@marimo-team/frontend 0.24.1-dev99 → 0.24.2-dev129
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/dist/assets/{CellStatus-wvvZkEPY.js → CellStatus-LoTwk7fR.js} +1 -1
- package/dist/assets/{ConnectedDataExplorerComponent-Dkqk66Mv.js → ConnectedDataExplorerComponent-DW6cJ-Lr.js} +1 -1
- package/dist/assets/{ErrorBoundary-npvnLp9x.js → ErrorBoundary-CDVGFYfr.js} +1 -1
- package/dist/assets/JsonOutput-CzIGPEZQ.js +50 -0
- package/dist/assets/{LazyAnyLanguageCodeMirror-zSwE3dvU.js → LazyAnyLanguageCodeMirror-LboTfNDv.js} +2 -2
- package/dist/assets/{MarimoErrorOutput-CeUo5oka.js → MarimoErrorOutput-DqpoYOvw.js} +1 -1
- package/dist/assets/RenderHTML-DwhMAd9l.js +1 -0
- package/dist/assets/{RunButton-BaV8A-z4.js → RunButton-BlpbweyH.js} +1 -1
- package/dist/assets/{VisuallyHidden-SChAyKIQ.js → VisuallyHidden-CBMDmozt.js} +1 -1
- package/dist/assets/{add-cell-with-ai-DoLkfzYn.js → add-cell-with-ai-R-3DS79K.js} +1 -1
- package/dist/assets/{add-connection-dialog-C1IF1nR0.js → add-connection-dialog-BGfpw5lC.js} +1 -1
- package/dist/assets/{agent-panel-CG154QrU.js → agent-panel-Cgt_K0tD.js} +1 -1
- package/dist/assets/ai-model-dropdown-DCmiuk7x.js +3 -0
- package/dist/assets/alert-dialog-CA-2mBs3.js +11 -0
- package/dist/assets/any-language-editor-DflLjPSQ.js +1 -0
- package/dist/assets/{app-config-button-ktBH1pEB.js → app-config-button-DUJC6b6x.js} +1 -1
- package/dist/assets/badge-BSgtkC2e.js +1 -0
- package/dist/assets/{blob-DVtvZmWH.js → blob-B2d_dHwI.js} +1 -1
- package/dist/assets/button-Dh8EwhsF.js +1 -0
- package/dist/assets/{cache-panel-C7jsiqCa.js → cache-panel-DqgtC98s.js} +1 -1
- package/dist/assets/{capabilities-LWzb3E3M.js → capabilities-D8kPgMKr.js} +1 -1
- package/dist/assets/{cell-editor-DoDqaCZp.js → cell-editor-Dw09J9yD.js} +6 -6
- package/dist/assets/{cell-link-Dqqt6Rgs.js → cell-link-6burT2XF.js} +1 -1
- package/dist/assets/{cells-D4RwofRx.js → cells-Cp-G34Rz.js} +56 -56
- package/dist/assets/{chat-display-COmzHgx5.js → chat-display-Bu405iyc.js} +1 -1
- package/dist/assets/{chat-panel-B2tyEfGW.js → chat-panel-BlUwNY5j.js} +1 -1
- package/dist/assets/{chat-ui-B5bsr-7V.js → chat-ui-DGiVDzNh.js} +1 -1
- package/dist/assets/{circle--ysFeW9z.js → circle-ByJdIf5p.js} +1 -1
- package/dist/assets/{column-preview-CW5DPFvy.js → column-preview-riSXbYe_.js} +1 -1
- package/dist/assets/{command-palette-B9dyvMvJ.js → command-palette-CCVzJcyf.js} +1 -1
- package/dist/assets/{common-CC3tuCpi.js → common-CHR7w7aQ.js} +1 -1
- package/dist/assets/{components-D02ZZZMP.js → components-C7mWrmXr.js} +1 -1
- package/dist/assets/{components-CBlGIIAX.js → components-DUYCXngU.js} +1 -1
- package/dist/assets/config-B-r81uZ6.js +1 -0
- package/dist/assets/{config-D4frVGQ4.js → config-BlNM0caL.js} +1 -1
- package/dist/assets/{copy-Cg05mM3C.js → copy-DlEomWzI.js} +1 -1
- package/dist/assets/{copy-icon-CRxVZTJ9.js → copy-icon-z8fuTE3w.js} +1 -1
- package/dist/assets/{createReducer-Bq-nQJiK.js → createReducer-B_XmHROl.js} +1 -1
- package/dist/assets/{datasource-Do8f2hFf.js → datasource-DrODSIs0.js} +1 -1
- package/dist/assets/{dates-DK5JikJo.js → dates-B58T85Jq.js} +1 -1
- package/dist/assets/dependency-graph-panel-AY5BEVH2.js +5 -0
- package/dist/assets/{dist-7qdHLg-L.js → dist-B0RXffUm.js} +1 -1
- package/dist/assets/dist-B0qYy1Ye.js +1 -0
- package/dist/assets/{dist-B97dKQGP.js → dist-B8pdsUrS.js} +1 -1
- package/dist/assets/{dist-BcfF-rkl.js → dist-BF7Lrekv.js} +1 -1
- package/dist/assets/dist-BL8RjfvI.js +1 -0
- package/dist/assets/dist-BVZxge7j.js +1 -0
- package/dist/assets/{dist-fxnYzq-R.js → dist-BaRNSaca.js} +1 -1
- package/dist/assets/dist-Bk2yQtw4.js +1 -0
- package/dist/assets/dist-BsfiiKoy.js +1 -0
- package/dist/assets/dist-BskmVd3B.js +1 -0
- package/dist/assets/{dist-DL1Thauf.js → dist-Bsu3h9O7.js} +1 -1
- package/dist/assets/{dist-PIe1xcZo.js → dist-BtC9ym6k.js} +7 -7
- package/dist/assets/{dist-DeuWxYVk.js → dist-Bv0S1RlZ.js} +1 -1
- package/dist/assets/{dist-CidBzUqR.js → dist-C--ZICxQ.js} +1 -1
- package/dist/assets/dist-C-2fD3XY.js +1 -0
- package/dist/assets/{dist-DzAWvPVK.js → dist-CKUpxYGQ.js} +1 -1
- package/dist/assets/dist-CMFMfBm1.js +1 -0
- package/dist/assets/dist-CZNULd6Z.js +2 -0
- package/dist/assets/dist-CjFduPiC.js +1 -0
- package/dist/assets/{dist-DoAjHgMj.js → dist-CmImLjus.js} +1 -1
- package/dist/assets/{dist-BKx0MLbb.js → dist-Cq8NOszX.js} +1 -1
- package/dist/assets/{dist-DCc0VfiO.js → dist-Cx4BE7jC.js} +3 -3
- package/dist/assets/dist-D45ScydS.js +1 -0
- package/dist/assets/dist-D6dg87r7.js +1 -0
- package/dist/assets/dist-DEjfQLz0.js +1 -0
- package/dist/assets/{dist-BcYW-EJk.js → dist-DJOWOALB.js} +1 -1
- package/dist/assets/{dist-CxxZaSme.js → dist-DPoYlxSC.js} +1 -1
- package/dist/assets/dist-DR-Y-nl3.js +1 -0
- package/dist/assets/dist-Dahlp9JQ.js +1 -0
- package/dist/assets/{dist-DIkuvChK.js → dist-Db-HC93w.js} +1 -1
- package/dist/assets/{dist-DTM7BAUu.js → dist-DdOlZ6mj.js} +1 -1
- package/dist/assets/{dist-Dz_04liz.js → dist-DiYjQAhI.js} +1 -1
- package/dist/assets/{dist-BO5c5n_b.js → dist-DkPPv0FB.js} +1 -1
- package/dist/assets/{dist-DkCO0b-0.js → dist-DmGtPaVM.js} +1 -1
- package/dist/assets/{dist-CXmhxecl.js → dist-DnxYYyU7.js} +1 -1
- package/dist/assets/{dist-CO1Hfv5H.js → dist-Dw9YRsCU.js} +1 -1
- package/dist/assets/dist-Dwx3KdUP.js +1 -0
- package/dist/assets/{dist-BgL43w5r.js → dist-DzCQtGkt.js} +1 -1
- package/dist/assets/dist-JweaDt6P.js +1 -0
- package/dist/assets/{dist-Dbu5sPgR.js → dist-gELFCfHH.js} +1 -1
- package/dist/assets/dist-kGDJ0AWF.js +1 -0
- package/dist/assets/{dist-Cqm1W-Zm.js → dist-kaLvV_d4.js} +1 -1
- package/dist/assets/{dist-CEeRVpMD.js → dist-qvk3g06H.js} +1 -1
- package/dist/assets/dist-wCw2twuB.js +1 -0
- package/dist/assets/dist-wF42tUcr.js +1 -0
- package/dist/assets/dist-wY2yia-1.js +3 -0
- package/dist/assets/{documentation-panel-DvHjxlli.js → documentation-panel-CaJF7e-j.js} +1 -1
- package/dist/assets/{download-BP8MrprC.js → download-DMxOzI7b.js} +1 -1
- package/dist/assets/dropdown-menu-C40jM9o4.js +1 -0
- package/dist/assets/{edit-page-71cK-Nhe.js → edit-page-Vqd9NedM.js} +6 -6
- package/dist/assets/{error-banner-BYN8YUMe.js → error-banner-Dw5YY9wq.js} +1 -1
- package/dist/assets/{error-entries-DOZ1u97X.js → error-entries-Cv2m1yhc.js} +1 -1
- package/dist/assets/{error-panel-CINcf76Z.js → error-panel-Bhlvt6_H.js} +1 -1
- package/dist/assets/{es-BuMFDpR4.js → es-CrFhA96G.js} +1 -1
- package/dist/assets/{esm-Dw0vvSg2.js → esm-BHMOvJzM.js} +1 -1
- package/dist/assets/{esm-BGpfQNhD.js → esm-DmqQGMel.js} +1 -1
- package/dist/assets/file-explorer-panel-6HvNfCrJ.js +1 -0
- package/dist/assets/{file-icons-DgKj9mrV.js → file-icons-DdGYuADJ.js} +1 -1
- package/dist/assets/file-name-input-K4MKESI_.js +3 -0
- package/dist/assets/{floating-outline-CRXIsrPm.js → floating-outline-DaUHnl_e.js} +1 -1
- package/dist/assets/{formats-DSzGCKeO.js → formats-C6s96nu2.js} +1 -1
- package/dist/assets/{formatting-BJlT1s_3.js → formatting-BWZH2nBg.js} +1 -1
- package/dist/assets/{fullscreen-0EEPR7uc.js → fullscreen-BH2jz-F4.js} +5 -5
- package/dist/assets/{gallery-page-TqnFYECu.js → gallery-page-C3pBpHlY.js} +1 -1
- package/dist/assets/{glide-data-editor-DcY3nXI8.js → glide-data-editor-sICUMEhk.js} +1 -1
- package/dist/assets/{glide-utils-CR1sWLZU.js → glide-utils-UGsrRHYj.js} +1 -1
- package/dist/assets/home-page-BLd6rnbk.js +4 -0
- package/dist/assets/{html-to-image-DMn_7CCA.js → html-to-image-D6GUC5q6.js} +1 -1
- package/dist/assets/index-BGT7have.css +2 -0
- package/dist/assets/index-ipFYAeCF.js +29 -0
- package/dist/assets/{input-Daz6sk8l.js → input-DEbY281O.js} +2 -2
- package/dist/assets/{kiosk-mode-CzGt3mc2.js → kiosk-mode-mxgb5lWf.js} +1 -1
- package/dist/assets/{layout-KJMQADEj.js → layout-DWnrxIo2.js} +5 -5
- package/dist/assets/links-DLvOXyO_.js +1 -0
- package/dist/assets/{logs-panel-DFibPeCT.js → logs-panel-BGS2v3ba.js} +1 -1
- package/dist/assets/lua-1tNpM92n.js +1 -0
- package/dist/assets/{lua-CRIS5afH.js → lua-DXBxhmso.js} +1 -1
- package/dist/assets/{markdown-renderer-CdZX2MvM.js → markdown-renderer-BZKlbm2Q.js} +1 -1
- package/dist/assets/menu-items-BSRA2YI9.js +1 -0
- package/dist/assets/{mermaid-CeseGGnS.js → mermaid-l6lQkCib.js} +1 -1
- package/dist/assets/{name-cell-input-B-d5Jwh4.js → name-cell-input-BMCdK-el.js} +1 -1
- package/dist/assets/{numbers-DKurV_vq.js → numbers-Bc-r3jsC.js} +1 -1
- package/dist/assets/{outline-panel-D2Wk10hY.js → outline-panel-Dr5u73V6.js} +1 -1
- package/dist/assets/{packages-panel-CQsbxIlG.js → packages-panel-BdpRg9tX.js} +1 -1
- package/dist/assets/{pair-with-agent-modal-CNxmIMFM.js → pair-with-agent-modal-CbUFKJHP.js} +1 -1
- package/dist/assets/{panel-accordion-state-D6-FMXE2.js → panel-accordion-state-DjUTN7i5.js} +1 -1
- package/dist/assets/{panels-BgcK_4M7.js → panels-CWn0Yh1D.js} +1 -1
- package/dist/assets/process-output-Ck7-P_xp.js +1 -0
- package/dist/assets/{readonly-code-display-BvqLeUsJ.js → readonly-code-display--S2daDa6.js} +1 -1
- package/dist/assets/{readonly-python-code-GSN4D4sb.js → readonly-python-code-DpIyjHqY.js} +1 -1
- package/dist/assets/{renderShortcut-DK_OucLT.js → renderShortcut-X-CJUSM8.js} +1 -1
- package/dist/assets/{reveal-component-u9ED2diI.js → reveal-component-nZIAapoD.js} +1 -1
- package/dist/assets/{run-page-U5iuhyz8.js → run-page-9pl8qhQR.js} +1 -1
- package/dist/assets/{runs-BQTlv6Ja.js → runs-euHSzlw_.js} +1 -1
- package/dist/assets/{scratchpad-panel--YOR0kUB.js → scratchpad-panel-BleGt2KM.js} +1 -1
- package/dist/assets/{scroll-to-bottom-button-xua0e9rA.js → scroll-to-bottom-button-DufiYUD7.js} +1 -1
- package/dist/assets/{secrets-panel-CZPbFAZH.js → secrets-panel-D3BpDIgg.js} +1 -1
- package/dist/assets/select-nLt2y0Sw.js +1 -0
- package/dist/assets/{session-CEdta5_Q.js → session-Sz5nSFku.js} +1 -1
- package/dist/assets/session-panel-DRGPlL5J.js +1 -0
- package/dist/assets/{share-C2MPy_VX.js → share-CPtBiNgr.js} +1 -1
- package/dist/assets/{skeleton-CsceCAjw.js → skeleton-BKeh8hf3.js} +1 -1
- package/dist/assets/{snippets-panel-BxwHsPmW.js → snippets-panel-D5yy7kj0.js} +1 -1
- package/dist/assets/{spec-CUFquO6R.js → spec-DKsAmLTi.js} +1 -1
- package/dist/assets/{state-BqrF--O0.js → state-B6AklCzD.js} +1 -1
- package/dist/assets/{state-C2c3_VuY.js → state-B8XRqyFg.js} +1 -1
- package/dist/assets/{state-CHplO0zn.js → state-Di9TbuV9.js} +1 -1
- package/dist/assets/{strings-CpYReX2Q.js → strings-CReV1AYG.js} +1 -1
- package/dist/assets/{swiper-component-Bot7ehYH.js → swiper-component-5Kdi1-Gn.js} +1 -1
- package/dist/assets/{switch-CtH5Ct94.js → switch-DjXr9Y9D.js} +1 -1
- package/dist/assets/{tabs-c6mpccpH.js → tabs-Cy1qXLzH.js} +1 -1
- package/dist/assets/{terminal-C73iz1fU.js → terminal-CQAFGBfN.js} +1 -1
- package/dist/assets/{tooltip-Cwltdez8.js → tooltip-BG35uS_N.js} +1 -1
- package/dist/assets/{tooltip-D7dq6bnc.js → tooltip-BUtPzKB4.js} +1 -1
- package/dist/assets/{tracing-Dhq121dR.js → tracing-DNk3gmWv.js} +1 -1
- package/dist/assets/{tracing-panel-IKt1933_.js → tracing-panel-Yqazr6w_.js} +2 -2
- package/dist/assets/{tree-actions-DIfWonCA.js → tree-actions-CG5g7aUQ.js} +1 -1
- package/dist/assets/{useAddCell-BYrVaYfZ.js → useAddCell-DdB_uBif.js} +1 -1
- package/dist/assets/{useBoolean-ZU5StAbr.js → useBoolean-BXC4CItZ.js} +1 -1
- package/dist/assets/{useCellActionButton-DbXDs0MA.js → useCellActionButton-B31neI3m.js} +1 -1
- package/dist/assets/{useDebounce-Dulm61-t.js → useDebounce-DgpSQhrP.js} +1 -1
- package/dist/assets/{useDeleteCell-Wgcl3CRG.js → useDeleteCell-Bz49_cFj.js} +1 -1
- package/dist/assets/{useDependencyPanelTab-C5AU8GKL.js → useDependencyPanelTab-C_ps0r--.js} +1 -1
- package/dist/assets/{useEventListener-D27Dii_l.js → useEventListener-92uWqz-P.js} +1 -1
- package/dist/assets/{useIframeCapabilities-DEpTCh1Q.js → useIframeCapabilities-C7Di8f2y.js} +1 -1
- package/dist/assets/{useInstallPackage-u7d0wo79.js → useInstallPackage-DsD08SLK.js} +1 -1
- package/dist/assets/{useInterval-B1_J4wdT.js → useInterval-B4v7_zd0.js} +1 -1
- package/dist/assets/{useNotebookActions-FuMERtHq.js → useNotebookActions-CQtbk9CB.js} +2 -2
- package/dist/assets/{useRunCells-DTdMRbkE.js → useRunCells-CX7oW5zy.js} +1 -1
- package/dist/assets/{useSplitCell-2z0zEB8X.js → useSplitCell-Dy2_DmJR.js} +1 -1
- package/dist/assets/{useTheme-CF-zG9YH.js → useTheme-C-ri8BtY.js} +1 -1
- package/dist/assets/utils-D5Ywm7-q.js +1 -0
- package/dist/assets/{vega-component-BSXJcTJb.js → vega-component-C7TCzyaU.js} +1 -1
- package/dist/assets/write-secret-modal-D6zoZgLY.js +2 -0
- package/dist/index.html +73 -73
- package/package.json +26 -26
- package/src/components/ai/ai-provider-icon.tsx +2 -2
- package/src/components/ai/ai-utils.ts +1 -1
- package/src/components/app-config/ai-config.tsx +33 -37
- package/src/components/app-config/user-config-form.tsx +1 -1
- package/src/components/data-table/__tests__/column-explorer.test.tsx +64 -4
- package/src/components/data-table/__tests__/column-visibility-dropdown.test.tsx +137 -4
- package/src/components/data-table/__tests__/url-detector.test.tsx +1 -1
- package/src/components/data-table/__tests__/useColumnVisibility.test.ts +153 -1
- package/src/components/data-table/column-explorer-panel/column-explorer.tsx +54 -25
- package/src/components/data-table/column-visibility-dropdown.tsx +62 -14
- package/src/components/data-table/date-popover.tsx +2 -1
- package/src/components/data-table/hooks/use-column-visibility.ts +76 -0
- package/src/components/data-table/renderers.tsx +4 -8
- package/src/components/data-table/show-only-column-button.tsx +58 -0
- package/src/components/dependency-graph/__tests__/elements.test.ts +151 -0
- package/src/components/dependency-graph/custom-edge.tsx +68 -0
- package/src/components/dependency-graph/custom-node.tsx +54 -26
- package/src/components/dependency-graph/dependency-graph-tree.tsx +110 -21
- package/src/components/dependency-graph/elements.ts +225 -31
- package/src/components/dependency-graph/panels.tsx +23 -2
- package/src/components/dependency-graph/utils/__tests__/layout.test.ts +78 -0
- package/src/components/dependency-graph/utils/layout.ts +108 -18
- package/src/components/editor/Output.tsx +40 -0
- package/src/components/editor/__tests__/Output.test.tsx +85 -2
- package/src/components/editor/connections/secret-combobox.tsx +3 -1
- package/src/components/editor/file-tree/__tests__/file-explorer-navigation.test.tsx +832 -0
- package/src/components/editor/file-tree/__tests__/file-viewer.test.tsx +27 -0
- package/src/components/editor/file-tree/__tests__/requesting-tree.test.ts +130 -0
- package/src/components/editor/file-tree/file-browser-row.tsx +82 -0
- package/src/components/editor/file-tree/file-explorer.tsx +377 -159
- package/src/components/editor/file-tree/file-operations.tsx +1 -1
- package/src/components/editor/file-tree/file-search-results.tsx +142 -0
- package/src/components/editor/file-tree/file-tree-row.tsx +40 -0
- package/src/components/editor/file-tree/file-viewer.tsx +2 -1
- package/src/components/editor/file-tree/renderers.tsx +4 -2
- package/src/components/editor/file-tree/requesting-tree.tsx +162 -32
- package/src/components/editor/file-tree/use-file-search.ts +142 -0
- package/src/components/editor/file-tree/use-hover-expand.ts +34 -0
- package/src/components/editor/navigation/__tests__/navigation.test.ts +30 -0
- package/src/components/editor/navigation/navigation.ts +20 -0
- package/src/components/forms/form.tsx +6 -4
- package/src/components/home/components.tsx +1 -0
- package/src/components/static-html/share-modal.tsx +3 -2
- package/src/components/ui/__tests__/badge.test.ts +63 -0
- package/src/components/ui/__tests__/button.test.ts +19 -0
- package/src/components/ui/__tests__/fullscreen.test.tsx +88 -0
- package/src/components/ui/__tests__/menu-items.test.ts +31 -0
- package/src/components/ui/badge.tsx +9 -7
- package/src/components/ui/button.tsx +1 -0
- package/src/components/ui/combobox.tsx +1 -1
- package/src/components/ui/date-input.tsx +1 -1
- package/src/components/ui/dialog.tsx +3 -1
- package/src/components/ui/fullscreen.tsx +43 -1
- package/src/components/ui/input.tsx +5 -1
- package/src/components/ui/links.tsx +2 -1
- package/src/components/ui/menu-items.tsx +9 -9
- package/src/components/ui/native-select.tsx +2 -2
- package/src/components/ui/navigation.tsx +1 -1
- package/src/components/ui/range-slider.tsx +5 -3
- package/src/components/ui/select.tsx +1 -1
- package/src/components/ui/sheet.tsx +1 -1
- package/src/components/ui/toast.tsx +8 -5
- package/src/components/ui/toaster.tsx +2 -2
- package/src/core/ai/ids/__tests__/ids.test.ts +0 -8
- package/src/core/ai/ids/ids.ts +1 -1
- package/src/core/cells/__tests__/add-missing-import.test.ts +20 -0
- package/src/core/codemirror/language/__tests__/utils.test.ts +1 -1
- package/src/core/config/config-schema.ts +1 -0
- package/src/core/hotkeys/hotkeys.ts +5 -0
- package/src/core/network/__tests__/requests-toasting.test.tsx +14 -0
- package/src/core/network/requests-toasting.tsx +1 -1
- package/src/css/globals.css +28 -0
- package/src/hooks/useEventListener.ts +1 -1
- package/src/plugins/core/RenderHTML.tsx +6 -4
- package/src/plugins/impl/MatrixPlugin.tsx +1 -1
- package/src/plugins/impl/code/any-language-editor.tsx +7 -4
- package/src/plugins/impl/data-frames/__tests__/schema.test.ts +34 -1
- package/src/plugins/impl/data-frames/forms/__tests__/__snapshots__/form.test.tsx.snap +25 -25
- package/src/plugins/impl/data-frames/schema.ts +5 -11
- package/src/plugins/impl/panel/__tests__/utils.test.ts +4 -4
- package/src/plugins/impl/vega/__tests__/vega.test.ts +1 -1
- package/src/stories/cell.stories.tsx +15 -11
- package/src/utils/__tests__/events.test.ts +1 -1
- package/dist/assets/JsonOutput-CRLQQVKf.js +0 -50
- package/dist/assets/RenderHTML-YkwVPe9V.js +0 -1
- package/dist/assets/ai-model-dropdown-CrSrb8Zz.js +0 -3
- package/dist/assets/alert-dialog-BVi_GyOB.js +0 -11
- package/dist/assets/any-language-editor-BL8H-DwB.js +0 -1
- package/dist/assets/badge-D_-uqy2N.js +0 -1
- package/dist/assets/button-Btj6GXNy.js +0 -1
- package/dist/assets/config-ycxJQP2b.js +0 -1
- package/dist/assets/dependency-graph-panel-Dg-tUB9T.js +0 -5
- package/dist/assets/dist-2oRmY-BC.js +0 -1
- package/dist/assets/dist-8lhGoJ54.js +0 -3
- package/dist/assets/dist-B4QaGCvF.js +0 -1
- package/dist/assets/dist-B_ABJVTW.js +0 -1
- package/dist/assets/dist-Bke0Ybxy.js +0 -1
- package/dist/assets/dist-Bw8CAY5i.js +0 -1
- package/dist/assets/dist-BwmO3SSk.js +0 -1
- package/dist/assets/dist-C3KxgR0m.js +0 -1
- package/dist/assets/dist-CLE562nZ.js +0 -1
- package/dist/assets/dist-CLi0j3bw.js +0 -1
- package/dist/assets/dist-CMIyXejt.js +0 -1
- package/dist/assets/dist-CbQrIaPV.js +0 -2
- package/dist/assets/dist-CpgfIIzU.js +0 -1
- package/dist/assets/dist-D7aYPqs9.js +0 -1
- package/dist/assets/dist-DKCF5R0T.js +0 -1
- package/dist/assets/dist-DbFa9cik.js +0 -1
- package/dist/assets/dist-DdPuhs_-.js +0 -1
- package/dist/assets/dist-DkfdZExz.js +0 -1
- package/dist/assets/dist-hOh6JBwi.js +0 -1
- package/dist/assets/dist-mY1j_5eA.js +0 -1
- package/dist/assets/dist-tg3aVnpD.js +0 -1
- package/dist/assets/dropdown-menu-CqNabM1f.js +0 -1
- package/dist/assets/file-explorer-panel-cflxW8a7.js +0 -1
- package/dist/assets/file-name-input-CQF4Ovwx.js +0 -3
- package/dist/assets/home-page-DPRHPAQM.js +0 -4
- package/dist/assets/index-BkIXRAbi.css +0 -2
- package/dist/assets/index-p49fbIlR.js +0 -29
- package/dist/assets/links-DPh7yoP-.js +0 -1
- package/dist/assets/lua-_4wuYo1j.js +0 -1
- package/dist/assets/menu-items-BSVrMleU.js +0 -1
- package/dist/assets/process-output-DvTtgoMs.js +0 -1
- package/dist/assets/select-czJLm6jf.js +0 -1
- package/dist/assets/session-panel-C_N3WGWQ.js +0 -1
- package/dist/assets/utils-CWSZQEjr.js +0 -1
- package/dist/assets/write-secret-modal-lNU_7c2x.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,i as t,n,r,t as i}from"./rolldown-runtime-B0Z9INg1.js";import{f as a,l as o,p as s,s as c}from"./useEvent-xfs0Sn4r.js";import{t as l}from"./react-CBDbhulC.js";import{t as u}from"./compiler-runtime-CYIjoINj.js";import{g as d}from"./useEventListener-D27Dii_l.js";import{t as f}from"./objects-snlMn4yk.js";import{t as p}from"./invariant-Ci2dTZ72.js";import{t as m}from"./cn-ldLVeaqm.js";import{t as h}from"./jsx-runtime-B74pBk57.js";import{a as g,c as _,d as v,i as y,n as ee,o as b,r as x,s as te,t as S}from"./select-czJLm6jf.js";import{t as C}from"./tooltip-D7dq6bnc.js";import{t as w}from"./button-Btj6GXNy.js";import{t as T}from"./createReducer-Bq-nQJiK.js";import{t as ne}from"./strings-CpYReX2Q.js";import{t as E}from"./createLucideIcon-B7HeEoG2.js";import{t as D}from"./spec-CUFquO6R.js";import{a as O,i as k,o as A,r as re,t as ie}from"./useLifecycle-BUaJcygz.js";import{n as ae}from"./table-CUK1W5bI.js";import{t as oe}from"./useNumberFormatter-DHJ9s6Vk.js";import{t as se}from"./square-function-DkZweMAs.js";import{t as ce}from"./badge-D_-uqy2N.js";import{r as le}from"./useTheme-CF-zG9YH.js";import{t as ue}from"./useDateFormatter-BiqAQ-zI.js";import{n as de}from"./useAsyncData-Buhk-UgR.js";import{r as fe,t as pe}from"./tooltip-Cwltdez8.js";import{i as me,n as he}from"./react-vega-C3-Qk46W.js";import{n as ge}from"./error-banner-BYN8YUMe.js";import{t as _e}from"./utils-49LGK4zG.js";var ve=E(`chart-column-big`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`rect`,{x:`15`,y:`5`,width:`4`,height:`12`,rx:`1`,key:`q8uenq`}],[`rect`,{x:`7`,y:`8`,width:`4`,height:`9`,rx:`1`,key:`sr5ea`}]]),ye=E(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]),be=u();function xe(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}var Se=i(((e,t)=>{var n=(function(){function e(e,t){return t!=null&&e instanceof t}var t;try{t=Map}catch{t=function(){}}var n;try{n=Set}catch{n=function(){}}var r;try{r=Promise}catch{r=function(){}}function i(a,o,s,c,u){typeof o==`object`&&(s=o.depth,c=o.prototype,u=o.includeNonEnumerable,o=o.circular);var d=[],f=[],p=typeof Buffer<`u`;o===void 0&&(o=!0),s===void 0&&(s=1/0);function m(a,s){if(a===null)return null;if(s===0)return a;var h,g;if(typeof a!=`object`)return a;if(e(a,t))h=new t;else if(e(a,n))h=new n;else if(e(a,r))h=new r(function(e,t){a.then(function(t){e(m(t,s-1))},function(e){t(m(e,s-1))})});else if(i.__isArray(a))h=[];else if(i.__isRegExp(a))h=new RegExp(a.source,l(a)),a.lastIndex&&(h.lastIndex=a.lastIndex);else if(i.__isDate(a))h=new Date(a.getTime());else if(p&&Buffer.isBuffer(a))return h=Buffer.allocUnsafe?Buffer.allocUnsafe(a.length):new Buffer(a.length),a.copy(h),h;else e(a,Error)?h=Object.create(a):c===void 0?(g=Object.getPrototypeOf(a),h=Object.create(g)):(h=Object.create(c),g=c);if(o){var _=d.indexOf(a);if(_!=-1)return f[_];d.push(a),f.push(h)}for(var v in e(a,t)&&a.forEach(function(e,t){var n=m(t,s-1),r=m(e,s-1);h.set(n,r)}),e(a,n)&&a.forEach(function(e){var t=m(e,s-1);h.add(t)}),a){var y;g&&(y=Object.getOwnPropertyDescriptor(g,v)),!(y&&y.set==null)&&(h[v]=m(a[v],s-1))}if(Object.getOwnPropertySymbols)for(var ee=Object.getOwnPropertySymbols(a),v=0;v<ee.length;v++){var b=ee[v],x=Object.getOwnPropertyDescriptor(a,b);x&&!x.enumerable&&!u||(h[b]=m(a[b],s-1),x.enumerable||Object.defineProperty(h,b,{enumerable:!1}))}if(u)for(var te=Object.getOwnPropertyNames(a),v=0;v<te.length;v++){var S=te[v],x=Object.getOwnPropertyDescriptor(a,S);x&&x.enumerable||(h[S]=m(a[S],s-1),Object.defineProperty(h,S,{enumerable:!1}))}return h}return m(a,s)}i.clonePrototype=function(e){if(e===null)return null;var t=function(){};return t.prototype=e,new t};function a(e){return Object.prototype.toString.call(e)}i.__objToStr=a;function o(e){return typeof e==`object`&&a(e)===`[object Date]`}i.__isDate=o;function s(e){return typeof e==`object`&&a(e)===`[object Array]`}i.__isArray=s;function c(e){return typeof e==`object`&&a(e)===`[object RegExp]`}i.__isRegExp=c;function l(e){var t=``;return e.global&&(t+=`g`),e.ignoreCase&&(t+=`i`),e.multiline&&(t+=`m`),t}return i.__getRegExpFlags=l,i})();typeof t==`object`&&t.exports&&(t.exports=n)})),Ce=i(((e,t)=>{var n=Array.isArray,r=Object.keys,i=Object.prototype.hasOwnProperty;t.exports=function e(t,a){if(t===a)return!0;if(t&&a&&typeof t==`object`&&typeof a==`object`){var o=n(t),s=n(a),c,l,u;if(o&&s){if(l=t.length,l!=a.length)return!1;for(c=l;c--!==0;)if(!e(t[c],a[c]))return!1;return!0}if(o!=s)return!1;var d=t instanceof Date,f=a instanceof Date;if(d!=f)return!1;if(d&&f)return t.getTime()==a.getTime();var p=t instanceof RegExp,m=a instanceof RegExp;if(p!=m)return!1;if(p&&m)return t.toString()==a.toString();var h=r(t);if(l=h.length,l!==r(a).length)return!1;for(c=l;c--!==0;)if(!i.call(a,h[c]))return!1;for(c=l;c--!==0;)if(u=h[c],!e(t[u],a[u]))return!1;return!0}return t!==t&&a!==a}})),we=i(((e,t)=>{t.exports=function(e,t){t||={},typeof t==`function`&&(t={cmp:t});var n=typeof t.cycles==`boolean`&&t.cycles,r=t.cmp&&(function(e){return function(t){return function(n,r){return e({key:n,value:t[n]},{key:r,value:t[r]})}}})(t.cmp),i=[];return(function e(t){if(t&&t.toJSON&&typeof t.toJSON==`function`&&(t=t.toJSON()),t!==void 0){if(typeof t==`number`)return isFinite(t)?``+t:`null`;if(typeof t!=`object`)return JSON.stringify(t);var a,o;if(Array.isArray(t)){for(o=`[`,a=0;a<t.length;a++)a&&(o+=`,`),o+=e(t[a])||`null`;return o+`]`}if(t===null)return`null`;if(i.indexOf(t)!==-1){if(n)return JSON.stringify(`__cycle__`);throw TypeError(`Converting circular structure to JSON`)}var s=i.push(t)-1,c=Object.keys(t).sort(r&&r(t));for(o=``,a=0;a<c.length;a++){var l=c[a],u=e(t[l]);u&&(o&&(o+=`,`),o+=JSON.stringify(l)+`:`+u)}return i.splice(s,1),`{`+o+`}`}})(e)}}));Se(),Ce();var Te=e(we());function Ee(e,t,n){return e.fields=t||[],e.fname=n,e}function De(e){throw Error(e)}function Oe(e){var t=[],n=null,r=0,i=e.length,a=``,o,s,c;e+=``;function l(){t.push(a+e.substring(o,s)),a=``,o=s+1}for(o=s=0;s<i;++s)if(c=e[s],c===`\\`)a+=e.substring(o,s),o=++s;else if(c===n)l(),n=null,r=-1;else if(n)continue;else o===r&&c===`"`||o===r&&c===`'`?(o=s+1,n=c):c===`.`&&!r?s>o?l():o=s+1:c===`[`?(s>o&&l(),r=o=s+1):c===`]`&&(r||De(`Access path missing open bracket: `+e),r>0&&l(),r=0,o=s+1);return r&&De(`Access path missing closing bracket: `+e),n&&De(`Access path missing closing quote: `+e),s>o&&(s++,l()),t}var ke=Array.isArray;function Ae(e){return e===Object(e)}function je(e){return typeof e==`string`}function Me(e){return ke(e)?`[`+e.map(Me)+`]`:Ae(e)||je(e)?JSON.stringify(e).replace(`\u2028`,`\\u2028`).replace(`\u2029`,`\\u2029`):e}function Ne(e,t){var n=Oe(e),r=`return _[`+n.map(Me).join(`][`)+`];`;return Ee(Function(`_`,r),[e=n.length===1?n[0]:e],t||e)}var Pe=[];Ne(`id`),Ee(function(e){return e},Pe,`identity`),Ee(function(){return 0},Pe,`zero`),Ee(function(){return 1},Pe,`one`),Ee(function(){return!0},Pe,`true`),Ee(function(){return!1},Pe,`false`);function Fe(e,t,n){var r=[t].concat([].slice.call(n));console[e](...r)}function Ie(e,t){var n=e||0;return{level:function(e){return arguments.length?(n=+e,this):n},error:function(){return n>=1&&Fe(t||`error`,`ERROR`,arguments),this},warn:function(){return n>=2&&Fe(t||`warn`,`WARN`,arguments),this},info:function(){return n>=3&&Fe(t||`log`,`INFO`,arguments),this},debug:function(){return n>=4&&Fe(t||`log`,`DEBUG`,arguments),this}}}function Le(e){return typeof e==`boolean`}function Re(e){for(var t={},n=0,r=e.length;n<r;++n)t[e[n]]=!0;return t}Set.prototype.toJSON=function(){return`Set(${[...this].map(e=>(0,Te.default)(e)).join(`,`)})`};var j=Te.default;function M(e,t){return e.indexOf(t)>-1}function ze(e,t){let n=0;for(let[r,i]of e.entries())if(t(i,r,n++))return!0;return!1}var N=Object.keys;function Be(e){let t=e.replace(/\W/g,`_`);return(e.match(/^\d+/)?`_`:``)+t}function Ve(e,t=`datum`){return`${t}[${Me(Oe(e).join(`.`))}]`}function He(e){return`${Oe(e).map(e=>e.replace(`.`,`\\.`)).join(`\\.`)}`}function Ue(...e){for(let t of e)if(t!==void 0)return t}function We(e){return Ge(e)?e:`__${e}`}function Ge(e){return e.indexOf(`__`)===0}var Ke=`column`,qe=`facet`,Je=`latitude`,Ye=`longitude`,Xe=`latitude2`,Ze=`longitude2`,Qe=`color`,$e=`fill`,et=`stroke`,tt=`shape`,nt=`size`,rt=`opacity`,it=`fillOpacity`,at=`strokeOpacity`,ot=`strokeWidth`,st=`text`,ct=`order`,lt=`detail`,ut=`tooltip`,dt=`href`,ft={x:1,y:1,x2:1,y2:1},pt={longitude:1,longitude2:1,latitude:1,latitude2:1};N(pt);var mt=Object.assign({},ft,pt,{color:1,fill:1,stroke:1,opacity:1,fillOpacity:1,strokeOpacity:1,strokeWidth:1,size:1,shape:1,order:1,text:1,detail:1,key:1,tooltip:1,href:1});function ht(e){return e===`color`||e===`fill`||e===`stroke`}var gt={row:1,column:1,facet:1};N(gt);var _t=Object.assign({},mt,gt),vt=N(_t),{order:yt,detail:bt}=_t,xt=xe(_t,[`order`,`detail`]),{order:St,detail:Ct,row:wt,column:Tt,facet:Et}=_t,Dt=xe(_t,[`order`,`detail`,`row`,`column`,`facet`]);N(xt),N(Dt),N(mt);var{x:Ot,y:kt,x2:At,y2:jt,latitude:Mt,longitude:Nt,latitude2:Pt,longitude2:Ft}=mt,It=xe(mt,[`x`,`y`,`x2`,`y2`,`latitude`,`longitude`,`latitude2`,`longitude2`]),Lt=N(It),Rt={x:1,y:1};N(Rt);var{text:zt,tooltip:Bt,href:Vt,detail:Ht,key:Ut,order:Wt}=It,Gt=xe(It,[`text`,`tooltip`,`href`,`detail`,`key`,`order`]);N(Gt);var Kt=Object.assign({},Rt,Gt);N(Kt);function qt(e){return!!Kt[e]}function Jt(e,t){return Qt(e)[t]}var Yt={area:`always`,bar:`always`,circle:`always`,geoshape:`always`,line:`always`,rule:`always`,point:`always`,rect:`always`,square:`always`,trail:`always`,text:`always`,tick:`always`},{geoshape:Xt}=Yt,Zt=xe(Yt,[`geoshape`]);function Qt(e){switch(e){case Qe:case $e:case et:case lt:case`key`:case ut:case dt:case ct:case rt:case it:case at:case ot:case qe:case`row`:case Ke:return Yt;case`x`:case`y`:case Je:case Ye:return Zt;case`x2`:case`y2`:case Xe:case Ze:return{rule:`always`,bar:`always`,rect:`always`,area:`always`,circle:`binned`,point:`binned`,square:`binned`,tick:`binned`,line:`binned`,trail:`binned`};case nt:return{point:`always`,tick:`always`,rule:`always`,circle:`always`,square:`always`,bar:`always`,text:`always`,line:`always`,trail:`always`};case tt:return{point:`always`,geoshape:`always`};case st:return{text:`always`}}}function $t(e){switch(e){case`x`:case`y`:case nt:case ot:case rt:case it:case at:case`x2`:case`y2`:return;case qe:case`row`:case Ke:case tt:case st:case ut:case dt:return`discrete`;case Qe:case $e:case et:return`flexible`;case Je:case Ye:case Xe:case Ze:case lt:case`key`:case ct:return}throw Error(`rangeType not implemented for `+e)}var en={orient:1,bandPosition:1,domain:1,domainColor:1,domainDash:1,domainDashOffset:1,domainOpacity:1,domainWidth:1,format:1,formatType:1,grid:1,gridColor:1,gridDash:1,gridDashOffset:1,gridOpacity:1,gridWidth:1,labelAlign:1,labelAngle:1,labelBaseline:1,labelBound:1,labelColor:1,labelFlush:1,labelFlushOffset:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,labelSeparation:1,maxExtent:1,minExtent:1,offset:1,position:1,tickColor:1,tickCount:1,tickDash:1,tickDashOffset:1,tickExtra:1,tickMinStep:1,tickOffset:1,tickOpacity:1,tickRound:1,ticks:1,tickSize:1,tickWidth:1,title:1,titleAlign:1,titleAnchor:1,titleAngle:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleOpacity:1,titlePadding:1,titleX:1,titleY:1,values:1,zindex:1},tn=Object.assign({},en,{encoding:1});N(Object.assign({gridScale:1,scale:1},en,{encode:1}));var nn=N(tn),rn={clipHeight:1,columnPadding:1,columns:1,cornerRadius:1,direction:1,fillColor:1,format:1,formatType:1,gradientLength:1,gradientOpacity:1,gradientStrokeColor:1,gradientStrokeWidth:1,gradientThickness:1,gridAlign:1,labelAlign:1,labelBaseline:1,labelColor:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labelSeparation:1,legendX:1,legendY:1,offset:1,orient:1,padding:1,rowPadding:1,strokeColor:1,symbolDash:1,symbolDashOffset:1,symbolFillColor:1,symbolOffset:1,symbolOpacity:1,symbolSize:1,symbolStrokeColor:1,symbolStrokeWidth:1,symbolType:1,tickCount:1,tickMinStep:1,title:1,titleAlign:1,titleAnchor:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleOpacity:1,titleOrient:1,titlePadding:1,type:1,values:1,zindex:1},an=Object.assign({},rn,{opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,encode:1}),on=N(rn);N(an);var sn=r({BAR_WITH_POINT_SCALE_AND_RANGESTEP_NULL:()=>Hn,CANNOT_FIX_RANGE_STEP_WITH_FIT:()=>un,CANNOT_UNION_CUSTOM_DOMAIN_WITH_FIELD_DOMAIN:()=>Gn,CONCAT_CANNOT_SHARE_AXIS:()=>yn,FIT_NON_SINGLE:()=>ln,INVALID_CHANNEL_FOR_AXIS:()=>cr,INVALID_SPEC:()=>cn,LINE_WITH_VARYING_SIZE:()=>In,MORE_THAN_ONE_SORT:()=>sr,NO_FIELDS_NEEDS_AS:()=>wn,NO_INIT_SCALE_BINDINGS:()=>gn,REPEAT_CANNOT_SHARE_AXIS:()=>bn,SCALE_BINDINGS_CONTINUOUS:()=>hn,UNABLE_TO_MERGE_DOMAINS:()=>or,cannotApplySizeToNonOrientedMark:()=>Xn,cannotProjectOnChannelWithoutField:()=>dn,cannotStackNonLinearScale:()=>ur,cannotStackRangedMark:()=>lr,cannotUseScalePropertyWithNonColor:()=>Kn,channelRequiredForBinned:()=>br,columnsNotSupportByRowCol:()=>vn,dayReplacedWithDate:()=>pr,differentParse:()=>Sn,discreteChannelCannotEncode:()=>Vn,domainRequiredForThresholdScale:()=>xr,domainSortDropped:()=>ar,droppedDay:()=>mr,droppingColor:()=>Nn,emptyFieldDef:()=>Pn,encodingOverridden:()=>Tn,errorBand1DNotSupport:()=>yr,errorBarCenterAndExtentAreNotNeeded:()=>hr,errorBarCenterIsNotNeeded:()=>vr,errorBarCenterIsUsedWithWrongExtent:()=>gr,errorBarContinuousAxisHasCustomizedAggregate:()=>_r,facetChannelDropped:()=>Bn,facetChannelShouldBeDiscrete:()=>zn,incompatibleChannel:()=>Ln,independentScaleMeansIndependentGuide:()=>ir,invalidAggregate:()=>jn,invalidEncodingChannel:()=>Rn,invalidFieldType:()=>On,invalidFieldTypeForCountAggregate:()=>An,invalidTimeUnit:()=>fr,invalidTransformIgnored:()=>Cn,latLongDeprecated:()=>Fn,lineWithRange:()=>Un,mergeConflictingDomainProperty:()=>rr,mergeConflictingProperty:()=>nr,missingFieldType:()=>Mn,nearestNotSupportForContinuous:()=>fn,noSuchRepeatedValue:()=>_n,nonZeroScaleUsedWithLengthMark:()=>kn,orientOverridden:()=>Wn,primitiveChannelDef:()=>Dn,projectionOverridden:()=>En,rangeStepDropped:()=>Zn,scalePropertyNotWorkWithScaleType:()=>er,scaleTypeNotWorkWithChannel:()=>Qn,scaleTypeNotWorkWithFieldDef:()=>$n,scaleTypeNotWorkWithMark:()=>tr,selectionNotFound:()=>mn,selectionNotSupported:()=>pn,stackNonSummativeAggregate:()=>dr,unaggregateDomainHasNoEffectForRawField:()=>qn,unaggregateDomainWithNonSharedDomainOp:()=>Jn,unaggregatedDomainWithLogScale:()=>Yn,unrecognizedParse:()=>xn}),cn=`Invalid spec`,ln=`Autosize "fit" only works for single views and layered views.`,un=`Cannot use a fixed value of "rangeStep" when "autosize" is "fit".`;function dn(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`}function fn(e){return`The "nearest" transform is not supported for ${e} marks.`}function pn(e){return`Selection not supported for ${e} yet`}function mn(e){return`Cannot find a selection named "${e}"`}var hn=`Scale bindings are currently only supported for scales with unbinned, continuous domains.`,gn=`Selections bound to scales cannot be separately initialized.`;function _n(e){return`Unknown repeated value "${e}".`}function vn(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`}var yn=`Axes cannot be shared in concatenated views yet (https://github.com/vega/vega-lite/issues/2415).`,bn=`Axes cannot be shared in repeated views yet (https://github.com/vega/vega-lite/issues/2415).`;function xn(e){return`Unrecognized parse "${e}".`}function Sn(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`}function Cn(e){return`Ignoring an invalid transform: ${j(e)}.`}var wn=`If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.`;function Tn(e){return`Layer's shared ${e.join(`,`)} channel ${e.length===1?`is`:`are`} overriden`}function En(e){let{parentProjection:t,projection:n}=e;return`Layer's shared projection ${j(t)} is overridden by a child projection ${j(n)}.`}function Dn(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${j(n)}}.`}function On(e){return`Invalid field type "${e}"`}function kn(e,t,n){return`A ${n.scaleType?`${n.scaleType} scale`:n.zeroFalse?`scale with zero=false`:`scale with custom domain that excludes zero`} is used to encode ${e}'s ${t}. This can be misleading as the ${t===`x`?`width`:`height`} of the ${e} can be arbitrary based on the scale domain. You may want to use point mark instead.`}function An(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`}function jn(e){return`Invalid aggregation operator "${e}"`}function Mn(e,t){return`Missing type for channel "${e}", using "${t}" instead.`}function Nn(e,t){let{fill:n,stroke:r}=t;return`Dropping color ${e} as the plot also has `+(n&&r?`fill and stroke`:n?`fill`:`stroke`)}function Pn(e,t){return`Dropping ${j(e)} from channel "${t}" since it does not contain data field or value.`}function Fn(e,t,n){return`${e}-encoding with type ${t} is deprecated. Replacing with ${n}-encoding.`}var In=`Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.`;function Ln(e,t,n){return`${e} dropped as it is incompatible with "${t}"${n?` when ${n}`:``}.`}function Rn(e){return`${e}-encoding is dropped as ${e} is not a valid encoding channel.`}function zn(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`}function Bn(e){return`Facet encoding dropped as ${e.join(` and `)} ${e.length>1?`are`:`is`} also specified.`}function Vn(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${t===`ordinal`?`order`:`magnitude`}.`}var Hn=`Bar mark should not be used with point scale when rangeStep is null. Please use band scale instead.`;function Un(e,t){return`Line mark is for continuous lines and thus cannot be used with ${e&&t?`x2 and y2`:e?`x2`:`y2`}. We will use the rule mark (line segments) instead.`}function Wn(e,t){return`Specified orient "${e}" overridden with "${t}"`}var Gn=`custom domain scale cannot be unioned with default field-based domain`;function Kn(e){return`Cannot use the scale property "${e}" with non-color channel.`}function qn(e){return`Using unaggregated domain with raw field has no effect (${j(e)}).`}function Jn(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`}function Yn(e){return`Unaggregated domain is currently unsupported for log scale (${j(e)}).`}function Xn(e){return`Cannot apply size to non-oriented mark "${e}".`}function Zn(e){return`rangeStep for "${e}" is dropped as top-level ${e===`x`?`width`:`height`} is provided.`}function Qn(e,t,n){return`Channel "${e}" does not work with "${t}" scale. We are using "${n}" scale instead.`}function $n(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`}function er(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`}function tr(e,t){return`Scale type "${t}" does not work with mark "${e}".`}function nr(e,t,n,r){return`Conflicting ${t.toString()} property "${e.toString()}" (${j(n)} and ${j(r)}). Using ${j(n)}.`}function rr(e,t,n,r){return`Conflicting ${t.toString()} property "${e.toString()}" (${j(n)} and ${j(r)}). Using the union of the two domains.`}function ir(e){return`Setting the scale to be independent for "${e}" means we also have to set the guide (axis or legend) to be independent.`}function ar(e){return`Dropping sort property ${j(e)} as unioned domains only support boolean or op 'count'.`}var or=`Unable to merge domains`,sr=`Domains that should be unioned has conflicting sort properties. Sort will be set to true.`,cr=`Invalid channel for axis.`;function lr(e){return`Cannot stack "${e}" if there is already "${e}2"`}function ur(e){return`Cannot stack non-linear scale (${e})`}function dr(e){return`Stacking is applied even though the aggregate function is non-summative ("${e}")`}function fr(e,t){return`Invalid ${e}: ${j(t)}`}function pr(e){return`Time unit "${e}" is not supported. We are replacing it with ${e.replace(`day`,`date`)}.`}function mr(e){return`Dropping day from datetime ${j(e)} as day cannot be combined with other units.`}function hr(e,t){return`${t?`extent `:``}${t&&e?`and `:``}${e?`center `:``}${t&&e?`are `:`is `}not needed when data are aggregated.`}function gr(e,t,n){return`${e} is not usually used with ${t} for ${n}.`}function _r(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`}function vr(e,t){return`Center is not needed to be specified in ${t} when extent is ${e}.`}function yr(e){return`1D error band does not support ${e}`}function br(e){return`Channel ${e} is required for "binned" bin`}function xr(e){return`Domain for ${e} is required for threshold scale`}var Sr=sn,Cr=Ie(2);function wr(...e){Cr.warn.apply(Cr,arguments)}var Tr={quantitative:1,ordinal:1,temporal:1,nominal:1,geojson:1},P=`quantitative`,Er=`ordinal`,Dr=`temporal`,Or=`nominal`,kr=`geojson`;function Ar(e){if(e)switch(e=e.toLowerCase(),e){case`q`:case P:return`quantitative`;case`t`:case Dr:return`temporal`;case`o`:case Er:return`ordinal`;case`n`:case Or:return`nominal`;case kr:return`geojson`}}var F;(function(e){e.LINEAR=`linear`,e.LOG=`log`,e.POW=`pow`,e.SQRT=`sqrt`,e.SYMLOG=`symlog`,e.TIME=`time`,e.UTC=`utc`,e.QUANTILE=`quantile`,e.QUANTIZE=`quantize`,e.THRESHOLD=`threshold`,e.BIN_ORDINAL=`bin-ordinal`,e.ORDINAL=`ordinal`,e.POINT=`point`,e.BAND=`band`})(F||={});var jr=N({linear:`numeric`,log:`numeric`,pow:`numeric`,sqrt:`numeric`,symlog:`numeric`,time:`time`,utc:`time`,ordinal:`ordinal`,"bin-ordinal":`bin-ordinal`,point:`ordinal-position`,band:`ordinal-position`,quantile:`discretizing`,quantize:`discretizing`,threshold:`discretizing`}),Mr=[`linear`,`log`,`pow`,`sqrt`,`symlog`,`time`,`utc`],Nr=Re(Mr),Pr=Re([`quantile`,`quantize`,`threshold`]),Fr=Re(Mr.concat([`quantile`,`quantize`,`threshold`])),Ir=Re([`ordinal`,`bin-ordinal`,`point`,`band`]);function Lr(e){return e in Ir}function Rr(e){return e in Fr}function zr(e){return e in Nr}function Br(e){return e in Pr}var Vr={type:1,domain:1,align:1,range:1,rangeStep:1,scheme:1,bins:1,reverse:1,round:1,clamp:1,nice:1,base:1,exponent:1,constant:1,interpolate:1,zero:1,padding:1,paddingInner:1,paddingOuter:1},Hr=N(Vr),{type:Ur,domain:Wr,range:Gr,rangeStep:Kr,scheme:qr}=Vr;N(xe(Vr,[`type`,`domain`,`range`,`rangeStep`,`scheme`])),Qr();function Jr(e,t){switch(t){case`type`:case`domain`:case`reverse`:case`range`:return!0;case`scheme`:case`interpolate`:return!M([`point`,`band`,`identity`],e);case`bins`:return!M([`point`,`band`,`identity`,`ordinal`],e);case`round`:return zr(e)||e===`band`||e===`point`;case`padding`:return zr(e)||M([`point`,`band`],e);case`paddingOuter`:case`rangeStep`:case`align`:return M([`point`,`band`],e);case`paddingInner`:return e===`band`;case`clamp`:return zr(e);case`nice`:return zr(e)||e===`quantize`||e===`threshold`;case`exponent`:return e===`pow`;case`base`:return e===`log`;case`constant`:return e===`symlog`;case`zero`:return Rr(e)&&!M([`log`,`time`,`utc`,`threshold`,`quantile`],e)}}function Yr(e,t){switch(t){case`interpolate`:case`scheme`:return ht(e)?void 0:Sr.cannotUseScalePropertyWithNonColor(e);case`align`:case`type`:case`bins`:case`domain`:case`range`:case`base`:case`exponent`:case`constant`:case`nice`:case`padding`:case`paddingInner`:case`paddingOuter`:case`rangeStep`:case`reverse`:case`round`:case`clamp`:case`zero`:return}}function Xr(e,t){return M([`ordinal`,`nominal`],t)?e===void 0||Lr(e):t===`temporal`?M([F.TIME,F.UTC,void 0],e):t!==`quantitative`||M([F.LOG,F.POW,F.SQRT,F.SYMLOG,F.QUANTILE,F.QUANTIZE,F.THRESHOLD,F.LINEAR,void 0],e)}function Zr(e,t){switch(e){case`x`:case`y`:return zr(t)||M([`band`,`point`],t);case nt:case ot:case rt:case it:case at:return zr(t)||Br(t)||M([`band`,`point`],t);case Qe:case $e:case et:return t!==`band`;case tt:return t===`ordinal`}return!1}function Qr(){let e={};for(let t of vt)for(let n of N(Tr))for(let r of jr){let i=$r(t,n);Zr(t,r)&&Xr(r,n)&&(e[i]=e[i]||[],e[i].push(r))}return e}function $r(e,t){return e+`_`+t}var ei=i(((e,t)=>{var n=t.exports,r=`__name__`;n.namedfunc=function(e,t){return t[r]=e,t},n.name=function(e){return e==null?null:e[r]},n.identity=function(e){return e},n.true=n.namedfunc(`true`,function(){return!0}),n.false=n.namedfunc(`false`,function(){return!1}),n.duplicate=function(e){return JSON.parse(JSON.stringify(e))},n.equal=function(e,t){return JSON.stringify(e)===JSON.stringify(t)},n.extend=function(e){for(var t,n,r=1,i=arguments.length;r<i;++r)for(n in t=arguments[r],t)e[n]=t[n];return e},n.length=function(e){return e!=null&&e.length!=null?e.length:null},n.keys=function(e){var t=[],n;for(n in e)t.push(n);return t},n.vals=function(e){var t=[],n;for(n in e)t.push(e[n]);return t},n.toMap=function(e,t){return(t=n.$(t))?e.reduce(function(e,n){return e[t(n)]=1,e},{}):e.reduce(function(e,t){return e[t]=1,e},{})},n.keystr=function(e){var t=e.length;if(!t)return``;for(var n=String(e[0]),r=1;r<t;++r)n+=`|`+String(e[r]);return n};var i=Object.prototype.toString;n.isObject=function(e){return e===Object(e)},n.isFunction=function(e){return i.call(e)===`[object Function]`},n.isString=function(e){return typeof value==`string`||i.call(e)===`[object String]`},n.isArray=Array.isArray||function(e){return i.call(e)===`[object Array]`},n.isNumber=function(e){return typeof e==`number`||i.call(e)===`[object Number]`},n.isBoolean=function(e){return e===!0||e===!1||i.call(e)==`[object Boolean]`},n.isDate=function(e){return i.call(e)===`[object Date]`},n.isValid=function(e){return e!=null&&e===e},n.isBuffer=typeof Buffer==`function`&&Buffer.isBuffer||n.false,n.number=function(e){return e==null||e===``?null:+e},n.boolean=function(e){return e==null||e===``?null:e!==`false`&&!!e},n.date=function(e,t){return e==null||e===``?null:(t||Date).parse(e)},n.array=function(e){return e==null?[]:n.isArray(e)?e:[e]},n.str=function(e){return n.isArray(e)?`[`+e.map(n.str)+`]`:n.isObject(e)||n.isString(e)?JSON.stringify(e).replace(`\u2028`,`\\u2028`).replace(`\u2029`,`\\u2029`):e};var a=/\[(.*?)\]|[^.\[]+/g;n.field=function(e){return String(e).match(a).map(function(e){return e[0]===`[`?e[1]!==`'`&&e[1]!==`"`?e.slice(1,-1):e.slice(2,-2).replace(/\\(["'])/g,`$1`):e})},n.accessor=function(e){return e==null||n.isFunction(e)?e:n.namedfunc(e,Function(`x`,`return x[`+n.field(e).map(n.str).join(`][`)+`];`))},n.$=n.accessor,n.mutator=function(e){var t;return n.isString(e)&&(t=n.field(e)).length>1?function(e,n){for(var r=0;r<t.length-1;++r)e=e[t[r]];e[t[r]]=n}:function(t,n){t[e]=n}},n.$func=function(e,t){return function(r){r=n.$(r)||n.identity;var i=e+(n.name(r)?`_`+n.name(r):``);return n.namedfunc(i,function(e){return t(r(e))})}},n.$valid=n.$func(`valid`,n.isValid),n.$length=n.$func(`length`,n.length),n.$in=function(e,t){e=n.$(e);var r=n.isArray(t)?n.toMap(t):t;return function(t){return!!r[e(t)]}},n.comparator=function(e){var t=[];return e===void 0&&(e=[]),e=n.array(e).map(function(e){var r=1;return e[0]===`-`?(r=-1,e=e.slice(1)):e[0]===`+`&&(r=1,e=e.slice(1)),t.push(r),n.accessor(e)}),function(r,i){var a,o,s,c;for(a=0,o=e.length;a<o;++a)if(s=e[a],c=n.cmp(s(r),s(i)),c)return c*t[a];return 0}},n.cmp=function(e,t){return(e<t||e==null)&&t!=null?-1:(e>t||t==null)&&e!=null?1:(t=t instanceof Date?+t:t,(e=e instanceof Date?+e:e)!==e&&t===t?-1:+(t!==t&&e===e))},n.numcmp=function(e,t){return e-t},n.stablesort=function(e,t,n){var r=e.reduce(function(e,t,r){return e[n(t)]=r,e},{});return e.sort(function(e,i){var a=t(e),o=t(i);return a<o?-1:a>o?1:r[n(e)]-r[n(i)]}),e},n.permute=function(e){for(var t=e.length,n,r;t;)r=Math.floor(Math.random()*t--),n=e[t],e[t]=e[r],e[r]=n},n.pad=function(e,t,n,r){r||=` `;var i=t-e.length;if(i<=0)return e;switch(n){case`left`:return o(i,r)+e;case`middle`:case`center`:return o(Math.floor(i/2),r)+e+o(Math.ceil(i/2),r);default:return e+o(i,r)}};function o(e,t){var n=``,r;for(r=0;r<e;++r)n+=t;return n}n.truncate=function(e,t,n,r,i){var a=e.length;if(a<=t)return e;i=i===void 0?`…`:String(i);var o=Math.max(0,t-i.length);switch(n){case`left`:return i+(r?s(e,o,1):e.slice(a-o));case`middle`:case`center`:var c=Math.ceil(o/2),l=Math.floor(o/2);return(r?s(e,c):e.slice(0,c))+i+(r?s(e,l,1):e.slice(a-l));default:return(r?s(e,o):e.slice(0,o))+i}};function s(e,t,n){var r=0,i=e.split(c);return e=n?(i=i.reverse()).filter(function(e){return r+=e.length,r<=t}).reverse():i.filter(function(e){return r+=e.length,r<=t}),e.length?e.join(``).trim():i[0].slice(0,t)}var c=/([\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u2028\u2029\u3000\uFEFF])/})),I=ei();function L(e,t){return e.indexOf(t)!==-1}function ti(e,t){for(let n=0;n<e.length;n++)if(!t(e[n],n))return!1;return!0}function R(e,t,n){if(e.forEach)e.forEach.call(n,t);else for(let r in e)t.call(n,e[r],r,e)}function ni(e,t){let n=0,r;for(r in e)if(t(e[r],r,n++))return!0;return!1}function ri(e,t){return e.filter(function(e){return!L(t,e)})}function ii(e){return Object.keys(e)}function ai(e){return!!e.parent}var oi={channel:1,aggregate:1,autoCount:1,bin:1,timeUnit:1,hasFn:1,sort:1,stack:1,field:1,type:1,format:1,scale:1,axis:1,legend:1,value:1},si=ii(oi);function ci(e){return e in oi}var li={bin:1,scale:1,sort:1,axis:1,legend:1};function ui(e){return li[e]}var di=[`maxbins`,`divide`,`extent`,`base`,`step`,`steps`,`minstep`],fi=[`field`,`op`,`order`],pi=di.map(e=>({parent:`bin`,child:e})),mi=fi.map(e=>({parent:`sort`,child:e})),hi=Hr.map(e=>({parent:`scale`,child:e})),gi=nn.map(e=>({parent:`axis`,child:e})),_i=on.map(e=>({parent:`legend`,child:e})),vi=[].concat(pi,mi,hi,gi,_i),yi=[`width`,`height`,`background`,`padding`,`title`],bi=`.`;function xi(e){return ai(e)?e.parent+bi+e.child:e}function Si(e){let t=e.split(bi);if(t.length===1)return e;if(t.length===2)return{parent:t[0],child:t[1]};throw`Invalid property key with `+t.length+` dots: `+e}var Ci=vi.reduce((e,t)=>(e[t.parent]=e[t.parent]||[],e[t.parent][t.child]=t,e),{});function wi(e,t){return(Ci[e]||{})[t]}function Ti(e){return ci(e)||ai(e)}var Ei=[].concat(si,vi),Di=[`type`,`field`,`bin`,`timeUnit`,`aggregate`,`autoCount`,`channel`,`mark`,`stack`,`scale`,`sort`,`axis`,`legend`].concat(pi,hi,gi,_i,mi),z;(function(e){e.MARK=`mark`,e.TRANSFORM=`transform`,e.STACK=`stack`,e.FORMAT=`format`,e.CHANNEL=`channel`,e.AGGREGATE=`aggregate`,e.AUTOCOUNT=`autoCount`,e.BIN=`bin`,e.HAS_FN=`hasFn`,e.TIMEUNIT=`timeUnit`,e.FIELD=`field`,e.TYPE=`type`,e.SORT=`sort`,e.SCALE=`scale`,e.AXIS=`axis`,e.LEGEND=`legend`,e.WIDTH=`width`,e.HEIGHT=`height`,e.BACKGROUND=`background`,e.PADDING=`padding`,e.TITLE=`title`})(z||={});var Oi=`area`,ki=`line`,Ai=`point`,ji=`rect`,Mi=`rule`,Ni=`text`,Pi=`tick`,Fi=`circle`,Ii=`square`,Li={area:1,bar:1,line:1,point:1,text:1,tick:1,trail:1,rect:1,geoshape:1,rule:1,circle:1,square:1};function Ri(e){return M([`line`,`area`,`trail`],e)}var zi=N(Li);function Bi(e){return e.type}Re(zi),[`january`,`february`,`march`,`april`,`may`,`june`,`july`,`august`,`september`,`october`,`november`,`december`].map(e=>e.substr(0,3)),[`sunday`,`monday`,`tuesday`,`wednesday`,`thursday`,`friday`,`saturday`].map(e=>e.substr(0,3));var B;(function(e){e.YEAR=`year`,e.MONTH=`month`,e.DAY=`day`,e.DATE=`date`,e.HOURS=`hours`,e.MINUTES=`minutes`,e.SECONDS=`seconds`,e.MILLISECONDS=`milliseconds`,e.YEARMONTH=`yearmonth`,e.YEARMONTHDATE=`yearmonthdate`,e.YEARMONTHDATEHOURS=`yearmonthdatehours`,e.YEARMONTHDATEHOURSMINUTES=`yearmonthdatehoursminutes`,e.YEARMONTHDATEHOURSMINUTESSECONDS=`yearmonthdatehoursminutesseconds`,e.MONTHDATE=`monthdate`,e.MONTHDATEHOURS=`monthdatehours`,e.HOURSMINUTES=`hoursminutes`,e.HOURSMINUTESSECONDS=`hoursminutesseconds`,e.MINUTESSECONDS=`minutesseconds`,e.SECONDSMILLISECONDS=`secondsmilliseconds`,e.QUARTER=`quarter`,e.YEARQUARTER=`yearquarter`,e.QUARTERMONTH=`quartermonth`,e.YEARQUARTERMONTH=`yearquartermonth`,e.UTCYEAR=`utcyear`,e.UTCMONTH=`utcmonth`,e.UTCDAY=`utcday`,e.UTCDATE=`utcdate`,e.UTCHOURS=`utchours`,e.UTCMINUTES=`utcminutes`,e.UTCSECONDS=`utcseconds`,e.UTCMILLISECONDS=`utcmilliseconds`,e.UTCYEARMONTH=`utcyearmonth`,e.UTCYEARMONTHDATE=`utcyearmonthdate`,e.UTCYEARMONTHDATEHOURS=`utcyearmonthdatehours`,e.UTCYEARMONTHDATEHOURSMINUTES=`utcyearmonthdatehoursminutes`,e.UTCYEARMONTHDATEHOURSMINUTESSECONDS=`utcyearmonthdatehoursminutesseconds`,e.UTCMONTHDATE=`utcmonthdate`,e.UTCMONTHDATEHOURS=`utcmonthdatehours`,e.UTCHOURSMINUTES=`utchoursminutes`,e.UTCHOURSMINUTESSECONDS=`utchoursminutesseconds`,e.UTCMINUTESSECONDS=`utcminutesseconds`,e.UTCSECONDSMILLISECONDS=`utcsecondsmilliseconds`,e.UTCQUARTER=`utcquarter`,e.UTCYEARQUARTER=`utcyearquarter`,e.UTCQUARTERMONTH=`utcquartermonth`,e.UTCYEARQUARTERMONTH=`utcyearquartermonth`})(B||={});var Vi={year:1,quarter:1,month:1,day:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},Hi=N(Vi);function Ui(e){return!!Vi[e]}var Wi={utcyear:1,utcquarter:1,utcmonth:1,utcday:1,utcdate:1,utchours:1,utcminutes:1,utcseconds:1,utcmilliseconds:1};function Gi(e){return!!Wi[e]}var Ki={yearquarter:1,yearquartermonth:1,yearmonth:1,yearmonthdate:1,yearmonthdatehours:1,yearmonthdatehoursminutes:1,yearmonthdatehoursminutesseconds:1,quartermonth:1,monthdate:1,monthdatehours:1,hoursminutes:1,hoursminutesseconds:1,minutesseconds:1,secondsmilliseconds:1},qi={utcyearquarter:1,utcyearquartermonth:1,utcyearmonth:1,utcyearmonthdate:1,utcyearmonthdatehours:1,utcyearmonthdatehoursminutes:1,utcyearmonthdatehoursminutesseconds:1,utcquartermonth:1,utcmonthdate:1,utcmonthdatehours:1,utchoursminutes:1,utchoursminutesseconds:1,utcminutesseconds:1,utcsecondsmilliseconds:1},Ji=Object.assign({},Wi,qi);function Yi(e){return!!Ji[e]}var Xi=Object.assign({},Vi,Wi,Ki,qi);N(Xi);function Zi(e){return!!Xi[e]}var Qi={year:`setFullYear`,month:`setMonth`,date:`setDate`,hours:`setHours`,minutes:`setMinutes`,seconds:`setSeconds`,milliseconds:`setMilliseconds`,quarter:null,day:null};function $i(e,t){let n=Yi(e),r=n?new Date(Date.UTC(1972,0,1,0,0,0,0)):new Date(1972,0,1,0,0,0,0);for(let i of Hi)if(ta(e,i))switch(i){case B.DAY:throw Error(`Cannot convert to TimeUnits containing 'day'`);case B.QUARTER:{let{getDateMethod:e,setDateMethod:i}=ea(`month`,n);r[i](Math.floor(t[e]()/3)*3);break}default:{let{getDateMethod:e,setDateMethod:a}=ea(i,n);r[a](t[e]())}}return r}function ea(e,t){let n=Qi[e];return{setDateMethod:t?`setUTC`+n.substr(3):n,getDateMethod:`get`+(t?`UTC`:``)+n.substr(3)}}function ta(e,t){let n=e.indexOf(t);return n>-1&&(t!==B.SECONDS||n===0||e.charAt(n-1)!==`i`)}function V(e){return na(e)||ra(e)}function na(e){return e===`?`}function ra(e){return e!==void 0&&e!=null&&(!!e.enum||!!e.name)&&!(0,I.isArray)(e)}function ia(e,t,n){return(0,I.extend)({},{name:t,enum:n},e===`?`?{}:e)}function aa(e){let t={},n={};for(let r of e){let e=[0];for(let t=0;t<r.length;t++)r.charAt(t).toUpperCase()===r.charAt(t)&&e.push(t);let i=e.map(e=>r.charAt(e)).join(``).toLowerCase();if(!n[i]){t[r]=i,n[i]=!0;continue}if(e[e.length-1]!==r.length-1&&(i=e.concat([r.length-1]).map(e=>r.charAt(e)).join(``).toLowerCase(),!n[i])){t[r]=i,n[i]=!0;continue}for(let e=1;!t[r];e++){let a=i+`_`+e;if(!n[a]){t[r]=a,n[a]=!0;break}}}return t}var oa={mark:`m`,channel:`c`,aggregate:`a`,autoCount:`#`,hasFn:`h`,bin:`b`,sort:`so`,stack:`st`,scale:`s`,format:`f`,axis:`ax`,legend:`l`,value:`v`,timeUnit:`tu`,field:`f`,type:`t`,binProps:{maxbins:`mb`,min:`mi`,max:`ma`,base:`b`,step:`s`,steps:`ss`,minstep:`ms`,divide:`d`},sortProps:{field:`f`,op:`o`,order:`or`},scaleProps:aa(Hr),axisProps:aa(nn),legendProps:aa(on)};function sa(e){if(ai(e))return oa[e.parent]+`-`+oa[e.parent+`Props`][e.child];if(oa[e])return oa[e];throw Error(`Default name undefined for `+e)}var H=[!1,!0],ca={maxbins:[5,10,20],extent:[void 0],base:[10],step:[void 0],steps:[void 0],minstep:[void 0],divide:[[5,2]],binned:[!1],anchor:[void 0],nice:[!0]},la={field:[void 0],op:[`min`,`mean`],order:[`ascending`,`descending`]},ua={type:[void 0,F.LOG],domain:[void 0],base:[void 0],exponent:[1,2],constant:[void 0],bins:[void 0],clamp:H,nice:H,reverse:H,round:H,zero:H,padding:[void 0],paddingInner:[void 0],paddingOuter:[void 0],interpolate:[void 0],range:[void 0],rangeStep:[17,21],scheme:[void 0]},da={zindex:[1,0],offset:[void 0],orient:[void 0],values:[void 0],bandPosition:[void 0],encoding:[void 0],domain:H,domainColor:[void 0],domainDash:[void 0],domainDashOffset:[void 0],domainOpacity:[void 0],domainWidth:[void 0],formatType:[void 0],grid:H,gridColor:[void 0],gridDash:[void 0],gridDashOffset:[void 0],gridOpacity:[void 0],gridWidth:[void 0],format:[void 0],labels:H,labelAlign:[void 0],labelAngle:[void 0],labelBaseline:[void 0],labelColor:[void 0],labelFlushOffset:[void 0],labelFont:[void 0],labelFontSize:[void 0],labelFontStyle:[void 0],labelFontWeight:[void 0],labelLimit:[void 0],labelOpacity:[void 0],labelSeparation:[void 0],labelOverlap:[void 0],labelPadding:[void 0],labelBound:[void 0],labelFlush:[void 0],maxExtent:[void 0],minExtent:[void 0],position:[void 0],ticks:H,tickColor:[void 0],tickCount:[void 0],tickDash:[void 0],tickExtra:[void 0],tickDashOffset:[void 0],tickMinStep:[void 0],tickOffset:[void 0],tickOpacity:[void 0],tickRound:[void 0],tickSize:[void 0],tickWidth:[void 0],title:[void 0],titleAlign:[void 0],titleAnchor:[void 0],titleAngle:[void 0],titleBaseline:[void 0],titleColor:[void 0],titleFont:[void 0],titleFontSize:[void 0],titleFontStyle:[void 0],titleFontWeight:[void 0],titleLimit:[void 0],titleOpacity:[void 0],titlePadding:[void 0],titleX:[void 0],titleY:[void 0]},fa={mark:[Ai,`bar`,ki,Oi,ji,Pi,Ni],channel:[`x`,`y`,`row`,Ke,nt,Qe],aggregate:[void 0,`mean`],autoCount:H,bin:H,hasFn:H,timeUnit:[void 0,B.YEAR,B.MONTH,B.MINUTES,B.SECONDS],field:[void 0],type:[Or,Er,P,Dr],sort:[`ascending`,`descending`],stack:[`zero`,`normalize`,`center`,null],value:[void 0],format:[void 0],title:[void 0],scale:[!0],axis:H,legend:H,binProps:ca,sortProps:la,scaleProps:ua,axisProps:da,legendProps:{orient:[`left`,`right`],format:[void 0],type:[void 0],values:[void 0],zindex:[void 0],clipHeight:[void 0],columnPadding:[void 0],columns:[void 0],cornerRadius:[void 0],direction:[void 0],encoding:[void 0],fillColor:[void 0],formatType:[void 0],gridAlign:[void 0],offset:[void 0],padding:[void 0],rowPadding:[void 0],strokeColor:[void 0],labelAlign:[void 0],labelBaseline:[void 0],labelColor:[void 0],labelFont:[void 0],labelFontSize:[void 0],labelFontStyle:[void 0],labelFontWeight:[void 0],labelLimit:[void 0],labelOffset:[void 0],labelOpacity:[void 0],labelOverlap:[void 0],labelPadding:[void 0],labelSeparation:[void 0],legendX:[void 0],legendY:[void 0],gradientLength:[void 0],gradientOpacity:[void 0],gradientStrokeColor:[void 0],gradientStrokeWidth:[void 0],gradientThickness:[void 0],symbolDash:[void 0],symbolDashOffset:[void 0],symbolFillColor:[void 0],symbolOffset:[void 0],symbolOpacity:[void 0],symbolSize:[void 0],symbolStrokeColor:[void 0],symbolStrokeWidth:[void 0],symbolType:[void 0],tickCount:[void 0],tickMinStep:[void 0],title:[void 0],titleAnchor:[void 0],titleAlign:[void 0],titleBaseline:[void 0],titleColor:[void 0],titleFont:[void 0],titleFontSize:[void 0],titleFontStyle:[void 0],titleFontWeight:[void 0],titleLimit:[void 0],titleOpacity:[void 0],titleOrient:[void 0],titlePadding:[void 0]}};function pa(e,t,n){if(e===`field`||ai(e)&&e.parent===`sort`&&e.child===`field`)return t.fieldNames();let r;if(r=ai(e)?n.enum[e.parent+`Props`][e.child]:n.enum[e],r!==void 0)return r;throw Error(`No default enumValues for `+JSON.stringify(e))}var ma={verbose:!1,defaultSpecConfig:{line:{point:!0},scale:{useUnaggregatedDomain:!0}},propertyPrecedence:Di.map(xi),enum:fa,numberNominalProportion:.05,numberNominalLimit:40,constraintManuallySpecifiedValue:!1,autoAddCount:!1,hasAppropriateGraphicTypeForMark:!0,omitAggregate:!1,omitAggregatePlotWithDimensionOnlyOnFacet:!0,omitAggregatePlotWithoutDimension:!1,omitBarLineAreaWithOcclusion:!0,omitBarTickWithSize:!0,omitMultipleNonPositionalChannels:!0,omitRaw:!1,omitRawContinuousFieldForAggregatePlot:!0,omitRepeatedField:!0,omitNonPositionalOrFacetOverPositionalChannels:!0,omitTableWithOcclusionIfAutoAddCount:!0,omitVerticalDotPlot:!1,omitInvalidStackSpec:!0,omitNonSumStack:!0,preferredBinAxis:`x`,preferredTemporalAxis:`x`,preferredOrdinalAxis:`y`,preferredNominalAxis:`y`,preferredFacet:`row`,minCardinalityForBin:15,maxCardinalityForCategoricalColor:20,maxCardinalityForFacet:20,maxCardinalityForShape:6,timeUnitShouldHaveVariation:!0,typeMatchesSchemaType:!0,stylize:!0,smallRangeStepForHighCardinalityOrFacet:{maxCardinality:10,rangeStep:12},nominalColorScaleForHighCardinality:{maxCardinality:10,palette:`category20`},xAxisOnTopForHighYCardinalityWithoutColumn:{maxCardinality:30},maxGoodCardinalityForFacet:5,maxGoodCardinalityForColor:7,minPercentUniqueForKey:.8,minCardinalityForKey:50},ha={argmax:1,argmin:1,average:1,count:1,distinct:1,max:1,mean:1,median:1,min:1,missing:1,q1:1,q3:1,ci0:1,ci1:1,stderr:1,stdev:1,stdevp:1,sum:1,valid:1,values:1,variance:1,variancep:1};function ga(e){return!!e&&!!e.argmin}function _a(e){return!!e&&!!e.argmax}N(ha);function va(e){return je(e)&&!!ha[e]}var ya=[`count`,`sum`,`distinct`,`valid`,`missing`];Re([`mean`,`average`,`median`,`q1`,`q3`,`min`,`max`]);function ba(e){return Le(e)&&(e=Na(e,void 0)),`bin`+N(e).map(t=>Be(`_${t}_${e[t]}`)).join(``)}function xa(e){return e===!0||Sa(e)&&!e.binned}function Sa(e){return Ae(e)}function Ca(e){switch(e){case`row`:case Ke:case nt:case Qe:case $e:case et:case ot:case rt:case it:case at:case tt:return 6;default:return 10}}function wa(e){return!!e&&!!e.condition&&!ke(e.condition)&&Ta(e.condition)}function Ta(e){return!!e&&(!!e.field||e.aggregate===`count`)}function Ea(e){return Ta(e)&&je(e.field)}function Da(e){return!!e.op}function Oa(e,t={}){let n=e.field,r=t.prefix,i=t.suffix,a=``;if(ja(e))n=We(`count`);else{let r;if(!t.nofn){if(Da(e))r=e.op;else{let{bin:o,aggregate:s,timeUnit:c}=e;xa(o)?(r=ba(o),i=(t.binSuffix||``)+(t.suffix||``)):s?_a(s)?(a=`.${n}`,n=`argmax_${s.argmax}`):ga(s)?(a=`.${n}`,n=`argmin_${s.argmin}`):r=String(s):c&&(r=String(c))}}r&&(n=n?`${r}_${n}`:r)}return i&&(n=`${n}_${i}`),r&&(n=`${r}_${n}`),t.forAs?n:t.expr?Ve(n,t.expr)+a:He(n)+a}function ka(e){switch(e.type){case`nominal`:case`ordinal`:case`geojson`:return!0;case`quantitative`:return!!e.bin;case`temporal`:return!1}throw Error(Sr.invalidFieldType(e.type))}function Aa(e){return!ka(e)}function ja(e){return e.aggregate===`count`}function Ma(e){if(Ta(e))return e;if(wa(e))return e.condition}function Na(e,t){return Le(e)?{maxbins:Ca(t)}:e===`binned`?{binned:!0}:!e.maxbins&&!e.step?Object.assign({},e,{maxbins:Ca(t)}):e}var Pa={compatible:!0};function Fa(e,t){let n=e.type;if(n===`geojson`&&t!==`shape`)return{compatible:!1,warning:`Channel ${t} should not be used with a geojson data.`};switch(t){case`row`:case`column`:case`facet`:return Aa(e)?{compatible:!1,warning:Sr.facetChannelShouldBeDiscrete(t)}:Pa;case`x`:case`y`:case`color`:case`fill`:case`stroke`:case`text`:case`detail`:case`key`:case`tooltip`:case`href`:return Pa;case`longitude`:case`longitude2`:case`latitude`:case`latitude2`:return n===`quantitative`?Pa:{compatible:!1,warning:`Channel ${t} should be used with a quantitative field only, not ${e.type} field.`};case`opacity`:case`fillOpacity`:case`strokeOpacity`:case`strokeWidth`:case`size`:case`x2`:case`y2`:return n===`nominal`&&!e.sort?{compatible:!1,warning:`Channel ${t} should not be used with an unsorted discrete field.`}:Pa;case`shape`:return M([`ordinal`,`nominal`,`geojson`],e.type)?Pa:{compatible:!1,warning:`Shape channel should be used with only either discrete or geojson data.`};case`order`:return e.type===`nominal`&&!(`sort`in e)?{compatible:!1,warning:`Channel order is inappropriate for nominal field, which has no inherent order.`}:Pa}throw Error(`channelCompatability not implemented for channel `+t)}function Ia(e,t,n,r){let i=La(t,n,r),{type:a}=e;return qt(t)?a===void 0?i:Zr(t,a)?Xr(a,n.type)?a:(wr(Sr.scaleTypeNotWorkWithFieldDef(a,i)),i):(wr(Sr.scaleTypeNotWorkWithChannel(t,a,i)),i):null}function La(e,t,n){switch(t.type){case`nominal`:case`ordinal`:return ht(e)||$t(e)===`discrete`?(e===`shape`&&t.type===`ordinal`&&wr(Sr.discreteChannelCannotEncode(e,`ordinal`)),`ordinal`):M([`x`,`y`],e)&&(M([`rect`,`bar`,`rule`],n)||n===`bar`)?`band`:`point`;case`temporal`:return ht(e)?`time`:$t(e)===`discrete`?(wr(Sr.discreteChannelCannotEncode(e,`temporal`)),`ordinal`):`time`;case`quantitative`:return ht(e)?xa(t.bin)?`bin-ordinal`:`linear`:$t(e)===`discrete`?(wr(Sr.discreteChannelCannotEncode(e,`quantitative`)),`ordinal`):`linear`;case`geojson`:return}throw Error(Sr.invalidFieldType(t.type))}var Ra;(function(e){e.QUANTITATIVE=P,e.ORDINAL=Er,e.TEMPORAL=Dr,e.NOMINAL=Or,e.KEY=`key`})(Ra||={});function za(e){return e===`ordinal`||e===`nominal`||e===Ra.KEY}var U=class e{constructor(e=null){this.index=e?Object.assign({},e):{}}has(e){return xi(e)in this.index}get(e){return this.index[xi(e)]}set(e,t){return this.index[xi(e)]=t,this}setByKey(e,t){this.index[e]=t}map(t){let n=new e;for(let e in this.index)n.index[e]=t(this.index[e]);return n}size(){return(0,I.keys)(this.index).length}duplicate(){return new e(this.index)}};function Ba(e,t){let n=e&&e[t];return n?ke(n)?ze(n,e=>!!e.field):Ta(n)||wa(n):!1}var Va={zero:1,center:1,normalize:1};function Ha(e){return!!Va[e]}var Ua=[`bar`,Oi,Mi,Ai,Fi,Ii,ki,Ni,Pi],Wa=[`bar`,Oi];function Ga(e){let t=e.x,n=e.y;if(Ta(t)&&Ta(n)){if(t.type===`quantitative`&&n.type===`quantitative`){if(t.stack)return`x`;if(n.stack)return`y`;if(!!t.aggregate!=!!n.aggregate)return t.aggregate?`x`:`y`}else if(t.type===`quantitative`)return`x`;else if(n.type===`quantitative`)return`y`}else if(Ta(t)&&t.type===`quantitative`)return`x`;else if(Ta(n)&&n.type===`quantitative`)return`y`}function Ka(e,t,n,r={}){let i=Bi(e)?e.type:e;if(!M(Ua,i))return null;let a=Ga(t);if(!a)return null;let o=t[a],s=Ea(o)?Oa(o,{}):void 0,c=a===`x`?`y`:`x`,l=t[c],u=Ea(l)?Oa(l,{}):void 0,d=Lt.reduce((e,n)=>{if(n!==`tooltip`&&Ba(t,n)){let r=t[n];(ke(r)?r:[r]).forEach(t=>{let r=Ma(t);if(r.aggregate)return;let i=Ea(r)?Oa(r,{}):void 0;(!i||i!==u&&i!==s)&&e.push({channel:n,fieldDef:r})})}return e},[]),f;if(o.stack===void 0?d.length>0&&(f=M(Wa,i)?Ue(n,`zero`):n):f=Le(o.stack)?o.stack?`zero`:null:o.stack,!f||!Ha(f))return null;if(o.scale&&o.scale.type&&o.scale.type!==F.LINEAR){if(r.disallowNonLinearStack)return null;wr(Sr.cannotStackNonLinearScale(o.scale.type))}return Ba(t,a===`x`?`x2`:`y2`)?(o.stack!==void 0&&wr(Sr.cannotStackRangedMark(a)),null):(o.aggregate&&!M(ya,o.aggregate)&&wr(Sr.stackNonSummativeAggregate(o.aggregate)),{groupbyChannel:l?c:void 0,fieldChannel:a,impute:Ri(i),stackBy:d,offset:f})}function qa(e){return ni(e.encodings,e=>G(e)&&!V(e.aggregate)&&!!e.aggregate||mo(e))}function Ja(e){if(!Za(e))return null;let t=go(e.encodings,{schema:null,wildcardMode:`null`}),n=e.mark;return Ka(n,t,void 0,{disallowNonLinearStack:!0})}function Ya(e){for(let t of e.encodings)if(t[z.STACK]!==void 0&&!V(t[z.STACK]))return t[z.STACK]}function Xa(e){for(let t of e.encodings)if(t[z.STACK]!==void 0&&!V(t.channel))return t.channel;return null}function Za(e){if(V(e.mark))return!1;let t=[z.STACK,z.CHANNEL,z.MARK,z.FIELD,z.AGGREGATE,z.AUTOCOUNT,z.SCALE,wi(`scale`,`type`),z.TYPE],n=(0,I.toMap)(ri(Ei,t)),r=e.encodings.filter(e=>!q(e));for(let e of r)if(Qa(e,{exclude:n}))return!1;return!0}function Qa(e,t={}){if(!(0,I.isObject)(e))return!1;for(let n in e)if(e.hasOwnProperty(n)&&(V(e[n])&&(!t.exclude||!t.exclude[n])||Qa(e[n],t)))return!0;return!1}function $a(e){return e.map(e=>eo(e))}function eo(e){return t=>e[t]===void 0?t:e[t]}function to(e,t){return V(e)?!na(e)&&e.enum?`?`+JSON.stringify(e.enum):`?`:t?t(e):e}function no(e,t){return t?t(e):e}var ro=new U,io=[].concat(Di,mi,[z.TRANSFORM,z.STACK],yi).reduce((e,t)=>e.set(t,!0),new U),ao={axis:{x:!0,y:!0,row:!0,column:!0},legend:{color:!0,opacity:!0,size:!0,shape:!0},scale:{x:!0,y:!0,color:!0,opacity:!0,row:!0,column:!0,size:!0,shape:!0},sort:{x:!0,y:!0,path:!0,order:!0},stack:{x:!0,y:!0}};function oo(e,t=io,n=ro){let r=[];t.get(z.MARK)&&r.push(to(e.mark,n.get(z.MARK))),e.transform&&e.transform.length>0&&r.push(`transform:`+JSON.stringify(e.transform));let i;if(t.get(z.STACK)&&(i=Ja(e)),e.encodings){let a=e.encodings.reduce((e,r)=>{if(!q(r)){let a;a=i&&r.channel===i.fieldChannel?so(Object.assign({},r,{stack:i.offset}),t,n):so(r,t,n),a&&e.push(a)}return e},[]).sort().join(`|`);a&&r.push(a)}for(let n of yi){let i=n.toString();if(t.get(n)&&e[i]){let t=e[i];r.push(`${i}=${JSON.stringify(t)}`)}}return r.join(`|`)}function so(e,t=io,n=ro){let r=[];if(t.get(z.CHANNEL)&&r.push(to(e.channel,n.get(z.CHANNEL))),G(e)){let i=co(e,t,n);i&&r.push(i)}else W(e)?r.push(e.value):K(e)&&r.push(`autocount()`);return r.join(`:`)}function co(e,t=io,n=ro){if(t.get(z.AGGREGATE)&&q(e))return`-`;let r=lo(e,t,n),i=uo(e,t,n),a;if(G(e)){if(a=t.get(`field`)?to(e.field,n.get(`field`)):`...`,t.get(z.TYPE)){if(V(e.type))a+=`,`+to(e.type,n.get(z.TYPE));else{let t=((e.type||`quantitative`)+``).substr(0,1);a+=`,`+to(t,n.get(z.TYPE))}}a+=i.map(e=>{let t=e.value instanceof Array?`[`+e.value+`]`:e.value;return`,`+e.key+`=`+t}).join(``)}else K(e)&&(a=`*,q`);return a?r?((0,I.isString)(r)?r:`?`+((0,I.keys)(r).length>0?JSON.stringify(r):``))+`(`+a+`)`:a:null}function lo(e,t,n){if(t.get(z.AGGREGATE)&&e.aggregate&&!V(e.aggregate))return no(e.aggregate,n.get(z.AGGREGATE));if(t.get(z.AGGREGATE)&&mo(e))return no(`count`,n.get(z.AGGREGATE));if(t.get(z.TIMEUNIT)&&e.timeUnit&&!V(e.timeUnit))return no(e.timeUnit,n.get(z.TIMEUNIT));if(t.get(z.BIN)&&e.bin&&!V(e.bin))return`bin`;{let n=null;for(let r of[z.AGGREGATE,z.AUTOCOUNT,z.TIMEUNIT,z.BIN]){let i=e[r];t.get(r)&&e[r]&&V(i)&&(n||={},n[r]=na(i)?i:i.enum)}return n&&e.hasFn&&(n.hasFn=!0),n}}function uo(e,t,n){let r=[];if(!(0,I.isBoolean)(e.bin)&&!na(e.bin)){let i=e.bin;for(let e in i){let a=wi(`bin`,e);a&&t.get(a)&&i[e]!==void 0&&r.push({key:e,value:to(i[e],n.get(a))})}r.sort((e,t)=>e.key.localeCompare(t.key))}for(let i of[z.SCALE,z.SORT,z.STACK,z.AXIS,z.LEGEND])if(!(!V(e.channel)&&!ao[i][e.channel])&&t.get(i)&&e[i]!==void 0){let a=e[i];if((0,I.isBoolean)(a)||a===null)r.push({key:i+``,value:a||!1});else if((0,I.isString)(a))r.push({key:i+``,value:no(JSON.stringify(a),n.get(i))});else{let e=[];for(let r in a){let o=wi(i,r);o&&t.get(o)&&a[r]!==void 0&&e.push({key:r,value:to(a[r],n.get(o))})}if(e.length>0){let t=e.sort((e,t)=>e.key.localeCompare(t.key)).reduce((e,t)=>(e[t.key]=t.value,e),{});r.push({key:i+``,value:JSON.stringify(t)})}}}return r}function fo(e,t,n){let r=[],i=0;for(let a=0;a<n;a++){let n=e.indexOf(t,i);if(n!==-1)r.push(e.substring(i,n)),i=n+1;else break}if(r.push(e.substr(i)),r.length!==n+1)for(;r.length!==n+1;)r.push(``);return r}var po;(function(e){function t(e,t){let r=t.indexOf(`(`)===-1?n(fo(t,`,`,2)):i(t);return Object.assign({channel:e},r)}e.encoding=t;function n(e){let t={};t.field=e[0],t.type=Ar(e[1].toUpperCase())||`?`;let n=e[2],i=0,a=0;for(;a<n.length;){let e=n.indexOf(`=`,a),o;if(e!==-1){let s=n.substring(a,e);if(n[a+s.length+1]===`{`){let e=a+s.length+1;i=r(e,n,`}`);let t=n.substring(e,i+1);o=JSON.parse(t),a=i+2}else if(n[a+s.length+1]===`[`){let e=a+s.length+1,t=r(e,n,`]`),i=n.substring(e,t+1);o=JSON.parse(i),a=t+2}else{let e=a,t=n.indexOf(`,`,a+s.length);t===-1&&(t=n.length),a=t+1,o=JSON.parse(n.substring(e+s.length+1,t))}ui(s)?t[s]=o:(t.bin=t.bin||{},t.bin[s]=o)}else break}return t}e.rawFieldDef=n;function r(e,t,n){for(let r=e;r<t.length;r++)if(t[r]===n)return r}e.getClosingIndex=r;function i(e){let t={};if(e[0]===`?`){let i=r(1,e,`}`),a=JSON.parse(e.substring(1,i+1));for(let e in a)t[e]=(0,I.isArray)(a[e])?{enum:a[e]}:a[e];return Object.assign({},t,n(fo(e.substring(i+2,e.length-1),`,`,2)))}{let t=e.substring(0,e.indexOf(`(`)),r=fo(e.substring(t.length+1,e.length-1),`,`,2);if(va(t))return Object.assign({aggregate:t},n(r));if(Zi(t))return Object.assign({timeUnit:t},n(r));if(t===`bin`)return Object.assign({bin:{}},n(r))}}e.fn=i})(po||={});function W(e){return e!=null&&e.value!==void 0}function G(e){return e!=null&&(e.field||e.aggregate===`count`)}function K(e){return e!=null&&`autoCount`in e}function q(e){return K(e)&&e.autoCount===!1}function mo(e){return K(e)&&e.autoCount===!0}var ho=[z.AGGREGATE,z.BIN,z.TIMEUNIT,z.FIELD,z.TYPE,z.SCALE,z.SORT,z.AXIS,z.LEGEND,z.STACK,z.FORMAT];function go(e,t){let{wildcardMode:n=`skip`}=t,r={};for(let n of e){if(q(n))continue;let{channel:e}=n;if(V(e))throw Error(`Cannot convert wildcard channel to a fixed channel`);let i=W(n)?_o(n):vo(n,t);if(i===null){if(t.wildcardMode===`null`)return null;continue}r[e]=i}return r}function _o(e){let{value:t}=e;return V(t)?null:{value:t}}function vo(e,t={}){let{props:n=ho,schema:r,wildcardMode:i=`skip`}=t;if(G(e)){let t={};for(let a of n){let n=e[a];if(V(n)){if(i===`skip`)continue;return null}if(n!==void 0){if(!(!ao[a]||ao[a][e.channel]))continue;if(ui(a)&&(0,I.isObject)(n)){n=Object.assign({},n);for(let e in n)if(V(n[e])){if(i===`null`)return null;delete n[e]}}if(a===`bin`&&n===!1)continue;a===`type`&&n===`key`?t.type=`nominal`:t[a]=n}if(a===z.SCALE&&r&&e.type===`ordinal`){let n=e.scale,{ordinalDomain:i}=r.fieldSchema(e.field);n!==null&&i&&(t[z.SCALE]=Object.assign({domain:i},(0,I.isObject)(n)?n:{}))}}return t}if(e.autoCount===!1)throw Error(`Cannot convert {autoCount: false} into a field def`);return{aggregate:`count`,field:`*`,type:`quantitative`}}function yo(e){return G(e)?!bo(e)&&e.type!==`temporal`:K(e)}function bo(e){if(G(e)){let t=vo(e,{props:[`bin`,`timeUnit`,`type`]});return ka(t)||!!t.timeUnit}return!1}function xo(e){let t=e.scale===!0||e.scale===`?`?{}:e.scale||{},{type:n,channel:r,timeUnit:i,bin:a}=e;if(V(t.type)||V(n)||V(r)||V(a))return;if(t.type)return t.type;if(n===`temporal`&&V(i)||n===`quantitative`&&V(a))return;let o={type:n===Ra.KEY?`nominal`:n,timeUnit:i,bin:a};return Ia({type:t.type},r,o,void 0)}function J(e,t,n,r){function i(t){return e(t=new Date(+t)),t}return i.floor=i,i.round=function(n){var r=new Date(+n),i=new Date(n-1);return e(r),e(i),t(i,1),n-r<i-n?r:i},i.ceil=function(n){return e(n=new Date(n-1)),t(n,1),n},i.offset=function(e,n){return t(e=new Date(+e),n==null?1:Math.floor(n)),e},i.range=function(n,r,i){var a=[];if(n=new Date(n-1),r=new Date(+r),i=i==null?1:Math.floor(i),!(n<r)||!(i>0))return a;for(t(n,1),e(n),n<r&&a.push(new Date(+n));t(n,i),e(n),n<r;)a.push(new Date(+n));return a},i.filter=function(n){return J(function(t){for(;e(t),!n(t);)t.setTime(t-1)},function(e,r){for(;--r>=0;)for(;t(e,1),!n(e););})},n&&(i.count=function(t,r){return So.setTime(+t),Co.setTime(+r),e(So),e(Co),Math.floor(n(So,Co))},i.every=function(e){return e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?i.filter(r?function(t){return r(t)%e===0}:function(t){return i.count(0,t)%e===0}):i}),i}var So,Co,Y=n((()=>{So=new Date,Co=new Date})),wo,To=n((()=>{Y(),wo=J(function(){},function(e,t){e.setTime(+e+t)},function(e,t){return t-e}),wo.every=function(e){return e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?J(function(t){t.setTime(Math.floor(t/e)*e)},function(t,n){t.setTime(+t+n*e)},function(t,n){return(n-t)/e}):wo}})),Eo,Do=n((()=>{Y(),Eo=J(function(e){e.setMilliseconds(0)},function(e,t){e.setTime(+e+t*1e3)},function(e,t){return(t-e)/1e3},function(e){return e.getSeconds()})})),Oo,ko=n((()=>{Y(),Oo=J(function(e){e.setSeconds(0,0)},function(e,t){e.setTime(+e+t*6e4)},function(e,t){return(t-e)/6e4},function(e){return e.getMinutes()})})),Ao,jo=n((()=>{Y(),Ao=J(function(e){e.setMinutes(0,0,0)},function(e,t){e.setTime(+e+t*36e5)},function(e,t){return(t-e)/36e5},function(e){return e.getHours()})})),Mo,No=n((()=>{Y(),Mo=J(function(e){e.setHours(0,0,0,0)},function(e,t){e.setDate(e.getDate()+t)},function(e,t){return(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/864e5},function(e){return e.getDate()-1})}));function Po(e){return J(function(t){t.setHours(0,0,0,0),t.setDate(t.getDate()-(t.getDay()+7-e)%7)},function(e,t){e.setDate(e.getDate()+t*7)},function(e,t){return(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/6048e5})}var Fo,Io,Lo,Ro,zo,Bo,Vo,Ho=n((()=>{Y(),Fo=Po(0),Io=Po(1),Lo=Po(2),Ro=Po(3),zo=Po(4),Bo=Po(5),Vo=Po(6)})),Uo,Wo=n((()=>{Y(),Uo=J(function(e){e.setHours(0,0,0,0),e.setDate(1)},function(e,t){e.setMonth(e.getMonth()+t)},function(e,t){return t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12},function(e){return e.getMonth()})})),Go,Ko=n((()=>{Y(),Go=J(function(e){e.setHours(0,0,0,0),e.setMonth(0,1)},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e,t){return t.getFullYear()-e.getFullYear()},function(e){return e.getFullYear()})})),qo,Jo=n((()=>{Y(),qo=J(function(e){e.setUTCMilliseconds(0)},function(e,t){e.setTime(+e+t*1e3)},function(e,t){return(t-e)/1e3},function(e){return e.getUTCSeconds()})})),Yo,Xo=n((()=>{Y(),Yo=J(function(e){e.setUTCSeconds(0,0)},function(e,t){e.setTime(+e+t*6e4)},function(e,t){return(t-e)/6e4},function(e){return e.getUTCMinutes()})})),Zo,Qo=n((()=>{Y(),Zo=J(function(e){e.setUTCMinutes(0,0,0)},function(e,t){e.setTime(+e+t*36e5)},function(e,t){return(t-e)/36e5},function(e){return e.getUTCHours()})})),$o,es=n((()=>{Y(),$o=J(function(e){e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCDate(e.getUTCDate()+t)},function(e,t){return(t-e)/864e5},function(e){return e.getUTCDate()-1})}));function ts(e){return J(function(t){t.setUTCHours(0,0,0,0),t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7)},function(e,t){e.setUTCDate(e.getUTCDate()+t*7)},function(e,t){return(t-e)/6048e5})}var ns,rs,is,as,os,ss,cs,ls=n((()=>{Y(),ns=ts(0),rs=ts(1),is=ts(2),as=ts(3),os=ts(4),ss=ts(5),cs=ts(6)})),us,ds=n((()=>{Y(),us=J(function(e){e.setUTCHours(0,0,0,0),e.setUTCDate(1)},function(e,t){e.setUTCMonth(e.getUTCMonth()+t)},function(e,t){return t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12},function(e){return e.getUTCMonth()})})),fs,ps=n((()=>{Y(),fs=J(function(e){e.setUTCHours(0,0,0,0),e.setUTCMonth(0,1)},function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)},function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()},function(e){return e.getUTCFullYear()})})),ms=r({day:()=>Mo,days:()=>ys,friday:()=>Bo,fridays:()=>Ts,hour:()=>Ao,hours:()=>vs,interval:()=>J,millisecond:()=>wo,milliseconds:()=>hs,minute:()=>Oo,minutes:()=>_s,monday:()=>Io,mondays:()=>xs,month:()=>Uo,months:()=>Os,saturday:()=>Vo,saturdays:()=>Es,second:()=>Eo,seconds:()=>gs,sunday:()=>Fo,sundays:()=>bs,thursday:()=>zo,thursdays:()=>ws,tuesday:()=>Lo,tuesdays:()=>Ss,utcDay:()=>$o,utcDays:()=>Fs,utcFriday:()=>ss,utcFridays:()=>Vs,utcHour:()=>Zo,utcHours:()=>Ps,utcMillisecond:()=>As,utcMilliseconds:()=>js,utcMinute:()=>Yo,utcMinutes:()=>Ns,utcMonday:()=>rs,utcMondays:()=>Ls,utcMonth:()=>us,utcMonths:()=>Ws,utcSaturday:()=>cs,utcSaturdays:()=>Hs,utcSecond:()=>qo,utcSeconds:()=>Ms,utcSunday:()=>ns,utcSundays:()=>Is,utcThursday:()=>os,utcThursdays:()=>Bs,utcTuesday:()=>is,utcTuesdays:()=>Rs,utcWednesday:()=>as,utcWednesdays:()=>zs,utcWeek:()=>ns,utcWeeks:()=>Us,utcYear:()=>fs,utcYears:()=>Gs,wednesday:()=>Ro,wednesdays:()=>Cs,week:()=>Fo,weeks:()=>Ds,year:()=>Go,years:()=>ks}),hs,gs,_s,vs,ys,bs,xs,Ss,Cs,ws,Ts,Es,Ds,Os,ks,As,js,Ms,Ns,Ps,Fs,Is,Ls,Rs,zs,Bs,Vs,Hs,Us,Ws,Gs,Ks=n((()=>{Y(),To(),Do(),ko(),jo(),No(),Ho(),Wo(),Ko(),Jo(),Xo(),Qo(),es(),ls(),ds(),ps(),hs=wo.range,gs=Eo.range,_s=Oo.range,vs=Ao.range,ys=Mo.range,bs=Fo.range,xs=Io.range,Ss=Lo.range,Cs=Ro.range,ws=zo.range,Ts=Bo.range,Es=Vo.range,Ds=Fo.range,Os=Uo.range,ks=Go.range,As=wo,js=hs,Ms=qo.range,Ns=Yo.range,Ps=Zo.range,Fs=$o.range,Is=ns.range,Ls=rs.range,Rs=is.range,zs=as.range,Bs=os.range,Vs=ss.range,Hs=cs.range,Us=ns.range,Ws=us.range,Gs=fs.range})),qs=i(((e,n)=>{var r=(Ks(),t(ms)),i=new Date,a=new Date(0,0,1).setFullYear(0),o=new Date(Date.UTC(0,0,1)).setUTCFullYear(0);function s(e){return i.setTime(+e),i}function c(e,t,n,r,i,a){var o={type:e,date:t,unit:n};return r?o.step=r:o.minstep=1,i!=null&&(o.min=i),a!=null&&(o.max=a),o}function l(e,t,n,r,i,a){return c(e,function(e){return t.offset(n,e)},function(e){return t.count(n,e)},r,i,a)}var u=[l(`second`,r.second,a),l(`minute`,r.minute,a),l(`hour`,r.hour,a),l(`day`,r.day,a,[1,7]),l(`month`,r.month,a,[1,3,6]),l(`year`,r.year,a),c(`seconds`,function(e){return new Date(1970,0,1,0,0,e)},function(e){return s(e).getSeconds()},null,0,59),c(`minutes`,function(e){return new Date(1970,0,1,0,e)},function(e){return s(e).getMinutes()},null,0,59),c(`hours`,function(e){return new Date(1970,0,1,e)},function(e){return s(e).getHours()},null,0,23),c(`weekdays`,function(e){return new Date(1970,0,4+e)},function(e){return s(e).getDay()},[1],0,6),c(`dates`,function(e){return new Date(1970,0,e)},function(e){return s(e).getDate()},[1],1,31),c(`months`,function(e){return new Date(1970,e%12,1)},function(e){return s(e).getMonth()},[1],0,11)],d=[l(`second`,r.utcSecond,o),l(`minute`,r.utcMinute,o),l(`hour`,r.utcHour,o),l(`day`,r.utcDay,o,[1,7]),l(`month`,r.utcMonth,o,[1,3,6]),l(`year`,r.utcYear,o),c(`seconds`,function(e){return new Date(Date.UTC(1970,0,1,0,0,e))},function(e){return s(e).getUTCSeconds()},null,0,59),c(`minutes`,function(e){return new Date(Date.UTC(1970,0,1,0,e))},function(e){return s(e).getUTCMinutes()},null,0,59),c(`hours`,function(e){return new Date(Date.UTC(1970,0,1,e))},function(e){return s(e).getUTCHours()},null,0,23),c(`weekdays`,function(e){return new Date(Date.UTC(1970,0,4+e))},function(e){return s(e).getUTCDay()},[1],0,6),c(`dates`,function(e){return new Date(Date.UTC(1970,0,e))},function(e){return s(e).getUTCDate()},[1],1,31),c(`months`,function(e){return new Date(Date.UTC(1970,e%12,1))},function(e){return s(e).getUTCMonth()},[1],0,11)],f=[[31536e6,5],[7776e6,4],[2592e6,4],[12096e5,3],[6048e5,3],[1728e5,3],[864e5,3],[432e5,2],[216e5,2],[108e5,2],[36e5,2],[18e5,1],[9e5,1],[3e5,1],[6e4,1],[3e4,0],[15e3,0],[5e3,0],[1e3,0]];function p(e,t,n,r){var i=f[0],a,o,s;for(a=1,o=f.length;a<o;++a)if(i=f[a],t>i[0]){if(s=t/i[0],s>r)return e[f[a-1][1]];if(s>=n)return e[i[1]]}return e[f[o-1][1]]}function m(e){var t={},n,r;for(n=0,r=e.length;n<r;++n)t[e[n].type]=e[n];return t.find=function(t,n,r){return p(e,t,n,r)},t}n.exports=m(u),n.exports.utc=m(d)})),Js=i(((e,t)=>{var n=ei(),r=qs(),i=1e-15;function a(e){if(!e)throw Error(`Missing binning options.`);var t=e.maxbins||15,n=e.base||10,r=Math.log(n),i=e.div||[5,2],a=e.min,l=e.max,u=l-a,d,f,p,m,h,g,_;if(e.step)d=e.step;else if(e.steps)d=e.steps[Math.min(e.steps.length-1,o(e.steps,u/t,0,e.steps.length))];else{for(f=Math.ceil(Math.log(t)/r),p=e.minstep||0,d=Math.max(p,n**+(Math.round(Math.log(u)/r)-f));Math.ceil(u/d)>t;)d*=n;for(g=0;g<i.length;++g)h=d/i[g],h>=p&&u/h<=t&&(d=h)}return h=Math.log(d),m=h>=0?0:~~(-h/r)+1,_=n**(-m-1),a=Math.min(a,Math.floor(a/d+_)*d),l=Math.ceil(l/d)*d,{start:a,stop:l,step:d,unit:{precision:m},value:s,index:c}}function o(e,t,r,i){for(;r<i;){var a=r+i>>>1;n.cmp(e[a],t)<0?r=a+1:i=a}return r}function s(e){return this.step*Math.floor(e/this.step+i)}function c(e){return Math.floor((e-this.start)/this.step+i)}function l(e){return this.unit.date(s.call(this,e))}function u(e){return c.call(this,this.unit.unit(e))}a.date=function(e){if(!e)throw Error(`Missing date binning options.`);var t=e.utc?r.utc:r,n=e.min,i=e.max,o=e.maxbins||20,s=e.minbins||4,c=i-+n,d=e.unit?t[e.unit]:t.find(c,s,o),f=a({min:d.min==null?d.unit(n):d.min,max:d.max==null?d.unit(i):d.max,maxbins:o,minstep:d.minstep,steps:d.step});return f.unit=d,f.index=u,e.raw||(f.value=l),f},t.exports=a})),Ys=i(((e,t)=>{var n=ei(),r=`__types__`,i={boolean:n.boolean,integer:n.number,number:n.number,date:n.date,string:function(e){return e==null||e===``?null:e+``}},a={boolean:function(e){return e===`true`||e===`false`||n.isBoolean(e)},integer:function(e){return a.number(e)&&(e=+e)===~~e},number:function(e){return!isNaN(+e)&&!n.isDate(e)},date:function(e){return!isNaN(Date.parse(e))}};function o(e,t){if(!t)return e&&e[r]||null;e[r]=t}function s(e){return n.keys(e)}function c(e){return`[`+e+`]`}function l(e,t){e=n.array(e),t=n.$(t);var i,a,o;if(e[r]&&(i=t(e[r]),n.isString(i)))return i;for(a=0,o=e.length;!n.isValid(i)&&a<o;++a)i=t?t(e[a]):e[a];return n.isDate(i)?`date`:n.isNumber(i)?`number`:n.isBoolean(i)?`boolean`:n.isString(i)?`string`:null}function u(e,t){if(e.length){var r=t?n.identity:(t=s(e[0]),c);return t.reduce(function(t,n){return t[n]=l(e,r(n)),t},{})}}function d(e,t){e=n.array(e),t=n.$(t);var r,i,o,s=[`boolean`,`integer`,`number`,`date`];for(r=0;r<e.length;++r){for(o=t?t(e[r]):e[r],i=0;i<s.length;++i)n.isValid(o)&&!a[s[i]](o)&&(s.splice(i,1),--i);if(s.length===0)return`string`}return s[0]}function f(e,t){var r=t?n.identity:(t=s(e[0]),c);return t.reduce(function(t,n){return t[n]=d(e,r(n)),t},{})}l.annotation=o,l.all=u,l.infer=d,l.inferAll=f,l.parsers=i,t.exports=l})),Xs=i(((e,t)=>{var n=ei(),r=t.exports;r.repeat=function(e,t){var n=Array(t),r;for(r=0;r<t;++r)n[r]=e;return n},r.zeros=function(e){return r.repeat(0,e)},r.range=function(e,t,n){if(arguments.length<3&&(n=1,arguments.length<2&&(t=e,e=0)),(t-e)/n==1/0)throw Error(`Infinite range`);var r=[],i=-1,a;if(n<0)for(;(a=e+n*++i)>t;)r.push(a);else for(;(a=e+n*++i)<t;)r.push(a);return r},r.random={},r.random.uniform=function(e,t){t===void 0&&(t=e===void 0?1:e,e=0);var n=t-e,i=function(){return e+n*Math.random()};return i.samples=function(e){return r.zeros(e).map(i)},i.pdf=function(r){return r>=e&&r<=t?1/n:0},i.cdf=function(r){return r<e?0:r>t?1:(r-e)/n},i.icdf=function(t){return t>=0&&t<=1?e+t*n:NaN},i},r.random.integer=function(e,t){t===void 0&&(t=e,e=0);var n=t-e,i=function(){return e+Math.floor(n*Math.random())};return i.samples=function(e){return r.zeros(e).map(i)},i.pdf=function(r){return r===Math.floor(r)&&r>=e&&r<t?1/n:0},i.cdf=function(r){var i=Math.floor(r);return i<e?0:i>=t?1:(i-e+1)/n},i.icdf=function(t){return t>=0&&t<=1?e-1+Math.floor(t*n):NaN},i},r.random.normal=function(e,t){e||=0,t||=1;var n,i=function(){var r=0,i=0,a,o;if(n!==void 0)return r=n,n=void 0,r;do r=Math.random()*2-1,i=Math.random()*2-1,a=r*r+i*i;while(a===0||a>1);return o=Math.sqrt(-2*Math.log(a)/a),n=e+i*o*t,e+r*o*t};return i.samples=function(e){return r.zeros(e).map(i)},i.pdf=function(n){var r=Math.exp((n-e)**2/(-2*t**2));return 1/(t*Math.sqrt(2*Math.PI))*r},i.cdf=function(n){var r,i=(n-e)/t,a=Math.abs(i);if(a>37)r=0;else{var o,s=Math.exp(-a*a/2);a<7.07106781186547?(o=.0352624965998911*a+.700383064443688,o=o*a+6.37396220353165,o=o*a+33.912866078383,o=o*a+112.079291497871,o=o*a+221.213596169931,o=o*a+220.206867912376,r=s*o,o=.0883883476483184*a+1.75566716318264,o=o*a+16.064177579207,o=o*a+86.7807322029461,o=o*a+296.564248779674,o=o*a+637.333633378831,o=o*a+793.826512519948,o=o*a+440.413735824752,r/=o):(o=a+.65,o=a+4/o,o=a+3/o,o=a+2/o,o=a+1/o,r=s/o/2.506628274631)}return i>0?1-r:r},i.icdf=function(n){if(n<=0||n>=1)return NaN;var r=2*n-1,i=8*(Math.PI-3)/(3*Math.PI*(4-Math.PI)),a=2/(Math.PI*i)+Math.log(1-r**2)/2,o=Math.log(1-r*r)/i,s=(r>0?1:-1)*Math.sqrt(Math.sqrt(a*a-o)-a);return e+t*Math.SQRT2*s},i},r.random.bootstrap=function(e,t){var i=e.filter(n.isValid),a=i.length,o=t?r.random.normal(0,t):null,s=function(){return i[~~(Math.random()*a)]+(o?o():0)};return s.samples=function(e){return r.zeros(e).map(s)},s}})),Zs=i(((e,t)=>{var n=ei(),r=Ys(),i=Xs(),a=t.exports;a.unique=function(e,t,r){t=n.$(t),r||=[];var i={},a,o,s;for(o=0,s=e.length;o<s;++o)a=t?t(e[o]):e[o],!(a in i)&&(i[a]=1,r.push(a));return r},a.count=function(e){return e&&e.length||0},a.count.valid=function(e,t){t=n.$(t);var r,i,a,o=0;for(i=0,a=e.length;i<a;++i)r=t?t(e[i]):e[i],n.isValid(r)&&(o+=1);return o},a.count.missing=function(e,t){t=n.$(t);var r,i,a,o=0;for(i=0,a=e.length;i<a;++i)r=t?t(e[i]):e[i],r??(o+=1);return o},a.count.distinct=function(e,t){t=n.$(t);var r={},i,a,o,s=0;for(a=0,o=e.length;a<o;++a)i=t?t(e[a]):e[a],!(i in r)&&(r[i]=1,s+=1);return s},a.count.map=function(e,t){t=n.$(t);var r={},i,a,o;for(a=0,o=e.length;a<o;++a)i=t?t(e[a]):e[a],r[i]=i in r?r[i]+1:1;return r},a.median=function(e,t){return t&&(e=e.map(n.$(t))),e=e.filter(n.isValid).sort(n.cmp),a.quantile(e,.5)},a.quartile=function(e,t){t&&(e=e.map(n.$(t))),e=e.filter(n.isValid).sort(n.cmp);var r=a.quantile;return[r(e,.25),r(e,.5),r(e,.75)]},a.quantile=function(e,t,r){r===void 0&&(r=t,t=n.identity),t=n.$(t);var i=(e.length-1)*r+1,a=Math.floor(i),o=+t(e[a-1]),s=i-a;return s?o+s*(t(e[a])-o):o},a.sum=function(e,t){t=n.$(t);for(var r=0,i=0,a=e.length,o;i<a;++i)o=t?t(e[i]):e[i],n.isValid(o)&&(r+=o);return r},a.mean=function(e,t){t=n.$(t);var r=0,i,a,o,s,c;for(a=0,s=0,o=e.length;a<o;++a)c=t?t(e[a]):e[a],n.isValid(c)&&(i=c-r,r+=i/++s);return r},a.mean.geometric=function(e,t){t=n.$(t);var r=1,i,a,o,s;for(s=0,i=0,a=e.length;s<a;++s)if(o=t?t(e[s]):e[s],n.isValid(o)){if(o<=0)throw Error(`Geometric mean only defined for positive values.`);r*=o,++i}return r=i>0?r**(1/i):0,r},a.mean.harmonic=function(e,t){t=n.$(t);var r=0,i,a,o,s;for(s=0,i=0,a=e.length;s<a;++s)o=t?t(e[s]):e[s],n.isValid(o)&&(r+=1/o,++i);return i/r},a.variance=function(e,t){if(t=n.$(t),!n.isArray(e)||e.length<2)return 0;var r=0,i=0,a,o,s,c;for(o=0,s=0;o<e.length;++o)c=t?t(e[o]):e[o],n.isValid(c)&&(a=c-r,r+=a/++s,i+=a*(c-r));return i/=s-1,i},a.stdev=function(e,t){return Math.sqrt(a.variance(e,t))},a.modeskew=function(e,t){var n=a.mean(e,t),r=a.median(e,t),i=a.stdev(e,t);return i===0?0:(n-r)/i},a.min=function(e,t){return a.extent(e,t)[0]},a.max=function(e,t){return a.extent(e,t)[1]},a.extent=function(e,t){t=n.$(t);var r,i,a,o,s=e.length;for(o=0;o<s;++o)if(a=t?t(e[o]):e[o],n.isValid(a)){r=i=a;break}for(;o<s;++o)a=t?t(e[o]):e[o],n.isValid(a)&&(a<r&&(r=a),a>i&&(i=a));return[r,i]},a.extent.index=function(e,t){t=n.$(t);var r=-1,i=-1,a,o,s,c,l=e.length;for(c=0;c<l;++c)if(s=t?t(e[c]):e[c],n.isValid(s)){a=o=s,r=i=c;break}for(;c<l;++c)s=t?t(e[c]):e[c],n.isValid(s)&&(s<a&&(a=s,r=c),s>o&&(o=s,i=c));return[r,i]},a.dot=function(e,t,r){var i=0,a,o;if(r)for(t=n.$(t),r=n.$(r),a=0;a<e.length;++a)o=t(e[a])*r(e[a]),o===o&&(i+=o);else{if(e.length!==t.length)throw Error(`Array lengths must match.`);for(a=0;a<e.length;++a)o=e[a]*t[a],o===o&&(i+=o)}return i},a.dist=function(e,t,r,i){var a=n.isFunction(r)||n.isString(r),o=e,s=a?e:t,c=a?i:r,l=c===2||c==null,u=e.length,d=0,f,p;for(a&&(t=n.$(t),r=n.$(r)),p=0;p<u;++p)f=a?t(o[p])-r(s[p]):o[p]-s[p],d+=l?f*f:Math.abs(f)**+c;return l?Math.sqrt(d):d**(1/c)},a.cohensd=function(e,t,r){var i=r?e.map(n.$(t)):e,o=r?e.map(n.$(r)):t,s=a.mean(i),c=a.mean(o),l=a.count.valid(i),u=a.count.valid(o);if(l+u-2<=0)return 0;var d=a.variance(i),f=a.variance(o),p=Math.sqrt(((l-1)*d+(u-1)*f)/(l+u-2));return p===0?0:(s-c)/p},a.covariance=function(e,t,r){var i=r?e.map(n.$(t)):e,o=r?e.map(n.$(r)):t,s=i.length,c=a.mean(i),l=a.mean(o),u=0,d=0,f,p,m,h,g;if(s!==o.length)throw Error(`Input lengths must match.`);for(f=0;f<s;++f)if(p=i[f],h=n.isValid(p),m=o[f],g=n.isValid(m),h&&g)u+=(p-c)*(m-l),++d;else if(h||g)throw Error(`Valid values must align.`);return u/(d-1)},a.rank=function(e,t){t=n.$(t)||n.identity;var r=e.map(function(e,n){return{idx:n,val:t(e)}}).sort(n.comparator(`val`)),i=e.length,a=Array(i),o=-1,s={},c,l,u;for(c=0;c<i;++c){if(l=r[c].val,o<0&&s===l)o=c-1;else if(o>-1&&s!==l){for(u=1+(c-1+o)/2;o<c;++o)a[r[o].idx]=u;o=-1}a[r[c].idx]=c+1,s=l}if(o>-1)for(u=1+(i-1+o)/2;o<i;++o)a[r[o].idx]=u;return a},a.cor=function(e,t,r){var i=r;r=i?e.map(n.$(r)):t,t=i?e.map(n.$(t)):e;var o=a.dot(t,r),s=a.mean(t),c=a.mean(r),l=a.stdev(t),u=a.stdev(r),d=e.length;return(o-d*s*c)/((d-1)*l*u)},a.cor.rank=function(e,t,n){var r=n?a.rank(e,t):a.rank(e),i=n?a.rank(e,n):a.rank(t),o=e.length,s,c,l;for(s=0,c=0;s<o;++s)l=r[s]-i[s],c+=l*l;return 1-6*c/(o*(o*o-1))},a.cor.dist=function(e,t,r){var i=r?e.map(n.$(t)):e,o=r?e.map(n.$(r)):t,s=a.dist.mat(i),c=a.dist.mat(o),l=s.length,u,d,f,p;for(u=0,d=0,f=0,p=0;u<l;++u)d+=s[u]*s[u],f+=c[u]*c[u],p+=s[u]*c[u];return Math.sqrt(p/Math.sqrt(d*f))},a.linearRegression=function(e,t,r){var i=r?e.map(n.$(t)):e,o=r?e.map(n.$(r)):t,s=i.length,c=a.covariance(i,o),l=a.stdev(i),u=a.stdev(o),d=c/(l*l),f=a.mean(o)-d*a.mean(i),p={slope:d,intercept:f,R:c/(l*u),rss:0},m,h;for(h=0;h<s;++h)n.isValid(i[h])&&n.isValid(o[h])&&(m=d*i[h]+f-o[h],p.rss+=m*m);return p},a.bootstrap={},a.bootstrap.ci=function(e,t,r,o,s){var c,l,u,d,f,p,m;for(n.isFunction(t)||n.isString(t)?(c=e.map(n.$(t)),l=r,u=o,d=s):(c=e,l=t,u=r,d=o),l=l?+l:1e3,u||=.05,f=i.random.bootstrap(c,d),m=0,p=Array(l);m<l;++m)p[m]=a.mean(f.samples(c.length));return p.sort(n.numcmp),[a.quantile(p,u/2),a.quantile(p,1-u/2)]},a.z={},a.z.ci=function(e,t,r){var o=e,s=t;(n.isFunction(t)||n.isString(t))&&(o=e.map(n.$(t)),s=r),s||=.05;var c=s===.05?1.96:i.random.normal(0,1).icdf(1-s/2),l=a.mean(o),u=a.stdev(o)/Math.sqrt(a.count.valid(o));return[l-c*u,l+c*u]},a.z.test=function(e,t,r,i){return n.isFunction(r)||n.isString(r)?(i&&i.paired?s:c)(i,e,t,r):n.isArray(t)?(r&&r.paired?s:c)(r,e,t):n.isFunction(t)||n.isString(t)?o(r,e,t):o(t,e)};function o(e,t,n){var r=e&&e.nullh||0,o=i.random.normal(0,1),s=a.mean(t,n),c=a.stdev(t,n)/Math.sqrt(a.count.valid(t,n));if(c===0)return+(s-r===0);var l=(s-r)/c;return 2*o.cdf(-Math.abs(l))}function s(e,t,r,i){var o=i?t.map(n.$(r)):t,s=i?t.map(n.$(i)):r,c=a.count(o),l=a.count(s),u=[],d;if(c!==l)throw Error(`Array lengths must match.`);for(d=0;d<c;++d)n.isValid(o[d])&&n.isValid(s[d])&&u.push(o[d]-s[d]);return a.z.test(u,e&&e.nullh||0)}function c(e,t,r,o){var s=o?t.map(n.$(r)):t,c=o?t.map(n.$(o)):r,l=a.count.valid(s),u=a.count.valid(c),d=i.random.normal(0,1),f=a.mean(s)-a.mean(c)-(e&&e.nullh||0),p=Math.sqrt(a.variance(s)/l+a.variance(c)/u);if(p===0)return+(f===0);var m=f/p;return 2*d.cdf(-Math.abs(m))}a.dist.mat=function(e){var t=e.length,n=t*t,r=Array(n),a=i.zeros(t),o=0,s,c,l;for(c=0;c<t;++c)for(r[c*t+c]=0,l=c+1;l<t;++l)r[c*t+l]=s=Math.abs(e[c]-e[l]),r[l*t+c]=s,a[c]+=s,a[l]+=s;for(c=0;c<t;++c)o+=a[c],a[c]/=t;for(o/=n,c=0;c<t;++c)for(l=c;l<t;++l)r[c*t+l]+=o-a[c]-a[l],r[l*t+c]=r[c*t+l];return r},a.entropy=function(e,t){t=n.$(t);var r,i,a=0,o=0,s=e.length;for(r=0;r<s;++r)a+=t?t(e[r]):e[r];if(a===0)return 0;for(r=0;r<s;++r)i=(t?t(e[r]):e[r])/a,i&&(o+=i*Math.log(i));return-o/Math.LN2},a.mutual=function(e,t,r,i){var a=i?e.map(n.$(t)):e,o=i?e.map(n.$(r)):t,s=i?e.map(n.$(i)):r,c={},l={},u=s.length,d=0,f=0,p=0,m,h,g;for(g=0;g<u;++g)c[a[g]]=0,l[o[g]]=0;for(g=0;g<u;++g)c[a[g]]+=s[g],l[o[g]]+=s[g],d+=s[g];for(h=1/(d*Math.LN2),g=0;g<u;++g)s[g]!==0&&(m=d*s[g]/(c[a[g]]*l[o[g]]),f+=s[g]*h*Math.log(m),p+=s[g]*h*Math.log(s[g]/d));return[f,1+f/p]},a.mutual.info=function(e,t,n,r){return a.mutual(e,t,n,r)[0]},a.mutual.dist=function(e,t,n,r){return a.mutual(e,t,n,r)[1]},a.profile=function(e,t){var i=0,o=0,s=0,c=0,l=null,u=null,d=0,f=[],p={},m,h,g,_,v;for(g=0;g<e.length;++g)_=t?t(e[g]):e[g],p[_]=_ in p?p[_]+1:(c+=1,1),_==null?++s:n.isValid(_)&&(v=typeof _==`string`?_.length:_,(l===null||v<l)&&(l=v),(u===null||v>u)&&(u=v),m=v-i,i+=m/++o,d+=m*(v-i),f.push(v));return d/=o-1,h=Math.sqrt(d),f.sort(n.cmp),{type:r(e,t),unique:p,count:e.length,valid:o,missing:s,distinct:c,min:l,max:u,mean:i,stdev:h,median:_=a.quantile(f,.5),q1:a.quantile(f,.25),q3:a.quantile(f,.75),modeskew:h===0?0:(i-_)/h}},a.summary=function(e,t){t||=n.keys(e[0]);var r=t.map(function(t){var r=a.profile(e,n.$(t));return r.field=t,r});return r.__summary__=!0,r}})),Qs=e(Js()),$s=Ys(),ec=Zs(),tc=Qs.default;function nc(e,t={},n={fields:[]}){t=(0,I.extend)({},ma,t);let r=(0,ec.summary)(e),i=(0,$s.inferAll)(e),a=n.fields.reduce((e,t)=>(e[t.name]=t,e),{}),o=r.map(function(n,r){let o=n.field,s=i[o]===`date`?X.DATETIME:i[o],c=n.distinct,l;if(s===X.NUMBER)l=P;else if(s===X.INTEGER)l=c<t.numberNominalLimit&&c/n.count<t.numberNominalProportion?Or:P;else if(s===X.DATETIME){l=Dr,n.min=new Date(e[0][o]),n.max=new Date(e[0][o]);for(let t of e){let e=new Date(t[o]).getTime();e<n.min.getTime()&&(n.min=new Date(e)),e>n.max.getTime()&&(n.max=new Date(e))}}else l=Or;l===`nominal`&&c/n.count>t.minPercentUniqueForKey&&n.count>t.minCardinalityForKey&&(l=Ra.KEY);let u={name:o,originalIndex:r,vlType:l,type:s,stats:n,timeStats:{},binStats:{}},d=a[u.name];return u=(0,I.extend)(u,d),u});for(let e of o)if(e.vlType===`quantitative`)for(let n of t.enum.binProps.maxbins)e.binStats[n]=ac(n,e.stats);else if(e.vlType===`temporal`)for(let n of t.enum.timeUnit)n!==void 0&&(e.timeStats[n]=oc(n,e.stats));return new ic(Object.assign({},n,{fields:o}))}var rc={nominal:0,key:1,ordinal:2,temporal:3,quantitative:4},ic=class{constructor(e){this._tableSchema=e,e.fields.sort(function(e,t){return rc[e.vlType]<rc[t.vlType]?-1:rc[e.vlType]>rc[t.vlType]?1:e.name.localeCompare(t.name)}),e.fields.forEach((e,t)=>e.index=t),this._fieldSchemaIndex=e.fields.reduce((e,t)=>(e[t.name]=t,e),{})}fieldNames(){return this._tableSchema.fields.map(e=>e.name)}get fieldSchemas(){return this._tableSchema.fields}fieldSchema(e){return this._fieldSchemaIndex[e]}tableSchema(){let e=(0,I.duplicate)(this._tableSchema);return e.fields.sort((e,t)=>e.originalIndex-t.originalIndex),e}primitiveType(e){return this._fieldSchemaIndex[e]?this._fieldSchemaIndex[e].type:null}vlType(e){return this._fieldSchemaIndex[e]?this._fieldSchemaIndex[e].vlType:null}cardinality(e,t=!0,n=!1){let r=this._fieldSchemaIndex[e.field];if(e.aggregate||K(e)&&e.autoCount)return 1;if(e.bin){let t;t=typeof e.bin==`boolean`?{maxbins:Ca(e.channel)}:e.bin===`?`?{enum:[!0,!1]}:e.bin;let n=t.maxbins;return r.binStats[n]||(r.binStats[n]=ac(n,r.stats)),r.binStats[n].distinct}if(e.timeUnit){if(t)switch(e.timeUnit){case B.SECONDS:return 60;case B.MINUTES:return 60;case B.HOURS:return 24;case B.DAY:return 7;case B.DATE:return 31;case B.MONTH:return 12;case B.QUARTER:return 4;case B.MILLISECONDS:return 1e3}let i=e.timeUnit,a=r.timeStats;return(!a||!a[i])&&(a=Object.assign({},a,{[i]:oc(e.timeUnit,r.stats)})),n?a[i].distinct-cc(a[i].unique,[`Invalid Date`,null]):a[i].distinct}return r?n?r.stats.distinct-cc(r.stats.unique,[NaN,null]):r.stats.distinct:null}timeUnitHasVariation(e){if(!e.timeUnit)return;if(e.timeUnit===B.DAY){let t=(0,I.extend)({},e,{timeUnit:B.DATE});if(this.cardinality(t,!1,!0)<=1)return!1}let t=e.timeUnit;for(let n of Hi)if(ta(t,n)){let t=(0,I.extend)({},e,{timeUnit:n});if(this.cardinality(t,!1,!0)<=1)return!1}return!0}domain(e){let t=this._fieldSchemaIndex[e.field],n=(0,I.keys)(t.stats.unique);return t.vlType===`quantitative`?[+t.stats.min,+t.stats.max]:t.type===X.DATETIME?[t.stats.min,t.stats.max]:t.type===X.INTEGER||t.type===X.NUMBER?(n=n.map(e=>+e),n.sort(I.cmp)):t.vlType===`ordinal`&&t.ordinalDomain?t.ordinalDomain:n.map(e=>e===`null`?null:e).sort(I.cmp)}stats(e){let t=this._fieldSchemaIndex[e.field];return t?t.stats:null}};function ac(e,t){let n=tc({min:t.min,max:t.max,maxbins:e}),r=(0,I.extend)({},t);return r.unique=sc(n,t.unique),r.distinct=(n.stop-n.start)/n.step,r.min=n.start,r.max=n.stop,r}function oc(e,t){let n=(0,I.extend)({},t),r={};return(0,I.keys)(t.unique).forEach(function(n){let i=n===`null`?null:new Date(n),a;a=i===null?null:isNaN(i.getTime())?`Invalid Date`:(e===B.DAY?i.getDay():$i(e,i)).toString(),r[a]=(r[a]||0)+t.unique[n]}),n.unique=r,n.distinct=(0,I.keys)(r).length,n}function sc(e,t){let n={};for(let r in t){let i;i=r===null?null:isNaN(Number(r))?NaN:e.value(Number(r)),n[i]=(n[i]||0)+t[r]}return n}function cc(e,t){return t.reduce(function(t,n){return e[n]?t+1:t},0)}var X;(function(e){e[e.STRING=`string`]=`STRING`,e[e.NUMBER=`number`]=`NUMBER`,e[e.INTEGER=`integer`]=`INTEGER`,e[e.BOOLEAN=`boolean`]=`BOOLEAN`,e[e.DATETIME=`datetime`]=`DATETIME`})(X||={});var lc=class{constructor(e){this.constraint=e}name(){return this.constraint.name}description(){return this.constraint.description}properties(){return this.constraint.properties}strict(){return this.constraint.strict}},uc=class extends lc{constructor(e){super(e)}hasAllRequiredPropertiesSpecific(e){return ti(this.constraint.properties,t=>{if(ai(t)){let n=t.parent,r=t.child;return!e[n]||!V(e[n][r])}return!e[t]||!V(e[t])})}satisfy(e,t,n,r){return!this.constraint.allowWildcardForProperties&&!this.hasAllRequiredPropertiesSpecific(e)||this.constraint.satisfy(e,t,n,r)}},dc=[{name:`aggregateOpSupportedByType`,description:`Aggregate function should be supported by data type.`,properties:[z.TYPE,z.AGGREGATE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>!e.aggregate||!za(e.type)},{name:`asteriskFieldWithCountOnly`,description:`Field="*" should be disallowed except aggregate="count"`,properties:[z.FIELD,z.AGGREGATE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>e.field===`*`==(e.aggregate===`count`)},{name:`minCardinalityForBin`,description:`binned quantitative field should not have too low cardinality`,properties:[z.BIN,z.FIELD,z.TYPE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>{if(e.bin&&e.type===`quantitative`){let n={channel:e.channel,field:e.field,type:e.type};return t.cardinality(n)>=r.minCardinalityForBin}return!0}},{name:`binAppliedForQuantitative`,description:`bin should be applied to quantitative field only.`,properties:[z.TYPE,z.BIN],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>!e.bin||e.type===P},{name:`channelFieldCompatible`,description:`encoding channel's range type be compatible with channel type.`,properties:[z.CHANNEL,z.TYPE,z.BIN,z.TIMEUNIT],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>{let i=Object.assign({field:`f`},vo(e,{schema:t,props:[`bin`,`timeUnit`,`type`]})),{compatible:a}=Fa(i,e.channel);return a?!0:!!((e.channel===`row`||e.channel===`column`)&&(Ui(i.timeUnit)||Gi(i.timeUnit)))}},{name:`hasFn`,description:`A field with as hasFn flag should have one of aggregate, timeUnit, or bin.`,properties:[z.AGGREGATE,z.BIN,z.TIMEUNIT],allowWildcardForProperties:!0,strict:!0,satisfy:(e,t,n,r)=>!e.hasFn||!!e.aggregate||!!e.bin||!!e.timeUnit},{name:`omitScaleZeroWithBinnedField`,description:`Do not use scale zero with binned field`,properties:[z.SCALE,wi(`scale`,`zero`),z.BIN],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>!(e.bin&&e.scale&&e.scale.zero===!0)},{name:`onlyOneTypeOfFunction`,description:`Only of of aggregate, autoCount, timeUnit, or bin should be applied at the same time.`,properties:[z.AGGREGATE,z.AUTOCOUNT,z.TIMEUNIT,z.BIN],allowWildcardForProperties:!0,strict:!0,satisfy:(e,t,n,r)=>!G(e)||(!V(e.aggregate)&&e.aggregate?1:0)+(!V(e.bin)&&e.bin?1:0)+(!V(e.timeUnit)&&e.timeUnit?1:0)<=1},{name:`timeUnitAppliedForTemporal`,description:`Time unit should be applied to temporal field only.`,properties:[z.TYPE,z.TIMEUNIT],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>!(e.timeUnit&&e.type!==`temporal`)},{name:`timeUnitShouldHaveVariation`,description:`A particular time unit should be applied only if they produce unique values.`,properties:[z.TIMEUNIT,z.TYPE],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n,r)=>e.timeUnit&&e.type===`temporal`?!n.has(`timeUnit`)&&!r.constraintManuallySpecifiedValue||t.timeUnitHasVariation(e):!0},{name:`scalePropertiesSupportedByScaleType`,description:`Scale properties must be supported by correct scale type`,properties:[].concat(hi,[z.SCALE,z.TYPE]),allowWildcardForProperties:!0,strict:!0,satisfy:(e,t,n,r)=>{if(e.scale){let t=e.scale,n=xo(e);if(n==null)return!0;for(let e in t){if(e===`type`||e===`name`||e===`enum`)continue;let t=e;if(n===`point`){if(!Jr(`point`,t)&&!Jr(`band`,t))return!1}else if(!Jr(n,t))return!1}}return!0}},{name:`scalePropertiesSupportedByChannel`,description:`Not all scale properties are supported by all encoding channels`,properties:[].concat(hi,[z.SCALE,z.CHANNEL]),allowWildcardForProperties:!0,strict:!0,satisfy:(e,t,n,r)=>{if(e){let t=e.channel,n=e.scale;if(t&&!V(t)&&n){if(t===`row`||t===`column`)return!1;for(let e in n)if(n.hasOwnProperty(e)&&e!==`type`&&e!==`name`&&e!==`enum`&&Yr(t,e)!==void 0)return!1}}return!0}},{name:`typeMatchesPrimitiveType`,description:`Data type should be supported by field's primitive type.`,properties:[z.FIELD,z.TYPE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>{if(e.field===`*`)return!0;let i=t.primitiveType(e.field),a=e.type;if(!n.has(`field`)&&!n.has(`type`)&&!r.constraintManuallySpecifiedValue)return!0;switch(i){case X.BOOLEAN:case X.STRING:return a!==`quantitative`&&a!==`temporal`;case X.NUMBER:case X.INTEGER:return a!==Dr;case X.DATETIME:return a===Dr;case null:return!1}throw Error(`Not implemented`)}},{name:`typeMatchesSchemaType`,description:`Enumerated data type of a field should match the field's type in the schema.`,properties:[z.FIELD,z.TYPE],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n,r)=>!n.has(`field`)&&!n.has(`type`)&&!r.constraintManuallySpecifiedValue?!0:e.field===`*`?e.type===P:t.vlType(e.field)===e.type},{name:`maxCardinalityForCategoricalColor`,description:`Categorical channel should not have too high cardinality`,properties:[z.CHANNEL,z.FIELD],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n,r)=>e.channel===`color`&&(e.type===`nominal`||e.type===Ra.KEY)?t.cardinality(e)<=r.maxCardinalityForCategoricalColor:!0},{name:`maxCardinalityForFacet`,description:`Row/column channel should not have too high cardinality`,properties:[z.CHANNEL,z.FIELD,z.BIN,z.TIMEUNIT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n,r)=>e.channel===`row`||e.channel===`column`?t.cardinality(e)<=r.maxCardinalityForFacet:!0},{name:`maxCardinalityForShape`,description:`Shape channel should not have too high cardinality`,properties:[z.CHANNEL,z.FIELD,z.BIN,z.TIMEUNIT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n,r)=>e.channel!==`shape`||t.cardinality(e)<=r.maxCardinalityForShape},{name:`dataTypeAndFunctionMatchScaleType`,description:`Scale type must match data type`,properties:[z.TYPE,z.SCALE,wi(`scale`,`type`),z.TIMEUNIT,z.BIN],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>{if(e.scale){let t=e.type,n=xo(e);if(za(t))return n===void 0||Lr(n);if(t===`temporal`)return e.timeUnit?L([F.TIME,F.UTC,void 0],n)||Lr(n):L([F.TIME,F.UTC,void 0],n);if(t===`quantitative`)return e.bin?L([F.LINEAR,void 0],n):L([F.LOG,F.POW,F.SQRT,F.QUANTILE,F.QUANTIZE,F.LINEAR,void 0],n)}return!0}},{name:`stackIsOnlyUsedWithXY`,description:`stack should only be allowed for x and y channels`,properties:[z.STACK,z.CHANNEL],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>!e.stack||e.channel===`x`||e.channel===`y`}].map(e=>new uc(e));dc.reduce((e,t)=>(e[t.name()]=t,e),{});var fc=dc.reduce((e,t)=>{for(let n of t.properties())e.set(n,e.get(n)||[]),e.get(n).push(t);return e},new U),pc=[{name:`doesNotSupportConstantValue`,description:`row, column, x, y, order, and detail should not work with constant values.`,properties:[z.TYPE,z.AGGREGATE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>!L([`row`,`column`,`x`,`y`,`detail`,`order`],e.channel)}].map(e=>new uc(e));pc.reduce((e,t)=>(e[t.name()]=t,e),{});var mc=pc.reduce((e,t)=>{for(let n of t.properties())e.set(n,e.get(n)||[]),e.get(n).push(t);return e},new U);function hc(e,t,n,r,i,a){let o=fc.get(e)||[],s=r.getEncodingQueryByIndex(n);for(let e of o)if((e.strict()||a[e.name()])&&!e.satisfy(s,i,r.wildcardIndex.encodings[n],a)){let n=`(enc) `+e.name();return a.verbose&&console.log(n+` failed with `+r.toShorthand()+` for `+t.name),n}let c=mc.get(e)||[];for(let e of c)if((e.strict()||a[e.name()])&&W(s)&&!e.satisfy(s,i,r.wildcardIndex.encodings[n],a)){let n=`(enc) `+e.name();return a.verbose&&console.log(n+` failed with `+r.toShorthand()+` for `+t.name),n}return null}var gc=Lt.reduce((e,t)=>(e[t]=!0,e),{}),_c=class extends lc{constructor(e){super(e)}hasAllRequiredPropertiesSpecific(e){return ti(this.constraint.properties,t=>{if(t===z.MARK)return!V(e.getMark());if(ai(t)){let n=t.parent,r=t.child;return ti(e.getEncodings(),e=>!e[n]||!V(e[n][r]))}if(!Ti(t))throw Error(`UNIMPLEMENTED`);return ti(e.getEncodings(),e=>!e[t]||!V(e[t]))})}satisfy(e,t,n){return!this.constraint.allowWildcardForProperties&&!this.hasAllRequiredPropertiesSpecific(e)||this.constraint.satisfy(e,t,n)}},vc=[{name:`noRepeatedChannel`,description:`Each encoding channel should only be used once.`,properties:[z.CHANNEL],allowWildcardForProperties:!0,strict:!0,satisfy:(e,t,n)=>{let r={};return ti(e.getEncodings(),e=>V(e.channel)?!0:!r[e.channel]&&(r[e.channel]=!0,!0))}},{name:`alwaysIncludeZeroInScaleWithBarMark`,description:`Do not recommend bar mark if scale does not start at zero`,properties:[z.MARK,z.SCALE,wi(`scale`,`zero`),z.CHANNEL,z.TYPE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n)=>{let r=e.getMark(),i=e.getEncodings();if(r===`bar`){for(let e of i)if(G(e)&&(e.channel===`x`||e.channel===`y`)&&e.type===`quantitative`&&e.scale&&e.scale.zero===!1)return!1}return!0}},{name:`autoAddCount`,description:`Automatically adding count only for plots with only ordinal, binned quantitative, or temporal with timeunit fields.`,properties:[z.BIN,z.TIMEUNIT,z.TYPE,z.AUTOCOUNT],allowWildcardForProperties:!0,strict:!1,satisfy:(e,t,n)=>ni(e.getEncodings(),e=>mo(e))?ti(e.getEncodings(),e=>{if(W(e)||K(e))return!0;switch(e.type){case P:return!!e.bin;case Dr:return!!e.timeUnit;case Er:case Ra.KEY:case Or:return!0}throw Error(`Unsupported Type`)}):!ti(e.wildcardIndex.encodingIndicesByProperty.get(`autoCount`)||[],t=>{let n=e.getEncodingQueryByIndex(t);return K(n)&&!V(n.autoCount)})||ni(e.getEncodings(),e=>(G(e)||K(e))&&e.type===`quantitative`?!q(e)&&G(e)&&(!e.bin||V(e.bin)):G(e)&&e.type===`temporal`?!e.timeUnit||V(e.timeUnit):!1)},{name:`channelPermittedByMarkType`,description:`Each encoding channel should be supported by the mark type`,properties:[z.CHANNEL,z.MARK],allowWildcardForProperties:!0,strict:!0,satisfy:(e,t,n)=>{let r=e.getMark();return V(r)?!0:ti(e.getEncodings(),e=>V(e.channel)?!0:!!Jt(e.channel,r))}},{name:`hasAllRequiredChannelsForMark`,description:`All required channels for the specified mark should be specified`,properties:[z.CHANNEL,z.MARK],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n)=>{let r=e.getMark();switch(r){case Oi:case ki:return e.channelUsed(`x`)&&e.channelUsed(`y`);case Ni:return e.channelUsed(st);case`bar`:case Fi:case Ii:case Pi:case Mi:case ji:return e.channelUsed(`x`)||e.channelUsed(`y`);case Ai:return!e.wildcardIndex.hasProperty(z.CHANNEL)||e.channelUsed(`x`)||e.channelUsed(`y`)}throw Error(`hasAllRequiredChannelsForMark not implemented for mark`+JSON.stringify(r))}},{name:`omitAggregate`,description:`Omit aggregate plots.`,properties:[z.AGGREGATE,z.AUTOCOUNT],allowWildcardForProperties:!0,strict:!1,satisfy:(e,t,n)=>!e.isAggregate()},{name:`omitAggregatePlotWithDimensionOnlyOnFacet`,description:`Omit aggregate plots with dimensions only on facets as that leads to inefficient use of space.`,properties:[z.CHANNEL,z.AGGREGATE,z.AUTOCOUNT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>{if(e.isAggregate()){let t=!1,r=!1,i=!1;if(e.specQuery.encodings.forEach((n,a)=>{W(n)||q(n)||G(n)&&!n.aggregate&&(r=!0,L([`row`,`column`],n.channel)?e.wildcardIndex.hasEncodingProperty(a,z.CHANNEL)&&(i=!0):t=!0)}),r&&!t&&(i||n.constraintManuallySpecifiedValue))return!1}return!0}},{name:`omitAggregatePlotWithoutDimension`,description:`Aggregate plots without dimension should be omitted`,properties:[z.AGGREGATE,z.AUTOCOUNT,z.BIN,z.TIMEUNIT,z.TYPE],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>!e.isAggregate()||ni(e.getEncodings(),e=>!!(bo(e)||G(e)&&e.type===`temporal`))},{name:`omitBarLineAreaWithOcclusion`,description:`Don't use bar, line or area to visualize raw plot as they often lead to occlusion.`,properties:[z.MARK,z.AGGREGATE,z.AUTOCOUNT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>!L([`bar`,`line`,`area`],e.getMark())||e.isAggregate()},{name:`omitBarTickWithSize`,description:`Do not map field to size channel with bar and tick mark`,properties:[z.CHANNEL,z.MARK],allowWildcardForProperties:!0,strict:!1,satisfy:(e,t,n)=>{if(L([`tick`,`bar`],e.getMark())&&e.channelEncodingField(`size`)){if(n.constraintManuallySpecifiedValue)return!1;{let t=e.specQuery.encodings;for(let n=0;n<t.length;n++)if(t[n].channel===`size`)return!e.wildcardIndex.hasEncodingProperty(n,z.CHANNEL)}}return!0}},{name:`omitBarAreaForLogScale`,description:`Do not use bar and area mark for x and y's log scale`,properties:[z.MARK,z.CHANNEL,z.SCALE,wi(`scale`,`type`),z.TYPE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n)=>{let r=e.getMark(),i=e.getEncodings();if(r===`area`||r===`bar`){for(let e of i)if(G(e)&&(e.channel===`x`||e.channel===`y`)&&e.scale&&xo(e)===F.LOG)return!1}return!0}},{name:`omitMultipleNonPositionalChannels`,description:`Unless manually specified, do not use multiple non-positional encoding channel to avoid over-encoding.`,properties:[z.CHANNEL],allowWildcardForProperties:!0,strict:!1,satisfy:(e,t,n)=>{let r=e.specQuery.encodings,i=0,a=!1;for(let t=0;t<r.length;t++){let o=r[t];if(W(o)||q(o))continue;let s=o.channel;if(!V(s)&&gc[s+``]&&(i+=1,e.wildcardIndex.hasEncodingProperty(t,z.CHANNEL)&&(a=!0),i>1&&(a||n.constraintManuallySpecifiedValue)))return!1}return!0}},{name:`omitNonPositionalOrFacetOverPositionalChannels`,description:`Do not use non-positional channels unless all positional channels are used`,properties:[z.CHANNEL],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>{let r=e.specQuery.encodings,i=!1,a=!1,o=!1,s=!1;for(let t=0;t<r.length;t++){let n=r[t];if(W(n)||q(n))continue;let c=n.channel;c===`x`?o=!0:c===`y`?s=!0:V(c)||(i=!0,e.wildcardIndex.hasEncodingProperty(t,z.CHANNEL)&&(a=!0))}return a||n.constraintManuallySpecifiedValue&&i?o&&s:!0}},{name:`omitRaw`,description:`Omit raw plots.`,properties:[z.AGGREGATE,z.AUTOCOUNT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>!!e.isAggregate()},{name:`omitRawContinuousFieldForAggregatePlot`,description:`Aggregate plot should not use raw continuous field as group by values. (Quantitative should be binned. Temporal should have time unit.)`,properties:[z.AGGREGATE,z.AUTOCOUNT,z.TIMEUNIT,z.BIN,z.TYPE],allowWildcardForProperties:!0,strict:!1,satisfy:(e,t,n)=>{if(e.isAggregate()){let t=e.specQuery.encodings;for(let r=0;r<t.length;r++){let i=t[r];if(!(W(i)||q(i))&&(G(i)&&i.type===`temporal`&&!i.timeUnit&&(e.wildcardIndex.hasEncodingProperty(r,z.TIMEUNIT)||n.constraintManuallySpecifiedValue)||i.type===`quantitative`&&G(i)&&!i.bin&&!i.aggregate&&(e.wildcardIndex.hasEncodingProperty(r,z.BIN)||e.wildcardIndex.hasEncodingProperty(r,z.AGGREGATE)||e.wildcardIndex.hasEncodingProperty(r,z.AUTOCOUNT)||n.constraintManuallySpecifiedValue)))return!1}}return!0}},{name:`omitRawDetail`,description:`Do not use detail channel with raw plot.`,properties:[z.CHANNEL,z.AGGREGATE,z.AUTOCOUNT],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n)=>e.isAggregate()?!0:ti(e.specQuery.encodings,(t,r)=>W(t)||q(t)?!0:!(t.channel===`detail`&&(e.wildcardIndex.hasEncodingProperty(r,z.CHANNEL)||n.constraintManuallySpecifiedValue)))},{name:`omitRepeatedField`,description:`Each field should be mapped to only one channel`,properties:[z.FIELD],allowWildcardForProperties:!0,strict:!1,satisfy:(e,t,n)=>{let r={},i={},a=e.specQuery.encodings;for(let t=0;t<a.length;t++){let o=a[t];if(W(o)||K(o))continue;let s;if(o.field&&!V(o.field)&&(s=o.field),K(o)&&!V(o.autoCount)&&(s=`count_*`),s){if(e.wildcardIndex.hasEncodingProperty(t,z.FIELD)&&(i[s]=!0),r[s]&&(i[s]||n.constraintManuallySpecifiedValue))return!1;r[s]=!0}}return!0}},{name:`omitVerticalDotPlot`,description:`Do not output vertical dot plot.`,properties:[z.CHANNEL],allowWildcardForProperties:!0,strict:!1,satisfy:(e,t,n)=>{let r=e.getEncodings();return r.length!==1||r[0].channel!==`y`}},{name:`hasAppropriateGraphicTypeForMark`,description:`Has appropriate graphic type for mark`,properties:[z.CHANNEL,z.MARK,z.TYPE,z.TIMEUNIT,z.BIN,z.AGGREGATE,z.AUTOCOUNT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>{let r=e.getMark();switch(r){case Oi:case ki:if(e.isAggregate()){let t=e.getEncodingQueryByChannel(`x`),n=e.getEncodingQueryByChannel(`y`),r=yo(t),i=yo(n);return t&&n&&r!==i&&!(G(t)&&!r&&L([`nominal`,`key`],t.type))&&!(G(n)&&!i&&L([`nominal`,`key`],n.type))}return!0;case Ni:return!0;case`bar`:case Pi:if(e.channelEncodingField(`size`))return!1;{let t=e.getEncodingQueryByChannel(`x`),n=e.getEncodingQueryByChannel(`y`);return yo(t)!==yo(n)}case ji:let t=e.getEncodingQueryByChannel(`x`),n=e.getEncodingQueryByChannel(`y`),r=bo(t),i=bo(n),a=e.getEncodingQueryByChannel(Qe),o=yo(a),s=G(a)?a.type===Er:!1;return(r&&i||r&&!e.channelUsed(`y`)||i&&!e.channelUsed(`x`))&&(!a||a&&(o||s));case Fi:case Ai:case Ii:case Mi:return!0}throw Error(`hasAllRequiredChannelsForMark not implemented for mark`+r)}},{name:`omitInvalidStackSpec`,description:`If stack is specified, must follow Vega-Lite stack rules`,properties:[z.STACK,z.FIELD,z.CHANNEL,z.MARK,z.AGGREGATE,z.AUTOCOUNT,z.SCALE,wi(`scale`,`type`),z.TYPE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n)=>{if(!e.wildcardIndex.hasProperty(z.STACK))return!0;let r=e.getVlStack();return!(r===null&&e.getStackOffset()!==null||r.fieldChannel!==e.getStackChannel())}},{name:`omitNonSumStack`,description:`Stack specifications that use non-summative aggregates should be omitted (even implicit ones)`,properties:[z.CHANNEL,z.MARK,z.AGGREGATE,z.AUTOCOUNT,z.SCALE,wi(`scale`,`type`),z.TYPE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n)=>{let r=e.getVlStack();return!(r!=null&&!L(ya,e.getEncodingQueryByChannel(r.fieldChannel).aggregate))}},{name:`omitTableWithOcclusionIfAutoAddCount`,description:`Plots without aggregation or autocount where x and y are both discrete should be omitted if autoAddCount is enabled as they often lead to occlusion`,properties:[z.CHANNEL,z.TYPE,z.TIMEUNIT,z.BIN,z.AGGREGATE,z.AUTOCOUNT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>{if(n.autoAddCount){let t=e.getEncodingQueryByChannel(`x`),n=e.getEncodingQueryByChannel(`y`);if((!G(t)||bo(t))&&(!G(n)||bo(n)))return e.isAggregate()?ti(e.getEncodings(),e=>{let t=e.channel;return!(t!==`x`&&t!==`y`&&t!==`row`&&t!==`column`&&G(e)&&!e.aggregate)}):!1}return!0}}].map(e=>new _c(e));vc.reduce((e,t)=>(e[t.name()]=t,e),{});var yc=vc.reduce((e,t)=>{for(let n of t.properties())e.set(n,e.get(n)||[]),e.get(n).push(t);return e},new U);function bc(e,t,n,r,i){let a=yc.get(e)||[];for(let e of a)if((e.strict()||i[e.name()])&&!e.satisfy(n,r,i)){let r=`(spec) `+e.name();return i.verbose&&console.log(r+` failed with `+n.toShorthand()+` for `+t.name),r}return null}var xc=new U;function Sc(e){return xc.get(e)}xc.set(`mark`,(e,t,n)=>(r,i)=>(i.getMark().enum.forEach(a=>{i.setMark(a),bc(`mark`,e.mark,i,t,n)||r.push(i.duplicate())}),i.resetMark(),r)),si.forEach(e=>{xc.set(e,Cc(e))}),vi.forEach(e=>{xc.set(e,Cc(e))});function Cc(e){return(t,n,r)=>(i,a)=>{let o=t.encodingIndicesByProperty.get(e);function s(c){if(c===o.length){i.push(a.duplicate());return}let l=o[c],u=t.encodings[l].get(e),d=a.getEncodingQueryByIndex(l),f=a.getEncodingProperty(l,e);W(d)||q(d)||!f?s(c+1):(u.enum.forEach(t=>{t===null&&(t=void 0),a.setEncodingProperty(l,e,t,u),!hc(e,u,l,a,n,r)&&(bc(e,u,a,n,r)||s(c+1))}),a.resetEncodingProperty(l,e,u))}return s(0),i}}function wc(e){return(0,I.isObject)(e)&&!!e.property}function Tc(e,t,n){return t||=new U,n||=new U,e.forEach(e=>{wc(e)?(t.setByKey(e.property,!0),n.setByKey(e.property,e.replace)):t.setByKey(e,!0)}),{include:t,replaceIndex:n,replacer:$a(n)}}var Ec=[z.FIELD,z.TYPE,z.AGGREGATE,z.BIN,z.TIMEUNIT,z.STACK],Dc=Ec.concat([{property:z.CHANNEL,replace:{x:`xy`,y:`xy`,color:`style`,size:`style`,shape:`style`,opacity:`style`,row:`facet`,column:`facet`}}]),Oc={};function kc(e,t){Oc[e]=t}var Ac=`field`,jc=`fieldTransform`,Mc=`encoding`,Nc=`spec`;function Pc(e,t){if(t){let n={name:``,path:``,items:[]},r={},i=[],a=[],o=[];for(let e=0;e<t.length;e++){i.push(e>0?i[e-1].duplicate():new U),a.push(e>0?a[e-1].duplicate():new U);let n=t[e].groupBy;if((0,I.isArray)(n)){let t=Tc(n,i[e],a[e]);o.push(t.replacer)}}return e.forEach(e=>{let a=``,s=n;for(let n=0;n<t.length;n++){let c=s.groupBy=t[n].groupBy;s.orderGroupBy=t[n].orderGroupBy;let l=(0,I.isArray)(c)?oo(e.specQuery,i[n],o[n]):Oc[c](e.specQuery);a+=`/`+l,r[a]||(r[a]={name:l,path:a,items:[]},s.items.push(r[a])),s=r[a]}s.items.push(e)}),n}return{name:``,path:``,items:e}}var Fc=Tc([z.FIELD]);function Ic(e,t){return Oc[t](e)}kc(Ac,e=>oo(e,Fc.include,Fc.replacer));var Lc=Tc(Ec);kc(jc,e=>oo(e,Lc.include,Lc.replacer));var Rc=Tc(Dc);kc(Mc,e=>oo(e,Rc.include,Rc.replacer)),kc(Nc,e=>JSON.stringify(e));var zc=class{constructor(){this._mark=void 0,this._encodings={},this._encodingIndicesByProperty=new U}setEncodingProperty(e,t,n){let r=this._encodings;(r[e]=r[e]||new U).set(t,n);let i=this._encodingIndicesByProperty;return i.set(t,i.get(t)||[]),i.get(t).push(e),this}hasEncodingProperty(e,t){return!!this._encodings[e]&&this._encodings[e].has(t)}hasProperty(e){if(Ti(e))return this.encodingIndicesByProperty.has(e);if(e===`mark`)return!!this.mark;throw Error(`Unimplemented for property `+e)}isEmpty(){return!this.mark&&this.encodingIndicesByProperty.size()===0}setMark(e){return this._mark=e,this}get mark(){return this._mark}get encodings(){return this._encodings}get encodingIndicesByProperty(){return this._encodingIndicesByProperty}},Bc=class e{constructor(e,t,n,r,i){this._rankingScore={},this._spec=e,this._channelFieldCount=e.encodings.reduce((e,t)=>(!V(t.channel)&&(!K(t)||t.autoCount!==!1)&&(e[t.channel+``]=1),e),{}),this._wildcardIndex=t,this._assignedWildcardIndex=i,this._opt=r,this._schema=n}static build(t,n,r){let i=new zc;if(V(t.mark)){let e=sa(z.MARK);t.mark=ia(t.mark,e,r.enum.mark),i.setMark(t.mark)}if(t.encodings.forEach((e,t)=>{K(e)&&(console.warn(`A field with autoCount should not be included as autoCount meant to be an internal object.`),e.type=P),G(e)&&e.type===void 0&&(e.type=`?`),si.forEach(a=>{if(V(e[a])){let o=sa(a)+t,s=pa(a,n,r),c=e[a]=ia(e[a],o,s);i.setEncodingProperty(t,a,c)}}),vi.forEach(a=>{let o=e[a.parent];if(o){let e=a.child;if(V(o[e])){let s=sa(a)+t,c=pa(a,n,r),l=o[e]=ia(o[e],s,c);i.setEncodingProperty(t,a,l)}}})}),r.autoAddCount){let e={name:sa(z.CHANNEL)+t.encodings.length,enum:pa(z.CHANNEL,n,r)},a={name:sa(z.AUTOCOUNT)+t.encodings.length,enum:[!1,!0]},o={channel:e,autoCount:a,type:P};t.encodings.push(o);let s=t.encodings.length-1;i.setEncodingProperty(s,z.CHANNEL,e),i.setEncodingProperty(s,z.AUTOCOUNT,a)}return new e(t,i,n,r,{})}get wildcardIndex(){return this._wildcardIndex}get schema(){return this._schema}get specQuery(){return this._spec}duplicate(){return new e((0,I.duplicate)(this._spec),this._wildcardIndex,this._schema,this._opt,(0,I.duplicate)(this._assignedWildcardIndex))}setMark(e){let t=this._wildcardIndex.mark.name;this._assignedWildcardIndex[t]=this._spec.mark=e}resetMark(){let e=this._spec.mark=this._wildcardIndex.mark;delete this._assignedWildcardIndex[e.name]}getMark(){return this._spec.mark}getEncodingProperty(e,t){let n=this._spec.encodings[e];return ai(t)?n[t.parent][t.child]:n[t]}setEncodingProperty(e,t,n,r){let i=this._spec.encodings[e];t===z.CHANNEL&&i.channel&&!V(i.channel)&&this._channelFieldCount[i.channel]--,ai(t)?i[t.parent][t.child]=n:i[t]=ui(t)&&n===!0?(0,I.extend)({},i[t],{enum:void 0,name:void 0}):n,this._assignedWildcardIndex[r.name]=n,t===z.CHANNEL&&(this._channelFieldCount[n]=(this._channelFieldCount[n]||0)+1)}resetEncodingProperty(e,t,n){let r=this._spec.encodings[e];t===z.CHANNEL&&this._channelFieldCount[r.channel]--,ai(t)?r[t.parent][t.child]=n:r[t]=n,delete this._assignedWildcardIndex[n.name]}channelUsed(e){return this._channelFieldCount[e]>0}channelEncodingField(e){return G(this.getEncodingQueryByChannel(e))}getEncodings(){return this._spec.encodings.filter(e=>!q(e))}getEncodingQueryByChannel(e){for(let t of this._spec.encodings)if(t.channel===e)return t}getEncodingQueryByIndex(e){return this._spec.encodings[e]}isAggregate(){return qa(this._spec)}getVlStack(){return Ja(this._spec)}getStackOffset(){return Ya(this._spec)}getStackChannel(){return Xa(this._spec)}toShorthand(e){if(e){if((0,I.isString)(e))return Ic(this.specQuery,e);let t=Tc(e);return oo(this._spec,t.include,t.replacer)}return oo(this._spec)}toSpec(e){if(V(this._spec.mark))return null;let t={};return e||=this._spec.data,e&&(t.data=e),this._spec.transform&&(t.transform=this._spec.transform),t.mark=this._spec.mark,t.encoding=go(this.specQuery.encodings,{schema:this._schema,wildcardMode:`null`}),this._spec.width&&(t.width=this._spec.width),this._spec.height&&(t.height=this._spec.height),this._spec.background&&(t.background=this._spec.background),this._spec.padding&&(t.padding=this._spec.padding),this._spec.title&&(t.title=this._spec.title),t.encoding===null?null:((this._spec.config||this._opt.defaultSpecConfig)&&(t.config=(0,I.extend)({},this._opt.defaultSpecConfig,this._spec.config)),t)}getRankingScore(e){return this._rankingScore[e]}setRankingScore(e,t){this._rankingScore[e]=t}};function Vc(e){if(e.groupBy){let t={groupBy:e.groupBy};e.orderBy&&(t.orderGroupBy=e.orderBy);let n={spec:(0,I.duplicate)(e.spec),nest:[t]};return e.chooseBy&&(n.chooseBy=e.chooseBy),e.config&&(n.config=e.config),n}return(0,I.duplicate)(e)}function Hc(e){return e.items!==void 0}function Uc(e){let t=e.items[0];for(;t&&Hc(t);)t=t.items[0];return t}var Wc=class{constructor(e){this.type=e,this.scoreIndex=this.initScore()}getFeatureScore(e){let t=this.type,n=this.scoreIndex[e];if(n!==void 0)return{type:t,feature:e,score:n}}},Z;(function(e){e[e.Q=P]=`Q`,e[e.BIN_Q=`bin_`+P]=`BIN_Q`,e[e.T=Dr]=`T`,e[e.TIMEUNIT_T=`timeUnit_time`]=`TIMEUNIT_T`,e[e.TIMEUNIT_O=`timeUnit_`+Er]=`TIMEUNIT_O`,e[e.O=Er]=`O`,e[e.N=Or]=`N`,e[e.K=Ra.KEY]=`K`,e[e.NONE=`-`]=`NONE`})(Z||={});var Gc=Z.Q,Kc=Z.BIN_Q,qc=Z.T,Jc=Z.TIMEUNIT_T,Yc=Z.TIMEUNIT_O,Xc=Z.O,Zc=Z.N,Qc=Z.K,$c=Z.NONE;function el(e){return e.bin?Z.BIN_Q:e.timeUnit?Lr(xo(e))?Z.TIMEUNIT_O:Z.TIMEUNIT_T:e.type}var tl=class extends Wc{constructor(){super(`Axis`)}initScore(e={}){e=Object.assign({},ma,e);let t={};return[{feature:Kc,opt:`preferredBinAxis`},{feature:qc,opt:`preferredTemporalAxis`},{feature:Jc,opt:`preferredTemporalAxis`},{feature:Yc,opt:`preferredTemporalAxis`},{feature:Xc,opt:`preferredOrdinalAxis`},{feature:Zc,opt:`preferredNominalAxis`}].forEach(n=>{e[n.opt]===`x`?t[n.feature+`_y`]=-.01:e[n.opt]===`y`&&(t[n.feature+`_x`]=-.01)}),t}featurize(e,t){return e+`_`+t}getScore(e,t,n){return e.getEncodings().reduce((e,t)=>{if(G(t)||K(t)){let n=el(t),r=this.featurize(n,t.channel),i=this.getFeatureScore(r);i&&e.push(i)}return e},[])}},nl=class extends Wc{constructor(){super(`Dimension`)}initScore(){return{row:-2,column:-2,color:0,opacity:0,size:0,shape:0}}getScore(e,t,n){return e.isAggregate()&&e.getEncodings().reduce((e,t)=>{if(K(t)||G(t)&&!t.aggregate){let n=this.getFeatureScore(t.channel+``);if(n&&n.score>e.score)return n}return e},{type:`Dimension`,feature:`No Dimension`,score:-5}),[]}},rl=class extends Wc{constructor(){super(`Facet`)}initScore(e){e=Object.assign({},ma,e);let t={};return e.preferredFacet===`row`?t[Ke]=-.01:e.preferredFacet===`column`&&(t.row=-.01),t}getScore(e,t,n){return e.getEncodings().reduce((e,t)=>{if(G(t)||K(t)){let n=this.getFeatureScore(t.channel);n&&e.push(n)}return e},[])}},il=class extends Wc{constructor(){super(`SizeChannel`)}initScore(){return{bar_size:-2,tick_size:-2}}getScore(e,t,n){let r=e.getMark();return e.getEncodings().reduce((e,t)=>{if(G(t)||K(t)){let n=r+`_`+t.channel,i=this.getFeatureScore(n);i&&e.push(i)}return e},[])}},al=class extends Wc{constructor(){super(`TypeChannel`)}initScore(){let e={},t={x:0,y:0,size:-.575,color:-.725,text:-2,opacity:-3,shape:-10,row:-10,column:-10,detail:-20};[Gc,qc,Jc].forEach(n=>{(0,I.keys)(t).forEach(r=>{e[this.featurize(n,r)]=t[r]})});let n=(0,I.extend)({},t,{row:-.75,column:-.75,shape:-3.1,text:-3.2,detail:-4});[Kc,Yc,Xc].forEach(t=>{(0,I.keys)(n).forEach(r=>{e[this.featurize(t,r)]=n[r]})});let r={x:0,y:0,color:-.6,shape:-.65,row:-.7,column:-.7,text:-.8,detail:-2,size:-3,opacity:-3.1};return(0,I.keys)(r).forEach(t=>{e[this.featurize(Zc,t)]=r[t],e[this.featurize(Qc,t)]=L([`x`,`y`,`detail`],t)?-1:r[t]-2}),e}featurize(e,t){return e+`_`+t}getScore(e,t,n){let r=e.getEncodings().reduce((e,t)=>{if(G(t)||K(t)){let n=co(t);(e[n]=e[n]||[]).push(t)}return e},{}),i=[];return R(r,e=>{let t=e.reduce((e,t)=>{if(G(t)||K(t)){let n=el(t),r=this.featurize(n,t.channel),i=this.getFeatureScore(r);if(e===null||i.score>e.score)return i}return e},null);i.push(t)}),i}},ol=class extends Wc{constructor(){super(`Mark`)}initScore(){return sl()}getScore(e,t,n){let r=e.getMark();(r===`circle`||r===`square`)&&(r=Ai);let i=e.getEncodingQueryByChannel(`x`),a=i?el(i):$c,o=e.getEncodingQueryByChannel(`y`),s=o?el(o):$c,c=!e.isAggregate(),l=a+`_`+s+`_`+c+`_`+r,u=this.getFeatureScore(l);return u?[u]:(console.error(`feature score missing for`,l),[])}};function Q(e,t,n,r){return e+`_`+t+`_`+n+`_`+r}function sl(){let e=[Gc,qc],t=[Kc,Yc,Xc,Zc,Qc,$c],n={};e.forEach(t=>{e.forEach(e=>{R({point:0,text:-.2,tick:-.5,rect:-1,bar:-2,line:-2,area:-2,rule:-2.5},(r,i)=>{let a=Q(t,e,!0,i);n[a]=r}),R({point:0,text:-.2,tick:-.5,bar:-2,line:-2,area:-2,rule:-2.5},(r,i)=>{let a=Q(t,e,!1,i);n[a]=r})})}),e.forEach(e=>{t.forEach(t=>{R({tick:0,point:-.2,text:-.5,bar:-2,line:-2,area:-2,rule:-2.5},(r,i)=>{let a=Q(e,t,!0,i);n[a]=r;let o=Q(t,e,!0,i);n[o]=r})}),[Jc].forEach(t=>{R({point:0,text:-.5,tick:-1,bar:-2,line:-2,area:-2,rule:-2.5},(r,i)=>{let a=Q(e,t,!0,i);n[a]=r;let o=Q(t,e,!0,i);n[o]=r})}),[$c,Zc,Xc,Qc].forEach(t=>{R({bar:0,point:-.2,tick:-.25,text:-.3,line:-2,area:-2,rule:-2.5},(r,i)=>{let a=Q(e,t,!1,i);n[a]=r;let o=Q(t,e,!1,i);n[o]=r})}),[Kc].forEach(t=>{R({bar:0,point:-.2,tick:-.25,text:-.3,line:-.5,area:-.5,rule:-2.5},(r,i)=>{let a=Q(e,t,!1,i);n[a]=r;let o=Q(t,e,!1,i);n[o]=r})}),[Jc,Yc].forEach(t=>{R({line:0,area:-.1,bar:-.2,point:-.3,tick:-.35,text:-.4,rule:-2.5},(r,i)=>{let a=Q(e,t,!1,i);n[a]=r;let o=Q(t,e,!1,i);n[o]=r})})}),[Jc].forEach(e=>{[Jc].forEach(t=>{let r={point:0,rect:-.1,text:-.5,tick:-1,bar:-2,line:-2,area:-2,rule:-2.5};R(r,(r,i)=>{let a=Q(e,t,!0,i);n[a]=r}),R(r,(r,i)=>{let a=Q(e,t,!1,i);n[a]=r})}),t.forEach(t=>{let r={tick:0,point:-.2,text:-.5,rect:-1,bar:-2,line:-2,area:-2,rule:-2.5};R(r,(r,i)=>{let a=Q(e,t,!0,i);n[a]=r}),R(r,(r,i)=>{let a=Q(t,e,!0,i);n[a]=r}),R(r,(r,i)=>{let a=Q(e,t,!1,i);n[a]=r}),R(r,(r,i)=>{let a=Q(t,e,!1,i);n[a]=r})})});for(let e of t)for(let r of t){let t={point:0,rect:0,text:-.1,tick:-1,bar:-2,line:-2,area:-2,rule:-2.5};R(t,(t,i)=>{let a=Q(e,r,!0,i);n[a]=t}),R(t,(t,i)=>{let a=Q(e,r,!1,i);n[a]=t})}return n}var cl=[new tl,new nl,new rl,new ol,new il,new al];function ll(e,t,n){let r=cl.reduce((r,i)=>{let a=i.getScore(e,t,n);return r.concat(a)},[]);return{score:r.reduce((e,t)=>e+t.score,0),features:r}}var ul=`aggregationQuality`;function dl(e,t,n){let r=fl(e,t,n);return{score:r.score,features:[r]}}function fl(e,t,n){let r=e.getEncodings();if(e.isAggregate()){if(ni(r,e=>G(e)&&(e.type===`quantitative`&&!e.bin&&!e.aggregate||e.type===`temporal`&&!e.timeUnit)))return{type:ul,score:.1,feature:`Aggregate with raw continuous`};if(ni(r,e=>G(e)&&bo(e))){let e=ni(r,e=>G(e)&&e.aggregate===`count`||mo(e)),t=ni(r,e=>G(e)&&!!e.bin);return e?{type:ul,score:.8,feature:`Aggregate with count`}:t?{type:ul,score:.7,feature:`Aggregate with bin but without count`}:{type:ul,score:.9,feature:`Aggregate without count and without bin`}}return{type:ul,score:.3,feature:`Aggregate without dimension`}}return ni(r,e=>G(e)&&!bo(e))?{type:ul,score:1,feature:`Raw with measure`}:{type:ul,score:.2,feature:`Raw without measure`}}var pl=`fieldOrder`;function ml(e,t,n){let r=e.wildcardIndex.encodingIndicesByProperty.get(`field`);if(!r)return{score:0,features:[]};let i=e.specQuery.encodings,a=t.fieldSchemas.length,o=[],s=0,c=1;for(let n=r.length-1;n>=0;n--){let l=r[n],u=i[l],d;if(G(u))d=u.field;else continue;let f=e.wildcardIndex.encodings[l].get(`field`),p=t.fieldSchema(d).index,m=-p*c;s+=m,o.push({score:m,type:`fieldOrder`,feature:`field ${f.name} is ${d} (#${p} in the schema)`}),c*=a}return{score:s,features:o}}var hl={};function gl(e,t){hl[e]=t}function _l(e){return hl[e]}function vl(e,t,n,r){return!t.nest||r===t.nest.length?(t.orderBy||t.chooseBy)&&(e.items.sort(yl(t.orderBy||t.chooseBy,n,t.config)),t.chooseBy&&e.items.length>0&&e.items.splice(1)):(e.items.forEach(e=>{vl(e,t,n,r+1)}),t.nest[r].orderGroupBy&&e.items.sort(bl(t.nest[r].orderGroupBy,n,t.config))),e}function yl(e,t,n){return(r,i)=>e instanceof Array?xl(e,r,i,t,n):xl([e],r,i,t,n)}function bl(e,t,n){return(r,i)=>{let a=Uc(r),o=Uc(i);return e instanceof Array?xl(e,a,o,t,n):xl([e],a,o,t,n)}}function xl(e,t,n,r,i){for(let a of e){let e=Sl(n,a,r,i).score-Sl(t,a,r,i).score;if(e!==0)return e}return 0}function Sl(e,t,n,r){if(e.getRankingScore(t)!==void 0)return e.getRankingScore(t);let i=_l(t)(e,n,r);return e.setRankingScore(t,i),i}gl(`effectiveness`,ll),gl(ul,dl),gl(pl,ml);function Cl(e,t,n){let r={};return e=e.map(function(e){return n.smallRangeStepForHighCardinalityOrFacet&&(e=wl(e,t,r,n)),n.nominalColorScaleForHighCardinality&&(e=Tl(e,t,r,n)),n.xAxisOnTopForHighYCardinalityWithoutColumn&&(e=El(e,t,r,n)),e}),e}function wl(e,t,n,r){[`row`,`y`,Ke,`x`].forEach(t=>{n[t]=e.getEncodingQueryByChannel(t)});let i=n.y;if(i!==void 0&&G(i)&&(n.row||t.cardinality(i)>r.smallRangeStepForHighCardinalityOrFacet.maxCardinality)){i.scale===void 0&&(i.scale={});let e=xo(i);i.scale&&(e===void 0||Lr(e))&&(i.scale.rangeStep||(i.scale.rangeStep=12))}let a=n.x;if(G(a)&&(n.column||t.cardinality(a)>r.smallRangeStepForHighCardinalityOrFacet.maxCardinality)){a.scale===void 0&&(a.scale={});let e=xo(a);a.scale&&(e===void 0||Lr(e))&&(a.scale.rangeStep||(a.scale.rangeStep=12))}return e}function Tl(e,t,n,r){n[Qe]=e.getEncodingQueryByChannel(Qe);let i=n[Qe];return G(i)&&i!==void 0&&(i.type===`nominal`||i.type===Ra.KEY)&&t.cardinality(i)>r.nominalColorScaleForHighCardinality.maxCardinality&&(i.scale===void 0&&(i.scale={}),i.scale&&(i.scale.range||(i.scale.scheme=r.nominalColorScaleForHighCardinality.palette))),e}function El(e,t,n,r){if([Ke,`x`,`y`].forEach(t=>{n[t]=e.getEncodingQueryByChannel(t)}),n.column===void 0){let e=n.x,i=n.y;G(e)&&G(i)&&i!==void 0&&i.field&&Lr(xo(i))&&e!==void 0&&t.cardinality(i)>r.xAxisOnTopForHighYCardinalityWithoutColumn.maxCardinality&&(e.axis===void 0&&(e.axis={}),e.axis&&!e.axis.orient&&(e.axis.orient=`top`))}return e}function Dl(e,t,n=ma){let r=Bc.build(e,t,n),i=r.wildcardIndex,a=[r];return n.propertyPrecedence.forEach(e=>{let r=Si(e);if(i.hasProperty(r)){let e=Sc(r)(i,t,n);a=a.reduce(e,[])}}),n.stylize&&(n.nominalColorScaleForHighCardinality!==null||n.smallRangeStepForHighCardinalityOrFacet!==null||n.xAxisOnTopForHighYCardinalityWithoutColumn!==null)?Cl(a,t,n):a}function Ol(e,t,n){e=Object.assign({},Vc(e),{config:Object.assign({},ma,n,e.config)});let r=vl(Pc(Dl(e.spec,t,e.config),e.nest),e,t,0);return{query:e,result:r}}var kl=e(l(),1),$=h(),Al={[X.BOOLEAN]:(0,$.jsx)(k,{className:`h-5 w-5 inline-flex opacity-60`}),[X.DATETIME]:(0,$.jsx)(A,{className:`h-5 w-5 inline-flex opacity-60`}),[X.NUMBER]:(0,$.jsx)(O,{className:`h-5 w-5 inline-flex opacity-60`}),[X.STRING]:(0,$.jsx)(re,{className:`h-5 w-5 inline-flex opacity-60`}),[X.INTEGER]:(0,$.jsx)(ye,{className:`h-5 w-5 inline-flex opacity-60`})},jl=12,Ml=e=>{let t=(0,be.c)(45),{schema:n}=e,[r,i]=(0,kl.useState)(),[a,o]=(0,kl.useState)(),s,c,l,u,d,f,p,h;if(t[0]!==n||t[1]!==r||t[2]!==a){s=n.fieldNames();let e;t[11]!==n||t[12]!==r?(e=r?n.stats({field:r,channel:`x`}):void 0,t[11]=n,t[12]=r,t[13]=e):e=t[13],l=e;let o;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(ve,{className:`text-muted-foreground`,width:40,height:40,strokeWidth:1.5}),t[14]=o):o=t[14];let g=o,_=a?s:s.slice(0,jl);c=s.length>jl,f=`flex flex-col justify-center items-center h-full flex-1 gap-2`,p=g,h=(0,$.jsxs)(`span`,{className:`text-muted-foreground font-semibold`,children:[s.length>0?s.length:`No`,` fields`]}),u=`hidden lg:grid grid-cols-2 xl:grid-cols-3 gap-2 p-2 bg-(--slate-1) border rounded lg:items-center items-start w-fit grid-flow-dense max-h-[300px] overflow-auto`;let v;t[15]!==n||t[16]!==r?(v=e=>{let t=n.cardinality({channel:`x`,field:e});return(0,$.jsxs)(`span`,{className:m(`hover:bg-muted self-start px-2 py-2 rounded flex flex-row gap-1 items-center cursor-pointer lg:justify-center text-sm truncate shrink-0 overflow-hidden`,r===e&&`bg-muted`),onClick:()=>{if(r===e){i(void 0);return}i(e)},children:[Al[n.primitiveType(e)],e,t>1&&(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,t,`)`]})]},e)},t[15]=n,t[16]=r,t[17]=v):v=t[17],d=_.map(v),t[0]=n,t[1]=r,t[2]=a,t[3]=s,t[4]=c,t[5]=l,t[6]=u,t[7]=d,t[8]=f,t[9]=p,t[10]=h}else s=t[3],c=t[4],l=t[5],u=t[6],d=t[7],f=t[8],p=t[9],h=t[10];let g;t[18]!==c||t[19]!==a?(g=c&&(0,$.jsx)(w,{"data-testid":`marimo-plugin-data-explorer-show-more-columns`,variant:`link`,size:`sm`,className:`self-center col-span-3 -mt-1`,onClick:()=>o(Fl),children:a?`Show less`:`Show more`}),t[18]=c,t[19]=a,t[20]=g):g=t[20];let v;t[21]!==u||t[22]!==d||t[23]!==g?(v=(0,$.jsxs)(`div`,{className:u,children:[d,g]}),t[21]=u,t[22]=d,t[23]=g,t[24]=v):v=t[24];let b=r||``,C=s.length===0,T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{i(e)},t[25]=T):T=t[25];let ne;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,$.jsx)(te,{className:`min-w-[210px] h-full`,children:(0,$.jsx)(_,{placeholder:`Select a column`})}),t[26]=ne):ne=t[26];let E;t[27]===n?E=t[28]:(E=n.fieldNames().map(e=>(0,$.jsx)(y,{value:e.toString(),children:(0,$.jsxs)(`span`,{className:`flex items-center gap-2 flex-1`,children:[Al[n.primitiveType(e)],(0,$.jsx)(`span`,{className:`flex-1`,children:e}),(0,$.jsxs)(`span`,{className:`text-muted-foreground text-xs font-semibold`,children:[`(`,n.vlType(e),`)`]})]})},e)),t[27]=n,t[28]=E);let D;t[29]===E?D=t[30]:(D=(0,$.jsx)(ee,{children:(0,$.jsx)(x,{children:E})}),t[29]=E,t[30]=D);let O;t[31]!==D||t[32]!==b||t[33]!==C?(O=(0,$.jsx)(`div`,{className:`lg:hidden`,children:(0,$.jsxs)(S,{"data-testid":`marimo-plugin-data-explorer-column-select`,value:b,disabled:C,onValueChange:T,children:[ne,D]})}),t[31]=D,t[32]=b,t[33]=C,t[34]=O):O=t[34];let k;t[35]!==r||t[36]!==l?(k=r&&(0,$.jsx)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-2 p-2 text-sm`,children:Nl.map(e=>(0,$.jsxs)(`div`,{className:`flex flex-row gap-2 min-w-[100px]`,children:[(0,$.jsx)(`span`,{className:`font-semibold`,children:e}),(0,$.jsx)(`span`,{children:(0,$.jsx)(Pl,{value:l?.[e]})})]},e))}),t[35]=r,t[36]=l,t[37]=k):k=t[37];let A;return t[38]!==O||t[39]!==k||t[40]!==f||t[41]!==p||t[42]!==h||t[43]!==v?(A=(0,$.jsxs)(`div`,{className:f,children:[p,h,v,O,k]}),t[38]=O,t[39]=k,t[40]=f,t[41]=p,t[42]=h,t[43]=v,t[44]=A):A=t[44],A},Nl=[`distinct`,`min`,`max`,`mean`,`median`,`q1`,`q3`,`stdev`],Pl=e=>{let t=(0,be.c)(8),{value:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={maximumFractionDigits:2},t[0]=r):r=t[0];let i=oe(r),a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a={year:`numeric`,month:`short`,day:`numeric`},t[1]=a):a=t[1];let o=ue(a);if(typeof n==`number`){let e;return t[2]!==i||t[3]!==n?(e=i.format(n),t[2]=i,t[3]=n,t[4]=e):e=t[4],e}if(typeof n==`string`)return n;if(typeof n==`object`&&n instanceof Date){let e;return t[5]!==o||t[6]!==n?(e=o.format(n),t[5]=o,t[6]=n,t[7]=e):e=t[7],e}return String(n)};function Fl(e){return!e}var Il=[`argmax`,`argmin`,`average`,`count`,`distinct`,`exponential`,`exponentialb`,`product`,`max`,`mean`,`median`,`min`,`missing`,`q1`,`q3`,`ci0`,`ci1`,`stderr`,`stdev`,`stdevp`,`sum`,`valid`,`values`,`variance`,`variancep`],Ll=e=>typeof e==`string`&&Il.includes(e);function Rl(e){return e?e===`bin`?{bin:!0}:Ll(e)?{aggregate:e}:zl(e)?{timeUnit:e}:{}:{}}function zl(e){return e?Vl.includes(e)||Hl.includes(e):!1}var Bl=[`bin`,`min`,`max`,`mean`,`median`,`sum`],Vl=[`year`,`month`,`date`,`day`,`hours`,`minutes`,`seconds`,`milliseconds`],Hl=[`yearmonth`,`yearmonthdate`,`monthdate`];function Ul(e){let{aggregate:t,bin:n,timeUnit:r}=e;if(n)return`bin`;if(t)return t.toString();if(r)return r.toString()}var Wl=[`?`,`area`,`bar`,`circle`,`geoshape`,`line`,`point`,`rect`,`rule`,`square`,`text`,`tick`,`trail`],Gl={type:`histograms`,limit:12,createQuery(e){return{spec:{data:e.spec.data,mark:`?`,transform:e.spec.transform,encodings:[{channel:`?`,bin:`?`,timeUnit:`?`,field:`?`,type:`?`},{channel:`?`,aggregate:`count`,field:`*`,type:`quantitative`}]},groupBy:`fieldTransform`,orderBy:[`fieldOrder`,`aggregationQuality`,`effectiveness`],chooseBy:[`aggregationQuality`,`effectiveness`],config:{autoAddCount:!1}}}};function Kl(e){let t={};for(let n in e)e[n]!==void 0&&(t[n]=e[n]);return t}function ql(e,t){let{fn:n,...r}=e;return{channel:t,...Rl(n),...r}}function Jl(e){let{aggregate:t,bin:n,timeUnit:r,field:i,scale:a,legend:o,axis:s,sort:c,description:l}=e,{type:u}=e;if(V(u))throw Error(`Wildcard not support`);u===`ordinal`&&(d.warn(`Ordinal type is not supported. Using nominal type instead.`),u=`nominal`);let f=Ul({aggregate:t,bin:n,timeUnit:r});return p(i!==void 0,`Field is required for fieldQ`),Kl({field:i,fn:f,type:u,sort:c,scale:a,axis:s,legend:o,description:l})}function Yl(e){return{mark:e.mark,encodings:Xl(e.encoding),config:e.config}}function Xl(e){return e?Object.entries(e).map(([e,t])=>ql(t,e)):[]}function Zl(e){let{type:t,limit:n,additionalFieldQuery:r}=e;return{type:t,limit:n,createQuery(e){return{spec:{...e.spec,encodings:[...e.spec.encodings,r]},groupBy:`field`,orderBy:[`fieldOrder`,`aggregationQuality`,`effectiveness`],chooseBy:[`aggregationQuality`,`effectiveness`],config:{autoAddCount:!0}}}}}var Ql=Zl({type:`addCategoricalField`,limit:4,additionalFieldQuery:{channel:`?`,field:`?`,type:`nominal`}}),$l=Zl({type:`addQuantitativeField`,limit:4,additionalFieldQuery:{channel:`?`,bin:`?`,aggregate:`?`,field:`?`,type:`quantitative`}}),eu=Zl({type:`addTemporalField`,limit:2,additionalFieldQuery:{channel:`?`,hasFn:!0,timeUnit:`?`,field:`?`,type:`temporal`}}),tu=[`color`,`fill`,`stroke`,`opacity`,`fillOpacity`,`strokeOpacity`,`strokeWidth`,`size`,`shape`,`strokeDash`,`angle`,`time`];function nu(e){return!au(e).hasAnyWildcard}function ru(e){let t=[`x`,`y`,`color`],n=[`row`,`column`],r=new Set(e.encodings.map(e=>e.channel)),i=t.every(e=>r.has(e)),a=n.some(e=>r.has(e));return i&&a}function iu(e){return e.encodings.length===0}function au(e){let t=!1,n=!1,r=!1;for(let i of e.encodings)W(i)||(K(i)?V(i.autoCount)&&(n=!0):(V(i.field)&&(t=!0),(V(i.aggregate)||V(i.bin)||V(i.timeUnit))&&(n=!0),V(i.channel)&&(r=!0)));return{hasAnyWildcard:r||t||n,hasWildcardField:t,hasWildcardFn:n,hasWildcardChannel:r}}var ou={name:`source`};function su(e){let t=!1,n=!1,r=!1;return e.encodings.forEach(e=>{e.channel===`x`||e.channel===`y`?t=!0:e.channel===`row`||e.channel===`column`?r=!0:typeof e.channel==`string`&&me(tu,e.channel)&&(n=!0)}),{hasOpenPosition:t,hasStyleChannel:n,hasOpenFacet:r}}function cu(e,t){let n={},{hasOpenPosition:r,hasStyleChannel:i,hasOpenFacet:a}=su(e.spec);return(r||i)&&(n.addQuantitativeField=uu($l,e,t)),(r||i||a)&&(n.addCategoricalField=uu(Ql,e,t)),r&&(n.addTemporalField=uu(eu,e,t)),n}function lu(e,t){if(iu(e.spec))return{plots:[],query:e,limit:1};let n=Ol(e,t).result;return{plots:[du(n,ou)[0]],query:e,limit:1}}function uu(e,t,n){let r=e.createQuery(t),i=Ol(r,n).result;return{plots:du(i,ou),query:r,limit:e.limit}}function du(e,t){return e.items.map(e=>Hc(e)?fu(t,Uc(e)):fu(t,e))}function fu(e,t){return{fieldInfos:t.getEncodings().filter(G).map(e=>({fieldDef:Jl(e),channel:e.channel})),spec:t.toSpec(e)}}function pu(e){let{spec:t,autoAddCount:n}=e,r=Yl(t),{hasAnyWildcard:i,hasWildcardFn:a,hasWildcardField:o}=au(r);return{spec:r,groupBy:mu({hasWildcardFn:a,hasWildcardField:o}),orderBy:[`fieldOrder`,`aggregationQuality`,`effectiveness`],chooseBy:[`aggregationQuality`,`effectiveness`],config:i?{autoAddCount:n}:void 0}}function mu(e){let{hasWildcardFn:t,hasWildcardField:n}=e;return t?`fieldTransform`:n?`field`:`encoding`}function hu(){return{mark:`?`,encoding:{},config:{},schema:null}}var{valueAtom:gu,useActions:_u}=T(hu,{setSchema:(e,t)=>({...e,schema:t}),setMark:(e,t)=>({...e,mark:t}),setEncoding:(e,t)=>{let n=Kl({...e.encoding,...t});return{...e,encoding:n}},set:(e,t)=>{let{schema:n,...r}=t;return{...e,...r}}});function vu(){return _u()}var yu=a(e=>{let t=e(gu);if(!t.schema)return{};let n=pu({spec:t,autoAddCount:!0});return iu(n.spec)?{main:lu(n,t.schema),histograms:uu(Gl,n,t.schema)}:nu(n.spec)&&!ru(n.spec)?{main:lu(n,t.schema),...cu(n,t.schema)}:{main:lu(n,t.schema)}}),bu=[`x`,`y`,`row`,`column`],xu=[`color`,`size`,`shape`],Su=e=>{let t=(0,be.c)(26),{schema:n,mark:r}=e,i=o(gu),a=vu(),s=i.encoding.x&&i.encoding.y,c;t[0]!==a||t[1]!==s||t[2]!==n||t[3]!==i.encoding?(c=e=>(0,$.jsx)(Cu,{schema:n,label:e,disabled:(e===`row`||e===`column`)&&!s,fieldDefinition:i.encoding[e],onChange:t=>a.setEncoding({[e]:t})},e),t[0]=a,t[1]=s,t[2]=n,t[3]=i.encoding,t[4]=c):c=t[4];let l=c,u;t[5]===r?u=t[6]:(u=r.toString(),t[5]=r,t[6]=u);let d;t[7]===a?d=t[8]:(d=e=>a.setMark(e),t[7]=a,t[8]=d);let f;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(te,{children:(0,$.jsx)(_,{placeholder:`Mark`})}),t[9]=f):f=t[9];let p;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(ee,{children:(0,$.jsxs)(x,{children:[(0,$.jsx)(g,{children:`Mark`}),Wl.map(Eu)]})}),t[10]=p):p=t[10];let m;t[11]!==u||t[12]!==d?(m=(0,$.jsxs)(S,{"data-testid":`marimo-plugin-data-explorer-mark-select`,value:u,onValueChange:d,children:[f,p]}),t[11]=u,t[12]=d,t[13]=m):m=t[13];let h=m,v;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(`span`,{className:`col-span-2 flex items-center justify-between w-full`,children:(0,$.jsx)(`div`,{className:`text-sm font-semibold`,children:`Encodings`})}),t[14]=v):v=t[14];let y;t[15]===l?y=t[16]:(y=bu.map(l),t[15]=l,t[16]=y);let b;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(`div`,{children:`Mark`}),t[17]=b):b=t[17];let C;t[18]===h?C=t[19]:(C=(0,$.jsxs)(`span`,{className:`col-span-2 text-sm font-semibold w-full border-t border-divider flex items-center justify-between pt-2 pr-[30px]`,children:[b,h]}),t[18]=h,t[19]=C);let w;t[20]===l?w=t[21]:(w=xu.map(l),t[20]=l,t[21]=w);let T;return t[22]!==C||t[23]!==w||t[24]!==y?(T=(0,$.jsxs)(`div`,{className:`grid gap-x-2 gap-y-4 justify-items-start py-3 pl-4 pr-2 bg-(--slate-1) border rounded items-center grid-template-columns-[repeat(2,_minmax(0,_min-content))] self-start`,children:[v,y,C,w]}),t[22]=C,t[23]=w,t[24]=y,t[25]=T):T=t[25],T},Cu=e=>{let t=(0,be.c)(43),{label:n,schema:r,fieldDefinition:i,disabled:a,onChange:o}=e,s;t[0]!==i||t[1]!==r?(s=()=>{if(!i)return`--`;if(i.field===`*`)return(0,$.jsxs)(`span`,{className:`flex gap-2 flex-1`,children:[Al[X.NUMBER],(0,$.jsx)(`span`,{className:`text-left flex-1`,children:`Count`})]});let e=i.field.toString();return(0,$.jsxs)(`span`,{className:`flex gap-2 flex-1`,children:[Al[r.primitiveType(e)],(0,$.jsx)(`span`,{className:`text-left flex-1`,children:i.fn?`${i.fn}(${i.field})`:e})]})},t[0]=i,t[1]=r,t[2]=s):s=t[2];let c=s,l;t[3]===o?l=t[4]:(l=()=>{o(void 0)},t[3]=o,t[4]=l);let u=l,d;t[5]===i?.field?d=t[6]:(d=i?.field.toString()??``,t[5]=i?.field,t[6]=d);let f=d,p;t[7]===n?p=t[8]:(p=(0,$.jsx)(v,{className:`text-(--slate-11) font-semibold`,children:n}),t[7]=n,t[8]=p);let m;t[9]!==o||t[10]!==r?(m=e=>{o(e===`*`?{field:`*`,fn:`count`,type:`quantitative`}:{field:e,type:r.vlType(e)})},t[9]=o,t[10]=r,t[11]=m):m=t[11];let h=f?u:void 0,g;t[12]===c?g=t[13]:(g=c(),t[12]=c,t[13]=g);let _;t[14]!==h||t[15]!==g?(_=(0,$.jsx)(te,{className:`min-w-[140px] lg:min-w-[210px] h-full`,onClear:h,children:g}),t[14]=h,t[15]=g,t[16]=_):_=t[16];let C;t[17]===r?C=t[18]:(C=r.fieldNames().map(e=>(0,$.jsx)(y,{value:e.toString(),children:(0,$.jsxs)(`span`,{className:`flex items-center gap-2 flex-1`,children:[Al[r.primitiveType(e)],(0,$.jsx)(`span`,{className:`flex-1`,children:e}),(0,$.jsxs)(`span`,{className:`text-muted-foreground text-xs font-semibold`,children:[`(`,r.vlType(e),`)`]})]})},e)),t[17]=r,t[18]=C);let w;t[19]===r?w=t[20]:(w=r.fieldNames().length===0&&(0,$.jsx)(y,{disabled:!0,value:`--`,children:`No columns`}),t[19]=r,t[20]=w);let T;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(b,{}),t[21]=T):T=t[21];let ne;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,$.jsx)(y,{value:`*`,children:(0,$.jsxs)(`span`,{className:`flex items-center gap-1 flex-1`,children:[Al[X.NUMBER],(0,$.jsx)(`span`,{className:`flex-1`,children:`Count`})]})},`*`),t[22]=ne):ne=t[22];let E;t[23]!==w||t[24]!==C?(E=(0,$.jsx)(ee,{children:(0,$.jsxs)(x,{children:[C,w,T,ne]})}),t[23]=w,t[24]=C,t[25]=E):E=t[25];let D;t[26]!==a||t[27]!==f||t[28]!==E||t[29]!==m||t[30]!==_?(D=(0,$.jsxs)(S,{value:f,disabled:a,onValueChange:m,children:[_,E]}),t[26]=a,t[27]=f,t[28]=E,t[29]=m,t[30]=_,t[31]=D):D=t[31];let O;t[32]!==i||t[33]!==o?(O=i&&(0,$.jsx)(Tu,{field:i,onChange:o}),t[32]=i,t[33]=o,t[34]=O):O=t[34];let k;t[35]===O?k=t[36]:(k=(0,$.jsx)(`div`,{className:`w-[26px]`,children:O}),t[35]=O,t[36]=k);let A;t[37]!==D||t[38]!==k?(A=(0,$.jsxs)(`div`,{className:`flex flex-row gap-1 h-[26px]`,children:[D,k]}),t[37]=D,t[38]=k,t[39]=A):A=t[39];let re;return t[40]!==A||t[41]!==p?(re=(0,$.jsxs)($.Fragment,{children:[p,A]}),t[40]=A,t[41]=p,t[42]=re):re=t[42],re},wu=`__`,Tu=e=>{let t=(0,be.c)(10),{field:n,onChange:r}=e;if(n.field===`*`)return null;let i;if(t[0]!==n||t[1]!==r){i=Symbol.for(`react.early_return_sentinel`);bb0:{let e=[];if(n.type===Ra.QUANTITATIVE&&(e=[[``,Bl]]),n.type===Ra.TEMPORAL&&(e=[[`Single`,Vl],[`Multi`,Hl]]),e.length>0){let a=e=>{r({...n,fn:e===wu?void 0:e})},o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(te,{className:`h-full px-1`,hideChevron:!0,variant:`ghost`,children:(0,$.jsx)(se,{size:14,strokeWidth:1.5})}),t[3]=o):o=t[3];let s,c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(x,{children:(0,$.jsx)(y,{value:wu,children:`None`})}),c=(0,$.jsx)(b,{}),t[4]=s,t[5]=c):(s=t[4],c=t[5]);let l=(0,$.jsxs)(ee,{children:[s,c,e.map(Ou)]}),u;t[6]!==n.fn||t[7]!==a||t[8]!==l?(u=(0,$.jsxs)(S,{"data-testid":`marimo-plugin-data-explorer-field-options`,value:n.fn,onValueChange:a,children:[o,l]}),t[6]=n.fn,t[7]=a,t[8]=l,t[9]=u):u=t[9],i=u;break bb0}}t[0]=n,t[1]=r,t[2]=i}else i=t[2];return i===Symbol.for(`react.early_return_sentinel`)?null:i};function Eu(e){return(0,$.jsx)(y,{value:e,children:e===`?`?`auto`:e},e)}function Du(e){return(0,$.jsx)(y,{value:e??wu,children:ne.startCase(e)},e)}function Ou(e){let[t,n]=e;return(0,$.jsxs)(x,{children:[t&&(0,$.jsx)(g,{children:t}),n.map(Du)]},t)}var ku=e=>{let t=(0,be.c)(5),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=s(),t[0]=n):n=t[0];let r=n,i;t[1]===e?i=t[2]:(i=()=>{let t=r.sub(gu,()=>{let{schema:t,...n}=r.get(gu);e.setValue(n)}),n=e.value;return n&&Object.keys(n).length>0&&r.set(gu,n),t},t[1]=e,t[2]=i),ie(i);let a;return t[3]===e?a=t[4]:(a=(0,$.jsx)(c,{store:r,children:(0,$.jsx)(ju,{...e})}),t[3]=e,t[4]=a),a};function Au(e){return{padding:{left:20,right:20,top:20,bottom:20},actions:{export:{svg:!0,png:!0},source:!1,compiled:!1,editor:!1},theme:e===`dark`?`dark`:void 0,tooltip:pe.call,renderer:`canvas`}}var ju=e=>{let t=(0,be.c)(43),{data:n}=e,r=vu(),i;t[0]!==r||t[1]!==n?(i=async()=>{if(!n)return{};let e=await fe(n,{type:`csv`,parse:`auto`},{replacePeriod:!0}),t=nc(e);return r.setSchema(t),{chartData:e,schema:t}},t[0]=r,t[1]=n,t[2]=i):i=t[2];let a;t[3]===n?a=t[4]:(a=[n],t[3]=n,t[4]=a);let{data:s,isPending:c,error:l}=de(i,a),{mark:u}=o(gu),d=o(yu),{theme:p}=le();if(l){let e;return t[5]===l?e=t[6]:(e=(0,$.jsx)(ge,{error:l}),t[5]=l,t[6]=e),e}if(!s){let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`div`,{}),t[7]=e):e=t[7],e}let{chartData:h,schema:g}=s;if(c||!g){let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`div`,{}),t[8]=e):e=t[8],e}let _=d.main?.plots?.[0],v;t[9]===_?.fieldInfos?v=t[10]:(v=new Set(_?.fieldInfos.map(Fu)),t[9]=_?.fieldInfos,t[10]=v);let y=v,ee;t[11]!==h||t[12]!==_||t[13]!==g||t[14]!==p?(ee=()=>{if(!_)return(0,$.jsx)(Ml,{schema:g});let e=_.spec,t=Pu(e),n=D(t,h);return(0,$.jsx)(`div`,{className:m(`flex overflow-y-auto justify-center items-center flex-1 w-[90%]`),children:(0,$.jsx)(he,{"data-container-width":_e(n),spec:n,options:Au(p)})})},t[11]=h,t[12]=_,t[13]=g,t[14]=p,t[15]=ee):ee=t[15];let b=ee,x;t[16]!==u||t[17]!==g?(x=(0,$.jsx)(Su,{mark:u,schema:g}),t[16]=u,t[17]=g,t[18]=x):x=t[18];let te;t[19]===b?te=t[20]:(te=b(),t[19]=b,t[20]=te);let S;t[21]!==x||t[22]!==te?(S=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[x,te]}),t[21]=x,t[22]=te,t[23]=S):S=t[23];let T=d.histograms?.plots,ne=d.addCategoricalField?.plots,E=d.addQuantitativeField?.plots,O=d.addTemporalField?.plots,k;if(t[24]!==r||t[25]!==h||t[26]!==y||t[27]!==E||t[28]!==O||t[29]!==T||t[30]!==ne||t[31]!==p){let e;t[33]!==r||t[34]!==h||t[35]!==y||t[36]!==p?(e=(e,t)=>(0,$.jsx)(Nu,{title:(0,$.jsx)(`div`,{className:`flex flex-row gap-1`,children:e.fieldInfos.map(e=>{let t=e.fieldDef.field===`*`?`Count`:e.fieldDef.fn?`${e.fieldDef.fn}(${e.fieldDef.field})`:e.fieldDef.field.toString();return(0,$.jsx)(ce,{variant:y.has(e.fieldDef.field)?`secondary`:`defaultOutline`,children:t},t)})}),actions:(0,$.jsx)(C,{content:`Make main plot`,children:(0,$.jsx)(w,{"data-testid":`marimo-plugin-data-explorer-make-main-plot`,variant:`text`,size:`icon`,onClick:()=>{let t=f.fromEntries(e.fieldInfos.map(Iu));r.setEncoding(t)},children:(0,$.jsx)(ae,{className:`w-4 h-4`})})}),children:(0,$.jsx)(he,{options:Au(p),spec:D(e.spec,h)},t)},t),t[33]=r,t[34]=h,t[35]=y,t[36]=p,t[37]=e):e=t[37],k=[T,ne,E,O].filter(Boolean).flat().map(e),t[24]=r,t[25]=h,t[26]=y,t[27]=E,t[28]=O,t[29]=T,t[30]=ne,t[31]=p,t[32]=k}else k=t[32];let A;t[38]===k?A=t[39]:(A=(0,$.jsx)(Mu,{children:k}),t[38]=k,t[39]=A);let re;return t[40]!==A||t[41]!==S?(re=(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[S,A]}),t[40]=A,t[41]=S,t[42]=re):re=t[42],re},Mu=e=>{let t=(0,be.c)(2),{children:n}=e;if(kl.Children.count(n)===0)return null;let r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`div`,{className:`flex flex-row overflow-x-auto overflow-y-hidden gap-4 snap-x pb-4`,children:n}),t[0]=n,t[1]=r),r},Nu=e=>{let t=(0,be.c)(10),{title:n,children:r,actions:i}=e,a;t[0]===n?a=t[1]:(a=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:n}),t[0]=n,t[1]=a);let o;t[2]!==i||t[3]!==a?(o=(0,$.jsxs)(`div`,{className:`flex flex-row justify-between items-center bg-(--slate-3) py-0.5 px-2`,children:[a,i]}),t[2]=i,t[3]=a,t[4]=o):o=t[4];let s;t[5]===r?s=t[6]:(s=(0,$.jsx)(`div`,{className:`px-6 pt-2 max-h-[280px] overflow-y-auto`,children:r}),t[5]=r,t[6]=s);let c;return t[7]!==o||t[8]!==s?(c=(0,$.jsxs)(`div`,{className:`shrink-0 bg-card shadow-md border overflow-hidden rounded snap-start`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c};function Pu(e){return e.encoding?.row||e.encoding?.column||(e.width=`container`),e}function Fu(e){return e.fieldDef.field}function Iu(e){return[e.channel,e.fieldDef]}export{ju as DataExplorerComponent,ku as default};
|
|
1
|
+
import{a as e,i as t,n,r,t as i}from"./rolldown-runtime-B0Z9INg1.js";import{f as a,l as o,p as s,s as c}from"./useEvent-xfs0Sn4r.js";import{t as l}from"./react-CBDbhulC.js";import{t as u}from"./compiler-runtime-CYIjoINj.js";import{g as d}from"./useEventListener-92uWqz-P.js";import{t as f}from"./objects-snlMn4yk.js";import{t as p}from"./invariant-Ci2dTZ72.js";import{t as m}from"./cn-ldLVeaqm.js";import{t as h}from"./jsx-runtime-B74pBk57.js";import{a as g,c as _,d as v,i as y,n as ee,o as b,r as x,s as te,t as S}from"./select-nLt2y0Sw.js";import{t as C}from"./tooltip-BUtPzKB4.js";import{t as w}from"./button-Dh8EwhsF.js";import{t as T}from"./createReducer-B_XmHROl.js";import{t as ne}from"./strings-CReV1AYG.js";import{t as E}from"./createLucideIcon-B7HeEoG2.js";import{t as D}from"./spec-DKsAmLTi.js";import{a as O,i as k,o as A,r as re,t as ie}from"./useLifecycle-BUaJcygz.js";import{n as ae}from"./table-CUK1W5bI.js";import{t as oe}from"./useNumberFormatter-DHJ9s6Vk.js";import{t as se}from"./square-function-DkZweMAs.js";import{t as ce}from"./badge-BSgtkC2e.js";import{r as le}from"./useTheme-C-ri8BtY.js";import{t as ue}from"./useDateFormatter-BiqAQ-zI.js";import{n as de}from"./useAsyncData-Buhk-UgR.js";import{r as fe,t as pe}from"./tooltip-BG35uS_N.js";import{i as me,n as he}from"./react-vega-C3-Qk46W.js";import{n as ge}from"./error-banner-Dw5YY9wq.js";import{t as _e}from"./utils-49LGK4zG.js";var ve=E(`chart-column-big`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`rect`,{x:`15`,y:`5`,width:`4`,height:`12`,rx:`1`,key:`q8uenq`}],[`rect`,{x:`7`,y:`8`,width:`4`,height:`9`,rx:`1`,key:`sr5ea`}]]),ye=E(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]),be=u();function xe(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}var Se=i(((e,t)=>{var n=(function(){function e(e,t){return t!=null&&e instanceof t}var t;try{t=Map}catch{t=function(){}}var n;try{n=Set}catch{n=function(){}}var r;try{r=Promise}catch{r=function(){}}function i(a,o,s,c,u){typeof o==`object`&&(s=o.depth,c=o.prototype,u=o.includeNonEnumerable,o=o.circular);var d=[],f=[],p=typeof Buffer<`u`;o===void 0&&(o=!0),s===void 0&&(s=1/0);function m(a,s){if(a===null)return null;if(s===0)return a;var h,g;if(typeof a!=`object`)return a;if(e(a,t))h=new t;else if(e(a,n))h=new n;else if(e(a,r))h=new r(function(e,t){a.then(function(t){e(m(t,s-1))},function(e){t(m(e,s-1))})});else if(i.__isArray(a))h=[];else if(i.__isRegExp(a))h=new RegExp(a.source,l(a)),a.lastIndex&&(h.lastIndex=a.lastIndex);else if(i.__isDate(a))h=new Date(a.getTime());else if(p&&Buffer.isBuffer(a))return h=Buffer.allocUnsafe?Buffer.allocUnsafe(a.length):new Buffer(a.length),a.copy(h),h;else e(a,Error)?h=Object.create(a):c===void 0?(g=Object.getPrototypeOf(a),h=Object.create(g)):(h=Object.create(c),g=c);if(o){var _=d.indexOf(a);if(_!=-1)return f[_];d.push(a),f.push(h)}for(var v in e(a,t)&&a.forEach(function(e,t){var n=m(t,s-1),r=m(e,s-1);h.set(n,r)}),e(a,n)&&a.forEach(function(e){var t=m(e,s-1);h.add(t)}),a){var y;g&&(y=Object.getOwnPropertyDescriptor(g,v)),!(y&&y.set==null)&&(h[v]=m(a[v],s-1))}if(Object.getOwnPropertySymbols)for(var ee=Object.getOwnPropertySymbols(a),v=0;v<ee.length;v++){var b=ee[v],x=Object.getOwnPropertyDescriptor(a,b);x&&!x.enumerable&&!u||(h[b]=m(a[b],s-1),x.enumerable||Object.defineProperty(h,b,{enumerable:!1}))}if(u)for(var te=Object.getOwnPropertyNames(a),v=0;v<te.length;v++){var S=te[v],x=Object.getOwnPropertyDescriptor(a,S);x&&x.enumerable||(h[S]=m(a[S],s-1),Object.defineProperty(h,S,{enumerable:!1}))}return h}return m(a,s)}i.clonePrototype=function(e){if(e===null)return null;var t=function(){};return t.prototype=e,new t};function a(e){return Object.prototype.toString.call(e)}i.__objToStr=a;function o(e){return typeof e==`object`&&a(e)===`[object Date]`}i.__isDate=o;function s(e){return typeof e==`object`&&a(e)===`[object Array]`}i.__isArray=s;function c(e){return typeof e==`object`&&a(e)===`[object RegExp]`}i.__isRegExp=c;function l(e){var t=``;return e.global&&(t+=`g`),e.ignoreCase&&(t+=`i`),e.multiline&&(t+=`m`),t}return i.__getRegExpFlags=l,i})();typeof t==`object`&&t.exports&&(t.exports=n)})),Ce=i(((e,t)=>{var n=Array.isArray,r=Object.keys,i=Object.prototype.hasOwnProperty;t.exports=function e(t,a){if(t===a)return!0;if(t&&a&&typeof t==`object`&&typeof a==`object`){var o=n(t),s=n(a),c,l,u;if(o&&s){if(l=t.length,l!=a.length)return!1;for(c=l;c--!==0;)if(!e(t[c],a[c]))return!1;return!0}if(o!=s)return!1;var d=t instanceof Date,f=a instanceof Date;if(d!=f)return!1;if(d&&f)return t.getTime()==a.getTime();var p=t instanceof RegExp,m=a instanceof RegExp;if(p!=m)return!1;if(p&&m)return t.toString()==a.toString();var h=r(t);if(l=h.length,l!==r(a).length)return!1;for(c=l;c--!==0;)if(!i.call(a,h[c]))return!1;for(c=l;c--!==0;)if(u=h[c],!e(t[u],a[u]))return!1;return!0}return t!==t&&a!==a}})),we=i(((e,t)=>{t.exports=function(e,t){t||={},typeof t==`function`&&(t={cmp:t});var n=typeof t.cycles==`boolean`&&t.cycles,r=t.cmp&&(function(e){return function(t){return function(n,r){return e({key:n,value:t[n]},{key:r,value:t[r]})}}})(t.cmp),i=[];return(function e(t){if(t&&t.toJSON&&typeof t.toJSON==`function`&&(t=t.toJSON()),t!==void 0){if(typeof t==`number`)return isFinite(t)?``+t:`null`;if(typeof t!=`object`)return JSON.stringify(t);var a,o;if(Array.isArray(t)){for(o=`[`,a=0;a<t.length;a++)a&&(o+=`,`),o+=e(t[a])||`null`;return o+`]`}if(t===null)return`null`;if(i.indexOf(t)!==-1){if(n)return JSON.stringify(`__cycle__`);throw TypeError(`Converting circular structure to JSON`)}var s=i.push(t)-1,c=Object.keys(t).sort(r&&r(t));for(o=``,a=0;a<c.length;a++){var l=c[a],u=e(t[l]);u&&(o&&(o+=`,`),o+=JSON.stringify(l)+`:`+u)}return i.splice(s,1),`{`+o+`}`}})(e)}}));Se(),Ce();var Te=e(we());function Ee(e,t,n){return e.fields=t||[],e.fname=n,e}function De(e){throw Error(e)}function Oe(e){var t=[],n=null,r=0,i=e.length,a=``,o,s,c;e+=``;function l(){t.push(a+e.substring(o,s)),a=``,o=s+1}for(o=s=0;s<i;++s)if(c=e[s],c===`\\`)a+=e.substring(o,s),o=++s;else if(c===n)l(),n=null,r=-1;else if(n)continue;else o===r&&c===`"`||o===r&&c===`'`?(o=s+1,n=c):c===`.`&&!r?s>o?l():o=s+1:c===`[`?(s>o&&l(),r=o=s+1):c===`]`&&(r||De(`Access path missing open bracket: `+e),r>0&&l(),r=0,o=s+1);return r&&De(`Access path missing closing bracket: `+e),n&&De(`Access path missing closing quote: `+e),s>o&&(s++,l()),t}var ke=Array.isArray;function Ae(e){return e===Object(e)}function je(e){return typeof e==`string`}function Me(e){return ke(e)?`[`+e.map(Me)+`]`:Ae(e)||je(e)?JSON.stringify(e).replace(`\u2028`,`\\u2028`).replace(`\u2029`,`\\u2029`):e}function Ne(e,t){var n=Oe(e),r=`return _[`+n.map(Me).join(`][`)+`];`;return Ee(Function(`_`,r),[e=n.length===1?n[0]:e],t||e)}var Pe=[];Ne(`id`),Ee(function(e){return e},Pe,`identity`),Ee(function(){return 0},Pe,`zero`),Ee(function(){return 1},Pe,`one`),Ee(function(){return!0},Pe,`true`),Ee(function(){return!1},Pe,`false`);function Fe(e,t,n){var r=[t].concat([].slice.call(n));console[e](...r)}function Ie(e,t){var n=e||0;return{level:function(e){return arguments.length?(n=+e,this):n},error:function(){return n>=1&&Fe(t||`error`,`ERROR`,arguments),this},warn:function(){return n>=2&&Fe(t||`warn`,`WARN`,arguments),this},info:function(){return n>=3&&Fe(t||`log`,`INFO`,arguments),this},debug:function(){return n>=4&&Fe(t||`log`,`DEBUG`,arguments),this}}}function Le(e){return typeof e==`boolean`}function Re(e){for(var t={},n=0,r=e.length;n<r;++n)t[e[n]]=!0;return t}Set.prototype.toJSON=function(){return`Set(${[...this].map(e=>(0,Te.default)(e)).join(`,`)})`};var j=Te.default;function M(e,t){return e.indexOf(t)>-1}function ze(e,t){let n=0;for(let[r,i]of e.entries())if(t(i,r,n++))return!0;return!1}var N=Object.keys;function Be(e){let t=e.replace(/\W/g,`_`);return(e.match(/^\d+/)?`_`:``)+t}function Ve(e,t=`datum`){return`${t}[${Me(Oe(e).join(`.`))}]`}function He(e){return`${Oe(e).map(e=>e.replace(`.`,`\\.`)).join(`\\.`)}`}function Ue(...e){for(let t of e)if(t!==void 0)return t}function We(e){return Ge(e)?e:`__${e}`}function Ge(e){return e.indexOf(`__`)===0}var Ke=`column`,qe=`facet`,Je=`latitude`,Ye=`longitude`,Xe=`latitude2`,Ze=`longitude2`,Qe=`color`,$e=`fill`,et=`stroke`,tt=`shape`,nt=`size`,rt=`opacity`,it=`fillOpacity`,at=`strokeOpacity`,ot=`strokeWidth`,st=`text`,ct=`order`,lt=`detail`,ut=`tooltip`,dt=`href`,ft={x:1,y:1,x2:1,y2:1},pt={longitude:1,longitude2:1,latitude:1,latitude2:1};N(pt);var mt=Object.assign({},ft,pt,{color:1,fill:1,stroke:1,opacity:1,fillOpacity:1,strokeOpacity:1,strokeWidth:1,size:1,shape:1,order:1,text:1,detail:1,key:1,tooltip:1,href:1});function ht(e){return e===`color`||e===`fill`||e===`stroke`}var gt={row:1,column:1,facet:1};N(gt);var _t=Object.assign({},mt,gt),vt=N(_t),{order:yt,detail:bt}=_t,xt=xe(_t,[`order`,`detail`]),{order:St,detail:Ct,row:wt,column:Tt,facet:Et}=_t,Dt=xe(_t,[`order`,`detail`,`row`,`column`,`facet`]);N(xt),N(Dt),N(mt);var{x:Ot,y:kt,x2:At,y2:jt,latitude:Mt,longitude:Nt,latitude2:Pt,longitude2:Ft}=mt,It=xe(mt,[`x`,`y`,`x2`,`y2`,`latitude`,`longitude`,`latitude2`,`longitude2`]),Lt=N(It),Rt={x:1,y:1};N(Rt);var{text:zt,tooltip:Bt,href:Vt,detail:Ht,key:Ut,order:Wt}=It,Gt=xe(It,[`text`,`tooltip`,`href`,`detail`,`key`,`order`]);N(Gt);var Kt=Object.assign({},Rt,Gt);N(Kt);function qt(e){return!!Kt[e]}function Jt(e,t){return Qt(e)[t]}var Yt={area:`always`,bar:`always`,circle:`always`,geoshape:`always`,line:`always`,rule:`always`,point:`always`,rect:`always`,square:`always`,trail:`always`,text:`always`,tick:`always`},{geoshape:Xt}=Yt,Zt=xe(Yt,[`geoshape`]);function Qt(e){switch(e){case Qe:case $e:case et:case lt:case`key`:case ut:case dt:case ct:case rt:case it:case at:case ot:case qe:case`row`:case Ke:return Yt;case`x`:case`y`:case Je:case Ye:return Zt;case`x2`:case`y2`:case Xe:case Ze:return{rule:`always`,bar:`always`,rect:`always`,area:`always`,circle:`binned`,point:`binned`,square:`binned`,tick:`binned`,line:`binned`,trail:`binned`};case nt:return{point:`always`,tick:`always`,rule:`always`,circle:`always`,square:`always`,bar:`always`,text:`always`,line:`always`,trail:`always`};case tt:return{point:`always`,geoshape:`always`};case st:return{text:`always`}}}function $t(e){switch(e){case`x`:case`y`:case nt:case ot:case rt:case it:case at:case`x2`:case`y2`:return;case qe:case`row`:case Ke:case tt:case st:case ut:case dt:return`discrete`;case Qe:case $e:case et:return`flexible`;case Je:case Ye:case Xe:case Ze:case lt:case`key`:case ct:return}throw Error(`rangeType not implemented for `+e)}var en={orient:1,bandPosition:1,domain:1,domainColor:1,domainDash:1,domainDashOffset:1,domainOpacity:1,domainWidth:1,format:1,formatType:1,grid:1,gridColor:1,gridDash:1,gridDashOffset:1,gridOpacity:1,gridWidth:1,labelAlign:1,labelAngle:1,labelBaseline:1,labelBound:1,labelColor:1,labelFlush:1,labelFlushOffset:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,labelSeparation:1,maxExtent:1,minExtent:1,offset:1,position:1,tickColor:1,tickCount:1,tickDash:1,tickDashOffset:1,tickExtra:1,tickMinStep:1,tickOffset:1,tickOpacity:1,tickRound:1,ticks:1,tickSize:1,tickWidth:1,title:1,titleAlign:1,titleAnchor:1,titleAngle:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleOpacity:1,titlePadding:1,titleX:1,titleY:1,values:1,zindex:1},tn=Object.assign({},en,{encoding:1});N(Object.assign({gridScale:1,scale:1},en,{encode:1}));var nn=N(tn),rn={clipHeight:1,columnPadding:1,columns:1,cornerRadius:1,direction:1,fillColor:1,format:1,formatType:1,gradientLength:1,gradientOpacity:1,gradientStrokeColor:1,gradientStrokeWidth:1,gradientThickness:1,gridAlign:1,labelAlign:1,labelBaseline:1,labelColor:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labelSeparation:1,legendX:1,legendY:1,offset:1,orient:1,padding:1,rowPadding:1,strokeColor:1,symbolDash:1,symbolDashOffset:1,symbolFillColor:1,symbolOffset:1,symbolOpacity:1,symbolSize:1,symbolStrokeColor:1,symbolStrokeWidth:1,symbolType:1,tickCount:1,tickMinStep:1,title:1,titleAlign:1,titleAnchor:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleOpacity:1,titleOrient:1,titlePadding:1,type:1,values:1,zindex:1},an=Object.assign({},rn,{opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,encode:1}),on=N(rn);N(an);var sn=r({BAR_WITH_POINT_SCALE_AND_RANGESTEP_NULL:()=>Hn,CANNOT_FIX_RANGE_STEP_WITH_FIT:()=>un,CANNOT_UNION_CUSTOM_DOMAIN_WITH_FIELD_DOMAIN:()=>Gn,CONCAT_CANNOT_SHARE_AXIS:()=>yn,FIT_NON_SINGLE:()=>ln,INVALID_CHANNEL_FOR_AXIS:()=>cr,INVALID_SPEC:()=>cn,LINE_WITH_VARYING_SIZE:()=>In,MORE_THAN_ONE_SORT:()=>sr,NO_FIELDS_NEEDS_AS:()=>wn,NO_INIT_SCALE_BINDINGS:()=>gn,REPEAT_CANNOT_SHARE_AXIS:()=>bn,SCALE_BINDINGS_CONTINUOUS:()=>hn,UNABLE_TO_MERGE_DOMAINS:()=>or,cannotApplySizeToNonOrientedMark:()=>Xn,cannotProjectOnChannelWithoutField:()=>dn,cannotStackNonLinearScale:()=>ur,cannotStackRangedMark:()=>lr,cannotUseScalePropertyWithNonColor:()=>Kn,channelRequiredForBinned:()=>br,columnsNotSupportByRowCol:()=>vn,dayReplacedWithDate:()=>pr,differentParse:()=>Sn,discreteChannelCannotEncode:()=>Vn,domainRequiredForThresholdScale:()=>xr,domainSortDropped:()=>ar,droppedDay:()=>mr,droppingColor:()=>Nn,emptyFieldDef:()=>Pn,encodingOverridden:()=>Tn,errorBand1DNotSupport:()=>yr,errorBarCenterAndExtentAreNotNeeded:()=>hr,errorBarCenterIsNotNeeded:()=>vr,errorBarCenterIsUsedWithWrongExtent:()=>gr,errorBarContinuousAxisHasCustomizedAggregate:()=>_r,facetChannelDropped:()=>Bn,facetChannelShouldBeDiscrete:()=>zn,incompatibleChannel:()=>Ln,independentScaleMeansIndependentGuide:()=>ir,invalidAggregate:()=>jn,invalidEncodingChannel:()=>Rn,invalidFieldType:()=>On,invalidFieldTypeForCountAggregate:()=>An,invalidTimeUnit:()=>fr,invalidTransformIgnored:()=>Cn,latLongDeprecated:()=>Fn,lineWithRange:()=>Un,mergeConflictingDomainProperty:()=>rr,mergeConflictingProperty:()=>nr,missingFieldType:()=>Mn,nearestNotSupportForContinuous:()=>fn,noSuchRepeatedValue:()=>_n,nonZeroScaleUsedWithLengthMark:()=>kn,orientOverridden:()=>Wn,primitiveChannelDef:()=>Dn,projectionOverridden:()=>En,rangeStepDropped:()=>Zn,scalePropertyNotWorkWithScaleType:()=>er,scaleTypeNotWorkWithChannel:()=>Qn,scaleTypeNotWorkWithFieldDef:()=>$n,scaleTypeNotWorkWithMark:()=>tr,selectionNotFound:()=>mn,selectionNotSupported:()=>pn,stackNonSummativeAggregate:()=>dr,unaggregateDomainHasNoEffectForRawField:()=>qn,unaggregateDomainWithNonSharedDomainOp:()=>Jn,unaggregatedDomainWithLogScale:()=>Yn,unrecognizedParse:()=>xn}),cn=`Invalid spec`,ln=`Autosize "fit" only works for single views and layered views.`,un=`Cannot use a fixed value of "rangeStep" when "autosize" is "fit".`;function dn(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`}function fn(e){return`The "nearest" transform is not supported for ${e} marks.`}function pn(e){return`Selection not supported for ${e} yet`}function mn(e){return`Cannot find a selection named "${e}"`}var hn=`Scale bindings are currently only supported for scales with unbinned, continuous domains.`,gn=`Selections bound to scales cannot be separately initialized.`;function _n(e){return`Unknown repeated value "${e}".`}function vn(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`}var yn=`Axes cannot be shared in concatenated views yet (https://github.com/vega/vega-lite/issues/2415).`,bn=`Axes cannot be shared in repeated views yet (https://github.com/vega/vega-lite/issues/2415).`;function xn(e){return`Unrecognized parse "${e}".`}function Sn(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`}function Cn(e){return`Ignoring an invalid transform: ${j(e)}.`}var wn=`If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.`;function Tn(e){return`Layer's shared ${e.join(`,`)} channel ${e.length===1?`is`:`are`} overriden`}function En(e){let{parentProjection:t,projection:n}=e;return`Layer's shared projection ${j(t)} is overridden by a child projection ${j(n)}.`}function Dn(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${j(n)}}.`}function On(e){return`Invalid field type "${e}"`}function kn(e,t,n){return`A ${n.scaleType?`${n.scaleType} scale`:n.zeroFalse?`scale with zero=false`:`scale with custom domain that excludes zero`} is used to encode ${e}'s ${t}. This can be misleading as the ${t===`x`?`width`:`height`} of the ${e} can be arbitrary based on the scale domain. You may want to use point mark instead.`}function An(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`}function jn(e){return`Invalid aggregation operator "${e}"`}function Mn(e,t){return`Missing type for channel "${e}", using "${t}" instead.`}function Nn(e,t){let{fill:n,stroke:r}=t;return`Dropping color ${e} as the plot also has `+(n&&r?`fill and stroke`:n?`fill`:`stroke`)}function Pn(e,t){return`Dropping ${j(e)} from channel "${t}" since it does not contain data field or value.`}function Fn(e,t,n){return`${e}-encoding with type ${t} is deprecated. Replacing with ${n}-encoding.`}var In=`Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.`;function Ln(e,t,n){return`${e} dropped as it is incompatible with "${t}"${n?` when ${n}`:``}.`}function Rn(e){return`${e}-encoding is dropped as ${e} is not a valid encoding channel.`}function zn(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`}function Bn(e){return`Facet encoding dropped as ${e.join(` and `)} ${e.length>1?`are`:`is`} also specified.`}function Vn(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${t===`ordinal`?`order`:`magnitude`}.`}var Hn=`Bar mark should not be used with point scale when rangeStep is null. Please use band scale instead.`;function Un(e,t){return`Line mark is for continuous lines and thus cannot be used with ${e&&t?`x2 and y2`:e?`x2`:`y2`}. We will use the rule mark (line segments) instead.`}function Wn(e,t){return`Specified orient "${e}" overridden with "${t}"`}var Gn=`custom domain scale cannot be unioned with default field-based domain`;function Kn(e){return`Cannot use the scale property "${e}" with non-color channel.`}function qn(e){return`Using unaggregated domain with raw field has no effect (${j(e)}).`}function Jn(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`}function Yn(e){return`Unaggregated domain is currently unsupported for log scale (${j(e)}).`}function Xn(e){return`Cannot apply size to non-oriented mark "${e}".`}function Zn(e){return`rangeStep for "${e}" is dropped as top-level ${e===`x`?`width`:`height`} is provided.`}function Qn(e,t,n){return`Channel "${e}" does not work with "${t}" scale. We are using "${n}" scale instead.`}function $n(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`}function er(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`}function tr(e,t){return`Scale type "${t}" does not work with mark "${e}".`}function nr(e,t,n,r){return`Conflicting ${t.toString()} property "${e.toString()}" (${j(n)} and ${j(r)}). Using ${j(n)}.`}function rr(e,t,n,r){return`Conflicting ${t.toString()} property "${e.toString()}" (${j(n)} and ${j(r)}). Using the union of the two domains.`}function ir(e){return`Setting the scale to be independent for "${e}" means we also have to set the guide (axis or legend) to be independent.`}function ar(e){return`Dropping sort property ${j(e)} as unioned domains only support boolean or op 'count'.`}var or=`Unable to merge domains`,sr=`Domains that should be unioned has conflicting sort properties. Sort will be set to true.`,cr=`Invalid channel for axis.`;function lr(e){return`Cannot stack "${e}" if there is already "${e}2"`}function ur(e){return`Cannot stack non-linear scale (${e})`}function dr(e){return`Stacking is applied even though the aggregate function is non-summative ("${e}")`}function fr(e,t){return`Invalid ${e}: ${j(t)}`}function pr(e){return`Time unit "${e}" is not supported. We are replacing it with ${e.replace(`day`,`date`)}.`}function mr(e){return`Dropping day from datetime ${j(e)} as day cannot be combined with other units.`}function hr(e,t){return`${t?`extent `:``}${t&&e?`and `:``}${e?`center `:``}${t&&e?`are `:`is `}not needed when data are aggregated.`}function gr(e,t,n){return`${e} is not usually used with ${t} for ${n}.`}function _r(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`}function vr(e,t){return`Center is not needed to be specified in ${t} when extent is ${e}.`}function yr(e){return`1D error band does not support ${e}`}function br(e){return`Channel ${e} is required for "binned" bin`}function xr(e){return`Domain for ${e} is required for threshold scale`}var Sr=sn,Cr=Ie(2);function wr(...e){Cr.warn.apply(Cr,arguments)}var Tr={quantitative:1,ordinal:1,temporal:1,nominal:1,geojson:1},P=`quantitative`,Er=`ordinal`,Dr=`temporal`,Or=`nominal`,kr=`geojson`;function Ar(e){if(e)switch(e=e.toLowerCase(),e){case`q`:case P:return`quantitative`;case`t`:case Dr:return`temporal`;case`o`:case Er:return`ordinal`;case`n`:case Or:return`nominal`;case kr:return`geojson`}}var F;(function(e){e.LINEAR=`linear`,e.LOG=`log`,e.POW=`pow`,e.SQRT=`sqrt`,e.SYMLOG=`symlog`,e.TIME=`time`,e.UTC=`utc`,e.QUANTILE=`quantile`,e.QUANTIZE=`quantize`,e.THRESHOLD=`threshold`,e.BIN_ORDINAL=`bin-ordinal`,e.ORDINAL=`ordinal`,e.POINT=`point`,e.BAND=`band`})(F||={});var jr=N({linear:`numeric`,log:`numeric`,pow:`numeric`,sqrt:`numeric`,symlog:`numeric`,time:`time`,utc:`time`,ordinal:`ordinal`,"bin-ordinal":`bin-ordinal`,point:`ordinal-position`,band:`ordinal-position`,quantile:`discretizing`,quantize:`discretizing`,threshold:`discretizing`}),Mr=[`linear`,`log`,`pow`,`sqrt`,`symlog`,`time`,`utc`],Nr=Re(Mr),Pr=Re([`quantile`,`quantize`,`threshold`]),Fr=Re(Mr.concat([`quantile`,`quantize`,`threshold`])),Ir=Re([`ordinal`,`bin-ordinal`,`point`,`band`]);function Lr(e){return e in Ir}function Rr(e){return e in Fr}function zr(e){return e in Nr}function Br(e){return e in Pr}var Vr={type:1,domain:1,align:1,range:1,rangeStep:1,scheme:1,bins:1,reverse:1,round:1,clamp:1,nice:1,base:1,exponent:1,constant:1,interpolate:1,zero:1,padding:1,paddingInner:1,paddingOuter:1},Hr=N(Vr),{type:Ur,domain:Wr,range:Gr,rangeStep:Kr,scheme:qr}=Vr;N(xe(Vr,[`type`,`domain`,`range`,`rangeStep`,`scheme`])),Qr();function Jr(e,t){switch(t){case`type`:case`domain`:case`reverse`:case`range`:return!0;case`scheme`:case`interpolate`:return!M([`point`,`band`,`identity`],e);case`bins`:return!M([`point`,`band`,`identity`,`ordinal`],e);case`round`:return zr(e)||e===`band`||e===`point`;case`padding`:return zr(e)||M([`point`,`band`],e);case`paddingOuter`:case`rangeStep`:case`align`:return M([`point`,`band`],e);case`paddingInner`:return e===`band`;case`clamp`:return zr(e);case`nice`:return zr(e)||e===`quantize`||e===`threshold`;case`exponent`:return e===`pow`;case`base`:return e===`log`;case`constant`:return e===`symlog`;case`zero`:return Rr(e)&&!M([`log`,`time`,`utc`,`threshold`,`quantile`],e)}}function Yr(e,t){switch(t){case`interpolate`:case`scheme`:return ht(e)?void 0:Sr.cannotUseScalePropertyWithNonColor(e);case`align`:case`type`:case`bins`:case`domain`:case`range`:case`base`:case`exponent`:case`constant`:case`nice`:case`padding`:case`paddingInner`:case`paddingOuter`:case`rangeStep`:case`reverse`:case`round`:case`clamp`:case`zero`:return}}function Xr(e,t){return M([`ordinal`,`nominal`],t)?e===void 0||Lr(e):t===`temporal`?M([F.TIME,F.UTC,void 0],e):t!==`quantitative`||M([F.LOG,F.POW,F.SQRT,F.SYMLOG,F.QUANTILE,F.QUANTIZE,F.THRESHOLD,F.LINEAR,void 0],e)}function Zr(e,t){switch(e){case`x`:case`y`:return zr(t)||M([`band`,`point`],t);case nt:case ot:case rt:case it:case at:return zr(t)||Br(t)||M([`band`,`point`],t);case Qe:case $e:case et:return t!==`band`;case tt:return t===`ordinal`}return!1}function Qr(){let e={};for(let t of vt)for(let n of N(Tr))for(let r of jr){let i=$r(t,n);Zr(t,r)&&Xr(r,n)&&(e[i]=e[i]||[],e[i].push(r))}return e}function $r(e,t){return e+`_`+t}var ei=i(((e,t)=>{var n=t.exports,r=`__name__`;n.namedfunc=function(e,t){return t[r]=e,t},n.name=function(e){return e==null?null:e[r]},n.identity=function(e){return e},n.true=n.namedfunc(`true`,function(){return!0}),n.false=n.namedfunc(`false`,function(){return!1}),n.duplicate=function(e){return JSON.parse(JSON.stringify(e))},n.equal=function(e,t){return JSON.stringify(e)===JSON.stringify(t)},n.extend=function(e){for(var t,n,r=1,i=arguments.length;r<i;++r)for(n in t=arguments[r],t)e[n]=t[n];return e},n.length=function(e){return e!=null&&e.length!=null?e.length:null},n.keys=function(e){var t=[],n;for(n in e)t.push(n);return t},n.vals=function(e){var t=[],n;for(n in e)t.push(e[n]);return t},n.toMap=function(e,t){return(t=n.$(t))?e.reduce(function(e,n){return e[t(n)]=1,e},{}):e.reduce(function(e,t){return e[t]=1,e},{})},n.keystr=function(e){var t=e.length;if(!t)return``;for(var n=String(e[0]),r=1;r<t;++r)n+=`|`+String(e[r]);return n};var i=Object.prototype.toString;n.isObject=function(e){return e===Object(e)},n.isFunction=function(e){return i.call(e)===`[object Function]`},n.isString=function(e){return typeof value==`string`||i.call(e)===`[object String]`},n.isArray=Array.isArray||function(e){return i.call(e)===`[object Array]`},n.isNumber=function(e){return typeof e==`number`||i.call(e)===`[object Number]`},n.isBoolean=function(e){return e===!0||e===!1||i.call(e)==`[object Boolean]`},n.isDate=function(e){return i.call(e)===`[object Date]`},n.isValid=function(e){return e!=null&&e===e},n.isBuffer=typeof Buffer==`function`&&Buffer.isBuffer||n.false,n.number=function(e){return e==null||e===``?null:+e},n.boolean=function(e){return e==null||e===``?null:e!==`false`&&!!e},n.date=function(e,t){return e==null||e===``?null:(t||Date).parse(e)},n.array=function(e){return e==null?[]:n.isArray(e)?e:[e]},n.str=function(e){return n.isArray(e)?`[`+e.map(n.str)+`]`:n.isObject(e)||n.isString(e)?JSON.stringify(e).replace(`\u2028`,`\\u2028`).replace(`\u2029`,`\\u2029`):e};var a=/\[(.*?)\]|[^.\[]+/g;n.field=function(e){return String(e).match(a).map(function(e){return e[0]===`[`?e[1]!==`'`&&e[1]!==`"`?e.slice(1,-1):e.slice(2,-2).replace(/\\(["'])/g,`$1`):e})},n.accessor=function(e){return e==null||n.isFunction(e)?e:n.namedfunc(e,Function(`x`,`return x[`+n.field(e).map(n.str).join(`][`)+`];`))},n.$=n.accessor,n.mutator=function(e){var t;return n.isString(e)&&(t=n.field(e)).length>1?function(e,n){for(var r=0;r<t.length-1;++r)e=e[t[r]];e[t[r]]=n}:function(t,n){t[e]=n}},n.$func=function(e,t){return function(r){r=n.$(r)||n.identity;var i=e+(n.name(r)?`_`+n.name(r):``);return n.namedfunc(i,function(e){return t(r(e))})}},n.$valid=n.$func(`valid`,n.isValid),n.$length=n.$func(`length`,n.length),n.$in=function(e,t){e=n.$(e);var r=n.isArray(t)?n.toMap(t):t;return function(t){return!!r[e(t)]}},n.comparator=function(e){var t=[];return e===void 0&&(e=[]),e=n.array(e).map(function(e){var r=1;return e[0]===`-`?(r=-1,e=e.slice(1)):e[0]===`+`&&(r=1,e=e.slice(1)),t.push(r),n.accessor(e)}),function(r,i){var a,o,s,c;for(a=0,o=e.length;a<o;++a)if(s=e[a],c=n.cmp(s(r),s(i)),c)return c*t[a];return 0}},n.cmp=function(e,t){return(e<t||e==null)&&t!=null?-1:(e>t||t==null)&&e!=null?1:(t=t instanceof Date?+t:t,(e=e instanceof Date?+e:e)!==e&&t===t?-1:+(t!==t&&e===e))},n.numcmp=function(e,t){return e-t},n.stablesort=function(e,t,n){var r=e.reduce(function(e,t,r){return e[n(t)]=r,e},{});return e.sort(function(e,i){var a=t(e),o=t(i);return a<o?-1:a>o?1:r[n(e)]-r[n(i)]}),e},n.permute=function(e){for(var t=e.length,n,r;t;)r=Math.floor(Math.random()*t--),n=e[t],e[t]=e[r],e[r]=n},n.pad=function(e,t,n,r){r||=` `;var i=t-e.length;if(i<=0)return e;switch(n){case`left`:return o(i,r)+e;case`middle`:case`center`:return o(Math.floor(i/2),r)+e+o(Math.ceil(i/2),r);default:return e+o(i,r)}};function o(e,t){var n=``,r;for(r=0;r<e;++r)n+=t;return n}n.truncate=function(e,t,n,r,i){var a=e.length;if(a<=t)return e;i=i===void 0?`…`:String(i);var o=Math.max(0,t-i.length);switch(n){case`left`:return i+(r?s(e,o,1):e.slice(a-o));case`middle`:case`center`:var c=Math.ceil(o/2),l=Math.floor(o/2);return(r?s(e,c):e.slice(0,c))+i+(r?s(e,l,1):e.slice(a-l));default:return(r?s(e,o):e.slice(0,o))+i}};function s(e,t,n){var r=0,i=e.split(c);return e=n?(i=i.reverse()).filter(function(e){return r+=e.length,r<=t}).reverse():i.filter(function(e){return r+=e.length,r<=t}),e.length?e.join(``).trim():i[0].slice(0,t)}var c=/([\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u2028\u2029\u3000\uFEFF])/})),I=ei();function L(e,t){return e.indexOf(t)!==-1}function ti(e,t){for(let n=0;n<e.length;n++)if(!t(e[n],n))return!1;return!0}function R(e,t,n){if(e.forEach)e.forEach.call(n,t);else for(let r in e)t.call(n,e[r],r,e)}function ni(e,t){let n=0,r;for(r in e)if(t(e[r],r,n++))return!0;return!1}function ri(e,t){return e.filter(function(e){return!L(t,e)})}function ii(e){return Object.keys(e)}function ai(e){return!!e.parent}var oi={channel:1,aggregate:1,autoCount:1,bin:1,timeUnit:1,hasFn:1,sort:1,stack:1,field:1,type:1,format:1,scale:1,axis:1,legend:1,value:1},si=ii(oi);function ci(e){return e in oi}var li={bin:1,scale:1,sort:1,axis:1,legend:1};function ui(e){return li[e]}var di=[`maxbins`,`divide`,`extent`,`base`,`step`,`steps`,`minstep`],fi=[`field`,`op`,`order`],pi=di.map(e=>({parent:`bin`,child:e})),mi=fi.map(e=>({parent:`sort`,child:e})),hi=Hr.map(e=>({parent:`scale`,child:e})),gi=nn.map(e=>({parent:`axis`,child:e})),_i=on.map(e=>({parent:`legend`,child:e})),vi=[].concat(pi,mi,hi,gi,_i),yi=[`width`,`height`,`background`,`padding`,`title`],bi=`.`;function xi(e){return ai(e)?e.parent+bi+e.child:e}function Si(e){let t=e.split(bi);if(t.length===1)return e;if(t.length===2)return{parent:t[0],child:t[1]};throw`Invalid property key with `+t.length+` dots: `+e}var Ci=vi.reduce((e,t)=>(e[t.parent]=e[t.parent]||[],e[t.parent][t.child]=t,e),{});function wi(e,t){return(Ci[e]||{})[t]}function Ti(e){return ci(e)||ai(e)}var Ei=[].concat(si,vi),Di=[`type`,`field`,`bin`,`timeUnit`,`aggregate`,`autoCount`,`channel`,`mark`,`stack`,`scale`,`sort`,`axis`,`legend`].concat(pi,hi,gi,_i,mi),z;(function(e){e.MARK=`mark`,e.TRANSFORM=`transform`,e.STACK=`stack`,e.FORMAT=`format`,e.CHANNEL=`channel`,e.AGGREGATE=`aggregate`,e.AUTOCOUNT=`autoCount`,e.BIN=`bin`,e.HAS_FN=`hasFn`,e.TIMEUNIT=`timeUnit`,e.FIELD=`field`,e.TYPE=`type`,e.SORT=`sort`,e.SCALE=`scale`,e.AXIS=`axis`,e.LEGEND=`legend`,e.WIDTH=`width`,e.HEIGHT=`height`,e.BACKGROUND=`background`,e.PADDING=`padding`,e.TITLE=`title`})(z||={});var Oi=`area`,ki=`line`,Ai=`point`,ji=`rect`,Mi=`rule`,Ni=`text`,Pi=`tick`,Fi=`circle`,Ii=`square`,Li={area:1,bar:1,line:1,point:1,text:1,tick:1,trail:1,rect:1,geoshape:1,rule:1,circle:1,square:1};function Ri(e){return M([`line`,`area`,`trail`],e)}var zi=N(Li);function Bi(e){return e.type}Re(zi),[`january`,`february`,`march`,`april`,`may`,`june`,`july`,`august`,`september`,`october`,`november`,`december`].map(e=>e.substr(0,3)),[`sunday`,`monday`,`tuesday`,`wednesday`,`thursday`,`friday`,`saturday`].map(e=>e.substr(0,3));var B;(function(e){e.YEAR=`year`,e.MONTH=`month`,e.DAY=`day`,e.DATE=`date`,e.HOURS=`hours`,e.MINUTES=`minutes`,e.SECONDS=`seconds`,e.MILLISECONDS=`milliseconds`,e.YEARMONTH=`yearmonth`,e.YEARMONTHDATE=`yearmonthdate`,e.YEARMONTHDATEHOURS=`yearmonthdatehours`,e.YEARMONTHDATEHOURSMINUTES=`yearmonthdatehoursminutes`,e.YEARMONTHDATEHOURSMINUTESSECONDS=`yearmonthdatehoursminutesseconds`,e.MONTHDATE=`monthdate`,e.MONTHDATEHOURS=`monthdatehours`,e.HOURSMINUTES=`hoursminutes`,e.HOURSMINUTESSECONDS=`hoursminutesseconds`,e.MINUTESSECONDS=`minutesseconds`,e.SECONDSMILLISECONDS=`secondsmilliseconds`,e.QUARTER=`quarter`,e.YEARQUARTER=`yearquarter`,e.QUARTERMONTH=`quartermonth`,e.YEARQUARTERMONTH=`yearquartermonth`,e.UTCYEAR=`utcyear`,e.UTCMONTH=`utcmonth`,e.UTCDAY=`utcday`,e.UTCDATE=`utcdate`,e.UTCHOURS=`utchours`,e.UTCMINUTES=`utcminutes`,e.UTCSECONDS=`utcseconds`,e.UTCMILLISECONDS=`utcmilliseconds`,e.UTCYEARMONTH=`utcyearmonth`,e.UTCYEARMONTHDATE=`utcyearmonthdate`,e.UTCYEARMONTHDATEHOURS=`utcyearmonthdatehours`,e.UTCYEARMONTHDATEHOURSMINUTES=`utcyearmonthdatehoursminutes`,e.UTCYEARMONTHDATEHOURSMINUTESSECONDS=`utcyearmonthdatehoursminutesseconds`,e.UTCMONTHDATE=`utcmonthdate`,e.UTCMONTHDATEHOURS=`utcmonthdatehours`,e.UTCHOURSMINUTES=`utchoursminutes`,e.UTCHOURSMINUTESSECONDS=`utchoursminutesseconds`,e.UTCMINUTESSECONDS=`utcminutesseconds`,e.UTCSECONDSMILLISECONDS=`utcsecondsmilliseconds`,e.UTCQUARTER=`utcquarter`,e.UTCYEARQUARTER=`utcyearquarter`,e.UTCQUARTERMONTH=`utcquartermonth`,e.UTCYEARQUARTERMONTH=`utcyearquartermonth`})(B||={});var Vi={year:1,quarter:1,month:1,day:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},Hi=N(Vi);function Ui(e){return!!Vi[e]}var Wi={utcyear:1,utcquarter:1,utcmonth:1,utcday:1,utcdate:1,utchours:1,utcminutes:1,utcseconds:1,utcmilliseconds:1};function Gi(e){return!!Wi[e]}var Ki={yearquarter:1,yearquartermonth:1,yearmonth:1,yearmonthdate:1,yearmonthdatehours:1,yearmonthdatehoursminutes:1,yearmonthdatehoursminutesseconds:1,quartermonth:1,monthdate:1,monthdatehours:1,hoursminutes:1,hoursminutesseconds:1,minutesseconds:1,secondsmilliseconds:1},qi={utcyearquarter:1,utcyearquartermonth:1,utcyearmonth:1,utcyearmonthdate:1,utcyearmonthdatehours:1,utcyearmonthdatehoursminutes:1,utcyearmonthdatehoursminutesseconds:1,utcquartermonth:1,utcmonthdate:1,utcmonthdatehours:1,utchoursminutes:1,utchoursminutesseconds:1,utcminutesseconds:1,utcsecondsmilliseconds:1},Ji=Object.assign({},Wi,qi);function Yi(e){return!!Ji[e]}var Xi=Object.assign({},Vi,Wi,Ki,qi);N(Xi);function Zi(e){return!!Xi[e]}var Qi={year:`setFullYear`,month:`setMonth`,date:`setDate`,hours:`setHours`,minutes:`setMinutes`,seconds:`setSeconds`,milliseconds:`setMilliseconds`,quarter:null,day:null};function $i(e,t){let n=Yi(e),r=n?new Date(Date.UTC(1972,0,1,0,0,0,0)):new Date(1972,0,1,0,0,0,0);for(let i of Hi)if(ta(e,i))switch(i){case B.DAY:throw Error(`Cannot convert to TimeUnits containing 'day'`);case B.QUARTER:{let{getDateMethod:e,setDateMethod:i}=ea(`month`,n);r[i](Math.floor(t[e]()/3)*3);break}default:{let{getDateMethod:e,setDateMethod:a}=ea(i,n);r[a](t[e]())}}return r}function ea(e,t){let n=Qi[e];return{setDateMethod:t?`setUTC`+n.substr(3):n,getDateMethod:`get`+(t?`UTC`:``)+n.substr(3)}}function ta(e,t){let n=e.indexOf(t);return n>-1&&(t!==B.SECONDS||n===0||e.charAt(n-1)!==`i`)}function V(e){return na(e)||ra(e)}function na(e){return e===`?`}function ra(e){return e!==void 0&&e!=null&&(!!e.enum||!!e.name)&&!(0,I.isArray)(e)}function ia(e,t,n){return(0,I.extend)({},{name:t,enum:n},e===`?`?{}:e)}function aa(e){let t={},n={};for(let r of e){let e=[0];for(let t=0;t<r.length;t++)r.charAt(t).toUpperCase()===r.charAt(t)&&e.push(t);let i=e.map(e=>r.charAt(e)).join(``).toLowerCase();if(!n[i]){t[r]=i,n[i]=!0;continue}if(e[e.length-1]!==r.length-1&&(i=e.concat([r.length-1]).map(e=>r.charAt(e)).join(``).toLowerCase(),!n[i])){t[r]=i,n[i]=!0;continue}for(let e=1;!t[r];e++){let a=i+`_`+e;if(!n[a]){t[r]=a,n[a]=!0;break}}}return t}var oa={mark:`m`,channel:`c`,aggregate:`a`,autoCount:`#`,hasFn:`h`,bin:`b`,sort:`so`,stack:`st`,scale:`s`,format:`f`,axis:`ax`,legend:`l`,value:`v`,timeUnit:`tu`,field:`f`,type:`t`,binProps:{maxbins:`mb`,min:`mi`,max:`ma`,base:`b`,step:`s`,steps:`ss`,minstep:`ms`,divide:`d`},sortProps:{field:`f`,op:`o`,order:`or`},scaleProps:aa(Hr),axisProps:aa(nn),legendProps:aa(on)};function sa(e){if(ai(e))return oa[e.parent]+`-`+oa[e.parent+`Props`][e.child];if(oa[e])return oa[e];throw Error(`Default name undefined for `+e)}var H=[!1,!0],ca={maxbins:[5,10,20],extent:[void 0],base:[10],step:[void 0],steps:[void 0],minstep:[void 0],divide:[[5,2]],binned:[!1],anchor:[void 0],nice:[!0]},la={field:[void 0],op:[`min`,`mean`],order:[`ascending`,`descending`]},ua={type:[void 0,F.LOG],domain:[void 0],base:[void 0],exponent:[1,2],constant:[void 0],bins:[void 0],clamp:H,nice:H,reverse:H,round:H,zero:H,padding:[void 0],paddingInner:[void 0],paddingOuter:[void 0],interpolate:[void 0],range:[void 0],rangeStep:[17,21],scheme:[void 0]},da={zindex:[1,0],offset:[void 0],orient:[void 0],values:[void 0],bandPosition:[void 0],encoding:[void 0],domain:H,domainColor:[void 0],domainDash:[void 0],domainDashOffset:[void 0],domainOpacity:[void 0],domainWidth:[void 0],formatType:[void 0],grid:H,gridColor:[void 0],gridDash:[void 0],gridDashOffset:[void 0],gridOpacity:[void 0],gridWidth:[void 0],format:[void 0],labels:H,labelAlign:[void 0],labelAngle:[void 0],labelBaseline:[void 0],labelColor:[void 0],labelFlushOffset:[void 0],labelFont:[void 0],labelFontSize:[void 0],labelFontStyle:[void 0],labelFontWeight:[void 0],labelLimit:[void 0],labelOpacity:[void 0],labelSeparation:[void 0],labelOverlap:[void 0],labelPadding:[void 0],labelBound:[void 0],labelFlush:[void 0],maxExtent:[void 0],minExtent:[void 0],position:[void 0],ticks:H,tickColor:[void 0],tickCount:[void 0],tickDash:[void 0],tickExtra:[void 0],tickDashOffset:[void 0],tickMinStep:[void 0],tickOffset:[void 0],tickOpacity:[void 0],tickRound:[void 0],tickSize:[void 0],tickWidth:[void 0],title:[void 0],titleAlign:[void 0],titleAnchor:[void 0],titleAngle:[void 0],titleBaseline:[void 0],titleColor:[void 0],titleFont:[void 0],titleFontSize:[void 0],titleFontStyle:[void 0],titleFontWeight:[void 0],titleLimit:[void 0],titleOpacity:[void 0],titlePadding:[void 0],titleX:[void 0],titleY:[void 0]},fa={mark:[Ai,`bar`,ki,Oi,ji,Pi,Ni],channel:[`x`,`y`,`row`,Ke,nt,Qe],aggregate:[void 0,`mean`],autoCount:H,bin:H,hasFn:H,timeUnit:[void 0,B.YEAR,B.MONTH,B.MINUTES,B.SECONDS],field:[void 0],type:[Or,Er,P,Dr],sort:[`ascending`,`descending`],stack:[`zero`,`normalize`,`center`,null],value:[void 0],format:[void 0],title:[void 0],scale:[!0],axis:H,legend:H,binProps:ca,sortProps:la,scaleProps:ua,axisProps:da,legendProps:{orient:[`left`,`right`],format:[void 0],type:[void 0],values:[void 0],zindex:[void 0],clipHeight:[void 0],columnPadding:[void 0],columns:[void 0],cornerRadius:[void 0],direction:[void 0],encoding:[void 0],fillColor:[void 0],formatType:[void 0],gridAlign:[void 0],offset:[void 0],padding:[void 0],rowPadding:[void 0],strokeColor:[void 0],labelAlign:[void 0],labelBaseline:[void 0],labelColor:[void 0],labelFont:[void 0],labelFontSize:[void 0],labelFontStyle:[void 0],labelFontWeight:[void 0],labelLimit:[void 0],labelOffset:[void 0],labelOpacity:[void 0],labelOverlap:[void 0],labelPadding:[void 0],labelSeparation:[void 0],legendX:[void 0],legendY:[void 0],gradientLength:[void 0],gradientOpacity:[void 0],gradientStrokeColor:[void 0],gradientStrokeWidth:[void 0],gradientThickness:[void 0],symbolDash:[void 0],symbolDashOffset:[void 0],symbolFillColor:[void 0],symbolOffset:[void 0],symbolOpacity:[void 0],symbolSize:[void 0],symbolStrokeColor:[void 0],symbolStrokeWidth:[void 0],symbolType:[void 0],tickCount:[void 0],tickMinStep:[void 0],title:[void 0],titleAnchor:[void 0],titleAlign:[void 0],titleBaseline:[void 0],titleColor:[void 0],titleFont:[void 0],titleFontSize:[void 0],titleFontStyle:[void 0],titleFontWeight:[void 0],titleLimit:[void 0],titleOpacity:[void 0],titleOrient:[void 0],titlePadding:[void 0]}};function pa(e,t,n){if(e===`field`||ai(e)&&e.parent===`sort`&&e.child===`field`)return t.fieldNames();let r;if(r=ai(e)?n.enum[e.parent+`Props`][e.child]:n.enum[e],r!==void 0)return r;throw Error(`No default enumValues for `+JSON.stringify(e))}var ma={verbose:!1,defaultSpecConfig:{line:{point:!0},scale:{useUnaggregatedDomain:!0}},propertyPrecedence:Di.map(xi),enum:fa,numberNominalProportion:.05,numberNominalLimit:40,constraintManuallySpecifiedValue:!1,autoAddCount:!1,hasAppropriateGraphicTypeForMark:!0,omitAggregate:!1,omitAggregatePlotWithDimensionOnlyOnFacet:!0,omitAggregatePlotWithoutDimension:!1,omitBarLineAreaWithOcclusion:!0,omitBarTickWithSize:!0,omitMultipleNonPositionalChannels:!0,omitRaw:!1,omitRawContinuousFieldForAggregatePlot:!0,omitRepeatedField:!0,omitNonPositionalOrFacetOverPositionalChannels:!0,omitTableWithOcclusionIfAutoAddCount:!0,omitVerticalDotPlot:!1,omitInvalidStackSpec:!0,omitNonSumStack:!0,preferredBinAxis:`x`,preferredTemporalAxis:`x`,preferredOrdinalAxis:`y`,preferredNominalAxis:`y`,preferredFacet:`row`,minCardinalityForBin:15,maxCardinalityForCategoricalColor:20,maxCardinalityForFacet:20,maxCardinalityForShape:6,timeUnitShouldHaveVariation:!0,typeMatchesSchemaType:!0,stylize:!0,smallRangeStepForHighCardinalityOrFacet:{maxCardinality:10,rangeStep:12},nominalColorScaleForHighCardinality:{maxCardinality:10,palette:`category20`},xAxisOnTopForHighYCardinalityWithoutColumn:{maxCardinality:30},maxGoodCardinalityForFacet:5,maxGoodCardinalityForColor:7,minPercentUniqueForKey:.8,minCardinalityForKey:50},ha={argmax:1,argmin:1,average:1,count:1,distinct:1,max:1,mean:1,median:1,min:1,missing:1,q1:1,q3:1,ci0:1,ci1:1,stderr:1,stdev:1,stdevp:1,sum:1,valid:1,values:1,variance:1,variancep:1};function ga(e){return!!e&&!!e.argmin}function _a(e){return!!e&&!!e.argmax}N(ha);function va(e){return je(e)&&!!ha[e]}var ya=[`count`,`sum`,`distinct`,`valid`,`missing`];Re([`mean`,`average`,`median`,`q1`,`q3`,`min`,`max`]);function ba(e){return Le(e)&&(e=Na(e,void 0)),`bin`+N(e).map(t=>Be(`_${t}_${e[t]}`)).join(``)}function xa(e){return e===!0||Sa(e)&&!e.binned}function Sa(e){return Ae(e)}function Ca(e){switch(e){case`row`:case Ke:case nt:case Qe:case $e:case et:case ot:case rt:case it:case at:case tt:return 6;default:return 10}}function wa(e){return!!e&&!!e.condition&&!ke(e.condition)&&Ta(e.condition)}function Ta(e){return!!e&&(!!e.field||e.aggregate===`count`)}function Ea(e){return Ta(e)&&je(e.field)}function Da(e){return!!e.op}function Oa(e,t={}){let n=e.field,r=t.prefix,i=t.suffix,a=``;if(ja(e))n=We(`count`);else{let r;if(!t.nofn){if(Da(e))r=e.op;else{let{bin:o,aggregate:s,timeUnit:c}=e;xa(o)?(r=ba(o),i=(t.binSuffix||``)+(t.suffix||``)):s?_a(s)?(a=`.${n}`,n=`argmax_${s.argmax}`):ga(s)?(a=`.${n}`,n=`argmin_${s.argmin}`):r=String(s):c&&(r=String(c))}}r&&(n=n?`${r}_${n}`:r)}return i&&(n=`${n}_${i}`),r&&(n=`${r}_${n}`),t.forAs?n:t.expr?Ve(n,t.expr)+a:He(n)+a}function ka(e){switch(e.type){case`nominal`:case`ordinal`:case`geojson`:return!0;case`quantitative`:return!!e.bin;case`temporal`:return!1}throw Error(Sr.invalidFieldType(e.type))}function Aa(e){return!ka(e)}function ja(e){return e.aggregate===`count`}function Ma(e){if(Ta(e))return e;if(wa(e))return e.condition}function Na(e,t){return Le(e)?{maxbins:Ca(t)}:e===`binned`?{binned:!0}:!e.maxbins&&!e.step?Object.assign({},e,{maxbins:Ca(t)}):e}var Pa={compatible:!0};function Fa(e,t){let n=e.type;if(n===`geojson`&&t!==`shape`)return{compatible:!1,warning:`Channel ${t} should not be used with a geojson data.`};switch(t){case`row`:case`column`:case`facet`:return Aa(e)?{compatible:!1,warning:Sr.facetChannelShouldBeDiscrete(t)}:Pa;case`x`:case`y`:case`color`:case`fill`:case`stroke`:case`text`:case`detail`:case`key`:case`tooltip`:case`href`:return Pa;case`longitude`:case`longitude2`:case`latitude`:case`latitude2`:return n===`quantitative`?Pa:{compatible:!1,warning:`Channel ${t} should be used with a quantitative field only, not ${e.type} field.`};case`opacity`:case`fillOpacity`:case`strokeOpacity`:case`strokeWidth`:case`size`:case`x2`:case`y2`:return n===`nominal`&&!e.sort?{compatible:!1,warning:`Channel ${t} should not be used with an unsorted discrete field.`}:Pa;case`shape`:return M([`ordinal`,`nominal`,`geojson`],e.type)?Pa:{compatible:!1,warning:`Shape channel should be used with only either discrete or geojson data.`};case`order`:return e.type===`nominal`&&!(`sort`in e)?{compatible:!1,warning:`Channel order is inappropriate for nominal field, which has no inherent order.`}:Pa}throw Error(`channelCompatability not implemented for channel `+t)}function Ia(e,t,n,r){let i=La(t,n,r),{type:a}=e;return qt(t)?a===void 0?i:Zr(t,a)?Xr(a,n.type)?a:(wr(Sr.scaleTypeNotWorkWithFieldDef(a,i)),i):(wr(Sr.scaleTypeNotWorkWithChannel(t,a,i)),i):null}function La(e,t,n){switch(t.type){case`nominal`:case`ordinal`:return ht(e)||$t(e)===`discrete`?(e===`shape`&&t.type===`ordinal`&&wr(Sr.discreteChannelCannotEncode(e,`ordinal`)),`ordinal`):M([`x`,`y`],e)&&(M([`rect`,`bar`,`rule`],n)||n===`bar`)?`band`:`point`;case`temporal`:return ht(e)?`time`:$t(e)===`discrete`?(wr(Sr.discreteChannelCannotEncode(e,`temporal`)),`ordinal`):`time`;case`quantitative`:return ht(e)?xa(t.bin)?`bin-ordinal`:`linear`:$t(e)===`discrete`?(wr(Sr.discreteChannelCannotEncode(e,`quantitative`)),`ordinal`):`linear`;case`geojson`:return}throw Error(Sr.invalidFieldType(t.type))}var Ra;(function(e){e.QUANTITATIVE=P,e.ORDINAL=Er,e.TEMPORAL=Dr,e.NOMINAL=Or,e.KEY=`key`})(Ra||={});function za(e){return e===`ordinal`||e===`nominal`||e===Ra.KEY}var U=class e{constructor(e=null){this.index=e?Object.assign({},e):{}}has(e){return xi(e)in this.index}get(e){return this.index[xi(e)]}set(e,t){return this.index[xi(e)]=t,this}setByKey(e,t){this.index[e]=t}map(t){let n=new e;for(let e in this.index)n.index[e]=t(this.index[e]);return n}size(){return(0,I.keys)(this.index).length}duplicate(){return new e(this.index)}};function Ba(e,t){let n=e&&e[t];return n?ke(n)?ze(n,e=>!!e.field):Ta(n)||wa(n):!1}var Va={zero:1,center:1,normalize:1};function Ha(e){return!!Va[e]}var Ua=[`bar`,Oi,Mi,Ai,Fi,Ii,ki,Ni,Pi],Wa=[`bar`,Oi];function Ga(e){let t=e.x,n=e.y;if(Ta(t)&&Ta(n)){if(t.type===`quantitative`&&n.type===`quantitative`){if(t.stack)return`x`;if(n.stack)return`y`;if(!!t.aggregate!=!!n.aggregate)return t.aggregate?`x`:`y`}else if(t.type===`quantitative`)return`x`;else if(n.type===`quantitative`)return`y`}else if(Ta(t)&&t.type===`quantitative`)return`x`;else if(Ta(n)&&n.type===`quantitative`)return`y`}function Ka(e,t,n,r={}){let i=Bi(e)?e.type:e;if(!M(Ua,i))return null;let a=Ga(t);if(!a)return null;let o=t[a],s=Ea(o)?Oa(o,{}):void 0,c=a===`x`?`y`:`x`,l=t[c],u=Ea(l)?Oa(l,{}):void 0,d=Lt.reduce((e,n)=>{if(n!==`tooltip`&&Ba(t,n)){let r=t[n];(ke(r)?r:[r]).forEach(t=>{let r=Ma(t);if(r.aggregate)return;let i=Ea(r)?Oa(r,{}):void 0;(!i||i!==u&&i!==s)&&e.push({channel:n,fieldDef:r})})}return e},[]),f;if(o.stack===void 0?d.length>0&&(f=M(Wa,i)?Ue(n,`zero`):n):f=Le(o.stack)?o.stack?`zero`:null:o.stack,!f||!Ha(f))return null;if(o.scale&&o.scale.type&&o.scale.type!==F.LINEAR){if(r.disallowNonLinearStack)return null;wr(Sr.cannotStackNonLinearScale(o.scale.type))}return Ba(t,a===`x`?`x2`:`y2`)?(o.stack!==void 0&&wr(Sr.cannotStackRangedMark(a)),null):(o.aggregate&&!M(ya,o.aggregate)&&wr(Sr.stackNonSummativeAggregate(o.aggregate)),{groupbyChannel:l?c:void 0,fieldChannel:a,impute:Ri(i),stackBy:d,offset:f})}function qa(e){return ni(e.encodings,e=>G(e)&&!V(e.aggregate)&&!!e.aggregate||mo(e))}function Ja(e){if(!Za(e))return null;let t=go(e.encodings,{schema:null,wildcardMode:`null`}),n=e.mark;return Ka(n,t,void 0,{disallowNonLinearStack:!0})}function Ya(e){for(let t of e.encodings)if(t[z.STACK]!==void 0&&!V(t[z.STACK]))return t[z.STACK]}function Xa(e){for(let t of e.encodings)if(t[z.STACK]!==void 0&&!V(t.channel))return t.channel;return null}function Za(e){if(V(e.mark))return!1;let t=[z.STACK,z.CHANNEL,z.MARK,z.FIELD,z.AGGREGATE,z.AUTOCOUNT,z.SCALE,wi(`scale`,`type`),z.TYPE],n=(0,I.toMap)(ri(Ei,t)),r=e.encodings.filter(e=>!q(e));for(let e of r)if(Qa(e,{exclude:n}))return!1;return!0}function Qa(e,t={}){if(!(0,I.isObject)(e))return!1;for(let n in e)if(e.hasOwnProperty(n)&&(V(e[n])&&(!t.exclude||!t.exclude[n])||Qa(e[n],t)))return!0;return!1}function $a(e){return e.map(e=>eo(e))}function eo(e){return t=>e[t]===void 0?t:e[t]}function to(e,t){return V(e)?!na(e)&&e.enum?`?`+JSON.stringify(e.enum):`?`:t?t(e):e}function no(e,t){return t?t(e):e}var ro=new U,io=[].concat(Di,mi,[z.TRANSFORM,z.STACK],yi).reduce((e,t)=>e.set(t,!0),new U),ao={axis:{x:!0,y:!0,row:!0,column:!0},legend:{color:!0,opacity:!0,size:!0,shape:!0},scale:{x:!0,y:!0,color:!0,opacity:!0,row:!0,column:!0,size:!0,shape:!0},sort:{x:!0,y:!0,path:!0,order:!0},stack:{x:!0,y:!0}};function oo(e,t=io,n=ro){let r=[];t.get(z.MARK)&&r.push(to(e.mark,n.get(z.MARK))),e.transform&&e.transform.length>0&&r.push(`transform:`+JSON.stringify(e.transform));let i;if(t.get(z.STACK)&&(i=Ja(e)),e.encodings){let a=e.encodings.reduce((e,r)=>{if(!q(r)){let a;a=i&&r.channel===i.fieldChannel?so(Object.assign({},r,{stack:i.offset}),t,n):so(r,t,n),a&&e.push(a)}return e},[]).sort().join(`|`);a&&r.push(a)}for(let n of yi){let i=n.toString();if(t.get(n)&&e[i]){let t=e[i];r.push(`${i}=${JSON.stringify(t)}`)}}return r.join(`|`)}function so(e,t=io,n=ro){let r=[];if(t.get(z.CHANNEL)&&r.push(to(e.channel,n.get(z.CHANNEL))),G(e)){let i=co(e,t,n);i&&r.push(i)}else W(e)?r.push(e.value):K(e)&&r.push(`autocount()`);return r.join(`:`)}function co(e,t=io,n=ro){if(t.get(z.AGGREGATE)&&q(e))return`-`;let r=lo(e,t,n),i=uo(e,t,n),a;if(G(e)){if(a=t.get(`field`)?to(e.field,n.get(`field`)):`...`,t.get(z.TYPE)){if(V(e.type))a+=`,`+to(e.type,n.get(z.TYPE));else{let t=((e.type||`quantitative`)+``).substr(0,1);a+=`,`+to(t,n.get(z.TYPE))}}a+=i.map(e=>{let t=e.value instanceof Array?`[`+e.value+`]`:e.value;return`,`+e.key+`=`+t}).join(``)}else K(e)&&(a=`*,q`);return a?r?((0,I.isString)(r)?r:`?`+((0,I.keys)(r).length>0?JSON.stringify(r):``))+`(`+a+`)`:a:null}function lo(e,t,n){if(t.get(z.AGGREGATE)&&e.aggregate&&!V(e.aggregate))return no(e.aggregate,n.get(z.AGGREGATE));if(t.get(z.AGGREGATE)&&mo(e))return no(`count`,n.get(z.AGGREGATE));if(t.get(z.TIMEUNIT)&&e.timeUnit&&!V(e.timeUnit))return no(e.timeUnit,n.get(z.TIMEUNIT));if(t.get(z.BIN)&&e.bin&&!V(e.bin))return`bin`;{let n=null;for(let r of[z.AGGREGATE,z.AUTOCOUNT,z.TIMEUNIT,z.BIN]){let i=e[r];t.get(r)&&e[r]&&V(i)&&(n||={},n[r]=na(i)?i:i.enum)}return n&&e.hasFn&&(n.hasFn=!0),n}}function uo(e,t,n){let r=[];if(!(0,I.isBoolean)(e.bin)&&!na(e.bin)){let i=e.bin;for(let e in i){let a=wi(`bin`,e);a&&t.get(a)&&i[e]!==void 0&&r.push({key:e,value:to(i[e],n.get(a))})}r.sort((e,t)=>e.key.localeCompare(t.key))}for(let i of[z.SCALE,z.SORT,z.STACK,z.AXIS,z.LEGEND])if(!(!V(e.channel)&&!ao[i][e.channel])&&t.get(i)&&e[i]!==void 0){let a=e[i];if((0,I.isBoolean)(a)||a===null)r.push({key:i+``,value:a||!1});else if((0,I.isString)(a))r.push({key:i+``,value:no(JSON.stringify(a),n.get(i))});else{let e=[];for(let r in a){let o=wi(i,r);o&&t.get(o)&&a[r]!==void 0&&e.push({key:r,value:to(a[r],n.get(o))})}if(e.length>0){let t=e.sort((e,t)=>e.key.localeCompare(t.key)).reduce((e,t)=>(e[t.key]=t.value,e),{});r.push({key:i+``,value:JSON.stringify(t)})}}}return r}function fo(e,t,n){let r=[],i=0;for(let a=0;a<n;a++){let n=e.indexOf(t,i);if(n!==-1)r.push(e.substring(i,n)),i=n+1;else break}if(r.push(e.substr(i)),r.length!==n+1)for(;r.length!==n+1;)r.push(``);return r}var po;(function(e){function t(e,t){let r=t.indexOf(`(`)===-1?n(fo(t,`,`,2)):i(t);return Object.assign({channel:e},r)}e.encoding=t;function n(e){let t={};t.field=e[0],t.type=Ar(e[1].toUpperCase())||`?`;let n=e[2],i=0,a=0;for(;a<n.length;){let e=n.indexOf(`=`,a),o;if(e!==-1){let s=n.substring(a,e);if(n[a+s.length+1]===`{`){let e=a+s.length+1;i=r(e,n,`}`);let t=n.substring(e,i+1);o=JSON.parse(t),a=i+2}else if(n[a+s.length+1]===`[`){let e=a+s.length+1,t=r(e,n,`]`),i=n.substring(e,t+1);o=JSON.parse(i),a=t+2}else{let e=a,t=n.indexOf(`,`,a+s.length);t===-1&&(t=n.length),a=t+1,o=JSON.parse(n.substring(e+s.length+1,t))}ui(s)?t[s]=o:(t.bin=t.bin||{},t.bin[s]=o)}else break}return t}e.rawFieldDef=n;function r(e,t,n){for(let r=e;r<t.length;r++)if(t[r]===n)return r}e.getClosingIndex=r;function i(e){let t={};if(e[0]===`?`){let i=r(1,e,`}`),a=JSON.parse(e.substring(1,i+1));for(let e in a)t[e]=(0,I.isArray)(a[e])?{enum:a[e]}:a[e];return Object.assign({},t,n(fo(e.substring(i+2,e.length-1),`,`,2)))}{let t=e.substring(0,e.indexOf(`(`)),r=fo(e.substring(t.length+1,e.length-1),`,`,2);if(va(t))return Object.assign({aggregate:t},n(r));if(Zi(t))return Object.assign({timeUnit:t},n(r));if(t===`bin`)return Object.assign({bin:{}},n(r))}}e.fn=i})(po||={});function W(e){return e!=null&&e.value!==void 0}function G(e){return e!=null&&(e.field||e.aggregate===`count`)}function K(e){return e!=null&&`autoCount`in e}function q(e){return K(e)&&e.autoCount===!1}function mo(e){return K(e)&&e.autoCount===!0}var ho=[z.AGGREGATE,z.BIN,z.TIMEUNIT,z.FIELD,z.TYPE,z.SCALE,z.SORT,z.AXIS,z.LEGEND,z.STACK,z.FORMAT];function go(e,t){let{wildcardMode:n=`skip`}=t,r={};for(let n of e){if(q(n))continue;let{channel:e}=n;if(V(e))throw Error(`Cannot convert wildcard channel to a fixed channel`);let i=W(n)?_o(n):vo(n,t);if(i===null){if(t.wildcardMode===`null`)return null;continue}r[e]=i}return r}function _o(e){let{value:t}=e;return V(t)?null:{value:t}}function vo(e,t={}){let{props:n=ho,schema:r,wildcardMode:i=`skip`}=t;if(G(e)){let t={};for(let a of n){let n=e[a];if(V(n)){if(i===`skip`)continue;return null}if(n!==void 0){if(!(!ao[a]||ao[a][e.channel]))continue;if(ui(a)&&(0,I.isObject)(n)){n=Object.assign({},n);for(let e in n)if(V(n[e])){if(i===`null`)return null;delete n[e]}}if(a===`bin`&&n===!1)continue;a===`type`&&n===`key`?t.type=`nominal`:t[a]=n}if(a===z.SCALE&&r&&e.type===`ordinal`){let n=e.scale,{ordinalDomain:i}=r.fieldSchema(e.field);n!==null&&i&&(t[z.SCALE]=Object.assign({domain:i},(0,I.isObject)(n)?n:{}))}}return t}if(e.autoCount===!1)throw Error(`Cannot convert {autoCount: false} into a field def`);return{aggregate:`count`,field:`*`,type:`quantitative`}}function yo(e){return G(e)?!bo(e)&&e.type!==`temporal`:K(e)}function bo(e){if(G(e)){let t=vo(e,{props:[`bin`,`timeUnit`,`type`]});return ka(t)||!!t.timeUnit}return!1}function xo(e){let t=e.scale===!0||e.scale===`?`?{}:e.scale||{},{type:n,channel:r,timeUnit:i,bin:a}=e;if(V(t.type)||V(n)||V(r)||V(a))return;if(t.type)return t.type;if(n===`temporal`&&V(i)||n===`quantitative`&&V(a))return;let o={type:n===Ra.KEY?`nominal`:n,timeUnit:i,bin:a};return Ia({type:t.type},r,o,void 0)}function J(e,t,n,r){function i(t){return e(t=new Date(+t)),t}return i.floor=i,i.round=function(n){var r=new Date(+n),i=new Date(n-1);return e(r),e(i),t(i,1),n-r<i-n?r:i},i.ceil=function(n){return e(n=new Date(n-1)),t(n,1),n},i.offset=function(e,n){return t(e=new Date(+e),n==null?1:Math.floor(n)),e},i.range=function(n,r,i){var a=[];if(n=new Date(n-1),r=new Date(+r),i=i==null?1:Math.floor(i),!(n<r)||!(i>0))return a;for(t(n,1),e(n),n<r&&a.push(new Date(+n));t(n,i),e(n),n<r;)a.push(new Date(+n));return a},i.filter=function(n){return J(function(t){for(;e(t),!n(t);)t.setTime(t-1)},function(e,r){for(;--r>=0;)for(;t(e,1),!n(e););})},n&&(i.count=function(t,r){return So.setTime(+t),Co.setTime(+r),e(So),e(Co),Math.floor(n(So,Co))},i.every=function(e){return e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?i.filter(r?function(t){return r(t)%e===0}:function(t){return i.count(0,t)%e===0}):i}),i}var So,Co,Y=n((()=>{So=new Date,Co=new Date})),wo,To=n((()=>{Y(),wo=J(function(){},function(e,t){e.setTime(+e+t)},function(e,t){return t-e}),wo.every=function(e){return e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?J(function(t){t.setTime(Math.floor(t/e)*e)},function(t,n){t.setTime(+t+n*e)},function(t,n){return(n-t)/e}):wo}})),Eo,Do=n((()=>{Y(),Eo=J(function(e){e.setMilliseconds(0)},function(e,t){e.setTime(+e+t*1e3)},function(e,t){return(t-e)/1e3},function(e){return e.getSeconds()})})),Oo,ko=n((()=>{Y(),Oo=J(function(e){e.setSeconds(0,0)},function(e,t){e.setTime(+e+t*6e4)},function(e,t){return(t-e)/6e4},function(e){return e.getMinutes()})})),Ao,jo=n((()=>{Y(),Ao=J(function(e){e.setMinutes(0,0,0)},function(e,t){e.setTime(+e+t*36e5)},function(e,t){return(t-e)/36e5},function(e){return e.getHours()})})),Mo,No=n((()=>{Y(),Mo=J(function(e){e.setHours(0,0,0,0)},function(e,t){e.setDate(e.getDate()+t)},function(e,t){return(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/864e5},function(e){return e.getDate()-1})}));function Po(e){return J(function(t){t.setHours(0,0,0,0),t.setDate(t.getDate()-(t.getDay()+7-e)%7)},function(e,t){e.setDate(e.getDate()+t*7)},function(e,t){return(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/6048e5})}var Fo,Io,Lo,Ro,zo,Bo,Vo,Ho=n((()=>{Y(),Fo=Po(0),Io=Po(1),Lo=Po(2),Ro=Po(3),zo=Po(4),Bo=Po(5),Vo=Po(6)})),Uo,Wo=n((()=>{Y(),Uo=J(function(e){e.setHours(0,0,0,0),e.setDate(1)},function(e,t){e.setMonth(e.getMonth()+t)},function(e,t){return t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12},function(e){return e.getMonth()})})),Go,Ko=n((()=>{Y(),Go=J(function(e){e.setHours(0,0,0,0),e.setMonth(0,1)},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e,t){return t.getFullYear()-e.getFullYear()},function(e){return e.getFullYear()})})),qo,Jo=n((()=>{Y(),qo=J(function(e){e.setUTCMilliseconds(0)},function(e,t){e.setTime(+e+t*1e3)},function(e,t){return(t-e)/1e3},function(e){return e.getUTCSeconds()})})),Yo,Xo=n((()=>{Y(),Yo=J(function(e){e.setUTCSeconds(0,0)},function(e,t){e.setTime(+e+t*6e4)},function(e,t){return(t-e)/6e4},function(e){return e.getUTCMinutes()})})),Zo,Qo=n((()=>{Y(),Zo=J(function(e){e.setUTCMinutes(0,0,0)},function(e,t){e.setTime(+e+t*36e5)},function(e,t){return(t-e)/36e5},function(e){return e.getUTCHours()})})),$o,es=n((()=>{Y(),$o=J(function(e){e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCDate(e.getUTCDate()+t)},function(e,t){return(t-e)/864e5},function(e){return e.getUTCDate()-1})}));function ts(e){return J(function(t){t.setUTCHours(0,0,0,0),t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7)},function(e,t){e.setUTCDate(e.getUTCDate()+t*7)},function(e,t){return(t-e)/6048e5})}var ns,rs,is,as,os,ss,cs,ls=n((()=>{Y(),ns=ts(0),rs=ts(1),is=ts(2),as=ts(3),os=ts(4),ss=ts(5),cs=ts(6)})),us,ds=n((()=>{Y(),us=J(function(e){e.setUTCHours(0,0,0,0),e.setUTCDate(1)},function(e,t){e.setUTCMonth(e.getUTCMonth()+t)},function(e,t){return t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12},function(e){return e.getUTCMonth()})})),fs,ps=n((()=>{Y(),fs=J(function(e){e.setUTCHours(0,0,0,0),e.setUTCMonth(0,1)},function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)},function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()},function(e){return e.getUTCFullYear()})})),ms=r({day:()=>Mo,days:()=>ys,friday:()=>Bo,fridays:()=>Ts,hour:()=>Ao,hours:()=>vs,interval:()=>J,millisecond:()=>wo,milliseconds:()=>hs,minute:()=>Oo,minutes:()=>_s,monday:()=>Io,mondays:()=>xs,month:()=>Uo,months:()=>Os,saturday:()=>Vo,saturdays:()=>Es,second:()=>Eo,seconds:()=>gs,sunday:()=>Fo,sundays:()=>bs,thursday:()=>zo,thursdays:()=>ws,tuesday:()=>Lo,tuesdays:()=>Ss,utcDay:()=>$o,utcDays:()=>Fs,utcFriday:()=>ss,utcFridays:()=>Vs,utcHour:()=>Zo,utcHours:()=>Ps,utcMillisecond:()=>As,utcMilliseconds:()=>js,utcMinute:()=>Yo,utcMinutes:()=>Ns,utcMonday:()=>rs,utcMondays:()=>Ls,utcMonth:()=>us,utcMonths:()=>Ws,utcSaturday:()=>cs,utcSaturdays:()=>Hs,utcSecond:()=>qo,utcSeconds:()=>Ms,utcSunday:()=>ns,utcSundays:()=>Is,utcThursday:()=>os,utcThursdays:()=>Bs,utcTuesday:()=>is,utcTuesdays:()=>Rs,utcWednesday:()=>as,utcWednesdays:()=>zs,utcWeek:()=>ns,utcWeeks:()=>Us,utcYear:()=>fs,utcYears:()=>Gs,wednesday:()=>Ro,wednesdays:()=>Cs,week:()=>Fo,weeks:()=>Ds,year:()=>Go,years:()=>ks}),hs,gs,_s,vs,ys,bs,xs,Ss,Cs,ws,Ts,Es,Ds,Os,ks,As,js,Ms,Ns,Ps,Fs,Is,Ls,Rs,zs,Bs,Vs,Hs,Us,Ws,Gs,Ks=n((()=>{Y(),To(),Do(),ko(),jo(),No(),Ho(),Wo(),Ko(),Jo(),Xo(),Qo(),es(),ls(),ds(),ps(),hs=wo.range,gs=Eo.range,_s=Oo.range,vs=Ao.range,ys=Mo.range,bs=Fo.range,xs=Io.range,Ss=Lo.range,Cs=Ro.range,ws=zo.range,Ts=Bo.range,Es=Vo.range,Ds=Fo.range,Os=Uo.range,ks=Go.range,As=wo,js=hs,Ms=qo.range,Ns=Yo.range,Ps=Zo.range,Fs=$o.range,Is=ns.range,Ls=rs.range,Rs=is.range,zs=as.range,Bs=os.range,Vs=ss.range,Hs=cs.range,Us=ns.range,Ws=us.range,Gs=fs.range})),qs=i(((e,n)=>{var r=(Ks(),t(ms)),i=new Date,a=new Date(0,0,1).setFullYear(0),o=new Date(Date.UTC(0,0,1)).setUTCFullYear(0);function s(e){return i.setTime(+e),i}function c(e,t,n,r,i,a){var o={type:e,date:t,unit:n};return r?o.step=r:o.minstep=1,i!=null&&(o.min=i),a!=null&&(o.max=a),o}function l(e,t,n,r,i,a){return c(e,function(e){return t.offset(n,e)},function(e){return t.count(n,e)},r,i,a)}var u=[l(`second`,r.second,a),l(`minute`,r.minute,a),l(`hour`,r.hour,a),l(`day`,r.day,a,[1,7]),l(`month`,r.month,a,[1,3,6]),l(`year`,r.year,a),c(`seconds`,function(e){return new Date(1970,0,1,0,0,e)},function(e){return s(e).getSeconds()},null,0,59),c(`minutes`,function(e){return new Date(1970,0,1,0,e)},function(e){return s(e).getMinutes()},null,0,59),c(`hours`,function(e){return new Date(1970,0,1,e)},function(e){return s(e).getHours()},null,0,23),c(`weekdays`,function(e){return new Date(1970,0,4+e)},function(e){return s(e).getDay()},[1],0,6),c(`dates`,function(e){return new Date(1970,0,e)},function(e){return s(e).getDate()},[1],1,31),c(`months`,function(e){return new Date(1970,e%12,1)},function(e){return s(e).getMonth()},[1],0,11)],d=[l(`second`,r.utcSecond,o),l(`minute`,r.utcMinute,o),l(`hour`,r.utcHour,o),l(`day`,r.utcDay,o,[1,7]),l(`month`,r.utcMonth,o,[1,3,6]),l(`year`,r.utcYear,o),c(`seconds`,function(e){return new Date(Date.UTC(1970,0,1,0,0,e))},function(e){return s(e).getUTCSeconds()},null,0,59),c(`minutes`,function(e){return new Date(Date.UTC(1970,0,1,0,e))},function(e){return s(e).getUTCMinutes()},null,0,59),c(`hours`,function(e){return new Date(Date.UTC(1970,0,1,e))},function(e){return s(e).getUTCHours()},null,0,23),c(`weekdays`,function(e){return new Date(Date.UTC(1970,0,4+e))},function(e){return s(e).getUTCDay()},[1],0,6),c(`dates`,function(e){return new Date(Date.UTC(1970,0,e))},function(e){return s(e).getUTCDate()},[1],1,31),c(`months`,function(e){return new Date(Date.UTC(1970,e%12,1))},function(e){return s(e).getUTCMonth()},[1],0,11)],f=[[31536e6,5],[7776e6,4],[2592e6,4],[12096e5,3],[6048e5,3],[1728e5,3],[864e5,3],[432e5,2],[216e5,2],[108e5,2],[36e5,2],[18e5,1],[9e5,1],[3e5,1],[6e4,1],[3e4,0],[15e3,0],[5e3,0],[1e3,0]];function p(e,t,n,r){var i=f[0],a,o,s;for(a=1,o=f.length;a<o;++a)if(i=f[a],t>i[0]){if(s=t/i[0],s>r)return e[f[a-1][1]];if(s>=n)return e[i[1]]}return e[f[o-1][1]]}function m(e){var t={},n,r;for(n=0,r=e.length;n<r;++n)t[e[n].type]=e[n];return t.find=function(t,n,r){return p(e,t,n,r)},t}n.exports=m(u),n.exports.utc=m(d)})),Js=i(((e,t)=>{var n=ei(),r=qs(),i=1e-15;function a(e){if(!e)throw Error(`Missing binning options.`);var t=e.maxbins||15,n=e.base||10,r=Math.log(n),i=e.div||[5,2],a=e.min,l=e.max,u=l-a,d,f,p,m,h,g,_;if(e.step)d=e.step;else if(e.steps)d=e.steps[Math.min(e.steps.length-1,o(e.steps,u/t,0,e.steps.length))];else{for(f=Math.ceil(Math.log(t)/r),p=e.minstep||0,d=Math.max(p,n**+(Math.round(Math.log(u)/r)-f));Math.ceil(u/d)>t;)d*=n;for(g=0;g<i.length;++g)h=d/i[g],h>=p&&u/h<=t&&(d=h)}return h=Math.log(d),m=h>=0?0:~~(-h/r)+1,_=n**(-m-1),a=Math.min(a,Math.floor(a/d+_)*d),l=Math.ceil(l/d)*d,{start:a,stop:l,step:d,unit:{precision:m},value:s,index:c}}function o(e,t,r,i){for(;r<i;){var a=r+i>>>1;n.cmp(e[a],t)<0?r=a+1:i=a}return r}function s(e){return this.step*Math.floor(e/this.step+i)}function c(e){return Math.floor((e-this.start)/this.step+i)}function l(e){return this.unit.date(s.call(this,e))}function u(e){return c.call(this,this.unit.unit(e))}a.date=function(e){if(!e)throw Error(`Missing date binning options.`);var t=e.utc?r.utc:r,n=e.min,i=e.max,o=e.maxbins||20,s=e.minbins||4,c=i-+n,d=e.unit?t[e.unit]:t.find(c,s,o),f=a({min:d.min==null?d.unit(n):d.min,max:d.max==null?d.unit(i):d.max,maxbins:o,minstep:d.minstep,steps:d.step});return f.unit=d,f.index=u,e.raw||(f.value=l),f},t.exports=a})),Ys=i(((e,t)=>{var n=ei(),r=`__types__`,i={boolean:n.boolean,integer:n.number,number:n.number,date:n.date,string:function(e){return e==null||e===``?null:e+``}},a={boolean:function(e){return e===`true`||e===`false`||n.isBoolean(e)},integer:function(e){return a.number(e)&&(e=+e)===~~e},number:function(e){return!isNaN(+e)&&!n.isDate(e)},date:function(e){return!isNaN(Date.parse(e))}};function o(e,t){if(!t)return e&&e[r]||null;e[r]=t}function s(e){return n.keys(e)}function c(e){return`[`+e+`]`}function l(e,t){e=n.array(e),t=n.$(t);var i,a,o;if(e[r]&&(i=t(e[r]),n.isString(i)))return i;for(a=0,o=e.length;!n.isValid(i)&&a<o;++a)i=t?t(e[a]):e[a];return n.isDate(i)?`date`:n.isNumber(i)?`number`:n.isBoolean(i)?`boolean`:n.isString(i)?`string`:null}function u(e,t){if(e.length){var r=t?n.identity:(t=s(e[0]),c);return t.reduce(function(t,n){return t[n]=l(e,r(n)),t},{})}}function d(e,t){e=n.array(e),t=n.$(t);var r,i,o,s=[`boolean`,`integer`,`number`,`date`];for(r=0;r<e.length;++r){for(o=t?t(e[r]):e[r],i=0;i<s.length;++i)n.isValid(o)&&!a[s[i]](o)&&(s.splice(i,1),--i);if(s.length===0)return`string`}return s[0]}function f(e,t){var r=t?n.identity:(t=s(e[0]),c);return t.reduce(function(t,n){return t[n]=d(e,r(n)),t},{})}l.annotation=o,l.all=u,l.infer=d,l.inferAll=f,l.parsers=i,t.exports=l})),Xs=i(((e,t)=>{var n=ei(),r=t.exports;r.repeat=function(e,t){var n=Array(t),r;for(r=0;r<t;++r)n[r]=e;return n},r.zeros=function(e){return r.repeat(0,e)},r.range=function(e,t,n){if(arguments.length<3&&(n=1,arguments.length<2&&(t=e,e=0)),(t-e)/n==1/0)throw Error(`Infinite range`);var r=[],i=-1,a;if(n<0)for(;(a=e+n*++i)>t;)r.push(a);else for(;(a=e+n*++i)<t;)r.push(a);return r},r.random={},r.random.uniform=function(e,t){t===void 0&&(t=e===void 0?1:e,e=0);var n=t-e,i=function(){return e+n*Math.random()};return i.samples=function(e){return r.zeros(e).map(i)},i.pdf=function(r){return r>=e&&r<=t?1/n:0},i.cdf=function(r){return r<e?0:r>t?1:(r-e)/n},i.icdf=function(t){return t>=0&&t<=1?e+t*n:NaN},i},r.random.integer=function(e,t){t===void 0&&(t=e,e=0);var n=t-e,i=function(){return e+Math.floor(n*Math.random())};return i.samples=function(e){return r.zeros(e).map(i)},i.pdf=function(r){return r===Math.floor(r)&&r>=e&&r<t?1/n:0},i.cdf=function(r){var i=Math.floor(r);return i<e?0:i>=t?1:(i-e+1)/n},i.icdf=function(t){return t>=0&&t<=1?e-1+Math.floor(t*n):NaN},i},r.random.normal=function(e,t){e||=0,t||=1;var n,i=function(){var r=0,i=0,a,o;if(n!==void 0)return r=n,n=void 0,r;do r=Math.random()*2-1,i=Math.random()*2-1,a=r*r+i*i;while(a===0||a>1);return o=Math.sqrt(-2*Math.log(a)/a),n=e+i*o*t,e+r*o*t};return i.samples=function(e){return r.zeros(e).map(i)},i.pdf=function(n){var r=Math.exp((n-e)**2/(-2*t**2));return 1/(t*Math.sqrt(2*Math.PI))*r},i.cdf=function(n){var r,i=(n-e)/t,a=Math.abs(i);if(a>37)r=0;else{var o,s=Math.exp(-a*a/2);a<7.07106781186547?(o=.0352624965998911*a+.700383064443688,o=o*a+6.37396220353165,o=o*a+33.912866078383,o=o*a+112.079291497871,o=o*a+221.213596169931,o=o*a+220.206867912376,r=s*o,o=.0883883476483184*a+1.75566716318264,o=o*a+16.064177579207,o=o*a+86.7807322029461,o=o*a+296.564248779674,o=o*a+637.333633378831,o=o*a+793.826512519948,o=o*a+440.413735824752,r/=o):(o=a+.65,o=a+4/o,o=a+3/o,o=a+2/o,o=a+1/o,r=s/o/2.506628274631)}return i>0?1-r:r},i.icdf=function(n){if(n<=0||n>=1)return NaN;var r=2*n-1,i=8*(Math.PI-3)/(3*Math.PI*(4-Math.PI)),a=2/(Math.PI*i)+Math.log(1-r**2)/2,o=Math.log(1-r*r)/i,s=(r>0?1:-1)*Math.sqrt(Math.sqrt(a*a-o)-a);return e+t*Math.SQRT2*s},i},r.random.bootstrap=function(e,t){var i=e.filter(n.isValid),a=i.length,o=t?r.random.normal(0,t):null,s=function(){return i[~~(Math.random()*a)]+(o?o():0)};return s.samples=function(e){return r.zeros(e).map(s)},s}})),Zs=i(((e,t)=>{var n=ei(),r=Ys(),i=Xs(),a=t.exports;a.unique=function(e,t,r){t=n.$(t),r||=[];var i={},a,o,s;for(o=0,s=e.length;o<s;++o)a=t?t(e[o]):e[o],!(a in i)&&(i[a]=1,r.push(a));return r},a.count=function(e){return e&&e.length||0},a.count.valid=function(e,t){t=n.$(t);var r,i,a,o=0;for(i=0,a=e.length;i<a;++i)r=t?t(e[i]):e[i],n.isValid(r)&&(o+=1);return o},a.count.missing=function(e,t){t=n.$(t);var r,i,a,o=0;for(i=0,a=e.length;i<a;++i)r=t?t(e[i]):e[i],r??(o+=1);return o},a.count.distinct=function(e,t){t=n.$(t);var r={},i,a,o,s=0;for(a=0,o=e.length;a<o;++a)i=t?t(e[a]):e[a],!(i in r)&&(r[i]=1,s+=1);return s},a.count.map=function(e,t){t=n.$(t);var r={},i,a,o;for(a=0,o=e.length;a<o;++a)i=t?t(e[a]):e[a],r[i]=i in r?r[i]+1:1;return r},a.median=function(e,t){return t&&(e=e.map(n.$(t))),e=e.filter(n.isValid).sort(n.cmp),a.quantile(e,.5)},a.quartile=function(e,t){t&&(e=e.map(n.$(t))),e=e.filter(n.isValid).sort(n.cmp);var r=a.quantile;return[r(e,.25),r(e,.5),r(e,.75)]},a.quantile=function(e,t,r){r===void 0&&(r=t,t=n.identity),t=n.$(t);var i=(e.length-1)*r+1,a=Math.floor(i),o=+t(e[a-1]),s=i-a;return s?o+s*(t(e[a])-o):o},a.sum=function(e,t){t=n.$(t);for(var r=0,i=0,a=e.length,o;i<a;++i)o=t?t(e[i]):e[i],n.isValid(o)&&(r+=o);return r},a.mean=function(e,t){t=n.$(t);var r=0,i,a,o,s,c;for(a=0,s=0,o=e.length;a<o;++a)c=t?t(e[a]):e[a],n.isValid(c)&&(i=c-r,r+=i/++s);return r},a.mean.geometric=function(e,t){t=n.$(t);var r=1,i,a,o,s;for(s=0,i=0,a=e.length;s<a;++s)if(o=t?t(e[s]):e[s],n.isValid(o)){if(o<=0)throw Error(`Geometric mean only defined for positive values.`);r*=o,++i}return r=i>0?r**(1/i):0,r},a.mean.harmonic=function(e,t){t=n.$(t);var r=0,i,a,o,s;for(s=0,i=0,a=e.length;s<a;++s)o=t?t(e[s]):e[s],n.isValid(o)&&(r+=1/o,++i);return i/r},a.variance=function(e,t){if(t=n.$(t),!n.isArray(e)||e.length<2)return 0;var r=0,i=0,a,o,s,c;for(o=0,s=0;o<e.length;++o)c=t?t(e[o]):e[o],n.isValid(c)&&(a=c-r,r+=a/++s,i+=a*(c-r));return i/=s-1,i},a.stdev=function(e,t){return Math.sqrt(a.variance(e,t))},a.modeskew=function(e,t){var n=a.mean(e,t),r=a.median(e,t),i=a.stdev(e,t);return i===0?0:(n-r)/i},a.min=function(e,t){return a.extent(e,t)[0]},a.max=function(e,t){return a.extent(e,t)[1]},a.extent=function(e,t){t=n.$(t);var r,i,a,o,s=e.length;for(o=0;o<s;++o)if(a=t?t(e[o]):e[o],n.isValid(a)){r=i=a;break}for(;o<s;++o)a=t?t(e[o]):e[o],n.isValid(a)&&(a<r&&(r=a),a>i&&(i=a));return[r,i]},a.extent.index=function(e,t){t=n.$(t);var r=-1,i=-1,a,o,s,c,l=e.length;for(c=0;c<l;++c)if(s=t?t(e[c]):e[c],n.isValid(s)){a=o=s,r=i=c;break}for(;c<l;++c)s=t?t(e[c]):e[c],n.isValid(s)&&(s<a&&(a=s,r=c),s>o&&(o=s,i=c));return[r,i]},a.dot=function(e,t,r){var i=0,a,o;if(r)for(t=n.$(t),r=n.$(r),a=0;a<e.length;++a)o=t(e[a])*r(e[a]),o===o&&(i+=o);else{if(e.length!==t.length)throw Error(`Array lengths must match.`);for(a=0;a<e.length;++a)o=e[a]*t[a],o===o&&(i+=o)}return i},a.dist=function(e,t,r,i){var a=n.isFunction(r)||n.isString(r),o=e,s=a?e:t,c=a?i:r,l=c===2||c==null,u=e.length,d=0,f,p;for(a&&(t=n.$(t),r=n.$(r)),p=0;p<u;++p)f=a?t(o[p])-r(s[p]):o[p]-s[p],d+=l?f*f:Math.abs(f)**+c;return l?Math.sqrt(d):d**(1/c)},a.cohensd=function(e,t,r){var i=r?e.map(n.$(t)):e,o=r?e.map(n.$(r)):t,s=a.mean(i),c=a.mean(o),l=a.count.valid(i),u=a.count.valid(o);if(l+u-2<=0)return 0;var d=a.variance(i),f=a.variance(o),p=Math.sqrt(((l-1)*d+(u-1)*f)/(l+u-2));return p===0?0:(s-c)/p},a.covariance=function(e,t,r){var i=r?e.map(n.$(t)):e,o=r?e.map(n.$(r)):t,s=i.length,c=a.mean(i),l=a.mean(o),u=0,d=0,f,p,m,h,g;if(s!==o.length)throw Error(`Input lengths must match.`);for(f=0;f<s;++f)if(p=i[f],h=n.isValid(p),m=o[f],g=n.isValid(m),h&&g)u+=(p-c)*(m-l),++d;else if(h||g)throw Error(`Valid values must align.`);return u/(d-1)},a.rank=function(e,t){t=n.$(t)||n.identity;var r=e.map(function(e,n){return{idx:n,val:t(e)}}).sort(n.comparator(`val`)),i=e.length,a=Array(i),o=-1,s={},c,l,u;for(c=0;c<i;++c){if(l=r[c].val,o<0&&s===l)o=c-1;else if(o>-1&&s!==l){for(u=1+(c-1+o)/2;o<c;++o)a[r[o].idx]=u;o=-1}a[r[c].idx]=c+1,s=l}if(o>-1)for(u=1+(i-1+o)/2;o<i;++o)a[r[o].idx]=u;return a},a.cor=function(e,t,r){var i=r;r=i?e.map(n.$(r)):t,t=i?e.map(n.$(t)):e;var o=a.dot(t,r),s=a.mean(t),c=a.mean(r),l=a.stdev(t),u=a.stdev(r),d=e.length;return(o-d*s*c)/((d-1)*l*u)},a.cor.rank=function(e,t,n){var r=n?a.rank(e,t):a.rank(e),i=n?a.rank(e,n):a.rank(t),o=e.length,s,c,l;for(s=0,c=0;s<o;++s)l=r[s]-i[s],c+=l*l;return 1-6*c/(o*(o*o-1))},a.cor.dist=function(e,t,r){var i=r?e.map(n.$(t)):e,o=r?e.map(n.$(r)):t,s=a.dist.mat(i),c=a.dist.mat(o),l=s.length,u,d,f,p;for(u=0,d=0,f=0,p=0;u<l;++u)d+=s[u]*s[u],f+=c[u]*c[u],p+=s[u]*c[u];return Math.sqrt(p/Math.sqrt(d*f))},a.linearRegression=function(e,t,r){var i=r?e.map(n.$(t)):e,o=r?e.map(n.$(r)):t,s=i.length,c=a.covariance(i,o),l=a.stdev(i),u=a.stdev(o),d=c/(l*l),f=a.mean(o)-d*a.mean(i),p={slope:d,intercept:f,R:c/(l*u),rss:0},m,h;for(h=0;h<s;++h)n.isValid(i[h])&&n.isValid(o[h])&&(m=d*i[h]+f-o[h],p.rss+=m*m);return p},a.bootstrap={},a.bootstrap.ci=function(e,t,r,o,s){var c,l,u,d,f,p,m;for(n.isFunction(t)||n.isString(t)?(c=e.map(n.$(t)),l=r,u=o,d=s):(c=e,l=t,u=r,d=o),l=l?+l:1e3,u||=.05,f=i.random.bootstrap(c,d),m=0,p=Array(l);m<l;++m)p[m]=a.mean(f.samples(c.length));return p.sort(n.numcmp),[a.quantile(p,u/2),a.quantile(p,1-u/2)]},a.z={},a.z.ci=function(e,t,r){var o=e,s=t;(n.isFunction(t)||n.isString(t))&&(o=e.map(n.$(t)),s=r),s||=.05;var c=s===.05?1.96:i.random.normal(0,1).icdf(1-s/2),l=a.mean(o),u=a.stdev(o)/Math.sqrt(a.count.valid(o));return[l-c*u,l+c*u]},a.z.test=function(e,t,r,i){return n.isFunction(r)||n.isString(r)?(i&&i.paired?s:c)(i,e,t,r):n.isArray(t)?(r&&r.paired?s:c)(r,e,t):n.isFunction(t)||n.isString(t)?o(r,e,t):o(t,e)};function o(e,t,n){var r=e&&e.nullh||0,o=i.random.normal(0,1),s=a.mean(t,n),c=a.stdev(t,n)/Math.sqrt(a.count.valid(t,n));if(c===0)return+(s-r===0);var l=(s-r)/c;return 2*o.cdf(-Math.abs(l))}function s(e,t,r,i){var o=i?t.map(n.$(r)):t,s=i?t.map(n.$(i)):r,c=a.count(o),l=a.count(s),u=[],d;if(c!==l)throw Error(`Array lengths must match.`);for(d=0;d<c;++d)n.isValid(o[d])&&n.isValid(s[d])&&u.push(o[d]-s[d]);return a.z.test(u,e&&e.nullh||0)}function c(e,t,r,o){var s=o?t.map(n.$(r)):t,c=o?t.map(n.$(o)):r,l=a.count.valid(s),u=a.count.valid(c),d=i.random.normal(0,1),f=a.mean(s)-a.mean(c)-(e&&e.nullh||0),p=Math.sqrt(a.variance(s)/l+a.variance(c)/u);if(p===0)return+(f===0);var m=f/p;return 2*d.cdf(-Math.abs(m))}a.dist.mat=function(e){var t=e.length,n=t*t,r=Array(n),a=i.zeros(t),o=0,s,c,l;for(c=0;c<t;++c)for(r[c*t+c]=0,l=c+1;l<t;++l)r[c*t+l]=s=Math.abs(e[c]-e[l]),r[l*t+c]=s,a[c]+=s,a[l]+=s;for(c=0;c<t;++c)o+=a[c],a[c]/=t;for(o/=n,c=0;c<t;++c)for(l=c;l<t;++l)r[c*t+l]+=o-a[c]-a[l],r[l*t+c]=r[c*t+l];return r},a.entropy=function(e,t){t=n.$(t);var r,i,a=0,o=0,s=e.length;for(r=0;r<s;++r)a+=t?t(e[r]):e[r];if(a===0)return 0;for(r=0;r<s;++r)i=(t?t(e[r]):e[r])/a,i&&(o+=i*Math.log(i));return-o/Math.LN2},a.mutual=function(e,t,r,i){var a=i?e.map(n.$(t)):e,o=i?e.map(n.$(r)):t,s=i?e.map(n.$(i)):r,c={},l={},u=s.length,d=0,f=0,p=0,m,h,g;for(g=0;g<u;++g)c[a[g]]=0,l[o[g]]=0;for(g=0;g<u;++g)c[a[g]]+=s[g],l[o[g]]+=s[g],d+=s[g];for(h=1/(d*Math.LN2),g=0;g<u;++g)s[g]!==0&&(m=d*s[g]/(c[a[g]]*l[o[g]]),f+=s[g]*h*Math.log(m),p+=s[g]*h*Math.log(s[g]/d));return[f,1+f/p]},a.mutual.info=function(e,t,n,r){return a.mutual(e,t,n,r)[0]},a.mutual.dist=function(e,t,n,r){return a.mutual(e,t,n,r)[1]},a.profile=function(e,t){var i=0,o=0,s=0,c=0,l=null,u=null,d=0,f=[],p={},m,h,g,_,v;for(g=0;g<e.length;++g)_=t?t(e[g]):e[g],p[_]=_ in p?p[_]+1:(c+=1,1),_==null?++s:n.isValid(_)&&(v=typeof _==`string`?_.length:_,(l===null||v<l)&&(l=v),(u===null||v>u)&&(u=v),m=v-i,i+=m/++o,d+=m*(v-i),f.push(v));return d/=o-1,h=Math.sqrt(d),f.sort(n.cmp),{type:r(e,t),unique:p,count:e.length,valid:o,missing:s,distinct:c,min:l,max:u,mean:i,stdev:h,median:_=a.quantile(f,.5),q1:a.quantile(f,.25),q3:a.quantile(f,.75),modeskew:h===0?0:(i-_)/h}},a.summary=function(e,t){t||=n.keys(e[0]);var r=t.map(function(t){var r=a.profile(e,n.$(t));return r.field=t,r});return r.__summary__=!0,r}})),Qs=e(Js()),$s=Ys(),ec=Zs(),tc=Qs.default;function nc(e,t={},n={fields:[]}){t=(0,I.extend)({},ma,t);let r=(0,ec.summary)(e),i=(0,$s.inferAll)(e),a=n.fields.reduce((e,t)=>(e[t.name]=t,e),{}),o=r.map(function(n,r){let o=n.field,s=i[o]===`date`?X.DATETIME:i[o],c=n.distinct,l;if(s===X.NUMBER)l=P;else if(s===X.INTEGER)l=c<t.numberNominalLimit&&c/n.count<t.numberNominalProportion?Or:P;else if(s===X.DATETIME){l=Dr,n.min=new Date(e[0][o]),n.max=new Date(e[0][o]);for(let t of e){let e=new Date(t[o]).getTime();e<n.min.getTime()&&(n.min=new Date(e)),e>n.max.getTime()&&(n.max=new Date(e))}}else l=Or;l===`nominal`&&c/n.count>t.minPercentUniqueForKey&&n.count>t.minCardinalityForKey&&(l=Ra.KEY);let u={name:o,originalIndex:r,vlType:l,type:s,stats:n,timeStats:{},binStats:{}},d=a[u.name];return u=(0,I.extend)(u,d),u});for(let e of o)if(e.vlType===`quantitative`)for(let n of t.enum.binProps.maxbins)e.binStats[n]=ac(n,e.stats);else if(e.vlType===`temporal`)for(let n of t.enum.timeUnit)n!==void 0&&(e.timeStats[n]=oc(n,e.stats));return new ic(Object.assign({},n,{fields:o}))}var rc={nominal:0,key:1,ordinal:2,temporal:3,quantitative:4},ic=class{constructor(e){this._tableSchema=e,e.fields.sort(function(e,t){return rc[e.vlType]<rc[t.vlType]?-1:rc[e.vlType]>rc[t.vlType]?1:e.name.localeCompare(t.name)}),e.fields.forEach((e,t)=>e.index=t),this._fieldSchemaIndex=e.fields.reduce((e,t)=>(e[t.name]=t,e),{})}fieldNames(){return this._tableSchema.fields.map(e=>e.name)}get fieldSchemas(){return this._tableSchema.fields}fieldSchema(e){return this._fieldSchemaIndex[e]}tableSchema(){let e=(0,I.duplicate)(this._tableSchema);return e.fields.sort((e,t)=>e.originalIndex-t.originalIndex),e}primitiveType(e){return this._fieldSchemaIndex[e]?this._fieldSchemaIndex[e].type:null}vlType(e){return this._fieldSchemaIndex[e]?this._fieldSchemaIndex[e].vlType:null}cardinality(e,t=!0,n=!1){let r=this._fieldSchemaIndex[e.field];if(e.aggregate||K(e)&&e.autoCount)return 1;if(e.bin){let t;t=typeof e.bin==`boolean`?{maxbins:Ca(e.channel)}:e.bin===`?`?{enum:[!0,!1]}:e.bin;let n=t.maxbins;return r.binStats[n]||(r.binStats[n]=ac(n,r.stats)),r.binStats[n].distinct}if(e.timeUnit){if(t)switch(e.timeUnit){case B.SECONDS:return 60;case B.MINUTES:return 60;case B.HOURS:return 24;case B.DAY:return 7;case B.DATE:return 31;case B.MONTH:return 12;case B.QUARTER:return 4;case B.MILLISECONDS:return 1e3}let i=e.timeUnit,a=r.timeStats;return(!a||!a[i])&&(a=Object.assign({},a,{[i]:oc(e.timeUnit,r.stats)})),n?a[i].distinct-cc(a[i].unique,[`Invalid Date`,null]):a[i].distinct}return r?n?r.stats.distinct-cc(r.stats.unique,[NaN,null]):r.stats.distinct:null}timeUnitHasVariation(e){if(!e.timeUnit)return;if(e.timeUnit===B.DAY){let t=(0,I.extend)({},e,{timeUnit:B.DATE});if(this.cardinality(t,!1,!0)<=1)return!1}let t=e.timeUnit;for(let n of Hi)if(ta(t,n)){let t=(0,I.extend)({},e,{timeUnit:n});if(this.cardinality(t,!1,!0)<=1)return!1}return!0}domain(e){let t=this._fieldSchemaIndex[e.field],n=(0,I.keys)(t.stats.unique);return t.vlType===`quantitative`?[+t.stats.min,+t.stats.max]:t.type===X.DATETIME?[t.stats.min,t.stats.max]:t.type===X.INTEGER||t.type===X.NUMBER?(n=n.map(e=>+e),n.sort(I.cmp)):t.vlType===`ordinal`&&t.ordinalDomain?t.ordinalDomain:n.map(e=>e===`null`?null:e).sort(I.cmp)}stats(e){let t=this._fieldSchemaIndex[e.field];return t?t.stats:null}};function ac(e,t){let n=tc({min:t.min,max:t.max,maxbins:e}),r=(0,I.extend)({},t);return r.unique=sc(n,t.unique),r.distinct=(n.stop-n.start)/n.step,r.min=n.start,r.max=n.stop,r}function oc(e,t){let n=(0,I.extend)({},t),r={};return(0,I.keys)(t.unique).forEach(function(n){let i=n===`null`?null:new Date(n),a;a=i===null?null:isNaN(i.getTime())?`Invalid Date`:(e===B.DAY?i.getDay():$i(e,i)).toString(),r[a]=(r[a]||0)+t.unique[n]}),n.unique=r,n.distinct=(0,I.keys)(r).length,n}function sc(e,t){let n={};for(let r in t){let i;i=r===null?null:isNaN(Number(r))?NaN:e.value(Number(r)),n[i]=(n[i]||0)+t[r]}return n}function cc(e,t){return t.reduce(function(t,n){return e[n]?t+1:t},0)}var X;(function(e){e[e.STRING=`string`]=`STRING`,e[e.NUMBER=`number`]=`NUMBER`,e[e.INTEGER=`integer`]=`INTEGER`,e[e.BOOLEAN=`boolean`]=`BOOLEAN`,e[e.DATETIME=`datetime`]=`DATETIME`})(X||={});var lc=class{constructor(e){this.constraint=e}name(){return this.constraint.name}description(){return this.constraint.description}properties(){return this.constraint.properties}strict(){return this.constraint.strict}},uc=class extends lc{constructor(e){super(e)}hasAllRequiredPropertiesSpecific(e){return ti(this.constraint.properties,t=>{if(ai(t)){let n=t.parent,r=t.child;return!e[n]||!V(e[n][r])}return!e[t]||!V(e[t])})}satisfy(e,t,n,r){return!this.constraint.allowWildcardForProperties&&!this.hasAllRequiredPropertiesSpecific(e)||this.constraint.satisfy(e,t,n,r)}},dc=[{name:`aggregateOpSupportedByType`,description:`Aggregate function should be supported by data type.`,properties:[z.TYPE,z.AGGREGATE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>!e.aggregate||!za(e.type)},{name:`asteriskFieldWithCountOnly`,description:`Field="*" should be disallowed except aggregate="count"`,properties:[z.FIELD,z.AGGREGATE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>e.field===`*`==(e.aggregate===`count`)},{name:`minCardinalityForBin`,description:`binned quantitative field should not have too low cardinality`,properties:[z.BIN,z.FIELD,z.TYPE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>{if(e.bin&&e.type===`quantitative`){let n={channel:e.channel,field:e.field,type:e.type};return t.cardinality(n)>=r.minCardinalityForBin}return!0}},{name:`binAppliedForQuantitative`,description:`bin should be applied to quantitative field only.`,properties:[z.TYPE,z.BIN],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>!e.bin||e.type===P},{name:`channelFieldCompatible`,description:`encoding channel's range type be compatible with channel type.`,properties:[z.CHANNEL,z.TYPE,z.BIN,z.TIMEUNIT],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>{let i=Object.assign({field:`f`},vo(e,{schema:t,props:[`bin`,`timeUnit`,`type`]})),{compatible:a}=Fa(i,e.channel);return a?!0:!!((e.channel===`row`||e.channel===`column`)&&(Ui(i.timeUnit)||Gi(i.timeUnit)))}},{name:`hasFn`,description:`A field with as hasFn flag should have one of aggregate, timeUnit, or bin.`,properties:[z.AGGREGATE,z.BIN,z.TIMEUNIT],allowWildcardForProperties:!0,strict:!0,satisfy:(e,t,n,r)=>!e.hasFn||!!e.aggregate||!!e.bin||!!e.timeUnit},{name:`omitScaleZeroWithBinnedField`,description:`Do not use scale zero with binned field`,properties:[z.SCALE,wi(`scale`,`zero`),z.BIN],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>!(e.bin&&e.scale&&e.scale.zero===!0)},{name:`onlyOneTypeOfFunction`,description:`Only of of aggregate, autoCount, timeUnit, or bin should be applied at the same time.`,properties:[z.AGGREGATE,z.AUTOCOUNT,z.TIMEUNIT,z.BIN],allowWildcardForProperties:!0,strict:!0,satisfy:(e,t,n,r)=>!G(e)||(!V(e.aggregate)&&e.aggregate?1:0)+(!V(e.bin)&&e.bin?1:0)+(!V(e.timeUnit)&&e.timeUnit?1:0)<=1},{name:`timeUnitAppliedForTemporal`,description:`Time unit should be applied to temporal field only.`,properties:[z.TYPE,z.TIMEUNIT],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>!(e.timeUnit&&e.type!==`temporal`)},{name:`timeUnitShouldHaveVariation`,description:`A particular time unit should be applied only if they produce unique values.`,properties:[z.TIMEUNIT,z.TYPE],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n,r)=>e.timeUnit&&e.type===`temporal`?!n.has(`timeUnit`)&&!r.constraintManuallySpecifiedValue||t.timeUnitHasVariation(e):!0},{name:`scalePropertiesSupportedByScaleType`,description:`Scale properties must be supported by correct scale type`,properties:[].concat(hi,[z.SCALE,z.TYPE]),allowWildcardForProperties:!0,strict:!0,satisfy:(e,t,n,r)=>{if(e.scale){let t=e.scale,n=xo(e);if(n==null)return!0;for(let e in t){if(e===`type`||e===`name`||e===`enum`)continue;let t=e;if(n===`point`){if(!Jr(`point`,t)&&!Jr(`band`,t))return!1}else if(!Jr(n,t))return!1}}return!0}},{name:`scalePropertiesSupportedByChannel`,description:`Not all scale properties are supported by all encoding channels`,properties:[].concat(hi,[z.SCALE,z.CHANNEL]),allowWildcardForProperties:!0,strict:!0,satisfy:(e,t,n,r)=>{if(e){let t=e.channel,n=e.scale;if(t&&!V(t)&&n){if(t===`row`||t===`column`)return!1;for(let e in n)if(n.hasOwnProperty(e)&&e!==`type`&&e!==`name`&&e!==`enum`&&Yr(t,e)!==void 0)return!1}}return!0}},{name:`typeMatchesPrimitiveType`,description:`Data type should be supported by field's primitive type.`,properties:[z.FIELD,z.TYPE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>{if(e.field===`*`)return!0;let i=t.primitiveType(e.field),a=e.type;if(!n.has(`field`)&&!n.has(`type`)&&!r.constraintManuallySpecifiedValue)return!0;switch(i){case X.BOOLEAN:case X.STRING:return a!==`quantitative`&&a!==`temporal`;case X.NUMBER:case X.INTEGER:return a!==Dr;case X.DATETIME:return a===Dr;case null:return!1}throw Error(`Not implemented`)}},{name:`typeMatchesSchemaType`,description:`Enumerated data type of a field should match the field's type in the schema.`,properties:[z.FIELD,z.TYPE],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n,r)=>!n.has(`field`)&&!n.has(`type`)&&!r.constraintManuallySpecifiedValue?!0:e.field===`*`?e.type===P:t.vlType(e.field)===e.type},{name:`maxCardinalityForCategoricalColor`,description:`Categorical channel should not have too high cardinality`,properties:[z.CHANNEL,z.FIELD],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n,r)=>e.channel===`color`&&(e.type===`nominal`||e.type===Ra.KEY)?t.cardinality(e)<=r.maxCardinalityForCategoricalColor:!0},{name:`maxCardinalityForFacet`,description:`Row/column channel should not have too high cardinality`,properties:[z.CHANNEL,z.FIELD,z.BIN,z.TIMEUNIT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n,r)=>e.channel===`row`||e.channel===`column`?t.cardinality(e)<=r.maxCardinalityForFacet:!0},{name:`maxCardinalityForShape`,description:`Shape channel should not have too high cardinality`,properties:[z.CHANNEL,z.FIELD,z.BIN,z.TIMEUNIT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n,r)=>e.channel!==`shape`||t.cardinality(e)<=r.maxCardinalityForShape},{name:`dataTypeAndFunctionMatchScaleType`,description:`Scale type must match data type`,properties:[z.TYPE,z.SCALE,wi(`scale`,`type`),z.TIMEUNIT,z.BIN],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>{if(e.scale){let t=e.type,n=xo(e);if(za(t))return n===void 0||Lr(n);if(t===`temporal`)return e.timeUnit?L([F.TIME,F.UTC,void 0],n)||Lr(n):L([F.TIME,F.UTC,void 0],n);if(t===`quantitative`)return e.bin?L([F.LINEAR,void 0],n):L([F.LOG,F.POW,F.SQRT,F.QUANTILE,F.QUANTIZE,F.LINEAR,void 0],n)}return!0}},{name:`stackIsOnlyUsedWithXY`,description:`stack should only be allowed for x and y channels`,properties:[z.STACK,z.CHANNEL],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>!e.stack||e.channel===`x`||e.channel===`y`}].map(e=>new uc(e));dc.reduce((e,t)=>(e[t.name()]=t,e),{});var fc=dc.reduce((e,t)=>{for(let n of t.properties())e.set(n,e.get(n)||[]),e.get(n).push(t);return e},new U),pc=[{name:`doesNotSupportConstantValue`,description:`row, column, x, y, order, and detail should not work with constant values.`,properties:[z.TYPE,z.AGGREGATE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>!L([`row`,`column`,`x`,`y`,`detail`,`order`],e.channel)}].map(e=>new uc(e));pc.reduce((e,t)=>(e[t.name()]=t,e),{});var mc=pc.reduce((e,t)=>{for(let n of t.properties())e.set(n,e.get(n)||[]),e.get(n).push(t);return e},new U);function hc(e,t,n,r,i,a){let o=fc.get(e)||[],s=r.getEncodingQueryByIndex(n);for(let e of o)if((e.strict()||a[e.name()])&&!e.satisfy(s,i,r.wildcardIndex.encodings[n],a)){let n=`(enc) `+e.name();return a.verbose&&console.log(n+` failed with `+r.toShorthand()+` for `+t.name),n}let c=mc.get(e)||[];for(let e of c)if((e.strict()||a[e.name()])&&W(s)&&!e.satisfy(s,i,r.wildcardIndex.encodings[n],a)){let n=`(enc) `+e.name();return a.verbose&&console.log(n+` failed with `+r.toShorthand()+` for `+t.name),n}return null}var gc=Lt.reduce((e,t)=>(e[t]=!0,e),{}),_c=class extends lc{constructor(e){super(e)}hasAllRequiredPropertiesSpecific(e){return ti(this.constraint.properties,t=>{if(t===z.MARK)return!V(e.getMark());if(ai(t)){let n=t.parent,r=t.child;return ti(e.getEncodings(),e=>!e[n]||!V(e[n][r]))}if(!Ti(t))throw Error(`UNIMPLEMENTED`);return ti(e.getEncodings(),e=>!e[t]||!V(e[t]))})}satisfy(e,t,n){return!this.constraint.allowWildcardForProperties&&!this.hasAllRequiredPropertiesSpecific(e)||this.constraint.satisfy(e,t,n)}},vc=[{name:`noRepeatedChannel`,description:`Each encoding channel should only be used once.`,properties:[z.CHANNEL],allowWildcardForProperties:!0,strict:!0,satisfy:(e,t,n)=>{let r={};return ti(e.getEncodings(),e=>V(e.channel)?!0:!r[e.channel]&&(r[e.channel]=!0,!0))}},{name:`alwaysIncludeZeroInScaleWithBarMark`,description:`Do not recommend bar mark if scale does not start at zero`,properties:[z.MARK,z.SCALE,wi(`scale`,`zero`),z.CHANNEL,z.TYPE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n)=>{let r=e.getMark(),i=e.getEncodings();if(r===`bar`){for(let e of i)if(G(e)&&(e.channel===`x`||e.channel===`y`)&&e.type===`quantitative`&&e.scale&&e.scale.zero===!1)return!1}return!0}},{name:`autoAddCount`,description:`Automatically adding count only for plots with only ordinal, binned quantitative, or temporal with timeunit fields.`,properties:[z.BIN,z.TIMEUNIT,z.TYPE,z.AUTOCOUNT],allowWildcardForProperties:!0,strict:!1,satisfy:(e,t,n)=>ni(e.getEncodings(),e=>mo(e))?ti(e.getEncodings(),e=>{if(W(e)||K(e))return!0;switch(e.type){case P:return!!e.bin;case Dr:return!!e.timeUnit;case Er:case Ra.KEY:case Or:return!0}throw Error(`Unsupported Type`)}):!ti(e.wildcardIndex.encodingIndicesByProperty.get(`autoCount`)||[],t=>{let n=e.getEncodingQueryByIndex(t);return K(n)&&!V(n.autoCount)})||ni(e.getEncodings(),e=>(G(e)||K(e))&&e.type===`quantitative`?!q(e)&&G(e)&&(!e.bin||V(e.bin)):G(e)&&e.type===`temporal`?!e.timeUnit||V(e.timeUnit):!1)},{name:`channelPermittedByMarkType`,description:`Each encoding channel should be supported by the mark type`,properties:[z.CHANNEL,z.MARK],allowWildcardForProperties:!0,strict:!0,satisfy:(e,t,n)=>{let r=e.getMark();return V(r)?!0:ti(e.getEncodings(),e=>V(e.channel)?!0:!!Jt(e.channel,r))}},{name:`hasAllRequiredChannelsForMark`,description:`All required channels for the specified mark should be specified`,properties:[z.CHANNEL,z.MARK],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n)=>{let r=e.getMark();switch(r){case Oi:case ki:return e.channelUsed(`x`)&&e.channelUsed(`y`);case Ni:return e.channelUsed(st);case`bar`:case Fi:case Ii:case Pi:case Mi:case ji:return e.channelUsed(`x`)||e.channelUsed(`y`);case Ai:return!e.wildcardIndex.hasProperty(z.CHANNEL)||e.channelUsed(`x`)||e.channelUsed(`y`)}throw Error(`hasAllRequiredChannelsForMark not implemented for mark`+JSON.stringify(r))}},{name:`omitAggregate`,description:`Omit aggregate plots.`,properties:[z.AGGREGATE,z.AUTOCOUNT],allowWildcardForProperties:!0,strict:!1,satisfy:(e,t,n)=>!e.isAggregate()},{name:`omitAggregatePlotWithDimensionOnlyOnFacet`,description:`Omit aggregate plots with dimensions only on facets as that leads to inefficient use of space.`,properties:[z.CHANNEL,z.AGGREGATE,z.AUTOCOUNT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>{if(e.isAggregate()){let t=!1,r=!1,i=!1;if(e.specQuery.encodings.forEach((n,a)=>{W(n)||q(n)||G(n)&&!n.aggregate&&(r=!0,L([`row`,`column`],n.channel)?e.wildcardIndex.hasEncodingProperty(a,z.CHANNEL)&&(i=!0):t=!0)}),r&&!t&&(i||n.constraintManuallySpecifiedValue))return!1}return!0}},{name:`omitAggregatePlotWithoutDimension`,description:`Aggregate plots without dimension should be omitted`,properties:[z.AGGREGATE,z.AUTOCOUNT,z.BIN,z.TIMEUNIT,z.TYPE],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>!e.isAggregate()||ni(e.getEncodings(),e=>!!(bo(e)||G(e)&&e.type===`temporal`))},{name:`omitBarLineAreaWithOcclusion`,description:`Don't use bar, line or area to visualize raw plot as they often lead to occlusion.`,properties:[z.MARK,z.AGGREGATE,z.AUTOCOUNT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>!L([`bar`,`line`,`area`],e.getMark())||e.isAggregate()},{name:`omitBarTickWithSize`,description:`Do not map field to size channel with bar and tick mark`,properties:[z.CHANNEL,z.MARK],allowWildcardForProperties:!0,strict:!1,satisfy:(e,t,n)=>{if(L([`tick`,`bar`],e.getMark())&&e.channelEncodingField(`size`)){if(n.constraintManuallySpecifiedValue)return!1;{let t=e.specQuery.encodings;for(let n=0;n<t.length;n++)if(t[n].channel===`size`)return!e.wildcardIndex.hasEncodingProperty(n,z.CHANNEL)}}return!0}},{name:`omitBarAreaForLogScale`,description:`Do not use bar and area mark for x and y's log scale`,properties:[z.MARK,z.CHANNEL,z.SCALE,wi(`scale`,`type`),z.TYPE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n)=>{let r=e.getMark(),i=e.getEncodings();if(r===`area`||r===`bar`){for(let e of i)if(G(e)&&(e.channel===`x`||e.channel===`y`)&&e.scale&&xo(e)===F.LOG)return!1}return!0}},{name:`omitMultipleNonPositionalChannels`,description:`Unless manually specified, do not use multiple non-positional encoding channel to avoid over-encoding.`,properties:[z.CHANNEL],allowWildcardForProperties:!0,strict:!1,satisfy:(e,t,n)=>{let r=e.specQuery.encodings,i=0,a=!1;for(let t=0;t<r.length;t++){let o=r[t];if(W(o)||q(o))continue;let s=o.channel;if(!V(s)&&gc[s+``]&&(i+=1,e.wildcardIndex.hasEncodingProperty(t,z.CHANNEL)&&(a=!0),i>1&&(a||n.constraintManuallySpecifiedValue)))return!1}return!0}},{name:`omitNonPositionalOrFacetOverPositionalChannels`,description:`Do not use non-positional channels unless all positional channels are used`,properties:[z.CHANNEL],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>{let r=e.specQuery.encodings,i=!1,a=!1,o=!1,s=!1;for(let t=0;t<r.length;t++){let n=r[t];if(W(n)||q(n))continue;let c=n.channel;c===`x`?o=!0:c===`y`?s=!0:V(c)||(i=!0,e.wildcardIndex.hasEncodingProperty(t,z.CHANNEL)&&(a=!0))}return a||n.constraintManuallySpecifiedValue&&i?o&&s:!0}},{name:`omitRaw`,description:`Omit raw plots.`,properties:[z.AGGREGATE,z.AUTOCOUNT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>!!e.isAggregate()},{name:`omitRawContinuousFieldForAggregatePlot`,description:`Aggregate plot should not use raw continuous field as group by values. (Quantitative should be binned. Temporal should have time unit.)`,properties:[z.AGGREGATE,z.AUTOCOUNT,z.TIMEUNIT,z.BIN,z.TYPE],allowWildcardForProperties:!0,strict:!1,satisfy:(e,t,n)=>{if(e.isAggregate()){let t=e.specQuery.encodings;for(let r=0;r<t.length;r++){let i=t[r];if(!(W(i)||q(i))&&(G(i)&&i.type===`temporal`&&!i.timeUnit&&(e.wildcardIndex.hasEncodingProperty(r,z.TIMEUNIT)||n.constraintManuallySpecifiedValue)||i.type===`quantitative`&&G(i)&&!i.bin&&!i.aggregate&&(e.wildcardIndex.hasEncodingProperty(r,z.BIN)||e.wildcardIndex.hasEncodingProperty(r,z.AGGREGATE)||e.wildcardIndex.hasEncodingProperty(r,z.AUTOCOUNT)||n.constraintManuallySpecifiedValue)))return!1}}return!0}},{name:`omitRawDetail`,description:`Do not use detail channel with raw plot.`,properties:[z.CHANNEL,z.AGGREGATE,z.AUTOCOUNT],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n)=>e.isAggregate()?!0:ti(e.specQuery.encodings,(t,r)=>W(t)||q(t)?!0:!(t.channel===`detail`&&(e.wildcardIndex.hasEncodingProperty(r,z.CHANNEL)||n.constraintManuallySpecifiedValue)))},{name:`omitRepeatedField`,description:`Each field should be mapped to only one channel`,properties:[z.FIELD],allowWildcardForProperties:!0,strict:!1,satisfy:(e,t,n)=>{let r={},i={},a=e.specQuery.encodings;for(let t=0;t<a.length;t++){let o=a[t];if(W(o)||K(o))continue;let s;if(o.field&&!V(o.field)&&(s=o.field),K(o)&&!V(o.autoCount)&&(s=`count_*`),s){if(e.wildcardIndex.hasEncodingProperty(t,z.FIELD)&&(i[s]=!0),r[s]&&(i[s]||n.constraintManuallySpecifiedValue))return!1;r[s]=!0}}return!0}},{name:`omitVerticalDotPlot`,description:`Do not output vertical dot plot.`,properties:[z.CHANNEL],allowWildcardForProperties:!0,strict:!1,satisfy:(e,t,n)=>{let r=e.getEncodings();return r.length!==1||r[0].channel!==`y`}},{name:`hasAppropriateGraphicTypeForMark`,description:`Has appropriate graphic type for mark`,properties:[z.CHANNEL,z.MARK,z.TYPE,z.TIMEUNIT,z.BIN,z.AGGREGATE,z.AUTOCOUNT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>{let r=e.getMark();switch(r){case Oi:case ki:if(e.isAggregate()){let t=e.getEncodingQueryByChannel(`x`),n=e.getEncodingQueryByChannel(`y`),r=yo(t),i=yo(n);return t&&n&&r!==i&&!(G(t)&&!r&&L([`nominal`,`key`],t.type))&&!(G(n)&&!i&&L([`nominal`,`key`],n.type))}return!0;case Ni:return!0;case`bar`:case Pi:if(e.channelEncodingField(`size`))return!1;{let t=e.getEncodingQueryByChannel(`x`),n=e.getEncodingQueryByChannel(`y`);return yo(t)!==yo(n)}case ji:let t=e.getEncodingQueryByChannel(`x`),n=e.getEncodingQueryByChannel(`y`),r=bo(t),i=bo(n),a=e.getEncodingQueryByChannel(Qe),o=yo(a),s=G(a)?a.type===Er:!1;return(r&&i||r&&!e.channelUsed(`y`)||i&&!e.channelUsed(`x`))&&(!a||a&&(o||s));case Fi:case Ai:case Ii:case Mi:return!0}throw Error(`hasAllRequiredChannelsForMark not implemented for mark`+r)}},{name:`omitInvalidStackSpec`,description:`If stack is specified, must follow Vega-Lite stack rules`,properties:[z.STACK,z.FIELD,z.CHANNEL,z.MARK,z.AGGREGATE,z.AUTOCOUNT,z.SCALE,wi(`scale`,`type`),z.TYPE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n)=>{if(!e.wildcardIndex.hasProperty(z.STACK))return!0;let r=e.getVlStack();return!(r===null&&e.getStackOffset()!==null||r.fieldChannel!==e.getStackChannel())}},{name:`omitNonSumStack`,description:`Stack specifications that use non-summative aggregates should be omitted (even implicit ones)`,properties:[z.CHANNEL,z.MARK,z.AGGREGATE,z.AUTOCOUNT,z.SCALE,wi(`scale`,`type`),z.TYPE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n)=>{let r=e.getVlStack();return!(r!=null&&!L(ya,e.getEncodingQueryByChannel(r.fieldChannel).aggregate))}},{name:`omitTableWithOcclusionIfAutoAddCount`,description:`Plots without aggregation or autocount where x and y are both discrete should be omitted if autoAddCount is enabled as they often lead to occlusion`,properties:[z.CHANNEL,z.TYPE,z.TIMEUNIT,z.BIN,z.AGGREGATE,z.AUTOCOUNT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>{if(n.autoAddCount){let t=e.getEncodingQueryByChannel(`x`),n=e.getEncodingQueryByChannel(`y`);if((!G(t)||bo(t))&&(!G(n)||bo(n)))return e.isAggregate()?ti(e.getEncodings(),e=>{let t=e.channel;return!(t!==`x`&&t!==`y`&&t!==`row`&&t!==`column`&&G(e)&&!e.aggregate)}):!1}return!0}}].map(e=>new _c(e));vc.reduce((e,t)=>(e[t.name()]=t,e),{});var yc=vc.reduce((e,t)=>{for(let n of t.properties())e.set(n,e.get(n)||[]),e.get(n).push(t);return e},new U);function bc(e,t,n,r,i){let a=yc.get(e)||[];for(let e of a)if((e.strict()||i[e.name()])&&!e.satisfy(n,r,i)){let r=`(spec) `+e.name();return i.verbose&&console.log(r+` failed with `+n.toShorthand()+` for `+t.name),r}return null}var xc=new U;function Sc(e){return xc.get(e)}xc.set(`mark`,(e,t,n)=>(r,i)=>(i.getMark().enum.forEach(a=>{i.setMark(a),bc(`mark`,e.mark,i,t,n)||r.push(i.duplicate())}),i.resetMark(),r)),si.forEach(e=>{xc.set(e,Cc(e))}),vi.forEach(e=>{xc.set(e,Cc(e))});function Cc(e){return(t,n,r)=>(i,a)=>{let o=t.encodingIndicesByProperty.get(e);function s(c){if(c===o.length){i.push(a.duplicate());return}let l=o[c],u=t.encodings[l].get(e),d=a.getEncodingQueryByIndex(l),f=a.getEncodingProperty(l,e);W(d)||q(d)||!f?s(c+1):(u.enum.forEach(t=>{t===null&&(t=void 0),a.setEncodingProperty(l,e,t,u),!hc(e,u,l,a,n,r)&&(bc(e,u,a,n,r)||s(c+1))}),a.resetEncodingProperty(l,e,u))}return s(0),i}}function wc(e){return(0,I.isObject)(e)&&!!e.property}function Tc(e,t,n){return t||=new U,n||=new U,e.forEach(e=>{wc(e)?(t.setByKey(e.property,!0),n.setByKey(e.property,e.replace)):t.setByKey(e,!0)}),{include:t,replaceIndex:n,replacer:$a(n)}}var Ec=[z.FIELD,z.TYPE,z.AGGREGATE,z.BIN,z.TIMEUNIT,z.STACK],Dc=Ec.concat([{property:z.CHANNEL,replace:{x:`xy`,y:`xy`,color:`style`,size:`style`,shape:`style`,opacity:`style`,row:`facet`,column:`facet`}}]),Oc={};function kc(e,t){Oc[e]=t}var Ac=`field`,jc=`fieldTransform`,Mc=`encoding`,Nc=`spec`;function Pc(e,t){if(t){let n={name:``,path:``,items:[]},r={},i=[],a=[],o=[];for(let e=0;e<t.length;e++){i.push(e>0?i[e-1].duplicate():new U),a.push(e>0?a[e-1].duplicate():new U);let n=t[e].groupBy;if((0,I.isArray)(n)){let t=Tc(n,i[e],a[e]);o.push(t.replacer)}}return e.forEach(e=>{let a=``,s=n;for(let n=0;n<t.length;n++){let c=s.groupBy=t[n].groupBy;s.orderGroupBy=t[n].orderGroupBy;let l=(0,I.isArray)(c)?oo(e.specQuery,i[n],o[n]):Oc[c](e.specQuery);a+=`/`+l,r[a]||(r[a]={name:l,path:a,items:[]},s.items.push(r[a])),s=r[a]}s.items.push(e)}),n}return{name:``,path:``,items:e}}var Fc=Tc([z.FIELD]);function Ic(e,t){return Oc[t](e)}kc(Ac,e=>oo(e,Fc.include,Fc.replacer));var Lc=Tc(Ec);kc(jc,e=>oo(e,Lc.include,Lc.replacer));var Rc=Tc(Dc);kc(Mc,e=>oo(e,Rc.include,Rc.replacer)),kc(Nc,e=>JSON.stringify(e));var zc=class{constructor(){this._mark=void 0,this._encodings={},this._encodingIndicesByProperty=new U}setEncodingProperty(e,t,n){let r=this._encodings;(r[e]=r[e]||new U).set(t,n);let i=this._encodingIndicesByProperty;return i.set(t,i.get(t)||[]),i.get(t).push(e),this}hasEncodingProperty(e,t){return!!this._encodings[e]&&this._encodings[e].has(t)}hasProperty(e){if(Ti(e))return this.encodingIndicesByProperty.has(e);if(e===`mark`)return!!this.mark;throw Error(`Unimplemented for property `+e)}isEmpty(){return!this.mark&&this.encodingIndicesByProperty.size()===0}setMark(e){return this._mark=e,this}get mark(){return this._mark}get encodings(){return this._encodings}get encodingIndicesByProperty(){return this._encodingIndicesByProperty}},Bc=class e{constructor(e,t,n,r,i){this._rankingScore={},this._spec=e,this._channelFieldCount=e.encodings.reduce((e,t)=>(!V(t.channel)&&(!K(t)||t.autoCount!==!1)&&(e[t.channel+``]=1),e),{}),this._wildcardIndex=t,this._assignedWildcardIndex=i,this._opt=r,this._schema=n}static build(t,n,r){let i=new zc;if(V(t.mark)){let e=sa(z.MARK);t.mark=ia(t.mark,e,r.enum.mark),i.setMark(t.mark)}if(t.encodings.forEach((e,t)=>{K(e)&&(console.warn(`A field with autoCount should not be included as autoCount meant to be an internal object.`),e.type=P),G(e)&&e.type===void 0&&(e.type=`?`),si.forEach(a=>{if(V(e[a])){let o=sa(a)+t,s=pa(a,n,r),c=e[a]=ia(e[a],o,s);i.setEncodingProperty(t,a,c)}}),vi.forEach(a=>{let o=e[a.parent];if(o){let e=a.child;if(V(o[e])){let s=sa(a)+t,c=pa(a,n,r),l=o[e]=ia(o[e],s,c);i.setEncodingProperty(t,a,l)}}})}),r.autoAddCount){let e={name:sa(z.CHANNEL)+t.encodings.length,enum:pa(z.CHANNEL,n,r)},a={name:sa(z.AUTOCOUNT)+t.encodings.length,enum:[!1,!0]},o={channel:e,autoCount:a,type:P};t.encodings.push(o);let s=t.encodings.length-1;i.setEncodingProperty(s,z.CHANNEL,e),i.setEncodingProperty(s,z.AUTOCOUNT,a)}return new e(t,i,n,r,{})}get wildcardIndex(){return this._wildcardIndex}get schema(){return this._schema}get specQuery(){return this._spec}duplicate(){return new e((0,I.duplicate)(this._spec),this._wildcardIndex,this._schema,this._opt,(0,I.duplicate)(this._assignedWildcardIndex))}setMark(e){let t=this._wildcardIndex.mark.name;this._assignedWildcardIndex[t]=this._spec.mark=e}resetMark(){let e=this._spec.mark=this._wildcardIndex.mark;delete this._assignedWildcardIndex[e.name]}getMark(){return this._spec.mark}getEncodingProperty(e,t){let n=this._spec.encodings[e];return ai(t)?n[t.parent][t.child]:n[t]}setEncodingProperty(e,t,n,r){let i=this._spec.encodings[e];t===z.CHANNEL&&i.channel&&!V(i.channel)&&this._channelFieldCount[i.channel]--,ai(t)?i[t.parent][t.child]=n:i[t]=ui(t)&&n===!0?(0,I.extend)({},i[t],{enum:void 0,name:void 0}):n,this._assignedWildcardIndex[r.name]=n,t===z.CHANNEL&&(this._channelFieldCount[n]=(this._channelFieldCount[n]||0)+1)}resetEncodingProperty(e,t,n){let r=this._spec.encodings[e];t===z.CHANNEL&&this._channelFieldCount[r.channel]--,ai(t)?r[t.parent][t.child]=n:r[t]=n,delete this._assignedWildcardIndex[n.name]}channelUsed(e){return this._channelFieldCount[e]>0}channelEncodingField(e){return G(this.getEncodingQueryByChannel(e))}getEncodings(){return this._spec.encodings.filter(e=>!q(e))}getEncodingQueryByChannel(e){for(let t of this._spec.encodings)if(t.channel===e)return t}getEncodingQueryByIndex(e){return this._spec.encodings[e]}isAggregate(){return qa(this._spec)}getVlStack(){return Ja(this._spec)}getStackOffset(){return Ya(this._spec)}getStackChannel(){return Xa(this._spec)}toShorthand(e){if(e){if((0,I.isString)(e))return Ic(this.specQuery,e);let t=Tc(e);return oo(this._spec,t.include,t.replacer)}return oo(this._spec)}toSpec(e){if(V(this._spec.mark))return null;let t={};return e||=this._spec.data,e&&(t.data=e),this._spec.transform&&(t.transform=this._spec.transform),t.mark=this._spec.mark,t.encoding=go(this.specQuery.encodings,{schema:this._schema,wildcardMode:`null`}),this._spec.width&&(t.width=this._spec.width),this._spec.height&&(t.height=this._spec.height),this._spec.background&&(t.background=this._spec.background),this._spec.padding&&(t.padding=this._spec.padding),this._spec.title&&(t.title=this._spec.title),t.encoding===null?null:((this._spec.config||this._opt.defaultSpecConfig)&&(t.config=(0,I.extend)({},this._opt.defaultSpecConfig,this._spec.config)),t)}getRankingScore(e){return this._rankingScore[e]}setRankingScore(e,t){this._rankingScore[e]=t}};function Vc(e){if(e.groupBy){let t={groupBy:e.groupBy};e.orderBy&&(t.orderGroupBy=e.orderBy);let n={spec:(0,I.duplicate)(e.spec),nest:[t]};return e.chooseBy&&(n.chooseBy=e.chooseBy),e.config&&(n.config=e.config),n}return(0,I.duplicate)(e)}function Hc(e){return e.items!==void 0}function Uc(e){let t=e.items[0];for(;t&&Hc(t);)t=t.items[0];return t}var Wc=class{constructor(e){this.type=e,this.scoreIndex=this.initScore()}getFeatureScore(e){let t=this.type,n=this.scoreIndex[e];if(n!==void 0)return{type:t,feature:e,score:n}}},Z;(function(e){e[e.Q=P]=`Q`,e[e.BIN_Q=`bin_`+P]=`BIN_Q`,e[e.T=Dr]=`T`,e[e.TIMEUNIT_T=`timeUnit_time`]=`TIMEUNIT_T`,e[e.TIMEUNIT_O=`timeUnit_`+Er]=`TIMEUNIT_O`,e[e.O=Er]=`O`,e[e.N=Or]=`N`,e[e.K=Ra.KEY]=`K`,e[e.NONE=`-`]=`NONE`})(Z||={});var Gc=Z.Q,Kc=Z.BIN_Q,qc=Z.T,Jc=Z.TIMEUNIT_T,Yc=Z.TIMEUNIT_O,Xc=Z.O,Zc=Z.N,Qc=Z.K,$c=Z.NONE;function el(e){return e.bin?Z.BIN_Q:e.timeUnit?Lr(xo(e))?Z.TIMEUNIT_O:Z.TIMEUNIT_T:e.type}var tl=class extends Wc{constructor(){super(`Axis`)}initScore(e={}){e=Object.assign({},ma,e);let t={};return[{feature:Kc,opt:`preferredBinAxis`},{feature:qc,opt:`preferredTemporalAxis`},{feature:Jc,opt:`preferredTemporalAxis`},{feature:Yc,opt:`preferredTemporalAxis`},{feature:Xc,opt:`preferredOrdinalAxis`},{feature:Zc,opt:`preferredNominalAxis`}].forEach(n=>{e[n.opt]===`x`?t[n.feature+`_y`]=-.01:e[n.opt]===`y`&&(t[n.feature+`_x`]=-.01)}),t}featurize(e,t){return e+`_`+t}getScore(e,t,n){return e.getEncodings().reduce((e,t)=>{if(G(t)||K(t)){let n=el(t),r=this.featurize(n,t.channel),i=this.getFeatureScore(r);i&&e.push(i)}return e},[])}},nl=class extends Wc{constructor(){super(`Dimension`)}initScore(){return{row:-2,column:-2,color:0,opacity:0,size:0,shape:0}}getScore(e,t,n){return e.isAggregate()&&e.getEncodings().reduce((e,t)=>{if(K(t)||G(t)&&!t.aggregate){let n=this.getFeatureScore(t.channel+``);if(n&&n.score>e.score)return n}return e},{type:`Dimension`,feature:`No Dimension`,score:-5}),[]}},rl=class extends Wc{constructor(){super(`Facet`)}initScore(e){e=Object.assign({},ma,e);let t={};return e.preferredFacet===`row`?t[Ke]=-.01:e.preferredFacet===`column`&&(t.row=-.01),t}getScore(e,t,n){return e.getEncodings().reduce((e,t)=>{if(G(t)||K(t)){let n=this.getFeatureScore(t.channel);n&&e.push(n)}return e},[])}},il=class extends Wc{constructor(){super(`SizeChannel`)}initScore(){return{bar_size:-2,tick_size:-2}}getScore(e,t,n){let r=e.getMark();return e.getEncodings().reduce((e,t)=>{if(G(t)||K(t)){let n=r+`_`+t.channel,i=this.getFeatureScore(n);i&&e.push(i)}return e},[])}},al=class extends Wc{constructor(){super(`TypeChannel`)}initScore(){let e={},t={x:0,y:0,size:-.575,color:-.725,text:-2,opacity:-3,shape:-10,row:-10,column:-10,detail:-20};[Gc,qc,Jc].forEach(n=>{(0,I.keys)(t).forEach(r=>{e[this.featurize(n,r)]=t[r]})});let n=(0,I.extend)({},t,{row:-.75,column:-.75,shape:-3.1,text:-3.2,detail:-4});[Kc,Yc,Xc].forEach(t=>{(0,I.keys)(n).forEach(r=>{e[this.featurize(t,r)]=n[r]})});let r={x:0,y:0,color:-.6,shape:-.65,row:-.7,column:-.7,text:-.8,detail:-2,size:-3,opacity:-3.1};return(0,I.keys)(r).forEach(t=>{e[this.featurize(Zc,t)]=r[t],e[this.featurize(Qc,t)]=L([`x`,`y`,`detail`],t)?-1:r[t]-2}),e}featurize(e,t){return e+`_`+t}getScore(e,t,n){let r=e.getEncodings().reduce((e,t)=>{if(G(t)||K(t)){let n=co(t);(e[n]=e[n]||[]).push(t)}return e},{}),i=[];return R(r,e=>{let t=e.reduce((e,t)=>{if(G(t)||K(t)){let n=el(t),r=this.featurize(n,t.channel),i=this.getFeatureScore(r);if(e===null||i.score>e.score)return i}return e},null);i.push(t)}),i}},ol=class extends Wc{constructor(){super(`Mark`)}initScore(){return sl()}getScore(e,t,n){let r=e.getMark();(r===`circle`||r===`square`)&&(r=Ai);let i=e.getEncodingQueryByChannel(`x`),a=i?el(i):$c,o=e.getEncodingQueryByChannel(`y`),s=o?el(o):$c,c=!e.isAggregate(),l=a+`_`+s+`_`+c+`_`+r,u=this.getFeatureScore(l);return u?[u]:(console.error(`feature score missing for`,l),[])}};function Q(e,t,n,r){return e+`_`+t+`_`+n+`_`+r}function sl(){let e=[Gc,qc],t=[Kc,Yc,Xc,Zc,Qc,$c],n={};e.forEach(t=>{e.forEach(e=>{R({point:0,text:-.2,tick:-.5,rect:-1,bar:-2,line:-2,area:-2,rule:-2.5},(r,i)=>{let a=Q(t,e,!0,i);n[a]=r}),R({point:0,text:-.2,tick:-.5,bar:-2,line:-2,area:-2,rule:-2.5},(r,i)=>{let a=Q(t,e,!1,i);n[a]=r})})}),e.forEach(e=>{t.forEach(t=>{R({tick:0,point:-.2,text:-.5,bar:-2,line:-2,area:-2,rule:-2.5},(r,i)=>{let a=Q(e,t,!0,i);n[a]=r;let o=Q(t,e,!0,i);n[o]=r})}),[Jc].forEach(t=>{R({point:0,text:-.5,tick:-1,bar:-2,line:-2,area:-2,rule:-2.5},(r,i)=>{let a=Q(e,t,!0,i);n[a]=r;let o=Q(t,e,!0,i);n[o]=r})}),[$c,Zc,Xc,Qc].forEach(t=>{R({bar:0,point:-.2,tick:-.25,text:-.3,line:-2,area:-2,rule:-2.5},(r,i)=>{let a=Q(e,t,!1,i);n[a]=r;let o=Q(t,e,!1,i);n[o]=r})}),[Kc].forEach(t=>{R({bar:0,point:-.2,tick:-.25,text:-.3,line:-.5,area:-.5,rule:-2.5},(r,i)=>{let a=Q(e,t,!1,i);n[a]=r;let o=Q(t,e,!1,i);n[o]=r})}),[Jc,Yc].forEach(t=>{R({line:0,area:-.1,bar:-.2,point:-.3,tick:-.35,text:-.4,rule:-2.5},(r,i)=>{let a=Q(e,t,!1,i);n[a]=r;let o=Q(t,e,!1,i);n[o]=r})})}),[Jc].forEach(e=>{[Jc].forEach(t=>{let r={point:0,rect:-.1,text:-.5,tick:-1,bar:-2,line:-2,area:-2,rule:-2.5};R(r,(r,i)=>{let a=Q(e,t,!0,i);n[a]=r}),R(r,(r,i)=>{let a=Q(e,t,!1,i);n[a]=r})}),t.forEach(t=>{let r={tick:0,point:-.2,text:-.5,rect:-1,bar:-2,line:-2,area:-2,rule:-2.5};R(r,(r,i)=>{let a=Q(e,t,!0,i);n[a]=r}),R(r,(r,i)=>{let a=Q(t,e,!0,i);n[a]=r}),R(r,(r,i)=>{let a=Q(e,t,!1,i);n[a]=r}),R(r,(r,i)=>{let a=Q(t,e,!1,i);n[a]=r})})});for(let e of t)for(let r of t){let t={point:0,rect:0,text:-.1,tick:-1,bar:-2,line:-2,area:-2,rule:-2.5};R(t,(t,i)=>{let a=Q(e,r,!0,i);n[a]=t}),R(t,(t,i)=>{let a=Q(e,r,!1,i);n[a]=t})}return n}var cl=[new tl,new nl,new rl,new ol,new il,new al];function ll(e,t,n){let r=cl.reduce((r,i)=>{let a=i.getScore(e,t,n);return r.concat(a)},[]);return{score:r.reduce((e,t)=>e+t.score,0),features:r}}var ul=`aggregationQuality`;function dl(e,t,n){let r=fl(e,t,n);return{score:r.score,features:[r]}}function fl(e,t,n){let r=e.getEncodings();if(e.isAggregate()){if(ni(r,e=>G(e)&&(e.type===`quantitative`&&!e.bin&&!e.aggregate||e.type===`temporal`&&!e.timeUnit)))return{type:ul,score:.1,feature:`Aggregate with raw continuous`};if(ni(r,e=>G(e)&&bo(e))){let e=ni(r,e=>G(e)&&e.aggregate===`count`||mo(e)),t=ni(r,e=>G(e)&&!!e.bin);return e?{type:ul,score:.8,feature:`Aggregate with count`}:t?{type:ul,score:.7,feature:`Aggregate with bin but without count`}:{type:ul,score:.9,feature:`Aggregate without count and without bin`}}return{type:ul,score:.3,feature:`Aggregate without dimension`}}return ni(r,e=>G(e)&&!bo(e))?{type:ul,score:1,feature:`Raw with measure`}:{type:ul,score:.2,feature:`Raw without measure`}}var pl=`fieldOrder`;function ml(e,t,n){let r=e.wildcardIndex.encodingIndicesByProperty.get(`field`);if(!r)return{score:0,features:[]};let i=e.specQuery.encodings,a=t.fieldSchemas.length,o=[],s=0,c=1;for(let n=r.length-1;n>=0;n--){let l=r[n],u=i[l],d;if(G(u))d=u.field;else continue;let f=e.wildcardIndex.encodings[l].get(`field`),p=t.fieldSchema(d).index,m=-p*c;s+=m,o.push({score:m,type:`fieldOrder`,feature:`field ${f.name} is ${d} (#${p} in the schema)`}),c*=a}return{score:s,features:o}}var hl={};function gl(e,t){hl[e]=t}function _l(e){return hl[e]}function vl(e,t,n,r){return!t.nest||r===t.nest.length?(t.orderBy||t.chooseBy)&&(e.items.sort(yl(t.orderBy||t.chooseBy,n,t.config)),t.chooseBy&&e.items.length>0&&e.items.splice(1)):(e.items.forEach(e=>{vl(e,t,n,r+1)}),t.nest[r].orderGroupBy&&e.items.sort(bl(t.nest[r].orderGroupBy,n,t.config))),e}function yl(e,t,n){return(r,i)=>e instanceof Array?xl(e,r,i,t,n):xl([e],r,i,t,n)}function bl(e,t,n){return(r,i)=>{let a=Uc(r),o=Uc(i);return e instanceof Array?xl(e,a,o,t,n):xl([e],a,o,t,n)}}function xl(e,t,n,r,i){for(let a of e){let e=Sl(n,a,r,i).score-Sl(t,a,r,i).score;if(e!==0)return e}return 0}function Sl(e,t,n,r){if(e.getRankingScore(t)!==void 0)return e.getRankingScore(t);let i=_l(t)(e,n,r);return e.setRankingScore(t,i),i}gl(`effectiveness`,ll),gl(ul,dl),gl(pl,ml);function Cl(e,t,n){let r={};return e=e.map(function(e){return n.smallRangeStepForHighCardinalityOrFacet&&(e=wl(e,t,r,n)),n.nominalColorScaleForHighCardinality&&(e=Tl(e,t,r,n)),n.xAxisOnTopForHighYCardinalityWithoutColumn&&(e=El(e,t,r,n)),e}),e}function wl(e,t,n,r){[`row`,`y`,Ke,`x`].forEach(t=>{n[t]=e.getEncodingQueryByChannel(t)});let i=n.y;if(i!==void 0&&G(i)&&(n.row||t.cardinality(i)>r.smallRangeStepForHighCardinalityOrFacet.maxCardinality)){i.scale===void 0&&(i.scale={});let e=xo(i);i.scale&&(e===void 0||Lr(e))&&(i.scale.rangeStep||(i.scale.rangeStep=12))}let a=n.x;if(G(a)&&(n.column||t.cardinality(a)>r.smallRangeStepForHighCardinalityOrFacet.maxCardinality)){a.scale===void 0&&(a.scale={});let e=xo(a);a.scale&&(e===void 0||Lr(e))&&(a.scale.rangeStep||(a.scale.rangeStep=12))}return e}function Tl(e,t,n,r){n[Qe]=e.getEncodingQueryByChannel(Qe);let i=n[Qe];return G(i)&&i!==void 0&&(i.type===`nominal`||i.type===Ra.KEY)&&t.cardinality(i)>r.nominalColorScaleForHighCardinality.maxCardinality&&(i.scale===void 0&&(i.scale={}),i.scale&&(i.scale.range||(i.scale.scheme=r.nominalColorScaleForHighCardinality.palette))),e}function El(e,t,n,r){if([Ke,`x`,`y`].forEach(t=>{n[t]=e.getEncodingQueryByChannel(t)}),n.column===void 0){let e=n.x,i=n.y;G(e)&&G(i)&&i!==void 0&&i.field&&Lr(xo(i))&&e!==void 0&&t.cardinality(i)>r.xAxisOnTopForHighYCardinalityWithoutColumn.maxCardinality&&(e.axis===void 0&&(e.axis={}),e.axis&&!e.axis.orient&&(e.axis.orient=`top`))}return e}function Dl(e,t,n=ma){let r=Bc.build(e,t,n),i=r.wildcardIndex,a=[r];return n.propertyPrecedence.forEach(e=>{let r=Si(e);if(i.hasProperty(r)){let e=Sc(r)(i,t,n);a=a.reduce(e,[])}}),n.stylize&&(n.nominalColorScaleForHighCardinality!==null||n.smallRangeStepForHighCardinalityOrFacet!==null||n.xAxisOnTopForHighYCardinalityWithoutColumn!==null)?Cl(a,t,n):a}function Ol(e,t,n){e=Object.assign({},Vc(e),{config:Object.assign({},ma,n,e.config)});let r=vl(Pc(Dl(e.spec,t,e.config),e.nest),e,t,0);return{query:e,result:r}}var kl=e(l(),1),$=h(),Al={[X.BOOLEAN]:(0,$.jsx)(k,{className:`h-5 w-5 inline-flex opacity-60`}),[X.DATETIME]:(0,$.jsx)(A,{className:`h-5 w-5 inline-flex opacity-60`}),[X.NUMBER]:(0,$.jsx)(O,{className:`h-5 w-5 inline-flex opacity-60`}),[X.STRING]:(0,$.jsx)(re,{className:`h-5 w-5 inline-flex opacity-60`}),[X.INTEGER]:(0,$.jsx)(ye,{className:`h-5 w-5 inline-flex opacity-60`})},jl=12,Ml=e=>{let t=(0,be.c)(45),{schema:n}=e,[r,i]=(0,kl.useState)(),[a,o]=(0,kl.useState)(),s,c,l,u,d,f,p,h;if(t[0]!==n||t[1]!==r||t[2]!==a){s=n.fieldNames();let e;t[11]!==n||t[12]!==r?(e=r?n.stats({field:r,channel:`x`}):void 0,t[11]=n,t[12]=r,t[13]=e):e=t[13],l=e;let o;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(ve,{className:`text-muted-foreground`,width:40,height:40,strokeWidth:1.5}),t[14]=o):o=t[14];let g=o,_=a?s:s.slice(0,jl);c=s.length>jl,f=`flex flex-col justify-center items-center h-full flex-1 gap-2`,p=g,h=(0,$.jsxs)(`span`,{className:`text-muted-foreground font-semibold`,children:[s.length>0?s.length:`No`,` fields`]}),u=`hidden lg:grid grid-cols-2 xl:grid-cols-3 gap-2 p-2 bg-(--slate-1) border rounded lg:items-center items-start w-fit grid-flow-dense max-h-[300px] overflow-auto`;let v;t[15]!==n||t[16]!==r?(v=e=>{let t=n.cardinality({channel:`x`,field:e});return(0,$.jsxs)(`span`,{className:m(`hover:bg-muted self-start px-2 py-2 rounded flex flex-row gap-1 items-center cursor-pointer lg:justify-center text-sm truncate shrink-0 overflow-hidden`,r===e&&`bg-muted`),onClick:()=>{if(r===e){i(void 0);return}i(e)},children:[Al[n.primitiveType(e)],e,t>1&&(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,t,`)`]})]},e)},t[15]=n,t[16]=r,t[17]=v):v=t[17],d=_.map(v),t[0]=n,t[1]=r,t[2]=a,t[3]=s,t[4]=c,t[5]=l,t[6]=u,t[7]=d,t[8]=f,t[9]=p,t[10]=h}else s=t[3],c=t[4],l=t[5],u=t[6],d=t[7],f=t[8],p=t[9],h=t[10];let g;t[18]!==c||t[19]!==a?(g=c&&(0,$.jsx)(w,{"data-testid":`marimo-plugin-data-explorer-show-more-columns`,variant:`link`,size:`sm`,className:`self-center col-span-3 -mt-1`,onClick:()=>o(Fl),children:a?`Show less`:`Show more`}),t[18]=c,t[19]=a,t[20]=g):g=t[20];let v;t[21]!==u||t[22]!==d||t[23]!==g?(v=(0,$.jsxs)(`div`,{className:u,children:[d,g]}),t[21]=u,t[22]=d,t[23]=g,t[24]=v):v=t[24];let b=r||``,C=s.length===0,T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{i(e)},t[25]=T):T=t[25];let ne;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,$.jsx)(te,{className:`min-w-[210px] h-full`,children:(0,$.jsx)(_,{placeholder:`Select a column`})}),t[26]=ne):ne=t[26];let E;t[27]===n?E=t[28]:(E=n.fieldNames().map(e=>(0,$.jsx)(y,{value:e.toString(),children:(0,$.jsxs)(`span`,{className:`flex items-center gap-2 flex-1`,children:[Al[n.primitiveType(e)],(0,$.jsx)(`span`,{className:`flex-1`,children:e}),(0,$.jsxs)(`span`,{className:`text-muted-foreground text-xs font-semibold`,children:[`(`,n.vlType(e),`)`]})]})},e)),t[27]=n,t[28]=E);let D;t[29]===E?D=t[30]:(D=(0,$.jsx)(ee,{children:(0,$.jsx)(x,{children:E})}),t[29]=E,t[30]=D);let O;t[31]!==D||t[32]!==b||t[33]!==C?(O=(0,$.jsx)(`div`,{className:`lg:hidden`,children:(0,$.jsxs)(S,{"data-testid":`marimo-plugin-data-explorer-column-select`,value:b,disabled:C,onValueChange:T,children:[ne,D]})}),t[31]=D,t[32]=b,t[33]=C,t[34]=O):O=t[34];let k;t[35]!==r||t[36]!==l?(k=r&&(0,$.jsx)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-2 p-2 text-sm`,children:Nl.map(e=>(0,$.jsxs)(`div`,{className:`flex flex-row gap-2 min-w-[100px]`,children:[(0,$.jsx)(`span`,{className:`font-semibold`,children:e}),(0,$.jsx)(`span`,{children:(0,$.jsx)(Pl,{value:l?.[e]})})]},e))}),t[35]=r,t[36]=l,t[37]=k):k=t[37];let A;return t[38]!==O||t[39]!==k||t[40]!==f||t[41]!==p||t[42]!==h||t[43]!==v?(A=(0,$.jsxs)(`div`,{className:f,children:[p,h,v,O,k]}),t[38]=O,t[39]=k,t[40]=f,t[41]=p,t[42]=h,t[43]=v,t[44]=A):A=t[44],A},Nl=[`distinct`,`min`,`max`,`mean`,`median`,`q1`,`q3`,`stdev`],Pl=e=>{let t=(0,be.c)(8),{value:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={maximumFractionDigits:2},t[0]=r):r=t[0];let i=oe(r),a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a={year:`numeric`,month:`short`,day:`numeric`},t[1]=a):a=t[1];let o=ue(a);if(typeof n==`number`){let e;return t[2]!==i||t[3]!==n?(e=i.format(n),t[2]=i,t[3]=n,t[4]=e):e=t[4],e}if(typeof n==`string`)return n;if(typeof n==`object`&&n instanceof Date){let e;return t[5]!==o||t[6]!==n?(e=o.format(n),t[5]=o,t[6]=n,t[7]=e):e=t[7],e}return String(n)};function Fl(e){return!e}var Il=[`argmax`,`argmin`,`average`,`count`,`distinct`,`exponential`,`exponentialb`,`product`,`max`,`mean`,`median`,`min`,`missing`,`q1`,`q3`,`ci0`,`ci1`,`stderr`,`stdev`,`stdevp`,`sum`,`valid`,`values`,`variance`,`variancep`],Ll=e=>typeof e==`string`&&Il.includes(e);function Rl(e){return e?e===`bin`?{bin:!0}:Ll(e)?{aggregate:e}:zl(e)?{timeUnit:e}:{}:{}}function zl(e){return e?Vl.includes(e)||Hl.includes(e):!1}var Bl=[`bin`,`min`,`max`,`mean`,`median`,`sum`],Vl=[`year`,`month`,`date`,`day`,`hours`,`minutes`,`seconds`,`milliseconds`],Hl=[`yearmonth`,`yearmonthdate`,`monthdate`];function Ul(e){let{aggregate:t,bin:n,timeUnit:r}=e;if(n)return`bin`;if(t)return t.toString();if(r)return r.toString()}var Wl=[`?`,`area`,`bar`,`circle`,`geoshape`,`line`,`point`,`rect`,`rule`,`square`,`text`,`tick`,`trail`],Gl={type:`histograms`,limit:12,createQuery(e){return{spec:{data:e.spec.data,mark:`?`,transform:e.spec.transform,encodings:[{channel:`?`,bin:`?`,timeUnit:`?`,field:`?`,type:`?`},{channel:`?`,aggregate:`count`,field:`*`,type:`quantitative`}]},groupBy:`fieldTransform`,orderBy:[`fieldOrder`,`aggregationQuality`,`effectiveness`],chooseBy:[`aggregationQuality`,`effectiveness`],config:{autoAddCount:!1}}}};function Kl(e){let t={};for(let n in e)e[n]!==void 0&&(t[n]=e[n]);return t}function ql(e,t){let{fn:n,...r}=e;return{channel:t,...Rl(n),...r}}function Jl(e){let{aggregate:t,bin:n,timeUnit:r,field:i,scale:a,legend:o,axis:s,sort:c,description:l}=e,{type:u}=e;if(V(u))throw Error(`Wildcard not support`);u===`ordinal`&&(d.warn(`Ordinal type is not supported. Using nominal type instead.`),u=`nominal`);let f=Ul({aggregate:t,bin:n,timeUnit:r});return p(i!==void 0,`Field is required for fieldQ`),Kl({field:i,fn:f,type:u,sort:c,scale:a,axis:s,legend:o,description:l})}function Yl(e){return{mark:e.mark,encodings:Xl(e.encoding),config:e.config}}function Xl(e){return e?Object.entries(e).map(([e,t])=>ql(t,e)):[]}function Zl(e){let{type:t,limit:n,additionalFieldQuery:r}=e;return{type:t,limit:n,createQuery(e){return{spec:{...e.spec,encodings:[...e.spec.encodings,r]},groupBy:`field`,orderBy:[`fieldOrder`,`aggregationQuality`,`effectiveness`],chooseBy:[`aggregationQuality`,`effectiveness`],config:{autoAddCount:!0}}}}}var Ql=Zl({type:`addCategoricalField`,limit:4,additionalFieldQuery:{channel:`?`,field:`?`,type:`nominal`}}),$l=Zl({type:`addQuantitativeField`,limit:4,additionalFieldQuery:{channel:`?`,bin:`?`,aggregate:`?`,field:`?`,type:`quantitative`}}),eu=Zl({type:`addTemporalField`,limit:2,additionalFieldQuery:{channel:`?`,hasFn:!0,timeUnit:`?`,field:`?`,type:`temporal`}}),tu=[`color`,`fill`,`stroke`,`opacity`,`fillOpacity`,`strokeOpacity`,`strokeWidth`,`size`,`shape`,`strokeDash`,`angle`,`time`];function nu(e){return!au(e).hasAnyWildcard}function ru(e){let t=[`x`,`y`,`color`],n=[`row`,`column`],r=new Set(e.encodings.map(e=>e.channel)),i=t.every(e=>r.has(e)),a=n.some(e=>r.has(e));return i&&a}function iu(e){return e.encodings.length===0}function au(e){let t=!1,n=!1,r=!1;for(let i of e.encodings)W(i)||(K(i)?V(i.autoCount)&&(n=!0):(V(i.field)&&(t=!0),(V(i.aggregate)||V(i.bin)||V(i.timeUnit))&&(n=!0),V(i.channel)&&(r=!0)));return{hasAnyWildcard:r||t||n,hasWildcardField:t,hasWildcardFn:n,hasWildcardChannel:r}}var ou={name:`source`};function su(e){let t=!1,n=!1,r=!1;return e.encodings.forEach(e=>{e.channel===`x`||e.channel===`y`?t=!0:e.channel===`row`||e.channel===`column`?r=!0:typeof e.channel==`string`&&me(tu,e.channel)&&(n=!0)}),{hasOpenPosition:t,hasStyleChannel:n,hasOpenFacet:r}}function cu(e,t){let n={},{hasOpenPosition:r,hasStyleChannel:i,hasOpenFacet:a}=su(e.spec);return(r||i)&&(n.addQuantitativeField=uu($l,e,t)),(r||i||a)&&(n.addCategoricalField=uu(Ql,e,t)),r&&(n.addTemporalField=uu(eu,e,t)),n}function lu(e,t){if(iu(e.spec))return{plots:[],query:e,limit:1};let n=Ol(e,t).result;return{plots:[du(n,ou)[0]],query:e,limit:1}}function uu(e,t,n){let r=e.createQuery(t),i=Ol(r,n).result;return{plots:du(i,ou),query:r,limit:e.limit}}function du(e,t){return e.items.map(e=>Hc(e)?fu(t,Uc(e)):fu(t,e))}function fu(e,t){return{fieldInfos:t.getEncodings().filter(G).map(e=>({fieldDef:Jl(e),channel:e.channel})),spec:t.toSpec(e)}}function pu(e){let{spec:t,autoAddCount:n}=e,r=Yl(t),{hasAnyWildcard:i,hasWildcardFn:a,hasWildcardField:o}=au(r);return{spec:r,groupBy:mu({hasWildcardFn:a,hasWildcardField:o}),orderBy:[`fieldOrder`,`aggregationQuality`,`effectiveness`],chooseBy:[`aggregationQuality`,`effectiveness`],config:i?{autoAddCount:n}:void 0}}function mu(e){let{hasWildcardFn:t,hasWildcardField:n}=e;return t?`fieldTransform`:n?`field`:`encoding`}function hu(){return{mark:`?`,encoding:{},config:{},schema:null}}var{valueAtom:gu,useActions:_u}=T(hu,{setSchema:(e,t)=>({...e,schema:t}),setMark:(e,t)=>({...e,mark:t}),setEncoding:(e,t)=>{let n=Kl({...e.encoding,...t});return{...e,encoding:n}},set:(e,t)=>{let{schema:n,...r}=t;return{...e,...r}}});function vu(){return _u()}var yu=a(e=>{let t=e(gu);if(!t.schema)return{};let n=pu({spec:t,autoAddCount:!0});return iu(n.spec)?{main:lu(n,t.schema),histograms:uu(Gl,n,t.schema)}:nu(n.spec)&&!ru(n.spec)?{main:lu(n,t.schema),...cu(n,t.schema)}:{main:lu(n,t.schema)}}),bu=[`x`,`y`,`row`,`column`],xu=[`color`,`size`,`shape`],Su=e=>{let t=(0,be.c)(26),{schema:n,mark:r}=e,i=o(gu),a=vu(),s=i.encoding.x&&i.encoding.y,c;t[0]!==a||t[1]!==s||t[2]!==n||t[3]!==i.encoding?(c=e=>(0,$.jsx)(Cu,{schema:n,label:e,disabled:(e===`row`||e===`column`)&&!s,fieldDefinition:i.encoding[e],onChange:t=>a.setEncoding({[e]:t})},e),t[0]=a,t[1]=s,t[2]=n,t[3]=i.encoding,t[4]=c):c=t[4];let l=c,u;t[5]===r?u=t[6]:(u=r.toString(),t[5]=r,t[6]=u);let d;t[7]===a?d=t[8]:(d=e=>a.setMark(e),t[7]=a,t[8]=d);let f;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(te,{children:(0,$.jsx)(_,{placeholder:`Mark`})}),t[9]=f):f=t[9];let p;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(ee,{children:(0,$.jsxs)(x,{children:[(0,$.jsx)(g,{children:`Mark`}),Wl.map(Eu)]})}),t[10]=p):p=t[10];let m;t[11]!==u||t[12]!==d?(m=(0,$.jsxs)(S,{"data-testid":`marimo-plugin-data-explorer-mark-select`,value:u,onValueChange:d,children:[f,p]}),t[11]=u,t[12]=d,t[13]=m):m=t[13];let h=m,v;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(`span`,{className:`col-span-2 flex items-center justify-between w-full`,children:(0,$.jsx)(`div`,{className:`text-sm font-semibold`,children:`Encodings`})}),t[14]=v):v=t[14];let y;t[15]===l?y=t[16]:(y=bu.map(l),t[15]=l,t[16]=y);let b;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(`div`,{children:`Mark`}),t[17]=b):b=t[17];let C;t[18]===h?C=t[19]:(C=(0,$.jsxs)(`span`,{className:`col-span-2 text-sm font-semibold w-full border-t border-divider flex items-center justify-between pt-2 pr-[30px]`,children:[b,h]}),t[18]=h,t[19]=C);let w;t[20]===l?w=t[21]:(w=xu.map(l),t[20]=l,t[21]=w);let T;return t[22]!==C||t[23]!==w||t[24]!==y?(T=(0,$.jsxs)(`div`,{className:`grid gap-x-2 gap-y-4 justify-items-start py-3 pl-4 pr-2 bg-(--slate-1) border rounded items-center grid-template-columns-[repeat(2,_minmax(0,_min-content))] self-start`,children:[v,y,C,w]}),t[22]=C,t[23]=w,t[24]=y,t[25]=T):T=t[25],T},Cu=e=>{let t=(0,be.c)(43),{label:n,schema:r,fieldDefinition:i,disabled:a,onChange:o}=e,s;t[0]!==i||t[1]!==r?(s=()=>{if(!i)return`--`;if(i.field===`*`)return(0,$.jsxs)(`span`,{className:`flex gap-2 flex-1`,children:[Al[X.NUMBER],(0,$.jsx)(`span`,{className:`text-left flex-1`,children:`Count`})]});let e=i.field.toString();return(0,$.jsxs)(`span`,{className:`flex gap-2 flex-1`,children:[Al[r.primitiveType(e)],(0,$.jsx)(`span`,{className:`text-left flex-1`,children:i.fn?`${i.fn}(${i.field})`:e})]})},t[0]=i,t[1]=r,t[2]=s):s=t[2];let c=s,l;t[3]===o?l=t[4]:(l=()=>{o(void 0)},t[3]=o,t[4]=l);let u=l,d;t[5]===i?.field?d=t[6]:(d=i?.field.toString()??``,t[5]=i?.field,t[6]=d);let f=d,p;t[7]===n?p=t[8]:(p=(0,$.jsx)(v,{className:`text-(--slate-11) font-semibold`,children:n}),t[7]=n,t[8]=p);let m;t[9]!==o||t[10]!==r?(m=e=>{o(e===`*`?{field:`*`,fn:`count`,type:`quantitative`}:{field:e,type:r.vlType(e)})},t[9]=o,t[10]=r,t[11]=m):m=t[11];let h=f?u:void 0,g;t[12]===c?g=t[13]:(g=c(),t[12]=c,t[13]=g);let _;t[14]!==h||t[15]!==g?(_=(0,$.jsx)(te,{className:`min-w-[140px] lg:min-w-[210px] h-full`,onClear:h,children:g}),t[14]=h,t[15]=g,t[16]=_):_=t[16];let C;t[17]===r?C=t[18]:(C=r.fieldNames().map(e=>(0,$.jsx)(y,{value:e.toString(),children:(0,$.jsxs)(`span`,{className:`flex items-center gap-2 flex-1`,children:[Al[r.primitiveType(e)],(0,$.jsx)(`span`,{className:`flex-1`,children:e}),(0,$.jsxs)(`span`,{className:`text-muted-foreground text-xs font-semibold`,children:[`(`,r.vlType(e),`)`]})]})},e)),t[17]=r,t[18]=C);let w;t[19]===r?w=t[20]:(w=r.fieldNames().length===0&&(0,$.jsx)(y,{disabled:!0,value:`--`,children:`No columns`}),t[19]=r,t[20]=w);let T;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(b,{}),t[21]=T):T=t[21];let ne;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,$.jsx)(y,{value:`*`,children:(0,$.jsxs)(`span`,{className:`flex items-center gap-1 flex-1`,children:[Al[X.NUMBER],(0,$.jsx)(`span`,{className:`flex-1`,children:`Count`})]})},`*`),t[22]=ne):ne=t[22];let E;t[23]!==w||t[24]!==C?(E=(0,$.jsx)(ee,{children:(0,$.jsxs)(x,{children:[C,w,T,ne]})}),t[23]=w,t[24]=C,t[25]=E):E=t[25];let D;t[26]!==a||t[27]!==f||t[28]!==E||t[29]!==m||t[30]!==_?(D=(0,$.jsxs)(S,{value:f,disabled:a,onValueChange:m,children:[_,E]}),t[26]=a,t[27]=f,t[28]=E,t[29]=m,t[30]=_,t[31]=D):D=t[31];let O;t[32]!==i||t[33]!==o?(O=i&&(0,$.jsx)(Tu,{field:i,onChange:o}),t[32]=i,t[33]=o,t[34]=O):O=t[34];let k;t[35]===O?k=t[36]:(k=(0,$.jsx)(`div`,{className:`w-[26px]`,children:O}),t[35]=O,t[36]=k);let A;t[37]!==D||t[38]!==k?(A=(0,$.jsxs)(`div`,{className:`flex flex-row gap-1 h-[26px]`,children:[D,k]}),t[37]=D,t[38]=k,t[39]=A):A=t[39];let re;return t[40]!==A||t[41]!==p?(re=(0,$.jsxs)($.Fragment,{children:[p,A]}),t[40]=A,t[41]=p,t[42]=re):re=t[42],re},wu=`__`,Tu=e=>{let t=(0,be.c)(10),{field:n,onChange:r}=e;if(n.field===`*`)return null;let i;if(t[0]!==n||t[1]!==r){i=Symbol.for(`react.early_return_sentinel`);bb0:{let e=[];if(n.type===Ra.QUANTITATIVE&&(e=[[``,Bl]]),n.type===Ra.TEMPORAL&&(e=[[`Single`,Vl],[`Multi`,Hl]]),e.length>0){let a=e=>{r({...n,fn:e===wu?void 0:e})},o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(te,{className:`h-full px-1`,hideChevron:!0,variant:`ghost`,children:(0,$.jsx)(se,{size:14,strokeWidth:1.5})}),t[3]=o):o=t[3];let s,c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(x,{children:(0,$.jsx)(y,{value:wu,children:`None`})}),c=(0,$.jsx)(b,{}),t[4]=s,t[5]=c):(s=t[4],c=t[5]);let l=(0,$.jsxs)(ee,{children:[s,c,e.map(Ou)]}),u;t[6]!==n.fn||t[7]!==a||t[8]!==l?(u=(0,$.jsxs)(S,{"data-testid":`marimo-plugin-data-explorer-field-options`,value:n.fn,onValueChange:a,children:[o,l]}),t[6]=n.fn,t[7]=a,t[8]=l,t[9]=u):u=t[9],i=u;break bb0}}t[0]=n,t[1]=r,t[2]=i}else i=t[2];return i===Symbol.for(`react.early_return_sentinel`)?null:i};function Eu(e){return(0,$.jsx)(y,{value:e,children:e===`?`?`auto`:e},e)}function Du(e){return(0,$.jsx)(y,{value:e??wu,children:ne.startCase(e)},e)}function Ou(e){let[t,n]=e;return(0,$.jsxs)(x,{children:[t&&(0,$.jsx)(g,{children:t}),n.map(Du)]},t)}var ku=e=>{let t=(0,be.c)(5),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=s(),t[0]=n):n=t[0];let r=n,i;t[1]===e?i=t[2]:(i=()=>{let t=r.sub(gu,()=>{let{schema:t,...n}=r.get(gu);e.setValue(n)}),n=e.value;return n&&Object.keys(n).length>0&&r.set(gu,n),t},t[1]=e,t[2]=i),ie(i);let a;return t[3]===e?a=t[4]:(a=(0,$.jsx)(c,{store:r,children:(0,$.jsx)(ju,{...e})}),t[3]=e,t[4]=a),a};function Au(e){return{padding:{left:20,right:20,top:20,bottom:20},actions:{export:{svg:!0,png:!0},source:!1,compiled:!1,editor:!1},theme:e===`dark`?`dark`:void 0,tooltip:pe.call,renderer:`canvas`}}var ju=e=>{let t=(0,be.c)(43),{data:n}=e,r=vu(),i;t[0]!==r||t[1]!==n?(i=async()=>{if(!n)return{};let e=await fe(n,{type:`csv`,parse:`auto`},{replacePeriod:!0}),t=nc(e);return r.setSchema(t),{chartData:e,schema:t}},t[0]=r,t[1]=n,t[2]=i):i=t[2];let a;t[3]===n?a=t[4]:(a=[n],t[3]=n,t[4]=a);let{data:s,isPending:c,error:l}=de(i,a),{mark:u}=o(gu),d=o(yu),{theme:p}=le();if(l){let e;return t[5]===l?e=t[6]:(e=(0,$.jsx)(ge,{error:l}),t[5]=l,t[6]=e),e}if(!s){let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`div`,{}),t[7]=e):e=t[7],e}let{chartData:h,schema:g}=s;if(c||!g){let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`div`,{}),t[8]=e):e=t[8],e}let _=d.main?.plots?.[0],v;t[9]===_?.fieldInfos?v=t[10]:(v=new Set(_?.fieldInfos.map(Fu)),t[9]=_?.fieldInfos,t[10]=v);let y=v,ee;t[11]!==h||t[12]!==_||t[13]!==g||t[14]!==p?(ee=()=>{if(!_)return(0,$.jsx)(Ml,{schema:g});let e=_.spec,t=Pu(e),n=D(t,h);return(0,$.jsx)(`div`,{className:m(`flex overflow-y-auto justify-center items-center flex-1 w-[90%]`),children:(0,$.jsx)(he,{"data-container-width":_e(n),spec:n,options:Au(p)})})},t[11]=h,t[12]=_,t[13]=g,t[14]=p,t[15]=ee):ee=t[15];let b=ee,x;t[16]!==u||t[17]!==g?(x=(0,$.jsx)(Su,{mark:u,schema:g}),t[16]=u,t[17]=g,t[18]=x):x=t[18];let te;t[19]===b?te=t[20]:(te=b(),t[19]=b,t[20]=te);let S;t[21]!==x||t[22]!==te?(S=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[x,te]}),t[21]=x,t[22]=te,t[23]=S):S=t[23];let T=d.histograms?.plots,ne=d.addCategoricalField?.plots,E=d.addQuantitativeField?.plots,O=d.addTemporalField?.plots,k;if(t[24]!==r||t[25]!==h||t[26]!==y||t[27]!==E||t[28]!==O||t[29]!==T||t[30]!==ne||t[31]!==p){let e;t[33]!==r||t[34]!==h||t[35]!==y||t[36]!==p?(e=(e,t)=>(0,$.jsx)(Nu,{title:(0,$.jsx)(`div`,{className:`flex flex-row gap-1`,children:e.fieldInfos.map(e=>{let t=e.fieldDef.field===`*`?`Count`:e.fieldDef.fn?`${e.fieldDef.fn}(${e.fieldDef.field})`:e.fieldDef.field.toString();return(0,$.jsx)(ce,{variant:y.has(e.fieldDef.field)?`secondary`:`defaultOutline`,children:t},t)})}),actions:(0,$.jsx)(C,{content:`Make main plot`,children:(0,$.jsx)(w,{"data-testid":`marimo-plugin-data-explorer-make-main-plot`,variant:`text`,size:`icon`,onClick:()=>{let t=f.fromEntries(e.fieldInfos.map(Iu));r.setEncoding(t)},children:(0,$.jsx)(ae,{className:`w-4 h-4`})})}),children:(0,$.jsx)(he,{options:Au(p),spec:D(e.spec,h)},t)},t),t[33]=r,t[34]=h,t[35]=y,t[36]=p,t[37]=e):e=t[37],k=[T,ne,E,O].filter(Boolean).flat().map(e),t[24]=r,t[25]=h,t[26]=y,t[27]=E,t[28]=O,t[29]=T,t[30]=ne,t[31]=p,t[32]=k}else k=t[32];let A;t[38]===k?A=t[39]:(A=(0,$.jsx)(Mu,{children:k}),t[38]=k,t[39]=A);let re;return t[40]!==A||t[41]!==S?(re=(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[S,A]}),t[40]=A,t[41]=S,t[42]=re):re=t[42],re},Mu=e=>{let t=(0,be.c)(2),{children:n}=e;if(kl.Children.count(n)===0)return null;let r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`div`,{className:`flex flex-row overflow-x-auto overflow-y-hidden gap-4 snap-x pb-4`,children:n}),t[0]=n,t[1]=r),r},Nu=e=>{let t=(0,be.c)(10),{title:n,children:r,actions:i}=e,a;t[0]===n?a=t[1]:(a=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:n}),t[0]=n,t[1]=a);let o;t[2]!==i||t[3]!==a?(o=(0,$.jsxs)(`div`,{className:`flex flex-row justify-between items-center bg-(--slate-3) py-0.5 px-2`,children:[a,i]}),t[2]=i,t[3]=a,t[4]=o):o=t[4];let s;t[5]===r?s=t[6]:(s=(0,$.jsx)(`div`,{className:`px-6 pt-2 max-h-[280px] overflow-y-auto`,children:r}),t[5]=r,t[6]=s);let c;return t[7]!==o||t[8]!==s?(c=(0,$.jsxs)(`div`,{className:`shrink-0 bg-card shadow-md border overflow-hidden rounded snap-start`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c};function Pu(e){return e.encoding?.row||e.encoding?.column||(e.width=`container`),e}function Fu(e){return e.fieldDef.field}function Iu(e){return[e.channel,e.fieldDef]}export{ju as DataExplorerComponent,ku as default};
|