@atom8n/n8n-editor-ui 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.stylelintcache +1 -0
- package/README.md +59 -0
- package/biome.jsonc +8 -0
- package/build.log +55 -0
- package/data/node-popularity.json +3998 -0
- package/dist/assets/AddDataTableModal-UINkk54_.js +1555 -0
- package/dist/assets/AgentEditorModal-CVww87TJ.js +358 -0
- package/dist/assets/Alert-Dy86dyOr.js +102 -0
- package/dist/assets/AnimatedSpinner-DmPN4poP.js +15 -0
- package/dist/assets/AnnotationTagsDropdown.ee-BJ7N9lek.js +71 -0
- package/dist/assets/AuthView-D2LWHrMp.js +106 -0
- package/dist/assets/BottomMenu-CIQiK_dJ.js +532 -0
- package/dist/assets/CalendarDate-DgQUMbNo.js +875 -0
- package/dist/assets/ChangePasswordView-Z6tUkw0u.js +133 -0
- package/dist/assets/ChatAgentAvatar-50YBnv3N.js +67 -0
- package/dist/assets/ChatFile-xZxmc2nV.js +146 -0
- package/dist/assets/ChatLayout-CTE_5SiM.js +96 -0
- package/dist/assets/ChatPersonalAgentsView-BGpHk03K.js +149 -0
- package/dist/assets/ChatSidebar-BkVwIypC.js +528 -0
- package/dist/assets/ChatView-BbbdeU9x.js +1559 -0
- package/dist/assets/ChatWorkflowAgentsView-BtunOxlC.js +116 -0
- package/dist/assets/CollectionParameter-BdcPG1lu.js +52 -0
- package/dist/assets/CommitMonoVariable-ytizKI8U.woff2 +0 -0
- package/dist/assets/CommunityNodeUpdateInfo-C37kca4W.js +273 -0
- package/dist/assets/CopyInput-DDZVu2iU.js +74 -0
- package/dist/assets/CredentialIcon-8YdTTFZ1.js +80 -0
- package/dist/assets/CredentialPicker-DWtj314o.js +293 -0
- package/dist/assets/CredentialSelectorModal-DTW2fKh0.js +138 -0
- package/dist/assets/CredentialsView-BjUchcCu.js +480 -0
- package/dist/assets/DataTableActions-DpAkoxg_.js +95 -0
- package/dist/assets/DataTableDetailsView-Coq7zdW5.js +41922 -0
- package/dist/assets/DataTableView-Cs-BIkzw.js +293 -0
- package/dist/assets/DemoFooter-Cga3jvi-.js +65 -0
- package/dist/assets/Draggable-vfvXl9Sp.js +105 -0
- package/dist/assets/EmptySharedSectionActionBox-DOXZtTCv.js +36 -0
- package/dist/assets/EnterpriseEdition.ee-D_rCFexM.js +15 -0
- package/dist/assets/EntityNotFound-3dhTRWsE.js +85 -0
- package/dist/assets/EntityUnAuthorised-ChJYZakE.js +66 -0
- package/dist/assets/ErrorView-zT9cX76a.js +61 -0
- package/dist/assets/EvaluationsRootView-C-OVWYnY.js +523 -0
- package/dist/assets/EvaluationsView-CJwJTruc.js +469 -0
- package/dist/assets/ExecutionsTime-DEQiyozR.js +573 -0
- package/dist/assets/ExecutionsView-Bd5Oh8TH.js +791 -0
- package/dist/assets/ExternalSecretsProviderConnectionSwitch.ee-C7Ih-uRo.js +191 -0
- package/dist/assets/FixedCollectionParameter-CYuTDW9t.js +496 -0
- package/dist/assets/ForgotMyPasswordView-Bs_L9P27.js +102 -0
- package/dist/assets/InsightsChartAverageRuntime-Bp3VA8_7.js +62 -0
- package/dist/assets/InsightsChartFailed-KPaNWoEr.js +52 -0
- package/dist/assets/InsightsChartFailureRate-DE6kE3FM.js +54 -0
- package/dist/assets/InsightsChartTimeSaved-auABNZlc.js +68 -0
- package/dist/assets/InsightsChartTotal-BKzYRKE7.js +56 -0
- package/dist/assets/InsightsDashboard-JWx4W6Db.js +473 -0
- package/dist/assets/InsightsPaywall-C8zLLKe8.js +63 -0
- package/dist/assets/InsightsSummary-cmN1lHDm.js +210 -0
- package/dist/assets/InsightsTableWorkflows-CqcC3IbQ.js +203 -0
- package/dist/assets/InterVariable-DiVDrmQJ.woff2 +0 -0
- package/dist/assets/InterVariable-Italic-FCBEiFp6.woff2 +0 -0
- package/dist/assets/ItemsRenderer-DC8WVyMv.js +922 -0
- package/dist/assets/KeyboardShortcutTooltip-D8PAK5JP.js +31 -0
- package/dist/assets/LogsPanel-BR06u9RK.js +52 -0
- package/dist/assets/LogsPanel-C-_acMHp.js +2325 -0
- package/dist/assets/MCPConnectWorkflowsModal-3g8_iUa4.js +303 -0
- package/dist/assets/MainHeader-DiQc1edn.js +2153 -0
- package/dist/assets/MainSidebar-CoPGG5Ea.js +804 -0
- package/dist/assets/MigrationRuleDetail-BAxk1Pvl.js +295 -0
- package/dist/assets/MigrationRules-IW9lZMpE.js +285 -0
- package/dist/assets/Modal-CIzXlZdZ.js +204 -0
- package/dist/assets/ModelByIdSelectorModal-DLvBjzJO.js +115 -0
- package/dist/assets/NDVEmptyState-33UoX00I.js +19743 -0
- package/dist/assets/NodeCreation-BNzbSWSB.js +240 -0
- package/dist/assets/NodeCreator-BftgCKx7.js +1288 -0
- package/dist/assets/NodeDetailsView-CsoQCpcF.js +1075 -0
- package/dist/assets/NodeDetailsViewV2-C_wNQR_3.js +981 -0
- package/dist/assets/NodeIcon-B9VW6tX6.js +87 -0
- package/dist/assets/NodeSettings-ZwVip6VR.js +1872 -0
- package/dist/assets/NodeView-D4WUEvLB.js +2452 -0
- package/dist/assets/OAuthConsentView-DlrUqZbT.js +230 -0
- package/dist/assets/PageViewLayout-NT1KPFgy.js +12 -0
- package/dist/assets/ParameterInputList-sG2nz-Jo.js +38091 -0
- package/dist/assets/PrebuiltAgentTemplatesView-Csi5U8dc.js +154 -0
- package/dist/assets/ProjectBreadcrumb-C_XiY7sc.js +98 -0
- package/dist/assets/ProjectCardBadge-t_hs7vzx.js +209 -0
- package/dist/assets/ProjectHeader-Dq5Ihb26.js +549 -0
- package/dist/assets/ProjectIcon-DY8gGuHX.js +64 -0
- package/dist/assets/ProjectRoleView-Du-KTrAC.js +435 -0
- package/dist/assets/ProjectRolesView-DjxM_y4u.js +239 -0
- package/dist/assets/ProjectSettings-C6kWuV21.js +966 -0
- package/dist/assets/ProjectSharing-CVUgNWAY.js +262 -0
- package/dist/assets/ProjectVariables-CJlAo3dv.js +467 -0
- package/dist/assets/ProviderSettingsModal-BUFC2ZLv.js +307 -0
- package/dist/assets/PushConnectionTracker-DPBnGV0v.js +27 -0
- package/dist/assets/ResolversView-3BdkvvYA.js +209 -0
- package/dist/assets/ResourceFiltersDropdown-dgyXpcEX.js +159 -0
- package/dist/assets/ResourcesListLayout-qBLtomK6.js +631 -0
- package/dist/assets/RunDataHtml-BrW0OQra.js +7 -0
- package/dist/assets/RunDataHtml-Cleia4Cj.js +40 -0
- package/dist/assets/RunDataJson-uxkrhYRK.js +227 -0
- package/dist/assets/RunDataJsonActions-DkPk7E8d.js +5007 -0
- package/dist/assets/RunDataParsedAiContent-CtPRjig-.js +26 -0
- package/dist/assets/RunDataParsedAiContent-WAuqLQ5M.js +192 -0
- package/dist/assets/RunDataSearch-YBWUr93C.js +141 -0
- package/dist/assets/RunDataTable-DcXaBynW.js +631 -0
- package/dist/assets/SamlOnboarding-BTdQ_hr3.js +78 -0
- package/dist/assets/SaveButton-D5sQSxIk.js +89 -0
- package/dist/assets/SelectedItemsInfo-BHZ-NvF5.js +58 -0
- package/dist/assets/SettingsApiView-IfZTMXx1.js +313 -0
- package/dist/assets/SettingsChatHubView-gWh2X6vX.js +285 -0
- package/dist/assets/SettingsCommunityNodesView-D8VQtpGY.js +349 -0
- package/dist/assets/SettingsExternalSecrets-CpMc7mkW.js +233 -0
- package/dist/assets/SettingsLdapView-CU5a2MAy.js +2553 -0
- package/dist/assets/SettingsLogStreamingView-uojTe-oX.js +375 -0
- package/dist/assets/SettingsMCPView-B5Swp1C_.js +1214 -0
- package/dist/assets/SettingsPersonalView-Cr3aGood.js +402 -0
- package/dist/assets/SettingsSourceControl-DXOvFDEY.js +547 -0
- package/dist/assets/SettingsSso-27MfU1HV.js +1032 -0
- package/dist/assets/SettingsUsageAndPlan-DqIO-G46.js +419 -0
- package/dist/assets/SettingsUsersView-DfHB4_Kh.js +833 -0
- package/dist/assets/SettingsView-C4sA7Uny.js +90 -0
- package/dist/assets/SetupTemplateFormStep-BmiSzZin.js +258 -0
- package/dist/assets/SetupView-VORZ-L_u.js +112 -0
- package/dist/assets/SetupWorkflowCredentialsButton-DTmkOAW5.js +73 -0
- package/dist/assets/SetupWorkflowFromTemplateView-B9NupdJE.js +286 -0
- package/dist/assets/SeverityTag-CX1qTTNA.js +45 -0
- package/dist/assets/SigninView-D9_Pm16j.js +358 -0
- package/dist/assets/SignoutView-BFsjEAGz.js +19 -0
- package/dist/assets/SignupView-Am4ot0QZ.js +137 -0
- package/dist/assets/SkeletonAgentCard-C5TL-h8F.js +191 -0
- package/dist/assets/TagsDropdown-Bvx_Hd6Q.js +230 -0
- package/dist/assets/TemplateCard-CyQ1GuVz.js +105 -0
- package/dist/assets/TemplateDetails-CZRusTxE.js +124 -0
- package/dist/assets/TemplateList-DKvbwuiY.js +333 -0
- package/dist/assets/TemplatesCollectionView-D8dxU8By.js +184 -0
- package/dist/assets/TemplatesSearchView-CebC_GLs.js +1230 -0
- package/dist/assets/TemplatesView-025CcmIY.js +57 -0
- package/dist/assets/TemplatesWorkflowView-C2JfwJAn.js +170 -0
- package/dist/assets/TestRunDetailView-Ck78TTWO.js +395 -0
- package/dist/assets/TextWithHighlights-BxumwGnv.js +57 -0
- package/dist/assets/TimeAgo-C6EN4lCs.js +123 -0
- package/dist/assets/ToolsSelectorModal-8QJoUvRL.js +368 -0
- package/dist/assets/TriggerPanel-B6pacLkk.js +1225 -0
- package/dist/assets/VirtualSchema-B3zGe_8b.js +2402 -0
- package/dist/assets/VirtualSchema-Dkh0Cu5z.js +37 -0
- package/dist/assets/VueMarkdown-CQqJL9vK.js +28 -0
- package/dist/assets/WorkerView-Caznsljo.js +563 -0
- package/dist/assets/WorkflowActivationErrorMessage-CGrfPi9O.js +17 -0
- package/dist/assets/WorkflowActivator-BINnz0f7.js +362 -0
- package/dist/assets/WorkflowExecutionsInfoAccordion-Dg37yEfT.js +166 -0
- package/dist/assets/WorkflowExecutionsLandingPage-V2wdubhK.js +93 -0
- package/dist/assets/WorkflowExecutionsPreview-DdJaqYV6.js +616 -0
- package/dist/assets/WorkflowExecutionsView-DV8ySTfn.js +808 -0
- package/dist/assets/WorkflowHistory-GtaBMzIM.js +973 -0
- package/dist/assets/WorkflowLocation-CQ9Sq-2y.js +164 -0
- package/dist/assets/WorkflowOnboardingView-C49gt0Jr.js +61 -0
- package/dist/assets/WorkflowPreview-CXdvv4Nq.js +186 -0
- package/dist/assets/WorkflowTagsDropdown-QwbICWjN.js +71 -0
- package/dist/assets/WorkflowsView-B-MWIECO.js +3253 -0
- package/dist/assets/_MapCache-CcdIl4Ae.js +363 -0
- package/dist/assets/_baseOrderBy-N8Be_6z6.js +2989 -0
- package/dist/assets/_initCloneObject-viQQyT6o.js +80 -0
- package/dist/assets/_plugin-vue_export-helper-BwBpWJRZ.js +6 -0
- package/dist/assets/aiTemplatesStarterCollection.store-nL9nePkK.js +656 -0
- package/dist/assets/apiKeys.store-BhOFmP2j.js +51 -0
- package/dist/assets/assistant.store-CNywgN4S.js +518 -0
- package/dist/assets/auth.eventBus-CWXS0Qp7.js +5 -0
- package/dist/assets/banners.store-CGEcBTDn.js +195 -0
- package/dist/assets/builder.store-Czk2ipDE.js +31417 -0
- package/dist/assets/buttons.esm-yintpW2E.js +364 -0
- package/dist/assets/chart-CNvyywtJ.js +10958 -0
- package/dist/assets/chartjs.utils-BAE52Cv9.js +155 -0
- package/dist/assets/chat.store-290YeyrQ.js +865 -0
- package/dist/assets/chatPanel.store-NDaawEZL.js +118 -0
- package/dist/assets/chunk-6z4oVpB-.js +36 -0
- package/dist/assets/col-Cmt4cmuS.js +158 -0
- package/dist/assets/constants-C8OH4tTq.js +106256 -0
- package/dist/assets/constants-DMrsrpD7.js +32 -0
- package/dist/assets/core-B9gt_4yk.js +4 -0
- package/dist/assets/core-CP5FY4aX.js +1202 -0
- package/dist/assets/core-CRbPymLT.js +9741 -0
- package/dist/assets/dataTable.store-DmipQsol.js +207 -0
- package/dist/assets/date-picker-2IDsBs2n.js +4115 -0
- package/dist/assets/dateFormatter-ik4-9_9r.js +33 -0
- package/dist/assets/dateformat-hG8NERse.js +181 -0
- package/dist/assets/dialog-lMho1TD8.js +425 -0
- package/dist/assets/dist-Cw46Is-h.js +151 -0
- package/dist/assets/doppler-B__k0MeW.webp +0 -0
- package/dist/assets/element-icons-B-tDfklg.woff +0 -0
- package/dist/assets/element-icons-_lZGOqcG.ttf +0 -0
- package/dist/assets/empty-BuGRxzl4.js +2210 -0
- package/dist/assets/en-CF30SCh2.js +95 -0
- package/dist/assets/en-DyO2pPiC.js +2 -0
- package/dist/assets/es-BkUFJVtD.js +43338 -0
- package/dist/assets/evaluation.constants-GYAwmJnh.js +284 -0
- package/dist/assets/executions.store-B9uRYwgv.js +205 -0
- package/dist/assets/exports-Crx_gvt_.js +1799 -0
- package/dist/assets/externalSecrets.ee.store-BJh4a_6G.js +118 -0
- package/dist/assets/fileUtils-CRWqOQje.js +20 -0
- package/dist/assets/folders.store-yAFj-5Vl.js +235 -0
- package/dist/assets/get-BcEmeOxn.js +2781 -0
- package/dist/assets/index-SL8542zQ.js +28372 -0
- package/dist/assets/insights.constants-BkJCYJTL.js +55 -0
- package/dist/assets/insights.store-BFc3kDUo.js +61 -0
- package/dist/assets/insights.utils-CcLXdrrz.js +77 -0
- package/dist/assets/isEmpty-C3XXoHqJ.js +35216 -0
- package/dist/assets/languageModules-9LyndCqU.js +13862 -0
- package/dist/assets/logStreaming.store-IZhWe_VK.js +190 -0
- package/dist/assets/mcp.constants-_Jcn7fPq.js +10 -0
- package/dist/assets/mcp.store-B9yfcAN9.js +116 -0
- package/dist/assets/merge-DhuTk1HM.js +564 -0
- package/dist/assets/nodeCreator.store-Bpnrwp2l.js +5444 -0
- package/dist/assets/nodeIcon-D6X-ENYt.js +102 -0
- package/dist/assets/nodeTransforms-RzcOM0v2.js +42 -0
- package/dist/assets/orderBy-Cu9F9DU_.js +15 -0
- package/dist/assets/path-browserify-RUt2u7iT.js +328 -0
- package/dist/assets/personalizedTemplatesV3.store-BGYp0YBN.js +334 -0
- package/dist/assets/pickBy-UI0Jt4wC.js +18 -0
- package/dist/assets/preload-helper-dyVz7ck7.js +59 -0
- package/dist/assets/radio-CSce3UT0.js +262 -0
- package/dist/assets/readyToRun.store-YEMvPUqo.js +626 -0
- package/dist/assets/readyToRunWorkflows.store-G3srgIze.js +1319 -0
- package/dist/assets/retry-BgHaYzbB.js +23 -0
- package/dist/assets/roles.store-CRf_zJTb.js +51 -0
- package/dist/assets/router-DNpzz3GH.js +2631 -0
- package/dist/assets/sanitize-html-CbW56HUN.js +10758 -0
- package/dist/assets/schemaPreview.store-DUgN1yVE.js +113 -0
- package/dist/assets/semver-Bk6DGseV.js +1306 -0
- package/dist/assets/smartDecimal-DAZl4HKA.js +6 -0
- package/dist/assets/sortByProperty-Cn7iGKYu.js +8 -0
- package/dist/assets/sourceControl.eventBus-D47xXSc_.js +3 -0
- package/dist/assets/sqlite3-DBpDb1lf.wasm +0 -0
- package/dist/assets/sqlite3-opfs-async-proxy-vVtmDGHX.js +461 -0
- package/dist/assets/sqlite3-worker1-bundler-friendly-DLarOZDL.js +9405 -0
- package/dist/assets/src-jviYSG25.js +55454 -0
- package/dist/assets/sso.store-DyApJwhx.js +139 -0
- package/dist/assets/style-E3CrYFV8.css +111829 -0
- package/dist/assets/table-we1DjFMV.js +3944 -0
- package/dist/assets/templateActions-bEDSARw2.js +65 -0
- package/dist/assets/templateTransforms-BHWiRbtR.js +43 -0
- package/dist/assets/truncate-C0KYt7i3.js +4176 -0
- package/dist/assets/typescript.worker-CYqLvLHh.js +152048 -0
- package/dist/assets/uniqBy-xDyuCRP0.js +10 -0
- package/dist/assets/usage.store-CU5J_nGm.js +100 -0
- package/dist/assets/useActions-B1JckIRj.js +255 -0
- package/dist/assets/useBeforeUnload-DiDkvI8p.js +40 -0
- package/dist/assets/useCanvasMapping-BXT7rGhC.js +12570 -0
- package/dist/assets/useCanvasOperations-8ULLtMkY.js +1765 -0
- package/dist/assets/useClipboard-DvjhVHqJ.js +39 -0
- package/dist/assets/useCommandBar-C4tLJbKt.js +2425 -0
- package/dist/assets/useCredentialResolvers-BKeFGJnY.js +78 -0
- package/dist/assets/useCustomAgent-DpILEt5e.js +471 -0
- package/dist/assets/useDebounce-Br5_1ug-.js +147 -0
- package/dist/assets/useExecutionData-M5iKsX6z.js +23 -0
- package/dist/assets/useExecutionDebugging-8azMzbnd.js +191 -0
- package/dist/assets/useExecutionHelpers-BgRRhpBM.js +91 -0
- package/dist/assets/useImportCurlCommand-CKiEmX5P.js +8891 -0
- package/dist/assets/useIntersectionObserver-BWMwOueh.js +33 -0
- package/dist/assets/useKeybindings-B2jfN6rd.js +62 -0
- package/dist/assets/useLogsTreeExpand-sZViUfdM.js +843 -0
- package/dist/assets/useMcp-DoMOIfqT.js +27 -0
- package/dist/assets/usePageRedirectionHelper-DjkznpX6.js +51 -0
- package/dist/assets/usePinnedData-BhZkqttf.js +203 -0
- package/dist/assets/usePushConnection-DMS-F_IW.js +513 -0
- package/dist/assets/useRecentResources-BVORr7eM.js +118 -0
- package/dist/assets/useRunWorkflow-LO7ffLp9.js +950 -0
- package/dist/assets/useSettingsItems-BhZXwMZn.js +144 -0
- package/dist/assets/useTelemetryContext-V6bv4YRq.js +34 -0
- package/dist/assets/useWorkflowActivate-DeSmDXjI.js +152 -0
- package/dist/assets/useWorkflowsCache-DtcEEAIR.js +179 -0
- package/dist/assets/userRoleProvisioning.store-kkSIdeTo.js +33 -0
- package/dist/assets/utils-DI7dLldp.js +54 -0
- package/dist/assets/versions.store-B1z2OrLE.js +191 -0
- package/dist/assets/vue-CydWIhxN.js +4378 -0
- package/dist/assets/vue-json-pretty-CsGX66mG.js +1130 -0
- package/dist/assets/vue.runtime.esm-bundler-tP5dCd7J.js +7325 -0
- package/dist/assets/xml-B_oj6Mle.js +2060 -0
- package/dist/favicon.ico +0 -0
- package/dist/index.html +157 -0
- package/dist/static/base-path.js +1 -0
- package/dist/static/community_package_tooltip_img.png +0 -0
- package/dist/static/data-mapping-gif.gif +0 -0
- package/dist/static/form-grey.svg +1 -0
- package/dist/static/google-auth/disabled.dark.png +0 -0
- package/dist/static/google-auth/disabled.png +0 -0
- package/dist/static/google-auth/focus.dark.png +0 -0
- package/dist/static/google-auth/focus.png +0 -0
- package/dist/static/google-auth/normal.dark.png +0 -0
- package/dist/static/google-auth/normal.png +0 -0
- package/dist/static/google-auth/pressed.dark.png +0 -0
- package/dist/static/google-auth/pressed.png +0 -0
- package/dist/static/n8n-logo.png +0 -0
- package/dist/static/og_image.png +0 -0
- package/dist/static/open-ai.svg +1 -0
- package/dist/static/openChat.png +0 -0
- package/dist/static/posthog.init.js +41 -0
- package/dist/static/prefers-color-scheme.css +5 -0
- package/dist/static/webhook-icon.svg +1 -0
- package/dist/tree-sitter-bash.wasm +0 -0
- package/dist/tree-sitter.wasm +0 -0
- package/eslint.config.mjs +59 -0
- package/index.html +45 -0
- package/index.js +0 -0
- package/package.json +147 -0
- package/postcss.config.cjs +6 -0
- package/scripts/fetch-node-popularity.mjs +102 -0
- package/stylelint.config.mjs +9 -0
- package/tailwind.config.js +8 -0
- package/tsconfig.json +36 -0
- package/vite/i18n-locales-hmr-helpers.ts +19 -0
- package/vite/source-map-js-shim.ts +1 -0
- package/vite/vite-plugin-node-popularity.mts +32 -0
- package/vite.config.mts +304 -0
|
@@ -0,0 +1,2781 @@
|
|
|
1
|
+
import { t as __commonJSMin } from "./chunk-6z4oVpB-.js";
|
|
2
|
+
import { C as computed, G as nextTick, Gt as unref, It as ref, K as onActivated, L as h, Lt as shallowReactive, P as defineComponent, Pt as reactive, Q as onUnmounted, Y as onDeactivated, _t as watch, nt as provide, z as inject, zt as shallowRef } from "./vue.runtime.esm-bundler-tP5dCd7J.js";
|
|
3
|
+
import { d as require__Symbol, l as require_isObjectLike, m as require_isArray, t as require__MapCache, u as require__baseGetTag } from "./_MapCache-CcdIl4Ae.js";
|
|
4
|
+
var require_default$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
5
|
+
function getDefaultWhiteList$1() {
|
|
6
|
+
var whiteList = {};
|
|
7
|
+
whiteList["align-content"] = false;
|
|
8
|
+
whiteList["align-items"] = false;
|
|
9
|
+
whiteList["align-self"] = false;
|
|
10
|
+
whiteList["alignment-adjust"] = false;
|
|
11
|
+
whiteList["alignment-baseline"] = false;
|
|
12
|
+
whiteList["all"] = false;
|
|
13
|
+
whiteList["anchor-point"] = false;
|
|
14
|
+
whiteList["animation"] = false;
|
|
15
|
+
whiteList["animation-delay"] = false;
|
|
16
|
+
whiteList["animation-direction"] = false;
|
|
17
|
+
whiteList["animation-duration"] = false;
|
|
18
|
+
whiteList["animation-fill-mode"] = false;
|
|
19
|
+
whiteList["animation-iteration-count"] = false;
|
|
20
|
+
whiteList["animation-name"] = false;
|
|
21
|
+
whiteList["animation-play-state"] = false;
|
|
22
|
+
whiteList["animation-timing-function"] = false;
|
|
23
|
+
whiteList["azimuth"] = false;
|
|
24
|
+
whiteList["backface-visibility"] = false;
|
|
25
|
+
whiteList["background"] = true;
|
|
26
|
+
whiteList["background-attachment"] = true;
|
|
27
|
+
whiteList["background-clip"] = true;
|
|
28
|
+
whiteList["background-color"] = true;
|
|
29
|
+
whiteList["background-image"] = true;
|
|
30
|
+
whiteList["background-origin"] = true;
|
|
31
|
+
whiteList["background-position"] = true;
|
|
32
|
+
whiteList["background-repeat"] = true;
|
|
33
|
+
whiteList["background-size"] = true;
|
|
34
|
+
whiteList["baseline-shift"] = false;
|
|
35
|
+
whiteList["binding"] = false;
|
|
36
|
+
whiteList["bleed"] = false;
|
|
37
|
+
whiteList["bookmark-label"] = false;
|
|
38
|
+
whiteList["bookmark-level"] = false;
|
|
39
|
+
whiteList["bookmark-state"] = false;
|
|
40
|
+
whiteList["border"] = true;
|
|
41
|
+
whiteList["border-bottom"] = true;
|
|
42
|
+
whiteList["border-bottom-color"] = true;
|
|
43
|
+
whiteList["border-bottom-left-radius"] = true;
|
|
44
|
+
whiteList["border-bottom-right-radius"] = true;
|
|
45
|
+
whiteList["border-bottom-style"] = true;
|
|
46
|
+
whiteList["border-bottom-width"] = true;
|
|
47
|
+
whiteList["border-collapse"] = true;
|
|
48
|
+
whiteList["border-color"] = true;
|
|
49
|
+
whiteList["border-image"] = true;
|
|
50
|
+
whiteList["border-image-outset"] = true;
|
|
51
|
+
whiteList["border-image-repeat"] = true;
|
|
52
|
+
whiteList["border-image-slice"] = true;
|
|
53
|
+
whiteList["border-image-source"] = true;
|
|
54
|
+
whiteList["border-image-width"] = true;
|
|
55
|
+
whiteList["border-left"] = true;
|
|
56
|
+
whiteList["border-left-color"] = true;
|
|
57
|
+
whiteList["border-left-style"] = true;
|
|
58
|
+
whiteList["border-left-width"] = true;
|
|
59
|
+
whiteList["border-radius"] = true;
|
|
60
|
+
whiteList["border-right"] = true;
|
|
61
|
+
whiteList["border-right-color"] = true;
|
|
62
|
+
whiteList["border-right-style"] = true;
|
|
63
|
+
whiteList["border-right-width"] = true;
|
|
64
|
+
whiteList["border-spacing"] = true;
|
|
65
|
+
whiteList["border-style"] = true;
|
|
66
|
+
whiteList["border-top"] = true;
|
|
67
|
+
whiteList["border-top-color"] = true;
|
|
68
|
+
whiteList["border-top-left-radius"] = true;
|
|
69
|
+
whiteList["border-top-right-radius"] = true;
|
|
70
|
+
whiteList["border-top-style"] = true;
|
|
71
|
+
whiteList["border-top-width"] = true;
|
|
72
|
+
whiteList["border-width"] = true;
|
|
73
|
+
whiteList["bottom"] = false;
|
|
74
|
+
whiteList["box-decoration-break"] = true;
|
|
75
|
+
whiteList["box-shadow"] = true;
|
|
76
|
+
whiteList["box-sizing"] = true;
|
|
77
|
+
whiteList["box-snap"] = true;
|
|
78
|
+
whiteList["box-suppress"] = true;
|
|
79
|
+
whiteList["break-after"] = true;
|
|
80
|
+
whiteList["break-before"] = true;
|
|
81
|
+
whiteList["break-inside"] = true;
|
|
82
|
+
whiteList["caption-side"] = false;
|
|
83
|
+
whiteList["chains"] = false;
|
|
84
|
+
whiteList["clear"] = true;
|
|
85
|
+
whiteList["clip"] = false;
|
|
86
|
+
whiteList["clip-path"] = false;
|
|
87
|
+
whiteList["clip-rule"] = false;
|
|
88
|
+
whiteList["color"] = true;
|
|
89
|
+
whiteList["color-interpolation-filters"] = true;
|
|
90
|
+
whiteList["column-count"] = false;
|
|
91
|
+
whiteList["column-fill"] = false;
|
|
92
|
+
whiteList["column-gap"] = false;
|
|
93
|
+
whiteList["column-rule"] = false;
|
|
94
|
+
whiteList["column-rule-color"] = false;
|
|
95
|
+
whiteList["column-rule-style"] = false;
|
|
96
|
+
whiteList["column-rule-width"] = false;
|
|
97
|
+
whiteList["column-span"] = false;
|
|
98
|
+
whiteList["column-width"] = false;
|
|
99
|
+
whiteList["columns"] = false;
|
|
100
|
+
whiteList["contain"] = false;
|
|
101
|
+
whiteList["content"] = false;
|
|
102
|
+
whiteList["counter-increment"] = false;
|
|
103
|
+
whiteList["counter-reset"] = false;
|
|
104
|
+
whiteList["counter-set"] = false;
|
|
105
|
+
whiteList["crop"] = false;
|
|
106
|
+
whiteList["cue"] = false;
|
|
107
|
+
whiteList["cue-after"] = false;
|
|
108
|
+
whiteList["cue-before"] = false;
|
|
109
|
+
whiteList["cursor"] = false;
|
|
110
|
+
whiteList["direction"] = false;
|
|
111
|
+
whiteList["display"] = true;
|
|
112
|
+
whiteList["display-inside"] = true;
|
|
113
|
+
whiteList["display-list"] = true;
|
|
114
|
+
whiteList["display-outside"] = true;
|
|
115
|
+
whiteList["dominant-baseline"] = false;
|
|
116
|
+
whiteList["elevation"] = false;
|
|
117
|
+
whiteList["empty-cells"] = false;
|
|
118
|
+
whiteList["filter"] = false;
|
|
119
|
+
whiteList["flex"] = false;
|
|
120
|
+
whiteList["flex-basis"] = false;
|
|
121
|
+
whiteList["flex-direction"] = false;
|
|
122
|
+
whiteList["flex-flow"] = false;
|
|
123
|
+
whiteList["flex-grow"] = false;
|
|
124
|
+
whiteList["flex-shrink"] = false;
|
|
125
|
+
whiteList["flex-wrap"] = false;
|
|
126
|
+
whiteList["float"] = false;
|
|
127
|
+
whiteList["float-offset"] = false;
|
|
128
|
+
whiteList["flood-color"] = false;
|
|
129
|
+
whiteList["flood-opacity"] = false;
|
|
130
|
+
whiteList["flow-from"] = false;
|
|
131
|
+
whiteList["flow-into"] = false;
|
|
132
|
+
whiteList["font"] = true;
|
|
133
|
+
whiteList["font-family"] = true;
|
|
134
|
+
whiteList["font-feature-settings"] = true;
|
|
135
|
+
whiteList["font-kerning"] = true;
|
|
136
|
+
whiteList["font-language-override"] = true;
|
|
137
|
+
whiteList["font-size"] = true;
|
|
138
|
+
whiteList["font-size-adjust"] = true;
|
|
139
|
+
whiteList["font-stretch"] = true;
|
|
140
|
+
whiteList["font-style"] = true;
|
|
141
|
+
whiteList["font-synthesis"] = true;
|
|
142
|
+
whiteList["font-variant"] = true;
|
|
143
|
+
whiteList["font-variant-alternates"] = true;
|
|
144
|
+
whiteList["font-variant-caps"] = true;
|
|
145
|
+
whiteList["font-variant-east-asian"] = true;
|
|
146
|
+
whiteList["font-variant-ligatures"] = true;
|
|
147
|
+
whiteList["font-variant-numeric"] = true;
|
|
148
|
+
whiteList["font-variant-position"] = true;
|
|
149
|
+
whiteList["font-weight"] = true;
|
|
150
|
+
whiteList["grid"] = false;
|
|
151
|
+
whiteList["grid-area"] = false;
|
|
152
|
+
whiteList["grid-auto-columns"] = false;
|
|
153
|
+
whiteList["grid-auto-flow"] = false;
|
|
154
|
+
whiteList["grid-auto-rows"] = false;
|
|
155
|
+
whiteList["grid-column"] = false;
|
|
156
|
+
whiteList["grid-column-end"] = false;
|
|
157
|
+
whiteList["grid-column-start"] = false;
|
|
158
|
+
whiteList["grid-row"] = false;
|
|
159
|
+
whiteList["grid-row-end"] = false;
|
|
160
|
+
whiteList["grid-row-start"] = false;
|
|
161
|
+
whiteList["grid-template"] = false;
|
|
162
|
+
whiteList["grid-template-areas"] = false;
|
|
163
|
+
whiteList["grid-template-columns"] = false;
|
|
164
|
+
whiteList["grid-template-rows"] = false;
|
|
165
|
+
whiteList["hanging-punctuation"] = false;
|
|
166
|
+
whiteList["height"] = true;
|
|
167
|
+
whiteList["hyphens"] = false;
|
|
168
|
+
whiteList["icon"] = false;
|
|
169
|
+
whiteList["image-orientation"] = false;
|
|
170
|
+
whiteList["image-resolution"] = false;
|
|
171
|
+
whiteList["ime-mode"] = false;
|
|
172
|
+
whiteList["initial-letters"] = false;
|
|
173
|
+
whiteList["inline-box-align"] = false;
|
|
174
|
+
whiteList["justify-content"] = false;
|
|
175
|
+
whiteList["justify-items"] = false;
|
|
176
|
+
whiteList["justify-self"] = false;
|
|
177
|
+
whiteList["left"] = false;
|
|
178
|
+
whiteList["letter-spacing"] = true;
|
|
179
|
+
whiteList["lighting-color"] = true;
|
|
180
|
+
whiteList["line-box-contain"] = false;
|
|
181
|
+
whiteList["line-break"] = false;
|
|
182
|
+
whiteList["line-grid"] = false;
|
|
183
|
+
whiteList["line-height"] = false;
|
|
184
|
+
whiteList["line-snap"] = false;
|
|
185
|
+
whiteList["line-stacking"] = false;
|
|
186
|
+
whiteList["line-stacking-ruby"] = false;
|
|
187
|
+
whiteList["line-stacking-shift"] = false;
|
|
188
|
+
whiteList["line-stacking-strategy"] = false;
|
|
189
|
+
whiteList["list-style"] = true;
|
|
190
|
+
whiteList["list-style-image"] = true;
|
|
191
|
+
whiteList["list-style-position"] = true;
|
|
192
|
+
whiteList["list-style-type"] = true;
|
|
193
|
+
whiteList["margin"] = true;
|
|
194
|
+
whiteList["margin-bottom"] = true;
|
|
195
|
+
whiteList["margin-left"] = true;
|
|
196
|
+
whiteList["margin-right"] = true;
|
|
197
|
+
whiteList["margin-top"] = true;
|
|
198
|
+
whiteList["marker-offset"] = false;
|
|
199
|
+
whiteList["marker-side"] = false;
|
|
200
|
+
whiteList["marks"] = false;
|
|
201
|
+
whiteList["mask"] = false;
|
|
202
|
+
whiteList["mask-box"] = false;
|
|
203
|
+
whiteList["mask-box-outset"] = false;
|
|
204
|
+
whiteList["mask-box-repeat"] = false;
|
|
205
|
+
whiteList["mask-box-slice"] = false;
|
|
206
|
+
whiteList["mask-box-source"] = false;
|
|
207
|
+
whiteList["mask-box-width"] = false;
|
|
208
|
+
whiteList["mask-clip"] = false;
|
|
209
|
+
whiteList["mask-image"] = false;
|
|
210
|
+
whiteList["mask-origin"] = false;
|
|
211
|
+
whiteList["mask-position"] = false;
|
|
212
|
+
whiteList["mask-repeat"] = false;
|
|
213
|
+
whiteList["mask-size"] = false;
|
|
214
|
+
whiteList["mask-source-type"] = false;
|
|
215
|
+
whiteList["mask-type"] = false;
|
|
216
|
+
whiteList["max-height"] = true;
|
|
217
|
+
whiteList["max-lines"] = false;
|
|
218
|
+
whiteList["max-width"] = true;
|
|
219
|
+
whiteList["min-height"] = true;
|
|
220
|
+
whiteList["min-width"] = true;
|
|
221
|
+
whiteList["move-to"] = false;
|
|
222
|
+
whiteList["nav-down"] = false;
|
|
223
|
+
whiteList["nav-index"] = false;
|
|
224
|
+
whiteList["nav-left"] = false;
|
|
225
|
+
whiteList["nav-right"] = false;
|
|
226
|
+
whiteList["nav-up"] = false;
|
|
227
|
+
whiteList["object-fit"] = false;
|
|
228
|
+
whiteList["object-position"] = false;
|
|
229
|
+
whiteList["opacity"] = false;
|
|
230
|
+
whiteList["order"] = false;
|
|
231
|
+
whiteList["orphans"] = false;
|
|
232
|
+
whiteList["outline"] = false;
|
|
233
|
+
whiteList["outline-color"] = false;
|
|
234
|
+
whiteList["outline-offset"] = false;
|
|
235
|
+
whiteList["outline-style"] = false;
|
|
236
|
+
whiteList["outline-width"] = false;
|
|
237
|
+
whiteList["overflow"] = false;
|
|
238
|
+
whiteList["overflow-wrap"] = false;
|
|
239
|
+
whiteList["overflow-x"] = false;
|
|
240
|
+
whiteList["overflow-y"] = false;
|
|
241
|
+
whiteList["padding"] = true;
|
|
242
|
+
whiteList["padding-bottom"] = true;
|
|
243
|
+
whiteList["padding-left"] = true;
|
|
244
|
+
whiteList["padding-right"] = true;
|
|
245
|
+
whiteList["padding-top"] = true;
|
|
246
|
+
whiteList["page"] = false;
|
|
247
|
+
whiteList["page-break-after"] = false;
|
|
248
|
+
whiteList["page-break-before"] = false;
|
|
249
|
+
whiteList["page-break-inside"] = false;
|
|
250
|
+
whiteList["page-policy"] = false;
|
|
251
|
+
whiteList["pause"] = false;
|
|
252
|
+
whiteList["pause-after"] = false;
|
|
253
|
+
whiteList["pause-before"] = false;
|
|
254
|
+
whiteList["perspective"] = false;
|
|
255
|
+
whiteList["perspective-origin"] = false;
|
|
256
|
+
whiteList["pitch"] = false;
|
|
257
|
+
whiteList["pitch-range"] = false;
|
|
258
|
+
whiteList["play-during"] = false;
|
|
259
|
+
whiteList["position"] = false;
|
|
260
|
+
whiteList["presentation-level"] = false;
|
|
261
|
+
whiteList["quotes"] = false;
|
|
262
|
+
whiteList["region-fragment"] = false;
|
|
263
|
+
whiteList["resize"] = false;
|
|
264
|
+
whiteList["rest"] = false;
|
|
265
|
+
whiteList["rest-after"] = false;
|
|
266
|
+
whiteList["rest-before"] = false;
|
|
267
|
+
whiteList["richness"] = false;
|
|
268
|
+
whiteList["right"] = false;
|
|
269
|
+
whiteList["rotation"] = false;
|
|
270
|
+
whiteList["rotation-point"] = false;
|
|
271
|
+
whiteList["ruby-align"] = false;
|
|
272
|
+
whiteList["ruby-merge"] = false;
|
|
273
|
+
whiteList["ruby-position"] = false;
|
|
274
|
+
whiteList["shape-image-threshold"] = false;
|
|
275
|
+
whiteList["shape-outside"] = false;
|
|
276
|
+
whiteList["shape-margin"] = false;
|
|
277
|
+
whiteList["size"] = false;
|
|
278
|
+
whiteList["speak"] = false;
|
|
279
|
+
whiteList["speak-as"] = false;
|
|
280
|
+
whiteList["speak-header"] = false;
|
|
281
|
+
whiteList["speak-numeral"] = false;
|
|
282
|
+
whiteList["speak-punctuation"] = false;
|
|
283
|
+
whiteList["speech-rate"] = false;
|
|
284
|
+
whiteList["stress"] = false;
|
|
285
|
+
whiteList["string-set"] = false;
|
|
286
|
+
whiteList["tab-size"] = false;
|
|
287
|
+
whiteList["table-layout"] = false;
|
|
288
|
+
whiteList["text-align"] = true;
|
|
289
|
+
whiteList["text-align-last"] = true;
|
|
290
|
+
whiteList["text-combine-upright"] = true;
|
|
291
|
+
whiteList["text-decoration"] = true;
|
|
292
|
+
whiteList["text-decoration-color"] = true;
|
|
293
|
+
whiteList["text-decoration-line"] = true;
|
|
294
|
+
whiteList["text-decoration-skip"] = true;
|
|
295
|
+
whiteList["text-decoration-style"] = true;
|
|
296
|
+
whiteList["text-emphasis"] = true;
|
|
297
|
+
whiteList["text-emphasis-color"] = true;
|
|
298
|
+
whiteList["text-emphasis-position"] = true;
|
|
299
|
+
whiteList["text-emphasis-style"] = true;
|
|
300
|
+
whiteList["text-height"] = true;
|
|
301
|
+
whiteList["text-indent"] = true;
|
|
302
|
+
whiteList["text-justify"] = true;
|
|
303
|
+
whiteList["text-orientation"] = true;
|
|
304
|
+
whiteList["text-overflow"] = true;
|
|
305
|
+
whiteList["text-shadow"] = true;
|
|
306
|
+
whiteList["text-space-collapse"] = true;
|
|
307
|
+
whiteList["text-transform"] = true;
|
|
308
|
+
whiteList["text-underline-position"] = true;
|
|
309
|
+
whiteList["text-wrap"] = true;
|
|
310
|
+
whiteList["top"] = false;
|
|
311
|
+
whiteList["transform"] = false;
|
|
312
|
+
whiteList["transform-origin"] = false;
|
|
313
|
+
whiteList["transform-style"] = false;
|
|
314
|
+
whiteList["transition"] = false;
|
|
315
|
+
whiteList["transition-delay"] = false;
|
|
316
|
+
whiteList["transition-duration"] = false;
|
|
317
|
+
whiteList["transition-property"] = false;
|
|
318
|
+
whiteList["transition-timing-function"] = false;
|
|
319
|
+
whiteList["unicode-bidi"] = false;
|
|
320
|
+
whiteList["vertical-align"] = false;
|
|
321
|
+
whiteList["visibility"] = false;
|
|
322
|
+
whiteList["voice-balance"] = false;
|
|
323
|
+
whiteList["voice-duration"] = false;
|
|
324
|
+
whiteList["voice-family"] = false;
|
|
325
|
+
whiteList["voice-pitch"] = false;
|
|
326
|
+
whiteList["voice-range"] = false;
|
|
327
|
+
whiteList["voice-rate"] = false;
|
|
328
|
+
whiteList["voice-stress"] = false;
|
|
329
|
+
whiteList["voice-volume"] = false;
|
|
330
|
+
whiteList["volume"] = false;
|
|
331
|
+
whiteList["white-space"] = false;
|
|
332
|
+
whiteList["widows"] = false;
|
|
333
|
+
whiteList["width"] = true;
|
|
334
|
+
whiteList["will-change"] = false;
|
|
335
|
+
whiteList["word-break"] = true;
|
|
336
|
+
whiteList["word-spacing"] = true;
|
|
337
|
+
whiteList["word-wrap"] = true;
|
|
338
|
+
whiteList["wrap-flow"] = false;
|
|
339
|
+
whiteList["wrap-through"] = false;
|
|
340
|
+
whiteList["writing-mode"] = false;
|
|
341
|
+
whiteList["z-index"] = false;
|
|
342
|
+
return whiteList;
|
|
343
|
+
}
|
|
344
|
+
function onAttr(name, value, options) {}
|
|
345
|
+
function onIgnoreAttr(name, value, options) {}
|
|
346
|
+
var REGEXP_URL_JAVASCRIPT = /javascript\s*\:/gim;
|
|
347
|
+
function safeAttrValue$1(name, value) {
|
|
348
|
+
if (REGEXP_URL_JAVASCRIPT.test(value)) return "";
|
|
349
|
+
return value;
|
|
350
|
+
}
|
|
351
|
+
exports.whiteList = getDefaultWhiteList$1();
|
|
352
|
+
exports.getDefaultWhiteList = getDefaultWhiteList$1;
|
|
353
|
+
exports.onAttr = onAttr;
|
|
354
|
+
exports.onIgnoreAttr = onIgnoreAttr;
|
|
355
|
+
exports.safeAttrValue = safeAttrValue$1;
|
|
356
|
+
}));
|
|
357
|
+
var require_util$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
358
|
+
module.exports = {
|
|
359
|
+
indexOf: function(arr, item) {
|
|
360
|
+
var i$1, j;
|
|
361
|
+
if (Array.prototype.indexOf) return arr.indexOf(item);
|
|
362
|
+
for (i$1 = 0, j = arr.length; i$1 < j; i$1++) if (arr[i$1] === item) return i$1;
|
|
363
|
+
return -1;
|
|
364
|
+
},
|
|
365
|
+
forEach: function(arr, fn, scope) {
|
|
366
|
+
var i$1, j;
|
|
367
|
+
if (Array.prototype.forEach) return arr.forEach(fn, scope);
|
|
368
|
+
for (i$1 = 0, j = arr.length; i$1 < j; i$1++) fn.call(scope, arr[i$1], i$1, arr);
|
|
369
|
+
},
|
|
370
|
+
trim: function(str) {
|
|
371
|
+
if (String.prototype.trim) return str.trim();
|
|
372
|
+
return str.replace(/(^\s*)|(\s*$)/g, "");
|
|
373
|
+
},
|
|
374
|
+
trimRight: function(str) {
|
|
375
|
+
if (String.prototype.trimRight) return str.trimRight();
|
|
376
|
+
return str.replace(/(\s*$)/g, "");
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
}));
|
|
380
|
+
var require_parser$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
381
|
+
var _$3 = require_util$1();
|
|
382
|
+
function parseStyle$1(css, onAttr$1) {
|
|
383
|
+
css = _$3.trimRight(css);
|
|
384
|
+
if (css[css.length - 1] !== ";") css += ";";
|
|
385
|
+
var cssLength = css.length;
|
|
386
|
+
var isParenthesisOpen = false;
|
|
387
|
+
var lastPos = 0;
|
|
388
|
+
var i$1 = 0;
|
|
389
|
+
var retCSS = "";
|
|
390
|
+
function addNewAttr() {
|
|
391
|
+
if (!isParenthesisOpen) {
|
|
392
|
+
var source = _$3.trim(css.slice(lastPos, i$1));
|
|
393
|
+
var j$1 = source.indexOf(":");
|
|
394
|
+
if (j$1 !== -1) {
|
|
395
|
+
var name = _$3.trim(source.slice(0, j$1));
|
|
396
|
+
var value = _$3.trim(source.slice(j$1 + 1));
|
|
397
|
+
if (name) {
|
|
398
|
+
var ret = onAttr$1(lastPos, retCSS.length, name, value, source);
|
|
399
|
+
if (ret) retCSS += ret + "; ";
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
lastPos = i$1 + 1;
|
|
404
|
+
}
|
|
405
|
+
for (; i$1 < cssLength; i$1++) {
|
|
406
|
+
var c = css[i$1];
|
|
407
|
+
if (c === "/" && css[i$1 + 1] === "*") {
|
|
408
|
+
var j = css.indexOf("*/", i$1 + 2);
|
|
409
|
+
if (j === -1) break;
|
|
410
|
+
i$1 = j + 1;
|
|
411
|
+
lastPos = i$1 + 1;
|
|
412
|
+
isParenthesisOpen = false;
|
|
413
|
+
} else if (c === "(") isParenthesisOpen = true;
|
|
414
|
+
else if (c === ")") isParenthesisOpen = false;
|
|
415
|
+
else if (c === ";") if (isParenthesisOpen) {} else addNewAttr();
|
|
416
|
+
else if (c === "\n") addNewAttr();
|
|
417
|
+
}
|
|
418
|
+
return _$3.trim(retCSS);
|
|
419
|
+
}
|
|
420
|
+
module.exports = parseStyle$1;
|
|
421
|
+
}));
|
|
422
|
+
var require_css = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
423
|
+
var DEFAULT$3 = require_default$1();
|
|
424
|
+
var parseStyle = require_parser$1();
|
|
425
|
+
require_util$1();
|
|
426
|
+
function isNull$1(obj) {
|
|
427
|
+
return obj === void 0 || obj === null;
|
|
428
|
+
}
|
|
429
|
+
function shallowCopyObject$1(obj) {
|
|
430
|
+
var ret = {};
|
|
431
|
+
for (var i$1 in obj) ret[i$1] = obj[i$1];
|
|
432
|
+
return ret;
|
|
433
|
+
}
|
|
434
|
+
function FilterCSS$3(options) {
|
|
435
|
+
options = shallowCopyObject$1(options || {});
|
|
436
|
+
options.whiteList = options.whiteList || DEFAULT$3.whiteList;
|
|
437
|
+
options.onAttr = options.onAttr || DEFAULT$3.onAttr;
|
|
438
|
+
options.onIgnoreAttr = options.onIgnoreAttr || DEFAULT$3.onIgnoreAttr;
|
|
439
|
+
options.safeAttrValue = options.safeAttrValue || DEFAULT$3.safeAttrValue;
|
|
440
|
+
this.options = options;
|
|
441
|
+
}
|
|
442
|
+
FilterCSS$3.prototype.process = function(css) {
|
|
443
|
+
css = css || "";
|
|
444
|
+
css = css.toString();
|
|
445
|
+
if (!css) return "";
|
|
446
|
+
var options = this.options;
|
|
447
|
+
var whiteList = options.whiteList;
|
|
448
|
+
var onAttr$1 = options.onAttr;
|
|
449
|
+
var onIgnoreAttr$1 = options.onIgnoreAttr;
|
|
450
|
+
var safeAttrValue$2 = options.safeAttrValue;
|
|
451
|
+
return parseStyle(css, function(sourcePosition, position, name, value, source) {
|
|
452
|
+
var check = whiteList[name];
|
|
453
|
+
var isWhite = false;
|
|
454
|
+
if (check === true) isWhite = check;
|
|
455
|
+
else if (typeof check === "function") isWhite = check(value);
|
|
456
|
+
else if (check instanceof RegExp) isWhite = check.test(value);
|
|
457
|
+
if (isWhite !== true) isWhite = false;
|
|
458
|
+
value = safeAttrValue$2(name, value);
|
|
459
|
+
if (!value) return;
|
|
460
|
+
var opts = {
|
|
461
|
+
position,
|
|
462
|
+
sourcePosition,
|
|
463
|
+
source,
|
|
464
|
+
isWhite
|
|
465
|
+
};
|
|
466
|
+
if (isWhite) {
|
|
467
|
+
var ret = onAttr$1(name, value, opts);
|
|
468
|
+
if (isNull$1(ret)) return name + ":" + value;
|
|
469
|
+
else return ret;
|
|
470
|
+
} else {
|
|
471
|
+
var ret = onIgnoreAttr$1(name, value, opts);
|
|
472
|
+
if (!isNull$1(ret)) return ret;
|
|
473
|
+
}
|
|
474
|
+
});
|
|
475
|
+
};
|
|
476
|
+
module.exports = FilterCSS$3;
|
|
477
|
+
}));
|
|
478
|
+
var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
479
|
+
var DEFAULT$2 = require_default$1();
|
|
480
|
+
var FilterCSS$2 = require_css();
|
|
481
|
+
function filterCSS(html, options) {
|
|
482
|
+
return new FilterCSS$2(options).process(html);
|
|
483
|
+
}
|
|
484
|
+
exports = module.exports = filterCSS;
|
|
485
|
+
exports.FilterCSS = FilterCSS$2;
|
|
486
|
+
for (var i in DEFAULT$2) exports[i] = DEFAULT$2[i];
|
|
487
|
+
if (typeof window !== "undefined") window.filterCSS = module.exports;
|
|
488
|
+
}));
|
|
489
|
+
var require_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
490
|
+
module.exports = {
|
|
491
|
+
indexOf: function(arr, item) {
|
|
492
|
+
var i$1, j;
|
|
493
|
+
if (Array.prototype.indexOf) return arr.indexOf(item);
|
|
494
|
+
for (i$1 = 0, j = arr.length; i$1 < j; i$1++) if (arr[i$1] === item) return i$1;
|
|
495
|
+
return -1;
|
|
496
|
+
},
|
|
497
|
+
forEach: function(arr, fn, scope) {
|
|
498
|
+
var i$1, j;
|
|
499
|
+
if (Array.prototype.forEach) return arr.forEach(fn, scope);
|
|
500
|
+
for (i$1 = 0, j = arr.length; i$1 < j; i$1++) fn.call(scope, arr[i$1], i$1, arr);
|
|
501
|
+
},
|
|
502
|
+
trim: function(str) {
|
|
503
|
+
if (String.prototype.trim) return str.trim();
|
|
504
|
+
return str.replace(/(^\s*)|(\s*$)/g, "");
|
|
505
|
+
},
|
|
506
|
+
spaceIndex: function(str) {
|
|
507
|
+
var match = /\s|\n|\t/.exec(str);
|
|
508
|
+
return match ? match.index : -1;
|
|
509
|
+
}
|
|
510
|
+
};
|
|
511
|
+
}));
|
|
512
|
+
var require_default = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
513
|
+
var FilterCSS$1 = require_lib$1().FilterCSS;
|
|
514
|
+
var getDefaultCSSWhiteList = require_lib$1().getDefaultWhiteList;
|
|
515
|
+
var _$2 = require_util();
|
|
516
|
+
function getDefaultWhiteList() {
|
|
517
|
+
return {
|
|
518
|
+
a: [
|
|
519
|
+
"target",
|
|
520
|
+
"href",
|
|
521
|
+
"title"
|
|
522
|
+
],
|
|
523
|
+
abbr: ["title"],
|
|
524
|
+
address: [],
|
|
525
|
+
area: [
|
|
526
|
+
"shape",
|
|
527
|
+
"coords",
|
|
528
|
+
"href",
|
|
529
|
+
"alt"
|
|
530
|
+
],
|
|
531
|
+
article: [],
|
|
532
|
+
aside: [],
|
|
533
|
+
audio: [
|
|
534
|
+
"autoplay",
|
|
535
|
+
"controls",
|
|
536
|
+
"crossorigin",
|
|
537
|
+
"loop",
|
|
538
|
+
"muted",
|
|
539
|
+
"preload",
|
|
540
|
+
"src"
|
|
541
|
+
],
|
|
542
|
+
b: [],
|
|
543
|
+
bdi: ["dir"],
|
|
544
|
+
bdo: ["dir"],
|
|
545
|
+
big: [],
|
|
546
|
+
blockquote: ["cite"],
|
|
547
|
+
br: [],
|
|
548
|
+
caption: [],
|
|
549
|
+
center: [],
|
|
550
|
+
cite: [],
|
|
551
|
+
code: [],
|
|
552
|
+
col: [
|
|
553
|
+
"align",
|
|
554
|
+
"valign",
|
|
555
|
+
"span",
|
|
556
|
+
"width"
|
|
557
|
+
],
|
|
558
|
+
colgroup: [
|
|
559
|
+
"align",
|
|
560
|
+
"valign",
|
|
561
|
+
"span",
|
|
562
|
+
"width"
|
|
563
|
+
],
|
|
564
|
+
dd: [],
|
|
565
|
+
del: ["datetime"],
|
|
566
|
+
details: ["open"],
|
|
567
|
+
div: [],
|
|
568
|
+
dl: [],
|
|
569
|
+
dt: [],
|
|
570
|
+
em: [],
|
|
571
|
+
figcaption: [],
|
|
572
|
+
figure: [],
|
|
573
|
+
font: [
|
|
574
|
+
"color",
|
|
575
|
+
"size",
|
|
576
|
+
"face"
|
|
577
|
+
],
|
|
578
|
+
footer: [],
|
|
579
|
+
h1: [],
|
|
580
|
+
h2: [],
|
|
581
|
+
h3: [],
|
|
582
|
+
h4: [],
|
|
583
|
+
h5: [],
|
|
584
|
+
h6: [],
|
|
585
|
+
header: [],
|
|
586
|
+
hr: [],
|
|
587
|
+
i: [],
|
|
588
|
+
img: [
|
|
589
|
+
"src",
|
|
590
|
+
"alt",
|
|
591
|
+
"title",
|
|
592
|
+
"width",
|
|
593
|
+
"height",
|
|
594
|
+
"loading"
|
|
595
|
+
],
|
|
596
|
+
ins: ["datetime"],
|
|
597
|
+
kbd: [],
|
|
598
|
+
li: [],
|
|
599
|
+
mark: [],
|
|
600
|
+
nav: [],
|
|
601
|
+
ol: [],
|
|
602
|
+
p: [],
|
|
603
|
+
pre: [],
|
|
604
|
+
s: [],
|
|
605
|
+
section: [],
|
|
606
|
+
small: [],
|
|
607
|
+
span: [],
|
|
608
|
+
sub: [],
|
|
609
|
+
summary: [],
|
|
610
|
+
sup: [],
|
|
611
|
+
strong: [],
|
|
612
|
+
strike: [],
|
|
613
|
+
table: [
|
|
614
|
+
"width",
|
|
615
|
+
"border",
|
|
616
|
+
"align",
|
|
617
|
+
"valign"
|
|
618
|
+
],
|
|
619
|
+
tbody: ["align", "valign"],
|
|
620
|
+
td: [
|
|
621
|
+
"width",
|
|
622
|
+
"rowspan",
|
|
623
|
+
"colspan",
|
|
624
|
+
"align",
|
|
625
|
+
"valign"
|
|
626
|
+
],
|
|
627
|
+
tfoot: ["align", "valign"],
|
|
628
|
+
th: [
|
|
629
|
+
"width",
|
|
630
|
+
"rowspan",
|
|
631
|
+
"colspan",
|
|
632
|
+
"align",
|
|
633
|
+
"valign"
|
|
634
|
+
],
|
|
635
|
+
thead: ["align", "valign"],
|
|
636
|
+
tr: [
|
|
637
|
+
"rowspan",
|
|
638
|
+
"align",
|
|
639
|
+
"valign"
|
|
640
|
+
],
|
|
641
|
+
tt: [],
|
|
642
|
+
u: [],
|
|
643
|
+
ul: [],
|
|
644
|
+
video: [
|
|
645
|
+
"autoplay",
|
|
646
|
+
"controls",
|
|
647
|
+
"crossorigin",
|
|
648
|
+
"loop",
|
|
649
|
+
"muted",
|
|
650
|
+
"playsinline",
|
|
651
|
+
"poster",
|
|
652
|
+
"preload",
|
|
653
|
+
"src",
|
|
654
|
+
"height",
|
|
655
|
+
"width"
|
|
656
|
+
]
|
|
657
|
+
};
|
|
658
|
+
}
|
|
659
|
+
var defaultCSSFilter = new FilterCSS$1();
|
|
660
|
+
function onTag(tag, html, options) {}
|
|
661
|
+
function onIgnoreTag(tag, html, options) {}
|
|
662
|
+
function onTagAttr(tag, name, value) {}
|
|
663
|
+
function onIgnoreTagAttr(tag, name, value) {}
|
|
664
|
+
function escapeHtml(html) {
|
|
665
|
+
return html.replace(REGEXP_LT, "<").replace(REGEXP_GT, ">");
|
|
666
|
+
}
|
|
667
|
+
function safeAttrValue(tag, name, value, cssFilter) {
|
|
668
|
+
value = friendlyAttrValue(value);
|
|
669
|
+
if (name === "href" || name === "src") {
|
|
670
|
+
value = _$2.trim(value);
|
|
671
|
+
if (value === "#") return "#";
|
|
672
|
+
if (!(value.substr(0, 7) === "http://" || value.substr(0, 8) === "https://" || value.substr(0, 7) === "mailto:" || value.substr(0, 4) === "tel:" || value.substr(0, 11) === "data:image/" || value.substr(0, 6) === "ftp://" || value.substr(0, 2) === "./" || value.substr(0, 3) === "../" || value[0] === "#" || value[0] === "/")) return "";
|
|
673
|
+
} else if (name === "background") {
|
|
674
|
+
REGEXP_DEFAULT_ON_TAG_ATTR_4.lastIndex = 0;
|
|
675
|
+
if (REGEXP_DEFAULT_ON_TAG_ATTR_4.test(value)) return "";
|
|
676
|
+
} else if (name === "style") {
|
|
677
|
+
REGEXP_DEFAULT_ON_TAG_ATTR_7.lastIndex = 0;
|
|
678
|
+
if (REGEXP_DEFAULT_ON_TAG_ATTR_7.test(value)) return "";
|
|
679
|
+
REGEXP_DEFAULT_ON_TAG_ATTR_8.lastIndex = 0;
|
|
680
|
+
if (REGEXP_DEFAULT_ON_TAG_ATTR_8.test(value)) {
|
|
681
|
+
REGEXP_DEFAULT_ON_TAG_ATTR_4.lastIndex = 0;
|
|
682
|
+
if (REGEXP_DEFAULT_ON_TAG_ATTR_4.test(value)) return "";
|
|
683
|
+
}
|
|
684
|
+
if (cssFilter !== false) {
|
|
685
|
+
cssFilter = cssFilter || defaultCSSFilter;
|
|
686
|
+
value = cssFilter.process(value);
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
value = escapeAttrValue(value);
|
|
690
|
+
return value;
|
|
691
|
+
}
|
|
692
|
+
var REGEXP_LT = /</g;
|
|
693
|
+
var REGEXP_GT = />/g;
|
|
694
|
+
var REGEXP_QUOTE = /"/g;
|
|
695
|
+
var REGEXP_QUOTE_2 = /"/g;
|
|
696
|
+
var REGEXP_ATTR_VALUE_1 = /&#([a-zA-Z0-9]*);?/gim;
|
|
697
|
+
var REGEXP_ATTR_VALUE_COLON = /:?/gim;
|
|
698
|
+
var REGEXP_ATTR_VALUE_NEWLINE = /&newline;?/gim;
|
|
699
|
+
var REGEXP_DEFAULT_ON_TAG_ATTR_4 = /((j\s*a\s*v\s*a|v\s*b|l\s*i\s*v\s*e)\s*s\s*c\s*r\s*i\s*p\s*t\s*|m\s*o\s*c\s*h\s*a):/gi;
|
|
700
|
+
var REGEXP_DEFAULT_ON_TAG_ATTR_7 = /e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n\s*\(.*/gi;
|
|
701
|
+
var REGEXP_DEFAULT_ON_TAG_ATTR_8 = /u\s*r\s*l\s*\(.*/gi;
|
|
702
|
+
function escapeQuote(str) {
|
|
703
|
+
return str.replace(REGEXP_QUOTE, """);
|
|
704
|
+
}
|
|
705
|
+
function unescapeQuote(str) {
|
|
706
|
+
return str.replace(REGEXP_QUOTE_2, "\"");
|
|
707
|
+
}
|
|
708
|
+
function escapeHtmlEntities(str) {
|
|
709
|
+
return str.replace(REGEXP_ATTR_VALUE_1, function replaceUnicode(str$1, code) {
|
|
710
|
+
return code[0] === "x" || code[0] === "X" ? String.fromCharCode(parseInt(code.substr(1), 16)) : String.fromCharCode(parseInt(code, 10));
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
function escapeDangerHtml5Entities(str) {
|
|
714
|
+
return str.replace(REGEXP_ATTR_VALUE_COLON, ":").replace(REGEXP_ATTR_VALUE_NEWLINE, " ");
|
|
715
|
+
}
|
|
716
|
+
function clearNonPrintableCharacter(str) {
|
|
717
|
+
var str2 = "";
|
|
718
|
+
for (var i$1 = 0, len = str.length; i$1 < len; i$1++) str2 += str.charCodeAt(i$1) < 32 ? " " : str.charAt(i$1);
|
|
719
|
+
return _$2.trim(str2);
|
|
720
|
+
}
|
|
721
|
+
function friendlyAttrValue(str) {
|
|
722
|
+
str = unescapeQuote(str);
|
|
723
|
+
str = escapeHtmlEntities(str);
|
|
724
|
+
str = escapeDangerHtml5Entities(str);
|
|
725
|
+
str = clearNonPrintableCharacter(str);
|
|
726
|
+
return str;
|
|
727
|
+
}
|
|
728
|
+
function escapeAttrValue(str) {
|
|
729
|
+
str = escapeQuote(str);
|
|
730
|
+
str = escapeHtml(str);
|
|
731
|
+
return str;
|
|
732
|
+
}
|
|
733
|
+
function onIgnoreTagStripAll() {
|
|
734
|
+
return "";
|
|
735
|
+
}
|
|
736
|
+
function StripTagBody(tags, next) {
|
|
737
|
+
if (typeof next !== "function") next = function() {};
|
|
738
|
+
var isRemoveAllTag = !Array.isArray(tags);
|
|
739
|
+
function isRemoveTag(tag) {
|
|
740
|
+
if (isRemoveAllTag) return true;
|
|
741
|
+
return _$2.indexOf(tags, tag) !== -1;
|
|
742
|
+
}
|
|
743
|
+
var removeList = [];
|
|
744
|
+
var posStart = false;
|
|
745
|
+
return {
|
|
746
|
+
onIgnoreTag: function(tag, html, options) {
|
|
747
|
+
if (isRemoveTag(tag)) if (options.isClosing) {
|
|
748
|
+
var ret = "[/removed]";
|
|
749
|
+
var end = options.position + ret.length;
|
|
750
|
+
removeList.push([posStart !== false ? posStart : options.position, end]);
|
|
751
|
+
posStart = false;
|
|
752
|
+
return ret;
|
|
753
|
+
} else {
|
|
754
|
+
if (!posStart) posStart = options.position;
|
|
755
|
+
return "[removed]";
|
|
756
|
+
}
|
|
757
|
+
else return next(tag, html, options);
|
|
758
|
+
},
|
|
759
|
+
remove: function(html) {
|
|
760
|
+
var rethtml = "";
|
|
761
|
+
var lastPos = 0;
|
|
762
|
+
_$2.forEach(removeList, function(pos) {
|
|
763
|
+
rethtml += html.slice(lastPos, pos[0]);
|
|
764
|
+
lastPos = pos[1];
|
|
765
|
+
});
|
|
766
|
+
rethtml += html.slice(lastPos);
|
|
767
|
+
return rethtml;
|
|
768
|
+
}
|
|
769
|
+
};
|
|
770
|
+
}
|
|
771
|
+
function stripCommentTag(html) {
|
|
772
|
+
var retHtml = "";
|
|
773
|
+
var lastPos = 0;
|
|
774
|
+
while (lastPos < html.length) {
|
|
775
|
+
var i$1 = html.indexOf("<!--", lastPos);
|
|
776
|
+
if (i$1 === -1) {
|
|
777
|
+
retHtml += html.slice(lastPos);
|
|
778
|
+
break;
|
|
779
|
+
}
|
|
780
|
+
retHtml += html.slice(lastPos, i$1);
|
|
781
|
+
var j = html.indexOf("-->", i$1);
|
|
782
|
+
if (j === -1) break;
|
|
783
|
+
lastPos = j + 3;
|
|
784
|
+
}
|
|
785
|
+
return retHtml;
|
|
786
|
+
}
|
|
787
|
+
function stripBlankChar(html) {
|
|
788
|
+
var chars = html.split("");
|
|
789
|
+
chars = chars.filter(function(char) {
|
|
790
|
+
var c = char.charCodeAt(0);
|
|
791
|
+
if (c === 127) return false;
|
|
792
|
+
if (c <= 31) {
|
|
793
|
+
if (c === 10 || c === 13) return true;
|
|
794
|
+
return false;
|
|
795
|
+
}
|
|
796
|
+
return true;
|
|
797
|
+
});
|
|
798
|
+
return chars.join("");
|
|
799
|
+
}
|
|
800
|
+
exports.whiteList = getDefaultWhiteList();
|
|
801
|
+
exports.getDefaultWhiteList = getDefaultWhiteList;
|
|
802
|
+
exports.onTag = onTag;
|
|
803
|
+
exports.onIgnoreTag = onIgnoreTag;
|
|
804
|
+
exports.onTagAttr = onTagAttr;
|
|
805
|
+
exports.onIgnoreTagAttr = onIgnoreTagAttr;
|
|
806
|
+
exports.safeAttrValue = safeAttrValue;
|
|
807
|
+
exports.escapeHtml = escapeHtml;
|
|
808
|
+
exports.escapeQuote = escapeQuote;
|
|
809
|
+
exports.unescapeQuote = unescapeQuote;
|
|
810
|
+
exports.escapeHtmlEntities = escapeHtmlEntities;
|
|
811
|
+
exports.escapeDangerHtml5Entities = escapeDangerHtml5Entities;
|
|
812
|
+
exports.clearNonPrintableCharacter = clearNonPrintableCharacter;
|
|
813
|
+
exports.friendlyAttrValue = friendlyAttrValue;
|
|
814
|
+
exports.escapeAttrValue = escapeAttrValue;
|
|
815
|
+
exports.onIgnoreTagStripAll = onIgnoreTagStripAll;
|
|
816
|
+
exports.StripTagBody = StripTagBody;
|
|
817
|
+
exports.stripCommentTag = stripCommentTag;
|
|
818
|
+
exports.stripBlankChar = stripBlankChar;
|
|
819
|
+
exports.attributeWrapSign = "\"";
|
|
820
|
+
exports.cssFilter = defaultCSSFilter;
|
|
821
|
+
exports.getDefaultCSSWhiteList = getDefaultCSSWhiteList;
|
|
822
|
+
}));
|
|
823
|
+
var require_parser = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
824
|
+
var _$1 = require_util();
|
|
825
|
+
function getTagName(html) {
|
|
826
|
+
var i$1 = _$1.spaceIndex(html);
|
|
827
|
+
var tagName;
|
|
828
|
+
if (i$1 === -1) tagName = html.slice(1, -1);
|
|
829
|
+
else tagName = html.slice(1, i$1 + 1);
|
|
830
|
+
tagName = _$1.trim(tagName).toLowerCase();
|
|
831
|
+
if (tagName.slice(0, 1) === "/") tagName = tagName.slice(1);
|
|
832
|
+
if (tagName.slice(-1) === "/") tagName = tagName.slice(0, -1);
|
|
833
|
+
return tagName;
|
|
834
|
+
}
|
|
835
|
+
function isClosing(html) {
|
|
836
|
+
return html.slice(0, 2) === "</";
|
|
837
|
+
}
|
|
838
|
+
function parseTag$1(html, onTag$1, escapeHtml$1) {
|
|
839
|
+
var rethtml = "";
|
|
840
|
+
var lastPos = 0;
|
|
841
|
+
var tagStart = false;
|
|
842
|
+
var quoteStart = false;
|
|
843
|
+
var currentPos = 0;
|
|
844
|
+
var len = html.length;
|
|
845
|
+
var currentTagName = "";
|
|
846
|
+
var currentHtml = "";
|
|
847
|
+
chariterator: for (currentPos = 0; currentPos < len; currentPos++) {
|
|
848
|
+
var c = html.charAt(currentPos);
|
|
849
|
+
if (tagStart === false) {
|
|
850
|
+
if (c === "<") {
|
|
851
|
+
tagStart = currentPos;
|
|
852
|
+
continue;
|
|
853
|
+
}
|
|
854
|
+
} else if (quoteStart === false) {
|
|
855
|
+
if (c === "<") {
|
|
856
|
+
rethtml += escapeHtml$1(html.slice(lastPos, currentPos));
|
|
857
|
+
tagStart = currentPos;
|
|
858
|
+
lastPos = currentPos;
|
|
859
|
+
continue;
|
|
860
|
+
}
|
|
861
|
+
if (c === ">" || currentPos === len - 1) {
|
|
862
|
+
rethtml += escapeHtml$1(html.slice(lastPos, tagStart));
|
|
863
|
+
currentHtml = html.slice(tagStart, currentPos + 1);
|
|
864
|
+
currentTagName = getTagName(currentHtml);
|
|
865
|
+
rethtml += onTag$1(tagStart, rethtml.length, currentTagName, currentHtml, isClosing(currentHtml));
|
|
866
|
+
lastPos = currentPos + 1;
|
|
867
|
+
tagStart = false;
|
|
868
|
+
continue;
|
|
869
|
+
}
|
|
870
|
+
if (c === "\"" || c === "'") {
|
|
871
|
+
var i$1 = 1;
|
|
872
|
+
var ic = html.charAt(currentPos - i$1);
|
|
873
|
+
while (ic.trim() === "" || ic === "=") {
|
|
874
|
+
if (ic === "=") {
|
|
875
|
+
quoteStart = c;
|
|
876
|
+
continue chariterator;
|
|
877
|
+
}
|
|
878
|
+
ic = html.charAt(currentPos - ++i$1);
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
} else if (c === quoteStart) {
|
|
882
|
+
quoteStart = false;
|
|
883
|
+
continue;
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
if (lastPos < len) rethtml += escapeHtml$1(html.substr(lastPos));
|
|
887
|
+
return rethtml;
|
|
888
|
+
}
|
|
889
|
+
var REGEXP_ILLEGAL_ATTR_NAME = /[^a-zA-Z0-9\\_:.-]/gim;
|
|
890
|
+
function parseAttr$1(html, onAttr$1) {
|
|
891
|
+
var lastPos = 0;
|
|
892
|
+
var lastMarkPos = 0;
|
|
893
|
+
var retAttrs = [];
|
|
894
|
+
var tmpName = false;
|
|
895
|
+
var len = html.length;
|
|
896
|
+
function addAttr(name, value) {
|
|
897
|
+
name = _$1.trim(name);
|
|
898
|
+
name = name.replace(REGEXP_ILLEGAL_ATTR_NAME, "").toLowerCase();
|
|
899
|
+
if (name.length < 1) return;
|
|
900
|
+
var ret = onAttr$1(name, value || "");
|
|
901
|
+
if (ret) retAttrs.push(ret);
|
|
902
|
+
}
|
|
903
|
+
for (var i$1 = 0; i$1 < len; i$1++) {
|
|
904
|
+
var c = html.charAt(i$1);
|
|
905
|
+
var v, j;
|
|
906
|
+
if (tmpName === false && c === "=") {
|
|
907
|
+
tmpName = html.slice(lastPos, i$1);
|
|
908
|
+
lastPos = i$1 + 1;
|
|
909
|
+
lastMarkPos = html.charAt(lastPos) === "\"" || html.charAt(lastPos) === "'" ? lastPos : findNextQuotationMark(html, i$1 + 1);
|
|
910
|
+
continue;
|
|
911
|
+
}
|
|
912
|
+
if (tmpName !== false) {
|
|
913
|
+
if (i$1 === lastMarkPos) {
|
|
914
|
+
j = html.indexOf(c, i$1 + 1);
|
|
915
|
+
if (j === -1) break;
|
|
916
|
+
else {
|
|
917
|
+
v = _$1.trim(html.slice(lastMarkPos + 1, j));
|
|
918
|
+
addAttr(tmpName, v);
|
|
919
|
+
tmpName = false;
|
|
920
|
+
i$1 = j;
|
|
921
|
+
lastPos = i$1 + 1;
|
|
922
|
+
continue;
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
if (/\s|\n|\t/.test(c)) {
|
|
927
|
+
html = html.replace(/\s|\n|\t/g, " ");
|
|
928
|
+
if (tmpName === false) {
|
|
929
|
+
j = findNextEqual(html, i$1);
|
|
930
|
+
if (j === -1) {
|
|
931
|
+
v = _$1.trim(html.slice(lastPos, i$1));
|
|
932
|
+
addAttr(v);
|
|
933
|
+
tmpName = false;
|
|
934
|
+
lastPos = i$1 + 1;
|
|
935
|
+
continue;
|
|
936
|
+
} else {
|
|
937
|
+
i$1 = j - 1;
|
|
938
|
+
continue;
|
|
939
|
+
}
|
|
940
|
+
} else {
|
|
941
|
+
j = findBeforeEqual(html, i$1 - 1);
|
|
942
|
+
if (j === -1) {
|
|
943
|
+
v = _$1.trim(html.slice(lastPos, i$1));
|
|
944
|
+
v = stripQuoteWrap(v);
|
|
945
|
+
addAttr(tmpName, v);
|
|
946
|
+
tmpName = false;
|
|
947
|
+
lastPos = i$1 + 1;
|
|
948
|
+
continue;
|
|
949
|
+
} else continue;
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
if (lastPos < html.length) if (tmpName === false) addAttr(html.slice(lastPos));
|
|
954
|
+
else addAttr(tmpName, stripQuoteWrap(_$1.trim(html.slice(lastPos))));
|
|
955
|
+
return _$1.trim(retAttrs.join(" "));
|
|
956
|
+
}
|
|
957
|
+
function findNextEqual(str, i$1) {
|
|
958
|
+
for (; i$1 < str.length; i$1++) {
|
|
959
|
+
var c = str[i$1];
|
|
960
|
+
if (c === " ") continue;
|
|
961
|
+
if (c === "=") return i$1;
|
|
962
|
+
return -1;
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
function findNextQuotationMark(str, i$1) {
|
|
966
|
+
for (; i$1 < str.length; i$1++) {
|
|
967
|
+
var c = str[i$1];
|
|
968
|
+
if (c === " ") continue;
|
|
969
|
+
if (c === "'" || c === "\"") return i$1;
|
|
970
|
+
return -1;
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
function findBeforeEqual(str, i$1) {
|
|
974
|
+
for (; i$1 > 0; i$1--) {
|
|
975
|
+
var c = str[i$1];
|
|
976
|
+
if (c === " ") continue;
|
|
977
|
+
if (c === "=") return i$1;
|
|
978
|
+
return -1;
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
function isQuoteWrapString(text) {
|
|
982
|
+
if (text[0] === "\"" && text[text.length - 1] === "\"" || text[0] === "'" && text[text.length - 1] === "'") return true;
|
|
983
|
+
else return false;
|
|
984
|
+
}
|
|
985
|
+
function stripQuoteWrap(text) {
|
|
986
|
+
if (isQuoteWrapString(text)) return text.substr(1, text.length - 2);
|
|
987
|
+
else return text;
|
|
988
|
+
}
|
|
989
|
+
exports.parseTag = parseTag$1;
|
|
990
|
+
exports.parseAttr = parseAttr$1;
|
|
991
|
+
}));
|
|
992
|
+
var require_xss = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
993
|
+
var FilterCSS = require_lib$1().FilterCSS;
|
|
994
|
+
var DEFAULT$1 = require_default();
|
|
995
|
+
var parser$1 = require_parser();
|
|
996
|
+
var parseTag = parser$1.parseTag;
|
|
997
|
+
var parseAttr = parser$1.parseAttr;
|
|
998
|
+
var _ = require_util();
|
|
999
|
+
function isNull(obj) {
|
|
1000
|
+
return obj === void 0 || obj === null;
|
|
1001
|
+
}
|
|
1002
|
+
function getAttrs(html) {
|
|
1003
|
+
var i$1 = _.spaceIndex(html);
|
|
1004
|
+
if (i$1 === -1) return {
|
|
1005
|
+
html: "",
|
|
1006
|
+
closing: html[html.length - 2] === "/"
|
|
1007
|
+
};
|
|
1008
|
+
html = _.trim(html.slice(i$1 + 1, -1));
|
|
1009
|
+
var isClosing$1 = html[html.length - 1] === "/";
|
|
1010
|
+
if (isClosing$1) html = _.trim(html.slice(0, -1));
|
|
1011
|
+
return {
|
|
1012
|
+
html,
|
|
1013
|
+
closing: isClosing$1
|
|
1014
|
+
};
|
|
1015
|
+
}
|
|
1016
|
+
function shallowCopyObject(obj) {
|
|
1017
|
+
var ret = {};
|
|
1018
|
+
for (var i$1 in obj) ret[i$1] = obj[i$1];
|
|
1019
|
+
return ret;
|
|
1020
|
+
}
|
|
1021
|
+
function keysToLowerCase(obj) {
|
|
1022
|
+
var ret = {};
|
|
1023
|
+
for (var i$1 in obj) if (Array.isArray(obj[i$1])) ret[i$1.toLowerCase()] = obj[i$1].map(function(item) {
|
|
1024
|
+
return item.toLowerCase();
|
|
1025
|
+
});
|
|
1026
|
+
else ret[i$1.toLowerCase()] = obj[i$1];
|
|
1027
|
+
return ret;
|
|
1028
|
+
}
|
|
1029
|
+
function FilterXSS$1(options) {
|
|
1030
|
+
options = shallowCopyObject(options || {});
|
|
1031
|
+
if (options.stripIgnoreTag) {
|
|
1032
|
+
if (options.onIgnoreTag) console.error("Notes: cannot use these two options \"stripIgnoreTag\" and \"onIgnoreTag\" at the same time");
|
|
1033
|
+
options.onIgnoreTag = DEFAULT$1.onIgnoreTagStripAll;
|
|
1034
|
+
}
|
|
1035
|
+
if (options.whiteList || options.allowList) options.whiteList = keysToLowerCase(options.whiteList || options.allowList);
|
|
1036
|
+
else options.whiteList = DEFAULT$1.whiteList;
|
|
1037
|
+
this.attributeWrapSign = options.singleQuotedAttributeValue === true ? "'" : DEFAULT$1.attributeWrapSign;
|
|
1038
|
+
options.onTag = options.onTag || DEFAULT$1.onTag;
|
|
1039
|
+
options.onTagAttr = options.onTagAttr || DEFAULT$1.onTagAttr;
|
|
1040
|
+
options.onIgnoreTag = options.onIgnoreTag || DEFAULT$1.onIgnoreTag;
|
|
1041
|
+
options.onIgnoreTagAttr = options.onIgnoreTagAttr || DEFAULT$1.onIgnoreTagAttr;
|
|
1042
|
+
options.safeAttrValue = options.safeAttrValue || DEFAULT$1.safeAttrValue;
|
|
1043
|
+
options.escapeHtml = options.escapeHtml || DEFAULT$1.escapeHtml;
|
|
1044
|
+
this.options = options;
|
|
1045
|
+
if (options.css === false) this.cssFilter = false;
|
|
1046
|
+
else {
|
|
1047
|
+
options.css = options.css || {};
|
|
1048
|
+
this.cssFilter = new FilterCSS(options.css);
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
FilterXSS$1.prototype.process = function(html) {
|
|
1052
|
+
html = html || "";
|
|
1053
|
+
html = html.toString();
|
|
1054
|
+
if (!html) return "";
|
|
1055
|
+
var me = this;
|
|
1056
|
+
var options = me.options;
|
|
1057
|
+
var whiteList = options.whiteList;
|
|
1058
|
+
var onTag$1 = options.onTag;
|
|
1059
|
+
var onIgnoreTag$1 = options.onIgnoreTag;
|
|
1060
|
+
var onTagAttr$1 = options.onTagAttr;
|
|
1061
|
+
var onIgnoreTagAttr$1 = options.onIgnoreTagAttr;
|
|
1062
|
+
var safeAttrValue$2 = options.safeAttrValue;
|
|
1063
|
+
var escapeHtml$1 = options.escapeHtml;
|
|
1064
|
+
var attributeWrapSign = me.attributeWrapSign;
|
|
1065
|
+
var cssFilter = me.cssFilter;
|
|
1066
|
+
if (options.stripBlankChar) html = DEFAULT$1.stripBlankChar(html);
|
|
1067
|
+
if (!options.allowCommentTag) html = DEFAULT$1.stripCommentTag(html);
|
|
1068
|
+
var stripIgnoreTagBody = false;
|
|
1069
|
+
if (options.stripIgnoreTagBody) {
|
|
1070
|
+
stripIgnoreTagBody = DEFAULT$1.StripTagBody(options.stripIgnoreTagBody, onIgnoreTag$1);
|
|
1071
|
+
onIgnoreTag$1 = stripIgnoreTagBody.onIgnoreTag;
|
|
1072
|
+
}
|
|
1073
|
+
var retHtml = parseTag(html, function(sourcePosition, position, tag, html$1, isClosing$1) {
|
|
1074
|
+
var info = {
|
|
1075
|
+
sourcePosition,
|
|
1076
|
+
position,
|
|
1077
|
+
isClosing: isClosing$1,
|
|
1078
|
+
isWhite: Object.prototype.hasOwnProperty.call(whiteList, tag)
|
|
1079
|
+
};
|
|
1080
|
+
var ret = onTag$1(tag, html$1, info);
|
|
1081
|
+
if (!isNull(ret)) return ret;
|
|
1082
|
+
if (info.isWhite) {
|
|
1083
|
+
if (info.isClosing) return "</" + tag + ">";
|
|
1084
|
+
var attrs = getAttrs(html$1);
|
|
1085
|
+
var whiteAttrList = whiteList[tag];
|
|
1086
|
+
var attrsHtml = parseAttr(attrs.html, function(name, value) {
|
|
1087
|
+
var isWhiteAttr = _.indexOf(whiteAttrList, name) !== -1;
|
|
1088
|
+
var ret$1 = onTagAttr$1(tag, name, value, isWhiteAttr);
|
|
1089
|
+
if (!isNull(ret$1)) return ret$1;
|
|
1090
|
+
if (isWhiteAttr) {
|
|
1091
|
+
value = safeAttrValue$2(tag, name, value, cssFilter);
|
|
1092
|
+
if (value) return name + "=" + attributeWrapSign + value + attributeWrapSign;
|
|
1093
|
+
else return name;
|
|
1094
|
+
} else {
|
|
1095
|
+
ret$1 = onIgnoreTagAttr$1(tag, name, value, isWhiteAttr);
|
|
1096
|
+
if (!isNull(ret$1)) return ret$1;
|
|
1097
|
+
return;
|
|
1098
|
+
}
|
|
1099
|
+
});
|
|
1100
|
+
html$1 = "<" + tag;
|
|
1101
|
+
if (attrsHtml) html$1 += " " + attrsHtml;
|
|
1102
|
+
if (attrs.closing) html$1 += " /";
|
|
1103
|
+
html$1 += ">";
|
|
1104
|
+
return html$1;
|
|
1105
|
+
} else {
|
|
1106
|
+
ret = onIgnoreTag$1(tag, html$1, info);
|
|
1107
|
+
if (!isNull(ret)) return ret;
|
|
1108
|
+
return escapeHtml$1(html$1);
|
|
1109
|
+
}
|
|
1110
|
+
}, escapeHtml$1);
|
|
1111
|
+
if (stripIgnoreTagBody) retHtml = stripIgnoreTagBody.remove(retHtml);
|
|
1112
|
+
return retHtml;
|
|
1113
|
+
};
|
|
1114
|
+
module.exports = FilterXSS$1;
|
|
1115
|
+
}));
|
|
1116
|
+
var require_lib = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1117
|
+
var DEFAULT = require_default();
|
|
1118
|
+
var parser = require_parser();
|
|
1119
|
+
var FilterXSS = require_xss();
|
|
1120
|
+
function filterXSS(html, options) {
|
|
1121
|
+
return new FilterXSS(options).process(html);
|
|
1122
|
+
}
|
|
1123
|
+
exports = module.exports = filterXSS;
|
|
1124
|
+
exports.filterXSS = filterXSS;
|
|
1125
|
+
exports.FilterXSS = FilterXSS;
|
|
1126
|
+
(function() {
|
|
1127
|
+
for (var i$1 in DEFAULT) exports[i$1] = DEFAULT[i$1];
|
|
1128
|
+
for (var j in parser) exports[j] = parser[j];
|
|
1129
|
+
})();
|
|
1130
|
+
if (typeof window !== "undefined") window.filterXSS = module.exports;
|
|
1131
|
+
function isWorkerEnv() {
|
|
1132
|
+
return typeof self !== "undefined" && typeof DedicatedWorkerGlobalScope !== "undefined" && self instanceof DedicatedWorkerGlobalScope;
|
|
1133
|
+
}
|
|
1134
|
+
if (isWorkerEnv()) self.filterXSS = module.exports;
|
|
1135
|
+
}));
|
|
1136
|
+
var isBrowser = typeof document !== "undefined";
|
|
1137
|
+
function isRouteComponent(component) {
|
|
1138
|
+
return typeof component === "object" || "displayName" in component || "props" in component || "__vccOpts" in component;
|
|
1139
|
+
}
|
|
1140
|
+
function isESModule(obj) {
|
|
1141
|
+
return obj.__esModule || obj[Symbol.toStringTag] === "Module" || obj.default && isRouteComponent(obj.default);
|
|
1142
|
+
}
|
|
1143
|
+
var assign = Object.assign;
|
|
1144
|
+
function applyToParams(fn, params) {
|
|
1145
|
+
const newParams = {};
|
|
1146
|
+
for (const key in params) {
|
|
1147
|
+
const value = params[key];
|
|
1148
|
+
newParams[key] = isArray$3(value) ? value.map(fn) : fn(value);
|
|
1149
|
+
}
|
|
1150
|
+
return newParams;
|
|
1151
|
+
}
|
|
1152
|
+
var noop = () => {};
|
|
1153
|
+
var isArray$3 = Array.isArray;
|
|
1154
|
+
var HASH_RE = /#/g;
|
|
1155
|
+
var AMPERSAND_RE = /&/g;
|
|
1156
|
+
var SLASH_RE = /\//g;
|
|
1157
|
+
var EQUAL_RE = /=/g;
|
|
1158
|
+
var IM_RE = /\?/g;
|
|
1159
|
+
var PLUS_RE = /\+/g;
|
|
1160
|
+
var ENC_BRACKET_OPEN_RE = /%5B/g;
|
|
1161
|
+
var ENC_BRACKET_CLOSE_RE = /%5D/g;
|
|
1162
|
+
var ENC_CARET_RE = /%5E/g;
|
|
1163
|
+
var ENC_BACKTICK_RE = /%60/g;
|
|
1164
|
+
var ENC_CURLY_OPEN_RE = /%7B/g;
|
|
1165
|
+
var ENC_PIPE_RE = /%7C/g;
|
|
1166
|
+
var ENC_CURLY_CLOSE_RE = /%7D/g;
|
|
1167
|
+
var ENC_SPACE_RE = /%20/g;
|
|
1168
|
+
function commonEncode(text) {
|
|
1169
|
+
return encodeURI("" + text).replace(ENC_PIPE_RE, "|").replace(ENC_BRACKET_OPEN_RE, "[").replace(ENC_BRACKET_CLOSE_RE, "]");
|
|
1170
|
+
}
|
|
1171
|
+
function encodeHash(text) {
|
|
1172
|
+
return commonEncode(text).replace(ENC_CURLY_OPEN_RE, "{").replace(ENC_CURLY_CLOSE_RE, "}").replace(ENC_CARET_RE, "^");
|
|
1173
|
+
}
|
|
1174
|
+
function encodeQueryValue(text) {
|
|
1175
|
+
return commonEncode(text).replace(PLUS_RE, "%2B").replace(ENC_SPACE_RE, "+").replace(HASH_RE, "%23").replace(AMPERSAND_RE, "%26").replace(ENC_BACKTICK_RE, "`").replace(ENC_CURLY_OPEN_RE, "{").replace(ENC_CURLY_CLOSE_RE, "}").replace(ENC_CARET_RE, "^");
|
|
1176
|
+
}
|
|
1177
|
+
function encodeQueryKey(text) {
|
|
1178
|
+
return encodeQueryValue(text).replace(EQUAL_RE, "%3D");
|
|
1179
|
+
}
|
|
1180
|
+
function encodePath(text) {
|
|
1181
|
+
return commonEncode(text).replace(HASH_RE, "%23").replace(IM_RE, "%3F");
|
|
1182
|
+
}
|
|
1183
|
+
function encodeParam(text) {
|
|
1184
|
+
return text == null ? "" : encodePath(text).replace(SLASH_RE, "%2F");
|
|
1185
|
+
}
|
|
1186
|
+
function decode(text) {
|
|
1187
|
+
try {
|
|
1188
|
+
return decodeURIComponent("" + text);
|
|
1189
|
+
} catch (err) {}
|
|
1190
|
+
return "" + text;
|
|
1191
|
+
}
|
|
1192
|
+
var TRAILING_SLASH_RE = /\/$/;
|
|
1193
|
+
var removeTrailingSlash = (path) => path.replace(TRAILING_SLASH_RE, "");
|
|
1194
|
+
function parseURL(parseQuery$1, location$1, currentLocation = "/") {
|
|
1195
|
+
let path, query = {}, searchString = "", hash = "";
|
|
1196
|
+
const hashPos = location$1.indexOf("#");
|
|
1197
|
+
let searchPos = location$1.indexOf("?");
|
|
1198
|
+
if (hashPos < searchPos && hashPos >= 0) searchPos = -1;
|
|
1199
|
+
if (searchPos > -1) {
|
|
1200
|
+
path = location$1.slice(0, searchPos);
|
|
1201
|
+
searchString = location$1.slice(searchPos + 1, hashPos > -1 ? hashPos : location$1.length);
|
|
1202
|
+
query = parseQuery$1(searchString);
|
|
1203
|
+
}
|
|
1204
|
+
if (hashPos > -1) {
|
|
1205
|
+
path = path || location$1.slice(0, hashPos);
|
|
1206
|
+
hash = location$1.slice(hashPos, location$1.length);
|
|
1207
|
+
}
|
|
1208
|
+
path = resolveRelativePath(path != null ? path : location$1, currentLocation);
|
|
1209
|
+
return {
|
|
1210
|
+
fullPath: path + (searchString && "?") + searchString + hash,
|
|
1211
|
+
path,
|
|
1212
|
+
query,
|
|
1213
|
+
hash: decode(hash)
|
|
1214
|
+
};
|
|
1215
|
+
}
|
|
1216
|
+
function stringifyURL(stringifyQuery$1, location$1) {
|
|
1217
|
+
const query = location$1.query ? stringifyQuery$1(location$1.query) : "";
|
|
1218
|
+
return location$1.path + (query && "?") + query + (location$1.hash || "");
|
|
1219
|
+
}
|
|
1220
|
+
function stripBase(pathname, base) {
|
|
1221
|
+
if (!base || !pathname.toLowerCase().startsWith(base.toLowerCase())) return pathname;
|
|
1222
|
+
return pathname.slice(base.length) || "/";
|
|
1223
|
+
}
|
|
1224
|
+
function isSameRouteLocation(stringifyQuery$1, a, b) {
|
|
1225
|
+
const aLastIndex = a.matched.length - 1;
|
|
1226
|
+
const bLastIndex = b.matched.length - 1;
|
|
1227
|
+
return aLastIndex > -1 && aLastIndex === bLastIndex && isSameRouteRecord(a.matched[aLastIndex], b.matched[bLastIndex]) && isSameRouteLocationParams(a.params, b.params) && stringifyQuery$1(a.query) === stringifyQuery$1(b.query) && a.hash === b.hash;
|
|
1228
|
+
}
|
|
1229
|
+
function isSameRouteRecord(a, b) {
|
|
1230
|
+
return (a.aliasOf || a) === (b.aliasOf || b);
|
|
1231
|
+
}
|
|
1232
|
+
function isSameRouteLocationParams(a, b) {
|
|
1233
|
+
if (Object.keys(a).length !== Object.keys(b).length) return false;
|
|
1234
|
+
for (const key in a) if (!isSameRouteLocationParamsValue(a[key], b[key])) return false;
|
|
1235
|
+
return true;
|
|
1236
|
+
}
|
|
1237
|
+
function isSameRouteLocationParamsValue(a, b) {
|
|
1238
|
+
return isArray$3(a) ? isEquivalentArray(a, b) : isArray$3(b) ? isEquivalentArray(b, a) : a === b;
|
|
1239
|
+
}
|
|
1240
|
+
function isEquivalentArray(a, b) {
|
|
1241
|
+
return isArray$3(b) ? a.length === b.length && a.every((value, i$1) => value === b[i$1]) : a.length === 1 && a[0] === b;
|
|
1242
|
+
}
|
|
1243
|
+
function resolveRelativePath(to, from) {
|
|
1244
|
+
if (to.startsWith("/")) return to;
|
|
1245
|
+
if (!to) return from;
|
|
1246
|
+
const fromSegments = from.split("/");
|
|
1247
|
+
const toSegments = to.split("/");
|
|
1248
|
+
const lastToSegment = toSegments[toSegments.length - 1];
|
|
1249
|
+
if (lastToSegment === ".." || lastToSegment === ".") toSegments.push("");
|
|
1250
|
+
let position = fromSegments.length - 1;
|
|
1251
|
+
let toPosition;
|
|
1252
|
+
let segment;
|
|
1253
|
+
for (toPosition = 0; toPosition < toSegments.length; toPosition++) {
|
|
1254
|
+
segment = toSegments[toPosition];
|
|
1255
|
+
if (segment === ".") continue;
|
|
1256
|
+
if (segment === "..") {
|
|
1257
|
+
if (position > 1) position--;
|
|
1258
|
+
} else break;
|
|
1259
|
+
}
|
|
1260
|
+
return fromSegments.slice(0, position).join("/") + "/" + toSegments.slice(toPosition).join("/");
|
|
1261
|
+
}
|
|
1262
|
+
var START_LOCATION_NORMALIZED = {
|
|
1263
|
+
path: "/",
|
|
1264
|
+
name: void 0,
|
|
1265
|
+
params: {},
|
|
1266
|
+
query: {},
|
|
1267
|
+
hash: "",
|
|
1268
|
+
fullPath: "/",
|
|
1269
|
+
matched: [],
|
|
1270
|
+
meta: {},
|
|
1271
|
+
redirectedFrom: void 0
|
|
1272
|
+
};
|
|
1273
|
+
var NavigationType;
|
|
1274
|
+
(function(NavigationType$1) {
|
|
1275
|
+
NavigationType$1["pop"] = "pop";
|
|
1276
|
+
NavigationType$1["push"] = "push";
|
|
1277
|
+
})(NavigationType || (NavigationType = {}));
|
|
1278
|
+
var NavigationDirection;
|
|
1279
|
+
(function(NavigationDirection$1) {
|
|
1280
|
+
NavigationDirection$1["back"] = "back";
|
|
1281
|
+
NavigationDirection$1["forward"] = "forward";
|
|
1282
|
+
NavigationDirection$1["unknown"] = "";
|
|
1283
|
+
})(NavigationDirection || (NavigationDirection = {}));
|
|
1284
|
+
var START = "";
|
|
1285
|
+
function normalizeBase(base) {
|
|
1286
|
+
if (!base) if (isBrowser) {
|
|
1287
|
+
const baseEl = document.querySelector("base");
|
|
1288
|
+
base = baseEl && baseEl.getAttribute("href") || "/";
|
|
1289
|
+
base = base.replace(/^\w+:\/\/[^\/]+/, "");
|
|
1290
|
+
} else base = "/";
|
|
1291
|
+
if (base[0] !== "/" && base[0] !== "#") base = "/" + base;
|
|
1292
|
+
return removeTrailingSlash(base);
|
|
1293
|
+
}
|
|
1294
|
+
var BEFORE_HASH_RE = /^[^#]+#/;
|
|
1295
|
+
function createHref(base, location$1) {
|
|
1296
|
+
return base.replace(BEFORE_HASH_RE, "#") + location$1;
|
|
1297
|
+
}
|
|
1298
|
+
function getElementPosition(el, offset) {
|
|
1299
|
+
const docRect = document.documentElement.getBoundingClientRect();
|
|
1300
|
+
const elRect = el.getBoundingClientRect();
|
|
1301
|
+
return {
|
|
1302
|
+
behavior: offset.behavior,
|
|
1303
|
+
left: elRect.left - docRect.left - (offset.left || 0),
|
|
1304
|
+
top: elRect.top - docRect.top - (offset.top || 0)
|
|
1305
|
+
};
|
|
1306
|
+
}
|
|
1307
|
+
var computeScrollPosition = () => ({
|
|
1308
|
+
left: window.scrollX,
|
|
1309
|
+
top: window.scrollY
|
|
1310
|
+
});
|
|
1311
|
+
function scrollToPosition(position) {
|
|
1312
|
+
let scrollToOptions;
|
|
1313
|
+
if ("el" in position) {
|
|
1314
|
+
const positionEl = position.el;
|
|
1315
|
+
const isIdSelector = typeof positionEl === "string" && positionEl.startsWith("#");
|
|
1316
|
+
const el = typeof positionEl === "string" ? isIdSelector ? document.getElementById(positionEl.slice(1)) : document.querySelector(positionEl) : positionEl;
|
|
1317
|
+
if (!el) return;
|
|
1318
|
+
scrollToOptions = getElementPosition(el, position);
|
|
1319
|
+
} else scrollToOptions = position;
|
|
1320
|
+
if ("scrollBehavior" in document.documentElement.style) window.scrollTo(scrollToOptions);
|
|
1321
|
+
else window.scrollTo(scrollToOptions.left != null ? scrollToOptions.left : window.scrollX, scrollToOptions.top != null ? scrollToOptions.top : window.scrollY);
|
|
1322
|
+
}
|
|
1323
|
+
function getScrollKey(path, delta) {
|
|
1324
|
+
return (history.state ? history.state.position - delta : -1) + path;
|
|
1325
|
+
}
|
|
1326
|
+
var scrollPositions = /* @__PURE__ */ new Map();
|
|
1327
|
+
function saveScrollPosition(key, scrollPosition) {
|
|
1328
|
+
scrollPositions.set(key, scrollPosition);
|
|
1329
|
+
}
|
|
1330
|
+
function getSavedScrollPosition(key) {
|
|
1331
|
+
const scroll = scrollPositions.get(key);
|
|
1332
|
+
scrollPositions.delete(key);
|
|
1333
|
+
return scroll;
|
|
1334
|
+
}
|
|
1335
|
+
var createBaseLocation = () => location.protocol + "//" + location.host;
|
|
1336
|
+
function createCurrentLocation(base, location$1) {
|
|
1337
|
+
const { pathname, search, hash } = location$1;
|
|
1338
|
+
const hashPos = base.indexOf("#");
|
|
1339
|
+
if (hashPos > -1) {
|
|
1340
|
+
let slicePos = hash.includes(base.slice(hashPos)) ? base.slice(hashPos).length : 1;
|
|
1341
|
+
let pathFromHash = hash.slice(slicePos);
|
|
1342
|
+
if (pathFromHash[0] !== "/") pathFromHash = "/" + pathFromHash;
|
|
1343
|
+
return stripBase(pathFromHash, "");
|
|
1344
|
+
}
|
|
1345
|
+
return stripBase(pathname, base) + search + hash;
|
|
1346
|
+
}
|
|
1347
|
+
function useHistoryListeners(base, historyState, currentLocation, replace) {
|
|
1348
|
+
let listeners = [];
|
|
1349
|
+
let teardowns = [];
|
|
1350
|
+
let pauseState = null;
|
|
1351
|
+
const popStateHandler = ({ state }) => {
|
|
1352
|
+
const to = createCurrentLocation(base, location);
|
|
1353
|
+
const from = currentLocation.value;
|
|
1354
|
+
const fromState = historyState.value;
|
|
1355
|
+
let delta = 0;
|
|
1356
|
+
if (state) {
|
|
1357
|
+
currentLocation.value = to;
|
|
1358
|
+
historyState.value = state;
|
|
1359
|
+
if (pauseState && pauseState === from) {
|
|
1360
|
+
pauseState = null;
|
|
1361
|
+
return;
|
|
1362
|
+
}
|
|
1363
|
+
delta = fromState ? state.position - fromState.position : 0;
|
|
1364
|
+
} else replace(to);
|
|
1365
|
+
listeners.forEach((listener) => {
|
|
1366
|
+
listener(currentLocation.value, from, {
|
|
1367
|
+
delta,
|
|
1368
|
+
type: NavigationType.pop,
|
|
1369
|
+
direction: delta ? delta > 0 ? NavigationDirection.forward : NavigationDirection.back : NavigationDirection.unknown
|
|
1370
|
+
});
|
|
1371
|
+
});
|
|
1372
|
+
};
|
|
1373
|
+
function pauseListeners() {
|
|
1374
|
+
pauseState = currentLocation.value;
|
|
1375
|
+
}
|
|
1376
|
+
function listen(callback) {
|
|
1377
|
+
listeners.push(callback);
|
|
1378
|
+
const teardown = () => {
|
|
1379
|
+
const index = listeners.indexOf(callback);
|
|
1380
|
+
if (index > -1) listeners.splice(index, 1);
|
|
1381
|
+
};
|
|
1382
|
+
teardowns.push(teardown);
|
|
1383
|
+
return teardown;
|
|
1384
|
+
}
|
|
1385
|
+
function beforeUnloadListener() {
|
|
1386
|
+
const { history: history$1 } = window;
|
|
1387
|
+
if (!history$1.state) return;
|
|
1388
|
+
history$1.replaceState(assign({}, history$1.state, { scroll: computeScrollPosition() }), "");
|
|
1389
|
+
}
|
|
1390
|
+
function destroy() {
|
|
1391
|
+
for (const teardown of teardowns) teardown();
|
|
1392
|
+
teardowns = [];
|
|
1393
|
+
window.removeEventListener("popstate", popStateHandler);
|
|
1394
|
+
window.removeEventListener("beforeunload", beforeUnloadListener);
|
|
1395
|
+
}
|
|
1396
|
+
window.addEventListener("popstate", popStateHandler);
|
|
1397
|
+
window.addEventListener("beforeunload", beforeUnloadListener, { passive: true });
|
|
1398
|
+
return {
|
|
1399
|
+
pauseListeners,
|
|
1400
|
+
listen,
|
|
1401
|
+
destroy
|
|
1402
|
+
};
|
|
1403
|
+
}
|
|
1404
|
+
function buildState(back, current, forward, replaced = false, computeScroll = false) {
|
|
1405
|
+
return {
|
|
1406
|
+
back,
|
|
1407
|
+
current,
|
|
1408
|
+
forward,
|
|
1409
|
+
replaced,
|
|
1410
|
+
position: window.history.length,
|
|
1411
|
+
scroll: computeScroll ? computeScrollPosition() : null
|
|
1412
|
+
};
|
|
1413
|
+
}
|
|
1414
|
+
function useHistoryStateNavigation(base) {
|
|
1415
|
+
const { history: history$1, location: location$1 } = window;
|
|
1416
|
+
const currentLocation = { value: createCurrentLocation(base, location$1) };
|
|
1417
|
+
const historyState = { value: history$1.state };
|
|
1418
|
+
if (!historyState.value) changeLocation(currentLocation.value, {
|
|
1419
|
+
back: null,
|
|
1420
|
+
current: currentLocation.value,
|
|
1421
|
+
forward: null,
|
|
1422
|
+
position: history$1.length - 1,
|
|
1423
|
+
replaced: true,
|
|
1424
|
+
scroll: null
|
|
1425
|
+
}, true);
|
|
1426
|
+
function changeLocation(to, state, replace$1) {
|
|
1427
|
+
const hashIndex = base.indexOf("#");
|
|
1428
|
+
const url = hashIndex > -1 ? (location$1.host && document.querySelector("base") ? base : base.slice(hashIndex)) + to : createBaseLocation() + base + to;
|
|
1429
|
+
try {
|
|
1430
|
+
history$1[replace$1 ? "replaceState" : "pushState"](state, "", url);
|
|
1431
|
+
historyState.value = state;
|
|
1432
|
+
} catch (err) {
|
|
1433
|
+
console.error(err);
|
|
1434
|
+
location$1[replace$1 ? "replace" : "assign"](url);
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
function replace(to, data) {
|
|
1438
|
+
changeLocation(to, assign({}, history$1.state, buildState(historyState.value.back, to, historyState.value.forward, true), data, { position: historyState.value.position }), true);
|
|
1439
|
+
currentLocation.value = to;
|
|
1440
|
+
}
|
|
1441
|
+
function push(to, data) {
|
|
1442
|
+
const currentState = assign({}, historyState.value, history$1.state, {
|
|
1443
|
+
forward: to,
|
|
1444
|
+
scroll: computeScrollPosition()
|
|
1445
|
+
});
|
|
1446
|
+
changeLocation(currentState.current, currentState, true);
|
|
1447
|
+
changeLocation(to, assign({}, buildState(currentLocation.value, to, null), { position: currentState.position + 1 }, data), false);
|
|
1448
|
+
currentLocation.value = to;
|
|
1449
|
+
}
|
|
1450
|
+
return {
|
|
1451
|
+
location: currentLocation,
|
|
1452
|
+
state: historyState,
|
|
1453
|
+
push,
|
|
1454
|
+
replace
|
|
1455
|
+
};
|
|
1456
|
+
}
|
|
1457
|
+
function createWebHistory(base) {
|
|
1458
|
+
base = normalizeBase(base);
|
|
1459
|
+
const historyNavigation = useHistoryStateNavigation(base);
|
|
1460
|
+
const historyListeners = useHistoryListeners(base, historyNavigation.state, historyNavigation.location, historyNavigation.replace);
|
|
1461
|
+
function go(delta, triggerListeners = true) {
|
|
1462
|
+
if (!triggerListeners) historyListeners.pauseListeners();
|
|
1463
|
+
history.go(delta);
|
|
1464
|
+
}
|
|
1465
|
+
const routerHistory = assign({
|
|
1466
|
+
location: "",
|
|
1467
|
+
base,
|
|
1468
|
+
go,
|
|
1469
|
+
createHref: createHref.bind(null, base)
|
|
1470
|
+
}, historyNavigation, historyListeners);
|
|
1471
|
+
Object.defineProperty(routerHistory, "location", {
|
|
1472
|
+
enumerable: true,
|
|
1473
|
+
get: () => historyNavigation.location.value
|
|
1474
|
+
});
|
|
1475
|
+
Object.defineProperty(routerHistory, "state", {
|
|
1476
|
+
enumerable: true,
|
|
1477
|
+
get: () => historyNavigation.state.value
|
|
1478
|
+
});
|
|
1479
|
+
return routerHistory;
|
|
1480
|
+
}
|
|
1481
|
+
function createMemoryHistory(base = "") {
|
|
1482
|
+
let listeners = [];
|
|
1483
|
+
let queue = [START];
|
|
1484
|
+
let position = 0;
|
|
1485
|
+
base = normalizeBase(base);
|
|
1486
|
+
function setLocation(location$1) {
|
|
1487
|
+
position++;
|
|
1488
|
+
if (position !== queue.length) queue.splice(position);
|
|
1489
|
+
queue.push(location$1);
|
|
1490
|
+
}
|
|
1491
|
+
function triggerListeners(to, from, { direction, delta }) {
|
|
1492
|
+
const info = {
|
|
1493
|
+
direction,
|
|
1494
|
+
delta,
|
|
1495
|
+
type: NavigationType.pop
|
|
1496
|
+
};
|
|
1497
|
+
for (const callback of listeners) callback(to, from, info);
|
|
1498
|
+
}
|
|
1499
|
+
const routerHistory = {
|
|
1500
|
+
location: START,
|
|
1501
|
+
state: {},
|
|
1502
|
+
base,
|
|
1503
|
+
createHref: createHref.bind(null, base),
|
|
1504
|
+
replace(to) {
|
|
1505
|
+
queue.splice(position--, 1);
|
|
1506
|
+
setLocation(to);
|
|
1507
|
+
},
|
|
1508
|
+
push(to, data) {
|
|
1509
|
+
setLocation(to);
|
|
1510
|
+
},
|
|
1511
|
+
listen(callback) {
|
|
1512
|
+
listeners.push(callback);
|
|
1513
|
+
return () => {
|
|
1514
|
+
const index = listeners.indexOf(callback);
|
|
1515
|
+
if (index > -1) listeners.splice(index, 1);
|
|
1516
|
+
};
|
|
1517
|
+
},
|
|
1518
|
+
destroy() {
|
|
1519
|
+
listeners = [];
|
|
1520
|
+
queue = [START];
|
|
1521
|
+
position = 0;
|
|
1522
|
+
},
|
|
1523
|
+
go(delta, shouldTrigger = true) {
|
|
1524
|
+
const from = this.location;
|
|
1525
|
+
const direction = delta < 0 ? NavigationDirection.back : NavigationDirection.forward;
|
|
1526
|
+
position = Math.max(0, Math.min(position + delta, queue.length - 1));
|
|
1527
|
+
if (shouldTrigger) triggerListeners(this.location, from, {
|
|
1528
|
+
direction,
|
|
1529
|
+
delta
|
|
1530
|
+
});
|
|
1531
|
+
}
|
|
1532
|
+
};
|
|
1533
|
+
Object.defineProperty(routerHistory, "location", {
|
|
1534
|
+
enumerable: true,
|
|
1535
|
+
get: () => queue[position]
|
|
1536
|
+
});
|
|
1537
|
+
return routerHistory;
|
|
1538
|
+
}
|
|
1539
|
+
function isRouteLocation(route) {
|
|
1540
|
+
return typeof route === "string" || route && typeof route === "object";
|
|
1541
|
+
}
|
|
1542
|
+
function isRouteName(name) {
|
|
1543
|
+
return typeof name === "string" || typeof name === "symbol";
|
|
1544
|
+
}
|
|
1545
|
+
var NavigationFailureSymbol = Symbol("");
|
|
1546
|
+
var NavigationFailureType;
|
|
1547
|
+
(function(NavigationFailureType$1) {
|
|
1548
|
+
NavigationFailureType$1[NavigationFailureType$1["aborted"] = 4] = "aborted";
|
|
1549
|
+
NavigationFailureType$1[NavigationFailureType$1["cancelled"] = 8] = "cancelled";
|
|
1550
|
+
NavigationFailureType$1[NavigationFailureType$1["duplicated"] = 16] = "duplicated";
|
|
1551
|
+
})(NavigationFailureType || (NavigationFailureType = {}));
|
|
1552
|
+
function createRouterError(type, params) {
|
|
1553
|
+
return assign(/* @__PURE__ */ new Error(), {
|
|
1554
|
+
type,
|
|
1555
|
+
[NavigationFailureSymbol]: true
|
|
1556
|
+
}, params);
|
|
1557
|
+
}
|
|
1558
|
+
function isNavigationFailure(error, type) {
|
|
1559
|
+
return error instanceof Error && NavigationFailureSymbol in error && (type == null || !!(error.type & type));
|
|
1560
|
+
}
|
|
1561
|
+
var BASE_PARAM_PATTERN = "[^/]+?";
|
|
1562
|
+
var BASE_PATH_PARSER_OPTIONS = {
|
|
1563
|
+
sensitive: false,
|
|
1564
|
+
strict: false,
|
|
1565
|
+
start: true,
|
|
1566
|
+
end: true
|
|
1567
|
+
};
|
|
1568
|
+
var REGEX_CHARS_RE = /[.+*?^${}()[\]/\\]/g;
|
|
1569
|
+
function tokensToParser(segments, extraOptions) {
|
|
1570
|
+
const options = assign({}, BASE_PATH_PARSER_OPTIONS, extraOptions);
|
|
1571
|
+
const score = [];
|
|
1572
|
+
let pattern = options.start ? "^" : "";
|
|
1573
|
+
const keys = [];
|
|
1574
|
+
for (const segment of segments) {
|
|
1575
|
+
const segmentScores = segment.length ? [] : [90];
|
|
1576
|
+
if (options.strict && !segment.length) pattern += "/";
|
|
1577
|
+
for (let tokenIndex = 0; tokenIndex < segment.length; tokenIndex++) {
|
|
1578
|
+
const token = segment[tokenIndex];
|
|
1579
|
+
let subSegmentScore = 40 + (options.sensitive ? .25 : 0);
|
|
1580
|
+
if (token.type === 0) {
|
|
1581
|
+
if (!tokenIndex) pattern += "/";
|
|
1582
|
+
pattern += token.value.replace(REGEX_CHARS_RE, "\\$&");
|
|
1583
|
+
subSegmentScore += 40;
|
|
1584
|
+
} else if (token.type === 1) {
|
|
1585
|
+
const { value, repeatable, optional, regexp } = token;
|
|
1586
|
+
keys.push({
|
|
1587
|
+
name: value,
|
|
1588
|
+
repeatable,
|
|
1589
|
+
optional
|
|
1590
|
+
});
|
|
1591
|
+
const re$1 = regexp ? regexp : BASE_PARAM_PATTERN;
|
|
1592
|
+
if (re$1 !== BASE_PARAM_PATTERN) {
|
|
1593
|
+
subSegmentScore += 10;
|
|
1594
|
+
try {
|
|
1595
|
+
`${re$1}`;
|
|
1596
|
+
} catch (err) {
|
|
1597
|
+
throw new Error(`Invalid custom RegExp for param "${value}" (${re$1}): ` + err.message);
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
let subPattern = repeatable ? `((?:${re$1})(?:/(?:${re$1}))*)` : `(${re$1})`;
|
|
1601
|
+
if (!tokenIndex) subPattern = optional && segment.length < 2 ? `(?:/${subPattern})` : "/" + subPattern;
|
|
1602
|
+
if (optional) subPattern += "?";
|
|
1603
|
+
pattern += subPattern;
|
|
1604
|
+
subSegmentScore += 20;
|
|
1605
|
+
if (optional) subSegmentScore += -8;
|
|
1606
|
+
if (repeatable) subSegmentScore += -20;
|
|
1607
|
+
if (re$1 === ".*") subSegmentScore += -50;
|
|
1608
|
+
}
|
|
1609
|
+
segmentScores.push(subSegmentScore);
|
|
1610
|
+
}
|
|
1611
|
+
score.push(segmentScores);
|
|
1612
|
+
}
|
|
1613
|
+
if (options.strict && options.end) {
|
|
1614
|
+
const i$1 = score.length - 1;
|
|
1615
|
+
score[i$1][score[i$1].length - 1] += .7000000000000001;
|
|
1616
|
+
}
|
|
1617
|
+
if (!options.strict) pattern += "/?";
|
|
1618
|
+
if (options.end) pattern += "$";
|
|
1619
|
+
else if (options.strict && !pattern.endsWith("/")) pattern += "(?:/|$)";
|
|
1620
|
+
const re = new RegExp(pattern, options.sensitive ? "" : "i");
|
|
1621
|
+
function parse(path) {
|
|
1622
|
+
const match = path.match(re);
|
|
1623
|
+
const params = {};
|
|
1624
|
+
if (!match) return null;
|
|
1625
|
+
for (let i$1 = 1; i$1 < match.length; i$1++) {
|
|
1626
|
+
const value = match[i$1] || "";
|
|
1627
|
+
const key = keys[i$1 - 1];
|
|
1628
|
+
params[key.name] = value && key.repeatable ? value.split("/") : value;
|
|
1629
|
+
}
|
|
1630
|
+
return params;
|
|
1631
|
+
}
|
|
1632
|
+
function stringify(params) {
|
|
1633
|
+
let path = "";
|
|
1634
|
+
let avoidDuplicatedSlash = false;
|
|
1635
|
+
for (const segment of segments) {
|
|
1636
|
+
if (!avoidDuplicatedSlash || !path.endsWith("/")) path += "/";
|
|
1637
|
+
avoidDuplicatedSlash = false;
|
|
1638
|
+
for (const token of segment) if (token.type === 0) path += token.value;
|
|
1639
|
+
else if (token.type === 1) {
|
|
1640
|
+
const { value, repeatable, optional } = token;
|
|
1641
|
+
const param = value in params ? params[value] : "";
|
|
1642
|
+
if (isArray$3(param) && !repeatable) throw new Error(`Provided param "${value}" is an array but it is not repeatable (* or + modifiers)`);
|
|
1643
|
+
const text = isArray$3(param) ? param.join("/") : param;
|
|
1644
|
+
if (!text) if (optional) {
|
|
1645
|
+
if (segment.length < 2) if (path.endsWith("/")) path = path.slice(0, -1);
|
|
1646
|
+
else avoidDuplicatedSlash = true;
|
|
1647
|
+
} else throw new Error(`Missing required param "${value}"`);
|
|
1648
|
+
path += text;
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
return path || "/";
|
|
1652
|
+
}
|
|
1653
|
+
return {
|
|
1654
|
+
re,
|
|
1655
|
+
score,
|
|
1656
|
+
keys,
|
|
1657
|
+
parse,
|
|
1658
|
+
stringify
|
|
1659
|
+
};
|
|
1660
|
+
}
|
|
1661
|
+
function compareScoreArray(a, b) {
|
|
1662
|
+
let i$1 = 0;
|
|
1663
|
+
while (i$1 < a.length && i$1 < b.length) {
|
|
1664
|
+
const diff = b[i$1] - a[i$1];
|
|
1665
|
+
if (diff) return diff;
|
|
1666
|
+
i$1++;
|
|
1667
|
+
}
|
|
1668
|
+
if (a.length < b.length) return a.length === 1 && a[0] === 80 ? -1 : 1;
|
|
1669
|
+
else if (a.length > b.length) return b.length === 1 && b[0] === 80 ? 1 : -1;
|
|
1670
|
+
return 0;
|
|
1671
|
+
}
|
|
1672
|
+
function comparePathParserScore(a, b) {
|
|
1673
|
+
let i$1 = 0;
|
|
1674
|
+
const aScore = a.score;
|
|
1675
|
+
const bScore = b.score;
|
|
1676
|
+
while (i$1 < aScore.length && i$1 < bScore.length) {
|
|
1677
|
+
const comp = compareScoreArray(aScore[i$1], bScore[i$1]);
|
|
1678
|
+
if (comp) return comp;
|
|
1679
|
+
i$1++;
|
|
1680
|
+
}
|
|
1681
|
+
if (Math.abs(bScore.length - aScore.length) === 1) {
|
|
1682
|
+
if (isLastScoreNegative(aScore)) return 1;
|
|
1683
|
+
if (isLastScoreNegative(bScore)) return -1;
|
|
1684
|
+
}
|
|
1685
|
+
return bScore.length - aScore.length;
|
|
1686
|
+
}
|
|
1687
|
+
function isLastScoreNegative(score) {
|
|
1688
|
+
const last = score[score.length - 1];
|
|
1689
|
+
return score.length > 0 && last[last.length - 1] < 0;
|
|
1690
|
+
}
|
|
1691
|
+
var ROOT_TOKEN = {
|
|
1692
|
+
type: 0,
|
|
1693
|
+
value: ""
|
|
1694
|
+
};
|
|
1695
|
+
var VALID_PARAM_RE = /[a-zA-Z0-9_]/;
|
|
1696
|
+
function tokenizePath(path) {
|
|
1697
|
+
if (!path) return [[]];
|
|
1698
|
+
if (path === "/") return [[ROOT_TOKEN]];
|
|
1699
|
+
if (!path.startsWith("/")) throw new Error(`Invalid path "${path}"`);
|
|
1700
|
+
function crash(message) {
|
|
1701
|
+
throw new Error(`ERR (${state})/"${buffer}": ${message}`);
|
|
1702
|
+
}
|
|
1703
|
+
let state = 0;
|
|
1704
|
+
let previousState = state;
|
|
1705
|
+
const tokens = [];
|
|
1706
|
+
let segment;
|
|
1707
|
+
function finalizeSegment() {
|
|
1708
|
+
if (segment) tokens.push(segment);
|
|
1709
|
+
segment = [];
|
|
1710
|
+
}
|
|
1711
|
+
let i$1 = 0;
|
|
1712
|
+
let char;
|
|
1713
|
+
let buffer = "";
|
|
1714
|
+
let customRe = "";
|
|
1715
|
+
function consumeBuffer() {
|
|
1716
|
+
if (!buffer) return;
|
|
1717
|
+
if (state === 0) segment.push({
|
|
1718
|
+
type: 0,
|
|
1719
|
+
value: buffer
|
|
1720
|
+
});
|
|
1721
|
+
else if (state === 1 || state === 2 || state === 3) {
|
|
1722
|
+
if (segment.length > 1 && (char === "*" || char === "+")) crash(`A repeatable param (${buffer}) must be alone in its segment. eg: '/:ids+.`);
|
|
1723
|
+
segment.push({
|
|
1724
|
+
type: 1,
|
|
1725
|
+
value: buffer,
|
|
1726
|
+
regexp: customRe,
|
|
1727
|
+
repeatable: char === "*" || char === "+",
|
|
1728
|
+
optional: char === "*" || char === "?"
|
|
1729
|
+
});
|
|
1730
|
+
} else crash("Invalid state to consume buffer");
|
|
1731
|
+
buffer = "";
|
|
1732
|
+
}
|
|
1733
|
+
function addCharToBuffer() {
|
|
1734
|
+
buffer += char;
|
|
1735
|
+
}
|
|
1736
|
+
while (i$1 < path.length) {
|
|
1737
|
+
char = path[i$1++];
|
|
1738
|
+
if (char === "\\" && state !== 2) {
|
|
1739
|
+
previousState = state;
|
|
1740
|
+
state = 4;
|
|
1741
|
+
continue;
|
|
1742
|
+
}
|
|
1743
|
+
switch (state) {
|
|
1744
|
+
case 0:
|
|
1745
|
+
if (char === "/") {
|
|
1746
|
+
if (buffer) consumeBuffer();
|
|
1747
|
+
finalizeSegment();
|
|
1748
|
+
} else if (char === ":") {
|
|
1749
|
+
consumeBuffer();
|
|
1750
|
+
state = 1;
|
|
1751
|
+
} else addCharToBuffer();
|
|
1752
|
+
break;
|
|
1753
|
+
case 4:
|
|
1754
|
+
addCharToBuffer();
|
|
1755
|
+
state = previousState;
|
|
1756
|
+
break;
|
|
1757
|
+
case 1:
|
|
1758
|
+
if (char === "(") state = 2;
|
|
1759
|
+
else if (VALID_PARAM_RE.test(char)) addCharToBuffer();
|
|
1760
|
+
else {
|
|
1761
|
+
consumeBuffer();
|
|
1762
|
+
state = 0;
|
|
1763
|
+
if (char !== "*" && char !== "?" && char !== "+") i$1--;
|
|
1764
|
+
}
|
|
1765
|
+
break;
|
|
1766
|
+
case 2:
|
|
1767
|
+
if (char === ")") if (customRe[customRe.length - 1] == "\\") customRe = customRe.slice(0, -1) + char;
|
|
1768
|
+
else state = 3;
|
|
1769
|
+
else customRe += char;
|
|
1770
|
+
break;
|
|
1771
|
+
case 3:
|
|
1772
|
+
consumeBuffer();
|
|
1773
|
+
state = 0;
|
|
1774
|
+
if (char !== "*" && char !== "?" && char !== "+") i$1--;
|
|
1775
|
+
customRe = "";
|
|
1776
|
+
break;
|
|
1777
|
+
default:
|
|
1778
|
+
crash("Unknown state");
|
|
1779
|
+
break;
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1782
|
+
if (state === 2) crash(`Unfinished custom RegExp for param "${buffer}"`);
|
|
1783
|
+
consumeBuffer();
|
|
1784
|
+
finalizeSegment();
|
|
1785
|
+
return tokens;
|
|
1786
|
+
}
|
|
1787
|
+
function createRouteRecordMatcher(record, parent, options) {
|
|
1788
|
+
const matcher = assign(tokensToParser(tokenizePath(record.path), options), {
|
|
1789
|
+
record,
|
|
1790
|
+
parent,
|
|
1791
|
+
children: [],
|
|
1792
|
+
alias: []
|
|
1793
|
+
});
|
|
1794
|
+
if (parent) {
|
|
1795
|
+
if (!matcher.record.aliasOf === !parent.record.aliasOf) parent.children.push(matcher);
|
|
1796
|
+
}
|
|
1797
|
+
return matcher;
|
|
1798
|
+
}
|
|
1799
|
+
function createRouterMatcher(routes, globalOptions) {
|
|
1800
|
+
const matchers = [];
|
|
1801
|
+
const matcherMap = /* @__PURE__ */ new Map();
|
|
1802
|
+
globalOptions = mergeOptions({
|
|
1803
|
+
strict: false,
|
|
1804
|
+
end: true,
|
|
1805
|
+
sensitive: false
|
|
1806
|
+
}, globalOptions);
|
|
1807
|
+
function getRecordMatcher(name) {
|
|
1808
|
+
return matcherMap.get(name);
|
|
1809
|
+
}
|
|
1810
|
+
function addRoute(record, parent, originalRecord) {
|
|
1811
|
+
const isRootAdd = !originalRecord;
|
|
1812
|
+
const mainNormalizedRecord = normalizeRouteRecord(record);
|
|
1813
|
+
mainNormalizedRecord.aliasOf = originalRecord && originalRecord.record;
|
|
1814
|
+
const options = mergeOptions(globalOptions, record);
|
|
1815
|
+
const normalizedRecords = [mainNormalizedRecord];
|
|
1816
|
+
if ("alias" in record) {
|
|
1817
|
+
const aliases = typeof record.alias === "string" ? [record.alias] : record.alias;
|
|
1818
|
+
for (const alias of aliases) normalizedRecords.push(normalizeRouteRecord(assign({}, mainNormalizedRecord, {
|
|
1819
|
+
components: originalRecord ? originalRecord.record.components : mainNormalizedRecord.components,
|
|
1820
|
+
path: alias,
|
|
1821
|
+
aliasOf: originalRecord ? originalRecord.record : mainNormalizedRecord
|
|
1822
|
+
})));
|
|
1823
|
+
}
|
|
1824
|
+
let matcher;
|
|
1825
|
+
let originalMatcher;
|
|
1826
|
+
for (const normalizedRecord of normalizedRecords) {
|
|
1827
|
+
const { path } = normalizedRecord;
|
|
1828
|
+
if (parent && path[0] !== "/") {
|
|
1829
|
+
const parentPath = parent.record.path;
|
|
1830
|
+
const connectingSlash = parentPath[parentPath.length - 1] === "/" ? "" : "/";
|
|
1831
|
+
normalizedRecord.path = parent.record.path + (path && connectingSlash + path);
|
|
1832
|
+
}
|
|
1833
|
+
matcher = createRouteRecordMatcher(normalizedRecord, parent, options);
|
|
1834
|
+
if (originalRecord) originalRecord.alias.push(matcher);
|
|
1835
|
+
else {
|
|
1836
|
+
originalMatcher = originalMatcher || matcher;
|
|
1837
|
+
if (originalMatcher !== matcher) originalMatcher.alias.push(matcher);
|
|
1838
|
+
if (isRootAdd && record.name && !isAliasRecord(matcher)) removeRoute(record.name);
|
|
1839
|
+
}
|
|
1840
|
+
if (isMatchable(matcher)) insertMatcher(matcher);
|
|
1841
|
+
if (mainNormalizedRecord.children) {
|
|
1842
|
+
const children = mainNormalizedRecord.children;
|
|
1843
|
+
for (let i$1 = 0; i$1 < children.length; i$1++) addRoute(children[i$1], matcher, originalRecord && originalRecord.children[i$1]);
|
|
1844
|
+
}
|
|
1845
|
+
originalRecord = originalRecord || matcher;
|
|
1846
|
+
}
|
|
1847
|
+
return originalMatcher ? () => {
|
|
1848
|
+
removeRoute(originalMatcher);
|
|
1849
|
+
} : noop;
|
|
1850
|
+
}
|
|
1851
|
+
function removeRoute(matcherRef) {
|
|
1852
|
+
if (isRouteName(matcherRef)) {
|
|
1853
|
+
const matcher = matcherMap.get(matcherRef);
|
|
1854
|
+
if (matcher) {
|
|
1855
|
+
matcherMap.delete(matcherRef);
|
|
1856
|
+
matchers.splice(matchers.indexOf(matcher), 1);
|
|
1857
|
+
matcher.children.forEach(removeRoute);
|
|
1858
|
+
matcher.alias.forEach(removeRoute);
|
|
1859
|
+
}
|
|
1860
|
+
} else {
|
|
1861
|
+
const index = matchers.indexOf(matcherRef);
|
|
1862
|
+
if (index > -1) {
|
|
1863
|
+
matchers.splice(index, 1);
|
|
1864
|
+
if (matcherRef.record.name) matcherMap.delete(matcherRef.record.name);
|
|
1865
|
+
matcherRef.children.forEach(removeRoute);
|
|
1866
|
+
matcherRef.alias.forEach(removeRoute);
|
|
1867
|
+
}
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1870
|
+
function getRoutes() {
|
|
1871
|
+
return matchers;
|
|
1872
|
+
}
|
|
1873
|
+
function insertMatcher(matcher) {
|
|
1874
|
+
const index = findInsertionIndex(matcher, matchers);
|
|
1875
|
+
matchers.splice(index, 0, matcher);
|
|
1876
|
+
if (matcher.record.name && !isAliasRecord(matcher)) matcherMap.set(matcher.record.name, matcher);
|
|
1877
|
+
}
|
|
1878
|
+
function resolve(location$1, currentLocation) {
|
|
1879
|
+
let matcher;
|
|
1880
|
+
let params = {};
|
|
1881
|
+
let path;
|
|
1882
|
+
let name;
|
|
1883
|
+
if ("name" in location$1 && location$1.name) {
|
|
1884
|
+
matcher = matcherMap.get(location$1.name);
|
|
1885
|
+
if (!matcher) throw createRouterError(1, { location: location$1 });
|
|
1886
|
+
name = matcher.record.name;
|
|
1887
|
+
params = assign(paramsFromLocation(currentLocation.params, matcher.keys.filter((k) => !k.optional).concat(matcher.parent ? matcher.parent.keys.filter((k) => k.optional) : []).map((k) => k.name)), location$1.params && paramsFromLocation(location$1.params, matcher.keys.map((k) => k.name)));
|
|
1888
|
+
path = matcher.stringify(params);
|
|
1889
|
+
} else if (location$1.path != null) {
|
|
1890
|
+
path = location$1.path;
|
|
1891
|
+
matcher = matchers.find((m) => m.re.test(path));
|
|
1892
|
+
if (matcher) {
|
|
1893
|
+
params = matcher.parse(path);
|
|
1894
|
+
name = matcher.record.name;
|
|
1895
|
+
}
|
|
1896
|
+
} else {
|
|
1897
|
+
matcher = currentLocation.name ? matcherMap.get(currentLocation.name) : matchers.find((m) => m.re.test(currentLocation.path));
|
|
1898
|
+
if (!matcher) throw createRouterError(1, {
|
|
1899
|
+
location: location$1,
|
|
1900
|
+
currentLocation
|
|
1901
|
+
});
|
|
1902
|
+
name = matcher.record.name;
|
|
1903
|
+
params = assign({}, currentLocation.params, location$1.params);
|
|
1904
|
+
path = matcher.stringify(params);
|
|
1905
|
+
}
|
|
1906
|
+
const matched = [];
|
|
1907
|
+
let parentMatcher = matcher;
|
|
1908
|
+
while (parentMatcher) {
|
|
1909
|
+
matched.unshift(parentMatcher.record);
|
|
1910
|
+
parentMatcher = parentMatcher.parent;
|
|
1911
|
+
}
|
|
1912
|
+
return {
|
|
1913
|
+
name,
|
|
1914
|
+
path,
|
|
1915
|
+
params,
|
|
1916
|
+
matched,
|
|
1917
|
+
meta: mergeMetaFields(matched)
|
|
1918
|
+
};
|
|
1919
|
+
}
|
|
1920
|
+
routes.forEach((route) => addRoute(route));
|
|
1921
|
+
function clearRoutes() {
|
|
1922
|
+
matchers.length = 0;
|
|
1923
|
+
matcherMap.clear();
|
|
1924
|
+
}
|
|
1925
|
+
return {
|
|
1926
|
+
addRoute,
|
|
1927
|
+
resolve,
|
|
1928
|
+
removeRoute,
|
|
1929
|
+
clearRoutes,
|
|
1930
|
+
getRoutes,
|
|
1931
|
+
getRecordMatcher
|
|
1932
|
+
};
|
|
1933
|
+
}
|
|
1934
|
+
function paramsFromLocation(params, keys) {
|
|
1935
|
+
const newParams = {};
|
|
1936
|
+
for (const key of keys) if (key in params) newParams[key] = params[key];
|
|
1937
|
+
return newParams;
|
|
1938
|
+
}
|
|
1939
|
+
function normalizeRouteRecord(record) {
|
|
1940
|
+
const normalized = {
|
|
1941
|
+
path: record.path,
|
|
1942
|
+
redirect: record.redirect,
|
|
1943
|
+
name: record.name,
|
|
1944
|
+
meta: record.meta || {},
|
|
1945
|
+
aliasOf: record.aliasOf,
|
|
1946
|
+
beforeEnter: record.beforeEnter,
|
|
1947
|
+
props: normalizeRecordProps(record),
|
|
1948
|
+
children: record.children || [],
|
|
1949
|
+
instances: {},
|
|
1950
|
+
leaveGuards: /* @__PURE__ */ new Set(),
|
|
1951
|
+
updateGuards: /* @__PURE__ */ new Set(),
|
|
1952
|
+
enterCallbacks: {},
|
|
1953
|
+
components: "components" in record ? record.components || null : record.component && { default: record.component }
|
|
1954
|
+
};
|
|
1955
|
+
Object.defineProperty(normalized, "mods", { value: {} });
|
|
1956
|
+
return normalized;
|
|
1957
|
+
}
|
|
1958
|
+
function normalizeRecordProps(record) {
|
|
1959
|
+
const propsObject = {};
|
|
1960
|
+
const props = record.props || false;
|
|
1961
|
+
if ("component" in record) propsObject.default = props;
|
|
1962
|
+
else for (const name in record.components) propsObject[name] = typeof props === "object" ? props[name] : props;
|
|
1963
|
+
return propsObject;
|
|
1964
|
+
}
|
|
1965
|
+
function isAliasRecord(record) {
|
|
1966
|
+
while (record) {
|
|
1967
|
+
if (record.record.aliasOf) return true;
|
|
1968
|
+
record = record.parent;
|
|
1969
|
+
}
|
|
1970
|
+
return false;
|
|
1971
|
+
}
|
|
1972
|
+
function mergeMetaFields(matched) {
|
|
1973
|
+
return matched.reduce((meta, record) => assign(meta, record.meta), {});
|
|
1974
|
+
}
|
|
1975
|
+
function mergeOptions(defaults, partialOptions) {
|
|
1976
|
+
const options = {};
|
|
1977
|
+
for (const key in defaults) options[key] = key in partialOptions ? partialOptions[key] : defaults[key];
|
|
1978
|
+
return options;
|
|
1979
|
+
}
|
|
1980
|
+
function findInsertionIndex(matcher, matchers) {
|
|
1981
|
+
let lower = 0;
|
|
1982
|
+
let upper = matchers.length;
|
|
1983
|
+
while (lower !== upper) {
|
|
1984
|
+
const mid = lower + upper >> 1;
|
|
1985
|
+
if (comparePathParserScore(matcher, matchers[mid]) < 0) upper = mid;
|
|
1986
|
+
else lower = mid + 1;
|
|
1987
|
+
}
|
|
1988
|
+
const insertionAncestor = getInsertionAncestor(matcher);
|
|
1989
|
+
if (insertionAncestor) upper = matchers.lastIndexOf(insertionAncestor, upper - 1);
|
|
1990
|
+
return upper;
|
|
1991
|
+
}
|
|
1992
|
+
function getInsertionAncestor(matcher) {
|
|
1993
|
+
let ancestor = matcher;
|
|
1994
|
+
while (ancestor = ancestor.parent) if (isMatchable(ancestor) && comparePathParserScore(matcher, ancestor) === 0) return ancestor;
|
|
1995
|
+
}
|
|
1996
|
+
function isMatchable({ record }) {
|
|
1997
|
+
return !!(record.name || record.components && Object.keys(record.components).length || record.redirect);
|
|
1998
|
+
}
|
|
1999
|
+
function parseQuery(search) {
|
|
2000
|
+
const query = {};
|
|
2001
|
+
if (search === "" || search === "?") return query;
|
|
2002
|
+
const searchParams = (search[0] === "?" ? search.slice(1) : search).split("&");
|
|
2003
|
+
for (let i$1 = 0; i$1 < searchParams.length; ++i$1) {
|
|
2004
|
+
const searchParam = searchParams[i$1].replace(PLUS_RE, " ");
|
|
2005
|
+
const eqPos = searchParam.indexOf("=");
|
|
2006
|
+
const key = decode(eqPos < 0 ? searchParam : searchParam.slice(0, eqPos));
|
|
2007
|
+
const value = eqPos < 0 ? null : decode(searchParam.slice(eqPos + 1));
|
|
2008
|
+
if (key in query) {
|
|
2009
|
+
let currentValue = query[key];
|
|
2010
|
+
if (!isArray$3(currentValue)) currentValue = query[key] = [currentValue];
|
|
2011
|
+
currentValue.push(value);
|
|
2012
|
+
} else query[key] = value;
|
|
2013
|
+
}
|
|
2014
|
+
return query;
|
|
2015
|
+
}
|
|
2016
|
+
function stringifyQuery(query) {
|
|
2017
|
+
let search = "";
|
|
2018
|
+
for (let key in query) {
|
|
2019
|
+
const value = query[key];
|
|
2020
|
+
key = encodeQueryKey(key);
|
|
2021
|
+
if (value == null) {
|
|
2022
|
+
if (value !== void 0) search += (search.length ? "&" : "") + key;
|
|
2023
|
+
continue;
|
|
2024
|
+
}
|
|
2025
|
+
(isArray$3(value) ? value.map((v) => v && encodeQueryValue(v)) : [value && encodeQueryValue(value)]).forEach((value$1) => {
|
|
2026
|
+
if (value$1 !== void 0) {
|
|
2027
|
+
search += (search.length ? "&" : "") + key;
|
|
2028
|
+
if (value$1 != null) search += "=" + value$1;
|
|
2029
|
+
}
|
|
2030
|
+
});
|
|
2031
|
+
}
|
|
2032
|
+
return search;
|
|
2033
|
+
}
|
|
2034
|
+
function normalizeQuery(query) {
|
|
2035
|
+
const normalizedQuery = {};
|
|
2036
|
+
for (const key in query) {
|
|
2037
|
+
const value = query[key];
|
|
2038
|
+
if (value !== void 0) normalizedQuery[key] = isArray$3(value) ? value.map((v) => v == null ? null : "" + v) : value == null ? value : "" + value;
|
|
2039
|
+
}
|
|
2040
|
+
return normalizedQuery;
|
|
2041
|
+
}
|
|
2042
|
+
var matchedRouteKey = Symbol("");
|
|
2043
|
+
var viewDepthKey = Symbol("");
|
|
2044
|
+
var routerKey = Symbol("");
|
|
2045
|
+
var routeLocationKey = Symbol("");
|
|
2046
|
+
var routerViewLocationKey = Symbol("");
|
|
2047
|
+
function useCallbacks() {
|
|
2048
|
+
let handlers = [];
|
|
2049
|
+
function add(handler) {
|
|
2050
|
+
handlers.push(handler);
|
|
2051
|
+
return () => {
|
|
2052
|
+
const i$1 = handlers.indexOf(handler);
|
|
2053
|
+
if (i$1 > -1) handlers.splice(i$1, 1);
|
|
2054
|
+
};
|
|
2055
|
+
}
|
|
2056
|
+
function reset() {
|
|
2057
|
+
handlers = [];
|
|
2058
|
+
}
|
|
2059
|
+
return {
|
|
2060
|
+
add,
|
|
2061
|
+
list: () => handlers.slice(),
|
|
2062
|
+
reset
|
|
2063
|
+
};
|
|
2064
|
+
}
|
|
2065
|
+
function registerGuard(record, name, guard) {
|
|
2066
|
+
const removeFromList = () => {
|
|
2067
|
+
record[name].delete(guard);
|
|
2068
|
+
};
|
|
2069
|
+
onUnmounted(removeFromList);
|
|
2070
|
+
onDeactivated(removeFromList);
|
|
2071
|
+
onActivated(() => {
|
|
2072
|
+
record[name].add(guard);
|
|
2073
|
+
});
|
|
2074
|
+
record[name].add(guard);
|
|
2075
|
+
}
|
|
2076
|
+
function onBeforeRouteLeave(leaveGuard) {
|
|
2077
|
+
const activeRecord = inject(matchedRouteKey, {}).value;
|
|
2078
|
+
if (!activeRecord) return;
|
|
2079
|
+
registerGuard(activeRecord, "leaveGuards", leaveGuard);
|
|
2080
|
+
}
|
|
2081
|
+
function guardToPromiseFn(guard, to, from, record, name, runWithContext = (fn) => fn()) {
|
|
2082
|
+
const enterCallbackArray = record && (record.enterCallbacks[name] = record.enterCallbacks[name] || []);
|
|
2083
|
+
return () => new Promise((resolve, reject) => {
|
|
2084
|
+
const next = (valid) => {
|
|
2085
|
+
if (valid === false) reject(createRouterError(4, {
|
|
2086
|
+
from,
|
|
2087
|
+
to
|
|
2088
|
+
}));
|
|
2089
|
+
else if (valid instanceof Error) reject(valid);
|
|
2090
|
+
else if (isRouteLocation(valid)) reject(createRouterError(2, {
|
|
2091
|
+
from: to,
|
|
2092
|
+
to: valid
|
|
2093
|
+
}));
|
|
2094
|
+
else {
|
|
2095
|
+
if (enterCallbackArray && record.enterCallbacks[name] === enterCallbackArray && typeof valid === "function") enterCallbackArray.push(valid);
|
|
2096
|
+
resolve();
|
|
2097
|
+
}
|
|
2098
|
+
};
|
|
2099
|
+
const guardReturn = runWithContext(() => guard.call(record && record.instances[name], to, from, next));
|
|
2100
|
+
let guardCall = Promise.resolve(guardReturn);
|
|
2101
|
+
if (guard.length < 3) guardCall = guardCall.then(next);
|
|
2102
|
+
guardCall.catch((err) => reject(err));
|
|
2103
|
+
});
|
|
2104
|
+
}
|
|
2105
|
+
function extractComponentsGuards(matched, guardType, to, from, runWithContext = (fn) => fn()) {
|
|
2106
|
+
const guards = [];
|
|
2107
|
+
for (const record of matched) for (const name in record.components) {
|
|
2108
|
+
let rawComponent = record.components[name];
|
|
2109
|
+
if (guardType !== "beforeRouteEnter" && !record.instances[name]) continue;
|
|
2110
|
+
if (isRouteComponent(rawComponent)) {
|
|
2111
|
+
const guard = (rawComponent.__vccOpts || rawComponent)[guardType];
|
|
2112
|
+
guard && guards.push(guardToPromiseFn(guard, to, from, record, name, runWithContext));
|
|
2113
|
+
} else {
|
|
2114
|
+
let componentPromise = rawComponent();
|
|
2115
|
+
guards.push(() => componentPromise.then((resolved) => {
|
|
2116
|
+
if (!resolved) throw new Error(`Couldn't resolve component "${name}" at "${record.path}"`);
|
|
2117
|
+
const resolvedComponent = isESModule(resolved) ? resolved.default : resolved;
|
|
2118
|
+
record.mods[name] = resolved;
|
|
2119
|
+
record.components[name] = resolvedComponent;
|
|
2120
|
+
const guard = (resolvedComponent.__vccOpts || resolvedComponent)[guardType];
|
|
2121
|
+
return guard && guardToPromiseFn(guard, to, from, record, name, runWithContext)();
|
|
2122
|
+
}));
|
|
2123
|
+
}
|
|
2124
|
+
}
|
|
2125
|
+
return guards;
|
|
2126
|
+
}
|
|
2127
|
+
function useLink(props) {
|
|
2128
|
+
const router = inject(routerKey);
|
|
2129
|
+
const currentRoute = inject(routeLocationKey);
|
|
2130
|
+
const route = computed(() => {
|
|
2131
|
+
const to = unref(props.to);
|
|
2132
|
+
return router.resolve(to);
|
|
2133
|
+
});
|
|
2134
|
+
const activeRecordIndex = computed(() => {
|
|
2135
|
+
const { matched } = route.value;
|
|
2136
|
+
const { length } = matched;
|
|
2137
|
+
const routeMatched = matched[length - 1];
|
|
2138
|
+
const currentMatched = currentRoute.matched;
|
|
2139
|
+
if (!routeMatched || !currentMatched.length) return -1;
|
|
2140
|
+
const index = currentMatched.findIndex(isSameRouteRecord.bind(null, routeMatched));
|
|
2141
|
+
if (index > -1) return index;
|
|
2142
|
+
const parentRecordPath = getOriginalPath(matched[length - 2]);
|
|
2143
|
+
return length > 1 && getOriginalPath(routeMatched) === parentRecordPath && currentMatched[currentMatched.length - 1].path !== parentRecordPath ? currentMatched.findIndex(isSameRouteRecord.bind(null, matched[length - 2])) : index;
|
|
2144
|
+
});
|
|
2145
|
+
const isActive = computed(() => activeRecordIndex.value > -1 && includesParams(currentRoute.params, route.value.params));
|
|
2146
|
+
const isExactActive = computed(() => activeRecordIndex.value > -1 && activeRecordIndex.value === currentRoute.matched.length - 1 && isSameRouteLocationParams(currentRoute.params, route.value.params));
|
|
2147
|
+
function navigate(e = {}) {
|
|
2148
|
+
if (guardEvent(e)) {
|
|
2149
|
+
const p = router[unref(props.replace) ? "replace" : "push"](unref(props.to)).catch(noop);
|
|
2150
|
+
if (props.viewTransition && typeof document !== "undefined" && "startViewTransition" in document) document.startViewTransition(() => p);
|
|
2151
|
+
return p;
|
|
2152
|
+
}
|
|
2153
|
+
return Promise.resolve();
|
|
2154
|
+
}
|
|
2155
|
+
return {
|
|
2156
|
+
route,
|
|
2157
|
+
href: computed(() => route.value.href),
|
|
2158
|
+
isActive,
|
|
2159
|
+
isExactActive,
|
|
2160
|
+
navigate
|
|
2161
|
+
};
|
|
2162
|
+
}
|
|
2163
|
+
function preferSingleVNode(vnodes) {
|
|
2164
|
+
return vnodes.length === 1 ? vnodes[0] : vnodes;
|
|
2165
|
+
}
|
|
2166
|
+
var RouterLink = /* @__PURE__ */ defineComponent({
|
|
2167
|
+
name: "RouterLink",
|
|
2168
|
+
compatConfig: { MODE: 3 },
|
|
2169
|
+
props: {
|
|
2170
|
+
to: {
|
|
2171
|
+
type: [String, Object],
|
|
2172
|
+
required: true
|
|
2173
|
+
},
|
|
2174
|
+
replace: Boolean,
|
|
2175
|
+
activeClass: String,
|
|
2176
|
+
exactActiveClass: String,
|
|
2177
|
+
custom: Boolean,
|
|
2178
|
+
ariaCurrentValue: {
|
|
2179
|
+
type: String,
|
|
2180
|
+
default: "page"
|
|
2181
|
+
}
|
|
2182
|
+
},
|
|
2183
|
+
useLink,
|
|
2184
|
+
setup(props, { slots }) {
|
|
2185
|
+
const link = reactive(useLink(props));
|
|
2186
|
+
const { options } = inject(routerKey);
|
|
2187
|
+
const elClass = computed(() => ({
|
|
2188
|
+
[getLinkClass(props.activeClass, options.linkActiveClass, "router-link-active")]: link.isActive,
|
|
2189
|
+
[getLinkClass(props.exactActiveClass, options.linkExactActiveClass, "router-link-exact-active")]: link.isExactActive
|
|
2190
|
+
}));
|
|
2191
|
+
return () => {
|
|
2192
|
+
const children = slots.default && preferSingleVNode(slots.default(link));
|
|
2193
|
+
return props.custom ? children : h("a", {
|
|
2194
|
+
"aria-current": link.isExactActive ? props.ariaCurrentValue : null,
|
|
2195
|
+
href: link.href,
|
|
2196
|
+
onClick: link.navigate,
|
|
2197
|
+
class: elClass.value
|
|
2198
|
+
}, children);
|
|
2199
|
+
};
|
|
2200
|
+
}
|
|
2201
|
+
});
|
|
2202
|
+
function guardEvent(e) {
|
|
2203
|
+
if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) return;
|
|
2204
|
+
if (e.defaultPrevented) return;
|
|
2205
|
+
if (e.button !== void 0 && e.button !== 0) return;
|
|
2206
|
+
if (e.currentTarget && e.currentTarget.getAttribute) {
|
|
2207
|
+
const target = e.currentTarget.getAttribute("target");
|
|
2208
|
+
if (/\b_blank\b/i.test(target)) return;
|
|
2209
|
+
}
|
|
2210
|
+
if (e.preventDefault) e.preventDefault();
|
|
2211
|
+
return true;
|
|
2212
|
+
}
|
|
2213
|
+
function includesParams(outer, inner) {
|
|
2214
|
+
for (const key in inner) {
|
|
2215
|
+
const innerValue = inner[key];
|
|
2216
|
+
const outerValue = outer[key];
|
|
2217
|
+
if (typeof innerValue === "string") {
|
|
2218
|
+
if (innerValue !== outerValue) return false;
|
|
2219
|
+
} else if (!isArray$3(outerValue) || outerValue.length !== innerValue.length || innerValue.some((value, i$1) => value !== outerValue[i$1])) return false;
|
|
2220
|
+
}
|
|
2221
|
+
return true;
|
|
2222
|
+
}
|
|
2223
|
+
function getOriginalPath(record) {
|
|
2224
|
+
return record ? record.aliasOf ? record.aliasOf.path : record.path : "";
|
|
2225
|
+
}
|
|
2226
|
+
var getLinkClass = (propClass, globalClass, defaultClass) => propClass != null ? propClass : globalClass != null ? globalClass : defaultClass;
|
|
2227
|
+
var RouterViewImpl = /* @__PURE__ */ defineComponent({
|
|
2228
|
+
name: "RouterView",
|
|
2229
|
+
inheritAttrs: false,
|
|
2230
|
+
props: {
|
|
2231
|
+
name: {
|
|
2232
|
+
type: String,
|
|
2233
|
+
default: "default"
|
|
2234
|
+
},
|
|
2235
|
+
route: Object
|
|
2236
|
+
},
|
|
2237
|
+
compatConfig: { MODE: 3 },
|
|
2238
|
+
setup(props, { attrs, slots }) {
|
|
2239
|
+
const injectedRoute = inject(routerViewLocationKey);
|
|
2240
|
+
const routeToDisplay = computed(() => props.route || injectedRoute.value);
|
|
2241
|
+
const injectedDepth = inject(viewDepthKey, 0);
|
|
2242
|
+
const depth = computed(() => {
|
|
2243
|
+
let initialDepth = unref(injectedDepth);
|
|
2244
|
+
const { matched } = routeToDisplay.value;
|
|
2245
|
+
let matchedRoute;
|
|
2246
|
+
while ((matchedRoute = matched[initialDepth]) && !matchedRoute.components) initialDepth++;
|
|
2247
|
+
return initialDepth;
|
|
2248
|
+
});
|
|
2249
|
+
const matchedRouteRef = computed(() => routeToDisplay.value.matched[depth.value]);
|
|
2250
|
+
provide(viewDepthKey, computed(() => depth.value + 1));
|
|
2251
|
+
provide(matchedRouteKey, matchedRouteRef);
|
|
2252
|
+
provide(routerViewLocationKey, routeToDisplay);
|
|
2253
|
+
const viewRef = ref();
|
|
2254
|
+
watch(() => [
|
|
2255
|
+
viewRef.value,
|
|
2256
|
+
matchedRouteRef.value,
|
|
2257
|
+
props.name
|
|
2258
|
+
], ([instance, to, name], [oldInstance, from, oldName]) => {
|
|
2259
|
+
if (to) {
|
|
2260
|
+
to.instances[name] = instance;
|
|
2261
|
+
if (from && from !== to && instance && instance === oldInstance) {
|
|
2262
|
+
if (!to.leaveGuards.size) to.leaveGuards = from.leaveGuards;
|
|
2263
|
+
if (!to.updateGuards.size) to.updateGuards = from.updateGuards;
|
|
2264
|
+
}
|
|
2265
|
+
}
|
|
2266
|
+
if (instance && to && (!from || !isSameRouteRecord(to, from) || !oldInstance)) (to.enterCallbacks[name] || []).forEach((callback) => callback(instance));
|
|
2267
|
+
}, { flush: "post" });
|
|
2268
|
+
return () => {
|
|
2269
|
+
const route = routeToDisplay.value;
|
|
2270
|
+
const currentName = props.name;
|
|
2271
|
+
const matchedRoute = matchedRouteRef.value;
|
|
2272
|
+
const ViewComponent = matchedRoute && matchedRoute.components[currentName];
|
|
2273
|
+
if (!ViewComponent) return normalizeSlot(slots.default, {
|
|
2274
|
+
Component: ViewComponent,
|
|
2275
|
+
route
|
|
2276
|
+
});
|
|
2277
|
+
const routePropsOption = matchedRoute.props[currentName];
|
|
2278
|
+
const routeProps = routePropsOption ? routePropsOption === true ? route.params : typeof routePropsOption === "function" ? routePropsOption(route) : routePropsOption : null;
|
|
2279
|
+
const onVnodeUnmounted = (vnode) => {
|
|
2280
|
+
if (vnode.component.isUnmounted) matchedRoute.instances[currentName] = null;
|
|
2281
|
+
};
|
|
2282
|
+
const component = h(ViewComponent, assign({}, routeProps, attrs, {
|
|
2283
|
+
onVnodeUnmounted,
|
|
2284
|
+
ref: viewRef
|
|
2285
|
+
}));
|
|
2286
|
+
return normalizeSlot(slots.default, {
|
|
2287
|
+
Component: component,
|
|
2288
|
+
route
|
|
2289
|
+
}) || component;
|
|
2290
|
+
};
|
|
2291
|
+
}
|
|
2292
|
+
});
|
|
2293
|
+
function normalizeSlot(slot, data) {
|
|
2294
|
+
if (!slot) return null;
|
|
2295
|
+
const slotContent = slot(data);
|
|
2296
|
+
return slotContent.length === 1 ? slotContent[0] : slotContent;
|
|
2297
|
+
}
|
|
2298
|
+
var RouterView = RouterViewImpl;
|
|
2299
|
+
function createRouter(options) {
|
|
2300
|
+
const matcher = createRouterMatcher(options.routes, options);
|
|
2301
|
+
const parseQuery$1 = options.parseQuery || parseQuery;
|
|
2302
|
+
const stringifyQuery$1 = options.stringifyQuery || stringifyQuery;
|
|
2303
|
+
const routerHistory = options.history;
|
|
2304
|
+
const beforeGuards = useCallbacks();
|
|
2305
|
+
const beforeResolveGuards = useCallbacks();
|
|
2306
|
+
const afterGuards = useCallbacks();
|
|
2307
|
+
const currentRoute = shallowRef(START_LOCATION_NORMALIZED);
|
|
2308
|
+
let pendingLocation = START_LOCATION_NORMALIZED;
|
|
2309
|
+
if (isBrowser && options.scrollBehavior && "scrollRestoration" in history) history.scrollRestoration = "manual";
|
|
2310
|
+
const normalizeParams = applyToParams.bind(null, (paramValue) => "" + paramValue);
|
|
2311
|
+
const encodeParams = applyToParams.bind(null, encodeParam);
|
|
2312
|
+
const decodeParams = applyToParams.bind(null, decode);
|
|
2313
|
+
function addRoute(parentOrRoute, route) {
|
|
2314
|
+
let parent;
|
|
2315
|
+
let record;
|
|
2316
|
+
if (isRouteName(parentOrRoute)) {
|
|
2317
|
+
parent = matcher.getRecordMatcher(parentOrRoute);
|
|
2318
|
+
record = route;
|
|
2319
|
+
} else record = parentOrRoute;
|
|
2320
|
+
return matcher.addRoute(record, parent);
|
|
2321
|
+
}
|
|
2322
|
+
function removeRoute(name) {
|
|
2323
|
+
const recordMatcher = matcher.getRecordMatcher(name);
|
|
2324
|
+
if (recordMatcher) matcher.removeRoute(recordMatcher);
|
|
2325
|
+
}
|
|
2326
|
+
function getRoutes() {
|
|
2327
|
+
return matcher.getRoutes().map((routeMatcher) => routeMatcher.record);
|
|
2328
|
+
}
|
|
2329
|
+
function hasRoute(name) {
|
|
2330
|
+
return !!matcher.getRecordMatcher(name);
|
|
2331
|
+
}
|
|
2332
|
+
function resolve(rawLocation, currentLocation) {
|
|
2333
|
+
currentLocation = assign({}, currentLocation || currentRoute.value);
|
|
2334
|
+
if (typeof rawLocation === "string") {
|
|
2335
|
+
const locationNormalized = parseURL(parseQuery$1, rawLocation, currentLocation.path);
|
|
2336
|
+
const matchedRoute$1 = matcher.resolve({ path: locationNormalized.path }, currentLocation);
|
|
2337
|
+
const href$1 = routerHistory.createHref(locationNormalized.fullPath);
|
|
2338
|
+
return assign(locationNormalized, matchedRoute$1, {
|
|
2339
|
+
params: decodeParams(matchedRoute$1.params),
|
|
2340
|
+
hash: decode(locationNormalized.hash),
|
|
2341
|
+
redirectedFrom: void 0,
|
|
2342
|
+
href: href$1
|
|
2343
|
+
});
|
|
2344
|
+
}
|
|
2345
|
+
let matcherLocation;
|
|
2346
|
+
if (rawLocation.path != null) matcherLocation = assign({}, rawLocation, { path: parseURL(parseQuery$1, rawLocation.path, currentLocation.path).path });
|
|
2347
|
+
else {
|
|
2348
|
+
const targetParams = assign({}, rawLocation.params);
|
|
2349
|
+
for (const key in targetParams) if (targetParams[key] == null) delete targetParams[key];
|
|
2350
|
+
matcherLocation = assign({}, rawLocation, { params: encodeParams(targetParams) });
|
|
2351
|
+
currentLocation.params = encodeParams(currentLocation.params);
|
|
2352
|
+
}
|
|
2353
|
+
const matchedRoute = matcher.resolve(matcherLocation, currentLocation);
|
|
2354
|
+
const hash = rawLocation.hash || "";
|
|
2355
|
+
matchedRoute.params = normalizeParams(decodeParams(matchedRoute.params));
|
|
2356
|
+
const fullPath = stringifyURL(stringifyQuery$1, assign({}, rawLocation, {
|
|
2357
|
+
hash: encodeHash(hash),
|
|
2358
|
+
path: matchedRoute.path
|
|
2359
|
+
}));
|
|
2360
|
+
const href = routerHistory.createHref(fullPath);
|
|
2361
|
+
return assign({
|
|
2362
|
+
fullPath,
|
|
2363
|
+
hash,
|
|
2364
|
+
query: stringifyQuery$1 === stringifyQuery ? normalizeQuery(rawLocation.query) : rawLocation.query || {}
|
|
2365
|
+
}, matchedRoute, {
|
|
2366
|
+
redirectedFrom: void 0,
|
|
2367
|
+
href
|
|
2368
|
+
});
|
|
2369
|
+
}
|
|
2370
|
+
function locationAsObject(to) {
|
|
2371
|
+
return typeof to === "string" ? parseURL(parseQuery$1, to, currentRoute.value.path) : assign({}, to);
|
|
2372
|
+
}
|
|
2373
|
+
function checkCanceledNavigation(to, from) {
|
|
2374
|
+
if (pendingLocation !== to) return createRouterError(8, {
|
|
2375
|
+
from,
|
|
2376
|
+
to
|
|
2377
|
+
});
|
|
2378
|
+
}
|
|
2379
|
+
function push(to) {
|
|
2380
|
+
return pushWithRedirect(to);
|
|
2381
|
+
}
|
|
2382
|
+
function replace(to) {
|
|
2383
|
+
return push(assign(locationAsObject(to), { replace: true }));
|
|
2384
|
+
}
|
|
2385
|
+
function handleRedirectRecord(to) {
|
|
2386
|
+
const lastMatched = to.matched[to.matched.length - 1];
|
|
2387
|
+
if (lastMatched && lastMatched.redirect) {
|
|
2388
|
+
const { redirect } = lastMatched;
|
|
2389
|
+
let newTargetLocation = typeof redirect === "function" ? redirect(to) : redirect;
|
|
2390
|
+
if (typeof newTargetLocation === "string") {
|
|
2391
|
+
newTargetLocation = newTargetLocation.includes("?") || newTargetLocation.includes("#") ? newTargetLocation = locationAsObject(newTargetLocation) : { path: newTargetLocation };
|
|
2392
|
+
newTargetLocation.params = {};
|
|
2393
|
+
}
|
|
2394
|
+
return assign({
|
|
2395
|
+
query: to.query,
|
|
2396
|
+
hash: to.hash,
|
|
2397
|
+
params: newTargetLocation.path != null ? {} : to.params
|
|
2398
|
+
}, newTargetLocation);
|
|
2399
|
+
}
|
|
2400
|
+
}
|
|
2401
|
+
function pushWithRedirect(to, redirectedFrom) {
|
|
2402
|
+
const targetLocation = pendingLocation = resolve(to);
|
|
2403
|
+
const from = currentRoute.value;
|
|
2404
|
+
const data = to.state;
|
|
2405
|
+
const force = to.force;
|
|
2406
|
+
const replace$1 = to.replace === true;
|
|
2407
|
+
const shouldRedirect = handleRedirectRecord(targetLocation);
|
|
2408
|
+
if (shouldRedirect) return pushWithRedirect(assign(locationAsObject(shouldRedirect), {
|
|
2409
|
+
state: typeof shouldRedirect === "object" ? assign({}, data, shouldRedirect.state) : data,
|
|
2410
|
+
force,
|
|
2411
|
+
replace: replace$1
|
|
2412
|
+
}), redirectedFrom || targetLocation);
|
|
2413
|
+
const toLocation = targetLocation;
|
|
2414
|
+
toLocation.redirectedFrom = redirectedFrom;
|
|
2415
|
+
let failure;
|
|
2416
|
+
if (!force && isSameRouteLocation(stringifyQuery$1, from, targetLocation)) {
|
|
2417
|
+
failure = createRouterError(16, {
|
|
2418
|
+
to: toLocation,
|
|
2419
|
+
from
|
|
2420
|
+
});
|
|
2421
|
+
handleScroll(from, from, true, false);
|
|
2422
|
+
}
|
|
2423
|
+
return (failure ? Promise.resolve(failure) : navigate(toLocation, from)).catch((error) => isNavigationFailure(error) ? isNavigationFailure(error, 2) ? error : markAsReady(error) : triggerError(error, toLocation, from)).then((failure$1) => {
|
|
2424
|
+
if (failure$1) {
|
|
2425
|
+
if (isNavigationFailure(failure$1, 2)) return pushWithRedirect(assign({ replace: replace$1 }, locationAsObject(failure$1.to), {
|
|
2426
|
+
state: typeof failure$1.to === "object" ? assign({}, data, failure$1.to.state) : data,
|
|
2427
|
+
force
|
|
2428
|
+
}), redirectedFrom || toLocation);
|
|
2429
|
+
} else failure$1 = finalizeNavigation(toLocation, from, true, replace$1, data);
|
|
2430
|
+
triggerAfterEach(toLocation, from, failure$1);
|
|
2431
|
+
return failure$1;
|
|
2432
|
+
});
|
|
2433
|
+
}
|
|
2434
|
+
function checkCanceledNavigationAndReject(to, from) {
|
|
2435
|
+
const error = checkCanceledNavigation(to, from);
|
|
2436
|
+
return error ? Promise.reject(error) : Promise.resolve();
|
|
2437
|
+
}
|
|
2438
|
+
function runWithContext(fn) {
|
|
2439
|
+
const app = installedApps.values().next().value;
|
|
2440
|
+
return app && typeof app.runWithContext === "function" ? app.runWithContext(fn) : fn();
|
|
2441
|
+
}
|
|
2442
|
+
function navigate(to, from) {
|
|
2443
|
+
let guards;
|
|
2444
|
+
const [leavingRecords, updatingRecords, enteringRecords] = extractChangingRecords(to, from);
|
|
2445
|
+
guards = extractComponentsGuards(leavingRecords.reverse(), "beforeRouteLeave", to, from);
|
|
2446
|
+
for (const record of leavingRecords) record.leaveGuards.forEach((guard) => {
|
|
2447
|
+
guards.push(guardToPromiseFn(guard, to, from));
|
|
2448
|
+
});
|
|
2449
|
+
const canceledNavigationCheck = checkCanceledNavigationAndReject.bind(null, to, from);
|
|
2450
|
+
guards.push(canceledNavigationCheck);
|
|
2451
|
+
return runGuardQueue(guards).then(() => {
|
|
2452
|
+
guards = [];
|
|
2453
|
+
for (const guard of beforeGuards.list()) guards.push(guardToPromiseFn(guard, to, from));
|
|
2454
|
+
guards.push(canceledNavigationCheck);
|
|
2455
|
+
return runGuardQueue(guards);
|
|
2456
|
+
}).then(() => {
|
|
2457
|
+
guards = extractComponentsGuards(updatingRecords, "beforeRouteUpdate", to, from);
|
|
2458
|
+
for (const record of updatingRecords) record.updateGuards.forEach((guard) => {
|
|
2459
|
+
guards.push(guardToPromiseFn(guard, to, from));
|
|
2460
|
+
});
|
|
2461
|
+
guards.push(canceledNavigationCheck);
|
|
2462
|
+
return runGuardQueue(guards);
|
|
2463
|
+
}).then(() => {
|
|
2464
|
+
guards = [];
|
|
2465
|
+
for (const record of enteringRecords) if (record.beforeEnter) if (isArray$3(record.beforeEnter)) for (const beforeEnter of record.beforeEnter) guards.push(guardToPromiseFn(beforeEnter, to, from));
|
|
2466
|
+
else guards.push(guardToPromiseFn(record.beforeEnter, to, from));
|
|
2467
|
+
guards.push(canceledNavigationCheck);
|
|
2468
|
+
return runGuardQueue(guards);
|
|
2469
|
+
}).then(() => {
|
|
2470
|
+
to.matched.forEach((record) => record.enterCallbacks = {});
|
|
2471
|
+
guards = extractComponentsGuards(enteringRecords, "beforeRouteEnter", to, from, runWithContext);
|
|
2472
|
+
guards.push(canceledNavigationCheck);
|
|
2473
|
+
return runGuardQueue(guards);
|
|
2474
|
+
}).then(() => {
|
|
2475
|
+
guards = [];
|
|
2476
|
+
for (const guard of beforeResolveGuards.list()) guards.push(guardToPromiseFn(guard, to, from));
|
|
2477
|
+
guards.push(canceledNavigationCheck);
|
|
2478
|
+
return runGuardQueue(guards);
|
|
2479
|
+
}).catch((err) => isNavigationFailure(err, 8) ? err : Promise.reject(err));
|
|
2480
|
+
}
|
|
2481
|
+
function triggerAfterEach(to, from, failure) {
|
|
2482
|
+
afterGuards.list().forEach((guard) => runWithContext(() => guard(to, from, failure)));
|
|
2483
|
+
}
|
|
2484
|
+
function finalizeNavigation(toLocation, from, isPush, replace$1, data) {
|
|
2485
|
+
const error = checkCanceledNavigation(toLocation, from);
|
|
2486
|
+
if (error) return error;
|
|
2487
|
+
const isFirstNavigation = from === START_LOCATION_NORMALIZED;
|
|
2488
|
+
const state = !isBrowser ? {} : history.state;
|
|
2489
|
+
if (isPush) if (replace$1 || isFirstNavigation) routerHistory.replace(toLocation.fullPath, assign({ scroll: isFirstNavigation && state && state.scroll }, data));
|
|
2490
|
+
else routerHistory.push(toLocation.fullPath, data);
|
|
2491
|
+
currentRoute.value = toLocation;
|
|
2492
|
+
handleScroll(toLocation, from, isPush, isFirstNavigation);
|
|
2493
|
+
markAsReady();
|
|
2494
|
+
}
|
|
2495
|
+
let removeHistoryListener;
|
|
2496
|
+
function setupListeners() {
|
|
2497
|
+
if (removeHistoryListener) return;
|
|
2498
|
+
removeHistoryListener = routerHistory.listen((to, _from, info) => {
|
|
2499
|
+
if (!router.listening) return;
|
|
2500
|
+
const toLocation = resolve(to);
|
|
2501
|
+
const shouldRedirect = handleRedirectRecord(toLocation);
|
|
2502
|
+
if (shouldRedirect) {
|
|
2503
|
+
pushWithRedirect(assign(shouldRedirect, {
|
|
2504
|
+
replace: true,
|
|
2505
|
+
force: true
|
|
2506
|
+
}), toLocation).catch(noop);
|
|
2507
|
+
return;
|
|
2508
|
+
}
|
|
2509
|
+
pendingLocation = toLocation;
|
|
2510
|
+
const from = currentRoute.value;
|
|
2511
|
+
if (isBrowser) saveScrollPosition(getScrollKey(from.fullPath, info.delta), computeScrollPosition());
|
|
2512
|
+
navigate(toLocation, from).catch((error) => {
|
|
2513
|
+
if (isNavigationFailure(error, 12)) return error;
|
|
2514
|
+
if (isNavigationFailure(error, 2)) {
|
|
2515
|
+
pushWithRedirect(assign(locationAsObject(error.to), { force: true }), toLocation).then((failure) => {
|
|
2516
|
+
if (isNavigationFailure(failure, 20) && !info.delta && info.type === NavigationType.pop) routerHistory.go(-1, false);
|
|
2517
|
+
}).catch(noop);
|
|
2518
|
+
return Promise.reject();
|
|
2519
|
+
}
|
|
2520
|
+
if (info.delta) routerHistory.go(-info.delta, false);
|
|
2521
|
+
return triggerError(error, toLocation, from);
|
|
2522
|
+
}).then((failure) => {
|
|
2523
|
+
failure = failure || finalizeNavigation(toLocation, from, false);
|
|
2524
|
+
if (failure) {
|
|
2525
|
+
if (info.delta && !isNavigationFailure(failure, 8)) routerHistory.go(-info.delta, false);
|
|
2526
|
+
else if (info.type === NavigationType.pop && isNavigationFailure(failure, 20)) routerHistory.go(-1, false);
|
|
2527
|
+
}
|
|
2528
|
+
triggerAfterEach(toLocation, from, failure);
|
|
2529
|
+
}).catch(noop);
|
|
2530
|
+
});
|
|
2531
|
+
}
|
|
2532
|
+
let readyHandlers = useCallbacks();
|
|
2533
|
+
let errorListeners = useCallbacks();
|
|
2534
|
+
let ready;
|
|
2535
|
+
function triggerError(error, to, from) {
|
|
2536
|
+
markAsReady(error);
|
|
2537
|
+
const list = errorListeners.list();
|
|
2538
|
+
if (list.length) list.forEach((handler) => handler(error, to, from));
|
|
2539
|
+
else console.error(error);
|
|
2540
|
+
return Promise.reject(error);
|
|
2541
|
+
}
|
|
2542
|
+
function isReady() {
|
|
2543
|
+
if (ready && currentRoute.value !== START_LOCATION_NORMALIZED) return Promise.resolve();
|
|
2544
|
+
return new Promise((resolve$1, reject) => {
|
|
2545
|
+
readyHandlers.add([resolve$1, reject]);
|
|
2546
|
+
});
|
|
2547
|
+
}
|
|
2548
|
+
function markAsReady(err) {
|
|
2549
|
+
if (!ready) {
|
|
2550
|
+
ready = !err;
|
|
2551
|
+
setupListeners();
|
|
2552
|
+
readyHandlers.list().forEach(([resolve$1, reject]) => err ? reject(err) : resolve$1());
|
|
2553
|
+
readyHandlers.reset();
|
|
2554
|
+
}
|
|
2555
|
+
return err;
|
|
2556
|
+
}
|
|
2557
|
+
function handleScroll(to, from, isPush, isFirstNavigation) {
|
|
2558
|
+
const { scrollBehavior } = options;
|
|
2559
|
+
if (!isBrowser || !scrollBehavior) return Promise.resolve();
|
|
2560
|
+
const scrollPosition = !isPush && getSavedScrollPosition(getScrollKey(to.fullPath, 0)) || (isFirstNavigation || !isPush) && history.state && history.state.scroll || null;
|
|
2561
|
+
return nextTick().then(() => scrollBehavior(to, from, scrollPosition)).then((position) => position && scrollToPosition(position)).catch((err) => triggerError(err, to, from));
|
|
2562
|
+
}
|
|
2563
|
+
const go = (delta) => routerHistory.go(delta);
|
|
2564
|
+
let started;
|
|
2565
|
+
const installedApps = /* @__PURE__ */ new Set();
|
|
2566
|
+
const router = {
|
|
2567
|
+
currentRoute,
|
|
2568
|
+
listening: true,
|
|
2569
|
+
addRoute,
|
|
2570
|
+
removeRoute,
|
|
2571
|
+
clearRoutes: matcher.clearRoutes,
|
|
2572
|
+
hasRoute,
|
|
2573
|
+
getRoutes,
|
|
2574
|
+
resolve,
|
|
2575
|
+
options,
|
|
2576
|
+
push,
|
|
2577
|
+
replace,
|
|
2578
|
+
go,
|
|
2579
|
+
back: () => go(-1),
|
|
2580
|
+
forward: () => go(1),
|
|
2581
|
+
beforeEach: beforeGuards.add,
|
|
2582
|
+
beforeResolve: beforeResolveGuards.add,
|
|
2583
|
+
afterEach: afterGuards.add,
|
|
2584
|
+
onError: errorListeners.add,
|
|
2585
|
+
isReady,
|
|
2586
|
+
install(app) {
|
|
2587
|
+
const router$1 = this;
|
|
2588
|
+
app.component("RouterLink", RouterLink);
|
|
2589
|
+
app.component("RouterView", RouterView);
|
|
2590
|
+
app.config.globalProperties.$router = router$1;
|
|
2591
|
+
Object.defineProperty(app.config.globalProperties, "$route", {
|
|
2592
|
+
enumerable: true,
|
|
2593
|
+
get: () => unref(currentRoute)
|
|
2594
|
+
});
|
|
2595
|
+
if (isBrowser && !started && currentRoute.value === START_LOCATION_NORMALIZED) {
|
|
2596
|
+
started = true;
|
|
2597
|
+
push(routerHistory.location).catch((err) => {});
|
|
2598
|
+
}
|
|
2599
|
+
const reactiveRoute = {};
|
|
2600
|
+
for (const key in START_LOCATION_NORMALIZED) Object.defineProperty(reactiveRoute, key, {
|
|
2601
|
+
get: () => currentRoute.value[key],
|
|
2602
|
+
enumerable: true
|
|
2603
|
+
});
|
|
2604
|
+
app.provide(routerKey, router$1);
|
|
2605
|
+
app.provide(routeLocationKey, shallowReactive(reactiveRoute));
|
|
2606
|
+
app.provide(routerViewLocationKey, currentRoute);
|
|
2607
|
+
const unmountApp = app.unmount;
|
|
2608
|
+
installedApps.add(app);
|
|
2609
|
+
app.unmount = function() {
|
|
2610
|
+
installedApps.delete(app);
|
|
2611
|
+
if (installedApps.size < 1) {
|
|
2612
|
+
pendingLocation = START_LOCATION_NORMALIZED;
|
|
2613
|
+
removeHistoryListener && removeHistoryListener();
|
|
2614
|
+
removeHistoryListener = null;
|
|
2615
|
+
currentRoute.value = START_LOCATION_NORMALIZED;
|
|
2616
|
+
started = false;
|
|
2617
|
+
ready = false;
|
|
2618
|
+
}
|
|
2619
|
+
unmountApp();
|
|
2620
|
+
};
|
|
2621
|
+
}
|
|
2622
|
+
};
|
|
2623
|
+
function runGuardQueue(guards) {
|
|
2624
|
+
return guards.reduce((promise, guard) => promise.then(() => runWithContext(guard)), Promise.resolve());
|
|
2625
|
+
}
|
|
2626
|
+
return router;
|
|
2627
|
+
}
|
|
2628
|
+
function extractChangingRecords(to, from) {
|
|
2629
|
+
const leavingRecords = [];
|
|
2630
|
+
const updatingRecords = [];
|
|
2631
|
+
const enteringRecords = [];
|
|
2632
|
+
const len = Math.max(from.matched.length, to.matched.length);
|
|
2633
|
+
for (let i$1 = 0; i$1 < len; i$1++) {
|
|
2634
|
+
const recordFrom = from.matched[i$1];
|
|
2635
|
+
if (recordFrom) if (to.matched.find((record) => isSameRouteRecord(record, recordFrom))) updatingRecords.push(recordFrom);
|
|
2636
|
+
else leavingRecords.push(recordFrom);
|
|
2637
|
+
const recordTo = to.matched[i$1];
|
|
2638
|
+
if (recordTo) {
|
|
2639
|
+
if (!from.matched.find((record) => isSameRouteRecord(record, recordTo))) enteringRecords.push(recordTo);
|
|
2640
|
+
}
|
|
2641
|
+
}
|
|
2642
|
+
return [
|
|
2643
|
+
leavingRecords,
|
|
2644
|
+
updatingRecords,
|
|
2645
|
+
enteringRecords
|
|
2646
|
+
];
|
|
2647
|
+
}
|
|
2648
|
+
function useRouter() {
|
|
2649
|
+
return inject(routerKey);
|
|
2650
|
+
}
|
|
2651
|
+
function useRoute(_name) {
|
|
2652
|
+
return inject(routeLocationKey);
|
|
2653
|
+
}
|
|
2654
|
+
var require_isSymbol = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2655
|
+
var baseGetTag = require__baseGetTag(), isObjectLike = require_isObjectLike();
|
|
2656
|
+
var symbolTag = "[object Symbol]";
|
|
2657
|
+
function isSymbol$3(value) {
|
|
2658
|
+
return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
|
|
2659
|
+
}
|
|
2660
|
+
module.exports = isSymbol$3;
|
|
2661
|
+
}));
|
|
2662
|
+
var require__isKey = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2663
|
+
var isArray$2 = require_isArray(), isSymbol$2 = require_isSymbol();
|
|
2664
|
+
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/;
|
|
2665
|
+
function isKey$1(value, object) {
|
|
2666
|
+
if (isArray$2(value)) return false;
|
|
2667
|
+
var type = typeof value;
|
|
2668
|
+
if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol$2(value)) return true;
|
|
2669
|
+
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
|
|
2670
|
+
}
|
|
2671
|
+
module.exports = isKey$1;
|
|
2672
|
+
}));
|
|
2673
|
+
var require_memoize = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2674
|
+
var MapCache = require__MapCache();
|
|
2675
|
+
var FUNC_ERROR_TEXT = "Expected a function";
|
|
2676
|
+
function memoize$1(func, resolver) {
|
|
2677
|
+
if (typeof func != "function" || resolver != null && typeof resolver != "function") throw new TypeError(FUNC_ERROR_TEXT);
|
|
2678
|
+
var memoized = function() {
|
|
2679
|
+
var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
|
|
2680
|
+
if (cache.has(key)) return cache.get(key);
|
|
2681
|
+
var result = func.apply(this, args);
|
|
2682
|
+
memoized.cache = cache.set(key, result) || cache;
|
|
2683
|
+
return result;
|
|
2684
|
+
};
|
|
2685
|
+
memoized.cache = new (memoize$1.Cache || MapCache)();
|
|
2686
|
+
return memoized;
|
|
2687
|
+
}
|
|
2688
|
+
memoize$1.Cache = MapCache;
|
|
2689
|
+
module.exports = memoize$1;
|
|
2690
|
+
}));
|
|
2691
|
+
var require__memoizeCapped = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2692
|
+
var memoize = require_memoize();
|
|
2693
|
+
var MAX_MEMOIZE_SIZE = 500;
|
|
2694
|
+
function memoizeCapped$1(func) {
|
|
2695
|
+
var result = memoize(func, function(key) {
|
|
2696
|
+
if (cache.size === MAX_MEMOIZE_SIZE) cache.clear();
|
|
2697
|
+
return key;
|
|
2698
|
+
});
|
|
2699
|
+
var cache = result.cache;
|
|
2700
|
+
return result;
|
|
2701
|
+
}
|
|
2702
|
+
module.exports = memoizeCapped$1;
|
|
2703
|
+
}));
|
|
2704
|
+
var require__stringToPath = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2705
|
+
var memoizeCapped = require__memoizeCapped();
|
|
2706
|
+
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
|
2707
|
+
var reEscapeChar = /\\(\\)?/g;
|
|
2708
|
+
module.exports = memoizeCapped(function(string) {
|
|
2709
|
+
var result = [];
|
|
2710
|
+
if (string.charCodeAt(0) === 46) result.push("");
|
|
2711
|
+
string.replace(rePropName, function(match, number, quote, subString) {
|
|
2712
|
+
result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
|
|
2713
|
+
});
|
|
2714
|
+
return result;
|
|
2715
|
+
});
|
|
2716
|
+
}));
|
|
2717
|
+
var require__arrayMap = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2718
|
+
function arrayMap$1(array, iteratee) {
|
|
2719
|
+
var index = -1, length = array == null ? 0 : array.length, result = Array(length);
|
|
2720
|
+
while (++index < length) result[index] = iteratee(array[index], index, array);
|
|
2721
|
+
return result;
|
|
2722
|
+
}
|
|
2723
|
+
module.exports = arrayMap$1;
|
|
2724
|
+
}));
|
|
2725
|
+
var require__baseToString = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2726
|
+
var Symbol$1 = require__Symbol(), arrayMap = require__arrayMap(), isArray$1 = require_isArray(), isSymbol$1 = require_isSymbol();
|
|
2727
|
+
var INFINITY$1 = Infinity;
|
|
2728
|
+
var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0, symbolToString = symbolProto ? symbolProto.toString : void 0;
|
|
2729
|
+
function baseToString$1(value) {
|
|
2730
|
+
if (typeof value == "string") return value;
|
|
2731
|
+
if (isArray$1(value)) return arrayMap(value, baseToString$1) + "";
|
|
2732
|
+
if (isSymbol$1(value)) return symbolToString ? symbolToString.call(value) : "";
|
|
2733
|
+
var result = value + "";
|
|
2734
|
+
return result == "0" && 1 / value == -INFINITY$1 ? "-0" : result;
|
|
2735
|
+
}
|
|
2736
|
+
module.exports = baseToString$1;
|
|
2737
|
+
}));
|
|
2738
|
+
var require_toString = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2739
|
+
var baseToString = require__baseToString();
|
|
2740
|
+
function toString$1(value) {
|
|
2741
|
+
return value == null ? "" : baseToString(value);
|
|
2742
|
+
}
|
|
2743
|
+
module.exports = toString$1;
|
|
2744
|
+
}));
|
|
2745
|
+
var require__castPath = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2746
|
+
var isArray = require_isArray(), isKey = require__isKey(), stringToPath = require__stringToPath(), toString = require_toString();
|
|
2747
|
+
function castPath$1(value, object) {
|
|
2748
|
+
if (isArray(value)) return value;
|
|
2749
|
+
return isKey(value, object) ? [value] : stringToPath(toString(value));
|
|
2750
|
+
}
|
|
2751
|
+
module.exports = castPath$1;
|
|
2752
|
+
}));
|
|
2753
|
+
var require__toKey = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2754
|
+
var isSymbol = require_isSymbol();
|
|
2755
|
+
var INFINITY = Infinity;
|
|
2756
|
+
function toKey$1(value) {
|
|
2757
|
+
if (typeof value == "string" || isSymbol(value)) return value;
|
|
2758
|
+
var result = value + "";
|
|
2759
|
+
return result == "0" && 1 / value == -INFINITY ? "-0" : result;
|
|
2760
|
+
}
|
|
2761
|
+
module.exports = toKey$1;
|
|
2762
|
+
}));
|
|
2763
|
+
var require__baseGet = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2764
|
+
var castPath = require__castPath(), toKey = require__toKey();
|
|
2765
|
+
function baseGet$1(object, path) {
|
|
2766
|
+
path = castPath(path, object);
|
|
2767
|
+
var index = 0, length = path.length;
|
|
2768
|
+
while (object != null && index < length) object = object[toKey(path[index++])];
|
|
2769
|
+
return index && index == length ? object : void 0;
|
|
2770
|
+
}
|
|
2771
|
+
module.exports = baseGet$1;
|
|
2772
|
+
}));
|
|
2773
|
+
var require_get = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2774
|
+
var baseGet = require__baseGet();
|
|
2775
|
+
function get(object, path, defaultValue) {
|
|
2776
|
+
var result = object == null ? void 0 : baseGet(object, path);
|
|
2777
|
+
return result === void 0 ? defaultValue : result;
|
|
2778
|
+
}
|
|
2779
|
+
module.exports = get;
|
|
2780
|
+
}));
|
|
2781
|
+
export { useRoute as _, require_toString as a, require__isKey as c, RouterView as d, createMemoryHistory as f, onBeforeRouteLeave as g, isNavigationFailure as h, require__castPath as i, require_isSymbol as l, createWebHistory as m, require__baseGet as n, require__arrayMap as o, createRouter as p, require__toKey as r, require_memoize as s, require_get as t, RouterLink as u, useRouter as v, require_lib as y };
|