@equinor/roma-framework 5.0.0 → 6.0.0

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 (127) hide show
  1. package/_commonjsHelpers-DKlypwS6.mjs +3277 -0
  2. package/cypress.mjs +31958 -49
  3. package/dev-portal/BAGVG3AX-CZ4YnljQ.mjs +37 -0
  4. package/dev-portal/KZB72KQG-Dk7Ih0xn.mjs +46 -0
  5. package/dev-portal/NITRNJ62-7tOtp9d-.mjs +12375 -0
  6. package/dev-portal/index-DYpA1xV-.mjs +102056 -0
  7. package/dev-portal/index.html +3 -2
  8. package/dev-portal/lib/api/roma/api/alarm-controller/alarm-controller.d.ts +97 -0
  9. package/dev-portal/lib/api/roma/api/alarm-group-controller/alarm-group-controller.d.ts +186 -0
  10. package/dev-portal/lib/api/roma/api/alarm-sse-controller/alarm-sse-controller.d.ts +36 -0
  11. package/dev-portal/lib/api/roma/api/app-controller/app-controller.d.ts +65 -31
  12. package/dev-portal/lib/api/roma/api/category-controller/category-controller.d.ts +57 -26
  13. package/dev-portal/lib/api/roma/api/environment-controller/environment-controller.d.ts +23 -10
  14. package/dev-portal/lib/api/roma/api/feedback-controller/feedback-controller.d.ts +29 -13
  15. package/dev-portal/lib/api/roma/api/health-controller/health-controller.d.ts +38 -0
  16. package/dev-portal/lib/api/roma/api/roma-configuration-controller/roma-configuration-controller.d.ts +99 -41
  17. package/dev-portal/lib/api/roma/api/server-side-event-controller/server-side-event-controller.d.ts +23 -7
  18. package/dev-portal/lib/api/roma/api/service-controller/service-controller.d.ts +57 -26
  19. package/dev-portal/lib/api/roma/api/setting-controller/setting-controller.d.ts +114 -47
  20. package/dev-portal/lib/api/roma/index.d.ts +4 -0
  21. package/dev-portal/lib/api/roma/model/adminDto.d.ts +6 -0
  22. package/dev-portal/lib/api/roma/model/adminDtoAdminType.d.ts +12 -0
  23. package/dev-portal/lib/api/roma/model/alarmDto.d.ts +19 -0
  24. package/dev-portal/lib/api/roma/model/alarmDtoPayload.d.ts +10 -0
  25. package/dev-portal/lib/api/roma/model/alarmDtoSeverity.d.ts +14 -0
  26. package/dev-portal/lib/api/roma/model/alarmDtoState.d.ts +12 -0
  27. package/dev-portal/lib/api/roma/model/alarmGroupDto.d.ts +16 -0
  28. package/dev-portal/lib/api/roma/model/appDto.d.ts +36 -11
  29. package/dev-portal/lib/api/roma/model/buildDto.d.ts +14 -0
  30. package/dev-portal/lib/api/roma/model/categoryDto.d.ts +4 -3
  31. package/dev-portal/lib/api/roma/model/clearAlarmRequest.d.ts +13 -0
  32. package/dev-portal/lib/api/roma/model/configDto.d.ts +6 -0
  33. package/dev-portal/lib/api/roma/model/environmentDto.d.ts +4 -4
  34. package/dev-portal/lib/api/roma/model/feedbackDetailsDto.d.ts +6 -3
  35. package/dev-portal/lib/api/roma/model/feedbackDto.d.ts +1 -1
  36. package/dev-portal/lib/api/roma/model/feedbackExpandedResponseDetailsDto.d.ts +7 -3
  37. package/dev-portal/lib/api/roma/model/feedbackExpandedResponseIssueDto.d.ts +3 -1
  38. package/dev-portal/lib/api/roma/model/feedbackPage.d.ts +7 -7
  39. package/dev-portal/lib/api/roma/model/feedbackResponseIssueDto.d.ts +3 -1
  40. package/dev-portal/lib/api/roma/model/feedbackSolutionDto.d.ts +2 -1
  41. package/dev-portal/lib/api/roma/model/getAllParams.d.ts +14 -0
  42. package/dev-portal/lib/api/roma/model/getAllRomaConfigurationTypes200Item.d.ts +1 -1
  43. package/dev-portal/lib/api/roma/model/index.d.ts +17 -1
  44. package/dev-portal/lib/api/roma/model/listFeedbacksByCurrentUserParams.d.ts +1 -1
  45. package/dev-portal/lib/api/roma/model/pageableObject.d.ts +2 -2
  46. package/dev-portal/lib/api/roma/model/raiseAlarmRequest.d.ts +15 -0
  47. package/dev-portal/lib/api/roma/model/raiseAlarmRequestPayload.d.ts +10 -0
  48. package/dev-portal/lib/api/roma/model/raiseAlarmRequestSeverity.d.ts +14 -0
  49. package/dev-portal/lib/api/roma/model/romaConfigurationDto.d.ts +10 -2
  50. package/dev-portal/lib/api/roma/model/serverSentEventAlarmDto.d.ts +9 -0
  51. package/dev-portal/lib/api/roma/model/serverSentEventStandardEventDto.d.ts +1 -2
  52. package/dev-portal/lib/api/roma/model/serviceDto.d.ts +13 -4
  53. package/dev-portal/lib/api/roma/model/settingDto.d.ts +10 -4
  54. package/dev-portal/lib/api/roma/model/sortObject.d.ts +3 -3
  55. package/dev-portal/lib/api/roma/model/uploadBundleBody.d.ts +1 -1
  56. package/dev-portal/lib/api/roma/model/versionDto.d.ts +4 -4
  57. package/dev-portal/lib/api/roma/model/visualizationDto.d.ts +12 -0
  58. package/dev-portal/lib/api/roma/use-client.d.ts +7 -7
  59. package/dev-portal/lib/dev-portal/AppLoader.d.ts +7 -1
  60. package/dev-portal/lib/dev-portal/AppViewer.d.ts +10 -0
  61. package/dev-portal/lib/dev-portal/EquinorLoader.d.ts +2 -2
  62. package/dev-portal/lib/dev-portal/PortalStyles.d.ts +26 -1361
  63. package/dev-portal/lib/dev-portal/config/AppClient.d.ts +26 -16
  64. package/dev-portal/lib/style-provider.d.ts +2 -1
  65. package/dev-portal/package.json +41 -4
  66. package/dev-portal/roma-framework.css +478 -0
  67. package/lib/api/roma/api/alarm-controller/alarm-controller.d.ts +97 -0
  68. package/lib/api/roma/api/alarm-group-controller/alarm-group-controller.d.ts +186 -0
  69. package/lib/api/roma/api/alarm-sse-controller/alarm-sse-controller.d.ts +36 -0
  70. package/lib/api/roma/api/app-controller/app-controller.d.ts +65 -31
  71. package/lib/api/roma/api/category-controller/category-controller.d.ts +57 -26
  72. package/lib/api/roma/api/environment-controller/environment-controller.d.ts +23 -10
  73. package/lib/api/roma/api/feedback-controller/feedback-controller.d.ts +29 -13
  74. package/lib/api/roma/api/health-controller/health-controller.d.ts +38 -0
  75. package/lib/api/roma/api/roma-configuration-controller/roma-configuration-controller.d.ts +99 -41
  76. package/lib/api/roma/api/server-side-event-controller/server-side-event-controller.d.ts +23 -7
  77. package/lib/api/roma/api/service-controller/service-controller.d.ts +57 -26
  78. package/lib/api/roma/api/setting-controller/setting-controller.d.ts +114 -47
  79. package/lib/api/roma/index.d.ts +4 -0
  80. package/lib/api/roma/model/adminDto.d.ts +6 -0
  81. package/lib/api/roma/model/adminDtoAdminType.d.ts +12 -0
  82. package/lib/api/roma/model/alarmDto.d.ts +19 -0
  83. package/lib/api/roma/model/alarmDtoPayload.d.ts +10 -0
  84. package/lib/api/roma/model/alarmDtoSeverity.d.ts +14 -0
  85. package/lib/api/roma/model/alarmDtoState.d.ts +12 -0
  86. package/lib/api/roma/model/alarmGroupDto.d.ts +16 -0
  87. package/lib/api/roma/model/appDto.d.ts +36 -11
  88. package/lib/api/roma/model/buildDto.d.ts +14 -0
  89. package/lib/api/roma/model/categoryDto.d.ts +4 -3
  90. package/lib/api/roma/model/clearAlarmRequest.d.ts +13 -0
  91. package/lib/api/roma/model/configDto.d.ts +6 -0
  92. package/lib/api/roma/model/environmentDto.d.ts +4 -4
  93. package/lib/api/roma/model/feedbackDetailsDto.d.ts +6 -3
  94. package/lib/api/roma/model/feedbackDto.d.ts +1 -1
  95. package/lib/api/roma/model/feedbackExpandedResponseDetailsDto.d.ts +7 -3
  96. package/lib/api/roma/model/feedbackExpandedResponseIssueDto.d.ts +3 -1
  97. package/lib/api/roma/model/feedbackPage.d.ts +7 -7
  98. package/lib/api/roma/model/feedbackResponseIssueDto.d.ts +3 -1
  99. package/lib/api/roma/model/feedbackSolutionDto.d.ts +2 -1
  100. package/lib/api/roma/model/getAllParams.d.ts +14 -0
  101. package/lib/api/roma/model/getAllRomaConfigurationTypes200Item.d.ts +1 -1
  102. package/lib/api/roma/model/index.d.ts +17 -1
  103. package/lib/api/roma/model/listFeedbacksByCurrentUserParams.d.ts +1 -1
  104. package/lib/api/roma/model/pageableObject.d.ts +2 -2
  105. package/lib/api/roma/model/raiseAlarmRequest.d.ts +15 -0
  106. package/lib/api/roma/model/raiseAlarmRequestPayload.d.ts +10 -0
  107. package/lib/api/roma/model/raiseAlarmRequestSeverity.d.ts +14 -0
  108. package/lib/api/roma/model/romaConfigurationDto.d.ts +10 -2
  109. package/lib/api/roma/model/serverSentEventAlarmDto.d.ts +9 -0
  110. package/lib/api/roma/model/serverSentEventStandardEventDto.d.ts +1 -2
  111. package/lib/api/roma/model/serviceDto.d.ts +13 -4
  112. package/lib/api/roma/model/settingDto.d.ts +10 -4
  113. package/lib/api/roma/model/sortObject.d.ts +3 -3
  114. package/lib/api/roma/model/uploadBundleBody.d.ts +1 -1
  115. package/lib/api/roma/model/versionDto.d.ts +4 -4
  116. package/lib/api/roma/model/visualizationDto.d.ts +12 -0
  117. package/lib/api/roma/use-client.d.ts +7 -7
  118. package/lib/dev-portal/AppLoader.d.ts +7 -1
  119. package/lib/dev-portal/AppViewer.d.ts +10 -0
  120. package/lib/dev-portal/EquinorLoader.d.ts +2 -2
  121. package/lib/dev-portal/PortalStyles.d.ts +26 -1361
  122. package/lib/dev-portal/config/AppClient.d.ts +26 -16
  123. package/lib/style-provider.d.ts +2 -1
  124. package/package.json +41 -4
  125. package/roma-framework.mjs +1401 -1252
  126. package/dev-portal/roma-framework.umd.js +0 -107649
  127. package/router-lZjM0_Ti.mjs +0 -6053
@@ -0,0 +1,3277 @@
1
+ import * as React3 from "react";
2
+ var extendStatics = function(d, b) {
3
+ extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
4
+ d2.__proto__ = b2;
5
+ } || function(d2, b2) {
6
+ for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p];
7
+ };
8
+ return extendStatics(d, b);
9
+ };
10
+ function __extends(d, b) {
11
+ if (typeof b !== "function" && b !== null)
12
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
13
+ extendStatics(d, b);
14
+ function __() {
15
+ this.constructor = d;
16
+ }
17
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
18
+ }
19
+ function __awaiter(thisArg, _arguments, P, generator) {
20
+ function adopt(value) {
21
+ return value instanceof P ? value : new P(function(resolve) {
22
+ resolve(value);
23
+ });
24
+ }
25
+ return new (P || (P = Promise))(function(resolve, reject) {
26
+ function fulfilled(value) {
27
+ try {
28
+ step(generator.next(value));
29
+ } catch (e) {
30
+ reject(e);
31
+ }
32
+ }
33
+ function rejected(value) {
34
+ try {
35
+ step(generator["throw"](value));
36
+ } catch (e) {
37
+ reject(e);
38
+ }
39
+ }
40
+ function step(result) {
41
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
42
+ }
43
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
44
+ });
45
+ }
46
+ function __generator(thisArg, body) {
47
+ var _ = { label: 0, sent: function() {
48
+ if (t[0] & 1) throw t[1];
49
+ return t[1];
50
+ }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
51
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
52
+ return this;
53
+ }), g;
54
+ function verb(n) {
55
+ return function(v) {
56
+ return step([n, v]);
57
+ };
58
+ }
59
+ function step(op) {
60
+ if (f) throw new TypeError("Generator is already executing.");
61
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
62
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
63
+ if (y = 0, t) op = [op[0] & 2, t.value];
64
+ switch (op[0]) {
65
+ case 0:
66
+ case 1:
67
+ t = op;
68
+ break;
69
+ case 4:
70
+ _.label++;
71
+ return { value: op[1], done: false };
72
+ case 5:
73
+ _.label++;
74
+ y = op[1];
75
+ op = [0];
76
+ continue;
77
+ case 7:
78
+ op = _.ops.pop();
79
+ _.trys.pop();
80
+ continue;
81
+ default:
82
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
83
+ _ = 0;
84
+ continue;
85
+ }
86
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
87
+ _.label = op[1];
88
+ break;
89
+ }
90
+ if (op[0] === 6 && _.label < t[1]) {
91
+ _.label = t[1];
92
+ t = op;
93
+ break;
94
+ }
95
+ if (t && _.label < t[2]) {
96
+ _.label = t[2];
97
+ _.ops.push(op);
98
+ break;
99
+ }
100
+ if (t[2]) _.ops.pop();
101
+ _.trys.pop();
102
+ continue;
103
+ }
104
+ op = body.call(thisArg, _);
105
+ } catch (e) {
106
+ op = [6, e];
107
+ y = 0;
108
+ } finally {
109
+ f = t = 0;
110
+ }
111
+ if (op[0] & 5) throw op[1];
112
+ return { value: op[0] ? op[1] : void 0, done: true };
113
+ }
114
+ }
115
+ function __values(o) {
116
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
117
+ if (m) return m.call(o);
118
+ if (o && typeof o.length === "number") return {
119
+ next: function() {
120
+ if (o && i >= o.length) o = void 0;
121
+ return { value: o && o[i++], done: !o };
122
+ }
123
+ };
124
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
125
+ }
126
+ function __read(o, n) {
127
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
128
+ if (!m) return o;
129
+ var i = m.call(o), r, ar = [], e;
130
+ try {
131
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
132
+ } catch (error) {
133
+ e = { error };
134
+ } finally {
135
+ try {
136
+ if (r && !r.done && (m = i["return"])) m.call(i);
137
+ } finally {
138
+ if (e) throw e.error;
139
+ }
140
+ }
141
+ return ar;
142
+ }
143
+ function __spreadArray(to, from2, pack) {
144
+ if (pack || arguments.length === 2) for (var i = 0, l = from2.length, ar; i < l; i++) {
145
+ if (ar || !(i in from2)) {
146
+ if (!ar) ar = Array.prototype.slice.call(from2, 0, i);
147
+ ar[i] = from2[i];
148
+ }
149
+ }
150
+ return to.concat(ar || Array.prototype.slice.call(from2));
151
+ }
152
+ function __await(v) {
153
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
154
+ }
155
+ function __asyncGenerator(thisArg, _arguments, generator) {
156
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
157
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
158
+ return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() {
159
+ return this;
160
+ }, i;
161
+ function awaitReturn(f) {
162
+ return function(v) {
163
+ return Promise.resolve(v).then(f, reject);
164
+ };
165
+ }
166
+ function verb(n, f) {
167
+ if (g[n]) {
168
+ i[n] = function(v) {
169
+ return new Promise(function(a, b) {
170
+ q.push([n, v, a, b]) > 1 || resume(n, v);
171
+ });
172
+ };
173
+ if (f) i[n] = f(i[n]);
174
+ }
175
+ }
176
+ function resume(n, v) {
177
+ try {
178
+ step(g[n](v));
179
+ } catch (e) {
180
+ settle(q[0][3], e);
181
+ }
182
+ }
183
+ function step(r) {
184
+ r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
185
+ }
186
+ function fulfill(value) {
187
+ resume("next", value);
188
+ }
189
+ function reject(value) {
190
+ resume("throw", value);
191
+ }
192
+ function settle(f, v) {
193
+ if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);
194
+ }
195
+ }
196
+ function __asyncValues(o) {
197
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
198
+ var m = o[Symbol.asyncIterator], i;
199
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
200
+ return this;
201
+ }, i);
202
+ function verb(n) {
203
+ i[n] = o[n] && function(v) {
204
+ return new Promise(function(resolve, reject) {
205
+ v = o[n](v), settle(resolve, reject, v.done, v.value);
206
+ });
207
+ };
208
+ }
209
+ function settle(resolve, reject, d, v) {
210
+ Promise.resolve(v).then(function(v2) {
211
+ resolve({ value: v2, done: d });
212
+ }, reject);
213
+ }
214
+ }
215
+ typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
216
+ var e = new Error(message);
217
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
218
+ };
219
+ function isFunction(value) {
220
+ return typeof value === "function";
221
+ }
222
+ function createErrorClass(createImpl) {
223
+ var _super = function(instance) {
224
+ Error.call(instance);
225
+ instance.stack = new Error().stack;
226
+ };
227
+ var ctorFunc = createImpl(_super);
228
+ ctorFunc.prototype = Object.create(Error.prototype);
229
+ ctorFunc.prototype.constructor = ctorFunc;
230
+ return ctorFunc;
231
+ }
232
+ var UnsubscriptionError = createErrorClass(function(_super) {
233
+ return function UnsubscriptionErrorImpl(errors) {
234
+ _super(this);
235
+ this.message = errors ? errors.length + " errors occurred during unsubscription:\n" + errors.map(function(err, i) {
236
+ return i + 1 + ") " + err.toString();
237
+ }).join("\n ") : "";
238
+ this.name = "UnsubscriptionError";
239
+ this.errors = errors;
240
+ };
241
+ });
242
+ function arrRemove(arr, item) {
243
+ if (arr) {
244
+ var index = arr.indexOf(item);
245
+ 0 <= index && arr.splice(index, 1);
246
+ }
247
+ }
248
+ var Subscription = (function() {
249
+ function Subscription2(initialTeardown) {
250
+ this.initialTeardown = initialTeardown;
251
+ this.closed = false;
252
+ this._parentage = null;
253
+ this._finalizers = null;
254
+ }
255
+ Subscription2.prototype.unsubscribe = function() {
256
+ var e_1, _a, e_2, _b;
257
+ var errors;
258
+ if (!this.closed) {
259
+ this.closed = true;
260
+ var _parentage = this._parentage;
261
+ if (_parentage) {
262
+ this._parentage = null;
263
+ if (Array.isArray(_parentage)) {
264
+ try {
265
+ for (var _parentage_1 = __values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {
266
+ var parent_1 = _parentage_1_1.value;
267
+ parent_1.remove(this);
268
+ }
269
+ } catch (e_1_1) {
270
+ e_1 = { error: e_1_1 };
271
+ } finally {
272
+ try {
273
+ if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return)) _a.call(_parentage_1);
274
+ } finally {
275
+ if (e_1) throw e_1.error;
276
+ }
277
+ }
278
+ } else {
279
+ _parentage.remove(this);
280
+ }
281
+ }
282
+ var initialFinalizer = this.initialTeardown;
283
+ if (isFunction(initialFinalizer)) {
284
+ try {
285
+ initialFinalizer();
286
+ } catch (e) {
287
+ errors = e instanceof UnsubscriptionError ? e.errors : [e];
288
+ }
289
+ }
290
+ var _finalizers = this._finalizers;
291
+ if (_finalizers) {
292
+ this._finalizers = null;
293
+ try {
294
+ for (var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
295
+ var finalizer = _finalizers_1_1.value;
296
+ try {
297
+ execFinalizer(finalizer);
298
+ } catch (err) {
299
+ errors = errors !== null && errors !== void 0 ? errors : [];
300
+ if (err instanceof UnsubscriptionError) {
301
+ errors = __spreadArray(__spreadArray([], __read(errors)), __read(err.errors));
302
+ } else {
303
+ errors.push(err);
304
+ }
305
+ }
306
+ }
307
+ } catch (e_2_1) {
308
+ e_2 = { error: e_2_1 };
309
+ } finally {
310
+ try {
311
+ if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) _b.call(_finalizers_1);
312
+ } finally {
313
+ if (e_2) throw e_2.error;
314
+ }
315
+ }
316
+ }
317
+ if (errors) {
318
+ throw new UnsubscriptionError(errors);
319
+ }
320
+ }
321
+ };
322
+ Subscription2.prototype.add = function(teardown) {
323
+ var _a;
324
+ if (teardown && teardown !== this) {
325
+ if (this.closed) {
326
+ execFinalizer(teardown);
327
+ } else {
328
+ if (teardown instanceof Subscription2) {
329
+ if (teardown.closed || teardown._hasParent(this)) {
330
+ return;
331
+ }
332
+ teardown._addParent(this);
333
+ }
334
+ (this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
335
+ }
336
+ }
337
+ };
338
+ Subscription2.prototype._hasParent = function(parent) {
339
+ var _parentage = this._parentage;
340
+ return _parentage === parent || Array.isArray(_parentage) && _parentage.includes(parent);
341
+ };
342
+ Subscription2.prototype._addParent = function(parent) {
343
+ var _parentage = this._parentage;
344
+ this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
345
+ };
346
+ Subscription2.prototype._removeParent = function(parent) {
347
+ var _parentage = this._parentage;
348
+ if (_parentage === parent) {
349
+ this._parentage = null;
350
+ } else if (Array.isArray(_parentage)) {
351
+ arrRemove(_parentage, parent);
352
+ }
353
+ };
354
+ Subscription2.prototype.remove = function(teardown) {
355
+ var _finalizers = this._finalizers;
356
+ _finalizers && arrRemove(_finalizers, teardown);
357
+ if (teardown instanceof Subscription2) {
358
+ teardown._removeParent(this);
359
+ }
360
+ };
361
+ Subscription2.EMPTY = (function() {
362
+ var empty = new Subscription2();
363
+ empty.closed = true;
364
+ return empty;
365
+ })();
366
+ return Subscription2;
367
+ })();
368
+ var EMPTY_SUBSCRIPTION = Subscription.EMPTY;
369
+ function isSubscription(value) {
370
+ return value instanceof Subscription || value && "closed" in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe);
371
+ }
372
+ function execFinalizer(finalizer) {
373
+ if (isFunction(finalizer)) {
374
+ finalizer();
375
+ } else {
376
+ finalizer.unsubscribe();
377
+ }
378
+ }
379
+ var config = {
380
+ Promise: void 0
381
+ };
382
+ var timeoutProvider = {
383
+ setTimeout: function(handler, timeout) {
384
+ var args = [];
385
+ for (var _i = 2; _i < arguments.length; _i++) {
386
+ args[_i - 2] = arguments[_i];
387
+ }
388
+ return setTimeout.apply(void 0, __spreadArray([handler, timeout], __read(args)));
389
+ },
390
+ clearTimeout: function(handle) {
391
+ return clearTimeout(handle);
392
+ },
393
+ delegate: void 0
394
+ };
395
+ function reportUnhandledError(err) {
396
+ timeoutProvider.setTimeout(function() {
397
+ {
398
+ throw err;
399
+ }
400
+ });
401
+ }
402
+ function noop() {
403
+ }
404
+ function errorContext(cb) {
405
+ {
406
+ cb();
407
+ }
408
+ }
409
+ var Subscriber = (function(_super) {
410
+ __extends(Subscriber2, _super);
411
+ function Subscriber2(destination) {
412
+ var _this = _super.call(this) || this;
413
+ _this.isStopped = false;
414
+ if (destination) {
415
+ _this.destination = destination;
416
+ if (isSubscription(destination)) {
417
+ destination.add(_this);
418
+ }
419
+ } else {
420
+ _this.destination = EMPTY_OBSERVER;
421
+ }
422
+ return _this;
423
+ }
424
+ Subscriber2.create = function(next, error, complete) {
425
+ return new SafeSubscriber(next, error, complete);
426
+ };
427
+ Subscriber2.prototype.next = function(value) {
428
+ if (this.isStopped) ;
429
+ else {
430
+ this._next(value);
431
+ }
432
+ };
433
+ Subscriber2.prototype.error = function(err) {
434
+ if (this.isStopped) ;
435
+ else {
436
+ this.isStopped = true;
437
+ this._error(err);
438
+ }
439
+ };
440
+ Subscriber2.prototype.complete = function() {
441
+ if (this.isStopped) ;
442
+ else {
443
+ this.isStopped = true;
444
+ this._complete();
445
+ }
446
+ };
447
+ Subscriber2.prototype.unsubscribe = function() {
448
+ if (!this.closed) {
449
+ this.isStopped = true;
450
+ _super.prototype.unsubscribe.call(this);
451
+ this.destination = null;
452
+ }
453
+ };
454
+ Subscriber2.prototype._next = function(value) {
455
+ this.destination.next(value);
456
+ };
457
+ Subscriber2.prototype._error = function(err) {
458
+ try {
459
+ this.destination.error(err);
460
+ } finally {
461
+ this.unsubscribe();
462
+ }
463
+ };
464
+ Subscriber2.prototype._complete = function() {
465
+ try {
466
+ this.destination.complete();
467
+ } finally {
468
+ this.unsubscribe();
469
+ }
470
+ };
471
+ return Subscriber2;
472
+ })(Subscription);
473
+ var ConsumerObserver = (function() {
474
+ function ConsumerObserver2(partialObserver) {
475
+ this.partialObserver = partialObserver;
476
+ }
477
+ ConsumerObserver2.prototype.next = function(value) {
478
+ var partialObserver = this.partialObserver;
479
+ if (partialObserver.next) {
480
+ try {
481
+ partialObserver.next(value);
482
+ } catch (error) {
483
+ handleUnhandledError(error);
484
+ }
485
+ }
486
+ };
487
+ ConsumerObserver2.prototype.error = function(err) {
488
+ var partialObserver = this.partialObserver;
489
+ if (partialObserver.error) {
490
+ try {
491
+ partialObserver.error(err);
492
+ } catch (error) {
493
+ handleUnhandledError(error);
494
+ }
495
+ } else {
496
+ handleUnhandledError(err);
497
+ }
498
+ };
499
+ ConsumerObserver2.prototype.complete = function() {
500
+ var partialObserver = this.partialObserver;
501
+ if (partialObserver.complete) {
502
+ try {
503
+ partialObserver.complete();
504
+ } catch (error) {
505
+ handleUnhandledError(error);
506
+ }
507
+ }
508
+ };
509
+ return ConsumerObserver2;
510
+ })();
511
+ var SafeSubscriber = (function(_super) {
512
+ __extends(SafeSubscriber2, _super);
513
+ function SafeSubscriber2(observerOrNext, error, complete) {
514
+ var _this = _super.call(this) || this;
515
+ var partialObserver;
516
+ if (isFunction(observerOrNext) || !observerOrNext) {
517
+ partialObserver = {
518
+ next: observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : void 0,
519
+ error: error !== null && error !== void 0 ? error : void 0,
520
+ complete: complete !== null && complete !== void 0 ? complete : void 0
521
+ };
522
+ } else {
523
+ {
524
+ partialObserver = observerOrNext;
525
+ }
526
+ }
527
+ _this.destination = new ConsumerObserver(partialObserver);
528
+ return _this;
529
+ }
530
+ return SafeSubscriber2;
531
+ })(Subscriber);
532
+ function handleUnhandledError(error) {
533
+ {
534
+ reportUnhandledError(error);
535
+ }
536
+ }
537
+ function defaultErrorHandler(err) {
538
+ throw err;
539
+ }
540
+ var EMPTY_OBSERVER = {
541
+ closed: true,
542
+ next: noop,
543
+ error: defaultErrorHandler,
544
+ complete: noop
545
+ };
546
+ var observable = (function() {
547
+ return typeof Symbol === "function" && Symbol.observable || "@@observable";
548
+ })();
549
+ function identity(x) {
550
+ return x;
551
+ }
552
+ function pipeFromArray(fns) {
553
+ if (fns.length === 0) {
554
+ return identity;
555
+ }
556
+ if (fns.length === 1) {
557
+ return fns[0];
558
+ }
559
+ return function piped(input) {
560
+ return fns.reduce(function(prev, fn) {
561
+ return fn(prev);
562
+ }, input);
563
+ };
564
+ }
565
+ var Observable = (function() {
566
+ function Observable2(subscribe) {
567
+ if (subscribe) {
568
+ this._subscribe = subscribe;
569
+ }
570
+ }
571
+ Observable2.prototype.lift = function(operator) {
572
+ var observable2 = new Observable2();
573
+ observable2.source = this;
574
+ observable2.operator = operator;
575
+ return observable2;
576
+ };
577
+ Observable2.prototype.subscribe = function(observerOrNext, error, complete) {
578
+ var _this = this;
579
+ var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
580
+ errorContext(function() {
581
+ var _a = _this, operator = _a.operator, source = _a.source;
582
+ subscriber.add(operator ? operator.call(subscriber, source) : source ? _this._subscribe(subscriber) : _this._trySubscribe(subscriber));
583
+ });
584
+ return subscriber;
585
+ };
586
+ Observable2.prototype._trySubscribe = function(sink) {
587
+ try {
588
+ return this._subscribe(sink);
589
+ } catch (err) {
590
+ sink.error(err);
591
+ }
592
+ };
593
+ Observable2.prototype.forEach = function(next, promiseCtor) {
594
+ var _this = this;
595
+ promiseCtor = getPromiseCtor(promiseCtor);
596
+ return new promiseCtor(function(resolve, reject) {
597
+ var subscriber = new SafeSubscriber({
598
+ next: function(value) {
599
+ try {
600
+ next(value);
601
+ } catch (err) {
602
+ reject(err);
603
+ subscriber.unsubscribe();
604
+ }
605
+ },
606
+ error: reject,
607
+ complete: resolve
608
+ });
609
+ _this.subscribe(subscriber);
610
+ });
611
+ };
612
+ Observable2.prototype._subscribe = function(subscriber) {
613
+ var _a;
614
+ return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
615
+ };
616
+ Observable2.prototype[observable] = function() {
617
+ return this;
618
+ };
619
+ Observable2.prototype.pipe = function() {
620
+ var operations = [];
621
+ for (var _i = 0; _i < arguments.length; _i++) {
622
+ operations[_i] = arguments[_i];
623
+ }
624
+ return pipeFromArray(operations)(this);
625
+ };
626
+ Observable2.prototype.toPromise = function(promiseCtor) {
627
+ var _this = this;
628
+ promiseCtor = getPromiseCtor(promiseCtor);
629
+ return new promiseCtor(function(resolve, reject) {
630
+ var value;
631
+ _this.subscribe(function(x) {
632
+ return value = x;
633
+ }, function(err) {
634
+ return reject(err);
635
+ }, function() {
636
+ return resolve(value);
637
+ });
638
+ });
639
+ };
640
+ Observable2.create = function(subscribe) {
641
+ return new Observable2(subscribe);
642
+ };
643
+ return Observable2;
644
+ })();
645
+ function getPromiseCtor(promiseCtor) {
646
+ var _a;
647
+ return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;
648
+ }
649
+ function isObserver(value) {
650
+ return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
651
+ }
652
+ function isSubscriber(value) {
653
+ return value && value instanceof Subscriber || isObserver(value) && isSubscription(value);
654
+ }
655
+ function hasLift(source) {
656
+ return isFunction(source === null || source === void 0 ? void 0 : source.lift);
657
+ }
658
+ function operate(init) {
659
+ return function(source) {
660
+ if (hasLift(source)) {
661
+ return source.lift(function(liftedSource) {
662
+ try {
663
+ return init(liftedSource, this);
664
+ } catch (err) {
665
+ this.error(err);
666
+ }
667
+ });
668
+ }
669
+ throw new TypeError("Unable to lift unknown Observable type");
670
+ };
671
+ }
672
+ function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) {
673
+ return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize);
674
+ }
675
+ var OperatorSubscriber = (function(_super) {
676
+ __extends(OperatorSubscriber2, _super);
677
+ function OperatorSubscriber2(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) {
678
+ var _this = _super.call(this, destination) || this;
679
+ _this.onFinalize = onFinalize;
680
+ _this.shouldUnsubscribe = shouldUnsubscribe;
681
+ _this._next = onNext ? function(value) {
682
+ try {
683
+ onNext(value);
684
+ } catch (err) {
685
+ destination.error(err);
686
+ }
687
+ } : _super.prototype._next;
688
+ _this._error = onError ? function(err) {
689
+ try {
690
+ onError(err);
691
+ } catch (err2) {
692
+ destination.error(err2);
693
+ } finally {
694
+ this.unsubscribe();
695
+ }
696
+ } : _super.prototype._error;
697
+ _this._complete = onComplete ? function() {
698
+ try {
699
+ onComplete();
700
+ } catch (err) {
701
+ destination.error(err);
702
+ } finally {
703
+ this.unsubscribe();
704
+ }
705
+ } : _super.prototype._complete;
706
+ return _this;
707
+ }
708
+ OperatorSubscriber2.prototype.unsubscribe = function() {
709
+ var _a;
710
+ if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
711
+ var closed_1 = this.closed;
712
+ _super.prototype.unsubscribe.call(this);
713
+ !closed_1 && ((_a = this.onFinalize) === null || _a === void 0 ? void 0 : _a.call(this));
714
+ }
715
+ };
716
+ return OperatorSubscriber2;
717
+ })(Subscriber);
718
+ var ObjectUnsubscribedError = createErrorClass(function(_super) {
719
+ return function ObjectUnsubscribedErrorImpl() {
720
+ _super(this);
721
+ this.name = "ObjectUnsubscribedError";
722
+ this.message = "object unsubscribed";
723
+ };
724
+ });
725
+ var Subject = (function(_super) {
726
+ __extends(Subject2, _super);
727
+ function Subject2() {
728
+ var _this = _super.call(this) || this;
729
+ _this.closed = false;
730
+ _this.currentObservers = null;
731
+ _this.observers = [];
732
+ _this.isStopped = false;
733
+ _this.hasError = false;
734
+ _this.thrownError = null;
735
+ return _this;
736
+ }
737
+ Subject2.prototype.lift = function(operator) {
738
+ var subject = new AnonymousSubject(this, this);
739
+ subject.operator = operator;
740
+ return subject;
741
+ };
742
+ Subject2.prototype._throwIfClosed = function() {
743
+ if (this.closed) {
744
+ throw new ObjectUnsubscribedError();
745
+ }
746
+ };
747
+ Subject2.prototype.next = function(value) {
748
+ var _this = this;
749
+ errorContext(function() {
750
+ var e_1, _a;
751
+ _this._throwIfClosed();
752
+ if (!_this.isStopped) {
753
+ if (!_this.currentObservers) {
754
+ _this.currentObservers = Array.from(_this.observers);
755
+ }
756
+ try {
757
+ for (var _b = __values(_this.currentObservers), _c = _b.next(); !_c.done; _c = _b.next()) {
758
+ var observer = _c.value;
759
+ observer.next(value);
760
+ }
761
+ } catch (e_1_1) {
762
+ e_1 = { error: e_1_1 };
763
+ } finally {
764
+ try {
765
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
766
+ } finally {
767
+ if (e_1) throw e_1.error;
768
+ }
769
+ }
770
+ }
771
+ });
772
+ };
773
+ Subject2.prototype.error = function(err) {
774
+ var _this = this;
775
+ errorContext(function() {
776
+ _this._throwIfClosed();
777
+ if (!_this.isStopped) {
778
+ _this.hasError = _this.isStopped = true;
779
+ _this.thrownError = err;
780
+ var observers = _this.observers;
781
+ while (observers.length) {
782
+ observers.shift().error(err);
783
+ }
784
+ }
785
+ });
786
+ };
787
+ Subject2.prototype.complete = function() {
788
+ var _this = this;
789
+ errorContext(function() {
790
+ _this._throwIfClosed();
791
+ if (!_this.isStopped) {
792
+ _this.isStopped = true;
793
+ var observers = _this.observers;
794
+ while (observers.length) {
795
+ observers.shift().complete();
796
+ }
797
+ }
798
+ });
799
+ };
800
+ Subject2.prototype.unsubscribe = function() {
801
+ this.isStopped = this.closed = true;
802
+ this.observers = this.currentObservers = null;
803
+ };
804
+ Object.defineProperty(Subject2.prototype, "observed", {
805
+ get: function() {
806
+ var _a;
807
+ return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;
808
+ },
809
+ enumerable: false,
810
+ configurable: true
811
+ });
812
+ Subject2.prototype._trySubscribe = function(subscriber) {
813
+ this._throwIfClosed();
814
+ return _super.prototype._trySubscribe.call(this, subscriber);
815
+ };
816
+ Subject2.prototype._subscribe = function(subscriber) {
817
+ this._throwIfClosed();
818
+ this._checkFinalizedStatuses(subscriber);
819
+ return this._innerSubscribe(subscriber);
820
+ };
821
+ Subject2.prototype._innerSubscribe = function(subscriber) {
822
+ var _this = this;
823
+ var _a = this, hasError = _a.hasError, isStopped = _a.isStopped, observers = _a.observers;
824
+ if (hasError || isStopped) {
825
+ return EMPTY_SUBSCRIPTION;
826
+ }
827
+ this.currentObservers = null;
828
+ observers.push(subscriber);
829
+ return new Subscription(function() {
830
+ _this.currentObservers = null;
831
+ arrRemove(observers, subscriber);
832
+ });
833
+ };
834
+ Subject2.prototype._checkFinalizedStatuses = function(subscriber) {
835
+ var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, isStopped = _a.isStopped;
836
+ if (hasError) {
837
+ subscriber.error(thrownError);
838
+ } else if (isStopped) {
839
+ subscriber.complete();
840
+ }
841
+ };
842
+ Subject2.prototype.asObservable = function() {
843
+ var observable2 = new Observable();
844
+ observable2.source = this;
845
+ return observable2;
846
+ };
847
+ Subject2.create = function(destination, source) {
848
+ return new AnonymousSubject(destination, source);
849
+ };
850
+ return Subject2;
851
+ })(Observable);
852
+ var AnonymousSubject = (function(_super) {
853
+ __extends(AnonymousSubject2, _super);
854
+ function AnonymousSubject2(destination, source) {
855
+ var _this = _super.call(this) || this;
856
+ _this.destination = destination;
857
+ _this.source = source;
858
+ return _this;
859
+ }
860
+ AnonymousSubject2.prototype.next = function(value) {
861
+ var _a, _b;
862
+ (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);
863
+ };
864
+ AnonymousSubject2.prototype.error = function(err) {
865
+ var _a, _b;
866
+ (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);
867
+ };
868
+ AnonymousSubject2.prototype.complete = function() {
869
+ var _a, _b;
870
+ (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);
871
+ };
872
+ AnonymousSubject2.prototype._subscribe = function(subscriber) {
873
+ var _a, _b;
874
+ return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION;
875
+ };
876
+ return AnonymousSubject2;
877
+ })(Subject);
878
+ var BehaviorSubject = (function(_super) {
879
+ __extends(BehaviorSubject2, _super);
880
+ function BehaviorSubject2(_value) {
881
+ var _this = _super.call(this) || this;
882
+ _this._value = _value;
883
+ return _this;
884
+ }
885
+ Object.defineProperty(BehaviorSubject2.prototype, "value", {
886
+ get: function() {
887
+ return this.getValue();
888
+ },
889
+ enumerable: false,
890
+ configurable: true
891
+ });
892
+ BehaviorSubject2.prototype._subscribe = function(subscriber) {
893
+ var subscription = _super.prototype._subscribe.call(this, subscriber);
894
+ !subscription.closed && subscriber.next(this._value);
895
+ return subscription;
896
+ };
897
+ BehaviorSubject2.prototype.getValue = function() {
898
+ var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, _value = _a._value;
899
+ if (hasError) {
900
+ throw thrownError;
901
+ }
902
+ this._throwIfClosed();
903
+ return _value;
904
+ };
905
+ BehaviorSubject2.prototype.next = function(value) {
906
+ _super.prototype.next.call(this, this._value = value);
907
+ };
908
+ return BehaviorSubject2;
909
+ })(Subject);
910
+ function isScheduler(value) {
911
+ return value && isFunction(value.schedule);
912
+ }
913
+ function last(arr) {
914
+ return arr[arr.length - 1];
915
+ }
916
+ function popScheduler(args) {
917
+ return isScheduler(last(args)) ? args.pop() : void 0;
918
+ }
919
+ var isArrayLike = (function(x) {
920
+ return x && typeof x.length === "number" && typeof x !== "function";
921
+ });
922
+ function isPromise(value) {
923
+ return isFunction(value === null || value === void 0 ? void 0 : value.then);
924
+ }
925
+ function isInteropObservable(input) {
926
+ return isFunction(input[observable]);
927
+ }
928
+ function isAsyncIterable(obj) {
929
+ return Symbol.asyncIterator && isFunction(obj === null || obj === void 0 ? void 0 : obj[Symbol.asyncIterator]);
930
+ }
931
+ function createInvalidObservableTypeError(input) {
932
+ return new TypeError("You provided " + (input !== null && typeof input === "object" ? "an invalid object" : "'" + input + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.");
933
+ }
934
+ function getSymbolIterator() {
935
+ if (typeof Symbol !== "function" || !Symbol.iterator) {
936
+ return "@@iterator";
937
+ }
938
+ return Symbol.iterator;
939
+ }
940
+ var iterator = getSymbolIterator();
941
+ function isIterable(input) {
942
+ return isFunction(input === null || input === void 0 ? void 0 : input[iterator]);
943
+ }
944
+ function readableStreamLikeToAsyncGenerator(readableStream) {
945
+ return __asyncGenerator(this, arguments, function readableStreamLikeToAsyncGenerator_1() {
946
+ var reader, _a, value, done;
947
+ return __generator(this, function(_b) {
948
+ switch (_b.label) {
949
+ case 0:
950
+ reader = readableStream.getReader();
951
+ _b.label = 1;
952
+ case 1:
953
+ _b.trys.push([1, , 9, 10]);
954
+ _b.label = 2;
955
+ case 2:
956
+ return [4, __await(reader.read())];
957
+ case 3:
958
+ _a = _b.sent(), value = _a.value, done = _a.done;
959
+ if (!done) return [3, 5];
960
+ return [4, __await(void 0)];
961
+ case 4:
962
+ return [2, _b.sent()];
963
+ case 5:
964
+ return [4, __await(value)];
965
+ case 6:
966
+ return [4, _b.sent()];
967
+ case 7:
968
+ _b.sent();
969
+ return [3, 2];
970
+ case 8:
971
+ return [3, 10];
972
+ case 9:
973
+ reader.releaseLock();
974
+ return [7];
975
+ case 10:
976
+ return [2];
977
+ }
978
+ });
979
+ });
980
+ }
981
+ function isReadableStreamLike(obj) {
982
+ return isFunction(obj === null || obj === void 0 ? void 0 : obj.getReader);
983
+ }
984
+ function innerFrom(input) {
985
+ if (input instanceof Observable) {
986
+ return input;
987
+ }
988
+ if (input != null) {
989
+ if (isInteropObservable(input)) {
990
+ return fromInteropObservable(input);
991
+ }
992
+ if (isArrayLike(input)) {
993
+ return fromArrayLike(input);
994
+ }
995
+ if (isPromise(input)) {
996
+ return fromPromise(input);
997
+ }
998
+ if (isAsyncIterable(input)) {
999
+ return fromAsyncIterable(input);
1000
+ }
1001
+ if (isIterable(input)) {
1002
+ return fromIterable(input);
1003
+ }
1004
+ if (isReadableStreamLike(input)) {
1005
+ return fromReadableStreamLike(input);
1006
+ }
1007
+ }
1008
+ throw createInvalidObservableTypeError(input);
1009
+ }
1010
+ function fromInteropObservable(obj) {
1011
+ return new Observable(function(subscriber) {
1012
+ var obs = obj[observable]();
1013
+ if (isFunction(obs.subscribe)) {
1014
+ return obs.subscribe(subscriber);
1015
+ }
1016
+ throw new TypeError("Provided object does not correctly implement Symbol.observable");
1017
+ });
1018
+ }
1019
+ function fromArrayLike(array) {
1020
+ return new Observable(function(subscriber) {
1021
+ for (var i = 0; i < array.length && !subscriber.closed; i++) {
1022
+ subscriber.next(array[i]);
1023
+ }
1024
+ subscriber.complete();
1025
+ });
1026
+ }
1027
+ function fromPromise(promise) {
1028
+ return new Observable(function(subscriber) {
1029
+ promise.then(function(value) {
1030
+ if (!subscriber.closed) {
1031
+ subscriber.next(value);
1032
+ subscriber.complete();
1033
+ }
1034
+ }, function(err) {
1035
+ return subscriber.error(err);
1036
+ }).then(null, reportUnhandledError);
1037
+ });
1038
+ }
1039
+ function fromIterable(iterable) {
1040
+ return new Observable(function(subscriber) {
1041
+ var e_1, _a;
1042
+ try {
1043
+ for (var iterable_1 = __values(iterable), iterable_1_1 = iterable_1.next(); !iterable_1_1.done; iterable_1_1 = iterable_1.next()) {
1044
+ var value = iterable_1_1.value;
1045
+ subscriber.next(value);
1046
+ if (subscriber.closed) {
1047
+ return;
1048
+ }
1049
+ }
1050
+ } catch (e_1_1) {
1051
+ e_1 = { error: e_1_1 };
1052
+ } finally {
1053
+ try {
1054
+ if (iterable_1_1 && !iterable_1_1.done && (_a = iterable_1.return)) _a.call(iterable_1);
1055
+ } finally {
1056
+ if (e_1) throw e_1.error;
1057
+ }
1058
+ }
1059
+ subscriber.complete();
1060
+ });
1061
+ }
1062
+ function fromAsyncIterable(asyncIterable) {
1063
+ return new Observable(function(subscriber) {
1064
+ process(asyncIterable, subscriber).catch(function(err) {
1065
+ return subscriber.error(err);
1066
+ });
1067
+ });
1068
+ }
1069
+ function fromReadableStreamLike(readableStream) {
1070
+ return fromAsyncIterable(readableStreamLikeToAsyncGenerator(readableStream));
1071
+ }
1072
+ function process(asyncIterable, subscriber) {
1073
+ var asyncIterable_1, asyncIterable_1_1;
1074
+ var e_2, _a;
1075
+ return __awaiter(this, void 0, void 0, function() {
1076
+ var value, e_2_1;
1077
+ return __generator(this, function(_b) {
1078
+ switch (_b.label) {
1079
+ case 0:
1080
+ _b.trys.push([0, 5, 6, 11]);
1081
+ asyncIterable_1 = __asyncValues(asyncIterable);
1082
+ _b.label = 1;
1083
+ case 1:
1084
+ return [4, asyncIterable_1.next()];
1085
+ case 2:
1086
+ if (!(asyncIterable_1_1 = _b.sent(), !asyncIterable_1_1.done)) return [3, 4];
1087
+ value = asyncIterable_1_1.value;
1088
+ subscriber.next(value);
1089
+ if (subscriber.closed) {
1090
+ return [2];
1091
+ }
1092
+ _b.label = 3;
1093
+ case 3:
1094
+ return [3, 1];
1095
+ case 4:
1096
+ return [3, 11];
1097
+ case 5:
1098
+ e_2_1 = _b.sent();
1099
+ e_2 = { error: e_2_1 };
1100
+ return [3, 11];
1101
+ case 6:
1102
+ _b.trys.push([6, , 9, 10]);
1103
+ if (!(asyncIterable_1_1 && !asyncIterable_1_1.done && (_a = asyncIterable_1.return))) return [3, 8];
1104
+ return [4, _a.call(asyncIterable_1)];
1105
+ case 7:
1106
+ _b.sent();
1107
+ _b.label = 8;
1108
+ case 8:
1109
+ return [3, 10];
1110
+ case 9:
1111
+ if (e_2) throw e_2.error;
1112
+ return [7];
1113
+ case 10:
1114
+ return [7];
1115
+ case 11:
1116
+ subscriber.complete();
1117
+ return [2];
1118
+ }
1119
+ });
1120
+ });
1121
+ }
1122
+ function executeSchedule(parentSubscription, scheduler, work, delay, repeat) {
1123
+ if (delay === void 0) {
1124
+ delay = 0;
1125
+ }
1126
+ if (repeat === void 0) {
1127
+ repeat = false;
1128
+ }
1129
+ var scheduleSubscription = scheduler.schedule(function() {
1130
+ work();
1131
+ if (repeat) {
1132
+ parentSubscription.add(this.schedule(null, delay));
1133
+ } else {
1134
+ this.unsubscribe();
1135
+ }
1136
+ }, delay);
1137
+ parentSubscription.add(scheduleSubscription);
1138
+ if (!repeat) {
1139
+ return scheduleSubscription;
1140
+ }
1141
+ }
1142
+ function observeOn(scheduler, delay) {
1143
+ if (delay === void 0) {
1144
+ delay = 0;
1145
+ }
1146
+ return operate(function(source, subscriber) {
1147
+ source.subscribe(createOperatorSubscriber(subscriber, function(value) {
1148
+ return executeSchedule(subscriber, scheduler, function() {
1149
+ return subscriber.next(value);
1150
+ }, delay);
1151
+ }, function() {
1152
+ return executeSchedule(subscriber, scheduler, function() {
1153
+ return subscriber.complete();
1154
+ }, delay);
1155
+ }, function(err) {
1156
+ return executeSchedule(subscriber, scheduler, function() {
1157
+ return subscriber.error(err);
1158
+ }, delay);
1159
+ }));
1160
+ });
1161
+ }
1162
+ function subscribeOn(scheduler, delay) {
1163
+ if (delay === void 0) {
1164
+ delay = 0;
1165
+ }
1166
+ return operate(function(source, subscriber) {
1167
+ subscriber.add(scheduler.schedule(function() {
1168
+ return source.subscribe(subscriber);
1169
+ }, delay));
1170
+ });
1171
+ }
1172
+ function scheduleObservable(input, scheduler) {
1173
+ return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));
1174
+ }
1175
+ function schedulePromise(input, scheduler) {
1176
+ return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));
1177
+ }
1178
+ function scheduleArray(input, scheduler) {
1179
+ return new Observable(function(subscriber) {
1180
+ var i = 0;
1181
+ return scheduler.schedule(function() {
1182
+ if (i === input.length) {
1183
+ subscriber.complete();
1184
+ } else {
1185
+ subscriber.next(input[i++]);
1186
+ if (!subscriber.closed) {
1187
+ this.schedule();
1188
+ }
1189
+ }
1190
+ });
1191
+ });
1192
+ }
1193
+ function scheduleIterable(input, scheduler) {
1194
+ return new Observable(function(subscriber) {
1195
+ var iterator$1;
1196
+ executeSchedule(subscriber, scheduler, function() {
1197
+ iterator$1 = input[iterator]();
1198
+ executeSchedule(subscriber, scheduler, function() {
1199
+ var _a;
1200
+ var value;
1201
+ var done;
1202
+ try {
1203
+ _a = iterator$1.next(), value = _a.value, done = _a.done;
1204
+ } catch (err) {
1205
+ subscriber.error(err);
1206
+ return;
1207
+ }
1208
+ if (done) {
1209
+ subscriber.complete();
1210
+ } else {
1211
+ subscriber.next(value);
1212
+ }
1213
+ }, 0, true);
1214
+ });
1215
+ return function() {
1216
+ return isFunction(iterator$1 === null || iterator$1 === void 0 ? void 0 : iterator$1.return) && iterator$1.return();
1217
+ };
1218
+ });
1219
+ }
1220
+ function scheduleAsyncIterable(input, scheduler) {
1221
+ if (!input) {
1222
+ throw new Error("Iterable cannot be null");
1223
+ }
1224
+ return new Observable(function(subscriber) {
1225
+ executeSchedule(subscriber, scheduler, function() {
1226
+ var iterator2 = input[Symbol.asyncIterator]();
1227
+ executeSchedule(subscriber, scheduler, function() {
1228
+ iterator2.next().then(function(result) {
1229
+ if (result.done) {
1230
+ subscriber.complete();
1231
+ } else {
1232
+ subscriber.next(result.value);
1233
+ }
1234
+ });
1235
+ }, 0, true);
1236
+ });
1237
+ });
1238
+ }
1239
+ function scheduleReadableStreamLike(input, scheduler) {
1240
+ return scheduleAsyncIterable(readableStreamLikeToAsyncGenerator(input), scheduler);
1241
+ }
1242
+ function scheduled(input, scheduler) {
1243
+ if (input != null) {
1244
+ if (isInteropObservable(input)) {
1245
+ return scheduleObservable(input, scheduler);
1246
+ }
1247
+ if (isArrayLike(input)) {
1248
+ return scheduleArray(input, scheduler);
1249
+ }
1250
+ if (isPromise(input)) {
1251
+ return schedulePromise(input, scheduler);
1252
+ }
1253
+ if (isAsyncIterable(input)) {
1254
+ return scheduleAsyncIterable(input, scheduler);
1255
+ }
1256
+ if (isIterable(input)) {
1257
+ return scheduleIterable(input, scheduler);
1258
+ }
1259
+ if (isReadableStreamLike(input)) {
1260
+ return scheduleReadableStreamLike(input, scheduler);
1261
+ }
1262
+ }
1263
+ throw createInvalidObservableTypeError(input);
1264
+ }
1265
+ function from(input, scheduler) {
1266
+ return scheduler ? scheduled(input, scheduler) : innerFrom(input);
1267
+ }
1268
+ function of() {
1269
+ var args = [];
1270
+ for (var _i = 0; _i < arguments.length; _i++) {
1271
+ args[_i] = arguments[_i];
1272
+ }
1273
+ var scheduler = popScheduler(args);
1274
+ return from(args, scheduler);
1275
+ }
1276
+ var EmptyError = createErrorClass(function(_super) {
1277
+ return function EmptyErrorImpl() {
1278
+ _super(this);
1279
+ this.name = "EmptyError";
1280
+ this.message = "no elements in sequence";
1281
+ };
1282
+ });
1283
+ function firstValueFrom(source, config2) {
1284
+ return new Promise(function(resolve, reject) {
1285
+ var subscriber = new SafeSubscriber({
1286
+ next: function(value) {
1287
+ resolve(value);
1288
+ subscriber.unsubscribe();
1289
+ },
1290
+ error: reject,
1291
+ complete: function() {
1292
+ {
1293
+ reject(new EmptyError());
1294
+ }
1295
+ }
1296
+ });
1297
+ source.subscribe(subscriber);
1298
+ });
1299
+ }
1300
+ var Action = /* @__PURE__ */ ((Action2) => {
1301
+ Action2["Pop"] = "POP";
1302
+ Action2["Push"] = "PUSH";
1303
+ Action2["Replace"] = "REPLACE";
1304
+ return Action2;
1305
+ })(Action || {});
1306
+ function invariant(value, message) {
1307
+ if (value === false || value === null || typeof value === "undefined") {
1308
+ throw new Error(message);
1309
+ }
1310
+ }
1311
+ function warning(cond, message) {
1312
+ if (!cond) {
1313
+ if (typeof console !== "undefined") console.warn(message);
1314
+ try {
1315
+ throw new Error(message);
1316
+ } catch (e) {
1317
+ }
1318
+ }
1319
+ }
1320
+ function createPath({
1321
+ pathname = "/",
1322
+ search = "",
1323
+ hash = ""
1324
+ }) {
1325
+ if (search && search !== "?")
1326
+ pathname += search.charAt(0) === "?" ? search : "?" + search;
1327
+ if (hash && hash !== "#")
1328
+ pathname += hash.charAt(0) === "#" ? hash : "#" + hash;
1329
+ return pathname;
1330
+ }
1331
+ function parsePath(path) {
1332
+ let parsedPath = {};
1333
+ if (path) {
1334
+ let hashIndex = path.indexOf("#");
1335
+ if (hashIndex >= 0) {
1336
+ parsedPath.hash = path.substring(hashIndex);
1337
+ path = path.substring(0, hashIndex);
1338
+ }
1339
+ let searchIndex = path.indexOf("?");
1340
+ if (searchIndex >= 0) {
1341
+ parsedPath.search = path.substring(searchIndex);
1342
+ path = path.substring(0, searchIndex);
1343
+ }
1344
+ if (path) {
1345
+ parsedPath.pathname = path;
1346
+ }
1347
+ }
1348
+ return parsedPath;
1349
+ }
1350
+ function matchRoutes(routes, locationArg, basename = "/") {
1351
+ return matchRoutesImpl(routes, locationArg, basename, false);
1352
+ }
1353
+ function matchRoutesImpl(routes, locationArg, basename, allowPartial) {
1354
+ let location = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
1355
+ let pathname = stripBasename(location.pathname || "/", basename);
1356
+ if (pathname == null) {
1357
+ return null;
1358
+ }
1359
+ let branches = flattenRoutes(routes);
1360
+ rankRouteBranches(branches);
1361
+ let matches = null;
1362
+ for (let i = 0; matches == null && i < branches.length; ++i) {
1363
+ let decoded = decodePath(pathname);
1364
+ matches = matchRouteBranch(
1365
+ branches[i],
1366
+ decoded,
1367
+ allowPartial
1368
+ );
1369
+ }
1370
+ return matches;
1371
+ }
1372
+ function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "", _hasParentOptionalSegments = false) {
1373
+ let flattenRoute = (route, index, hasParentOptionalSegments = _hasParentOptionalSegments, relativePath) => {
1374
+ let meta = {
1375
+ relativePath: relativePath === void 0 ? route.path || "" : relativePath,
1376
+ caseSensitive: route.caseSensitive === true,
1377
+ childrenIndex: index,
1378
+ route
1379
+ };
1380
+ if (meta.relativePath.startsWith("/")) {
1381
+ if (!meta.relativePath.startsWith(parentPath) && hasParentOptionalSegments) {
1382
+ return;
1383
+ }
1384
+ invariant(
1385
+ meta.relativePath.startsWith(parentPath),
1386
+ `Absolute route path "${meta.relativePath}" nested under path "${parentPath}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`
1387
+ );
1388
+ meta.relativePath = meta.relativePath.slice(parentPath.length);
1389
+ }
1390
+ let path = joinPaths([parentPath, meta.relativePath]);
1391
+ let routesMeta = parentsMeta.concat(meta);
1392
+ if (route.children && route.children.length > 0) {
1393
+ invariant(
1394
+ // Our types know better, but runtime JS may not!
1395
+ // @ts-expect-error
1396
+ route.index !== true,
1397
+ `Index routes must not have child routes. Please remove all child routes from route path "${path}".`
1398
+ );
1399
+ flattenRoutes(
1400
+ route.children,
1401
+ branches,
1402
+ routesMeta,
1403
+ path,
1404
+ hasParentOptionalSegments
1405
+ );
1406
+ }
1407
+ if (route.path == null && !route.index) {
1408
+ return;
1409
+ }
1410
+ branches.push({
1411
+ path,
1412
+ score: computeScore(path, route.index),
1413
+ routesMeta
1414
+ });
1415
+ };
1416
+ routes.forEach((route, index) => {
1417
+ if (route.path === "" || !route.path?.includes("?")) {
1418
+ flattenRoute(route, index);
1419
+ } else {
1420
+ for (let exploded of explodeOptionalSegments(route.path)) {
1421
+ flattenRoute(route, index, true, exploded);
1422
+ }
1423
+ }
1424
+ });
1425
+ return branches;
1426
+ }
1427
+ function explodeOptionalSegments(path) {
1428
+ let segments = path.split("/");
1429
+ if (segments.length === 0) return [];
1430
+ let [first, ...rest] = segments;
1431
+ let isOptional = first.endsWith("?");
1432
+ let required = first.replace(/\?$/, "");
1433
+ if (rest.length === 0) {
1434
+ return isOptional ? [required, ""] : [required];
1435
+ }
1436
+ let restExploded = explodeOptionalSegments(rest.join("/"));
1437
+ let result = [];
1438
+ result.push(
1439
+ ...restExploded.map(
1440
+ (subpath) => subpath === "" ? required : [required, subpath].join("/")
1441
+ )
1442
+ );
1443
+ if (isOptional) {
1444
+ result.push(...restExploded);
1445
+ }
1446
+ return result.map(
1447
+ (exploded) => path.startsWith("/") && exploded === "" ? "/" : exploded
1448
+ );
1449
+ }
1450
+ function rankRouteBranches(branches) {
1451
+ branches.sort(
1452
+ (a, b) => a.score !== b.score ? b.score - a.score : compareIndexes(
1453
+ a.routesMeta.map((meta) => meta.childrenIndex),
1454
+ b.routesMeta.map((meta) => meta.childrenIndex)
1455
+ )
1456
+ );
1457
+ }
1458
+ var paramRe = /^:[\w-]+$/;
1459
+ var dynamicSegmentValue = 3;
1460
+ var indexRouteValue = 2;
1461
+ var emptySegmentValue = 1;
1462
+ var staticSegmentValue = 10;
1463
+ var splatPenalty = -2;
1464
+ var isSplat = (s) => s === "*";
1465
+ function computeScore(path, index) {
1466
+ let segments = path.split("/");
1467
+ let initialScore = segments.length;
1468
+ if (segments.some(isSplat)) {
1469
+ initialScore += splatPenalty;
1470
+ }
1471
+ if (index) {
1472
+ initialScore += indexRouteValue;
1473
+ }
1474
+ return segments.filter((s) => !isSplat(s)).reduce(
1475
+ (score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === "" ? emptySegmentValue : staticSegmentValue),
1476
+ initialScore
1477
+ );
1478
+ }
1479
+ function compareIndexes(a, b) {
1480
+ let siblings = a.length === b.length && a.slice(0, -1).every((n, i) => n === b[i]);
1481
+ return siblings ? (
1482
+ // If two routes are siblings, we should try to match the earlier sibling
1483
+ // first. This allows people to have fine-grained control over the matching
1484
+ // behavior by simply putting routes with identical paths in the order they
1485
+ // want them tried.
1486
+ a[a.length - 1] - b[b.length - 1]
1487
+ ) : (
1488
+ // Otherwise, it doesn't really make sense to rank non-siblings by index,
1489
+ // so they sort equally.
1490
+ 0
1491
+ );
1492
+ }
1493
+ function matchRouteBranch(branch, pathname, allowPartial = false) {
1494
+ let { routesMeta } = branch;
1495
+ let matchedParams = {};
1496
+ let matchedPathname = "/";
1497
+ let matches = [];
1498
+ for (let i = 0; i < routesMeta.length; ++i) {
1499
+ let meta = routesMeta[i];
1500
+ let end = i === routesMeta.length - 1;
1501
+ let remainingPathname = matchedPathname === "/" ? pathname : pathname.slice(matchedPathname.length) || "/";
1502
+ let match = matchPath(
1503
+ { path: meta.relativePath, caseSensitive: meta.caseSensitive, end },
1504
+ remainingPathname
1505
+ );
1506
+ let route = meta.route;
1507
+ if (!match && end && allowPartial && !routesMeta[routesMeta.length - 1].route.index) {
1508
+ match = matchPath(
1509
+ {
1510
+ path: meta.relativePath,
1511
+ caseSensitive: meta.caseSensitive,
1512
+ end: false
1513
+ },
1514
+ remainingPathname
1515
+ );
1516
+ }
1517
+ if (!match) {
1518
+ return null;
1519
+ }
1520
+ Object.assign(matchedParams, match.params);
1521
+ matches.push({
1522
+ // TODO: Can this as be avoided?
1523
+ params: matchedParams,
1524
+ pathname: joinPaths([matchedPathname, match.pathname]),
1525
+ pathnameBase: normalizePathname(
1526
+ joinPaths([matchedPathname, match.pathnameBase])
1527
+ ),
1528
+ route
1529
+ });
1530
+ if (match.pathnameBase !== "/") {
1531
+ matchedPathname = joinPaths([matchedPathname, match.pathnameBase]);
1532
+ }
1533
+ }
1534
+ return matches;
1535
+ }
1536
+ function matchPath(pattern, pathname) {
1537
+ if (typeof pattern === "string") {
1538
+ pattern = { path: pattern, caseSensitive: false, end: true };
1539
+ }
1540
+ let [matcher, compiledParams] = compilePath(
1541
+ pattern.path,
1542
+ pattern.caseSensitive,
1543
+ pattern.end
1544
+ );
1545
+ let match = pathname.match(matcher);
1546
+ if (!match) return null;
1547
+ let matchedPathname = match[0];
1548
+ let pathnameBase = matchedPathname.replace(/(.)\/+$/, "$1");
1549
+ let captureGroups = match.slice(1);
1550
+ let params = compiledParams.reduce(
1551
+ (memo2, { paramName, isOptional }, index) => {
1552
+ if (paramName === "*") {
1553
+ let splatValue = captureGroups[index] || "";
1554
+ pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\/+$/, "$1");
1555
+ }
1556
+ const value = captureGroups[index];
1557
+ if (isOptional && !value) {
1558
+ memo2[paramName] = void 0;
1559
+ } else {
1560
+ memo2[paramName] = (value || "").replace(/%2F/g, "/");
1561
+ }
1562
+ return memo2;
1563
+ },
1564
+ {}
1565
+ );
1566
+ return {
1567
+ params,
1568
+ pathname: matchedPathname,
1569
+ pathnameBase,
1570
+ pattern
1571
+ };
1572
+ }
1573
+ function compilePath(path, caseSensitive = false, end = true) {
1574
+ warning(
1575
+ path === "*" || !path.endsWith("*") || path.endsWith("/*"),
1576
+ `Route path "${path}" will be treated as if it were "${path.replace(/\*$/, "/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${path.replace(/\*$/, "/*")}".`
1577
+ );
1578
+ let params = [];
1579
+ let regexpSource = "^" + path.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(
1580
+ /\/:([\w-]+)(\?)?/g,
1581
+ (match, paramName, isOptional, index, str) => {
1582
+ params.push({ paramName, isOptional: isOptional != null });
1583
+ if (isOptional) {
1584
+ let nextChar = str.charAt(index + match.length);
1585
+ if (nextChar && nextChar !== "/") {
1586
+ return "/([^\\/]*)";
1587
+ }
1588
+ return "(?:/([^\\/]*))?";
1589
+ }
1590
+ return "/([^\\/]+)";
1591
+ }
1592
+ ).replace(/\/([\w-]+)\?(\/|$)/g, "(/$1)?$2");
1593
+ if (path.endsWith("*")) {
1594
+ params.push({ paramName: "*" });
1595
+ regexpSource += path === "*" || path === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$";
1596
+ } else if (end) {
1597
+ regexpSource += "\\/*$";
1598
+ } else if (path !== "" && path !== "/") {
1599
+ regexpSource += "(?:(?=\\/|$))";
1600
+ } else ;
1601
+ let matcher = new RegExp(regexpSource, caseSensitive ? void 0 : "i");
1602
+ return [matcher, params];
1603
+ }
1604
+ function decodePath(value) {
1605
+ try {
1606
+ return value.split("/").map((v) => decodeURIComponent(v).replace(/\//g, "%2F")).join("/");
1607
+ } catch (error) {
1608
+ warning(
1609
+ false,
1610
+ `The URL path "${value}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${error}).`
1611
+ );
1612
+ return value;
1613
+ }
1614
+ }
1615
+ function stripBasename(pathname, basename) {
1616
+ if (basename === "/") return pathname;
1617
+ if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {
1618
+ return null;
1619
+ }
1620
+ let startIndex = basename.endsWith("/") ? basename.length - 1 : basename.length;
1621
+ let nextChar = pathname.charAt(startIndex);
1622
+ if (nextChar && nextChar !== "/") {
1623
+ return null;
1624
+ }
1625
+ return pathname.slice(startIndex) || "/";
1626
+ }
1627
+ var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
1628
+ function resolvePath(to, fromPathname = "/") {
1629
+ let {
1630
+ pathname: toPathname,
1631
+ search = "",
1632
+ hash = ""
1633
+ } = typeof to === "string" ? parsePath(to) : to;
1634
+ let pathname;
1635
+ if (toPathname) {
1636
+ toPathname = toPathname.replace(/\/\/+/g, "/");
1637
+ if (toPathname.startsWith("/")) {
1638
+ pathname = resolvePathname(toPathname.substring(1), "/");
1639
+ } else {
1640
+ pathname = resolvePathname(toPathname, fromPathname);
1641
+ }
1642
+ } else {
1643
+ pathname = fromPathname;
1644
+ }
1645
+ return {
1646
+ pathname,
1647
+ search: normalizeSearch(search),
1648
+ hash: normalizeHash(hash)
1649
+ };
1650
+ }
1651
+ function resolvePathname(relativePath, fromPathname) {
1652
+ let segments = fromPathname.replace(/\/+$/, "").split("/");
1653
+ let relativeSegments = relativePath.split("/");
1654
+ relativeSegments.forEach((segment) => {
1655
+ if (segment === "..") {
1656
+ if (segments.length > 1) segments.pop();
1657
+ } else if (segment !== ".") {
1658
+ segments.push(segment);
1659
+ }
1660
+ });
1661
+ return segments.length > 1 ? segments.join("/") : "/";
1662
+ }
1663
+ function getInvalidPathError(char, field, dest, path) {
1664
+ return `Cannot include a '${char}' character in a manually specified \`to.${field}\` field [${JSON.stringify(
1665
+ path
1666
+ )}]. Please separate it out to the \`to.${dest}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`;
1667
+ }
1668
+ function getPathContributingMatches(matches) {
1669
+ return matches.filter(
1670
+ (match, index) => index === 0 || match.route.path && match.route.path.length > 0
1671
+ );
1672
+ }
1673
+ function getResolveToMatches(matches) {
1674
+ let pathMatches = getPathContributingMatches(matches);
1675
+ return pathMatches.map(
1676
+ (match, idx) => idx === pathMatches.length - 1 ? match.pathname : match.pathnameBase
1677
+ );
1678
+ }
1679
+ function resolveTo(toArg, routePathnames, locationPathname, isPathRelative = false) {
1680
+ let to;
1681
+ if (typeof toArg === "string") {
1682
+ to = parsePath(toArg);
1683
+ } else {
1684
+ to = { ...toArg };
1685
+ invariant(
1686
+ !to.pathname || !to.pathname.includes("?"),
1687
+ getInvalidPathError("?", "pathname", "search", to)
1688
+ );
1689
+ invariant(
1690
+ !to.pathname || !to.pathname.includes("#"),
1691
+ getInvalidPathError("#", "pathname", "hash", to)
1692
+ );
1693
+ invariant(
1694
+ !to.search || !to.search.includes("#"),
1695
+ getInvalidPathError("#", "search", "hash", to)
1696
+ );
1697
+ }
1698
+ let isEmptyPath = toArg === "" || to.pathname === "";
1699
+ let toPathname = isEmptyPath ? "/" : to.pathname;
1700
+ let from2;
1701
+ if (toPathname == null) {
1702
+ from2 = locationPathname;
1703
+ } else {
1704
+ let routePathnameIndex = routePathnames.length - 1;
1705
+ if (!isPathRelative && toPathname.startsWith("..")) {
1706
+ let toSegments = toPathname.split("/");
1707
+ while (toSegments[0] === "..") {
1708
+ toSegments.shift();
1709
+ routePathnameIndex -= 1;
1710
+ }
1711
+ to.pathname = toSegments.join("/");
1712
+ }
1713
+ from2 = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : "/";
1714
+ }
1715
+ let path = resolvePath(to, from2);
1716
+ let hasExplicitTrailingSlash = toPathname && toPathname !== "/" && toPathname.endsWith("/");
1717
+ let hasCurrentTrailingSlash = (isEmptyPath || toPathname === ".") && locationPathname.endsWith("/");
1718
+ if (!path.pathname.endsWith("/") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) {
1719
+ path.pathname += "/";
1720
+ }
1721
+ return path;
1722
+ }
1723
+ var joinPaths = (paths) => paths.join("/").replace(/\/\/+/g, "/");
1724
+ var normalizePathname = (pathname) => pathname.replace(/\/+$/, "").replace(/^\/*/, "/");
1725
+ var normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search;
1726
+ var normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
1727
+ var ErrorResponseImpl = class {
1728
+ constructor(status, statusText, data2, internal = false) {
1729
+ this.status = status;
1730
+ this.statusText = statusText || "";
1731
+ this.internal = internal;
1732
+ if (data2 instanceof Error) {
1733
+ this.data = data2.toString();
1734
+ this.error = data2;
1735
+ } else {
1736
+ this.data = data2;
1737
+ }
1738
+ }
1739
+ };
1740
+ function isRouteErrorResponse(error) {
1741
+ return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error;
1742
+ }
1743
+ function getRoutePattern(matches) {
1744
+ return matches.map((m) => m.route.path).filter(Boolean).join("/").replace(/\/\/*/g, "/") || "/";
1745
+ }
1746
+ var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
1747
+ function parseToInfo(_to, basename) {
1748
+ let to = _to;
1749
+ if (typeof to !== "string" || !ABSOLUTE_URL_REGEX.test(to)) {
1750
+ return {
1751
+ absoluteURL: void 0,
1752
+ isExternal: false,
1753
+ to
1754
+ };
1755
+ }
1756
+ let absoluteURL = to;
1757
+ let isExternal = false;
1758
+ if (isBrowser) {
1759
+ try {
1760
+ let currentUrl = new URL(window.location.href);
1761
+ let targetUrl = to.startsWith("//") ? new URL(currentUrl.protocol + to) : new URL(to);
1762
+ let path = stripBasename(targetUrl.pathname, basename);
1763
+ if (targetUrl.origin === currentUrl.origin && path != null) {
1764
+ to = path + targetUrl.search + targetUrl.hash;
1765
+ } else {
1766
+ isExternal = true;
1767
+ }
1768
+ } catch (e) {
1769
+ warning(
1770
+ false,
1771
+ `<Link to="${to}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`
1772
+ );
1773
+ }
1774
+ }
1775
+ return {
1776
+ absoluteURL,
1777
+ isExternal,
1778
+ to
1779
+ };
1780
+ }
1781
+ Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
1782
+ var validMutationMethodsArr = [
1783
+ "POST",
1784
+ "PUT",
1785
+ "PATCH",
1786
+ "DELETE"
1787
+ ];
1788
+ new Set(
1789
+ validMutationMethodsArr
1790
+ );
1791
+ var validRequestMethodsArr = [
1792
+ "GET",
1793
+ ...validMutationMethodsArr
1794
+ ];
1795
+ new Set(validRequestMethodsArr);
1796
+ var DataRouterContext = React3.createContext(null);
1797
+ DataRouterContext.displayName = "DataRouter";
1798
+ var DataRouterStateContext = React3.createContext(null);
1799
+ DataRouterStateContext.displayName = "DataRouterState";
1800
+ var RSCRouterContext = React3.createContext(false);
1801
+ var ViewTransitionContext = React3.createContext({
1802
+ isTransitioning: false
1803
+ });
1804
+ ViewTransitionContext.displayName = "ViewTransition";
1805
+ var FetchersContext = React3.createContext(
1806
+ /* @__PURE__ */ new Map()
1807
+ );
1808
+ FetchersContext.displayName = "Fetchers";
1809
+ var AwaitContext = React3.createContext(null);
1810
+ AwaitContext.displayName = "Await";
1811
+ var NavigationContext = React3.createContext(
1812
+ null
1813
+ );
1814
+ NavigationContext.displayName = "Navigation";
1815
+ var LocationContext = React3.createContext(
1816
+ null
1817
+ );
1818
+ LocationContext.displayName = "Location";
1819
+ var RouteContext = React3.createContext({
1820
+ outlet: null,
1821
+ matches: [],
1822
+ isDataRoute: false
1823
+ });
1824
+ RouteContext.displayName = "Route";
1825
+ var RouteErrorContext = React3.createContext(null);
1826
+ RouteErrorContext.displayName = "RouteError";
1827
+ var ERROR_DIGEST_BASE = "REACT_ROUTER_ERROR";
1828
+ var ERROR_DIGEST_REDIRECT = "REDIRECT";
1829
+ var ERROR_DIGEST_ROUTE_ERROR_RESPONSE = "ROUTE_ERROR_RESPONSE";
1830
+ function decodeRedirectErrorDigest(digest) {
1831
+ if (digest.startsWith(`${ERROR_DIGEST_BASE}:${ERROR_DIGEST_REDIRECT}:{`)) {
1832
+ try {
1833
+ let parsed = JSON.parse(digest.slice(28));
1834
+ if (typeof parsed === "object" && parsed && typeof parsed.status === "number" && typeof parsed.statusText === "string" && typeof parsed.location === "string" && typeof parsed.reloadDocument === "boolean" && typeof parsed.replace === "boolean") {
1835
+ return parsed;
1836
+ }
1837
+ } catch {
1838
+ }
1839
+ }
1840
+ }
1841
+ function decodeRouteErrorResponseDigest(digest) {
1842
+ if (digest.startsWith(
1843
+ `${ERROR_DIGEST_BASE}:${ERROR_DIGEST_ROUTE_ERROR_RESPONSE}:{`
1844
+ )) {
1845
+ try {
1846
+ let parsed = JSON.parse(digest.slice(40));
1847
+ if (typeof parsed === "object" && parsed && typeof parsed.status === "number" && typeof parsed.statusText === "string") {
1848
+ return new ErrorResponseImpl(
1849
+ parsed.status,
1850
+ parsed.statusText,
1851
+ parsed.data
1852
+ );
1853
+ }
1854
+ } catch {
1855
+ }
1856
+ }
1857
+ }
1858
+ function useHref(to, { relative } = {}) {
1859
+ invariant(
1860
+ useInRouterContext(),
1861
+ // TODO: This error is probably because they somehow have 2 versions of the
1862
+ // router loaded. We can help them understand how to avoid that.
1863
+ `useHref() may be used only in the context of a <Router> component.`
1864
+ );
1865
+ let { basename, navigator } = React3.useContext(NavigationContext);
1866
+ let { hash, pathname, search } = useResolvedPath(to, { relative });
1867
+ let joinedPathname = pathname;
1868
+ if (basename !== "/") {
1869
+ joinedPathname = pathname === "/" ? basename : joinPaths([basename, pathname]);
1870
+ }
1871
+ return navigator.createHref({ pathname: joinedPathname, search, hash });
1872
+ }
1873
+ function useInRouterContext() {
1874
+ return React3.useContext(LocationContext) != null;
1875
+ }
1876
+ function useLocation() {
1877
+ invariant(
1878
+ useInRouterContext(),
1879
+ // TODO: This error is probably because they somehow have 2 versions of the
1880
+ // router loaded. We can help them understand how to avoid that.
1881
+ `useLocation() may be used only in the context of a <Router> component.`
1882
+ );
1883
+ return React3.useContext(LocationContext).location;
1884
+ }
1885
+ var navigateEffectWarning = `You should call navigate() in a React.useEffect(), not when your component is first rendered.`;
1886
+ function useIsomorphicLayoutEffect(cb) {
1887
+ let isStatic = React3.useContext(NavigationContext).static;
1888
+ if (!isStatic) {
1889
+ React3.useLayoutEffect(cb);
1890
+ }
1891
+ }
1892
+ function useNavigate() {
1893
+ let { isDataRoute } = React3.useContext(RouteContext);
1894
+ return isDataRoute ? useNavigateStable() : useNavigateUnstable();
1895
+ }
1896
+ function useNavigateUnstable() {
1897
+ invariant(
1898
+ useInRouterContext(),
1899
+ // TODO: This error is probably because they somehow have 2 versions of the
1900
+ // router loaded. We can help them understand how to avoid that.
1901
+ `useNavigate() may be used only in the context of a <Router> component.`
1902
+ );
1903
+ let dataRouterContext = React3.useContext(DataRouterContext);
1904
+ let { basename, navigator } = React3.useContext(NavigationContext);
1905
+ let { matches } = React3.useContext(RouteContext);
1906
+ let { pathname: locationPathname } = useLocation();
1907
+ let routePathnamesJson = JSON.stringify(getResolveToMatches(matches));
1908
+ let activeRef = React3.useRef(false);
1909
+ useIsomorphicLayoutEffect(() => {
1910
+ activeRef.current = true;
1911
+ });
1912
+ let navigate = React3.useCallback(
1913
+ (to, options = {}) => {
1914
+ warning(activeRef.current, navigateEffectWarning);
1915
+ if (!activeRef.current) return;
1916
+ if (typeof to === "number") {
1917
+ navigator.go(to);
1918
+ return;
1919
+ }
1920
+ let path = resolveTo(
1921
+ to,
1922
+ JSON.parse(routePathnamesJson),
1923
+ locationPathname,
1924
+ options.relative === "path"
1925
+ );
1926
+ if (dataRouterContext == null && basename !== "/") {
1927
+ path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
1928
+ }
1929
+ (!!options.replace ? navigator.replace : navigator.push)(
1930
+ path,
1931
+ options.state,
1932
+ options
1933
+ );
1934
+ },
1935
+ [
1936
+ basename,
1937
+ navigator,
1938
+ routePathnamesJson,
1939
+ locationPathname,
1940
+ dataRouterContext
1941
+ ]
1942
+ );
1943
+ return navigate;
1944
+ }
1945
+ React3.createContext(null);
1946
+ function useParams() {
1947
+ let { matches } = React3.useContext(RouteContext);
1948
+ let routeMatch = matches[matches.length - 1];
1949
+ return routeMatch ? routeMatch.params : {};
1950
+ }
1951
+ function useResolvedPath(to, { relative } = {}) {
1952
+ let { matches } = React3.useContext(RouteContext);
1953
+ let { pathname: locationPathname } = useLocation();
1954
+ let routePathnamesJson = JSON.stringify(getResolveToMatches(matches));
1955
+ return React3.useMemo(
1956
+ () => resolveTo(
1957
+ to,
1958
+ JSON.parse(routePathnamesJson),
1959
+ locationPathname,
1960
+ relative === "path"
1961
+ ),
1962
+ [to, routePathnamesJson, locationPathname, relative]
1963
+ );
1964
+ }
1965
+ function useRoutesImpl(routes, locationArg, dataRouterOpts) {
1966
+ invariant(
1967
+ useInRouterContext(),
1968
+ // TODO: This error is probably because they somehow have 2 versions of the
1969
+ // router loaded. We can help them understand how to avoid that.
1970
+ `useRoutes() may be used only in the context of a <Router> component.`
1971
+ );
1972
+ let { navigator } = React3.useContext(NavigationContext);
1973
+ let { matches: parentMatches } = React3.useContext(RouteContext);
1974
+ let routeMatch = parentMatches[parentMatches.length - 1];
1975
+ let parentParams = routeMatch ? routeMatch.params : {};
1976
+ let parentPathname = routeMatch ? routeMatch.pathname : "/";
1977
+ let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : "/";
1978
+ let parentRoute = routeMatch && routeMatch.route;
1979
+ {
1980
+ let parentPath = parentRoute && parentRoute.path || "";
1981
+ warningOnce(
1982
+ parentPathname,
1983
+ !parentRoute || parentPath.endsWith("*") || parentPath.endsWith("*?"),
1984
+ `You rendered descendant <Routes> (or called \`useRoutes()\`) at "${parentPathname}" (under <Route path="${parentPath}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
1985
+
1986
+ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPath === "/" ? "*" : `${parentPath}/*`}">.`
1987
+ );
1988
+ }
1989
+ let locationFromContext = useLocation();
1990
+ let location;
1991
+ {
1992
+ location = locationFromContext;
1993
+ }
1994
+ let pathname = location.pathname || "/";
1995
+ let remainingPathname = pathname;
1996
+ if (parentPathnameBase !== "/") {
1997
+ let parentSegments = parentPathnameBase.replace(/^\//, "").split("/");
1998
+ let segments = pathname.replace(/^\//, "").split("/");
1999
+ remainingPathname = "/" + segments.slice(parentSegments.length).join("/");
2000
+ }
2001
+ let matches = matchRoutes(routes, { pathname: remainingPathname });
2002
+ {
2003
+ warning(
2004
+ parentRoute || matches != null,
2005
+ `No routes matched location "${location.pathname}${location.search}${location.hash}" `
2006
+ );
2007
+ warning(
2008
+ matches == null || matches[matches.length - 1].route.element !== void 0 || matches[matches.length - 1].route.Component !== void 0 || matches[matches.length - 1].route.lazy !== void 0,
2009
+ `Matched leaf route at location "${location.pathname}${location.search}${location.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`
2010
+ );
2011
+ }
2012
+ let renderedMatches = _renderMatches(
2013
+ matches && matches.map(
2014
+ (match) => Object.assign({}, match, {
2015
+ params: Object.assign({}, parentParams, match.params),
2016
+ pathname: joinPaths([
2017
+ parentPathnameBase,
2018
+ // Re-encode pathnames that were decoded inside matchRoutes.
2019
+ // Pre-encode `%`, `?` and `#` ahead of `encodeLocation` because it uses
2020
+ // `new URL()` internally and we need to prevent it from treating
2021
+ // them as separators
2022
+ navigator.encodeLocation ? navigator.encodeLocation(
2023
+ match.pathname.replace(/%/g, "%25").replace(/\?/g, "%3F").replace(/#/g, "%23")
2024
+ ).pathname : match.pathname
2025
+ ]),
2026
+ pathnameBase: match.pathnameBase === "/" ? parentPathnameBase : joinPaths([
2027
+ parentPathnameBase,
2028
+ // Re-encode pathnames that were decoded inside matchRoutes
2029
+ // Pre-encode `%`, `?` and `#` ahead of `encodeLocation` because it uses
2030
+ // `new URL()` internally and we need to prevent it from treating
2031
+ // them as separators
2032
+ navigator.encodeLocation ? navigator.encodeLocation(
2033
+ match.pathnameBase.replace(/%/g, "%25").replace(/\?/g, "%3F").replace(/#/g, "%23")
2034
+ ).pathname : match.pathnameBase
2035
+ ])
2036
+ })
2037
+ ),
2038
+ parentMatches,
2039
+ dataRouterOpts
2040
+ );
2041
+ return renderedMatches;
2042
+ }
2043
+ function DefaultErrorComponent() {
2044
+ let error = useRouteError();
2045
+ let message = isRouteErrorResponse(error) ? `${error.status} ${error.statusText}` : error instanceof Error ? error.message : JSON.stringify(error);
2046
+ let stack = error instanceof Error ? error.stack : null;
2047
+ let lightgrey = "rgba(200,200,200, 0.5)";
2048
+ let preStyles = { padding: "0.5rem", backgroundColor: lightgrey };
2049
+ let codeStyles = { padding: "2px 4px", backgroundColor: lightgrey };
2050
+ let devInfo = null;
2051
+ {
2052
+ console.error(
2053
+ "Error handled by React Router default ErrorBoundary:",
2054
+ error
2055
+ );
2056
+ devInfo = /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement("p", null, "💿 Hey developer 👋"), /* @__PURE__ */ React3.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own ", /* @__PURE__ */ React3.createElement("code", { style: codeStyles }, "ErrorBoundary"), " or", " ", /* @__PURE__ */ React3.createElement("code", { style: codeStyles }, "errorElement"), " prop on your route."));
2057
+ }
2058
+ return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement("h2", null, "Unexpected Application Error!"), /* @__PURE__ */ React3.createElement("h3", { style: { fontStyle: "italic" } }, message), stack ? /* @__PURE__ */ React3.createElement("pre", { style: preStyles }, stack) : null, devInfo);
2059
+ }
2060
+ var defaultErrorElement = /* @__PURE__ */ React3.createElement(DefaultErrorComponent, null);
2061
+ var RenderErrorBoundary = class extends React3.Component {
2062
+ constructor(props) {
2063
+ super(props);
2064
+ this.state = {
2065
+ location: props.location,
2066
+ revalidation: props.revalidation,
2067
+ error: props.error
2068
+ };
2069
+ }
2070
+ static getDerivedStateFromError(error) {
2071
+ return { error };
2072
+ }
2073
+ static getDerivedStateFromProps(props, state) {
2074
+ if (state.location !== props.location || state.revalidation !== "idle" && props.revalidation === "idle") {
2075
+ return {
2076
+ error: props.error,
2077
+ location: props.location,
2078
+ revalidation: props.revalidation
2079
+ };
2080
+ }
2081
+ return {
2082
+ error: props.error !== void 0 ? props.error : state.error,
2083
+ location: state.location,
2084
+ revalidation: props.revalidation || state.revalidation
2085
+ };
2086
+ }
2087
+ componentDidCatch(error, errorInfo) {
2088
+ if (this.props.onError) {
2089
+ this.props.onError(error, errorInfo);
2090
+ } else {
2091
+ console.error(
2092
+ "React Router caught the following error during render",
2093
+ error
2094
+ );
2095
+ }
2096
+ }
2097
+ render() {
2098
+ let error = this.state.error;
2099
+ if (this.context && typeof error === "object" && error && "digest" in error && typeof error.digest === "string") {
2100
+ const decoded = decodeRouteErrorResponseDigest(error.digest);
2101
+ if (decoded) error = decoded;
2102
+ }
2103
+ let result = error !== void 0 ? /* @__PURE__ */ React3.createElement(RouteContext.Provider, { value: this.props.routeContext }, /* @__PURE__ */ React3.createElement(
2104
+ RouteErrorContext.Provider,
2105
+ {
2106
+ value: error,
2107
+ children: this.props.component
2108
+ }
2109
+ )) : this.props.children;
2110
+ if (this.context) {
2111
+ return /* @__PURE__ */ React3.createElement(RSCErrorHandler, { error }, result);
2112
+ }
2113
+ return result;
2114
+ }
2115
+ };
2116
+ RenderErrorBoundary.contextType = RSCRouterContext;
2117
+ var errorRedirectHandledMap = /* @__PURE__ */ new WeakMap();
2118
+ function RSCErrorHandler({
2119
+ children,
2120
+ error
2121
+ }) {
2122
+ let { basename } = React3.useContext(NavigationContext);
2123
+ if (typeof error === "object" && error && "digest" in error && typeof error.digest === "string") {
2124
+ let redirect2 = decodeRedirectErrorDigest(error.digest);
2125
+ if (redirect2) {
2126
+ let existingRedirect = errorRedirectHandledMap.get(error);
2127
+ if (existingRedirect) throw existingRedirect;
2128
+ let parsed = parseToInfo(redirect2.location, basename);
2129
+ if (isBrowser && !errorRedirectHandledMap.get(error)) {
2130
+ if (parsed.isExternal || redirect2.reloadDocument) {
2131
+ window.location.href = parsed.absoluteURL || parsed.to;
2132
+ } else {
2133
+ const redirectPromise = Promise.resolve().then(
2134
+ () => window.__reactRouterDataRouter.navigate(parsed.to, {
2135
+ replace: redirect2.replace
2136
+ })
2137
+ );
2138
+ errorRedirectHandledMap.set(error, redirectPromise);
2139
+ throw redirectPromise;
2140
+ }
2141
+ }
2142
+ return /* @__PURE__ */ React3.createElement(
2143
+ "meta",
2144
+ {
2145
+ httpEquiv: "refresh",
2146
+ content: `0;url=${parsed.absoluteURL || parsed.to}`
2147
+ }
2148
+ );
2149
+ }
2150
+ }
2151
+ return children;
2152
+ }
2153
+ function RenderedRoute({ routeContext, match, children }) {
2154
+ let dataRouterContext = React3.useContext(DataRouterContext);
2155
+ if (dataRouterContext && dataRouterContext.static && dataRouterContext.staticContext && (match.route.errorElement || match.route.ErrorBoundary)) {
2156
+ dataRouterContext.staticContext._deepestRenderedBoundaryId = match.route.id;
2157
+ }
2158
+ return /* @__PURE__ */ React3.createElement(RouteContext.Provider, { value: routeContext }, children);
2159
+ }
2160
+ function _renderMatches(matches, parentMatches = [], dataRouterOpts) {
2161
+ let dataRouterState = dataRouterOpts?.state;
2162
+ if (matches == null) {
2163
+ if (!dataRouterState) {
2164
+ return null;
2165
+ }
2166
+ if (dataRouterState.errors) {
2167
+ matches = dataRouterState.matches;
2168
+ } else if (parentMatches.length === 0 && !dataRouterState.initialized && dataRouterState.matches.length > 0) {
2169
+ matches = dataRouterState.matches;
2170
+ } else {
2171
+ return null;
2172
+ }
2173
+ }
2174
+ let renderedMatches = matches;
2175
+ let errors = dataRouterState?.errors;
2176
+ if (errors != null) {
2177
+ let errorIndex = renderedMatches.findIndex(
2178
+ (m) => m.route.id && errors?.[m.route.id] !== void 0
2179
+ );
2180
+ invariant(
2181
+ errorIndex >= 0,
2182
+ `Could not find a matching route for errors on route IDs: ${Object.keys(
2183
+ errors
2184
+ ).join(",")}`
2185
+ );
2186
+ renderedMatches = renderedMatches.slice(
2187
+ 0,
2188
+ Math.min(renderedMatches.length, errorIndex + 1)
2189
+ );
2190
+ }
2191
+ let renderFallback = false;
2192
+ let fallbackIndex = -1;
2193
+ if (dataRouterOpts && dataRouterState) {
2194
+ renderFallback = dataRouterState.renderFallback;
2195
+ for (let i = 0; i < renderedMatches.length; i++) {
2196
+ let match = renderedMatches[i];
2197
+ if (match.route.HydrateFallback || match.route.hydrateFallbackElement) {
2198
+ fallbackIndex = i;
2199
+ }
2200
+ if (match.route.id) {
2201
+ let { loaderData, errors: errors2 } = dataRouterState;
2202
+ let needsToRunLoader = match.route.loader && !loaderData.hasOwnProperty(match.route.id) && (!errors2 || errors2[match.route.id] === void 0);
2203
+ if (match.route.lazy || needsToRunLoader) {
2204
+ if (dataRouterOpts.isStatic) {
2205
+ renderFallback = true;
2206
+ }
2207
+ if (fallbackIndex >= 0) {
2208
+ renderedMatches = renderedMatches.slice(0, fallbackIndex + 1);
2209
+ } else {
2210
+ renderedMatches = [renderedMatches[0]];
2211
+ }
2212
+ break;
2213
+ }
2214
+ }
2215
+ }
2216
+ }
2217
+ let onErrorHandler = dataRouterOpts?.onError;
2218
+ let onError = dataRouterState && onErrorHandler ? (error, errorInfo) => {
2219
+ onErrorHandler(error, {
2220
+ location: dataRouterState.location,
2221
+ params: dataRouterState.matches?.[0]?.params ?? {},
2222
+ unstable_pattern: getRoutePattern(dataRouterState.matches),
2223
+ errorInfo
2224
+ });
2225
+ } : void 0;
2226
+ return renderedMatches.reduceRight(
2227
+ (outlet, match, index) => {
2228
+ let error;
2229
+ let shouldRenderHydrateFallback = false;
2230
+ let errorElement = null;
2231
+ let hydrateFallbackElement = null;
2232
+ if (dataRouterState) {
2233
+ error = errors && match.route.id ? errors[match.route.id] : void 0;
2234
+ errorElement = match.route.errorElement || defaultErrorElement;
2235
+ if (renderFallback) {
2236
+ if (fallbackIndex < 0 && index === 0) {
2237
+ warningOnce(
2238
+ "route-fallback",
2239
+ false,
2240
+ "No `HydrateFallback` element provided to render during initial hydration"
2241
+ );
2242
+ shouldRenderHydrateFallback = true;
2243
+ hydrateFallbackElement = null;
2244
+ } else if (fallbackIndex === index) {
2245
+ shouldRenderHydrateFallback = true;
2246
+ hydrateFallbackElement = match.route.hydrateFallbackElement || null;
2247
+ }
2248
+ }
2249
+ }
2250
+ let matches2 = parentMatches.concat(renderedMatches.slice(0, index + 1));
2251
+ let getChildren = () => {
2252
+ let children;
2253
+ if (error) {
2254
+ children = errorElement;
2255
+ } else if (shouldRenderHydrateFallback) {
2256
+ children = hydrateFallbackElement;
2257
+ } else if (match.route.Component) {
2258
+ children = /* @__PURE__ */ React3.createElement(match.route.Component, null);
2259
+ } else if (match.route.element) {
2260
+ children = match.route.element;
2261
+ } else {
2262
+ children = outlet;
2263
+ }
2264
+ return /* @__PURE__ */ React3.createElement(
2265
+ RenderedRoute,
2266
+ {
2267
+ match,
2268
+ routeContext: {
2269
+ outlet,
2270
+ matches: matches2,
2271
+ isDataRoute: dataRouterState != null
2272
+ },
2273
+ children
2274
+ }
2275
+ );
2276
+ };
2277
+ return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /* @__PURE__ */ React3.createElement(
2278
+ RenderErrorBoundary,
2279
+ {
2280
+ location: dataRouterState.location,
2281
+ revalidation: dataRouterState.revalidation,
2282
+ component: errorElement,
2283
+ error,
2284
+ children: getChildren(),
2285
+ routeContext: { outlet: null, matches: matches2, isDataRoute: true },
2286
+ onError
2287
+ }
2288
+ ) : getChildren();
2289
+ },
2290
+ null
2291
+ );
2292
+ }
2293
+ function getDataRouterConsoleError(hookName) {
2294
+ return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
2295
+ }
2296
+ function useDataRouterContext(hookName) {
2297
+ let ctx = React3.useContext(DataRouterContext);
2298
+ invariant(ctx, getDataRouterConsoleError(hookName));
2299
+ return ctx;
2300
+ }
2301
+ function useDataRouterState(hookName) {
2302
+ let state = React3.useContext(DataRouterStateContext);
2303
+ invariant(state, getDataRouterConsoleError(hookName));
2304
+ return state;
2305
+ }
2306
+ function useRouteContext(hookName) {
2307
+ let route = React3.useContext(RouteContext);
2308
+ invariant(route, getDataRouterConsoleError(hookName));
2309
+ return route;
2310
+ }
2311
+ function useCurrentRouteId(hookName) {
2312
+ let route = useRouteContext(hookName);
2313
+ let thisRoute = route.matches[route.matches.length - 1];
2314
+ invariant(
2315
+ thisRoute.route.id,
2316
+ `${hookName} can only be used on routes that contain a unique "id"`
2317
+ );
2318
+ return thisRoute.route.id;
2319
+ }
2320
+ function useRouteId() {
2321
+ return useCurrentRouteId(
2322
+ "useRouteId"
2323
+ /* UseRouteId */
2324
+ );
2325
+ }
2326
+ function useRouteError() {
2327
+ let error = React3.useContext(RouteErrorContext);
2328
+ let state = useDataRouterState(
2329
+ "useRouteError"
2330
+ /* UseRouteError */
2331
+ );
2332
+ let routeId = useCurrentRouteId(
2333
+ "useRouteError"
2334
+ /* UseRouteError */
2335
+ );
2336
+ if (error !== void 0) {
2337
+ return error;
2338
+ }
2339
+ return state.errors?.[routeId];
2340
+ }
2341
+ function useNavigateStable() {
2342
+ let { router } = useDataRouterContext(
2343
+ "useNavigate"
2344
+ /* UseNavigateStable */
2345
+ );
2346
+ let id = useCurrentRouteId(
2347
+ "useNavigate"
2348
+ /* UseNavigateStable */
2349
+ );
2350
+ let activeRef = React3.useRef(false);
2351
+ useIsomorphicLayoutEffect(() => {
2352
+ activeRef.current = true;
2353
+ });
2354
+ let navigate = React3.useCallback(
2355
+ async (to, options = {}) => {
2356
+ warning(activeRef.current, navigateEffectWarning);
2357
+ if (!activeRef.current) return;
2358
+ if (typeof to === "number") {
2359
+ await router.navigate(to);
2360
+ } else {
2361
+ await router.navigate(to, { fromRouteId: id, ...options });
2362
+ }
2363
+ },
2364
+ [router, id]
2365
+ );
2366
+ return navigate;
2367
+ }
2368
+ var alreadyWarned = {};
2369
+ function warningOnce(key, cond, message) {
2370
+ if (!cond && !alreadyWarned[key]) {
2371
+ alreadyWarned[key] = true;
2372
+ warning(false, message);
2373
+ }
2374
+ }
2375
+ React3.memo(DataRoutes);
2376
+ function DataRoutes({
2377
+ routes,
2378
+ future,
2379
+ state,
2380
+ isStatic,
2381
+ onError
2382
+ }) {
2383
+ return useRoutesImpl(routes, void 0, { state, isStatic, onError });
2384
+ }
2385
+ var defaultMethod = "get";
2386
+ var defaultEncType = "application/x-www-form-urlencoded";
2387
+ function isHtmlElement(object) {
2388
+ return typeof HTMLElement !== "undefined" && object instanceof HTMLElement;
2389
+ }
2390
+ function isButtonElement(object) {
2391
+ return isHtmlElement(object) && object.tagName.toLowerCase() === "button";
2392
+ }
2393
+ function isFormElement(object) {
2394
+ return isHtmlElement(object) && object.tagName.toLowerCase() === "form";
2395
+ }
2396
+ function isInputElement(object) {
2397
+ return isHtmlElement(object) && object.tagName.toLowerCase() === "input";
2398
+ }
2399
+ function isModifiedEvent(event) {
2400
+ return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
2401
+ }
2402
+ function shouldProcessLinkClick(event, target) {
2403
+ return event.button === 0 && // Ignore everything but left clicks
2404
+ (!target || target === "_self") && // Let browser handle "target=_blank" etc.
2405
+ !isModifiedEvent(event);
2406
+ }
2407
+ var _formDataSupportsSubmitter = null;
2408
+ function isFormDataSubmitterSupported() {
2409
+ if (_formDataSupportsSubmitter === null) {
2410
+ try {
2411
+ new FormData(
2412
+ document.createElement("form"),
2413
+ // @ts-expect-error if FormData supports the submitter parameter, this will throw
2414
+ 0
2415
+ );
2416
+ _formDataSupportsSubmitter = false;
2417
+ } catch (e) {
2418
+ _formDataSupportsSubmitter = true;
2419
+ }
2420
+ }
2421
+ return _formDataSupportsSubmitter;
2422
+ }
2423
+ var supportedFormEncTypes = /* @__PURE__ */ new Set([
2424
+ "application/x-www-form-urlencoded",
2425
+ "multipart/form-data",
2426
+ "text/plain"
2427
+ ]);
2428
+ function getFormEncType(encType) {
2429
+ if (encType != null && !supportedFormEncTypes.has(encType)) {
2430
+ warning(
2431
+ false,
2432
+ `"${encType}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${defaultEncType}"`
2433
+ );
2434
+ return null;
2435
+ }
2436
+ return encType;
2437
+ }
2438
+ function getFormSubmissionInfo(target, basename) {
2439
+ let method;
2440
+ let action;
2441
+ let encType;
2442
+ let formData;
2443
+ let body;
2444
+ if (isFormElement(target)) {
2445
+ let attr = target.getAttribute("action");
2446
+ action = attr ? stripBasename(attr, basename) : null;
2447
+ method = target.getAttribute("method") || defaultMethod;
2448
+ encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType;
2449
+ formData = new FormData(target);
2450
+ } else if (isButtonElement(target) || isInputElement(target) && (target.type === "submit" || target.type === "image")) {
2451
+ let form = target.form;
2452
+ if (form == null) {
2453
+ throw new Error(
2454
+ `Cannot submit a <button> or <input type="submit"> without a <form>`
2455
+ );
2456
+ }
2457
+ let attr = target.getAttribute("formaction") || form.getAttribute("action");
2458
+ action = attr ? stripBasename(attr, basename) : null;
2459
+ method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod;
2460
+ encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType;
2461
+ formData = new FormData(form, target);
2462
+ if (!isFormDataSubmitterSupported()) {
2463
+ let { name, type, value } = target;
2464
+ if (type === "image") {
2465
+ let prefix = name ? `${name}.` : "";
2466
+ formData.append(`${prefix}x`, "0");
2467
+ formData.append(`${prefix}y`, "0");
2468
+ } else if (name) {
2469
+ formData.append(name, value);
2470
+ }
2471
+ }
2472
+ } else if (isHtmlElement(target)) {
2473
+ throw new Error(
2474
+ `Cannot submit element that is not <form>, <button>, or <input type="submit|image">`
2475
+ );
2476
+ } else {
2477
+ method = defaultMethod;
2478
+ action = null;
2479
+ encType = defaultEncType;
2480
+ body = target;
2481
+ }
2482
+ if (formData && encType === "text/plain") {
2483
+ body = formData;
2484
+ formData = void 0;
2485
+ }
2486
+ return { action, method: method.toLowerCase(), encType, formData, body };
2487
+ }
2488
+ Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
2489
+ function invariant2(value, message) {
2490
+ if (value === false || value === null || typeof value === "undefined") {
2491
+ throw new Error(message);
2492
+ }
2493
+ }
2494
+ function singleFetchUrl(reqUrl, basename, trailingSlashAware, extension) {
2495
+ let url = typeof reqUrl === "string" ? new URL(
2496
+ reqUrl,
2497
+ // This can be called during the SSR flow via PrefetchPageLinksImpl so
2498
+ // don't assume window is available
2499
+ typeof window === "undefined" ? "server://singlefetch/" : window.location.origin
2500
+ ) : reqUrl;
2501
+ if (trailingSlashAware) {
2502
+ if (url.pathname.endsWith("/")) {
2503
+ url.pathname = `${url.pathname}_.${extension}`;
2504
+ } else {
2505
+ url.pathname = `${url.pathname}.${extension}`;
2506
+ }
2507
+ } else {
2508
+ if (url.pathname === "/") {
2509
+ url.pathname = `_root.${extension}`;
2510
+ } else if (basename && stripBasename(url.pathname, basename) === "/") {
2511
+ url.pathname = `${basename.replace(/\/$/, "")}/_root.${extension}`;
2512
+ } else {
2513
+ url.pathname = `${url.pathname.replace(/\/$/, "")}.${extension}`;
2514
+ }
2515
+ }
2516
+ return url;
2517
+ }
2518
+ async function loadRouteModule(route, routeModulesCache) {
2519
+ if (route.id in routeModulesCache) {
2520
+ return routeModulesCache[route.id];
2521
+ }
2522
+ try {
2523
+ let routeModule = await import(
2524
+ /* @vite-ignore */
2525
+ /* webpackIgnore: true */
2526
+ route.module
2527
+ );
2528
+ routeModulesCache[route.id] = routeModule;
2529
+ return routeModule;
2530
+ } catch (error) {
2531
+ console.error(
2532
+ `Error loading route module \`${route.module}\`, reloading page...`
2533
+ );
2534
+ console.error(error);
2535
+ if (window.__reactRouterContext && window.__reactRouterContext.isSpaMode && // @ts-expect-error
2536
+ void 0) ;
2537
+ window.location.reload();
2538
+ return new Promise(() => {
2539
+ });
2540
+ }
2541
+ }
2542
+ function isHtmlLinkDescriptor(object) {
2543
+ if (object == null) {
2544
+ return false;
2545
+ }
2546
+ if (object.href == null) {
2547
+ return object.rel === "preload" && typeof object.imageSrcSet === "string" && typeof object.imageSizes === "string";
2548
+ }
2549
+ return typeof object.rel === "string" && typeof object.href === "string";
2550
+ }
2551
+ async function getKeyedPrefetchLinks(matches, manifest, routeModules) {
2552
+ let links = await Promise.all(
2553
+ matches.map(async (match) => {
2554
+ let route = manifest.routes[match.route.id];
2555
+ if (route) {
2556
+ let mod = await loadRouteModule(route, routeModules);
2557
+ return mod.links ? mod.links() : [];
2558
+ }
2559
+ return [];
2560
+ })
2561
+ );
2562
+ return dedupeLinkDescriptors(
2563
+ links.flat(1).filter(isHtmlLinkDescriptor).filter((link) => link.rel === "stylesheet" || link.rel === "preload").map(
2564
+ (link) => link.rel === "stylesheet" ? { ...link, rel: "prefetch", as: "style" } : { ...link, rel: "prefetch" }
2565
+ )
2566
+ );
2567
+ }
2568
+ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, location, mode) {
2569
+ let isNew = (match, index) => {
2570
+ if (!currentMatches[index]) return true;
2571
+ return match.route.id !== currentMatches[index].route.id;
2572
+ };
2573
+ let matchPathChanged = (match, index) => {
2574
+ return (
2575
+ // param change, /users/123 -> /users/456
2576
+ currentMatches[index].pathname !== match.pathname || // splat param changed, which is not present in match.path
2577
+ // e.g. /files/images/avatar.jpg -> files/finances.xls
2578
+ currentMatches[index].route.path?.endsWith("*") && currentMatches[index].params["*"] !== match.params["*"]
2579
+ );
2580
+ };
2581
+ if (mode === "assets") {
2582
+ return nextMatches.filter(
2583
+ (match, index) => isNew(match, index) || matchPathChanged(match, index)
2584
+ );
2585
+ }
2586
+ if (mode === "data") {
2587
+ return nextMatches.filter((match, index) => {
2588
+ let manifestRoute = manifest.routes[match.route.id];
2589
+ if (!manifestRoute || !manifestRoute.hasLoader) {
2590
+ return false;
2591
+ }
2592
+ if (isNew(match, index) || matchPathChanged(match, index)) {
2593
+ return true;
2594
+ }
2595
+ if (match.route.shouldRevalidate) {
2596
+ let routeChoice = match.route.shouldRevalidate({
2597
+ currentUrl: new URL(
2598
+ location.pathname + location.search + location.hash,
2599
+ window.origin
2600
+ ),
2601
+ currentParams: currentMatches[0]?.params || {},
2602
+ nextUrl: new URL(page, window.origin),
2603
+ nextParams: match.params,
2604
+ defaultShouldRevalidate: true
2605
+ });
2606
+ if (typeof routeChoice === "boolean") {
2607
+ return routeChoice;
2608
+ }
2609
+ }
2610
+ return true;
2611
+ });
2612
+ }
2613
+ return [];
2614
+ }
2615
+ function getModuleLinkHrefs(matches, manifest, { includeHydrateFallback } = {}) {
2616
+ return dedupeHrefs(
2617
+ matches.map((match) => {
2618
+ let route = manifest.routes[match.route.id];
2619
+ if (!route) return [];
2620
+ let hrefs = [route.module];
2621
+ if (route.clientActionModule) {
2622
+ hrefs = hrefs.concat(route.clientActionModule);
2623
+ }
2624
+ if (route.clientLoaderModule) {
2625
+ hrefs = hrefs.concat(route.clientLoaderModule);
2626
+ }
2627
+ if (includeHydrateFallback && route.hydrateFallbackModule) {
2628
+ hrefs = hrefs.concat(route.hydrateFallbackModule);
2629
+ }
2630
+ if (route.imports) {
2631
+ hrefs = hrefs.concat(route.imports);
2632
+ }
2633
+ return hrefs;
2634
+ }).flat(1)
2635
+ );
2636
+ }
2637
+ function dedupeHrefs(hrefs) {
2638
+ return [...new Set(hrefs)];
2639
+ }
2640
+ function sortKeys(obj) {
2641
+ let sorted = {};
2642
+ let keys = Object.keys(obj).sort();
2643
+ for (let key of keys) {
2644
+ sorted[key] = obj[key];
2645
+ }
2646
+ return sorted;
2647
+ }
2648
+ function dedupeLinkDescriptors(descriptors, preloads) {
2649
+ let set = /* @__PURE__ */ new Set();
2650
+ new Set(preloads);
2651
+ return descriptors.reduce((deduped, descriptor) => {
2652
+ let key = JSON.stringify(sortKeys(descriptor));
2653
+ if (!set.has(key)) {
2654
+ set.add(key);
2655
+ deduped.push({ key, link: descriptor });
2656
+ }
2657
+ return deduped;
2658
+ }, []);
2659
+ }
2660
+ function useDataRouterContext2() {
2661
+ let context = React3.useContext(DataRouterContext);
2662
+ invariant2(
2663
+ context,
2664
+ "You must render this element inside a <DataRouterContext.Provider> element"
2665
+ );
2666
+ return context;
2667
+ }
2668
+ function useDataRouterStateContext() {
2669
+ let context = React3.useContext(DataRouterStateContext);
2670
+ invariant2(
2671
+ context,
2672
+ "You must render this element inside a <DataRouterStateContext.Provider> element"
2673
+ );
2674
+ return context;
2675
+ }
2676
+ var FrameworkContext = React3.createContext(void 0);
2677
+ FrameworkContext.displayName = "FrameworkContext";
2678
+ function useFrameworkContext() {
2679
+ let context = React3.useContext(FrameworkContext);
2680
+ invariant2(
2681
+ context,
2682
+ "You must render this element inside a <HydratedRouter> element"
2683
+ );
2684
+ return context;
2685
+ }
2686
+ function usePrefetchBehavior(prefetch, theirElementProps) {
2687
+ let frameworkContext = React3.useContext(FrameworkContext);
2688
+ let [maybePrefetch, setMaybePrefetch] = React3.useState(false);
2689
+ let [shouldPrefetch, setShouldPrefetch] = React3.useState(false);
2690
+ let { onFocus, onBlur, onMouseEnter, onMouseLeave, onTouchStart } = theirElementProps;
2691
+ let ref = React3.useRef(null);
2692
+ React3.useEffect(() => {
2693
+ if (prefetch === "render") {
2694
+ setShouldPrefetch(true);
2695
+ }
2696
+ if (prefetch === "viewport") {
2697
+ let callback = (entries) => {
2698
+ entries.forEach((entry) => {
2699
+ setShouldPrefetch(entry.isIntersecting);
2700
+ });
2701
+ };
2702
+ let observer = new IntersectionObserver(callback, { threshold: 0.5 });
2703
+ if (ref.current) observer.observe(ref.current);
2704
+ return () => {
2705
+ observer.disconnect();
2706
+ };
2707
+ }
2708
+ }, [prefetch]);
2709
+ React3.useEffect(() => {
2710
+ if (maybePrefetch) {
2711
+ let id = setTimeout(() => {
2712
+ setShouldPrefetch(true);
2713
+ }, 100);
2714
+ return () => {
2715
+ clearTimeout(id);
2716
+ };
2717
+ }
2718
+ }, [maybePrefetch]);
2719
+ let setIntent = () => {
2720
+ setMaybePrefetch(true);
2721
+ };
2722
+ let cancelIntent = () => {
2723
+ setMaybePrefetch(false);
2724
+ setShouldPrefetch(false);
2725
+ };
2726
+ if (!frameworkContext) {
2727
+ return [false, ref, {}];
2728
+ }
2729
+ if (prefetch !== "intent") {
2730
+ return [shouldPrefetch, ref, {}];
2731
+ }
2732
+ return [
2733
+ shouldPrefetch,
2734
+ ref,
2735
+ {
2736
+ onFocus: composeEventHandlers(onFocus, setIntent),
2737
+ onBlur: composeEventHandlers(onBlur, cancelIntent),
2738
+ onMouseEnter: composeEventHandlers(onMouseEnter, setIntent),
2739
+ onMouseLeave: composeEventHandlers(onMouseLeave, cancelIntent),
2740
+ onTouchStart: composeEventHandlers(onTouchStart, setIntent)
2741
+ }
2742
+ ];
2743
+ }
2744
+ function composeEventHandlers(theirHandler, ourHandler) {
2745
+ return (event) => {
2746
+ theirHandler && theirHandler(event);
2747
+ if (!event.defaultPrevented) {
2748
+ ourHandler(event);
2749
+ }
2750
+ };
2751
+ }
2752
+ function PrefetchPageLinks({ page, ...linkProps }) {
2753
+ let { router } = useDataRouterContext2();
2754
+ let matches = React3.useMemo(
2755
+ () => matchRoutes(router.routes, page, router.basename),
2756
+ [router.routes, page, router.basename]
2757
+ );
2758
+ if (!matches) {
2759
+ return null;
2760
+ }
2761
+ return /* @__PURE__ */ React3.createElement(PrefetchPageLinksImpl, { page, matches, ...linkProps });
2762
+ }
2763
+ function useKeyedPrefetchLinks(matches) {
2764
+ let { manifest, routeModules } = useFrameworkContext();
2765
+ let [keyedPrefetchLinks, setKeyedPrefetchLinks] = React3.useState([]);
2766
+ React3.useEffect(() => {
2767
+ let interrupted = false;
2768
+ void getKeyedPrefetchLinks(matches, manifest, routeModules).then(
2769
+ (links) => {
2770
+ if (!interrupted) {
2771
+ setKeyedPrefetchLinks(links);
2772
+ }
2773
+ }
2774
+ );
2775
+ return () => {
2776
+ interrupted = true;
2777
+ };
2778
+ }, [matches, manifest, routeModules]);
2779
+ return keyedPrefetchLinks;
2780
+ }
2781
+ function PrefetchPageLinksImpl({
2782
+ page,
2783
+ matches: nextMatches,
2784
+ ...linkProps
2785
+ }) {
2786
+ let location = useLocation();
2787
+ let { future, manifest, routeModules } = useFrameworkContext();
2788
+ let { basename } = useDataRouterContext2();
2789
+ let { loaderData, matches } = useDataRouterStateContext();
2790
+ let newMatchesForData = React3.useMemo(
2791
+ () => getNewMatchesForLinks(
2792
+ page,
2793
+ nextMatches,
2794
+ matches,
2795
+ manifest,
2796
+ location,
2797
+ "data"
2798
+ ),
2799
+ [page, nextMatches, matches, manifest, location]
2800
+ );
2801
+ let newMatchesForAssets = React3.useMemo(
2802
+ () => getNewMatchesForLinks(
2803
+ page,
2804
+ nextMatches,
2805
+ matches,
2806
+ manifest,
2807
+ location,
2808
+ "assets"
2809
+ ),
2810
+ [page, nextMatches, matches, manifest, location]
2811
+ );
2812
+ let dataHrefs = React3.useMemo(() => {
2813
+ if (page === location.pathname + location.search + location.hash) {
2814
+ return [];
2815
+ }
2816
+ let routesParams = /* @__PURE__ */ new Set();
2817
+ let foundOptOutRoute = false;
2818
+ nextMatches.forEach((m) => {
2819
+ let manifestRoute = manifest.routes[m.route.id];
2820
+ if (!manifestRoute || !manifestRoute.hasLoader) {
2821
+ return;
2822
+ }
2823
+ if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && routeModules[m.route.id]?.shouldRevalidate) {
2824
+ foundOptOutRoute = true;
2825
+ } else if (manifestRoute.hasClientLoader) {
2826
+ foundOptOutRoute = true;
2827
+ } else {
2828
+ routesParams.add(m.route.id);
2829
+ }
2830
+ });
2831
+ if (routesParams.size === 0) {
2832
+ return [];
2833
+ }
2834
+ let url = singleFetchUrl(
2835
+ page,
2836
+ basename,
2837
+ future.unstable_trailingSlashAwareDataRequests,
2838
+ "data"
2839
+ );
2840
+ if (foundOptOutRoute && routesParams.size > 0) {
2841
+ url.searchParams.set(
2842
+ "_routes",
2843
+ nextMatches.filter((m) => routesParams.has(m.route.id)).map((m) => m.route.id).join(",")
2844
+ );
2845
+ }
2846
+ return [url.pathname + url.search];
2847
+ }, [
2848
+ basename,
2849
+ future.unstable_trailingSlashAwareDataRequests,
2850
+ loaderData,
2851
+ location,
2852
+ manifest,
2853
+ newMatchesForData,
2854
+ nextMatches,
2855
+ page,
2856
+ routeModules
2857
+ ]);
2858
+ let moduleHrefs = React3.useMemo(
2859
+ () => getModuleLinkHrefs(newMatchesForAssets, manifest),
2860
+ [newMatchesForAssets, manifest]
2861
+ );
2862
+ let keyedPrefetchLinks = useKeyedPrefetchLinks(newMatchesForAssets);
2863
+ return /* @__PURE__ */ React3.createElement(React3.Fragment, null, dataHrefs.map((href) => /* @__PURE__ */ React3.createElement("link", { key: href, rel: "prefetch", as: "fetch", href, ...linkProps })), moduleHrefs.map((href) => /* @__PURE__ */ React3.createElement("link", { key: href, rel: "modulepreload", href, ...linkProps })), keyedPrefetchLinks.map(({ key, link }) => (
2864
+ // these don't spread `linkProps` because they are full link descriptors
2865
+ // already with their own props
2866
+ /* @__PURE__ */ React3.createElement(
2867
+ "link",
2868
+ {
2869
+ key,
2870
+ nonce: linkProps.nonce,
2871
+ ...link,
2872
+ crossOrigin: link.crossOrigin ?? linkProps.crossOrigin
2873
+ }
2874
+ )
2875
+ )));
2876
+ }
2877
+ function mergeRefs(...refs) {
2878
+ return (value) => {
2879
+ refs.forEach((ref) => {
2880
+ if (typeof ref === "function") {
2881
+ ref(value);
2882
+ } else if (ref != null) {
2883
+ ref.current = value;
2884
+ }
2885
+ });
2886
+ };
2887
+ }
2888
+ var isBrowser2 = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
2889
+ try {
2890
+ if (isBrowser2) {
2891
+ window.__reactRouterVersion = // @ts-expect-error
2892
+ "7.13.2";
2893
+ }
2894
+ } catch (e) {
2895
+ }
2896
+ var ABSOLUTE_URL_REGEX2 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
2897
+ var Link = React3.forwardRef(
2898
+ function LinkWithRef({
2899
+ onClick,
2900
+ discover = "render",
2901
+ prefetch = "none",
2902
+ relative,
2903
+ reloadDocument,
2904
+ replace: replace2,
2905
+ unstable_mask,
2906
+ state,
2907
+ target,
2908
+ to,
2909
+ preventScrollReset,
2910
+ viewTransition,
2911
+ unstable_defaultShouldRevalidate,
2912
+ ...rest
2913
+ }, forwardedRef) {
2914
+ let { basename, navigator, unstable_useTransitions } = React3.useContext(NavigationContext);
2915
+ let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX2.test(to);
2916
+ let parsed = parseToInfo(to, basename);
2917
+ to = parsed.to;
2918
+ let href = useHref(to, { relative });
2919
+ let location = useLocation();
2920
+ let maskedHref = null;
2921
+ if (unstable_mask) {
2922
+ let resolved = resolveTo(
2923
+ unstable_mask,
2924
+ [],
2925
+ location.unstable_mask ? location.unstable_mask.pathname : "/",
2926
+ true
2927
+ );
2928
+ if (basename !== "/") {
2929
+ resolved.pathname = resolved.pathname === "/" ? basename : joinPaths([basename, resolved.pathname]);
2930
+ }
2931
+ maskedHref = navigator.createHref(resolved);
2932
+ }
2933
+ let [shouldPrefetch, prefetchRef, prefetchHandlers] = usePrefetchBehavior(
2934
+ prefetch,
2935
+ rest
2936
+ );
2937
+ let internalOnClick = useLinkClickHandler(to, {
2938
+ replace: replace2,
2939
+ unstable_mask,
2940
+ state,
2941
+ target,
2942
+ preventScrollReset,
2943
+ relative,
2944
+ viewTransition,
2945
+ unstable_defaultShouldRevalidate,
2946
+ unstable_useTransitions
2947
+ });
2948
+ function handleClick(event) {
2949
+ if (onClick) onClick(event);
2950
+ if (!event.defaultPrevented) {
2951
+ internalOnClick(event);
2952
+ }
2953
+ }
2954
+ let isSpaLink = !(parsed.isExternal || reloadDocument);
2955
+ let link = (
2956
+ // eslint-disable-next-line jsx-a11y/anchor-has-content
2957
+ /* @__PURE__ */ React3.createElement(
2958
+ "a",
2959
+ {
2960
+ ...rest,
2961
+ ...prefetchHandlers,
2962
+ href: (isSpaLink ? maskedHref : void 0) || parsed.absoluteURL || href,
2963
+ onClick: isSpaLink ? handleClick : onClick,
2964
+ ref: mergeRefs(forwardedRef, prefetchRef),
2965
+ target,
2966
+ "data-discover": !isAbsolute && discover === "render" ? "true" : void 0
2967
+ }
2968
+ )
2969
+ );
2970
+ return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React3.createElement(React3.Fragment, null, link, /* @__PURE__ */ React3.createElement(PrefetchPageLinks, { page: href })) : link;
2971
+ }
2972
+ );
2973
+ Link.displayName = "Link";
2974
+ var NavLink = React3.forwardRef(
2975
+ function NavLinkWithRef({
2976
+ "aria-current": ariaCurrentProp = "page",
2977
+ caseSensitive = false,
2978
+ className: classNameProp = "",
2979
+ end = false,
2980
+ style: styleProp,
2981
+ to,
2982
+ viewTransition,
2983
+ children,
2984
+ ...rest
2985
+ }, ref) {
2986
+ let path = useResolvedPath(to, { relative: rest.relative });
2987
+ let location = useLocation();
2988
+ let routerState = React3.useContext(DataRouterStateContext);
2989
+ let { navigator, basename } = React3.useContext(NavigationContext);
2990
+ let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
2991
+ // eslint-disable-next-line react-hooks/rules-of-hooks
2992
+ useViewTransitionState(path) && viewTransition === true;
2993
+ let toPathname = navigator.encodeLocation ? navigator.encodeLocation(path).pathname : path.pathname;
2994
+ let locationPathname = location.pathname;
2995
+ let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null;
2996
+ if (!caseSensitive) {
2997
+ locationPathname = locationPathname.toLowerCase();
2998
+ nextLocationPathname = nextLocationPathname ? nextLocationPathname.toLowerCase() : null;
2999
+ toPathname = toPathname.toLowerCase();
3000
+ }
3001
+ if (nextLocationPathname && basename) {
3002
+ nextLocationPathname = stripBasename(nextLocationPathname, basename) || nextLocationPathname;
3003
+ }
3004
+ const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
3005
+ let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
3006
+ let isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(toPathname.length) === "/");
3007
+ let renderProps = {
3008
+ isActive,
3009
+ isPending,
3010
+ isTransitioning
3011
+ };
3012
+ let ariaCurrent = isActive ? ariaCurrentProp : void 0;
3013
+ let className;
3014
+ if (typeof classNameProp === "function") {
3015
+ className = classNameProp(renderProps);
3016
+ } else {
3017
+ className = [
3018
+ classNameProp,
3019
+ isActive ? "active" : null,
3020
+ isPending ? "pending" : null,
3021
+ isTransitioning ? "transitioning" : null
3022
+ ].filter(Boolean).join(" ");
3023
+ }
3024
+ let style = typeof styleProp === "function" ? styleProp(renderProps) : styleProp;
3025
+ return /* @__PURE__ */ React3.createElement(
3026
+ Link,
3027
+ {
3028
+ ...rest,
3029
+ "aria-current": ariaCurrent,
3030
+ className,
3031
+ ref,
3032
+ style,
3033
+ to,
3034
+ viewTransition
3035
+ },
3036
+ typeof children === "function" ? children(renderProps) : children
3037
+ );
3038
+ }
3039
+ );
3040
+ NavLink.displayName = "NavLink";
3041
+ var Form = React3.forwardRef(
3042
+ ({
3043
+ discover = "render",
3044
+ fetcherKey,
3045
+ navigate,
3046
+ reloadDocument,
3047
+ replace: replace2,
3048
+ state,
3049
+ method = defaultMethod,
3050
+ action,
3051
+ onSubmit,
3052
+ relative,
3053
+ preventScrollReset,
3054
+ viewTransition,
3055
+ unstable_defaultShouldRevalidate,
3056
+ ...props
3057
+ }, forwardedRef) => {
3058
+ let { unstable_useTransitions } = React3.useContext(NavigationContext);
3059
+ let submit = useSubmit();
3060
+ let formAction = useFormAction(action, { relative });
3061
+ let formMethod = method.toLowerCase() === "get" ? "get" : "post";
3062
+ let isAbsolute = typeof action === "string" && ABSOLUTE_URL_REGEX2.test(action);
3063
+ let submitHandler = (event) => {
3064
+ onSubmit && onSubmit(event);
3065
+ if (event.defaultPrevented) return;
3066
+ event.preventDefault();
3067
+ let submitter = event.nativeEvent.submitter;
3068
+ let submitMethod = submitter?.getAttribute("formmethod") || method;
3069
+ let doSubmit = () => submit(submitter || event.currentTarget, {
3070
+ fetcherKey,
3071
+ method: submitMethod,
3072
+ navigate,
3073
+ replace: replace2,
3074
+ state,
3075
+ relative,
3076
+ preventScrollReset,
3077
+ viewTransition,
3078
+ unstable_defaultShouldRevalidate
3079
+ });
3080
+ if (unstable_useTransitions && navigate !== false) {
3081
+ React3.startTransition(() => doSubmit());
3082
+ } else {
3083
+ doSubmit();
3084
+ }
3085
+ };
3086
+ return /* @__PURE__ */ React3.createElement(
3087
+ "form",
3088
+ {
3089
+ ref: forwardedRef,
3090
+ method: formMethod,
3091
+ action: formAction,
3092
+ onSubmit: reloadDocument ? onSubmit : submitHandler,
3093
+ ...props,
3094
+ "data-discover": !isAbsolute && discover === "render" ? "true" : void 0
3095
+ }
3096
+ );
3097
+ }
3098
+ );
3099
+ Form.displayName = "Form";
3100
+ function getDataRouterConsoleError2(hookName) {
3101
+ return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
3102
+ }
3103
+ function useDataRouterContext3(hookName) {
3104
+ let ctx = React3.useContext(DataRouterContext);
3105
+ invariant(ctx, getDataRouterConsoleError2(hookName));
3106
+ return ctx;
3107
+ }
3108
+ function useLinkClickHandler(to, {
3109
+ target,
3110
+ replace: replaceProp,
3111
+ unstable_mask,
3112
+ state,
3113
+ preventScrollReset,
3114
+ relative,
3115
+ viewTransition,
3116
+ unstable_defaultShouldRevalidate,
3117
+ unstable_useTransitions
3118
+ } = {}) {
3119
+ let navigate = useNavigate();
3120
+ let location = useLocation();
3121
+ let path = useResolvedPath(to, { relative });
3122
+ return React3.useCallback(
3123
+ (event) => {
3124
+ if (shouldProcessLinkClick(event, target)) {
3125
+ event.preventDefault();
3126
+ let replace2 = replaceProp !== void 0 ? replaceProp : createPath(location) === createPath(path);
3127
+ let doNavigate = () => navigate(to, {
3128
+ replace: replace2,
3129
+ unstable_mask,
3130
+ state,
3131
+ preventScrollReset,
3132
+ relative,
3133
+ viewTransition,
3134
+ unstable_defaultShouldRevalidate
3135
+ });
3136
+ if (unstable_useTransitions) {
3137
+ React3.startTransition(() => doNavigate());
3138
+ } else {
3139
+ doNavigate();
3140
+ }
3141
+ }
3142
+ },
3143
+ [
3144
+ location,
3145
+ navigate,
3146
+ path,
3147
+ replaceProp,
3148
+ unstable_mask,
3149
+ state,
3150
+ target,
3151
+ to,
3152
+ preventScrollReset,
3153
+ relative,
3154
+ viewTransition,
3155
+ unstable_defaultShouldRevalidate,
3156
+ unstable_useTransitions
3157
+ ]
3158
+ );
3159
+ }
3160
+ var fetcherId = 0;
3161
+ var getUniqueFetcherId = () => `__${String(++fetcherId)}__`;
3162
+ function useSubmit() {
3163
+ let { router } = useDataRouterContext3(
3164
+ "useSubmit"
3165
+ /* UseSubmit */
3166
+ );
3167
+ let { basename } = React3.useContext(NavigationContext);
3168
+ let currentRouteId = useRouteId();
3169
+ let routerFetch = router.fetch;
3170
+ let routerNavigate = router.navigate;
3171
+ return React3.useCallback(
3172
+ async (target, options = {}) => {
3173
+ let { action, method, encType, formData, body } = getFormSubmissionInfo(
3174
+ target,
3175
+ basename
3176
+ );
3177
+ if (options.navigate === false) {
3178
+ let key = options.fetcherKey || getUniqueFetcherId();
3179
+ await routerFetch(key, currentRouteId, options.action || action, {
3180
+ unstable_defaultShouldRevalidate: options.unstable_defaultShouldRevalidate,
3181
+ preventScrollReset: options.preventScrollReset,
3182
+ formData,
3183
+ body,
3184
+ formMethod: options.method || method,
3185
+ formEncType: options.encType || encType,
3186
+ flushSync: options.flushSync
3187
+ });
3188
+ } else {
3189
+ await routerNavigate(options.action || action, {
3190
+ unstable_defaultShouldRevalidate: options.unstable_defaultShouldRevalidate,
3191
+ preventScrollReset: options.preventScrollReset,
3192
+ formData,
3193
+ body,
3194
+ formMethod: options.method || method,
3195
+ formEncType: options.encType || encType,
3196
+ replace: options.replace,
3197
+ state: options.state,
3198
+ fromRouteId: currentRouteId,
3199
+ flushSync: options.flushSync,
3200
+ viewTransition: options.viewTransition
3201
+ });
3202
+ }
3203
+ },
3204
+ [routerFetch, routerNavigate, basename, currentRouteId]
3205
+ );
3206
+ }
3207
+ function useFormAction(action, { relative } = {}) {
3208
+ let { basename } = React3.useContext(NavigationContext);
3209
+ let routeContext = React3.useContext(RouteContext);
3210
+ invariant(routeContext, "useFormAction must be used inside a RouteContext");
3211
+ let [match] = routeContext.matches.slice(-1);
3212
+ let path = { ...useResolvedPath(action ? action : ".", { relative }) };
3213
+ let location = useLocation();
3214
+ if (action == null) {
3215
+ path.search = location.search;
3216
+ let params = new URLSearchParams(path.search);
3217
+ let indexValues = params.getAll("index");
3218
+ let hasNakedIndexParam = indexValues.some((v) => v === "");
3219
+ if (hasNakedIndexParam) {
3220
+ params.delete("index");
3221
+ indexValues.filter((v) => v).forEach((v) => params.append("index", v));
3222
+ let qs = params.toString();
3223
+ path.search = qs ? `?${qs}` : "";
3224
+ }
3225
+ }
3226
+ if ((!action || action === ".") && match.route.index) {
3227
+ path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
3228
+ }
3229
+ if (basename !== "/") {
3230
+ path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
3231
+ }
3232
+ return createPath(path);
3233
+ }
3234
+ function useViewTransitionState(to, { relative } = {}) {
3235
+ let vtContext = React3.useContext(ViewTransitionContext);
3236
+ invariant(
3237
+ vtContext != null,
3238
+ "`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
3239
+ );
3240
+ let { basename } = useDataRouterContext3(
3241
+ "useViewTransitionState"
3242
+ /* useViewTransitionState */
3243
+ );
3244
+ let path = useResolvedPath(to, { relative });
3245
+ if (!vtContext.isTransitioning) {
3246
+ return false;
3247
+ }
3248
+ let currentPath = stripBasename(vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
3249
+ let nextPath = stripBasename(vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
3250
+ return matchPath(path.pathname, nextPath) != null || matchPath(path.pathname, currentPath) != null;
3251
+ }
3252
+ function getDefaultExportFromCjs(x) {
3253
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
3254
+ }
3255
+ export {
3256
+ Action as A,
3257
+ BehaviorSubject as B,
3258
+ EmptyError as E,
3259
+ Link as L,
3260
+ Observable as O,
3261
+ Subscription as S,
3262
+ __extends as _,
3263
+ identity as a,
3264
+ isFunction as b,
3265
+ createOperatorSubscriber as c,
3266
+ of as d,
3267
+ from as e,
3268
+ firstValueFrom as f,
3269
+ getDefaultExportFromCjs as g,
3270
+ __spreadArray as h,
3271
+ innerFrom as i,
3272
+ __read as j,
3273
+ arrRemove as k,
3274
+ isScheduler as l,
3275
+ operate as o,
3276
+ useParams as u
3277
+ };