@marimo-team/frontend 0.24.1-dev42 → 0.24.1-dev44
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-CfNQG_fZ.js → CellStatus-B6CWKORY.js} +1 -1
- package/dist/assets/ConnectedDataExplorerComponent-DZnvpjue.js +1 -0
- package/dist/assets/JsonOutput-BI2qFHVr.js +50 -0
- package/dist/assets/MarimoErrorOutput-BXh29HCp.js +6 -0
- package/dist/assets/RenderHTML-COTZYPO7.js +1 -0
- package/dist/assets/RunButton-DTUzITFm.js +1 -0
- package/dist/assets/VisuallyHidden-DurJ_JBW.js +1 -0
- package/dist/assets/{add-cell-with-ai-CGBEoX6T.js → add-cell-with-ai-B0RdHenk.js} +19 -19
- package/dist/assets/add-connection-dialog-CcnJ2LkX.js +166 -0
- package/dist/assets/agent-panel-PB0I1dIC.js +286 -0
- package/dist/assets/ai-model-dropdown-DjQy2bo-.js +3 -0
- package/dist/assets/app-config-button-COFLeJCU.js +1 -0
- package/dist/assets/{blob-ChElOQvm.js → blob-BBiZd3vX.js} +1 -1
- package/dist/assets/{cache-panel-CLfGxru6.js → cache-panel-MAXVmKkG.js} +1 -1
- package/dist/assets/cell-editor-5wcJHF0s.js +24 -0
- package/dist/assets/cell-link-BbAJokoX.js +1 -0
- package/dist/assets/cells-B1S_6FG3.js +227 -0
- package/dist/assets/chat-display-ClG9MRI_.js +1 -0
- package/dist/assets/chat-panel-BRoqCSCR.js +4 -0
- package/dist/assets/chat-ui-CNvkb287.js +4 -0
- package/dist/assets/circle--ysFeW9z.js +1 -0
- package/dist/assets/column-preview-D6cIOnWQ.js +1 -0
- package/dist/assets/command-palette-DtZy0Am-.js +1 -0
- package/dist/assets/common-BGLbVHCS.js +1 -0
- package/dist/assets/components-BAvTsivu.js +1 -0
- package/dist/assets/config-DcB2swfZ.js +1 -0
- package/dist/assets/context-Do8M9TDF.js +1 -0
- package/dist/assets/{datasource-C0_eJO-0.js → datasource-BrSYgi6C.js} +2 -2
- package/dist/assets/dependency-graph-panel-C13q-nga.js +5 -0
- package/dist/assets/{documentation-panel-CxjnCPq6.js → documentation-panel-CtQqNEQw.js} +1 -1
- package/dist/assets/{download-CxzOE8FX.js → download-CIdXYNHv.js} +1 -1
- package/dist/assets/dropdown-menu-CqNabM1f.js +1 -0
- package/dist/assets/edit-page-jAyDC21z.js +9 -0
- package/dist/assets/{error-entries-DCRQWi_N.js → error-entries-DEjvzkum.js} +1 -1
- package/dist/assets/{error-panel-Bx5cPw6N.js → error-panel-BvrDwUv8.js} +1 -1
- package/dist/assets/file-explorer-panel-DYujxxK-.js +1 -0
- package/dist/assets/{file-icons-DxXY84Jn.js → file-icons-Bo1Ewf1W.js} +1 -1
- package/dist/assets/file-name-input-BDGq0-ac.js +3 -0
- package/dist/assets/{floating-outline-gjfcwmyU.js → floating-outline-CNsG18LK.js} +1 -1
- package/dist/assets/{gallery-page-BI3aTl8u.js → gallery-page-4dZlIWMe.js} +1 -1
- package/dist/assets/{glide-data-editor-CrWGp7DP.js → glide-data-editor-BQNVc0zc.js} +2 -2
- package/dist/assets/home-page-CFAldshJ.js +4 -0
- package/dist/assets/html-to-image-DMn_7CCA.js +2 -0
- package/dist/assets/index-0VrRpta0.css +2 -0
- package/dist/assets/index-BBPHmHdW.js +29 -0
- package/dist/assets/input-DeyycFtq.js +7 -0
- package/dist/assets/{layout-BQjGHHu-.js → layout-Ddsz1eHh.js} +5 -5
- package/dist/assets/{logs-panel-D1RUMXL1.js → logs-panel-BSD1GETR.js} +1 -1
- package/dist/assets/markdown-renderer-DIXiKP4m.js +2 -0
- package/dist/assets/{mermaid-DtNubw9S.js → mermaid-CwvTqKGz.js} +2 -2
- package/dist/assets/{name-cell-input-DSKoNRk3.js → name-cell-input-zqypwqoZ.js} +1 -1
- package/dist/assets/{outline-panel-UIygpaO3.js → outline-panel-C5GAyqII.js} +1 -1
- package/dist/assets/packages-panel-CYLyGihe.js +1 -0
- package/dist/assets/{pair-with-agent-modal-Pl5cv7Gv.js → pair-with-agent-modal-CBIL9_6g.js} +2 -2
- package/dist/assets/panel-accordion-state-DmV3OgfX.js +1 -0
- package/dist/assets/panels-D53vWR00.js +4 -0
- package/dist/assets/{process-output-BWDSbk5d.js → process-output-DNhz9LLW.js} +1 -1
- package/dist/assets/{readonly-code-display-Bbnq-khe.js → readonly-code-display-CKT-gv1m.js} +1 -1
- package/dist/assets/readonly-python-code-De0vvuWh.js +1 -0
- package/dist/assets/{renderShortcut-Dj3NbkoC.js → renderShortcut-D9XYVNe3.js} +1 -1
- package/dist/assets/{reveal-component-Bgmfon3f.js → reveal-component-C0L5MU2W.js} +4 -4
- package/dist/assets/run-page-DXZapRtY.js +1 -0
- package/dist/assets/scratchpad-panel-ja6doGoa.js +1 -0
- package/dist/assets/secrets-panel-B7Rcwc2I.js +1 -0
- package/dist/assets/select-BUEX2Vfl.js +1 -0
- package/dist/assets/session-panel-ftyqfsYy.js +1 -0
- package/dist/assets/{skeleton-DGs-LrlZ.js → skeleton-CxFczTPo.js} +1 -1
- package/dist/assets/snippets-panel-BZ254lxN.js +1 -0
- package/dist/assets/{state-WVnIPIsw.js → state-MlBpc9qi.js} +3 -3
- package/dist/assets/{state-N_csMEH1.js → state-llVv0lIh.js} +1 -1
- package/dist/assets/switch-CBR-ykv3.js +1 -0
- package/dist/assets/tabs-c6mpccpH.js +1 -0
- package/dist/assets/{terminal-aLrVlOf6.js → terminal-OC_FnEas.js} +3 -3
- package/dist/assets/tracing-C0FGWieO.js +1 -0
- package/dist/assets/tracing-panel-LeIOi1Tv.js +2 -0
- package/dist/assets/{tree-actions-Ctf5W0DR.js → tree-actions-CrWpuExP.js} +1 -1
- package/dist/assets/useAddCell-DIdbaU70.js +1 -0
- package/dist/assets/useCellActionButton-DXyUqFdJ.js +1 -0
- package/dist/assets/{useDateFormatter-CfPcCT-J.js → useDateFormatter-BiqAQ-zI.js} +1 -1
- package/dist/assets/{useDeleteCell-6wcjnAMK.js → useDeleteCell-CSCMg7Up.js} +1 -1
- package/dist/assets/useDependencyPanelTab-Bt7aBDpS.js +1 -0
- package/dist/assets/useNotebookActions-ClT4GmnB.js +10 -0
- package/dist/assets/useNumberFormatter-DHJ9s6Vk.js +1 -0
- package/dist/assets/useRunCells-DHnbXALT.js +1 -0
- package/dist/assets/{useSplitCell-oIRu7Qlj.js → useSplitCell-CxlsGCB_.js} +1 -1
- package/dist/assets/{vega-component-D4OKyVdb.js → vega-component-CzgE5HEs.js} +1 -1
- package/dist/assets/write-secret-modal-BG_B6y1P.js +2 -0
- package/dist/index.html +57 -71
- package/package.json +1 -1
- package/src/components/datasources/datasources.tsx +16 -17
- package/src/components/editor/actions/useNotebookActions.tsx +50 -0
- package/src/components/editor/chrome/panels/components.tsx +1 -1
- package/src/components/editor/connections/__tests__/add-connection-button.test.tsx +129 -0
- package/src/components/editor/connections/add-connection-button.tsx +132 -0
- package/src/components/editor/connections/components.tsx +11 -0
- package/src/components/editor/connections/quick-add-data-sources.tsx +11 -11
- package/src/components/editor/controls/__tests__/notebook-menu-dropdown.test.tsx +109 -1
- package/src/components/storage/storage-inspector.tsx +15 -17
- package/src/core/codemirror/language/panel/sql.test.tsx +69 -0
- package/src/core/codemirror/language/panel/sql.tsx +81 -4
- package/dist/assets/ConnectedDataExplorerComponent-88Ojqyhx.js +0 -1
- package/dist/assets/DeferredRequestRegistry-C-SpvRCH.js +0 -1
- package/dist/assets/ImperativeModal-68zj0lxy.js +0 -1
- package/dist/assets/JsonOutput-pCdkYz4X.js +0 -50
- package/dist/assets/MarimoErrorOutput-b7bFhjgD.js +0 -6
- package/dist/assets/RSPContexts-D2JcYZo2.js +0 -1
- package/dist/assets/RenderHTML-BUuDW4yZ.js +0 -1
- package/dist/assets/RunButton-4MKgVYXU.js +0 -1
- package/dist/assets/SSRProvider-C_WMmqnS.js +0 -1
- package/dist/assets/add-connection-dialog-BcLKuMHt.js +0 -166
- package/dist/assets/agent-panel-BVyaNGyG.js +0 -286
- package/dist/assets/ai-model-dropdown-C_IoSmhR.js +0 -3
- package/dist/assets/app-config-button-BvpunAmJ.js +0 -1
- package/dist/assets/cell-editor-pKuytlrm.js +0 -24
- package/dist/assets/cell-link-D9d1y67_.js +0 -1
- package/dist/assets/cells-BdoPd1mK.js +0 -226
- package/dist/assets/chat-display-CbsB82vm.js +0 -1
- package/dist/assets/chat-panel-DCPKH1gP.js +0 -4
- package/dist/assets/chat-ui-BwLG6iSS.js +0 -4
- package/dist/assets/circle-plus-cm-FRu9O.js +0 -1
- package/dist/assets/column-preview-fku2dKeP.js +0 -1
- package/dist/assets/command-Cvmdzx0n.js +0 -1
- package/dist/assets/command-palette-BJFR8wKv.js +0 -1
- package/dist/assets/common-CQ9OqrFS.js +0 -1
- package/dist/assets/components-CaOG3LOY.js +0 -1
- package/dist/assets/config-xlrIxOZJ.js +0 -1
- package/dist/assets/context-Bf2wPdef.js +0 -1
- package/dist/assets/data-source-discovery-BsrDlL04.js +0 -1
- package/dist/assets/dependency-graph-panel-CxZJ5e7D.js +0 -5
- package/dist/assets/dialog-EjSc4yoH.js +0 -1
- package/dist/assets/dropdown-menu-BpI5klSq.js +0 -1
- package/dist/assets/edit-page-DwKN7vIP.js +0 -9
- package/dist/assets/field-YoG_gQAY.js +0 -1
- package/dist/assets/file-explorer-panel-CRrPqu3s.js +0 -1
- package/dist/assets/file-name-input-uFNWUWCc.js +0 -3
- package/dist/assets/focus-DgNLvj0o.js +0 -1
- package/dist/assets/form-CD2uATFu.js +0 -2
- package/dist/assets/form-GIq5QCAI.js +0 -1
- package/dist/assets/home-page-CYg3rQCB.js +0 -4
- package/dist/assets/html-to-image-Bt7Ld74W.js +0 -2
- package/dist/assets/index-CrsPwq0f.js +0 -29
- package/dist/assets/index-H2TMW127.css +0 -2
- package/dist/assets/input-BuOxQ3Wy.js +0 -1
- package/dist/assets/label-B67m1YH7.js +0 -1
- package/dist/assets/links-C7oaxPJK.js +0 -1
- package/dist/assets/markdown-renderer-C8IbrNw3.js +0 -2
- package/dist/assets/packages-panel-CIwyYf45.js +0 -1
- package/dist/assets/panel-accordion-state-DAAi8MPY.js +0 -1
- package/dist/assets/panels-DcguQKjE.js +0 -4
- package/dist/assets/popover-CgOo22ko.js +0 -1
- package/dist/assets/radio-group-DZoEgN7k.js +0 -1
- package/dist/assets/readonly-python-code-CyfabMFb.js +0 -1
- package/dist/assets/refresh-ccw-DrVG5f2L.js +0 -1
- package/dist/assets/request-registry-mNu7sXOU.js +0 -1
- package/dist/assets/run-page-Buh6gERG.js +0 -1
- package/dist/assets/scratchpad-panel-soCf5igY.js +0 -1
- package/dist/assets/secrets-panel-CCb8F6PC.js +0 -1
- package/dist/assets/select-DwqnFsyg.js +0 -1
- package/dist/assets/session-panel-BO4lOJc-.js +0 -1
- package/dist/assets/snippets-panel-CulFiQ0V.js +0 -1
- package/dist/assets/sparkles-30wHhAF5.js +0 -1
- package/dist/assets/state-B-K0k6lb.js +0 -1
- package/dist/assets/switch-VzdUoXkf.js +0 -1
- package/dist/assets/textarea-mD3C73jw.js +0 -1
- package/dist/assets/tracing-B_Qlv38-.js +0 -1
- package/dist/assets/tracing-panel--KVMPYqh.js +0 -2
- package/dist/assets/useCellActionButton-BDVM-sW-.js +0 -1
- package/dist/assets/useDependencyPanelTab-D4TnSeLa.js +0 -1
- package/dist/assets/useNotebookActions-gEpi1TfO.js +0 -10
- package/dist/assets/useNumberFormatter-BmUQe2Pf.js +0 -1
- package/dist/assets/usePress-CwOqeEX3.js +0 -7
- package/dist/assets/useRunCells-DP6cAHq0.js +0 -1
- package/dist/assets/write-secret-modal-dplU5PG8.js +0 -2
- package/dist/assets/x-BgkoSHM-.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
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 _,i as v,n as y,o as b,r as ee,s as x,t as te}from"./select-DwqnFsyg.js";import{t as S}from"./label-B67m1YH7.js";import{t as C}from"./tooltip-D7dq6bnc.js";import{t as w}from"./button-BMBznEru.js";import{t as T}from"./createReducer-Bq-nQJiK.js";import{t as E}from"./strings-CpYReX2Q.js";import{t as D}from"./createLucideIcon-B7HeEoG2.js";import{t as O}from"./spec-CUFquO6R.js";import{a as k,i as A,o as j,r as ne,t as re}from"./useLifecycle-BUaJcygz.js";import{n as ie}from"./table-CUK1W5bI.js";import{t as ae}from"./square-function-DkZweMAs.js";import{t as oe}from"./badge-D_-uqy2N.js";import{r as se}from"./useTheme-BRnykVDX.js";import{t as ce}from"./useDateFormatter-CfPcCT-J.js";import{t as le}from"./useNumberFormatter-BmUQe2Pf.js";import{r as ue,t as de}from"./tooltip-Cwltdez8.js";import{i as fe,n as pe}from"./react-vega-C3-Qk46W.js";import{n as me}from"./error-banner-B3KYUlCX.js";import{t as he}from"./utils-49LGK4zG.js";import{n as ge}from"./useAsyncData-Buhk-UgR.js";var _e=D(`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`}]]),ve=D(`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`}]]),ye=u();function be(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 xe=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 b=Object.getOwnPropertySymbols(a),v=0;v<b.length;v++){var ee=b[v],x=Object.getOwnPropertyDescriptor(a,ee);x&&!x.enumerable&&!u||(h[ee]=m(a[ee],s-1),x.enumerable||Object.defineProperty(h,ee,{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)})),Se=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}})),Ce=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)}}));xe(),Se();var we=e(Ce());function Te(e,t,n){return e.fields=t||[],e.fname=n,e}function Ee(e){throw Error(e)}function De(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||Ee(`Access path missing open bracket: `+e),r>0&&l(),r=0,o=s+1);return r&&Ee(`Access path missing closing bracket: `+e),n&&Ee(`Access path missing closing quote: `+e),s>o&&(s++,l()),t}var Oe=Array.isArray;function ke(e){return e===Object(e)}function Ae(e){return typeof e==`string`}function je(e){return Oe(e)?`[`+e.map(je)+`]`:ke(e)||Ae(e)?JSON.stringify(e).replace(`\u2028`,`\\u2028`).replace(`\u2029`,`\\u2029`):e}function Me(e,t){var n=De(e),r=`return _[`+n.map(je).join(`][`)+`];`;return Te(Function(`_`,r),[e=n.length===1?n[0]:e],t||e)}var Ne=[];Me(`id`),Te(function(e){return e},Ne,`identity`),Te(function(){return 0},Ne,`zero`),Te(function(){return 1},Ne,`one`),Te(function(){return!0},Ne,`true`),Te(function(){return!1},Ne,`false`);function Pe(e,t,n){var r=[t].concat([].slice.call(n));console[e](...r)}function Fe(e,t){var n=e||0;return{level:function(e){return arguments.length?(n=+e,this):n},error:function(){return n>=1&&Pe(t||`error`,`ERROR`,arguments),this},warn:function(){return n>=2&&Pe(t||`warn`,`WARN`,arguments),this},info:function(){return n>=3&&Pe(t||`log`,`INFO`,arguments),this},debug:function(){return n>=4&&Pe(t||`log`,`DEBUG`,arguments),this}}}function Ie(e){return typeof e==`boolean`}function Le(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,we.default)(e)).join(`,`)})`};var M=we.default;function N(e,t){return e.indexOf(t)>-1}function Re(e,t){let n=0;for(let[r,i]of e.entries())if(t(i,r,n++))return!0;return!1}var P=Object.keys;function ze(e){let t=e.replace(/\W/g,`_`);return(e.match(/^\d+/)?`_`:``)+t}function Be(e,t=`datum`){return`${t}[${je(De(e).join(`.`))}]`}function Ve(e){return`${De(e).map(e=>e.replace(`.`,`\\.`)).join(`\\.`)}`}function He(...e){for(let t of e)if(t!==void 0)return t}function Ue(e){return We(e)?e:`__${e}`}function We(e){return e.indexOf(`__`)===0}var Ge=`column`,Ke=`facet`,qe=`latitude`,Je=`longitude`,Ye=`latitude2`,Xe=`longitude2`,Ze=`color`,Qe=`fill`,$e=`stroke`,et=`shape`,tt=`size`,nt=`opacity`,rt=`fillOpacity`,it=`strokeOpacity`,at=`strokeWidth`,ot=`text`,st=`order`,ct=`detail`,lt=`tooltip`,ut=`href`,dt={x:1,y:1,x2:1,y2:1},ft={longitude:1,longitude2:1,latitude:1,latitude2:1};P(ft);var pt=Object.assign({},dt,ft,{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 mt(e){return e===`color`||e===`fill`||e===`stroke`}var ht={row:1,column:1,facet:1};P(ht);var gt=Object.assign({},pt,ht),_t=P(gt),{order:vt,detail:yt}=gt,bt=be(gt,[`order`,`detail`]),{order:xt,detail:St,row:Ct,column:wt,facet:Tt}=gt,Et=be(gt,[`order`,`detail`,`row`,`column`,`facet`]);P(bt),P(Et),P(pt);var{x:Dt,y:Ot,x2:kt,y2:At,latitude:jt,longitude:Mt,latitude2:Nt,longitude2:Pt}=pt,Ft=be(pt,[`x`,`y`,`x2`,`y2`,`latitude`,`longitude`,`latitude2`,`longitude2`]),It=P(Ft),Lt={x:1,y:1};P(Lt);var{text:Rt,tooltip:zt,href:Bt,detail:Vt,key:Ht,order:Ut}=Ft,Wt=be(Ft,[`text`,`tooltip`,`href`,`detail`,`key`,`order`]);P(Wt);var Gt=Object.assign({},Lt,Wt);P(Gt);function Kt(e){return!!Gt[e]}function qt(e,t){return Zt(e)[t]}var Jt={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:Yt}=Jt,Xt=be(Jt,[`geoshape`]);function Zt(e){switch(e){case Ze:case Qe:case $e:case ct:case`key`:case lt:case ut:case st:case nt:case rt:case it:case at:case Ke:case`row`:case Ge:return Jt;case`x`:case`y`:case qe:case Je:return Xt;case`x2`:case`y2`:case Ye:case Xe:return{rule:`always`,bar:`always`,rect:`always`,area:`always`,circle:`binned`,point:`binned`,square:`binned`,tick:`binned`,line:`binned`,trail:`binned`};case tt:return{point:`always`,tick:`always`,rule:`always`,circle:`always`,square:`always`,bar:`always`,text:`always`,line:`always`,trail:`always`};case et:return{point:`always`,geoshape:`always`};case ot:return{text:`always`}}}function Qt(e){switch(e){case`x`:case`y`:case tt:case at:case nt:case rt:case it:case`x2`:case`y2`:return;case Ke:case`row`:case Ge:case et:case ot:case lt:case ut:return`discrete`;case Ze:case Qe:case $e:return`flexible`;case qe:case Je:case Ye:case Xe:case ct:case`key`:case st:return}throw Error(`rangeType not implemented for `+e)}var $t={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},en=Object.assign({},$t,{encoding:1});P(Object.assign({gridScale:1,scale:1},$t,{encode:1}));var tn=P(en),nn={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},rn=Object.assign({},nn,{opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,encode:1}),an=P(nn);P(rn);var on=r({BAR_WITH_POINT_SCALE_AND_RANGESTEP_NULL:()=>Vn,CANNOT_FIX_RANGE_STEP_WITH_FIT:()=>ln,CANNOT_UNION_CUSTOM_DOMAIN_WITH_FIELD_DOMAIN:()=>Wn,CONCAT_CANNOT_SHARE_AXIS:()=>vn,FIT_NON_SINGLE:()=>cn,INVALID_CHANNEL_FOR_AXIS:()=>sr,INVALID_SPEC:()=>sn,LINE_WITH_VARYING_SIZE:()=>Fn,MORE_THAN_ONE_SORT:()=>or,NO_FIELDS_NEEDS_AS:()=>Cn,NO_INIT_SCALE_BINDINGS:()=>hn,REPEAT_CANNOT_SHARE_AXIS:()=>yn,SCALE_BINDINGS_CONTINUOUS:()=>mn,UNABLE_TO_MERGE_DOMAINS:()=>ar,cannotApplySizeToNonOrientedMark:()=>Yn,cannotProjectOnChannelWithoutField:()=>un,cannotStackNonLinearScale:()=>lr,cannotStackRangedMark:()=>cr,cannotUseScalePropertyWithNonColor:()=>Gn,channelRequiredForBinned:()=>yr,columnsNotSupportByRowCol:()=>_n,dayReplacedWithDate:()=>fr,differentParse:()=>xn,discreteChannelCannotEncode:()=>Bn,domainRequiredForThresholdScale:()=>br,domainSortDropped:()=>ir,droppedDay:()=>pr,droppingColor:()=>Mn,emptyFieldDef:()=>Nn,encodingOverridden:()=>wn,errorBand1DNotSupport:()=>vr,errorBarCenterAndExtentAreNotNeeded:()=>mr,errorBarCenterIsNotNeeded:()=>_r,errorBarCenterIsUsedWithWrongExtent:()=>hr,errorBarContinuousAxisHasCustomizedAggregate:()=>gr,facetChannelDropped:()=>zn,facetChannelShouldBeDiscrete:()=>Rn,incompatibleChannel:()=>In,independentScaleMeansIndependentGuide:()=>rr,invalidAggregate:()=>An,invalidEncodingChannel:()=>Ln,invalidFieldType:()=>Dn,invalidFieldTypeForCountAggregate:()=>kn,invalidTimeUnit:()=>dr,invalidTransformIgnored:()=>Sn,latLongDeprecated:()=>Pn,lineWithRange:()=>Hn,mergeConflictingDomainProperty:()=>nr,mergeConflictingProperty:()=>tr,missingFieldType:()=>jn,nearestNotSupportForContinuous:()=>dn,noSuchRepeatedValue:()=>gn,nonZeroScaleUsedWithLengthMark:()=>On,orientOverridden:()=>Un,primitiveChannelDef:()=>En,projectionOverridden:()=>Tn,rangeStepDropped:()=>Xn,scalePropertyNotWorkWithScaleType:()=>$n,scaleTypeNotWorkWithChannel:()=>Zn,scaleTypeNotWorkWithFieldDef:()=>Qn,scaleTypeNotWorkWithMark:()=>er,selectionNotFound:()=>pn,selectionNotSupported:()=>fn,stackNonSummativeAggregate:()=>ur,unaggregateDomainHasNoEffectForRawField:()=>Kn,unaggregateDomainWithNonSharedDomainOp:()=>qn,unaggregatedDomainWithLogScale:()=>Jn,unrecognizedParse:()=>bn}),sn=`Invalid spec`,cn=`Autosize "fit" only works for single views and layered views.`,ln=`Cannot use a fixed value of "rangeStep" when "autosize" is "fit".`;function un(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`}function dn(e){return`The "nearest" transform is not supported for ${e} marks.`}function fn(e){return`Selection not supported for ${e} yet`}function pn(e){return`Cannot find a selection named "${e}"`}var mn=`Scale bindings are currently only supported for scales with unbinned, continuous domains.`,hn=`Selections bound to scales cannot be separately initialized.`;function gn(e){return`Unknown repeated value "${e}".`}function _n(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`}var vn=`Axes cannot be shared in concatenated views yet (https://github.com/vega/vega-lite/issues/2415).`,yn=`Axes cannot be shared in repeated views yet (https://github.com/vega/vega-lite/issues/2415).`;function bn(e){return`Unrecognized parse "${e}".`}function xn(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`}function Sn(e){return`Ignoring an invalid transform: ${M(e)}.`}var Cn=`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 wn(e){return`Layer's shared ${e.join(`,`)} channel ${e.length===1?`is`:`are`} overriden`}function Tn(e){let{parentProjection:t,projection:n}=e;return`Layer's shared projection ${M(t)} is overridden by a child projection ${M(n)}.`}function En(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${M(n)}}.`}function Dn(e){return`Invalid field type "${e}"`}function On(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 kn(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`}function An(e){return`Invalid aggregation operator "${e}"`}function jn(e,t){return`Missing type for channel "${e}", using "${t}" instead.`}function Mn(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 Nn(e,t){return`Dropping ${M(e)} from channel "${t}" since it does not contain data field or value.`}function Pn(e,t,n){return`${e}-encoding with type ${t} is deprecated. Replacing with ${n}-encoding.`}var Fn=`Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.`;function In(e,t,n){return`${e} dropped as it is incompatible with "${t}"${n?` when ${n}`:``}.`}function Ln(e){return`${e}-encoding is dropped as ${e} is not a valid encoding channel.`}function Rn(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`}function zn(e){return`Facet encoding dropped as ${e.join(` and `)} ${e.length>1?`are`:`is`} also specified.`}function Bn(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${t===`ordinal`?`order`:`magnitude`}.`}var Vn=`Bar mark should not be used with point scale when rangeStep is null. Please use band scale instead.`;function Hn(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 Un(e,t){return`Specified orient "${e}" overridden with "${t}"`}var Wn=`custom domain scale cannot be unioned with default field-based domain`;function Gn(e){return`Cannot use the scale property "${e}" with non-color channel.`}function Kn(e){return`Using unaggregated domain with raw field has no effect (${M(e)}).`}function qn(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`}function Jn(e){return`Unaggregated domain is currently unsupported for log scale (${M(e)}).`}function Yn(e){return`Cannot apply size to non-oriented mark "${e}".`}function Xn(e){return`rangeStep for "${e}" is dropped as top-level ${e===`x`?`width`:`height`} is provided.`}function Zn(e,t,n){return`Channel "${e}" does not work with "${t}" scale. We are using "${n}" scale instead.`}function Qn(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`}function $n(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`}function er(e,t){return`Scale type "${t}" does not work with mark "${e}".`}function tr(e,t,n,r){return`Conflicting ${t.toString()} property "${e.toString()}" (${M(n)} and ${M(r)}). Using ${M(n)}.`}function nr(e,t,n,r){return`Conflicting ${t.toString()} property "${e.toString()}" (${M(n)} and ${M(r)}). Using the union of the two domains.`}function rr(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 ir(e){return`Dropping sort property ${M(e)} as unioned domains only support boolean or op 'count'.`}var ar=`Unable to merge domains`,or=`Domains that should be unioned has conflicting sort properties. Sort will be set to true.`,sr=`Invalid channel for axis.`;function cr(e){return`Cannot stack "${e}" if there is already "${e}2"`}function lr(e){return`Cannot stack non-linear scale (${e})`}function ur(e){return`Stacking is applied even though the aggregate function is non-summative ("${e}")`}function dr(e,t){return`Invalid ${e}: ${M(t)}`}function fr(e){return`Time unit "${e}" is not supported. We are replacing it with ${e.replace(`day`,`date`)}.`}function pr(e){return`Dropping day from datetime ${M(e)} as day cannot be combined with other units.`}function mr(e,t){return`${t?`extent `:``}${t&&e?`and `:``}${e?`center `:``}${t&&e?`are `:`is `}not needed when data are aggregated.`}function hr(e,t,n){return`${e} is not usually used with ${t} for ${n}.`}function gr(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`}function _r(e,t){return`Center is not needed to be specified in ${t} when extent is ${e}.`}function vr(e){return`1D error band does not support ${e}`}function yr(e){return`Channel ${e} is required for "binned" bin`}function br(e){return`Domain for ${e} is required for threshold scale`}var F=on,xr=Fe(2);function Sr(...e){xr.warn.apply(xr,arguments)}var Cr={quantitative:1,ordinal:1,temporal:1,nominal:1,geojson:1},wr=`quantitative`,Tr=`ordinal`,Er=`temporal`,Dr=`nominal`,Or=`geojson`;function kr(e){if(e)switch(e=e.toLowerCase(),e){case`q`:case wr:return`quantitative`;case`t`:case Er:return`temporal`;case`o`:case Tr:return`ordinal`;case`n`:case Dr:return`nominal`;case Or:return`geojson`}}var I;(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`})(I||={});var Ar=P({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`}),jr=[`linear`,`log`,`pow`,`sqrt`,`symlog`,`time`,`utc`],Mr=Le(jr),Nr=Le([`quantile`,`quantize`,`threshold`]),Pr=Le(jr.concat([`quantile`,`quantize`,`threshold`])),Fr=Le([`ordinal`,`bin-ordinal`,`point`,`band`]);function Ir(e){return e in Fr}function Lr(e){return e in Pr}function Rr(e){return e in Mr}function zr(e){return e in Nr}var Br={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},Vr=P(Br),{type:Hr,domain:Ur,range:Wr,rangeStep:Gr,scheme:Kr}=Br;P(be(Br,[`type`,`domain`,`range`,`rangeStep`,`scheme`])),Zr();function qr(e,t){switch(t){case`type`:case`domain`:case`reverse`:case`range`:return!0;case`scheme`:case`interpolate`:return!N([`point`,`band`,`identity`],e);case`bins`:return!N([`point`,`band`,`identity`,`ordinal`],e);case`round`:return Rr(e)||e===`band`||e===`point`;case`padding`:return Rr(e)||N([`point`,`band`],e);case`paddingOuter`:case`rangeStep`:case`align`:return N([`point`,`band`],e);case`paddingInner`:return e===`band`;case`clamp`:return Rr(e);case`nice`:return Rr(e)||e===`quantize`||e===`threshold`;case`exponent`:return e===`pow`;case`base`:return e===`log`;case`constant`:return e===`symlog`;case`zero`:return Lr(e)&&!N([`log`,`time`,`utc`,`threshold`,`quantile`],e)}}function Jr(e,t){switch(t){case`interpolate`:case`scheme`:return mt(e)?void 0:F.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 Yr(e,t){return N([`ordinal`,`nominal`],t)?e===void 0||Ir(e):t===`temporal`?N([I.TIME,I.UTC,void 0],e):t!==`quantitative`||N([I.LOG,I.POW,I.SQRT,I.SYMLOG,I.QUANTILE,I.QUANTIZE,I.THRESHOLD,I.LINEAR,void 0],e)}function Xr(e,t){switch(e){case`x`:case`y`:return Rr(t)||N([`band`,`point`],t);case tt:case at:case nt:case rt:case it:return Rr(t)||zr(t)||N([`band`,`point`],t);case Ze:case Qe:case $e:return t!==`band`;case et:return t===`ordinal`}return!1}function Zr(){let e={};for(let t of _t)for(let n of P(Cr))for(let r of Ar){let i=Qr(t,n);Xr(t,r)&&Yr(r,n)&&(e[i]=e[i]||[],e[i].push(r))}return e}function Qr(e,t){return e+`_`+t}var $r=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])/})),L=$r();function R(e,t){return e.indexOf(t)!==-1}function ei(e,t){for(let n=0;n<e.length;n++)if(!t(e[n],n))return!1;return!0}function z(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 ti(e,t){let n=0,r;for(r in e)if(t(e[r],r,n++))return!0;return!1}function ni(e,t){return e.filter(function(e){return!R(t,e)})}function ri(e){return Object.keys(e)}function ii(e){return!!e.parent}var ai={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},oi=ri(ai);function si(e){return e in ai}var ci={bin:1,scale:1,sort:1,axis:1,legend:1};function li(e){return ci[e]}var ui=[`maxbins`,`divide`,`extent`,`base`,`step`,`steps`,`minstep`],di=[`field`,`op`,`order`],fi=ui.map(e=>({parent:`bin`,child:e})),pi=di.map(e=>({parent:`sort`,child:e})),mi=Vr.map(e=>({parent:`scale`,child:e})),hi=tn.map(e=>({parent:`axis`,child:e})),gi=an.map(e=>({parent:`legend`,child:e})),_i=[].concat(fi,pi,mi,hi,gi),vi=[`width`,`height`,`background`,`padding`,`title`],yi=`.`;function bi(e){return ii(e)?e.parent+yi+e.child:e}function xi(e){let t=e.split(yi);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 Si=_i.reduce((e,t)=>(e[t.parent]=e[t.parent]||[],e[t.parent][t.child]=t,e),{});function Ci(e,t){return(Si[e]||{})[t]}function wi(e){return si(e)||ii(e)}var Ti=[].concat(oi,_i),Ei=[`type`,`field`,`bin`,`timeUnit`,`aggregate`,`autoCount`,`channel`,`mark`,`stack`,`scale`,`sort`,`axis`,`legend`].concat(fi,mi,hi,gi,pi),B;(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`})(B||={});var Di=`area`,Oi=`line`,ki=`point`,Ai=`rect`,ji=`rule`,Mi=`text`,Ni=`tick`,Pi=`circle`,Fi=`square`,Ii={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 Li(e){return N([`line`,`area`,`trail`],e)}var Ri=P(Ii);function zi(e){return e.type}Le(Ri),[`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 V;(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`})(V||={});var Bi={year:1,quarter:1,month:1,day:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},Vi=P(Bi);function Hi(e){return!!Bi[e]}var Ui={utcyear:1,utcquarter:1,utcmonth:1,utcday:1,utcdate:1,utchours:1,utcminutes:1,utcseconds:1,utcmilliseconds:1};function Wi(e){return!!Ui[e]}var Gi={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},Ki={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},qi=Object.assign({},Ui,Ki);function Ji(e){return!!qi[e]}var Yi=Object.assign({},Bi,Ui,Gi,Ki);P(Yi);function Xi(e){return!!Yi[e]}var Zi={year:`setFullYear`,month:`setMonth`,date:`setDate`,hours:`setHours`,minutes:`setMinutes`,seconds:`setSeconds`,milliseconds:`setMilliseconds`,quarter:null,day:null};function Qi(e,t){let n=Ji(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 Vi)if(ea(e,i))switch(i){case V.DAY:throw Error(`Cannot convert to TimeUnits containing 'day'`);case V.QUARTER:{let{getDateMethod:e,setDateMethod:i}=$i(`month`,n);r[i](Math.floor(t[e]()/3)*3);break}default:{let{getDateMethod:e,setDateMethod:a}=$i(i,n);r[a](t[e]())}}return r}function $i(e,t){let n=Zi[e];return{setDateMethod:t?`setUTC`+n.substr(3):n,getDateMethod:`get`+(t?`UTC`:``)+n.substr(3)}}function ea(e,t){let n=e.indexOf(t);return n>-1&&(t!==V.SECONDS||n===0||e.charAt(n-1)!==`i`)}function H(e){return ta(e)||na(e)}function ta(e){return e===`?`}function na(e){return e!==void 0&&e!=null&&(!!e.enum||!!e.name)&&!(0,L.isArray)(e)}function ra(e,t,n){return(0,L.extend)({},{name:t,enum:n},e===`?`?{}:e)}function ia(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 aa={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:ia(Vr),axisProps:ia(tn),legendProps:ia(an)};function oa(e){if(ii(e))return aa[e.parent]+`-`+aa[e.parent+`Props`][e.child];if(aa[e])return aa[e];throw Error(`Default name undefined for `+e)}var U=[!1,!0],sa={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]},ca={field:[void 0],op:[`min`,`mean`],order:[`ascending`,`descending`]},la={type:[void 0,I.LOG],domain:[void 0],base:[void 0],exponent:[1,2],constant:[void 0],bins:[void 0],clamp:U,nice:U,reverse:U,round:U,zero:U,padding:[void 0],paddingInner:[void 0],paddingOuter:[void 0],interpolate:[void 0],range:[void 0],rangeStep:[17,21],scheme:[void 0]},ua={zindex:[1,0],offset:[void 0],orient:[void 0],values:[void 0],bandPosition:[void 0],encoding:[void 0],domain:U,domainColor:[void 0],domainDash:[void 0],domainDashOffset:[void 0],domainOpacity:[void 0],domainWidth:[void 0],formatType:[void 0],grid:U,gridColor:[void 0],gridDash:[void 0],gridDashOffset:[void 0],gridOpacity:[void 0],gridWidth:[void 0],format:[void 0],labels:U,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:U,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]},da={mark:[ki,`bar`,Oi,Di,Ai,Ni,Mi],channel:[`x`,`y`,`row`,Ge,tt,Ze],aggregate:[void 0,`mean`],autoCount:U,bin:U,hasFn:U,timeUnit:[void 0,V.YEAR,V.MONTH,V.MINUTES,V.SECONDS],field:[void 0],type:[Dr,Tr,wr,Er],sort:[`ascending`,`descending`],stack:[`zero`,`normalize`,`center`,null],value:[void 0],format:[void 0],title:[void 0],scale:[!0],axis:U,legend:U,binProps:sa,sortProps:ca,scaleProps:la,axisProps:ua,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 fa(e,t,n){if(e===`field`||ii(e)&&e.parent===`sort`&&e.child===`field`)return t.fieldNames();let r;if(r=ii(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 pa={verbose:!1,defaultSpecConfig:{line:{point:!0},scale:{useUnaggregatedDomain:!0}},propertyPrecedence:Ei.map(bi),enum:da,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},ma={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 ha(e){return!!e&&!!e.argmin}function ga(e){return!!e&&!!e.argmax}P(ma);function _a(e){return Ae(e)&&!!ma[e]}var va=[`count`,`sum`,`distinct`,`valid`,`missing`];Le([`mean`,`average`,`median`,`q1`,`q3`,`min`,`max`]);function ya(e){return Ie(e)&&(e=Ma(e,void 0)),`bin`+P(e).map(t=>ze(`_${t}_${e[t]}`)).join(``)}function ba(e){return e===!0||xa(e)&&!e.binned}function xa(e){return ke(e)}function Sa(e){switch(e){case`row`:case Ge:case tt:case Ze:case Qe:case $e:case at:case nt:case rt:case it:case et:return 6;default:return 10}}function Ca(e){return!!e&&!!e.condition&&!Oe(e.condition)&&wa(e.condition)}function wa(e){return!!e&&(!!e.field||e.aggregate===`count`)}function Ta(e){return wa(e)&&Ae(e.field)}function Ea(e){return!!e.op}function Da(e,t={}){let n=e.field,r=t.prefix,i=t.suffix,a=``;if(Aa(e))n=Ue(`count`);else{let r;if(!t.nofn){if(Ea(e))r=e.op;else{let{bin:o,aggregate:s,timeUnit:c}=e;ba(o)?(r=ya(o),i=(t.binSuffix||``)+(t.suffix||``)):s?ga(s)?(a=`.${n}`,n=`argmax_${s.argmax}`):ha(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?Be(n,t.expr)+a:Ve(n)+a}function Oa(e){switch(e.type){case`nominal`:case`ordinal`:case`geojson`:return!0;case`quantitative`:return!!e.bin;case`temporal`:return!1}throw Error(F.invalidFieldType(e.type))}function ka(e){return!Oa(e)}function Aa(e){return e.aggregate===`count`}function ja(e){if(wa(e))return e;if(Ca(e))return e.condition}function Ma(e,t){return Ie(e)?{maxbins:Sa(t)}:e===`binned`?{binned:!0}:!e.maxbins&&!e.step?Object.assign({},e,{maxbins:Sa(t)}):e}var Na={compatible:!0};function Pa(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 ka(e)?{compatible:!1,warning:F.facetChannelShouldBeDiscrete(t)}:Na;case`x`:case`y`:case`color`:case`fill`:case`stroke`:case`text`:case`detail`:case`key`:case`tooltip`:case`href`:return Na;case`longitude`:case`longitude2`:case`latitude`:case`latitude2`:return n===`quantitative`?Na:{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.`}:Na;case`shape`:return N([`ordinal`,`nominal`,`geojson`],e.type)?Na:{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.`}:Na}throw Error(`channelCompatability not implemented for channel `+t)}function Fa(e,t,n,r){let i=Ia(t,n,r),{type:a}=e;return Kt(t)?a===void 0?i:Xr(t,a)?Yr(a,n.type)?a:(Sr(F.scaleTypeNotWorkWithFieldDef(a,i)),i):(Sr(F.scaleTypeNotWorkWithChannel(t,a,i)),i):null}function Ia(e,t,n){switch(t.type){case`nominal`:case`ordinal`:return mt(e)||Qt(e)===`discrete`?(e===`shape`&&t.type===`ordinal`&&Sr(F.discreteChannelCannotEncode(e,`ordinal`)),`ordinal`):N([`x`,`y`],e)&&(N([`rect`,`bar`,`rule`],n)||n===`bar`)?`band`:`point`;case`temporal`:return mt(e)?`time`:Qt(e)===`discrete`?(Sr(F.discreteChannelCannotEncode(e,`temporal`)),`ordinal`):`time`;case`quantitative`:return mt(e)?ba(t.bin)?`bin-ordinal`:`linear`:Qt(e)===`discrete`?(Sr(F.discreteChannelCannotEncode(e,`quantitative`)),`ordinal`):`linear`;case`geojson`:return}throw Error(F.invalidFieldType(t.type))}var La;(function(e){e.QUANTITATIVE=wr,e.ORDINAL=Tr,e.TEMPORAL=Er,e.NOMINAL=Dr,e.KEY=`key`})(La||={});function Ra(e){return e===`ordinal`||e===`nominal`||e===La.KEY}var W=class e{constructor(e=null){this.index=e?Object.assign({},e):{}}has(e){return bi(e)in this.index}get(e){return this.index[bi(e)]}set(e,t){return this.index[bi(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,L.keys)(this.index).length}duplicate(){return new e(this.index)}};function za(e,t){let n=e&&e[t];return n?Oe(n)?Re(n,e=>!!e.field):wa(n)||Ca(n):!1}var Ba={zero:1,center:1,normalize:1};function Va(e){return!!Ba[e]}var Ha=[`bar`,Di,ji,ki,Pi,Fi,Oi,Mi,Ni],Ua=[`bar`,Di];function Wa(e){let t=e.x,n=e.y;if(wa(t)&&wa(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(wa(t)&&t.type===`quantitative`)return`x`;else if(wa(n)&&n.type===`quantitative`)return`y`}function Ga(e,t,n,r={}){let i=zi(e)?e.type:e;if(!N(Ha,i))return null;let a=Wa(t);if(!a)return null;let o=t[a],s=Ta(o)?Da(o,{}):void 0,c=a===`x`?`y`:`x`,l=t[c],u=Ta(l)?Da(l,{}):void 0,d=It.reduce((e,n)=>{if(n!==`tooltip`&&za(t,n)){let r=t[n];(Oe(r)?r:[r]).forEach(t=>{let r=ja(t);if(r.aggregate)return;let i=Ta(r)?Da(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=N(Ua,i)?He(n,`zero`):n):f=Ie(o.stack)?o.stack?`zero`:null:o.stack,!f||!Va(f))return null;if(o.scale&&o.scale.type&&o.scale.type!==I.LINEAR){if(r.disallowNonLinearStack)return null;Sr(F.cannotStackNonLinearScale(o.scale.type))}return za(t,a===`x`?`x2`:`y2`)?(o.stack!==void 0&&Sr(F.cannotStackRangedMark(a)),null):(o.aggregate&&!N(va,o.aggregate)&&Sr(F.stackNonSummativeAggregate(o.aggregate)),{groupbyChannel:l?c:void 0,fieldChannel:a,impute:Li(i),stackBy:d,offset:f})}function Ka(e){return ti(e.encodings,e=>K(e)&&!H(e.aggregate)&&!!e.aggregate||mo(e))}function qa(e){if(!Xa(e))return null;let t=go(e.encodings,{schema:null,wildcardMode:`null`}),n=e.mark;return Ga(n,t,void 0,{disallowNonLinearStack:!0})}function Ja(e){for(let t of e.encodings)if(t[B.STACK]!==void 0&&!H(t[B.STACK]))return t[B.STACK]}function Ya(e){for(let t of e.encodings)if(t[B.STACK]!==void 0&&!H(t.channel))return t.channel;return null}function Xa(e){if(H(e.mark))return!1;let t=[B.STACK,B.CHANNEL,B.MARK,B.FIELD,B.AGGREGATE,B.AUTOCOUNT,B.SCALE,Ci(`scale`,`type`),B.TYPE],n=(0,L.toMap)(ni(Ti,t)),r=e.encodings.filter(e=>!po(e));for(let e of r)if(Za(e,{exclude:n}))return!1;return!0}function Za(e,t={}){if(!(0,L.isObject)(e))return!1;for(let n in e)if(e.hasOwnProperty(n)&&(H(e[n])&&(!t.exclude||!t.exclude[n])||Za(e[n],t)))return!0;return!1}function Qa(e){return e.map(e=>$a(e))}function $a(e){return t=>e[t]===void 0?t:e[t]}function eo(e,t){return H(e)?!ta(e)&&e.enum?`?`+JSON.stringify(e.enum):`?`:t?t(e):e}function to(e,t){return t?t(e):e}var no=new W,ro=[].concat(Ei,pi,[B.TRANSFORM,B.STACK],vi).reduce((e,t)=>e.set(t,!0),new W),io={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 ao(e,t=ro,n=no){let r=[];t.get(B.MARK)&&r.push(eo(e.mark,n.get(B.MARK))),e.transform&&e.transform.length>0&&r.push(`transform:`+JSON.stringify(e.transform));let i;if(t.get(B.STACK)&&(i=qa(e)),e.encodings){let a=e.encodings.reduce((e,r)=>{if(!po(r)){let a;a=i&&r.channel===i.fieldChannel?oo(Object.assign({},r,{stack:i.offset}),t,n):oo(r,t,n),a&&e.push(a)}return e},[]).sort().join(`|`);a&&r.push(a)}for(let n of vi){let i=n.toString();if(t.get(n)&&e[i]){let t=e[i];r.push(`${i}=${JSON.stringify(t)}`)}}return r.join(`|`)}function oo(e,t=ro,n=no){let r=[];if(t.get(B.CHANNEL)&&r.push(eo(e.channel,n.get(B.CHANNEL))),K(e)){let i=so(e,t,n);i&&r.push(i)}else G(e)?r.push(e.value):q(e)&&r.push(`autocount()`);return r.join(`:`)}function so(e,t=ro,n=no){if(t.get(B.AGGREGATE)&&po(e))return`-`;let r=co(e,t,n),i=lo(e,t,n),a;if(K(e)){if(a=t.get(`field`)?eo(e.field,n.get(`field`)):`...`,t.get(B.TYPE)){if(H(e.type))a+=`,`+eo(e.type,n.get(B.TYPE));else{let t=((e.type||`quantitative`)+``).substr(0,1);a+=`,`+eo(t,n.get(B.TYPE))}}a+=i.map(e=>{let t=e.value instanceof Array?`[`+e.value+`]`:e.value;return`,`+e.key+`=`+t}).join(``)}else q(e)&&(a=`*,q`);return a?r?((0,L.isString)(r)?r:`?`+((0,L.keys)(r).length>0?JSON.stringify(r):``))+`(`+a+`)`:a:null}function co(e,t,n){if(t.get(B.AGGREGATE)&&e.aggregate&&!H(e.aggregate))return to(e.aggregate,n.get(B.AGGREGATE));if(t.get(B.AGGREGATE)&&mo(e))return to(`count`,n.get(B.AGGREGATE));if(t.get(B.TIMEUNIT)&&e.timeUnit&&!H(e.timeUnit))return to(e.timeUnit,n.get(B.TIMEUNIT));if(t.get(B.BIN)&&e.bin&&!H(e.bin))return`bin`;{let n=null;for(let r of[B.AGGREGATE,B.AUTOCOUNT,B.TIMEUNIT,B.BIN]){let i=e[r];t.get(r)&&e[r]&&H(i)&&(n||={},n[r]=ta(i)?i:i.enum)}return n&&e.hasFn&&(n.hasFn=!0),n}}function lo(e,t,n){let r=[];if(!(0,L.isBoolean)(e.bin)&&!ta(e.bin)){let i=e.bin;for(let e in i){let a=Ci(`bin`,e);a&&t.get(a)&&i[e]!==void 0&&r.push({key:e,value:eo(i[e],n.get(a))})}r.sort((e,t)=>e.key.localeCompare(t.key))}for(let i of[B.SCALE,B.SORT,B.STACK,B.AXIS,B.LEGEND])if(!(!H(e.channel)&&!io[i][e.channel])&&t.get(i)&&e[i]!==void 0){let a=e[i];if((0,L.isBoolean)(a)||a===null)r.push({key:i+``,value:a||!1});else if((0,L.isString)(a))r.push({key:i+``,value:to(JSON.stringify(a),n.get(i))});else{let e=[];for(let r in a){let o=Ci(i,r);o&&t.get(o)&&a[r]!==void 0&&e.push({key:r,value:eo(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 uo(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 fo;(function(e){function t(e,t){let r=t.indexOf(`(`)===-1?n(uo(t,`,`,2)):i(t);return Object.assign({channel:e},r)}e.encoding=t;function n(e){let t={};t.field=e[0],t.type=kr(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))}li(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,L.isArray)(a[e])?{enum:a[e]}:a[e];return Object.assign({},t,n(uo(e.substring(i+2,e.length-1),`,`,2)))}{let t=e.substring(0,e.indexOf(`(`)),r=uo(e.substring(t.length+1,e.length-1),`,`,2);if(_a(t))return Object.assign({aggregate:t},n(r));if(Xi(t))return Object.assign({timeUnit:t},n(r));if(t===`bin`)return Object.assign({bin:{}},n(r))}}e.fn=i})(fo||={});function G(e){return e!=null&&e.value!==void 0}function K(e){return e!=null&&(e.field||e.aggregate===`count`)}function q(e){return e!=null&&`autoCount`in e}function po(e){return q(e)&&e.autoCount===!1}function mo(e){return q(e)&&e.autoCount===!0}var ho=[B.AGGREGATE,B.BIN,B.TIMEUNIT,B.FIELD,B.TYPE,B.SCALE,B.SORT,B.AXIS,B.LEGEND,B.STACK,B.FORMAT];function go(e,t){let{wildcardMode:n=`skip`}=t,r={};for(let n of e){if(po(n))continue;let{channel:e}=n;if(H(e))throw Error(`Cannot convert wildcard channel to a fixed channel`);let i=G(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 H(t)?null:{value:t}}function vo(e,t={}){let{props:n=ho,schema:r,wildcardMode:i=`skip`}=t;if(K(e)){let t={};for(let a of n){let n=e[a];if(H(n)){if(i===`skip`)continue;return null}if(n!==void 0){if(!(!io[a]||io[a][e.channel]))continue;if(li(a)&&(0,L.isObject)(n)){n=Object.assign({},n);for(let e in n)if(H(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===B.SCALE&&r&&e.type===`ordinal`){let n=e.scale,{ordinalDomain:i}=r.fieldSchema(e.field);n!==null&&i&&(t[B.SCALE]=Object.assign({domain:i},(0,L.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 K(e)?!bo(e)&&e.type!==`temporal`:q(e)}function bo(e){if(K(e)){let t=vo(e,{props:[`bin`,`timeUnit`,`type`]});return Oa(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(H(t.type)||H(n)||H(r)||H(a))return;if(t.type)return t.type;if(n===`temporal`&&H(i)||n===`quantitative`&&H(a))return;let o={type:n===La.KEY?`nominal`:n,timeUnit:i,bin:a};return Fa({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=$r(),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=$r(),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=$r(),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=$r(),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,L.extend)({},pa,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=wr;else if(s===X.INTEGER)l=c<t.numberNominalLimit&&c/n.count<t.numberNominalProportion?Dr:wr;else if(s===X.DATETIME){l=Er,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=Dr;l===`nominal`&&c/n.count>t.minPercentUniqueForKey&&n.count>t.minCardinalityForKey&&(l=La.KEY);let u={name:o,originalIndex:r,vlType:l,type:s,stats:n,timeStats:{},binStats:{}},d=a[u.name];return u=(0,L.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,L.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||q(e)&&e.autoCount)return 1;if(e.bin){let t;t=typeof e.bin==`boolean`?{maxbins:Sa(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 V.SECONDS:return 60;case V.MINUTES:return 60;case V.HOURS:return 24;case V.DAY:return 7;case V.DATE:return 31;case V.MONTH:return 12;case V.QUARTER:return 4;case V.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===V.DAY){let t=(0,L.extend)({},e,{timeUnit:V.DATE});if(this.cardinality(t,!1,!0)<=1)return!1}let t=e.timeUnit;for(let n of Vi)if(ea(t,n)){let t=(0,L.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,L.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(L.cmp)):t.vlType===`ordinal`&&t.ordinalDomain?t.ordinalDomain:n.map(e=>e===`null`?null:e).sort(L.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,L.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,L.extend)({},t),r={};return(0,L.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===V.DAY?i.getDay():Qi(e,i)).toString(),r[a]=(r[a]||0)+t.unique[n]}),n.unique=r,n.distinct=(0,L.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 ei(this.constraint.properties,t=>{if(ii(t)){let n=t.parent,r=t.child;return!e[n]||!H(e[n][r])}return!e[t]||!H(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:[B.TYPE,B.AGGREGATE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>!e.aggregate||!Ra(e.type)},{name:`asteriskFieldWithCountOnly`,description:`Field="*" should be disallowed except aggregate="count"`,properties:[B.FIELD,B.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:[B.BIN,B.FIELD,B.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:[B.TYPE,B.BIN],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>!e.bin||e.type===wr},{name:`channelFieldCompatible`,description:`encoding channel's range type be compatible with channel type.`,properties:[B.CHANNEL,B.TYPE,B.BIN,B.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}=Pa(i,e.channel);return a?!0:!!((e.channel===`row`||e.channel===`column`)&&(Hi(i.timeUnit)||Wi(i.timeUnit)))}},{name:`hasFn`,description:`A field with as hasFn flag should have one of aggregate, timeUnit, or bin.`,properties:[B.AGGREGATE,B.BIN,B.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:[B.SCALE,Ci(`scale`,`zero`),B.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:[B.AGGREGATE,B.AUTOCOUNT,B.TIMEUNIT,B.BIN],allowWildcardForProperties:!0,strict:!0,satisfy:(e,t,n,r)=>!K(e)||(!H(e.aggregate)&&e.aggregate?1:0)+(!H(e.bin)&&e.bin?1:0)+(!H(e.timeUnit)&&e.timeUnit?1:0)<=1},{name:`timeUnitAppliedForTemporal`,description:`Time unit should be applied to temporal field only.`,properties:[B.TYPE,B.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:[B.TIMEUNIT,B.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(mi,[B.SCALE,B.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(!qr(`point`,t)&&!qr(`band`,t))return!1}else if(!qr(n,t))return!1}}return!0}},{name:`scalePropertiesSupportedByChannel`,description:`Not all scale properties are supported by all encoding channels`,properties:[].concat(mi,[B.SCALE,B.CHANNEL]),allowWildcardForProperties:!0,strict:!0,satisfy:(e,t,n,r)=>{if(e){let t=e.channel,n=e.scale;if(t&&!H(t)&&n){if(t===`row`||t===`column`)return!1;for(let e in n)if(n.hasOwnProperty(e)&&e!==`type`&&e!==`name`&&e!==`enum`&&Jr(t,e)!==void 0)return!1}}return!0}},{name:`typeMatchesPrimitiveType`,description:`Data type should be supported by field's primitive type.`,properties:[B.FIELD,B.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!==Er;case X.DATETIME:return a===Er;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:[B.FIELD,B.TYPE],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n,r)=>!n.has(`field`)&&!n.has(`type`)&&!r.constraintManuallySpecifiedValue?!0:e.field===`*`?e.type===wr:t.vlType(e.field)===e.type},{name:`maxCardinalityForCategoricalColor`,description:`Categorical channel should not have too high cardinality`,properties:[B.CHANNEL,B.FIELD],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n,r)=>e.channel===`color`&&(e.type===`nominal`||e.type===La.KEY)?t.cardinality(e)<=r.maxCardinalityForCategoricalColor:!0},{name:`maxCardinalityForFacet`,description:`Row/column channel should not have too high cardinality`,properties:[B.CHANNEL,B.FIELD,B.BIN,B.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:[B.CHANNEL,B.FIELD,B.BIN,B.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:[B.TYPE,B.SCALE,Ci(`scale`,`type`),B.TIMEUNIT,B.BIN],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>{if(e.scale){let t=e.type,n=xo(e);if(Ra(t))return n===void 0||Ir(n);if(t===`temporal`)return e.timeUnit?R([I.TIME,I.UTC,void 0],n)||Ir(n):R([I.TIME,I.UTC,void 0],n);if(t===`quantitative`)return e.bin?R([I.LINEAR,void 0],n):R([I.LOG,I.POW,I.SQRT,I.QUANTILE,I.QUANTIZE,I.LINEAR,void 0],n)}return!0}},{name:`stackIsOnlyUsedWithXY`,description:`stack should only be allowed for x and y channels`,properties:[B.STACK,B.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 W),pc=[{name:`doesNotSupportConstantValue`,description:`row, column, x, y, order, and detail should not work with constant values.`,properties:[B.TYPE,B.AGGREGATE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>!R([`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 W);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()])&&G(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=It.reduce((e,t)=>(e[t]=!0,e),{}),_c=class extends lc{constructor(e){super(e)}hasAllRequiredPropertiesSpecific(e){return ei(this.constraint.properties,t=>{if(t===B.MARK)return!H(e.getMark());if(ii(t)){let n=t.parent,r=t.child;return ei(e.getEncodings(),e=>!e[n]||!H(e[n][r]))}if(!wi(t))throw Error(`UNIMPLEMENTED`);return ei(e.getEncodings(),e=>!e[t]||!H(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:[B.CHANNEL],allowWildcardForProperties:!0,strict:!0,satisfy:(e,t,n)=>{let r={};return ei(e.getEncodings(),e=>H(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:[B.MARK,B.SCALE,Ci(`scale`,`zero`),B.CHANNEL,B.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(K(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:[B.BIN,B.TIMEUNIT,B.TYPE,B.AUTOCOUNT],allowWildcardForProperties:!0,strict:!1,satisfy:(e,t,n)=>ti(e.getEncodings(),e=>mo(e))?ei(e.getEncodings(),e=>{if(G(e)||q(e))return!0;switch(e.type){case wr:return!!e.bin;case Er:return!!e.timeUnit;case Tr:case La.KEY:case Dr:return!0}throw Error(`Unsupported Type`)}):!ei(e.wildcardIndex.encodingIndicesByProperty.get(`autoCount`)||[],t=>{let n=e.getEncodingQueryByIndex(t);return q(n)&&!H(n.autoCount)})||ti(e.getEncodings(),e=>(K(e)||q(e))&&e.type===`quantitative`?!po(e)&&K(e)&&(!e.bin||H(e.bin)):K(e)&&e.type===`temporal`?!e.timeUnit||H(e.timeUnit):!1)},{name:`channelPermittedByMarkType`,description:`Each encoding channel should be supported by the mark type`,properties:[B.CHANNEL,B.MARK],allowWildcardForProperties:!0,strict:!0,satisfy:(e,t,n)=>{let r=e.getMark();return H(r)?!0:ei(e.getEncodings(),e=>H(e.channel)?!0:!!qt(e.channel,r))}},{name:`hasAllRequiredChannelsForMark`,description:`All required channels for the specified mark should be specified`,properties:[B.CHANNEL,B.MARK],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n)=>{let r=e.getMark();switch(r){case Di:case Oi:return e.channelUsed(`x`)&&e.channelUsed(`y`);case Mi:return e.channelUsed(ot);case`bar`:case Pi:case Fi:case Ni:case ji:case Ai:return e.channelUsed(`x`)||e.channelUsed(`y`);case ki:return!e.wildcardIndex.hasProperty(B.CHANNEL)||e.channelUsed(`x`)||e.channelUsed(`y`)}throw Error(`hasAllRequiredChannelsForMark not implemented for mark`+JSON.stringify(r))}},{name:`omitAggregate`,description:`Omit aggregate plots.`,properties:[B.AGGREGATE,B.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:[B.CHANNEL,B.AGGREGATE,B.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)=>{G(n)||po(n)||K(n)&&!n.aggregate&&(r=!0,R([`row`,`column`],n.channel)?e.wildcardIndex.hasEncodingProperty(a,B.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:[B.AGGREGATE,B.AUTOCOUNT,B.BIN,B.TIMEUNIT,B.TYPE],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>!e.isAggregate()||ti(e.getEncodings(),e=>!!(bo(e)||K(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:[B.MARK,B.AGGREGATE,B.AUTOCOUNT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>!R([`bar`,`line`,`area`],e.getMark())||e.isAggregate()},{name:`omitBarTickWithSize`,description:`Do not map field to size channel with bar and tick mark`,properties:[B.CHANNEL,B.MARK],allowWildcardForProperties:!0,strict:!1,satisfy:(e,t,n)=>{if(R([`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,B.CHANNEL)}}return!0}},{name:`omitBarAreaForLogScale`,description:`Do not use bar and area mark for x and y's log scale`,properties:[B.MARK,B.CHANNEL,B.SCALE,Ci(`scale`,`type`),B.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(K(e)&&(e.channel===`x`||e.channel===`y`)&&e.scale&&xo(e)===I.LOG)return!1}return!0}},{name:`omitMultipleNonPositionalChannels`,description:`Unless manually specified, do not use multiple non-positional encoding channel to avoid over-encoding.`,properties:[B.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(G(o)||po(o))continue;let s=o.channel;if(!H(s)&&gc[s+``]&&(i+=1,e.wildcardIndex.hasEncodingProperty(t,B.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:[B.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(G(n)||po(n))continue;let c=n.channel;c===`x`?o=!0:c===`y`?s=!0:H(c)||(i=!0,e.wildcardIndex.hasEncodingProperty(t,B.CHANNEL)&&(a=!0))}return a||n.constraintManuallySpecifiedValue&&i?o&&s:!0}},{name:`omitRaw`,description:`Omit raw plots.`,properties:[B.AGGREGATE,B.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:[B.AGGREGATE,B.AUTOCOUNT,B.TIMEUNIT,B.BIN,B.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(!(G(i)||po(i))&&(K(i)&&i.type===`temporal`&&!i.timeUnit&&(e.wildcardIndex.hasEncodingProperty(r,B.TIMEUNIT)||n.constraintManuallySpecifiedValue)||i.type===`quantitative`&&K(i)&&!i.bin&&!i.aggregate&&(e.wildcardIndex.hasEncodingProperty(r,B.BIN)||e.wildcardIndex.hasEncodingProperty(r,B.AGGREGATE)||e.wildcardIndex.hasEncodingProperty(r,B.AUTOCOUNT)||n.constraintManuallySpecifiedValue)))return!1}}return!0}},{name:`omitRawDetail`,description:`Do not use detail channel with raw plot.`,properties:[B.CHANNEL,B.AGGREGATE,B.AUTOCOUNT],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n)=>e.isAggregate()?!0:ei(e.specQuery.encodings,(t,r)=>G(t)||po(t)?!0:!(t.channel===`detail`&&(e.wildcardIndex.hasEncodingProperty(r,B.CHANNEL)||n.constraintManuallySpecifiedValue)))},{name:`omitRepeatedField`,description:`Each field should be mapped to only one channel`,properties:[B.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(G(o)||q(o))continue;let s;if(o.field&&!H(o.field)&&(s=o.field),q(o)&&!H(o.autoCount)&&(s=`count_*`),s){if(e.wildcardIndex.hasEncodingProperty(t,B.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:[B.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:[B.CHANNEL,B.MARK,B.TYPE,B.TIMEUNIT,B.BIN,B.AGGREGATE,B.AUTOCOUNT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>{let r=e.getMark();switch(r){case Di:case Oi:if(e.isAggregate()){let t=e.getEncodingQueryByChannel(`x`),n=e.getEncodingQueryByChannel(`y`),r=yo(t),i=yo(n);return t&&n&&r!==i&&!(K(t)&&!r&&R([`nominal`,`key`],t.type))&&!(K(n)&&!i&&R([`nominal`,`key`],n.type))}return!0;case Mi:return!0;case`bar`:case Ni:if(e.channelEncodingField(`size`))return!1;{let t=e.getEncodingQueryByChannel(`x`),n=e.getEncodingQueryByChannel(`y`);return yo(t)!==yo(n)}case Ai:let t=e.getEncodingQueryByChannel(`x`),n=e.getEncodingQueryByChannel(`y`),r=bo(t),i=bo(n),a=e.getEncodingQueryByChannel(Ze),o=yo(a),s=K(a)?a.type===Tr:!1;return(r&&i||r&&!e.channelUsed(`y`)||i&&!e.channelUsed(`x`))&&(!a||a&&(o||s));case Pi:case ki:case Fi:case ji:return!0}throw Error(`hasAllRequiredChannelsForMark not implemented for mark`+r)}},{name:`omitInvalidStackSpec`,description:`If stack is specified, must follow Vega-Lite stack rules`,properties:[B.STACK,B.FIELD,B.CHANNEL,B.MARK,B.AGGREGATE,B.AUTOCOUNT,B.SCALE,Ci(`scale`,`type`),B.TYPE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n)=>{if(!e.wildcardIndex.hasProperty(B.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:[B.CHANNEL,B.MARK,B.AGGREGATE,B.AUTOCOUNT,B.SCALE,Ci(`scale`,`type`),B.TYPE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n)=>{let r=e.getVlStack();return!(r!=null&&!R(va,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:[B.CHANNEL,B.TYPE,B.TIMEUNIT,B.BIN,B.AGGREGATE,B.AUTOCOUNT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>{if(n.autoAddCount){let t=e.getEncodingQueryByChannel(`x`),n=e.getEncodingQueryByChannel(`y`);if((!K(t)||bo(t))&&(!K(n)||bo(n)))return e.isAggregate()?ei(e.getEncodings(),e=>{let t=e.channel;return!(t!==`x`&&t!==`y`&&t!==`row`&&t!==`column`&&K(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 W);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 W;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)),oi.forEach(e=>{xc.set(e,Cc(e))}),_i.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);G(d)||po(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,L.isObject)(e)&&!!e.property}function Tc(e,t,n){return t||=new W,n||=new W,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:Qa(n)}}var Ec=[B.FIELD,B.TYPE,B.AGGREGATE,B.BIN,B.TIMEUNIT,B.STACK],Dc=Ec.concat([{property:B.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 W),a.push(e>0?a[e-1].duplicate():new W);let n=t[e].groupBy;if((0,L.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,L.isArray)(c)?ao(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([B.FIELD]);function Ic(e,t){return Oc[t](e)}kc(Ac,e=>ao(e,Fc.include,Fc.replacer));var Lc=Tc(Ec);kc(jc,e=>ao(e,Lc.include,Lc.replacer));var Rc=Tc(Dc);kc(Mc,e=>ao(e,Rc.include,Rc.replacer)),kc(Nc,e=>JSON.stringify(e));var zc=class{constructor(){this._mark=void 0,this._encodings={},this._encodingIndicesByProperty=new W}setEncodingProperty(e,t,n){let r=this._encodings;(r[e]=r[e]||new W).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(wi(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)=>(!H(t.channel)&&(!q(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(H(t.mark)){let e=oa(B.MARK);t.mark=ra(t.mark,e,r.enum.mark),i.setMark(t.mark)}if(t.encodings.forEach((e,t)=>{q(e)&&(console.warn(`A field with autoCount should not be included as autoCount meant to be an internal object.`),e.type=wr),K(e)&&e.type===void 0&&(e.type=`?`),oi.forEach(a=>{if(H(e[a])){let o=oa(a)+t,s=fa(a,n,r),c=e[a]=ra(e[a],o,s);i.setEncodingProperty(t,a,c)}}),_i.forEach(a=>{let o=e[a.parent];if(o){let e=a.child;if(H(o[e])){let s=oa(a)+t,c=fa(a,n,r),l=o[e]=ra(o[e],s,c);i.setEncodingProperty(t,a,l)}}})}),r.autoAddCount){let e={name:oa(B.CHANNEL)+t.encodings.length,enum:fa(B.CHANNEL,n,r)},a={name:oa(B.AUTOCOUNT)+t.encodings.length,enum:[!1,!0]},o={channel:e,autoCount:a,type:wr};t.encodings.push(o);let s=t.encodings.length-1;i.setEncodingProperty(s,B.CHANNEL,e),i.setEncodingProperty(s,B.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,L.duplicate)(this._spec),this._wildcardIndex,this._schema,this._opt,(0,L.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 ii(t)?n[t.parent][t.child]:n[t]}setEncodingProperty(e,t,n,r){let i=this._spec.encodings[e];t===B.CHANNEL&&i.channel&&!H(i.channel)&&this._channelFieldCount[i.channel]--,ii(t)?i[t.parent][t.child]=n:i[t]=li(t)&&n===!0?(0,L.extend)({},i[t],{enum:void 0,name:void 0}):n,this._assignedWildcardIndex[r.name]=n,t===B.CHANNEL&&(this._channelFieldCount[n]=(this._channelFieldCount[n]||0)+1)}resetEncodingProperty(e,t,n){let r=this._spec.encodings[e];t===B.CHANNEL&&this._channelFieldCount[r.channel]--,ii(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 K(this.getEncodingQueryByChannel(e))}getEncodings(){return this._spec.encodings.filter(e=>!po(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 Ka(this._spec)}getVlStack(){return qa(this._spec)}getStackOffset(){return Ja(this._spec)}getStackChannel(){return Ya(this._spec)}toShorthand(e){if(e){if((0,L.isString)(e))return Ic(this.specQuery,e);let t=Tc(e);return ao(this._spec,t.include,t.replacer)}return ao(this._spec)}toSpec(e){if(H(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,L.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,L.duplicate)(e.spec),nest:[t]};return e.chooseBy&&(n.chooseBy=e.chooseBy),e.config&&(n.config=e.config),n}return(0,L.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=wr]=`Q`,e[e.BIN_Q=`bin_`+wr]=`BIN_Q`,e[e.T=Er]=`T`,e[e.TIMEUNIT_T=`timeUnit_time`]=`TIMEUNIT_T`,e[e.TIMEUNIT_O=`timeUnit_`+Tr]=`TIMEUNIT_O`,e[e.O=Tr]=`O`,e[e.N=Dr]=`N`,e[e.K=La.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?Ir(xo(e))?Z.TIMEUNIT_O:Z.TIMEUNIT_T:e.type}var tl=class extends Wc{constructor(){super(`Axis`)}initScore(e={}){e=Object.assign({},pa,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(K(t)||q(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(q(t)||K(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({},pa,e);let t={};return e.preferredFacet===`row`?t[Ge]=-.01:e.preferredFacet===`column`&&(t.row=-.01),t}getScore(e,t,n){return e.getEncodings().reduce((e,t)=>{if(K(t)||q(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(K(t)||q(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,L.keys)(t).forEach(r=>{e[this.featurize(n,r)]=t[r]})});let n=(0,L.extend)({},t,{row:-.75,column:-.75,shape:-3.1,text:-3.2,detail:-4});[Kc,Yc,Xc].forEach(t=>{(0,L.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,L.keys)(r).forEach(t=>{e[this.featurize(Zc,t)]=r[t],e[this.featurize(Qc,t)]=R([`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(K(t)||q(t)){let n=so(t);(e[n]=e[n]||[]).push(t)}return e},{}),i=[];return z(r,e=>{let t=e.reduce((e,t)=>{if(K(t)||q(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=ki);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=>{z({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}),z({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=>{z({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=>{z({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=>{z({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=>{z({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=>{z({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};z(r,(r,i)=>{let a=Q(e,t,!0,i);n[a]=r}),z(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};z(r,(r,i)=>{let a=Q(e,t,!0,i);n[a]=r}),z(r,(r,i)=>{let a=Q(t,e,!0,i);n[a]=r}),z(r,(r,i)=>{let a=Q(e,t,!1,i);n[a]=r}),z(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};z(t,(t,i)=>{let a=Q(e,r,!0,i);n[a]=t}),z(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(ti(r,e=>K(e)&&(e.type===`quantitative`&&!e.bin&&!e.aggregate||e.type===`temporal`&&!e.timeUnit)))return{type:ul,score:.1,feature:`Aggregate with raw continuous`};if(ti(r,e=>K(e)&&bo(e))){let e=ti(r,e=>K(e)&&e.aggregate===`count`||mo(e)),t=ti(r,e=>K(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 ti(r,e=>K(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(K(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`,Ge,`x`].forEach(t=>{n[t]=e.getEncodingQueryByChannel(t)});let i=n.y;if(i!==void 0&&K(i)&&(n.row||t.cardinality(i)>r.smallRangeStepForHighCardinalityOrFacet.maxCardinality)){i.scale===void 0&&(i.scale={});let e=xo(i);i.scale&&(e===void 0||Ir(e))&&(i.scale.rangeStep||(i.scale.rangeStep=12))}let a=n.x;if(K(a)&&(n.column||t.cardinality(a)>r.smallRangeStepForHighCardinalityOrFacet.maxCardinality)){a.scale===void 0&&(a.scale={});let e=xo(a);a.scale&&(e===void 0||Ir(e))&&(a.scale.rangeStep||(a.scale.rangeStep=12))}return e}function Tl(e,t,n,r){n[Ze]=e.getEncodingQueryByChannel(Ze);let i=n[Ze];return K(i)&&i!==void 0&&(i.type===`nominal`||i.type===La.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([Ge,`x`,`y`].forEach(t=>{n[t]=e.getEncodingQueryByChannel(t)}),n.column===void 0){let e=n.x,i=n.y;K(e)&&K(i)&&i!==void 0&&i.field&&Ir(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=pa){let r=Bc.build(e,t,n),i=r.wildcardIndex,a=[r];return n.propertyPrecedence.forEach(e=>{let r=xi(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({},pa,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)(A,{className:`h-5 w-5 inline-flex opacity-60`}),[X.DATETIME]:(0,$.jsx)(j,{className:`h-5 w-5 inline-flex opacity-60`}),[X.NUMBER]:(0,$.jsx)(k,{className:`h-5 w-5 inline-flex opacity-60`}),[X.STRING]:(0,$.jsx)(ne,{className:`h-5 w-5 inline-flex opacity-60`}),[X.INTEGER]:(0,$.jsx)(ve,{className:`h-5 w-5 inline-flex opacity-60`})},jl=12,Ml=e=>{let t=(0,ye.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)(_e,{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 b;t[21]!==u||t[22]!==d||t[23]!==g?(b=(0,$.jsxs)(`div`,{className:u,children:[d,g]}),t[21]=u,t[22]=d,t[23]=g,t[24]=b):b=t[24];let S=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 E;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(x,{className:`min-w-[210px] h-full`,children:(0,$.jsx)(_,{placeholder:`Select a column`})}),t[26]=E):E=t[26];let D;t[27]===n?D=t[28]:(D=n.fieldNames().map(e=>(0,$.jsx)(v,{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]=D);let O;t[29]===D?O=t[30]:(O=(0,$.jsx)(y,{children:(0,$.jsx)(ee,{children:D})}),t[29]=D,t[30]=O);let k;t[31]!==O||t[32]!==S||t[33]!==C?(k=(0,$.jsx)(`div`,{className:`lg:hidden`,children:(0,$.jsxs)(te,{"data-testid":`marimo-plugin-data-explorer-column-select`,value:S,disabled:C,onValueChange:T,children:[E,O]})}),t[31]=O,t[32]=S,t[33]=C,t[34]=k):k=t[34];let A;t[35]!==r||t[36]!==l?(A=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]=A):A=t[37];let j;return t[38]!==k||t[39]!==A||t[40]!==f||t[41]!==p||t[42]!==h||t[43]!==b?(j=(0,$.jsxs)(`div`,{className:f,children:[p,h,b,k,A]}),t[38]=k,t[39]=A,t[40]=f,t[41]=p,t[42]=h,t[43]=b,t[44]=j):j=t[44],j},Nl=[`distinct`,`min`,`max`,`mean`,`median`,`q1`,`q3`,`stdev`],Pl=e=>{let t=(0,ye.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=le(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=ce(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(H(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)G(i)||(q(i)?H(i.autoCount)&&(n=!0):(H(i.field)&&(t=!0),(H(i.aggregate)||H(i.bin)||H(i.timeUnit))&&(n=!0),H(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`&&fe(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(K).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,ye.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)(x,{children:(0,$.jsx)(_,{placeholder:`Mark`})}),t[9]=f):f=t[9];let p;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(y,{children:(0,$.jsxs)(ee,{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)(te,{"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 b;t[15]===l?b=t[16]:(b=bu.map(l),t[15]=l,t[16]=b);let S;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(`div`,{children:`Mark`}),t[17]=S):S=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:[S,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]!==b?(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,b,C,w]}),t[22]=C,t[23]=w,t[24]=b,t[25]=T):T=t[25],T},Cu=e=>{let t=(0,ye.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)(S,{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)(x,{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)(v,{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)(v,{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 E;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(v,{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]=E):E=t[22];let D;t[23]!==w||t[24]!==C?(D=(0,$.jsx)(y,{children:(0,$.jsxs)(ee,{children:[C,w,T,E]})}),t[23]=w,t[24]=C,t[25]=D):D=t[25];let O;t[26]!==a||t[27]!==f||t[28]!==D||t[29]!==m||t[30]!==_?(O=(0,$.jsxs)(te,{value:f,disabled:a,onValueChange:m,children:[_,D]}),t[26]=a,t[27]=f,t[28]=D,t[29]=m,t[30]=_,t[31]=O):O=t[31];let k;t[32]!==i||t[33]!==o?(k=i&&(0,$.jsx)(Tu,{field:i,onChange:o}),t[32]=i,t[33]=o,t[34]=k):k=t[34];let A;t[35]===k?A=t[36]:(A=(0,$.jsx)(`div`,{className:`w-[26px]`,children:k}),t[35]=k,t[36]=A);let j;t[37]!==O||t[38]!==A?(j=(0,$.jsxs)(`div`,{className:`flex flex-row gap-1 h-[26px]`,children:[O,A]}),t[37]=O,t[38]=A,t[39]=j):j=t[39];let ne;return t[40]!==j||t[41]!==p?(ne=(0,$.jsxs)($.Fragment,{children:[p,j]}),t[40]=j,t[41]=p,t[42]=ne):ne=t[42],ne},wu=`__`,Tu=e=>{let t=(0,ye.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===La.QUANTITATIVE&&(e=[[``,Bl]]),n.type===La.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)(x,{className:`h-full px-1`,hideChevron:!0,variant:`ghost`,children:(0,$.jsx)(ae,{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)(ee,{children:(0,$.jsx)(v,{value:wu,children:`None`})}),c=(0,$.jsx)(b,{}),t[4]=s,t[5]=c):(s=t[4],c=t[5]);let l=(0,$.jsxs)(y,{children:[s,c,e.map(Ou)]}),u;t[6]!==n.fn||t[7]!==a||t[8]!==l?(u=(0,$.jsxs)(te,{"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)(v,{value:e,children:e===`?`?`auto`:e},e)}function Du(e){return(0,$.jsx)(v,{value:e??wu,children:E.startCase(e)},e)}function Ou(e){let[t,n]=e;return(0,$.jsxs)(ee,{children:[t&&(0,$.jsx)(g,{children:t}),n.map(Du)]},t)}var ku=e=>{let t=(0,ye.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),re(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:de.call,renderer:`canvas`}}var ju=e=>{let t=(0,ye.c)(43),{data:n}=e,r=vu(),i;t[0]!==r||t[1]!==n?(i=async()=>{if(!n)return{};let e=await ue(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}=ge(i,a),{mark:u}=o(gu),d=o(yu),{theme:p}=se();if(l){let e;return t[5]===l?e=t[6]:(e=(0,$.jsx)(me,{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,b;t[11]!==h||t[12]!==_||t[13]!==g||t[14]!==p?(b=()=>{if(!_)return(0,$.jsx)(Ml,{schema:g});let e=_.spec,t=Pu(e),n=O(t,h);return(0,$.jsx)(`div`,{className:m(`flex overflow-y-auto justify-center items-center flex-1 w-[90%]`),children:(0,$.jsx)(pe,{"data-container-width":he(n),spec:n,options:Au(p)})})},t[11]=h,t[12]=_,t[13]=g,t[14]=p,t[15]=b):b=t[15];let ee=b,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]===ee?te=t[20]:(te=ee(),t[19]=ee,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,E=d.addCategoricalField?.plots,D=d.addQuantitativeField?.plots,k=d.addTemporalField?.plots,A;if(t[24]!==r||t[25]!==h||t[26]!==y||t[27]!==D||t[28]!==k||t[29]!==T||t[30]!==E||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)(oe,{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)(ie,{className:`w-4 h-4`})})}),children:(0,$.jsx)(pe,{options:Au(p),spec:O(e.spec,h)},t)},t),t[33]=r,t[34]=h,t[35]=y,t[36]=p,t[37]=e):e=t[37],A=[T,E,D,k].filter(Boolean).flat().map(e),t[24]=r,t[25]=h,t[26]=y,t[27]=D,t[28]=k,t[29]=T,t[30]=E,t[31]=p,t[32]=A}else A=t[32];let j;t[38]===A?j=t[39]:(j=(0,$.jsx)(Mu,{children:A}),t[38]=A,t[39]=j);let ne;return t[40]!==j||t[41]!==S?(ne=(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[S,j]}),t[40]=j,t[41]=S,t[42]=ne):ne=t[42],ne},Mu=e=>{let t=(0,ye.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,ye.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 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-B7HeEoG2.js";import{t}from"./Deferred-CrTnjj37.js";import{t as n}from"./uuid-k9DpjH68.js";var r=e(`key`,[[`path`,{d:`m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4`,key:`g0fldk`}],[`path`,{d:`m21 2-9.6 9.6`,key:`1j0ho8`}],[`circle`,{cx:`7.5`,cy:`15.5`,r:`5.5`,key:`yqb3hr`}]]),i={create(){return n()}},a=class{requests=new Map;operation;makeRequest;opts;constructor(e,t,n={}){this.operation=e,this.makeRequest=t,this.opts=n}async request(e){if(this.opts.resolveExistingRequests){let e=this.opts.resolveExistingRequests();for(let t of this.requests.values())t.resolve(e);this.requests.clear()}let n=i.create(),r=new t;return this.requests.set(n,r),await this.makeRequest(n,e).catch(e=>{r.reject(e),this.requests.delete(n)}),r.promise}resolve(e,t){let n=this.requests.get(e);n!==void 0&&(n.resolve(t),this.requests.delete(e))}reject(e,t){let n=this.requests.get(e);n!==void 0&&(n.reject(t),this.requests.delete(e))}};export{r as n,a as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{t}from"./react-CBDbhulC.js";import{t as n}from"./compiler-runtime-CYIjoINj.js";import{t as r}from"./jsx-runtime-B74pBk57.js";import{a as i,c as a,i as o,l as s,n as c,r as l,s as u,t as d}from"./alert-dialog-DBoy-FMx.js";import{t as f}from"./button-BMBznEru.js";import{r as p}from"./input-BuOxQ3Wy.js";import{t as m}from"./dialog-EjSc4yoH.js";var h=n(),g=e(t(),1),_=r(),v=g.createContext({modal:null,setModal:()=>{}}),y=e=>{let t=(0,h.c)(6),[n,r]=g.useState(null),i;t[0]===n?i=t[1]:(i={modal:n,setModal:r},t[0]=n,t[1]=i);let a;return t[2]!==n||t[3]!==e.children||t[4]!==i?(a=(0,_.jsxs)(v,{value:i,children:[n,e.children]}),t[2]=n,t[3]=e.children,t[4]=i,t[5]=a):a=t[5],a};function b(){let e=g.use(v);if(e===void 0)throw Error(`useModal must be used within a ModalProvider`);let t=()=>{e.setModal(null)};return{openModal:n=>{e.setModal((0,_.jsx)(m,{open:!0,onOpenChange:e=>{e||t()},children:n}))},openAlert:n=>{e.setModal((0,_.jsx)(d,{open:!0,onOpenChange:e=>{e||t()},children:(0,_.jsxs)(o,{children:[n,(0,_.jsx)(u,{children:(0,_.jsx)(c,{autoFocus:!0,onClick:t,children:`Ok`})})]})}))},openPrompt:n=>{e.setModal((0,_.jsx)(d,{open:!0,onOpenChange:e=>{e||t()},children:(0,_.jsx)(o,{children:(0,_.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),n.onConfirm(e.currentTarget.prompt.value),t()},children:[(0,_.jsxs)(a,{children:[(0,_.jsx)(s,{children:n.title}),(0,_.jsx)(i,{children:n.description}),(0,_.jsx)(p,{spellCheck:n.spellCheck,defaultValue:n.defaultValue,className:`my-4 h-8`,name:`prompt`,required:!0,autoFocus:!0,autoComplete:`off`})]}),(0,_.jsxs)(u,{children:[(0,_.jsx)(l,{onClick:t,children:`Cancel`}),(0,_.jsx)(f,{type:`submit`,children:n.confirmText??`Ok`})]})]})})}))},openConfirm:n=>{e.setModal((0,_.jsx)(d,{open:!0,onOpenChange:e=>{e||t()},children:(0,_.jsxs)(o,{children:[(0,_.jsxs)(a,{children:[(0,_.jsx)(s,{className:n.variant===`destructive`?`text-destructive`:``,children:n.title}),(0,_.jsx)(i,{children:n.description})]}),(0,_.jsxs)(u,{children:[(0,_.jsx)(l,{onClick:t,children:`Cancel`}),n.confirmAction]})]})}))},closeModal:t}}export{b as n,y as t};
|