documentation-hub 5.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +43 -0
- package/.github/workflows/build.yml +64 -0
- package/.github/workflows/ci.yml +39 -0
- package/.vscode/extensions.json +3 -0
- package/Current.md +97 -0
- package/DocHub_Image.png +0 -0
- package/README.md +666 -0
- package/USER_GUIDE.md +1173 -0
- package/Updater.md +311 -0
- package/build/256x256.png +0 -0
- package/build/512x512.png +0 -0
- package/build/app-update.yml +4 -0
- package/build/create-icon.js +208 -0
- package/build/icon.ico +0 -0
- package/build/icon.png +0 -0
- package/build/icon_1024x1024.png +0 -0
- package/dist/assets/Analytics-BpsG9895.js +1 -0
- package/dist/assets/Card-IAZin8kp.js +1 -0
- package/dist/assets/CurrentSession-B-rFkHvf.js +12 -0
- package/dist/assets/Dashboard-C_5gMb0q.js +1 -0
- package/dist/assets/Documents-CqZ25axS.js +1 -0
- package/dist/assets/Input-l89xwXBi.js +1 -0
- package/dist/assets/Reporting-DqdHJY_a.js +1 -0
- package/dist/assets/Search-XNbu5z_3.js +1 -0
- package/dist/assets/SessionManager-lH9hZfzH.js +1 -0
- package/dist/assets/Sessions-ClZOPYNc.js +1 -0
- package/dist/assets/Settings-DUEHGURa.js +11 -0
- package/dist/assets/index-8xUe8ptc.js +24 -0
- package/dist/assets/index-RYyJqF7O.css +1 -0
- package/dist/assets/path-BkOl0AGO.js +1 -0
- package/dist/assets/promises-ID_B9S-h.js +1 -0
- package/dist/assets/urlHelpers-TvgahX0r.js +1 -0
- package/dist/assets/useToast-yRSO1dkm.js +1 -0
- package/dist/assets/vendor-charts-RkGK5ROP.js +36 -0
- package/dist/assets/vendor-db-l0sNRNKZ.js +1 -0
- package/dist/assets/vendor-react-BVZ_anCF.js +4 -0
- package/dist/assets/vendor-search-Dw8P0qyA.js +1 -0
- package/dist/assets/vendor-ui-BU7NfluV.js +53 -0
- package/dist/electron/PowerAutomateApiService-LfW09ZGr.js +147 -0
- package/dist/electron/main-CXkNtyv-.js +19789 -0
- package/dist/electron/main.js +5 -0
- package/dist/electron/preload.js +1 -0
- package/dist/icon.png +0 -0
- package/dist/index.html +27 -0
- package/docs/CODEBASE_ANALYSIS_REPORT.md +309 -0
- package/docs/DEBUG_LOGGING_GUIDE.md +244 -0
- package/docs/README.md +115 -0
- package/docs/TOC_WIRING_GUIDE.md +344 -0
- package/docs/analysis/Bullet_Symbol_Bug_Analysis.md +136 -0
- package/docs/analysis/DOCXMLATER_ANALYSIS_SUMMARY.txt +169 -0
- package/docs/analysis/Document_Processing_Issues_Analysis.md +704 -0
- package/docs/analysis/FIELD_PRESERVATION_ANALYSIS.md +1200 -0
- package/docs/analysis/INDENTATION_PRESERVE_ANALYSIS.md +181 -0
- package/docs/analysis/INDENTATION_PRESERVE_IMPLEMENTATION.md +207 -0
- package/docs/analysis/List_Implementation.md +206 -0
- package/docs/analysis/List_Implementation_Accuracy_Report.md +366 -0
- package/docs/analysis/PROCESSING_OPTIONS_UI_UPDATES.md +220 -0
- package/docs/analysis/RefactorStyles.md +852 -0
- package/docs/analysis/STYLE_PARAMETER_ENHANCEMENT.md +143 -0
- package/docs/analysis/docxmlater-comparison-todo-2025-11-13.md +636 -0
- package/docs/analysis/docxmlater-implementation-analysis-2025-11-13.md +340 -0
- package/docs/analysis/docxmlater-template_ui-integration-analysis.md +263 -0
- package/docs/analysis/github-issues-to-create.md +237 -0
- package/docs/api/API_README.md +538 -0
- package/docs/api/API_REFERENCE.md +751 -0
- package/docs/api/TYPE_DEFINITIONS.md +869 -0
- package/docs/architecture/FONT_EMBEDDING_GUIDE.md +318 -0
- package/docs/architecture/docxmlater-functions-and-structure.md +726 -0
- package/docs/docxmlater-readme.md +1341 -0
- package/docs/fixes/EXECUTION_LOG_TEST_BASE.md +573 -0
- package/docs/fixes/HYPERLINK_TEXT_SANITIZATION.md +253 -0
- package/docs/fixes/README.md +37 -0
- package/docs/github-issues/issue-1-body.md +125 -0
- package/docs/github-issues/issue-10-body.md +850 -0
- package/docs/github-issues/issue-2-body.md +200 -0
- package/docs/github-issues/issue-3-body.md +270 -0
- package/docs/github-issues/issue-4-body.md +169 -0
- package/docs/github-issues/issue-5-body.md +173 -0
- package/docs/github-issues/issue-6-body.md +158 -0
- package/docs/github-issues/issue-7-body.md +171 -0
- package/docs/github-issues/issue-8-body.md +407 -0
- package/docs/github-issues/issue-9-body.md +515 -0
- package/docs/github-issues/issue-tracker.md +274 -0
- package/docs/github-issues/predictive-analysis-2025-10-18.md +2131 -0
- package/docs/implementation/List_Framework_Refactor_Plan.md +336 -0
- package/docs/implementation/PRIMARY_TEXT_COLOR_FEATURE.md +217 -0
- package/docs/implementation/RELEASE_PLAN_v2.1.0.md +362 -0
- package/docs/implementation/RefactorStyles.md +588 -0
- package/docs/implementation/implement-plan.md +489 -0
- package/docs/implementation/missing-helpers-implementation.md +391 -0
- package/docs/implementation/refactor-plan.md +520 -0
- package/docs/implementation/session-implementation-complete.md +233 -0
- package/docs/implementation/session-management-plan.md +250 -0
- package/docs/setup-checklist.md +77 -0
- package/docs/versions/changelog.md +345 -0
- package/electron/customUpdater.ts +656 -0
- package/electron/main.ts +2441 -0
- package/electron/memoryConfig.ts +187 -0
- package/electron/preload.ts +394 -0
- package/electron/proxyConfig.ts +340 -0
- package/electron/services/BackupService.ts +452 -0
- package/electron/services/DictionaryService.ts +402 -0
- package/electron/services/LocalDictionaryLookupService.ts +147 -0
- package/electron/services/PowerAutomateApiService.ts +231 -0
- package/electron/services/SharePointSyncService.ts +474 -0
- package/electron/windowsCertStore.ts +427 -0
- package/electron/zscalerConfig.ts +381 -0
- package/eslint.config.js +92 -0
- package/jest.config.js +52 -0
- package/package.json +214 -0
- package/postcss.config.mjs +6 -0
- package/public/icon.png +0 -0
- package/publish-release.ps1 +5 -0
- package/renovate.json +30 -0
- package/src/App.tsx +216 -0
- package/src/__mocks__/p-limit.js +12 -0
- package/src/__mocks__/styleMock.js +1 -0
- package/src/components/common/BugReportButton.tsx +44 -0
- package/src/components/common/BugReportDialog.tsx +193 -0
- package/src/components/common/Button.tsx +153 -0
- package/src/components/common/Card.tsx +86 -0
- package/src/components/common/ColorPickerDialog.tsx +177 -0
- package/src/components/common/ConfirmDialog.tsx +96 -0
- package/src/components/common/DebugConsole.tsx +275 -0
- package/src/components/common/EmptyState.tsx +183 -0
- package/src/components/common/ErrorBoundary.tsx +98 -0
- package/src/components/common/ErrorDetailsDialog.tsx +153 -0
- package/src/components/common/ErrorFallback.tsx +218 -0
- package/src/components/common/Input.tsx +109 -0
- package/src/components/common/Skeleton.tsx +184 -0
- package/src/components/common/SplashScreen.tsx +81 -0
- package/src/components/common/Toast.tsx +155 -0
- package/src/components/common/Tooltip.tsx +79 -0
- package/src/components/common/UpdateNotification.tsx +320 -0
- package/src/components/comparison/ComparisonWindow.tsx +374 -0
- package/src/components/comparison/SideBySideDiff.tsx +486 -0
- package/src/components/comparison/index.ts +8 -0
- package/src/components/document/DocumentUploader.tsx +288 -0
- package/src/components/document/HyperlinkPreview.tsx +430 -0
- package/src/components/document/HyperlinkService.md +1484 -0
- package/src/components/document/Hyperlink_Technical_Documentation.md +496 -0
- package/src/components/document/InlineChangesView.tsx +707 -0
- package/src/components/document/ProcessingProgress.tsx +303 -0
- package/src/components/document/ProcessingResults.tsx +256 -0
- package/src/components/document/TrackedChangesDetail.tsx +530 -0
- package/src/components/document/TrackedChangesPanel.tsx +546 -0
- package/src/components/document/VirtualDocumentList.tsx +240 -0
- package/src/components/editor/DocumentEditor.tsx +723 -0
- package/src/components/editor/DocumentEditorModal.tsx +640 -0
- package/src/components/editor/EditorQuickActions.tsx +502 -0
- package/src/components/editor/EditorToolbar.tsx +312 -0
- package/src/components/editor/TableEditor.tsx +926 -0
- package/src/components/editor/index.ts +18 -0
- package/src/components/layout/Header.tsx +190 -0
- package/src/components/layout/Sidebar.tsx +313 -0
- package/src/components/layout/TitleBar.tsx +190 -0
- package/src/components/navigation/CommandPalette.tsx +233 -0
- package/src/components/navigation/KeyboardShortcutsModal.tsx +173 -0
- package/src/components/sessions/ChangeItem.tsx +408 -0
- package/src/components/sessions/ChangeViewer.tsx +1155 -0
- package/src/components/sessions/DocumentComparisonModal.tsx +314 -0
- package/src/components/sessions/ProcessingOptions.tsx +297 -0
- package/src/components/sessions/ReplacementsTab.tsx +438 -0
- package/src/components/sessions/RevisionHandlingOptions.tsx +87 -0
- package/src/components/sessions/SessionManager.tsx +188 -0
- package/src/components/sessions/StylesEditor.tsx +1335 -0
- package/src/components/sessions/TabContainer.tsx +151 -0
- package/src/components/sessions/VirtualSessionList.tsx +157 -0
- package/src/components/sessions/sessionToProcessorManager.tsx +420 -0
- package/src/components/settings/CertificateManager.tsx +410 -0
- package/src/components/settings/SegmentedControl.tsx +88 -0
- package/src/components/settings/SettingRow.tsx +52 -0
- package/src/contexts/GlobalStatsContext.tsx +396 -0
- package/src/contexts/SessionContext.tsx +2129 -0
- package/src/contexts/ThemeContext.tsx +428 -0
- package/src/contexts/UserSettingsContext.tsx +290 -0
- package/src/contexts/__tests__/GlobalStatsContext.test.tsx +390 -0
- package/src/global.d.ts +273 -0
- package/src/hooks/useDocumentQueue.tsx +210 -0
- package/src/hooks/useToast.tsx +55 -0
- package/src/main.tsx +10 -0
- package/src/pages/Analytics.tsx +386 -0
- package/src/pages/CurrentSession.tsx +1174 -0
- package/src/pages/Dashboard.tsx +319 -0
- package/src/pages/Documents.tsx +317 -0
- package/src/pages/Projects.tsx +250 -0
- package/src/pages/Reporting.tsx +386 -0
- package/src/pages/Search.tsx +349 -0
- package/src/pages/Sessions.tsx +285 -0
- package/src/pages/Settings.tsx +2662 -0
- package/src/services/HyperlinkService.ts +1085 -0
- package/src/services/document/DocXMLaterProcessor.ts +617 -0
- package/src/services/document/DocumentProcessingComparison.ts +856 -0
- package/src/services/document/DocumentSnapshotService.ts +575 -0
- package/src/services/document/WordDocumentProcessor.ts +10509 -0
- package/src/services/document/__tests__/DocXMLaterProcessor.hyperlinks.test.md +311 -0
- package/src/services/document/__tests__/WordDocumentProcessor.integration.test.ts +515 -0
- package/src/services/document/__tests__/WordDocumentProcessor.test.ts +812 -0
- package/src/services/document/blanklines/BlankLineManager.ts +658 -0
- package/src/services/document/blanklines/__tests__/paragraphChecks.test.ts +281 -0
- package/src/services/document/blanklines/helpers/blankLineInsertion.ts +87 -0
- package/src/services/document/blanklines/helpers/blankLineSnapshot.ts +251 -0
- package/src/services/document/blanklines/helpers/clearCustom.ts +121 -0
- package/src/services/document/blanklines/helpers/contextChecks.ts +117 -0
- package/src/services/document/blanklines/helpers/imageChecks.ts +51 -0
- package/src/services/document/blanklines/helpers/paragraphChecks.ts +236 -0
- package/src/services/document/blanklines/helpers/removeBlanksBetweenListItems.ts +91 -0
- package/src/services/document/blanklines/helpers/removeTrailingBlanks.ts +35 -0
- package/src/services/document/blanklines/helpers/tableGuards.ts +21 -0
- package/src/services/document/blanklines/index.ts +67 -0
- package/src/services/document/blanklines/rules/additionRules.ts +337 -0
- package/src/services/document/blanklines/rules/indentationRules.ts +317 -0
- package/src/services/document/blanklines/rules/removalRules.ts +362 -0
- package/src/services/document/blanklines/rules/ruleTypes.ts +92 -0
- package/src/services/document/blanklines/types.ts +29 -0
- package/src/services/document/helpers/ImageBorderCropper.ts +377 -0
- package/src/services/document/helpers/__tests__/whitespace.test.ts +272 -0
- package/src/services/document/helpers/whitespace.ts +117 -0
- package/src/services/document/list/ListNormalizer.ts +947 -0
- package/src/services/document/list/index.ts +45 -0
- package/src/services/document/list/list-detection.ts +275 -0
- package/src/services/document/list/list-types.ts +162 -0
- package/src/services/document/processors/HyperlinkProcessor.ts +370 -0
- package/src/services/document/processors/ListProcessor.ts +257 -0
- package/src/services/document/processors/StructureProcessor.ts +176 -0
- package/src/services/document/processors/StyleProcessor.ts +389 -0
- package/src/services/document/processors/TableProcessor.ts +2238 -0
- package/src/services/document/processors/__tests__/HyperlinkProcessor.test.ts +314 -0
- package/src/services/document/processors/__tests__/ListProcessor.test.ts +291 -0
- package/src/services/document/processors/__tests__/StructureProcessor.test.ts +257 -0
- package/src/services/document/processors/__tests__/TableProcessor.hlp-tips-bullets.test.ts +459 -0
- package/src/services/document/processors/__tests__/TableProcessor.test.ts +1604 -0
- package/src/services/document/processors/index.ts +28 -0
- package/src/services/document/types/docx-processing.ts +310 -0
- package/src/services/editor/EditorActionHandlers.ts +901 -0
- package/src/services/editor/index.ts +13 -0
- package/src/setupTests.ts +47 -0
- package/src/styles/global.css +782 -0
- package/src/types/backup.ts +132 -0
- package/src/types/dictionary.ts +125 -0
- package/src/types/document-processing.ts +331 -0
- package/src/types/docxmlater-augments.d.ts +142 -0
- package/src/types/editor.ts +280 -0
- package/src/types/electron.ts +340 -0
- package/src/types/globalStats.ts +155 -0
- package/src/types/hyperlink.ts +471 -0
- package/src/types/operations.ts +354 -0
- package/src/types/session.ts +427 -0
- package/src/types/settings.ts +112 -0
- package/src/utils/MemoryMonitor.ts +248 -0
- package/src/utils/cn.ts +6 -0
- package/src/utils/colorConvert.ts +306 -0
- package/src/utils/diffUtils.ts +347 -0
- package/src/utils/documentUtils.ts +202 -0
- package/src/utils/electronGuard.ts +62 -0
- package/src/utils/indexedDB.ts +915 -0
- package/src/utils/logger.ts +717 -0
- package/src/utils/pathSecurity.ts +232 -0
- package/src/utils/pathValidator.ts +236 -0
- package/src/utils/processingTimeEstimator.ts +153 -0
- package/src/utils/safeJsonParse.ts +62 -0
- package/src/utils/textSanitizer.ts +162 -0
- package/src/utils/urlHelpers.ts +304 -0
- package/src/utils/urlPatterns.ts +198 -0
- package/src/utils/urlSanitizer.ts +152 -0
- package/src/vite-env.d.ts +11 -0
- package/tsconfig.electron.json +19 -0
- package/tsconfig.json +36 -0
- package/tsconfig.node.json +12 -0
- package/typedoc.json +45 -0
- package/vite.config.ts +152 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
function Vn(e,t){for(var r=0;r<t.length;r++){const n=t[r];if(typeof n!="string"&&!Array.isArray(n)){for(const o in n)if(o!=="default"&&!(o in e)){const a=Object.getOwnPropertyDescriptor(n,o);a&&Object.defineProperty(e,o,a.get?a:{enumerable:!0,get:()=>n[o]})}}}return Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}function Gr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Nt={exports:{}},I={};var vr;function Kn(){if(vr)return I;vr=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),i=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),s=Symbol.for("react.suspense"),l=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),w=Symbol.iterator;function g(f){return f===null||typeof f!="object"?null:(f=w&&f[w]||f["@@iterator"],typeof f=="function"?f:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},P=Object.assign,x={};function _(f,R,A){this.props=f,this.context=R,this.refs=x,this.updater=A||S}_.prototype.isReactComponent={},_.prototype.setState=function(f,R){if(typeof f!="object"&&typeof f!="function"&&f!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,f,R,"setState")},_.prototype.forceUpdate=function(f){this.updater.enqueueForceUpdate(this,f,"forceUpdate")};function C(){}C.prototype=_.prototype;function $(f,R,A){this.props=f,this.context=R,this.refs=x,this.updater=A||S}var Z=$.prototype=new C;Z.constructor=$,P(Z,_.prototype),Z.isPureReactComponent=!0;var Y=Array.isArray;function te(){}var p={H:null,A:null,T:null,S:null},j=Object.prototype.hasOwnProperty;function B(f,R,A){var T=A.ref;return{$$typeof:e,type:f,key:R,ref:T!==void 0?T:null,props:A}}function re(f,R){return B(f.type,R,f.props)}function X(f){return typeof f=="object"&&f!==null&&f.$$typeof===e}function le(f){var R={"=":"=0",":":"=2"};return"$"+f.replace(/[=:]/g,function(A){return R[A]})}var we=/\/+/g;function ne(f,R){return typeof f=="object"&&f!==null&&f.key!=null?le(""+f.key):R.toString(36)}function Q(f){switch(f.status){case"fulfilled":return f.value;case"rejected":throw f.reason;default:switch(typeof f.status=="string"?f.then(te,te):(f.status="pending",f.then(function(R){f.status==="pending"&&(f.status="fulfilled",f.value=R)},function(R){f.status==="pending"&&(f.status="rejected",f.reason=R)})),f.status){case"fulfilled":return f.value;case"rejected":throw f.reason}}throw f}function G(f,R,A,T,z){var H=typeof f;(H==="undefined"||H==="boolean")&&(f=null);var J=!1;if(f===null)J=!0;else switch(H){case"bigint":case"string":case"number":J=!0;break;case"object":switch(f.$$typeof){case e:case t:J=!0;break;case h:return J=f._init,G(J(f._payload),R,A,T,z)}}if(J)return z=z(f),J=T===""?"."+ne(f,0):T,Y(z)?(A="",J!=null&&(A=J.replace(we,"$&/")+"/"),G(z,R,A,"",function(Dt){return Dt})):z!=null&&(X(z)&&(z=re(z,A+(z.key==null||f&&f.key===z.key?"":(""+z.key).replace(we,"$&/")+"/")+J)),R.push(z)),1;J=0;var de=T===""?".":T+":";if(Y(f))for(var he=0;he<f.length;he++)T=f[he],H=de+ne(T,he),J+=G(T,R,A,H,z);else if(he=g(f),typeof he=="function")for(f=he.call(f),he=0;!(T=f.next()).done;)T=T.value,H=de+ne(T,he++),J+=G(T,R,A,H,z);else if(H==="object"){if(typeof f.then=="function")return G(Q(f),R,A,T,z);throw R=String(f),Error("Objects are not valid as a React child (found: "+(R==="[object Object]"?"object with keys {"+Object.keys(f).join(", ")+"}":R)+"). If you meant to render a collection of children, use an array instead.")}return J}function ue(f,R,A){if(f==null)return f;var T=[],z=0;return G(f,T,"","",function(H){return R.call(A,H,z++)}),T}function q(f){if(f._status===-1){var R=f._result;R=R(),R.then(function(A){(f._status===0||f._status===-1)&&(f._status=1,f._result=A)},function(A){(f._status===0||f._status===-1)&&(f._status=2,f._result=A)}),f._status===-1&&(f._status=0,f._result=R)}if(f._status===1)return f._result.default;throw f._result}var oe=typeof reportError=="function"?reportError:function(f){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var R=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof f=="object"&&f!==null&&typeof f.message=="string"?String(f.message):String(f),error:f});if(!window.dispatchEvent(R))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",f);return}console.error(f)},fe={map:ue,forEach:function(f,R,A){ue(f,function(){R.apply(this,arguments)},A)},count:function(f){var R=0;return ue(f,function(){R++}),R},toArray:function(f){return ue(f,function(R){return R})||[]},only:function(f){if(!X(f))throw Error("React.Children.only expected to receive a single React element child.");return f}};return I.Activity=m,I.Children=fe,I.Component=_,I.Fragment=r,I.Profiler=o,I.PureComponent=$,I.StrictMode=n,I.Suspense=s,I.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=p,I.__COMPILER_RUNTIME={__proto__:null,c:function(f){return p.H.useMemoCache(f)}},I.cache=function(f){return function(){return f.apply(null,arguments)}},I.cacheSignal=function(){return null},I.cloneElement=function(f,R,A){if(f==null)throw Error("The argument must be a React element, but you passed "+f+".");var T=P({},f.props),z=f.key;if(R!=null)for(H in R.key!==void 0&&(z=""+R.key),R)!j.call(R,H)||H==="key"||H==="__self"||H==="__source"||H==="ref"&&R.ref===void 0||(T[H]=R[H]);var H=arguments.length-2;if(H===1)T.children=A;else if(1<H){for(var J=Array(H),de=0;de<H;de++)J[de]=arguments[de+2];T.children=J}return B(f.type,z,T)},I.createContext=function(f){return f={$$typeof:i,_currentValue:f,_currentValue2:f,_threadCount:0,Provider:null,Consumer:null},f.Provider=f,f.Consumer={$$typeof:a,_context:f},f},I.createElement=function(f,R,A){var T,z={},H=null;if(R!=null)for(T in R.key!==void 0&&(H=""+R.key),R)j.call(R,T)&&T!=="key"&&T!=="__self"&&T!=="__source"&&(z[T]=R[T]);var J=arguments.length-2;if(J===1)z.children=A;else if(1<J){for(var de=Array(J),he=0;he<J;he++)de[he]=arguments[he+2];z.children=de}if(f&&f.defaultProps)for(T in J=f.defaultProps,J)z[T]===void 0&&(z[T]=J[T]);return B(f,H,z)},I.createRef=function(){return{current:null}},I.forwardRef=function(f){return{$$typeof:u,render:f}},I.isValidElement=X,I.lazy=function(f){return{$$typeof:h,_payload:{_status:-1,_result:f},_init:q}},I.memo=function(f,R){return{$$typeof:l,type:f,compare:R===void 0?null:R}},I.startTransition=function(f){var R=p.T,A={};p.T=A;try{var T=f(),z=p.S;z!==null&&z(A,T),typeof T=="object"&&T!==null&&typeof T.then=="function"&&T.then(te,oe)}catch(H){oe(H)}finally{R!==null&&A.types!==null&&(R.types=A.types),p.T=R}},I.unstable_useCacheRefresh=function(){return p.H.useCacheRefresh()},I.use=function(f){return p.H.use(f)},I.useActionState=function(f,R,A){return p.H.useActionState(f,R,A)},I.useCallback=function(f,R){return p.H.useCallback(f,R)},I.useContext=function(f){return p.H.useContext(f)},I.useDebugValue=function(){},I.useDeferredValue=function(f,R){return p.H.useDeferredValue(f,R)},I.useEffect=function(f,R){return p.H.useEffect(f,R)},I.useEffectEvent=function(f){return p.H.useEffectEvent(f)},I.useId=function(){return p.H.useId()},I.useImperativeHandle=function(f,R,A){return p.H.useImperativeHandle(f,R,A)},I.useInsertionEffect=function(f,R){return p.H.useInsertionEffect(f,R)},I.useLayoutEffect=function(f,R){return p.H.useLayoutEffect(f,R)},I.useMemo=function(f,R){return p.H.useMemo(f,R)},I.useOptimistic=function(f,R){return p.H.useOptimistic(f,R)},I.useReducer=function(f,R,A){return p.H.useReducer(f,R,A)},I.useRef=function(f){return p.H.useRef(f)},I.useState=function(f){return p.H.useState(f)},I.useSyncExternalStore=function(f,R,A){return p.H.useSyncExternalStore(f,R,A)},I.useTransition=function(){return p.H.useTransition()},I.version="19.2.4",I}var gr;function Jr(){return gr||(gr=1,Nt.exports=Kn()),Nt.exports}var v=Jr();const qn=Gr(v),Gn=Vn({__proto__:null,default:qn},[v]);var $t={exports:{}},ye={};var wr;function Jn(){if(wr)return ye;wr=1;var e=Jr();function t(s){var l="https://react.dev/errors/"+s;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)l+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+s+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var n={d:{f:r,r:function(){throw Error(t(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},o=Symbol.for("react.portal");function a(s,l,h){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:m==null?null:""+m,children:s,containerInfo:l,implementation:h}}var i=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(s,l){if(s==="font")return"";if(typeof l=="string")return l==="use-credentials"?l:""}return ye.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,ye.createPortal=function(s,l){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11)throw Error(t(299));return a(s,l,null,h)},ye.flushSync=function(s){var l=i.T,h=n.p;try{if(i.T=null,n.p=2,s)return s()}finally{i.T=l,n.p=h,n.d.f()}},ye.preconnect=function(s,l){typeof s=="string"&&(l?(l=l.crossOrigin,l=typeof l=="string"?l==="use-credentials"?l:"":void 0):l=null,n.d.C(s,l))},ye.prefetchDNS=function(s){typeof s=="string"&&n.d.D(s)},ye.preinit=function(s,l){if(typeof s=="string"&&l&&typeof l.as=="string"){var h=l.as,m=u(h,l.crossOrigin),w=typeof l.integrity=="string"?l.integrity:void 0,g=typeof l.fetchPriority=="string"?l.fetchPriority:void 0;h==="style"?n.d.S(s,typeof l.precedence=="string"?l.precedence:void 0,{crossOrigin:m,integrity:w,fetchPriority:g}):h==="script"&&n.d.X(s,{crossOrigin:m,integrity:w,fetchPriority:g,nonce:typeof l.nonce=="string"?l.nonce:void 0})}},ye.preinitModule=function(s,l){if(typeof s=="string")if(typeof l=="object"&&l!==null){if(l.as==null||l.as==="script"){var h=u(l.as,l.crossOrigin);n.d.M(s,{crossOrigin:h,integrity:typeof l.integrity=="string"?l.integrity:void 0,nonce:typeof l.nonce=="string"?l.nonce:void 0})}}else l==null&&n.d.M(s)},ye.preload=function(s,l){if(typeof s=="string"&&typeof l=="object"&&l!==null&&typeof l.as=="string"){var h=l.as,m=u(h,l.crossOrigin);n.d.L(s,h,{crossOrigin:m,integrity:typeof l.integrity=="string"?l.integrity:void 0,nonce:typeof l.nonce=="string"?l.nonce:void 0,type:typeof l.type=="string"?l.type:void 0,fetchPriority:typeof l.fetchPriority=="string"?l.fetchPriority:void 0,referrerPolicy:typeof l.referrerPolicy=="string"?l.referrerPolicy:void 0,imageSrcSet:typeof l.imageSrcSet=="string"?l.imageSrcSet:void 0,imageSizes:typeof l.imageSizes=="string"?l.imageSizes:void 0,media:typeof l.media=="string"?l.media:void 0})}},ye.preloadModule=function(s,l){if(typeof s=="string")if(l){var h=u(l.as,l.crossOrigin);n.d.m(s,{as:typeof l.as=="string"&&l.as!=="script"?l.as:void 0,crossOrigin:h,integrity:typeof l.integrity=="string"?l.integrity:void 0})}else n.d.m(s)},ye.requestFormReset=function(s){n.d.r(s)},ye.unstable_batchedUpdates=function(s,l){return s(l)},ye.useFormState=function(s,l,h){return i.H.useFormState(s,l,h)},ye.useFormStatus=function(){return i.H.useHostTransitionStatus()},ye.version="19.2.4",ye}var Rr;function Xn(){if(Rr)return $t.exports;Rr=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),$t.exports=Jn(),$t.exports}var Xr=e=>{throw TypeError(e)},Qn=(e,t,r)=>t.has(e)||Xr("Cannot "+r),Ut=(e,t,r)=>(Qn(e,t,"read from private field"),r?r.call(e):t.get(e)),Zn=(e,t,r)=>t.has(e)?Xr("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Er="popstate";function ea(e={}){function t(o,a){let{pathname:i="/",search:u="",hash:s=""}=Ae(o.location.hash.substring(1));return!i.startsWith("/")&&!i.startsWith(".")&&(i="/"+i),it("",{pathname:i,search:u,hash:s},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function r(o,a){let i=o.document.querySelector("base"),u="";if(i&&i.getAttribute("href")){let s=o.location.href,l=s.indexOf("#");u=l===-1?s:s.slice(0,l)}return u+"#"+(typeof a=="string"?a:Le(a))}function n(o,a){ie(o.pathname.charAt(0)==="/",`relative pathnames are not supported in hash history.push(${JSON.stringify(a)})`)}return ra(t,r,n,e)}function k(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function ie(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function ta(){return Math.random().toString(36).substring(2,10)}function br(e,t){return{usr:e.state,key:e.key,idx:t}}function it(e,t,r=null,n){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Ae(t):t,state:r,key:t&&t.key||n||ta()}}function Le({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Ae(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substring(n),e=e.substring(0,n)),e&&(t.pathname=e)}return t}function ra(e,t,r,n={}){let{window:o=document.defaultView,v5Compat:a=!1}=n,i=o.history,u="POP",s=null,l=h();l==null&&(l=0,i.replaceState({...i.state,idx:l},""));function h(){return(i.state||{idx:null}).idx}function m(){u="POP";let x=h(),_=x==null?null:x-l;l=x,s&&s({action:u,location:P.location,delta:_})}function w(x,_){u="PUSH";let C=it(P.location,x,_);r&&r(C,x),l=h()+1;let $=br(C,l),Z=P.createHref(C);try{i.pushState($,"",Z)}catch(Y){if(Y instanceof DOMException&&Y.name==="DataCloneError")throw Y;o.location.assign(Z)}a&&s&&s({action:u,location:P.location,delta:1})}function g(x,_){u="REPLACE";let C=it(P.location,x,_);r&&r(C,x),l=h();let $=br(C,l),Z=P.createHref(C);i.replaceState($,"",Z),a&&s&&s({action:u,location:P.location,delta:0})}function S(x){return Qr(x)}let P={get action(){return u},get location(){return e(o,i)},listen(x){if(s)throw new Error("A history only accepts one active listener");return o.addEventListener(Er,m),s=x,()=>{o.removeEventListener(Er,m),s=null}},createHref(x){return t(o,x)},createURL:S,encodeLocation(x){let _=S(x);return{pathname:_.pathname,search:_.search,hash:_.hash}},push:w,replace:g,go(x){return i.go(x)}};return P}function Qr(e,t=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),k(r,"No window.location.(origin|href) available to create URL");let n=typeof e=="string"?e:Le(e);return n=n.replace(/ $/,"%20"),!t&&n.startsWith("//")&&(n=r+n),new URL(n,r)}var nt,Cr=class{constructor(e){if(Zn(this,nt,new Map),e)for(let[t,r]of e)this.set(t,r)}get(e){if(Ut(this,nt).has(e))return Ut(this,nt).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw new Error("No value found for context")}set(e,t){Ut(this,nt).set(e,t)}};nt=new WeakMap;var na=new Set(["lazy","caseSensitive","path","id","index","children"]);function aa(e){return na.has(e)}var oa=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function ia(e){return oa.has(e)}function la(e){return e.index===!0}function lt(e,t,r=[],n={},o=!1){return e.map((a,i)=>{let u=[...r,String(i)],s=typeof a.id=="string"?a.id:u.join("-");if(k(a.index!==!0||!a.children,"Cannot specify children on an index route"),k(o||!n[s],`Found a route id collision on id "${s}". Route id's must be globally unique within Data Router usages`),la(a)){let l={...a,id:s};return n[s]=Sr(l,t(l)),l}else{let l={...a,id:s,children:void 0};return n[s]=Sr(l,t(l)),a.children&&(l.children=lt(a.children,t,u,n,o)),l}})}function Sr(e,t){return Object.assign(e,{...t,...typeof t.lazy=="object"&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function $e(e,t,r="/"){return at(e,t,r,!1)}function at(e,t,r,n){let o=typeof t=="string"?Ae(t):t,a=Ce(o.pathname||"/",r);if(a==null)return null;let i=Zr(e);ua(i);let u=null;for(let s=0;u==null&&s<i.length;++s){let l=Ra(a);u=ga(i[s],l,n)}return u}function sa(e,t){let{route:r,pathname:n,params:o}=e;return{id:r.id,pathname:n,params:o,data:t[r.id],loaderData:t[r.id],handle:r.handle}}function Zr(e,t=[],r=[],n="",o=!1){let a=(i,u,s=o,l)=>{let h={relativePath:l===void 0?i.path||"":l,caseSensitive:i.caseSensitive===!0,childrenIndex:u,route:i};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(n)&&s)return;k(h.relativePath.startsWith(n),`Absolute route path "${h.relativePath}" nested under path "${n}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),h.relativePath=h.relativePath.slice(n.length)}let m=_e([n,h.relativePath]),w=r.concat(h);i.children&&i.children.length>0&&(k(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),Zr(i.children,t,w,m,s)),!(i.path==null&&!i.index)&&t.push({path:m,score:ya(m,i.index),routesMeta:w})};return e.forEach((i,u)=>{if(i.path===""||!i.path?.includes("?"))a(i,u);else for(let s of en(i.path))a(i,u,!0,s)}),t}function en(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,o=r.endsWith("?"),a=r.replace(/\?$/,"");if(n.length===0)return o?[a,""]:[a];let i=en(n.join("/")),u=[];return u.push(...i.map(s=>s===""?a:[a,s].join("/"))),o&&u.push(...i),u.map(s=>e.startsWith("/")&&s===""?"/":s)}function ua(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:va(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}var ca=/^:[\w-]+$/,fa=3,da=2,ha=1,ma=10,pa=-2,Pr=e=>e==="*";function ya(e,t){let r=e.split("/"),n=r.length;return r.some(Pr)&&(n+=pa),t&&(n+=da),r.filter(o=>!Pr(o)).reduce((o,a)=>o+(ca.test(a)?fa:a===""?ha:ma),n)}function va(e,t){return e.length===t.length&&e.slice(0,-1).every((n,o)=>n===t[o])?e[e.length-1]-t[t.length-1]:0}function ga(e,t,r=!1){let{routesMeta:n}=e,o={},a="/",i=[];for(let u=0;u<n.length;++u){let s=n[u],l=u===n.length-1,h=a==="/"?t:t.slice(a.length)||"/",m=xt({path:s.relativePath,caseSensitive:s.caseSensitive,end:l},h),w=s.route;if(!m&&l&&r&&!n[n.length-1].route.index&&(m=xt({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},h)),!m)return null;Object.assign(o,m.params),i.push({params:o,pathname:_e([a,m.pathname]),pathnameBase:Ca(_e([a,m.pathnameBase])),route:w}),m.pathnameBase!=="/"&&(a=_e([a,m.pathnameBase]))}return i}function xt(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=wa(e.path,e.caseSensitive,e.end),o=t.match(r);if(!o)return null;let a=o[0],i=a.replace(/(.)\/+$/,"$1"),u=o.slice(1);return{params:n.reduce((l,{paramName:h,isOptional:m},w)=>{if(h==="*"){let S=u[w]||"";i=a.slice(0,a.length-S.length).replace(/(.)\/+$/,"$1")}const g=u[w];return m&&!g?l[h]=void 0:l[h]=(g||"").replace(/%2F/g,"/"),l},{}),pathname:a,pathnameBase:i,pattern:e}}function wa(e,t=!1,r=!0){ie(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let n=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,u,s)=>(n.push({paramName:u,isOptional:s!=null}),s?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(n.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),n]}function Ra(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return ie(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Ce(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}function Ea({basename:e,pathname:t}){return t==="/"?e:_e([e,t])}var tn=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Vt=e=>tn.test(e);function ba(e,t="/"){let{pathname:r,search:n="",hash:o=""}=typeof e=="string"?Ae(e):e,a;return r?(r=r.replace(/\/\/+/g,"/"),r.startsWith("/")?a=xr(r.substring(1),"/"):a=xr(r,t)):a=t,{pathname:a,search:Sa(n),hash:Pa(o)}}function xr(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?r.length>1&&r.pop():o!=="."&&r.push(o)}),r.length>1?r.join("/"):"/"}function Ft(e,t,r,n){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(n)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function rn(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function Kt(e){let t=rn(e);return t.map((r,n)=>n===t.length-1?r.pathname:r.pathnameBase)}function qt(e,t,r,n=!1){let o;typeof e=="string"?o=Ae(e):(o={...e},k(!o.pathname||!o.pathname.includes("?"),Ft("?","pathname","search",o)),k(!o.pathname||!o.pathname.includes("#"),Ft("#","pathname","hash",o)),k(!o.search||!o.search.includes("#"),Ft("#","search","hash",o)));let a=e===""||o.pathname==="",i=a?"/":o.pathname,u;if(i==null)u=r;else{let m=t.length-1;if(!n&&i.startsWith("..")){let w=i.split("/");for(;w[0]==="..";)w.shift(),m-=1;o.pathname=w.join("/")}u=m>=0?t[m]:"/"}let s=ba(o,u),l=i&&i!=="/"&&i.endsWith("/"),h=(a||i===".")&&r.endsWith("/");return!s.pathname.endsWith("/")&&(l||h)&&(s.pathname+="/"),s}var _e=e=>e.join("/").replace(/\/\/+/g,"/"),Ca=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Sa=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Pa=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,ut=class{constructor(e,t,r,n=!1){this.status=e,this.statusText=t||"",this.internal=n,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function st(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function ct(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var nn=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function an(e,t){let r=e;if(typeof r!="string"||!tn.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let n=r,o=!1;if(nn)try{let a=new URL(window.location.href),i=r.startsWith("//")?new URL(a.protocol+r):new URL(r),u=Ce(i.pathname,t);i.origin===a.origin&&u!=null?r=u+i.search+i.hash:o=!0}catch{ie(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:n,isExternal:o,to:r}}var Fe=Symbol("Uninstrumented");function xa(e,t){let r={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(o=>o({id:t.id,index:t.index,path:t.path,instrument(a){let i=Object.keys(r);for(let u of i)a[u]&&r[u].push(a[u])}}));let n={};if(typeof t.lazy=="function"&&r.lazy.length>0){let o=Ge(r.lazy,t.lazy,()=>{});o&&(n.lazy=o)}if(typeof t.lazy=="object"){let o=t.lazy;["middleware","loader","action"].forEach(a=>{let i=o[a],u=r[`lazy.${a}`];if(typeof i=="function"&&u.length>0){let s=Ge(u,i,()=>{});s&&(n.lazy=Object.assign(n.lazy||{},{[a]:s}))}})}return["loader","action"].forEach(o=>{let a=t[o];if(typeof a=="function"&&r[o].length>0){let i=a[Fe]??a,u=Ge(r[o],i,(...s)=>_r(s[0]));u&&(o==="loader"&&i.hydrate===!0&&(u.hydrate=!0),u[Fe]=i,n[o]=u)}}),t.middleware&&t.middleware.length>0&&r.middleware.length>0&&(n.middleware=t.middleware.map(o=>{let a=o[Fe]??o,i=Ge(r.middleware,a,(...u)=>_r(u[0]));return i?(i[Fe]=a,i):o})),n}function _a(e,t){let r={navigate:[],fetch:[]};if(t.forEach(n=>n({instrument(o){let a=Object.keys(o);for(let i of a)o[i]&&r[i].push(o[i])}})),r.navigate.length>0){let n=e.navigate[Fe]??e.navigate,o=Ge(r.navigate,n,(...a)=>{let[i,u]=a;return{to:typeof i=="number"||typeof i=="string"?i:i?Le(i):".",...Lr(e,u??{})}});o&&(o[Fe]=n,e.navigate=o)}if(r.fetch.length>0){let n=e.fetch[Fe]??e.fetch,o=Ge(r.fetch,n,(...a)=>{let[i,,u,s]=a;return{href:u??".",fetcherKey:i,...Lr(e,s??{})}});o&&(o[Fe]=n,e.fetch=o)}return e}function Ge(e,t,r){return e.length===0?null:async(...n)=>{let o=await on(e,r(...n),()=>t(...n),e.length-1);if(o.type==="error")throw o.value;return o.value}}async function on(e,t,r,n){let o=e[n],a;if(o){let i,u=async()=>(i?console.error("You cannot call instrumented handlers more than once"):i=on(e,t,r,n-1),a=await i,k(a,"Expected a result"),a.type==="error"&&a.value instanceof Error?{status:"error",error:a.value}:{status:"success",error:void 0});try{await o(u,t)}catch(s){console.error("An instrumentation function threw an error:",s)}i||await u(),await i}else try{a={type:"success",value:await r()}}catch(i){a={type:"error",value:i}}return a||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function _r(e){let{request:t,context:r,params:n,unstable_pattern:o}=e;return{request:La(t),params:{...n},unstable_pattern:o,context:Da(r)}}function Lr(e,t){return{currentUrl:Le(e.state.location),..."formMethod"in t?{formMethod:t.formMethod}:{},..."formEncType"in t?{formEncType:t.formEncType}:{},..."formData"in t?{formData:t.formData}:{},..."body"in t?{body:t.body}:{}}}function La(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function Da(e){if(Ma(e)){let t={...e};return Object.freeze(t),t}else return{get:t=>e.get(t)}}var Ta=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Ma(e){if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getOwnPropertyNames(t).sort().join("\0")===Ta}var ln=["POST","PUT","PATCH","DELETE"],Oa=new Set(ln),Aa=["GET",...ln],Na=new Set(Aa),sn=new Set([301,302,303,307,308]),$a=new Set([307,308]),jt={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Ua={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},et={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},Fa=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),un="remix-router-transitions",cn=Symbol("ResetLoaderData");function ja(e){const t=e.window?e.window:typeof window<"u"?window:void 0,r=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u";k(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let n=e.hydrationRouteProperties||[],o=e.mapRouteProperties||Fa,a=o;if(e.unstable_instrumentations){let c=e.unstable_instrumentations;a=d=>({...o(d),...xa(c.map(y=>y.route).filter(Boolean),d)})}let i={},u=lt(e.routes,a,void 0,i),s,l=e.basename||"/";l.startsWith("/")||(l=`/${l}`);let h=e.dataStrategy||Ba,m={...e.future},w=null,g=new Set,S=null,P=null,x=null,_=e.hydrationData!=null,C=$e(u,e.history.location,l),$=!1,Z=null,Y;if(C==null&&!e.patchRoutesOnNavigation){let c=be(404,{pathname:e.history.location.pathname}),{matches:d,route:y}=Rt(u);Y=!0,C=d,Z={[y.id]:c}}else if(C&&!e.hydrationData&&pt(C,u,e.history.location.pathname).active&&(C=null),C)if(C.some(c=>c.route.lazy))Y=!1;else if(!C.some(c=>Gt(c.route)))Y=!0;else{let c=e.hydrationData?e.hydrationData.loaderData:null,d=e.hydrationData?e.hydrationData.errors:null;if(d){let y=C.findIndex(E=>d[E.route.id]!==void 0);Y=C.slice(0,y+1).every(E=>!Bt(E.route,c,d))}else Y=C.every(y=>!Bt(y.route,c,d))}else{Y=!1,C=[];let c=pt(null,u,e.history.location.pathname);c.active&&c.matches&&($=!0,C=c.matches)}let te,p={historyAction:e.history.action,location:e.history.location,matches:C,initialized:Y,navigation:jt,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||Z,fetchers:new Map,blockers:new Map},j="POP",B=null,re=!1,X,le=!1,we=new Map,ne=null,Q=!1,G=!1,ue=new Set,q=new Map,oe=0,fe=-1,f=new Map,R=new Set,A=new Map,T=new Map,z=new Set,H=new Map,J,de=null;function he(){if(w=e.history.listen(({action:c,location:d,delta:y})=>{if(J){J(),J=void 0;return}ie(H.size===0||y!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let E=dr({currentLocation:p.location,nextLocation:d,historyAction:c});if(E&&y!=null){let b=new Promise(M=>{J=M});e.history.go(y*-1),mt(E,{state:"blocked",location:d,proceed(){mt(E,{state:"proceeding",proceed:void 0,reset:void 0,location:d}),b.then(()=>e.history.go(y))},reset(){let M=new Map(p.blockers);M.set(E,et),me({blockers:M})}}),B?.resolve(),B=null;return}return je(c,d)}),r){lo(t,we);let c=()=>so(t,we);t.addEventListener("pagehide",c),ne=()=>t.removeEventListener("pagehide",c)}return p.initialized||je("POP",p.location,{initialHydration:!0}),te}function Dt(){w&&w(),ne&&ne(),g.clear(),X&&X.abort(),p.fetchers.forEach((c,d)=>Mt(d)),p.blockers.forEach((c,d)=>fr(d))}function Tn(c){return g.add(c),()=>g.delete(c)}function me(c,d={}){c.matches&&(c.matches=c.matches.map(b=>{let M=i[b.route.id],L=b.route;return L.element!==M.element||L.errorElement!==M.errorElement||L.hydrateFallbackElement!==M.hydrateFallbackElement?{...b,route:M}:b})),p={...p,...c};let y=[],E=[];p.fetchers.forEach((b,M)=>{b.state==="idle"&&(z.has(M)?y.push(M):E.push(M))}),z.forEach(b=>{!p.fetchers.has(b)&&!q.has(b)&&y.push(b)}),[...g].forEach(b=>b(p,{deletedFetchers:y,newErrors:c.errors??null,viewTransitionOpts:d.viewTransitionOpts,flushSync:d.flushSync===!0})),y.forEach(b=>Mt(b)),E.forEach(b=>p.fetchers.delete(b))}function Ve(c,d,{flushSync:y}={}){let E=p.actionData!=null&&p.navigation.formMethod!=null&&ve(p.navigation.formMethod)&&p.navigation.state==="loading"&&c.state?._isRedirect!==!0,b;d.actionData?Object.keys(d.actionData).length>0?b=d.actionData:b=null:E?b=p.actionData:b=null;let M=d.loaderData?jr(p.loaderData,d.loaderData,d.matches||[],d.errors):p.loaderData,L=p.blockers;L.size>0&&(L=new Map(L),L.forEach((F,N)=>L.set(N,et)));let D=Q?!1:mr(c,d.matches||p.matches),O=re===!0||p.navigation.formMethod!=null&&ve(p.navigation.formMethod)&&c.state?._isRedirect!==!0;s&&(u=s,s=void 0),Q||j==="POP"||(j==="PUSH"?e.history.push(c,c.state):j==="REPLACE"&&e.history.replace(c,c.state));let U;if(j==="POP"){let F=we.get(p.location.pathname);F&&F.has(c.pathname)?U={currentLocation:p.location,nextLocation:c}:we.has(c.pathname)&&(U={currentLocation:c,nextLocation:p.location})}else if(le){let F=we.get(p.location.pathname);F?F.add(c.pathname):(F=new Set([c.pathname]),we.set(p.location.pathname,F)),U={currentLocation:p.location,nextLocation:c}}me({...d,actionData:b,loaderData:M,historyAction:j,location:c,initialized:!0,navigation:jt,revalidation:"idle",restoreScrollPosition:D,preventScrollReset:O,blockers:L},{viewTransitionOpts:U,flushSync:y===!0}),j="POP",re=!1,le=!1,Q=!1,G=!1,B?.resolve(),B=null,de?.resolve(),de=null}async function ar(c,d){if(B?.resolve(),B=null,typeof c=="number"){B||(B=Hr());let K=B.promise;return e.history.go(c),K}let y=Ht(p.location,p.matches,l,c,d?.fromRouteId,d?.relative),{path:E,submission:b,error:M}=Dr(!1,y,d),L=p.location,D=it(p.location,E,d&&d.state);D={...D,...e.history.encodeLocation(D)};let O=d&&d.replace!=null?d.replace:void 0,U="PUSH";O===!0?U="REPLACE":O===!1||b!=null&&ve(b.formMethod)&&b.formAction===p.location.pathname+p.location.search&&(U="REPLACE");let F=d&&"preventScrollReset"in d?d.preventScrollReset===!0:void 0,N=(d&&d.flushSync)===!0,V=dr({currentLocation:L,nextLocation:D,historyAction:U});if(V){mt(V,{state:"blocked",location:D,proceed(){mt(V,{state:"proceeding",proceed:void 0,reset:void 0,location:D}),ar(c,d)},reset(){let K=new Map(p.blockers);K.set(V,et),me({blockers:K})}});return}await je(U,D,{submission:b,pendingError:M,preventScrollReset:F,replace:d&&d.replace,enableViewTransition:d&&d.viewTransition,flushSync:N,callSiteDefaultShouldRevalidate:d&&d.unstable_defaultShouldRevalidate})}function Mn(){de||(de=Hr()),Tt(),me({revalidation:"loading"});let c=de.promise;return p.navigation.state==="submitting"?c:p.navigation.state==="idle"?(je(p.historyAction,p.location,{startUninterruptedRevalidation:!0}),c):(je(j||p.historyAction,p.navigation.location,{overrideNavigation:p.navigation,enableViewTransition:le===!0}),c)}async function je(c,d,y){X&&X.abort(),X=null,j=c,Q=(y&&y.startUninterruptedRevalidation)===!0,Hn(p.location,p.matches),re=(y&&y.preventScrollReset)===!0,le=(y&&y.enableViewTransition)===!0;let E=s||u,b=y&&y.overrideNavigation,M=y?.initialHydration&&p.matches&&p.matches.length>0&&!$?p.matches:$e(E,d,l),L=(y&&y.flushSync)===!0;if(M&&p.initialized&&!G&&Xa(p.location,d)&&!(y&&y.submission&&ve(y.submission.formMethod))){Ve(d,{matches:M},{flushSync:L});return}let D=pt(M,E,d.pathname);if(D.active&&D.matches&&(M=D.matches),!M){let{error:se,notFoundMatches:ge,route:ee}=Ot(d.pathname);Ve(d,{matches:ge,loaderData:{},errors:{[ee.id]:se}},{flushSync:L});return}X=new AbortController;let O=qe(e.history,d,X.signal,y&&y.submission),U=e.getContext?await e.getContext():new Cr,F;if(y&&y.pendingError)F=[Ue(M).route.id,{type:"error",error:y.pendingError}];else if(y&&y.submission&&ve(y.submission.formMethod)){let se=await On(O,d,y.submission,M,U,D.active,y&&y.initialHydration===!0,{replace:y.replace,flushSync:L});if(se.shortCircuited)return;if(se.pendingActionResult){let[ge,ee]=se.pendingActionResult;if(Re(ee)&&st(ee.error)&&ee.error.status===404){X=null,Ve(d,{matches:se.matches,loaderData:{},errors:{[ge]:ee.error}});return}}M=se.matches||M,F=se.pendingActionResult,b=zt(d,y.submission),L=!1,D.active=!1,O=qe(e.history,O.url,O.signal)}let{shortCircuited:N,matches:V,loaderData:K,errors:ce}=await An(O,d,M,U,D.active,b,y&&y.submission,y&&y.fetcherSubmission,y&&y.replace,y&&y.initialHydration===!0,L,F,y&&y.callSiteDefaultShouldRevalidate);N||(X=null,Ve(d,{matches:V||M,...zr(F),loaderData:K,errors:ce}))}async function On(c,d,y,E,b,M,L,D={}){Tt();let O=oo(d,y);if(me({navigation:O},{flushSync:D.flushSync===!0}),M){let N=await yt(E,d.pathname,c.signal);if(N.type==="aborted")return{shortCircuited:!0};if(N.type==="error"){if(N.partialMatches.length===0){let{matches:K,route:ce}=Rt(u);return{matches:K,pendingActionResult:[ce.id,{type:"error",error:N.error}]}}let V=Ue(N.partialMatches).route.id;return{matches:N.partialMatches,pendingActionResult:[V,{type:"error",error:N.error}]}}else if(N.matches)E=N.matches;else{let{notFoundMatches:V,error:K,route:ce}=Ot(d.pathname);return{matches:V,pendingActionResult:[ce.id,{type:"error",error:K}]}}}let U,F=Ct(E,d);if(!F.route.action&&!F.route.lazy)U={type:"error",error:be(405,{method:c.method,pathname:d.pathname,routeId:F.route.id})};else{let N=Je(a,i,c,E,F,L?[]:n,b),V=await Xe(c,N,b,null);if(U=V[F.route.id],!U){for(let K of E)if(V[K.route.id]){U=V[K.route.id];break}}if(c.signal.aborted)return{shortCircuited:!0}}if(Be(U)){let N;return D&&D.replace!=null?N=D.replace:N=$r(U.response.headers.get("Location"),new URL(c.url),l,e.history)===p.location.pathname+p.location.search,await ze(c,U,!0,{submission:y,replace:N}),{shortCircuited:!0}}if(Re(U)){let N=Ue(E,F.route.id);return(D&&D.replace)!==!0&&(j="PUSH"),{matches:E,pendingActionResult:[N.route.id,U,F.route.id]}}return{matches:E,pendingActionResult:[F.route.id,U]}}async function An(c,d,y,E,b,M,L,D,O,U,F,N,V){let K=M||zt(d,L),ce=L||D||kr(K),se=!Q&&!U;if(b){if(se){let pe=or(N);me({navigation:K,...pe!==void 0?{actionData:pe}:{}},{flushSync:F})}let W=await yt(y,d.pathname,c.signal);if(W.type==="aborted")return{shortCircuited:!0};if(W.type==="error"){if(W.partialMatches.length===0){let{matches:Ke,route:He}=Rt(u);return{matches:Ke,loaderData:{},errors:{[He.id]:W.error}}}let pe=Ue(W.partialMatches).route.id;return{matches:W.partialMatches,loaderData:{},errors:{[pe]:W.error}}}else if(W.matches)y=W.matches;else{let{error:pe,notFoundMatches:Ke,route:He}=Ot(d.pathname);return{matches:Ke,loaderData:{},errors:{[He.id]:pe}}}}let ge=s||u,{dsMatches:ee,revalidatingFetchers:Ee}=Tr(c,E,a,i,e.history,p,y,ce,d,U?[]:n,U===!0,G,ue,z,A,R,ge,l,e.patchRoutesOnNavigation!=null,N,V);if(fe=++oe,!e.dataStrategy&&!ee.some(W=>W.shouldLoad)&&!ee.some(W=>W.route.middleware&&W.route.middleware.length>0)&&Ee.length===0){let W=ur();return Ve(d,{matches:y,loaderData:{},errors:N&&Re(N[1])?{[N[0]]:N[1].error}:null,...zr(N),...W?{fetchers:new Map(p.fetchers)}:{}},{flushSync:F}),{shortCircuited:!0}}if(se){let W={};if(!b){W.navigation=K;let pe=or(N);pe!==void 0&&(W.actionData=pe)}Ee.length>0&&(W.fetchers=Nn(Ee)),me(W,{flushSync:F})}Ee.forEach(W=>{Me(W.key),W.controller&&q.set(W.key,W.controller)});let Ie=()=>Ee.forEach(W=>Me(W.key));X&&X.signal.addEventListener("abort",Ie);let{loaderResults:Qe,fetcherResults:Ne}=await ir(ee,Ee,c,E);if(c.signal.aborted)return{shortCircuited:!0};X&&X.signal.removeEventListener("abort",Ie),Ee.forEach(W=>q.delete(W.key));let xe=Et(Qe);if(xe)return await ze(c,xe.result,!0,{replace:O}),{shortCircuited:!0};if(xe=Et(Ne),xe)return R.add(xe.key),await ze(c,xe.result,!0,{replace:O}),{shortCircuited:!0};let{loaderData:At,errors:Ze}=Fr(p,y,Qe,N,Ee,Ne);U&&p.errors&&(Ze={...p.errors,...Ze});let ke=ur(),vt=cr(fe),gt=ke||vt||Ee.length>0;return{matches:y,loaderData:At,errors:Ze,...gt?{fetchers:new Map(p.fetchers)}:{}}}function or(c){if(c&&!Re(c[1]))return{[c[0]]:c[1].data};if(p.actionData)return Object.keys(p.actionData).length===0?null:p.actionData}function Nn(c){return c.forEach(d=>{let y=p.fetchers.get(d.key),E=tt(void 0,y?y.data:void 0);p.fetchers.set(d.key,E)}),new Map(p.fetchers)}async function $n(c,d,y,E){Me(c);let b=(E&&E.flushSync)===!0,M=s||u,L=Ht(p.location,p.matches,l,y,d,E?.relative),D=$e(M,L,l),O=pt(D,M,L);if(O.active&&O.matches&&(D=O.matches),!D){Te(c,d,be(404,{pathname:L}),{flushSync:b});return}let{path:U,submission:F,error:N}=Dr(!0,L,E);if(N){Te(c,d,N,{flushSync:b});return}let V=e.getContext?await e.getContext():new Cr,K=(E&&E.preventScrollReset)===!0;if(F&&ve(F.formMethod)){await Un(c,d,U,D,V,O.active,b,K,F,E&&E.unstable_defaultShouldRevalidate);return}A.set(c,{routeId:d,path:U}),await Fn(c,d,U,D,V,O.active,b,K,F)}async function Un(c,d,y,E,b,M,L,D,O,U){Tt(),A.delete(c);let F=p.fetchers.get(c);De(c,io(O,F),{flushSync:L});let N=new AbortController,V=qe(e.history,y,N.signal,O);if(M){let ae=await yt(E,new URL(V.url).pathname,V.signal,c);if(ae.type==="aborted")return;if(ae.type==="error"){Te(c,d,ae.error,{flushSync:L});return}else if(ae.matches)E=ae.matches;else{Te(c,d,be(404,{pathname:y}),{flushSync:L});return}}let K=Ct(E,y);if(!K.route.action&&!K.route.lazy){let ae=be(405,{method:O.formMethod,pathname:y,routeId:d});Te(c,d,ae,{flushSync:L});return}q.set(c,N);let ce=oe,se=Je(a,i,V,E,K,n,b),ge=await Xe(V,se,b,c),ee=ge[K.route.id];if(!ee){for(let ae of se)if(ge[ae.route.id]){ee=ge[ae.route.id];break}}if(V.signal.aborted){q.get(c)===N&&q.delete(c);return}if(z.has(c)){if(Be(ee)||Re(ee)){De(c,Oe(void 0));return}}else{if(Be(ee))if(q.delete(c),fe>ce){De(c,Oe(void 0));return}else return R.add(c),De(c,tt(O)),ze(V,ee,!1,{fetcherSubmission:O,preventScrollReset:D});if(Re(ee)){Te(c,d,ee.error);return}}let Ee=p.navigation.location||p.location,Ie=qe(e.history,Ee,N.signal),Qe=s||u,Ne=p.navigation.state!=="idle"?$e(Qe,p.navigation.location,l):p.matches;k(Ne,"Didn't find any matches after fetcher action");let xe=++oe;f.set(c,xe);let At=tt(O,ee.data);p.fetchers.set(c,At);let{dsMatches:Ze,revalidatingFetchers:ke}=Tr(Ie,b,a,i,e.history,p,Ne,O,Ee,n,!1,G,ue,z,A,R,Qe,l,e.patchRoutesOnNavigation!=null,[K.route.id,ee],U);ke.filter(ae=>ae.key!==c).forEach(ae=>{let wt=ae.key,yr=p.fetchers.get(wt),Yn=tt(void 0,yr?yr.data:void 0);p.fetchers.set(wt,Yn),Me(wt),ae.controller&&q.set(wt,ae.controller)}),me({fetchers:new Map(p.fetchers)});let vt=()=>ke.forEach(ae=>Me(ae.key));N.signal.addEventListener("abort",vt);let{loaderResults:gt,fetcherResults:W}=await ir(Ze,ke,Ie,b);if(N.signal.aborted)return;if(N.signal.removeEventListener("abort",vt),f.delete(c),q.delete(c),ke.forEach(ae=>q.delete(ae.key)),p.fetchers.has(c)){let ae=Oe(ee.data);p.fetchers.set(c,ae)}let pe=Et(gt);if(pe)return ze(Ie,pe.result,!1,{preventScrollReset:D});if(pe=Et(W),pe)return R.add(pe.key),ze(Ie,pe.result,!1,{preventScrollReset:D});let{loaderData:Ke,errors:He}=Fr(p,Ne,gt,void 0,ke,W);cr(xe),p.navigation.state==="loading"&&xe>fe?(k(j,"Expected pending action"),X&&X.abort(),Ve(p.navigation.location,{matches:Ne,loaderData:Ke,errors:He,fetchers:new Map(p.fetchers)})):(me({errors:He,loaderData:jr(p.loaderData,Ke,Ne,He),fetchers:new Map(p.fetchers)}),G=!1)}async function Fn(c,d,y,E,b,M,L,D,O){let U=p.fetchers.get(c);De(c,tt(O,U?U.data:void 0),{flushSync:L});let F=new AbortController,N=qe(e.history,y,F.signal);if(M){let ee=await yt(E,new URL(N.url).pathname,N.signal,c);if(ee.type==="aborted")return;if(ee.type==="error"){Te(c,d,ee.error,{flushSync:L});return}else if(ee.matches)E=ee.matches;else{Te(c,d,be(404,{pathname:y}),{flushSync:L});return}}let V=Ct(E,y);q.set(c,F);let K=oe,ce=Je(a,i,N,E,V,n,b),ge=(await Xe(N,ce,b,c))[V.route.id];if(q.get(c)===F&&q.delete(c),!N.signal.aborted){if(z.has(c)){De(c,Oe(void 0));return}if(Be(ge))if(fe>K){De(c,Oe(void 0));return}else{R.add(c),await ze(N,ge,!1,{preventScrollReset:D});return}if(Re(ge)){Te(c,d,ge.error);return}De(c,Oe(ge.data))}}async function ze(c,d,y,{submission:E,fetcherSubmission:b,preventScrollReset:M,replace:L}={}){y||(B?.resolve(),B=null),d.response.headers.has("X-Remix-Revalidate")&&(G=!0);let D=d.response.headers.get("Location");k(D,"Expected a Location header on the redirect Response"),D=$r(D,new URL(c.url),l,e.history);let O=it(p.location,D,{_isRedirect:!0});if(r){let ce=!1;if(d.response.headers.has("X-Remix-Reload-Document"))ce=!0;else if(Vt(D)){const se=Qr(D,!0);ce=se.origin!==t.location.origin||Ce(se.pathname,l)==null}if(ce){L?t.location.replace(D):t.location.assign(D);return}}X=null;let U=L===!0||d.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:F,formAction:N,formEncType:V}=p.navigation;!E&&!b&&F&&N&&V&&(E=kr(p.navigation));let K=E||b;if($a.has(d.response.status)&&K&&ve(K.formMethod))await je(U,O,{submission:{...K,formAction:D},preventScrollReset:M||re,enableViewTransition:y?le:void 0});else{let ce=zt(O,E);await je(U,O,{overrideNavigation:ce,fetcherSubmission:b,preventScrollReset:M||re,enableViewTransition:y?le:void 0})}}async function Xe(c,d,y,E){let b,M={};try{b=await Ya(h,c,d,E,y,!1)}catch(L){return d.filter(D=>D.shouldLoad).forEach(D=>{M[D.route.id]={type:"error",error:L}}),M}if(c.signal.aborted)return M;if(!ve(c.method))for(let L of d){if(b[L.route.id]?.type==="error")break;!b.hasOwnProperty(L.route.id)&&!p.loaderData.hasOwnProperty(L.route.id)&&(!p.errors||!p.errors.hasOwnProperty(L.route.id))&&L.shouldCallHandler()&&(b[L.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${L.route.id}`)})}for(let[L,D]of Object.entries(b))if(to(D)){let O=D.result;M[L]={type:"redirect",response:Ga(O,c,L,d,l)}}else M[L]=await qa(D);return M}async function ir(c,d,y,E){let b=Xe(y,c,E,null),M=Promise.all(d.map(async O=>{if(O.matches&&O.match&&O.request&&O.controller){let F=(await Xe(O.request,O.matches,E,O.key))[O.match.route.id];return{[O.key]:F}}else return Promise.resolve({[O.key]:{type:"error",error:be(404,{pathname:O.path})}})})),L=await b,D=(await M).reduce((O,U)=>Object.assign(O,U),{});return{loaderResults:L,fetcherResults:D}}function Tt(){G=!0,A.forEach((c,d)=>{q.has(d)&&ue.add(d),Me(d)})}function De(c,d,y={}){p.fetchers.set(c,d),me({fetchers:new Map(p.fetchers)},{flushSync:(y&&y.flushSync)===!0})}function Te(c,d,y,E={}){let b=Ue(p.matches,d);Mt(c),me({errors:{[b.route.id]:y},fetchers:new Map(p.fetchers)},{flushSync:(E&&E.flushSync)===!0})}function lr(c){return T.set(c,(T.get(c)||0)+1),z.has(c)&&z.delete(c),p.fetchers.get(c)||Ua}function jn(c,d){Me(c,d?.reason),De(c,Oe(null))}function Mt(c){let d=p.fetchers.get(c);q.has(c)&&!(d&&d.state==="loading"&&f.has(c))&&Me(c),A.delete(c),f.delete(c),R.delete(c),z.delete(c),ue.delete(c),p.fetchers.delete(c)}function zn(c){let d=(T.get(c)||0)-1;d<=0?(T.delete(c),z.add(c)):T.set(c,d),me({fetchers:new Map(p.fetchers)})}function Me(c,d){let y=q.get(c);y&&(y.abort(d),q.delete(c))}function sr(c){for(let d of c){let y=lr(d),E=Oe(y.data);p.fetchers.set(d,E)}}function ur(){let c=[],d=!1;for(let y of R){let E=p.fetchers.get(y);k(E,`Expected fetcher: ${y}`),E.state==="loading"&&(R.delete(y),c.push(y),d=!0)}return sr(c),d}function cr(c){let d=[];for(let[y,E]of f)if(E<c){let b=p.fetchers.get(y);k(b,`Expected fetcher: ${y}`),b.state==="loading"&&(Me(y),f.delete(y),d.push(y))}return sr(d),d.length>0}function In(c,d){let y=p.blockers.get(c)||et;return H.get(c)!==d&&H.set(c,d),y}function fr(c){p.blockers.delete(c),H.delete(c)}function mt(c,d){let y=p.blockers.get(c)||et;k(y.state==="unblocked"&&d.state==="blocked"||y.state==="blocked"&&d.state==="blocked"||y.state==="blocked"&&d.state==="proceeding"||y.state==="blocked"&&d.state==="unblocked"||y.state==="proceeding"&&d.state==="unblocked",`Invalid blocker state transition: ${y.state} -> ${d.state}`);let E=new Map(p.blockers);E.set(c,d),me({blockers:E})}function dr({currentLocation:c,nextLocation:d,historyAction:y}){if(H.size===0)return;H.size>1&&ie(!1,"A router only supports one blocker at a time");let E=Array.from(H.entries()),[b,M]=E[E.length-1],L=p.blockers.get(b);if(!(L&&L.state==="proceeding")&&M({currentLocation:c,nextLocation:d,historyAction:y}))return b}function Ot(c){let d=be(404,{pathname:c}),y=s||u,{matches:E,route:b}=Rt(y);return{notFoundMatches:E,route:b,error:d}}function kn(c,d,y){if(S=c,x=d,P=y||null,!_&&p.navigation===jt){_=!0;let E=mr(p.location,p.matches);E!=null&&me({restoreScrollPosition:E})}return()=>{S=null,x=null,P=null}}function hr(c,d){return P&&P(c,d.map(E=>sa(E,p.loaderData)))||c.key}function Hn(c,d){if(S&&x){let y=hr(c,d);S[y]=x()}}function mr(c,d){if(S){let y=hr(c,d),E=S[y];if(typeof E=="number")return E}return null}function pt(c,d,y){if(e.patchRoutesOnNavigation)if(c){if(Object.keys(c[0].params).length>0)return{active:!0,matches:at(d,y,l,!0)}}else return{active:!0,matches:at(d,y,l,!0)||[]};return{active:!1,matches:null}}async function yt(c,d,y,E){if(!e.patchRoutesOnNavigation)return{type:"success",matches:c};let b=c;for(;;){let M=s==null,L=s||u,D=i;try{await e.patchRoutesOnNavigation({signal:y,path:d,matches:b,fetcherKey:E,patch:(F,N)=>{y.aborted||Mr(F,N,L,D,a,!1)}})}catch(F){return{type:"error",error:F,partialMatches:b}}finally{M&&!y.aborted&&(u=[...u])}if(y.aborted)return{type:"aborted"};let O=$e(L,d,l),U=null;if(O){if(Object.keys(O[0].params).length===0)return{type:"success",matches:O};if(U=at(L,d,l,!0),!(U&&b.length<U.length&&pr(b,U.slice(0,b.length))))return{type:"success",matches:O}}if(U||(U=at(L,d,l,!0)),!U||pr(b,U))return{type:"success",matches:null};b=U}}function pr(c,d){return c.length===d.length&&c.every((y,E)=>y.route.id===d[E].route.id)}function Bn(c){i={},s=lt(c,a,void 0,i)}function Wn(c,d,y=!1){let E=s==null;Mr(c,d,s||u,i,a,y),E&&(u=[...u],me({}))}return te={get basename(){return l},get future(){return m},get state(){return p},get routes(){return u},get window(){return t},initialize:he,subscribe:Tn,enableScrollRestoration:kn,navigate:ar,fetch:$n,revalidate:Mn,createHref:c=>e.history.createHref(c),encodeLocation:c=>e.history.encodeLocation(c),getFetcher:lr,resetFetcher:jn,deleteFetcher:zn,dispose:Dt,getBlocker:In,deleteBlocker:fr,patchRoutes:Wn,_internalFetchControllers:q,_internalSetRoutes:Bn,_internalSetStateDoNotUseOrYouWillBreakYourApp(c){me(c)}},e.unstable_instrumentations&&(te=_a(te,e.unstable_instrumentations.map(c=>c.router).filter(Boolean))),te}function za(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function Ht(e,t,r,n,o,a){let i,u;if(o){i=[];for(let l of t)if(i.push(l),l.route.id===o){u=l;break}}else i=t,u=t[t.length-1];let s=qt(n||".",Kt(i),Ce(e.pathname,r)||e.pathname,a==="path");if(n==null&&(s.search=e.search,s.hash=e.hash),(n==null||n===""||n===".")&&u){let l=Xt(s.search);if(u.route.index&&!l)s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index";else if(!u.route.index&&l){let h=new URLSearchParams(s.search),m=h.getAll("index");h.delete("index"),m.filter(g=>g).forEach(g=>h.append("index",g));let w=h.toString();s.search=w?`?${w}`:""}}return r!=="/"&&(s.pathname=Ea({basename:r,pathname:s.pathname})),Le(s)}function Dr(e,t,r){if(!r||!za(r))return{path:t};if(r.formMethod&&!ao(r.formMethod))return{path:t,error:be(405,{method:r.formMethod})};let n=()=>({path:t,error:be(400,{type:"invalid-body"})}),a=(r.formMethod||"get").toUpperCase(),i=yn(t);if(r.body!==void 0){if(r.formEncType==="text/plain"){if(!ve(a))return n();let m=typeof r.body=="string"?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce((w,[g,S])=>`${w}${g}=${S}
|
|
2
|
+
`,""):String(r.body);return{path:t,submission:{formMethod:a,formAction:i,formEncType:r.formEncType,formData:void 0,json:void 0,text:m}}}else if(r.formEncType==="application/json"){if(!ve(a))return n();try{let m=typeof r.body=="string"?JSON.parse(r.body):r.body;return{path:t,submission:{formMethod:a,formAction:i,formEncType:r.formEncType,formData:void 0,json:m,text:void 0}}}catch{return n()}}}k(typeof FormData=="function","FormData is not available in this environment");let u,s;if(r.formData)u=Yt(r.formData),s=r.formData;else if(r.body instanceof FormData)u=Yt(r.body),s=r.body;else if(r.body instanceof URLSearchParams)u=r.body,s=Ur(u);else if(r.body==null)u=new URLSearchParams,s=new FormData;else try{u=new URLSearchParams(r.body),s=Ur(u)}catch{return n()}let l={formMethod:a,formAction:i,formEncType:r&&r.formEncType||"application/x-www-form-urlencoded",formData:s,json:void 0,text:void 0};if(ve(l.formMethod))return{path:t,submission:l};let h=Ae(t);return e&&h.search&&Xt(h.search)&&u.append("index",""),h.search=`?${u}`,{path:Le(h),submission:l}}function Tr(e,t,r,n,o,a,i,u,s,l,h,m,w,g,S,P,x,_,C,$,Z){let Y=$?Re($[1])?$[1].error:$[1].data:void 0,te=o.createURL(a.location),p=o.createURL(s),j;if(h&&a.errors){let Q=Object.keys(a.errors)[0];j=i.findIndex(G=>G.route.id===Q)}else if($&&Re($[1])){let Q=$[0];j=i.findIndex(G=>G.route.id===Q)-1}let B=$?$[1].statusCode:void 0,re=B&&B>=400,X={currentUrl:te,currentParams:a.matches[0]?.params||{},nextUrl:p,nextParams:i[0].params,...u,actionResult:Y,actionStatus:B},le=ct(i),we=i.map((Q,G)=>{let{route:ue}=Q,q=null;if(j!=null&&G>j?q=!1:ue.lazy?q=!0:Gt(ue)?h?q=Bt(ue,a.loaderData,a.errors):Ia(a.loaderData,a.matches[G],Q)&&(q=!0):q=!1,q!==null)return Wt(r,n,e,le,Q,l,t,q);let oe=!1;typeof Z=="boolean"?oe=Z:re?oe=!1:(m||te.pathname+te.search===p.pathname+p.search||te.search!==p.search||ka(a.matches[G],Q))&&(oe=!0);let fe={...X,defaultShouldRevalidate:oe},f=ot(Q,fe);return Wt(r,n,e,le,Q,l,t,f,fe,Z)}),ne=[];return S.forEach((Q,G)=>{if(h||!i.some(T=>T.route.id===Q.routeId)||g.has(G))return;let ue=a.fetchers.get(G),q=ue&&ue.state!=="idle"&&ue.data===void 0,oe=$e(x,Q.path,_);if(!oe){if(C&&q)return;ne.push({key:G,routeId:Q.routeId,path:Q.path,matches:null,match:null,request:null,controller:null});return}if(P.has(G))return;let fe=Ct(oe,Q.path),f=new AbortController,R=qe(o,Q.path,f.signal),A=null;if(w.has(G))w.delete(G),A=Je(r,n,R,oe,fe,l,t);else if(q)m&&(A=Je(r,n,R,oe,fe,l,t));else{let T;typeof Z=="boolean"?T=Z:re?T=!1:T=m;let z={...X,defaultShouldRevalidate:T};ot(fe,z)&&(A=Je(r,n,R,oe,fe,l,t,z))}A&&ne.push({key:G,routeId:Q.routeId,path:Q.path,matches:A,match:fe,request:R,controller:f})}),{dsMatches:we,revalidatingFetchers:ne}}function Gt(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function Bt(e,t,r){if(e.lazy)return!0;if(!Gt(e))return!1;let n=t!=null&&e.id in t,o=r!=null&&r[e.id]!==void 0;return!n&&o?!1:typeof e.loader=="function"&&e.loader.hydrate===!0?!0:!n&&!o}function Ia(e,t,r){let n=!t||r.route.id!==t.route.id,o=!e.hasOwnProperty(r.route.id);return n||o}function ka(e,t){let r=e.route.path;return e.pathname!==t.pathname||r!=null&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function ot(e,t){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(t);if(typeof r=="boolean")return r}return t.defaultShouldRevalidate}function Mr(e,t,r,n,o,a){let i;if(e){let l=n[e];k(l,`No route found to patch children into: routeId = ${e}`),l.children||(l.children=[]),i=l.children}else i=r;let u=[],s=[];if(t.forEach(l=>{let h=i.find(m=>fn(l,m));h?s.push({existingRoute:h,newRoute:l}):u.push(l)}),u.length>0){let l=lt(u,o,[e||"_","patch",String(i?.length||"0")],n);i.push(...l)}if(a&&s.length>0)for(let l=0;l<s.length;l++){let{existingRoute:h,newRoute:m}=s[l],w=h,[g]=lt([m],o,[],{},!0);Object.assign(w,{element:g.element?g.element:w.element,errorElement:g.errorElement?g.errorElement:w.errorElement,hydrateFallbackElement:g.hydrateFallbackElement?g.hydrateFallbackElement:w.hydrateFallbackElement})}}function fn(e,t){return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children.every((r,n)=>t.children?.some(o=>fn(r,o))):!1}var Or=new WeakMap,dn=({key:e,route:t,manifest:r,mapRouteProperties:n})=>{let o=r[t.id];if(k(o,"No route found in manifest"),!o.lazy||typeof o.lazy!="object")return;let a=o.lazy[e];if(!a)return;let i=Or.get(o);i||(i={},Or.set(o,i));let u=i[e];if(u)return u;let s=(async()=>{let l=aa(e),m=o[e]!==void 0&&e!=="hasErrorBoundary";if(l)ie(!l,"Route property "+e+" is not a supported lazy route property. This property will be ignored."),i[e]=Promise.resolve();else if(m)ie(!1,`Route "${o.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let w=await a();w!=null&&(Object.assign(o,{[e]:w}),Object.assign(o,n(o)))}typeof o.lazy=="object"&&(o.lazy[e]=void 0,Object.values(o.lazy).every(w=>w===void 0)&&(o.lazy=void 0))})();return i[e]=s,s},Ar=new WeakMap;function Ha(e,t,r,n,o){let a=r[e.id];if(k(a,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy=="function"){let h=Ar.get(a);if(h)return{lazyRoutePromise:h,lazyHandlerPromise:h};let m=(async()=>{k(typeof e.lazy=="function","No lazy route function found");let w=await e.lazy(),g={};for(let S in w){let P=w[S];if(P===void 0)continue;let x=ia(S),C=a[S]!==void 0&&S!=="hasErrorBoundary";x?ie(!x,"Route property "+S+" is not a supported property to be returned from a lazy route function. This property will be ignored."):C?ie(!C,`Route "${a.id}" has a static property "${S}" defined but its lazy function is also returning a value for this property. The lazy route property "${S}" will be ignored.`):g[S]=P}Object.assign(a,g),Object.assign(a,{...n(a),lazy:void 0})})();return Ar.set(a,m),m.catch(()=>{}),{lazyRoutePromise:m,lazyHandlerPromise:m}}let i=Object.keys(e.lazy),u=[],s;for(let h of i){if(o&&o.includes(h))continue;let m=dn({key:h,route:e,manifest:r,mapRouteProperties:n});m&&(u.push(m),h===t&&(s=m))}let l=u.length>0?Promise.all(u).then(()=>{}):void 0;return l?.catch(()=>{}),s?.catch(()=>{}),{lazyRoutePromise:l,lazyHandlerPromise:s}}async function Nr(e){let t=e.matches.filter(o=>o.shouldLoad),r={};return(await Promise.all(t.map(o=>o.resolve()))).forEach((o,a)=>{r[t[a].route.id]=o}),r}async function Ba(e){return e.matches.some(t=>t.route.middleware)?hn(e,()=>Nr(e)):Nr(e)}function hn(e,t){return Wa(e,t,n=>{if(no(n))throw n;return n},Za,r);function r(n,o,a){if(a)return Promise.resolve(Object.assign(a.value,{[o]:{type:"error",result:n}}));{let{matches:i}=e,u=Math.min(Math.max(i.findIndex(l=>l.route.id===o),0),Math.max(i.findIndex(l=>l.shouldCallHandler()),0)),s=Ue(i,i[u].route.id).route.id;return Promise.resolve({[s]:{type:"error",result:n}})}}}async function Wa(e,t,r,n,o){let{matches:a,request:i,params:u,context:s,unstable_pattern:l}=e,h=a.flatMap(w=>w.route.middleware?w.route.middleware.map(g=>[w.route.id,g]):[]);return await mn({request:i,params:u,context:s,unstable_pattern:l},h,t,r,n,o)}async function mn(e,t,r,n,o,a,i=0){let{request:u}=e;if(u.signal.aborted)throw u.signal.reason??new Error(`Request aborted: ${u.method} ${u.url}`);let s=t[i];if(!s)return await r();let[l,h]=s,m,w=async()=>{if(m)throw new Error("You may only call `next()` once per middleware");try{return m={value:await mn(e,t,r,n,o,a,i+1)},m.value}catch(g){return m={value:await a(g,l,m)},m.value}};try{let g=await h(e,w),S=g!=null?n(g):void 0;return o(S)?S:m?S??m.value:(m={value:await w()},m.value)}catch(g){return await a(g,l,m)}}function pn(e,t,r,n,o){let a=dn({key:"middleware",route:n.route,manifest:t,mapRouteProperties:e}),i=Ha(n.route,ve(r.method)?"action":"loader",t,e,o);return{middleware:a,route:i.lazyRoutePromise,handler:i.lazyHandlerPromise}}function Wt(e,t,r,n,o,a,i,u,s=null,l){let h=!1,m=pn(e,t,r,o,a);return{...o,_lazyPromises:m,shouldLoad:u,shouldRevalidateArgs:s,shouldCallHandler(w){return h=!0,s?typeof l=="boolean"?ot(o,{...s,defaultShouldRevalidate:l}):typeof w=="boolean"?ot(o,{...s,defaultShouldRevalidate:w}):ot(o,s):u},resolve(w){let{lazy:g,loader:S,middleware:P}=o.route,x=h||u||w&&!ve(r.method)&&(g||S),_=P&&P.length>0&&!S&&!g;return x&&(ve(r.method)||!_)?Va({request:r,unstable_pattern:n,match:o,lazyHandlerPromise:m?.handler,lazyRoutePromise:m?.route,handlerOverride:w,scopedContext:i}):Promise.resolve({type:"data",result:void 0})}}}function Je(e,t,r,n,o,a,i,u=null){return n.map(s=>s.route.id!==o.route.id?{...s,shouldLoad:!1,shouldRevalidateArgs:u,shouldCallHandler:()=>!1,_lazyPromises:pn(e,t,r,s,a),resolve:()=>Promise.resolve({type:"data",result:void 0})}:Wt(e,t,r,ct(n),s,a,i,!0,u))}async function Ya(e,t,r,n,o,a){r.some(l=>l._lazyPromises?.middleware)&&await Promise.all(r.map(l=>l._lazyPromises?.middleware));let i={request:t,unstable_pattern:ct(r),params:r[0].params,context:o,matches:r},s=await e({...i,fetcherKey:n,runClientMiddleware:l=>{let h=i;return hn(h,()=>l({...h,fetcherKey:n,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(r.flatMap(l=>[l._lazyPromises?.handler,l._lazyPromises?.route]))}catch{}return s}async function Va({request:e,unstable_pattern:t,match:r,lazyHandlerPromise:n,lazyRoutePromise:o,handlerOverride:a,scopedContext:i}){let u,s,l=ve(e.method),h=l?"action":"loader",m=w=>{let g,S=new Promise((_,C)=>g=C);s=()=>g(),e.signal.addEventListener("abort",s);let P=_=>typeof w!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${h}" [routeId: ${r.route.id}]`)):w({request:e,unstable_pattern:t,params:r.params,context:i},..._!==void 0?[_]:[]),x=(async()=>{try{return{type:"data",result:await(a?a(C=>P(C)):P())}}catch(_){return{type:"error",result:_}}})();return Promise.race([x,S])};try{let w=l?r.route.action:r.route.loader;if(n||o)if(w){let g,[S]=await Promise.all([m(w).catch(P=>{g=P}),n,o]);if(g!==void 0)throw g;u=S}else{await n;let g=l?r.route.action:r.route.loader;if(g)[u]=await Promise.all([m(g),o]);else if(h==="action"){let S=new URL(e.url),P=S.pathname+S.search;throw be(405,{method:e.method,pathname:P,routeId:r.route.id})}else return{type:"data",result:void 0}}else if(w)u=await m(w);else{let g=new URL(e.url),S=g.pathname+g.search;throw be(404,{pathname:S})}}catch(w){return{type:"error",result:w}}finally{s&&e.signal.removeEventListener("abort",s)}return u}async function Ka(e){let t=e.headers.get("Content-Type");return t&&/\bapplication\/json\b/.test(t)?e.body==null?null:e.json():e.text()}async function qa(e){let{result:t,type:r}=e;if(Jt(t)){let n;try{n=await Ka(t)}catch(o){return{type:"error",error:o}}return r==="error"?{type:"error",error:new ut(t.status,t.statusText,n),statusCode:t.status,headers:t.headers}:{type:"data",data:n,statusCode:t.status,headers:t.headers}}return r==="error"?Ir(t)?t.data instanceof Error?{type:"error",error:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"error",error:Qa(t),statusCode:st(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"error",error:t,statusCode:st(t)?t.status:void 0}:Ir(t)?{type:"data",data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"data",data:t}}function Ga(e,t,r,n,o){let a=e.headers.get("Location");if(k(a,"Redirects returned/thrown from loaders/actions must have a Location header"),!Vt(a)){let i=n.slice(0,n.findIndex(u=>u.route.id===r)+1);a=Ht(new URL(t.url),i,o,a),e.headers.set("Location",a)}return e}function $r(e,t,r,n){let o=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];if(Vt(e)){let a=e,i=a.startsWith("//")?new URL(t.protocol+a):new URL(a);if(o.includes(i.protocol))throw new Error("Invalid redirect location");let u=Ce(i.pathname,r)!=null;if(i.origin===t.origin&&u)return i.pathname+i.search+i.hash}try{let a=n.createURL(e);if(o.includes(a.protocol))throw new Error("Invalid redirect location")}catch{}return e}function qe(e,t,r,n){let o=e.createURL(yn(t)).toString(),a={signal:r};if(n&&ve(n.formMethod)){let{formMethod:i,formEncType:u}=n;a.method=i.toUpperCase(),u==="application/json"?(a.headers=new Headers({"Content-Type":u}),a.body=JSON.stringify(n.json)):u==="text/plain"?a.body=n.text:u==="application/x-www-form-urlencoded"&&n.formData?a.body=Yt(n.formData):a.body=n.formData}return new Request(o,a)}function Yt(e){let t=new URLSearchParams;for(let[r,n]of e.entries())t.append(r,typeof n=="string"?n:n.name);return t}function Ur(e){let t=new FormData;for(let[r,n]of e.entries())t.append(r,n);return t}function Ja(e,t,r,n=!1,o=!1){let a={},i=null,u,s=!1,l={},h=r&&Re(r[1])?r[1].error:void 0;return e.forEach(m=>{if(!(m.route.id in t))return;let w=m.route.id,g=t[w];if(k(!Be(g),"Cannot handle redirect results in processLoaderData"),Re(g)){let S=g.error;if(h!==void 0&&(S=h,h=void 0),i=i||{},o)i[w]=S;else{let P=Ue(e,w);i[P.route.id]==null&&(i[P.route.id]=S)}n||(a[w]=cn),s||(s=!0,u=st(g.error)?g.error.status:500),g.headers&&(l[w]=g.headers)}else a[w]=g.data,g.statusCode&&g.statusCode!==200&&!s&&(u=g.statusCode),g.headers&&(l[w]=g.headers)}),h!==void 0&&r&&(i={[r[0]]:h},r[2]&&(a[r[2]]=void 0)),{loaderData:a,errors:i,statusCode:u||200,loaderHeaders:l}}function Fr(e,t,r,n,o,a){let{loaderData:i,errors:u}=Ja(t,r,n);return o.filter(s=>!s.matches||s.matches.some(l=>l.shouldLoad)).forEach(s=>{let{key:l,match:h,controller:m}=s;if(m&&m.signal.aborted)return;let w=a[l];if(k(w,"Did not find corresponding fetcher result"),Re(w)){let g=Ue(e.matches,h?.route.id);u&&u[g.route.id]||(u={...u,[g.route.id]:w.error}),e.fetchers.delete(l)}else if(Be(w))k(!1,"Unhandled fetcher revalidation redirect");else{let g=Oe(w.data);e.fetchers.set(l,g)}}),{loaderData:i,errors:u}}function jr(e,t,r,n){let o=Object.entries(t).filter(([,a])=>a!==cn).reduce((a,[i,u])=>(a[i]=u,a),{});for(let a of r){let i=a.route.id;if(!t.hasOwnProperty(i)&&e.hasOwnProperty(i)&&a.route.loader&&(o[i]=e[i]),n&&n.hasOwnProperty(i))break}return o}function zr(e){return e?Re(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function Ue(e,t){return(t?e.slice(0,e.findIndex(n=>n.route.id===t)+1):[...e]).reverse().find(n=>n.route.hasErrorBoundary===!0)||e[0]}function Rt(e){let t=e.length===1?e[0]:e.find(r=>r.index||!r.path||r.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function be(e,{pathname:t,routeId:r,method:n,type:o,message:a}={}){let i="Unknown Server Error",u="Unknown @remix-run/router error";return e===400?(i="Bad Request",n&&t&&r?u=`You made a ${n} request to "${t}" but did not provide a \`loader\` for route "${r}", so there is no way to handle the request.`:o==="invalid-body"&&(u="Unable to encode submission body")):e===403?(i="Forbidden",u=`Route "${r}" does not match URL "${t}"`):e===404?(i="Not Found",u=`No route matches URL "${t}"`):e===405&&(i="Method Not Allowed",n&&t&&r?u=`You made a ${n.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${r}", so there is no way to handle the request.`:n&&(u=`Invalid request method "${n.toUpperCase()}"`)),new ut(e||500,i,new Error(u),!0)}function Et(e){let t=Object.entries(e);for(let r=t.length-1;r>=0;r--){let[n,o]=t[r];if(Be(o))return{key:n,result:o}}}function yn(e){let t=typeof e=="string"?Ae(e):e;return Le({...t,hash:""})}function Xa(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function Qa(e){return new ut(e.init?.status??500,e.init?.statusText??"Internal Server Error",e.data)}function Za(e){return e!=null&&typeof e=="object"&&Object.entries(e).every(([t,r])=>typeof t=="string"&&eo(r))}function eo(e){return e!=null&&typeof e=="object"&&"type"in e&&"result"in e&&(e.type==="data"||e.type==="error")}function to(e){return Jt(e.result)&&sn.has(e.result.status)}function Re(e){return e.type==="error"}function Be(e){return(e&&e.type)==="redirect"}function Ir(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function Jt(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function ro(e){return sn.has(e)}function no(e){return Jt(e)&&ro(e.status)&&e.headers.has("Location")}function ao(e){return Na.has(e.toUpperCase())}function ve(e){return Oa.has(e.toUpperCase())}function Xt(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function Ct(e,t){let r=typeof t=="string"?Ae(t).search:t.search;if(e[e.length-1].route.index&&Xt(r||""))return e[e.length-1];let n=rn(e);return n[n.length-1]}function kr(e){let{formMethod:t,formAction:r,formEncType:n,text:o,formData:a,json:i}=e;if(!(!t||!r||!n)){if(o!=null)return{formMethod:t,formAction:r,formEncType:n,formData:void 0,json:void 0,text:o};if(a!=null)return{formMethod:t,formAction:r,formEncType:n,formData:a,json:void 0,text:void 0};if(i!==void 0)return{formMethod:t,formAction:r,formEncType:n,formData:void 0,json:i,text:void 0}}}function zt(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function oo(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function tt(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function io(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function Oe(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function lo(e,t){try{let r=e.sessionStorage.getItem(un);if(r){let n=JSON.parse(r);for(let[o,a]of Object.entries(n||{}))a&&Array.isArray(a)&&t.set(o,new Set(a||[]))}}catch{}}function so(e,t){if(t.size>0){let r={};for(let[n,o]of t)r[n]=[...o];try{e.sessionStorage.setItem(un,JSON.stringify(r))}catch(n){ie(!1,`Failed to save applied view transitions in sessionStorage (${n}).`)}}}function Hr(){let e,t,r=new Promise((n,o)=>{e=async a=>{n(a);try{await r}catch{}},t=async a=>{o(a);try{await r}catch{}}});return{promise:r,resolve:e,reject:t}}var We=v.createContext(null);We.displayName="DataRouter";var ft=v.createContext(null);ft.displayName="DataRouterState";var vn=v.createContext(!1);function uo(){return v.useContext(vn)}var Qt=v.createContext({isTransitioning:!1});Qt.displayName="ViewTransition";var gn=v.createContext(new Map);gn.displayName="Fetchers";var co=v.createContext(null);co.displayName="Await";var Se=v.createContext(null);Se.displayName="Navigation";var _t=v.createContext(null);_t.displayName="Location";var Pe=v.createContext({outlet:null,matches:[],isDataRoute:!1});Pe.displayName="Route";var Zt=v.createContext(null);Zt.displayName="RouteError";var wn="REACT_ROUTER_ERROR",fo="REDIRECT",ho="ROUTE_ERROR_RESPONSE";function mo(e){if(e.startsWith(`${wn}:${fo}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function po(e){if(e.startsWith(`${wn}:${ho}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new ut(t.status,t.statusText,t.data)}catch{}}function yo(e,{relative:t}={}){k(dt(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:n}=v.useContext(Se),{hash:o,pathname:a,search:i}=ht(e,{relative:t}),u=a;return r!=="/"&&(u=a==="/"?r:_e([r,a])),n.createHref({pathname:u,search:i,hash:o})}function dt(){return v.useContext(_t)!=null}function Ye(){return k(dt(),"useLocation() may be used only in the context of a <Router> component."),v.useContext(_t).location}var Rn="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function En(e){v.useContext(Se).static||v.useLayoutEffect(e)}function vo(){let{isDataRoute:e}=v.useContext(Pe);return e?Oo():go()}function go(){k(dt(),"useNavigate() may be used only in the context of a <Router> component.");let e=v.useContext(We),{basename:t,navigator:r}=v.useContext(Se),{matches:n}=v.useContext(Pe),{pathname:o}=Ye(),a=JSON.stringify(Kt(n)),i=v.useRef(!1);return En(()=>{i.current=!0}),v.useCallback((s,l={})=>{if(ie(i.current,Rn),!i.current)return;if(typeof s=="number"){r.go(s);return}let h=qt(s,JSON.parse(a),o,l.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:_e([t,h.pathname])),(l.replace?r.replace:r.push)(h,l.state,l)},[t,r,a,o,e])}var wo=v.createContext(null);function Ro(e){let t=v.useContext(Pe).outlet;return v.useMemo(()=>t&&v.createElement(wo.Provider,{value:e},t),[t,e])}function Ci(){let{matches:e}=v.useContext(Pe),t=e[e.length-1];return t?t.params:{}}function ht(e,{relative:t}={}){let{matches:r}=v.useContext(Pe),{pathname:n}=Ye(),o=JSON.stringify(Kt(r));return v.useMemo(()=>qt(e,JSON.parse(o),n,t==="path"),[e,o,n,t])}function Eo(e,t,r,n,o){k(dt(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=v.useContext(Se),{matches:i}=v.useContext(Pe),u=i[i.length-1],s=u?u.params:{},l=u?u.pathname:"/",h=u?u.pathnameBase:"/",m=u&&u.route;{let C=m&&m.path||"";Cn(l,!m||C.endsWith("*")||C.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${C}">) 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.
|
|
3
|
+
|
|
4
|
+
Please change the parent <Route path="${C}"> to <Route path="${C==="/"?"*":`${C}/*`}">.`)}let w=Ye(),g;g=w;let S=g.pathname||"/",P=S;if(h!=="/"){let C=h.replace(/^\//,"").split("/");P="/"+S.replace(/^\//,"").split("/").slice(C.length).join("/")}let x=$e(e,{pathname:P});return ie(m||x!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),ie(x==null||x[x.length-1].route.element!==void 0||x[x.length-1].route.Component!==void 0||x[x.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.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.`),xo(x&&x.map(C=>Object.assign({},C,{params:Object.assign({},s,C.params),pathname:_e([h,a.encodeLocation?a.encodeLocation(C.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?h:_e([h,a.encodeLocation?a.encodeLocation(C.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),i,r,n,o)}function bo(){let e=Mo(),t=st(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,n="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:n},a={padding:"2px 4px",backgroundColor:n},i=null;return console.error("Error handled by React Router default ErrorBoundary:",e),i=v.createElement(v.Fragment,null,v.createElement("p",null,"💿 Hey developer 👋"),v.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",v.createElement("code",{style:a},"ErrorBoundary")," or"," ",v.createElement("code",{style:a},"errorElement")," prop on your route.")),v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},t),r?v.createElement("pre",{style:o},r):null,i)}var Co=v.createElement(bo,null),bn=class extends v.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=po(e.digest);r&&(e=r)}let t=e!==void 0?v.createElement(Pe.Provider,{value:this.props.routeContext},v.createElement(Zt.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?v.createElement(So,{error:e},t):t}};bn.contextType=vn;var It=new WeakMap;function So({children:e,error:t}){let{basename:r}=v.useContext(Se);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let n=mo(t.digest);if(n){let o=It.get(t);if(o)throw o;let a=an(n.location,r);if(nn&&!It.get(t))if(a.isExternal||n.reloadDocument)window.location.href=a.absoluteURL||a.to;else{const i=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:n.replace}));throw It.set(t,i),i}return v.createElement("meta",{httpEquiv:"refresh",content:`0;url=${a.absoluteURL||a.to}`})}}return e}function Po({routeContext:e,match:t,children:r}){let n=v.useContext(We);return n&&n.static&&n.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(n.staticContext._deepestRenderedBoundaryId=t.route.id),v.createElement(Pe.Provider,{value:e},r)}function xo(e,t=[],r=null,n=null,o=null){if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let a=e,i=r?.errors;if(i!=null){let h=a.findIndex(m=>m.route.id&&i?.[m.route.id]!==void 0);k(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),a=a.slice(0,Math.min(a.length,h+1))}let u=!1,s=-1;if(r)for(let h=0;h<a.length;h++){let m=a[h];if((m.route.HydrateFallback||m.route.hydrateFallbackElement)&&(s=h),m.route.id){let{loaderData:w,errors:g}=r,S=m.route.loader&&!w.hasOwnProperty(m.route.id)&&(!g||g[m.route.id]===void 0);if(m.route.lazy||S){u=!0,s>=0?a=a.slice(0,s+1):a=[a[0]];break}}}let l=r&&n?(h,m)=>{n(h,{location:r.location,params:r.matches?.[0]?.params??{},unstable_pattern:ct(r.matches),errorInfo:m})}:void 0;return a.reduceRight((h,m,w)=>{let g,S=!1,P=null,x=null;r&&(g=i&&m.route.id?i[m.route.id]:void 0,P=m.route.errorElement||Co,u&&(s<0&&w===0?(Cn("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,x=null):s===w&&(S=!0,x=m.route.hydrateFallbackElement||null)));let _=t.concat(a.slice(0,w+1)),C=()=>{let $;return g?$=P:S?$=x:m.route.Component?$=v.createElement(m.route.Component,null):m.route.element?$=m.route.element:$=h,v.createElement(Po,{match:m,routeContext:{outlet:h,matches:_,isDataRoute:r!=null},children:$})};return r&&(m.route.ErrorBoundary||m.route.errorElement||w===0)?v.createElement(bn,{location:r.location,revalidation:r.revalidation,component:P,error:g,children:C(),routeContext:{outlet:null,matches:_,isDataRoute:!0},onError:l}):C()},null)}function er(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function _o(e){let t=v.useContext(We);return k(t,er(e)),t}function Lo(e){let t=v.useContext(ft);return k(t,er(e)),t}function Do(e){let t=v.useContext(Pe);return k(t,er(e)),t}function tr(e){let t=Do(e),r=t.matches[t.matches.length-1];return k(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function To(){return tr("useRouteId")}function Mo(){let e=v.useContext(Zt),t=Lo("useRouteError"),r=tr("useRouteError");return e!==void 0?e:t.errors?.[r]}function Oo(){let{router:e}=_o("useNavigate"),t=tr("useNavigate"),r=v.useRef(!1);return En(()=>{r.current=!0}),v.useCallback(async(o,a={})=>{ie(r.current,Rn),r.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:t,...a}))},[e,t])}var Br={};function Cn(e,t,r){!t&&!Br[e]&&(Br[e]=!0,ie(!1,r))}var Wr={};function Yr(e,t){!e&&!Wr[t]&&(Wr[t]=!0,console.warn(t))}var Ao="useOptimistic",Vr=Gn[Ao],No=()=>{};function $o(e){return Vr?Vr(e):[e,No]}function Uo(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&ie(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:v.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&ie(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:v.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&ie(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:v.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var Fo=["HydrateFallback","hydrateFallbackElement"],jo=class{constructor(){this.status="pending",this.promise=new Promise((e,t)=>{this.resolve=r=>{this.status==="pending"&&(this.status="resolved",e(r))},this.reject=r=>{this.status==="pending"&&(this.status="rejected",t(r))}})}};function zo({router:e,flushSync:t,onError:r,unstable_useTransitions:n}){n=uo()||n;let[a,i]=v.useState(e.state),[u,s]=$o(a),[l,h]=v.useState(),[m,w]=v.useState({isTransitioning:!1}),[g,S]=v.useState(),[P,x]=v.useState(),[_,C]=v.useState(),$=v.useRef(new Map),Z=v.useCallback((j,{deletedFetchers:B,newErrors:re,flushSync:X,viewTransitionOpts:le})=>{re&&r&&Object.values(re).forEach(ne=>r(ne,{location:j.location,params:j.matches[0]?.params??{},unstable_pattern:ct(j.matches)})),j.fetchers.forEach((ne,Q)=>{ne.data!==void 0&&$.current.set(Q,ne.data)}),B.forEach(ne=>$.current.delete(ne)),Yr(X===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let we=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition=="function";if(Yr(le==null||we,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!le||!we){t&&X?t(()=>i(j)):n===!1?i(j):v.startTransition(()=>{n===!0&&s(ne=>Kr(ne,j)),i(j)});return}if(t&&X){t(()=>{P&&(g?.resolve(),P.skipTransition()),w({isTransitioning:!0,flushSync:!0,currentLocation:le.currentLocation,nextLocation:le.nextLocation})});let ne=e.window.document.startViewTransition(()=>{t(()=>i(j))});ne.finished.finally(()=>{t(()=>{S(void 0),x(void 0),h(void 0),w({isTransitioning:!1})})}),t(()=>x(ne));return}P?(g?.resolve(),P.skipTransition(),C({state:j,currentLocation:le.currentLocation,nextLocation:le.nextLocation})):(h(j),w({isTransitioning:!0,flushSync:!1,currentLocation:le.currentLocation,nextLocation:le.nextLocation}))},[e.window,t,P,g,n,s,r]);v.useLayoutEffect(()=>e.subscribe(Z),[e,Z]),v.useEffect(()=>{m.isTransitioning&&!m.flushSync&&S(new jo)},[m]),v.useEffect(()=>{if(g&&l&&e.window){let j=l,B=g.promise,re=e.window.document.startViewTransition(async()=>{n===!1?i(j):v.startTransition(()=>{n===!0&&s(X=>Kr(X,j)),i(j)}),await B});re.finished.finally(()=>{S(void 0),x(void 0),h(void 0),w({isTransitioning:!1})}),x(re)}},[l,g,e.window,n,s]),v.useEffect(()=>{g&&l&&u.location.key===l.location.key&&g.resolve()},[g,P,u.location,l]),v.useEffect(()=>{!m.isTransitioning&&_&&(h(_.state),w({isTransitioning:!0,flushSync:!1,currentLocation:_.currentLocation,nextLocation:_.nextLocation}),C(void 0))},[m.isTransitioning,_]);let Y=v.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:j=>e.navigate(j),push:(j,B,re)=>e.navigate(j,{state:B,preventScrollReset:re?.preventScrollReset}),replace:(j,B,re)=>e.navigate(j,{replace:!0,state:B,preventScrollReset:re?.preventScrollReset})}),[e]),te=e.basename||"/",p=v.useMemo(()=>({router:e,navigator:Y,static:!1,basename:te,onError:r}),[e,Y,te,r]);return v.createElement(v.Fragment,null,v.createElement(We.Provider,{value:p},v.createElement(ft.Provider,{value:u},v.createElement(gn.Provider,{value:$.current},v.createElement(Qt.Provider,{value:m},v.createElement(Ho,{basename:te,location:u.location,navigationType:u.historyAction,navigator:Y,unstable_useTransitions:n},v.createElement(Io,{routes:e.routes,future:e.future,state:u,onError:r})))))),null)}function Kr(e,t){return{...e,navigation:t.navigation.state!=="idle"?t.navigation:e.navigation,revalidation:t.revalidation!=="idle"?t.revalidation:e.revalidation,actionData:t.navigation.state!=="submitting"?t.actionData:e.actionData,fetchers:t.fetchers}}var Io=v.memo(ko);function ko({routes:e,future:t,state:r,onError:n}){return Eo(e,void 0,r,n,t)}function Si(e){return Ro(e.context)}function Ho({basename:e="/",children:t=null,location:r,navigationType:n="POP",navigator:o,static:a=!1,unstable_useTransitions:i}){k(!dt(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let u=e.replace(/^\/*/,"/"),s=v.useMemo(()=>({basename:u,navigator:o,static:a,unstable_useTransitions:i,future:{}}),[u,o,a,i]);typeof r=="string"&&(r=Ae(r));let{pathname:l="/",search:h="",hash:m="",state:w=null,key:g="default"}=r,S=v.useMemo(()=>{let P=Ce(l,u);return P==null?null:{location:{pathname:P,search:h,hash:m,state:w,key:g},navigationType:n}},[u,l,h,m,w,g,n]);return ie(S!=null,`<Router basename="${u}"> is not able to match the URL "${l}${h}${m}" because it does not start with the basename, so the <Router> won't render anything.`),S==null?null:v.createElement(Se.Provider,{value:s},v.createElement(_t.Provider,{children:t,value:S}))}var St="get",Pt="application/x-www-form-urlencoded";function Lt(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function Bo(e){return Lt(e)&&e.tagName.toLowerCase()==="button"}function Wo(e){return Lt(e)&&e.tagName.toLowerCase()==="form"}function Yo(e){return Lt(e)&&e.tagName.toLowerCase()==="input"}function Vo(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Ko(e,t){return e.button===0&&(!t||t==="_self")&&!Vo(e)}var bt=null;function qo(){if(bt===null)try{new FormData(document.createElement("form"),0),bt=!1}catch{bt=!0}return bt}var Go=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function kt(e){return e!=null&&!Go.has(e)?(ie(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Pt}"`),null):e}function Jo(e,t){let r,n,o,a,i;if(Wo(e)){let u=e.getAttribute("action");n=u?Ce(u,t):null,r=e.getAttribute("method")||St,o=kt(e.getAttribute("enctype"))||Pt,a=new FormData(e)}else if(Bo(e)||Yo(e)&&(e.type==="submit"||e.type==="image")){let u=e.form;if(u==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let s=e.getAttribute("formaction")||u.getAttribute("action");if(n=s?Ce(s,t):null,r=e.getAttribute("formmethod")||u.getAttribute("method")||St,o=kt(e.getAttribute("formenctype"))||kt(u.getAttribute("enctype"))||Pt,a=new FormData(u,e),!qo()){let{name:l,type:h,value:m}=e;if(h==="image"){let w=l?`${l}.`:"";a.append(`${w}x`,"0"),a.append(`${w}y`,"0")}else l&&a.append(l,m)}}else{if(Lt(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=St,n=null,o=Pt,i=e}return a&&o==="text/plain"&&(i=a,a=void 0),{action:n,method:r.toLowerCase(),encType:o,formData:a,body:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function rr(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Xo(e,t,r,n){let o=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${n}`:o.pathname=`${o.pathname}.${n}`:o.pathname==="/"?o.pathname=`_root.${n}`:t&&Ce(o.pathname,t)==="/"?o.pathname=`${t.replace(/\/$/,"")}/_root.${n}`:o.pathname=`${o.pathname.replace(/\/$/,"")}.${n}`,o}async function Qo(e,t){if(e.id in t)return t[e.id];try{let r=await import(e.module);return t[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Zo(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function ei(e,t,r){let n=await Promise.all(e.map(async o=>{let a=t.routes[o.route.id];if(a){let i=await Qo(a,r);return i.links?i.links():[]}return[]}));return ai(n.flat(1).filter(Zo).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function qr(e,t,r,n,o,a){let i=(s,l)=>r[l]?s.route.id!==r[l].route.id:!0,u=(s,l)=>r[l].pathname!==s.pathname||r[l].route.path?.endsWith("*")&&r[l].params["*"]!==s.params["*"];return a==="assets"?t.filter((s,l)=>i(s,l)||u(s,l)):a==="data"?t.filter((s,l)=>{let h=n.routes[s.route.id];if(!h||!h.hasLoader)return!1;if(i(s,l)||u(s,l))return!0;if(s.route.shouldRevalidate){let m=s.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:r[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:s.params,defaultShouldRevalidate:!0});if(typeof m=="boolean")return m}return!0}):[]}function ti(e,t,{includeHydrateFallback:r}={}){return ri(e.map(n=>{let o=t.routes[n.route.id];if(!o)return[];let a=[o.module];return o.clientActionModule&&(a=a.concat(o.clientActionModule)),o.clientLoaderModule&&(a=a.concat(o.clientLoaderModule)),r&&o.hydrateFallbackModule&&(a=a.concat(o.hydrateFallbackModule)),o.imports&&(a=a.concat(o.imports)),a}).flat(1))}function ri(e){return[...new Set(e)]}function ni(e){let t={},r=Object.keys(e).sort();for(let n of r)t[n]=e[n];return t}function ai(e,t){let r=new Set;return new Set(t),e.reduce((n,o)=>{let a=JSON.stringify(ni(o));return r.has(a)||(r.add(a),n.push({key:a,link:o})),n},[])}function Sn(){let e=v.useContext(We);return rr(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function oi(){let e=v.useContext(ft);return rr(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var nr=v.createContext(void 0);nr.displayName="FrameworkContext";function Pn(){let e=v.useContext(nr);return rr(e,"You must render this element inside a <HydratedRouter> element"),e}function ii(e,t){let r=v.useContext(nr),[n,o]=v.useState(!1),[a,i]=v.useState(!1),{onFocus:u,onBlur:s,onMouseEnter:l,onMouseLeave:h,onTouchStart:m}=t,w=v.useRef(null);v.useEffect(()=>{if(e==="render"&&i(!0),e==="viewport"){let P=_=>{_.forEach(C=>{i(C.isIntersecting)})},x=new IntersectionObserver(P,{threshold:.5});return w.current&&x.observe(w.current),()=>{x.disconnect()}}},[e]),v.useEffect(()=>{if(n){let P=setTimeout(()=>{i(!0)},100);return()=>{clearTimeout(P)}}},[n]);let g=()=>{o(!0)},S=()=>{o(!1),i(!1)};return r?e!=="intent"?[a,w,{}]:[a,w,{onFocus:rt(u,g),onBlur:rt(s,S),onMouseEnter:rt(l,g),onMouseLeave:rt(h,S),onTouchStart:rt(m,g)}]:[!1,w,{}]}function rt(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function li({page:e,...t}){let{router:r}=Sn(),n=v.useMemo(()=>$e(r.routes,e,r.basename),[r.routes,e,r.basename]);return n?v.createElement(ui,{page:e,matches:n,...t}):null}function si(e){let{manifest:t,routeModules:r}=Pn(),[n,o]=v.useState([]);return v.useEffect(()=>{let a=!1;return ei(e,t,r).then(i=>{a||o(i)}),()=>{a=!0}},[e,t,r]),n}function ui({page:e,matches:t,...r}){let n=Ye(),{future:o,manifest:a,routeModules:i}=Pn(),{basename:u}=Sn(),{loaderData:s,matches:l}=oi(),h=v.useMemo(()=>qr(e,t,l,a,n,"data"),[e,t,l,a,n]),m=v.useMemo(()=>qr(e,t,l,a,n,"assets"),[e,t,l,a,n]),w=v.useMemo(()=>{if(e===n.pathname+n.search+n.hash)return[];let P=new Set,x=!1;if(t.forEach(C=>{let $=a.routes[C.route.id];!$||!$.hasLoader||(!h.some(Z=>Z.route.id===C.route.id)&&C.route.id in s&&i[C.route.id]?.shouldRevalidate||$.hasClientLoader?x=!0:P.add(C.route.id))}),P.size===0)return[];let _=Xo(e,u,o.unstable_trailingSlashAwareDataRequests,"data");return x&&P.size>0&&_.searchParams.set("_routes",t.filter(C=>P.has(C.route.id)).map(C=>C.route.id).join(",")),[_.pathname+_.search]},[u,o.unstable_trailingSlashAwareDataRequests,s,n,a,h,t,e,i]),g=v.useMemo(()=>ti(m,a),[m,a]),S=si(m);return v.createElement(v.Fragment,null,w.map(P=>v.createElement("link",{key:P,rel:"prefetch",as:"fetch",href:P,...r})),g.map(P=>v.createElement("link",{key:P,rel:"modulepreload",href:P,...r})),S.map(({key:P,link:x})=>v.createElement("link",{key:P,nonce:r.nonce,...x,crossOrigin:x.crossOrigin??r.crossOrigin})))}function ci(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var fi=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{fi&&(window.__reactRouterVersion="7.13.0")}catch{}function Pi(e,t){return ja({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:ea({window:t?.window}),hydrationData:t?.hydrationData||di(),routes:e,mapRouteProperties:Uo,hydrationRouteProperties:Fo,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,unstable_instrumentations:t?.unstable_instrumentations}).initialize()}function di(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:hi(e.errors)}),e}function hi(e){if(!e)return null;let t=Object.entries(e),r={};for(let[n,o]of t)if(o&&o.__type==="RouteErrorResponse")r[n]=new ut(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(o.__subType){let a=window[o.__subType];if(typeof a=="function")try{let i=new a(o.message);i.stack="",r[n]=i}catch{}}if(r[n]==null){let a=new Error(o.message);a.stack="",r[n]=a}}else r[n]=o;return r}var xn=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_n=v.forwardRef(function({onClick:t,discover:r="render",prefetch:n="none",relative:o,reloadDocument:a,replace:i,state:u,target:s,to:l,preventScrollReset:h,viewTransition:m,unstable_defaultShouldRevalidate:w,...g},S){let{basename:P,unstable_useTransitions:x}=v.useContext(Se),_=typeof l=="string"&&xn.test(l),C=an(l,P);l=C.to;let $=yo(l,{relative:o}),[Z,Y,te]=ii(n,g),p=vi(l,{replace:i,state:u,target:s,preventScrollReset:h,relative:o,viewTransition:m,unstable_defaultShouldRevalidate:w,unstable_useTransitions:x});function j(re){t&&t(re),re.defaultPrevented||p(re)}let B=v.createElement("a",{...g,...te,href:C.absoluteURL||$,onClick:C.isExternal||a?t:j,ref:ci(S,Y),target:s,"data-discover":!_&&r==="render"?"true":void 0});return Z&&!_?v.createElement(v.Fragment,null,B,v.createElement(li,{page:$})):B});_n.displayName="Link";var mi=v.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:n="",end:o=!1,style:a,to:i,viewTransition:u,children:s,...l},h){let m=ht(i,{relative:l.relative}),w=Ye(),g=v.useContext(ft),{navigator:S,basename:P}=v.useContext(Se),x=g!=null&&bi(m)&&u===!0,_=S.encodeLocation?S.encodeLocation(m).pathname:m.pathname,C=w.pathname,$=g&&g.navigation&&g.navigation.location?g.navigation.location.pathname:null;r||(C=C.toLowerCase(),$=$?$.toLowerCase():null,_=_.toLowerCase()),$&&P&&($=Ce($,P)||$);const Z=_!=="/"&&_.endsWith("/")?_.length-1:_.length;let Y=C===_||!o&&C.startsWith(_)&&C.charAt(Z)==="/",te=$!=null&&($===_||!o&&$.startsWith(_)&&$.charAt(_.length)==="/"),p={isActive:Y,isPending:te,isTransitioning:x},j=Y?t:void 0,B;typeof n=="function"?B=n(p):B=[n,Y?"active":null,te?"pending":null,x?"transitioning":null].filter(Boolean).join(" ");let re=typeof a=="function"?a(p):a;return v.createElement(_n,{...l,"aria-current":j,className:B,ref:h,style:re,to:i,viewTransition:u},typeof s=="function"?s(p):s)});mi.displayName="NavLink";var pi=v.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:n,replace:o,state:a,method:i=St,action:u,onSubmit:s,relative:l,preventScrollReset:h,viewTransition:m,unstable_defaultShouldRevalidate:w,...g},S)=>{let{unstable_useTransitions:P}=v.useContext(Se),x=Ri(),_=Ei(u,{relative:l}),C=i.toLowerCase()==="get"?"get":"post",$=typeof u=="string"&&xn.test(u),Z=Y=>{if(s&&s(Y),Y.defaultPrevented)return;Y.preventDefault();let te=Y.nativeEvent.submitter,p=te?.getAttribute("formmethod")||i,j=()=>x(te||Y.currentTarget,{fetcherKey:t,method:p,navigate:r,replace:o,state:a,relative:l,preventScrollReset:h,viewTransition:m,unstable_defaultShouldRevalidate:w});P&&r!==!1?v.startTransition(()=>j()):j()};return v.createElement("form",{ref:S,method:C,action:_,onSubmit:n?s:Z,...g,"data-discover":!$&&e==="render"?"true":void 0})});pi.displayName="Form";function yi(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ln(e){let t=v.useContext(We);return k(t,yi(e)),t}function vi(e,{target:t,replace:r,state:n,preventScrollReset:o,relative:a,viewTransition:i,unstable_defaultShouldRevalidate:u,unstable_useTransitions:s}={}){let l=vo(),h=Ye(),m=ht(e,{relative:a});return v.useCallback(w=>{if(Ko(w,t)){w.preventDefault();let g=r!==void 0?r:Le(h)===Le(m),S=()=>l(e,{replace:g,state:n,preventScrollReset:o,relative:a,viewTransition:i,unstable_defaultShouldRevalidate:u});s?v.startTransition(()=>S()):S()}},[h,l,m,r,n,t,e,o,a,i,u,s])}var gi=0,wi=()=>`__${String(++gi)}__`;function Ri(){let{router:e}=Ln("useSubmit"),{basename:t}=v.useContext(Se),r=To(),n=e.fetch,o=e.navigate;return v.useCallback(async(a,i={})=>{let{action:u,method:s,encType:l,formData:h,body:m}=Jo(a,t);if(i.navigate===!1){let w=i.fetcherKey||wi();await n(w,r,i.action||u,{unstable_defaultShouldRevalidate:i.unstable_defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:h,body:m,formMethod:i.method||s,formEncType:i.encType||l,flushSync:i.flushSync})}else await o(i.action||u,{unstable_defaultShouldRevalidate:i.unstable_defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:h,body:m,formMethod:i.method||s,formEncType:i.encType||l,replace:i.replace,state:i.state,fromRouteId:r,flushSync:i.flushSync,viewTransition:i.viewTransition})},[n,o,t,r])}function Ei(e,{relative:t}={}){let{basename:r}=v.useContext(Se),n=v.useContext(Pe);k(n,"useFormAction must be used inside a RouteContext");let[o]=n.matches.slice(-1),a={...ht(e||".",{relative:t})},i=Ye();if(e==null){a.search=i.search;let u=new URLSearchParams(a.search),s=u.getAll("index");if(s.some(h=>h==="")){u.delete("index"),s.filter(m=>m).forEach(m=>u.append("index",m));let h=u.toString();a.search=h?`?${h}`:""}}return(!e||e===".")&&o.route.index&&(a.search=a.search?a.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(a.pathname=a.pathname==="/"?r:_e([r,a.pathname])),Le(a)}function bi(e,{relative:t}={}){let r=v.useContext(Qt);k(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:n}=Ln("useViewTransitionState"),o=ht(e,{relative:t});if(!r.isTransitioning)return!1;let a=Ce(r.currentLocation.pathname,n)||r.currentLocation.pathname,i=Ce(r.nextLocation.pathname,n)||r.nextLocation.pathname;return xt(o.pathname,i)!=null||xt(o.pathname,a)!=null}var Dn=Xn();const xi=Gr(Dn);function _i(e){return v.createElement(zo,{flushSync:Dn.flushSync,...e})}export{Si as O,Gn as R,Dn as a,xi as b,Jr as c,Xn as d,Ye as e,Pi as f,Gr as g,_i as h,qn as i,Ci as j,v as r,vo as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function m(e){return Array.isArray?Array.isArray(e):st(e)==="[object Array]"}function at(e){if(typeof e=="string")return e;let t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function lt(e){return e==null?"":at(e)}function M(e){return typeof e=="string"}function tt(e){return typeof e=="number"}function ft(e){return e===!0||e===!1||dt(e)&&st(e)=="[object Boolean]"}function et(e){return typeof e=="object"}function dt(e){return et(e)&&e!==null}function E(e){return e!=null}function P(e){return!e.trim().length}function st(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const gt="Incorrect 'index' type",At=e=>`Invalid value for key ${e}`,pt=e=>`Pattern length exceeds max of ${e}.`,Et=e=>`Missing ${e} property in key`,Ct=e=>`Property 'weight' in key '${e}' must be a positive integer`,J=Object.prototype.hasOwnProperty;class Ft{constructor(t){this._keys=[],this._keyMap={};let s=0;t.forEach(n=>{let r=nt(n);this._keys.push(r),this._keyMap[r.id]=r,s+=r.weight}),this._keys.forEach(n=>{n.weight/=s})}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function nt(e){let t=null,s=null,n=null,r=1,i=null;if(M(e)||m(e))n=e,t=U(e),s=j(e);else{if(!J.call(e,"name"))throw new Error(Et("name"));const u=e.name;if(n=u,J.call(e,"weight")&&(r=e.weight,r<=0))throw new Error(Ct(u));t=U(u),s=j(u),i=e.getFn}return{path:t,id:s,weight:r,src:n,getFn:i}}function U(e){return m(e)?e:e.split(".")}function j(e){return m(e)?e.join("."):e}function Bt(e,t){let s=[],n=!1;const r=(i,u,c)=>{if(E(i))if(!u[c])s.push(i);else{let o=u[c];const h=i[o];if(!E(h))return;if(c===u.length-1&&(M(h)||tt(h)||ft(h)))s.push(lt(h));else if(m(h)){n=!0;for(let a=0,f=h.length;a<f;a+=1)r(h[a],u,c+1)}else u.length&&r(h,u,c+1)}};return r(e,M(t)?t.split("."):t,0),n?s:s[0]}const Mt={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},Dt={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},mt={location:0,threshold:.6,distance:100},yt={useExtendedSearch:!1,getFn:Bt,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var l={...Dt,...Mt,...mt,...yt};const xt=/[^ ]+/g;function _t(e=1,t=3){const s=new Map,n=Math.pow(10,t);return{get(r){const i=r.match(xt).length;if(s.has(i))return s.get(i);const u=1/Math.pow(i,.5*e),c=parseFloat(Math.round(u*n)/n);return s.set(i,c),c},clear(){s.clear()}}}class Y{constructor({getFn:t=l.getFn,fieldNormWeight:s=l.fieldNormWeight}={}){this.norm=_t(s,3),this.getFn=t,this.isCreated=!1,this.setIndexRecords()}setSources(t=[]){this.docs=t}setIndexRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t,this._keysMap={},t.forEach((s,n)=>{this._keysMap[s.id]=n})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,M(this.docs[0])?this.docs.forEach((t,s)=>{this._addString(t,s)}):this.docs.forEach((t,s)=>{this._addObject(t,s)}),this.norm.clear())}add(t){const s=this.size();M(t)?this._addString(t,s):this._addObject(t,s)}removeAt(t){this.records.splice(t,1);for(let s=t,n=this.size();s<n;s+=1)this.records[s].i-=1}getValueForItemAtKeyId(t,s){return t[this._keysMap[s]]}size(){return this.records.length}_addString(t,s){if(!E(t)||P(t))return;let n={v:t,i:s,n:this.norm.get(t)};this.records.push(n)}_addObject(t,s){let n={i:s,$:{}};this.keys.forEach((r,i)=>{let u=r.getFn?r.getFn(t):this.getFn(t,r.path);if(E(u)){if(m(u)){let c=[];const o=[{nestedArrIndex:-1,value:u}];for(;o.length;){const{nestedArrIndex:h,value:a}=o.pop();if(E(a))if(M(a)&&!P(a)){let f={v:a,i:h,n:this.norm.get(a)};c.push(f)}else m(a)&&a.forEach((f,d)=>{o.push({nestedArrIndex:d,value:f})})}n.$[i]=c}else if(M(u)&&!P(u)){let c={v:u,n:this.norm.get(u)};n.$[i]=c}}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}}function rt(e,t,{getFn:s=l.getFn,fieldNormWeight:n=l.fieldNormWeight}={}){const r=new Y({getFn:s,fieldNormWeight:n});return r.setKeys(e.map(nt)),r.setSources(t),r.create(),r}function It(e,{getFn:t=l.getFn,fieldNormWeight:s=l.fieldNormWeight}={}){const{keys:n,records:r}=e,i=new Y({getFn:t,fieldNormWeight:s});return i.setKeys(n),i.setIndexRecords(r),i}function $(e,{errors:t=0,currentLocation:s=0,expectedLocation:n=0,distance:r=l.distance,ignoreLocation:i=l.ignoreLocation}={}){const u=t/e.length;if(i)return u;const c=Math.abs(n-s);return r?u+c/r:c?1:u}function St(e=[],t=l.minMatchCharLength){let s=[],n=-1,r=-1,i=0;for(let u=e.length;i<u;i+=1){let c=e[i];c&&n===-1?n=i:!c&&n!==-1&&(r=i-1,r-n+1>=t&&s.push([n,r]),n=-1)}return e[i-1]&&i-n>=t&&s.push([n,i-1]),s}const w=32;function wt(e,t,s,{location:n=l.location,distance:r=l.distance,threshold:i=l.threshold,findAllMatches:u=l.findAllMatches,minMatchCharLength:c=l.minMatchCharLength,includeMatches:o=l.includeMatches,ignoreLocation:h=l.ignoreLocation}={}){if(t.length>w)throw new Error(pt(w));const a=t.length,f=e.length,d=Math.max(0,Math.min(n,f));let g=i,A=d;const p=c>1||o,F=p?Array(f):[];let y;for(;(y=e.indexOf(t,A))>-1;){let C=$(t,{currentLocation:y,expectedLocation:d,distance:r,ignoreLocation:h});if(g=Math.min(C,g),A=y+a,p){let x=0;for(;x<a;)F[y+x]=1,x+=1}}A=-1;let D=[],L=1,S=a+f;const ht=1<<a-1;for(let C=0;C<a;C+=1){let x=0,_=S;for(;x<_;)$(t,{errors:C,currentLocation:d+_,expectedLocation:d,distance:r,ignoreLocation:h})<=g?x=_:S=_,_=Math.floor((S-x)/2+x);S=_;let V=Math.max(1,d-_+1),T=u?f:Math.min(d+_,f)+a,R=Array(T+2);R[T+1]=(1<<C)-1;for(let B=T;B>=V;B-=1){let O=B-1,Q=s[e.charAt(O)];if(p&&(F[O]=+!!Q),R[B]=(R[B+1]<<1|1)&Q,C&&(R[B]|=(D[B+1]|D[B])<<1|1|D[B+1]),R[B]&ht&&(L=$(t,{errors:C,currentLocation:O,expectedLocation:d,distance:r,ignoreLocation:h}),L<=g)){if(g=L,A=O,A<=d)break;V=Math.max(1,2*d-A)}}if($(t,{errors:C+1,currentLocation:d,expectedLocation:d,distance:r,ignoreLocation:h})>g)break;D=R}const v={isMatch:A>=0,score:Math.max(.001,L)};if(p){const C=St(F,c);C.length?o&&(v.indices=C):v.isMatch=!1}return v}function Lt(e){let t={};for(let s=0,n=e.length;s<n;s+=1){const r=e.charAt(s);t[r]=(t[r]||0)|1<<n-s-1}return t}const k=String.prototype.normalize?(e=>e.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,"")):(e=>e);class it{constructor(t,{location:s=l.location,threshold:n=l.threshold,distance:r=l.distance,includeMatches:i=l.includeMatches,findAllMatches:u=l.findAllMatches,minMatchCharLength:c=l.minMatchCharLength,isCaseSensitive:o=l.isCaseSensitive,ignoreDiacritics:h=l.ignoreDiacritics,ignoreLocation:a=l.ignoreLocation}={}){if(this.options={location:s,threshold:n,distance:r,includeMatches:i,findAllMatches:u,minMatchCharLength:c,isCaseSensitive:o,ignoreDiacritics:h,ignoreLocation:a},t=o?t:t.toLowerCase(),t=h?k(t):t,this.pattern=t,this.chunks=[],!this.pattern.length)return;const f=(g,A)=>{this.chunks.push({pattern:g,alphabet:Lt(g),startIndex:A})},d=this.pattern.length;if(d>w){let g=0;const A=d%w,p=d-A;for(;g<p;)f(this.pattern.substr(g,w),g),g+=w;if(A){const F=d-w;f(this.pattern.substr(F),F)}}else f(this.pattern,0)}searchIn(t){const{isCaseSensitive:s,ignoreDiacritics:n,includeMatches:r}=this.options;if(t=s?t:t.toLowerCase(),t=n?k(t):t,this.pattern===t){let p={isMatch:!0,score:0};return r&&(p.indices=[[0,t.length-1]]),p}const{location:i,distance:u,threshold:c,findAllMatches:o,minMatchCharLength:h,ignoreLocation:a}=this.options;let f=[],d=0,g=!1;this.chunks.forEach(({pattern:p,alphabet:F,startIndex:y})=>{const{isMatch:D,score:L,indices:S}=wt(t,p,F,{location:i+y,distance:u,threshold:c,findAllMatches:o,minMatchCharLength:h,includeMatches:r,ignoreLocation:a});D&&(g=!0),d+=L,D&&S&&(f=[...f,...S])});let A={isMatch:g,score:g?d/this.chunks.length:1};return g&&r&&(A.indices=f),A}}class I{constructor(t){this.pattern=t}static isMultiMatch(t){return X(t,this.multiRegex)}static isSingleMatch(t){return X(t,this.singleRegex)}search(){}}function X(e,t){const s=e.match(t);return s?s[1]:null}class Rt extends I{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(t){const s=t===this.pattern;return{isMatch:s,score:s?0:1,indices:[0,this.pattern.length-1]}}}class bt extends I{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){const n=t.indexOf(this.pattern)===-1;return{isMatch:n,score:n?0:1,indices:[0,t.length-1]}}}class Ot extends I{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){const s=t.startsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,this.pattern.length-1]}}}class $t extends I{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){const s=!t.startsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,t.length-1]}}}class kt extends I{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){const s=t.endsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[t.length-this.pattern.length,t.length-1]}}}class Nt extends I{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){const s=!t.endsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,t.length-1]}}}class ut extends I{constructor(t,{location:s=l.location,threshold:n=l.threshold,distance:r=l.distance,includeMatches:i=l.includeMatches,findAllMatches:u=l.findAllMatches,minMatchCharLength:c=l.minMatchCharLength,isCaseSensitive:o=l.isCaseSensitive,ignoreDiacritics:h=l.ignoreDiacritics,ignoreLocation:a=l.ignoreLocation}={}){super(t),this._bitapSearch=new it(t,{location:s,threshold:n,distance:r,includeMatches:i,findAllMatches:u,minMatchCharLength:c,isCaseSensitive:o,ignoreDiacritics:h,ignoreLocation:a})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}class ct extends I{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let s=0,n;const r=[],i=this.pattern.length;for(;(n=t.indexOf(this.pattern,s))>-1;)s=n+i,r.push([n,s-1]);const u=!!r.length;return{isMatch:u,score:u?0:1,indices:r}}}const K=[Rt,ct,Ot,$t,Nt,kt,bt,ut],Z=K.length,vt=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,Tt="|";function Pt(e,t={}){return e.split(Tt).map(s=>{let n=s.trim().split(vt).filter(i=>i&&!!i.trim()),r=[];for(let i=0,u=n.length;i<u;i+=1){const c=n[i];let o=!1,h=-1;for(;!o&&++h<Z;){const a=K[h];let f=a.isMultiMatch(c);f&&(r.push(new a(f,t)),o=!0)}if(!o)for(h=-1;++h<Z;){const a=K[h];let f=a.isSingleMatch(c);if(f){r.push(new a(f,t));break}}}return r})}const jt=new Set([ut.type,ct.type]);class Kt{constructor(t,{isCaseSensitive:s=l.isCaseSensitive,ignoreDiacritics:n=l.ignoreDiacritics,includeMatches:r=l.includeMatches,minMatchCharLength:i=l.minMatchCharLength,ignoreLocation:u=l.ignoreLocation,findAllMatches:c=l.findAllMatches,location:o=l.location,threshold:h=l.threshold,distance:a=l.distance}={}){this.query=null,this.options={isCaseSensitive:s,ignoreDiacritics:n,includeMatches:r,minMatchCharLength:i,findAllMatches:c,ignoreLocation:u,location:o,threshold:h,distance:a},t=s?t:t.toLowerCase(),t=n?k(t):t,this.pattern=t,this.query=Pt(this.pattern,this.options)}static condition(t,s){return s.useExtendedSearch}searchIn(t){const s=this.query;if(!s)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:r,ignoreDiacritics:i}=this.options;t=r?t:t.toLowerCase(),t=i?k(t):t;let u=0,c=[],o=0;for(let h=0,a=s.length;h<a;h+=1){const f=s[h];c.length=0,u=0;for(let d=0,g=f.length;d<g;d+=1){const A=f[d],{isMatch:p,indices:F,score:y}=A.search(t);if(p){if(u+=1,o+=y,n){const D=A.constructor.type;jt.has(D)?c=[...c,...F]:c.push(F)}}else{o=0,u=0,c.length=0;break}}if(u){let d={isMatch:!0,score:o/u};return n&&(d.indices=c),d}}return{isMatch:!1,score:1}}}const W=[];function Wt(...e){W.push(...e)}function z(e,t){for(let s=0,n=W.length;s<n;s+=1){let r=W[s];if(r.condition(e,t))return new r(e,t)}return new it(e,t)}const N={AND:"$and",OR:"$or"},G={PATH:"$path",PATTERN:"$val"},H=e=>!!(e[N.AND]||e[N.OR]),zt=e=>!!e[G.PATH],Gt=e=>!m(e)&&et(e)&&!H(e),q=e=>({[N.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function ot(e,t,{auto:s=!0}={}){const n=r=>{let i=Object.keys(r);const u=zt(r);if(!u&&i.length>1&&!H(r))return n(q(r));if(Gt(r)){const o=u?r[G.PATH]:i[0],h=u?r[G.PATTERN]:r[o];if(!M(h))throw new Error(At(o));const a={keyId:j(o),pattern:h};return s&&(a.searcher=z(h,t)),a}let c={children:[],operator:i[0]};return i.forEach(o=>{const h=r[o];m(h)&&h.forEach(a=>{c.children.push(n(a))})}),c};return H(e)||(e=q(e)),n(e)}function Ht(e,{ignoreFieldNorm:t=l.ignoreFieldNorm}){e.forEach(s=>{let n=1;s.matches.forEach(({key:r,norm:i,score:u})=>{const c=r?r.weight:null;n*=Math.pow(u===0&&c?Number.EPSILON:u,(c||1)*(t?1:i))}),s.score=n})}function Yt(e,t){const s=e.matches;t.matches=[],E(s)&&s.forEach(n=>{if(!E(n.indices)||!n.indices.length)return;const{indices:r,value:i}=n;let u={indices:r,value:i};n.key&&(u.key=n.key.src),n.idx>-1&&(u.refIndex=n.idx),t.matches.push(u)})}function Vt(e,t){t.score=e.score}function Qt(e,t,{includeMatches:s=l.includeMatches,includeScore:n=l.includeScore}={}){const r=[];return s&&r.push(Yt),n&&r.push(Vt),e.map(i=>{const{idx:u}=i,c={item:t[u],refIndex:u};return r.length&&r.forEach(o=>{o(i,c)}),c})}class b{constructor(t,s={},n){this.options={...l,...s},this.options.useExtendedSearch,this._keyStore=new Ft(this.options.keys),this.setCollection(t,n)}setCollection(t,s){if(this._docs=t,s&&!(s instanceof Y))throw new Error(gt);this._myIndex=s||rt(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){E(t)&&(this._docs.push(t),this._myIndex.add(t))}remove(t=()=>!1){const s=[];for(let n=0,r=this._docs.length;n<r;n+=1){const i=this._docs[n];t(i,n)&&(this.removeAt(n),n-=1,r-=1,s.push(i))}return s}removeAt(t){this._docs.splice(t,1),this._myIndex.removeAt(t)}getIndex(){return this._myIndex}search(t,{limit:s=-1}={}){const{includeMatches:n,includeScore:r,shouldSort:i,sortFn:u,ignoreFieldNorm:c}=this.options;let o=M(t)?M(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return Ht(o,{ignoreFieldNorm:c}),i&&o.sort(u),tt(s)&&s>-1&&(o=o.slice(0,s)),Qt(o,this._docs,{includeMatches:n,includeScore:r})}_searchStringList(t){const s=z(t,this.options),{records:n}=this._myIndex,r=[];return n.forEach(({v:i,i:u,n:c})=>{if(!E(i))return;const{isMatch:o,score:h,indices:a}=s.searchIn(i);o&&r.push({item:i,idx:u,matches:[{score:h,value:i,norm:c,indices:a}]})}),r}_searchLogical(t){const s=ot(t,this.options),n=(c,o,h)=>{if(!c.children){const{keyId:f,searcher:d}=c,g=this._findMatches({key:this._keyStore.get(f),value:this._myIndex.getValueForItemAtKeyId(o,f),searcher:d});return g&&g.length?[{idx:h,item:o,matches:g}]:[]}const a=[];for(let f=0,d=c.children.length;f<d;f+=1){const g=c.children[f],A=n(g,o,h);if(A.length)a.push(...A);else if(c.operator===N.AND)return[]}return a},r=this._myIndex.records,i={},u=[];return r.forEach(({$:c,i:o})=>{if(E(c)){let h=n(s,c,o);h.length&&(i[o]||(i[o]={idx:o,item:c,matches:[]},u.push(i[o])),h.forEach(({matches:a})=>{i[o].matches.push(...a)}))}}),u}_searchObjectList(t){const s=z(t,this.options),{keys:n,records:r}=this._myIndex,i=[];return r.forEach(({$:u,i:c})=>{if(!E(u))return;let o=[];n.forEach((h,a)=>{o.push(...this._findMatches({key:h,value:u[a],searcher:s}))}),o.length&&i.push({idx:c,item:u,matches:o})}),i}_findMatches({key:t,value:s,searcher:n}){if(!E(s))return[];let r=[];if(m(s))s.forEach(({v:i,i:u,n:c})=>{if(!E(i))return;const{isMatch:o,score:h,indices:a}=n.searchIn(i);o&&r.push({score:h,key:t,value:i,idx:u,norm:c,indices:a})});else{const{v:i,n:u}=s,{isMatch:c,score:o,indices:h}=n.searchIn(i);c&&r.push({score:o,key:t,value:i,norm:u,indices:h})}return r}}b.version="7.1.0";b.createIndex=rt;b.parseIndex=It;b.config=l;b.parseQuery=ot;Wt(Kt);export{b as F};
|