@hmlr/govuk-react-components-library 1.1.0 → 1.2.1

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 (204) hide show
  1. package/README.md +9 -3
  2. package/assets/uml-diagram.svg +620 -575
  3. package/bundle-analysis-main.html +1 -3
  4. package/bundle-analysis-pdfvc.html +1 -1
  5. package/dist/PDFViewerCanvas.cjs.js +2003 -16
  6. package/dist/PDFViewerCanvas.cjs.js.map +1 -1
  7. package/dist/PDFViewerCanvas.d.ts +30 -0
  8. package/dist/PDFViewerCanvas.esm.js +1974 -5
  9. package/dist/PDFViewerCanvas.esm.js.map +1 -1
  10. package/dist/index.cjs.css +18 -11
  11. package/dist/index.cjs.js +2120 -125
  12. package/dist/index.cjs.js.map +1 -1
  13. package/dist/index.d.ts +81 -4
  14. package/dist/index.esm.css +18 -11
  15. package/dist/index.esm.js +2103 -108
  16. package/dist/index.esm.js.map +1 -1
  17. package/package.json +27 -29
  18. package/scripts/generateStories.mjs +3 -3
  19. package/dist/types/PDFViewerCanvas.d.ts +0 -1
  20. package/dist/types/components/Accordion/Accordion.config.d.ts +0 -5
  21. package/dist/types/components/Accordion/Accordion.d.ts +0 -4
  22. package/dist/types/components/Accordion/Accordion.types.d.ts +0 -20
  23. package/dist/types/components/Accordion/index.d.ts +0 -2
  24. package/dist/types/components/ActionLink/ActionLink.d.ts +0 -4
  25. package/dist/types/components/ActionLink/ActionLink.types.d.ts +0 -13
  26. package/dist/types/components/ActionLink/index.d.ts +0 -1
  27. package/dist/types/components/BackLink/BackLink.d.ts +0 -4
  28. package/dist/types/components/BackLink/BackLink.types.d.ts +0 -9
  29. package/dist/types/components/BackLink/index.d.ts +0 -1
  30. package/dist/types/components/Boolean/Boolean.d.ts +0 -4
  31. package/dist/types/components/Boolean/Boolean.types.d.ts +0 -39
  32. package/dist/types/components/Boolean/OmitKey.d.ts +0 -5
  33. package/dist/types/components/Boolean/index.d.ts +0 -1
  34. package/dist/types/components/Breadcrumbs/Breadcrumbs.d.ts +0 -4
  35. package/dist/types/components/Breadcrumbs/Breadcrumbs.types.d.ts +0 -13
  36. package/dist/types/components/Breadcrumbs/index.d.ts +0 -1
  37. package/dist/types/components/Button/Button.config.d.ts +0 -2
  38. package/dist/types/components/Button/Button.d.ts +0 -4
  39. package/dist/types/components/Button/Button.types.d.ts +0 -13
  40. package/dist/types/components/Button/index.d.ts +0 -2
  41. package/dist/types/components/CardColumn/CardColumn.d.ts +0 -5
  42. package/dist/types/components/CardColumn/CardColumn.types.d.ts +0 -5
  43. package/dist/types/components/CardColumn/index.d.ts +0 -1
  44. package/dist/types/components/CardLayout/CardLayout.d.ts +0 -4
  45. package/dist/types/components/CardLayout/CardLayout.types.d.ts +0 -5
  46. package/dist/types/components/CardLayout/index.d.ts +0 -1
  47. package/dist/types/components/CharacterCount/CharacterCount.config.d.ts +0 -2
  48. package/dist/types/components/CharacterCount/CharacterCount.d.ts +0 -4
  49. package/dist/types/components/CharacterCount/CharacterCount.types.d.ts +0 -12
  50. package/dist/types/components/CharacterCount/index.d.ts +0 -1
  51. package/dist/types/components/Checkboxes/Checkboxes.config.d.ts +0 -1
  52. package/dist/types/components/Checkboxes/Checkboxes.d.ts +0 -4
  53. package/dist/types/components/Checkboxes/Checkboxes.types.d.ts +0 -3
  54. package/dist/types/components/Checkboxes/index.d.ts +0 -2
  55. package/dist/types/components/CookieBanner/CookieBanner.d.ts +0 -4
  56. package/dist/types/components/CookieBanner/CookieBanner.types.d.ts +0 -21
  57. package/dist/types/components/CookieBanner/index.d.ts +0 -1
  58. package/dist/types/components/DataNavigation/DataNavigation.d.ts +0 -4
  59. package/dist/types/components/DataNavigation/DataNavigation.types.d.ts +0 -9
  60. package/dist/types/components/DataNavigation/index.d.ts +0 -1
  61. package/dist/types/components/DateInput/DateInput.d.ts +0 -4
  62. package/dist/types/components/DateInput/DateInput.types.d.ts +0 -29
  63. package/dist/types/components/DateInput/index.d.ts +0 -1
  64. package/dist/types/components/Details/Details.d.ts +0 -4
  65. package/dist/types/components/Details/Details.types.d.ts +0 -5
  66. package/dist/types/components/Details/index.d.ts +0 -1
  67. package/dist/types/components/DifferenceNavigation/DifferenceNavigation.d.ts +0 -4
  68. package/dist/types/components/DifferenceNavigation/DifferenceNavigation.types.d.ts +0 -7
  69. package/dist/types/components/DifferenceNavigation/index.d.ts +0 -1
  70. package/dist/types/components/ErrorBoundary/ErrorBoundary.d.ts +0 -9
  71. package/dist/types/components/ErrorBoundary/ErrorBoundary.types.d.ts +0 -11
  72. package/dist/types/components/ErrorBoundary/index.d.ts +0 -1
  73. package/dist/types/components/ErrorMessage/ErrorMessage.d.ts +0 -4
  74. package/dist/types/components/ErrorMessage/ErrorMessage.types.d.ts +0 -6
  75. package/dist/types/components/ErrorMessage/index.d.ts +0 -1
  76. package/dist/types/components/ErrorSummary/ErrorSummary.config.d.ts +0 -2
  77. package/dist/types/components/ErrorSummary/ErrorSummary.d.ts +0 -4
  78. package/dist/types/components/ErrorSummary/ErrorSummary.types.d.ts +0 -13
  79. package/dist/types/components/ErrorSummary/index.d.ts +0 -2
  80. package/dist/types/components/ExitThisPage/ExitThisPage.config.d.ts +0 -1
  81. package/dist/types/components/ExitThisPage/ExitThisPage.d.ts +0 -4
  82. package/dist/types/components/ExitThisPage/ExitThisPage.types.d.ts +0 -17
  83. package/dist/types/components/ExitThisPage/index.d.ts +0 -2
  84. package/dist/types/components/Fieldset/Fieldset.d.ts +0 -4
  85. package/dist/types/components/Fieldset/Fieldset.types.d.ts +0 -12
  86. package/dist/types/components/Fieldset/index.d.ts +0 -1
  87. package/dist/types/components/FileUpload/FileUpload.d.ts +0 -4
  88. package/dist/types/components/FileUpload/FileUpload.types.d.ts +0 -15
  89. package/dist/types/components/FileUpload/index.d.ts +0 -1
  90. package/dist/types/components/Footer/Footer.d.ts +0 -4
  91. package/dist/types/components/Footer/Footer.types.d.ts +0 -33
  92. package/dist/types/components/Footer/index.d.ts +0 -1
  93. package/dist/types/components/Header/Header.config.d.ts +0 -1
  94. package/dist/types/components/Header/Header.d.ts +0 -4
  95. package/dist/types/components/Header/Header.types.d.ts +0 -28
  96. package/dist/types/components/Header/index.d.ts +0 -2
  97. package/dist/types/components/Hint/Hint.d.ts +0 -4
  98. package/dist/types/components/Hint/Hint.types.d.ts +0 -4
  99. package/dist/types/components/Hint/index.d.ts +0 -1
  100. package/dist/types/components/Input/Input.d.ts +0 -4
  101. package/dist/types/components/Input/Input.types.d.ts +0 -22
  102. package/dist/types/components/Input/index.d.ts +0 -1
  103. package/dist/types/components/InsetText/InsetText.d.ts +0 -4
  104. package/dist/types/components/InsetText/InsetText.types.d.ts +0 -4
  105. package/dist/types/components/InsetText/index.d.ts +0 -1
  106. package/dist/types/components/Label/Label.d.ts +0 -4
  107. package/dist/types/components/Label/Label.types.d.ts +0 -6
  108. package/dist/types/components/Label/index.d.ts +0 -1
  109. package/dist/types/components/Landing/Landing.d.ts +0 -4
  110. package/dist/types/components/Landing/Landing.types.d.ts +0 -4
  111. package/dist/types/components/Landing/index.d.ts +0 -1
  112. package/dist/types/components/LinkWithRef/LinkWithRef.d.ts +0 -4
  113. package/dist/types/components/LinkWithRef/LinkWithRef.types.d.ts +0 -9
  114. package/dist/types/components/LinkWithRef/index.d.ts +0 -1
  115. package/dist/types/components/Loading/Loading.d.ts +0 -5
  116. package/dist/types/components/Loading/Loading.types.d.ts +0 -4
  117. package/dist/types/components/Loading/index.d.ts +0 -1
  118. package/dist/types/components/Main/Main.d.ts +0 -4
  119. package/dist/types/components/Main/Main.types.d.ts +0 -5
  120. package/dist/types/components/Main/index.d.ts +0 -1
  121. package/dist/types/components/NotFoundPage/NotFoundPage.d.ts +0 -3
  122. package/dist/types/components/NotFoundPage/index.d.ts +0 -1
  123. package/dist/types/components/NotificationBanner/NotificationBanner.config.d.ts +0 -2
  124. package/dist/types/components/NotificationBanner/NotificationBanner.d.ts +0 -4
  125. package/dist/types/components/NotificationBanner/NotificationBanner.types.d.ts +0 -12
  126. package/dist/types/components/NotificationBanner/index.d.ts +0 -1
  127. package/dist/types/components/PDFViewer/ObjectToQueryString.d.ts +0 -1
  128. package/dist/types/components/PDFViewer/PDFViewer.d.ts +0 -4
  129. package/dist/types/components/PDFViewer/PDFViewer.types.d.ts +0 -25
  130. package/dist/types/components/PDFViewer/PDFViewerBackend.d.ts +0 -2
  131. package/dist/types/components/PDFViewer/ResolvePDFSource.d.ts +0 -27
  132. package/dist/types/components/PDFViewer/Slugify.d.ts +0 -1
  133. package/dist/types/components/PDFViewer/index.d.ts +0 -2
  134. package/dist/types/components/PDFViewer/testutilities/SampleBase64.d.ts +0 -44
  135. package/dist/types/components/PDFViewerCanvas/PDFViewerCanvas.d.ts +0 -9
  136. package/dist/types/components/PDFViewerCanvas/PDFViewerCanvas.types.d.ts +0 -8
  137. package/dist/types/components/PDFViewerCanvas/index.d.ts +0 -1
  138. package/dist/types/components/Pagination/NavigationButton.d.ts +0 -3
  139. package/dist/types/components/Pagination/Pagination.d.ts +0 -4
  140. package/dist/types/components/Pagination/Pagination.types.d.ts +0 -32
  141. package/dist/types/components/Pagination/SvgIcon.d.ts +0 -3
  142. package/dist/types/components/Pagination/UsePagination.d.ts +0 -9
  143. package/dist/types/components/Pagination/index.d.ts +0 -3
  144. package/dist/types/components/Panel/Panel.d.ts +0 -4
  145. package/dist/types/components/Panel/Panel.types.d.ts +0 -7
  146. package/dist/types/components/Panel/index.d.ts +0 -1
  147. package/dist/types/components/PasswordInput/PasswordInput.config.d.ts +0 -1
  148. package/dist/types/components/PasswordInput/PasswordInput.d.ts +0 -4
  149. package/dist/types/components/PasswordInput/PasswordInput.types.d.ts +0 -49
  150. package/dist/types/components/PasswordInput/index.d.ts +0 -2
  151. package/dist/types/components/PhaseBanner/PhaseBanner.d.ts +0 -4
  152. package/dist/types/components/PhaseBanner/PhaseBanner.types.d.ts +0 -6
  153. package/dist/types/components/PhaseBanner/index.d.ts +0 -1
  154. package/dist/types/components/ProblemWithService/ProblemWithService.d.ts +0 -4
  155. package/dist/types/components/ProblemWithService/ProblemWithService.types.d.ts +0 -7
  156. package/dist/types/components/ProblemWithService/index.d.ts +0 -1
  157. package/dist/types/components/Radios/Radios.config.d.ts +0 -1
  158. package/dist/types/components/Radios/Radios.d.ts +0 -4
  159. package/dist/types/components/Radios/Radios.types.d.ts +0 -7
  160. package/dist/types/components/Radios/index.d.ts +0 -2
  161. package/dist/types/components/Select/Select.d.ts +0 -4
  162. package/dist/types/components/Select/Select.types.d.ts +0 -21
  163. package/dist/types/components/Select/index.d.ts +0 -1
  164. package/dist/types/components/ServiceNavigation/ServiceNavigation.d.ts +0 -4
  165. package/dist/types/components/ServiceNavigation/ServiceNavigation.types.d.ts +0 -21
  166. package/dist/types/components/ServiceNavigation/index.d.ts +0 -1
  167. package/dist/types/components/SkipLink/SkipLink.config.d.ts +0 -1
  168. package/dist/types/components/SkipLink/SkipLink.d.ts +0 -4
  169. package/dist/types/components/SkipLink/SkipLink.types.d.ts +0 -5
  170. package/dist/types/components/SkipLink/index.d.ts +0 -2
  171. package/dist/types/components/SummaryList/SummaryList.d.ts +0 -4
  172. package/dist/types/components/SummaryList/SummaryList.types.d.ts +0 -22
  173. package/dist/types/components/SummaryList/index.d.ts +0 -1
  174. package/dist/types/components/Table/Table.d.ts +0 -4
  175. package/dist/types/components/Table/Table.types.d.ts +0 -21
  176. package/dist/types/components/Table/index.d.ts +0 -1
  177. package/dist/types/components/Tabs/Tabs.config.d.ts +0 -1
  178. package/dist/types/components/Tabs/Tabs.d.ts +0 -4
  179. package/dist/types/components/Tabs/Tabs.types.d.ts +0 -14
  180. package/dist/types/components/Tabs/index.d.ts +0 -2
  181. package/dist/types/components/Tag/Tag.d.ts +0 -4
  182. package/dist/types/components/Tag/Tag.types.d.ts +0 -4
  183. package/dist/types/components/Tag/index.d.ts +0 -1
  184. package/dist/types/components/TaskList/TaskList.d.ts +0 -4
  185. package/dist/types/components/TaskList/TaskList.types.d.ts +0 -21
  186. package/dist/types/components/TaskList/index.d.ts +0 -1
  187. package/dist/types/components/Textarea/Textarea.d.ts +0 -4
  188. package/dist/types/components/Textarea/Textarea.types.d.ts +0 -14
  189. package/dist/types/components/Textarea/index.d.ts +0 -1
  190. package/dist/types/components/WarningInfo/WarningInfo.d.ts +0 -4
  191. package/dist/types/components/WarningInfo/WarningInfo.types.d.ts +0 -8
  192. package/dist/types/components/WarningInfo/index.d.ts +0 -1
  193. package/dist/types/components/WarningText/WarningText.d.ts +0 -4
  194. package/dist/types/components/WarningText/WarningText.types.d.ts +0 -4
  195. package/dist/types/components/WarningText/index.d.ts +0 -1
  196. package/dist/types/components/index.d.ts +0 -51
  197. package/dist/types/dynamics/index.d.ts +0 -3
  198. package/dist/types/dynamics/types.d.ts +0 -37
  199. package/dist/types/index.d.ts +0 -1
  200. package/dist/types/utils/ProcessExampleData.d.ts +0 -3
  201. package/dist/types/utils/StoriesFromFixtures.d.ts +0 -5
  202. package/dist/types/utils/TitleCase.d.ts +0 -2
  203. package/dist/types/utils/WithReference.d.ts +0 -5
  204. package/dist/types/utils/WithReference.types.d.ts +0 -15
package/dist/index.cjs.js CHANGED
@@ -2,8 +2,7 @@
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  var govukFrontend = require('govuk-frontend');
5
- var reactRouterDom = require('react-router-dom');
6
- var React = require('react');
5
+ var React3 = require('react');
7
6
 
8
7
  function _interopNamespaceDefault(e) {
9
8
  var n = Object.create(null);
@@ -22,7 +21,7 @@ function _interopNamespaceDefault(e) {
22
21
  return Object.freeze(n);
23
22
  }
24
23
 
25
- var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
24
+ var React3__namespace = /*#__PURE__*/_interopNamespaceDefault(React3);
26
25
 
27
26
  function ConfigureOverallAccordion($scope, config) {
28
27
  if (JSON.stringify(config) === JSON.stringify({})) {
@@ -98,9 +97,1962 @@ const Accordion = ({ headingLevel: HeadingLevel = "h2", items = [], className, i
98
97
  return (jsxRuntime.jsx("div", { ...remainingAttributes, id: id, className: `govuk-accordion ${className || ""}`, "data-module": "govuk-accordion", children: items.filter(Boolean).map((item, index) => (jsxRuntime.jsxs("div", { className: `govuk-accordion__section ${item.expanded ? "govuk-accordion__section--expanded" : ""}`, children: [jsxRuntime.jsxs("div", { className: "govuk-accordion__section-header", children: [jsxRuntime.jsx(HeadingLevel, { className: "govuk-accordion__section-heading", children: jsxRuntime.jsx("span", { className: "govuk-accordion__section-button", id: `${id}-heading-${index + 1}`, children: item.heading?.children }) }), item.summary && (jsxRuntime.jsx("div", { className: "govuk-accordion__section-summary govuk-body", id: `${id}-summary-${index + 1}`, children: item.summary.children }))] }), jsxRuntime.jsx("div", { id: `${id}-content-${index + 1}`, className: "govuk-accordion__section-content", "aria-labelledby": `${id}-heading-${index + 1}`, children: item.content?.children })] }, item.reactListKey || index))) }));
99
98
  };
100
99
 
100
+ /**
101
+ * react-router v7.13.2
102
+ *
103
+ * Copyright (c) Remix Software Inc.
104
+ *
105
+ * This source code is licensed under the MIT license found in the
106
+ * LICENSE.md file in the root directory of this source tree.
107
+ *
108
+ * @license MIT
109
+ */
110
+ function invariant(value, message) {
111
+ if (value === false || value === null || typeof value === "undefined") {
112
+ throw new Error(message);
113
+ }
114
+ }
115
+ function warning(cond, message) {
116
+ if (!cond) {
117
+ if (typeof console !== "undefined") console.warn(message);
118
+ try {
119
+ throw new Error(message);
120
+ } catch (e) {
121
+ }
122
+ }
123
+ }
124
+ function createPath({
125
+ pathname = "/",
126
+ search = "",
127
+ hash = ""
128
+ }) {
129
+ if (search && search !== "?")
130
+ pathname += search.charAt(0) === "?" ? search : "?" + search;
131
+ if (hash && hash !== "#")
132
+ pathname += hash.charAt(0) === "#" ? hash : "#" + hash;
133
+ return pathname;
134
+ }
135
+ function parsePath(path) {
136
+ let parsedPath = {};
137
+ if (path) {
138
+ let hashIndex = path.indexOf("#");
139
+ if (hashIndex >= 0) {
140
+ parsedPath.hash = path.substring(hashIndex);
141
+ path = path.substring(0, hashIndex);
142
+ }
143
+ let searchIndex = path.indexOf("?");
144
+ if (searchIndex >= 0) {
145
+ parsedPath.search = path.substring(searchIndex);
146
+ path = path.substring(0, searchIndex);
147
+ }
148
+ if (path) {
149
+ parsedPath.pathname = path;
150
+ }
151
+ }
152
+ return parsedPath;
153
+ }
154
+ function matchRoutes(routes, locationArg, basename = "/") {
155
+ return matchRoutesImpl(routes, locationArg, basename, false);
156
+ }
157
+ function matchRoutesImpl(routes, locationArg, basename, allowPartial) {
158
+ let location = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
159
+ let pathname = stripBasename(location.pathname || "/", basename);
160
+ if (pathname == null) {
161
+ return null;
162
+ }
163
+ let branches = flattenRoutes(routes);
164
+ rankRouteBranches(branches);
165
+ let matches = null;
166
+ for (let i = 0; matches == null && i < branches.length; ++i) {
167
+ let decoded = decodePath(pathname);
168
+ matches = matchRouteBranch(
169
+ branches[i],
170
+ decoded,
171
+ allowPartial
172
+ );
173
+ }
174
+ return matches;
175
+ }
176
+ function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "", _hasParentOptionalSegments = false) {
177
+ let flattenRoute = (route, index, hasParentOptionalSegments = _hasParentOptionalSegments, relativePath) => {
178
+ let meta = {
179
+ relativePath: relativePath === void 0 ? route.path || "" : relativePath,
180
+ caseSensitive: route.caseSensitive === true,
181
+ childrenIndex: index,
182
+ route
183
+ };
184
+ if (meta.relativePath.startsWith("/")) {
185
+ if (!meta.relativePath.startsWith(parentPath) && hasParentOptionalSegments) {
186
+ return;
187
+ }
188
+ invariant(
189
+ meta.relativePath.startsWith(parentPath),
190
+ `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.`
191
+ );
192
+ meta.relativePath = meta.relativePath.slice(parentPath.length);
193
+ }
194
+ let path = joinPaths([parentPath, meta.relativePath]);
195
+ let routesMeta = parentsMeta.concat(meta);
196
+ if (route.children && route.children.length > 0) {
197
+ invariant(
198
+ // Our types know better, but runtime JS may not!
199
+ // @ts-expect-error
200
+ route.index !== true,
201
+ `Index routes must not have child routes. Please remove all child routes from route path "${path}".`
202
+ );
203
+ flattenRoutes(
204
+ route.children,
205
+ branches,
206
+ routesMeta,
207
+ path,
208
+ hasParentOptionalSegments
209
+ );
210
+ }
211
+ if (route.path == null && !route.index) {
212
+ return;
213
+ }
214
+ branches.push({
215
+ path,
216
+ score: computeScore(path, route.index),
217
+ routesMeta
218
+ });
219
+ };
220
+ routes.forEach((route, index) => {
221
+ if (route.path === "" || !route.path?.includes("?")) {
222
+ flattenRoute(route, index);
223
+ } else {
224
+ for (let exploded of explodeOptionalSegments(route.path)) {
225
+ flattenRoute(route, index, true, exploded);
226
+ }
227
+ }
228
+ });
229
+ return branches;
230
+ }
231
+ function explodeOptionalSegments(path) {
232
+ let segments = path.split("/");
233
+ if (segments.length === 0) return [];
234
+ let [first, ...rest] = segments;
235
+ let isOptional = first.endsWith("?");
236
+ let required = first.replace(/\?$/, "");
237
+ if (rest.length === 0) {
238
+ return isOptional ? [required, ""] : [required];
239
+ }
240
+ let restExploded = explodeOptionalSegments(rest.join("/"));
241
+ let result = [];
242
+ result.push(
243
+ ...restExploded.map(
244
+ (subpath) => subpath === "" ? required : [required, subpath].join("/")
245
+ )
246
+ );
247
+ if (isOptional) {
248
+ result.push(...restExploded);
249
+ }
250
+ return result.map(
251
+ (exploded) => path.startsWith("/") && exploded === "" ? "/" : exploded
252
+ );
253
+ }
254
+ function rankRouteBranches(branches) {
255
+ branches.sort(
256
+ (a, b) => a.score !== b.score ? b.score - a.score : compareIndexes(
257
+ a.routesMeta.map((meta) => meta.childrenIndex),
258
+ b.routesMeta.map((meta) => meta.childrenIndex)
259
+ )
260
+ );
261
+ }
262
+ var paramRe = /^:[\w-]+$/;
263
+ var dynamicSegmentValue = 3;
264
+ var indexRouteValue = 2;
265
+ var emptySegmentValue = 1;
266
+ var staticSegmentValue = 10;
267
+ var splatPenalty = -2;
268
+ var isSplat = (s) => s === "*";
269
+ function computeScore(path, index) {
270
+ let segments = path.split("/");
271
+ let initialScore = segments.length;
272
+ if (segments.some(isSplat)) {
273
+ initialScore += splatPenalty;
274
+ }
275
+ if (index) {
276
+ initialScore += indexRouteValue;
277
+ }
278
+ return segments.filter((s) => !isSplat(s)).reduce(
279
+ (score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === "" ? emptySegmentValue : staticSegmentValue),
280
+ initialScore
281
+ );
282
+ }
283
+ function compareIndexes(a, b) {
284
+ let siblings = a.length === b.length && a.slice(0, -1).every((n, i) => n === b[i]);
285
+ return siblings ? (
286
+ // If two routes are siblings, we should try to match the earlier sibling
287
+ // first. This allows people to have fine-grained control over the matching
288
+ // behavior by simply putting routes with identical paths in the order they
289
+ // want them tried.
290
+ a[a.length - 1] - b[b.length - 1]
291
+ ) : (
292
+ // Otherwise, it doesn't really make sense to rank non-siblings by index,
293
+ // so they sort equally.
294
+ 0
295
+ );
296
+ }
297
+ function matchRouteBranch(branch, pathname, allowPartial = false) {
298
+ let { routesMeta } = branch;
299
+ let matchedParams = {};
300
+ let matchedPathname = "/";
301
+ let matches = [];
302
+ for (let i = 0; i < routesMeta.length; ++i) {
303
+ let meta = routesMeta[i];
304
+ let end = i === routesMeta.length - 1;
305
+ let remainingPathname = matchedPathname === "/" ? pathname : pathname.slice(matchedPathname.length) || "/";
306
+ let match = matchPath(
307
+ { path: meta.relativePath, caseSensitive: meta.caseSensitive, end },
308
+ remainingPathname
309
+ );
310
+ let route = meta.route;
311
+ if (!match && end && allowPartial && !routesMeta[routesMeta.length - 1].route.index) {
312
+ match = matchPath(
313
+ {
314
+ path: meta.relativePath,
315
+ caseSensitive: meta.caseSensitive,
316
+ end: false
317
+ },
318
+ remainingPathname
319
+ );
320
+ }
321
+ if (!match) {
322
+ return null;
323
+ }
324
+ Object.assign(matchedParams, match.params);
325
+ matches.push({
326
+ // TODO: Can this as be avoided?
327
+ params: matchedParams,
328
+ pathname: joinPaths([matchedPathname, match.pathname]),
329
+ pathnameBase: normalizePathname(
330
+ joinPaths([matchedPathname, match.pathnameBase])
331
+ ),
332
+ route
333
+ });
334
+ if (match.pathnameBase !== "/") {
335
+ matchedPathname = joinPaths([matchedPathname, match.pathnameBase]);
336
+ }
337
+ }
338
+ return matches;
339
+ }
340
+ function matchPath(pattern, pathname) {
341
+ if (typeof pattern === "string") {
342
+ pattern = { path: pattern, caseSensitive: false, end: true };
343
+ }
344
+ let [matcher, compiledParams] = compilePath(
345
+ pattern.path,
346
+ pattern.caseSensitive,
347
+ pattern.end
348
+ );
349
+ let match = pathname.match(matcher);
350
+ if (!match) return null;
351
+ let matchedPathname = match[0];
352
+ let pathnameBase = matchedPathname.replace(/(.)\/+$/, "$1");
353
+ let captureGroups = match.slice(1);
354
+ let params = compiledParams.reduce(
355
+ (memo2, { paramName, isOptional }, index) => {
356
+ if (paramName === "*") {
357
+ let splatValue = captureGroups[index] || "";
358
+ pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\/+$/, "$1");
359
+ }
360
+ const value = captureGroups[index];
361
+ if (isOptional && !value) {
362
+ memo2[paramName] = void 0;
363
+ } else {
364
+ memo2[paramName] = (value || "").replace(/%2F/g, "/");
365
+ }
366
+ return memo2;
367
+ },
368
+ {}
369
+ );
370
+ return {
371
+ params,
372
+ pathname: matchedPathname,
373
+ pathnameBase,
374
+ pattern
375
+ };
376
+ }
377
+ function compilePath(path, caseSensitive = false, end = true) {
378
+ warning(
379
+ path === "*" || !path.endsWith("*") || path.endsWith("/*"),
380
+ `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(/\*$/, "/*")}".`
381
+ );
382
+ let params = [];
383
+ let regexpSource = "^" + path.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(
384
+ /\/:([\w-]+)(\?)?/g,
385
+ (match, paramName, isOptional, index, str) => {
386
+ params.push({ paramName, isOptional: isOptional != null });
387
+ if (isOptional) {
388
+ let nextChar = str.charAt(index + match.length);
389
+ if (nextChar && nextChar !== "/") {
390
+ return "/([^\\/]*)";
391
+ }
392
+ return "(?:/([^\\/]*))?";
393
+ }
394
+ return "/([^\\/]+)";
395
+ }
396
+ ).replace(/\/([\w-]+)\?(\/|$)/g, "(/$1)?$2");
397
+ if (path.endsWith("*")) {
398
+ params.push({ paramName: "*" });
399
+ regexpSource += path === "*" || path === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$";
400
+ } else if (end) {
401
+ regexpSource += "\\/*$";
402
+ } else if (path !== "" && path !== "/") {
403
+ regexpSource += "(?:(?=\\/|$))";
404
+ } else ;
405
+ let matcher = new RegExp(regexpSource, caseSensitive ? void 0 : "i");
406
+ return [matcher, params];
407
+ }
408
+ function decodePath(value) {
409
+ try {
410
+ return value.split("/").map((v) => decodeURIComponent(v).replace(/\//g, "%2F")).join("/");
411
+ } catch (error) {
412
+ warning(
413
+ false,
414
+ `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}).`
415
+ );
416
+ return value;
417
+ }
418
+ }
419
+ function stripBasename(pathname, basename) {
420
+ if (basename === "/") return pathname;
421
+ if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {
422
+ return null;
423
+ }
424
+ let startIndex = basename.endsWith("/") ? basename.length - 1 : basename.length;
425
+ let nextChar = pathname.charAt(startIndex);
426
+ if (nextChar && nextChar !== "/") {
427
+ return null;
428
+ }
429
+ return pathname.slice(startIndex) || "/";
430
+ }
431
+ var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
432
+ function resolvePath(to, fromPathname = "/") {
433
+ let {
434
+ pathname: toPathname,
435
+ search = "",
436
+ hash = ""
437
+ } = typeof to === "string" ? parsePath(to) : to;
438
+ let pathname;
439
+ if (toPathname) {
440
+ toPathname = toPathname.replace(/\/\/+/g, "/");
441
+ if (toPathname.startsWith("/")) {
442
+ pathname = resolvePathname(toPathname.substring(1), "/");
443
+ } else {
444
+ pathname = resolvePathname(toPathname, fromPathname);
445
+ }
446
+ } else {
447
+ pathname = fromPathname;
448
+ }
449
+ return {
450
+ pathname,
451
+ search: normalizeSearch(search),
452
+ hash: normalizeHash(hash)
453
+ };
454
+ }
455
+ function resolvePathname(relativePath, fromPathname) {
456
+ let segments = fromPathname.replace(/\/+$/, "").split("/");
457
+ let relativeSegments = relativePath.split("/");
458
+ relativeSegments.forEach((segment) => {
459
+ if (segment === "..") {
460
+ if (segments.length > 1) segments.pop();
461
+ } else if (segment !== ".") {
462
+ segments.push(segment);
463
+ }
464
+ });
465
+ return segments.length > 1 ? segments.join("/") : "/";
466
+ }
467
+ function getInvalidPathError(char, field, dest, path) {
468
+ return `Cannot include a '${char}' character in a manually specified \`to.${field}\` field [${JSON.stringify(
469
+ path
470
+ )}]. 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.`;
471
+ }
472
+ function getPathContributingMatches(matches) {
473
+ return matches.filter(
474
+ (match, index) => index === 0 || match.route.path && match.route.path.length > 0
475
+ );
476
+ }
477
+ function getResolveToMatches(matches) {
478
+ let pathMatches = getPathContributingMatches(matches);
479
+ return pathMatches.map(
480
+ (match, idx) => idx === pathMatches.length - 1 ? match.pathname : match.pathnameBase
481
+ );
482
+ }
483
+ function resolveTo(toArg, routePathnames, locationPathname, isPathRelative = false) {
484
+ let to;
485
+ if (typeof toArg === "string") {
486
+ to = parsePath(toArg);
487
+ } else {
488
+ to = { ...toArg };
489
+ invariant(
490
+ !to.pathname || !to.pathname.includes("?"),
491
+ getInvalidPathError("?", "pathname", "search", to)
492
+ );
493
+ invariant(
494
+ !to.pathname || !to.pathname.includes("#"),
495
+ getInvalidPathError("#", "pathname", "hash", to)
496
+ );
497
+ invariant(
498
+ !to.search || !to.search.includes("#"),
499
+ getInvalidPathError("#", "search", "hash", to)
500
+ );
501
+ }
502
+ let isEmptyPath = toArg === "" || to.pathname === "";
503
+ let toPathname = isEmptyPath ? "/" : to.pathname;
504
+ let from;
505
+ if (toPathname == null) {
506
+ from = locationPathname;
507
+ } else {
508
+ let routePathnameIndex = routePathnames.length - 1;
509
+ if (!isPathRelative && toPathname.startsWith("..")) {
510
+ let toSegments = toPathname.split("/");
511
+ while (toSegments[0] === "..") {
512
+ toSegments.shift();
513
+ routePathnameIndex -= 1;
514
+ }
515
+ to.pathname = toSegments.join("/");
516
+ }
517
+ from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : "/";
518
+ }
519
+ let path = resolvePath(to, from);
520
+ let hasExplicitTrailingSlash = toPathname && toPathname !== "/" && toPathname.endsWith("/");
521
+ let hasCurrentTrailingSlash = (isEmptyPath || toPathname === ".") && locationPathname.endsWith("/");
522
+ if (!path.pathname.endsWith("/") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) {
523
+ path.pathname += "/";
524
+ }
525
+ return path;
526
+ }
527
+ var joinPaths = (paths) => paths.join("/").replace(/\/\/+/g, "/");
528
+ var normalizePathname = (pathname) => pathname.replace(/\/+$/, "").replace(/^\/*/, "/");
529
+ var normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search;
530
+ var normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
531
+ var ErrorResponseImpl = class {
532
+ constructor(status, statusText, data2, internal = false) {
533
+ this.status = status;
534
+ this.statusText = statusText || "";
535
+ this.internal = internal;
536
+ if (data2 instanceof Error) {
537
+ this.data = data2.toString();
538
+ this.error = data2;
539
+ } else {
540
+ this.data = data2;
541
+ }
542
+ }
543
+ };
544
+ function isRouteErrorResponse(error) {
545
+ return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error;
546
+ }
547
+ function getRoutePattern(matches) {
548
+ return matches.map((m) => m.route.path).filter(Boolean).join("/").replace(/\/\/*/g, "/") || "/";
549
+ }
550
+ var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
551
+ function parseToInfo(_to, basename) {
552
+ let to = _to;
553
+ if (typeof to !== "string" || !ABSOLUTE_URL_REGEX.test(to)) {
554
+ return {
555
+ absoluteURL: void 0,
556
+ isExternal: false,
557
+ to
558
+ };
559
+ }
560
+ let absoluteURL = to;
561
+ let isExternal = false;
562
+ if (isBrowser) {
563
+ try {
564
+ let currentUrl = new URL(window.location.href);
565
+ let targetUrl = to.startsWith("//") ? new URL(currentUrl.protocol + to) : new URL(to);
566
+ let path = stripBasename(targetUrl.pathname, basename);
567
+ if (targetUrl.origin === currentUrl.origin && path != null) {
568
+ to = path + targetUrl.search + targetUrl.hash;
569
+ } else {
570
+ isExternal = true;
571
+ }
572
+ } catch (e) {
573
+ warning(
574
+ false,
575
+ `<Link to="${to}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`
576
+ );
577
+ }
578
+ }
579
+ return {
580
+ absoluteURL,
581
+ isExternal,
582
+ to
583
+ };
584
+ }
585
+ Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
586
+
587
+ // lib/router/router.ts
588
+ var validMutationMethodsArr = [
589
+ "POST",
590
+ "PUT",
591
+ "PATCH",
592
+ "DELETE"
593
+ ];
594
+ new Set(
595
+ validMutationMethodsArr
596
+ );
597
+ var validRequestMethodsArr = [
598
+ "GET",
599
+ ...validMutationMethodsArr
600
+ ];
601
+ new Set(validRequestMethodsArr);
602
+ var DataRouterContext = React3__namespace.createContext(null);
603
+ DataRouterContext.displayName = "DataRouter";
604
+ var DataRouterStateContext = React3__namespace.createContext(null);
605
+ DataRouterStateContext.displayName = "DataRouterState";
606
+ var RSCRouterContext = React3__namespace.createContext(false);
607
+ var ViewTransitionContext = React3__namespace.createContext({
608
+ isTransitioning: false
609
+ });
610
+ ViewTransitionContext.displayName = "ViewTransition";
611
+ var FetchersContext = React3__namespace.createContext(
612
+ /* @__PURE__ */ new Map()
613
+ );
614
+ FetchersContext.displayName = "Fetchers";
615
+ var AwaitContext = React3__namespace.createContext(null);
616
+ AwaitContext.displayName = "Await";
617
+ var NavigationContext = React3__namespace.createContext(
618
+ null
619
+ );
620
+ NavigationContext.displayName = "Navigation";
621
+ var LocationContext = React3__namespace.createContext(
622
+ null
623
+ );
624
+ LocationContext.displayName = "Location";
625
+ var RouteContext = React3__namespace.createContext({
626
+ outlet: null,
627
+ matches: [],
628
+ isDataRoute: false
629
+ });
630
+ RouteContext.displayName = "Route";
631
+ var RouteErrorContext = React3__namespace.createContext(null);
632
+ RouteErrorContext.displayName = "RouteError";
633
+
634
+ // lib/errors.ts
635
+ var ERROR_DIGEST_BASE = "REACT_ROUTER_ERROR";
636
+ var ERROR_DIGEST_REDIRECT = "REDIRECT";
637
+ var ERROR_DIGEST_ROUTE_ERROR_RESPONSE = "ROUTE_ERROR_RESPONSE";
638
+ function decodeRedirectErrorDigest(digest) {
639
+ if (digest.startsWith(`${ERROR_DIGEST_BASE}:${ERROR_DIGEST_REDIRECT}:{`)) {
640
+ try {
641
+ let parsed = JSON.parse(digest.slice(28));
642
+ 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") {
643
+ return parsed;
644
+ }
645
+ } catch {
646
+ }
647
+ }
648
+ }
649
+ function decodeRouteErrorResponseDigest(digest) {
650
+ if (digest.startsWith(
651
+ `${ERROR_DIGEST_BASE}:${ERROR_DIGEST_ROUTE_ERROR_RESPONSE}:{`
652
+ )) {
653
+ try {
654
+ let parsed = JSON.parse(digest.slice(40));
655
+ if (typeof parsed === "object" && parsed && typeof parsed.status === "number" && typeof parsed.statusText === "string") {
656
+ return new ErrorResponseImpl(
657
+ parsed.status,
658
+ parsed.statusText,
659
+ parsed.data
660
+ );
661
+ }
662
+ } catch {
663
+ }
664
+ }
665
+ }
666
+
667
+ // lib/hooks.tsx
668
+ function useHref(to, { relative } = {}) {
669
+ invariant(
670
+ useInRouterContext(),
671
+ // TODO: This error is probably because they somehow have 2 versions of the
672
+ // router loaded. We can help them understand how to avoid that.
673
+ `useHref() may be used only in the context of a <Router> component.`
674
+ );
675
+ let { basename, navigator } = React3__namespace.useContext(NavigationContext);
676
+ let { hash, pathname, search } = useResolvedPath(to, { relative });
677
+ let joinedPathname = pathname;
678
+ if (basename !== "/") {
679
+ joinedPathname = pathname === "/" ? basename : joinPaths([basename, pathname]);
680
+ }
681
+ return navigator.createHref({ pathname: joinedPathname, search, hash });
682
+ }
683
+ function useInRouterContext() {
684
+ return React3__namespace.useContext(LocationContext) != null;
685
+ }
686
+ function useLocation() {
687
+ invariant(
688
+ useInRouterContext(),
689
+ // TODO: This error is probably because they somehow have 2 versions of the
690
+ // router loaded. We can help them understand how to avoid that.
691
+ `useLocation() may be used only in the context of a <Router> component.`
692
+ );
693
+ return React3__namespace.useContext(LocationContext).location;
694
+ }
695
+ var navigateEffectWarning = `You should call navigate() in a React.useEffect(), not when your component is first rendered.`;
696
+ function useIsomorphicLayoutEffect(cb) {
697
+ let isStatic = React3__namespace.useContext(NavigationContext).static;
698
+ if (!isStatic) {
699
+ React3__namespace.useLayoutEffect(cb);
700
+ }
701
+ }
702
+ function useNavigate() {
703
+ let { isDataRoute } = React3__namespace.useContext(RouteContext);
704
+ return isDataRoute ? useNavigateStable() : useNavigateUnstable();
705
+ }
706
+ function useNavigateUnstable() {
707
+ invariant(
708
+ useInRouterContext(),
709
+ // TODO: This error is probably because they somehow have 2 versions of the
710
+ // router loaded. We can help them understand how to avoid that.
711
+ `useNavigate() may be used only in the context of a <Router> component.`
712
+ );
713
+ let dataRouterContext = React3__namespace.useContext(DataRouterContext);
714
+ let { basename, navigator } = React3__namespace.useContext(NavigationContext);
715
+ let { matches } = React3__namespace.useContext(RouteContext);
716
+ let { pathname: locationPathname } = useLocation();
717
+ let routePathnamesJson = JSON.stringify(getResolveToMatches(matches));
718
+ let activeRef = React3__namespace.useRef(false);
719
+ useIsomorphicLayoutEffect(() => {
720
+ activeRef.current = true;
721
+ });
722
+ let navigate = React3__namespace.useCallback(
723
+ (to, options = {}) => {
724
+ warning(activeRef.current, navigateEffectWarning);
725
+ if (!activeRef.current) return;
726
+ if (typeof to === "number") {
727
+ navigator.go(to);
728
+ return;
729
+ }
730
+ let path = resolveTo(
731
+ to,
732
+ JSON.parse(routePathnamesJson),
733
+ locationPathname,
734
+ options.relative === "path"
735
+ );
736
+ if (dataRouterContext == null && basename !== "/") {
737
+ path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
738
+ }
739
+ (!!options.replace ? navigator.replace : navigator.push)(
740
+ path,
741
+ options.state,
742
+ options
743
+ );
744
+ },
745
+ [
746
+ basename,
747
+ navigator,
748
+ routePathnamesJson,
749
+ locationPathname,
750
+ dataRouterContext
751
+ ]
752
+ );
753
+ return navigate;
754
+ }
755
+ React3__namespace.createContext(null);
756
+ function useResolvedPath(to, { relative } = {}) {
757
+ let { matches } = React3__namespace.useContext(RouteContext);
758
+ let { pathname: locationPathname } = useLocation();
759
+ let routePathnamesJson = JSON.stringify(getResolveToMatches(matches));
760
+ return React3__namespace.useMemo(
761
+ () => resolveTo(
762
+ to,
763
+ JSON.parse(routePathnamesJson),
764
+ locationPathname,
765
+ relative === "path"
766
+ ),
767
+ [to, routePathnamesJson, locationPathname, relative]
768
+ );
769
+ }
770
+ function useRoutesImpl(routes, locationArg, dataRouterOpts) {
771
+ invariant(
772
+ useInRouterContext(),
773
+ // TODO: This error is probably because they somehow have 2 versions of the
774
+ // router loaded. We can help them understand how to avoid that.
775
+ `useRoutes() may be used only in the context of a <Router> component.`
776
+ );
777
+ let { navigator } = React3__namespace.useContext(NavigationContext);
778
+ let { matches: parentMatches } = React3__namespace.useContext(RouteContext);
779
+ let routeMatch = parentMatches[parentMatches.length - 1];
780
+ let parentParams = routeMatch ? routeMatch.params : {};
781
+ let parentPathname = routeMatch ? routeMatch.pathname : "/";
782
+ let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : "/";
783
+ let parentRoute = routeMatch && routeMatch.route;
784
+ {
785
+ let parentPath = parentRoute && parentRoute.path || "";
786
+ warningOnce(
787
+ parentPathname,
788
+ !parentRoute || parentPath.endsWith("*") || parentPath.endsWith("*?"),
789
+ `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.
790
+
791
+ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPath === "/" ? "*" : `${parentPath}/*`}">.`
792
+ );
793
+ }
794
+ let locationFromContext = useLocation();
795
+ let location;
796
+ {
797
+ location = locationFromContext;
798
+ }
799
+ let pathname = location.pathname || "/";
800
+ let remainingPathname = pathname;
801
+ if (parentPathnameBase !== "/") {
802
+ let parentSegments = parentPathnameBase.replace(/^\//, "").split("/");
803
+ let segments = pathname.replace(/^\//, "").split("/");
804
+ remainingPathname = "/" + segments.slice(parentSegments.length).join("/");
805
+ }
806
+ let matches = matchRoutes(routes, { pathname: remainingPathname });
807
+ {
808
+ warning(
809
+ parentRoute || matches != null,
810
+ `No routes matched location "${location.pathname}${location.search}${location.hash}" `
811
+ );
812
+ warning(
813
+ 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,
814
+ `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.`
815
+ );
816
+ }
817
+ let renderedMatches = _renderMatches(
818
+ matches && matches.map(
819
+ (match) => Object.assign({}, match, {
820
+ params: Object.assign({}, parentParams, match.params),
821
+ pathname: joinPaths([
822
+ parentPathnameBase,
823
+ // Re-encode pathnames that were decoded inside matchRoutes.
824
+ // Pre-encode `%`, `?` and `#` ahead of `encodeLocation` because it uses
825
+ // `new URL()` internally and we need to prevent it from treating
826
+ // them as separators
827
+ navigator.encodeLocation ? navigator.encodeLocation(
828
+ match.pathname.replace(/%/g, "%25").replace(/\?/g, "%3F").replace(/#/g, "%23")
829
+ ).pathname : match.pathname
830
+ ]),
831
+ pathnameBase: match.pathnameBase === "/" ? parentPathnameBase : joinPaths([
832
+ parentPathnameBase,
833
+ // Re-encode pathnames that were decoded inside matchRoutes
834
+ // Pre-encode `%`, `?` and `#` ahead of `encodeLocation` because it uses
835
+ // `new URL()` internally and we need to prevent it from treating
836
+ // them as separators
837
+ navigator.encodeLocation ? navigator.encodeLocation(
838
+ match.pathnameBase.replace(/%/g, "%25").replace(/\?/g, "%3F").replace(/#/g, "%23")
839
+ ).pathname : match.pathnameBase
840
+ ])
841
+ })
842
+ ),
843
+ parentMatches,
844
+ dataRouterOpts
845
+ );
846
+ return renderedMatches;
847
+ }
848
+ function DefaultErrorComponent() {
849
+ let error = useRouteError();
850
+ let message = isRouteErrorResponse(error) ? `${error.status} ${error.statusText}` : error instanceof Error ? error.message : JSON.stringify(error);
851
+ let stack = error instanceof Error ? error.stack : null;
852
+ let lightgrey = "rgba(200,200,200, 0.5)";
853
+ let preStyles = { padding: "0.5rem", backgroundColor: lightgrey };
854
+ let codeStyles = { padding: "2px 4px", backgroundColor: lightgrey };
855
+ let devInfo = null;
856
+ {
857
+ console.error(
858
+ "Error handled by React Router default ErrorBoundary:",
859
+ error
860
+ );
861
+ devInfo = /* @__PURE__ */ React3__namespace.createElement(React3__namespace.Fragment, null, /* @__PURE__ */ React3__namespace.createElement("p", null, "\u{1F4BF} Hey developer \u{1F44B}"), /* @__PURE__ */ React3__namespace.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own ", /* @__PURE__ */ React3__namespace.createElement("code", { style: codeStyles }, "ErrorBoundary"), " or", " ", /* @__PURE__ */ React3__namespace.createElement("code", { style: codeStyles }, "errorElement"), " prop on your route."));
862
+ }
863
+ return /* @__PURE__ */ React3__namespace.createElement(React3__namespace.Fragment, null, /* @__PURE__ */ React3__namespace.createElement("h2", null, "Unexpected Application Error!"), /* @__PURE__ */ React3__namespace.createElement("h3", { style: { fontStyle: "italic" } }, message), stack ? /* @__PURE__ */ React3__namespace.createElement("pre", { style: preStyles }, stack) : null, devInfo);
864
+ }
865
+ var defaultErrorElement = /* @__PURE__ */ React3__namespace.createElement(DefaultErrorComponent, null);
866
+ var RenderErrorBoundary = class extends React3__namespace.Component {
867
+ constructor(props) {
868
+ super(props);
869
+ this.state = {
870
+ location: props.location,
871
+ revalidation: props.revalidation,
872
+ error: props.error
873
+ };
874
+ }
875
+ static getDerivedStateFromError(error) {
876
+ return { error };
877
+ }
878
+ static getDerivedStateFromProps(props, state) {
879
+ if (state.location !== props.location || state.revalidation !== "idle" && props.revalidation === "idle") {
880
+ return {
881
+ error: props.error,
882
+ location: props.location,
883
+ revalidation: props.revalidation
884
+ };
885
+ }
886
+ return {
887
+ error: props.error !== void 0 ? props.error : state.error,
888
+ location: state.location,
889
+ revalidation: props.revalidation || state.revalidation
890
+ };
891
+ }
892
+ componentDidCatch(error, errorInfo) {
893
+ if (this.props.onError) {
894
+ this.props.onError(error, errorInfo);
895
+ } else {
896
+ console.error(
897
+ "React Router caught the following error during render",
898
+ error
899
+ );
900
+ }
901
+ }
902
+ render() {
903
+ let error = this.state.error;
904
+ if (this.context && typeof error === "object" && error && "digest" in error && typeof error.digest === "string") {
905
+ const decoded = decodeRouteErrorResponseDigest(error.digest);
906
+ if (decoded) error = decoded;
907
+ }
908
+ let result = error !== void 0 ? /* @__PURE__ */ React3__namespace.createElement(RouteContext.Provider, { value: this.props.routeContext }, /* @__PURE__ */ React3__namespace.createElement(
909
+ RouteErrorContext.Provider,
910
+ {
911
+ value: error,
912
+ children: this.props.component
913
+ }
914
+ )) : this.props.children;
915
+ if (this.context) {
916
+ return /* @__PURE__ */ React3__namespace.createElement(RSCErrorHandler, { error }, result);
917
+ }
918
+ return result;
919
+ }
920
+ };
921
+ RenderErrorBoundary.contextType = RSCRouterContext;
922
+ var errorRedirectHandledMap = /* @__PURE__ */ new WeakMap();
923
+ function RSCErrorHandler({
924
+ children,
925
+ error
926
+ }) {
927
+ let { basename } = React3__namespace.useContext(NavigationContext);
928
+ if (typeof error === "object" && error && "digest" in error && typeof error.digest === "string") {
929
+ let redirect2 = decodeRedirectErrorDigest(error.digest);
930
+ if (redirect2) {
931
+ let existingRedirect = errorRedirectHandledMap.get(error);
932
+ if (existingRedirect) throw existingRedirect;
933
+ let parsed = parseToInfo(redirect2.location, basename);
934
+ if (isBrowser && !errorRedirectHandledMap.get(error)) {
935
+ if (parsed.isExternal || redirect2.reloadDocument) {
936
+ window.location.href = parsed.absoluteURL || parsed.to;
937
+ } else {
938
+ const redirectPromise = Promise.resolve().then(
939
+ () => window.__reactRouterDataRouter.navigate(parsed.to, {
940
+ replace: redirect2.replace
941
+ })
942
+ );
943
+ errorRedirectHandledMap.set(error, redirectPromise);
944
+ throw redirectPromise;
945
+ }
946
+ }
947
+ return /* @__PURE__ */ React3__namespace.createElement(
948
+ "meta",
949
+ {
950
+ httpEquiv: "refresh",
951
+ content: `0;url=${parsed.absoluteURL || parsed.to}`
952
+ }
953
+ );
954
+ }
955
+ }
956
+ return children;
957
+ }
958
+ function RenderedRoute({ routeContext, match, children }) {
959
+ let dataRouterContext = React3__namespace.useContext(DataRouterContext);
960
+ if (dataRouterContext && dataRouterContext.static && dataRouterContext.staticContext && (match.route.errorElement || match.route.ErrorBoundary)) {
961
+ dataRouterContext.staticContext._deepestRenderedBoundaryId = match.route.id;
962
+ }
963
+ return /* @__PURE__ */ React3__namespace.createElement(RouteContext.Provider, { value: routeContext }, children);
964
+ }
965
+ function _renderMatches(matches, parentMatches = [], dataRouterOpts) {
966
+ let dataRouterState = dataRouterOpts?.state;
967
+ if (matches == null) {
968
+ if (!dataRouterState) {
969
+ return null;
970
+ }
971
+ if (dataRouterState.errors) {
972
+ matches = dataRouterState.matches;
973
+ } else if (parentMatches.length === 0 && !dataRouterState.initialized && dataRouterState.matches.length > 0) {
974
+ matches = dataRouterState.matches;
975
+ } else {
976
+ return null;
977
+ }
978
+ }
979
+ let renderedMatches = matches;
980
+ let errors = dataRouterState?.errors;
981
+ if (errors != null) {
982
+ let errorIndex = renderedMatches.findIndex(
983
+ (m) => m.route.id && errors?.[m.route.id] !== void 0
984
+ );
985
+ invariant(
986
+ errorIndex >= 0,
987
+ `Could not find a matching route for errors on route IDs: ${Object.keys(
988
+ errors
989
+ ).join(",")}`
990
+ );
991
+ renderedMatches = renderedMatches.slice(
992
+ 0,
993
+ Math.min(renderedMatches.length, errorIndex + 1)
994
+ );
995
+ }
996
+ let renderFallback = false;
997
+ let fallbackIndex = -1;
998
+ if (dataRouterOpts && dataRouterState) {
999
+ renderFallback = dataRouterState.renderFallback;
1000
+ for (let i = 0; i < renderedMatches.length; i++) {
1001
+ let match = renderedMatches[i];
1002
+ if (match.route.HydrateFallback || match.route.hydrateFallbackElement) {
1003
+ fallbackIndex = i;
1004
+ }
1005
+ if (match.route.id) {
1006
+ let { loaderData, errors: errors2 } = dataRouterState;
1007
+ let needsToRunLoader = match.route.loader && !loaderData.hasOwnProperty(match.route.id) && (!errors2 || errors2[match.route.id] === void 0);
1008
+ if (match.route.lazy || needsToRunLoader) {
1009
+ if (dataRouterOpts.isStatic) {
1010
+ renderFallback = true;
1011
+ }
1012
+ if (fallbackIndex >= 0) {
1013
+ renderedMatches = renderedMatches.slice(0, fallbackIndex + 1);
1014
+ } else {
1015
+ renderedMatches = [renderedMatches[0]];
1016
+ }
1017
+ break;
1018
+ }
1019
+ }
1020
+ }
1021
+ }
1022
+ let onErrorHandler = dataRouterOpts?.onError;
1023
+ let onError = dataRouterState && onErrorHandler ? (error, errorInfo) => {
1024
+ onErrorHandler(error, {
1025
+ location: dataRouterState.location,
1026
+ params: dataRouterState.matches?.[0]?.params ?? {},
1027
+ unstable_pattern: getRoutePattern(dataRouterState.matches),
1028
+ errorInfo
1029
+ });
1030
+ } : void 0;
1031
+ return renderedMatches.reduceRight(
1032
+ (outlet, match, index) => {
1033
+ let error;
1034
+ let shouldRenderHydrateFallback = false;
1035
+ let errorElement = null;
1036
+ let hydrateFallbackElement = null;
1037
+ if (dataRouterState) {
1038
+ error = errors && match.route.id ? errors[match.route.id] : void 0;
1039
+ errorElement = match.route.errorElement || defaultErrorElement;
1040
+ if (renderFallback) {
1041
+ if (fallbackIndex < 0 && index === 0) {
1042
+ warningOnce(
1043
+ "route-fallback",
1044
+ false,
1045
+ "No `HydrateFallback` element provided to render during initial hydration"
1046
+ );
1047
+ shouldRenderHydrateFallback = true;
1048
+ hydrateFallbackElement = null;
1049
+ } else if (fallbackIndex === index) {
1050
+ shouldRenderHydrateFallback = true;
1051
+ hydrateFallbackElement = match.route.hydrateFallbackElement || null;
1052
+ }
1053
+ }
1054
+ }
1055
+ let matches2 = parentMatches.concat(renderedMatches.slice(0, index + 1));
1056
+ let getChildren = () => {
1057
+ let children;
1058
+ if (error) {
1059
+ children = errorElement;
1060
+ } else if (shouldRenderHydrateFallback) {
1061
+ children = hydrateFallbackElement;
1062
+ } else if (match.route.Component) {
1063
+ children = /* @__PURE__ */ React3__namespace.createElement(match.route.Component, null);
1064
+ } else if (match.route.element) {
1065
+ children = match.route.element;
1066
+ } else {
1067
+ children = outlet;
1068
+ }
1069
+ return /* @__PURE__ */ React3__namespace.createElement(
1070
+ RenderedRoute,
1071
+ {
1072
+ match,
1073
+ routeContext: {
1074
+ outlet,
1075
+ matches: matches2,
1076
+ isDataRoute: dataRouterState != null
1077
+ },
1078
+ children
1079
+ }
1080
+ );
1081
+ };
1082
+ return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /* @__PURE__ */ React3__namespace.createElement(
1083
+ RenderErrorBoundary,
1084
+ {
1085
+ location: dataRouterState.location,
1086
+ revalidation: dataRouterState.revalidation,
1087
+ component: errorElement,
1088
+ error,
1089
+ children: getChildren(),
1090
+ routeContext: { outlet: null, matches: matches2, isDataRoute: true },
1091
+ onError
1092
+ }
1093
+ ) : getChildren();
1094
+ },
1095
+ null
1096
+ );
1097
+ }
1098
+ function getDataRouterConsoleError(hookName) {
1099
+ return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
1100
+ }
1101
+ function useDataRouterContext(hookName) {
1102
+ let ctx = React3__namespace.useContext(DataRouterContext);
1103
+ invariant(ctx, getDataRouterConsoleError(hookName));
1104
+ return ctx;
1105
+ }
1106
+ function useDataRouterState(hookName) {
1107
+ let state = React3__namespace.useContext(DataRouterStateContext);
1108
+ invariant(state, getDataRouterConsoleError(hookName));
1109
+ return state;
1110
+ }
1111
+ function useRouteContext(hookName) {
1112
+ let route = React3__namespace.useContext(RouteContext);
1113
+ invariant(route, getDataRouterConsoleError(hookName));
1114
+ return route;
1115
+ }
1116
+ function useCurrentRouteId(hookName) {
1117
+ let route = useRouteContext(hookName);
1118
+ let thisRoute = route.matches[route.matches.length - 1];
1119
+ invariant(
1120
+ thisRoute.route.id,
1121
+ `${hookName} can only be used on routes that contain a unique "id"`
1122
+ );
1123
+ return thisRoute.route.id;
1124
+ }
1125
+ function useRouteId() {
1126
+ return useCurrentRouteId("useRouteId" /* UseRouteId */);
1127
+ }
1128
+ function useRouteError() {
1129
+ let error = React3__namespace.useContext(RouteErrorContext);
1130
+ let state = useDataRouterState("useRouteError" /* UseRouteError */);
1131
+ let routeId = useCurrentRouteId("useRouteError" /* UseRouteError */);
1132
+ if (error !== void 0) {
1133
+ return error;
1134
+ }
1135
+ return state.errors?.[routeId];
1136
+ }
1137
+ function useNavigateStable() {
1138
+ let { router } = useDataRouterContext("useNavigate" /* UseNavigateStable */);
1139
+ let id = useCurrentRouteId("useNavigate" /* UseNavigateStable */);
1140
+ let activeRef = React3__namespace.useRef(false);
1141
+ useIsomorphicLayoutEffect(() => {
1142
+ activeRef.current = true;
1143
+ });
1144
+ let navigate = React3__namespace.useCallback(
1145
+ async (to, options = {}) => {
1146
+ warning(activeRef.current, navigateEffectWarning);
1147
+ if (!activeRef.current) return;
1148
+ if (typeof to === "number") {
1149
+ await router.navigate(to);
1150
+ } else {
1151
+ await router.navigate(to, { fromRouteId: id, ...options });
1152
+ }
1153
+ },
1154
+ [router, id]
1155
+ );
1156
+ return navigate;
1157
+ }
1158
+ var alreadyWarned = {};
1159
+ function warningOnce(key, cond, message) {
1160
+ if (!cond && !alreadyWarned[key]) {
1161
+ alreadyWarned[key] = true;
1162
+ warning(false, message);
1163
+ }
1164
+ }
1165
+ React3__namespace.memo(DataRoutes);
1166
+ function DataRoutes({
1167
+ routes,
1168
+ future,
1169
+ state,
1170
+ isStatic,
1171
+ onError
1172
+ }) {
1173
+ return useRoutesImpl(routes, void 0, { state, isStatic, onError});
1174
+ }
1175
+
1176
+ // lib/dom/dom.ts
1177
+ var defaultMethod = "get";
1178
+ var defaultEncType = "application/x-www-form-urlencoded";
1179
+ function isHtmlElement(object) {
1180
+ return typeof HTMLElement !== "undefined" && object instanceof HTMLElement;
1181
+ }
1182
+ function isButtonElement(object) {
1183
+ return isHtmlElement(object) && object.tagName.toLowerCase() === "button";
1184
+ }
1185
+ function isFormElement(object) {
1186
+ return isHtmlElement(object) && object.tagName.toLowerCase() === "form";
1187
+ }
1188
+ function isInputElement(object) {
1189
+ return isHtmlElement(object) && object.tagName.toLowerCase() === "input";
1190
+ }
1191
+ function isModifiedEvent(event) {
1192
+ return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
1193
+ }
1194
+ function shouldProcessLinkClick(event, target) {
1195
+ return event.button === 0 && // Ignore everything but left clicks
1196
+ (!target || target === "_self") && // Let browser handle "target=_blank" etc.
1197
+ !isModifiedEvent(event);
1198
+ }
1199
+ var _formDataSupportsSubmitter = null;
1200
+ function isFormDataSubmitterSupported() {
1201
+ if (_formDataSupportsSubmitter === null) {
1202
+ try {
1203
+ new FormData(
1204
+ document.createElement("form"),
1205
+ // @ts-expect-error if FormData supports the submitter parameter, this will throw
1206
+ 0
1207
+ );
1208
+ _formDataSupportsSubmitter = false;
1209
+ } catch (e) {
1210
+ _formDataSupportsSubmitter = true;
1211
+ }
1212
+ }
1213
+ return _formDataSupportsSubmitter;
1214
+ }
1215
+ var supportedFormEncTypes = /* @__PURE__ */ new Set([
1216
+ "application/x-www-form-urlencoded",
1217
+ "multipart/form-data",
1218
+ "text/plain"
1219
+ ]);
1220
+ function getFormEncType(encType) {
1221
+ if (encType != null && !supportedFormEncTypes.has(encType)) {
1222
+ warning(
1223
+ false,
1224
+ `"${encType}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${defaultEncType}"`
1225
+ );
1226
+ return null;
1227
+ }
1228
+ return encType;
1229
+ }
1230
+ function getFormSubmissionInfo(target, basename) {
1231
+ let method;
1232
+ let action;
1233
+ let encType;
1234
+ let formData;
1235
+ let body;
1236
+ if (isFormElement(target)) {
1237
+ let attr = target.getAttribute("action");
1238
+ action = attr ? stripBasename(attr, basename) : null;
1239
+ method = target.getAttribute("method") || defaultMethod;
1240
+ encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType;
1241
+ formData = new FormData(target);
1242
+ } else if (isButtonElement(target) || isInputElement(target) && (target.type === "submit" || target.type === "image")) {
1243
+ let form = target.form;
1244
+ if (form == null) {
1245
+ throw new Error(
1246
+ `Cannot submit a <button> or <input type="submit"> without a <form>`
1247
+ );
1248
+ }
1249
+ let attr = target.getAttribute("formaction") || form.getAttribute("action");
1250
+ action = attr ? stripBasename(attr, basename) : null;
1251
+ method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod;
1252
+ encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType;
1253
+ formData = new FormData(form, target);
1254
+ if (!isFormDataSubmitterSupported()) {
1255
+ let { name, type, value } = target;
1256
+ if (type === "image") {
1257
+ let prefix = name ? `${name}.` : "";
1258
+ formData.append(`${prefix}x`, "0");
1259
+ formData.append(`${prefix}y`, "0");
1260
+ } else if (name) {
1261
+ formData.append(name, value);
1262
+ }
1263
+ }
1264
+ } else if (isHtmlElement(target)) {
1265
+ throw new Error(
1266
+ `Cannot submit element that is not <form>, <button>, or <input type="submit|image">`
1267
+ );
1268
+ } else {
1269
+ method = defaultMethod;
1270
+ action = null;
1271
+ encType = defaultEncType;
1272
+ body = target;
1273
+ }
1274
+ if (formData && encType === "text/plain") {
1275
+ body = formData;
1276
+ formData = void 0;
1277
+ }
1278
+ return { action, method: method.toLowerCase(), encType, formData, body };
1279
+ }
1280
+ Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
1281
+
1282
+ // lib/dom/ssr/invariant.ts
1283
+ function invariant2(value, message) {
1284
+ if (value === false || value === null || typeof value === "undefined") {
1285
+ throw new Error(message);
1286
+ }
1287
+ }
1288
+ function singleFetchUrl(reqUrl, basename, trailingSlashAware, extension) {
1289
+ let url = typeof reqUrl === "string" ? new URL(
1290
+ reqUrl,
1291
+ // This can be called during the SSR flow via PrefetchPageLinksImpl so
1292
+ // don't assume window is available
1293
+ typeof window === "undefined" ? "server://singlefetch/" : window.location.origin
1294
+ ) : reqUrl;
1295
+ if (trailingSlashAware) {
1296
+ if (url.pathname.endsWith("/")) {
1297
+ url.pathname = `${url.pathname}_.${extension}`;
1298
+ } else {
1299
+ url.pathname = `${url.pathname}.${extension}`;
1300
+ }
1301
+ } else {
1302
+ if (url.pathname === "/") {
1303
+ url.pathname = `_root.${extension}`;
1304
+ } else if (basename && stripBasename(url.pathname, basename) === "/") {
1305
+ url.pathname = `${basename.replace(/\/$/, "")}/_root.${extension}`;
1306
+ } else {
1307
+ url.pathname = `${url.pathname.replace(/\/$/, "")}.${extension}`;
1308
+ }
1309
+ }
1310
+ return url;
1311
+ }
1312
+
1313
+ // lib/dom/ssr/routeModules.ts
1314
+ async function loadRouteModule(route, routeModulesCache) {
1315
+ if (route.id in routeModulesCache) {
1316
+ return routeModulesCache[route.id];
1317
+ }
1318
+ try {
1319
+ let routeModule = await import(
1320
+ /* @vite-ignore */
1321
+ /* webpackIgnore: true */
1322
+ route.module
1323
+ );
1324
+ routeModulesCache[route.id] = routeModule;
1325
+ return routeModule;
1326
+ } catch (error) {
1327
+ console.error(
1328
+ `Error loading route module \`${route.module}\`, reloading page...`
1329
+ );
1330
+ console.error(error);
1331
+ if (window.__reactRouterContext && window.__reactRouterContext.isSpaMode && // @ts-expect-error
1332
+ undefined) {
1333
+ throw error;
1334
+ }
1335
+ window.location.reload();
1336
+ return new Promise(() => {
1337
+ });
1338
+ }
1339
+ }
1340
+ function isHtmlLinkDescriptor(object) {
1341
+ if (object == null) {
1342
+ return false;
1343
+ }
1344
+ if (object.href == null) {
1345
+ return object.rel === "preload" && typeof object.imageSrcSet === "string" && typeof object.imageSizes === "string";
1346
+ }
1347
+ return typeof object.rel === "string" && typeof object.href === "string";
1348
+ }
1349
+ async function getKeyedPrefetchLinks(matches, manifest, routeModules) {
1350
+ let links = await Promise.all(
1351
+ matches.map(async (match) => {
1352
+ let route = manifest.routes[match.route.id];
1353
+ if (route) {
1354
+ let mod = await loadRouteModule(route, routeModules);
1355
+ return mod.links ? mod.links() : [];
1356
+ }
1357
+ return [];
1358
+ })
1359
+ );
1360
+ return dedupeLinkDescriptors(
1361
+ links.flat(1).filter(isHtmlLinkDescriptor).filter((link) => link.rel === "stylesheet" || link.rel === "preload").map(
1362
+ (link) => link.rel === "stylesheet" ? { ...link, rel: "prefetch", as: "style" } : { ...link, rel: "prefetch" }
1363
+ )
1364
+ );
1365
+ }
1366
+ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, location, mode) {
1367
+ let isNew = (match, index) => {
1368
+ if (!currentMatches[index]) return true;
1369
+ return match.route.id !== currentMatches[index].route.id;
1370
+ };
1371
+ let matchPathChanged = (match, index) => {
1372
+ return (
1373
+ // param change, /users/123 -> /users/456
1374
+ currentMatches[index].pathname !== match.pathname || // splat param changed, which is not present in match.path
1375
+ // e.g. /files/images/avatar.jpg -> files/finances.xls
1376
+ currentMatches[index].route.path?.endsWith("*") && currentMatches[index].params["*"] !== match.params["*"]
1377
+ );
1378
+ };
1379
+ if (mode === "assets") {
1380
+ return nextMatches.filter(
1381
+ (match, index) => isNew(match, index) || matchPathChanged(match, index)
1382
+ );
1383
+ }
1384
+ if (mode === "data") {
1385
+ return nextMatches.filter((match, index) => {
1386
+ let manifestRoute = manifest.routes[match.route.id];
1387
+ if (!manifestRoute || !manifestRoute.hasLoader) {
1388
+ return false;
1389
+ }
1390
+ if (isNew(match, index) || matchPathChanged(match, index)) {
1391
+ return true;
1392
+ }
1393
+ if (match.route.shouldRevalidate) {
1394
+ let routeChoice = match.route.shouldRevalidate({
1395
+ currentUrl: new URL(
1396
+ location.pathname + location.search + location.hash,
1397
+ window.origin
1398
+ ),
1399
+ currentParams: currentMatches[0]?.params || {},
1400
+ nextUrl: new URL(page, window.origin),
1401
+ nextParams: match.params,
1402
+ defaultShouldRevalidate: true
1403
+ });
1404
+ if (typeof routeChoice === "boolean") {
1405
+ return routeChoice;
1406
+ }
1407
+ }
1408
+ return true;
1409
+ });
1410
+ }
1411
+ return [];
1412
+ }
1413
+ function getModuleLinkHrefs(matches, manifest, { includeHydrateFallback } = {}) {
1414
+ return dedupeHrefs(
1415
+ matches.map((match) => {
1416
+ let route = manifest.routes[match.route.id];
1417
+ if (!route) return [];
1418
+ let hrefs = [route.module];
1419
+ if (route.clientActionModule) {
1420
+ hrefs = hrefs.concat(route.clientActionModule);
1421
+ }
1422
+ if (route.clientLoaderModule) {
1423
+ hrefs = hrefs.concat(route.clientLoaderModule);
1424
+ }
1425
+ if (includeHydrateFallback && route.hydrateFallbackModule) {
1426
+ hrefs = hrefs.concat(route.hydrateFallbackModule);
1427
+ }
1428
+ if (route.imports) {
1429
+ hrefs = hrefs.concat(route.imports);
1430
+ }
1431
+ return hrefs;
1432
+ }).flat(1)
1433
+ );
1434
+ }
1435
+ function dedupeHrefs(hrefs) {
1436
+ return [...new Set(hrefs)];
1437
+ }
1438
+ function sortKeys(obj) {
1439
+ let sorted = {};
1440
+ let keys = Object.keys(obj).sort();
1441
+ for (let key of keys) {
1442
+ sorted[key] = obj[key];
1443
+ }
1444
+ return sorted;
1445
+ }
1446
+ function dedupeLinkDescriptors(descriptors, preloads) {
1447
+ let set = /* @__PURE__ */ new Set();
1448
+ new Set(preloads);
1449
+ return descriptors.reduce((deduped, descriptor) => {
1450
+ let key = JSON.stringify(sortKeys(descriptor));
1451
+ if (!set.has(key)) {
1452
+ set.add(key);
1453
+ deduped.push({ key, link: descriptor });
1454
+ }
1455
+ return deduped;
1456
+ }, []);
1457
+ }
1458
+
1459
+ // lib/dom/ssr/components.tsx
1460
+ function useDataRouterContext2() {
1461
+ let context = React3__namespace.useContext(DataRouterContext);
1462
+ invariant2(
1463
+ context,
1464
+ "You must render this element inside a <DataRouterContext.Provider> element"
1465
+ );
1466
+ return context;
1467
+ }
1468
+ function useDataRouterStateContext() {
1469
+ let context = React3__namespace.useContext(DataRouterStateContext);
1470
+ invariant2(
1471
+ context,
1472
+ "You must render this element inside a <DataRouterStateContext.Provider> element"
1473
+ );
1474
+ return context;
1475
+ }
1476
+ var FrameworkContext = React3__namespace.createContext(void 0);
1477
+ FrameworkContext.displayName = "FrameworkContext";
1478
+ function useFrameworkContext() {
1479
+ let context = React3__namespace.useContext(FrameworkContext);
1480
+ invariant2(
1481
+ context,
1482
+ "You must render this element inside a <HydratedRouter> element"
1483
+ );
1484
+ return context;
1485
+ }
1486
+ function usePrefetchBehavior(prefetch, theirElementProps) {
1487
+ let frameworkContext = React3__namespace.useContext(FrameworkContext);
1488
+ let [maybePrefetch, setMaybePrefetch] = React3__namespace.useState(false);
1489
+ let [shouldPrefetch, setShouldPrefetch] = React3__namespace.useState(false);
1490
+ let { onFocus, onBlur, onMouseEnter, onMouseLeave, onTouchStart } = theirElementProps;
1491
+ let ref = React3__namespace.useRef(null);
1492
+ React3__namespace.useEffect(() => {
1493
+ if (prefetch === "render") {
1494
+ setShouldPrefetch(true);
1495
+ }
1496
+ if (prefetch === "viewport") {
1497
+ let callback = (entries) => {
1498
+ entries.forEach((entry) => {
1499
+ setShouldPrefetch(entry.isIntersecting);
1500
+ });
1501
+ };
1502
+ let observer = new IntersectionObserver(callback, { threshold: 0.5 });
1503
+ if (ref.current) observer.observe(ref.current);
1504
+ return () => {
1505
+ observer.disconnect();
1506
+ };
1507
+ }
1508
+ }, [prefetch]);
1509
+ React3__namespace.useEffect(() => {
1510
+ if (maybePrefetch) {
1511
+ let id = setTimeout(() => {
1512
+ setShouldPrefetch(true);
1513
+ }, 100);
1514
+ return () => {
1515
+ clearTimeout(id);
1516
+ };
1517
+ }
1518
+ }, [maybePrefetch]);
1519
+ let setIntent = () => {
1520
+ setMaybePrefetch(true);
1521
+ };
1522
+ let cancelIntent = () => {
1523
+ setMaybePrefetch(false);
1524
+ setShouldPrefetch(false);
1525
+ };
1526
+ if (!frameworkContext) {
1527
+ return [false, ref, {}];
1528
+ }
1529
+ if (prefetch !== "intent") {
1530
+ return [shouldPrefetch, ref, {}];
1531
+ }
1532
+ return [
1533
+ shouldPrefetch,
1534
+ ref,
1535
+ {
1536
+ onFocus: composeEventHandlers(onFocus, setIntent),
1537
+ onBlur: composeEventHandlers(onBlur, cancelIntent),
1538
+ onMouseEnter: composeEventHandlers(onMouseEnter, setIntent),
1539
+ onMouseLeave: composeEventHandlers(onMouseLeave, cancelIntent),
1540
+ onTouchStart: composeEventHandlers(onTouchStart, setIntent)
1541
+ }
1542
+ ];
1543
+ }
1544
+ function composeEventHandlers(theirHandler, ourHandler) {
1545
+ return (event) => {
1546
+ theirHandler && theirHandler(event);
1547
+ if (!event.defaultPrevented) {
1548
+ ourHandler(event);
1549
+ }
1550
+ };
1551
+ }
1552
+ function PrefetchPageLinks({ page, ...linkProps }) {
1553
+ let { router } = useDataRouterContext2();
1554
+ let matches = React3__namespace.useMemo(
1555
+ () => matchRoutes(router.routes, page, router.basename),
1556
+ [router.routes, page, router.basename]
1557
+ );
1558
+ if (!matches) {
1559
+ return null;
1560
+ }
1561
+ return /* @__PURE__ */ React3__namespace.createElement(PrefetchPageLinksImpl, { page, matches, ...linkProps });
1562
+ }
1563
+ function useKeyedPrefetchLinks(matches) {
1564
+ let { manifest, routeModules } = useFrameworkContext();
1565
+ let [keyedPrefetchLinks, setKeyedPrefetchLinks] = React3__namespace.useState([]);
1566
+ React3__namespace.useEffect(() => {
1567
+ let interrupted = false;
1568
+ void getKeyedPrefetchLinks(matches, manifest, routeModules).then(
1569
+ (links) => {
1570
+ if (!interrupted) {
1571
+ setKeyedPrefetchLinks(links);
1572
+ }
1573
+ }
1574
+ );
1575
+ return () => {
1576
+ interrupted = true;
1577
+ };
1578
+ }, [matches, manifest, routeModules]);
1579
+ return keyedPrefetchLinks;
1580
+ }
1581
+ function PrefetchPageLinksImpl({
1582
+ page,
1583
+ matches: nextMatches,
1584
+ ...linkProps
1585
+ }) {
1586
+ let location = useLocation();
1587
+ let { future, manifest, routeModules } = useFrameworkContext();
1588
+ let { basename } = useDataRouterContext2();
1589
+ let { loaderData, matches } = useDataRouterStateContext();
1590
+ let newMatchesForData = React3__namespace.useMemo(
1591
+ () => getNewMatchesForLinks(
1592
+ page,
1593
+ nextMatches,
1594
+ matches,
1595
+ manifest,
1596
+ location,
1597
+ "data"
1598
+ ),
1599
+ [page, nextMatches, matches, manifest, location]
1600
+ );
1601
+ let newMatchesForAssets = React3__namespace.useMemo(
1602
+ () => getNewMatchesForLinks(
1603
+ page,
1604
+ nextMatches,
1605
+ matches,
1606
+ manifest,
1607
+ location,
1608
+ "assets"
1609
+ ),
1610
+ [page, nextMatches, matches, manifest, location]
1611
+ );
1612
+ let dataHrefs = React3__namespace.useMemo(() => {
1613
+ if (page === location.pathname + location.search + location.hash) {
1614
+ return [];
1615
+ }
1616
+ let routesParams = /* @__PURE__ */ new Set();
1617
+ let foundOptOutRoute = false;
1618
+ nextMatches.forEach((m) => {
1619
+ let manifestRoute = manifest.routes[m.route.id];
1620
+ if (!manifestRoute || !manifestRoute.hasLoader) {
1621
+ return;
1622
+ }
1623
+ if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && routeModules[m.route.id]?.shouldRevalidate) {
1624
+ foundOptOutRoute = true;
1625
+ } else if (manifestRoute.hasClientLoader) {
1626
+ foundOptOutRoute = true;
1627
+ } else {
1628
+ routesParams.add(m.route.id);
1629
+ }
1630
+ });
1631
+ if (routesParams.size === 0) {
1632
+ return [];
1633
+ }
1634
+ let url = singleFetchUrl(
1635
+ page,
1636
+ basename,
1637
+ future.unstable_trailingSlashAwareDataRequests,
1638
+ "data"
1639
+ );
1640
+ if (foundOptOutRoute && routesParams.size > 0) {
1641
+ url.searchParams.set(
1642
+ "_routes",
1643
+ nextMatches.filter((m) => routesParams.has(m.route.id)).map((m) => m.route.id).join(",")
1644
+ );
1645
+ }
1646
+ return [url.pathname + url.search];
1647
+ }, [
1648
+ basename,
1649
+ future.unstable_trailingSlashAwareDataRequests,
1650
+ loaderData,
1651
+ location,
1652
+ manifest,
1653
+ newMatchesForData,
1654
+ nextMatches,
1655
+ page,
1656
+ routeModules
1657
+ ]);
1658
+ let moduleHrefs = React3__namespace.useMemo(
1659
+ () => getModuleLinkHrefs(newMatchesForAssets, manifest),
1660
+ [newMatchesForAssets, manifest]
1661
+ );
1662
+ let keyedPrefetchLinks = useKeyedPrefetchLinks(newMatchesForAssets);
1663
+ return /* @__PURE__ */ React3__namespace.createElement(React3__namespace.Fragment, null, dataHrefs.map((href) => /* @__PURE__ */ React3__namespace.createElement("link", { key: href, rel: "prefetch", as: "fetch", href, ...linkProps })), moduleHrefs.map((href) => /* @__PURE__ */ React3__namespace.createElement("link", { key: href, rel: "modulepreload", href, ...linkProps })), keyedPrefetchLinks.map(({ key, link }) => (
1664
+ // these don't spread `linkProps` because they are full link descriptors
1665
+ // already with their own props
1666
+ /* @__PURE__ */ React3__namespace.createElement(
1667
+ "link",
1668
+ {
1669
+ key,
1670
+ nonce: linkProps.nonce,
1671
+ ...link,
1672
+ crossOrigin: link.crossOrigin ?? linkProps.crossOrigin
1673
+ }
1674
+ )
1675
+ )));
1676
+ }
1677
+ function mergeRefs(...refs) {
1678
+ return (value) => {
1679
+ refs.forEach((ref) => {
1680
+ if (typeof ref === "function") {
1681
+ ref(value);
1682
+ } else if (ref != null) {
1683
+ ref.current = value;
1684
+ }
1685
+ });
1686
+ };
1687
+ }
1688
+ var isBrowser2 = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
1689
+ try {
1690
+ if (isBrowser2) {
1691
+ window.__reactRouterVersion = // @ts-expect-error
1692
+ "7.13.2";
1693
+ }
1694
+ } catch (e) {
1695
+ }
1696
+ var ABSOLUTE_URL_REGEX2 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
1697
+ var Link = React3__namespace.forwardRef(
1698
+ function LinkWithRef({
1699
+ onClick,
1700
+ discover = "render",
1701
+ prefetch = "none",
1702
+ relative,
1703
+ reloadDocument,
1704
+ replace: replace2,
1705
+ unstable_mask,
1706
+ state,
1707
+ target,
1708
+ to,
1709
+ preventScrollReset,
1710
+ viewTransition,
1711
+ unstable_defaultShouldRevalidate,
1712
+ ...rest
1713
+ }, forwardedRef) {
1714
+ let { basename, navigator, unstable_useTransitions } = React3__namespace.useContext(NavigationContext);
1715
+ let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX2.test(to);
1716
+ let parsed = parseToInfo(to, basename);
1717
+ to = parsed.to;
1718
+ let href = useHref(to, { relative });
1719
+ let location = useLocation();
1720
+ let maskedHref = null;
1721
+ if (unstable_mask) {
1722
+ let resolved = resolveTo(
1723
+ unstable_mask,
1724
+ [],
1725
+ location.unstable_mask ? location.unstable_mask.pathname : "/",
1726
+ true
1727
+ );
1728
+ if (basename !== "/") {
1729
+ resolved.pathname = resolved.pathname === "/" ? basename : joinPaths([basename, resolved.pathname]);
1730
+ }
1731
+ maskedHref = navigator.createHref(resolved);
1732
+ }
1733
+ let [shouldPrefetch, prefetchRef, prefetchHandlers] = usePrefetchBehavior(
1734
+ prefetch,
1735
+ rest
1736
+ );
1737
+ let internalOnClick = useLinkClickHandler(to, {
1738
+ replace: replace2,
1739
+ unstable_mask,
1740
+ state,
1741
+ target,
1742
+ preventScrollReset,
1743
+ relative,
1744
+ viewTransition,
1745
+ unstable_defaultShouldRevalidate,
1746
+ unstable_useTransitions
1747
+ });
1748
+ function handleClick(event) {
1749
+ if (onClick) onClick(event);
1750
+ if (!event.defaultPrevented) {
1751
+ internalOnClick(event);
1752
+ }
1753
+ }
1754
+ let isSpaLink = !(parsed.isExternal || reloadDocument);
1755
+ let link = (
1756
+ // eslint-disable-next-line jsx-a11y/anchor-has-content
1757
+ /* @__PURE__ */ React3__namespace.createElement(
1758
+ "a",
1759
+ {
1760
+ ...rest,
1761
+ ...prefetchHandlers,
1762
+ href: (isSpaLink ? maskedHref : void 0) || parsed.absoluteURL || href,
1763
+ onClick: isSpaLink ? handleClick : onClick,
1764
+ ref: mergeRefs(forwardedRef, prefetchRef),
1765
+ target,
1766
+ "data-discover": !isAbsolute && discover === "render" ? "true" : void 0
1767
+ }
1768
+ )
1769
+ );
1770
+ return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React3__namespace.createElement(React3__namespace.Fragment, null, link, /* @__PURE__ */ React3__namespace.createElement(PrefetchPageLinks, { page: href })) : link;
1771
+ }
1772
+ );
1773
+ Link.displayName = "Link";
1774
+ var NavLink = React3__namespace.forwardRef(
1775
+ function NavLinkWithRef({
1776
+ "aria-current": ariaCurrentProp = "page",
1777
+ caseSensitive = false,
1778
+ className: classNameProp = "",
1779
+ end = false,
1780
+ style: styleProp,
1781
+ to,
1782
+ viewTransition,
1783
+ children,
1784
+ ...rest
1785
+ }, ref) {
1786
+ let path = useResolvedPath(to, { relative: rest.relative });
1787
+ let location = useLocation();
1788
+ let routerState = React3__namespace.useContext(DataRouterStateContext);
1789
+ let { navigator, basename } = React3__namespace.useContext(NavigationContext);
1790
+ let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
1791
+ // eslint-disable-next-line react-hooks/rules-of-hooks
1792
+ useViewTransitionState(path) && viewTransition === true;
1793
+ let toPathname = navigator.encodeLocation ? navigator.encodeLocation(path).pathname : path.pathname;
1794
+ let locationPathname = location.pathname;
1795
+ let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null;
1796
+ if (!caseSensitive) {
1797
+ locationPathname = locationPathname.toLowerCase();
1798
+ nextLocationPathname = nextLocationPathname ? nextLocationPathname.toLowerCase() : null;
1799
+ toPathname = toPathname.toLowerCase();
1800
+ }
1801
+ if (nextLocationPathname && basename) {
1802
+ nextLocationPathname = stripBasename(nextLocationPathname, basename) || nextLocationPathname;
1803
+ }
1804
+ const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
1805
+ let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
1806
+ let isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(toPathname.length) === "/");
1807
+ let renderProps = {
1808
+ isActive,
1809
+ isPending,
1810
+ isTransitioning
1811
+ };
1812
+ let ariaCurrent = isActive ? ariaCurrentProp : void 0;
1813
+ let className;
1814
+ if (typeof classNameProp === "function") {
1815
+ className = classNameProp(renderProps);
1816
+ } else {
1817
+ className = [
1818
+ classNameProp,
1819
+ isActive ? "active" : null,
1820
+ isPending ? "pending" : null,
1821
+ isTransitioning ? "transitioning" : null
1822
+ ].filter(Boolean).join(" ");
1823
+ }
1824
+ let style = typeof styleProp === "function" ? styleProp(renderProps) : styleProp;
1825
+ return /* @__PURE__ */ React3__namespace.createElement(
1826
+ Link,
1827
+ {
1828
+ ...rest,
1829
+ "aria-current": ariaCurrent,
1830
+ className,
1831
+ ref,
1832
+ style,
1833
+ to,
1834
+ viewTransition
1835
+ },
1836
+ typeof children === "function" ? children(renderProps) : children
1837
+ );
1838
+ }
1839
+ );
1840
+ NavLink.displayName = "NavLink";
1841
+ var Form = React3__namespace.forwardRef(
1842
+ ({
1843
+ discover = "render",
1844
+ fetcherKey,
1845
+ navigate,
1846
+ reloadDocument,
1847
+ replace: replace2,
1848
+ state,
1849
+ method = defaultMethod,
1850
+ action,
1851
+ onSubmit,
1852
+ relative,
1853
+ preventScrollReset,
1854
+ viewTransition,
1855
+ unstable_defaultShouldRevalidate,
1856
+ ...props
1857
+ }, forwardedRef) => {
1858
+ let { unstable_useTransitions } = React3__namespace.useContext(NavigationContext);
1859
+ let submit = useSubmit();
1860
+ let formAction = useFormAction(action, { relative });
1861
+ let formMethod = method.toLowerCase() === "get" ? "get" : "post";
1862
+ let isAbsolute = typeof action === "string" && ABSOLUTE_URL_REGEX2.test(action);
1863
+ let submitHandler = (event) => {
1864
+ onSubmit && onSubmit(event);
1865
+ if (event.defaultPrevented) return;
1866
+ event.preventDefault();
1867
+ let submitter = event.nativeEvent.submitter;
1868
+ let submitMethod = submitter?.getAttribute("formmethod") || method;
1869
+ let doSubmit = () => submit(submitter || event.currentTarget, {
1870
+ fetcherKey,
1871
+ method: submitMethod,
1872
+ navigate,
1873
+ replace: replace2,
1874
+ state,
1875
+ relative,
1876
+ preventScrollReset,
1877
+ viewTransition,
1878
+ unstable_defaultShouldRevalidate
1879
+ });
1880
+ if (unstable_useTransitions && navigate !== false) {
1881
+ React3__namespace.startTransition(() => doSubmit());
1882
+ } else {
1883
+ doSubmit();
1884
+ }
1885
+ };
1886
+ return /* @__PURE__ */ React3__namespace.createElement(
1887
+ "form",
1888
+ {
1889
+ ref: forwardedRef,
1890
+ method: formMethod,
1891
+ action: formAction,
1892
+ onSubmit: reloadDocument ? onSubmit : submitHandler,
1893
+ ...props,
1894
+ "data-discover": !isAbsolute && discover === "render" ? "true" : void 0
1895
+ }
1896
+ );
1897
+ }
1898
+ );
1899
+ Form.displayName = "Form";
1900
+ function getDataRouterConsoleError2(hookName) {
1901
+ return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
1902
+ }
1903
+ function useDataRouterContext3(hookName) {
1904
+ let ctx = React3__namespace.useContext(DataRouterContext);
1905
+ invariant(ctx, getDataRouterConsoleError2(hookName));
1906
+ return ctx;
1907
+ }
1908
+ function useLinkClickHandler(to, {
1909
+ target,
1910
+ replace: replaceProp,
1911
+ unstable_mask,
1912
+ state,
1913
+ preventScrollReset,
1914
+ relative,
1915
+ viewTransition,
1916
+ unstable_defaultShouldRevalidate,
1917
+ unstable_useTransitions
1918
+ } = {}) {
1919
+ let navigate = useNavigate();
1920
+ let location = useLocation();
1921
+ let path = useResolvedPath(to, { relative });
1922
+ return React3__namespace.useCallback(
1923
+ (event) => {
1924
+ if (shouldProcessLinkClick(event, target)) {
1925
+ event.preventDefault();
1926
+ let replace2 = replaceProp !== void 0 ? replaceProp : createPath(location) === createPath(path);
1927
+ let doNavigate = () => navigate(to, {
1928
+ replace: replace2,
1929
+ unstable_mask,
1930
+ state,
1931
+ preventScrollReset,
1932
+ relative,
1933
+ viewTransition,
1934
+ unstable_defaultShouldRevalidate
1935
+ });
1936
+ if (unstable_useTransitions) {
1937
+ React3__namespace.startTransition(() => doNavigate());
1938
+ } else {
1939
+ doNavigate();
1940
+ }
1941
+ }
1942
+ },
1943
+ [
1944
+ location,
1945
+ navigate,
1946
+ path,
1947
+ replaceProp,
1948
+ unstable_mask,
1949
+ state,
1950
+ target,
1951
+ to,
1952
+ preventScrollReset,
1953
+ relative,
1954
+ viewTransition,
1955
+ unstable_defaultShouldRevalidate,
1956
+ unstable_useTransitions
1957
+ ]
1958
+ );
1959
+ }
1960
+ var fetcherId = 0;
1961
+ var getUniqueFetcherId = () => `__${String(++fetcherId)}__`;
1962
+ function useSubmit() {
1963
+ let { router } = useDataRouterContext3("useSubmit" /* UseSubmit */);
1964
+ let { basename } = React3__namespace.useContext(NavigationContext);
1965
+ let currentRouteId = useRouteId();
1966
+ let routerFetch = router.fetch;
1967
+ let routerNavigate = router.navigate;
1968
+ return React3__namespace.useCallback(
1969
+ async (target, options = {}) => {
1970
+ let { action, method, encType, formData, body } = getFormSubmissionInfo(
1971
+ target,
1972
+ basename
1973
+ );
1974
+ if (options.navigate === false) {
1975
+ let key = options.fetcherKey || getUniqueFetcherId();
1976
+ await routerFetch(key, currentRouteId, options.action || action, {
1977
+ unstable_defaultShouldRevalidate: options.unstable_defaultShouldRevalidate,
1978
+ preventScrollReset: options.preventScrollReset,
1979
+ formData,
1980
+ body,
1981
+ formMethod: options.method || method,
1982
+ formEncType: options.encType || encType,
1983
+ flushSync: options.flushSync
1984
+ });
1985
+ } else {
1986
+ await routerNavigate(options.action || action, {
1987
+ unstable_defaultShouldRevalidate: options.unstable_defaultShouldRevalidate,
1988
+ preventScrollReset: options.preventScrollReset,
1989
+ formData,
1990
+ body,
1991
+ formMethod: options.method || method,
1992
+ formEncType: options.encType || encType,
1993
+ replace: options.replace,
1994
+ state: options.state,
1995
+ fromRouteId: currentRouteId,
1996
+ flushSync: options.flushSync,
1997
+ viewTransition: options.viewTransition
1998
+ });
1999
+ }
2000
+ },
2001
+ [routerFetch, routerNavigate, basename, currentRouteId]
2002
+ );
2003
+ }
2004
+ function useFormAction(action, { relative } = {}) {
2005
+ let { basename } = React3__namespace.useContext(NavigationContext);
2006
+ let routeContext = React3__namespace.useContext(RouteContext);
2007
+ invariant(routeContext, "useFormAction must be used inside a RouteContext");
2008
+ let [match] = routeContext.matches.slice(-1);
2009
+ let path = { ...useResolvedPath(action ? action : ".", { relative }) };
2010
+ let location = useLocation();
2011
+ if (action == null) {
2012
+ path.search = location.search;
2013
+ let params = new URLSearchParams(path.search);
2014
+ let indexValues = params.getAll("index");
2015
+ let hasNakedIndexParam = indexValues.some((v) => v === "");
2016
+ if (hasNakedIndexParam) {
2017
+ params.delete("index");
2018
+ indexValues.filter((v) => v).forEach((v) => params.append("index", v));
2019
+ let qs = params.toString();
2020
+ path.search = qs ? `?${qs}` : "";
2021
+ }
2022
+ }
2023
+ if ((!action || action === ".") && match.route.index) {
2024
+ path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
2025
+ }
2026
+ if (basename !== "/") {
2027
+ path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
2028
+ }
2029
+ return createPath(path);
2030
+ }
2031
+ function useViewTransitionState(to, { relative } = {}) {
2032
+ let vtContext = React3__namespace.useContext(ViewTransitionContext);
2033
+ invariant(
2034
+ vtContext != null,
2035
+ "`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
2036
+ );
2037
+ let { basename } = useDataRouterContext3(
2038
+ "useViewTransitionState" /* useViewTransitionState */
2039
+ );
2040
+ let path = useResolvedPath(to, { relative });
2041
+ if (!vtContext.isTransitioning) {
2042
+ return false;
2043
+ }
2044
+ let currentPath = stripBasename(vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
2045
+ let nextPath = stripBasename(vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
2046
+ return matchPath(path.pathname, nextPath) != null || matchPath(path.pathname, currentPath) != null;
2047
+ }
2048
+
2049
+ function getDefaultExportFromCjs (x) {
2050
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
2051
+ }
2052
+
101
2053
  const LinkWithRef = ({ children, to, href, forwardedRef = null, ...attributes }) => {
102
2054
  if (to) {
103
- return (jsxRuntime.jsx(reactRouterDom.Link, { ref: forwardedRef, to: to, ...attributes, children: children }));
2055
+ return (jsxRuntime.jsx(Link, { ref: forwardedRef, to: to, ...attributes, children: children }));
104
2056
  }
105
2057
  return (jsxRuntime.jsx("a", { ref: forwardedRef, href: href || "#", ...attributes, children: children }));
106
2058
  };
@@ -178,40 +2130,39 @@ const Boolean$1 = ({ className, errorMessage, fieldset, formGroup, hint, idPrefi
178
2130
  return null;
179
2131
  };
180
2132
  const hasFieldset = !!fieldset;
181
- const innerHtml = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [getHintComponent(), getErrorMessageComponent(), jsxRuntime.jsx("div", { className: `govuk-${controlType} ${className || ""}`, ...attributes, "data-module": `govuk-${controlType}`, children: items &&
182
- items.map((item, index) => {
183
- if (!item) {
184
- return null;
185
- }
186
- if (item.behaviour === "exclusive") {
187
- delete item.behaviour;
188
- }
189
- const { id, children, hint: itemHint, conditional: itemConditional, behaviour, label, reactListKey, ...itemAttributes } = item;
190
- const idSuffix = `-${index + 1}`;
191
- const idValue = id || `${idPrefixValue}${index === 0 ? "" : idSuffix}`;
192
- const nameValue = item.name ? item.name : name;
193
- const conditionalId = itemConditional?.children
194
- ? `conditional-${idValue}`
195
- : undefined;
196
- const itemHintId = `${idValue}-item-hint`;
197
- let itemDescribedBy = "";
198
- if (controlType === "checkboxes" && !hasFieldset) {
199
- itemDescribedBy = describedBy;
200
- }
201
- if (itemHint) {
202
- itemDescribedBy += ` ${itemHintId}`;
203
- }
204
- if (item.divider) {
205
- return (jsxRuntime.jsx("div", { className: `govuk-${controlType}__divider`, children: item.divider }, reactListKey || index));
206
- }
207
- return (jsxRuntime.jsxs(React.Fragment, { children: [jsxRuntime.jsxs("div", { className: `govuk-${controlType}__item`, children: [jsxRuntime.jsx("input", { className: `govuk-${controlType}__input`, id: idValue, name: nameValue, type: controlType === "radios" ? "radio" : "checkbox", "data-aria-controls": conditionalId, "aria-describedby": itemDescribedBy || undefined, onChange: onChange, onBlur: onBlur, "data-behaviour": behaviour, ...itemAttributes }), jsxRuntime.jsx(Label, { ...label,
208
- className: `govuk-${controlType}__label ${label?.className || ""}`,
209
- htmlFor: idValue,
210
- isPageHeading: false, children: children }), itemHint ? (jsxRuntime.jsx(Hint, { ...itemHint,
211
- className: `govuk-${controlType}__hint ${itemHint.className || ""}`, id: itemHintId })) : ("")] }), itemConditional?.children ? (jsxRuntime.jsx("div", { className: `govuk-${controlType}__conditional ${item.checked
212
- ? ""
213
- : `govuk-${controlType}__conditional--hidden`}`, id: conditionalId, children: itemConditional.children })) : ("")] }, reactListKey || index));
214
- }) })] }));
2133
+ const innerHtml = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [getHintComponent(), getErrorMessageComponent(), jsxRuntime.jsx("div", { className: `govuk-${controlType} ${className || ""}`, ...attributes, "data-module": `govuk-${controlType}`, children: items?.map((item, index) => {
2134
+ if (!item) {
2135
+ return null;
2136
+ }
2137
+ if (item.behaviour === "exclusive") {
2138
+ delete item.behaviour;
2139
+ }
2140
+ const { id, children, hint: itemHint, conditional: itemConditional, behaviour, label, reactListKey, ...itemAttributes } = item;
2141
+ const idSuffix = `-${index + 1}`;
2142
+ const idValue = id || `${idPrefixValue}${index === 0 ? "" : idSuffix}`;
2143
+ const nameValue = item.name ? item.name : name;
2144
+ const conditionalId = itemConditional?.children
2145
+ ? `conditional-${idValue}`
2146
+ : undefined;
2147
+ const itemHintId = `${idValue}-item-hint`;
2148
+ let itemDescribedBy = "";
2149
+ if (controlType === "checkboxes" && !hasFieldset) {
2150
+ itemDescribedBy = describedBy;
2151
+ }
2152
+ if (itemHint) {
2153
+ itemDescribedBy += ` ${itemHintId}`;
2154
+ }
2155
+ if (item.divider) {
2156
+ return (jsxRuntime.jsx("div", { className: `govuk-${controlType}__divider`, children: item.divider }, reactListKey || index));
2157
+ }
2158
+ return (jsxRuntime.jsxs(React3.Fragment, { children: [jsxRuntime.jsxs("div", { className: `govuk-${controlType}__item`, children: [jsxRuntime.jsx("input", { className: `govuk-${controlType}__input`, id: idValue, name: nameValue, type: controlType === "radios" ? "radio" : "checkbox", "data-aria-controls": conditionalId, "aria-describedby": itemDescribedBy || undefined, onChange: onChange, onBlur: onBlur, "data-behaviour": behaviour, ...itemAttributes }), jsxRuntime.jsx(Label, { ...label,
2159
+ className: `govuk-${controlType}__label ${label?.className || ""}`,
2160
+ htmlFor: idValue,
2161
+ isPageHeading: false, children: children }), itemHint ? (jsxRuntime.jsx(Hint, { ...itemHint,
2162
+ className: `govuk-${controlType}__hint ${itemHint.className || ""}`, id: itemHintId })) : ("")] }), itemConditional?.children ? (jsxRuntime.jsx("div", { className: `govuk-${controlType}__conditional ${item.checked
2163
+ ? ""
2164
+ : `govuk-${controlType}__conditional--hidden`}`, id: conditionalId, children: itemConditional.children })) : ("")] }, reactListKey || index));
2165
+ }) })] }));
215
2166
  return (jsxRuntime.jsx("div", { className: `govuk-form-group${errorMessage ? " govuk-form-group--error" : ""} ${formGroup?.className || ""}`, children: hasFieldset ? (jsxRuntime.jsx(Fieldset, { ...omit(fieldset, "role"), "aria-describedby": describedBy.trim() || undefined, children: innerHtml })) : (innerHtml) }));
216
2167
  };
217
2168
 
@@ -292,10 +2243,6 @@ function ConfigureOverallButton($scope, config) {
292
2243
  govukFrontend.createAll(govukFrontend.Button, config, $scope);
293
2244
  }
294
2245
 
295
- function getDefaultExportFromCjs (x) {
296
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
297
- }
298
-
299
2246
  var classnames = {exports: {}};
300
2247
 
301
2248
  /*!
@@ -385,7 +2332,7 @@ var classNames = /*@__PURE__*/getDefaultExportFromCjs(classnamesExports);
385
2332
 
386
2333
  const DEFAULT_BREAKPOINTS = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs'];
387
2334
  const DEFAULT_MIN_BREAKPOINT = 'xs';
388
- const ThemeContext = /*#__PURE__*/React__namespace.createContext({
2335
+ const ThemeContext = /*#__PURE__*/React3__namespace.createContext({
389
2336
  prefixes: {},
390
2337
  breakpoints: DEFAULT_BREAKPOINTS,
391
2338
  minBreakpoint: DEFAULT_MIN_BREAKPOINT
@@ -397,11 +2344,11 @@ const {
397
2344
  function useBootstrapPrefix(prefix, defaultPrefix) {
398
2345
  const {
399
2346
  prefixes
400
- } = React.useContext(ThemeContext);
2347
+ } = React3.useContext(ThemeContext);
401
2348
  return prefix || prefixes[defaultPrefix] || defaultPrefix;
402
2349
  }
403
2350
 
404
- const CardBody = /*#__PURE__*/React__namespace.forwardRef(({
2351
+ const CardBody = /*#__PURE__*/React3__namespace.forwardRef(({
405
2352
  className,
406
2353
  bsPrefix,
407
2354
  as: Component = 'div',
@@ -416,7 +2363,7 @@ const CardBody = /*#__PURE__*/React__namespace.forwardRef(({
416
2363
  });
417
2364
  CardBody.displayName = 'CardBody';
418
2365
 
419
- const CardFooter = /*#__PURE__*/React__namespace.forwardRef(({
2366
+ const CardFooter = /*#__PURE__*/React3__namespace.forwardRef(({
420
2367
  className,
421
2368
  bsPrefix,
422
2369
  as: Component = 'div',
@@ -431,10 +2378,10 @@ const CardFooter = /*#__PURE__*/React__namespace.forwardRef(({
431
2378
  });
432
2379
  CardFooter.displayName = 'CardFooter';
433
2380
 
434
- const context = /*#__PURE__*/React__namespace.createContext(null);
2381
+ const context = /*#__PURE__*/React3__namespace.createContext(null);
435
2382
  context.displayName = 'CardHeaderContext';
436
2383
 
437
- const CardHeader = /*#__PURE__*/React__namespace.forwardRef(({
2384
+ const CardHeader = /*#__PURE__*/React3__namespace.forwardRef(({
438
2385
  bsPrefix,
439
2386
  className,
440
2387
  // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
@@ -442,7 +2389,7 @@ const CardHeader = /*#__PURE__*/React__namespace.forwardRef(({
442
2389
  ...props
443
2390
  }, ref) => {
444
2391
  const prefix = useBootstrapPrefix(bsPrefix, 'card-header');
445
- const contextValue = React.useMemo(() => ({
2392
+ const contextValue = React3.useMemo(() => ({
446
2393
  cardHeaderBsPrefix: prefix
447
2394
  }), [prefix]);
448
2395
  return /*#__PURE__*/jsxRuntime.jsx(context.Provider, {
@@ -456,7 +2403,7 @@ const CardHeader = /*#__PURE__*/React__namespace.forwardRef(({
456
2403
  });
457
2404
  CardHeader.displayName = 'CardHeader';
458
2405
 
459
- const CardImg = /*#__PURE__*/React__namespace.forwardRef(
2406
+ const CardImg = /*#__PURE__*/React3__namespace.forwardRef(
460
2407
  // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
461
2408
  ({
462
2409
  bsPrefix,
@@ -474,7 +2421,7 @@ const CardImg = /*#__PURE__*/React__namespace.forwardRef(
474
2421
  });
475
2422
  CardImg.displayName = 'CardImg';
476
2423
 
477
- const CardImgOverlay = /*#__PURE__*/React__namespace.forwardRef(({
2424
+ const CardImgOverlay = /*#__PURE__*/React3__namespace.forwardRef(({
478
2425
  className,
479
2426
  bsPrefix,
480
2427
  as: Component = 'div',
@@ -489,7 +2436,7 @@ const CardImgOverlay = /*#__PURE__*/React__namespace.forwardRef(({
489
2436
  });
490
2437
  CardImgOverlay.displayName = 'CardImgOverlay';
491
2438
 
492
- const CardLink = /*#__PURE__*/React__namespace.forwardRef(({
2439
+ const CardLink = /*#__PURE__*/React3__namespace.forwardRef(({
493
2440
  className,
494
2441
  bsPrefix,
495
2442
  as: Component = 'a',
@@ -507,14 +2454,14 @@ CardLink.displayName = 'CardLink';
507
2454
  var divWithClassName = (className =>
508
2455
  /*#__PURE__*/
509
2456
  // eslint-disable-next-line react/display-name
510
- React__namespace.forwardRef((p, ref) => /*#__PURE__*/jsxRuntime.jsx("div", {
2457
+ React3__namespace.forwardRef((p, ref) => /*#__PURE__*/jsxRuntime.jsx("div", {
511
2458
  ...p,
512
2459
  ref: ref,
513
2460
  className: classNames(p.className, className)
514
2461
  })));
515
2462
 
516
2463
  const DivStyledAsH6 = divWithClassName('h6');
517
- const CardSubtitle = /*#__PURE__*/React__namespace.forwardRef(({
2464
+ const CardSubtitle = /*#__PURE__*/React3__namespace.forwardRef(({
518
2465
  className,
519
2466
  bsPrefix,
520
2467
  as: Component = DivStyledAsH6,
@@ -529,7 +2476,7 @@ const CardSubtitle = /*#__PURE__*/React__namespace.forwardRef(({
529
2476
  });
530
2477
  CardSubtitle.displayName = 'CardSubtitle';
531
2478
 
532
- const CardText = /*#__PURE__*/React__namespace.forwardRef(({
2479
+ const CardText = /*#__PURE__*/React3__namespace.forwardRef(({
533
2480
  className,
534
2481
  bsPrefix,
535
2482
  as: Component = 'p',
@@ -545,7 +2492,7 @@ const CardText = /*#__PURE__*/React__namespace.forwardRef(({
545
2492
  CardText.displayName = 'CardText';
546
2493
 
547
2494
  const DivStyledAsH5 = divWithClassName('h5');
548
- const CardTitle = /*#__PURE__*/React__namespace.forwardRef(({
2495
+ const CardTitle = /*#__PURE__*/React3__namespace.forwardRef(({
549
2496
  className,
550
2497
  bsPrefix,
551
2498
  as: Component = DivStyledAsH5,
@@ -560,7 +2507,7 @@ const CardTitle = /*#__PURE__*/React__namespace.forwardRef(({
560
2507
  });
561
2508
  CardTitle.displayName = 'CardTitle';
562
2509
 
563
- const Card = /*#__PURE__*/React__namespace.forwardRef(({
2510
+ const Card = /*#__PURE__*/React3__namespace.forwardRef(({
564
2511
  bsPrefix,
565
2512
  className,
566
2513
  bg,
@@ -595,9 +2542,19 @@ var Card$1 = Object.assign(Card, {
595
2542
  ImgOverlay: CardImgOverlay
596
2543
  });
597
2544
 
2545
+ // The default colours come from the SCSS via govuk-functional-colour(), which
2546
+ // resolves the govuk-frontend CSS custom properties (--govuk-colour-brand,
2547
+ // --govuk-colour-header-background). We only need to set inline CSS variables
2548
+ // here when the consumer explicitly overrides them via props.
598
2549
  const CardColumn = (props) => {
599
- const { body, header, link } = props;
600
- return (jsxRuntime.jsx("div", { className: "col", children: jsxRuntime.jsxs(Card$1, { className: "card-styles", children: [jsxRuntime.jsx(reactRouterDom.Link, { to: link, children: jsxRuntime.jsx(Card$1.Header, { className: "card-header govuk-!-font-size-27 govuk-!-font-weight-bold", children: header }) }), jsxRuntime.jsx(Card$1.Body, { className: "govuk-!-font-size-19", children: body })] }) }));
2550
+ const { body, header, link, textColor, hoverColor } = props;
2551
+ const inlineVars = textColor || hoverColor
2552
+ ? {
2553
+ ...(textColor && { "--card-text-color": textColor }),
2554
+ ...(hoverColor && { "--card-hover-color": hoverColor }),
2555
+ }
2556
+ : undefined;
2557
+ return (jsxRuntime.jsx("div", { className: "col", children: jsxRuntime.jsxs(Card$1, { className: "card-styles", style: inlineVars, children: [jsxRuntime.jsx(Link, { to: link, children: jsxRuntime.jsx(Card$1.Header, { className: "card-header govuk-!-font-size-27 govuk-!-font-weight-bold", children: header }) }), jsxRuntime.jsx(Card$1.Body, { className: "govuk-!-font-size-19", children: body })] }) }));
601
2558
  };
602
2559
 
603
2560
  const CardLayout = (props) => {
@@ -605,7 +2562,7 @@ const CardLayout = (props) => {
605
2562
  const divideByColumn = [];
606
2563
  let accumulator = [];
607
2564
  children.map((child, index) => {
608
- accumulator.push(React.createElement(CardColumn, { ...child, key: `card-column-${index}` }));
2565
+ accumulator.push(React3.createElement(CardColumn, { ...child, key: `card-column-${index}` }));
609
2566
  if (index % numberOfGridColumns === numberOfGridColumns - 1) {
610
2567
  divideByColumn.push(jsxRuntime.jsx("div", { className: `row row-cols-1 row-cols-md-${numberOfGridColumns} govuk-!-margin-bottom-8`, children: accumulator }, `card-layout-${index}`));
611
2568
  accumulator = [];
@@ -623,7 +2580,7 @@ const defaultProps$1 = {
623
2580
  id: "",
624
2581
  name: "",
625
2582
  };
626
- const Textarea = React.forwardRef((props = defaultProps$1, ref) => {
2583
+ const Textarea = React3.forwardRef((props = defaultProps$1, ref) => {
627
2584
  const { className, "aria-describedby": describedBy, errorMessage, formGroup, hint, label, id, ...attributes } = props;
628
2585
  let describedByValue = describedBy || "";
629
2586
  let hintComponent = null;
@@ -664,16 +2621,34 @@ const CookieActions = ({ actions }) => (jsxRuntime.jsx("div", { className: "govu
664
2621
  const CookieMessage = ({ headingChildren, children, className, actions, }) => (jsxRuntime.jsxs("div", { className: `govuk-cookie-banner__message govuk-width-container ${className || ""}`, children: [jsxRuntime.jsx("div", { className: "govuk-grid-row", children: jsxRuntime.jsxs("div", { className: "govuk-grid-column-two-thirds", children: [headingChildren && (jsxRuntime.jsx("h2", { className: "govuk-cookie-banner__heading govuk-heading-m", children: headingChildren })), jsxRuntime.jsx("div", { className: "govuk-cookie-banner__content", children: typeof children === "string" ? (jsxRuntime.jsx("p", { className: "govuk-body", children: children })) : (children) })] }) }), actions && jsxRuntime.jsx(CookieActions, { actions: actions })] }));
665
2622
  const CookieBanner = ({ className, messages, "aria-label": ariaLabel = "Cookie banner", ...attributes }) => (jsxRuntime.jsx("div", { className: `govuk-cookie-banner ${className || ""}`, "data-nosnippet": true, role: "region", "aria-label": ariaLabel, ...attributes, children: messages.map((message, index) => (jsxRuntime.jsx(CookieMessage, { headingChildren: message.headingChildren, className: message.className, actions: message.actions, ...message, children: message.children }, index))) }));
666
2623
 
667
- const DataNavigation = ({ dataId, setDataFocus, previousText = "Previous", previousCondition, nextText = "Next", nextCondition, dataDescription, }) => {
668
- // Helper to render the navigation buttons
669
- const renderNavButton = (id, onClick, disabled, content) => (jsxRuntime.jsx(Button, { id: id, onClick: onClick, "data-testid": id, disabled: disabled, children: content }));
2624
+ const DataNavigation = ({ dataId, setDataFocus, previousText = "Previous", previousCondition, nextText = "Next", nextCondition, dataDescription, buttonColour, buttonTextColour, buttonShadowColour, buttonHoverColour, buttonHoverTextColour, }) => {
2625
+ // CSS custom properties set directly on each <button> element via Button's
2626
+ // ...attributes spread, so they sit on the same element that
2627
+ // .app-data-navigation-button targets — no inheritance from a parent div needed.
2628
+ const inlineVars = {
2629
+ ...(buttonColour && { "--data-nav-button-colour": buttonColour }),
2630
+ ...(buttonTextColour && {
2631
+ "--data-nav-button-text-colour": buttonTextColour,
2632
+ }),
2633
+ ...(buttonShadowColour && {
2634
+ "--data-nav-button-shadow-colour": buttonShadowColour,
2635
+ }),
2636
+ ...(buttonHoverColour && {
2637
+ "--data-nav-button-hover-colour": buttonHoverColour,
2638
+ }),
2639
+ ...(buttonHoverTextColour && {
2640
+ "--data-nav-button-hover-text-colour": buttonHoverTextColour,
2641
+ }),
2642
+ };
2643
+ const hasInlineVars = Object.keys(inlineVars).length > 0;
2644
+ const renderNavButton = (id, onClick, disabled, content) => (jsxRuntime.jsx(Button, { id: id, onClick: onClick, "data-testid": id, disabled: disabled, className: "app-data-navigation-button", ...(hasInlineVars && { style: inlineVars }), children: content }));
670
2645
  return (jsxRuntime.jsxs("div", { className: "govuk-grid-row", children: [jsxRuntime.jsx("div", { className: "govuk-grid-column-one-third govuk-!-text-align-left", children: renderNavButton("previous-data", () => setDataFocus(dataId - 1), previousCondition, jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("svg", { className: "govuk-button__start-icon back-button", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", transform: "rotate(180)", children: jsxRuntime.jsx("path", { fill: "currentColor", d: "M8.122 24l-4.122-4 8-8-8-8 4.122-4 11.878 12z" }) }), "\u00A0", previousText] })) }), jsxRuntime.jsx("div", { className: "govuk-grid-column-one-third govuk-!-text-align-centre", children: jsxRuntime.jsx(Label, { children: dataDescription }) }), jsxRuntime.jsx("div", { className: "govuk-grid-column-one-third govuk-!-text-align-right", children: renderNavButton("next-data", () => setDataFocus(dataId + 1), nextCondition, jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [nextText, jsxRuntime.jsx("svg", { className: "govuk-button__start-icon", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", children: jsxRuntime.jsx("path", { fill: "currentColor", d: "M8.122 24l-4.122-4 8-8-8-8 4.122-4 11.878 12z" }) })] })) })] }));
671
2646
  };
672
2647
 
673
2648
  const defaultProps = {
674
2649
  type: "text",
675
2650
  };
676
- const Input = React.forwardRef((props = defaultProps, ref) => {
2651
+ const Input = React3.forwardRef((props = defaultProps, ref) => {
677
2652
  const { className, "aria-describedby": describedBy, errorMessage, formGroup, hint, label, name, id, prefix, suffix, ...attributes } = props;
678
2653
  let describedByValue = describedBy || "";
679
2654
  let hintComponent = null;
@@ -761,20 +2736,40 @@ function titleCase(str) {
761
2736
  .join(" ");
762
2737
  }
763
2738
 
764
- const DifferenceNavigation = ({ differenceId, setDifferenceFocus, totalDifferences, keyword = "variation", plural = "variations", }) => {
2739
+ const DifferenceNavigation = ({ differenceId, setDifferenceFocus, totalDifferences, keyword = "variation", plural = "variations", buttonColour, buttonTextColour, buttonShadowColour, buttonHoverColour, buttonHoverTextColour, }) => {
765
2740
  if (totalDifferences === 0) {
766
2741
  return (jsxRuntime.jsxs("p", { className: "govuk-body govuk-!-font-size-20 govuk-!-text-align-centre", children: ["No ", `${plural}`, " found"] }));
767
2742
  }
2743
+ // CSS custom properties set directly on each <button> element via Button's
2744
+ // ...attributes spread, so they sit on the same element that
2745
+ // .app-difference-navigation-button targets — no inheritance from a parent
2746
+ // div needed. Only written when a prop is explicitly provided.
2747
+ const inlineVars = {
2748
+ ...(buttonColour && { "--diff-nav-button-colour": buttonColour }),
2749
+ ...(buttonTextColour && {
2750
+ "--diff-nav-button-text-colour": buttonTextColour,
2751
+ }),
2752
+ ...(buttonShadowColour && {
2753
+ "--diff-nav-button-shadow-colour": buttonShadowColour,
2754
+ }),
2755
+ ...(buttonHoverColour && {
2756
+ "--diff-nav-button-hover-colour": buttonHoverColour,
2757
+ }),
2758
+ ...(buttonHoverTextColour && {
2759
+ "--diff-nav-button-hover-text-colour": buttonHoverTextColour,
2760
+ }),
2761
+ };
2762
+ const hasInlineVars = Object.keys(inlineVars).length > 0;
768
2763
  const isPreviousDisabled = differenceId <= 1;
769
2764
  const isNextDisabled = differenceId === totalDifferences;
770
- const renderButton = (id, onClick, disabled, content) => (jsxRuntime.jsx(Button, { id: id, onClick: onClick, "data-testid": id, disabled: disabled, children: content }));
2765
+ const renderButton = (id, onClick, disabled, content) => (jsxRuntime.jsx(Button, { id: id, onClick: onClick, "data-testid": id, disabled: disabled, className: "app-difference-navigation-button", ...(hasInlineVars && { style: inlineVars }), children: content }));
771
2766
  return (jsxRuntime.jsxs("div", { className: "govuk-grid-row", children: [jsxRuntime.jsx("div", { className: "govuk-grid-column-one-third", children: jsxRuntime.jsx("div", { className: "govuk-!-text-align-left", children: renderButton(`previous-${keyword}`, () => setDifferenceFocus(differenceId - 1), isPreviousDisabled, jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [" ", jsxRuntime.jsx("svg", { className: "govuk-button__start-icon back-button", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", transform: "rotate(180)", children: jsxRuntime.jsx("path", { fill: "currentColor", d: "M8.122 24l-4.122-4 8-8-8-8 4.122-4 11.878 12z" }) }), "\u00A0Previous", " "] })) }) }), jsxRuntime.jsx("div", { className: "govuk-grid-column-one-third", children: jsxRuntime.jsxs(Label, { className: "govuk-!-text-align-centre", children: [titleCase(keyword), " ", differenceId, " of ", totalDifferences] }) }), jsxRuntime.jsx("div", { className: "govuk-grid-column-one-third", children: jsxRuntime.jsx("div", { className: "govuk-!-text-align-right", children: renderButton(`next-${keyword}`, () => setDifferenceFocus(differenceId + 1), isNextDisabled, jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [" ", "Next", jsxRuntime.jsx("svg", { className: "govuk-button__start-icon back-button", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", children: jsxRuntime.jsx("path", { fill: "currentColor", d: "M8.122 24l-4.122-4 8-8-8-8 4.122-4 11.878 12z" }) })] })) }) })] }));
772
2767
  };
773
2768
 
774
2769
  const Main = ({ children, backLink = "", backLinkState = null, }) => (jsxRuntime.jsx("div", { className: "govuk-width-container", children: jsxRuntime.jsxs("main", { className: "govuk-main-wrapper", id: "main-content", "data-testid": "main-content", children: [backLink && (jsxRuntime.jsx("div", { className: "govuk-grid-row", children: jsxRuntime.jsx("div", { className: "govuk-grid-column-two-thirds", children: jsxRuntime.jsx(BackLink, { to: { pathname: backLink }, state: backLinkState }) }) })), children && jsxRuntime.jsx("div", { children: children })] }) }));
775
2770
 
776
2771
  const ProblemWithService = ({ message = "", applicationName = "Document and plan retrieval system", applicationRoute = "/", reportingLink = "http://marval-live/MSMselfservice/AutoGen.aspx?page=1268", basePageName = "dashboard", }) => {
777
- const { state } = reactRouterDom.useLocation();
2772
+ const { state } = useLocation();
778
2773
  const determineMessage = state?.message || message;
779
2774
  const determineApplicationName = state?.applicationName || applicationName;
780
2775
  const refreshPage = () => {
@@ -785,7 +2780,7 @@ const ProblemWithService = ({ message = "", applicationName = "Document and plan
785
2780
  return (jsxRuntime.jsxs(Main, { children: [jsxRuntime.jsx("h1", { className: "govuk-heading-xl", children: "Sorry, there is a problem with the service" }), hasMessage() && (jsxRuntime.jsx("div", { className: "govuk-error-summary", "aria-labelledby": "error-summary-title", role: "alert", tabIndex: -1, "data-module": "govuk-error-summary", children: jsxRuntime.jsx("div", { className: "govuk-error-summary__body", children: jsxRuntime.jsx("p", { children: determineMessage }) }) })), jsxRuntime.jsx("p", { className: "govuk-body", children: "Try again later." }), jsxRuntime.jsxs("p", { className: "govuk-body", children: ["You can go back to", " ", jsxRuntime.jsx(LinkWithRef, { className: "govuk-link", to: applicationRoute, onClick: refreshPage, children: determineApplicationName }), " ", basePageName, "."] }), jsxRuntime.jsxs("p", { className: "govuk-body", children: ["If the problem continues\u00A0", jsxRuntime.jsxs("a", { href: reportingLink, className: "govuk-link", target: "_blank", rel: "noreferrer", children: ["contact support", jsxRuntime.jsx("span", { className: "nav-panel__text opens-in-new-window" }), jsxRuntime.jsx("span", { className: "visually-hidden", children: "(Opens in a new window or tab)" })] }), "."] })] }));
786
2781
  };
787
2782
 
788
- class ErrorBoundary extends React.Component {
2783
+ class ErrorBoundary extends React3.Component {
789
2784
  constructor(props) {
790
2785
  super(props);
791
2786
  this.state = {
@@ -869,70 +2864,70 @@ const FileUpload = (props) => {
869
2864
  FileUpload.displayName = "FileUpload";
870
2865
 
871
2866
  const Footer = (props) => {
872
- const { className, containerClassName, meta, navigation, ...attributes } = props;
2867
+ const { className, containerClassName, meta, navigation, contentLicence, ...attributes } = props;
873
2868
  let navigationComponent;
874
2869
  let metaComponent;
2870
+ let contentLicenceComponent;
875
2871
  if (navigation && navigation.length > 0) {
876
2872
  navigationComponent = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: "govuk-footer__navigation", children: navigation.map((nav, navIndex) => (jsxRuntime.jsxs("div", { className: `govuk-footer__section govuk-grid-column-${nav.width ? nav.width : "full"}`, children: [jsxRuntime.jsx("h2", { className: "govuk-footer__heading govuk-heading-m", children: nav.title }), nav.items && nav.items.length > 0 ? (jsxRuntime.jsx("ul", { className: `govuk-footer__list ${nav.columns ? `govuk-footer__list--columns-${nav.columns}` : ""}`, children: nav.items.map((item, index) => {
877
2873
  const { className: itemClassName, children: itemChildren, reactListKey, ...itemAttributes } = item;
878
- return (jsxRuntime.jsx(React.Fragment, { children: (item.href || item.to) && itemChildren && (jsxRuntime.jsx("li", { className: "govuk-footer__list-item", children: jsxRuntime.jsx(LinkWithRef, { className: `govuk-footer__link ${itemClassName || ""}`, ...itemAttributes, children: itemChildren }) })) }, reactListKey || index));
2874
+ return (jsxRuntime.jsx(React3.Fragment, { children: (item.href || item.to) && itemChildren && (jsxRuntime.jsx("li", { className: "govuk-footer__list-item", children: jsxRuntime.jsx(LinkWithRef, { className: `govuk-footer__link ${itemClassName || ""}`, ...itemAttributes, children: itemChildren }) })) }, reactListKey || index));
879
2875
  }) })) : null] }, nav.reactListKey || navIndex))) }), jsxRuntime.jsx("hr", { className: "govuk-footer__section-break" })] }));
880
2876
  }
881
2877
  if (meta) {
882
2878
  metaComponent = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("h2", { className: "govuk-visually-hidden", children: meta.visuallyHiddenTitle
883
2879
  ? meta.visuallyHiddenTitle
884
- : "Support links" }), meta.items && meta.items.length > 0 ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx("ul", { className: "govuk-footer__inline-list", children: meta.items.map((item, index) => {
885
- const { className: itemClassName, children: itemChildren, reactListKey, ...itemAttributes } = item;
886
- return (jsxRuntime.jsx("li", { className: "govuk-footer__inline-list-item", children: jsxRuntime.jsx(LinkWithRef, { className: `govuk-footer__link ${itemClassName || ""}`, ...itemAttributes, children: itemChildren }) }, reactListKey || index));
887
- }) }) })) : null, meta.children ? (jsxRuntime.jsx("div", { className: "govuk-footer__meta-custom", children: meta.children })) : null] }));
2880
+ : "Support links" }), meta.items && meta.items.length > 0 ? (jsxRuntime.jsx("ul", { className: "govuk-footer__inline-list", children: meta.items.map((item, index) => {
2881
+ const { className: itemClassName, children: itemChildren, reactListKey, ...itemAttributes } = item;
2882
+ return (jsxRuntime.jsx("li", { className: "govuk-footer__inline-list-item", children: jsxRuntime.jsx(LinkWithRef, { className: `govuk-footer__link ${itemClassName || ""}`, ...itemAttributes, children: itemChildren }) }, reactListKey || index));
2883
+ }) })) : null, meta.children ? (jsxRuntime.jsx("div", { className: "govuk-footer__meta-custom", children: meta.children })) : null] }));
2884
+ }
2885
+ if (contentLicence) {
2886
+ const { className: contentLicenceClassName, children: contentLicenceChildren, ...contentLicenceAttributes } = contentLicence;
2887
+ contentLicenceComponent = (jsxRuntime.jsx("div", { className: contentLicenceClassName, ...contentLicenceAttributes, children: contentLicenceChildren }));
2888
+ }
2889
+ else if (contentLicence === undefined) {
2890
+ contentLicenceComponent = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("svg", { "aria-hidden": "true", focusable: "false", className: "govuk-footer__licence-logo", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 483.2 195.7", height: "17", width: "41", children: jsxRuntime.jsx("path", { fill: "currentColor", d: "M421.5 142.8V.1l-50.7 32.3v161.1h112.4v-50.7zm-122.3-9.6A47.12 47.12 0 0 1 221 97.8c0-26 21.1-47.1 47.1-47.1 16.7 0 31.4 8.7 39.7 21.8l42.7-27.2A97.63 97.63 0 0 0 268.1 0c-36.5 0-68.3 20.1-85.1 49.7A98 98 0 0 0 97.8 0C43.9 0 0 43.9 0 97.8s43.9 97.8 97.8 97.8c36.5 0 68.3-20.1 85.1-49.7a97.76 97.76 0 0 0 149.6 25.4l19.4 22.2h3v-87.8h-80l24.3 27.5zM97.8 145c-26 0-47.1-21.1-47.1-47.1s21.1-47.1 47.1-47.1 47.2 21 47.2 47S123.8 145 97.8 145" }) }), jsxRuntime.jsxs("span", { className: "govuk-footer__licence-description", children: ["All content is available under the", jsxRuntime.jsx("a", { className: "govuk-footer__link", href: "https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/", rel: "license", children: "Open Government Licence v3.0" }), ", except where otherwise stated"] })] }));
888
2891
  }
889
- return (jsxRuntime.jsx("footer", { className: `govuk-footer ${className || ""}`, role: "contentinfo", ...attributes, children: jsxRuntime.jsxs("div", { className: `govuk-width-container ${containerClassName || ""}`, children: [navigationComponent, jsxRuntime.jsxs("div", { className: "govuk-footer__meta", children: [jsxRuntime.jsxs("div", { className: "govuk-footer__meta-item govuk-footer__meta-item--grow", children: [metaComponent, jsxRuntime.jsx("svg", { "aria-hidden": "true", focusable: "false", className: "govuk-footer__licence-logo", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 483.2 195.7", height: "17", width: "41", children: jsxRuntime.jsx("path", { fill: "currentColor", d: "M421.5 142.8V.1l-50.7 32.3v161.1h112.4v-50.7zm-122.3-9.6A47.12 47.12 0 0 1 221 97.8c0-26 21.1-47.1 47.1-47.1 16.7 0 31.4 8.7 39.7 21.8l42.7-27.2A97.63 97.63 0 0 0 268.1 0c-36.5 0-68.3 20.1-85.1 49.7A98 98 0 0 0 97.8 0C43.9 0 0 43.9 0 97.8s43.9 97.8 97.8 97.8c36.5 0 68.3-20.1 85.1-49.7a97.76 97.76 0 0 0 149.6 25.4l19.4 22.2h3v-87.8h-80l24.3 27.5zM97.8 145c-26 0-47.1-21.1-47.1-47.1s21.1-47.1 47.1-47.1 47.2 21 47.2 47S123.8 145 97.8 145" }) }), jsxRuntime.jsxs("span", { className: "govuk-footer__licence-description", children: ["All content is available under the", " ", jsxRuntime.jsx("a", { className: "govuk-footer__link", href: "https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/", rel: "license", children: "Open Government Licence v3.0" }), ", except where otherwise stated"] })] }), jsxRuntime.jsx("div", { className: "govuk-footer__meta-item", children: jsxRuntime.jsx("a", { className: "govuk-footer__link govuk-footer__copyright-logo", href: "https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/", children: "\u00A9 Crown copyright" }) })] })] }) }));
2892
+ else {
2893
+ contentLicenceComponent = jsxRuntime.jsx(jsxRuntime.Fragment, {});
2894
+ }
2895
+ return (jsxRuntime.jsx("footer", { className: `govuk-footer ${className || ""}`, role: "contentinfo", ...attributes, children: jsxRuntime.jsxs("div", { className: `govuk-width-container ${containerClassName || ""}`, children: [jsxRuntime.jsx("svg", { focusable: "false", role: "presentation", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 64 60", height: "30", width: "32", fill: "currentcolor", className: "govuk-footer__crown", children: jsxRuntime.jsxs("g", { children: [jsxRuntime.jsx("circle", { cx: "20", cy: "17.6", r: "3.7" }), jsxRuntime.jsx("circle", { cx: "10.2", cy: "23.5", r: "3.7" }), jsxRuntime.jsx("circle", { cx: "3.7", cy: "33.2", r: "3.7" }), jsxRuntime.jsx("circle", { cx: "31.7", cy: "30.6", r: "3.7" }), jsxRuntime.jsx("circle", { cx: "43.3", cy: "17.6", r: "3.7" }), jsxRuntime.jsx("circle", { cx: "53.2", cy: "23.5", r: "3.7" }), jsxRuntime.jsx("circle", { cx: "59.7", cy: "33.2", r: "3.7" }), jsxRuntime.jsx("circle", { cx: "31.7", cy: "30.6", r: "3.7" }), jsxRuntime.jsx("path", { d: "M33.1,9.8c.2-.1.3-.3.5-.5l4.6,2.4v-6.8l-4.6,1.5c-.1-.2-.3-.3-.5-.5l1.9-5.9h-6.7l1.9,5.9c-.2.1-.3.3-.5.5l-4.6-1.5v6.8l4.6-2.4c.1.2.3.3.5.5l-2.6,8c-.9,2.8,1.2,5.7,4.1,5.7h0c3,0,5.1-2.9,4.1-5.7l-2.6-8ZM37,37.9s-3.4,3.8-4.1,6.1c2.2,0,4.2-.5,6.4-2.8l-.7,8.5c-2-2.8-4.4-4.1-5.7-3.8.1,3.1.5,6.7,5.8,7.2,3.7.3,6.7-1.5,7-3.8.4-2.6-2-4.3-3.7-1.6-1.4-4.5,2.4-6.1,4.9-3.2-1.9-4.5-1.8-7.7,2.4-10.9,3,4,2.6,7.3-1.2,11.1,2.4-1.3,6.2,0,4,4.6-1.2-2.8-3.7-2.2-4.2.2-.3,1.7.7,3.7,3,4.2,1.9.3,4.7-.9,7-5.9-1.3,0-2.4.7-3.9,1.7l2.4-8c.6,2.3,1.4,3.7,2.2,4.5.6-1.6.5-2.8,0-5.3l5,1.8c-2.6,3.6-5.2,8.7-7.3,17.5-7.4-1.1-15.7-1.7-24.5-1.7h0c-8.8,0-17.1.6-24.5,1.7-2.1-8.9-4.7-13.9-7.3-17.5l5-1.8c-.5,2.5-.6,3.7,0,5.3.8-.8,1.6-2.3,2.2-4.5l2.4,8c-1.5-1-2.6-1.7-3.9-1.7,2.3,5,5.2,6.2,7,5.9,2.3-.4,3.3-2.4,3-4.2-.5-2.4-3-3.1-4.2-.2-2.2-4.6,1.6-6,4-4.6-3.7-3.7-4.2-7.1-1.2-11.1,4.2,3.2,4.3,6.4,2.4,10.9,2.5-2.8,6.3-1.3,4.9,3.2-1.8-2.7-4.1-1-3.7,1.6.3,2.3,3.3,4.1,7,3.8,5.4-.5,5.7-4.2,5.8-7.2-1.3-.2-3.7,1-5.7,3.8l-.7-8.5c2.2,2.3,4.2,2.7,6.4,2.8-.7-2.3-4.1-6.1-4.1-6.1h10.6,0Z" })] }) }), navigationComponent, jsxRuntime.jsxs("div", { className: "govuk-footer__meta", children: [jsxRuntime.jsxs("div", { className: "govuk-footer__meta-item govuk-footer__meta-item--grow", children: [metaComponent, contentLicenceComponent] }), jsxRuntime.jsx("div", { className: "govuk-footer__meta-item", children: jsxRuntime.jsx("a", { className: "govuk-footer__link govuk-footer__copyright-logo", href: "https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/", children: "\u00A9 Crown copyright" }) })] })] }) }));
890
2896
  };
891
2897
 
2898
+ // Tudor Crown SVG — govuk-frontend v5+ (replaces old St. Edward's Crown)
2899
+ const GovUKLogotype = () => (jsxRuntime.jsxs("svg", { focusable: "false", role: "img", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 324 60", height: "30", width: "162", fill: "currentcolor", className: "govuk-header__logotype", "aria-label": "GOV.UK", children: [jsxRuntime.jsx("title", { children: "GOV.UK" }), jsxRuntime.jsxs("g", { children: [jsxRuntime.jsx("circle", { cx: "20", cy: "17.6", r: "3.7" }), jsxRuntime.jsx("circle", { cx: "10.2", cy: "23.5", r: "3.7" }), jsxRuntime.jsx("circle", { cx: "3.7", cy: "33.2", r: "3.7" }), jsxRuntime.jsx("circle", { cx: "31.7", cy: "30.6", r: "3.7" }), jsxRuntime.jsx("circle", { cx: "43.3", cy: "17.6", r: "3.7" }), jsxRuntime.jsx("circle", { cx: "53.2", cy: "23.5", r: "3.7" }), jsxRuntime.jsx("circle", { cx: "59.7", cy: "33.2", r: "3.7" }), jsxRuntime.jsx("circle", { cx: "31.7", cy: "30.6", r: "3.7" }), jsxRuntime.jsx("path", { d: "M33.1,9.8c.2-.1.3-.3.5-.5l4.6,2.4v-6.8l-4.6,1.5c-.1-.2-.3-.3-.5-.5l1.9-5.9h-6.7l1.9,5.9c-.2.1-.3.3-.5.5l-4.6-1.5v6.8l4.6-2.4c.1.2.3.3.5.5l-2.6,8c-.9,2.8,1.2,5.7,4.1,5.7h0c3,0,5.1-2.9,4.1-5.7l-2.6-8ZM37,37.9s-3.4,3.8-4.1,6.1c2.2,0,4.2-.5,6.4-2.8l-.7,8.5c-2-2.8-4.4-4.1-5.7-3.8.1,3.1.5,6.7,5.8,7.2,3.7.3,6.7-1.5,7-3.8.4-2.6-2-4.3-3.7-1.6-1.4-4.5,2.4-6.1,4.9-3.2-1.9-4.5-1.8-7.7,2.4-10.9,3,4,2.6,7.3-1.2,11.1,2.4-1.3,6.2,0,4,4.6-1.2-2.8-3.7-2.2-4.2.2-.3,1.7.7,3.7,3,4.2,1.9.3,4.7-.9,7-5.9-1.3,0-2.4.7-3.9,1.7l2.4-8c.6,2.3,1.4,3.7,2.2,4.5.6-1.6.5-2.8,0-5.3l5,1.8c-2.6,3.6-5.2,8.7-7.3,17.5-7.4-1.1-15.7-1.7-24.5-1.7h0c-8.8,0-17.1.6-24.5,1.7-2.1-8.9-4.7-13.9-7.3-17.5l5-1.8c-.5,2.5-.6,3.7,0,5.3.8-.8,1.6-2.3,2.2-4.5l2.4,8c-1.5-1-2.6-1.7-3.9-1.7,2.3,5,5.2,6.2,7,5.9,2.3-.4,3.3-2.4,3-4.2-.5-2.4-3-3.1-4.2-.2-2.2-4.6,1.6-6,4-4.6-3.7-3.7-4.2-7.1-1.2-11.1,4.2,3.2,4.3,6.4,2.4,10.9,2.5-2.8,6.3-1.3,4.9,3.2-1.8-2.7-4.1-1-3.7,1.6.3,2.3,3.3,4.1,7,3.8,5.4-.5,5.7-4.2,5.8-7.2-1.3-.2-3.7,1-5.7,3.8l-.7-8.5c2.2,2.3,4.2,2.7,6.4,2.8-.7-2.3-4.1-6.1-4.1-6.1h10.6,0Z" })] }), jsxRuntime.jsx("circle", { className: "govuk-logo-dot", cx: "226", cy: "36", r: "7.3" }), jsxRuntime.jsx("path", { d: "M93.94 41.25c.4 1.81 1.2 3.21 2.21 4.62 1 1.4 2.21 2.41 3.61 3.21s3.21 1.2 5.22 1.2 3.61-.4 4.82-1c1.4-.6 2.41-1.4 3.21-2.41.8-1 1.4-2.01 1.61-3.01s.4-2.01.4-3.01v.14h-10.86v-7.02h20.07v24.08h-8.03v-5.56c-.6.8-1.38 1.61-2.19 2.41-.8.8-1.81 1.2-2.81 1.81-1 .4-2.21.8-3.41 1.2s-2.41.4-3.81.4a18.56 18.56 0 0 1-14.65-6.63c-1.6-2.01-3.01-4.41-3.81-7.02s-1.4-5.62-1.4-8.83.4-6.02 1.4-8.83a20.45 20.45 0 0 1 19.46-13.65c3.21 0 4.01.2 5.82.8 1.81.4 3.61 1.2 5.02 2.01 1.61.8 2.81 2.01 4.01 3.21s2.21 2.61 2.81 4.21l-7.63 4.41c-.4-1-1-1.81-1.61-2.61-.6-.8-1.4-1.4-2.21-2.01-.8-.6-1.81-1-2.81-1.4-1-.4-2.21-.4-3.61-.4-2.01 0-3.81.4-5.22 1.2-1.4.8-2.61 1.81-3.61 3.21s-1.61 2.81-2.21 4.62c-.4 1.81-.6 3.71-.6 5.42s.8 5.22.8 5.22Zm57.8-27.9c3.21 0 6.22.6 8.63 1.81 2.41 1.2 4.82 2.81 6.62 4.82S170.2 24.39 171 27s1.4 5.62 1.4 8.83-.4 6.02-1.4 8.83-2.41 5.02-4.01 7.02-4.01 3.61-6.62 4.82-5.42 1.81-8.63 1.81-6.22-.6-8.63-1.81-4.82-2.81-6.42-4.82-3.21-4.41-4.01-7.02-1.4-5.62-1.4-8.83.4-6.02 1.4-8.83 2.41-5.02 4.01-7.02 4.01-3.61 6.42-4.82 5.42-1.81 8.63-1.81Zm0 36.73c1.81 0 3.61-.4 5.02-1s2.61-1.81 3.61-3.01 1.81-2.81 2.21-4.41c.4-1.81.8-3.61.8-5.62 0-2.21-.2-4.21-.8-6.02s-1.2-3.21-2.21-4.62c-1-1.2-2.21-2.21-3.61-3.01s-3.21-1-5.02-1-3.61.4-5.02 1c-1.4.8-2.61 1.81-3.61 3.01s-1.81 2.81-2.21 4.62c-.4 1.81-.8 3.61-.8 5.62 0 2.41.2 4.21.8 6.02.4 1.81 1.2 3.21 2.21 4.41s2.21 2.21 3.61 3.01c1.4.8 3.21 1 5.02 1Zm36.32 7.96-12.24-44.15h9.83l8.43 32.77h.4l8.23-32.77h9.83L200.3 58.04h-12.24Zm74.14-7.96c2.18 0 3.51-.6 3.51-.6 1.2-.6 2.01-1 2.81-1.81s1.4-1.81 1.81-2.81a13 13 0 0 0 .8-4.01V13.9h8.63v28.15c0 2.41-.4 4.62-1.4 6.62-.8 2.01-2.21 3.61-3.61 5.02s-3.41 2.41-5.62 3.21-4.62 1.2-7.02 1.2-5.02-.4-7.02-1.2c-2.21-.8-4.01-1.81-5.62-3.21s-2.81-3.01-3.61-5.02-1.4-4.21-1.4-6.62V13.9h8.63v26.95c0 1.61.2 3.01.8 4.01.4 1.2 1.2 2.21 2.01 2.81.8.8 1.81 1.4 2.81 1.81 0 0 1.34.6 3.51.6Zm34.22-36.18v18.92l15.65-18.92h10.82l-15.03 17.32 16.03 26.83h-10.21l-11.44-20.21-5.62 6.22v13.99h-8.83V13.9" })] }));
892
2900
  const Header = (props) => {
893
- const { className, containerClassName = "govuk-width-container", homepageUrlHref = "/", homepageUrlTo, navigation, navigationClassName, productName, serviceName, serviceUrlHref, serviceUrlTo, navigationLabel = "Menu", menuButtonLabel = "Show or hide menu", removeGovUKHeader = null, logo, ...attributes } = props;
2901
+ const { className, containerClassName = "govuk-width-container", homepageUrlHref = "/", homepageUrlTo, navigation, navigationClassName, productName, serviceName, serviceUrlHref, serviceUrlTo, navigationLabel = "Menu", menuButtonLabel = "Show or hide menu", removeGovUKHeader = null, ...attributes } = props;
894
2902
  let productNameComponent = null;
895
2903
  let navigationComponent = null;
896
2904
  if (productName) {
897
2905
  productNameComponent = (jsxRuntime.jsx("span", { className: "govuk-header__product-name", children: productName }));
898
2906
  }
899
2907
  if (serviceName || navigation) {
900
- navigationComponent = (jsxRuntime.jsxs("div", { className: "govuk-header__content", children: [serviceName ? (jsxRuntime.jsx(LinkWithRef, { href: serviceUrlHref, to: serviceUrlTo, className: "govuk-header__link govuk-header__link--service-name", children: serviceName })) : null, navigation ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("nav", { className: `govuk-header__navigation ${navigationClassName || ""}`, "aria-label": navigationLabel, children: [jsxRuntime.jsx("button", { type: "button", className: "govuk-header__menu-button govuk-js-header-toggle", "aria-controls": "navigation", "aria-label": menuButtonLabel, children: "Menu" }), jsxRuntime.jsx("ul", { id: "navigation", className: "govuk-header__navigation-list", children: navigation.map((item, index) => {
901
- const { active: itemActive, className: itemClassName, children: itemChildren, reactListKey, ...itemAttributes } = item;
902
- return itemChildren ? (jsxRuntime.jsx("li", { className: `govuk-header__navigation-item${itemActive
903
- ? " govuk-header__navigation-item--active"
904
- : ""}`, children: item.href || item.to ? (jsxRuntime.jsx(LinkWithRef, { className: `govuk-header__link ${itemClassName || ""}`, ...itemAttributes, children: itemChildren })) : (itemChildren) }, reactListKey || index)) : null;
905
- }) })] }) })) : null] }));
906
- }
907
- return (jsxRuntime.jsx("header", { className: `govuk-header ${className || ""}`, role: "banner", "data-module": "govuk-header", ...attributes, children: jsxRuntime.jsxs("div", { className: `govuk-header__container ${containerClassName}`, children: [jsxRuntime.jsx("div", { className: "govuk-header__logo", children: jsxRuntime.jsxs(LinkWithRef, { to: homepageUrlTo, href: homepageUrlHref, className: "govuk-header__link govuk-header__link--homepage", children: [!removeGovUKHeader && (jsxRuntime.jsx("span", { className: "govuk-header__logotype", dangerouslySetInnerHTML: {
908
- __html: `
909
- <!--[if gt IE 8]><!-->
910
- <svg
911
- aria-hidden="true"
912
- focusable="false"
913
- class="govuk-header__logotype-crown"
914
- xmlns="http://www.w3.org/2000/svg"
915
- viewBox="0 0 132 97"
916
- height="30"
917
- width="36"
918
- >
919
- <path
920
- fill="currentColor"
921
- fillRule="evenodd"
922
- d="M25 30.2c3.5 1.5 7.7-.2 9.1-3.7 1.5-3.6-.2-7.8-3.9-9.2-3.6-1.4-7.6.3-9.1 3.9-1.4 3.5.3 7.5 3.9 9zM9 39.5c3.6 1.5 7.8-.2 9.2-3.7 1.5-3.6-.2-7.8-3.9-9.1-3.6-1.5-7.6.2-9.1 3.8-1.4 3.5.3 7.5 3.8 9zM4.4 57.2c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.5-1.5-7.6.3-9.1 3.8-1.4 3.5.3 7.6 3.9 9.1zm38.3-21.4c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.6-1.5-7.6.3-9.1 3.8-1.3 3.6.4 7.7 3.9 9.1zm64.4-5.6c-3.6 1.5-7.8-.2-9.1-3.7-1.5-3.6.2-7.8 3.8-9.2 3.6-1.4 7.7.3 9.2 3.9 1.3 3.5-.4 7.5-3.9 9zm15.9 9.3c-3.6 1.5-7.7-.2-9.1-3.7-1.5-3.6.2-7.8 3.7-9.1 3.6-1.5 7.7.2 9.2 3.8 1.5 3.5-.3 7.5-3.8 9zm4.7 17.7c-3.6 1.5-7.8-.2-9.2-3.8-1.5-3.6.2-7.7 3.9-9.1 3.6-1.5 7.7.3 9.2 3.8 1.3 3.5-.4 7.6-3.9 9.1zM89.3 35.8c-3.6 1.5-7.8-.2-9.2-3.8-1.4-3.6.2-7.7 3.9-9.1 3.6-1.5 7.7.3 9.2 3.8 1.4 3.6-.3 7.7-3.9 9.1zM69.7 17.7l8.9 4.7V9.3l-8.9 2.8c-.2-.3-.5-.6-.9-.9L72.4 0H59.6l3.5 11.2c-.3.3-.6.5-.9.9l-8.8-2.8v13.1l8.8-4.7c.3.3.6.7.9.9l-5 15.4v.1c-.2.8-.4 1.6-.4 2.4 0 4.1 3.1 7.5 7 8.1h.2c.3 0 .7.1 1 .1.4 0 .7 0 1-.1h.2c4-.6 7.1-4.1 7.1-8.1 0-.8-.1-1.7-.4-2.4V34l-5.1-15.4c.4-.2.7-.6 1-.9zM66 92.8c16.9 0 32.8 1.1 47.1 3.2 4-16.9 8.9-26.7 14-33.5l-9.6-3.4c1 4.9 1.1 7.2 0 10.2-1.5-1.4-3-4.3-4.2-8.7L108.6 76c2.8-2 5-3.2 7.5-3.3-4.4 9.4-10 11.9-13.6 11.2-4.3-.8-6.3-4.6-5.6-7.9 1-4.7 5.7-5.9 8-.5 4.3-8.7-3-11.4-7.6-8.8 7.1-7.2 7.9-13.5 2.1-21.1-8 6.1-8.1 12.3-4.5 20.8-4.7-5.4-12.1-2.5-9.5 6.2 3.4-5.2 7.9-2 7.2 3.1-.6 4.3-6.4 7.8-13.5 7.2-10.3-.9-10.9-8-11.2-13.8 2.5-.5 7.1 1.8 11 7.3L80.2 60c-4.1 4.4-8 5.3-12.3 5.4 1.4-4.4 8-11.6 8-11.6H55.5s6.4 7.2 7.9 11.6c-4.2-.1-8-1-12.3-5.4l1.4 16.4c3.9-5.5 8.5-7.7 10.9-7.3-.3 5.8-.9 12.8-11.1 13.8-7.2.6-12.9-2.9-13.5-7.2-.7-5 3.8-8.3 7.1-3.1 2.7-8.7-4.6-11.6-9.4-6.2 3.7-8.5 3.6-14.7-4.6-20.8-5.8 7.6-5 13.9 2.2 21.1-4.7-2.6-11.9.1-7.7 8.8 2.3-5.5 7.1-4.2 8.1.5.7 3.3-1.3 7.1-5.7 7.9-3.5.7-9-1.8-13.5-11.2 2.5.1 4.7 1.3 7.5 3.3l-4.7-15.4c-1.2 4.4-2.7 7.2-4.3 8.7-1.1-3-.9-5.3 0-10.2l-9.5 3.4c5 6.9 9.9 16.7 14 33.5 14.8-2.1 30.8-3.2 47.7-3.2z"
923
- />
924
- </svg>
925
- <!--<![endif]-->
926
- <!--[if IE 8]>
927
- <img src="${logo}" class="govuk-header__logotype-crown-fallback-image" width="36" height="32" />
928
- <![endif]-->
929
- <span class="govuk-header__logotype-text">GOV.UK</span>
930
- `,
931
- } })), productNameComponent] }) }), navigationComponent] }) }));
2908
+ navigationComponent = (jsxRuntime.jsxs("div", { className: "govuk-header__content", children: [serviceName ? (jsxRuntime.jsx(LinkWithRef, { href: serviceUrlHref, to: serviceUrlTo, className: "govuk-header__link govuk-header__link--service-name", children: serviceName })) : null, navigation ? (jsxRuntime.jsxs("nav", { className: `govuk-header__navigation ${navigationClassName || ""}`, "aria-label": navigationLabel, children: [jsxRuntime.jsx("button", { type: "button", className: "govuk-header__menu-button govuk-js-header-toggle", "aria-controls": "navigation", "aria-label": menuButtonLabel, children: "Menu" }), jsxRuntime.jsx("ul", { id: "navigation", className: "govuk-header__navigation-list", children: navigation.map((item, index) => {
2909
+ const { active: itemActive, className: itemClassName, children: itemChildren, reactListKey, ...itemAttributes } = item;
2910
+ return itemChildren ? (jsxRuntime.jsx("li", { className: `govuk-header__navigation-item${itemActive ? " govuk-header__navigation-item--active" : ""}`, children: item.href || item.to ? (jsxRuntime.jsx(LinkWithRef, { className: `govuk-header__link ${itemClassName || ""}`, ...itemAttributes, children: itemChildren })) : (itemChildren) }, reactListKey || index)) : null;
2911
+ }) })] })) : null] }));
2912
+ }
2913
+ return (jsxRuntime.jsx("header", { className: `govuk-header ${className || ""}`, role: "banner", "data-module": "govuk-header", ...attributes, children: jsxRuntime.jsxs("div", { className: `govuk-header__container ${containerClassName}`, children: [jsxRuntime.jsx("div", { className: "govuk-header__logo", children: jsxRuntime.jsxs(LinkWithRef, { to: homepageUrlTo, href: homepageUrlHref, className: "govuk-header__homepage-link", children: [!removeGovUKHeader && jsxRuntime.jsx(GovUKLogotype, {}), productNameComponent] }) }), navigationComponent] }) }));
932
2914
  };
933
2915
 
934
- function ConfigureOverallHeader($scope) {
935
- govukFrontend.createAll(govukFrontend.Header, undefined, $scope);
2916
+ // src/components/Header/Header.config.tsx
2917
+ async function ConfigureOverallHeader($scope) {
2918
+ const govukFrontend = await import('govuk-frontend');
2919
+ if ("Header" in govukFrontend) {
2920
+ const { createAll } = govukFrontend;
2921
+ const { Header } = govukFrontend;
2922
+ createAll(Header, undefined, $scope);
2923
+ }
2924
+ else {
2925
+ if (process.env.NODE_ENV !== "production") {
2926
+ console.warn("ConfigureOverallHeader is a no-op in govuk-frontend v5+. " +
2927
+ "The Header menu toggle no longer requires JavaScript initialisation. " +
2928
+ "This call can be safely removed.");
2929
+ }
2930
+ }
936
2931
  }
937
2932
 
938
2933
  const InsetText = ({ className, children, ...attributes }) => {
@@ -941,7 +2936,7 @@ const InsetText = ({ className, children, ...attributes }) => {
941
2936
 
942
2937
  const Landing = (props) => {
943
2938
  const { to = "/" } = props;
944
- return (jsxRuntime.jsx(Main, { children: jsxRuntime.jsx("div", { className: "govuk-grid-row", children: jsxRuntime.jsx("div", { className: "govuk-hint govuk-grid-column-full", children: jsxRuntime.jsx("div", { className: "centered-wheel", children: jsxRuntime.jsx("h2", { className: "govuk-heading-m", children: jsxRuntime.jsx(reactRouterDom.Link, { to: to, children: "Single sign on" }) }) }) }) }) }));
2939
+ return (jsxRuntime.jsx(Main, { children: jsxRuntime.jsx("div", { className: "govuk-grid-row", children: jsxRuntime.jsx("div", { className: "govuk-hint govuk-grid-column-full", children: jsxRuntime.jsx("div", { className: "centered-wheel", children: jsxRuntime.jsx("h2", { className: "govuk-heading-m", children: jsxRuntime.jsx(Link, { to: to, children: "Single sign on" }) }) }) }) }) }));
945
2940
  };
946
2941
 
947
2942
  const Loading = ({ message = null, html = null }) => {
@@ -989,7 +2984,7 @@ const UsePagination = ({ totalCount, pageSize, siblingCount = 1, currentPage, })
989
2984
  const range = (start, end) => {
990
2985
  return Array.from({ length: end - start + 1 }, (_, idx) => idx + start);
991
2986
  };
992
- const paginationRange = React.useMemo(() => {
2987
+ const paginationRange = React3.useMemo(() => {
993
2988
  const totalPages = Math.ceil(totalCount / pageSize);
994
2989
  const visiblePages = siblingCount + 10;
995
2990
  // Case 1: Show all pages when total pages is less than the number of visible pages
@@ -1034,7 +3029,7 @@ const Panel = (props) => {
1034
3029
  return (jsxRuntime.jsxs("div", { className: `govuk-panel govuk-panel--confirmation ${className || ""}`, ...attributes, children: [jsxRuntime.jsx(HeadingLevel, { className: "govuk-panel__title", children: titleChildren }), innerHtml] }));
1035
3030
  };
1036
3031
 
1037
- const PasswordInput = React.forwardRef((props, ref) => {
3032
+ const PasswordInput = React3.forwardRef((props, ref) => {
1038
3033
  const { className, "aria-describedby": describedBy, errorMessage, formGroup, hint, label, name, id, autoComplete = "current-password", showPasswordText = "Show", hidePasswordText = "Hide", showPasswordAriaLabelText = "Show password", hidePasswordAriaLabelText = "Hide password", passwordShownAnnouncementText, passwordHiddenAnnouncementText, ...attributes } = props;
1039
3034
  let describedByValue = describedBy || "";
1040
3035
  let hintComponent = null;
@@ -1193,24 +3188,24 @@ const ResolvePDFSource = (source) => {
1193
3188
  };
1194
3189
 
1195
3190
  const PDFViewer = (props) => {
1196
- const viewerRef = React.useRef(null);
3191
+ const viewerRef = React3.useRef(null);
1197
3192
  const { iframeId, src, viewerLocation, documentName, documentNameColour, backend, toolbar = "minimal", additionalBackendAttributes,
1198
3193
  // optional: lets callers skip client-side fetch for remote resources
1199
3194
  disableClientFetch = false, ...attributes } = props;
1200
- const [loading, setLoading] = React.useState(false);
3195
+ const [loading, setLoading] = React3.useState(false);
1201
3196
  // ref for object URL (either created by ResolvePDFSource or by us after fetching)
1202
- const objectUrlRef = React.useRef(null);
3197
+ const objectUrlRef = React3.useRef(null);
1203
3198
  // did ResolvePDFSource create the object URL? (helps understanding where to revoke)
1204
- const createdByResolveRef = React.useRef(false);
3199
+ const createdByResolveRef = React3.useRef(false);
1205
3200
  // fetch abort controller for cross-origin remote fetches
1206
- const fetchControllerRef = React.useRef(null);
3201
+ const fetchControllerRef = React3.useRef(null);
1207
3202
  const isRemoteUrl = (url) => {
1208
3203
  if (!url)
1209
3204
  return false;
1210
3205
  // Check if it's an HTTP(S) URL
1211
3206
  return /^https?:\/\//i.test(url);
1212
3207
  };
1213
- React.useEffect(() => {
3208
+ React3.useEffect(() => {
1214
3209
  let mounted = true;
1215
3210
  setLoading(true);
1216
3211
  const element = viewerRef.current;
@@ -1464,7 +3459,7 @@ const Select = (props) => {
1464
3459
  .filter((item) => item)
1465
3460
  .map((option, index) => {
1466
3461
  const { reactListKey, children, ...optionAttributes } = option;
1467
- return (React.createElement("option", { ...optionAttributes, key: reactListKey || index }, children));
3462
+ return (React3.createElement("option", { ...optionAttributes, key: reactListKey || index }, children));
1468
3463
  })
1469
3464
  : null;
1470
3465
  return (jsxRuntime.jsxs("div", { className: `govuk-form-group${errorMessage ? " govuk-form-group--error" : ""} ${formGroup?.className || ""}`, children: [jsxRuntime.jsx(Label, { ...label, htmlFor: id }), hintComponent, errorMessageComponent, jsxRuntime.jsx("select", { className: `govuk-select ${className || ""}${errorMessage ? " govuk-select--error" : ""}`, id: id, "aria-describedby": describedByValue || undefined, ...attributes, children: options })] }));
@@ -1510,11 +3505,11 @@ const SummaryList = (props) => {
1510
3505
 
1511
3506
  const Table = ({ caption, captionClassName, className, firstCellIsHeader, head, rows, footer, ...attributes }) => {
1512
3507
  // Memoize caption component to avoid re-renders if it doesn't change
1513
- const captionComponent = React.useMemo(() => caption && (jsxRuntime.jsx("caption", { className: `govuk-table__caption ${captionClassName || ""}`, children: caption })), [caption, captionClassName]);
3508
+ const captionComponent = React3.useMemo(() => caption && (jsxRuntime.jsx("caption", { className: `govuk-table__caption ${captionClassName || ""}`, children: caption })), [caption, captionClassName]);
1514
3509
  // Memoize head component
1515
- const headComponent = React.useMemo(() => head && (jsxRuntime.jsx("thead", { className: "govuk-table__head", children: jsxRuntime.jsx("tr", { className: "govuk-table__row", children: head.map(({ className, format, children, reactListKey, ...itemAttributes }, index) => (jsxRuntime.jsx("th", { scope: "col", className: `govuk-table__header ${format ? `govuk-table__header--${format}` : ""} ${className || ""}`, ...itemAttributes, children: children }, reactListKey || index))) }) })), [head]);
3510
+ const headComponent = React3.useMemo(() => head && (jsxRuntime.jsx("thead", { className: "govuk-table__head", children: jsxRuntime.jsx("tr", { className: "govuk-table__row", children: head.map(({ className, format, children, reactListKey, ...itemAttributes }, index) => (jsxRuntime.jsx("th", { scope: "col", className: `govuk-table__header ${format ? `govuk-table__header--${format}` : ""} ${className || ""}`, ...itemAttributes, children: children }, reactListKey || index))) }) })), [head]);
1516
3511
  // Memoize footer component
1517
- const footerComponent = React.useMemo(() => footer && (jsxRuntime.jsx("tfoot", { className: "govuk-table__head", children: jsxRuntime.jsx("tr", { className: "govuk-table__row", children: footer.map(({ className, format, children, reactListKey, ...itemAttributes }, index) => (jsxRuntime.jsx("th", { scope: "col", className: `govuk-table__header ${format ? `govuk-table__header--${format}` : ""} ${className || ""}`, ...itemAttributes, children: children }, reactListKey || index))) }) })), [footer]);
3512
+ const footerComponent = React3.useMemo(() => footer && (jsxRuntime.jsx("tfoot", { className: "govuk-table__head", children: jsxRuntime.jsx("tr", { className: "govuk-table__row", children: footer.map(({ className, format, children, reactListKey, ...itemAttributes }, index) => (jsxRuntime.jsx("th", { scope: "col", className: `govuk-table__header ${format ? `govuk-table__header--${format}` : ""} ${className || ""}`, ...itemAttributes, children: children }, reactListKey || index))) }) })), [footer]);
1518
3513
  // Filter rows that contain cells
1519
3514
  const filteredRows = rows?.filter((row) => row.cells) || [];
1520
3515
  return (jsxRuntime.jsxs("table", { className: `govuk-table ${className}`, ...attributes, children: [captionComponent, headComponent, jsxRuntime.jsx("tbody", { className: "govuk-table__body", children: filteredRows.map(({ cells, reactListKey }, rowIndex) => (jsxRuntime.jsx("tr", { className: "govuk-table__row", children: cells.map(({ className, children, format, reactListKey, ...cellAttributes }, cellIndex) => {
@@ -1559,7 +3554,7 @@ const TaskList = (props) => {
1559
3554
 
1560
3555
  const WarningInfo = ({ messageHeading = "Warning or Info Heading", message = "Warning or Info Heading message", advice = "Try again later.", applicationName = "Document and plan retrieval system", applicationRoute = "/", basePageName = "dashboard", }) => {
1561
3556
  let determineMessage;
1562
- const { state } = reactRouterDom.useLocation();
3557
+ const { state } = useLocation();
1563
3558
  if (state && state.message) {
1564
3559
  determineMessage = state.message;
1565
3560
  }