@hydranium/glsp-server 1.0.0-next.12 → 1.0.0-next.127

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 (100) hide show
  1. package/README.md +20 -5
  2. package/lib/browser/start-glsp-server-in-worker.d.ts +30 -39
  3. package/lib/browser/start-glsp-server-in-worker.d.ts.map +1 -1
  4. package/lib/browser/start-glsp-server-in-worker.js +43 -8
  5. package/lib/browser/start-glsp-server-in-worker.js.map +1 -1
  6. package/lib/command/hydranium-glsp-command-stack.d.ts +27 -0
  7. package/lib/command/hydranium-glsp-command-stack.d.ts.map +1 -0
  8. package/lib/command/hydranium-glsp-command-stack.js +53 -0
  9. package/lib/command/hydranium-glsp-command-stack.js.map +1 -0
  10. package/lib/command/hydranium-glsp-recording-command.d.ts +22 -22
  11. package/lib/command/hydranium-glsp-recording-command.d.ts.map +1 -1
  12. package/lib/command/hydranium-glsp-recording-command.js +25 -26
  13. package/lib/command/hydranium-glsp-recording-command.js.map +1 -1
  14. package/lib/command/index.d.ts +1 -0
  15. package/lib/command/index.d.ts.map +1 -1
  16. package/lib/command/index.js +1 -0
  17. package/lib/command/index.js.map +1 -1
  18. package/lib/launcher/abstract-hydranium-glsp-diagram-module.d.ts +12 -3
  19. package/lib/launcher/abstract-hydranium-glsp-diagram-module.d.ts.map +1 -1
  20. package/lib/launcher/abstract-hydranium-glsp-diagram-module.js +18 -2
  21. package/lib/launcher/abstract-hydranium-glsp-diagram-module.js.map +1 -1
  22. package/lib/launcher/hydranium-glsp-server.d.ts +10 -6
  23. package/lib/launcher/hydranium-glsp-server.d.ts.map +1 -1
  24. package/lib/launcher/hydranium-glsp-server.js +16 -6
  25. package/lib/launcher/hydranium-glsp-server.js.map +1 -1
  26. package/lib/messages/index.d.ts +24 -0
  27. package/lib/messages/index.d.ts.map +1 -0
  28. package/lib/messages/index.js +24 -0
  29. package/lib/messages/index.js.map +1 -0
  30. package/lib/node/start-glsp-server.d.ts +1 -1
  31. package/lib/node/start-glsp-server.d.ts.map +1 -1
  32. package/lib/node/start-glsp-server.js +2 -2
  33. package/lib/node/start-glsp-server.js.map +1 -1
  34. package/lib/state/abstract-hydranium-glsp-state.d.ts +110 -43
  35. package/lib/state/abstract-hydranium-glsp-state.d.ts.map +1 -1
  36. package/lib/state/abstract-hydranium-glsp-state.js +139 -60
  37. package/lib/state/abstract-hydranium-glsp-state.js.map +1 -1
  38. package/lib/state/full-text-hydranium-glsp-state.d.ts +6 -6
  39. package/lib/state/full-text-hydranium-glsp-state.d.ts.map +1 -1
  40. package/lib/state/full-text-hydranium-glsp-state.js +6 -10
  41. package/lib/state/full-text-hydranium-glsp-state.js.map +1 -1
  42. package/lib/state/reconcile-source-model-write.d.ts +9 -8
  43. package/lib/state/reconcile-source-model-write.d.ts.map +1 -1
  44. package/lib/state/reconcile-source-model-write.js +8 -8
  45. package/lib/state/reconcile-source-model-write.js.map +1 -1
  46. package/lib/state/reconciling-multi-document-glsp-state.d.ts +59 -59
  47. package/lib/state/reconciling-multi-document-glsp-state.d.ts.map +1 -1
  48. package/lib/state/reconciling-multi-document-glsp-state.js +84 -82
  49. package/lib/state/reconciling-multi-document-glsp-state.js.map +1 -1
  50. package/lib/state/reconciling-transfer-hydranium-glsp-state.d.ts +19 -18
  51. package/lib/state/reconciling-transfer-hydranium-glsp-state.d.ts.map +1 -1
  52. package/lib/state/reconciling-transfer-hydranium-glsp-state.js +26 -30
  53. package/lib/state/reconciling-transfer-hydranium-glsp-state.js.map +1 -1
  54. package/lib/storage/hydranium-glsp-request-save-model-action-handler.d.ts +30 -0
  55. package/lib/storage/hydranium-glsp-request-save-model-action-handler.d.ts.map +1 -0
  56. package/lib/storage/hydranium-glsp-request-save-model-action-handler.js +47 -0
  57. package/lib/storage/hydranium-glsp-request-save-model-action-handler.js.map +1 -0
  58. package/lib/storage/hydranium-glsp-storage.d.ts +295 -79
  59. package/lib/storage/hydranium-glsp-storage.d.ts.map +1 -1
  60. package/lib/storage/hydranium-glsp-storage.js +435 -94
  61. package/lib/storage/hydranium-glsp-storage.js.map +1 -1
  62. package/lib/storage/index.d.ts +2 -1
  63. package/lib/storage/index.d.ts.map +1 -1
  64. package/lib/storage/index.js +2 -1
  65. package/lib/storage/index.js.map +1 -1
  66. package/lib/storage/save-delivery-policy.d.ts +46 -0
  67. package/lib/storage/save-delivery-policy.d.ts.map +1 -0
  68. package/lib/storage/{save-conflict-policy.js → save-delivery-policy.js} +7 -8
  69. package/lib/storage/save-delivery-policy.js.map +1 -0
  70. package/lib/validation/diagnostic-markers.d.ts +2 -2
  71. package/lib/validation/diagnostic-markers.d.ts.map +1 -1
  72. package/lib/validation/diagnostic-markers.js +7 -0
  73. package/lib/validation/diagnostic-markers.js.map +1 -1
  74. package/lib/validation/hydranium-glsp-model-validator.d.ts.map +1 -1
  75. package/lib/validation/hydranium-glsp-model-validator.js +1 -1
  76. package/lib/validation/hydranium-glsp-model-validator.js.map +1 -1
  77. package/package.json +17 -8
  78. package/src/browser/start-glsp-server-in-worker.ts +41 -44
  79. package/src/command/hydranium-glsp-command-stack.ts +36 -0
  80. package/src/command/hydranium-glsp-recording-command.ts +26 -26
  81. package/src/command/index.ts +1 -0
  82. package/src/launcher/abstract-hydranium-glsp-diagram-module.ts +27 -3
  83. package/src/launcher/hydranium-glsp-server.ts +16 -6
  84. package/src/messages/index.ts +30 -0
  85. package/src/node/start-glsp-server.ts +2 -3
  86. package/src/state/abstract-hydranium-glsp-state.ts +174 -73
  87. package/src/state/full-text-hydranium-glsp-state.ts +7 -11
  88. package/src/state/reconcile-source-model-write.ts +18 -15
  89. package/src/state/reconciling-multi-document-glsp-state.ts +86 -83
  90. package/src/state/reconciling-transfer-hydranium-glsp-state.ts +27 -31
  91. package/src/storage/hydranium-glsp-request-save-model-action-handler.ts +40 -0
  92. package/src/storage/hydranium-glsp-storage.ts +497 -103
  93. package/src/storage/index.ts +2 -1
  94. package/src/storage/save-delivery-policy.ts +44 -0
  95. package/src/validation/diagnostic-markers.ts +10 -3
  96. package/src/validation/hydranium-glsp-model-validator.ts +3 -3
  97. package/lib/storage/save-conflict-policy.d.ts +0 -56
  98. package/lib/storage/save-conflict-policy.d.ts.map +0 -1
  99. package/lib/storage/save-conflict-policy.js.map +0 -1
  100. package/src/storage/save-conflict-policy.ts +0 -52
@@ -28,16 +28,16 @@ import { reconcileSourceModelWrite } from './reconcile-source-model-write.js';
28
28
  * field-level shape is what lets `fast-json-patch` diff per field, so undo /
29
29
  * redo and forward-write reconcile act per field instead of clobbering the
30
30
  * whole document.
31
- * - {@link baseline} — the last in-sync projection, captured on every
31
+ * - {@link base} — the last in-sync projection, captured on every
32
32
  * {@link setSourceRoot}. A forward-write conflict reconciles the user's
33
- * intent (baseline → attempted) against the fresh server root.
33
+ * intent (base → ours) against the server's current root (theirs).
34
34
  * - {@link updateSourceModel} — the concrete reconcile template: persist,
35
35
  * and on a `ConflictError` consult the injected `conflictResolver` and act
36
36
  * on the merged / no-op / conflict / unavailable outcome.
37
37
  * - {@link persist} / {@link refetch} — the only I/O seams. Defaults route
38
- * through `ModelService.update` / `.validated` (reachable from the base via
39
- * `sharedServices.model`); adopters whose document round-trip differs
40
- * override these without touching the orchestration.
38
+ * through the diagram session's `update` and `ModelService.validated`;
39
+ * adopters whose document round-trip differs override these without
40
+ * touching the orchestration.
41
41
  *
42
42
  * Adopters whose source model is whole-document text (a bare `{ text }`
43
43
  * source model) or that are read-only do NOT extend this class — they extend
@@ -49,12 +49,12 @@ import { reconcileSourceModelWrite } from './reconcile-source-model-write.js';
49
49
  let ReconcilingTransferHydraniumGlspState = class ReconcilingTransferHydraniumGlspState extends AbstractHydraniumGlspState {
50
50
  /**
51
51
  * Last in-sync source-model projection, captured on every
52
- * {@link setSourceRoot} (initial load + post-update). The baseline a
52
+ * {@link setSourceRoot} (initial load + post-update). The base a
53
53
  * forward-write conflict reconciles against: it stays the pre-command
54
54
  * state because operation handlers mutate `_sourceRoot` in place during
55
55
  * `execute` while `setSourceRoot` only re-runs once the write commits.
56
56
  */
57
- baseline;
57
+ base;
58
58
  /**
59
59
  * Persisted-shape projection of the current source root, consumed by GLSP's
60
60
  * {@link JsonModelState} read side and recorded for field-level undo / redo.
@@ -68,27 +68,27 @@ let ReconcilingTransferHydraniumGlspState = class ReconcilingTransferHydraniumGl
68
68
  }
69
69
  setSourceRoot(uri, root) {
70
70
  super.setSourceRoot(uri, root);
71
- this.baseline = this.sourceModel;
71
+ this.base = this.sourceModel;
72
72
  }
73
73
  /**
74
74
  * Persist `model` back to the document store, then capture the resulting
75
75
  * AST root. On a `ConflictError` (the based-on version was superseded),
76
- * reconcile the user's intent against the fresh server root via the bound
76
+ * reconcile the user's intent against the server's current root via the bound
77
77
  * `conflictResolver` and act on the outcome — one declarative policy
78
78
  * (force = last-writer-wins, reconciling = field-level merge) shared with
79
79
  * undo / redo.
80
80
  */
81
- async updateSourceModel(model, version) {
81
+ async updateSourceModel(model, basedOn = this.basedOn) {
82
82
  // Orchestration lives in `reconcileSourceModelWrite` so the multi-document
83
83
  // state gets the identical conflict handling; this method supplies only
84
84
  // the single-document meaning of persist / project.
85
- return reconcileSourceModelWrite(model, version, {
86
- persist: async (candidate, baseVersion) => {
87
- const { root } = await this.persist(candidate, baseVersion);
85
+ return reconcileSourceModelWrite(model, basedOn, {
86
+ persist: async (candidate, candidateBasedOn) => {
87
+ const { root } = await this.persist(candidate, candidateBasedOn);
88
88
  this.setSourceRoot(this._sourceUri, root);
89
89
  },
90
90
  refetch: () => this.refetch(),
91
- baseline: this.baseline,
91
+ base: this.base,
92
92
  conflictResolver: this.conflictResolver,
93
93
  logger: this.logger,
94
94
  onConflictDropped: () => this.refreshSourceRoot()
@@ -96,30 +96,26 @@ let ReconcilingTransferHydraniumGlspState = class ReconcilingTransferHydraniumGl
96
96
  }
97
97
  /**
98
98
  * Persist hook — the only write-side I/O. Default routes the structured
99
- * model through `ModelService.update` (serialize → reparse), opting into
100
- * the `ConflictError` gate when `version` is given. Adopters whose document
99
+ * model through the diagram session's `update` (serialize → reparse),
100
+ * opting into the `ConflictError` gate unless `basedOn` is `'anything'`,
101
+ * and throws without a session. Adopters whose document
101
102
  * round-trip differs override this; the orchestration in
102
103
  * {@link updateSourceModel} is unchanged.
103
104
  */
104
- async persist(model, baseVersion) {
105
- const document = await this.sharedServices.model.ModelService.update({
106
- uri: this._sourceUri,
107
- model,
108
- clientId: this.clientId,
109
- baseVersion
110
- });
105
+ async persist(model, basedOn) {
106
+ const document = await this.requireModelSession().update({ uri: this._sourceUri, model, basedOn });
111
107
  return document;
112
108
  }
113
109
  /**
114
- * Refetch hook — reads the current settled server root as a persisted-shape
115
- * projection (or `undefined` when unavailable). The `conflictResolver`
116
- * replays the user's intent against this fresh state. Default uses
117
- * `ModelService.validated` + the framework encoder's `'grammar'` mode;
118
- * adopters override alongside {@link persist}.
110
+ * Refetch hook — the stored text parsed afresh, as a persisted-shape
111
+ * projection (or `undefined` when unavailable): theirs, which the
112
+ * `conflictResolver` replays the user's intent onto. Default uses
113
+ * {@link AbstractHydraniumGlspState.readCurrentRoot} + the framework
114
+ * encoder's `'grammar'` mode; adopters override alongside {@link persist}.
119
115
  */
120
116
  async refetch() {
121
- const fresh = await this.sharedServices.model.ModelService.validated(this._sourceUri).catch(() => undefined);
122
- return fresh ? this.sharedServices.model.TransferEncoder.toTransfer(fresh.root, 'grammar') : undefined;
117
+ const theirs = await this.readCurrentRoot(this._sourceUri);
118
+ return theirs ? this.sharedServices.model.TransferEncoder.toTransfer(theirs, 'grammar') : undefined;
123
119
  }
124
120
  };
125
121
  ReconcilingTransferHydraniumGlspState = __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"reconciling-transfer-hydranium-glsp-state.js","sourceRoot":"","sources":["../../src/state/reconciling-transfer-hydranium-glsp-state.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;;;;;;;AAGlF,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAGvC,OAAO,EAAE,0BAA0B,EAAE,MAAM,oC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OAMG;IACO,KAAK,CAAC,OAAO,CAAC,KAAmB,EAAE,WAAoB;QAC9D,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC;YAClE,GAAG,EAAE,IAAI,CAAC,UAAU;YACpB,KAAK;YACL,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,WAAW;SACb,CAAC,CAAC;QACH,OAAO,QAAsC,CAAC;IACjD,CAAC;IAED;;;;;;OAMG;IACO,KAAK,CAAC,OAAO;QACpB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAC7G,OAAO,KAAK,CAAC,CAAC,CAAE,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,eAAe,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAA6B,CAAC,CAAC,CAAC,SAAS,CAAC;IACvI,CAAC;CACH,CAAA;AAnFY,qCAAqC;IADjD,UAAU,EAAE;GACA,qCAAqC,CAmFjD"}
1
+ {"version":3,"file":"reconciling-transfer-hydranium-glsp-state.js","sourceRoot":"","sources":["../../src/state/reconciling-transfer-hydranium-glsp-state.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;;;;;;;AAGlF,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAGvC,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAE9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEI,IAAM,qCAAqC,GAA3C,MAAM,qCACV,SAAQ,0BAA+C;IAGvD;;;;;;OAMG;IACO,IAAI,CAAgB;IAE9B;;;;;;;OAOG;IACH,IAAI,WAAW;QACZ,O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C;IACjD,CAAC;IAED;;;;;;OAMG;IACO,KAAK,CAAC,OAAO;QACpB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3D,OAAO,MAAM,CAAC,CAAC,CAAE,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,eAAe,CAAC,UAAU,CAAC,MAAM,EAAE,SAAS,CAA6B,CAAC,CAAC,CAAC,SAAS,CAAC;IACpI,CAAC;CACH,CAAA;AA/EY,qCAAqC;IADjD,UAAU,EAAE;GACA,qCAAqC,CA+EjD"}
@@ -0,0 +1,30 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ import { type Action, SaveModelActionHandler } from '@eclipse-glsp/server';
10
+ /**
11
+ * Answers a {@link RequestSaveModelAction}: saves exactly as GLSP's
12
+ * {@link SaveModelActionHandler} saves a `SaveModelAction` carrying the same
13
+ * `fileUri`, dirty-state change included, then replies with a
14
+ * {@link ModelSavedAction}.
15
+ *
16
+ * A failed save throws, and the server turns the throw into a `RejectAction`
17
+ * for the request. The save handler's own `SaveModelAction` stays registered,
18
+ * so a client that sends it is unaffected.
19
+ *
20
+ * `AbstractHydraniumGlspDiagramModule` registers it. A diagram module that does
21
+ * not extend that base adds it in `configureActionHandlers`. Without it no
22
+ * handler is advertised for the request, and the Theia client saves as GLSP's
23
+ * saveable does: a save nothing answers, so a failed one surfaces only as a
24
+ * timeout, and a window can close over a save still under way.
25
+ */
26
+ export declare class HydraniumGlspRequestSaveModelActionHandler extends SaveModelActionHandler {
27
+ actionKinds: string[];
28
+ execute(action: Action): Promise<Action[]>;
29
+ }
30
+ //# sourceMappingURL=hydranium-glsp-request-save-model-action-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hydranium-glsp-request-save-model-action-handler.d.ts","sourceRoot":"","sources":["../../src/storage/hydranium-glsp-request-save-model-action-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,MAAM,EAAmB,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAI5F;;;;;;;;;;;;;;;GAeG;AACH,qBACa,0CAA2C,SAAQ,sBAAsB;IAC1E,WAAW,WAAiC;IAGtC,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAK3D"}
@@ -0,0 +1,47 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
10
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
13
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
14
+ };
15
+ import { SaveModelAction, SaveModelActionHandler } from '@eclipse-glsp/server';
16
+ import { ModelSavedAction, RequestSaveModelAction } from '@hydranium/protocol';
17
+ import { injectable } from 'inversify';
18
+ /**
19
+ * Answers a {@link RequestSaveModelAction}: saves exactly as GLSP's
20
+ * {@link SaveModelActionHandler} saves a `SaveModelAction` carrying the same
21
+ * `fileUri`, dirty-state change included, then replies with a
22
+ * {@link ModelSavedAction}.
23
+ *
24
+ * A failed save throws, and the server turns the throw into a `RejectAction`
25
+ * for the request. The save handler's own `SaveModelAction` stays registered,
26
+ * so a client that sends it is unaffected.
27
+ *
28
+ * `AbstractHydraniumGlspDiagramModule` registers it. A diagram module that does
29
+ * not extend that base adds it in `configureActionHandlers`. Without it no
30
+ * handler is advertised for the request, and the Theia client saves as GLSP's
31
+ * saveable does: a save nothing answers, so a failed one surfaces only as a
32
+ * timeout, and a window can close over a save still under way.
33
+ */
34
+ let HydraniumGlspRequestSaveModelActionHandler = class HydraniumGlspRequestSaveModelActionHandler extends SaveModelActionHandler {
35
+ actionKinds = [RequestSaveModelAction.KIND];
36
+ // Typed `Action`, the one parameter type both this kind and the base's accept.
37
+ async execute(action) {
38
+ const fileUri = 'fileUri' in action && typeof action.fileUri === 'string' ? action.fileUri : undefined;
39
+ const actions = await super.execute(SaveModelAction.create({ fileUri }));
40
+ return [...actions, ModelSavedAction.create()];
41
+ }
42
+ };
43
+ HydraniumGlspRequestSaveModelActionHandler = __decorate([
44
+ injectable()
45
+ ], HydraniumGlspRequestSaveModelActionHandler);
46
+ export { HydraniumGlspRequestSaveModelActionHandler };
47
+ //# sourceMappingURL=hydranium-glsp-request-save-model-action-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hydranium-glsp-request-save-model-action-handler.js","sourceRoot":"","sources":["../../src/storage/hydranium-glsp-request-save-model-action-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;;;;;;;AAElF,OAAO,EAAe,eAAe,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC;;;;;;;;;;;;;;;GAeG;AAEI,IAAM,0CAA0C,GAAhD,MAAM,0CAA2C,SAAQ,sBAAsB;IAC1E,WAAW,GAAG,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;IAErD,+EAA+E;IACtE,KAAK,CAAC,OAAO,CAAC,MAAc;QAClC,MAAM,OAAO,GAAG,SAAS,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;QACvG,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;QACzE,OAAO,CAAC,GAAG,OAAO,EAAE,gBAAgB,CAAC,MAAM,EAAE,CAAC,CAAC;IAClD,CAAC;CACH,CAAA;AATY,0CAA0C;IADtD,UAAU,EAAE;GACA,0CAA0C,CAStD"}