{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "application/javascript": [ "\n", "(function(root) {\n", " function now() {\n", " return new Date();\n", " }\n", "\n", " var force = true;\n", "\n", " if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n", " root._bokeh_onload_callbacks = [];\n", " root._bokeh_is_loading = undefined;\n", " }\n", "\n", " if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n", " root._bokeh_timeout = Date.now() + 5000;\n", " root._bokeh_failed_load = false;\n", " }\n", "\n", " function run_callbacks() {\n", " try {\n", " root._bokeh_onload_callbacks.forEach(function(callback) {\n", " if (callback != null)\n", " callback();\n", " });\n", " } finally {\n", " delete root._bokeh_onload_callbacks\n", " }\n", " console.debug(\"Bokeh: all callbacks have finished\");\n", " }\n", "\n", " function load_libs(css_urls, js_urls, callback) {\n", " if (css_urls == null) css_urls = [];\n", " if (js_urls == null) js_urls = [];\n", "\n", " root._bokeh_onload_callbacks.push(callback);\n", " if (root._bokeh_is_loading > 0) {\n", " console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n", " return null;\n", " }\n", " if (js_urls == null || js_urls.length === 0) {\n", " run_callbacks();\n", " return null;\n", " }\n", " console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n", " root._bokeh_is_loading = css_urls.length + js_urls.length;\n", "\n", " function on_load() {\n", " root._bokeh_is_loading--;\n", " if (root._bokeh_is_loading === 0) {\n", " console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n", " run_callbacks()\n", " }\n", " }\n", "\n", " function on_error() {\n", " console.error(\"failed to load \" + url);\n", " }\n", "\n", " for (var i = 0; i < css_urls.length; i++) {\n", " var url = css_urls[i];\n", " const element = document.createElement(\"link\");\n", " element.onload = on_load;\n", " element.onerror = on_error;\n", " element.rel = \"stylesheet\";\n", " element.type = \"text/css\";\n", " element.href = url;\n", " console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n", " document.body.appendChild(element);\n", " }\n", "\n", " if (window.requirejs) {\n", " require([], function() {\n", " run_callbacks();\n", " })\n", " } else {\n", " var skip = [];\n", " for (var i = 0; i < js_urls.length; i++) {\n", " var url = js_urls[i];\n", " if (skip.indexOf(url) >= 0) { on_load(); continue; }\n", " var element = document.createElement('script');\n", " element.onload = on_load;\n", " element.onerror = on_error;\n", " element.async = false;\n", " element.src = url;\n", " console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n", " document.head.appendChild(element);\n", " }\n", " }\n", " };\n", "\n", " function inject_raw_css(css) {\n", " const element = document.createElement(\"style\");\n", " element.appendChild(document.createTextNode(css));\n", " document.body.appendChild(element);\n", " }\n", "\n", " var js_urls = [];\n", " var css_urls = [];\n", "\n", " var inline_js = [\n", " function(Bokeh) {\n", " inject_raw_css(\"table.panel-df {\\n margin-left: auto;\\n margin-right: auto;\\n border: none;\\n border-collapse: collapse;\\n border-spacing: 0;\\n color: black;\\n font-size: 12px;\\n table-layout: fixed;\\n width: 100%;\\n}\\n\\n.panel-df tr, .panel-df th, .panel-df td {\\n text-align: right;\\n vertical-align: middle;\\n padding: 0.5em 0.5em !important;\\n line-height: normal;\\n white-space: normal;\\n max-width: none;\\n border: none;\\n}\\n\\n.panel-df tbody {\\n display: table-row-group;\\n vertical-align: middle;\\n border-color: inherit;\\n}\\n\\n.panel-df tbody tr:nth-child(odd) {\\n background: #f5f5f5;\\n}\\n\\n.panel-df thead {\\n border-bottom: 1px solid black;\\n vertical-align: bottom;\\n}\\n\\n.panel-df tr:hover {\\n background: lightblue !important;\\n cursor: pointer;\\n}\\n\");\n", " },\n", " function(Bokeh) {\n", " inject_raw_css(\".json-formatter-row {\\n font-family: monospace;\\n}\\n.json-formatter-row,\\n.json-formatter-row a,\\n.json-formatter-row a:hover {\\n color: black;\\n text-decoration: none;\\n}\\n.json-formatter-row .json-formatter-row {\\n margin-left: 1rem;\\n}\\n.json-formatter-row .json-formatter-children.json-formatter-empty {\\n opacity: 0.5;\\n margin-left: 1rem;\\n}\\n.json-formatter-row .json-formatter-children.json-formatter-empty:after {\\n display: none;\\n}\\n.json-formatter-row .json-formatter-children.json-formatter-empty.json-formatter-object:after {\\n content: \\\"No properties\\\";\\n}\\n.json-formatter-row .json-formatter-children.json-formatter-empty.json-formatter-array:after {\\n content: \\\"[]\\\";\\n}\\n.json-formatter-row .json-formatter-string,\\n.json-formatter-row .json-formatter-stringifiable {\\n color: green;\\n white-space: pre;\\n word-wrap: break-word;\\n}\\n.json-formatter-row .json-formatter-number {\\n color: blue;\\n}\\n.json-formatter-row .json-formatter-boolean {\\n color: red;\\n}\\n.json-formatter-row .json-formatter-null {\\n color: #855A00;\\n}\\n.json-formatter-row .json-formatter-undefined {\\n color: #ca0b69;\\n}\\n.json-formatter-row .json-formatter-function {\\n color: #FF20ED;\\n}\\n.json-formatter-row .json-formatter-date {\\n background-color: rgba(0, 0, 0, 0.05);\\n}\\n.json-formatter-row .json-formatter-url {\\n text-decoration: underline;\\n color: blue;\\n cursor: pointer;\\n}\\n.json-formatter-row .json-formatter-bracket {\\n color: blue;\\n}\\n.json-formatter-row .json-formatter-key {\\n color: #00008B;\\n padding-right: 0.2rem;\\n}\\n.json-formatter-row .json-formatter-toggler-link {\\n cursor: pointer;\\n}\\n.json-formatter-row .json-formatter-toggler {\\n line-height: 1.2rem;\\n font-size: 0.7rem;\\n vertical-align: middle;\\n opacity: 0.6;\\n cursor: pointer;\\n padding-right: 0.2rem;\\n}\\n.json-formatter-row .json-formatter-toggler:after {\\n display: inline-block;\\n transition: transform 100ms ease-in;\\n content: \\\"\\\\25BA\\\";\\n}\\n.json-formatter-row > a > .json-formatter-preview-text {\\n opacity: 0;\\n transition: opacity 0.15s ease-in;\\n font-style: italic;\\n}\\n.json-formatter-row:hover > a > .json-formatter-preview-text {\\n opacity: 0.6;\\n}\\n.json-formatter-row.json-formatter-open > .json-formatter-toggler-link .json-formatter-toggler:after {\\n transform: rotate(90deg);\\n}\\n.json-formatter-row.json-formatter-open > .json-formatter-children:after {\\n display: inline-block;\\n}\\n.json-formatter-row.json-formatter-open > a > .json-formatter-preview-text {\\n display: none;\\n}\\n.json-formatter-row.json-formatter-open.json-formatter-empty:after {\\n display: block;\\n}\\n.json-formatter-dark.json-formatter-row {\\n font-family: monospace;\\n}\\n.json-formatter-dark.json-formatter-row,\\n.json-formatter-dark.json-formatter-row a,\\n.json-formatter-dark.json-formatter-row a:hover {\\n color: white;\\n text-decoration: none;\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-row {\\n margin-left: 1rem;\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-children.json-formatter-empty {\\n opacity: 0.5;\\n margin-left: 1rem;\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-children.json-formatter-empty:after {\\n display: none;\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-children.json-formatter-empty.json-formatter-object:after {\\n content: \\\"No properties\\\";\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-children.json-formatter-empty.json-formatter-array:after {\\n content: \\\"[]\\\";\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-string,\\n.json-formatter-dark.json-formatter-row .json-formatter-stringifiable {\\n color: #31F031;\\n white-space: pre;\\n word-wrap: break-word;\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-number {\\n color: #66C2FF;\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-boolean {\\n color: #EC4242;\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-null {\\n color: #EEC97D;\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-undefined {\\n color: #ef8fbe;\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-function {\\n color: #FD48CB;\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-date {\\n background-color: rgba(255, 255, 255, 0.05);\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-url {\\n text-decoration: underline;\\n color: #027BFF;\\n cursor: pointer;\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-bracket {\\n color: #9494FF;\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-key {\\n color: #23A0DB;\\n padding-right: 0.2rem;\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-toggler-link {\\n cursor: pointer;\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-toggler {\\n line-height: 1.2rem;\\n font-size: 0.7rem;\\n vertical-align: middle;\\n opacity: 0.6;\\n cursor: pointer;\\n padding-right: 0.2rem;\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-toggler:after {\\n display: inline-block;\\n transition: transform 100ms ease-in;\\n content: \\\"\\\\25BA\\\";\\n}\\n.json-formatter-dark.json-formatter-row > a > .json-formatter-preview-text {\\n opacity: 0;\\n transition: opacity 0.15s ease-in;\\n font-style: italic;\\n}\\n.json-formatter-dark.json-formatter-row:hover > a > .json-formatter-preview-text {\\n opacity: 0.6;\\n}\\n.json-formatter-dark.json-formatter-row.json-formatter-open > .json-formatter-toggler-link .json-formatter-toggler:after {\\n transform: rotate(90deg);\\n}\\n.json-formatter-dark.json-formatter-row.json-formatter-open > .json-formatter-children:after {\\n display: inline-block;\\n}\\n.json-formatter-dark.json-formatter-row.json-formatter-open > a > .json-formatter-preview-text {\\n display: none;\\n}\\n.json-formatter-dark.json-formatter-row.json-formatter-open.json-formatter-empty:after {\\n display: block;\\n}\\n\");\n", " },\n", " function(Bokeh) {\n", " inject_raw_css(\".codehilite .hll { background-color: #ffffcc }\\n.codehilite { background: #f8f8f8; }\\n.codehilite .c { color: #408080; font-style: italic } /* Comment */\\n.codehilite .err { border: 1px solid #FF0000 } /* Error */\\n.codehilite .k { color: #008000; font-weight: bold } /* Keyword */\\n.codehilite .o { color: #666666 } /* Operator */\\n.codehilite .ch { color: #408080; font-style: italic } /* Comment.Hashbang */\\n.codehilite .cm { color: #408080; font-style: italic } /* Comment.Multiline */\\n.codehilite .cp { color: #BC7A00 } /* Comment.Preproc */\\n.codehilite .cpf { color: #408080; font-style: italic } /* Comment.PreprocFile */\\n.codehilite .c1 { color: #408080; font-style: italic } /* Comment.Single */\\n.codehilite .cs { color: #408080; font-style: italic } /* Comment.Special */\\n.codehilite .gd { color: #A00000 } /* Generic.Deleted */\\n.codehilite .ge { font-style: italic } /* Generic.Emph */\\n.codehilite .gr { color: #FF0000 } /* Generic.Error */\\n.codehilite .gh { color: #000080; font-weight: bold } /* Generic.Heading */\\n.codehilite .gi { color: #00A000 } /* Generic.Inserted */\\n.codehilite .go { color: #888888 } /* Generic.Output */\\n.codehilite .gp { color: #000080; font-weight: bold } /* Generic.Prompt */\\n.codehilite .gs { font-weight: bold } /* Generic.Strong */\\n.codehilite .gu { color: #800080; font-weight: bold } /* Generic.Subheading */\\n.codehilite .gt { color: #0044DD } /* Generic.Traceback */\\n.codehilite .kc { color: #008000; font-weight: bold } /* Keyword.Constant */\\n.codehilite .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */\\n.codehilite .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */\\n.codehilite .kp { color: #008000 } /* Keyword.Pseudo */\\n.codehilite .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */\\n.codehilite .kt { color: #B00040 } /* Keyword.Type */\\n.codehilite .m { color: #666666 } /* Literal.Number */\\n.codehilite .s { color: #BA2121 } /* Literal.String */\\n.codehilite .na { color: #7D9029 } /* Name.Attribute */\\n.codehilite .nb { color: #008000 } /* Name.Builtin */\\n.codehilite .nc { color: #0000FF; font-weight: bold } /* Name.Class */\\n.codehilite .no { color: #880000 } /* Name.Constant */\\n.codehilite .nd { color: #AA22FF } /* Name.Decorator */\\n.codehilite .ni { color: #999999; font-weight: bold } /* Name.Entity */\\n.codehilite .ne { color: #D2413A; font-weight: bold } /* Name.Exception */\\n.codehilite .nf { color: #0000FF } /* Name.Function */\\n.codehilite .nl { color: #A0A000 } /* Name.Label */\\n.codehilite .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */\\n.codehilite .nt { color: #008000; font-weight: bold } /* Name.Tag */\\n.codehilite .nv { color: #19177C } /* Name.Variable */\\n.codehilite .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */\\n.codehilite .w { color: #bbbbbb } /* Text.Whitespace */\\n.codehilite .mb { color: #666666 } /* Literal.Number.Bin */\\n.codehilite .mf { color: #666666 } /* Literal.Number.Float */\\n.codehilite .mh { color: #666666 } /* Literal.Number.Hex */\\n.codehilite .mi { color: #666666 } /* Literal.Number.Integer */\\n.codehilite .mo { color: #666666 } /* Literal.Number.Oct */\\n.codehilite .sa { color: #BA2121 } /* Literal.String.Affix */\\n.codehilite .sb { color: #BA2121 } /* Literal.String.Backtick */\\n.codehilite .sc { color: #BA2121 } /* Literal.String.Char */\\n.codehilite .dl { color: #BA2121 } /* Literal.String.Delimiter */\\n.codehilite .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */\\n.codehilite .s2 { color: #BA2121 } /* Literal.String.Double */\\n.codehilite .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */\\n.codehilite .sh { color: #BA2121 } /* Literal.String.Heredoc */\\n.codehilite .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */\\n.codehilite .sx { color: #008000 } /* Literal.String.Other */\\n.codehilite .sr { color: #BB6688 } /* Literal.String.Regex */\\n.codehilite .s1 { color: #BA2121 } /* Literal.String.Single */\\n.codehilite .ss { color: #19177C } /* Literal.String.Symbol */\\n.codehilite .bp { color: #008000 } /* Name.Builtin.Pseudo */\\n.codehilite .fm { color: #0000FF } /* Name.Function.Magic */\\n.codehilite .vc { color: #19177C } /* Name.Variable.Class */\\n.codehilite .vg { color: #19177C } /* Name.Variable.Global */\\n.codehilite .vi { color: #19177C } /* Name.Variable.Instance */\\n.codehilite .vm { color: #19177C } /* Name.Variable.Magic */\\n.codehilite .il { color: #666666 } /* Literal.Number.Integer.Long */\\n\\n.markdown h1 { margin-block-start: 0.34em }\\n.markdown h2 { margin-block-start: 0.42em }\\n.markdown h3 { margin-block-start: 0.5em }\\n.markdown h4 { margin-block-start: 0.67em }\\n.markdown h5 { margin-block-start: 0.84em }\\n.markdown h6 { margin-block-start: 1.17em }\\n.markdown ul { padding-inline-start: 2em }\\n.markdown ol { padding-inline-start: 2em }\\n.markdown strong { font-weight: 600 }\\n.markdown a { color: -webkit-link }\\n.markdown a { color: -moz-hyperlinkText }\\n\");\n", " },\n", " function(Bokeh) {\n", " inject_raw_css(\".panel-widget-box {\\n\\tmin-height: 20px;\\n\\tbackground-color: #f5f5f5;\\n\\tborder: 1px solid #e3e3e3 !important;\\n\\tborder-radius: 4px;\\n\\t-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.05);\\n\\tbox-shadow: inset 0 1px 1px rgba(0,0,0,.05);\\n\\toverflow-x: hidden;\\n\\toverflow-y: hidden;\\n}\\n\\n.scrollable {\\n overflow: scroll;\\n}\\n\\nprogress {\\n\\tappearance: none;\\n\\t-moz-appearance: none;\\n\\t-webkit-appearance: none;\\n\\n\\tborder: none;\\n\\theight: 20px;\\n\\tbackground-color: whiteSmoke;\\n\\tborder-radius: 3px;\\n\\tbox-shadow: 0 2px 3px rgba(0,0,0,.5) inset;\\n\\tcolor: royalblue;\\n\\tposition: relative;\\n\\tmargin: 0 0 1.5em;\\n}\\n\\nprogress[value]::-webkit-progress-bar {\\n\\tbackground-color: whiteSmoke;\\n\\tborder-radius: 3px;\\n\\tbox-shadow: 0 2px 3px rgba(0,0,0,.5) inset;\\n}\\n\\nprogress[value]::-webkit-progress-value {\\n\\tposition: relative;\\n\\n\\tbackground-size: 35px 20px, 100% 100%, 100% 100%;\\n\\tborder-radius:3px;\\n}\\n\\nprogress.active:not([value])::before {\\n\\tbackground-position: 10%;\\n\\tanimation-name: stripes;\\n\\tanimation-duration: 3s;\\n\\tanimation-timing-function: linear;\\n\\tanimation-iteration-count: infinite;\\n}\\n\\nprogress[value]::-moz-progress-bar {\\n\\tbackground-size: 35px 20px, 100% 100%, 100% 100%;\\n\\tborder-radius:3px;\\n}\\n\\nprogress:not([value])::-moz-progress-bar {\\n\\tborder-radius:3px;\\n\\tbackground:\\n\\tlinear-gradient(-45deg, transparent 33%, rgba(0, 0, 0, 0.2) 33%, rgba(0, 0, 0, 0.2) 66%, transparent 66%) left/2.5em 1.5em;\\n\\n}\\n\\nprogress.active:not([value])::-moz-progress-bar {\\n\\tbackground-position: 10%;\\n\\tanimation-name: stripes;\\n\\tanimation-duration: 3s;\\n\\tanimation-timing-function: linear;\\n\\tanimation-iteration-count: infinite;\\n}\\n\\nprogress.active:not([value])::-webkit-progress-bar {\\n\\tbackground-position: 10%;\\n\\tanimation-name: stripes;\\n\\tanimation-duration: 3s;\\n\\tanimation-timing-function: linear;\\n\\tanimation-iteration-count: infinite;\\n}\\n\\nprogress.primary[value]::-webkit-progress-value { background-color: #007bff; }\\nprogress.primary:not([value])::before { background-color: #007bff; }\\nprogress.primary:not([value])::-webkit-progress-bar { background-color: #007bff; }\\nprogress.primary::-moz-progress-bar { background-color: #007bff; }\\n\\nprogress.secondary[value]::-webkit-progress-value { background-color: #6c757d; }\\nprogress.secondary:not([value])::before { background-color: #6c757d; }\\nprogress.secondary:not([value])::-webkit-progress-bar { background-color: #6c757d; }\\nprogress.secondary::-moz-progress-bar { background-color: #6c757d; }\\n\\nprogress.success[value]::-webkit-progress-value { background-color: #28a745; }\\nprogress.success:not([value])::before { background-color: #28a745; }\\nprogress.success:not([value])::-webkit-progress-bar { background-color: #28a745; }\\nprogress.success::-moz-progress-bar { background-color: #28a745; }\\n\\nprogress.danger[value]::-webkit-progress-value { background-color: #dc3545; }\\nprogress.danger:not([value])::before { background-color: #dc3545; }\\nprogress.danger:not([value])::-webkit-progress-bar { background-color: #dc3545; }\\nprogress.danger::-moz-progress-bar { background-color: #dc3545; }\\n\\nprogress.warning[value]::-webkit-progress-value { background-color: #ffc107; }\\nprogress.warning:not([value])::before { background-color: #ffc107; }\\nprogress.warning:not([value])::-webkit-progress-bar { background-color: #ffc107; }\\nprogress.warning::-moz-progress-bar { background-color: #ffc107; }\\n\\nprogress.info[value]::-webkit-progress-value { background-color: #17a2b8; }\\nprogress.info:not([value])::before { background-color: #17a2b8; }\\nprogress.info:not([value])::-webkit-progress-bar { background-color: #17a2b8; }\\nprogress.info::-moz-progress-bar { background-color: #17a2b8; }\\n\\nprogress.light[value]::-webkit-progress-value { background-color: #f8f9fa; }\\nprogress.light:not([value])::before { background-color: #f8f9fa; }\\nprogress.light:not([value])::-webkit-progress-bar { background-color: #f8f9fa; }\\nprogress.light::-moz-progress-bar { background-color: #f8f9fa; }\\n\\nprogress.dark[value]::-webkit-progress-value { background-color: #343a40; }\\nprogress.dark:not([value])::-webkit-progress-bar { background-color: #343a40; }\\nprogress.dark:not([value])::before { background-color: #343a40; }\\nprogress.dark::-moz-progress-bar { background-color: #343a40; }\\n\\nprogress:not([value])::-webkit-progress-bar {\\n\\tborder-radius: 3px;\\n\\tbackground:\\n\\tlinear-gradient(-45deg, transparent 33%, rgba(0, 0, 0, 0.2) 33%, rgba(0, 0, 0, 0.2) 66%, transparent 66%) left/2.5em 1.5em;\\n}\\nprogress:not([value])::before {\\n\\tcontent:\\\" \\\";\\n\\tposition:absolute;\\n\\theight: 20px;\\n\\ttop:0;\\n\\tleft:0;\\n\\tright:0;\\n\\tbottom:0;\\n\\tborder-radius: 3px;\\n\\tbackground:\\n\\tlinear-gradient(-45deg, transparent 33%, rgba(0, 0, 0, 0.2) 33%, rgba(0, 0, 0, 0.2) 66%, transparent 66%) left/2.5em 1.5em;\\n}\\n\\n@keyframes stripes {\\n from {background-position: 0%}\\n to {background-position: 100%}\\n}\\n\");\n", " },\n", " function(Bokeh) {\n", " /* BEGIN bokeh.js */\n", " /*!\n", " * Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors\n", " * All rights reserved.\n", " * \n", " * Redistribution and use in source and binary forms, with or without modification,\n", " * are permitted provided that the following conditions are met:\n", " * \n", " * Redistributions of source code must retain the above copyright notice,\n", " * this list of conditions and the following disclaimer.\n", " * \n", " * Redistributions in binary form must reproduce the above copyright notice,\n", " * this list of conditions and the following disclaimer in the documentation\n", " * and/or other materials provided with the distribution.\n", " * \n", " * Neither the name of Anaconda nor the names of any contributors\n", " * may be used to endorse or promote products derived from this software\n", " * without specific prior written permission.\n", " * \n", " * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n", " * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n", " * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n", " * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n", " * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n", " * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n", " * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n", " * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n", " * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n", " * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n", " * THE POSSIBILITY OF SUCH DAMAGE.\n", " */\n", " (function(root, factory) {\n", " const bokeh = factory();\n", " if (root.Bokeh === undefined) {\n", " root.Bokeh = bokeh;\n", " }\n", " const Bokeh = root.Bokeh;\n", " Bokeh[bokeh.version] = bokeh;\n", " })(this, function() {\n", " var define;\n", " var parent_require = typeof require === \"function\" && require\n", " return (function(modules, entry, aliases, externals) {\n", " if (aliases === undefined) aliases = {};\n", " if (externals === undefined) externals = {};\n", "\n", " var cache = {};\n", "\n", " var normalize = function(name) {\n", " if (typeof name === \"number\")\n", " return name;\n", "\n", " if (name === \"bokehjs\")\n", " return entry;\n", "\n", " var prefix = \"@bokehjs/\"\n", " if (name.slice(0, prefix.length) === prefix)\n", " name = name.slice(prefix.length)\n", "\n", " var alias = aliases[name]\n", " if (alias != null)\n", " return alias;\n", "\n", " var trailing = name.length > 0 && name[name.lenght-1] === \"/\";\n", " var index = aliases[name + (trailing ? \"\" : \"/\") + \"index\"];\n", " if (index != null)\n", " return index;\n", "\n", " return name;\n", " }\n", "\n", " var require = function(name) {\n", " var mod = cache[name];\n", " if (!mod) {\n", " var id = normalize(name);\n", "\n", " mod = cache[id];\n", " if (!mod) {\n", " if (!modules[id]) {\n", " if (externals[id] === false || (externals[id] == true && parent_require)) {\n", " try {\n", " mod = {exports: externals[id] ? parent_require(id) : {}};\n", " cache[id] = cache[name] = mod;\n", " return mod.exports;\n", " } catch (e) {}\n", " }\n", "\n", " var err = new Error(\"Cannot find module '\" + name + \"'\");\n", " err.code = 'MODULE_NOT_FOUND';\n", " throw err;\n", " }\n", "\n", " mod = {exports: {}};\n", " cache[id] = cache[name] = mod;\n", " modules[id].call(mod.exports, require, mod, mod.exports);\n", " } else\n", " cache[name] = mod;\n", " }\n", "\n", " return mod.exports;\n", " }\n", "\n", " var main = require(entry);\n", " main.require = require;\n", "\n", " if (typeof Proxy !== \"undefined\") {\n", " // allow Bokeh.loader[\"@bokehjs/module/name\"] syntax\n", " main.loader = new Proxy({}, {\n", " get: function(_obj, module) {\n", " return require(module);\n", " }\n", " });\n", " }\n", "\n", " main.register_plugin = function(plugin_modules, plugin_entry, plugin_aliases, plugin_externals) {\n", " if (plugin_aliases === undefined) plugin_aliases = {};\n", " if (plugin_externals === undefined) plugin_externals = {};\n", "\n", " for (var name in plugin_modules) {\n", " modules[name] = plugin_modules[name];\n", " }\n", "\n", " for (var name in plugin_aliases) {\n", " aliases[name] = plugin_aliases[name];\n", " }\n", "\n", " for (var name in plugin_externals) {\n", " externals[name] = plugin_externals[name];\n", " }\n", "\n", " var plugin = require(plugin_entry);\n", "\n", " for (var name in plugin) {\n", " main[name] = plugin[name];\n", " }\n", "\n", " return plugin;\n", " }\n", "\n", " return main;\n", " })\n", " ([\n", " /* main.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " tslib_1.__exportStar(require(2) /* ./index */, exports);\n", " },\n", " /* tslib/tslib.es6.js */ function _(require, module, exports) {\n", " /*! *****************************************************************************\n", " Copyright (c) Microsoft Corporation. All rights reserved.\n", " Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use\n", " this file except in compliance with the License. You may obtain a copy of the\n", " License at http://www.apache.org/licenses/LICENSE-2.0\n", " \n", " THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n", " KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\n", " WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\n", " MERCHANTABLITY OR NON-INFRINGEMENT.\n", " \n", " See the Apache Version 2.0 License for specific language governing permissions\n", " and limitations under the License.\n", " ***************************************************************************** */\n", " /* global Reflect, Promise */\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var extendStatics = function (d, b) {\n", " extendStatics = Object.setPrototypeOf ||\n", " ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n", " function (d, b) {\n", " for (var p in b)\n", " if (b.hasOwnProperty(p))\n", " d[p] = b[p];\n", " };\n", " return extendStatics(d, b);\n", " };\n", " function __extends(d, b) {\n", " extendStatics(d, b);\n", " function __() { this.constructor = d; }\n", " d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n", " }\n", " exports.__extends = __extends;\n", " exports.__assign = function () {\n", " exports.__assign = Object.assign || function __assign(t) {\n", " for (var s, i = 1, n = arguments.length; i < n; i++) {\n", " s = arguments[i];\n", " for (var p in s)\n", " if (Object.prototype.hasOwnProperty.call(s, p))\n", " t[p] = s[p];\n", " }\n", " return t;\n", " };\n", " return exports.__assign.apply(this, arguments);\n", " };\n", " function __rest(s, e) {\n", " var t = {};\n", " for (var p in s)\n", " if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n", " t[p] = s[p];\n", " if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n", " for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n", " if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n", " t[p[i]] = s[p[i]];\n", " }\n", " return t;\n", " }\n", " exports.__rest = __rest;\n", " function __decorate(decorators, target, key, desc) {\n", " var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n", " if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\")\n", " r = Reflect.decorate(decorators, target, key, desc);\n", " else\n", " for (var i = decorators.length - 1; i >= 0; i--)\n", " if (d = decorators[i])\n", " r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n", " return c > 3 && r && Object.defineProperty(target, key, r), r;\n", " }\n", " exports.__decorate = __decorate;\n", " function __param(paramIndex, decorator) {\n", " return function (target, key) { decorator(target, key, paramIndex); };\n", " }\n", " exports.__param = __param;\n", " function __metadata(metadataKey, metadataValue) {\n", " if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\")\n", " return Reflect.metadata(metadataKey, metadataValue);\n", " }\n", " exports.__metadata = __metadata;\n", " function __awaiter(thisArg, _arguments, P, generator) {\n", " function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n", " return new (P || (P = Promise))(function (resolve, reject) {\n", " function fulfilled(value) {\n", " try {\n", " step(generator.next(value));\n", " }\n", " catch (e) {\n", " reject(e);\n", " }\n", " }\n", " function rejected(value) {\n", " try {\n", " step(generator[\"throw\"](value));\n", " }\n", " catch (e) {\n", " reject(e);\n", " }\n", " }\n", " function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n", " step((generator = generator.apply(thisArg, _arguments || [])).next());\n", " });\n", " }\n", " exports.__awaiter = __awaiter;\n", " function __generator(thisArg, body) {\n", " var _ = { label: 0, sent: function () {\n", " if (t[0] & 1)\n", " throw t[1];\n", " return t[1];\n", " }, trys: [], ops: [] }, f, y, t, g;\n", " return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function () { return this; }), g;\n", " function verb(n) { return function (v) { return step([n, v]); }; }\n", " function step(op) {\n", " if (f)\n", " throw new TypeError(\"Generator is already executing.\");\n", " while (_)\n", " try {\n", " if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)\n", " return t;\n", " if (y = 0, t)\n", " op = [op[0] & 2, t.value];\n", " switch (op[0]) {\n", " case 0:\n", " case 1:\n", " t = op;\n", " break;\n", " case 4:\n", " _.label++;\n", " return { value: op[1], done: false };\n", " case 5:\n", " _.label++;\n", " y = op[1];\n", " op = [0];\n", " continue;\n", " case 7:\n", " op = _.ops.pop();\n", " _.trys.pop();\n", " continue;\n", " default:\n", " if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n", " _ = 0;\n", " continue;\n", " }\n", " if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {\n", " _.label = op[1];\n", " break;\n", " }\n", " if (op[0] === 6 && _.label < t[1]) {\n", " _.label = t[1];\n", " t = op;\n", " break;\n", " }\n", " if (t && _.label < t[2]) {\n", " _.label = t[2];\n", " _.ops.push(op);\n", " break;\n", " }\n", " if (t[2])\n", " _.ops.pop();\n", " _.trys.pop();\n", " continue;\n", " }\n", " op = body.call(thisArg, _);\n", " }\n", " catch (e) {\n", " op = [6, e];\n", " y = 0;\n", " }\n", " finally {\n", " f = t = 0;\n", " }\n", " if (op[0] & 5)\n", " throw op[1];\n", " return { value: op[0] ? op[1] : void 0, done: true };\n", " }\n", " }\n", " exports.__generator = __generator;\n", " function __exportStar(m, exports) {\n", " for (var p in m)\n", " if (!exports.hasOwnProperty(p))\n", " exports[p] = m[p];\n", " }\n", " exports.__exportStar = __exportStar;\n", " function __values(o) {\n", " var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n", " if (m)\n", " return m.call(o);\n", " if (o && typeof o.length === \"number\")\n", " return {\n", " next: function () {\n", " if (o && i >= o.length)\n", " o = void 0;\n", " return { value: o && o[i++], done: !o };\n", " }\n", " };\n", " throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n", " }\n", " exports.__values = __values;\n", " function __read(o, n) {\n", " var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n", " if (!m)\n", " return o;\n", " var i = m.call(o), r, ar = [], e;\n", " try {\n", " while ((n === void 0 || n-- > 0) && !(r = i.next()).done)\n", " ar.push(r.value);\n", " }\n", " catch (error) {\n", " e = { error: error };\n", " }\n", " finally {\n", " try {\n", " if (r && !r.done && (m = i[\"return\"]))\n", " m.call(i);\n", " }\n", " finally {\n", " if (e)\n", " throw e.error;\n", " }\n", " }\n", " return ar;\n", " }\n", " exports.__read = __read;\n", " function __spread() {\n", " for (var ar = [], i = 0; i < arguments.length; i++)\n", " ar = ar.concat(__read(arguments[i]));\n", " return ar;\n", " }\n", " exports.__spread = __spread;\n", " function __spreadArrays() {\n", " for (var s = 0, i = 0, il = arguments.length; i < il; i++)\n", " s += arguments[i].length;\n", " for (var r = Array(s), k = 0, i = 0; i < il; i++)\n", " for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n", " r[k] = a[j];\n", " return r;\n", " }\n", " exports.__spreadArrays = __spreadArrays;\n", " ;\n", " function __await(v) {\n", " return this instanceof __await ? (this.v = v, this) : new __await(v);\n", " }\n", " exports.__await = __await;\n", " function __asyncGenerator(thisArg, _arguments, generator) {\n", " if (!Symbol.asyncIterator)\n", " throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n", " var g = generator.apply(thisArg, _arguments || []), i, q = [];\n", " return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\n", " function verb(n) {\n", " if (g[n])\n", " i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); };\n", " }\n", " function resume(n, v) {\n", " try {\n", " step(g[n](v));\n", " }\n", " catch (e) {\n", " settle(q[0][3], e);\n", " }\n", " }\n", " function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n", " function fulfill(value) { resume(\"next\", value); }\n", " function reject(value) { resume(\"throw\", value); }\n", " function settle(f, v) {\n", " if (f(v), q.shift(), q.length)\n", " resume(q[0][0], q[0][1]);\n", " }\n", " }\n", " exports.__asyncGenerator = __asyncGenerator;\n", " function __asyncDelegator(o) {\n", " var i, p;\n", " return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n", " function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\n", " }\n", " exports.__asyncDelegator = __asyncDelegator;\n", " function __asyncValues(o) {\n", " if (!Symbol.asyncIterator)\n", " throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n", " var m = o[Symbol.asyncIterator], i;\n", " return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n", " function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n", " function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }\n", " }\n", " exports.__asyncValues = __asyncValues;\n", " function __makeTemplateObject(cooked, raw) {\n", " if (Object.defineProperty) {\n", " Object.defineProperty(cooked, \"raw\", { value: raw });\n", " }\n", " else {\n", " cooked.raw = raw;\n", " }\n", " return cooked;\n", " }\n", " exports.__makeTemplateObject = __makeTemplateObject;\n", " ;\n", " function __importStar(mod) {\n", " if (mod && mod.__esModule)\n", " return mod;\n", " var result = {};\n", " if (mod != null)\n", " for (var k in mod)\n", " if (Object.hasOwnProperty.call(mod, k))\n", " result[k] = mod[k];\n", " result.default = mod;\n", " return result;\n", " }\n", " exports.__importStar = __importStar;\n", " function __importDefault(mod) {\n", " return (mod && mod.__esModule) ? mod : { default: mod };\n", " }\n", " exports.__importDefault = __importDefault;\n", " function __classPrivateFieldGet(receiver, privateMap) {\n", " if (!privateMap.has(receiver)) {\n", " throw new TypeError(\"attempted to get private field on non-instance\");\n", " }\n", " return privateMap.get(receiver);\n", " }\n", " exports.__classPrivateFieldGet = __classPrivateFieldGet;\n", " function __classPrivateFieldSet(receiver, privateMap, value) {\n", " if (!privateMap.has(receiver)) {\n", " throw new TypeError(\"attempted to set private field on non-instance\");\n", " }\n", " privateMap.set(receiver, value);\n", " return value;\n", " }\n", " exports.__classPrivateFieldSet = __classPrivateFieldSet;\n", " },\n", " /* index.js */ function _(require, module, exports) {\n", " var __importStar = (this && this.__importStar) || function (mod) {\n", " if (mod && mod.__esModule)\n", " return mod;\n", " var result = {};\n", " if (mod != null)\n", " for (var k in mod)\n", " if (Object.hasOwnProperty.call(mod, k))\n", " result[k] = mod[k];\n", " result[\"default\"] = mod;\n", " return result;\n", " };\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var version_1 = require(3) /* ./version */;\n", " exports.version = version_1.version;\n", " var embed_1 = require(4) /* ./embed */;\n", " exports.index = embed_1.index;\n", " exports.embed = __importStar(require(4) /* ./embed */);\n", " exports.protocol = __importStar(require(367) /* ./protocol */);\n", " exports._testing = __importStar(require(368) /* ./testing */);\n", " var logging_1 = require(72) /* ./core/logging */;\n", " exports.logger = logging_1.logger;\n", " exports.set_log_level = logging_1.set_log_level;\n", " var settings_1 = require(22) /* ./core/settings */;\n", " exports.settings = settings_1.settings;\n", " var base_1 = require(7) /* ./base */;\n", " exports.Models = base_1.Models;\n", " var document_1 = require(5) /* ./document */;\n", " exports.documents = document_1.documents;\n", " var safely_1 = require(369) /* ./safely */;\n", " exports.safely = safely_1.safely;\n", " },\n", " /* version.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.version = \"2.1.1\";\n", " },\n", " /* embed/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const document_1 = require(5) /* ../document */;\n", " const logging_1 = require(72) /* ../core/logging */;\n", " const string_1 = require(24) /* ../core/util/string */;\n", " const types_1 = require(8) /* ../core/util/types */;\n", " const callback_1 = require(15) /* ../core/util/callback */;\n", " const standalone_1 = require(358) /* ./standalone */;\n", " const server_1 = require(360) /* ./server */;\n", " const dom_1 = require(359) /* ./dom */;\n", " var standalone_2 = require(358) /* ./standalone */;\n", " exports.add_document_standalone = standalone_2.add_document_standalone;\n", " exports.index = standalone_2.index;\n", " var server_2 = require(360) /* ./server */;\n", " exports.add_document_from_session = server_2.add_document_from_session;\n", " var notebook_1 = require(365) /* ./notebook */;\n", " exports.embed_items_notebook = notebook_1.embed_items_notebook;\n", " exports.kernels = notebook_1.kernels;\n", " var dom_2 = require(359) /* ./dom */;\n", " exports.BOKEH_ROOT = dom_2.BOKEH_ROOT;\n", " async function embed_item(item, target_id) {\n", " const docs_json = {};\n", " const doc_id = string_1.uuid4();\n", " docs_json[doc_id] = item.doc;\n", " if (target_id == null)\n", " target_id = item.target_id;\n", " const element = document.getElementById(target_id);\n", " if (element != null)\n", " element.classList.add(dom_1.BOKEH_ROOT);\n", " const roots = { [item.root_id]: target_id };\n", " const render_item = { roots, root_ids: [item.root_id], docid: doc_id };\n", " const [views] = await callback_1.defer(() => _embed_items(docs_json, [render_item]));\n", " return views;\n", " }\n", " exports.embed_item = embed_item;\n", " // TODO (bev) this is currently clunky. Standalone embeds only provide\n", " // the first two args, whereas server provide the app_app, and *may* prove and\n", " // absolute_url as well if non-relative links are needed for resources. This function\n", " // should probably be split in to two pieces to reflect the different usage patterns\n", " async function embed_items(docs_json, render_items, app_path, absolute_url) {\n", " return await callback_1.defer(() => _embed_items(docs_json, render_items, app_path, absolute_url));\n", " }\n", " exports.embed_items = embed_items;\n", " async function _embed_items(docs_json, render_items, app_path, absolute_url) {\n", " if (types_1.isString(docs_json))\n", " docs_json = JSON.parse(string_1.unescape(docs_json));\n", " const docs = {};\n", " for (const docid in docs_json) {\n", " const doc_json = docs_json[docid];\n", " docs[docid] = document_1.Document.from_json(doc_json);\n", " }\n", " const views = [];\n", " for (const item of render_items) {\n", " const element = dom_1._resolve_element(item);\n", " const roots = dom_1._resolve_root_elements(item);\n", " if (item.docid != null) {\n", " views.push(await standalone_1.add_document_standalone(docs[item.docid], element, roots, item.use_for_title));\n", " }\n", " else if (item.token != null) {\n", " const websocket_url = server_1._get_ws_url(app_path, absolute_url);\n", " logging_1.logger.debug(`embed: computed ws url: ${websocket_url}`);\n", " try {\n", " views.push(await server_1.add_document_from_session(websocket_url, item.token, element, roots, item.use_for_title));\n", " console.log(\"Bokeh items were rendered successfully\");\n", " }\n", " catch (error) {\n", " console.log(\"Error rendering Bokeh items:\", error);\n", " }\n", " }\n", " else\n", " throw new Error(`Error rendering Bokeh items: either 'docid' or 'token' was expected.`);\n", " }\n", " return views;\n", " }\n", " },\n", " /* document/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " tslib_1.__exportStar(require(6) /* ./document */, exports);\n", " tslib_1.__exportStar(require(105) /* ./events */, exports);\n", " },\n", " /* document/document.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const base_1 = require(7) /* ../base */;\n", " const version_1 = require(3) /* ../version */;\n", " const logging_1 = require(72) /* ../core/logging */;\n", " const bokeh_events_1 = require(291) /* ../core/bokeh_events */;\n", " const has_props_1 = require(13) /* ../core/has_props */;\n", " const signaling_1 = require(14) /* ../core/signaling */;\n", " const refs_1 = require(16) /* ../core/util/refs */;\n", " const serialization_1 = require(27) /* ../core/util/serialization */;\n", " const array_1 = require(9) /* ../core/util/array */;\n", " const sets = tslib_1.__importStar(require(104) /* ../core/util/set */);\n", " const eq_1 = require(25) /* ../core/util/eq */;\n", " const types_1 = require(8) /* ../core/util/types */;\n", " const layout_dom_1 = require(245) /* ../models/layouts/layout_dom */;\n", " const column_data_source_1 = require(76) /* ../models/sources/column_data_source */;\n", " const model_1 = require(71) /* ../model */;\n", " const events_1 = require(105) /* ./events */;\n", " // Dispatches events to the subscribed models\n", " class EventManager {\n", " constructor(document) {\n", " this.document = document;\n", " this.session = null;\n", " this.subscribed_models = new Set();\n", " }\n", " send_event(bokeh_event) {\n", " const event = new events_1.MessageSentEvent(this.document, \"bokeh_event\", bokeh_event.to_json());\n", " this.document._trigger_on_change(event);\n", " }\n", " trigger(event) {\n", " for (const model of this.subscribed_models) {\n", " if (event.origin != null && event.origin != model)\n", " continue;\n", " model._process_event(event);\n", " }\n", " }\n", " }\n", " exports.EventManager = EventManager;\n", " EventManager.__name__ = \"EventManager\";\n", " exports.documents = [];\n", " exports.DEFAULT_TITLE = \"Bokeh Application\";\n", " // This class should match the API of the Python Document class\n", " // as much as possible.\n", " class Document {\n", " constructor() {\n", " exports.documents.push(this);\n", " this._init_timestamp = Date.now();\n", " this._title = exports.DEFAULT_TITLE;\n", " this._roots = [];\n", " this._all_models = new Map();\n", " this._all_models_freeze_count = 0;\n", " this._callbacks = new Map();\n", " this._message_callbacks = new Map();\n", " this.event_manager = new EventManager(this);\n", " this.idle = new signaling_1.Signal0(this, \"idle\");\n", " this._idle_roots = new WeakMap(); // TODO: WeakSet would be better\n", " this._interactive_timestamp = null;\n", " this._interactive_plot = null;\n", " }\n", " get layoutables() {\n", " return this._roots.filter((root) => root instanceof layout_dom_1.LayoutDOM);\n", " }\n", " get is_idle() {\n", " for (const root of this.layoutables) {\n", " if (!this._idle_roots.has(root))\n", " return false;\n", " }\n", " return true;\n", " }\n", " notify_idle(model) {\n", " this._idle_roots.set(model, true);\n", " if (this.is_idle) {\n", " logging_1.logger.info(`document idle at ${Date.now() - this._init_timestamp} ms`);\n", " this.idle.emit();\n", " }\n", " }\n", " clear() {\n", " this._push_all_models_freeze();\n", " try {\n", " while (this._roots.length > 0) {\n", " this.remove_root(this._roots[0]);\n", " }\n", " }\n", " finally {\n", " this._pop_all_models_freeze();\n", " }\n", " }\n", " interactive_start(plot) {\n", " if (this._interactive_plot == null) {\n", " this._interactive_plot = plot;\n", " this._interactive_plot.trigger_event(new bokeh_events_1.LODStart());\n", " }\n", " this._interactive_timestamp = Date.now();\n", " }\n", " interactive_stop(plot) {\n", " if (this._interactive_plot != null && this._interactive_plot.id === plot.id) {\n", " this._interactive_plot.trigger_event(new bokeh_events_1.LODEnd());\n", " }\n", " this._interactive_plot = null;\n", " this._interactive_timestamp = null;\n", " }\n", " interactive_duration() {\n", " if (this._interactive_timestamp == null)\n", " return -1;\n", " else\n", " return Date.now() - this._interactive_timestamp;\n", " }\n", " destructively_move(dest_doc) {\n", " if (dest_doc === this) {\n", " throw new Error(\"Attempted to overwrite a document with itself\");\n", " }\n", " dest_doc.clear();\n", " // we have to remove ALL roots before adding any\n", " // to the new doc or else models referenced from multiple\n", " // roots could be in both docs at once, which isn't allowed.\n", " const roots = array_1.copy(this._roots);\n", " this.clear();\n", " for (const root of roots) {\n", " if (root.document != null)\n", " throw new Error(`Somehow we didn't detach ${root}`);\n", " }\n", " if (this._all_models.size != 0) {\n", " throw new Error(`this._all_models still had stuff in it: ${this._all_models}`);\n", " }\n", " for (const root of roots) {\n", " dest_doc.add_root(root);\n", " }\n", " dest_doc.set_title(this._title);\n", " }\n", " // TODO other fields of doc\n", " _push_all_models_freeze() {\n", " this._all_models_freeze_count += 1;\n", " }\n", " _pop_all_models_freeze() {\n", " this._all_models_freeze_count -= 1;\n", " if (this._all_models_freeze_count === 0) {\n", " this._recompute_all_models();\n", " }\n", " }\n", " /*protected*/ _invalidate_all_models() {\n", " logging_1.logger.debug(\"invalidating document models\");\n", " // if freeze count is > 0, we'll recompute on unfreeze\n", " if (this._all_models_freeze_count === 0) {\n", " this._recompute_all_models();\n", " }\n", " }\n", " _recompute_all_models() {\n", " let new_all_models_set = new Set();\n", " for (const r of this._roots) {\n", " new_all_models_set = sets.union(new_all_models_set, r.references());\n", " }\n", " const old_all_models_set = new Set(this._all_models.values());\n", " const to_detach = sets.difference(old_all_models_set, new_all_models_set);\n", " const to_attach = sets.difference(new_all_models_set, old_all_models_set);\n", " const recomputed = new Map();\n", " for (const model of new_all_models_set) {\n", " recomputed.set(model.id, model);\n", " }\n", " for (const d of to_detach) {\n", " d.detach_document();\n", " }\n", " for (const a of to_attach) {\n", " a.attach_document(this);\n", " }\n", " this._all_models = recomputed;\n", " }\n", " roots() {\n", " return this._roots;\n", " }\n", " add_root(model, setter_id) {\n", " logging_1.logger.debug(`Adding root: ${model}`);\n", " if (array_1.includes(this._roots, model))\n", " return;\n", " this._push_all_models_freeze();\n", " try {\n", " this._roots.push(model);\n", " }\n", " finally {\n", " this._pop_all_models_freeze();\n", " }\n", " this._trigger_on_change(new events_1.RootAddedEvent(this, model, setter_id));\n", " }\n", " remove_root(model, setter_id) {\n", " const i = this._roots.indexOf(model);\n", " if (i < 0)\n", " return;\n", " this._push_all_models_freeze();\n", " try {\n", " this._roots.splice(i, 1);\n", " }\n", " finally {\n", " this._pop_all_models_freeze();\n", " }\n", " this._trigger_on_change(new events_1.RootRemovedEvent(this, model, setter_id));\n", " }\n", " title() {\n", " return this._title;\n", " }\n", " set_title(title, setter_id) {\n", " if (title !== this._title) {\n", " this._title = title;\n", " this._trigger_on_change(new events_1.TitleChangedEvent(this, title, setter_id));\n", " }\n", " }\n", " get_model_by_id(model_id) {\n", " var _a;\n", " return (_a = this._all_models.get(model_id)) !== null && _a !== void 0 ? _a : null;\n", " }\n", " get_model_by_name(name) {\n", " const found = [];\n", " for (const model of this._all_models.values()) {\n", " if (model instanceof model_1.Model && model.name == name)\n", " found.push(model);\n", " }\n", " switch (found.length) {\n", " case 0:\n", " return null;\n", " case 1:\n", " return found[0];\n", " default:\n", " throw new Error(`Multiple models are named '${name}'`);\n", " }\n", " }\n", " on_message(msg_type, callback) {\n", " const message_callbacks = this._message_callbacks.get(msg_type);\n", " if (message_callbacks == null)\n", " this._message_callbacks.set(msg_type, new Set([callback]));\n", " else\n", " message_callbacks.add(callback);\n", " }\n", " remove_on_message(msg_type, callback) {\n", " var _a;\n", " (_a = this._message_callbacks.get(msg_type)) === null || _a === void 0 ? void 0 : _a.delete(callback);\n", " }\n", " _trigger_on_message(msg_type, msg_data) {\n", " const message_callbacks = this._message_callbacks.get(msg_type);\n", " if (message_callbacks != null) {\n", " for (const cb of message_callbacks) {\n", " cb(msg_data);\n", " }\n", " }\n", " }\n", " on_change(callback, allow_batches = false) {\n", " if (!this._callbacks.has(callback)) {\n", " this._callbacks.set(callback, allow_batches);\n", " }\n", " }\n", " remove_on_change(callback) {\n", " this._callbacks.delete(callback);\n", " }\n", " _trigger_on_change(event) {\n", " for (const [callback, allow_batches] of this._callbacks) {\n", " if (!allow_batches && event instanceof events_1.DocumentEventBatch) {\n", " for (const ev of event.events) {\n", " callback(ev);\n", " }\n", " }\n", " else {\n", " callback(event);\n", " }\n", " }\n", " }\n", " _notify_change(model, attr, old_value, new_value, options) {\n", " this._trigger_on_change(new events_1.ModelChangedEvent(this, model, attr, old_value, new_value, options === null || options === void 0 ? void 0 : options.setter_id, options === null || options === void 0 ? void 0 : options.hint));\n", " }\n", " static _references_json(references, include_defaults = true) {\n", " const references_json = [];\n", " for (const r of references) {\n", " const struct = r.struct();\n", " struct.attributes = r.attributes_as_json(include_defaults);\n", " // server doesn't want id in here since it's already in ref above\n", " delete struct.attributes.id;\n", " references_json.push(struct);\n", " }\n", " return references_json;\n", " }\n", " static _instantiate_object(obj_id, obj_type, obj_attrs) {\n", " const full_attrs = Object.assign(Object.assign({}, obj_attrs), { id: obj_id, __deferred__: true });\n", " const model = base_1.Models(obj_type);\n", " return new model(full_attrs);\n", " }\n", " // given a JSON representation of all models in a graph, return a\n", " // dict of new model objects\n", " static _instantiate_references_json(references_json, existing_models) {\n", " // Create all instances, but without setting their props\n", " const references = new Map();\n", " for (const obj of references_json) {\n", " const obj_id = obj.id;\n", " const obj_type = obj.type;\n", " const obj_attrs = obj.attributes || {};\n", " let instance = existing_models.get(obj_id);\n", " if (instance == null) {\n", " instance = Document._instantiate_object(obj_id, obj_type, obj_attrs);\n", " if (obj.subtype != null)\n", " instance.set_subtype(obj.subtype);\n", " }\n", " references.set(instance.id, instance);\n", " }\n", " return references;\n", " }\n", " // if v looks like a ref, or a collection, resolve it, otherwise return it unchanged\n", " // recurse into collections but not into HasProps\n", " static _resolve_refs(value, old_references, new_references, buffers) {\n", " function resolve_ref(v) {\n", " if (refs_1.is_ref(v)) {\n", " if (old_references.has(v.id))\n", " return old_references.get(v.id);\n", " else if (new_references.has(v.id))\n", " return new_references.get(v.id);\n", " else\n", " throw new Error(`reference ${JSON.stringify(v)} isn't known (not in Document?)`);\n", " }\n", " else if (serialization_1.is_NDArray_ref(v)) {\n", " return serialization_1.decode_NDArray(v, buffers);\n", " }\n", " else if (types_1.isArray(v))\n", " return resolve_array(v);\n", " else if (types_1.isPlainObject(v))\n", " return resolve_dict(v);\n", " else\n", " return v;\n", " }\n", " function resolve_array(array) {\n", " const results = [];\n", " for (const v of array) {\n", " results.push(resolve_ref(v));\n", " }\n", " return results;\n", " }\n", " function resolve_dict(dict) {\n", " const resolved = {};\n", " for (const k in dict) {\n", " const v = dict[k];\n", " resolved[k] = resolve_ref(v);\n", " }\n", " return resolved;\n", " }\n", " return resolve_ref(value);\n", " }\n", " // given a JSON representation of all models in a graph and new\n", " // model instances, set the properties on the models from the\n", " // JSON\n", " static _initialize_references_json(references_json, old_references, new_references, buffers) {\n", " const to_update = new Map();\n", " for (const { id, attributes } of references_json) {\n", " const is_new = !old_references.has(id);\n", " const instance = is_new ? new_references.get(id) : old_references.get(id);\n", " // replace references with actual instances in obj_attrs\n", " const resolved_attrs = Document._resolve_refs(attributes, old_references, new_references, buffers);\n", " instance.setv(resolved_attrs, { silent: true });\n", " to_update.set(id, { instance, is_new });\n", " }\n", " const ordered_instances = [];\n", " const handled = new Set();\n", " function finalize_all_by_dfs(v) {\n", " if (v instanceof has_props_1.HasProps) {\n", " // note that we ignore instances that aren't updated (not in to_update)\n", " if (to_update.has(v.id) && !handled.has(v.id)) {\n", " handled.add(v.id);\n", " const { instance, is_new } = to_update.get(v.id);\n", " const { attributes } = instance;\n", " for (const attr in attributes) {\n", " finalize_all_by_dfs(attributes[attr]);\n", " }\n", " if (is_new) {\n", " // Finalizing here just to avoid iterating\n", " // over `ordered_instances` twice.\n", " instance.finalize();\n", " // Preserving an ordered collection of instances\n", " // to avoid having to go through DFS again.\n", " ordered_instances.push(instance);\n", " }\n", " }\n", " }\n", " else if (types_1.isArray(v)) {\n", " for (const e of v)\n", " finalize_all_by_dfs(e);\n", " }\n", " else if (types_1.isPlainObject(v)) {\n", " for (const k in v)\n", " finalize_all_by_dfs(v[k]);\n", " }\n", " }\n", " for (const item of to_update.values()) {\n", " finalize_all_by_dfs(item.instance);\n", " }\n", " // `connect_signals` has to be executed last because it\n", " // may rely on properties of dependencies that are initialized\n", " // only in `finalize`. It's a problem that appears when\n", " // there are circular references, e.g. as in\n", " // CDS -> CustomJS (on data change) -> GlyphRenderer (in args) -> CDS.\n", " for (const instance of ordered_instances) {\n", " instance.connect_signals();\n", " }\n", " }\n", " static _event_for_attribute_change(changed_obj, key, new_value, doc, value_refs) {\n", " const changed_model = doc.get_model_by_id(changed_obj.id); // XXX!\n", " if (!changed_model.property(key).syncable)\n", " return null;\n", " else {\n", " const event = {\n", " kind: \"ModelChanged\",\n", " model: { id: changed_obj.id },\n", " attr: key,\n", " new: new_value,\n", " };\n", " has_props_1.HasProps._json_record_references(doc, new_value, value_refs, { recursive: true });\n", " return event;\n", " }\n", " }\n", " static _events_to_sync_objects(from_obj, to_obj, to_doc, value_refs) {\n", " const from_keys = Object.keys(from_obj.attributes); //XXX!\n", " const to_keys = Object.keys(to_obj.attributes); //XXX!\n", " const removed = array_1.difference(from_keys, to_keys);\n", " const added = array_1.difference(to_keys, from_keys);\n", " const shared = array_1.intersection(from_keys, to_keys);\n", " const events = [];\n", " for (const key of removed) {\n", " // we don't really have a \"remove\" event - not sure this ever\n", " // happens even. One way this could happen is if the server\n", " // does include_defaults=True and we do\n", " // include_defaults=false ... in that case it'd be best to\n", " // just ignore this probably. Warn about it, could mean\n", " // there's a bug if we don't have a key that the server sent.\n", " logging_1.logger.warn(`Server sent key ${key} but we don't seem to have it in our JSON`);\n", " }\n", " for (const key of added) {\n", " const new_value = to_obj.attributes[key]; // XXX!\n", " events.push(Document._event_for_attribute_change(from_obj, key, new_value, to_doc, value_refs));\n", " }\n", " for (const key of shared) {\n", " const old_value = from_obj.attributes[key]; // XXX!\n", " const new_value = to_obj.attributes[key]; // XXX!\n", " if (old_value == null && new_value == null) {\n", " }\n", " else if (old_value == null || new_value == null) {\n", " events.push(Document._event_for_attribute_change(from_obj, key, new_value, to_doc, value_refs));\n", " }\n", " else {\n", " if (!eq_1.isEqual(old_value, new_value))\n", " events.push(Document._event_for_attribute_change(from_obj, key, new_value, to_doc, value_refs));\n", " }\n", " }\n", " return events.filter((e) => e != null);\n", " }\n", " // we use this to detect changes during document deserialization\n", " // (in model constructors and initializers)\n", " static _compute_patch_since_json(from_json, to_doc) {\n", " const to_json = to_doc.to_json(false); // include_defaults=false\n", " function refs(json) {\n", " const result = new Map();\n", " for (const obj of json.roots.references)\n", " result.set(obj.id, obj);\n", " return result;\n", " }\n", " const from_references = refs(from_json);\n", " const from_roots = new Map();\n", " const from_root_ids = [];\n", " for (const r of from_json.roots.root_ids) {\n", " from_roots.set(r, from_references.get(r));\n", " from_root_ids.push(r);\n", " }\n", " const to_references = refs(to_json);\n", " const to_roots = new Map();\n", " const to_root_ids = [];\n", " for (const r of to_json.roots.root_ids) {\n", " to_roots.set(r, to_references.get(r));\n", " to_root_ids.push(r);\n", " }\n", " from_root_ids.sort();\n", " to_root_ids.sort();\n", " if (array_1.difference(from_root_ids, to_root_ids).length > 0 ||\n", " array_1.difference(to_root_ids, from_root_ids).length > 0) {\n", " // this would arise if someone does add_root/remove_root during\n", " // document deserialization, hopefully they won't ever do so.\n", " throw new Error(\"Not implemented: computing add/remove of document roots\");\n", " }\n", " const value_refs = new Set();\n", " let events = [];\n", " for (const id of to_doc._all_models.keys()) {\n", " if (from_references.has(id)) {\n", " const update_model_events = Document._events_to_sync_objects(from_references.get(id), to_references.get(id), to_doc, value_refs);\n", " events = events.concat(update_model_events);\n", " }\n", " }\n", " return {\n", " references: Document._references_json(value_refs, false),\n", " events,\n", " };\n", " }\n", " to_json_string(include_defaults = true) {\n", " return JSON.stringify(this.to_json(include_defaults));\n", " }\n", " to_json(include_defaults = true) {\n", " const root_ids = this._roots.map((r) => r.id);\n", " const root_references = this._all_models.values();\n", " return {\n", " version: version_1.version,\n", " title: this._title,\n", " roots: {\n", " root_ids,\n", " references: Document._references_json(root_references, include_defaults),\n", " },\n", " };\n", " }\n", " static from_json_string(s) {\n", " const json = JSON.parse(s);\n", " return Document.from_json(json);\n", " }\n", " static from_json(json) {\n", " logging_1.logger.debug(\"Creating Document from JSON\");\n", " function pyify(version) {\n", " return version.replace(/-(dev|rc)\\./, \"$1\");\n", " }\n", " const py_version = json.version; // XXX!\n", " const is_dev = py_version.indexOf('+') !== -1 || py_version.indexOf('-') !== -1;\n", " const versions_string = `Library versions: JS (${version_1.version}) / Python (${py_version})`;\n", " if (!is_dev && pyify(version_1.version) != py_version) {\n", " logging_1.logger.warn(\"JS/Python version mismatch\");\n", " logging_1.logger.warn(versions_string);\n", " }\n", " else\n", " logging_1.logger.debug(versions_string);\n", " const roots_json = json.roots;\n", " const root_ids = roots_json.root_ids;\n", " const references_json = roots_json.references;\n", " const references = Document._instantiate_references_json(references_json, new Map());\n", " Document._initialize_references_json(references_json, new Map(), references, new Map());\n", " const doc = new Document();\n", " for (const id of root_ids) {\n", " const root = references.get(id);\n", " if (root != null) {\n", " doc.add_root(root); // XXX: HasProps\n", " }\n", " }\n", " doc.set_title(json.title); // XXX!\n", " return doc;\n", " }\n", " replace_with_json(json) {\n", " const replacement = Document.from_json(json);\n", " replacement.destructively_move(this);\n", " }\n", " create_json_patch_string(events) {\n", " return JSON.stringify(this.create_json_patch(events));\n", " }\n", " create_json_patch(events) {\n", " const references = new Set();\n", " const json_events = [];\n", " for (const event of events) {\n", " if (event.document !== this) {\n", " logging_1.logger.warn(\"Cannot create a patch using events from a different document, event had \", event.document, \" we are \", this);\n", " throw new Error(\"Cannot create a patch using events from a different document\");\n", " }\n", " json_events.push(event.json(references));\n", " }\n", " return {\n", " events: json_events,\n", " references: Document._references_json(references),\n", " };\n", " }\n", " apply_json_patch(patch, buffers = new Map(), setter_id) {\n", " const references_json = patch.references;\n", " const events_json = patch.events;\n", " const references = Document._instantiate_references_json(references_json, this._all_models);\n", " if (!(buffers instanceof Map)) {\n", " buffers = new Map(buffers);\n", " }\n", " // The model being changed isn't always in references so add it in\n", " for (const event_json of events_json) {\n", " switch (event_json.kind) {\n", " case \"RootAdded\":\n", " case \"RootRemoved\":\n", " case \"ModelChanged\": {\n", " const model_id = event_json.model.id;\n", " const model = this._all_models.get(model_id);\n", " if (model != null) {\n", " references.set(model_id, model);\n", " }\n", " else if (!references.has(model_id)) {\n", " logging_1.logger.warn(`Got an event for unknown model ${event_json.model}\"`);\n", " throw new Error(\"event model wasn't known\");\n", " }\n", " break;\n", " }\n", " }\n", " }\n", " // split references into old and new so we know whether to initialize or update\n", " const old_references = new Map();\n", " const new_references = new Map();\n", " for (const [id, value] of references) {\n", " if (this._all_models.has(id))\n", " old_references.set(id, value);\n", " else\n", " new_references.set(id, value);\n", " }\n", " Document._initialize_references_json(references_json, old_references, new_references, buffers);\n", " for (const event_json of events_json) {\n", " switch (event_json.kind) {\n", " case 'MessageSent': {\n", " const { msg_type, msg_data } = event_json;\n", " let data;\n", " if (msg_data === undefined) {\n", " if (buffers.size == 1) {\n", " const [[, buffer]] = buffers;\n", " data = buffer;\n", " }\n", " else {\n", " throw new Error(\"expected exactly one buffer\");\n", " }\n", " }\n", " else {\n", " data = Document._resolve_refs(msg_data, old_references, new_references, buffers);\n", " }\n", " this._trigger_on_message(msg_type, data);\n", " break;\n", " }\n", " case 'ModelChanged': {\n", " const patched_id = event_json.model.id;\n", " const patched_obj = this._all_models.get(patched_id);\n", " if (patched_obj == null) {\n", " throw new Error(`Cannot apply patch to ${patched_id} which is not in the document`);\n", " }\n", " const attr = event_json.attr;\n", " const value = Document._resolve_refs(event_json.new, old_references, new_references, buffers);\n", " patched_obj.setv({ [attr]: value }, { setter_id });\n", " break;\n", " }\n", " case 'ColumnDataChanged': {\n", " const column_source_id = event_json.column_source.id;\n", " const column_source = this._all_models.get(column_source_id);\n", " if (column_source == null) {\n", " throw new Error(`Cannot stream to ${column_source_id} which is not in the document`);\n", " }\n", " const data = Document._resolve_refs(event_json.new, new Map(), new Map(), buffers);\n", " if (event_json.cols != null) {\n", " for (const k in column_source.data) {\n", " if (!(k in data)) {\n", " data[k] = column_source.data[k];\n", " }\n", " }\n", " }\n", " column_source.setv({ data }, { setter_id, check_eq: false });\n", " break;\n", " }\n", " case 'ColumnsStreamed': {\n", " const column_source_id = event_json.column_source.id;\n", " const column_source = this._all_models.get(column_source_id);\n", " if (column_source == null) {\n", " throw new Error(`Cannot stream to ${column_source_id} which is not in the document`);\n", " }\n", " if (!(column_source instanceof column_data_source_1.ColumnDataSource)) {\n", " throw new Error(\"Cannot stream to non-ColumnDataSource\");\n", " }\n", " const data = event_json.data;\n", " const rollover = event_json.rollover;\n", " column_source.stream(data, rollover, setter_id);\n", " break;\n", " }\n", " case 'ColumnsPatched': {\n", " const column_source_id = event_json.column_source.id;\n", " const column_source = this._all_models.get(column_source_id);\n", " if (column_source == null) {\n", " throw new Error(`Cannot patch ${column_source_id} which is not in the document`);\n", " }\n", " if (!(column_source instanceof column_data_source_1.ColumnDataSource)) {\n", " throw new Error(\"Cannot patch non-ColumnDataSource\");\n", " }\n", " const patches = event_json.patches;\n", " column_source.patch(patches, setter_id);\n", " break;\n", " }\n", " case 'RootAdded': {\n", " const root_id = event_json.model.id;\n", " const root_obj = references.get(root_id);\n", " this.add_root(root_obj, setter_id); // XXX: HasProps\n", " break;\n", " }\n", " case 'RootRemoved': {\n", " const root_id = event_json.model.id;\n", " const root_obj = references.get(root_id);\n", " this.remove_root(root_obj, setter_id); // XXX: HasProps\n", " break;\n", " }\n", " case 'TitleChanged': {\n", " this.set_title(event_json.title, setter_id);\n", " break;\n", " }\n", " default:\n", " throw new Error(\"Unknown patch event \" + JSON.stringify(event_json));\n", " }\n", " }\n", " }\n", " }\n", " exports.Document = Document;\n", " Document.__name__ = \"Document\";\n", " },\n", " /* base.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const types_1 = require(8) /* ./core/util/types */;\n", " const has_props_1 = require(13) /* ./core/has_props */;\n", " exports.overrides = {};\n", " const _all_models = new Map();\n", " exports.Models = ((name) => {\n", " const model = exports.overrides[name] || _all_models.get(name);\n", " if (model == null) {\n", " throw new Error(`Model '${name}' does not exist. This could be due to a widget or a custom model not being registered before first usage.`);\n", " }\n", " return model;\n", " });\n", " exports.Models.register = (name, model) => {\n", " exports.overrides[name] = model;\n", " };\n", " exports.Models.unregister = (name) => {\n", " delete exports.overrides[name];\n", " };\n", " function is_HasProps(obj) {\n", " return types_1.isObject(obj) && obj.prototype instanceof has_props_1.HasProps;\n", " }\n", " exports.Models.register_models = (models, force = false, errorFn) => {\n", " if (models == null)\n", " return;\n", " for (const name in models) {\n", " const model = models[name];\n", " if (is_HasProps(model)) {\n", " const qualified = model.__qualified__;\n", " if (force || !_all_models.has(qualified))\n", " _all_models.set(qualified, model);\n", " else if (errorFn != null)\n", " errorFn(qualified);\n", " else\n", " console.warn(`Model '${qualified}' was already registered`);\n", " }\n", " }\n", " };\n", " exports.register_models = exports.Models.register_models;\n", " exports.Models.registered_names = () => Array.from(_all_models.keys());\n", " // TODO: this doesn't belong here, but it's easier this way for backwards compatibility\n", " const AllModels = tslib_1.__importStar(require(29) /* ./models */);\n", " exports.register_models(AllModels);\n", " },\n", " /* core/util/types.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " // Underscore.js 1.8.3\n", " // http://underscorejs.org\n", " // (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n", " // Underscore may be freely distributed under the MIT license.\n", " const array_1 = require(9) /* ./array */;\n", " const toString = Object.prototype.toString;\n", " function isBoolean(obj) {\n", " return obj === true || obj === false || toString.call(obj) === '[object Boolean]';\n", " }\n", " exports.isBoolean = isBoolean;\n", " function isNumber(obj) {\n", " return toString.call(obj) === \"[object Number]\";\n", " }\n", " exports.isNumber = isNumber;\n", " function isInteger(obj) {\n", " return isNumber(obj) && Number.isInteger(obj);\n", " }\n", " exports.isInteger = isInteger;\n", " function isString(obj) {\n", " return toString.call(obj) === \"[object String]\";\n", " }\n", " exports.isString = isString;\n", " function isFunction(obj) {\n", " return toString.call(obj) === \"[object Function]\";\n", " }\n", " exports.isFunction = isFunction;\n", " function isArray(obj) {\n", " return Array.isArray(obj);\n", " }\n", " exports.isArray = isArray;\n", " function isArrayOf(arr, predicate) {\n", " return array_1.every(arr, predicate);\n", " }\n", " exports.isArrayOf = isArrayOf;\n", " function isArrayableOf(arr, predicate) {\n", " for (let i = 0, end = arr.length; i < end; i++) {\n", " if (!predicate(arr[i]))\n", " return false;\n", " }\n", " return true;\n", " }\n", " exports.isArrayableOf = isArrayableOf;\n", " function isTypedArray(obj) {\n", " return ArrayBuffer.isView(obj) && !(obj instanceof DataView);\n", " }\n", " exports.isTypedArray = isTypedArray;\n", " function isObject(obj) {\n", " const tp = typeof obj;\n", " return tp === 'function' || tp === 'object' && !!obj;\n", " }\n", " exports.isObject = isObject;\n", " function isPlainObject(obj) {\n", " return isObject(obj) && (obj.constructor == null || obj.constructor === Object);\n", " }\n", " exports.isPlainObject = isPlainObject;\n", " },\n", " /* core/util/array.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " // Underscore.js 1.8.3\n", " // http://underscorejs.org\n", " // (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n", " // Underscore may be freely distributed under the MIT license.\n", " const math_1 = require(10) /* ./math */;\n", " const assert_1 = require(11) /* ./assert */;\n", " const arrayable_1 = require(12) /* ./arrayable */;\n", " exports.map = arrayable_1.map;\n", " exports.reduce = arrayable_1.reduce;\n", " exports.min = arrayable_1.min;\n", " exports.min_by = arrayable_1.min_by;\n", " exports.max = arrayable_1.max;\n", " exports.max_by = arrayable_1.max_by;\n", " exports.sum = arrayable_1.sum;\n", " exports.cumsum = arrayable_1.cumsum;\n", " exports.every = arrayable_1.every;\n", " exports.some = arrayable_1.some;\n", " exports.find = arrayable_1.find;\n", " exports.find_last = arrayable_1.find_last;\n", " exports.find_index = arrayable_1.find_index;\n", " exports.find_last_index = arrayable_1.find_last_index;\n", " exports.sorted_index = arrayable_1.sorted_index;\n", " exports.is_empty = arrayable_1.is_empty;\n", " const slice = Array.prototype.slice;\n", " function head(array) {\n", " return array[0];\n", " }\n", " exports.head = head;\n", " function tail(array) {\n", " return array[array.length - 1];\n", " }\n", " exports.tail = tail;\n", " function last(array) {\n", " return array[array.length - 1];\n", " }\n", " exports.last = last;\n", " function copy(array) {\n", " return slice.call(array);\n", " }\n", " exports.copy = copy;\n", " function concat(arrays) {\n", " return [].concat(...arrays);\n", " }\n", " exports.concat = concat;\n", " function includes(array, value) {\n", " return array.indexOf(value) !== -1;\n", " }\n", " exports.includes = includes;\n", " exports.contains = includes;\n", " function nth(array, index) {\n", " return array[index >= 0 ? index : array.length + index];\n", " }\n", " exports.nth = nth;\n", " function zip(...arrays) {\n", " if (arrays.length == 0)\n", " return [];\n", " const n = arrayable_1.min(arrays.map((a) => a.length));\n", " const k = arrays.length;\n", " const result = new Array(n);\n", " for (let i = 0; i < n; i++) {\n", " result[i] = new Array(k);\n", " for (let j = 0; j < k; j++)\n", " result[i][j] = arrays[j][i];\n", " }\n", " return result;\n", " }\n", " exports.zip = zip;\n", " function unzip(array) {\n", " const n = array.length;\n", " const k = arrayable_1.min(array.map((a) => a.length));\n", " const results = Array(k);\n", " for (let j = 0; j < k; j++)\n", " results[j] = new Array(n);\n", " for (let i = 0; i < n; i++) {\n", " for (let j = 0; j < k; j++)\n", " results[j][i] = array[i][j];\n", " }\n", " return results;\n", " }\n", " exports.unzip = unzip;\n", " function range(start, stop, step = 1) {\n", " assert_1.assert(step > 0, \"'step' must be a positive number\");\n", " if (stop == null) {\n", " stop = start;\n", " start = 0;\n", " }\n", " const { max, ceil, abs } = Math;\n", " const delta = start <= stop ? step : -step;\n", " const length = max(ceil(abs(stop - start) / step), 0);\n", " const range = Array(length);\n", " for (let i = 0; i < length; i++, start += delta) {\n", " range[i] = start;\n", " }\n", " return range;\n", " }\n", " exports.range = range;\n", " function linspace(start, stop, num = 100) {\n", " const step = (stop - start) / (num - 1);\n", " const array = new Array(num);\n", " for (let i = 0; i < num; i++) {\n", " array[i] = start + step * i;\n", " }\n", " return array;\n", " }\n", " exports.linspace = linspace;\n", " function transpose(array) {\n", " const rows = array.length;\n", " const cols = array[0].length;\n", " const transposed = [];\n", " for (let j = 0; j < cols; j++) {\n", " transposed[j] = [];\n", " for (let i = 0; i < rows; i++) {\n", " transposed[j][i] = array[i][j];\n", " }\n", " }\n", " return transposed;\n", " }\n", " exports.transpose = transpose;\n", " function argmin(array) {\n", " return arrayable_1.min_by(range(array.length), (i) => array[i]);\n", " }\n", " exports.argmin = argmin;\n", " function argmax(array) {\n", " return arrayable_1.max_by(range(array.length), (i) => array[i]);\n", " }\n", " exports.argmax = argmax;\n", " function sort_by(array, key) {\n", " const tmp = array.map((value, index) => {\n", " return { value, index, key: key(value) };\n", " });\n", " tmp.sort((left, right) => {\n", " const a = left.key;\n", " const b = right.key;\n", " if (a !== b) {\n", " if (a > b || a === undefined)\n", " return 1;\n", " if (a < b || b === undefined)\n", " return -1;\n", " }\n", " return left.index - right.index;\n", " });\n", " return tmp.map((item) => item.value);\n", " }\n", " exports.sort_by = sort_by;\n", " function uniq(array) {\n", " const result = [];\n", " for (const value of array) {\n", " if (!includes(result, value)) {\n", " result.push(value);\n", " }\n", " }\n", " return result;\n", " }\n", " exports.uniq = uniq;\n", " function uniq_by(array, key) {\n", " const result = [];\n", " const seen = [];\n", " for (const value of array) {\n", " const computed = key(value);\n", " if (!includes(seen, computed)) {\n", " seen.push(computed);\n", " result.push(value);\n", " }\n", " }\n", " return result;\n", " }\n", " exports.uniq_by = uniq_by;\n", " function union(...arrays) {\n", " return uniq(concat(arrays));\n", " }\n", " exports.union = union;\n", " function intersection(array, ...arrays) {\n", " const result = [];\n", " top: for (const item of array) {\n", " if (includes(result, item))\n", " continue;\n", " for (const other of arrays) {\n", " if (!includes(other, item))\n", " continue top;\n", " }\n", " result.push(item);\n", " }\n", " return result;\n", " }\n", " exports.intersection = intersection;\n", " function difference(array, ...arrays) {\n", " const rest = concat(arrays);\n", " return array.filter((value) => !includes(rest, value));\n", " }\n", " exports.difference = difference;\n", " function remove_at(array, i) {\n", " const result = copy(array);\n", " result.splice(i, 1);\n", " return result;\n", " }\n", " exports.remove_at = remove_at;\n", " function remove_by(array, key) {\n", " for (let i = 0; i < array.length;) {\n", " if (key(array[i]))\n", " array.splice(i, 1);\n", " else\n", " i++;\n", " }\n", " }\n", " exports.remove_by = remove_by;\n", " // Shuffle a collection, using the modern version of the\n", " // [Fisher-Yates shuffle](http://en.wikipedia.org/wiki/Fisher–Yates_shuffle).\n", " function shuffle(array) {\n", " const length = array.length;\n", " const shuffled = new Array(length);\n", " for (let i = 0; i < length; i++) {\n", " const rand = math_1.randomIn(0, i);\n", " if (rand !== i)\n", " shuffled[i] = shuffled[rand];\n", " shuffled[rand] = array[i];\n", " }\n", " return shuffled;\n", " }\n", " exports.shuffle = shuffle;\n", " function pairwise(array, fn) {\n", " const n = array.length;\n", " const result = new Array(n - 1);\n", " for (let i = 0; i < n - 1; i++) {\n", " result[i] = fn(array[i], array[i + 1]);\n", " }\n", " return result;\n", " }\n", " exports.pairwise = pairwise;\n", " function reversed(array) {\n", " const n = array.length;\n", " const result = new Array(n);\n", " for (let i = 0; i < n; i++) {\n", " result[n - i - 1] = array[i];\n", " }\n", " return result;\n", " }\n", " exports.reversed = reversed;\n", " function repeat(value, n) {\n", " const result = new Array(n);\n", " for (let i = 0; i < n; i++) {\n", " result[i] = value;\n", " }\n", " return result;\n", " }\n", " exports.repeat = repeat;\n", " },\n", " /* core/util/math.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " function angle_norm(angle) {\n", " if (angle == 0) {\n", " return 0;\n", " }\n", " while (angle <= 0) {\n", " angle += 2 * Math.PI;\n", " }\n", " while (angle > 2 * Math.PI) {\n", " angle -= 2 * Math.PI;\n", " }\n", " return angle;\n", " }\n", " exports.angle_norm = angle_norm;\n", " function angle_dist(lhs, rhs) {\n", " return angle_norm(lhs - rhs);\n", " }\n", " exports.angle_dist = angle_dist;\n", " function angle_between(mid, lhs, rhs, direction) {\n", " const d = angle_dist(lhs, rhs);\n", " if (d == 0)\n", " return false;\n", " if (d == 2 * Math.PI)\n", " return true;\n", " const norm_mid = angle_norm(mid);\n", " const cond = angle_dist(lhs, norm_mid) <= d && angle_dist(norm_mid, rhs) <= d;\n", " return (direction == 0 /* clock */) ? cond : !cond;\n", " }\n", " exports.angle_between = angle_between;\n", " function random() {\n", " return Math.random();\n", " }\n", " exports.random = random;\n", " function randomIn(min, max) {\n", " if (max == null) {\n", " max = min;\n", " min = 0;\n", " }\n", " return min + Math.floor(Math.random() * (max - min + 1));\n", " }\n", " exports.randomIn = randomIn;\n", " function atan2(start, end) {\n", " /*\n", " * Calculate the angle between a line containing start and end points (composed\n", " * of [x, y] arrays) and the positive x-axis.\n", " */\n", " return Math.atan2(end[1] - start[1], end[0] - start[0]);\n", " }\n", " exports.atan2 = atan2;\n", " // http://www2.econ.osaka-u.ac.jp/~tanizaki/class/2013/econome3/13.pdf (Page 432)\n", " function rnorm(mu, sigma) {\n", " // Generate a random normal with a mean of 0 and a sigma of 1\n", " let r1;\n", " let r2;\n", " while (true) {\n", " r1 = random();\n", " r2 = random();\n", " r2 = (2 * r2 - 1) * Math.sqrt(2 * (1 / Math.E));\n", " if (-4 * r1 * r1 * Math.log(r1) >= r2 * r2)\n", " break;\n", " }\n", " let rn = r2 / r1;\n", " // Transform the standard normal to meet the characteristics that we want (mu, sigma)\n", " rn = mu + sigma * rn;\n", " return rn;\n", " }\n", " exports.rnorm = rnorm;\n", " function clamp(val, min, max) {\n", " if (val > max)\n", " return max;\n", " if (val < min)\n", " return min;\n", " return val;\n", " }\n", " exports.clamp = clamp;\n", " },\n", " /* core/util/assert.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " class AssertionError extends Error {\n", " }\n", " exports.AssertionError = AssertionError;\n", " AssertionError.__name__ = \"AssertionError\";\n", " function assert(condition, message) {\n", " if (condition === true || (condition !== false && condition()))\n", " return;\n", " throw new AssertionError(message !== null && message !== void 0 ? message : \"Assertion failed\");\n", " }\n", " exports.assert = assert;\n", " function unreachable() {\n", " throw new Error(\"unreachable code\");\n", " }\n", " exports.unreachable = unreachable;\n", " },\n", " /* core/util/arrayable.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " function is_empty(array) {\n", " return array.length == 0;\n", " }\n", " exports.is_empty = is_empty;\n", " function splice(array, start, k, ...items) {\n", " const len = array.length;\n", " if (start < 0)\n", " start += len;\n", " if (start < 0)\n", " start = 0;\n", " else if (start > len)\n", " start = len;\n", " if (k == null || k > len - start)\n", " k = len - start;\n", " else if (k < 0)\n", " k = 0;\n", " const n = len - k + items.length;\n", " const result = new array.constructor(n);\n", " let i = 0;\n", " for (; i < start; i++) {\n", " result[i] = array[i];\n", " }\n", " for (const item of items) {\n", " result[i++] = item;\n", " }\n", " for (let j = start + k; j < len; j++) {\n", " result[i++] = array[j];\n", " }\n", " return result;\n", " }\n", " exports.splice = splice;\n", " function head(array, n) {\n", " return splice(array, n, array.length - n);\n", " }\n", " exports.head = head;\n", " function insert(array, item, i) {\n", " return splice(array, i, 0, item);\n", " }\n", " exports.insert = insert;\n", " function append(array, item) {\n", " return splice(array, array.length, 0, item);\n", " }\n", " exports.append = append;\n", " function prepend(array, item) {\n", " return splice(array, 0, 0, item);\n", " }\n", " exports.prepend = prepend;\n", " function indexOf(array, item) {\n", " for (let i = 0, n = array.length; i < n; i++) {\n", " if (array[i] === item)\n", " return i;\n", " }\n", " return -1;\n", " }\n", " exports.indexOf = indexOf;\n", " function map(array, fn) {\n", " const n = array.length;\n", " const result = new array.constructor(n);\n", " for (let i = 0; i < n; i++) {\n", " result[i] = fn(array[i], i, array);\n", " }\n", " return result;\n", " }\n", " exports.map = map;\n", " function filter(array, pred) {\n", " const n = array.length;\n", " const result = new array.constructor(n);\n", " let k = 0;\n", " for (let i = 0; i < n; i++) {\n", " const value = array[i];\n", " if (pred(value, i, array))\n", " result[k++] = value;\n", " }\n", " return head(result, k);\n", " }\n", " exports.filter = filter;\n", " function reduce(array, fn, initial) {\n", " const n = array.length;\n", " if (initial === undefined && n == 0)\n", " throw new Error(\"can't reduce an empty array without an initial value\");\n", " let value;\n", " let i;\n", " if (initial === undefined) {\n", " value = array[0];\n", " i = 1;\n", " }\n", " else {\n", " value = initial;\n", " i = 0;\n", " }\n", " for (; i < n; i++) {\n", " value = fn(value, array[i], i, array);\n", " }\n", " return value;\n", " }\n", " exports.reduce = reduce;\n", " function min(array) {\n", " let value;\n", " let result = Infinity;\n", " for (let i = 0, length = array.length; i < length; i++) {\n", " value = array[i];\n", " if (value < result) {\n", " result = value;\n", " }\n", " }\n", " return result;\n", " }\n", " exports.min = min;\n", " function min_by(array, key) {\n", " if (array.length == 0)\n", " throw new Error(\"min_by() called with an empty array\");\n", " let result = array[0];\n", " let resultComputed = key(result);\n", " for (let i = 1, length = array.length; i < length; i++) {\n", " const value = array[i];\n", " const computed = key(value);\n", " if (computed < resultComputed) {\n", " result = value;\n", " resultComputed = computed;\n", " }\n", " }\n", " return result;\n", " }\n", " exports.min_by = min_by;\n", " function max(array) {\n", " let value;\n", " let result = -Infinity;\n", " for (let i = 0, length = array.length; i < length; i++) {\n", " value = array[i];\n", " if (value > result) {\n", " result = value;\n", " }\n", " }\n", " return result;\n", " }\n", " exports.max = max;\n", " function max_by(array, key) {\n", " if (array.length == 0)\n", " throw new Error(\"max_by() called with an empty array\");\n", " let result = array[0];\n", " let resultComputed = key(result);\n", " for (let i = 1, length = array.length; i < length; i++) {\n", " const value = array[i];\n", " const computed = key(value);\n", " if (computed > resultComputed) {\n", " result = value;\n", " resultComputed = computed;\n", " }\n", " }\n", " return result;\n", " }\n", " exports.max_by = max_by;\n", " function sum(array) {\n", " let result = 0;\n", " for (let i = 0, n = array.length; i < n; i++) {\n", " result += array[i];\n", " }\n", " return result;\n", " }\n", " exports.sum = sum;\n", " function cumsum(array) {\n", " const result = new array.constructor(array.length);\n", " reduce(array, (a, b, i) => result[i] = a + b, 0);\n", " return result;\n", " }\n", " exports.cumsum = cumsum;\n", " function every(array, predicate) {\n", " for (let i = 0, length = array.length; i < length; i++) {\n", " if (!predicate(array[i]))\n", " return false;\n", " }\n", " return true;\n", " }\n", " exports.every = every;\n", " function some(array, predicate) {\n", " for (let i = 0, length = array.length; i < length; i++) {\n", " if (predicate(array[i]))\n", " return true;\n", " }\n", " return false;\n", " }\n", " exports.some = some;\n", " function index_of(array, value) {\n", " for (let i = 0, length = array.length; i < length; i++) {\n", " if (array[i] === value)\n", " return i;\n", " }\n", " return -1;\n", " }\n", " exports.index_of = index_of;\n", " function _find_index(dir) {\n", " return function (array, predicate) {\n", " const length = array.length;\n", " let index = dir > 0 ? 0 : length - 1;\n", " for (; index >= 0 && index < length; index += dir) {\n", " if (predicate(array[index]))\n", " return index;\n", " }\n", " return -1;\n", " };\n", " }\n", " exports.find_index = _find_index(1);\n", " exports.find_last_index = _find_index(-1);\n", " function find(array, predicate) {\n", " const index = exports.find_index(array, predicate);\n", " return index == -1 ? undefined : array[index];\n", " }\n", " exports.find = find;\n", " function find_last(array, predicate) {\n", " const index = exports.find_last_index(array, predicate);\n", " return index == -1 ? undefined : array[index];\n", " }\n", " exports.find_last = find_last;\n", " function sorted_index(array, value) {\n", " let low = 0;\n", " let high = array.length;\n", " while (low < high) {\n", " const mid = Math.floor((low + high) / 2);\n", " if (array[mid] < value)\n", " low = mid + 1;\n", " else\n", " high = mid;\n", " }\n", " return low;\n", " }\n", " exports.sorted_index = sorted_index;\n", " },\n", " /* core/has_props.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const signaling_1 = require(14) /* ./signaling */;\n", " const refs_1 = require(16) /* ./util/refs */;\n", " const p = tslib_1.__importStar(require(18) /* ./properties */);\n", " const mixins = tslib_1.__importStar(require(23) /* ./property_mixins */);\n", " const string_1 = require(24) /* ./util/string */;\n", " const array_1 = require(9) /* ./util/array */;\n", " const object_1 = require(17) /* ./util/object */;\n", " const types_1 = require(8) /* ./util/types */;\n", " const eq_1 = require(25) /* ./util/eq */;\n", " const document_1 = require(5) /* ../document */;\n", " const ndarray_1 = require(26) /* ./util/ndarray */;\n", " const serialization_1 = require(27) /* ./util/serialization */;\n", " class HasProps extends signaling_1.Signalable() {\n", " constructor(attrs = {}) {\n", " var _a;\n", " super();\n", " this._subtype = undefined;\n", " this.document = null;\n", " this.destroyed = new signaling_1.Signal0(this, \"destroyed\");\n", " this.change = new signaling_1.Signal0(this, \"change\");\n", " this.transformchange = new signaling_1.Signal0(this, \"transformchange\");\n", " this.properties = {}; // Object.create(null)\n", " this._pending = false;\n", " this._changing = false;\n", " const get = attrs instanceof Map ? attrs.get : (name) => attrs[name];\n", " for (const [name, { type, default_value, options }] of object_1.entries(this._props)) {\n", " if (type != null)\n", " this.properties[name] = new type(this, name, default_value, get(name), options);\n", " else\n", " throw new Error(`undefined property type for ${this.type}.${name}`);\n", " }\n", " // allowing us to defer initialization when loading many models\n", " // when loading a bunch of models, we want to do initialization as a second pass\n", " // because other objects that this one depends on might not be loaded yet\n", " if (!((_a = get(\"__deferred__\")) !== null && _a !== void 0 ? _a : false)) {\n", " this.finalize();\n", " this.connect_signals();\n", " }\n", " }\n", " // XXX: setter is only required for backwards compatibility\n", " set type(name) {\n", " console.warn(\"prototype.type = 'ModelName' is deprecated, use static __name__ instead\");\n", " this.constructor.__name__ = name;\n", " }\n", " get type() {\n", " return this.constructor.__qualified__;\n", " }\n", " static get __qualified__() {\n", " const { __module__, __name__ } = this;\n", " return __module__ != null ? `${__module__}.${__name__}` : __name__;\n", " }\n", " static init_HasProps() {\n", " this.prototype._props = {};\n", " this.prototype._mixins = [];\n", " this.define({\n", " id: [p.String, () => string_1.uniqueId()],\n", " });\n", " }\n", " static _fix_default(default_value, _attr) {\n", " if (default_value === undefined)\n", " return undefined;\n", " else if (types_1.isFunction(default_value))\n", " return default_value;\n", " else if (!types_1.isObject(default_value))\n", " return () => default_value;\n", " else {\n", " //logger.warn(`${this.prototype.type}.${attr} uses unwrapped non-primitive default value`)\n", " if (types_1.isArray(default_value))\n", " return () => array_1.copy(default_value);\n", " else\n", " return () => object_1.clone(default_value);\n", " }\n", " }\n", " // TODO: don't use Partial<>, but exclude inherited properties\n", " static define(obj) {\n", " for (const [name, prop] of object_1.entries(obj)) {\n", " if (this.prototype._props[name] != null)\n", " throw new Error(`attempted to redefine property '${this.prototype.type}.${name}'`);\n", " if (this.prototype[name] != null)\n", " throw new Error(`attempted to redefine attribute '${this.prototype.type}.${name}'`);\n", " Object.defineProperty(this.prototype, name, {\n", " // XXX: don't use tail calls in getters/setters due to https://bugs.webkit.org/show_bug.cgi?id=164306\n", " get() {\n", " const value = this.properties[name].get_value();\n", " return value;\n", " },\n", " set(value) {\n", " this.setv({ [name]: value });\n", " return this;\n", " },\n", " configurable: false,\n", " enumerable: true,\n", " });\n", " const [type, default_value, options] = prop;\n", " const refined_prop = {\n", " type,\n", " default_value: this._fix_default(default_value, name),\n", " options,\n", " };\n", " const props = object_1.clone(this.prototype._props);\n", " props[name] = refined_prop;\n", " this.prototype._props = props;\n", " }\n", " }\n", " static internal(obj) {\n", " const _object = {};\n", " for (const [name, entry] of object_1.entries(obj)) {\n", " const [type, default_value, options = {}] = entry;\n", " _object[name] = [type, default_value, Object.assign(Object.assign({}, options), { internal: true })];\n", " }\n", " this.define(_object);\n", " }\n", " static mixins(defs) {\n", " if (!types_1.isArray(defs))\n", " defs = [defs];\n", " function resolve(kind) {\n", " switch (kind) {\n", " case \"line\": return mixins.LineVector;\n", " case \"fill\": return mixins.FillVector;\n", " case \"hatch\": return mixins.HatchVector;\n", " case \"text\": return mixins.TextVector;\n", " default:\n", " throw new Error(`Unknown property mixin kind '${kind}'`);\n", " }\n", " }\n", " function rename(prefix, mixin) {\n", " const result = {};\n", " for (const [name, prop] of object_1.entries(mixin)) {\n", " result[prefix + name] = prop;\n", " }\n", " return result;\n", " }\n", " function kind_of(mixin) {\n", " const [key] = Object.keys(mixin);\n", " const [kind] = key.split(\"_\", 1);\n", " return kind;\n", " }\n", " const mixin_defs = {};\n", " const names = [];\n", " for (const def of defs) {\n", " if (types_1.isString(def)) {\n", " // TODO: remove this branch in 3.0\n", " const [kind, prefix = \"\"] = def.split(\":\");\n", " const mixin = resolve(kind);\n", " names.push(def);\n", " object_1.extend(mixin_defs, rename(prefix, mixin));\n", " }\n", " else if (types_1.isArray(def)) {\n", " const [prefix, mixin] = def;\n", " names.push(`${kind_of(mixin)}:${prefix}`);\n", " object_1.extend(mixin_defs, rename(prefix, mixin));\n", " }\n", " else {\n", " const mixin = def;\n", " names.push(kind_of(mixin));\n", " object_1.extend(mixin_defs, mixin);\n", " }\n", " }\n", " this.define(mixin_defs);\n", " this.prototype._mixins = [...this.prototype._mixins, ...names];\n", " }\n", " static override(obj) {\n", " for (const [name, prop] of object_1.entries(obj)) {\n", " const default_value = this._fix_default(prop, name);\n", " const value = this.prototype._props[name];\n", " if (value == null)\n", " throw new Error(`attempted to override nonexistent '${this.prototype.type}.${name}'`);\n", " const props = object_1.clone(this.prototype._props);\n", " props[name] = Object.assign(Object.assign({}, value), { default_value });\n", " this.prototype._props = props;\n", " }\n", " }\n", " toString() {\n", " return `${this.type}(${this.id})`;\n", " }\n", " property(name) {\n", " const prop = this.properties[name];\n", " if (prop != null)\n", " return prop;\n", " else\n", " throw new Error(`unknown property ${this.type}.${name}`);\n", " }\n", " get attributes() {\n", " const attrs = {}; // Object.create(null)\n", " for (const prop of this) {\n", " attrs[prop.attr] = prop.get_value();\n", " }\n", " return attrs;\n", " }\n", " finalize() {\n", " for (const prop of this) {\n", " if (prop.spec.transform != null)\n", " this.connect(prop.spec.transform.change, () => this.transformchange.emit());\n", " }\n", " this.initialize();\n", " }\n", " initialize() { }\n", " connect_signals() { }\n", " disconnect_signals() {\n", " signaling_1.Signal.disconnectReceiver(this);\n", " }\n", " destroy() {\n", " this.disconnect_signals();\n", " this.destroyed.emit();\n", " }\n", " // Create a new model with identical attributes to this one.\n", " clone() {\n", " return new this.constructor(this.attributes);\n", " }\n", " // Set a hash of model attributes on the object, firing `\"change\"`. This is\n", " // the core primitive operation of a model, updating the data and notifying\n", " // anyone who needs to know about the change in state. The heart of the beast.\n", " _setv(changes, options) {\n", " // Extract attributes and options.\n", " const check_eq = options.check_eq;\n", " const silent = options.silent;\n", " const changed = [];\n", " const changing = this._changing;\n", " this._changing = true;\n", " for (const [prop, value] of changes) {\n", " if (check_eq === false || !eq_1.isEqual(prop.get_value(), value)) {\n", " prop.set_value(value);\n", " changed.push(prop);\n", " }\n", " }\n", " // Trigger all relevant attribute changes.\n", " if (!silent) {\n", " if (changed.length > 0)\n", " this._pending = true;\n", " for (const prop of changed) {\n", " prop.change.emit();\n", " }\n", " }\n", " // You might be wondering why there's a `while` loop here. Changes can\n", " // be recursively nested within `\"change\"` events.\n", " if (changing)\n", " return;\n", " if (!silent && !options.no_change) {\n", " while (this._pending) {\n", " this._pending = false;\n", " this.change.emit();\n", " }\n", " }\n", " this._pending = false;\n", " this._changing = false;\n", " }\n", " setv(changes, options = {}) {\n", " if (object_1.isEmpty(changes))\n", " return;\n", " const changed = new Map();\n", " const previous = new Map();\n", " for (const attr in changes) {\n", " if (!changes.hasOwnProperty(attr))\n", " continue;\n", " const prop = this.properties[attr];\n", " if (prop == null)\n", " throw new Error(`property ${this.type}.${attr} wasn't declared`);\n", " const value = changes[attr];\n", " changed.set(prop, value);\n", " previous.set(prop, prop.get_value());\n", " }\n", " this._setv(changed, options);\n", " const { document } = this;\n", " if (document != null) {\n", " const changed = [];\n", " for (const [prop, value] of previous) {\n", " changed.push([prop, value, prop.get_value()]);\n", " }\n", " for (const [, old_value, new_value] of changed) {\n", " if (this._needs_invalidate(old_value, new_value)) {\n", " document._invalidate_all_models();\n", " break;\n", " }\n", " }\n", " if (options.silent !== true) {\n", " this._push_changes(changed, options);\n", " }\n", " }\n", " }\n", " /** @deprecated */\n", " getv(name) {\n", " return this.property(name).get_value();\n", " }\n", " ref() {\n", " return { id: this.id };\n", " }\n", " struct() {\n", " const struct = {\n", " type: this.type,\n", " id: this.id,\n", " attributes: {},\n", " };\n", " if (this._subtype != null) {\n", " struct.subtype = this._subtype;\n", " }\n", " return struct;\n", " }\n", " // we only keep the subtype so we match Python;\n", " // only Python cares about this\n", " set_subtype(subtype) {\n", " this._subtype = subtype;\n", " }\n", " *[Symbol.iterator]() {\n", " for (const name in this.properties) {\n", " yield this.properties[name];\n", " }\n", " }\n", " *syncable_properties() {\n", " for (const prop of this) {\n", " if (prop.syncable)\n", " yield prop;\n", " }\n", " }\n", " /** @deprecated */\n", " serializable_attributes() {\n", " const attrs = {};\n", " for (const prop of this.syncable_properties()) {\n", " attrs[prop.attr] = prop.get_value();\n", " }\n", " return attrs;\n", " }\n", " static _value_to_json(value) {\n", " if (value instanceof HasProps)\n", " return value.ref();\n", " else if (ndarray_1.is_NDArray(value))\n", " return serialization_1.encode_NDArray(value);\n", " else if (types_1.isArray(value) || types_1.isTypedArray(value)) {\n", " const n = value.length;\n", " const ref_array = new Array(n);\n", " for (let i = 0; i < n; i++) {\n", " const v = value[i];\n", " ref_array[i] = HasProps._value_to_json(v);\n", " }\n", " return ref_array;\n", " }\n", " else if (types_1.isPlainObject(value)) {\n", " const ref_obj = {};\n", " for (const subkey in value) {\n", " if (value.hasOwnProperty(subkey))\n", " ref_obj[subkey] = HasProps._value_to_json(value[subkey]);\n", " }\n", " return ref_obj;\n", " }\n", " else\n", " return value;\n", " }\n", " // Convert attributes to \"shallow\" JSON (values which are themselves models\n", " // are included as just references)\n", " attributes_as_json(include_defaults = true, value_to_json = HasProps._value_to_json) {\n", " const attributes = {}; // Object.create(null)\n", " for (const prop of this) {\n", " if (prop.syncable && (include_defaults || prop.dirty)) {\n", " attributes[prop.attr] = value_to_json(prop.get_value());\n", " }\n", " }\n", " return attributes;\n", " }\n", " // this is like _value_record_references but expects to find refs\n", " // instead of models, and takes a doc to look up the refs in\n", " static _json_record_references(doc, v, refs, options) {\n", " const { recursive } = options;\n", " if (refs_1.is_ref(v)) {\n", " const model = doc.get_model_by_id(v.id);\n", " if (model != null && !refs.has(model)) {\n", " HasProps._value_record_references(model, refs, { recursive });\n", " }\n", " }\n", " else if (types_1.isArray(v)) {\n", " for (const elem of v)\n", " HasProps._json_record_references(doc, elem, refs, { recursive });\n", " }\n", " else if (types_1.isPlainObject(v)) {\n", " for (const k in v) {\n", " if (v.hasOwnProperty(k)) {\n", " const elem = v[k];\n", " HasProps._json_record_references(doc, elem, refs, { recursive });\n", " }\n", " }\n", " }\n", " }\n", " // add all references from 'v' to 'result', if recurse\n", " // is true then descend into refs, if false only\n", " // descend into non-refs\n", " static _value_record_references(v, refs, options) {\n", " const { recursive } = options;\n", " if (v instanceof HasProps) {\n", " if (!refs.has(v)) {\n", " refs.add(v);\n", " if (recursive) {\n", " const immediate = v._immediate_references();\n", " for (const obj of immediate)\n", " HasProps._value_record_references(obj, refs, { recursive: true });\n", " }\n", " }\n", " }\n", " else if (types_1.isArray(v)) {\n", " for (const elem of v)\n", " HasProps._value_record_references(elem, refs, { recursive });\n", " }\n", " else if (types_1.isPlainObject(v)) {\n", " for (const k in v) {\n", " if (v.hasOwnProperty(k)) {\n", " const elem = v[k];\n", " HasProps._value_record_references(elem, refs, { recursive });\n", " }\n", " }\n", " }\n", " }\n", " // Get models that are immediately referenced by our properties\n", " // (do not recurse, do not include ourselves)\n", " _immediate_references() {\n", " const refs = new Set();\n", " for (const prop of this.syncable_properties()) {\n", " const value = prop.get_value();\n", " HasProps._value_record_references(value, refs, { recursive: false });\n", " }\n", " return [...refs.values()];\n", " }\n", " references() {\n", " const refs = new Set();\n", " HasProps._value_record_references(this, refs, { recursive: true });\n", " return refs;\n", " }\n", " _doc_attached() { }\n", " _doc_detached() { }\n", " attach_document(doc) {\n", " // This should only be called by the Document implementation to set the document field\n", " if (this.document != null && this.document != doc)\n", " throw new Error(\"models must be owned by only a single document\");\n", " this.document = doc;\n", " this._doc_attached();\n", " }\n", " detach_document() {\n", " // This should only be called by the Document implementation to unset the document field\n", " this._doc_detached();\n", " this.document = null;\n", " }\n", " _needs_invalidate(old_value, new_value) {\n", " const new_refs = new Set();\n", " HasProps._value_record_references(new_value, new_refs, { recursive: false });\n", " const old_refs = new Set();\n", " HasProps._value_record_references(old_value, old_refs, { recursive: false });\n", " for (const new_id of new_refs) {\n", " if (!old_refs.has(new_id))\n", " return true;\n", " }\n", " for (const old_id of old_refs) {\n", " if (!new_refs.has(old_id))\n", " return true;\n", " }\n", " return false;\n", " }\n", " _push_changes(changes, options = {}) {\n", " const { document } = this;\n", " if (document == null)\n", " return;\n", " const { setter_id } = options;\n", " const events = [];\n", " for (const [prop, old_value, new_value] of changes) {\n", " if (prop.syncable)\n", " events.push(new document_1.ModelChangedEvent(document, this, prop.attr, old_value, new_value, setter_id));\n", " }\n", " if (events.length != 0) {\n", " let event;\n", " if (events.length == 1)\n", " [event] = events;\n", " else\n", " event = new document_1.DocumentEventBatch(document, events, setter_id);\n", " document._trigger_on_change(event);\n", " }\n", " }\n", " materialize_dataspecs(source) {\n", " // Note: this should be moved to a function separate from HasProps\n", " const data = {};\n", " for (const prop of this) {\n", " if (!(prop instanceof p.VectorSpec))\n", " continue;\n", " // this skips optional properties like radius for circles\n", " if (prop.optional && prop.spec.value == null && !prop.dirty)\n", " continue;\n", " const name = prop.attr;\n", " const array = prop.array(source);\n", " data[`_${name}`] = array;\n", " if (prop instanceof p.DistanceSpec)\n", " data[`max_${name}`] = array_1.max(array);\n", " }\n", " return data;\n", " }\n", " on_change(properties, fn) {\n", " for (const property of types_1.isArray(properties) ? properties : [properties]) {\n", " this.connect(property.change, fn);\n", " }\n", " }\n", " }\n", " exports.HasProps = HasProps;\n", " HasProps.init_HasProps();\n", " },\n", " /* core/signaling.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " // Based on https://github.com/phosphorjs/phosphor/blob/master/packages/signaling/src/index.ts\n", " const callback_1 = require(15) /* ./util/callback */;\n", " const array_1 = require(9) /* ./util/array */;\n", " class Signal {\n", " constructor(sender, name) {\n", " this.sender = sender;\n", " this.name = name;\n", " }\n", " connect(slot, context = null) {\n", " if (!receiversForSender.has(this.sender)) {\n", " receiversForSender.set(this.sender, []);\n", " }\n", " const receivers = receiversForSender.get(this.sender);\n", " if (findConnection(receivers, this, slot, context) != null) {\n", " return false;\n", " }\n", " const receiver = context || slot;\n", " if (!sendersForReceiver.has(receiver)) {\n", " sendersForReceiver.set(receiver, []);\n", " }\n", " const senders = sendersForReceiver.get(receiver);\n", " const connection = { signal: this, slot, context };\n", " receivers.push(connection);\n", " senders.push(connection);\n", " return true;\n", " }\n", " disconnect(slot, context = null) {\n", " const receivers = receiversForSender.get(this.sender);\n", " if (receivers == null || receivers.length === 0) {\n", " return false;\n", " }\n", " const connection = findConnection(receivers, this, slot, context);\n", " if (connection == null) {\n", " return false;\n", " }\n", " const receiver = context || slot;\n", " const senders = sendersForReceiver.get(receiver);\n", " connection.signal = null;\n", " scheduleCleanup(receivers);\n", " scheduleCleanup(senders);\n", " return true;\n", " }\n", " emit(args) {\n", " const receivers = receiversForSender.get(this.sender) || [];\n", " for (const { signal, slot, context } of receivers) {\n", " if (signal === this) {\n", " slot.call(context, args, this.sender);\n", " }\n", " }\n", " }\n", " }\n", " exports.Signal = Signal;\n", " Signal.__name__ = \"Signal\";\n", " class Signal0 extends Signal {\n", " emit() {\n", " super.emit(undefined);\n", " }\n", " }\n", " exports.Signal0 = Signal0;\n", " Signal0.__name__ = \"Signal0\";\n", " (function (Signal) {\n", " function disconnectBetween(sender, receiver) {\n", " const receivers = receiversForSender.get(sender);\n", " if (receivers == null || receivers.length === 0)\n", " return;\n", " const senders = sendersForReceiver.get(receiver);\n", " if (senders == null || senders.length === 0)\n", " return;\n", " for (const connection of senders) {\n", " if (connection.signal == null)\n", " return;\n", " if (connection.signal.sender === sender)\n", " connection.signal = null;\n", " }\n", " scheduleCleanup(receivers);\n", " scheduleCleanup(senders);\n", " }\n", " Signal.disconnectBetween = disconnectBetween;\n", " function disconnectSender(sender) {\n", " const receivers = receiversForSender.get(sender);\n", " if (receivers == null || receivers.length === 0)\n", " return;\n", " for (const connection of receivers) {\n", " if (connection.signal == null)\n", " return;\n", " const receiver = connection.context || connection.slot;\n", " connection.signal = null;\n", " scheduleCleanup(sendersForReceiver.get(receiver));\n", " }\n", " scheduleCleanup(receivers);\n", " }\n", " Signal.disconnectSender = disconnectSender;\n", " function disconnectReceiver(receiver) {\n", " const senders = sendersForReceiver.get(receiver);\n", " if (senders == null || senders.length === 0)\n", " return;\n", " for (const connection of senders) {\n", " if (connection.signal == null)\n", " return;\n", " const sender = connection.signal.sender;\n", " connection.signal = null;\n", " scheduleCleanup(receiversForSender.get(sender));\n", " }\n", " scheduleCleanup(senders);\n", " }\n", " Signal.disconnectReceiver = disconnectReceiver;\n", " function disconnectAll(obj) {\n", " const receivers = receiversForSender.get(obj);\n", " if (receivers != null && receivers.length !== 0) {\n", " for (const connection of receivers) {\n", " connection.signal = null;\n", " }\n", " scheduleCleanup(receivers);\n", " }\n", " const senders = sendersForReceiver.get(obj);\n", " if (senders != null && senders.length !== 0) {\n", " for (const connection of senders) {\n", " connection.signal = null;\n", " }\n", " scheduleCleanup(senders);\n", " }\n", " }\n", " Signal.disconnectAll = disconnectAll;\n", " })(Signal || (exports.Signal = Signal = {}));\n", " function Signalable() {\n", " return class {\n", " connect(signal, slot) {\n", " return signal.connect(slot, this);\n", " }\n", " disconnect(signal, slot) {\n", " return signal.disconnect(slot, this);\n", " }\n", " };\n", " }\n", " exports.Signalable = Signalable;\n", " const receiversForSender = new WeakMap();\n", " const sendersForReceiver = new WeakMap();\n", " function findConnection(conns, signal, slot, context) {\n", " return array_1.find(conns, conn => conn.signal === signal && conn.slot === slot && conn.context === context);\n", " }\n", " const dirty_set = new Set();\n", " function scheduleCleanup(connections) {\n", " if (dirty_set.size === 0) {\n", " callback_1.defer(cleanup_dirty_set);\n", " }\n", " dirty_set.add(connections);\n", " }\n", " function cleanup_dirty_set() {\n", " for (const connections of dirty_set) {\n", " array_1.remove_by(connections, (connection) => connection.signal == null);\n", " }\n", " dirty_set.clear();\n", " }\n", " },\n", " /* core/util/callback.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " // Underscore.js 1.8.3\n", " // http://underscorejs.org\n", " // (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n", " // Underscore may be freely distributed under the MIT license.\n", " function delay(func, wait) {\n", " return setTimeout(func, wait);\n", " }\n", " exports.delay = delay;\n", " const _defer = typeof requestAnimationFrame === \"function\" ? requestAnimationFrame : setImmediate;\n", " function defer(func) {\n", " return new Promise((resolve) => {\n", " _defer(() => resolve(func()));\n", " });\n", " }\n", " exports.defer = defer;\n", " function throttle(func, wait, options = {}) {\n", " let context, args, result;\n", " let timeout = null;\n", " let previous = 0;\n", " const later = function () {\n", " previous = options.leading === false ? 0 : Date.now();\n", " timeout = null;\n", " result = func.apply(context, args);\n", " if (!timeout)\n", " context = args = null;\n", " };\n", " return function () {\n", " const now = Date.now();\n", " if (!previous && options.leading === false)\n", " previous = now;\n", " const remaining = wait - (now - previous);\n", " context = this;\n", " args = arguments;\n", " if (remaining <= 0 || remaining > wait) {\n", " if (timeout) {\n", " clearTimeout(timeout);\n", " timeout = null;\n", " }\n", " previous = now;\n", " result = func.apply(context, args);\n", " if (!timeout)\n", " context = args = null;\n", " }\n", " else if (!timeout && options.trailing !== false) {\n", " timeout = setTimeout(later, remaining);\n", " }\n", " return result;\n", " };\n", " }\n", " exports.throttle = throttle;\n", " function once(func) {\n", " let done = false;\n", " let memo;\n", " return function () {\n", " if (!done) {\n", " done = true;\n", " memo = func();\n", " }\n", " return memo;\n", " };\n", " }\n", " exports.once = once;\n", " },\n", " /* core/util/refs.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const types_1 = require(8) /* ./types */;\n", " const object_1 = require(17) /* ./object */;\n", " // Determine whether an object has the proper format of a Bokeh reference\n", " //\n", " // @param arg [Object] the object to test\n", " // @return [bool] whether the object is a reference\n", " //\n", " // @note this function does not check that the id and types are valid,\n", " // only that the format is correct (all required keys are present)\n", " //\n", " function is_ref(arg) {\n", " if (types_1.isPlainObject(arg)) {\n", " const attrs = object_1.keys(arg);\n", " return attrs.length == 1 && attrs[0] == \"id\";\n", " }\n", " return false;\n", " }\n", " exports.is_ref = is_ref;\n", " },\n", " /* core/util/object.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const array_1 = require(9) /* ./array */;\n", " exports.keys = Object.keys, exports.values = Object.values, exports.entries = Object.entries, exports.extend = Object.assign;\n", " function clone(obj) {\n", " return Object.assign({}, obj);\n", " }\n", " exports.clone = clone;\n", " function merge(obj1, obj2) {\n", " /*\n", " * Returns an object with the array values for obj1 and obj2 unioned by key.\n", " */\n", " const result = Object.create(Object.prototype);\n", " const keys = array_1.concat([Object.keys(obj1), Object.keys(obj2)]);\n", " for (const key of keys) {\n", " const arr1 = obj1.hasOwnProperty(key) ? obj1[key] : [];\n", " const arr2 = obj2.hasOwnProperty(key) ? obj2[key] : [];\n", " result[key] = array_1.union(arr1, arr2);\n", " }\n", " return result;\n", " }\n", " exports.merge = merge;\n", " function size(obj) {\n", " return Object.keys(obj).length;\n", " }\n", " exports.size = size;\n", " function isEmpty(obj) {\n", " return size(obj) == 0;\n", " }\n", " exports.isEmpty = isEmpty;\n", " function to_object(map) {\n", " const obj = {};\n", " for (const [key, val] of map) {\n", " obj[key] = val;\n", " }\n", " return obj;\n", " }\n", " exports.to_object = to_object;\n", " },\n", " /* core/properties.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const signaling_1 = require(14) /* ./signaling */;\n", " const enums = tslib_1.__importStar(require(19) /* ./enums */);\n", " const array_1 = require(9) /* ./util/array */;\n", " const arrayable_1 = require(12) /* ./util/arrayable */;\n", " const color_1 = require(20) /* ./util/color */;\n", " const types_1 = require(8) /* ./util/types */;\n", " const settings_1 = require(22) /* ./settings */;\n", " function valueToString(value) {\n", " try {\n", " return JSON.stringify(value);\n", " }\n", " catch (_a) {\n", " return value.toString();\n", " }\n", " }\n", " function isSpec(obj) {\n", " return types_1.isPlainObject(obj) &&\n", " ((obj.value === undefined ? 0 : 1) +\n", " (obj.field === undefined ? 0 : 1) +\n", " (obj.expr === undefined ? 0 : 1) == 1); // garbage JS XOR\n", " }\n", " exports.isSpec = isSpec;\n", " class Property {\n", " constructor(obj, attr, default_value, initial_value, options = {}) {\n", " var _a, _b;\n", " this.obj = obj;\n", " this.attr = attr;\n", " this.default_value = default_value;\n", " this._dirty = false;\n", " this.change = new signaling_1.Signal0(this.obj, \"change\");\n", " this.internal = (_a = options.internal) !== null && _a !== void 0 ? _a : false;\n", " this.optional = (_b = options.optional) !== null && _b !== void 0 ? _b : false;\n", " let attr_value;\n", " if (initial_value !== undefined) {\n", " attr_value = initial_value;\n", " this._dirty = true;\n", " }\n", " else {\n", " const value = this._default_override();\n", " if (value !== undefined)\n", " attr_value = value;\n", " else if (default_value !== undefined)\n", " attr_value = default_value(obj);\n", " else {\n", " //throw new Error(\"no default\")\n", " attr_value = null; // XXX: nullable properties\n", " }\n", " }\n", " this._update(attr_value);\n", " }\n", " get syncable() {\n", " return !this.internal;\n", " }\n", " get_value() {\n", " return this.spec.value;\n", " }\n", " set_value(val) {\n", " this._update(val);\n", " this._dirty = true;\n", " }\n", " // abstract _intrinsic_default(): T\n", " _default_override() {\n", " return undefined;\n", " }\n", " get dirty() {\n", " return this._dirty;\n", " }\n", " //protected abstract _update(attr_value: T): void\n", " _update(attr_value) {\n", " if (attr_value != null) // XXX: non-nullalble types\n", " this.validate(attr_value);\n", " this.spec = { value: attr_value };\n", " }\n", " toString() {\n", " /*${this.name}*/\n", " return `Prop(${this.obj}.${this.attr}, spec: ${valueToString(this.spec)})`;\n", " }\n", " // ----- customizable policies\n", " normalize(values) {\n", " return values;\n", " }\n", " validate(value) {\n", " if (!this.valid(value))\n", " throw new Error(`${this.obj.type}.${this.attr} given invalid value: ${valueToString(value)}`);\n", " }\n", " valid(_value) {\n", " return true;\n", " }\n", " // ----- property accessors\n", " value(do_spec_transform = true) {\n", " if (this.spec.value === undefined)\n", " throw new Error(\"attempted to retrieve property value for property without value specification\");\n", " let ret = this.normalize([this.spec.value])[0];\n", " if (this.spec.transform != null && do_spec_transform)\n", " ret = this.spec.transform.compute(ret);\n", " return ret;\n", " }\n", " }\n", " exports.Property = Property;\n", " Property.__name__ = \"Property\";\n", " //\n", " // Primitive Properties\n", " //\n", " class Any extends Property {\n", " }\n", " exports.Any = Any;\n", " Any.__name__ = \"Any\";\n", " class Array extends Property {\n", " valid(value) {\n", " return types_1.isArray(value) || value instanceof Float64Array;\n", " }\n", " }\n", " exports.Array = Array;\n", " Array.__name__ = \"Array\";\n", " class Boolean extends Property {\n", " valid(value) {\n", " return types_1.isBoolean(value);\n", " }\n", " }\n", " exports.Boolean = Boolean;\n", " Boolean.__name__ = \"Boolean\";\n", " class Color extends Property {\n", " valid(value) {\n", " return types_1.isString(value) && color_1.is_color(value);\n", " }\n", " }\n", " exports.Color = Color;\n", " Color.__name__ = \"Color\";\n", " class Instance extends Property {\n", " }\n", " exports.Instance = Instance;\n", " Instance.__name__ = \"Instance\";\n", " class Number extends Property {\n", " valid(value) {\n", " return types_1.isNumber(value);\n", " }\n", " }\n", " exports.Number = Number;\n", " Number.__name__ = \"Number\";\n", " class Int extends Number {\n", " valid(value) {\n", " return types_1.isNumber(value) && (value | 0) == value;\n", " }\n", " }\n", " exports.Int = Int;\n", " Int.__name__ = \"Int\";\n", " class Angle extends Number {\n", " }\n", " exports.Angle = Angle;\n", " Angle.__name__ = \"Angle\";\n", " class Percent extends Number {\n", " valid(value) {\n", " return types_1.isNumber(value) && 0 <= value && value <= 1.0;\n", " }\n", " }\n", " exports.Percent = Percent;\n", " Percent.__name__ = \"Percent\";\n", " class String extends Property {\n", " valid(value) {\n", " return types_1.isString(value);\n", " }\n", " }\n", " exports.String = String;\n", " String.__name__ = \"String\";\n", " class NullString extends Property {\n", " valid(value) {\n", " return value === null || types_1.isString(value);\n", " }\n", " }\n", " exports.NullString = NullString;\n", " NullString.__name__ = \"NullString\";\n", " class FontSize extends String {\n", " }\n", " exports.FontSize = FontSize;\n", " FontSize.__name__ = \"FontSize\";\n", " class Font extends String {\n", " _default_override() {\n", " return settings_1.settings.dev ? \"Bokeh\" : undefined;\n", " }\n", " }\n", " exports.Font = Font;\n", " Font.__name__ = \"Font\";\n", " //\n", " // Enum properties\n", " //\n", " class EnumProperty extends Property {\n", " valid(value) {\n", " return types_1.isString(value) && array_1.includes(this.enum_values, value);\n", " }\n", " }\n", " exports.EnumProperty = EnumProperty;\n", " EnumProperty.__name__ = \"EnumProperty\";\n", " function Enum(values) {\n", " return class extends EnumProperty {\n", " get enum_values() {\n", " return values;\n", " }\n", " };\n", " }\n", " exports.Enum = Enum;\n", " class Direction extends EnumProperty {\n", " get enum_values() {\n", " return enums.Direction;\n", " }\n", " normalize(values) {\n", " const result = new Uint8Array(values.length);\n", " for (let i = 0; i < values.length; i++) {\n", " switch (values[i]) {\n", " case \"clock\":\n", " result[i] = 0;\n", " break;\n", " case \"anticlock\":\n", " result[i] = 1;\n", " break;\n", " }\n", " }\n", " return result;\n", " }\n", " }\n", " exports.Direction = Direction;\n", " Direction.__name__ = \"Direction\";\n", " exports.Anchor = Enum(enums.Anchor);\n", " exports.AngleUnits = Enum(enums.AngleUnits);\n", " exports.BoxOrigin = Enum(enums.BoxOrigin);\n", " exports.ButtonType = Enum(enums.ButtonType);\n", " exports.CalendarPosition = Enum(enums.CalendarPosition);\n", " exports.Dimension = Enum(enums.Dimension);\n", " exports.Dimensions = Enum(enums.Dimensions);\n", " exports.Distribution = Enum(enums.Distribution);\n", " exports.FontStyle = Enum(enums.FontStyle);\n", " exports.HatchPatternType = Enum(enums.HatchPatternType);\n", " exports.HTTPMethod = Enum(enums.HTTPMethod);\n", " exports.HexTileOrientation = Enum(enums.HexTileOrientation);\n", " exports.HoverMode = Enum(enums.HoverMode);\n", " exports.LatLon = Enum(enums.LatLon);\n", " exports.LegendClickPolicy = Enum(enums.LegendClickPolicy);\n", " exports.LegendLocation = Enum(enums.LegendLocation);\n", " exports.LineCap = Enum(enums.LineCap);\n", " exports.LineJoin = Enum(enums.LineJoin);\n", " exports.LinePolicy = Enum(enums.LinePolicy);\n", " exports.Location = Enum(enums.Location);\n", " exports.Logo = Enum(enums.Logo);\n", " exports.MarkerType = Enum(enums.MarkerType);\n", " exports.MutedPolicy = Enum(enums.MutedPolicy);\n", " exports.Orientation = Enum(enums.Orientation);\n", " exports.OutputBackend = Enum(enums.OutputBackend);\n", " exports.PaddingUnits = Enum(enums.PaddingUnits);\n", " exports.Place = Enum(enums.Place);\n", " exports.PointPolicy = Enum(enums.PointPolicy);\n", " exports.RadiusDimension = Enum(enums.RadiusDimension);\n", " exports.RenderLevel = Enum(enums.RenderLevel);\n", " exports.RenderMode = Enum(enums.RenderMode);\n", " exports.ResetPolicy = Enum(enums.ResetPolicy);\n", " exports.RoundingFunction = Enum(enums.RoundingFunction);\n", " exports.Side = Enum(enums.Side);\n", " exports.SizingMode = Enum(enums.SizingMode);\n", " exports.Sort = Enum(enums.Sort);\n", " exports.SpatialUnits = Enum(enums.SpatialUnits);\n", " exports.StartEnd = Enum(enums.StartEnd);\n", " exports.StepMode = Enum(enums.StepMode);\n", " exports.TapBehavior = Enum(enums.TapBehavior);\n", " exports.TextAlign = Enum(enums.TextAlign);\n", " exports.TextBaseline = Enum(enums.TextBaseline);\n", " exports.TextureRepetition = Enum(enums.TextureRepetition);\n", " exports.TickLabelOrientation = Enum(enums.TickLabelOrientation);\n", " exports.TooltipAttachment = Enum(enums.TooltipAttachment);\n", " exports.UpdateMode = Enum(enums.UpdateMode);\n", " exports.VerticalAlign = Enum(enums.VerticalAlign);\n", " //\n", " // DataSpec properties\n", " //\n", " class ScalarSpec extends Property {\n", " get_value() {\n", " // XXX: allow obj.x = null; obj.x == null\n", " return this.spec.value === null ? null : this.spec;\n", " }\n", " _update(attr_value) {\n", " if (isSpec(attr_value))\n", " this.spec = attr_value;\n", " else\n", " this.spec = { value: attr_value };\n", " if (this.spec.value != null)\n", " this.validate(this.spec.value);\n", " }\n", " }\n", " exports.ScalarSpec = ScalarSpec;\n", " ScalarSpec.__name__ = \"ScalarSpec\";\n", " class AnyScalar extends ScalarSpec {\n", " }\n", " exports.AnyScalar = AnyScalar;\n", " AnyScalar.__name__ = \"AnyScalar\";\n", " class ColorScalar extends ScalarSpec {\n", " }\n", " exports.ColorScalar = ColorScalar;\n", " ColorScalar.__name__ = \"ColorScalar\";\n", " class NumberScalar extends ScalarSpec {\n", " }\n", " exports.NumberScalar = NumberScalar;\n", " NumberScalar.__name__ = \"NumberScalar\";\n", " class StringScalar extends ScalarSpec {\n", " }\n", " exports.StringScalar = StringScalar;\n", " StringScalar.__name__ = \"StringScalar\";\n", " class NullStringScalar extends ScalarSpec {\n", " }\n", " exports.NullStringScalar = NullStringScalar;\n", " NullStringScalar.__name__ = \"NullStringScalar\";\n", " class ArrayScalar extends ScalarSpec {\n", " }\n", " exports.ArrayScalar = ArrayScalar;\n", " ArrayScalar.__name__ = \"ArrayScalar\";\n", " class LineJoinScalar extends ScalarSpec {\n", " }\n", " exports.LineJoinScalar = LineJoinScalar;\n", " LineJoinScalar.__name__ = \"LineJoinScalar\";\n", " class LineCapScalar extends ScalarSpec {\n", " }\n", " exports.LineCapScalar = LineCapScalar;\n", " LineCapScalar.__name__ = \"LineCapScalar\";\n", " class FontSizeScalar extends ScalarSpec {\n", " }\n", " exports.FontSizeScalar = FontSizeScalar;\n", " FontSizeScalar.__name__ = \"FontSizeScalar\";\n", " class FontStyleScalar extends ScalarSpec {\n", " }\n", " exports.FontStyleScalar = FontStyleScalar;\n", " FontStyleScalar.__name__ = \"FontStyleScalar\";\n", " class TextAlignScalar extends ScalarSpec {\n", " }\n", " exports.TextAlignScalar = TextAlignScalar;\n", " TextAlignScalar.__name__ = \"TextAlignScalar\";\n", " class TextBaselineScalar extends ScalarSpec {\n", " }\n", " exports.TextBaselineScalar = TextBaselineScalar;\n", " TextBaselineScalar.__name__ = \"TextBaselineScalar\";\n", " class VectorSpec extends Property {\n", " get_value() {\n", " // XXX: allow obj.x = null; obj.x == null\n", " return this.spec.value === null ? null : this.spec;\n", " }\n", " _update(attr_value) {\n", " if (isSpec(attr_value))\n", " this.spec = attr_value;\n", " else\n", " this.spec = { value: attr_value };\n", " if (this.spec.value != null)\n", " this.validate(this.spec.value);\n", " }\n", " array(source) {\n", " let ret;\n", " if (this.spec.field != null) {\n", " ret = this.normalize(source.get_column(this.spec.field));\n", " if (ret == null)\n", " throw new Error(`attempted to retrieve property array for nonexistent field '${this.spec.field}'`);\n", " }\n", " else if (this.spec.expr != null) {\n", " ret = this.normalize(this.spec.expr.v_compute(source));\n", " }\n", " else {\n", " let length = source.get_length();\n", " if (length == null)\n", " length = 1;\n", " const value = this.value(false); // don't apply any spec transform\n", " ret = array_1.repeat(value, length);\n", " }\n", " if (this.spec.transform != null)\n", " ret = this.spec.transform.v_compute(ret);\n", " return ret;\n", " }\n", " }\n", " exports.VectorSpec = VectorSpec;\n", " VectorSpec.__name__ = \"VectorSpec\";\n", " class DataSpec extends VectorSpec {\n", " }\n", " exports.DataSpec = DataSpec;\n", " DataSpec.__name__ = \"DataSpec\";\n", " class UnitsSpec extends VectorSpec {\n", " _update(attr_value) {\n", " super._update(attr_value);\n", " if (this.spec.units == null)\n", " this.spec.units = this.default_units;\n", " const units = this.spec.units;\n", " if (!array_1.includes(this.valid_units, units))\n", " throw new Error(`units must be one of ${this.valid_units.join(\", \")}; got: ${units}`);\n", " }\n", " get units() {\n", " return this.spec.units;\n", " }\n", " set units(units) {\n", " this.spec.units = units;\n", " }\n", " }\n", " exports.UnitsSpec = UnitsSpec;\n", " UnitsSpec.__name__ = \"UnitsSpec\";\n", " class AngleSpec extends UnitsSpec {\n", " get default_units() { return \"rad\"; }\n", " get valid_units() { return enums.AngleUnits; }\n", " normalize(values) {\n", " if (this.spec.units == \"deg\")\n", " values = arrayable_1.map(values, (x) => x * Math.PI / 180.0);\n", " values = arrayable_1.map(values, (x) => -x);\n", " return super.normalize(values);\n", " }\n", " }\n", " exports.AngleSpec = AngleSpec;\n", " AngleSpec.__name__ = \"AngleSpec\";\n", " class BooleanSpec extends DataSpec {\n", " }\n", " exports.BooleanSpec = BooleanSpec;\n", " BooleanSpec.__name__ = \"BooleanSpec\";\n", " class ColorSpec extends DataSpec {\n", " }\n", " exports.ColorSpec = ColorSpec;\n", " ColorSpec.__name__ = \"ColorSpec\";\n", " class CoordinateSpec extends DataSpec {\n", " }\n", " exports.CoordinateSpec = CoordinateSpec;\n", " CoordinateSpec.__name__ = \"CoordinateSpec\";\n", " class CoordinateSeqSpec extends DataSpec {\n", " }\n", " exports.CoordinateSeqSpec = CoordinateSeqSpec;\n", " CoordinateSeqSpec.__name__ = \"CoordinateSeqSpec\";\n", " class DistanceSpec extends UnitsSpec {\n", " get default_units() { return \"data\"; }\n", " get valid_units() { return enums.SpatialUnits; }\n", " }\n", " exports.DistanceSpec = DistanceSpec;\n", " DistanceSpec.__name__ = \"DistanceSpec\";\n", " class FontSizeSpec extends DataSpec {\n", " }\n", " exports.FontSizeSpec = FontSizeSpec;\n", " FontSizeSpec.__name__ = \"FontSizeSpec\";\n", " class MarkerSpec extends DataSpec {\n", " }\n", " exports.MarkerSpec = MarkerSpec;\n", " MarkerSpec.__name__ = \"MarkerSpec\";\n", " class NumberSpec extends DataSpec {\n", " }\n", " exports.NumberSpec = NumberSpec;\n", " NumberSpec.__name__ = \"NumberSpec\";\n", " class StringSpec extends DataSpec {\n", " }\n", " exports.StringSpec = StringSpec;\n", " StringSpec.__name__ = \"StringSpec\";\n", " class NullStringSpec extends DataSpec {\n", " }\n", " exports.NullStringSpec = NullStringSpec;\n", " NullStringSpec.__name__ = \"NullStringSpec\";\n", " },\n", " /* core/enums.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.Align = [\"start\", \"center\", \"end\"];\n", " exports.Anchor = [\n", " \"top_left\", \"top_center\", \"top_right\",\n", " \"center_left\", \"center\", \"center_right\",\n", " \"bottom_left\", \"bottom_center\", \"bottom_right\",\n", " ];\n", " exports.AngleUnits = [\"deg\", \"rad\"];\n", " exports.BoxOrigin = [\"corner\", \"center\"];\n", " exports.ButtonType = [\"default\", \"primary\", \"success\", \"warning\", \"danger\"];\n", " exports.CalendarPosition = [\"auto\", \"above\", \"below\"];\n", " exports.Dimension = [\"width\", \"height\"];\n", " exports.Dimensions = [\"width\", \"height\", \"both\"];\n", " exports.Direction = [\"clock\", \"anticlock\"];\n", " exports.Distribution = [\"uniform\", \"normal\"];\n", " exports.FontStyle = [\"normal\", \"italic\", \"bold\", \"bold italic\"];\n", " exports.HatchPatternType = [\n", " 'blank', 'dot', 'ring', 'horizontal_line', 'vertical_line', 'cross', 'horizontal_dash',\n", " 'vertical_dash', 'spiral', 'right_diagonal_line', 'left_diagonal_line', 'diagonal_cross',\n", " 'right_diagonal_dash', 'left_diagonal_dash', 'horizontal_wave', 'vertical_wave', 'criss_cross',\n", " ' ', '.', 'o', '-', '|', '+', '\"', ':', '@', '/', '\\\\', 'x', ',', '`', 'v', '>', '*',\n", " ];\n", " exports.HTTPMethod = [\"POST\", \"GET\"];\n", " exports.HexTileOrientation = [\"pointytop\", \"flattop\"];\n", " exports.HoverMode = [\"mouse\", \"hline\", \"vline\"];\n", " exports.LatLon = [\"lat\", \"lon\"];\n", " exports.LegendClickPolicy = [\"none\", \"hide\", \"mute\"];\n", " exports.LegendLocation = exports.Anchor;\n", " exports.LineCap = [\"butt\", \"round\", \"square\"];\n", " exports.LineJoin = [\"miter\", \"round\", \"bevel\"];\n", " exports.LinePolicy = [\"prev\", \"next\", \"nearest\", \"interp\", \"none\"];\n", " exports.Location = [\"above\", \"below\", \"left\", \"right\"];\n", " exports.Logo = [\"normal\", \"grey\"];\n", " exports.MarkerType = [\n", " \"asterisk\", \"circle\", \"circle_cross\", \"circle_dot\", \"circle_x\",\n", " \"circle_y\", \"cross\", \"dash\", \"diamond\", \"diamond_cross\", \"diamond_dot\",\n", " \"dot\", \"hex\", \"hex_dot\", \"inverted_triangle\", \"plus\", \"square\",\n", " \"square_cross\", \"square_dot\", \"square_pin\", \"square_x\", \"triangle\",\n", " \"triangle_dot\", \"triangle_pin\", \"x\", \"y\",\n", " ];\n", " exports.MutedPolicy = [\"show\", \"ignore\"];\n", " exports.Orientation = [\"vertical\", \"horizontal\"];\n", " exports.OutputBackend = [\"canvas\", \"svg\", \"webgl\"];\n", " exports.PaddingUnits = [\"percent\", \"absolute\"];\n", " exports.Place = [\"above\", \"below\", \"left\", \"right\", \"center\"];\n", " exports.PointPolicy = [\"snap_to_data\", \"follow_mouse\", \"none\"];\n", " exports.RadiusDimension = [\"x\", \"y\", \"max\", \"min\"];\n", " exports.RenderLevel = [\"image\", \"underlay\", \"glyph\", \"guide\", \"annotation\", \"overlay\"];\n", " exports.RenderMode = [\"canvas\", \"css\"];\n", " exports.ResetPolicy = [\"standard\", \"event_only\"];\n", " exports.RoundingFunction = [\"round\", \"nearest\", \"floor\", \"rounddown\", \"ceil\", \"roundup\"];\n", " exports.SelectionMode = [\"replace\", \"append\", \"intersect\", \"subtract\"];\n", " exports.Side = [\"above\", \"below\", \"left\", \"right\"];\n", " exports.SizingMode = [\"stretch_width\", \"stretch_height\", \"stretch_both\", \"scale_width\", \"scale_height\", \"scale_both\", \"fixed\"];\n", " exports.Sort = [\"ascending\", \"descending\"];\n", " exports.SpatialUnits = [\"screen\", \"data\"];\n", " exports.StartEnd = [\"start\", \"end\"];\n", " exports.StepMode = [\"after\", \"before\", \"center\"];\n", " exports.TapBehavior = [\"select\", \"inspect\"];\n", " exports.TextAlign = [\"left\", \"right\", \"center\"];\n", " exports.TextBaseline = [\"top\", \"middle\", \"bottom\", \"alphabetic\", \"hanging\", \"ideographic\"];\n", " exports.TextureRepetition = [\"repeat\", \"repeat_x\", \"repeat_y\", \"no_repeat\"];\n", " exports.TickLabelOrientation = [\"vertical\", \"horizontal\", \"parallel\", \"normal\"];\n", " exports.TooltipAttachment = [\"horizontal\", \"vertical\", \"left\", \"right\", \"above\", \"below\"];\n", " exports.UpdateMode = [\"replace\", \"append\"];\n", " exports.VerticalAlign = [\"top\", \"middle\", \"bottom\"];\n", " },\n", " /* core/util/color.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const svg_colors_1 = require(21) /* ./svg_colors */;\n", " const array_1 = require(9) /* ./array */;\n", " function is_color(value) {\n", " return svg_colors_1.is_svg_color(value.toLowerCase()) || value.substring(0, 1) == \"#\" || valid_rgb(value);\n", " }\n", " exports.is_color = is_color;\n", " function _component2hex(v) {\n", " const h = Number(v).toString(16);\n", " return h.length == 1 ? `0${h}` : h;\n", " }\n", " function rgb2hex(r, g, b) {\n", " const R = _component2hex(r & 0xFF);\n", " const G = _component2hex(g & 0xFF);\n", " const B = _component2hex(b & 0xFF);\n", " return `#${R}${G}${B}`;\n", " }\n", " exports.rgb2hex = rgb2hex;\n", " function color2hex(color) {\n", " color = color + '';\n", " if (color.indexOf('#') == 0)\n", " return color;\n", " else if (svg_colors_1.is_svg_color(color))\n", " return svg_colors_1.svg_colors[color];\n", " else if (color.indexOf('rgb') == 0) {\n", " const rgb = color.replace(/^rgba?\\(|\\s+|\\)$/g, '').split(',');\n", " let hex = rgb.slice(0, 3).map(_component2hex).join('');\n", " if (rgb.length == 4)\n", " hex += _component2hex(Math.floor(parseFloat(rgb[3]) * 255));\n", " return `#${hex.slice(0, 8)}`; // can also be rgba\n", " }\n", " else\n", " return color;\n", " }\n", " exports.color2hex = color2hex;\n", " function color2rgba(color, alpha = 1.0) {\n", " if (!color) // NaN, null, '', etc.\n", " return [0, 0, 0, 0]; // transparent\n", " // Convert to hex and then to clean version of 6 or 8 chars\n", " let hex = color2hex(color);\n", " hex = hex.replace(/ |#/g, '');\n", " if (hex.length <= 4) {\n", " hex = hex.replace(/(.)/g, '$1$1');\n", " }\n", " // Convert pairs to numbers\n", " const rgba = hex.match(/../g).map((i) => parseInt(i, 16) / 255);\n", " // Ensure correct length, add alpha if necessary\n", " while (rgba.length < 3)\n", " rgba.push(0);\n", " if (rgba.length < 4)\n", " rgba.push(alpha);\n", " return rgba.slice(0, 4);\n", " }\n", " exports.color2rgba = color2rgba;\n", " function color2css(color, alpha = 1.0) {\n", " if (alpha == 1.0)\n", " return color;\n", " else {\n", " const [r, g, b, a] = color2rgba(color, alpha);\n", " return `rgba(${r * 255},${g * 255},${b * 255},${a})`;\n", " }\n", " }\n", " exports.color2css = color2css;\n", " function valid_rgb(value) {\n", " let params;\n", " switch (value.substring(0, 4)) {\n", " case \"rgba\": {\n", " params = { start: \"rgba(\", len: 4, alpha: true };\n", " break;\n", " }\n", " case \"rgb(\": {\n", " params = { start: \"rgb(\", len: 3, alpha: false };\n", " break;\n", " }\n", " default:\n", " return false;\n", " }\n", " // if '.' and then ',' found, we know decimals are used on rgb\n", " if (new RegExp(\".*?(\\\\.).*(,)\").test(value))\n", " return false;\n", " // throw new Error(`color expects integers for rgb in rgb/rgba tuple, received ${value}`)\n", " // extract the numerical values from inside parens\n", " const contents = value.replace(params.start, \"\").replace(\")\", \"\").split(',').map(parseFloat);\n", " // check length of array based on rgb/rgba\n", " if (contents.length != params.len)\n", " return false;\n", " // throw new Error(`color expects rgba ${params.len}-tuple, received ${value}`)\n", " // check for valid numerical values for rgba\n", " if (params.alpha && !(0 <= contents[3] && contents[3] <= 1))\n", " return false;\n", " // throw new Error(\"color expects rgba 4-tuple to have alpha value between 0 and 1\")\n", " if (array_1.includes(contents.slice(0, 3).map((rgb) => 0 <= rgb && rgb <= 255), false))\n", " return false;\n", " // throw new Error(\"color expects rgb to have value between 0 and 255\")\n", " return true;\n", " }\n", " exports.valid_rgb = valid_rgb;\n", " },\n", " /* core/util/svg_colors.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.svg_colors = {\n", " indianred: \"#CD5C5C\",\n", " lightcoral: \"#F08080\",\n", " salmon: \"#FA8072\",\n", " darksalmon: \"#E9967A\",\n", " lightsalmon: \"#FFA07A\",\n", " crimson: \"#DC143C\",\n", " red: \"#FF0000\",\n", " firebrick: \"#B22222\",\n", " darkred: \"#8B0000\",\n", " pink: \"#FFC0CB\",\n", " lightpink: \"#FFB6C1\",\n", " hotpink: \"#FF69B4\",\n", " deeppink: \"#FF1493\",\n", " mediumvioletred: \"#C71585\",\n", " palevioletred: \"#DB7093\",\n", " coral: \"#FF7F50\",\n", " tomato: \"#FF6347\",\n", " orangered: \"#FF4500\",\n", " darkorange: \"#FF8C00\",\n", " orange: \"#FFA500\",\n", " gold: \"#FFD700\",\n", " yellow: \"#FFFF00\",\n", " lightyellow: \"#FFFFE0\",\n", " lemonchiffon: \"#FFFACD\",\n", " lightgoldenrodyellow: \"#FAFAD2\",\n", " papayawhip: \"#FFEFD5\",\n", " moccasin: \"#FFE4B5\",\n", " peachpuff: \"#FFDAB9\",\n", " palegoldenrod: \"#EEE8AA\",\n", " khaki: \"#F0E68C\",\n", " darkkhaki: \"#BDB76B\",\n", " lavender: \"#E6E6FA\",\n", " thistle: \"#D8BFD8\",\n", " plum: \"#DDA0DD\",\n", " violet: \"#EE82EE\",\n", " orchid: \"#DA70D6\",\n", " fuchsia: \"#FF00FF\",\n", " magenta: \"#FF00FF\",\n", " mediumorchid: \"#BA55D3\",\n", " mediumpurple: \"#9370DB\",\n", " blueviolet: \"#8A2BE2\",\n", " darkviolet: \"#9400D3\",\n", " darkorchid: \"#9932CC\",\n", " darkmagenta: \"#8B008B\",\n", " purple: \"#800080\",\n", " indigo: \"#4B0082\",\n", " slateblue: \"#6A5ACD\",\n", " darkslateblue: \"#483D8B\",\n", " mediumslateblue: \"#7B68EE\",\n", " greenyellow: \"#ADFF2F\",\n", " chartreuse: \"#7FFF00\",\n", " lawngreen: \"#7CFC00\",\n", " lime: \"#00FF00\",\n", " limegreen: \"#32CD32\",\n", " palegreen: \"#98FB98\",\n", " lightgreen: \"#90EE90\",\n", " mediumspringgreen: \"#00FA9A\",\n", " springgreen: \"#00FF7F\",\n", " mediumseagreen: \"#3CB371\",\n", " seagreen: \"#2E8B57\",\n", " forestgreen: \"#228B22\",\n", " green: \"#008000\",\n", " darkgreen: \"#006400\",\n", " yellowgreen: \"#9ACD32\",\n", " olivedrab: \"#6B8E23\",\n", " olive: \"#808000\",\n", " darkolivegreen: \"#556B2F\",\n", " mediumaquamarine: \"#66CDAA\",\n", " darkseagreen: \"#8FBC8F\",\n", " lightseagreen: \"#20B2AA\",\n", " darkcyan: \"#008B8B\",\n", " teal: \"#008080\",\n", " aqua: \"#00FFFF\",\n", " cyan: \"#00FFFF\",\n", " lightcyan: \"#E0FFFF\",\n", " paleturquoise: \"#AFEEEE\",\n", " aquamarine: \"#7FFFD4\",\n", " turquoise: \"#40E0D0\",\n", " mediumturquoise: \"#48D1CC\",\n", " darkturquoise: \"#00CED1\",\n", " cadetblue: \"#5F9EA0\",\n", " steelblue: \"#4682B4\",\n", " lightsteelblue: \"#B0C4DE\",\n", " powderblue: \"#B0E0E6\",\n", " lightblue: \"#ADD8E6\",\n", " skyblue: \"#87CEEB\",\n", " lightskyblue: \"#87CEFA\",\n", " deepskyblue: \"#00BFFF\",\n", " dodgerblue: \"#1E90FF\",\n", " cornflowerblue: \"#6495ED\",\n", " royalblue: \"#4169E1\",\n", " blue: \"#0000FF\",\n", " mediumblue: \"#0000CD\",\n", " darkblue: \"#00008B\",\n", " navy: \"#000080\",\n", " midnightblue: \"#191970\",\n", " cornsilk: \"#FFF8DC\",\n", " blanchedalmond: \"#FFEBCD\",\n", " bisque: \"#FFE4C4\",\n", " navajowhite: \"#FFDEAD\",\n", " wheat: \"#F5DEB3\",\n", " burlywood: \"#DEB887\",\n", " tan: \"#D2B48C\",\n", " rosybrown: \"#BC8F8F\",\n", " sandybrown: \"#F4A460\",\n", " goldenrod: \"#DAA520\",\n", " darkgoldenrod: \"#B8860B\",\n", " peru: \"#CD853F\",\n", " chocolate: \"#D2691E\",\n", " saddlebrown: \"#8B4513\",\n", " sienna: \"#A0522D\",\n", " brown: \"#A52A2A\",\n", " maroon: \"#800000\",\n", " white: \"#FFFFFF\",\n", " snow: \"#FFFAFA\",\n", " honeydew: \"#F0FFF0\",\n", " mintcream: \"#F5FFFA\",\n", " azure: \"#F0FFFF\",\n", " aliceblue: \"#F0F8FF\",\n", " ghostwhite: \"#F8F8FF\",\n", " whitesmoke: \"#F5F5F5\",\n", " seashell: \"#FFF5EE\",\n", " beige: \"#F5F5DC\",\n", " oldlace: \"#FDF5E6\",\n", " floralwhite: \"#FFFAF0\",\n", " ivory: \"#FFFFF0\",\n", " antiquewhite: \"#FAEBD7\",\n", " linen: \"#FAF0E6\",\n", " lavenderblush: \"#FFF0F5\",\n", " mistyrose: \"#FFE4E1\",\n", " gainsboro: \"#DCDCDC\",\n", " lightgray: \"#D3D3D3\",\n", " lightgrey: \"#D3D3D3\",\n", " silver: \"#C0C0C0\",\n", " darkgray: \"#A9A9A9\",\n", " darkgrey: \"#A9A9A9\",\n", " gray: \"#808080\",\n", " grey: \"#808080\",\n", " dimgray: \"#696969\",\n", " dimgrey: \"#696969\",\n", " lightslategray: \"#778899\",\n", " lightslategrey: \"#778899\",\n", " slategray: \"#708090\",\n", " slategrey: \"#708090\",\n", " darkslategray: \"#2F4F4F\",\n", " darkslategrey: \"#2F4F4F\",\n", " black: \"#000000\",\n", " };\n", " function is_svg_color(color) {\n", " return color in exports.svg_colors;\n", " }\n", " exports.is_svg_color = is_svg_color;\n", " },\n", " /* core/settings.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " class Settings {\n", " constructor() {\n", " this._dev = false;\n", " }\n", " set dev(dev) {\n", " this._dev = dev;\n", " }\n", " get dev() {\n", " return this._dev;\n", " }\n", " }\n", " exports.Settings = Settings;\n", " Settings.__name__ = \"Settings\";\n", " exports.settings = new Settings();\n", " },\n", " /* core/property_mixins.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const p = tslib_1.__importStar(require(18) /* ./properties */);\n", " exports.Line = {\n", " line_color: [p.Color, \"black\"],\n", " line_alpha: [p.Number, 1.0],\n", " line_width: [p.Number, 1],\n", " line_join: [p.LineJoin, \"bevel\"],\n", " line_cap: [p.LineCap, \"butt\"],\n", " line_dash: [p.Array, []],\n", " line_dash_offset: [p.Number, 0],\n", " };\n", " exports.Fill = {\n", " fill_color: [p.Color, \"gray\"],\n", " fill_alpha: [p.Number, 1.0],\n", " };\n", " exports.Hatch = {\n", " hatch_color: [p.Color, \"black\"],\n", " hatch_alpha: [p.Number, 1.0],\n", " hatch_scale: [p.Number, 12.0],\n", " hatch_pattern: [p.NullString, null],\n", " hatch_weight: [p.Number, 1.0],\n", " hatch_extra: [p.Any, {}],\n", " };\n", " exports.Text = {\n", " text_color: [p.Color, \"#444444\"],\n", " text_alpha: [p.Number, 1.0],\n", " text_font: [p.Font, \"helvetica\"],\n", " text_font_size: [p.FontSize, \"16px\"],\n", " text_font_style: [p.FontStyle, \"normal\"],\n", " text_align: [p.TextAlign, \"left\"],\n", " text_baseline: [p.TextBaseline, \"bottom\"],\n", " text_line_height: [p.Number, 1.2],\n", " };\n", " exports.LineScalar = {\n", " line_color: [p.ColorScalar, \"black\"],\n", " line_alpha: [p.NumberScalar, 1.0],\n", " line_width: [p.NumberScalar, 1],\n", " line_join: [p.LineJoinScalar, \"bevel\"],\n", " line_cap: [p.LineCapScalar, \"butt\"],\n", " line_dash: [p.ArrayScalar, []],\n", " line_dash_offset: [p.NumberScalar, 0],\n", " };\n", " exports.FillScalar = {\n", " fill_color: [p.ColorScalar, \"gray\"],\n", " fill_alpha: [p.NumberScalar, 1.0],\n", " };\n", " exports.HatchScalar = {\n", " hatch_color: [p.ColorScalar, \"black\"],\n", " hatch_alpha: [p.NumberScalar, 1.0],\n", " hatch_scale: [p.NumberScalar, 12.0],\n", " hatch_pattern: [p.NullStringScalar, null],\n", " hatch_weight: [p.NumberScalar, 1.0],\n", " hatch_extra: [p.AnyScalar, {}],\n", " };\n", " exports.TextScalar = {\n", " text_color: [p.ColorScalar, \"#444444\"],\n", " text_alpha: [p.NumberScalar, 1.0],\n", " text_font: [p.Font, \"helvetica\"],\n", " text_font_size: [p.FontSizeScalar, \"16px\"],\n", " text_font_style: [p.FontStyleScalar, \"normal\"],\n", " text_align: [p.TextAlignScalar, \"left\"],\n", " text_baseline: [p.TextBaselineScalar, \"bottom\"],\n", " text_line_height: [p.NumberScalar, 1.2],\n", " };\n", " exports.LineVector = {\n", " line_color: [p.ColorSpec, \"black\"],\n", " line_alpha: [p.NumberSpec, 1.0],\n", " line_width: [p.NumberSpec, 1],\n", " line_join: [p.LineJoin, \"bevel\"],\n", " line_cap: [p.LineCap, \"butt\"],\n", " line_dash: [p.Array, []],\n", " line_dash_offset: [p.Number, 0],\n", " };\n", " exports.FillVector = {\n", " fill_color: [p.ColorSpec, \"gray\"],\n", " fill_alpha: [p.NumberSpec, 1.0],\n", " };\n", " exports.HatchVector = {\n", " hatch_color: [p.ColorSpec, \"black\"],\n", " hatch_alpha: [p.NumberSpec, 1.0],\n", " hatch_scale: [p.NumberSpec, 12.0],\n", " hatch_pattern: [p.NullStringSpec, null],\n", " hatch_weight: [p.NumberSpec, 1.0],\n", " hatch_extra: [p.Any, {}],\n", " };\n", " exports.TextVector = {\n", " text_color: [p.ColorSpec, \"#444444\"],\n", " text_alpha: [p.NumberSpec, 1.0],\n", " text_font: [p.Font, \"helvetica\"],\n", " text_font_size: [p.FontSizeSpec, \"16px\"],\n", " text_font_style: [p.FontStyle, \"normal\"],\n", " text_align: [p.TextAlign, \"left\"],\n", " text_baseline: [p.TextBaseline, \"bottom\"],\n", " text_line_height: [p.Number, 1.2],\n", " };\n", " },\n", " /* core/util/string.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const settings_1 = require(22) /* ../settings */;\n", " function startsWith(str, searchString, position = 0) {\n", " return str.substr(position, searchString.length) == searchString;\n", " }\n", " exports.startsWith = startsWith;\n", " function uuid4() {\n", " // from ipython project\n", " // http://www.ietf.org/rfc/rfc4122.txt\n", " const s = new Array(32);\n", " const hexDigits = \"0123456789ABCDEF\";\n", " for (let i = 0; i < 32; i++) {\n", " s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);\n", " }\n", " s[12] = \"4\"; // bits 12-15 of the time_hi_and_version field to 0010\n", " s[16] = hexDigits.substr((s[16].charCodeAt(0) & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01\n", " return s.join(\"\");\n", " }\n", " exports.uuid4 = uuid4;\n", " let counter = 1000;\n", " function uniqueId(prefix) {\n", " const id = settings_1.settings.dev ? `j${counter++}` : uuid4();\n", " if (prefix != null)\n", " return `${prefix}-${id}`;\n", " else\n", " return id;\n", " }\n", " exports.uniqueId = uniqueId;\n", " function escape(s) {\n", " return s.replace(/(?:[&<>\"'`])/g, (ch) => {\n", " switch (ch) {\n", " case '&': return '&';\n", " case '<': return '<';\n", " case '>': return '>';\n", " case '\"': return '"';\n", " case \"'\": return ''';\n", " case '`': return '`';\n", " default: return ch;\n", " }\n", " });\n", " }\n", " exports.escape = escape;\n", " function unescape(s) {\n", " return s.replace(/&(amp|lt|gt|quot|#x27|#x60);/g, (_, entity) => {\n", " switch (entity) {\n", " case 'amp': return '&';\n", " case 'lt': return '<';\n", " case 'gt': return '>';\n", " case 'quot': return '\"';\n", " case '#x27': return \"'\";\n", " case '#x60': return '`';\n", " default: return entity;\n", " }\n", " });\n", " }\n", " exports.unescape = unescape;\n", " function use_strict(code) {\n", " return `'use strict';\\n${code}`;\n", " }\n", " exports.use_strict = use_strict;\n", " },\n", " /* core/util/eq.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " // Underscore.js 1.8.3\n", " // http://underscorejs.org\n", " // (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n", " // Underscore may be freely distributed under the MIT license.\n", " const types_1 = require(8) /* ./types */;\n", " const toString = Object.prototype.toString;\n", " // Internal recursive comparison function for `isEqual`.\n", " function eq(a, b, aStack, bStack) {\n", " // Identical objects are equal. `0 === -0`, but they aren't identical.\n", " // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).\n", " if (a === b)\n", " return a !== 0 || 1 / a === 1 / b;\n", " // A strict comparison is necessary because `null == undefined`.\n", " if (a == null || b == null)\n", " return a === b;\n", " // Compare `[[Class]]` names.\n", " const className = toString.call(a);\n", " if (className !== toString.call(b))\n", " return false;\n", " switch (className) {\n", " // Strings, numbers, regular expressions, dates, and booleans are compared by value.\n", " case '[object RegExp]':\n", " // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')\n", " case '[object String]':\n", " // Primitives and their corresponding object wrappers are equivalent; thus, `\"5\"` is\n", " // equivalent to `new String(\"5\")`.\n", " return '' + a === '' + b;\n", " case '[object Number]':\n", " // `NaN`s are equivalent, but non-reflexive.\n", " // Object(NaN) is equivalent to NaN\n", " if (+a !== +a)\n", " return +b !== +b;\n", " // An `egal` comparison is performed for other numeric values.\n", " return +a === 0 ? 1 / +a === 1 / b : +a === +b;\n", " case '[object Date]':\n", " case '[object Boolean]':\n", " // Coerce dates and booleans to numeric primitive values. Dates are compared by their\n", " // millisecond representations. Note that invalid dates with millisecond representations\n", " // of `NaN` are not equivalent.\n", " return +a === +b;\n", " }\n", " const areArrays = className === '[object Array]';\n", " if (!areArrays) {\n", " if (typeof a != 'object' || typeof b != 'object')\n", " return false;\n", " // Objects with different constructors are not equivalent, but `Object`s or `Array`s\n", " // from different frames are.\n", " const aCtor = a.constructor, bCtor = b.constructor;\n", " if (aCtor !== bCtor && !(types_1.isFunction(aCtor) && aCtor instanceof aCtor &&\n", " types_1.isFunction(bCtor) && bCtor instanceof bCtor)\n", " && ('constructor' in a && 'constructor' in b)) {\n", " return false;\n", " }\n", " }\n", " // Assume equality for cyclic structures. The algorithm for detecting cyclic\n", " // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.\n", " // Initializing stack of traversed objects.\n", " // It's done here since we only need them for objects and arrays comparison.\n", " aStack = aStack || [];\n", " bStack = bStack || [];\n", " let length = aStack.length;\n", " while (length--) {\n", " // Linear search. Performance is inversely proportional to the number of\n", " // unique nested structures.\n", " if (aStack[length] === a)\n", " return bStack[length] === b;\n", " }\n", " // Add the first object to the stack of traversed objects.\n", " aStack.push(a);\n", " bStack.push(b);\n", " // Recursively compare objects and arrays.\n", " if (areArrays) {\n", " // Compare array lengths to determine if a deep comparison is necessary.\n", " length = a.length;\n", " if (length !== b.length)\n", " return false;\n", " // Deep compare the contents, ignoring non-numeric properties.\n", " while (length--) {\n", " if (!eq(a[length], b[length], aStack, bStack))\n", " return false;\n", " }\n", " }\n", " else {\n", " // Deep compare objects.\n", " const keys = Object.keys(a);\n", " let key;\n", " length = keys.length;\n", " // Ensure that both objects contain the same number of properties before comparing deep equality.\n", " if (Object.keys(b).length !== length)\n", " return false;\n", " while (length--) {\n", " // Deep compare each member\n", " key = keys[length];\n", " if (!(b.hasOwnProperty(key) && eq(a[key], b[key], aStack, bStack)))\n", " return false;\n", " }\n", " }\n", " // Remove the first object from the stack of traversed objects.\n", " aStack.pop();\n", " bStack.pop();\n", " return true;\n", " }\n", " // Perform a deep comparison to check if two objects are equal.\n", " function isEqual(a, b) {\n", " return eq(a, b);\n", " }\n", " exports.isEqual = isEqual;\n", " },\n", " /* core/util/ndarray.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const types_1 = require(8) /* ./types */;\n", " const assert_1 = require(11) /* ./assert */;\n", " const __ndarray__ = Symbol(\"__ndarray__\");\n", " class Uint8NDArray extends Uint8Array {\n", " constructor(seq, shape) {\n", " super(seq);\n", " this.__ndarray__ = __ndarray__;\n", " this.dtype = \"uint8\";\n", " this.shape = shape !== null && shape !== void 0 ? shape : [this.length];\n", " }\n", " }\n", " exports.Uint8NDArray = Uint8NDArray;\n", " Uint8NDArray.__name__ = \"Uint8NDArray\";\n", " class Int8NDArray extends Int8Array {\n", " constructor(seq, shape) {\n", " super(seq);\n", " this.__ndarray__ = __ndarray__;\n", " this.dtype = \"int8\";\n", " this.shape = shape !== null && shape !== void 0 ? shape : (is_NDArray(seq) ? seq.shape : [this.length]);\n", " }\n", " }\n", " exports.Int8NDArray = Int8NDArray;\n", " Int8NDArray.__name__ = \"Int8NDArray\";\n", " class Uint16NDArray extends Uint16Array {\n", " constructor(seq, shape) {\n", " super(seq);\n", " this.__ndarray__ = __ndarray__;\n", " this.dtype = \"uint16\";\n", " this.shape = shape !== null && shape !== void 0 ? shape : (is_NDArray(seq) ? seq.shape : [this.length]);\n", " }\n", " }\n", " exports.Uint16NDArray = Uint16NDArray;\n", " Uint16NDArray.__name__ = \"Uint16NDArray\";\n", " class Int16NDArray extends Int16Array {\n", " constructor(seq, shape) {\n", " super(seq);\n", " this.__ndarray__ = __ndarray__;\n", " this.dtype = \"int16\";\n", " this.shape = shape !== null && shape !== void 0 ? shape : (is_NDArray(seq) ? seq.shape : [this.length]);\n", " }\n", " }\n", " exports.Int16NDArray = Int16NDArray;\n", " Int16NDArray.__name__ = \"Int16NDArray\";\n", " class Uint32NDArray extends Uint32Array {\n", " constructor(seq, shape) {\n", " super(seq);\n", " this.__ndarray__ = __ndarray__;\n", " this.dtype = \"uint32\";\n", " this.shape = shape !== null && shape !== void 0 ? shape : (is_NDArray(seq) ? seq.shape : [this.length]);\n", " }\n", " }\n", " exports.Uint32NDArray = Uint32NDArray;\n", " Uint32NDArray.__name__ = \"Uint32NDArray\";\n", " class Int32NDArray extends Int32Array {\n", " constructor(seq, shape) {\n", " super(seq);\n", " this.__ndarray__ = __ndarray__;\n", " this.dtype = \"int32\";\n", " this.shape = shape !== null && shape !== void 0 ? shape : (is_NDArray(seq) ? seq.shape : [this.length]);\n", " }\n", " }\n", " exports.Int32NDArray = Int32NDArray;\n", " Int32NDArray.__name__ = \"Int32NDArray\";\n", " class Float32NDArray extends Float32Array {\n", " constructor(seq, shape) {\n", " super(seq);\n", " this.__ndarray__ = __ndarray__;\n", " this.dtype = \"float32\";\n", " this.shape = shape !== null && shape !== void 0 ? shape : (is_NDArray(seq) ? seq.shape : [this.length]);\n", " }\n", " }\n", " exports.Float32NDArray = Float32NDArray;\n", " Float32NDArray.__name__ = \"Float32NDArray\";\n", " class Float64NDArray extends Float64Array {\n", " constructor(seq, shape) {\n", " super(seq);\n", " this.__ndarray__ = __ndarray__;\n", " this.dtype = \"float64\";\n", " this.shape = shape !== null && shape !== void 0 ? shape : (is_NDArray(seq) ? seq.shape : [this.length]);\n", " }\n", " }\n", " exports.Float64NDArray = Float64NDArray;\n", " Float64NDArray.__name__ = \"Float64NDArray\";\n", " function is_NDArray(v) {\n", " return types_1.isObject(v) && v.__ndarray__ == __ndarray__;\n", " }\n", " exports.is_NDArray = is_NDArray;\n", " function ndarray(array, options = {}) {\n", " let { dtype } = options;\n", " if (dtype == null) {\n", " if (array instanceof ArrayBuffer || types_1.isArray(array)) {\n", " dtype = \"float64\";\n", " }\n", " else {\n", " dtype = (() => {\n", " switch (true) {\n", " case array instanceof Uint8Array: return \"uint8\";\n", " case array instanceof Int8Array: return \"int8\";\n", " case array instanceof Uint16Array: return \"uint16\";\n", " case array instanceof Int16Array: return \"int16\";\n", " case array instanceof Uint32Array: return \"uint32\";\n", " case array instanceof Int32Array: return \"int32\";\n", " case array instanceof Float32Array: return \"float32\";\n", " case array instanceof Float64Array: return \"float64\";\n", " default:\n", " assert_1.unreachable();\n", " }\n", " })();\n", " }\n", " }\n", " const { shape } = options;\n", " switch (dtype) {\n", " case \"uint8\": return new Uint8NDArray(array, shape);\n", " case \"int8\": return new Int8NDArray(array, shape);\n", " case \"uint16\": return new Uint16NDArray(array, shape);\n", " case \"int16\": return new Int16NDArray(array, shape);\n", " case \"uint32\": return new Uint32NDArray(array, shape);\n", " case \"int32\": return new Int32NDArray(array, shape);\n", " case \"float32\": return new Float32NDArray(array, shape);\n", " case \"float64\": return new Float64NDArray(array, shape);\n", " }\n", " }\n", " exports.ndarray = ndarray;\n", " },\n", " /* core/util/serialization.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const types_1 = require(8) /* ./types */;\n", " const compat_1 = require(28) /* ./compat */;\n", " const ndarray = tslib_1.__importStar(require(26) /* ./ndarray */);\n", " function buffer_to_base64(buffer) {\n", " const bytes = new Uint8Array(buffer);\n", " const chars = Array.from(bytes).map((b) => String.fromCharCode(b));\n", " return btoa(chars.join(\"\"));\n", " }\n", " exports.buffer_to_base64 = buffer_to_base64;\n", " function base64_to_buffer(base64) {\n", " const binary_string = atob(base64);\n", " const len = binary_string.length;\n", " const bytes = new Uint8Array(len);\n", " for (let i = 0, end = len; i < end; i++) {\n", " bytes[i] = binary_string.charCodeAt(i);\n", " }\n", " return bytes.buffer;\n", " }\n", " exports.base64_to_buffer = base64_to_buffer;\n", " exports.BYTE_ORDER = compat_1.is_little_endian ? \"little\" : \"big\";\n", " function swap16(a) {\n", " const x = new Uint8Array(a.buffer, a.byteOffset, a.length * 2);\n", " for (let i = 0, end = x.length; i < end; i += 2) {\n", " const t = x[i];\n", " x[i] = x[i + 1];\n", " x[i + 1] = t;\n", " }\n", " }\n", " exports.swap16 = swap16;\n", " function swap32(a) {\n", " const x = new Uint8Array(a.buffer, a.byteOffset, a.length * 4);\n", " for (let i = 0, end = x.length; i < end; i += 4) {\n", " let t = x[i];\n", " x[i] = x[i + 3];\n", " x[i + 3] = t;\n", " t = x[i + 1];\n", " x[i + 1] = x[i + 2];\n", " x[i + 2] = t;\n", " }\n", " }\n", " exports.swap32 = swap32;\n", " function swap64(a) {\n", " const x = new Uint8Array(a.buffer, a.byteOffset, a.length * 8);\n", " for (let i = 0, end = x.length; i < end; i += 8) {\n", " let t = x[i];\n", " x[i] = x[i + 7];\n", " x[i + 7] = t;\n", " t = x[i + 1];\n", " x[i + 1] = x[i + 6];\n", " x[i + 6] = t;\n", " t = x[i + 2];\n", " x[i + 2] = x[i + 5];\n", " x[i + 5] = t;\n", " t = x[i + 3];\n", " x[i + 3] = x[i + 4];\n", " x[i + 4] = t;\n", " }\n", " }\n", " exports.swap64 = swap64;\n", " function is_NDArray_ref(v) {\n", " return types_1.isPlainObject(v) && (\"__buffer__\" in v || \"__ndarray__\" in v);\n", " }\n", " exports.is_NDArray_ref = is_NDArray_ref;\n", " function decode_NDArray(ref, buffers) {\n", " const { shape, dtype, order } = ref;\n", " let bytes;\n", " if (\"__buffer__\" in ref) {\n", " const buffer = buffers.get(ref.__buffer__);\n", " if (buffer != null)\n", " bytes = buffer;\n", " else\n", " throw new Error(`buffer for ${ref.__buffer__} not found`);\n", " }\n", " else {\n", " bytes = base64_to_buffer(ref.__ndarray__);\n", " }\n", " const array = (() => {\n", " switch (dtype) {\n", " case \"uint8\": return new ndarray.Uint8NDArray(bytes, shape);\n", " case \"int8\": return new ndarray.Int8NDArray(bytes, shape);\n", " case \"uint16\": return new ndarray.Uint16NDArray(bytes, shape);\n", " case \"int16\": return new ndarray.Int16NDArray(bytes, shape);\n", " case \"uint32\": return new ndarray.Uint32NDArray(bytes, shape);\n", " case \"int32\": return new ndarray.Int32NDArray(bytes, shape);\n", " case \"float32\": return new ndarray.Float32NDArray(bytes, shape);\n", " case \"float64\": return new ndarray.Float64NDArray(bytes, shape);\n", " }\n", " })();\n", " if (order !== exports.BYTE_ORDER) {\n", " switch (array.BYTES_PER_ELEMENT) {\n", " case 2:\n", " swap16(array);\n", " break;\n", " case 4:\n", " swap32(array);\n", " break;\n", " case 8:\n", " swap64(array);\n", " break;\n", " }\n", " }\n", " return array;\n", " }\n", " exports.decode_NDArray = decode_NDArray;\n", " function encode_NDArray(array, buffers) {\n", " const data = {\n", " order: exports.BYTE_ORDER,\n", " dtype: array.dtype,\n", " shape: array.shape,\n", " };\n", " if (buffers != null) {\n", " const __buffer__ = `${buffers.size}`;\n", " buffers.set(__buffer__, array.buffer);\n", " return Object.assign({ __buffer__ }, data);\n", " }\n", " else {\n", " const __ndarray__ = buffer_to_base64(array.buffer);\n", " return Object.assign({ __ndarray__ }, data);\n", " }\n", " }\n", " exports.encode_NDArray = encode_NDArray;\n", " },\n", " /* core/util/compat.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.is_ie = (() => {\n", " const ua = typeof navigator !== \"undefined\" ? navigator.userAgent : \"\";\n", " return ua.indexOf('MSIE') >= 0 || ua.indexOf('Trident') > 0 || ua.indexOf('Edge') > 0;\n", " })();\n", " exports.is_mobile = (() => {\n", " return typeof window !== \"undefined\" && (\"ontouchstart\" in window || navigator.maxTouchPoints > 0);\n", " })();\n", " exports.is_little_endian = (() => {\n", " const buf = new ArrayBuffer(4);\n", " const buf8 = new Uint8Array(buf);\n", " const buf32 = new Uint32Array(buf);\n", " buf32[1] = 0x0a0b0c0d;\n", " let little_endian = true;\n", " if (buf8[4] == 0x0a && buf8[5] == 0x0b && buf8[6] == 0x0c && buf8[7] == 0x0d) {\n", " little_endian = false;\n", " }\n", " return little_endian;\n", " })();\n", " },\n", " /* models/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " tslib_1.__exportStar(require(30) /* ./annotations */, exports);\n", " tslib_1.__exportStar(require(149) /* ./axes */, exports);\n", " tslib_1.__exportStar(require(176) /* ./callbacks */, exports);\n", " tslib_1.__exportStar(require(180) /* ./canvas */, exports);\n", " tslib_1.__exportStar(require(194) /* ./expressions */, exports);\n", " tslib_1.__exportStar(require(198) /* ./filters */, exports);\n", " tslib_1.__exportStar(require(204) /* ./formatters */, exports);\n", " tslib_1.__exportStar(require(208) /* ./glyphs */, exports);\n", " tslib_1.__exportStar(require(238) /* ./graphs */, exports);\n", " tslib_1.__exportStar(require(241) /* ./grids */, exports);\n", " tslib_1.__exportStar(require(243) /* ./layouts */, exports);\n", " tslib_1.__exportStar(require(260) /* ./mappers */, exports);\n", " tslib_1.__exportStar(require(123) /* ./transforms */, exports);\n", " tslib_1.__exportStar(require(266) /* ./markers */, exports);\n", " tslib_1.__exportStar(require(270) /* ./plots */, exports);\n", " tslib_1.__exportStar(require(297) /* ./ranges */, exports);\n", " tslib_1.__exportStar(require(298) /* ./renderers */, exports);\n", " tslib_1.__exportStar(require(299) /* ./scales */, exports);\n", " tslib_1.__exportStar(require(300) /* ./selections */, exports);\n", " tslib_1.__exportStar(require(301) /* ./sources */, exports);\n", " tslib_1.__exportStar(require(306) /* ./tickers */, exports);\n", " tslib_1.__exportStar(require(308) /* ./tiles */, exports);\n", " tslib_1.__exportStar(require(319) /* ./textures */, exports);\n", " tslib_1.__exportStar(require(323) /* ./tools */, exports);\n", " },\n", " /* models/annotations/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var annotation_1 = require(31) /* ./annotation */;\n", " exports.Annotation = annotation_1.Annotation;\n", " var arrow_1 = require(74) /* ./arrow */;\n", " exports.Arrow = arrow_1.Arrow;\n", " var arrow_head_1 = require(75) /* ./arrow_head */;\n", " exports.ArrowHead = arrow_head_1.ArrowHead;\n", " var arrow_head_2 = require(75) /* ./arrow_head */;\n", " exports.OpenHead = arrow_head_2.OpenHead;\n", " var arrow_head_3 = require(75) /* ./arrow_head */;\n", " exports.NormalHead = arrow_head_3.NormalHead;\n", " var arrow_head_4 = require(75) /* ./arrow_head */;\n", " exports.TeeHead = arrow_head_4.TeeHead;\n", " var arrow_head_5 = require(75) /* ./arrow_head */;\n", " exports.VeeHead = arrow_head_5.VeeHead;\n", " var band_1 = require(106) /* ./band */;\n", " exports.Band = band_1.Band;\n", " var box_annotation_1 = require(107) /* ./box_annotation */;\n", " exports.BoxAnnotation = box_annotation_1.BoxAnnotation;\n", " var color_bar_1 = require(108) /* ./color_bar */;\n", " exports.ColorBar = color_bar_1.ColorBar;\n", " var label_1 = require(133) /* ./label */;\n", " exports.Label = label_1.Label;\n", " var label_set_1 = require(135) /* ./label_set */;\n", " exports.LabelSet = label_set_1.LabelSet;\n", " var legend_1 = require(136) /* ./legend */;\n", " exports.Legend = legend_1.Legend;\n", " var legend_item_1 = require(137) /* ./legend_item */;\n", " exports.LegendItem = legend_item_1.LegendItem;\n", " var poly_annotation_1 = require(139) /* ./poly_annotation */;\n", " exports.PolyAnnotation = poly_annotation_1.PolyAnnotation;\n", " var slope_1 = require(140) /* ./slope */;\n", " exports.Slope = slope_1.Slope;\n", " var span_1 = require(141) /* ./span */;\n", " exports.Span = span_1.Span;\n", " var text_annotation_1 = require(134) /* ./text_annotation */;\n", " exports.TextAnnotation = text_annotation_1.TextAnnotation;\n", " var title_1 = require(142) /* ./title */;\n", " exports.Title = title_1.Title;\n", " var toolbar_panel_1 = require(143) /* ./toolbar_panel */;\n", " exports.ToolbarPanel = toolbar_panel_1.ToolbarPanel;\n", " var tooltip_1 = require(144) /* ./tooltip */;\n", " exports.Tooltip = tooltip_1.Tooltip;\n", " var whisker_1 = require(148) /* ./whisker */;\n", " exports.Whisker = whisker_1.Whisker;\n", " },\n", " /* models/annotations/annotation.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const proj = tslib_1.__importStar(require(32) /* ../../core/util/projections */);\n", " const object_1 = require(17) /* ../../core/util/object */;\n", " const renderer_1 = require(65) /* ../renderers/renderer */;\n", " const annotations_css_1 = tslib_1.__importDefault(require(73) /* ../../styles/annotations.css */);\n", " class AnnotationView extends renderer_1.RendererView {\n", " get panel() {\n", " return this.layout;\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " const p = this.model.properties;\n", " this.on_change(p.visible, () => this.plot_view.request_layout());\n", " }\n", " styles() {\n", " return [...super.styles(), annotations_css_1.default];\n", " }\n", " get_size() {\n", " if (this.model.visible) {\n", " const { width, height } = this._get_size();\n", " return { width: Math.round(width), height: Math.round(height) };\n", " }\n", " else\n", " return { width: 0, height: 0 };\n", " }\n", " _get_size() {\n", " throw new Error(\"not implemented\");\n", " }\n", " set_data(source) {\n", " const data = this.model.materialize_dataspecs(source);\n", " object_1.extend(this, data);\n", " if (this.plot_model.use_map) {\n", " const self = this;\n", " if (self._x != null)\n", " [self._x, self._y] = proj.project_xy(self._x, self._y);\n", " if (self._xs != null)\n", " [self._xs, self._ys] = proj.project_xsys(self._xs, self._ys);\n", " }\n", " }\n", " get needs_clip() {\n", " return this.layout == null; // TODO: change this, when center layout is fully implemented\n", " }\n", " serializable_state() {\n", " const state = super.serializable_state();\n", " return this.layout == null ? state : Object.assign(Object.assign({}, state), { bbox: this.layout.bbox.box });\n", " }\n", " }\n", " exports.AnnotationView = AnnotationView;\n", " AnnotationView.__name__ = \"AnnotationView\";\n", " class Annotation extends renderer_1.Renderer {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Annotation() {\n", " this.override({\n", " level: 'annotation',\n", " });\n", " }\n", " }\n", " exports.Annotation = Annotation;\n", " Annotation.__name__ = \"Annotation\";\n", " Annotation.init_Annotation();\n", " },\n", " /* core/util/projections.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const core_1 = tslib_1.__importDefault(require(33) /* proj4/lib/core */);\n", " const Proj_1 = tslib_1.__importDefault(require(34) /* proj4/lib/Proj */);\n", " const mercator = new Proj_1.default('GOOGLE');\n", " const wgs84 = new Proj_1.default('WGS84');\n", " exports.wgs84_mercator = core_1.default(wgs84, mercator);\n", " const mercator_bounds = {\n", " lon: [-20026376.39, 20026376.39],\n", " lat: [-20048966.10, 20048966.10],\n", " };\n", " const latlon_bounds = {\n", " lon: [-180, 180],\n", " lat: [-85.06, 85.06],\n", " };\n", " function clip_mercator(low, high, dimension) {\n", " const [min, max] = mercator_bounds[dimension];\n", " return [Math.max(low, min), Math.min(high, max)];\n", " }\n", " exports.clip_mercator = clip_mercator;\n", " function in_bounds(value, dimension) {\n", " const [min, max] = latlon_bounds[dimension];\n", " return min < value && value < max;\n", " }\n", " exports.in_bounds = in_bounds;\n", " function project_xy(x, y) {\n", " const n = Math.min(x.length, y.length);\n", " const merc_x_s = new Array(n);\n", " const merc_y_s = new Array(n);\n", " for (let i = 0; i < n; i++) {\n", " const [merc_x, merc_y] = exports.wgs84_mercator.forward([x[i], y[i]]);\n", " merc_x_s[i] = merc_x;\n", " merc_y_s[i] = merc_y;\n", " }\n", " return [merc_x_s, merc_y_s];\n", " }\n", " exports.project_xy = project_xy;\n", " function project_xsys(xs, ys) {\n", " const n = Math.min(xs.length, ys.length);\n", " const merc_xs_s = new Array(n);\n", " const merc_ys_s = new Array(n);\n", " for (let i = 0; i < n; i++) {\n", " const [merc_x_s, merc_y_s] = project_xy(xs[i], ys[i]);\n", " merc_xs_s[i] = merc_x_s;\n", " merc_ys_s[i] = merc_y_s;\n", " }\n", " return [merc_xs_s, merc_ys_s];\n", " }\n", " exports.project_xsys = project_xsys;\n", " },\n", " /* proj4/lib/core.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const Proj_1 = tslib_1.__importDefault(require(34) /* ./Proj */);\n", " const transform_1 = tslib_1.__importDefault(require(59) /* ./transform */);\n", " var wgs84 = Proj_1.default('WGS84');\n", " function transformer(from, to, coords) {\n", " var transformedArray, out, keys;\n", " if (Array.isArray(coords)) {\n", " transformedArray = transform_1.default(from, to, coords) || { x: NaN, y: NaN };\n", " if (coords.length > 2) {\n", " if ((typeof from.name !== 'undefined' && from.name === 'geocent') || (typeof to.name !== 'undefined' && to.name === 'geocent')) {\n", " if (typeof transformedArray.z === 'number') {\n", " return [transformedArray.x, transformedArray.y, transformedArray.z].concat(coords.splice(3));\n", " }\n", " else {\n", " return [transformedArray.x, transformedArray.y, coords[2]].concat(coords.splice(3));\n", " }\n", " }\n", " else {\n", " return [transformedArray.x, transformedArray.y].concat(coords.splice(2));\n", " }\n", " }\n", " else {\n", " return [transformedArray.x, transformedArray.y];\n", " }\n", " }\n", " else {\n", " out = transform_1.default(from, to, coords);\n", " keys = Object.keys(coords);\n", " if (keys.length === 2) {\n", " return out;\n", " }\n", " keys.forEach(function (key) {\n", " if ((typeof from.name !== 'undefined' && from.name === 'geocent') || (typeof to.name !== 'undefined' && to.name === 'geocent')) {\n", " if (key === 'x' || key === 'y' || key === 'z') {\n", " return;\n", " }\n", " }\n", " else {\n", " if (key === 'x' || key === 'y') {\n", " return;\n", " }\n", " }\n", " out[key] = coords[key];\n", " });\n", " return out;\n", " }\n", " }\n", " function checkProj(item) {\n", " if (item instanceof Proj_1.default) {\n", " return item;\n", " }\n", " if (item.oProj) {\n", " return item.oProj;\n", " }\n", " return Proj_1.default(item);\n", " }\n", " function proj4(fromProj, toProj, coord) {\n", " fromProj = checkProj(fromProj);\n", " var single = false;\n", " var obj;\n", " if (typeof toProj === 'undefined') {\n", " toProj = fromProj;\n", " fromProj = wgs84;\n", " single = true;\n", " }\n", " else if (typeof toProj.x !== 'undefined' || Array.isArray(toProj)) {\n", " coord = toProj;\n", " toProj = fromProj;\n", " fromProj = wgs84;\n", " single = true;\n", " }\n", " toProj = checkProj(toProj);\n", " if (coord) {\n", " return transformer(fromProj, toProj, coord);\n", " }\n", " else {\n", " obj = {\n", " forward: function (coords) {\n", " return transformer(fromProj, toProj, coords);\n", " },\n", " inverse: function (coords) {\n", " return transformer(toProj, fromProj, coords);\n", " }\n", " };\n", " if (single) {\n", " obj.oProj = toProj;\n", " }\n", " return obj;\n", " }\n", " }\n", " exports.default = proj4;\n", " },\n", " /* proj4/lib/Proj.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const parseCode_1 = tslib_1.__importDefault(require(35) /* ./parseCode */);\n", " const extend_1 = tslib_1.__importDefault(require(46) /* ./extend */);\n", " const projections_1 = tslib_1.__importDefault(require(47) /* ./projections */);\n", " const deriveConstants_1 = require(55) /* ./deriveConstants */;\n", " const Datum_1 = tslib_1.__importDefault(require(57) /* ./constants/Datum */);\n", " const datum_1 = tslib_1.__importDefault(require(58) /* ./datum */);\n", " const match_1 = tslib_1.__importDefault(require(42) /* ./match */);\n", " function Projection(srsCode, callback) {\n", " if (!(this instanceof Projection)) {\n", " return new Projection(srsCode);\n", " }\n", " callback = callback || function (error) {\n", " if (error) {\n", " throw error;\n", " }\n", " };\n", " var json = parseCode_1.default(srsCode);\n", " if (typeof json !== 'object') {\n", " callback(srsCode);\n", " return;\n", " }\n", " var ourProj = Projection.projections.get(json.projName);\n", " if (!ourProj) {\n", " callback(srsCode);\n", " return;\n", " }\n", " if (json.datumCode && json.datumCode !== 'none') {\n", " var datumDef = match_1.default(Datum_1.default, json.datumCode);\n", " if (datumDef) {\n", " json.datum_params = datumDef.towgs84 ? datumDef.towgs84.split(',') : null;\n", " json.ellps = datumDef.ellipse;\n", " json.datumName = datumDef.datumName ? datumDef.datumName : json.datumCode;\n", " }\n", " }\n", " json.k0 = json.k0 || 1.0;\n", " json.axis = json.axis || 'enu';\n", " json.ellps = json.ellps || 'wgs84';\n", " var sphere_ = deriveConstants_1.sphere(json.a, json.b, json.rf, json.ellps, json.sphere);\n", " var ecc = deriveConstants_1.eccentricity(sphere_.a, sphere_.b, sphere_.rf, json.R_A);\n", " var datumObj = json.datum || datum_1.default(json.datumCode, json.datum_params, sphere_.a, sphere_.b, ecc.es, ecc.ep2);\n", " extend_1.default(this, json); // transfer everything over from the projection because we don't know what we'll need\n", " extend_1.default(this, ourProj); // transfer all the methods from the projection\n", " // copy the 4 things over we calulated in deriveConstants.sphere\n", " this.a = sphere_.a;\n", " this.b = sphere_.b;\n", " this.rf = sphere_.rf;\n", " this.sphere = sphere_.sphere;\n", " // copy the 3 things we calculated in deriveConstants.eccentricity\n", " this.es = ecc.es;\n", " this.e = ecc.e;\n", " this.ep2 = ecc.ep2;\n", " // add in the datum object\n", " this.datum = datumObj;\n", " // init the projection\n", " this.init();\n", " // legecy callback from back in the day when it went to spatialreference.org\n", " callback(null, this);\n", " }\n", " Projection.projections = projections_1.default;\n", " Projection.projections.start();\n", " exports.default = Projection;\n", " },\n", " /* proj4/lib/parseCode.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const defs_1 = tslib_1.__importDefault(require(36) /* ./defs */);\n", " const wkt_parser_1 = tslib_1.__importDefault(require(43) /* wkt-parser */);\n", " const projString_1 = tslib_1.__importDefault(require(38) /* ./projString */);\n", " const match_1 = tslib_1.__importDefault(require(42) /* ./match */);\n", " function testObj(code) {\n", " return typeof code === 'string';\n", " }\n", " function testDef(code) {\n", " return code in defs_1.default;\n", " }\n", " var codeWords = ['PROJECTEDCRS', 'PROJCRS', 'GEOGCS', 'GEOCCS', 'PROJCS', 'LOCAL_CS', 'GEODCRS', 'GEODETICCRS', 'GEODETICDATUM', 'ENGCRS', 'ENGINEERINGCRS'];\n", " function testWKT(code) {\n", " return codeWords.some(function (word) {\n", " return code.indexOf(word) > -1;\n", " });\n", " }\n", " var codes = ['3857', '900913', '3785', '102113'];\n", " function checkMercator(item) {\n", " var auth = match_1.default(item, 'authority');\n", " if (!auth) {\n", " return;\n", " }\n", " var code = match_1.default(auth, 'epsg');\n", " return code && codes.indexOf(code) > -1;\n", " }\n", " function checkProjStr(item) {\n", " var ext = match_1.default(item, 'extension');\n", " if (!ext) {\n", " return;\n", " }\n", " return match_1.default(ext, 'proj4');\n", " }\n", " function testProj(code) {\n", " return code[0] === '+';\n", " }\n", " function parse(code) {\n", " if (testObj(code)) {\n", " //check to see if this is a WKT string\n", " if (testDef(code)) {\n", " return defs_1.default[code];\n", " }\n", " if (testWKT(code)) {\n", " var out = wkt_parser_1.default(code);\n", " // test of spetial case, due to this being a very common and often malformed\n", " if (checkMercator(out)) {\n", " return defs_1.default['EPSG:3857'];\n", " }\n", " var maybeProjStr = checkProjStr(out);\n", " if (maybeProjStr) {\n", " return projString_1.default(maybeProjStr);\n", " }\n", " return out;\n", " }\n", " if (testProj(code)) {\n", " return projString_1.default(code);\n", " }\n", " }\n", " else {\n", " return code;\n", " }\n", " }\n", " exports.default = parse;\n", " },\n", " /* proj4/lib/defs.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const global_1 = tslib_1.__importDefault(require(37) /* ./global */);\n", " const projString_1 = tslib_1.__importDefault(require(38) /* ./projString */);\n", " const wkt_parser_1 = tslib_1.__importDefault(require(43) /* wkt-parser */);\n", " function defs(name) {\n", " /*global console*/\n", " var that = this;\n", " if (arguments.length === 2) {\n", " var def = arguments[1];\n", " if (typeof def === 'string') {\n", " if (def.charAt(0) === '+') {\n", " defs[name] = projString_1.default(arguments[1]);\n", " }\n", " else {\n", " defs[name] = wkt_parser_1.default(arguments[1]);\n", " }\n", " }\n", " else {\n", " defs[name] = def;\n", " }\n", " }\n", " else if (arguments.length === 1) {\n", " if (Array.isArray(name)) {\n", " return name.map(function (v) {\n", " if (Array.isArray(v)) {\n", " defs.apply(that, v);\n", " }\n", " else {\n", " defs(v);\n", " }\n", " });\n", " }\n", " else if (typeof name === 'string') {\n", " if (name in defs) {\n", " return defs[name];\n", " }\n", " }\n", " else if ('EPSG' in name) {\n", " defs['EPSG:' + name.EPSG] = name;\n", " }\n", " else if ('ESRI' in name) {\n", " defs['ESRI:' + name.ESRI] = name;\n", " }\n", " else if ('IAU2000' in name) {\n", " defs['IAU2000:' + name.IAU2000] = name;\n", " }\n", " else {\n", " console.log(name);\n", " }\n", " return;\n", " }\n", " }\n", " global_1.default(defs);\n", " exports.default = defs;\n", " },\n", " /* proj4/lib/global.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " function default_1(defs) {\n", " defs('EPSG:4326', \"+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees\");\n", " defs('EPSG:4269', \"+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees\");\n", " defs('EPSG:3857', \"+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs\");\n", " defs.WGS84 = defs['EPSG:4326'];\n", " defs['EPSG:3785'] = defs['EPSG:3857']; // maintain backward compat, official code is 3857\n", " defs.GOOGLE = defs['EPSG:3857'];\n", " defs['EPSG:900913'] = defs['EPSG:3857'];\n", " defs['EPSG:102113'] = defs['EPSG:3857'];\n", " }\n", " exports.default = default_1;\n", " },\n", " /* proj4/lib/projString.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const values_1 = require(39) /* ./constants/values */;\n", " const PrimeMeridian_1 = tslib_1.__importDefault(require(40) /* ./constants/PrimeMeridian */);\n", " const units_1 = tslib_1.__importDefault(require(41) /* ./constants/units */);\n", " const match_1 = tslib_1.__importDefault(require(42) /* ./match */);\n", " function default_1(defData) {\n", " var self = {};\n", " var paramObj = defData.split('+').map(function (v) {\n", " return v.trim();\n", " }).filter(function (a) {\n", " return a;\n", " }).reduce(function (p, a) {\n", " var split = a.split('=');\n", " split.push(true);\n", " p[split[0].toLowerCase()] = split[1];\n", " return p;\n", " }, {});\n", " var paramName, paramVal, paramOutname;\n", " var params = {\n", " proj: 'projName',\n", " datum: 'datumCode',\n", " rf: function (v) {\n", " self.rf = parseFloat(v);\n", " },\n", " lat_0: function (v) {\n", " self.lat0 = v * values_1.D2R;\n", " },\n", " lat_1: function (v) {\n", " self.lat1 = v * values_1.D2R;\n", " },\n", " lat_2: function (v) {\n", " self.lat2 = v * values_1.D2R;\n", " },\n", " lat_ts: function (v) {\n", " self.lat_ts = v * values_1.D2R;\n", " },\n", " lon_0: function (v) {\n", " self.long0 = v * values_1.D2R;\n", " },\n", " lon_1: function (v) {\n", " self.long1 = v * values_1.D2R;\n", " },\n", " lon_2: function (v) {\n", " self.long2 = v * values_1.D2R;\n", " },\n", " alpha: function (v) {\n", " self.alpha = parseFloat(v) * values_1.D2R;\n", " },\n", " lonc: function (v) {\n", " self.longc = v * values_1.D2R;\n", " },\n", " x_0: function (v) {\n", " self.x0 = parseFloat(v);\n", " },\n", " y_0: function (v) {\n", " self.y0 = parseFloat(v);\n", " },\n", " k_0: function (v) {\n", " self.k0 = parseFloat(v);\n", " },\n", " k: function (v) {\n", " self.k0 = parseFloat(v);\n", " },\n", " a: function (v) {\n", " self.a = parseFloat(v);\n", " },\n", " b: function (v) {\n", " self.b = parseFloat(v);\n", " },\n", " r_a: function () {\n", " self.R_A = true;\n", " },\n", " zone: function (v) {\n", " self.zone = parseInt(v, 10);\n", " },\n", " south: function () {\n", " self.utmSouth = true;\n", " },\n", " towgs84: function (v) {\n", " self.datum_params = v.split(\",\").map(function (a) {\n", " return parseFloat(a);\n", " });\n", " },\n", " to_meter: function (v) {\n", " self.to_meter = parseFloat(v);\n", " },\n", " units: function (v) {\n", " self.units = v;\n", " var unit = match_1.default(units_1.default, v);\n", " if (unit) {\n", " self.to_meter = unit.to_meter;\n", " }\n", " },\n", " from_greenwich: function (v) {\n", " self.from_greenwich = v * values_1.D2R;\n", " },\n", " pm: function (v) {\n", " var pm = match_1.default(PrimeMeridian_1.default, v);\n", " self.from_greenwich = (pm ? pm : parseFloat(v)) * values_1.D2R;\n", " },\n", " nadgrids: function (v) {\n", " if (v === '@null') {\n", " self.datumCode = 'none';\n", " }\n", " else {\n", " self.nadgrids = v;\n", " }\n", " },\n", " axis: function (v) {\n", " var legalAxis = \"ewnsud\";\n", " if (v.length === 3 && legalAxis.indexOf(v.substr(0, 1)) !== -1 && legalAxis.indexOf(v.substr(1, 1)) !== -1 && legalAxis.indexOf(v.substr(2, 1)) !== -1) {\n", " self.axis = v;\n", " }\n", " }\n", " };\n", " for (paramName in paramObj) {\n", " paramVal = paramObj[paramName];\n", " if (paramName in params) {\n", " paramOutname = params[paramName];\n", " if (typeof paramOutname === 'function') {\n", " paramOutname(paramVal);\n", " }\n", " else {\n", " self[paramOutname] = paramVal;\n", " }\n", " }\n", " else {\n", " self[paramName] = paramVal;\n", " }\n", " }\n", " if (typeof self.datumCode === 'string' && self.datumCode !== \"WGS84\") {\n", " self.datumCode = self.datumCode.toLowerCase();\n", " }\n", " return self;\n", " }\n", " exports.default = default_1;\n", " },\n", " /* proj4/lib/constants/values.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.PJD_3PARAM = 1;\n", " exports.PJD_7PARAM = 2;\n", " exports.PJD_WGS84 = 4; // WGS84 or equivalent\n", " exports.PJD_NODATUM = 5; // WGS84 or equivalent\n", " exports.SEC_TO_RAD = 4.84813681109535993589914102357e-6;\n", " exports.HALF_PI = Math.PI / 2;\n", " // ellipoid pj_set_ell.c\n", " exports.SIXTH = 0.1666666666666666667;\n", " /* 1/6 */\n", " exports.RA4 = 0.04722222222222222222;\n", " /* 17/360 */\n", " exports.RA6 = 0.02215608465608465608;\n", " exports.EPSLN = 1.0e-10;\n", " // you'd think you could use Number.EPSILON above but that makes\n", " // Mollweide get into an infinate loop.\n", " exports.D2R = 0.01745329251994329577;\n", " exports.R2D = 57.29577951308232088;\n", " exports.FORTPI = Math.PI / 4;\n", " exports.TWO_PI = Math.PI * 2;\n", " // SPI is slightly greater than Math.PI, so values that exceed the -180..180\n", " // degree range by a tiny amount don't get wrapped. This prevents points that\n", " // have drifted from their original location along the 180th meridian (due to\n", " // floating point error) from changing their sign.\n", " exports.SPI = 3.14159265359;\n", " },\n", " /* proj4/lib/constants/PrimeMeridian.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var exports$1 = {};\n", " exports.default = exports$1;\n", " exports$1.greenwich = 0.0; //\"0dE\",\n", " exports$1.lisbon = -9.131906111111; //\"9d07'54.862\\\"W\",\n", " exports$1.paris = 2.337229166667; //\"2d20'14.025\\\"E\",\n", " exports$1.bogota = -74.080916666667; //\"74d04'51.3\\\"W\",\n", " exports$1.madrid = -3.687938888889; //\"3d41'16.58\\\"W\",\n", " exports$1.rome = 12.452333333333; //\"12d27'8.4\\\"E\",\n", " exports$1.bern = 7.439583333333; //\"7d26'22.5\\\"E\",\n", " exports$1.jakarta = 106.807719444444; //\"106d48'27.79\\\"E\",\n", " exports$1.ferro = -17.666666666667; //\"17d40'W\",\n", " exports$1.brussels = 4.367975; //\"4d22'4.71\\\"E\",\n", " exports$1.stockholm = 18.058277777778; //\"18d3'29.8\\\"E\",\n", " exports$1.athens = 23.7163375; //\"23d42'58.815\\\"E\",\n", " exports$1.oslo = 10.722916666667; //\"10d43'22.5\\\"E\"\n", " },\n", " /* proj4/lib/constants/units.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.default = {\n", " ft: { to_meter: 0.3048 },\n", " 'us-ft': { to_meter: 1200 / 3937 }\n", " };\n", " },\n", " /* proj4/lib/match.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var ignoredChar = /[\\s_\\-\\/\\(\\)]/g;\n", " function match(obj, key) {\n", " if (obj[key]) {\n", " return obj[key];\n", " }\n", " var keys = Object.keys(obj);\n", " var lkey = key.toLowerCase().replace(ignoredChar, '');\n", " var i = -1;\n", " var testkey, processedKey;\n", " while (++i < keys.length) {\n", " testkey = keys[i];\n", " processedKey = testkey.toLowerCase().replace(ignoredChar, '');\n", " if (processedKey === lkey) {\n", " return obj[testkey];\n", " }\n", " }\n", " }\n", " exports.default = match;\n", " },\n", " /* wkt-parser/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " var D2R = 0.01745329251994329577;\n", " const parser_1 = tslib_1.__importDefault(require(44) /* ./parser */);\n", " const process_1 = require(45) /* ./process */;\n", " function rename(obj, params) {\n", " var outName = params[0];\n", " var inName = params[1];\n", " if (!(outName in obj) && (inName in obj)) {\n", " obj[outName] = obj[inName];\n", " if (params.length === 3) {\n", " obj[outName] = params[2](obj[outName]);\n", " }\n", " }\n", " }\n", " function d2r(input) {\n", " return input * D2R;\n", " }\n", " function cleanWKT(wkt) {\n", " if (wkt.type === 'GEOGCS') {\n", " wkt.projName = 'longlat';\n", " }\n", " else if (wkt.type === 'LOCAL_CS') {\n", " wkt.projName = 'identity';\n", " wkt.local = true;\n", " }\n", " else {\n", " if (typeof wkt.PROJECTION === 'object') {\n", " wkt.projName = Object.keys(wkt.PROJECTION)[0];\n", " }\n", " else {\n", " wkt.projName = wkt.PROJECTION;\n", " }\n", " }\n", " if (wkt.AXIS) {\n", " var axisOrder = '';\n", " for (var i = 0, ii = wkt.AXIS.length; i < ii; ++i) {\n", " var axis = wkt.AXIS[i];\n", " var descriptor = axis[0].toLowerCase();\n", " if (descriptor.indexOf('north') !== -1) {\n", " axisOrder += 'n';\n", " }\n", " else if (descriptor.indexOf('south') !== -1) {\n", " axisOrder += 's';\n", " }\n", " else if (descriptor.indexOf('east') !== -1) {\n", " axisOrder += 'e';\n", " }\n", " else if (descriptor.indexOf('west') !== -1) {\n", " axisOrder += 'w';\n", " }\n", " }\n", " if (axisOrder.length === 2) {\n", " axisOrder += 'u';\n", " }\n", " if (axisOrder.length === 3) {\n", " wkt.axis = axisOrder;\n", " }\n", " }\n", " if (wkt.UNIT) {\n", " wkt.units = wkt.UNIT.name.toLowerCase();\n", " if (wkt.units === 'metre') {\n", " wkt.units = 'meter';\n", " }\n", " if (wkt.UNIT.convert) {\n", " if (wkt.type === 'GEOGCS') {\n", " if (wkt.DATUM && wkt.DATUM.SPHEROID) {\n", " wkt.to_meter = wkt.UNIT.convert * wkt.DATUM.SPHEROID.a;\n", " }\n", " }\n", " else {\n", " wkt.to_meter = wkt.UNIT.convert;\n", " }\n", " }\n", " }\n", " var geogcs = wkt.GEOGCS;\n", " if (wkt.type === 'GEOGCS') {\n", " geogcs = wkt;\n", " }\n", " if (geogcs) {\n", " //if(wkt.GEOGCS.PRIMEM&&wkt.GEOGCS.PRIMEM.convert){\n", " // wkt.from_greenwich=wkt.GEOGCS.PRIMEM.convert*D2R;\n", " //}\n", " if (geogcs.DATUM) {\n", " wkt.datumCode = geogcs.DATUM.name.toLowerCase();\n", " }\n", " else {\n", " wkt.datumCode = geogcs.name.toLowerCase();\n", " }\n", " if (wkt.datumCode.slice(0, 2) === 'd_') {\n", " wkt.datumCode = wkt.datumCode.slice(2);\n", " }\n", " if (wkt.datumCode === 'new_zealand_geodetic_datum_1949' || wkt.datumCode === 'new_zealand_1949') {\n", " wkt.datumCode = 'nzgd49';\n", " }\n", " if (wkt.datumCode === 'wgs_1984' || wkt.datumCode === 'world_geodetic_system_1984') {\n", " if (wkt.PROJECTION === 'Mercator_Auxiliary_Sphere') {\n", " wkt.sphere = true;\n", " }\n", " wkt.datumCode = 'wgs84';\n", " }\n", " if (wkt.datumCode.slice(-6) === '_ferro') {\n", " wkt.datumCode = wkt.datumCode.slice(0, -6);\n", " }\n", " if (wkt.datumCode.slice(-8) === '_jakarta') {\n", " wkt.datumCode = wkt.datumCode.slice(0, -8);\n", " }\n", " if (~wkt.datumCode.indexOf('belge')) {\n", " wkt.datumCode = 'rnb72';\n", " }\n", " if (geogcs.DATUM && geogcs.DATUM.SPHEROID) {\n", " wkt.ellps = geogcs.DATUM.SPHEROID.name.replace('_19', '').replace(/[Cc]larke\\_18/, 'clrk');\n", " if (wkt.ellps.toLowerCase().slice(0, 13) === 'international') {\n", " wkt.ellps = 'intl';\n", " }\n", " wkt.a = geogcs.DATUM.SPHEROID.a;\n", " wkt.rf = parseFloat(geogcs.DATUM.SPHEROID.rf, 10);\n", " }\n", " if (geogcs.DATUM && geogcs.DATUM.TOWGS84) {\n", " wkt.datum_params = geogcs.DATUM.TOWGS84;\n", " }\n", " if (~wkt.datumCode.indexOf('osgb_1936')) {\n", " wkt.datumCode = 'osgb36';\n", " }\n", " if (~wkt.datumCode.indexOf('osni_1952')) {\n", " wkt.datumCode = 'osni52';\n", " }\n", " if (~wkt.datumCode.indexOf('tm65')\n", " || ~wkt.datumCode.indexOf('geodetic_datum_of_1965')) {\n", " wkt.datumCode = 'ire65';\n", " }\n", " if (wkt.datumCode === 'ch1903+') {\n", " wkt.datumCode = 'ch1903';\n", " }\n", " if (~wkt.datumCode.indexOf('israel')) {\n", " wkt.datumCode = 'isr93';\n", " }\n", " }\n", " if (wkt.b && !isFinite(wkt.b)) {\n", " wkt.b = wkt.a;\n", " }\n", " function toMeter(input) {\n", " var ratio = wkt.to_meter || 1;\n", " return input * ratio;\n", " }\n", " var renamer = function (a) {\n", " return rename(wkt, a);\n", " };\n", " var list = [\n", " ['standard_parallel_1', 'Standard_Parallel_1'],\n", " ['standard_parallel_2', 'Standard_Parallel_2'],\n", " ['false_easting', 'False_Easting'],\n", " ['false_northing', 'False_Northing'],\n", " ['central_meridian', 'Central_Meridian'],\n", " ['latitude_of_origin', 'Latitude_Of_Origin'],\n", " ['latitude_of_origin', 'Central_Parallel'],\n", " ['scale_factor', 'Scale_Factor'],\n", " ['k0', 'scale_factor'],\n", " ['latitude_of_center', 'Latitude_Of_Center'],\n", " ['latitude_of_center', 'Latitude_of_center'],\n", " ['lat0', 'latitude_of_center', d2r],\n", " ['longitude_of_center', 'Longitude_Of_Center'],\n", " ['longitude_of_center', 'Longitude_of_center'],\n", " ['longc', 'longitude_of_center', d2r],\n", " ['x0', 'false_easting', toMeter],\n", " ['y0', 'false_northing', toMeter],\n", " ['long0', 'central_meridian', d2r],\n", " ['lat0', 'latitude_of_origin', d2r],\n", " ['lat0', 'standard_parallel_1', d2r],\n", " ['lat1', 'standard_parallel_1', d2r],\n", " ['lat2', 'standard_parallel_2', d2r],\n", " ['azimuth', 'Azimuth'],\n", " ['alpha', 'azimuth', d2r],\n", " ['srsCode', 'name']\n", " ];\n", " list.forEach(renamer);\n", " if (!wkt.long0 && wkt.longc && (wkt.projName === 'Albers_Conic_Equal_Area' || wkt.projName === 'Lambert_Azimuthal_Equal_Area')) {\n", " wkt.long0 = wkt.longc;\n", " }\n", " if (!wkt.lat_ts && wkt.lat1 && (wkt.projName === 'Stereographic_South_Pole' || wkt.projName === 'Polar Stereographic (variant B)')) {\n", " wkt.lat0 = d2r(wkt.lat1 > 0 ? 90 : -90);\n", " wkt.lat_ts = wkt.lat1;\n", " }\n", " }\n", " function default_1(wkt) {\n", " var lisp = parser_1.default(wkt);\n", " var type = lisp.shift();\n", " var name = lisp.shift();\n", " lisp.unshift(['name', name]);\n", " lisp.unshift(['type', type]);\n", " var obj = {};\n", " process_1.sExpr(lisp, obj);\n", " cleanWKT(obj);\n", " return obj;\n", " }\n", " exports.default = default_1;\n", " },\n", " /* wkt-parser/parser.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.default = parseString;\n", " var NEUTRAL = 1;\n", " var KEYWORD = 2;\n", " var NUMBER = 3;\n", " var QUOTED = 4;\n", " var AFTERQUOTE = 5;\n", " var ENDED = -1;\n", " var whitespace = /\\s/;\n", " var latin = /[A-Za-z]/;\n", " var keyword = /[A-Za-z84]/;\n", " var endThings = /[,\\]]/;\n", " var digets = /[\\d\\.E\\-\\+]/;\n", " // const ignoredChar = /[\\s_\\-\\/\\(\\)]/g;\n", " function Parser(text) {\n", " if (typeof text !== 'string') {\n", " throw new Error('not a string');\n", " }\n", " this.text = text.trim();\n", " this.level = 0;\n", " this.place = 0;\n", " this.root = null;\n", " this.stack = [];\n", " this.currentObject = null;\n", " this.state = NEUTRAL;\n", " }\n", " Parser.prototype.readCharicter = function () {\n", " var char = this.text[this.place++];\n", " if (this.state !== QUOTED) {\n", " while (whitespace.test(char)) {\n", " if (this.place >= this.text.length) {\n", " return;\n", " }\n", " char = this.text[this.place++];\n", " }\n", " }\n", " switch (this.state) {\n", " case NEUTRAL:\n", " return this.neutral(char);\n", " case KEYWORD:\n", " return this.keyword(char);\n", " case QUOTED:\n", " return this.quoted(char);\n", " case AFTERQUOTE:\n", " return this.afterquote(char);\n", " case NUMBER:\n", " return this.number(char);\n", " case ENDED:\n", " return;\n", " }\n", " };\n", " Parser.prototype.afterquote = function (char) {\n", " if (char === '\"') {\n", " this.word += '\"';\n", " this.state = QUOTED;\n", " return;\n", " }\n", " if (endThings.test(char)) {\n", " this.word = this.word.trim();\n", " this.afterItem(char);\n", " return;\n", " }\n", " throw new Error('havn\\'t handled \"' + char + '\" in afterquote yet, index ' + this.place);\n", " };\n", " Parser.prototype.afterItem = function (char) {\n", " if (char === ',') {\n", " if (this.word !== null) {\n", " this.currentObject.push(this.word);\n", " }\n", " this.word = null;\n", " this.state = NEUTRAL;\n", " return;\n", " }\n", " if (char === ']') {\n", " this.level--;\n", " if (this.word !== null) {\n", " this.currentObject.push(this.word);\n", " this.word = null;\n", " }\n", " this.state = NEUTRAL;\n", " this.currentObject = this.stack.pop();\n", " if (!this.currentObject) {\n", " this.state = ENDED;\n", " }\n", " return;\n", " }\n", " };\n", " Parser.prototype.number = function (char) {\n", " if (digets.test(char)) {\n", " this.word += char;\n", " return;\n", " }\n", " if (endThings.test(char)) {\n", " this.word = parseFloat(this.word);\n", " this.afterItem(char);\n", " return;\n", " }\n", " throw new Error('havn\\'t handled \"' + char + '\" in number yet, index ' + this.place);\n", " };\n", " Parser.prototype.quoted = function (char) {\n", " if (char === '\"') {\n", " this.state = AFTERQUOTE;\n", " return;\n", " }\n", " this.word += char;\n", " return;\n", " };\n", " Parser.prototype.keyword = function (char) {\n", " if (keyword.test(char)) {\n", " this.word += char;\n", " return;\n", " }\n", " if (char === '[') {\n", " var newObjects = [];\n", " newObjects.push(this.word);\n", " this.level++;\n", " if (this.root === null) {\n", " this.root = newObjects;\n", " }\n", " else {\n", " this.currentObject.push(newObjects);\n", " }\n", " this.stack.push(this.currentObject);\n", " this.currentObject = newObjects;\n", " this.state = NEUTRAL;\n", " return;\n", " }\n", " if (endThings.test(char)) {\n", " this.afterItem(char);\n", " return;\n", " }\n", " throw new Error('havn\\'t handled \"' + char + '\" in keyword yet, index ' + this.place);\n", " };\n", " Parser.prototype.neutral = function (char) {\n", " if (latin.test(char)) {\n", " this.word = char;\n", " this.state = KEYWORD;\n", " return;\n", " }\n", " if (char === '\"') {\n", " this.word = '';\n", " this.state = QUOTED;\n", " return;\n", " }\n", " if (digets.test(char)) {\n", " this.word = char;\n", " this.state = NUMBER;\n", " return;\n", " }\n", " if (endThings.test(char)) {\n", " this.afterItem(char);\n", " return;\n", " }\n", " throw new Error('havn\\'t handled \"' + char + '\" in neutral yet, index ' + this.place);\n", " };\n", " Parser.prototype.output = function () {\n", " while (this.place < this.text.length) {\n", " this.readCharicter();\n", " }\n", " if (this.state === ENDED) {\n", " return this.root;\n", " }\n", " throw new Error('unable to parse string \"' + this.text + '\". State is ' + this.state);\n", " };\n", " function parseString(txt) {\n", " var parser = new Parser(txt);\n", " return parser.output();\n", " }\n", " },\n", " /* wkt-parser/process.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " function mapit(obj, key, value) {\n", " if (Array.isArray(key)) {\n", " value.unshift(key);\n", " key = null;\n", " }\n", " var thing = key ? {} : obj;\n", " var out = value.reduce(function (newObj, item) {\n", " sExpr(item, newObj);\n", " return newObj;\n", " }, thing);\n", " if (key) {\n", " obj[key] = out;\n", " }\n", " }\n", " function sExpr(v, obj) {\n", " if (!Array.isArray(v)) {\n", " obj[v] = true;\n", " return;\n", " }\n", " var key = v.shift();\n", " if (key === 'PARAMETER') {\n", " key = v.shift();\n", " }\n", " if (v.length === 1) {\n", " if (Array.isArray(v[0])) {\n", " obj[key] = {};\n", " sExpr(v[0], obj[key]);\n", " return;\n", " }\n", " obj[key] = v[0];\n", " return;\n", " }\n", " if (!v.length) {\n", " obj[key] = true;\n", " return;\n", " }\n", " if (key === 'TOWGS84') {\n", " obj[key] = v;\n", " return;\n", " }\n", " if (key === 'AXIS') {\n", " if (!(key in obj)) {\n", " obj[key] = [];\n", " }\n", " obj[key].push(v);\n", " return;\n", " }\n", " if (!Array.isArray(key)) {\n", " obj[key] = {};\n", " }\n", " var i;\n", " switch (key) {\n", " case 'UNIT':\n", " case 'PRIMEM':\n", " case 'VERT_DATUM':\n", " obj[key] = {\n", " name: v[0].toLowerCase(),\n", " convert: v[1]\n", " };\n", " if (v.length === 3) {\n", " sExpr(v[2], obj[key]);\n", " }\n", " return;\n", " case 'SPHEROID':\n", " case 'ELLIPSOID':\n", " obj[key] = {\n", " name: v[0],\n", " a: v[1],\n", " rf: v[2]\n", " };\n", " if (v.length === 4) {\n", " sExpr(v[3], obj[key]);\n", " }\n", " return;\n", " case 'PROJECTEDCRS':\n", " case 'PROJCRS':\n", " case 'GEOGCS':\n", " case 'GEOCCS':\n", " case 'PROJCS':\n", " case 'LOCAL_CS':\n", " case 'GEODCRS':\n", " case 'GEODETICCRS':\n", " case 'GEODETICDATUM':\n", " case 'EDATUM':\n", " case 'ENGINEERINGDATUM':\n", " case 'VERT_CS':\n", " case 'VERTCRS':\n", " case 'VERTICALCRS':\n", " case 'COMPD_CS':\n", " case 'COMPOUNDCRS':\n", " case 'ENGINEERINGCRS':\n", " case 'ENGCRS':\n", " case 'FITTED_CS':\n", " case 'LOCAL_DATUM':\n", " case 'DATUM':\n", " v[0] = ['name', v[0]];\n", " mapit(obj, key, v);\n", " return;\n", " default:\n", " i = -1;\n", " while (++i < v.length) {\n", " if (!Array.isArray(v[i])) {\n", " return sExpr(v, obj[key]);\n", " }\n", " }\n", " return mapit(obj, key, v);\n", " }\n", " }\n", " exports.sExpr = sExpr;\n", " },\n", " /* proj4/lib/extend.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " function default_1(destination, source) {\n", " destination = destination || {};\n", " var value, property;\n", " if (!source) {\n", " return destination;\n", " }\n", " for (property in source) {\n", " value = source[property];\n", " if (value !== undefined) {\n", " destination[property] = value;\n", " }\n", " }\n", " return destination;\n", " }\n", " exports.default = default_1;\n", " },\n", " /* proj4/lib/projections.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const merc_1 = tslib_1.__importDefault(require(48) /* ./projections/merc */);\n", " const longlat_1 = tslib_1.__importDefault(require(54) /* ./projections/longlat */);\n", " var projs = [merc_1.default, longlat_1.default];\n", " var names = {};\n", " var projStore = [];\n", " function add(proj, i) {\n", " var len = projStore.length;\n", " if (!proj.names) {\n", " console.log(i);\n", " return true;\n", " }\n", " projStore[len] = proj;\n", " proj.names.forEach(function (n) {\n", " names[n.toLowerCase()] = len;\n", " });\n", " return this;\n", " }\n", " exports.add = add;\n", " function get(name) {\n", " if (!name) {\n", " return false;\n", " }\n", " var n = name.toLowerCase();\n", " if (typeof names[n] !== 'undefined' && projStore[names[n]]) {\n", " return projStore[names[n]];\n", " }\n", " }\n", " exports.get = get;\n", " function start() {\n", " projs.forEach(add);\n", " }\n", " exports.start = start;\n", " exports.default = {\n", " start: start,\n", " add: add,\n", " get: get\n", " };\n", " },\n", " /* proj4/lib/projections/merc.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const msfnz_1 = tslib_1.__importDefault(require(49) /* ../common/msfnz */);\n", " const adjust_lon_1 = tslib_1.__importDefault(require(50) /* ../common/adjust_lon */);\n", " const tsfnz_1 = tslib_1.__importDefault(require(52) /* ../common/tsfnz */);\n", " const phi2z_1 = tslib_1.__importDefault(require(53) /* ../common/phi2z */);\n", " const values_1 = require(39) /* ../constants/values */;\n", " function init() {\n", " var con = this.b / this.a;\n", " this.es = 1 - con * con;\n", " if (!('x0' in this)) {\n", " this.x0 = 0;\n", " }\n", " if (!('y0' in this)) {\n", " this.y0 = 0;\n", " }\n", " this.e = Math.sqrt(this.es);\n", " if (this.lat_ts) {\n", " if (this.sphere) {\n", " this.k0 = Math.cos(this.lat_ts);\n", " }\n", " else {\n", " this.k0 = msfnz_1.default(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts));\n", " }\n", " }\n", " else {\n", " if (!this.k0) {\n", " if (this.k) {\n", " this.k0 = this.k;\n", " }\n", " else {\n", " this.k0 = 1;\n", " }\n", " }\n", " }\n", " }\n", " exports.init = init;\n", " /* Mercator forward equations--mapping lat,long to x,y\n", " --------------------------------------------------*/\n", " function forward(p) {\n", " var lon = p.x;\n", " var lat = p.y;\n", " // convert to radians\n", " if (lat * values_1.R2D > 90 && lat * values_1.R2D < -90 && lon * values_1.R2D > 180 && lon * values_1.R2D < -180) {\n", " return null;\n", " }\n", " var x, y;\n", " if (Math.abs(Math.abs(lat) - values_1.HALF_PI) <= values_1.EPSLN) {\n", " return null;\n", " }\n", " else {\n", " if (this.sphere) {\n", " x = this.x0 + this.a * this.k0 * adjust_lon_1.default(lon - this.long0);\n", " y = this.y0 + this.a * this.k0 * Math.log(Math.tan(values_1.FORTPI + 0.5 * lat));\n", " }\n", " else {\n", " var sinphi = Math.sin(lat);\n", " var ts = tsfnz_1.default(this.e, lat, sinphi);\n", " x = this.x0 + this.a * this.k0 * adjust_lon_1.default(lon - this.long0);\n", " y = this.y0 - this.a * this.k0 * Math.log(ts);\n", " }\n", " p.x = x;\n", " p.y = y;\n", " return p;\n", " }\n", " }\n", " exports.forward = forward;\n", " /* Mercator inverse equations--mapping x,y to lat/long\n", " --------------------------------------------------*/\n", " function inverse(p) {\n", " var x = p.x - this.x0;\n", " var y = p.y - this.y0;\n", " var lon, lat;\n", " if (this.sphere) {\n", " lat = values_1.HALF_PI - 2 * Math.atan(Math.exp(-y / (this.a * this.k0)));\n", " }\n", " else {\n", " var ts = Math.exp(-y / (this.a * this.k0));\n", " lat = phi2z_1.default(this.e, ts);\n", " if (lat === -9999) {\n", " return null;\n", " }\n", " }\n", " lon = adjust_lon_1.default(this.long0 + x / (this.a * this.k0));\n", " p.x = lon;\n", " p.y = lat;\n", " return p;\n", " }\n", " exports.inverse = inverse;\n", " exports.names = [\"Mercator\", \"Popular Visualisation Pseudo Mercator\", \"Mercator_1SP\", \"Mercator_Auxiliary_Sphere\", \"merc\"];\n", " exports.default = {\n", " init: init,\n", " forward: forward,\n", " inverse: inverse,\n", " names: exports.names\n", " };\n", " },\n", " /* proj4/lib/common/msfnz.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " function default_1(eccent, sinphi, cosphi) {\n", " var con = eccent * sinphi;\n", " return cosphi / (Math.sqrt(1 - con * con));\n", " }\n", " exports.default = default_1;\n", " },\n", " /* proj4/lib/common/adjust_lon.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const values_1 = require(39) /* ../constants/values */;\n", " const sign_1 = tslib_1.__importDefault(require(51) /* ./sign */);\n", " function default_1(x) {\n", " return (Math.abs(x) <= values_1.SPI) ? x : (x - (sign_1.default(x) * values_1.TWO_PI));\n", " }\n", " exports.default = default_1;\n", " },\n", " /* proj4/lib/common/sign.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " function default_1(x) {\n", " return x < 0 ? -1 : 1;\n", " }\n", " exports.default = default_1;\n", " },\n", " /* proj4/lib/common/tsfnz.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const values_1 = require(39) /* ../constants/values */;\n", " function default_1(eccent, phi, sinphi) {\n", " var con = eccent * sinphi;\n", " var com = 0.5 * eccent;\n", " con = Math.pow(((1 - con) / (1 + con)), com);\n", " return (Math.tan(0.5 * (values_1.HALF_PI - phi)) / con);\n", " }\n", " exports.default = default_1;\n", " },\n", " /* proj4/lib/common/phi2z.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const values_1 = require(39) /* ../constants/values */;\n", " function default_1(eccent, ts) {\n", " var eccnth = 0.5 * eccent;\n", " var con, dphi;\n", " var phi = values_1.HALF_PI - 2 * Math.atan(ts);\n", " for (var i = 0; i <= 15; i++) {\n", " con = eccent * Math.sin(phi);\n", " dphi = values_1.HALF_PI - 2 * Math.atan(ts * (Math.pow(((1 - con) / (1 + con)), eccnth))) - phi;\n", " phi += dphi;\n", " if (Math.abs(dphi) <= 0.0000000001) {\n", " return phi;\n", " }\n", " }\n", " //console.log(\"phi2z has NoConvergence\");\n", " return -9999;\n", " }\n", " exports.default = default_1;\n", " },\n", " /* proj4/lib/projections/longlat.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " function init() {\n", " //no-op for longlat\n", " }\n", " exports.init = init;\n", " function identity(pt) {\n", " return pt;\n", " }\n", " exports.forward = identity;\n", " exports.inverse = identity;\n", " exports.names = [\"longlat\", \"identity\"];\n", " exports.default = {\n", " init: init,\n", " forward: identity,\n", " inverse: identity,\n", " names: exports.names\n", " };\n", " },\n", " /* proj4/lib/deriveConstants.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const values_1 = require(39) /* ./constants/values */;\n", " const Ellipsoid_1 = tslib_1.__importStar(require(56) /* ./constants/Ellipsoid */);\n", " const match_1 = tslib_1.__importDefault(require(42) /* ./match */);\n", " function eccentricity(a, b, rf, R_A) {\n", " var a2 = a * a; // used in geocentric\n", " var b2 = b * b; // used in geocentric\n", " var es = (a2 - b2) / a2; // e ^ 2\n", " var e = 0;\n", " if (R_A) {\n", " a *= 1 - es * (values_1.SIXTH + es * (values_1.RA4 + es * values_1.RA6));\n", " a2 = a * a;\n", " es = 0;\n", " }\n", " else {\n", " e = Math.sqrt(es); // eccentricity\n", " }\n", " var ep2 = (a2 - b2) / b2; // used in geocentric\n", " return {\n", " es: es,\n", " e: e,\n", " ep2: ep2\n", " };\n", " }\n", " exports.eccentricity = eccentricity;\n", " function sphere(a, b, rf, ellps, sphere) {\n", " if (!a) { // do we have an ellipsoid?\n", " var ellipse = match_1.default(Ellipsoid_1.default, ellps);\n", " if (!ellipse) {\n", " ellipse = Ellipsoid_1.WGS84;\n", " }\n", " a = ellipse.a;\n", " b = ellipse.b;\n", " rf = ellipse.rf;\n", " }\n", " if (rf && !b) {\n", " b = (1.0 - 1.0 / rf) * a;\n", " }\n", " if (rf === 0 || Math.abs(a - b) < values_1.EPSLN) {\n", " sphere = true;\n", " b = a;\n", " }\n", " return {\n", " a: a,\n", " b: b,\n", " rf: rf,\n", " sphere: sphere\n", " };\n", " }\n", " exports.sphere = sphere;\n", " },\n", " /* proj4/lib/constants/Ellipsoid.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var exports$1 = {};\n", " exports.default = exports$1;\n", " exports$1.MERIT = {\n", " a: 6378137.0,\n", " rf: 298.257,\n", " ellipseName: \"MERIT 1983\"\n", " };\n", " exports$1.SGS85 = {\n", " a: 6378136.0,\n", " rf: 298.257,\n", " ellipseName: \"Soviet Geodetic System 85\"\n", " };\n", " exports$1.GRS80 = {\n", " a: 6378137.0,\n", " rf: 298.257222101,\n", " ellipseName: \"GRS 1980(IUGG, 1980)\"\n", " };\n", " exports$1.IAU76 = {\n", " a: 6378140.0,\n", " rf: 298.257,\n", " ellipseName: \"IAU 1976\"\n", " };\n", " exports$1.airy = {\n", " a: 6377563.396,\n", " b: 6356256.910,\n", " ellipseName: \"Airy 1830\"\n", " };\n", " exports$1.APL4 = {\n", " a: 6378137,\n", " rf: 298.25,\n", " ellipseName: \"Appl. Physics. 1965\"\n", " };\n", " exports$1.NWL9D = {\n", " a: 6378145.0,\n", " rf: 298.25,\n", " ellipseName: \"Naval Weapons Lab., 1965\"\n", " };\n", " exports$1.mod_airy = {\n", " a: 6377340.189,\n", " b: 6356034.446,\n", " ellipseName: \"Modified Airy\"\n", " };\n", " exports$1.andrae = {\n", " a: 6377104.43,\n", " rf: 300.0,\n", " ellipseName: \"Andrae 1876 (Den., Iclnd.)\"\n", " };\n", " exports$1.aust_SA = {\n", " a: 6378160.0,\n", " rf: 298.25,\n", " ellipseName: \"Australian Natl & S. Amer. 1969\"\n", " };\n", " exports$1.GRS67 = {\n", " a: 6378160.0,\n", " rf: 298.2471674270,\n", " ellipseName: \"GRS 67(IUGG 1967)\"\n", " };\n", " exports$1.bessel = {\n", " a: 6377397.155,\n", " rf: 299.1528128,\n", " ellipseName: \"Bessel 1841\"\n", " };\n", " exports$1.bess_nam = {\n", " a: 6377483.865,\n", " rf: 299.1528128,\n", " ellipseName: \"Bessel 1841 (Namibia)\"\n", " };\n", " exports$1.clrk66 = {\n", " a: 6378206.4,\n", " b: 6356583.8,\n", " ellipseName: \"Clarke 1866\"\n", " };\n", " exports$1.clrk80 = {\n", " a: 6378249.145,\n", " rf: 293.4663,\n", " ellipseName: \"Clarke 1880 mod.\"\n", " };\n", " exports$1.clrk58 = {\n", " a: 6378293.645208759,\n", " rf: 294.2606763692654,\n", " ellipseName: \"Clarke 1858\"\n", " };\n", " exports$1.CPM = {\n", " a: 6375738.7,\n", " rf: 334.29,\n", " ellipseName: \"Comm. des Poids et Mesures 1799\"\n", " };\n", " exports$1.delmbr = {\n", " a: 6376428.0,\n", " rf: 311.5,\n", " ellipseName: \"Delambre 1810 (Belgium)\"\n", " };\n", " exports$1.engelis = {\n", " a: 6378136.05,\n", " rf: 298.2566,\n", " ellipseName: \"Engelis 1985\"\n", " };\n", " exports$1.evrst30 = {\n", " a: 6377276.345,\n", " rf: 300.8017,\n", " ellipseName: \"Everest 1830\"\n", " };\n", " exports$1.evrst48 = {\n", " a: 6377304.063,\n", " rf: 300.8017,\n", " ellipseName: \"Everest 1948\"\n", " };\n", " exports$1.evrst56 = {\n", " a: 6377301.243,\n", " rf: 300.8017,\n", " ellipseName: \"Everest 1956\"\n", " };\n", " exports$1.evrst69 = {\n", " a: 6377295.664,\n", " rf: 300.8017,\n", " ellipseName: \"Everest 1969\"\n", " };\n", " exports$1.evrstSS = {\n", " a: 6377298.556,\n", " rf: 300.8017,\n", " ellipseName: \"Everest (Sabah & Sarawak)\"\n", " };\n", " exports$1.fschr60 = {\n", " a: 6378166.0,\n", " rf: 298.3,\n", " ellipseName: \"Fischer (Mercury Datum) 1960\"\n", " };\n", " exports$1.fschr60m = {\n", " a: 6378155.0,\n", " rf: 298.3,\n", " ellipseName: \"Fischer 1960\"\n", " };\n", " exports$1.fschr68 = {\n", " a: 6378150.0,\n", " rf: 298.3,\n", " ellipseName: \"Fischer 1968\"\n", " };\n", " exports$1.helmert = {\n", " a: 6378200.0,\n", " rf: 298.3,\n", " ellipseName: \"Helmert 1906\"\n", " };\n", " exports$1.hough = {\n", " a: 6378270.0,\n", " rf: 297.0,\n", " ellipseName: \"Hough\"\n", " };\n", " exports$1.intl = {\n", " a: 6378388.0,\n", " rf: 297.0,\n", " ellipseName: \"International 1909 (Hayford)\"\n", " };\n", " exports$1.kaula = {\n", " a: 6378163.0,\n", " rf: 298.24,\n", " ellipseName: \"Kaula 1961\"\n", " };\n", " exports$1.lerch = {\n", " a: 6378139.0,\n", " rf: 298.257,\n", " ellipseName: \"Lerch 1979\"\n", " };\n", " exports$1.mprts = {\n", " a: 6397300.0,\n", " rf: 191.0,\n", " ellipseName: \"Maupertius 1738\"\n", " };\n", " exports$1.new_intl = {\n", " a: 6378157.5,\n", " b: 6356772.2,\n", " ellipseName: \"New International 1967\"\n", " };\n", " exports$1.plessis = {\n", " a: 6376523.0,\n", " rf: 6355863.0,\n", " ellipseName: \"Plessis 1817 (France)\"\n", " };\n", " exports$1.krass = {\n", " a: 6378245.0,\n", " rf: 298.3,\n", " ellipseName: \"Krassovsky, 1942\"\n", " };\n", " exports$1.SEasia = {\n", " a: 6378155.0,\n", " b: 6356773.3205,\n", " ellipseName: \"Southeast Asia\"\n", " };\n", " exports$1.walbeck = {\n", " a: 6376896.0,\n", " b: 6355834.8467,\n", " ellipseName: \"Walbeck\"\n", " };\n", " exports$1.WGS60 = {\n", " a: 6378165.0,\n", " rf: 298.3,\n", " ellipseName: \"WGS 60\"\n", " };\n", " exports$1.WGS66 = {\n", " a: 6378145.0,\n", " rf: 298.25,\n", " ellipseName: \"WGS 66\"\n", " };\n", " exports$1.WGS7 = {\n", " a: 6378135.0,\n", " rf: 298.26,\n", " ellipseName: \"WGS 72\"\n", " };\n", " exports.WGS84 = exports$1.WGS84 = {\n", " a: 6378137.0,\n", " rf: 298.257223563,\n", " ellipseName: \"WGS 84\"\n", " };\n", " exports$1.sphere = {\n", " a: 6370997.0,\n", " b: 6370997.0,\n", " ellipseName: \"Normal Sphere (r=6370997)\"\n", " };\n", " },\n", " /* proj4/lib/constants/Datum.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var exports$1 = {};\n", " exports.default = exports$1;\n", " exports$1.wgs84 = {\n", " towgs84: \"0,0,0\",\n", " ellipse: \"WGS84\",\n", " datumName: \"WGS84\"\n", " };\n", " exports$1.ch1903 = {\n", " towgs84: \"674.374,15.056,405.346\",\n", " ellipse: \"bessel\",\n", " datumName: \"swiss\"\n", " };\n", " exports$1.ggrs87 = {\n", " towgs84: \"-199.87,74.79,246.62\",\n", " ellipse: \"GRS80\",\n", " datumName: \"Greek_Geodetic_Reference_System_1987\"\n", " };\n", " exports$1.nad83 = {\n", " towgs84: \"0,0,0\",\n", " ellipse: \"GRS80\",\n", " datumName: \"North_American_Datum_1983\"\n", " };\n", " exports$1.nad27 = {\n", " nadgrids: \"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat\",\n", " ellipse: \"clrk66\",\n", " datumName: \"North_American_Datum_1927\"\n", " };\n", " exports$1.potsdam = {\n", " towgs84: \"606.0,23.0,413.0\",\n", " ellipse: \"bessel\",\n", " datumName: \"Potsdam Rauenberg 1950 DHDN\"\n", " };\n", " exports$1.carthage = {\n", " towgs84: \"-263.0,6.0,431.0\",\n", " ellipse: \"clark80\",\n", " datumName: \"Carthage 1934 Tunisia\"\n", " };\n", " exports$1.hermannskogel = {\n", " towgs84: \"653.0,-212.0,449.0\",\n", " ellipse: \"bessel\",\n", " datumName: \"Hermannskogel\"\n", " };\n", " exports$1.osni52 = {\n", " towgs84: \"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15\",\n", " ellipse: \"airy\",\n", " datumName: \"Irish National\"\n", " };\n", " exports$1.ire65 = {\n", " towgs84: \"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15\",\n", " ellipse: \"mod_airy\",\n", " datumName: \"Ireland 1965\"\n", " };\n", " exports$1.rassadiran = {\n", " towgs84: \"-133.63,-157.5,-158.62\",\n", " ellipse: \"intl\",\n", " datumName: \"Rassadiran\"\n", " };\n", " exports$1.nzgd49 = {\n", " towgs84: \"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993\",\n", " ellipse: \"intl\",\n", " datumName: \"New Zealand Geodetic Datum 1949\"\n", " };\n", " exports$1.osgb36 = {\n", " towgs84: \"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894\",\n", " ellipse: \"airy\",\n", " datumName: \"Airy 1830\"\n", " };\n", " exports$1.s_jtsk = {\n", " towgs84: \"589,76,480\",\n", " ellipse: 'bessel',\n", " datumName: 'S-JTSK (Ferro)'\n", " };\n", " exports$1.beduaram = {\n", " towgs84: '-106,-87,188',\n", " ellipse: 'clrk80',\n", " datumName: 'Beduaram'\n", " };\n", " exports$1.gunung_segara = {\n", " towgs84: '-403,684,41',\n", " ellipse: 'bessel',\n", " datumName: 'Gunung Segara Jakarta'\n", " };\n", " exports$1.rnb72 = {\n", " towgs84: \"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1\",\n", " ellipse: \"intl\",\n", " datumName: \"Reseau National Belge 1972\"\n", " };\n", " },\n", " /* proj4/lib/datum.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const values_1 = require(39) /* ./constants/values */;\n", " function datum(datumCode, datum_params, a, b, es, ep2) {\n", " var out = {};\n", " if (datumCode === undefined || datumCode === 'none') {\n", " out.datum_type = values_1.PJD_NODATUM;\n", " }\n", " else {\n", " out.datum_type = values_1.PJD_WGS84;\n", " }\n", " if (datum_params) {\n", " out.datum_params = datum_params.map(parseFloat);\n", " if (out.datum_params[0] !== 0 || out.datum_params[1] !== 0 || out.datum_params[2] !== 0) {\n", " out.datum_type = values_1.PJD_3PARAM;\n", " }\n", " if (out.datum_params.length > 3) {\n", " if (out.datum_params[3] !== 0 || out.datum_params[4] !== 0 || out.datum_params[5] !== 0 || out.datum_params[6] !== 0) {\n", " out.datum_type = values_1.PJD_7PARAM;\n", " out.datum_params[3] *= values_1.SEC_TO_RAD;\n", " out.datum_params[4] *= values_1.SEC_TO_RAD;\n", " out.datum_params[5] *= values_1.SEC_TO_RAD;\n", " out.datum_params[6] = (out.datum_params[6] / 1000000.0) + 1.0;\n", " }\n", " }\n", " }\n", " out.a = a; //datum object also uses these values\n", " out.b = b;\n", " out.es = es;\n", " out.ep2 = ep2;\n", " return out;\n", " }\n", " exports.default = datum;\n", " },\n", " /* proj4/lib/transform.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const values_1 = require(39) /* ./constants/values */;\n", " const datum_transform_1 = tslib_1.__importDefault(require(60) /* ./datum_transform */);\n", " const adjust_axis_1 = tslib_1.__importDefault(require(62) /* ./adjust_axis */);\n", " const Proj_1 = tslib_1.__importDefault(require(34) /* ./Proj */);\n", " const toPoint_1 = tslib_1.__importDefault(require(63) /* ./common/toPoint */);\n", " const checkSanity_1 = tslib_1.__importDefault(require(64) /* ./checkSanity */);\n", " function checkNotWGS(source, dest) {\n", " return ((source.datum.datum_type === values_1.PJD_3PARAM || source.datum.datum_type === values_1.PJD_7PARAM) && dest.datumCode !== 'WGS84') || ((dest.datum.datum_type === values_1.PJD_3PARAM || dest.datum.datum_type === values_1.PJD_7PARAM) && source.datumCode !== 'WGS84');\n", " }\n", " function transform(source, dest, point) {\n", " var wgs84;\n", " if (Array.isArray(point)) {\n", " point = toPoint_1.default(point);\n", " }\n", " checkSanity_1.default(point);\n", " // Workaround for datum shifts towgs84, if either source or destination projection is not wgs84\n", " if (source.datum && dest.datum && checkNotWGS(source, dest)) {\n", " wgs84 = new Proj_1.default('WGS84');\n", " point = transform(source, wgs84, point);\n", " source = wgs84;\n", " }\n", " // DGR, 2010/11/12\n", " if (source.axis !== 'enu') {\n", " point = adjust_axis_1.default(source, false, point);\n", " }\n", " // Transform source points to long/lat, if they aren't already.\n", " if (source.projName === 'longlat') {\n", " point = {\n", " x: point.x * values_1.D2R,\n", " y: point.y * values_1.D2R,\n", " z: point.z || 0\n", " };\n", " }\n", " else {\n", " if (source.to_meter) {\n", " point = {\n", " x: point.x * source.to_meter,\n", " y: point.y * source.to_meter,\n", " z: point.z || 0\n", " };\n", " }\n", " point = source.inverse(point); // Convert Cartesian to longlat\n", " }\n", " // Adjust for the prime meridian if necessary\n", " if (source.from_greenwich) {\n", " point.x += source.from_greenwich;\n", " }\n", " // Convert datums if needed, and if possible.\n", " point = datum_transform_1.default(source.datum, dest.datum, point);\n", " // Adjust for the prime meridian if necessary\n", " if (dest.from_greenwich) {\n", " point = {\n", " x: point.x - dest.from_greenwich,\n", " y: point.y,\n", " z: point.z || 0\n", " };\n", " }\n", " if (dest.projName === 'longlat') {\n", " // convert radians to decimal degrees\n", " point = {\n", " x: point.x * values_1.R2D,\n", " y: point.y * values_1.R2D,\n", " z: point.z || 0\n", " };\n", " }\n", " else { // else project\n", " point = dest.forward(point);\n", " if (dest.to_meter) {\n", " point = {\n", " x: point.x / dest.to_meter,\n", " y: point.y / dest.to_meter,\n", " z: point.z || 0\n", " };\n", " }\n", " }\n", " // DGR, 2010/11/12\n", " if (dest.axis !== 'enu') {\n", " return adjust_axis_1.default(dest, true, point);\n", " }\n", " return point;\n", " }\n", " exports.default = transform;\n", " },\n", " /* proj4/lib/datum_transform.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const values_1 = require(39) /* ./constants/values */;\n", " const datumUtils_1 = require(61) /* ./datumUtils */;\n", " function checkParams(type) {\n", " return (type === values_1.PJD_3PARAM || type === values_1.PJD_7PARAM);\n", " }\n", " function default_1(source, dest, point) {\n", " // Short cut if the datums are identical.\n", " if (datumUtils_1.compareDatums(source, dest)) {\n", " return point; // in this case, zero is sucess,\n", " // whereas cs_compare_datums returns 1 to indicate TRUE\n", " // confusing, should fix this\n", " }\n", " // Explicitly skip datum transform by setting 'datum=none' as parameter for either source or dest\n", " if (source.datum_type === values_1.PJD_NODATUM || dest.datum_type === values_1.PJD_NODATUM) {\n", " return point;\n", " }\n", " // If this datum requires grid shifts, then apply it to geodetic coordinates.\n", " // Do we need to go through geocentric coordinates?\n", " if (source.es === dest.es && source.a === dest.a && !checkParams(source.datum_type) && !checkParams(dest.datum_type)) {\n", " return point;\n", " }\n", " // Convert to geocentric coordinates.\n", " point = datumUtils_1.geodeticToGeocentric(point, source.es, source.a);\n", " // Convert between datums\n", " if (checkParams(source.datum_type)) {\n", " point = datumUtils_1.geocentricToWgs84(point, source.datum_type, source.datum_params);\n", " }\n", " if (checkParams(dest.datum_type)) {\n", " point = datumUtils_1.geocentricFromWgs84(point, dest.datum_type, dest.datum_params);\n", " }\n", " return datumUtils_1.geocentricToGeodetic(point, dest.es, dest.a, dest.b);\n", " }\n", " exports.default = default_1;\n", " },\n", " /* proj4/lib/datumUtils.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const values_1 = require(39) /* ./constants/values */;\n", " function compareDatums(source, dest) {\n", " if (source.datum_type !== dest.datum_type) {\n", " return false; // false, datums are not equal\n", " }\n", " else if (source.a !== dest.a || Math.abs(source.es - dest.es) > 0.000000000050) {\n", " // the tolerance for es is to ensure that GRS80 and WGS84\n", " // are considered identical\n", " return false;\n", " }\n", " else if (source.datum_type === values_1.PJD_3PARAM) {\n", " return (source.datum_params[0] === dest.datum_params[0] && source.datum_params[1] === dest.datum_params[1] && source.datum_params[2] === dest.datum_params[2]);\n", " }\n", " else if (source.datum_type === values_1.PJD_7PARAM) {\n", " return (source.datum_params[0] === dest.datum_params[0] && source.datum_params[1] === dest.datum_params[1] && source.datum_params[2] === dest.datum_params[2] && source.datum_params[3] === dest.datum_params[3] && source.datum_params[4] === dest.datum_params[4] && source.datum_params[5] === dest.datum_params[5] && source.datum_params[6] === dest.datum_params[6]);\n", " }\n", " else {\n", " return true; // datums are equal\n", " }\n", " } // cs_compare_datums()\n", " exports.compareDatums = compareDatums;\n", " /*\n", " * The function Convert_Geodetic_To_Geocentric converts geodetic coordinates\n", " * (latitude, longitude, and height) to geocentric coordinates (X, Y, Z),\n", " * according to the current ellipsoid parameters.\n", " *\n", " * Latitude : Geodetic latitude in radians (input)\n", " * Longitude : Geodetic longitude in radians (input)\n", " * Height : Geodetic height, in meters (input)\n", " * X : Calculated Geocentric X coordinate, in meters (output)\n", " * Y : Calculated Geocentric Y coordinate, in meters (output)\n", " * Z : Calculated Geocentric Z coordinate, in meters (output)\n", " *\n", " */\n", " function geodeticToGeocentric(p, es, a) {\n", " var Longitude = p.x;\n", " var Latitude = p.y;\n", " var Height = p.z ? p.z : 0; //Z value not always supplied\n", " var Rn; /* Earth radius at location */\n", " var Sin_Lat; /* Math.sin(Latitude) */\n", " var Sin2_Lat; /* Square of Math.sin(Latitude) */\n", " var Cos_Lat; /* Math.cos(Latitude) */\n", " /*\n", " ** Don't blow up if Latitude is just a little out of the value\n", " ** range as it may just be a rounding issue. Also removed longitude\n", " ** test, it should be wrapped by Math.cos() and Math.sin(). NFW for PROJ.4, Sep/2001.\n", " */\n", " if (Latitude < -values_1.HALF_PI && Latitude > -1.001 * values_1.HALF_PI) {\n", " Latitude = -values_1.HALF_PI;\n", " }\n", " else if (Latitude > values_1.HALF_PI && Latitude < 1.001 * values_1.HALF_PI) {\n", " Latitude = values_1.HALF_PI;\n", " }\n", " else if (Latitude < -values_1.HALF_PI) {\n", " /* Latitude out of range */\n", " //..reportError('geocent:lat out of range:' + Latitude);\n", " return { x: -Infinity, y: -Infinity, z: p.z };\n", " }\n", " else if (Latitude > values_1.HALF_PI) {\n", " /* Latitude out of range */\n", " return { x: Infinity, y: Infinity, z: p.z };\n", " }\n", " if (Longitude > Math.PI) {\n", " Longitude -= (2 * Math.PI);\n", " }\n", " Sin_Lat = Math.sin(Latitude);\n", " Cos_Lat = Math.cos(Latitude);\n", " Sin2_Lat = Sin_Lat * Sin_Lat;\n", " Rn = a / (Math.sqrt(1.0e0 - es * Sin2_Lat));\n", " return {\n", " x: (Rn + Height) * Cos_Lat * Math.cos(Longitude),\n", " y: (Rn + Height) * Cos_Lat * Math.sin(Longitude),\n", " z: ((Rn * (1 - es)) + Height) * Sin_Lat\n", " };\n", " } // cs_geodetic_to_geocentric()\n", " exports.geodeticToGeocentric = geodeticToGeocentric;\n", " function geocentricToGeodetic(p, es, a, b) {\n", " /* local defintions and variables */\n", " /* end-criterium of loop, accuracy of sin(Latitude) */\n", " var genau = 1e-12;\n", " var genau2 = (genau * genau);\n", " var maxiter = 30;\n", " var P; /* distance between semi-minor axis and location */\n", " var RR; /* distance between center and location */\n", " var CT; /* sin of geocentric latitude */\n", " var ST; /* cos of geocentric latitude */\n", " var RX;\n", " var RK;\n", " var RN; /* Earth radius at location */\n", " var CPHI0; /* cos of start or old geodetic latitude in iterations */\n", " var SPHI0; /* sin of start or old geodetic latitude in iterations */\n", " var CPHI; /* cos of searched geodetic latitude */\n", " var SPHI; /* sin of searched geodetic latitude */\n", " var SDPHI; /* end-criterium: addition-theorem of sin(Latitude(iter)-Latitude(iter-1)) */\n", " var iter; /* # of continous iteration, max. 30 is always enough (s.a.) */\n", " var X = p.x;\n", " var Y = p.y;\n", " var Z = p.z ? p.z : 0.0; //Z value not always supplied\n", " var Longitude;\n", " var Latitude;\n", " var Height;\n", " P = Math.sqrt(X * X + Y * Y);\n", " RR = Math.sqrt(X * X + Y * Y + Z * Z);\n", " /* special cases for latitude and longitude */\n", " if (P / a < genau) {\n", " /* special case, if P=0. (X=0., Y=0.) */\n", " Longitude = 0.0;\n", " /* if (X,Y,Z)=(0.,0.,0.) then Height becomes semi-minor axis\n", " * of ellipsoid (=center of mass), Latitude becomes PI/2 */\n", " if (RR / a < genau) {\n", " Latitude = values_1.HALF_PI;\n", " Height = -b;\n", " return {\n", " x: p.x,\n", " y: p.y,\n", " z: p.z\n", " };\n", " }\n", " }\n", " else {\n", " /* ellipsoidal (geodetic) longitude\n", " * interval: -PI < Longitude <= +PI */\n", " Longitude = Math.atan2(Y, X);\n", " }\n", " /* --------------------------------------------------------------\n", " * Following iterative algorithm was developped by\n", " * \"Institut for Erdmessung\", University of Hannover, July 1988.\n", " * Internet: www.ife.uni-hannover.de\n", " * Iterative computation of CPHI,SPHI and Height.\n", " * Iteration of CPHI and SPHI to 10**-12 radian resp.\n", " * 2*10**-7 arcsec.\n", " * --------------------------------------------------------------\n", " */\n", " CT = Z / RR;\n", " ST = P / RR;\n", " RX = 1.0 / Math.sqrt(1.0 - es * (2.0 - es) * ST * ST);\n", " CPHI0 = ST * (1.0 - es) * RX;\n", " SPHI0 = CT * RX;\n", " iter = 0;\n", " /* loop to find sin(Latitude) resp. Latitude\n", " * until |sin(Latitude(iter)-Latitude(iter-1))| < genau */\n", " do {\n", " iter++;\n", " RN = a / Math.sqrt(1.0 - es * SPHI0 * SPHI0);\n", " /* ellipsoidal (geodetic) height */\n", " Height = P * CPHI0 + Z * SPHI0 - RN * (1.0 - es * SPHI0 * SPHI0);\n", " RK = es * RN / (RN + Height);\n", " RX = 1.0 / Math.sqrt(1.0 - RK * (2.0 - RK) * ST * ST);\n", " CPHI = ST * (1.0 - RK) * RX;\n", " SPHI = CT * RX;\n", " SDPHI = SPHI * CPHI0 - CPHI * SPHI0;\n", " CPHI0 = CPHI;\n", " SPHI0 = SPHI;\n", " } while (SDPHI * SDPHI > genau2 && iter < maxiter);\n", " /* ellipsoidal (geodetic) latitude */\n", " Latitude = Math.atan(SPHI / Math.abs(CPHI));\n", " return {\n", " x: Longitude,\n", " y: Latitude,\n", " z: Height\n", " };\n", " } // cs_geocentric_to_geodetic()\n", " exports.geocentricToGeodetic = geocentricToGeodetic;\n", " /****************************************************************/\n", " // pj_geocentic_to_wgs84( p )\n", " // p = point to transform in geocentric coordinates (x,y,z)\n", " /** point object, nothing fancy, just allows values to be\n", " passed back and forth by reference rather than by value.\n", " Other point classes may be used as long as they have\n", " x and y properties, which will get modified in the transform method.\n", " */\n", " function geocentricToWgs84(p, datum_type, datum_params) {\n", " if (datum_type === values_1.PJD_3PARAM) {\n", " // if( x[io] === HUGE_VAL )\n", " // continue;\n", " return {\n", " x: p.x + datum_params[0],\n", " y: p.y + datum_params[1],\n", " z: p.z + datum_params[2],\n", " };\n", " }\n", " else if (datum_type === values_1.PJD_7PARAM) {\n", " var Dx_BF = datum_params[0];\n", " var Dy_BF = datum_params[1];\n", " var Dz_BF = datum_params[2];\n", " var Rx_BF = datum_params[3];\n", " var Ry_BF = datum_params[4];\n", " var Rz_BF = datum_params[5];\n", " var M_BF = datum_params[6];\n", " // if( x[io] === HUGE_VAL )\n", " // continue;\n", " return {\n", " x: M_BF * (p.x - Rz_BF * p.y + Ry_BF * p.z) + Dx_BF,\n", " y: M_BF * (Rz_BF * p.x + p.y - Rx_BF * p.z) + Dy_BF,\n", " z: M_BF * (-Ry_BF * p.x + Rx_BF * p.y + p.z) + Dz_BF\n", " };\n", " }\n", " } // cs_geocentric_to_wgs84\n", " exports.geocentricToWgs84 = geocentricToWgs84;\n", " /****************************************************************/\n", " // pj_geocentic_from_wgs84()\n", " // coordinate system definition,\n", " // point to transform in geocentric coordinates (x,y,z)\n", " function geocentricFromWgs84(p, datum_type, datum_params) {\n", " if (datum_type === values_1.PJD_3PARAM) {\n", " //if( x[io] === HUGE_VAL )\n", " // continue;\n", " return {\n", " x: p.x - datum_params[0],\n", " y: p.y - datum_params[1],\n", " z: p.z - datum_params[2],\n", " };\n", " }\n", " else if (datum_type === values_1.PJD_7PARAM) {\n", " var Dx_BF = datum_params[0];\n", " var Dy_BF = datum_params[1];\n", " var Dz_BF = datum_params[2];\n", " var Rx_BF = datum_params[3];\n", " var Ry_BF = datum_params[4];\n", " var Rz_BF = datum_params[5];\n", " var M_BF = datum_params[6];\n", " var x_tmp = (p.x - Dx_BF) / M_BF;\n", " var y_tmp = (p.y - Dy_BF) / M_BF;\n", " var z_tmp = (p.z - Dz_BF) / M_BF;\n", " //if( x[io] === HUGE_VAL )\n", " // continue;\n", " return {\n", " x: x_tmp + Rz_BF * y_tmp - Ry_BF * z_tmp,\n", " y: -Rz_BF * x_tmp + y_tmp + Rx_BF * z_tmp,\n", " z: Ry_BF * x_tmp - Rx_BF * y_tmp + z_tmp\n", " };\n", " } //cs_geocentric_from_wgs84()\n", " }\n", " exports.geocentricFromWgs84 = geocentricFromWgs84;\n", " },\n", " /* proj4/lib/adjust_axis.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " function default_1(crs, denorm, point) {\n", " var xin = point.x, yin = point.y, zin = point.z || 0.0;\n", " var v, t, i;\n", " var out = {};\n", " for (i = 0; i < 3; i++) {\n", " if (denorm && i === 2 && point.z === undefined) {\n", " continue;\n", " }\n", " if (i === 0) {\n", " v = xin;\n", " if (\"ew\".indexOf(crs.axis[i]) !== -1) {\n", " t = 'x';\n", " }\n", " else {\n", " t = 'y';\n", " }\n", " }\n", " else if (i === 1) {\n", " v = yin;\n", " if (\"ns\".indexOf(crs.axis[i]) !== -1) {\n", " t = 'y';\n", " }\n", " else {\n", " t = 'x';\n", " }\n", " }\n", " else {\n", " v = zin;\n", " t = 'z';\n", " }\n", " switch (crs.axis[i]) {\n", " case 'e':\n", " case 'w':\n", " case 'n':\n", " case 's':\n", " out[t] = v;\n", " break;\n", " case 'u':\n", " if (point[t] !== undefined) {\n", " out.z = v;\n", " }\n", " break;\n", " case 'd':\n", " if (point[t] !== undefined) {\n", " out.z = -v;\n", " }\n", " break;\n", " default:\n", " //console.log(\"ERROR: unknow axis (\"+crs.axis[i]+\") - check definition of \"+crs.projName);\n", " return null;\n", " }\n", " }\n", " return out;\n", " }\n", " exports.default = default_1;\n", " },\n", " /* proj4/lib/common/toPoint.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " function default_1(array) {\n", " var out = {\n", " x: array[0],\n", " y: array[1]\n", " };\n", " if (array.length > 2) {\n", " out.z = array[2];\n", " }\n", " if (array.length > 3) {\n", " out.m = array[3];\n", " }\n", " return out;\n", " }\n", " exports.default = default_1;\n", " },\n", " /* proj4/lib/checkSanity.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " function default_1(point) {\n", " checkCoord(point.x);\n", " checkCoord(point.y);\n", " }\n", " exports.default = default_1;\n", " function checkCoord(num) {\n", " if (typeof Number.isFinite === 'function') {\n", " if (Number.isFinite(num)) {\n", " return;\n", " }\n", " throw new TypeError('coordinates must be finite numbers');\n", " }\n", " if (typeof num !== 'number' || num !== num || !isFinite(num)) {\n", " throw new TypeError('coordinates must be finite numbers');\n", " }\n", " }\n", " },\n", " /* models/renderers/renderer.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const dom_view_1 = require(66) /* ../../core/dom_view */;\n", " const visuals = tslib_1.__importStar(require(70) /* ../../core/visuals */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const model_1 = require(71) /* ../../model */;\n", " // This shouldn't be a DOMView, but annotations create a mess.\n", " class RendererView extends dom_view_1.DOMView {\n", " initialize() {\n", " super.initialize();\n", " this.visuals = new visuals.Visuals(this.model);\n", " this._has_finished = true; // XXX: should be in render() but subclasses don't respect super()\n", " }\n", " get plot_view() {\n", " return this.parent;\n", " }\n", " get plot_model() {\n", " return this.parent.model;\n", " }\n", " get layer() {\n", " const { canvas_view } = this.plot_view;\n", " return this.model.level == \"overlay\" ? canvas_view.overlays : canvas_view.primary;\n", " }\n", " request_render() {\n", " this.plot_view.request_render();\n", " }\n", " map_to_screen(x, y) {\n", " return this.plot_view.map_to_screen(x, y, this.model.x_range_name, this.model.y_range_name);\n", " }\n", " get needs_clip() {\n", " return false;\n", " }\n", " notify_finished() {\n", " this.plot_view.notify_finished();\n", " }\n", " get has_webgl() {\n", " return false;\n", " }\n", " }\n", " exports.RendererView = RendererView;\n", " RendererView.__name__ = \"RendererView\";\n", " class Renderer extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Renderer() {\n", " this.define({\n", " level: [p.RenderLevel],\n", " visible: [p.Boolean, true],\n", " });\n", " }\n", " }\n", " exports.Renderer = Renderer;\n", " Renderer.__name__ = \"Renderer\";\n", " Renderer.init_Renderer();\n", " },\n", " /* core/dom_view.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const view_1 = require(67) /* ./view */;\n", " const dom_1 = require(68) /* ./dom */;\n", " const DOM = tslib_1.__importStar(require(68) /* ./dom */);\n", " const root_css_1 = tslib_1.__importDefault(require(69) /* ../styles/root.css */);\n", " class DOMView extends view_1.View {\n", " initialize() {\n", " super.initialize();\n", " this._has_finished = false;\n", " if (this.is_root) {\n", " this._stylesheet = dom_1.stylesheet;\n", " }\n", " this._inject_styles();\n", " this.el = this._createElement();\n", " }\n", " remove() {\n", " DOM.removeElement(this.el);\n", " super.remove();\n", " }\n", " css_classes() {\n", " return [];\n", " }\n", " styles() {\n", " return [root_css_1.default];\n", " }\n", " cursor(_sx, _sy) {\n", " return null;\n", " }\n", " render() { }\n", " renderTo(element) {\n", " element.appendChild(this.el);\n", " this.render();\n", " }\n", " has_finished() {\n", " return this._has_finished;\n", " }\n", " get is_idle() {\n", " return this.has_finished();\n", " }\n", " get stylesheet() {\n", " if (this.is_root)\n", " return this._stylesheet;\n", " else\n", " return this.root.stylesheet;\n", " }\n", " _inject_styles() {\n", " const { stylesheet } = this;\n", " for (const style of this.styles()) {\n", " stylesheet.append(style);\n", " }\n", " }\n", " _createElement() {\n", " return DOM.createElement(this.tagName, { class: this.css_classes() });\n", " }\n", " }\n", " exports.DOMView = DOMView;\n", " DOMView.__name__ = \"DOMView\";\n", " DOMView.prototype.tagName = \"div\";\n", " },\n", " /* core/view.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const signaling_1 = require(14) /* ./signaling */;\n", " const types_1 = require(8) /* ./util/types */;\n", " class View {\n", " constructor(options) {\n", " this.removed = new signaling_1.Signal0(this, \"removed\");\n", " this._ready = Promise.resolve(undefined);\n", " if (options.model != null)\n", " this.model = options.model;\n", " else\n", " throw new Error(\"model of a view wasn't configured\");\n", " this._parent = options.parent;\n", " }\n", " get ready() {\n", " return this._ready;\n", " }\n", " connect(signal, slot) {\n", " const new_slot = (args, sender) => {\n", " const promise = Promise.resolve(slot.call(this, args, sender));\n", " this._ready = this._ready.then(() => promise);\n", " };\n", " return signal.connect(new_slot, this);\n", " }\n", " disconnect(signal, slot) {\n", " return signal.disconnect(slot, this);\n", " }\n", " initialize() { }\n", " async lazy_initialize() { }\n", " remove() {\n", " this._parent = undefined;\n", " this.disconnect_signals();\n", " this.removed.emit();\n", " }\n", " toString() {\n", " return `${this.model.type}View(${this.model.id})`;\n", " }\n", " serializable_state() {\n", " return { type: this.model.type };\n", " }\n", " get parent() {\n", " if (this._parent !== undefined)\n", " return this._parent;\n", " else\n", " throw new Error(\"parent of a view wasn't configured\");\n", " }\n", " get is_root() {\n", " return this.parent === null;\n", " }\n", " get root() {\n", " return this.is_root ? this : this.parent.root;\n", " }\n", " assert_root() {\n", " if (!this.is_root)\n", " throw new Error(`${this.toString()} is not a root layout`);\n", " }\n", " connect_signals() { }\n", " disconnect_signals() {\n", " signaling_1.Signal.disconnectReceiver(this);\n", " }\n", " on_change(properties, fn) {\n", " for (const property of types_1.isArray(properties) ? properties : [properties]) {\n", " this.connect(property.change, fn);\n", " }\n", " }\n", " }\n", " exports.View = View;\n", " View.__name__ = \"View\";\n", " },\n", " /* core/dom.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const types_1 = require(8) /* ./util/types */;\n", " const _createElement = (tag) => {\n", " return (attrs = {}, ...children) => {\n", " const element = document.createElement(tag);\n", " element.classList.add(\"bk\");\n", " for (const attr in attrs) {\n", " let value = attrs[attr];\n", " if (value == null || types_1.isBoolean(value) && !value)\n", " continue;\n", " if (attr === \"class\") {\n", " if (types_1.isString(value))\n", " value = value.split(/\\s+/);\n", " if (types_1.isArray(value)) {\n", " for (const cls of value) {\n", " if (cls != null)\n", " element.classList.add(cls);\n", " }\n", " continue;\n", " }\n", " }\n", " if (attr === \"style\" && types_1.isPlainObject(value)) {\n", " for (const prop in value) {\n", " element.style[prop] = value[prop];\n", " }\n", " continue;\n", " }\n", " if (attr === \"data\" && types_1.isPlainObject(value)) {\n", " for (const key in value) {\n", " element.dataset[key] = value[key]; // XXX: attrs needs a better type\n", " }\n", " continue;\n", " }\n", " element.setAttribute(attr, value);\n", " }\n", " function append(child) {\n", " if (child instanceof Element)\n", " element.appendChild(child);\n", " else if (types_1.isString(child))\n", " element.appendChild(document.createTextNode(child));\n", " else if (child != null && child !== false)\n", " throw new Error(`expected a DOM element, string, false or null, got ${JSON.stringify(child)}`);\n", " }\n", " for (const child of children) {\n", " if (types_1.isArray(child)) {\n", " for (const _child of child)\n", " append(_child);\n", " }\n", " else\n", " append(child);\n", " }\n", " return element;\n", " };\n", " };\n", " function createElement(tag, attrs, ...children) {\n", " return _createElement(tag)(attrs, ...children);\n", " }\n", " exports.createElement = createElement;\n", " exports.div = _createElement(\"div\"), exports.span = _createElement(\"span\"), exports.canvas = _createElement(\"canvas\"), exports.link = _createElement(\"link\"), exports.style = _createElement(\"style\"), exports.a = _createElement(\"a\"), exports.p = _createElement(\"p\"), exports.i = _createElement(\"i\"), exports.pre = _createElement(\"pre\"), exports.button = _createElement(\"button\"), exports.label = _createElement(\"label\"), exports.input = _createElement(\"input\"), exports.select = _createElement(\"select\"), exports.option = _createElement(\"option\"), exports.optgroup = _createElement(\"optgroup\"), exports.textarea = _createElement(\"textarea\");\n", " function nbsp() {\n", " return document.createTextNode(\"\\u00a0\");\n", " }\n", " exports.nbsp = nbsp;\n", " function append(element, ...children) {\n", " for (const child of children)\n", " element.appendChild(child);\n", " }\n", " exports.append = append;\n", " function remove(element) {\n", " const parent = element.parentNode;\n", " if (parent != null) {\n", " parent.removeChild(element);\n", " }\n", " }\n", " exports.remove = remove;\n", " exports.removeElement = remove;\n", " function replaceWith(element, replacement) {\n", " const parent = element.parentNode;\n", " if (parent != null) {\n", " parent.replaceChild(replacement, element);\n", " }\n", " }\n", " exports.replaceWith = replaceWith;\n", " function prepend(element, ...nodes) {\n", " const first = element.firstChild;\n", " for (const node of nodes) {\n", " element.insertBefore(node, first);\n", " }\n", " }\n", " exports.prepend = prepend;\n", " function empty(element, attrs = false) {\n", " let child;\n", " while (child = element.firstChild) {\n", " element.removeChild(child);\n", " }\n", " if (attrs) {\n", " for (const attr of element.attributes) {\n", " element.removeAttributeNode(attr);\n", " }\n", " }\n", " }\n", " exports.empty = empty;\n", " function display(element) {\n", " element.style.display = \"\";\n", " }\n", " exports.display = display;\n", " function undisplay(element) {\n", " element.style.display = \"none\";\n", " }\n", " exports.undisplay = undisplay;\n", " function show(element) {\n", " element.style.visibility = \"\";\n", " }\n", " exports.show = show;\n", " function hide(element) {\n", " element.style.visibility = \"hidden\";\n", " }\n", " exports.hide = hide;\n", " function offset(element) {\n", " const rect = element.getBoundingClientRect();\n", " return {\n", " top: rect.top + window.pageYOffset - document.documentElement.clientTop,\n", " left: rect.left + window.pageXOffset - document.documentElement.clientLeft,\n", " };\n", " }\n", " exports.offset = offset;\n", " function matches(el, selector) {\n", " const p = Element.prototype;\n", " const f = p.matches || p.webkitMatchesSelector || p.mozMatchesSelector || p.msMatchesSelector;\n", " return f.call(el, selector);\n", " }\n", " exports.matches = matches;\n", " function parent(el, selector) {\n", " let node = el;\n", " while (node = node.parentElement) {\n", " if (matches(node, selector))\n", " return node;\n", " }\n", " return null;\n", " }\n", " exports.parent = parent;\n", " function num(value) {\n", " return parseFloat(value) || 0;\n", " }\n", " function extents(el) {\n", " const style = getComputedStyle(el);\n", " return {\n", " border: {\n", " top: num(style.borderTopWidth),\n", " bottom: num(style.borderBottomWidth),\n", " left: num(style.borderLeftWidth),\n", " right: num(style.borderRightWidth),\n", " },\n", " margin: {\n", " top: num(style.marginTop),\n", " bottom: num(style.marginBottom),\n", " left: num(style.marginLeft),\n", " right: num(style.marginRight),\n", " },\n", " padding: {\n", " top: num(style.paddingTop),\n", " bottom: num(style.paddingBottom),\n", " left: num(style.paddingLeft),\n", " right: num(style.paddingRight),\n", " },\n", " };\n", " }\n", " exports.extents = extents;\n", " function size(el) {\n", " const rect = el.getBoundingClientRect();\n", " return {\n", " width: Math.ceil(rect.width),\n", " height: Math.ceil(rect.height),\n", " };\n", " }\n", " exports.size = size;\n", " function scroll_size(el) {\n", " return {\n", " width: Math.ceil(el.scrollWidth),\n", " height: Math.ceil(el.scrollHeight),\n", " };\n", " }\n", " exports.scroll_size = scroll_size;\n", " function outer_size(el) {\n", " const { margin: { left, right, top, bottom } } = extents(el);\n", " const { width, height } = size(el);\n", " return {\n", " width: Math.ceil(width + left + right),\n", " height: Math.ceil(height + top + bottom),\n", " };\n", " }\n", " exports.outer_size = outer_size;\n", " function content_size(el) {\n", " const { left, top } = el.getBoundingClientRect();\n", " const { padding } = extents(el);\n", " let width = 0;\n", " let height = 0;\n", " for (const child of el.children) {\n", " const rect = child.getBoundingClientRect();\n", " width = Math.max(width, Math.ceil(rect.left - left - padding.left + rect.width));\n", " height = Math.max(height, Math.ceil(rect.top - top - padding.top + rect.height));\n", " }\n", " return { width, height };\n", " }\n", " exports.content_size = content_size;\n", " function position(el, box, margin) {\n", " const { style } = el;\n", " style.left = `${box.x}px`;\n", " style.top = `${box.y}px`;\n", " style.width = `${box.width}px`;\n", " style.height = `${box.height}px`;\n", " if (margin == null)\n", " style.margin = \"\";\n", " else {\n", " const { top, right, bottom, left } = margin;\n", " style.margin = `${top}px ${right}px ${bottom}px ${left}px`;\n", " }\n", " }\n", " exports.position = position;\n", " function children(el) {\n", " return Array.from(el.children);\n", " }\n", " exports.children = children;\n", " class ClassList {\n", " constructor(el) {\n", " this.el = el;\n", " this.classList = el.classList;\n", " }\n", " get values() {\n", " const values = [];\n", " for (let i = 0; i < this.classList.length; i++) {\n", " const item = this.classList.item(i);\n", " if (item != null)\n", " values.push(item);\n", " }\n", " return values;\n", " }\n", " has(cls) {\n", " return this.classList.contains(cls);\n", " }\n", " add(...classes) {\n", " for (const cls of classes)\n", " this.classList.add(cls);\n", " return this;\n", " }\n", " remove(...classes) {\n", " for (const cls of classes)\n", " this.classList.remove(cls);\n", " return this;\n", " }\n", " clear() {\n", " for (const cls of this.values) {\n", " if (cls != \"bk\")\n", " this.classList.remove(cls);\n", " }\n", " return this;\n", " }\n", " toggle(cls, activate) {\n", " const add = activate != null ? activate : !this.has(cls);\n", " if (add)\n", " this.add(cls);\n", " else\n", " this.remove(cls);\n", " return this;\n", " }\n", " }\n", " exports.ClassList = ClassList;\n", " ClassList.__name__ = \"ClassList\";\n", " function classes(el) {\n", " return new ClassList(el);\n", " }\n", " exports.classes = classes;\n", " function toggle_attribute(el, attr, state) {\n", " if (state == null) {\n", " state = !el.hasAttribute(attr);\n", " }\n", " if (state)\n", " el.setAttribute(attr, \"true\");\n", " else\n", " el.removeAttribute(attr);\n", " }\n", " exports.toggle_attribute = toggle_attribute;\n", " (function (Keys) {\n", " Keys[Keys[\"Backspace\"] = 8] = \"Backspace\";\n", " Keys[Keys[\"Tab\"] = 9] = \"Tab\";\n", " Keys[Keys[\"Enter\"] = 13] = \"Enter\";\n", " Keys[Keys[\"Esc\"] = 27] = \"Esc\";\n", " Keys[Keys[\"PageUp\"] = 33] = \"PageUp\";\n", " Keys[Keys[\"PageDown\"] = 34] = \"PageDown\";\n", " Keys[Keys[\"Left\"] = 37] = \"Left\";\n", " Keys[Keys[\"Up\"] = 38] = \"Up\";\n", " Keys[Keys[\"Right\"] = 39] = \"Right\";\n", " Keys[Keys[\"Down\"] = 40] = \"Down\";\n", " Keys[Keys[\"Delete\"] = 46] = \"Delete\";\n", " })(exports.Keys || (exports.Keys = {}));\n", " function undisplayed(el, fn) {\n", " const { display } = el.style;\n", " el.style.display = \"none\";\n", " try {\n", " return fn();\n", " }\n", " finally {\n", " el.style.display = display;\n", " }\n", " }\n", " exports.undisplayed = undisplayed;\n", " function unsized(el, fn) {\n", " return sized(el, {}, fn);\n", " }\n", " exports.unsized = unsized;\n", " function sized(el, size, fn) {\n", " const { width, height, position, display } = el.style;\n", " el.style.position = \"absolute\";\n", " el.style.display = \"\";\n", " el.style.width = size.width != null && size.width != Infinity ? `${size.width}px` : \"auto\";\n", " el.style.height = size.height != null && size.height != Infinity ? `${size.height}px` : \"auto\";\n", " try {\n", " return fn();\n", " }\n", " finally {\n", " el.style.position = position;\n", " el.style.display = display;\n", " el.style.width = width;\n", " el.style.height = height;\n", " }\n", " }\n", " exports.sized = sized;\n", " class StyleSheet {\n", " constructor(root) {\n", " this.root = root;\n", " this.known = new Set();\n", " this.style = exports.style({ type: \"text/css\" });\n", " prepend(root, this.style);\n", " }\n", " append(css) {\n", " if (!this.known.has(css)) {\n", " this.style.appendChild(document.createTextNode(css));\n", " this.known.add(css);\n", " }\n", " }\n", " }\n", " exports.StyleSheet = StyleSheet;\n", " StyleSheet.__name__ = \"StyleSheet\";\n", " exports.stylesheet = new StyleSheet(document.head);\n", " },\n", " /* styles/root.css.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const css = `\n", " .bk-root {\n", " position: relative;\n", " width: auto;\n", " height: auto;\n", " z-index: 0;\n", " box-sizing: border-box;\n", " font-family: Helvetica, Arial, sans-serif;\n", " font-size: 13px;\n", " }\n", " .bk-root .bk,\n", " .bk-root .bk:before,\n", " .bk-root .bk:after {\n", " box-sizing: inherit;\n", " margin: 0;\n", " border: 0;\n", " padding: 0;\n", " background-image: none;\n", " font-family: inherit;\n", " font-size: 100%;\n", " line-height: 1.42857143;\n", " }\n", " .bk-root pre.bk {\n", " font-family: Courier, monospace;\n", " }\n", " `;\n", " exports.default = css;\n", " },\n", " /* core/visuals.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const mixins = tslib_1.__importStar(require(23) /* ./property_mixins */);\n", " const p = tslib_1.__importStar(require(18) /* ./properties */);\n", " const color_1 = require(20) /* ./util/color */;\n", " const arrayable_1 = require(12) /* ./util/arrayable */;\n", " function _horz(ctx, h, h2) {\n", " ctx.moveTo(0, h2 + 0.5);\n", " ctx.lineTo(h, h2 + 0.5);\n", " ctx.stroke();\n", " }\n", " function _vert(ctx, h, h2) {\n", " ctx.moveTo(h2 + 0.5, 0);\n", " ctx.lineTo(h2 + 0.5, h);\n", " ctx.stroke();\n", " }\n", " function _x(ctx, h) {\n", " ctx.moveTo(0, h);\n", " ctx.lineTo(h, 0);\n", " ctx.stroke();\n", " ctx.moveTo(0, 0);\n", " ctx.lineTo(h, h);\n", " ctx.stroke();\n", " }\n", " function _get_canvas(size) {\n", " const canvas = document.createElement('canvas');\n", " canvas.width = size;\n", " canvas.height = size;\n", " return canvas;\n", " }\n", " function create_hatch_canvas(hatch_pattern, hatch_color, hatch_scale, hatch_weight) {\n", " const h = hatch_scale;\n", " const h2 = h / 2;\n", " const h4 = h2 / 2;\n", " const canvas = _get_canvas(hatch_scale);\n", " const ctx = canvas.getContext(\"2d\");\n", " ctx.strokeStyle = hatch_color;\n", " ctx.lineCap = \"square\";\n", " ctx.fillStyle = hatch_color;\n", " ctx.lineWidth = hatch_weight;\n", " switch (hatch_pattern) {\n", " // we should not need these if code conditions on hatch.doit, but\n", " // include them here just for completeness\n", " case \" \":\n", " case \"blank\":\n", " break;\n", " case \".\":\n", " case \"dot\":\n", " ctx.arc(h2, h2, h2 / 2, 0, 2 * Math.PI, true);\n", " ctx.fill();\n", " break;\n", " case \"o\":\n", " case \"ring\":\n", " ctx.arc(h2, h2, h2 / 2, 0, 2 * Math.PI, true);\n", " ctx.stroke();\n", " break;\n", " case \"-\":\n", " case \"horizontal_line\":\n", " _horz(ctx, h, h2);\n", " break;\n", " case \"|\":\n", " case \"vertical_line\":\n", " _vert(ctx, h, h2);\n", " break;\n", " case \"+\":\n", " case \"cross\":\n", " _horz(ctx, h, h2);\n", " _vert(ctx, h, h2);\n", " break;\n", " case \"\\\"\":\n", " case \"horizontal_dash\":\n", " _horz(ctx, h2, h2);\n", " break;\n", " case \":\":\n", " case \"vertical_dash\":\n", " _vert(ctx, h2, h2);\n", " break;\n", " case \"@\":\n", " case \"spiral\":\n", " const h30 = h / 30;\n", " ctx.moveTo(h2, h2);\n", " for (let i = 0; i < 360; i++) {\n", " const angle = 0.1 * i;\n", " const x = h2 + (h30 * angle) * Math.cos(angle);\n", " const y = h2 + (h30 * angle) * Math.sin(angle);\n", " ctx.lineTo(x, y);\n", " }\n", " ctx.stroke();\n", " break;\n", " case \"/\":\n", " case \"right_diagonal_line\":\n", " ctx.moveTo(-h4 + 0.5, h);\n", " ctx.lineTo(h4 + 0.5, 0);\n", " ctx.stroke();\n", " ctx.moveTo(h4 + 0.5, h);\n", " ctx.lineTo(3 * h4 + 0.5, 0);\n", " ctx.stroke();\n", " ctx.moveTo(3 * h4 + 0.5, h);\n", " ctx.lineTo(5 * h4 + 0.5, 0);\n", " ctx.stroke();\n", " ctx.stroke();\n", " break;\n", " case \"\\\\\":\n", " case \"left_diagonal_line\":\n", " ctx.moveTo(h4 + 0.5, h);\n", " ctx.lineTo(-h4 + 0.5, 0);\n", " ctx.stroke();\n", " ctx.moveTo(3 * h4 + 0.5, h);\n", " ctx.lineTo(h4 + 0.5, 0);\n", " ctx.stroke();\n", " ctx.moveTo(5 * h4 + 0.5, h);\n", " ctx.lineTo(3 * h4 + 0.5, 0);\n", " ctx.stroke();\n", " ctx.stroke();\n", " break;\n", " case \"x\":\n", " case \"diagonal_cross\":\n", " _x(ctx, h);\n", " break;\n", " case \",\":\n", " case \"right_diagonal_dash\":\n", " ctx.moveTo(h4 + 0.5, 3 * h4 + 0.5);\n", " ctx.lineTo(3 * h4 + 0.5, h4 + 0.5);\n", " ctx.stroke();\n", " break;\n", " case \"`\":\n", " case \"left_diagonal_dash\":\n", " ctx.moveTo(h4 + 0.5, h4 + 0.5);\n", " ctx.lineTo(3 * h4 + 0.5, 3 * h4 + 0.5);\n", " ctx.stroke();\n", " break;\n", " case \"v\":\n", " case \"horizontal_wave\":\n", " ctx.moveTo(0, h4);\n", " ctx.lineTo(h2, 3 * h4);\n", " ctx.lineTo(h, h4);\n", " ctx.stroke();\n", " break;\n", " case \">\":\n", " case \"vertical_wave\":\n", " ctx.moveTo(h4, 0);\n", " ctx.lineTo(3 * h4, h2);\n", " ctx.lineTo(h4, h);\n", " ctx.stroke();\n", " break;\n", " case \"*\":\n", " case \"criss_cross\":\n", " _x(ctx, h);\n", " _horz(ctx, h, h2);\n", " _vert(ctx, h, h2);\n", " break;\n", " }\n", " return canvas;\n", " }\n", " class ContextProperties {\n", " constructor(obj, prefix = \"\") {\n", " this.obj = obj;\n", " this.prefix = prefix;\n", " this.cache = {};\n", " for (const attr of this.attrs)\n", " this[attr] = obj.properties[prefix + attr];\n", " }\n", " warm_cache(source) {\n", " for (const attr of this.attrs) {\n", " const prop = this.obj.properties[this.prefix + attr];\n", " if (prop.spec.value !== undefined) // TODO (bev) better test?\n", " this.cache[attr] = prop.spec.value;\n", " else if (source != null && prop instanceof p.VectorSpec)\n", " this.cache[attr + \"_array\"] = prop.array(source);\n", " else\n", " throw new Error(\"source is required with a vectorized visual property\");\n", " }\n", " }\n", " cache_select(attr, i) {\n", " const prop = this.obj.properties[this.prefix + attr];\n", " let value;\n", " if (prop.spec.value !== undefined) // TODO (bev) better test?\n", " this.cache[attr] = value = prop.spec.value;\n", " else\n", " this.cache[attr] = value = this.cache[attr + \"_array\"][i];\n", " return value;\n", " }\n", " get_array(attr) {\n", " const array = this.cache[attr + \"_array\"];\n", " if (this.all_indices != null) {\n", " return arrayable_1.map(this.all_indices, (i) => array[i]);\n", " }\n", " else {\n", " return array;\n", " }\n", " }\n", " set_vectorize(ctx, i) {\n", " if (this.all_indices != null) // all_indices is set by a Visuals instance associated with a CDSView\n", " this._set_vectorize(ctx, this.all_indices[i]);\n", " else // all_indices is not set for annotations which may have vectorized visual props\n", " this._set_vectorize(ctx, i);\n", " }\n", " }\n", " exports.ContextProperties = ContextProperties;\n", " ContextProperties.__name__ = \"ContextProperties\";\n", " class Line extends ContextProperties {\n", " set_value(ctx) {\n", " ctx.strokeStyle = this.line_color.value();\n", " ctx.globalAlpha = this.line_alpha.value();\n", " ctx.lineWidth = this.line_width.value();\n", " ctx.lineJoin = this.line_join.value();\n", " ctx.lineCap = this.line_cap.value();\n", " ctx.setLineDash(this.line_dash.value());\n", " ctx.setLineDashOffset(this.line_dash_offset.value());\n", " }\n", " get doit() {\n", " return !(this.line_color.spec.value === null ||\n", " this.line_alpha.spec.value == 0 ||\n", " this.line_width.spec.value == 0);\n", " }\n", " _set_vectorize(ctx, i) {\n", " this.cache_select(\"line_color\", i);\n", " ctx.strokeStyle = this.cache.line_color;\n", " this.cache_select(\"line_alpha\", i);\n", " ctx.globalAlpha = this.cache.line_alpha;\n", " this.cache_select(\"line_width\", i);\n", " ctx.lineWidth = this.cache.line_width;\n", " this.cache_select(\"line_join\", i);\n", " ctx.lineJoin = this.cache.line_join;\n", " this.cache_select(\"line_cap\", i);\n", " ctx.lineCap = this.cache.line_cap;\n", " this.cache_select(\"line_dash\", i);\n", " ctx.setLineDash(this.cache.line_dash);\n", " this.cache_select(\"line_dash_offset\", i);\n", " ctx.setLineDashOffset(this.cache.line_dash_offset);\n", " }\n", " color_value() {\n", " return color_1.color2css(this.line_color.value(), this.line_alpha.value());\n", " }\n", " }\n", " exports.Line = Line;\n", " Line.__name__ = \"Line\";\n", " Line.prototype.attrs = Object.keys(mixins.LineVector);\n", " class Fill extends ContextProperties {\n", " set_value(ctx) {\n", " ctx.fillStyle = this.fill_color.value();\n", " ctx.globalAlpha = this.fill_alpha.value();\n", " }\n", " get doit() {\n", " return !(this.fill_color.spec.value === null ||\n", " this.fill_alpha.spec.value == 0);\n", " }\n", " _set_vectorize(ctx, i) {\n", " this.cache_select(\"fill_color\", i);\n", " ctx.fillStyle = this.cache.fill_color;\n", " this.cache_select(\"fill_alpha\", i);\n", " ctx.globalAlpha = this.cache.fill_alpha;\n", " }\n", " color_value() {\n", " return color_1.color2css(this.fill_color.value(), this.fill_alpha.value());\n", " }\n", " }\n", " exports.Fill = Fill;\n", " Fill.__name__ = \"Fill\";\n", " Fill.prototype.attrs = Object.keys(mixins.FillVector);\n", " class Hatch extends ContextProperties {\n", " cache_select(name, i) {\n", " let value;\n", " if (name == \"pattern\") {\n", " this.cache_select(\"hatch_color\", i);\n", " this.cache_select(\"hatch_scale\", i);\n", " this.cache_select(\"hatch_pattern\", i);\n", " this.cache_select(\"hatch_weight\", i);\n", " const { hatch_color, hatch_scale, hatch_pattern, hatch_weight, hatch_extra } = this.cache;\n", " if (hatch_extra != null && hatch_extra.hasOwnProperty(hatch_pattern)) {\n", " const custom = hatch_extra[hatch_pattern];\n", " this.cache.pattern = custom.get_pattern(hatch_color, hatch_scale, hatch_weight);\n", " }\n", " else {\n", " this.cache.pattern = (ctx) => {\n", " const canvas = create_hatch_canvas(hatch_pattern, hatch_color, hatch_scale, hatch_weight);\n", " return ctx.createPattern(canvas, 'repeat');\n", " };\n", " }\n", " }\n", " else\n", " value = super.cache_select(name, i);\n", " return value;\n", " }\n", " _try_defer(defer_func) {\n", " const { hatch_pattern, hatch_extra } = this.cache;\n", " if (hatch_extra != null && hatch_extra.hasOwnProperty(hatch_pattern)) {\n", " const custom = hatch_extra[hatch_pattern];\n", " custom.onload(defer_func);\n", " }\n", " }\n", " get doit() {\n", " return !(this.hatch_color.spec.value === null ||\n", " this.hatch_alpha.spec.value == 0 ||\n", " this.hatch_pattern.spec.value == \" \" ||\n", " this.hatch_pattern.spec.value == \"blank\" ||\n", " this.hatch_pattern.spec.value === null);\n", " }\n", " doit2(ctx, i, ready_func, defer_func) {\n", " if (!this.doit) {\n", " return;\n", " }\n", " this.cache_select(\"pattern\", i);\n", " const pattern = this.cache.pattern(ctx);\n", " if (pattern == null) {\n", " this._try_defer(defer_func);\n", " }\n", " else {\n", " this.set_vectorize(ctx, i);\n", " ready_func();\n", " }\n", " }\n", " _set_vectorize(ctx, i) {\n", " this.cache_select(\"pattern\", i);\n", " ctx.fillStyle = this.cache.pattern(ctx);\n", " this.cache_select(\"hatch_alpha\", i);\n", " ctx.globalAlpha = this.cache.hatch_alpha;\n", " }\n", " color_value() {\n", " return color_1.color2css(this.hatch_color.value(), this.hatch_alpha.value());\n", " }\n", " }\n", " exports.Hatch = Hatch;\n", " Hatch.__name__ = \"Hatch\";\n", " Hatch.prototype.attrs = Object.keys(mixins.HatchVector);\n", " class Text extends ContextProperties {\n", " color_value() {\n", " return color_1.color2css(this.text_color.value(), this.text_alpha.value());\n", " }\n", " font_value() {\n", " const text_font = this.text_font.value();\n", " const text_font_size = this.text_font_size.value();\n", " const text_font_style = this.text_font_style.value();\n", " return `${text_font_style} ${text_font_size} ${text_font}`;\n", " }\n", " v_font_value(i) {\n", " super.cache_select(\"text_font_style\", i);\n", " super.cache_select(\"text_font_size\", i);\n", " super.cache_select(\"text_font\", i);\n", " const { text_font_style, text_font_size, text_font } = this.cache;\n", " return `${text_font_style} ${text_font_size} ${text_font}`;\n", " }\n", " cache_select(name, i) {\n", " let value;\n", " if (name == \"font\") {\n", " this.cache.font = value = this.v_font_value(i);\n", " }\n", " else\n", " value = super.cache_select(name, i);\n", " return value;\n", " }\n", " set_value(ctx) {\n", " ctx.font = this.font_value();\n", " ctx.fillStyle = this.text_color.value();\n", " ctx.globalAlpha = this.text_alpha.value();\n", " ctx.textAlign = this.text_align.value();\n", " ctx.textBaseline = this.text_baseline.value();\n", " }\n", " get doit() {\n", " return !(this.text_color.spec.value === null ||\n", " this.text_alpha.spec.value == 0);\n", " }\n", " _set_vectorize(ctx, i) {\n", " this.cache_select(\"font\", i);\n", " ctx.font = this.cache.font;\n", " this.cache_select(\"text_color\", i);\n", " ctx.fillStyle = this.cache.text_color;\n", " this.cache_select(\"text_alpha\", i);\n", " ctx.globalAlpha = this.cache.text_alpha;\n", " this.cache_select(\"text_align\", i);\n", " ctx.textAlign = this.cache.text_align;\n", " this.cache_select(\"text_baseline\", i);\n", " ctx.textBaseline = this.cache.text_baseline;\n", " }\n", " }\n", " exports.Text = Text;\n", " Text.__name__ = \"Text\";\n", " Text.prototype.attrs = Object.keys(mixins.TextVector);\n", " class Visuals {\n", " constructor(model) {\n", " for (const mixin of model._mixins) {\n", " const [name, prefix = \"\"] = mixin.split(\":\");\n", " let cls;\n", " switch (name) {\n", " case \"line\":\n", " cls = Line;\n", " break;\n", " case \"fill\":\n", " cls = Fill;\n", " break;\n", " case \"hatch\":\n", " cls = Hatch;\n", " break;\n", " case \"text\":\n", " cls = Text;\n", " break;\n", " default:\n", " throw new Error(`unknown visual: ${name}`);\n", " }\n", " this[prefix + name] = new cls(model, prefix);\n", " }\n", " }\n", " warm_cache(source) {\n", " for (const name in this) {\n", " if (this.hasOwnProperty(name)) {\n", " const prop = this[name];\n", " if (prop instanceof ContextProperties)\n", " prop.warm_cache(source);\n", " }\n", " }\n", " }\n", " set_all_indices(all_indices) {\n", " for (const name in this) {\n", " if (this.hasOwnProperty(name)) {\n", " const prop = this[name];\n", " if (prop instanceof ContextProperties)\n", " prop.all_indices = all_indices;\n", " }\n", " }\n", " }\n", " }\n", " exports.Visuals = Visuals;\n", " Visuals.__name__ = \"Visuals\";\n", " },\n", " /* model.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const has_props_1 = require(13) /* ./core/has_props */;\n", " const p = tslib_1.__importStar(require(18) /* ./core/properties */);\n", " const types_1 = require(8) /* ./core/util/types */;\n", " const object_1 = require(17) /* ./core/util/object */;\n", " const logging_1 = require(72) /* ./core/logging */;\n", " class Model extends has_props_1.HasProps {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Model() {\n", " this.define({\n", " tags: [p.Array, []],\n", " name: [p.String],\n", " js_property_callbacks: [p.Any, {}],\n", " js_event_callbacks: [p.Any, {}],\n", " subscribed_events: [p.Array, []],\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " this._js_callbacks = new Map();\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this._update_property_callbacks();\n", " this.connect(this.properties.js_property_callbacks.change, () => this._update_property_callbacks());\n", " this.connect(this.properties.js_event_callbacks.change, () => this._update_event_callbacks());\n", " this.connect(this.properties.subscribed_events.change, () => this._update_event_callbacks());\n", " }\n", " /*protected*/ _process_event(event) {\n", " for (const callback of this.js_event_callbacks[event.event_name] || [])\n", " callback.execute(event);\n", " if (this.document != null && this.subscribed_events.some((m) => m == event.event_name))\n", " this.document.event_manager.send_event(event);\n", " }\n", " trigger_event(event) {\n", " if (this.document != null) {\n", " event.origin = this;\n", " this.document.event_manager.trigger(event);\n", " }\n", " }\n", " _update_event_callbacks() {\n", " if (this.document == null) {\n", " // File an issue: SidePanel in particular seems to have this issue\n", " logging_1.logger.warn('WARNING: Document not defined for updating event callbacks');\n", " return;\n", " }\n", " this.document.event_manager.subscribed_models.add(this);\n", " }\n", " _update_property_callbacks() {\n", " const signal_for = (event) => {\n", " const [evt, attr = null] = event.split(\":\");\n", " return attr != null ? this.properties[attr][evt] : this[evt];\n", " };\n", " for (const [event, callbacks] of this._js_callbacks) {\n", " const signal = signal_for(event);\n", " for (const cb of callbacks)\n", " this.disconnect(signal, cb);\n", " }\n", " this._js_callbacks.clear();\n", " for (const [event, callbacks] of object_1.entries(this.js_property_callbacks)) {\n", " const wrappers = callbacks.map((cb) => () => cb.execute(this));\n", " this._js_callbacks.set(event, wrappers);\n", " const signal = signal_for(event);\n", " for (const cb of wrappers)\n", " this.connect(signal, cb);\n", " }\n", " }\n", " _doc_attached() {\n", " if (!object_1.isEmpty(this.js_event_callbacks) || this.subscribed_events.length != 0)\n", " this._update_event_callbacks();\n", " }\n", " _doc_detached() {\n", " this.document.event_manager.subscribed_models.delete(this);\n", " }\n", " select(selector) {\n", " if (types_1.isString(selector))\n", " return [...this.references()].filter((ref) => ref instanceof Model && ref.name === selector);\n", " else if (selector.prototype instanceof has_props_1.HasProps)\n", " return [...this.references()].filter((ref) => ref instanceof selector);\n", " else\n", " throw new Error(\"invalid selector\");\n", " }\n", " select_one(selector) {\n", " const result = this.select(selector);\n", " switch (result.length) {\n", " case 0:\n", " return null;\n", " case 1:\n", " return result[0];\n", " default:\n", " throw new Error(\"found more than one object matching given selector\");\n", " }\n", " }\n", " }\n", " exports.Model = Model;\n", " Model.__name__ = \"Model\";\n", " Model.init_Model();\n", " },\n", " /* core/logging.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " // This is based on https://github.com/pimterry/loglevel\n", " const types_1 = require(8) /* ./util/types */;\n", " const _loggers = {};\n", " class LogLevel {\n", " constructor(name, level) {\n", " this.name = name;\n", " this.level = level;\n", " }\n", " }\n", " exports.LogLevel = LogLevel;\n", " LogLevel.__name__ = \"LogLevel\";\n", " class Logger {\n", " constructor(name, level = Logger.INFO) {\n", " this._name = name;\n", " this.set_level(level);\n", " }\n", " static get levels() {\n", " return Object.keys(Logger.log_levels);\n", " }\n", " static get(name, level = Logger.INFO) {\n", " if (name.length > 0) {\n", " let logger = _loggers[name];\n", " if (logger == null)\n", " _loggers[name] = logger = new Logger(name, level);\n", " return logger;\n", " }\n", " else\n", " throw new TypeError(\"Logger.get() expects a non-empty string name and an optional log-level\");\n", " }\n", " get level() {\n", " return this.get_level();\n", " }\n", " get_level() {\n", " return this._log_level;\n", " }\n", " set_level(log_level) {\n", " if (log_level instanceof LogLevel)\n", " this._log_level = log_level;\n", " else if (types_1.isString(log_level) && Logger.log_levels[log_level] != null)\n", " this._log_level = Logger.log_levels[log_level];\n", " else\n", " throw new Error(\"Logger.set_level() expects a log-level object or a string name of a log-level\");\n", " const logger_name = `[${this._name}]`;\n", " for (const name in Logger.log_levels) {\n", " const log_level = Logger.log_levels[name];\n", " if (log_level.level < this._log_level.level || this._log_level.level === Logger.OFF.level)\n", " this[name] = function () { };\n", " else\n", " this[name] = _method_factory(name, logger_name);\n", " }\n", " }\n", " trace(..._args) { }\n", " debug(..._args) { }\n", " info(..._args) { }\n", " warn(..._args) { }\n", " error(..._args) { }\n", " }\n", " exports.Logger = Logger;\n", " Logger.__name__ = \"Logger\";\n", " Logger.TRACE = new LogLevel(\"trace\", 0);\n", " Logger.DEBUG = new LogLevel(\"debug\", 1);\n", " Logger.INFO = new LogLevel(\"info\", 2);\n", " Logger.WARN = new LogLevel(\"warn\", 6);\n", " Logger.ERROR = new LogLevel(\"error\", 7);\n", " Logger.FATAL = new LogLevel(\"fatal\", 8);\n", " Logger.OFF = new LogLevel(\"off\", 9);\n", " Logger.log_levels = {\n", " trace: Logger.TRACE,\n", " debug: Logger.DEBUG,\n", " info: Logger.INFO,\n", " warn: Logger.WARN,\n", " error: Logger.ERROR,\n", " fatal: Logger.FATAL,\n", " off: Logger.OFF,\n", " };\n", " function _method_factory(method_name, logger_name) {\n", " if (console[method_name] != null)\n", " return console[method_name].bind(console, logger_name);\n", " else if (console.log != null)\n", " return console.log.bind(console, logger_name);\n", " else\n", " return function () { };\n", " }\n", " exports.logger = Logger.get(\"bokeh\");\n", " function set_log_level(level) {\n", " const previous_level = exports.logger.level;\n", " if (types_1.isString(level) && Logger.log_levels[level] == null) {\n", " console.log(`[bokeh] unrecognized logging level '${level}' passed to Bokeh.set_log_level(), ignoring`);\n", " console.log(`[bokeh] valid log levels are: ${Logger.levels.join(', ')}`);\n", " }\n", " else {\n", " console.log(`[bokeh] setting log level to: '${types_1.isString(level) ? level : level.level}'`);\n", " exports.logger.set_level(level);\n", " }\n", " return previous_level;\n", " }\n", " exports.set_log_level = set_log_level;\n", " function with_log_level(level, fn) {\n", " const original = set_log_level(level);\n", " try {\n", " fn();\n", " }\n", " finally {\n", " set_log_level(original);\n", " }\n", " }\n", " exports.with_log_level = with_log_level;\n", " },\n", " /* styles/annotations.css.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const css = `\n", " .bk-root .bk-shading {\n", " position: absolute;\n", " display: block;\n", " border: 1px dashed green;\n", " }\n", " `;\n", " exports.default = css;\n", " },\n", " /* models/annotations/arrow.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const annotation_1 = require(31) /* ./annotation */;\n", " const arrow_head_1 = require(75) /* ./arrow_head */;\n", " const column_data_source_1 = require(76) /* ../sources/column_data_source */;\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const math_1 = require(10) /* ../../core/util/math */;\n", " class ArrowView extends annotation_1.AnnotationView {\n", " initialize() {\n", " super.initialize();\n", " if (this.model.source == null)\n", " this.model.source = new column_data_source_1.ColumnDataSource();\n", " this.set_data(this.model.source);\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.change, () => this.set_data(this.model.source));\n", " this.connect(this.model.source.streaming, () => this.set_data(this.model.source));\n", " this.connect(this.model.source.patching, () => this.set_data(this.model.source));\n", " }\n", " set_data(source) {\n", " super.set_data(source);\n", " this.visuals.warm_cache(source);\n", " this.plot_view.request_render();\n", " }\n", " _map_data() {\n", " const { frame } = this.plot_view;\n", " let sx_start, sy_start;\n", " if (this.model.start_units == 'data') {\n", " sx_start = frame.xscales[this.model.x_range_name].v_compute(this._x_start);\n", " sy_start = frame.yscales[this.model.y_range_name].v_compute(this._y_start);\n", " }\n", " else {\n", " sx_start = frame.xview.v_compute(this._x_start);\n", " sy_start = frame.yview.v_compute(this._y_start);\n", " }\n", " let sx_end, sy_end;\n", " if (this.model.end_units == 'data') {\n", " sx_end = frame.xscales[this.model.x_range_name].v_compute(this._x_end);\n", " sy_end = frame.yscales[this.model.y_range_name].v_compute(this._y_end);\n", " }\n", " else {\n", " sx_end = frame.xview.v_compute(this._x_end);\n", " sy_end = frame.yview.v_compute(this._y_end);\n", " }\n", " return [[sx_start, sy_start], [sx_end, sy_end]];\n", " }\n", " render() {\n", " if (!this.model.visible)\n", " return;\n", " const { ctx } = this.layer;\n", " ctx.save();\n", " // Order in this function is important. First we draw all the arrow heads.\n", " const [start, end] = this._map_data();\n", " if (this.model.end != null)\n", " this._arrow_head(ctx, \"render\", this.model.end, start, end);\n", " if (this.model.start != null)\n", " this._arrow_head(ctx, \"render\", this.model.start, end, start);\n", " // Next we call .clip on all the arrow heads, inside an initial canvas sized\n", " // rect, to create an \"inverted\" clip region for the arrow heads\n", " ctx.beginPath();\n", " const { x, y, width, height } = this.plot_view.frame.bbox;\n", " ctx.rect(x, y, width, height);\n", " if (this.model.end != null)\n", " this._arrow_head(ctx, \"clip\", this.model.end, start, end);\n", " if (this.model.start != null)\n", " this._arrow_head(ctx, \"clip\", this.model.start, end, start);\n", " ctx.closePath();\n", " ctx.clip();\n", " // Finally we draw the arrow body, with the clipping regions set up. This prevents\n", " // \"fat\" arrows from overlapping the arrow head in a bad way.\n", " this._arrow_body(ctx, start, end);\n", " ctx.restore();\n", " }\n", " _arrow_head(ctx, action, head, start, end) {\n", " for (let i = 0, _end = this._x_start.length; i < _end; i++) {\n", " // arrow head runs orthogonal to arrow body\n", " const angle = Math.PI / 2 + math_1.atan2([start[0][i], start[1][i]], [end[0][i], end[1][i]]);\n", " ctx.save();\n", " ctx.translate(end[0][i], end[1][i]);\n", " ctx.rotate(angle);\n", " if (action == \"render\")\n", " head.render(ctx, i);\n", " else if (action == \"clip\")\n", " head.clip(ctx, i);\n", " ctx.restore();\n", " }\n", " }\n", " _arrow_body(ctx, start, end) {\n", " if (!this.visuals.line.doit)\n", " return;\n", " for (let i = 0, n = this._x_start.length; i < n; i++) {\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.beginPath();\n", " ctx.moveTo(start[0][i], start[1][i]);\n", " ctx.lineTo(end[0][i], end[1][i]);\n", " ctx.stroke();\n", " }\n", " }\n", " }\n", " exports.ArrowView = ArrowView;\n", " ArrowView.__name__ = \"ArrowView\";\n", " class Arrow extends annotation_1.Annotation {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Arrow() {\n", " this.prototype.default_view = ArrowView;\n", " this.mixins(property_mixins_1.LineVector);\n", " this.define({\n", " x_start: [p.NumberSpec],\n", " y_start: [p.NumberSpec],\n", " start_units: [p.SpatialUnits, 'data'],\n", " start: [p.Instance, null],\n", " x_end: [p.NumberSpec],\n", " y_end: [p.NumberSpec],\n", " end_units: [p.SpatialUnits, 'data'],\n", " end: [p.Instance, () => new arrow_head_1.OpenHead({})],\n", " source: [p.Instance],\n", " x_range_name: [p.String, 'default'],\n", " y_range_name: [p.String, 'default'],\n", " });\n", " }\n", " }\n", " exports.Arrow = Arrow;\n", " Arrow.__name__ = \"Arrow\";\n", " Arrow.init_Arrow();\n", " },\n", " /* models/annotations/arrow_head.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const annotation_1 = require(31) /* ./annotation */;\n", " const visuals_1 = require(70) /* ../../core/visuals */;\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class ArrowHead extends annotation_1.Annotation {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ArrowHead() {\n", " this.define({\n", " size: [p.Number, 25],\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.visuals = new visuals_1.Visuals(this);\n", " }\n", " }\n", " exports.ArrowHead = ArrowHead;\n", " ArrowHead.__name__ = \"ArrowHead\";\n", " ArrowHead.init_ArrowHead();\n", " class OpenHead extends ArrowHead {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_OpenHead() {\n", " this.mixins(property_mixins_1.LineVector);\n", " }\n", " clip(ctx, i) {\n", " // This method should not begin or close a path\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.moveTo(0.5 * this.size, this.size);\n", " ctx.lineTo(0.5 * this.size, -2);\n", " ctx.lineTo(-0.5 * this.size, -2);\n", " ctx.lineTo(-0.5 * this.size, this.size);\n", " ctx.lineTo(0, 0);\n", " ctx.lineTo(0.5 * this.size, this.size);\n", " }\n", " render(ctx, i) {\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.beginPath();\n", " ctx.moveTo(0.5 * this.size, this.size);\n", " ctx.lineTo(0, 0);\n", " ctx.lineTo(-0.5 * this.size, this.size);\n", " ctx.stroke();\n", " }\n", " }\n", " }\n", " exports.OpenHead = OpenHead;\n", " OpenHead.__name__ = \"OpenHead\";\n", " OpenHead.init_OpenHead();\n", " class NormalHead extends ArrowHead {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_NormalHead() {\n", " this.mixins([property_mixins_1.LineVector, property_mixins_1.FillVector]);\n", " this.override({\n", " fill_color: 'black',\n", " });\n", " }\n", " clip(ctx, i) {\n", " // This method should not begin or close a path\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.moveTo(0.5 * this.size, this.size);\n", " ctx.lineTo(0.5 * this.size, -2);\n", " ctx.lineTo(-0.5 * this.size, -2);\n", " ctx.lineTo(-0.5 * this.size, this.size);\n", " ctx.lineTo(0.5 * this.size, this.size);\n", " }\n", " render(ctx, i) {\n", " if (this.visuals.fill.doit) {\n", " this.visuals.fill.set_vectorize(ctx, i);\n", " this._normal(ctx, i);\n", " ctx.fill();\n", " }\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_vectorize(ctx, i);\n", " this._normal(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " _normal(ctx, _i) {\n", " ctx.beginPath();\n", " ctx.moveTo(0.5 * this.size, this.size);\n", " ctx.lineTo(0, 0);\n", " ctx.lineTo(-0.5 * this.size, this.size);\n", " ctx.closePath();\n", " }\n", " }\n", " exports.NormalHead = NormalHead;\n", " NormalHead.__name__ = \"NormalHead\";\n", " NormalHead.init_NormalHead();\n", " class VeeHead extends ArrowHead {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_VeeHead() {\n", " this.mixins([property_mixins_1.LineVector, property_mixins_1.FillVector]);\n", " this.override({\n", " fill_color: 'black',\n", " });\n", " }\n", " clip(ctx, i) {\n", " // This method should not begin or close a path\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.moveTo(0.5 * this.size, this.size);\n", " ctx.lineTo(0.5 * this.size, -2);\n", " ctx.lineTo(-0.5 * this.size, -2);\n", " ctx.lineTo(-0.5 * this.size, this.size);\n", " ctx.lineTo(0, 0.5 * this.size);\n", " ctx.lineTo(0.5 * this.size, this.size);\n", " }\n", " render(ctx, i) {\n", " if (this.visuals.fill.doit) {\n", " this.visuals.fill.set_vectorize(ctx, i);\n", " this._vee(ctx, i);\n", " ctx.fill();\n", " }\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_vectorize(ctx, i);\n", " this._vee(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " _vee(ctx, _i) {\n", " ctx.beginPath();\n", " ctx.moveTo(0.5 * this.size, this.size);\n", " ctx.lineTo(0, 0);\n", " ctx.lineTo(-0.5 * this.size, this.size);\n", " ctx.lineTo(0, 0.5 * this.size);\n", " ctx.closePath();\n", " }\n", " }\n", " exports.VeeHead = VeeHead;\n", " VeeHead.__name__ = \"VeeHead\";\n", " VeeHead.init_VeeHead();\n", " class TeeHead extends ArrowHead {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_TeeHead() {\n", " this.mixins(property_mixins_1.LineVector);\n", " }\n", " render(ctx, i) {\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.beginPath();\n", " ctx.moveTo(0.5 * this.size, 0);\n", " ctx.lineTo(-0.5 * this.size, 0);\n", " ctx.stroke();\n", " }\n", " }\n", " clip(_ctx, _i) { }\n", " }\n", " exports.TeeHead = TeeHead;\n", " TeeHead.__name__ = \"TeeHead\";\n", " TeeHead.init_TeeHead();\n", " },\n", " /* models/sources/column_data_source.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const columnar_data_source_1 = require(77) /* ./columnar_data_source */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const object_1 = require(17) /* ../../core/util/object */;\n", " const typed_array = tslib_1.__importStar(require(103) /* ../../core/util/typed_array */);\n", " const set_1 = require(104) /* ../../core/util/set */;\n", " const events_1 = require(105) /* ../../document/events */;\n", " //exported for testing\n", " function stream_to_column(col, new_col, rollover) {\n", " if (types_1.isArray(col)) {\n", " const result = col.concat(new_col);\n", " if (rollover != null && result.length > rollover)\n", " return result.slice(-rollover);\n", " else\n", " return result;\n", " }\n", " else if (types_1.isTypedArray(col)) {\n", " const total_len = col.length + new_col.length;\n", " // handle rollover case for typed arrays\n", " if (rollover != null && total_len > rollover) {\n", " const start = total_len - rollover;\n", " const end = col.length;\n", " // resize col if it is shorter than the rollover length\n", " let result;\n", " if (col.length < rollover) {\n", " result = new col.constructor(rollover);\n", " result.set(col, 0);\n", " }\n", " else\n", " result = col;\n", " // shift values in original col to accommodate new_col\n", " for (let i = start, endi = end; i < endi; i++) {\n", " result[i - start] = result[i];\n", " }\n", " // update end values in col with new_col\n", " for (let i = 0, endi = new_col.length; i < endi; i++) {\n", " result[i + (end - start)] = new_col[i];\n", " }\n", " return result;\n", " }\n", " else {\n", " const tmp = new col.constructor(new_col);\n", " return typed_array.concat(col, tmp);\n", " }\n", " }\n", " else\n", " throw new Error(\"unsupported array types\");\n", " }\n", " exports.stream_to_column = stream_to_column;\n", " // exported for testing\n", " function slice(ind, length) {\n", " let start, step, stop;\n", " if (types_1.isNumber(ind)) {\n", " start = ind;\n", " stop = ind + 1;\n", " step = 1;\n", " }\n", " else {\n", " start = ind.start != null ? ind.start : 0;\n", " stop = ind.stop != null ? ind.stop : length;\n", " step = ind.step != null ? ind.step : 1;\n", " }\n", " return [start, stop, step];\n", " }\n", " exports.slice = slice;\n", " // exported for testing\n", " function patch_to_column(col, patch) {\n", " const patched = new Set();\n", " let patched_range = false;\n", " for (const [ind, val] of patch) {\n", " // make the single index case look like the length-3 multi-index case\n", " let shape;\n", " let item;\n", " let index;\n", " let value;\n", " if (types_1.isArray(ind)) {\n", " const [i] = ind;\n", " patched.add(i);\n", " shape = col[i].shape;\n", " item = col[i];\n", " value = val;\n", " // this is basically like NumPy's \"newaxis\", inserting an empty dimension\n", " // makes length 2 and 3 multi-index cases uniform, so that the same code\n", " // can handle both\n", " if (ind.length === 2) {\n", " shape = [1, shape[0]];\n", " index = [ind[0], 0, ind[1]];\n", " }\n", " else\n", " index = ind;\n", " }\n", " else {\n", " if (types_1.isNumber(ind)) {\n", " value = [val];\n", " patched.add(ind);\n", " }\n", " else {\n", " value = val;\n", " patched_range = true;\n", " }\n", " index = [0, 0, ind];\n", " shape = [1, col.length];\n", " item = col;\n", " }\n", " // now this one nested loop handles all cases\n", " let flat_index = 0;\n", " const [istart, istop, istep] = slice(index[1], shape[0]);\n", " const [jstart, jstop, jstep] = slice(index[2], shape[1]);\n", " for (let i = istart; i < istop; i += istep) {\n", " for (let j = jstart; j < jstop; j += jstep) {\n", " if (patched_range) {\n", " patched.add(j);\n", " }\n", " item[i * shape[1] + j] = value[flat_index];\n", " flat_index++;\n", " }\n", " }\n", " }\n", " return patched;\n", " }\n", " exports.patch_to_column = patch_to_column;\n", " class ColumnDataSource extends columnar_data_source_1.ColumnarDataSource {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ColumnDataSource() {\n", " this.define({\n", " data: [p.Any, {}],\n", " });\n", " }\n", " stream(new_data, rollover, setter_id) {\n", " const { data } = this;\n", " for (const k in new_data) {\n", " data[k] = stream_to_column(data[k], new_data[k], rollover);\n", " }\n", " this.setv({ data }, { silent: true });\n", " this.streaming.emit();\n", " if (this.document != null) {\n", " const hint = new events_1.ColumnsStreamedEvent(this.document, this.ref(), new_data, rollover);\n", " this.document._notify_change(this, 'data', null, null, { setter_id, hint });\n", " }\n", " }\n", " patch(patches, setter_id) {\n", " const { data } = this;\n", " let patched = new Set();\n", " for (const [column, patch] of object_1.entries(patches)) {\n", " patched = set_1.union(patched, patch_to_column(data[column], patch)); // XXX\n", " }\n", " this.setv({ data }, { silent: true });\n", " this.patching.emit([...patched]);\n", " if (this.document != null) {\n", " const hint = new events_1.ColumnsPatchedEvent(this.document, this.ref(), patches);\n", " this.document._notify_change(this, 'data', null, null, { setter_id, hint });\n", " }\n", " }\n", " }\n", " exports.ColumnDataSource = ColumnDataSource;\n", " ColumnDataSource.__name__ = \"ColumnDataSource\";\n", " ColumnDataSource.init_ColumnDataSource();\n", " },\n", " /* models/sources/columnar_data_source.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const data_source_1 = require(78) /* ./data_source */;\n", " const signaling_1 = require(14) /* ../../core/signaling */;\n", " const logging_1 = require(72) /* ../../core/logging */;\n", " const selection_manager_1 = require(80) /* ../../core/selection_manager */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const object_1 = require(17) /* ../../core/util/object */;\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " const interaction_policy_1 = require(102) /* ../selections/interaction_policy */;\n", " class ColumnarDataSource extends data_source_1.DataSource {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " get_array(key) {\n", " let column = this.data[key];\n", " if (column == null)\n", " this.data[key] = column = [];\n", " else if (!types_1.isArray(column))\n", " this.data[key] = column = Array.from(column);\n", " return column;\n", " }\n", " static init_ColumnarDataSource() {\n", " this.define({\n", " selection_policy: [p.Instance, () => new interaction_policy_1.UnionRenderers()],\n", " });\n", " this.internal({\n", " selection_manager: [p.Instance, (self) => new selection_manager_1.SelectionManager({ source: self })],\n", " inspected: [p.Instance, () => new selection_1.Selection()],\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " this._select = new signaling_1.Signal0(this, \"select\");\n", " this.inspect = new signaling_1.Signal(this, \"inspect\"); // XXX: <[indices, tool, renderer-view, source, data], this>\n", " this.streaming = new signaling_1.Signal0(this, \"streaming\");\n", " this.patching = new signaling_1.Signal(this, \"patching\");\n", " }\n", " get_column(colname) {\n", " const column = this.data[colname];\n", " return column != null ? column : null;\n", " }\n", " columns() {\n", " // return the column names in this data source\n", " return object_1.keys(this.data);\n", " }\n", " get_length(soft = true) {\n", " const lengths = array_1.uniq(object_1.values(this.data).map((v) => v.length));\n", " switch (lengths.length) {\n", " case 0: {\n", " return null; // XXX: don't guess, treat on case-by-case basis\n", " }\n", " case 1: {\n", " return lengths[0];\n", " }\n", " default: {\n", " const msg = \"data source has columns of inconsistent lengths\";\n", " if (soft) {\n", " logging_1.logger.warn(msg);\n", " return lengths.sort()[0];\n", " }\n", " else\n", " throw new Error(msg);\n", " }\n", " }\n", " }\n", " get_indices() {\n", " const length = this.get_length();\n", " return array_1.range(0, length != null ? length : 1);\n", " //TODO: returns [0] when no data, should it?\n", " }\n", " clear() {\n", " const empty = {};\n", " for (const col of this.columns()) {\n", " empty[col] = new this.data[col].constructor(0);\n", " }\n", " this.data = empty;\n", " }\n", " }\n", " exports.ColumnarDataSource = ColumnarDataSource;\n", " ColumnarDataSource.__name__ = \"ColumnarDataSource\";\n", " ColumnarDataSource.init_ColumnarDataSource();\n", " },\n", " /* models/sources/data_source.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const model_1 = require(71) /* ../../model */;\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class DataSource extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_DataSource() {\n", " this.define({\n", " selected: [p.Instance, () => new selection_1.Selection()],\n", " });\n", " }\n", " }\n", " exports.DataSource = DataSource;\n", " DataSource.__name__ = \"DataSource\";\n", " DataSource.init_DataSource();\n", " },\n", " /* models/selections/selection.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const model_1 = require(71) /* ../../model */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const object_1 = require(17) /* ../../core/util/object */;\n", " class Selection extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Selection() {\n", " this.define({\n", " indices: [p.Array, []],\n", " line_indices: [p.Array, []],\n", " multiline_indices: [p.Any, {}],\n", " });\n", " this.internal({\n", " selected_glyphs: [p.Array, []],\n", " get_view: [p.Any],\n", " image_indices: [p.Array, []],\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.get_view = () => null;\n", " }\n", " static from_hits(hits) {\n", " const indices = array_1.sort_by(hits, ([, dist]) => dist).map(([i]) => i);\n", " return new Selection({ indices });\n", " }\n", " get selected_glyph() {\n", " return this.selected_glyphs.length > 0 ? this.selected_glyphs[0] : null;\n", " }\n", " add_to_selected_glyphs(glyph) {\n", " this.selected_glyphs.push(glyph);\n", " }\n", " update(selection, _final = true, mode = \"replace\") {\n", " switch (mode) {\n", " case \"replace\": {\n", " this.indices = selection.indices;\n", " this.line_indices = selection.line_indices;\n", " this.selected_glyphs = selection.selected_glyphs;\n", " this.get_view = selection.get_view;\n", " this.multiline_indices = selection.multiline_indices;\n", " this.image_indices = selection.image_indices;\n", " break;\n", " }\n", " case \"append\": {\n", " this.update_through_union(selection);\n", " break;\n", " }\n", " case \"intersect\": {\n", " this.update_through_intersection(selection);\n", " break;\n", " }\n", " case \"subtract\": {\n", " this.update_through_subtraction(selection);\n", " break;\n", " }\n", " }\n", " }\n", " clear() {\n", " this.indices = [];\n", " this.line_indices = [];\n", " this.multiline_indices = {};\n", " this.get_view = () => null;\n", " this.selected_glyphs = [];\n", " }\n", " is_empty() {\n", " return this.indices.length == 0 && this.line_indices.length == 0 && this.image_indices.length == 0;\n", " }\n", " update_through_union(other) {\n", " this.indices = array_1.union(this.indices, other.indices);\n", " this.selected_glyphs = array_1.union(other.selected_glyphs, this.selected_glyphs);\n", " this.line_indices = array_1.union(other.line_indices, this.line_indices);\n", " if (!this.get_view())\n", " this.get_view = other.get_view;\n", " this.multiline_indices = object_1.merge(other.multiline_indices, this.multiline_indices);\n", " }\n", " update_through_intersection(other) {\n", " this.indices = array_1.intersection(this.indices, other.indices);\n", " // TODO: think through and fix any logic below\n", " this.selected_glyphs = array_1.union(other.selected_glyphs, this.selected_glyphs);\n", " this.line_indices = array_1.union(other.line_indices, this.line_indices);\n", " if (!this.get_view())\n", " this.get_view = other.get_view;\n", " this.multiline_indices = object_1.merge(other.multiline_indices, this.multiline_indices);\n", " }\n", " update_through_subtraction(other) {\n", " this.indices = array_1.difference(this.indices, other.indices);\n", " // TODO: think through and fix any logic below\n", " this.selected_glyphs = array_1.union(other.selected_glyphs, this.selected_glyphs);\n", " this.line_indices = array_1.union(other.line_indices, this.line_indices);\n", " if (!this.get_view())\n", " this.get_view = other.get_view;\n", " this.multiline_indices = object_1.merge(other.multiline_indices, this.multiline_indices);\n", " }\n", " }\n", " exports.Selection = Selection;\n", " Selection.__name__ = \"Selection\";\n", " Selection.init_Selection();\n", " },\n", " /* core/selection_manager.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const has_props_1 = require(13) /* ./has_props */;\n", " const selection_1 = require(79) /* ../models/selections/selection */;\n", " const glyph_renderer_1 = require(81) /* ../models/renderers/glyph_renderer */;\n", " const graph_renderer_1 = require(100) /* ../models/renderers/graph_renderer */;\n", " const p = tslib_1.__importStar(require(18) /* ./properties */);\n", " class SelectionManager extends has_props_1.HasProps {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.inspectors = new Map();\n", " }\n", " static init_SelectionManager() {\n", " this.internal({\n", " source: [p.Any],\n", " });\n", " }\n", " select(renderer_views, geometry, final, mode = \"replace\") {\n", " // divide renderers into glyph_renderers or graph_renderers\n", " const glyph_renderer_views = [];\n", " const graph_renderer_views = [];\n", " for (const r of renderer_views) {\n", " if (r instanceof glyph_renderer_1.GlyphRendererView)\n", " glyph_renderer_views.push(r);\n", " else if (r instanceof graph_renderer_1.GraphRendererView)\n", " graph_renderer_views.push(r);\n", " }\n", " let did_hit = false;\n", " // graph renderer case\n", " for (const r of graph_renderer_views) {\n", " const hit_test_result = r.model.selection_policy.hit_test(geometry, r);\n", " did_hit = did_hit || r.model.selection_policy.do_selection(hit_test_result, r.model, final, mode);\n", " }\n", " // glyph renderers\n", " if (glyph_renderer_views.length > 0) {\n", " const hit_test_result = this.source.selection_policy.hit_test(geometry, glyph_renderer_views);\n", " did_hit = did_hit || this.source.selection_policy.do_selection(hit_test_result, this.source, final, mode);\n", " }\n", " return did_hit;\n", " }\n", " inspect(renderer_view, geometry) {\n", " let did_hit = false;\n", " if (renderer_view instanceof glyph_renderer_1.GlyphRendererView) {\n", " const hit_test_result = renderer_view.hit_test(geometry);\n", " if (hit_test_result != null) {\n", " did_hit = !hit_test_result.is_empty();\n", " const inspection = this.get_or_create_inspector(renderer_view.model);\n", " inspection.update(hit_test_result, true, \"replace\");\n", " this.source.setv({ inspected: inspection }, { silent: true });\n", " this.source.inspect.emit([renderer_view, { geometry }]);\n", " }\n", " }\n", " else if (renderer_view instanceof graph_renderer_1.GraphRendererView) {\n", " const hit_test_result = renderer_view.model.inspection_policy.hit_test(geometry, renderer_view);\n", " did_hit = did_hit || renderer_view.model.inspection_policy.do_inspection(hit_test_result, geometry, renderer_view, false, \"replace\");\n", " }\n", " return did_hit;\n", " }\n", " clear(rview) {\n", " this.source.selected.clear();\n", " if (rview != null)\n", " this.get_or_create_inspector(rview.model).clear();\n", " }\n", " get_or_create_inspector(renderer) {\n", " let selection = this.inspectors.get(renderer);\n", " if (selection == null) {\n", " selection = new selection_1.Selection();\n", " this.inspectors.set(renderer, selection);\n", " }\n", " return selection;\n", " }\n", " }\n", " exports.SelectionManager = SelectionManager;\n", " SelectionManager.__name__ = \"SelectionManager\";\n", " SelectionManager.init_SelectionManager();\n", " },\n", " /* models/renderers/glyph_renderer.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const data_renderer_1 = require(82) /* ./data_renderer */;\n", " const line_1 = require(83) /* ../glyphs/line */;\n", " const patch_1 = require(94) /* ../glyphs/patch */;\n", " const harea_1 = require(95) /* ../glyphs/harea */;\n", " const varea_1 = require(97) /* ../glyphs/varea */;\n", " const cds_view_1 = require(98) /* ../sources/cds_view */;\n", " const logging_1 = require(72) /* ../../core/logging */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const arrayable_1 = require(12) /* ../../core/util/arrayable */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const object_1 = require(17) /* ../../core/util/object */;\n", " const build_views_1 = require(99) /* ../../core/build_views */;\n", " const factor_range_1 = require(90) /* ../ranges/factor_range */;\n", " const selection_defaults = {\n", " fill: {},\n", " line: {},\n", " };\n", " const decimated_defaults = {\n", " fill: { fill_alpha: 0.3, fill_color: \"grey\" },\n", " line: { line_alpha: 0.3, line_color: \"grey\" },\n", " };\n", " const nonselection_defaults = {\n", " fill: { fill_alpha: 0.2 },\n", " line: {},\n", " };\n", " class GlyphRendererView extends data_renderer_1.DataRendererView {\n", " async lazy_initialize() {\n", " await super.lazy_initialize();\n", " const base_glyph = this.model.glyph;\n", " const has_fill = array_1.includes(base_glyph._mixins, \"fill\");\n", " const has_line = array_1.includes(base_glyph._mixins, \"line\");\n", " const glyph_attrs = object_1.clone(base_glyph.attributes);\n", " delete glyph_attrs.id;\n", " function mk_glyph(defaults) {\n", " const attrs = object_1.clone(glyph_attrs);\n", " if (has_fill)\n", " object_1.extend(attrs, defaults.fill);\n", " if (has_line)\n", " object_1.extend(attrs, defaults.line);\n", " return new base_glyph.constructor(attrs);\n", " }\n", " this.glyph = await this.build_glyph_view(base_glyph);\n", " let { selection_glyph } = this.model;\n", " if (selection_glyph == null)\n", " selection_glyph = mk_glyph({ fill: {}, line: {} });\n", " else if (selection_glyph === \"auto\")\n", " selection_glyph = mk_glyph(selection_defaults);\n", " this.selection_glyph = await this.build_glyph_view(selection_glyph);\n", " let { nonselection_glyph } = this.model;\n", " if ((nonselection_glyph == null))\n", " nonselection_glyph = mk_glyph({ fill: {}, line: {} });\n", " else if (nonselection_glyph === \"auto\")\n", " nonselection_glyph = mk_glyph(nonselection_defaults);\n", " this.nonselection_glyph = await this.build_glyph_view(nonselection_glyph);\n", " const { hover_glyph } = this.model;\n", " if (hover_glyph != null)\n", " this.hover_glyph = await this.build_glyph_view(hover_glyph);\n", " const { muted_glyph } = this.model;\n", " if (muted_glyph != null)\n", " this.muted_glyph = await this.build_glyph_view(muted_glyph);\n", " const decimated_glyph = mk_glyph(decimated_defaults);\n", " this.decimated_glyph = await this.build_glyph_view(decimated_glyph);\n", " this.xscale = this.plot_view.frame.xscales[this.model.x_range_name];\n", " this.yscale = this.plot_view.frame.yscales[this.model.y_range_name];\n", " this.set_data(false);\n", " }\n", " async build_glyph_view(glyph) {\n", " return build_views_1.build_view(glyph, { parent: this });\n", " }\n", " remove() {\n", " var _a, _b;\n", " this.glyph.remove();\n", " this.selection_glyph.remove();\n", " this.nonselection_glyph.remove();\n", " (_a = this.hover_glyph) === null || _a === void 0 ? void 0 : _a.remove();\n", " (_b = this.muted_glyph) === null || _b === void 0 ? void 0 : _b.remove();\n", " this.decimated_glyph.remove();\n", " super.remove();\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.change, () => this.request_render());\n", " this.connect(this.model.glyph.change, () => this.set_data());\n", " this.connect(this.model.data_source.change, () => this.set_data());\n", " this.connect(this.model.data_source.streaming, () => this.set_data());\n", " this.connect(this.model.data_source.patching, (indices /* XXX: WHY? */) => this.set_data(true, indices));\n", " this.connect(this.model.data_source.selected.change, () => this.request_render());\n", " this.connect(this.model.data_source._select, () => this.request_render());\n", " if (this.hover_glyph != null)\n", " this.connect(this.model.data_source.inspect, () => this.request_render());\n", " this.connect(this.model.properties.view.change, () => this.set_data());\n", " this.connect(this.model.view.change, () => this.set_data());\n", " this.connect(this.model.properties.visible.change, () => this.plot_view.update_dataranges());\n", " const { x_ranges, y_ranges } = this.plot_view.frame;\n", " for (const name in x_ranges) {\n", " const rng = x_ranges[name];\n", " if (rng instanceof factor_range_1.FactorRange)\n", " this.connect(rng.change, () => this.set_data());\n", " }\n", " for (const name in y_ranges) {\n", " const rng = y_ranges[name];\n", " if (rng instanceof factor_range_1.FactorRange)\n", " this.connect(rng.change, () => this.set_data());\n", " }\n", " this.connect(this.model.glyph.transformchange, () => this.set_data());\n", " }\n", " have_selection_glyphs() {\n", " return this.selection_glyph != null && this.nonselection_glyph != null;\n", " }\n", " // in case of partial updates like patching, the list of indices that actually\n", " // changed may be passed as the \"indices\" parameter to afford any optional optimizations\n", " set_data(request_render = true, indices = null) {\n", " const t0 = Date.now();\n", " const source = this.model.data_source;\n", " this.all_indices = this.model.view.indices;\n", " // TODO (bev) this is a bit clunky, need to make sure glyphs use the correct ranges when they call\n", " // mapping functions on the base Renderer class\n", " this.glyph.model.setv({ x_range_name: this.model.x_range_name,\n", " y_range_name: this.model.y_range_name }, { silent: true });\n", " this.glyph.set_data(source, this.all_indices, indices);\n", " this.glyph.set_visuals(source, this.all_indices);\n", " this.decimated_glyph.set_visuals(source, this.all_indices);\n", " if (this.have_selection_glyphs()) {\n", " this.selection_glyph.set_visuals(source, this.all_indices);\n", " this.nonselection_glyph.set_visuals(source, this.all_indices);\n", " }\n", " if (this.hover_glyph != null)\n", " this.hover_glyph.set_visuals(source, this.all_indices);\n", " if (this.muted_glyph != null)\n", " this.muted_glyph.set_visuals(source, this.all_indices);\n", " const { lod_factor } = this.plot_model;\n", " this.decimated = [];\n", " for (let i = 0, end = Math.floor(this.all_indices.length / lod_factor); i < end; i++) {\n", " this.decimated.push(i * lod_factor);\n", " }\n", " const dt = Date.now() - t0;\n", " logging_1.logger.debug(`${this.glyph.model.type} ${this.model}): set_data finished in ${dt}ms`);\n", " this.set_data_timestamp = Date.now();\n", " if (request_render)\n", " this.request_render();\n", " }\n", " get has_webgl() {\n", " return this.glyph.has_webgl;\n", " }\n", " render() {\n", " if (!this.model.visible)\n", " return;\n", " const t0 = Date.now();\n", " const glsupport = this.has_webgl;\n", " this.glyph.map_data();\n", " const dtmap = Date.now() - t0;\n", " const tmask = Date.now();\n", " // all_indices is in full data space, indices is converted to subset space\n", " // either by mask_data (that uses the spatial index) or manually\n", " let indices = this.glyph.mask_data(this.all_indices);\n", " if (indices.length === this.all_indices.length) {\n", " indices = array_1.range(0, this.all_indices.length);\n", " }\n", " const dtmask = Date.now() - tmask;\n", " const { ctx } = this.layer;\n", " ctx.save();\n", " // selected is in full set space\n", " const { selected } = this.model.data_source;\n", " let selected_full_indices;\n", " if (!selected || selected.is_empty())\n", " selected_full_indices = [];\n", " else {\n", " if (this.glyph instanceof line_1.LineView && selected.selected_glyph === this.glyph.model)\n", " selected_full_indices = this.model.view.convert_indices_from_subset(indices);\n", " else\n", " selected_full_indices = selected.indices;\n", " }\n", " // inspected is in full set space\n", " const { inspected } = this.model.data_source;\n", " const inspected_full_indices = new Set((() => {\n", " if (!inspected || inspected.is_empty())\n", " return [];\n", " else {\n", " if (inspected.selected_glyph)\n", " return this.model.view.convert_indices_from_subset(indices);\n", " else if (inspected.indices.length > 0)\n", " return inspected.indices;\n", " else {\n", " // TODO: return inspected.multiline_indices.keys()\n", " return Object.keys(inspected.multiline_indices).map((i) => parseInt(i));\n", " }\n", " }\n", " })());\n", " // inspected is transformed to subset space\n", " const inspected_subset_indices = arrayable_1.filter(indices, (i) => inspected_full_indices.has(this.all_indices[i]));\n", " const { lod_threshold } = this.plot_model;\n", " let glyph;\n", " let nonselection_glyph;\n", " let selection_glyph;\n", " if ((this.model.document != null ? this.model.document.interactive_duration() > 0 : false)\n", " && !glsupport && lod_threshold != null && this.all_indices.length > lod_threshold) {\n", " // Render decimated during interaction if too many elements and not using GL\n", " indices = this.decimated;\n", " glyph = this.decimated_glyph;\n", " nonselection_glyph = this.decimated_glyph;\n", " selection_glyph = this.selection_glyph;\n", " }\n", " else {\n", " glyph = this.model.muted && this.muted_glyph != null ? this.muted_glyph : this.glyph;\n", " nonselection_glyph = this.nonselection_glyph;\n", " selection_glyph = this.selection_glyph;\n", " }\n", " if (this.hover_glyph != null && inspected_subset_indices.length)\n", " indices = array_1.difference(indices, inspected_subset_indices);\n", " // Render with no selection\n", " let dtselect = null;\n", " let trender;\n", " if (!(selected_full_indices.length && this.have_selection_glyphs())) {\n", " trender = Date.now();\n", " if (this.glyph instanceof line_1.LineView) {\n", " if (this.hover_glyph && inspected_subset_indices.length)\n", " this.hover_glyph.render(ctx, this.model.view.convert_indices_from_subset(inspected_subset_indices), this.glyph);\n", " else\n", " glyph.render(ctx, this.all_indices, this.glyph);\n", " }\n", " else if (this.glyph instanceof patch_1.PatchView || this.glyph instanceof harea_1.HAreaView || this.glyph instanceof varea_1.VAreaView) {\n", " if (inspected.selected_glyphs.length == 0 || this.hover_glyph == null) {\n", " glyph.render(ctx, this.all_indices, this.glyph);\n", " }\n", " else {\n", " for (const sglyph of inspected.selected_glyphs) {\n", " if (sglyph == this.glyph.model)\n", " this.hover_glyph.render(ctx, this.all_indices, this.glyph);\n", " }\n", " }\n", " }\n", " else {\n", " glyph.render(ctx, indices, this.glyph);\n", " if (this.hover_glyph && inspected_subset_indices.length)\n", " this.hover_glyph.render(ctx, inspected_subset_indices, this.glyph);\n", " }\n", " // Render with selection\n", " }\n", " else {\n", " // reset the selection mask\n", " const tselect = Date.now();\n", " const selected_mask = {};\n", " for (const i of selected_full_indices) {\n", " selected_mask[i] = true;\n", " }\n", " // intersect/different selection with render mask\n", " const selected_subset_indices = new Array();\n", " const nonselected_subset_indices = new Array();\n", " // now, selected is changed to subset space, except for Line glyph\n", " if (this.glyph instanceof line_1.LineView) {\n", " for (const i of this.all_indices) {\n", " if (selected_mask[i] != null)\n", " selected_subset_indices.push(i);\n", " else\n", " nonselected_subset_indices.push(i);\n", " }\n", " }\n", " else {\n", " for (const i of indices) {\n", " if (selected_mask[this.all_indices[i]] != null)\n", " selected_subset_indices.push(i);\n", " else\n", " nonselected_subset_indices.push(i);\n", " }\n", " }\n", " dtselect = Date.now() - tselect;\n", " trender = Date.now();\n", " nonselection_glyph.render(ctx, nonselected_subset_indices, this.glyph);\n", " selection_glyph.render(ctx, selected_subset_indices, this.glyph);\n", " if (this.hover_glyph != null) {\n", " if (this.glyph instanceof line_1.LineView)\n", " this.hover_glyph.render(ctx, this.model.view.convert_indices_from_subset(inspected_subset_indices), this.glyph);\n", " else\n", " this.hover_glyph.render(ctx, inspected_subset_indices, this.glyph);\n", " }\n", " }\n", " const dtrender = Date.now() - trender;\n", " this.last_dtrender = dtrender;\n", " const dttot = Date.now() - t0;\n", " logging_1.logger.debug(`${this.glyph.model.type} ${this.model}: render finished in ${dttot}ms`);\n", " logging_1.logger.trace(` - map_data finished in : ${dtmap}ms`);\n", " logging_1.logger.trace(` - mask_data finished in : ${dtmask}ms`);\n", " if (dtselect != null) {\n", " logging_1.logger.trace(` - selection mask finished in : ${dtselect}ms`);\n", " }\n", " logging_1.logger.trace(` - glyph renders finished in : ${dtrender}ms`);\n", " ctx.restore();\n", " }\n", " draw_legend(ctx, x0, x1, y0, y1, field, label, index) {\n", " if (index == null)\n", " index = this.model.get_reference_point(field, label);\n", " this.glyph.draw_legend_for_index(ctx, { x0, x1, y0, y1 }, index);\n", " }\n", " hit_test(geometry) {\n", " if (!this.model.visible)\n", " return null;\n", " const hit_test_result = this.glyph.hit_test(geometry);\n", " // glyphs that don't have hit-testing implemented will return null\n", " if (hit_test_result == null)\n", " return null;\n", " return this.model.view.convert_selection_from_subset(hit_test_result);\n", " }\n", " }\n", " exports.GlyphRendererView = GlyphRendererView;\n", " GlyphRendererView.__name__ = \"GlyphRendererView\";\n", " class GlyphRenderer extends data_renderer_1.DataRenderer {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_GlyphRenderer() {\n", " this.prototype.default_view = GlyphRendererView;\n", " this.define({\n", " data_source: [p.Instance],\n", " view: [p.Instance, () => new cds_view_1.CDSView()],\n", " glyph: [p.Instance],\n", " hover_glyph: [p.Instance],\n", " nonselection_glyph: [p.Any, 'auto'],\n", " selection_glyph: [p.Any, 'auto'],\n", " muted_glyph: [p.Instance],\n", " muted: [p.Boolean, false],\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " if (this.view.source == null) {\n", " this.view.source = this.data_source;\n", " this.view.compute_indices();\n", " }\n", " }\n", " get_reference_point(field, value) {\n", " let index = 0;\n", " if (field != null) {\n", " const data = this.data_source.get_column(field);\n", " if (data != null) {\n", " const i = arrayable_1.indexOf(data, value);\n", " if (i != -1)\n", " index = i;\n", " }\n", " }\n", " return index;\n", " }\n", " get_selection_manager() {\n", " return this.data_source.selection_manager;\n", " }\n", " }\n", " exports.GlyphRenderer = GlyphRenderer;\n", " GlyphRenderer.__name__ = \"GlyphRenderer\";\n", " GlyphRenderer.init_GlyphRenderer();\n", " },\n", " /* models/renderers/data_renderer.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const renderer_1 = require(65) /* ./renderer */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class DataRendererView extends renderer_1.RendererView {\n", " }\n", " exports.DataRendererView = DataRendererView;\n", " DataRendererView.__name__ = \"DataRendererView\";\n", " class DataRenderer extends renderer_1.Renderer {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_DataRenderer() {\n", " this.define({\n", " x_range_name: [p.String, 'default'],\n", " y_range_name: [p.String, 'default'],\n", " });\n", " this.override({\n", " level: 'glyph',\n", " });\n", " }\n", " }\n", " exports.DataRenderer = DataRenderer;\n", " DataRenderer.__name__ = \"DataRenderer\";\n", " DataRenderer.init_DataRenderer();\n", " },\n", " /* models/glyphs/line.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const xy_glyph_1 = require(84) /* ./xy_glyph */;\n", " const utils_1 = require(92) /* ./utils */;\n", " const mixins = tslib_1.__importStar(require(23) /* ../../core/property_mixins */);\n", " const hittest = tslib_1.__importStar(require(93) /* ../../core/hittest */);\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class LineView extends xy_glyph_1.XYGlyphView {\n", " _render(ctx, indices, { sx, sy }) {\n", " let drawing = false;\n", " let last_index = null;\n", " this.visuals.line.set_value(ctx);\n", " for (const i of indices) {\n", " if (drawing) {\n", " if (!isFinite(sx[i] + sy[i])) {\n", " ctx.stroke();\n", " ctx.beginPath();\n", " drawing = false;\n", " last_index = i;\n", " continue;\n", " }\n", " if (last_index != null && i - last_index > 1) {\n", " ctx.stroke();\n", " drawing = false;\n", " }\n", " }\n", " if (drawing)\n", " ctx.lineTo(sx[i], sy[i]);\n", " else {\n", " ctx.beginPath();\n", " ctx.moveTo(sx[i], sy[i]);\n", " drawing = true;\n", " }\n", " last_index = i;\n", " }\n", " if (drawing)\n", " ctx.stroke();\n", " }\n", " _hit_point(geometry) {\n", " /* Check if the point geometry hits this line glyph and return an object\n", " that describes the hit result:\n", " Args:\n", " * geometry (object): object with the following keys\n", " * sx (float): screen x coordinate of the point\n", " * sy (float): screen y coordinate of the point\n", " * type (str): type of geometry (in this case it's a point)\n", " */\n", " const result = new selection_1.Selection();\n", " const point = { x: geometry.sx, y: geometry.sy };\n", " let shortest = 9999;\n", " const threshold = Math.max(2, this.visuals.line.line_width.value() / 2);\n", " for (let i = 0, end = this.sx.length - 1; i < end; i++) {\n", " const p0 = { x: this.sx[i], y: this.sy[i] };\n", " const p1 = { x: this.sx[i + 1], y: this.sy[i + 1] };\n", " const dist = hittest.dist_to_segment(point, p0, p1);\n", " if (dist < threshold && dist < shortest) {\n", " shortest = dist;\n", " result.add_to_selected_glyphs(this.model);\n", " result.get_view = () => this;\n", " result.line_indices = [i];\n", " }\n", " }\n", " return result;\n", " }\n", " _hit_span(geometry) {\n", " const { sx, sy } = geometry;\n", " const result = new selection_1.Selection();\n", " let val;\n", " let values;\n", " if (geometry.direction == 'v') {\n", " val = this.renderer.yscale.invert(sy);\n", " values = this._y;\n", " }\n", " else {\n", " val = this.renderer.xscale.invert(sx);\n", " values = this._x;\n", " }\n", " for (let i = 0, end = values.length - 1; i < end; i++) {\n", " if ((values[i] <= val && val <= values[i + 1]) || (values[i + 1] <= val && val <= values[i])) {\n", " result.add_to_selected_glyphs(this.model);\n", " result.get_view = () => this;\n", " result.line_indices.push(i);\n", " }\n", " }\n", " return result;\n", " }\n", " get_interpolation_hit(i, geometry) {\n", " const [x2, y2, x3, y3] = [this._x[i], this._y[i], this._x[i + 1], this._y[i + 1]];\n", " return utils_1.line_interpolation(this.renderer, geometry, x2, y2, x3, y3);\n", " }\n", " draw_legend_for_index(ctx, bbox, index) {\n", " utils_1.generic_line_legend(this.visuals, ctx, bbox, index);\n", " }\n", " }\n", " exports.LineView = LineView;\n", " LineView.__name__ = \"LineView\";\n", " class Line extends xy_glyph_1.XYGlyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Line() {\n", " this.prototype.default_view = LineView;\n", " this.mixins(mixins.Line /*Scalar*/);\n", " }\n", " }\n", " exports.Line = Line;\n", " Line.__name__ = \"Line\";\n", " Line.init_Line();\n", " },\n", " /* models/glyphs/xy_glyph.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const spatial_1 = require(85) /* ../../core/util/spatial */;\n", " const glyph_1 = require(89) /* ./glyph */;\n", " class XYGlyphView extends glyph_1.GlyphView {\n", " _index_data() {\n", " const points = [];\n", " for (let i = 0, end = this._x.length; i < end; i++) {\n", " const x = this._x[i];\n", " const y = this._y[i];\n", " if (isNaN(x + y) || !isFinite(x + y))\n", " continue;\n", " points.push({ x0: x, y0: y, x1: x, y1: y, i });\n", " }\n", " return new spatial_1.SpatialIndex(points);\n", " }\n", " scenterx(i) {\n", " return this.sx[i];\n", " }\n", " scentery(i) {\n", " return this.sy[i];\n", " }\n", " }\n", " exports.XYGlyphView = XYGlyphView;\n", " XYGlyphView.__name__ = \"XYGlyphView\";\n", " class XYGlyph extends glyph_1.Glyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_XYGlyph() {\n", " this.coords([['x', 'y']]);\n", " }\n", " }\n", " exports.XYGlyph = XYGlyph;\n", " XYGlyph.__name__ = \"XYGlyph\";\n", " XYGlyph.init_XYGlyph();\n", " },\n", " /* core/util/spatial.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const flatbush_1 = tslib_1.__importDefault(require(86) /* flatbush */);\n", " const bbox_1 = require(88) /* ./bbox */;\n", " class SpatialIndex {\n", " constructor(points) {\n", " this.points = points;\n", " this.index = null;\n", " if (points.length > 0) {\n", " this.index = new flatbush_1.default(points.length);\n", " for (const p of points) {\n", " const { x0, y0, x1, y1 } = p;\n", " this.index.add(x0, y0, x1, y1);\n", " }\n", " this.index.finish();\n", " }\n", " }\n", " _normalize(rect) {\n", " let { x0, y0, x1, y1 } = rect;\n", " if (x0 > x1)\n", " [x0, x1] = [x1, x0];\n", " if (y0 > y1)\n", " [y0, y1] = [y1, y0];\n", " return { x0, y0, x1, y1 };\n", " }\n", " get bbox() {\n", " if (this.index == null)\n", " return bbox_1.empty();\n", " else {\n", " const { minX, minY, maxX, maxY } = this.index;\n", " return { x0: minX, y0: minY, x1: maxX, y1: maxY };\n", " }\n", " }\n", " search(rect) {\n", " if (this.index == null)\n", " return [];\n", " else {\n", " const { x0, y0, x1, y1 } = this._normalize(rect);\n", " const indices = this.index.search(x0, y0, x1, y1);\n", " return indices.map((j) => this.points[j]);\n", " }\n", " }\n", " indices(rect) {\n", " return this.search(rect).map(({ i }) => i);\n", " }\n", " }\n", " exports.SpatialIndex = SpatialIndex;\n", " SpatialIndex.__name__ = \"SpatialIndex\";\n", " },\n", " /* flatbush/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const flatqueue_1 = tslib_1.__importDefault(require(87) /* flatqueue */);\n", " const ARRAY_TYPES = [\n", " Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array,\n", " Int32Array, Uint32Array, Float32Array, Float64Array\n", " ];\n", " const VERSION = 3; // serialized format version\n", " class Flatbush {\n", " static from(data) {\n", " if (!(data instanceof ArrayBuffer)) {\n", " throw new Error('Data must be an instance of ArrayBuffer.');\n", " }\n", " const [magic, versionAndType] = new Uint8Array(data, 0, 2);\n", " if (magic !== 0xfb) {\n", " throw new Error('Data does not appear to be in a Flatbush format.');\n", " }\n", " if (versionAndType >> 4 !== VERSION) {\n", " throw new Error(`Got v${versionAndType >> 4} data when expected v${VERSION}.`);\n", " }\n", " const [nodeSize] = new Uint16Array(data, 2, 1);\n", " const [numItems] = new Uint32Array(data, 4, 1);\n", " return new Flatbush(numItems, nodeSize, ARRAY_TYPES[versionAndType & 0x0f], data);\n", " }\n", " constructor(numItems, nodeSize = 16, ArrayType = Float64Array, data) {\n", " if (numItems === undefined)\n", " throw new Error('Missing required argument: numItems.');\n", " if (isNaN(numItems) || numItems <= 0)\n", " throw new Error(`Unpexpected numItems value: ${numItems}.`);\n", " this.numItems = +numItems;\n", " this.nodeSize = Math.min(Math.max(+nodeSize, 2), 65535);\n", " // calculate the total number of nodes in the R-tree to allocate space for\n", " // and the index of each tree level (used in search later)\n", " let n = numItems;\n", " let numNodes = n;\n", " this._levelBounds = [n * 4];\n", " do {\n", " n = Math.ceil(n / this.nodeSize);\n", " numNodes += n;\n", " this._levelBounds.push(numNodes * 4);\n", " } while (n !== 1);\n", " this.ArrayType = ArrayType || Float64Array;\n", " this.IndexArrayType = numNodes < 16384 ? Uint16Array : Uint32Array;\n", " const arrayTypeIndex = ARRAY_TYPES.indexOf(this.ArrayType);\n", " const nodesByteSize = numNodes * 4 * this.ArrayType.BYTES_PER_ELEMENT;\n", " if (arrayTypeIndex < 0) {\n", " throw new Error(`Unexpected typed array class: ${ArrayType}.`);\n", " }\n", " if (data && (data instanceof ArrayBuffer)) {\n", " this.data = data;\n", " this._boxes = new this.ArrayType(this.data, 8, numNodes * 4);\n", " this._indices = new this.IndexArrayType(this.data, 8 + nodesByteSize, numNodes);\n", " this._pos = numNodes * 4;\n", " this.minX = this._boxes[this._pos - 4];\n", " this.minY = this._boxes[this._pos - 3];\n", " this.maxX = this._boxes[this._pos - 2];\n", " this.maxY = this._boxes[this._pos - 1];\n", " }\n", " else {\n", " this.data = new ArrayBuffer(8 + nodesByteSize + numNodes * this.IndexArrayType.BYTES_PER_ELEMENT);\n", " this._boxes = new this.ArrayType(this.data, 8, numNodes * 4);\n", " this._indices = new this.IndexArrayType(this.data, 8 + nodesByteSize, numNodes);\n", " this._pos = 0;\n", " this.minX = Infinity;\n", " this.minY = Infinity;\n", " this.maxX = -Infinity;\n", " this.maxY = -Infinity;\n", " new Uint8Array(this.data, 0, 2).set([0xfb, (VERSION << 4) + arrayTypeIndex]);\n", " new Uint16Array(this.data, 2, 1)[0] = nodeSize;\n", " new Uint32Array(this.data, 4, 1)[0] = numItems;\n", " }\n", " // a priority queue for k-nearest-neighbors queries\n", " this._queue = new flatqueue_1.default();\n", " }\n", " add(minX, minY, maxX, maxY) {\n", " const index = this._pos >> 2;\n", " this._indices[index] = index;\n", " this._boxes[this._pos++] = minX;\n", " this._boxes[this._pos++] = minY;\n", " this._boxes[this._pos++] = maxX;\n", " this._boxes[this._pos++] = maxY;\n", " if (minX < this.minX)\n", " this.minX = minX;\n", " if (minY < this.minY)\n", " this.minY = minY;\n", " if (maxX > this.maxX)\n", " this.maxX = maxX;\n", " if (maxY > this.maxY)\n", " this.maxY = maxY;\n", " return index;\n", " }\n", " finish() {\n", " if (this._pos >> 2 !== this.numItems) {\n", " throw new Error(`Added ${this._pos >> 2} items when expected ${this.numItems}.`);\n", " }\n", " if (this.numItems <= this.nodeSize) {\n", " // only one node, skip sorting and just fill the root box\n", " this._boxes[this._pos++] = this.minX;\n", " this._boxes[this._pos++] = this.minY;\n", " this._boxes[this._pos++] = this.maxX;\n", " this._boxes[this._pos++] = this.maxY;\n", " return;\n", " }\n", " const width = this.maxX - this.minX;\n", " const height = this.maxY - this.minY;\n", " const hilbertValues = new Uint32Array(this.numItems);\n", " const hilbertMax = (1 << 16) - 1;\n", " // map item centers into Hilbert coordinate space and calculate Hilbert values\n", " for (let i = 0; i < this.numItems; i++) {\n", " let pos = 4 * i;\n", " const minX = this._boxes[pos++];\n", " const minY = this._boxes[pos++];\n", " const maxX = this._boxes[pos++];\n", " const maxY = this._boxes[pos++];\n", " const x = Math.floor(hilbertMax * ((minX + maxX) / 2 - this.minX) / width);\n", " const y = Math.floor(hilbertMax * ((minY + maxY) / 2 - this.minY) / height);\n", " hilbertValues[i] = hilbert(x, y);\n", " }\n", " // sort items by their Hilbert value (for packing later)\n", " sort(hilbertValues, this._boxes, this._indices, 0, this.numItems - 1, this.nodeSize);\n", " // generate nodes at each tree level, bottom-up\n", " for (let i = 0, pos = 0; i < this._levelBounds.length - 1; i++) {\n", " const end = this._levelBounds[i];\n", " // generate a parent node for each block of consecutive nodes\n", " while (pos < end) {\n", " const nodeIndex = pos;\n", " // calculate bbox for the new node\n", " let nodeMinX = Infinity;\n", " let nodeMinY = Infinity;\n", " let nodeMaxX = -Infinity;\n", " let nodeMaxY = -Infinity;\n", " for (let i = 0; i < this.nodeSize && pos < end; i++) {\n", " nodeMinX = Math.min(nodeMinX, this._boxes[pos++]);\n", " nodeMinY = Math.min(nodeMinY, this._boxes[pos++]);\n", " nodeMaxX = Math.max(nodeMaxX, this._boxes[pos++]);\n", " nodeMaxY = Math.max(nodeMaxY, this._boxes[pos++]);\n", " }\n", " // add the new node to the tree data\n", " this._indices[this._pos >> 2] = nodeIndex;\n", " this._boxes[this._pos++] = nodeMinX;\n", " this._boxes[this._pos++] = nodeMinY;\n", " this._boxes[this._pos++] = nodeMaxX;\n", " this._boxes[this._pos++] = nodeMaxY;\n", " }\n", " }\n", " }\n", " search(minX, minY, maxX, maxY, filterFn) {\n", " if (this._pos !== this._boxes.length) {\n", " throw new Error('Data not yet indexed - call index.finish().');\n", " }\n", " let nodeIndex = this._boxes.length - 4;\n", " const queue = [];\n", " const results = [];\n", " while (nodeIndex !== undefined) {\n", " // find the end index of the node\n", " const end = Math.min(nodeIndex + this.nodeSize * 4, upperBound(nodeIndex, this._levelBounds));\n", " // search through child nodes\n", " for (let pos = nodeIndex; pos < end; pos += 4) {\n", " const index = this._indices[pos >> 2] | 0;\n", " // check if node bbox intersects with query bbox\n", " if (maxX < this._boxes[pos])\n", " continue; // maxX < nodeMinX\n", " if (maxY < this._boxes[pos + 1])\n", " continue; // maxY < nodeMinY\n", " if (minX > this._boxes[pos + 2])\n", " continue; // minX > nodeMaxX\n", " if (minY > this._boxes[pos + 3])\n", " continue; // minY > nodeMaxY\n", " if (nodeIndex < this.numItems * 4) {\n", " if (filterFn === undefined || filterFn(index)) {\n", " results.push(index); // leaf item\n", " }\n", " }\n", " else {\n", " queue.push(index); // node; add it to the search queue\n", " }\n", " }\n", " nodeIndex = queue.pop();\n", " }\n", " return results;\n", " }\n", " neighbors(x, y, maxResults = Infinity, maxDistance = Infinity, filterFn) {\n", " if (this._pos !== this._boxes.length) {\n", " throw new Error('Data not yet indexed - call index.finish().');\n", " }\n", " let nodeIndex = this._boxes.length - 4;\n", " const q = this._queue;\n", " const results = [];\n", " const maxDistSquared = maxDistance * maxDistance;\n", " while (nodeIndex !== undefined) {\n", " // find the end index of the node\n", " const end = Math.min(nodeIndex + this.nodeSize * 4, upperBound(nodeIndex, this._levelBounds));\n", " // add child nodes to the queue\n", " for (let pos = nodeIndex; pos < end; pos += 4) {\n", " const index = this._indices[pos >> 2] | 0;\n", " const dx = axisDist(x, this._boxes[pos], this._boxes[pos + 2]);\n", " const dy = axisDist(y, this._boxes[pos + 1], this._boxes[pos + 3]);\n", " const dist = dx * dx + dy * dy;\n", " if (nodeIndex < this.numItems * 4) { // leaf node\n", " if (filterFn === undefined || filterFn(index)) {\n", " // put a negative index if it's an item rather than a node, to recognize later\n", " q.push(-index - 1, dist);\n", " }\n", " }\n", " else {\n", " q.push(index, dist);\n", " }\n", " }\n", " // pop items from the queue\n", " while (q.length && q.peek() < 0) {\n", " const dist = q.peekValue();\n", " if (dist > maxDistSquared) {\n", " q.clear();\n", " return results;\n", " }\n", " results.push(-q.pop() - 1);\n", " if (results.length === maxResults) {\n", " q.clear();\n", " return results;\n", " }\n", " }\n", " nodeIndex = q.pop();\n", " }\n", " q.clear();\n", " return results;\n", " }\n", " }\n", " exports.default = Flatbush;\n", " function axisDist(k, min, max) {\n", " return k < min ? min - k : k <= max ? 0 : k - max;\n", " }\n", " // binary search for the first value in the array bigger than the given\n", " function upperBound(value, arr) {\n", " let i = 0;\n", " let j = arr.length - 1;\n", " while (i < j) {\n", " const m = (i + j) >> 1;\n", " if (arr[m] > value) {\n", " j = m;\n", " }\n", " else {\n", " i = m + 1;\n", " }\n", " }\n", " return arr[i];\n", " }\n", " // custom quicksort that partially sorts bbox data alongside the hilbert values\n", " function sort(values, boxes, indices, left, right, nodeSize) {\n", " if (Math.floor(left / nodeSize) >= Math.floor(right / nodeSize))\n", " return;\n", " const pivot = values[(left + right) >> 1];\n", " let i = left - 1;\n", " let j = right + 1;\n", " while (true) {\n", " do\n", " i++;\n", " while (values[i] < pivot);\n", " do\n", " j--;\n", " while (values[j] > pivot);\n", " if (i >= j)\n", " break;\n", " swap(values, boxes, indices, i, j);\n", " }\n", " sort(values, boxes, indices, left, j, nodeSize);\n", " sort(values, boxes, indices, j + 1, right, nodeSize);\n", " }\n", " // swap two values and two corresponding boxes\n", " function swap(values, boxes, indices, i, j) {\n", " const temp = values[i];\n", " values[i] = values[j];\n", " values[j] = temp;\n", " const k = 4 * i;\n", " const m = 4 * j;\n", " const a = boxes[k];\n", " const b = boxes[k + 1];\n", " const c = boxes[k + 2];\n", " const d = boxes[k + 3];\n", " boxes[k] = boxes[m];\n", " boxes[k + 1] = boxes[m + 1];\n", " boxes[k + 2] = boxes[m + 2];\n", " boxes[k + 3] = boxes[m + 3];\n", " boxes[m] = a;\n", " boxes[m + 1] = b;\n", " boxes[m + 2] = c;\n", " boxes[m + 3] = d;\n", " const e = indices[i];\n", " indices[i] = indices[j];\n", " indices[j] = e;\n", " }\n", " // Fast Hilbert curve algorithm by http://threadlocalmutex.com/\n", " // Ported from C++ https://github.com/rawrunprotected/hilbert_curves (public domain)\n", " function hilbert(x, y) {\n", " let a = x ^ y;\n", " let b = 0xFFFF ^ a;\n", " let c = 0xFFFF ^ (x | y);\n", " let d = x & (y ^ 0xFFFF);\n", " let A = a | (b >> 1);\n", " let B = (a >> 1) ^ a;\n", " let C = ((c >> 1) ^ (b & (d >> 1))) ^ c;\n", " let D = ((a & (c >> 1)) ^ (d >> 1)) ^ d;\n", " a = A;\n", " b = B;\n", " c = C;\n", " d = D;\n", " A = ((a & (a >> 2)) ^ (b & (b >> 2)));\n", " B = ((a & (b >> 2)) ^ (b & ((a ^ b) >> 2)));\n", " C ^= ((a & (c >> 2)) ^ (b & (d >> 2)));\n", " D ^= ((b & (c >> 2)) ^ ((a ^ b) & (d >> 2)));\n", " a = A;\n", " b = B;\n", " c = C;\n", " d = D;\n", " A = ((a & (a >> 4)) ^ (b & (b >> 4)));\n", " B = ((a & (b >> 4)) ^ (b & ((a ^ b) >> 4)));\n", " C ^= ((a & (c >> 4)) ^ (b & (d >> 4)));\n", " D ^= ((b & (c >> 4)) ^ ((a ^ b) & (d >> 4)));\n", " a = A;\n", " b = B;\n", " c = C;\n", " d = D;\n", " C ^= ((a & (c >> 8)) ^ (b & (d >> 8)));\n", " D ^= ((b & (c >> 8)) ^ ((a ^ b) & (d >> 8)));\n", " a = C ^ (C >> 1);\n", " b = D ^ (D >> 1);\n", " let i0 = x ^ y;\n", " let i1 = b | (0xFFFF ^ (i0 | a));\n", " i0 = (i0 | (i0 << 8)) & 0x00FF00FF;\n", " i0 = (i0 | (i0 << 4)) & 0x0F0F0F0F;\n", " i0 = (i0 | (i0 << 2)) & 0x33333333;\n", " i0 = (i0 | (i0 << 1)) & 0x55555555;\n", " i1 = (i1 | (i1 << 8)) & 0x00FF00FF;\n", " i1 = (i1 | (i1 << 4)) & 0x0F0F0F0F;\n", " i1 = (i1 | (i1 << 2)) & 0x33333333;\n", " i1 = (i1 | (i1 << 1)) & 0x55555555;\n", " return ((i1 << 1) | i0) >>> 0;\n", " }\n", " },\n", " /* flatqueue/index.mjs */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " class FlatQueue {\n", " constructor() {\n", " this.ids = [];\n", " this.values = [];\n", " this.length = 0;\n", " }\n", " clear() {\n", " this.length = 0;\n", " }\n", " push(id, value) {\n", " let pos = this.length++;\n", " this.ids[pos] = id;\n", " this.values[pos] = value;\n", " while (pos > 0) {\n", " const parent = (pos - 1) >> 1;\n", " const parentValue = this.values[parent];\n", " if (value >= parentValue)\n", " break;\n", " this.ids[pos] = this.ids[parent];\n", " this.values[pos] = parentValue;\n", " pos = parent;\n", " }\n", " this.ids[pos] = id;\n", " this.values[pos] = value;\n", " }\n", " pop() {\n", " if (this.length === 0)\n", " return undefined;\n", " const top = this.ids[0];\n", " this.length--;\n", " if (this.length > 0) {\n", " const id = this.ids[0] = this.ids[this.length];\n", " const value = this.values[0] = this.values[this.length];\n", " const halfLength = this.length >> 1;\n", " let pos = 0;\n", " while (pos < halfLength) {\n", " let left = (pos << 1) + 1;\n", " const right = left + 1;\n", " let bestIndex = this.ids[left];\n", " let bestValue = this.values[left];\n", " const rightValue = this.values[right];\n", " if (right < this.length && rightValue < bestValue) {\n", " left = right;\n", " bestIndex = this.ids[right];\n", " bestValue = rightValue;\n", " }\n", " if (bestValue >= value)\n", " break;\n", " this.ids[pos] = bestIndex;\n", " this.values[pos] = bestValue;\n", " pos = left;\n", " }\n", " this.ids[pos] = id;\n", " this.values[pos] = value;\n", " }\n", " return top;\n", " }\n", " peek() {\n", " if (this.length === 0)\n", " return undefined;\n", " return this.ids[0];\n", " }\n", " peekValue() {\n", " if (this.length === 0)\n", " return undefined;\n", " return this.values[0];\n", " }\n", " }\n", " exports.default = FlatQueue;\n", " },\n", " /* core/util/bbox.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const { min, max } = Math;\n", " function empty() {\n", " return {\n", " x0: Infinity,\n", " y0: Infinity,\n", " x1: -Infinity,\n", " y1: -Infinity,\n", " };\n", " }\n", " exports.empty = empty;\n", " function positive_x() {\n", " return {\n", " x0: Number.MIN_VALUE,\n", " y0: -Infinity,\n", " x1: Infinity,\n", " y1: Infinity,\n", " };\n", " }\n", " exports.positive_x = positive_x;\n", " function positive_y() {\n", " return {\n", " x0: -Infinity,\n", " y0: Number.MIN_VALUE,\n", " x1: Infinity,\n", " y1: Infinity,\n", " };\n", " }\n", " exports.positive_y = positive_y;\n", " function union(a, b) {\n", " return {\n", " x0: min(a.x0, b.x0),\n", " x1: max(a.x1, b.x1),\n", " y0: min(a.y0, b.y0),\n", " y1: max(a.y1, b.y1),\n", " };\n", " }\n", " exports.union = union;\n", " class BBox {\n", " constructor(box) {\n", " if (box == null) {\n", " this.x0 = 0;\n", " this.y0 = 0;\n", " this.x1 = 0;\n", " this.y1 = 0;\n", " }\n", " else if ('x0' in box) {\n", " const { x0, y0, x1, y1 } = box;\n", " if (!(x0 <= x1 && y0 <= y1))\n", " throw new Error(`invalid bbox {x0: ${x0}, y0: ${y0}, x1: ${x1}, y1: ${y1}}`);\n", " this.x0 = x0;\n", " this.y0 = y0;\n", " this.x1 = x1;\n", " this.y1 = y1;\n", " }\n", " else if (\"x\" in box) {\n", " const { x, y, width, height } = box;\n", " if (!(width >= 0 && height >= 0))\n", " throw new Error(`invalid bbox {x: ${x}, y: ${y}, width: ${width}, height: ${height}}`);\n", " this.x0 = x;\n", " this.y0 = y;\n", " this.x1 = x + width;\n", " this.y1 = y + height;\n", " }\n", " else {\n", " let left, right;\n", " let top, bottom;\n", " if (\"width\" in box) {\n", " if (\"left\" in box) {\n", " left = box.left;\n", " right = left + box.width;\n", " }\n", " else if (\"right\" in box) {\n", " right = box.right;\n", " left = right - box.width;\n", " }\n", " else {\n", " const w2 = box.width / 2;\n", " left = box.hcenter - w2;\n", " right = box.hcenter + w2;\n", " }\n", " }\n", " else {\n", " left = box.left;\n", " right = box.right;\n", " }\n", " if (\"height\" in box) {\n", " if (\"top\" in box) {\n", " top = box.top;\n", " bottom = top + box.height;\n", " }\n", " else if (\"bottom\" in box) {\n", " bottom = box.bottom;\n", " top = bottom - box.height;\n", " }\n", " else {\n", " const h2 = box.height / 2;\n", " top = box.vcenter - h2;\n", " bottom = box.vcenter + h2;\n", " }\n", " }\n", " else {\n", " top = box.top;\n", " bottom = box.bottom;\n", " }\n", " if (!(left <= right && top <= bottom))\n", " throw new Error(`invalid bbox {left: ${left}, top: ${top}, right: ${right}, bottom: ${bottom}}`);\n", " this.x0 = left;\n", " this.y0 = top;\n", " this.x1 = right;\n", " this.y1 = bottom;\n", " }\n", " }\n", " toString() {\n", " return `BBox({left: ${this.left}, top: ${this.top}, width: ${this.width}, height: ${this.height}})`;\n", " }\n", " get left() { return this.x0; }\n", " get top() { return this.y0; }\n", " get right() { return this.x1; }\n", " get bottom() { return this.y1; }\n", " get p0() { return [this.x0, this.y0]; }\n", " get p1() { return [this.x1, this.y1]; }\n", " get x() { return this.x0; }\n", " get y() { return this.y0; }\n", " get width() { return this.x1 - this.x0; }\n", " get height() { return this.y1 - this.y0; }\n", " get rect() { return { x0: this.x0, y0: this.y0, x1: this.x1, y1: this.y1 }; }\n", " get box() { return { x: this.x, y: this.y, width: this.width, height: this.height }; }\n", " get h_range() { return { start: this.x0, end: this.x1 }; }\n", " get v_range() { return { start: this.y0, end: this.y1 }; }\n", " get ranges() { return [this.h_range, this.v_range]; }\n", " get aspect() { return this.width / this.height; }\n", " get hcenter() { return (this.left + this.right) / 2; }\n", " get vcenter() { return (this.top + this.bottom) / 2; }\n", " contains(x, y) {\n", " return x >= this.x0 && x <= this.x1 && y >= this.y0 && y <= this.y1;\n", " }\n", " clip(x, y) {\n", " if (x < this.x0)\n", " x = this.x0;\n", " else if (x > this.x1)\n", " x = this.x1;\n", " if (y < this.y0)\n", " y = this.y0;\n", " else if (y > this.y1)\n", " y = this.y1;\n", " return [x, y];\n", " }\n", " union(that) {\n", " return new BBox({\n", " x0: min(this.x0, that.x0),\n", " y0: min(this.y0, that.y0),\n", " x1: max(this.x1, that.x1),\n", " y1: max(this.y1, that.y1),\n", " });\n", " }\n", " equals(that) {\n", " return this.x0 == that.x0 && this.y0 == that.y0 && this.x1 == that.x1 && this.y1 == that.y1;\n", " }\n", " get xview() {\n", " return {\n", " compute: (x) => {\n", " return this.left + x;\n", " },\n", " v_compute: (xx) => {\n", " const _xx = new Float64Array(xx.length);\n", " const left = this.left;\n", " for (let i = 0; i < xx.length; i++) {\n", " _xx[i] = left + xx[i];\n", " }\n", " return _xx;\n", " },\n", " };\n", " }\n", " get yview() {\n", " return {\n", " compute: (y) => {\n", " return this.bottom - y;\n", " },\n", " v_compute: (yy) => {\n", " const _yy = new Float64Array(yy.length);\n", " const bottom = this.bottom;\n", " for (let i = 0; i < yy.length; i++) {\n", " _yy[i] = bottom - yy[i];\n", " }\n", " return _yy;\n", " },\n", " };\n", " }\n", " }\n", " exports.BBox = BBox;\n", " BBox.__name__ = \"BBox\";\n", " },\n", " /* models/glyphs/glyph.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const bbox = tslib_1.__importStar(require(88) /* ../../core/util/bbox */);\n", " const proj = tslib_1.__importStar(require(32) /* ../../core/util/projections */);\n", " const visuals = tslib_1.__importStar(require(70) /* ../../core/visuals */);\n", " const view_1 = require(67) /* ../../core/view */;\n", " const model_1 = require(71) /* ../../model */;\n", " const logging_1 = require(72) /* ../../core/logging */;\n", " const arrayable_1 = require(12) /* ../../core/util/arrayable */;\n", " const object_1 = require(17) /* ../../core/util/object */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const line_1 = require(83) /* ./line */;\n", " const factor_range_1 = require(90) /* ../ranges/factor_range */;\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class GlyphView extends view_1.View {\n", " constructor() {\n", " super(...arguments);\n", " this._nohit_warned = new Set();\n", " }\n", " get renderer() {\n", " return this.parent;\n", " }\n", " get has_webgl() {\n", " return this.glglyph != null;\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.visuals = new visuals.Visuals(this.model);\n", " }\n", " async lazy_initialize() {\n", " await super.lazy_initialize();\n", " const { webgl } = this.renderer.plot_view.canvas_view;\n", " if (webgl != null) {\n", " let webgl_module = null;\n", " try {\n", " webgl_module = await Promise.resolve().then(() => tslib_1.__importStar(require(371) /* ./webgl/index */));\n", " }\n", " catch (e) {\n", " // TODO: this exposes the underyling module system\n", " if (e.code === 'MODULE_NOT_FOUND')\n", " logging_1.logger.warn('WebGL was requested and is supported, but bokeh-gl(.min).js is not available, falling back to 2D rendering.');\n", " else\n", " throw e;\n", " }\n", " if (webgl_module != null) {\n", " const Cls = webgl_module[this.model.type + 'GLGlyph'];\n", " if (Cls != null)\n", " this.glglyph = new Cls(webgl.gl, this);\n", " }\n", " }\n", " }\n", " set_visuals(source, indices) {\n", " this.visuals.set_all_indices(indices);\n", " this.visuals.warm_cache(source);\n", " if (this.glglyph != null)\n", " this.glglyph.set_visuals_changed();\n", " }\n", " render(ctx, indices, data) {\n", " ctx.beginPath();\n", " if (this.glglyph != null) {\n", " if (this.glglyph.render(ctx, indices, data))\n", " return;\n", " }\n", " this._render(ctx, indices, data);\n", " }\n", " has_finished() {\n", " return true;\n", " }\n", " notify_finished() {\n", " this.renderer.notify_finished();\n", " }\n", " _bounds(bounds) {\n", " return bounds;\n", " }\n", " bounds() {\n", " return this._bounds(this.index.bbox);\n", " }\n", " log_bounds() {\n", " const bb = bbox.empty();\n", " const positive_x_bbs = this.index.search(bbox.positive_x());\n", " for (const x of positive_x_bbs) {\n", " if (x.x0 < bb.x0)\n", " bb.x0 = x.x0;\n", " if (x.x1 > bb.x1)\n", " bb.x1 = x.x1;\n", " }\n", " const positive_y_bbs = this.index.search(bbox.positive_y());\n", " for (const y of positive_y_bbs) {\n", " if (y.y0 < bb.y0)\n", " bb.y0 = y.y0;\n", " if (y.y1 > bb.y1)\n", " bb.y1 = y.y1;\n", " }\n", " return this._bounds(bb);\n", " }\n", " get_anchor_point(anchor, i, [sx, sy]) {\n", " switch (anchor) {\n", " case \"center\": return { x: this.scenterx(i, sx, sy), y: this.scentery(i, sx, sy) };\n", " default: return null;\n", " }\n", " }\n", " sdist(scale, pts, spans, pts_location = \"edge\", dilate = false) {\n", " let pt0;\n", " let pt1;\n", " const n = pts.length;\n", " if (pts_location == 'center') {\n", " const halfspan = arrayable_1.map(spans, (d) => d / 2);\n", " pt0 = new Float64Array(n);\n", " for (let i = 0; i < n; i++) {\n", " pt0[i] = pts[i] - halfspan[i];\n", " }\n", " pt1 = new Float64Array(n);\n", " for (let i = 0; i < n; i++) {\n", " pt1[i] = pts[i] + halfspan[i];\n", " }\n", " }\n", " else {\n", " pt0 = pts;\n", " pt1 = new Float64Array(n);\n", " for (let i = 0; i < n; i++) {\n", " pt1[i] = pt0[i] + spans[i];\n", " }\n", " }\n", " const spt0 = scale.v_compute(pt0);\n", " const spt1 = scale.v_compute(pt1);\n", " if (dilate)\n", " return arrayable_1.map(spt0, (_, i) => Math.ceil(Math.abs(spt1[i] - spt0[i])));\n", " else\n", " return arrayable_1.map(spt0, (_, i) => Math.abs(spt1[i] - spt0[i]));\n", " }\n", " draw_legend_for_index(_ctx, _bbox, _index) { }\n", " hit_test(geometry) {\n", " switch (geometry.type) {\n", " case \"point\":\n", " if (this._hit_point != null)\n", " return this._hit_point(geometry);\n", " break;\n", " case \"span\":\n", " if (this._hit_span != null)\n", " return this._hit_span(geometry);\n", " break;\n", " case \"rect\":\n", " if (this._hit_rect != null)\n", " return this._hit_rect(geometry);\n", " break;\n", " case \"poly\":\n", " if (this._hit_poly != null)\n", " return this._hit_poly(geometry);\n", " break;\n", " }\n", " if (!this._nohit_warned.has(geometry.type)) {\n", " logging_1.logger.debug(`'${geometry.type}' selection not available for ${this.model.type}`);\n", " this._nohit_warned.add(geometry.type);\n", " }\n", " return null;\n", " }\n", " _hit_rect_against_index(geometry) {\n", " const { sx0, sx1, sy0, sy1 } = geometry;\n", " const [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " const [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " const indices = this.index.indices({ x0, x1, y0, y1 });\n", " return new selection_1.Selection({ indices });\n", " }\n", " set_data(source, indices, indices_to_update) {\n", " let data = this.model.materialize_dataspecs(source);\n", " if (indices && !(this instanceof line_1.LineView)) {\n", " const data_subset = {};\n", " for (const k in data) {\n", " const v = data[k];\n", " if (k.charAt(0) === '_')\n", " data_subset[k] = indices.map((i) => v[i]);\n", " else\n", " data_subset[k] = v;\n", " }\n", " data = data_subset;\n", " }\n", " const self = this;\n", " object_1.extend(self, data);\n", " // TODO (bev) Should really probably delegate computing projected\n", " // coordinates to glyphs, instead of centralizing here in one place.\n", " if (this.renderer.plot_view.model.use_map) {\n", " if (self._x != null)\n", " [self._x, self._y] = proj.project_xy(self._x, self._y);\n", " if (self._xs != null)\n", " [self._xs, self._ys] = proj.project_xsys(self._xs, self._ys);\n", " if (self._x0 != null)\n", " [self._x0, self._y0] = proj.project_xy(self._x0, self._y0);\n", " if (self._x1 != null)\n", " [self._x1, self._y1] = proj.project_xy(self._x1, self._y1);\n", " }\n", " // if we have any coordinates that are categorical, convert them to\n", " // synthetic coords here\n", " if (this.renderer.plot_view.frame.x_ranges != null) { // XXXX JUST TEMP FOR TESTS TO PASS\n", " const xr = this.renderer.plot_view.frame.x_ranges[this.model.x_range_name];\n", " const yr = this.renderer.plot_view.frame.y_ranges[this.model.y_range_name];\n", " for (let [xname, yname] of this.model._coords) {\n", " xname = `_${xname}`;\n", " yname = `_${yname}`;\n", " // TODO (bev) more robust detection of multi-glyph case\n", " // hand multi glyph case\n", " if (self._xs != null) {\n", " if (xr instanceof factor_range_1.FactorRange) {\n", " self[xname] = arrayable_1.map(self[xname], (arr) => xr.v_synthetic(arr));\n", " }\n", " if (yr instanceof factor_range_1.FactorRange) {\n", " self[yname] = arrayable_1.map(self[yname], (arr) => yr.v_synthetic(arr));\n", " }\n", " }\n", " else {\n", " // hand standard glyph case\n", " if (xr instanceof factor_range_1.FactorRange) {\n", " self[xname] = xr.v_synthetic(self[xname]);\n", " }\n", " if (yr instanceof factor_range_1.FactorRange) {\n", " self[yname] = yr.v_synthetic(self[yname]);\n", " }\n", " }\n", " }\n", " }\n", " if (this.glglyph != null)\n", " this.glglyph.set_data_changed(self._x.length);\n", " this._set_data(indices_to_update); //TODO doesn't take subset indices into account\n", " this.index_data();\n", " }\n", " _set_data(_indices) { }\n", " index_data() {\n", " this.index = this._index_data();\n", " }\n", " mask_data(indices) {\n", " // WebGL can do the clipping much more efficiently\n", " if (this.glglyph != null || this._mask_data == null)\n", " return indices;\n", " else\n", " return this._mask_data();\n", " }\n", " map_data() {\n", " // TODO: if using gl, skip this (when is this called?)\n", " // map all the coordinate fields\n", " const self = this;\n", " for (let [xname, yname] of this.model._coords) {\n", " const sxname = `s${xname}`;\n", " const syname = `s${yname}`;\n", " xname = `_${xname}`;\n", " yname = `_${yname}`;\n", " if (self[xname] != null && (types_1.isArray(self[xname][0]) || types_1.isTypedArray(self[xname][0]))) {\n", " const n = self[xname].length;\n", " self[sxname] = new Array(n);\n", " self[syname] = new Array(n);\n", " for (let i = 0; i < n; i++) {\n", " const [sx, sy] = this.map_to_screen(self[xname][i], self[yname][i]);\n", " self[sxname][i] = sx;\n", " self[syname][i] = sy;\n", " }\n", " }\n", " else\n", " [self[sxname], self[syname]] = this.map_to_screen(self[xname], self[yname]);\n", " }\n", " this._map_data();\n", " }\n", " // This is where specs not included in coords are computed, e.g. radius.\n", " _map_data() { }\n", " map_to_screen(x, y) {\n", " return this.renderer.plot_view.map_to_screen(x, y, this.model.x_range_name, this.model.y_range_name);\n", " }\n", " }\n", " exports.GlyphView = GlyphView;\n", " GlyphView.__name__ = \"GlyphView\";\n", " class Glyph extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Glyph() {\n", " this.prototype._coords = [];\n", " this.internal({\n", " x_range_name: [p.String, 'default'],\n", " y_range_name: [p.String, 'default'],\n", " });\n", " }\n", " static coords(coords) {\n", " const _coords = this.prototype._coords.concat(coords);\n", " this.prototype._coords = _coords;\n", " const result = {};\n", " for (const [x, y] of coords) {\n", " result[x] = [p.CoordinateSpec];\n", " result[y] = [p.CoordinateSpec];\n", " }\n", " this.define(result);\n", " }\n", " }\n", " exports.Glyph = Glyph;\n", " Glyph.__name__ = \"Glyph\";\n", " Glyph.init_Glyph();\n", " },\n", " /* models/ranges/factor_range.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const range_1 = require(91) /* ./range */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const arrayable_1 = require(12) /* ../../core/util/arrayable */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const assert_1 = require(11) /* ../../core/util/assert */;\n", " function map_one_level(factors, padding, offset = 0) {\n", " const mapping = new Map();\n", " for (let i = 0; i < factors.length; i++) {\n", " const factor = factors[i];\n", " if (!mapping.has(factor))\n", " mapping.set(factor, { value: 0.5 + i * (1 + padding) + offset });\n", " else\n", " throw new Error(`duplicate factor or subfactor: ${factor}`);\n", " }\n", " return [mapping, (factors.length - 1) * padding];\n", " }\n", " exports.map_one_level = map_one_level;\n", " function map_two_levels(factors, outer_pad, factor_pad, offset = 0) {\n", " var _a;\n", " const mapping = new Map();\n", " const tops = new Map();\n", " for (const [f0, f1] of factors) {\n", " const top = (_a = tops.get(f0)) !== null && _a !== void 0 ? _a : [];\n", " tops.set(f0, [...top, f1]);\n", " }\n", " let suboffset = offset;\n", " let total_subpad = 0;\n", " for (const [f0, top] of tops) {\n", " const n = top.length;\n", " const [submap, subpad] = map_one_level(top, factor_pad, suboffset);\n", " total_subpad += subpad;\n", " const subtot = array_1.sum(top.map((f1) => submap.get(f1).value));\n", " mapping.set(f0, { value: subtot / n, mapping: submap });\n", " suboffset += n + outer_pad + subpad;\n", " }\n", " return [mapping, (tops.size - 1) * outer_pad + total_subpad];\n", " }\n", " exports.map_two_levels = map_two_levels;\n", " function map_three_levels(factors, outer_pad, inner_pad, factor_pad, offset = 0) {\n", " var _a;\n", " const mapping = new Map();\n", " const tops = new Map();\n", " for (const [f0, f1, f2] of factors) {\n", " const top = (_a = tops.get(f0)) !== null && _a !== void 0 ? _a : [];\n", " tops.set(f0, [...top, [f1, f2]]);\n", " }\n", " let suboffset = offset;\n", " let total_subpad = 0;\n", " for (const [f0, top] of tops) {\n", " const n = top.length;\n", " const [submap, subpad] = map_two_levels(top, inner_pad, factor_pad, suboffset);\n", " total_subpad += subpad;\n", " const subtot = array_1.sum(top.map(([f1]) => submap.get(f1).value));\n", " mapping.set(f0, { value: subtot / n, mapping: submap });\n", " suboffset += n + outer_pad + subpad;\n", " }\n", " return [mapping, (tops.size - 1) * outer_pad + total_subpad];\n", " }\n", " exports.map_three_levels = map_three_levels;\n", " class FactorRange extends range_1.Range {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_FactorRange() {\n", " this.define({\n", " factors: [p.Array, []],\n", " factor_padding: [p.Number, 0],\n", " subgroup_padding: [p.Number, 0.8],\n", " group_padding: [p.Number, 1.4],\n", " range_padding: [p.Number, 0],\n", " range_padding_units: [p.PaddingUnits, \"percent\"],\n", " start: [p.Number],\n", " end: [p.Number],\n", " });\n", " this.internal({\n", " levels: [p.Number],\n", " mids: [p.Array, null],\n", " tops: [p.Array, null],\n", " });\n", " }\n", " get min() {\n", " return this.start;\n", " }\n", " get max() {\n", " return this.end;\n", " }\n", " initialize() {\n", " super.initialize();\n", " this._init(true);\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.properties.factors.change, () => this.reset());\n", " this.connect(this.properties.factor_padding.change, () => this.reset());\n", " this.connect(this.properties.group_padding.change, () => this.reset());\n", " this.connect(this.properties.subgroup_padding.change, () => this.reset());\n", " this.connect(this.properties.range_padding.change, () => this.reset());\n", " this.connect(this.properties.range_padding_units.change, () => this.reset());\n", " }\n", " reset() {\n", " this._init(false);\n", " this.change.emit();\n", " }\n", " _lookup(x) {\n", " switch (x.length) {\n", " case 1: {\n", " const [f0] = x;\n", " const mapping = this._mapping;\n", " const y0 = mapping.get(f0);\n", " return y0 != null ? y0.value : NaN;\n", " }\n", " case 2: {\n", " const [f0, f1] = x;\n", " const mapping = this._mapping;\n", " const y0 = mapping.get(f0);\n", " if (y0 != null) {\n", " const y1 = y0.mapping.get(f1);\n", " if (y1 != null)\n", " return y1.value;\n", " }\n", " return NaN;\n", " }\n", " case 3: {\n", " const [f0, f1, f2] = x;\n", " const mapping = this._mapping;\n", " const y0 = mapping.get(f0);\n", " if (y0 != null) {\n", " const y1 = y0.mapping.get(f1);\n", " if (y1 != null) {\n", " const y2 = y1.mapping.get(f2);\n", " if (y2 != null)\n", " return y2.value;\n", " }\n", " }\n", " return NaN;\n", " }\n", " default:\n", " assert_1.unreachable();\n", " }\n", " }\n", " // convert a string factor into a synthetic coordinate\n", " synthetic(x) {\n", " if (types_1.isNumber(x))\n", " return x;\n", " if (types_1.isString(x))\n", " return this._lookup([x]);\n", " let offset = 0;\n", " const off = x[x.length - 1];\n", " if (types_1.isNumber(off)) {\n", " offset = off;\n", " x = x.slice(0, -1);\n", " }\n", " return this._lookup(x) + offset;\n", " }\n", " // convert an array of string factors into synthetic coordinates\n", " v_synthetic(xs) {\n", " return arrayable_1.map(xs, (x) => this.synthetic(x));\n", " }\n", " _init(silent) {\n", " const { levels, mapping, tops, mids, inside_padding } = (() => {\n", " if (array_1.every(this.factors, types_1.isString)) {\n", " const factors = this.factors;\n", " const [mapping, inside_padding] = map_one_level(factors, this.factor_padding);\n", " const tops = null;\n", " const mids = null;\n", " return { levels: 1, mapping, tops, mids, inside_padding };\n", " }\n", " else if (array_1.every(this.factors, (x) => types_1.isArray(x) && x.length == 2 && types_1.isString(x[0]) && types_1.isString(x[1]))) {\n", " const factors = this.factors;\n", " const [mapping, inside_padding] = map_two_levels(factors, this.group_padding, this.factor_padding);\n", " const tops = [...mapping.keys()];\n", " const mids = null;\n", " return { levels: 2, mapping, tops, mids, inside_padding };\n", " }\n", " else if (array_1.every(this.factors, (x) => types_1.isArray(x) && x.length == 3 && types_1.isString(x[0]) && types_1.isString(x[1]) && types_1.isString(x[2]))) {\n", " const factors = this.factors;\n", " const [mapping, inside_padding] = map_three_levels(factors, this.group_padding, this.subgroup_padding, this.factor_padding);\n", " const tops = [...mapping.keys()];\n", " const mids = [];\n", " for (const [f0, L2] of mapping) {\n", " for (const f1 of L2.mapping.keys()) {\n", " mids.push([f0, f1]);\n", " }\n", " }\n", " return { levels: 3, mapping, tops, mids, inside_padding };\n", " }\n", " else\n", " assert_1.unreachable();\n", " })();\n", " this._mapping = mapping;\n", " this.tops = tops;\n", " this.mids = mids;\n", " let start = 0;\n", " let end = this.factors.length + inside_padding;\n", " if (this.range_padding_units == \"percent\") {\n", " const half_span = (end - start) * this.range_padding / 2;\n", " start -= half_span;\n", " end += half_span;\n", " }\n", " else {\n", " start -= this.range_padding;\n", " end += this.range_padding;\n", " }\n", " this.setv({ start, end, levels }, { silent });\n", " if (this.bounds == \"auto\")\n", " this.setv({ bounds: [start, end] }, { silent: true });\n", " }\n", " }\n", " exports.FactorRange = FactorRange;\n", " FactorRange.__name__ = \"FactorRange\";\n", " FactorRange.init_FactorRange();\n", " },\n", " /* models/ranges/range.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const model_1 = require(71) /* ../../model */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class Range extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.have_updated_interactively = false;\n", " }\n", " static init_Range() {\n", " this.define({\n", " bounds: [p.Any],\n", " min_interval: [p.Any],\n", " max_interval: [p.Any],\n", " });\n", " this.internal({\n", " plots: [p.Array, []],\n", " });\n", " }\n", " get is_reversed() {\n", " return this.start > this.end;\n", " }\n", " }\n", " exports.Range = Range;\n", " Range.__name__ = \"Range\";\n", " Range.init_Range();\n", " },\n", " /* models/glyphs/utils.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const hittest = tslib_1.__importStar(require(93) /* ../../core/hittest */);\n", " function generic_line_legend(visuals, ctx, { x0, x1, y0, y1 }, index) {\n", " ctx.save();\n", " ctx.beginPath();\n", " ctx.moveTo(x0, (y0 + y1) / 2);\n", " ctx.lineTo(x1, (y0 + y1) / 2);\n", " if (visuals.line.doit) {\n", " visuals.line.set_vectorize(ctx, index);\n", " ctx.stroke();\n", " }\n", " ctx.restore();\n", " }\n", " exports.generic_line_legend = generic_line_legend;\n", " function generic_area_legend(visuals, ctx, { x0, x1, y0, y1 }, index) {\n", " const w = Math.abs(x1 - x0);\n", " const dw = w * 0.1;\n", " const h = Math.abs(y1 - y0);\n", " const dh = h * 0.1;\n", " const sx0 = x0 + dw;\n", " const sx1 = x1 - dw;\n", " const sy0 = y0 + dh;\n", " const sy1 = y1 - dh;\n", " if (visuals.fill.doit) {\n", " visuals.fill.set_vectorize(ctx, index);\n", " ctx.fillRect(sx0, sy0, sx1 - sx0, sy1 - sy0);\n", " }\n", " if (visuals.hatch != null && visuals.hatch.doit) {\n", " visuals.hatch.set_vectorize(ctx, index);\n", " ctx.fillRect(sx0, sy0, sx1 - sx0, sy1 - sy0);\n", " }\n", " if (visuals.line && visuals.line.doit) {\n", " ctx.beginPath();\n", " ctx.rect(sx0, sy0, sx1 - sx0, sy1 - sy0);\n", " visuals.line.set_vectorize(ctx, index);\n", " ctx.stroke();\n", " }\n", " }\n", " exports.generic_area_legend = generic_area_legend;\n", " function line_interpolation(renderer, geometry, x2, y2, x3, y3) {\n", " const { sx, sy } = geometry;\n", " let x0, x1;\n", " let y0, y1;\n", " if (geometry.type == 'point') {\n", " // The +/- adjustments here are to dilate the hit point into a virtual \"segment\" to use below\n", " [y0, y1] = renderer.yscale.r_invert(sy - 1, sy + 1);\n", " [x0, x1] = renderer.xscale.r_invert(sx - 1, sx + 1);\n", " }\n", " else {\n", " // The +/- adjustments here are to handle cases such as purely horizontal or vertical lines\n", " if (geometry.direction == 'v') {\n", " [y0, y1] = renderer.yscale.r_invert(sy, sy);\n", " [x0, x1] = [Math.min(x2 - 1, x3 - 1), Math.max(x2 + 1, x3 + 1)];\n", " }\n", " else {\n", " [x0, x1] = renderer.xscale.r_invert(sx, sx);\n", " [y0, y1] = [Math.min(y2 - 1, y3 - 1), Math.max(y2 + 1, y3 + 1)];\n", " }\n", " }\n", " const { x, y } = hittest.check_2_segments_intersect(x0, y0, x1, y1, x2, y2, x3, y3);\n", " return [x, y]; // XXX: null is not handled at use sites\n", " }\n", " exports.line_interpolation = line_interpolation;\n", " },\n", " /* core/hittest.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " function point_in_poly(x, y, px, py) {\n", " let inside = false;\n", " let x1 = px[px.length - 1];\n", " let y1 = py[py.length - 1];\n", " for (let i = 0; i < px.length; i++) {\n", " const x2 = px[i];\n", " const y2 = py[i];\n", " if ((y1 < y) != (y2 < y)) {\n", " if ((x1 + (y - y1) / (y2 - y1) * (x2 - x1)) < x)\n", " inside = !inside;\n", " }\n", " x1 = x2;\n", " y1 = y2;\n", " }\n", " return inside;\n", " }\n", " exports.point_in_poly = point_in_poly;\n", " function point_in_ellipse(x, y, angle, b, a, x0, y0) {\n", " const A = ((Math.cos(angle) / a) ** 2 + (Math.sin(angle) / b) ** 2);\n", " const B = 2 * Math.cos(angle) * Math.sin(angle) * ((1 / a) ** 2 - (1 / b) ** 2);\n", " const C = ((Math.cos(angle) / b) ** 2 + (Math.sin(angle) / a) ** 2);\n", " const eqn = A * (x - x0) ** 2 + B * (x - x0) * (y - y0) + C * (y - y0) ** 2;\n", " const inside = eqn <= 1;\n", " return inside;\n", " }\n", " exports.point_in_ellipse = point_in_ellipse;\n", " function sqr(x) {\n", " return x * x;\n", " }\n", " function dist_2_pts(p0, p1) {\n", " return sqr(p0.x - p1.x) + sqr(p0.y - p1.y);\n", " }\n", " exports.dist_2_pts = dist_2_pts;\n", " function dist_to_segment_squared(p, v, w) {\n", " const l2 = dist_2_pts(v, w);\n", " if (l2 == 0)\n", " return dist_2_pts(p, v);\n", " const t = ((p.x - v.x) * (w.x - v.x) + (p.y - v.y) * (w.y - v.y)) / l2;\n", " if (t < 0)\n", " return dist_2_pts(p, v);\n", " if (t > 1)\n", " return dist_2_pts(p, w);\n", " const q = { x: v.x + t * (w.x - v.x), y: v.y + t * (w.y - v.y) };\n", " return dist_2_pts(p, q);\n", " }\n", " exports.dist_to_segment_squared = dist_to_segment_squared;\n", " function dist_to_segment(p, v, w) {\n", " return Math.sqrt(dist_to_segment_squared(p, v, w));\n", " }\n", " exports.dist_to_segment = dist_to_segment;\n", " function check_2_segments_intersect(l0_x0, l0_y0, l0_x1, l0_y1, l1_x0, l1_y0, l1_x1, l1_y1) {\n", " /*\n", " * Check if 2 segments (l0 and l1) intersect. Returns a structure with\n", " * the following attributes:\n", " * * hit (boolean): whether the 2 segments intersect\n", " * * x (float): x coordinate of the intersection point\n", " * * y (float): y coordinate of the intersection point\n", " */\n", " const den = ((l1_y1 - l1_y0) * (l0_x1 - l0_x0)) - ((l1_x1 - l1_x0) * (l0_y1 - l0_y0));\n", " if (den == 0) {\n", " return { hit: false, x: null, y: null };\n", " }\n", " else {\n", " let a = l0_y0 - l1_y0;\n", " let b = l0_x0 - l1_x0;\n", " const num1 = ((l1_x1 - l1_x0) * a) - ((l1_y1 - l1_y0) * b);\n", " const num2 = ((l0_x1 - l0_x0) * a) - ((l0_y1 - l0_y0) * b);\n", " a = num1 / den;\n", " b = num2 / den;\n", " const x = l0_x0 + (a * (l0_x1 - l0_x0));\n", " const y = l0_y0 + (a * (l0_y1 - l0_y0));\n", " return { hit: (a > 0 && a < 1) && (b > 0 && b < 1), x, y };\n", " }\n", " }\n", " exports.check_2_segments_intersect = check_2_segments_intersect;\n", " },\n", " /* models/glyphs/patch.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const xy_glyph_1 = require(84) /* ./xy_glyph */;\n", " const utils_1 = require(92) /* ./utils */;\n", " const hittest = tslib_1.__importStar(require(93) /* ../../core/hittest */);\n", " const mixins = tslib_1.__importStar(require(23) /* ../../core/property_mixins */);\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class PatchView extends xy_glyph_1.XYGlyphView {\n", " _inner_loop(ctx, indices, sx, sy, func) {\n", " for (const i of indices) {\n", " if (i == 0) {\n", " ctx.beginPath();\n", " ctx.moveTo(sx[i], sy[i]);\n", " continue;\n", " }\n", " else if (isNaN(sx[i] + sy[i])) {\n", " ctx.closePath();\n", " func.apply(ctx);\n", " ctx.beginPath();\n", " continue;\n", " }\n", " else\n", " ctx.lineTo(sx[i], sy[i]);\n", " }\n", " ctx.closePath();\n", " func.call(ctx);\n", " }\n", " _render(ctx, indices, { sx, sy }) {\n", " if (this.visuals.fill.doit) {\n", " this.visuals.fill.set_value(ctx);\n", " this._inner_loop(ctx, indices, sx, sy, ctx.fill);\n", " }\n", " this.visuals.hatch.doit2(ctx, 0, () => this._inner_loop(ctx, indices, sx, sy, ctx.fill), () => this.renderer.request_render());\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_value(ctx);\n", " this._inner_loop(ctx, indices, sx, sy, ctx.stroke);\n", " }\n", " }\n", " draw_legend_for_index(ctx, bbox, index) {\n", " utils_1.generic_area_legend(this.visuals, ctx, bbox, index);\n", " }\n", " _hit_point(geometry) {\n", " const result = new selection_1.Selection();\n", " if (hittest.point_in_poly(geometry.sx, geometry.sy, this.sx, this.sy)) {\n", " result.add_to_selected_glyphs(this.model);\n", " result.get_view = () => this;\n", " }\n", " return result;\n", " }\n", " }\n", " exports.PatchView = PatchView;\n", " PatchView.__name__ = \"PatchView\";\n", " class Patch extends xy_glyph_1.XYGlyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Patch() {\n", " this.prototype.default_view = PatchView;\n", " this.mixins([mixins.Line /*Scalar*/, mixins.Fill /*Scalar*/, mixins.Hatch /*Scalar*/]);\n", " }\n", " }\n", " exports.Patch = Patch;\n", " Patch.__name__ = \"Patch\";\n", " Patch.init_Patch();\n", " },\n", " /* models/glyphs/harea.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const area_1 = require(96) /* ./area */;\n", " const spatial_1 = require(85) /* ../../core/util/spatial */;\n", " const hittest = tslib_1.__importStar(require(93) /* ../../core/hittest */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class HAreaView extends area_1.AreaView {\n", " _index_data() {\n", " const points = [];\n", " for (let i = 0, end = this._x1.length; i < end; i++) {\n", " const x1 = this._x1[i];\n", " const x2 = this._x2[i];\n", " const y = this._y[i];\n", " if (isNaN(x1 + x2 + y) || !isFinite(x1 + x2 + y))\n", " continue;\n", " points.push({ x0: Math.min(x1, x2), y0: y, x1: Math.max(x1, x2), y1: y, i });\n", " }\n", " return new spatial_1.SpatialIndex(points);\n", " }\n", " _inner(ctx, sx1, sx2, sy, func) {\n", " ctx.beginPath();\n", " for (let i = 0, end = sx1.length; i < end; i++) {\n", " ctx.lineTo(sx1[i], sy[i]);\n", " }\n", " // iterate backwards so that the upper end is below the lower start\n", " for (let i = sx2.length - 1; i >= 0; i--) {\n", " ctx.lineTo(sx2[i], sy[i]);\n", " }\n", " ctx.closePath();\n", " func.call(ctx);\n", " }\n", " _render(ctx, _indices, { sx1, sx2, sy }) {\n", " if (this.visuals.fill.doit) {\n", " this.visuals.fill.set_value(ctx);\n", " this._inner(ctx, sx1, sx2, sy, ctx.fill);\n", " }\n", " this.visuals.hatch.doit2(ctx, 0, () => this._inner(ctx, sx1, sx2, sy, ctx.fill), () => this.renderer.request_render());\n", " }\n", " _hit_point(geometry) {\n", " const L = this.sy.length;\n", " const sx = new Float64Array(2 * L);\n", " const sy = new Float64Array(2 * L);\n", " for (let i = 0, end = L; i < end; i++) {\n", " sx[i] = this.sx1[i];\n", " sy[i] = this.sy[i];\n", " sx[L + i] = this.sx2[L - i - 1];\n", " sy[L + i] = this.sy[L - i - 1];\n", " }\n", " const result = new selection_1.Selection();\n", " if (hittest.point_in_poly(geometry.sx, geometry.sy, sx, sy)) {\n", " result.add_to_selected_glyphs(this.model);\n", " result.get_view = () => this;\n", " }\n", " return result;\n", " }\n", " scenterx(i) {\n", " return (this.sx1[i] + this.sx2[i]) / 2;\n", " }\n", " scentery(i) {\n", " return this.sy[i];\n", " }\n", " _map_data() {\n", " this.sx1 = this.renderer.xscale.v_compute(this._x1);\n", " this.sx2 = this.renderer.xscale.v_compute(this._x2);\n", " this.sy = this.renderer.yscale.v_compute(this._y);\n", " }\n", " }\n", " exports.HAreaView = HAreaView;\n", " HAreaView.__name__ = \"HAreaView\";\n", " class HArea extends area_1.Area {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_HArea() {\n", " this.prototype.default_view = HAreaView;\n", " this.define({\n", " x1: [p.CoordinateSpec],\n", " x2: [p.CoordinateSpec],\n", " y: [p.CoordinateSpec],\n", " });\n", " }\n", " }\n", " exports.HArea = HArea;\n", " HArea.__name__ = \"HArea\";\n", " HArea.init_HArea();\n", " },\n", " /* models/glyphs/area.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const glyph_1 = require(89) /* ./glyph */;\n", " const utils_1 = require(92) /* ./utils */;\n", " const mixins = tslib_1.__importStar(require(23) /* ../../core/property_mixins */);\n", " class AreaView extends glyph_1.GlyphView {\n", " draw_legend_for_index(ctx, bbox, index) {\n", " utils_1.generic_area_legend(this.visuals, ctx, bbox, index);\n", " }\n", " }\n", " exports.AreaView = AreaView;\n", " AreaView.__name__ = \"AreaView\";\n", " class Area extends glyph_1.Glyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Area() {\n", " this.mixins([mixins.Fill /*Scalar*/, mixins.HatchVector]);\n", " }\n", " }\n", " exports.Area = Area;\n", " Area.__name__ = \"Area\";\n", " Area.init_Area();\n", " },\n", " /* models/glyphs/varea.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const area_1 = require(96) /* ./area */;\n", " const spatial_1 = require(85) /* ../../core/util/spatial */;\n", " const hittest = tslib_1.__importStar(require(93) /* ../../core/hittest */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class VAreaView extends area_1.AreaView {\n", " _index_data() {\n", " const points = [];\n", " for (let i = 0, end = this._x.length; i < end; i++) {\n", " const x = this._x[i];\n", " const y1 = this._y1[i];\n", " const y2 = this._y2[i];\n", " if (isNaN(x + y1 + y2) || !isFinite(x + y1 + y2))\n", " continue;\n", " points.push({ x0: x, y0: Math.min(y1, y2), x1: x, y1: Math.max(y1, y2), i });\n", " }\n", " return new spatial_1.SpatialIndex(points);\n", " }\n", " _inner(ctx, sx, sy1, sy2, func) {\n", " ctx.beginPath();\n", " for (let i = 0, end = sy1.length; i < end; i++) {\n", " ctx.lineTo(sx[i], sy1[i]);\n", " }\n", " // iterate backwards so that the upper end is below the lower start\n", " for (let i = sy2.length - 1; i >= 0; i--) {\n", " ctx.lineTo(sx[i], sy2[i]);\n", " }\n", " ctx.closePath();\n", " func.call(ctx);\n", " }\n", " _render(ctx, _indices, { sx, sy1, sy2 }) {\n", " if (this.visuals.fill.doit) {\n", " this.visuals.fill.set_value(ctx);\n", " this._inner(ctx, sx, sy1, sy2, ctx.fill);\n", " }\n", " this.visuals.hatch.doit2(ctx, 0, () => this._inner(ctx, sx, sy1, sy2, ctx.fill), () => this.renderer.request_render());\n", " }\n", " scenterx(i) {\n", " return this.sx[i];\n", " }\n", " scentery(i) {\n", " return (this.sy1[i] + this.sy2[i]) / 2;\n", " }\n", " _hit_point(geometry) {\n", " const L = this.sx.length;\n", " const sx = new Float64Array(2 * L);\n", " const sy = new Float64Array(2 * L);\n", " for (let i = 0, end = L; i < end; i++) {\n", " sx[i] = this.sx[i];\n", " sy[i] = this.sy1[i];\n", " sx[L + i] = this.sx[L - i - 1];\n", " sy[L + i] = this.sy2[L - i - 1];\n", " }\n", " const result = new selection_1.Selection();\n", " if (hittest.point_in_poly(geometry.sx, geometry.sy, sx, sy)) {\n", " result.add_to_selected_glyphs(this.model);\n", " result.get_view = () => this;\n", " }\n", " return result;\n", " }\n", " _map_data() {\n", " this.sx = this.renderer.xscale.v_compute(this._x);\n", " this.sy1 = this.renderer.yscale.v_compute(this._y1);\n", " this.sy2 = this.renderer.yscale.v_compute(this._y2);\n", " }\n", " }\n", " exports.VAreaView = VAreaView;\n", " VAreaView.__name__ = \"VAreaView\";\n", " class VArea extends area_1.Area {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_VArea() {\n", " this.prototype.default_view = VAreaView;\n", " this.define({\n", " x: [p.CoordinateSpec],\n", " y1: [p.CoordinateSpec],\n", " y2: [p.CoordinateSpec],\n", " });\n", " }\n", " }\n", " exports.VArea = VArea;\n", " VArea.__name__ = \"VArea\";\n", " VArea.init_VArea();\n", " },\n", " /* models/sources/cds_view.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const model_1 = require(71) /* ../../model */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const columnar_data_source_1 = require(77) /* ./columnar_data_source */;\n", " class CDSView extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_CDSView() {\n", " this.define({\n", " filters: [p.Array, []],\n", " source: [p.Instance],\n", " });\n", " this.internal({\n", " indices: [p.Array, []],\n", " indices_map: [p.Any, {}],\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.compute_indices();\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.properties.filters.change, () => {\n", " this.compute_indices();\n", " this.change.emit();\n", " });\n", " const connect_listeners = () => {\n", " const fn = () => this.compute_indices();\n", " if (this.source != null) {\n", " this.connect(this.source.change, fn);\n", " if (this.source instanceof columnar_data_source_1.ColumnarDataSource) {\n", " this.connect(this.source.streaming, fn);\n", " this.connect(this.source.patching, fn);\n", " }\n", " }\n", " };\n", " let initialized = this.source != null;\n", " if (initialized)\n", " connect_listeners();\n", " else {\n", " this.connect(this.properties.source.change, () => {\n", " if (!initialized) {\n", " connect_listeners();\n", " initialized = true;\n", " }\n", " });\n", " }\n", " }\n", " compute_indices() {\n", " const indices = this.filters\n", " .map((filter) => filter.compute_indices(this.source))\n", " .filter((indices) => indices != null);\n", " if (indices.length > 0)\n", " this.indices = array_1.intersection.apply(this, indices);\n", " else if (this.source instanceof columnar_data_source_1.ColumnarDataSource)\n", " this.indices = this.source.get_indices();\n", " this.indices_map_to_subset();\n", " }\n", " indices_map_to_subset() {\n", " this.indices_map = {};\n", " for (let i = 0; i < this.indices.length; i++) {\n", " this.indices_map[this.indices[i]] = i;\n", " }\n", " }\n", " convert_selection_from_subset(selection_subset) {\n", " const selection_full = new selection_1.Selection();\n", " selection_full.update_through_union(selection_subset);\n", " const indices_1d = selection_subset.indices.map((i) => this.indices[i]);\n", " selection_full.indices = indices_1d;\n", " selection_full.image_indices = selection_subset.image_indices;\n", " return selection_full;\n", " }\n", " convert_selection_to_subset(selection_full) {\n", " const selection_subset = new selection_1.Selection();\n", " selection_subset.update_through_union(selection_full);\n", " const indices_1d = selection_full.indices.map((i) => this.indices_map[i]);\n", " selection_subset.indices = indices_1d;\n", " selection_subset.image_indices = selection_full.image_indices;\n", " return selection_subset;\n", " }\n", " convert_indices_from_subset(indices) {\n", " return indices.map((i) => this.indices[i]);\n", " }\n", " }\n", " exports.CDSView = CDSView;\n", " CDSView.__name__ = \"CDSView\";\n", " CDSView.init_CDSView();\n", " },\n", " /* core/build_views.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const array_1 = require(9) /* ./util/array */;\n", " async function _build_view(view_cls, model, options) {\n", " const view = new view_cls(Object.assign(Object.assign({}, options), { model }));\n", " view.initialize();\n", " await view.lazy_initialize();\n", " return view;\n", " }\n", " async function build_view(model, options = { parent: null }, cls = (model) => model.default_view) {\n", " const view = await _build_view(cls(model), model, options);\n", " view.connect_signals();\n", " return view;\n", " }\n", " exports.build_view = build_view;\n", " async function build_views(view_storage, models, options = { parent: null }, cls = (model) => model.default_view) {\n", " const to_remove = array_1.difference([...view_storage.keys()], models);\n", " for (const model of to_remove) {\n", " view_storage.get(model).remove();\n", " view_storage.delete(model);\n", " }\n", " const created_views = [];\n", " const new_models = models.filter((model) => !view_storage.has(model));\n", " for (const model of new_models) {\n", " const view = await _build_view(cls(model), model, options);\n", " view_storage.set(model, view);\n", " created_views.push(view);\n", " }\n", " for (const view of created_views)\n", " view.connect_signals();\n", " return created_views;\n", " }\n", " exports.build_views = build_views;\n", " function remove_views(view_storage) {\n", " for (const [model, view] of view_storage) {\n", " view.remove();\n", " view_storage.delete(model);\n", " }\n", " }\n", " exports.remove_views = remove_views;\n", " },\n", " /* models/renderers/graph_renderer.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const data_renderer_1 = require(82) /* ./data_renderer */;\n", " const graph_hit_test_policy_1 = require(101) /* ../graphs/graph_hit_test_policy */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const build_views_1 = require(99) /* ../../core/build_views */;\n", " class GraphRendererView extends data_renderer_1.DataRendererView {\n", " initialize() {\n", " super.initialize();\n", " this.xscale = this.plot_view.frame.xscales.default;\n", " this.yscale = this.plot_view.frame.yscales.default;\n", " this._renderer_views = new Map();\n", " }\n", " async lazy_initialize() {\n", " [this.node_view, this.edge_view] = await build_views_1.build_views(this._renderer_views, [\n", " this.model.node_renderer,\n", " this.model.edge_renderer,\n", " ], { parent: this.parent });\n", " this.set_data();\n", " }\n", " remove() {\n", " build_views_1.remove_views(this._renderer_views);\n", " super.remove();\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.layout_provider.change, () => this.set_data());\n", " this.connect(this.model.node_renderer.data_source._select, () => this.set_data());\n", " this.connect(this.model.node_renderer.data_source.inspect, () => this.set_data());\n", " this.connect(this.model.node_renderer.data_source.change, () => this.set_data());\n", " this.connect(this.model.edge_renderer.data_source._select, () => this.set_data());\n", " this.connect(this.model.edge_renderer.data_source.inspect, () => this.set_data());\n", " this.connect(this.model.edge_renderer.data_source.change, () => this.set_data());\n", " const { x_ranges, y_ranges } = this.plot_view.frame;\n", " for (const name in x_ranges) {\n", " const rng = x_ranges[name];\n", " this.connect(rng.change, () => this.set_data());\n", " }\n", " for (const name in y_ranges) {\n", " const rng = y_ranges[name];\n", " this.connect(rng.change, () => this.set_data());\n", " }\n", " }\n", " set_data(request_render = true) {\n", " // TODO (bev) this is a bit clunky, need to make sure glyphs use the correct ranges when they call\n", " // mapping functions on the base Renderer class\n", " this.node_view.glyph.model.setv({ x_range_name: this.model.x_range_name, y_range_name: this.model.y_range_name }, { silent: true });\n", " this.edge_view.glyph.model.setv({ x_range_name: this.model.x_range_name, y_range_name: this.model.y_range_name }, { silent: true });\n", " // XXX\n", " const node_glyph = this.node_view.glyph;\n", " [node_glyph._x, node_glyph._y] =\n", " this.model.layout_provider.get_node_coordinates(this.model.node_renderer.data_source);\n", " const edge_glyph = this.edge_view.glyph;\n", " [edge_glyph._xs, edge_glyph._ys] =\n", " this.model.layout_provider.get_edge_coordinates(this.model.edge_renderer.data_source);\n", " node_glyph.index_data();\n", " edge_glyph.index_data();\n", " if (request_render)\n", " this.request_render();\n", " }\n", " render() {\n", " this.edge_view.render();\n", " this.node_view.render();\n", " }\n", " }\n", " exports.GraphRendererView = GraphRendererView;\n", " GraphRendererView.__name__ = \"GraphRendererView\";\n", " class GraphRenderer extends data_renderer_1.DataRenderer {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_GraphRenderer() {\n", " this.prototype.default_view = GraphRendererView;\n", " this.define({\n", " layout_provider: [p.Instance],\n", " node_renderer: [p.Instance],\n", " edge_renderer: [p.Instance],\n", " selection_policy: [p.Instance, () => new graph_hit_test_policy_1.NodesOnly()],\n", " inspection_policy: [p.Instance, () => new graph_hit_test_policy_1.NodesOnly()],\n", " });\n", " }\n", " get_selection_manager() {\n", " return this.node_renderer.data_source.selection_manager;\n", " }\n", " }\n", " exports.GraphRenderer = GraphRenderer;\n", " GraphRenderer.__name__ = \"GraphRenderer\";\n", " GraphRenderer.init_GraphRenderer();\n", " },\n", " /* models/graphs/graph_hit_test_policy.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const model_1 = require(71) /* ../../model */;\n", " const arrayable_1 = require(12) /* ../../core/util/arrayable */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class GraphHitTestPolicy extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " _hit_test_nodes(geometry, graph_view) {\n", " if (!graph_view.model.visible)\n", " return null;\n", " const hit_test_result = graph_view.node_view.glyph.hit_test(geometry);\n", " if (hit_test_result == null)\n", " return null;\n", " else\n", " return graph_view.node_view.model.view.convert_selection_from_subset(hit_test_result);\n", " }\n", " _hit_test_edges(geometry, graph_view) {\n", " if (!graph_view.model.visible)\n", " return null;\n", " const hit_test_result = graph_view.edge_view.glyph.hit_test(geometry);\n", " if (hit_test_result == null)\n", " return null;\n", " else\n", " return graph_view.edge_view.model.view.convert_selection_from_subset(hit_test_result);\n", " }\n", " }\n", " exports.GraphHitTestPolicy = GraphHitTestPolicy;\n", " GraphHitTestPolicy.__name__ = \"GraphHitTestPolicy\";\n", " class NodesOnly extends GraphHitTestPolicy {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " hit_test(geometry, graph_view) {\n", " return this._hit_test_nodes(geometry, graph_view);\n", " }\n", " do_selection(hit_test_result, graph, final, mode) {\n", " if (hit_test_result == null)\n", " return false;\n", " const node_selection = graph.node_renderer.data_source.selected;\n", " node_selection.update(hit_test_result, final, mode);\n", " graph.node_renderer.data_source._select.emit();\n", " return !node_selection.is_empty();\n", " }\n", " do_inspection(hit_test_result, geometry, graph_view, final, mode) {\n", " if (hit_test_result == null)\n", " return false;\n", " const node_inspection = graph_view.model.get_selection_manager().get_or_create_inspector(graph_view.node_view.model);\n", " node_inspection.update(hit_test_result, final, mode);\n", " // silently set inspected attr to avoid triggering data_source.change event and rerender\n", " graph_view.node_view.model.data_source.setv({ inspected: node_inspection }, { silent: true });\n", " graph_view.node_view.model.data_source.inspect.emit([graph_view.node_view, { geometry }]);\n", " return !node_inspection.is_empty();\n", " }\n", " }\n", " exports.NodesOnly = NodesOnly;\n", " NodesOnly.__name__ = \"NodesOnly\";\n", " class NodesAndLinkedEdges extends GraphHitTestPolicy {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " hit_test(geometry, graph_view) {\n", " return this._hit_test_nodes(geometry, graph_view);\n", " }\n", " get_linked_edges(node_source, edge_source, mode) {\n", " let node_indices = [];\n", " if (mode == 'selection') {\n", " node_indices = node_source.selected.indices.map((i) => node_source.data.index[i]);\n", " }\n", " else if (mode == 'inspection') {\n", " node_indices = node_source.inspected.indices.map((i) => node_source.data.index[i]);\n", " }\n", " const edge_indices = [];\n", " for (let i = 0; i < edge_source.data.start.length; i++) {\n", " if (array_1.contains(node_indices, edge_source.data.start[i]) || array_1.contains(node_indices, edge_source.data.end[i]))\n", " edge_indices.push(i);\n", " }\n", " const linked_edges = new selection_1.Selection();\n", " for (const i of edge_indices) {\n", " linked_edges.multiline_indices[i] = [0]; //currently only supports 2-element multilines, so this is all of it\n", " }\n", " linked_edges.indices = edge_indices;\n", " return linked_edges;\n", " }\n", " do_selection(hit_test_result, graph, final, mode) {\n", " if (hit_test_result == null)\n", " return false;\n", " const node_selection = graph.node_renderer.data_source.selected;\n", " node_selection.update(hit_test_result, final, mode);\n", " const edge_selection = graph.edge_renderer.data_source.selected;\n", " const linked_edges_selection = this.get_linked_edges(graph.node_renderer.data_source, graph.edge_renderer.data_source, 'selection');\n", " edge_selection.update(linked_edges_selection, final, mode);\n", " graph.node_renderer.data_source._select.emit();\n", " return !node_selection.is_empty();\n", " }\n", " do_inspection(hit_test_result, geometry, graph_view, final, mode) {\n", " if (hit_test_result == null)\n", " return false;\n", " const node_inspection = graph_view.node_view.model.data_source.selection_manager.get_or_create_inspector(graph_view.node_view.model);\n", " node_inspection.update(hit_test_result, final, mode);\n", " graph_view.node_view.model.data_source.setv({ inspected: node_inspection }, { silent: true });\n", " const edge_inspection = graph_view.edge_view.model.data_source.selection_manager.get_or_create_inspector(graph_view.edge_view.model);\n", " const linked_edges = this.get_linked_edges(graph_view.node_view.model.data_source, graph_view.edge_view.model.data_source, 'inspection');\n", " edge_inspection.update(linked_edges, final, mode);\n", " //silently set inspected attr to avoid triggering data_source.change event and rerender\n", " graph_view.edge_view.model.data_source.setv({ inspected: edge_inspection }, { silent: true });\n", " graph_view.node_view.model.data_source.inspect.emit([graph_view.node_view, { geometry }]);\n", " return !node_inspection.is_empty();\n", " }\n", " }\n", " exports.NodesAndLinkedEdges = NodesAndLinkedEdges;\n", " NodesAndLinkedEdges.__name__ = \"NodesAndLinkedEdges\";\n", " class EdgesAndLinkedNodes extends GraphHitTestPolicy {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " hit_test(geometry, graph_view) {\n", " return this._hit_test_edges(geometry, graph_view);\n", " }\n", " get_linked_nodes(node_source, edge_source, mode) {\n", " let edge_indices = [];\n", " if (mode == 'selection')\n", " edge_indices = edge_source.selected.indices;\n", " else if (mode == 'inspection')\n", " edge_indices = edge_source.inspected.indices;\n", " const nodes = [];\n", " for (const i of edge_indices) {\n", " nodes.push(edge_source.data.start[i]);\n", " nodes.push(edge_source.data.end[i]);\n", " }\n", " const node_indices = array_1.uniq(nodes).map((i) => arrayable_1.indexOf(node_source.data.index, i));\n", " return new selection_1.Selection({ indices: node_indices });\n", " }\n", " do_selection(hit_test_result, graph, final, mode) {\n", " if (hit_test_result == null)\n", " return false;\n", " const edge_selection = graph.edge_renderer.data_source.selected;\n", " edge_selection.update(hit_test_result, final, mode);\n", " const node_selection = graph.node_renderer.data_source.selected;\n", " const linked_nodes = this.get_linked_nodes(graph.node_renderer.data_source, graph.edge_renderer.data_source, 'selection');\n", " node_selection.update(linked_nodes, final, mode);\n", " graph.edge_renderer.data_source._select.emit();\n", " return !edge_selection.is_empty();\n", " }\n", " do_inspection(hit_test_result, geometry, graph_view, final, mode) {\n", " if (hit_test_result == null)\n", " return false;\n", " const edge_inspection = graph_view.edge_view.model.data_source.selection_manager.get_or_create_inspector(graph_view.edge_view.model);\n", " edge_inspection.update(hit_test_result, final, mode);\n", " graph_view.edge_view.model.data_source.setv({ inspected: edge_inspection }, { silent: true });\n", " const node_inspection = graph_view.node_view.model.data_source.selection_manager.get_or_create_inspector(graph_view.node_view.model);\n", " const linked_nodes = this.get_linked_nodes(graph_view.node_view.model.data_source, graph_view.edge_view.model.data_source, 'inspection');\n", " node_inspection.update(linked_nodes, final, mode);\n", " // silently set inspected attr to avoid triggering data_source.change event and rerender\n", " graph_view.node_view.model.data_source.setv({ inspected: node_inspection }, { silent: true });\n", " graph_view.edge_view.model.data_source.inspect.emit([graph_view.edge_view, { geometry }]);\n", " return !edge_inspection.is_empty();\n", " }\n", " }\n", " exports.EdgesAndLinkedNodes = EdgesAndLinkedNodes;\n", " EdgesAndLinkedNodes.__name__ = \"EdgesAndLinkedNodes\";\n", " },\n", " /* models/selections/interaction_policy.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const model_1 = require(71) /* ../../model */;\n", " class SelectionPolicy extends model_1.Model {\n", " do_selection(hit_test_result, source, final, mode) {\n", " if (hit_test_result === null) {\n", " return false;\n", " }\n", " else {\n", " source.selected.update(hit_test_result, final, mode);\n", " source._select.emit();\n", " return !source.selected.is_empty();\n", " }\n", " }\n", " }\n", " exports.SelectionPolicy = SelectionPolicy;\n", " SelectionPolicy.__name__ = \"SelectionPolicy\";\n", " class IntersectRenderers extends SelectionPolicy {\n", " hit_test(geometry, renderer_views) {\n", " const hit_test_result_renderers = [];\n", " for (const r of renderer_views) {\n", " const result = r.hit_test(geometry);\n", " if (result !== null)\n", " hit_test_result_renderers.push(result);\n", " }\n", " if (hit_test_result_renderers.length > 0) {\n", " const hit_test_result = hit_test_result_renderers[0];\n", " for (const hit_test_result_other of hit_test_result_renderers) {\n", " hit_test_result.update_through_intersection(hit_test_result_other);\n", " }\n", " return hit_test_result;\n", " }\n", " else {\n", " return null;\n", " }\n", " }\n", " }\n", " exports.IntersectRenderers = IntersectRenderers;\n", " IntersectRenderers.__name__ = \"IntersectRenderers\";\n", " class UnionRenderers extends SelectionPolicy {\n", " hit_test(geometry, renderer_views) {\n", " const hit_test_result_renderers = [];\n", " for (const r of renderer_views) {\n", " const result = r.hit_test(geometry);\n", " if (result !== null)\n", " hit_test_result_renderers.push(result);\n", " }\n", " if (hit_test_result_renderers.length > 0) {\n", " const hit_test_result = hit_test_result_renderers[0];\n", " for (const hit_test_result_other of hit_test_result_renderers) {\n", " hit_test_result.update_through_union(hit_test_result_other);\n", " }\n", " return hit_test_result;\n", " }\n", " else {\n", " return null;\n", " }\n", " }\n", " }\n", " exports.UnionRenderers = UnionRenderers;\n", " UnionRenderers.__name__ = \"UnionRenderers\";\n", " },\n", " /* core/util/typed_array.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " function concat(array0, ...arrays) {\n", " let n = array0.length;\n", " for (const array of arrays)\n", " n += array.length;\n", " const result = new array0.constructor(n);\n", " result.set(array0, 0);\n", " let i = array0.length;\n", " for (const array of arrays) {\n", " result.set(array, i);\n", " i += array.length;\n", " }\n", " return result;\n", " }\n", " exports.concat = concat;\n", " },\n", " /* core/util/set.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " function union(...sets) {\n", " const result = new Set();\n", " for (const set of sets) {\n", " for (const item of set) {\n", " result.add(item);\n", " }\n", " }\n", " return result;\n", " }\n", " exports.union = union;\n", " function intersection(set, ...sets) {\n", " const result = new Set();\n", " top: for (const item of set) {\n", " for (const other of sets) {\n", " if (!other.has(item))\n", " continue top;\n", " }\n", " result.add(item);\n", " }\n", " return result;\n", " }\n", " exports.intersection = intersection;\n", " function difference(set, ...sets) {\n", " const result = new Set(set);\n", " for (const item of union(...sets)) {\n", " result.delete(item);\n", " }\n", " return result;\n", " }\n", " exports.difference = difference;\n", " },\n", " /* document/events.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const has_props_1 = require(13) /* ../core/has_props */;\n", " class DocumentEvent {\n", " constructor(document) {\n", " this.document = document;\n", " }\n", " }\n", " exports.DocumentEvent = DocumentEvent;\n", " DocumentEvent.__name__ = \"DocumentEvent\";\n", " class DocumentEventBatch extends DocumentEvent {\n", " constructor(document, events, setter_id) {\n", " super(document);\n", " this.events = events;\n", " this.setter_id = setter_id;\n", " }\n", " }\n", " exports.DocumentEventBatch = DocumentEventBatch;\n", " DocumentEventBatch.__name__ = \"DocumentEventBatch\";\n", " class DocumentChangedEvent extends DocumentEvent {\n", " }\n", " exports.DocumentChangedEvent = DocumentChangedEvent;\n", " DocumentChangedEvent.__name__ = \"DocumentChangedEvent\";\n", " class MessageSentEvent extends DocumentChangedEvent {\n", " constructor(document, msg_type, msg_data) {\n", " super(document);\n", " this.msg_type = msg_type;\n", " this.msg_data = msg_data;\n", " }\n", " json(_references) {\n", " const value = this.msg_data;\n", " const value_json = has_props_1.HasProps._value_to_json(value);\n", " const value_refs = new Set();\n", " has_props_1.HasProps._value_record_references(value, value_refs, { recursive: true });\n", " /* XXX: this will cause all referenced models to be reinitialized\n", " for (const id in value_refs) {\n", " references[id] = value_refs[id]\n", " }\n", " */\n", " return {\n", " kind: \"MessageSent\",\n", " msg_type: this.msg_type,\n", " msg_data: value_json,\n", " };\n", " }\n", " }\n", " exports.MessageSentEvent = MessageSentEvent;\n", " MessageSentEvent.__name__ = \"MessageSentEvent\";\n", " class ModelChangedEvent extends DocumentChangedEvent {\n", " constructor(document, model, attr, old, new_, setter_id, hint) {\n", " super(document);\n", " this.model = model;\n", " this.attr = attr;\n", " this.old = old;\n", " this.new_ = new_;\n", " this.setter_id = setter_id;\n", " this.hint = hint;\n", " }\n", " json(references) {\n", " if (this.attr === \"id\") {\n", " throw new Error(\"'id' field should never change, whatever code just set it is wrong\");\n", " }\n", " if (this.hint != null)\n", " return this.hint.json(references);\n", " const value = this.new_;\n", " const value_json = has_props_1.HasProps._value_to_json(value);\n", " const value_refs = new Set();\n", " has_props_1.HasProps._value_record_references(value, value_refs, { recursive: true });\n", " if (value_refs.has(this.model) && this.model !== value) {\n", " // we know we don't want a whole new copy of the obj we're\n", " // patching unless it's also the value itself\n", " value_refs.delete(this.model);\n", " }\n", " for (const ref of value_refs) {\n", " references.add(ref);\n", " }\n", " return {\n", " kind: \"ModelChanged\",\n", " model: this.model.ref(),\n", " attr: this.attr,\n", " new: value_json,\n", " };\n", " }\n", " }\n", " exports.ModelChangedEvent = ModelChangedEvent;\n", " ModelChangedEvent.__name__ = \"ModelChangedEvent\";\n", " class ColumnsPatchedEvent extends DocumentChangedEvent {\n", " constructor(document, column_source, patches) {\n", " super(document);\n", " this.column_source = column_source;\n", " this.patches = patches;\n", " }\n", " json(_references) {\n", " return {\n", " kind: \"ColumnsPatched\",\n", " column_source: this.column_source,\n", " patches: this.patches,\n", " };\n", " }\n", " }\n", " exports.ColumnsPatchedEvent = ColumnsPatchedEvent;\n", " ColumnsPatchedEvent.__name__ = \"ColumnsPatchedEvent\";\n", " class ColumnsStreamedEvent extends DocumentChangedEvent {\n", " constructor(document, column_source, data, rollover) {\n", " super(document);\n", " this.column_source = column_source;\n", " this.data = data;\n", " this.rollover = rollover;\n", " }\n", " json(_references) {\n", " return {\n", " kind: \"ColumnsStreamed\",\n", " column_source: this.column_source,\n", " data: this.data,\n", " rollover: this.rollover,\n", " };\n", " }\n", " }\n", " exports.ColumnsStreamedEvent = ColumnsStreamedEvent;\n", " ColumnsStreamedEvent.__name__ = \"ColumnsStreamedEvent\";\n", " class TitleChangedEvent extends DocumentChangedEvent {\n", " constructor(document, title, setter_id) {\n", " super(document);\n", " this.title = title;\n", " this.setter_id = setter_id;\n", " }\n", " json(_references) {\n", " return {\n", " kind: \"TitleChanged\",\n", " title: this.title,\n", " };\n", " }\n", " }\n", " exports.TitleChangedEvent = TitleChangedEvent;\n", " TitleChangedEvent.__name__ = \"TitleChangedEvent\";\n", " class RootAddedEvent extends DocumentChangedEvent {\n", " constructor(document, model, setter_id) {\n", " super(document);\n", " this.model = model;\n", " this.setter_id = setter_id;\n", " }\n", " json(references) {\n", " has_props_1.HasProps._value_record_references(this.model, references, { recursive: true });\n", " return {\n", " kind: \"RootAdded\",\n", " model: this.model.ref(),\n", " };\n", " }\n", " }\n", " exports.RootAddedEvent = RootAddedEvent;\n", " RootAddedEvent.__name__ = \"RootAddedEvent\";\n", " class RootRemovedEvent extends DocumentChangedEvent {\n", " constructor(document, model, setter_id) {\n", " super(document);\n", " this.model = model;\n", " this.setter_id = setter_id;\n", " }\n", " json(_references) {\n", " return {\n", " kind: \"RootRemoved\",\n", " model: this.model.ref(),\n", " };\n", " }\n", " }\n", " exports.RootRemovedEvent = RootRemovedEvent;\n", " RootRemovedEvent.__name__ = \"RootRemovedEvent\";\n", " },\n", " /* models/annotations/band.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const annotation_1 = require(31) /* ./annotation */;\n", " const column_data_source_1 = require(76) /* ../sources/column_data_source */;\n", " const mixins = tslib_1.__importStar(require(23) /* ../../core/property_mixins */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class BandView extends annotation_1.AnnotationView {\n", " initialize() {\n", " super.initialize();\n", " this.set_data(this.model.source);\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.source.streaming, () => this.set_data(this.model.source));\n", " this.connect(this.model.source.patching, () => this.set_data(this.model.source));\n", " this.connect(this.model.source.change, () => this.set_data(this.model.source));\n", " }\n", " set_data(source) {\n", " super.set_data(source);\n", " this.visuals.warm_cache(source);\n", " this.plot_view.request_render();\n", " }\n", " _map_data() {\n", " const { frame } = this.plot_view;\n", " const dim = this.model.dimension;\n", " const xscale = frame.xscales[this.model.x_range_name];\n", " const yscale = frame.yscales[this.model.y_range_name];\n", " const limit_scale = dim == \"height\" ? yscale : xscale;\n", " const base_scale = dim == \"height\" ? xscale : yscale;\n", " const limit_view = dim == \"height\" ? frame.yview : frame.xview;\n", " const base_view = dim == \"height\" ? frame.xview : frame.yview;\n", " let _lower_sx;\n", " if (this.model.properties.lower.units == \"data\")\n", " _lower_sx = limit_scale.v_compute(this._lower);\n", " else\n", " _lower_sx = limit_view.v_compute(this._lower);\n", " let _upper_sx;\n", " if (this.model.properties.upper.units == \"data\")\n", " _upper_sx = limit_scale.v_compute(this._upper);\n", " else\n", " _upper_sx = limit_view.v_compute(this._upper);\n", " let _base_sx;\n", " if (this.model.properties.base.units == \"data\")\n", " _base_sx = base_scale.v_compute(this._base);\n", " else\n", " _base_sx = base_view.v_compute(this._base);\n", " const [i, j] = dim == 'height' ? [1, 0] : [0, 1];\n", " const _lower = [_lower_sx, _base_sx];\n", " const _upper = [_upper_sx, _base_sx];\n", " this._lower_sx = _lower[i];\n", " this._lower_sy = _lower[j];\n", " this._upper_sx = _upper[i];\n", " this._upper_sy = _upper[j];\n", " }\n", " render() {\n", " if (!this.model.visible)\n", " return;\n", " this._map_data();\n", " const { ctx } = this.layer;\n", " // Draw the band body\n", " ctx.beginPath();\n", " ctx.moveTo(this._lower_sx[0], this._lower_sy[0]);\n", " for (let i = 0, end = this._lower_sx.length; i < end; i++) {\n", " ctx.lineTo(this._lower_sx[i], this._lower_sy[i]);\n", " }\n", " // iterate backwards so that the upper end is below the lower start\n", " for (let i = this._upper_sx.length - 1; i >= 0; i--) {\n", " ctx.lineTo(this._upper_sx[i], this._upper_sy[i]);\n", " }\n", " ctx.closePath();\n", " if (this.visuals.fill.doit) {\n", " this.visuals.fill.set_value(ctx);\n", " ctx.fill();\n", " }\n", " // Draw the lower band edge\n", " ctx.beginPath();\n", " ctx.moveTo(this._lower_sx[0], this._lower_sy[0]);\n", " for (let i = 0, end = this._lower_sx.length; i < end; i++) {\n", " ctx.lineTo(this._lower_sx[i], this._lower_sy[i]);\n", " }\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_value(ctx);\n", " ctx.stroke();\n", " }\n", " // Draw the upper band edge\n", " ctx.beginPath();\n", " ctx.moveTo(this._upper_sx[0], this._upper_sy[0]);\n", " for (let i = 0, end = this._upper_sx.length; i < end; i++) {\n", " ctx.lineTo(this._upper_sx[i], this._upper_sy[i]);\n", " }\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_value(ctx);\n", " ctx.stroke();\n", " }\n", " }\n", " }\n", " exports.BandView = BandView;\n", " BandView.__name__ = \"BandView\";\n", " class Band extends annotation_1.Annotation {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Band() {\n", " this.prototype.default_view = BandView;\n", " this.mixins([mixins.Line /*Scalar*/, mixins.Fill /*Scalar*/]);\n", " this.define({\n", " lower: [p.DistanceSpec],\n", " upper: [p.DistanceSpec],\n", " base: [p.DistanceSpec],\n", " dimension: [p.Dimension, 'height'],\n", " source: [p.Instance, () => new column_data_source_1.ColumnDataSource()],\n", " x_range_name: [p.String, 'default'],\n", " y_range_name: [p.String, 'default'],\n", " });\n", " this.override({\n", " fill_color: \"#fff9ba\",\n", " fill_alpha: 0.4,\n", " line_color: \"#cccccc\",\n", " line_alpha: 0.3,\n", " });\n", " }\n", " }\n", " exports.Band = Band;\n", " Band.__name__ = \"Band\";\n", " Band.init_Band();\n", " },\n", " /* models/annotations/box_annotation.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const annotation_1 = require(31) /* ./annotation */;\n", " const signaling_1 = require(14) /* ../../core/signaling */;\n", " const mixins = tslib_1.__importStar(require(23) /* ../../core/property_mixins */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const bbox_1 = require(88) /* ../../core/util/bbox */;\n", " exports.EDGE_TOLERANCE = 2.5;\n", " class BoxAnnotationView extends annotation_1.AnnotationView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.change, () => this.plot_view.request_paint(this));\n", " this.connect(this.model.data_update, () => this.plot_view.request_paint(this));\n", " }\n", " render() {\n", " if (!this.model.visible)\n", " return;\n", " // don't render if *all* position are null\n", " if (this.model.left == null && this.model.right == null && this.model.top == null && this.model.bottom == null) {\n", " return;\n", " }\n", " const { frame } = this.plot_view;\n", " const xscale = frame.xscales[this.model.x_range_name];\n", " const yscale = frame.yscales[this.model.y_range_name];\n", " const _calc_dim = (dim, dim_units, scale, view, frame_extrema) => {\n", " let sdim;\n", " if (dim != null) {\n", " if (this.model.screen)\n", " sdim = dim;\n", " else {\n", " if (dim_units == 'data')\n", " sdim = scale.compute(dim);\n", " else\n", " sdim = view.compute(dim);\n", " }\n", " }\n", " else\n", " sdim = frame_extrema;\n", " return sdim;\n", " };\n", " this.sleft = _calc_dim(this.model.left, this.model.left_units, xscale, frame.xview, frame._left.value);\n", " this.sright = _calc_dim(this.model.right, this.model.right_units, xscale, frame.xview, frame._right.value);\n", " this.stop = _calc_dim(this.model.top, this.model.top_units, yscale, frame.yview, frame._top.value);\n", " this.sbottom = _calc_dim(this.model.bottom, this.model.bottom_units, yscale, frame.yview, frame._bottom.value);\n", " this._paint_box(this.sleft, this.sright, this.sbottom, this.stop);\n", " }\n", " _paint_box(sleft, sright, sbottom, stop) {\n", " const { ctx } = this.layer;\n", " ctx.save();\n", " ctx.beginPath();\n", " ctx.rect(sleft, stop, sright - sleft, sbottom - stop);\n", " if (this.visuals.fill.doit) {\n", " this.visuals.fill.set_value(ctx);\n", " ctx.fill();\n", " }\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_value(ctx);\n", " ctx.stroke();\n", " }\n", " ctx.restore();\n", " }\n", " interactive_bbox() {\n", " const tol = this.model.properties.line_width.value() + exports.EDGE_TOLERANCE;\n", " return new bbox_1.BBox({\n", " x0: this.sleft - tol,\n", " y0: this.stop - tol,\n", " x1: this.sright + tol,\n", " y1: this.sbottom + tol,\n", " });\n", " }\n", " interactive_hit(sx, sy) {\n", " if (this.model.in_cursor == null)\n", " return false;\n", " const bbox = this.interactive_bbox();\n", " return bbox.contains(sx, sy);\n", " }\n", " cursor(sx, sy) {\n", " const tol = 3;\n", " if (Math.abs(sx - this.sleft) < tol || Math.abs(sx - this.sright) < tol)\n", " return this.model.ew_cursor;\n", " else if (Math.abs(sy - this.sbottom) < tol || Math.abs(sy - this.stop) < tol)\n", " return this.model.ns_cursor;\n", " else if (sx > this.sleft && sx < this.sright && sy > this.stop && sy < this.sbottom)\n", " return this.model.in_cursor;\n", " else\n", " return null;\n", " }\n", " }\n", " exports.BoxAnnotationView = BoxAnnotationView;\n", " BoxAnnotationView.__name__ = \"BoxAnnotationView\";\n", " class BoxAnnotation extends annotation_1.Annotation {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_BoxAnnotation() {\n", " this.prototype.default_view = BoxAnnotationView;\n", " this.mixins([mixins.Line /*Scalar*/, mixins.Fill /*Scalar*/]);\n", " this.define({\n", " render_mode: [p.RenderMode, 'canvas'],\n", " x_range_name: [p.String, 'default'],\n", " y_range_name: [p.String, 'default'],\n", " top: [p.Number, null],\n", " top_units: [p.SpatialUnits, 'data'],\n", " bottom: [p.Number, null],\n", " bottom_units: [p.SpatialUnits, 'data'],\n", " left: [p.Number, null],\n", " left_units: [p.SpatialUnits, 'data'],\n", " right: [p.Number, null],\n", " right_units: [p.SpatialUnits, 'data'],\n", " });\n", " this.internal({\n", " screen: [p.Boolean, false],\n", " ew_cursor: [p.String, null],\n", " ns_cursor: [p.String, null],\n", " in_cursor: [p.String, null],\n", " });\n", " this.override({\n", " fill_color: '#fff9ba',\n", " fill_alpha: 0.4,\n", " line_color: '#cccccc',\n", " line_alpha: 0.3,\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.data_update = new signaling_1.Signal0(this, \"data_update\");\n", " }\n", " update({ left, right, top, bottom }) {\n", " this.setv({ left, right, top, bottom, screen: true }, { silent: true });\n", " this.data_update.emit();\n", " }\n", " }\n", " exports.BoxAnnotation = BoxAnnotation;\n", " BoxAnnotation.__name__ = \"BoxAnnotation\";\n", " BoxAnnotation.init_BoxAnnotation();\n", " },\n", " /* models/annotations/color_bar.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const annotation_1 = require(31) /* ./annotation */;\n", " const basic_ticker_1 = require(109) /* ../tickers/basic_ticker */;\n", " const basic_tick_formatter_1 = require(113) /* ../formatters/basic_tick_formatter */;\n", " const linear_color_mapper_1 = require(115) /* ../mappers/linear_color_mapper */;\n", " const linear_scale_1 = require(120) /* ../scales/linear_scale */;\n", " const log_scale_1 = require(130) /* ../scales/log_scale */;\n", " const range1d_1 = require(131) /* ../ranges/range1d */;\n", " const mixins = tslib_1.__importStar(require(23) /* ../../core/property_mixins */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const text_util = tslib_1.__importStar(require(132) /* ../../core/util/text */);\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const arrayable_1 = require(12) /* ../../core/util/arrayable */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const assert_1 = require(11) /* ../../core/util/assert */;\n", " const SHORT_DIM = 25;\n", " const LONG_DIM_MIN_SCALAR = 0.3;\n", " const LONG_DIM_MAX_SCALAR = 0.8;\n", " class ColorBarView extends annotation_1.AnnotationView {\n", " initialize() {\n", " super.initialize();\n", " this._set_canvas_image();\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.visible.change, () => this.plot_view.request_render());\n", " this.connect(this.model.ticker.change, () => this.plot_view.request_render());\n", " this.connect(this.model.formatter.change, () => this.plot_view.request_render());\n", " if (this.model.color_mapper != null) {\n", " this.connect(this.model.color_mapper.change, () => {\n", " this._set_canvas_image();\n", " this.plot_view.request_render();\n", " });\n", " }\n", " }\n", " _get_size() {\n", " if (this.model.color_mapper == null)\n", " return { width: 0, height: 0 };\n", " else {\n", " const { width, height } = this.compute_legend_dimensions();\n", " return { width, height };\n", " }\n", " }\n", " _set_canvas_image() {\n", " if (this.model.color_mapper == null)\n", " return;\n", " let { palette } = this.model.color_mapper;\n", " if (this.model.orientation == 'vertical')\n", " palette = array_1.reversed(palette);\n", " let w, h;\n", " switch (this.model.orientation) {\n", " case \"vertical\": {\n", " [w, h] = [1, palette.length];\n", " break;\n", " }\n", " case \"horizontal\": {\n", " [w, h] = [palette.length, 1];\n", " break;\n", " }\n", " }\n", " const canvas = document.createElement('canvas');\n", " canvas.width = w;\n", " canvas.height = h;\n", " const image_ctx = canvas.getContext('2d');\n", " const image_data = image_ctx.getImageData(0, 0, w, h);\n", " // We always want to draw the entire palette linearly, so we create a new\n", " // LinearColorMapper instance and map a monotonic range of values with\n", " // length = palette.length to get each palette color in order.\n", " const cmap = new linear_color_mapper_1.LinearColorMapper({ palette }).rgba_mapper;\n", " const buf8 = cmap.v_compute(array_1.range(0, palette.length));\n", " image_data.data.set(buf8);\n", " image_ctx.putImageData(image_data, 0, 0);\n", " this.image = canvas;\n", " }\n", " compute_legend_dimensions() {\n", " const image_dimensions = this._computed_image_dimensions();\n", " const [image_height, image_width] = [image_dimensions.height, image_dimensions.width];\n", " const label_extent = this._get_label_extent();\n", " const title_extent = this._title_extent();\n", " const tick_extent = this._tick_extent();\n", " const { padding } = this.model;\n", " let legend_height, legend_width;\n", " switch (this.model.orientation) {\n", " case \"vertical\":\n", " legend_height = image_height + title_extent + 2 * padding;\n", " legend_width = image_width + tick_extent + label_extent + 2 * padding;\n", " break;\n", " case \"horizontal\":\n", " legend_height = image_height + title_extent + tick_extent + label_extent + 2 * padding;\n", " legend_width = image_width + 2 * padding;\n", " break;\n", " }\n", " return { width: legend_width, height: legend_height };\n", " }\n", " compute_legend_location() {\n", " const legend_dimensions = this.compute_legend_dimensions();\n", " const [legend_height, legend_width] = [legend_dimensions.height, legend_dimensions.width];\n", " const legend_margin = this.model.margin;\n", " const panel = this.panel != null ? this.panel : this.plot_view.frame;\n", " const [hr, vr] = panel.bbox.ranges;\n", " const { location } = this.model;\n", " let sx, sy;\n", " if (types_1.isString(location)) {\n", " switch (location) {\n", " case 'top_left':\n", " sx = hr.start + legend_margin;\n", " sy = vr.start + legend_margin;\n", " break;\n", " case 'top_center':\n", " sx = (hr.end + hr.start) / 2 - legend_width / 2;\n", " sy = vr.start + legend_margin;\n", " break;\n", " case 'top_right':\n", " sx = hr.end - legend_margin - legend_width;\n", " sy = vr.start + legend_margin;\n", " break;\n", " case 'bottom_right':\n", " sx = hr.end - legend_margin - legend_width;\n", " sy = vr.end - legend_margin - legend_height;\n", " break;\n", " case 'bottom_center':\n", " sx = (hr.end + hr.start) / 2 - legend_width / 2;\n", " sy = vr.end - legend_margin - legend_height;\n", " break;\n", " case 'bottom_left':\n", " sx = hr.start + legend_margin;\n", " sy = vr.end - legend_margin - legend_height;\n", " break;\n", " case 'center_left':\n", " sx = hr.start + legend_margin;\n", " sy = (vr.end + vr.start) / 2 - legend_height / 2;\n", " break;\n", " case 'center':\n", " sx = (hr.end + hr.start) / 2 - legend_width / 2;\n", " sy = (vr.end + vr.start) / 2 - legend_height / 2;\n", " break;\n", " case 'center_right':\n", " sx = hr.end - legend_margin - legend_width;\n", " sy = (vr.end + vr.start) / 2 - legend_height / 2;\n", " break;\n", " }\n", " }\n", " else if (types_1.isArray(location) && location.length == 2) {\n", " const [vx, vy] = location;\n", " sx = panel.xview.compute(vx);\n", " sy = panel.yview.compute(vy) - legend_height;\n", " }\n", " else\n", " assert_1.unreachable();\n", " return { sx, sy };\n", " }\n", " render() {\n", " if (!this.model.visible || this.model.color_mapper == null)\n", " return;\n", " const { ctx } = this.layer;\n", " ctx.save();\n", " const { sx, sy } = this.compute_legend_location();\n", " ctx.translate(sx, sy);\n", " this._draw_bbox(ctx);\n", " const image_offset = this._get_image_offset();\n", " ctx.translate(image_offset.x, image_offset.y);\n", " this._draw_image(ctx);\n", " if (this.model.color_mapper.low != null && this.model.color_mapper.high != null) {\n", " const tick_info = this.tick_info();\n", " this._draw_major_ticks(ctx, tick_info);\n", " this._draw_minor_ticks(ctx, tick_info);\n", " this._draw_major_labels(ctx, tick_info);\n", " }\n", " if (this.model.title)\n", " this._draw_title(ctx);\n", " ctx.restore();\n", " }\n", " _draw_bbox(ctx) {\n", " const bbox = this.compute_legend_dimensions();\n", " ctx.save();\n", " if (this.visuals.background_fill.doit) {\n", " this.visuals.background_fill.set_value(ctx);\n", " ctx.fillRect(0, 0, bbox.width, bbox.height);\n", " }\n", " if (this.visuals.border_line.doit) {\n", " this.visuals.border_line.set_value(ctx);\n", " ctx.strokeRect(0, 0, bbox.width, bbox.height);\n", " }\n", " ctx.restore();\n", " }\n", " _draw_image(ctx) {\n", " const image = this._computed_image_dimensions();\n", " ctx.save();\n", " ctx.setImageSmoothingEnabled(false);\n", " ctx.globalAlpha = this.model.scale_alpha;\n", " ctx.drawImage(this.image, 0, 0, image.width, image.height);\n", " if (this.visuals.bar_line.doit) {\n", " this.visuals.bar_line.set_value(ctx);\n", " ctx.strokeRect(0, 0, image.width, image.height);\n", " }\n", " ctx.restore();\n", " }\n", " _draw_major_ticks(ctx, tick_info) {\n", " if (!this.visuals.major_tick_line.doit)\n", " return;\n", " const [nx, ny] = this._normals();\n", " const image = this._computed_image_dimensions();\n", " const [x_offset, y_offset] = [image.width * nx, image.height * ny];\n", " const [sx, sy] = tick_info.coords.major;\n", " const tin = this.model.major_tick_in;\n", " const tout = this.model.major_tick_out;\n", " ctx.save();\n", " ctx.translate(x_offset, y_offset);\n", " this.visuals.major_tick_line.set_value(ctx);\n", " for (let i = 0, end = sx.length; i < end; i++) {\n", " ctx.beginPath();\n", " ctx.moveTo(Math.round(sx[i] + nx * tout), Math.round(sy[i] + ny * tout));\n", " ctx.lineTo(Math.round(sx[i] - nx * tin), Math.round(sy[i] - ny * tin));\n", " ctx.stroke();\n", " }\n", " ctx.restore();\n", " }\n", " _draw_minor_ticks(ctx, tick_info) {\n", " if (!this.visuals.minor_tick_line.doit)\n", " return;\n", " const [nx, ny] = this._normals();\n", " const image = this._computed_image_dimensions();\n", " const [x_offset, y_offset] = [image.width * nx, image.height * ny];\n", " const [sx, sy] = tick_info.coords.minor;\n", " const tin = this.model.minor_tick_in;\n", " const tout = this.model.minor_tick_out;\n", " ctx.save();\n", " ctx.translate(x_offset, y_offset);\n", " this.visuals.minor_tick_line.set_value(ctx);\n", " for (let i = 0, end = sx.length; i < end; i++) {\n", " ctx.beginPath();\n", " ctx.moveTo(Math.round(sx[i] + nx * tout), Math.round(sy[i] + ny * tout));\n", " ctx.lineTo(Math.round(sx[i] - nx * tin), Math.round(sy[i] - ny * tin));\n", " ctx.stroke();\n", " }\n", " ctx.restore();\n", " }\n", " _draw_major_labels(ctx, tick_info) {\n", " if (!this.visuals.major_label_text.doit)\n", " return;\n", " const [nx, ny] = this._normals();\n", " const image = this._computed_image_dimensions();\n", " const [x_offset, y_offset] = [image.width * nx, image.height * ny];\n", " const standoff = (this.model.label_standoff + this._tick_extent());\n", " const [x_standoff, y_standoff] = [standoff * nx, standoff * ny];\n", " const [sx, sy] = tick_info.coords.major;\n", " const formatted_labels = tick_info.labels.major;\n", " this.visuals.major_label_text.set_value(ctx);\n", " ctx.save();\n", " ctx.translate(x_offset + x_standoff, y_offset + y_standoff);\n", " for (let i = 0, end = sx.length; i < end; i++) {\n", " ctx.fillText(formatted_labels[i], Math.round(sx[i] + nx * this.model.label_standoff), Math.round(sy[i] + ny * this.model.label_standoff));\n", " }\n", " ctx.restore();\n", " }\n", " _draw_title(ctx) {\n", " if (!this.visuals.title_text.doit)\n", " return;\n", " ctx.save();\n", " this.visuals.title_text.set_value(ctx);\n", " ctx.fillText(this.model.title, 0, -this.model.title_standoff);\n", " ctx.restore();\n", " }\n", " /*protected*/ _get_label_extent() {\n", " const major_labels = this.tick_info().labels.major;\n", " let label_extent;\n", " if (this.model.color_mapper.low != null && this.model.color_mapper.high != null && !array_1.is_empty(major_labels)) {\n", " const { ctx } = this.layer;\n", " ctx.save();\n", " this.visuals.major_label_text.set_value(ctx);\n", " switch (this.model.orientation) {\n", " case \"vertical\":\n", " label_extent = array_1.max((major_labels.map((label) => ctx.measureText(label.toString()).width)));\n", " break;\n", " case \"horizontal\":\n", " label_extent = text_util.measure_font(this.visuals.major_label_text.font_value()).height;\n", " break;\n", " }\n", " label_extent += this.model.label_standoff;\n", " ctx.restore();\n", " }\n", " else\n", " label_extent = 0;\n", " return label_extent;\n", " }\n", " /*protected*/ _get_image_offset() {\n", " // Returns image offset relative to legend bounding box\n", " const x = this.model.padding;\n", " const y = this.model.padding + this._title_extent();\n", " return { x, y };\n", " }\n", " // {{{ TODO: state\n", " _normals() {\n", " return this.model.orientation == 'vertical' ? [1, 0] : [0, 1];\n", " }\n", " _title_extent() {\n", " const font_value = this.model.title_text_font + \" \" + this.model.title_text_font_size + \" \" + this.model.title_text_font_style;\n", " const title_extent = this.model.title ? text_util.measure_font(font_value).height + this.model.title_standoff : 0;\n", " return title_extent;\n", " }\n", " _tick_extent() {\n", " if (this.model.color_mapper.low != null && this.model.color_mapper.high != null)\n", " return array_1.max([this.model.major_tick_out, this.model.minor_tick_out]);\n", " else\n", " return 0;\n", " }\n", " _computed_image_dimensions() {\n", " /*\n", " Heuristics to determine ColorBar image dimensions if set to \"auto\"\n", " \n", " Note: Returns the height/width values for the ColorBar's scale image, not\n", " the dimensions of the entire ColorBar.\n", " \n", " If the short dimension (the width of a vertical bar or height of a\n", " horizontal bar) is set to \"auto\", the resulting dimension will be set to\n", " 25 px.\n", " \n", " For a ColorBar in a side panel with the long dimension (the height of a\n", " vertical bar or width of a horizontal bar) set to \"auto\", the\n", " resulting dimension will be as long as the adjacent frame edge, so that the\n", " bar \"fits\" to the plot.\n", " \n", " For a ColorBar in the plot frame with the long dimension set to \"auto\", the\n", " resulting dimension will be the greater of:\n", " * The length of the color palette * 25px\n", " * The parallel frame dimension * 0.30\n", " (i.e the frame height for a vertical ColorBar)\n", " But not greater than:\n", " * The parallel frame dimension * 0.80\n", " */\n", " const frame_height = this.plot_view.frame._height.value;\n", " const frame_width = this.plot_view.frame._width.value;\n", " const title_extent = this._title_extent();\n", " let height, width;\n", " switch (this.model.orientation) {\n", " case \"vertical\": {\n", " if (this.model.height == 'auto') {\n", " if (this.panel != null)\n", " height = frame_height - 2 * this.model.padding - title_extent;\n", " else {\n", " height = array_1.max([this.model.color_mapper.palette.length * SHORT_DIM, frame_height * LONG_DIM_MIN_SCALAR]);\n", " height = array_1.min([height, frame_height * LONG_DIM_MAX_SCALAR - 2 * this.model.padding - title_extent]);\n", " }\n", " }\n", " else\n", " height = this.model.height;\n", " width = this.model.width == 'auto' ? SHORT_DIM : this.model.width;\n", " break;\n", " }\n", " case \"horizontal\": {\n", " height = this.model.height == 'auto' ? SHORT_DIM : this.model.height;\n", " if (this.model.width == 'auto') {\n", " if (this.panel != null)\n", " width = frame_width - 2 * this.model.padding;\n", " else {\n", " width = array_1.max([this.model.color_mapper.palette.length * SHORT_DIM, frame_width * LONG_DIM_MIN_SCALAR]);\n", " width = array_1.min([width, frame_width * LONG_DIM_MAX_SCALAR - 2 * this.model.padding]);\n", " }\n", " }\n", " else\n", " width = this.model.width;\n", " break;\n", " }\n", " }\n", " return { width, height };\n", " }\n", " /*protected*/ _tick_coordinate_scale(scale_length) {\n", " /*\n", " Creates and returns a scale instance that maps the `color_mapper` range\n", " (low to high) to a screen space range equal to the length of the ColorBar's\n", " scale image. The scale is used to calculate the tick coordinates in screen\n", " coordinates for plotting purposes.\n", " \n", " Note: the type of color_mapper has to match the type of scale (i.e.\n", " a LinearColorMapper will require a corresponding LinearScale instance).\n", " */\n", " const ranges = {\n", " source_range: new range1d_1.Range1d({\n", " start: this.model.color_mapper.low,\n", " end: this.model.color_mapper.high,\n", " }),\n", " target_range: new range1d_1.Range1d({\n", " start: 0,\n", " end: scale_length,\n", " }),\n", " };\n", " switch (this.model.color_mapper.type) {\n", " case \"LinearColorMapper\": return new linear_scale_1.LinearScale(ranges);\n", " case \"LogColorMapper\": return new log_scale_1.LogScale(ranges);\n", " default:\n", " assert_1.unreachable();\n", " }\n", " }\n", " _format_major_labels(initial_labels, major_ticks) {\n", " // XXX: passing null as cross_loc probably means MercatorTickFormatters, etc\n", " // will not function properly in conjunction with colorbars\n", " const formatted_labels = this.model.formatter.doFormat(initial_labels, null);\n", " for (let i = 0, end = major_ticks.length; i < end; i++) {\n", " if (major_ticks[i] in this.model.major_label_overrides)\n", " formatted_labels[i] = this.model.major_label_overrides[major_ticks[i]];\n", " }\n", " return formatted_labels;\n", " }\n", " tick_info() {\n", " const image_dimensions = this._computed_image_dimensions();\n", " let scale_length;\n", " switch (this.model.orientation) {\n", " case \"vertical\": {\n", " scale_length = image_dimensions.height;\n", " break;\n", " }\n", " case \"horizontal\": {\n", " scale_length = image_dimensions.width;\n", " break;\n", " }\n", " }\n", " const scale = this._tick_coordinate_scale(scale_length);\n", " const [i, j] = this._normals();\n", " const [start, end] = [this.model.color_mapper.low, this.model.color_mapper.high];\n", " // XXX: passing null as cross_loc probably means MercatorTickers, etc\n", " // will not function properly in conjunction with colorbars\n", " const ticks = this.model.ticker.get_ticks(start, end, null, null, this.model.ticker.desired_num_ticks);\n", " const majors = ticks.major;\n", " const minors = ticks.minor;\n", " const major_coords = [[], []];\n", " const minor_coords = [[], []];\n", " for (let ii = 0, _end = majors.length; ii < _end; ii++) {\n", " if (majors[ii] < start || majors[ii] > end)\n", " continue;\n", " major_coords[i].push(majors[ii]);\n", " major_coords[j].push(0);\n", " }\n", " for (let ii = 0, _end = minors.length; ii < _end; ii++) {\n", " if (minors[ii] < start || minors[ii] > end)\n", " continue;\n", " minor_coords[i].push(minors[ii]);\n", " minor_coords[j].push(0);\n", " }\n", " const labels = { major: this._format_major_labels(major_coords[i], majors) };\n", " const coords = {\n", " major: [[], []],\n", " minor: [[], []],\n", " };\n", " coords.major[i] = scale.v_compute(major_coords[i]);\n", " coords.minor[i] = scale.v_compute(minor_coords[i]);\n", " coords.major[j] = major_coords[j];\n", " coords.minor[j] = minor_coords[j];\n", " // Because we want the scale to be reversed\n", " if (this.model.orientation == 'vertical') {\n", " coords.major[i] = arrayable_1.map(coords.major[i], (coord) => scale_length - coord);\n", " coords.minor[i] = arrayable_1.map(coords.minor[i], (coord) => scale_length - coord);\n", " }\n", " return { coords, labels };\n", " }\n", " }\n", " exports.ColorBarView = ColorBarView;\n", " ColorBarView.__name__ = \"ColorBarView\";\n", " class ColorBar extends annotation_1.Annotation {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ColorBar() {\n", " this.prototype.default_view = ColorBarView;\n", " this.mixins([\n", " [\"major_label_\", mixins.Text],\n", " [\"title_\", mixins.Text],\n", " [\"major_tick_\", mixins.Line],\n", " [\"minor_tick_\", mixins.Line],\n", " [\"border_\", mixins.Line],\n", " [\"bar_\", mixins.Line],\n", " [\"background_\", mixins.Fill],\n", " ]);\n", " this.define({\n", " location: [p.Any, 'top_right'],\n", " orientation: [p.Orientation, 'vertical'],\n", " title: [p.String],\n", " title_standoff: [p.Number, 2],\n", " width: [p.Any, 'auto'],\n", " height: [p.Any, 'auto'],\n", " scale_alpha: [p.Number, 1.0],\n", " ticker: [p.Instance, () => new basic_ticker_1.BasicTicker()],\n", " formatter: [p.Instance, () => new basic_tick_formatter_1.BasicTickFormatter()],\n", " major_label_overrides: [p.Any, {}],\n", " color_mapper: [p.Instance],\n", " label_standoff: [p.Number, 5],\n", " margin: [p.Number, 30],\n", " padding: [p.Number, 10],\n", " major_tick_in: [p.Number, 5],\n", " major_tick_out: [p.Number, 0],\n", " minor_tick_in: [p.Number, 0],\n", " minor_tick_out: [p.Number, 0],\n", " });\n", " this.override({\n", " background_fill_color: \"#ffffff\",\n", " background_fill_alpha: 0.95,\n", " bar_line_color: null,\n", " border_line_color: null,\n", " major_label_text_align: \"center\",\n", " major_label_text_baseline: \"middle\",\n", " major_label_text_font_size: \"11px\",\n", " major_tick_line_color: \"#ffffff\",\n", " minor_tick_line_color: null,\n", " title_text_font_size: \"13px\",\n", " title_text_font_style: \"italic\",\n", " });\n", " }\n", " }\n", " exports.ColorBar = ColorBar;\n", " ColorBar.__name__ = \"ColorBar\";\n", " ColorBar.init_ColorBar();\n", " },\n", " /* models/tickers/basic_ticker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const adaptive_ticker_1 = require(110) /* ./adaptive_ticker */;\n", " class BasicTicker extends adaptive_ticker_1.AdaptiveTicker {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " }\n", " exports.BasicTicker = BasicTicker;\n", " BasicTicker.__name__ = \"BasicTicker\";\n", " },\n", " /* models/tickers/adaptive_ticker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const continuous_ticker_1 = require(111) /* ./continuous_ticker */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " // Forces a number x into a specified range [min_val, max_val].\n", " function clamp(x, min_val, max_val) {\n", " return Math.max(min_val, Math.min(max_val, x));\n", " }\n", " // A log function with an optional base.\n", " function log(x, base = Math.E) {\n", " return Math.log(x) / Math.log(base);\n", " }\n", " class AdaptiveTicker extends continuous_ticker_1.ContinuousTicker {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_AdaptiveTicker() {\n", " this.define({\n", " base: [p.Number, 10.0],\n", " mantissas: [p.Array, [1, 2, 5]],\n", " min_interval: [p.Number, 0.0],\n", " max_interval: [p.Number],\n", " });\n", " }\n", " // These arguments control the range of possible intervals. The interval I\n", " // returned by get_interval() will be the one that most closely matches the\n", " // desired number of ticks, subject to the following constraints:\n", " // I = (M * B^N), where\n", " // M is a member of mantissas,\n", " // B is base,\n", " // and N is an integer;\n", " // and min_interval <= I <= max_interval.\n", " initialize() {\n", " super.initialize();\n", " const prefix_mantissa = array_1.nth(this.mantissas, -1) / this.base;\n", " const suffix_mantissa = array_1.nth(this.mantissas, 0) * this.base;\n", " this.extended_mantissas = [prefix_mantissa, ...this.mantissas, suffix_mantissa];\n", " this.base_factor = this.get_min_interval() === 0.0 ? 1.0 : this.get_min_interval();\n", " }\n", " get_interval(data_low, data_high, desired_n_ticks) {\n", " const data_range = data_high - data_low;\n", " const ideal_interval = this.get_ideal_interval(data_low, data_high, desired_n_ticks);\n", " const interval_exponent = Math.floor(log(ideal_interval / this.base_factor, this.base));\n", " const ideal_magnitude = this.base ** interval_exponent * this.base_factor;\n", " // An untested optimization.\n", " // const ideal_mantissa = ideal_interval / ideal_magnitude\n", " // index = sorted_index(this.extended_mantissas, ideal_mantissa)\n", " // candidate_mantissas = this.extended_mantissas[index..index + 1]\n", " const candidate_mantissas = this.extended_mantissas;\n", " const errors = candidate_mantissas.map((mantissa) => {\n", " return Math.abs(desired_n_ticks - (data_range / (mantissa * ideal_magnitude)));\n", " });\n", " const best_mantissa = candidate_mantissas[array_1.argmin(errors)];\n", " const interval = best_mantissa * ideal_magnitude;\n", " return clamp(interval, this.get_min_interval(), this.get_max_interval());\n", " }\n", " }\n", " exports.AdaptiveTicker = AdaptiveTicker;\n", " AdaptiveTicker.__name__ = \"AdaptiveTicker\";\n", " AdaptiveTicker.init_AdaptiveTicker();\n", " },\n", " /* models/tickers/continuous_ticker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const ticker_1 = require(112) /* ./ticker */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " class ContinuousTicker extends ticker_1.Ticker {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ContinuousTicker() {\n", " this.define({\n", " num_minor_ticks: [p.Number, 5],\n", " desired_num_ticks: [p.Number, 6],\n", " });\n", " }\n", " get_ticks(data_low, data_high, _range, cross_loc, _) {\n", " return this.get_ticks_no_defaults(data_low, data_high, cross_loc, this.desired_num_ticks);\n", " }\n", " // The version of get_ticks() that does the work (and the version that\n", " // should be overridden in subclasses).\n", " get_ticks_no_defaults(data_low, data_high, _cross_loc, desired_n_ticks) {\n", " const interval = this.get_interval(data_low, data_high, desired_n_ticks);\n", " const start_factor = Math.floor(data_low / interval);\n", " const end_factor = Math.ceil(data_high / interval);\n", " let factors;\n", " if (isNaN(start_factor) || isNaN(end_factor))\n", " factors = [];\n", " else\n", " factors = array_1.range(start_factor, end_factor + 1);\n", " const ticks = factors\n", " .map((factor) => factor * interval)\n", " .filter((tick) => data_low <= tick && tick <= data_high);\n", " const num_minor_ticks = this.num_minor_ticks;\n", " const minor_ticks = [];\n", " if (num_minor_ticks > 0 && ticks.length > 0) {\n", " const minor_interval = interval / num_minor_ticks;\n", " const minor_offsets = array_1.range(0, num_minor_ticks).map((i) => i * minor_interval);\n", " for (const x of minor_offsets.slice(1)) {\n", " const mt = ticks[0] - x;\n", " if (data_low <= mt && mt <= data_high) {\n", " minor_ticks.push(mt);\n", " }\n", " }\n", " for (const tick of ticks) {\n", " for (const x of minor_offsets) {\n", " const mt = tick + x;\n", " if (data_low <= mt && mt <= data_high) {\n", " minor_ticks.push(mt);\n", " }\n", " }\n", " }\n", " }\n", " return {\n", " major: ticks,\n", " minor: minor_ticks,\n", " };\n", " }\n", " // Returns the smallest interval that can be returned by get_interval().\n", " get_min_interval() {\n", " return this.min_interval;\n", " }\n", " // Returns the largest interval that can be returned by get_interval().\n", " get_max_interval() {\n", " return this.max_interval != null ? this.max_interval : Infinity;\n", " }\n", " // Returns the interval size that would produce exactly the number of\n", " // desired ticks. (In general we won't use exactly this interval, because\n", " // we want the ticks to be round numbers.)\n", " get_ideal_interval(data_low, data_high, desired_n_ticks) {\n", " const data_range = data_high - data_low;\n", " return data_range / desired_n_ticks;\n", " }\n", " }\n", " exports.ContinuousTicker = ContinuousTicker;\n", " ContinuousTicker.__name__ = \"ContinuousTicker\";\n", " ContinuousTicker.init_ContinuousTicker();\n", " },\n", " /* models/tickers/ticker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const model_1 = require(71) /* ../../model */;\n", " class Ticker extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " }\n", " exports.Ticker = Ticker;\n", " Ticker.__name__ = \"Ticker\";\n", " },\n", " /* models/formatters/basic_tick_formatter.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const tick_formatter_1 = require(114) /* ./tick_formatter */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class BasicTickFormatter extends tick_formatter_1.TickFormatter {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.last_precision = 3;\n", " }\n", " static init_BasicTickFormatter() {\n", " this.define({\n", " precision: [p.Any, 'auto'],\n", " use_scientific: [p.Boolean, true],\n", " power_limit_high: [p.Number, 5],\n", " power_limit_low: [p.Number, -3],\n", " });\n", " }\n", " get scientific_limit_low() {\n", " return 10.0 ** this.power_limit_low;\n", " }\n", " get scientific_limit_high() {\n", " return 10.0 ** this.power_limit_high;\n", " }\n", " _need_sci(ticks) {\n", " if (!this.use_scientific)\n", " return false;\n", " const { scientific_limit_high } = this;\n", " const { scientific_limit_low } = this;\n", " const zeroish = ticks.length < 2 ? 0 : Math.abs(ticks[1] - ticks[0]) / 10000;\n", " for (const tick of ticks) {\n", " const tick_abs = Math.abs(tick);\n", " if (tick_abs <= zeroish)\n", " continue;\n", " if (tick_abs >= scientific_limit_high || tick_abs <= scientific_limit_low) {\n", " return true;\n", " }\n", " }\n", " return false;\n", " }\n", " _format_with_precision(ticks, need_sci, precision) {\n", " const labels = new Array(ticks.length);\n", " if (need_sci) {\n", " for (let i = 0, end = ticks.length; i < end; i++) {\n", " labels[i] = ticks[i].toExponential(precision);\n", " }\n", " }\n", " else {\n", " for (let i = 0, end = ticks.length; i < end; i++) {\n", " // strip trailing zeros\n", " labels[i] = ticks[i].toFixed(precision).replace(/(\\.[0-9]*?)0+$/, \"$1\").replace(/\\.$/, \"\");\n", " }\n", " }\n", " return labels;\n", " }\n", " _auto_precision(ticks, need_sci) {\n", " const labels = new Array(ticks.length);\n", " const asc = this.last_precision <= 15;\n", " outer: for (let x = this.last_precision; asc ? x <= 15 : x >= 1; asc ? x++ : x--) {\n", " if (need_sci) {\n", " labels[0] = ticks[0].toExponential(x);\n", " for (let i = 1; i < ticks.length; i++) {\n", " if (labels[i] == labels[i - 1]) {\n", " continue outer;\n", " }\n", " }\n", " this.last_precision = x;\n", " break;\n", " }\n", " else {\n", " labels[0] = ticks[0].toFixed(x).replace(/(\\.[0-9]*?)0+$/, \"$1\").replace(/\\.$/, \"\");\n", " for (let i = 1; i < ticks.length; i++) {\n", " labels[i] = ticks[i].toFixed(x).replace(/(\\.[0-9]*?)0+$/, \"$1\").replace(/\\.$/, \"\");\n", " if (labels[i] == labels[i - 1]) {\n", " continue outer;\n", " }\n", " }\n", " this.last_precision = x;\n", " break;\n", " }\n", " }\n", " return this.last_precision;\n", " }\n", " doFormat(ticks, _opts) {\n", " if (ticks.length == 0)\n", " return [];\n", " const need_sci = this._need_sci(ticks);\n", " const precision = this.precision == \"auto\" ? this._auto_precision(ticks, need_sci) : this.precision;\n", " return this._format_with_precision(ticks, need_sci, precision);\n", " }\n", " }\n", " exports.BasicTickFormatter = BasicTickFormatter;\n", " BasicTickFormatter.__name__ = \"BasicTickFormatter\";\n", " BasicTickFormatter.init_BasicTickFormatter();\n", " },\n", " /* models/formatters/tick_formatter.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const model_1 = require(71) /* ../../model */;\n", " class TickFormatter extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " }\n", " exports.TickFormatter = TickFormatter;\n", " TickFormatter.__name__ = \"TickFormatter\";\n", " },\n", " /* models/mappers/linear_color_mapper.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const continuous_color_mapper_1 = require(116) /* ./continuous_color_mapper */;\n", " const arrayable_1 = require(12) /* ../../core/util/arrayable */;\n", " class LinearColorMapper extends continuous_color_mapper_1.ContinuousColorMapper {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " _v_compute(data, values, palette, colors) {\n", " const { nan_color, low_color, high_color } = colors;\n", " const low = this.low != null ? this.low : arrayable_1.min(data);\n", " const high = this.high != null ? this.high : arrayable_1.max(data);\n", " const max_key = palette.length - 1;\n", " const norm_factor = 1 / (high - low);\n", " const normed_interval = 1 / palette.length;\n", " for (let i = 0, end = data.length; i < end; i++) {\n", " const d = data[i];\n", " if (isNaN(d)) {\n", " values[i] = nan_color;\n", " continue;\n", " }\n", " // This handles the edge case where d == high, since the code below maps\n", " // values exactly equal to high to palette.length, which is greater than\n", " // max_key\n", " if (d == high) {\n", " values[i] = palette[max_key];\n", " continue;\n", " }\n", " const normed_d = (d - low) * norm_factor;\n", " const key = Math.floor(normed_d / normed_interval);\n", " if (key < 0)\n", " values[i] = low_color != null ? low_color : palette[0];\n", " else if (key > max_key)\n", " values[i] = high_color != null ? high_color : palette[max_key];\n", " else\n", " values[i] = palette[key];\n", " }\n", " }\n", " }\n", " exports.LinearColorMapper = LinearColorMapper;\n", " LinearColorMapper.__name__ = \"LinearColorMapper\";\n", " },\n", " /* models/mappers/continuous_color_mapper.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const color_mapper_1 = require(117) /* ./color_mapper */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class ContinuousColorMapper extends color_mapper_1.ColorMapper {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ContinuousColorMapper() {\n", " this.define({\n", " high: [p.Number],\n", " low: [p.Number],\n", " high_color: [p.Color],\n", " low_color: [p.Color],\n", " });\n", " }\n", " _colors(conv) {\n", " return Object.assign(Object.assign({}, super._colors(conv)), { low_color: this.low_color != null ? conv(this.low_color) : undefined, high_color: this.high_color != null ? conv(this.high_color) : undefined });\n", " }\n", " }\n", " exports.ContinuousColorMapper = ContinuousColorMapper;\n", " ContinuousColorMapper.__name__ = \"ContinuousColorMapper\";\n", " ContinuousColorMapper.init_ContinuousColorMapper();\n", " },\n", " /* models/mappers/color_mapper.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const mapper_1 = require(118) /* ./mapper */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const color_1 = require(20) /* ../../core/util/color */;\n", " const compat_1 = require(28) /* ../../core/util/compat */;\n", " function _convert_color(color) {\n", " if (types_1.isNumber(color))\n", " return color;\n", " if (color[0] != \"#\")\n", " color = color_1.color2hex(color);\n", " if (color.length != 9)\n", " color = color + 'ff';\n", " return parseInt(color.slice(1), 16);\n", " }\n", " exports._convert_color = _convert_color;\n", " function _convert_palette(palette) {\n", " const new_palette = new Uint32Array(palette.length);\n", " for (let i = 0, end = palette.length; i < end; i++)\n", " new_palette[i] = _convert_color(palette[i]);\n", " return new_palette;\n", " }\n", " exports._convert_palette = _convert_palette;\n", " function _uint32_to_rgba(values) {\n", " if (compat_1.is_little_endian) {\n", " const view = new DataView(values.buffer);\n", " for (let i = 0, end = values.length; i < end; i++)\n", " view.setUint32(i * 4, values[i]);\n", " }\n", " return new Uint8Array(values.buffer);\n", " }\n", " exports._uint32_to_rgba = _uint32_to_rgba;\n", " class ColorMapper extends mapper_1.Mapper {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ColorMapper() {\n", " this.define({\n", " palette: [p.Any],\n", " nan_color: [p.Color, \"gray\"],\n", " });\n", " }\n", " v_compute(xs) {\n", " const values = new Array(xs.length);\n", " this._v_compute(xs, values, this.palette, this._colors((c) => c));\n", " return values;\n", " }\n", " get rgba_mapper() {\n", " const self = this;\n", " const palette = _convert_palette(this.palette);\n", " const colors = this._colors(_convert_color);\n", " return {\n", " v_compute(xs) {\n", " const values = new Uint32Array(xs.length);\n", " self._v_compute(xs, values, palette, colors);\n", " return _uint32_to_rgba(values);\n", " },\n", " };\n", " }\n", " _colors(conv) {\n", " return { nan_color: conv(this.nan_color) };\n", " }\n", " }\n", " exports.ColorMapper = ColorMapper;\n", " ColorMapper.__name__ = \"ColorMapper\";\n", " ColorMapper.init_ColorMapper();\n", " },\n", " /* models/mappers/mapper.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const transform_1 = require(119) /* ../transforms/transform */;\n", " class Mapper extends transform_1.Transform {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " compute(_x) {\n", " // If it's just a single value, then a mapper doesn't really make sense.\n", " throw new Error(\"mapping single values is not supported\");\n", " }\n", " }\n", " exports.Mapper = Mapper;\n", " Mapper.__name__ = \"Mapper\";\n", " },\n", " /* models/transforms/transform.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const model_1 = require(71) /* ../../model */;\n", " class Transform extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " }\n", " exports.Transform = Transform;\n", " Transform.__name__ = \"Transform\";\n", " },\n", " /* models/scales/linear_scale.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const continuous_scale_1 = require(121) /* ./continuous_scale */;\n", " class LinearScale extends continuous_scale_1.ContinuousScale {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " compute(x) {\n", " return this._linear_compute(x);\n", " }\n", " v_compute(xs) {\n", " return this._linear_v_compute(xs);\n", " }\n", " invert(xprime) {\n", " return this._linear_invert(xprime);\n", " }\n", " v_invert(xprimes) {\n", " return this._linear_v_invert(xprimes);\n", " }\n", " }\n", " exports.LinearScale = LinearScale;\n", " LinearScale.__name__ = \"LinearScale\";\n", " },\n", " /* models/scales/continuous_scale.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const scale_1 = require(122) /* ./scale */;\n", " class ContinuousScale extends scale_1.Scale {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " }\n", " exports.ContinuousScale = ContinuousScale;\n", " ContinuousScale.__name__ = \"ContinuousScale\";\n", " },\n", " /* models/scales/scale.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const transforms_1 = require(123) /* ../transforms */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class Scale extends transforms_1.Transform {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Scale() {\n", " this.internal({\n", " source_range: [p.Any],\n", " target_range: [p.Any],\n", " });\n", " }\n", " r_compute(x0, x1) {\n", " if (this.target_range.is_reversed)\n", " return [this.compute(x1), this.compute(x0)];\n", " else\n", " return [this.compute(x0), this.compute(x1)];\n", " }\n", " r_invert(sx0, sx1) {\n", " if (this.target_range.is_reversed)\n", " return [this.invert(sx1), this.invert(sx0)];\n", " else\n", " return [this.invert(sx0), this.invert(sx1)];\n", " }\n", " // These are needed by both LinearScale and CategoricalScale and this is the\n", " // only common ancestor. TODO: Proper MI/Mixin would be better.\n", " _linear_compute(x) {\n", " const [factor, offset] = this._linear_compute_state();\n", " return factor * x + offset;\n", " }\n", " _linear_v_compute(xs) {\n", " const [factor, offset] = this._linear_compute_state();\n", " const result = new Float64Array(xs.length);\n", " for (let i = 0; i < xs.length; i++)\n", " result[i] = factor * xs[i] + offset;\n", " return result;\n", " }\n", " _linear_invert(xprime) {\n", " const [factor, offset] = this._linear_compute_state();\n", " return (xprime - offset) / factor;\n", " }\n", " _linear_v_invert(xprimes) {\n", " const [factor, offset] = this._linear_compute_state();\n", " const result = new Float64Array(xprimes.length);\n", " for (let i = 0; i < xprimes.length; i++)\n", " result[i] = (xprimes[i] - offset) / factor;\n", " return result;\n", " }\n", " /*protected*/ _linear_compute_state() {\n", " //\n", " // (t1 - t0) (t1 - t0)\n", " // --------- * x - --------- * s0 + t0\n", " // (s1 - s0) (s1 - s0)\n", " //\n", " // [ factor ] [ offset ]\n", " //\n", " const source_start = this.source_range.start;\n", " const source_end = this.source_range.end;\n", " const target_start = this.target_range.start;\n", " const target_end = this.target_range.end;\n", " const factor = (target_end - target_start) / (source_end - source_start);\n", " const offset = -(factor * source_start) + target_start;\n", " return [factor, offset];\n", " }\n", " }\n", " exports.Scale = Scale;\n", " Scale.__name__ = \"Scale\";\n", " Scale.init_Scale();\n", " },\n", " /* models/transforms/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var customjs_transform_1 = require(124) /* ./customjs_transform */;\n", " exports.CustomJSTransform = customjs_transform_1.CustomJSTransform;\n", " var dodge_1 = require(125) /* ./dodge */;\n", " exports.Dodge = dodge_1.Dodge;\n", " var interpolator_1 = require(126) /* ./interpolator */;\n", " exports.Interpolator = interpolator_1.Interpolator;\n", " var jitter_1 = require(127) /* ./jitter */;\n", " exports.Jitter = jitter_1.Jitter;\n", " var linear_interpolator_1 = require(128) /* ./linear_interpolator */;\n", " exports.LinearInterpolator = linear_interpolator_1.LinearInterpolator;\n", " var step_interpolator_1 = require(129) /* ./step_interpolator */;\n", " exports.StepInterpolator = step_interpolator_1.StepInterpolator;\n", " var transform_1 = require(119) /* ./transform */;\n", " exports.Transform = transform_1.Transform;\n", " },\n", " /* models/transforms/customjs_transform.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const transform_1 = require(119) /* ./transform */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const object_1 = require(17) /* ../../core/util/object */;\n", " const string_1 = require(24) /* ../../core/util/string */;\n", " class CustomJSTransform extends transform_1.Transform {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_CustomJSTransform() {\n", " this.define({\n", " args: [p.Any, {}],\n", " func: [p.String, \"\"],\n", " v_func: [p.String, \"\"],\n", " });\n", " }\n", " get names() {\n", " return object_1.keys(this.args);\n", " }\n", " get values() {\n", " return object_1.values(this.args);\n", " }\n", " _make_transform(name, func) {\n", " return new Function(...this.names, name, string_1.use_strict(func));\n", " }\n", " get scalar_transform() {\n", " return this._make_transform(\"x\", this.func);\n", " }\n", " get vector_transform() {\n", " return this._make_transform(\"xs\", this.v_func);\n", " }\n", " compute(x) {\n", " return this.scalar_transform(...this.values, x);\n", " }\n", " v_compute(xs) {\n", " return this.vector_transform(...this.values, xs);\n", " }\n", " }\n", " exports.CustomJSTransform = CustomJSTransform;\n", " CustomJSTransform.__name__ = \"CustomJSTransform\";\n", " CustomJSTransform.init_CustomJSTransform();\n", " },\n", " /* models/transforms/dodge.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const transform_1 = require(119) /* ./transform */;\n", " const factor_range_1 = require(90) /* ../ranges/factor_range */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " class Dodge extends transform_1.Transform {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Dodge() {\n", " this.define({\n", " value: [p.Number, 0],\n", " range: [p.Instance],\n", " });\n", " }\n", " // XXX: this is repeated in ./jitter.ts\n", " v_compute(xs0) {\n", " let xs;\n", " if (this.range instanceof factor_range_1.FactorRange)\n", " xs = this.range.v_synthetic(xs0);\n", " else if (types_1.isArrayableOf(xs0, types_1.isNumber))\n", " xs = xs0;\n", " else\n", " throw new Error(\"unexpected\");\n", " const result = new Float64Array(xs.length);\n", " for (let i = 0; i < xs.length; i++) {\n", " const x = xs[i];\n", " result[i] = this._compute(x);\n", " }\n", " return result;\n", " }\n", " compute(x) {\n", " if (this.range instanceof factor_range_1.FactorRange)\n", " return this._compute(this.range.synthetic(x));\n", " else if (types_1.isNumber(x))\n", " return this._compute(x);\n", " else\n", " throw new Error(\"unexpected\");\n", " }\n", " _compute(x) {\n", " return x + this.value;\n", " }\n", " }\n", " exports.Dodge = Dodge;\n", " Dodge.__name__ = \"Dodge\";\n", " Dodge.init_Dodge();\n", " },\n", " /* models/transforms/interpolator.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const transform_1 = require(119) /* ./transform */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " class Interpolator extends transform_1.Transform {\n", " constructor(attrs) {\n", " super(attrs);\n", " this._sorted_dirty = true;\n", " }\n", " static init_Interpolator() {\n", " this.define({\n", " x: [p.Any],\n", " y: [p.Any],\n", " data: [p.Any],\n", " clip: [p.Boolean, true],\n", " });\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.change, () => this._sorted_dirty = true);\n", " }\n", " v_compute(xs) {\n", " const result = new Float64Array(xs.length);\n", " for (let i = 0; i < xs.length; i++) {\n", " const x = xs[i];\n", " result[i] = this.compute(x);\n", " }\n", " return result;\n", " }\n", " sort(descending = false) {\n", " if (!this._sorted_dirty)\n", " return;\n", " let tsx;\n", " let tsy;\n", " if (types_1.isString(this.x) && types_1.isString(this.y) && this.data != null) {\n", " const column_names = this.data.columns();\n", " if (!array_1.includes(column_names, this.x))\n", " throw new Error(\"The x parameter does not correspond to a valid column name defined in the data parameter\");\n", " if (!array_1.includes(column_names, this.y))\n", " throw new Error(\"The y parameter does not correspond to a valid column name defined in the data parameter\");\n", " tsx = this.data.get_column(this.x);\n", " tsy = this.data.get_column(this.y);\n", " }\n", " else if (types_1.isArray(this.x) && types_1.isArray(this.y)) {\n", " tsx = this.x;\n", " tsy = this.y;\n", " }\n", " else {\n", " throw new Error(\"parameters 'x' and 'y' must be both either string fields or arrays\");\n", " }\n", " if (tsx.length !== tsy.length)\n", " throw new Error(\"The length for x and y do not match\");\n", " if (tsx.length < 2)\n", " throw new Error(\"x and y must have at least two elements to support interpolation\");\n", " // The following sorting code is referenced from:\n", " // http://stackoverflow.com/questions/11499268/sort-two-arrays-the-same-way\n", " const list = [];\n", " for (const j in tsx) {\n", " list.push({ x: tsx[j], y: tsy[j] });\n", " }\n", " if (descending)\n", " list.sort((a, b) => a.x > b.x ? -1 : (a.x == b.x ? 0 : 1));\n", " else\n", " list.sort((a, b) => a.x < b.x ? -1 : (a.x == b.x ? 0 : 1));\n", " this._x_sorted = [];\n", " this._y_sorted = [];\n", " for (const { x, y } of list) {\n", " this._x_sorted.push(x);\n", " this._y_sorted.push(y);\n", " }\n", " this._sorted_dirty = false;\n", " }\n", " }\n", " exports.Interpolator = Interpolator;\n", " Interpolator.__name__ = \"Interpolator\";\n", " Interpolator.init_Interpolator();\n", " },\n", " /* models/transforms/jitter.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const transform_1 = require(119) /* ./transform */;\n", " const factor_range_1 = require(90) /* ../ranges/factor_range */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const bokeh_math = tslib_1.__importStar(require(10) /* ../../core/util/math */);\n", " class Jitter extends transform_1.Transform {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Jitter() {\n", " this.define({\n", " mean: [p.Number, 0],\n", " width: [p.Number, 1],\n", " distribution: [p.Distribution, 'uniform'],\n", " range: [p.Instance],\n", " });\n", " this.internal({\n", " previous_values: [p.Array],\n", " });\n", " }\n", " v_compute(xs0) {\n", " if (this.previous_values != null && this.previous_values.length == xs0.length)\n", " return this.previous_values;\n", " let xs;\n", " if (this.range instanceof factor_range_1.FactorRange)\n", " xs = this.range.v_synthetic(xs0);\n", " else if (types_1.isArrayableOf(xs0, types_1.isNumber))\n", " xs = xs0;\n", " else\n", " throw new Error(\"unexpected\");\n", " const result = new Float64Array(xs.length);\n", " for (let i = 0; i < xs.length; i++) {\n", " const x = xs[i];\n", " result[i] = this._compute(x);\n", " }\n", " this.previous_values = result;\n", " return result;\n", " }\n", " compute(x) {\n", " if (this.range instanceof factor_range_1.FactorRange)\n", " return this._compute(this.range.synthetic(x));\n", " else if (types_1.isNumber(x))\n", " return this._compute(x);\n", " else\n", " throw new Error(\"unexpected\");\n", " }\n", " _compute(x) {\n", " switch (this.distribution) {\n", " case \"uniform\":\n", " return x + this.mean + (bokeh_math.random() - 0.5) * this.width;\n", " case \"normal\":\n", " return x + bokeh_math.rnorm(this.mean, this.width);\n", " }\n", " }\n", " }\n", " exports.Jitter = Jitter;\n", " Jitter.__name__ = \"Jitter\";\n", " Jitter.init_Jitter();\n", " },\n", " /* models/transforms/linear_interpolator.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const interpolator_1 = require(126) /* ./interpolator */;\n", " class LinearInterpolator extends interpolator_1.Interpolator {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " compute(x) {\n", " this.sort(false);\n", " if (this.clip) {\n", " if (x < this._x_sorted[0] || x > this._x_sorted[this._x_sorted.length - 1])\n", " return NaN;\n", " }\n", " else {\n", " if (x < this._x_sorted[0])\n", " return this._y_sorted[0];\n", " if (x > this._x_sorted[this._x_sorted.length - 1])\n", " return this._y_sorted[this._y_sorted.length - 1];\n", " }\n", " if (x == this._x_sorted[0])\n", " return this._y_sorted[0];\n", " const ind = array_1.find_last_index(this._x_sorted, num => num < x);\n", " const x1 = this._x_sorted[ind];\n", " const x2 = this._x_sorted[ind + 1];\n", " const y1 = this._y_sorted[ind];\n", " const y2 = this._y_sorted[ind + 1];\n", " return y1 + (((x - x1) / (x2 - x1)) * (y2 - y1));\n", " }\n", " }\n", " exports.LinearInterpolator = LinearInterpolator;\n", " LinearInterpolator.__name__ = \"LinearInterpolator\";\n", " },\n", " /* models/transforms/step_interpolator.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const interpolator_1 = require(126) /* ./interpolator */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " class StepInterpolator extends interpolator_1.Interpolator {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_StepInterpolator() {\n", " this.define({\n", " mode: [p.StepMode, \"after\"],\n", " });\n", " }\n", " compute(x) {\n", " this.sort(false);\n", " if (this.clip) {\n", " if (x < this._x_sorted[0] || x > this._x_sorted[this._x_sorted.length - 1])\n", " return NaN;\n", " }\n", " else {\n", " if (x < this._x_sorted[0])\n", " return this._y_sorted[0];\n", " if (x > this._x_sorted[this._x_sorted.length - 1])\n", " return this._y_sorted[this._y_sorted.length - 1];\n", " }\n", " let ind;\n", " switch (this.mode) {\n", " case \"after\": {\n", " ind = array_1.find_last_index(this._x_sorted, num => x >= num);\n", " break;\n", " }\n", " case \"before\": {\n", " ind = array_1.find_index(this._x_sorted, num => x <= num);\n", " break;\n", " }\n", " case \"center\": {\n", " const diffs = this._x_sorted.map((tx) => Math.abs(tx - x));\n", " const mdiff = array_1.min(diffs);\n", " ind = array_1.find_index(diffs, num => mdiff === num);\n", " break;\n", " }\n", " default:\n", " throw new Error(`unknown mode: ${this.mode}`);\n", " }\n", " return ind != -1 ? this._y_sorted[ind] : NaN;\n", " }\n", " }\n", " exports.StepInterpolator = StepInterpolator;\n", " StepInterpolator.__name__ = \"StepInterpolator\";\n", " StepInterpolator.init_StepInterpolator();\n", " },\n", " /* models/scales/log_scale.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const continuous_scale_1 = require(121) /* ./continuous_scale */;\n", " class LogScale extends continuous_scale_1.ContinuousScale {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " compute(x) {\n", " const [factor, offset, inter_factor, inter_offset] = this._compute_state();\n", " let value;\n", " if (inter_factor == 0)\n", " value = 0;\n", " else {\n", " const _x = (Math.log(x) - inter_offset) / inter_factor;\n", " if (isFinite(_x))\n", " value = _x * factor + offset;\n", " else\n", " value = NaN;\n", " }\n", " return value;\n", " }\n", " v_compute(xs) {\n", " const [factor, offset, inter_factor, inter_offset] = this._compute_state();\n", " const result = new Float64Array(xs.length);\n", " if (inter_factor == 0) {\n", " for (let i = 0; i < xs.length; i++)\n", " result[i] = 0;\n", " }\n", " else {\n", " for (let i = 0; i < xs.length; i++) {\n", " const _x = (Math.log(xs[i]) - inter_offset) / inter_factor;\n", " let value;\n", " if (isFinite(_x))\n", " value = _x * factor + offset;\n", " else\n", " value = NaN;\n", " result[i] = value;\n", " }\n", " }\n", " return result;\n", " }\n", " invert(xprime) {\n", " const [factor, offset, inter_factor, inter_offset] = this._compute_state();\n", " const value = (xprime - offset) / factor;\n", " return Math.exp(inter_factor * value + inter_offset);\n", " }\n", " v_invert(xprimes) {\n", " const [factor, offset, inter_factor, inter_offset] = this._compute_state();\n", " const result = new Float64Array(xprimes.length);\n", " for (let i = 0; i < xprimes.length; i++) {\n", " const value = (xprimes[i] - offset) / factor;\n", " result[i] = Math.exp(inter_factor * value + inter_offset);\n", " }\n", " return result;\n", " }\n", " _get_safe_factor(orig_start, orig_end) {\n", " let start = orig_start < 0 ? 0 : orig_start;\n", " let end = orig_end < 0 ? 0 : orig_end;\n", " if (start == end) {\n", " if (start == 0)\n", " [start, end] = [1, 10];\n", " else {\n", " const log_val = Math.log(start) / Math.log(10);\n", " start = 10 ** Math.floor(log_val);\n", " if (Math.ceil(log_val) != Math.floor(log_val))\n", " end = 10 ** Math.ceil(log_val);\n", " else\n", " end = 10 ** (Math.ceil(log_val) + 1);\n", " }\n", " }\n", " return [start, end];\n", " }\n", " /*protected*/ _compute_state() {\n", " const source_start = this.source_range.start;\n", " const source_end = this.source_range.end;\n", " const target_start = this.target_range.start;\n", " const target_end = this.target_range.end;\n", " const screen_range = target_end - target_start;\n", " const [start, end] = this._get_safe_factor(source_start, source_end);\n", " let inter_factor;\n", " let inter_offset;\n", " if (start == 0) {\n", " inter_factor = Math.log(end);\n", " inter_offset = 0;\n", " }\n", " else {\n", " inter_factor = Math.log(end) - Math.log(start);\n", " inter_offset = Math.log(start);\n", " }\n", " const factor = screen_range;\n", " const offset = target_start;\n", " return [factor, offset, inter_factor, inter_offset];\n", " }\n", " }\n", " exports.LogScale = LogScale;\n", " LogScale.__name__ = \"LogScale\";\n", " },\n", " /* models/ranges/range1d.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const range_1 = require(91) /* ./range */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class Range1d extends range_1.Range {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Range1d() {\n", " this.define({\n", " start: [p.Number, 0],\n", " end: [p.Number, 1],\n", " reset_start: [p.Number],\n", " reset_end: [p.Number],\n", " });\n", " }\n", " _set_auto_bounds() {\n", " if (this.bounds == 'auto') {\n", " const min = Math.min(this.reset_start, this.reset_end);\n", " const max = Math.max(this.reset_start, this.reset_end);\n", " this.setv({ bounds: [min, max] }, { silent: true });\n", " }\n", " }\n", " initialize() {\n", " super.initialize();\n", " if (this.reset_start == null) {\n", " this.reset_start = this.start;\n", " }\n", " if (this.reset_end == null) {\n", " this.reset_end = this.end;\n", " }\n", " this._set_auto_bounds();\n", " }\n", " get min() {\n", " return Math.min(this.start, this.end);\n", " }\n", " get max() {\n", " return Math.max(this.start, this.end);\n", " }\n", " reset() {\n", " this._set_auto_bounds();\n", " if (this.start != this.reset_start || this.end != this.reset_end)\n", " this.setv({ start: this.reset_start, end: this.reset_end });\n", " else\n", " this.change.emit();\n", " }\n", " }\n", " exports.Range1d = Range1d;\n", " Range1d.__name__ = \"Range1d\";\n", " Range1d.init_Range1d();\n", " },\n", " /* core/util/text.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const dom_1 = require(68) /* ../dom */;\n", " const _font_cache = new Map();\n", " function measure_font(font) {\n", " const metrics = _font_cache.get(font);\n", " if (metrics != null)\n", " return metrics;\n", " const text = dom_1.span({ style: { font } }, \"Hg\");\n", " const block = dom_1.div({ style: { display: \"inline-block\", width: \"1px\", height: \"0px\" } });\n", " const elem = dom_1.div({}, text, block);\n", " document.body.appendChild(elem);\n", " try {\n", " block.style.verticalAlign = \"baseline\";\n", " const ascent = dom_1.offset(block).top - dom_1.offset(text).top;\n", " block.style.verticalAlign = \"bottom\";\n", " const height = dom_1.offset(block).top - dom_1.offset(text).top;\n", " const result = { height, ascent, descent: height - ascent };\n", " _font_cache.set(font, result);\n", " return result;\n", " }\n", " finally {\n", " document.body.removeChild(elem);\n", " }\n", " }\n", " exports.measure_font = measure_font;\n", " const _text_cache = new Map();\n", " function measure_text(text, font) {\n", " let size_cache = _text_cache.get(font);\n", " if (size_cache != null) {\n", " const size = size_cache.get(text);\n", " if (size != null)\n", " return size;\n", " }\n", " else {\n", " size_cache = new Map();\n", " _text_cache.set(font, size_cache);\n", " }\n", " const el = dom_1.div({ style: { display: \"inline-block\", \"white-space\": \"nowrap\", font } }, text);\n", " document.body.appendChild(el);\n", " try {\n", " const { width, height } = el.getBoundingClientRect();\n", " size_cache.set(text, { width, height });\n", " return { width, height };\n", " }\n", " finally {\n", " document.body.removeChild(el);\n", " }\n", " }\n", " exports.measure_text = measure_text;\n", " },\n", " /* models/annotations/label.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const text_annotation_1 = require(134) /* ./text_annotation */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const mixins = tslib_1.__importStar(require(23) /* ../../core/property_mixins */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class LabelView extends text_annotation_1.TextAnnotationView {\n", " initialize() {\n", " super.initialize();\n", " this.visuals.warm_cache();\n", " }\n", " _get_size() {\n", " const { ctx } = this.layer;\n", " this.visuals.text.set_value(ctx);\n", " const { width, ascent } = ctx.measureText(this.model.text);\n", " return { width, height: ascent };\n", " }\n", " render() {\n", " if (!this.model.visible && this.model.render_mode == 'css')\n", " dom_1.undisplay(this.el);\n", " if (!this.model.visible)\n", " return;\n", " // Here because AngleSpec does units transform and label doesn't support specs\n", " let angle;\n", " switch (this.model.angle_units) {\n", " case \"rad\": {\n", " angle = -this.model.angle;\n", " break;\n", " }\n", " case \"deg\": {\n", " angle = (-this.model.angle * Math.PI) / 180.0;\n", " break;\n", " }\n", " }\n", " const panel = this.panel != null ? this.panel : this.plot_view.frame;\n", " const xscale = this.plot_view.frame.xscales[this.model.x_range_name];\n", " const yscale = this.plot_view.frame.yscales[this.model.y_range_name];\n", " let sx = this.model.x_units == \"data\" ? xscale.compute(this.model.x) : panel.xview.compute(this.model.x);\n", " let sy = this.model.y_units == \"data\" ? yscale.compute(this.model.y) : panel.yview.compute(this.model.y);\n", " sx += this.model.x_offset;\n", " sy -= this.model.y_offset;\n", " const draw = this.model.render_mode == 'canvas' ? this._canvas_text.bind(this) : this._css_text.bind(this);\n", " draw(this.layer.ctx, this.model.text, sx, sy, angle);\n", " }\n", " }\n", " exports.LabelView = LabelView;\n", " LabelView.__name__ = \"LabelView\";\n", " class Label extends text_annotation_1.TextAnnotation {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Label() {\n", " this.prototype.default_view = LabelView;\n", " this.mixins([\n", " mixins.Text /*Scalar*/,\n", " [\"border_\", mixins.Line],\n", " [\"background_\", mixins.Fill],\n", " ]);\n", " this.define({\n", " x: [p.Number],\n", " x_units: [p.SpatialUnits, 'data'],\n", " y: [p.Number],\n", " y_units: [p.SpatialUnits, 'data'],\n", " text: [p.String],\n", " angle: [p.Angle, 0],\n", " angle_units: [p.AngleUnits, 'rad'],\n", " x_offset: [p.Number, 0],\n", " y_offset: [p.Number, 0],\n", " x_range_name: [p.String, 'default'],\n", " y_range_name: [p.String, 'default'],\n", " });\n", " this.override({\n", " background_fill_color: null,\n", " border_line_color: null,\n", " });\n", " }\n", " }\n", " exports.Label = Label;\n", " Label.__name__ = \"Label\";\n", " Label.init_Label();\n", " },\n", " /* models/annotations/text_annotation.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const annotation_1 = require(31) /* ./annotation */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const text_1 = require(132) /* ../../core/util/text */;\n", " const assert_1 = require(11) /* ../../core/util/assert */;\n", " class TextAnnotationView extends annotation_1.AnnotationView {\n", " constructor() {\n", " super(...arguments);\n", " this.rotate = true;\n", " }\n", " initialize() {\n", " super.initialize();\n", " if (this.model.render_mode == 'css') {\n", " this.plot_view.canvas_view.add_overlay(this.el);\n", " }\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " if (this.model.render_mode == 'css') {\n", " // dispatch CSS update immediately\n", " this.connect(this.model.change, () => this.render());\n", " }\n", " else {\n", " this.connect(this.model.change, () => this.plot_view.request_render());\n", " }\n", " }\n", " _calculate_text_dimensions(ctx, text) {\n", " const { width } = ctx.measureText(text);\n", " const { height } = text_1.measure_font(this.visuals.text.font_value());\n", " return [width, height];\n", " }\n", " _calculate_bounding_box_dimensions(ctx, text) {\n", " const [width, height] = this._calculate_text_dimensions(ctx, text);\n", " let x_offset;\n", " switch (ctx.textAlign) {\n", " case 'left':\n", " x_offset = 0;\n", " break;\n", " case 'center':\n", " x_offset = -width / 2;\n", " break;\n", " case 'right':\n", " x_offset = -width;\n", " break;\n", " default:\n", " assert_1.unreachable();\n", " }\n", " // guestimated from https://www.w3.org/TR/2dcontext/#dom-context-2d-textbaseline\n", " let y_offset;\n", " switch (ctx.textBaseline) {\n", " case 'top':\n", " y_offset = 0.0;\n", " break;\n", " case 'middle':\n", " y_offset = -0.5 * height;\n", " break;\n", " case 'bottom':\n", " y_offset = -1.0 * height;\n", " break;\n", " case 'alphabetic':\n", " y_offset = -0.8 * height;\n", " break;\n", " case 'hanging':\n", " y_offset = -0.17 * height;\n", " break;\n", " case 'ideographic':\n", " y_offset = -0.83 * height;\n", " break;\n", " default:\n", " assert_1.unreachable();\n", " }\n", " return [x_offset, y_offset, width, height];\n", " }\n", " _canvas_text(ctx, text, sx, sy, angle) {\n", " this.visuals.text.set_value(ctx);\n", " const bbox_dims = this._calculate_bounding_box_dimensions(ctx, text);\n", " ctx.save();\n", " ctx.beginPath();\n", " ctx.translate(sx, sy);\n", " if (angle)\n", " ctx.rotate(angle);\n", " ctx.rect(bbox_dims[0], bbox_dims[1], bbox_dims[2], bbox_dims[3]);\n", " if (this.visuals.background_fill.doit) {\n", " this.visuals.background_fill.set_value(ctx);\n", " ctx.fill();\n", " }\n", " if (this.visuals.border_line.doit) {\n", " this.visuals.border_line.set_value(ctx);\n", " ctx.stroke();\n", " }\n", " if (this.visuals.text.doit) {\n", " this.visuals.text.set_value(ctx);\n", " ctx.fillText(text, 0, 0);\n", " }\n", " ctx.restore();\n", " }\n", " _css_text(ctx, text, sx, sy, angle) {\n", " dom_1.undisplay(this.el);\n", " this.visuals.text.set_value(ctx);\n", " const bbox_dims = this._calculate_bounding_box_dimensions(ctx, text);\n", " // attempt to support vector string-style (\"8 4 8\") line dashing for css mode\n", " const ld = this.visuals.border_line.line_dash.value();\n", " const line_dash = ld.length < 2 ? \"solid\" : \"dashed\";\n", " this.visuals.border_line.set_value(ctx);\n", " this.visuals.background_fill.set_value(ctx);\n", " this.el.style.position = 'absolute';\n", " this.el.style.left = `${sx + bbox_dims[0]}px`;\n", " this.el.style.top = `${sy + bbox_dims[1]}px`;\n", " this.el.style.color = `${this.visuals.text.text_color.value()}`;\n", " this.el.style.opacity = `${this.visuals.text.text_alpha.value()}`;\n", " this.el.style.font = `${this.visuals.text.font_value()}`;\n", " this.el.style.lineHeight = \"normal\"; // needed to prevent ipynb css override\n", " if (angle) {\n", " this.el.style.transform = `rotate(${angle}rad)`;\n", " }\n", " if (this.visuals.background_fill.doit) {\n", " this.el.style.backgroundColor = `${this.visuals.background_fill.color_value()}`;\n", " }\n", " if (this.visuals.border_line.doit) {\n", " this.el.style.borderStyle = `${line_dash}`;\n", " this.el.style.borderWidth = `${this.visuals.border_line.line_width.value()}px`;\n", " this.el.style.borderColor = `${this.visuals.border_line.color_value()}`;\n", " }\n", " this.el.textContent = text;\n", " dom_1.display(this.el);\n", " }\n", " }\n", " exports.TextAnnotationView = TextAnnotationView;\n", " TextAnnotationView.__name__ = \"TextAnnotationView\";\n", " class TextAnnotation extends annotation_1.Annotation {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_TextAnnotation() {\n", " this.define({\n", " render_mode: [p.RenderMode, \"canvas\"],\n", " });\n", " }\n", " }\n", " exports.TextAnnotation = TextAnnotation;\n", " TextAnnotation.__name__ = \"TextAnnotation\";\n", " TextAnnotation.init_TextAnnotation();\n", " },\n", " /* models/annotations/label_set.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const text_annotation_1 = require(134) /* ./text_annotation */;\n", " const column_data_source_1 = require(76) /* ../sources/column_data_source */;\n", " const mixins = tslib_1.__importStar(require(23) /* ../../core/property_mixins */);\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class LabelSetView extends text_annotation_1.TextAnnotationView {\n", " initialize() {\n", " super.initialize();\n", " this.set_data(this.model.source);\n", " if (this.model.render_mode == 'css') {\n", " for (let i = 0, end = this._text.length; i < end; i++) {\n", " const el = dom_1.div({ style: { display: \"none\" } });\n", " this.el.appendChild(el);\n", " }\n", " }\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " if (this.model.render_mode == 'css') {\n", " // dispatch CSS update immediately\n", " this.connect(this.model.change, () => {\n", " this.set_data(this.model.source);\n", " this.render();\n", " });\n", " this.connect(this.model.source.streaming, () => {\n", " this.set_data(this.model.source);\n", " this.render();\n", " });\n", " this.connect(this.model.source.patching, () => {\n", " this.set_data(this.model.source);\n", " this.render();\n", " });\n", " this.connect(this.model.source.change, () => {\n", " this.set_data(this.model.source);\n", " this.render();\n", " });\n", " }\n", " else {\n", " this.connect(this.model.change, () => {\n", " this.set_data(this.model.source);\n", " this.plot_view.request_render();\n", " });\n", " this.connect(this.model.source.streaming, () => {\n", " this.set_data(this.model.source);\n", " this.plot_view.request_render();\n", " });\n", " this.connect(this.model.source.patching, () => {\n", " this.set_data(this.model.source);\n", " this.plot_view.request_render();\n", " });\n", " this.connect(this.model.source.change, () => {\n", " this.set_data(this.model.source);\n", " this.plot_view.request_render();\n", " });\n", " }\n", " }\n", " set_data(source) {\n", " super.set_data(source);\n", " this.visuals.warm_cache(source);\n", " }\n", " _map_data() {\n", " const xscale = this.plot_view.frame.xscales[this.model.x_range_name];\n", " const yscale = this.plot_view.frame.yscales[this.model.y_range_name];\n", " const panel = this.panel != null ? this.panel : this.plot_view.frame;\n", " const sx = this.model.x_units == \"data\" ? xscale.v_compute(this._x) : panel.xview.v_compute(this._x);\n", " const sy = this.model.y_units == \"data\" ? yscale.v_compute(this._y) : panel.yview.v_compute(this._y);\n", " return [sx, sy];\n", " }\n", " render() {\n", " if (!this.model.visible && this.model.render_mode == 'css')\n", " dom_1.undisplay(this.el);\n", " if (!this.model.visible)\n", " return;\n", " const draw = this.model.render_mode == 'canvas' ? this._v_canvas_text.bind(this) : this._v_css_text.bind(this);\n", " const { ctx } = this.layer;\n", " const [sx, sy] = this._map_data();\n", " for (let i = 0, end = this._text.length; i < end; i++) {\n", " draw(ctx, i, this._text[i], sx[i] + this._x_offset[i], sy[i] - this._y_offset[i], this._angle[i]);\n", " }\n", " }\n", " _get_size() {\n", " const { ctx } = this.layer;\n", " this.visuals.text.set_value(ctx);\n", " const { width, ascent } = ctx.measureText(this._text[0]);\n", " return { width, height: ascent };\n", " }\n", " _v_canvas_text(ctx, i, text, sx, sy, angle) {\n", " this.visuals.text.set_vectorize(ctx, i);\n", " const bbox_dims = this._calculate_bounding_box_dimensions(ctx, text);\n", " ctx.save();\n", " ctx.beginPath();\n", " ctx.translate(sx, sy);\n", " ctx.rotate(angle);\n", " ctx.rect(bbox_dims[0], bbox_dims[1], bbox_dims[2], bbox_dims[3]);\n", " if (this.visuals.background_fill.doit) {\n", " this.visuals.background_fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (this.visuals.border_line.doit) {\n", " this.visuals.border_line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " if (this.visuals.text.doit) {\n", " this.visuals.text.set_vectorize(ctx, i);\n", " ctx.fillText(text, 0, 0);\n", " }\n", " ctx.restore();\n", " }\n", " _v_css_text(ctx, i, text, sx, sy, angle) {\n", " const el = this.el.children[i];\n", " el.textContent = text;\n", " this.visuals.text.set_vectorize(ctx, i);\n", " const bbox_dims = this._calculate_bounding_box_dimensions(ctx, text);\n", " // attempt to support vector-style (\"8 4 8\") line dashing for css mode\n", " const ld = this.visuals.border_line.line_dash.value();\n", " const line_dash = ld.length < 2 ? \"solid\" : \"dashed\";\n", " this.visuals.border_line.set_vectorize(ctx, i);\n", " this.visuals.background_fill.set_vectorize(ctx, i);\n", " el.style.position = 'absolute';\n", " el.style.left = `${sx + bbox_dims[0]}px`;\n", " el.style.top = `${sy + bbox_dims[1]}px`;\n", " el.style.color = `${this.visuals.text.text_color.value()}`;\n", " el.style.opacity = `${this.visuals.text.text_alpha.value()}`;\n", " el.style.font = `${this.visuals.text.font_value()}`;\n", " el.style.lineHeight = \"normal\"; // needed to prevent ipynb css override\n", " if (angle) {\n", " el.style.transform = `rotate(${angle}rad)`;\n", " }\n", " if (this.visuals.background_fill.doit) {\n", " el.style.backgroundColor = `${this.visuals.background_fill.color_value()}`;\n", " }\n", " if (this.visuals.border_line.doit) {\n", " el.style.borderStyle = `${line_dash}`;\n", " el.style.borderWidth = `${this.visuals.border_line.line_width.value()}px`;\n", " el.style.borderColor = `${this.visuals.border_line.color_value()}`;\n", " }\n", " dom_1.display(el);\n", " }\n", " }\n", " exports.LabelSetView = LabelSetView;\n", " LabelSetView.__name__ = \"LabelSetView\";\n", " class LabelSet extends text_annotation_1.TextAnnotation {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_LabelSet() {\n", " this.prototype.default_view = LabelSetView;\n", " this.mixins([\n", " mixins.TextVector,\n", " [\"border_\", mixins.LineVector],\n", " [\"background_\", mixins.FillVector],\n", " ]);\n", " this.define({\n", " x: [p.NumberSpec],\n", " y: [p.NumberSpec],\n", " x_units: [p.SpatialUnits, 'data'],\n", " y_units: [p.SpatialUnits, 'data'],\n", " text: [p.StringSpec, { field: \"text\" }],\n", " angle: [p.AngleSpec, 0],\n", " x_offset: [p.NumberSpec, { value: 0 }],\n", " y_offset: [p.NumberSpec, { value: 0 }],\n", " source: [p.Instance, () => new column_data_source_1.ColumnDataSource()],\n", " x_range_name: [p.String, 'default'],\n", " y_range_name: [p.String, 'default'],\n", " });\n", " this.override({\n", " background_fill_color: null,\n", " border_line_color: null,\n", " });\n", " }\n", " }\n", " exports.LabelSet = LabelSet;\n", " LabelSet.__name__ = \"LabelSet\";\n", " LabelSet.init_LabelSet();\n", " },\n", " /* models/annotations/legend.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const annotation_1 = require(31) /* ./annotation */;\n", " const mixins = tslib_1.__importStar(require(23) /* ../../core/property_mixins */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const signaling_1 = require(14) /* ../../core/signaling */;\n", " const text_1 = require(132) /* ../../core/util/text */;\n", " const bbox_1 = require(88) /* ../../core/util/bbox */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const assert_1 = require(11) /* ../../core/util/assert */;\n", " class LegendView extends annotation_1.AnnotationView {\n", " cursor(_sx, _sy) {\n", " return this.model.click_policy == \"none\" ? null : \"pointer\";\n", " }\n", " get legend_padding() {\n", " return this.visuals.border_line.line_color.value() != null ? this.model.padding : 0;\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.change, () => this.plot_view.request_render());\n", " this.connect(this.model.item_change, () => this.plot_view.request_render());\n", " }\n", " compute_legend_bbox() {\n", " const legend_names = this.model.get_legend_names();\n", " const { glyph_height, glyph_width } = this.model;\n", " const { label_height, label_width } = this.model;\n", " this.max_label_height = array_1.max([text_1.measure_font(this.visuals.label_text.font_value()).height, label_height, glyph_height]);\n", " // this is to measure text properties\n", " const { ctx } = this.layer;\n", " ctx.save();\n", " this.visuals.label_text.set_value(ctx);\n", " this.text_widths = new Map();\n", " for (const name of legend_names) {\n", " this.text_widths.set(name, array_1.max([ctx.measureText(name).width, label_width]));\n", " }\n", " this.visuals.title_text.set_value(ctx);\n", " this.title_height = this.model.title ? text_1.measure_font(this.visuals.title_text.font_value()).height + this.model.title_standoff : 0;\n", " this.title_width = this.model.title ? ctx.measureText(this.model.title).width : 0;\n", " ctx.restore();\n", " const max_label_width = Math.max(array_1.max([...this.text_widths.values()]), 0);\n", " const legend_margin = this.model.margin;\n", " const { legend_padding } = this;\n", " const legend_spacing = this.model.spacing;\n", " const { label_standoff } = this.model;\n", " let legend_height, legend_width;\n", " if (this.model.orientation == \"vertical\") {\n", " legend_height = legend_names.length * this.max_label_height + Math.max(legend_names.length - 1, 0) * legend_spacing + 2 * legend_padding + this.title_height;\n", " legend_width = array_1.max([(max_label_width + glyph_width + label_standoff + 2 * legend_padding), this.title_width + 2 * legend_padding]);\n", " }\n", " else {\n", " let item_width = 2 * legend_padding + Math.max(legend_names.length - 1, 0) * legend_spacing;\n", " for (const [, width] of this.text_widths) {\n", " item_width += array_1.max([width, label_width]) + glyph_width + label_standoff;\n", " }\n", " legend_width = array_1.max([this.title_width + 2 * legend_padding, item_width]);\n", " legend_height = this.max_label_height + this.title_height + 2 * legend_padding;\n", " }\n", " const panel = this.panel != null ? this.panel : this.plot_view.frame;\n", " const [hr, vr] = panel.bbox.ranges;\n", " const { location } = this.model;\n", " let sx, sy;\n", " if (types_1.isString(location)) {\n", " switch (location) {\n", " case 'top_left':\n", " sx = hr.start + legend_margin;\n", " sy = vr.start + legend_margin;\n", " break;\n", " case 'top_center':\n", " sx = (hr.end + hr.start) / 2 - legend_width / 2;\n", " sy = vr.start + legend_margin;\n", " break;\n", " case 'top_right':\n", " sx = hr.end - legend_margin - legend_width;\n", " sy = vr.start + legend_margin;\n", " break;\n", " case 'bottom_right':\n", " sx = hr.end - legend_margin - legend_width;\n", " sy = vr.end - legend_margin - legend_height;\n", " break;\n", " case 'bottom_center':\n", " sx = (hr.end + hr.start) / 2 - legend_width / 2;\n", " sy = vr.end - legend_margin - legend_height;\n", " break;\n", " case 'bottom_left':\n", " sx = hr.start + legend_margin;\n", " sy = vr.end - legend_margin - legend_height;\n", " break;\n", " case 'center_left':\n", " sx = hr.start + legend_margin;\n", " sy = (vr.end + vr.start) / 2 - legend_height / 2;\n", " break;\n", " case 'center':\n", " sx = (hr.end + hr.start) / 2 - legend_width / 2;\n", " sy = (vr.end + vr.start) / 2 - legend_height / 2;\n", " break;\n", " case 'center_right':\n", " sx = hr.end - legend_margin - legend_width;\n", " sy = (vr.end + vr.start) / 2 - legend_height / 2;\n", " break;\n", " }\n", " }\n", " else if (types_1.isArray(location) && location.length == 2) {\n", " const [vx, vy] = location;\n", " sx = panel.xview.compute(vx);\n", " sy = panel.yview.compute(vy) - legend_height;\n", " }\n", " else\n", " assert_1.unreachable();\n", " return new bbox_1.BBox({ left: sx, top: sy, width: legend_width, height: legend_height });\n", " }\n", " interactive_bbox() {\n", " return this.compute_legend_bbox();\n", " }\n", " interactive_hit(sx, sy) {\n", " const bbox = this.interactive_bbox();\n", " return bbox.contains(sx, sy);\n", " }\n", " on_hit(sx, sy) {\n", " let yoffset;\n", " const { glyph_width } = this.model;\n", " const { legend_padding } = this;\n", " const legend_spacing = this.model.spacing;\n", " const { label_standoff } = this.model;\n", " let xoffset = (yoffset = legend_padding);\n", " const legend_bbox = this.compute_legend_bbox();\n", " const vertical = this.model.orientation == \"vertical\";\n", " for (const item of this.model.items) {\n", " const labels = item.get_labels_list_from_label_prop();\n", " for (const label of labels) {\n", " const x1 = legend_bbox.x + xoffset;\n", " const y1 = legend_bbox.y + yoffset + this.title_height;\n", " let w, h;\n", " if (vertical)\n", " [w, h] = [legend_bbox.width - 2 * legend_padding, this.max_label_height];\n", " else\n", " [w, h] = [this.text_widths.get(label) + glyph_width + label_standoff, this.max_label_height];\n", " const bbox = new bbox_1.BBox({ left: x1, top: y1, width: w, height: h });\n", " if (bbox.contains(sx, sy)) {\n", " switch (this.model.click_policy) {\n", " case \"hide\": {\n", " for (const r of item.renderers)\n", " r.visible = !r.visible;\n", " break;\n", " }\n", " case \"mute\": {\n", " for (const r of item.renderers)\n", " r.muted = !r.muted;\n", " break;\n", " }\n", " }\n", " return true;\n", " }\n", " if (vertical)\n", " yoffset += this.max_label_height + legend_spacing;\n", " else\n", " xoffset += this.text_widths.get(label) + glyph_width + label_standoff + legend_spacing;\n", " }\n", " }\n", " return false;\n", " }\n", " render() {\n", " if (!this.model.visible)\n", " return;\n", " if (this.model.items.length == 0)\n", " return;\n", " // set a backref on render so that items can later signal item_change upates\n", " // on the model to trigger a re-render\n", " for (const item of this.model.items) {\n", " item.legend = this.model;\n", " }\n", " const { ctx } = this.layer;\n", " const bbox = this.compute_legend_bbox();\n", " ctx.save();\n", " this._draw_legend_box(ctx, bbox);\n", " this._draw_legend_items(ctx, bbox);\n", " if (this.model.title)\n", " this._draw_title(ctx, bbox);\n", " ctx.restore();\n", " }\n", " _draw_legend_box(ctx, bbox) {\n", " ctx.beginPath();\n", " ctx.rect(bbox.x, bbox.y, bbox.width, bbox.height);\n", " this.visuals.background_fill.set_value(ctx);\n", " ctx.fill();\n", " if (this.visuals.border_line.doit) {\n", " this.visuals.border_line.set_value(ctx);\n", " ctx.stroke();\n", " }\n", " }\n", " _draw_legend_items(ctx, bbox) {\n", " const { glyph_width, glyph_height } = this.model;\n", " const { legend_padding } = this;\n", " const legend_spacing = this.model.spacing;\n", " const { label_standoff } = this.model;\n", " let xoffset = legend_padding;\n", " let yoffset = legend_padding;\n", " const vertical = this.model.orientation == \"vertical\";\n", " for (const item of this.model.items) {\n", " const labels = item.get_labels_list_from_label_prop();\n", " const field = item.get_field_from_label_prop();\n", " if (labels.length == 0)\n", " continue;\n", " const active = (() => {\n", " switch (this.model.click_policy) {\n", " case \"none\": return true;\n", " case \"hide\": return array_1.every(item.renderers, r => r.visible);\n", " case \"mute\": return array_1.every(item.renderers, r => !r.muted);\n", " }\n", " })();\n", " for (const label of labels) {\n", " const x1 = bbox.x + xoffset;\n", " const y1 = bbox.y + yoffset + this.title_height;\n", " const x2 = x1 + glyph_width;\n", " const y2 = y1 + glyph_height;\n", " if (vertical)\n", " yoffset += this.max_label_height + legend_spacing;\n", " else\n", " xoffset += this.text_widths.get(label) + glyph_width + label_standoff + legend_spacing;\n", " this.visuals.label_text.set_value(ctx);\n", " ctx.fillText(label, x2 + label_standoff, y1 + this.max_label_height / 2.0);\n", " for (const r of item.renderers) {\n", " const view = this.plot_view.renderer_views.get(r);\n", " view.draw_legend(ctx, x1, x2, y1, y2, field, label, item.index);\n", " }\n", " if (!active) {\n", " let w, h;\n", " if (vertical)\n", " [w, h] = [bbox.width - 2 * legend_padding, this.max_label_height];\n", " else\n", " [w, h] = [this.text_widths.get(label) + glyph_width + label_standoff, this.max_label_height];\n", " ctx.beginPath();\n", " ctx.rect(x1, y1, w, h);\n", " this.visuals.inactive_fill.set_value(ctx);\n", " ctx.fill();\n", " }\n", " }\n", " }\n", " }\n", " _draw_title(ctx, bbox) {\n", " if (!this.visuals.title_text.doit)\n", " return;\n", " ctx.save();\n", " ctx.translate(bbox.x0, bbox.y0 + this.title_height);\n", " this.visuals.title_text.set_value(ctx);\n", " ctx.fillText(this.model.title, this.legend_padding, this.legend_padding - this.model.title_standoff);\n", " ctx.restore();\n", " }\n", " _get_size() {\n", " const { width, height } = this.compute_legend_bbox();\n", " return {\n", " width: width + 2 * this.model.margin,\n", " height: height + 2 * this.model.margin,\n", " };\n", " }\n", " }\n", " exports.LegendView = LegendView;\n", " LegendView.__name__ = \"LegendView\";\n", " class Legend extends annotation_1.Annotation {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.item_change = new signaling_1.Signal0(this, \"item_change\");\n", " }\n", " static init_Legend() {\n", " this.prototype.default_view = LegendView;\n", " this.mixins([\n", " [\"label_\", mixins.Text],\n", " [\"title_\", mixins.Text],\n", " [\"inactive_\", mixins.Fill],\n", " [\"border_\", mixins.Line],\n", " [\"background_\", mixins.Fill],\n", " ]);\n", " this.define({\n", " orientation: [p.Orientation, 'vertical'],\n", " location: [p.Any, 'top_right'],\n", " title: [p.String],\n", " title_standoff: [p.Number, 5],\n", " label_standoff: [p.Number, 5],\n", " glyph_height: [p.Number, 20],\n", " glyph_width: [p.Number, 20],\n", " label_height: [p.Number, 20],\n", " label_width: [p.Number, 20],\n", " margin: [p.Number, 10],\n", " padding: [p.Number, 10],\n", " spacing: [p.Number, 3],\n", " items: [p.Array, []],\n", " click_policy: [p.Any, \"none\"],\n", " });\n", " this.override({\n", " border_line_color: \"#e5e5e5\",\n", " border_line_alpha: 0.5,\n", " border_line_width: 1,\n", " background_fill_color: \"#ffffff\",\n", " background_fill_alpha: 0.95,\n", " inactive_fill_color: \"white\",\n", " inactive_fill_alpha: 0.7,\n", " label_text_font_size: \"13px\",\n", " label_text_baseline: \"middle\",\n", " title_text_font_size: \"13px\",\n", " title_text_font_style: \"italic\",\n", " });\n", " }\n", " get_legend_names() {\n", " const legend_names = [];\n", " for (const item of this.items) {\n", " const labels = item.get_labels_list_from_label_prop();\n", " legend_names.push(...labels);\n", " }\n", " return legend_names;\n", " }\n", " }\n", " exports.Legend = Legend;\n", " Legend.__name__ = \"Legend\";\n", " Legend.init_Legend();\n", " },\n", " /* models/annotations/legend_item.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const model_1 = require(71) /* ../../model */;\n", " const columnar_data_source_1 = require(77) /* ../sources/columnar_data_source */;\n", " const vectorization_1 = require(138) /* ../../core/vectorization */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const logging_1 = require(72) /* ../../core/logging */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " class LegendItem extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_LegendItem() {\n", " this.define({\n", " label: [p.StringSpec, null],\n", " renderers: [p.Array, []],\n", " index: [p.Number, null],\n", " });\n", " }\n", " /*protected*/ _check_data_sources_on_renderers() {\n", " const field = this.get_field_from_label_prop();\n", " if (field != null) {\n", " if (this.renderers.length < 1) {\n", " return false;\n", " }\n", " const source = this.renderers[0].data_source;\n", " if (source != null) {\n", " for (const r of this.renderers) {\n", " if (r.data_source != source) {\n", " return false;\n", " }\n", " }\n", " }\n", " }\n", " return true;\n", " }\n", " /*protected*/ _check_field_label_on_data_source() {\n", " const field = this.get_field_from_label_prop();\n", " if (field != null) {\n", " if (this.renderers.length < 1) {\n", " return false;\n", " }\n", " const source = this.renderers[0].data_source;\n", " if (source != null && !array_1.includes(source.columns(), field)) {\n", " return false;\n", " }\n", " }\n", " return true;\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.legend = null;\n", " this.connect(this.change, () => {\n", " if (this.legend != null)\n", " this.legend.item_change.emit();\n", " });\n", " // Validate data_sources match\n", " const data_source_validation = this._check_data_sources_on_renderers();\n", " if (!data_source_validation)\n", " logging_1.logger.error(\"Non matching data sources on legend item renderers\");\n", " // Validate label in data_source\n", " const field_validation = this._check_field_label_on_data_source();\n", " if (!field_validation)\n", " logging_1.logger.error(`Bad column name on label: ${this.label}`);\n", " }\n", " get_field_from_label_prop() {\n", " const { label } = this;\n", " return vectorization_1.isField(label) ? label.field : null;\n", " }\n", " get_labels_list_from_label_prop() {\n", " // Always return a list of the labels\n", " if (vectorization_1.isValue(this.label)) {\n", " const { value } = this.label;\n", " return value != null ? [value] : [];\n", " }\n", " const field = this.get_field_from_label_prop();\n", " if (field != null) {\n", " let source;\n", " if (this.renderers[0] && this.renderers[0].data_source != null)\n", " source = this.renderers[0].data_source;\n", " else\n", " return [\"No source found\"];\n", " if (source instanceof columnar_data_source_1.ColumnarDataSource) {\n", " const data = source.get_column(field);\n", " if (data != null)\n", " return array_1.uniq(Array.from(data));\n", " else\n", " return [\"Invalid field\"];\n", " }\n", " }\n", " return [];\n", " }\n", " }\n", " exports.LegendItem = LegendItem;\n", " LegendItem.__name__ = \"LegendItem\";\n", " LegendItem.init_LegendItem();\n", " },\n", " /* core/vectorization.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const types_1 = require(8) /* ./util/types */;\n", " function isValue(obj) {\n", " return types_1.isPlainObject(obj) && \"value\" in obj;\n", " }\n", " exports.isValue = isValue;\n", " function isField(obj) {\n", " return types_1.isPlainObject(obj) && \"field\" in obj;\n", " }\n", " exports.isField = isField;\n", " },\n", " /* models/annotations/poly_annotation.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const annotation_1 = require(31) /* ./annotation */;\n", " const mixins = tslib_1.__importStar(require(23) /* ../../core/property_mixins */);\n", " const signaling_1 = require(14) /* ../../core/signaling */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class PolyAnnotationView extends annotation_1.AnnotationView {\n", " connect_signals() {\n", " super.connect_signals();\n", " // need to respond to either normal BB change events or silent\n", " // \"data only updates\" that tools might want to use\n", " this.connect(this.model.change, () => this.plot_view.request_render());\n", " this.connect(this.model.data_update, () => this.plot_view.request_render());\n", " }\n", " render() {\n", " if (!this.model.visible)\n", " return;\n", " const { xs, ys } = this.model;\n", " if (xs.length != ys.length)\n", " return;\n", " if (xs.length < 3 || ys.length < 3)\n", " return;\n", " const { frame } = this.plot_view;\n", " const { ctx } = this.layer;\n", " for (let i = 0, end = xs.length; i < end; i++) {\n", " let sx;\n", " if (this.model.xs_units == 'screen')\n", " sx = this.model.screen ? xs[i] : frame.xview.compute(xs[i]);\n", " else\n", " throw new Error(\"not implemented\");\n", " let sy;\n", " if (this.model.ys_units == 'screen')\n", " sy = this.model.screen ? ys[i] : frame.yview.compute(ys[i]);\n", " else\n", " throw new Error(\"not implemented\");\n", " if (i == 0) {\n", " ctx.beginPath();\n", " ctx.moveTo(sx, sy);\n", " }\n", " else {\n", " ctx.lineTo(sx, sy);\n", " }\n", " }\n", " ctx.closePath();\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_value(ctx);\n", " ctx.stroke();\n", " }\n", " if (this.visuals.fill.doit) {\n", " this.visuals.fill.set_value(ctx);\n", " ctx.fill();\n", " }\n", " }\n", " }\n", " exports.PolyAnnotationView = PolyAnnotationView;\n", " PolyAnnotationView.__name__ = \"PolyAnnotationView\";\n", " class PolyAnnotation extends annotation_1.Annotation {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_PolyAnnotation() {\n", " this.prototype.default_view = PolyAnnotationView;\n", " this.mixins([mixins.Line /*Scalar*/, mixins.Fill /*Scalar*/]);\n", " this.define({\n", " xs: [p.Array, []],\n", " xs_units: [p.SpatialUnits, 'data'],\n", " ys: [p.Array, []],\n", " ys_units: [p.SpatialUnits, 'data'],\n", " x_range_name: [p.String, 'default'],\n", " y_range_name: [p.String, 'default'],\n", " });\n", " this.internal({\n", " screen: [p.Boolean, false],\n", " });\n", " this.override({\n", " fill_color: \"#fff9ba\",\n", " fill_alpha: 0.4,\n", " line_color: \"#cccccc\",\n", " line_alpha: 0.3,\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.data_update = new signaling_1.Signal0(this, \"data_update\");\n", " }\n", " update({ xs, ys }) {\n", " this.setv({ xs, ys, screen: true }, { silent: true });\n", " this.data_update.emit();\n", " }\n", " }\n", " exports.PolyAnnotation = PolyAnnotation;\n", " PolyAnnotation.__name__ = \"PolyAnnotation\";\n", " PolyAnnotation.init_PolyAnnotation();\n", " },\n", " /* models/annotations/slope.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const annotation_1 = require(31) /* ./annotation */;\n", " const mixins = tslib_1.__importStar(require(23) /* ../../core/property_mixins */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class SlopeView extends annotation_1.AnnotationView {\n", " initialize() {\n", " super.initialize();\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.change, () => this.plot_view.request_render());\n", " }\n", " render() {\n", " if (!this.model.visible)\n", " return;\n", " this._draw_slope();\n", " }\n", " _draw_slope() {\n", " const gradient = this.model.gradient;\n", " const y_intercept = this.model.y_intercept;\n", " if (gradient == null || y_intercept == null) {\n", " return;\n", " }\n", " const { frame } = this.plot_view;\n", " const xscale = frame.xscales[this.model.x_range_name];\n", " const yscale = frame.yscales[this.model.y_range_name];\n", " const sy_start = frame._top.value;\n", " const sy_end = sy_start + frame._height.value;\n", " const y_start = yscale.invert(sy_start);\n", " const y_end = yscale.invert(sy_end);\n", " const x_start = (y_start - y_intercept) / gradient;\n", " const x_end = (y_end - y_intercept) / gradient;\n", " const sx_start = xscale.compute(x_start);\n", " const sx_end = xscale.compute(x_end);\n", " const { ctx } = this.layer;\n", " ctx.save();\n", " ctx.beginPath();\n", " this.visuals.line.set_value(ctx);\n", " ctx.moveTo(sx_start, sy_start);\n", " ctx.lineTo(sx_end, sy_end);\n", " ctx.stroke();\n", " ctx.restore();\n", " }\n", " }\n", " exports.SlopeView = SlopeView;\n", " SlopeView.__name__ = \"SlopeView\";\n", " class Slope extends annotation_1.Annotation {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Slope() {\n", " this.prototype.default_view = SlopeView;\n", " this.mixins(mixins.Line /*Scalar*/);\n", " this.define({\n", " gradient: [p.Number, null],\n", " y_intercept: [p.Number, null],\n", " x_range_name: [p.String, 'default'],\n", " y_range_name: [p.String, 'default'],\n", " });\n", " this.override({\n", " line_color: 'black',\n", " });\n", " }\n", " }\n", " exports.Slope = Slope;\n", " Slope.__name__ = \"Slope\";\n", " Slope.init_Slope();\n", " },\n", " /* models/annotations/span.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const annotation_1 = require(31) /* ./annotation */;\n", " const mixins = tslib_1.__importStar(require(23) /* ../../core/property_mixins */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class SpanView extends annotation_1.AnnotationView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.change, () => this.plot_view.request_paint(this));\n", " }\n", " render() {\n", " if (!this.model.visible)\n", " return;\n", " const { location } = this.model;\n", " if (location == null) {\n", " return;\n", " }\n", " const { frame } = this.plot_view;\n", " const xscale = frame.xscales[this.model.x_range_name];\n", " const yscale = frame.yscales[this.model.y_range_name];\n", " const _calc_dim = (scale, view) => {\n", " if (this.model.location_units == 'data')\n", " return scale.compute(location);\n", " else\n", " return this.model.for_hover ? location : view.compute(location);\n", " };\n", " let height, sleft, stop, width;\n", " if (this.model.dimension == 'width') {\n", " stop = _calc_dim(yscale, frame.yview);\n", " sleft = frame._left.value;\n", " width = frame._width.value;\n", " height = this.model.properties.line_width.value();\n", " }\n", " else {\n", " stop = frame._top.value;\n", " sleft = _calc_dim(xscale, frame.xview);\n", " width = this.model.properties.line_width.value();\n", " height = frame._height.value;\n", " }\n", " const { ctx } = this.layer;\n", " ctx.save();\n", " ctx.beginPath();\n", " this.visuals.line.set_value(ctx);\n", " ctx.moveTo(sleft, stop);\n", " if (this.model.dimension == \"width\") {\n", " ctx.lineTo(sleft + width, stop);\n", " }\n", " else {\n", " ctx.lineTo(sleft, stop + height);\n", " }\n", " ctx.stroke();\n", " ctx.restore();\n", " }\n", " }\n", " exports.SpanView = SpanView;\n", " SpanView.__name__ = \"SpanView\";\n", " class Span extends annotation_1.Annotation {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Span() {\n", " this.prototype.default_view = SpanView;\n", " this.mixins(mixins.Line /*Scalar*/);\n", " this.define({\n", " render_mode: [p.RenderMode, 'canvas'],\n", " x_range_name: [p.String, 'default'],\n", " y_range_name: [p.String, 'default'],\n", " location: [p.Number, null],\n", " location_units: [p.SpatialUnits, 'data'],\n", " dimension: [p.Dimension, 'width'],\n", " });\n", " this.override({\n", " line_color: 'black',\n", " });\n", " this.internal({\n", " for_hover: [p.Boolean, false],\n", " });\n", " }\n", " }\n", " exports.Span = Span;\n", " Span.__name__ = \"Span\";\n", " Span.init_Span();\n", " },\n", " /* models/annotations/title.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const text_annotation_1 = require(134) /* ./text_annotation */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const visuals_1 = require(70) /* ../../core/visuals */;\n", " const mixins = tslib_1.__importStar(require(23) /* ../../core/property_mixins */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class TitleView extends text_annotation_1.TextAnnotationView {\n", " initialize() {\n", " super.initialize();\n", " this.visuals.text = new visuals_1.Text(this.model);\n", " }\n", " _get_location() {\n", " const panel = this.panel;\n", " const hmargin = this.model.offset;\n", " const vmargin = 5;\n", " let sx, sy;\n", " switch (panel.side) {\n", " case 'above':\n", " case 'below': {\n", " switch (this.model.vertical_align) {\n", " case 'top':\n", " sy = panel._top.value + vmargin;\n", " break;\n", " case 'middle':\n", " sy = panel._vcenter.value;\n", " break;\n", " case 'bottom':\n", " sy = panel._bottom.value - vmargin;\n", " break;\n", " }\n", " switch (this.model.align) {\n", " case 'left':\n", " sx = panel._left.value + hmargin;\n", " break;\n", " case 'center':\n", " sx = panel._hcenter.value;\n", " break;\n", " case 'right':\n", " sx = panel._right.value - hmargin;\n", " break;\n", " }\n", " break;\n", " }\n", " case 'left': {\n", " switch (this.model.vertical_align) {\n", " case 'top':\n", " sx = panel._left.value - vmargin;\n", " break;\n", " case 'middle':\n", " sx = panel._hcenter.value;\n", " break;\n", " case 'bottom':\n", " sx = panel._right.value + vmargin;\n", " break;\n", " }\n", " switch (this.model.align) {\n", " case 'left':\n", " sy = panel._bottom.value - hmargin;\n", " break;\n", " case 'center':\n", " sy = panel._vcenter.value;\n", " break;\n", " case 'right':\n", " sy = panel._top.value + hmargin;\n", " break;\n", " }\n", " break;\n", " }\n", " case 'right': {\n", " switch (this.model.vertical_align) {\n", " case 'top':\n", " sx = panel._right.value - vmargin;\n", " break;\n", " case 'middle':\n", " sx = panel._hcenter.value;\n", " break;\n", " case 'bottom':\n", " sx = panel._left.value + vmargin;\n", " break;\n", " }\n", " switch (this.model.align) {\n", " case 'left':\n", " sy = panel._top.value + hmargin;\n", " break;\n", " case 'center':\n", " sy = panel._vcenter.value;\n", " break;\n", " case 'right':\n", " sy = panel._bottom.value - hmargin;\n", " break;\n", " }\n", " break;\n", " }\n", " }\n", " return [sx, sy];\n", " }\n", " render() {\n", " if (!this.model.visible) {\n", " if (this.model.render_mode == 'css')\n", " dom_1.undisplay(this.el);\n", " return;\n", " }\n", " const { text } = this.model;\n", " if (text == null || text.length == 0)\n", " return;\n", " this.model.text_baseline = this.model.vertical_align;\n", " this.model.text_align = this.model.align;\n", " const [sx, sy] = this._get_location();\n", " const angle = this.panel.get_label_angle_heuristic('parallel');\n", " const draw = this.model.render_mode == 'canvas' ? this._canvas_text.bind(this) : this._css_text.bind(this);\n", " draw(this.layer.ctx, text, sx, sy, angle);\n", " }\n", " _get_size() {\n", " const { text } = this.model;\n", " if (text == null || text.length == 0)\n", " return { width: 0, height: 0 };\n", " else {\n", " this.visuals.text.set_value(this.layer.ctx);\n", " const { width, ascent } = this.layer.ctx.measureText(text);\n", " return { width, height: ascent * this.visuals.text.text_line_height.value() + 10 };\n", " }\n", " }\n", " }\n", " exports.TitleView = TitleView;\n", " TitleView.__name__ = \"TitleView\";\n", " class Title extends text_annotation_1.TextAnnotation {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Title() {\n", " this.prototype.default_view = TitleView;\n", " this.mixins([\n", " [\"border_\", mixins.Line],\n", " [\"background_\", mixins.Fill],\n", " ]);\n", " this.define({\n", " text: [p.String],\n", " text_font: [p.Font, 'helvetica'],\n", " text_font_size: [p.StringSpec, '13px'],\n", " text_font_style: [p.FontStyle, 'bold'],\n", " text_color: [p.ColorSpec, '#444444'],\n", " text_alpha: [p.NumberSpec, 1.0],\n", " text_line_height: [p.Number, 1.0],\n", " vertical_align: [p.VerticalAlign, 'bottom'],\n", " align: [p.TextAlign, 'left'],\n", " offset: [p.Number, 0],\n", " });\n", " this.override({\n", " background_fill_color: null,\n", " border_line_color: null,\n", " });\n", " this.internal({\n", " text_align: [p.TextAlign, 'left'],\n", " text_baseline: [p.TextBaseline, 'bottom'],\n", " });\n", " }\n", " }\n", " exports.Title = Title;\n", " Title.__name__ = \"Title\";\n", " Title.init_Title();\n", " },\n", " /* models/annotations/toolbar_panel.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const annotation_1 = require(31) /* ./annotation */;\n", " const build_views_1 = require(99) /* ../../core/build_views */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class ToolbarPanelView extends annotation_1.AnnotationView {\n", " constructor() {\n", " super(...arguments);\n", " this.rotate = true;\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.plot_view.canvas_view.add_event(this.el);\n", " }\n", " async lazy_initialize() {\n", " this._toolbar_view = await build_views_1.build_view(this.model.toolbar, { parent: this });\n", " this.plot_view.visibility_callbacks.push((visible) => this._toolbar_view.set_visibility(visible));\n", " }\n", " remove() {\n", " this._toolbar_view.remove();\n", " super.remove();\n", " }\n", " render() {\n", " super.render();\n", " if (!this.model.visible) {\n", " dom_1.undisplay(this.el);\n", " return;\n", " }\n", " this.el.style.position = \"absolute\";\n", " this.el.style.overflow = \"hidden\";\n", " dom_1.position(this.el, this.panel.bbox);\n", " this._toolbar_view.render();\n", " dom_1.empty(this.el);\n", " this.el.appendChild(this._toolbar_view.el);\n", " dom_1.display(this.el);\n", " }\n", " _get_size() {\n", " const { tools, logo } = this.model.toolbar;\n", " return {\n", " width: tools.length * 30 + (logo != null ? 25 : 0),\n", " height: 30,\n", " };\n", " }\n", " }\n", " exports.ToolbarPanelView = ToolbarPanelView;\n", " ToolbarPanelView.__name__ = \"ToolbarPanelView\";\n", " class ToolbarPanel extends annotation_1.Annotation {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ToolbarPanel() {\n", " this.prototype.default_view = ToolbarPanelView;\n", " this.define({\n", " toolbar: [p.Instance],\n", " });\n", " }\n", " }\n", " exports.ToolbarPanel = ToolbarPanel;\n", " ToolbarPanel.__name__ = \"ToolbarPanel\";\n", " ToolbarPanel.init_ToolbarPanel();\n", " },\n", " /* models/annotations/tooltip.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const annotation_1 = require(31) /* ./annotation */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const tooltips_1 = require(145) /* ../../styles/tooltips */;\n", " const mixins_1 = require(146) /* ../../styles/mixins */;\n", " const tooltips_css_1 = tslib_1.__importDefault(require(147) /* ../../styles/tooltips.css */);\n", " function compute_side(attachment, sx, sy, hcenter, vcenter) {\n", " switch (attachment) {\n", " case \"horizontal\":\n", " return sx < hcenter ? \"right\" : \"left\";\n", " case \"vertical\":\n", " return sy < vcenter ? \"below\" : \"above\";\n", " default:\n", " return attachment;\n", " }\n", " }\n", " exports.compute_side = compute_side;\n", " class TooltipView extends annotation_1.AnnotationView {\n", " initialize() {\n", " super.initialize();\n", " // TODO (bev) really probably need multiple divs\n", " this.plot_view.canvas_view.add_overlay(this.el);\n", " dom_1.undisplay(this.el);\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.data.change, () => this._draw_tips());\n", " }\n", " styles() {\n", " return [...super.styles(), tooltips_css_1.default];\n", " }\n", " css_classes() {\n", " return super.css_classes().concat(tooltips_1.bk_tooltip);\n", " }\n", " render() {\n", " if (!this.model.visible)\n", " return;\n", " this._draw_tips();\n", " }\n", " _draw_tips() {\n", " const { data } = this.model;\n", " dom_1.empty(this.el);\n", " dom_1.undisplay(this.el);\n", " if (this.model.custom)\n", " this.el.classList.add(tooltips_1.bk_tooltip_custom);\n", " else\n", " this.el.classList.remove(tooltips_1.bk_tooltip_custom);\n", " if (data.length == 0)\n", " return;\n", " const { frame } = this.plot_view;\n", " for (const [sx, sy, content] of data) {\n", " if (this.model.inner_only && !frame.bbox.contains(sx, sy))\n", " continue;\n", " const tip = dom_1.div({}, content);\n", " this.el.appendChild(tip);\n", " }\n", " const [sx, sy] = data[data.length - 1]; // XXX: this previously depended on {sx, sy} leaking from the for-loop\n", " const side = compute_side(this.model.attachment, sx, sy, frame._hcenter.value, frame._vcenter.value);\n", " this.el.classList.remove(mixins_1.bk_right);\n", " this.el.classList.remove(mixins_1.bk_left);\n", " this.el.classList.remove(mixins_1.bk_above);\n", " this.el.classList.remove(mixins_1.bk_below);\n", " const arrow_size = 10; // XXX: keep in sync with less\n", " dom_1.display(this.el); // XXX: {offset,client}Width() gives 0 when display=\"none\"\n", " // slightly confusing: side \"left\" (for example) is relative to point that\n", " // is being annotated but CS class \".bk-left\" is relative to the tooltip itself\n", " let top;\n", " let left = 0;\n", " let right = 0;\n", " switch (side) {\n", " case \"right\":\n", " this.el.classList.add(mixins_1.bk_left);\n", " left = sx + (this.el.offsetWidth - this.el.clientWidth) + arrow_size;\n", " top = sy - this.el.offsetHeight / 2;\n", " break;\n", " case \"left\":\n", " this.el.classList.add(mixins_1.bk_right);\n", " right = (this.plot_view.layout.bbox.width - sx) + arrow_size;\n", " top = sy - this.el.offsetHeight / 2;\n", " break;\n", " case \"below\":\n", " this.el.classList.add(mixins_1.bk_above);\n", " top = sy + (this.el.offsetHeight - this.el.clientHeight) + arrow_size;\n", " left = Math.round(sx - this.el.offsetWidth / 2);\n", " break;\n", " case \"above\":\n", " this.el.classList.add(mixins_1.bk_below);\n", " top = sy - this.el.offsetHeight - arrow_size;\n", " left = Math.round(sx - this.el.offsetWidth / 2);\n", " break;\n", " }\n", " if (this.model.show_arrow)\n", " this.el.classList.add(tooltips_1.bk_tooltip_arrow);\n", " // TODO (bev) this is not currently bulletproof. If there are\n", " // two hits, not colocated and one is off the screen, that can\n", " // be problematic\n", " if (this.el.childNodes.length > 0) {\n", " this.el.style.top = `${top}px`;\n", " this.el.style.left = left ? `${left}px` : 'auto';\n", " this.el.style.right = right ? `${right}px` : 'auto';\n", " }\n", " else\n", " dom_1.undisplay(this.el);\n", " }\n", " }\n", " exports.TooltipView = TooltipView;\n", " TooltipView.__name__ = \"TooltipView\";\n", " class Tooltip extends annotation_1.Annotation {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Tooltip() {\n", " this.prototype.default_view = TooltipView;\n", " this.define({\n", " attachment: [p.TooltipAttachment, 'horizontal'],\n", " inner_only: [p.Boolean, true],\n", " show_arrow: [p.Boolean, true],\n", " });\n", " this.override({\n", " level: 'overlay',\n", " });\n", " this.internal({\n", " data: [p.Any, []],\n", " custom: [p.Any],\n", " });\n", " }\n", " clear() {\n", " this.data = [];\n", " }\n", " add(sx, sy, content) {\n", " this.data = this.data.concat([[sx, sy, content]]);\n", " }\n", " }\n", " exports.Tooltip = Tooltip;\n", " Tooltip.__name__ = \"Tooltip\";\n", " Tooltip.init_Tooltip();\n", " },\n", " /* styles/tooltips.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.bk_tooltip = \"bk-tooltip\";\n", " exports.bk_tooltip_arrow = \"bk-tooltip-arrow\";\n", " exports.bk_tooltip_custom = \"bk-tooltip-custom\";\n", " exports.bk_tooltip_row_label = \"bk-tooltip-row-label\";\n", " exports.bk_tooltip_row_value = \"bk-tooltip-row-value\";\n", " exports.bk_tooltip_color_block = \"bk-tooltip-color-block\";\n", " },\n", " /* styles/mixins.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.bk_active = \"bk-active\";\n", " exports.bk_inline = \"bk-inline\";\n", " exports.bk_left = \"bk-left\";\n", " exports.bk_right = \"bk-right\";\n", " exports.bk_above = \"bk-above\";\n", " exports.bk_below = \"bk-below\";\n", " exports.bk_up = \"bk-up\";\n", " exports.bk_down = \"bk-down\";\n", " function bk_side(side) {\n", " switch (side) {\n", " case \"above\": return exports.bk_above;\n", " case \"below\": return exports.bk_below;\n", " case \"left\": return exports.bk_left;\n", " case \"right\": return exports.bk_right;\n", " }\n", " }\n", " exports.bk_side = bk_side;\n", " },\n", " /* styles/tooltips.css.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const css = `\n", " .bk-root {\n", " /* Same border color used everywhere */\n", " /* Gray of icons */\n", " }\n", " .bk-root .bk-tooltip {\n", " font-weight: 300;\n", " font-size: 12px;\n", " position: absolute;\n", " padding: 5px;\n", " border: 1px solid #e5e5e5;\n", " color: #2f2f2f;\n", " background-color: white;\n", " pointer-events: none;\n", " opacity: 0.95;\n", " z-index: 100;\n", " }\n", " .bk-root .bk-tooltip > div:not(:first-child) {\n", " /* gives space when multiple elements are being hovered over */\n", " margin-top: 5px;\n", " border-top: #e5e5e5 1px dashed;\n", " }\n", " .bk-root .bk-tooltip.bk-left.bk-tooltip-arrow::before {\n", " position: absolute;\n", " margin: -7px 0 0 0;\n", " top: 50%;\n", " width: 0;\n", " height: 0;\n", " border-style: solid;\n", " border-width: 7px 0 7px 0;\n", " border-color: transparent;\n", " content: \" \";\n", " display: block;\n", " left: -10px;\n", " border-right-width: 10px;\n", " border-right-color: #909599;\n", " }\n", " .bk-root .bk-tooltip.bk-left::before {\n", " left: -10px;\n", " border-right-width: 10px;\n", " border-right-color: #909599;\n", " }\n", " .bk-root .bk-tooltip.bk-right.bk-tooltip-arrow::after {\n", " position: absolute;\n", " margin: -7px 0 0 0;\n", " top: 50%;\n", " width: 0;\n", " height: 0;\n", " border-style: solid;\n", " border-width: 7px 0 7px 0;\n", " border-color: transparent;\n", " content: \" \";\n", " display: block;\n", " right: -10px;\n", " border-left-width: 10px;\n", " border-left-color: #909599;\n", " }\n", " .bk-root .bk-tooltip.bk-right::after {\n", " right: -10px;\n", " border-left-width: 10px;\n", " border-left-color: #909599;\n", " }\n", " .bk-root .bk-tooltip.bk-above::before {\n", " position: absolute;\n", " margin: 0 0 0 -7px;\n", " left: 50%;\n", " width: 0;\n", " height: 0;\n", " border-style: solid;\n", " border-width: 0 7px 0 7px;\n", " border-color: transparent;\n", " content: \" \";\n", " display: block;\n", " top: -10px;\n", " border-bottom-width: 10px;\n", " border-bottom-color: #909599;\n", " }\n", " .bk-root .bk-tooltip.bk-below::after {\n", " position: absolute;\n", " margin: 0 0 0 -7px;\n", " left: 50%;\n", " width: 0;\n", " height: 0;\n", " border-style: solid;\n", " border-width: 0 7px 0 7px;\n", " border-color: transparent;\n", " content: \" \";\n", " display: block;\n", " bottom: -10px;\n", " border-top-width: 10px;\n", " border-top-color: #909599;\n", " }\n", " .bk-root .bk-tooltip-row-label {\n", " text-align: right;\n", " color: #26aae1;\n", " /* blue from toolbar highlighting */\n", " }\n", " .bk-root .bk-tooltip-row-value {\n", " color: default;\n", " /* seems to be necessary for notebook */\n", " }\n", " .bk-root .bk-tooltip-color-block {\n", " width: 12px;\n", " height: 12px;\n", " margin-left: 5px;\n", " margin-right: 5px;\n", " outline: #dddddd solid 1px;\n", " display: inline-block;\n", " }\n", " `;\n", " exports.default = css;\n", " },\n", " /* models/annotations/whisker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const annotation_1 = require(31) /* ./annotation */;\n", " const column_data_source_1 = require(76) /* ../sources/column_data_source */;\n", " const arrow_head_1 = require(75) /* ./arrow_head */;\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class WhiskerView extends annotation_1.AnnotationView {\n", " initialize() {\n", " super.initialize();\n", " this.set_data(this.model.source);\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.source.streaming, () => this.set_data(this.model.source));\n", " this.connect(this.model.source.patching, () => this.set_data(this.model.source));\n", " this.connect(this.model.source.change, () => this.set_data(this.model.source));\n", " }\n", " set_data(source) {\n", " super.set_data(source);\n", " this.visuals.warm_cache(source);\n", " this.plot_view.request_render();\n", " }\n", " _map_data() {\n", " const { frame } = this.plot_view;\n", " const dim = this.model.dimension;\n", " const xscale = frame.xscales[this.model.x_range_name];\n", " const yscale = frame.yscales[this.model.y_range_name];\n", " const limit_scale = dim == \"height\" ? yscale : xscale;\n", " const base_scale = dim == \"height\" ? xscale : yscale;\n", " const limit_view = dim == \"height\" ? frame.yview : frame.xview;\n", " const base_view = dim == \"height\" ? frame.xview : frame.yview;\n", " let _lower_sx;\n", " if (this.model.properties.lower.units == \"data\")\n", " _lower_sx = limit_scale.v_compute(this._lower);\n", " else\n", " _lower_sx = limit_view.v_compute(this._lower);\n", " let _upper_sx;\n", " if (this.model.properties.upper.units == \"data\")\n", " _upper_sx = limit_scale.v_compute(this._upper);\n", " else\n", " _upper_sx = limit_view.v_compute(this._upper);\n", " let _base_sx;\n", " if (this.model.properties.base.units == \"data\")\n", " _base_sx = base_scale.v_compute(this._base);\n", " else\n", " _base_sx = base_view.v_compute(this._base);\n", " const [i, j] = dim == 'height' ? [1, 0] : [0, 1];\n", " const _lower = [_lower_sx, _base_sx];\n", " const _upper = [_upper_sx, _base_sx];\n", " this._lower_sx = _lower[i];\n", " this._lower_sy = _lower[j];\n", " this._upper_sx = _upper[i];\n", " this._upper_sy = _upper[j];\n", " }\n", " render() {\n", " if (!this.model.visible)\n", " return;\n", " this._map_data();\n", " const { ctx } = this.layer;\n", " if (this.visuals.line.doit) {\n", " for (let i = 0, end = this._lower_sx.length; i < end; i++) {\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.beginPath();\n", " ctx.moveTo(this._lower_sx[i], this._lower_sy[i]);\n", " ctx.lineTo(this._upper_sx[i], this._upper_sy[i]);\n", " ctx.stroke();\n", " }\n", " }\n", " const angle = this.model.dimension == \"height\" ? 0 : Math.PI / 2;\n", " if (this.model.lower_head != null) {\n", " for (let i = 0, end = this._lower_sx.length; i < end; i++) {\n", " ctx.save();\n", " ctx.translate(this._lower_sx[i], this._lower_sy[i]);\n", " ctx.rotate(angle + Math.PI);\n", " this.model.lower_head.render(ctx, i);\n", " ctx.restore();\n", " }\n", " }\n", " if (this.model.upper_head != null) {\n", " for (let i = 0, end = this._upper_sx.length; i < end; i++) {\n", " ctx.save();\n", " ctx.translate(this._upper_sx[i], this._upper_sy[i]);\n", " ctx.rotate(angle);\n", " this.model.upper_head.render(ctx, i);\n", " ctx.restore();\n", " }\n", " }\n", " }\n", " }\n", " exports.WhiskerView = WhiskerView;\n", " WhiskerView.__name__ = \"WhiskerView\";\n", " class Whisker extends annotation_1.Annotation {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Whisker() {\n", " this.prototype.default_view = WhiskerView;\n", " this.mixins(property_mixins_1.LineVector);\n", " this.define({\n", " lower: [p.DistanceSpec],\n", " lower_head: [p.Instance, () => new arrow_head_1.TeeHead({ level: \"underlay\", size: 10 })],\n", " upper: [p.DistanceSpec],\n", " upper_head: [p.Instance, () => new arrow_head_1.TeeHead({ level: \"underlay\", size: 10 })],\n", " base: [p.DistanceSpec],\n", " dimension: [p.Dimension, 'height'],\n", " source: [p.Instance, () => new column_data_source_1.ColumnDataSource()],\n", " x_range_name: [p.String, 'default'],\n", " y_range_name: [p.String, 'default'],\n", " });\n", " this.override({\n", " level: 'underlay',\n", " });\n", " }\n", " }\n", " exports.Whisker = Whisker;\n", " Whisker.__name__ = \"Whisker\";\n", " Whisker.init_Whisker();\n", " },\n", " /* models/axes/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var axis_1 = require(150) /* ./axis */;\n", " exports.Axis = axis_1.Axis;\n", " var categorical_axis_1 = require(152) /* ./categorical_axis */;\n", " exports.CategoricalAxis = categorical_axis_1.CategoricalAxis;\n", " var continuous_axis_1 = require(155) /* ./continuous_axis */;\n", " exports.ContinuousAxis = continuous_axis_1.ContinuousAxis;\n", " var datetime_axis_1 = require(156) /* ./datetime_axis */;\n", " exports.DatetimeAxis = datetime_axis_1.DatetimeAxis;\n", " var linear_axis_1 = require(157) /* ./linear_axis */;\n", " exports.LinearAxis = linear_axis_1.LinearAxis;\n", " var log_axis_1 = require(170) /* ./log_axis */;\n", " exports.LogAxis = log_axis_1.LogAxis;\n", " var mercator_axis_1 = require(173) /* ./mercator_axis */;\n", " exports.MercatorAxis = mercator_axis_1.MercatorAxis;\n", " },\n", " /* models/axes/axis.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const guide_renderer_1 = require(151) /* ../renderers/guide_renderer */;\n", " const mixins = tslib_1.__importStar(require(23) /* ../../core/property_mixins */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const factor_range_1 = require(90) /* ../ranges/factor_range */;\n", " const { abs, min, max } = Math;\n", " class AxisView extends guide_renderer_1.GuideRendererView {\n", " constructor() {\n", " super(...arguments);\n", " this.rotate = true;\n", " }\n", " get panel() {\n", " return this.layout;\n", " }\n", " render() {\n", " if (!this.model.visible)\n", " return;\n", " const extents = {\n", " tick: this._tick_extent(),\n", " tick_label: this._tick_label_extents(),\n", " axis_label: this._axis_label_extent(),\n", " };\n", " const tick_coords = this.tick_coords;\n", " const ctx = this.layer.ctx;\n", " ctx.save();\n", " this._draw_rule(ctx, extents);\n", " this._draw_major_ticks(ctx, extents, tick_coords);\n", " this._draw_minor_ticks(ctx, extents, tick_coords);\n", " this._draw_major_labels(ctx, extents, tick_coords);\n", " this._draw_axis_label(ctx, extents, tick_coords);\n", " if (this._render != null)\n", " this._render(ctx, extents, tick_coords);\n", " ctx.restore();\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.change, () => this.plot_view.request_paint());\n", " const p = this.model.properties;\n", " this.on_change(p.visible, () => this.plot_view.request_layout());\n", " }\n", " get_size() {\n", " if (this.model.visible && this.model.fixed_location == null) {\n", " const size = this._get_size();\n", " return { width: 0 /* max */, height: Math.round(size) };\n", " }\n", " else\n", " return { width: 0, height: 0 };\n", " }\n", " _get_size() {\n", " return this._tick_extent() + this._tick_label_extent() + this._axis_label_extent();\n", " }\n", " get needs_clip() {\n", " return this.model.fixed_location != null;\n", " }\n", " // drawing sub functions -----------------------------------------------------\n", " _draw_rule(ctx, _extents) {\n", " if (!this.visuals.axis_line.doit)\n", " return;\n", " const [xs, ys] = this.rule_coords;\n", " const [sxs, sys] = this.plot_view.map_to_screen(xs, ys, this.model.x_range_name, this.model.y_range_name);\n", " const [nx, ny] = this.normals;\n", " const [xoff, yoff] = this.offsets;\n", " this.visuals.axis_line.set_value(ctx);\n", " ctx.beginPath();\n", " ctx.moveTo(Math.round(sxs[0] + nx * xoff), Math.round(sys[0] + ny * yoff));\n", " for (let i = 1; i < sxs.length; i++) {\n", " const sx = Math.round(sxs[i] + nx * xoff);\n", " const sy = Math.round(sys[i] + ny * yoff);\n", " ctx.lineTo(sx, sy);\n", " }\n", " ctx.stroke();\n", " }\n", " _draw_major_ticks(ctx, _extents, tick_coords) {\n", " const tin = this.model.major_tick_in;\n", " const tout = this.model.major_tick_out;\n", " const visuals = this.visuals.major_tick_line;\n", " this._draw_ticks(ctx, tick_coords.major, tin, tout, visuals);\n", " }\n", " _draw_minor_ticks(ctx, _extents, tick_coords) {\n", " const tin = this.model.minor_tick_in;\n", " const tout = this.model.minor_tick_out;\n", " const visuals = this.visuals.minor_tick_line;\n", " this._draw_ticks(ctx, tick_coords.minor, tin, tout, visuals);\n", " }\n", " _draw_major_labels(ctx, extents, tick_coords) {\n", " const coords = tick_coords.major;\n", " const labels = this.compute_labels(coords[this.dimension]);\n", " const orient = this.model.major_label_orientation;\n", " const standoff = extents.tick + this.model.major_label_standoff;\n", " const visuals = this.visuals.major_label_text;\n", " this._draw_oriented_labels(ctx, labels, coords, orient, this.panel.side, standoff, visuals);\n", " }\n", " _draw_axis_label(ctx, extents, _tick_coords) {\n", " if (this.model.axis_label == null || this.model.axis_label.length == 0 || this.model.fixed_location != null)\n", " return;\n", " let sx;\n", " let sy;\n", " switch (this.panel.side) {\n", " case \"above\":\n", " sx = this.panel._hcenter.value;\n", " sy = this.panel._bottom.value;\n", " break;\n", " case \"below\":\n", " sx = this.panel._hcenter.value;\n", " sy = this.panel._top.value;\n", " break;\n", " case \"left\":\n", " sx = this.panel._right.value;\n", " sy = this.panel._vcenter.value;\n", " break;\n", " case \"right\":\n", " sx = this.panel._left.value;\n", " sy = this.panel._vcenter.value;\n", " break;\n", " default:\n", " throw new Error(`unknown side: ${this.panel.side}`);\n", " }\n", " const coords = [[sx], [sy]];\n", " const standoff = extents.tick + array_1.sum(extents.tick_label) + this.model.axis_label_standoff;\n", " const visuals = this.visuals.axis_label_text;\n", " this._draw_oriented_labels(ctx, [this.model.axis_label], coords, 'parallel', this.panel.side, standoff, visuals, \"screen\");\n", " }\n", " _draw_ticks(ctx, coords, tin, tout, visuals) {\n", " if (!visuals.doit)\n", " return;\n", " const [x, y] = coords;\n", " const [sxs, sys] = this.plot_view.map_to_screen(x, y, this.model.x_range_name, this.model.y_range_name);\n", " const [nx, ny] = this.normals;\n", " const [xoff, yoff] = this.offsets;\n", " const [nxin, nyin] = [nx * (xoff - tin), ny * (yoff - tin)];\n", " const [nxout, nyout] = [nx * (xoff + tout), ny * (yoff + tout)];\n", " visuals.set_value(ctx);\n", " for (let i = 0; i < sxs.length; i++) {\n", " const sx0 = Math.round(sxs[i] + nxout);\n", " const sy0 = Math.round(sys[i] + nyout);\n", " const sx1 = Math.round(sxs[i] + nxin);\n", " const sy1 = Math.round(sys[i] + nyin);\n", " ctx.beginPath();\n", " ctx.moveTo(sx0, sy0);\n", " ctx.lineTo(sx1, sy1);\n", " ctx.stroke();\n", " }\n", " }\n", " _draw_oriented_labels(ctx, labels, coords, orient, _side, standoff, visuals, units = \"data\") {\n", " if (!visuals.doit || labels.length == 0)\n", " return;\n", " let sxs, sys;\n", " let xoff, yoff;\n", " if (units == \"screen\") {\n", " [sxs, sys] = coords;\n", " [xoff, yoff] = [0, 0];\n", " }\n", " else {\n", " const [dxs, dys] = coords;\n", " [sxs, sys] = this.plot_view.map_to_screen(dxs, dys, this.model.x_range_name, this.model.y_range_name);\n", " [xoff, yoff] = this.offsets;\n", " }\n", " const [nx, ny] = this.normals;\n", " const nxd = nx * (xoff + standoff);\n", " const nyd = ny * (yoff + standoff);\n", " visuals.set_value(ctx);\n", " this.panel.apply_label_text_heuristics(ctx, orient);\n", " let angle;\n", " if (types_1.isString(orient))\n", " angle = this.panel.get_label_angle_heuristic(orient);\n", " else\n", " angle = -orient;\n", " for (let i = 0; i < sxs.length; i++) {\n", " const sx = Math.round(sxs[i] + nxd);\n", " const sy = Math.round(sys[i] + nyd);\n", " ctx.translate(sx, sy);\n", " ctx.rotate(angle);\n", " ctx.fillText(labels[i], 0, 0);\n", " ctx.rotate(-angle);\n", " ctx.translate(-sx, -sy);\n", " }\n", " }\n", " // extents sub functions -----------------------------------------------------\n", " /*protected*/ _axis_label_extent() {\n", " if (this.model.axis_label == null || this.model.axis_label == \"\")\n", " return 0;\n", " const standoff = this.model.axis_label_standoff;\n", " const visuals = this.visuals.axis_label_text;\n", " return this._oriented_labels_extent([this.model.axis_label], \"parallel\", this.panel.side, standoff, visuals);\n", " }\n", " /*protected*/ _tick_extent() {\n", " return this.model.major_tick_out;\n", " }\n", " /*protected*/ _tick_label_extent() {\n", " return array_1.sum(this._tick_label_extents());\n", " }\n", " _tick_label_extents() {\n", " const coords = this.tick_coords.major;\n", " const labels = this.compute_labels(coords[this.dimension]);\n", " const orient = this.model.major_label_orientation;\n", " const standoff = this.model.major_label_standoff;\n", " const visuals = this.visuals.major_label_text;\n", " return [this._oriented_labels_extent(labels, orient, this.panel.side, standoff, visuals)];\n", " }\n", " _oriented_labels_extent(labels, orient, side, standoff, visuals) {\n", " if (labels.length == 0)\n", " return 0;\n", " const ctx = this.layer.ctx;\n", " visuals.set_value(ctx);\n", " let hscale;\n", " let angle;\n", " if (types_1.isString(orient)) {\n", " hscale = 1;\n", " angle = this.panel.get_label_angle_heuristic(orient);\n", " }\n", " else {\n", " hscale = 2;\n", " angle = -orient;\n", " }\n", " angle = Math.abs(angle);\n", " const c = Math.cos(angle);\n", " const s = Math.sin(angle);\n", " let extent = 0;\n", " for (let i = 0; i < labels.length; i++) {\n", " const w = ctx.measureText(labels[i]).width * 1.1;\n", " const h = ctx.measureText(labels[i]).ascent * 0.9;\n", " let val;\n", " if (side == \"above\" || side == \"below\")\n", " val = w * s + (h / hscale) * c;\n", " else\n", " val = w * c + (h / hscale) * s;\n", " // update extent if current value is larger\n", " if (val > extent)\n", " extent = val;\n", " }\n", " // only apply the standoff if we already have non-zero extent\n", " if (extent > 0)\n", " extent += standoff;\n", " return extent;\n", " }\n", " // {{{ TODO: state\n", " get normals() {\n", " return this.panel.normals;\n", " }\n", " get dimension() {\n", " return this.panel.dimension;\n", " }\n", " compute_labels(ticks) {\n", " const labels = this.model.formatter.doFormat(ticks, this);\n", " for (let i = 0; i < ticks.length; i++) {\n", " if (ticks[i] in this.model.major_label_overrides)\n", " labels[i] = this.model.major_label_overrides[ticks[i]];\n", " }\n", " return labels;\n", " }\n", " get offsets() {\n", " // If we have a fixed_position then we should respect that exactly and\n", " // not apply any offsets (https://github.com/bokeh/bokeh/issues/8552)\n", " if (this.model.fixed_location != null)\n", " return [0, 0];\n", " const { frame } = this.plot_view;\n", " let [xoff, yoff] = [0, 0];\n", " switch (this.panel.side) {\n", " case \"below\":\n", " yoff = abs(this.panel._top.value - frame._bottom.value);\n", " break;\n", " case \"above\":\n", " yoff = abs(this.panel._bottom.value - frame._top.value);\n", " break;\n", " case \"right\":\n", " xoff = abs(this.panel._left.value - frame._right.value);\n", " break;\n", " case \"left\":\n", " xoff = abs(this.panel._right.value - frame._left.value);\n", " break;\n", " }\n", " return [xoff, yoff];\n", " }\n", " get ranges() {\n", " const i = this.dimension;\n", " const j = (i + 1) % 2;\n", " const { frame } = this.plot_view;\n", " const ranges = [\n", " frame.x_ranges[this.model.x_range_name],\n", " frame.y_ranges[this.model.y_range_name],\n", " ];\n", " return [ranges[i], ranges[j]];\n", " }\n", " get computed_bounds() {\n", " const [range] = this.ranges;\n", " const user_bounds = this.model.bounds; // XXX: ? 'auto'\n", " const range_bounds = [range.min, range.max];\n", " if (user_bounds == 'auto')\n", " return [range.min, range.max];\n", " else if (types_1.isArray(user_bounds)) {\n", " let start;\n", " let end;\n", " const [user_start, user_end] = user_bounds;\n", " const [range_start, range_end] = range_bounds;\n", " if (abs(user_start - user_end) > abs(range_start - range_end)) {\n", " start = max(min(user_start, user_end), range_start);\n", " end = min(max(user_start, user_end), range_end);\n", " }\n", " else {\n", " start = min(user_start, user_end);\n", " end = max(user_start, user_end);\n", " }\n", " return [start, end];\n", " }\n", " else\n", " throw new Error(`user bounds '${user_bounds}' not understood`);\n", " }\n", " get rule_coords() {\n", " const i = this.dimension;\n", " const j = (i + 1) % 2;\n", " const [range] = this.ranges;\n", " const [start, end] = this.computed_bounds;\n", " const xs = new Array(2);\n", " const ys = new Array(2);\n", " const coords = [xs, ys];\n", " coords[i][0] = Math.max(start, range.min);\n", " coords[i][1] = Math.min(end, range.max);\n", " if (coords[i][0] > coords[i][1])\n", " coords[i][0] = coords[i][1] = NaN;\n", " coords[j][0] = this.loc;\n", " coords[j][1] = this.loc;\n", " return coords;\n", " }\n", " get tick_coords() {\n", " const i = this.dimension;\n", " const j = (i + 1) % 2;\n", " const [range] = this.ranges;\n", " const [start, end] = this.computed_bounds;\n", " const ticks = this.model.ticker.get_ticks(start, end, range, this.loc, {});\n", " const majors = ticks.major;\n", " const minors = ticks.minor;\n", " const xs = [];\n", " const ys = [];\n", " const coords = [xs, ys];\n", " const minor_xs = [];\n", " const minor_ys = [];\n", " const minor_coords = [minor_xs, minor_ys];\n", " const [range_min, range_max] = [range.min, range.max];\n", " for (let ii = 0; ii < majors.length; ii++) {\n", " if (majors[ii] < range_min || majors[ii] > range_max)\n", " continue;\n", " coords[i].push(majors[ii]);\n", " coords[j].push(this.loc);\n", " }\n", " for (let ii = 0; ii < minors.length; ii++) {\n", " if (minors[ii] < range_min || minors[ii] > range_max)\n", " continue;\n", " minor_coords[i].push(minors[ii]);\n", " minor_coords[j].push(this.loc);\n", " }\n", " return {\n", " major: coords,\n", " minor: minor_coords,\n", " };\n", " }\n", " get loc() {\n", " const { fixed_location } = this.model;\n", " if (fixed_location != null) {\n", " if (types_1.isNumber(fixed_location))\n", " return fixed_location;\n", " const [, cross_range] = this.ranges;\n", " if (cross_range instanceof factor_range_1.FactorRange)\n", " return cross_range.synthetic(fixed_location);\n", " throw new Error(\"unexpected\");\n", " }\n", " const [, cross_range] = this.ranges;\n", " switch (this.panel.side) {\n", " case 'left':\n", " case 'below':\n", " return cross_range.start;\n", " case 'right':\n", " case 'above':\n", " return cross_range.end;\n", " }\n", " }\n", " // }}}\n", " serializable_state() {\n", " return Object.assign(Object.assign({}, super.serializable_state()), { bbox: this.layout.bbox.box });\n", " }\n", " }\n", " exports.AxisView = AxisView;\n", " AxisView.__name__ = \"AxisView\";\n", " class Axis extends guide_renderer_1.GuideRenderer {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Axis() {\n", " this.prototype.default_view = AxisView;\n", " this.mixins([\n", " [\"axis_\", mixins.Line],\n", " [\"major_tick_\", mixins.Line],\n", " [\"minor_tick_\", mixins.Line],\n", " [\"major_label_\", mixins.Text],\n", " [\"axis_label_\", mixins.Text],\n", " ]);\n", " this.define({\n", " bounds: [p.Any, 'auto'],\n", " ticker: [p.Instance],\n", " formatter: [p.Instance],\n", " x_range_name: [p.String, 'default'],\n", " y_range_name: [p.String, 'default'],\n", " axis_label: [p.String, ''],\n", " axis_label_standoff: [p.Int, 5],\n", " major_label_standoff: [p.Int, 5],\n", " major_label_orientation: [p.Any, \"horizontal\"],\n", " major_label_overrides: [p.Any, {}],\n", " major_tick_in: [p.Number, 2],\n", " major_tick_out: [p.Number, 6],\n", " minor_tick_in: [p.Number, 0],\n", " minor_tick_out: [p.Number, 4],\n", " fixed_location: [p.Any, null],\n", " });\n", " this.override({\n", " axis_line_color: 'black',\n", " major_tick_line_color: 'black',\n", " minor_tick_line_color: 'black',\n", " major_label_text_font_size: \"11px\",\n", " major_label_text_align: \"center\",\n", " major_label_text_baseline: \"alphabetic\",\n", " axis_label_text_font_size: \"13px\",\n", " axis_label_text_font_style: \"italic\",\n", " });\n", " }\n", " }\n", " exports.Axis = Axis;\n", " Axis.__name__ = \"Axis\";\n", " Axis.init_Axis();\n", " },\n", " /* models/renderers/guide_renderer.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const renderer_1 = require(65) /* ./renderer */;\n", " class GuideRendererView extends renderer_1.RendererView {\n", " }\n", " exports.GuideRendererView = GuideRendererView;\n", " GuideRendererView.__name__ = \"GuideRendererView\";\n", " class GuideRenderer extends renderer_1.Renderer {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_GuideRenderer() {\n", " this.override({\n", " level: \"guide\",\n", " });\n", " }\n", " }\n", " exports.GuideRenderer = GuideRenderer;\n", " GuideRenderer.__name__ = \"GuideRenderer\";\n", " GuideRenderer.init_GuideRenderer();\n", " },\n", " /* models/axes/categorical_axis.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const axis_1 = require(150) /* ./axis */;\n", " const categorical_ticker_1 = require(153) /* ../tickers/categorical_ticker */;\n", " const categorical_tick_formatter_1 = require(154) /* ../formatters/categorical_tick_formatter */;\n", " const mixins = tslib_1.__importStar(require(23) /* ../../core/property_mixins */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class CategoricalAxisView extends axis_1.AxisView {\n", " _render(ctx, extents, tick_coords) {\n", " this._draw_group_separators(ctx, extents, tick_coords);\n", " }\n", " _draw_group_separators(ctx, _extents, _tick_coords) {\n", " const [range] = this.ranges;\n", " const [start, end] = this.computed_bounds;\n", " if (!range.tops || range.tops.length < 2 || !this.visuals.separator_line.doit)\n", " return;\n", " const dim = this.dimension;\n", " const alt = (dim + 1) % 2;\n", " const coords = [[], []];\n", " let ind = 0;\n", " for (let i = 0; i < range.tops.length - 1; i++) {\n", " let first, last;\n", " for (let j = ind; j < range.factors.length; j++) {\n", " if (range.factors[j][0] == range.tops[i + 1]) {\n", " [first, last] = [range.factors[j - 1], range.factors[j]];\n", " ind = j;\n", " break;\n", " }\n", " }\n", " const pt = (range.synthetic(first) + range.synthetic(last)) / 2;\n", " if (pt > start && pt < end) {\n", " coords[dim].push(pt);\n", " coords[alt].push(this.loc);\n", " }\n", " }\n", " const tex = this._tick_label_extent();\n", " this._draw_ticks(ctx, coords, -3, (tex - 6), this.visuals.separator_line);\n", " }\n", " _draw_major_labels(ctx, extents, _tick_coords) {\n", " const info = this._get_factor_info();\n", " let standoff = extents.tick + this.model.major_label_standoff;\n", " for (let i = 0; i < info.length; i++) {\n", " const [labels, coords, orient, visuals] = info[i];\n", " this._draw_oriented_labels(ctx, labels, coords, orient, this.panel.side, standoff, visuals);\n", " standoff += extents.tick_label[i];\n", " }\n", " }\n", " _tick_label_extents() {\n", " const info = this._get_factor_info();\n", " const extents = [];\n", " for (const [labels, , orient, visuals] of info) {\n", " const extent = this._oriented_labels_extent(labels, orient, this.panel.side, this.model.major_label_standoff, visuals);\n", " extents.push(extent);\n", " }\n", " return extents;\n", " }\n", " _get_factor_info() {\n", " const [range] = this.ranges;\n", " const [start, end] = this.computed_bounds;\n", " const loc = this.loc;\n", " const ticks = this.model.ticker.get_ticks(start, end, range, loc, {});\n", " const coords = this.tick_coords;\n", " const info = [];\n", " if (range.levels == 1) {\n", " const major = ticks.major;\n", " const labels = this.model.formatter.doFormat(major, this);\n", " info.push([labels, coords.major, this.model.major_label_orientation, this.visuals.major_label_text]);\n", " }\n", " else if (range.levels == 2) {\n", " const major = ticks.major.map((x) => x[1]);\n", " const labels = this.model.formatter.doFormat(major, this);\n", " info.push([labels, coords.major, this.model.major_label_orientation, this.visuals.major_label_text]);\n", " info.push([ticks.tops, coords.tops, this.model.group_label_orientation, this.visuals.group_text]);\n", " }\n", " else if (range.levels == 3) {\n", " const major = ticks.major.map((x) => x[2]);\n", " const labels = this.model.formatter.doFormat(major, this);\n", " const mid_labels = ticks.mids.map((x) => x[1]);\n", " info.push([labels, coords.major, this.model.major_label_orientation, this.visuals.major_label_text]);\n", " info.push([mid_labels, coords.mids, this.model.subgroup_label_orientation, this.visuals.subgroup_text]);\n", " info.push([ticks.tops, coords.tops, this.model.group_label_orientation, this.visuals.group_text]);\n", " }\n", " return info;\n", " }\n", " // {{{ TODO: state\n", " get tick_coords() {\n", " const i = this.dimension;\n", " const j = (i + 1) % 2;\n", " const [range] = this.ranges;\n", " const [start, end] = this.computed_bounds;\n", " const ticks = this.model.ticker.get_ticks(start, end, range, this.loc, {});\n", " const coords = {\n", " major: [[], []],\n", " mids: [[], []],\n", " tops: [[], []],\n", " minor: [[], []],\n", " };\n", " coords.major[i] = ticks.major;\n", " coords.major[j] = ticks.major.map((_x) => this.loc);\n", " if (range.levels == 3) {\n", " coords.mids[i] = ticks.mids;\n", " coords.mids[j] = ticks.mids.map((_x) => this.loc);\n", " }\n", " if (range.levels > 1) {\n", " coords.tops[i] = ticks.tops;\n", " coords.tops[j] = ticks.tops.map((_x) => this.loc);\n", " }\n", " return coords;\n", " }\n", " }\n", " exports.CategoricalAxisView = CategoricalAxisView;\n", " CategoricalAxisView.__name__ = \"CategoricalAxisView\";\n", " class CategoricalAxis extends axis_1.Axis {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_CategoricalAxis() {\n", " this.prototype.default_view = CategoricalAxisView;\n", " this.mixins([\n", " [\"separator_\", mixins.Line],\n", " [\"group_\", mixins.Text],\n", " [\"subgroup_\", mixins.Text],\n", " ]);\n", " this.define({\n", " group_label_orientation: [p.Any, \"parallel\"],\n", " subgroup_label_orientation: [p.Any, \"parallel\"],\n", " });\n", " this.override({\n", " ticker: () => new categorical_ticker_1.CategoricalTicker(),\n", " formatter: () => new categorical_tick_formatter_1.CategoricalTickFormatter(),\n", " separator_line_color: \"lightgrey\",\n", " separator_line_width: 2,\n", " group_text_font_style: \"bold\",\n", " group_text_font_size: \"11px\",\n", " group_text_color: \"grey\",\n", " subgroup_text_font_style: \"bold\",\n", " subgroup_text_font_size: \"11px\",\n", " });\n", " }\n", " }\n", " exports.CategoricalAxis = CategoricalAxis;\n", " CategoricalAxis.__name__ = \"CategoricalAxis\";\n", " CategoricalAxis.init_CategoricalAxis();\n", " },\n", " /* models/tickers/categorical_ticker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const ticker_1 = require(112) /* ./ticker */;\n", " class CategoricalTicker extends ticker_1.Ticker {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " get_ticks(start, end, range, _cross_loc, _) {\n", " const majors = this._collect(range.factors, range, start, end);\n", " const tops = this._collect(range.tops || [], range, start, end);\n", " const mids = this._collect(range.mids || [], range, start, end);\n", " return {\n", " major: majors,\n", " minor: [],\n", " tops,\n", " mids,\n", " };\n", " }\n", " _collect(factors, range, start, end) {\n", " const result = [];\n", " for (const factor of factors) {\n", " const coord = range.synthetic(factor);\n", " if (coord > start && coord < end)\n", " result.push(factor);\n", " }\n", " return result;\n", " }\n", " }\n", " exports.CategoricalTicker = CategoricalTicker;\n", " CategoricalTicker.__name__ = \"CategoricalTicker\";\n", " },\n", " /* models/formatters/categorical_tick_formatter.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tick_formatter_1 = require(114) /* ./tick_formatter */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " class CategoricalTickFormatter extends tick_formatter_1.TickFormatter {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " doFormat(ticks, _opts) {\n", " return array_1.copy(ticks);\n", " }\n", " }\n", " exports.CategoricalTickFormatter = CategoricalTickFormatter;\n", " CategoricalTickFormatter.__name__ = \"CategoricalTickFormatter\";\n", " },\n", " /* models/axes/continuous_axis.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const axis_1 = require(150) /* ./axis */;\n", " class ContinuousAxis extends axis_1.Axis {\n", " // TODO: __view_type__: ContinuousAxisView\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " }\n", " exports.ContinuousAxis = ContinuousAxis;\n", " ContinuousAxis.__name__ = \"ContinuousAxis\";\n", " },\n", " /* models/axes/datetime_axis.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const linear_axis_1 = require(157) /* ./linear_axis */;\n", " const datetime_tick_formatter_1 = require(158) /* ../formatters/datetime_tick_formatter */;\n", " const datetime_ticker_1 = require(163) /* ../tickers/datetime_ticker */;\n", " class DatetimeAxisView extends linear_axis_1.LinearAxisView {\n", " }\n", " exports.DatetimeAxisView = DatetimeAxisView;\n", " DatetimeAxisView.__name__ = \"DatetimeAxisView\";\n", " class DatetimeAxis extends linear_axis_1.LinearAxis {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_DatetimeAxis() {\n", " this.prototype.default_view = DatetimeAxisView;\n", " this.override({\n", " ticker: () => new datetime_ticker_1.DatetimeTicker(),\n", " formatter: () => new datetime_tick_formatter_1.DatetimeTickFormatter(),\n", " });\n", " }\n", " }\n", " exports.DatetimeAxis = DatetimeAxis;\n", " DatetimeAxis.__name__ = \"DatetimeAxis\";\n", " DatetimeAxis.init_DatetimeAxis();\n", " },\n", " /* models/axes/linear_axis.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const axis_1 = require(150) /* ./axis */;\n", " const continuous_axis_1 = require(155) /* ./continuous_axis */;\n", " const basic_tick_formatter_1 = require(113) /* ../formatters/basic_tick_formatter */;\n", " const basic_ticker_1 = require(109) /* ../tickers/basic_ticker */;\n", " class LinearAxisView extends axis_1.AxisView {\n", " }\n", " exports.LinearAxisView = LinearAxisView;\n", " LinearAxisView.__name__ = \"LinearAxisView\";\n", " class LinearAxis extends continuous_axis_1.ContinuousAxis {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_LinearAxis() {\n", " this.prototype.default_view = LinearAxisView;\n", " this.override({\n", " ticker: () => new basic_ticker_1.BasicTicker(),\n", " formatter: () => new basic_tick_formatter_1.BasicTickFormatter(),\n", " });\n", " }\n", " }\n", " exports.LinearAxis = LinearAxis;\n", " LinearAxis.__name__ = \"LinearAxis\";\n", " LinearAxis.init_LinearAxis();\n", " },\n", " /* models/formatters/datetime_tick_formatter.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const timezone_1 = tslib_1.__importDefault(require(159) /* timezone */);\n", " const tick_formatter_1 = require(114) /* ./tick_formatter */;\n", " const logging_1 = require(72) /* ../../core/logging */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const templating_1 = require(160) /* ../../core/util/templating */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " function _us(t) {\n", " // From double-precision unix (millisecond) timestamp get\n", " // microsecond since last second. Precision seems to run\n", " // out around the hundreds of nanoseconds scale, so rounding\n", " // to the nearest microsecond should round to a nice\n", " // microsecond / millisecond tick.\n", " return Math.round(((t / 1000) % 1) * 1000000);\n", " }\n", " function _array(t) {\n", " return timezone_1.default(t, \"%Y %m %d %H %M %S\").split(/\\s+/).map(e => parseInt(e, 10));\n", " }\n", " function _strftime(t, format) {\n", " if (types_1.isFunction(format)) {\n", " return format(t);\n", " }\n", " else {\n", " // Python's datetime library augments the microsecond directive %f, which is not\n", " // supported by the javascript library timezone: http://bigeasy.github.io/timezone/.\n", " // Use a regular expression to replace %f directive with microseconds.\n", " // TODO: what should we do for negative microsecond strings?\n", " const microsecond_replacement_string = templating_1.sprintf(\"$1%06d\", _us(t));\n", " format = format.replace(/((^|[^%])(%%)*)%f/, microsecond_replacement_string);\n", " if (format.indexOf(\"%\") == -1) {\n", " // timezone seems to ignore any strings without any formatting directives,\n", " // and just return the time argument back instead of the string argument.\n", " // But we want the string argument, in case a user supplies a format string\n", " // which doesn't contain a formatting directive or is only using %f.\n", " return format;\n", " }\n", " return timezone_1.default(t, format);\n", " }\n", " }\n", " // Labels of time units, from finest to coarsest.\n", " const format_order = [\n", " 'microseconds', 'milliseconds', 'seconds', 'minsec', 'minutes', 'hourmin', 'hours', 'days', 'months', 'years',\n", " ];\n", " class DatetimeTickFormatter extends tick_formatter_1.TickFormatter {\n", " constructor(attrs) {\n", " super(attrs);\n", " // Whether or not to strip the leading zeros on tick labels.\n", " this.strip_leading_zeros = true;\n", " }\n", " static init_DatetimeTickFormatter() {\n", " this.define({\n", " microseconds: [p.Array, ['%fus']],\n", " milliseconds: [p.Array, ['%3Nms', '%S.%3Ns']],\n", " seconds: [p.Array, ['%Ss']],\n", " minsec: [p.Array, [':%M:%S']],\n", " minutes: [p.Array, [':%M', '%Mm']],\n", " hourmin: [p.Array, ['%H:%M']],\n", " hours: [p.Array, ['%Hh', '%H:%M']],\n", " days: [p.Array, ['%m/%d', '%a%d']],\n", " months: [p.Array, ['%m/%Y', '%b %Y']],\n", " years: [p.Array, ['%Y']],\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " // TODO (bev) trigger update on format change\n", " this._update_width_formats();\n", " }\n", " _update_width_formats() {\n", " const now = +timezone_1.default(new Date());\n", " const _widths = function (fmt_strings) {\n", " const sizes = fmt_strings.map((fmt_string) => _strftime(now, fmt_string).length);\n", " const sorted = array_1.sort_by(array_1.zip(sizes, fmt_strings), ([size]) => size);\n", " return array_1.unzip(sorted);\n", " };\n", " this._width_formats = {\n", " microseconds: _widths(this.microseconds),\n", " milliseconds: _widths(this.milliseconds),\n", " seconds: _widths(this.seconds),\n", " minsec: _widths(this.minsec),\n", " minutes: _widths(this.minutes),\n", " hourmin: _widths(this.hourmin),\n", " hours: _widths(this.hours),\n", " days: _widths(this.days),\n", " months: _widths(this.months),\n", " years: _widths(this.years),\n", " };\n", " }\n", " // FIXME There is some unfortunate flicker when panning/zooming near the\n", " // span boundaries.\n", " // FIXME Rounding is weird at the 20-us scale and below.\n", " _get_resolution_str(resolution_secs, span_secs) {\n", " // Our resolution boundaries should not be round numbers, because we want\n", " // them to fall between the possible tick intervals (which *are* round\n", " // numbers, as we've worked hard to ensure). Consequently, we adjust the\n", " // resolution upwards a small amount (less than any possible step in\n", " // scales) to make the effective boundaries slightly lower.\n", " const adjusted_secs = resolution_secs * 1.1;\n", " switch (false) {\n", " case !(adjusted_secs < 1e-3): return \"microseconds\";\n", " case !(adjusted_secs < 1.0): return \"milliseconds\";\n", " case !(adjusted_secs < 60): return span_secs >= 60 ? \"minsec\" : \"seconds\";\n", " case !(adjusted_secs < 3600): return span_secs >= 3600 ? \"hourmin\" : \"minutes\";\n", " case !(adjusted_secs < (24 * 3600)): return \"hours\";\n", " case !(adjusted_secs < (31 * 24 * 3600)): return \"days\";\n", " case !(adjusted_secs < (365 * 24 * 3600)): return \"months\";\n", " default: return \"years\";\n", " }\n", " }\n", " doFormat(ticks, _opts) {\n", " // In order to pick the right set of labels, we need to determine\n", " // the resolution of the ticks. We can do this using a ticker if\n", " // it's provided, or by computing the resolution from the actual\n", " // ticks we've been given.\n", " if (ticks.length == 0)\n", " return [];\n", " const span = Math.abs(ticks[ticks.length - 1] - ticks[0]) / 1000.0;\n", " const r = span / (ticks.length - 1);\n", " const resol = this._get_resolution_str(r, span);\n", " const [, [format]] = this._width_formats[resol];\n", " // Apply the format to the tick values\n", " const labels = [];\n", " const resol_ndx = format_order.indexOf(resol);\n", " // This dictionary maps the name of a time resolution (in @format_order)\n", " // to its index in a time.localtime() timetuple. The default is to map\n", " // everything to index 0, which is year. This is not ideal; it might cause\n", " // a problem with the tick at midnight, january 1st, 0 a.d. being incorrectly\n", " // promoted at certain tick resolutions.\n", " const time_tuple_ndx_for_resol = {};\n", " for (const fmt of format_order) {\n", " time_tuple_ndx_for_resol[fmt] = 0;\n", " }\n", " time_tuple_ndx_for_resol.seconds = 5;\n", " time_tuple_ndx_for_resol.minsec = 4;\n", " time_tuple_ndx_for_resol.minutes = 4;\n", " time_tuple_ndx_for_resol.hourmin = 3;\n", " time_tuple_ndx_for_resol.hours = 3;\n", " // As we format each tick, check to see if we are at a boundary of the\n", " // next higher unit of time. If so, replace the current format with one\n", " // from that resolution. This is not the best heuristic in the world,\n", " // but it works! There is some trickiness here due to having to deal\n", " // with hybrid formats in a reasonable manner.\n", " for (const t of ticks) {\n", " let s, tm;\n", " try {\n", " tm = _array(t);\n", " s = _strftime(t, format);\n", " }\n", " catch (error) {\n", " logging_1.logger.warn(`unable to format tick for timestamp value ${t}`);\n", " logging_1.logger.warn(` - ${error}`);\n", " labels.push(\"ERR\");\n", " continue;\n", " }\n", " let hybrid_handled = false;\n", " let next_ndx = resol_ndx;\n", " // The way to check that we are at the boundary of the next unit of\n", " // time is by checking that we have 0 units of the resolution, i.e.\n", " // we are at zero minutes, so display hours, or we are at zero seconds,\n", " // so display minutes (and if that is zero as well, then display hours).\n", " while (tm[time_tuple_ndx_for_resol[format_order[next_ndx]]] == 0) {\n", " let next_format;\n", " next_ndx += 1;\n", " if (next_ndx == format_order.length)\n", " break;\n", " if ((resol == \"minsec\" || resol == \"hourmin\") && !hybrid_handled) {\n", " if ((resol == \"minsec\" && tm[4] == 0 && tm[5] != 0) || (resol == \"hourmin\" && tm[3] == 0 && tm[4] != 0)) {\n", " next_format = this._width_formats[format_order[resol_ndx - 1]][1][0];\n", " s = _strftime(t, next_format);\n", " break;\n", " }\n", " else {\n", " hybrid_handled = true;\n", " }\n", " }\n", " next_format = this._width_formats[format_order[next_ndx]][1][0];\n", " s = _strftime(t, next_format);\n", " }\n", " // TODO: should expose this in api. %H, %d, etc use leading zeros and\n", " // users might prefer to see them lined up correctly.\n", " if (this.strip_leading_zeros) {\n", " let ss = s.replace(/^0+/g, \"\");\n", " if (ss != s && isNaN(parseInt(ss))) {\n", " // If the string can now be parsed as starting with an integer, then\n", " // leave all zeros stripped, otherwise start with a zero. Hence:\n", " // A label such as '000ms' should leave one zero.\n", " // A label such as '001ms' or '0-1ms' should not leave a leading zero.\n", " ss = `0${ss}`;\n", " }\n", " labels.push(ss);\n", " }\n", " else\n", " labels.push(s);\n", " }\n", " return labels;\n", " }\n", " }\n", " exports.DatetimeTickFormatter = DatetimeTickFormatter;\n", " DatetimeTickFormatter.__name__ = \"DatetimeTickFormatter\";\n", " DatetimeTickFormatter.init_DatetimeTickFormatter();\n", " },\n", " /* timezone/index.js */ function _(require, module, exports) {\n", " !function (definition) {\n", " if (typeof module == \"object\" && module.exports)\n", " module.exports = definition();\n", " else if (typeof define == \"function\")\n", " define(definition);\n", " else\n", " this.tz = definition();\n", " }(function () {\n", " /*\n", " function die () {\n", " console.log.apply(console, __slice.call(arguments, 0));\n", " return process.exit(1);\n", " }\n", " \n", " function say () { return console.log.apply(console, __slice.call(arguments, 0)) }\n", " */\n", " function actualize(entry, rule, year) {\n", " var actualized, date = rule.day[1];\n", " do {\n", " actualized = new Date(Date.UTC(year, rule.month, Math.abs(date++)));\n", " } while (rule.day[0] < 7 && actualized.getUTCDay() != rule.day[0]);\n", " actualized = {\n", " clock: rule.clock,\n", " sort: actualized.getTime(),\n", " rule: rule,\n", " save: rule.save * 6e4,\n", " offset: entry.offset\n", " };\n", " actualized[actualized.clock] = actualized.sort + rule.time * 6e4;\n", " if (actualized.posix) {\n", " actualized.wallclock = actualized[actualized.clock] + (entry.offset + rule.saved);\n", " }\n", " else {\n", " actualized.posix = actualized[actualized.clock] - (entry.offset + rule.saved);\n", " }\n", " return actualized;\n", " }\n", " function find(request, clock, time) {\n", " var i, I, entry, found, zone = request[request.zone], actualized = [], abbrev, rules, j, year = new Date(time).getUTCFullYear(), off = 1;\n", " for (i = 1, I = zone.length; i < I; i++)\n", " if (zone[i][clock] <= time)\n", " break;\n", " entry = zone[i];\n", " if (entry.rules) {\n", " rules = request[entry.rules];\n", " for (j = year + 1; j >= year - off; --j)\n", " for (i = 0, I = rules.length; i < I; i++)\n", " if (rules[i].from <= j && j <= rules[i].to)\n", " actualized.push(actualize(entry, rules[i], j));\n", " else if (rules[i].to < j && off == 1)\n", " off = j - rules[i].to;\n", " actualized.sort(function (a, b) { return a.sort - b.sort; });\n", " for (i = 0, I = actualized.length; i < I; i++) {\n", " if (time >= actualized[i][clock] && actualized[i][actualized[i].clock] > entry[actualized[i].clock])\n", " found = actualized[i];\n", " }\n", " }\n", " if (found) {\n", " if (abbrev = /^(.*)\\/(.*)$/.exec(entry.format)) {\n", " found.abbrev = abbrev[found.save ? 2 : 1];\n", " }\n", " else {\n", " found.abbrev = entry.format.replace(/%s/, found.rule.letter);\n", " }\n", " }\n", " return found || entry;\n", " }\n", " function convertToWallclock(request, posix) {\n", " if (request.zone == \"UTC\")\n", " return posix;\n", " request.entry = find(request, \"posix\", posix);\n", " return posix + request.entry.offset + request.entry.save;\n", " }\n", " function convertToPOSIX(request, wallclock) {\n", " if (request.zone == \"UTC\")\n", " return wallclock;\n", " var entry, diff;\n", " request.entry = entry = find(request, \"wallclock\", wallclock);\n", " diff = wallclock - entry.wallclock;\n", " return 0 < diff && diff < entry.save ? null : wallclock - entry.offset - entry.save;\n", " }\n", " function adjust(request, posix, match) {\n", " var increment = +(match[1] + 1) // conversion necessary for week day addition\n", " , offset = match[2] * increment, index = UNITS.indexOf(match[3].toLowerCase()), date;\n", " if (index > 9) {\n", " posix += offset * TIME[index - 10];\n", " }\n", " else {\n", " date = new Date(convertToWallclock(request, posix));\n", " if (index < 7) {\n", " while (offset) {\n", " date.setUTCDate(date.getUTCDate() + increment);\n", " if (date.getUTCDay() == index)\n", " offset -= increment;\n", " }\n", " }\n", " else if (index == 7) {\n", " date.setUTCFullYear(date.getUTCFullYear() + offset);\n", " }\n", " else if (index == 8) {\n", " date.setUTCMonth(date.getUTCMonth() + offset);\n", " }\n", " else {\n", " date.setUTCDate(date.getUTCDate() + offset);\n", " }\n", " if ((posix = convertToPOSIX(request, date.getTime())) == null) {\n", " posix = convertToPOSIX(request, date.getTime() + 864e5 * increment) - 864e5 * increment;\n", " }\n", " }\n", " return posix;\n", " }\n", " function convert(vargs) {\n", " if (!vargs.length)\n", " return \"1.0.23\";\n", " var request = Object.create(this), adjustments = [], i, I, $, argument, date;\n", " for (i = 0; i < vargs.length; i++) { // leave the for loop alone, it works.\n", " argument = vargs[i];\n", " // https://twitter.com/bigeasy/status/215112186572439552\n", " if (Array.isArray(argument)) {\n", " if (!i && !isNaN(argument[1])) {\n", " date = argument;\n", " }\n", " else {\n", " argument.splice.apply(vargs, [i--, 1].concat(argument));\n", " }\n", " }\n", " else if (isNaN(argument)) {\n", " $ = typeof argument;\n", " if ($ == \"string\") {\n", " if (~argument.indexOf(\"%\")) {\n", " request.format = argument;\n", " }\n", " else if (!i && argument == \"*\") {\n", " date = argument;\n", " }\n", " else if (!i && ($ = /^(\\d{4})-(\\d{2})-(\\d{2})(?:[T\\s](\\d{2}):(\\d{2})(?::(\\d{2})(?:\\.(\\d+))?)?(Z|(([+-])(\\d{2}(:\\d{2}){0,2})))?)?$/.exec(argument))) {\n", " date = [];\n", " date.push.apply(date, $.slice(1, 8));\n", " if ($[9]) {\n", " date.push($[10] + 1);\n", " date.push.apply(date, $[11].split(/:/));\n", " }\n", " else if ($[8]) {\n", " date.push(1);\n", " }\n", " }\n", " else if (/^\\w{2,3}_\\w{2}$/.test(argument)) {\n", " request.locale = argument;\n", " }\n", " else if ($ = UNIT_RE.exec(argument)) {\n", " adjustments.push($);\n", " }\n", " else {\n", " request.zone = argument;\n", " }\n", " }\n", " else if ($ == \"function\") {\n", " if ($ = argument.call(request))\n", " return $;\n", " }\n", " else if (/^\\w{2,3}_\\w{2}$/.test(argument.name)) {\n", " request[argument.name] = argument;\n", " }\n", " else if (argument.zones) {\n", " for ($ in argument.zones)\n", " request[$] = argument.zones[$];\n", " for ($ in argument.rules)\n", " request[$] = argument.rules[$];\n", " }\n", " }\n", " else if (!i) {\n", " date = argument;\n", " }\n", " }\n", " if (!request[request.locale])\n", " delete request.locale;\n", " if (!request[request.zone])\n", " delete request.zone;\n", " if (date != null) {\n", " if (date == \"*\") {\n", " date = request.clock();\n", " }\n", " else if (Array.isArray(date)) {\n", " $ = [];\n", " I = !date[7];\n", " for (i = 0; i < 11; i++)\n", " $[i] = +(date[i] || 0); // conversion necessary for decrement\n", " --$[1]; // Grr..\n", " date = Date.UTC.apply(Date.UTC, $) + -$[7] * ($[8] * 36e5 + $[9] * 6e4 + $[10] * 1e3);\n", " }\n", " else {\n", " date = Math.floor(date);\n", " }\n", " if (!isNaN(date)) {\n", " if (I)\n", " date = convertToPOSIX(request, date);\n", " if (date == null)\n", " return date;\n", " for (i = 0, I = adjustments.length; i < I; i++) {\n", " date = adjust(request, date, adjustments[i]);\n", " }\n", " if (!request.format)\n", " return date;\n", " $ = new Date(convertToWallclock(request, date));\n", " return request.format.replace(/%([-0_^]?)(:{0,3})(\\d*)(.)/g, function (value, flag, colons, padding, specifier) {\n", " var f, fill = \"0\", pad;\n", " if (f = request[specifier]) {\n", " value = String(f.call(request, $, date, flag, colons.length));\n", " if ((flag || f.style) == \"_\")\n", " fill = \" \";\n", " pad = flag == \"-\" ? 0 : f.pad || 0;\n", " while (value.length < pad)\n", " value = fill + value;\n", " pad = flag == \"-\" ? 0 : padding || f.pad;\n", " while (value.length < pad)\n", " value = fill + value;\n", " if (specifier == \"N\" && pad < value.length)\n", " value = value.slice(0, pad);\n", " if (flag == \"^\")\n", " value = value.toUpperCase();\n", " }\n", " return value;\n", " });\n", " }\n", " }\n", " return function () { return request.convert(arguments); };\n", " }\n", " var context = { clock: function () { return +(new Date()); },\n", " zone: \"UTC\",\n", " entry: { abbrev: \"UTC\", offset: 0, save: 0 },\n", " UTC: 1,\n", " z: function (date, posix, flag, delimiters) {\n", " var offset = this.entry.offset + this.entry.save, seconds = Math.abs(offset / 1000), parts = [], part = 3600, i, z;\n", " for (i = 0; i < 3; i++) {\n", " parts.push((\"0\" + Math.floor(seconds / part)).slice(-2));\n", " seconds %= part;\n", " part /= 60;\n", " }\n", " if (flag == \"^\" && !offset)\n", " return \"Z\";\n", " if (flag == \"^\")\n", " delimiters = 3;\n", " if (delimiters == 3) {\n", " z = parts.join(\":\");\n", " z = z.replace(/:00$/, \"\");\n", " if (flag != \"^\")\n", " z = z.replace(/:00$/, \"\");\n", " }\n", " else if (delimiters) {\n", " z = parts.slice(0, delimiters + 1).join(\":\");\n", " if (flag == \"^\")\n", " z = z.replace(/:00$/, \"\");\n", " }\n", " else {\n", " z = parts.slice(0, 2).join(\"\");\n", " }\n", " z = (offset < 0 ? \"-\" : \"+\") + z;\n", " z = z.replace(/([-+])(0)/, { \"_\": \" $1\", \"-\": \"$1\" }[flag] || \"$1$2\");\n", " return z;\n", " },\n", " \"%\": function (date) { return \"%\"; },\n", " n: function (date) { return \"\\n\"; },\n", " t: function (date) { return \"\\t\"; },\n", " U: function (date) { return weekOfYear(date, 0); },\n", " W: function (date) { return weekOfYear(date, 1); },\n", " V: function (date) { return isoWeek(date)[0]; },\n", " G: function (date) { return isoWeek(date)[1]; },\n", " g: function (date) { return isoWeek(date)[1] % 100; },\n", " j: function (date) { return Math.floor((date.getTime() - Date.UTC(date.getUTCFullYear(), 0)) / 864e5) + 1; },\n", " s: function (date) { return Math.floor(date.getTime() / 1000); },\n", " C: function (date) { return Math.floor(date.getUTCFullYear() / 100); },\n", " N: function (date) { return date.getTime() % 1000 * 1000000; },\n", " m: function (date) { return date.getUTCMonth() + 1; },\n", " Y: function (date) { return date.getUTCFullYear(); },\n", " y: function (date) { return date.getUTCFullYear() % 100; },\n", " H: function (date) { return date.getUTCHours(); },\n", " M: function (date) { return date.getUTCMinutes(); },\n", " S: function (date) { return date.getUTCSeconds(); },\n", " e: function (date) { return date.getUTCDate(); },\n", " d: function (date) { return date.getUTCDate(); },\n", " u: function (date) { return date.getUTCDay() || 7; },\n", " w: function (date) { return date.getUTCDay(); },\n", " l: function (date) { return date.getUTCHours() % 12 || 12; },\n", " I: function (date) { return date.getUTCHours() % 12 || 12; },\n", " k: function (date) { return date.getUTCHours(); },\n", " Z: function (date) { return this.entry.abbrev; },\n", " a: function (date) { return this[this.locale].day.abbrev[date.getUTCDay()]; },\n", " A: function (date) { return this[this.locale].day.full[date.getUTCDay()]; },\n", " h: function (date) { return this[this.locale].month.abbrev[date.getUTCMonth()]; },\n", " b: function (date) { return this[this.locale].month.abbrev[date.getUTCMonth()]; },\n", " B: function (date) { return this[this.locale].month.full[date.getUTCMonth()]; },\n", " P: function (date) { return this[this.locale].meridiem[Math.floor(date.getUTCHours() / 12)].toLowerCase(); },\n", " p: function (date) { return this[this.locale].meridiem[Math.floor(date.getUTCHours() / 12)]; },\n", " R: function (date, posix) { return this.convert([posix, \"%H:%M\"]); },\n", " T: function (date, posix) { return this.convert([posix, \"%H:%M:%S\"]); },\n", " D: function (date, posix) { return this.convert([posix, \"%m/%d/%y\"]); },\n", " F: function (date, posix) { return this.convert([posix, \"%Y-%m-%d\"]); },\n", " x: function (date, posix) { return this.convert([posix, this[this.locale].date]); },\n", " r: function (date, posix) { return this.convert([posix, this[this.locale].time12 || '%I:%M:%S']); },\n", " X: function (date, posix) { return this.convert([posix, this[this.locale].time24]); },\n", " c: function (date, posix) { return this.convert([posix, this[this.locale].dateTime]); },\n", " convert: convert,\n", " locale: \"en_US\",\n", " en_US: {\n", " date: \"%m/%d/%Y\",\n", " time24: \"%I:%M:%S %p\",\n", " time12: \"%I:%M:%S %p\",\n", " dateTime: \"%a %d %b %Y %I:%M:%S %p %Z\",\n", " meridiem: [\"AM\", \"PM\"],\n", " month: {\n", " abbrev: \"Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec\".split(\"|\"),\n", " full: \"January|February|March|April|May|June|July|August|September|October|November|December\".split(\"|\")\n", " },\n", " day: {\n", " abbrev: \"Sun|Mon|Tue|Wed|Thu|Fri|Sat\".split(\"|\"),\n", " full: \"Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday\".split(\"|\")\n", " }\n", " }\n", " };\n", " var UNITS = \"Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|year|month|day|hour|minute|second|millisecond\", UNIT_RE = new RegExp(\"^\\\\s*([+-])(\\\\d+)\\\\s+(\" + UNITS + \")s?\\\\s*$\", \"i\"), TIME = [36e5, 6e4, 1e3, 1];\n", " UNITS = UNITS.toLowerCase().split(\"|\");\n", " \"delmHMSUWVgCIky\".replace(/./g, function (e) { context[e].pad = 2; });\n", " context.N.pad = 9;\n", " context.j.pad = 3;\n", " context.k.style = \"_\";\n", " context.l.style = \"_\";\n", " context.e.style = \"_\";\n", " function weekOfYear(date, startOfWeek) {\n", " var diff, nyd, weekStart;\n", " nyd = new Date(Date.UTC(date.getUTCFullYear(), 0));\n", " diff = Math.floor((date.getTime() - nyd.getTime()) / 864e5);\n", " if (nyd.getUTCDay() == startOfWeek) {\n", " weekStart = 0;\n", " }\n", " else {\n", " weekStart = 7 - nyd.getUTCDay() + startOfWeek;\n", " if (weekStart == 8) {\n", " weekStart = 1;\n", " }\n", " }\n", " return diff >= weekStart ? Math.floor((diff - weekStart) / 7) + 1 : 0;\n", " }\n", " function isoWeek(date) {\n", " var nyd, nyy, week;\n", " nyy = date.getUTCFullYear();\n", " nyd = new Date(Date.UTC(nyy, 0)).getUTCDay();\n", " week = weekOfYear(date, 1) + (nyd > 1 && nyd <= 4 ? 1 : 0);\n", " if (!week) {\n", " nyy = date.getUTCFullYear() - 1;\n", " nyd = new Date(Date.UTC(nyy, 0)).getUTCDay();\n", " week = nyd == 4 || (nyd == 3 && new Date(nyy, 1, 29).getDate() == 29) ? 53 : 52;\n", " return [week, date.getUTCFullYear() - 1];\n", " }\n", " else if (week == 53 && !(nyd == 4 || (nyd == 3 && new Date(nyy, 1, 29).getDate() == 29))) {\n", " return [1, date.getUTCFullYear() + 1];\n", " }\n", " else {\n", " return [week, date.getUTCFullYear()];\n", " }\n", " }\n", " return function () { return context.convert(arguments); };\n", " });\n", " },\n", " /* core/util/templating.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const Numbro = tslib_1.__importStar(require(161) /* @bokeh/numbro */);\n", " const sprintf_js_1 = require(162) /* sprintf-js */;\n", " const timezone_1 = tslib_1.__importDefault(require(159) /* timezone */);\n", " const string_1 = require(24) /* ./string */;\n", " const types_1 = require(8) /* ./types */;\n", " exports.DEFAULT_FORMATTERS = {\n", " numeral: (value, format, _special_vars) => Numbro.format(value, format),\n", " datetime: (value, format, _special_vars) => timezone_1.default(value, format),\n", " printf: (value, format, _special_vars) => sprintf(format, value),\n", " };\n", " function sprintf(format, ...args) {\n", " return sprintf_js_1.sprintf(format, ...args);\n", " }\n", " exports.sprintf = sprintf;\n", " function basic_formatter(value, _format, _special_vars) {\n", " if (types_1.isNumber(value)) {\n", " const format = (() => {\n", " switch (false) {\n", " case Math.floor(value) != value:\n", " return \"%d\";\n", " case !(Math.abs(value) > 0.1) || !(Math.abs(value) < 1000):\n", " return \"%0.3f\";\n", " default:\n", " return \"%0.3e\";\n", " }\n", " })();\n", " return sprintf(format, value);\n", " }\n", " else\n", " return `${value}`; // get strings for categorical types\n", " }\n", " exports.basic_formatter = basic_formatter;\n", " function get_formatter(raw_spec, format, formatters) {\n", " // no format, use default built in formatter\n", " if (format == null)\n", " return basic_formatter;\n", " // format spec in the formatters dict, use that\n", " if (formatters != null && raw_spec in formatters) {\n", " const formatter = formatters[raw_spec];\n", " if (types_1.isString(formatter)) {\n", " if (formatter in exports.DEFAULT_FORMATTERS)\n", " return exports.DEFAULT_FORMATTERS[formatter];\n", " else\n", " throw new Error(`Unknown tooltip field formatter type '${formatter}'`);\n", " }\n", " return function (value, format, special_vars) {\n", " return formatter.format(value, format, special_vars);\n", " };\n", " }\n", " // otherwise use \"numeral\" as default\n", " return exports.DEFAULT_FORMATTERS.numeral;\n", " }\n", " exports.get_formatter = get_formatter;\n", " function _get_special_value(name, special_vars) {\n", " if (name in special_vars)\n", " return special_vars[name];\n", " else\n", " throw new Error(`Unknown special variable '\\$${name}'`);\n", " }\n", " function _get_column_value(name, data_source, i) {\n", " const column = data_source.get_column(name);\n", " // missing column\n", " if (column == null)\n", " return null;\n", " // typical (non-image) index\n", " if (types_1.isNumber(i))\n", " return column[i];\n", " // image index\n", " const data = column[i.index];\n", " if (types_1.isTypedArray(data) || types_1.isArray(data)) {\n", " // inspect array of arrays\n", " if (types_1.isArray(data[0])) {\n", " const row = data[i.dim2];\n", " return row[i.dim1];\n", " }\n", " else\n", " return data[i.flat_index]; // inspect flat array\n", " }\n", " else\n", " return data; // inspect per-image scalar data\n", " }\n", " function get_value(raw_name, data_source, i, special_vars) {\n", " if (raw_name[0] == \"$\") {\n", " const name = raw_name.substring(1);\n", " return _get_special_value(name, special_vars);\n", " }\n", " else {\n", " const name = raw_name.substring(1).replace(/[{}]/g, \"\");\n", " return _get_column_value(name, data_source, i);\n", " }\n", " }\n", " exports.get_value = get_value;\n", " function replace_placeholders(str, data_source, i, formatters, special_vars = {}) {\n", " // this handles the special case @$name, replacing it with an @var corresponding to special_vars.name\n", " str = str.replace(/@\\$name/g, (_match) => `@{${special_vars.name}}`);\n", " //\n", " // (?:\\$\\w+) - special vars: $x\n", " // (?:@\\w+) - simple names: @foo\n", " // (?:@{(?:[^{}]+)})) - full names: @{one two}\n", " //\n", " // (?:{([^{}]+)})? - (optional) format for all of the above: @foo{fmt}\n", " //\n", " str = str.replace(/((?:\\$\\w+)|(?:@\\w+)|(?:@{(?:[^{}]+)}))(?:{([^{}]+)})?/g, (_match, spec, format) => {\n", " const value = get_value(spec, data_source, i, special_vars);\n", " // missing value, return ???\n", " if (value == null)\n", " return `${string_1.escape(\"???\")}`;\n", " // 'safe' format, return the value as-is\n", " if (format == 'safe')\n", " return `${value}`;\n", " // format and escape everything else\n", " const formatter = get_formatter(spec, format, formatters);\n", " return `${string_1.escape(formatter(value, format, special_vars))}`;\n", " });\n", " return str;\n", " }\n", " exports.replace_placeholders = replace_placeholders;\n", " },\n", " /* @bokeh/numbro/numbro.js */ function _(require, module, exports) {\n", " /*!\n", " * numbro.js\n", " * version : 1.6.2\n", " * author : Företagsplatsen AB\n", " * license : MIT\n", " * http://www.foretagsplatsen.se\n", " */\n", " /************************************\n", " Constants\n", " ************************************/\n", " var numbro, VERSION = '1.6.2', \n", " // internal storage for culture config files\n", " cultures = {}, \n", " // Todo: Remove in 2.0.0\n", " languages = cultures, currentCulture = 'en-US', zeroFormat = null, defaultFormat = '0,0', defaultCurrencyFormat = '0$', \n", " // check for nodeJS\n", " hasModule = (typeof module !== 'undefined' && module.exports), \n", " // default culture\n", " enUS = {\n", " delimiters: {\n", " thousands: ',',\n", " decimal: '.'\n", " },\n", " abbreviations: {\n", " thousand: 'k',\n", " million: 'm',\n", " billion: 'b',\n", " trillion: 't'\n", " },\n", " ordinal: function (number) {\n", " var b = number % 10;\n", " return (~~(number % 100 / 10) === 1) ? 'th' :\n", " (b === 1) ? 'st' :\n", " (b === 2) ? 'nd' :\n", " (b === 3) ? 'rd' : 'th';\n", " },\n", " currency: {\n", " symbol: '$',\n", " position: 'prefix'\n", " },\n", " defaults: {\n", " currencyFormat: ',0000 a'\n", " },\n", " formats: {\n", " fourDigits: '0000 a',\n", " fullWithTwoDecimals: '$ ,0.00',\n", " fullWithTwoDecimalsNoCurrency: ',0.00'\n", " }\n", " };\n", " /************************************\n", " Constructors\n", " ************************************/\n", " // Numbro prototype object\n", " function Numbro(number) {\n", " this._value = number;\n", " }\n", " function zeroes(count) {\n", " var i, ret = '';\n", " for (i = 0; i < count; i++) {\n", " ret += '0';\n", " }\n", " return ret;\n", " }\n", " /**\n", " * Implementation of toFixed() for numbers with exponent > 21\n", " *\n", " *\n", " */\n", " function toFixedLarge(value, precision) {\n", " var mantissa, beforeDec, afterDec, exponent, str;\n", " str = value.toString();\n", " mantissa = str.split('e')[0];\n", " exponent = str.split('e')[1];\n", " beforeDec = mantissa.split('.')[0];\n", " afterDec = mantissa.split('.')[1] || '';\n", " str = beforeDec + afterDec + zeroes(exponent - afterDec.length);\n", " if (precision > 0) {\n", " str += '.' + zeroes(precision);\n", " }\n", " return str;\n", " }\n", " /**\n", " * Implementation of toFixed() that treats floats more like decimals\n", " *\n", " * Fixes binary rounding issues (eg. (0.615).toFixed(2) === '0.61') that present\n", " * problems for accounting- and finance-related software.\n", " */\n", " function toFixed(value, precision, roundingFunction, optionals) {\n", " var power = Math.pow(10, precision), optionalsRegExp, output;\n", " if (value.toFixed(0).search('e') > -1) {\n", " // Above 1e21, toFixed returns scientific notation, which\n", " // is useless and unexpected\n", " output = toFixedLarge(value, precision);\n", " }\n", " else {\n", " //roundingFunction = (roundingFunction !== undefined ? roundingFunction : Math.round);\n", " // Multiply up by precision, round accurately, then divide and use native toFixed():\n", " output = (roundingFunction(value * power) / power).toFixed(precision);\n", " }\n", " if (optionals) {\n", " optionalsRegExp = new RegExp('0{1,' + optionals + '}$');\n", " output = output.replace(optionalsRegExp, '');\n", " }\n", " return output;\n", " }\n", " /************************************\n", " Formatting\n", " ************************************/\n", " // determine what type of formatting we need to do\n", " function formatNumbro(value, format, roundingFunction) {\n", " var output;\n", " // TODO: do something with `language`\n", " // figure out what kind of format we are dealing with\n", " if (format.indexOf('$') > -1) { // currency!!!!!\n", " output = formatCurrency(value, format, roundingFunction);\n", " }\n", " else if (format.indexOf('%') > -1) { // percentage\n", " output = formatPercentage(value, format, roundingFunction);\n", " }\n", " else if (format.indexOf(':') > -1) { // time\n", " output = formatTime(value);\n", " }\n", " else { // plain ol' numbers or bytes\n", " output = formatNumber(value, format, roundingFunction);\n", " }\n", " // return string\n", " return output;\n", " }\n", " function formatCurrency(value, originalFormat, roundingFunction) {\n", " var format = originalFormat, symbolIndex = format.indexOf('$'), openParenIndex = format.indexOf('('), plusSignIndex = format.indexOf('+'), minusSignIndex = format.indexOf('-'), space = '', decimalSeparator = '', spliceIndex, output;\n", " if (format.indexOf('$') === -1) {\n", " // Use defaults instead of the format provided\n", " if (cultures[currentCulture].currency.position === 'infix') {\n", " decimalSeparator = cultures[currentCulture].currency.symbol;\n", " if (cultures[currentCulture].currency.spaceSeparated) {\n", " decimalSeparator = ' ' + decimalSeparator + ' ';\n", " }\n", " }\n", " else if (cultures[currentCulture].currency.spaceSeparated) {\n", " space = ' ';\n", " }\n", " }\n", " else {\n", " // check for space before or after currency\n", " if (format.indexOf(' $') > -1) {\n", " space = ' ';\n", " format = format.replace(' $', '');\n", " }\n", " else if (format.indexOf('$ ') > -1) {\n", " space = ' ';\n", " format = format.replace('$ ', '');\n", " }\n", " else {\n", " format = format.replace('$', '');\n", " }\n", " }\n", " // Format The Number\n", " output = formatNumber(value, format, roundingFunction, decimalSeparator);\n", " if (originalFormat.indexOf('$') === -1) {\n", " // Use defaults instead of the format provided\n", " switch (cultures[currentCulture].currency.position) {\n", " case 'postfix':\n", " if (output.indexOf(')') > -1) {\n", " output = output.split('');\n", " output.splice(-1, 0, space + cultures[currentCulture].currency.symbol);\n", " output = output.join('');\n", " }\n", " else {\n", " output = output + space + cultures[currentCulture].currency.symbol;\n", " }\n", " break;\n", " case 'infix':\n", " break;\n", " case 'prefix':\n", " if (output.indexOf('(') > -1 || output.indexOf('-') > -1) {\n", " output = output.split('');\n", " spliceIndex = Math.max(openParenIndex, minusSignIndex) + 1;\n", " output.splice(spliceIndex, 0, cultures[currentCulture].currency.symbol + space);\n", " output = output.join('');\n", " }\n", " else {\n", " output = cultures[currentCulture].currency.symbol + space + output;\n", " }\n", " break;\n", " default:\n", " throw Error('Currency position should be among [\"prefix\", \"infix\", \"postfix\"]');\n", " }\n", " }\n", " else {\n", " // position the symbol\n", " if (symbolIndex <= 1) {\n", " if (output.indexOf('(') > -1 || output.indexOf('+') > -1 || output.indexOf('-') > -1) {\n", " output = output.split('');\n", " spliceIndex = 1;\n", " if (symbolIndex < openParenIndex || symbolIndex < plusSignIndex || symbolIndex < minusSignIndex) {\n", " // the symbol appears before the \"(\", \"+\" or \"-\"\n", " spliceIndex = 0;\n", " }\n", " output.splice(spliceIndex, 0, cultures[currentCulture].currency.symbol + space);\n", " output = output.join('');\n", " }\n", " else {\n", " output = cultures[currentCulture].currency.symbol + space + output;\n", " }\n", " }\n", " else {\n", " if (output.indexOf(')') > -1) {\n", " output = output.split('');\n", " output.splice(-1, 0, space + cultures[currentCulture].currency.symbol);\n", " output = output.join('');\n", " }\n", " else {\n", " output = output + space + cultures[currentCulture].currency.symbol;\n", " }\n", " }\n", " }\n", " return output;\n", " }\n", " function formatPercentage(value, format, roundingFunction) {\n", " var space = '', output;\n", " value = value * 100;\n", " // check for space before %\n", " if (format.indexOf(' %') > -1) {\n", " space = ' ';\n", " format = format.replace(' %', '');\n", " }\n", " else {\n", " format = format.replace('%', '');\n", " }\n", " output = formatNumber(value, format, roundingFunction);\n", " if (output.indexOf(')') > -1) {\n", " output = output.split('');\n", " output.splice(-1, 0, space + '%');\n", " output = output.join('');\n", " }\n", " else {\n", " output = output + space + '%';\n", " }\n", " return output;\n", " }\n", " function formatTime(value) {\n", " var hours = Math.floor(value / 60 / 60), minutes = Math.floor((value - (hours * 60 * 60)) / 60), seconds = Math.round(value - (hours * 60 * 60) - (minutes * 60));\n", " return hours + ':' +\n", " ((minutes < 10) ? '0' + minutes : minutes) + ':' +\n", " ((seconds < 10) ? '0' + seconds : seconds);\n", " }\n", " function formatNumber(value, format, roundingFunction, sep) {\n", " var negP = false, signed = false, optDec = false, abbr = '', i, abbrK = false, // force abbreviation to thousands\n", " abbrM = false, // force abbreviation to millions\n", " abbrB = false, // force abbreviation to billions\n", " abbrT = false, // force abbreviation to trillions\n", " abbrForce = false, // force abbreviation\n", " bytes = '', ord = '', abs = Math.abs(value), binarySuffixes = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'], decimalSuffixes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], min, max, power, totalLength, length, minimumPrecision, pow, w, intPrecision, precision, prefix, postfix, thousands, d = '', forcedNeg = false, neg = false, indexOpenP, size, indexMinus, paren = '', minlen;\n", " // check if number is zero and a custom zero format has been set\n", " if (value === 0 && zeroFormat !== null) {\n", " return zeroFormat;\n", " }\n", " if (!isFinite(value)) {\n", " return '' + value;\n", " }\n", " if (format.indexOf('{') === 0) {\n", " var end = format.indexOf('}');\n", " if (end === -1) {\n", " throw Error('Format should also contain a \"}\"');\n", " }\n", " prefix = format.slice(1, end);\n", " format = format.slice(end + 1);\n", " }\n", " else {\n", " prefix = '';\n", " }\n", " if (format.indexOf('}') === format.length - 1) {\n", " var start = format.indexOf('{');\n", " if (start === -1) {\n", " throw Error('Format should also contain a \"{\"');\n", " }\n", " postfix = format.slice(start + 1, -1);\n", " format = format.slice(0, start + 1);\n", " }\n", " else {\n", " postfix = '';\n", " }\n", " // check for min length\n", " var info;\n", " if (format.indexOf('.') === -1) {\n", " info = format.match(/([0-9]+).*/);\n", " }\n", " else {\n", " info = format.match(/([0-9]+)\\..*/);\n", " }\n", " minlen = info === null ? -1 : info[1].length;\n", " // see if we should use parentheses for negative number or if we should prefix with a sign\n", " // if both are present we default to parentheses\n", " if (format.indexOf('-') !== -1) {\n", " forcedNeg = true;\n", " }\n", " if (format.indexOf('(') > -1) {\n", " negP = true;\n", " format = format.slice(1, -1);\n", " }\n", " else if (format.indexOf('+') > -1) {\n", " signed = true;\n", " format = format.replace(/\\+/g, '');\n", " }\n", " // see if abbreviation is wanted\n", " if (format.indexOf('a') > -1) {\n", " intPrecision = format.split('.')[0].match(/[0-9]+/g) || ['0'];\n", " intPrecision = parseInt(intPrecision[0], 10);\n", " // check if abbreviation is specified\n", " abbrK = format.indexOf('aK') >= 0;\n", " abbrM = format.indexOf('aM') >= 0;\n", " abbrB = format.indexOf('aB') >= 0;\n", " abbrT = format.indexOf('aT') >= 0;\n", " abbrForce = abbrK || abbrM || abbrB || abbrT;\n", " // check for space before abbreviation\n", " if (format.indexOf(' a') > -1) {\n", " abbr = ' ';\n", " format = format.replace(' a', '');\n", " }\n", " else {\n", " format = format.replace('a', '');\n", " }\n", " totalLength = Math.floor(Math.log(abs) / Math.LN10) + 1;\n", " minimumPrecision = totalLength % 3;\n", " minimumPrecision = minimumPrecision === 0 ? 3 : minimumPrecision;\n", " if (intPrecision && abs !== 0) {\n", " length = Math.floor(Math.log(abs) / Math.LN10) + 1 - intPrecision;\n", " pow = 3 * ~~((Math.min(intPrecision, totalLength) - minimumPrecision) / 3);\n", " abs = abs / Math.pow(10, pow);\n", " if (format.indexOf('.') === -1 && intPrecision > 3) {\n", " format += '[.]';\n", " size = length === 0 ? 0 : 3 * ~~(length / 3) - length;\n", " size = size < 0 ? size + 3 : size;\n", " for (i = 0; i < size; i++) {\n", " format += '0';\n", " }\n", " }\n", " }\n", " if (Math.floor(Math.log(Math.abs(value)) / Math.LN10) + 1 !== intPrecision) {\n", " if (abs >= Math.pow(10, 12) && !abbrForce || abbrT) {\n", " // trillion\n", " abbr = abbr + cultures[currentCulture].abbreviations.trillion;\n", " value = value / Math.pow(10, 12);\n", " }\n", " else if (abs < Math.pow(10, 12) && abs >= Math.pow(10, 9) && !abbrForce || abbrB) {\n", " // billion\n", " abbr = abbr + cultures[currentCulture].abbreviations.billion;\n", " value = value / Math.pow(10, 9);\n", " }\n", " else if (abs < Math.pow(10, 9) && abs >= Math.pow(10, 6) && !abbrForce || abbrM) {\n", " // million\n", " abbr = abbr + cultures[currentCulture].abbreviations.million;\n", " value = value / Math.pow(10, 6);\n", " }\n", " else if (abs < Math.pow(10, 6) && abs >= Math.pow(10, 3) && !abbrForce || abbrK) {\n", " // thousand\n", " abbr = abbr + cultures[currentCulture].abbreviations.thousand;\n", " value = value / Math.pow(10, 3);\n", " }\n", " }\n", " }\n", " // see if we are formatting binary bytes\n", " if (format.indexOf('b') > -1) {\n", " // check for space before\n", " if (format.indexOf(' b') > -1) {\n", " bytes = ' ';\n", " format = format.replace(' b', '');\n", " }\n", " else {\n", " format = format.replace('b', '');\n", " }\n", " for (power = 0; power <= binarySuffixes.length; power++) {\n", " min = Math.pow(1024, power);\n", " max = Math.pow(1024, power + 1);\n", " if (value >= min && value < max) {\n", " bytes = bytes + binarySuffixes[power];\n", " if (min > 0) {\n", " value = value / min;\n", " }\n", " break;\n", " }\n", " }\n", " }\n", " // see if we are formatting decimal bytes\n", " if (format.indexOf('d') > -1) {\n", " // check for space before\n", " if (format.indexOf(' d') > -1) {\n", " bytes = ' ';\n", " format = format.replace(' d', '');\n", " }\n", " else {\n", " format = format.replace('d', '');\n", " }\n", " for (power = 0; power <= decimalSuffixes.length; power++) {\n", " min = Math.pow(1000, power);\n", " max = Math.pow(1000, power + 1);\n", " if (value >= min && value < max) {\n", " bytes = bytes + decimalSuffixes[power];\n", " if (min > 0) {\n", " value = value / min;\n", " }\n", " break;\n", " }\n", " }\n", " }\n", " // see if ordinal is wanted\n", " if (format.indexOf('o') > -1) {\n", " // check for space before\n", " if (format.indexOf(' o') > -1) {\n", " ord = ' ';\n", " format = format.replace(' o', '');\n", " }\n", " else {\n", " format = format.replace('o', '');\n", " }\n", " if (cultures[currentCulture].ordinal) {\n", " ord = ord + cultures[currentCulture].ordinal(value);\n", " }\n", " }\n", " if (format.indexOf('[.]') > -1) {\n", " optDec = true;\n", " format = format.replace('[.]', '.');\n", " }\n", " w = value.toString().split('.')[0];\n", " precision = format.split('.')[1];\n", " thousands = format.indexOf(',');\n", " if (precision) {\n", " if (precision.indexOf('*') !== -1) {\n", " d = toFixed(value, value.toString().split('.')[1].length, roundingFunction);\n", " }\n", " else {\n", " if (precision.indexOf('[') > -1) {\n", " precision = precision.replace(']', '');\n", " precision = precision.split('[');\n", " d = toFixed(value, (precision[0].length + precision[1].length), roundingFunction, precision[1].length);\n", " }\n", " else {\n", " d = toFixed(value, precision.length, roundingFunction);\n", " }\n", " }\n", " w = d.split('.')[0];\n", " if (d.split('.')[1].length) {\n", " var p = sep ? abbr + sep : cultures[currentCulture].delimiters.decimal;\n", " d = p + d.split('.')[1];\n", " }\n", " else {\n", " d = '';\n", " }\n", " if (optDec && Number(d.slice(1)) === 0) {\n", " d = '';\n", " }\n", " }\n", " else {\n", " w = toFixed(value, null, roundingFunction);\n", " }\n", " // format number\n", " if (w.indexOf('-') > -1) {\n", " w = w.slice(1);\n", " neg = true;\n", " }\n", " if (w.length < minlen) {\n", " w = new Array(minlen - w.length + 1).join('0') + w;\n", " }\n", " if (thousands > -1) {\n", " w = w.toString().replace(/(\\d)(?=(\\d{3})+(?!\\d))/g, '$1' +\n", " cultures[currentCulture].delimiters.thousands);\n", " }\n", " if (format.indexOf('.') === 0) {\n", " w = '';\n", " }\n", " indexOpenP = format.indexOf('(');\n", " indexMinus = format.indexOf('-');\n", " if (indexOpenP < indexMinus) {\n", " paren = ((negP && neg) ? '(' : '') + (((forcedNeg && neg) || (!negP && neg)) ? '-' : '');\n", " }\n", " else {\n", " paren = (((forcedNeg && neg) || (!negP && neg)) ? '-' : '') + ((negP && neg) ? '(' : '');\n", " }\n", " return prefix +\n", " paren + ((!neg && signed && value !== 0) ? '+' : '') +\n", " w + d +\n", " ((ord) ? ord : '') +\n", " ((abbr && !sep) ? abbr : '') +\n", " ((bytes) ? bytes : '') +\n", " ((negP && neg) ? ')' : '') +\n", " postfix;\n", " }\n", " /************************************\n", " Top Level Functions\n", " ************************************/\n", " numbro = function (input) {\n", " if (numbro.isNumbro(input)) {\n", " input = input.value();\n", " }\n", " else if (input === 0 || typeof input === 'undefined') {\n", " input = 0;\n", " }\n", " else if (!Number(input)) {\n", " input = numbro.fn.unformat(input);\n", " }\n", " return new Numbro(Number(input));\n", " };\n", " // version number\n", " numbro.version = VERSION;\n", " // compare numbro object\n", " numbro.isNumbro = function (obj) {\n", " return obj instanceof Numbro;\n", " };\n", " /**\n", " * This function allow the user to set a new language with a fallback if\n", " * the language does not exist. If no fallback language is provided,\n", " * it fallbacks to english.\n", " *\n", " * @deprecated Since in version 1.6.0. It will be deleted in version 2.0\n", " * `setCulture` should be used instead.\n", " */\n", " numbro.setLanguage = function (newLanguage, fallbackLanguage) {\n", " console.warn('`setLanguage` is deprecated since version 1.6.0. Use `setCulture` instead');\n", " var key = newLanguage, prefix = newLanguage.split('-')[0], matchingLanguage = null;\n", " if (!languages[key]) {\n", " Object.keys(languages).forEach(function (language) {\n", " if (!matchingLanguage && language.split('-')[0] === prefix) {\n", " matchingLanguage = language;\n", " }\n", " });\n", " key = matchingLanguage || fallbackLanguage || 'en-US';\n", " }\n", " chooseCulture(key);\n", " };\n", " /**\n", " * This function allow the user to set a new culture with a fallback if\n", " * the culture does not exist. If no fallback culture is provided,\n", " * it fallbacks to \"en-US\".\n", " */\n", " numbro.setCulture = function (newCulture, fallbackCulture) {\n", " var key = newCulture, suffix = newCulture.split('-')[1], matchingCulture = null;\n", " if (!cultures[key]) {\n", " if (suffix) {\n", " Object.keys(cultures).forEach(function (language) {\n", " if (!matchingCulture && language.split('-')[1] === suffix) {\n", " matchingCulture = language;\n", " }\n", " });\n", " }\n", " key = matchingCulture || fallbackCulture || 'en-US';\n", " }\n", " chooseCulture(key);\n", " };\n", " /**\n", " * This function will load languages and then set the global language. If\n", " * no arguments are passed in, it will simply return the current global\n", " * language key.\n", " *\n", " * @deprecated Since in version 1.6.0. It will be deleted in version 2.0\n", " * `culture` should be used instead.\n", " */\n", " numbro.language = function (key, values) {\n", " console.warn('`language` is deprecated since version 1.6.0. Use `culture` instead');\n", " if (!key) {\n", " return currentCulture;\n", " }\n", " if (key && !values) {\n", " if (!languages[key]) {\n", " throw new Error('Unknown language : ' + key);\n", " }\n", " chooseCulture(key);\n", " }\n", " if (values || !languages[key]) {\n", " setCulture(key, values);\n", " }\n", " return numbro;\n", " };\n", " /**\n", " * This function will load cultures and then set the global culture. If\n", " * no arguments are passed in, it will simply return the current global\n", " * culture code.\n", " */\n", " numbro.culture = function (code, values) {\n", " if (!code) {\n", " return currentCulture;\n", " }\n", " if (code && !values) {\n", " if (!cultures[code]) {\n", " throw new Error('Unknown culture : ' + code);\n", " }\n", " chooseCulture(code);\n", " }\n", " if (values || !cultures[code]) {\n", " setCulture(code, values);\n", " }\n", " return numbro;\n", " };\n", " /**\n", " * This function provides access to the loaded language data. If\n", " * no arguments are passed in, it will simply return the current\n", " * global language object.\n", " *\n", " * @deprecated Since in version 1.6.0. It will be deleted in version 2.0\n", " * `culture` should be used instead.\n", " */\n", " numbro.languageData = function (key) {\n", " console.warn('`languageData` is deprecated since version 1.6.0. Use `cultureData` instead');\n", " if (!key) {\n", " return languages[currentCulture];\n", " }\n", " if (!languages[key]) {\n", " throw new Error('Unknown language : ' + key);\n", " }\n", " return languages[key];\n", " };\n", " /**\n", " * This function provides access to the loaded culture data. If\n", " * no arguments are passed in, it will simply return the current\n", " * global culture object.\n", " */\n", " numbro.cultureData = function (code) {\n", " if (!code) {\n", " return cultures[currentCulture];\n", " }\n", " if (!cultures[code]) {\n", " throw new Error('Unknown culture : ' + code);\n", " }\n", " return cultures[code];\n", " };\n", " numbro.culture('en-US', enUS);\n", " /**\n", " * @deprecated Since in version 1.6.0. It will be deleted in version 2.0\n", " * `cultures` should be used instead.\n", " */\n", " numbro.languages = function () {\n", " console.warn('`languages` is deprecated since version 1.6.0. Use `cultures` instead');\n", " return languages;\n", " };\n", " numbro.cultures = function () {\n", " return cultures;\n", " };\n", " numbro.zeroFormat = function (format) {\n", " zeroFormat = typeof (format) === 'string' ? format : null;\n", " };\n", " numbro.defaultFormat = function (format) {\n", " defaultFormat = typeof (format) === 'string' ? format : '0.0';\n", " };\n", " numbro.defaultCurrencyFormat = function (format) {\n", " defaultCurrencyFormat = typeof (format) === 'string' ? format : '0$';\n", " };\n", " numbro.validate = function (val, culture) {\n", " var _decimalSep, _thousandSep, _currSymbol, _valArray, _abbrObj, _thousandRegEx, cultureData, temp;\n", " //coerce val to string\n", " if (typeof val !== 'string') {\n", " val += '';\n", " if (console.warn) {\n", " console.warn('Numbro.js: Value is not string. It has been co-erced to: ', val);\n", " }\n", " }\n", " //trim whitespaces from either sides\n", " val = val.trim();\n", " //if val is just digits return true\n", " if (!!val.match(/^\\d+$/)) {\n", " return true;\n", " }\n", " //if val is empty return false\n", " if (val === '') {\n", " return false;\n", " }\n", " //get the decimal and thousands separator from numbro.cultureData\n", " try {\n", " //check if the culture is understood by numbro. if not, default it to current culture\n", " cultureData = numbro.cultureData(culture);\n", " }\n", " catch (e) {\n", " cultureData = numbro.cultureData(numbro.culture());\n", " }\n", " //setup the delimiters and currency symbol based on culture\n", " _currSymbol = cultureData.currency.symbol;\n", " _abbrObj = cultureData.abbreviations;\n", " _decimalSep = cultureData.delimiters.decimal;\n", " if (cultureData.delimiters.thousands === '.') {\n", " _thousandSep = '\\\\.';\n", " }\n", " else {\n", " _thousandSep = cultureData.delimiters.thousands;\n", " }\n", " // validating currency symbol\n", " temp = val.match(/^[^\\d]+/);\n", " if (temp !== null) {\n", " val = val.substr(1);\n", " if (temp[0] !== _currSymbol) {\n", " return false;\n", " }\n", " }\n", " //validating abbreviation symbol\n", " temp = val.match(/[^\\d]+$/);\n", " if (temp !== null) {\n", " val = val.slice(0, -1);\n", " if (temp[0] !== _abbrObj.thousand && temp[0] !== _abbrObj.million &&\n", " temp[0] !== _abbrObj.billion && temp[0] !== _abbrObj.trillion) {\n", " return false;\n", " }\n", " }\n", " _thousandRegEx = new RegExp(_thousandSep + '{2}');\n", " if (!val.match(/[^\\d.,]/g)) {\n", " _valArray = val.split(_decimalSep);\n", " if (_valArray.length > 2) {\n", " return false;\n", " }\n", " else {\n", " if (_valArray.length < 2) {\n", " return (!!_valArray[0].match(/^\\d+.*\\d$/) && !_valArray[0].match(_thousandRegEx));\n", " }\n", " else {\n", " if (_valArray[0].length === 1) {\n", " return (!!_valArray[0].match(/^\\d+$/) &&\n", " !_valArray[0].match(_thousandRegEx) &&\n", " !!_valArray[1].match(/^\\d+$/));\n", " }\n", " else {\n", " return (!!_valArray[0].match(/^\\d+.*\\d$/) &&\n", " !_valArray[0].match(_thousandRegEx) &&\n", " !!_valArray[1].match(/^\\d+$/));\n", " }\n", " }\n", " }\n", " }\n", " return false;\n", " };\n", " /************************************\n", " Helpers\n", " ************************************/\n", " function setCulture(code, values) {\n", " cultures[code] = values;\n", " }\n", " function chooseCulture(code) {\n", " currentCulture = code;\n", " var defaults = cultures[code].defaults;\n", " if (defaults && defaults.format) {\n", " numbro.defaultFormat(defaults.format);\n", " }\n", " if (defaults && defaults.currencyFormat) {\n", " numbro.defaultCurrencyFormat(defaults.currencyFormat);\n", " }\n", " }\n", " function format(input, formatString, language, roundingFunction) {\n", " if (language != null && language !== numbro.culture()) {\n", " numbro.setCulture(language);\n", " }\n", " return formatNumbro(Number(input), formatString != null ? formatString : defaultFormat, roundingFunction == null ? Math.round : roundingFunction);\n", " }\n", " module.exports = { \"format\": format };\n", " },\n", " /* sprintf-js/src/sprintf.js */ function _(require, module, exports) {\n", " /* global window, exports, define */\n", " !function () {\n", " 'use strict';\n", " var re = {\n", " not_string: /[^s]/,\n", " not_bool: /[^t]/,\n", " not_type: /[^T]/,\n", " not_primitive: /[^v]/,\n", " number: /[diefg]/,\n", " numeric_arg: /[bcdiefguxX]/,\n", " json: /[j]/,\n", " not_json: /[^j]/,\n", " text: /^[^\\x25]+/,\n", " modulo: /^\\x25{2}/,\n", " placeholder: /^\\x25(?:([1-9]\\d*)\\$|\\(([^)]+)\\))?(\\+)?(0|'[^$])?(-)?(\\d+)?(?:\\.(\\d+))?([b-gijostTuvxX])/,\n", " key: /^([a-z_][a-z_\\d]*)/i,\n", " key_access: /^\\.([a-z_][a-z_\\d]*)/i,\n", " index_access: /^\\[(\\d+)\\]/,\n", " sign: /^[+-]/\n", " };\n", " function sprintf(key) {\n", " // `arguments` is not an array, but should be fine for this call\n", " return sprintf_format(sprintf_parse(key), arguments);\n", " }\n", " function vsprintf(fmt, argv) {\n", " return sprintf.apply(null, [fmt].concat(argv || []));\n", " }\n", " function sprintf_format(parse_tree, argv) {\n", " var cursor = 1, tree_length = parse_tree.length, arg, output = '', i, k, ph, pad, pad_character, pad_length, is_positive, sign;\n", " for (i = 0; i < tree_length; i++) {\n", " if (typeof parse_tree[i] === 'string') {\n", " output += parse_tree[i];\n", " }\n", " else if (typeof parse_tree[i] === 'object') {\n", " ph = parse_tree[i]; // convenience purposes only\n", " if (ph.keys) { // keyword argument\n", " arg = argv[cursor];\n", " for (k = 0; k < ph.keys.length; k++) {\n", " if (arg == undefined) {\n", " throw new Error(sprintf('[sprintf] Cannot access property \"%s\" of undefined value \"%s\"', ph.keys[k], ph.keys[k - 1]));\n", " }\n", " arg = arg[ph.keys[k]];\n", " }\n", " }\n", " else if (ph.param_no) { // positional argument (explicit)\n", " arg = argv[ph.param_no];\n", " }\n", " else { // positional argument (implicit)\n", " arg = argv[cursor++];\n", " }\n", " if (re.not_type.test(ph.type) && re.not_primitive.test(ph.type) && arg instanceof Function) {\n", " arg = arg();\n", " }\n", " if (re.numeric_arg.test(ph.type) && (typeof arg !== 'number' && isNaN(arg))) {\n", " throw new TypeError(sprintf('[sprintf] expecting number but found %T', arg));\n", " }\n", " if (re.number.test(ph.type)) {\n", " is_positive = arg >= 0;\n", " }\n", " switch (ph.type) {\n", " case 'b':\n", " arg = parseInt(arg, 10).toString(2);\n", " break;\n", " case 'c':\n", " arg = String.fromCharCode(parseInt(arg, 10));\n", " break;\n", " case 'd':\n", " case 'i':\n", " arg = parseInt(arg, 10);\n", " break;\n", " case 'j':\n", " arg = JSON.stringify(arg, null, ph.width ? parseInt(ph.width) : 0);\n", " break;\n", " case 'e':\n", " arg = ph.precision ? parseFloat(arg).toExponential(ph.precision) : parseFloat(arg).toExponential();\n", " break;\n", " case 'f':\n", " arg = ph.precision ? parseFloat(arg).toFixed(ph.precision) : parseFloat(arg);\n", " break;\n", " case 'g':\n", " arg = ph.precision ? String(Number(arg.toPrecision(ph.precision))) : parseFloat(arg);\n", " break;\n", " case 'o':\n", " arg = (parseInt(arg, 10) >>> 0).toString(8);\n", " break;\n", " case 's':\n", " arg = String(arg);\n", " arg = (ph.precision ? arg.substring(0, ph.precision) : arg);\n", " break;\n", " case 't':\n", " arg = String(!!arg);\n", " arg = (ph.precision ? arg.substring(0, ph.precision) : arg);\n", " break;\n", " case 'T':\n", " arg = Object.prototype.toString.call(arg).slice(8, -1).toLowerCase();\n", " arg = (ph.precision ? arg.substring(0, ph.precision) : arg);\n", " break;\n", " case 'u':\n", " arg = parseInt(arg, 10) >>> 0;\n", " break;\n", " case 'v':\n", " arg = arg.valueOf();\n", " arg = (ph.precision ? arg.substring(0, ph.precision) : arg);\n", " break;\n", " case 'x':\n", " arg = (parseInt(arg, 10) >>> 0).toString(16);\n", " break;\n", " case 'X':\n", " arg = (parseInt(arg, 10) >>> 0).toString(16).toUpperCase();\n", " break;\n", " }\n", " if (re.json.test(ph.type)) {\n", " output += arg;\n", " }\n", " else {\n", " if (re.number.test(ph.type) && (!is_positive || ph.sign)) {\n", " sign = is_positive ? '+' : '-';\n", " arg = arg.toString().replace(re.sign, '');\n", " }\n", " else {\n", " sign = '';\n", " }\n", " pad_character = ph.pad_char ? ph.pad_char === '0' ? '0' : ph.pad_char.charAt(1) : ' ';\n", " pad_length = ph.width - (sign + arg).length;\n", " pad = ph.width ? (pad_length > 0 ? pad_character.repeat(pad_length) : '') : '';\n", " output += ph.align ? sign + arg + pad : (pad_character === '0' ? sign + pad + arg : pad + sign + arg);\n", " }\n", " }\n", " }\n", " return output;\n", " }\n", " var sprintf_cache = Object.create(null);\n", " function sprintf_parse(fmt) {\n", " if (sprintf_cache[fmt]) {\n", " return sprintf_cache[fmt];\n", " }\n", " var _fmt = fmt, match, parse_tree = [], arg_names = 0;\n", " while (_fmt) {\n", " if ((match = re.text.exec(_fmt)) !== null) {\n", " parse_tree.push(match[0]);\n", " }\n", " else if ((match = re.modulo.exec(_fmt)) !== null) {\n", " parse_tree.push('%');\n", " }\n", " else if ((match = re.placeholder.exec(_fmt)) !== null) {\n", " if (match[2]) {\n", " arg_names |= 1;\n", " var field_list = [], replacement_field = match[2], field_match = [];\n", " if ((field_match = re.key.exec(replacement_field)) !== null) {\n", " field_list.push(field_match[1]);\n", " while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') {\n", " if ((field_match = re.key_access.exec(replacement_field)) !== null) {\n", " field_list.push(field_match[1]);\n", " }\n", " else if ((field_match = re.index_access.exec(replacement_field)) !== null) {\n", " field_list.push(field_match[1]);\n", " }\n", " else {\n", " throw new SyntaxError('[sprintf] failed to parse named argument key');\n", " }\n", " }\n", " }\n", " else {\n", " throw new SyntaxError('[sprintf] failed to parse named argument key');\n", " }\n", " match[2] = field_list;\n", " }\n", " else {\n", " arg_names |= 2;\n", " }\n", " if (arg_names === 3) {\n", " throw new Error('[sprintf] mixing positional and named placeholders is not (yet) supported');\n", " }\n", " parse_tree.push({\n", " placeholder: match[0],\n", " param_no: match[1],\n", " keys: match[2],\n", " sign: match[3],\n", " pad_char: match[4],\n", " align: match[5],\n", " width: match[6],\n", " precision: match[7],\n", " type: match[8]\n", " });\n", " }\n", " else {\n", " throw new SyntaxError('[sprintf] unexpected placeholder');\n", " }\n", " _fmt = _fmt.substring(match[0].length);\n", " }\n", " return sprintf_cache[fmt] = parse_tree;\n", " }\n", " /**\n", " * export to either browser or node.js\n", " */\n", " /* eslint-disable quote-props */\n", " if (typeof exports !== 'undefined') {\n", " exports['sprintf'] = sprintf;\n", " exports['vsprintf'] = vsprintf;\n", " }\n", " if (typeof window !== 'undefined') {\n", " window['sprintf'] = sprintf;\n", " window['vsprintf'] = vsprintf;\n", " if (typeof define === 'function' && define['amd']) {\n", " define(function () {\n", " return {\n", " 'sprintf': sprintf,\n", " 'vsprintf': vsprintf\n", " };\n", " });\n", " }\n", " }\n", " /* eslint-enable quote-props */\n", " }(); // eslint-disable-line\n", " },\n", " /* models/tickers/datetime_ticker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const adaptive_ticker_1 = require(110) /* ./adaptive_ticker */;\n", " const composite_ticker_1 = require(164) /* ./composite_ticker */;\n", " const days_ticker_1 = require(165) /* ./days_ticker */;\n", " const months_ticker_1 = require(168) /* ./months_ticker */;\n", " const years_ticker_1 = require(169) /* ./years_ticker */;\n", " const util_1 = require(167) /* ./util */;\n", " class DatetimeTicker extends composite_ticker_1.CompositeTicker {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_DatetimeTicker() {\n", " this.override({\n", " num_minor_ticks: 0,\n", " tickers: () => [\n", " // Sub-second.\n", " new adaptive_ticker_1.AdaptiveTicker({\n", " mantissas: [1, 2, 5],\n", " base: 10,\n", " min_interval: 0,\n", " max_interval: 500 * util_1.ONE_MILLI,\n", " num_minor_ticks: 0,\n", " }),\n", " // Seconds, minutes.\n", " new adaptive_ticker_1.AdaptiveTicker({\n", " mantissas: [1, 2, 5, 10, 15, 20, 30],\n", " base: 60,\n", " min_interval: util_1.ONE_SECOND,\n", " max_interval: 30 * util_1.ONE_MINUTE,\n", " num_minor_ticks: 0,\n", " }),\n", " // Hours.\n", " new adaptive_ticker_1.AdaptiveTicker({\n", " mantissas: [1, 2, 4, 6, 8, 12],\n", " base: 24.0,\n", " min_interval: util_1.ONE_HOUR,\n", " max_interval: 12 * util_1.ONE_HOUR,\n", " num_minor_ticks: 0,\n", " }),\n", " // Days.\n", " new days_ticker_1.DaysTicker({ days: array_1.range(1, 32) }),\n", " new days_ticker_1.DaysTicker({ days: array_1.range(1, 31, 3) }),\n", " new days_ticker_1.DaysTicker({ days: [1, 8, 15, 22] }),\n", " new days_ticker_1.DaysTicker({ days: [1, 15] }),\n", " // Months.\n", " new months_ticker_1.MonthsTicker({ months: array_1.range(0, 12, 1) }),\n", " new months_ticker_1.MonthsTicker({ months: array_1.range(0, 12, 2) }),\n", " new months_ticker_1.MonthsTicker({ months: array_1.range(0, 12, 4) }),\n", " new months_ticker_1.MonthsTicker({ months: array_1.range(0, 12, 6) }),\n", " // Years\n", " new years_ticker_1.YearsTicker({}),\n", " ],\n", " });\n", " }\n", " }\n", " exports.DatetimeTicker = DatetimeTicker;\n", " DatetimeTicker.__name__ = \"DatetimeTicker\";\n", " DatetimeTicker.init_DatetimeTicker();\n", " },\n", " /* models/tickers/composite_ticker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const continuous_ticker_1 = require(111) /* ./continuous_ticker */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " class CompositeTicker extends continuous_ticker_1.ContinuousTicker {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_CompositeTicker() {\n", " this.define({\n", " tickers: [p.Array, []],\n", " });\n", " }\n", " // The tickers should be in order of increasing interval size; specifically,\n", " // if S comes before T, then it should be the case that\n", " // S.get_max_interval() < T.get_min_interval().\n", " // FIXME Enforce this automatically.\n", " get min_intervals() {\n", " return this.tickers.map((ticker) => ticker.get_min_interval());\n", " }\n", " get max_intervals() {\n", " return this.tickers.map((ticker) => ticker.get_max_interval());\n", " }\n", " get min_interval() {\n", " return this.min_intervals[0];\n", " }\n", " get max_interval() {\n", " return this.max_intervals[0];\n", " }\n", " get_best_ticker(data_low, data_high, desired_n_ticks) {\n", " const data_range = data_high - data_low;\n", " const ideal_interval = this.get_ideal_interval(data_low, data_high, desired_n_ticks);\n", " const ticker_ndxs = [\n", " array_1.sorted_index(this.min_intervals, ideal_interval) - 1,\n", " array_1.sorted_index(this.max_intervals, ideal_interval),\n", " ];\n", " const intervals = [\n", " this.min_intervals[ticker_ndxs[0]],\n", " this.max_intervals[ticker_ndxs[1]],\n", " ];\n", " const errors = intervals.map((interval) => {\n", " return Math.abs(desired_n_ticks - (data_range / interval));\n", " });\n", " let best_ticker;\n", " if (array_1.is_empty(errors.filter((e) => !isNaN(e)))) {\n", " // this can happen if the data isn't loaded yet, we just default to the first scale\n", " best_ticker = this.tickers[0];\n", " }\n", " else {\n", " const best_index = array_1.argmin(errors);\n", " const best_ticker_ndx = ticker_ndxs[best_index];\n", " best_ticker = this.tickers[best_ticker_ndx];\n", " }\n", " return best_ticker;\n", " }\n", " get_interval(data_low, data_high, desired_n_ticks) {\n", " const best_ticker = this.get_best_ticker(data_low, data_high, desired_n_ticks);\n", " return best_ticker.get_interval(data_low, data_high, desired_n_ticks);\n", " }\n", " get_ticks_no_defaults(data_low, data_high, cross_loc, desired_n_ticks) {\n", " const best_ticker = this.get_best_ticker(data_low, data_high, desired_n_ticks);\n", " return best_ticker.get_ticks_no_defaults(data_low, data_high, cross_loc, desired_n_ticks);\n", " }\n", " }\n", " exports.CompositeTicker = CompositeTicker;\n", " CompositeTicker.__name__ = \"CompositeTicker\";\n", " CompositeTicker.init_CompositeTicker();\n", " },\n", " /* models/tickers/days_ticker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const single_interval_ticker_1 = require(166) /* ./single_interval_ticker */;\n", " const util_1 = require(167) /* ./util */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " // Given a start and end time in millis, returns the shortest array of\n", " // consecutive months (as Dates) that surrounds both times.\n", " function date_range_by_month(start_time, end_time) {\n", " const start_date = util_1.last_month_no_later_than(new Date(start_time));\n", " const end_date = util_1.last_month_no_later_than(new Date(end_time));\n", " // XXX This is not a reliable technique in general, but it should be\n", " // safe when the day of the month is 1. (The problem case is this:\n", " // Mar 31 -> Apr 31, which becomes May 1.)\n", " end_date.setUTCMonth(end_date.getUTCMonth() + 1);\n", " const dates = [];\n", " const date = start_date;\n", " while (true) {\n", " dates.push(util_1.copy_date(date));\n", " date.setUTCMonth(date.getUTCMonth() + 1);\n", " if (date > end_date)\n", " break;\n", " }\n", " return dates;\n", " }\n", " class DaysTicker extends single_interval_ticker_1.SingleIntervalTicker {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_DaysTicker() {\n", " this.define({\n", " days: [p.Array, []],\n", " });\n", " this.override({\n", " num_minor_ticks: 0,\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " const days = this.days;\n", " if (days.length > 1)\n", " this.interval = (days[1] - days[0]) * util_1.ONE_DAY;\n", " else\n", " this.interval = 31 * util_1.ONE_DAY;\n", " }\n", " get_ticks_no_defaults(data_low, data_high, _cross_loc, _desired_n_ticks) {\n", " const month_dates = date_range_by_month(data_low, data_high);\n", " const days = this.days;\n", " const days_of_month = (month_date, interval) => {\n", " const current_month = month_date.getUTCMonth();\n", " const dates = [];\n", " for (const day of days) {\n", " const day_date = util_1.copy_date(month_date);\n", " day_date.setUTCDate(day);\n", " // We can't use all of the values in this.days, because they may not\n", " // fall within the current month. In fact, if, e.g., our month is 28 days\n", " // and we're marking every third day, we don't want day 28 to show up\n", " // because it'll be right next to the 1st of the next month. So we\n", " // make sure we have a bit of room before we include a day.\n", " // TODO (bev) The above description does not exactly work because JS Date\n", " // is broken and will happily consider \"Feb 28 + 3*ONE_DAY\" to have month \"2\"\n", " const future_date = new Date(day_date.getTime() + (interval / 2));\n", " if (future_date.getUTCMonth() == current_month)\n", " dates.push(day_date);\n", " }\n", " return dates;\n", " };\n", " const interval = this.interval;\n", " const day_dates = array_1.concat(month_dates.map((date) => days_of_month(date, interval)));\n", " const all_ticks = day_dates.map((day_date) => day_date.getTime());\n", " const ticks_in_range = all_ticks.filter((tick) => data_low <= tick && tick <= data_high);\n", " return {\n", " major: ticks_in_range,\n", " minor: [],\n", " };\n", " }\n", " }\n", " exports.DaysTicker = DaysTicker;\n", " DaysTicker.__name__ = \"DaysTicker\";\n", " DaysTicker.init_DaysTicker();\n", " },\n", " /* models/tickers/single_interval_ticker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const continuous_ticker_1 = require(111) /* ./continuous_ticker */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class SingleIntervalTicker extends continuous_ticker_1.ContinuousTicker {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_SingleIntervalTicker() {\n", " this.define({\n", " interval: [p.Number],\n", " });\n", " }\n", " get_interval(_data_low, _data_high, _n_desired_ticks) {\n", " return this.interval;\n", " }\n", " get min_interval() {\n", " return this.interval;\n", " }\n", " get max_interval() {\n", " return this.interval;\n", " }\n", " }\n", " exports.SingleIntervalTicker = SingleIntervalTicker;\n", " SingleIntervalTicker.__name__ = \"SingleIntervalTicker\";\n", " SingleIntervalTicker.init_SingleIntervalTicker();\n", " },\n", " /* models/tickers/util.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " // TODO Clear out debugging code, etc.\n", " // TODO Organize helper functions.\n", " // TODO The years ticker doesn't always use the roundest numbers; it should\n", " // probably use a special ticker.\n", " // TODO Add tests.\n", " // TODO There used to be a TODO: restore memoization. So.... do that?\n", " // TODO Instead of a get_ticks() method, there used to be an auto_ticks()\n", " // function that took a lot of fancy arguments, but those arguments weren't\n", " // used anywhere. Should we restore them?\n", " // Some time constants, in milliseconds.\n", " exports.ONE_MILLI = 1.0;\n", " exports.ONE_SECOND = 1000.0;\n", " exports.ONE_MINUTE = 60.0 * exports.ONE_SECOND;\n", " exports.ONE_HOUR = 60 * exports.ONE_MINUTE;\n", " exports.ONE_DAY = 24 * exports.ONE_HOUR;\n", " exports.ONE_MONTH = 30 * exports.ONE_DAY; // An approximation, obviously.\n", " exports.ONE_YEAR = 365 * exports.ONE_DAY;\n", " // ---------------------------------------------------------------------------\n", " // Date/time utility functions\n", " // ---------------------------------------------------------------------------\n", " // Makes a copy of a date object.\n", " function copy_date(date) {\n", " return new Date(date.getTime());\n", " }\n", " exports.copy_date = copy_date;\n", " // Rounds a date down to the month.\n", " function last_month_no_later_than(date) {\n", " const new_date = copy_date(date);\n", " new_date.setUTCDate(1);\n", " new_date.setUTCHours(0);\n", " new_date.setUTCMinutes(0);\n", " new_date.setUTCSeconds(0);\n", " new_date.setUTCMilliseconds(0);\n", " return new_date;\n", " }\n", " exports.last_month_no_later_than = last_month_no_later_than;\n", " // Rounds a date down to the year.\n", " function last_year_no_later_than(date) {\n", " const new_date = last_month_no_later_than(date);\n", " new_date.setUTCMonth(0);\n", " return new_date;\n", " }\n", " exports.last_year_no_later_than = last_year_no_later_than;\n", " },\n", " /* models/tickers/months_ticker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const single_interval_ticker_1 = require(166) /* ./single_interval_ticker */;\n", " const util_1 = require(167) /* ./util */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " // Given a start and end time in millis, returns the shortest array of\n", " // consecutive years (as Dates) that surrounds both times.\n", " function date_range_by_year(start_time, end_time) {\n", " const start_date = util_1.last_year_no_later_than(new Date(start_time));\n", " const end_date = util_1.last_year_no_later_than(new Date(end_time));\n", " end_date.setUTCFullYear(end_date.getUTCFullYear() + 1);\n", " const dates = [];\n", " const date = start_date;\n", " while (true) {\n", " dates.push(util_1.copy_date(date));\n", " date.setUTCFullYear(date.getUTCFullYear() + 1);\n", " if (date > end_date)\n", " break;\n", " }\n", " return dates;\n", " }\n", " class MonthsTicker extends single_interval_ticker_1.SingleIntervalTicker {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_MonthsTicker() {\n", " this.define({\n", " months: [p.Array, []],\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " const months = this.months;\n", " if (months.length > 1)\n", " this.interval = (months[1] - months[0]) * util_1.ONE_MONTH;\n", " else\n", " this.interval = 12 * util_1.ONE_MONTH;\n", " }\n", " get_ticks_no_defaults(data_low, data_high, _cross_loc, _desired_n_ticks) {\n", " const year_dates = date_range_by_year(data_low, data_high);\n", " const months = this.months;\n", " const months_of_year = (year_date) => {\n", " return months.map((month) => {\n", " const month_date = util_1.copy_date(year_date);\n", " month_date.setUTCMonth(month);\n", " return month_date;\n", " });\n", " };\n", " const month_dates = array_1.concat(year_dates.map(months_of_year));\n", " const all_ticks = month_dates.map((month_date) => month_date.getTime());\n", " const ticks_in_range = all_ticks.filter((tick) => data_low <= tick && tick <= data_high);\n", " return {\n", " major: ticks_in_range,\n", " minor: [],\n", " };\n", " }\n", " }\n", " exports.MonthsTicker = MonthsTicker;\n", " MonthsTicker.__name__ = \"MonthsTicker\";\n", " MonthsTicker.init_MonthsTicker();\n", " },\n", " /* models/tickers/years_ticker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const basic_ticker_1 = require(109) /* ./basic_ticker */;\n", " const single_interval_ticker_1 = require(166) /* ./single_interval_ticker */;\n", " const util_1 = require(167) /* ./util */;\n", " class YearsTicker extends single_interval_ticker_1.SingleIntervalTicker {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.interval = util_1.ONE_YEAR;\n", " this.basic_ticker = new basic_ticker_1.BasicTicker({ num_minor_ticks: 0 });\n", " }\n", " get_ticks_no_defaults(data_low, data_high, cross_loc, desired_n_ticks) {\n", " const start_year = util_1.last_year_no_later_than(new Date(data_low)).getUTCFullYear();\n", " const end_year = util_1.last_year_no_later_than(new Date(data_high)).getUTCFullYear();\n", " const years = this.basic_ticker.get_ticks_no_defaults(start_year, end_year, cross_loc, desired_n_ticks).major;\n", " const all_ticks = years.map((year) => Date.UTC(year, 0, 1));\n", " const ticks_in_range = all_ticks.filter((tick) => data_low <= tick && tick <= data_high);\n", " return {\n", " major: ticks_in_range,\n", " minor: [],\n", " };\n", " }\n", " }\n", " exports.YearsTicker = YearsTicker;\n", " YearsTicker.__name__ = \"YearsTicker\";\n", " },\n", " /* models/axes/log_axis.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const axis_1 = require(150) /* ./axis */;\n", " const continuous_axis_1 = require(155) /* ./continuous_axis */;\n", " const log_tick_formatter_1 = require(171) /* ../formatters/log_tick_formatter */;\n", " const log_ticker_1 = require(172) /* ../tickers/log_ticker */;\n", " class LogAxisView extends axis_1.AxisView {\n", " }\n", " exports.LogAxisView = LogAxisView;\n", " LogAxisView.__name__ = \"LogAxisView\";\n", " class LogAxis extends continuous_axis_1.ContinuousAxis {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_LogAxis() {\n", " this.prototype.default_view = LogAxisView;\n", " this.override({\n", " ticker: () => new log_ticker_1.LogTicker(),\n", " formatter: () => new log_tick_formatter_1.LogTickFormatter(),\n", " });\n", " }\n", " }\n", " exports.LogAxis = LogAxis;\n", " LogAxis.__name__ = \"LogAxis\";\n", " LogAxis.init_LogAxis();\n", " },\n", " /* models/formatters/log_tick_formatter.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const tick_formatter_1 = require(114) /* ./tick_formatter */;\n", " const basic_tick_formatter_1 = require(113) /* ./basic_tick_formatter */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class LogTickFormatter extends tick_formatter_1.TickFormatter {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_LogTickFormatter() {\n", " this.define({\n", " ticker: [p.Instance, null],\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.basic_formatter = new basic_tick_formatter_1.BasicTickFormatter();\n", " }\n", " doFormat(ticks, opts) {\n", " if (ticks.length == 0)\n", " return [];\n", " const base = this.ticker != null ? this.ticker.base : 10;\n", " let small_interval = false;\n", " const labels = new Array(ticks.length);\n", " for (let i = 0, end = ticks.length; i < end; i++) {\n", " labels[i] = `${base}^${Math.round(Math.log(ticks[i]) / Math.log(base))}`;\n", " if (i > 0 && labels[i] == labels[i - 1]) {\n", " small_interval = true;\n", " break;\n", " }\n", " }\n", " if (small_interval)\n", " return this.basic_formatter.doFormat(ticks, opts);\n", " else\n", " return labels;\n", " }\n", " }\n", " exports.LogTickFormatter = LogTickFormatter;\n", " LogTickFormatter.__name__ = \"LogTickFormatter\";\n", " LogTickFormatter.init_LogTickFormatter();\n", " },\n", " /* models/tickers/log_ticker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const adaptive_ticker_1 = require(110) /* ./adaptive_ticker */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " class LogTicker extends adaptive_ticker_1.AdaptiveTicker {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_LogTicker() {\n", " this.override({\n", " mantissas: [1, 5],\n", " });\n", " }\n", " get_ticks_no_defaults(data_low, data_high, _cross_loc, desired_n_ticks) {\n", " const num_minor_ticks = this.num_minor_ticks;\n", " const minor_ticks = [];\n", " const base = this.base;\n", " const log_low = Math.log(data_low) / Math.log(base);\n", " const log_high = Math.log(data_high) / Math.log(base);\n", " const log_interval = log_high - log_low;\n", " let ticks;\n", " if (!isFinite(log_interval)) {\n", " ticks = [];\n", " }\n", " else if (log_interval < 2) { // treat as linear ticker\n", " const interval = this.get_interval(data_low, data_high, desired_n_ticks);\n", " const start_factor = Math.floor(data_low / interval);\n", " const end_factor = Math.ceil(data_high / interval);\n", " ticks = array_1.range(start_factor, end_factor + 1)\n", " .filter((factor) => factor != 0)\n", " .map((factor) => factor * interval)\n", " .filter((tick) => data_low <= tick && tick <= data_high);\n", " if (num_minor_ticks > 0 && ticks.length > 0) {\n", " const minor_interval = interval / num_minor_ticks;\n", " const minor_offsets = array_1.range(0, num_minor_ticks).map((i) => i * minor_interval);\n", " for (const x of minor_offsets.slice(1)) {\n", " minor_ticks.push(ticks[0] - x);\n", " }\n", " for (const tick of ticks) {\n", " for (const x of minor_offsets) {\n", " minor_ticks.push(tick + x);\n", " }\n", " }\n", " }\n", " }\n", " else {\n", " const startlog = Math.ceil(log_low * 0.999999);\n", " const endlog = Math.floor(log_high * 1.000001);\n", " const interval = Math.ceil((endlog - startlog) / 9.0);\n", " ticks = array_1.range(startlog - 1, endlog + 1, interval)\n", " .map((i) => base ** i);\n", " if (num_minor_ticks > 0 && ticks.length > 0) {\n", " const minor_interval = base ** interval / num_minor_ticks;\n", " const minor_offsets = array_1.range(1, num_minor_ticks + 1).map((i) => i * minor_interval);\n", " for (const x of minor_offsets) {\n", " minor_ticks.push(ticks[0] / x);\n", " }\n", " minor_ticks.push(ticks[0]);\n", " for (const tick of ticks) {\n", " for (const x of minor_offsets) {\n", " minor_ticks.push(tick * x);\n", " }\n", " }\n", " }\n", " }\n", " return {\n", " major: ticks.filter((tick) => data_low <= tick && tick <= data_high),\n", " minor: minor_ticks.filter((tick) => data_low <= tick && tick <= data_high),\n", " };\n", " }\n", " }\n", " exports.LogTicker = LogTicker;\n", " LogTicker.__name__ = \"LogTicker\";\n", " LogTicker.init_LogTicker();\n", " },\n", " /* models/axes/mercator_axis.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const axis_1 = require(150) /* ./axis */;\n", " const linear_axis_1 = require(157) /* ./linear_axis */;\n", " const mercator_tick_formatter_1 = require(174) /* ../formatters/mercator_tick_formatter */;\n", " const mercator_ticker_1 = require(175) /* ../tickers/mercator_ticker */;\n", " class MercatorAxisView extends axis_1.AxisView {\n", " }\n", " exports.MercatorAxisView = MercatorAxisView;\n", " MercatorAxisView.__name__ = \"MercatorAxisView\";\n", " class MercatorAxis extends linear_axis_1.LinearAxis {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_MercatorAxis() {\n", " this.prototype.default_view = MercatorAxisView;\n", " this.override({\n", " ticker: () => new mercator_ticker_1.MercatorTicker({ dimension: \"lat\" }),\n", " formatter: () => new mercator_tick_formatter_1.MercatorTickFormatter({ dimension: \"lat\" }),\n", " });\n", " }\n", " }\n", " exports.MercatorAxis = MercatorAxis;\n", " MercatorAxis.__name__ = \"MercatorAxis\";\n", " MercatorAxis.init_MercatorAxis();\n", " },\n", " /* models/formatters/mercator_tick_formatter.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const basic_tick_formatter_1 = require(113) /* ./basic_tick_formatter */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const projections_1 = require(32) /* ../../core/util/projections */;\n", " class MercatorTickFormatter extends basic_tick_formatter_1.BasicTickFormatter {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_MercatorTickFormatter() {\n", " this.define({\n", " dimension: [p.LatLon],\n", " });\n", " }\n", " doFormat(ticks, opts) {\n", " if (this.dimension == null)\n", " throw new Error(\"MercatorTickFormatter.dimension not configured\");\n", " if (ticks.length == 0)\n", " return [];\n", " const n = ticks.length;\n", " const proj_ticks = new Array(n);\n", " if (this.dimension == \"lon\") {\n", " for (let i = 0; i < n; i++) {\n", " const [lon] = projections_1.wgs84_mercator.inverse([ticks[i], opts.loc]);\n", " proj_ticks[i] = lon;\n", " }\n", " }\n", " else {\n", " for (let i = 0; i < n; i++) {\n", " const [, lat] = projections_1.wgs84_mercator.inverse([opts.loc, ticks[i]]);\n", " proj_ticks[i] = lat;\n", " }\n", " }\n", " return super.doFormat(proj_ticks, opts);\n", " }\n", " }\n", " exports.MercatorTickFormatter = MercatorTickFormatter;\n", " MercatorTickFormatter.__name__ = \"MercatorTickFormatter\";\n", " MercatorTickFormatter.init_MercatorTickFormatter();\n", " },\n", " /* models/tickers/mercator_ticker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const basic_ticker_1 = require(109) /* ./basic_ticker */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const projections_1 = require(32) /* ../../core/util/projections */;\n", " class MercatorTicker extends basic_ticker_1.BasicTicker {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_MercatorTicker() {\n", " this.define({\n", " dimension: [p.LatLon],\n", " });\n", " }\n", " get_ticks_no_defaults(data_low, data_high, cross_loc, desired_n_ticks) {\n", " if (this.dimension == null) {\n", " throw new Error(\"MercatorTicker.dimension not configured\");\n", " }\n", " [data_low, data_high] = projections_1.clip_mercator(data_low, data_high, this.dimension);\n", " let proj_low, proj_high, proj_cross_loc;\n", " if (this.dimension === \"lon\") {\n", " [proj_low, proj_cross_loc] = projections_1.wgs84_mercator.inverse([data_low, cross_loc]); // lgtm [js/useless-assignment-to-local]\n", " [proj_high, proj_cross_loc] = projections_1.wgs84_mercator.inverse([data_high, cross_loc]);\n", " }\n", " else {\n", " [proj_cross_loc, proj_low] = projections_1.wgs84_mercator.inverse([cross_loc, data_low]); // lgtm [js/useless-assignment-to-local]\n", " [proj_cross_loc, proj_high] = projections_1.wgs84_mercator.inverse([cross_loc, data_high]);\n", " }\n", " const proj_ticks = super.get_ticks_no_defaults(proj_low, proj_high, cross_loc, desired_n_ticks);\n", " const major = [];\n", " const minor = [];\n", " if (this.dimension === \"lon\") {\n", " for (const tick of proj_ticks.major) {\n", " if (projections_1.in_bounds(tick, 'lon')) {\n", " const [lon] = projections_1.wgs84_mercator.forward([tick, proj_cross_loc]);\n", " major.push(lon);\n", " }\n", " }\n", " for (const tick of proj_ticks.minor) {\n", " if (projections_1.in_bounds(tick, 'lon')) {\n", " const [lon] = projections_1.wgs84_mercator.forward([tick, proj_cross_loc]);\n", " minor.push(lon);\n", " }\n", " }\n", " }\n", " else {\n", " for (const tick of proj_ticks.major) {\n", " if (projections_1.in_bounds(tick, 'lat')) {\n", " const [, lat] = projections_1.wgs84_mercator.forward([proj_cross_loc, tick]);\n", " major.push(lat);\n", " }\n", " }\n", " for (const tick of proj_ticks.minor) {\n", " if (projections_1.in_bounds(tick, 'lat')) {\n", " const [, lat] = projections_1.wgs84_mercator.forward([proj_cross_loc, tick]);\n", " minor.push(lat);\n", " }\n", " }\n", " }\n", " return { major, minor };\n", " }\n", " }\n", " exports.MercatorTicker = MercatorTicker;\n", " MercatorTicker.__name__ = \"MercatorTicker\";\n", " MercatorTicker.init_MercatorTicker();\n", " },\n", " /* models/callbacks/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var customjs_1 = require(177) /* ./customjs */;\n", " exports.CustomJS = customjs_1.CustomJS;\n", " var open_url_1 = require(179) /* ./open_url */;\n", " exports.OpenURL = open_url_1.OpenURL;\n", " },\n", " /* models/callbacks/customjs.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const callback_1 = require(178) /* ./callback */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const object_1 = require(17) /* ../../core/util/object */;\n", " const string_1 = require(24) /* ../../core/util/string */;\n", " class CustomJS extends callback_1.Callback {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_CustomJS() {\n", " this.define({\n", " args: [p.Any, {}],\n", " code: [p.String, ''],\n", " });\n", " }\n", " get names() {\n", " return object_1.keys(this.args);\n", " }\n", " get values() {\n", " return object_1.values(this.args);\n", " }\n", " get func() {\n", " const code = string_1.use_strict(this.code);\n", " return new Function(...this.names, \"cb_obj\", \"cb_data\", code);\n", " }\n", " execute(cb_obj, cb_data = {}) {\n", " return this.func.apply(cb_obj, this.values.concat(cb_obj, cb_data));\n", " }\n", " }\n", " exports.CustomJS = CustomJS;\n", " CustomJS.__name__ = \"CustomJS\";\n", " CustomJS.init_CustomJS();\n", " },\n", " /* models/callbacks/callback.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const model_1 = require(71) /* ../../model */;\n", " class Callback extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " }\n", " exports.Callback = Callback;\n", " Callback.__name__ = \"Callback\";\n", " },\n", " /* models/callbacks/open_url.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const callback_1 = require(178) /* ./callback */;\n", " const templating_1 = require(160) /* ../../core/util/templating */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class OpenURL extends callback_1.Callback {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_OpenURL() {\n", " this.define({\n", " url: [p.String, 'http://'],\n", " same_tab: [p.Boolean, false],\n", " });\n", " }\n", " execute(_cb_obj, { source }) {\n", " const open_url = (i) => {\n", " const url = templating_1.replace_placeholders(this.url, source, i);\n", " if (this.same_tab)\n", " window.location.href = url;\n", " else\n", " window.open(url);\n", " };\n", " const { selected } = source;\n", " for (const i of selected.indices)\n", " open_url(i);\n", " for (const i of selected.line_indices)\n", " open_url(i);\n", " // TODO: multiline_indices: {[key: string]: number[]}\n", " }\n", " }\n", " exports.OpenURL = OpenURL;\n", " OpenURL.__name__ = \"OpenURL\";\n", " OpenURL.init_OpenURL();\n", " },\n", " /* models/canvas/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var canvas_1 = require(181) /* ./canvas */;\n", " exports.Canvas = canvas_1.Canvas;\n", " var cartesian_frame_1 = require(184) /* ./cartesian_frame */;\n", " exports.CartesianFrame = cartesian_frame_1.CartesianFrame;\n", " },\n", " /* models/canvas/canvas.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const has_props_1 = require(13) /* ../../core/has_props */;\n", " const dom_view_1 = require(66) /* ../../core/dom_view */;\n", " const logging_1 = require(72) /* ../../core/logging */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const object_1 = require(17) /* ../../core/util/object */;\n", " const bbox_1 = require(88) /* ../../core/util/bbox */;\n", " const canvas_1 = require(182) /* ../../core/util/canvas */;\n", " const svg_1 = require(183) /* ../../core/util/svg */;\n", " const global_webgl = (() => {\n", " // We use a global invisible canvas and gl context. By having a global context,\n", " // we avoid the limitation of max 16 contexts that most browsers have.\n", " const canvas = document.createElement(\"canvas\");\n", " const gl = canvas.getContext(\"webgl\", { premultipliedAlpha: true });\n", " // If WebGL is available, we store a reference to the gl canvas on\n", " // the ctx object, because that's what gets passed everywhere.\n", " if (gl != null)\n", " return { canvas, gl };\n", " else {\n", " logging_1.logger.trace(\"WebGL is not supported\");\n", " return undefined;\n", " }\n", " })();\n", " const style = {\n", " position: \"absolute\",\n", " top: \"0\",\n", " left: \"0\",\n", " width: \"100%\",\n", " height: \"100%\",\n", " };\n", " class CanvasLayer {\n", " constructor(backend, hidpi) {\n", " this.backend = backend;\n", " this.hidpi = hidpi;\n", " this.pixel_ratio = 1;\n", " this.bbox = new bbox_1.BBox();\n", " switch (backend) {\n", " case \"webgl\":\n", " case \"canvas\": {\n", " this._el = this._canvas = dom_1.canvas({ style });\n", " const ctx = this.canvas.getContext('2d');\n", " if (ctx == null)\n", " throw new Error(\"unable to obtain 2D rendering context\");\n", " this._ctx = ctx;\n", " if (hidpi) {\n", " this.pixel_ratio = devicePixelRatio;\n", " }\n", " break;\n", " }\n", " case \"svg\": {\n", " const ctx = new svg_1.SVGRenderingContext2D();\n", " this._ctx = ctx;\n", " this._canvas = ctx.getSvg();\n", " this._el = dom_1.div({ style }, this._canvas);\n", " break;\n", " }\n", " }\n", " canvas_1.fixup_ctx(this._ctx);\n", " }\n", " get canvas() {\n", " return this._canvas;\n", " }\n", " get ctx() {\n", " return this._ctx;\n", " }\n", " get el() {\n", " return this._el;\n", " }\n", " resize(width, height) {\n", " this.bbox = new bbox_1.BBox({ left: 0, top: 0, width, height });\n", " const target = this._ctx instanceof svg_1.SVGRenderingContext2D ? this._ctx : this.canvas;\n", " target.width = width * this.pixel_ratio;\n", " target.height = height * this.pixel_ratio;\n", " }\n", " prepare() {\n", " const { ctx, hidpi, pixel_ratio } = this;\n", " ctx.save();\n", " if (hidpi) {\n", " ctx.scale(pixel_ratio, pixel_ratio);\n", " ctx.translate(0.5, 0.5);\n", " }\n", " this.clear();\n", " }\n", " clear() {\n", " const { x, y, width, height } = this.bbox;\n", " this.ctx.clearRect(x, y, width, height);\n", " }\n", " finish() {\n", " this.ctx.restore();\n", " }\n", " save(name) {\n", " const { _canvas } = this;\n", " if (_canvas instanceof HTMLCanvasElement) {\n", " if (_canvas.msToBlob != null) {\n", " const blob = _canvas.msToBlob();\n", " window.navigator.msSaveBlob(blob, name);\n", " }\n", " else {\n", " const link = document.createElement(\"a\");\n", " link.href = _canvas.toDataURL(\"image/png\");\n", " link.download = name + \".png\";\n", " link.target = \"_blank\";\n", " link.dispatchEvent(new MouseEvent(\"click\"));\n", " }\n", " }\n", " else {\n", " const ctx = this._ctx;\n", " const svg = ctx.getSerializedSvg(true);\n", " const svgblob = new Blob([svg], { type: \"text/plain\" });\n", " const downloadLink = document.createElement(\"a\");\n", " downloadLink.download = name + \".svg\";\n", " downloadLink.innerHTML = \"Download svg\";\n", " downloadLink.href = window.URL.createObjectURL(svgblob);\n", " downloadLink.onclick = (event) => document.body.removeChild(event.target);\n", " downloadLink.style.display = \"none\";\n", " document.body.appendChild(downloadLink);\n", " downloadLink.click();\n", " }\n", " }\n", " }\n", " exports.CanvasLayer = CanvasLayer;\n", " CanvasLayer.__name__ = \"CanvasLayer\";\n", " class CanvasView extends dom_view_1.DOMView {\n", " initialize() {\n", " super.initialize();\n", " const { output_backend, hidpi } = this.model;\n", " if (output_backend == \"webgl\") {\n", " this.webgl = global_webgl;\n", " }\n", " this.underlays_el = dom_1.div({ style });\n", " this.primary = new CanvasLayer(output_backend, hidpi);\n", " this.overlays = new CanvasLayer(output_backend, hidpi);\n", " this.overlays_el = dom_1.div({ style });\n", " this.events_el = dom_1.div({ class: \"bk-canvas-events\", style });\n", " const elements = [\n", " this.underlays_el,\n", " this.primary.el,\n", " this.overlays.el,\n", " this.overlays_el,\n", " this.events_el,\n", " ];\n", " object_1.extend(this.el.style, style);\n", " dom_1.append(this.el, ...elements);\n", " logging_1.logger.debug(\"CanvasView initialized\");\n", " }\n", " add_underlay(el) {\n", " this.underlays_el.appendChild(el);\n", " }\n", " add_overlay(el) {\n", " this.overlays_el.appendChild(el);\n", " }\n", " add_event(el) {\n", " this.events_el.appendChild(el);\n", " }\n", " get pixel_ratio() {\n", " return this.primary.pixel_ratio; // XXX: primary\n", " }\n", " resize(width, height) {\n", " this.bbox = new bbox_1.BBox({ left: 0, top: 0, width, height });\n", " this.primary.resize(width, height);\n", " this.overlays.resize(width, height);\n", " }\n", " prepare_webgl(frame_box) {\n", " // Prepare WebGL for a drawing pass\n", " const { webgl } = this;\n", " if (webgl != null) {\n", " // Sync canvas size\n", " const { width, height } = this.bbox;\n", " webgl.canvas.width = this.pixel_ratio * width;\n", " webgl.canvas.height = this.pixel_ratio * height;\n", " const { gl } = webgl;\n", " // Clipping\n", " gl.enable(gl.SCISSOR_TEST);\n", " const [sx, sy, w, h] = frame_box;\n", " const { xview, yview } = this.bbox;\n", " const vx = xview.compute(sx);\n", " const vy = yview.compute(sy + h);\n", " const ratio = this.pixel_ratio;\n", " gl.scissor(ratio * vx, ratio * vy, ratio * w, ratio * h); // lower left corner, width, height\n", " // Setup blending\n", " gl.enable(gl.BLEND);\n", " gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE_MINUS_DST_ALPHA, gl.ONE); // premultipliedAlpha == true\n", " }\n", " }\n", " clear_webgl() {\n", " const { webgl } = this;\n", " if (webgl != null) {\n", " // Prepare GL for drawing\n", " const { gl, canvas } = webgl;\n", " gl.viewport(0, 0, canvas.width, canvas.height);\n", " gl.clearColor(0, 0, 0, 0);\n", " gl.clear(gl.COLOR_BUFFER_BIT || gl.DEPTH_BUFFER_BIT);\n", " }\n", " }\n", " blit_webgl(ctx) {\n", " // This should be called when the ctx has no state except the HIDPI transform\n", " const { webgl } = this;\n", " if (webgl != null) {\n", " // Blit gl canvas into the 2D canvas. To do 1-on-1 blitting, we need\n", " // to remove the hidpi transform, then blit, then restore.\n", " // ctx.globalCompositeOperation = \"source-over\" -> OK; is the default\n", " logging_1.logger.debug('drawing with WebGL');\n", " ctx.restore();\n", " ctx.drawImage(webgl.canvas, 0, 0);\n", " // Set back hidpi transform\n", " ctx.save();\n", " if (this.model.hidpi) {\n", " const ratio = this.pixel_ratio;\n", " ctx.scale(ratio, ratio);\n", " ctx.translate(0.5, 0.5);\n", " }\n", " }\n", " }\n", " save(name) {\n", " const { output_backend } = this.model;\n", " const { width, height } = this.bbox;\n", " const composite = new CanvasLayer(output_backend, false);\n", " composite.resize(width, height);\n", " composite.ctx.drawImage(this.primary.canvas, 0, 0);\n", " composite.ctx.drawImage(this.overlays.canvas, 0, 0);\n", " composite.save(name);\n", " }\n", " }\n", " exports.CanvasView = CanvasView;\n", " CanvasView.__name__ = \"CanvasView\";\n", " class Canvas extends has_props_1.HasProps {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Canvas() {\n", " this.prototype.default_view = CanvasView;\n", " this.internal({\n", " hidpi: [p.Boolean, true],\n", " output_backend: [p.OutputBackend, \"canvas\"],\n", " });\n", " }\n", " }\n", " exports.Canvas = Canvas;\n", " Canvas.__name__ = \"Canvas\";\n", " Canvas.init_Canvas();\n", " },\n", " /* core/util/canvas.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " function fixup_line_dash(ctx) {\n", " if (!ctx.setLineDash) {\n", " ctx.setLineDash = (dash) => {\n", " ctx.mozDash = dash;\n", " ctx.webkitLineDash = dash;\n", " };\n", " }\n", " if (!ctx.getLineDash) {\n", " ctx.getLineDash = () => {\n", " return ctx.mozDash;\n", " };\n", " }\n", " }\n", " function fixup_line_dash_offset(ctx) {\n", " ctx.setLineDashOffset = (offset) => {\n", " ctx.lineDashOffset = offset;\n", " ctx.mozDashOffset = offset;\n", " ctx.webkitLineDashOffset = offset;\n", " };\n", " ctx.getLineDashOffset = () => {\n", " return ctx.mozDashOffset;\n", " };\n", " }\n", " function fixup_image_smoothing(ctx) {\n", " ctx.setImageSmoothingEnabled = (value) => {\n", " ctx.imageSmoothingEnabled = value;\n", " ctx.mozImageSmoothingEnabled = value;\n", " ctx.oImageSmoothingEnabled = value;\n", " ctx.webkitImageSmoothingEnabled = value;\n", " ctx.msImageSmoothingEnabled = value;\n", " };\n", " ctx.getImageSmoothingEnabled = () => {\n", " const val = ctx.imageSmoothingEnabled;\n", " return val != null ? val : true;\n", " };\n", " }\n", " function fixup_measure_text(ctx) {\n", " if (ctx.measureText && ctx.html5MeasureText == null) {\n", " ctx.html5MeasureText = ctx.measureText;\n", " ctx.measureText = (text) => {\n", " const textMetrics = ctx.html5MeasureText(text);\n", " // fake it til you make it\n", " textMetrics.ascent = ctx.html5MeasureText(\"m\").width * 1.6;\n", " return textMetrics;\n", " };\n", " }\n", " }\n", " function fixup_ellipse(ctx) {\n", " // implementing the ctx.ellipse function with bezier curves\n", " // we don't implement the startAngle, endAngle and anticlockwise arguments.\n", " function ellipse_bezier(x, y, radiusX, radiusY, rotation, _startAngle, _endAngle, anticlockwise = false) {\n", " const c = 0.551784; // see http://www.tinaja.com/glib/ellipse4.pdf\n", " ctx.translate(x, y);\n", " ctx.rotate(rotation);\n", " let rx = radiusX;\n", " let ry = radiusY;\n", " if (anticlockwise) {\n", " rx = -radiusX;\n", " ry = -radiusY;\n", " }\n", " ctx.moveTo(-rx, 0); // start point of first curve\n", " ctx.bezierCurveTo(-rx, ry * c, -rx * c, ry, 0, ry);\n", " ctx.bezierCurveTo(rx * c, ry, rx, ry * c, rx, 0);\n", " ctx.bezierCurveTo(rx, -ry * c, rx * c, -ry, 0, -ry);\n", " ctx.bezierCurveTo(-rx * c, -ry, -rx, -ry * c, -rx, 0);\n", " ctx.rotate(-rotation);\n", " ctx.translate(-x, -y);\n", " }\n", " if (!ctx.ellipse)\n", " ctx.ellipse = ellipse_bezier;\n", " }\n", " function fixup_ctx(ctx) {\n", " fixup_line_dash(ctx);\n", " fixup_line_dash_offset(ctx);\n", " fixup_image_smoothing(ctx);\n", " fixup_measure_text(ctx);\n", " fixup_ellipse(ctx);\n", " }\n", " exports.fixup_ctx = fixup_ctx;\n", " },\n", " /* core/util/svg.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " /**\n", " * Based on https://github.com/gliffy/canvas2svg\n", " */\n", " const types_1 = require(8) /* ./types */;\n", " function svg_children(node) {\n", " return [...node.childNodes];\n", " }\n", " // helper function that generates a random string\n", " function randomString(holder) {\n", " if (!holder) {\n", " throw new Error(\"cannot create a random attribute name for an undefined object\");\n", " }\n", " const chars = \"ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz\";\n", " let randomstring = \"\";\n", " do {\n", " randomstring = \"\";\n", " for (let i = 0; i < 12; i++) {\n", " randomstring += chars[Math.floor(Math.random() * chars.length)];\n", " }\n", " } while (holder[randomstring]);\n", " return randomstring;\n", " }\n", " // helper function to map named to numbered entities\n", " function createNamedToNumberedLookup(input, radix) {\n", " const lookup = new Map();\n", " const items = input.split(',');\n", " radix = radix || 10;\n", " // Map from named to numbered entities.\n", " for (let i = 0; i < items.length; i += 2) {\n", " const entity = '&' + items[i + 1] + ';';\n", " const base10 = parseInt(items[i], radix);\n", " lookup.set(entity, '&#' + base10 + ';');\n", " }\n", " // FF and IE need to create a regex from hex values ie   == \\xa0\n", " lookup.set(\"\\\\xa0\", ' ');\n", " return lookup;\n", " }\n", " // helper function to map canvas-textAlign to svg-textAnchor\n", " function getTextAnchor(textAlign) {\n", " // TODO: support rtl languages\n", " const mapping = { left: \"start\", right: \"end\", center: \"middle\", start: \"start\", end: \"end\" };\n", " return mapping[textAlign] || mapping.start;\n", " }\n", " // helper function to map canvas-textBaseline to svg-dominantBaseline\n", " function getDominantBaseline(textBaseline) {\n", " // INFO: not supported in all browsers\n", " const mapping = { alphabetic: \"alphabetic\", hanging: \"hanging\", top: \"text-before-edge\", bottom: \"text-after-edge\", middle: \"central\" };\n", " return mapping[textBaseline] || mapping.alphabetic;\n", " }\n", " // Unpack entities lookup where the numbers are in radix 32 to reduce the size\n", " // entity mapping courtesy of tinymce\n", " const namedEntities = createNamedToNumberedLookup('50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,' +\n", " '5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,' +\n", " '5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,' +\n", " '5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,' +\n", " '68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,' +\n", " '6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,' +\n", " '6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,' +\n", " '75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,' +\n", " '7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,' +\n", " '7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,' +\n", " 'sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,' +\n", " 'st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,' +\n", " 't9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,' +\n", " 'tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,' +\n", " 'u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,' +\n", " '81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,' +\n", " '8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,' +\n", " '8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,' +\n", " '8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,' +\n", " '8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,' +\n", " 'nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,' +\n", " 'rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,' +\n", " 'Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,' +\n", " '80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,' +\n", " '811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro', 32);\n", " // Some basic mappings for attributes and default values.\n", " const STYLES = {\n", " strokeStyle: {\n", " svgAttr: \"stroke\",\n", " canvas: \"#000000\",\n", " svg: \"none\",\n", " apply: \"stroke\",\n", " },\n", " fillStyle: {\n", " svgAttr: \"fill\",\n", " canvas: \"#000000\",\n", " svg: null,\n", " apply: \"fill\",\n", " },\n", " lineCap: {\n", " svgAttr: \"stroke-linecap\",\n", " canvas: \"butt\",\n", " svg: \"butt\",\n", " apply: \"stroke\",\n", " },\n", " lineJoin: {\n", " svgAttr: \"stroke-linejoin\",\n", " canvas: \"miter\",\n", " svg: \"miter\",\n", " apply: \"stroke\",\n", " },\n", " miterLimit: {\n", " svgAttr: \"stroke-miterlimit\",\n", " canvas: 10,\n", " svg: 4,\n", " apply: \"stroke\",\n", " },\n", " lineWidth: {\n", " svgAttr: \"stroke-width\",\n", " canvas: 1,\n", " svg: 1,\n", " apply: \"stroke\",\n", " },\n", " globalAlpha: {\n", " svgAttr: \"opacity\",\n", " canvas: 1,\n", " svg: 1,\n", " apply: \"fill stroke\",\n", " },\n", " font: {\n", " // font converts to multiple svg attributes, there is custom logic for this\n", " canvas: \"10px sans-serif\",\n", " },\n", " shadowColor: {\n", " canvas: \"#000000\",\n", " },\n", " shadowOffsetX: {\n", " canvas: 0,\n", " },\n", " shadowOffsetY: {\n", " canvas: 0,\n", " },\n", " shadowBlur: {\n", " canvas: 0,\n", " },\n", " textAlign: {\n", " canvas: \"start\",\n", " },\n", " textBaseline: {\n", " canvas: \"alphabetic\",\n", " },\n", " lineDash: {\n", " svgAttr: \"stroke-dasharray\",\n", " canvas: [],\n", " svg: null,\n", " apply: \"stroke\",\n", " },\n", " };\n", " class CanvasGradient {\n", " constructor(gradientNode, ctx) {\n", " this.__root = gradientNode;\n", " this.__ctx = ctx;\n", " }\n", " /**\n", " * Adds a color stop to the gradient root\n", " */\n", " addColorStop(offset, color) {\n", " const stop = this.__ctx.__createElement(\"stop\");\n", " stop.setAttribute(\"offset\", `${offset}`);\n", " if (color.indexOf(\"rgba\") !== -1) {\n", " // separate alpha value, since webkit can't handle it\n", " const regex = /rgba\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d?\\.?\\d*)\\s*\\)/gi;\n", " const matches = regex.exec(color);\n", " const [, r, g, b, a] = matches;\n", " stop.setAttribute(\"stop-color\", `rgb(${r},${g},${b})`);\n", " stop.setAttribute(\"stop-opacity\", a);\n", " }\n", " else {\n", " stop.setAttribute(\"stop-color\", color);\n", " }\n", " this.__root.appendChild(stop);\n", " }\n", " }\n", " CanvasGradient.__name__ = \"CanvasGradient\";\n", " class CanvasPattern {\n", " constructor(pattern, ctx) {\n", " this.__root = pattern;\n", " this.__ctx = ctx;\n", " }\n", " }\n", " CanvasPattern.__name__ = \"CanvasPattern\";\n", " /**\n", " * The mock canvas context\n", " * @param o - options include:\n", " * ctx - existing Context2D to wrap around\n", " * width - width of your canvas (defaults to 500)\n", " * height - height of your canvas (defaults to 500)\n", " * enableMirroring - enables canvas mirroring (get image data) (defaults to false)\n", " * document - the document object (defaults to the current document)\n", " */\n", " class SVGRenderingContext2D /*implements CanvasRenderingContext2D*/ {\n", " constructor(options) {\n", " var _a, _b, _c, _d;\n", " this.__currentPosition = null;\n", " this.__currentElementsToStyle = null;\n", " this.enableMirroring = (_a = options === null || options === void 0 ? void 0 : options.enableMirroring) !== null && _a !== void 0 ? _a : false;\n", " this.__document = (_b = options === null || options === void 0 ? void 0 : options.document) !== null && _b !== void 0 ? _b : document;\n", " // allow passing in an existing context to wrap around\n", " // if a context is passed in, we know a canvas already exist\n", " if (options === null || options === void 0 ? void 0 : options.ctx) {\n", " this.__ctx = options.ctx;\n", " }\n", " else {\n", " this.__canvas = this.__document.createElement(\"canvas\");\n", " this.__ctx = this.__canvas.getContext(\"2d\");\n", " }\n", " this.__setDefaultStyles();\n", " this.__stack = [this.__getStyleState()];\n", " this.__groupStack = [];\n", " // the root svg element\n", " this.__root = this.__document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n", " this.__root.setAttribute(\"version\", \"1.1\");\n", " this.__root.setAttribute(\"xmlns\", \"http://www.w3.org/2000/svg\");\n", " this.__root.setAttributeNS(\"http://www.w3.org/2000/xmlns/\", \"xmlns:xlink\", \"http://www.w3.org/1999/xlink\");\n", " this.width = (_c = options === null || options === void 0 ? void 0 : options.width) !== null && _c !== void 0 ? _c : 500;\n", " this.height = (_d = options === null || options === void 0 ? void 0 : options.height) !== null && _d !== void 0 ? _d : 500;\n", " // make sure we don't generate the same ids in defs\n", " this.__ids = {};\n", " // defs tag\n", " this.__defs = this.__document.createElementNS(\"http://www.w3.org/2000/svg\", \"defs\");\n", " this.__root.appendChild(this.__defs);\n", " // also add a group child. the svg element can't use the transform attribute\n", " this.__currentElement = this.__document.createElementNS(\"http://www.w3.org/2000/svg\", \"g\");\n", " this.__root.appendChild(this.__currentElement);\n", " }\n", " get canvas() {\n", " // XXX: point back to this instance\n", " return this;\n", " }\n", " get width() {\n", " return this._width;\n", " }\n", " set width(width) {\n", " this._width = width;\n", " this.__root.setAttribute(\"width\", `${width}`);\n", " }\n", " get height() {\n", " return this._height;\n", " }\n", " set height(height) {\n", " this._height = height;\n", " this.__root.setAttribute(\"height\", `${height}`);\n", " }\n", " /**\n", " * Creates the specified svg element\n", " */\n", " __createElement(elementName, properties = {}, resetFill = false) {\n", " const element = this.__document.createElementNS(\"http://www.w3.org/2000/svg\", elementName);\n", " if (resetFill) {\n", " // if fill or stroke is not specified, the svg element should not display. By default SVG's fill is black.\n", " element.setAttribute(\"fill\", \"none\");\n", " element.setAttribute(\"stroke\", \"none\");\n", " }\n", " const keys = Object.keys(properties);\n", " for (const key of keys) {\n", " element.setAttribute(key, `${properties[key]}`);\n", " }\n", " return element;\n", " }\n", " /**\n", " * Applies default canvas styles to the context\n", " */\n", " __setDefaultStyles() {\n", " // default 2d canvas context properties see:http://www.w3.org/TR/2dcontext/\n", " const keys = Object.keys(STYLES);\n", " const self = this;\n", " for (let i = 0; i < keys.length; i++) {\n", " const key = keys[i];\n", " self[key] = STYLES[key].canvas;\n", " }\n", " }\n", " /**\n", " * Applies styles on restore\n", " */\n", " __applyStyleState(styleState) {\n", " const keys = Object.keys(styleState);\n", " const self = this;\n", " for (let i = 0; i < keys.length; i++) {\n", " const key = keys[i];\n", " self[key] = styleState[key];\n", " }\n", " }\n", " /**\n", " * Gets the current style state\n", " */\n", " __getStyleState() {\n", " const keys = Object.keys(STYLES);\n", " const styleState = {};\n", " for (let i = 0; i < keys.length; i++) {\n", " const key = keys[i];\n", " styleState[key] = this[key];\n", " }\n", " return styleState;\n", " }\n", " /**\n", " * Apples the current styles to the current SVG element. On \"ctx.fill\" or \"ctx.stroke\"\n", " */\n", " __applyStyleToCurrentElement(type) {\n", " let currentElement = this.__currentElement;\n", " const currentStyleGroup = this.__currentElementsToStyle;\n", " if (currentStyleGroup != null) {\n", " currentElement.setAttribute(type, \"\");\n", " currentElement = currentStyleGroup.element;\n", " for (const node of currentStyleGroup.children) {\n", " node.setAttribute(type, \"\");\n", " }\n", " }\n", " const keys = Object.keys(STYLES);\n", " for (let i = 0; i < keys.length; i++) {\n", " const style = STYLES[keys[i]];\n", " const value = this[keys[i]];\n", " if (style.apply) {\n", " // is this a gradient or pattern?\n", " if (value instanceof CanvasPattern) {\n", " // pattern\n", " if (value.__ctx) {\n", " // copy over defs\n", " while (value.__ctx.__defs.childNodes.length) {\n", " const id = svg_children(value.__ctx.__defs)[0].getAttribute(\"id\");\n", " this.__ids[id] = id;\n", " this.__defs.appendChild(value.__ctx.__defs.childNodes[0]);\n", " }\n", " }\n", " const id = value.__root.getAttribute(\"id\");\n", " currentElement.setAttribute(style.apply, `url(#${id})`);\n", " }\n", " else if (value instanceof CanvasGradient) {\n", " // gradient\n", " const id = value.__root.getAttribute(\"id\");\n", " currentElement.setAttribute(style.apply, `url(#${id})`);\n", " }\n", " else if (style.apply.indexOf(type) !== -1 && style.svg !== value) {\n", " if ((style.svgAttr === \"stroke\" || style.svgAttr === \"fill\") && types_1.isString(value) && value.indexOf(\"rgba\") !== -1) {\n", " // separate alpha value, since illustrator can't handle it\n", " const regex = /rgba\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d?\\.?\\d*)\\s*\\)/gi;\n", " const matches = regex.exec(value);\n", " const [, r, g, b, a] = matches;\n", " currentElement.setAttribute(style.svgAttr, `rgb(${r},${g},${b})`);\n", " // should take globalAlpha here\n", " let opacity = parseFloat(a);\n", " const globalAlpha = this.globalAlpha;\n", " if (globalAlpha != null) {\n", " opacity *= globalAlpha;\n", " }\n", " currentElement.setAttribute(style.svgAttr + \"-opacity\", `${opacity}`);\n", " }\n", " else {\n", " let attr = style.svgAttr;\n", " if (keys[i] === 'globalAlpha') {\n", " attr = type + '-' + style.svgAttr;\n", " if (currentElement.getAttribute(attr)) {\n", " // fill-opacity or stroke-opacity has already been set by stroke or fill.\n", " continue;\n", " }\n", " }\n", " // otherwise only update attribute if right type, and not svg default\n", " currentElement.setAttribute(attr, `${value}`);\n", " }\n", " }\n", " }\n", " }\n", " }\n", " /**\n", " * Will return the closest group or svg node. May return the current element.\n", " */\n", " __closestGroupOrSvg(node = this.__currentElement) {\n", " if (node.nodeName === \"g\" || node.nodeName === \"svg\") {\n", " return node;\n", " }\n", " else {\n", " return this.__closestGroupOrSvg(node.parentNode);\n", " }\n", " }\n", " /**\n", " * Returns the serialized value of the svg so far\n", " * @param fixNamedEntities - Standalone SVG doesn't support named entities, which document.createTextNode encodes.\n", " * If true, we attempt to find all named entities and encode it as a numeric entity.\n", " * @return serialized svg\n", " */\n", " getSerializedSvg(fixNamedEntities = false) {\n", " let serialized = new XMLSerializer().serializeToString(this.__root);\n", " // IE search for a duplicate xmnls because they didn't implement setAttributeNS correctly\n", " const xmlns = /xmlns=\"http:\\/\\/www\\.w3\\.org\\/2000\\/svg\".+xmlns=\"http:\\/\\/www\\.w3\\.org\\/2000\\/svg/gi;\n", " if (xmlns.test(serialized)) {\n", " serialized = serialized.replace('xmlns=\"http://www.w3.org/2000/svg', 'xmlns:xlink=\"http://www.w3.org/1999/xlink');\n", " }\n", " if (fixNamedEntities) {\n", " // loop over each named entity and replace with the proper equivalent.\n", " for (const [key, value] of namedEntities) {\n", " const regexp = new RegExp(key, \"gi\");\n", " if (regexp.test(serialized)) {\n", " serialized = serialized.replace(regexp, value);\n", " }\n", " }\n", " }\n", " return serialized;\n", " }\n", " getSvg() {\n", " return this.__root;\n", " }\n", " /**\n", " * Will generate a group tag.\n", " */\n", " save() {\n", " const group = this.__createElement(\"g\");\n", " const parent = this.__closestGroupOrSvg();\n", " this.__groupStack.push(parent);\n", " parent.appendChild(group);\n", " this.__currentElement = group;\n", " this.__stack.push(this.__getStyleState());\n", " }\n", " /**\n", " * Sets current element to parent, or just root if already root\n", " */\n", " restore() {\n", " this.__currentElement = this.__groupStack.pop();\n", " this.__currentElementsToStyle = null;\n", " // Clearing canvas will make the poped group invalid, currentElement is set to the root group node.\n", " if (!this.__currentElement) {\n", " this.__currentElement = svg_children(this.__root)[1];\n", " }\n", " const state = this.__stack.pop();\n", " this.__applyStyleState(state);\n", " }\n", " /**\n", " * Helper method to add transform\n", " */\n", " __addTransform(t) {\n", " // if the current element has siblings, add another group\n", " const parent = this.__closestGroupOrSvg();\n", " if (parent.childNodes.length > 0) {\n", " if (this.__currentElement.nodeName === \"path\") {\n", " if (!this.__currentElementsToStyle) {\n", " this.__currentElementsToStyle = { element: parent, children: [] };\n", " }\n", " this.__currentElementsToStyle.children.push(this.__currentElement);\n", " this.__applyCurrentDefaultPath();\n", " }\n", " const group = this.__createElement(\"g\");\n", " parent.appendChild(group);\n", " this.__currentElement = group;\n", " }\n", " let transform = this.__currentElement.getAttribute(\"transform\");\n", " if (transform) {\n", " if (transform.includes(t))\n", " return;\n", " transform += \" \";\n", " }\n", " else {\n", " transform = \"\";\n", " }\n", " transform += t;\n", " this.__currentElement.setAttribute(\"transform\", transform);\n", " }\n", " /**\n", " * scales the current element\n", " */\n", " scale(x, y) {\n", " this.__addTransform(`scale(${x},${y !== null && y !== void 0 ? y : x})`);\n", " }\n", " /**\n", " * rotates the current element\n", " */\n", " rotate(angle) {\n", " const degrees = (angle * 180 / Math.PI);\n", " const [cx, cy] = [0, 0];\n", " this.__addTransform(`rotate(${degrees},${cx},${cy})`);\n", " }\n", " /**\n", " * translates the current element\n", " */\n", " translate(x, y) {\n", " this.__addTransform(`translate(${x},${y})`);\n", " }\n", " /**\n", " * applies a transform to the current element\n", " */\n", " transform(a, b, c, d, e, f) {\n", " this.__addTransform(`matrix(${a},${b},${c},${d},${e},${f})`);\n", " }\n", " /**\n", " * Create a new Path Element\n", " */\n", " beginPath() {\n", " // Note that there is only one current default path, it is not part of the drawing state.\n", " // See also: https://html.spec.whatwg.org/multipage/scripting.html#current-default-path\n", " this.__currentDefaultPath = \"\";\n", " this.__currentPosition = null;\n", " const path = this.__createElement(\"path\", {}, true);\n", " const parent = this.__closestGroupOrSvg();\n", " parent.appendChild(path);\n", " this.__currentElement = path;\n", " }\n", " /**\n", " * Helper function to apply currentDefaultPath to current path element\n", " */\n", " __applyCurrentDefaultPath() {\n", " const currentElement = this.__currentElement;\n", " if (currentElement.nodeName === \"path\") {\n", " currentElement.setAttribute(\"d\", this.__currentDefaultPath);\n", " }\n", " else {\n", " console.error(\"Attempted to apply path command to node\", currentElement.nodeName);\n", " }\n", " }\n", " /**\n", " * Helper function to add path command\n", " */\n", " __addPathCommand(command) {\n", " this.__currentDefaultPath += \" \";\n", " this.__currentDefaultPath += command;\n", " }\n", " /**\n", " * Adds the move command to the current path element,\n", " * if the currentPathElement is not empty create a new path element\n", " */\n", " moveTo(x, y) {\n", " if (this.__currentElement.nodeName !== \"path\") {\n", " this.beginPath();\n", " }\n", " // creates a new subpath with the given point\n", " this.__currentPosition = { x, y };\n", " this.__addPathCommand(`M ${x} ${y}`);\n", " }\n", " /**\n", " * Closes the current path\n", " */\n", " closePath() {\n", " if (this.__currentDefaultPath) {\n", " this.__addPathCommand(\"Z\");\n", " }\n", " }\n", " /**\n", " * Adds a line to command\n", " */\n", " lineTo(x, y) {\n", " this.__currentPosition = { x, y };\n", " if (this.__currentDefaultPath.indexOf('M') > -1) {\n", " this.__addPathCommand(`L ${x} ${y}`);\n", " }\n", " else {\n", " this.__addPathCommand(`M ${x} ${y}`);\n", " }\n", " }\n", " /**\n", " * Add a bezier command\n", " */\n", " bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y) {\n", " this.__currentPosition = { x, y };\n", " this.__addPathCommand(`C ${cp1x} ${cp1y} ${cp2x} ${cp2y} ${x} ${y}`);\n", " }\n", " /**\n", " * Adds a quadratic curve to command\n", " */\n", " quadraticCurveTo(cpx, cpy, x, y) {\n", " this.__currentPosition = { x, y };\n", " this.__addPathCommand(`Q ${cpx} ${cpy} ${x} ${y}`);\n", " }\n", " /**\n", " * Adds the arcTo to the current path\n", " *\n", " * @see http://www.w3.org/TR/2015/WD-2dcontext-20150514/#dom-context-2d-arcto\n", " */\n", " arcTo(x1, y1, x2, y2, radius) {\n", " // Let the point (x0, y0) be the last point in the subpath.\n", " if (this.__currentPosition == null)\n", " return;\n", " const x0 = this.__currentPosition.x;\n", " const y0 = this.__currentPosition.y;\n", " // Negative values for radius must cause the implementation to throw an IndexSizeError exception.\n", " if (radius < 0) {\n", " throw new Error(\"IndexSizeError: The radius provided (\" + radius + \") is negative.\");\n", " }\n", " // If the point (x0, y0) is equal to the point (x1, y1),\n", " // or if the point (x1, y1) is equal to the point (x2, y2),\n", " // or if the radius radius is zero,\n", " // then the method must add the point (x1, y1) to the subpath,\n", " // and connect that point to the previous point (x0, y0) by a straight line.\n", " if (((x0 === x1) && (y0 === y1)) || ((x1 === x2) && (y1 === y2)) || (radius === 0)) {\n", " this.lineTo(x1, y1);\n", " return;\n", " }\n", " function normalize([x, y]) {\n", " const len = Math.sqrt(x ** 2 + y ** 2);\n", " return [x / len, y / len];\n", " }\n", " // Otherwise, if the points (x0, y0), (x1, y1), and (x2, y2) all lie on a single straight line,\n", " // then the method must add the point (x1, y1) to the subpath,\n", " // and connect that point to the previous point (x0, y0) by a straight line.\n", " const unit_vec_p1_p0 = normalize([x0 - x1, y0 - y1]);\n", " const unit_vec_p1_p2 = normalize([x2 - x1, y2 - y1]);\n", " if (unit_vec_p1_p0[0] * unit_vec_p1_p2[1] === unit_vec_p1_p0[1] * unit_vec_p1_p2[0]) {\n", " this.lineTo(x1, y1);\n", " return;\n", " }\n", " // Otherwise, let The Arc be the shortest arc given by circumference of the circle that has radius radius,\n", " // and that has one point tangent to the half-infinite line that crosses the point (x0, y0) and ends at the point (x1, y1),\n", " // and that has a different point tangent to the half-infinite line that ends at the point (x1, y1), and crosses the point (x2, y2).\n", " // The points at which this circle touches these two lines are called the start and end tangent points respectively.\n", " // note that both vectors are unit vectors, so the length is 1\n", " const cos = (unit_vec_p1_p0[0] * unit_vec_p1_p2[0] + unit_vec_p1_p0[1] * unit_vec_p1_p2[1]);\n", " const theta = Math.acos(Math.abs(cos));\n", " // Calculate origin\n", " const unit_vec_p1_origin = normalize([\n", " unit_vec_p1_p0[0] + unit_vec_p1_p2[0],\n", " unit_vec_p1_p0[1] + unit_vec_p1_p2[1],\n", " ]);\n", " const len_p1_origin = radius / Math.sin(theta / 2);\n", " const x = x1 + len_p1_origin * unit_vec_p1_origin[0];\n", " const y = y1 + len_p1_origin * unit_vec_p1_origin[1];\n", " // Calculate start angle and end angle\n", " // rotate 90deg clockwise (note that y axis points to its down)\n", " const unit_vec_origin_start_tangent = [\n", " -unit_vec_p1_p0[1],\n", " unit_vec_p1_p0[0],\n", " ];\n", " // rotate 90deg counter clockwise (note that y axis points to its down)\n", " const unit_vec_origin_end_tangent = [\n", " unit_vec_p1_p2[1],\n", " -unit_vec_p1_p2[0],\n", " ];\n", " function getAngle(vector) {\n", " // get angle (clockwise) between vector and (1, 0)\n", " const x = vector[0];\n", " const y = vector[1];\n", " if (y >= 0) { // note that y axis points to its down\n", " return Math.acos(x);\n", " }\n", " else {\n", " return -Math.acos(x);\n", " }\n", " }\n", " const startAngle = getAngle(unit_vec_origin_start_tangent);\n", " const endAngle = getAngle(unit_vec_origin_end_tangent);\n", " // Connect the point (x0, y0) to the start tangent point by a straight line\n", " this.lineTo(x + unit_vec_origin_start_tangent[0] * radius, y + unit_vec_origin_start_tangent[1] * radius);\n", " // Connect the start tangent point to the end tangent point by arc\n", " // and adding the end tangent point to the subpath.\n", " this.arc(x, y, radius, startAngle, endAngle);\n", " }\n", " /**\n", " * Sets the stroke property on the current element\n", " */\n", " stroke() {\n", " if (this.__currentElement.nodeName === \"path\") {\n", " this.__currentElement.setAttribute(\"paint-order\", \"fill stroke markers\");\n", " }\n", " this.__applyCurrentDefaultPath();\n", " this.__applyStyleToCurrentElement(\"stroke\");\n", " }\n", " /**\n", " * Sets fill properties on the current element\n", " */\n", " fill() {\n", " if (this.__currentElement.nodeName === \"path\") {\n", " this.__currentElement.setAttribute(\"paint-order\", \"stroke fill markers\");\n", " }\n", " this.__applyCurrentDefaultPath();\n", " this.__applyStyleToCurrentElement(\"fill\");\n", " }\n", " /**\n", " * Adds a rectangle to the path.\n", " */\n", " rect(x, y, width, height) {\n", " if (this.__currentElement.nodeName !== \"path\") {\n", " this.beginPath();\n", " }\n", " this.moveTo(x, y);\n", " this.lineTo(x + width, y);\n", " this.lineTo(x + width, y + height);\n", " this.lineTo(x, y + height);\n", " this.lineTo(x, y);\n", " this.closePath();\n", " }\n", " /**\n", " * adds a rectangle element\n", " */\n", " fillRect(x, y, width, height) {\n", " const rect = this.__createElement(\"rect\", { x, y, width, height }, true);\n", " const parent = this.__closestGroupOrSvg();\n", " parent.appendChild(rect);\n", " this.__currentElement = rect;\n", " this.__applyStyleToCurrentElement(\"fill\");\n", " }\n", " /**\n", " * Draws a rectangle with no fill\n", " * @param x\n", " * @param y\n", " * @param width\n", " * @param height\n", " */\n", " strokeRect(x, y, width, height) {\n", " const rect = this.__createElement(\"rect\", { x, y, width, height }, true);\n", " const parent = this.__closestGroupOrSvg();\n", " parent.appendChild(rect);\n", " this.__currentElement = rect;\n", " this.__applyStyleToCurrentElement(\"stroke\");\n", " }\n", " /**\n", " * Clear entire canvas:\n", " * 1. save current transforms\n", " * 2. remove all the childNodes of the root g element\n", " */\n", " __clearCanvas() {\n", " const current = this.__closestGroupOrSvg();\n", " const transform = current.getAttribute(\"transform\");\n", " const rootGroup = svg_children(this.__root)[1];\n", " const childNodes = rootGroup.childNodes;\n", " for (let i = childNodes.length - 1; i >= 0; i--) {\n", " if (childNodes[i]) {\n", " rootGroup.removeChild(childNodes[i]);\n", " }\n", " }\n", " this.__currentElement = rootGroup;\n", " // reset __groupStack as all the child group nodes are all removed.\n", " this.__groupStack = [];\n", " if (transform) {\n", " this.__addTransform(transform);\n", " }\n", " }\n", " /**\n", " * \"Clears\" a canvas by just drawing a white rectangle in the current group.\n", " */\n", " clearRect(x, y, width, height) {\n", " if (x === 0 && y === 0 && width === this.width && height === this.height) {\n", " this.__clearCanvas();\n", " return;\n", " }\n", " const rect = this.__createElement(\"rect\", { x, y, width, height, fill: \"#FFFFFF\" }, true);\n", " const parent = this.__closestGroupOrSvg();\n", " parent.appendChild(rect);\n", " }\n", " /**\n", " * Adds a linear gradient to a defs tag.\n", " * Returns a canvas gradient object that has a reference to it's parent def\n", " */\n", " createLinearGradient(x1, y1, x2, y2) {\n", " const grad = this.__createElement(\"linearGradient\", {\n", " id: randomString(this.__ids),\n", " x1: x1 + \"px\",\n", " x2: x2 + \"px\",\n", " y1: y1 + \"px\",\n", " y2: y2 + \"px\",\n", " gradientUnits: \"userSpaceOnUse\",\n", " }, false);\n", " this.__defs.appendChild(grad);\n", " return new CanvasGradient(grad, this);\n", " }\n", " /**\n", " * Adds a radial gradient to a defs tag.\n", " * Returns a canvas gradient object that has a reference to it's parent def\n", " */\n", " createRadialGradient(x0, y0, _r0, x1, y1, r1) {\n", " const grad = this.__createElement(\"radialGradient\", {\n", " id: randomString(this.__ids),\n", " cx: x1 + \"px\",\n", " cy: y1 + \"px\",\n", " r: r1 + \"px\",\n", " fx: x0 + \"px\",\n", " fy: y0 + \"px\",\n", " gradientUnits: \"userSpaceOnUse\",\n", " }, false);\n", " this.__defs.appendChild(grad);\n", " return new CanvasGradient(grad, this);\n", " }\n", " /**\n", " * Parses the font string and returns svg mapping\n", " */\n", " __parseFont() {\n", " const regex = /^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))(?:\\s*\\/\\s*(normal|[.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])))?\\s*([-,\\'\\\"\\sa-z0-9]+?)\\s*$/i;\n", " const fontPart = regex.exec(this.font);\n", " const data = {\n", " style: fontPart[1] || 'normal',\n", " size: fontPart[4] || '10px',\n", " family: fontPart[6] || 'sans-serif',\n", " weight: fontPart[3] || 'normal',\n", " decoration: fontPart[2] || 'normal',\n", " };\n", " // canvas doesn't support underline natively, but we can pass this attribute\n", " if (this.__fontUnderline === \"underline\") {\n", " data.decoration = \"underline\";\n", " }\n", " // canvas also doesn't support linking, but we can pass this as well\n", " if (this.__fontHref != null) {\n", " data.href = this.__fontHref;\n", " }\n", " return data;\n", " }\n", " /**\n", " * Helper to link text fragments\n", " */\n", " __wrapTextLink(font, element) {\n", " if (font.href) {\n", " const a = this.__createElement(\"a\");\n", " a.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", font.href);\n", " a.appendChild(element);\n", " return a;\n", " }\n", " return element;\n", " }\n", " /**\n", " * Fills or strokes text\n", " */\n", " __applyText(text, x, y, action) {\n", " const font = this.__parseFont();\n", " const parent = this.__closestGroupOrSvg();\n", " const textElement = this.__createElement(\"text\", {\n", " \"font-family\": font.family,\n", " \"font-size\": font.size,\n", " \"font-style\": font.style,\n", " \"font-weight\": font.weight,\n", " \"text-decoration\": font.decoration,\n", " x,\n", " y,\n", " \"text-anchor\": getTextAnchor(this.textAlign),\n", " \"dominant-baseline\": getDominantBaseline(this.textBaseline),\n", " }, true);\n", " textElement.appendChild(this.__document.createTextNode(text));\n", " this.__currentElement = textElement;\n", " this.__applyStyleToCurrentElement(action);\n", " parent.appendChild(this.__wrapTextLink(font, textElement));\n", " }\n", " /**\n", " * Creates a text element\n", " */\n", " fillText(text, x, y) {\n", " this.__applyText(text, x, y, \"fill\");\n", " }\n", " /**\n", " * Strokes text\n", " */\n", " strokeText(text, x, y) {\n", " this.__applyText(text, x, y, \"stroke\");\n", " }\n", " /**\n", " * No need to implement this for svg.\n", " */\n", " measureText(text) {\n", " this.__ctx.font = this.font;\n", " return this.__ctx.measureText(text);\n", " }\n", " arc(x, y, radius, startAngle, endAngle, counterClockwise = false) {\n", " // in canvas no circle is drawn if no angle is provided.\n", " if (startAngle === endAngle) {\n", " return;\n", " }\n", " startAngle = startAngle % (2 * Math.PI);\n", " endAngle = endAngle % (2 * Math.PI);\n", " if (startAngle === endAngle) {\n", " // circle time! subtract some of the angle so svg is happy (svg elliptical arc can't draw a full circle)\n", " endAngle = ((endAngle + (2 * Math.PI)) - 0.001 * (counterClockwise ? -1 : 1)) % (2 * Math.PI);\n", " }\n", " const endX = x + radius * Math.cos(endAngle);\n", " const endY = y + radius * Math.sin(endAngle);\n", " const startX = x + radius * Math.cos(startAngle);\n", " const startY = y + radius * Math.sin(startAngle);\n", " const sweepFlag = counterClockwise ? 0 : 1;\n", " let largeArcFlag = 0;\n", " let diff = endAngle - startAngle;\n", " // https://github.com/gliffy/canvas2svg/issues/4\n", " if (diff < 0) {\n", " diff += 2 * Math.PI;\n", " }\n", " if (counterClockwise) {\n", " largeArcFlag = diff > Math.PI ? 0 : 1;\n", " }\n", " else {\n", " largeArcFlag = diff > Math.PI ? 1 : 0;\n", " }\n", " this.moveTo(startX, startY);\n", " const rx = radius;\n", " const ry = radius;\n", " const xAxisRotation = 0;\n", " this.__addPathCommand(`A ${rx} ${ry} ${xAxisRotation} ${largeArcFlag} ${sweepFlag} ${endX} ${endY}`);\n", " this.__currentPosition = { x: endX, y: endY };\n", " }\n", " /**\n", " * Generates a ClipPath from the clip command.\n", " */\n", " clip() {\n", " const group = this.__closestGroupOrSvg();\n", " const clipPath = this.__createElement(\"clipPath\");\n", " const id = randomString(this.__ids);\n", " const newGroup = this.__createElement(\"g\");\n", " this.__applyCurrentDefaultPath();\n", " group.removeChild(this.__currentElement);\n", " clipPath.setAttribute(\"id\", id);\n", " clipPath.appendChild(this.__currentElement);\n", " this.__defs.appendChild(clipPath);\n", " // set the clip path to this group\n", " group.setAttribute(\"clip-path\", `url(#${id})`);\n", " // clip paths can be scaled and transformed, we need to add another wrapper group to avoid later transformations\n", " // to this path\n", " group.appendChild(newGroup);\n", " this.__currentElement = newGroup;\n", " }\n", " /**\n", " * Draws a canvas, image or mock context to this canvas.\n", " * Note that all svg dom manipulation uses node.childNodes rather than node.children for IE support.\n", " * http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-context-2d-drawimage\n", " */\n", " drawImage(image, ...args) {\n", " let dx, dy;\n", " let dw, dh;\n", " let sx, sy;\n", " let sw, sh;\n", " if (args.length == 2) {\n", " [dx, dy] = args;\n", " sx = 0;\n", " sy = 0;\n", " sw = image.width;\n", " sh = image.height;\n", " dw = sw;\n", " dh = sh;\n", " }\n", " else if (args.length == 4) {\n", " [dx, dy, dw, dh] = args;\n", " sx = 0;\n", " sy = 0;\n", " sw = image.width;\n", " sh = image.height;\n", " }\n", " else if (args.length === 8) {\n", " [sx, sy, sw, sh, dx, dy, dw, dh] = args;\n", " }\n", " else {\n", " throw new Error(`Inavlid number of arguments passed to drawImage: ${arguments.length}`);\n", " }\n", " // parent, svg, defs, group, currentElement, svgImage, canvas, context, id\n", " const parent = this.__closestGroupOrSvg();\n", " const translateDirective = \"translate(\" + dx + \", \" + dy + \")\";\n", " if (image instanceof SVGRenderingContext2D) {\n", " // In the future we may want to clone nodes instead.\n", " // also I'm currently ignoring dw, dh, sw, sh, sx, sy for a mock context.\n", " const svg = image.getSvg().cloneNode(true);\n", " if (svg.childNodes && svg.childNodes.length > 1) {\n", " const defs = svg_children(svg)[0];\n", " while (defs.childNodes.length) {\n", " const id = svg_children(defs)[0].getAttribute(\"id\");\n", " this.__ids[id] = id;\n", " this.__defs.appendChild(svg_children(defs)[0]);\n", " }\n", " const group = svg_children(svg)[1];\n", " if (group) {\n", " // save original transform\n", " const originTransform = group.getAttribute(\"transform\");\n", " let transformDirective;\n", " if (originTransform) {\n", " transformDirective = originTransform + \" \" + translateDirective;\n", " }\n", " else {\n", " transformDirective = translateDirective;\n", " }\n", " group.setAttribute(\"transform\", transformDirective);\n", " parent.appendChild(group);\n", " }\n", " }\n", " }\n", " else if (image instanceof HTMLImageElement || image instanceof SVGImageElement) {\n", " const svgImage = this.__createElement(\"image\");\n", " svgImage.setAttribute(\"width\", `${dw}`);\n", " svgImage.setAttribute(\"height\", `${dh}`);\n", " svgImage.setAttribute(\"preserveAspectRatio\", \"none\");\n", " if (sx || sy || sw !== image.width || sh !== image.height) {\n", " // crop the image using a temporary canvas\n", " const canvas = this.__document.createElement(\"canvas\");\n", " canvas.width = dw;\n", " canvas.height = dh;\n", " const context = canvas.getContext(\"2d\");\n", " context.drawImage(image, sx, sy, sw, sh, 0, 0, dw, dh);\n", " image = canvas;\n", " }\n", " svgImage.setAttribute(\"transform\", translateDirective);\n", " const url = image instanceof HTMLCanvasElement ? image.toDataURL() : image.getAttribute(\"src\");\n", " svgImage.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", url);\n", " parent.appendChild(svgImage);\n", " }\n", " else if (image instanceof HTMLCanvasElement) {\n", " const svgImage = this.__createElement(\"image\");\n", " svgImage.setAttribute(\"width\", `${dw}`);\n", " svgImage.setAttribute(\"height\", `${dh}`);\n", " svgImage.setAttribute(\"preserveAspectRatio\", \"none\");\n", " // draw canvas onto temporary canvas so that smoothing can be handled\n", " const canvas = this.__document.createElement(\"canvas\");\n", " canvas.width = dw;\n", " canvas.height = dh;\n", " const context = canvas.getContext(\"2d\");\n", " context.imageSmoothingEnabled = false;\n", " //context.mozImageSmoothingEnabled = false\n", " //context.oImageSmoothingEnabled = false\n", " //context.webkitImageSmoothingEnabled = false\n", " context.drawImage(image, sx, sy, sw, sh, 0, 0, dw, dh);\n", " image = canvas;\n", " svgImage.setAttribute(\"transform\", translateDirective);\n", " svgImage.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", image.toDataURL());\n", " parent.appendChild(svgImage);\n", " }\n", " }\n", " /**\n", " * Generates a pattern tag\n", " */\n", " createPattern(image, _repetition) {\n", " const pattern = this.__document.createElementNS(\"http://www.w3.org/2000/svg\", \"pattern\");\n", " const id = randomString(this.__ids);\n", " pattern.setAttribute(\"id\", id);\n", " pattern.setAttribute(\"width\", `${image.width}`);\n", " pattern.setAttribute(\"height\", `${image.height}`);\n", " let img;\n", " if (image instanceof HTMLCanvasElement || image instanceof HTMLImageElement || image instanceof SVGImageElement) {\n", " img = this.__document.createElementNS(\"http://www.w3.org/2000/svg\", \"image\");\n", " img.setAttribute(\"width\", `${image.width}`);\n", " img.setAttribute(\"height\", `${image.height}`);\n", " const url = image instanceof HTMLCanvasElement ? image.toDataURL() : image.getAttribute(\"src\");\n", " img.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", url);\n", " pattern.appendChild(img);\n", " this.__defs.appendChild(pattern);\n", " }\n", " else if (image instanceof SVGRenderingContext2D) {\n", " pattern.appendChild(image.__root.childNodes[1]);\n", " this.__defs.appendChild(pattern);\n", " }\n", " return new CanvasPattern(pattern, this);\n", " }\n", " setLineDash(dashArray) {\n", " if (dashArray && dashArray.length > 0) {\n", " this.lineDash = dashArray.join(\",\");\n", " }\n", " else {\n", " this.lineDash = null;\n", " }\n", " }\n", " }\n", " exports.SVGRenderingContext2D = SVGRenderingContext2D;\n", " SVGRenderingContext2D.__name__ = \"SVGRenderingContext2D\";\n", " },\n", " /* models/canvas/cartesian_frame.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const categorical_scale_1 = require(185) /* ../scales/categorical_scale */;\n", " const continuous_scale_1 = require(121) /* ../scales/continuous_scale */;\n", " const log_scale_1 = require(130) /* ../scales/log_scale */;\n", " const range1d_1 = require(131) /* ../ranges/range1d */;\n", " const data_range1d_1 = require(186) /* ../ranges/data_range1d */;\n", " const factor_range_1 = require(90) /* ../ranges/factor_range */;\n", " const layout_1 = require(188) /* ../../core/layout */;\n", " class CartesianFrame extends layout_1.LayoutItem {\n", " constructor(x_scale, y_scale, x_range, y_range, extra_x_ranges = {}, extra_y_ranges = {}) {\n", " super();\n", " this.x_scale = x_scale;\n", " this.y_scale = y_scale;\n", " this.x_range = x_range;\n", " this.y_range = y_range;\n", " this.extra_x_ranges = extra_x_ranges;\n", " this.extra_y_ranges = extra_y_ranges;\n", " this._configure_scales();\n", " }\n", " map_to_screen(x, y, x_name = \"default\", y_name = \"default\") {\n", " const sx = this.xscales[x_name].v_compute(x);\n", " const sy = this.yscales[y_name].v_compute(y);\n", " return [sx, sy];\n", " }\n", " _get_ranges(range, extra_ranges) {\n", " return Object.assign(Object.assign({}, extra_ranges), { default: range });\n", " }\n", " /*protected*/ _get_scales(scale, ranges, frame_range) {\n", " const scales = {};\n", " for (const name in ranges) {\n", " const range = ranges[name];\n", " if (range instanceof data_range1d_1.DataRange1d || range instanceof range1d_1.Range1d) {\n", " if (!(scale instanceof continuous_scale_1.ContinuousScale))\n", " throw new Error(`Range ${range.type} is incompatible is Scale ${scale.type}`);\n", " }\n", " if (range instanceof factor_range_1.FactorRange) {\n", " if (!(scale instanceof categorical_scale_1.CategoricalScale))\n", " throw new Error(`Range ${range.type} is incompatible is Scale ${scale.type}`);\n", " }\n", " if (scale instanceof log_scale_1.LogScale && range instanceof data_range1d_1.DataRange1d)\n", " range.scale_hint = \"log\";\n", " const s = scale.clone();\n", " s.setv({ source_range: range, target_range: frame_range });\n", " scales[name] = s;\n", " }\n", " return scales;\n", " }\n", " _configure_frame_ranges() {\n", " // data to/from screen space transform (left-bottom <-> left-top origin)\n", " this._h_target = new range1d_1.Range1d({ start: this._left.value, end: this._right.value });\n", " this._v_target = new range1d_1.Range1d({ start: this._bottom.value, end: this._top.value });\n", " }\n", " _configure_scales() {\n", " this._configure_frame_ranges();\n", " this._x_ranges = this._get_ranges(this.x_range, this.extra_x_ranges);\n", " this._y_ranges = this._get_ranges(this.y_range, this.extra_y_ranges);\n", " this._xscales = this._get_scales(this.x_scale, this._x_ranges, this._h_target);\n", " this._yscales = this._get_scales(this.y_scale, this._y_ranges, this._v_target);\n", " }\n", " _update_scales() {\n", " this._configure_frame_ranges();\n", " for (const name in this._xscales) {\n", " const scale = this._xscales[name];\n", " scale.target_range = this._h_target;\n", " }\n", " for (const name in this._yscales) {\n", " const scale = this._yscales[name];\n", " scale.target_range = this._v_target;\n", " }\n", " }\n", " _set_geometry(outer, inner) {\n", " super._set_geometry(outer, inner);\n", " this._update_scales();\n", " }\n", " get x_ranges() {\n", " return this._x_ranges;\n", " }\n", " get y_ranges() {\n", " return this._y_ranges;\n", " }\n", " get xscales() {\n", " return this._xscales;\n", " }\n", " get yscales() {\n", " return this._yscales;\n", " }\n", " }\n", " exports.CartesianFrame = CartesianFrame;\n", " CartesianFrame.__name__ = \"CartesianFrame\";\n", " },\n", " /* models/scales/categorical_scale.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const scale_1 = require(122) /* ./scale */;\n", " class CategoricalScale extends scale_1.Scale {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " compute(x) {\n", " return super._linear_compute(this.source_range.synthetic(x));\n", " }\n", " v_compute(xs) {\n", " return super._linear_v_compute(this.source_range.v_synthetic(xs));\n", " }\n", " invert(xprime) {\n", " return this._linear_invert(xprime);\n", " }\n", " v_invert(xprimes) {\n", " return this._linear_v_invert(xprimes);\n", " }\n", " }\n", " exports.CategoricalScale = CategoricalScale;\n", " CategoricalScale.__name__ = \"CategoricalScale\";\n", " },\n", " /* models/ranges/data_range1d.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const data_range_1 = require(187) /* ./data_range */;\n", " const glyph_renderer_1 = require(81) /* ../renderers/glyph_renderer */;\n", " const logging_1 = require(72) /* ../../core/logging */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const bbox = tslib_1.__importStar(require(88) /* ../../core/util/bbox */);\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " class DataRange1d extends data_range_1.DataRange {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.have_updated_interactively = false;\n", " }\n", " static init_DataRange1d() {\n", " this.define({\n", " start: [p.Number],\n", " end: [p.Number],\n", " range_padding: [p.Number, 0.1],\n", " range_padding_units: [p.PaddingUnits, \"percent\"],\n", " flipped: [p.Boolean, false],\n", " follow: [p.StartEnd],\n", " follow_interval: [p.Number],\n", " default_span: [p.Number, 2],\n", " only_visible: [p.Boolean, false],\n", " });\n", " this.internal({\n", " scale_hint: [p.String, 'auto'],\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " this._initial_start = this.start;\n", " this._initial_end = this.end;\n", " this._initial_range_padding = this.range_padding;\n", " this._initial_range_padding_units = this.range_padding_units;\n", " this._initial_follow = this.follow;\n", " this._initial_follow_interval = this.follow_interval;\n", " this._initial_default_span = this.default_span;\n", " this._plot_bounds = new Map();\n", " }\n", " get min() {\n", " return Math.min(this.start, this.end);\n", " }\n", " get max() {\n", " return Math.max(this.start, this.end);\n", " }\n", " computed_renderers() {\n", " // TODO (bev) check that renderers actually configured with this range\n", " const names = this.names;\n", " let renderers = this.renderers;\n", " if (renderers.length == 0) {\n", " for (const plot of this.plots) {\n", " const rs = plot.renderers.filter((r) => r instanceof glyph_renderer_1.GlyphRenderer);\n", " renderers = renderers.concat(rs);\n", " }\n", " }\n", " if (names.length > 0)\n", " renderers = renderers.filter((r) => array_1.includes(names, r.name));\n", " logging_1.logger.debug(`computed ${renderers.length} renderers for ${this}`);\n", " for (const renderer of renderers) {\n", " logging_1.logger.trace(` - ${renderer}`);\n", " }\n", " return renderers;\n", " }\n", " /*protected*/ _compute_plot_bounds(renderers, bounds) {\n", " let result = bbox.empty();\n", " for (const r of renderers) {\n", " const rect = bounds.get(r);\n", " if (rect != null && (r.visible || !this.only_visible)) {\n", " result = bbox.union(result, rect);\n", " }\n", " }\n", " return result;\n", " }\n", " adjust_bounds_for_aspect(bounds, ratio) {\n", " const result = bbox.empty();\n", " let width = bounds.x1 - bounds.x0;\n", " if (width <= 0) {\n", " width = 1.0;\n", " }\n", " let height = bounds.y1 - bounds.y0;\n", " if (height <= 0) {\n", " height = 1.0;\n", " }\n", " const xcenter = 0.5 * (bounds.x1 + bounds.x0);\n", " const ycenter = 0.5 * (bounds.y1 + bounds.y0);\n", " if (width < ratio * height) {\n", " width = ratio * height;\n", " }\n", " else {\n", " height = width / ratio;\n", " }\n", " result.x1 = xcenter + 0.5 * width;\n", " result.x0 = xcenter - 0.5 * width;\n", " result.y1 = ycenter + 0.5 * height;\n", " result.y0 = ycenter - 0.5 * height;\n", " return result;\n", " }\n", " /*protected*/ _compute_min_max(plot_bounds, dimension) {\n", " let overall = bbox.empty();\n", " for (const rect of plot_bounds) {\n", " overall = bbox.union(overall, rect);\n", " }\n", " let min, max;\n", " if (dimension == 0)\n", " [min, max] = [overall.x0, overall.x1];\n", " else\n", " [min, max] = [overall.y0, overall.y1];\n", " return [min, max];\n", " }\n", " /*protected*/ _compute_range(min, max) {\n", " const range_padding = this.range_padding; // XXX: ? 0\n", " let start, end;\n", " if (this._initial_start != null)\n", " min = this._initial_start;\n", " if (this._initial_end != null)\n", " max = this._initial_end;\n", " if (this.scale_hint == \"log\") {\n", " if (isNaN(min) || !isFinite(min) || min <= 0) {\n", " if (isNaN(max) || !isFinite(max) || max <= 0)\n", " min = 0.1;\n", " else\n", " min = max / 100;\n", " logging_1.logger.warn(`could not determine minimum data value for log axis, DataRange1d using value ${min}`);\n", " }\n", " if (isNaN(max) || !isFinite(max) || max <= 0) {\n", " if (isNaN(min) || !isFinite(min) || min <= 0)\n", " max = 10;\n", " else\n", " max = min * 100;\n", " logging_1.logger.warn(`could not determine maximum data value for log axis, DataRange1d using value ${max}`);\n", " }\n", " let center, span;\n", " if (max == min) {\n", " span = this.default_span + 0.001;\n", " center = Math.log(min) / Math.log(10);\n", " }\n", " else {\n", " let log_min, log_max;\n", " if (this.range_padding_units == \"percent\") {\n", " log_min = Math.log(min) / Math.log(10);\n", " log_max = Math.log(max) / Math.log(10);\n", " span = (log_max - log_min) * (1 + range_padding);\n", " }\n", " else {\n", " log_min = Math.log(min - range_padding) / Math.log(10);\n", " log_max = Math.log(max + range_padding) / Math.log(10);\n", " span = log_max - log_min;\n", " }\n", " center = (log_min + log_max) / 2.0;\n", " }\n", " start = 10 ** (center - span / 2.0);\n", " end = 10 ** (center + span / 2.0);\n", " }\n", " else {\n", " let span;\n", " if (max == min)\n", " span = this.default_span;\n", " else {\n", " if (this.range_padding_units == \"percent\")\n", " span = (max - min) * (1 + range_padding);\n", " else\n", " span = (max - min) + 2 * range_padding;\n", " }\n", " const center = (max + min) / 2.0;\n", " start = center - span / 2.0;\n", " end = center + span / 2.0;\n", " }\n", " let follow_sign = +1;\n", " if (this.flipped) {\n", " [start, end] = [end, start];\n", " follow_sign = -1;\n", " }\n", " const follow_interval = this.follow_interval;\n", " if (follow_interval != null && Math.abs(start - end) > follow_interval) {\n", " if (this.follow == 'start')\n", " end = start + follow_sign * follow_interval;\n", " else if (this.follow == 'end')\n", " start = end - follow_sign * follow_interval;\n", " }\n", " return [start, end];\n", " }\n", " update(bounds, dimension, plot, ratio) {\n", " if (this.have_updated_interactively)\n", " return;\n", " const renderers = this.computed_renderers();\n", " // update the raw data bounds for all renderers we care about\n", " let total_bounds = this._compute_plot_bounds(renderers, bounds);\n", " if (ratio != null)\n", " total_bounds = this.adjust_bounds_for_aspect(total_bounds, ratio);\n", " this._plot_bounds.set(plot, total_bounds);\n", " // compute the min/mix for our specified dimension\n", " const [min, max] = this._compute_min_max(this._plot_bounds.values(), dimension);\n", " // derive start, end from bounds and data range config\n", " let [start, end] = this._compute_range(min, max);\n", " if (this._initial_start != null) {\n", " if (this.scale_hint == \"log\") {\n", " if (this._initial_start > 0)\n", " start = this._initial_start;\n", " }\n", " else\n", " start = this._initial_start;\n", " }\n", " if (this._initial_end != null) {\n", " if (this.scale_hint == \"log\") {\n", " if (this._initial_end > 0)\n", " end = this._initial_end;\n", " }\n", " else\n", " end = this._initial_end;\n", " }\n", " // only trigger updates when there are changes\n", " const [_start, _end] = [this.start, this.end];\n", " if (start != _start || end != _end) {\n", " const new_range = {};\n", " if (start != _start)\n", " new_range.start = start;\n", " if (end != _end)\n", " new_range.end = end;\n", " this.setv(new_range);\n", " }\n", " if (this.bounds == 'auto')\n", " this.setv({ bounds: [start, end] }, { silent: true });\n", " this.change.emit();\n", " }\n", " reset() {\n", " this.have_updated_interactively = false;\n", " // change events silenced as PlotView.update_dataranges triggers property callbacks\n", " this.setv({\n", " range_padding: this._initial_range_padding,\n", " range_padding_units: this._initial_range_padding_units,\n", " follow: this._initial_follow,\n", " follow_interval: this._initial_follow_interval,\n", " default_span: this._initial_default_span,\n", " }, { silent: true });\n", " this.change.emit();\n", " }\n", " }\n", " exports.DataRange1d = DataRange1d;\n", " DataRange1d.__name__ = \"DataRange1d\";\n", " DataRange1d.init_DataRange1d();\n", " },\n", " /* models/ranges/data_range.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const range_1 = require(91) /* ./range */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class DataRange extends range_1.Range {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_DataRange() {\n", " this.define({\n", " names: [p.Array, []],\n", " renderers: [p.Array, []],\n", " });\n", " }\n", " }\n", " exports.DataRange = DataRange;\n", " DataRange.__name__ = \"DataRange\";\n", " DataRange.init_DataRange();\n", " },\n", " /* core/layout/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var types_1 = require(189) /* ./types */;\n", " exports.Sizeable = types_1.Sizeable;\n", " var layoutable_1 = require(190) /* ./layoutable */;\n", " exports.Layoutable = layoutable_1.Layoutable;\n", " exports.LayoutItem = layoutable_1.LayoutItem;\n", " var alignments_1 = require(191) /* ./alignments */;\n", " exports.HStack = alignments_1.HStack;\n", " exports.VStack = alignments_1.VStack;\n", " exports.AnchorLayout = alignments_1.AnchorLayout;\n", " var grid_1 = require(192) /* ./grid */;\n", " exports.Grid = grid_1.Grid;\n", " exports.Row = grid_1.Row;\n", " exports.Column = grid_1.Column;\n", " var html_1 = require(193) /* ./html */;\n", " exports.ContentBox = html_1.ContentBox;\n", " exports.VariadicBox = html_1.VariadicBox;\n", " },\n", " /* core/layout/types.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const { min, max } = Math;\n", " class Sizeable {\n", " constructor(size = {}) {\n", " this.width = size.width != null ? size.width : 0;\n", " this.height = size.height != null ? size.height : 0;\n", " }\n", " bounded_to({ width, height }) {\n", " return new Sizeable({\n", " width: this.width == Infinity && width != null ? width : this.width,\n", " height: this.height == Infinity && height != null ? height : this.height,\n", " });\n", " }\n", " expanded_to({ width, height }) {\n", " return new Sizeable({\n", " width: width != Infinity ? max(this.width, width) : this.width,\n", " height: height != Infinity ? max(this.height, height) : this.height,\n", " });\n", " }\n", " expand_to({ width, height }) {\n", " this.width = max(this.width, width);\n", " this.height = max(this.height, height);\n", " }\n", " narrowed_to({ width, height }) {\n", " return new Sizeable({\n", " width: min(this.width, width),\n", " height: min(this.height, height),\n", " });\n", " }\n", " narrow_to({ width, height }) {\n", " this.width = min(this.width, width);\n", " this.height = min(this.height, height);\n", " }\n", " grow_by({ left, right, top, bottom }) {\n", " const width = this.width + left + right;\n", " const height = this.height + top + bottom;\n", " return new Sizeable({ width, height });\n", " }\n", " shrink_by({ left, right, top, bottom }) {\n", " const width = max(this.width - left - right, 0);\n", " const height = max(this.height - top - bottom, 0);\n", " return new Sizeable({ width, height });\n", " }\n", " map(w_fn, h_fn) {\n", " return new Sizeable({\n", " width: w_fn(this.width),\n", " height: (h_fn != null ? h_fn : w_fn)(this.height),\n", " });\n", " }\n", " }\n", " exports.Sizeable = Sizeable;\n", " Sizeable.__name__ = \"Sizeable\";\n", " },\n", " /* core/layout/layoutable.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const types_1 = require(189) /* ./types */;\n", " const bbox_1 = require(88) /* ../util/bbox */;\n", " const { min, max, round } = Math;\n", " class Layoutable {\n", " constructor() {\n", " this._bbox = new bbox_1.BBox();\n", " this._inner_bbox = new bbox_1.BBox();\n", " const layout = this;\n", " this._top = { get value() { return layout.bbox.top; } };\n", " this._left = { get value() { return layout.bbox.left; } };\n", " this._width = { get value() { return layout.bbox.width; } };\n", " this._height = { get value() { return layout.bbox.height; } };\n", " this._right = { get value() { return layout.bbox.right; } };\n", " this._bottom = { get value() { return layout.bbox.bottom; } };\n", " this._hcenter = { get value() { return layout.bbox.hcenter; } };\n", " this._vcenter = { get value() { return layout.bbox.vcenter; } };\n", " }\n", " get bbox() {\n", " return this._bbox;\n", " }\n", " get inner_bbox() {\n", " return this._inner_bbox;\n", " }\n", " get sizing() {\n", " return this._sizing;\n", " }\n", " set_sizing(sizing) {\n", " const width_policy = sizing.width_policy || \"fit\";\n", " const width = sizing.width;\n", " const min_width = sizing.min_width != null ? sizing.min_width : 0;\n", " const max_width = sizing.max_width != null ? sizing.max_width : Infinity;\n", " const height_policy = sizing.height_policy || \"fit\";\n", " const height = sizing.height;\n", " const min_height = sizing.min_height != null ? sizing.min_height : 0;\n", " const max_height = sizing.max_height != null ? sizing.max_height : Infinity;\n", " const aspect = sizing.aspect;\n", " const margin = sizing.margin || { top: 0, right: 0, bottom: 0, left: 0 };\n", " const visible = sizing.visible !== false;\n", " const halign = sizing.halign || \"start\";\n", " const valign = sizing.valign || \"start\";\n", " this._sizing = {\n", " width_policy, min_width, width, max_width,\n", " height_policy, min_height, height, max_height,\n", " aspect,\n", " margin,\n", " visible,\n", " halign,\n", " valign,\n", " size: { width, height },\n", " min_size: { width: min_width, height: min_height },\n", " max_size: { width: max_width, height: max_height },\n", " };\n", " this._init();\n", " }\n", " _init() { }\n", " _set_geometry(outer, inner) {\n", " this._bbox = outer;\n", " this._inner_bbox = inner;\n", " }\n", " set_geometry(outer, inner) {\n", " this._set_geometry(outer, inner || outer);\n", " }\n", " is_width_expanding() {\n", " return this.sizing.width_policy == \"max\";\n", " }\n", " is_height_expanding() {\n", " return this.sizing.height_policy == \"max\";\n", " }\n", " apply_aspect(viewport, { width, height }) {\n", " const { aspect } = this.sizing;\n", " if (aspect != null) {\n", " const { width_policy, height_policy } = this.sizing;\n", " const gt = (width, height) => {\n", " const policies = { max: 4, fit: 3, min: 2, fixed: 1 };\n", " return policies[width] > policies[height];\n", " };\n", " if (width_policy != \"fixed\" && height_policy != \"fixed\") {\n", " if (width_policy == height_policy) {\n", " const w_width = width;\n", " const w_height = round(width / aspect);\n", " const h_width = round(height * aspect);\n", " const h_height = height;\n", " const w_diff = Math.abs(viewport.width - w_width) + Math.abs(viewport.height - w_height);\n", " const h_diff = Math.abs(viewport.width - h_width) + Math.abs(viewport.height - h_height);\n", " if (w_diff <= h_diff) {\n", " width = w_width;\n", " height = w_height;\n", " }\n", " else {\n", " width = h_width;\n", " height = h_height;\n", " }\n", " }\n", " else if (gt(width_policy, height_policy)) {\n", " height = round(width / aspect);\n", " }\n", " else {\n", " width = round(height * aspect);\n", " }\n", " }\n", " else if (width_policy == \"fixed\") {\n", " height = round(width / aspect);\n", " }\n", " else if (height_policy == \"fixed\") {\n", " width = round(height * aspect);\n", " }\n", " }\n", " return { width, height };\n", " }\n", " measure(viewport_size) {\n", " if (!this.sizing.visible)\n", " return { width: 0, height: 0 };\n", " const exact_width = (width) => {\n", " return this.sizing.width_policy == \"fixed\" && this.sizing.width != null ? this.sizing.width : width;\n", " };\n", " const exact_height = (height) => {\n", " return this.sizing.height_policy == \"fixed\" && this.sizing.height != null ? this.sizing.height : height;\n", " };\n", " const viewport = new types_1.Sizeable(viewport_size)\n", " .shrink_by(this.sizing.margin)\n", " .map(exact_width, exact_height);\n", " const computed = this._measure(viewport);\n", " const clipped = this.clip_size(computed);\n", " const width = exact_width(clipped.width);\n", " const height = exact_height(clipped.height);\n", " const size = this.apply_aspect(viewport, { width, height });\n", " return Object.assign(Object.assign({}, computed), size);\n", " }\n", " compute(viewport = {}) {\n", " const size_hint = this.measure({\n", " width: viewport.width != null && this.is_width_expanding() ? viewport.width : Infinity,\n", " height: viewport.height != null && this.is_height_expanding() ? viewport.height : Infinity,\n", " });\n", " const { width, height } = size_hint;\n", " const outer = new bbox_1.BBox({ left: 0, top: 0, width, height });\n", " let inner = undefined;\n", " if (size_hint.inner != null) {\n", " const { left, top, right, bottom } = size_hint.inner;\n", " inner = new bbox_1.BBox({ left, top, right: width - right, bottom: height - bottom });\n", " }\n", " this.set_geometry(outer, inner);\n", " }\n", " get xview() {\n", " return this.bbox.xview;\n", " }\n", " get yview() {\n", " return this.bbox.yview;\n", " }\n", " clip_width(width) {\n", " return max(this.sizing.min_width, min(width, this.sizing.max_width));\n", " }\n", " clip_height(height) {\n", " return max(this.sizing.min_height, min(height, this.sizing.max_height));\n", " }\n", " clip_size({ width, height }) {\n", " return {\n", " width: this.clip_width(width),\n", " height: this.clip_height(height),\n", " };\n", " }\n", " }\n", " exports.Layoutable = Layoutable;\n", " Layoutable.__name__ = \"Layoutable\";\n", " class LayoutItem extends Layoutable {\n", " /*\n", " constructor(readonly measure_fn: (viewport: Size) => Size) {\n", " super()\n", " }\n", " protected _measure(viewport: Size): SizeHint {\n", " return this.measure_fn(viewport)\n", " }\n", " protected _measure(viewport: Size): SizeHint {\n", " return {\n", " width: viewport.width != Infinity ? viewport.width : this.sizing.min_width,\n", " height: viewport.height != Infinity ? viewport.height : this.sizing.min_width,\n", " }\n", " }\n", " */\n", " _measure(viewport) {\n", " const { width_policy, height_policy } = this.sizing;\n", " let width;\n", " if (viewport.width == Infinity) {\n", " width = this.sizing.width != null ? this.sizing.width : 0;\n", " }\n", " else {\n", " switch (width_policy) {\n", " case \"fixed\": {\n", " width = this.sizing.width != null ? this.sizing.width : 0;\n", " break;\n", " }\n", " case \"min\": {\n", " width = this.sizing.width != null ? min(viewport.width, this.sizing.width) : 0;\n", " break;\n", " }\n", " case \"fit\": {\n", " width = this.sizing.width != null ? min(viewport.width, this.sizing.width) : viewport.width;\n", " break;\n", " }\n", " case \"max\": {\n", " width = this.sizing.width != null ? max(viewport.width, this.sizing.width) : viewport.width;\n", " break;\n", " }\n", " }\n", " }\n", " let height;\n", " if (viewport.height == Infinity) {\n", " height = this.sizing.height != null ? this.sizing.height : 0;\n", " }\n", " else {\n", " switch (height_policy) {\n", " case \"fixed\": {\n", " height = this.sizing.height != null ? this.sizing.height : 0;\n", " break;\n", " }\n", " case \"min\": {\n", " height = this.sizing.height != null ? min(viewport.height, this.sizing.height) : 0;\n", " break;\n", " }\n", " case \"fit\": {\n", " height = this.sizing.height != null ? min(viewport.height, this.sizing.height) : viewport.height;\n", " break;\n", " }\n", " case \"max\": {\n", " height = this.sizing.height != null ? max(viewport.height, this.sizing.height) : viewport.height;\n", " break;\n", " }\n", " }\n", " }\n", " return { width, height };\n", " }\n", " }\n", " exports.LayoutItem = LayoutItem;\n", " LayoutItem.__name__ = \"LayoutItem\";\n", " class ContentLayoutable extends Layoutable {\n", " _measure(viewport) {\n", " const content_size = this._content_size();\n", " const bounds = viewport\n", " .bounded_to(this.sizing.size)\n", " .bounded_to(content_size);\n", " const width = (() => {\n", " switch (this.sizing.width_policy) {\n", " case \"fixed\":\n", " return this.sizing.width != null ? this.sizing.width : content_size.width;\n", " case \"min\":\n", " return content_size.width;\n", " case \"fit\":\n", " return bounds.width;\n", " case \"max\":\n", " return Math.max(content_size.width, bounds.width);\n", " }\n", " })();\n", " const height = (() => {\n", " switch (this.sizing.height_policy) {\n", " case \"fixed\":\n", " return this.sizing.height != null ? this.sizing.height : content_size.height;\n", " case \"min\":\n", " return content_size.height;\n", " case \"fit\":\n", " return bounds.height;\n", " case \"max\":\n", " return Math.max(content_size.height, bounds.height);\n", " }\n", " })();\n", " return { width, height };\n", " }\n", " }\n", " exports.ContentLayoutable = ContentLayoutable;\n", " ContentLayoutable.__name__ = \"ContentLayoutable\";\n", " },\n", " /* core/layout/alignments.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const layoutable_1 = require(190) /* ./layoutable */;\n", " const bbox_1 = require(88) /* ../util/bbox */;\n", " class Stack extends layoutable_1.Layoutable {\n", " constructor() {\n", " super(...arguments);\n", " this.children = [];\n", " }\n", " }\n", " exports.Stack = Stack;\n", " Stack.__name__ = \"Stack\";\n", " class HStack extends Stack {\n", " _measure(_viewport) {\n", " let width = 0;\n", " let height = 0;\n", " for (const child of this.children) {\n", " const size_hint = child.measure({ width: 0, height: 0 });\n", " width += size_hint.width;\n", " height = Math.max(height, size_hint.height);\n", " }\n", " return { width, height };\n", " }\n", " _set_geometry(outer, inner) {\n", " super._set_geometry(outer, inner);\n", " const { top, bottom } = outer;\n", " let { left } = outer;\n", " for (const child of this.children) {\n", " const { width } = child.measure({ width: 0, height: 0 });\n", " child.set_geometry(new bbox_1.BBox({ left, width, top, bottom }));\n", " left += width;\n", " }\n", " }\n", " }\n", " exports.HStack = HStack;\n", " HStack.__name__ = \"HStack\";\n", " class VStack extends Stack {\n", " _measure(_viewport) {\n", " let width = 0;\n", " let height = 0;\n", " for (const child of this.children) {\n", " const size_hint = child.measure({ width: 0, height: 0 });\n", " width = Math.max(width, size_hint.width);\n", " height += size_hint.height;\n", " }\n", " return { width, height };\n", " }\n", " _set_geometry(outer, inner) {\n", " super._set_geometry(outer, inner);\n", " const { left, right } = outer;\n", " let { top } = outer;\n", " for (const child of this.children) {\n", " const { height } = child.measure({ width: 0, height: 0 });\n", " child.set_geometry(new bbox_1.BBox({ top, height, left, right }));\n", " top += height;\n", " }\n", " }\n", " }\n", " exports.VStack = VStack;\n", " VStack.__name__ = \"VStack\";\n", " class AnchorLayout extends layoutable_1.Layoutable {\n", " constructor() {\n", " super(...arguments);\n", " this.children = [];\n", " }\n", " _measure(viewport) {\n", " let width = 0;\n", " let height = 0;\n", " for (const { layout } of this.children) {\n", " const size_hint = layout.measure(viewport);\n", " width = Math.max(width, size_hint.width);\n", " height = Math.max(height, size_hint.height);\n", " }\n", " return { width, height };\n", " }\n", " _set_geometry(outer, inner) {\n", " super._set_geometry(outer, inner);\n", " for (const { layout, anchor, margin } of this.children) {\n", " const { left, right, top, bottom, hcenter, vcenter } = outer;\n", " const { width, height } = layout.measure(outer);\n", " let bbox;\n", " switch (anchor) {\n", " case 'top_left':\n", " bbox = new bbox_1.BBox({ left: left + margin, top: top + margin, width, height });\n", " break;\n", " case 'top_center':\n", " bbox = new bbox_1.BBox({ hcenter, top: top + margin, width, height });\n", " break;\n", " case 'top_right':\n", " bbox = new bbox_1.BBox({ right: right - margin, top: top + margin, width, height });\n", " break;\n", " case 'bottom_right':\n", " bbox = new bbox_1.BBox({ right: right - margin, bottom: bottom - margin, width, height });\n", " break;\n", " case 'bottom_center':\n", " bbox = new bbox_1.BBox({ hcenter, bottom: bottom - margin, width, height });\n", " break;\n", " case 'bottom_left':\n", " bbox = new bbox_1.BBox({ left: left + margin, bottom: bottom - margin, width, height });\n", " break;\n", " case 'center_left':\n", " bbox = new bbox_1.BBox({ left: left + margin, vcenter, width, height });\n", " break;\n", " case 'center':\n", " bbox = new bbox_1.BBox({ hcenter, vcenter, width, height });\n", " break;\n", " case 'center_right':\n", " bbox = new bbox_1.BBox({ right: right - margin, vcenter, width, height });\n", " break;\n", " }\n", " layout.set_geometry(bbox);\n", " }\n", " }\n", " }\n", " exports.AnchorLayout = AnchorLayout;\n", " AnchorLayout.__name__ = \"AnchorLayout\";\n", " },\n", " /* core/layout/grid.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const types_1 = require(189) /* ./types */;\n", " const layoutable_1 = require(190) /* ./layoutable */;\n", " const types_2 = require(8) /* ../util/types */;\n", " const bbox_1 = require(88) /* ../util/bbox */;\n", " const array_1 = require(9) /* ../util/array */;\n", " const { max, round } = Math;\n", " class DefaultMap {\n", " constructor(def) {\n", " this.def = def;\n", " this._map = new Map();\n", " }\n", " get(key) {\n", " let value = this._map.get(key);\n", " if (value === undefined) {\n", " value = this.def();\n", " this._map.set(key, value);\n", " }\n", " return value;\n", " }\n", " apply(key, fn) {\n", " const value = this.get(key);\n", " this._map.set(key, fn(value));\n", " }\n", " }\n", " DefaultMap.__name__ = \"DefaultMap\";\n", " class Container {\n", " constructor() {\n", " this._items = [];\n", " this._nrows = 0;\n", " this._ncols = 0;\n", " }\n", " get nrows() {\n", " return this._nrows;\n", " }\n", " get ncols() {\n", " return this._ncols;\n", " }\n", " add(span, data) {\n", " const { r1, c1 } = span;\n", " this._nrows = max(this._nrows, r1 + 1);\n", " this._ncols = max(this._ncols, c1 + 1);\n", " this._items.push({ span, data });\n", " }\n", " at(r, c) {\n", " const selected = this._items.filter(({ span }) => {\n", " return span.r0 <= r && r <= span.r1 &&\n", " span.c0 <= c && c <= span.c1;\n", " });\n", " return selected.map(({ data }) => data);\n", " }\n", " row(r) {\n", " const selected = this._items.filter(({ span }) => span.r0 <= r && r <= span.r1);\n", " return selected.map(({ data }) => data);\n", " }\n", " col(c) {\n", " const selected = this._items.filter(({ span }) => span.c0 <= c && c <= span.c1);\n", " return selected.map(({ data }) => data);\n", " }\n", " foreach(fn) {\n", " for (const { span, data } of this._items) {\n", " fn(span, data);\n", " }\n", " }\n", " map(fn) {\n", " const result = new Container();\n", " for (const { span, data } of this._items) {\n", " result.add(span, fn(span, data));\n", " }\n", " return result;\n", " }\n", " }\n", " Container.__name__ = \"Container\";\n", " class Grid extends layoutable_1.Layoutable {\n", " constructor(items = []) {\n", " super();\n", " this.items = items;\n", " this.rows = \"auto\";\n", " this.cols = \"auto\";\n", " this.spacing = 0;\n", " this.absolute = false;\n", " }\n", " is_width_expanding() {\n", " if (super.is_width_expanding())\n", " return true;\n", " if (this.sizing.width_policy == \"fixed\")\n", " return false;\n", " const { cols } = this._state;\n", " return array_1.some(cols, (col) => col.policy == \"max\");\n", " }\n", " is_height_expanding() {\n", " if (super.is_height_expanding())\n", " return true;\n", " if (this.sizing.height_policy == \"fixed\")\n", " return false;\n", " const { rows } = this._state;\n", " return array_1.some(rows, (row) => row.policy == \"max\");\n", " }\n", " _init() {\n", " super._init();\n", " const items = new Container();\n", " for (const { layout, row, col, row_span, col_span } of this.items) {\n", " if (layout.sizing.visible) {\n", " const r0 = row;\n", " const c0 = col;\n", " const r1 = row + (row_span != null ? row_span : 1) - 1;\n", " const c1 = col + (col_span != null ? col_span : 1) - 1;\n", " items.add({ r0, c0, r1, c1 }, layout);\n", " }\n", " }\n", " const { nrows, ncols } = items;\n", " const rows = new Array(nrows);\n", " for (let y = 0; y < nrows; y++) {\n", " const row = (() => {\n", " const sizing = types_2.isPlainObject(this.rows) ? this.rows[y] || this.rows[\"*\"] : this.rows;\n", " if (sizing == null)\n", " return { policy: \"auto\" };\n", " else if (types_2.isNumber(sizing))\n", " return { policy: \"fixed\", height: sizing };\n", " else if (types_2.isString(sizing))\n", " return { policy: sizing };\n", " else\n", " return sizing;\n", " })();\n", " const align = row.align || \"auto\";\n", " if (row.policy == \"fixed\")\n", " rows[y] = { policy: \"fixed\", height: row.height, align };\n", " else if (row.policy == \"min\")\n", " rows[y] = { policy: \"min\", align };\n", " else if (row.policy == \"fit\" || row.policy == \"max\")\n", " rows[y] = { policy: row.policy, flex: row.flex || 1, align };\n", " else if (row.policy == \"auto\") {\n", " if (array_1.some(items.row(y), (layout) => layout.is_height_expanding()))\n", " rows[y] = { policy: \"max\", flex: 1, align };\n", " else\n", " rows[y] = { policy: \"min\", align };\n", " }\n", " else\n", " throw new Error(\"unrechable\");\n", " }\n", " const cols = new Array(ncols);\n", " for (let x = 0; x < ncols; x++) {\n", " const col = (() => {\n", " const sizing = types_2.isPlainObject(this.cols) ? this.cols[x] || this.cols[\"*\"] : this.cols;\n", " if (sizing == null)\n", " return { policy: \"auto\" };\n", " else if (types_2.isNumber(sizing))\n", " return { policy: \"fixed\", width: sizing };\n", " else if (types_2.isString(sizing))\n", " return { policy: sizing };\n", " else\n", " return sizing;\n", " })();\n", " const align = col.align || \"auto\";\n", " if (col.policy == \"fixed\")\n", " cols[x] = { policy: \"fixed\", width: col.width, align };\n", " else if (col.policy == \"min\")\n", " cols[x] = { policy: \"min\", align };\n", " else if (col.policy == \"fit\" || col.policy == \"max\")\n", " cols[x] = { policy: col.policy, flex: col.flex || 1, align };\n", " else if (col.policy == \"auto\") {\n", " if (array_1.some(items.col(x), (layout) => layout.is_width_expanding()))\n", " cols[x] = { policy: \"max\", flex: 1, align };\n", " else\n", " cols[x] = { policy: \"min\", align };\n", " }\n", " else\n", " throw new Error(\"unrechable\");\n", " }\n", " const [rspacing, cspacing] = types_2.isNumber(this.spacing) ? [this.spacing, this.spacing] : this.spacing;\n", " this._state = { items, nrows, ncols, rows, cols, rspacing, cspacing };\n", " }\n", " _measure_totals(row_heights, col_widths) {\n", " const { nrows, ncols, rspacing, cspacing } = this._state;\n", " return {\n", " height: array_1.sum(row_heights) + (nrows - 1) * rspacing,\n", " width: array_1.sum(col_widths) + (ncols - 1) * cspacing,\n", " };\n", " }\n", " _measure_cells(cell_viewport) {\n", " const { items, nrows, ncols, rows, cols, rspacing, cspacing } = this._state;\n", " const row_heights = new Array(nrows);\n", " for (let r = 0; r < nrows; r++) {\n", " const row = rows[r];\n", " row_heights[r] = row.policy == \"fixed\" ? row.height : 0;\n", " }\n", " const col_widths = new Array(ncols);\n", " for (let c = 0; c < ncols; c++) {\n", " const col = cols[c];\n", " col_widths[c] = col.policy == \"fixed\" ? col.width : 0;\n", " }\n", " const size_hints = new Container();\n", " items.foreach((span, layout) => {\n", " const { r0, c0, r1, c1 } = span;\n", " const rspace = (r1 - r0) * rspacing;\n", " const cspace = (c1 - c0) * cspacing;\n", " let height = 0;\n", " for (let r = r0; r <= r1; r++) {\n", " height += cell_viewport(r, c0).height;\n", " }\n", " height += rspace;\n", " let width = 0;\n", " for (let c = c0; c <= c1; c++) {\n", " width += cell_viewport(r0, c).width;\n", " }\n", " width += cspace;\n", " const size_hint = layout.measure({ width, height });\n", " size_hints.add(span, { layout, size_hint });\n", " const size = new types_1.Sizeable(size_hint).grow_by(layout.sizing.margin);\n", " size.height -= rspace;\n", " size.width -= cspace;\n", " const radjustable = [];\n", " for (let r = r0; r <= r1; r++) {\n", " const row = rows[r];\n", " if (row.policy == \"fixed\")\n", " size.height -= row.height;\n", " else\n", " radjustable.push(r);\n", " }\n", " if (size.height > 0) {\n", " const rheight = round(size.height / radjustable.length);\n", " for (const r of radjustable) {\n", " row_heights[r] = max(row_heights[r], rheight);\n", " }\n", " }\n", " const cadjustable = [];\n", " for (let c = c0; c <= c1; c++) {\n", " const col = cols[c];\n", " if (col.policy == \"fixed\")\n", " size.width -= col.width;\n", " else\n", " cadjustable.push(c);\n", " }\n", " if (size.width > 0) {\n", " const cwidth = round(size.width / cadjustable.length);\n", " for (const c of cadjustable) {\n", " col_widths[c] = max(col_widths[c], cwidth);\n", " }\n", " }\n", " });\n", " const size = this._measure_totals(row_heights, col_widths);\n", " return { size, row_heights, col_widths, size_hints };\n", " }\n", " _measure_grid(viewport) {\n", " const { nrows, ncols, rows, cols, rspacing, cspacing } = this._state;\n", " const preferred = this._measure_cells((y, x) => {\n", " const row = rows[y];\n", " const col = cols[x];\n", " return {\n", " width: col.policy == \"fixed\" ? col.width : Infinity,\n", " height: row.policy == \"fixed\" ? row.height : Infinity,\n", " };\n", " });\n", " let available_height;\n", " if (this.sizing.height_policy == \"fixed\" && this.sizing.height != null)\n", " available_height = this.sizing.height;\n", " else if (viewport.height != Infinity && this.is_height_expanding())\n", " available_height = viewport.height;\n", " else\n", " available_height = preferred.size.height;\n", " let height_flex = 0;\n", " for (let y = 0; y < nrows; y++) {\n", " const row = rows[y];\n", " if (row.policy == \"fit\" || row.policy == \"max\")\n", " height_flex += row.flex;\n", " else\n", " available_height -= preferred.row_heights[y];\n", " }\n", " available_height -= (nrows - 1) * rspacing;\n", " if (height_flex != 0 && available_height > 0) {\n", " for (let y = 0; y < nrows; y++) {\n", " const row = rows[y];\n", " if (row.policy == \"fit\" || row.policy == \"max\") {\n", " const height = round(available_height * (row.flex / height_flex));\n", " available_height -= height;\n", " preferred.row_heights[y] = height;\n", " height_flex -= row.flex;\n", " }\n", " }\n", " }\n", " else if (available_height < 0) {\n", " let nadjustable = 0;\n", " for (let y = 0; y < nrows; y++) {\n", " const row = rows[y];\n", " if (row.policy != \"fixed\")\n", " nadjustable++;\n", " }\n", " let overflow_height = -available_height;\n", " for (let y = 0; y < nrows; y++) {\n", " const row = rows[y];\n", " if (row.policy != \"fixed\") {\n", " const height = preferred.row_heights[y];\n", " const cutoff = round(overflow_height / nadjustable);\n", " preferred.row_heights[y] = max(height - cutoff, 0);\n", " overflow_height -= cutoff > height ? height : cutoff;\n", " nadjustable--;\n", " }\n", " }\n", " }\n", " let available_width;\n", " if (this.sizing.width_policy == \"fixed\" && this.sizing.width != null)\n", " available_width = this.sizing.width;\n", " else if (viewport.width != Infinity && this.is_width_expanding())\n", " available_width = viewport.width;\n", " else\n", " available_width = preferred.size.width;\n", " let width_flex = 0;\n", " for (let x = 0; x < ncols; x++) {\n", " const col = cols[x];\n", " if (col.policy == \"fit\" || col.policy == \"max\")\n", " width_flex += col.flex;\n", " else\n", " available_width -= preferred.col_widths[x];\n", " }\n", " available_width -= (ncols - 1) * cspacing;\n", " if (width_flex != 0 && available_width > 0) {\n", " for (let x = 0; x < ncols; x++) {\n", " const col = cols[x];\n", " if (col.policy == \"fit\" || col.policy == \"max\") {\n", " const width = round(available_width * (col.flex / width_flex));\n", " available_width -= width;\n", " preferred.col_widths[x] = width;\n", " width_flex -= col.flex;\n", " }\n", " }\n", " }\n", " else if (available_width < 0) {\n", " let nadjustable = 0;\n", " for (let x = 0; x < ncols; x++) {\n", " const col = cols[x];\n", " if (col.policy != \"fixed\")\n", " nadjustable++;\n", " }\n", " let overflow_width = -available_width;\n", " for (let x = 0; x < ncols; x++) {\n", " const col = cols[x];\n", " if (col.policy != \"fixed\") {\n", " const width = preferred.col_widths[x];\n", " const cutoff = round(overflow_width / nadjustable);\n", " preferred.col_widths[x] = max(width - cutoff, 0);\n", " overflow_width -= cutoff > width ? width : cutoff;\n", " nadjustable--;\n", " }\n", " }\n", " }\n", " const { row_heights, col_widths, size_hints } = this._measure_cells((y, x) => {\n", " return {\n", " width: preferred.col_widths[x],\n", " height: preferred.row_heights[y],\n", " };\n", " });\n", " const size = this._measure_totals(row_heights, col_widths);\n", " return { size, row_heights, col_widths, size_hints };\n", " }\n", " _measure(viewport) {\n", " const { size } = this._measure_grid(viewport);\n", " return size;\n", " }\n", " _set_geometry(outer, inner) {\n", " super._set_geometry(outer, inner);\n", " const { nrows, ncols, rspacing, cspacing } = this._state;\n", " const { row_heights, col_widths, size_hints } = this._measure_grid(outer);\n", " const rows = this._state.rows.map((row, r) => {\n", " return Object.assign(Object.assign({}, row), { top: 0, height: row_heights[r], get bottom() { return this.top + this.height; } });\n", " });\n", " const cols = this._state.cols.map((col, c) => {\n", " return Object.assign(Object.assign({}, col), { left: 0, width: col_widths[c], get right() { return this.left + this.width; } });\n", " });\n", " const items = size_hints.map((_, item) => {\n", " return Object.assign(Object.assign({}, item), { outer: new bbox_1.BBox(), inner: new bbox_1.BBox() });\n", " });\n", " for (let r = 0, top = !this.absolute ? 0 : outer.top; r < nrows; r++) {\n", " const row = rows[r];\n", " row.top = top;\n", " top += row.height + rspacing;\n", " }\n", " for (let c = 0, left = !this.absolute ? 0 : outer.left; c < ncols; c++) {\n", " const col = cols[c];\n", " col.left = left;\n", " left += col.width + cspacing;\n", " }\n", " function span_width(c0, c1) {\n", " let width = (c1 - c0) * cspacing;\n", " for (let c = c0; c <= c1; c++) {\n", " width += cols[c].width;\n", " }\n", " return width;\n", " }\n", " function span_height(r0, r1) {\n", " let height = (r1 - r0) * rspacing;\n", " for (let r = r0; r <= r1; r++) {\n", " height += rows[r].height;\n", " }\n", " return height;\n", " }\n", " items.foreach(({ r0, c0, r1, c1 }, item) => {\n", " const { layout, size_hint } = item;\n", " const { sizing } = layout;\n", " const { width, height } = size_hint;\n", " const span = {\n", " width: span_width(c0, c1),\n", " height: span_height(r0, r1),\n", " };\n", " const halign = c0 == c1 && cols[c0].align != \"auto\" ? cols[c0].align : sizing.halign;\n", " const valign = r0 == r1 && rows[r0].align != \"auto\" ? rows[r0].align : sizing.valign;\n", " let left = cols[c0].left;\n", " if (halign == \"start\")\n", " left += sizing.margin.left;\n", " else if (halign == \"center\")\n", " left += round((span.width - width) / 2);\n", " else if (halign == \"end\")\n", " left += span.width - sizing.margin.right - width;\n", " let top = rows[r0].top;\n", " if (valign == \"start\")\n", " top += sizing.margin.top;\n", " else if (valign == \"center\")\n", " top += round((span.height - height) / 2);\n", " else if (valign == \"end\")\n", " top += span.height - sizing.margin.bottom - height;\n", " item.outer = new bbox_1.BBox({ left, top, width, height });\n", " });\n", " const row_aligns = rows.map(() => {\n", " return {\n", " start: new DefaultMap(() => 0),\n", " end: new DefaultMap(() => 0),\n", " };\n", " });\n", " const col_aligns = cols.map(() => {\n", " return {\n", " start: new DefaultMap(() => 0),\n", " end: new DefaultMap(() => 0),\n", " };\n", " });\n", " items.foreach(({ r0, c0, r1, c1 }, { size_hint, outer }) => {\n", " const { inner } = size_hint;\n", " if (inner != null) {\n", " row_aligns[r0].start.apply(outer.top, (v) => max(v, inner.top));\n", " row_aligns[r1].end.apply(rows[r1].bottom - outer.bottom, (v) => max(v, inner.bottom));\n", " col_aligns[c0].start.apply(outer.left, (v) => max(v, inner.left));\n", " col_aligns[c1].end.apply(cols[c1].right - outer.right, (v) => max(v, inner.right));\n", " }\n", " });\n", " items.foreach(({ r0, c0, r1, c1 }, item) => {\n", " const { size_hint, outer } = item;\n", " function inner_bbox({ left, right, top, bottom }) {\n", " const width = outer.width - left - right;\n", " const height = outer.height - top - bottom;\n", " return new bbox_1.BBox({ left, top, width, height });\n", " }\n", " if (size_hint.inner != null) {\n", " let inner = inner_bbox(size_hint.inner);\n", " if (size_hint.align !== false) {\n", " const top = row_aligns[r0].start.get(outer.top);\n", " const bottom = row_aligns[r1].end.get(rows[r1].bottom - outer.bottom);\n", " const left = col_aligns[c0].start.get(outer.left);\n", " const right = col_aligns[c1].end.get(cols[c1].right - outer.right);\n", " try {\n", " inner = inner_bbox({ top, bottom, left, right });\n", " }\n", " catch (_a) { }\n", " }\n", " item.inner = inner;\n", " }\n", " else\n", " item.inner = outer;\n", " });\n", " items.foreach((_, { layout, outer, inner }) => {\n", " layout.set_geometry(outer, inner);\n", " });\n", " }\n", " }\n", " exports.Grid = Grid;\n", " Grid.__name__ = \"Grid\";\n", " class Row extends Grid {\n", " constructor(items) {\n", " super();\n", " this.items = items.map((item, i) => ({ layout: item, row: 0, col: i }));\n", " this.rows = \"fit\";\n", " }\n", " }\n", " exports.Row = Row;\n", " Row.__name__ = \"Row\";\n", " class Column extends Grid {\n", " constructor(items) {\n", " super();\n", " this.items = items.map((item, i) => ({ layout: item, row: i, col: 0 }));\n", " this.cols = \"fit\";\n", " }\n", " }\n", " exports.Column = Column;\n", " Column.__name__ = \"Column\";\n", " },\n", " /* core/layout/html.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const layoutable_1 = require(190) /* ./layoutable */;\n", " const types_1 = require(189) /* ./types */;\n", " const dom_1 = require(68) /* ../dom */;\n", " class ContentBox extends layoutable_1.ContentLayoutable {\n", " constructor(el) {\n", " super();\n", " this.content_size = dom_1.unsized(el, () => new types_1.Sizeable(dom_1.size(el)));\n", " }\n", " _content_size() {\n", " return this.content_size;\n", " }\n", " }\n", " exports.ContentBox = ContentBox;\n", " ContentBox.__name__ = \"ContentBox\";\n", " class VariadicBox extends layoutable_1.Layoutable {\n", " constructor(el) {\n", " super();\n", " this.el = el;\n", " }\n", " _measure(viewport) {\n", " const bounded = new types_1.Sizeable(viewport).bounded_to(this.sizing.size);\n", " return dom_1.sized(this.el, bounded, () => {\n", " const content = new types_1.Sizeable(dom_1.content_size(this.el));\n", " const { border, padding } = dom_1.extents(this.el);\n", " return content.grow_by(border).grow_by(padding).map(Math.ceil);\n", " });\n", " }\n", " }\n", " exports.VariadicBox = VariadicBox;\n", " VariadicBox.__name__ = \"VariadicBox\";\n", " class CachedVariadicBox extends VariadicBox {\n", " constructor(el) {\n", " super(el);\n", " this._cache = new Map();\n", " }\n", " _measure(viewport) {\n", " const { width, height } = viewport;\n", " const key = `${width},${height}`;\n", " let size_hint = this._cache.get(key);\n", " if (size_hint == null) {\n", " size_hint = super._measure(viewport);\n", " this._cache.set(key, size_hint);\n", " }\n", " return size_hint;\n", " }\n", " invalidate_cache() {\n", " this._cache.clear();\n", " }\n", " }\n", " exports.CachedVariadicBox = CachedVariadicBox;\n", " CachedVariadicBox.__name__ = \"CachedVariadicBox\";\n", " },\n", " /* models/expressions/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var expression_1 = require(195) /* ./expression */;\n", " exports.Expression = expression_1.Expression;\n", " var stack_1 = require(196) /* ./stack */;\n", " exports.Stack = stack_1.Stack;\n", " var cumsum_1 = require(197) /* ./cumsum */;\n", " exports.CumSum = cumsum_1.CumSum;\n", " },\n", " /* models/expressions/expression.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const model_1 = require(71) /* ../../model */;\n", " class Expression extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " initialize() {\n", " super.initialize();\n", " this._connected = new Set();\n", " this._result = new Map();\n", " }\n", " v_compute(source) {\n", " if (!this._connected.has(source)) {\n", " this.connect(source.change, () => this._result.delete(source));\n", " this.connect(source.patching, () => this._result.delete(source));\n", " this.connect(source.streaming, () => this._result.delete(source));\n", " this._connected.add(source);\n", " }\n", " let result = this._result.get(source);\n", " if (result == null) {\n", " result = this._v_compute(source);\n", " this._result.set(source, result);\n", " }\n", " return result;\n", " }\n", " }\n", " exports.Expression = Expression;\n", " Expression.__name__ = \"Expression\";\n", " },\n", " /* models/expressions/stack.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const expression_1 = require(195) /* ./expression */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class Stack extends expression_1.Expression {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Stack() {\n", " this.define({\n", " fields: [p.Array, []],\n", " });\n", " }\n", " _v_compute(source) {\n", " var _a;\n", " const n = (_a = source.get_length()) !== null && _a !== void 0 ? _a : 0;\n", " const result = new Float64Array(n);\n", " for (const f of this.fields) {\n", " const column = source.data[f];\n", " if (column != null) {\n", " for (let i = 0, k = Math.min(n, column.length); i < k; i++) {\n", " result[i] += column[i];\n", " }\n", " }\n", " }\n", " return result;\n", " }\n", " }\n", " exports.Stack = Stack;\n", " Stack.__name__ = \"Stack\";\n", " Stack.init_Stack();\n", " },\n", " /* models/expressions/cumsum.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const expression_1 = require(195) /* ./expression */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class CumSum extends expression_1.Expression {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_CumSum() {\n", " this.define({\n", " field: [p.String],\n", " include_zero: [p.Boolean, false],\n", " });\n", " }\n", " _v_compute(source) {\n", " const result = new Float64Array(source.get_length() || 0);\n", " const col = source.data[this.field];\n", " const offset = this.include_zero ? 1 : 0;\n", " result[0] = this.include_zero ? 0 : col[0];\n", " for (let i = 1; i < result.length; i++) {\n", " result[i] = result[i - 1] + col[i - offset];\n", " }\n", " return result;\n", " }\n", " }\n", " exports.CumSum = CumSum;\n", " CumSum.__name__ = \"CumSum\";\n", " CumSum.init_CumSum();\n", " },\n", " /* models/filters/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var boolean_filter_1 = require(199) /* ./boolean_filter */;\n", " exports.BooleanFilter = boolean_filter_1.BooleanFilter;\n", " var customjs_filter_1 = require(201) /* ./customjs_filter */;\n", " exports.CustomJSFilter = customjs_filter_1.CustomJSFilter;\n", " var filter_1 = require(200) /* ./filter */;\n", " exports.Filter = filter_1.Filter;\n", " var group_filter_1 = require(202) /* ./group_filter */;\n", " exports.GroupFilter = group_filter_1.GroupFilter;\n", " var index_filter_1 = require(203) /* ./index_filter */;\n", " exports.IndexFilter = index_filter_1.IndexFilter;\n", " },\n", " /* models/filters/boolean_filter.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const filter_1 = require(200) /* ./filter */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const logging_1 = require(72) /* ../../core/logging */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " class BooleanFilter extends filter_1.Filter {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_BooleanFilter() {\n", " this.define({\n", " booleans: [p.Array, null],\n", " });\n", " }\n", " compute_indices(source) {\n", " const booleans = this.booleans;\n", " if (booleans != null && booleans.length > 0) {\n", " if (array_1.every(booleans, types_1.isBoolean)) {\n", " if (booleans.length !== source.get_length()) {\n", " logging_1.logger.warn(`${this}: length of booleans doesn't match data source`);\n", " }\n", " return array_1.range(0, booleans.length).filter((i) => booleans[i] === true);\n", " }\n", " else {\n", " logging_1.logger.warn(`${this}: booleans should be array of booleans, defaulting to no filtering`);\n", " return null;\n", " }\n", " }\n", " else {\n", " if (booleans != null && booleans.length == 0)\n", " logging_1.logger.warn(`${this}: booleans is empty, defaulting to no filtering`);\n", " else\n", " logging_1.logger.warn(`${this}: booleans was not set, defaulting to no filtering`);\n", " return null;\n", " }\n", " }\n", " }\n", " exports.BooleanFilter = BooleanFilter;\n", " BooleanFilter.__name__ = \"BooleanFilter\";\n", " BooleanFilter.init_BooleanFilter();\n", " },\n", " /* models/filters/filter.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const model_1 = require(71) /* ../../model */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const logging_1 = require(72) /* ../../core/logging */;\n", " class Filter extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Filter() {\n", " this.define({\n", " filter: [p.Array, null],\n", " });\n", " }\n", " compute_indices(_source) {\n", " const filter = this.filter;\n", " if (filter != null) {\n", " if (types_1.isArrayOf(filter, types_1.isBoolean)) {\n", " return array_1.range(0, filter.length).filter((i) => filter[i] === true);\n", " }\n", " if (types_1.isArrayOf(filter, types_1.isInteger)) {\n", " return filter;\n", " }\n", " logging_1.logger.warn(`${this}: filter should either be array of only booleans or only integers, defaulting to no filtering`);\n", " return null;\n", " }\n", " else {\n", " logging_1.logger.warn(`${this}: filter was not set to be an array, defaulting to no filtering`);\n", " return null;\n", " }\n", " }\n", " }\n", " exports.Filter = Filter;\n", " Filter.__name__ = \"Filter\";\n", " Filter.init_Filter();\n", " },\n", " /* models/filters/customjs_filter.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const filter_1 = require(200) /* ./filter */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const object_1 = require(17) /* ../../core/util/object */;\n", " const string_1 = require(24) /* ../../core/util/string */;\n", " class CustomJSFilter extends filter_1.Filter {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_CustomJSFilter() {\n", " this.define({\n", " args: [p.Any, {}],\n", " code: [p.String, ''],\n", " });\n", " }\n", " get names() {\n", " return object_1.keys(this.args);\n", " }\n", " get values() {\n", " return object_1.values(this.args);\n", " }\n", " get func() {\n", " const code = string_1.use_strict(this.code);\n", " return new Function(...this.names, \"source\", code);\n", " }\n", " compute_indices(source) {\n", " this.filter = this.func(...this.values, source);\n", " return super.compute_indices(source);\n", " }\n", " }\n", " exports.CustomJSFilter = CustomJSFilter;\n", " CustomJSFilter.__name__ = \"CustomJSFilter\";\n", " CustomJSFilter.init_CustomJSFilter();\n", " },\n", " /* models/filters/group_filter.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const filter_1 = require(200) /* ./filter */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const logging_1 = require(72) /* ../../core/logging */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " class GroupFilter extends filter_1.Filter {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.indices = null;\n", " }\n", " static init_GroupFilter() {\n", " this.define({\n", " column_name: [p.String],\n", " group: [p.String],\n", " });\n", " }\n", " compute_indices(source) {\n", " const column = source.get_column(this.column_name);\n", " if (column == null) {\n", " logging_1.logger.warn(\"group filter: groupby column not found in data source\");\n", " return null;\n", " }\n", " else {\n", " this.indices = array_1.range(0, source.get_length() || 0).filter((i) => column[i] === this.group);\n", " if (this.indices.length === 0) {\n", " logging_1.logger.warn(`group filter: group '${this.group}' did not match any values in column '${this.column_name}'`);\n", " }\n", " return this.indices;\n", " }\n", " }\n", " }\n", " exports.GroupFilter = GroupFilter;\n", " GroupFilter.__name__ = \"GroupFilter\";\n", " GroupFilter.init_GroupFilter();\n", " },\n", " /* models/filters/index_filter.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const filter_1 = require(200) /* ./filter */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const logging_1 = require(72) /* ../../core/logging */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " class IndexFilter extends filter_1.Filter {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_IndexFilter() {\n", " this.define({\n", " indices: [p.Array, null],\n", " });\n", " }\n", " compute_indices(_source) {\n", " if (this.indices != null) {\n", " if (array_1.every(this.indices, types_1.isInteger))\n", " return this.indices;\n", " else {\n", " logging_1.logger.warn(`${this}: indices should be array of integers, defaulting to no filtering`);\n", " return null;\n", " }\n", " }\n", " else {\n", " logging_1.logger.warn(`${this}: indices was not set, defaulting to no filtering`);\n", " return null;\n", " }\n", " }\n", " }\n", " exports.IndexFilter = IndexFilter;\n", " IndexFilter.__name__ = \"IndexFilter\";\n", " IndexFilter.init_IndexFilter();\n", " },\n", " /* models/formatters/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var basic_tick_formatter_1 = require(113) /* ./basic_tick_formatter */;\n", " exports.BasicTickFormatter = basic_tick_formatter_1.BasicTickFormatter;\n", " var categorical_tick_formatter_1 = require(154) /* ./categorical_tick_formatter */;\n", " exports.CategoricalTickFormatter = categorical_tick_formatter_1.CategoricalTickFormatter;\n", " var datetime_tick_formatter_1 = require(158) /* ./datetime_tick_formatter */;\n", " exports.DatetimeTickFormatter = datetime_tick_formatter_1.DatetimeTickFormatter;\n", " var func_tick_formatter_1 = require(205) /* ./func_tick_formatter */;\n", " exports.FuncTickFormatter = func_tick_formatter_1.FuncTickFormatter;\n", " var log_tick_formatter_1 = require(171) /* ./log_tick_formatter */;\n", " exports.LogTickFormatter = log_tick_formatter_1.LogTickFormatter;\n", " var mercator_tick_formatter_1 = require(174) /* ./mercator_tick_formatter */;\n", " exports.MercatorTickFormatter = mercator_tick_formatter_1.MercatorTickFormatter;\n", " var numeral_tick_formatter_1 = require(206) /* ./numeral_tick_formatter */;\n", " exports.NumeralTickFormatter = numeral_tick_formatter_1.NumeralTickFormatter;\n", " var printf_tick_formatter_1 = require(207) /* ./printf_tick_formatter */;\n", " exports.PrintfTickFormatter = printf_tick_formatter_1.PrintfTickFormatter;\n", " var tick_formatter_1 = require(114) /* ./tick_formatter */;\n", " exports.TickFormatter = tick_formatter_1.TickFormatter;\n", " },\n", " /* models/formatters/func_tick_formatter.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const tick_formatter_1 = require(114) /* ./tick_formatter */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const object_1 = require(17) /* ../../core/util/object */;\n", " const string_1 = require(24) /* ../../core/util/string */;\n", " class FuncTickFormatter extends tick_formatter_1.TickFormatter {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_FuncTickFormatter() {\n", " this.define({\n", " args: [p.Any, {}],\n", " code: [p.String, ''],\n", " });\n", " }\n", " get names() {\n", " return object_1.keys(this.args);\n", " }\n", " get values() {\n", " return object_1.values(this.args);\n", " }\n", " /*protected*/ _make_func() {\n", " const code = string_1.use_strict(this.code);\n", " return new Function(\"tick\", \"index\", \"ticks\", ...this.names, code);\n", " }\n", " doFormat(ticks, _opts) {\n", " const cache = {};\n", " const func = this._make_func().bind(cache);\n", " return ticks.map((tick, index, ticks) => func(tick, index, ticks, ...this.values));\n", " }\n", " }\n", " exports.FuncTickFormatter = FuncTickFormatter;\n", " FuncTickFormatter.__name__ = \"FuncTickFormatter\";\n", " FuncTickFormatter.init_FuncTickFormatter();\n", " },\n", " /* models/formatters/numeral_tick_formatter.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const Numbro = tslib_1.__importStar(require(161) /* @bokeh/numbro */);\n", " const tick_formatter_1 = require(114) /* ./tick_formatter */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class NumeralTickFormatter extends tick_formatter_1.TickFormatter {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_NumeralTickFormatter() {\n", " this.define({\n", " // TODO (bev) all of these could be tightened up\n", " format: [p.String, '0,0'],\n", " language: [p.String, 'en'],\n", " rounding: [p.RoundingFunction, 'round'],\n", " });\n", " }\n", " get _rounding_fn() {\n", " switch (this.rounding) {\n", " case \"round\":\n", " case \"nearest\":\n", " return Math.round;\n", " case \"floor\":\n", " case \"rounddown\":\n", " return Math.floor;\n", " case \"ceil\":\n", " case \"roundup\":\n", " return Math.ceil;\n", " }\n", " }\n", " doFormat(ticks, _opts) {\n", " const { format, language, _rounding_fn } = this;\n", " return ticks.map((tick) => Numbro.format(tick, format, language, _rounding_fn));\n", " }\n", " }\n", " exports.NumeralTickFormatter = NumeralTickFormatter;\n", " NumeralTickFormatter.__name__ = \"NumeralTickFormatter\";\n", " NumeralTickFormatter.init_NumeralTickFormatter();\n", " },\n", " /* models/formatters/printf_tick_formatter.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const tick_formatter_1 = require(114) /* ./tick_formatter */;\n", " const templating_1 = require(160) /* ../../core/util/templating */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class PrintfTickFormatter extends tick_formatter_1.TickFormatter {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_PrintfTickFormatter() {\n", " this.define({\n", " format: [p.String, '%s'],\n", " });\n", " }\n", " doFormat(ticks, _opts) {\n", " return ticks.map((tick) => templating_1.sprintf(this.format, tick));\n", " }\n", " }\n", " exports.PrintfTickFormatter = PrintfTickFormatter;\n", " PrintfTickFormatter.__name__ = \"PrintfTickFormatter\";\n", " PrintfTickFormatter.init_PrintfTickFormatter();\n", " },\n", " /* models/glyphs/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var annular_wedge_1 = require(209) /* ./annular_wedge */;\n", " exports.AnnularWedge = annular_wedge_1.AnnularWedge;\n", " var annulus_1 = require(210) /* ./annulus */;\n", " exports.Annulus = annulus_1.Annulus;\n", " var arc_1 = require(211) /* ./arc */;\n", " exports.Arc = arc_1.Arc;\n", " var bezier_1 = require(212) /* ./bezier */;\n", " exports.Bezier = bezier_1.Bezier;\n", " var circle_1 = require(213) /* ./circle */;\n", " exports.Circle = circle_1.Circle;\n", " var center_rotatable_1 = require(214) /* ./center_rotatable */;\n", " exports.CenterRotatable = center_rotatable_1.CenterRotatable;\n", " var ellipse_1 = require(215) /* ./ellipse */;\n", " exports.Ellipse = ellipse_1.Ellipse;\n", " var ellipse_oval_1 = require(216) /* ./ellipse_oval */;\n", " exports.EllipseOval = ellipse_oval_1.EllipseOval;\n", " var glyph_1 = require(89) /* ./glyph */;\n", " exports.Glyph = glyph_1.Glyph;\n", " var harea_1 = require(95) /* ./harea */;\n", " exports.HArea = harea_1.HArea;\n", " var hbar_1 = require(217) /* ./hbar */;\n", " exports.HBar = hbar_1.HBar;\n", " var hex_tile_1 = require(219) /* ./hex_tile */;\n", " exports.HexTile = hex_tile_1.HexTile;\n", " var image_1 = require(220) /* ./image */;\n", " exports.Image = image_1.Image;\n", " var image_rgba_1 = require(222) /* ./image_rgba */;\n", " exports.ImageRGBA = image_rgba_1.ImageRGBA;\n", " var image_url_1 = require(223) /* ./image_url */;\n", " exports.ImageURL = image_url_1.ImageURL;\n", " var line_1 = require(83) /* ./line */;\n", " exports.Line = line_1.Line;\n", " var multi_line_1 = require(225) /* ./multi_line */;\n", " exports.MultiLine = multi_line_1.MultiLine;\n", " var multi_polygons_1 = require(226) /* ./multi_polygons */;\n", " exports.MultiPolygons = multi_polygons_1.MultiPolygons;\n", " var oval_1 = require(227) /* ./oval */;\n", " exports.Oval = oval_1.Oval;\n", " var patch_1 = require(94) /* ./patch */;\n", " exports.Patch = patch_1.Patch;\n", " var patches_1 = require(228) /* ./patches */;\n", " exports.Patches = patches_1.Patches;\n", " var quad_1 = require(229) /* ./quad */;\n", " exports.Quad = quad_1.Quad;\n", " var quadratic_1 = require(230) /* ./quadratic */;\n", " exports.Quadratic = quadratic_1.Quadratic;\n", " var ray_1 = require(231) /* ./ray */;\n", " exports.Ray = ray_1.Ray;\n", " var rect_1 = require(232) /* ./rect */;\n", " exports.Rect = rect_1.Rect;\n", " var segment_1 = require(233) /* ./segment */;\n", " exports.Segment = segment_1.Segment;\n", " var step_1 = require(234) /* ./step */;\n", " exports.Step = step_1.Step;\n", " var text_1 = require(235) /* ./text */;\n", " exports.Text = text_1.Text;\n", " var varea_1 = require(97) /* ./varea */;\n", " exports.VArea = varea_1.VArea;\n", " var vbar_1 = require(236) /* ./vbar */;\n", " exports.VBar = vbar_1.VBar;\n", " var wedge_1 = require(237) /* ./wedge */;\n", " exports.Wedge = wedge_1.Wedge;\n", " var xy_glyph_1 = require(84) /* ./xy_glyph */;\n", " exports.XYGlyph = xy_glyph_1.XYGlyph;\n", " },\n", " /* models/glyphs/annular_wedge.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const xy_glyph_1 = require(84) /* ./xy_glyph */;\n", " const utils_1 = require(92) /* ./utils */;\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const math_1 = require(10) /* ../../core/util/math */;\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class AnnularWedgeView extends xy_glyph_1.XYGlyphView {\n", " _map_data() {\n", " if (this.model.properties.inner_radius.units == \"data\")\n", " this.sinner_radius = this.sdist(this.renderer.xscale, this._x, this._inner_radius);\n", " else\n", " this.sinner_radius = this._inner_radius;\n", " if (this.model.properties.outer_radius.units == \"data\")\n", " this.souter_radius = this.sdist(this.renderer.xscale, this._x, this._outer_radius);\n", " else\n", " this.souter_radius = this._outer_radius;\n", " this._angle = new Float32Array(this._start_angle.length);\n", " for (let i = 0, end = this._start_angle.length; i < end; i++) {\n", " this._angle[i] = this._end_angle[i] - this._start_angle[i];\n", " }\n", " }\n", " _render(ctx, indices, { sx, sy, _start_angle, _angle, sinner_radius, souter_radius }) {\n", " const direction = this.model.properties.direction.value();\n", " for (const i of indices) {\n", " if (isNaN(sx[i] + sy[i] + sinner_radius[i] + souter_radius[i] + _start_angle[i] + _angle[i]))\n", " continue;\n", " ctx.translate(sx[i], sy[i]);\n", " ctx.rotate(_start_angle[i]);\n", " ctx.moveTo(souter_radius[i], 0);\n", " ctx.beginPath();\n", " ctx.arc(0, 0, souter_radius[i], 0, _angle[i], direction);\n", " ctx.rotate(_angle[i]);\n", " ctx.lineTo(sinner_radius[i], 0);\n", " ctx.arc(0, 0, sinner_radius[i], 0, -_angle[i], !direction);\n", " ctx.closePath();\n", " ctx.rotate(-_angle[i] - _start_angle[i]);\n", " ctx.translate(-sx[i], -sy[i]);\n", " if (this.visuals.fill.doit) {\n", " this.visuals.fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " }\n", " _hit_point(geometry) {\n", " const { sx, sy } = geometry;\n", " const x = this.renderer.xscale.invert(sx);\n", " const y = this.renderer.yscale.invert(sy);\n", " // check radius first\n", " let x0, y0;\n", " let x1, y1;\n", " if (this.model.properties.outer_radius.units == \"data\") {\n", " x0 = x - this.max_outer_radius;\n", " x1 = x + this.max_outer_radius;\n", " y0 = y - this.max_outer_radius;\n", " y1 = y + this.max_outer_radius;\n", " }\n", " else {\n", " const sx0 = sx - this.max_outer_radius;\n", " const sx1 = sx + this.max_outer_radius;\n", " [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " const sy0 = sy - this.max_outer_radius;\n", " const sy1 = sy + this.max_outer_radius;\n", " [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " }\n", " const candidates = [];\n", " for (const i of this.index.indices({ x0, x1, y0, y1 })) {\n", " const or2 = this.souter_radius[i] ** 2;\n", " const ir2 = this.sinner_radius[i] ** 2;\n", " const [sx0, sx1] = this.renderer.xscale.r_compute(x, this._x[i]);\n", " const [sy0, sy1] = this.renderer.yscale.r_compute(y, this._y[i]);\n", " const dist = (sx0 - sx1) ** 2 + (sy0 - sy1) ** 2;\n", " if (dist <= or2 && dist >= ir2)\n", " candidates.push([i, dist]);\n", " }\n", " const direction = this.model.properties.direction.value();\n", " const hits = [];\n", " for (const [i, dist] of candidates) {\n", " // NOTE: minus the angle because JS uses non-mathy convention for angles\n", " const angle = Math.atan2(sy - this.sy[i], sx - this.sx[i]);\n", " if (math_1.angle_between(-angle, -this._start_angle[i], -this._end_angle[i], direction)) {\n", " hits.push([i, dist]);\n", " }\n", " }\n", " return selection_1.Selection.from_hits(hits);\n", " }\n", " draw_legend_for_index(ctx, bbox, index) {\n", " utils_1.generic_area_legend(this.visuals, ctx, bbox, index);\n", " }\n", " _scenterxy(i) {\n", " const r = (this.sinner_radius[i] + this.souter_radius[i]) / 2;\n", " const a = (this._start_angle[i] + this._end_angle[i]) / 2;\n", " return { x: this.sx[i] + (r * Math.cos(a)), y: this.sy[i] + (r * Math.sin(a)) };\n", " }\n", " scenterx(i) {\n", " return this._scenterxy(i).x;\n", " }\n", " scentery(i) {\n", " return this._scenterxy(i).y;\n", " }\n", " }\n", " exports.AnnularWedgeView = AnnularWedgeView;\n", " AnnularWedgeView.__name__ = \"AnnularWedgeView\";\n", " class AnnularWedge extends xy_glyph_1.XYGlyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_AnnularWedge() {\n", " this.prototype.default_view = AnnularWedgeView;\n", " this.mixins([property_mixins_1.LineVector, property_mixins_1.FillVector]);\n", " this.define({\n", " direction: [p.Direction, 'anticlock'],\n", " inner_radius: [p.DistanceSpec],\n", " outer_radius: [p.DistanceSpec],\n", " start_angle: [p.AngleSpec],\n", " end_angle: [p.AngleSpec],\n", " });\n", " }\n", " }\n", " exports.AnnularWedge = AnnularWedge;\n", " AnnularWedge.__name__ = \"AnnularWedge\";\n", " AnnularWedge.init_AnnularWedge();\n", " },\n", " /* models/glyphs/annulus.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const xy_glyph_1 = require(84) /* ./xy_glyph */;\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const compat_1 = require(28) /* ../../core/util/compat */;\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class AnnulusView extends xy_glyph_1.XYGlyphView {\n", " _map_data() {\n", " if (this.model.properties.inner_radius.units == \"data\")\n", " this.sinner_radius = this.sdist(this.renderer.xscale, this._x, this._inner_radius);\n", " else\n", " this.sinner_radius = this._inner_radius;\n", " if (this.model.properties.outer_radius.units == \"data\")\n", " this.souter_radius = this.sdist(this.renderer.xscale, this._x, this._outer_radius);\n", " else\n", " this.souter_radius = this._outer_radius;\n", " }\n", " _render(ctx, indices, { sx, sy, sinner_radius, souter_radius }) {\n", " for (const i of indices) {\n", " if (isNaN(sx[i] + sy[i] + sinner_radius[i] + souter_radius[i]))\n", " continue;\n", " // Because this visual has a whole in it, it proved \"challenging\"\n", " // for some browsers to render if drawn in one go --- i.e. it did not\n", " // work on IE. If we render in two parts (upper and lower part),\n", " // it is unambiguous what part should be filled. The line is\n", " // better drawn in one go though, otherwise the part where the pieces\n", " // meet will not be fully closed due to aa.\n", " if (this.visuals.fill.doit) {\n", " this.visuals.fill.set_vectorize(ctx, i);\n", " ctx.beginPath();\n", " if (compat_1.is_ie) {\n", " // Draw two halves of the donut. Works on IE, but causes an aa line on Safari.\n", " for (const clockwise of [false, true]) {\n", " ctx.arc(sx[i], sy[i], sinner_radius[i], 0, Math.PI, clockwise);\n", " ctx.arc(sx[i], sy[i], souter_radius[i], Math.PI, 0, !clockwise);\n", " }\n", " }\n", " else {\n", " // Draw donut in one go. Does not work on iE.\n", " ctx.arc(sx[i], sy[i], sinner_radius[i], 0, 2 * Math.PI, true);\n", " ctx.arc(sx[i], sy[i], souter_radius[i], 2 * Math.PI, 0, false);\n", " }\n", " ctx.fill();\n", " }\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.beginPath();\n", " ctx.arc(sx[i], sy[i], sinner_radius[i], 0, 2 * Math.PI);\n", " ctx.moveTo(sx[i] + souter_radius[i], sy[i]);\n", " ctx.arc(sx[i], sy[i], souter_radius[i], 0, 2 * Math.PI);\n", " ctx.stroke();\n", " }\n", " }\n", " }\n", " _hit_point(geometry) {\n", " const { sx, sy } = geometry;\n", " const x = this.renderer.xscale.invert(sx);\n", " const y = this.renderer.yscale.invert(sy);\n", " let x0, y0;\n", " let x1, y1;\n", " if (this.model.properties.outer_radius.units == \"data\") {\n", " x0 = x - this.max_outer_radius;\n", " x1 = x + this.max_outer_radius;\n", " y0 = y - this.max_outer_radius;\n", " y1 = y + this.max_outer_radius;\n", " }\n", " else {\n", " const sx0 = sx - this.max_outer_radius;\n", " const sx1 = sx + this.max_outer_radius;\n", " [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " const sy0 = sy - this.max_outer_radius;\n", " const sy1 = sy + this.max_outer_radius;\n", " [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " }\n", " const hits = [];\n", " for (const i of this.index.indices({ x0, x1, y0, y1 })) {\n", " const or2 = this.souter_radius[i] ** 2;\n", " const ir2 = this.sinner_radius[i] ** 2;\n", " const [sx0, sx1] = this.renderer.xscale.r_compute(x, this._x[i]);\n", " const [sy0, sy1] = this.renderer.yscale.r_compute(y, this._y[i]);\n", " const dist = (sx0 - sx1) ** 2 + (sy0 - sy1) ** 2;\n", " if (dist <= or2 && dist >= ir2)\n", " hits.push([i, dist]);\n", " }\n", " return selection_1.Selection.from_hits(hits);\n", " }\n", " draw_legend_for_index(ctx, { x0, y0, x1, y1 }, index) {\n", " const len = index + 1;\n", " const sx = new Array(len);\n", " sx[index] = (x0 + x1) / 2;\n", " const sy = new Array(len);\n", " sy[index] = (y0 + y1) / 2;\n", " const r = Math.min(Math.abs(x1 - x0), Math.abs(y1 - y0)) * 0.5;\n", " const sinner_radius = new Array(len);\n", " sinner_radius[index] = r * 0.4;\n", " const souter_radius = new Array(len);\n", " souter_radius[index] = r * 0.8;\n", " this._render(ctx, [index], { sx, sy, sinner_radius, souter_radius }); // XXX\n", " }\n", " }\n", " exports.AnnulusView = AnnulusView;\n", " AnnulusView.__name__ = \"AnnulusView\";\n", " class Annulus extends xy_glyph_1.XYGlyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Annulus() {\n", " this.prototype.default_view = AnnulusView;\n", " this.mixins([property_mixins_1.LineVector, property_mixins_1.FillVector]);\n", " this.define({\n", " inner_radius: [p.DistanceSpec],\n", " outer_radius: [p.DistanceSpec],\n", " });\n", " }\n", " }\n", " exports.Annulus = Annulus;\n", " Annulus.__name__ = \"Annulus\";\n", " Annulus.init_Annulus();\n", " },\n", " /* models/glyphs/arc.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const xy_glyph_1 = require(84) /* ./xy_glyph */;\n", " const utils_1 = require(92) /* ./utils */;\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class ArcView extends xy_glyph_1.XYGlyphView {\n", " _map_data() {\n", " if (this.model.properties.radius.units == \"data\")\n", " this.sradius = this.sdist(this.renderer.xscale, this._x, this._radius);\n", " else\n", " this.sradius = this._radius;\n", " }\n", " _render(ctx, indices, { sx, sy, sradius, _start_angle, _end_angle }) {\n", " if (this.visuals.line.doit) {\n", " const direction = this.model.properties.direction.value();\n", " for (const i of indices) {\n", " if (isNaN(sx[i] + sy[i] + sradius[i] + _start_angle[i] + _end_angle[i]))\n", " continue;\n", " ctx.beginPath();\n", " ctx.arc(sx[i], sy[i], sradius[i], _start_angle[i], _end_angle[i], direction);\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " }\n", " draw_legend_for_index(ctx, bbox, index) {\n", " utils_1.generic_line_legend(this.visuals, ctx, bbox, index);\n", " }\n", " }\n", " exports.ArcView = ArcView;\n", " ArcView.__name__ = \"ArcView\";\n", " class Arc extends xy_glyph_1.XYGlyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Arc() {\n", " this.prototype.default_view = ArcView;\n", " this.mixins(property_mixins_1.LineVector);\n", " this.define({\n", " direction: [p.Direction, 'anticlock'],\n", " radius: [p.DistanceSpec],\n", " start_angle: [p.AngleSpec],\n", " end_angle: [p.AngleSpec],\n", " });\n", " }\n", " }\n", " exports.Arc = Arc;\n", " Arc.__name__ = \"Arc\";\n", " Arc.init_Arc();\n", " },\n", " /* models/glyphs/bezier.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const spatial_1 = require(85) /* ../../core/util/spatial */;\n", " const glyph_1 = require(89) /* ./glyph */;\n", " const utils_1 = require(92) /* ./utils */;\n", " // algorithm adapted from http://stackoverflow.com/a/14429749/3406693\n", " function _cbb(x0, y0, x1, y1, x2, y2, x3, y3) {\n", " const tvalues = [];\n", " const bounds = [[], []];\n", " for (let i = 0; i <= 2; i++) {\n", " let a, b, c;\n", " if (i === 0) {\n", " b = ((6 * x0) - (12 * x1)) + (6 * x2);\n", " a = (((-3 * x0) + (9 * x1)) - (9 * x2)) + (3 * x3);\n", " c = (3 * x1) - (3 * x0);\n", " }\n", " else {\n", " b = ((6 * y0) - (12 * y1)) + (6 * y2);\n", " a = (((-3 * y0) + (9 * y1)) - (9 * y2)) + (3 * y3);\n", " c = (3 * y1) - (3 * y0);\n", " }\n", " if (Math.abs(a) < 1e-12) { // Numerical robustness\n", " if (Math.abs(b) < 1e-12) // Numerical robustness\n", " continue;\n", " const t = -c / b;\n", " if (0 < t && t < 1)\n", " tvalues.push(t);\n", " continue;\n", " }\n", " const b2ac = (b * b) - (4 * c * a);\n", " const sqrtb2ac = Math.sqrt(b2ac);\n", " if (b2ac < 0)\n", " continue;\n", " const t1 = (-b + sqrtb2ac) / (2 * a);\n", " if (0 < t1 && t1 < 1)\n", " tvalues.push(t1);\n", " const t2 = (-b - sqrtb2ac) / (2 * a);\n", " if (0 < t2 && t2 < 1)\n", " tvalues.push(t2);\n", " }\n", " let j = tvalues.length;\n", " const jlen = j;\n", " while (j--) {\n", " const t = tvalues[j];\n", " const mt = 1 - t;\n", " const x = (mt * mt * mt * x0) + (3 * mt * mt * t * x1) + (3 * mt * t * t * x2) + (t * t * t * x3);\n", " bounds[0][j] = x;\n", " const y = (mt * mt * mt * y0) + (3 * mt * mt * t * y1) + (3 * mt * t * t * y2) + (t * t * t * y3);\n", " bounds[1][j] = y;\n", " }\n", " bounds[0][jlen] = x0;\n", " bounds[1][jlen] = y0;\n", " bounds[0][jlen + 1] = x3;\n", " bounds[1][jlen + 1] = y3;\n", " return [\n", " Math.min(...bounds[0]),\n", " Math.max(...bounds[1]),\n", " Math.max(...bounds[0]),\n", " Math.min(...bounds[1]),\n", " ];\n", " }\n", " class BezierView extends glyph_1.GlyphView {\n", " _index_data() {\n", " const points = [];\n", " for (let i = 0, end = this._x0.length; i < end; i++) {\n", " if (isNaN(this._x0[i] + this._x1[i] + this._y0[i] + this._y1[i] + this._cx0[i] + this._cy0[i] + this._cx1[i] + this._cy1[i]))\n", " continue;\n", " const [x0, y0, x1, y1] = _cbb(this._x0[i], this._y0[i], this._x1[i], this._y1[i], this._cx0[i], this._cy0[i], this._cx1[i], this._cy1[i]);\n", " points.push({ x0, y0, x1, y1, i });\n", " }\n", " return new spatial_1.SpatialIndex(points);\n", " }\n", " _render(ctx, indices, { sx0, sy0, sx1, sy1, scx0, scy0, scx1, scy1 }) {\n", " if (this.visuals.line.doit) {\n", " for (const i of indices) {\n", " if (isNaN(sx0[i] + sy0[i] + sx1[i] + sy1[i] + scx0[i] + scy0[i] + scx1[i] + scy1[i]))\n", " continue;\n", " ctx.beginPath();\n", " ctx.moveTo(sx0[i], sy0[i]);\n", " ctx.bezierCurveTo(scx0[i], scy0[i], scx1[i], scy1[i], sx1[i], sy1[i]);\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " }\n", " draw_legend_for_index(ctx, bbox, index) {\n", " utils_1.generic_line_legend(this.visuals, ctx, bbox, index);\n", " }\n", " scenterx() {\n", " throw new Error(\"not implemented\");\n", " }\n", " scentery() {\n", " throw new Error(\"not implemented\");\n", " }\n", " }\n", " exports.BezierView = BezierView;\n", " BezierView.__name__ = \"BezierView\";\n", " class Bezier extends glyph_1.Glyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Bezier() {\n", " this.prototype.default_view = BezierView;\n", " this.coords([['x0', 'y0'], ['x1', 'y1'], ['cx0', 'cy0'], ['cx1', 'cy1']]);\n", " this.mixins(property_mixins_1.LineVector);\n", " }\n", " }\n", " exports.Bezier = Bezier;\n", " Bezier.__name__ = \"Bezier\";\n", " Bezier.init_Bezier();\n", " },\n", " /* models/glyphs/circle.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const xy_glyph_1 = require(84) /* ./xy_glyph */;\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const hittest = tslib_1.__importStar(require(93) /* ../../core/hittest */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const arrayable_1 = require(12) /* ../../core/util/arrayable */;\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class CircleView extends xy_glyph_1.XYGlyphView {\n", " _map_data() {\n", " // XXX: Order is important here: size is always present (at least\n", " // a default), but radius is only present if a user specifies it.\n", " if (this._radius != null) {\n", " if (this.model.properties.radius.units == \"data\") {\n", " switch (this.model.radius_dimension) {\n", " case \"x\": {\n", " this.sradius = this.sdist(this.renderer.xscale, this._x, this._radius);\n", " break;\n", " }\n", " case \"y\": {\n", " this.sradius = this.sdist(this.renderer.yscale, this._y, this._radius);\n", " break;\n", " }\n", " case \"max\": {\n", " const sradius_x = this.sdist(this.renderer.xscale, this._x, this._radius);\n", " const sradius_y = this.sdist(this.renderer.yscale, this._y, this._radius);\n", " this.sradius = arrayable_1.map(sradius_x, (s, i) => Math.max(s, sradius_y[i]));\n", " break;\n", " }\n", " case \"min\": {\n", " const sradius_x = this.sdist(this.renderer.xscale, this._x, this._radius);\n", " const sradius_y = this.sdist(this.renderer.yscale, this._y, this._radius);\n", " this.sradius = arrayable_1.map(sradius_x, (s, i) => Math.min(s, sradius_y[i]));\n", " break;\n", " }\n", " }\n", " }\n", " else {\n", " this.sradius = this._radius;\n", " this.max_size = 2 * this.max_radius;\n", " }\n", " }\n", " else\n", " this.sradius = arrayable_1.map(this._size, (s) => s / 2);\n", " }\n", " _mask_data() {\n", " const [hr, vr] = this.renderer.plot_view.frame.bbox.ranges;\n", " let x0, y0;\n", " let x1, y1;\n", " if (this._radius != null && this.model.properties.radius.units == \"data\") {\n", " const sx0 = hr.start;\n", " const sx1 = hr.end;\n", " [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " x0 -= this.max_radius;\n", " x1 += this.max_radius;\n", " const sy0 = vr.start;\n", " const sy1 = vr.end;\n", " [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " y0 -= this.max_radius;\n", " y1 += this.max_radius;\n", " }\n", " else {\n", " const sx0 = hr.start - this.max_size;\n", " const sx1 = hr.end + this.max_size;\n", " [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " const sy0 = vr.start - this.max_size;\n", " const sy1 = vr.end + this.max_size;\n", " [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " }\n", " return this.index.indices({ x0, x1, y0, y1 });\n", " }\n", " _render(ctx, indices, { sx, sy, sradius }) {\n", " for (const i of indices) {\n", " if (isNaN(sx[i] + sy[i] + sradius[i]))\n", " continue;\n", " ctx.beginPath();\n", " ctx.arc(sx[i], sy[i], sradius[i], 0, 2 * Math.PI, false);\n", " if (this.visuals.fill.doit) {\n", " this.visuals.fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " }\n", " _hit_point(geometry) {\n", " const { sx, sy } = geometry;\n", " const x = this.renderer.xscale.invert(sx);\n", " const y = this.renderer.yscale.invert(sy);\n", " let x0, x1, y0, y1;\n", " if (this._radius != null && this.model.properties.radius.units == \"data\") {\n", " x0 = x - this.max_radius;\n", " x1 = x + this.max_radius;\n", " y0 = y - this.max_radius;\n", " y1 = y + this.max_radius;\n", " }\n", " else {\n", " const sx0 = sx - this.max_size;\n", " const sx1 = sx + this.max_size;\n", " [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " const sy0 = sy - this.max_size;\n", " const sy1 = sy + this.max_size;\n", " [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " }\n", " const candidates = this.index.indices({ x0, x1, y0, y1 });\n", " const hits = [];\n", " if (this._radius != null && this.model.properties.radius.units == \"data\") {\n", " for (const i of candidates) {\n", " const r2 = this.sradius[i] ** 2;\n", " const [sx0, sx1] = this.renderer.xscale.r_compute(x, this._x[i]);\n", " const [sy0, sy1] = this.renderer.yscale.r_compute(y, this._y[i]);\n", " const dist = (sx0 - sx1) ** 2 + (sy0 - sy1) ** 2;\n", " if (dist <= r2) {\n", " hits.push([i, dist]);\n", " }\n", " }\n", " }\n", " else {\n", " for (const i of candidates) {\n", " const r2 = this.sradius[i] ** 2;\n", " const dist = (this.sx[i] - sx) ** 2 + (this.sy[i] - sy) ** 2;\n", " if (dist <= r2) {\n", " hits.push([i, dist]);\n", " }\n", " }\n", " }\n", " return selection_1.Selection.from_hits(hits);\n", " }\n", " _hit_span(geometry) {\n", " const { sx, sy } = geometry;\n", " const bounds = this.bounds();\n", " let x0, x1, y0, y1;\n", " if (geometry.direction == 'h') {\n", " // use circle bounds instead of current pointer y coordinates\n", " let sx0, sx1;\n", " y0 = bounds.y0;\n", " y1 = bounds.y1;\n", " if (this._radius != null && this.model.properties.radius.units == \"data\") {\n", " sx0 = sx - this.max_radius;\n", " sx1 = sx + this.max_radius;\n", " [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " }\n", " else {\n", " const ms = this.max_size / 2;\n", " sx0 = sx - ms;\n", " sx1 = sx + ms;\n", " [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " }\n", " }\n", " else {\n", " // use circle bounds instead of current pointer x coordinates\n", " let sy0, sy1;\n", " x0 = bounds.x0;\n", " x1 = bounds.x1;\n", " if (this._radius != null && this.model.properties.radius.units == \"data\") {\n", " sy0 = sy - this.max_radius;\n", " sy1 = sy + this.max_radius;\n", " [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " }\n", " else {\n", " const ms = this.max_size / 2;\n", " sy0 = sy - ms;\n", " sy1 = sy + ms;\n", " [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " }\n", " }\n", " const indices = this.index.indices({ x0, x1, y0, y1 });\n", " return new selection_1.Selection({ indices });\n", " }\n", " _hit_rect(geometry) {\n", " const { sx0, sx1, sy0, sy1 } = geometry;\n", " const [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " const [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " const indices = this.index.indices({ x0, x1, y0, y1 });\n", " return new selection_1.Selection({ indices });\n", " }\n", " _hit_poly(geometry) {\n", " const { sx, sy } = geometry;\n", " // TODO (bev) use spatial index to pare candidate list\n", " const candidates = array_1.range(0, this.sx.length);\n", " const indices = [];\n", " for (let i = 0, end = candidates.length; i < end; i++) {\n", " const index = candidates[i];\n", " if (hittest.point_in_poly(this.sx[i], this.sy[i], sx, sy)) {\n", " indices.push(index);\n", " }\n", " }\n", " return new selection_1.Selection({ indices });\n", " }\n", " // circle does not inherit from marker (since it also accepts radius) so we\n", " // must supply a draw_legend for it here\n", " draw_legend_for_index(ctx, { x0, y0, x1, y1 }, index) {\n", " // using objects like this seems a little wonky, since the keys are coerced to\n", " // stings, but it works\n", " const len = index + 1;\n", " const sx = new Array(len);\n", " sx[index] = (x0 + x1) / 2;\n", " const sy = new Array(len);\n", " sy[index] = (y0 + y1) / 2;\n", " const sradius = new Array(len);\n", " sradius[index] = Math.min(Math.abs(x1 - x0), Math.abs(y1 - y0)) * 0.2;\n", " this._render(ctx, [index], { sx, sy, sradius }); // XXX\n", " }\n", " }\n", " exports.CircleView = CircleView;\n", " CircleView.__name__ = \"CircleView\";\n", " class Circle extends xy_glyph_1.XYGlyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Circle() {\n", " this.prototype.default_view = CircleView;\n", " this.mixins([property_mixins_1.LineVector, property_mixins_1.FillVector]);\n", " this.define({\n", " angle: [p.AngleSpec, 0],\n", " size: [p.DistanceSpec, { units: \"screen\", value: 4 }],\n", " radius: [p.DistanceSpec, undefined, { optional: true }],\n", " radius_dimension: [p.RadiusDimension, 'x'],\n", " });\n", " }\n", " }\n", " exports.Circle = Circle;\n", " Circle.__name__ = \"Circle\";\n", " Circle.init_Circle();\n", " },\n", " /* models/glyphs/center_rotatable.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const xy_glyph_1 = require(84) /* ./xy_glyph */;\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class CenterRotatableView extends xy_glyph_1.XYGlyphView {\n", " }\n", " exports.CenterRotatableView = CenterRotatableView;\n", " CenterRotatableView.__name__ = \"CenterRotatableView\";\n", " class CenterRotatable extends xy_glyph_1.XYGlyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_CenterRotatable() {\n", " this.mixins([property_mixins_1.LineVector, property_mixins_1.FillVector]);\n", " this.define({\n", " angle: [p.AngleSpec, 0],\n", " width: [p.DistanceSpec],\n", " height: [p.DistanceSpec],\n", " });\n", " }\n", " }\n", " exports.CenterRotatable = CenterRotatable;\n", " CenterRotatable.__name__ = \"CenterRotatable\";\n", " CenterRotatable.init_CenterRotatable();\n", " },\n", " /* models/glyphs/ellipse.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const ellipse_oval_1 = require(216) /* ./ellipse_oval */;\n", " class EllipseView extends ellipse_oval_1.EllipseOvalView {\n", " }\n", " exports.EllipseView = EllipseView;\n", " EllipseView.__name__ = \"EllipseView\";\n", " class Ellipse extends ellipse_oval_1.EllipseOval {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Ellipse() {\n", " this.prototype.default_view = EllipseView;\n", " }\n", " }\n", " exports.Ellipse = Ellipse;\n", " Ellipse.__name__ = \"Ellipse\";\n", " Ellipse.init_Ellipse();\n", " },\n", " /* models/glyphs/ellipse_oval.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const center_rotatable_1 = require(214) /* ./center_rotatable */;\n", " const hittest = tslib_1.__importStar(require(93) /* ../../core/hittest */);\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class EllipseOvalView extends center_rotatable_1.CenterRotatableView {\n", " _set_data() {\n", " this.max_w2 = 0;\n", " if (this.model.properties.width.units == \"data\")\n", " this.max_w2 = this.max_width / 2;\n", " this.max_h2 = 0;\n", " if (this.model.properties.height.units == \"data\")\n", " this.max_h2 = this.max_height / 2;\n", " }\n", " _map_data() {\n", " if (this.model.properties.width.units == \"data\")\n", " this.sw = this.sdist(this.renderer.xscale, this._x, this._width, 'center');\n", " else\n", " this.sw = this._width;\n", " if (this.model.properties.height.units == \"data\")\n", " this.sh = this.sdist(this.renderer.yscale, this._y, this._height, 'center');\n", " else\n", " this.sh = this._height;\n", " }\n", " _render(ctx, indices, { sx, sy, sw, sh, _angle }) {\n", " for (const i of indices) {\n", " if (isNaN(sx[i] + sy[i] + sw[i] + sh[i] + _angle[i]))\n", " continue;\n", " ctx.beginPath();\n", " ctx.ellipse(sx[i], sy[i], sw[i] / 2.0, sh[i] / 2.0, _angle[i], 0, 2 * Math.PI);\n", " if (this.visuals.fill.doit) {\n", " this.visuals.fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " }\n", " _hit_point(geometry) {\n", " let x0, x1, y0, y1, cond, dist, sx0, sx1, sy0, sy1;\n", " const { sx, sy } = geometry;\n", " const x = this.renderer.xscale.invert(sx);\n", " const y = this.renderer.yscale.invert(sy);\n", " if (this.model.properties.width.units == \"data\") {\n", " x0 = x - this.max_width;\n", " x1 = x + this.max_width;\n", " }\n", " else {\n", " sx0 = sx - this.max_width;\n", " sx1 = sx + this.max_width;\n", " [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " }\n", " if (this.model.properties.height.units == \"data\") {\n", " y0 = y - this.max_height;\n", " y1 = y + this.max_height;\n", " }\n", " else {\n", " sy0 = sy - this.max_height;\n", " sy1 = sy + this.max_height;\n", " [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " }\n", " const candidates = this.index.indices({ x0, x1, y0, y1 });\n", " const hits = [];\n", " for (const i of candidates) {\n", " cond = hittest.point_in_ellipse(sx, sy, this._angle[i], this.sh[i] / 2, this.sw[i] / 2, this.sx[i], this.sy[i]);\n", " if (cond) {\n", " [sx0, sx1] = this.renderer.xscale.r_compute(x, this._x[i]);\n", " [sy0, sy1] = this.renderer.yscale.r_compute(y, this._y[i]);\n", " dist = (sx0 - sx1) ** 2 + (sy0 - sy1) ** 2;\n", " hits.push([i, dist]);\n", " }\n", " }\n", " return selection_1.Selection.from_hits(hits);\n", " }\n", " draw_legend_for_index(ctx, { x0, y0, x1, y1 }, index) {\n", " const len = index + 1;\n", " const sx = new Array(len);\n", " sx[index] = (x0 + x1) / 2;\n", " const sy = new Array(len);\n", " sy[index] = (y0 + y1) / 2;\n", " const scale = this.sw[index] / this.sh[index];\n", " const d = Math.min(Math.abs(x1 - x0), Math.abs(y1 - y0)) * 0.8;\n", " const sw = new Array(len);\n", " const sh = new Array(len);\n", " if (scale > 1) {\n", " sw[index] = d;\n", " sh[index] = d / scale;\n", " }\n", " else {\n", " sw[index] = d * scale;\n", " sh[index] = d;\n", " }\n", " this._render(ctx, [index], { sx, sy, sw, sh, _angle: [0] }); // XXX\n", " }\n", " _bounds({ x0, x1, y0, y1 }) {\n", " return {\n", " x0: x0 - this.max_w2,\n", " x1: x1 + this.max_w2,\n", " y0: y0 - this.max_h2,\n", " y1: y1 + this.max_h2,\n", " };\n", " }\n", " }\n", " exports.EllipseOvalView = EllipseOvalView;\n", " EllipseOvalView.__name__ = \"EllipseOvalView\";\n", " class EllipseOval extends center_rotatable_1.CenterRotatable {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " }\n", " exports.EllipseOval = EllipseOval;\n", " EllipseOval.__name__ = \"EllipseOval\";\n", " },\n", " /* models/glyphs/hbar.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const box_1 = require(218) /* ./box */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class HBarView extends box_1.BoxView {\n", " scenterx(i) {\n", " return (this.sleft[i] + this.sright[i]) / 2;\n", " }\n", " scentery(i) {\n", " return this.sy[i];\n", " }\n", " _index_data() {\n", " return this._index_box(this._y.length);\n", " }\n", " _lrtb(i) {\n", " const l = Math.min(this._left[i], this._right[i]);\n", " const r = Math.max(this._left[i], this._right[i]);\n", " const t = this._y[i] + 0.5 * this._height[i];\n", " const b = this._y[i] - 0.5 * this._height[i];\n", " return [l, r, t, b];\n", " }\n", " _map_data() {\n", " this.sy = this.renderer.yscale.v_compute(this._y);\n", " this.sh = this.sdist(this.renderer.yscale, this._y, this._height, \"center\");\n", " this.sleft = this.renderer.xscale.v_compute(this._left);\n", " this.sright = this.renderer.xscale.v_compute(this._right);\n", " const n = this.sy.length;\n", " this.stop = new Float64Array(n);\n", " this.sbottom = new Float64Array(n);\n", " for (let i = 0; i < n; i++) {\n", " this.stop[i] = this.sy[i] - this.sh[i] / 2;\n", " this.sbottom[i] = this.sy[i] + this.sh[i] / 2;\n", " }\n", " this._clamp_viewport();\n", " }\n", " }\n", " exports.HBarView = HBarView;\n", " HBarView.__name__ = \"HBarView\";\n", " class HBar extends box_1.Box {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_HBar() {\n", " this.prototype.default_view = HBarView;\n", " this.coords([['left', 'y']]);\n", " this.define({\n", " height: [p.NumberSpec],\n", " right: [p.CoordinateSpec],\n", " });\n", " this.override({ left: 0 });\n", " }\n", " }\n", " exports.HBar = HBar;\n", " HBar.__name__ = \"HBar\";\n", " HBar.init_HBar();\n", " },\n", " /* models/glyphs/box.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const spatial_1 = require(85) /* ../../core/util/spatial */;\n", " const glyph_1 = require(89) /* ./glyph */;\n", " const utils_1 = require(92) /* ./utils */;\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class BoxView extends glyph_1.GlyphView {\n", " get_anchor_point(anchor, i, _spt) {\n", " const left = Math.min(this.sleft[i], this.sright[i]);\n", " const right = Math.max(this.sright[i], this.sleft[i]);\n", " const top = Math.min(this.stop[i], this.sbottom[i]); // screen coordinates !!!\n", " const bottom = Math.max(this.sbottom[i], this.stop[i]); //\n", " switch (anchor) {\n", " case \"top_left\": return { x: left, y: top };\n", " case \"top_center\": return { x: (left + right) / 2, y: top };\n", " case \"top_right\": return { x: right, y: top };\n", " case \"bottom_left\": return { x: left, y: bottom };\n", " case \"bottom_center\": return { x: (left + right) / 2, y: bottom };\n", " case \"bottom_right\": return { x: right, y: bottom };\n", " case \"center_left\": return { x: left, y: (top + bottom) / 2 };\n", " case \"center\": return { x: (left + right) / 2, y: (top + bottom) / 2 };\n", " case \"center_right\": return { x: right, y: (top + bottom) / 2 };\n", " default: return null;\n", " }\n", " }\n", " _index_box(len) {\n", " const points = [];\n", " for (let i = 0; i < len; i++) {\n", " const [l, r, t, b] = this._lrtb(i);\n", " if (isNaN(l + r + t + b) || !isFinite(l + r + t + b))\n", " continue;\n", " points.push({\n", " x0: Math.min(l, r),\n", " y0: Math.min(t, b),\n", " x1: Math.max(r, l),\n", " y1: Math.max(t, b),\n", " i,\n", " });\n", " }\n", " return new spatial_1.SpatialIndex(points);\n", " }\n", " _render(ctx, indices, { sleft, sright, stop, sbottom }) {\n", " for (const i of indices) {\n", " if (isNaN(sleft[i] + stop[i] + sright[i] + sbottom[i]))\n", " continue;\n", " ctx.rect(sleft[i], stop[i], sright[i] - sleft[i], sbottom[i] - stop[i]);\n", " if (this.visuals.fill.doit) {\n", " this.visuals.fill.set_vectorize(ctx, i);\n", " ctx.beginPath();\n", " ctx.rect(sleft[i], stop[i], sright[i] - sleft[i], sbottom[i] - stop[i]);\n", " ctx.fill();\n", " }\n", " this.visuals.hatch.doit2(ctx, i, () => {\n", " ctx.beginPath();\n", " ctx.rect(sleft[i], stop[i], sright[i] - sleft[i], sbottom[i] - stop[i]);\n", " ctx.fill();\n", " }, () => this.renderer.request_render());\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.beginPath();\n", " ctx.rect(sleft[i], stop[i], sright[i] - sleft[i], sbottom[i] - stop[i]);\n", " ctx.stroke();\n", " }\n", " }\n", " }\n", " // We need to clamp the endpoints inside the viewport, because various browser canvas\n", " // implementations have issues drawing rects with enpoints far outside the viewport\n", " _clamp_viewport() {\n", " const hr = this.renderer.plot_view.frame.bbox.h_range;\n", " const vr = this.renderer.plot_view.frame.bbox.v_range;\n", " const n = this.stop.length;\n", " for (let i = 0; i < n; i++) {\n", " this.stop[i] = Math.max(this.stop[i], vr.start);\n", " this.sbottom[i] = Math.min(this.sbottom[i], vr.end);\n", " this.sleft[i] = Math.max(this.sleft[i], hr.start);\n", " this.sright[i] = Math.min(this.sright[i], hr.end);\n", " }\n", " }\n", " _hit_rect(geometry) {\n", " return this._hit_rect_against_index(geometry);\n", " }\n", " _hit_point(geometry) {\n", " const { sx, sy } = geometry;\n", " const x = this.renderer.xscale.invert(sx);\n", " const y = this.renderer.yscale.invert(sy);\n", " const indices = this.index.indices({ x0: x, y0: y, x1: x, y1: y });\n", " return new selection_1.Selection({ indices });\n", " }\n", " _hit_span(geometry) {\n", " const { sx, sy } = geometry;\n", " let indices;\n", " if (geometry.direction == 'v') {\n", " const y = this.renderer.yscale.invert(sy);\n", " const hr = this.renderer.plot_view.frame.bbox.h_range;\n", " const [x0, x1] = this.renderer.xscale.r_invert(hr.start, hr.end);\n", " indices = this.index.indices({ x0, y0: y, x1, y1: y });\n", " }\n", " else {\n", " const x = this.renderer.xscale.invert(sx);\n", " const vr = this.renderer.plot_view.frame.bbox.v_range;\n", " const [y0, y1] = this.renderer.yscale.r_invert(vr.start, vr.end);\n", " indices = this.index.indices({ x0: x, y0, x1: x, y1 });\n", " }\n", " return new selection_1.Selection({ indices });\n", " }\n", " draw_legend_for_index(ctx, bbox, index) {\n", " utils_1.generic_area_legend(this.visuals, ctx, bbox, index);\n", " }\n", " }\n", " exports.BoxView = BoxView;\n", " BoxView.__name__ = \"BoxView\";\n", " class Box extends glyph_1.Glyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Box() {\n", " this.mixins([property_mixins_1.LineVector, property_mixins_1.FillVector, property_mixins_1.HatchVector]);\n", " }\n", " }\n", " exports.Box = Box;\n", " Box.__name__ = \"Box\";\n", " Box.init_Box();\n", " },\n", " /* models/glyphs/hex_tile.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const glyph_1 = require(89) /* ./glyph */;\n", " const hittest = tslib_1.__importStar(require(93) /* ../../core/hittest */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const spatial_1 = require(85) /* ../../core/util/spatial */;\n", " const utils_1 = require(92) /* ./utils */;\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class HexTileView extends glyph_1.GlyphView {\n", " scenterx(i) { return this.sx[i]; }\n", " scentery(i) { return this.sy[i]; }\n", " _set_data() {\n", " const n = this._q.length;\n", " const size = this.model.size;\n", " const aspect_scale = this.model.aspect_scale;\n", " this._x = new Float64Array(n);\n", " this._y = new Float64Array(n);\n", " if (this.model.orientation == \"pointytop\") {\n", " for (let i = 0; i < n; i++) {\n", " this._x[i] = size * Math.sqrt(3) * (this._q[i] + this._r[i] / 2) / aspect_scale;\n", " this._y[i] = -size * 3 / 2 * this._r[i];\n", " }\n", " }\n", " else {\n", " for (let i = 0; i < n; i++) {\n", " this._x[i] = size * 3 / 2 * this._q[i];\n", " this._y[i] = -size * Math.sqrt(3) * (this._r[i] + this._q[i] / 2) * aspect_scale;\n", " }\n", " }\n", " }\n", " _index_data() {\n", " let ysize = this.model.size;\n", " let xsize = Math.sqrt(3) * ysize / 2;\n", " if (this.model.orientation == \"flattop\") {\n", " [xsize, ysize] = [ysize, xsize];\n", " ysize *= this.model.aspect_scale;\n", " }\n", " else\n", " xsize /= this.model.aspect_scale;\n", " const points = [];\n", " for (let i = 0; i < this._x.length; i++) {\n", " const x = this._x[i];\n", " const y = this._y[i];\n", " if (isNaN(x + y) || !isFinite(x + y))\n", " continue;\n", " points.push({ x0: x - xsize, y0: y - ysize, x1: x + xsize, y1: y + ysize, i });\n", " }\n", " return new spatial_1.SpatialIndex(points);\n", " }\n", " // overriding map_data instead of _map_data because the default automatic mappings\n", " // for other glyphs (with cartesian coordinates) is not useful\n", " map_data() {\n", " [this.sx, this.sy] = this.map_to_screen(this._x, this._y);\n", " [this.svx, this.svy] = this._get_unscaled_vertices();\n", " }\n", " _get_unscaled_vertices() {\n", " const size = this.model.size;\n", " const aspect_scale = this.model.aspect_scale;\n", " if (this.model.orientation == \"pointytop\") {\n", " const rscale = this.renderer.yscale;\n", " const hscale = this.renderer.xscale;\n", " const r = Math.abs(rscale.compute(0) - rscale.compute(size)); // assumes linear scale\n", " const h = Math.sqrt(3) / 2 * Math.abs(hscale.compute(0) - hscale.compute(size)) / aspect_scale; // assumes linear scale\n", " const r2 = r / 2.0;\n", " const svx = [0, -h, -h, 0, h, h];\n", " const svy = [r, r2, -r2, -r, -r2, r2];\n", " return [svx, svy];\n", " }\n", " else {\n", " const rscale = this.renderer.xscale;\n", " const hscale = this.renderer.yscale;\n", " const r = Math.abs(rscale.compute(0) - rscale.compute(size)); // assumes linear scale\n", " const h = Math.sqrt(3) / 2 * Math.abs(hscale.compute(0) - hscale.compute(size)) * aspect_scale; // assumes linear scale\n", " const r2 = r / 2.0;\n", " const svx = [r, r2, -r2, -r, -r2, r2];\n", " const svy = [0, -h, -h, 0, h, h];\n", " return [svx, svy];\n", " }\n", " }\n", " _render(ctx, indices, { sx, sy, svx, svy, _scale }) {\n", " for (const i of indices) {\n", " if (isNaN(sx[i] + sy[i] + _scale[i]))\n", " continue;\n", " ctx.translate(sx[i], sy[i]);\n", " ctx.beginPath();\n", " for (let j = 0; j < 6; j++) {\n", " ctx.lineTo(svx[j] * _scale[i], svy[j] * _scale[i]);\n", " }\n", " ctx.closePath();\n", " ctx.translate(-sx[i], -sy[i]);\n", " if (this.visuals.fill.doit) {\n", " this.visuals.fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " }\n", " _hit_point(geometry) {\n", " const { sx, sy } = geometry;\n", " const x = this.renderer.xscale.invert(sx);\n", " const y = this.renderer.yscale.invert(sy);\n", " const candidates = this.index.indices({ x0: x, y0: y, x1: x, y1: y });\n", " const indices = [];\n", " for (const i of candidates) {\n", " if (hittest.point_in_poly(sx - this.sx[i], sy - this.sy[i], this.svx, this.svy)) {\n", " indices.push(i);\n", " }\n", " }\n", " return new selection_1.Selection({ indices });\n", " }\n", " _hit_span(geometry) {\n", " const { sx, sy } = geometry;\n", " let indices;\n", " if (geometry.direction == 'v') {\n", " const y = this.renderer.yscale.invert(sy);\n", " const hr = this.renderer.plot_view.frame.bbox.h_range;\n", " const [x0, x1] = this.renderer.xscale.r_invert(hr.start, hr.end);\n", " indices = this.index.indices({ x0, y0: y, x1, y1: y });\n", " }\n", " else {\n", " const x = this.renderer.xscale.invert(sx);\n", " const vr = this.renderer.plot_view.frame.bbox.v_range;\n", " const [y0, y1] = this.renderer.yscale.r_invert(vr.start, vr.end);\n", " indices = this.index.indices({ x0: x, y0, x1: x, y1 });\n", " }\n", " return new selection_1.Selection({ indices });\n", " }\n", " _hit_rect(geometry) {\n", " const { sx0, sx1, sy0, sy1 } = geometry;\n", " const [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " const [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " const indices = this.index.indices({ x0, x1, y0, y1 });\n", " return new selection_1.Selection({ indices });\n", " }\n", " draw_legend_for_index(ctx, bbox, index) {\n", " utils_1.generic_area_legend(this.visuals, ctx, bbox, index);\n", " }\n", " }\n", " exports.HexTileView = HexTileView;\n", " HexTileView.__name__ = \"HexTileView\";\n", " class HexTile extends glyph_1.Glyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_HexTile() {\n", " this.prototype.default_view = HexTileView;\n", " this.coords([['r', 'q']]);\n", " this.mixins([property_mixins_1.LineVector, property_mixins_1.FillVector]);\n", " this.define({\n", " size: [p.Number, 1.0],\n", " aspect_scale: [p.Number, 1.0],\n", " scale: [p.NumberSpec, 1.0],\n", " orientation: [p.HexTileOrientation, \"pointytop\"],\n", " });\n", " this.override({ line_color: null });\n", " }\n", " }\n", " exports.HexTile = HexTile;\n", " HexTile.__name__ = \"HexTile\";\n", " HexTile.init_HexTile();\n", " },\n", " /* models/glyphs/image.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const image_base_1 = require(221) /* ./image_base */;\n", " const linear_color_mapper_1 = require(115) /* ../mappers/linear_color_mapper */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class ImageView extends image_base_1.ImageBaseView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.color_mapper.change, () => this._update_image());\n", " }\n", " _update_image() {\n", " // Only reset image_data if already initialized\n", " if (this.image_data != null) {\n", " this._set_data(null);\n", " this.renderer.plot_view.request_render();\n", " }\n", " }\n", " _flat_img_to_buf8(img) {\n", " const cmap = this.model.color_mapper.rgba_mapper;\n", " return cmap.v_compute(img);\n", " }\n", " }\n", " exports.ImageView = ImageView;\n", " ImageView.__name__ = \"ImageView\";\n", " // NOTE: this needs to be redefined here, because palettes are located in bokeh-api.js bundle\n", " const Greys9 = () => [\"#000000\", \"#252525\", \"#525252\", \"#737373\", \"#969696\", \"#bdbdbd\", \"#d9d9d9\", \"#f0f0f0\", \"#ffffff\"];\n", " class Image extends image_base_1.ImageBase {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Image() {\n", " this.prototype.default_view = ImageView;\n", " this.define({\n", " color_mapper: [p.Instance, () => new linear_color_mapper_1.LinearColorMapper({ palette: Greys9() })],\n", " });\n", " }\n", " }\n", " exports.Image = Image;\n", " Image.__name__ = \"Image\";\n", " Image.init_Image();\n", " },\n", " /* models/glyphs/image_base.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const xy_glyph_1 = require(84) /* ./xy_glyph */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " const spatial_1 = require(85) /* ../../core/util/spatial */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const ndarray_1 = require(26) /* ../../core/util/ndarray */;\n", " class ImageBaseView extends xy_glyph_1.XYGlyphView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.global_alpha.change, () => this.renderer.request_render());\n", " }\n", " _render(ctx, indices, { image_data, sx, sy, sw, sh }) {\n", " const old_smoothing = ctx.getImageSmoothingEnabled();\n", " ctx.setImageSmoothingEnabled(false);\n", " ctx.globalAlpha = this.model.global_alpha;\n", " for (const i of indices) {\n", " if (image_data[i] == null || isNaN(sx[i] + sy[i] + sw[i] + sh[i]))\n", " continue;\n", " const y_offset = sy[i];\n", " ctx.translate(0, y_offset);\n", " ctx.scale(1, -1);\n", " ctx.translate(0, -y_offset);\n", " ctx.drawImage(image_data[i], sx[i] | 0, sy[i] | 0, sw[i], sh[i]);\n", " ctx.translate(0, y_offset);\n", " ctx.scale(1, -1);\n", " ctx.translate(0, -y_offset);\n", " }\n", " ctx.setImageSmoothingEnabled(old_smoothing);\n", " }\n", " _set_data(indices) {\n", " this._set_width_heigh_data();\n", " for (let i = 0, end = this._image.length; i < end; i++) {\n", " if (indices != null && indices.indexOf(i) < 0)\n", " continue;\n", " const img = this._image[i];\n", " let flat_img;\n", " if (ndarray_1.is_NDArray(img)) {\n", " flat_img = img;\n", " this._height[i] = img.shape[0];\n", " this._width[i] = img.shape[1];\n", " }\n", " else {\n", " flat_img = array_1.concat(img);\n", " this._height[i] = img.length;\n", " this._width[i] = img[0].length;\n", " }\n", " const buf8 = this._flat_img_to_buf8(flat_img);\n", " this._set_image_data_from_buffer(i, buf8);\n", " }\n", " }\n", " _index_data() {\n", " const points = [];\n", " for (let i = 0, end = this._x.length; i < end; i++) {\n", " const [l, r, t, b] = this._lrtb(i);\n", " if (isNaN(l + r + t + b) || !isFinite(l + r + t + b)) {\n", " continue;\n", " }\n", " points.push({ x0: l, y0: b, x1: r, y1: t, i });\n", " }\n", " return new spatial_1.SpatialIndex(points);\n", " }\n", " _lrtb(i) {\n", " const xr = this.renderer.xscale.source_range;\n", " const x1 = this._x[i];\n", " const x2 = xr.is_reversed ? x1 - this._dw[i] : x1 + this._dw[i];\n", " const yr = this.renderer.yscale.source_range;\n", " const y1 = this._y[i];\n", " const y2 = yr.is_reversed ? y1 - this._dh[i] : y1 + this._dh[i];\n", " const [l, r] = x1 < x2 ? [x1, x2] : [x2, x1];\n", " const [b, t] = y1 < y2 ? [y1, y2] : [y2, y1];\n", " return [l, r, t, b];\n", " }\n", " _set_width_heigh_data() {\n", " if (this.image_data == null || this.image_data.length != this._image.length)\n", " this.image_data = new Array(this._image.length);\n", " if (this._width == null || this._width.length != this._image.length)\n", " this._width = new Array(this._image.length);\n", " if (this._height == null || this._height.length != this._image.length)\n", " this._height = new Array(this._image.length);\n", " }\n", " _get_or_create_canvas(i) {\n", " const _image_data = this.image_data[i];\n", " if (_image_data != null && _image_data.width == this._width[i] &&\n", " _image_data.height == this._height[i])\n", " return _image_data;\n", " else {\n", " const canvas = document.createElement('canvas');\n", " canvas.width = this._width[i];\n", " canvas.height = this._height[i];\n", " return canvas;\n", " }\n", " }\n", " _set_image_data_from_buffer(i, buf8) {\n", " const canvas = this._get_or_create_canvas(i);\n", " const ctx = canvas.getContext('2d');\n", " const image_data = ctx.getImageData(0, 0, this._width[i], this._height[i]);\n", " image_data.data.set(buf8);\n", " ctx.putImageData(image_data, 0, 0);\n", " this.image_data[i] = canvas;\n", " }\n", " _map_data() {\n", " switch (this.model.properties.dw.units) {\n", " case \"data\": {\n", " this.sw = this.sdist(this.renderer.xscale, this._x, this._dw, 'edge', this.model.dilate);\n", " break;\n", " }\n", " case \"screen\": {\n", " this.sw = this._dw;\n", " break;\n", " }\n", " }\n", " switch (this.model.properties.dh.units) {\n", " case \"data\": {\n", " this.sh = this.sdist(this.renderer.yscale, this._y, this._dh, 'edge', this.model.dilate);\n", " break;\n", " }\n", " case \"screen\": {\n", " this.sh = this._dh;\n", " break;\n", " }\n", " }\n", " }\n", " _image_index(index, x, y) {\n", " const [l, r, t, b] = this._lrtb(index);\n", " const width = this._width[index];\n", " const height = this._height[index];\n", " const dx = (r - l) / width;\n", " const dy = (t - b) / height;\n", " let dim1 = Math.floor((x - l) / dx);\n", " let dim2 = Math.floor((y - b) / dy);\n", " if (this.renderer.xscale.source_range.is_reversed)\n", " dim1 = width - dim1 - 1;\n", " if (this.renderer.yscale.source_range.is_reversed)\n", " dim2 = height - dim2 - 1;\n", " return { index, dim1, dim2, flat_index: dim2 * width + dim1 };\n", " }\n", " _hit_point(geometry) {\n", " const { sx, sy } = geometry;\n", " const x = this.renderer.xscale.invert(sx);\n", " const y = this.renderer.yscale.invert(sy);\n", " const candidates = this.index.indices({ x0: x, x1: x, y0: y, y1: y });\n", " const result = new selection_1.Selection();\n", " for (const index of candidates) {\n", " if (sx != Infinity && sy != Infinity) {\n", " result.image_indices.push(this._image_index(index, x, y));\n", " }\n", " }\n", " return result;\n", " }\n", " }\n", " exports.ImageBaseView = ImageBaseView;\n", " ImageBaseView.__name__ = \"ImageBaseView\";\n", " class ImageBase extends xy_glyph_1.XYGlyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ImageBase() {\n", " this.define({\n", " image: [p.NumberSpec],\n", " dw: [p.DistanceSpec],\n", " dh: [p.DistanceSpec],\n", " dilate: [p.Boolean, false],\n", " global_alpha: [p.Number, 1.0],\n", " });\n", " }\n", " }\n", " exports.ImageBase = ImageBase;\n", " ImageBase.__name__ = \"ImageBase\";\n", " ImageBase.init_ImageBase();\n", " },\n", " /* models/glyphs/image_rgba.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const image_base_1 = require(221) /* ./image_base */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " class ImageRGBAView extends image_base_1.ImageBaseView {\n", " _flat_img_to_buf8(img) {\n", " let array;\n", " if (types_1.isArray(img)) {\n", " array = new Uint32Array(img);\n", " }\n", " else {\n", " array = img;\n", " }\n", " return new Uint8Array(array.buffer);\n", " }\n", " }\n", " exports.ImageRGBAView = ImageRGBAView;\n", " ImageRGBAView.__name__ = \"ImageRGBAView\";\n", " class ImageRGBA extends image_base_1.ImageBase {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ImageRGBA() {\n", " this.prototype.default_view = ImageRGBAView;\n", " }\n", " }\n", " exports.ImageRGBA = ImageRGBA;\n", " ImageRGBA.__name__ = \"ImageRGBA\";\n", " ImageRGBA.init_ImageRGBA();\n", " },\n", " /* models/glyphs/image_url.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const xy_glyph_1 = require(84) /* ./xy_glyph */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const arrayable_1 = require(12) /* ../../core/util/arrayable */;\n", " const spatial_1 = require(85) /* ../../core/util/spatial */;\n", " const image_1 = require(224) /* ../../core/util/image */;\n", " class ImageURLView extends xy_glyph_1.XYGlyphView {\n", " constructor() {\n", " super(...arguments);\n", " this._images_rendered = false;\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.connect(this.model.properties.global_alpha.change, () => this.renderer.request_render());\n", " }\n", " _index_data() {\n", " return new spatial_1.SpatialIndex([]);\n", " }\n", " _set_data() {\n", " if (this.image == null || this.image.length != this._url.length)\n", " this.image = arrayable_1.map(this._url, () => null);\n", " const { retry_attempts, retry_timeout } = this.model;\n", " for (let i = 0, end = this._url.length; i < end; i++) {\n", " const url = this._url[i];\n", " if (url == null || url == \"\")\n", " continue;\n", " new image_1.ImageLoader(url, {\n", " loaded: (image) => {\n", " this.image[i] = image;\n", " this.renderer.request_render();\n", " },\n", " attempts: retry_attempts + 1,\n", " timeout: retry_timeout,\n", " });\n", " }\n", " const w_data = this.model.properties.w.units == \"data\";\n", " const h_data = this.model.properties.h.units == \"data\";\n", " const n = this._x.length;\n", " const xs = new Array(w_data ? 2 * n : n);\n", " const ys = new Array(h_data ? 2 * n : n);\n", " for (let i = 0; i < n; i++) {\n", " xs[i] = this._x[i];\n", " ys[i] = this._y[i];\n", " }\n", " // if the width/height are in screen units, don't try to include them in bounds\n", " if (w_data) {\n", " for (let i = 0; i < n; i++)\n", " xs[n + i] = this._x[i] + this._w[i];\n", " }\n", " if (h_data) {\n", " for (let i = 0; i < n; i++)\n", " ys[n + i] = this._y[i] + this._h[i];\n", " }\n", " const x0 = arrayable_1.min(xs);\n", " const x1 = arrayable_1.max(xs);\n", " const y0 = arrayable_1.min(ys);\n", " const y1 = arrayable_1.max(ys);\n", " this._bounds_rect = { x0, x1, y0, y1 };\n", " }\n", " has_finished() {\n", " return super.has_finished() && this._images_rendered == true;\n", " }\n", " _map_data() {\n", " // Better to check this.model.w and this.model.h for null since the set_data\n", " // machinery will have converted this._w and this._w to lists of null\n", " const ws = this.model.w != null ? this._w : arrayable_1.map(this._x, () => NaN);\n", " const hs = this.model.h != null ? this._h : arrayable_1.map(this._x, () => NaN);\n", " switch (this.model.properties.w.units) {\n", " case \"data\": {\n", " this.sw = this.sdist(this.renderer.xscale, this._x, ws, \"edge\", this.model.dilate);\n", " break;\n", " }\n", " case \"screen\": {\n", " this.sw = ws;\n", " break;\n", " }\n", " }\n", " switch (this.model.properties.h.units) {\n", " case \"data\": {\n", " this.sh = this.sdist(this.renderer.yscale, this._y, hs, \"edge\", this.model.dilate);\n", " break;\n", " }\n", " case \"screen\": {\n", " this.sh = hs;\n", " break;\n", " }\n", " }\n", " }\n", " _render(ctx, indices, { image, sx, sy, sw, sh, _angle }) {\n", " // TODO (bev): take actual border width into account when clipping\n", " const { frame } = this.renderer.plot_view;\n", " ctx.rect(frame._left.value + 1, frame._top.value + 1, frame._width.value - 2, frame._height.value - 2);\n", " ctx.clip();\n", " let finished = true;\n", " for (const i of indices) {\n", " if (isNaN(sx[i] + sy[i] + _angle[i]))\n", " continue;\n", " const img = image[i];\n", " if (img == null) {\n", " finished = false;\n", " continue;\n", " }\n", " this._render_image(ctx, i, img, sx, sy, sw, sh, _angle);\n", " }\n", " if (finished && !this._images_rendered) {\n", " this._images_rendered = true;\n", " this.notify_finished();\n", " }\n", " }\n", " _final_sx_sy(anchor, sx, sy, sw, sh) {\n", " switch (anchor) {\n", " case 'top_left': return [sx, sy];\n", " case 'top_center': return [sx - (sw / 2), sy];\n", " case 'top_right': return [sx - sw, sy];\n", " case 'center_right': return [sx - sw, sy - (sh / 2)];\n", " case 'bottom_right': return [sx - sw, sy - sh];\n", " case 'bottom_center': return [sx - (sw / 2), sy - sh];\n", " case 'bottom_left': return [sx, sy - sh];\n", " case 'center_left': return [sx, sy - (sh / 2)];\n", " case 'center': return [sx - (sw / 2), sy - (sh / 2)];\n", " }\n", " }\n", " _render_image(ctx, i, image, sx, sy, sw, sh, angle) {\n", " if (isNaN(sw[i]))\n", " sw[i] = image.width;\n", " if (isNaN(sh[i]))\n", " sh[i] = image.height;\n", " const { anchor } = this.model;\n", " const [sxi, syi] = this._final_sx_sy(anchor, sx[i], sy[i], sw[i], sh[i]);\n", " ctx.save();\n", " ctx.globalAlpha = this.model.global_alpha;\n", " const sw2 = sw[i] / 2;\n", " const sh2 = sh[i] / 2;\n", " if (angle[i]) {\n", " ctx.translate(sxi, syi);\n", " //rotation about center of image\n", " ctx.translate(sw2, sh2);\n", " ctx.rotate(angle[i]);\n", " ctx.translate(-sw2, -sh2);\n", " ctx.drawImage(image, 0, 0, sw[i], sh[i]);\n", " ctx.translate(sw2, sh2);\n", " ctx.rotate(-angle[i]);\n", " ctx.translate(-sw2, -sh2);\n", " ctx.translate(-sxi, -syi);\n", " }\n", " else\n", " ctx.drawImage(image, sxi, syi, sw[i], sh[i]);\n", " ctx.restore();\n", " }\n", " bounds() {\n", " return this._bounds_rect;\n", " }\n", " }\n", " exports.ImageURLView = ImageURLView;\n", " ImageURLView.__name__ = \"ImageURLView\";\n", " class ImageURL extends xy_glyph_1.XYGlyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ImageURL() {\n", " this.prototype.default_view = ImageURLView;\n", " this.define({\n", " url: [p.StringSpec],\n", " anchor: [p.Anchor, 'top_left'],\n", " global_alpha: [p.Number, 1.0],\n", " angle: [p.AngleSpec, 0],\n", " w: [p.DistanceSpec],\n", " h: [p.DistanceSpec],\n", " dilate: [p.Boolean, false],\n", " retry_attempts: [p.Number, 0],\n", " retry_timeout: [p.Number, 0],\n", " });\n", " }\n", " }\n", " exports.ImageURL = ImageURL;\n", " ImageURL.__name__ = \"ImageURL\";\n", " ImageURL.init_ImageURL();\n", " },\n", " /* core/util/image.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const logging_1 = require(72) /* ../logging */;\n", " class ImageLoader {\n", " constructor(url, options = {}) {\n", " this._image = new Image();\n", " this._finished = false;\n", " const { attempts = 1, timeout = 1 } = options;\n", " this.promise = new Promise((resolve, _reject) => {\n", " this._image.crossOrigin = \"anonymous\";\n", " let retries = 0;\n", " this._image.onerror = () => {\n", " if (++retries == attempts) {\n", " const message = `unable to load ${url} image after ${attempts} attempts`;\n", " logging_1.logger.warn(message);\n", " if (this._image.crossOrigin != null) {\n", " logging_1.logger.warn(`attempting to load ${url} without a cross origin policy`);\n", " this._image.crossOrigin = null;\n", " retries = 0;\n", " }\n", " else {\n", " if (options.failed != null)\n", " options.failed();\n", " return; // XXX reject(new Error(message))\n", " }\n", " }\n", " setTimeout(() => this._image.src = url, timeout);\n", " };\n", " this._image.onload = () => {\n", " this._finished = true;\n", " if (options.loaded != null)\n", " options.loaded(this._image);\n", " resolve(this._image);\n", " };\n", " this._image.src = url;\n", " });\n", " }\n", " get finished() {\n", " return this._finished;\n", " }\n", " get image() {\n", " return this._image;\n", " }\n", " }\n", " exports.ImageLoader = ImageLoader;\n", " ImageLoader.__name__ = \"ImageLoader\";\n", " },\n", " /* models/glyphs/multi_line.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const spatial_1 = require(85) /* ../../core/util/spatial */;\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const hittest = tslib_1.__importStar(require(93) /* ../../core/hittest */);\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const object_1 = require(17) /* ../../core/util/object */;\n", " const glyph_1 = require(89) /* ./glyph */;\n", " const utils_1 = require(92) /* ./utils */;\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class MultiLineView extends glyph_1.GlyphView {\n", " _index_data() {\n", " const points = [];\n", " for (let i = 0, end = this._xs.length; i < end; i++) {\n", " if (this._xs[i] == null || this._xs[i].length === 0)\n", " continue;\n", " const _xsi = this._xs[i];\n", " const xs = [];\n", " for (let j = 0, n = _xsi.length; j < n; j++) {\n", " const x = _xsi[j];\n", " if (!isNaN(x))\n", " xs.push(x);\n", " }\n", " const _ysi = this._ys[i];\n", " const ys = [];\n", " for (let j = 0, n = _ysi.length; j < n; j++) {\n", " const y = _ysi[j];\n", " if (!isNaN(y))\n", " ys.push(y);\n", " }\n", " const [x0, x1] = [array_1.min(xs), array_1.max(xs)];\n", " const [y0, y1] = [array_1.min(ys), array_1.max(ys)];\n", " points.push({ x0, y0, x1, y1, i });\n", " }\n", " return new spatial_1.SpatialIndex(points);\n", " }\n", " _render(ctx, indices, { sxs, sys }) {\n", " for (const i of indices) {\n", " const [sx, sy] = [sxs[i], sys[i]];\n", " this.visuals.line.set_vectorize(ctx, i);\n", " for (let j = 0, end = sx.length; j < end; j++) {\n", " if (j == 0) {\n", " ctx.beginPath();\n", " ctx.moveTo(sx[j], sy[j]);\n", " continue;\n", " }\n", " else if (isNaN(sx[j]) || isNaN(sy[j])) {\n", " ctx.stroke();\n", " ctx.beginPath();\n", " continue;\n", " }\n", " else\n", " ctx.lineTo(sx[j], sy[j]);\n", " }\n", " ctx.stroke();\n", " }\n", " }\n", " _hit_point(geometry) {\n", " const point = { x: geometry.sx, y: geometry.sy };\n", " let shortest = 9999;\n", " const hits = new Map();\n", " for (let i = 0, end = this.sxs.length; i < end; i++) {\n", " const threshold = Math.max(2, this.visuals.line.cache_select('line_width', i) / 2);\n", " let points = null;\n", " for (let j = 0, endj = this.sxs[i].length - 1; j < endj; j++) {\n", " const p0 = { x: this.sxs[i][j], y: this.sys[i][j] };\n", " const p1 = { x: this.sxs[i][j + 1], y: this.sys[i][j + 1] };\n", " const dist = hittest.dist_to_segment(point, p0, p1);\n", " if (dist < threshold && dist < shortest) {\n", " shortest = dist;\n", " points = [j];\n", " }\n", " }\n", " if (points != null) {\n", " hits.set(i, points);\n", " }\n", " }\n", " return new selection_1.Selection({\n", " indices: [...hits.keys()],\n", " multiline_indices: object_1.to_object(hits),\n", " });\n", " }\n", " _hit_span(geometry) {\n", " const { sx, sy } = geometry;\n", " let val;\n", " let values;\n", " if (geometry.direction === 'v') {\n", " val = this.renderer.yscale.invert(sy);\n", " values = this._ys;\n", " }\n", " else {\n", " val = this.renderer.xscale.invert(sx);\n", " values = this._xs;\n", " }\n", " const hits = new Map();\n", " for (let i = 0, end = values.length; i < end; i++) {\n", " const points = [];\n", " for (let j = 0, endj = values[i].length - 1; j < endj; j++) {\n", " if (values[i][j] <= val && val <= values[i][j + 1])\n", " points.push(j);\n", " }\n", " if (points.length > 0) {\n", " hits.set(i, points);\n", " }\n", " }\n", " return new selection_1.Selection({\n", " indices: [...hits.keys()],\n", " multiline_indices: object_1.to_object(hits),\n", " });\n", " }\n", " get_interpolation_hit(i, point_i, geometry) {\n", " const [x2, y2, x3, y3] = [this._xs[i][point_i], this._ys[i][point_i], this._xs[i][point_i + 1], this._ys[i][point_i + 1]];\n", " return utils_1.line_interpolation(this.renderer, geometry, x2, y2, x3, y3);\n", " }\n", " draw_legend_for_index(ctx, bbox, index) {\n", " utils_1.generic_line_legend(this.visuals, ctx, bbox, index);\n", " }\n", " scenterx() {\n", " throw new Error(\"not implemented\");\n", " }\n", " scentery() {\n", " throw new Error(\"not implemented\");\n", " }\n", " }\n", " exports.MultiLineView = MultiLineView;\n", " MultiLineView.__name__ = \"MultiLineView\";\n", " class MultiLine extends glyph_1.Glyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_MultiLine() {\n", " this.prototype.default_view = MultiLineView;\n", " this.coords([['xs', 'ys']]);\n", " this.mixins(property_mixins_1.LineVector);\n", " }\n", " }\n", " exports.MultiLine = MultiLine;\n", " MultiLine.__name__ = \"MultiLine\";\n", " MultiLine.init_MultiLine();\n", " },\n", " /* models/glyphs/multi_polygons.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const spatial_1 = require(85) /* ../../core/util/spatial */;\n", " const glyph_1 = require(89) /* ./glyph */;\n", " const utils_1 = require(92) /* ./utils */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const arrayable_1 = require(12) /* ../../core/util/arrayable */;\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const hittest = tslib_1.__importStar(require(93) /* ../../core/hittest */);\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const assert_1 = require(11) /* ../../core/util/assert */;\n", " class MultiPolygonsView extends glyph_1.GlyphView {\n", " _index_data() {\n", " const points = [];\n", " for (let i = 0, end = this._xs.length; i < end; i++) {\n", " for (let j = 0, endj = this._xs[i].length; j < endj; j++) {\n", " const xs = this._xs[i][j][0]; // do not use holes\n", " const ys = this._ys[i][j][0]; // do not use holes\n", " if (xs.length == 0)\n", " continue;\n", " points.push({ x0: array_1.min(xs), y0: array_1.min(ys), x1: array_1.max(xs), y1: array_1.max(ys), i });\n", " }\n", " }\n", " this.hole_index = this._index_hole_data(); // should this be set here?\n", " return new spatial_1.SpatialIndex(points);\n", " }\n", " _index_hole_data() {\n", " // need advice on how to use this sure if this could be more useful\n", " const points = [];\n", " for (let i = 0, end = this._xs.length; i < end; i++) {\n", " for (let j = 0, endj = this._xs[i].length; j < endj; j++) {\n", " if (this._xs[i][j].length > 1) {\n", " for (let k = 1, endk = this._xs[i][j].length; k < endk; k++) {\n", " const xs = this._xs[i][j][k]; // only use holes\n", " const ys = this._ys[i][j][k]; // only use holes\n", " if (xs.length == 0)\n", " continue;\n", " points.push({ x0: array_1.min(xs), y0: array_1.min(ys), x1: array_1.max(xs), y1: array_1.max(ys), i });\n", " }\n", " }\n", " }\n", " }\n", " return new spatial_1.SpatialIndex(points);\n", " }\n", " _mask_data() {\n", " const xr = this.renderer.plot_view.frame.x_ranges.default;\n", " const [x0, x1] = [xr.min, xr.max];\n", " const yr = this.renderer.plot_view.frame.y_ranges.default;\n", " const [y0, y1] = [yr.min, yr.max];\n", " const indices = this.index.indices({ x0, x1, y0, y1 });\n", " // TODO this is probably needed in patches as well so that we don't draw glyphs multiple times\n", " return indices.sort((a, b) => a - b).filter((value, index, array) => {\n", " return (index === 0) || (value !== array[index - 1]);\n", " });\n", " }\n", " _inner_loop(ctx, sx, sy) {\n", " ctx.beginPath();\n", " for (let j = 0, endj = sx.length; j < endj; j++) {\n", " for (let k = 0, endk = sx[j].length; k < endk; k++) {\n", " const _sx = sx[j][k];\n", " const _sy = sy[j][k];\n", " for (let l = 0, endl = _sx.length; l < endl; l++) {\n", " if (l == 0) {\n", " ctx.moveTo(_sx[l], _sy[l]);\n", " continue;\n", " }\n", " else\n", " ctx.lineTo(_sx[l], _sy[l]);\n", " }\n", " ctx.closePath();\n", " }\n", " }\n", " }\n", " _render(ctx, indices, { sxs, sys }) {\n", " if (this.visuals.fill.doit || this.visuals.line.doit) {\n", " for (const i of indices) {\n", " const [sx, sy] = [sxs[i], sys[i]];\n", " if (this.visuals.fill.doit) {\n", " this.visuals.fill.set_vectorize(ctx, i);\n", " this._inner_loop(ctx, sx, sy);\n", " ctx.fill(\"evenodd\");\n", " }\n", " this.visuals.hatch.doit2(ctx, i, () => {\n", " this._inner_loop(ctx, sx, sy);\n", " ctx.fill(\"evenodd\");\n", " }, () => this.renderer.request_render());\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_vectorize(ctx, i);\n", " this._inner_loop(ctx, sx, sy);\n", " ctx.stroke();\n", " }\n", " }\n", " }\n", " }\n", " _hit_rect(geometry) {\n", " const { sx0, sx1, sy0, sy1 } = geometry;\n", " const xs = [sx0, sx1, sx1, sx0];\n", " const ys = [sy0, sy0, sy1, sy1];\n", " const [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " const [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " const candidates = this.index.indices({ x0, x1, y0, y1 });\n", " const indices = [];\n", " for (let i = 0, end = candidates.length; i < end; i++) {\n", " const index = candidates[i];\n", " const sxss = this.sxs[index];\n", " const syss = this.sys[index];\n", " let hit = true;\n", " for (let j = 0, endj = sxss.length; j < endj; j++) {\n", " for (let k = 0, endk = sxss[j][0].length; k < endk; k++) {\n", " const sx = sxss[j][0][k];\n", " const sy = syss[j][0][k];\n", " if (!hittest.point_in_poly(sx, sy, xs, ys)) {\n", " hit = false;\n", " break;\n", " }\n", " }\n", " if (!hit)\n", " break;\n", " }\n", " if (hit) {\n", " indices.push(index);\n", " }\n", " }\n", " return new selection_1.Selection({ indices });\n", " }\n", " _hit_point(geometry) {\n", " const { sx, sy } = geometry;\n", " const x = this.renderer.xscale.invert(sx);\n", " const y = this.renderer.yscale.invert(sy);\n", " const candidates = this.index.indices({ x0: x, y0: y, x1: x, y1: y });\n", " const hole_candidates = this.hole_index.indices({ x0: x, y0: y, x1: x, y1: y });\n", " const indices = [];\n", " for (let i = 0, end = candidates.length; i < end; i++) {\n", " const index = candidates[i];\n", " const sxs = this.sxs[index];\n", " const sys = this.sys[index];\n", " for (let j = 0, endj = sxs.length; j < endj; j++) {\n", " const nk = sxs[j].length;\n", " if (hittest.point_in_poly(sx, sy, sxs[j][0], sys[j][0])) {\n", " if (nk == 1) {\n", " indices.push(index);\n", " }\n", " else if (hole_candidates.indexOf(index) == -1) {\n", " indices.push(index);\n", " }\n", " else if (nk > 1) {\n", " let in_a_hole = false;\n", " for (let k = 1; k < nk; k++) {\n", " const sxs_k = sxs[j][k];\n", " const sys_k = sys[j][k];\n", " if (hittest.point_in_poly(sx, sy, sxs_k, sys_k)) {\n", " in_a_hole = true;\n", " break;\n", " }\n", " else {\n", " continue;\n", " }\n", " }\n", " if (!in_a_hole) {\n", " indices.push(index);\n", " }\n", " }\n", " }\n", " }\n", " }\n", " return new selection_1.Selection({ indices });\n", " }\n", " _get_snap_coord(array) {\n", " return arrayable_1.sum(array) / array.length;\n", " }\n", " scenterx(i, sx, sy) {\n", " if (this.sxs[i].length == 1) {\n", " // We don't have discontinuous objects so we're ok\n", " return this._get_snap_coord(this.sxs[i][0][0]);\n", " }\n", " else {\n", " // We have discontinuous objects, so we need to find which\n", " // one we're in, we can use point_in_poly again\n", " const sxs = this.sxs[i];\n", " const sys = this.sys[i];\n", " for (let j = 0, end = sxs.length; j < end; j++) {\n", " if (hittest.point_in_poly(sx, sy, sxs[j][0], sys[j][0]))\n", " return this._get_snap_coord(sxs[j][0]);\n", " }\n", " }\n", " assert_1.unreachable();\n", " }\n", " scentery(i, sx, sy) {\n", " if (this.sys[i].length == 1) {\n", " // We don't have discontinuous objects so we're ok\n", " return this._get_snap_coord(this.sys[i][0][0]);\n", " }\n", " else {\n", " // We have discontinuous objects, so we need to find which\n", " // one we're in, we can use point_in_poly again\n", " const sxs = this.sxs[i];\n", " const sys = this.sys[i];\n", " for (let j = 0, end = sxs.length; j < end; j++) {\n", " if (hittest.point_in_poly(sx, sy, sxs[j][0], sys[j][0]))\n", " return this._get_snap_coord(sys[j][0]);\n", " }\n", " }\n", " assert_1.unreachable();\n", " }\n", " map_data() {\n", " const self = this;\n", " for (let [xname, yname] of this.model._coords) {\n", " const sxname = `s${xname}`;\n", " const syname = `s${yname}`;\n", " xname = `_${xname}`;\n", " yname = `_${yname}`;\n", " if (self[xname] != null && (types_1.isArray(self[xname][0]) || types_1.isTypedArray(self[xname][0]))) {\n", " const ni = self[xname].length;\n", " self[sxname] = new Array(ni);\n", " self[syname] = new Array(ni);\n", " for (let i = 0; i < ni; i++) {\n", " const nj = self[xname][i].length;\n", " self[sxname][i] = new Array(nj);\n", " self[syname][i] = new Array(nj);\n", " for (let j = 0; j < nj; j++) {\n", " const nk = self[xname][i][j].length;\n", " self[sxname][i][j] = new Array(nk);\n", " self[syname][i][j] = new Array(nk);\n", " for (let k = 0; k < nk; k++) {\n", " const [sx, sy] = this.map_to_screen(self[xname][i][j][k], self[yname][i][j][k]);\n", " self[sxname][i][j][k] = sx;\n", " self[syname][i][j][k] = sy;\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " draw_legend_for_index(ctx, bbox, index) {\n", " utils_1.generic_area_legend(this.visuals, ctx, bbox, index);\n", " }\n", " }\n", " exports.MultiPolygonsView = MultiPolygonsView;\n", " MultiPolygonsView.__name__ = \"MultiPolygonsView\";\n", " class MultiPolygons extends glyph_1.Glyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_MultiPolygons() {\n", " this.prototype.default_view = MultiPolygonsView;\n", " this.coords([['xs', 'ys']]);\n", " this.mixins([property_mixins_1.LineVector, property_mixins_1.FillVector, property_mixins_1.HatchVector]);\n", " }\n", " }\n", " exports.MultiPolygons = MultiPolygons;\n", " MultiPolygons.__name__ = \"MultiPolygons\";\n", " MultiPolygons.init_MultiPolygons();\n", " },\n", " /* models/glyphs/oval.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const ellipse_oval_1 = require(216) /* ./ellipse_oval */;\n", " class OvalView extends ellipse_oval_1.EllipseOvalView {\n", " _map_data() {\n", " super._map_data();\n", " // oval drawn from bezier curves = ellipse with width reduced by 3/4\n", " const { sw } = this;\n", " const n = sw.length;\n", " for (let i = 0; i < n; i++) {\n", " sw[i] *= 0.75;\n", " }\n", " }\n", " }\n", " exports.OvalView = OvalView;\n", " OvalView.__name__ = \"OvalView\";\n", " class Oval extends ellipse_oval_1.EllipseOval {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Oval() {\n", " this.prototype.default_view = OvalView;\n", " }\n", " }\n", " exports.Oval = Oval;\n", " Oval.__name__ = \"Oval\";\n", " Oval.init_Oval();\n", " },\n", " /* models/glyphs/patches.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const spatial_1 = require(85) /* ../../core/util/spatial */;\n", " const glyph_1 = require(89) /* ./glyph */;\n", " const utils_1 = require(92) /* ./utils */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const arrayable_1 = require(12) /* ../../core/util/arrayable */;\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const hittest = tslib_1.__importStar(require(93) /* ../../core/hittest */);\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " const assert_1 = require(11) /* ../../core/util/assert */;\n", " class PatchesView extends glyph_1.GlyphView {\n", " _build_discontinuous_object(nanned_qs) {\n", " // _s is this.xs, this.ys, this.sxs, this.sys\n", " // an object of n 1-d arrays in either data or screen units\n", " //\n", " // Each 1-d array gets broken to an array of arrays split\n", " // on any NaNs\n", " //\n", " // So:\n", " // { 0: [x11, x12],\n", " // 1: [x21, x22, x23],\n", " // 2: [x31, NaN, x32]\n", " // }\n", " // becomes\n", " // { 0: [[x11, x12]],\n", " // 1: [[x21, x22, x23]],\n", " // 2: [[x31],[x32]]\n", " // }\n", " const ds = [];\n", " for (let i = 0, end = nanned_qs.length; i < end; i++) {\n", " ds[i] = [];\n", " let qs = array_1.copy(nanned_qs[i]);\n", " while (qs.length > 0) {\n", " const nan_index = array_1.find_last_index(qs, (q) => isNaN(q));\n", " let qs_part;\n", " if (nan_index >= 0)\n", " qs_part = qs.splice(nan_index);\n", " else {\n", " qs_part = qs;\n", " qs = [];\n", " }\n", " const denanned = qs_part.filter((q) => !isNaN(q));\n", " ds[i].push(denanned);\n", " }\n", " }\n", " return ds;\n", " }\n", " _index_data() {\n", " const xss = this._build_discontinuous_object(this._xs); // XXX\n", " const yss = this._build_discontinuous_object(this._ys); // XXX\n", " const points = [];\n", " for (let i = 0, end = this._xs.length; i < end; i++) {\n", " for (let j = 0, endj = xss[i].length; j < endj; j++) {\n", " const xs = xss[i][j];\n", " const ys = yss[i][j];\n", " if (xs.length == 0)\n", " continue;\n", " points.push({ x0: array_1.min(xs), y0: array_1.min(ys), x1: array_1.max(xs), y1: array_1.max(ys), i });\n", " }\n", " }\n", " return new spatial_1.SpatialIndex(points);\n", " }\n", " _mask_data() {\n", " const xr = this.renderer.plot_view.frame.x_ranges.default;\n", " const [x0, x1] = [xr.min, xr.max];\n", " const yr = this.renderer.plot_view.frame.y_ranges.default;\n", " const [y0, y1] = [yr.min, yr.max];\n", " const indices = this.index.indices({ x0, x1, y0, y1 });\n", " // TODO (bev) this should be under test\n", " return indices.sort((a, b) => a - b);\n", " }\n", " _inner_loop(ctx, sx, sy, func) {\n", " for (let j = 0, end = sx.length; j < end; j++) {\n", " if (j == 0) {\n", " ctx.beginPath();\n", " ctx.moveTo(sx[j], sy[j]);\n", " continue;\n", " }\n", " else if (isNaN(sx[j] + sy[j])) {\n", " ctx.closePath();\n", " func.apply(ctx);\n", " ctx.beginPath();\n", " continue;\n", " }\n", " else\n", " ctx.lineTo(sx[j], sy[j]);\n", " }\n", " ctx.closePath();\n", " func.call(ctx);\n", " }\n", " _render(ctx, indices, { sxs, sys }) {\n", " // this.sxss and this.syss are used by _hit_point and sxc, syc\n", " // This is the earliest we can build them, and only build them once\n", " this.sxss = this._build_discontinuous_object(sxs); // XXX\n", " this.syss = this._build_discontinuous_object(sys); // XXX\n", " for (const i of indices) {\n", " const [sx, sy] = [sxs[i], sys[i]];\n", " if (this.visuals.fill.doit) {\n", " this.visuals.fill.set_vectorize(ctx, i);\n", " this._inner_loop(ctx, sx, sy, ctx.fill);\n", " }\n", " this.visuals.hatch.doit2(ctx, i, () => this._inner_loop(ctx, sx, sy, ctx.fill), () => this.renderer.request_render());\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_vectorize(ctx, i);\n", " this._inner_loop(ctx, sx, sy, ctx.stroke);\n", " }\n", " }\n", " }\n", " _hit_rect(geometry) {\n", " const { sx0, sx1, sy0, sy1 } = geometry;\n", " const xs = [sx0, sx1, sx1, sx0];\n", " const ys = [sy0, sy0, sy1, sy1];\n", " const [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " const [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " const candidates = this.index.indices({ x0, x1, y0, y1 });\n", " const indices = [];\n", " for (let i = 0, end = candidates.length; i < end; i++) {\n", " const index = candidates[i];\n", " const sxss = this.sxs[index];\n", " const syss = this.sys[index];\n", " let hit = true;\n", " for (let j = 0, endj = sxss.length; j < endj; j++) {\n", " const sx = sxss[j];\n", " const sy = syss[j];\n", " if (!hittest.point_in_poly(sx, sy, xs, ys)) {\n", " hit = false;\n", " break;\n", " }\n", " }\n", " if (hit) {\n", " indices.push(index);\n", " }\n", " }\n", " return new selection_1.Selection({ indices });\n", " }\n", " _hit_point(geometry) {\n", " const { sx, sy } = geometry;\n", " const x = this.renderer.xscale.invert(sx);\n", " const y = this.renderer.yscale.invert(sy);\n", " const candidates = this.index.indices({ x0: x, y0: y, x1: x, y1: y });\n", " const indices = [];\n", " for (let i = 0, end = candidates.length; i < end; i++) {\n", " const index = candidates[i];\n", " const sxs = this.sxss[index];\n", " const sys = this.syss[index];\n", " for (let j = 0, endj = sxs.length; j < endj; j++) {\n", " if (hittest.point_in_poly(sx, sy, sxs[j], sys[j])) {\n", " indices.push(index);\n", " }\n", " }\n", " }\n", " return new selection_1.Selection({ indices });\n", " }\n", " _get_snap_coord(array) {\n", " return arrayable_1.sum(array) / array.length;\n", " }\n", " scenterx(i, sx, sy) {\n", " if (this.sxss[i].length == 1) {\n", " // We don't have discontinuous objects so we're ok\n", " return this._get_snap_coord(this.sxs[i]);\n", " }\n", " else {\n", " // We have discontinuous objects, so we need to find which\n", " // one we're in, we can use point_in_poly again\n", " const sxs = this.sxss[i];\n", " const sys = this.syss[i];\n", " for (let j = 0, end = sxs.length; j < end; j++) {\n", " if (hittest.point_in_poly(sx, sy, sxs[j], sys[j]))\n", " return this._get_snap_coord(sxs[j]);\n", " }\n", " }\n", " assert_1.unreachable();\n", " }\n", " scentery(i, sx, sy) {\n", " if (this.syss[i].length == 1) {\n", " // We don't have discontinuous objects so we're ok\n", " return this._get_snap_coord(this.sys[i]);\n", " }\n", " else {\n", " // We have discontinuous objects, so we need to find which\n", " // one we're in, we can use point_in_poly again\n", " const sxs = this.sxss[i];\n", " const sys = this.syss[i];\n", " for (let j = 0, end = sxs.length; j < end; j++) {\n", " if (hittest.point_in_poly(sx, sy, sxs[j], sys[j]))\n", " return this._get_snap_coord(sys[j]);\n", " }\n", " }\n", " assert_1.unreachable();\n", " }\n", " draw_legend_for_index(ctx, bbox, index) {\n", " utils_1.generic_area_legend(this.visuals, ctx, bbox, index);\n", " }\n", " }\n", " exports.PatchesView = PatchesView;\n", " PatchesView.__name__ = \"PatchesView\";\n", " class Patches extends glyph_1.Glyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Patches() {\n", " this.prototype.default_view = PatchesView;\n", " this.coords([['xs', 'ys']]);\n", " this.mixins([property_mixins_1.LineVector, property_mixins_1.FillVector, property_mixins_1.HatchVector]);\n", " }\n", " }\n", " exports.Patches = Patches;\n", " Patches.__name__ = \"Patches\";\n", " Patches.init_Patches();\n", " },\n", " /* models/glyphs/quad.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const box_1 = require(218) /* ./box */;\n", " class QuadView extends box_1.BoxView {\n", " scenterx(i) {\n", " return (this.sleft[i] + this.sright[i]) / 2;\n", " }\n", " scentery(i) {\n", " return (this.stop[i] + this.sbottom[i]) / 2;\n", " }\n", " _index_data() {\n", " return this._index_box(this._right.length);\n", " }\n", " _lrtb(i) {\n", " const l = this._left[i];\n", " const r = this._right[i];\n", " const t = this._top[i];\n", " const b = this._bottom[i];\n", " return [l, r, t, b];\n", " }\n", " }\n", " exports.QuadView = QuadView;\n", " QuadView.__name__ = \"QuadView\";\n", " class Quad extends box_1.Box {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Quad() {\n", " this.prototype.default_view = QuadView;\n", " this.coords([['right', 'bottom'], ['left', 'top']]);\n", " }\n", " }\n", " exports.Quad = Quad;\n", " Quad.__name__ = \"Quad\";\n", " Quad.init_Quad();\n", " },\n", " /* models/glyphs/quadratic.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const spatial_1 = require(85) /* ../../core/util/spatial */;\n", " const glyph_1 = require(89) /* ./glyph */;\n", " const utils_1 = require(92) /* ./utils */;\n", " // Formula from: http://pomax.nihongoresources.com/pages/bezier/\n", " //\n", " // if segment is quadratic bezier do:\n", " // for both directions do:\n", " // if control between start and end, compute linear bounding box\n", " // otherwise, compute\n", " // bound = u(1-t)^2 + 2v(1-t)t + wt^2\n", " // (with t = ((u-v) / (u-2v+w)), with {u = start, v = control, w = end})\n", " // if control precedes start, min = bound, otherwise max = bound\n", " function _qbb(u, v, w) {\n", " if (v == (u + w) / 2)\n", " return [u, w];\n", " else {\n", " const t = (u - v) / ((u - (2 * v)) + w);\n", " const bd = (u * (1 - t) ** 2) + (2 * v * (1 - t) * t) + (w * t ** 2);\n", " return [Math.min(u, w, bd), Math.max(u, w, bd)];\n", " }\n", " }\n", " class QuadraticView extends glyph_1.GlyphView {\n", " _index_data() {\n", " const points = [];\n", " for (let i = 0, end = this._x0.length; i < end; i++) {\n", " if (isNaN(this._x0[i] + this._x1[i] + this._y0[i] + this._y1[i] + this._cx[i] + this._cy[i]))\n", " continue;\n", " const [x0, x1] = _qbb(this._x0[i], this._cx[i], this._x1[i]);\n", " const [y0, y1] = _qbb(this._y0[i], this._cy[i], this._y1[i]);\n", " points.push({ x0, y0, x1, y1, i });\n", " }\n", " return new spatial_1.SpatialIndex(points);\n", " }\n", " _render(ctx, indices, { sx0, sy0, sx1, sy1, scx, scy }) {\n", " if (this.visuals.line.doit) {\n", " for (const i of indices) {\n", " if (isNaN(sx0[i] + sy0[i] + sx1[i] + sy1[i] + scx[i] + scy[i]))\n", " continue;\n", " ctx.beginPath();\n", " ctx.moveTo(sx0[i], sy0[i]);\n", " ctx.quadraticCurveTo(scx[i], scy[i], sx1[i], sy1[i]);\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " }\n", " draw_legend_for_index(ctx, bbox, index) {\n", " utils_1.generic_line_legend(this.visuals, ctx, bbox, index);\n", " }\n", " scenterx() {\n", " throw new Error(\"not implemented\");\n", " }\n", " scentery() {\n", " throw new Error(\"not implemented\");\n", " }\n", " }\n", " exports.QuadraticView = QuadraticView;\n", " QuadraticView.__name__ = \"QuadraticView\";\n", " class Quadratic extends glyph_1.Glyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Quadratic() {\n", " this.prototype.default_view = QuadraticView;\n", " this.coords([['x0', 'y0'], ['x1', 'y1'], ['cx', 'cy']]);\n", " this.mixins(property_mixins_1.LineVector);\n", " }\n", " }\n", " exports.Quadratic = Quadratic;\n", " Quadratic.__name__ = \"Quadratic\";\n", " Quadratic.init_Quadratic();\n", " },\n", " /* models/glyphs/ray.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const xy_glyph_1 = require(84) /* ./xy_glyph */;\n", " const utils_1 = require(92) /* ./utils */;\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class RayView extends xy_glyph_1.XYGlyphView {\n", " _map_data() {\n", " if (this.model.properties.length.units == \"data\")\n", " this.slength = this.sdist(this.renderer.xscale, this._x, this._length);\n", " else\n", " this.slength = this._length;\n", " }\n", " _render(ctx, indices, { sx, sy, slength, _angle }) {\n", " if (this.visuals.line.doit) {\n", " const width = this.renderer.plot_view.frame._width.value;\n", " const height = this.renderer.plot_view.frame._height.value;\n", " const inf_len = 2 * (width + height);\n", " for (let i = 0, end = slength.length; i < end; i++) {\n", " if (slength[i] == 0)\n", " slength[i] = inf_len;\n", " }\n", " for (const i of indices) {\n", " if (isNaN(sx[i] + sy[i] + _angle[i] + slength[i]))\n", " continue;\n", " ctx.translate(sx[i], sy[i]);\n", " ctx.rotate(_angle[i]);\n", " ctx.beginPath();\n", " ctx.moveTo(0, 0);\n", " ctx.lineTo(slength[i], 0);\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " ctx.rotate(-_angle[i]);\n", " ctx.translate(-sx[i], -sy[i]);\n", " }\n", " }\n", " }\n", " draw_legend_for_index(ctx, bbox, index) {\n", " utils_1.generic_line_legend(this.visuals, ctx, bbox, index);\n", " }\n", " }\n", " exports.RayView = RayView;\n", " RayView.__name__ = \"RayView\";\n", " class Ray extends xy_glyph_1.XYGlyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Ray() {\n", " this.prototype.default_view = RayView;\n", " this.mixins(property_mixins_1.LineVector);\n", " this.define({\n", " length: [p.DistanceSpec],\n", " angle: [p.AngleSpec],\n", " });\n", " }\n", " }\n", " exports.Ray = Ray;\n", " Ray.__name__ = \"Ray\";\n", " Ray.init_Ray();\n", " },\n", " /* models/glyphs/rect.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const center_rotatable_1 = require(214) /* ./center_rotatable */;\n", " const utils_1 = require(92) /* ./utils */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const arrayable_1 = require(12) /* ../../core/util/arrayable */;\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class RectView extends center_rotatable_1.CenterRotatableView {\n", " _set_data() {\n", " this.max_w2 = 0;\n", " if (this.model.properties.width.units == \"data\")\n", " this.max_w2 = this.max_width / 2;\n", " this.max_h2 = 0;\n", " if (this.model.properties.height.units == \"data\")\n", " this.max_h2 = this.max_height / 2;\n", " }\n", " _map_data() {\n", " if (this.model.properties.width.units == \"data\")\n", " [this.sw, this.sx0] = this._map_dist_corner_for_data_side_length(this._x, this._width, this.renderer.xscale);\n", " else {\n", " this.sw = this._width;\n", " const n = this.sx.length;\n", " this.sx0 = new Float64Array(n);\n", " for (let i = 0; i < n; i++)\n", " this.sx0[i] = this.sx[i] - this.sw[i] / 2;\n", " }\n", " if (this.model.properties.height.units == \"data\")\n", " [this.sh, this.sy1] = this._map_dist_corner_for_data_side_length(this._y, this._height, this.renderer.yscale);\n", " else {\n", " this.sh = this._height;\n", " const n = this.sy.length;\n", " this.sy1 = new Float64Array(n);\n", " for (let i = 0; i < n; i++)\n", " this.sy1[i] = this.sy[i] - this.sh[i] / 2;\n", " }\n", " const n = this.sw.length;\n", " this.ssemi_diag = new Float64Array(n);\n", " for (let i = 0; i < n; i++)\n", " this.ssemi_diag[i] = Math.sqrt((this.sw[i] / 2 * this.sw[i]) / 2 + (this.sh[i] / 2 * this.sh[i]) / 2);\n", " }\n", " _render(ctx, indices, { sx, sy, sx0, sy1, sw, sh, _angle }) {\n", " if (this.visuals.fill.doit) {\n", " for (const i of indices) {\n", " if (isNaN(sx[i] + sy[i] + sx0[i] + sy1[i] + sw[i] + sh[i] + _angle[i]))\n", " continue;\n", " //no need to test the return value, we call fillRect for every glyph anyway\n", " this.visuals.fill.set_vectorize(ctx, i);\n", " if (_angle[i]) {\n", " ctx.translate(sx[i], sy[i]);\n", " ctx.rotate(_angle[i]);\n", " ctx.fillRect(-sw[i] / 2, -sh[i] / 2, sw[i], sh[i]);\n", " ctx.rotate(-_angle[i]);\n", " ctx.translate(-sx[i], -sy[i]);\n", " }\n", " else\n", " ctx.fillRect(sx0[i], sy1[i], sw[i], sh[i]);\n", " }\n", " }\n", " if (this.visuals.line.doit) {\n", " ctx.beginPath();\n", " for (const i of indices) {\n", " if (isNaN(sx[i] + sy[i] + sx0[i] + sy1[i] + sw[i] + sh[i] + _angle[i]))\n", " continue;\n", " // fillRect does not fill zero-height or -width rects, but rect(...)\n", " // does seem to stroke them (1px wide or tall). Explicitly ignore rects\n", " // with zero width or height to be consistent\n", " if (sw[i] == 0 || sh[i] == 0)\n", " continue;\n", " if (_angle[i]) {\n", " ctx.translate(sx[i], sy[i]);\n", " ctx.rotate(_angle[i]);\n", " ctx.rect(-sw[i] / 2, -sh[i] / 2, sw[i], sh[i]);\n", " ctx.rotate(-_angle[i]);\n", " ctx.translate(-sx[i], -sy[i]);\n", " }\n", " else\n", " ctx.rect(sx0[i], sy1[i], sw[i], sh[i]);\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " ctx.beginPath();\n", " }\n", " ctx.stroke();\n", " }\n", " }\n", " _hit_rect(geometry) {\n", " return this._hit_rect_against_index(geometry);\n", " }\n", " _hit_point(geometry) {\n", " let { sx, sy } = geometry;\n", " const x = this.renderer.xscale.invert(sx);\n", " const y = this.renderer.yscale.invert(sy);\n", " const scenter_x = [];\n", " for (let i = 0, end = this.sx0.length; i < end; i++) {\n", " scenter_x.push(this.sx0[i] + this.sw[i] / 2);\n", " }\n", " const scenter_y = [];\n", " for (let i = 0, end = this.sy1.length; i < end; i++) {\n", " scenter_y.push(this.sy1[i] + this.sh[i] / 2);\n", " }\n", " const max_x2_ddist = arrayable_1.max(this._ddist(0, scenter_x, this.ssemi_diag));\n", " const max_y2_ddist = arrayable_1.max(this._ddist(1, scenter_y, this.ssemi_diag));\n", " const x0 = x - max_x2_ddist;\n", " const x1 = x + max_x2_ddist;\n", " const y0 = y - max_y2_ddist;\n", " const y1 = y + max_y2_ddist;\n", " const indices = [];\n", " for (const i of this.index.indices({ x0, x1, y0, y1 })) {\n", " let height_in, width_in;\n", " if (this._angle[i]) {\n", " const s = Math.sin(-this._angle[i]);\n", " const c = Math.cos(-this._angle[i]);\n", " const px = c * (sx - this.sx[i]) - s * (sy - this.sy[i]) + this.sx[i];\n", " const py = s * (sx - this.sx[i]) + c * (sy - this.sy[i]) + this.sy[i];\n", " sx = px;\n", " sy = py;\n", " width_in = Math.abs(this.sx[i] - sx) <= this.sw[i] / 2;\n", " height_in = Math.abs(this.sy[i] - sy) <= this.sh[i] / 2;\n", " }\n", " else {\n", " width_in = (sx - this.sx0[i] <= this.sw[i]) && (sx - this.sx0[i] >= 0);\n", " height_in = (sy - this.sy1[i] <= this.sh[i]) && (sy - this.sy1[i] >= 0);\n", " }\n", " if (height_in && width_in) {\n", " indices.push(i);\n", " }\n", " }\n", " return new selection_1.Selection({ indices });\n", " }\n", " _map_dist_corner_for_data_side_length(coord, side_length, scale) {\n", " const n = coord.length;\n", " const pt0 = new Float64Array(n);\n", " const pt1 = new Float64Array(n);\n", " for (let i = 0; i < n; i++) {\n", " pt0[i] = Number(coord[i]) - side_length[i] / 2;\n", " pt1[i] = Number(coord[i]) + side_length[i] / 2;\n", " }\n", " const spt0 = scale.v_compute(pt0);\n", " const spt1 = scale.v_compute(pt1);\n", " const sside_length = this.sdist(scale, pt0, side_length, 'edge', this.model.dilate);\n", " let spt_corner = spt0;\n", " for (let i = 0, end = spt0.length; i < end; i++) {\n", " if (spt0[i] != spt1[i]) {\n", " spt_corner = spt0[i] < spt1[i] ? spt0 : spt1;\n", " break;\n", " }\n", " }\n", " return [sside_length, spt_corner];\n", " }\n", " _ddist(dim, spts, spans) {\n", " const scale = dim == 0 ? this.renderer.xscale : this.renderer.yscale;\n", " const spt0 = spts;\n", " const m = spt0.length;\n", " const spt1 = new Float64Array(m);\n", " for (let i = 0; i < m; i++)\n", " spt1[i] = spt0[i] + spans[i];\n", " const pt0 = scale.v_invert(spt0);\n", " const pt1 = scale.v_invert(spt1);\n", " const n = pt0.length;\n", " const ddist = new Float64Array(n);\n", " for (let i = 0; i < n; i++)\n", " ddist[i] = Math.abs(pt1[i] - pt0[i]);\n", " return ddist;\n", " }\n", " draw_legend_for_index(ctx, bbox, index) {\n", " utils_1.generic_area_legend(this.visuals, ctx, bbox, index);\n", " }\n", " _bounds({ x0, x1, y0, y1 }) {\n", " return {\n", " x0: x0 - this.max_w2,\n", " x1: x1 + this.max_w2,\n", " y0: y0 - this.max_h2,\n", " y1: y1 + this.max_h2,\n", " };\n", " }\n", " }\n", " exports.RectView = RectView;\n", " RectView.__name__ = \"RectView\";\n", " class Rect extends center_rotatable_1.CenterRotatable {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Rect() {\n", " this.prototype.default_view = RectView;\n", " this.define({\n", " dilate: [p.Boolean, false],\n", " });\n", " }\n", " }\n", " exports.Rect = Rect;\n", " Rect.__name__ = \"Rect\";\n", " Rect.init_Rect();\n", " },\n", " /* models/glyphs/segment.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const hittest = tslib_1.__importStar(require(93) /* ../../core/hittest */);\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const spatial_1 = require(85) /* ../../core/util/spatial */;\n", " const glyph_1 = require(89) /* ./glyph */;\n", " const utils_1 = require(92) /* ./utils */;\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class SegmentView extends glyph_1.GlyphView {\n", " _index_data() {\n", " const points = [];\n", " for (let i = 0, end = this._x0.length; i < end; i++) {\n", " const x0 = this._x0[i];\n", " const x1 = this._x1[i];\n", " const y0 = this._y0[i];\n", " const y1 = this._y1[i];\n", " if (!isNaN(x0 + x1 + y0 + y1)) {\n", " points.push({\n", " x0: Math.min(x0, x1),\n", " y0: Math.min(y0, y1),\n", " x1: Math.max(x0, x1),\n", " y1: Math.max(y0, y1),\n", " i,\n", " });\n", " }\n", " }\n", " return new spatial_1.SpatialIndex(points);\n", " }\n", " _render(ctx, indices, { sx0, sy0, sx1, sy1 }) {\n", " if (this.visuals.line.doit) {\n", " for (const i of indices) {\n", " if (isNaN(sx0[i] + sy0[i] + sx1[i] + sy1[i]))\n", " continue;\n", " ctx.beginPath();\n", " ctx.moveTo(sx0[i], sy0[i]);\n", " ctx.lineTo(sx1[i], sy1[i]);\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " }\n", " _hit_point(geometry) {\n", " const { sx, sy } = geometry;\n", " const point = { x: sx, y: sy };\n", " const lw_voffset = 2; // FIXME: Use maximum of segments line_width/2 instead of magic constant 2\n", " const [x0, x1] = this.renderer.xscale.r_invert(sx - lw_voffset, sx + lw_voffset);\n", " const [y0, y1] = this.renderer.yscale.r_invert(sy - lw_voffset, sy + lw_voffset);\n", " const candidates = this.index.indices({ x0, y0, x1, y1 });\n", " const indices = [];\n", " for (const i of candidates) {\n", " const threshold2 = Math.max(2, this.visuals.line.cache_select('line_width', i) / 2) ** 2;\n", " const p0 = { x: this.sx0[i], y: this.sy0[i] };\n", " const p1 = { x: this.sx1[i], y: this.sy1[i] };\n", " const dist2 = hittest.dist_to_segment_squared(point, p0, p1);\n", " if (dist2 < threshold2) {\n", " indices.push(i);\n", " }\n", " }\n", " return new selection_1.Selection({ indices });\n", " }\n", " _hit_span(geometry) {\n", " const [hr, vr] = this.renderer.plot_view.frame.bbox.ranges;\n", " const { sx, sy } = geometry;\n", " let v0;\n", " let v1;\n", " let val;\n", " if (geometry.direction == 'v') {\n", " val = this.renderer.yscale.invert(sy);\n", " [v0, v1] = [this._y0, this._y1];\n", " }\n", " else {\n", " val = this.renderer.xscale.invert(sx);\n", " [v0, v1] = [this._x0, this._x1];\n", " }\n", " const indices = [];\n", " const [x0, x1] = this.renderer.xscale.r_invert(hr.start, hr.end);\n", " const [y0, y1] = this.renderer.yscale.r_invert(vr.start, vr.end);\n", " const candidates = this.index.indices({ x0, y0, x1, y1 });\n", " for (const i of candidates) {\n", " if ((v0[i] <= val && val <= v1[i]) || (v1[i] <= val && val <= v0[i]))\n", " indices.push(i);\n", " const threshold = 1.5 + (this.visuals.line.cache_select('line_width', i) / 2); // Maximum pixel difference to detect hit\n", " if (v0[i] == v1[i]) {\n", " if (geometry.direction == 'h') {\n", " if (Math.abs(this.sx0[i] - sx) <= threshold) {\n", " indices.push(i);\n", " }\n", " }\n", " else {\n", " if (Math.abs(this.sy0[i] - sy) <= threshold) {\n", " indices.push(i);\n", " }\n", " }\n", " }\n", " }\n", " return new selection_1.Selection({ indices });\n", " }\n", " scenterx(i) {\n", " return (this.sx0[i] + this.sx1[i]) / 2;\n", " }\n", " scentery(i) {\n", " return (this.sy0[i] + this.sy1[i]) / 2;\n", " }\n", " draw_legend_for_index(ctx, bbox, index) {\n", " utils_1.generic_line_legend(this.visuals, ctx, bbox, index);\n", " }\n", " }\n", " exports.SegmentView = SegmentView;\n", " SegmentView.__name__ = \"SegmentView\";\n", " class Segment extends glyph_1.Glyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Segment() {\n", " this.prototype.default_view = SegmentView;\n", " this.coords([['x0', 'y0'], ['x1', 'y1']]);\n", " this.mixins(property_mixins_1.LineVector);\n", " }\n", " }\n", " exports.Segment = Segment;\n", " Segment.__name__ = \"Segment\";\n", " Segment.init_Segment();\n", " },\n", " /* models/glyphs/step.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const xy_glyph_1 = require(84) /* ./xy_glyph */;\n", " const utils_1 = require(92) /* ./utils */;\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class StepView extends xy_glyph_1.XYGlyphView {\n", " _render(ctx, indices, { sx, sy }) {\n", " let drawing = false;\n", " let last_index = null;\n", " this.visuals.line.set_value(ctx);\n", " const L = indices.length;\n", " if (L < 2)\n", " return;\n", " ctx.beginPath();\n", " ctx.moveTo(sx[0], sy[0]);\n", " for (const i of indices) {\n", " let x1, x2;\n", " let y1, y2;\n", " switch (this.model.mode) {\n", " case \"before\": {\n", " [x1, y1] = [sx[i - 1], sy[i]];\n", " [x2, y2] = [sx[i], sy[i]];\n", " break;\n", " }\n", " case \"after\": {\n", " [x1, y1] = [sx[i], sy[i - 1]];\n", " [x2, y2] = [sx[i], sy[i]];\n", " break;\n", " }\n", " case \"center\": {\n", " const xm = (sx[i - 1] + sx[i]) / 2;\n", " [x1, y1] = [xm, sy[i - 1]];\n", " [x2, y2] = [xm, sy[i]];\n", " break;\n", " }\n", " default:\n", " throw new Error(\"unexpected\");\n", " }\n", " if (drawing) {\n", " if (!isFinite(sx[i] + sy[i])) {\n", " ctx.stroke();\n", " ctx.beginPath();\n", " drawing = false;\n", " last_index = i;\n", " continue;\n", " }\n", " if (last_index != null && i - last_index > 1) {\n", " ctx.stroke();\n", " drawing = false;\n", " }\n", " }\n", " if (drawing) {\n", " ctx.lineTo(x1, y1);\n", " ctx.lineTo(x2, y2);\n", " }\n", " else {\n", " ctx.beginPath();\n", " ctx.moveTo(sx[i], sy[i]);\n", " drawing = true;\n", " }\n", " last_index = i;\n", " }\n", " ctx.lineTo(sx[L - 1], sy[L - 1]);\n", " ctx.stroke();\n", " }\n", " draw_legend_for_index(ctx, bbox, index) {\n", " utils_1.generic_line_legend(this.visuals, ctx, bbox, index);\n", " }\n", " }\n", " exports.StepView = StepView;\n", " StepView.__name__ = \"StepView\";\n", " class Step extends xy_glyph_1.XYGlyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Step() {\n", " this.prototype.default_view = StepView;\n", " this.mixins(property_mixins_1.LineVector);\n", " this.define({\n", " mode: [p.StepMode, \"before\"],\n", " });\n", " }\n", " }\n", " exports.Step = Step;\n", " Step.__name__ = \"Step\";\n", " Step.init_Step();\n", " },\n", " /* models/glyphs/text.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const xy_glyph_1 = require(84) /* ./xy_glyph */;\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const hittest = tslib_1.__importStar(require(93) /* ../../core/hittest */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const text_1 = require(132) /* ../../core/util/text */;\n", " const assert_1 = require(11) /* ../../core/util/assert */;\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class TextView extends xy_glyph_1.XYGlyphView {\n", " _rotate_point(x, y, xoff, yoff, angle) {\n", " const sxr = (x - xoff) * Math.cos(angle) - (y - yoff) * Math.sin(angle) + xoff;\n", " const syr = (x - xoff) * Math.sin(angle) + (y - yoff) * Math.cos(angle) + yoff;\n", " return [sxr, syr];\n", " }\n", " _text_bounds(x0, y0, width, height) {\n", " const xvals = [x0, x0 + width, x0 + width, x0, x0];\n", " const yvals = [y0, y0, y0 - height, y0 - height, y0];\n", " return [xvals, yvals];\n", " }\n", " _render(ctx, indices, { sx, sy, _x_offset, _y_offset, _angle, _text }) {\n", " this._sys = [];\n", " this._sxs = [];\n", " for (const i of indices) {\n", " this._sxs[i] = [];\n", " this._sys[i] = [];\n", " if (isNaN(sx[i] + sy[i] + _x_offset[i] + _y_offset[i] + _angle[i]) || _text[i] == null)\n", " continue;\n", " if (this.visuals.text.doit) {\n", " const text = `${_text[i]}`;\n", " ctx.save();\n", " ctx.translate(sx[i] + _x_offset[i], sy[i] + _y_offset[i]);\n", " ctx.rotate(_angle[i]);\n", " this.visuals.text.set_vectorize(ctx, i);\n", " const font = this.visuals.text.cache_select(\"font\", i);\n", " const { height } = text_1.measure_font(font);\n", " const line_height = this.visuals.text.text_line_height.value() * height;\n", " if (text.indexOf(\"\\n\") == -1) {\n", " ctx.fillText(text, 0, 0);\n", " const x0 = sx[i] + _x_offset[i];\n", " const y0 = sy[i] + _y_offset[i];\n", " const width = ctx.measureText(text).width;\n", " const [xvalues, yvalues] = this._text_bounds(x0, y0, width, line_height);\n", " this._sxs[i].push(xvalues);\n", " this._sys[i].push(yvalues);\n", " }\n", " else {\n", " const lines = text.split(\"\\n\");\n", " const block_height = line_height * lines.length;\n", " const baseline = this.visuals.text.cache_select(\"text_baseline\", i);\n", " let y;\n", " switch (baseline) {\n", " case \"top\": {\n", " y = 0;\n", " break;\n", " }\n", " case \"middle\": {\n", " y = (-block_height / 2) + (line_height / 2);\n", " break;\n", " }\n", " case \"bottom\": {\n", " y = -block_height + line_height;\n", " break;\n", " }\n", " default: {\n", " y = 0;\n", " console.warn(`'${baseline}' baseline not supported with multi line text`);\n", " }\n", " }\n", " for (const line of lines) {\n", " ctx.fillText(line, 0, y);\n", " const x0 = sx[i] + _x_offset[i];\n", " const y0 = y + sy[i] + _y_offset[i];\n", " const width = ctx.measureText(line).width;\n", " const [xvalues, yvalues] = this._text_bounds(x0, y0, width, line_height);\n", " this._sxs[i].push(xvalues);\n", " this._sys[i].push(yvalues);\n", " y += line_height;\n", " }\n", " }\n", " ctx.restore();\n", " }\n", " }\n", " }\n", " _hit_point(geometry) {\n", " const { sx, sy } = geometry;\n", " const indices = [];\n", " for (let i = 0; i < this._sxs.length; i++) {\n", " const sxs = this._sxs[i];\n", " const sys = this._sys[i];\n", " const n = sxs.length;\n", " for (let j = 0, endj = n; j < endj; j++) {\n", " const [sxr, syr] = this._rotate_point(sx, sy, sxs[n - 1][0], sys[n - 1][0], -this._angle[i]);\n", " if (hittest.point_in_poly(sxr, syr, sxs[j], sys[j])) {\n", " indices.push(i);\n", " }\n", " }\n", " }\n", " return new selection_1.Selection({ indices });\n", " }\n", " _scenterxy(i) {\n", " const sxs = this._sxs[i];\n", " const sys = this._sys[i];\n", " assert_1.assert(sxs.length != 0 && sys.length != 0);\n", " const sx0 = sxs[0][0];\n", " const sy0 = sys[0][0];\n", " const sxc = (sxs[0][2] + sx0) / 2;\n", " const syc = (sys[0][2] + sy0) / 2;\n", " const [sxcr, sycr] = this._rotate_point(sxc, syc, sx0, sy0, this._angle[i]);\n", " return { x: sxcr, y: sycr };\n", " }\n", " scenterx(i) {\n", " return this._scenterxy(i).x;\n", " }\n", " scentery(i) {\n", " return this._scenterxy(i).y;\n", " }\n", " }\n", " exports.TextView = TextView;\n", " TextView.__name__ = \"TextView\";\n", " class Text extends xy_glyph_1.XYGlyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Text() {\n", " this.prototype.default_view = TextView;\n", " this.mixins(property_mixins_1.TextVector);\n", " this.define({\n", " text: [p.NullStringSpec, { field: \"text\" }],\n", " angle: [p.AngleSpec, 0],\n", " x_offset: [p.NumberSpec, 0],\n", " y_offset: [p.NumberSpec, 0],\n", " });\n", " }\n", " }\n", " exports.Text = Text;\n", " Text.__name__ = \"Text\";\n", " Text.init_Text();\n", " },\n", " /* models/glyphs/vbar.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const box_1 = require(218) /* ./box */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class VBarView extends box_1.BoxView {\n", " scenterx(i) {\n", " return this.sx[i];\n", " }\n", " scentery(i) {\n", " return (this.stop[i] + this.sbottom[i]) / 2;\n", " }\n", " _index_data() {\n", " return this._index_box(this._x.length);\n", " }\n", " _lrtb(i) {\n", " const l = this._x[i] - (this._width[i] / 2);\n", " const r = this._x[i] + (this._width[i] / 2);\n", " const t = Math.max(this._top[i], this._bottom[i]);\n", " const b = Math.min(this._top[i], this._bottom[i]);\n", " return [l, r, t, b];\n", " }\n", " _map_data() {\n", " this.sx = this.renderer.xscale.v_compute(this._x);\n", " this.sw = this.sdist(this.renderer.xscale, this._x, this._width, \"center\");\n", " this.stop = this.renderer.yscale.v_compute(this._top);\n", " this.sbottom = this.renderer.yscale.v_compute(this._bottom);\n", " const n = this.sx.length;\n", " this.sleft = new Float64Array(n);\n", " this.sright = new Float64Array(n);\n", " for (let i = 0; i < n; i++) {\n", " this.sleft[i] = this.sx[i] - this.sw[i] / 2;\n", " this.sright[i] = this.sx[i] + this.sw[i] / 2;\n", " }\n", " this._clamp_viewport();\n", " }\n", " }\n", " exports.VBarView = VBarView;\n", " VBarView.__name__ = \"VBarView\";\n", " class VBar extends box_1.Box {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_VBar() {\n", " this.prototype.default_view = VBarView;\n", " this.coords([['x', 'bottom']]);\n", " this.define({\n", " width: [p.NumberSpec],\n", " top: [p.CoordinateSpec],\n", " });\n", " this.override({\n", " bottom: 0,\n", " });\n", " }\n", " }\n", " exports.VBar = VBar;\n", " VBar.__name__ = \"VBar\";\n", " VBar.init_VBar();\n", " },\n", " /* models/glyphs/wedge.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const xy_glyph_1 = require(84) /* ./xy_glyph */;\n", " const utils_1 = require(92) /* ./utils */;\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const math_1 = require(10) /* ../../core/util/math */;\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class WedgeView extends xy_glyph_1.XYGlyphView {\n", " _map_data() {\n", " if (this.model.properties.radius.units == \"data\")\n", " this.sradius = this.sdist(this.renderer.xscale, this._x, this._radius);\n", " else\n", " this.sradius = this._radius;\n", " }\n", " _render(ctx, indices, { sx, sy, sradius, _start_angle, _end_angle }) {\n", " const direction = this.model.properties.direction.value();\n", " for (const i of indices) {\n", " if (isNaN(sx[i] + sy[i] + sradius[i] + _start_angle[i] + _end_angle[i]))\n", " continue;\n", " ctx.beginPath();\n", " ctx.arc(sx[i], sy[i], sradius[i], _start_angle[i], _end_angle[i], direction);\n", " ctx.lineTo(sx[i], sy[i]);\n", " ctx.closePath();\n", " if (this.visuals.fill.doit) {\n", " this.visuals.fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " }\n", " _hit_point(geometry) {\n", " let dist, sx0, sx1, sy0, sy1, x0, x1, y0, y1;\n", " const { sx, sy } = geometry;\n", " const x = this.renderer.xscale.invert(sx);\n", " const y = this.renderer.yscale.invert(sy);\n", " // check diameter first\n", " const max_diameter = 2 * this.max_radius;\n", " if (this.model.properties.radius.units === \"data\") {\n", " x0 = x - max_diameter;\n", " x1 = x + max_diameter;\n", " y0 = y - max_diameter;\n", " y1 = y + max_diameter;\n", " }\n", " else {\n", " sx0 = sx - max_diameter;\n", " sx1 = sx + max_diameter;\n", " [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " sy0 = sy - max_diameter;\n", " sy1 = sy + max_diameter;\n", " [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " }\n", " const candidates = [];\n", " for (const i of this.index.indices({ x0, x1, y0, y1 })) {\n", " const r2 = this.sradius[i] ** 2;\n", " [sx0, sx1] = this.renderer.xscale.r_compute(x, this._x[i]);\n", " [sy0, sy1] = this.renderer.yscale.r_compute(y, this._y[i]);\n", " dist = (sx0 - sx1) ** 2 + (sy0 - sy1) ** 2;\n", " if (dist <= r2) {\n", " candidates.push([i, dist]);\n", " }\n", " }\n", " const direction = this.model.properties.direction.value();\n", " const hits = [];\n", " for (const [i, dist] of candidates) {\n", " // NOTE: minus the angle because JS uses non-mathy convention for angles\n", " const angle = Math.atan2(sy - this.sy[i], sx - this.sx[i]);\n", " if (math_1.angle_between(-angle, -this._start_angle[i], -this._end_angle[i], direction)) {\n", " hits.push([i, dist]);\n", " }\n", " }\n", " return selection_1.Selection.from_hits(hits);\n", " }\n", " draw_legend_for_index(ctx, bbox, index) {\n", " utils_1.generic_area_legend(this.visuals, ctx, bbox, index);\n", " }\n", " _scenterxy(i) {\n", " const r = this.sradius[i] / 2;\n", " const a = (this._start_angle[i] + this._end_angle[i]) / 2;\n", " return { x: this.sx[i] + (r * Math.cos(a)), y: this.sy[i] + (r * Math.sin(a)) };\n", " }\n", " scenterx(i) {\n", " return this._scenterxy(i).x;\n", " }\n", " scentery(i) {\n", " return this._scenterxy(i).y;\n", " }\n", " }\n", " exports.WedgeView = WedgeView;\n", " WedgeView.__name__ = \"WedgeView\";\n", " class Wedge extends xy_glyph_1.XYGlyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Wedge() {\n", " this.prototype.default_view = WedgeView;\n", " this.mixins([property_mixins_1.LineVector, property_mixins_1.FillVector]);\n", " this.define({\n", " direction: [p.Direction, 'anticlock'],\n", " radius: [p.DistanceSpec],\n", " start_angle: [p.AngleSpec],\n", " end_angle: [p.AngleSpec],\n", " });\n", " }\n", " }\n", " exports.Wedge = Wedge;\n", " Wedge.__name__ = \"Wedge\";\n", " Wedge.init_Wedge();\n", " },\n", " /* models/graphs/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " tslib_1.__exportStar(require(101) /* ./graph_hit_test_policy */, exports);\n", " tslib_1.__exportStar(require(239) /* ./layout_provider */, exports);\n", " tslib_1.__exportStar(require(240) /* ./static_layout_provider */, exports);\n", " },\n", " /* models/graphs/layout_provider.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const model_1 = require(71) /* ../../model */;\n", " class LayoutProvider extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " }\n", " exports.LayoutProvider = LayoutProvider;\n", " LayoutProvider.__name__ = \"LayoutProvider\";\n", " },\n", " /* models/graphs/static_layout_provider.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const layout_provider_1 = require(239) /* ./layout_provider */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class StaticLayoutProvider extends layout_provider_1.LayoutProvider {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_StaticLayoutProvider() {\n", " this.define({\n", " graph_layout: [p.Any, {}],\n", " });\n", " }\n", " get_node_coordinates(node_source) {\n", " const xs = [];\n", " const ys = [];\n", " const index = node_source.data.index;\n", " for (let i = 0, end = index.length; i < end; i++) {\n", " const point = this.graph_layout[index[i]];\n", " const [x, y] = point != null ? point : [NaN, NaN];\n", " xs.push(x);\n", " ys.push(y);\n", " }\n", " return [xs, ys];\n", " }\n", " get_edge_coordinates(edge_source) {\n", " const xs = [];\n", " const ys = [];\n", " const starts = edge_source.data.start;\n", " const ends = edge_source.data.end;\n", " const has_paths = (edge_source.data.xs != null) && (edge_source.data.ys != null);\n", " for (let i = 0, endi = starts.length; i < endi; i++) {\n", " const in_layout = (this.graph_layout[starts[i]] != null) && (this.graph_layout[ends[i]] != null);\n", " if (has_paths && in_layout) {\n", " xs.push(edge_source.data.xs[i]);\n", " ys.push(edge_source.data.ys[i]);\n", " }\n", " else {\n", " let end, start;\n", " if (in_layout)\n", " [start, end] = [this.graph_layout[starts[i]], this.graph_layout[ends[i]]];\n", " else\n", " [start, end] = [[NaN, NaN], [NaN, NaN]];\n", " xs.push([start[0], end[0]]);\n", " ys.push([start[1], end[1]]);\n", " }\n", " }\n", " return [xs, ys];\n", " }\n", " }\n", " exports.StaticLayoutProvider = StaticLayoutProvider;\n", " StaticLayoutProvider.__name__ = \"StaticLayoutProvider\";\n", " StaticLayoutProvider.init_StaticLayoutProvider();\n", " },\n", " /* models/grids/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var grid_1 = require(242) /* ./grid */;\n", " exports.Grid = grid_1.Grid;\n", " },\n", " /* models/grids/grid.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const guide_renderer_1 = require(151) /* ../renderers/guide_renderer */;\n", " const mixins = tslib_1.__importStar(require(23) /* ../../core/property_mixins */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " class GridView extends guide_renderer_1.GuideRendererView {\n", " render() {\n", " if (!this.model.visible)\n", " return;\n", " const ctx = this.layer.ctx;\n", " ctx.save();\n", " this._draw_regions(ctx);\n", " this._draw_minor_grids(ctx);\n", " this._draw_grids(ctx);\n", " ctx.restore();\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.change, () => this.request_render());\n", " }\n", " _draw_regions(ctx) {\n", " if (!this.visuals.band_fill.doit && !this.visuals.band_hatch.doit)\n", " return;\n", " this.visuals.band_fill.set_value(ctx);\n", " const [xs, ys] = this.grid_coords('major', false);\n", " for (let i = 0; i < xs.length - 1; i++) {\n", " if (i % 2 != 1)\n", " continue;\n", " const [sx0, sy0] = this.plot_view.map_to_screen(xs[i], ys[i], this.model.x_range_name, this.model.y_range_name);\n", " const [sx1, sy1] = this.plot_view.map_to_screen(xs[i + 1], ys[i + 1], this.model.x_range_name, this.model.y_range_name);\n", " if (this.visuals.band_fill.doit)\n", " ctx.fillRect(sx0[0], sy0[0], sx1[1] - sx0[0], sy1[1] - sy0[0]);\n", " this.visuals.band_hatch.doit2(ctx, i, () => {\n", " ctx.fillRect(sx0[0], sy0[0], sx1[1] - sx0[0], sy1[1] - sy0[0]);\n", " }, () => this.request_render());\n", " }\n", " }\n", " _draw_grids(ctx) {\n", " if (!this.visuals.grid_line.doit)\n", " return;\n", " const [xs, ys] = this.grid_coords('major');\n", " this._draw_grid_helper(ctx, this.visuals.grid_line, xs, ys);\n", " }\n", " _draw_minor_grids(ctx) {\n", " if (!this.visuals.minor_grid_line.doit)\n", " return;\n", " const [xs, ys] = this.grid_coords('minor');\n", " this._draw_grid_helper(ctx, this.visuals.minor_grid_line, xs, ys);\n", " }\n", " _draw_grid_helper(ctx, visuals, xs, ys) {\n", " visuals.set_value(ctx);\n", " for (let i = 0; i < xs.length; i++) {\n", " const [sx, sy] = this.plot_view.map_to_screen(xs[i], ys[i], this.model.x_range_name, this.model.y_range_name);\n", " ctx.beginPath();\n", " ctx.moveTo(Math.round(sx[0]), Math.round(sy[0]));\n", " for (let i = 1; i < sx.length; i++)\n", " ctx.lineTo(Math.round(sx[i]), Math.round(sy[i]));\n", " ctx.stroke();\n", " }\n", " }\n", " // {{{ TODO: state\n", " ranges() {\n", " const i = this.model.dimension;\n", " const j = (i + 1) % 2;\n", " const frame = this.plot_view.frame;\n", " const ranges = [\n", " frame.x_ranges[this.model.x_range_name],\n", " frame.y_ranges[this.model.y_range_name],\n", " ];\n", " return [ranges[i], ranges[j]];\n", " }\n", " computed_bounds() {\n", " const [range] = this.ranges();\n", " const user_bounds = this.model.bounds;\n", " const range_bounds = [range.min, range.max];\n", " let start;\n", " let end;\n", " if (types_1.isArray(user_bounds)) {\n", " start = Math.min(user_bounds[0], user_bounds[1]);\n", " end = Math.max(user_bounds[0], user_bounds[1]);\n", " if (start < range_bounds[0])\n", " start = range_bounds[0];\n", " // XXX:\n", " //else if (start > range_bounds[1])\n", " // start = null\n", " if (end > range_bounds[1])\n", " end = range_bounds[1];\n", " // XXX:\n", " //else if (end < range_bounds[0])\n", " // end = null\n", " }\n", " else {\n", " [start, end] = range_bounds;\n", " for (const axis_view of this.plot_view.axis_views) {\n", " if (axis_view.dimension == this.model.dimension\n", " && axis_view.model.x_range_name == this.model.x_range_name\n", " && axis_view.model.y_range_name == this.model.y_range_name) {\n", " [start, end] = axis_view.computed_bounds;\n", " }\n", " }\n", " }\n", " return [start, end];\n", " }\n", " grid_coords(location, exclude_ends = true) {\n", " const i = this.model.dimension;\n", " const j = (i + 1) % 2;\n", " const [range, cross_range] = this.ranges();\n", " let [start, end] = this.computed_bounds();\n", " [start, end] = [Math.min(start, end), Math.max(start, end)];\n", " const coords = [[], []];\n", " // TODO: (bev) using cross_range.min for cross_loc is a bit of a cheat. Since we\n", " // currently only support \"straight line\" grids, this should be OK for now. If\n", " // we ever want to support \"curved\" grids, e.g. for some projections, we may\n", " // have to communicate more than just a single cross location.\n", " const ticker = this.model.get_ticker();\n", " if (ticker == null) {\n", " return coords;\n", " }\n", " const ticks = ticker.get_ticks(start, end, range, cross_range.min, {})[location];\n", " const min = range.min;\n", " const max = range.max;\n", " const cmin = cross_range.min;\n", " const cmax = cross_range.max;\n", " if (!exclude_ends) {\n", " if (ticks[0] != min)\n", " ticks.splice(0, 0, min);\n", " if (ticks[ticks.length - 1] != max)\n", " ticks.push(max);\n", " }\n", " for (let ii = 0; ii < ticks.length; ii++) {\n", " if ((ticks[ii] == min || ticks[ii] == max) && exclude_ends)\n", " continue;\n", " const dim_i = [];\n", " const dim_j = [];\n", " const N = 2;\n", " for (let n = 0; n < N; n++) {\n", " const loc = cmin + (cmax - cmin) / (N - 1) * n;\n", " dim_i.push(ticks[ii]);\n", " dim_j.push(loc);\n", " }\n", " coords[i].push(dim_i);\n", " coords[j].push(dim_j);\n", " }\n", " return coords;\n", " }\n", " }\n", " exports.GridView = GridView;\n", " GridView.__name__ = \"GridView\";\n", " class Grid extends guide_renderer_1.GuideRenderer {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Grid() {\n", " this.prototype.default_view = GridView;\n", " this.mixins([\n", " [\"grid_\", mixins.Line],\n", " [\"minor_grid_\", mixins.Line],\n", " [\"band_\", mixins.Fill],\n", " [\"band_\", mixins.Hatch],\n", " ]);\n", " this.define({\n", " bounds: [p.Any, 'auto'],\n", " dimension: [p.Any, 0],\n", " axis: [p.Instance],\n", " ticker: [p.Instance],\n", " x_range_name: [p.String, 'default'],\n", " y_range_name: [p.String, 'default'],\n", " });\n", " this.override({\n", " level: \"underlay\",\n", " band_fill_color: null,\n", " band_fill_alpha: 0,\n", " grid_line_color: '#e5e5e5',\n", " minor_grid_line_color: null,\n", " });\n", " }\n", " get_ticker() {\n", " if (this.ticker != null) {\n", " return this.ticker;\n", " }\n", " if (this.axis != null) {\n", " return this.axis.ticker;\n", " }\n", " return null;\n", " }\n", " }\n", " exports.Grid = Grid;\n", " Grid.__name__ = \"Grid\";\n", " Grid.init_Grid();\n", " },\n", " /* models/layouts/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var box_1 = require(244) /* ./box */;\n", " exports.Box = box_1.Box;\n", " var column_1 = require(247) /* ./column */;\n", " exports.Column = column_1.Column;\n", " var grid_box_1 = require(248) /* ./grid_box */;\n", " exports.GridBox = grid_box_1.GridBox;\n", " var html_box_1 = require(249) /* ./html_box */;\n", " exports.HTMLBox = html_box_1.HTMLBox;\n", " var layout_dom_1 = require(245) /* ./layout_dom */;\n", " exports.LayoutDOM = layout_dom_1.LayoutDOM;\n", " var row_1 = require(250) /* ./row */;\n", " exports.Row = row_1.Row;\n", " var spacer_1 = require(251) /* ./spacer */;\n", " exports.Spacer = spacer_1.Spacer;\n", " var tabs_1 = require(252) /* ./tabs */;\n", " exports.Panel = tabs_1.Panel;\n", " exports.Tabs = tabs_1.Tabs;\n", " var widget_box_1 = require(259) /* ./widget_box */;\n", " exports.WidgetBox = widget_box_1.WidgetBox;\n", " },\n", " /* models/layouts/box.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const layout_dom_1 = require(245) /* ./layout_dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class BoxView extends layout_dom_1.LayoutDOMView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.children.change, () => this.rebuild());\n", " }\n", " get child_models() {\n", " return this.model.children;\n", " }\n", " }\n", " exports.BoxView = BoxView;\n", " BoxView.__name__ = \"BoxView\";\n", " class Box extends layout_dom_1.LayoutDOM {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Box() {\n", " this.define({\n", " children: [p.Array, []],\n", " spacing: [p.Number, 0],\n", " });\n", " }\n", " }\n", " exports.Box = Box;\n", " Box.__name__ = \"Box\";\n", " Box.init_Box();\n", " },\n", " /* models/layouts/layout_dom.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const model_1 = require(71) /* ../../model */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const logging_1 = require(72) /* ../../core/logging */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const build_views_1 = require(99) /* ../../core/build_views */;\n", " const dom_view_1 = require(66) /* ../../core/dom_view */;\n", " const root_1 = require(246) /* ../../styles/root */;\n", " class LayoutDOMView extends dom_view_1.DOMView {\n", " constructor() {\n", " super(...arguments);\n", " this._idle_notified = false;\n", " this._offset_parent = null;\n", " this._viewport = {};\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.el.style.position = this.is_root ? \"relative\" : \"absolute\";\n", " this._child_views = new Map();\n", " }\n", " async lazy_initialize() {\n", " await this.build_child_views();\n", " }\n", " remove() {\n", " for (const child_view of this.child_views)\n", " child_view.remove();\n", " this._child_views.clear();\n", " super.remove();\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " if (this.is_root) {\n", " this._on_resize = () => this.resize_layout();\n", " window.addEventListener(\"resize\", this._on_resize);\n", " this._parent_observer = setInterval(() => {\n", " const offset_parent = this.el.offsetParent;\n", " if (this._offset_parent != offset_parent) {\n", " this._offset_parent = offset_parent;\n", " if (offset_parent != null) {\n", " this.compute_viewport();\n", " this.invalidate_layout();\n", " }\n", " }\n", " }, 250);\n", " }\n", " const p = this.model.properties;\n", " this.on_change([\n", " p.width, p.height,\n", " p.min_width, p.min_height,\n", " p.max_width, p.max_height,\n", " p.margin,\n", " p.width_policy, p.height_policy, p.sizing_mode,\n", " p.aspect_ratio,\n", " p.visible,\n", " ], () => this.invalidate_layout());\n", " this.on_change([\n", " p.background,\n", " p.css_classes,\n", " ], () => this.invalidate_render());\n", " }\n", " disconnect_signals() {\n", " if (this._parent_observer != null)\n", " clearTimeout(this._parent_observer);\n", " if (this._on_resize != null)\n", " window.removeEventListener(\"resize\", this._on_resize);\n", " super.disconnect_signals();\n", " }\n", " css_classes() {\n", " return super.css_classes().concat(this.model.css_classes);\n", " }\n", " get child_views() {\n", " return this.child_models.map((child) => this._child_views.get(child));\n", " }\n", " async build_child_views() {\n", " await build_views_1.build_views(this._child_views, this.child_models, { parent: this });\n", " }\n", " render() {\n", " super.render();\n", " dom_1.empty(this.el); // XXX: this should be in super\n", " const { background } = this.model;\n", " this.el.style.backgroundColor = background != null ? background : \"\";\n", " dom_1.classes(this.el).clear().add(...this.css_classes());\n", " for (const child_view of this.child_views) {\n", " this.el.appendChild(child_view.el);\n", " child_view.render();\n", " }\n", " }\n", " update_layout() {\n", " for (const child_view of this.child_views)\n", " child_view.update_layout();\n", " this._update_layout();\n", " }\n", " update_position() {\n", " this.el.style.display = this.model.visible ? \"block\" : \"none\";\n", " const margin = this.is_root ? this.layout.sizing.margin : undefined;\n", " dom_1.position(this.el, this.layout.bbox, margin);\n", " for (const child_view of this.child_views)\n", " child_view.update_position();\n", " }\n", " after_layout() {\n", " for (const child_view of this.child_views)\n", " child_view.after_layout();\n", " this._has_finished = true;\n", " }\n", " compute_viewport() {\n", " this._viewport = this._viewport_size();\n", " }\n", " renderTo(element) {\n", " element.appendChild(this.el);\n", " this._offset_parent = this.el.offsetParent;\n", " this.compute_viewport();\n", " this.build();\n", " }\n", " build() {\n", " this.assert_root();\n", " this.render();\n", " this.update_layout();\n", " this.compute_layout();\n", " return this;\n", " }\n", " async rebuild() {\n", " await this.build_child_views();\n", " this.invalidate_render();\n", " }\n", " compute_layout() {\n", " const start = Date.now();\n", " this.layout.compute(this._viewport);\n", " this.update_position();\n", " this.after_layout();\n", " logging_1.logger.debug(`layout computed in ${Date.now() - start} ms`);\n", " this.notify_finished();\n", " }\n", " resize_layout() {\n", " this.root.compute_viewport();\n", " this.root.compute_layout();\n", " }\n", " invalidate_layout() {\n", " this.root.update_layout();\n", " this.root.compute_layout();\n", " }\n", " invalidate_render() {\n", " this.render();\n", " this.invalidate_layout();\n", " }\n", " has_finished() {\n", " if (!super.has_finished())\n", " return false;\n", " for (const child_view of this.child_views) {\n", " if (!child_view.has_finished())\n", " return false;\n", " }\n", " return true;\n", " }\n", " notify_finished() {\n", " if (!this.is_root)\n", " this.root.notify_finished();\n", " else {\n", " if (!this._idle_notified && this.has_finished()) {\n", " if (this.model.document != null) {\n", " this._idle_notified = true;\n", " this.model.document.notify_idle(this.model);\n", " }\n", " }\n", " }\n", " }\n", " _width_policy() {\n", " return this.model.width != null ? \"fixed\" : \"fit\";\n", " }\n", " _height_policy() {\n", " return this.model.height != null ? \"fixed\" : \"fit\";\n", " }\n", " box_sizing() {\n", " let { width_policy, height_policy, aspect_ratio } = this.model;\n", " if (width_policy == \"auto\")\n", " width_policy = this._width_policy();\n", " if (height_policy == \"auto\")\n", " height_policy = this._height_policy();\n", " const { sizing_mode } = this.model;\n", " if (sizing_mode != null) {\n", " if (sizing_mode == \"fixed\")\n", " width_policy = height_policy = \"fixed\";\n", " else if (sizing_mode == \"stretch_both\")\n", " width_policy = height_policy = \"max\";\n", " else if (sizing_mode == \"stretch_width\")\n", " width_policy = \"max\";\n", " else if (sizing_mode == \"stretch_height\")\n", " height_policy = \"max\";\n", " else {\n", " if (aspect_ratio == null)\n", " aspect_ratio = \"auto\";\n", " switch (sizing_mode) {\n", " case \"scale_width\":\n", " width_policy = \"max\";\n", " height_policy = \"min\";\n", " break;\n", " case \"scale_height\":\n", " width_policy = \"min\";\n", " height_policy = \"max\";\n", " break;\n", " case \"scale_both\":\n", " width_policy = \"max\";\n", " height_policy = \"max\";\n", " break;\n", " }\n", " }\n", " }\n", " const sizing = { width_policy, height_policy };\n", " const { min_width, min_height } = this.model;\n", " if (min_width != null)\n", " sizing.min_width = min_width;\n", " if (min_height != null)\n", " sizing.min_height = min_height;\n", " const { width, height } = this.model;\n", " if (width != null)\n", " sizing.width = width;\n", " if (height != null)\n", " sizing.height = height;\n", " const { max_width, max_height } = this.model;\n", " if (max_width != null)\n", " sizing.max_width = max_width;\n", " if (max_height != null)\n", " sizing.max_height = max_height;\n", " if (aspect_ratio == \"auto\" && width != null && height != null)\n", " sizing.aspect = width / height;\n", " else if (types_1.isNumber(aspect_ratio))\n", " sizing.aspect = aspect_ratio;\n", " const { margin } = this.model;\n", " if (margin != null) {\n", " if (types_1.isNumber(margin))\n", " sizing.margin = { top: margin, right: margin, bottom: margin, left: margin };\n", " else if (margin.length == 2) {\n", " const [vertical, horizontal] = margin;\n", " sizing.margin = { top: vertical, right: horizontal, bottom: vertical, left: horizontal };\n", " }\n", " else {\n", " const [top, right, bottom, left] = margin;\n", " sizing.margin = { top, right, bottom, left };\n", " }\n", " }\n", " sizing.visible = this.model.visible;\n", " const { align } = this.model;\n", " if (types_1.isArray(align))\n", " [sizing.halign, sizing.valign] = align;\n", " else\n", " sizing.halign = sizing.valign = align;\n", " return sizing;\n", " }\n", " _viewport_size() {\n", " return dom_1.undisplayed(this.el, () => {\n", " let measuring = this.el;\n", " while (measuring = measuring.parentElement) {\n", " // .bk-root element doesn't bring any value\n", " if (measuring.classList.contains(root_1.bk_root))\n", " continue;\n", " // we reached element, so use viewport size\n", " if (measuring == document.body) {\n", " const { margin: { left, right, top, bottom } } = dom_1.extents(document.body);\n", " const width = Math.ceil(document.documentElement.clientWidth - left - right);\n", " const height = Math.ceil(document.documentElement.clientHeight - top - bottom);\n", " return { width, height };\n", " }\n", " // stop on first element with sensible dimensions\n", " const { padding: { left, right, top, bottom } } = dom_1.extents(measuring);\n", " const { width, height } = measuring.getBoundingClientRect();\n", " const inner_width = Math.ceil(width - left - right);\n", " const inner_height = Math.ceil(height - top - bottom);\n", " if (inner_width > 0 || inner_height > 0)\n", " return {\n", " width: inner_width > 0 ? inner_width : undefined,\n", " height: inner_height > 0 ? inner_height : undefined,\n", " };\n", " }\n", " // this element is detached from DOM\n", " return {};\n", " });\n", " }\n", " serializable_state() {\n", " return Object.assign(Object.assign({}, super.serializable_state()), { bbox: this.layout.bbox.box, children: this.child_views.map((child) => child.serializable_state()) });\n", " }\n", " }\n", " exports.LayoutDOMView = LayoutDOMView;\n", " LayoutDOMView.__name__ = \"LayoutDOMView\";\n", " class LayoutDOM extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_LayoutDOM() {\n", " this.define({\n", " width: [p.Number, null],\n", " height: [p.Number, null],\n", " min_width: [p.Number, null],\n", " min_height: [p.Number, null],\n", " max_width: [p.Number, null],\n", " max_height: [p.Number, null],\n", " margin: [p.Any, [0, 0, 0, 0]],\n", " width_policy: [p.Any, \"auto\"],\n", " height_policy: [p.Any, \"auto\"],\n", " aspect_ratio: [p.Any, null],\n", " sizing_mode: [p.SizingMode, null],\n", " visible: [p.Boolean, true],\n", " disabled: [p.Boolean, false],\n", " align: [p.Any, \"start\"],\n", " background: [p.Color, null],\n", " css_classes: [p.Array, []],\n", " });\n", " }\n", " }\n", " exports.LayoutDOM = LayoutDOM;\n", " LayoutDOM.__name__ = \"LayoutDOM\";\n", " LayoutDOM.init_LayoutDOM();\n", " },\n", " /* styles/root.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.bk_root = \"bk-root\";\n", " },\n", " /* models/layouts/column.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const box_1 = require(244) /* ./box */;\n", " const grid_1 = require(192) /* ../../core/layout/grid */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class ColumnView extends box_1.BoxView {\n", " _update_layout() {\n", " const items = this.child_views.map((child) => child.layout);\n", " this.layout = new grid_1.Column(items);\n", " this.layout.rows = this.model.rows;\n", " this.layout.spacing = [this.model.spacing, 0];\n", " this.layout.set_sizing(this.box_sizing());\n", " }\n", " }\n", " exports.ColumnView = ColumnView;\n", " ColumnView.__name__ = \"ColumnView\";\n", " class Column extends box_1.Box {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Column() {\n", " this.prototype.default_view = ColumnView;\n", " this.define({\n", " rows: [p.Any, \"auto\"],\n", " });\n", " }\n", " }\n", " exports.Column = Column;\n", " Column.__name__ = \"Column\";\n", " Column.init_Column();\n", " },\n", " /* models/layouts/grid_box.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const layout_dom_1 = require(245) /* ./layout_dom */;\n", " const grid_1 = require(192) /* ../../core/layout/grid */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class GridBoxView extends layout_dom_1.LayoutDOMView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.children.change, () => this.rebuild());\n", " }\n", " get child_models() {\n", " return this.model.children.map(([child]) => child);\n", " }\n", " _update_layout() {\n", " this.layout = new grid_1.Grid();\n", " this.layout.rows = this.model.rows;\n", " this.layout.cols = this.model.cols;\n", " this.layout.spacing = this.model.spacing;\n", " for (const [child, row, col, row_span, col_span] of this.model.children) {\n", " const child_view = this._child_views.get(child);\n", " this.layout.items.push({ layout: child_view.layout, row, col, row_span, col_span });\n", " }\n", " this.layout.set_sizing(this.box_sizing());\n", " }\n", " }\n", " exports.GridBoxView = GridBoxView;\n", " GridBoxView.__name__ = \"GridBoxView\";\n", " class GridBox extends layout_dom_1.LayoutDOM {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_GridBox() {\n", " this.prototype.default_view = GridBoxView;\n", " this.define({\n", " children: [p.Array, []],\n", " rows: [p.Any, \"auto\"],\n", " cols: [p.Any, \"auto\"],\n", " spacing: [p.Any, 0],\n", " });\n", " }\n", " }\n", " exports.GridBox = GridBox;\n", " GridBox.__name__ = \"GridBox\";\n", " GridBox.init_GridBox();\n", " },\n", " /* models/layouts/html_box.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const layout_dom_1 = require(245) /* ../layouts/layout_dom */;\n", " const layout_1 = require(188) /* ../../core/layout */;\n", " class HTMLBoxView extends layout_dom_1.LayoutDOMView {\n", " get child_models() {\n", " return [];\n", " }\n", " _update_layout() {\n", " this.layout = new layout_1.ContentBox(this.el);\n", " this.layout.set_sizing(this.box_sizing());\n", " }\n", " }\n", " exports.HTMLBoxView = HTMLBoxView;\n", " HTMLBoxView.__name__ = \"HTMLBoxView\";\n", " class HTMLBox extends layout_dom_1.LayoutDOM {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " }\n", " exports.HTMLBox = HTMLBox;\n", " HTMLBox.__name__ = \"HTMLBox\";\n", " },\n", " /* models/layouts/row.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const box_1 = require(244) /* ./box */;\n", " const grid_1 = require(192) /* ../../core/layout/grid */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class RowView extends box_1.BoxView {\n", " _update_layout() {\n", " const items = this.child_views.map((child) => child.layout);\n", " this.layout = new grid_1.Row(items);\n", " this.layout.cols = this.model.cols;\n", " this.layout.spacing = [0, this.model.spacing];\n", " this.layout.set_sizing(this.box_sizing());\n", " }\n", " }\n", " exports.RowView = RowView;\n", " RowView.__name__ = \"RowView\";\n", " class Row extends box_1.Box {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Row() {\n", " this.prototype.default_view = RowView;\n", " this.define({\n", " cols: [p.Any, \"auto\"],\n", " });\n", " }\n", " }\n", " exports.Row = Row;\n", " Row.__name__ = \"Row\";\n", " Row.init_Row();\n", " },\n", " /* models/layouts/spacer.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const layout_dom_1 = require(245) /* ./layout_dom */;\n", " const layout_1 = require(188) /* ../../core/layout */;\n", " class SpacerView extends layout_dom_1.LayoutDOMView {\n", " get child_models() {\n", " return [];\n", " }\n", " _update_layout() {\n", " this.layout = new layout_1.LayoutItem();\n", " this.layout.set_sizing(this.box_sizing());\n", " }\n", " }\n", " exports.SpacerView = SpacerView;\n", " SpacerView.__name__ = \"SpacerView\";\n", " class Spacer extends layout_dom_1.LayoutDOM {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Spacer() {\n", " this.prototype.default_view = SpacerView;\n", " }\n", " }\n", " exports.Spacer = Spacer;\n", " Spacer.__name__ = \"Spacer\";\n", " Spacer.init_Spacer();\n", " },\n", " /* models/layouts/tabs.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const layout_1 = require(188) /* ../../core/layout */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const layout_dom_1 = require(245) /* ./layout_dom */;\n", " const model_1 = require(71) /* ../../model */;\n", " const mixins_1 = require(146) /* ../../styles/mixins */;\n", " const tabs_1 = require(253) /* ../../styles/tabs */;\n", " const buttons_1 = require(254) /* ../../styles/buttons */;\n", " const menus_1 = require(255) /* ../../styles/menus */;\n", " const buttons_css_1 = tslib_1.__importDefault(require(256) /* ../../styles/buttons.css */);\n", " const menus_css_1 = tslib_1.__importDefault(require(257) /* ../../styles/menus.css */);\n", " const tabs_css_1 = tslib_1.__importDefault(require(258) /* ../../styles/tabs.css */);\n", " class TabsView extends layout_dom_1.LayoutDOMView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.tabs.change, () => this.rebuild());\n", " this.connect(this.model.properties.active.change, () => this.on_active_change());\n", " }\n", " styles() {\n", " return [...super.styles(), buttons_css_1.default, menus_css_1.default, tabs_css_1.default];\n", " }\n", " get child_models() {\n", " return this.model.tabs.map((tab) => tab.child);\n", " }\n", " _update_layout() {\n", " const loc = this.model.tabs_location;\n", " const vertical = loc == \"above\" || loc == \"below\";\n", " // XXX: this is a hack, this should be handled by \"fit\" policy in grid layout\n", " const { scroll_el, headers_el } = this;\n", " this.header = new class extends layout_1.ContentBox {\n", " _measure(viewport) {\n", " const min_headers = 3;\n", " const scroll = dom_1.size(scroll_el);\n", " const headers = dom_1.children(headers_el).slice(0, min_headers).map((el) => dom_1.size(el));\n", " const { width, height } = super._measure(viewport);\n", " if (vertical) {\n", " const min_width = scroll.width + array_1.sum(headers.map((size) => size.width));\n", " return { width: viewport.width != Infinity ? viewport.width : min_width, height };\n", " }\n", " else {\n", " const min_height = scroll.height + array_1.sum(headers.map((size) => size.height));\n", " return { width, height: viewport.height != Infinity ? viewport.height : min_height };\n", " }\n", " }\n", " }(this.header_el);\n", " if (vertical)\n", " this.header.set_sizing({ width_policy: \"fit\", height_policy: \"fixed\" });\n", " else\n", " this.header.set_sizing({ width_policy: \"fixed\", height_policy: \"fit\" });\n", " let row = 1;\n", " let col = 1;\n", " switch (loc) {\n", " case \"above\":\n", " row -= 1;\n", " break;\n", " case \"below\":\n", " row += 1;\n", " break;\n", " case \"left\":\n", " col -= 1;\n", " break;\n", " case \"right\":\n", " col += 1;\n", " break;\n", " }\n", " const header = { layout: this.header, row, col };\n", " const panels = this.child_views.map((child_view) => {\n", " return { layout: child_view.layout, row: 1, col: 1 };\n", " });\n", " this.layout = new layout_1.Grid([header, ...panels]);\n", " this.layout.set_sizing(this.box_sizing());\n", " }\n", " update_position() {\n", " super.update_position();\n", " this.header_el.style.position = \"absolute\"; // XXX: do it in position()\n", " dom_1.position(this.header_el, this.header.bbox);\n", " const loc = this.model.tabs_location;\n", " const vertical = loc == \"above\" || loc == \"below\";\n", " const scroll_el_size = dom_1.size(this.scroll_el);\n", " const headers_el_size = dom_1.scroll_size(this.headers_el);\n", " if (vertical) {\n", " const { width } = this.header.bbox;\n", " if (headers_el_size.width > width) {\n", " this.wrapper_el.style.maxWidth = `${width - scroll_el_size.width}px`;\n", " dom_1.display(this.scroll_el);\n", " }\n", " else {\n", " this.wrapper_el.style.maxWidth = \"\";\n", " dom_1.undisplay(this.scroll_el);\n", " }\n", " }\n", " else {\n", " const { height } = this.header.bbox;\n", " if (headers_el_size.height > height) {\n", " this.wrapper_el.style.maxHeight = `${height - scroll_el_size.height}px`;\n", " dom_1.display(this.scroll_el);\n", " }\n", " else {\n", " this.wrapper_el.style.maxHeight = \"\";\n", " dom_1.undisplay(this.scroll_el);\n", " }\n", " }\n", " const { child_views } = this;\n", " for (const child_view of child_views)\n", " dom_1.hide(child_view.el);\n", " const tab = child_views[this.model.active];\n", " if (tab != null)\n", " dom_1.show(tab.el);\n", " }\n", " render() {\n", " super.render();\n", " const { active } = this.model;\n", " const loc = this.model.tabs_location;\n", " const vertical = loc == \"above\" || loc == \"below\";\n", " const headers = this.model.tabs.map((tab, i) => {\n", " const el = dom_1.div({ class: [tabs_1.bk_tab, i == active ? mixins_1.bk_active : null] }, tab.title);\n", " el.addEventListener(\"click\", (event) => {\n", " if (event.target == event.currentTarget)\n", " this.change_active(i);\n", " });\n", " if (tab.closable) {\n", " const close_el = dom_1.div({ class: tabs_1.bk_close });\n", " close_el.addEventListener(\"click\", (event) => {\n", " if (event.target == event.currentTarget) {\n", " this.model.tabs = array_1.remove_at(this.model.tabs, i);\n", " const ntabs = this.model.tabs.length;\n", " if (this.model.active > ntabs - 1)\n", " this.model.active = ntabs - 1;\n", " }\n", " });\n", " el.appendChild(close_el);\n", " }\n", " return el;\n", " });\n", " this.headers_el = dom_1.div({ class: [tabs_1.bk_headers] }, headers);\n", " this.wrapper_el = dom_1.div({ class: tabs_1.bk_headers_wrapper }, this.headers_el);\n", " const left_el = dom_1.div({ class: [buttons_1.bk_btn, buttons_1.bk_btn_default], disabled: \"\" }, dom_1.div({ class: [menus_1.bk_caret, mixins_1.bk_left] }));\n", " const right_el = dom_1.div({ class: [buttons_1.bk_btn, buttons_1.bk_btn_default] }, dom_1.div({ class: [menus_1.bk_caret, mixins_1.bk_right] }));\n", " let scroll_index = 0;\n", " const do_scroll = (dir) => {\n", " return () => {\n", " const ntabs = this.model.tabs.length;\n", " if (dir == \"left\")\n", " scroll_index = Math.max(scroll_index - 1, 0);\n", " else\n", " scroll_index = Math.min(scroll_index + 1, ntabs - 1);\n", " if (scroll_index == 0)\n", " left_el.setAttribute(\"disabled\", \"\");\n", " else\n", " left_el.removeAttribute(\"disabled\");\n", " if (scroll_index == ntabs - 1)\n", " right_el.setAttribute(\"disabled\", \"\");\n", " else\n", " right_el.removeAttribute(\"disabled\");\n", " const sizes = dom_1.children(this.headers_el)\n", " .slice(0, scroll_index)\n", " .map((el) => el.getBoundingClientRect());\n", " if (vertical) {\n", " const left = -array_1.sum(sizes.map((size) => size.width));\n", " this.headers_el.style.left = `${left}px`;\n", " }\n", " else {\n", " const top = -array_1.sum(sizes.map((size) => size.height));\n", " this.headers_el.style.top = `${top}px`;\n", " }\n", " };\n", " };\n", " left_el.addEventListener(\"click\", do_scroll(\"left\"));\n", " right_el.addEventListener(\"click\", do_scroll(\"right\"));\n", " this.scroll_el = dom_1.div({ class: buttons_1.bk_btn_group }, left_el, right_el);\n", " this.header_el = dom_1.div({ class: [tabs_1.bk_tabs_header, mixins_1.bk_side(loc)] }, this.scroll_el, this.wrapper_el);\n", " this.el.appendChild(this.header_el);\n", " }\n", " change_active(i) {\n", " if (i != this.model.active) {\n", " this.model.active = i;\n", " }\n", " }\n", " on_active_change() {\n", " const i = this.model.active;\n", " const headers = dom_1.children(this.headers_el);\n", " for (const el of headers)\n", " el.classList.remove(mixins_1.bk_active);\n", " headers[i].classList.add(mixins_1.bk_active);\n", " const { child_views } = this;\n", " for (const child_view of child_views)\n", " dom_1.hide(child_view.el);\n", " dom_1.show(child_views[i].el);\n", " }\n", " }\n", " exports.TabsView = TabsView;\n", " TabsView.__name__ = \"TabsView\";\n", " class Tabs extends layout_dom_1.LayoutDOM {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Tabs() {\n", " this.prototype.default_view = TabsView;\n", " this.define({\n", " tabs: [p.Array, []],\n", " tabs_location: [p.Location, \"above\"],\n", " active: [p.Number, 0],\n", " });\n", " }\n", " }\n", " exports.Tabs = Tabs;\n", " Tabs.__name__ = \"Tabs\";\n", " Tabs.init_Tabs();\n", " class Panel extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Panel() {\n", " this.define({\n", " title: [p.String, \"\"],\n", " child: [p.Instance],\n", " closable: [p.Boolean, false],\n", " });\n", " }\n", " }\n", " exports.Panel = Panel;\n", " Panel.__name__ = \"Panel\";\n", " Panel.init_Panel();\n", " },\n", " /* styles/tabs.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.bk_tabs_header = \"bk-tabs-header\";\n", " exports.bk_headers_wrapper = \"bk-headers-wrapper\";\n", " exports.bk_headers = \"bk-headers\";\n", " exports.bk_tab = \"bk-tab\";\n", " exports.bk_close = \"bk-close\";\n", " },\n", " /* styles/buttons.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.bk_btn = \"bk-btn\";\n", " exports.bk_btn_group = \"bk-btn-group\";\n", " exports.bk_btn_default = \"bk-btn-default\";\n", " exports.bk_btn_primary = \"bk-btn-primary\";\n", " exports.bk_btn_success = \"bk-btn-success\";\n", " exports.bk_btn_warning = \"bk-btn-warning\";\n", " exports.bk_btn_danger = \"bk-btn-danger\";\n", " function bk_btn_type(button_type) {\n", " switch (button_type) {\n", " case \"default\": return exports.bk_btn_default;\n", " case \"primary\": return exports.bk_btn_primary;\n", " case \"success\": return exports.bk_btn_success;\n", " case \"warning\": return exports.bk_btn_warning;\n", " case \"danger\": return exports.bk_btn_danger;\n", " }\n", " }\n", " exports.bk_btn_type = bk_btn_type;\n", " exports.bk_dropdown_toggle = \"bk-dropdown-toggle\";\n", " },\n", " /* styles/menus.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.bk_menu = \"bk-menu\";\n", " exports.bk_caret = \"bk-caret\";\n", " exports.bk_divider = \"bk-divider\";\n", " },\n", " /* styles/buttons.css.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const css = `\n", " .bk-root .bk-btn {\n", " height: 100%;\n", " display: inline-block;\n", " text-align: center;\n", " vertical-align: middle;\n", " white-space: nowrap;\n", " cursor: pointer;\n", " padding: 6px 12px;\n", " font-size: 12px;\n", " border: 1px solid transparent;\n", " border-radius: 4px;\n", " outline: 0;\n", " user-select: none;\n", " -ms-user-select: none;\n", " -moz-user-select: none;\n", " -webkit-user-select: none;\n", " }\n", " .bk-root .bk-btn:hover,\n", " .bk-root .bk-btn:focus {\n", " text-decoration: none;\n", " }\n", " .bk-root .bk-btn:active,\n", " .bk-root .bk-btn.bk-active {\n", " background-image: none;\n", " box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);\n", " }\n", " .bk-root .bk-btn[disabled] {\n", " cursor: not-allowed;\n", " pointer-events: none;\n", " opacity: 0.65;\n", " box-shadow: none;\n", " }\n", " .bk-root .bk-btn-default {\n", " color: #333;\n", " background-color: #fff;\n", " border-color: #ccc;\n", " }\n", " .bk-root .bk-btn-default:hover {\n", " background-color: #f5f5f5;\n", " border-color: #b8b8b8;\n", " }\n", " .bk-root .bk-btn-default.bk-active {\n", " background-color: #ebebeb;\n", " border-color: #adadad;\n", " }\n", " .bk-root .bk-btn-default[disabled],\n", " .bk-root .bk-btn-default[disabled]:hover,\n", " .bk-root .bk-btn-default[disabled]:focus,\n", " .bk-root .bk-btn-default[disabled]:active,\n", " .bk-root .bk-btn-default[disabled].bk-active {\n", " background-color: #e6e6e6;\n", " border-color: #ccc;\n", " }\n", " .bk-root .bk-btn-primary {\n", " color: #fff;\n", " background-color: #428bca;\n", " border-color: #357ebd;\n", " }\n", " .bk-root .bk-btn-primary:hover {\n", " background-color: #3681c1;\n", " border-color: #2c699e;\n", " }\n", " .bk-root .bk-btn-primary.bk-active {\n", " background-color: #3276b1;\n", " border-color: #285e8e;\n", " }\n", " .bk-root .bk-btn-primary[disabled],\n", " .bk-root .bk-btn-primary[disabled]:hover,\n", " .bk-root .bk-btn-primary[disabled]:focus,\n", " .bk-root .bk-btn-primary[disabled]:active,\n", " .bk-root .bk-btn-primary[disabled].bk-active {\n", " background-color: #506f89;\n", " border-color: #357ebd;\n", " }\n", " .bk-root .bk-btn-success {\n", " color: #fff;\n", " background-color: #5cb85c;\n", " border-color: #4cae4c;\n", " }\n", " .bk-root .bk-btn-success:hover {\n", " background-color: #4eb24e;\n", " border-color: #409240;\n", " }\n", " .bk-root .bk-btn-success.bk-active {\n", " background-color: #47a447;\n", " border-color: #398439;\n", " }\n", " .bk-root .bk-btn-success[disabled],\n", " .bk-root .bk-btn-success[disabled]:hover,\n", " .bk-root .bk-btn-success[disabled]:focus,\n", " .bk-root .bk-btn-success[disabled]:active,\n", " .bk-root .bk-btn-success[disabled].bk-active {\n", " background-color: #667b66;\n", " border-color: #4cae4c;\n", " }\n", " .bk-root .bk-btn-warning {\n", " color: #fff;\n", " background-color: #f0ad4e;\n", " border-color: #eea236;\n", " }\n", " .bk-root .bk-btn-warning:hover {\n", " background-color: #eea43b;\n", " border-color: #e89014;\n", " }\n", " .bk-root .bk-btn-warning.bk-active {\n", " background-color: #ed9c28;\n", " border-color: #d58512;\n", " }\n", " .bk-root .bk-btn-warning[disabled],\n", " .bk-root .bk-btn-warning[disabled]:hover,\n", " .bk-root .bk-btn-warning[disabled]:focus,\n", " .bk-root .bk-btn-warning[disabled]:active,\n", " .bk-root .bk-btn-warning[disabled].bk-active {\n", " background-color: #c89143;\n", " border-color: #eea236;\n", " }\n", " .bk-root .bk-btn-danger {\n", " color: #fff;\n", " background-color: #d9534f;\n", " border-color: #d43f3a;\n", " }\n", " .bk-root .bk-btn-danger:hover {\n", " background-color: #d5433e;\n", " border-color: #bd2d29;\n", " }\n", " .bk-root .bk-btn-danger.bk-active {\n", " background-color: #d2322d;\n", " border-color: #ac2925;\n", " }\n", " .bk-root .bk-btn-danger[disabled],\n", " .bk-root .bk-btn-danger[disabled]:hover,\n", " .bk-root .bk-btn-danger[disabled]:focus,\n", " .bk-root .bk-btn-danger[disabled]:active,\n", " .bk-root .bk-btn-danger[disabled].bk-active {\n", " background-color: #a55350;\n", " border-color: #d43f3a;\n", " }\n", " .bk-root .bk-btn-group {\n", " height: 100%;\n", " display: flex;\n", " display: -webkit-flex;\n", " flex-wrap: nowrap;\n", " -webkit-flex-wrap: nowrap;\n", " align-items: center;\n", " -webkit-align-items: center;\n", " flex-direction: row;\n", " -webkit-flex-direction: row;\n", " }\n", " .bk-root .bk-btn-group > .bk-btn {\n", " flex-grow: 1;\n", " -webkit-flex-grow: 1;\n", " }\n", " .bk-root .bk-btn-group > .bk-btn + .bk-btn {\n", " margin-left: -1px;\n", " }\n", " .bk-root .bk-btn-group > .bk-btn:first-child:not(:last-child) {\n", " border-bottom-right-radius: 0;\n", " border-top-right-radius: 0;\n", " }\n", " .bk-root .bk-btn-group > .bk-btn:not(:first-child):last-child {\n", " border-bottom-left-radius: 0;\n", " border-top-left-radius: 0;\n", " }\n", " .bk-root .bk-btn-group > .bk-btn:not(:first-child):not(:last-child) {\n", " border-radius: 0;\n", " }\n", " .bk-root .bk-btn-group .bk-dropdown-toggle {\n", " flex: 0 0 0;\n", " -webkit-flex: 0 0 0;\n", " padding: 6px 6px;\n", " }\n", " `;\n", " exports.default = css;\n", " },\n", " /* styles/menus.css.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const css = `\n", " .bk-root .bk-menu-icon {\n", " width: 28px;\n", " height: 28px;\n", " background-size: 60%;\n", " background-color: transparent;\n", " background-repeat: no-repeat;\n", " background-position: center center;\n", " }\n", " .bk-root .bk-context-menu {\n", " position: absolute;\n", " display: inline-flex;\n", " display: -webkit-inline-flex;\n", " flex-wrap: nowrap;\n", " -webkit-flex-wrap: nowrap;\n", " user-select: none;\n", " -ms-user-select: none;\n", " -moz-user-select: none;\n", " -webkit-user-select: none;\n", " width: auto;\n", " height: auto;\n", " z-index: 100;\n", " cursor: pointer;\n", " font-size: 12px;\n", " background-color: #fff;\n", " border: 1px solid #ccc;\n", " border-radius: 4px;\n", " box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);\n", " }\n", " .bk-root .bk-context-menu.bk-horizontal {\n", " flex-direction: row;\n", " -webkit-flex-direction: row;\n", " }\n", " .bk-root .bk-context-menu.bk-vertical {\n", " flex-direction: column;\n", " -webkit-flex-direction: column;\n", " }\n", " .bk-root .bk-context-menu > .bk-divider {\n", " cursor: default;\n", " overflow: hidden;\n", " background-color: #e5e5e5;\n", " }\n", " .bk-root .bk-context-menu.bk-horizontal > .bk-divider {\n", " width: 1px;\n", " margin: 5px 0;\n", " }\n", " .bk-root .bk-context-menu.bk-vertical > .bk-divider {\n", " height: 1px;\n", " margin: 0 5px;\n", " }\n", " .bk-root .bk-context-menu > :not(.bk-divider) {\n", " border: 1px solid transparent;\n", " }\n", " .bk-root .bk-context-menu > :not(.bk-divider).bk-active {\n", " border-color: #26aae1;\n", " }\n", " .bk-root .bk-context-menu > :not(.bk-divider):hover {\n", " background-color: #f9f9f9;\n", " }\n", " .bk-root .bk-context-menu.bk-horizontal > :not(.bk-divider):first-child {\n", " border-top-left-radius: 4px;\n", " border-bottom-left-radius: 4px;\n", " }\n", " .bk-root .bk-context-menu.bk-horizontal > :not(.bk-divider):last-child {\n", " border-top-right-radius: 4px;\n", " border-bottom-right-radius: 4px;\n", " }\n", " .bk-root .bk-context-menu.bk-vertical > :not(.bk-divider):first-child {\n", " border-top-left-radius: 4px;\n", " border-top-right-radius: 4px;\n", " }\n", " .bk-root .bk-context-menu.bk-vertical > :not(.bk-divider):last-child {\n", " border-bottom-left-radius: 4px;\n", " border-bottom-right-radius: 4px;\n", " }\n", " .bk-root .bk-menu {\n", " position: absolute;\n", " left: 0;\n", " width: 100%;\n", " z-index: 100;\n", " cursor: pointer;\n", " font-size: 12px;\n", " background-color: #fff;\n", " border: 1px solid #ccc;\n", " border-radius: 4px;\n", " box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);\n", " }\n", " .bk-root .bk-menu.bk-above {\n", " bottom: 100%;\n", " }\n", " .bk-root .bk-menu.bk-below {\n", " top: 100%;\n", " }\n", " .bk-root .bk-menu > .bk-divider {\n", " height: 1px;\n", " margin: 7.5px 0;\n", " overflow: hidden;\n", " background-color: #e5e5e5;\n", " }\n", " .bk-root .bk-menu > :not(.bk-divider) {\n", " padding: 6px 12px;\n", " }\n", " .bk-root .bk-menu > :not(.bk-divider):hover,\n", " .bk-root .bk-menu > :not(.bk-divider).bk-active {\n", " background-color: #e6e6e6;\n", " }\n", " .bk-root .bk-caret {\n", " display: inline-block;\n", " vertical-align: middle;\n", " width: 0;\n", " height: 0;\n", " margin: 0 5px;\n", " }\n", " .bk-root .bk-caret.bk-down {\n", " border-top: 4px solid;\n", " }\n", " .bk-root .bk-caret.bk-up {\n", " border-bottom: 4px solid;\n", " }\n", " .bk-root .bk-caret.bk-down,\n", " .bk-root .bk-caret.bk-up {\n", " border-right: 4px solid transparent;\n", " border-left: 4px solid transparent;\n", " }\n", " .bk-root .bk-caret.bk-left {\n", " border-right: 4px solid;\n", " }\n", " .bk-root .bk-caret.bk-right {\n", " border-left: 4px solid;\n", " }\n", " .bk-root .bk-caret.bk-left,\n", " .bk-root .bk-caret.bk-right {\n", " border-top: 4px solid transparent;\n", " border-bottom: 4px solid transparent;\n", " }\n", " `;\n", " exports.default = css;\n", " },\n", " /* styles/tabs.css.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const css = `\n", " .bk-root .bk-tabs-header {\n", " display: flex;\n", " display: -webkit-flex;\n", " flex-wrap: nowrap;\n", " -webkit-flex-wrap: nowrap;\n", " align-items: center;\n", " -webkit-align-items: center;\n", " overflow: hidden;\n", " user-select: none;\n", " -ms-user-select: none;\n", " -moz-user-select: none;\n", " -webkit-user-select: none;\n", " }\n", " .bk-root .bk-tabs-header .bk-btn-group {\n", " height: auto;\n", " margin-right: 5px;\n", " }\n", " .bk-root .bk-tabs-header .bk-btn-group > .bk-btn {\n", " flex-grow: 0;\n", " -webkit-flex-grow: 0;\n", " height: auto;\n", " padding: 4px 4px;\n", " }\n", " .bk-root .bk-tabs-header .bk-headers-wrapper {\n", " flex-grow: 1;\n", " -webkit-flex-grow: 1;\n", " overflow: hidden;\n", " color: #666666;\n", " }\n", " .bk-root .bk-tabs-header.bk-above .bk-headers-wrapper {\n", " border-bottom: 1px solid #e6e6e6;\n", " }\n", " .bk-root .bk-tabs-header.bk-right .bk-headers-wrapper {\n", " border-left: 1px solid #e6e6e6;\n", " }\n", " .bk-root .bk-tabs-header.bk-below .bk-headers-wrapper {\n", " border-top: 1px solid #e6e6e6;\n", " }\n", " .bk-root .bk-tabs-header.bk-left .bk-headers-wrapper {\n", " border-right: 1px solid #e6e6e6;\n", " }\n", " .bk-root .bk-tabs-header.bk-above,\n", " .bk-root .bk-tabs-header.bk-below {\n", " flex-direction: row;\n", " -webkit-flex-direction: row;\n", " }\n", " .bk-root .bk-tabs-header.bk-above .bk-headers,\n", " .bk-root .bk-tabs-header.bk-below .bk-headers {\n", " flex-direction: row;\n", " -webkit-flex-direction: row;\n", " }\n", " .bk-root .bk-tabs-header.bk-left,\n", " .bk-root .bk-tabs-header.bk-right {\n", " flex-direction: column;\n", " -webkit-flex-direction: column;\n", " }\n", " .bk-root .bk-tabs-header.bk-left .bk-headers,\n", " .bk-root .bk-tabs-header.bk-right .bk-headers {\n", " flex-direction: column;\n", " -webkit-flex-direction: column;\n", " }\n", " .bk-root .bk-tabs-header .bk-headers {\n", " position: relative;\n", " display: flex;\n", " display: -webkit-flex;\n", " flex-wrap: nowrap;\n", " -webkit-flex-wrap: nowrap;\n", " align-items: center;\n", " -webkit-align-items: center;\n", " }\n", " .bk-root .bk-tabs-header .bk-tab {\n", " padding: 4px 8px;\n", " border: solid transparent;\n", " white-space: nowrap;\n", " cursor: pointer;\n", " }\n", " .bk-root .bk-tabs-header .bk-tab:hover {\n", " background-color: #f2f2f2;\n", " }\n", " .bk-root .bk-tabs-header .bk-tab.bk-active {\n", " color: #4d4d4d;\n", " background-color: white;\n", " border-color: #e6e6e6;\n", " }\n", " .bk-root .bk-tabs-header .bk-tab .bk-close {\n", " margin-left: 10px;\n", " }\n", " .bk-root .bk-tabs-header.bk-above .bk-tab {\n", " border-width: 3px 1px 0px 1px;\n", " border-radius: 4px 4px 0 0;\n", " }\n", " .bk-root .bk-tabs-header.bk-right .bk-tab {\n", " border-width: 1px 3px 1px 0px;\n", " border-radius: 0 4px 4px 0;\n", " }\n", " .bk-root .bk-tabs-header.bk-below .bk-tab {\n", " border-width: 0px 1px 3px 1px;\n", " border-radius: 0 0 4px 4px;\n", " }\n", " .bk-root .bk-tabs-header.bk-left .bk-tab {\n", " border-width: 1px 0px 1px 3px;\n", " border-radius: 4px 0 0 4px;\n", " }\n", " .bk-root .bk-close {\n", " display: inline-block;\n", " width: 10px;\n", " height: 10px;\n", " vertical-align: middle;\n", " background-image: url('data:image/svg+xml;utf8,\\\n", " \\\n", " \\\n", " \\\n", " ');\n", " }\n", " .bk-root .bk-close:hover {\n", " background-image: url('data:image/svg+xml;utf8,\\\n", " \\\n", " \\\n", " \\\n", " ');\n", " }\n", " `;\n", " exports.default = css;\n", " },\n", " /* models/layouts/widget_box.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const column_1 = require(247) /* ./column */;\n", " class WidgetBoxView extends column_1.ColumnView {\n", " }\n", " exports.WidgetBoxView = WidgetBoxView;\n", " WidgetBoxView.__name__ = \"WidgetBoxView\";\n", " class WidgetBox extends column_1.Column {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_WidgetBox() {\n", " this.prototype.default_view = WidgetBoxView;\n", " }\n", " }\n", " exports.WidgetBox = WidgetBox;\n", " WidgetBox.__name__ = \"WidgetBox\";\n", " WidgetBox.init_WidgetBox();\n", " },\n", " /* models/mappers/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var categorical_color_mapper_1 = require(261) /* ./categorical_color_mapper */;\n", " exports.CategoricalColorMapper = categorical_color_mapper_1.CategoricalColorMapper;\n", " var categorical_marker_mapper_1 = require(263) /* ./categorical_marker_mapper */;\n", " exports.CategoricalMarkerMapper = categorical_marker_mapper_1.CategoricalMarkerMapper;\n", " var categorical_pattern_mapper_1 = require(264) /* ./categorical_pattern_mapper */;\n", " exports.CategoricalPatternMapper = categorical_pattern_mapper_1.CategoricalPatternMapper;\n", " var continuous_color_mapper_1 = require(116) /* ./continuous_color_mapper */;\n", " exports.ContinuousColorMapper = continuous_color_mapper_1.ContinuousColorMapper;\n", " var color_mapper_1 = require(117) /* ./color_mapper */;\n", " exports.ColorMapper = color_mapper_1.ColorMapper;\n", " var linear_color_mapper_1 = require(115) /* ./linear_color_mapper */;\n", " exports.LinearColorMapper = linear_color_mapper_1.LinearColorMapper;\n", " var log_color_mapper_1 = require(265) /* ./log_color_mapper */;\n", " exports.LogColorMapper = log_color_mapper_1.LogColorMapper;\n", " },\n", " /* models/mappers/categorical_color_mapper.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const categorical_mapper_1 = require(262) /* ./categorical_mapper */;\n", " const color_mapper_1 = require(117) /* ./color_mapper */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class CategoricalColorMapper extends color_mapper_1.ColorMapper {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_CategoricalColorMapper() {\n", " this.define({\n", " factors: [p.Array],\n", " start: [p.Number, 0],\n", " end: [p.Number],\n", " });\n", " }\n", " _v_compute(data, values, palette, { nan_color }) {\n", " categorical_mapper_1.cat_v_compute(data, this.factors, palette, values, this.start, this.end, nan_color);\n", " }\n", " }\n", " exports.CategoricalColorMapper = CategoricalColorMapper;\n", " CategoricalColorMapper.__name__ = \"CategoricalColorMapper\";\n", " CategoricalColorMapper.init_CategoricalColorMapper();\n", " },\n", " /* models/mappers/categorical_mapper.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const arrayable_1 = require(12) /* ../../core/util/arrayable */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " function _cat_equals(a, b) {\n", " if (a.length != b.length)\n", " return false;\n", " for (let i = 0, end = a.length; i < end; i++) {\n", " if (a[i] !== b[i])\n", " return false;\n", " }\n", " return true;\n", " }\n", " exports._cat_equals = _cat_equals;\n", " function cat_v_compute(data, factors, targets, values, start, end, extra_value) {\n", " for (let i = 0, N = data.length; i < N; i++) {\n", " let d = data[i];\n", " let key;\n", " if (types_1.isString(d))\n", " key = arrayable_1.index_of(factors, d);\n", " else {\n", " if (start != null) {\n", " if (end != null)\n", " d = d.slice(start, end);\n", " else\n", " d = d.slice(start);\n", " }\n", " else if (end != null)\n", " d = d.slice(0, end);\n", " if (d.length == 1)\n", " key = arrayable_1.index_of(factors, d[0]);\n", " else\n", " key = arrayable_1.find_index(factors, (x) => _cat_equals(x, d));\n", " }\n", " let value;\n", " if (key < 0 || key >= targets.length)\n", " value = extra_value;\n", " else\n", " value = targets[key];\n", " values[i] = value;\n", " }\n", " }\n", " exports.cat_v_compute = cat_v_compute;\n", " },\n", " /* models/mappers/categorical_marker_mapper.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const categorical_mapper_1 = require(262) /* ./categorical_mapper */;\n", " const mapper_1 = require(118) /* ./mapper */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class CategoricalMarkerMapper extends mapper_1.Mapper {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_CategoricalMarkerMapper() {\n", " this.define({\n", " factors: [p.Array],\n", " markers: [p.Array],\n", " start: [p.Number, 0],\n", " end: [p.Number],\n", " default_value: [p.MarkerType, \"circle\"],\n", " });\n", " }\n", " v_compute(xs) {\n", " const values = new Array(xs.length);\n", " categorical_mapper_1.cat_v_compute(xs, this.factors, this.markers, values, this.start, this.end, this.default_value);\n", " return values;\n", " }\n", " }\n", " exports.CategoricalMarkerMapper = CategoricalMarkerMapper;\n", " CategoricalMarkerMapper.__name__ = \"CategoricalMarkerMapper\";\n", " CategoricalMarkerMapper.init_CategoricalMarkerMapper();\n", " },\n", " /* models/mappers/categorical_pattern_mapper.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const categorical_mapper_1 = require(262) /* ./categorical_mapper */;\n", " const mapper_1 = require(118) /* ./mapper */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class CategoricalPatternMapper extends mapper_1.Mapper {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_CategoricalPatternMapper() {\n", " this.define({\n", " factors: [p.Array],\n", " patterns: [p.Array],\n", " start: [p.Number, 0],\n", " end: [p.Number],\n", " default_value: [p.HatchPatternType, \" \"],\n", " });\n", " }\n", " v_compute(xs) {\n", " const values = new Array(xs.length);\n", " categorical_mapper_1.cat_v_compute(xs, this.factors, this.patterns, values, this.start, this.end, this.default_value);\n", " return values;\n", " }\n", " }\n", " exports.CategoricalPatternMapper = CategoricalPatternMapper;\n", " CategoricalPatternMapper.__name__ = \"CategoricalPatternMapper\";\n", " CategoricalPatternMapper.init_CategoricalPatternMapper();\n", " },\n", " /* models/mappers/log_color_mapper.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const continuous_color_mapper_1 = require(116) /* ./continuous_color_mapper */;\n", " const arrayable_1 = require(12) /* ../../core/util/arrayable */;\n", " class LogColorMapper extends continuous_color_mapper_1.ContinuousColorMapper {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " _v_compute(data, values, palette, colors) {\n", " const { nan_color, low_color, high_color } = colors;\n", " const n = palette.length;\n", " const low = this.low != null ? this.low : arrayable_1.min(data);\n", " const high = this.high != null ? this.high : arrayable_1.max(data);\n", " const scale = n / (Math.log(high) - Math.log(low)); // subtract the low offset\n", " const max_key = palette.length - 1;\n", " for (let i = 0, end = data.length; i < end; i++) {\n", " const d = data[i];\n", " // Check NaN\n", " if (isNaN(d)) {\n", " values[i] = nan_color;\n", " continue;\n", " }\n", " if (d > high) {\n", " values[i] = high_color != null ? high_color : palette[max_key];\n", " continue;\n", " }\n", " // This handles the edge case where d == high, since the code below maps\n", " // values exactly equal to high to palette.length, which is greater than\n", " // max_key\n", " if (d == high) {\n", " values[i] = palette[max_key];\n", " continue;\n", " }\n", " if (d < low) {\n", " values[i] = low_color != null ? low_color : palette[0];\n", " continue;\n", " }\n", " // Get the key\n", " const log = Math.log(d) - Math.log(low); // subtract the low offset\n", " let key = Math.floor(log * scale);\n", " // Deal with upper bound\n", " if (key > max_key)\n", " key = max_key;\n", " values[i] = palette[key];\n", " }\n", " }\n", " }\n", " exports.LogColorMapper = LogColorMapper;\n", " LogColorMapper.__name__ = \"LogColorMapper\";\n", " },\n", " /* models/markers/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " tslib_1.__exportStar(require(267) /* ./defs */, exports);\n", " var marker_1 = require(268) /* ./marker */;\n", " exports.Marker = marker_1.Marker;\n", " var scatter_1 = require(269) /* ./scatter */;\n", " exports.Scatter = scatter_1.Scatter;\n", " },\n", " /* models/markers/defs.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const marker_1 = require(268) /* ./marker */;\n", " const SQ3 = Math.sqrt(3);\n", " function _one_line(ctx, r) {\n", " ctx.moveTo(-r, 0);\n", " ctx.lineTo(r, 0);\n", " }\n", " function _one_x(ctx, r) {\n", " ctx.rotate(Math.PI / 4);\n", " _one_cross(ctx, r);\n", " ctx.rotate(-Math.PI / 4);\n", " }\n", " function _one_y(ctx, r) {\n", " const h = r * SQ3;\n", " const a = h / 3;\n", " ctx.moveTo(-h / 2, -a);\n", " ctx.lineTo(0, 0);\n", " ctx.lineTo(h / 2, -a);\n", " ctx.lineTo(0, 0);\n", " ctx.lineTo(0, r);\n", " }\n", " function _one_cross(ctx, r) {\n", " ctx.moveTo(0, r);\n", " ctx.lineTo(0, -r);\n", " ctx.moveTo(-r, 0);\n", " ctx.lineTo(r, 0);\n", " }\n", " function _one_dot(ctx, r) {\n", " ctx.beginPath();\n", " ctx.arc(0, 0, r / 4, 0, 2 * Math.PI, false);\n", " ctx.closePath();\n", " }\n", " function _one_diamond(ctx, r) {\n", " ctx.moveTo(0, r);\n", " ctx.lineTo(r / 1.5, 0);\n", " ctx.lineTo(0, -r);\n", " ctx.lineTo(-r / 1.5, 0);\n", " ctx.closePath();\n", " }\n", " function _one_hex(ctx, r) {\n", " const r2 = r / 2;\n", " const h = SQ3 * r2;\n", " ctx.moveTo(r, 0);\n", " ctx.lineTo(r2, -h);\n", " ctx.lineTo(-r2, -h);\n", " ctx.lineTo(-r, 0);\n", " ctx.lineTo(-r2, h);\n", " ctx.lineTo(r2, h);\n", " ctx.closePath();\n", " }\n", " function _one_tri(ctx, r) {\n", " const h = r * SQ3;\n", " const a = h / 3;\n", " ctx.moveTo(-r, a);\n", " ctx.lineTo(r, a);\n", " ctx.lineTo(0, a - h);\n", " ctx.closePath();\n", " }\n", " function asterisk(ctx, i, r, line, _fill) {\n", " _one_cross(ctx, r);\n", " _one_x(ctx, r);\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " function circle(ctx, i, r, line, fill) {\n", " ctx.arc(0, 0, r, 0, 2 * Math.PI, false);\n", " if (fill.doit) {\n", " fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " function circle_cross(ctx, i, r, line, fill) {\n", " ctx.arc(0, 0, r, 0, 2 * Math.PI, false);\n", " if (fill.doit) {\n", " fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " _one_cross(ctx, r);\n", " ctx.stroke();\n", " }\n", " }\n", " function circle_dot(ctx, i, r, line, fill) {\n", " circle(ctx, i, r, line, fill);\n", " dot(ctx, i, r, line, fill);\n", " }\n", " function circle_y(ctx, i, r, line, fill) {\n", " ctx.arc(0, 0, r, 0, 2 * Math.PI, false);\n", " if (fill.doit) {\n", " fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " _one_y(ctx, r);\n", " ctx.stroke();\n", " }\n", " }\n", " function circle_x(ctx, i, r, line, fill) {\n", " ctx.arc(0, 0, r, 0, 2 * Math.PI, false);\n", " if (fill.doit) {\n", " fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " _one_x(ctx, r);\n", " ctx.stroke();\n", " }\n", " }\n", " function cross(ctx, i, r, line, _fill) {\n", " _one_cross(ctx, r);\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " function diamond(ctx, i, r, line, fill) {\n", " _one_diamond(ctx, r);\n", " if (fill.doit) {\n", " fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " function diamond_cross(ctx, i, r, line, fill) {\n", " _one_diamond(ctx, r);\n", " if (fill.doit) {\n", " fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " ctx.moveTo(0, r);\n", " ctx.lineTo(0, -r);\n", " ctx.moveTo(-r / 1.5, 0);\n", " ctx.lineTo(r / 1.5, 0);\n", " ctx.stroke();\n", " }\n", " }\n", " function diamond_dot(ctx, i, r, line, fill) {\n", " diamond(ctx, i, r, line, fill);\n", " dot(ctx, i, r, line, fill);\n", " }\n", " function dot(ctx, i, r, line, _fill) {\n", " _one_dot(ctx, r);\n", " line.set_vectorize(ctx, i);\n", " ctx.fillStyle = ctx.strokeStyle; // NOTE: dots use line color for fill to match\n", " ctx.fill();\n", " }\n", " function hex(ctx, i, r, line, fill) {\n", " _one_hex(ctx, r);\n", " if (fill.doit) {\n", " fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " function hex_dot(ctx, i, r, line, fill) {\n", " hex(ctx, i, r, line, fill);\n", " dot(ctx, i, r, line, fill);\n", " }\n", " function inverted_triangle(ctx, i, r, line, fill) {\n", " ctx.rotate(Math.PI);\n", " _one_tri(ctx, r);\n", " ctx.rotate(-Math.PI);\n", " if (fill.doit) {\n", " fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " function plus(ctx, i, r, line, fill) {\n", " const a = 3 * r / 8;\n", " const b = r;\n", " const xs = [a, a, b, b, a, a, -a, -a, -b, -b, -a, -a];\n", " const ys = [b, a, a, -a, -a, -b, -b, -a, -a, a, a, b];\n", " ctx.moveTo(xs[0], ys[0]);\n", " for (i = 1; i < 12; i++)\n", " ctx.lineTo(xs[i], ys[i]);\n", " ctx.closePath();\n", " if (fill.doit) {\n", " fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " function square(ctx, i, r, line, fill) {\n", " const size = 2 * r;\n", " ctx.rect(-r, -r, size, size);\n", " if (fill.doit) {\n", " fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " function square_pin(ctx, i, r, line, fill) {\n", " const a = 3 * r / 8;\n", " ctx.moveTo(-r, -r);\n", " /* eslint-disable space-in-parens */\n", " ctx.quadraticCurveTo(0, -a, r, -r);\n", " ctx.quadraticCurveTo(a, 0, r, r);\n", " ctx.quadraticCurveTo(0, a, -r, r);\n", " ctx.quadraticCurveTo(-a, 0, -r, -r);\n", " /* eslint-ensable space-in-parens */\n", " ctx.closePath();\n", " if (fill.doit) {\n", " fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " function square_cross(ctx, i, r, line, fill) {\n", " const size = 2 * r;\n", " ctx.rect(-r, -r, size, size);\n", " if (fill.doit) {\n", " fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " _one_cross(ctx, r);\n", " ctx.stroke();\n", " }\n", " }\n", " function square_dot(ctx, i, r, line, fill) {\n", " square(ctx, i, r, line, fill);\n", " dot(ctx, i, r, line, fill);\n", " }\n", " function square_x(ctx, i, r, line, fill) {\n", " const size = 2 * r;\n", " ctx.rect(-r, -r, size, size);\n", " if (fill.doit) {\n", " fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " ctx.moveTo(-r, r);\n", " ctx.lineTo(r, -r);\n", " ctx.moveTo(-r, -r);\n", " ctx.lineTo(r, r);\n", " ctx.stroke();\n", " }\n", " }\n", " function triangle(ctx, i, r, line, fill) {\n", " _one_tri(ctx, r);\n", " if (fill.doit) {\n", " fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " function triangle_dot(ctx, i, r, line, fill) {\n", " triangle(ctx, i, r, line, fill);\n", " dot(ctx, i, r, line, fill);\n", " }\n", " function triangle_pin(ctx, i, r, line, fill) {\n", " const h = r * SQ3;\n", " const a = h / 3;\n", " const b = 3 * a / 8;\n", " ctx.moveTo(-r, a);\n", " ctx.quadraticCurveTo(0, b, r, a);\n", " ctx.quadraticCurveTo(SQ3 * b / 2, b / 2, 0, a - h);\n", " ctx.quadraticCurveTo(-SQ3 * b / 2, b / 2, -r, a);\n", " ctx.closePath();\n", " if (fill.doit) {\n", " fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " function dash(ctx, i, r, line, _fill) {\n", " _one_line(ctx, r);\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " function x(ctx, i, r, line, _fill) {\n", " _one_x(ctx, r);\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " function y(ctx, i, r, line, _fill) {\n", " _one_y(ctx, r);\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " function _mk_model(type, f) {\n", " var _a;\n", " const view = class extends marker_1.MarkerView {\n", " static initClass() {\n", " this.prototype._render_one = f;\n", " }\n", " };\n", " view.initClass();\n", " const model = (_a = class extends marker_1.Marker {\n", " static initClass() {\n", " this.prototype.default_view = view;\n", " }\n", " },\n", " _a.__name__ = type,\n", " _a);\n", " model.initClass();\n", " return model;\n", " }\n", " // markers are final, so no need to export views\n", " exports.Asterisk = _mk_model('Asterisk', asterisk);\n", " exports.CircleCross = _mk_model('CircleCross', circle_cross);\n", " exports.CircleDot = _mk_model('CircleDot', circle_dot);\n", " exports.CircleY = _mk_model('CircleY', circle_y);\n", " exports.CircleX = _mk_model('CircleX', circle_x);\n", " exports.Cross = _mk_model('Cross', cross);\n", " exports.Dash = _mk_model('Dash', dash);\n", " exports.Diamond = _mk_model('Diamond', diamond);\n", " exports.DiamondCross = _mk_model('DiamondCross', diamond_cross);\n", " exports.DiamondDot = _mk_model('DiamondDot', diamond_dot);\n", " exports.Dot = _mk_model('Dot', dot);\n", " exports.Hex = _mk_model('Hex', hex);\n", " exports.HexDot = _mk_model('HexDot', hex_dot);\n", " exports.InvertedTriangle = _mk_model('InvertedTriangle', inverted_triangle);\n", " exports.Plus = _mk_model('Plus', plus);\n", " exports.Square = _mk_model('Square', square);\n", " exports.SquareCross = _mk_model('SquareCross', square_cross);\n", " exports.SquareDot = _mk_model('SquareDot', square_dot);\n", " exports.SquarePin = _mk_model('SquarePin', square_pin);\n", " exports.SquareX = _mk_model('SquareX', square_x);\n", " exports.Triangle = _mk_model('Triangle', triangle);\n", " exports.TriangleDot = _mk_model('TriangleDot', triangle_dot);\n", " exports.TrianglePin = _mk_model('TrianglePin', triangle_pin);\n", " exports.X = _mk_model('X', x);\n", " exports.Y = _mk_model('Y', y);\n", " exports.marker_funcs = {\n", " asterisk,\n", " circle,\n", " circle_cross,\n", " circle_dot,\n", " circle_y,\n", " circle_x,\n", " cross,\n", " diamond,\n", " diamond_dot,\n", " diamond_cross,\n", " dot,\n", " hex,\n", " hex_dot,\n", " inverted_triangle,\n", " plus,\n", " square,\n", " square_cross,\n", " square_dot,\n", " square_pin,\n", " square_x,\n", " triangle,\n", " triangle_dot,\n", " triangle_pin,\n", " dash,\n", " x,\n", " y,\n", " };\n", " },\n", " /* models/markers/marker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const xy_glyph_1 = require(84) /* ../glyphs/xy_glyph */;\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const hittest = tslib_1.__importStar(require(93) /* ../../core/hittest */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class MarkerView extends xy_glyph_1.XYGlyphView {\n", " _render(ctx, indices, { sx, sy, _size, _angle }) {\n", " for (const i of indices) {\n", " if (isNaN(sx[i] + sy[i] + _size[i] + _angle[i]))\n", " continue;\n", " const r = _size[i] / 2;\n", " ctx.beginPath();\n", " ctx.translate(sx[i], sy[i]);\n", " if (_angle[i])\n", " ctx.rotate(_angle[i]);\n", " this._render_one(ctx, i, r, this.visuals.line, this.visuals.fill);\n", " if (_angle[i])\n", " ctx.rotate(-_angle[i]);\n", " ctx.translate(-sx[i], -sy[i]);\n", " }\n", " }\n", " _mask_data() {\n", " // dilate the inner screen region by max_size and map back to data space for use in\n", " // spatial query\n", " const hr = this.renderer.plot_view.frame.bbox.h_range;\n", " const sx0 = hr.start - this.max_size;\n", " const sx1 = hr.end + this.max_size;\n", " const [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " const vr = this.renderer.plot_view.frame.bbox.v_range;\n", " const sy0 = vr.start - this.max_size;\n", " const sy1 = vr.end + this.max_size;\n", " const [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " return this.index.indices({ x0, x1, y0, y1 });\n", " }\n", " _hit_point(geometry) {\n", " const { sx, sy } = geometry;\n", " const sx0 = sx - this.max_size;\n", " const sx1 = sx + this.max_size;\n", " const [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " const sy0 = sy - this.max_size;\n", " const sy1 = sy + this.max_size;\n", " const [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " const candidates = this.index.indices({ x0, x1, y0, y1 });\n", " const hits = [];\n", " for (const i of candidates) {\n", " const s2 = this._size[i] / 2;\n", " const dist = Math.abs(this.sx[i] - sx) + Math.abs(this.sy[i] - sy);\n", " if (Math.abs(this.sx[i] - sx) <= s2 && Math.abs(this.sy[i] - sy) <= s2) {\n", " hits.push([i, dist]);\n", " }\n", " }\n", " return selection_1.Selection.from_hits(hits);\n", " }\n", " _hit_span(geometry) {\n", " const { sx, sy } = geometry;\n", " const bounds = this.bounds();\n", " const ms = this.max_size / 2;\n", " let x0, x1, y0, y1;\n", " if (geometry.direction == 'h') {\n", " y0 = bounds.y0;\n", " y1 = bounds.y1;\n", " const sx0 = sx - ms;\n", " const sx1 = sx + ms;\n", " [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " }\n", " else {\n", " x0 = bounds.x0;\n", " x1 = bounds.x1;\n", " const sy0 = sy - ms;\n", " const sy1 = sy + ms;\n", " [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " }\n", " const indices = this.index.indices({ x0, x1, y0, y1 });\n", " return new selection_1.Selection({ indices });\n", " }\n", " _hit_rect(geometry) {\n", " const { sx0, sx1, sy0, sy1 } = geometry;\n", " const [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " const [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " const indices = this.index.indices({ x0, x1, y0, y1 });\n", " return new selection_1.Selection({ indices });\n", " }\n", " _hit_poly(geometry) {\n", " const { sx, sy } = geometry;\n", " // TODO (bev) use spatial index to pare candidate list\n", " const candidates = array_1.range(0, this.sx.length);\n", " const indices = [];\n", " for (let i = 0, end = candidates.length; i < end; i++) {\n", " const index = candidates[i];\n", " if (hittest.point_in_poly(this.sx[i], this.sy[i], sx, sy)) {\n", " indices.push(index);\n", " }\n", " }\n", " return new selection_1.Selection({ indices });\n", " }\n", " draw_legend_for_index(ctx, { x0, x1, y0, y1 }, index) {\n", " // using objects like this seems a little wonky, since the keys are coerced to\n", " // stings, but it works\n", " const len = index + 1;\n", " const sx = new Array(len);\n", " sx[index] = (x0 + x1) / 2;\n", " const sy = new Array(len);\n", " sy[index] = (y0 + y1) / 2;\n", " const size = new Array(len);\n", " size[index] = Math.min(Math.abs(x1 - x0), Math.abs(y1 - y0)) * 0.4;\n", " const angle = new Array(len);\n", " angle[index] = 0; // don't attempt to match glyph angle\n", " this._render(ctx, [index], { sx, sy, _size: size, _angle: angle }); // XXX\n", " }\n", " }\n", " exports.MarkerView = MarkerView;\n", " MarkerView.__name__ = \"MarkerView\";\n", " class Marker extends xy_glyph_1.XYGlyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Marker() {\n", " this.mixins([property_mixins_1.LineVector, property_mixins_1.FillVector]);\n", " this.define({\n", " size: [p.DistanceSpec, { units: \"screen\", value: 4 }],\n", " angle: [p.AngleSpec, 0],\n", " });\n", " }\n", " }\n", " exports.Marker = Marker;\n", " Marker.__name__ = \"Marker\";\n", " Marker.init_Marker();\n", " },\n", " /* models/markers/scatter.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const marker_1 = require(268) /* ./marker */;\n", " const defs_1 = require(267) /* ./defs */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class ScatterView extends marker_1.MarkerView {\n", " _render(ctx, indices, { sx, sy, _size, _angle, _marker }) {\n", " for (const i of indices) {\n", " if (isNaN(sx[i] + sy[i] + _size[i] + _angle[i]) || _marker[i] == null)\n", " continue;\n", " const r = _size[i] / 2;\n", " ctx.beginPath();\n", " ctx.translate(sx[i], sy[i]);\n", " if (_angle[i])\n", " ctx.rotate(_angle[i]);\n", " defs_1.marker_funcs[_marker[i]](ctx, i, r, this.visuals.line, this.visuals.fill);\n", " if (_angle[i])\n", " ctx.rotate(-_angle[i]);\n", " ctx.translate(-sx[i], -sy[i]);\n", " }\n", " }\n", " draw_legend_for_index(ctx, { x0, x1, y0, y1 }, index) {\n", " // using objects like this seems a little wonky, since the keys are coerced to\n", " // stings, but it works\n", " const len = index + 1;\n", " const sx = new Array(len);\n", " sx[index] = (x0 + x1) / 2;\n", " const sy = new Array(len);\n", " sy[index] = (y0 + y1) / 2;\n", " const size = new Array(len);\n", " size[index] = Math.min(Math.abs(x1 - x0), Math.abs(y1 - y0)) * 0.4;\n", " const angle = new Array(len);\n", " angle[index] = 0; // don't attempt to match glyph angle\n", " const marker = new Array(len);\n", " marker[index] = this._marker[index];\n", " this._render(ctx, [index], { sx, sy, _size: size, _angle: angle, _marker: marker }); // XXX\n", " }\n", " }\n", " exports.ScatterView = ScatterView;\n", " ScatterView.__name__ = \"ScatterView\";\n", " class Scatter extends marker_1.Marker {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Scatter() {\n", " this.prototype.default_view = ScatterView;\n", " this.define({\n", " marker: [p.MarkerSpec, { value: \"circle\" }],\n", " });\n", " }\n", " }\n", " exports.Scatter = Scatter;\n", " Scatter.__name__ = \"Scatter\";\n", " Scatter.init_Scatter();\n", " },\n", " /* models/plots/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var gmap_plot_1 = require(271) /* ./gmap_plot */;\n", " exports.MapOptions = gmap_plot_1.MapOptions;\n", " var gmap_plot_2 = require(271) /* ./gmap_plot */;\n", " exports.GMapOptions = gmap_plot_2.GMapOptions;\n", " var gmap_plot_3 = require(271) /* ./gmap_plot */;\n", " exports.GMapPlot = gmap_plot_3.GMapPlot;\n", " var plot_1 = require(272) /* ./plot */;\n", " exports.Plot = plot_1.Plot;\n", " },\n", " /* models/plots/gmap_plot.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const logging_1 = require(72) /* ../../core/logging */;\n", " const plot_1 = require(272) /* ./plot */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const model_1 = require(71) /* ../../model */;\n", " const range1d_1 = require(131) /* ../ranges/range1d */;\n", " const gmap_plot_canvas_1 = require(296) /* ./gmap_plot_canvas */;\n", " exports.GMapPlotView = gmap_plot_canvas_1.GMapPlotView;\n", " class MapOptions extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_MapOptions() {\n", " this.define({\n", " lat: [p.Number],\n", " lng: [p.Number],\n", " zoom: [p.Number, 12],\n", " });\n", " }\n", " }\n", " exports.MapOptions = MapOptions;\n", " MapOptions.__name__ = \"MapOptions\";\n", " MapOptions.init_MapOptions();\n", " class GMapOptions extends MapOptions {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_GMapOptions() {\n", " this.define({\n", " map_type: [p.String, \"roadmap\"],\n", " scale_control: [p.Boolean, false],\n", " styles: [p.String],\n", " tilt: [p.Int, 45],\n", " });\n", " }\n", " }\n", " exports.GMapOptions = GMapOptions;\n", " GMapOptions.__name__ = \"GMapOptions\";\n", " GMapOptions.init_GMapOptions();\n", " class GMapPlot extends plot_1.Plot {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_GMapPlot() {\n", " this.prototype.default_view = gmap_plot_canvas_1.GMapPlotView;\n", " // This seems to be necessary so that everything can initialize.\n", " // Feels very clumsy, but I'm not sure how the properties system wants\n", " // to handle something like this situation.\n", " this.define({\n", " map_options: [p.Instance],\n", " api_key: [p.String],\n", " });\n", " this.override({\n", " x_range: () => new range1d_1.Range1d(),\n", " y_range: () => new range1d_1.Range1d(),\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.use_map = true;\n", " if (!this.api_key)\n", " logging_1.logger.error(\"api_key is required. See https://developers.google.com/maps/documentation/javascript/get-api-key for more information on how to obtain your own.\");\n", " }\n", " }\n", " exports.GMapPlot = GMapPlot;\n", " GMapPlot.__name__ = \"GMapPlot\";\n", " GMapPlot.init_GMapPlot();\n", " },\n", " /* models/plots/plot.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const mixins = tslib_1.__importStar(require(23) /* ../../core/property_mixins */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const signaling_1 = require(14) /* ../../core/signaling */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const object_1 = require(17) /* ../../core/util/object */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const layout_dom_1 = require(245) /* ../layouts/layout_dom */;\n", " const title_1 = require(142) /* ../annotations/title */;\n", " const linear_scale_1 = require(120) /* ../scales/linear_scale */;\n", " const toolbar_1 = require(273) /* ../tools/toolbar */;\n", " const column_data_source_1 = require(76) /* ../sources/column_data_source */;\n", " const glyph_renderer_1 = require(81) /* ../renderers/glyph_renderer */;\n", " const data_range1d_1 = require(186) /* ../ranges/data_range1d */;\n", " const plot_canvas_1 = require(290) /* ./plot_canvas */;\n", " exports.PlotView = plot_canvas_1.PlotView;\n", " class Plot extends layout_dom_1.LayoutDOM {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Plot() {\n", " this.prototype.default_view = plot_canvas_1.PlotView;\n", " this.mixins([\n", " [\"outline_\", mixins.Line],\n", " [\"background_\", mixins.Fill],\n", " [\"border_\", mixins.Fill],\n", " ]);\n", " this.define({\n", " toolbar: [p.Instance, () => new toolbar_1.Toolbar()],\n", " toolbar_location: [p.Location, 'right'],\n", " toolbar_sticky: [p.Boolean, true],\n", " plot_width: [p.Number, 600],\n", " plot_height: [p.Number, 600],\n", " frame_width: [p.Number, null],\n", " frame_height: [p.Number, null],\n", " title: [p.Any, () => new title_1.Title({ text: \"\" })],\n", " title_location: [p.Location, 'above'],\n", " above: [p.Array, []],\n", " below: [p.Array, []],\n", " left: [p.Array, []],\n", " right: [p.Array, []],\n", " center: [p.Array, []],\n", " renderers: [p.Array, []],\n", " x_range: [p.Instance, () => new data_range1d_1.DataRange1d()],\n", " extra_x_ranges: [p.Any, {}],\n", " y_range: [p.Instance, () => new data_range1d_1.DataRange1d()],\n", " extra_y_ranges: [p.Any, {}],\n", " x_scale: [p.Instance, () => new linear_scale_1.LinearScale()],\n", " y_scale: [p.Instance, () => new linear_scale_1.LinearScale()],\n", " lod_factor: [p.Number, 10],\n", " lod_interval: [p.Number, 300],\n", " lod_threshold: [p.Number, 2000],\n", " lod_timeout: [p.Number, 500],\n", " hidpi: [p.Boolean, true],\n", " output_backend: [p.OutputBackend, \"canvas\"],\n", " min_border: [p.Number, 5],\n", " min_border_top: [p.Number, null],\n", " min_border_left: [p.Number, null],\n", " min_border_bottom: [p.Number, null],\n", " min_border_right: [p.Number, null],\n", " inner_width: [p.Number],\n", " inner_height: [p.Number],\n", " outer_width: [p.Number],\n", " outer_height: [p.Number],\n", " match_aspect: [p.Boolean, false],\n", " aspect_scale: [p.Number, 1],\n", " reset_policy: [p.ResetPolicy, \"standard\"],\n", " });\n", " this.override({\n", " outline_line_color: \"#e5e5e5\",\n", " border_fill_color: \"#ffffff\",\n", " background_fill_color: \"#ffffff\",\n", " });\n", " }\n", " // TODO: change this when we drop ES5 compatibility (https://github.com/microsoft/TypeScript/issues/338)\n", " get width() {\n", " // const width = super.width\n", " const width = this.properties.width.get_value();\n", " return width != null ? width : this.plot_width;\n", " }\n", " set width(width) {\n", " this.setv({ width, plot_width: width });\n", " }\n", " get height() {\n", " // const height = super.height\n", " const height = this.properties.height.get_value();\n", " return height != null ? height : this.plot_height;\n", " }\n", " set height(height) {\n", " this.setv({ height, plot_height: height });\n", " }\n", " _doc_attached() {\n", " super._doc_attached();\n", " this._push_changes([\n", " [this.properties.inner_height, null, this.inner_height],\n", " [this.properties.inner_width, null, this.inner_width],\n", " ]);\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.reset = new signaling_1.Signal0(this, \"reset\");\n", " for (const xr of object_1.values(this.extra_x_ranges).concat(this.x_range)) {\n", " let plots = xr.plots;\n", " if (types_1.isArray(plots)) {\n", " plots = plots.concat(this);\n", " xr.setv({ plots }, { silent: true });\n", " }\n", " }\n", " for (const yr of object_1.values(this.extra_y_ranges).concat(this.y_range)) {\n", " let plots = yr.plots;\n", " if (types_1.isArray(plots)) {\n", " plots = plots.concat(this);\n", " yr.setv({ plots }, { silent: true });\n", " }\n", " }\n", " }\n", " add_layout(renderer, side = \"center\") {\n", " const renderers = this.properties[side].get_value();\n", " this.setv({ [side]: [...renderers, renderer] });\n", " }\n", " remove_layout(renderer) {\n", " const del = (items) => {\n", " array_1.remove_by(items, (item) => item == renderer);\n", " };\n", " del(this.left);\n", " del(this.right);\n", " del(this.above);\n", " del(this.below);\n", " del(this.center);\n", " }\n", " add_renderers(...renderers) {\n", " this.renderers = this.renderers.concat(renderers);\n", " }\n", " add_glyph(glyph, source = new column_data_source_1.ColumnDataSource(), extra_attrs = {}) {\n", " const attrs = Object.assign(Object.assign({}, extra_attrs), { data_source: source, glyph });\n", " const renderer = new glyph_renderer_1.GlyphRenderer(attrs);\n", " this.add_renderers(renderer);\n", " return renderer;\n", " }\n", " add_tools(...tools) {\n", " this.toolbar.tools = this.toolbar.tools.concat(tools);\n", " }\n", " get panels() {\n", " return [...this.side_panels, ...this.center];\n", " }\n", " get side_panels() {\n", " const { above, below, left, right } = this;\n", " return array_1.concat([above, below, left, right]);\n", " }\n", " }\n", " exports.Plot = Plot;\n", " Plot.__name__ = \"Plot\";\n", " Plot.init_Plot();\n", " },\n", " /* models/tools/toolbar.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const inspect_tool_1 = require(274) /* ./inspectors/inspect_tool */;\n", " const toolbar_base_1 = require(283) /* ./toolbar_base */;\n", " const _get_active_attr = (et) => {\n", " switch (et) {\n", " case 'tap': return 'active_tap';\n", " case 'pan': return 'active_drag';\n", " case 'pinch':\n", " case 'scroll': return 'active_scroll';\n", " case 'multi': return 'active_multi';\n", " }\n", " return null;\n", " };\n", " const _supports_auto = (et) => {\n", " return et == 'tap' || et == 'pan';\n", " };\n", " class Toolbar extends toolbar_base_1.ToolbarBase {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Toolbar() {\n", " this.prototype.default_view = toolbar_base_1.ToolbarBaseView;\n", " this.define({\n", " active_drag: [p.Any, 'auto'],\n", " active_inspect: [p.Any, 'auto'],\n", " active_scroll: [p.Any, 'auto'],\n", " active_tap: [p.Any, 'auto'],\n", " active_multi: [p.Any, null],\n", " });\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " const { tools, active_drag, active_inspect, active_scroll, active_tap, active_multi } = this.properties;\n", " this.on_change([tools, active_drag, active_inspect, active_scroll, active_tap, active_multi], () => this._init_tools());\n", " }\n", " _init_tools() {\n", " super._init_tools();\n", " if (this.active_inspect == 'auto') {\n", " // do nothing as all tools are active be default\n", " }\n", " else if (this.active_inspect instanceof inspect_tool_1.InspectTool) {\n", " let found = false;\n", " for (const inspector of this.inspectors) {\n", " if (inspector != this.active_inspect)\n", " inspector.active = false;\n", " else\n", " found = true;\n", " }\n", " if (!found) {\n", " this.active_inspect = null;\n", " }\n", " }\n", " else if (types_1.isArray(this.active_inspect)) {\n", " const active_inspect = array_1.intersection(this.active_inspect, this.inspectors);\n", " if (active_inspect.length != this.active_inspect.length) {\n", " this.active_inspect = active_inspect;\n", " }\n", " for (const inspector of this.inspectors) {\n", " if (!array_1.includes(this.active_inspect, inspector))\n", " inspector.active = false;\n", " }\n", " }\n", " else if (this.active_inspect == null) {\n", " for (const inspector of this.inspectors)\n", " inspector.active = false;\n", " }\n", " const _activate_gesture = (tool) => {\n", " if (tool.active) {\n", " // tool was activated by a proxy, but we need to finish configuration manually\n", " this._active_change(tool);\n", " }\n", " else\n", " tool.active = true;\n", " };\n", " // Connecting signals has to be done before changing the active state of the tools.\n", " for (const et in this.gestures) {\n", " const gesture = this.gestures[et];\n", " gesture.tools = array_1.sort_by(gesture.tools, (tool) => tool.default_order);\n", " for (const tool of gesture.tools) {\n", " this.connect(tool.properties.active.change, () => this._active_change(tool));\n", " }\n", " }\n", " for (const et in this.gestures) {\n", " const active_attr = _get_active_attr(et);\n", " if (active_attr) {\n", " const active_tool = this[active_attr];\n", " if (active_tool == 'auto') {\n", " const gesture = this.gestures[et];\n", " if (gesture.tools.length != 0 && _supports_auto(et)) {\n", " _activate_gesture(gesture.tools[0]);\n", " }\n", " }\n", " else if (active_tool != null) {\n", " if (array_1.includes(this.tools, active_tool)) {\n", " _activate_gesture(active_tool);\n", " }\n", " else {\n", " this[active_attr] = null;\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " exports.Toolbar = Toolbar;\n", " Toolbar.__name__ = \"Toolbar\";\n", " Toolbar.init_Toolbar();\n", " },\n", " /* models/tools/inspectors/inspect_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const button_tool_1 = require(275) /* ../button_tool */;\n", " const on_off_button_1 = require(282) /* ../on_off_button */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " class InspectToolView extends button_tool_1.ButtonToolView {\n", " }\n", " exports.InspectToolView = InspectToolView;\n", " InspectToolView.__name__ = \"InspectToolView\";\n", " class InspectTool extends button_tool_1.ButtonTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.event_type = \"move\";\n", " }\n", " static init_InspectTool() {\n", " this.prototype.button_view = on_off_button_1.OnOffButtonView;\n", " this.define({\n", " toggleable: [p.Boolean, true],\n", " });\n", " this.override({\n", " active: true,\n", " });\n", " }\n", " }\n", " exports.InspectTool = InspectTool;\n", " InspectTool.__name__ = \"InspectTool\";\n", " InspectTool.init_InspectTool();\n", " },\n", " /* models/tools/button_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const hammerjs_1 = tslib_1.__importDefault(require(276) /* hammerjs */);\n", " const dom_view_1 = require(66) /* ../../core/dom_view */;\n", " const tool_1 = require(277) /* ./tool */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const string_1 = require(24) /* ../../core/util/string */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const toolbar_1 = require(278) /* ../../styles/toolbar */;\n", " const toolbar_css_1 = tslib_1.__importDefault(require(279) /* ../../styles/toolbar.css */);\n", " const icons_css_1 = tslib_1.__importDefault(require(280) /* ../../styles/icons.css */);\n", " const menus_css_1 = tslib_1.__importDefault(require(257) /* ../../styles/menus.css */);\n", " const menus_1 = require(281) /* ../../core/util/menus */;\n", " class ButtonToolButtonView extends dom_view_1.DOMView {\n", " initialize() {\n", " super.initialize();\n", " const items = this.model.menu;\n", " if (items != null) {\n", " const location = this.parent.model.toolbar_location;\n", " const reverse = location == \"left\" || location == \"above\";\n", " const orientation = this.parent.model.horizontal ? \"vertical\" : \"horizontal\";\n", " this._menu = new menus_1.ContextMenu(!reverse ? items : array_1.reversed(items), {\n", " orientation,\n", " prevent_hide: (event) => event.target == this.el,\n", " });\n", " }\n", " this._hammer = new hammerjs_1.default(this.el, {\n", " touchAction: \"auto\",\n", " inputClass: hammerjs_1.default.TouchMouseInput,\n", " });\n", " this.connect(this.model.change, () => this.render());\n", " this._hammer.on(\"tap\", (e) => {\n", " var _a;\n", " if ((_a = this._menu) === null || _a === void 0 ? void 0 : _a.is_open) {\n", " this._menu.hide();\n", " return;\n", " }\n", " if (e.target == this.el) {\n", " this._clicked();\n", " }\n", " });\n", " this._hammer.on(\"press\", () => this._pressed());\n", " }\n", " remove() {\n", " var _a;\n", " this._hammer.destroy();\n", " (_a = this._menu) === null || _a === void 0 ? void 0 : _a.remove();\n", " super.remove();\n", " }\n", " styles() {\n", " return [...super.styles(), toolbar_css_1.default, icons_css_1.default, menus_css_1.default];\n", " }\n", " css_classes() {\n", " return super.css_classes().concat(toolbar_1.bk_toolbar_button);\n", " }\n", " render() {\n", " dom_1.empty(this.el);\n", " const icon = this.model.computed_icon;\n", " if (types_1.isString(icon)) {\n", " if (string_1.startsWith(icon, \"data:image\"))\n", " this.el.style.backgroundImage = \"url('\" + icon + \"')\";\n", " else\n", " this.el.classList.add(icon);\n", " }\n", " this.el.title = this.model.tooltip;\n", " if (this._menu != null) {\n", " this.root.el.appendChild(this._menu.el);\n", " }\n", " }\n", " _pressed() {\n", " var _a;\n", " const { left, top, right, bottom } = this.el.getBoundingClientRect();\n", " const at = (() => {\n", " switch (this.parent.model.toolbar_location) {\n", " case \"right\":\n", " return { right: left, top };\n", " case \"left\":\n", " return { left: right, top };\n", " case \"above\":\n", " return { left, top: bottom };\n", " case \"below\":\n", " return { left, bottom: top };\n", " }\n", " })();\n", " (_a = this._menu) === null || _a === void 0 ? void 0 : _a.toggle(at);\n", " }\n", " }\n", " exports.ButtonToolButtonView = ButtonToolButtonView;\n", " ButtonToolButtonView.__name__ = \"ButtonToolButtonView\";\n", " class ButtonToolView extends tool_1.ToolView {\n", " }\n", " exports.ButtonToolView = ButtonToolView;\n", " ButtonToolView.__name__ = \"ButtonToolView\";\n", " class ButtonTool extends tool_1.Tool {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ButtonTool() {\n", " this.internal({\n", " disabled: [p.Boolean, false],\n", " });\n", " }\n", " get tooltip() {\n", " return this.tool_name;\n", " }\n", " get computed_icon() {\n", " return this.icon;\n", " }\n", " get menu() {\n", " return null;\n", " }\n", " }\n", " exports.ButtonTool = ButtonTool;\n", " ButtonTool.__name__ = \"ButtonTool\";\n", " ButtonTool.init_ButtonTool();\n", " },\n", " /* hammerjs/hammer.js */ function _(require, module, exports) {\n", " /*! Hammer.JS - v2.0.7 - 2016-04-22\n", " * http://hammerjs.github.io/\n", " *\n", " * Copyright (c) 2016 Jorik Tangelder;\n", " * Licensed under the MIT license */\n", " (function (window, document, exportName, undefined) {\n", " 'use strict';\n", " var VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];\n", " var TEST_ELEMENT = document.createElement('div');\n", " var TYPE_FUNCTION = 'function';\n", " var round = Math.round;\n", " var abs = Math.abs;\n", " var now = Date.now;\n", " /**\n", " * set a timeout with a given scope\n", " * @param {Function} fn\n", " * @param {Number} timeout\n", " * @param {Object} context\n", " * @returns {number}\n", " */\n", " function setTimeoutContext(fn, timeout, context) {\n", " return setTimeout(bindFn(fn, context), timeout);\n", " }\n", " /**\n", " * if the argument is an array, we want to execute the fn on each entry\n", " * if it aint an array we don't want to do a thing.\n", " * this is used by all the methods that accept a single and array argument.\n", " * @param {*|Array} arg\n", " * @param {String} fn\n", " * @param {Object} [context]\n", " * @returns {Boolean}\n", " */\n", " function invokeArrayArg(arg, fn, context) {\n", " if (Array.isArray(arg)) {\n", " each(arg, context[fn], context);\n", " return true;\n", " }\n", " return false;\n", " }\n", " /**\n", " * walk objects and arrays\n", " * @param {Object} obj\n", " * @param {Function} iterator\n", " * @param {Object} context\n", " */\n", " function each(obj, iterator, context) {\n", " var i;\n", " if (!obj) {\n", " return;\n", " }\n", " if (obj.forEach) {\n", " obj.forEach(iterator, context);\n", " }\n", " else if (obj.length !== undefined) {\n", " i = 0;\n", " while (i < obj.length) {\n", " iterator.call(context, obj[i], i, obj);\n", " i++;\n", " }\n", " }\n", " else {\n", " for (i in obj) {\n", " obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);\n", " }\n", " }\n", " }\n", " /**\n", " * wrap a method with a deprecation warning and stack trace\n", " * @param {Function} method\n", " * @param {String} name\n", " * @param {String} message\n", " * @returns {Function} A new function wrapping the supplied method.\n", " */\n", " function deprecate(method, name, message) {\n", " var deprecationMessage = 'DEPRECATED METHOD: ' + name + '\\n' + message + ' AT \\n';\n", " return function () {\n", " var e = new Error('get-stack-trace');\n", " var stack = e && e.stack ? e.stack.replace(/^[^\\(]+?[\\n$]/gm, '')\n", " .replace(/^\\s+at\\s+/gm, '')\n", " .replace(/^Object.\\s*\\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';\n", " var log = window.console && (window.console.warn || window.console.log);\n", " if (log) {\n", " log.call(window.console, deprecationMessage, stack);\n", " }\n", " return method.apply(this, arguments);\n", " };\n", " }\n", " /**\n", " * extend object.\n", " * means that properties in dest will be overwritten by the ones in src.\n", " * @param {Object} target\n", " * @param {...Object} objects_to_assign\n", " * @returns {Object} target\n", " */\n", " var assign;\n", " if (typeof Object.assign !== 'function') {\n", " assign = function assign(target) {\n", " if (target === undefined || target === null) {\n", " throw new TypeError('Cannot convert undefined or null to object');\n", " }\n", " var output = Object(target);\n", " for (var index = 1; index < arguments.length; index++) {\n", " var source = arguments[index];\n", " if (source !== undefined && source !== null) {\n", " for (var nextKey in source) {\n", " if (source.hasOwnProperty(nextKey)) {\n", " output[nextKey] = source[nextKey];\n", " }\n", " }\n", " }\n", " }\n", " return output;\n", " };\n", " }\n", " else {\n", " assign = Object.assign;\n", " }\n", " /**\n", " * extend object.\n", " * means that properties in dest will be overwritten by the ones in src.\n", " * @param {Object} dest\n", " * @param {Object} src\n", " * @param {Boolean} [merge=false]\n", " * @returns {Object} dest\n", " */\n", " var extend = deprecate(function extend(dest, src, merge) {\n", " var keys = Object.keys(src);\n", " var i = 0;\n", " while (i < keys.length) {\n", " if (!merge || (merge && dest[keys[i]] === undefined)) {\n", " dest[keys[i]] = src[keys[i]];\n", " }\n", " i++;\n", " }\n", " return dest;\n", " }, 'extend', 'Use `assign`.');\n", " /**\n", " * merge the values from src in the dest.\n", " * means that properties that exist in dest will not be overwritten by src\n", " * @param {Object} dest\n", " * @param {Object} src\n", " * @returns {Object} dest\n", " */\n", " var merge = deprecate(function merge(dest, src) {\n", " return extend(dest, src, true);\n", " }, 'merge', 'Use `assign`.');\n", " /**\n", " * simple class inheritance\n", " * @param {Function} child\n", " * @param {Function} base\n", " * @param {Object} [properties]\n", " */\n", " function inherit(child, base, properties) {\n", " var baseP = base.prototype, childP;\n", " childP = child.prototype = Object.create(baseP);\n", " childP.constructor = child;\n", " childP._super = baseP;\n", " if (properties) {\n", " assign(childP, properties);\n", " }\n", " }\n", " /**\n", " * simple function bind\n", " * @param {Function} fn\n", " * @param {Object} context\n", " * @returns {Function}\n", " */\n", " function bindFn(fn, context) {\n", " return function boundFn() {\n", " return fn.apply(context, arguments);\n", " };\n", " }\n", " /**\n", " * let a boolean value also be a function that must return a boolean\n", " * this first item in args will be used as the context\n", " * @param {Boolean|Function} val\n", " * @param {Array} [args]\n", " * @returns {Boolean}\n", " */\n", " function boolOrFn(val, args) {\n", " if (typeof val == TYPE_FUNCTION) {\n", " return val.apply(args ? args[0] || undefined : undefined, args);\n", " }\n", " return val;\n", " }\n", " /**\n", " * use the val2 when val1 is undefined\n", " * @param {*} val1\n", " * @param {*} val2\n", " * @returns {*}\n", " */\n", " function ifUndefined(val1, val2) {\n", " return (val1 === undefined) ? val2 : val1;\n", " }\n", " /**\n", " * addEventListener with multiple events at once\n", " * @param {EventTarget} target\n", " * @param {String} types\n", " * @param {Function} handler\n", " */\n", " function addEventListeners(target, types, handler) {\n", " each(splitStr(types), function (type) {\n", " target.addEventListener(type, handler, false);\n", " });\n", " }\n", " /**\n", " * removeEventListener with multiple events at once\n", " * @param {EventTarget} target\n", " * @param {String} types\n", " * @param {Function} handler\n", " */\n", " function removeEventListeners(target, types, handler) {\n", " each(splitStr(types), function (type) {\n", " target.removeEventListener(type, handler, false);\n", " });\n", " }\n", " /**\n", " * find if a node is in the given parent\n", " * @method hasParent\n", " * @param {HTMLElement} node\n", " * @param {HTMLElement} parent\n", " * @return {Boolean} found\n", " */\n", " function hasParent(node, parent) {\n", " while (node) {\n", " if (node == parent) {\n", " return true;\n", " }\n", " node = node.parentNode;\n", " }\n", " return false;\n", " }\n", " /**\n", " * small indexOf wrapper\n", " * @param {String} str\n", " * @param {String} find\n", " * @returns {Boolean} found\n", " */\n", " function inStr(str, find) {\n", " return str.indexOf(find) > -1;\n", " }\n", " /**\n", " * split string on whitespace\n", " * @param {String} str\n", " * @returns {Array} words\n", " */\n", " function splitStr(str) {\n", " return str.trim().split(/\\s+/g);\n", " }\n", " /**\n", " * find if a array contains the object using indexOf or a simple polyFill\n", " * @param {Array} src\n", " * @param {String} find\n", " * @param {String} [findByKey]\n", " * @return {Boolean|Number} false when not found, or the index\n", " */\n", " function inArray(src, find, findByKey) {\n", " if (src.indexOf && !findByKey) {\n", " return src.indexOf(find);\n", " }\n", " else {\n", " var i = 0;\n", " while (i < src.length) {\n", " if ((findByKey && src[i][findByKey] == find) || (!findByKey && src[i] === find)) {\n", " return i;\n", " }\n", " i++;\n", " }\n", " return -1;\n", " }\n", " }\n", " /**\n", " * convert array-like objects to real arrays\n", " * @param {Object} obj\n", " * @returns {Array}\n", " */\n", " function toArray(obj) {\n", " return Array.prototype.slice.call(obj, 0);\n", " }\n", " /**\n", " * unique array with objects based on a key (like 'id') or just by the array's value\n", " * @param {Array} src [{id:1},{id:2},{id:1}]\n", " * @param {String} [key]\n", " * @param {Boolean} [sort=False]\n", " * @returns {Array} [{id:1},{id:2}]\n", " */\n", " function uniqueArray(src, key, sort) {\n", " var results = [];\n", " var values = [];\n", " var i = 0;\n", " while (i < src.length) {\n", " var val = key ? src[i][key] : src[i];\n", " if (inArray(values, val) < 0) {\n", " results.push(src[i]);\n", " }\n", " values[i] = val;\n", " i++;\n", " }\n", " if (sort) {\n", " if (!key) {\n", " results = results.sort();\n", " }\n", " else {\n", " results = results.sort(function sortUniqueArray(a, b) {\n", " return a[key] > b[key];\n", " });\n", " }\n", " }\n", " return results;\n", " }\n", " /**\n", " * get the prefixed property\n", " * @param {Object} obj\n", " * @param {String} property\n", " * @returns {String|Undefined} prefixed\n", " */\n", " function prefixed(obj, property) {\n", " var prefix, prop;\n", " var camelProp = property[0].toUpperCase() + property.slice(1);\n", " var i = 0;\n", " while (i < VENDOR_PREFIXES.length) {\n", " prefix = VENDOR_PREFIXES[i];\n", " prop = (prefix) ? prefix + camelProp : property;\n", " if (prop in obj) {\n", " return prop;\n", " }\n", " i++;\n", " }\n", " return undefined;\n", " }\n", " /**\n", " * get a unique id\n", " * @returns {number} uniqueId\n", " */\n", " var _uniqueId = 1;\n", " function uniqueId() {\n", " return _uniqueId++;\n", " }\n", " /**\n", " * get the window object of an element\n", " * @param {HTMLElement} element\n", " * @returns {DocumentView|Window}\n", " */\n", " function getWindowForElement(element) {\n", " var doc = element.ownerDocument || element;\n", " return (doc.defaultView || doc.parentWindow || window);\n", " }\n", " var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;\n", " var SUPPORT_TOUCH = ('ontouchstart' in window);\n", " var SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined;\n", " var SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);\n", " var INPUT_TYPE_TOUCH = 'touch';\n", " var INPUT_TYPE_PEN = 'pen';\n", " var INPUT_TYPE_MOUSE = 'mouse';\n", " var INPUT_TYPE_KINECT = 'kinect';\n", " var COMPUTE_INTERVAL = 25;\n", " var INPUT_START = 1;\n", " var INPUT_MOVE = 2;\n", " var INPUT_END = 4;\n", " var INPUT_CANCEL = 8;\n", " var DIRECTION_NONE = 1;\n", " var DIRECTION_LEFT = 2;\n", " var DIRECTION_RIGHT = 4;\n", " var DIRECTION_UP = 8;\n", " var DIRECTION_DOWN = 16;\n", " var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;\n", " var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;\n", " var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;\n", " var PROPS_XY = ['x', 'y'];\n", " var PROPS_CLIENT_XY = ['clientX', 'clientY'];\n", " /**\n", " * create new input type manager\n", " * @param {Manager} manager\n", " * @param {Function} callback\n", " * @returns {Input}\n", " * @constructor\n", " */\n", " function Input(manager, callback) {\n", " var self = this;\n", " this.manager = manager;\n", " this.callback = callback;\n", " this.element = manager.element;\n", " this.target = manager.options.inputTarget;\n", " // smaller wrapper around the handler, for the scope and the enabled state of the manager,\n", " // so when disabled the input events are completely bypassed.\n", " this.domHandler = function (ev) {\n", " if (boolOrFn(manager.options.enable, [manager])) {\n", " self.handler(ev);\n", " }\n", " };\n", " this.init();\n", " }\n", " Input.prototype = {\n", " /**\n", " * should handle the inputEvent data and trigger the callback\n", " * @virtual\n", " */\n", " handler: function () { },\n", " /**\n", " * bind the events\n", " */\n", " init: function () {\n", " this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);\n", " this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);\n", " this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n", " },\n", " /**\n", " * unbind the events\n", " */\n", " destroy: function () {\n", " this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);\n", " this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);\n", " this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n", " }\n", " };\n", " /**\n", " * create new input type manager\n", " * called by the Manager constructor\n", " * @param {Hammer} manager\n", " * @returns {Input}\n", " */\n", " function createInputInstance(manager) {\n", " var Type;\n", " var inputClass = manager.options.inputClass;\n", " if (inputClass) {\n", " Type = inputClass;\n", " }\n", " else if (SUPPORT_POINTER_EVENTS) {\n", " Type = PointerEventInput;\n", " }\n", " else if (SUPPORT_ONLY_TOUCH) {\n", " Type = TouchInput;\n", " }\n", " else if (!SUPPORT_TOUCH) {\n", " Type = MouseInput;\n", " }\n", " else {\n", " Type = TouchMouseInput;\n", " }\n", " return new (Type)(manager, inputHandler);\n", " }\n", " /**\n", " * handle input events\n", " * @param {Manager} manager\n", " * @param {String} eventType\n", " * @param {Object} input\n", " */\n", " function inputHandler(manager, eventType, input) {\n", " var pointersLen = input.pointers.length;\n", " var changedPointersLen = input.changedPointers.length;\n", " var isFirst = (eventType & INPUT_START && (pointersLen - changedPointersLen === 0));\n", " var isFinal = (eventType & (INPUT_END | INPUT_CANCEL) && (pointersLen - changedPointersLen === 0));\n", " input.isFirst = !!isFirst;\n", " input.isFinal = !!isFinal;\n", " if (isFirst) {\n", " manager.session = {};\n", " }\n", " // source event is the normalized value of the domEvents\n", " // like 'touchstart, mouseup, pointerdown'\n", " input.eventType = eventType;\n", " // compute scale, rotation etc\n", " computeInputData(manager, input);\n", " // emit secret event\n", " manager.emit('hammer.input', input);\n", " manager.recognize(input);\n", " manager.session.prevInput = input;\n", " }\n", " /**\n", " * extend the data with some usable properties like scale, rotate, velocity etc\n", " * @param {Object} manager\n", " * @param {Object} input\n", " */\n", " function computeInputData(manager, input) {\n", " var session = manager.session;\n", " var pointers = input.pointers;\n", " var pointersLength = pointers.length;\n", " // store the first input to calculate the distance and direction\n", " if (!session.firstInput) {\n", " session.firstInput = simpleCloneInputData(input);\n", " }\n", " // to compute scale and rotation we need to store the multiple touches\n", " if (pointersLength > 1 && !session.firstMultiple) {\n", " session.firstMultiple = simpleCloneInputData(input);\n", " }\n", " else if (pointersLength === 1) {\n", " session.firstMultiple = false;\n", " }\n", " var firstInput = session.firstInput;\n", " var firstMultiple = session.firstMultiple;\n", " var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;\n", " var center = input.center = getCenter(pointers);\n", " input.timeStamp = now();\n", " input.deltaTime = input.timeStamp - firstInput.timeStamp;\n", " input.angle = getAngle(offsetCenter, center);\n", " input.distance = getDistance(offsetCenter, center);\n", " computeDeltaXY(session, input);\n", " input.offsetDirection = getDirection(input.deltaX, input.deltaY);\n", " var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);\n", " input.overallVelocityX = overallVelocity.x;\n", " input.overallVelocityY = overallVelocity.y;\n", " input.overallVelocity = (abs(overallVelocity.x) > abs(overallVelocity.y)) ? overallVelocity.x : overallVelocity.y;\n", " input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;\n", " input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;\n", " input.maxPointers = !session.prevInput ? input.pointers.length : ((input.pointers.length >\n", " session.prevInput.maxPointers) ? input.pointers.length : session.prevInput.maxPointers);\n", " computeIntervalInputData(session, input);\n", " // find the correct target\n", " var target = manager.element;\n", " if (hasParent(input.srcEvent.target, target)) {\n", " target = input.srcEvent.target;\n", " }\n", " input.target = target;\n", " }\n", " function computeDeltaXY(session, input) {\n", " var center = input.center;\n", " var offset = session.offsetDelta || {};\n", " var prevDelta = session.prevDelta || {};\n", " var prevInput = session.prevInput || {};\n", " if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {\n", " prevDelta = session.prevDelta = {\n", " x: prevInput.deltaX || 0,\n", " y: prevInput.deltaY || 0\n", " };\n", " offset = session.offsetDelta = {\n", " x: center.x,\n", " y: center.y\n", " };\n", " }\n", " input.deltaX = prevDelta.x + (center.x - offset.x);\n", " input.deltaY = prevDelta.y + (center.y - offset.y);\n", " }\n", " /**\n", " * velocity is calculated every x ms\n", " * @param {Object} session\n", " * @param {Object} input\n", " */\n", " function computeIntervalInputData(session, input) {\n", " var last = session.lastInterval || input, deltaTime = input.timeStamp - last.timeStamp, velocity, velocityX, velocityY, direction;\n", " if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {\n", " var deltaX = input.deltaX - last.deltaX;\n", " var deltaY = input.deltaY - last.deltaY;\n", " var v = getVelocity(deltaTime, deltaX, deltaY);\n", " velocityX = v.x;\n", " velocityY = v.y;\n", " velocity = (abs(v.x) > abs(v.y)) ? v.x : v.y;\n", " direction = getDirection(deltaX, deltaY);\n", " session.lastInterval = input;\n", " }\n", " else {\n", " // use latest velocity info if it doesn't overtake a minimum period\n", " velocity = last.velocity;\n", " velocityX = last.velocityX;\n", " velocityY = last.velocityY;\n", " direction = last.direction;\n", " }\n", " input.velocity = velocity;\n", " input.velocityX = velocityX;\n", " input.velocityY = velocityY;\n", " input.direction = direction;\n", " }\n", " /**\n", " * create a simple clone from the input used for storage of firstInput and firstMultiple\n", " * @param {Object} input\n", " * @returns {Object} clonedInputData\n", " */\n", " function simpleCloneInputData(input) {\n", " // make a simple copy of the pointers because we will get a reference if we don't\n", " // we only need clientXY for the calculations\n", " var pointers = [];\n", " var i = 0;\n", " while (i < input.pointers.length) {\n", " pointers[i] = {\n", " clientX: round(input.pointers[i].clientX),\n", " clientY: round(input.pointers[i].clientY)\n", " };\n", " i++;\n", " }\n", " return {\n", " timeStamp: now(),\n", " pointers: pointers,\n", " center: getCenter(pointers),\n", " deltaX: input.deltaX,\n", " deltaY: input.deltaY\n", " };\n", " }\n", " /**\n", " * get the center of all the pointers\n", " * @param {Array} pointers\n", " * @return {Object} center contains `x` and `y` properties\n", " */\n", " function getCenter(pointers) {\n", " var pointersLength = pointers.length;\n", " // no need to loop when only one touch\n", " if (pointersLength === 1) {\n", " return {\n", " x: round(pointers[0].clientX),\n", " y: round(pointers[0].clientY)\n", " };\n", " }\n", " var x = 0, y = 0, i = 0;\n", " while (i < pointersLength) {\n", " x += pointers[i].clientX;\n", " y += pointers[i].clientY;\n", " i++;\n", " }\n", " return {\n", " x: round(x / pointersLength),\n", " y: round(y / pointersLength)\n", " };\n", " }\n", " /**\n", " * calculate the velocity between two points. unit is in px per ms.\n", " * @param {Number} deltaTime\n", " * @param {Number} x\n", " * @param {Number} y\n", " * @return {Object} velocity `x` and `y`\n", " */\n", " function getVelocity(deltaTime, x, y) {\n", " return {\n", " x: x / deltaTime || 0,\n", " y: y / deltaTime || 0\n", " };\n", " }\n", " /**\n", " * get the direction between two points\n", " * @param {Number} x\n", " * @param {Number} y\n", " * @return {Number} direction\n", " */\n", " function getDirection(x, y) {\n", " if (x === y) {\n", " return DIRECTION_NONE;\n", " }\n", " if (abs(x) >= abs(y)) {\n", " return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;\n", " }\n", " return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;\n", " }\n", " /**\n", " * calculate the absolute distance between two points\n", " * @param {Object} p1 {x, y}\n", " * @param {Object} p2 {x, y}\n", " * @param {Array} [props] containing x and y keys\n", " * @return {Number} distance\n", " */\n", " function getDistance(p1, p2, props) {\n", " if (!props) {\n", " props = PROPS_XY;\n", " }\n", " var x = p2[props[0]] - p1[props[0]], y = p2[props[1]] - p1[props[1]];\n", " return Math.sqrt((x * x) + (y * y));\n", " }\n", " /**\n", " * calculate the angle between two coordinates\n", " * @param {Object} p1\n", " * @param {Object} p2\n", " * @param {Array} [props] containing x and y keys\n", " * @return {Number} angle\n", " */\n", " function getAngle(p1, p2, props) {\n", " if (!props) {\n", " props = PROPS_XY;\n", " }\n", " var x = p2[props[0]] - p1[props[0]], y = p2[props[1]] - p1[props[1]];\n", " return Math.atan2(y, x) * 180 / Math.PI;\n", " }\n", " /**\n", " * calculate the rotation degrees between two pointersets\n", " * @param {Array} start array of pointers\n", " * @param {Array} end array of pointers\n", " * @return {Number} rotation\n", " */\n", " function getRotation(start, end) {\n", " return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);\n", " }\n", " /**\n", " * calculate the scale factor between two pointersets\n", " * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out\n", " * @param {Array} start array of pointers\n", " * @param {Array} end array of pointers\n", " * @return {Number} scale\n", " */\n", " function getScale(start, end) {\n", " return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);\n", " }\n", " var MOUSE_INPUT_MAP = {\n", " mousedown: INPUT_START,\n", " mousemove: INPUT_MOVE,\n", " mouseup: INPUT_END\n", " };\n", " var MOUSE_ELEMENT_EVENTS = 'mousedown';\n", " var MOUSE_WINDOW_EVENTS = 'mousemove mouseup';\n", " /**\n", " * Mouse events input\n", " * @constructor\n", " * @extends Input\n", " */\n", " function MouseInput() {\n", " this.evEl = MOUSE_ELEMENT_EVENTS;\n", " this.evWin = MOUSE_WINDOW_EVENTS;\n", " this.pressed = false; // mousedown state\n", " Input.apply(this, arguments);\n", " }\n", " inherit(MouseInput, Input, {\n", " /**\n", " * handle mouse events\n", " * @param {Object} ev\n", " */\n", " handler: function MEhandler(ev) {\n", " var eventType = MOUSE_INPUT_MAP[ev.type];\n", " // on start we want to have the left mouse button down\n", " if (eventType & INPUT_START && ev.button === 0) {\n", " this.pressed = true;\n", " }\n", " if (eventType & INPUT_MOVE && ev.which !== 1) {\n", " eventType = INPUT_END;\n", " }\n", " // mouse must be down\n", " if (!this.pressed) {\n", " return;\n", " }\n", " if (eventType & INPUT_END) {\n", " this.pressed = false;\n", " }\n", " this.callback(this.manager, eventType, {\n", " pointers: [ev],\n", " changedPointers: [ev],\n", " pointerType: INPUT_TYPE_MOUSE,\n", " srcEvent: ev\n", " });\n", " }\n", " });\n", " var POINTER_INPUT_MAP = {\n", " pointerdown: INPUT_START,\n", " pointermove: INPUT_MOVE,\n", " pointerup: INPUT_END,\n", " pointercancel: INPUT_CANCEL,\n", " pointerout: INPUT_CANCEL\n", " };\n", " // in IE10 the pointer types is defined as an enum\n", " var IE10_POINTER_TYPE_ENUM = {\n", " 2: INPUT_TYPE_TOUCH,\n", " 3: INPUT_TYPE_PEN,\n", " 4: INPUT_TYPE_MOUSE,\n", " 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816\n", " };\n", " var POINTER_ELEMENT_EVENTS = 'pointerdown';\n", " var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';\n", " // IE10 has prefixed support, and case-sensitive\n", " if (window.MSPointerEvent && !window.PointerEvent) {\n", " POINTER_ELEMENT_EVENTS = 'MSPointerDown';\n", " POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';\n", " }\n", " /**\n", " * Pointer events input\n", " * @constructor\n", " * @extends Input\n", " */\n", " function PointerEventInput() {\n", " this.evEl = POINTER_ELEMENT_EVENTS;\n", " this.evWin = POINTER_WINDOW_EVENTS;\n", " Input.apply(this, arguments);\n", " this.store = (this.manager.session.pointerEvents = []);\n", " }\n", " inherit(PointerEventInput, Input, {\n", " /**\n", " * handle mouse events\n", " * @param {Object} ev\n", " */\n", " handler: function PEhandler(ev) {\n", " var store = this.store;\n", " var removePointer = false;\n", " var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');\n", " var eventType = POINTER_INPUT_MAP[eventTypeNormalized];\n", " var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;\n", " var isTouch = (pointerType == INPUT_TYPE_TOUCH);\n", " // get index of the event in the store\n", " var storeIndex = inArray(store, ev.pointerId, 'pointerId');\n", " // start and mouse must be down\n", " if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {\n", " if (storeIndex < 0) {\n", " store.push(ev);\n", " storeIndex = store.length - 1;\n", " }\n", " }\n", " else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n", " removePointer = true;\n", " }\n", " // it not found, so the pointer hasn't been down (so it's probably a hover)\n", " if (storeIndex < 0) {\n", " return;\n", " }\n", " // update the event in the store\n", " store[storeIndex] = ev;\n", " this.callback(this.manager, eventType, {\n", " pointers: store,\n", " changedPointers: [ev],\n", " pointerType: pointerType,\n", " srcEvent: ev\n", " });\n", " if (removePointer) {\n", " // remove from the store\n", " store.splice(storeIndex, 1);\n", " }\n", " }\n", " });\n", " var SINGLE_TOUCH_INPUT_MAP = {\n", " touchstart: INPUT_START,\n", " touchmove: INPUT_MOVE,\n", " touchend: INPUT_END,\n", " touchcancel: INPUT_CANCEL\n", " };\n", " var SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';\n", " var SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';\n", " /**\n", " * Touch events input\n", " * @constructor\n", " * @extends Input\n", " */\n", " function SingleTouchInput() {\n", " this.evTarget = SINGLE_TOUCH_TARGET_EVENTS;\n", " this.evWin = SINGLE_TOUCH_WINDOW_EVENTS;\n", " this.started = false;\n", " Input.apply(this, arguments);\n", " }\n", " inherit(SingleTouchInput, Input, {\n", " handler: function TEhandler(ev) {\n", " var type = SINGLE_TOUCH_INPUT_MAP[ev.type];\n", " // should we handle the touch events?\n", " if (type === INPUT_START) {\n", " this.started = true;\n", " }\n", " if (!this.started) {\n", " return;\n", " }\n", " var touches = normalizeSingleTouches.call(this, ev, type);\n", " // when done, reset the started state\n", " if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {\n", " this.started = false;\n", " }\n", " this.callback(this.manager, type, {\n", " pointers: touches[0],\n", " changedPointers: touches[1],\n", " pointerType: INPUT_TYPE_TOUCH,\n", " srcEvent: ev\n", " });\n", " }\n", " });\n", " /**\n", " * @this {TouchInput}\n", " * @param {Object} ev\n", " * @param {Number} type flag\n", " * @returns {undefined|Array} [all, changed]\n", " */\n", " function normalizeSingleTouches(ev, type) {\n", " var all = toArray(ev.touches);\n", " var changed = toArray(ev.changedTouches);\n", " if (type & (INPUT_END | INPUT_CANCEL)) {\n", " all = uniqueArray(all.concat(changed), 'identifier', true);\n", " }\n", " return [all, changed];\n", " }\n", " var TOUCH_INPUT_MAP = {\n", " touchstart: INPUT_START,\n", " touchmove: INPUT_MOVE,\n", " touchend: INPUT_END,\n", " touchcancel: INPUT_CANCEL\n", " };\n", " var TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';\n", " /**\n", " * Multi-user touch events input\n", " * @constructor\n", " * @extends Input\n", " */\n", " function TouchInput() {\n", " this.evTarget = TOUCH_TARGET_EVENTS;\n", " this.targetIds = {};\n", " Input.apply(this, arguments);\n", " }\n", " inherit(TouchInput, Input, {\n", " handler: function MTEhandler(ev) {\n", " var type = TOUCH_INPUT_MAP[ev.type];\n", " var touches = getTouches.call(this, ev, type);\n", " if (!touches) {\n", " return;\n", " }\n", " this.callback(this.manager, type, {\n", " pointers: touches[0],\n", " changedPointers: touches[1],\n", " pointerType: INPUT_TYPE_TOUCH,\n", " srcEvent: ev\n", " });\n", " }\n", " });\n", " /**\n", " * @this {TouchInput}\n", " * @param {Object} ev\n", " * @param {Number} type flag\n", " * @returns {undefined|Array} [all, changed]\n", " */\n", " function getTouches(ev, type) {\n", " var allTouches = toArray(ev.touches);\n", " var targetIds = this.targetIds;\n", " // when there is only one touch, the process can be simplified\n", " if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {\n", " targetIds[allTouches[0].identifier] = true;\n", " return [allTouches, allTouches];\n", " }\n", " var i, targetTouches, changedTouches = toArray(ev.changedTouches), changedTargetTouches = [], target = this.target;\n", " // get target touches from touches\n", " targetTouches = allTouches.filter(function (touch) {\n", " return hasParent(touch.target, target);\n", " });\n", " // collect touches\n", " if (type === INPUT_START) {\n", " i = 0;\n", " while (i < targetTouches.length) {\n", " targetIds[targetTouches[i].identifier] = true;\n", " i++;\n", " }\n", " }\n", " // filter changed touches to only contain touches that exist in the collected target ids\n", " i = 0;\n", " while (i < changedTouches.length) {\n", " if (targetIds[changedTouches[i].identifier]) {\n", " changedTargetTouches.push(changedTouches[i]);\n", " }\n", " // cleanup removed touches\n", " if (type & (INPUT_END | INPUT_CANCEL)) {\n", " delete targetIds[changedTouches[i].identifier];\n", " }\n", " i++;\n", " }\n", " if (!changedTargetTouches.length) {\n", " return;\n", " }\n", " return [\n", " // merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'\n", " uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true),\n", " changedTargetTouches\n", " ];\n", " }\n", " /**\n", " * Combined touch and mouse input\n", " *\n", " * Touch has a higher priority then mouse, and while touching no mouse events are allowed.\n", " * This because touch devices also emit mouse events while doing a touch.\n", " *\n", " * @constructor\n", " * @extends Input\n", " */\n", " var DEDUP_TIMEOUT = 2500;\n", " var DEDUP_DISTANCE = 25;\n", " function TouchMouseInput() {\n", " Input.apply(this, arguments);\n", " var handler = bindFn(this.handler, this);\n", " this.touch = new TouchInput(this.manager, handler);\n", " this.mouse = new MouseInput(this.manager, handler);\n", " this.primaryTouch = null;\n", " this.lastTouches = [];\n", " }\n", " inherit(TouchMouseInput, Input, {\n", " /**\n", " * handle mouse and touch events\n", " * @param {Hammer} manager\n", " * @param {String} inputEvent\n", " * @param {Object} inputData\n", " */\n", " handler: function TMEhandler(manager, inputEvent, inputData) {\n", " var isTouch = (inputData.pointerType == INPUT_TYPE_TOUCH), isMouse = (inputData.pointerType == INPUT_TYPE_MOUSE);\n", " if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) {\n", " return;\n", " }\n", " // when we're in a touch event, record touches to de-dupe synthetic mouse event\n", " if (isTouch) {\n", " recordTouches.call(this, inputEvent, inputData);\n", " }\n", " else if (isMouse && isSyntheticEvent.call(this, inputData)) {\n", " return;\n", " }\n", " this.callback(manager, inputEvent, inputData);\n", " },\n", " /**\n", " * remove the event listeners\n", " */\n", " destroy: function destroy() {\n", " this.touch.destroy();\n", " this.mouse.destroy();\n", " }\n", " });\n", " function recordTouches(eventType, eventData) {\n", " if (eventType & INPUT_START) {\n", " this.primaryTouch = eventData.changedPointers[0].identifier;\n", " setLastTouch.call(this, eventData);\n", " }\n", " else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n", " setLastTouch.call(this, eventData);\n", " }\n", " }\n", " function setLastTouch(eventData) {\n", " var touch = eventData.changedPointers[0];\n", " if (touch.identifier === this.primaryTouch) {\n", " var lastTouch = { x: touch.clientX, y: touch.clientY };\n", " this.lastTouches.push(lastTouch);\n", " var lts = this.lastTouches;\n", " var removeLastTouch = function () {\n", " var i = lts.indexOf(lastTouch);\n", " if (i > -1) {\n", " lts.splice(i, 1);\n", " }\n", " };\n", " setTimeout(removeLastTouch, DEDUP_TIMEOUT);\n", " }\n", " }\n", " function isSyntheticEvent(eventData) {\n", " var x = eventData.srcEvent.clientX, y = eventData.srcEvent.clientY;\n", " for (var i = 0; i < this.lastTouches.length; i++) {\n", " var t = this.lastTouches[i];\n", " var dx = Math.abs(x - t.x), dy = Math.abs(y - t.y);\n", " if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) {\n", " return true;\n", " }\n", " }\n", " return false;\n", " }\n", " var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');\n", " var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;\n", " // magical touchAction value\n", " var TOUCH_ACTION_COMPUTE = 'compute';\n", " var TOUCH_ACTION_AUTO = 'auto';\n", " var TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented\n", " var TOUCH_ACTION_NONE = 'none';\n", " var TOUCH_ACTION_PAN_X = 'pan-x';\n", " var TOUCH_ACTION_PAN_Y = 'pan-y';\n", " var TOUCH_ACTION_MAP = getTouchActionProps();\n", " /**\n", " * Touch Action\n", " * sets the touchAction property or uses the js alternative\n", " * @param {Manager} manager\n", " * @param {String} value\n", " * @constructor\n", " */\n", " function TouchAction(manager, value) {\n", " this.manager = manager;\n", " this.set(value);\n", " }\n", " TouchAction.prototype = {\n", " /**\n", " * set the touchAction value on the element or enable the polyfill\n", " * @param {String} value\n", " */\n", " set: function (value) {\n", " // find out the touch-action by the event handlers\n", " if (value == TOUCH_ACTION_COMPUTE) {\n", " value = this.compute();\n", " }\n", " if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) {\n", " this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;\n", " }\n", " this.actions = value.toLowerCase().trim();\n", " },\n", " /**\n", " * just re-set the touchAction value\n", " */\n", " update: function () {\n", " this.set(this.manager.options.touchAction);\n", " },\n", " /**\n", " * compute the value for the touchAction property based on the recognizer's settings\n", " * @returns {String} value\n", " */\n", " compute: function () {\n", " var actions = [];\n", " each(this.manager.recognizers, function (recognizer) {\n", " if (boolOrFn(recognizer.options.enable, [recognizer])) {\n", " actions = actions.concat(recognizer.getTouchAction());\n", " }\n", " });\n", " return cleanTouchActions(actions.join(' '));\n", " },\n", " /**\n", " * this method is called on each input cycle and provides the preventing of the browser behavior\n", " * @param {Object} input\n", " */\n", " preventDefaults: function (input) {\n", " var srcEvent = input.srcEvent;\n", " var direction = input.offsetDirection;\n", " // if the touch action did prevented once this session\n", " if (this.manager.session.prevented) {\n", " srcEvent.preventDefault();\n", " return;\n", " }\n", " var actions = this.actions;\n", " var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE];\n", " var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y];\n", " var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X];\n", " if (hasNone) {\n", " //do not prevent defaults if this is a tap gesture\n", " var isTapPointer = input.pointers.length === 1;\n", " var isTapMovement = input.distance < 2;\n", " var isTapTouchTime = input.deltaTime < 250;\n", " if (isTapPointer && isTapMovement && isTapTouchTime) {\n", " return;\n", " }\n", " }\n", " if (hasPanX && hasPanY) {\n", " // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent\n", " return;\n", " }\n", " if (hasNone ||\n", " (hasPanY && direction & DIRECTION_HORIZONTAL) ||\n", " (hasPanX && direction & DIRECTION_VERTICAL)) {\n", " return this.preventSrc(srcEvent);\n", " }\n", " },\n", " /**\n", " * call preventDefault to prevent the browser's default behavior (scrolling in most cases)\n", " * @param {Object} srcEvent\n", " */\n", " preventSrc: function (srcEvent) {\n", " this.manager.session.prevented = true;\n", " srcEvent.preventDefault();\n", " }\n", " };\n", " /**\n", " * when the touchActions are collected they are not a valid value, so we need to clean things up. *\n", " * @param {String} actions\n", " * @returns {*}\n", " */\n", " function cleanTouchActions(actions) {\n", " // none\n", " if (inStr(actions, TOUCH_ACTION_NONE)) {\n", " return TOUCH_ACTION_NONE;\n", " }\n", " var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);\n", " var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);\n", " // if both pan-x and pan-y are set (different recognizers\n", " // for different directions, e.g. horizontal pan but vertical swipe?)\n", " // we need none (as otherwise with pan-x pan-y combined none of these\n", " // recognizers will work, since the browser would handle all panning\n", " if (hasPanX && hasPanY) {\n", " return TOUCH_ACTION_NONE;\n", " }\n", " // pan-x OR pan-y\n", " if (hasPanX || hasPanY) {\n", " return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;\n", " }\n", " // manipulation\n", " if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {\n", " return TOUCH_ACTION_MANIPULATION;\n", " }\n", " return TOUCH_ACTION_AUTO;\n", " }\n", " function getTouchActionProps() {\n", " if (!NATIVE_TOUCH_ACTION) {\n", " return false;\n", " }\n", " var touchMap = {};\n", " var cssSupports = window.CSS && window.CSS.supports;\n", " ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function (val) {\n", " // If css.supports is not supported but there is native touch-action assume it supports\n", " // all values. This is the case for IE 10 and 11.\n", " touchMap[val] = cssSupports ? window.CSS.supports('touch-action', val) : true;\n", " });\n", " return touchMap;\n", " }\n", " /**\n", " * Recognizer flow explained; *\n", " * All recognizers have the initial state of POSSIBLE when a input session starts.\n", " * The definition of a input session is from the first input until the last input, with all it's movement in it. *\n", " * Example session for mouse-input: mousedown -> mousemove -> mouseup\n", " *\n", " * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed\n", " * which determines with state it should be.\n", " *\n", " * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to\n", " * POSSIBLE to give it another change on the next cycle.\n", " *\n", " * Possible\n", " * |\n", " * +-----+---------------+\n", " * | |\n", " * +-----+-----+ |\n", " * | | |\n", " * Failed Cancelled |\n", " * +-------+------+\n", " * | |\n", " * Recognized Began\n", " * |\n", " * Changed\n", " * |\n", " * Ended/Recognized\n", " */\n", " var STATE_POSSIBLE = 1;\n", " var STATE_BEGAN = 2;\n", " var STATE_CHANGED = 4;\n", " var STATE_ENDED = 8;\n", " var STATE_RECOGNIZED = STATE_ENDED;\n", " var STATE_CANCELLED = 16;\n", " var STATE_FAILED = 32;\n", " /**\n", " * Recognizer\n", " * Every recognizer needs to extend from this class.\n", " * @constructor\n", " * @param {Object} options\n", " */\n", " function Recognizer(options) {\n", " this.options = assign({}, this.defaults, options || {});\n", " this.id = uniqueId();\n", " this.manager = null;\n", " // default is enable true\n", " this.options.enable = ifUndefined(this.options.enable, true);\n", " this.state = STATE_POSSIBLE;\n", " this.simultaneous = {};\n", " this.requireFail = [];\n", " }\n", " Recognizer.prototype = {\n", " /**\n", " * @virtual\n", " * @type {Object}\n", " */\n", " defaults: {},\n", " /**\n", " * set options\n", " * @param {Object} options\n", " * @return {Recognizer}\n", " */\n", " set: function (options) {\n", " assign(this.options, options);\n", " // also update the touchAction, in case something changed about the directions/enabled state\n", " this.manager && this.manager.touchAction.update();\n", " return this;\n", " },\n", " /**\n", " * recognize simultaneous with an other recognizer.\n", " * @param {Recognizer} otherRecognizer\n", " * @returns {Recognizer} this\n", " */\n", " recognizeWith: function (otherRecognizer) {\n", " if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {\n", " return this;\n", " }\n", " var simultaneous = this.simultaneous;\n", " otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n", " if (!simultaneous[otherRecognizer.id]) {\n", " simultaneous[otherRecognizer.id] = otherRecognizer;\n", " otherRecognizer.recognizeWith(this);\n", " }\n", " return this;\n", " },\n", " /**\n", " * drop the simultaneous link. it doesnt remove the link on the other recognizer.\n", " * @param {Recognizer} otherRecognizer\n", " * @returns {Recognizer} this\n", " */\n", " dropRecognizeWith: function (otherRecognizer) {\n", " if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {\n", " return this;\n", " }\n", " otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n", " delete this.simultaneous[otherRecognizer.id];\n", " return this;\n", " },\n", " /**\n", " * recognizer can only run when an other is failing\n", " * @param {Recognizer} otherRecognizer\n", " * @returns {Recognizer} this\n", " */\n", " requireFailure: function (otherRecognizer) {\n", " if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {\n", " return this;\n", " }\n", " var requireFail = this.requireFail;\n", " otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n", " if (inArray(requireFail, otherRecognizer) === -1) {\n", " requireFail.push(otherRecognizer);\n", " otherRecognizer.requireFailure(this);\n", " }\n", " return this;\n", " },\n", " /**\n", " * drop the requireFailure link. it does not remove the link on the other recognizer.\n", " * @param {Recognizer} otherRecognizer\n", " * @returns {Recognizer} this\n", " */\n", " dropRequireFailure: function (otherRecognizer) {\n", " if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {\n", " return this;\n", " }\n", " otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n", " var index = inArray(this.requireFail, otherRecognizer);\n", " if (index > -1) {\n", " this.requireFail.splice(index, 1);\n", " }\n", " return this;\n", " },\n", " /**\n", " * has require failures boolean\n", " * @returns {boolean}\n", " */\n", " hasRequireFailures: function () {\n", " return this.requireFail.length > 0;\n", " },\n", " /**\n", " * if the recognizer can recognize simultaneous with an other recognizer\n", " * @param {Recognizer} otherRecognizer\n", " * @returns {Boolean}\n", " */\n", " canRecognizeWith: function (otherRecognizer) {\n", " return !!this.simultaneous[otherRecognizer.id];\n", " },\n", " /**\n", " * You should use `tryEmit` instead of `emit` directly to check\n", " * that all the needed recognizers has failed before emitting.\n", " * @param {Object} input\n", " */\n", " emit: function (input) {\n", " var self = this;\n", " var state = this.state;\n", " function emit(event) {\n", " self.manager.emit(event, input);\n", " }\n", " // 'panstart' and 'panmove'\n", " if (state < STATE_ENDED) {\n", " emit(self.options.event + stateStr(state));\n", " }\n", " emit(self.options.event); // simple 'eventName' events\n", " if (input.additionalEvent) { // additional event(panleft, panright, pinchin, pinchout...)\n", " emit(input.additionalEvent);\n", " }\n", " // panend and pancancel\n", " if (state >= STATE_ENDED) {\n", " emit(self.options.event + stateStr(state));\n", " }\n", " },\n", " /**\n", " * Check that all the require failure recognizers has failed,\n", " * if true, it emits a gesture event,\n", " * otherwise, setup the state to FAILED.\n", " * @param {Object} input\n", " */\n", " tryEmit: function (input) {\n", " if (this.canEmit()) {\n", " return this.emit(input);\n", " }\n", " // it's failing anyway\n", " this.state = STATE_FAILED;\n", " },\n", " /**\n", " * can we emit?\n", " * @returns {boolean}\n", " */\n", " canEmit: function () {\n", " var i = 0;\n", " while (i < this.requireFail.length) {\n", " if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {\n", " return false;\n", " }\n", " i++;\n", " }\n", " return true;\n", " },\n", " /**\n", " * update the recognizer\n", " * @param {Object} inputData\n", " */\n", " recognize: function (inputData) {\n", " // make a new copy of the inputData\n", " // so we can change the inputData without messing up the other recognizers\n", " var inputDataClone = assign({}, inputData);\n", " // is is enabled and allow recognizing?\n", " if (!boolOrFn(this.options.enable, [this, inputDataClone])) {\n", " this.reset();\n", " this.state = STATE_FAILED;\n", " return;\n", " }\n", " // reset when we've reached the end\n", " if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {\n", " this.state = STATE_POSSIBLE;\n", " }\n", " this.state = this.process(inputDataClone);\n", " // the recognizer has recognized a gesture\n", " // so trigger an event\n", " if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {\n", " this.tryEmit(inputDataClone);\n", " }\n", " },\n", " /**\n", " * return the state of the recognizer\n", " * the actual recognizing happens in this method\n", " * @virtual\n", " * @param {Object} inputData\n", " * @returns {Const} STATE\n", " */\n", " process: function (inputData) { },\n", " /**\n", " * return the preferred touch-action\n", " * @virtual\n", " * @returns {Array}\n", " */\n", " getTouchAction: function () { },\n", " /**\n", " * called when the gesture isn't allowed to recognize\n", " * like when another is being recognized or it is disabled\n", " * @virtual\n", " */\n", " reset: function () { }\n", " };\n", " /**\n", " * get a usable string, used as event postfix\n", " * @param {Const} state\n", " * @returns {String} state\n", " */\n", " function stateStr(state) {\n", " if (state & STATE_CANCELLED) {\n", " return 'cancel';\n", " }\n", " else if (state & STATE_ENDED) {\n", " return 'end';\n", " }\n", " else if (state & STATE_CHANGED) {\n", " return 'move';\n", " }\n", " else if (state & STATE_BEGAN) {\n", " return 'start';\n", " }\n", " return '';\n", " }\n", " /**\n", " * direction cons to string\n", " * @param {Const} direction\n", " * @returns {String}\n", " */\n", " function directionStr(direction) {\n", " if (direction == DIRECTION_DOWN) {\n", " return 'down';\n", " }\n", " else if (direction == DIRECTION_UP) {\n", " return 'up';\n", " }\n", " else if (direction == DIRECTION_LEFT) {\n", " return 'left';\n", " }\n", " else if (direction == DIRECTION_RIGHT) {\n", " return 'right';\n", " }\n", " return '';\n", " }\n", " /**\n", " * get a recognizer by name if it is bound to a manager\n", " * @param {Recognizer|String} otherRecognizer\n", " * @param {Recognizer} recognizer\n", " * @returns {Recognizer}\n", " */\n", " function getRecognizerByNameIfManager(otherRecognizer, recognizer) {\n", " var manager = recognizer.manager;\n", " if (manager) {\n", " return manager.get(otherRecognizer);\n", " }\n", " return otherRecognizer;\n", " }\n", " /**\n", " * This recognizer is just used as a base for the simple attribute recognizers.\n", " * @constructor\n", " * @extends Recognizer\n", " */\n", " function AttrRecognizer() {\n", " Recognizer.apply(this, arguments);\n", " }\n", " inherit(AttrRecognizer, Recognizer, {\n", " /**\n", " * @namespace\n", " * @memberof AttrRecognizer\n", " */\n", " defaults: {\n", " /**\n", " * @type {Number}\n", " * @default 1\n", " */\n", " pointers: 1\n", " },\n", " /**\n", " * Used to check if it the recognizer receives valid input, like input.distance > 10.\n", " * @memberof AttrRecognizer\n", " * @param {Object} input\n", " * @returns {Boolean} recognized\n", " */\n", " attrTest: function (input) {\n", " var optionPointers = this.options.pointers;\n", " return optionPointers === 0 || input.pointers.length === optionPointers;\n", " },\n", " /**\n", " * Process the input and return the state for the recognizer\n", " * @memberof AttrRecognizer\n", " * @param {Object} input\n", " * @returns {*} State\n", " */\n", " process: function (input) {\n", " var state = this.state;\n", " var eventType = input.eventType;\n", " var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);\n", " var isValid = this.attrTest(input);\n", " // on cancel input and we've recognized before, return STATE_CANCELLED\n", " if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {\n", " return state | STATE_CANCELLED;\n", " }\n", " else if (isRecognized || isValid) {\n", " if (eventType & INPUT_END) {\n", " return state | STATE_ENDED;\n", " }\n", " else if (!(state & STATE_BEGAN)) {\n", " return STATE_BEGAN;\n", " }\n", " return state | STATE_CHANGED;\n", " }\n", " return STATE_FAILED;\n", " }\n", " });\n", " /**\n", " * Pan\n", " * Recognized when the pointer is down and moved in the allowed direction.\n", " * @constructor\n", " * @extends AttrRecognizer\n", " */\n", " function PanRecognizer() {\n", " AttrRecognizer.apply(this, arguments);\n", " this.pX = null;\n", " this.pY = null;\n", " }\n", " inherit(PanRecognizer, AttrRecognizer, {\n", " /**\n", " * @namespace\n", " * @memberof PanRecognizer\n", " */\n", " defaults: {\n", " event: 'pan',\n", " threshold: 10,\n", " pointers: 1,\n", " direction: DIRECTION_ALL\n", " },\n", " getTouchAction: function () {\n", " var direction = this.options.direction;\n", " var actions = [];\n", " if (direction & DIRECTION_HORIZONTAL) {\n", " actions.push(TOUCH_ACTION_PAN_Y);\n", " }\n", " if (direction & DIRECTION_VERTICAL) {\n", " actions.push(TOUCH_ACTION_PAN_X);\n", " }\n", " return actions;\n", " },\n", " directionTest: function (input) {\n", " var options = this.options;\n", " var hasMoved = true;\n", " var distance = input.distance;\n", " var direction = input.direction;\n", " var x = input.deltaX;\n", " var y = input.deltaY;\n", " // lock to axis?\n", " if (!(direction & options.direction)) {\n", " if (options.direction & DIRECTION_HORIZONTAL) {\n", " direction = (x === 0) ? DIRECTION_NONE : (x < 0) ? DIRECTION_LEFT : DIRECTION_RIGHT;\n", " hasMoved = x != this.pX;\n", " distance = Math.abs(input.deltaX);\n", " }\n", " else {\n", " direction = (y === 0) ? DIRECTION_NONE : (y < 0) ? DIRECTION_UP : DIRECTION_DOWN;\n", " hasMoved = y != this.pY;\n", " distance = Math.abs(input.deltaY);\n", " }\n", " }\n", " input.direction = direction;\n", " return hasMoved && distance > options.threshold && direction & options.direction;\n", " },\n", " attrTest: function (input) {\n", " return AttrRecognizer.prototype.attrTest.call(this, input) &&\n", " (this.state & STATE_BEGAN || (!(this.state & STATE_BEGAN) && this.directionTest(input)));\n", " },\n", " emit: function (input) {\n", " this.pX = input.deltaX;\n", " this.pY = input.deltaY;\n", " var direction = directionStr(input.direction);\n", " if (direction) {\n", " input.additionalEvent = this.options.event + direction;\n", " }\n", " this._super.emit.call(this, input);\n", " }\n", " });\n", " /**\n", " * Pinch\n", " * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).\n", " * @constructor\n", " * @extends AttrRecognizer\n", " */\n", " function PinchRecognizer() {\n", " AttrRecognizer.apply(this, arguments);\n", " }\n", " inherit(PinchRecognizer, AttrRecognizer, {\n", " /**\n", " * @namespace\n", " * @memberof PinchRecognizer\n", " */\n", " defaults: {\n", " event: 'pinch',\n", " threshold: 0,\n", " pointers: 2\n", " },\n", " getTouchAction: function () {\n", " return [TOUCH_ACTION_NONE];\n", " },\n", " attrTest: function (input) {\n", " return this._super.attrTest.call(this, input) &&\n", " (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);\n", " },\n", " emit: function (input) {\n", " if (input.scale !== 1) {\n", " var inOut = input.scale < 1 ? 'in' : 'out';\n", " input.additionalEvent = this.options.event + inOut;\n", " }\n", " this._super.emit.call(this, input);\n", " }\n", " });\n", " /**\n", " * Press\n", " * Recognized when the pointer is down for x ms without any movement.\n", " * @constructor\n", " * @extends Recognizer\n", " */\n", " function PressRecognizer() {\n", " Recognizer.apply(this, arguments);\n", " this._timer = null;\n", " this._input = null;\n", " }\n", " inherit(PressRecognizer, Recognizer, {\n", " /**\n", " * @namespace\n", " * @memberof PressRecognizer\n", " */\n", " defaults: {\n", " event: 'press',\n", " pointers: 1,\n", " time: 251,\n", " threshold: 9 // a minimal movement is ok, but keep it low\n", " },\n", " getTouchAction: function () {\n", " return [TOUCH_ACTION_AUTO];\n", " },\n", " process: function (input) {\n", " var options = this.options;\n", " var validPointers = input.pointers.length === options.pointers;\n", " var validMovement = input.distance < options.threshold;\n", " var validTime = input.deltaTime > options.time;\n", " this._input = input;\n", " // we only allow little movement\n", " // and we've reached an end event, so a tap is possible\n", " if (!validMovement || !validPointers || (input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime)) {\n", " this.reset();\n", " }\n", " else if (input.eventType & INPUT_START) {\n", " this.reset();\n", " this._timer = setTimeoutContext(function () {\n", " this.state = STATE_RECOGNIZED;\n", " this.tryEmit();\n", " }, options.time, this);\n", " }\n", " else if (input.eventType & INPUT_END) {\n", " return STATE_RECOGNIZED;\n", " }\n", " return STATE_FAILED;\n", " },\n", " reset: function () {\n", " clearTimeout(this._timer);\n", " },\n", " emit: function (input) {\n", " if (this.state !== STATE_RECOGNIZED) {\n", " return;\n", " }\n", " if (input && (input.eventType & INPUT_END)) {\n", " this.manager.emit(this.options.event + 'up', input);\n", " }\n", " else {\n", " this._input.timeStamp = now();\n", " this.manager.emit(this.options.event, this._input);\n", " }\n", " }\n", " });\n", " /**\n", " * Rotate\n", " * Recognized when two or more pointer are moving in a circular motion.\n", " * @constructor\n", " * @extends AttrRecognizer\n", " */\n", " function RotateRecognizer() {\n", " AttrRecognizer.apply(this, arguments);\n", " }\n", " inherit(RotateRecognizer, AttrRecognizer, {\n", " /**\n", " * @namespace\n", " * @memberof RotateRecognizer\n", " */\n", " defaults: {\n", " event: 'rotate',\n", " threshold: 0,\n", " pointers: 2\n", " },\n", " getTouchAction: function () {\n", " return [TOUCH_ACTION_NONE];\n", " },\n", " attrTest: function (input) {\n", " return this._super.attrTest.call(this, input) &&\n", " (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);\n", " }\n", " });\n", " /**\n", " * Swipe\n", " * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.\n", " * @constructor\n", " * @extends AttrRecognizer\n", " */\n", " function SwipeRecognizer() {\n", " AttrRecognizer.apply(this, arguments);\n", " }\n", " inherit(SwipeRecognizer, AttrRecognizer, {\n", " /**\n", " * @namespace\n", " * @memberof SwipeRecognizer\n", " */\n", " defaults: {\n", " event: 'swipe',\n", " threshold: 10,\n", " velocity: 0.3,\n", " direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,\n", " pointers: 1\n", " },\n", " getTouchAction: function () {\n", " return PanRecognizer.prototype.getTouchAction.call(this);\n", " },\n", " attrTest: function (input) {\n", " var direction = this.options.direction;\n", " var velocity;\n", " if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {\n", " velocity = input.overallVelocity;\n", " }\n", " else if (direction & DIRECTION_HORIZONTAL) {\n", " velocity = input.overallVelocityX;\n", " }\n", " else if (direction & DIRECTION_VERTICAL) {\n", " velocity = input.overallVelocityY;\n", " }\n", " return this._super.attrTest.call(this, input) &&\n", " direction & input.offsetDirection &&\n", " input.distance > this.options.threshold &&\n", " input.maxPointers == this.options.pointers &&\n", " abs(velocity) > this.options.velocity && input.eventType & INPUT_END;\n", " },\n", " emit: function (input) {\n", " var direction = directionStr(input.offsetDirection);\n", " if (direction) {\n", " this.manager.emit(this.options.event + direction, input);\n", " }\n", " this.manager.emit(this.options.event, input);\n", " }\n", " });\n", " /**\n", " * A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur\n", " * between the given interval and position. The delay option can be used to recognize multi-taps without firing\n", " * a single tap.\n", " *\n", " * The eventData from the emitted event contains the property `tapCount`, which contains the amount of\n", " * multi-taps being recognized.\n", " * @constructor\n", " * @extends Recognizer\n", " */\n", " function TapRecognizer() {\n", " Recognizer.apply(this, arguments);\n", " // previous time and center,\n", " // used for tap counting\n", " this.pTime = false;\n", " this.pCenter = false;\n", " this._timer = null;\n", " this._input = null;\n", " this.count = 0;\n", " }\n", " inherit(TapRecognizer, Recognizer, {\n", " /**\n", " * @namespace\n", " * @memberof PinchRecognizer\n", " */\n", " defaults: {\n", " event: 'tap',\n", " pointers: 1,\n", " taps: 1,\n", " interval: 300,\n", " time: 250,\n", " threshold: 9,\n", " posThreshold: 10 // a multi-tap can be a bit off the initial position\n", " },\n", " getTouchAction: function () {\n", " return [TOUCH_ACTION_MANIPULATION];\n", " },\n", " process: function (input) {\n", " var options = this.options;\n", " var validPointers = input.pointers.length === options.pointers;\n", " var validMovement = input.distance < options.threshold;\n", " var validTouchTime = input.deltaTime < options.time;\n", " this.reset();\n", " if ((input.eventType & INPUT_START) && (this.count === 0)) {\n", " return this.failTimeout();\n", " }\n", " // we only allow little movement\n", " // and we've reached an end event, so a tap is possible\n", " if (validMovement && validTouchTime && validPointers) {\n", " if (input.eventType != INPUT_END) {\n", " return this.failTimeout();\n", " }\n", " var validInterval = this.pTime ? (input.timeStamp - this.pTime < options.interval) : true;\n", " var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;\n", " this.pTime = input.timeStamp;\n", " this.pCenter = input.center;\n", " if (!validMultiTap || !validInterval) {\n", " this.count = 1;\n", " }\n", " else {\n", " this.count += 1;\n", " }\n", " this._input = input;\n", " // if tap count matches we have recognized it,\n", " // else it has began recognizing...\n", " var tapCount = this.count % options.taps;\n", " if (tapCount === 0) {\n", " // no failing requirements, immediately trigger the tap event\n", " // or wait as long as the multitap interval to trigger\n", " if (!this.hasRequireFailures()) {\n", " return STATE_RECOGNIZED;\n", " }\n", " else {\n", " this._timer = setTimeoutContext(function () {\n", " this.state = STATE_RECOGNIZED;\n", " this.tryEmit();\n", " }, options.interval, this);\n", " return STATE_BEGAN;\n", " }\n", " }\n", " }\n", " return STATE_FAILED;\n", " },\n", " failTimeout: function () {\n", " this._timer = setTimeoutContext(function () {\n", " this.state = STATE_FAILED;\n", " }, this.options.interval, this);\n", " return STATE_FAILED;\n", " },\n", " reset: function () {\n", " clearTimeout(this._timer);\n", " },\n", " emit: function () {\n", " if (this.state == STATE_RECOGNIZED) {\n", " this._input.tapCount = this.count;\n", " this.manager.emit(this.options.event, this._input);\n", " }\n", " }\n", " });\n", " /**\n", " * Simple way to create a manager with a default set of recognizers.\n", " * @param {HTMLElement} element\n", " * @param {Object} [options]\n", " * @constructor\n", " */\n", " function Hammer(element, options) {\n", " options = options || {};\n", " options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset);\n", " return new Manager(element, options);\n", " }\n", " /**\n", " * @const {string}\n", " */\n", " Hammer.VERSION = '2.0.7';\n", " /**\n", " * default settings\n", " * @namespace\n", " */\n", " Hammer.defaults = {\n", " /**\n", " * set if DOM events are being triggered.\n", " * But this is slower and unused by simple implementations, so disabled by default.\n", " * @type {Boolean}\n", " * @default false\n", " */\n", " domEvents: false,\n", " /**\n", " * The value for the touchAction property/fallback.\n", " * When set to `compute` it will magically set the correct value based on the added recognizers.\n", " * @type {String}\n", " * @default compute\n", " */\n", " touchAction: TOUCH_ACTION_COMPUTE,\n", " /**\n", " * @type {Boolean}\n", " * @default true\n", " */\n", " enable: true,\n", " /**\n", " * EXPERIMENTAL FEATURE -- can be removed/changed\n", " * Change the parent input target element.\n", " * If Null, then it is being set the to main element.\n", " * @type {Null|EventTarget}\n", " * @default null\n", " */\n", " inputTarget: null,\n", " /**\n", " * force an input class\n", " * @type {Null|Function}\n", " * @default null\n", " */\n", " inputClass: null,\n", " /**\n", " * Default recognizer setup when calling `Hammer()`\n", " * When creating a new Manager these will be skipped.\n", " * @type {Array}\n", " */\n", " preset: [\n", " // RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]\n", " [RotateRecognizer, { enable: false }],\n", " [PinchRecognizer, { enable: false }, ['rotate']],\n", " [SwipeRecognizer, { direction: DIRECTION_HORIZONTAL }],\n", " [PanRecognizer, { direction: DIRECTION_HORIZONTAL }, ['swipe']],\n", " [TapRecognizer],\n", " [TapRecognizer, { event: 'doubletap', taps: 2 }, ['tap']],\n", " [PressRecognizer]\n", " ],\n", " /**\n", " * Some CSS properties can be used to improve the working of Hammer.\n", " * Add them to this method and they will be set when creating a new Manager.\n", " * @namespace\n", " */\n", " cssProps: {\n", " /**\n", " * Disables text selection to improve the dragging gesture. Mainly for desktop browsers.\n", " * @type {String}\n", " * @default 'none'\n", " */\n", " userSelect: 'none',\n", " /**\n", " * Disable the Windows Phone grippers when pressing an element.\n", " * @type {String}\n", " * @default 'none'\n", " */\n", " touchSelect: 'none',\n", " /**\n", " * Disables the default callout shown when you touch and hold a touch target.\n", " * On iOS, when you touch and hold a touch target such as a link, Safari displays\n", " * a callout containing information about the link. This property allows you to disable that callout.\n", " * @type {String}\n", " * @default 'none'\n", " */\n", " touchCallout: 'none',\n", " /**\n", " * Specifies whether zooming is enabled. Used by IE10>\n", " * @type {String}\n", " * @default 'none'\n", " */\n", " contentZooming: 'none',\n", " /**\n", " * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.\n", " * @type {String}\n", " * @default 'none'\n", " */\n", " userDrag: 'none',\n", " /**\n", " * Overrides the highlight color shown when the user taps a link or a JavaScript\n", " * clickable element in iOS. This property obeys the alpha value, if specified.\n", " * @type {String}\n", " * @default 'rgba(0,0,0,0)'\n", " */\n", " tapHighlightColor: 'rgba(0,0,0,0)'\n", " }\n", " };\n", " var STOP = 1;\n", " var FORCED_STOP = 2;\n", " /**\n", " * Manager\n", " * @param {HTMLElement} element\n", " * @param {Object} [options]\n", " * @constructor\n", " */\n", " function Manager(element, options) {\n", " this.options = assign({}, Hammer.defaults, options || {});\n", " this.options.inputTarget = this.options.inputTarget || element;\n", " this.handlers = {};\n", " this.session = {};\n", " this.recognizers = [];\n", " this.oldCssProps = {};\n", " this.element = element;\n", " this.input = createInputInstance(this);\n", " this.touchAction = new TouchAction(this, this.options.touchAction);\n", " toggleCssProps(this, true);\n", " each(this.options.recognizers, function (item) {\n", " var recognizer = this.add(new (item[0])(item[1]));\n", " item[2] && recognizer.recognizeWith(item[2]);\n", " item[3] && recognizer.requireFailure(item[3]);\n", " }, this);\n", " }\n", " Manager.prototype = {\n", " /**\n", " * set options\n", " * @param {Object} options\n", " * @returns {Manager}\n", " */\n", " set: function (options) {\n", " assign(this.options, options);\n", " // Options that need a little more setup\n", " if (options.touchAction) {\n", " this.touchAction.update();\n", " }\n", " if (options.inputTarget) {\n", " // Clean up existing event listeners and reinitialize\n", " this.input.destroy();\n", " this.input.target = options.inputTarget;\n", " this.input.init();\n", " }\n", " return this;\n", " },\n", " /**\n", " * stop recognizing for this session.\n", " * This session will be discarded, when a new [input]start event is fired.\n", " * When forced, the recognizer cycle is stopped immediately.\n", " * @param {Boolean} [force]\n", " */\n", " stop: function (force) {\n", " this.session.stopped = force ? FORCED_STOP : STOP;\n", " },\n", " /**\n", " * run the recognizers!\n", " * called by the inputHandler function on every movement of the pointers (touches)\n", " * it walks through all the recognizers and tries to detect the gesture that is being made\n", " * @param {Object} inputData\n", " */\n", " recognize: function (inputData) {\n", " var session = this.session;\n", " if (session.stopped) {\n", " return;\n", " }\n", " // run the touch-action polyfill\n", " this.touchAction.preventDefaults(inputData);\n", " var recognizer;\n", " var recognizers = this.recognizers;\n", " // this holds the recognizer that is being recognized.\n", " // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED\n", " // if no recognizer is detecting a thing, it is set to `null`\n", " var curRecognizer = session.curRecognizer;\n", " // reset when the last recognizer is recognized\n", " // or when we're in a new session\n", " if (!curRecognizer || (curRecognizer && curRecognizer.state & STATE_RECOGNIZED)) {\n", " curRecognizer = session.curRecognizer = null;\n", " }\n", " var i = 0;\n", " while (i < recognizers.length) {\n", " recognizer = recognizers[i];\n", " // find out if we are allowed try to recognize the input for this one.\n", " // 1. allow if the session is NOT forced stopped (see the .stop() method)\n", " // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one\n", " // that is being recognized.\n", " // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.\n", " // this can be setup with the `recognizeWith()` method on the recognizer.\n", " if (session.stopped !== FORCED_STOP && ( // 1\n", " !curRecognizer || recognizer == curRecognizer || // 2\n", " recognizer.canRecognizeWith(curRecognizer))) { // 3\n", " recognizer.recognize(inputData);\n", " }\n", " else {\n", " recognizer.reset();\n", " }\n", " // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the\n", " // current active recognizer. but only if we don't already have an active recognizer\n", " if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {\n", " curRecognizer = session.curRecognizer = recognizer;\n", " }\n", " i++;\n", " }\n", " },\n", " /**\n", " * get a recognizer by its event name.\n", " * @param {Recognizer|String} recognizer\n", " * @returns {Recognizer|Null}\n", " */\n", " get: function (recognizer) {\n", " if (recognizer instanceof Recognizer) {\n", " return recognizer;\n", " }\n", " var recognizers = this.recognizers;\n", " for (var i = 0; i < recognizers.length; i++) {\n", " if (recognizers[i].options.event == recognizer) {\n", " return recognizers[i];\n", " }\n", " }\n", " return null;\n", " },\n", " /**\n", " * add a recognizer to the manager\n", " * existing recognizers with the same event name will be removed\n", " * @param {Recognizer} recognizer\n", " * @returns {Recognizer|Manager}\n", " */\n", " add: function (recognizer) {\n", " if (invokeArrayArg(recognizer, 'add', this)) {\n", " return this;\n", " }\n", " // remove existing\n", " var existing = this.get(recognizer.options.event);\n", " if (existing) {\n", " this.remove(existing);\n", " }\n", " this.recognizers.push(recognizer);\n", " recognizer.manager = this;\n", " this.touchAction.update();\n", " return recognizer;\n", " },\n", " /**\n", " * remove a recognizer by name or instance\n", " * @param {Recognizer|String} recognizer\n", " * @returns {Manager}\n", " */\n", " remove: function (recognizer) {\n", " if (invokeArrayArg(recognizer, 'remove', this)) {\n", " return this;\n", " }\n", " recognizer = this.get(recognizer);\n", " // let's make sure this recognizer exists\n", " if (recognizer) {\n", " var recognizers = this.recognizers;\n", " var index = inArray(recognizers, recognizer);\n", " if (index !== -1) {\n", " recognizers.splice(index, 1);\n", " this.touchAction.update();\n", " }\n", " }\n", " return this;\n", " },\n", " /**\n", " * bind event\n", " * @param {String} events\n", " * @param {Function} handler\n", " * @returns {EventEmitter} this\n", " */\n", " on: function (events, handler) {\n", " if (events === undefined) {\n", " return;\n", " }\n", " if (handler === undefined) {\n", " return;\n", " }\n", " var handlers = this.handlers;\n", " each(splitStr(events), function (event) {\n", " handlers[event] = handlers[event] || [];\n", " handlers[event].push(handler);\n", " });\n", " return this;\n", " },\n", " /**\n", " * unbind event, leave emit blank to remove all handlers\n", " * @param {String} events\n", " * @param {Function} [handler]\n", " * @returns {EventEmitter} this\n", " */\n", " off: function (events, handler) {\n", " if (events === undefined) {\n", " return;\n", " }\n", " var handlers = this.handlers;\n", " each(splitStr(events), function (event) {\n", " if (!handler) {\n", " delete handlers[event];\n", " }\n", " else {\n", " handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);\n", " }\n", " });\n", " return this;\n", " },\n", " /**\n", " * emit event to the listeners\n", " * @param {String} event\n", " * @param {Object} data\n", " */\n", " emit: function (event, data) {\n", " // we also want to trigger dom events\n", " if (this.options.domEvents) {\n", " triggerDomEvent(event, data);\n", " }\n", " // no handlers, so skip it all\n", " var handlers = this.handlers[event] && this.handlers[event].slice();\n", " if (!handlers || !handlers.length) {\n", " return;\n", " }\n", " data.type = event;\n", " data.preventDefault = function () {\n", " data.srcEvent.preventDefault();\n", " };\n", " var i = 0;\n", " while (i < handlers.length) {\n", " handlers[i](data);\n", " i++;\n", " }\n", " },\n", " /**\n", " * destroy the manager and unbinds all events\n", " * it doesn't unbind dom events, that is the user own responsibility\n", " */\n", " destroy: function () {\n", " this.element && toggleCssProps(this, false);\n", " this.handlers = {};\n", " this.session = {};\n", " this.input.destroy();\n", " this.element = null;\n", " }\n", " };\n", " /**\n", " * add/remove the css properties as defined in manager.options.cssProps\n", " * @param {Manager} manager\n", " * @param {Boolean} add\n", " */\n", " function toggleCssProps(manager, add) {\n", " var element = manager.element;\n", " if (!element.style) {\n", " return;\n", " }\n", " var prop;\n", " each(manager.options.cssProps, function (value, name) {\n", " prop = prefixed(element.style, name);\n", " if (add) {\n", " manager.oldCssProps[prop] = element.style[prop];\n", " element.style[prop] = value;\n", " }\n", " else {\n", " element.style[prop] = manager.oldCssProps[prop] || '';\n", " }\n", " });\n", " if (!add) {\n", " manager.oldCssProps = {};\n", " }\n", " }\n", " /**\n", " * trigger dom event\n", " * @param {String} event\n", " * @param {Object} data\n", " */\n", " function triggerDomEvent(event, data) {\n", " var gestureEvent = document.createEvent('Event');\n", " gestureEvent.initEvent(event, true, true);\n", " gestureEvent.gesture = data;\n", " data.target.dispatchEvent(gestureEvent);\n", " }\n", " assign(Hammer, {\n", " INPUT_START: INPUT_START,\n", " INPUT_MOVE: INPUT_MOVE,\n", " INPUT_END: INPUT_END,\n", " INPUT_CANCEL: INPUT_CANCEL,\n", " STATE_POSSIBLE: STATE_POSSIBLE,\n", " STATE_BEGAN: STATE_BEGAN,\n", " STATE_CHANGED: STATE_CHANGED,\n", " STATE_ENDED: STATE_ENDED,\n", " STATE_RECOGNIZED: STATE_RECOGNIZED,\n", " STATE_CANCELLED: STATE_CANCELLED,\n", " STATE_FAILED: STATE_FAILED,\n", " DIRECTION_NONE: DIRECTION_NONE,\n", " DIRECTION_LEFT: DIRECTION_LEFT,\n", " DIRECTION_RIGHT: DIRECTION_RIGHT,\n", " DIRECTION_UP: DIRECTION_UP,\n", " DIRECTION_DOWN: DIRECTION_DOWN,\n", " DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL,\n", " DIRECTION_VERTICAL: DIRECTION_VERTICAL,\n", " DIRECTION_ALL: DIRECTION_ALL,\n", " Manager: Manager,\n", " Input: Input,\n", " TouchAction: TouchAction,\n", " TouchInput: TouchInput,\n", " MouseInput: MouseInput,\n", " PointerEventInput: PointerEventInput,\n", " TouchMouseInput: TouchMouseInput,\n", " SingleTouchInput: SingleTouchInput,\n", " Recognizer: Recognizer,\n", " AttrRecognizer: AttrRecognizer,\n", " Tap: TapRecognizer,\n", " Pan: PanRecognizer,\n", " Swipe: SwipeRecognizer,\n", " Pinch: PinchRecognizer,\n", " Rotate: RotateRecognizer,\n", " Press: PressRecognizer,\n", " on: addEventListeners,\n", " off: removeEventListeners,\n", " each: each,\n", " merge: merge,\n", " extend: extend,\n", " assign: assign,\n", " inherit: inherit,\n", " bindFn: bindFn,\n", " prefixed: prefixed\n", " });\n", " // this prevents errors when Hammer is loaded in the presence of an AMD\n", " // style loader but by script tag, not by the loader.\n", " var freeGlobal = (typeof window !== 'undefined' ? window : (typeof self !== 'undefined' ? self : {})); // jshint ignore:line\n", " freeGlobal.Hammer = Hammer;\n", " if (typeof define === 'function' && define.amd) {\n", " define(function () {\n", " return Hammer;\n", " });\n", " }\n", " else if (typeof module != 'undefined' && module.exports) {\n", " module.exports = Hammer;\n", " }\n", " else {\n", " window[exportName] = Hammer;\n", " }\n", " })(window, document, 'Hammer');\n", " },\n", " /* models/tools/tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const view_1 = require(67) /* ../../core/view */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const model_1 = require(71) /* ../../model */;\n", " class ToolView extends view_1.View {\n", " get plot_view() {\n", " return this.parent;\n", " }\n", " get plot_model() {\n", " return this.parent.model;\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.active.change, () => {\n", " if (this.model.active)\n", " this.activate();\n", " else\n", " this.deactivate();\n", " });\n", " }\n", " // activate is triggered by toolbar ui actions\n", " activate() { }\n", " // deactivate is triggered by toolbar ui actions\n", " deactivate() { }\n", " }\n", " exports.ToolView = ToolView;\n", " ToolView.__name__ = \"ToolView\";\n", " class Tool extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Tool() {\n", " this.prototype._known_aliases = new Map();\n", " this.internal({\n", " active: [p.Boolean, false],\n", " });\n", " }\n", " get synthetic_renderers() {\n", " return [];\n", " }\n", " // utility function to return a tool name, modified\n", " // by the active dimensions. Used by tools that have dimensions\n", " _get_dim_tooltip(name, dims) {\n", " switch (dims) {\n", " case \"width\": return `${name} (x-axis)`;\n", " case \"height\": return `${name} (y-axis)`;\n", " case \"both\": return name;\n", " }\n", " }\n", " // utility function to get limits along both dimensions, given\n", " // optional dimensional constraints\n", " _get_dim_limits([sx0, sy0], [sx1, sy1], frame, dims) {\n", " const hr = frame.bbox.h_range;\n", " let sxlim;\n", " if (dims == 'width' || dims == 'both') {\n", " sxlim = [array_1.min([sx0, sx1]), array_1.max([sx0, sx1])];\n", " sxlim = [array_1.max([sxlim[0], hr.start]), array_1.min([sxlim[1], hr.end])];\n", " }\n", " else\n", " sxlim = [hr.start, hr.end];\n", " const vr = frame.bbox.v_range;\n", " let sylim;\n", " if (dims == 'height' || dims == 'both') {\n", " sylim = [array_1.min([sy0, sy1]), array_1.max([sy0, sy1])];\n", " sylim = [array_1.max([sylim[0], vr.start]), array_1.min([sylim[1], vr.end])];\n", " }\n", " else\n", " sylim = [vr.start, vr.end];\n", " return [sxlim, sylim];\n", " }\n", " static register_alias(name, fn) {\n", " this.prototype._known_aliases.set(name, fn);\n", " }\n", " static from_string(name) {\n", " const fn = this.prototype._known_aliases.get(name);\n", " if (fn != null)\n", " return fn();\n", " else {\n", " const names = [...this.prototype._known_aliases.keys()];\n", " throw new Error(`unexpected tool name '${name}', possible tools are ${names.join(\", \")}`);\n", " }\n", " }\n", " }\n", " exports.Tool = Tool;\n", " Tool.__name__ = \"Tool\";\n", " Tool.init_Tool();\n", " },\n", " /* styles/toolbar.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.bk_toolbar = \"bk-toolbar\";\n", " exports.bk_toolbar_hidden = \"bk-toolbar-hidden\";\n", " exports.bk_toolbar_button = \"bk-toolbar-button\";\n", " exports.bk_button_bar = \"bk-button-bar\";\n", " exports.bk_toolbar_button_custom_action = \"bk-toolbar-button-custom-action\";\n", " },\n", " /* styles/toolbar.css.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const css = `\n", " .bk-root .bk-toolbar-hidden {\n", " visibility: hidden;\n", " opacity: 0;\n", " transition: visibility 0.3s linear, opacity 0.3s linear;\n", " }\n", " .bk-root .bk-toolbar,\n", " .bk-root .bk-button-bar {\n", " display: flex;\n", " display: -webkit-flex;\n", " flex-wrap: nowrap;\n", " -webkit-flex-wrap: nowrap;\n", " align-items: center;\n", " -webkit-align-items: center;\n", " user-select: none;\n", " -ms-user-select: none;\n", " -moz-user-select: none;\n", " -webkit-user-select: none;\n", " }\n", " .bk-root .bk-toolbar .bk-logo {\n", " flex-shrink: 0;\n", " -webkit-flex-shrink: 0;\n", " }\n", " .bk-root .bk-toolbar.bk-above,\n", " .bk-root .bk-toolbar.bk-below {\n", " flex-direction: row;\n", " -webkit-flex-direction: row;\n", " justify-content: flex-end;\n", " -webkit-justify-content: flex-end;\n", " }\n", " .bk-root .bk-toolbar.bk-above .bk-button-bar,\n", " .bk-root .bk-toolbar.bk-below .bk-button-bar {\n", " display: flex;\n", " display: -webkit-flex;\n", " flex-direction: row;\n", " -webkit-flex-direction: row;\n", " }\n", " .bk-root .bk-toolbar.bk-above .bk-logo,\n", " .bk-root .bk-toolbar.bk-below .bk-logo {\n", " order: 1;\n", " -webkit-order: 1;\n", " margin-left: 5px;\n", " margin-right: 0px;\n", " }\n", " .bk-root .bk-toolbar.bk-left,\n", " .bk-root .bk-toolbar.bk-right {\n", " flex-direction: column;\n", " -webkit-flex-direction: column;\n", " justify-content: flex-start;\n", " -webkit-justify-content: flex-start;\n", " }\n", " .bk-root .bk-toolbar.bk-left .bk-button-bar,\n", " .bk-root .bk-toolbar.bk-right .bk-button-bar {\n", " display: flex;\n", " display: -webkit-flex;\n", " flex-direction: column;\n", " -webkit-flex-direction: column;\n", " }\n", " .bk-root .bk-toolbar.bk-left .bk-logo,\n", " .bk-root .bk-toolbar.bk-right .bk-logo {\n", " order: 0;\n", " -webkit-order: 0;\n", " margin-bottom: 5px;\n", " margin-top: 0px;\n", " }\n", " .bk-root .bk-toolbar-button {\n", " width: 30px;\n", " height: 30px;\n", " cursor: pointer;\n", " background-size: 60%;\n", " background-color: transparent;\n", " background-repeat: no-repeat;\n", " background-position: center center;\n", " }\n", " .bk-root .bk-toolbar-button:hover {\n", " background-color: rgba(192, 192, 192, 0.15);\n", " }\n", " .bk-root .bk-toolbar-button:focus {\n", " outline: none;\n", " }\n", " .bk-root .bk-toolbar-button::-moz-focus-inner {\n", " border: 0;\n", " }\n", " .bk-root .bk-toolbar.bk-above .bk-toolbar-button {\n", " border-bottom: 2px solid transparent;\n", " }\n", " .bk-root .bk-toolbar.bk-above .bk-toolbar-button.bk-active {\n", " border-bottom-color: #26aae1;\n", " }\n", " .bk-root .bk-toolbar.bk-below .bk-toolbar-button {\n", " border-top: 2px solid transparent;\n", " }\n", " .bk-root .bk-toolbar.bk-below .bk-toolbar-button.bk-active {\n", " border-top-color: #26aae1;\n", " }\n", " .bk-root .bk-toolbar.bk-right .bk-toolbar-button {\n", " border-left: 2px solid transparent;\n", " }\n", " .bk-root .bk-toolbar.bk-right .bk-toolbar-button.bk-active {\n", " border-left-color: #26aae1;\n", " }\n", " .bk-root .bk-toolbar.bk-left .bk-toolbar-button {\n", " border-right: 2px solid transparent;\n", " }\n", " .bk-root .bk-toolbar.bk-left .bk-toolbar-button.bk-active {\n", " border-right-color: #26aae1;\n", " }\n", " .bk-root .bk-button-bar + .bk-button-bar:before {\n", " content: \" \";\n", " display: inline-block;\n", " background-color: lightgray;\n", " }\n", " .bk-root .bk-toolbar.bk-above .bk-button-bar + .bk-button-bar:before,\n", " .bk-root .bk-toolbar.bk-below .bk-button-bar + .bk-button-bar:before {\n", " height: 10px;\n", " width: 1px;\n", " }\n", " .bk-root .bk-toolbar.bk-left .bk-button-bar + .bk-button-bar:before,\n", " .bk-root .bk-toolbar.bk-right .bk-button-bar + .bk-button-bar:before {\n", " height: 1px;\n", " width: 10px;\n", " }\n", " `;\n", " exports.default = css;\n", " },\n", " /* styles/icons.css.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const css = `\n", " .bk-root .bk-tool-icon-replace-mode {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH5AUFFxokK3gniQAAAHpJREFUWMNjXLhsJcNAAiaGAQajDhhwB7DgEP+PxmeksvjgDwFcLmYkUh2hkBj8IcBIZXsYh1w2/I8v3sgAOM0bLYhGc8GgrwuICgldfQO88pcvXvg/aOuCUQeM5oLRuoCFCJcTbOMh5XOiW0JDNhdQS3y0IBp1ABwAAF8KGrhC1Eg6AAAAAElFTkSuQmCC\");\n", " }\n", " .bk-root .bk-tool-icon-append-mode {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH5AUFFxkZWD04WwAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAAoUlEQVRYw+1WQQ6AIAwrhO8Y/bIXEz9jIMSDr8ETCUEPQzA4pMeFLKNbu4l5WR0CDOMEALBGIzMuQIBEZQjPgP9JLjwTfBjY9sO9lZsFA9IafZng3BlIyVefgd8XQFZBAWe8jfNxwsDhir6rzoCiPiy1K+J8/FRQemv2XfAdFcQ9znU4Viqg9ta1qYJ+D1BnAIBrkgGVOrXNqUA9rbyZm/AEzFh4jEeY/soAAAAASUVORK5CYII=\");\n", " }\n", " .bk-root .bk-tool-icon-intersect-mode {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH5AUFFxkrkOpp2wAAAPhJREFUWMPtV1EKwjAMTUavI3oawR/vtn5srJdREfzwMvHHQlcT2mpdMzFfWxiP5r2+JMN+mAiCOB72CABgR1cln4oOGocJnuMTSxWk8jMm7OggYkYXA9gPE3uyd8NXHONJ+eYMdE/NqCJmEZ5ZqlJJ4sUksKN7cYSaPoCZFWR1QI+Xm1fBACU63Cw22x0AAJxudwrffVwvZ+JmQdAHZkw0d4EpAMCw8k87pMdbnwtizQumJYv3nwV6XOA1qbUT/oQLUJgFRbsiNwFVucBIlyR3p0tdMp+XmFjfLKi1LatyAXtCRjPWBdL3Ke3VuACJKFfDr/xFN2fgAR/Go0qaLlmEAAAAAElFTkSuQmCC\");\n", " }\n", " .bk-root .bk-tool-icon-subtract-mode {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH5AUFFxgsF5XNOQAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAABFUlEQVRYw9VWUQqDMAxNpWfxQxD1MoP97G7zQ5mH2RTZYLtM9lWoMbXtxLXNX4OG9r28l4hrd0PQoqxqAACYpxH25C/nkwCHyCBwSPoS09k1T5Fo+4EiExcC4v584xGFmyIXHBLRISAVZyZufUPVa4rcrwmPDgr93ylo+2GliLRUYHK6th/o/6r7nfLpqaCsagEA8Hh9FmcNKeRmgeYDC+SCq0B6FFi8/BcV6BdR9cL3gCv3ijPKOacsn3rBEcjmaVxpfGcg4wHxzgJJnc6241Hn23DERFRAu1bNcWa3Q0uXi62XR6sCaWoSejbtdLYmU3kTEunNgj0bUbQqYG/IcMaqwPS9jftoVCAQ0ZVDJwf0zQdH4AsyW6fpQu4YegAAAABJRU5ErkJggg==\");\n", " }\n", " .bk-root .bk-tool-icon-clear-selection {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH5AUGEhcuan3d3wAAAoRJREFUWMPtlzFP3EAQhd+b3TNSzg0N5TWXLkJQUUaKhIQ4fgP/g5ArrriE/I3opEgRrZtIVJR0FJQ010SioUmEZHtnUpwN9gWHGA5BJCy58MraffvmfZ41v3z9hqe8BE98vQh4cgG+Ydzmnrng8efvQJNi/uN7dznx/B3ggtfhf4ehNdUttRzBDIm/2VTiiWCG1HK0nc+3UWtq8BQIiEEakEQOADBIA4QCQmBqoHBhFNR27ikQSmGdYCdTqCpEHMDZmEKRWUBEv1gBDg5SzRJnpopILWICgWuRYflLamuzxB2BmtYqSRIka5VWU8QduXO+1hRc5YZu5GAwmP2ZJzND0IBu5HCV2+NQcAhAVRsnC2IbPzPdSjzd6to6VtfWkXi6YLaVWr7xoAwkfpb8MnC3SH7rKSMBe4M0jA/OTicFIbtCGRIyNbURhcf3ErCd6YwA1m0HgAxhw1NGQnlXBHG4kylVlSJuH0RfIP2CkL2I/qS1gIAAQiBl1QwFggIHtyxgrxK5PgyfC0JWKoT0HLh8LwoietB4TYKaIl7yeNURxB05UtMxDOcVQlZIrlRKdK6m47gjR/fuBRQihyLArtNeJD50Izcx2Eczu7iFkIug4VM3cpOr3MKDekFED0fWUHv9Zq0kpLnridjhY3XDg7NTN0jDrhO3X7O9Wg7wwyANu4mnayNg3gmbu0tCNoUyBNGv2l4rB9EXynA7082FOxAQLhU6rQVO9T2AvWowFToNCJcPORGxIRcnpjZSKATSU9NxvOQnAPArDSaQoUKnNI4iufkGtD4P3EHIcWZhz4HLceSOyrR3Izf5memPAL2cX3yhAkonysZVaWLBkd9dw1Ivv2a/AYPkK+ty1U1DAAAAAElFTkSuQmCC\");\n", " }\n", " .bk-root .bk-tool-icon-box-select {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEg0kduFrowAAAIdJREFUWMPtVtEKwCAI9KL//4e9DPZ3+wP3KgOjNZouFYI4C8q7s7DtB1lGIeMoRMRinCLXg/ML3EcFqpjjloOyZxRntxpwQ8HsgHYARKFAtSFrCg3TCdMFCE1BuuALEXJLjC4qENsFVXCESZw38/kWLOkC/K4PcOc/Hj03WkoDT3EaWW9egQul6CUbq90JTwAAAABJRU5ErkJggg==\");\n", " }\n", " .bk-root .bk-tool-icon-box-zoom {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEg82t254aQAAAkBJREFUWMPN11+E1FEUB/DPTFn2qaeIpcSwr5NlUyJiKWVXWUqvlUh/iE3RY9mUekkPPURtLKNRrFJEeuphGfUUaVliiX1aVjGs6aG7+XX9ZnZ+d2fTl2vmnHvPPfeee/79Sk+may2/UQq/q7Qu+bAJoxjHIKqB/wlfUMcMVqI9bLZ+DGIKwzlzQ2GcxCx2xwvKOUKlaHTiX8bHNspjDONHkOmJBW5jIof/FvPh/06MZOb6cRc7cGn1AKUE5cdzlM/gAr5F/O24H3xkFRfxAbVygvK+cIsspjGWo1zgjeFpxL+BvnLw7laBA4xjIFJwrgu52DoVjKdY4HBEX8dSF3JLYe1fe6UcYCii3xWQjdfuSTnAtoheKCC7GNED5Zx4L4qt61jbTLHA94geKSC7P7ZeShQ0Inoi1IJuEOeORooFXkV0FZNdZs5qvFfKAeqYy7nZ6yg//HG0MBfffh71lFrQDCW2EvEP4mt4okZUDftz9rmGZkotmMxJRtlisy+MTniAWrty3AlXw0hFM2TD89l+oNsoOJXjbIs4EpqNtTCLXbiZ0g+M4mFObj8U3vsNjoZCVcmk60ZwthpepLZkB/AsivWfOJZxtpUQHfWib7KWDwzjeegBZJSdKFiE2qJTFFTwElsi/unQ/awXrU4WGMD7nOJxBY/1EO2iYConq93CHT1GOwucjdqnRyFz+VcHmMNefMY9nNkA3SWUOoXhQviSWQ4huLIRFlirFixnQq/XaKXUgg2xQNGv4V7x/RcW+AXPB3h7H1PaiQAAAABJRU5ErkJggg==\");\n", " }\n", " .bk-root .bk-tool-icon-zoom-in {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEgsUBmL8iQAAA2JJREFUWMO9l12IlFUYx3//MzPrLpSjkm5oN4FFIWVEl66IQlFYwtLOzozsjHdGRSCRF0sfBEXRVV0FQuQiLm5CZNBFgRRaRLVFhbJ2EdiN5gbK7toObTPn6eYdPTvNzPvOBz5Xh/ec5/n/n89zXtEHmZqeSXSuXBz/3zfdKvBWJHQrwZuRcP0El+QkbQXeBX6WZEgm6TtJk5lM5o4Lc+cV6qpf4Ga20Tm338zeATItVK9Ker6yvPzp4NDQ3+XieGsCU9MzTYumGbhz7m4ze9/MHgvBgItACrgfGAj2jgAvAYs3wlEujjc13kii8YyZrXXOfWhmo9GnFUlvOOemarVapVqtkslksmb2KjARqL62ecuWN9NxbRInzrldAXhV0uFSIfdew7G/gNLU9MwS8CwSmE3Oz88fcXG5blfpqVRq0Ix8VIAAX0XgrVL7HDCHGcCaWrV60LUBN8Dae58aQIxEqcA592I9M610JL0cpG/U9TIHJNKY3RV5z0R+7Nd4HZ0P1g/2RMBuegLAsRMnb4vT8d5vqKfMzOgtAlADrkmqGywmiMBTwfr3dC9j1Xv/r6Tvg/5/5ejxE6cO7M9faVbQZrYNOFSPmqQvVo9FKexvi5uWX58943aM7DwAfBDY+FbSCxP5sdkGx55GeguzrUEXPaSo2pFkAbiSZQCAzZJOmdkjwd6SpB/M7KykQTPbA2wDhoIzRzcNDx9MJwGNIXdJ0mEzmwbujL7dbma7gd03A7lKfnTOvf74nl0r6bonTUbujRSUCrm2d4L3/kvn3JPe+8+BDW2i9o+kT7z3kxP5sYsA6W47oE64TsR7P9tQL4vA2mh9WdIscKxUyJ0M7aR7acOGzikD65EQLEjaa2ZXzMwDFeB6qZBbbLTRE4EGeSaozNOZgYFf8qP7lmIvs354n0qlHpB0T7B9Ogl4IgJJrmjv/SiQjbrkD+BMUkfSbYATPdckrTOzkciWAXOlQu5cYgLdPEIapud9wMOR9zVJH3ViKx333mtHMJvNuoWFhZ3A+ojMcja77njXBEKwJJfTcqUyCIQ34Mf7nnh0paMnXacFuGoC1mr3AtuDfLzd8Zuyl+rfuGn4HLAD+Az4qZQf+61TAj0Noj8vX6oC35SL43u7teG6rf5+iXppwW7/JUL5D03qaFRvvUe+AAAAAElFTkSuQmCC\");\n", " }\n", " .bk-root .bk-tool-icon-zoom-out {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEgsHgty9VwAAA0FJREFUWMO9l09oXFUUxn/fmXlpItppi22k7UJBRSlVkCytSAuKUloIdjKT0El3FXVXdVFKRVAQV7qQohsNwdA0UFvBhYtqUVyIVlRaogtFQVq7qSTVjA3z3nHzBq/jvPmTN/Ss7rv3nvN99/y794kByMzcfE/7picn/jenmwWeRUI3E7wdCRskuCSTdDfwBvCtJEdySV9KOhpF0e0/LF5SqKtBgbv7ZjObcvfXgShD9Zqk5+orKx8Oj4z8NT05kU1gZm6+bdK0Azezu9z9hLs/HoIBvwAF4H5gKFh7B3gBWFY3460kWve4+3oze9fdx9OpVUmvmNlMHMf1RqNBFEUldz8OHAxUX9q6bduryut+Sfvc/Wz62ZD0fK1afjND9y3gGSRwv1GMojstTxUUCoVhdyopEYDzKXjWwZ4FFnEHWBc3Goet00m7lZlZYQixKw0FZnakGZksHUnHgvCN5/KARBH37enpOVg58H13HV0Kxg/kIuD/ngSA2ZMLt3bTSZJkUzNk7k4+D0AM/CGpaXCyBw/sC8Y/qZd2GpZiuL9YLN4Sx/HpoP5/c/exQ1OVq+1yyt13SLoArEsJnMjlgfOffvK3u58Kprab2QezJxfG2iTzUzI70wRPG9jbmpmb95SNB9mpzp7/j2yVdNbdx4K565K+cvfPJQ27+x5gBzAS7Hlvy+jo4WIvoC3kWpcvS3rR3eeAO9K529x9N7C7zX6AC2b28hN7Hl1Vt44niVq13LUjmtlYkiQfA5s6eO+GpDNJkhw9NFX5ueNt2ARodyF1IHIN2JiOl4H16fiKpK+B2Vq1vBAqFAf4IJkGNiIhWJK0192vunsC1IE/a9XycquNXARa5OnApeeioaHvKuP7r3dTGsiLqFAo7JR0T7B8rhfwXARa2us4UEqr5Ffgs151i/08oTNKdIO770ptObBYq5Yv5ibQq/sl3Qc8lJ4+lnSqH1vFfp9koZRKJVtaWnqkWXqSVkqlDe+vmUDWpZMlK/X6MBDegKf3P/nYaj8ErN9fqZBYEsf3Ag8G8Xit33BaniTcvGX0IvAw8BHwTa1y4Md+CeRqRL9fudwAvpienNi7Vhu21uwflOT+L+i1X2TJP57iUvUFtHWsAAAAAElFTkSuQmCC\");\n", " }\n", " .bk-root .bk-tool-icon-help {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAABltpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iCiAgICAgICAgICAgIHhtbG5zOmV4aWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20vZXhpZi8xLjAvIgogICAgICAgICAgICB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIKICAgICAgICAgICAgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiCiAgICAgICAgICAgIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIKICAgICAgICAgICAgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIj4KICAgICAgICAgPHRpZmY6UmVzb2x1dGlvblVuaXQ+MjwvdGlmZjpSZXNvbHV0aW9uVW5pdD4KICAgICAgICAgPHRpZmY6Q29tcHJlc3Npb24+NTwvdGlmZjpDb21wcmVzc2lvbj4KICAgICAgICAgPHRpZmY6WFJlc29sdXRpb24+NzI8L3RpZmY6WFJlc29sdXRpb24+CiAgICAgICAgIDx0aWZmOk9yaWVudGF0aW9uPjE8L3RpZmY6T3JpZW50YXRpb24+CiAgICAgICAgIDx0aWZmOllSZXNvbHV0aW9uPjcyPC90aWZmOllSZXNvbHV0aW9uPgogICAgICAgICA8ZXhpZjpQaXhlbFlEaW1lbnNpb24+MzI8L2V4aWY6UGl4ZWxZRGltZW5zaW9uPgogICAgICAgICA8ZXhpZjpQaXhlbFhEaW1lbnNpb24+MzI8L2V4aWY6UGl4ZWxYRGltZW5zaW9uPgogICAgICAgICA8ZXhpZjpDb2xvclNwYWNlPjE8L2V4aWY6Q29sb3JTcGFjZT4KICAgICAgICAgPHhtcE1NOkluc3RhbmNlSUQ+eG1wLmlpZDpBODVDNDBDMzIwQjMxMUU0ODREQUYzNzM5QTM2MjBCRTwveG1wTU06SW5zdGFuY2VJRD4KICAgICAgICAgPHhtcE1NOkRvY3VtZW50SUQ+eG1wLmRpZDpBODVDNDBDNDIwQjMxMUU0ODREQUYzNzM5QTM2MjBCRTwveG1wTU06RG9jdW1lbnRJRD4KICAgICAgICAgPHhtcE1NOkRlcml2ZWRGcm9tIHJkZjpwYXJzZVR5cGU9IlJlc291cmNlIj4KICAgICAgICAgICAgPHN0UmVmOmluc3RhbmNlSUQ+eG1wLmlpZDpBODVDNDBDMTIwQjMxMUU0ODREQUYzNzM5QTM2MjBCRTwvc3RSZWY6aW5zdGFuY2VJRD4KICAgICAgICAgICAgPHN0UmVmOmRvY3VtZW50SUQ+eG1wLmRpZDpBODVDNDBDMjIwQjMxMUU0ODREQUYzNzM5QTM2MjBCRTwvc3RSZWY6ZG9jdW1lbnRJRD4KICAgICAgICAgPC94bXBNTTpEZXJpdmVkRnJvbT4KICAgICAgICAgPGRjOnN1YmplY3Q+CiAgICAgICAgICAgIDxyZGY6U2VxLz4KICAgICAgICAgPC9kYzpzdWJqZWN0PgogICAgICAgICA8eG1wOk1vZGlmeURhdGU+MjAxNjoxMToyOCAxMToxMTo4MjwveG1wOk1vZGlmeURhdGU+CiAgICAgICAgIDx4bXA6Q3JlYXRvclRvb2w+UGl4ZWxtYXRvciAzLjY8L3htcDpDcmVhdG9yVG9vbD4KICAgICAgPC9yZGY6RGVzY3JpcHRpb24+CiAgIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+Cphjt2AAAAT7SURBVFgJxRdbaFxFdGb2bhui227BWrsVKYgf2kJUbP9EUPuzEB803WTXJjH61Q/7Ya1+CMYKEVTsh4J/EpvY7BoabUiNiA8s1p+4KIhpoUUEselHqyS76TbZ3HuP58ydc3d2u4+IkQxczpz3mZkzZ86VYpXjvenpjZsLhUcliE4AuUuASAgptmt1EFdwPiclzIIUUwubNn17OJlcXo1p2UpodHRiux9xB1Eug1+slbzhFxGOKc851tu7/0oznYYBDA8Pt0U2tL8KQryIq2tvZqQhD0QJHRz3yqWhgYGBpXpydQMwqz6NCnurleCSADkJEfgKfOePqL80R/wV1ZaQyr1LenKfkPCkEPKeaj0xg7vxVL3duCmA0Vyuw/fl52hgBxsBED+h4Cv9z3R/zbRm8MTJTx7HQN7GQB6w5C4L4SX7M5lfLBpurjXMyvNIShiyi0l1pL8n9b7EDGPR8fHxzSsQ6XDB3618/xqo6Pk25V5MpVJllgHM1BO58RdQ612kOYZ+GXdij70TYQB05mpj+1kU5G2fB+l3PZtOf8NGx6ambnMXb3yAxg8wjSEG6OKKR9oicBQD+ZvpH2Wzj0lQpxCPG9qMv1x6hHNCsSAlHM7ZOa682vlI9tRDbvHGbD3nZAPpDoD/3JIrLpAs26UFkC3EMUA99hpfGtEBfJjNJnS2Gwnadnvl+Xw+iuc3DAJuNyIaSCHpilVldyDjjUxj3WDZIAhxhHHyRcdNuA7AAfUaXzVKODpzFiZ4/uLvh5G+m2no+C/pyIf7MqlEJB7bpqR6nXkEUfbeawuLaZsW2ISfNQ2vtaktQlGFQyIVGT0o2+2EC4iQNGwjBIN9qdQ5Qg4mk4X4rW3vCClLtowE2FOFUxKDfNmiZci3ovKKRFPh4FK9q4Zbdr+lKKJiA13TcHR2dmLBgdmQ0GAS2MZaEowY+XbAk09IvgtYZGp16SyvFhaHcIUh645t8T9DBCcnz5zZ4hZLu3DzK2QlL1QQa0Y+pHiJKPSuOGj3PmZTheM5w2TwqBxnvBZOTk7G5gvXJ5Aelms8wnJURL+olSWcfEhf6gDoUXPMq6ZlqbzWU2pE+3hi4s6F68tfIj9cBMlikr7Z0/P0b/X0yIcUXsDCF1WhtL4OROHaXk+xlkbV0Cu732Nmhc4peaWSg73pA8dq5RkvO37ldUTfXCKZv2q45MkhvG87WQEzpCCUSvV1d9GONBy3lMvgKSwrZig8gjAietWY0QriylO2jIo4yVbOSb7KB/qmI9BPKjHpSSXYauRyn92Nq9/Kcrj13x3s3v8D481glQ/0raiNYgX9njPSBOImbrHZePl+tfFmc9sH+Xaoh8NjOKSVdDMhjjYzQLy+dFceH5+IJQf9VYXX4tROg4ZFU8m31M3mfPEqUoJqCGJfvWpo2xnNfdrhC28n06SCeSzNZxlvBINGRXCtKS7EY1uV6V7HWAm38y1cXaXsMcOCvr9ySPj+af7A1U2HJXHzVNvUXVLIGyPf+jV0pf8GHoN+TLAyPkidTCi2RpPApmnR0Bd1zGRaB/B8Oj2HSw7LLbVR1MmskW8RdEWVXSJf3JbpAMgRtc4IZoxTh9qotQjCasm46M0YX9pV1VmbpvRH5OwwgdRtSg2vKaAz/1dNKVtb17Y8DCL4HVufHxMOYl1/zTgIgiYvBnFKfaNp3YjTdPz3n9Na8//X7/k/O1tdwopcZlcAAAAASUVORK5CYII=\");\n", " }\n", " .bk-root .bk-tool-icon-hover {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEg4oVHp0SwAAAQJJREFUWMPtlsENgzAMRb8RQ5VJItFDOgaZAMaAA0iZpN3KPZSoEEHSQBCViI/G8pfNt/KAFFcPshPdoAGgZkYVVYjQAFCyFLN8tlAbXRwAxp61nc9XCkGERpZCxRDvBl0zoxp7K98GAACxxH29srNNmPsK2l7zHoHHXZDr+/9vwDfB3kgeSB5IHkgeOH0DmesJjSXi6pUvkYt5u9teVy6aWREDM0D0BRvmGRV5N6DsQkMzI64FidtI5t3AOKWaFhuioY8dlYf9TO1PREUh/9HVeAqzIThHgWZ6MuNmC1jiL1mK4pAzlKUojEmNsxcmL0J60tazWjLZFpClPbd9BMJfL95145YajN5RHQAAAABJRU5ErkJggg==\");\n", " }\n", " .bk-root .bk-tool-icon-crosshair {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAADEUlEQVRYR81XXVIaQRCeHqug8CXmBNETaE4gniDwIgpVspxAbxC9ATkBkCpQ8gKeQDiB5AQxNyAvUlrldr7eHxyGXZi1rMJ5opbp7m++7un+htSGF204vsoMoNXrlzSpfWa1oxQfhAegCZGaEtPorHo8znIoJwCt6+td8uk7ApUQCIHTF4BNAWzImq8ap6cP68CsBdDp9i9ZqXM7ML79g/EnCWD+jgMKENKqWT+tXK0CkQqgNRjs0OxpQIqKhoMxaG6/6JeRnK7T6yO2UvVqhYSlLX+ryORfgKn9ORDFIy7ky41yGcwsr0QAQfDH5zucOswx819fs4egI9OFCcD8DjBF7VNbEX0JzdWEt3NHSSASAcCxBDqMgt/623kvyTgNgNjJIfTjk4D4FqaJR1715MjmYAmA5Bx3AwUXQL+t105KaTlcBSC26XRvhjEIoLiq1yqXpr8FAGG16/ug4IT27fxBWu7EiQuAiImJpEMKE6nYM30uAIDDttSUOPfJP7JzbjPhAiBIh9QE67vIvoOi9WJfCwDavf40ulpjbCqmUf+W753ezURuh7Dg1SqflwAEHU6pgfyBq9Y4qx0LG++2fnZ/eUzcstmdM2AWH+jfc+liWdBJfSENf8Lifi3GVwC9mybOfi5dzatWVrbbLIHNva8p5h/16gkaFiLGGxbufkoE6XguwePiXLF3XmMfCUCUAqtKXU7sumd1CowOuJEi3Pg1FBpjitIGhyvVSfvmjci6ZR+rFQfDiPVE2jFYeICQ+PoewwjC5h7CZld6DBdyu6nDSKgzOyIMhmhK5TTqXYbRorZYM46TmpKAAOrGWwSJJekSB1yqJNOzp1Gs7YJ0EDeySDIMtJbQHh6Kf/uFfNFZkolJICRmz0P8DKWZuIG2g1hpok+Mk0Qphs0h9lzMtWRoNvYLuVImUWrmPJDlBKeRBDfATGOpHkhw670QSHWGLLckmF1PTsMlYqMJpyUbiO0weiMMceqLVTcotnMCYAYJJbcuQrVgZFP0NOOJYpr62pf3AmrHfWUG4O7abefGAfwH7EXSMJafOlYAAAAASUVORK5CYII=\");\n", " }\n", " .bk-root .bk-tool-icon-lasso-select {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEgwlGP1qdAAABMBJREFUWMO9V1uIVVUY/r61z57ZMx4DnbzgkbQXL5iCJphlWdpIGY4jpFBkEiU9ZNaDRRcITcIwMwgxoQtU2IMXdAZfMjFvpERXYiSbysyBEXFmyuHMnLP32uvrwT2xnY5nxvHQ93Jg7fWv71/r//7L4a59TRgqJk+Z6v3a+sv0OI5nk5wu6VaSVZImAThHsgjgrKTvM5nMUWvtmf5n8HodCIKgOgzDhc65pSTrJQWDsSNpJX1ljHnDOfdT37oZLLHv+8OMMasKhcIJ59xHAJYMlhwAJGUAzJfUTHLFuFzOG5QDU6dNMyQfs9Yedc5tBpAD4IYYNQGoBrDtQnt7/b0LFrJsCHzfn2itfQfAnZLiazytA3AaQAuAiwDaEgeNpGkkswAWSBqRONB38b88z5uTKePt6iiKXkk8jq+iJC5LOmiMaTLGHLPWhmWeHr7vV0dRtATAapAzIVmSo51zyzIlbm2stesFPA6pKk0r6Ryg93y/ek8YFvPOOTg3cDSiKCoC2OP7/rEoirYm4rUkF12lAWNM1lr7lqQn0+QA8gI2jBg5cj6Aj8OwmB+KAKIoukhyp6SRJAUgl0ndPLDWPi9pJQCbuviXvu+/GIZhW1dnJ24UJFuTjCCA2ADA8sYGWmsXS3qmL94kDYAtkh4Nw7ANlQJ5U6INT1KrAYC9zQdykl7nFSj5fXp5Y8NWVBhy7mUAjqShMYdMXV2dJ2klyRwAJ8lIeuGWCRMP7N7frEqSG2OmAFhKshNAp5wrmO7u7jEAngPQm1S2z2pqapr+OPt7XEly0oxwzq2RdFmSD2AMgKKJouhhAL4kA+Cs53l7e3t7uytJHgRBreTWkXwkKVJnJD0B4GAGwIJE9R6AFufc6UqSZ7PZbD6ff5dkA4CQZEHSqwAOISmXtwGIE+F1SeqqIP8d+Xz+C0mLJYWSAODteXffczjdDQNJ0BWMCoLg5gqIbRTJNwHsljQhUb0luWPM2LE7Thw/9m/5NCT/TByxAOYWi8X6/gdWV1dnfN8fNRBxJpMZTXKdc+6IpFVJWAEgkvSJpA0X2tvtVTaSjgOYBCAEEADYSHK87/sfhmEYA9gShuEDkgzJHyWtB/B1irQ2juP7ADxkrX0wOUOpzmdpzEY590HJ7Ni1r2kSyZOSiv2+hSRjSTXp/QAukzySNJOJkmalyNIl10hqMcasdc61XDNcQRD8BnITgNp+36r6kfcNFMMlLQGwTNLMEuQGQBfJl2bdPru+HDkAZAqFQux53jZHEsC6aw0eg2gylNRBcqcx5v04ji999+03AwsWAOI4Lsy9a94WkisAnE5a5WCJYwCfA1g7LJudI2lTHMeXBm1faiQzxkyRtF3S5CTupeAB+KG2tnZFT0/P30NO2VKLzrmfAbwGMipjG5Oc0dPTc0Md05SZ5U4Q2FxChErtEYD7jTGNQ3UgM8Asv90Yc9I5LSKRlXSI5CxJa0jWSALJjKRnAewfkniT+vwf7N7fXHK9rq7O7+jo+BTA/NRrdBpjnnLOnUrvXd7YMPQXSBunneno6IhIHgYwW1JtkgmBpBkATlVMAwOk3nFJ+VSoqgCMr6gIy2FcLtdKspAedyQN/98caDt/3kpyabUmf8WvG/8A1vODTBVE/0MAAAAASUVORK5CYII=\");\n", " }\n", " .bk-root .bk-tool-icon-pan {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEg4lKssI9gAAAOtJREFUWMPVll0KwyAMgNPgoc0JzDX2Mtgp3csKErSamGabIEUo/T6bHz0ezxdsjPJ5kvUDaROem7VJAp3gufkbtwtI+JYEOsHNEugIN0mgM1wtsVoF1MnyKtZHZBW4DVxoMh6jaAW0MTfnBAbALyUwCD6UwEB4VyJN4FXx4aqUAACgFLjzrsRP9AECAP4Cm88QtJeJrGivdeNdPpko+j1H7XzUB+6WYHmo4eDk4wj41XFMEfBZGXpK0F/eB+QhVcXslVo7i6eANjF5NYSojCN7wi05MJNgbfKiMaPZA75TBVKCrWWbnGrb3DPePZ9Bcbe/QecAAAAASUVORK5CYII=\");\n", " }\n", " .bk-root .bk-tool-icon-xpan {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEg4X4hxZdgAAAMpJREFUWMPtlsEKwjAMhr/pwOOedINJe/PobWXCfAIvgo/nA4heOiilZQqN2yE5lpD/I38SWt3uD9aMHSuHAiiAAmwaYCqoM/0KMABtQYDW11wEaHyiEei28bWb8LGOkk5C4iEEgE11YBQWDyHGuAMD0CeS30IQPfACbC3o+Vd2bOIOWMCtoO1mC+ap3CfmoCokFs/SZd6E0ILjnzrhvFbyEJ2FIZzXyB6iZ3AkjITn8WOdSbbAoaD4NSW+tIZdQYBOPyQKoAAKkIsPv0se4A/1UC0AAAAASUVORK5CYII=\");\n", " }\n", " .bk-root .bk-tool-icon-ypan {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEg4anK0lywAAAMVJREFUWMPtlzEKwzAMRX/S7rlpIMXeOnaLaME36FLo8XqCdNFghGljyc4kgQi2Q/SUj0F/eL7eMMTKz6j9wNlYPGRrFcSoLH4XxQPvdQeYuPOlcLbw2dRTgqvoXEaolWM0aP4LYm0NkHYWzyFSSwlmzjw2sR6OvAXNwgEcwAEcwAEcwAEcoGYk20SiMCHlmVoCzACoojEqjHBmCeJOCOo1lgPA7Q8E8TvdjMmHuzsV3NFD4w+1t+Ai/gTx3qHuOFqdMQB8ASMwJX0IEHOeAAAAAElFTkSuQmCC\");\n", " }\n", " .bk-root .bk-tool-icon-range {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAABCJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iCiAgICAgICAgICAgIHhtbG5zOmV4aWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20vZXhpZi8xLjAvIgogICAgICAgICAgICB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iCiAgICAgICAgICAgIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyI+CiAgICAgICAgIDx0aWZmOlJlc29sdXRpb25Vbml0PjI8L3RpZmY6UmVzb2x1dGlvblVuaXQ+CiAgICAgICAgIDx0aWZmOkNvbXByZXNzaW9uPjU8L3RpZmY6Q29tcHJlc3Npb24+CiAgICAgICAgIDx0aWZmOlhSZXNvbHV0aW9uPjcyPC90aWZmOlhSZXNvbHV0aW9uPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICAgICA8dGlmZjpZUmVzb2x1dGlvbj43MjwvdGlmZjpZUmVzb2x1dGlvbj4KICAgICAgICAgPGV4aWY6UGl4ZWxYRGltZW5zaW9uPjMyPC9leGlmOlBpeGVsWERpbWVuc2lvbj4KICAgICAgICAgPGV4aWY6Q29sb3JTcGFjZT4xPC9leGlmOkNvbG9yU3BhY2U+CiAgICAgICAgIDxleGlmOlBpeGVsWURpbWVuc2lvbj4zMjwvZXhpZjpQaXhlbFlEaW1lbnNpb24+CiAgICAgICAgIDxkYzpzdWJqZWN0PgogICAgICAgICAgICA8cmRmOkJhZy8+CiAgICAgICAgIDwvZGM6c3ViamVjdD4KICAgICAgICAgPHhtcDpNb2RpZnlEYXRlPjIwMTgtMDQtMjhUMTQ6MDQ6NDk8L3htcDpNb2RpZnlEYXRlPgogICAgICAgICA8eG1wOkNyZWF0b3JUb29sPlBpeGVsbWF0b3IgMy43PC94bXA6Q3JlYXRvclRvb2w+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgrsrWBhAAAD60lEQVRYCcVWv2scRxSemZ097SHbSeWkcYwwclDhzr1Q5T6QE1LghP6BGNIYJGRWNlaZItiFK1mr+JAu4HQu0kjpU8sgF3ITAsaFg0hOvt2Zyfvmdsa7a610Unx44Zgf773vvfneezPHNzrbhn3CT3xC3wPXYOC8LDzqdi8YY/gwh4BeknS/2th6dr2kf94AOp3OFyWgMyziOPbMDxV9FTtJnl1ut795Xd0/YQ0/vtYQwMT1KXWCfr2IjOWwtNehwN4xL9ykTrm6Pzl58yLn3J+mKh9mXbT3uRjGEDph+O8/TjfP5dBp7Ha7AX7O3o5nZeD/0E/OGyXntDgzA0X6qmCnrVutVlrUWV9f/3xo+pwhGDhvEPHOjoxnZjJggXmMHzBQ7NGNp9vxk61fr0HR7e/u7pZzCGHlc7qwBYYTT7tJYSx1AQzppyFPft5apta9w7SKcn0b7P7+/jCsDQ5mbc0dCmIJGDN0ehdcjsmkm6A6KUeKFOTE11PLxrC7Ukqh3ylL2fT0NAP9q6ur6rRCJJYsbKB0JsbCKMuy+xREePDyxQPCz+Crlw062QcA5wBOOt1l6vIl2WiI9F1fN6Q+BBqit6hEC4Hk08GQJMn4myjSP7RavVxgdaVUh/3U6HCMsPr9pYnJKRziHtWQ+un58+hGs6nsjQSjpuTyKGN3CX+FBwHXSiEVgjP+O8X6N12kIePES+GzTKAkGbNp8yJsGUMVzz8jPKReiyAQRimy5/cjye5RpF8utFp/+nwmT7d/NMzcFkS7yjJNGDaPURQxIQThEQy0SyF4l5WJYYhBa816vZ6dU7A6CAhbZVow/pDe0O9hVOoCi13r4BgBAvJHqMSQL2vE/iH6IAXEwgrRVUmBoRRwnwJQT98xEeVeSUyB4dJ5nwJBKdCFFGRmUCcu7rwIYypCTblaChuNBhWODrman5ub+4v0rMNBt8z6Ezh7GksJQpCbm79cMQE7QBFm/X6f0rjWnv8WRYg/QdbUpwDAEBy8vPyA8rNGzg3a8MiElwiM7dAtRqNoNptjGPM1laVxP9umWEMGLOKhKUOJDtBwDmzsw9fC/CzHr9SGuCTi2LbbKvVtmqXpCjMihBFa79Wrt5fGx9PDzc3fmu32Lf8qFliwU9emKhBSp+kRKn/hu9k1COEDbFdt/BoKWOAkuEbdVYyoIXv8+I/QK9dMHEb1Knb7MHOv8LFFOsjzCVHWOD7Ltn+MXCRF4729vWMDK+p8rLkvwjLg4N4v741m5YuwCI9CvHp1Ha8gFdBoPnQAkGsYYGxxcfEI7QQlFCTGUXwjAz4tWF+EpymOWu7fglE7qsOvrYE6g4+9/x/vhRbMdLOCFgAAAABJRU5ErkJggg==\");\n", " }\n", " .bk-root .bk-tool-icon-polygon-select {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEjc1OfiVKAAAAe1JREFUWMPt1r9rU1EUB/DPK0XbqphFHETo4OCiFhwF0V1KHbRSROLqon+AUMVRRFBwEbRFMBiV+mMW/wIxi5OD1kERRVKRJHUwLvfBTZrU5OWBGXLgQu7Jfe98z/ec7z0vKa88b2q1BDtRHdAPBaylm1NzsxsOjPnPNt6WSWprbft+/c3I3zOAjhT1Y4+fvcjEQJIXnVECSa+AhqIHqlHH5lWCZoe+Gk4GRgDG86j9SAUdlDBSQaZhlOkuHyoVdJmsw98D1S5fM4NYM1LCpqM+Lwa240oLgmZzpVZvzKT75VLZcqksSZKWlQeAy/iORVwIvh31xvotvK7VG3Px4aWHj3Jl4C2uYSvq+Bn8v6LLbaVWb9zsBiKLCvbiNG7gLm7jAYqbPHMJMziZ9lsKoh8GtqCEVVzHftwJn+TFHp4/hg8BSCYVfMOZoPEv2NZGdy9WCGUr9toDR3E2/H4V6nwRe/BmgN65H1ZhvMuB3XiKIyFoGefwO6ysVkUlrNUNsyAK/jli533Q+Y8cJFvAeXyMS1CI/jiMr/gUtD2LQwMGr4R3p7bY3oQHQ5b38CT4D2AXXg6YcQXHpyYnlqKsi5iOAVSwL9zd7zJ09r+Cpwq72omFMazjT9Dnibym0dTkRDUKrrgwH7MwXVyYB38BstaGDfLUTsgAAAAASUVORK5CYII=\");\n", " }\n", " .bk-root .bk-tool-icon-redo {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEg4itK+dVQAAAaFJREFUWMPt1L1rFFEUBfDfJDaBBSslIFjbaSFp1FJQFMVCHkzhKIqdUYOCoBgErVz8rCwiTDMwBCIKipDWyip/gxAIWAmBgBC0eYFh2Gx2l9lFcA5M8e59782Zc84dWrT435Hs1siLchqn43MS0zgW22vYxjesYjVLw3YjBPKinMUTBOwf8J5fKLGYpWFjJAJ5Uc7gIW6jM6Kim3iNZ1katgYmEL/6I+YasvY7Lg6iRpIX5VF8wuEe/XV8wGf8jN6LWTiAc7iEQ7ucPZ+lYW0vAtfwvlbfwCKW9gpXDOv1mJvZHiSO91MiyYsyiQSuxtpXXM7SsDmM5nlRdrCMMz3sOJWl4Xevc/vwBzdwAl+yNNwZxfRI+GxelK9ikHcwh8d4NNR/YFRES1ZwoTYdR7I0rNf3TzVNIGbmSvR/Bx08mIgCFSVu4l2ltIWD9WxNGR+W8KOynqnZ0rwCeVG+wa0hjrxtWoF5dAfc28V8Mib/n+Nev5dnabg/zgw87aNEN/bHOwVRiRe4Wym9zNKwMKkpgIWKEt24njxiJlq0aPFv4i9ZWXMSPPhE/QAAAABJRU5ErkJggg==\");\n", " }\n", " .bk-root .bk-tool-icon-reset {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEg4gWqH8eQAABLdJREFUWMPtlktsVGUUx3/nfvfOlLQaY2IiRRMQIRpI0PjamJhoVASDvNpCpYw1vJQYSVwZwIVQF6wwRHmkAUof9ElrI6VqDAXcID4TF0IiYQMkSlTokNCZ+b7jove2t+NMH7rQBWd3v+989/zP+Z8X3Jb/WGQySvUNTQBJESkNguAVYIWqzhaRhwBU9WcR+QXoymazn6jqzUQiMQSQzWZRVdal1vwzAI2tHQBPOuc2AbWTdOyQ53n7nHNfRwee51GzqoIQMCLDpr3x/tLQ0oZzrk5Vj0/BOEBt+KYuOlBVGlrahr0Wob27t3gEjnZ2AyQzmUwHsDgP6J/AYRE553neDwDOuUdU9QngNeCumK4TkRMhZUORcYC1qysLA6iuSQHIwkWLD6lqapQsuSmwTVV3h99I7EcAR462A2xR2Ilq6ehTaejvO1774kuLNALR33eclsaGsQDe3fYegHl43vyNwEeqGl1963mm2jl7YZRTQ82qlWP4HM6ZToC5ztkW4LHQoALru7s6Di5dvlIj/e6ujrEAWoZDn8hmMjXATMACGaAVuBjXTVVXFc/AxhaA+4zvn1DV+eHxVWPMAmvtb5GeMWZyZVhI2rt7qVy2pOh9U1snwIPW2vMi4oWJuBPYHkVAVScPoKmtkzVVK6cEMsyJraHhiCqJqJUwj/JRz7TW1iSSyR2rVyylqa0Ta+24Ic8vXaAEmDFc/l5Z2A/80OibuVyuz/f9ElUdHCmvw82t5HK5h6y1PYhsz2YyGw43t2KtBZHIGwB6+j4rCkBVUdV7gXrggnPuu8h4eP+xMeZS2D0rJYZ6AdAMzAt1b4nI26p6IFZOY8pugijcKSIHVLUK0LyST4vnrVfnWr3mjmP4QTATaERkXkypRFX3isjmuHdRJEK6Ckqquopp06bdKCkp2Sgi7XnGLcg7gzeutwNIiPYc8HixqIrIOlU9ONVIhHPEd851icgSVXUiskVV94gIqoonIt0i8gfQCfwae38e6BWRXuBZz5jZ8VbaOE4EIqlZVUEQBLlkMplS1QER2RwkEnsSyaREDUzyeNsvIhvCMqkH1kdIJ2o+k8iJB1LVVRfjZ6nqqlEAIbdVQGto8Lrv+/dbawcjAL7vc+6bs+zetetfLSHxniIFGofGGsU2oC7eOCbDfZ7nQawBOSAX74SF9oEPImOq+r7nmVmxb5raukZa8UReGmNmhbMkAwwBH467EYVZe49z7kdgenj8k7V2oTHm8kgdWcvrNdVFjR8cHkYzjDH9wLjDaEwEzpwa4MypgWvAjtjxfGNMj4jMiT+M+kFsZI/Q6Pv+HGNMT8w4wI7TAyevxXVPD5z8+zD64tRXAMHVK1eaVLUyVvuDqroV2BOnJF4ZIedviUidqt4Re9s+vbx8zZXLl7PR2+nl5Tz/zNOFp2FzxzGAklw22wUsLLaSKXwf8vhosZUM6PeDYEUum70VHfpBwKsVyyfeikOP6oBNwN1TrLbfgX3A1kKLzKeff8nLLzw38T5wZDgxn1LnNk5lLRfP26/OnR2hwfNYW2Atn9RCsrf+EECyrKysDFimqhXhyjY3VLkAXBKRDqA7nU6nS0tLhyIj6XSaN9bVclv+l/IXAmkwvZc+jNUAAAAASUVORK5CYII=\");\n", " }\n", " .bk-root .bk-tool-icon-save {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEg4UexUIzAAAAIRJREFUWMNjXLhs5X+GAQRMDAMMWJDYjGhyf7CoIQf8x2H+f0KGM9M7BBio5FNcITo408CoA0YdQM1cwEhtB/ylgqMkCJmFLwrOQguj/xTg50hmkeyARAYGhlNUCIXjDAwM0eREwTUGBgbz0Ww46oBRB4w6YNQBow4YdcCIahP+H5EhAAAH2R8hH3Rg0QAAAABJRU5ErkJggg==\");\n", " }\n", " .bk-root .bk-tool-icon-tap-select {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2hpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYxIDY0LjE0MDk0OSwgMjAxMC8xMi8wNy0xMDo1NzowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo3NzIwRUFGMDYyMjE2ODExOTdBNUNBNjVEQTY5OTRDRSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpCOTJBQzE0RDQ0RDUxMUU0QTE0ODk2NTE1M0M0MkZENCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpCOTJBQzE0QzQ0RDUxMUU0QTE0ODk2NTE1M0M0MkZENCIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M1LjEgTWFjaW50b3NoIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OTQ0QzIwMUM1RjIxNjgxMUE3QkFFMzhGRjc2NTI3MjgiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6NzcyMEVBRjA2MjIxNjgxMTk3QTVDQTY1REE2OTk0Q0UiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6eYZ88AAADLklEQVR42rSXf2TUYRzHv7tuGcfE6Vwb5zLSSjEj7Y9KWqfEmFZJP+yPMdKKmUrrn0iUfjhWlLFi6YfNrF+StBoTo39iYkTGco4xxxG59P7k/T2PT8/37nu3bx9ezvPj+zyf5/PreS78bGLS8SmrwE6yje3NHJsDBTALpknBz6JhH3NiYAB0gHqPOVv52wJ6QQ48BzdAttTioRJjdeA8mAHHS2xuk3p+M8M16ipVQE49Ds6CiFO9RLjGONf05QLx6wPQaBlbBlPgJVgkP0ETiIJ2sB/E1XfimjfgBOOlKDUqCGOcqBcQnw6BYW5YTo4wbvQhMmCfGRemC2rBiGXzWUb+kM/NRZ6CHWBM9ce5R61NgX6ayhSJ5EPlItlDRNkz4JbFHf06BkSzHjXxM+gDv1S/mPUo2AXWgt9UUHL/IVhS8yUV1/EbV3o4N+NaoE9Fu/i827K5pNYHnqAVJECShWmAaddpscYFFXwR7vnXBRGlnUN/L6kqKJlxnRUuDbaDBiL+vst5d4gpcpBrqk/2jIgCKVUolhntplzivHmwh4stGOPfwBWwl/2dpp8p7xjQZqFLiQJtauKkivYm+kzccpK57yXfOUe+P23JqAnVbhMFmlXntCWnxbT31am9ZJ4BJifsUmNTqt0cYhA5ypympPg7VkEKunPbVb8cIG+0kyHLJZNR7fUMooUKFHAPkfQo58VLK+RzwRDd4FdWG9mjpaAXzqkJa1R7kQttqEABWXMjOOxxVRfnhRm5URX1prk/0pQHwNcKlchZ+jdpC+hFdVqO0my9Hj5dkYgCn1Rfh/KdlNDHrJhPqlDih+IfBd6qwpOgEqYMsorJ2HtWxtagLJDn/W3KRfPOZhoeBJfZPgVeGKeKrkQBh5dLXl25Ny3pc4/1fkTdbvFqFQgbxWeYD0hXulhQ0pYiM1jG547fcbMQpVnHTZEn9W3ljsCzwHxCdVteNHIZvQa7/7cC7nV6zHIfyFP9EXjFa7YxKAVqPP4bxhhoLWW+z9JyCb6M/MREg59/RlmmXbmneIybB+YC/ay+yrffqEddDzwGvKxxDmzhc0tc80XVgblqFfgjwAAPubcGjAOl1wAAAABJRU5ErkJggg==\");\n", " }\n", " .bk-root .bk-tool-icon-undo {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEg4em8Dh0gAAAatJREFUWMPt1rFrFFEQBvDfGhACASshkL/ALpWVrSAKEQV5sIULWlgZNSgIFkGIVQ412gkBt1lYLERREFJqJRaW1oHAoZUQsDqwecWy7N3tbe6C4H2wxc682Zn3zTfvLXPM8b8j6RqYF+UCzsfnHBawGt3fMcAX7GEvS8NgKgXkRbmMxwg41TLsN0psZmnodyogL8pFPMIdLHUk7hA7eJKl4U/rAuKu3+HslFr/FZezNPSTFslX8QErDe4DvMVH/Iq9F7VwGpdwZUjsPtaSFjv/1vCBPjaxO0xcNbHejLpZrrlvJCMCT+JzA+2fcC1Lw+GE4l3CG1yIptfjCtiKoqtiJ0vD3aM0Py/K57iIMxgkQxat4EdN7e9xdRzlk+LEEPvDWvIDXJ928sYxjL36icWK+VaWhlezOIqbGFirJd/H7szugrwoX+D2BDEvszSsT5OBdfRaru/F9dPXQF6U27g/KnmWhgctxqyzBrZGMNGL/rHI0nDkKXiKexXTsywNGx0OnFbFNk3BRoWJXnw//j+ivCi32/S8CxPVNiWOAdUiJtXITIqYY45/Cn8B2D97FYW2H+IAAAAASUVORK5CYII=\");\n", " }\n", " .bk-root .bk-tool-icon-wheel-pan {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEgswOmEYWAAABddJREFUWMO9l09oXNcVxn/n3vc0fzRjj2RHyIZ6ERuy6CarxJtS0pQSCsXNpqGFWK5tTHAwyqIGN7VdEts1LV04BEoxdlJnUbfNogtDCYWQRZOSxtAUCoFiJY0pWJVUjeTKM9LMe+9+Xcyb8ZMychuofeHCffeee7/vnXvOuefYlV/+mv932//tb91z/Y2rvxmMHQ+4FcEfOIGN4A+UwDDwoQScc7vM7AIwB8yZ2QXn3K77Ab6OgJnVgeOSbkqaBiaACUnTkm4Cx3OZzwf+qzcRQup1zNZ9RwDe+0YI4YKZTUn6zCGSMLOfAF/03r+QZdnyfwO+ePEiI6N1nPMgMDMkETLRbd2mXG8gCbd9YiIKIUxLKoLfBN7I+80+CUlTIYTp7RMT0b3Af37p8kh5y9gZcy4Fzt+5szqSaxkzUR7dwtrKMmaGW242d0t6vrD/He/90865o865o977p4F3Ctp4frnZ3L0Z+OryUrVSrZ0z8ZxhHjhcq1XPrS43q/0flDlK9XpPA2ma7gMeyvfPx3H8TJZlH4YQWiGEVpZlH8Zx/Awwn8s8lKbpvmq1ahvB641SXNk6dhLskNA2MIBtwKHK1vGTW8bKMRbAMgyPqWeETxUM8VSSJAv52JmZA0iSZMHMThWwnipXKp8hsLLcSaIR92oU8xjSayCQXotiHotG3Ku3m+0EOQwPQCDggMf7BzQajSs5eAk4B5zLx4O1vD2eJMmAQKliscgASJMw21pansFs1swQ/DNLmUmTMNuXX+taXHTDaj5OW612R1JZ0nFJJ/J+XFJ5aWmpA6S5bHV8fHsPHFU6q3pJCjtFxtrKMuXRLUUXXxdrRLazFOtUolZlsGhmACsgnHPTwJnCnjP5HMBKLotzxsTE9rgDL0t6LoriKsDIaB31ZEK+JxQJRHFUBR2NqLw8OTkZR0OC0ntm9k1JWU7OA4vD/mZ+YfElsANmNEKi75vztzB5M8uAr+bx48me88g757PQ1U5zNg52YH7hX8l6f+4Fi3c3BqHNmkI4YQOV2MGCNu9qHPYCewfzbrC+XSGcWEcgTRKA3wFfyzdDz5d+D3x9CIcfA4eBbQS9LscskgfLnHNPAnslvS/pbZDHLLPADpx9N9fqpSIBH8cxWZY9m6bpb4Ev5fN/iKLo2TRNgdx/eo8Wk5O7Ts/N/SOSdMjHdj4kmgkIEJLJzPZKetvMTkIvFLsR25Ml2gfuF5M7vnA66sdooJYkCSGERe/9VAjhzRxoKk3Tvg3U8nulVqvx8cyNpER2umM+SdOkbc5B8JhpqBdIgTRR24h+lpKen731aRIN7thscH9Zlv0d2F8YD2TIX7F2uw3A7ZWV1a0TYz9ca8cJZHRbuRuaDfUCw9/qJHamPOKToAwHtHN6lMvlSkH2o7wDMDo6WuGuQbbn5+YAKNcb3J5fSvrhtTY+vsOPuD1IOyRhMOkj9kSx29HfXB5RUnS964NT2+3vbGbxG9auO2cDNuV6A8NTb5TitBuOpQkfYD2vwOxgmvBB2g3Hto5X42EJyVsFlztbKpXGNgqVSqUxSWcLU2+tdToa9hasLjfPYlwGa+bTi8Dl1dvNsyvNtQQL9MO2w+HM7BqwlAtPdrvdq9773WAVsIr3fne3270KTOYyS2Z2bbXdHhogKmPj7YWF+VOSXs/v/9KdO+0fVBrjbRkgB/KIDBnYu9f/7D+ZmfmRxPd6qwB8YmZXcq1MAQ/nJhTM+OnDe/a8+PGNG9lm19V/D1Qw7HXZlcRa69+U6w38l5/4ipxzf5X0CPBILjcGPJH34pVcc8692FxcXLlXRnTwwH7+9P4f8aWe3fY59LIqo1NMyQBCCHNmdgx4BegUWefjDvCKmR0LIcz9L8nokSNH+PRvH4HC3YQ098pSbevg24qlmZmNmtmjkg4D3+j/tZldkvQXSa3PW5ptlpL3ZaIN99OS9F7+IgKUgSyEkNyv2nHT7DZX0dr9rpjua2l2r4rogRAYVqZvnPsPqVnpEXjEaB4AAAAASUVORK5CYII=\");\n", " }\n", " .bk-root .bk-tool-icon-wheel-zoom {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEgskILvMJQAABTtJREFUWMPdl1+MXVUVxn/fPvf2zrSFmUKnoBCUdjRoVaIxEpO2JhilMYBCtBQS2hejpg1Uo2NUrIFAoyGmtiE+GHwQGtvQJhqDmKYRBv+URFsFDNCSptH60DJTO3dKnX/33rM/H7rvsDu9M20fDMaVnGTvtb69z7fWXmvtc/TEzqd4OyXwNsv/FwFJQVI/sA14SZKRLOlPkr5TrVYXHz70quYkEEK4TtI2YAgYkrQthHDdhV5uuw+43/ZrwCbgRttgY/tjtrc0m83X3/f+D6ydnJhYcB4BSZcBA7aP2d4ELAGW2N5k+xgwkDB0IH19CGGH7R8B1aQeAf4KvAw0ku4K2zu7uru3ApdPEyiKohd4TNKjtjt5h6RHgccSNrddbvuHtm9Jqoak7xVF8WFgdavV+pSk5cCObNmXgK++85prCj3z28HKqZMnH7D9YAY4BvwujT8BvCuL1INX9vVt+dfwcCvNb7f9q2RuSfrGvWu/sL2Nf3LX7pzvj4ENSGBPVarVd4fRkZFltjdmoMGiKO4IIWwIIWwoiuIOYDDzeOPoyMiyFLkum7WJCMDztrcrTTrIRuAQZ6NcK1utL4dWq/VZoC8BhqvV6l1lWb4YYxyLMY6VZflitVq9CxhOmL60hhCKeYiV7WMKIXw9jT1HpXw3c+bOAKzOjJubzebJrKQCQLPZPClpc7bP6rMYKtjXth2OMf7tIkr11Wz8oQDc1Fb09vY+kQw1YAuwJY2nbUluAnCWpKkaFl6IQIzxivaR2SYA89sJVK/Xp2x32R6w/a30DNjuqtfrU0ArYecDCEqgLqm94T0dEm9mBG7PxkdDlkBnkhebgIezNQ8nHcCZPL9ijE1Jf/bZZoPtzbavmqNZLbf9tSxq+yoduuJ+SZ+zXSZyBXCqU+d8fvC5yRUrV+0G2j3g2hDCLyXd/+Su3QdnvP/zCuH72LWsgf2k0oHlH2c2odlkxcpVEdgr6aDtjyb8x20/J+mA7T9I6rL9SWA5dne2/GdXLl58qNJh398An85yTMA+4DOz8Dgu6Zu2dwJXJ91ltm8Gbp7Fgb+EEB4aHhpq5CEtACqVyr3AC0AlPS8k3TSmQ2YPhhBuS/1/LpmS9JTtNTHGfwBU2uUALARotVqniqJYH2Pck85pfavVaufAwnQvnHc0McaDKVptebN94QAnJB0EdtjekydyZXqjs/0ZgLIs/w6sy8bnYGYJ63pgERKC05JutT1kOwITwL9tvzlzUQUYB+Zjs2DBgu6xsbGJZHstByZbezregcBXeCsEz1bnzXt5anLyzLq71zDLxTRdVgemdx0fv2e2w5thO5DbiqL4oKT3ZKpnpyYnz+SY2ZpTAPZmJfdIrVZbNBNUq9UW2X4kU+2dcf53Aj1pj2PA7y/6m1DS00A9za9uNBq7iqJYBuoGdRdFsazRaOzKSqye1rTbaa/tlbYrqXQP2X4FIA9/J1l39xrC0v7+w5IeB8XkwS1lWe6TGJAYKMty31tfO4qSHl/a3384I3CDpI+kzC4lnRfrue6GytEjR8oQwlY73gC0L4qlth/q0M1/LYWtR48cKQF6enrC6dOnVwGLEpnxnp7en4+O1i/tszzGOCTpPmB7ahb57QUwBWyXdF+McWg6MScmuoA8OX8xOlpvXGz422XYTsB/SnpA0h7bX5R0WzI9HUL4qe2XbI+dk3xl+V7gxoztD5jRI+YK/zkEEokx2/uB/RdzIfUtueqVN04cXwF8G3iHY3z9Urw/j8ClyhsnjrcS2Vv/J/8NLxT+/zqBTkcxU/cfEkyEAu3kmjAAAAAASUVORK5CYII=\");\n", " }\n", " .bk-root .bk-tool-icon-box-edit {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEg4QfHjM1QAAAGRJREFUWMNjXLhsJcNAAiaGAQYsDAwM/+lsJ+OgCwGsLqMB+D8o08CoA0YdMOqAUQewDFQdMBoFIyoN/B/U7YFRB7DQIc7xyo9GwbBMA4xDqhxgISH1klXbDYk0QOseEeOgDgEAIS0JQleje6IAAAAASUVORK5CYII=\");\n", " }\n", " .bk-root .bk-tool-icon-freehand-draw {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAADTElEQVRYCeWWTWwMYRjH/88721X1lZJIGxJxcEE4OOiBgzjXWh8TJKR76kWacOBGxdEJIdk4VChZI/phidRBHMRRIr7DSUiaSCRFRM3u88gz+o7Z6bBTdjmYZPf9eJ55fv/5zzvvDPC/H9QsA66Olo9Ga+/MdR+Ljm2/KQIULsz9FqItGdOfJKLhApLgVkiSCGODjWit7QpKWy+TNrFeXvzKVUT8NiTVaIgDcbiCFJ7GiT8WkARXAdYBK0Lbhi/CenArRNskuM7/tgNp4ArQ42dwjf3WY5gWTqC7O/NbNn2Xkfw/YwdSw/We14HP2IEZwX+y9cZ9SH0LmgFP7UCz4KkENBNeV0Cz4b8U8DfgKiDxMWwUXETqLvJpCQpXZfawbzS7t9v5pL19cHBwfja7YA0y/lyCM0+E5hv5+piZXwKYcF23as+37bTXsQVqgkL0p/34fHR7DcBtbetFsBmGDwMOJCggYG55yw7dMlk6DuC1Bdu2RsCU9TYWQq2IoGbsreZ5NzvEqfSBsIsIy8OTbcdgiRHeh4o8AFAEwDakbY2AaCCpH7V9aGhoUUUy3UyVbkPYFuYLDlUZH8XBpwxkK0Dbgxg5HcVi0ent7a0RULMIozaHBSMfF9b2SzdutFcFB2FkwMIJOG6qfteXOa1nHZ48tyefuwyfT9s6wtzZ3t7eZse2DR2I228TtHXzuWCx9g8MtK5cuHCZTH4tiHEOa4xFngvTyS8f35d6enomiCi4/foEXBkZaQuukChL4FYA2Whd7YcC4gEdW3CpdL3LtGAVCVYJywEyTpAuJKeMOKXZs/Bw947C50KhUFOG4cwz35cjWNBlHGeD53n3xsfHP/T19U1qciggar8Fa4I3PHobIotBWBtc2hSiChyZxVzM53Pv7FVH6Tp3uVy+g0r1ImD2GjIrQGYIxjnfuXTZGICS5k/bBwJoubwEFX4TLah9EXomJGMA3za+f9913Yl4TnzsDQ+vE6YTZOjHh4ngibstt1pzQwd04F0bPStEBpXqRoBeQ/AKghfBnOEKgS+Q7z91Xfdz/HGKg8Ox7z8iYD9z6wqTkZFgnvhMGP9VZ2or1XVkPM9z0mytSfVsHa1RLBZbLoyNzUnK+ydz3wC6I9x+lwbngwAAAABJRU5ErkJggg==\");\n", " }\n", " .bk-root .bk-tool-icon-poly-draw {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEjglo9eZgwAAAc5JREFUWMPt1zFrU1EUB/DfS4OmVTGDIChCP4BgnQXRxVHqIJUupp9AB8VBQcRBQUXIB9DWQoMRiXZzcnQSA34A7aAuHSJKkgo2LvfBrU3aJnlYkBy4vHcP557zP/9z3r33JdXa647N0kHSZd5Nn0rSxc8G3cXp85sMcnZZ8vge3osZ+l3vB8CWFA0iL14t79h210swAjACMAIwAjACkB90D/8/GchI9ve4nPwTBh5E9ws7OepzGWb9EddSn51Op9ZstadSg4VK1UKlKkmSDSMLALewiuNh/hVJq71Wxttmqz0dG88vPc+MgWP4grvYG3SLOBrZFFFrttqPe4HIDxh4GSei+98iSlusuYopXEAjBtEPA3tQwUpwluAbDm4TPJUz+BTW9l2Ce6G7L0X/Bw8D3T/7SKKIDzHg7QCcxjvcQAEtXAnrrg/RP0/DKPbqgcN4iVOR7gcO4dcQgRuoh7HSqwlP4n20m63jJu5n8MkWMYfP3UowhzdR8FU8w9iQwevBdyq3/27CMRzAE5yLuvsRLg+ZcR1nJ8YL81HWJUzGAPaFZwe/Q5MdyYDyNHgjzO90YyGHtVDncuiJchaHw8R4oREFV5qdiVmYLM3OgD9k5209/atmIAAAAABJRU5ErkJggg==\");\n", " }\n", " .bk-root .bk-tool-icon-point-draw {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEiERGWPELgAAA4RJREFUWMO1lr1uG1cQhb9ztdRSP7AF1QxgwKlcuZSqRC9gWUUUINWqTh5AnaFOnVPEteQmRuhCURqWsSqqc9IolREXdEvQBElxtdw7KURSFEVKu4w8wAKLxdw9Z+bMnRmZGXfZ29//II8th4WwGVNyIoQLYB5vxA9Caq04iUd9A+7ZlsNC2I7TdSd2hZXMJKlnTqp9jtl/GBaqoyQ0noFKpUIzBicYYc+DEFpxkglc4oVJa5gvDn8v1xV2irG3FM4NSVwjUKlUaMcpJhCGmSEJQ6QGD8M5WnHCd8+f3QCXpPLx8WNwv0j6Bm9FMK7FJ3WBE+R/2t7c/GBmFvSBrzRTCsyTDjXrxUgEMtpxynJYmJoBJ4VAybwVARgvL7Oik0okCodnKpVKX7P0leiVMb0VvbJT+upznK4vh0GIeQwwQStJkHQD3MwsCALTJRG7Qrdrj5m/djgYaIa0hlkRdJk26XEgC9txurccBtVW3IudBImmZuACUP+ZlIDBt9FKcubYNTcAH/X0RYM1E7utJPlqe+uZzPxUcEkiSS4sTT95n15Mud0xWC0o2PAWOCdK3KYZlFxfM+tHOcnMzNr1es18ug+cgsVjP4yBU/Ppfrter1m/+l0+zYygML1xRVHU7TSb1cSzBzoBzszsH+AMdJJ49jrNZjWKou6wBnwOzcyndBpNbuueURR1Dw8Pq35p9cc5p/Dy9Dypt7jXrtdGwQECS9NPhr6Gq6txUzNigE6zydLK6lTw12/KT4FGFEUfJX2YJNONq5tVs4ODA7sD/DnwJ/BoADZuE3tHFs12dna6d4C/BI6AlbyzI8ii2TTw12/KK33gb2cdXsNZoAntbZC2SeO4c9592k/5eNQbiwvFd1kJuFGwLJr1wSPg/SwpvyFBHufOeXcFeAlE97U/uCxOY+P3b+Bn4B3Q+L8EdJfD4a+/AbC4UBzPxiPg3wlHZquB28Cn2IuR9x3gr3uV4DbwfvSDOvi4uFA8BDZmIRHkjHpS9Ht9iRqd8+5G3g05mAGcQbsdiX5QJ428G7Kygo8XYdb1/K4NWVmjzkNge2sz84bs+ELmpDDLtqWsNZBXgvmw8CTtpWVMT7x5YWBjLARnwZfKQNYN2U2LPvrh+5nBt7c2M2/It9bArCTKR8eZN+SJ13AScPnoODeRdqNenH+wul5w2gUr2WUjMFAt8bZ/0axX/wNnv4H8vTFb1QAAAABJRU5ErkJggg==\");\n", " }\n", " .bk-root .bk-tool-icon-poly-edit {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gELFi46qJmxxAAABV9JREFUWMOdl19vFFUYxn9n9u9sCyylUIzWUoMQBAWCMdEEIt6xIRQSLIEKtvHe6AcA4yeQb7CAUNJy0daLeomJN8SEULAC2kBBapBKoLvbmdl/c14vdmY7u91tF95kknPOnHmf95znPc97Ro2OTeBbdjFDT3c32ZxVHUOE9kSMB0/m6ExuoJn1H+ur6Y+OTfD50SMN5168OgrAlyf7CfuD+z7+iDs3p8hkLUQ0iFQ/yFl5Nm/qonfHVva+s32Zw9GxCYILsZ08tpNfBhbs+1YN4OH9+7huGdECSBVfqUosbsllfmauBqiR+cCNwOr7AEo8pPHJnymXykhg5fUWjoQpl0vVvhZhbSzGoUOHqgBlt6B6uruj2Zy1E9jo0fhfeyL2x4Mnc8VErK0KUEOB64JSyptfG4RSytsJjUJVxw2lsFy3urL9nx1Qd25ObctkrVMi+jQivd7U2ZyV/3Hzpq7h3h1b/7p9Y0o8v8rwAbTWrGpSocN/FGDlbAI0Rl23PCBan0Ok158H9Ipwzi25A/Mzc9Gl/BYx/E4kYqC1NKRARNAaDCNUM27Z+Zr+ouXs0q4+LSLBHPYCFkTkC6uU39kwCdsS7WRKmaYUiAhdnZ3MPX2K4+QjQI+C94A93rMzm8ltMwyDeDzWjMZeEb2pYQDdW3vITU2jtUZ5QThOPgm8C7wP7J15OPsBsB3oWpGnVWisCeDS1VHj4vBI92+/3tgB7Ab2AruAXiDBK5oIOkhtkEYRNRuJhObrd8Dl9ewf4D5wG7hVLpen29vb5wzD+BrkbBMaL3d1dk5nsrnlFDTTFWAWmAZueWD3gCemGde2k2fw1Al1YXhEvjozoO49eczdqekrWmsc2zlrmvEKOGoW1GUjFLqSk2KpJrCLwyMCPAP+BO54QL8DM6YZX/ClsP9YnwKkXnIBP4jdIpJRpdJTCYdMwwi98KU0Hjc/dDILNyUcwTCWdOSMJ0TRmBktGRhLugu0xyLk7CIqVNm+0bGJptl1YXikD0grpY4Rjc4a8Fbgdab/6OGbAJeCUuyJnnHmZH9pbSyGuBXV8NUwlUpR1EWyixmSyTWEwqGlJ2Swbo2JXbAAfgDGgGQA9I1A9t1tlq0AxrXxn0ilUpw4fhQqYkH/sT41OTnJJwf2s6FjI5mshdYa7bqVR2uezr9MJmJt14FvGrh/O9D+e6UkM/xyCuCqEKCYnJyUTKFQrZDHjxzGshwWLQcRsOz8Hi85P23id0ug/XilAMLBmm4tPGdoaKjSH5+oAGrhwvBI9SjZTn4QSK9yenoD7dlrExPoJlXW8G8ytpNHxRKk02lGxsdRKFwXLNvx5yY94HQLGhGk4LFCYQSqaE0AwWM1eOoEbR0dKBSW7bC4mKuffxs4D/wCLKwQQPAUzIkslfp6cVomROWSolh0GjldAM4nzDi2k9/i5UAzC9aKfwNJ3zgJg9YEvN6+C7SHgKm69+sD7RfNnKTTaZRPQfAut4oFV//IS7gkcB34VlVo8kGzphlfB+DU+TfNGBpZtRastvrvARJmfMF28ge9sc2B9/PNnCilMIDwK6y8/ow/Ai4kvILTljAXvDvEvrqKSUs60KolzPjBxspavQD2tKqCAGF/Ba+xE/Wbilu54wZV8NEKF5fXzQHl/bh4hUsE0WAXSlDMYcQSrQXgCmsTseXHsJkNnjqBFGwKJaHsKlxtUHYVhbLCzr1kaOA4bcn1y1Swmb+iLpJKpVrfgdpfsiVVCYcgluwgnU7jEgJ4s5UkLFtWYyHyEg0/N1q1tmQH+YXnAMFr97Nmv3p+0QsHQRsF8qpBOE5+rb9Nkaj50tVQKjqh4OU3GNL/1/So3vuUgbAAAAAASUVORK5CYII=\");\n", " }\n", " .bk-root .bk-tool-icon-line-edit {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAG/3pUWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYAAHjarVdpknSpDfzPKXwEJBDLccQW4Rv4+E4BtXR198znCdeLLijgQUoppWg3//Pv5f6FDwefXJRcUk3J4xNrrKzoFH8+pyUf9/f+8J3C7y/j7jnBGApow/mZ5l2vGJfXCzne8fZ13OV+9yl3ozvx2DDYyXbauCDvRoHPON3frl5Imt7MuX8hH0seiz9/xwxnDMFgYMczUPD7m89J4fwp/iK+OVRbiMf6gm8K4bv/3NN1Pzjw2fvwn+93PLzccTZ6mJU+/HTHSX723/bSOyLi58n8jmiqz/798+a/tUZZax7rNCKOakzXqIcpu4eFDe483kh4Mv4E/byfiqd49R2OHzC1Od/woxLD44siDVJaNHfbqQNi5MkZLXPnsMdKyFy5gwwCHXhocXahhhEK+OhgLmCYn1hon1vtPBxWcPIgrGTCZrR5fHvc58A/fb5stJaFOZEvT18BF1t8AYYxZ99YBUJoXZ/K9i+50/jPjxEbwKBsNxcYqL6dLZrQK7bC5jl4cVga/Ql5yuNuABfhbAEYCmDAJwpCiXxmzkTwYwE/CuQcIjcwQOKEB1ByDCGBnMJ2Nt7JtNey8BmGvIAICSlkUFODgqwYJSbkW0EIqZMgUUSSZClSRVNIMUlKKSfTKc0hxyw55ZxLrllLKLFISSWXUmrRyjVAxsTVVHMttVZVHKpRsZdivWKgcQstNmmp5VZabdoRPj126annXnrtOniEAQlwI408yqhDJ02E0oxTZpp5llmnLsTaCisuWWnlVVZd+mTtsvqVtU/m/po1uqzxJsrW5RdrGM75sQWZnIhxBsY4EhjPxgACmo0zXyhGNuaMM185uBCEgVKMnEHGGBiMk1gWPbl7Mfcrbw7e/V9545+Yc0bd/4M5Z9S9Mfedtx9YG7rlNmyCLAvhUyhkQPrNhvO5AJFnrZIR0plaLL5liQYdDi5TubaIokFDkmoFEB8CzxZVxemssDqthPhUblPgW1iQU5g6XwNwyVI7bUFRm035iNziMkgWvEso2SXnsJfveR0Y4SlVF8YWC1pVQhJiQa8JwDvlMNIxAfq3F7GDObHU1LlhzlZaWwNp6BvACxAgInGXlllMGZCpEnZHrGA6GM2718xuFcz7YdUQxzEEfjdWz4GlkcwaonT0pgA6mB25grPILtnSMhuCpsGhmMU6uJbixJs4lbKHqh+wos1jW2rchyGRCIvN9MXu+KAmMSfAlIKVvi/tybhCPJZCu2Ow9pLdyo427+X2ovMBmKNu8PA0zgl3fS0PB1DWWkVYB47bkyiJHhkFPzTzCjzn4Dq1mqoIWzCmcDGsHQmQAQdEHsixK1IXESd5rLU7THVJNV8obHS8sZeN0G5Jdt5pQTVKCCbgK1hItTS8o92iEZpuWJ/oC2r/0+zTmhvFXoaMVKRe27altDtid6OvG1hENVwBnC61KKugNoemOiPCCNb3GoHAZOFuDxxPsD+07nbSPcr/o1Zmc4jARhotrA5F5ZcjP9rPk90vR8A+k028A+8+5wKlHVID542sMzMCuXktkRzUCpE+xCBZywjNcJITx0II9x5948CekBl4XaC5OCX2nCyObdwN3HwQh5DWL/BBEkhDYHn/vpXNgZkVTZs8rj+HO8JFC6qvDVhgAEQSYCDyC86rMhG1WPzAVB9ZldDWG6EzDcFiqJBDvFS8mXDv3SK2LPoguVB2kwUx7UL5KqZWiEzocsbvSjNnaYDNtcYJuA5cDcsrvHd6yCxGjqvl9+wh3Qh8Kc9py8sNW8ncU8qwxdPj1qIGfrPqlXeoS4/JLa/LwRLTCtxuSoZUT+2Su6kXW3QNacYQbId6NUKVbROpviybFSPQQL9lhB2MamEnFyB9Y+hrG1+xBg+L0QG2TZdTdlcsBdq9oHdt9Bu5/IM9+Nfh1AwrSqlboTA6Bgq568A7UfbaMrZjoQZhQphofvNw93+bN+5X7FYKBgLmRid+tSdV6c02A4R0cHwKobmoMt5+6WI9XNISFIywpf6RMd5/a91vE78FzVHIFmxud4woyJx76OMTCa4yhgN3iJO2VfRPFMv9sYTxFzU+1eWeYS52pwOoSJldZY6koib4P1O427rbeUrNZfu44hWjz5ZSuu/vKPpimoXbLkfxWSPetvxDWG5jQSaZCxA3ad+p6rlttDhK+YwwK1LHVe0drDtorc5vnQ1247g58vewDtU7L3DRwrG4dhCUDRKKOtYr2dXHtpt+33d1WZmfkAHdl7Q8ENF+CNgB+nOw29n5F7SeNo/ckbu4laLTCdqJLHjmhJbKzmrCEX7zULrhefuHmu0V/1nbP1pnb6FaT7sOxn4pvWkfrYhYtCeJ4Xv+kOXrroIs1eHWXN1/AfzaY94ms5vaAAABg2lDQ1BJQ0MgcHJvZmlsZQAAeJx9kT1Iw0AcxV/TSkUqDnYQUchQnSyIijhqFYpQIdQKrTqYXPoFTRqSFBdHwbXg4Mdi1cHFWVcHV0EQ/ABxcnRSdJES/5cUWsR4cNyPd/ced+8AoVFhmhUaBzTdNtPJhJjNrYrhV4QwjAgGIMrMMuYkKQXf8XWPAF/v4jzL/9yfo1fNWwwIiMSzzDBt4g3i6U3b4LxPHGUlWSU+Jx4z6YLEj1xXPH7jXHRZ4JlRM5OeJ44Si8UOVjqYlUyNeIo4pmo65QtZj1XOW5y1So217slfGMnrK8tcpzmEJBaxBAkiFNRQRgU24rTqpFhI037Cxz/o+iVyKeQqg5FjAVVokF0/+B/87tYqTE54SZEE0PXiOB8jQHgXaNYd5/vYcZonQPAZuNLb/moDmPkkvd7WYkdA3zZwcd3WlD3gcgcYeDJkU3alIE2hUADez+ibckD/LdCz5vXW2sfpA5ChrlI3wMEhMFqk7HWfd3d39vbvmVZ/P2aecqIM1FFZAAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH5AQdDBkQmV+argAABM5JREFUWMOtl9trHFUcxz9n9jYzm7Tb9JIWGtqUllLwVgRBQWl90S6lTaGmF6E2/4H+A4r+A0offdlWodL4kEZw9bG+iC9iKqLF0os0EBq02dtcdmdnfj7szGZ2M5vulv5g4JwzZ873+7ufUfMLi0RSa1TZNzVFrW511xBhzMxx79EyOwrbGSSzZ073zOcXFnlv5lTi3mvfzAPwwYVZ0tHiq6+/xu+/LlGtWYgEINL9oG657N41yfSRgxw9cHjDgfMLi8QVsR0X23E3gMXnkXQJ3L9zB99vI4EA0sVXqsPF93xW7y73ACVJBJwE1j8HUBIi3Sz/QNtrIzHN+yWdSdNue915IMKWXI4TJ050Adp+U+2bmkrV6tZeYAXwEJExMyf3Hi0rM5fvAvS4wPdBKRW6vZeEUiq0RIBCddddpymu0+rRbPvEzkPVmmWLBA1EdGAbYNctt7V712QwfeSgd/uXJQnPVVoEEAQBTxXpuEMELNtNNFW1WrsrQdBCRImQEeE/wBUh53v+7tW7y5n1+BZRIoJSioXvy3itdgclURSZTBrP87AdV57G1TT0d4GPgC+Bw8Ca7bifATsTgzBvjlH1qgNdICJM7tjB8soKw4jtuD+Gw3c229e1wF+P/uHPpT86rhBBRHActwAcAl4EjgIvAYcFJnlOoq5dv6EBU8AR4OUQ6AVgGjATwuC5YUdZ4A+z+1mBTUM/AKwqpZSIpPfu2VP7+/6DYEMMPE9N83lzq23ZWwxDd4GaQnmgUloqperSCpKC8HGCXz8G7NANU8CWUKPzsUDbyLPVyjYC39e0VMZx3Ccoha4b4lQqbUlnsBqNWCXpEMgKfA38DNSBcdPQr4zlMtTtFiqlulmQmJv9ks2idUZGZMjZmZMAfBUvxWHR0y5dmPV2FcbPG9ncFdPQS3nTuAJQLBZpBS1qjSqFwjipdGr9SWlsHTewm9ZmnngMKAaV9nBd+/bmdxSLRc6dnemm3+yZ06pcLvPGW2+yfWIn1ZpFEAQEvt95goCV1TXMXH4zAt4woaRF7RTAVylAUS6Xpdpsdjvk2VMnsSyHhuVEZTh+xgywBhwLfZIdKRfj7dWqPGFubq7T428ukslkaHttLNsZ9P3nwIfh+DhwS4EO9DA0zByBCE2n1fPxpQuznSCaX1js9nFp2pjbtqGhobQ0jUY9CbgALERah3IM+El1rNqTaqaph5W1uYGAFrfA5YvnyE9MoFBYtjMI/BXgQR/4pqVDZL3V9/cYrX+x7SnsXh/H5TLwW2iBQbVLNgn65CDsrSPOIJOXwmdQ4fRHrZilUqmXwNXrNzbbfxv4ArgFVBLeJ95oDEMHwHHcvvUcRqEwuBf0SSUEB9gfxsAgAkO1kcj/WvwKPaR8EhvPAUvRtdIMtR1FtBH37w8DEeChaehXw/xfAnzHcVOjEkhHrIe0Qlz7T8PuWLEd9+2w9KphgUUgQJ7JAgAPDT13NTrJyOYqIilrlEwQv/NPMTSByxfPIU37eCqtq2zWmPYDjbavaLYVdn2NuffPjqRJK2hRLBaHzoK+X7L1QE+nIFeYoFQqkTVMaTn2UOe1LWtwEJqGzqgRnS9M4Fb+3XBJGfSrFzW9dBw0icioJBzHzUXdMJM18APwWo6Kmy1O6X+V8UHDotBqogAAAABJRU5ErkJggg==\");\n", " }\n", " `;\n", " exports.default = css;\n", " },\n", " /* core/util/menus.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const dom_1 = require(68) /* ../dom */;\n", " //import menus_css from \"styles/menus.css\"\n", " const styles = tslib_1.__importStar(require(255) /* ../../styles/menus */);\n", " class ContextMenu {\n", " constructor(items, options = {}) {\n", " this.items = items;\n", " this.options = options;\n", " this.el = dom_1.div();\n", " this._open = false;\n", " this._item_click = (i) => {\n", " var _a;\n", " (_a = this.items[i]) === null || _a === void 0 ? void 0 : _a.handler();\n", " this.hide();\n", " };\n", " this._on_mousedown = (event) => {\n", " var _a, _b;\n", " const { target } = event;\n", " if (target instanceof Node && this.el.contains(target))\n", " return;\n", " if ((_b = (_a = this.options).prevent_hide) === null || _b === void 0 ? void 0 : _b.call(_a, event))\n", " return;\n", " this.hide();\n", " };\n", " this._on_keydown = (event) => {\n", " if (event.keyCode == dom_1.Keys.Esc)\n", " this.hide();\n", " };\n", " this._on_blur = () => {\n", " this.hide();\n", " };\n", " dom_1.undisplay(this.el);\n", " }\n", " get is_open() {\n", " return this._open;\n", " }\n", " get can_open() {\n", " return this.items.length != 0;\n", " }\n", " remove() {\n", " dom_1.remove(this.el);\n", " this._unlisten();\n", " }\n", " _listen() {\n", " document.addEventListener(\"mousedown\", this._on_mousedown);\n", " document.addEventListener(\"keydown\", this._on_keydown);\n", " window.addEventListener(\"blur\", this._on_blur);\n", " }\n", " _unlisten() {\n", " document.removeEventListener(\"mousedown\", this._on_mousedown);\n", " document.removeEventListener(\"keydown\", this._on_keydown);\n", " window.removeEventListener(\"blur\", this._on_blur);\n", " }\n", " _position(at) {\n", " const parent_el = this.el.parentElement;\n", " if (parent_el != null) {\n", " const parent = parent_el.getBoundingClientRect();\n", " this.el.style.left = at.left != null ? `${at.left - parent.left}px` : \"\";\n", " this.el.style.top = at.top != null ? `${at.top - parent.top}px` : \"\";\n", " this.el.style.right = at.right != null ? `${parent.right - at.right}px` : \"\";\n", " this.el.style.bottom = at.bottom != null ? `${parent.bottom - at.bottom}px` : \"\";\n", " }\n", " }\n", " /*\n", " styles(): string[] {\n", " return [...super.styles(), menus_css]\n", " }\n", " */\n", " render() {\n", " var _a;\n", " dom_1.empty(this.el, true);\n", " const orientation = (_a = this.options.orientation) !== null && _a !== void 0 ? _a : \"vertical\";\n", " dom_1.classes(this.el).add(\"bk-context-menu\", `bk-${orientation}`);\n", " dom_1.append(this.el, ...this.items.map((item, i) => {\n", " var _a;\n", " let el;\n", " if (item != null) {\n", " const icon = item.icon != null ? dom_1.div({ class: [\"bk-menu-icon\", item.icon] }) : null;\n", " el = dom_1.div({ class: ((_a = item.active) === null || _a === void 0 ? void 0 : _a.call(item)) ? \"bk-active\" : null, title: item.tooltip }, icon, item.label);\n", " }\n", " else {\n", " el = dom_1.div({ class: styles.bk_divider });\n", " }\n", " el.addEventListener(\"click\", () => this._item_click(i));\n", " return el;\n", " }));\n", " }\n", " show(at) {\n", " if (this.items.length == 0)\n", " return;\n", " if (!this._open) {\n", " this.render();\n", " this._position(at !== null && at !== void 0 ? at : { left: 0, top: 0 });\n", " dom_1.display(this.el);\n", " this._listen();\n", " this._open = true;\n", " }\n", " }\n", " hide() {\n", " if (this._open) {\n", " this._open = false;\n", " this._unlisten();\n", " dom_1.undisplay(this.el);\n", " }\n", " }\n", " toggle(at) {\n", " this._open ? this.hide() : this.show(at);\n", " }\n", " }\n", " exports.ContextMenu = ContextMenu;\n", " ContextMenu.__name__ = \"ContextMenu\";\n", " },\n", " /* models/tools/on_off_button.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const button_tool_1 = require(275) /* ./button_tool */;\n", " const mixins_1 = require(146) /* ../../styles/mixins */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " class OnOffButtonView extends button_tool_1.ButtonToolButtonView {\n", " render() {\n", " super.render();\n", " dom_1.classes(this.el).toggle(mixins_1.bk_active, this.model.active);\n", " }\n", " _clicked() {\n", " const { active } = this.model;\n", " this.model.active = !active;\n", " }\n", " }\n", " exports.OnOffButtonView = OnOffButtonView;\n", " OnOffButtonView.__name__ = \"OnOffButtonView\";\n", " },\n", " /* models/tools/toolbar_base.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const logging_1 = require(72) /* ../../core/logging */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const build_views_1 = require(99) /* ../../core/build_views */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const dom_view_1 = require(66) /* ../../core/dom_view */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const model_1 = require(71) /* ../../model */;\n", " const gesture_tool_1 = require(284) /* ./gestures/gesture_tool */;\n", " const action_tool_1 = require(285) /* ./actions/action_tool */;\n", " const help_tool_1 = require(286) /* ./actions/help_tool */;\n", " const inspect_tool_1 = require(274) /* ./inspectors/inspect_tool */;\n", " const toolbar_1 = require(278) /* ../../styles/toolbar */;\n", " const logo_1 = require(288) /* ../../styles/logo */;\n", " const mixins_1 = require(146) /* ../../styles/mixins */;\n", " const toolbar_css_1 = tslib_1.__importDefault(require(279) /* ../../styles/toolbar.css */);\n", " const logo_css_1 = tslib_1.__importDefault(require(289) /* ../../styles/logo.css */);\n", " class ToolbarViewModel extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ToolbarViewModel() {\n", " this.define({\n", " _visible: [p.Any, null],\n", " autohide: [p.Boolean, false],\n", " });\n", " }\n", " get visible() {\n", " return (!this.autohide) ? true : (this._visible == null) ? false : this._visible;\n", " }\n", " }\n", " exports.ToolbarViewModel = ToolbarViewModel;\n", " ToolbarViewModel.__name__ = \"ToolbarViewModel\";\n", " ToolbarViewModel.init_ToolbarViewModel();\n", " class ToolbarBaseView extends dom_view_1.DOMView {\n", " initialize() {\n", " super.initialize();\n", " this._tool_button_views = new Map();\n", " this._toolbar_view_model = new ToolbarViewModel({ autohide: this.model.autohide });\n", " }\n", " async lazy_initialize() {\n", " await this._build_tool_button_views();\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.tools.change, async () => {\n", " await this._build_tool_button_views();\n", " this.render();\n", " });\n", " this.connect(this.model.properties.autohide.change, () => {\n", " this._toolbar_view_model.autohide = this.model.autohide;\n", " this._on_visible_change();\n", " });\n", " this.connect(this._toolbar_view_model.properties._visible.change, () => this._on_visible_change());\n", " }\n", " styles() {\n", " return [...super.styles(), toolbar_css_1.default, logo_css_1.default];\n", " }\n", " remove() {\n", " build_views_1.remove_views(this._tool_button_views);\n", " super.remove();\n", " }\n", " async _build_tool_button_views() {\n", " const tools = (this.model._proxied_tools != null ? this.model._proxied_tools : this.model.tools); // XXX\n", " await build_views_1.build_views(this._tool_button_views, tools, { parent: this }, (tool) => tool.button_view); // XXX: no ButtonToolButton model\n", " }\n", " set_visibility(visible) {\n", " if (visible != this._toolbar_view_model._visible) {\n", " this._toolbar_view_model._visible = visible;\n", " }\n", " }\n", " _on_visible_change() {\n", " const visible = this._toolbar_view_model.visible;\n", " const hidden_class = toolbar_1.bk_toolbar_hidden;\n", " if (this.el.classList.contains(hidden_class) && visible) {\n", " this.el.classList.remove(hidden_class);\n", " }\n", " else if (!visible) {\n", " this.el.classList.add(hidden_class);\n", " }\n", " }\n", " render() {\n", " dom_1.empty(this.el);\n", " this.el.classList.add(toolbar_1.bk_toolbar);\n", " this.el.classList.add(mixins_1.bk_side(this.model.toolbar_location));\n", " this._toolbar_view_model.autohide = this.model.autohide;\n", " this._on_visible_change();\n", " if (this.model.logo != null) {\n", " const gray = this.model.logo === \"grey\" ? logo_1.bk_grey : null;\n", " const logo = dom_1.a({ href: \"https://bokeh.org/\", target: \"_blank\", class: [logo_1.bk_logo, logo_1.bk_logo_small, gray] });\n", " this.el.appendChild(logo);\n", " }\n", " for (const [, button_view] of this._tool_button_views) {\n", " button_view.render();\n", " }\n", " const bars = [];\n", " const el = (tool) => {\n", " return this._tool_button_views.get(tool).el;\n", " };\n", " const { gestures } = this.model;\n", " for (const et in gestures) {\n", " bars.push(gestures[et].tools.map(el));\n", " }\n", " bars.push(this.model.actions.map(el));\n", " bars.push(this.model.inspectors.filter((tool) => tool.toggleable).map(el));\n", " for (const bar of bars) {\n", " if (bar.length !== 0) {\n", " const el = dom_1.div({ class: toolbar_1.bk_button_bar }, bar);\n", " this.el.appendChild(el);\n", " }\n", " }\n", " }\n", " update_layout() { }\n", " update_position() { }\n", " after_layout() {\n", " this._has_finished = true;\n", " }\n", " }\n", " exports.ToolbarBaseView = ToolbarBaseView;\n", " ToolbarBaseView.__name__ = \"ToolbarBaseView\";\n", " function createGestureMap() {\n", " return {\n", " pan: { tools: [], active: null },\n", " scroll: { tools: [], active: null },\n", " pinch: { tools: [], active: null },\n", " tap: { tools: [], active: null },\n", " doubletap: { tools: [], active: null },\n", " press: { tools: [], active: null },\n", " pressup: { tools: [], active: null },\n", " rotate: { tools: [], active: null },\n", " move: { tools: [], active: null },\n", " multi: { tools: [], active: null },\n", " };\n", " }\n", " class ToolbarBase extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ToolbarBase() {\n", " this.prototype.default_view = ToolbarBaseView;\n", " this.define({\n", " tools: [p.Array, []],\n", " logo: [p.Logo, 'normal'],\n", " autohide: [p.Boolean, false],\n", " });\n", " this.internal({\n", " gestures: [p.Any, createGestureMap],\n", " actions: [p.Array, []],\n", " inspectors: [p.Array, []],\n", " help: [p.Array, []],\n", " toolbar_location: [p.Location, 'right'],\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " this._init_tools();\n", " }\n", " _init_tools() {\n", " // The only purpose of this function is to avoid unnecessary property churning.\n", " const tools_changed = function (old_tools, new_tools) {\n", " if (old_tools.length != new_tools.length) {\n", " return true;\n", " }\n", " const new_ids = new Set(new_tools.map(t => t.id));\n", " return array_1.some(old_tools, t => !new_ids.has(t.id));\n", " };\n", " const new_inspectors = this.tools.filter(t => t instanceof inspect_tool_1.InspectTool);\n", " if (tools_changed(this.inspectors, new_inspectors)) {\n", " this.inspectors = new_inspectors;\n", " }\n", " const new_help = this.tools.filter(t => t instanceof help_tool_1.HelpTool);\n", " if (tools_changed(this.help, new_help)) {\n", " this.help = new_help;\n", " }\n", " const new_actions = this.tools.filter(t => t instanceof action_tool_1.ActionTool);\n", " if (tools_changed(this.actions, new_actions)) {\n", " this.actions = new_actions;\n", " }\n", " const check_event_type = (et, tool) => {\n", " if (!(et in this.gestures)) {\n", " logging_1.logger.warn(`Toolbar: unknown event type '${et}' for tool: ${tool}`);\n", " }\n", " };\n", " const new_gestures = createGestureMap();\n", " for (const tool of this.tools) {\n", " if (tool instanceof gesture_tool_1.GestureTool && tool.event_type) {\n", " if (types_1.isString(tool.event_type)) {\n", " new_gestures[tool.event_type].tools.push(tool);\n", " check_event_type(tool.event_type, tool);\n", " }\n", " else {\n", " new_gestures.multi.tools.push(tool);\n", " for (const et of tool.event_type) {\n", " check_event_type(et, tool);\n", " }\n", " }\n", " }\n", " }\n", " for (const et of Object.keys(new_gestures)) {\n", " const gm = this.gestures[et];\n", " if (tools_changed(gm.tools, new_gestures[et].tools)) {\n", " gm.tools = new_gestures[et].tools;\n", " }\n", " if (gm.active && array_1.every(gm.tools, t => t.id != gm.active.id)) {\n", " gm.active = null;\n", " }\n", " }\n", " }\n", " get horizontal() {\n", " return this.toolbar_location === \"above\" || this.toolbar_location === \"below\";\n", " }\n", " get vertical() {\n", " return this.toolbar_location === \"left\" || this.toolbar_location === \"right\";\n", " }\n", " _active_change(tool) {\n", " const { event_type } = tool;\n", " if (event_type == null)\n", " return;\n", " const event_types = types_1.isString(event_type) ? [event_type] : event_type;\n", " for (const et of event_types) {\n", " if (tool.active) {\n", " const currently_active_tool = this.gestures[et].active;\n", " if (currently_active_tool != null && tool != currently_active_tool) {\n", " logging_1.logger.debug(`Toolbar: deactivating tool: ${currently_active_tool} for event type '${et}'`);\n", " currently_active_tool.active = false;\n", " }\n", " this.gestures[et].active = tool;\n", " logging_1.logger.debug(`Toolbar: activating tool: ${tool} for event type '${et}'`);\n", " }\n", " else\n", " this.gestures[et].active = null;\n", " }\n", " }\n", " }\n", " exports.ToolbarBase = ToolbarBase;\n", " ToolbarBase.__name__ = \"ToolbarBase\";\n", " ToolbarBase.init_ToolbarBase();\n", " },\n", " /* models/tools/gestures/gesture_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const button_tool_1 = require(275) /* ../button_tool */;\n", " const on_off_button_1 = require(282) /* ../on_off_button */;\n", " class GestureToolView extends button_tool_1.ButtonToolView {\n", " }\n", " exports.GestureToolView = GestureToolView;\n", " GestureToolView.__name__ = \"GestureToolView\";\n", " class GestureTool extends button_tool_1.ButtonTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.button_view = on_off_button_1.OnOffButtonView;\n", " }\n", " }\n", " exports.GestureTool = GestureTool;\n", " GestureTool.__name__ = \"GestureTool\";\n", " },\n", " /* models/tools/actions/action_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const button_tool_1 = require(275) /* ../button_tool */;\n", " const signaling_1 = require(14) /* ../../../core/signaling */;\n", " class ActionToolButtonView extends button_tool_1.ButtonToolButtonView {\n", " _clicked() {\n", " this.model.do.emit();\n", " }\n", " }\n", " exports.ActionToolButtonView = ActionToolButtonView;\n", " ActionToolButtonView.__name__ = \"ActionToolButtonView\";\n", " class ActionToolView extends button_tool_1.ButtonToolView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.do, () => this.doit());\n", " }\n", " }\n", " exports.ActionToolView = ActionToolView;\n", " ActionToolView.__name__ = \"ActionToolView\";\n", " class ActionTool extends button_tool_1.ButtonTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.button_view = ActionToolButtonView;\n", " this.do = new signaling_1.Signal0(this, \"do\");\n", " }\n", " }\n", " exports.ActionTool = ActionTool;\n", " ActionTool.__name__ = \"ActionTool\";\n", " },\n", " /* models/tools/actions/help_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const action_tool_1 = require(285) /* ./action_tool */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class HelpToolView extends action_tool_1.ActionToolView {\n", " doit() {\n", " window.open(this.model.redirect);\n", " }\n", " }\n", " exports.HelpToolView = HelpToolView;\n", " HelpToolView.__name__ = \"HelpToolView\";\n", " class HelpTool extends action_tool_1.ActionTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Help\";\n", " this.icon = icons_1.bk_tool_icon_help;\n", " }\n", " static init_HelpTool() {\n", " this.prototype.default_view = HelpToolView;\n", " this.define({\n", " help_tooltip: [p.String, 'Click the question mark to learn more about Bokeh plot tools.'],\n", " redirect: [p.String, 'https://docs.bokeh.org/en/latest/docs/user_guide/tools.html'],\n", " });\n", " this.register_alias(\"help\", () => new HelpTool());\n", " }\n", " get tooltip() {\n", " return this.help_tooltip;\n", " }\n", " }\n", " exports.HelpTool = HelpTool;\n", " HelpTool.__name__ = \"HelpTool\";\n", " HelpTool.init_HelpTool();\n", " },\n", " /* styles/icons.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.bk_tool_icon_box_select = \"bk-tool-icon-box-select\";\n", " exports.bk_tool_icon_box_zoom = \"bk-tool-icon-box-zoom\";\n", " exports.bk_tool_icon_zoom_in = \"bk-tool-icon-zoom-in\";\n", " exports.bk_tool_icon_zoom_out = \"bk-tool-icon-zoom-out\";\n", " exports.bk_tool_icon_help = \"bk-tool-icon-help\";\n", " exports.bk_tool_icon_hover = \"bk-tool-icon-hover\";\n", " exports.bk_tool_icon_crosshair = \"bk-tool-icon-crosshair\";\n", " exports.bk_tool_icon_lasso_select = \"bk-tool-icon-lasso-select\";\n", " exports.bk_tool_icon_pan = \"bk-tool-icon-pan\";\n", " exports.bk_tool_icon_xpan = \"bk-tool-icon-xpan\";\n", " exports.bk_tool_icon_ypan = \"bk-tool-icon-ypan\";\n", " exports.bk_tool_icon_range = \"bk-tool-icon-range\";\n", " exports.bk_tool_icon_polygon_select = \"bk-tool-icon-polygon-select\";\n", " exports.bk_tool_icon_redo = \"bk-tool-icon-redo\";\n", " exports.bk_tool_icon_reset = \"bk-tool-icon-reset\";\n", " exports.bk_tool_icon_save = \"bk-tool-icon-save\";\n", " exports.bk_tool_icon_tap_select = \"bk-tool-icon-tap-select\";\n", " exports.bk_tool_icon_undo = \"bk-tool-icon-undo\";\n", " exports.bk_tool_icon_wheel_pan = \"bk-tool-icon-wheel-pan\";\n", " exports.bk_tool_icon_wheel_zoom = \"bk-tool-icon-wheel-zoom\";\n", " exports.bk_tool_icon_box_edit = \"bk-tool-icon-box-edit\";\n", " exports.bk_tool_icon_freehand_draw = \"bk-tool-icon-freehand-draw\";\n", " exports.bk_tool_icon_poly_draw = \"bk-tool-icon-poly-draw\";\n", " exports.bk_tool_icon_point_draw = \"bk-tool-icon-point-draw\";\n", " exports.bk_tool_icon_poly_edit = \"bk-tool-icon-poly-edit\";\n", " exports.bk_tool_icon_line_edit = \"bk-tool-icon-line-edit\";\n", " },\n", " /* styles/logo.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.bk_logo = \"bk-logo\";\n", " exports.bk_logo_notebook = \"bk-logo-notebook\";\n", " exports.bk_logo_small = \"bk-logo-small\";\n", " exports.bk_grey = \"bk-grey\";\n", " },\n", " /* styles/logo.css.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const css = `\n", " .bk-root .bk-logo {\n", " margin: 5px;\n", " position: relative;\n", " display: block;\n", " background-repeat: no-repeat;\n", " }\n", " .bk-root .bk-logo.bk-grey {\n", " filter: url(\"data:image/svg+xml;utf8,#grayscale\");\n", " /* Firefox 10+, Firefox on Android */\n", " filter: gray;\n", " /* IE6-9 */\n", " -webkit-filter: grayscale(100%);\n", " /* Chrome 19+, Safari 6+, Safari 6+ iOS */\n", " }\n", " .bk-root .bk-logo-small {\n", " width: 20px;\n", " height: 20px;\n", " background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNui8sowAAAOkSURBVDiNjZRtaJVlGMd/1/08zzln5zjP1LWcU9N0NkN8m2CYjpgQYQXqSs0I84OLIC0hkEKoPtiH3gmKoiJDU7QpLgoLjLIQCpEsNJ1vqUOdO7ppbuec5+V+rj4ctwzd8IIbbi6u+8f1539dt3A78eXC7QizUF7gyV1fD1Yqg4JWz84yffhm0qkFqBogB9rM8tZdtwVsPUhWhGcFJngGeWrPzHm5oaMmkfEg1usvLFyc8jLRqDOMru7AyC8saQr7GG7f5fvDeH7Ej8CM66nIF+8yngt6HWaKh7k49Soy9nXurCi1o3qUbS3zWfrYeQDTB/Qj6kX6Ybhw4B+bOYoLKCC9H3Nu/leUTZ1JdRWkkn2ldcCamzrcf47KKXdAJllSlxAOkRgyHsGC/zRday5Qld9DyoM4/q/rUoy/CXh3jzOu3bHUVZeU+DEn8FInkPBFlu3+nW3Nw0mk6vCDiWg8CeJaxEwuHS3+z5RgY+YBR6V1Z1nxSOfoaPa4LASWxxdNp+VWTk7+4vzaou8v8PN+xo+KY2xsw6une2frhw05CTYOmQvsEhjhWjn0bmXPjpE1+kplmmkP3suftwTubK9Vq22qKmrBhpY4jvd5afdRA3wGjFAgcnTK2s4hY0/GPNIb0nErGMCRxWOOX64Z8RAC4oCXdklmEvcL8o0BfkNK4lUg9HTl+oPlQxdNo3Mg4Nv175e/1LDGzZen30MEjRUtmXSfiTVu1kK8W4txyV6BMKlbgk3lMwYCiusNy9fVfvvwMxv8Ynl6vxoByANLTWplvuj/nF9m2+PDtt1eiHPBr1oIfhCChQMBw6Aw0UulqTKZdfVvfG7VcfIqLG9bcldL/+pdWTLxLUy8Qq38heUIjh4XlzZxzQm19lLFlr8vdQ97rjZVOLf8nclzckbcD4wxXMidpX30sFd37Fv/GtwwhzhxGVAprjbg0gCAEeIgwCZyTV2Z1REEW8O4py0wsjeloKoMr6iCY6dP92H6Vw/oTyICIthibxjm/DfN9lVz8IqtqKYLUXfoKVMVQVVJOElGjrnnUt9T9wbgp8AyYKaGlqingHZU/uG2NTZSVqwHQTWkx9hxjkpWDaCg6Ckj5qebgBVbT3V3NNXMSiWSDdGV3hrtzla7J+duwPOToIg42ChPQOQjspnSlp1V+Gjdged7+8UN5CRAV7a5EdFNwCjEaBR27b3W890TE7g24NAP/mMDXRWrGoFPQI9ls/MWO2dWFAar/xcOIImbbpA3zgAAAABJRU5ErkJggg==);\n", " }\n", " .bk-root .bk-logo-notebook {\n", " display: inline-block;\n", " vertical-align: middle;\n", " margin-right: 5px;\n", " }\n", " `;\n", " exports.default = css;\n", " },\n", " /* models/plots/plot_canvas.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var __rest = (this && this.__rest) || function (s, e) {\n", " var t = {};\n", " for (var p in s)\n", " if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n", " t[p] = s[p];\n", " if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n", " for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n", " if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n", " t[p[i]] = s[p[i]];\n", " }\n", " return t;\n", " };\n", " const cartesian_frame_1 = require(184) /* ../canvas/cartesian_frame */;\n", " const canvas_1 = require(181) /* ../canvas/canvas */;\n", " const data_range1d_1 = require(186) /* ../ranges/data_range1d */;\n", " const glyph_renderer_1 = require(81) /* ../renderers/glyph_renderer */;\n", " const layout_dom_1 = require(245) /* ../layouts/layout_dom */;\n", " const title_1 = require(142) /* ../annotations/title */;\n", " const axis_1 = require(150) /* ../axes/axis */;\n", " const toolbar_panel_1 = require(143) /* ../annotations/toolbar_panel */;\n", " const bokeh_events_1 = require(291) /* ../../core/bokeh_events */;\n", " const signaling_1 = require(14) /* ../../core/signaling */;\n", " const build_views_1 = require(99) /* ../../core/build_views */;\n", " const ui_events_1 = require(292) /* ../../core/ui_events */;\n", " const visuals_1 = require(70) /* ../../core/visuals */;\n", " const logging_1 = require(72) /* ../../core/logging */;\n", " const throttle_1 = require(294) /* ../../core/util/throttle */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const object_1 = require(17) /* ../../core/util/object */;\n", " const layout_1 = require(188) /* ../../core/layout */;\n", " const alignments_1 = require(191) /* ../../core/layout/alignments */;\n", " const side_panel_1 = require(295) /* ../../core/layout/side_panel */;\n", " const grid_1 = require(192) /* ../../core/layout/grid */;\n", " const bbox_1 = require(88) /* ../../core/util/bbox */;\n", " class PlotLayout extends layout_1.Layoutable {\n", " constructor() {\n", " super(...arguments);\n", " this.min_border = { left: 0, top: 0, right: 0, bottom: 0 };\n", " }\n", " _measure(viewport) {\n", " viewport = new layout_1.Sizeable(viewport).bounded_to(this.sizing.size);\n", " const left_hint = this.left_panel.measure({ width: 0, height: viewport.height });\n", " const left = Math.max(left_hint.width, this.min_border.left);\n", " const right_hint = this.right_panel.measure({ width: 0, height: viewport.height });\n", " const right = Math.max(right_hint.width, this.min_border.right);\n", " const top_hint = this.top_panel.measure({ width: viewport.width, height: 0 });\n", " const top = Math.max(top_hint.height, this.min_border.top);\n", " const bottom_hint = this.bottom_panel.measure({ width: viewport.width, height: 0 });\n", " const bottom = Math.max(bottom_hint.height, this.min_border.bottom);\n", " const center_viewport = new layout_1.Sizeable(viewport).shrink_by({ left, right, top, bottom });\n", " const center = this.center_panel.measure(center_viewport);\n", " const width = left + center.width + right;\n", " const height = top + center.height + bottom;\n", " const align = (() => {\n", " const { width_policy, height_policy } = this.center_panel.sizing;\n", " return width_policy != \"fixed\" && height_policy != \"fixed\";\n", " })();\n", " return { width, height, inner: { left, right, top, bottom }, align };\n", " }\n", " _set_geometry(outer, inner) {\n", " super._set_geometry(outer, inner);\n", " this.center_panel.set_geometry(inner);\n", " const left_hint = this.left_panel.measure({ width: 0, height: outer.height });\n", " const right_hint = this.right_panel.measure({ width: 0, height: outer.height });\n", " const top_hint = this.top_panel.measure({ width: outer.width, height: 0 });\n", " const bottom_hint = this.bottom_panel.measure({ width: outer.width, height: 0 });\n", " const { left, top, right, bottom } = inner;\n", " this.top_panel.set_geometry(new bbox_1.BBox({ left, right, bottom: top, height: top_hint.height }));\n", " this.bottom_panel.set_geometry(new bbox_1.BBox({ left, right, top: bottom, height: bottom_hint.height }));\n", " this.left_panel.set_geometry(new bbox_1.BBox({ top, bottom, right: left, width: left_hint.width }));\n", " this.right_panel.set_geometry(new bbox_1.BBox({ top, bottom, left: right, width: right_hint.width }));\n", " }\n", " }\n", " exports.PlotLayout = PlotLayout;\n", " PlotLayout.__name__ = \"PlotLayout\";\n", " class PlotView extends layout_dom_1.LayoutDOMView {\n", " constructor() {\n", " super(...arguments);\n", " this._outer_bbox = new bbox_1.BBox();\n", " this._inner_bbox = new bbox_1.BBox();\n", " this._needs_paint = true;\n", " this._needs_layout = false;\n", " this._invalidated_painters = new Set();\n", " this._invalidate_all = true;\n", " }\n", " get is_paused() {\n", " return this._is_paused != null && this._is_paused !== 0;\n", " }\n", " get child_models() {\n", " return [];\n", " }\n", " pause() {\n", " if (this._is_paused == null)\n", " this._is_paused = 1;\n", " else\n", " this._is_paused += 1;\n", " }\n", " unpause(no_render = false) {\n", " if (this._is_paused == null)\n", " throw new Error(\"wasn't paused\");\n", " this._is_paused -= 1;\n", " if (this._is_paused == 0 && !no_render)\n", " this.request_paint();\n", " }\n", " // TODO: this needs to be removed\n", " request_render() {\n", " this.request_paint();\n", " }\n", " request_paint(to_invalidate) {\n", " if (to_invalidate != null) {\n", " this._invalidated_painters.add(to_invalidate);\n", " }\n", " else {\n", " this._invalidate_all = true;\n", " }\n", " if (!this.is_paused) {\n", " const promise = this.throttled_paint();\n", " this._ready = this._ready.then(() => promise);\n", " }\n", " }\n", " request_layout() {\n", " this._needs_layout = true;\n", " this.request_paint();\n", " }\n", " reset() {\n", " if (this.model.reset_policy == \"standard\") {\n", " this.clear_state();\n", " this.reset_range();\n", " this.reset_selection();\n", " }\n", " this.model.trigger_event(new bokeh_events_1.Reset());\n", " }\n", " remove() {\n", " this.ui_event_bus.destroy();\n", " build_views_1.remove_views(this.renderer_views);\n", " build_views_1.remove_views(this.tool_views);\n", " this.canvas_view.remove();\n", " super.remove();\n", " }\n", " render() {\n", " super.render();\n", " this.el.appendChild(this.canvas_view.el);\n", " this.canvas_view.render();\n", " }\n", " initialize() {\n", " this.pause();\n", " super.initialize();\n", " this.state_changed = new signaling_1.Signal0(this, \"state_changed\");\n", " this.lod_started = false;\n", " this.visuals = new visuals_1.Visuals(this.model); // XXX\n", " this._initial_state_info = {\n", " selection: new Map(),\n", " dimensions: { width: 0, height: 0 },\n", " };\n", " this.visibility_callbacks = [];\n", " this.state = { history: [], index: -1 };\n", " const { hidpi, output_backend } = this.model;\n", " this.canvas = new canvas_1.Canvas({ hidpi, output_backend });\n", " this.frame = new cartesian_frame_1.CartesianFrame(this.model.x_scale, this.model.y_scale, this.model.x_range, this.model.y_range, this.model.extra_x_ranges, this.model.extra_y_ranges);\n", " this.throttled_paint = throttle_1.throttle(() => this.repaint(), 1000 / 60);\n", " const { title_location, title } = this.model;\n", " if (title_location != null && title != null) {\n", " this._title = title instanceof title_1.Title ? title : new title_1.Title({ text: title });\n", " }\n", " const { toolbar_location, toolbar } = this.model;\n", " if (toolbar_location != null && toolbar != null) {\n", " this._toolbar = new toolbar_panel_1.ToolbarPanel({ toolbar });\n", " toolbar.toolbar_location = toolbar_location;\n", " }\n", " this.renderer_views = new Map();\n", " this.tool_views = new Map();\n", " }\n", " async lazy_initialize() {\n", " this.canvas_view = await build_views_1.build_view(this.canvas, { parent: this });\n", " this.ui_event_bus = new ui_events_1.UIEvents(this, this.model.toolbar, this.canvas_view.events_el);\n", " await this.build_renderer_views();\n", " await this.build_tool_views();\n", " this.update_dataranges();\n", " this.unpause(true);\n", " logging_1.logger.debug(\"PlotView initialized\");\n", " }\n", " _width_policy() {\n", " return this.model.frame_width == null ? super._width_policy() : \"min\";\n", " }\n", " _height_policy() {\n", " return this.model.frame_height == null ? super._height_policy() : \"min\";\n", " }\n", " _update_layout() {\n", " this.layout = new PlotLayout();\n", " this.layout.set_sizing(this.box_sizing());\n", " const { frame_width, frame_height } = this.model;\n", " this.layout.center_panel = this.frame;\n", " this.layout.center_panel.set_sizing(Object.assign(Object.assign({}, (frame_width != null ? { width_policy: \"fixed\", width: frame_width } : { width_policy: \"fit\" })), (frame_height != null ? { height_policy: \"fixed\", height: frame_height } : { height_policy: \"fit\" })));\n", " const above = array_1.copy(this.model.above);\n", " const below = array_1.copy(this.model.below);\n", " const left = array_1.copy(this.model.left);\n", " const right = array_1.copy(this.model.right);\n", " const get_side = (side) => {\n", " switch (side) {\n", " case \"above\": return above;\n", " case \"below\": return below;\n", " case \"left\": return left;\n", " case \"right\": return right;\n", " }\n", " };\n", " const { title_location, title } = this.model;\n", " if (title_location != null && title != null) {\n", " get_side(title_location).push(this._title);\n", " }\n", " const { toolbar_location, toolbar } = this.model;\n", " if (toolbar_location != null && toolbar != null) {\n", " const panels = get_side(toolbar_location);\n", " let push_toolbar = true;\n", " if (this.model.toolbar_sticky) {\n", " for (let i = 0; i < panels.length; i++) {\n", " const panel = panels[i];\n", " if (panel instanceof title_1.Title) {\n", " if (toolbar_location == \"above\" || toolbar_location == \"below\")\n", " panels[i] = [panel, this._toolbar];\n", " else\n", " panels[i] = [this._toolbar, panel];\n", " push_toolbar = false;\n", " break;\n", " }\n", " }\n", " }\n", " if (push_toolbar)\n", " panels.push(this._toolbar);\n", " }\n", " const set_layout = (side, model) => {\n", " const view = this.renderer_views.get(model);\n", " return view.layout = new side_panel_1.SidePanel(side, view);\n", " };\n", " const set_layouts = (side, panels) => {\n", " const horizontal = side == \"above\" || side == \"below\";\n", " const layouts = [];\n", " for (const panel of panels) {\n", " if (types_1.isArray(panel)) {\n", " const items = panel.map((subpanel) => {\n", " const item = set_layout(side, subpanel);\n", " if (subpanel instanceof toolbar_panel_1.ToolbarPanel) {\n", " const dim = horizontal ? \"width_policy\" : \"height_policy\";\n", " item.set_sizing(Object.assign(Object.assign({}, item.sizing), { [dim]: \"min\" }));\n", " }\n", " return item;\n", " });\n", " let layout;\n", " if (horizontal) {\n", " layout = new grid_1.Row(items);\n", " layout.set_sizing({ width_policy: \"max\", height_policy: \"min\" });\n", " }\n", " else {\n", " layout = new grid_1.Column(items);\n", " layout.set_sizing({ width_policy: \"min\", height_policy: \"max\" });\n", " }\n", " layout.absolute = true;\n", " layouts.push(layout);\n", " }\n", " else\n", " layouts.push(set_layout(side, panel));\n", " }\n", " return layouts;\n", " };\n", " const min_border = this.model.min_border != null ? this.model.min_border : 0;\n", " this.layout.min_border = {\n", " left: this.model.min_border_left != null ? this.model.min_border_left : min_border,\n", " top: this.model.min_border_top != null ? this.model.min_border_top : min_border,\n", " right: this.model.min_border_right != null ? this.model.min_border_right : min_border,\n", " bottom: this.model.min_border_bottom != null ? this.model.min_border_bottom : min_border,\n", " };\n", " const top_panel = new alignments_1.VStack();\n", " const bottom_panel = new alignments_1.VStack();\n", " const left_panel = new alignments_1.HStack();\n", " const right_panel = new alignments_1.HStack();\n", " top_panel.children = array_1.reversed(set_layouts(\"above\", above));\n", " bottom_panel.children = set_layouts(\"below\", below);\n", " left_panel.children = array_1.reversed(set_layouts(\"left\", left));\n", " right_panel.children = set_layouts(\"right\", right);\n", " top_panel.set_sizing({ width_policy: \"fit\", height_policy: \"min\" /*, min_height: this.layout.min_border.top*/ });\n", " bottom_panel.set_sizing({ width_policy: \"fit\", height_policy: \"min\" /*, min_height: this.layout.min_width.bottom*/ });\n", " left_panel.set_sizing({ width_policy: \"min\", height_policy: \"fit\" /*, min_width: this.layout.min_width.left*/ });\n", " right_panel.set_sizing({ width_policy: \"min\", height_policy: \"fit\" /*, min_width: this.layout.min_width.right*/ });\n", " this.layout.top_panel = top_panel;\n", " this.layout.bottom_panel = bottom_panel;\n", " this.layout.left_panel = left_panel;\n", " this.layout.right_panel = right_panel;\n", " }\n", " get axis_views() {\n", " const views = [];\n", " for (const [, renderer_view] of this.renderer_views) {\n", " if (renderer_view instanceof axis_1.AxisView)\n", " views.push(renderer_view);\n", " }\n", " return views;\n", " }\n", " set_cursor(cursor = \"default\") {\n", " this.canvas_view.el.style.cursor = cursor;\n", " }\n", " set_toolbar_visibility(visible) {\n", " for (const callback of this.visibility_callbacks)\n", " callback(visible);\n", " }\n", " update_dataranges() {\n", " // Update any DataRange1ds here\n", " const bounds = new Map();\n", " const log_bounds = new Map();\n", " let calculate_log_bounds = false;\n", " for (const r of object_1.values(this.frame.x_ranges).concat(object_1.values(this.frame.y_ranges))) {\n", " if (r instanceof data_range1d_1.DataRange1d) {\n", " if (r.scale_hint == \"log\")\n", " calculate_log_bounds = true;\n", " }\n", " }\n", " for (const [renderer, renderer_view] of this.renderer_views) {\n", " if (renderer_view instanceof glyph_renderer_1.GlyphRendererView) {\n", " const bds = renderer_view.glyph.bounds();\n", " if (bds != null)\n", " bounds.set(renderer, bds);\n", " if (calculate_log_bounds) {\n", " const log_bds = renderer_view.glyph.log_bounds();\n", " if (log_bds != null)\n", " log_bounds.set(renderer, log_bds);\n", " }\n", " }\n", " }\n", " let follow_enabled = false;\n", " let has_bounds = false;\n", " const { width, height } = this.frame.bbox;\n", " let r;\n", " if (this.model.match_aspect !== false && width != 0 && height != 0)\n", " r = (1 / this.model.aspect_scale) * (width / height);\n", " for (const xr of object_1.values(this.frame.x_ranges)) {\n", " if (xr instanceof data_range1d_1.DataRange1d) {\n", " const bounds_to_use = xr.scale_hint == \"log\" ? log_bounds : bounds;\n", " xr.update(bounds_to_use, 0, this.model, r);\n", " if (xr.follow) {\n", " follow_enabled = true;\n", " }\n", " }\n", " if (xr.bounds != null)\n", " has_bounds = true;\n", " }\n", " for (const yr of object_1.values(this.frame.y_ranges)) {\n", " if (yr instanceof data_range1d_1.DataRange1d) {\n", " const bounds_to_use = yr.scale_hint == \"log\" ? log_bounds : bounds;\n", " yr.update(bounds_to_use, 1, this.model, r);\n", " if (yr.follow) {\n", " follow_enabled = true;\n", " }\n", " }\n", " if (yr.bounds != null)\n", " has_bounds = true;\n", " }\n", " if (follow_enabled && has_bounds) {\n", " logging_1.logger.warn('Follow enabled so bounds are unset.');\n", " for (const xr of object_1.values(this.frame.x_ranges)) {\n", " xr.bounds = null;\n", " }\n", " for (const yr of object_1.values(this.frame.y_ranges)) {\n", " yr.bounds = null;\n", " }\n", " }\n", " this.range_update_timestamp = Date.now();\n", " }\n", " map_to_screen(x, y, x_name = \"default\", y_name = \"default\") {\n", " return this.frame.map_to_screen(x, y, x_name, y_name);\n", " }\n", " push_state(type, new_info) {\n", " const { history, index } = this.state;\n", " const prev_info = history[index] != null ? history[index].info : {};\n", " const info = Object.assign(Object.assign(Object.assign({}, this._initial_state_info), prev_info), new_info);\n", " this.state.history = this.state.history.slice(0, this.state.index + 1);\n", " this.state.history.push({ type, info });\n", " this.state.index = this.state.history.length - 1;\n", " this.state_changed.emit();\n", " }\n", " clear_state() {\n", " this.state = { history: [], index: -1 };\n", " this.state_changed.emit();\n", " }\n", " can_undo() {\n", " return this.state.index >= 0;\n", " }\n", " can_redo() {\n", " return this.state.index < this.state.history.length - 1;\n", " }\n", " undo() {\n", " if (this.can_undo()) {\n", " this.state.index -= 1;\n", " this._do_state_change(this.state.index);\n", " this.state_changed.emit();\n", " }\n", " }\n", " redo() {\n", " if (this.can_redo()) {\n", " this.state.index += 1;\n", " this._do_state_change(this.state.index);\n", " this.state_changed.emit();\n", " }\n", " }\n", " _do_state_change(index) {\n", " const info = this.state.history[index] != null ? this.state.history[index].info : this._initial_state_info;\n", " if (info.range != null)\n", " this.update_range(info.range);\n", " if (info.selection != null)\n", " this.update_selection(info.selection);\n", " }\n", " get_selection() {\n", " const selection = new Map();\n", " for (const renderer of this.model.renderers) {\n", " if (renderer instanceof glyph_renderer_1.GlyphRenderer) {\n", " const { selected } = renderer.data_source;\n", " selection.set(renderer, selected);\n", " }\n", " }\n", " return selection;\n", " }\n", " update_selection(selections) {\n", " for (const renderer of this.model.renderers) {\n", " if (!(renderer instanceof glyph_renderer_1.GlyphRenderer))\n", " continue;\n", " const ds = renderer.data_source;\n", " if (selections != null) {\n", " const selection = selections.get(renderer);\n", " if (selection != null) {\n", " ds.selected.update(selection, true);\n", " }\n", " }\n", " else\n", " ds.selection_manager.clear();\n", " }\n", " }\n", " reset_selection() {\n", " this.update_selection(null);\n", " }\n", " _update_ranges_together(range_info_iter) {\n", " // Get weight needed to scale the diff of the range to honor interval limits\n", " let weight = 1.0;\n", " for (const [rng, range_info] of range_info_iter) {\n", " weight = Math.min(weight, this._get_weight_to_constrain_interval(rng, range_info));\n", " }\n", " // Apply shared weight to all ranges\n", " if (weight < 1) {\n", " for (const [rng, range_info] of range_info_iter) {\n", " range_info.start = weight * range_info.start + (1 - weight) * rng.start;\n", " range_info.end = weight * range_info.end + (1 - weight) * rng.end;\n", " }\n", " }\n", " }\n", " _update_ranges_individually(range_info_iter, is_panning, is_scrolling, maintain_focus) {\n", " let hit_bound = false;\n", " for (const [rng, range_info] of range_info_iter) {\n", " // Limit range interval first. Note that for scroll events,\n", " // the interval has already been limited for all ranges simultaneously\n", " if (!is_scrolling) {\n", " const weight = this._get_weight_to_constrain_interval(rng, range_info);\n", " if (weight < 1) {\n", " range_info.start = weight * range_info.start + (1 - weight) * rng.start;\n", " range_info.end = weight * range_info.end + (1 - weight) * rng.end;\n", " }\n", " }\n", " // Prevent range from going outside limits\n", " // Also ensure that range keeps the same delta when panning/scrolling\n", " if (rng.bounds != null && rng.bounds != \"auto\") { // check `auto` for type-checking purpose\n", " const [min, max] = rng.bounds;\n", " const new_interval = Math.abs(range_info.end - range_info.start);\n", " if (rng.is_reversed) {\n", " if (min != null) {\n", " if (min >= range_info.end) {\n", " hit_bound = true;\n", " range_info.end = min;\n", " if (is_panning || is_scrolling) {\n", " range_info.start = min + new_interval;\n", " }\n", " }\n", " }\n", " if (max != null) {\n", " if (max <= range_info.start) {\n", " hit_bound = true;\n", " range_info.start = max;\n", " if (is_panning || is_scrolling) {\n", " range_info.end = max - new_interval;\n", " }\n", " }\n", " }\n", " }\n", " else {\n", " if (min != null) {\n", " if (min >= range_info.start) {\n", " hit_bound = true;\n", " range_info.start = min;\n", " if (is_panning || is_scrolling) {\n", " range_info.end = min + new_interval;\n", " }\n", " }\n", " }\n", " if (max != null) {\n", " if (max <= range_info.end) {\n", " hit_bound = true;\n", " range_info.end = max;\n", " if (is_panning || is_scrolling) {\n", " range_info.start = max - new_interval;\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " // Cancel the event when hitting a bound while scrolling. This ensures that\n", " // the scroll-zoom tool maintains its focus position. Setting `maintain_focus`\n", " // to false results in a more \"gliding\" behavior, allowing one to\n", " // zoom out more smoothly, at the cost of losing the focus position.\n", " if (is_scrolling && hit_bound && maintain_focus)\n", " return;\n", " for (const [rng, range_info] of range_info_iter) {\n", " rng.have_updated_interactively = true;\n", " if (rng.start != range_info.start || rng.end != range_info.end)\n", " rng.setv(range_info);\n", " }\n", " }\n", " _get_weight_to_constrain_interval(rng, range_info) {\n", " // Get the weight by which a range-update can be applied\n", " // to still honor the interval limits (including the implicit\n", " // max interval imposed by the bounds)\n", " const { min_interval } = rng;\n", " let { max_interval } = rng;\n", " // Express bounds as a max_interval. By doing this, the application of\n", " // bounds and interval limits can be applied independent from each-other.\n", " if (rng.bounds != null && rng.bounds != \"auto\") { // check `auto` for type-checking purpose\n", " const [min, max] = rng.bounds;\n", " if (min != null && max != null) {\n", " const max_interval2 = Math.abs(max - min);\n", " max_interval = max_interval != null ? Math.min(max_interval, max_interval2) : max_interval2;\n", " }\n", " }\n", " let weight = 1.0;\n", " if (min_interval != null || max_interval != null) {\n", " const old_interval = Math.abs(rng.end - rng.start);\n", " const new_interval = Math.abs(range_info.end - range_info.start);\n", " if (min_interval > 0 && new_interval < min_interval) {\n", " weight = (old_interval - min_interval) / (old_interval - new_interval);\n", " }\n", " if (max_interval > 0 && new_interval > max_interval) {\n", " weight = (max_interval - old_interval) / (new_interval - old_interval);\n", " }\n", " weight = Math.max(0.0, Math.min(1.0, weight));\n", " }\n", " return weight;\n", " }\n", " update_range(range_info, is_panning = false, is_scrolling = false, maintain_focus = true) {\n", " this.pause();\n", " const { x_ranges, y_ranges } = this.frame;\n", " if (range_info == null) {\n", " for (const name in x_ranges) {\n", " const rng = x_ranges[name];\n", " rng.reset();\n", " }\n", " for (const name in y_ranges) {\n", " const rng = y_ranges[name];\n", " rng.reset();\n", " }\n", " this.update_dataranges();\n", " }\n", " else {\n", " const range_info_iter = [];\n", " for (const name in x_ranges) {\n", " const rng = x_ranges[name];\n", " range_info_iter.push([rng, range_info.xrs[name]]);\n", " }\n", " for (const name in y_ranges) {\n", " const rng = y_ranges[name];\n", " range_info_iter.push([rng, range_info.yrs[name]]);\n", " }\n", " if (is_scrolling) {\n", " this._update_ranges_together(range_info_iter); // apply interval bounds while keeping aspect\n", " }\n", " this._update_ranges_individually(range_info_iter, is_panning, is_scrolling, maintain_focus);\n", " }\n", " this.unpause();\n", " }\n", " reset_range() {\n", " this.update_range(null);\n", " }\n", " _invalidate_layout() {\n", " const needs_layout = () => {\n", " for (const panel of this.model.side_panels) {\n", " const view = this.renderer_views.get(panel);\n", " if (view.layout.has_size_changed())\n", " return true;\n", " }\n", " return false;\n", " };\n", " if (needs_layout())\n", " this.root.compute_layout();\n", " }\n", " get_renderer_views() {\n", " return this.computed_renderers.map((r) => this.renderer_views.get(r));\n", " }\n", " async build_renderer_views() {\n", " this.computed_renderers = [];\n", " const { above, below, left, right, center, renderers } = this.model;\n", " this.computed_renderers.push(...above, ...below, ...left, ...right, ...center, ...renderers);\n", " if (this._title != null)\n", " this.computed_renderers.push(this._title);\n", " if (this._toolbar != null)\n", " this.computed_renderers.push(this._toolbar);\n", " for (const tool of this.model.toolbar.tools) {\n", " if (tool.overlay != null)\n", " this.computed_renderers.push(tool.overlay);\n", " this.computed_renderers.push(...tool.synthetic_renderers);\n", " }\n", " await build_views_1.build_views(this.renderer_views, this.computed_renderers, { parent: this });\n", " }\n", " async build_tool_views() {\n", " const tool_models = this.model.toolbar.tools;\n", " const new_tool_views = await build_views_1.build_views(this.tool_views, tool_models, { parent: this });\n", " new_tool_views.map((tool_view) => this.ui_event_bus.register_tool(tool_view));\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " const { x_ranges, y_ranges } = this.frame;\n", " for (const name in x_ranges) {\n", " const rng = x_ranges[name];\n", " this.connect(rng.change, () => { this._needs_layout = true; this.request_paint(); });\n", " }\n", " for (const name in y_ranges) {\n", " const rng = y_ranges[name];\n", " this.connect(rng.change, () => { this._needs_layout = true; this.request_paint(); });\n", " }\n", " const { plot_width, plot_height } = this.model.properties;\n", " this.on_change([plot_width, plot_height], () => this.invalidate_layout());\n", " const { above, below, left, right, center, renderers } = this.model.properties;\n", " this.on_change([above, below, left, right, center, renderers], async () => await this.build_renderer_views());\n", " this.connect(this.model.toolbar.properties.tools.change, async () => {\n", " await this.build_renderer_views();\n", " await this.build_tool_views();\n", " });\n", " this.connect(this.model.change, () => this.request_paint());\n", " this.connect(this.model.reset, () => this.reset());\n", " }\n", " set_initial_range() {\n", " // check for good values for ranges before setting initial range\n", " let good_vals = true;\n", " const { x_ranges, y_ranges } = this.frame;\n", " const xrs = {};\n", " const yrs = {};\n", " for (const name in x_ranges) {\n", " const { start, end } = x_ranges[name];\n", " if (start == null || end == null || isNaN(start + end)) {\n", " good_vals = false;\n", " break;\n", " }\n", " xrs[name] = { start, end };\n", " }\n", " if (good_vals) {\n", " for (const name in y_ranges) {\n", " const { start, end } = y_ranges[name];\n", " if (start == null || end == null || isNaN(start + end)) {\n", " good_vals = false;\n", " break;\n", " }\n", " yrs[name] = { start, end };\n", " }\n", " }\n", " if (good_vals) {\n", " this._initial_state_info.range = { xrs, yrs };\n", " logging_1.logger.debug(\"initial ranges set\");\n", " }\n", " else\n", " logging_1.logger.warn('could not set initial ranges');\n", " }\n", " has_finished() {\n", " if (!super.has_finished())\n", " return false;\n", " for (const [, renderer_view] of this.renderer_views) {\n", " if (!renderer_view.has_finished())\n", " return false;\n", " }\n", " return true;\n", " }\n", " after_layout() {\n", " super.after_layout();\n", " this._needs_layout = false;\n", " this.model.setv({\n", " inner_width: Math.round(this.frame._width.value),\n", " inner_height: Math.round(this.frame._height.value),\n", " outer_width: Math.round(this.layout._width.value),\n", " outer_height: Math.round(this.layout._height.value),\n", " }, { no_change: true });\n", " if (this.model.match_aspect !== false) {\n", " this.pause();\n", " this.update_dataranges();\n", " this.unpause(true);\n", " }\n", " if (!this._outer_bbox.equals(this.layout.bbox)) {\n", " const { width, height } = this.layout.bbox;\n", " this.canvas_view.resize(width, height);\n", " this._outer_bbox = this.layout.bbox;\n", " this._invalidate_all = true;\n", " this._needs_paint = true;\n", " }\n", " if (!this._inner_bbox.equals(this.frame.inner_bbox)) {\n", " this._inner_bbox = this.layout.inner_bbox;\n", " this._needs_paint = true;\n", " }\n", " if (this._needs_paint) {\n", " // XXX: can't be this.request_paint(), because it would trigger back-and-forth\n", " // layout recomputing feedback loop between plots. Plots are also much more\n", " // responsive this way, especially in interactive mode.\n", " this._needs_paint = false;\n", " this.paint();\n", " }\n", " }\n", " repaint() {\n", " if (this._needs_layout)\n", " this._invalidate_layout();\n", " this.paint();\n", " }\n", " paint() {\n", " if (this.is_paused)\n", " return;\n", " logging_1.logger.trace(`PlotView.paint() for ${this.model.id}`);\n", " const { document } = this.model;\n", " if (document != null) {\n", " const interactive_duration = document.interactive_duration();\n", " if (interactive_duration >= 0 && interactive_duration < this.model.lod_interval) {\n", " setTimeout(() => {\n", " if (document.interactive_duration() > this.model.lod_timeout) {\n", " document.interactive_stop(this.model);\n", " }\n", " this.request_paint();\n", " }, this.model.lod_timeout);\n", " }\n", " else\n", " document.interactive_stop(this.model);\n", " }\n", " for (const [, renderer_view] of this.renderer_views) {\n", " if (this.range_update_timestamp == null ||\n", " (renderer_view instanceof glyph_renderer_1.GlyphRendererView && renderer_view.set_data_timestamp > this.range_update_timestamp)) {\n", " this.update_dataranges();\n", " break;\n", " }\n", " }\n", " let do_primary = false;\n", " let do_overlays = false;\n", " if (this._invalidate_all) {\n", " do_primary = true;\n", " do_overlays = true;\n", " }\n", " else {\n", " for (const painter of this._invalidated_painters) {\n", " const { level } = painter.model;\n", " if (level != \"overlay\")\n", " do_primary = true;\n", " else\n", " do_overlays = true;\n", " if (do_primary && do_overlays)\n", " break;\n", " }\n", " }\n", " this._invalidated_painters.clear();\n", " this._invalidate_all = false;\n", " const frame_box = [\n", " this.frame._left.value,\n", " this.frame._top.value,\n", " this.frame._width.value,\n", " this.frame._height.value,\n", " ];\n", " const { primary, overlays } = this.canvas_view;\n", " if (do_primary) {\n", " primary.prepare();\n", " this.canvas_view.prepare_webgl(frame_box);\n", " this.canvas_view.clear_webgl();\n", " this._map_hook(primary.ctx, frame_box);\n", " this._paint_empty(primary.ctx, frame_box);\n", " this._paint_outline(primary.ctx, frame_box);\n", " this._paint_levels(primary.ctx, \"image\", frame_box, true);\n", " this._paint_levels(primary.ctx, \"underlay\", frame_box, true);\n", " this._paint_levels(primary.ctx, \"glyph\", frame_box, true);\n", " this._paint_levels(primary.ctx, \"guide\", frame_box, false);\n", " this._paint_levels(primary.ctx, \"annotation\", frame_box, false);\n", " primary.finish();\n", " }\n", " if (do_overlays) {\n", " overlays.prepare();\n", " this._paint_levels(overlays.ctx, \"overlay\", frame_box, false);\n", " overlays.finish();\n", " }\n", " if (this._initial_state_info.range == null)\n", " this.set_initial_range();\n", " }\n", " _paint_levels(ctx, level, clip_region, global_clip) {\n", " for (const renderer of this.computed_renderers) {\n", " if (renderer.level != level)\n", " continue;\n", " const renderer_view = this.renderer_views.get(renderer);\n", " ctx.save();\n", " if (global_clip || renderer_view.needs_clip) {\n", " ctx.beginPath();\n", " ctx.rect(...clip_region);\n", " ctx.clip();\n", " }\n", " renderer_view.render();\n", " ctx.restore();\n", " if (renderer_view.has_webgl) {\n", " this.canvas_view.blit_webgl(ctx);\n", " this.canvas_view.clear_webgl();\n", " }\n", " }\n", " }\n", " _map_hook(_ctx, _frame_box) { }\n", " _paint_empty(ctx, frame_box) {\n", " const [cx, cy, cw, ch] = [0, 0, this.layout._width.value, this.layout._height.value];\n", " const [fx, fy, fw, fh] = frame_box;\n", " if (this.visuals.border_fill.doit) {\n", " this.visuals.border_fill.set_value(ctx);\n", " ctx.fillRect(cx, cy, cw, ch);\n", " ctx.clearRect(fx, fy, fw, fh);\n", " }\n", " if (this.visuals.background_fill.doit) {\n", " this.visuals.background_fill.set_value(ctx);\n", " ctx.fillRect(fx, fy, fw, fh);\n", " }\n", " }\n", " _paint_outline(ctx, frame_box) {\n", " if (this.visuals.outline_line.doit) {\n", " ctx.save();\n", " this.visuals.outline_line.set_value(ctx);\n", " let [x0, y0, w, h] = frame_box;\n", " // XXX: shrink outline region by 1px to make right and bottom lines visible\n", " // if they are on the edge of the canvas.\n", " if (x0 + w == this.layout._width.value) {\n", " w -= 1;\n", " }\n", " if (y0 + h == this.layout._height.value) {\n", " h -= 1;\n", " }\n", " ctx.strokeRect(x0, y0, w, h);\n", " ctx.restore();\n", " }\n", " }\n", " save(name) {\n", " this.canvas_view.save(name);\n", " }\n", " serializable_state() {\n", " const _a = super.serializable_state(), { children } = _a, state = __rest(_a, [\"children\"]);\n", " const renderers = this.get_renderer_views()\n", " .map((view) => view.serializable_state())\n", " .filter((item) => \"bbox\" in item);\n", " return Object.assign(Object.assign({}, state), { children: [...children, ...renderers] }); // XXX\n", " }\n", " }\n", " exports.PlotView = PlotView;\n", " PlotView.__name__ = \"PlotView\";\n", " },\n", " /* core/bokeh_events.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n", " var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n", " if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\")\n", " r = Reflect.decorate(decorators, target, key, desc);\n", " else\n", " for (var i = decorators.length - 1; i >= 0; i--)\n", " if (d = decorators[i])\n", " r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n", " return c > 3 && r && Object.defineProperty(target, key, r), r;\n", " };\n", " function event(event_name) {\n", " return function (cls) {\n", " cls.prototype.event_name = event_name;\n", " };\n", " }\n", " class BokehEvent {\n", " constructor() {\n", " this.origin = null;\n", " }\n", " to_json() {\n", " const { event_name } = this;\n", " return { event_name, event_values: this._to_json() };\n", " }\n", " _to_json() {\n", " return { model: this.origin };\n", " }\n", " }\n", " exports.BokehEvent = BokehEvent;\n", " BokehEvent.__name__ = \"BokehEvent\";\n", " let ButtonClick = class ButtonClick extends BokehEvent {\n", " };\n", " exports.ButtonClick = ButtonClick;\n", " ButtonClick.__name__ = \"ButtonClick\";\n", " exports.ButtonClick = ButtonClick = __decorate([\n", " event(\"button_click\")\n", " ], ButtonClick);\n", " let MenuItemClick = class MenuItemClick extends BokehEvent {\n", " constructor(item) {\n", " super();\n", " this.item = item;\n", " }\n", " _to_json() {\n", " const { item } = this;\n", " return Object.assign(Object.assign({}, super._to_json()), { item });\n", " }\n", " };\n", " exports.MenuItemClick = MenuItemClick;\n", " MenuItemClick.__name__ = \"MenuItemClick\";\n", " exports.MenuItemClick = MenuItemClick = __decorate([\n", " event(\"menu_item_click\")\n", " ], MenuItemClick);\n", " // A UIEvent is an event originating on a canvas this includes.\n", " // DOM events such as keystrokes as well as hammer events and LOD events.\n", " class UIEvent extends BokehEvent {\n", " }\n", " exports.UIEvent = UIEvent;\n", " UIEvent.__name__ = \"UIEvent\";\n", " let LODStart = class LODStart extends UIEvent {\n", " };\n", " exports.LODStart = LODStart;\n", " LODStart.__name__ = \"LODStart\";\n", " exports.LODStart = LODStart = __decorate([\n", " event(\"lodstart\")\n", " ], LODStart);\n", " let LODEnd = class LODEnd extends UIEvent {\n", " };\n", " exports.LODEnd = LODEnd;\n", " LODEnd.__name__ = \"LODEnd\";\n", " exports.LODEnd = LODEnd = __decorate([\n", " event(\"lodend\")\n", " ], LODEnd);\n", " let SelectionGeometry = class SelectionGeometry extends UIEvent {\n", " constructor(geometry, final) {\n", " super();\n", " this.geometry = geometry;\n", " this.final = final;\n", " }\n", " _to_json() {\n", " const { geometry, final } = this;\n", " return Object.assign(Object.assign({}, super._to_json()), { geometry, final });\n", " }\n", " };\n", " exports.SelectionGeometry = SelectionGeometry;\n", " SelectionGeometry.__name__ = \"SelectionGeometry\";\n", " exports.SelectionGeometry = SelectionGeometry = __decorate([\n", " event(\"selectiongeometry\")\n", " ], SelectionGeometry);\n", " let Reset = class Reset extends UIEvent {\n", " };\n", " exports.Reset = Reset;\n", " Reset.__name__ = \"Reset\";\n", " exports.Reset = Reset = __decorate([\n", " event(\"reset\")\n", " ], Reset);\n", " class PointEvent extends UIEvent {\n", " constructor(sx, sy, x, y) {\n", " super();\n", " this.sx = sx;\n", " this.sy = sy;\n", " this.x = x;\n", " this.y = y;\n", " }\n", " _to_json() {\n", " const { sx, sy, x, y } = this;\n", " return Object.assign(Object.assign({}, super._to_json()), { sx, sy, x, y });\n", " }\n", " }\n", " exports.PointEvent = PointEvent;\n", " PointEvent.__name__ = \"PointEvent\";\n", " let Pan = class Pan extends PointEvent {\n", " /* TODO: direction: -1 | 1 */\n", " constructor(sx, sy, x, y, delta_x, delta_y) {\n", " super(sx, sy, x, y);\n", " this.sx = sx;\n", " this.sy = sy;\n", " this.x = x;\n", " this.y = y;\n", " this.delta_x = delta_x;\n", " this.delta_y = delta_y;\n", " }\n", " _to_json() {\n", " const { delta_x, delta_y /*, direction*/ } = this;\n", " return Object.assign(Object.assign({}, super._to_json()), { delta_x, delta_y /*, direction*/ });\n", " }\n", " };\n", " exports.Pan = Pan;\n", " Pan.__name__ = \"Pan\";\n", " exports.Pan = Pan = __decorate([\n", " event(\"pan\")\n", " ], Pan);\n", " let Pinch = class Pinch extends PointEvent {\n", " constructor(sx, sy, x, y, scale) {\n", " super(sx, sy, x, y);\n", " this.sx = sx;\n", " this.sy = sy;\n", " this.x = x;\n", " this.y = y;\n", " this.scale = scale;\n", " }\n", " _to_json() {\n", " const { scale } = this;\n", " return Object.assign(Object.assign({}, super._to_json()), { scale });\n", " }\n", " };\n", " exports.Pinch = Pinch;\n", " Pinch.__name__ = \"Pinch\";\n", " exports.Pinch = Pinch = __decorate([\n", " event(\"pinch\")\n", " ], Pinch);\n", " let Rotate = class Rotate extends PointEvent {\n", " constructor(sx, sy, x, y, rotation) {\n", " super(sx, sy, x, y);\n", " this.sx = sx;\n", " this.sy = sy;\n", " this.x = x;\n", " this.y = y;\n", " this.rotation = rotation;\n", " }\n", " _to_json() {\n", " const { rotation } = this;\n", " return Object.assign(Object.assign({}, super._to_json()), { rotation });\n", " }\n", " };\n", " exports.Rotate = Rotate;\n", " Rotate.__name__ = \"Rotate\";\n", " exports.Rotate = Rotate = __decorate([\n", " event(\"rotate\")\n", " ], Rotate);\n", " let MouseWheel = class MouseWheel extends PointEvent {\n", " constructor(sx, sy, x, y, delta) {\n", " super(sx, sy, x, y);\n", " this.sx = sx;\n", " this.sy = sy;\n", " this.x = x;\n", " this.y = y;\n", " this.delta = delta;\n", " }\n", " _to_json() {\n", " const { delta } = this;\n", " return Object.assign(Object.assign({}, super._to_json()), { delta });\n", " }\n", " };\n", " exports.MouseWheel = MouseWheel;\n", " MouseWheel.__name__ = \"MouseWheel\";\n", " exports.MouseWheel = MouseWheel = __decorate([\n", " event(\"wheel\")\n", " ], MouseWheel);\n", " let MouseMove = class MouseMove extends PointEvent {\n", " };\n", " exports.MouseMove = MouseMove;\n", " MouseMove.__name__ = \"MouseMove\";\n", " exports.MouseMove = MouseMove = __decorate([\n", " event(\"mousemove\")\n", " ], MouseMove);\n", " let MouseEnter = class MouseEnter extends PointEvent {\n", " };\n", " exports.MouseEnter = MouseEnter;\n", " MouseEnter.__name__ = \"MouseEnter\";\n", " exports.MouseEnter = MouseEnter = __decorate([\n", " event(\"mouseenter\")\n", " ], MouseEnter);\n", " let MouseLeave = class MouseLeave extends PointEvent {\n", " };\n", " exports.MouseLeave = MouseLeave;\n", " MouseLeave.__name__ = \"MouseLeave\";\n", " exports.MouseLeave = MouseLeave = __decorate([\n", " event(\"mouseleave\")\n", " ], MouseLeave);\n", " let Tap = class Tap extends PointEvent {\n", " };\n", " exports.Tap = Tap;\n", " Tap.__name__ = \"Tap\";\n", " exports.Tap = Tap = __decorate([\n", " event(\"tap\")\n", " ], Tap);\n", " let DoubleTap = class DoubleTap extends PointEvent {\n", " };\n", " exports.DoubleTap = DoubleTap;\n", " DoubleTap.__name__ = \"DoubleTap\";\n", " exports.DoubleTap = DoubleTap = __decorate([\n", " event(\"doubletap\")\n", " ], DoubleTap);\n", " let Press = class Press extends PointEvent {\n", " };\n", " exports.Press = Press;\n", " Press.__name__ = \"Press\";\n", " exports.Press = Press = __decorate([\n", " event(\"press\")\n", " ], Press);\n", " let PressUp = class PressUp extends PointEvent {\n", " };\n", " exports.PressUp = PressUp;\n", " PressUp.__name__ = \"PressUp\";\n", " exports.PressUp = PressUp = __decorate([\n", " event(\"pressup\")\n", " ], PressUp);\n", " let PanStart = class PanStart extends PointEvent {\n", " };\n", " exports.PanStart = PanStart;\n", " PanStart.__name__ = \"PanStart\";\n", " exports.PanStart = PanStart = __decorate([\n", " event(\"panstart\")\n", " ], PanStart);\n", " let PanEnd = class PanEnd extends PointEvent {\n", " };\n", " exports.PanEnd = PanEnd;\n", " PanEnd.__name__ = \"PanEnd\";\n", " exports.PanEnd = PanEnd = __decorate([\n", " event(\"panend\")\n", " ], PanEnd);\n", " let PinchStart = class PinchStart extends PointEvent {\n", " };\n", " exports.PinchStart = PinchStart;\n", " PinchStart.__name__ = \"PinchStart\";\n", " exports.PinchStart = PinchStart = __decorate([\n", " event(\"pinchstart\")\n", " ], PinchStart);\n", " let PinchEnd = class PinchEnd extends PointEvent {\n", " };\n", " exports.PinchEnd = PinchEnd;\n", " PinchEnd.__name__ = \"PinchEnd\";\n", " exports.PinchEnd = PinchEnd = __decorate([\n", " event(\"pinchend\")\n", " ], PinchEnd);\n", " let RotateStart = class RotateStart extends PointEvent {\n", " };\n", " exports.RotateStart = RotateStart;\n", " RotateStart.__name__ = \"RotateStart\";\n", " exports.RotateStart = RotateStart = __decorate([\n", " event(\"rotatestart\")\n", " ], RotateStart);\n", " let RotateEnd = class RotateEnd extends PointEvent {\n", " };\n", " exports.RotateEnd = RotateEnd;\n", " RotateEnd.__name__ = \"RotateEnd\";\n", " exports.RotateEnd = RotateEnd = __decorate([\n", " event(\"rotateend\")\n", " ], RotateEnd);\n", " },\n", " /* core/ui_events.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const hammerjs_1 = tslib_1.__importDefault(require(276) /* hammerjs */);\n", " const signaling_1 = require(14) /* ./signaling */;\n", " const logging_1 = require(72) /* ./logging */;\n", " const dom_1 = require(68) /* ./dom */;\n", " const wheel_1 = require(293) /* ./util/wheel */;\n", " const array_1 = require(9) /* ./util/array */;\n", " const types_1 = require(8) /* ./util/types */;\n", " const compat_1 = require(28) /* ./util/compat */;\n", " const events = tslib_1.__importStar(require(291) /* ./bokeh_events */);\n", " const menus_1 = require(281) /* ./util/menus */;\n", " function is_touch(event) {\n", " return typeof TouchEvent !== \"undefined\" && event instanceof TouchEvent;\n", " }\n", " class UIEvents {\n", " constructor(plot_view, toolbar, hit_area) {\n", " this.plot_view = plot_view;\n", " this.toolbar = toolbar;\n", " this.hit_area = hit_area;\n", " this.pan_start = new signaling_1.Signal(this, 'pan:start');\n", " this.pan = new signaling_1.Signal(this, 'pan');\n", " this.pan_end = new signaling_1.Signal(this, 'pan:end');\n", " this.pinch_start = new signaling_1.Signal(this, 'pinch:start');\n", " this.pinch = new signaling_1.Signal(this, 'pinch');\n", " this.pinch_end = new signaling_1.Signal(this, 'pinch:end');\n", " this.rotate_start = new signaling_1.Signal(this, 'rotate:start');\n", " this.rotate = new signaling_1.Signal(this, 'rotate');\n", " this.rotate_end = new signaling_1.Signal(this, 'rotate:end');\n", " this.tap = new signaling_1.Signal(this, 'tap');\n", " this.doubletap = new signaling_1.Signal(this, 'doubletap');\n", " this.press = new signaling_1.Signal(this, 'press');\n", " this.pressup = new signaling_1.Signal(this, 'pressup');\n", " this.move_enter = new signaling_1.Signal(this, 'move:enter');\n", " this.move = new signaling_1.Signal(this, 'move');\n", " this.move_exit = new signaling_1.Signal(this, 'move:exit');\n", " this.scroll = new signaling_1.Signal(this, 'scroll');\n", " this.keydown = new signaling_1.Signal(this, 'keydown');\n", " this.keyup = new signaling_1.Signal(this, 'keyup');\n", " this.hammer = new hammerjs_1.default(this.hit_area, {\n", " touchAction: 'auto',\n", " inputClass: hammerjs_1.default.TouchMouseInput,\n", " });\n", " this._configure_hammerjs();\n", " // Mouse & keyboard events not handled through hammerjs\n", " // We can 'add and forget' these event listeners because this.hit_area is a DOM element\n", " // that will be thrown away when the view is removed\n", " this.hit_area.addEventListener(\"mousemove\", (e) => this._mouse_move(e));\n", " this.hit_area.addEventListener(\"mouseenter\", (e) => this._mouse_enter(e));\n", " this.hit_area.addEventListener(\"mouseleave\", (e) => this._mouse_exit(e));\n", " this.hit_area.addEventListener(\"contextmenu\", (e) => this._context_menu(e));\n", " this.hit_area.addEventListener(\"wheel\", (e) => this._mouse_wheel(e));\n", " // But we MUST remove listeners registered on document or we'll leak memory: register\n", " // 'this' as the listener (it implements the event listener interface, i.e. handleEvent)\n", " // instead of an anonymous function so we can easily refer back to it for removing\n", " document.addEventListener(\"keydown\", this);\n", " document.addEventListener(\"keyup\", this);\n", " this.menu = new menus_1.ContextMenu([], {\n", " prevent_hide: (event) => event.button == 2 && event.target == this.hit_area,\n", " });\n", " this.hit_area.appendChild(this.menu.el);\n", " }\n", " destroy() {\n", " this.menu.remove();\n", " this.hammer.destroy();\n", " document.removeEventListener(\"keydown\", this);\n", " document.removeEventListener(\"keyup\", this);\n", " }\n", " handleEvent(e) {\n", " if (e.type == \"keydown\")\n", " this._key_down(e);\n", " else if (e.type == \"keyup\")\n", " this._key_up(e);\n", " }\n", " _configure_hammerjs() {\n", " // This is to be able to distinguish double taps from single taps\n", " this.hammer.get('doubletap').recognizeWith('tap');\n", " this.hammer.get('tap').requireFailure('doubletap');\n", " this.hammer.get('doubletap').dropRequireFailure('tap');\n", " this.hammer.on('doubletap', (e) => this._doubletap(e));\n", " this.hammer.on('tap', (e) => this._tap(e));\n", " this.hammer.on('press', (e) => this._press(e));\n", " this.hammer.on('pressup', (e) => this._pressup(e));\n", " this.hammer.get('pan').set({ direction: hammerjs_1.default.DIRECTION_ALL });\n", " this.hammer.on('panstart', (e) => this._pan_start(e));\n", " this.hammer.on('pan', (e) => this._pan(e));\n", " this.hammer.on('panend', (e) => this._pan_end(e));\n", " this.hammer.get('pinch').set({ enable: true });\n", " this.hammer.on('pinchstart', (e) => this._pinch_start(e));\n", " this.hammer.on('pinch', (e) => this._pinch(e));\n", " this.hammer.on('pinchend', (e) => this._pinch_end(e));\n", " this.hammer.get('rotate').set({ enable: true });\n", " this.hammer.on('rotatestart', (e) => this._rotate_start(e));\n", " this.hammer.on('rotate', (e) => this._rotate(e));\n", " this.hammer.on('rotateend', (e) => this._rotate_end(e));\n", " }\n", " register_tool(tool_view) {\n", " const et = tool_view.model.event_type;\n", " if (et != null) {\n", " if (types_1.isString(et))\n", " this._register_tool(tool_view, et);\n", " else {\n", " // Multi-tools should only registered shared events once\n", " et.forEach((e, index) => this._register_tool(tool_view, e, index < 1));\n", " }\n", " }\n", " }\n", " _register_tool(tool_view, et, shared = true) {\n", " const v = tool_view;\n", " const { id } = v.model;\n", " const conditionally = (fn) => (arg) => {\n", " if (arg.id == id)\n", " fn(arg.e);\n", " };\n", " const unconditionally = (fn) => (arg) => {\n", " fn(arg.e);\n", " };\n", " switch (et) {\n", " case \"pan\": {\n", " if (v._pan_start != null)\n", " v.connect(this.pan_start, conditionally(v._pan_start.bind(v)));\n", " if (v._pan != null)\n", " v.connect(this.pan, conditionally(v._pan.bind(v)));\n", " if (v._pan_end != null)\n", " v.connect(this.pan_end, conditionally(v._pan_end.bind(v)));\n", " break;\n", " }\n", " case \"pinch\": {\n", " if (v._pinch_start != null)\n", " v.connect(this.pinch_start, conditionally(v._pinch_start.bind(v)));\n", " if (v._pinch != null)\n", " v.connect(this.pinch, conditionally(v._pinch.bind(v)));\n", " if (v._pinch_end != null)\n", " v.connect(this.pinch_end, conditionally(v._pinch_end.bind(v)));\n", " break;\n", " }\n", " case \"rotate\": {\n", " if (v._rotate_start != null)\n", " v.connect(this.rotate_start, conditionally(v._rotate_start.bind(v)));\n", " if (v._rotate != null)\n", " v.connect(this.rotate, conditionally(v._rotate.bind(v)));\n", " if (v._rotate_end != null)\n", " v.connect(this.rotate_end, conditionally(v._rotate_end.bind(v)));\n", " break;\n", " }\n", " case \"move\": {\n", " if (v._move_enter != null)\n", " v.connect(this.move_enter, conditionally(v._move_enter.bind(v)));\n", " if (v._move != null)\n", " v.connect(this.move, conditionally(v._move.bind(v)));\n", " if (v._move_exit != null)\n", " v.connect(this.move_exit, conditionally(v._move_exit.bind(v)));\n", " break;\n", " }\n", " case \"tap\": {\n", " if (v._tap != null)\n", " v.connect(this.tap, conditionally(v._tap.bind(v)));\n", " break;\n", " }\n", " case \"press\": {\n", " if (v._press != null)\n", " v.connect(this.press, conditionally(v._press.bind(v)));\n", " if (v._pressup != null)\n", " v.connect(this.pressup, conditionally(v._pressup.bind(v)));\n", " break;\n", " }\n", " case \"scroll\": {\n", " if (v._scroll != null)\n", " v.connect(this.scroll, conditionally(v._scroll.bind(v)));\n", " break;\n", " }\n", " default:\n", " throw new Error(`unsupported event_type: ${et}`);\n", " }\n", " // Skip shared events if registering multi-tool\n", " if (!shared)\n", " return;\n", " if (v._doubletap != null)\n", " v.connect(this.doubletap, unconditionally(v._doubletap.bind(v)));\n", " if (v._keydown != null)\n", " v.connect(this.keydown, unconditionally(v._keydown.bind(v)));\n", " if (v._keyup != null)\n", " v.connect(this.keyup, unconditionally(v._keyup.bind(v)));\n", " // Dual touch hack part 1/2\n", " // This is a hack for laptops with touch screen who may be pinching or scrolling\n", " // in order to use the wheel zoom tool. If it's a touch screen the WheelZoomTool event\n", " // will be linked to pinch. But we also want to trigger in the case of a scroll.\n", " if (compat_1.is_mobile && v._scroll != null && et == 'pinch') {\n", " logging_1.logger.debug(\"Registering scroll on touch screen\");\n", " v.connect(this.scroll, conditionally(v._scroll.bind(v)));\n", " }\n", " }\n", " _hit_test_renderers(sx, sy) {\n", " const views = this.plot_view.get_renderer_views();\n", " for (const view of array_1.reversed(views)) {\n", " const { level } = view.model;\n", " if ((level == 'annotation' || level == 'overlay') && view.interactive_hit != null) {\n", " if (view.interactive_hit(sx, sy))\n", " return view;\n", " }\n", " }\n", " return null;\n", " }\n", " _hit_test_frame(sx, sy) {\n", " return this.plot_view.frame.bbox.contains(sx, sy);\n", " }\n", " _hit_test_canvas(sx, sy) {\n", " return this.plot_view.layout.bbox.contains(sx, sy);\n", " }\n", " _trigger(signal, e, srcEvent) {\n", " const gestures = this.toolbar.gestures;\n", " const event_type = signal.name;\n", " const base_type = event_type.split(\":\")[0];\n", " const view = this._hit_test_renderers(e.sx, e.sy);\n", " const on_canvas = this._hit_test_canvas(e.sx, e.sy);\n", " switch (base_type) {\n", " case \"move\": {\n", " const active_gesture = gestures[base_type].active;\n", " if (active_gesture != null)\n", " this.trigger(signal, e, active_gesture.id);\n", " const active_inspectors = this.toolbar.inspectors.filter(t => t.active);\n", " let cursor = \"default\";\n", " // the event happened on a renderer\n", " if (view != null) {\n", " cursor = view.cursor(e.sx, e.sy) || cursor;\n", " if (!array_1.is_empty(active_inspectors)) {\n", " // override event_type to cause inspectors to clear overlays\n", " signal = this.move_exit; // XXX\n", " }\n", " // the event happened on the plot frame but off a renderer\n", " }\n", " else if (this._hit_test_frame(e.sx, e.sy)) {\n", " if (!array_1.is_empty(active_inspectors)) {\n", " cursor = \"crosshair\";\n", " }\n", " }\n", " this.plot_view.set_cursor(cursor);\n", " this.plot_view.set_toolbar_visibility(on_canvas);\n", " active_inspectors.map((inspector) => this.trigger(signal, e, inspector.id));\n", " break;\n", " }\n", " case \"tap\": {\n", " const { target } = srcEvent;\n", " if (target != null && target != this.hit_area)\n", " return; // don't trigger bokeh events\n", " if (view != null && view.on_hit != null)\n", " view.on_hit(e.sx, e.sy);\n", " const active_gesture = gestures[base_type].active;\n", " if (active_gesture != null)\n", " this.trigger(signal, e, active_gesture.id);\n", " break;\n", " }\n", " case \"scroll\": {\n", " // Dual touch hack part 2/2\n", " // This is a hack for laptops with touch screen who may be pinching or scrolling\n", " // in order to use the wheel zoom tool. If it's a touch screen the WheelZoomTool event\n", " // will be linked to pinch. But we also want to trigger in the case of a scroll.\n", " const base = compat_1.is_mobile ? \"pinch\" : \"scroll\";\n", " const active_gesture = gestures[base].active;\n", " if (active_gesture != null) {\n", " srcEvent.preventDefault();\n", " srcEvent.stopPropagation();\n", " this.trigger(signal, e, active_gesture.id);\n", " }\n", " break;\n", " }\n", " case \"pan\": {\n", " const active_gesture = gestures[base_type].active;\n", " if (active_gesture != null) {\n", " srcEvent.preventDefault();\n", " this.trigger(signal, e, active_gesture.id);\n", " }\n", " break;\n", " }\n", " default: {\n", " const active_gesture = gestures[base_type].active;\n", " if (active_gesture != null)\n", " this.trigger(signal, e, active_gesture.id);\n", " }\n", " }\n", " this._trigger_bokeh_event(e);\n", " }\n", " trigger(signal, e, id = null) {\n", " signal.emit({ id, e });\n", " }\n", " _trigger_bokeh_event(e) {\n", " const ev = (() => {\n", " const xscale = this.plot_view.frame.xscales.default;\n", " const yscale = this.plot_view.frame.yscales.default;\n", " const { sx, sy } = e;\n", " const x = xscale.invert(sx);\n", " const y = yscale.invert(sy);\n", " switch (e.type) {\n", " case \"wheel\":\n", " return new events.MouseWheel(sx, sy, x, y, e.delta);\n", " case \"mousemove\":\n", " return new events.MouseMove(sx, sy, x, y);\n", " case \"mouseenter\":\n", " return new events.MouseEnter(sx, sy, x, y);\n", " case \"mouseleave\":\n", " return new events.MouseLeave(sx, sy, x, y);\n", " case \"tap\":\n", " return new events.Tap(sx, sy, x, y);\n", " case \"doubletap\":\n", " return new events.DoubleTap(sx, sy, x, y);\n", " case \"press\":\n", " return new events.Press(sx, sy, x, y);\n", " case \"pressup\":\n", " return new events.PressUp(sx, sy, x, y);\n", " case \"pan\":\n", " return new events.Pan(sx, sy, x, y, e.deltaX, e.deltaY);\n", " case \"panstart\":\n", " return new events.PanStart(sx, sy, x, y);\n", " case \"panend\":\n", " return new events.PanEnd(sx, sy, x, y);\n", " case \"pinch\":\n", " return new events.Pinch(sx, sy, x, y, e.scale);\n", " case \"pinchstart\":\n", " return new events.PinchStart(sx, sy, x, y);\n", " case \"pinchend\":\n", " return new events.PinchEnd(sx, sy, x, y);\n", " case \"rotate\":\n", " return new events.Rotate(sx, sy, x, y, e.rotation);\n", " case \"rotatestart\":\n", " return new events.RotateStart(sx, sy, x, y);\n", " case \"rotateend\":\n", " return new events.RotateEnd(sx, sy, x, y);\n", " default:\n", " return undefined;\n", " }\n", " })();\n", " if (ev != null)\n", " this.plot_view.model.trigger_event(ev);\n", " }\n", " _get_sxy(event) {\n", " const { pageX, pageY } = is_touch(event) ? (event.touches.length != 0 ? event.touches : event.changedTouches)[0] : event;\n", " const { left, top } = dom_1.offset(this.hit_area);\n", " return {\n", " sx: pageX - left,\n", " sy: pageY - top,\n", " };\n", " }\n", " _pan_event(e) {\n", " return Object.assign(Object.assign({ type: e.type }, this._get_sxy(e.srcEvent)), { deltaX: e.deltaX, deltaY: e.deltaY, shiftKey: e.srcEvent.shiftKey, ctrlKey: e.srcEvent.ctrlKey });\n", " }\n", " _pinch_event(e) {\n", " return Object.assign(Object.assign({ type: e.type }, this._get_sxy(e.srcEvent)), { scale: e.scale, shiftKey: e.srcEvent.shiftKey, ctrlKey: e.srcEvent.ctrlKey });\n", " }\n", " _rotate_event(e) {\n", " return Object.assign(Object.assign({ type: e.type }, this._get_sxy(e.srcEvent)), { rotation: e.rotation, shiftKey: e.srcEvent.shiftKey, ctrlKey: e.srcEvent.ctrlKey });\n", " }\n", " _tap_event(e) {\n", " return Object.assign(Object.assign({ type: e.type }, this._get_sxy(e.srcEvent)), { shiftKey: e.srcEvent.shiftKey, ctrlKey: e.srcEvent.ctrlKey });\n", " }\n", " _move_event(e) {\n", " return Object.assign(Object.assign({ type: e.type }, this._get_sxy(e)), { shiftKey: e.shiftKey, ctrlKey: e.ctrlKey });\n", " }\n", " _scroll_event(e) {\n", " return Object.assign(Object.assign({ type: e.type }, this._get_sxy(e)), { delta: wheel_1.getDeltaY(e), shiftKey: e.shiftKey, ctrlKey: e.ctrlKey });\n", " }\n", " _key_event(e) {\n", " return {\n", " type: e.type,\n", " keyCode: e.keyCode,\n", " };\n", " }\n", " _pan_start(e) {\n", " const ev = this._pan_event(e);\n", " // back out delta to get original center point\n", " ev.sx -= e.deltaX;\n", " ev.sy -= e.deltaY;\n", " this._trigger(this.pan_start, ev, e.srcEvent);\n", " }\n", " _pan(e) {\n", " this._trigger(this.pan, this._pan_event(e), e.srcEvent);\n", " }\n", " _pan_end(e) {\n", " this._trigger(this.pan_end, this._pan_event(e), e.srcEvent);\n", " }\n", " _pinch_start(e) {\n", " this._trigger(this.pinch_start, this._pinch_event(e), e.srcEvent);\n", " }\n", " _pinch(e) {\n", " this._trigger(this.pinch, this._pinch_event(e), e.srcEvent);\n", " }\n", " _pinch_end(e) {\n", " this._trigger(this.pinch_end, this._pinch_event(e), e.srcEvent);\n", " }\n", " _rotate_start(e) {\n", " this._trigger(this.rotate_start, this._rotate_event(e), e.srcEvent);\n", " }\n", " _rotate(e) {\n", " this._trigger(this.rotate, this._rotate_event(e), e.srcEvent);\n", " }\n", " _rotate_end(e) {\n", " this._trigger(this.rotate_end, this._rotate_event(e), e.srcEvent);\n", " }\n", " _tap(e) {\n", " this._trigger(this.tap, this._tap_event(e), e.srcEvent);\n", " }\n", " _doubletap(e) {\n", " // NOTE: doubletap event triggered unconditionally\n", " const ev = this._tap_event(e);\n", " this._trigger_bokeh_event(ev);\n", " this.trigger(this.doubletap, ev);\n", " }\n", " _press(e) {\n", " this._trigger(this.press, this._tap_event(e), e.srcEvent);\n", " }\n", " _pressup(e) {\n", " this._trigger(this.pressup, this._tap_event(e), e.srcEvent);\n", " }\n", " _mouse_enter(e) {\n", " this._trigger(this.move_enter, this._move_event(e), e);\n", " }\n", " _mouse_move(e) {\n", " this._trigger(this.move, this._move_event(e), e);\n", " }\n", " _mouse_exit(e) {\n", " this._trigger(this.move_exit, this._move_event(e), e);\n", " }\n", " _mouse_wheel(e) {\n", " this._trigger(this.scroll, this._scroll_event(e), e);\n", " }\n", " _context_menu(e) {\n", " if (!this.menu.is_open && this.menu.can_open) {\n", " e.preventDefault();\n", " }\n", " const { sx, sy } = this._get_sxy(e);\n", " this.menu.toggle({ left: sx, top: sy });\n", " }\n", " _key_down(e) {\n", " // NOTE: keyup event triggered unconditionally\n", " this.trigger(this.keydown, this._key_event(e));\n", " }\n", " _key_up(e) {\n", " // NOTE: keyup event triggered unconditionally\n", " this.trigger(this.keyup, this._key_event(e));\n", " }\n", " }\n", " exports.UIEvents = UIEvents;\n", " UIEvents.__name__ = \"UIEvents\";\n", " },\n", " /* core/util/wheel.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " /*!\n", " * jQuery Mousewheel 3.1.13\n", " *\n", " * Copyright jQuery Foundation and other contributors\n", " * Released under the MIT license\n", " * http://jquery.org/license\n", " */\n", " function fontSize(element) {\n", " const value = getComputedStyle(element).fontSize;\n", " if (value != null)\n", " return parseInt(value, 10);\n", " return null;\n", " }\n", " function lineHeight(element) {\n", " const parent = element.offsetParent || document.body;\n", " return fontSize(parent) || fontSize(element) || 16;\n", " }\n", " function pageHeight(element) {\n", " return element.clientHeight; // XXX: should be content height?\n", " }\n", " function getDeltaY(event) {\n", " let deltaY = -event.deltaY;\n", " if (event.target instanceof HTMLElement) {\n", " switch (event.deltaMode) {\n", " case event.DOM_DELTA_LINE:\n", " deltaY *= lineHeight(event.target);\n", " break;\n", " case event.DOM_DELTA_PAGE:\n", " deltaY *= pageHeight(event.target);\n", " break;\n", " }\n", " }\n", " return deltaY;\n", " }\n", " exports.getDeltaY = getDeltaY;\n", " },\n", " /* core/util/throttle.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " function _delay_animation(callback) {\n", " callback(Date.now()); // XXX: performance.now()\n", " return -1;\n", " }\n", " const delay_animation = (typeof window !== 'undefined' ? window.requestAnimationFrame : undefined) ||\n", " (typeof window !== 'undefined' ? window.webkitRequestAnimationFrame : undefined) ||\n", " (typeof window !== 'undefined' ? window.mozRequestAnimationFrame : undefined) ||\n", " (typeof window !== 'undefined' ? window.msRequestAnimationFrame : undefined) || _delay_animation;\n", " // Returns a function, that, when invoked, will only be triggered at\n", " // most once during a given window of time.\n", " //\n", " // In addition, if the browser supports requestAnimationFrame, the\n", " // throttled function will be run no more frequently than request\n", " // animation frame allows.\n", " //\n", " // @param func [function] the function to throttle\n", " // @param wait [number] time in milliseconds to use for window\n", " // @return [function] throttled function\n", " //\n", " function throttle(func, wait) {\n", " let timeout = null;\n", " let previous = 0;\n", " let pending = false;\n", " return function () {\n", " return new Promise((resolve, reject) => {\n", " const later = function () {\n", " previous = Date.now();\n", " timeout = null;\n", " pending = false;\n", " try {\n", " func();\n", " resolve();\n", " }\n", " catch (error) {\n", " reject(error);\n", " }\n", " };\n", " const now = Date.now();\n", " const remaining = wait - (now - previous);\n", " if (remaining <= 0 && !pending) {\n", " if (timeout != null) {\n", " clearTimeout(timeout);\n", " }\n", " pending = true;\n", " delay_animation(later);\n", " }\n", " else if (!timeout && !pending) {\n", " timeout = setTimeout(() => delay_animation(later), remaining);\n", " }\n", " else {\n", " resolve();\n", " }\n", " });\n", " };\n", " }\n", " exports.throttle = throttle;\n", " },\n", " /* core/layout/side_panel.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const types_1 = require(189) /* ./types */;\n", " const layoutable_1 = require(190) /* ./layoutable */;\n", " const types_2 = require(8) /* ../util/types */;\n", " // This table lays out the rules for configuring the baseline, alignment, etc. of\n", " // title text, based on it's location and orientation\n", " //\n", " // side orient baseline align angle normal-dist\n", " // ------------------------------------------------------------------------------\n", " // above parallel bottom center 0 height\n", " // normal middle left -90 width\n", " // horizontal bottom center 0 height\n", " // [angle > 0] middle left width * sin + height * cos\n", " // [angle < 0] middle right width * sin + height * cos\n", " //\n", " // below parallel top center 0 height\n", " // normal middle right 90 width\n", " // horizontal top center 0 height\n", " // [angle > 0] middle right width * sin + height * cos\n", " // [angle < 0] middle left width * sin + height * cos\n", " //\n", " // left parallel bottom center 90 height\n", " // normal middle right 0 width\n", " // horizontal middle right 0 width\n", " // [angle > 0] middle right width * cos + height * sin\n", " // [angle < 0] middle right width * cos + height + sin\n", " //\n", " // right parallel bottom center -90 height\n", " // normal middle left 0 width\n", " // horizontal middle left 0 width\n", " // [angle > 0] middle left width * cos + height * sin\n", " // [angle < 0] middle left width * cos + height + sin\n", " const pi2 = Math.PI / 2;\n", " const ALPHABETIC = 'alphabetic';\n", " const TOP = 'top';\n", " const BOTTOM = 'bottom';\n", " const MIDDLE = 'middle';\n", " const HANGING = 'hanging';\n", " const LEFT = 'left';\n", " const RIGHT = 'right';\n", " const CENTER = 'center';\n", " const _angle_lookup = {\n", " above: {\n", " parallel: 0,\n", " normal: -pi2,\n", " horizontal: 0,\n", " vertical: -pi2,\n", " },\n", " below: {\n", " parallel: 0,\n", " normal: pi2,\n", " horizontal: 0,\n", " vertical: pi2,\n", " },\n", " left: {\n", " parallel: -pi2,\n", " normal: 0,\n", " horizontal: 0,\n", " vertical: -pi2,\n", " },\n", " right: {\n", " parallel: pi2,\n", " normal: 0,\n", " horizontal: 0,\n", " vertical: pi2,\n", " },\n", " };\n", " const _baseline_lookup = {\n", " above: {\n", " justified: TOP,\n", " parallel: ALPHABETIC,\n", " normal: MIDDLE,\n", " horizontal: ALPHABETIC,\n", " vertical: MIDDLE,\n", " },\n", " below: {\n", " justified: BOTTOM,\n", " parallel: HANGING,\n", " normal: MIDDLE,\n", " horizontal: HANGING,\n", " vertical: MIDDLE,\n", " },\n", " left: {\n", " justified: TOP,\n", " parallel: ALPHABETIC,\n", " normal: MIDDLE,\n", " horizontal: MIDDLE,\n", " vertical: ALPHABETIC,\n", " },\n", " right: {\n", " justified: TOP,\n", " parallel: ALPHABETIC,\n", " normal: MIDDLE,\n", " horizontal: MIDDLE,\n", " vertical: ALPHABETIC,\n", " },\n", " };\n", " const _align_lookup = {\n", " above: {\n", " justified: CENTER,\n", " parallel: CENTER,\n", " normal: LEFT,\n", " horizontal: CENTER,\n", " vertical: LEFT,\n", " },\n", " below: {\n", " justified: CENTER,\n", " parallel: CENTER,\n", " normal: LEFT,\n", " horizontal: CENTER,\n", " vertical: LEFT,\n", " },\n", " left: {\n", " justified: CENTER,\n", " parallel: CENTER,\n", " normal: RIGHT,\n", " horizontal: RIGHT,\n", " vertical: CENTER,\n", " },\n", " right: {\n", " justified: CENTER,\n", " parallel: CENTER,\n", " normal: LEFT,\n", " horizontal: LEFT,\n", " vertical: CENTER,\n", " },\n", " };\n", " const _align_lookup_negative = {\n", " above: RIGHT,\n", " below: LEFT,\n", " left: RIGHT,\n", " right: LEFT,\n", " };\n", " const _align_lookup_positive = {\n", " above: LEFT,\n", " below: RIGHT,\n", " left: RIGHT,\n", " right: LEFT,\n", " };\n", " class SidePanel extends layoutable_1.ContentLayoutable {\n", " constructor(side, obj) {\n", " super();\n", " this.side = side;\n", " this.obj = obj;\n", " switch (this.side) {\n", " case \"above\":\n", " this._dim = 0;\n", " this._normals = [0, -1];\n", " break;\n", " case \"below\":\n", " this._dim = 0;\n", " this._normals = [0, 1];\n", " break;\n", " case \"left\":\n", " this._dim = 1;\n", " this._normals = [-1, 0];\n", " break;\n", " case \"right\":\n", " this._dim = 1;\n", " this._normals = [1, 0];\n", " break;\n", " }\n", " if (this.is_horizontal)\n", " this.set_sizing({ width_policy: \"max\", height_policy: \"fixed\" });\n", " else\n", " this.set_sizing({ width_policy: \"fixed\", height_policy: \"max\" });\n", " }\n", " _content_size() {\n", " return new types_1.Sizeable(this.get_oriented_size());\n", " }\n", " get_oriented_size() {\n", " const { width, height } = this.obj.get_size();\n", " if (!this.obj.rotate || this.is_horizontal)\n", " return { width, height };\n", " else\n", " return { width: height, height: width };\n", " }\n", " has_size_changed() {\n", " const { width, height } = this.get_oriented_size();\n", " if (this.is_horizontal)\n", " return this.bbox.height != height;\n", " else\n", " return this.bbox.width != width;\n", " }\n", " get dimension() {\n", " return this._dim;\n", " }\n", " get normals() {\n", " return this._normals;\n", " }\n", " get is_horizontal() {\n", " return this._dim == 0;\n", " }\n", " get is_vertical() {\n", " return this._dim == 1;\n", " }\n", " apply_label_text_heuristics(ctx, orient) {\n", " const side = this.side;\n", " let baseline;\n", " let align;\n", " if (types_2.isString(orient)) {\n", " baseline = _baseline_lookup[side][orient];\n", " align = _align_lookup[side][orient];\n", " }\n", " else {\n", " if (orient < 0) {\n", " baseline = 'middle';\n", " align = _align_lookup_negative[side];\n", " }\n", " else {\n", " baseline = 'middle';\n", " align = _align_lookup_positive[side];\n", " }\n", " }\n", " ctx.textBaseline = baseline;\n", " ctx.textAlign = align;\n", " }\n", " get_label_angle_heuristic(orient) {\n", " return _angle_lookup[this.side][orient];\n", " }\n", " }\n", " exports.SidePanel = SidePanel;\n", " SidePanel.__name__ = \"SidePanel\";\n", " },\n", " /* models/plots/gmap_plot_canvas.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const signaling_1 = require(14) /* ../../core/signaling */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const projections_1 = require(32) /* ../../core/util/projections */;\n", " const plot_canvas_1 = require(290) /* ./plot_canvas */;\n", " const gmaps_ready = new signaling_1.Signal0({}, \"gmaps_ready\");\n", " const load_google_api = function (api_key) {\n", " window._bokeh_gmaps_callback = () => gmaps_ready.emit();\n", " const script = document.createElement('script');\n", " script.type = 'text/javascript';\n", " script.src = `https://maps.googleapis.com/maps/api/js?v=3.36&key=${api_key}&callback=_bokeh_gmaps_callback`;\n", " document.body.appendChild(script);\n", " };\n", " class GMapPlotView extends plot_canvas_1.PlotView {\n", " initialize() {\n", " this.pause();\n", " super.initialize();\n", " this._tiles_loaded = false;\n", " this.zoom_count = 0;\n", " const { zoom, lat, lng } = this.model.map_options;\n", " this.initial_zoom = zoom;\n", " this.initial_lat = lat;\n", " this.initial_lng = lng;\n", " if (typeof google === \"undefined\" || google.maps == null) {\n", " if (typeof window._bokeh_gmaps_callback === \"undefined\") {\n", " const decoded_api_key = atob(this.model.api_key);\n", " load_google_api(decoded_api_key);\n", " }\n", " gmaps_ready.connect(() => this.request_render());\n", " }\n", " this.unpause();\n", " }\n", " remove() {\n", " dom_1.remove(this.map_el);\n", " super.remove();\n", " }\n", " update_range(range_info) {\n", " // RESET -------------------------\n", " if (range_info == null) {\n", " this.map.setCenter({ lat: this.initial_lat, lng: this.initial_lng });\n", " this.map.setOptions({ zoom: this.initial_zoom });\n", " super.update_range(null);\n", " // PAN ----------------------------\n", " }\n", " else if (range_info.sdx != null || range_info.sdy != null) {\n", " this.map.panBy(range_info.sdx || 0, range_info.sdy || 0);\n", " super.update_range(range_info);\n", " // ZOOM ---------------------------\n", " }\n", " else if (range_info.factor != null) {\n", " // The zoom count decreases the sensitivity of the zoom. (We could make this user configurable)\n", " if (this.zoom_count !== 10) {\n", " this.zoom_count += 1;\n", " return;\n", " }\n", " this.zoom_count = 0;\n", " this.pause();\n", " super.update_range(range_info);\n", " const zoom_change = range_info.factor < 0 ? -1 : 1;\n", " const old_map_zoom = this.map.getZoom();\n", " const new_map_zoom = old_map_zoom + zoom_change;\n", " // Zooming out too far causes problems\n", " if (new_map_zoom >= 2) {\n", " this.map.setZoom(new_map_zoom);\n", " // Check we haven't gone out of bounds, and if we have undo the zoom\n", " const [proj_xstart, proj_xend, ,] = this._get_projected_bounds();\n", " if (proj_xend - proj_xstart < 0) {\n", " this.map.setZoom(old_map_zoom);\n", " }\n", " }\n", " this.unpause();\n", " }\n", " // Finally re-center\n", " this._set_bokeh_ranges();\n", " }\n", " _build_map() {\n", " const { maps } = google;\n", " this.map_types = {\n", " satellite: maps.MapTypeId.SATELLITE,\n", " terrain: maps.MapTypeId.TERRAIN,\n", " roadmap: maps.MapTypeId.ROADMAP,\n", " hybrid: maps.MapTypeId.HYBRID,\n", " };\n", " const mo = this.model.map_options;\n", " const map_options = {\n", " center: new maps.LatLng(mo.lat, mo.lng),\n", " zoom: mo.zoom,\n", " disableDefaultUI: true,\n", " mapTypeId: this.map_types[mo.map_type],\n", " scaleControl: mo.scale_control,\n", " tilt: mo.tilt,\n", " };\n", " if (mo.styles != null)\n", " map_options.styles = JSON.parse(mo.styles);\n", " // create the map with above options in div\n", " this.map_el = dom_1.div({ style: { position: \"absolute\" } });\n", " this.canvas_view.add_underlay(this.map_el);\n", " this.map = new maps.Map(this.map_el, map_options);\n", " // update bokeh ranges whenever the map idles, which should be after most UI action\n", " maps.event.addListener(this.map, 'idle', () => this._set_bokeh_ranges());\n", " // also need an event when bounds change so that map resizes trigger renders too\n", " maps.event.addListener(this.map, 'bounds_changed', () => this._set_bokeh_ranges());\n", " maps.event.addListenerOnce(this.map, 'tilesloaded', () => this._render_finished());\n", " // wire up listeners so that changes to properties are reflected\n", " this.connect(this.model.properties.map_options.change, () => this._update_options());\n", " this.connect(this.model.map_options.properties.styles.change, () => this._update_styles());\n", " this.connect(this.model.map_options.properties.lat.change, () => this._update_center('lat'));\n", " this.connect(this.model.map_options.properties.lng.change, () => this._update_center('lng'));\n", " this.connect(this.model.map_options.properties.zoom.change, () => this._update_zoom());\n", " this.connect(this.model.map_options.properties.map_type.change, () => this._update_map_type());\n", " this.connect(this.model.map_options.properties.scale_control.change, () => this._update_scale_control());\n", " this.connect(this.model.map_options.properties.tilt.change, () => this._update_tilt());\n", " }\n", " _render_finished() {\n", " this._tiles_loaded = true;\n", " this.notify_finished();\n", " }\n", " has_finished() {\n", " return super.has_finished() && this._tiles_loaded === true;\n", " }\n", " _get_latlon_bounds() {\n", " const bounds = this.map.getBounds();\n", " const top_right = bounds.getNorthEast();\n", " const bottom_left = bounds.getSouthWest();\n", " const xstart = bottom_left.lng();\n", " const xend = top_right.lng();\n", " const ystart = bottom_left.lat();\n", " const yend = top_right.lat();\n", " return [xstart, xend, ystart, yend];\n", " }\n", " _get_projected_bounds() {\n", " const [xstart, xend, ystart, yend] = this._get_latlon_bounds();\n", " const [proj_xstart, proj_ystart] = projections_1.wgs84_mercator.forward([xstart, ystart]);\n", " const [proj_xend, proj_yend] = projections_1.wgs84_mercator.forward([xend, yend]);\n", " return [proj_xstart, proj_xend, proj_ystart, proj_yend];\n", " }\n", " _set_bokeh_ranges() {\n", " const [proj_xstart, proj_xend, proj_ystart, proj_yend] = this._get_projected_bounds();\n", " this.frame.x_range.setv({ start: proj_xstart, end: proj_xend });\n", " this.frame.y_range.setv({ start: proj_ystart, end: proj_yend });\n", " }\n", " _update_center(fld) {\n", " const c = this.map.getCenter().toJSON();\n", " c[fld] = this.model.map_options[fld];\n", " this.map.setCenter(c);\n", " this._set_bokeh_ranges();\n", " }\n", " _update_map_type() {\n", " this.map.setOptions({ mapTypeId: this.map_types[this.model.map_options.map_type] });\n", " }\n", " _update_scale_control() {\n", " this.map.setOptions({ scaleControl: this.model.map_options.scale_control });\n", " }\n", " _update_tilt() {\n", " this.map.setOptions({ tilt: this.model.map_options.tilt });\n", " }\n", " _update_options() {\n", " this._update_styles();\n", " this._update_center('lat');\n", " this._update_center('lng');\n", " this._update_zoom();\n", " this._update_map_type();\n", " }\n", " _update_styles() {\n", " this.map.setOptions({ styles: JSON.parse(this.model.map_options.styles) });\n", " }\n", " _update_zoom() {\n", " this.map.setOptions({ zoom: this.model.map_options.zoom });\n", " this._set_bokeh_ranges();\n", " }\n", " // this method is expected and called by PlotView.render\n", " _map_hook(_ctx, frame_box) {\n", " if (this.map == null && typeof google !== \"undefined\" && google.maps != null)\n", " this._build_map();\n", " if (this.map_el != null) {\n", " const [left, top, width, height] = frame_box;\n", " this.map_el.style.top = `${top}px`;\n", " this.map_el.style.left = `${left}px`;\n", " this.map_el.style.width = `${width}px`;\n", " this.map_el.style.height = `${height}px`;\n", " }\n", " }\n", " // this overrides the standard _paint_empty to make the inner canvas transparent\n", " _paint_empty(ctx, frame_box) {\n", " const ow = this.layout._width.value;\n", " const oh = this.layout._height.value;\n", " const [left, top, iw, ih] = frame_box;\n", " ctx.clearRect(0, 0, ow, oh);\n", " ctx.beginPath();\n", " ctx.moveTo(0, 0);\n", " ctx.lineTo(0, oh);\n", " ctx.lineTo(ow, oh);\n", " ctx.lineTo(ow, 0);\n", " ctx.lineTo(0, 0);\n", " ctx.moveTo(left, top);\n", " ctx.lineTo(left + iw, top);\n", " ctx.lineTo(left + iw, top + ih);\n", " ctx.lineTo(left, top + ih);\n", " ctx.lineTo(left, top);\n", " ctx.closePath();\n", " if (this.model.border_fill_color != null) {\n", " ctx.fillStyle = this.model.border_fill_color;\n", " ctx.fill();\n", " }\n", " }\n", " }\n", " exports.GMapPlotView = GMapPlotView;\n", " GMapPlotView.__name__ = \"GMapPlotView\";\n", " },\n", " /* models/ranges/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var data_range_1 = require(187) /* ./data_range */;\n", " exports.DataRange = data_range_1.DataRange;\n", " var data_range1d_1 = require(186) /* ./data_range1d */;\n", " exports.DataRange1d = data_range1d_1.DataRange1d;\n", " var factor_range_1 = require(90) /* ./factor_range */;\n", " exports.FactorRange = factor_range_1.FactorRange;\n", " var range_1 = require(91) /* ./range */;\n", " exports.Range = range_1.Range;\n", " var range1d_1 = require(131) /* ./range1d */;\n", " exports.Range1d = range1d_1.Range1d;\n", " },\n", " /* models/renderers/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var glyph_renderer_1 = require(81) /* ./glyph_renderer */;\n", " exports.GlyphRenderer = glyph_renderer_1.GlyphRenderer;\n", " var graph_renderer_1 = require(100) /* ./graph_renderer */;\n", " exports.GraphRenderer = graph_renderer_1.GraphRenderer;\n", " var guide_renderer_1 = require(151) /* ./guide_renderer */;\n", " exports.GuideRenderer = guide_renderer_1.GuideRenderer;\n", " var renderer_1 = require(65) /* ./renderer */;\n", " exports.Renderer = renderer_1.Renderer;\n", " },\n", " /* models/scales/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var categorical_scale_1 = require(185) /* ./categorical_scale */;\n", " exports.CategoricalScale = categorical_scale_1.CategoricalScale;\n", " var continuous_scale_1 = require(121) /* ./continuous_scale */;\n", " exports.ContinuousScale = continuous_scale_1.ContinuousScale;\n", " var linear_scale_1 = require(120) /* ./linear_scale */;\n", " exports.LinearScale = linear_scale_1.LinearScale;\n", " var log_scale_1 = require(130) /* ./log_scale */;\n", " exports.LogScale = log_scale_1.LogScale;\n", " var scale_1 = require(122) /* ./scale */;\n", " exports.Scale = scale_1.Scale;\n", " },\n", " /* models/selections/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " tslib_1.__exportStar(require(102) /* ./interaction_policy */, exports);\n", " var selection_1 = require(79) /* ./selection */;\n", " exports.Selection = selection_1.Selection;\n", " },\n", " /* models/sources/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var server_sent_data_source_1 = require(302) /* ./server_sent_data_source */;\n", " exports.ServerSentDataSource = server_sent_data_source_1.ServerSentDataSource;\n", " var ajax_data_source_1 = require(304) /* ./ajax_data_source */;\n", " exports.AjaxDataSource = ajax_data_source_1.AjaxDataSource;\n", " var column_data_source_1 = require(76) /* ./column_data_source */;\n", " exports.ColumnDataSource = column_data_source_1.ColumnDataSource;\n", " var columnar_data_source_1 = require(77) /* ./columnar_data_source */;\n", " exports.ColumnarDataSource = columnar_data_source_1.ColumnarDataSource;\n", " var cds_view_1 = require(98) /* ./cds_view */;\n", " exports.CDSView = cds_view_1.CDSView;\n", " var data_source_1 = require(78) /* ./data_source */;\n", " exports.DataSource = data_source_1.DataSource;\n", " var geojson_data_source_1 = require(305) /* ./geojson_data_source */;\n", " exports.GeoJSONDataSource = geojson_data_source_1.GeoJSONDataSource;\n", " var web_data_source_1 = require(303) /* ./web_data_source */;\n", " exports.WebDataSource = web_data_source_1.WebDataSource;\n", " },\n", " /* models/sources/server_sent_data_source.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const web_data_source_1 = require(303) /* ./web_data_source */;\n", " class ServerSentDataSource extends web_data_source_1.WebDataSource {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.initialized = false;\n", " }\n", " destroy() {\n", " super.destroy();\n", " }\n", " setup() {\n", " if (!this.initialized) {\n", " this.initialized = true;\n", " const source = new EventSource(this.data_url);\n", " source.onmessage = (event) => {\n", " this.load_data(JSON.parse(event.data), this.mode, this.max_size);\n", " };\n", " }\n", " }\n", " }\n", " exports.ServerSentDataSource = ServerSentDataSource;\n", " ServerSentDataSource.__name__ = \"ServerSentDataSource\";\n", " },\n", " /* models/sources/web_data_source.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const column_data_source_1 = require(76) /* ./column_data_source */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class WebDataSource extends column_data_source_1.ColumnDataSource {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " get_column(colname) {\n", " const column = this.data[colname];\n", " return column != null ? column : [];\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.setup();\n", " }\n", " load_data(raw_data, mode, max_size) {\n", " const { adapter } = this;\n", " let data;\n", " if (adapter != null)\n", " data = adapter.execute(this, { response: raw_data });\n", " else\n", " data = raw_data;\n", " switch (mode) {\n", " case \"replace\": {\n", " this.data = data;\n", " break;\n", " }\n", " case \"append\": {\n", " const original_data = this.data;\n", " for (const column of this.columns()) {\n", " // XXX: support typed arrays\n", " const old_col = Array.from(original_data[column]);\n", " const new_col = Array.from(data[column]);\n", " data[column] = old_col.concat(new_col).slice(-max_size);\n", " }\n", " this.data = data;\n", " break;\n", " }\n", " }\n", " }\n", " static init_WebDataSource() {\n", " this.define({\n", " mode: [p.UpdateMode, 'replace'],\n", " max_size: [p.Number],\n", " adapter: [p.Any, null],\n", " data_url: [p.String],\n", " });\n", " }\n", " }\n", " exports.WebDataSource = WebDataSource;\n", " WebDataSource.__name__ = \"WebDataSource\";\n", " WebDataSource.init_WebDataSource();\n", " },\n", " /* models/sources/ajax_data_source.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const web_data_source_1 = require(303) /* ./web_data_source */;\n", " const logging_1 = require(72) /* ../../core/logging */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class AjaxDataSource extends web_data_source_1.WebDataSource {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.initialized = false;\n", " }\n", " static init_AjaxDataSource() {\n", " this.define({\n", " polling_interval: [p.Number],\n", " content_type: [p.String, 'application/json'],\n", " http_headers: [p.Any, {}],\n", " method: [p.HTTPMethod, 'POST'],\n", " if_modified: [p.Boolean, false],\n", " });\n", " }\n", " destroy() {\n", " if (this.interval != null)\n", " clearInterval(this.interval);\n", " super.destroy();\n", " }\n", " setup() {\n", " if (!this.initialized) {\n", " this.initialized = true;\n", " this.get_data(this.mode);\n", " if (this.polling_interval) {\n", " const callback = () => this.get_data(this.mode, this.max_size, this.if_modified);\n", " this.interval = setInterval(callback, this.polling_interval);\n", " }\n", " }\n", " }\n", " get_data(mode, max_size = 0, _if_modified = false) {\n", " const xhr = this.prepare_request();\n", " // TODO: if_modified\n", " xhr.addEventListener(\"load\", () => this.do_load(xhr, mode, max_size));\n", " xhr.addEventListener(\"error\", () => this.do_error(xhr));\n", " xhr.send();\n", " }\n", " prepare_request() {\n", " const xhr = new XMLHttpRequest();\n", " xhr.open(this.method, this.data_url, true);\n", " xhr.withCredentials = false;\n", " xhr.setRequestHeader(\"Content-Type\", this.content_type);\n", " const http_headers = this.http_headers;\n", " for (const name in http_headers) {\n", " const value = http_headers[name];\n", " xhr.setRequestHeader(name, value);\n", " }\n", " return xhr;\n", " }\n", " do_load(xhr, mode, max_size) {\n", " if (xhr.status === 200) {\n", " const raw_data = JSON.parse(xhr.responseText);\n", " this.load_data(raw_data, mode, max_size);\n", " }\n", " }\n", " do_error(xhr) {\n", " logging_1.logger.error(`Failed to fetch JSON from ${this.data_url} with code ${xhr.status}`);\n", " }\n", " }\n", " exports.AjaxDataSource = AjaxDataSource;\n", " AjaxDataSource.__name__ = \"AjaxDataSource\";\n", " AjaxDataSource.init_AjaxDataSource();\n", " },\n", " /* models/sources/geojson_data_source.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const columnar_data_source_1 = require(77) /* ./columnar_data_source */;\n", " const logging_1 = require(72) /* ../../core/logging */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " function orNaN(v) {\n", " return v != null ? v : NaN;\n", " }\n", " class GeoJSONDataSource extends columnar_data_source_1.ColumnarDataSource {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_GeoJSONDataSource() {\n", " this.define({\n", " geojson: [p.Any],\n", " });\n", " this.internal({\n", " data: [p.Any, {}],\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " this._update_data();\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.properties.geojson.change, () => this._update_data());\n", " }\n", " _update_data() {\n", " this.data = this.geojson_to_column_data();\n", " }\n", " _get_new_list_array(length) {\n", " return array_1.range(0, length).map((_i) => []);\n", " }\n", " _get_new_nan_array(length) {\n", " return array_1.range(0, length).map((_i) => NaN);\n", " }\n", " _add_properties(item, data, i, item_count) {\n", " const properties = item.properties || {};\n", " for (const property in properties) {\n", " if (!data.hasOwnProperty(property))\n", " data[property] = this._get_new_nan_array(item_count);\n", " // orNaN necessary here to prevent null values from ending up in the column\n", " data[property][i] = orNaN(properties[property]);\n", " }\n", " }\n", " _add_geometry(geometry, data, i) {\n", " function flatten(acc, item) {\n", " return acc.concat([[NaN, NaN, NaN]]).concat(item);\n", " }\n", " switch (geometry.type) {\n", " case \"Point\": {\n", " const [x, y, z] = geometry.coordinates;\n", " data.x[i] = x;\n", " data.y[i] = y;\n", " data.z[i] = orNaN(z);\n", " break;\n", " }\n", " case \"LineString\": {\n", " const { coordinates } = geometry;\n", " for (let j = 0; j < coordinates.length; j++) {\n", " const [x, y, z] = coordinates[j];\n", " data.xs[i][j] = x;\n", " data.ys[i][j] = y;\n", " data.zs[i][j] = orNaN(z);\n", " }\n", " break;\n", " }\n", " case \"Polygon\": {\n", " if (geometry.coordinates.length > 1)\n", " logging_1.logger.warn('Bokeh does not support Polygons with holes in, only exterior ring used.');\n", " const exterior_ring = geometry.coordinates[0];\n", " for (let j = 0; j < exterior_ring.length; j++) {\n", " const [x, y, z] = exterior_ring[j];\n", " data.xs[i][j] = x;\n", " data.ys[i][j] = y;\n", " data.zs[i][j] = orNaN(z);\n", " }\n", " break;\n", " }\n", " case \"MultiPoint\": {\n", " logging_1.logger.warn('MultiPoint not supported in Bokeh');\n", " break;\n", " }\n", " case \"MultiLineString\": {\n", " const coordinates = geometry.coordinates.reduce(flatten);\n", " for (let j = 0; j < coordinates.length; j++) {\n", " const [x, y, z] = coordinates[j];\n", " data.xs[i][j] = x;\n", " data.ys[i][j] = y;\n", " data.zs[i][j] = orNaN(z);\n", " }\n", " break;\n", " }\n", " case \"MultiPolygon\": {\n", " const exterior_rings = [];\n", " for (const polygon of geometry.coordinates) {\n", " if (polygon.length > 1)\n", " logging_1.logger.warn('Bokeh does not support Polygons with holes in, only exterior ring used.');\n", " exterior_rings.push(polygon[0]);\n", " }\n", " const coordinates = exterior_rings.reduce(flatten);\n", " for (let j = 0; j < coordinates.length; j++) {\n", " const [x, y, z] = coordinates[j];\n", " data.xs[i][j] = x;\n", " data.ys[i][j] = y;\n", " data.zs[i][j] = orNaN(z);\n", " }\n", " break;\n", " }\n", " default:\n", " throw new Error(`Invalid GeoJSON geometry type: ${geometry.type}`);\n", " }\n", " }\n", " geojson_to_column_data() {\n", " const geojson = JSON.parse(this.geojson);\n", " let items;\n", " switch (geojson.type) {\n", " case \"GeometryCollection\": {\n", " if (geojson.geometries == null)\n", " throw new Error('No geometries found in GeometryCollection');\n", " if (geojson.geometries.length === 0)\n", " throw new Error('geojson.geometries must have one or more items');\n", " items = geojson.geometries;\n", " break;\n", " }\n", " case \"FeatureCollection\": {\n", " if (geojson.features == null)\n", " throw new Error('No features found in FeaturesCollection');\n", " if (geojson.features.length == 0)\n", " throw new Error('geojson.features must have one or more items');\n", " items = geojson.features;\n", " break;\n", " }\n", " default:\n", " throw new Error('Bokeh only supports type GeometryCollection and FeatureCollection at top level');\n", " }\n", " let item_count = 0;\n", " for (const item of items) {\n", " const geometry = item.type === 'Feature' ? item.geometry : item;\n", " if (geometry.type == 'GeometryCollection')\n", " item_count += geometry.geometries.length;\n", " else\n", " item_count += 1;\n", " }\n", " const data = {\n", " x: this._get_new_nan_array(item_count),\n", " y: this._get_new_nan_array(item_count),\n", " z: this._get_new_nan_array(item_count),\n", " xs: this._get_new_list_array(item_count),\n", " ys: this._get_new_list_array(item_count),\n", " zs: this._get_new_list_array(item_count),\n", " };\n", " let arr_index = 0;\n", " for (const item of items) {\n", " const geometry = item.type == 'Feature' ? item.geometry : item;\n", " if (geometry.type == \"GeometryCollection\") {\n", " for (const g of geometry.geometries) {\n", " this._add_geometry(g, data, arr_index);\n", " if (item.type === 'Feature')\n", " this._add_properties(item, data, arr_index, item_count);\n", " arr_index += 1;\n", " }\n", " }\n", " else {\n", " this._add_geometry(geometry, data, arr_index);\n", " if (item.type === 'Feature')\n", " this._add_properties(item, data, arr_index, item_count);\n", " arr_index += 1;\n", " }\n", " }\n", " return data;\n", " }\n", " }\n", " exports.GeoJSONDataSource = GeoJSONDataSource;\n", " GeoJSONDataSource.__name__ = \"GeoJSONDataSource\";\n", " GeoJSONDataSource.init_GeoJSONDataSource();\n", " },\n", " /* models/tickers/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var adaptive_ticker_1 = require(110) /* ./adaptive_ticker */;\n", " exports.AdaptiveTicker = adaptive_ticker_1.AdaptiveTicker;\n", " var basic_ticker_1 = require(109) /* ./basic_ticker */;\n", " exports.BasicTicker = basic_ticker_1.BasicTicker;\n", " var categorical_ticker_1 = require(153) /* ./categorical_ticker */;\n", " exports.CategoricalTicker = categorical_ticker_1.CategoricalTicker;\n", " var composite_ticker_1 = require(164) /* ./composite_ticker */;\n", " exports.CompositeTicker = composite_ticker_1.CompositeTicker;\n", " var continuous_ticker_1 = require(111) /* ./continuous_ticker */;\n", " exports.ContinuousTicker = continuous_ticker_1.ContinuousTicker;\n", " var datetime_ticker_1 = require(163) /* ./datetime_ticker */;\n", " exports.DatetimeTicker = datetime_ticker_1.DatetimeTicker;\n", " var days_ticker_1 = require(165) /* ./days_ticker */;\n", " exports.DaysTicker = days_ticker_1.DaysTicker;\n", " var fixed_ticker_1 = require(307) /* ./fixed_ticker */;\n", " exports.FixedTicker = fixed_ticker_1.FixedTicker;\n", " var log_ticker_1 = require(172) /* ./log_ticker */;\n", " exports.LogTicker = log_ticker_1.LogTicker;\n", " var mercator_ticker_1 = require(175) /* ./mercator_ticker */;\n", " exports.MercatorTicker = mercator_ticker_1.MercatorTicker;\n", " var months_ticker_1 = require(168) /* ./months_ticker */;\n", " exports.MonthsTicker = months_ticker_1.MonthsTicker;\n", " var single_interval_ticker_1 = require(166) /* ./single_interval_ticker */;\n", " exports.SingleIntervalTicker = single_interval_ticker_1.SingleIntervalTicker;\n", " var ticker_1 = require(112) /* ./ticker */;\n", " exports.Ticker = ticker_1.Ticker;\n", " var years_ticker_1 = require(169) /* ./years_ticker */;\n", " exports.YearsTicker = years_ticker_1.YearsTicker;\n", " },\n", " /* models/tickers/fixed_ticker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const continuous_ticker_1 = require(111) /* ./continuous_ticker */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class FixedTicker extends continuous_ticker_1.ContinuousTicker {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.min_interval = 0;\n", " this.max_interval = 0;\n", " }\n", " static init_FixedTicker() {\n", " this.define({\n", " ticks: [p.Array, []],\n", " minor_ticks: [p.Array, []],\n", " });\n", " }\n", " get_ticks_no_defaults(_data_low, _data_high, _cross_loc, _desired_n_ticks) {\n", " return {\n", " major: this.ticks,\n", " minor: this.minor_ticks,\n", " };\n", " }\n", " // XXX: whatever, because FixedTicker needs to fulfill the interface somehow\n", " get_interval(_data_low, _data_high, _desired_n_ticks) {\n", " return 0;\n", " }\n", " }\n", " exports.FixedTicker = FixedTicker;\n", " FixedTicker.__name__ = \"FixedTicker\";\n", " FixedTicker.init_FixedTicker();\n", " },\n", " /* models/tiles/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var bbox_tile_source_1 = require(309) /* ./bbox_tile_source */;\n", " exports.BBoxTileSource = bbox_tile_source_1.BBoxTileSource;\n", " var mercator_tile_source_1 = require(310) /* ./mercator_tile_source */;\n", " exports.MercatorTileSource = mercator_tile_source_1.MercatorTileSource;\n", " var quadkey_tile_source_1 = require(313) /* ./quadkey_tile_source */;\n", " exports.QUADKEYTileSource = quadkey_tile_source_1.QUADKEYTileSource;\n", " var tile_renderer_1 = require(314) /* ./tile_renderer */;\n", " exports.TileRenderer = tile_renderer_1.TileRenderer;\n", " var tile_source_1 = require(311) /* ./tile_source */;\n", " exports.TileSource = tile_source_1.TileSource;\n", " var tms_tile_source_1 = require(318) /* ./tms_tile_source */;\n", " exports.TMSTileSource = tms_tile_source_1.TMSTileSource;\n", " var wmts_tile_source_1 = require(315) /* ./wmts_tile_source */;\n", " exports.WMTSTileSource = wmts_tile_source_1.WMTSTileSource;\n", " },\n", " /* models/tiles/bbox_tile_source.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const mercator_tile_source_1 = require(310) /* ./mercator_tile_source */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class BBoxTileSource extends mercator_tile_source_1.MercatorTileSource {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_BBoxTileSource() {\n", " this.define({\n", " use_latlon: [p.Boolean, false],\n", " });\n", " }\n", " get_image_url(x, y, z) {\n", " const image_url = this.string_lookup_replace(this.url, this.extra_url_vars);\n", " let xmax, xmin, ymax, ymin;\n", " if (this.use_latlon)\n", " [xmin, ymin, xmax, ymax] = this.get_tile_geographic_bounds(x, y, z);\n", " else\n", " [xmin, ymin, xmax, ymax] = this.get_tile_meter_bounds(x, y, z);\n", " return image_url\n", " .replace(\"{XMIN}\", xmin.toString())\n", " .replace(\"{YMIN}\", ymin.toString())\n", " .replace(\"{XMAX}\", xmax.toString())\n", " .replace(\"{YMAX}\", ymax.toString());\n", " }\n", " }\n", " exports.BBoxTileSource = BBoxTileSource;\n", " BBoxTileSource.__name__ = \"BBoxTileSource\";\n", " BBoxTileSource.init_BBoxTileSource();\n", " },\n", " /* models/tiles/mercator_tile_source.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const tile_source_1 = require(311) /* ./tile_source */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const tile_utils_1 = require(312) /* ./tile_utils */;\n", " class MercatorTileSource extends tile_source_1.TileSource {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_MercatorTileSource() {\n", " this.define({\n", " snap_to_zoom: [p.Boolean, false],\n", " wrap_around: [p.Boolean, true],\n", " });\n", " this.override({\n", " x_origin_offset: 20037508.34,\n", " y_origin_offset: 20037508.34,\n", " initial_resolution: 156543.03392804097,\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " this._resolutions = array_1.range(this.min_zoom, this.max_zoom + 1).map((z) => this.get_resolution(z));\n", " }\n", " _computed_initial_resolution() {\n", " if (this.initial_resolution != null)\n", " return this.initial_resolution;\n", " else {\n", " // TODO testing 2015-11-17, if this codepath is used it seems\n", " // to use 100% cpu and wedge Chrome\n", " return (2 * Math.PI * 6378137) / this.tile_size;\n", " }\n", " }\n", " is_valid_tile(x, y, z) {\n", " if (!this.wrap_around) {\n", " if (x < 0 || x >= 2 ** z)\n", " return false;\n", " }\n", " if (y < 0 || y >= 2 ** z)\n", " return false;\n", " return true;\n", " }\n", " parent_by_tile_xyz(x, y, z) {\n", " const quadkey = this.tile_xyz_to_quadkey(x, y, z);\n", " const parent_quadkey = quadkey.substring(0, quadkey.length - 1);\n", " return this.quadkey_to_tile_xyz(parent_quadkey);\n", " }\n", " get_resolution(level) {\n", " return this._computed_initial_resolution() / 2 ** level;\n", " }\n", " get_resolution_by_extent(extent, height, width) {\n", " const x_rs = (extent[2] - extent[0]) / width;\n", " const y_rs = (extent[3] - extent[1]) / height;\n", " return [x_rs, y_rs];\n", " }\n", " get_level_by_extent(extent, height, width) {\n", " const x_rs = (extent[2] - extent[0]) / width;\n", " const y_rs = (extent[3] - extent[1]) / height;\n", " const resolution = Math.max(x_rs, y_rs);\n", " let i = 0;\n", " for (const r of this._resolutions) {\n", " if (resolution > r) {\n", " if (i == 0)\n", " return 0;\n", " if (i > 0)\n", " return i - 1;\n", " }\n", " i += 1;\n", " }\n", " // otherwise return the highest available resolution\n", " return (i - 1);\n", " }\n", " get_closest_level_by_extent(extent, height, width) {\n", " const x_rs = (extent[2] - extent[0]) / width;\n", " const y_rs = (extent[3] - extent[1]) / height;\n", " const resolution = Math.max(x_rs, y_rs);\n", " const closest = this._resolutions.reduce(function (previous, current) {\n", " if (Math.abs(current - resolution) < Math.abs(previous - resolution))\n", " return current;\n", " else\n", " return previous;\n", " });\n", " return this._resolutions.indexOf(closest);\n", " }\n", " snap_to_zoom_level(extent, height, width, level) {\n", " const [xmin, ymin, xmax, ymax] = extent;\n", " const desired_res = this._resolutions[level];\n", " let desired_x_delta = width * desired_res;\n", " let desired_y_delta = height * desired_res;\n", " if (!this.snap_to_zoom) {\n", " const xscale = (xmax - xmin) / desired_x_delta;\n", " const yscale = (ymax - ymin) / desired_y_delta;\n", " if (xscale > yscale) {\n", " desired_x_delta = (xmax - xmin);\n", " desired_y_delta = desired_y_delta * xscale;\n", " }\n", " else {\n", " desired_x_delta = desired_x_delta * yscale;\n", " desired_y_delta = (ymax - ymin);\n", " }\n", " }\n", " const x_adjust = (desired_x_delta - (xmax - xmin)) / 2;\n", " const y_adjust = (desired_y_delta - (ymax - ymin)) / 2;\n", " return [xmin - x_adjust, ymin - y_adjust, xmax + x_adjust, ymax + y_adjust];\n", " }\n", " tms_to_wmts(x, y, z) {\n", " // Note this works both ways\n", " return [x, 2 ** z - 1 - y, z];\n", " }\n", " wmts_to_tms(x, y, z) {\n", " // Note this works both ways\n", " return [x, 2 ** z - 1 - y, z];\n", " }\n", " pixels_to_meters(px, py, level) {\n", " const res = this.get_resolution(level);\n", " const mx = (px * res) - this.x_origin_offset;\n", " const my = (py * res) - this.y_origin_offset;\n", " return [mx, my];\n", " }\n", " meters_to_pixels(mx, my, level) {\n", " const res = this.get_resolution(level);\n", " const px = (mx + this.x_origin_offset) / res;\n", " const py = (my + this.y_origin_offset) / res;\n", " return [px, py];\n", " }\n", " pixels_to_tile(px, py) {\n", " let tx = Math.ceil(px / this.tile_size);\n", " tx = tx === 0 ? tx : tx - 1;\n", " const ty = Math.max(Math.ceil(py / this.tile_size) - 1, 0);\n", " return [tx, ty];\n", " }\n", " pixels_to_raster(px, py, level) {\n", " const mapSize = this.tile_size << level;\n", " return [px, mapSize - py];\n", " }\n", " meters_to_tile(mx, my, level) {\n", " const [px, py] = this.meters_to_pixels(mx, my, level);\n", " return this.pixels_to_tile(px, py);\n", " }\n", " get_tile_meter_bounds(tx, ty, level) {\n", " // expects tms styles coordinates (bottom-left origin)\n", " const [xmin, ymin] = this.pixels_to_meters(tx * this.tile_size, ty * this.tile_size, level);\n", " const [xmax, ymax] = this.pixels_to_meters((tx + 1) * this.tile_size, (ty + 1) * this.tile_size, level);\n", " return [xmin, ymin, xmax, ymax];\n", " }\n", " get_tile_geographic_bounds(tx, ty, level) {\n", " const bounds = this.get_tile_meter_bounds(tx, ty, level);\n", " const [minLon, minLat, maxLon, maxLat] = tile_utils_1.meters_extent_to_geographic(bounds);\n", " return [minLon, minLat, maxLon, maxLat];\n", " }\n", " get_tiles_by_extent(extent, level, tile_border = 1) {\n", " // unpack extent and convert to tile coordinates\n", " const [xmin, ymin, xmax, ymax] = extent;\n", " let [txmin, tymin] = this.meters_to_tile(xmin, ymin, level);\n", " let [txmax, tymax] = this.meters_to_tile(xmax, ymax, level);\n", " // add tiles which border\n", " txmin -= tile_border;\n", " tymin -= tile_border;\n", " txmax += tile_border;\n", " tymax += tile_border;\n", " const tiles = [];\n", " for (let ty = tymax; ty >= tymin; ty--) {\n", " for (let tx = txmin; tx <= txmax; tx++) {\n", " if (this.is_valid_tile(tx, ty, level))\n", " tiles.push([tx, ty, level, this.get_tile_meter_bounds(tx, ty, level)]);\n", " }\n", " }\n", " this.sort_tiles_from_center(tiles, [txmin, tymin, txmax, tymax]);\n", " return tiles;\n", " }\n", " quadkey_to_tile_xyz(quadKey) {\n", " /**\n", " * Computes tile x, y and z values based on quadKey.\n", " */\n", " let tileX = 0;\n", " let tileY = 0;\n", " const tileZ = quadKey.length;\n", " for (let i = tileZ; i > 0; i--) {\n", " const value = quadKey.charAt(tileZ - i);\n", " const mask = 1 << (i - 1);\n", " switch (value) {\n", " case '0':\n", " continue;\n", " case '1':\n", " tileX |= mask;\n", " break;\n", " case '2':\n", " tileY |= mask;\n", " break;\n", " case '3':\n", " tileX |= mask;\n", " tileY |= mask;\n", " break;\n", " default:\n", " throw new TypeError(`Invalid Quadkey: ${quadKey}`);\n", " }\n", " }\n", " return [tileX, tileY, tileZ];\n", " }\n", " tile_xyz_to_quadkey(x, y, z) {\n", " /*\n", " * Computes quadkey value based on tile x, y and z values.\n", " */\n", " let quadkey = \"\";\n", " for (let i = z; i > 0; i--) {\n", " const mask = 1 << (i - 1);\n", " let digit = 0;\n", " if ((x & mask) !== 0) {\n", " digit += 1;\n", " }\n", " if ((y & mask) !== 0) {\n", " digit += 2;\n", " }\n", " quadkey += digit.toString();\n", " }\n", " return quadkey;\n", " }\n", " children_by_tile_xyz(x, y, z) {\n", " const quadkey = this.tile_xyz_to_quadkey(x, y, z);\n", " const child_tile_xyz = [];\n", " for (let i = 0; i <= 3; i++) {\n", " const [x, y, z] = this.quadkey_to_tile_xyz(quadkey + i.toString());\n", " const b = this.get_tile_meter_bounds(x, y, z);\n", " child_tile_xyz.push([x, y, z, b]);\n", " }\n", " return child_tile_xyz;\n", " }\n", " get_closest_parent_by_tile_xyz(x, y, z) {\n", " const world_x = this.calculate_world_x_by_tile_xyz(x, y, z);\n", " [x, y, z] = this.normalize_xyz(x, y, z);\n", " let quadkey = this.tile_xyz_to_quadkey(x, y, z);\n", " while (quadkey.length > 0) {\n", " quadkey = quadkey.substring(0, quadkey.length - 1);\n", " [x, y, z] = this.quadkey_to_tile_xyz(quadkey);\n", " [x, y, z] = this.denormalize_xyz(x, y, z, world_x);\n", " if (this.tiles.has(this.tile_xyz_to_key(x, y, z)))\n", " return [x, y, z];\n", " }\n", " return [0, 0, 0];\n", " }\n", " normalize_xyz(x, y, z) {\n", " if (this.wrap_around) {\n", " const tile_count = 2 ** z;\n", " return [((x % tile_count) + tile_count) % tile_count, y, z];\n", " }\n", " else {\n", " return [x, y, z];\n", " }\n", " }\n", " denormalize_xyz(x, y, z, world_x) {\n", " return [x + (world_x * 2 ** z), y, z];\n", " }\n", " denormalize_meters(meters_x, meters_y, _level, world_x) {\n", " return [meters_x + (world_x * 2 * Math.PI * 6378137), meters_y];\n", " }\n", " calculate_world_x_by_tile_xyz(x, _y, z) {\n", " return Math.floor(x / 2 ** z);\n", " }\n", " }\n", " exports.MercatorTileSource = MercatorTileSource;\n", " MercatorTileSource.__name__ = \"MercatorTileSource\";\n", " MercatorTileSource.init_MercatorTileSource();\n", " },\n", " /* models/tiles/tile_source.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const model_1 = require(71) /* ../../model */;\n", " const object_1 = require(17) /* ../../core/util/object */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class TileSource extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_TileSource() {\n", " this.define({\n", " url: [p.String, ''],\n", " tile_size: [p.Number, 256],\n", " max_zoom: [p.Number, 30],\n", " min_zoom: [p.Number, 0],\n", " extra_url_vars: [p.Any, {}],\n", " attribution: [p.String, ''],\n", " x_origin_offset: [p.Number],\n", " y_origin_offset: [p.Number],\n", " initial_resolution: [p.Number],\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.tiles = new Map();\n", " this._normalize_case();\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.change, () => this._clear_cache());\n", " }\n", " string_lookup_replace(str, lookup) {\n", " let result_str = str;\n", " for (const [key, value] of object_1.entries(lookup)) {\n", " result_str = result_str.replace(`{${key}}`, value);\n", " }\n", " return result_str;\n", " }\n", " _normalize_case() {\n", " /*\n", " * Note: should probably be refactored into subclasses.\n", " */\n", " const url = this.url\n", " .replace('{x}', '{X}')\n", " .replace('{y}', '{Y}')\n", " .replace('{z}', '{Z}')\n", " .replace('{q}', '{Q}')\n", " .replace('{xmin}', '{XMIN}')\n", " .replace('{ymin}', '{YMIN}')\n", " .replace('{xmax}', '{XMAX}')\n", " .replace('{ymax}', '{YMAX}');\n", " this.url = url;\n", " }\n", " _clear_cache() {\n", " this.tiles = new Map();\n", " }\n", " tile_xyz_to_key(x, y, z) {\n", " return `${x}:${y}:${z}`;\n", " }\n", " key_to_tile_xyz(key) {\n", " const [x, y, z] = key.split(':').map((c) => parseInt(c));\n", " return [x, y, z];\n", " }\n", " sort_tiles_from_center(tiles, tile_extent) {\n", " const [txmin, tymin, txmax, tymax] = tile_extent;\n", " const center_x = ((txmax - txmin) / 2) + txmin;\n", " const center_y = ((tymax - tymin) / 2) + tymin;\n", " tiles.sort(function (a, b) {\n", " const a_distance = Math.sqrt((center_x - a[0]) ** 2 + (center_y - a[1]) ** 2);\n", " const b_distance = Math.sqrt((center_x - b[0]) ** 2 + (center_y - b[1]) ** 2);\n", " return a_distance - b_distance;\n", " });\n", " }\n", " get_image_url(x, y, z) {\n", " const image_url = this.string_lookup_replace(this.url, this.extra_url_vars);\n", " return image_url\n", " .replace(\"{X}\", x.toString())\n", " .replace('{Y}', y.toString())\n", " .replace(\"{Z}\", z.toString());\n", " }\n", " }\n", " exports.TileSource = TileSource;\n", " TileSource.__name__ = \"TileSource\";\n", " TileSource.init_TileSource();\n", " },\n", " /* models/tiles/tile_utils.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const projections_1 = require(32) /* ../../core/util/projections */;\n", " function geographic_to_meters(xLon, yLat) {\n", " return projections_1.wgs84_mercator.forward([xLon, yLat]);\n", " }\n", " exports.geographic_to_meters = geographic_to_meters;\n", " function meters_to_geographic(mx, my) {\n", " return projections_1.wgs84_mercator.inverse([mx, my]);\n", " }\n", " exports.meters_to_geographic = meters_to_geographic;\n", " function geographic_extent_to_meters(extent) {\n", " const [g_xmin, g_ymin, g_xmax, g_ymax] = extent;\n", " const [m_xmin, m_ymin] = geographic_to_meters(g_xmin, g_ymin);\n", " const [m_xmax, m_ymax] = geographic_to_meters(g_xmax, g_ymax);\n", " return [m_xmin, m_ymin, m_xmax, m_ymax];\n", " }\n", " exports.geographic_extent_to_meters = geographic_extent_to_meters;\n", " function meters_extent_to_geographic(extent) {\n", " const [m_xmin, m_ymin, m_xmax, m_ymax] = extent;\n", " const [g_xmin, g_ymin] = meters_to_geographic(m_xmin, m_ymin);\n", " const [g_xmax, g_ymax] = meters_to_geographic(m_xmax, m_ymax);\n", " return [g_xmin, g_ymin, g_xmax, g_ymax];\n", " }\n", " exports.meters_extent_to_geographic = meters_extent_to_geographic;\n", " },\n", " /* models/tiles/quadkey_tile_source.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const mercator_tile_source_1 = require(310) /* ./mercator_tile_source */;\n", " class QUADKEYTileSource extends mercator_tile_source_1.MercatorTileSource {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " get_image_url(x, y, z) {\n", " const image_url = this.string_lookup_replace(this.url, this.extra_url_vars);\n", " const [wx, wy, wz] = this.tms_to_wmts(x, y, z);\n", " const quadKey = this.tile_xyz_to_quadkey(wx, wy, wz);\n", " return image_url.replace(\"{Q}\", quadKey);\n", " }\n", " }\n", " exports.QUADKEYTileSource = QUADKEYTileSource;\n", " QUADKEYTileSource.__name__ = \"QUADKEYTileSource\";\n", " },\n", " /* models/tiles/tile_renderer.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const wmts_tile_source_1 = require(315) /* ./wmts_tile_source */;\n", " const data_renderer_1 = require(82) /* ../renderers/data_renderer */;\n", " const range1d_1 = require(131) /* ../ranges/range1d */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const image_1 = require(224) /* ../../core/util/image */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const selection_manager_1 = require(80) /* ../../core/selection_manager */;\n", " const column_data_source_1 = require(76) /* ../sources/column_data_source */;\n", " const tiles_1 = require(316) /* ../../styles/tiles */;\n", " const tiles_css_1 = tslib_1.__importDefault(require(317) /* ../../styles/tiles.css */);\n", " class TileRendererView extends data_renderer_1.DataRendererView {\n", " initialize() {\n", " this._tiles = [];\n", " super.initialize();\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.change, () => this.request_render());\n", " this.connect(this.model.tile_source.change, () => this.request_render());\n", " }\n", " styles() {\n", " return [...super.styles(), tiles_css_1.default];\n", " }\n", " get_extent() {\n", " return [this.x_range.start, this.y_range.start, this.x_range.end, this.y_range.end];\n", " }\n", " get map_plot() {\n", " return this.plot_model;\n", " }\n", " get map_canvas() {\n", " return this.layer.ctx;\n", " }\n", " get map_frame() {\n", " return this.plot_view.frame;\n", " }\n", " get x_range() {\n", " return this.map_plot.x_range;\n", " }\n", " get y_range() {\n", " return this.map_plot.y_range;\n", " }\n", " _set_data() {\n", " this.extent = this.get_extent();\n", " this._last_height = undefined;\n", " this._last_width = undefined;\n", " }\n", " _update_attribution() {\n", " if (this.attribution_el != null)\n", " dom_1.removeElement(this.attribution_el);\n", " const { attribution } = this.model.tile_source;\n", " if (types_1.isString(attribution) && attribution.length > 0) {\n", " const { layout, frame } = this.plot_view;\n", " const offset_right = layout._width.value - frame._right.value;\n", " const offset_bottom = layout._height.value - frame._bottom.value;\n", " const max_width = frame._width.value;\n", " this.attribution_el = dom_1.div({\n", " class: tiles_1.bk_tile_attribution,\n", " style: {\n", " position: \"absolute\",\n", " right: `${offset_right}px`,\n", " bottom: `${offset_bottom}px`,\n", " 'max-width': `${max_width - 4 /*padding*/}px`,\n", " padding: \"2px\",\n", " 'background-color': 'rgba(255,255,255,0.5)',\n", " 'font-size': '9px',\n", " 'line-height': '1.05',\n", " 'white-space': 'nowrap',\n", " overflow: 'hidden',\n", " 'text-overflow': 'ellipsis',\n", " },\n", " });\n", " this.plot_view.canvas_view.add_event(this.attribution_el);\n", " this.attribution_el.innerHTML = attribution;\n", " this.attribution_el.title = this.attribution_el.textContent.replace(/\\s*\\n\\s*/g, \" \");\n", " }\n", " }\n", " _map_data() {\n", " this.initial_extent = this.get_extent();\n", " const zoom_level = this.model.tile_source.get_level_by_extent(this.initial_extent, this.map_frame._height.value, this.map_frame._width.value);\n", " const new_extent = this.model.tile_source.snap_to_zoom_level(this.initial_extent, this.map_frame._height.value, this.map_frame._width.value, zoom_level);\n", " this.x_range.start = new_extent[0];\n", " this.y_range.start = new_extent[1];\n", " this.x_range.end = new_extent[2];\n", " this.y_range.end = new_extent[3];\n", " if (this.x_range instanceof range1d_1.Range1d) {\n", " this.x_range.reset_start = new_extent[0];\n", " this.x_range.reset_end = new_extent[2];\n", " }\n", " if (this.y_range instanceof range1d_1.Range1d) {\n", " this.y_range.reset_start = new_extent[1];\n", " this.y_range.reset_end = new_extent[3];\n", " }\n", " this._update_attribution();\n", " }\n", " _create_tile(x, y, z, bounds, cache_only = false) {\n", " const [nx, ny, nz] = this.model.tile_source.normalize_xyz(x, y, z);\n", " const tile = {\n", " img: undefined,\n", " tile_coords: [x, y, z],\n", " normalized_coords: [nx, ny, nz],\n", " quadkey: this.model.tile_source.tile_xyz_to_quadkey(x, y, z),\n", " cache_key: this.model.tile_source.tile_xyz_to_key(x, y, z),\n", " bounds,\n", " loaded: false,\n", " finished: false,\n", " x_coord: bounds[0],\n", " y_coord: bounds[3],\n", " };\n", " const src = this.model.tile_source.get_image_url(nx, ny, nz);\n", " new image_1.ImageLoader(src, {\n", " loaded: (img) => {\n", " Object.assign(tile, { img, loaded: true });\n", " if (cache_only) {\n", " tile.finished = true;\n", " this.notify_finished();\n", " }\n", " else\n", " this.request_render();\n", " },\n", " failed() {\n", " tile.finished = true;\n", " },\n", " });\n", " this.model.tile_source.tiles.set(tile.cache_key, tile);\n", " this._tiles.push(tile);\n", " }\n", " _enforce_aspect_ratio() {\n", " // brute force way of handling resize or sizing_mode event -------------------------------------------------------------\n", " if ((this._last_height !== this.map_frame._height.value) || (this._last_width !== this.map_frame._width.value)) {\n", " const extent = this.get_extent();\n", " const zoom_level = this.model.tile_source.get_level_by_extent(extent, this.map_frame._height.value, this.map_frame._width.value);\n", " const new_extent = this.model.tile_source.snap_to_zoom_level(extent, this.map_frame._height.value, this.map_frame._width.value, zoom_level);\n", " this.x_range.setv({ start: new_extent[0], end: new_extent[2] });\n", " this.y_range.setv({ start: new_extent[1], end: new_extent[3] });\n", " this.extent = new_extent;\n", " this._last_height = this.map_frame._height.value;\n", " this._last_width = this.map_frame._width.value;\n", " }\n", " }\n", " has_finished() {\n", " if (!super.has_finished()) {\n", " return false;\n", " }\n", " if (this._tiles.length === 0) {\n", " return false;\n", " }\n", " for (const tile of this._tiles) {\n", " if (!tile.finished) {\n", " return false;\n", " }\n", " }\n", " return true;\n", " }\n", " render() {\n", " if (this.map_initialized == null) {\n", " this._set_data();\n", " this._map_data();\n", " this.map_initialized = true;\n", " }\n", " this._enforce_aspect_ratio();\n", " this._update();\n", " if (this.prefetch_timer != null) {\n", " clearTimeout(this.prefetch_timer);\n", " }\n", " this.prefetch_timer = setTimeout(this._prefetch_tiles.bind(this), 500);\n", " if (this.has_finished()) {\n", " this.notify_finished();\n", " }\n", " }\n", " _draw_tile(tile_key) {\n", " const tile_data = this.model.tile_source.tiles.get(tile_key);\n", " if (tile_data != null && tile_data.loaded) {\n", " const [[sxmin], [symin]] = this.plot_view.map_to_screen([tile_data.bounds[0]], [tile_data.bounds[3]]);\n", " const [[sxmax], [symax]] = this.plot_view.map_to_screen([tile_data.bounds[2]], [tile_data.bounds[1]]);\n", " const sw = sxmax - sxmin;\n", " const sh = symax - symin;\n", " const sx = sxmin;\n", " const sy = symin;\n", " const old_smoothing = this.map_canvas.getImageSmoothingEnabled();\n", " this.map_canvas.setImageSmoothingEnabled(this.model.smoothing);\n", " this.map_canvas.drawImage(tile_data.img, sx, sy, sw, sh);\n", " this.map_canvas.setImageSmoothingEnabled(old_smoothing);\n", " tile_data.finished = true;\n", " }\n", " }\n", " _set_rect() {\n", " const outline_width = this.plot_model.properties.outline_line_width.value();\n", " const l = this.map_frame._left.value + (outline_width / 2);\n", " const t = this.map_frame._top.value + (outline_width / 2);\n", " const w = this.map_frame._width.value - outline_width;\n", " const h = this.map_frame._height.value - outline_width;\n", " this.map_canvas.rect(l, t, w, h);\n", " this.map_canvas.clip();\n", " }\n", " _render_tiles(tile_keys) {\n", " this.map_canvas.save();\n", " this._set_rect();\n", " this.map_canvas.globalAlpha = this.model.alpha;\n", " for (const tile_key of tile_keys) {\n", " this._draw_tile(tile_key);\n", " }\n", " this.map_canvas.restore();\n", " }\n", " _prefetch_tiles() {\n", " const { tile_source } = this.model;\n", " const extent = this.get_extent();\n", " const h = this.map_frame._height.value;\n", " const w = this.map_frame._width.value;\n", " const zoom_level = this.model.tile_source.get_level_by_extent(extent, h, w);\n", " const tiles = this.model.tile_source.get_tiles_by_extent(extent, zoom_level);\n", " for (let t = 0, end = Math.min(10, tiles.length); t < end; t++) {\n", " const [x, y, z] = tiles[t];\n", " const children = this.model.tile_source.children_by_tile_xyz(x, y, z);\n", " for (const c of children) {\n", " const [cx, cy, cz, cbounds] = c;\n", " if (tile_source.tiles.has(tile_source.tile_xyz_to_key(cx, cy, cz))) {\n", " continue;\n", " }\n", " else {\n", " this._create_tile(cx, cy, cz, cbounds, true);\n", " }\n", " }\n", " }\n", " }\n", " _fetch_tiles(tiles) {\n", " for (const tile of tiles) {\n", " const [x, y, z, bounds] = tile;\n", " this._create_tile(x, y, z, bounds);\n", " }\n", " }\n", " _update() {\n", " const { tile_source } = this.model;\n", " const { min_zoom } = tile_source;\n", " const { max_zoom } = tile_source;\n", " let extent = this.get_extent();\n", " const zooming_out = (this.extent[2] - this.extent[0]) < (extent[2] - extent[0]);\n", " const h = this.map_frame._height.value;\n", " const w = this.map_frame._width.value;\n", " let zoom_level = tile_source.get_level_by_extent(extent, h, w);\n", " let snap_back = false;\n", " if (zoom_level < min_zoom) {\n", " extent = this.extent;\n", " zoom_level = min_zoom;\n", " snap_back = true;\n", " }\n", " else if (zoom_level > max_zoom) {\n", " extent = this.extent;\n", " zoom_level = max_zoom;\n", " snap_back = true;\n", " }\n", " if (snap_back) {\n", " this.x_range.setv({ x_range: { start: extent[0], end: extent[2] } });\n", " this.y_range.setv({ start: extent[1], end: extent[3] });\n", " }\n", " this.extent = extent;\n", " const tiles = tile_source.get_tiles_by_extent(extent, zoom_level);\n", " const need_load = [];\n", " const cached = [];\n", " const parents = [];\n", " const children = [];\n", " for (const t of tiles) {\n", " const [x, y, z] = t;\n", " const key = tile_source.tile_xyz_to_key(x, y, z);\n", " const tile = tile_source.tiles.get(key);\n", " if (tile != null && tile.loaded) {\n", " cached.push(key);\n", " }\n", " else {\n", " if (this.model.render_parents) {\n", " const [px, py, pz] = tile_source.get_closest_parent_by_tile_xyz(x, y, z);\n", " const parent_key = tile_source.tile_xyz_to_key(px, py, pz);\n", " const parent_tile = tile_source.tiles.get(parent_key);\n", " if ((parent_tile != null) && parent_tile.loaded && !array_1.includes(parents, parent_key)) {\n", " parents.push(parent_key);\n", " }\n", " if (zooming_out) {\n", " const child_tiles = tile_source.children_by_tile_xyz(x, y, z);\n", " for (const [cx, cy, cz] of child_tiles) {\n", " const child_key = tile_source.tile_xyz_to_key(cx, cy, cz);\n", " if (tile_source.tiles.has(child_key))\n", " children.push(child_key);\n", " }\n", " }\n", " }\n", " }\n", " if (tile == null)\n", " need_load.push(t);\n", " }\n", " // draw stand-in parents ----------\n", " this._render_tiles(parents);\n", " this._render_tiles(children);\n", " // draw cached ----------\n", " this._render_tiles(cached);\n", " // fetch missing -------\n", " if (this.render_timer != null) {\n", " clearTimeout(this.render_timer);\n", " }\n", " this.render_timer = setTimeout((() => this._fetch_tiles(need_load)), 65);\n", " }\n", " }\n", " exports.TileRendererView = TileRendererView;\n", " TileRendererView.__name__ = \"TileRendererView\";\n", " class TileRenderer extends data_renderer_1.DataRenderer {\n", " constructor(attrs) {\n", " super(attrs);\n", " // XXX: tile renderer doesn't allow selection, but needs to fulfil the APIs\n", " this._selection_manager = new selection_manager_1.SelectionManager({\n", " source: new column_data_source_1.ColumnDataSource(),\n", " });\n", " }\n", " static init_TileRenderer() {\n", " this.prototype.default_view = TileRendererView;\n", " this.define({\n", " alpha: [p.Number, 1.0],\n", " smoothing: [p.Boolean, true],\n", " tile_source: [p.Instance, () => new wmts_tile_source_1.WMTSTileSource()],\n", " render_parents: [p.Boolean, true],\n", " });\n", " }\n", " get_selection_manager() {\n", " return this._selection_manager;\n", " }\n", " }\n", " exports.TileRenderer = TileRenderer;\n", " TileRenderer.__name__ = \"TileRenderer\";\n", " TileRenderer.init_TileRenderer();\n", " },\n", " /* models/tiles/wmts_tile_source.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const mercator_tile_source_1 = require(310) /* ./mercator_tile_source */;\n", " class WMTSTileSource extends mercator_tile_source_1.MercatorTileSource {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " get_image_url(x, y, z) {\n", " const image_url = this.string_lookup_replace(this.url, this.extra_url_vars);\n", " const [wx, wy, wz] = this.tms_to_wmts(x, y, z);\n", " return image_url\n", " .replace(\"{X}\", wx.toString())\n", " .replace(\"{Y}\", wy.toString())\n", " .replace(\"{Z}\", wz.toString());\n", " }\n", " }\n", " exports.WMTSTileSource = WMTSTileSource;\n", " WMTSTileSource.__name__ = \"WMTSTileSource\";\n", " },\n", " /* styles/tiles.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.bk_tile_attribution = \"bk-tile-attribution\";\n", " },\n", " /* styles/tiles.css.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const css = `\n", " .bk-root .bk-tile-attribution a {\n", " color: black;\n", " }\n", " `;\n", " exports.default = css;\n", " },\n", " /* models/tiles/tms_tile_source.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const mercator_tile_source_1 = require(310) /* ./mercator_tile_source */;\n", " class TMSTileSource extends mercator_tile_source_1.MercatorTileSource {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " get_image_url(x, y, z) {\n", " const image_url = this.string_lookup_replace(this.url, this.extra_url_vars);\n", " return image_url\n", " .replace(\"{X}\", x.toString())\n", " .replace('{Y}', y.toString())\n", " .replace(\"{Z}\", z.toString());\n", " }\n", " }\n", " exports.TMSTileSource = TMSTileSource;\n", " TMSTileSource.__name__ = \"TMSTileSource\";\n", " },\n", " /* models/textures/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var canvas_texture_1 = require(320) /* ./canvas_texture */;\n", " exports.CanvasTexture = canvas_texture_1.CanvasTexture;\n", " var image_url_texture_1 = require(322) /* ./image_url_texture */;\n", " exports.ImageURLTexture = image_url_texture_1.ImageURLTexture;\n", " var texture_1 = require(321) /* ./texture */;\n", " exports.Texture = texture_1.Texture;\n", " },\n", " /* models/textures/canvas_texture.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const texture_1 = require(321) /* ./texture */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const string_1 = require(24) /* ../../core/util/string */;\n", " class CanvasTexture extends texture_1.Texture {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_CanvasTexture() {\n", " this.define({\n", " code: [p.String],\n", " });\n", " }\n", " get func() {\n", " const code = string_1.use_strict(this.code);\n", " return new Function(\"ctx\", \"color\", \"scale\", \"weight\", code);\n", " }\n", " get_pattern(color, scale, weight) {\n", " return (ctx) => {\n", " const canvas = document.createElement('canvas');\n", " canvas.width = scale;\n", " canvas.height = scale;\n", " const pattern_ctx = canvas.getContext('2d');\n", " this.func.call(this, pattern_ctx, color, scale, weight);\n", " return ctx.createPattern(canvas, this.repetition);\n", " };\n", " }\n", " }\n", " exports.CanvasTexture = CanvasTexture;\n", " CanvasTexture.__name__ = \"CanvasTexture\";\n", " CanvasTexture.init_CanvasTexture();\n", " },\n", " /* models/textures/texture.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const model_1 = require(71) /* ../../model */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class Texture extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Texture() {\n", " this.define({\n", " repetition: [p.TextureRepetition, \"repeat\"],\n", " });\n", " }\n", " onload(defer_func) {\n", " defer_func();\n", " }\n", " }\n", " exports.Texture = Texture;\n", " Texture.__name__ = \"Texture\";\n", " Texture.init_Texture();\n", " },\n", " /* models/textures/image_url_texture.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const texture_1 = require(321) /* ./texture */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const image_1 = require(224) /* ../../core/util/image */;\n", " class ImageURLTexture extends texture_1.Texture {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ImageURLTexture() {\n", " this.define({\n", " url: [p.String],\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " this._loader = new image_1.ImageLoader(this.url);\n", " }\n", " get_pattern(_color, _scale, _weight) {\n", " return (ctx) => {\n", " if (!this._loader.finished) {\n", " return null;\n", " }\n", " return ctx.createPattern(this._loader.image, this.repetition);\n", " };\n", " }\n", " onload(defer_func) {\n", " this._loader.promise.then(() => defer_func());\n", " }\n", " }\n", " exports.ImageURLTexture = ImageURLTexture;\n", " ImageURLTexture.__name__ = \"ImageURLTexture\";\n", " ImageURLTexture.init_ImageURLTexture();\n", " },\n", " /* models/tools/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var action_tool_1 = require(285) /* ./actions/action_tool */;\n", " exports.ActionTool = action_tool_1.ActionTool;\n", " var custom_action_1 = require(324) /* ./actions/custom_action */;\n", " exports.CustomAction = custom_action_1.CustomAction;\n", " var help_tool_1 = require(286) /* ./actions/help_tool */;\n", " exports.HelpTool = help_tool_1.HelpTool;\n", " var redo_tool_1 = require(325) /* ./actions/redo_tool */;\n", " exports.RedoTool = redo_tool_1.RedoTool;\n", " var reset_tool_1 = require(326) /* ./actions/reset_tool */;\n", " exports.ResetTool = reset_tool_1.ResetTool;\n", " var save_tool_1 = require(327) /* ./actions/save_tool */;\n", " exports.SaveTool = save_tool_1.SaveTool;\n", " var undo_tool_1 = require(328) /* ./actions/undo_tool */;\n", " exports.UndoTool = undo_tool_1.UndoTool;\n", " var zoom_in_tool_1 = require(329) /* ./actions/zoom_in_tool */;\n", " exports.ZoomInTool = zoom_in_tool_1.ZoomInTool;\n", " var zoom_out_tool_1 = require(331) /* ./actions/zoom_out_tool */;\n", " exports.ZoomOutTool = zoom_out_tool_1.ZoomOutTool;\n", " var button_tool_1 = require(275) /* ./button_tool */;\n", " exports.ButtonTool = button_tool_1.ButtonTool;\n", " var edit_tool_1 = require(332) /* ./edit/edit_tool */;\n", " exports.EditTool = edit_tool_1.EditTool;\n", " var box_edit_tool_1 = require(333) /* ./edit/box_edit_tool */;\n", " exports.BoxEditTool = box_edit_tool_1.BoxEditTool;\n", " var freehand_draw_tool_1 = require(334) /* ./edit/freehand_draw_tool */;\n", " exports.FreehandDrawTool = freehand_draw_tool_1.FreehandDrawTool;\n", " var point_draw_tool_1 = require(335) /* ./edit/point_draw_tool */;\n", " exports.PointDrawTool = point_draw_tool_1.PointDrawTool;\n", " var poly_draw_tool_1 = require(336) /* ./edit/poly_draw_tool */;\n", " exports.PolyDrawTool = poly_draw_tool_1.PolyDrawTool;\n", " var poly_tool_1 = require(337) /* ./edit/poly_tool */;\n", " exports.PolyTool = poly_tool_1.PolyTool;\n", " var poly_edit_tool_1 = require(338) /* ./edit/poly_edit_tool */;\n", " exports.PolyEditTool = poly_edit_tool_1.PolyEditTool;\n", " var box_select_tool_1 = require(339) /* ./gestures/box_select_tool */;\n", " exports.BoxSelectTool = box_select_tool_1.BoxSelectTool;\n", " var box_zoom_tool_1 = require(342) /* ./gestures/box_zoom_tool */;\n", " exports.BoxZoomTool = box_zoom_tool_1.BoxZoomTool;\n", " var gesture_tool_1 = require(284) /* ./gestures/gesture_tool */;\n", " exports.GestureTool = gesture_tool_1.GestureTool;\n", " var lasso_select_tool_1 = require(343) /* ./gestures/lasso_select_tool */;\n", " exports.LassoSelectTool = lasso_select_tool_1.LassoSelectTool;\n", " var line_edit_tool_1 = require(344) /* ./edit/line_edit_tool */;\n", " exports.LineEditTool = line_edit_tool_1.LineEditTool;\n", " var pan_tool_1 = require(346) /* ./gestures/pan_tool */;\n", " exports.PanTool = pan_tool_1.PanTool;\n", " var poly_select_tool_1 = require(347) /* ./gestures/poly_select_tool */;\n", " exports.PolySelectTool = poly_select_tool_1.PolySelectTool;\n", " var range_tool_1 = require(348) /* ./gestures/range_tool */;\n", " exports.RangeTool = range_tool_1.RangeTool;\n", " var select_tool_1 = require(340) /* ./gestures/select_tool */;\n", " exports.SelectTool = select_tool_1.SelectTool;\n", " var tap_tool_1 = require(349) /* ./gestures/tap_tool */;\n", " exports.TapTool = tap_tool_1.TapTool;\n", " var wheel_pan_tool_1 = require(350) /* ./gestures/wheel_pan_tool */;\n", " exports.WheelPanTool = wheel_pan_tool_1.WheelPanTool;\n", " var wheel_zoom_tool_1 = require(351) /* ./gestures/wheel_zoom_tool */;\n", " exports.WheelZoomTool = wheel_zoom_tool_1.WheelZoomTool;\n", " var crosshair_tool_1 = require(352) /* ./inspectors/crosshair_tool */;\n", " exports.CrosshairTool = crosshair_tool_1.CrosshairTool;\n", " var customjs_hover_1 = require(353) /* ./inspectors/customjs_hover */;\n", " exports.CustomJSHover = customjs_hover_1.CustomJSHover;\n", " var hover_tool_1 = require(354) /* ./inspectors/hover_tool */;\n", " exports.HoverTool = hover_tool_1.HoverTool;\n", " var inspect_tool_1 = require(274) /* ./inspectors/inspect_tool */;\n", " exports.InspectTool = inspect_tool_1.InspectTool;\n", " var tool_1 = require(277) /* ./tool */;\n", " exports.Tool = tool_1.Tool;\n", " var tool_proxy_1 = require(355) /* ./tool_proxy */;\n", " exports.ToolProxy = tool_proxy_1.ToolProxy;\n", " var toolbar_1 = require(273) /* ./toolbar */;\n", " exports.Toolbar = toolbar_1.Toolbar;\n", " var toolbar_base_1 = require(283) /* ./toolbar_base */;\n", " exports.ToolbarBase = toolbar_base_1.ToolbarBase;\n", " var toolbar_box_1 = require(357) /* ./toolbar_box */;\n", " exports.ProxyToolbar = toolbar_box_1.ProxyToolbar;\n", " var toolbar_box_2 = require(357) /* ./toolbar_box */;\n", " exports.ToolbarBox = toolbar_box_2.ToolbarBox;\n", " },\n", " /* models/tools/actions/custom_action.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const action_tool_1 = require(285) /* ./action_tool */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const toolbar_1 = require(278) /* ../../../styles/toolbar */;\n", " class CustomActionButtonView extends action_tool_1.ActionToolButtonView {\n", " css_classes() {\n", " return super.css_classes().concat(toolbar_1.bk_toolbar_button_custom_action);\n", " }\n", " }\n", " exports.CustomActionButtonView = CustomActionButtonView;\n", " CustomActionButtonView.__name__ = \"CustomActionButtonView\";\n", " class CustomActionView extends action_tool_1.ActionToolView {\n", " doit() {\n", " if (this.model.callback != null)\n", " this.model.callback.execute(this.model);\n", " }\n", " }\n", " exports.CustomActionView = CustomActionView;\n", " CustomActionView.__name__ = \"CustomActionView\";\n", " class CustomAction extends action_tool_1.ActionTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Custom Action\";\n", " this.button_view = CustomActionButtonView;\n", " }\n", " static init_CustomAction() {\n", " this.prototype.default_view = CustomActionView;\n", " this.define({\n", " action_tooltip: [p.String, 'Perform a Custom Action'],\n", " callback: [p.Any],\n", " icon: [p.String],\n", " });\n", " }\n", " get tooltip() {\n", " return this.action_tooltip;\n", " }\n", " }\n", " exports.CustomAction = CustomAction;\n", " CustomAction.__name__ = \"CustomAction\";\n", " CustomAction.init_CustomAction();\n", " },\n", " /* models/tools/actions/redo_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const action_tool_1 = require(285) /* ./action_tool */;\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class RedoToolView extends action_tool_1.ActionToolView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.plot_view.state_changed, () => this.model.disabled = !this.plot_view.can_redo());\n", " }\n", " doit() {\n", " this.plot_view.redo();\n", " }\n", " }\n", " exports.RedoToolView = RedoToolView;\n", " RedoToolView.__name__ = \"RedoToolView\";\n", " class RedoTool extends action_tool_1.ActionTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Redo\";\n", " this.icon = icons_1.bk_tool_icon_redo;\n", " }\n", " static init_RedoTool() {\n", " this.prototype.default_view = RedoToolView;\n", " this.override({\n", " disabled: true,\n", " });\n", " this.register_alias(\"redo\", () => new RedoTool());\n", " }\n", " }\n", " exports.RedoTool = RedoTool;\n", " RedoTool.__name__ = \"RedoTool\";\n", " RedoTool.init_RedoTool();\n", " },\n", " /* models/tools/actions/reset_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const action_tool_1 = require(285) /* ./action_tool */;\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class ResetToolView extends action_tool_1.ActionToolView {\n", " doit() {\n", " this.plot_view.reset();\n", " }\n", " }\n", " exports.ResetToolView = ResetToolView;\n", " ResetToolView.__name__ = \"ResetToolView\";\n", " class ResetTool extends action_tool_1.ActionTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Reset\";\n", " this.icon = icons_1.bk_tool_icon_reset;\n", " }\n", " static init_ResetTool() {\n", " this.prototype.default_view = ResetToolView;\n", " this.register_alias(\"reset\", () => new ResetTool());\n", " }\n", " }\n", " exports.ResetTool = ResetTool;\n", " ResetTool.__name__ = \"ResetTool\";\n", " ResetTool.init_ResetTool();\n", " },\n", " /* models/tools/actions/save_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const action_tool_1 = require(285) /* ./action_tool */;\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class SaveToolView extends action_tool_1.ActionToolView {\n", " doit() {\n", " this.plot_view.save(\"bokeh_plot\");\n", " }\n", " }\n", " exports.SaveToolView = SaveToolView;\n", " SaveToolView.__name__ = \"SaveToolView\";\n", " class SaveTool extends action_tool_1.ActionTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Save\";\n", " this.icon = icons_1.bk_tool_icon_save;\n", " }\n", " static init_SaveTool() {\n", " this.prototype.default_view = SaveToolView;\n", " this.register_alias(\"save\", () => new SaveTool());\n", " }\n", " }\n", " exports.SaveTool = SaveTool;\n", " SaveTool.__name__ = \"SaveTool\";\n", " SaveTool.init_SaveTool();\n", " },\n", " /* models/tools/actions/undo_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const action_tool_1 = require(285) /* ./action_tool */;\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class UndoToolView extends action_tool_1.ActionToolView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.plot_view.state_changed, () => this.model.disabled = !this.plot_view.can_undo());\n", " }\n", " doit() {\n", " this.plot_view.undo();\n", " }\n", " }\n", " exports.UndoToolView = UndoToolView;\n", " UndoToolView.__name__ = \"UndoToolView\";\n", " class UndoTool extends action_tool_1.ActionTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Undo\";\n", " this.icon = icons_1.bk_tool_icon_undo;\n", " }\n", " static init_UndoTool() {\n", " this.prototype.default_view = UndoToolView;\n", " this.override({\n", " disabled: true,\n", " });\n", " this.register_alias(\"undo\", () => new UndoTool());\n", " }\n", " }\n", " exports.UndoTool = UndoTool;\n", " UndoTool.__name__ = \"UndoTool\";\n", " UndoTool.init_UndoTool();\n", " },\n", " /* models/tools/actions/zoom_in_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const action_tool_1 = require(285) /* ./action_tool */;\n", " const zoom_1 = require(330) /* ../../../core/util/zoom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class ZoomInToolView extends action_tool_1.ActionToolView {\n", " doit() {\n", " const frame = this.plot_view.frame;\n", " const dims = this.model.dimensions;\n", " // restrict to axis configured in tool's dimensions property\n", " const h_axis = dims == 'width' || dims == 'both';\n", " const v_axis = dims == 'height' || dims == 'both';\n", " const zoom_info = zoom_1.scale_range(frame, this.model.factor, h_axis, v_axis);\n", " this.plot_view.push_state('zoom_out', { range: zoom_info });\n", " this.plot_view.update_range(zoom_info, false, true);\n", " if (this.model.document)\n", " this.model.document.interactive_start(this.plot_model);\n", " }\n", " }\n", " exports.ZoomInToolView = ZoomInToolView;\n", " ZoomInToolView.__name__ = \"ZoomInToolView\";\n", " class ZoomInTool extends action_tool_1.ActionTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Zoom In\";\n", " this.icon = icons_1.bk_tool_icon_zoom_in;\n", " }\n", " static init_ZoomInTool() {\n", " this.prototype.default_view = ZoomInToolView;\n", " this.define({\n", " factor: [p.Percent, 0.1],\n", " dimensions: [p.Dimensions, \"both\"],\n", " });\n", " this.register_alias(\"zoom_in\", () => new ZoomInTool({ dimensions: 'both' }));\n", " this.register_alias(\"xzoom_in\", () => new ZoomInTool({ dimensions: 'width' }));\n", " this.register_alias(\"yzoom_in\", () => new ZoomInTool({ dimensions: 'height' }));\n", " }\n", " get tooltip() {\n", " return this._get_dim_tooltip(this.tool_name, this.dimensions);\n", " }\n", " }\n", " exports.ZoomInTool = ZoomInTool;\n", " ZoomInTool.__name__ = \"ZoomInTool\";\n", " ZoomInTool.init_ZoomInTool();\n", " },\n", " /* core/util/zoom.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const math_1 = require(10) /* ./math */;\n", " // Module for zoom-related functions\n", " function scale_highlow(range, factor, center) {\n", " const [low, high] = [range.start, range.end];\n", " const x = center != null ? center : (high + low) / 2.0;\n", " const x0 = low - (low - x) * factor;\n", " const x1 = high - (high - x) * factor;\n", " return [x0, x1];\n", " }\n", " exports.scale_highlow = scale_highlow;\n", " function get_info(scales, [sxy0, sxy1]) {\n", " const info = {};\n", " for (const name in scales) {\n", " const scale = scales[name];\n", " const [start, end] = scale.r_invert(sxy0, sxy1);\n", " info[name] = { start, end };\n", " }\n", " return info;\n", " }\n", " exports.get_info = get_info;\n", " function scale_range(frame, factor, h_axis = true, v_axis = true, center) {\n", " /*\n", " * Utility function for zoom tools to calculate/create the zoom_info object\n", " * of the form required by ``PlotView.update_range``\n", " *\n", " * Parameters:\n", " * frame : CartesianFrame\n", " * factor : Number\n", " * h_axis : Boolean, optional\n", " * whether to zoom the horizontal axis (default = true)\n", " * v_axis : Boolean, optional\n", " * whether to zoom the horizontal axis (default = true)\n", " * center : object, optional\n", " * of form {'x': Number, 'y', Number}\n", " *\n", " * Returns:\n", " * object:\n", " */\n", " // clamp the magnitude of factor, if it is > 1 bad things happen\n", " factor = math_1.clamp(factor, -0.9, 0.9);\n", " const hfactor = h_axis ? factor : 0;\n", " const [sx0, sx1] = scale_highlow(frame.bbox.h_range, hfactor, center != null ? center.x : undefined);\n", " const xrs = get_info(frame.xscales, [sx0, sx1]);\n", " const vfactor = v_axis ? factor : 0;\n", " const [sy0, sy1] = scale_highlow(frame.bbox.v_range, vfactor, center != null ? center.y : undefined);\n", " const yrs = get_info(frame.yscales, [sy0, sy1]);\n", " // OK this sucks we can't set factor independently in each direction. It is used\n", " // for GMap plots, and GMap plots always preserve aspect, so effective the value\n", " // of 'dimensions' is ignored.\n", " return { xrs, yrs, factor };\n", " }\n", " exports.scale_range = scale_range;\n", " },\n", " /* models/tools/actions/zoom_out_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const action_tool_1 = require(285) /* ./action_tool */;\n", " const zoom_1 = require(330) /* ../../../core/util/zoom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class ZoomOutToolView extends action_tool_1.ActionToolView {\n", " doit() {\n", " const frame = this.plot_view.frame;\n", " const dims = this.model.dimensions;\n", " // restrict to axis configured in tool's dimensions property\n", " const h_axis = dims == 'width' || dims == 'both';\n", " const v_axis = dims == 'height' || dims == 'both';\n", " // zooming out requires a negative factor to scale_range\n", " const zoom_info = zoom_1.scale_range(frame, -this.model.factor, h_axis, v_axis);\n", " this.plot_view.push_state('zoom_out', { range: zoom_info });\n", " this.plot_view.update_range(zoom_info, false, true);\n", " if (this.model.document)\n", " this.model.document.interactive_start(this.plot_model);\n", " }\n", " }\n", " exports.ZoomOutToolView = ZoomOutToolView;\n", " ZoomOutToolView.__name__ = \"ZoomOutToolView\";\n", " class ZoomOutTool extends action_tool_1.ActionTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Zoom Out\";\n", " this.icon = icons_1.bk_tool_icon_zoom_out;\n", " }\n", " static init_ZoomOutTool() {\n", " this.prototype.default_view = ZoomOutToolView;\n", " this.define({\n", " factor: [p.Percent, 0.1],\n", " dimensions: [p.Dimensions, \"both\"],\n", " });\n", " this.register_alias(\"zoom_out\", () => new ZoomOutTool({ dimensions: 'both' }));\n", " this.register_alias(\"xzoom_out\", () => new ZoomOutTool({ dimensions: 'width' }));\n", " this.register_alias(\"yzoom_out\", () => new ZoomOutTool({ dimensions: 'height' }));\n", " }\n", " get tooltip() {\n", " return this._get_dim_tooltip(this.tool_name, this.dimensions);\n", " }\n", " }\n", " exports.ZoomOutTool = ZoomOutTool;\n", " ZoomOutTool.__name__ = \"ZoomOutTool\";\n", " ZoomOutTool.init_ZoomOutTool();\n", " },\n", " /* models/tools/edit/edit_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const array_1 = require(9) /* ../../../core/util/array */;\n", " const types_1 = require(8) /* ../../../core/util/types */;\n", " const assert_1 = require(11) /* ../../../core/util/assert */;\n", " const gesture_tool_1 = require(284) /* ../gestures/gesture_tool */;\n", " class EditToolView extends gesture_tool_1.GestureToolView {\n", " constructor() {\n", " super(...arguments);\n", " this._mouse_in_frame = true;\n", " }\n", " _select_mode(ev) {\n", " const { shiftKey, ctrlKey } = ev;\n", " if (!shiftKey && !ctrlKey)\n", " return \"replace\";\n", " else if (shiftKey && !ctrlKey)\n", " return \"append\";\n", " else if (!shiftKey && ctrlKey)\n", " return \"intersect\";\n", " else if (shiftKey && ctrlKey)\n", " return \"subtract\";\n", " else\n", " assert_1.unreachable();\n", " }\n", " _move_enter(_e) {\n", " this._mouse_in_frame = true;\n", " }\n", " _move_exit(_e) {\n", " this._mouse_in_frame = false;\n", " }\n", " _map_drag(sx, sy, renderer) {\n", " // Maps screen to data coordinates\n", " const frame = this.plot_view.frame;\n", " if (!frame.bbox.contains(sx, sy)) {\n", " return null;\n", " }\n", " const x = frame.xscales[renderer.x_range_name].invert(sx);\n", " const y = frame.yscales[renderer.y_range_name].invert(sy);\n", " return [x, y];\n", " }\n", " _delete_selected(renderer) {\n", " // Deletes all selected rows in the ColumnDataSource\n", " const cds = renderer.data_source;\n", " const indices = cds.selected.indices;\n", " indices.sort();\n", " for (const column of cds.columns()) {\n", " const values = cds.get_array(column);\n", " for (let index = 0; index < indices.length; index++) {\n", " const ind = indices[index];\n", " values.splice(ind - index, 1);\n", " }\n", " }\n", " this._emit_cds_changes(cds);\n", " }\n", " _pop_glyphs(cds, num_objects) {\n", " // Pops rows in the CDS until only num_objects are left\n", " const columns = cds.columns();\n", " if (!num_objects || !columns.length)\n", " return;\n", " for (const column of columns) {\n", " let array = cds.get_array(column);\n", " const drop = array.length - num_objects + 1;\n", " if (drop < 1)\n", " continue;\n", " if (!types_1.isArray(array)) {\n", " array = Array.from(array);\n", " cds.data[column] = array;\n", " }\n", " array.splice(0, drop);\n", " }\n", " }\n", " _emit_cds_changes(cds, redraw = true, clear = true, emit = true) {\n", " if (clear)\n", " cds.selection_manager.clear();\n", " if (redraw)\n", " cds.change.emit();\n", " if (emit) {\n", " cds.data = cds.data;\n", " cds.properties.data.change.emit();\n", " }\n", " }\n", " _drag_points(ev, renderers, dim = \"both\") {\n", " if (this._basepoint == null)\n", " return;\n", " const [bx, by] = this._basepoint;\n", " for (const renderer of renderers) {\n", " const basepoint = this._map_drag(bx, by, renderer);\n", " const point = this._map_drag(ev.sx, ev.sy, renderer);\n", " if (point == null || basepoint == null) {\n", " continue;\n", " }\n", " const [x, y] = point;\n", " const [px, py] = basepoint;\n", " const [dx, dy] = [x - px, y - py];\n", " // Type once dataspecs are typed\n", " const glyph = renderer.glyph;\n", " const cds = renderer.data_source;\n", " const [xkey, ykey] = [glyph.x.field, glyph.y.field];\n", " for (const index of cds.selected.indices) {\n", " if (xkey && (dim == \"width\" || dim == \"both\")) {\n", " cds.data[xkey][index] += dx;\n", " }\n", " if (ykey && (dim == \"height\" || dim == \"both\")) {\n", " cds.data[ykey][index] += dy;\n", " }\n", " }\n", " cds.change.emit();\n", " }\n", " this._basepoint = [ev.sx, ev.sy];\n", " }\n", " _pad_empty_columns(cds, coord_columns) {\n", " // Pad ColumnDataSource non-coordinate columns with empty_value\n", " for (const column of cds.columns()) {\n", " if (!array_1.includes(coord_columns, column))\n", " cds.get_array(column).push(this.model.empty_value);\n", " }\n", " }\n", " _select_event(ev, mode, renderers) {\n", " // Process selection event on the supplied renderers and return selected renderers\n", " const frame = this.plot_view.frame;\n", " const { sx, sy } = ev;\n", " if (!frame.bbox.contains(sx, sy)) {\n", " return [];\n", " }\n", " const geometry = { type: 'point', sx, sy };\n", " const selected = [];\n", " for (const renderer of renderers) {\n", " const sm = renderer.get_selection_manager();\n", " const cds = renderer.data_source;\n", " const views = [this.plot_view.renderer_views.get(renderer)];\n", " const did_hit = sm.select(views, geometry, true, mode);\n", " if (did_hit) {\n", " selected.push(renderer);\n", " }\n", " cds.properties.selected.change.emit();\n", " }\n", " return selected;\n", " }\n", " }\n", " exports.EditToolView = EditToolView;\n", " EditToolView.__name__ = \"EditToolView\";\n", " class EditTool extends gesture_tool_1.GestureTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_EditTool() {\n", " this.define({\n", " custom_icon: [p.String],\n", " custom_tooltip: [p.String],\n", " empty_value: [p.Any],\n", " renderers: [p.Array, []],\n", " });\n", " }\n", " get tooltip() {\n", " return this.custom_tooltip || this.tool_name;\n", " }\n", " get computed_icon() {\n", " return this.custom_icon || this.icon;\n", " }\n", " }\n", " exports.EditTool = EditTool;\n", " EditTool.__name__ = \"EditTool\";\n", " EditTool.init_EditTool();\n", " },\n", " /* models/tools/edit/box_edit_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const dom_1 = require(68) /* ../../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const edit_tool_1 = require(332) /* ./edit_tool */;\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class BoxEditToolView extends edit_tool_1.EditToolView {\n", " _tap(ev) {\n", " if ((this._draw_basepoint != null) || (this._basepoint != null))\n", " return;\n", " this._select_event(ev, this._select_mode(ev), this.model.renderers);\n", " }\n", " _keyup(ev) {\n", " if (!this.model.active || !this._mouse_in_frame)\n", " return;\n", " for (const renderer of this.model.renderers) {\n", " if (ev.keyCode === dom_1.Keys.Backspace) {\n", " this._delete_selected(renderer);\n", " }\n", " else if (ev.keyCode == dom_1.Keys.Esc) {\n", " // Type properly once selection_manager is typed\n", " const cds = renderer.data_source;\n", " cds.selection_manager.clear();\n", " }\n", " }\n", " }\n", " _set_extent([sx0, sx1], [sy0, sy1], append, emit = false) {\n", " const renderer = this.model.renderers[0];\n", " const frame = this.plot_view.frame;\n", " // Type once dataspecs are typed\n", " const glyph = renderer.glyph;\n", " const cds = renderer.data_source;\n", " const xscale = frame.xscales[renderer.x_range_name];\n", " const yscale = frame.yscales[renderer.y_range_name];\n", " const [x0, x1] = xscale.r_invert(sx0, sx1);\n", " const [y0, y1] = yscale.r_invert(sy0, sy1);\n", " const [x, y] = [(x0 + x1) / 2, (y0 + y1) / 2];\n", " const [w, h] = [x1 - x0, y1 - y0];\n", " const [xkey, ykey] = [glyph.x.field, glyph.y.field];\n", " const [wkey, hkey] = [glyph.width.field, glyph.height.field];\n", " if (append) {\n", " this._pop_glyphs(cds, this.model.num_objects);\n", " if (xkey)\n", " cds.get_array(xkey).push(x);\n", " if (ykey)\n", " cds.get_array(ykey).push(y);\n", " if (wkey)\n", " cds.get_array(wkey).push(w);\n", " if (hkey)\n", " cds.get_array(hkey).push(h);\n", " this._pad_empty_columns(cds, [xkey, ykey, wkey, hkey]);\n", " }\n", " else {\n", " const index = cds.data[xkey].length - 1;\n", " if (xkey)\n", " cds.data[xkey][index] = x;\n", " if (ykey)\n", " cds.data[ykey][index] = y;\n", " if (wkey)\n", " cds.data[wkey][index] = w;\n", " if (hkey)\n", " cds.data[hkey][index] = h;\n", " }\n", " this._emit_cds_changes(cds, true, false, emit);\n", " }\n", " _update_box(ev, append = false, emit = false) {\n", " if (this._draw_basepoint == null)\n", " return;\n", " const curpoint = [ev.sx, ev.sy];\n", " const frame = this.plot_view.frame;\n", " const dims = this.model.dimensions;\n", " const limits = this.model._get_dim_limits(this._draw_basepoint, curpoint, frame, dims);\n", " if (limits != null) {\n", " const [sxlim, sylim] = limits;\n", " this._set_extent(sxlim, sylim, append, emit);\n", " }\n", " }\n", " _doubletap(ev) {\n", " if (!this.model.active)\n", " return;\n", " if (this._draw_basepoint != null) {\n", " this._update_box(ev, false, true);\n", " this._draw_basepoint = null;\n", " }\n", " else {\n", " this._draw_basepoint = [ev.sx, ev.sy];\n", " this._select_event(ev, \"append\", this.model.renderers);\n", " this._update_box(ev, true, false);\n", " }\n", " }\n", " _move(ev) {\n", " this._update_box(ev, false, false);\n", " }\n", " _pan_start(ev) {\n", " if (ev.shiftKey) {\n", " if (this._draw_basepoint != null)\n", " return;\n", " this._draw_basepoint = [ev.sx, ev.sy];\n", " this._update_box(ev, true, false);\n", " }\n", " else {\n", " if (this._basepoint != null)\n", " return;\n", " this._select_event(ev, \"append\", this.model.renderers);\n", " this._basepoint = [ev.sx, ev.sy];\n", " }\n", " }\n", " _pan(ev, append = false, emit = false) {\n", " if (ev.shiftKey) {\n", " if (this._draw_basepoint == null)\n", " return;\n", " this._update_box(ev, append, emit);\n", " }\n", " else {\n", " if (this._basepoint == null)\n", " return;\n", " this._drag_points(ev, this.model.renderers);\n", " }\n", " }\n", " _pan_end(ev) {\n", " this._pan(ev, false, true);\n", " if (ev.shiftKey) {\n", " this._draw_basepoint = null;\n", " }\n", " else {\n", " this._basepoint = null;\n", " for (const renderer of this.model.renderers)\n", " this._emit_cds_changes(renderer.data_source, false, true, true);\n", " }\n", " }\n", " }\n", " exports.BoxEditToolView = BoxEditToolView;\n", " BoxEditToolView.__name__ = \"BoxEditToolView\";\n", " class BoxEditTool extends edit_tool_1.EditTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Box Edit Tool\";\n", " this.icon = icons_1.bk_tool_icon_box_edit;\n", " this.event_type = [\"tap\", \"pan\", \"move\"];\n", " this.default_order = 1;\n", " }\n", " static init_BoxEditTool() {\n", " this.prototype.default_view = BoxEditToolView;\n", " this.define({\n", " dimensions: [p.Dimensions, \"both\"],\n", " num_objects: [p.Int, 0],\n", " });\n", " }\n", " }\n", " exports.BoxEditTool = BoxEditTool;\n", " BoxEditTool.__name__ = \"BoxEditTool\";\n", " BoxEditTool.init_BoxEditTool();\n", " },\n", " /* models/tools/edit/freehand_draw_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const dom_1 = require(68) /* ../../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const types_1 = require(8) /* ../../../core/util/types */;\n", " const edit_tool_1 = require(332) /* ./edit_tool */;\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class FreehandDrawToolView extends edit_tool_1.EditToolView {\n", " _draw(ev, mode, emit = false) {\n", " if (!this.model.active)\n", " return;\n", " const renderer = this.model.renderers[0];\n", " const point = this._map_drag(ev.sx, ev.sy, renderer);\n", " if (point == null)\n", " return;\n", " const [x, y] = point;\n", " const cds = renderer.data_source;\n", " const glyph = renderer.glyph;\n", " const [xkey, ykey] = [glyph.xs.field, glyph.ys.field];\n", " if (mode == 'new') {\n", " this._pop_glyphs(cds, this.model.num_objects);\n", " if (xkey)\n", " cds.get_array(xkey).push([x]);\n", " if (ykey)\n", " cds.get_array(ykey).push([y]);\n", " this._pad_empty_columns(cds, [xkey, ykey]);\n", " }\n", " else if (mode == 'add') {\n", " if (xkey) {\n", " const xidx = cds.data[xkey].length - 1;\n", " let xs = cds.get_array(xkey)[xidx];\n", " if (!types_1.isArray(xs)) {\n", " xs = Array.from(xs);\n", " cds.data[xkey][xidx] = xs;\n", " }\n", " xs.push(x);\n", " }\n", " if (ykey) {\n", " const yidx = cds.data[ykey].length - 1;\n", " let ys = cds.get_array(ykey)[yidx];\n", " if (!types_1.isArray(ys)) {\n", " ys = Array.from(ys);\n", " cds.data[ykey][yidx] = ys;\n", " }\n", " ys.push(y);\n", " }\n", " }\n", " this._emit_cds_changes(cds, true, true, emit);\n", " }\n", " _pan_start(ev) {\n", " this._draw(ev, 'new');\n", " }\n", " _pan(ev) {\n", " this._draw(ev, 'add');\n", " }\n", " _pan_end(ev) {\n", " this._draw(ev, 'add', true);\n", " }\n", " _tap(ev) {\n", " this._select_event(ev, this._select_mode(ev), this.model.renderers);\n", " }\n", " _keyup(ev) {\n", " if (!this.model.active || !this._mouse_in_frame)\n", " return;\n", " for (const renderer of this.model.renderers) {\n", " if (ev.keyCode === dom_1.Keys.Esc) {\n", " renderer.data_source.selection_manager.clear();\n", " }\n", " else if (ev.keyCode === dom_1.Keys.Backspace) {\n", " this._delete_selected(renderer);\n", " }\n", " }\n", " }\n", " }\n", " exports.FreehandDrawToolView = FreehandDrawToolView;\n", " FreehandDrawToolView.__name__ = \"FreehandDrawToolView\";\n", " class FreehandDrawTool extends edit_tool_1.EditTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Freehand Draw Tool\";\n", " this.icon = icons_1.bk_tool_icon_freehand_draw;\n", " this.event_type = [\"pan\", \"tap\"];\n", " this.default_order = 3;\n", " }\n", " static init_FreehandDrawTool() {\n", " this.prototype.default_view = FreehandDrawToolView;\n", " this.define({\n", " num_objects: [p.Int, 0],\n", " });\n", " }\n", " }\n", " exports.FreehandDrawTool = FreehandDrawTool;\n", " FreehandDrawTool.__name__ = \"FreehandDrawTool\";\n", " FreehandDrawTool.init_FreehandDrawTool();\n", " },\n", " /* models/tools/edit/point_draw_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const dom_1 = require(68) /* ../../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const edit_tool_1 = require(332) /* ./edit_tool */;\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class PointDrawToolView extends edit_tool_1.EditToolView {\n", " _tap(ev) {\n", " const renderers = this._select_event(ev, this._select_mode(ev), this.model.renderers);\n", " if (renderers.length || !this.model.add) {\n", " return;\n", " }\n", " const renderer = this.model.renderers[0];\n", " const point = this._map_drag(ev.sx, ev.sy, renderer);\n", " if (point == null)\n", " return;\n", " // Type once dataspecs are typed\n", " const glyph = renderer.glyph;\n", " const cds = renderer.data_source;\n", " const [xkey, ykey] = [glyph.x.field, glyph.y.field];\n", " const [x, y] = point;\n", " this._pop_glyphs(cds, this.model.num_objects);\n", " if (xkey)\n", " cds.get_array(xkey).push(x);\n", " if (ykey)\n", " cds.get_array(ykey).push(y);\n", " this._pad_empty_columns(cds, [xkey, ykey]);\n", " cds.change.emit();\n", " cds.data = cds.data;\n", " cds.properties.data.change.emit();\n", " }\n", " _keyup(ev) {\n", " if (!this.model.active || !this._mouse_in_frame)\n", " return;\n", " for (const renderer of this.model.renderers) {\n", " if (ev.keyCode === dom_1.Keys.Backspace) {\n", " this._delete_selected(renderer);\n", " }\n", " else if (ev.keyCode == dom_1.Keys.Esc) {\n", " renderer.data_source.selection_manager.clear();\n", " }\n", " }\n", " }\n", " _pan_start(ev) {\n", " if (!this.model.drag)\n", " return;\n", " this._select_event(ev, \"append\", this.model.renderers);\n", " this._basepoint = [ev.sx, ev.sy];\n", " }\n", " _pan(ev) {\n", " if (!this.model.drag || this._basepoint == null)\n", " return;\n", " this._drag_points(ev, this.model.renderers);\n", " }\n", " _pan_end(ev) {\n", " if (!this.model.drag)\n", " return;\n", " this._pan(ev);\n", " for (const renderer of this.model.renderers)\n", " this._emit_cds_changes(renderer.data_source, false, true, true);\n", " this._basepoint = null;\n", " }\n", " }\n", " exports.PointDrawToolView = PointDrawToolView;\n", " PointDrawToolView.__name__ = \"PointDrawToolView\";\n", " class PointDrawTool extends edit_tool_1.EditTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Point Draw Tool\";\n", " this.icon = icons_1.bk_tool_icon_point_draw;\n", " this.event_type = [\"tap\", \"pan\", \"move\"];\n", " this.default_order = 2;\n", " }\n", " static init_PointDrawTool() {\n", " this.prototype.default_view = PointDrawToolView;\n", " this.define({\n", " add: [p.Boolean, true],\n", " drag: [p.Boolean, true],\n", " num_objects: [p.Int, 0],\n", " });\n", " }\n", " }\n", " exports.PointDrawTool = PointDrawTool;\n", " PointDrawTool.__name__ = \"PointDrawTool\";\n", " PointDrawTool.init_PointDrawTool();\n", " },\n", " /* models/tools/edit/poly_draw_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const dom_1 = require(68) /* ../../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const types_1 = require(8) /* ../../../core/util/types */;\n", " const poly_tool_1 = require(337) /* ./poly_tool */;\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class PolyDrawToolView extends poly_tool_1.PolyToolView {\n", " constructor() {\n", " super(...arguments);\n", " this._drawing = false;\n", " this._initialized = false;\n", " }\n", " _tap(ev) {\n", " if (this._drawing)\n", " this._draw(ev, 'add', true);\n", " else\n", " this._select_event(ev, this._select_mode(ev), this.model.renderers);\n", " }\n", " _draw(ev, mode, emit = false) {\n", " const renderer = this.model.renderers[0];\n", " const point = this._map_drag(ev.sx, ev.sy, renderer);\n", " if (!this._initialized)\n", " this.activate(); // Ensure that activate has been called\n", " if (point == null)\n", " return;\n", " const [x, y] = this._snap_to_vertex(ev, ...point);\n", " const cds = renderer.data_source;\n", " const glyph = renderer.glyph;\n", " const [xkey, ykey] = [glyph.xs.field, glyph.ys.field];\n", " if (mode == 'new') {\n", " this._pop_glyphs(cds, this.model.num_objects);\n", " if (xkey)\n", " cds.get_array(xkey).push([x, x]);\n", " if (ykey)\n", " cds.get_array(ykey).push([y, y]);\n", " this._pad_empty_columns(cds, [xkey, ykey]);\n", " }\n", " else if (mode == 'edit') {\n", " if (xkey) {\n", " const xs = cds.data[xkey][cds.data[xkey].length - 1];\n", " xs[xs.length - 1] = x;\n", " }\n", " if (ykey) {\n", " const ys = cds.data[ykey][cds.data[ykey].length - 1];\n", " ys[ys.length - 1] = y;\n", " }\n", " }\n", " else if (mode == 'add') {\n", " if (xkey) {\n", " const xidx = cds.data[xkey].length - 1;\n", " let xs = cds.get_array(xkey)[xidx];\n", " const nx = xs[xs.length - 1];\n", " xs[xs.length - 1] = x;\n", " if (!types_1.isArray(xs)) {\n", " xs = Array.from(xs);\n", " cds.data[xkey][xidx] = xs;\n", " }\n", " xs.push(nx);\n", " }\n", " if (ykey) {\n", " const yidx = cds.data[ykey].length - 1;\n", " let ys = cds.get_array(ykey)[yidx];\n", " const ny = ys[ys.length - 1];\n", " ys[ys.length - 1] = y;\n", " if (!types_1.isArray(ys)) {\n", " ys = Array.from(ys);\n", " cds.data[ykey][yidx] = ys;\n", " }\n", " ys.push(ny);\n", " }\n", " }\n", " this._emit_cds_changes(cds, true, false, emit);\n", " }\n", " _show_vertices() {\n", " if (!this.model.active) {\n", " return;\n", " }\n", " const xs = [];\n", " const ys = [];\n", " for (let i = 0; i < this.model.renderers.length; i++) {\n", " const renderer = this.model.renderers[i];\n", " const cds = renderer.data_source;\n", " const glyph = renderer.glyph;\n", " const [xkey, ykey] = [glyph.xs.field, glyph.ys.field];\n", " if (xkey) {\n", " for (const array of cds.get_array(xkey))\n", " Array.prototype.push.apply(xs, array);\n", " }\n", " if (ykey) {\n", " for (const array of cds.get_array(ykey))\n", " Array.prototype.push.apply(ys, array);\n", " }\n", " if (this._drawing && (i == (this.model.renderers.length - 1))) {\n", " // Skip currently drawn vertex\n", " xs.splice(xs.length - 1, 1);\n", " ys.splice(ys.length - 1, 1);\n", " }\n", " }\n", " this._set_vertices(xs, ys);\n", " }\n", " _doubletap(ev) {\n", " if (!this.model.active)\n", " return;\n", " if (this._drawing) {\n", " this._drawing = false;\n", " this._draw(ev, 'edit', true);\n", " }\n", " else {\n", " this._drawing = true;\n", " this._draw(ev, 'new', true);\n", " }\n", " }\n", " _move(ev) {\n", " if (this._drawing) {\n", " this._draw(ev, 'edit');\n", " }\n", " }\n", " _remove() {\n", " const renderer = this.model.renderers[0];\n", " const cds = renderer.data_source;\n", " const glyph = renderer.glyph;\n", " const [xkey, ykey] = [glyph.xs.field, glyph.ys.field];\n", " if (xkey) {\n", " const xidx = cds.data[xkey].length - 1;\n", " const xs = cds.get_array(xkey)[xidx];\n", " xs.splice(xs.length - 1, 1);\n", " }\n", " if (ykey) {\n", " const yidx = cds.data[ykey].length - 1;\n", " const ys = cds.get_array(ykey)[yidx];\n", " ys.splice(ys.length - 1, 1);\n", " }\n", " this._emit_cds_changes(cds);\n", " }\n", " _keyup(ev) {\n", " if (!this.model.active || !this._mouse_in_frame)\n", " return;\n", " for (const renderer of this.model.renderers) {\n", " if (ev.keyCode === dom_1.Keys.Backspace) {\n", " this._delete_selected(renderer);\n", " }\n", " else if (ev.keyCode == dom_1.Keys.Esc) {\n", " if (this._drawing) {\n", " this._remove();\n", " this._drawing = false;\n", " }\n", " renderer.data_source.selection_manager.clear();\n", " }\n", " }\n", " }\n", " _pan_start(ev) {\n", " if (!this.model.drag)\n", " return;\n", " this._select_event(ev, \"append\", this.model.renderers);\n", " this._basepoint = [ev.sx, ev.sy];\n", " }\n", " _pan(ev) {\n", " if (this._basepoint == null || !this.model.drag)\n", " return;\n", " const [bx, by] = this._basepoint;\n", " // Process polygon/line dragging\n", " for (const renderer of this.model.renderers) {\n", " const basepoint = this._map_drag(bx, by, renderer);\n", " const point = this._map_drag(ev.sx, ev.sy, renderer);\n", " if (point == null || basepoint == null)\n", " continue;\n", " const cds = renderer.data_source;\n", " // Type once dataspecs are typed\n", " const glyph = renderer.glyph;\n", " const [xkey, ykey] = [glyph.xs.field, glyph.ys.field];\n", " if (!xkey && !ykey)\n", " continue;\n", " const [x, y] = point;\n", " const [px, py] = basepoint;\n", " const [dx, dy] = [x - px, y - py];\n", " for (const index of cds.selected.indices) {\n", " let length, xs, ys;\n", " if (xkey)\n", " xs = cds.data[xkey][index];\n", " if (ykey) {\n", " ys = cds.data[ykey][index];\n", " length = ys.length;\n", " }\n", " else {\n", " length = xs.length;\n", " }\n", " for (let i = 0; i < length; i++) {\n", " if (xs)\n", " xs[i] += dx;\n", " if (ys)\n", " ys[i] += dy;\n", " }\n", " }\n", " cds.change.emit();\n", " }\n", " this._basepoint = [ev.sx, ev.sy];\n", " }\n", " _pan_end(ev) {\n", " if (!this.model.drag)\n", " return;\n", " this._pan(ev);\n", " for (const renderer of this.model.renderers)\n", " this._emit_cds_changes(renderer.data_source);\n", " this._basepoint = null;\n", " }\n", " activate() {\n", " if (!this.model.vertex_renderer || !this.model.active)\n", " return;\n", " this._show_vertices();\n", " if (!this._initialized) {\n", " for (const renderer of this.model.renderers) {\n", " const cds = renderer.data_source;\n", " cds.connect(cds.properties.data.change, () => this._show_vertices());\n", " }\n", " }\n", " this._initialized = true;\n", " }\n", " deactivate() {\n", " if (this._drawing) {\n", " this._remove();\n", " this._drawing = false;\n", " }\n", " if (this.model.vertex_renderer)\n", " this._hide_vertices();\n", " }\n", " }\n", " exports.PolyDrawToolView = PolyDrawToolView;\n", " PolyDrawToolView.__name__ = \"PolyDrawToolView\";\n", " class PolyDrawTool extends poly_tool_1.PolyTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Polygon Draw Tool\";\n", " this.icon = icons_1.bk_tool_icon_poly_draw;\n", " this.event_type = [\"pan\", \"tap\", \"move\"];\n", " this.default_order = 3;\n", " }\n", " static init_PolyDrawTool() {\n", " this.prototype.default_view = PolyDrawToolView;\n", " this.define({\n", " drag: [p.Boolean, true],\n", " num_objects: [p.Int, 0],\n", " });\n", " }\n", " }\n", " exports.PolyDrawTool = PolyDrawTool;\n", " PolyDrawTool.__name__ = \"PolyDrawTool\";\n", " PolyDrawTool.init_PolyDrawTool();\n", " },\n", " /* models/tools/edit/poly_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const types_1 = require(8) /* ../../../core/util/types */;\n", " const edit_tool_1 = require(332) /* ./edit_tool */;\n", " class PolyToolView extends edit_tool_1.EditToolView {\n", " _set_vertices(xs, ys) {\n", " const point_glyph = this.model.vertex_renderer.glyph;\n", " const point_cds = this.model.vertex_renderer.data_source;\n", " const [pxkey, pykey] = [point_glyph.x.field, point_glyph.y.field];\n", " if (pxkey) {\n", " if (types_1.isArray(xs))\n", " point_cds.data[pxkey] = xs;\n", " else\n", " point_glyph.x = { value: xs };\n", " }\n", " if (pykey) {\n", " if (types_1.isArray(ys))\n", " point_cds.data[pykey] = ys;\n", " else\n", " point_glyph.y = { value: ys };\n", " }\n", " this._emit_cds_changes(point_cds, true, true, false);\n", " }\n", " _hide_vertices() {\n", " this._set_vertices([], []);\n", " }\n", " _snap_to_vertex(ev, x, y) {\n", " if (this.model.vertex_renderer) {\n", " // If an existing vertex is hit snap to it\n", " const vertex_selected = this._select_event(ev, \"replace\", [this.model.vertex_renderer]);\n", " const point_ds = this.model.vertex_renderer.data_source;\n", " // Type once dataspecs are typed\n", " const point_glyph = this.model.vertex_renderer.glyph;\n", " const [pxkey, pykey] = [point_glyph.x.field, point_glyph.y.field];\n", " if (vertex_selected.length) {\n", " const index = point_ds.selected.indices[0];\n", " if (pxkey)\n", " x = point_ds.data[pxkey][index];\n", " if (pykey)\n", " y = point_ds.data[pykey][index];\n", " point_ds.selection_manager.clear();\n", " }\n", " }\n", " return [x, y];\n", " }\n", " }\n", " exports.PolyToolView = PolyToolView;\n", " PolyToolView.__name__ = \"PolyToolView\";\n", " class PolyTool extends edit_tool_1.EditTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_PolyTool() {\n", " this.prototype.default_view = PolyToolView;\n", " this.define({\n", " vertex_renderer: [p.Instance],\n", " });\n", " }\n", " }\n", " exports.PolyTool = PolyTool;\n", " PolyTool.__name__ = \"PolyTool\";\n", " PolyTool.init_PolyTool();\n", " },\n", " /* models/tools/edit/poly_edit_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const dom_1 = require(68) /* ../../../core/dom */;\n", " const types_1 = require(8) /* ../../../core/util/types */;\n", " const poly_tool_1 = require(337) /* ./poly_tool */;\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class PolyEditToolView extends poly_tool_1.PolyToolView {\n", " constructor() {\n", " super(...arguments);\n", " this._drawing = false;\n", " }\n", " _doubletap(ev) {\n", " if (!this.model.active)\n", " return;\n", " const point = this._map_drag(ev.sx, ev.sy, this.model.vertex_renderer);\n", " if (point == null)\n", " return;\n", " const [x, y] = point;\n", " // Perform hit testing\n", " const vertex_selected = this._select_event(ev, \"replace\", [this.model.vertex_renderer]);\n", " const point_cds = this.model.vertex_renderer.data_source;\n", " // Type once dataspecs are typed\n", " const point_glyph = this.model.vertex_renderer.glyph;\n", " const [pxkey, pykey] = [point_glyph.x.field, point_glyph.y.field];\n", " if (vertex_selected.length && this._selected_renderer != null) {\n", " // Insert a new point after the selected vertex and enter draw mode\n", " const index = point_cds.selected.indices[0];\n", " if (this._drawing) {\n", " this._drawing = false;\n", " point_cds.selection_manager.clear();\n", " }\n", " else {\n", " point_cds.selected.indices = [index + 1];\n", " if (pxkey)\n", " point_cds.get_array(pxkey).splice(index + 1, 0, x);\n", " if (pykey)\n", " point_cds.get_array(pykey).splice(index + 1, 0, y);\n", " this._drawing = true;\n", " }\n", " point_cds.change.emit();\n", " this._emit_cds_changes(this._selected_renderer.data_source);\n", " }\n", " else {\n", " this._show_vertices(ev);\n", " }\n", " }\n", " _show_vertices(ev) {\n", " if (!this.model.active)\n", " return;\n", " const renderers = this._select_event(ev, \"replace\", this.model.renderers);\n", " if (!renderers.length) {\n", " this._set_vertices([], []);\n", " this._selected_renderer = null;\n", " this._drawing = false;\n", " return;\n", " }\n", " const renderer = renderers[0];\n", " const glyph = renderer.glyph;\n", " const cds = renderer.data_source;\n", " const index = cds.selected.indices[0];\n", " const [xkey, ykey] = [glyph.xs.field, glyph.ys.field];\n", " let xs;\n", " let ys;\n", " if (xkey) {\n", " xs = cds.data[xkey][index];\n", " if (!types_1.isArray(xs))\n", " cds.data[xkey][index] = xs = Array.from(xs);\n", " }\n", " else {\n", " xs = glyph.xs.value;\n", " }\n", " if (ykey) {\n", " ys = cds.data[ykey][index];\n", " if (!types_1.isArray(ys))\n", " cds.data[ykey][index] = ys = Array.from(ys);\n", " }\n", " else {\n", " ys = glyph.ys.value;\n", " }\n", " this._selected_renderer = renderer;\n", " this._set_vertices(xs, ys);\n", " }\n", " _move(ev) {\n", " if (this._drawing && this._selected_renderer != null) {\n", " const renderer = this.model.vertex_renderer;\n", " const cds = renderer.data_source;\n", " const glyph = renderer.glyph;\n", " const point = this._map_drag(ev.sx, ev.sy, renderer);\n", " if (point == null)\n", " return;\n", " let [x, y] = point;\n", " const indices = cds.selected.indices;\n", " [x, y] = this._snap_to_vertex(ev, x, y);\n", " cds.selected.indices = indices;\n", " const [xkey, ykey] = [glyph.x.field, glyph.y.field];\n", " const index = indices[0];\n", " if (xkey)\n", " cds.data[xkey][index] = x;\n", " if (ykey)\n", " cds.data[ykey][index] = y;\n", " cds.change.emit();\n", " this._selected_renderer.data_source.change.emit();\n", " }\n", " }\n", " _tap(ev) {\n", " const renderer = this.model.vertex_renderer;\n", " const point = this._map_drag(ev.sx, ev.sy, renderer);\n", " if (point == null)\n", " return;\n", " else if (this._drawing && this._selected_renderer) {\n", " let [x, y] = point;\n", " const cds = renderer.data_source;\n", " // Type once dataspecs are typed\n", " const glyph = renderer.glyph;\n", " const [xkey, ykey] = [glyph.x.field, glyph.y.field];\n", " const indices = cds.selected.indices;\n", " [x, y] = this._snap_to_vertex(ev, x, y);\n", " const index = indices[0];\n", " cds.selected.indices = [index + 1];\n", " if (xkey) {\n", " const xs = cds.get_array(xkey);\n", " const nx = xs[index];\n", " xs[index] = x;\n", " xs.splice(index + 1, 0, nx);\n", " }\n", " if (ykey) {\n", " const ys = cds.get_array(ykey);\n", " const ny = ys[index];\n", " ys[index] = y;\n", " ys.splice(index + 1, 0, ny);\n", " }\n", " cds.change.emit();\n", " this._emit_cds_changes(this._selected_renderer.data_source, true, false, true);\n", " return;\n", " }\n", " const mode = this._select_mode(ev);\n", " this._select_event(ev, mode, [renderer]);\n", " this._select_event(ev, mode, this.model.renderers);\n", " }\n", " _remove_vertex() {\n", " if (!this._drawing || !this._selected_renderer)\n", " return;\n", " const renderer = this.model.vertex_renderer;\n", " const cds = renderer.data_source;\n", " // Type once dataspecs are typed\n", " const glyph = renderer.glyph;\n", " const index = cds.selected.indices[0];\n", " const [xkey, ykey] = [glyph.x.field, glyph.y.field];\n", " if (xkey)\n", " cds.get_array(xkey).splice(index, 1);\n", " if (ykey)\n", " cds.get_array(ykey).splice(index, 1);\n", " cds.change.emit();\n", " this._emit_cds_changes(this._selected_renderer.data_source);\n", " }\n", " _pan_start(ev) {\n", " this._select_event(ev, \"append\", [this.model.vertex_renderer]);\n", " this._basepoint = [ev.sx, ev.sy];\n", " }\n", " _pan(ev) {\n", " if (this._basepoint == null)\n", " return;\n", " this._drag_points(ev, [this.model.vertex_renderer]);\n", " if (this._selected_renderer)\n", " this._selected_renderer.data_source.change.emit();\n", " }\n", " _pan_end(ev) {\n", " if (this._basepoint == null)\n", " return;\n", " this._drag_points(ev, [this.model.vertex_renderer]);\n", " this._emit_cds_changes(this.model.vertex_renderer.data_source, false, true, true);\n", " if (this._selected_renderer) {\n", " this._emit_cds_changes(this._selected_renderer.data_source);\n", " }\n", " this._basepoint = null;\n", " }\n", " _keyup(ev) {\n", " if (!this.model.active || !this._mouse_in_frame)\n", " return;\n", " let renderers;\n", " if (this._selected_renderer) {\n", " renderers = [this.model.vertex_renderer];\n", " }\n", " else {\n", " renderers = this.model.renderers;\n", " }\n", " for (const renderer of renderers) {\n", " if (ev.keyCode === dom_1.Keys.Backspace) {\n", " this._delete_selected(renderer);\n", " if (this._selected_renderer) {\n", " this._emit_cds_changes(this._selected_renderer.data_source);\n", " }\n", " }\n", " else if (ev.keyCode == dom_1.Keys.Esc) {\n", " if (this._drawing) {\n", " this._remove_vertex();\n", " this._drawing = false;\n", " }\n", " else if (this._selected_renderer) {\n", " this._hide_vertices();\n", " }\n", " renderer.data_source.selection_manager.clear();\n", " }\n", " }\n", " }\n", " deactivate() {\n", " if (!this._selected_renderer) {\n", " return;\n", " }\n", " else if (this._drawing) {\n", " this._remove_vertex();\n", " this._drawing = false;\n", " }\n", " this._hide_vertices();\n", " }\n", " }\n", " exports.PolyEditToolView = PolyEditToolView;\n", " PolyEditToolView.__name__ = \"PolyEditToolView\";\n", " class PolyEditTool extends poly_tool_1.PolyTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Poly Edit Tool\";\n", " this.icon = icons_1.bk_tool_icon_poly_edit;\n", " this.event_type = [\"tap\", \"pan\", \"move\"];\n", " this.default_order = 4;\n", " }\n", " static init_PolyEditTool() {\n", " this.prototype.default_view = PolyEditToolView;\n", " }\n", " }\n", " exports.PolyEditTool = PolyEditTool;\n", " PolyEditTool.__name__ = \"PolyEditTool\";\n", " PolyEditTool.init_PolyEditTool();\n", " },\n", " /* models/tools/gestures/box_select_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const select_tool_1 = require(340) /* ./select_tool */;\n", " const box_annotation_1 = require(107) /* ../../annotations/box_annotation */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class BoxSelectToolView extends select_tool_1.SelectToolView {\n", " _compute_limits(curpoint) {\n", " const frame = this.plot_view.frame;\n", " const dims = this.model.dimensions;\n", " let base_point = this._base_point;\n", " if (this.model.origin == \"center\") {\n", " const [cx, cy] = base_point;\n", " const [dx, dy] = curpoint;\n", " base_point = [cx - (dx - cx), cy - (dy - cy)];\n", " }\n", " return this.model._get_dim_limits(base_point, curpoint, frame, dims);\n", " }\n", " _pan_start(ev) {\n", " const { sx, sy } = ev;\n", " this._base_point = [sx, sy];\n", " }\n", " _pan(ev) {\n", " const { sx, sy } = ev;\n", " const curpoint = [sx, sy];\n", " const [sxlim, sylim] = this._compute_limits(curpoint);\n", " this.model.overlay.update({ left: sxlim[0], right: sxlim[1], top: sylim[0], bottom: sylim[1] });\n", " if (this.model.select_every_mousemove) {\n", " this._do_select(sxlim, sylim, false, this._select_mode(ev));\n", " }\n", " }\n", " _pan_end(ev) {\n", " const { sx, sy } = ev;\n", " const curpoint = [sx, sy];\n", " const [sxlim, sylim] = this._compute_limits(curpoint);\n", " this._do_select(sxlim, sylim, true, this._select_mode(ev));\n", " this.model.overlay.update({ left: null, right: null, top: null, bottom: null });\n", " this._base_point = null;\n", " this.plot_view.push_state('box_select', { selection: this.plot_view.get_selection() });\n", " }\n", " _do_select([sx0, sx1], [sy0, sy1], final, mode = \"replace\") {\n", " const geometry = { type: 'rect', sx0, sx1, sy0, sy1 };\n", " this._select(geometry, final, mode);\n", " }\n", " }\n", " exports.BoxSelectToolView = BoxSelectToolView;\n", " BoxSelectToolView.__name__ = \"BoxSelectToolView\";\n", " const DEFAULT_BOX_OVERLAY = () => {\n", " return new box_annotation_1.BoxAnnotation({\n", " level: \"overlay\",\n", " top_units: \"screen\",\n", " left_units: \"screen\",\n", " bottom_units: \"screen\",\n", " right_units: \"screen\",\n", " fill_color: \"lightgrey\",\n", " fill_alpha: 0.5,\n", " line_color: \"black\",\n", " line_alpha: 1.0,\n", " line_width: 2,\n", " line_dash: [4, 4],\n", " });\n", " };\n", " class BoxSelectTool extends select_tool_1.SelectTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Box Select\";\n", " this.icon = icons_1.bk_tool_icon_box_select;\n", " this.event_type = \"pan\";\n", " this.default_order = 30;\n", " }\n", " static init_BoxSelectTool() {\n", " this.prototype.default_view = BoxSelectToolView;\n", " this.define({\n", " dimensions: [p.Dimensions, \"both\"],\n", " select_every_mousemove: [p.Boolean, false],\n", " overlay: [p.Instance, DEFAULT_BOX_OVERLAY],\n", " origin: [p.BoxOrigin, \"corner\"],\n", " });\n", " this.register_alias(\"box_select\", () => new BoxSelectTool());\n", " this.register_alias(\"xbox_select\", () => new BoxSelectTool({ dimensions: 'width' }));\n", " this.register_alias(\"ybox_select\", () => new BoxSelectTool({ dimensions: 'height' }));\n", " }\n", " get tooltip() {\n", " return this._get_dim_tooltip(this.tool_name, this.dimensions);\n", " }\n", " }\n", " exports.BoxSelectTool = BoxSelectTool;\n", " BoxSelectTool.__name__ = \"BoxSelectTool\";\n", " BoxSelectTool.init_BoxSelectTool();\n", " },\n", " /* models/tools/gestures/select_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const gesture_tool_1 = require(284) /* ./gesture_tool */;\n", " const glyph_renderer_1 = require(81) /* ../../renderers/glyph_renderer */;\n", " const graph_renderer_1 = require(100) /* ../../renderers/graph_renderer */;\n", " const util_1 = require(341) /* ../util */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const dom_1 = require(68) /* ../../../core/dom */;\n", " const bokeh_events_1 = require(291) /* ../../../core/bokeh_events */;\n", " const signaling_1 = require(14) /* ../../../core/signaling */;\n", " const assert_1 = require(11) /* ../../../core/util/assert */;\n", " class SelectToolView extends gesture_tool_1.GestureToolView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.model.clear.connect(() => this._clear());\n", " }\n", " get computed_renderers() {\n", " const renderers = this.model.renderers;\n", " const all_renderers = this.plot_model.renderers;\n", " const names = this.model.names;\n", " return util_1.compute_renderers(renderers, all_renderers, names);\n", " }\n", " _computed_renderers_by_data_source() {\n", " var _a;\n", " const renderers_by_source = new Map();\n", " for (const r of this.computed_renderers) {\n", " let source;\n", " if (r instanceof glyph_renderer_1.GlyphRenderer)\n", " source = r.data_source;\n", " else if (r instanceof graph_renderer_1.GraphRenderer)\n", " source = r.node_renderer.data_source;\n", " else\n", " continue;\n", " const renderers = (_a = renderers_by_source.get(source)) !== null && _a !== void 0 ? _a : [];\n", " renderers_by_source.set(source, [...renderers, r]);\n", " }\n", " return renderers_by_source;\n", " }\n", " _select_mode(ev) {\n", " const { shiftKey, ctrlKey } = ev;\n", " if (!shiftKey && !ctrlKey)\n", " return this.model.mode;\n", " else if (shiftKey && !ctrlKey)\n", " return \"append\";\n", " else if (!shiftKey && ctrlKey)\n", " return \"intersect\";\n", " else if (shiftKey && ctrlKey)\n", " return \"subtract\";\n", " else\n", " assert_1.unreachable();\n", " }\n", " _keyup(ev) {\n", " if (ev.keyCode == dom_1.Keys.Esc) {\n", " this._clear();\n", " }\n", " }\n", " _clear() {\n", " for (const renderer of this.computed_renderers) {\n", " renderer.get_selection_manager().clear();\n", " }\n", " this.plot_view.request_render();\n", " }\n", " _select(geometry, final, mode) {\n", " const renderers_by_source = this._computed_renderers_by_data_source();\n", " for (const [, renderers] of renderers_by_source) {\n", " const sm = renderers[0].get_selection_manager();\n", " const r_views = [];\n", " for (const r of renderers) {\n", " const r_view = this.plot_view.renderer_views.get(r);\n", " if (r_view != null) {\n", " r_views.push(r_view);\n", " }\n", " }\n", " sm.select(r_views, geometry, final, mode);\n", " }\n", " // XXX: messed up class structure\n", " if (this.model.callback != null)\n", " this._emit_callback(geometry);\n", " this._emit_selection_event(geometry, final);\n", " }\n", " _emit_selection_event(geometry, final = true) {\n", " const { frame } = this.plot_view;\n", " const xm = frame.xscales.default;\n", " const ym = frame.yscales.default;\n", " let geometry_data;\n", " switch (geometry.type) {\n", " case \"point\": {\n", " const { sx, sy } = geometry;\n", " const x = xm.invert(sx);\n", " const y = ym.invert(sy);\n", " geometry_data = Object.assign(Object.assign({}, geometry), { x, y });\n", " break;\n", " }\n", " case \"span\": {\n", " const { sx, sy } = geometry;\n", " const x = xm.invert(sx);\n", " const y = ym.invert(sy);\n", " geometry_data = Object.assign(Object.assign({}, geometry), { x, y });\n", " break;\n", " }\n", " case \"rect\": {\n", " const { sx0, sx1, sy0, sy1 } = geometry;\n", " const [x0, x1] = xm.r_invert(sx0, sx1);\n", " const [y0, y1] = ym.r_invert(sy0, sy1);\n", " geometry_data = Object.assign(Object.assign({}, geometry), { x0, y0, x1, y1 });\n", " break;\n", " }\n", " case \"poly\": {\n", " const { sx, sy } = geometry;\n", " const x = xm.v_invert(sx);\n", " const y = ym.v_invert(sy);\n", " geometry_data = Object.assign(Object.assign({}, geometry), { x, y });\n", " break;\n", " }\n", " }\n", " this.plot_model.trigger_event(new bokeh_events_1.SelectionGeometry(geometry_data, final));\n", " }\n", " }\n", " exports.SelectToolView = SelectToolView;\n", " SelectToolView.__name__ = \"SelectToolView\";\n", " class SelectTool extends gesture_tool_1.GestureTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.clear = new signaling_1.Signal0(this, \"clear\");\n", " }\n", " static init_SelectTool() {\n", " this.define({\n", " renderers: [p.Any, 'auto'],\n", " names: [p.Array, []],\n", " mode: [p.Any, \"replace\"],\n", " });\n", " }\n", " get menu() {\n", " return [\n", " {\n", " icon: \"bk-tool-icon-replace-mode\",\n", " tooltip: \"Replace the current selection\",\n", " active: () => this.mode == \"replace\",\n", " handler: () => {\n", " this.mode = \"replace\";\n", " this.active = true;\n", " },\n", " }, {\n", " icon: \"bk-tool-icon-append-mode\",\n", " tooltip: \"Append to the current selection (Shift)\",\n", " active: () => this.mode == \"append\",\n", " handler: () => {\n", " this.mode = \"append\";\n", " this.active = true;\n", " },\n", " }, {\n", " icon: \"bk-tool-icon-intersect-mode\",\n", " tooltip: \"Intersect with the current selection (Ctrl)\",\n", " active: () => this.mode == \"intersect\",\n", " handler: () => {\n", " this.mode = \"intersect\";\n", " this.active = true;\n", " },\n", " }, {\n", " icon: \"bk-tool-icon-subtract-mode\",\n", " tooltip: \"Subtract from the current selection (Shift+Ctrl)\",\n", " active: () => this.mode == \"subtract\",\n", " handler: () => {\n", " this.mode = \"subtract\";\n", " this.active = true;\n", " },\n", " },\n", " null,\n", " {\n", " icon: \"bk-tool-icon-clear-selection\",\n", " tooltip: \"Clear the current selection (Esc)\",\n", " handler: () => {\n", " this.clear.emit();\n", " },\n", " },\n", " ];\n", " }\n", " }\n", " exports.SelectTool = SelectTool;\n", " SelectTool.__name__ = \"SelectTool\";\n", " SelectTool.init_SelectTool();\n", " },\n", " /* models/tools/util.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " function compute_renderers(renderers, all_renderers, names) {\n", " if (renderers == null)\n", " return [];\n", " let result = renderers == 'auto' ? all_renderers : renderers;\n", " if (names.length > 0)\n", " result = result.filter((r) => array_1.includes(names, r.name));\n", " return result;\n", " }\n", " exports.compute_renderers = compute_renderers;\n", " },\n", " /* models/tools/gestures/box_zoom_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const gesture_tool_1 = require(284) /* ./gesture_tool */;\n", " const box_annotation_1 = require(107) /* ../../annotations/box_annotation */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class BoxZoomToolView extends gesture_tool_1.GestureToolView {\n", " _match_aspect(base_point, curpoint, frame) {\n", " // aspect ratio of plot frame\n", " const a = frame.bbox.aspect;\n", " const hend = frame.bbox.h_range.end;\n", " const hstart = frame.bbox.h_range.start;\n", " const vend = frame.bbox.v_range.end;\n", " const vstart = frame.bbox.v_range.start;\n", " // current aspect of cursor-defined box\n", " let vw = Math.abs(base_point[0] - curpoint[0]);\n", " let vh = Math.abs(base_point[1] - curpoint[1]);\n", " const va = vh == 0 ? 0 : vw / vh;\n", " const [xmod] = va >= a ? [1, va / a] : [a / va, 1];\n", " // OK the code blocks below merit some explanation. They do:\n", " //\n", " // compute left/right, pin to frame if necessary\n", " // compute top/bottom (based on new left/right), pin to frame if necessary\n", " // recompute left/right (based on top/bottom), in case top/bottom were pinned\n", " // base_point[0] is left\n", " let left;\n", " let right;\n", " if (base_point[0] <= curpoint[0]) {\n", " left = base_point[0];\n", " right = base_point[0] + vw * xmod;\n", " if (right > hend)\n", " right = hend;\n", " // base_point[0] is right\n", " }\n", " else {\n", " right = base_point[0];\n", " left = base_point[0] - vw * xmod;\n", " if (left < hstart)\n", " left = hstart;\n", " }\n", " vw = Math.abs(right - left);\n", " // base_point[1] is bottom\n", " let top;\n", " let bottom;\n", " if (base_point[1] <= curpoint[1]) {\n", " bottom = base_point[1];\n", " top = base_point[1] + vw / a;\n", " if (top > vend)\n", " top = vend;\n", " // base_point[1] is top\n", " }\n", " else {\n", " top = base_point[1];\n", " bottom = base_point[1] - vw / a;\n", " if (bottom < vstart)\n", " bottom = vstart;\n", " }\n", " vh = Math.abs(top - bottom);\n", " // base_point[0] is left\n", " if (base_point[0] <= curpoint[0])\n", " right = base_point[0] + a * vh;\n", " // base_point[0] is right\n", " else\n", " left = base_point[0] - a * vh;\n", " return [[left, right], [bottom, top]];\n", " }\n", " _compute_limits(curpoint) {\n", " const frame = this.plot_view.frame;\n", " const dims = this.model.dimensions;\n", " let base_point = this._base_point;\n", " if (this.model.origin == \"center\") {\n", " const [cx, cy] = base_point;\n", " const [dx, dy] = curpoint;\n", " base_point = [cx - (dx - cx), cy - (dy - cy)];\n", " }\n", " let sx;\n", " let sy;\n", " if (this.model.match_aspect && dims == 'both')\n", " [sx, sy] = this._match_aspect(base_point, curpoint, frame);\n", " else\n", " [sx, sy] = this.model._get_dim_limits(base_point, curpoint, frame, dims);\n", " return [sx, sy];\n", " }\n", " _pan_start(ev) {\n", " this._base_point = [ev.sx, ev.sy];\n", " }\n", " _pan(ev) {\n", " const curpoint = [ev.sx, ev.sy];\n", " const [sx, sy] = this._compute_limits(curpoint);\n", " this.model.overlay.update({ left: sx[0], right: sx[1], top: sy[0], bottom: sy[1] });\n", " }\n", " _pan_end(ev) {\n", " const curpoint = [ev.sx, ev.sy];\n", " const [sx, sy] = this._compute_limits(curpoint);\n", " this._update(sx, sy);\n", " this.model.overlay.update({ left: null, right: null, top: null, bottom: null });\n", " this._base_point = null;\n", " }\n", " _update([sx0, sx1], [sy0, sy1]) {\n", " // If the viewing window is too small, no-op: it is likely that the user did\n", " // not intend to make this box zoom and instead was trying to cancel out of the\n", " // zoom, a la matplotlib's ToolZoom. Like matplotlib, set the threshold at 5 pixels.\n", " if (Math.abs(sx1 - sx0) <= 5 || Math.abs(sy1 - sy0) <= 5)\n", " return;\n", " const { xscales, yscales } = this.plot_view.frame;\n", " const xrs = {};\n", " for (const name in xscales) {\n", " const scale = xscales[name];\n", " const [start, end] = scale.r_invert(sx0, sx1);\n", " xrs[name] = { start, end };\n", " }\n", " const yrs = {};\n", " for (const name in yscales) {\n", " const scale = yscales[name];\n", " const [start, end] = scale.r_invert(sy0, sy1);\n", " yrs[name] = { start, end };\n", " }\n", " const zoom_info = { xrs, yrs };\n", " this.plot_view.push_state('box_zoom', { range: zoom_info });\n", " this.plot_view.update_range(zoom_info);\n", " }\n", " }\n", " exports.BoxZoomToolView = BoxZoomToolView;\n", " BoxZoomToolView.__name__ = \"BoxZoomToolView\";\n", " const DEFAULT_BOX_OVERLAY = () => {\n", " return new box_annotation_1.BoxAnnotation({\n", " level: \"overlay\",\n", " top_units: \"screen\",\n", " left_units: \"screen\",\n", " bottom_units: \"screen\",\n", " right_units: \"screen\",\n", " fill_color: \"lightgrey\",\n", " fill_alpha: 0.5,\n", " line_color: \"black\",\n", " line_alpha: 1.0,\n", " line_width: 2,\n", " line_dash: [4, 4],\n", " });\n", " };\n", " class BoxZoomTool extends gesture_tool_1.GestureTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Box Zoom\";\n", " this.icon = icons_1.bk_tool_icon_box_zoom;\n", " this.event_type = \"pan\";\n", " this.default_order = 20;\n", " }\n", " static init_BoxZoomTool() {\n", " this.prototype.default_view = BoxZoomToolView;\n", " this.define({\n", " dimensions: [p.Dimensions, \"both\"],\n", " overlay: [p.Instance, DEFAULT_BOX_OVERLAY],\n", " match_aspect: [p.Boolean, false],\n", " origin: [p.BoxOrigin, \"corner\"],\n", " });\n", " this.register_alias(\"box_zoom\", () => new BoxZoomTool({ dimensions: 'both' }));\n", " this.register_alias(\"xbox_zoom\", () => new BoxZoomTool({ dimensions: 'width' }));\n", " this.register_alias(\"ybox_zoom\", () => new BoxZoomTool({ dimensions: 'height' }));\n", " }\n", " get tooltip() {\n", " return this._get_dim_tooltip(this.tool_name, this.dimensions);\n", " }\n", " }\n", " exports.BoxZoomTool = BoxZoomTool;\n", " BoxZoomTool.__name__ = \"BoxZoomTool\";\n", " BoxZoomTool.init_BoxZoomTool();\n", " },\n", " /* models/tools/gestures/lasso_select_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const select_tool_1 = require(340) /* ./select_tool */;\n", " const poly_annotation_1 = require(139) /* ../../annotations/poly_annotation */;\n", " const dom_1 = require(68) /* ../../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class LassoSelectToolView extends select_tool_1.SelectToolView {\n", " initialize() {\n", " super.initialize();\n", " this.data = null;\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.active.change, () => this._active_change());\n", " }\n", " _active_change() {\n", " if (!this.model.active)\n", " this._clear_overlay();\n", " }\n", " _keyup(ev) {\n", " if (ev.keyCode == dom_1.Keys.Enter)\n", " this._clear_overlay();\n", " }\n", " _pan_start(ev) {\n", " const { sx, sy } = ev;\n", " this.data = { sx: [sx], sy: [sy] };\n", " }\n", " _pan(ev) {\n", " const { sx: _sx, sy: _sy } = ev;\n", " const [sx, sy] = this.plot_view.frame.bbox.clip(_sx, _sy);\n", " this.data.sx.push(sx);\n", " this.data.sy.push(sy);\n", " const overlay = this.model.overlay;\n", " overlay.update({ xs: this.data.sx, ys: this.data.sy });\n", " if (this.model.select_every_mousemove) {\n", " this._do_select(this.data.sx, this.data.sy, false, this._select_mode(ev));\n", " }\n", " }\n", " _pan_end(ev) {\n", " this._clear_overlay();\n", " this._do_select(this.data.sx, this.data.sy, true, this._select_mode(ev));\n", " this.plot_view.push_state('lasso_select', { selection: this.plot_view.get_selection() });\n", " }\n", " _clear_overlay() {\n", " this.model.overlay.update({ xs: [], ys: [] });\n", " }\n", " _do_select(sx, sy, final, mode) {\n", " const geometry = { type: 'poly', sx, sy };\n", " this._select(geometry, final, mode);\n", " }\n", " }\n", " exports.LassoSelectToolView = LassoSelectToolView;\n", " LassoSelectToolView.__name__ = \"LassoSelectToolView\";\n", " const DEFAULT_POLY_OVERLAY = () => {\n", " return new poly_annotation_1.PolyAnnotation({\n", " level: \"overlay\",\n", " xs_units: \"screen\",\n", " ys_units: \"screen\",\n", " fill_color: \"lightgrey\",\n", " fill_alpha: 0.5,\n", " line_color: \"black\",\n", " line_alpha: 1.0,\n", " line_width: 2,\n", " line_dash: [4, 4],\n", " });\n", " };\n", " class LassoSelectTool extends select_tool_1.SelectTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Lasso Select\";\n", " this.icon = icons_1.bk_tool_icon_lasso_select;\n", " this.event_type = \"pan\";\n", " this.default_order = 12;\n", " }\n", " static init_LassoSelectTool() {\n", " this.prototype.default_view = LassoSelectToolView;\n", " this.define({\n", " select_every_mousemove: [p.Boolean, true],\n", " overlay: [p.Instance, DEFAULT_POLY_OVERLAY],\n", " });\n", " this.register_alias(\"lasso_select\", () => new LassoSelectTool());\n", " }\n", " }\n", " exports.LassoSelectTool = LassoSelectTool;\n", " LassoSelectTool.__name__ = \"LassoSelectTool\";\n", " LassoSelectTool.init_LassoSelectTool();\n", " },\n", " /* models/tools/edit/line_edit_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const line_tool_1 = require(345) /* ./line_tool */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class LineEditToolView extends line_tool_1.LineToolView {\n", " constructor() {\n", " super(...arguments);\n", " this._drawing = false;\n", " }\n", " _doubletap(ev) {\n", " if (!this.model.active)\n", " return;\n", " const renderers = this.model.renderers;\n", " for (const renderer of renderers) {\n", " const line_selected = this._select_event(ev, \"replace\", [renderer]);\n", " if (line_selected.length == 1) {\n", " this._selected_renderer = renderer;\n", " }\n", " }\n", " this._show_intersections();\n", " this._update_line_cds();\n", " }\n", " _show_intersections() {\n", " if (!this.model.active)\n", " return;\n", " if (this._selected_renderer == null)\n", " return;\n", " const renderers = this.model.renderers;\n", " if (!renderers.length) {\n", " this._set_intersection([], []);\n", " this._selected_renderer = null;\n", " this._drawing = false;\n", " return;\n", " }\n", " const cds = this._selected_renderer.data_source;\n", " const glyph = this._selected_renderer.glyph;\n", " const [xkey, ykey] = [glyph.x.field, glyph.y.field];\n", " const x = cds.get_array(xkey);\n", " const y = cds.get_array(ykey);\n", " this._set_intersection(x, y);\n", " }\n", " _tap(ev) {\n", " const renderer = this.model.intersection_renderer;\n", " const point = this._map_drag(ev.sx, ev.sy, renderer);\n", " if (point == null)\n", " return;\n", " else if (this._drawing && this._selected_renderer) {\n", " const mode = this._select_mode(ev);\n", " const selected_points = this._select_event(ev, mode, [renderer]);\n", " if (selected_points.length == 0) {\n", " return;\n", " }\n", " }\n", " const mode = this._select_mode(ev);\n", " this._select_event(ev, mode, [renderer]);\n", " this._select_event(ev, mode, this.model.renderers);\n", " }\n", " _update_line_cds() {\n", " if (this._selected_renderer == null)\n", " return;\n", " const point_glyph = this.model.intersection_renderer.glyph;\n", " const point_cds = this.model.intersection_renderer.data_source;\n", " const [pxkey, pykey] = [point_glyph.x.field, point_glyph.y.field];\n", " if (pxkey && pykey) {\n", " const x = point_cds.data[pxkey];\n", " const y = point_cds.data[pykey];\n", " this._selected_renderer.data_source.data[pxkey] = x;\n", " this._selected_renderer.data_source.data[pykey] = y;\n", " }\n", " this._emit_cds_changes(this._selected_renderer.data_source, true, true, false);\n", " }\n", " _pan_start(ev) {\n", " this._select_event(ev, \"append\", [this.model.intersection_renderer]);\n", " this._basepoint = [ev.sx, ev.sy];\n", " }\n", " _pan(ev) {\n", " if (this._basepoint == null)\n", " return;\n", " this._drag_points(ev, [this.model.intersection_renderer], this.model.dimensions);\n", " if (this._selected_renderer)\n", " this._selected_renderer.data_source.change.emit();\n", " }\n", " _pan_end(ev) {\n", " if (this._basepoint == null)\n", " return;\n", " this._drag_points(ev, [this.model.intersection_renderer]);\n", " this._emit_cds_changes(this.model.intersection_renderer.data_source, false, true, true);\n", " if (this._selected_renderer) {\n", " this._emit_cds_changes(this._selected_renderer.data_source);\n", " }\n", " this._basepoint = null;\n", " }\n", " activate() {\n", " this._drawing = true;\n", " }\n", " deactivate() {\n", " if (!this._selected_renderer) {\n", " return;\n", " }\n", " else if (this._drawing) {\n", " this._drawing = false;\n", " }\n", " this._hide_intersections();\n", " }\n", " }\n", " exports.LineEditToolView = LineEditToolView;\n", " LineEditToolView.__name__ = \"LineEditToolView\";\n", " class LineEditTool extends line_tool_1.LineTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Line Edit Tool\";\n", " this.icon = icons_1.bk_tool_icon_line_edit;\n", " this.event_type = [\"tap\", \"pan\", \"move\"];\n", " this.default_order = 4;\n", " }\n", " static init_LineEditTool() {\n", " this.prototype.default_view = LineEditToolView;\n", " this.define({\n", " dimensions: [p.Dimensions, \"both\"],\n", " });\n", " }\n", " get tooltip() {\n", " return this._get_dim_tooltip(this.tool_name, this.dimensions);\n", " }\n", " }\n", " exports.LineEditTool = LineEditTool;\n", " LineEditTool.__name__ = \"LineEditTool\";\n", " LineEditTool.init_LineEditTool();\n", " },\n", " /* models/tools/edit/line_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const types_1 = require(8) /* ../../../core/util/types */;\n", " const edit_tool_1 = require(332) /* ./edit_tool */;\n", " class LineToolView extends edit_tool_1.EditToolView {\n", " _set_intersection(x, y) {\n", " const point_glyph = this.model.intersection_renderer.glyph;\n", " const point_cds = this.model.intersection_renderer.data_source;\n", " const [pxkey, pykey] = [point_glyph.x.field, point_glyph.y.field];\n", " if (pxkey) {\n", " if (types_1.isArray(x))\n", " point_cds.data[pxkey] = x;\n", " else\n", " point_glyph.x = { value: x };\n", " }\n", " if (pykey) {\n", " if (types_1.isArray(y))\n", " point_cds.data[pykey] = y;\n", " else\n", " point_glyph.y = { value: y };\n", " }\n", " this._emit_cds_changes(point_cds, true, true, false);\n", " }\n", " _hide_intersections() {\n", " this._set_intersection([], []);\n", " }\n", " }\n", " exports.LineToolView = LineToolView;\n", " LineToolView.__name__ = \"LineToolView\";\n", " class LineTool extends edit_tool_1.EditTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_LineTool() {\n", " this.prototype.default_view = LineToolView;\n", " this.define({\n", " intersection_renderer: [p.Instance],\n", " });\n", " }\n", " }\n", " exports.LineTool = LineTool;\n", " LineTool.__name__ = \"LineTool\";\n", " LineTool.init_LineTool();\n", " },\n", " /* models/tools/gestures/pan_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const gesture_tool_1 = require(284) /* ./gesture_tool */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class PanToolView extends gesture_tool_1.GestureToolView {\n", " _pan_start(ev) {\n", " this.last_dx = 0;\n", " this.last_dy = 0;\n", " const { sx, sy } = ev;\n", " const bbox = this.plot_view.frame.bbox;\n", " if (!bbox.contains(sx, sy)) {\n", " const hr = bbox.h_range;\n", " const vr = bbox.v_range;\n", " if (sx < hr.start || sx > hr.end)\n", " this.v_axis_only = true;\n", " if (sy < vr.start || sy > vr.end)\n", " this.h_axis_only = true;\n", " }\n", " if (this.model.document != null)\n", " this.model.document.interactive_start(this.plot_model);\n", " }\n", " _pan(ev) {\n", " this._update(ev.deltaX, ev.deltaY);\n", " if (this.model.document != null)\n", " this.model.document.interactive_start(this.plot_model);\n", " }\n", " _pan_end(_e) {\n", " this.h_axis_only = false;\n", " this.v_axis_only = false;\n", " if (this.pan_info != null)\n", " this.plot_view.push_state('pan', { range: this.pan_info });\n", " }\n", " _update(dx, dy) {\n", " const frame = this.plot_view.frame;\n", " const new_dx = dx - this.last_dx;\n", " const new_dy = dy - this.last_dy;\n", " const hr = frame.bbox.h_range;\n", " const sx_low = hr.start - new_dx;\n", " const sx_high = hr.end - new_dx;\n", " const vr = frame.bbox.v_range;\n", " const sy_low = vr.start - new_dy;\n", " const sy_high = vr.end - new_dy;\n", " const dims = this.model.dimensions;\n", " let sx0;\n", " let sx1;\n", " let sdx;\n", " if ((dims == 'width' || dims == 'both') && !this.v_axis_only) {\n", " sx0 = sx_low;\n", " sx1 = sx_high;\n", " sdx = -new_dx;\n", " }\n", " else {\n", " sx0 = hr.start;\n", " sx1 = hr.end;\n", " sdx = 0;\n", " }\n", " let sy0;\n", " let sy1;\n", " let sdy;\n", " if ((dims == 'height' || dims == 'both') && !this.h_axis_only) {\n", " sy0 = sy_low;\n", " sy1 = sy_high;\n", " sdy = -new_dy;\n", " }\n", " else {\n", " sy0 = vr.start;\n", " sy1 = vr.end;\n", " sdy = 0;\n", " }\n", " this.last_dx = dx;\n", " this.last_dy = dy;\n", " const { xscales, yscales } = frame;\n", " const xrs = {};\n", " for (const name in xscales) {\n", " const scale = xscales[name];\n", " const [start, end] = scale.r_invert(sx0, sx1);\n", " xrs[name] = { start, end };\n", " }\n", " const yrs = {};\n", " for (const name in yscales) {\n", " const scale = yscales[name];\n", " const [start, end] = scale.r_invert(sy0, sy1);\n", " yrs[name] = { start, end };\n", " }\n", " this.pan_info = { xrs, yrs, sdx, sdy };\n", " this.plot_view.update_range(this.pan_info, true);\n", " }\n", " }\n", " exports.PanToolView = PanToolView;\n", " PanToolView.__name__ = \"PanToolView\";\n", " class PanTool extends gesture_tool_1.GestureTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Pan\";\n", " this.event_type = \"pan\";\n", " this.default_order = 10;\n", " }\n", " static init_PanTool() {\n", " this.prototype.default_view = PanToolView;\n", " this.define({\n", " dimensions: [p.Dimensions, \"both\"],\n", " });\n", " this.register_alias(\"pan\", () => new PanTool({ dimensions: 'both' }));\n", " this.register_alias(\"xpan\", () => new PanTool({ dimensions: 'width' }));\n", " this.register_alias(\"ypan\", () => new PanTool({ dimensions: 'height' }));\n", " }\n", " get tooltip() {\n", " return this._get_dim_tooltip(\"Pan\", this.dimensions);\n", " }\n", " get icon() {\n", " switch (this.dimensions) {\n", " case \"both\": return icons_1.bk_tool_icon_pan;\n", " case \"width\": return icons_1.bk_tool_icon_xpan;\n", " case \"height\": return icons_1.bk_tool_icon_ypan;\n", " }\n", " }\n", " }\n", " exports.PanTool = PanTool;\n", " PanTool.__name__ = \"PanTool\";\n", " PanTool.init_PanTool();\n", " },\n", " /* models/tools/gestures/poly_select_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const select_tool_1 = require(340) /* ./select_tool */;\n", " const poly_annotation_1 = require(139) /* ../../annotations/poly_annotation */;\n", " const dom_1 = require(68) /* ../../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const array_1 = require(9) /* ../../../core/util/array */;\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class PolySelectToolView extends select_tool_1.SelectToolView {\n", " initialize() {\n", " super.initialize();\n", " this.data = { sx: [], sy: [] };\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.active.change, () => this._active_change());\n", " }\n", " _active_change() {\n", " if (!this.model.active)\n", " this._clear_data();\n", " }\n", " _keyup(ev) {\n", " if (ev.keyCode == dom_1.Keys.Enter)\n", " this._clear_data();\n", " }\n", " _doubletap(ev) {\n", " this._do_select(this.data.sx, this.data.sy, true, this._select_mode(ev));\n", " this.plot_view.push_state('poly_select', { selection: this.plot_view.get_selection() });\n", " this._clear_data();\n", " }\n", " _clear_data() {\n", " this.data = { sx: [], sy: [] };\n", " this.model.overlay.update({ xs: [], ys: [] });\n", " }\n", " _tap(ev) {\n", " const { sx, sy } = ev;\n", " const frame = this.plot_view.frame;\n", " if (!frame.bbox.contains(sx, sy))\n", " return;\n", " this.data.sx.push(sx);\n", " this.data.sy.push(sy);\n", " this.model.overlay.update({ xs: array_1.copy(this.data.sx), ys: array_1.copy(this.data.sy) });\n", " }\n", " _do_select(sx, sy, final, mode) {\n", " const geometry = { type: 'poly', sx, sy };\n", " this._select(geometry, final, mode);\n", " }\n", " }\n", " exports.PolySelectToolView = PolySelectToolView;\n", " PolySelectToolView.__name__ = \"PolySelectToolView\";\n", " const DEFAULT_POLY_OVERLAY = () => {\n", " return new poly_annotation_1.PolyAnnotation({\n", " level: \"overlay\",\n", " xs_units: \"screen\",\n", " ys_units: \"screen\",\n", " fill_color: \"lightgrey\",\n", " fill_alpha: 0.5,\n", " line_color: \"black\",\n", " line_alpha: 1.0,\n", " line_width: 2,\n", " line_dash: [4, 4],\n", " });\n", " };\n", " class PolySelectTool extends select_tool_1.SelectTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Poly Select\";\n", " this.icon = icons_1.bk_tool_icon_polygon_select;\n", " this.event_type = \"tap\";\n", " this.default_order = 11;\n", " }\n", " static init_PolySelectTool() {\n", " this.prototype.default_view = PolySelectToolView;\n", " this.define({\n", " overlay: [p.Instance, DEFAULT_POLY_OVERLAY],\n", " });\n", " this.register_alias(\"poly_select\", () => new PolySelectTool());\n", " }\n", " }\n", " exports.PolySelectTool = PolySelectTool;\n", " PolySelectTool.__name__ = \"PolySelectTool\";\n", " PolySelectTool.init_PolySelectTool();\n", " },\n", " /* models/tools/gestures/range_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const box_annotation_1 = require(107) /* ../../annotations/box_annotation */;\n", " const logging_1 = require(72) /* ../../../core/logging */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const gesture_tool_1 = require(284) /* ./gesture_tool */;\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " function flip_side(side) {\n", " switch (side) {\n", " case 1 /* Left */: return 2 /* Right */;\n", " case 2 /* Right */: return 1 /* Left */;\n", " case 4 /* Bottom */: return 5 /* Top */;\n", " case 5 /* Top */: return 4 /* Bottom */;\n", " default: return side;\n", " }\n", " }\n", " exports.flip_side = flip_side;\n", " // TODO (bev) This would be better directly with BoxAnnotation, but hard\n", " // to test on a view. Move when \"View Models\" are implemented\n", " function is_near(pos, value, scale, tolerance) {\n", " if (value == null)\n", " return false;\n", " const svalue = scale.compute(value);\n", " return Math.abs(pos - svalue) < tolerance;\n", " }\n", " exports.is_near = is_near;\n", " // TODO (bev) This would be better directly with BoxAnnotation, but hard\n", " // to test on a view. Move when \"View Models\" are implemented\n", " function is_inside(sx, sy, xscale, yscale, overlay) {\n", " let result = true;\n", " if (overlay.left != null && overlay.right != null) {\n", " const x = xscale.invert(sx);\n", " if (x < overlay.left || x > overlay.right)\n", " result = false;\n", " }\n", " if (overlay.bottom != null && overlay.top != null) {\n", " const y = yscale.invert(sy);\n", " if (y < overlay.bottom || y > overlay.top)\n", " result = false;\n", " }\n", " return result;\n", " }\n", " exports.is_inside = is_inside;\n", " function sides_inside(start, end, range) {\n", " let result = 0;\n", " if (start >= range.start && start <= range.end)\n", " result += 1;\n", " if (end >= range.start && end <= range.end)\n", " result += 1;\n", " return result;\n", " }\n", " exports.sides_inside = sides_inside;\n", " function compute_value(value, scale, sdelta, range) {\n", " const svalue = scale.compute(value);\n", " const new_value = scale.invert(svalue + sdelta);\n", " if (new_value >= range.start && new_value <= range.end)\n", " return new_value;\n", " return value;\n", " }\n", " exports.compute_value = compute_value;\n", " function update_range_end_side(end, range, side) {\n", " if (end > range.start) {\n", " range.end = end;\n", " return side;\n", " }\n", " else {\n", " range.end = range.start;\n", " range.start = end;\n", " return flip_side(side);\n", " }\n", " }\n", " exports.update_range_end_side = update_range_end_side;\n", " function update_range_start_side(start, range, side) {\n", " if (start < range.end) {\n", " range.start = start;\n", " return side;\n", " }\n", " else {\n", " range.start = range.end;\n", " range.end = start;\n", " return flip_side(side);\n", " }\n", " }\n", " exports.update_range_start_side = update_range_start_side;\n", " function update_range(range, scale, delta, plot_range) {\n", " const [sstart, send] = scale.r_compute(range.start, range.end);\n", " const [start, end] = scale.r_invert(sstart + delta, send + delta);\n", " const initial_sides_inside = sides_inside(range.start, range.end, plot_range);\n", " const final_sides_inside = sides_inside(start, end, plot_range);\n", " // Allow the update as long as the number of sides in-bounds does not decrease\n", " if (final_sides_inside >= initial_sides_inside) {\n", " range.start = start;\n", " range.end = end;\n", " }\n", " }\n", " exports.update_range = update_range;\n", " class RangeToolView extends gesture_tool_1.GestureToolView {\n", " initialize() {\n", " super.initialize();\n", " this.side = 0 /* None */;\n", " this.model.update_overlay_from_ranges();\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " if (this.model.x_range != null)\n", " this.connect(this.model.x_range.change, () => this.model.update_overlay_from_ranges());\n", " if (this.model.y_range != null)\n", " this.connect(this.model.y_range.change, () => this.model.update_overlay_from_ranges());\n", " }\n", " _pan_start(ev) {\n", " this.last_dx = 0;\n", " this.last_dy = 0;\n", " const xr = this.model.x_range;\n", " const yr = this.model.y_range;\n", " const frame = this.plot_view.frame;\n", " const xscale = frame.xscales.default;\n", " const yscale = frame.yscales.default;\n", " const overlay = this.model.overlay;\n", " const { left, right, top, bottom } = overlay;\n", " const tolerance = this.model.overlay.properties.line_width.value() + box_annotation_1.EDGE_TOLERANCE;\n", " if (xr != null && this.model.x_interaction) {\n", " if (is_near(ev.sx, left, xscale, tolerance))\n", " this.side = 1 /* Left */;\n", " else if (is_near(ev.sx, right, xscale, tolerance))\n", " this.side = 2 /* Right */;\n", " else if (is_inside(ev.sx, ev.sy, xscale, yscale, overlay)) {\n", " this.side = 3 /* LeftRight */;\n", " }\n", " }\n", " if (yr != null && this.model.y_interaction) {\n", " if (this.side == 0 /* None */ && is_near(ev.sy, bottom, yscale, tolerance))\n", " this.side = 4 /* Bottom */;\n", " if (this.side == 0 /* None */ && is_near(ev.sy, top, yscale, tolerance))\n", " this.side = 5 /* Top */;\n", " else if (is_inside(ev.sx, ev.sy, xscale, yscale, this.model.overlay)) {\n", " if (this.side == 3 /* LeftRight */)\n", " this.side = 7 /* LeftRightBottomTop */;\n", " else\n", " this.side = 6 /* BottomTop */;\n", " }\n", " }\n", " }\n", " _pan(ev) {\n", " const frame = this.plot_view.frame;\n", " const new_dx = ev.deltaX - this.last_dx;\n", " const new_dy = ev.deltaY - this.last_dy;\n", " const xr = this.model.x_range;\n", " const yr = this.model.y_range;\n", " const xscale = frame.xscales.default;\n", " const yscale = frame.yscales.default;\n", " if (xr != null) {\n", " if (this.side == 3 /* LeftRight */ || this.side == 7 /* LeftRightBottomTop */)\n", " update_range(xr, xscale, new_dx, frame.x_range);\n", " else if (this.side == 1 /* Left */) {\n", " const start = compute_value(xr.start, xscale, new_dx, frame.x_range);\n", " this.side = update_range_start_side(start, xr, this.side);\n", " }\n", " else if (this.side == 2 /* Right */) {\n", " const end = compute_value(xr.end, xscale, new_dx, frame.x_range);\n", " this.side = update_range_end_side(end, xr, this.side);\n", " }\n", " }\n", " if (yr != null) {\n", " if (this.side == 6 /* BottomTop */ || this.side == 7 /* LeftRightBottomTop */)\n", " update_range(yr, yscale, new_dy, frame.y_range);\n", " else if (this.side == 4 /* Bottom */) {\n", " const start = compute_value(yr.start, yscale, new_dy, frame.y_range);\n", " this.side = update_range_start_side(start, yr, this.side);\n", " }\n", " else if (this.side == 5 /* Top */) {\n", " const end = compute_value(yr.end, yscale, new_dy, frame.y_range);\n", " this.side = update_range_end_side(end, yr, this.side);\n", " }\n", " }\n", " this.last_dx = ev.deltaX;\n", " this.last_dy = ev.deltaY;\n", " }\n", " _pan_end(_ev) {\n", " this.side = 0 /* None */;\n", " }\n", " }\n", " exports.RangeToolView = RangeToolView;\n", " RangeToolView.__name__ = \"RangeToolView\";\n", " const DEFAULT_RANGE_OVERLAY = () => {\n", " return new box_annotation_1.BoxAnnotation({\n", " level: \"overlay\",\n", " fill_color: \"lightgrey\",\n", " fill_alpha: 0.5,\n", " line_color: \"black\",\n", " line_alpha: 1.0,\n", " line_width: 0.5,\n", " line_dash: [2, 2],\n", " });\n", " };\n", " class RangeTool extends gesture_tool_1.GestureTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Range Tool\";\n", " this.icon = icons_1.bk_tool_icon_range;\n", " this.event_type = \"pan\";\n", " this.default_order = 1;\n", " }\n", " static init_RangeTool() {\n", " this.prototype.default_view = RangeToolView;\n", " this.define({\n", " x_range: [p.Instance, null],\n", " x_interaction: [p.Boolean, true],\n", " y_range: [p.Instance, null],\n", " y_interaction: [p.Boolean, true],\n", " overlay: [p.Instance, DEFAULT_RANGE_OVERLAY],\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.overlay.in_cursor = \"grab\";\n", " this.overlay.ew_cursor = this.x_range != null && this.x_interaction ? \"ew-resize\" : null;\n", " this.overlay.ns_cursor = this.y_range != null && this.y_interaction ? \"ns-resize\" : null;\n", " }\n", " update_overlay_from_ranges() {\n", " if (this.x_range == null && this.y_range == null) {\n", " this.overlay.left = null;\n", " this.overlay.right = null;\n", " this.overlay.bottom = null;\n", " this.overlay.top = null;\n", " logging_1.logger.warn('RangeTool not configured with any Ranges.');\n", " }\n", " if (this.x_range == null) {\n", " this.overlay.left = null;\n", " this.overlay.right = null;\n", " }\n", " else {\n", " this.overlay.left = this.x_range.start;\n", " this.overlay.right = this.x_range.end;\n", " }\n", " if (this.y_range == null) {\n", " this.overlay.bottom = null;\n", " this.overlay.top = null;\n", " }\n", " else {\n", " this.overlay.bottom = this.y_range.start;\n", " this.overlay.top = this.y_range.end;\n", " }\n", " }\n", " }\n", " exports.RangeTool = RangeTool;\n", " RangeTool.__name__ = \"RangeTool\";\n", " RangeTool.init_RangeTool();\n", " },\n", " /* models/tools/gestures/tap_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const select_tool_1 = require(340) /* ./select_tool */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class TapToolView extends select_tool_1.SelectToolView {\n", " _tap(ev) {\n", " const { sx, sy } = ev;\n", " const geometry = { type: \"point\", sx, sy };\n", " this._select(geometry, true, this._select_mode(ev));\n", " }\n", " _select(geometry, final, mode) {\n", " const callback = this.model.callback;\n", " if (this.model.behavior == \"select\") {\n", " const renderers_by_source = this._computed_renderers_by_data_source();\n", " for (const [, renderers] of renderers_by_source) {\n", " const sm = renderers[0].get_selection_manager();\n", " const r_views = renderers.map((r) => this.plot_view.renderer_views.get(r));\n", " const did_hit = sm.select(r_views, geometry, final, mode);\n", " if (did_hit && callback != null) {\n", " const { frame } = this.plot_view;\n", " const xscale = frame.xscales[renderers[0].x_range_name];\n", " const yscale = frame.yscales[renderers[0].y_range_name];\n", " const x = xscale.invert(geometry.sx);\n", " const y = yscale.invert(geometry.sy);\n", " const data = { geometries: Object.assign(Object.assign({}, geometry), { x, y }), source: sm.source };\n", " callback.execute(this.model, data);\n", " }\n", " }\n", " this._emit_selection_event(geometry);\n", " this.plot_view.push_state('tap', { selection: this.plot_view.get_selection() });\n", " }\n", " else {\n", " for (const r of this.computed_renderers) {\n", " const sm = r.get_selection_manager();\n", " const did_hit = sm.inspect(this.plot_view.renderer_views.get(r), geometry);\n", " if (did_hit && callback != null) {\n", " const { frame } = this.plot_view;\n", " const xscale = frame.xscales[r.x_range_name];\n", " const yscale = frame.yscales[r.y_range_name];\n", " const x = xscale.invert(geometry.sx);\n", " const y = yscale.invert(geometry.sy);\n", " const data = { geometries: Object.assign(Object.assign({}, geometry), { x, y }), source: sm.source };\n", " callback.execute(this.model, data);\n", " }\n", " }\n", " }\n", " }\n", " }\n", " exports.TapToolView = TapToolView;\n", " TapToolView.__name__ = \"TapToolView\";\n", " class TapTool extends select_tool_1.SelectTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Tap\";\n", " this.icon = icons_1.bk_tool_icon_tap_select;\n", " this.event_type = \"tap\";\n", " this.default_order = 10;\n", " }\n", " static init_TapTool() {\n", " this.prototype.default_view = TapToolView;\n", " this.define({\n", " behavior: [p.TapBehavior, \"select\"],\n", " callback: [p.Any],\n", " });\n", " this.register_alias(\"click\", () => new TapTool({ behavior: \"inspect\" }));\n", " this.register_alias(\"tap\", () => new TapTool());\n", " }\n", " }\n", " exports.TapTool = TapTool;\n", " TapTool.__name__ = \"TapTool\";\n", " TapTool.init_TapTool();\n", " },\n", " /* models/tools/gestures/wheel_pan_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const gesture_tool_1 = require(284) /* ./gesture_tool */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class WheelPanToolView extends gesture_tool_1.GestureToolView {\n", " _scroll(ev) {\n", " let factor = this.model.speed * ev.delta;\n", " // clamp the magnitude of factor, if it is > 1 bad things happen\n", " if (factor > 0.9)\n", " factor = 0.9;\n", " else if (factor < -0.9)\n", " factor = -0.9;\n", " this._update_ranges(factor);\n", " }\n", " _update_ranges(factor) {\n", " const { frame } = this.plot_view;\n", " const hr = frame.bbox.h_range;\n", " const vr = frame.bbox.v_range;\n", " const [sx_low, sx_high] = [hr.start, hr.end];\n", " const [sy_low, sy_high] = [vr.start, vr.end];\n", " let sx0;\n", " let sx1;\n", " let sy0;\n", " let sy1;\n", " switch (this.model.dimension) {\n", " case \"height\": {\n", " const sy_range = Math.abs(sy_high - sy_low);\n", " sx0 = sx_low;\n", " sx1 = sx_high;\n", " sy0 = sy_low - sy_range * factor;\n", " sy1 = sy_high - sy_range * factor;\n", " break;\n", " }\n", " case \"width\": {\n", " const sx_range = Math.abs(sx_high - sx_low);\n", " sx0 = sx_low - sx_range * factor;\n", " sx1 = sx_high - sx_range * factor;\n", " sy0 = sy_low;\n", " sy1 = sy_high;\n", " break;\n", " }\n", " default:\n", " throw new Error(\"this shouldn't have happened\");\n", " }\n", " const { xscales, yscales } = frame;\n", " const xrs = {};\n", " for (const name in xscales) {\n", " const scale = xscales[name];\n", " const [start, end] = scale.r_invert(sx0, sx1);\n", " xrs[name] = { start, end };\n", " }\n", " const yrs = {};\n", " for (const name in yscales) {\n", " const scale = yscales[name];\n", " const [start, end] = scale.r_invert(sy0, sy1);\n", " yrs[name] = { start, end };\n", " }\n", " // OK this sucks we can't set factor independently in each direction. It is used\n", " // for GMap plots, and GMap plots always preserve aspect, so effective the value\n", " // of 'dimensions' is ignored.\n", " const pan_info = { xrs, yrs, factor };\n", " this.plot_view.push_state('wheel_pan', { range: pan_info });\n", " this.plot_view.update_range(pan_info, false, true);\n", " if (this.model.document != null)\n", " this.model.document.interactive_start(this.plot_model);\n", " }\n", " }\n", " exports.WheelPanToolView = WheelPanToolView;\n", " WheelPanToolView.__name__ = \"WheelPanToolView\";\n", " class WheelPanTool extends gesture_tool_1.GestureTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Wheel Pan\";\n", " this.icon = icons_1.bk_tool_icon_wheel_pan;\n", " this.event_type = \"scroll\";\n", " this.default_order = 12;\n", " }\n", " static init_WheelPanTool() {\n", " this.prototype.default_view = WheelPanToolView;\n", " this.define({\n", " dimension: [p.Dimension, \"width\"],\n", " });\n", " this.internal({\n", " speed: [p.Number, 1 / 1000],\n", " });\n", " this.register_alias(\"xwheel_pan\", () => new WheelPanTool({ dimension: \"width\" }));\n", " this.register_alias(\"ywheel_pan\", () => new WheelPanTool({ dimension: \"height\" }));\n", " }\n", " get tooltip() {\n", " return this._get_dim_tooltip(this.tool_name, this.dimension);\n", " }\n", " }\n", " exports.WheelPanTool = WheelPanTool;\n", " WheelPanTool.__name__ = \"WheelPanTool\";\n", " WheelPanTool.init_WheelPanTool();\n", " },\n", " /* models/tools/gestures/wheel_zoom_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const gesture_tool_1 = require(284) /* ./gesture_tool */;\n", " const zoom_1 = require(330) /* ../../../core/util/zoom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const compat_1 = require(28) /* ../../../core/util/compat */;\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class WheelZoomToolView extends gesture_tool_1.GestureToolView {\n", " _pinch(ev) {\n", " // TODO (bev) this can probably be done much better\n", " const { sx, sy, scale, ctrlKey, shiftKey } = ev;\n", " let delta;\n", " if (scale >= 1)\n", " delta = (scale - 1) * 20.0;\n", " else\n", " delta = -20.0 / scale;\n", " this._scroll({ type: \"wheel\", sx, sy, delta, ctrlKey, shiftKey });\n", " }\n", " _scroll(ev) {\n", " const { frame } = this.plot_view;\n", " const hr = frame.bbox.h_range;\n", " const vr = frame.bbox.v_range;\n", " const { sx, sy } = ev;\n", " const dims = this.model.dimensions;\n", " // restrict to axis configured in tool's dimensions property and if\n", " // zoom origin is inside of frame range/domain\n", " const h_axis = (dims == 'width' || dims == 'both') && hr.start < sx && sx < hr.end;\n", " const v_axis = (dims == 'height' || dims == 'both') && vr.start < sy && sy < vr.end;\n", " if ((!h_axis || !v_axis) && !this.model.zoom_on_axis) {\n", " return;\n", " }\n", " const factor = this.model.speed * ev.delta;\n", " const zoom_info = zoom_1.scale_range(frame, factor, h_axis, v_axis, { x: sx, y: sy });\n", " this.plot_view.push_state('wheel_zoom', { range: zoom_info });\n", " this.plot_view.update_range(zoom_info, false, true, this.model.maintain_focus);\n", " if (this.model.document != null)\n", " this.model.document.interactive_start(this.plot_model);\n", " }\n", " }\n", " exports.WheelZoomToolView = WheelZoomToolView;\n", " WheelZoomToolView.__name__ = \"WheelZoomToolView\";\n", " class WheelZoomTool extends gesture_tool_1.GestureTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Wheel Zoom\";\n", " this.icon = icons_1.bk_tool_icon_wheel_zoom;\n", " this.event_type = compat_1.is_mobile ? \"pinch\" : \"scroll\";\n", " this.default_order = 10;\n", " }\n", " static init_WheelZoomTool() {\n", " this.prototype.default_view = WheelZoomToolView;\n", " this.define({\n", " dimensions: [p.Dimensions, \"both\"],\n", " maintain_focus: [p.Boolean, true],\n", " zoom_on_axis: [p.Boolean, true],\n", " speed: [p.Number, 1 / 600],\n", " });\n", " this.register_alias(\"wheel_zoom\", () => new WheelZoomTool({ dimensions: 'both' }));\n", " this.register_alias(\"xwheel_zoom\", () => new WheelZoomTool({ dimensions: 'width' }));\n", " this.register_alias(\"ywheel_zoom\", () => new WheelZoomTool({ dimensions: 'height' }));\n", " }\n", " get tooltip() {\n", " return this._get_dim_tooltip(this.tool_name, this.dimensions);\n", " }\n", " }\n", " exports.WheelZoomTool = WheelZoomTool;\n", " WheelZoomTool.__name__ = \"WheelZoomTool\";\n", " WheelZoomTool.init_WheelZoomTool();\n", " },\n", " /* models/tools/inspectors/crosshair_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const inspect_tool_1 = require(274) /* ./inspect_tool */;\n", " const span_1 = require(141) /* ../../annotations/span */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const object_1 = require(17) /* ../../../core/util/object */;\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class CrosshairToolView extends inspect_tool_1.InspectToolView {\n", " _move(ev) {\n", " if (!this.model.active)\n", " return;\n", " const { sx, sy } = ev;\n", " if (!this.plot_view.frame.bbox.contains(sx, sy))\n", " this._update_spans(null, null);\n", " else\n", " this._update_spans(sx, sy);\n", " }\n", " _move_exit(_e) {\n", " this._update_spans(null, null);\n", " }\n", " _update_spans(x, y) {\n", " const dims = this.model.dimensions;\n", " if (dims == \"width\" || dims == \"both\")\n", " this.model.spans.width.location = y;\n", " if (dims == \"height\" || dims == \"both\")\n", " this.model.spans.height.location = x;\n", " }\n", " }\n", " exports.CrosshairToolView = CrosshairToolView;\n", " CrosshairToolView.__name__ = \"CrosshairToolView\";\n", " class CrosshairTool extends inspect_tool_1.InspectTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Crosshair\";\n", " this.icon = icons_1.bk_tool_icon_crosshair;\n", " }\n", " static init_CrosshairTool() {\n", " this.prototype.default_view = CrosshairToolView;\n", " this.define({\n", " dimensions: [p.Dimensions, \"both\"],\n", " line_color: [p.Color, 'black'],\n", " line_width: [p.Number, 1],\n", " line_alpha: [p.Number, 1.0],\n", " });\n", " this.internal({\n", " spans: [p.Any],\n", " });\n", " this.register_alias(\"crosshair\", () => new CrosshairTool());\n", " }\n", " get tooltip() {\n", " return this._get_dim_tooltip(\"Crosshair\", this.dimensions);\n", " }\n", " get synthetic_renderers() {\n", " return object_1.values(this.spans);\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.spans = {\n", " width: new span_1.Span({\n", " for_hover: true,\n", " dimension: \"width\",\n", " location_units: \"screen\",\n", " level: \"overlay\",\n", " line_color: this.line_color,\n", " line_width: this.line_width,\n", " line_alpha: this.line_alpha,\n", " }),\n", " height: new span_1.Span({\n", " for_hover: true,\n", " dimension: \"height\",\n", " location_units: \"screen\",\n", " level: \"overlay\",\n", " line_color: this.line_color,\n", " line_width: this.line_width,\n", " line_alpha: this.line_alpha,\n", " }),\n", " };\n", " }\n", " }\n", " exports.CrosshairTool = CrosshairTool;\n", " CrosshairTool.__name__ = \"CrosshairTool\";\n", " CrosshairTool.init_CrosshairTool();\n", " },\n", " /* models/tools/inspectors/customjs_hover.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const model_1 = require(71) /* ../../../model */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const object_1 = require(17) /* ../../../core/util/object */;\n", " const string_1 = require(24) /* ../../../core/util/string */;\n", " class CustomJSHover extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_CustomJSHover() {\n", " this.define({\n", " args: [p.Any, {}],\n", " code: [p.String, \"\"],\n", " });\n", " }\n", " get values() {\n", " return object_1.values(this.args);\n", " }\n", " /*protected*/ _make_code(valname, formatname, varsname, fn) {\n", " // this relies on keys(args) and values(args) returning keys and values\n", " // in the same order\n", " return new Function(...object_1.keys(this.args), valname, formatname, varsname, string_1.use_strict(fn));\n", " }\n", " format(value, format, special_vars) {\n", " const formatter = this._make_code(\"value\", \"format\", \"special_vars\", this.code);\n", " return formatter(...this.values, value, format, special_vars);\n", " }\n", " }\n", " exports.CustomJSHover = CustomJSHover;\n", " CustomJSHover.__name__ = \"CustomJSHover\";\n", " CustomJSHover.init_CustomJSHover();\n", " },\n", " /* models/tools/inspectors/hover_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const inspect_tool_1 = require(274) /* ./inspect_tool */;\n", " const tooltip_1 = require(144) /* ../../annotations/tooltip */;\n", " const glyph_renderer_1 = require(81) /* ../../renderers/glyph_renderer */;\n", " const graph_renderer_1 = require(100) /* ../../renderers/graph_renderer */;\n", " const util_1 = require(341) /* ../util */;\n", " const hittest = tslib_1.__importStar(require(93) /* ../../../core/hittest */);\n", " const templating_1 = require(160) /* ../../../core/util/templating */;\n", " const dom_1 = require(68) /* ../../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const color_1 = require(20) /* ../../../core/util/color */;\n", " const object_1 = require(17) /* ../../../core/util/object */;\n", " const types_1 = require(8) /* ../../../core/util/types */;\n", " const build_views_1 = require(99) /* ../../../core/build_views */;\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " const tooltips_1 = require(145) /* ../../../styles/tooltips */;\n", " function _nearest_line_hit(i, geometry, sx, sy, dx, dy) {\n", " const d1 = { x: dx[i], y: dy[i] };\n", " const d2 = { x: dx[i + 1], y: dy[i + 1] };\n", " let dist1;\n", " let dist2;\n", " if (geometry.type == \"span\") {\n", " if (geometry.direction == \"h\") {\n", " dist1 = Math.abs(d1.x - sx);\n", " dist2 = Math.abs(d2.x - sx);\n", " }\n", " else {\n", " dist1 = Math.abs(d1.y - sy);\n", " dist2 = Math.abs(d2.y - sy);\n", " }\n", " }\n", " else {\n", " const s = { x: sx, y: sy };\n", " dist1 = hittest.dist_2_pts(d1, s);\n", " dist2 = hittest.dist_2_pts(d2, s);\n", " }\n", " if (dist1 < dist2)\n", " return [[d1.x, d1.y], i];\n", " else\n", " return [[d2.x, d2.y], i + 1];\n", " }\n", " exports._nearest_line_hit = _nearest_line_hit;\n", " function _line_hit(xs, ys, ind) {\n", " return [[xs[ind], ys[ind]], ind];\n", " }\n", " exports._line_hit = _line_hit;\n", " class HoverToolView extends inspect_tool_1.InspectToolView {\n", " initialize() {\n", " super.initialize();\n", " this._ttmodels = null;\n", " this._ttviews = new Map();\n", " }\n", " remove() {\n", " build_views_1.remove_views(this._ttviews);\n", " super.remove();\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " for (const r of this.computed_renderers) {\n", " if (r instanceof glyph_renderer_1.GlyphRenderer)\n", " this.connect(r.data_source.inspect, this._update);\n", " else if (r instanceof graph_renderer_1.GraphRenderer) {\n", " this.connect(r.node_renderer.data_source.inspect, this._update);\n", " this.connect(r.edge_renderer.data_source.inspect, this._update);\n", " }\n", " }\n", " // TODO: this.connect(this.plot_model.properties.renderers.change, () => this._computed_renderers = this._ttmodels = null)\n", " this.connect(this.model.properties.renderers.change, () => this._computed_renderers = this._ttmodels = null);\n", " this.connect(this.model.properties.names.change, () => this._computed_renderers = this._ttmodels = null);\n", " this.connect(this.model.properties.tooltips.change, () => this._ttmodels = null);\n", " }\n", " _compute_ttmodels() {\n", " const ttmodels = new Map();\n", " const tooltips = this.model.tooltips;\n", " if (tooltips != null) {\n", " for (const r of this.computed_renderers) {\n", " const tooltip = new tooltip_1.Tooltip({\n", " custom: types_1.isString(tooltips) || types_1.isFunction(tooltips),\n", " attachment: this.model.attachment,\n", " show_arrow: this.model.show_arrow,\n", " });\n", " if (r instanceof glyph_renderer_1.GlyphRenderer) {\n", " ttmodels.set(r, tooltip);\n", " }\n", " else if (r instanceof graph_renderer_1.GraphRenderer) {\n", " ttmodels.set(r.node_renderer, tooltip);\n", " ttmodels.set(r.edge_renderer, tooltip);\n", " }\n", " }\n", " }\n", " build_views_1.build_views(this._ttviews, [...ttmodels.values()], { parent: this.plot_view });\n", " return ttmodels;\n", " }\n", " get computed_renderers() {\n", " if (this._computed_renderers == null) {\n", " const renderers = this.model.renderers;\n", " const all_renderers = this.plot_model.renderers;\n", " const names = this.model.names;\n", " this._computed_renderers = util_1.compute_renderers(renderers, all_renderers, names);\n", " }\n", " return this._computed_renderers;\n", " }\n", " get ttmodels() {\n", " if (this._ttmodels == null)\n", " this._ttmodels = this._compute_ttmodels();\n", " return this._ttmodels;\n", " }\n", " _clear() {\n", " this._inspect(Infinity, Infinity);\n", " for (const [, tooltip] of this.ttmodels) {\n", " tooltip.clear();\n", " }\n", " }\n", " _move(ev) {\n", " if (!this.model.active)\n", " return;\n", " const { sx, sy } = ev;\n", " if (!this.plot_view.frame.bbox.contains(sx, sy))\n", " this._clear();\n", " else\n", " this._inspect(sx, sy);\n", " }\n", " _move_exit() {\n", " this._clear();\n", " }\n", " _inspect(sx, sy) {\n", " let geometry;\n", " if (this.model.mode == 'mouse')\n", " geometry = { type: 'point', sx, sy };\n", " else {\n", " const direction = this.model.mode == 'vline' ? 'h' : 'v';\n", " geometry = { type: 'span', direction, sx, sy };\n", " }\n", " for (const r of this.computed_renderers) {\n", " const sm = r.get_selection_manager();\n", " sm.inspect(this.plot_view.renderer_views.get(r), geometry);\n", " }\n", " if (this.model.callback != null)\n", " this._emit_callback(geometry);\n", " }\n", " _update([renderer_view, { geometry }]) {\n", " if (!this.model.active)\n", " return;\n", " if (!(renderer_view instanceof glyph_renderer_1.GlyphRendererView)) // || renderer_view instanceof GraphRendererView))\n", " return;\n", " const { model: renderer } = renderer_view;\n", " if (this.model.muted_policy == 'ignore' && renderer instanceof glyph_renderer_1.GlyphRenderer && renderer.muted)\n", " return;\n", " const tooltip = this.ttmodels.get(renderer);\n", " if (tooltip == null)\n", " return;\n", " tooltip.clear();\n", " const selection_manager = renderer.get_selection_manager();\n", " let indices = selection_manager.inspectors.get(renderer);\n", " if (renderer instanceof glyph_renderer_1.GlyphRenderer)\n", " indices = renderer.view.convert_selection_to_subset(indices);\n", " if (indices.is_empty())\n", " return;\n", " const ds = selection_manager.source;\n", " const { frame } = this.plot_view;\n", " const { sx, sy } = geometry;\n", " const xscale = frame.xscales[renderer.x_range_name];\n", " const yscale = frame.yscales[renderer.y_range_name];\n", " const x = xscale.invert(sx);\n", " const y = yscale.invert(sy);\n", " const glyph = renderer_view.glyph; // XXX\n", " for (const i of indices.line_indices) {\n", " let data_x = glyph._x[i + 1];\n", " let data_y = glyph._y[i + 1];\n", " let ii = i;\n", " let rx;\n", " let ry;\n", " switch (this.model.line_policy) {\n", " case \"interp\": { // and renderer.get_interpolation_hit?\n", " [data_x, data_y] = glyph.get_interpolation_hit(i, geometry);\n", " rx = xscale.compute(data_x);\n", " ry = yscale.compute(data_y);\n", " break;\n", " }\n", " case \"prev\": {\n", " [[rx, ry], ii] = _line_hit(glyph.sx, glyph.sy, i);\n", " break;\n", " }\n", " case \"next\": {\n", " [[rx, ry], ii] = _line_hit(glyph.sx, glyph.sy, i + 1);\n", " break;\n", " }\n", " case \"nearest\": {\n", " [[rx, ry], ii] = _nearest_line_hit(i, geometry, sx, sy, glyph.sx, glyph.sy);\n", " data_x = glyph._x[ii];\n", " data_y = glyph._y[ii];\n", " break;\n", " }\n", " default: {\n", " [rx, ry] = [sx, sy];\n", " }\n", " }\n", " const vars = {\n", " index: ii,\n", " x, y, sx, sy, data_x, data_y, rx, ry,\n", " indices: indices.line_indices,\n", " name: renderer_view.model.name,\n", " };\n", " tooltip.add(rx, ry, this._render_tooltips(ds, ii, vars));\n", " }\n", " for (const struct of indices.image_indices) {\n", " const vars = { index: struct.index, x, y, sx, sy };\n", " const rendered = this._render_tooltips(ds, struct, vars);\n", " tooltip.add(sx, sy, rendered);\n", " }\n", " for (const i of indices.indices) {\n", " // multiglyphs set additional indices, e.g. multiline_indices for different tooltips\n", " if (!object_1.isEmpty(indices.multiline_indices)) {\n", " for (const j of indices.multiline_indices[i.toString()]) { // TODO: indices.multiline_indices.get(i)\n", " let data_x = glyph._xs[i][j];\n", " let data_y = glyph._ys[i][j];\n", " let jj = j;\n", " let rx;\n", " let ry;\n", " switch (this.model.line_policy) {\n", " case \"interp\": { // and renderer.get_interpolation_hit?\n", " [data_x, data_y] = glyph.get_interpolation_hit(i, j, geometry);\n", " rx = xscale.compute(data_x);\n", " ry = yscale.compute(data_y);\n", " break;\n", " }\n", " case \"prev\": {\n", " [[rx, ry], jj] = _line_hit(glyph.sxs[i], glyph.sys[i], j);\n", " break;\n", " }\n", " case \"next\": {\n", " [[rx, ry], jj] = _line_hit(glyph.sxs[i], glyph.sys[i], j + 1);\n", " break;\n", " }\n", " case \"nearest\": {\n", " [[rx, ry], jj] = _nearest_line_hit(j, geometry, sx, sy, glyph.sxs[i], glyph.sys[i]);\n", " data_x = glyph._xs[i][jj];\n", " data_y = glyph._ys[i][jj];\n", " break;\n", " }\n", " default:\n", " throw new Error(\"should't have happened\");\n", " }\n", " let index;\n", " if (renderer instanceof glyph_renderer_1.GlyphRenderer)\n", " index = renderer.view.convert_indices_from_subset([i])[0];\n", " else\n", " index = i;\n", " const vars = {\n", " index, x, y, sx, sy, data_x, data_y,\n", " segment_index: jj,\n", " indices: indices.multiline_indices,\n", " name: renderer_view.model.name,\n", " };\n", " tooltip.add(rx, ry, this._render_tooltips(ds, index, vars));\n", " }\n", " }\n", " else {\n", " // handle non-multiglyphs\n", " const data_x = glyph._x != null ? glyph._x[i] : undefined;\n", " const data_y = glyph._y != null ? glyph._y[i] : undefined;\n", " let rx;\n", " let ry;\n", " if (this.model.point_policy == 'snap_to_data') { // and renderer.glyph.sx? and renderer.glyph.sy?\n", " // Pass in our screen position so we can determine which patch we're\n", " // over if there are discontinuous patches.\n", " let pt = glyph.get_anchor_point(this.model.anchor, i, [sx, sy]);\n", " if (pt == null)\n", " pt = glyph.get_anchor_point(\"center\", i, [sx, sy]);\n", " rx = pt.x;\n", " ry = pt.y;\n", " }\n", " else\n", " [rx, ry] = [sx, sy];\n", " let index;\n", " if (renderer instanceof glyph_renderer_1.GlyphRenderer)\n", " index = renderer.view.convert_indices_from_subset([i])[0];\n", " else\n", " index = i;\n", " const vars = {\n", " index, x, y, sx, sy, data_x, data_y,\n", " indices: indices.indices,\n", " name: renderer_view.model.name,\n", " };\n", " tooltip.add(rx, ry, this._render_tooltips(ds, index, vars));\n", " }\n", " }\n", " }\n", " _emit_callback(geometry) {\n", " for (const r of this.computed_renderers) {\n", " const index = r.data_source.inspected;\n", " const { frame } = this.plot_view;\n", " const xscale = frame.xscales[r.x_range_name];\n", " const yscale = frame.yscales[r.y_range_name];\n", " const x = xscale.invert(geometry.sx);\n", " const y = yscale.invert(geometry.sy);\n", " const g = Object.assign({ x, y }, geometry);\n", " this.model.callback.execute(this.model, { index, geometry: g, renderer: r });\n", " }\n", " }\n", " _render_tooltips(ds, i, vars) {\n", " const tooltips = this.model.tooltips;\n", " if (types_1.isString(tooltips)) {\n", " const el = dom_1.div();\n", " el.innerHTML = templating_1.replace_placeholders(tooltips, ds, i, this.model.formatters, vars);\n", " return el;\n", " }\n", " else if (types_1.isFunction(tooltips)) {\n", " return tooltips(ds, vars);\n", " }\n", " else {\n", " const rows = dom_1.div({ style: { display: \"table\", borderSpacing: \"2px\" } });\n", " for (const [label, value] of tooltips) {\n", " const row = dom_1.div({ style: { display: \"table-row\" } });\n", " rows.appendChild(row);\n", " let cell;\n", " cell = dom_1.div({ style: { display: \"table-cell\" }, class: tooltips_1.bk_tooltip_row_label }, label.length != 0 ? `${label}: ` : \"\");\n", " row.appendChild(cell);\n", " cell = dom_1.div({ style: { display: \"table-cell\" }, class: tooltips_1.bk_tooltip_row_value });\n", " row.appendChild(cell);\n", " if (value.indexOf(\"$color\") >= 0) {\n", " const [, opts = \"\", colname] = value.match(/\\$color(\\[.*\\])?:(\\w*)/); // XXX!\n", " const column = ds.get_column(colname); // XXX: change to columnar ds\n", " if (column == null) {\n", " const el = dom_1.span({}, `${colname} unknown`);\n", " cell.appendChild(el);\n", " continue;\n", " }\n", " const hex = opts.indexOf(\"hex\") >= 0;\n", " const swatch = opts.indexOf(\"swatch\") >= 0;\n", " let color = types_1.isNumber(i) ? column[i] : null;\n", " if (color == null) {\n", " const el = dom_1.span({}, \"(null)\");\n", " cell.appendChild(el);\n", " continue;\n", " }\n", " if (hex)\n", " color = color_1.color2hex(color);\n", " let el = dom_1.span({}, color);\n", " cell.appendChild(el);\n", " if (swatch) {\n", " el = dom_1.span({ class: tooltips_1.bk_tooltip_color_block, style: { backgroundColor: color } }, \" \");\n", " cell.appendChild(el);\n", " }\n", " }\n", " else {\n", " const el = dom_1.span();\n", " el.innerHTML = templating_1.replace_placeholders(value.replace(\"$~\", \"$data_\"), ds, i, this.model.formatters, vars);\n", " cell.appendChild(el);\n", " }\n", " }\n", " return rows;\n", " }\n", " }\n", " }\n", " exports.HoverToolView = HoverToolView;\n", " HoverToolView.__name__ = \"HoverToolView\";\n", " class HoverTool extends inspect_tool_1.InspectTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Hover\";\n", " this.icon = icons_1.bk_tool_icon_hover;\n", " }\n", " static init_HoverTool() {\n", " this.prototype.default_view = HoverToolView;\n", " this.define({\n", " tooltips: [p.Any, [\n", " [\"index\", \"$index\"],\n", " [\"data (x, y)\", \"($x, $y)\"],\n", " [\"screen (x, y)\", \"($sx, $sy)\"],\n", " ]],\n", " formatters: [p.Any, {}],\n", " renderers: [p.Any, 'auto'],\n", " names: [p.Array, []],\n", " mode: [p.HoverMode, 'mouse'],\n", " muted_policy: [p.MutedPolicy, 'show'],\n", " point_policy: [p.PointPolicy, 'snap_to_data'],\n", " line_policy: [p.LinePolicy, 'nearest'],\n", " show_arrow: [p.Boolean, true],\n", " anchor: [p.Anchor, 'center'],\n", " attachment: [p.TooltipAttachment, 'horizontal'],\n", " callback: [p.Any],\n", " });\n", " this.register_alias(\"hover\", () => new HoverTool());\n", " }\n", " }\n", " exports.HoverTool = HoverTool;\n", " HoverTool.__name__ = \"HoverTool\";\n", " HoverTool.init_HoverTool();\n", " },\n", " /* models/tools/tool_proxy.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const signaling_1 = require(14) /* ../../core/signaling */;\n", " const model_1 = require(71) /* ../../model */;\n", " const inspect_tool_1 = require(274) /* ./inspectors/inspect_tool */;\n", " const iterator_1 = require(356) /* ../../core/util/iterator */;\n", " class ToolProxy extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ToolProxy() {\n", " this.define({\n", " tools: [p.Array, []],\n", " active: [p.Boolean, false],\n", " disabled: [p.Boolean, false],\n", " });\n", " }\n", " // Operates all the tools given only one button\n", " get button_view() {\n", " return this.tools[0].button_view;\n", " }\n", " get event_type() {\n", " return this.tools[0].event_type;\n", " }\n", " get tooltip() {\n", " return this.tools[0].tooltip;\n", " }\n", " get tool_name() {\n", " return this.tools[0].tool_name;\n", " }\n", " get icon() {\n", " return this.tools[0].computed_icon;\n", " }\n", " get computed_icon() {\n", " return this.icon;\n", " }\n", " get toggleable() {\n", " const tool = this.tools[0];\n", " return tool instanceof inspect_tool_1.InspectTool && tool.toggleable;\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.do = new signaling_1.Signal0(this, \"do\");\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.do, () => this.doit());\n", " this.connect(this.properties.active.change, () => this.set_active());\n", " for (const tool of this.tools) {\n", " this.connect(tool.properties.active.change, () => {\n", " this.active = tool.active;\n", " });\n", " }\n", " }\n", " doit() {\n", " for (const tool of this.tools) {\n", " tool.do.emit();\n", " }\n", " }\n", " set_active() {\n", " for (const tool of this.tools) {\n", " tool.active = this.active;\n", " }\n", " }\n", " get menu() {\n", " const { menu } = this.tools[0];\n", " if (menu == null)\n", " return null;\n", " const items = [];\n", " for (const [item, i] of iterator_1.enumerate(menu)) {\n", " if (item == null)\n", " items.push(null);\n", " else {\n", " const handler = () => {\n", " var _a, _b;\n", " for (const tool of this.tools) {\n", " (_b = (_a = tool.menu) === null || _a === void 0 ? void 0 : _a[i]) === null || _b === void 0 ? void 0 : _b.handler();\n", " }\n", " };\n", " items.push(Object.assign(Object.assign({}, item), { handler }));\n", " }\n", " }\n", " return items;\n", " }\n", " }\n", " exports.ToolProxy = ToolProxy;\n", " ToolProxy.__name__ = \"ToolProxy\";\n", " ToolProxy.init_ToolProxy();\n", " },\n", " /* core/util/iterator.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const array_1 = require(9) /* ./array */;\n", " function* enumerate(seq) {\n", " let i = 0;\n", " for (const item of seq) {\n", " yield [item, i++];\n", " }\n", " }\n", " exports.enumerate = enumerate;\n", " // https://docs.python.org/3.8/library/itertools.html#itertools.combinations\n", " function* combinations(seq, r) {\n", " const n = seq.length;\n", " if (r > n)\n", " return;\n", " const indices = array_1.range(r);\n", " yield indices.map((i) => seq[i]);\n", " while (true) {\n", " let k;\n", " for (const i of array_1.reversed(array_1.range(r))) {\n", " if (indices[i] != i + n - r) {\n", " k = i;\n", " break;\n", " }\n", " }\n", " if (k == null)\n", " return;\n", " indices[k] += 1;\n", " for (const j of array_1.range(k + 1, r)) {\n", " indices[j] = indices[j - 1] + 1;\n", " }\n", " yield indices.map((i) => seq[i]);\n", " }\n", " }\n", " exports.combinations = combinations;\n", " function* subsets(seq) {\n", " for (const k of array_1.range(seq.length + 1)) {\n", " yield* combinations(seq, k);\n", " }\n", " }\n", " exports.subsets = subsets;\n", " },\n", " /* models/tools/toolbar_box.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const toolbar_base_1 = require(283) /* ./toolbar_base */;\n", " const tool_proxy_1 = require(355) /* ./tool_proxy */;\n", " const layout_dom_1 = require(245) /* ../layouts/layout_dom */;\n", " const layout_1 = require(188) /* ../../core/layout */;\n", " class ProxyToolbar extends toolbar_base_1.ToolbarBase {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ProxyToolbar() {\n", " this.define({\n", " toolbars: [p.Array, []],\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " this._merge_tools();\n", " }\n", " _merge_tools() {\n", " // Go through all the tools on the toolbar and replace them with\n", " // a proxy e.g. PanTool, BoxSelectTool, etc.\n", " this._proxied_tools = [];\n", " const inspectors = {};\n", " const actions = {};\n", " const gestures = {};\n", " const new_help_tools = [];\n", " const new_help_urls = [];\n", " for (const helptool of this.help) {\n", " if (!array_1.includes(new_help_urls, helptool.redirect)) {\n", " new_help_tools.push(helptool);\n", " new_help_urls.push(helptool.redirect);\n", " }\n", " }\n", " this._proxied_tools.push(...new_help_tools);\n", " this.help = new_help_tools;\n", " for (const event_type in this.gestures) {\n", " const gesture = this.gestures[event_type];\n", " if (!(event_type in gestures)) {\n", " gestures[event_type] = {};\n", " }\n", " for (const tool of gesture.tools) {\n", " if (!(tool.type in gestures[event_type])) {\n", " gestures[event_type][tool.type] = [];\n", " }\n", " gestures[event_type][tool.type].push(tool);\n", " }\n", " }\n", " for (const tool of this.inspectors) {\n", " if (!(tool.type in inspectors)) {\n", " inspectors[tool.type] = [];\n", " }\n", " inspectors[tool.type].push(tool);\n", " }\n", " for (const tool of this.actions) {\n", " if (!(tool.type in actions)) {\n", " actions[tool.type] = [];\n", " }\n", " actions[tool.type].push(tool);\n", " }\n", " // Add a proxy for each of the groups of tools.\n", " const make_proxy = (tools, active = false) => {\n", " const proxy = new tool_proxy_1.ToolProxy({ tools, active });\n", " this._proxied_tools.push(proxy);\n", " return proxy;\n", " };\n", " for (const event_type in gestures) {\n", " const gesture = this.gestures[event_type];\n", " gesture.tools = [];\n", " for (const tool_type in gestures[event_type]) {\n", " const tools = gestures[event_type][tool_type];\n", " if (tools.length > 0) {\n", " if (event_type == 'multi') {\n", " for (const tool of tools) {\n", " const proxy = make_proxy([tool]);\n", " gesture.tools.push(proxy);\n", " this.connect(proxy.properties.active.change, () => this._active_change(proxy));\n", " }\n", " }\n", " else {\n", " const proxy = make_proxy(tools);\n", " gesture.tools.push(proxy);\n", " this.connect(proxy.properties.active.change, () => this._active_change(proxy));\n", " }\n", " }\n", " }\n", " }\n", " this.actions = [];\n", " for (const tool_type in actions) {\n", " const tools = actions[tool_type];\n", " if (tool_type == 'CustomAction') {\n", " for (const tool of tools)\n", " this.actions.push(make_proxy([tool]));\n", " }\n", " else if (tools.length > 0) {\n", " this.actions.push(make_proxy(tools)); // XXX\n", " }\n", " }\n", " this.inspectors = [];\n", " for (const tool_type in inspectors) {\n", " const tools = inspectors[tool_type];\n", " if (tools.length > 0)\n", " this.inspectors.push(make_proxy(tools, true)); // XXX\n", " }\n", " for (const et in this.gestures) {\n", " const gesture = this.gestures[et];\n", " if (gesture.tools.length == 0)\n", " continue;\n", " gesture.tools = array_1.sort_by(gesture.tools, (tool) => tool.default_order);\n", " if (!(et == 'pinch' || et == 'scroll' || et == 'multi'))\n", " gesture.tools[0].active = true;\n", " }\n", " }\n", " }\n", " exports.ProxyToolbar = ProxyToolbar;\n", " ProxyToolbar.__name__ = \"ProxyToolbar\";\n", " ProxyToolbar.init_ProxyToolbar();\n", " class ToolbarBoxView extends layout_dom_1.LayoutDOMView {\n", " initialize() {\n", " this.model.toolbar.toolbar_location = this.model.toolbar_location;\n", " super.initialize();\n", " }\n", " get child_models() {\n", " return [this.model.toolbar]; // XXX\n", " }\n", " _update_layout() {\n", " this.layout = new layout_1.ContentBox(this.child_views[0].el);\n", " const { toolbar } = this.model;\n", " if (toolbar.horizontal) {\n", " this.layout.set_sizing({\n", " width_policy: \"fit\", min_width: 100, height_policy: \"fixed\",\n", " });\n", " }\n", " else {\n", " this.layout.set_sizing({\n", " width_policy: \"fixed\", height_policy: \"fit\", min_height: 100,\n", " });\n", " }\n", " }\n", " }\n", " exports.ToolbarBoxView = ToolbarBoxView;\n", " ToolbarBoxView.__name__ = \"ToolbarBoxView\";\n", " class ToolbarBox extends layout_dom_1.LayoutDOM {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ToolbarBox() {\n", " this.prototype.default_view = ToolbarBoxView;\n", " this.define({\n", " toolbar: [p.Instance],\n", " toolbar_location: [p.Location, \"right\"],\n", " });\n", " }\n", " }\n", " exports.ToolbarBox = ToolbarBox;\n", " ToolbarBox.__name__ = \"ToolbarBox\";\n", " ToolbarBox.init_ToolbarBox();\n", " },\n", " /* embed/standalone.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const document_1 = require(5) /* ../document */;\n", " const dom_view_1 = require(66) /* ../core/dom_view */;\n", " const build_views_1 = require(99) /* ../core/build_views */;\n", " const dom_1 = require(68) /* ../core/dom */;\n", " const dom_2 = require(359) /* ./dom */;\n", " // A map from the root model IDs to their views.\n", " exports.index = {};\n", " async function add_document_standalone(document, element, roots = [], use_for_title = false) {\n", " // this is a LOCAL index of views used only by this particular rendering\n", " // call, so we can remove the views we create.\n", " const views = new Map();\n", " async function render_model(model) {\n", " let root_el;\n", " const root_models = document.roots();\n", " const idx = root_models.indexOf(model);\n", " const root = roots[idx];\n", " if (root != null)\n", " root_el = root;\n", " else if (element.classList.contains(dom_2.BOKEH_ROOT))\n", " root_el = element;\n", " else {\n", " root_el = dom_1.div({ class: dom_2.BOKEH_ROOT });\n", " element.appendChild(root_el);\n", " }\n", " const view = await build_views_1.build_view(model, { parent: null });\n", " if (view instanceof dom_view_1.DOMView)\n", " view.renderTo(root_el);\n", " views.set(model, view);\n", " exports.index[model.id] = view;\n", " return view;\n", " }\n", " function unrender_model(model) {\n", " const view = views.get(model);\n", " if (view != null) {\n", " view.remove();\n", " views.delete(model);\n", " delete exports.index[model.id];\n", " }\n", " }\n", " for (const model of document.roots())\n", " await render_model(model);\n", " if (use_for_title)\n", " window.document.title = document.title();\n", " document.on_change((event) => {\n", " if (event instanceof document_1.RootAddedEvent)\n", " render_model(event.model);\n", " else if (event instanceof document_1.RootRemovedEvent)\n", " unrender_model(event.model);\n", " else if (use_for_title && event instanceof document_1.TitleChangedEvent)\n", " window.document.title = event.title;\n", " });\n", " return [...views.values()];\n", " }\n", " exports.add_document_standalone = add_document_standalone;\n", " },\n", " /* embed/dom.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const dom_1 = require(68) /* ../core/dom */;\n", " const root_1 = require(246) /* ../styles/root */;\n", " // Matches Bokeh CSS class selector. Setting all Bokeh parent element class names\n", " // with this var prevents user configurations where css styling is unset.\n", " exports.BOKEH_ROOT = root_1.bk_root;\n", " function _get_element(elementid) {\n", " let element = document.getElementById(elementid);\n", " if (element == null)\n", " throw new Error(`Error rendering Bokeh model: could not find #${elementid} HTML tag`);\n", " if (!document.body.contains(element))\n", " throw new Error(`Error rendering Bokeh model: element #${elementid} must be under `);\n", " // If autoload script, replace script tag with div for embedding.\n", " if (element.tagName == \"SCRIPT\") {\n", " const root_el = dom_1.div({ class: exports.BOKEH_ROOT });\n", " dom_1.replaceWith(element, root_el);\n", " element = root_el;\n", " }\n", " return element;\n", " }\n", " function _resolve_element(item) {\n", " const { elementid } = item;\n", " if (elementid != null)\n", " return _get_element(elementid);\n", " else\n", " return document.body;\n", " }\n", " exports._resolve_element = _resolve_element;\n", " function _resolve_root_elements(item) {\n", " const roots = [];\n", " if ((item.root_ids != null) && (item.roots != null)) {\n", " for (const root_id of item.root_ids)\n", " roots.push(_get_element(item.roots[root_id]));\n", " }\n", " return roots;\n", " }\n", " exports._resolve_root_elements = _resolve_root_elements;\n", " },\n", " /* embed/server.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const connection_1 = require(361) /* ../client/connection */;\n", " const logging_1 = require(72) /* ../core/logging */;\n", " const standalone_1 = require(358) /* ./standalone */;\n", " // @internal\n", " function _get_ws_url(app_path, absolute_url) {\n", " let protocol = 'ws:';\n", " if (window.location.protocol == 'https:')\n", " protocol = 'wss:';\n", " let loc;\n", " if (absolute_url != null) {\n", " loc = document.createElement('a');\n", " loc.href = absolute_url;\n", " }\n", " else\n", " loc = window.location;\n", " if (app_path != null) {\n", " if (app_path == \"/\")\n", " app_path = \"\";\n", " }\n", " else\n", " app_path = loc.pathname.replace(/\\/+$/, '');\n", " return protocol + '//' + loc.host + app_path + '/ws';\n", " }\n", " exports._get_ws_url = _get_ws_url;\n", " // map { websocket url to map { session id to promise of ClientSession } }\n", " const _sessions = {};\n", " function _get_session(websocket_url, token, args_string) {\n", " const session_id = connection_1.parse_token(token).session_id;\n", " if (!(websocket_url in _sessions))\n", " _sessions[websocket_url] = {};\n", " const subsessions = _sessions[websocket_url];\n", " if (!(session_id in subsessions))\n", " subsessions[session_id] = connection_1.pull_session(websocket_url, token, args_string);\n", " return subsessions[session_id];\n", " }\n", " // Fill element with the roots from token\n", " async function add_document_from_session(websocket_url, token, element, roots = [], use_for_title = false) {\n", " const args_string = window.location.search.substr(1);\n", " let session;\n", " try {\n", " session = await _get_session(websocket_url, token, args_string);\n", " }\n", " catch (error) {\n", " const session_id = connection_1.parse_token(token).session_id;\n", " logging_1.logger.error(`Failed to load Bokeh session ${session_id}: ${error}`);\n", " throw error;\n", " }\n", " return standalone_1.add_document_standalone(session.document, element, roots, use_for_title);\n", " }\n", " exports.add_document_from_session = add_document_from_session;\n", " },\n", " /* client/connection.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const logging_1 = require(72) /* ../core/logging */;\n", " const document_1 = require(5) /* ../document */;\n", " const message_1 = require(362) /* ../protocol/message */;\n", " const receiver_1 = require(363) /* ../protocol/receiver */;\n", " const session_1 = require(364) /* ./session */;\n", " exports.DEFAULT_SERVER_WEBSOCKET_URL = \"ws://localhost:5006/ws\";\n", " exports.DEFAULT_TOKEN = \"eyJzZXNzaW9uX2lkIjogImRlZmF1bHQifQ\";\n", " let _connection_count = 0;\n", " function parse_token(token) {\n", " let payload = token.split('.')[0];\n", " const mod = payload.length % 4;\n", " if (mod != 0)\n", " payload = payload + \"=\".repeat(4 - mod);\n", " return JSON.parse(atob(payload.replace(/_/g, '/').replace(/-/g, '+')));\n", " }\n", " exports.parse_token = parse_token;\n", " class ClientConnection {\n", " constructor(url = exports.DEFAULT_SERVER_WEBSOCKET_URL, token = exports.DEFAULT_TOKEN, args_string = null) {\n", " this.url = url;\n", " this.token = token;\n", " this.args_string = args_string;\n", " this._number = _connection_count++;\n", " this.socket = null;\n", " this.session = null;\n", " this.closed_permanently = false;\n", " this._current_handler = null;\n", " this._pending_replies = new Map();\n", " this._pending_messages = [];\n", " this._receiver = new receiver_1.Receiver();\n", " this.id = parse_token(token).session_id.split('.')[0];\n", " logging_1.logger.debug(`Creating websocket ${this._number} to '${this.url}' session '${this.id}'`);\n", " }\n", " async connect() {\n", " if (this.closed_permanently)\n", " throw new Error(\"Cannot connect() a closed ClientConnection\");\n", " if (this.socket != null)\n", " throw new Error(\"Already connected\");\n", " this._current_handler = null;\n", " this._pending_replies.clear();\n", " this._pending_messages = [];\n", " try {\n", " let versioned_url = `${this.url}`;\n", " if (this.args_string != null && this.args_string.length > 0)\n", " versioned_url += `?${this.args_string}`;\n", " this.socket = new WebSocket(versioned_url, [\"bokeh\", this.token]);\n", " return new Promise((resolve, reject) => {\n", " // \"arraybuffer\" gives us binary data we can look at;\n", " // if we just needed an opaque blob we could use \"blob\"\n", " this.socket.binaryType = \"arraybuffer\";\n", " this.socket.onopen = () => this._on_open(resolve, reject);\n", " this.socket.onmessage = (event) => this._on_message(event);\n", " this.socket.onclose = (event) => this._on_close(event, reject);\n", " this.socket.onerror = () => this._on_error(reject);\n", " });\n", " }\n", " catch (error) {\n", " logging_1.logger.error(`websocket creation failed to url: ${this.url}`);\n", " logging_1.logger.error(` - ${error}`);\n", " throw error;\n", " }\n", " }\n", " close() {\n", " if (!this.closed_permanently) {\n", " logging_1.logger.debug(`Permanently closing websocket connection ${this._number}`);\n", " this.closed_permanently = true;\n", " if (this.socket != null)\n", " this.socket.close(1000, `close method called on ClientConnection ${this._number}`);\n", " this.session._connection_closed();\n", " }\n", " }\n", " _schedule_reconnect(milliseconds) {\n", " const retry = () => {\n", " // TODO commented code below until we fix reconnection to repull\n", " // the document when required. Otherwise, we get a lot of\n", " // confusing errors that are causing trouble when debugging.\n", " /*\n", " if (this.closed_permanently) {\n", " */\n", " if (!this.closed_permanently)\n", " logging_1.logger.info(`Websocket connection ${this._number} disconnected, will not attempt to reconnect`);\n", " return;\n", " /*\n", " } else {\n", " logger.debug(`Attempting to reconnect websocket ${this._number}`)\n", " this.connect()\n", " }\n", " */\n", " };\n", " setTimeout(retry, milliseconds);\n", " }\n", " send(message) {\n", " if (this.socket == null)\n", " throw new Error(`not connected so cannot send ${message}`);\n", " message.send(this.socket);\n", " }\n", " async send_with_reply(message) {\n", " const reply = await new Promise((resolve, reject) => {\n", " this._pending_replies.set(message.msgid(), { resolve, reject });\n", " this.send(message);\n", " });\n", " if (reply.msgtype() === \"ERROR\")\n", " throw new Error(`Error reply ${reply.content.text}`);\n", " else\n", " return reply;\n", " }\n", " async _pull_doc_json() {\n", " const message = message_1.Message.create(\"PULL-DOC-REQ\", {});\n", " const reply = await this.send_with_reply(message);\n", " if (!(\"doc\" in reply.content))\n", " throw new Error(\"No 'doc' field in PULL-DOC-REPLY\");\n", " return reply.content.doc;\n", " }\n", " async _repull_session_doc(resolve, reject) {\n", " var _a;\n", " logging_1.logger.debug(this.session ? \"Repulling session\" : \"Pulling session for first time\");\n", " try {\n", " const doc_json = await this._pull_doc_json();\n", " if (this.session == null) {\n", " if (this.closed_permanently) {\n", " logging_1.logger.debug(\"Got new document after connection was already closed\");\n", " reject(new Error(\"The connection has been closed\"));\n", " }\n", " else {\n", " const document = document_1.Document.from_json(doc_json);\n", " // Constructing models changes some of their attributes, we deal with that\n", " // here. This happens when models set attributes during construction\n", " // or initialization.\n", " const patch = document_1.Document._compute_patch_since_json(doc_json, document);\n", " if (patch.events.length > 0) {\n", " logging_1.logger.debug(`Sending ${patch.events.length} changes from model construction back to server`);\n", " const patch_message = message_1.Message.create('PATCH-DOC', {}, patch);\n", " this.send(patch_message);\n", " }\n", " this.session = new session_1.ClientSession(this, document, this.id);\n", " for (const msg of this._pending_messages) {\n", " this.session.handle(msg);\n", " }\n", " this._pending_messages = [];\n", " logging_1.logger.debug(\"Created a new session from new pulled doc\");\n", " resolve(this.session);\n", " }\n", " }\n", " else {\n", " this.session.document.replace_with_json(doc_json);\n", " logging_1.logger.debug(\"Updated existing session with new pulled doc\");\n", " // Since the session already exists, we don't need to call `resolve` again.\n", " }\n", " }\n", " catch (error) {\n", " (_a = console.trace) === null || _a === void 0 ? void 0 : _a.call(console, error);\n", " logging_1.logger.error(`Failed to repull session ${error}`);\n", " reject(error);\n", " }\n", " }\n", " _on_open(resolve, reject) {\n", " logging_1.logger.info(`Websocket connection ${this._number} is now open`);\n", " this._current_handler = (message) => {\n", " this._awaiting_ack_handler(message, resolve, reject);\n", " };\n", " }\n", " _on_message(event) {\n", " if (this._current_handler == null)\n", " logging_1.logger.error(\"Got a message with no current handler set\");\n", " try {\n", " this._receiver.consume(event.data);\n", " }\n", " catch (e) {\n", " this._close_bad_protocol(e.toString());\n", " }\n", " const msg = this._receiver.message;\n", " if (msg != null) {\n", " const problem = msg.problem();\n", " if (problem != null)\n", " this._close_bad_protocol(problem);\n", " this._current_handler(msg);\n", " }\n", " }\n", " _on_close(event, reject) {\n", " logging_1.logger.info(`Lost websocket ${this._number} connection, ${event.code} (${event.reason})`);\n", " this.socket = null;\n", " this._pending_replies.forEach((pr) => pr.reject(\"Disconnected\"));\n", " this._pending_replies.clear();\n", " if (!this.closed_permanently)\n", " this._schedule_reconnect(2000);\n", " reject(new Error(`Lost websocket connection, ${event.code} (${event.reason})`));\n", " }\n", " _on_error(reject) {\n", " logging_1.logger.debug(`Websocket error on socket ${this._number}`);\n", " const msg = \"Could not open websocket\";\n", " logging_1.logger.error(`Failed to connect to Bokeh server: ${msg}`);\n", " reject(new Error(msg));\n", " }\n", " _close_bad_protocol(detail) {\n", " logging_1.logger.error(`Closing connection: ${detail}`);\n", " if (this.socket != null)\n", " this.socket.close(1002, detail); // 1002 = protocol error\n", " }\n", " _awaiting_ack_handler(message, resolve, reject) {\n", " if (message.msgtype() === \"ACK\") {\n", " this._current_handler = (message) => this._steady_state_handler(message);\n", " // Reload any sessions\n", " this._repull_session_doc(resolve, reject);\n", " }\n", " else\n", " this._close_bad_protocol(\"First message was not an ACK\");\n", " }\n", " _steady_state_handler(message) {\n", " const reqid = message.reqid();\n", " const pr = this._pending_replies.get(reqid);\n", " if (pr) {\n", " this._pending_replies.delete(reqid);\n", " pr.resolve(message);\n", " }\n", " else if (this.session) {\n", " this.session.handle(message);\n", " }\n", " else if (message.msgtype() != 'PATCH-DOC') {\n", " // This branch can be executed only before we get the document.\n", " // When we get the document, all of the patches will already be incorporated.\n", " // In general, it's not possible to apply patches received before the document,\n", " // since they may change some models that were removed before serving the document.\n", " this._pending_messages.push(message);\n", " }\n", " }\n", " }\n", " exports.ClientConnection = ClientConnection;\n", " ClientConnection.__name__ = \"ClientConnection\";\n", " function pull_session(url, token, args_string) {\n", " const connection = new ClientConnection(url, token, args_string);\n", " return connection.connect();\n", " }\n", " exports.pull_session = pull_session;\n", " },\n", " /* protocol/message.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const string_1 = require(24) /* ../core/util/string */;\n", " class Message {\n", " constructor(header, metadata, content) {\n", " this.header = header;\n", " this.metadata = metadata;\n", " this.content = content;\n", " this.buffers = new Map();\n", " }\n", " static assemble(header_json, metadata_json, content_json) {\n", " const header = JSON.parse(header_json);\n", " const metadata = JSON.parse(metadata_json);\n", " const content = JSON.parse(content_json);\n", " return new Message(header, metadata, content);\n", " }\n", " assemble_buffer(buf_header, buf_payload) {\n", " const nb = this.header.num_buffers != null ? this.header.num_buffers : 0;\n", " if (nb <= this.buffers.size)\n", " throw new Error(`too many buffers received, expecting ${nb}`);\n", " const { id } = JSON.parse(buf_header);\n", " this.buffers.set(id, buf_payload);\n", " }\n", " // not defined for BokehJS, only *receiving* buffers is supported\n", " // add_buffer: (buf_header, buf_payload) ->\n", " // write_buffers: (socket)\n", " static create(msgtype, metadata, content = {}) {\n", " const header = Message.create_header(msgtype);\n", " return new Message(header, metadata, content);\n", " }\n", " static create_header(msgtype) {\n", " return {\n", " msgid: string_1.uniqueId(),\n", " msgtype,\n", " };\n", " }\n", " complete() {\n", " if (this.header != null && this.metadata != null && this.content != null) {\n", " if (this.header.num_buffers != undefined)\n", " return this.buffers.size == this.header.num_buffers;\n", " else\n", " return true;\n", " }\n", " else\n", " return false;\n", " }\n", " send(socket) {\n", " const nb = this.header.num_buffers != null ? this.header.num_buffers : 0;\n", " if (nb > 0)\n", " throw new Error(\"BokehJS only supports receiving buffers, not sending\");\n", " const header_json = JSON.stringify(this.header);\n", " const metadata_json = JSON.stringify(this.metadata);\n", " const content_json = JSON.stringify(this.content);\n", " socket.send(header_json);\n", " socket.send(metadata_json);\n", " socket.send(content_json);\n", " }\n", " msgid() {\n", " return this.header.msgid;\n", " }\n", " msgtype() {\n", " return this.header.msgtype;\n", " }\n", " reqid() {\n", " return this.header.reqid;\n", " }\n", " // return the reason we should close on bad protocol, if there is one\n", " problem() {\n", " if (!('msgid' in this.header))\n", " return \"No msgid in header\";\n", " else if (!('msgtype' in this.header))\n", " return \"No msgtype in header\";\n", " else\n", " return null;\n", " }\n", " }\n", " exports.Message = Message;\n", " Message.__name__ = \"Message\";\n", " },\n", " /* protocol/receiver.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const message_1 = require(362) /* ./message */;\n", " const types_1 = require(8) /* ../core/util/types */;\n", " class Receiver {\n", " constructor() {\n", " this.message = null;\n", " this._partial = null;\n", " this._fragments = [];\n", " this._buf_header = null;\n", " this._current_consumer = this._HEADER;\n", " }\n", " consume(fragment) {\n", " this._current_consumer(fragment);\n", " }\n", " _HEADER(fragment) {\n", " this._assume_text(fragment);\n", " this.message = null;\n", " this._partial = null;\n", " this._fragments = [fragment];\n", " this._buf_header = null;\n", " this._current_consumer = this._METADATA;\n", " }\n", " _METADATA(fragment) {\n", " this._assume_text(fragment);\n", " this._fragments.push(fragment);\n", " this._current_consumer = this._CONTENT;\n", " }\n", " _CONTENT(fragment) {\n", " this._assume_text(fragment);\n", " this._fragments.push(fragment);\n", " const [header_json, metadata_json, content_json] = this._fragments.slice(0, 3);\n", " this._partial = message_1.Message.assemble(header_json, metadata_json, content_json);\n", " this._check_complete();\n", " }\n", " _BUFFER_HEADER(fragment) {\n", " this._assume_text(fragment);\n", " this._buf_header = fragment;\n", " this._current_consumer = this._BUFFER_PAYLOAD;\n", " }\n", " _BUFFER_PAYLOAD(fragment) {\n", " this._assume_binary(fragment);\n", " this._partial.assemble_buffer(this._buf_header, fragment);\n", " this._check_complete();\n", " }\n", " _assume_text(fragment) {\n", " if (!types_1.isString(fragment))\n", " throw new Error(\"Expected text fragment but received binary fragment\");\n", " }\n", " _assume_binary(fragment) {\n", " if (!(fragment instanceof ArrayBuffer))\n", " throw new Error(\"Expected binary fragment but received text fragment\");\n", " }\n", " _check_complete() {\n", " if (this._partial.complete()) {\n", " this.message = this._partial;\n", " this._current_consumer = this._HEADER;\n", " }\n", " else\n", " this._current_consumer = this._BUFFER_HEADER;\n", " }\n", " }\n", " exports.Receiver = Receiver;\n", " Receiver.__name__ = \"Receiver\";\n", " },\n", " /* client/session.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const document_1 = require(5) /* ../document */;\n", " const message_1 = require(362) /* ../protocol/message */;\n", " const logging_1 = require(72) /* ../core/logging */;\n", " class ClientSession {\n", " constructor(_connection, document, id) {\n", " this._connection = _connection;\n", " this.document = document;\n", " this.id = id;\n", " this._document_listener = (event) => {\n", " this._document_changed(event);\n", " };\n", " this.document.on_change(this._document_listener, true);\n", " }\n", " handle(message) {\n", " const msgtype = message.msgtype();\n", " if (msgtype === 'PATCH-DOC')\n", " this._handle_patch(message);\n", " else if (msgtype === 'OK')\n", " this._handle_ok(message);\n", " else if (msgtype === 'ERROR')\n", " this._handle_error(message);\n", " else\n", " logging_1.logger.debug(`Doing nothing with message ${message.msgtype()}`);\n", " }\n", " close() {\n", " this._connection.close();\n", " }\n", " /*protected*/ _connection_closed() {\n", " this.document.remove_on_change(this._document_listener);\n", " }\n", " // Sends a request to the server for info about the server, such as its Bokeh\n", " // version. Returns a promise, the value of the promise is a free-form dictionary\n", " // of server details.\n", " async request_server_info() {\n", " const message = message_1.Message.create('SERVER-INFO-REQ', {});\n", " const reply = await this._connection.send_with_reply(message);\n", " return reply.content;\n", " }\n", " // Sends some request to the server (no guarantee about which one) and returns\n", " // a promise which is completed when the server replies. The purpose of this\n", " // is that if you wait for the promise to be completed, you know the server\n", " // has processed the request. This is useful when writing tests because once\n", " // the server has processed this request it should also have processed any\n", " // events or requests you sent previously, which means you can check for the\n", " // results of that processing without a race condition. (This assumes the\n", " // server processes events in sequence, which it mostly has to semantically,\n", " // since reordering events might change the final state.)\n", " async force_roundtrip() {\n", " await this.request_server_info();\n", " }\n", " _document_changed(event) {\n", " // Filter out events that were initiated by the ClientSession itself\n", " if (event.setter_id === this.id) // XXX: not all document events define this\n", " return;\n", " const events = event instanceof document_1.DocumentEventBatch ? event.events : [event];\n", " const patch = this.document.create_json_patch(events);\n", " // TODO (havocp) the connection may be closed here, which will\n", " // cause this send to throw an error - need to deal with it more cleanly.\n", " const message = message_1.Message.create('PATCH-DOC', {}, patch);\n", " this._connection.send(message);\n", " }\n", " _handle_patch(message) {\n", " this.document.apply_json_patch(message.content, message.buffers, this.id);\n", " }\n", " _handle_ok(message) {\n", " logging_1.logger.trace(`Unhandled OK reply to ${message.reqid()}`);\n", " }\n", " _handle_error(message) {\n", " logging_1.logger.error(`Unhandled ERROR reply to ${message.reqid()}: ${message.content.text}`);\n", " }\n", " }\n", " exports.ClientSession = ClientSession;\n", " ClientSession.__name__ = \"ClientSession\";\n", " },\n", " /* embed/notebook.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " var __asyncValues = (this && this.__asyncValues) || function (o) {\n", " if (!Symbol.asyncIterator)\n", " throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n", " var m = o[Symbol.asyncIterator], i;\n", " return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n", " function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n", " function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }\n", " };\n", " const document_1 = require(5) /* ../document */;\n", " const receiver_1 = require(363) /* ../protocol/receiver */;\n", " const logging_1 = require(72) /* ../core/logging */;\n", " const dom_1 = require(68) /* ../core/dom */;\n", " const object_1 = require(17) /* ../core/util/object */;\n", " const standalone_1 = require(358) /* ./standalone */;\n", " const dom_2 = require(359) /* ./dom */;\n", " const root_css_1 = tslib_1.__importDefault(require(69) /* ../styles/root.css */);\n", " const logo_css_1 = tslib_1.__importDefault(require(289) /* ../styles/logo.css */);\n", " const notebook_css_1 = tslib_1.__importDefault(require(366) /* ../styles/notebook.css */);\n", " dom_1.stylesheet.append(root_css_1.default);\n", " dom_1.stylesheet.append(logo_css_1.default);\n", " dom_1.stylesheet.append(notebook_css_1.default);\n", " // This exists to allow the @bokeh/jupyter_bokeh extension to store the\n", " // notebook kernel so that _init_comms can register the comms target.\n", " // This has to be available at Bokeh.embed.kernels in JupyterLab.\n", " exports.kernels = {};\n", " function _handle_notebook_comms(receiver, comm_msg) {\n", " if (comm_msg.buffers.length > 0)\n", " receiver.consume(comm_msg.buffers[0].buffer);\n", " else\n", " receiver.consume(comm_msg.content.data);\n", " const msg = receiver.message;\n", " if (msg != null)\n", " this.apply_json_patch(msg.content, msg.buffers);\n", " }\n", " function _init_comms(target, doc) {\n", " if (typeof Jupyter !== 'undefined' && Jupyter.notebook.kernel != null) {\n", " logging_1.logger.info(`Registering Jupyter comms for target ${target}`);\n", " const comm_manager = Jupyter.notebook.kernel.comm_manager;\n", " try {\n", " comm_manager.register_target(target, (comm) => {\n", " logging_1.logger.info(`Registering Jupyter comms for target ${target}`);\n", " const r = new receiver_1.Receiver();\n", " comm.on_msg(_handle_notebook_comms.bind(doc, r));\n", " });\n", " }\n", " catch (e) {\n", " logging_1.logger.warn(`Jupyter comms failed to register. push_notebook() will not function. (exception reported: ${e})`);\n", " }\n", " }\n", " else if (doc.roots()[0].id in exports.kernels) {\n", " logging_1.logger.info(`Registering JupyterLab comms for target ${target}`);\n", " const kernel = exports.kernels[doc.roots()[0].id];\n", " try {\n", " kernel.registerCommTarget(target, (comm) => {\n", " logging_1.logger.info(`Registering JupyterLab comms for target ${target}`);\n", " const r = new receiver_1.Receiver();\n", " comm.onMsg = _handle_notebook_comms.bind(doc, r);\n", " });\n", " }\n", " catch (e) {\n", " logging_1.logger.warn(`Jupyter comms failed to register. push_notebook() will not function. (exception reported: ${e})`);\n", " }\n", " }\n", " else if (typeof google != 'undefined' && google.colab.kernel != null) {\n", " logging_1.logger.info(`Registering Google Colab comms for target ${target}`);\n", " const comm_manager = google.colab.kernel.comms;\n", " try {\n", " comm_manager.registerTarget(target, async (comm) => {\n", " var e_1, _a;\n", " var _b;\n", " logging_1.logger.info(`Registering Google Colab comms for target ${target}`);\n", " const r = new receiver_1.Receiver();\n", " try {\n", " for (var _c = __asyncValues(comm.messages), _d; _d = await _c.next(), !_d.done;) {\n", " const message = _d.value;\n", " const content = { data: message.data };\n", " const buffers = [];\n", " for (const buffer of (_b = message.buffers) !== null && _b !== void 0 ? _b : []) {\n", " buffers.push(new DataView(buffer));\n", " }\n", " const msg = { content, buffers };\n", " _handle_notebook_comms.bind(doc)(r, msg);\n", " }\n", " }\n", " catch (e_1_1) {\n", " e_1 = { error: e_1_1 };\n", " }\n", " finally {\n", " try {\n", " if (_d && !_d.done && (_a = _c.return))\n", " await _a.call(_c);\n", " }\n", " finally {\n", " if (e_1)\n", " throw e_1.error;\n", " }\n", " }\n", " });\n", " }\n", " catch (e) {\n", " logging_1.logger.warn(`Google Colab comms failed to register. push_notebook() will not function. (exception reported: ${e})`);\n", " }\n", " }\n", " else {\n", " console.warn(`Jupyter notebooks comms not available. push_notebook() will not function. If running JupyterLab ensure the latest @bokeh/jupyter_bokeh extension is installed. In an exported notebook this warning is expected.`);\n", " }\n", " }\n", " function embed_items_notebook(docs_json, render_items) {\n", " if (object_1.size(docs_json) != 1)\n", " throw new Error(\"embed_items_notebook expects exactly one document in docs_json\");\n", " const document = document_1.Document.from_json(object_1.values(docs_json)[0]);\n", " for (const item of render_items) {\n", " if (item.notebook_comms_target != null)\n", " _init_comms(item.notebook_comms_target, document);\n", " const element = dom_2._resolve_element(item);\n", " const roots = dom_2._resolve_root_elements(item);\n", " standalone_1.add_document_standalone(document, element, roots);\n", " }\n", " }\n", " exports.embed_items_notebook = embed_items_notebook;\n", " },\n", " /* styles/notebook.css.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const css = `\n", " /* notebook specific tweaks so no black outline and matching padding\n", " /* can't be wrapped inside bk-root. here are the offending jupyter lines:\n", " /* https://github.com/jupyter/notebook/blob/master/notebook/static/notebook/less/renderedhtml.less#L59-L76 */\n", " .rendered_html .bk-root .bk-tooltip table,\n", " .rendered_html .bk-root .bk-tooltip tr,\n", " .rendered_html .bk-root .bk-tooltip th,\n", " .rendered_html .bk-root .bk-tooltip td {\n", " border: none;\n", " padding: 1px;\n", " }\n", " `;\n", " exports.default = css;\n", " },\n", " /* protocol/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " tslib_1.__exportStar(require(362) /* ./message */, exports);\n", " tslib_1.__exportStar(require(363) /* ./receiver */, exports);\n", " },\n", " /* testing.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " // Just a dumb key/value record for collecting arbitrary info for tests\n", " exports.results = {};\n", " // Selenium has race conditions that make it difficult to read out the\n", " // results structure. This function deletes/creates a div that can act as\n", " // a semaphore. Tests should wait for the previous div to be stale, then\n", " // find the new div. At that point the results should be available\n", " function update_test_div() {\n", " const body = document.getElementsByTagName(\"body\")[0];\n", " const col = document.getElementsByClassName(\"bokeh-test-div\");\n", " if (col.length == 1) {\n", " body.removeChild(col[0]);\n", " delete col[0];\n", " }\n", " const box = document.createElement(\"div\");\n", " box.classList.add(\"bokeh-test-div\");\n", " box.style.display = \"none\";\n", " body.insertBefore(box, body.firstChild);\n", " }\n", " function init() {\n", " update_test_div();\n", " }\n", " exports.init = init;\n", " function record0(key, value) {\n", " exports.results[key] = value;\n", " }\n", " exports.record0 = record0;\n", " function record(key, value) {\n", " exports.results[key] = value;\n", " update_test_div();\n", " }\n", " exports.record = record;\n", " function count(key) {\n", " if (exports.results[key] == undefined)\n", " exports.results[key] = 0;\n", " exports.results[key] += 1;\n", " update_test_div();\n", " }\n", " exports.count = count;\n", " },\n", " /* safely.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " // Keep this code as terse and as close to vanila JS as possible. If we\n", " // arrived here, it means we should trust no one and need to act properly.\n", " function _burst_into_flames(error) {\n", " // Make box\n", " const box = document.createElement(\"div\");\n", " box.style.backgroundColor = \"#f2dede\";\n", " box.style.border = \"1px solid #a94442\";\n", " box.style.borderRadius = \"4px\";\n", " box.style.display = \"inline-block\";\n", " box.style.fontFamily = \"sans-serif\";\n", " box.style.marginTop = \"5px\";\n", " box.style.minWidth = \"200px\";\n", " box.style.padding = \"5px 5px 5px 10px\";\n", " box.classList.add(\"bokeh-error-box-into-flames\");\n", " // Make button\n", " const button = document.createElement(\"span\");\n", " button.style.backgroundColor = \"#a94442\";\n", " button.style.borderRadius = \"0px 4px 0px 0px\";\n", " button.style.color = \"white\";\n", " button.style.cursor = \"pointer\";\n", " button.style.cssFloat = \"right\";\n", " button.style.fontSize = \"0.8em\";\n", " button.style.margin = \"-6px -6px 0px 0px\";\n", " button.style.padding = \"2px 5px 4px 5px\";\n", " button.title = \"close\";\n", " button.setAttribute(\"aria-label\", \"close\");\n", " button.appendChild(document.createTextNode(\"x\"));\n", " button.addEventListener(\"click\", () => body.removeChild(box));\n", " // Make title\n", " const title = document.createElement(\"h3\");\n", " title.style.color = \"#a94442\";\n", " title.style.margin = \"8px 0px 0px 0px\";\n", " title.style.padding = \"0px\";\n", " title.appendChild(document.createTextNode(\"Bokeh Error\"));\n", " // Make message\n", " const message = document.createElement(\"pre\");\n", " message.style.whiteSpace = \"unset\";\n", " message.style.overflowX = \"auto\";\n", " const text = error instanceof Error ? error.message : error;\n", " message.appendChild(document.createTextNode(text));\n", " // Add pieces to box\n", " box.appendChild(button);\n", " box.appendChild(title);\n", " box.appendChild(message);\n", " // Put box in doc\n", " const body = document.getElementsByTagName(\"body\")[0];\n", " body.insertBefore(box, body.firstChild);\n", " }\n", " function safely(fn, silent = false) {\n", " try {\n", " return fn();\n", " }\n", " catch (error) {\n", " _burst_into_flames(error);\n", " if (!silent)\n", " throw error;\n", " else\n", " return;\n", " }\n", " }\n", " exports.safely = safely;\n", " },\n", " ], 0, {\"main\":0,\"tslib\":1,\"index\":2,\"version\":3,\"embed/index\":4,\"document/index\":5,\"document/document\":6,\"base\":7,\"core/util/types\":8,\"core/util/array\":9,\"core/util/math\":10,\"core/util/assert\":11,\"core/util/arrayable\":12,\"core/has_props\":13,\"core/signaling\":14,\"core/util/callback\":15,\"core/util/refs\":16,\"core/util/object\":17,\"core/properties\":18,\"core/enums\":19,\"core/util/color\":20,\"core/util/svg_colors\":21,\"core/settings\":22,\"core/property_mixins\":23,\"core/util/string\":24,\"core/util/eq\":25,\"core/util/ndarray\":26,\"core/util/serialization\":27,\"core/util/compat\":28,\"models/index\":29,\"models/annotations/index\":30,\"models/annotations/annotation\":31,\"core/util/projections\":32,\"models/renderers/renderer\":65,\"core/dom_view\":66,\"core/view\":67,\"core/dom\":68,\"styles/root.css\":69,\"core/visuals\":70,\"model\":71,\"core/logging\":72,\"styles/annotations.css\":73,\"models/annotations/arrow\":74,\"models/annotations/arrow_head\":75,\"models/sources/column_data_source\":76,\"models/sources/columnar_data_source\":77,\"models/sources/data_source\":78,\"models/selections/selection\":79,\"core/selection_manager\":80,\"models/renderers/glyph_renderer\":81,\"models/renderers/data_renderer\":82,\"models/glyphs/line\":83,\"models/glyphs/xy_glyph\":84,\"core/util/spatial\":85,\"core/util/bbox\":88,\"models/glyphs/glyph\":89,\"models/ranges/factor_range\":90,\"models/ranges/range\":91,\"models/glyphs/utils\":92,\"core/hittest\":93,\"models/glyphs/patch\":94,\"models/glyphs/harea\":95,\"models/glyphs/area\":96,\"models/glyphs/varea\":97,\"models/sources/cds_view\":98,\"core/build_views\":99,\"models/renderers/graph_renderer\":100,\"models/graphs/graph_hit_test_policy\":101,\"models/selections/interaction_policy\":102,\"core/util/typed_array\":103,\"core/util/set\":104,\"document/events\":105,\"models/annotations/band\":106,\"models/annotations/box_annotation\":107,\"models/annotations/color_bar\":108,\"models/tickers/basic_ticker\":109,\"models/tickers/adaptive_ticker\":110,\"models/tickers/continuous_ticker\":111,\"models/tickers/ticker\":112,\"models/formatters/basic_tick_formatter\":113,\"models/formatters/tick_formatter\":114,\"models/mappers/linear_color_mapper\":115,\"models/mappers/continuous_color_mapper\":116,\"models/mappers/color_mapper\":117,\"models/mappers/mapper\":118,\"models/transforms/transform\":119,\"models/scales/linear_scale\":120,\"models/scales/continuous_scale\":121,\"models/scales/scale\":122,\"models/transforms/index\":123,\"models/transforms/customjs_transform\":124,\"models/transforms/dodge\":125,\"models/transforms/interpolator\":126,\"models/transforms/jitter\":127,\"models/transforms/linear_interpolator\":128,\"models/transforms/step_interpolator\":129,\"models/scales/log_scale\":130,\"models/ranges/range1d\":131,\"core/util/text\":132,\"models/annotations/label\":133,\"models/annotations/text_annotation\":134,\"models/annotations/label_set\":135,\"models/annotations/legend\":136,\"models/annotations/legend_item\":137,\"core/vectorization\":138,\"models/annotations/poly_annotation\":139,\"models/annotations/slope\":140,\"models/annotations/span\":141,\"models/annotations/title\":142,\"models/annotations/toolbar_panel\":143,\"models/annotations/tooltip\":144,\"styles/tooltips\":145,\"styles/mixins\":146,\"styles/tooltips.css\":147,\"models/annotations/whisker\":148,\"models/axes/index\":149,\"models/axes/axis\":150,\"models/renderers/guide_renderer\":151,\"models/axes/categorical_axis\":152,\"models/tickers/categorical_ticker\":153,\"models/formatters/categorical_tick_formatter\":154,\"models/axes/continuous_axis\":155,\"models/axes/datetime_axis\":156,\"models/axes/linear_axis\":157,\"models/formatters/datetime_tick_formatter\":158,\"core/util/templating\":160,\"models/tickers/datetime_ticker\":163,\"models/tickers/composite_ticker\":164,\"models/tickers/days_ticker\":165,\"models/tickers/single_interval_ticker\":166,\"models/tickers/util\":167,\"models/tickers/months_ticker\":168,\"models/tickers/years_ticker\":169,\"models/axes/log_axis\":170,\"models/formatters/log_tick_formatter\":171,\"models/tickers/log_ticker\":172,\"models/axes/mercator_axis\":173,\"models/formatters/mercator_tick_formatter\":174,\"models/tickers/mercator_ticker\":175,\"models/callbacks/index\":176,\"models/callbacks/customjs\":177,\"models/callbacks/callback\":178,\"models/callbacks/open_url\":179,\"models/canvas/index\":180,\"models/canvas/canvas\":181,\"core/util/canvas\":182,\"core/util/svg\":183,\"models/canvas/cartesian_frame\":184,\"models/scales/categorical_scale\":185,\"models/ranges/data_range1d\":186,\"models/ranges/data_range\":187,\"core/layout/index\":188,\"core/layout/types\":189,\"core/layout/layoutable\":190,\"core/layout/alignments\":191,\"core/layout/grid\":192,\"core/layout/html\":193,\"models/expressions/index\":194,\"models/expressions/expression\":195,\"models/expressions/stack\":196,\"models/expressions/cumsum\":197,\"models/filters/index\":198,\"models/filters/boolean_filter\":199,\"models/filters/filter\":200,\"models/filters/customjs_filter\":201,\"models/filters/group_filter\":202,\"models/filters/index_filter\":203,\"models/formatters/index\":204,\"models/formatters/func_tick_formatter\":205,\"models/formatters/numeral_tick_formatter\":206,\"models/formatters/printf_tick_formatter\":207,\"models/glyphs/index\":208,\"models/glyphs/annular_wedge\":209,\"models/glyphs/annulus\":210,\"models/glyphs/arc\":211,\"models/glyphs/bezier\":212,\"models/glyphs/circle\":213,\"models/glyphs/center_rotatable\":214,\"models/glyphs/ellipse\":215,\"models/glyphs/ellipse_oval\":216,\"models/glyphs/hbar\":217,\"models/glyphs/box\":218,\"models/glyphs/hex_tile\":219,\"models/glyphs/image\":220,\"models/glyphs/image_base\":221,\"models/glyphs/image_rgba\":222,\"models/glyphs/image_url\":223,\"core/util/image\":224,\"models/glyphs/multi_line\":225,\"models/glyphs/multi_polygons\":226,\"models/glyphs/oval\":227,\"models/glyphs/patches\":228,\"models/glyphs/quad\":229,\"models/glyphs/quadratic\":230,\"models/glyphs/ray\":231,\"models/glyphs/rect\":232,\"models/glyphs/segment\":233,\"models/glyphs/step\":234,\"models/glyphs/text\":235,\"models/glyphs/vbar\":236,\"models/glyphs/wedge\":237,\"models/graphs/index\":238,\"models/graphs/layout_provider\":239,\"models/graphs/static_layout_provider\":240,\"models/grids/index\":241,\"models/grids/grid\":242,\"models/layouts/index\":243,\"models/layouts/box\":244,\"models/layouts/layout_dom\":245,\"styles/root\":246,\"models/layouts/column\":247,\"models/layouts/grid_box\":248,\"models/layouts/html_box\":249,\"models/layouts/row\":250,\"models/layouts/spacer\":251,\"models/layouts/tabs\":252,\"styles/tabs\":253,\"styles/buttons\":254,\"styles/menus\":255,\"styles/buttons.css\":256,\"styles/menus.css\":257,\"styles/tabs.css\":258,\"models/layouts/widget_box\":259,\"models/mappers/index\":260,\"models/mappers/categorical_color_mapper\":261,\"models/mappers/categorical_mapper\":262,\"models/mappers/categorical_marker_mapper\":263,\"models/mappers/categorical_pattern_mapper\":264,\"models/mappers/log_color_mapper\":265,\"models/markers/index\":266,\"models/markers/defs\":267,\"models/markers/marker\":268,\"models/markers/scatter\":269,\"models/plots/index\":270,\"models/plots/gmap_plot\":271,\"models/plots/plot\":272,\"models/tools/toolbar\":273,\"models/tools/inspectors/inspect_tool\":274,\"models/tools/button_tool\":275,\"models/tools/tool\":277,\"styles/toolbar\":278,\"styles/toolbar.css\":279,\"styles/icons.css\":280,\"core/util/menus\":281,\"models/tools/on_off_button\":282,\"models/tools/toolbar_base\":283,\"models/tools/gestures/gesture_tool\":284,\"models/tools/actions/action_tool\":285,\"models/tools/actions/help_tool\":286,\"styles/icons\":287,\"styles/logo\":288,\"styles/logo.css\":289,\"models/plots/plot_canvas\":290,\"core/bokeh_events\":291,\"core/ui_events\":292,\"core/util/wheel\":293,\"core/util/throttle\":294,\"core/layout/side_panel\":295,\"models/plots/gmap_plot_canvas\":296,\"models/ranges/index\":297,\"models/renderers/index\":298,\"models/scales/index\":299,\"models/selections/index\":300,\"models/sources/index\":301,\"models/sources/server_sent_data_source\":302,\"models/sources/web_data_source\":303,\"models/sources/ajax_data_source\":304,\"models/sources/geojson_data_source\":305,\"models/tickers/index\":306,\"models/tickers/fixed_ticker\":307,\"models/tiles/index\":308,\"models/tiles/bbox_tile_source\":309,\"models/tiles/mercator_tile_source\":310,\"models/tiles/tile_source\":311,\"models/tiles/tile_utils\":312,\"models/tiles/quadkey_tile_source\":313,\"models/tiles/tile_renderer\":314,\"models/tiles/wmts_tile_source\":315,\"styles/tiles\":316,\"styles/tiles.css\":317,\"models/tiles/tms_tile_source\":318,\"models/textures/index\":319,\"models/textures/canvas_texture\":320,\"models/textures/texture\":321,\"models/textures/image_url_texture\":322,\"models/tools/index\":323,\"models/tools/actions/custom_action\":324,\"models/tools/actions/redo_tool\":325,\"models/tools/actions/reset_tool\":326,\"models/tools/actions/save_tool\":327,\"models/tools/actions/undo_tool\":328,\"models/tools/actions/zoom_in_tool\":329,\"core/util/zoom\":330,\"models/tools/actions/zoom_out_tool\":331,\"models/tools/edit/edit_tool\":332,\"models/tools/edit/box_edit_tool\":333,\"models/tools/edit/freehand_draw_tool\":334,\"models/tools/edit/point_draw_tool\":335,\"models/tools/edit/poly_draw_tool\":336,\"models/tools/edit/poly_tool\":337,\"models/tools/edit/poly_edit_tool\":338,\"models/tools/gestures/box_select_tool\":339,\"models/tools/gestures/select_tool\":340,\"models/tools/util\":341,\"models/tools/gestures/box_zoom_tool\":342,\"models/tools/gestures/lasso_select_tool\":343,\"models/tools/edit/line_edit_tool\":344,\"models/tools/edit/line_tool\":345,\"models/tools/gestures/pan_tool\":346,\"models/tools/gestures/poly_select_tool\":347,\"models/tools/gestures/range_tool\":348,\"models/tools/gestures/tap_tool\":349,\"models/tools/gestures/wheel_pan_tool\":350,\"models/tools/gestures/wheel_zoom_tool\":351,\"models/tools/inspectors/crosshair_tool\":352,\"models/tools/inspectors/customjs_hover\":353,\"models/tools/inspectors/hover_tool\":354,\"models/tools/tool_proxy\":355,\"core/util/iterator\":356,\"models/tools/toolbar_box\":357,\"embed/standalone\":358,\"embed/dom\":359,\"embed/server\":360,\"client/connection\":361,\"protocol/message\":362,\"protocol/receiver\":363,\"client/session\":364,\"embed/notebook\":365,\"styles/notebook.css\":366,\"protocol/index\":367,\"testing\":368,\"safely\":369}, {});\n", " })\n", "\n", " //# sourceMappingURL=bokeh.js.map\n", "\n", " /* END bokeh.js */\n", " },\n", " \n", " function(Bokeh) {\n", " /* BEGIN bokeh-widgets.js */\n", " /*!\n", " * Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors\n", " * All rights reserved.\n", " * \n", " * Redistribution and use in source and binary forms, with or without modification,\n", " * are permitted provided that the following conditions are met:\n", " * \n", " * Redistributions of source code must retain the above copyright notice,\n", " * this list of conditions and the following disclaimer.\n", " * \n", " * Redistributions in binary form must reproduce the above copyright notice,\n", " * this list of conditions and the following disclaimer in the documentation\n", " * and/or other materials provided with the distribution.\n", " * \n", " * Neither the name of Anaconda nor the names of any contributors\n", " * may be used to endorse or promote products derived from this software\n", " * without specific prior written permission.\n", " * \n", " * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n", " * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n", " * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n", " * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n", " * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n", " * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n", " * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n", " * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n", " * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n", " * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n", " * THE POSSIBILITY OF SUCH DAMAGE.\n", " */\n", " (function(root, factory) {\n", " factory(root[\"Bokeh\"], \"2.1.1\");\n", " })(this, function(Bokeh, version) {\n", " var define;\n", " return (function(modules, entry, aliases, externals) {\n", " const bokeh = typeof Bokeh !== \"undefined\" && (version != null ? Bokeh[version] : Bokeh);\n", " if (bokeh != null) {\n", " return bokeh.register_plugin(modules, entry, aliases);\n", " } else {\n", " throw new Error(\"Cannot find Bokeh \" + version + \". You have to load it prior to loading plugins.\");\n", " }\n", " })\n", " ({\n", " 390: /* models/widgets/main.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const Widgets = tslib_1.__importStar(require(391) /* ./index */);\n", " exports.Widgets = Widgets;\n", " const base_1 = require(7) /* ../../base */;\n", " base_1.register_models(Widgets);\n", " },\n", " 391: /* models/widgets/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var abstract_button_1 = require(392) /* ./abstract_button */;\n", " exports.AbstractButton = abstract_button_1.AbstractButton;\n", " var abstract_icon_1 = require(395) /* ./abstract_icon */;\n", " exports.AbstractIcon = abstract_icon_1.AbstractIcon;\n", " var autocomplete_input_1 = require(396) /* ./autocomplete_input */;\n", " exports.AutocompleteInput = autocomplete_input_1.AutocompleteInput;\n", " var button_1 = require(401) /* ./button */;\n", " exports.Button = button_1.Button;\n", " var checkbox_button_group_1 = require(402) /* ./checkbox_button_group */;\n", " exports.CheckboxButtonGroup = checkbox_button_group_1.CheckboxButtonGroup;\n", " var checkbox_group_1 = require(404) /* ./checkbox_group */;\n", " exports.CheckboxGroup = checkbox_group_1.CheckboxGroup;\n", " var color_picker_1 = require(406) /* ./color_picker */;\n", " exports.ColorPicker = color_picker_1.ColorPicker;\n", " var date_picker_1 = require(407) /* ./date_picker */;\n", " exports.DatePicker = date_picker_1.DatePicker;\n", " var date_range_slider_1 = require(410) /* ./date_range_slider */;\n", " exports.DateRangeSlider = date_range_slider_1.DateRangeSlider;\n", " var date_slider_1 = require(416) /* ./date_slider */;\n", " exports.DateSlider = date_slider_1.DateSlider;\n", " var div_1 = require(417) /* ./div */;\n", " exports.Div = div_1.Div;\n", " var dropdown_1 = require(421) /* ./dropdown */;\n", " exports.Dropdown = dropdown_1.Dropdown;\n", " var file_input_1 = require(422) /* ./file_input */;\n", " exports.FileInput = file_input_1.FileInput;\n", " var input_widget_1 = require(398) /* ./input_widget */;\n", " exports.InputWidget = input_widget_1.InputWidget;\n", " var markup_1 = require(418) /* ./markup */;\n", " exports.Markup = markup_1.Markup;\n", " var multiselect_1 = require(423) /* ./multiselect */;\n", " exports.MultiSelect = multiselect_1.MultiSelect;\n", " var paragraph_1 = require(424) /* ./paragraph */;\n", " exports.Paragraph = paragraph_1.Paragraph;\n", " var password_input_1 = require(425) /* ./password_input */;\n", " exports.PasswordInput = password_input_1.PasswordInput;\n", " var multichoice_1 = require(426) /* ./multichoice */;\n", " exports.MultiChoice = multichoice_1.MultiChoice;\n", " var pretext_1 = require(429) /* ./pretext */;\n", " exports.PreText = pretext_1.PreText;\n", " var radio_button_group_1 = require(430) /* ./radio_button_group */;\n", " exports.RadioButtonGroup = radio_button_group_1.RadioButtonGroup;\n", " var radio_group_1 = require(431) /* ./radio_group */;\n", " exports.RadioGroup = radio_group_1.RadioGroup;\n", " var range_slider_1 = require(432) /* ./range_slider */;\n", " exports.RangeSlider = range_slider_1.RangeSlider;\n", " var selectbox_1 = require(433) /* ./selectbox */;\n", " exports.Select = selectbox_1.Select;\n", " var slider_1 = require(434) /* ./slider */;\n", " exports.Slider = slider_1.Slider;\n", " var spinner_1 = require(435) /* ./spinner */;\n", " exports.Spinner = spinner_1.Spinner;\n", " var text_input_1 = require(397) /* ./text_input */;\n", " exports.TextInput = text_input_1.TextInput;\n", " var textarea_input_1 = require(436) /* ./textarea_input */;\n", " exports.TextAreaInput = textarea_input_1.TextAreaInput;\n", " var toggle_1 = require(437) /* ./toggle */;\n", " exports.Toggle = toggle_1.Toggle;\n", " var widget_1 = require(458) /* ./widget */;\n", " exports.Widget = widget_1.Widget;\n", " },\n", " 392: /* models/widgets/abstract_button.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const build_views_1 = require(99) /* ../../core/build_views */;\n", " const control_1 = require(393) /* ./control */;\n", " const buttons_1 = require(254) /* ../../styles/buttons */;\n", " const buttons_css_1 = tslib_1.__importDefault(require(256) /* ../../styles/buttons.css */);\n", " class AbstractButtonView extends control_1.ControlView {\n", " *controls() {\n", " yield this.button_el;\n", " }\n", " async lazy_initialize() {\n", " await super.lazy_initialize();\n", " const { icon } = this.model;\n", " if (icon != null) {\n", " this.icon_view = await build_views_1.build_view(icon, { parent: this });\n", " }\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.change, () => this.render());\n", " }\n", " remove() {\n", " if (this.icon_view != null)\n", " this.icon_view.remove();\n", " super.remove();\n", " }\n", " styles() {\n", " return [...super.styles(), buttons_css_1.default];\n", " }\n", " _render_button(...children) {\n", " return dom_1.button({\n", " type: \"button\",\n", " disabled: this.model.disabled,\n", " class: [buttons_1.bk_btn, buttons_1.bk_btn_type(this.model.button_type)],\n", " }, ...children);\n", " }\n", " render() {\n", " super.render();\n", " this.button_el = this._render_button(this.model.label);\n", " this.button_el.addEventListener(\"click\", () => this.click());\n", " if (this.icon_view != null) {\n", " dom_1.prepend(this.button_el, this.icon_view.el, dom_1.nbsp());\n", " this.icon_view.render();\n", " }\n", " this.group_el = dom_1.div({ class: buttons_1.bk_btn_group }, this.button_el);\n", " this.el.appendChild(this.group_el);\n", " }\n", " click() { }\n", " }\n", " exports.AbstractButtonView = AbstractButtonView;\n", " AbstractButtonView.__name__ = \"AbstractButtonView\";\n", " class AbstractButton extends control_1.Control {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_AbstractButton() {\n", " this.define({\n", " label: [p.String, \"Button\"],\n", " icon: [p.Instance],\n", " button_type: [p.ButtonType, \"default\"],\n", " });\n", " }\n", " }\n", " exports.AbstractButton = AbstractButton;\n", " AbstractButton.__name__ = \"AbstractButton\";\n", " AbstractButton.init_AbstractButton();\n", " },\n", " 393: /* models/widgets/control.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const widget_1 = require(458) /* ./widget */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " class ControlView extends widget_1.WidgetView {\n", " connect_signals() {\n", " super.connect_signals();\n", " const p = this.model.properties;\n", " this.on_change(p.disabled, () => {\n", " for (const el of this.controls()) {\n", " dom_1.toggle_attribute(el, \"disabled\", this.model.disabled);\n", " }\n", " });\n", " }\n", " }\n", " exports.ControlView = ControlView;\n", " ControlView.__name__ = \"ControlView\";\n", " class Control extends widget_1.Widget {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " }\n", " exports.Control = Control;\n", " Control.__name__ = \"Control\";\n", " },\n", " 458: /* models/widgets/widget.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const html_box_1 = require(249) /* ../layouts/html_box */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class WidgetView extends html_box_1.HTMLBoxView {\n", " _width_policy() {\n", " return this.model.orientation == \"horizontal\" ? super._width_policy() : \"fixed\";\n", " }\n", " _height_policy() {\n", " return this.model.orientation == \"horizontal\" ? \"fixed\" : super._height_policy();\n", " }\n", " box_sizing() {\n", " const sizing = super.box_sizing();\n", " if (this.model.orientation == \"horizontal\") {\n", " if (sizing.width == null)\n", " sizing.width = this.model.default_size;\n", " }\n", " else {\n", " if (sizing.height == null)\n", " sizing.height = this.model.default_size;\n", " }\n", " return sizing;\n", " }\n", " }\n", " exports.WidgetView = WidgetView;\n", " WidgetView.__name__ = \"WidgetView\";\n", " class Widget extends html_box_1.HTMLBox {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Widget() {\n", " this.define({\n", " orientation: [p.Orientation, \"horizontal\"],\n", " default_size: [p.Number, 300],\n", " });\n", " this.override({\n", " margin: [5, 5, 5, 5],\n", " });\n", " }\n", " }\n", " exports.Widget = Widget;\n", " Widget.__name__ = \"Widget\";\n", " Widget.init_Widget();\n", " },\n", " 395: /* models/widgets/abstract_icon.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const model_1 = require(71) /* ../../model */;\n", " const dom_view_1 = require(66) /* ../../core/dom_view */;\n", " class AbstractIconView extends dom_view_1.DOMView {\n", " }\n", " exports.AbstractIconView = AbstractIconView;\n", " AbstractIconView.__name__ = \"AbstractIconView\";\n", " class AbstractIcon extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " }\n", " exports.AbstractIcon = AbstractIcon;\n", " AbstractIcon.__name__ = \"AbstractIcon\";\n", " },\n", " 396: /* models/widgets/autocomplete_input.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const text_input_1 = require(397) /* ./text_input */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const math_1 = require(10) /* ../../core/util/math */;\n", " const mixins_1 = require(146) /* ../../styles/mixins */;\n", " const menus_1 = require(255) /* ../../styles/menus */;\n", " const menus_css_1 = tslib_1.__importDefault(require(257) /* ../../styles/menus.css */);\n", " class AutocompleteInputView extends text_input_1.TextInputView {\n", " constructor() {\n", " super(...arguments);\n", " this._open = false;\n", " this._last_value = \"\";\n", " this._hover_index = 0;\n", " }\n", " styles() {\n", " return [...super.styles(), menus_css_1.default];\n", " }\n", " render() {\n", " super.render();\n", " this.input_el.addEventListener(\"keydown\", (event) => this._keydown(event));\n", " this.input_el.addEventListener(\"keyup\", (event) => this._keyup(event));\n", " this.menu = dom_1.div({ class: [menus_1.bk_menu, mixins_1.bk_below] });\n", " this.menu.addEventListener(\"click\", (event) => this._menu_click(event));\n", " this.menu.addEventListener(\"mouseover\", (event) => this._menu_hover(event));\n", " this.el.appendChild(this.menu);\n", " dom_1.undisplay(this.menu);\n", " }\n", " change_input() {\n", " if (this._open && this.menu.children.length > 0) {\n", " this.model.value = this.menu.children[this._hover_index].textContent;\n", " this.input_el.focus();\n", " this._hide_menu();\n", " }\n", " }\n", " _update_completions(completions) {\n", " dom_1.empty(this.menu);\n", " for (const text of completions) {\n", " const item = dom_1.div({}, text);\n", " this.menu.appendChild(item);\n", " }\n", " if (completions.length > 0)\n", " this.menu.children[0].classList.add(mixins_1.bk_active);\n", " }\n", " _show_menu() {\n", " if (!this._open) {\n", " this._open = true;\n", " this._hover_index = 0;\n", " this._last_value = this.model.value;\n", " dom_1.display(this.menu);\n", " const listener = (event) => {\n", " const { target } = event;\n", " if (target instanceof HTMLElement && !this.el.contains(target)) {\n", " document.removeEventListener(\"click\", listener);\n", " this._hide_menu();\n", " }\n", " };\n", " document.addEventListener(\"click\", listener);\n", " }\n", " }\n", " _hide_menu() {\n", " if (this._open) {\n", " this._open = false;\n", " dom_1.undisplay(this.menu);\n", " }\n", " }\n", " _menu_click(event) {\n", " if (event.target != event.currentTarget && event.target instanceof Element) {\n", " this.model.value = event.target.textContent;\n", " this.input_el.focus();\n", " this._hide_menu();\n", " }\n", " }\n", " _menu_hover(event) {\n", " if (event.target != event.currentTarget && event.target instanceof Element) {\n", " let i = 0;\n", " for (i = 0; i < this.menu.children.length; i++) {\n", " if (this.menu.children[i].textContent == event.target.textContent)\n", " break;\n", " }\n", " this._bump_hover(i);\n", " }\n", " }\n", " _bump_hover(new_index) {\n", " const n_children = this.menu.children.length;\n", " if (this._open && n_children > 0) {\n", " this.menu.children[this._hover_index].classList.remove(mixins_1.bk_active);\n", " this._hover_index = math_1.clamp(new_index, 0, n_children - 1);\n", " this.menu.children[this._hover_index].classList.add(mixins_1.bk_active);\n", " }\n", " }\n", " _keydown(_event) { }\n", " _keyup(event) {\n", " switch (event.keyCode) {\n", " case dom_1.Keys.Enter: {\n", " this.change_input();\n", " break;\n", " }\n", " case dom_1.Keys.Esc: {\n", " this._hide_menu();\n", " break;\n", " }\n", " case dom_1.Keys.Up: {\n", " this._bump_hover(this._hover_index - 1);\n", " break;\n", " }\n", " case dom_1.Keys.Down: {\n", " this._bump_hover(this._hover_index + 1);\n", " break;\n", " }\n", " default: {\n", " const value = this.input_el.value;\n", " if (value.length < this.model.min_characters) {\n", " this._hide_menu();\n", " return;\n", " }\n", " const completions = [];\n", " const { case_sensitive } = this.model;\n", " let acnorm;\n", " if (case_sensitive) {\n", " acnorm = (t) => t;\n", " }\n", " else {\n", " acnorm = (t) => t.toLowerCase();\n", " }\n", " for (const text of this.model.completions) {\n", " if (acnorm(text).startsWith(acnorm(value))) {\n", " completions.push(text);\n", " }\n", " }\n", " this._update_completions(completions);\n", " if (completions.length == 0)\n", " this._hide_menu();\n", " else\n", " this._show_menu();\n", " }\n", " }\n", " }\n", " }\n", " exports.AutocompleteInputView = AutocompleteInputView;\n", " AutocompleteInputView.__name__ = \"AutocompleteInputView\";\n", " class AutocompleteInput extends text_input_1.TextInput {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_AutocompleteInput() {\n", " this.prototype.default_view = AutocompleteInputView;\n", " this.define({\n", " completions: [p.Array, []],\n", " min_characters: [p.Int, 2],\n", " case_sensitive: [p.Boolean, true],\n", " });\n", " }\n", " }\n", " exports.AutocompleteInput = AutocompleteInput;\n", " AutocompleteInput.__name__ = \"AutocompleteInput\";\n", " AutocompleteInput.init_AutocompleteInput();\n", " },\n", " 397: /* models/widgets/text_input.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const input_widget_1 = require(398) /* ./input_widget */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const inputs_1 = require(400) /* ../../styles/widgets/inputs */;\n", " class TextInputView extends input_widget_1.InputWidgetView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.name.change, () => this.input_el.name = this.model.name || \"\");\n", " this.connect(this.model.properties.value.change, () => this.input_el.value = this.model.value);\n", " this.connect(this.model.properties.value_input.change, () => this.input_el.value = this.model.value_input);\n", " this.connect(this.model.properties.disabled.change, () => this.input_el.disabled = this.model.disabled);\n", " this.connect(this.model.properties.placeholder.change, () => this.input_el.placeholder = this.model.placeholder);\n", " }\n", " render() {\n", " super.render();\n", " this.input_el = dom_1.input({\n", " type: \"text\",\n", " class: inputs_1.bk_input,\n", " name: this.model.name,\n", " value: this.model.value,\n", " disabled: this.model.disabled,\n", " placeholder: this.model.placeholder,\n", " });\n", " this.input_el.addEventListener(\"change\", () => this.change_input());\n", " this.input_el.addEventListener(\"input\", () => this.change_input_oninput());\n", " this.group_el.appendChild(this.input_el);\n", " }\n", " change_input() {\n", " this.model.value = this.input_el.value;\n", " super.change_input();\n", " }\n", " change_input_oninput() {\n", " this.model.value_input = this.input_el.value;\n", " super.change_input();\n", " }\n", " }\n", " exports.TextInputView = TextInputView;\n", " TextInputView.__name__ = \"TextInputView\";\n", " class TextInput extends input_widget_1.InputWidget {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_TextInput() {\n", " this.prototype.default_view = TextInputView;\n", " this.define({\n", " value: [p.String, \"\"],\n", " value_input: [p.String, \"\"],\n", " placeholder: [p.String, \"\"],\n", " });\n", " }\n", " }\n", " exports.TextInput = TextInput;\n", " TextInput.__name__ = \"TextInput\";\n", " TextInput.init_TextInput();\n", " },\n", " 398: /* models/widgets/input_widget.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const control_1 = require(393) /* ./control */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const inputs_css_1 = tslib_1.__importDefault(require(399) /* ../../styles/widgets/inputs.css */);\n", " const inputs_1 = require(400) /* ../../styles/widgets/inputs */;\n", " class InputWidgetView extends control_1.ControlView {\n", " *controls() {\n", " yield this.input_el;\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.title.change, () => {\n", " this.label_el.textContent = this.model.title;\n", " });\n", " }\n", " styles() {\n", " return [...super.styles(), inputs_css_1.default];\n", " }\n", " render() {\n", " super.render();\n", " const { title } = this.model;\n", " this.label_el = dom_1.label({ style: { display: title.length == 0 ? \"none\" : \"\" } }, title);\n", " this.group_el = dom_1.div({ class: inputs_1.bk_input_group }, this.label_el);\n", " this.el.appendChild(this.group_el);\n", " }\n", " change_input() { }\n", " }\n", " exports.InputWidgetView = InputWidgetView;\n", " InputWidgetView.__name__ = \"InputWidgetView\";\n", " class InputWidget extends control_1.Control {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_InputWidget() {\n", " this.define({\n", " title: [p.String, \"\"],\n", " });\n", " }\n", " }\n", " exports.InputWidget = InputWidget;\n", " InputWidget.__name__ = \"InputWidget\";\n", " InputWidget.init_InputWidget();\n", " },\n", " 399: /* styles/widgets/inputs.css.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const css = `\n", " .bk-root .bk-input {\n", " display: inline-block;\n", " width: 100%;\n", " flex-grow: 1;\n", " -webkit-flex-grow: 1;\n", " min-height: 31px;\n", " padding: 0 12px;\n", " background-color: #fff;\n", " border: 1px solid #ccc;\n", " border-radius: 4px;\n", " }\n", " .bk-root .bk-input:focus {\n", " border-color: #66afe9;\n", " outline: 0;\n", " box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);\n", " }\n", " .bk-root .bk-input::placeholder,\n", " .bk-root .bk-input:-ms-input-placeholder,\n", " .bk-root .bk-input::-moz-placeholder,\n", " .bk-root .bk-input::-webkit-input-placeholder {\n", " color: #999;\n", " opacity: 1;\n", " }\n", " .bk-root .bk-input[disabled] {\n", " cursor: not-allowed;\n", " background-color: #eee;\n", " opacity: 1;\n", " }\n", " .bk-root select:not([multiple]).bk-input,\n", " .bk-root select:not([size]).bk-input {\n", " height: auto;\n", " appearance: none;\n", " -webkit-appearance: none;\n", " background-image: url('data:image/svg+xml;utf8,');\n", " background-position: right 0.5em center;\n", " background-size: 8px 6px;\n", " background-repeat: no-repeat;\n", " }\n", " .bk-root select[multiple].bk-input,\n", " .bk-root select[size].bk-input,\n", " .bk-root textarea.bk-input {\n", " height: auto;\n", " }\n", " .bk-root .bk-input-group {\n", " width: 100%;\n", " height: 100%;\n", " display: inline-flex;\n", " display: -webkit-inline-flex;\n", " flex-wrap: nowrap;\n", " -webkit-flex-wrap: nowrap;\n", " align-items: start;\n", " -webkit-align-items: start;\n", " flex-direction: column;\n", " -webkit-flex-direction: column;\n", " white-space: nowrap;\n", " }\n", " .bk-root .bk-input-group.bk-inline {\n", " flex-direction: row;\n", " -webkit-flex-direction: row;\n", " }\n", " .bk-root .bk-input-group.bk-inline > *:not(:first-child) {\n", " margin-left: 5px;\n", " }\n", " .bk-root .bk-input-group input[type=\"checkbox\"] + span,\n", " .bk-root .bk-input-group input[type=\"radio\"] + span {\n", " position: relative;\n", " top: -2px;\n", " margin-left: 3px;\n", " }\n", " `;\n", " exports.default = css;\n", " },\n", " 400: /* styles/widgets/inputs.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.bk_input = \"bk-input\";\n", " exports.bk_input_group = \"bk-input-group\";\n", " },\n", " 401: /* models/widgets/button.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const abstract_button_1 = require(392) /* ./abstract_button */;\n", " const bokeh_events_1 = require(291) /* ../../core/bokeh_events */;\n", " class ButtonView extends abstract_button_1.AbstractButtonView {\n", " click() {\n", " this.model.clicks = this.model.clicks + 1;\n", " this.model.trigger_event(new bokeh_events_1.ButtonClick());\n", " super.click();\n", " }\n", " }\n", " exports.ButtonView = ButtonView;\n", " ButtonView.__name__ = \"ButtonView\";\n", " class Button extends abstract_button_1.AbstractButton {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Button() {\n", " this.prototype.default_view = ButtonView;\n", " this.override({\n", " label: \"Button\",\n", " });\n", " }\n", " }\n", " exports.Button = Button;\n", " Button.__name__ = \"Button\";\n", " Button.init_Button();\n", " },\n", " 402: /* models/widgets/checkbox_button_group.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const button_group_1 = require(403) /* ./button_group */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const mixins_1 = require(146) /* ../../styles/mixins */;\n", " class CheckboxButtonGroupView extends button_group_1.ButtonGroupView {\n", " get active() {\n", " return new Set(this.model.active);\n", " }\n", " change_active(i) {\n", " const { active } = this;\n", " active.has(i) ? active.delete(i) : active.add(i);\n", " this.model.active = [...active].sort();\n", " }\n", " _update_active() {\n", " const { active } = this;\n", " this._buttons.forEach((button, i) => {\n", " dom_1.classes(button).toggle(mixins_1.bk_active, active.has(i));\n", " });\n", " }\n", " }\n", " exports.CheckboxButtonGroupView = CheckboxButtonGroupView;\n", " CheckboxButtonGroupView.__name__ = \"CheckboxButtonGroupView\";\n", " class CheckboxButtonGroup extends button_group_1.ButtonGroup {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_CheckboxButtonGroup() {\n", " this.prototype.default_view = CheckboxButtonGroupView;\n", " this.define({\n", " active: [p.Array, []],\n", " });\n", " }\n", " }\n", " exports.CheckboxButtonGroup = CheckboxButtonGroup;\n", " CheckboxButtonGroup.__name__ = \"CheckboxButtonGroup\";\n", " CheckboxButtonGroup.init_CheckboxButtonGroup();\n", " },\n", " 403: /* models/widgets/button_group.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const control_1 = require(393) /* ./control */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const buttons_1 = require(254) /* ../../styles/buttons */;\n", " const buttons_css_1 = tslib_1.__importDefault(require(256) /* ../../styles/buttons.css */);\n", " class ButtonGroupView extends control_1.ControlView {\n", " *controls() {\n", " yield* this._buttons; // TODO: HTMLButtonElement[]\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " const p = this.model.properties;\n", " this.on_change(p.button_type, () => this.render());\n", " this.on_change(p.labels, () => this.render());\n", " this.on_change(p.active, () => this._update_active());\n", " }\n", " styles() {\n", " return [...super.styles(), buttons_css_1.default];\n", " }\n", " render() {\n", " super.render();\n", " this._buttons = this.model.labels.map((label, i) => {\n", " const button = dom_1.div({\n", " class: [buttons_1.bk_btn, buttons_1.bk_btn_type(this.model.button_type)],\n", " disabled: this.model.disabled,\n", " }, label);\n", " button.addEventListener(\"click\", () => this.change_active(i));\n", " return button;\n", " });\n", " this._update_active();\n", " const group = dom_1.div({ class: buttons_1.bk_btn_group }, this._buttons);\n", " this.el.appendChild(group);\n", " }\n", " }\n", " exports.ButtonGroupView = ButtonGroupView;\n", " ButtonGroupView.__name__ = \"ButtonGroupView\";\n", " class ButtonGroup extends control_1.Control {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ButtonGroup() {\n", " this.define({\n", " labels: [p.Array, []],\n", " button_type: [p.ButtonType, \"default\"],\n", " });\n", " }\n", " }\n", " exports.ButtonGroup = ButtonGroup;\n", " ButtonGroup.__name__ = \"ButtonGroup\";\n", " ButtonGroup.init_ButtonGroup();\n", " },\n", " 404: /* models/widgets/checkbox_group.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const input_group_1 = require(405) /* ./input_group */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const mixins_1 = require(146) /* ../../styles/mixins */;\n", " const inputs_1 = require(400) /* ../../styles/widgets/inputs */;\n", " class CheckboxGroupView extends input_group_1.InputGroupView {\n", " render() {\n", " super.render();\n", " const group = dom_1.div({ class: [inputs_1.bk_input_group, this.model.inline ? mixins_1.bk_inline : null] });\n", " this.el.appendChild(group);\n", " const { active, labels } = this.model;\n", " this._inputs = [];\n", " for (let i = 0; i < labels.length; i++) {\n", " const checkbox = dom_1.input({ type: `checkbox`, value: `${i}` });\n", " checkbox.addEventListener(\"change\", () => this.change_active(i));\n", " this._inputs.push(checkbox);\n", " if (this.model.disabled)\n", " checkbox.disabled = true;\n", " if (array_1.includes(active, i))\n", " checkbox.checked = true;\n", " const label_el = dom_1.label({}, checkbox, dom_1.span({}, labels[i]));\n", " group.appendChild(label_el);\n", " }\n", " }\n", " change_active(i) {\n", " const active = new Set(this.model.active);\n", " active.has(i) ? active.delete(i) : active.add(i);\n", " this.model.active = [...active].sort();\n", " }\n", " }\n", " exports.CheckboxGroupView = CheckboxGroupView;\n", " CheckboxGroupView.__name__ = \"CheckboxGroupView\";\n", " class CheckboxGroup extends input_group_1.InputGroup {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_CheckboxGroup() {\n", " this.prototype.default_view = CheckboxGroupView;\n", " this.define({\n", " active: [p.Array, []],\n", " labels: [p.Array, []],\n", " inline: [p.Boolean, false],\n", " });\n", " }\n", " }\n", " exports.CheckboxGroup = CheckboxGroup;\n", " CheckboxGroup.__name__ = \"CheckboxGroup\";\n", " CheckboxGroup.init_CheckboxGroup();\n", " },\n", " 405: /* models/widgets/input_group.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const control_1 = require(393) /* ./control */;\n", " const inputs_css_1 = tslib_1.__importDefault(require(399) /* ../../styles/widgets/inputs.css */);\n", " class InputGroupView extends control_1.ControlView {\n", " *controls() {\n", " yield* this._inputs;\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.change, () => this.render());\n", " }\n", " styles() {\n", " return [...super.styles(), inputs_css_1.default];\n", " }\n", " }\n", " exports.InputGroupView = InputGroupView;\n", " InputGroupView.__name__ = \"InputGroupView\";\n", " class InputGroup extends control_1.Control {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " }\n", " exports.InputGroup = InputGroup;\n", " InputGroup.__name__ = \"InputGroup\";\n", " },\n", " 406: /* models/widgets/color_picker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const input_widget_1 = require(398) /* ./input_widget */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const inputs_1 = require(400) /* ../../styles/widgets/inputs */;\n", " class ColorPickerView extends input_widget_1.InputWidgetView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.name.change, () => this.input_el.name = this.model.name || \"\");\n", " this.connect(this.model.properties.color.change, () => this.input_el.value = this.model.color);\n", " this.connect(this.model.properties.disabled.change, () => this.input_el.disabled = this.model.disabled);\n", " }\n", " render() {\n", " super.render();\n", " this.input_el = dom_1.input({\n", " type: \"color\",\n", " class: inputs_1.bk_input,\n", " name: this.model.name,\n", " value: this.model.color,\n", " disabled: this.model.disabled,\n", " });\n", " this.input_el.addEventListener(\"change\", () => this.change_input());\n", " this.group_el.appendChild(this.input_el);\n", " }\n", " change_input() {\n", " this.model.color = this.input_el.value;\n", " super.change_input();\n", " }\n", " }\n", " exports.ColorPickerView = ColorPickerView;\n", " ColorPickerView.__name__ = \"ColorPickerView\";\n", " class ColorPicker extends input_widget_1.InputWidget {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ColorPicker() {\n", " this.prototype.default_view = ColorPickerView;\n", " this.define({\n", " color: [p.Color, \"#000000\"],\n", " });\n", " }\n", " }\n", " exports.ColorPicker = ColorPicker;\n", " ColorPicker.__name__ = \"ColorPicker\";\n", " ColorPicker.init_ColorPicker();\n", " },\n", " 407: /* models/widgets/date_picker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const flatpickr_1 = tslib_1.__importDefault(require(408) /* flatpickr */);\n", " const input_widget_1 = require(398) /* ./input_widget */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const inputs_1 = require(400) /* ../../styles/widgets/inputs */;\n", " const flatpickr_css_1 = tslib_1.__importDefault(require(409) /* ../../styles/widgets/flatpickr.css */);\n", " function _convert_date_list(value) {\n", " const result = [];\n", " for (const item of value) {\n", " if (types_1.isString(item))\n", " result.push(item);\n", " else {\n", " const [from, to] = item;\n", " result.push({ from, to });\n", " }\n", " }\n", " return result;\n", " }\n", " class DatePickerView extends input_widget_1.InputWidgetView {\n", " connect_signals() {\n", " super.connect_signals();\n", " const { value, min_date, max_date, disabled_dates, enabled_dates, position, inline } = this.model.properties;\n", " this.connect(value.change, () => { var _a; return (_a = this._picker) === null || _a === void 0 ? void 0 : _a.setDate(value.value()); });\n", " this.connect(min_date.change, () => { var _a; return (_a = this._picker) === null || _a === void 0 ? void 0 : _a.set(\"minDate\", min_date.value()); });\n", " this.connect(max_date.change, () => { var _a; return (_a = this._picker) === null || _a === void 0 ? void 0 : _a.set(\"maxDate\", max_date.value()); });\n", " this.connect(disabled_dates.change, () => { var _a; return (_a = this._picker) === null || _a === void 0 ? void 0 : _a.set(\"disable\", disabled_dates.value()); });\n", " this.connect(enabled_dates.change, () => { var _a; return (_a = this._picker) === null || _a === void 0 ? void 0 : _a.set(\"enable\", enabled_dates.value()); });\n", " this.connect(position.change, () => { var _a; return (_a = this._picker) === null || _a === void 0 ? void 0 : _a.set(\"position\", position.value()); });\n", " this.connect(inline.change, () => { var _a; return (_a = this._picker) === null || _a === void 0 ? void 0 : _a.set(\"inline\", inline.value()); });\n", " }\n", " remove() {\n", " var _a;\n", " (_a = this._picker) === null || _a === void 0 ? void 0 : _a.destroy();\n", " super.remove();\n", " }\n", " styles() {\n", " return [...super.styles(), flatpickr_css_1.default];\n", " }\n", " render() {\n", " if (this._picker != null)\n", " return;\n", " super.render();\n", " this.input_el = dom_1.input({ type: \"text\", class: inputs_1.bk_input, disabled: this.model.disabled });\n", " this.group_el.appendChild(this.input_el);\n", " this._picker = flatpickr_1.default(this.input_el, {\n", " defaultDate: this.model.value,\n", " minDate: this.model.min_date,\n", " maxDate: this.model.max_date,\n", " inline: this.model.inline,\n", " position: this.model.position,\n", " disable: _convert_date_list(this.model.disabled_dates),\n", " enable: _convert_date_list(this.model.enabled_dates),\n", " onChange: (selected_dates, date_string, instance) => this._on_change(selected_dates, date_string, instance),\n", " });\n", " }\n", " _on_change(_selected_dates, date_string, _instance) {\n", " this.model.value = date_string;\n", " this.change_input();\n", " }\n", " }\n", " exports.DatePickerView = DatePickerView;\n", " DatePickerView.__name__ = \"DatePickerView\";\n", " class DatePicker extends input_widget_1.InputWidget {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_DatePicker() {\n", " this.prototype.default_view = DatePickerView;\n", " this.define({\n", " value: [p.Any],\n", " min_date: [p.Any],\n", " max_date: [p.Any],\n", " disabled_dates: [p.Any, []],\n", " enabled_dates: [p.Any, []],\n", " position: [p.CalendarPosition, \"auto\"],\n", " inline: [p.Boolean, false],\n", " });\n", " }\n", " }\n", " exports.DatePicker = DatePicker;\n", " DatePicker.__name__ = \"DatePicker\";\n", " DatePicker.init_DatePicker();\n", " },\n", " 408: /* flatpickr/dist/flatpickr.js */ function _(require, module, exports) {\n", " /* flatpickr v4.6.3, @license MIT */\n", " (function (global, factory) {\n", " typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n", " typeof define === 'function' && define.amd ? define(factory) :\n", " (global = global || self, global.flatpickr = factory());\n", " }(this, function () {\n", " 'use strict';\n", " /*! *****************************************************************************\n", " Copyright (c) Microsoft Corporation. All rights reserved.\n", " Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use\n", " this file except in compliance with the License. You may obtain a copy of the\n", " License at http://www.apache.org/licenses/LICENSE-2.0\n", " \n", " THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n", " KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\n", " WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\n", " MERCHANTABLITY OR NON-INFRINGEMENT.\n", " \n", " See the Apache Version 2.0 License for specific language governing permissions\n", " and limitations under the License.\n", " ***************************************************************************** */\n", " var __assign = function () {\n", " __assign = Object.assign || function __assign(t) {\n", " for (var s, i = 1, n = arguments.length; i < n; i++) {\n", " s = arguments[i];\n", " for (var p in s)\n", " if (Object.prototype.hasOwnProperty.call(s, p))\n", " t[p] = s[p];\n", " }\n", " return t;\n", " };\n", " return __assign.apply(this, arguments);\n", " };\n", " var HOOKS = [\n", " \"onChange\",\n", " \"onClose\",\n", " \"onDayCreate\",\n", " \"onDestroy\",\n", " \"onKeyDown\",\n", " \"onMonthChange\",\n", " \"onOpen\",\n", " \"onParseConfig\",\n", " \"onReady\",\n", " \"onValueUpdate\",\n", " \"onYearChange\",\n", " \"onPreCalendarPosition\",\n", " ];\n", " var defaults = {\n", " _disable: [],\n", " _enable: [],\n", " allowInput: false,\n", " altFormat: \"F j, Y\",\n", " altInput: false,\n", " altInputClass: \"form-control input\",\n", " animate: typeof window === \"object\" &&\n", " window.navigator.userAgent.indexOf(\"MSIE\") === -1,\n", " ariaDateFormat: \"F j, Y\",\n", " clickOpens: true,\n", " closeOnSelect: true,\n", " conjunction: \", \",\n", " dateFormat: \"Y-m-d\",\n", " defaultHour: 12,\n", " defaultMinute: 0,\n", " defaultSeconds: 0,\n", " disable: [],\n", " disableMobile: false,\n", " enable: [],\n", " enableSeconds: false,\n", " enableTime: false,\n", " errorHandler: function (err) {\n", " return typeof console !== \"undefined\" && console.warn(err);\n", " },\n", " getWeek: function (givenDate) {\n", " var date = new Date(givenDate.getTime());\n", " date.setHours(0, 0, 0, 0);\n", " // Thursday in current week decides the year.\n", " date.setDate(date.getDate() + 3 - ((date.getDay() + 6) % 7));\n", " // January 4 is always in week 1.\n", " var week1 = new Date(date.getFullYear(), 0, 4);\n", " // Adjust to Thursday in week 1 and count number of weeks from date to week1.\n", " return (1 +\n", " Math.round(((date.getTime() - week1.getTime()) / 86400000 -\n", " 3 +\n", " ((week1.getDay() + 6) % 7)) /\n", " 7));\n", " },\n", " hourIncrement: 1,\n", " ignoredFocusElements: [],\n", " inline: false,\n", " locale: \"default\",\n", " minuteIncrement: 5,\n", " mode: \"single\",\n", " monthSelectorType: \"dropdown\",\n", " nextArrow: \"\",\n", " noCalendar: false,\n", " now: new Date(),\n", " onChange: [],\n", " onClose: [],\n", " onDayCreate: [],\n", " onDestroy: [],\n", " onKeyDown: [],\n", " onMonthChange: [],\n", " onOpen: [],\n", " onParseConfig: [],\n", " onReady: [],\n", " onValueUpdate: [],\n", " onYearChange: [],\n", " onPreCalendarPosition: [],\n", " plugins: [],\n", " position: \"auto\",\n", " positionElement: undefined,\n", " prevArrow: \"\",\n", " shorthandCurrentMonth: false,\n", " showMonths: 1,\n", " static: false,\n", " time_24hr: false,\n", " weekNumbers: false,\n", " wrap: false\n", " };\n", " var english = {\n", " weekdays: {\n", " shorthand: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n", " longhand: [\n", " \"Sunday\",\n", " \"Monday\",\n", " \"Tuesday\",\n", " \"Wednesday\",\n", " \"Thursday\",\n", " \"Friday\",\n", " \"Saturday\",\n", " ]\n", " },\n", " months: {\n", " shorthand: [\n", " \"Jan\",\n", " \"Feb\",\n", " \"Mar\",\n", " \"Apr\",\n", " \"May\",\n", " \"Jun\",\n", " \"Jul\",\n", " \"Aug\",\n", " \"Sep\",\n", " \"Oct\",\n", " \"Nov\",\n", " \"Dec\",\n", " ],\n", " longhand: [\n", " \"January\",\n", " \"February\",\n", " \"March\",\n", " \"April\",\n", " \"May\",\n", " \"June\",\n", " \"July\",\n", " \"August\",\n", " \"September\",\n", " \"October\",\n", " \"November\",\n", " \"December\",\n", " ]\n", " },\n", " daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],\n", " firstDayOfWeek: 0,\n", " ordinal: function (nth) {\n", " var s = nth % 100;\n", " if (s > 3 && s < 21)\n", " return \"th\";\n", " switch (s % 10) {\n", " case 1:\n", " return \"st\";\n", " case 2:\n", " return \"nd\";\n", " case 3:\n", " return \"rd\";\n", " default:\n", " return \"th\";\n", " }\n", " },\n", " rangeSeparator: \" to \",\n", " weekAbbreviation: \"Wk\",\n", " scrollTitle: \"Scroll to increment\",\n", " toggleTitle: \"Click to toggle\",\n", " amPM: [\"AM\", \"PM\"],\n", " yearAriaLabel: \"Year\",\n", " hourAriaLabel: \"Hour\",\n", " minuteAriaLabel: \"Minute\",\n", " time_24hr: false\n", " };\n", " var pad = function (number) { return (\"0\" + number).slice(-2); };\n", " var int = function (bool) { return (bool === true ? 1 : 0); };\n", " /* istanbul ignore next */\n", " function debounce(func, wait, immediate) {\n", " if (immediate === void 0) {\n", " immediate = false;\n", " }\n", " var timeout;\n", " return function () {\n", " var context = this, args = arguments;\n", " timeout !== null && clearTimeout(timeout);\n", " timeout = window.setTimeout(function () {\n", " timeout = null;\n", " if (!immediate)\n", " func.apply(context, args);\n", " }, wait);\n", " if (immediate && !timeout)\n", " func.apply(context, args);\n", " };\n", " }\n", " var arrayify = function (obj) {\n", " return obj instanceof Array ? obj : [obj];\n", " };\n", " function toggleClass(elem, className, bool) {\n", " if (bool === true)\n", " return elem.classList.add(className);\n", " elem.classList.remove(className);\n", " }\n", " function createElement(tag, className, content) {\n", " var e = window.document.createElement(tag);\n", " className = className || \"\";\n", " content = content || \"\";\n", " e.className = className;\n", " if (content !== undefined)\n", " e.textContent = content;\n", " return e;\n", " }\n", " function clearNode(node) {\n", " while (node.firstChild)\n", " node.removeChild(node.firstChild);\n", " }\n", " function findParent(node, condition) {\n", " if (condition(node))\n", " return node;\n", " else if (node.parentNode)\n", " return findParent(node.parentNode, condition);\n", " return undefined; // nothing found\n", " }\n", " function createNumberInput(inputClassName, opts) {\n", " var wrapper = createElement(\"div\", \"numInputWrapper\"), numInput = createElement(\"input\", \"numInput \" + inputClassName), arrowUp = createElement(\"span\", \"arrowUp\"), arrowDown = createElement(\"span\", \"arrowDown\");\n", " if (navigator.userAgent.indexOf(\"MSIE 9.0\") === -1) {\n", " numInput.type = \"number\";\n", " }\n", " else {\n", " numInput.type = \"text\";\n", " numInput.pattern = \"\\\\d*\";\n", " }\n", " if (opts !== undefined)\n", " for (var key in opts)\n", " numInput.setAttribute(key, opts[key]);\n", " wrapper.appendChild(numInput);\n", " wrapper.appendChild(arrowUp);\n", " wrapper.appendChild(arrowDown);\n", " return wrapper;\n", " }\n", " function getEventTarget(event) {\n", " if (typeof event.composedPath === \"function\") {\n", " var path = event.composedPath();\n", " return path[0];\n", " }\n", " return event.target;\n", " }\n", " var doNothing = function () { return undefined; };\n", " var monthToStr = function (monthNumber, shorthand, locale) { return locale.months[shorthand ? \"shorthand\" : \"longhand\"][monthNumber]; };\n", " var revFormat = {\n", " D: doNothing,\n", " F: function (dateObj, monthName, locale) {\n", " dateObj.setMonth(locale.months.longhand.indexOf(monthName));\n", " },\n", " G: function (dateObj, hour) {\n", " dateObj.setHours(parseFloat(hour));\n", " },\n", " H: function (dateObj, hour) {\n", " dateObj.setHours(parseFloat(hour));\n", " },\n", " J: function (dateObj, day) {\n", " dateObj.setDate(parseFloat(day));\n", " },\n", " K: function (dateObj, amPM, locale) {\n", " dateObj.setHours((dateObj.getHours() % 12) +\n", " 12 * int(new RegExp(locale.amPM[1], \"i\").test(amPM)));\n", " },\n", " M: function (dateObj, shortMonth, locale) {\n", " dateObj.setMonth(locale.months.shorthand.indexOf(shortMonth));\n", " },\n", " S: function (dateObj, seconds) {\n", " dateObj.setSeconds(parseFloat(seconds));\n", " },\n", " U: function (_, unixSeconds) { return new Date(parseFloat(unixSeconds) * 1000); },\n", " W: function (dateObj, weekNum, locale) {\n", " var weekNumber = parseInt(weekNum);\n", " var date = new Date(dateObj.getFullYear(), 0, 2 + (weekNumber - 1) * 7, 0, 0, 0, 0);\n", " date.setDate(date.getDate() - date.getDay() + locale.firstDayOfWeek);\n", " return date;\n", " },\n", " Y: function (dateObj, year) {\n", " dateObj.setFullYear(parseFloat(year));\n", " },\n", " Z: function (_, ISODate) { return new Date(ISODate); },\n", " d: function (dateObj, day) {\n", " dateObj.setDate(parseFloat(day));\n", " },\n", " h: function (dateObj, hour) {\n", " dateObj.setHours(parseFloat(hour));\n", " },\n", " i: function (dateObj, minutes) {\n", " dateObj.setMinutes(parseFloat(minutes));\n", " },\n", " j: function (dateObj, day) {\n", " dateObj.setDate(parseFloat(day));\n", " },\n", " l: doNothing,\n", " m: function (dateObj, month) {\n", " dateObj.setMonth(parseFloat(month) - 1);\n", " },\n", " n: function (dateObj, month) {\n", " dateObj.setMonth(parseFloat(month) - 1);\n", " },\n", " s: function (dateObj, seconds) {\n", " dateObj.setSeconds(parseFloat(seconds));\n", " },\n", " u: function (_, unixMillSeconds) {\n", " return new Date(parseFloat(unixMillSeconds));\n", " },\n", " w: doNothing,\n", " y: function (dateObj, year) {\n", " dateObj.setFullYear(2000 + parseFloat(year));\n", " }\n", " };\n", " var tokenRegex = {\n", " D: \"(\\\\w+)\",\n", " F: \"(\\\\w+)\",\n", " G: \"(\\\\d\\\\d|\\\\d)\",\n", " H: \"(\\\\d\\\\d|\\\\d)\",\n", " J: \"(\\\\d\\\\d|\\\\d)\\\\w+\",\n", " K: \"\",\n", " M: \"(\\\\w+)\",\n", " S: \"(\\\\d\\\\d|\\\\d)\",\n", " U: \"(.+)\",\n", " W: \"(\\\\d\\\\d|\\\\d)\",\n", " Y: \"(\\\\d{4})\",\n", " Z: \"(.+)\",\n", " d: \"(\\\\d\\\\d|\\\\d)\",\n", " h: \"(\\\\d\\\\d|\\\\d)\",\n", " i: \"(\\\\d\\\\d|\\\\d)\",\n", " j: \"(\\\\d\\\\d|\\\\d)\",\n", " l: \"(\\\\w+)\",\n", " m: \"(\\\\d\\\\d|\\\\d)\",\n", " n: \"(\\\\d\\\\d|\\\\d)\",\n", " s: \"(\\\\d\\\\d|\\\\d)\",\n", " u: \"(.+)\",\n", " w: \"(\\\\d\\\\d|\\\\d)\",\n", " y: \"(\\\\d{2})\"\n", " };\n", " var formats = {\n", " // get the date in UTC\n", " Z: function (date) { return date.toISOString(); },\n", " // weekday name, short, e.g. Thu\n", " D: function (date, locale, options) {\n", " return locale.weekdays.shorthand[formats.w(date, locale, options)];\n", " },\n", " // full month name e.g. January\n", " F: function (date, locale, options) {\n", " return monthToStr(formats.n(date, locale, options) - 1, false, locale);\n", " },\n", " // padded hour 1-12\n", " G: function (date, locale, options) {\n", " return pad(formats.h(date, locale, options));\n", " },\n", " // hours with leading zero e.g. 03\n", " H: function (date) { return pad(date.getHours()); },\n", " // day (1-30) with ordinal suffix e.g. 1st, 2nd\n", " J: function (date, locale) {\n", " return locale.ordinal !== undefined\n", " ? date.getDate() + locale.ordinal(date.getDate())\n", " : date.getDate();\n", " },\n", " // AM/PM\n", " K: function (date, locale) { return locale.amPM[int(date.getHours() > 11)]; },\n", " // shorthand month e.g. Jan, Sep, Oct, etc\n", " M: function (date, locale) {\n", " return monthToStr(date.getMonth(), true, locale);\n", " },\n", " // seconds 00-59\n", " S: function (date) { return pad(date.getSeconds()); },\n", " // unix timestamp\n", " U: function (date) { return date.getTime() / 1000; },\n", " W: function (date, _, options) {\n", " return options.getWeek(date);\n", " },\n", " // full year e.g. 2016\n", " Y: function (date) { return date.getFullYear(); },\n", " // day in month, padded (01-30)\n", " d: function (date) { return pad(date.getDate()); },\n", " // hour from 1-12 (am/pm)\n", " h: function (date) { return (date.getHours() % 12 ? date.getHours() % 12 : 12); },\n", " // minutes, padded with leading zero e.g. 09\n", " i: function (date) { return pad(date.getMinutes()); },\n", " // day in month (1-30)\n", " j: function (date) { return date.getDate(); },\n", " // weekday name, full, e.g. Thursday\n", " l: function (date, locale) {\n", " return locale.weekdays.longhand[date.getDay()];\n", " },\n", " // padded month number (01-12)\n", " m: function (date) { return pad(date.getMonth() + 1); },\n", " // the month number (1-12)\n", " n: function (date) { return date.getMonth() + 1; },\n", " // seconds 0-59\n", " s: function (date) { return date.getSeconds(); },\n", " // Unix Milliseconds\n", " u: function (date) { return date.getTime(); },\n", " // number of the day of the week\n", " w: function (date) { return date.getDay(); },\n", " // last two digits of year e.g. 16 for 2016\n", " y: function (date) { return String(date.getFullYear()).substring(2); }\n", " };\n", " var createDateFormatter = function (_a) {\n", " var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c;\n", " return function (dateObj, frmt, overrideLocale) {\n", " var locale = overrideLocale || l10n;\n", " if (config.formatDate !== undefined) {\n", " return config.formatDate(dateObj, frmt, locale);\n", " }\n", " return frmt\n", " .split(\"\")\n", " .map(function (c, i, arr) {\n", " return formats[c] && arr[i - 1] !== \"\\\\\"\n", " ? formats[c](dateObj, locale, config)\n", " : c !== \"\\\\\"\n", " ? c\n", " : \"\";\n", " })\n", " .join(\"\");\n", " };\n", " };\n", " var createDateParser = function (_a) {\n", " var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c;\n", " return function (date, givenFormat, timeless, customLocale) {\n", " if (date !== 0 && !date)\n", " return undefined;\n", " var locale = customLocale || l10n;\n", " var parsedDate;\n", " var dateOrig = date;\n", " if (date instanceof Date)\n", " parsedDate = new Date(date.getTime());\n", " else if (typeof date !== \"string\" &&\n", " date.toFixed !== undefined // timestamp\n", " )\n", " // create a copy\n", " parsedDate = new Date(date);\n", " else if (typeof date === \"string\") {\n", " // date string\n", " var format = givenFormat || (config || defaults).dateFormat;\n", " var datestr = String(date).trim();\n", " if (datestr === \"today\") {\n", " parsedDate = new Date();\n", " timeless = true;\n", " }\n", " else if (/Z$/.test(datestr) ||\n", " /GMT$/.test(datestr) // datestrings w/ timezone\n", " )\n", " parsedDate = new Date(date);\n", " else if (config && config.parseDate)\n", " parsedDate = config.parseDate(date, format);\n", " else {\n", " parsedDate =\n", " !config || !config.noCalendar\n", " ? new Date(new Date().getFullYear(), 0, 1, 0, 0, 0, 0)\n", " : new Date(new Date().setHours(0, 0, 0, 0));\n", " var matched = void 0, ops = [];\n", " for (var i = 0, matchIndex = 0, regexStr = \"\"; i < format.length; i++) {\n", " var token_1 = format[i];\n", " var isBackSlash = token_1 === \"\\\\\";\n", " var escaped = format[i - 1] === \"\\\\\" || isBackSlash;\n", " if (tokenRegex[token_1] && !escaped) {\n", " regexStr += tokenRegex[token_1];\n", " var match = new RegExp(regexStr).exec(date);\n", " if (match && (matched = true)) {\n", " ops[token_1 !== \"Y\" ? \"push\" : \"unshift\"]({\n", " fn: revFormat[token_1],\n", " val: match[++matchIndex]\n", " });\n", " }\n", " }\n", " else if (!isBackSlash)\n", " regexStr += \".\"; // don't really care\n", " ops.forEach(function (_a) {\n", " var fn = _a.fn, val = _a.val;\n", " return (parsedDate = fn(parsedDate, val, locale) || parsedDate);\n", " });\n", " }\n", " parsedDate = matched ? parsedDate : undefined;\n", " }\n", " }\n", " /* istanbul ignore next */\n", " if (!(parsedDate instanceof Date && !isNaN(parsedDate.getTime()))) {\n", " config.errorHandler(new Error(\"Invalid date provided: \" + dateOrig));\n", " return undefined;\n", " }\n", " if (timeless === true)\n", " parsedDate.setHours(0, 0, 0, 0);\n", " return parsedDate;\n", " };\n", " };\n", " /**\n", " * Compute the difference in dates, measured in ms\n", " */\n", " function compareDates(date1, date2, timeless) {\n", " if (timeless === void 0) {\n", " timeless = true;\n", " }\n", " if (timeless !== false) {\n", " return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n", " new Date(date2.getTime()).setHours(0, 0, 0, 0));\n", " }\n", " return date1.getTime() - date2.getTime();\n", " }\n", " var isBetween = function (ts, ts1, ts2) {\n", " return ts > Math.min(ts1, ts2) && ts < Math.max(ts1, ts2);\n", " };\n", " var duration = {\n", " DAY: 86400000\n", " };\n", " if (typeof Object.assign !== \"function\") {\n", " Object.assign = function (target) {\n", " var args = [];\n", " for (var _i = 1; _i < arguments.length; _i++) {\n", " args[_i - 1] = arguments[_i];\n", " }\n", " if (!target) {\n", " throw TypeError(\"Cannot convert undefined or null to object\");\n", " }\n", " var _loop_1 = function (source) {\n", " if (source) {\n", " Object.keys(source).forEach(function (key) { return (target[key] = source[key]); });\n", " }\n", " };\n", " for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {\n", " var source = args_1[_a];\n", " _loop_1(source);\n", " }\n", " return target;\n", " };\n", " }\n", " var DEBOUNCED_CHANGE_MS = 300;\n", " function FlatpickrInstance(element, instanceConfig) {\n", " var self = {\n", " config: __assign({}, defaults, flatpickr.defaultConfig),\n", " l10n: english\n", " };\n", " self.parseDate = createDateParser({ config: self.config, l10n: self.l10n });\n", " self._handlers = [];\n", " self.pluginElements = [];\n", " self.loadedPlugins = [];\n", " self._bind = bind;\n", " self._setHoursFromDate = setHoursFromDate;\n", " self._positionCalendar = positionCalendar;\n", " self.changeMonth = changeMonth;\n", " self.changeYear = changeYear;\n", " self.clear = clear;\n", " self.close = close;\n", " self._createElement = createElement;\n", " self.destroy = destroy;\n", " self.isEnabled = isEnabled;\n", " self.jumpToDate = jumpToDate;\n", " self.open = open;\n", " self.redraw = redraw;\n", " self.set = set;\n", " self.setDate = setDate;\n", " self.toggle = toggle;\n", " function setupHelperFunctions() {\n", " self.utils = {\n", " getDaysInMonth: function (month, yr) {\n", " if (month === void 0) {\n", " month = self.currentMonth;\n", " }\n", " if (yr === void 0) {\n", " yr = self.currentYear;\n", " }\n", " if (month === 1 && ((yr % 4 === 0 && yr % 100 !== 0) || yr % 400 === 0))\n", " return 29;\n", " return self.l10n.daysInMonth[month];\n", " }\n", " };\n", " }\n", " function init() {\n", " self.element = self.input = element;\n", " self.isOpen = false;\n", " parseConfig();\n", " setupLocale();\n", " setupInputs();\n", " setupDates();\n", " setupHelperFunctions();\n", " if (!self.isMobile)\n", " build();\n", " bindEvents();\n", " if (self.selectedDates.length || self.config.noCalendar) {\n", " if (self.config.enableTime) {\n", " setHoursFromDate(self.config.noCalendar\n", " ? self.latestSelectedDateObj || self.config.minDate\n", " : undefined);\n", " }\n", " updateValue(false);\n", " }\n", " setCalendarWidth();\n", " self.showTimeInput =\n", " self.selectedDates.length > 0 || self.config.noCalendar;\n", " var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n", " /* TODO: investigate this further\n", " \n", " Currently, there is weird positioning behavior in safari causing pages\n", " to scroll up. https://github.com/chmln/flatpickr/issues/563\n", " \n", " However, most browsers are not Safari and positioning is expensive when used\n", " in scale. https://github.com/chmln/flatpickr/issues/1096\n", " */\n", " if (!self.isMobile && isSafari) {\n", " positionCalendar();\n", " }\n", " triggerEvent(\"onReady\");\n", " }\n", " function bindToInstance(fn) {\n", " return fn.bind(self);\n", " }\n", " function setCalendarWidth() {\n", " var config = self.config;\n", " if (config.weekNumbers === false && config.showMonths === 1)\n", " return;\n", " else if (config.noCalendar !== true) {\n", " window.requestAnimationFrame(function () {\n", " if (self.calendarContainer !== undefined) {\n", " self.calendarContainer.style.visibility = \"hidden\";\n", " self.calendarContainer.style.display = \"block\";\n", " }\n", " if (self.daysContainer !== undefined) {\n", " var daysWidth = (self.days.offsetWidth + 1) * config.showMonths;\n", " self.daysContainer.style.width = daysWidth + \"px\";\n", " self.calendarContainer.style.width =\n", " daysWidth +\n", " (self.weekWrapper !== undefined\n", " ? self.weekWrapper.offsetWidth\n", " : 0) +\n", " \"px\";\n", " self.calendarContainer.style.removeProperty(\"visibility\");\n", " self.calendarContainer.style.removeProperty(\"display\");\n", " }\n", " });\n", " }\n", " }\n", " /**\n", " * The handler for all events targeting the time inputs\n", " */\n", " function updateTime(e) {\n", " if (self.selectedDates.length === 0) {\n", " setDefaultTime();\n", " }\n", " if (e !== undefined && e.type !== \"blur\") {\n", " timeWrapper(e);\n", " }\n", " var prevValue = self._input.value;\n", " setHoursFromInputs();\n", " updateValue();\n", " if (self._input.value !== prevValue) {\n", " self._debouncedChange();\n", " }\n", " }\n", " function ampm2military(hour, amPM) {\n", " return (hour % 12) + 12 * int(amPM === self.l10n.amPM[1]);\n", " }\n", " function military2ampm(hour) {\n", " switch (hour % 24) {\n", " case 0:\n", " case 12:\n", " return 12;\n", " default:\n", " return hour % 12;\n", " }\n", " }\n", " /**\n", " * Syncs the selected date object time with user's time input\n", " */\n", " function setHoursFromInputs() {\n", " if (self.hourElement === undefined || self.minuteElement === undefined)\n", " return;\n", " var hours = (parseInt(self.hourElement.value.slice(-2), 10) || 0) % 24, minutes = (parseInt(self.minuteElement.value, 10) || 0) % 60, seconds = self.secondElement !== undefined\n", " ? (parseInt(self.secondElement.value, 10) || 0) % 60\n", " : 0;\n", " if (self.amPM !== undefined) {\n", " hours = ampm2military(hours, self.amPM.textContent);\n", " }\n", " var limitMinHours = self.config.minTime !== undefined ||\n", " (self.config.minDate &&\n", " self.minDateHasTime &&\n", " self.latestSelectedDateObj &&\n", " compareDates(self.latestSelectedDateObj, self.config.minDate, true) ===\n", " 0);\n", " var limitMaxHours = self.config.maxTime !== undefined ||\n", " (self.config.maxDate &&\n", " self.maxDateHasTime &&\n", " self.latestSelectedDateObj &&\n", " compareDates(self.latestSelectedDateObj, self.config.maxDate, true) ===\n", " 0);\n", " if (limitMaxHours) {\n", " var maxTime = self.config.maxTime !== undefined\n", " ? self.config.maxTime\n", " : self.config.maxDate;\n", " hours = Math.min(hours, maxTime.getHours());\n", " if (hours === maxTime.getHours())\n", " minutes = Math.min(minutes, maxTime.getMinutes());\n", " if (minutes === maxTime.getMinutes())\n", " seconds = Math.min(seconds, maxTime.getSeconds());\n", " }\n", " if (limitMinHours) {\n", " var minTime = self.config.minTime !== undefined\n", " ? self.config.minTime\n", " : self.config.minDate;\n", " hours = Math.max(hours, minTime.getHours());\n", " if (hours === minTime.getHours())\n", " minutes = Math.max(minutes, minTime.getMinutes());\n", " if (minutes === minTime.getMinutes())\n", " seconds = Math.max(seconds, minTime.getSeconds());\n", " }\n", " setHours(hours, minutes, seconds);\n", " }\n", " /**\n", " * Syncs time input values with a date\n", " */\n", " function setHoursFromDate(dateObj) {\n", " var date = dateObj || self.latestSelectedDateObj;\n", " if (date)\n", " setHours(date.getHours(), date.getMinutes(), date.getSeconds());\n", " }\n", " function setDefaultHours() {\n", " var hours = self.config.defaultHour;\n", " var minutes = self.config.defaultMinute;\n", " var seconds = self.config.defaultSeconds;\n", " if (self.config.minDate !== undefined) {\n", " var minHr = self.config.minDate.getHours();\n", " var minMinutes = self.config.minDate.getMinutes();\n", " hours = Math.max(hours, minHr);\n", " if (hours === minHr)\n", " minutes = Math.max(minMinutes, minutes);\n", " if (hours === minHr && minutes === minMinutes)\n", " seconds = self.config.minDate.getSeconds();\n", " }\n", " if (self.config.maxDate !== undefined) {\n", " var maxHr = self.config.maxDate.getHours();\n", " var maxMinutes = self.config.maxDate.getMinutes();\n", " hours = Math.min(hours, maxHr);\n", " if (hours === maxHr)\n", " minutes = Math.min(maxMinutes, minutes);\n", " if (hours === maxHr && minutes === maxMinutes)\n", " seconds = self.config.maxDate.getSeconds();\n", " }\n", " setHours(hours, minutes, seconds);\n", " }\n", " /**\n", " * Sets the hours, minutes, and optionally seconds\n", " * of the latest selected date object and the\n", " * corresponding time inputs\n", " * @param {Number} hours the hour. whether its military\n", " * or am-pm gets inferred from config\n", " * @param {Number} minutes the minutes\n", " * @param {Number} seconds the seconds (optional)\n", " */\n", " function setHours(hours, minutes, seconds) {\n", " if (self.latestSelectedDateObj !== undefined) {\n", " self.latestSelectedDateObj.setHours(hours % 24, minutes, seconds || 0, 0);\n", " }\n", " if (!self.hourElement || !self.minuteElement || self.isMobile)\n", " return;\n", " self.hourElement.value = pad(!self.config.time_24hr\n", " ? ((12 + hours) % 12) + 12 * int(hours % 12 === 0)\n", " : hours);\n", " self.minuteElement.value = pad(minutes);\n", " if (self.amPM !== undefined)\n", " self.amPM.textContent = self.l10n.amPM[int(hours >= 12)];\n", " if (self.secondElement !== undefined)\n", " self.secondElement.value = pad(seconds);\n", " }\n", " /**\n", " * Handles the year input and incrementing events\n", " * @param {Event} event the keyup or increment event\n", " */\n", " function onYearInput(event) {\n", " var year = parseInt(event.target.value) + (event.delta || 0);\n", " if (year / 1000 > 1 ||\n", " (event.key === \"Enter\" && !/[^\\d]/.test(year.toString()))) {\n", " changeYear(year);\n", " }\n", " }\n", " /**\n", " * Essentially addEventListener + tracking\n", " * @param {Element} element the element to addEventListener to\n", " * @param {String} event the event name\n", " * @param {Function} handler the event handler\n", " */\n", " function bind(element, event, handler, options) {\n", " if (event instanceof Array)\n", " return event.forEach(function (ev) { return bind(element, ev, handler, options); });\n", " if (element instanceof Array)\n", " return element.forEach(function (el) { return bind(el, event, handler, options); });\n", " element.addEventListener(event, handler, options);\n", " self._handlers.push({\n", " element: element,\n", " event: event,\n", " handler: handler,\n", " options: options\n", " });\n", " }\n", " /**\n", " * A mousedown handler which mimics click.\n", " * Minimizes latency, since we don't need to wait for mouseup in most cases.\n", " * Also, avoids handling right clicks.\n", " *\n", " * @param {Function} handler the event handler\n", " */\n", " function onClick(handler) {\n", " return function (evt) {\n", " evt.which === 1 && handler(evt);\n", " };\n", " }\n", " function triggerChange() {\n", " triggerEvent(\"onChange\");\n", " }\n", " /**\n", " * Adds all the necessary event listeners\n", " */\n", " function bindEvents() {\n", " if (self.config.wrap) {\n", " [\"open\", \"close\", \"toggle\", \"clear\"].forEach(function (evt) {\n", " Array.prototype.forEach.call(self.element.querySelectorAll(\"[data-\" + evt + \"]\"), function (el) {\n", " return bind(el, \"click\", self[evt]);\n", " });\n", " });\n", " }\n", " if (self.isMobile) {\n", " setupMobile();\n", " return;\n", " }\n", " var debouncedResize = debounce(onResize, 50);\n", " self._debouncedChange = debounce(triggerChange, DEBOUNCED_CHANGE_MS);\n", " if (self.daysContainer && !/iPhone|iPad|iPod/i.test(navigator.userAgent))\n", " bind(self.daysContainer, \"mouseover\", function (e) {\n", " if (self.config.mode === \"range\")\n", " onMouseOver(e.target);\n", " });\n", " bind(window.document.body, \"keydown\", onKeyDown);\n", " if (!self.config.inline && !self.config.static)\n", " bind(window, \"resize\", debouncedResize);\n", " if (window.ontouchstart !== undefined)\n", " bind(window.document, \"touchstart\", documentClick);\n", " else\n", " bind(window.document, \"mousedown\", onClick(documentClick));\n", " bind(window.document, \"focus\", documentClick, { capture: true });\n", " if (self.config.clickOpens === true) {\n", " bind(self._input, \"focus\", self.open);\n", " bind(self._input, \"mousedown\", onClick(self.open));\n", " }\n", " if (self.daysContainer !== undefined) {\n", " bind(self.monthNav, \"mousedown\", onClick(onMonthNavClick));\n", " bind(self.monthNav, [\"keyup\", \"increment\"], onYearInput);\n", " bind(self.daysContainer, \"mousedown\", onClick(selectDate));\n", " }\n", " if (self.timeContainer !== undefined &&\n", " self.minuteElement !== undefined &&\n", " self.hourElement !== undefined) {\n", " var selText = function (e) {\n", " return e.target.select();\n", " };\n", " bind(self.timeContainer, [\"increment\"], updateTime);\n", " bind(self.timeContainer, \"blur\", updateTime, { capture: true });\n", " bind(self.timeContainer, \"mousedown\", onClick(timeIncrement));\n", " bind([self.hourElement, self.minuteElement], [\"focus\", \"click\"], selText);\n", " if (self.secondElement !== undefined)\n", " bind(self.secondElement, \"focus\", function () { return self.secondElement && self.secondElement.select(); });\n", " if (self.amPM !== undefined) {\n", " bind(self.amPM, \"mousedown\", onClick(function (e) {\n", " updateTime(e);\n", " triggerChange();\n", " }));\n", " }\n", " }\n", " }\n", " /**\n", " * Set the calendar view to a particular date.\n", " * @param {Date} jumpDate the date to set the view to\n", " * @param {boolean} triggerChange if change events should be triggered\n", " */\n", " function jumpToDate(jumpDate, triggerChange) {\n", " var jumpTo = jumpDate !== undefined\n", " ? self.parseDate(jumpDate)\n", " : self.latestSelectedDateObj ||\n", " (self.config.minDate && self.config.minDate > self.now\n", " ? self.config.minDate\n", " : self.config.maxDate && self.config.maxDate < self.now\n", " ? self.config.maxDate\n", " : self.now);\n", " var oldYear = self.currentYear;\n", " var oldMonth = self.currentMonth;\n", " try {\n", " if (jumpTo !== undefined) {\n", " self.currentYear = jumpTo.getFullYear();\n", " self.currentMonth = jumpTo.getMonth();\n", " }\n", " }\n", " catch (e) {\n", " /* istanbul ignore next */\n", " e.message = \"Invalid date supplied: \" + jumpTo;\n", " self.config.errorHandler(e);\n", " }\n", " if (triggerChange && self.currentYear !== oldYear) {\n", " triggerEvent(\"onYearChange\");\n", " buildMonthSwitch();\n", " }\n", " if (triggerChange &&\n", " (self.currentYear !== oldYear || self.currentMonth !== oldMonth)) {\n", " triggerEvent(\"onMonthChange\");\n", " }\n", " self.redraw();\n", " }\n", " /**\n", " * The up/down arrow handler for time inputs\n", " * @param {Event} e the click event\n", " */\n", " function timeIncrement(e) {\n", " if (~e.target.className.indexOf(\"arrow\"))\n", " incrementNumInput(e, e.target.classList.contains(\"arrowUp\") ? 1 : -1);\n", " }\n", " /**\n", " * Increments/decrements the value of input associ-\n", " * ated with the up/down arrow by dispatching an\n", " * \"increment\" event on the input.\n", " *\n", " * @param {Event} e the click event\n", " * @param {Number} delta the diff (usually 1 or -1)\n", " * @param {Element} inputElem the input element\n", " */\n", " function incrementNumInput(e, delta, inputElem) {\n", " var target = e && e.target;\n", " var input = inputElem ||\n", " (target && target.parentNode && target.parentNode.firstChild);\n", " var event = createEvent(\"increment\");\n", " event.delta = delta;\n", " input && input.dispatchEvent(event);\n", " }\n", " function build() {\n", " var fragment = window.document.createDocumentFragment();\n", " self.calendarContainer = createElement(\"div\", \"flatpickr-calendar\");\n", " self.calendarContainer.tabIndex = -1;\n", " if (!self.config.noCalendar) {\n", " fragment.appendChild(buildMonthNav());\n", " self.innerContainer = createElement(\"div\", \"flatpickr-innerContainer\");\n", " if (self.config.weekNumbers) {\n", " var _a = buildWeeks(), weekWrapper = _a.weekWrapper, weekNumbers = _a.weekNumbers;\n", " self.innerContainer.appendChild(weekWrapper);\n", " self.weekNumbers = weekNumbers;\n", " self.weekWrapper = weekWrapper;\n", " }\n", " self.rContainer = createElement(\"div\", \"flatpickr-rContainer\");\n", " self.rContainer.appendChild(buildWeekdays());\n", " if (!self.daysContainer) {\n", " self.daysContainer = createElement(\"div\", \"flatpickr-days\");\n", " self.daysContainer.tabIndex = -1;\n", " }\n", " buildDays();\n", " self.rContainer.appendChild(self.daysContainer);\n", " self.innerContainer.appendChild(self.rContainer);\n", " fragment.appendChild(self.innerContainer);\n", " }\n", " if (self.config.enableTime) {\n", " fragment.appendChild(buildTime());\n", " }\n", " toggleClass(self.calendarContainer, \"rangeMode\", self.config.mode === \"range\");\n", " toggleClass(self.calendarContainer, \"animate\", self.config.animate === true);\n", " toggleClass(self.calendarContainer, \"multiMonth\", self.config.showMonths > 1);\n", " self.calendarContainer.appendChild(fragment);\n", " var customAppend = self.config.appendTo !== undefined &&\n", " self.config.appendTo.nodeType !== undefined;\n", " if (self.config.inline || self.config.static) {\n", " self.calendarContainer.classList.add(self.config.inline ? \"inline\" : \"static\");\n", " if (self.config.inline) {\n", " if (!customAppend && self.element.parentNode)\n", " self.element.parentNode.insertBefore(self.calendarContainer, self._input.nextSibling);\n", " else if (self.config.appendTo !== undefined)\n", " self.config.appendTo.appendChild(self.calendarContainer);\n", " }\n", " if (self.config.static) {\n", " var wrapper = createElement(\"div\", \"flatpickr-wrapper\");\n", " if (self.element.parentNode)\n", " self.element.parentNode.insertBefore(wrapper, self.element);\n", " wrapper.appendChild(self.element);\n", " if (self.altInput)\n", " wrapper.appendChild(self.altInput);\n", " wrapper.appendChild(self.calendarContainer);\n", " }\n", " }\n", " if (!self.config.static && !self.config.inline)\n", " (self.config.appendTo !== undefined\n", " ? self.config.appendTo\n", " : window.document.body).appendChild(self.calendarContainer);\n", " }\n", " function createDay(className, date, dayNumber, i) {\n", " var dateIsEnabled = isEnabled(date, true), dayElement = createElement(\"span\", \"flatpickr-day \" + className, date.getDate().toString());\n", " dayElement.dateObj = date;\n", " dayElement.$i = i;\n", " dayElement.setAttribute(\"aria-label\", self.formatDate(date, self.config.ariaDateFormat));\n", " if (className.indexOf(\"hidden\") === -1 &&\n", " compareDates(date, self.now) === 0) {\n", " self.todayDateElem = dayElement;\n", " dayElement.classList.add(\"today\");\n", " dayElement.setAttribute(\"aria-current\", \"date\");\n", " }\n", " if (dateIsEnabled) {\n", " dayElement.tabIndex = -1;\n", " if (isDateSelected(date)) {\n", " dayElement.classList.add(\"selected\");\n", " self.selectedDateElem = dayElement;\n", " if (self.config.mode === \"range\") {\n", " toggleClass(dayElement, \"startRange\", self.selectedDates[0] &&\n", " compareDates(date, self.selectedDates[0], true) === 0);\n", " toggleClass(dayElement, \"endRange\", self.selectedDates[1] &&\n", " compareDates(date, self.selectedDates[1], true) === 0);\n", " if (className === \"nextMonthDay\")\n", " dayElement.classList.add(\"inRange\");\n", " }\n", " }\n", " }\n", " else {\n", " dayElement.classList.add(\"flatpickr-disabled\");\n", " }\n", " if (self.config.mode === \"range\") {\n", " if (isDateInRange(date) && !isDateSelected(date))\n", " dayElement.classList.add(\"inRange\");\n", " }\n", " if (self.weekNumbers &&\n", " self.config.showMonths === 1 &&\n", " className !== \"prevMonthDay\" &&\n", " dayNumber % 7 === 1) {\n", " self.weekNumbers.insertAdjacentHTML(\"beforeend\", \"\" + self.config.getWeek(date) + \"\");\n", " }\n", " triggerEvent(\"onDayCreate\", dayElement);\n", " return dayElement;\n", " }\n", " function focusOnDayElem(targetNode) {\n", " targetNode.focus();\n", " if (self.config.mode === \"range\")\n", " onMouseOver(targetNode);\n", " }\n", " function getFirstAvailableDay(delta) {\n", " var startMonth = delta > 0 ? 0 : self.config.showMonths - 1;\n", " var endMonth = delta > 0 ? self.config.showMonths : -1;\n", " for (var m = startMonth; m != endMonth; m += delta) {\n", " var month = self.daysContainer.children[m];\n", " var startIndex = delta > 0 ? 0 : month.children.length - 1;\n", " var endIndex = delta > 0 ? month.children.length : -1;\n", " for (var i = startIndex; i != endIndex; i += delta) {\n", " var c = month.children[i];\n", " if (c.className.indexOf(\"hidden\") === -1 && isEnabled(c.dateObj))\n", " return c;\n", " }\n", " }\n", " return undefined;\n", " }\n", " function getNextAvailableDay(current, delta) {\n", " var givenMonth = current.className.indexOf(\"Month\") === -1\n", " ? current.dateObj.getMonth()\n", " : self.currentMonth;\n", " var endMonth = delta > 0 ? self.config.showMonths : -1;\n", " var loopDelta = delta > 0 ? 1 : -1;\n", " for (var m = givenMonth - self.currentMonth; m != endMonth; m += loopDelta) {\n", " var month = self.daysContainer.children[m];\n", " var startIndex = givenMonth - self.currentMonth === m\n", " ? current.$i + delta\n", " : delta < 0\n", " ? month.children.length - 1\n", " : 0;\n", " var numMonthDays = month.children.length;\n", " for (var i = startIndex; i >= 0 && i < numMonthDays && i != (delta > 0 ? numMonthDays : -1); i += loopDelta) {\n", " var c = month.children[i];\n", " if (c.className.indexOf(\"hidden\") === -1 &&\n", " isEnabled(c.dateObj) &&\n", " Math.abs(current.$i - i) >= Math.abs(delta))\n", " return focusOnDayElem(c);\n", " }\n", " }\n", " self.changeMonth(loopDelta);\n", " focusOnDay(getFirstAvailableDay(loopDelta), 0);\n", " return undefined;\n", " }\n", " function focusOnDay(current, offset) {\n", " var dayFocused = isInView(document.activeElement || document.body);\n", " var startElem = current !== undefined\n", " ? current\n", " : dayFocused\n", " ? document.activeElement\n", " : self.selectedDateElem !== undefined && isInView(self.selectedDateElem)\n", " ? self.selectedDateElem\n", " : self.todayDateElem !== undefined && isInView(self.todayDateElem)\n", " ? self.todayDateElem\n", " : getFirstAvailableDay(offset > 0 ? 1 : -1);\n", " if (startElem === undefined)\n", " return self._input.focus();\n", " if (!dayFocused)\n", " return focusOnDayElem(startElem);\n", " getNextAvailableDay(startElem, offset);\n", " }\n", " function buildMonthDays(year, month) {\n", " var firstOfMonth = (new Date(year, month, 1).getDay() - self.l10n.firstDayOfWeek + 7) % 7;\n", " var prevMonthDays = self.utils.getDaysInMonth((month - 1 + 12) % 12);\n", " var daysInMonth = self.utils.getDaysInMonth(month), days = window.document.createDocumentFragment(), isMultiMonth = self.config.showMonths > 1, prevMonthDayClass = isMultiMonth ? \"prevMonthDay hidden\" : \"prevMonthDay\", nextMonthDayClass = isMultiMonth ? \"nextMonthDay hidden\" : \"nextMonthDay\";\n", " var dayNumber = prevMonthDays + 1 - firstOfMonth, dayIndex = 0;\n", " // prepend days from the ending of previous month\n", " for (; dayNumber <= prevMonthDays; dayNumber++, dayIndex++) {\n", " days.appendChild(createDay(prevMonthDayClass, new Date(year, month - 1, dayNumber), dayNumber, dayIndex));\n", " }\n", " // Start at 1 since there is no 0th day\n", " for (dayNumber = 1; dayNumber <= daysInMonth; dayNumber++, dayIndex++) {\n", " days.appendChild(createDay(\"\", new Date(year, month, dayNumber), dayNumber, dayIndex));\n", " }\n", " // append days from the next month\n", " for (var dayNum = daysInMonth + 1; dayNum <= 42 - firstOfMonth &&\n", " (self.config.showMonths === 1 || dayIndex % 7 !== 0); dayNum++, dayIndex++) {\n", " days.appendChild(createDay(nextMonthDayClass, new Date(year, month + 1, dayNum % daysInMonth), dayNum, dayIndex));\n", " }\n", " //updateNavigationCurrentMonth();\n", " var dayContainer = createElement(\"div\", \"dayContainer\");\n", " dayContainer.appendChild(days);\n", " return dayContainer;\n", " }\n", " function buildDays() {\n", " if (self.daysContainer === undefined) {\n", " return;\n", " }\n", " clearNode(self.daysContainer);\n", " // TODO: week numbers for each month\n", " if (self.weekNumbers)\n", " clearNode(self.weekNumbers);\n", " var frag = document.createDocumentFragment();\n", " for (var i = 0; i < self.config.showMonths; i++) {\n", " var d = new Date(self.currentYear, self.currentMonth, 1);\n", " d.setMonth(self.currentMonth + i);\n", " frag.appendChild(buildMonthDays(d.getFullYear(), d.getMonth()));\n", " }\n", " self.daysContainer.appendChild(frag);\n", " self.days = self.daysContainer.firstChild;\n", " if (self.config.mode === \"range\" && self.selectedDates.length === 1) {\n", " onMouseOver();\n", " }\n", " }\n", " function buildMonthSwitch() {\n", " if (self.config.showMonths > 1 ||\n", " self.config.monthSelectorType !== \"dropdown\")\n", " return;\n", " var shouldBuildMonth = function (month) {\n", " if (self.config.minDate !== undefined &&\n", " self.currentYear === self.config.minDate.getFullYear() &&\n", " month < self.config.minDate.getMonth()) {\n", " return false;\n", " }\n", " return !(self.config.maxDate !== undefined &&\n", " self.currentYear === self.config.maxDate.getFullYear() &&\n", " month > self.config.maxDate.getMonth());\n", " };\n", " self.monthsDropdownContainer.tabIndex = -1;\n", " self.monthsDropdownContainer.innerHTML = \"\";\n", " for (var i = 0; i < 12; i++) {\n", " if (!shouldBuildMonth(i))\n", " continue;\n", " var month = createElement(\"option\", \"flatpickr-monthDropdown-month\");\n", " month.value = new Date(self.currentYear, i).getMonth().toString();\n", " month.textContent = monthToStr(i, self.config.shorthandCurrentMonth, self.l10n);\n", " month.tabIndex = -1;\n", " if (self.currentMonth === i) {\n", " month.selected = true;\n", " }\n", " self.monthsDropdownContainer.appendChild(month);\n", " }\n", " }\n", " function buildMonth() {\n", " var container = createElement(\"div\", \"flatpickr-month\");\n", " var monthNavFragment = window.document.createDocumentFragment();\n", " var monthElement;\n", " if (self.config.showMonths > 1 ||\n", " self.config.monthSelectorType === \"static\") {\n", " monthElement = createElement(\"span\", \"cur-month\");\n", " }\n", " else {\n", " self.monthsDropdownContainer = createElement(\"select\", \"flatpickr-monthDropdown-months\");\n", " bind(self.monthsDropdownContainer, \"change\", function (e) {\n", " var target = e.target;\n", " var selectedMonth = parseInt(target.value, 10);\n", " self.changeMonth(selectedMonth - self.currentMonth);\n", " triggerEvent(\"onMonthChange\");\n", " });\n", " buildMonthSwitch();\n", " monthElement = self.monthsDropdownContainer;\n", " }\n", " var yearInput = createNumberInput(\"cur-year\", { tabindex: \"-1\" });\n", " var yearElement = yearInput.getElementsByTagName(\"input\")[0];\n", " yearElement.setAttribute(\"aria-label\", self.l10n.yearAriaLabel);\n", " if (self.config.minDate) {\n", " yearElement.setAttribute(\"min\", self.config.minDate.getFullYear().toString());\n", " }\n", " if (self.config.maxDate) {\n", " yearElement.setAttribute(\"max\", self.config.maxDate.getFullYear().toString());\n", " yearElement.disabled =\n", " !!self.config.minDate &&\n", " self.config.minDate.getFullYear() === self.config.maxDate.getFullYear();\n", " }\n", " var currentMonth = createElement(\"div\", \"flatpickr-current-month\");\n", " currentMonth.appendChild(monthElement);\n", " currentMonth.appendChild(yearInput);\n", " monthNavFragment.appendChild(currentMonth);\n", " container.appendChild(monthNavFragment);\n", " return {\n", " container: container,\n", " yearElement: yearElement,\n", " monthElement: monthElement\n", " };\n", " }\n", " function buildMonths() {\n", " clearNode(self.monthNav);\n", " self.monthNav.appendChild(self.prevMonthNav);\n", " if (self.config.showMonths) {\n", " self.yearElements = [];\n", " self.monthElements = [];\n", " }\n", " for (var m = self.config.showMonths; m--;) {\n", " var month = buildMonth();\n", " self.yearElements.push(month.yearElement);\n", " self.monthElements.push(month.monthElement);\n", " self.monthNav.appendChild(month.container);\n", " }\n", " self.monthNav.appendChild(self.nextMonthNav);\n", " }\n", " function buildMonthNav() {\n", " self.monthNav = createElement(\"div\", \"flatpickr-months\");\n", " self.yearElements = [];\n", " self.monthElements = [];\n", " self.prevMonthNav = createElement(\"span\", \"flatpickr-prev-month\");\n", " self.prevMonthNav.innerHTML = self.config.prevArrow;\n", " self.nextMonthNav = createElement(\"span\", \"flatpickr-next-month\");\n", " self.nextMonthNav.innerHTML = self.config.nextArrow;\n", " buildMonths();\n", " Object.defineProperty(self, \"_hidePrevMonthArrow\", {\n", " get: function () { return self.__hidePrevMonthArrow; },\n", " set: function (bool) {\n", " if (self.__hidePrevMonthArrow !== bool) {\n", " toggleClass(self.prevMonthNav, \"flatpickr-disabled\", bool);\n", " self.__hidePrevMonthArrow = bool;\n", " }\n", " }\n", " });\n", " Object.defineProperty(self, \"_hideNextMonthArrow\", {\n", " get: function () { return self.__hideNextMonthArrow; },\n", " set: function (bool) {\n", " if (self.__hideNextMonthArrow !== bool) {\n", " toggleClass(self.nextMonthNav, \"flatpickr-disabled\", bool);\n", " self.__hideNextMonthArrow = bool;\n", " }\n", " }\n", " });\n", " self.currentYearElement = self.yearElements[0];\n", " updateNavigationCurrentMonth();\n", " return self.monthNav;\n", " }\n", " function buildTime() {\n", " self.calendarContainer.classList.add(\"hasTime\");\n", " if (self.config.noCalendar)\n", " self.calendarContainer.classList.add(\"noCalendar\");\n", " self.timeContainer = createElement(\"div\", \"flatpickr-time\");\n", " self.timeContainer.tabIndex = -1;\n", " var separator = createElement(\"span\", \"flatpickr-time-separator\", \":\");\n", " var hourInput = createNumberInput(\"flatpickr-hour\", {\n", " \"aria-label\": self.l10n.hourAriaLabel\n", " });\n", " self.hourElement = hourInput.getElementsByTagName(\"input\")[0];\n", " var minuteInput = createNumberInput(\"flatpickr-minute\", {\n", " \"aria-label\": self.l10n.minuteAriaLabel\n", " });\n", " self.minuteElement = minuteInput.getElementsByTagName(\"input\")[0];\n", " self.hourElement.tabIndex = self.minuteElement.tabIndex = -1;\n", " self.hourElement.value = pad(self.latestSelectedDateObj\n", " ? self.latestSelectedDateObj.getHours()\n", " : self.config.time_24hr\n", " ? self.config.defaultHour\n", " : military2ampm(self.config.defaultHour));\n", " self.minuteElement.value = pad(self.latestSelectedDateObj\n", " ? self.latestSelectedDateObj.getMinutes()\n", " : self.config.defaultMinute);\n", " self.hourElement.setAttribute(\"step\", self.config.hourIncrement.toString());\n", " self.minuteElement.setAttribute(\"step\", self.config.minuteIncrement.toString());\n", " self.hourElement.setAttribute(\"min\", self.config.time_24hr ? \"0\" : \"1\");\n", " self.hourElement.setAttribute(\"max\", self.config.time_24hr ? \"23\" : \"12\");\n", " self.minuteElement.setAttribute(\"min\", \"0\");\n", " self.minuteElement.setAttribute(\"max\", \"59\");\n", " self.timeContainer.appendChild(hourInput);\n", " self.timeContainer.appendChild(separator);\n", " self.timeContainer.appendChild(minuteInput);\n", " if (self.config.time_24hr)\n", " self.timeContainer.classList.add(\"time24hr\");\n", " if (self.config.enableSeconds) {\n", " self.timeContainer.classList.add(\"hasSeconds\");\n", " var secondInput = createNumberInput(\"flatpickr-second\");\n", " self.secondElement = secondInput.getElementsByTagName(\"input\")[0];\n", " self.secondElement.value = pad(self.latestSelectedDateObj\n", " ? self.latestSelectedDateObj.getSeconds()\n", " : self.config.defaultSeconds);\n", " self.secondElement.setAttribute(\"step\", self.minuteElement.getAttribute(\"step\"));\n", " self.secondElement.setAttribute(\"min\", \"0\");\n", " self.secondElement.setAttribute(\"max\", \"59\");\n", " self.timeContainer.appendChild(createElement(\"span\", \"flatpickr-time-separator\", \":\"));\n", " self.timeContainer.appendChild(secondInput);\n", " }\n", " if (!self.config.time_24hr) {\n", " // add self.amPM if appropriate\n", " self.amPM = createElement(\"span\", \"flatpickr-am-pm\", self.l10n.amPM[int((self.latestSelectedDateObj\n", " ? self.hourElement.value\n", " : self.config.defaultHour) > 11)]);\n", " self.amPM.title = self.l10n.toggleTitle;\n", " self.amPM.tabIndex = -1;\n", " self.timeContainer.appendChild(self.amPM);\n", " }\n", " return self.timeContainer;\n", " }\n", " function buildWeekdays() {\n", " if (!self.weekdayContainer)\n", " self.weekdayContainer = createElement(\"div\", \"flatpickr-weekdays\");\n", " else\n", " clearNode(self.weekdayContainer);\n", " for (var i = self.config.showMonths; i--;) {\n", " var container = createElement(\"div\", \"flatpickr-weekdaycontainer\");\n", " self.weekdayContainer.appendChild(container);\n", " }\n", " updateWeekdays();\n", " return self.weekdayContainer;\n", " }\n", " function updateWeekdays() {\n", " if (!self.weekdayContainer) {\n", " return;\n", " }\n", " var firstDayOfWeek = self.l10n.firstDayOfWeek;\n", " var weekdays = self.l10n.weekdays.shorthand.slice();\n", " if (firstDayOfWeek > 0 && firstDayOfWeek < weekdays.length) {\n", " weekdays = weekdays.splice(firstDayOfWeek, weekdays.length).concat(weekdays.splice(0, firstDayOfWeek));\n", " }\n", " for (var i = self.config.showMonths; i--;) {\n", " self.weekdayContainer.children[i].innerHTML = \"\\n \\n \" + weekdays.join(\"\") + \"\\n \\n \";\n", " }\n", " }\n", " /* istanbul ignore next */\n", " function buildWeeks() {\n", " self.calendarContainer.classList.add(\"hasWeeks\");\n", " var weekWrapper = createElement(\"div\", \"flatpickr-weekwrapper\");\n", " weekWrapper.appendChild(createElement(\"span\", \"flatpickr-weekday\", self.l10n.weekAbbreviation));\n", " var weekNumbers = createElement(\"div\", \"flatpickr-weeks\");\n", " weekWrapper.appendChild(weekNumbers);\n", " return {\n", " weekWrapper: weekWrapper,\n", " weekNumbers: weekNumbers\n", " };\n", " }\n", " function changeMonth(value, isOffset) {\n", " if (isOffset === void 0) {\n", " isOffset = true;\n", " }\n", " var delta = isOffset ? value : value - self.currentMonth;\n", " if ((delta < 0 && self._hidePrevMonthArrow === true) ||\n", " (delta > 0 && self._hideNextMonthArrow === true))\n", " return;\n", " self.currentMonth += delta;\n", " if (self.currentMonth < 0 || self.currentMonth > 11) {\n", " self.currentYear += self.currentMonth > 11 ? 1 : -1;\n", " self.currentMonth = (self.currentMonth + 12) % 12;\n", " triggerEvent(\"onYearChange\");\n", " buildMonthSwitch();\n", " }\n", " buildDays();\n", " triggerEvent(\"onMonthChange\");\n", " updateNavigationCurrentMonth();\n", " }\n", " function clear(triggerChangeEvent, toInitial) {\n", " if (triggerChangeEvent === void 0) {\n", " triggerChangeEvent = true;\n", " }\n", " if (toInitial === void 0) {\n", " toInitial = true;\n", " }\n", " self.input.value = \"\";\n", " if (self.altInput !== undefined)\n", " self.altInput.value = \"\";\n", " if (self.mobileInput !== undefined)\n", " self.mobileInput.value = \"\";\n", " self.selectedDates = [];\n", " self.latestSelectedDateObj = undefined;\n", " if (toInitial === true) {\n", " self.currentYear = self._initialDate.getFullYear();\n", " self.currentMonth = self._initialDate.getMonth();\n", " }\n", " self.showTimeInput = false;\n", " if (self.config.enableTime === true) {\n", " setDefaultHours();\n", " }\n", " self.redraw();\n", " if (triggerChangeEvent)\n", " // triggerChangeEvent is true (default) or an Event\n", " triggerEvent(\"onChange\");\n", " }\n", " function close() {\n", " self.isOpen = false;\n", " if (!self.isMobile) {\n", " if (self.calendarContainer !== undefined) {\n", " self.calendarContainer.classList.remove(\"open\");\n", " }\n", " if (self._input !== undefined) {\n", " self._input.classList.remove(\"active\");\n", " }\n", " }\n", " triggerEvent(\"onClose\");\n", " }\n", " function destroy() {\n", " if (self.config !== undefined)\n", " triggerEvent(\"onDestroy\");\n", " for (var i = self._handlers.length; i--;) {\n", " var h = self._handlers[i];\n", " h.element.removeEventListener(h.event, h.handler, h.options);\n", " }\n", " self._handlers = [];\n", " if (self.mobileInput) {\n", " if (self.mobileInput.parentNode)\n", " self.mobileInput.parentNode.removeChild(self.mobileInput);\n", " self.mobileInput = undefined;\n", " }\n", " else if (self.calendarContainer && self.calendarContainer.parentNode) {\n", " if (self.config.static && self.calendarContainer.parentNode) {\n", " var wrapper = self.calendarContainer.parentNode;\n", " wrapper.lastChild && wrapper.removeChild(wrapper.lastChild);\n", " if (wrapper.parentNode) {\n", " while (wrapper.firstChild)\n", " wrapper.parentNode.insertBefore(wrapper.firstChild, wrapper);\n", " wrapper.parentNode.removeChild(wrapper);\n", " }\n", " }\n", " else\n", " self.calendarContainer.parentNode.removeChild(self.calendarContainer);\n", " }\n", " if (self.altInput) {\n", " self.input.type = \"text\";\n", " if (self.altInput.parentNode)\n", " self.altInput.parentNode.removeChild(self.altInput);\n", " delete self.altInput;\n", " }\n", " if (self.input) {\n", " self.input.type = self.input._type;\n", " self.input.classList.remove(\"flatpickr-input\");\n", " self.input.removeAttribute(\"readonly\");\n", " self.input.value = \"\";\n", " }\n", " [\n", " \"_showTimeInput\",\n", " \"latestSelectedDateObj\",\n", " \"_hideNextMonthArrow\",\n", " \"_hidePrevMonthArrow\",\n", " \"__hideNextMonthArrow\",\n", " \"__hidePrevMonthArrow\",\n", " \"isMobile\",\n", " \"isOpen\",\n", " \"selectedDateElem\",\n", " \"minDateHasTime\",\n", " \"maxDateHasTime\",\n", " \"days\",\n", " \"daysContainer\",\n", " \"_input\",\n", " \"_positionElement\",\n", " \"innerContainer\",\n", " \"rContainer\",\n", " \"monthNav\",\n", " \"todayDateElem\",\n", " \"calendarContainer\",\n", " \"weekdayContainer\",\n", " \"prevMonthNav\",\n", " \"nextMonthNav\",\n", " \"monthsDropdownContainer\",\n", " \"currentMonthElement\",\n", " \"currentYearElement\",\n", " \"navigationCurrentMonth\",\n", " \"selectedDateElem\",\n", " \"config\",\n", " ].forEach(function (k) {\n", " try {\n", " delete self[k];\n", " }\n", " catch (_) { }\n", " });\n", " }\n", " function isCalendarElem(elem) {\n", " if (self.config.appendTo && self.config.appendTo.contains(elem))\n", " return true;\n", " return self.calendarContainer.contains(elem);\n", " }\n", " function documentClick(e) {\n", " if (self.isOpen && !self.config.inline) {\n", " var eventTarget_1 = getEventTarget(e);\n", " var isCalendarElement = isCalendarElem(eventTarget_1);\n", " var isInput = eventTarget_1 === self.input ||\n", " eventTarget_1 === self.altInput ||\n", " self.element.contains(eventTarget_1) ||\n", " // web components\n", " // e.path is not present in all browsers. circumventing typechecks\n", " (e.path &&\n", " e.path.indexOf &&\n", " (~e.path.indexOf(self.input) ||\n", " ~e.path.indexOf(self.altInput)));\n", " var lostFocus = e.type === \"blur\"\n", " ? isInput &&\n", " e.relatedTarget &&\n", " !isCalendarElem(e.relatedTarget)\n", " : !isInput &&\n", " !isCalendarElement &&\n", " !isCalendarElem(e.relatedTarget);\n", " var isIgnored = !self.config.ignoredFocusElements.some(function (elem) {\n", " return elem.contains(eventTarget_1);\n", " });\n", " if (lostFocus && isIgnored) {\n", " if (self.timeContainer !== undefined &&\n", " self.minuteElement !== undefined &&\n", " self.hourElement !== undefined) {\n", " updateTime();\n", " }\n", " self.close();\n", " if (self.config.mode === \"range\" && self.selectedDates.length === 1) {\n", " self.clear(false);\n", " self.redraw();\n", " }\n", " }\n", " }\n", " }\n", " function changeYear(newYear) {\n", " if (!newYear ||\n", " (self.config.minDate && newYear < self.config.minDate.getFullYear()) ||\n", " (self.config.maxDate && newYear > self.config.maxDate.getFullYear()))\n", " return;\n", " var newYearNum = newYear, isNewYear = self.currentYear !== newYearNum;\n", " self.currentYear = newYearNum || self.currentYear;\n", " if (self.config.maxDate &&\n", " self.currentYear === self.config.maxDate.getFullYear()) {\n", " self.currentMonth = Math.min(self.config.maxDate.getMonth(), self.currentMonth);\n", " }\n", " else if (self.config.minDate &&\n", " self.currentYear === self.config.minDate.getFullYear()) {\n", " self.currentMonth = Math.max(self.config.minDate.getMonth(), self.currentMonth);\n", " }\n", " if (isNewYear) {\n", " self.redraw();\n", " triggerEvent(\"onYearChange\");\n", " buildMonthSwitch();\n", " }\n", " }\n", " function isEnabled(date, timeless) {\n", " if (timeless === void 0) {\n", " timeless = true;\n", " }\n", " var dateToCheck = self.parseDate(date, undefined, timeless); // timeless\n", " if ((self.config.minDate &&\n", " dateToCheck &&\n", " compareDates(dateToCheck, self.config.minDate, timeless !== undefined ? timeless : !self.minDateHasTime) < 0) ||\n", " (self.config.maxDate &&\n", " dateToCheck &&\n", " compareDates(dateToCheck, self.config.maxDate, timeless !== undefined ? timeless : !self.maxDateHasTime) > 0))\n", " return false;\n", " if (self.config.enable.length === 0 && self.config.disable.length === 0)\n", " return true;\n", " if (dateToCheck === undefined)\n", " return false;\n", " var bool = self.config.enable.length > 0, array = bool ? self.config.enable : self.config.disable;\n", " for (var i = 0, d = void 0; i < array.length; i++) {\n", " d = array[i];\n", " if (typeof d === \"function\" &&\n", " d(dateToCheck) // disabled by function\n", " )\n", " return bool;\n", " else if (d instanceof Date &&\n", " dateToCheck !== undefined &&\n", " d.getTime() === dateToCheck.getTime())\n", " // disabled by date\n", " return bool;\n", " else if (typeof d === \"string\" && dateToCheck !== undefined) {\n", " // disabled by date string\n", " var parsed = self.parseDate(d, undefined, true);\n", " return parsed && parsed.getTime() === dateToCheck.getTime()\n", " ? bool\n", " : !bool;\n", " }\n", " else if (\n", " // disabled by range\n", " typeof d === \"object\" &&\n", " dateToCheck !== undefined &&\n", " d.from &&\n", " d.to &&\n", " dateToCheck.getTime() >= d.from.getTime() &&\n", " dateToCheck.getTime() <= d.to.getTime())\n", " return bool;\n", " }\n", " return !bool;\n", " }\n", " function isInView(elem) {\n", " if (self.daysContainer !== undefined)\n", " return (elem.className.indexOf(\"hidden\") === -1 &&\n", " self.daysContainer.contains(elem));\n", " return false;\n", " }\n", " function onKeyDown(e) {\n", " // e.key e.keyCode\n", " // \"Backspace\" 8\n", " // \"Tab\" 9\n", " // \"Enter\" 13\n", " // \"Escape\" (IE \"Esc\") 27\n", " // \"ArrowLeft\" (IE \"Left\") 37\n", " // \"ArrowUp\" (IE \"Up\") 38\n", " // \"ArrowRight\" (IE \"Right\") 39\n", " // \"ArrowDown\" (IE \"Down\") 40\n", " // \"Delete\" (IE \"Del\") 46\n", " var isInput = e.target === self._input;\n", " var allowInput = self.config.allowInput;\n", " var allowKeydown = self.isOpen && (!allowInput || !isInput);\n", " var allowInlineKeydown = self.config.inline && isInput && !allowInput;\n", " if (e.keyCode === 13 && isInput) {\n", " if (allowInput) {\n", " self.setDate(self._input.value, true, e.target === self.altInput\n", " ? self.config.altFormat\n", " : self.config.dateFormat);\n", " return e.target.blur();\n", " }\n", " else {\n", " self.open();\n", " }\n", " }\n", " else if (isCalendarElem(e.target) ||\n", " allowKeydown ||\n", " allowInlineKeydown) {\n", " var isTimeObj = !!self.timeContainer &&\n", " self.timeContainer.contains(e.target);\n", " switch (e.keyCode) {\n", " case 13:\n", " if (isTimeObj) {\n", " e.preventDefault();\n", " updateTime();\n", " focusAndClose();\n", " }\n", " else\n", " selectDate(e);\n", " break;\n", " case 27: // escape\n", " e.preventDefault();\n", " focusAndClose();\n", " break;\n", " case 8:\n", " case 46:\n", " if (isInput && !self.config.allowInput) {\n", " e.preventDefault();\n", " self.clear();\n", " }\n", " break;\n", " case 37:\n", " case 39:\n", " if (!isTimeObj && !isInput) {\n", " e.preventDefault();\n", " if (self.daysContainer !== undefined &&\n", " (allowInput === false ||\n", " (document.activeElement && isInView(document.activeElement)))) {\n", " var delta_1 = e.keyCode === 39 ? 1 : -1;\n", " if (!e.ctrlKey)\n", " focusOnDay(undefined, delta_1);\n", " else {\n", " e.stopPropagation();\n", " changeMonth(delta_1);\n", " focusOnDay(getFirstAvailableDay(1), 0);\n", " }\n", " }\n", " }\n", " else if (self.hourElement)\n", " self.hourElement.focus();\n", " break;\n", " case 38:\n", " case 40:\n", " e.preventDefault();\n", " var delta = e.keyCode === 40 ? 1 : -1;\n", " if ((self.daysContainer && e.target.$i !== undefined) ||\n", " e.target === self.input ||\n", " e.target === self.altInput) {\n", " if (e.ctrlKey) {\n", " e.stopPropagation();\n", " changeYear(self.currentYear - delta);\n", " focusOnDay(getFirstAvailableDay(1), 0);\n", " }\n", " else if (!isTimeObj)\n", " focusOnDay(undefined, delta * 7);\n", " }\n", " else if (e.target === self.currentYearElement) {\n", " changeYear(self.currentYear - delta);\n", " }\n", " else if (self.config.enableTime) {\n", " if (!isTimeObj && self.hourElement)\n", " self.hourElement.focus();\n", " updateTime(e);\n", " self._debouncedChange();\n", " }\n", " break;\n", " case 9:\n", " if (isTimeObj) {\n", " var elems = [\n", " self.hourElement,\n", " self.minuteElement,\n", " self.secondElement,\n", " self.amPM,\n", " ]\n", " .concat(self.pluginElements)\n", " .filter(function (x) { return x; });\n", " var i = elems.indexOf(e.target);\n", " if (i !== -1) {\n", " var target = elems[i + (e.shiftKey ? -1 : 1)];\n", " e.preventDefault();\n", " (target || self._input).focus();\n", " }\n", " }\n", " else if (!self.config.noCalendar &&\n", " self.daysContainer &&\n", " self.daysContainer.contains(e.target) &&\n", " e.shiftKey) {\n", " e.preventDefault();\n", " self._input.focus();\n", " }\n", " break;\n", " default:\n", " break;\n", " }\n", " }\n", " if (self.amPM !== undefined && e.target === self.amPM) {\n", " switch (e.key) {\n", " case self.l10n.amPM[0].charAt(0):\n", " case self.l10n.amPM[0].charAt(0).toLowerCase():\n", " self.amPM.textContent = self.l10n.amPM[0];\n", " setHoursFromInputs();\n", " updateValue();\n", " break;\n", " case self.l10n.amPM[1].charAt(0):\n", " case self.l10n.amPM[1].charAt(0).toLowerCase():\n", " self.amPM.textContent = self.l10n.amPM[1];\n", " setHoursFromInputs();\n", " updateValue();\n", " break;\n", " }\n", " }\n", " if (isInput || isCalendarElem(e.target)) {\n", " triggerEvent(\"onKeyDown\", e);\n", " }\n", " }\n", " function onMouseOver(elem) {\n", " if (self.selectedDates.length !== 1 ||\n", " (elem &&\n", " (!elem.classList.contains(\"flatpickr-day\") ||\n", " elem.classList.contains(\"flatpickr-disabled\"))))\n", " return;\n", " var hoverDate = elem\n", " ? elem.dateObj.getTime()\n", " : self.days.firstElementChild.dateObj.getTime(), initialDate = self.parseDate(self.selectedDates[0], undefined, true).getTime(), rangeStartDate = Math.min(hoverDate, self.selectedDates[0].getTime()), rangeEndDate = Math.max(hoverDate, self.selectedDates[0].getTime());\n", " var containsDisabled = false;\n", " var minRange = 0, maxRange = 0;\n", " for (var t = rangeStartDate; t < rangeEndDate; t += duration.DAY) {\n", " if (!isEnabled(new Date(t), true)) {\n", " containsDisabled =\n", " containsDisabled || (t > rangeStartDate && t < rangeEndDate);\n", " if (t < initialDate && (!minRange || t > minRange))\n", " minRange = t;\n", " else if (t > initialDate && (!maxRange || t < maxRange))\n", " maxRange = t;\n", " }\n", " }\n", " for (var m = 0; m < self.config.showMonths; m++) {\n", " var month = self.daysContainer.children[m];\n", " var _loop_1 = function (i, l) {\n", " var dayElem = month.children[i], date = dayElem.dateObj;\n", " var timestamp = date.getTime();\n", " var outOfRange = (minRange > 0 && timestamp < minRange) ||\n", " (maxRange > 0 && timestamp > maxRange);\n", " if (outOfRange) {\n", " dayElem.classList.add(\"notAllowed\");\n", " [\"inRange\", \"startRange\", \"endRange\"].forEach(function (c) {\n", " dayElem.classList.remove(c);\n", " });\n", " return \"continue\";\n", " }\n", " else if (containsDisabled && !outOfRange)\n", " return \"continue\";\n", " [\"startRange\", \"inRange\", \"endRange\", \"notAllowed\"].forEach(function (c) {\n", " dayElem.classList.remove(c);\n", " });\n", " if (elem !== undefined) {\n", " elem.classList.add(hoverDate <= self.selectedDates[0].getTime()\n", " ? \"startRange\"\n", " : \"endRange\");\n", " if (initialDate < hoverDate && timestamp === initialDate)\n", " dayElem.classList.add(\"startRange\");\n", " else if (initialDate > hoverDate && timestamp === initialDate)\n", " dayElem.classList.add(\"endRange\");\n", " if (timestamp >= minRange &&\n", " (maxRange === 0 || timestamp <= maxRange) &&\n", " isBetween(timestamp, initialDate, hoverDate))\n", " dayElem.classList.add(\"inRange\");\n", " }\n", " };\n", " for (var i = 0, l = month.children.length; i < l; i++) {\n", " _loop_1(i, l);\n", " }\n", " }\n", " }\n", " function onResize() {\n", " if (self.isOpen && !self.config.static && !self.config.inline)\n", " positionCalendar();\n", " }\n", " function setDefaultTime() {\n", " self.setDate(self.config.minDate !== undefined\n", " ? new Date(self.config.minDate.getTime())\n", " : new Date(), true);\n", " setDefaultHours();\n", " updateValue();\n", " }\n", " function open(e, positionElement) {\n", " if (positionElement === void 0) {\n", " positionElement = self._positionElement;\n", " }\n", " if (self.isMobile === true) {\n", " if (e) {\n", " e.preventDefault();\n", " e.target && e.target.blur();\n", " }\n", " if (self.mobileInput !== undefined) {\n", " self.mobileInput.focus();\n", " self.mobileInput.click();\n", " }\n", " triggerEvent(\"onOpen\");\n", " return;\n", " }\n", " if (self._input.disabled || self.config.inline)\n", " return;\n", " var wasOpen = self.isOpen;\n", " self.isOpen = true;\n", " if (!wasOpen) {\n", " self.calendarContainer.classList.add(\"open\");\n", " self._input.classList.add(\"active\");\n", " triggerEvent(\"onOpen\");\n", " positionCalendar(positionElement);\n", " }\n", " if (self.config.enableTime === true && self.config.noCalendar === true) {\n", " if (self.selectedDates.length === 0) {\n", " setDefaultTime();\n", " }\n", " if (self.config.allowInput === false &&\n", " (e === undefined ||\n", " !self.timeContainer.contains(e.relatedTarget))) {\n", " setTimeout(function () { return self.hourElement.select(); }, 50);\n", " }\n", " }\n", " }\n", " function minMaxDateSetter(type) {\n", " return function (date) {\n", " var dateObj = (self.config[\"_\" + type + \"Date\"] = self.parseDate(date, self.config.dateFormat));\n", " var inverseDateObj = self.config[\"_\" + (type === \"min\" ? \"max\" : \"min\") + \"Date\"];\n", " if (dateObj !== undefined) {\n", " self[type === \"min\" ? \"minDateHasTime\" : \"maxDateHasTime\"] =\n", " dateObj.getHours() > 0 ||\n", " dateObj.getMinutes() > 0 ||\n", " dateObj.getSeconds() > 0;\n", " }\n", " if (self.selectedDates) {\n", " self.selectedDates = self.selectedDates.filter(function (d) { return isEnabled(d); });\n", " if (!self.selectedDates.length && type === \"min\")\n", " setHoursFromDate(dateObj);\n", " updateValue();\n", " }\n", " if (self.daysContainer) {\n", " redraw();\n", " if (dateObj !== undefined)\n", " self.currentYearElement[type] = dateObj.getFullYear().toString();\n", " else\n", " self.currentYearElement.removeAttribute(type);\n", " self.currentYearElement.disabled =\n", " !!inverseDateObj &&\n", " dateObj !== undefined &&\n", " inverseDateObj.getFullYear() === dateObj.getFullYear();\n", " }\n", " };\n", " }\n", " function parseConfig() {\n", " var boolOpts = [\n", " \"wrap\",\n", " \"weekNumbers\",\n", " \"allowInput\",\n", " \"clickOpens\",\n", " \"time_24hr\",\n", " \"enableTime\",\n", " \"noCalendar\",\n", " \"altInput\",\n", " \"shorthandCurrentMonth\",\n", " \"inline\",\n", " \"static\",\n", " \"enableSeconds\",\n", " \"disableMobile\",\n", " ];\n", " var userConfig = __assign({}, instanceConfig, JSON.parse(JSON.stringify(element.dataset || {})));\n", " var formats = {};\n", " self.config.parseDate = userConfig.parseDate;\n", " self.config.formatDate = userConfig.formatDate;\n", " Object.defineProperty(self.config, \"enable\", {\n", " get: function () { return self.config._enable; },\n", " set: function (dates) {\n", " self.config._enable = parseDateRules(dates);\n", " }\n", " });\n", " Object.defineProperty(self.config, \"disable\", {\n", " get: function () { return self.config._disable; },\n", " set: function (dates) {\n", " self.config._disable = parseDateRules(dates);\n", " }\n", " });\n", " var timeMode = userConfig.mode === \"time\";\n", " if (!userConfig.dateFormat && (userConfig.enableTime || timeMode)) {\n", " var defaultDateFormat = flatpickr.defaultConfig.dateFormat || defaults.dateFormat;\n", " formats.dateFormat =\n", " userConfig.noCalendar || timeMode\n", " ? \"H:i\" + (userConfig.enableSeconds ? \":S\" : \"\")\n", " : defaultDateFormat + \" H:i\" + (userConfig.enableSeconds ? \":S\" : \"\");\n", " }\n", " if (userConfig.altInput &&\n", " (userConfig.enableTime || timeMode) &&\n", " !userConfig.altFormat) {\n", " var defaultAltFormat = flatpickr.defaultConfig.altFormat || defaults.altFormat;\n", " formats.altFormat =\n", " userConfig.noCalendar || timeMode\n", " ? \"h:i\" + (userConfig.enableSeconds ? \":S K\" : \" K\")\n", " : defaultAltFormat + (\" h:i\" + (userConfig.enableSeconds ? \":S\" : \"\") + \" K\");\n", " }\n", " if (!userConfig.altInputClass) {\n", " self.config.altInputClass =\n", " self.input.className + \" \" + self.config.altInputClass;\n", " }\n", " Object.defineProperty(self.config, \"minDate\", {\n", " get: function () { return self.config._minDate; },\n", " set: minMaxDateSetter(\"min\")\n", " });\n", " Object.defineProperty(self.config, \"maxDate\", {\n", " get: function () { return self.config._maxDate; },\n", " set: minMaxDateSetter(\"max\")\n", " });\n", " var minMaxTimeSetter = function (type) {\n", " return function (val) {\n", " self.config[type === \"min\" ? \"_minTime\" : \"_maxTime\"] = self.parseDate(val, \"H:i:S\");\n", " };\n", " };\n", " Object.defineProperty(self.config, \"minTime\", {\n", " get: function () { return self.config._minTime; },\n", " set: minMaxTimeSetter(\"min\")\n", " });\n", " Object.defineProperty(self.config, \"maxTime\", {\n", " get: function () { return self.config._maxTime; },\n", " set: minMaxTimeSetter(\"max\")\n", " });\n", " if (userConfig.mode === \"time\") {\n", " self.config.noCalendar = true;\n", " self.config.enableTime = true;\n", " }\n", " Object.assign(self.config, formats, userConfig);\n", " for (var i = 0; i < boolOpts.length; i++)\n", " self.config[boolOpts[i]] =\n", " self.config[boolOpts[i]] === true ||\n", " self.config[boolOpts[i]] === \"true\";\n", " HOOKS.filter(function (hook) { return self.config[hook] !== undefined; }).forEach(function (hook) {\n", " self.config[hook] = arrayify(self.config[hook] || []).map(bindToInstance);\n", " });\n", " self.isMobile =\n", " !self.config.disableMobile &&\n", " !self.config.inline &&\n", " self.config.mode === \"single\" &&\n", " !self.config.disable.length &&\n", " !self.config.enable.length &&\n", " !self.config.weekNumbers &&\n", " /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);\n", " for (var i = 0; i < self.config.plugins.length; i++) {\n", " var pluginConf = self.config.plugins[i](self) || {};\n", " for (var key in pluginConf) {\n", " if (HOOKS.indexOf(key) > -1) {\n", " self.config[key] = arrayify(pluginConf[key])\n", " .map(bindToInstance)\n", " .concat(self.config[key]);\n", " }\n", " else if (typeof userConfig[key] === \"undefined\")\n", " self.config[key] = pluginConf[key];\n", " }\n", " }\n", " triggerEvent(\"onParseConfig\");\n", " }\n", " function setupLocale() {\n", " if (typeof self.config.locale !== \"object\" &&\n", " typeof flatpickr.l10ns[self.config.locale] === \"undefined\")\n", " self.config.errorHandler(new Error(\"flatpickr: invalid locale \" + self.config.locale));\n", " self.l10n = __assign({}, flatpickr.l10ns[\"default\"], (typeof self.config.locale === \"object\"\n", " ? self.config.locale\n", " : self.config.locale !== \"default\"\n", " ? flatpickr.l10ns[self.config.locale]\n", " : undefined));\n", " tokenRegex.K = \"(\" + self.l10n.amPM[0] + \"|\" + self.l10n.amPM[1] + \"|\" + self.l10n.amPM[0].toLowerCase() + \"|\" + self.l10n.amPM[1].toLowerCase() + \")\";\n", " var userConfig = __assign({}, instanceConfig, JSON.parse(JSON.stringify(element.dataset || {})));\n", " if (userConfig.time_24hr === undefined &&\n", " flatpickr.defaultConfig.time_24hr === undefined) {\n", " self.config.time_24hr = self.l10n.time_24hr;\n", " }\n", " self.formatDate = createDateFormatter(self);\n", " self.parseDate = createDateParser({ config: self.config, l10n: self.l10n });\n", " }\n", " function positionCalendar(customPositionElement) {\n", " if (self.calendarContainer === undefined)\n", " return;\n", " triggerEvent(\"onPreCalendarPosition\");\n", " var positionElement = customPositionElement || self._positionElement;\n", " var calendarHeight = Array.prototype.reduce.call(self.calendarContainer.children, (function (acc, child) { return acc + child.offsetHeight; }), 0), calendarWidth = self.calendarContainer.offsetWidth, configPos = self.config.position.split(\" \"), configPosVertical = configPos[0], configPosHorizontal = configPos.length > 1 ? configPos[1] : null, inputBounds = positionElement.getBoundingClientRect(), distanceFromBottom = window.innerHeight - inputBounds.bottom, showOnTop = configPosVertical === \"above\" ||\n", " (configPosVertical !== \"below\" &&\n", " distanceFromBottom < calendarHeight &&\n", " inputBounds.top > calendarHeight);\n", " var top = window.pageYOffset +\n", " inputBounds.top +\n", " (!showOnTop ? positionElement.offsetHeight + 2 : -calendarHeight - 2);\n", " toggleClass(self.calendarContainer, \"arrowTop\", !showOnTop);\n", " toggleClass(self.calendarContainer, \"arrowBottom\", showOnTop);\n", " if (self.config.inline)\n", " return;\n", " var left = window.pageXOffset +\n", " inputBounds.left -\n", " (configPosHorizontal != null && configPosHorizontal === \"center\"\n", " ? (calendarWidth - inputBounds.width) / 2\n", " : 0);\n", " var right = window.document.body.offsetWidth - (window.pageXOffset + inputBounds.right);\n", " var rightMost = left + calendarWidth > window.document.body.offsetWidth;\n", " var centerMost = right + calendarWidth > window.document.body.offsetWidth;\n", " toggleClass(self.calendarContainer, \"rightMost\", rightMost);\n", " if (self.config.static)\n", " return;\n", " self.calendarContainer.style.top = top + \"px\";\n", " if (!rightMost) {\n", " self.calendarContainer.style.left = left + \"px\";\n", " self.calendarContainer.style.right = \"auto\";\n", " }\n", " else if (!centerMost) {\n", " self.calendarContainer.style.left = \"auto\";\n", " self.calendarContainer.style.right = right + \"px\";\n", " }\n", " else {\n", " var doc = document.styleSheets[0];\n", " // some testing environments don't have css support\n", " if (doc === undefined)\n", " return;\n", " var bodyWidth = window.document.body.offsetWidth;\n", " var centerLeft = Math.max(0, bodyWidth / 2 - calendarWidth / 2);\n", " var centerBefore = \".flatpickr-calendar.centerMost:before\";\n", " var centerAfter = \".flatpickr-calendar.centerMost:after\";\n", " var centerIndex = doc.cssRules.length;\n", " var centerStyle = \"{left:\" + inputBounds.left + \"px;right:auto;}\";\n", " toggleClass(self.calendarContainer, \"rightMost\", false);\n", " toggleClass(self.calendarContainer, \"centerMost\", true);\n", " doc.insertRule(centerBefore + \",\" + centerAfter + centerStyle, centerIndex);\n", " self.calendarContainer.style.left = centerLeft + \"px\";\n", " self.calendarContainer.style.right = \"auto\";\n", " }\n", " }\n", " function redraw() {\n", " if (self.config.noCalendar || self.isMobile)\n", " return;\n", " updateNavigationCurrentMonth();\n", " buildDays();\n", " }\n", " function focusAndClose() {\n", " self._input.focus();\n", " if (window.navigator.userAgent.indexOf(\"MSIE\") !== -1 ||\n", " navigator.msMaxTouchPoints !== undefined) {\n", " // hack - bugs in the way IE handles focus keeps the calendar open\n", " setTimeout(self.close, 0);\n", " }\n", " else {\n", " self.close();\n", " }\n", " }\n", " function selectDate(e) {\n", " e.preventDefault();\n", " e.stopPropagation();\n", " var isSelectable = function (day) {\n", " return day.classList &&\n", " day.classList.contains(\"flatpickr-day\") &&\n", " !day.classList.contains(\"flatpickr-disabled\") &&\n", " !day.classList.contains(\"notAllowed\");\n", " };\n", " var t = findParent(e.target, isSelectable);\n", " if (t === undefined)\n", " return;\n", " var target = t;\n", " var selectedDate = (self.latestSelectedDateObj = new Date(target.dateObj.getTime()));\n", " var shouldChangeMonth = (selectedDate.getMonth() < self.currentMonth ||\n", " selectedDate.getMonth() >\n", " self.currentMonth + self.config.showMonths - 1) &&\n", " self.config.mode !== \"range\";\n", " self.selectedDateElem = target;\n", " if (self.config.mode === \"single\")\n", " self.selectedDates = [selectedDate];\n", " else if (self.config.mode === \"multiple\") {\n", " var selectedIndex = isDateSelected(selectedDate);\n", " if (selectedIndex)\n", " self.selectedDates.splice(parseInt(selectedIndex), 1);\n", " else\n", " self.selectedDates.push(selectedDate);\n", " }\n", " else if (self.config.mode === \"range\") {\n", " if (self.selectedDates.length === 2) {\n", " self.clear(false, false);\n", " }\n", " self.latestSelectedDateObj = selectedDate;\n", " self.selectedDates.push(selectedDate);\n", " // unless selecting same date twice, sort ascendingly\n", " if (compareDates(selectedDate, self.selectedDates[0], true) !== 0)\n", " self.selectedDates.sort(function (a, b) { return a.getTime() - b.getTime(); });\n", " }\n", " setHoursFromInputs();\n", " if (shouldChangeMonth) {\n", " var isNewYear = self.currentYear !== selectedDate.getFullYear();\n", " self.currentYear = selectedDate.getFullYear();\n", " self.currentMonth = selectedDate.getMonth();\n", " if (isNewYear) {\n", " triggerEvent(\"onYearChange\");\n", " buildMonthSwitch();\n", " }\n", " triggerEvent(\"onMonthChange\");\n", " }\n", " updateNavigationCurrentMonth();\n", " buildDays();\n", " updateValue();\n", " if (self.config.enableTime)\n", " setTimeout(function () { return (self.showTimeInput = true); }, 50);\n", " // maintain focus\n", " if (!shouldChangeMonth &&\n", " self.config.mode !== \"range\" &&\n", " self.config.showMonths === 1)\n", " focusOnDayElem(target);\n", " else if (self.selectedDateElem !== undefined &&\n", " self.hourElement === undefined) {\n", " self.selectedDateElem && self.selectedDateElem.focus();\n", " }\n", " if (self.hourElement !== undefined)\n", " self.hourElement !== undefined && self.hourElement.focus();\n", " if (self.config.closeOnSelect) {\n", " var single = self.config.mode === \"single\" && !self.config.enableTime;\n", " var range = self.config.mode === \"range\" &&\n", " self.selectedDates.length === 2 &&\n", " !self.config.enableTime;\n", " if (single || range) {\n", " focusAndClose();\n", " }\n", " }\n", " triggerChange();\n", " }\n", " var CALLBACKS = {\n", " locale: [setupLocale, updateWeekdays],\n", " showMonths: [buildMonths, setCalendarWidth, buildWeekdays],\n", " minDate: [jumpToDate],\n", " maxDate: [jumpToDate]\n", " };\n", " function set(option, value) {\n", " if (option !== null && typeof option === \"object\") {\n", " Object.assign(self.config, option);\n", " for (var key in option) {\n", " if (CALLBACKS[key] !== undefined)\n", " CALLBACKS[key].forEach(function (x) { return x(); });\n", " }\n", " }\n", " else {\n", " self.config[option] = value;\n", " if (CALLBACKS[option] !== undefined)\n", " CALLBACKS[option].forEach(function (x) { return x(); });\n", " else if (HOOKS.indexOf(option) > -1)\n", " self.config[option] = arrayify(value);\n", " }\n", " self.redraw();\n", " updateValue(false);\n", " }\n", " function setSelectedDate(inputDate, format) {\n", " var dates = [];\n", " if (inputDate instanceof Array)\n", " dates = inputDate.map(function (d) { return self.parseDate(d, format); });\n", " else if (inputDate instanceof Date || typeof inputDate === \"number\")\n", " dates = [self.parseDate(inputDate, format)];\n", " else if (typeof inputDate === \"string\") {\n", " switch (self.config.mode) {\n", " case \"single\":\n", " case \"time\":\n", " dates = [self.parseDate(inputDate, format)];\n", " break;\n", " case \"multiple\":\n", " dates = inputDate\n", " .split(self.config.conjunction)\n", " .map(function (date) { return self.parseDate(date, format); });\n", " break;\n", " case \"range\":\n", " dates = inputDate\n", " .split(self.l10n.rangeSeparator)\n", " .map(function (date) { return self.parseDate(date, format); });\n", " break;\n", " default:\n", " break;\n", " }\n", " }\n", " else\n", " self.config.errorHandler(new Error(\"Invalid date supplied: \" + JSON.stringify(inputDate)));\n", " self.selectedDates = dates.filter(function (d) { return d instanceof Date && isEnabled(d, false); });\n", " if (self.config.mode === \"range\")\n", " self.selectedDates.sort(function (a, b) { return a.getTime() - b.getTime(); });\n", " }\n", " function setDate(date, triggerChange, format) {\n", " if (triggerChange === void 0) {\n", " triggerChange = false;\n", " }\n", " if (format === void 0) {\n", " format = self.config.dateFormat;\n", " }\n", " if ((date !== 0 && !date) || (date instanceof Array && date.length === 0))\n", " return self.clear(triggerChange);\n", " setSelectedDate(date, format);\n", " self.showTimeInput = self.selectedDates.length > 0;\n", " self.latestSelectedDateObj =\n", " self.selectedDates[self.selectedDates.length - 1];\n", " self.redraw();\n", " jumpToDate();\n", " setHoursFromDate();\n", " if (self.selectedDates.length === 0) {\n", " self.clear(false);\n", " }\n", " updateValue(triggerChange);\n", " if (triggerChange)\n", " triggerEvent(\"onChange\");\n", " }\n", " function parseDateRules(arr) {\n", " return arr\n", " .slice()\n", " .map(function (rule) {\n", " if (typeof rule === \"string\" ||\n", " typeof rule === \"number\" ||\n", " rule instanceof Date) {\n", " return self.parseDate(rule, undefined, true);\n", " }\n", " else if (rule &&\n", " typeof rule === \"object\" &&\n", " rule.from &&\n", " rule.to)\n", " return {\n", " from: self.parseDate(rule.from, undefined),\n", " to: self.parseDate(rule.to, undefined)\n", " };\n", " return rule;\n", " })\n", " .filter(function (x) { return x; }); // remove falsy values\n", " }\n", " function setupDates() {\n", " self.selectedDates = [];\n", " self.now = self.parseDate(self.config.now) || new Date();\n", " // Workaround IE11 setting placeholder as the input's value\n", " var preloadedDate = self.config.defaultDate ||\n", " ((self.input.nodeName === \"INPUT\" ||\n", " self.input.nodeName === \"TEXTAREA\") &&\n", " self.input.placeholder &&\n", " self.input.value === self.input.placeholder\n", " ? null\n", " : self.input.value);\n", " if (preloadedDate)\n", " setSelectedDate(preloadedDate, self.config.dateFormat);\n", " self._initialDate =\n", " self.selectedDates.length > 0\n", " ? self.selectedDates[0]\n", " : self.config.minDate &&\n", " self.config.minDate.getTime() > self.now.getTime()\n", " ? self.config.minDate\n", " : self.config.maxDate &&\n", " self.config.maxDate.getTime() < self.now.getTime()\n", " ? self.config.maxDate\n", " : self.now;\n", " self.currentYear = self._initialDate.getFullYear();\n", " self.currentMonth = self._initialDate.getMonth();\n", " if (self.selectedDates.length > 0)\n", " self.latestSelectedDateObj = self.selectedDates[0];\n", " if (self.config.minTime !== undefined)\n", " self.config.minTime = self.parseDate(self.config.minTime, \"H:i\");\n", " if (self.config.maxTime !== undefined)\n", " self.config.maxTime = self.parseDate(self.config.maxTime, \"H:i\");\n", " self.minDateHasTime =\n", " !!self.config.minDate &&\n", " (self.config.minDate.getHours() > 0 ||\n", " self.config.minDate.getMinutes() > 0 ||\n", " self.config.minDate.getSeconds() > 0);\n", " self.maxDateHasTime =\n", " !!self.config.maxDate &&\n", " (self.config.maxDate.getHours() > 0 ||\n", " self.config.maxDate.getMinutes() > 0 ||\n", " self.config.maxDate.getSeconds() > 0);\n", " Object.defineProperty(self, \"showTimeInput\", {\n", " get: function () { return self._showTimeInput; },\n", " set: function (bool) {\n", " self._showTimeInput = bool;\n", " if (self.calendarContainer)\n", " toggleClass(self.calendarContainer, \"showTimeInput\", bool);\n", " self.isOpen && positionCalendar();\n", " }\n", " });\n", " }\n", " function setupInputs() {\n", " self.input = self.config.wrap\n", " ? element.querySelector(\"[data-input]\")\n", " : element;\n", " /* istanbul ignore next */\n", " if (!self.input) {\n", " self.config.errorHandler(new Error(\"Invalid input element specified\"));\n", " return;\n", " }\n", " // hack: store previous type to restore it after destroy()\n", " self.input._type = self.input.type;\n", " self.input.type = \"text\";\n", " self.input.classList.add(\"flatpickr-input\");\n", " self._input = self.input;\n", " if (self.config.altInput) {\n", " // replicate self.element\n", " self.altInput = createElement(self.input.nodeName, self.config.altInputClass);\n", " self._input = self.altInput;\n", " self.altInput.placeholder = self.input.placeholder;\n", " self.altInput.disabled = self.input.disabled;\n", " self.altInput.required = self.input.required;\n", " self.altInput.tabIndex = self.input.tabIndex;\n", " self.altInput.type = \"text\";\n", " self.input.setAttribute(\"type\", \"hidden\");\n", " if (!self.config.static && self.input.parentNode)\n", " self.input.parentNode.insertBefore(self.altInput, self.input.nextSibling);\n", " }\n", " if (!self.config.allowInput)\n", " self._input.setAttribute(\"readonly\", \"readonly\");\n", " self._positionElement = self.config.positionElement || self._input;\n", " }\n", " function setupMobile() {\n", " var inputType = self.config.enableTime\n", " ? self.config.noCalendar\n", " ? \"time\"\n", " : \"datetime-local\"\n", " : \"date\";\n", " self.mobileInput = createElement(\"input\", self.input.className + \" flatpickr-mobile\");\n", " self.mobileInput.step = self.input.getAttribute(\"step\") || \"any\";\n", " self.mobileInput.tabIndex = 1;\n", " self.mobileInput.type = inputType;\n", " self.mobileInput.disabled = self.input.disabled;\n", " self.mobileInput.required = self.input.required;\n", " self.mobileInput.placeholder = self.input.placeholder;\n", " self.mobileFormatStr =\n", " inputType === \"datetime-local\"\n", " ? \"Y-m-d\\\\TH:i:S\"\n", " : inputType === \"date\"\n", " ? \"Y-m-d\"\n", " : \"H:i:S\";\n", " if (self.selectedDates.length > 0) {\n", " self.mobileInput.defaultValue = self.mobileInput.value = self.formatDate(self.selectedDates[0], self.mobileFormatStr);\n", " }\n", " if (self.config.minDate)\n", " self.mobileInput.min = self.formatDate(self.config.minDate, \"Y-m-d\");\n", " if (self.config.maxDate)\n", " self.mobileInput.max = self.formatDate(self.config.maxDate, \"Y-m-d\");\n", " self.input.type = \"hidden\";\n", " if (self.altInput !== undefined)\n", " self.altInput.type = \"hidden\";\n", " try {\n", " if (self.input.parentNode)\n", " self.input.parentNode.insertBefore(self.mobileInput, self.input.nextSibling);\n", " }\n", " catch (_a) { }\n", " bind(self.mobileInput, \"change\", function (e) {\n", " self.setDate(e.target.value, false, self.mobileFormatStr);\n", " triggerEvent(\"onChange\");\n", " triggerEvent(\"onClose\");\n", " });\n", " }\n", " function toggle(e) {\n", " if (self.isOpen === true)\n", " return self.close();\n", " self.open(e);\n", " }\n", " function triggerEvent(event, data) {\n", " // If the instance has been destroyed already, all hooks have been removed\n", " if (self.config === undefined)\n", " return;\n", " var hooks = self.config[event];\n", " if (hooks !== undefined && hooks.length > 0) {\n", " for (var i = 0; hooks[i] && i < hooks.length; i++)\n", " hooks[i](self.selectedDates, self.input.value, self, data);\n", " }\n", " if (event === \"onChange\") {\n", " self.input.dispatchEvent(createEvent(\"change\"));\n", " // many front-end frameworks bind to the input event\n", " self.input.dispatchEvent(createEvent(\"input\"));\n", " }\n", " }\n", " function createEvent(name) {\n", " var e = document.createEvent(\"Event\");\n", " e.initEvent(name, true, true);\n", " return e;\n", " }\n", " function isDateSelected(date) {\n", " for (var i = 0; i < self.selectedDates.length; i++) {\n", " if (compareDates(self.selectedDates[i], date) === 0)\n", " return \"\" + i;\n", " }\n", " return false;\n", " }\n", " function isDateInRange(date) {\n", " if (self.config.mode !== \"range\" || self.selectedDates.length < 2)\n", " return false;\n", " return (compareDates(date, self.selectedDates[0]) >= 0 &&\n", " compareDates(date, self.selectedDates[1]) <= 0);\n", " }\n", " function updateNavigationCurrentMonth() {\n", " if (self.config.noCalendar || self.isMobile || !self.monthNav)\n", " return;\n", " self.yearElements.forEach(function (yearElement, i) {\n", " var d = new Date(self.currentYear, self.currentMonth, 1);\n", " d.setMonth(self.currentMonth + i);\n", " if (self.config.showMonths > 1 ||\n", " self.config.monthSelectorType === \"static\") {\n", " self.monthElements[i].textContent =\n", " monthToStr(d.getMonth(), self.config.shorthandCurrentMonth, self.l10n) + \" \";\n", " }\n", " else {\n", " self.monthsDropdownContainer.value = d.getMonth().toString();\n", " }\n", " yearElement.value = d.getFullYear().toString();\n", " });\n", " self._hidePrevMonthArrow =\n", " self.config.minDate !== undefined &&\n", " (self.currentYear === self.config.minDate.getFullYear()\n", " ? self.currentMonth <= self.config.minDate.getMonth()\n", " : self.currentYear < self.config.minDate.getFullYear());\n", " self._hideNextMonthArrow =\n", " self.config.maxDate !== undefined &&\n", " (self.currentYear === self.config.maxDate.getFullYear()\n", " ? self.currentMonth + 1 > self.config.maxDate.getMonth()\n", " : self.currentYear > self.config.maxDate.getFullYear());\n", " }\n", " function getDateStr(format) {\n", " return self.selectedDates\n", " .map(function (dObj) { return self.formatDate(dObj, format); })\n", " .filter(function (d, i, arr) {\n", " return self.config.mode !== \"range\" ||\n", " self.config.enableTime ||\n", " arr.indexOf(d) === i;\n", " })\n", " .join(self.config.mode !== \"range\"\n", " ? self.config.conjunction\n", " : self.l10n.rangeSeparator);\n", " }\n", " /**\n", " * Updates the values of inputs associated with the calendar\n", " */\n", " function updateValue(triggerChange) {\n", " if (triggerChange === void 0) {\n", " triggerChange = true;\n", " }\n", " if (self.mobileInput !== undefined && self.mobileFormatStr) {\n", " self.mobileInput.value =\n", " self.latestSelectedDateObj !== undefined\n", " ? self.formatDate(self.latestSelectedDateObj, self.mobileFormatStr)\n", " : \"\";\n", " }\n", " self.input.value = getDateStr(self.config.dateFormat);\n", " if (self.altInput !== undefined) {\n", " self.altInput.value = getDateStr(self.config.altFormat);\n", " }\n", " if (triggerChange !== false)\n", " triggerEvent(\"onValueUpdate\");\n", " }\n", " function onMonthNavClick(e) {\n", " var isPrevMonth = self.prevMonthNav.contains(e.target);\n", " var isNextMonth = self.nextMonthNav.contains(e.target);\n", " if (isPrevMonth || isNextMonth) {\n", " changeMonth(isPrevMonth ? -1 : 1);\n", " }\n", " else if (self.yearElements.indexOf(e.target) >= 0) {\n", " e.target.select();\n", " }\n", " else if (e.target.classList.contains(\"arrowUp\")) {\n", " self.changeYear(self.currentYear + 1);\n", " }\n", " else if (e.target.classList.contains(\"arrowDown\")) {\n", " self.changeYear(self.currentYear - 1);\n", " }\n", " }\n", " function timeWrapper(e) {\n", " e.preventDefault();\n", " var isKeyDown = e.type === \"keydown\", input = e.target;\n", " if (self.amPM !== undefined && e.target === self.amPM) {\n", " self.amPM.textContent =\n", " self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])];\n", " }\n", " var min = parseFloat(input.getAttribute(\"min\")), max = parseFloat(input.getAttribute(\"max\")), step = parseFloat(input.getAttribute(\"step\")), curValue = parseInt(input.value, 10), delta = e.delta ||\n", " (isKeyDown ? (e.which === 38 ? 1 : -1) : 0);\n", " var newValue = curValue + step * delta;\n", " if (typeof input.value !== \"undefined\" && input.value.length === 2) {\n", " var isHourElem = input === self.hourElement, isMinuteElem = input === self.minuteElement;\n", " if (newValue < min) {\n", " newValue =\n", " max +\n", " newValue +\n", " int(!isHourElem) +\n", " (int(isHourElem) && int(!self.amPM));\n", " if (isMinuteElem)\n", " incrementNumInput(undefined, -1, self.hourElement);\n", " }\n", " else if (newValue > max) {\n", " newValue =\n", " input === self.hourElement ? newValue - max - int(!self.amPM) : min;\n", " if (isMinuteElem)\n", " incrementNumInput(undefined, 1, self.hourElement);\n", " }\n", " if (self.amPM &&\n", " isHourElem &&\n", " (step === 1\n", " ? newValue + curValue === 23\n", " : Math.abs(newValue - curValue) > step)) {\n", " self.amPM.textContent =\n", " self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])];\n", " }\n", " input.value = pad(newValue);\n", " }\n", " }\n", " init();\n", " return self;\n", " }\n", " /* istanbul ignore next */\n", " function _flatpickr(nodeList, config) {\n", " // static list\n", " var nodes = Array.prototype.slice\n", " .call(nodeList)\n", " .filter(function (x) { return x instanceof HTMLElement; });\n", " var instances = [];\n", " for (var i = 0; i < nodes.length; i++) {\n", " var node = nodes[i];\n", " try {\n", " if (node.getAttribute(\"data-fp-omit\") !== null)\n", " continue;\n", " if (node._flatpickr !== undefined) {\n", " node._flatpickr.destroy();\n", " node._flatpickr = undefined;\n", " }\n", " node._flatpickr = FlatpickrInstance(node, config || {});\n", " instances.push(node._flatpickr);\n", " }\n", " catch (e) {\n", " console.error(e);\n", " }\n", " }\n", " return instances.length === 1 ? instances[0] : instances;\n", " }\n", " /* istanbul ignore next */\n", " if (typeof HTMLElement !== \"undefined\" &&\n", " typeof HTMLCollection !== \"undefined\" &&\n", " typeof NodeList !== \"undefined\") {\n", " // browser env\n", " HTMLCollection.prototype.flatpickr = NodeList.prototype.flatpickr = function (config) {\n", " return _flatpickr(this, config);\n", " };\n", " HTMLElement.prototype.flatpickr = function (config) {\n", " return _flatpickr([this], config);\n", " };\n", " }\n", " /* istanbul ignore next */\n", " var flatpickr = function (selector, config) {\n", " if (typeof selector === \"string\") {\n", " return _flatpickr(window.document.querySelectorAll(selector), config);\n", " }\n", " else if (selector instanceof Node) {\n", " return _flatpickr([selector], config);\n", " }\n", " else {\n", " return _flatpickr(selector, config);\n", " }\n", " };\n", " /* istanbul ignore next */\n", " flatpickr.defaultConfig = {};\n", " flatpickr.l10ns = {\n", " en: __assign({}, english),\n", " \"default\": __assign({}, english)\n", " };\n", " flatpickr.localize = function (l10n) {\n", " flatpickr.l10ns[\"default\"] = __assign({}, flatpickr.l10ns[\"default\"], l10n);\n", " };\n", " flatpickr.setDefaults = function (config) {\n", " flatpickr.defaultConfig = __assign({}, flatpickr.defaultConfig, config);\n", " };\n", " flatpickr.parseDate = createDateParser({});\n", " flatpickr.formatDate = createDateFormatter({});\n", " flatpickr.compareDates = compareDates;\n", " /* istanbul ignore next */\n", " if (typeof jQuery !== \"undefined\" && typeof jQuery.fn !== \"undefined\") {\n", " jQuery.fn.flatpickr = function (config) {\n", " return _flatpickr(this, config);\n", " };\n", " }\n", " // eslint-disable-next-line @typescript-eslint/camelcase\n", " Date.prototype.fp_incr = function (days) {\n", " return new Date(this.getFullYear(), this.getMonth(), this.getDate() + (typeof days === \"string\" ? parseInt(days, 10) : days));\n", " };\n", " if (typeof window !== \"undefined\") {\n", " window.flatpickr = flatpickr;\n", " }\n", " return flatpickr;\n", " }));\n", " },\n", " 409: /* styles/widgets/flatpickr.css.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const css = `\n", " .flatpickr-calendar {\n", " background: transparent;\n", " opacity: 0;\n", " display: none;\n", " text-align: center;\n", " visibility: hidden;\n", " padding: 0;\n", " -webkit-animation: none;\n", " animation: none;\n", " direction: ltr;\n", " border: 0;\n", " font-size: 14px;\n", " line-height: 24px;\n", " border-radius: 5px;\n", " position: absolute;\n", " width: 307.875px;\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " -ms-touch-action: manipulation;\n", " touch-action: manipulation;\n", " background: #fff;\n", " -webkit-box-shadow: 1px 0 0 #e6e6e6, -1px 0 0 #e6e6e6, 0 1px 0 #e6e6e6, 0 -1px 0 #e6e6e6, 0 3px 13px rgba(0, 0, 0, 0.08);\n", " box-shadow: 1px 0 0 #e6e6e6, -1px 0 0 #e6e6e6, 0 1px 0 #e6e6e6, 0 -1px 0 #e6e6e6, 0 3px 13px rgba(0, 0, 0, 0.08);\n", " }\n", " .flatpickr-calendar.open,\n", " .flatpickr-calendar.inline {\n", " opacity: 1;\n", " max-height: 640px;\n", " visibility: visible;\n", " }\n", " .flatpickr-calendar.open {\n", " display: inline-block;\n", " z-index: 99999;\n", " }\n", " .flatpickr-calendar.animate.open {\n", " -webkit-animation: fpFadeInDown 300ms cubic-bezier(0.23, 1, 0.32, 1);\n", " animation: fpFadeInDown 300ms cubic-bezier(0.23, 1, 0.32, 1);\n", " }\n", " .flatpickr-calendar.inline {\n", " display: block;\n", " position: relative;\n", " top: 2px;\n", " }\n", " .flatpickr-calendar.static {\n", " position: absolute;\n", " top: calc(100% + 2px);\n", " }\n", " .flatpickr-calendar.static.open {\n", " z-index: 999;\n", " display: block;\n", " }\n", " .flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+1) .flatpickr-day.inRange:nth-child(7n+7) {\n", " -webkit-box-shadow: none !important;\n", " box-shadow: none !important;\n", " }\n", " .flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+2) .flatpickr-day.inRange:nth-child(7n+1) {\n", " -webkit-box-shadow: -2px 0 0 #e6e6e6, 5px 0 0 #e6e6e6;\n", " box-shadow: -2px 0 0 #e6e6e6, 5px 0 0 #e6e6e6;\n", " }\n", " .flatpickr-calendar .hasWeeks .dayContainer,\n", " .flatpickr-calendar .hasTime .dayContainer {\n", " border-bottom: 0;\n", " border-bottom-right-radius: 0;\n", " border-bottom-left-radius: 0;\n", " }\n", " .flatpickr-calendar .hasWeeks .dayContainer {\n", " border-left: 0;\n", " }\n", " .flatpickr-calendar.showTimeInput.hasTime .flatpickr-time {\n", " height: 40px;\n", " border-top: 1px solid #e6e6e6;\n", " }\n", " .flatpickr-calendar.noCalendar.hasTime .flatpickr-time {\n", " height: auto;\n", " }\n", " .flatpickr-calendar:before,\n", " .flatpickr-calendar:after {\n", " position: absolute;\n", " display: block;\n", " pointer-events: none;\n", " border: solid transparent;\n", " content: '';\n", " height: 0;\n", " width: 0;\n", " left: 22px;\n", " }\n", " .flatpickr-calendar.rightMost:before,\n", " .flatpickr-calendar.rightMost:after {\n", " left: auto;\n", " right: 22px;\n", " }\n", " .flatpickr-calendar:before {\n", " border-width: 5px;\n", " margin: 0 -5px;\n", " }\n", " .flatpickr-calendar:after {\n", " border-width: 4px;\n", " margin: 0 -4px;\n", " }\n", " .flatpickr-calendar.arrowTop:before,\n", " .flatpickr-calendar.arrowTop:after {\n", " bottom: 100%;\n", " }\n", " .flatpickr-calendar.arrowTop:before {\n", " border-bottom-color: #e6e6e6;\n", " }\n", " .flatpickr-calendar.arrowTop:after {\n", " border-bottom-color: #fff;\n", " }\n", " .flatpickr-calendar.arrowBottom:before,\n", " .flatpickr-calendar.arrowBottom:after {\n", " top: 100%;\n", " }\n", " .flatpickr-calendar.arrowBottom:before {\n", " border-top-color: #e6e6e6;\n", " }\n", " .flatpickr-calendar.arrowBottom:after {\n", " border-top-color: #fff;\n", " }\n", " .flatpickr-calendar:focus {\n", " outline: 0;\n", " }\n", " .flatpickr-wrapper {\n", " position: relative;\n", " display: inline-block;\n", " }\n", " .flatpickr-months {\n", " display: -webkit-box;\n", " display: -webkit-flex;\n", " display: -ms-flexbox;\n", " display: flex;\n", " }\n", " .flatpickr-months .flatpickr-month {\n", " background: transparent;\n", " color: rgba(0, 0, 0, 0.9);\n", " fill: rgba(0, 0, 0, 0.9);\n", " height: 34px;\n", " line-height: 1;\n", " text-align: center;\n", " position: relative;\n", " -webkit-user-select: none;\n", " -moz-user-select: none;\n", " -ms-user-select: none;\n", " user-select: none;\n", " overflow: hidden;\n", " -webkit-box-flex: 1;\n", " -webkit-flex: 1;\n", " -ms-flex: 1;\n", " flex: 1;\n", " }\n", " .flatpickr-months .flatpickr-prev-month,\n", " .flatpickr-months .flatpickr-next-month {\n", " text-decoration: none;\n", " cursor: pointer;\n", " position: absolute;\n", " top: 0;\n", " height: 34px;\n", " padding: 10px;\n", " z-index: 3;\n", " color: rgba(0, 0, 0, 0.9);\n", " fill: rgba(0, 0, 0, 0.9);\n", " }\n", " .flatpickr-months .flatpickr-prev-month.flatpickr-disabled,\n", " .flatpickr-months .flatpickr-next-month.flatpickr-disabled {\n", " display: none;\n", " }\n", " .flatpickr-months .flatpickr-prev-month i,\n", " .flatpickr-months .flatpickr-next-month i {\n", " position: relative;\n", " }\n", " .flatpickr-months .flatpickr-prev-month.flatpickr-prev-month,\n", " .flatpickr-months .flatpickr-next-month.flatpickr-prev-month {\n", " /*\n", " /*rtl:begin:ignore*/\n", " /*\n", " */\n", " left: 0;\n", " /*\n", " /*rtl:end:ignore*/\n", " /*\n", " */\n", " }\n", " /*\n", " /*rtl:begin:ignore*/\n", " /*\n", " /*rtl:end:ignore*/\n", " .flatpickr-months .flatpickr-prev-month.flatpickr-next-month,\n", " .flatpickr-months .flatpickr-next-month.flatpickr-next-month {\n", " /*\n", " /*rtl:begin:ignore*/\n", " /*\n", " */\n", " right: 0;\n", " /*\n", " /*rtl:end:ignore*/\n", " /*\n", " */\n", " }\n", " /*\n", " /*rtl:begin:ignore*/\n", " /*\n", " /*rtl:end:ignore*/\n", " .flatpickr-months .flatpickr-prev-month:hover,\n", " .flatpickr-months .flatpickr-next-month:hover {\n", " color: #959ea9;\n", " }\n", " .flatpickr-months .flatpickr-prev-month:hover svg,\n", " .flatpickr-months .flatpickr-next-month:hover svg {\n", " fill: #f64747;\n", " }\n", " .flatpickr-months .flatpickr-prev-month svg,\n", " .flatpickr-months .flatpickr-next-month svg {\n", " width: 14px;\n", " height: 14px;\n", " }\n", " .flatpickr-months .flatpickr-prev-month svg path,\n", " .flatpickr-months .flatpickr-next-month svg path {\n", " -webkit-transition: fill 0.1s;\n", " transition: fill 0.1s;\n", " fill: inherit;\n", " }\n", " .numInputWrapper {\n", " position: relative;\n", " height: auto;\n", " }\n", " .numInputWrapper input,\n", " .numInputWrapper span {\n", " display: inline-block;\n", " }\n", " .numInputWrapper input {\n", " width: 100%;\n", " }\n", " .numInputWrapper input::-ms-clear {\n", " display: none;\n", " }\n", " .numInputWrapper input::-webkit-outer-spin-button,\n", " .numInputWrapper input::-webkit-inner-spin-button {\n", " margin: 0;\n", " -webkit-appearance: none;\n", " }\n", " .numInputWrapper span {\n", " position: absolute;\n", " right: 0;\n", " width: 14px;\n", " padding: 0 4px 0 2px;\n", " height: 50%;\n", " line-height: 50%;\n", " opacity: 0;\n", " cursor: pointer;\n", " border: 1px solid rgba(57, 57, 57, 0.15);\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " }\n", " .numInputWrapper span:hover {\n", " background: rgba(0, 0, 0, 0.1);\n", " }\n", " .numInputWrapper span:active {\n", " background: rgba(0, 0, 0, 0.2);\n", " }\n", " .numInputWrapper span:after {\n", " display: block;\n", " content: \"\";\n", " position: absolute;\n", " }\n", " .numInputWrapper span.arrowUp {\n", " top: 0;\n", " border-bottom: 0;\n", " }\n", " .numInputWrapper span.arrowUp:after {\n", " border-left: 4px solid transparent;\n", " border-right: 4px solid transparent;\n", " border-bottom: 4px solid rgba(57, 57, 57, 0.6);\n", " top: 26%;\n", " }\n", " .numInputWrapper span.arrowDown {\n", " top: 50%;\n", " }\n", " .numInputWrapper span.arrowDown:after {\n", " border-left: 4px solid transparent;\n", " border-right: 4px solid transparent;\n", " border-top: 4px solid rgba(57, 57, 57, 0.6);\n", " top: 40%;\n", " }\n", " .numInputWrapper span svg {\n", " width: inherit;\n", " height: auto;\n", " }\n", " .numInputWrapper span svg path {\n", " fill: rgba(0, 0, 0, 0.5);\n", " }\n", " .numInputWrapper:hover {\n", " background: rgba(0, 0, 0, 0.05);\n", " }\n", " .numInputWrapper:hover span {\n", " opacity: 1;\n", " }\n", " .flatpickr-current-month {\n", " font-size: 135%;\n", " line-height: inherit;\n", " font-weight: 300;\n", " color: inherit;\n", " position: absolute;\n", " width: 75%;\n", " left: 12.5%;\n", " padding: 7.48px 0 0 0;\n", " line-height: 1;\n", " height: 34px;\n", " display: inline-block;\n", " text-align: center;\n", " -webkit-transform: translate3d(0px, 0px, 0px);\n", " transform: translate3d(0px, 0px, 0px);\n", " }\n", " .flatpickr-current-month span.cur-month {\n", " font-family: inherit;\n", " font-weight: 700;\n", " color: inherit;\n", " display: inline-block;\n", " margin-left: 0.5ch;\n", " padding: 0;\n", " }\n", " .flatpickr-current-month span.cur-month:hover {\n", " background: rgba(0, 0, 0, 0.05);\n", " }\n", " .flatpickr-current-month .numInputWrapper {\n", " width: 6ch;\n", " width: 7ch\\0;\n", " display: inline-block;\n", " }\n", " .flatpickr-current-month .numInputWrapper span.arrowUp:after {\n", " border-bottom-color: rgba(0, 0, 0, 0.9);\n", " }\n", " .flatpickr-current-month .numInputWrapper span.arrowDown:after {\n", " border-top-color: rgba(0, 0, 0, 0.9);\n", " }\n", " .flatpickr-current-month input.cur-year {\n", " background: transparent;\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " color: inherit;\n", " cursor: text;\n", " padding: 0 0 0 0.5ch;\n", " margin: 0;\n", " display: inline-block;\n", " font-size: inherit;\n", " font-family: inherit;\n", " font-weight: 300;\n", " line-height: inherit;\n", " height: auto;\n", " border: 0;\n", " border-radius: 0;\n", " vertical-align: initial;\n", " -webkit-appearance: textfield;\n", " -moz-appearance: textfield;\n", " appearance: textfield;\n", " }\n", " .flatpickr-current-month input.cur-year:focus {\n", " outline: 0;\n", " }\n", " .flatpickr-current-month input.cur-year[disabled],\n", " .flatpickr-current-month input.cur-year[disabled]:hover {\n", " font-size: 100%;\n", " color: rgba(0, 0, 0, 0.5);\n", " background: transparent;\n", " pointer-events: none;\n", " }\n", " .flatpickr-current-month .flatpickr-monthDropdown-months {\n", " appearance: menulist;\n", " background: transparent;\n", " border: none;\n", " border-radius: 0;\n", " box-sizing: border-box;\n", " color: inherit;\n", " cursor: pointer;\n", " font-size: inherit;\n", " font-family: inherit;\n", " font-weight: 300;\n", " height: auto;\n", " line-height: inherit;\n", " margin: -1px 0 0 0;\n", " outline: none;\n", " padding: 0 0 0 0.5ch;\n", " position: relative;\n", " vertical-align: initial;\n", " -webkit-box-sizing: border-box;\n", " -webkit-appearance: menulist;\n", " -moz-appearance: menulist;\n", " width: auto;\n", " }\n", " .flatpickr-current-month .flatpickr-monthDropdown-months:focus,\n", " .flatpickr-current-month .flatpickr-monthDropdown-months:active {\n", " outline: none;\n", " }\n", " .flatpickr-current-month .flatpickr-monthDropdown-months:hover {\n", " background: rgba(0, 0, 0, 0.05);\n", " }\n", " .flatpickr-current-month .flatpickr-monthDropdown-months .flatpickr-monthDropdown-month {\n", " background-color: transparent;\n", " outline: none;\n", " padding: 0;\n", " }\n", " .flatpickr-weekdays {\n", " background: transparent;\n", " text-align: center;\n", " overflow: hidden;\n", " width: 100%;\n", " display: -webkit-box;\n", " display: -webkit-flex;\n", " display: -ms-flexbox;\n", " display: flex;\n", " -webkit-box-align: center;\n", " -webkit-align-items: center;\n", " -ms-flex-align: center;\n", " align-items: center;\n", " height: 28px;\n", " }\n", " .flatpickr-weekdays .flatpickr-weekdaycontainer {\n", " display: -webkit-box;\n", " display: -webkit-flex;\n", " display: -ms-flexbox;\n", " display: flex;\n", " -webkit-box-flex: 1;\n", " -webkit-flex: 1;\n", " -ms-flex: 1;\n", " flex: 1;\n", " }\n", " span.flatpickr-weekday {\n", " cursor: default;\n", " font-size: 90%;\n", " background: transparent;\n", " color: rgba(0, 0, 0, 0.54);\n", " line-height: 1;\n", " margin: 0;\n", " text-align: center;\n", " display: block;\n", " -webkit-box-flex: 1;\n", " -webkit-flex: 1;\n", " -ms-flex: 1;\n", " flex: 1;\n", " font-weight: bolder;\n", " }\n", " .dayContainer,\n", " .flatpickr-weeks {\n", " padding: 1px 0 0 0;\n", " }\n", " .flatpickr-days {\n", " position: relative;\n", " overflow: hidden;\n", " display: -webkit-box;\n", " display: -webkit-flex;\n", " display: -ms-flexbox;\n", " display: flex;\n", " -webkit-box-align: start;\n", " -webkit-align-items: flex-start;\n", " -ms-flex-align: start;\n", " align-items: flex-start;\n", " width: 307.875px;\n", " }\n", " .flatpickr-days:focus {\n", " outline: 0;\n", " }\n", " .dayContainer {\n", " padding: 0;\n", " outline: 0;\n", " text-align: left;\n", " width: 307.875px;\n", " min-width: 307.875px;\n", " max-width: 307.875px;\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " display: inline-block;\n", " display: -ms-flexbox;\n", " display: -webkit-box;\n", " display: -webkit-flex;\n", " display: flex;\n", " -webkit-flex-wrap: wrap;\n", " flex-wrap: wrap;\n", " -ms-flex-wrap: wrap;\n", " -ms-flex-pack: justify;\n", " -webkit-justify-content: space-around;\n", " justify-content: space-around;\n", " -webkit-transform: translate3d(0px, 0px, 0px);\n", " transform: translate3d(0px, 0px, 0px);\n", " opacity: 1;\n", " }\n", " .dayContainer + .dayContainer {\n", " -webkit-box-shadow: -1px 0 0 #e6e6e6;\n", " box-shadow: -1px 0 0 #e6e6e6;\n", " }\n", " .flatpickr-day {\n", " background: none;\n", " border: 1px solid transparent;\n", " border-radius: 150px;\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " color: #393939;\n", " cursor: pointer;\n", " font-weight: 400;\n", " width: 14.2857143%;\n", " -webkit-flex-basis: 14.2857143%;\n", " -ms-flex-preferred-size: 14.2857143%;\n", " flex-basis: 14.2857143%;\n", " max-width: 39px;\n", " height: 39px;\n", " line-height: 39px;\n", " margin: 0;\n", " display: inline-block;\n", " position: relative;\n", " -webkit-box-pack: center;\n", " -webkit-justify-content: center;\n", " -ms-flex-pack: center;\n", " justify-content: center;\n", " text-align: center;\n", " }\n", " .flatpickr-day.inRange,\n", " .flatpickr-day.prevMonthDay.inRange,\n", " .flatpickr-day.nextMonthDay.inRange,\n", " .flatpickr-day.today.inRange,\n", " .flatpickr-day.prevMonthDay.today.inRange,\n", " .flatpickr-day.nextMonthDay.today.inRange,\n", " .flatpickr-day:hover,\n", " .flatpickr-day.prevMonthDay:hover,\n", " .flatpickr-day.nextMonthDay:hover,\n", " .flatpickr-day:focus,\n", " .flatpickr-day.prevMonthDay:focus,\n", " .flatpickr-day.nextMonthDay:focus {\n", " cursor: pointer;\n", " outline: 0;\n", " background: #e6e6e6;\n", " border-color: #e6e6e6;\n", " }\n", " .flatpickr-day.today {\n", " border-color: #959ea9;\n", " }\n", " .flatpickr-day.today:hover,\n", " .flatpickr-day.today:focus {\n", " border-color: #959ea9;\n", " background: #959ea9;\n", " color: #fff;\n", " }\n", " .flatpickr-day.selected,\n", " .flatpickr-day.startRange,\n", " .flatpickr-day.endRange,\n", " .flatpickr-day.selected.inRange,\n", " .flatpickr-day.startRange.inRange,\n", " .flatpickr-day.endRange.inRange,\n", " .flatpickr-day.selected:focus,\n", " .flatpickr-day.startRange:focus,\n", " .flatpickr-day.endRange:focus,\n", " .flatpickr-day.selected:hover,\n", " .flatpickr-day.startRange:hover,\n", " .flatpickr-day.endRange:hover,\n", " .flatpickr-day.selected.prevMonthDay,\n", " .flatpickr-day.startRange.prevMonthDay,\n", " .flatpickr-day.endRange.prevMonthDay,\n", " .flatpickr-day.selected.nextMonthDay,\n", " .flatpickr-day.startRange.nextMonthDay,\n", " .flatpickr-day.endRange.nextMonthDay {\n", " background: #569ff7;\n", " -webkit-box-shadow: none;\n", " box-shadow: none;\n", " color: #fff;\n", " border-color: #569ff7;\n", " }\n", " .flatpickr-day.selected.startRange,\n", " .flatpickr-day.startRange.startRange,\n", " .flatpickr-day.endRange.startRange {\n", " border-radius: 50px 0 0 50px;\n", " }\n", " .flatpickr-day.selected.endRange,\n", " .flatpickr-day.startRange.endRange,\n", " .flatpickr-day.endRange.endRange {\n", " border-radius: 0 50px 50px 0;\n", " }\n", " .flatpickr-day.selected.startRange + .endRange:not(:nth-child(7n+1)),\n", " .flatpickr-day.startRange.startRange + .endRange:not(:nth-child(7n+1)),\n", " .flatpickr-day.endRange.startRange + .endRange:not(:nth-child(7n+1)) {\n", " -webkit-box-shadow: -10px 0 0 #569ff7;\n", " box-shadow: -10px 0 0 #569ff7;\n", " }\n", " .flatpickr-day.selected.startRange.endRange,\n", " .flatpickr-day.startRange.startRange.endRange,\n", " .flatpickr-day.endRange.startRange.endRange {\n", " border-radius: 50px;\n", " }\n", " .flatpickr-day.inRange {\n", " border-radius: 0;\n", " -webkit-box-shadow: -5px 0 0 #e6e6e6, 5px 0 0 #e6e6e6;\n", " box-shadow: -5px 0 0 #e6e6e6, 5px 0 0 #e6e6e6;\n", " }\n", " .flatpickr-day.flatpickr-disabled,\n", " .flatpickr-day.flatpickr-disabled:hover,\n", " .flatpickr-day.prevMonthDay,\n", " .flatpickr-day.nextMonthDay,\n", " .flatpickr-day.notAllowed,\n", " .flatpickr-day.notAllowed.prevMonthDay,\n", " .flatpickr-day.notAllowed.nextMonthDay {\n", " color: rgba(57, 57, 57, 0.3);\n", " background: transparent;\n", " border-color: transparent;\n", " cursor: default;\n", " }\n", " .flatpickr-day.flatpickr-disabled,\n", " .flatpickr-day.flatpickr-disabled:hover {\n", " cursor: not-allowed;\n", " color: rgba(57, 57, 57, 0.1);\n", " }\n", " .flatpickr-day.week.selected {\n", " border-radius: 0;\n", " -webkit-box-shadow: -5px 0 0 #569ff7, 5px 0 0 #569ff7;\n", " box-shadow: -5px 0 0 #569ff7, 5px 0 0 #569ff7;\n", " }\n", " .flatpickr-day.hidden {\n", " visibility: hidden;\n", " }\n", " .rangeMode .flatpickr-day {\n", " margin-top: 1px;\n", " }\n", " .flatpickr-weekwrapper {\n", " float: left;\n", " }\n", " .flatpickr-weekwrapper .flatpickr-weeks {\n", " padding: 0 12px;\n", " -webkit-box-shadow: 1px 0 0 #e6e6e6;\n", " box-shadow: 1px 0 0 #e6e6e6;\n", " }\n", " .flatpickr-weekwrapper .flatpickr-weekday {\n", " float: none;\n", " width: 100%;\n", " line-height: 28px;\n", " }\n", " .flatpickr-weekwrapper span.flatpickr-day,\n", " .flatpickr-weekwrapper span.flatpickr-day:hover {\n", " display: block;\n", " width: 100%;\n", " max-width: none;\n", " color: rgba(57, 57, 57, 0.3);\n", " background: transparent;\n", " cursor: default;\n", " border: none;\n", " }\n", " .flatpickr-innerContainer {\n", " display: block;\n", " display: -webkit-box;\n", " display: -webkit-flex;\n", " display: -ms-flexbox;\n", " display: flex;\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " overflow: hidden;\n", " }\n", " .flatpickr-rContainer {\n", " display: inline-block;\n", " padding: 0;\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " }\n", " .flatpickr-time {\n", " text-align: center;\n", " outline: 0;\n", " display: block;\n", " height: 0;\n", " line-height: 40px;\n", " max-height: 40px;\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " overflow: hidden;\n", " display: -webkit-box;\n", " display: -webkit-flex;\n", " display: -ms-flexbox;\n", " display: flex;\n", " }\n", " .flatpickr-time:after {\n", " content: \"\";\n", " display: table;\n", " clear: both;\n", " }\n", " .flatpickr-time .numInputWrapper {\n", " -webkit-box-flex: 1;\n", " -webkit-flex: 1;\n", " -ms-flex: 1;\n", " flex: 1;\n", " width: 40%;\n", " height: 40px;\n", " float: left;\n", " }\n", " .flatpickr-time .numInputWrapper span.arrowUp:after {\n", " border-bottom-color: #393939;\n", " }\n", " .flatpickr-time .numInputWrapper span.arrowDown:after {\n", " border-top-color: #393939;\n", " }\n", " .flatpickr-time.hasSeconds .numInputWrapper {\n", " width: 26%;\n", " }\n", " .flatpickr-time.time24hr .numInputWrapper {\n", " width: 49%;\n", " }\n", " .flatpickr-time input {\n", " background: transparent;\n", " -webkit-box-shadow: none;\n", " box-shadow: none;\n", " border: 0;\n", " border-radius: 0;\n", " text-align: center;\n", " margin: 0;\n", " padding: 0;\n", " height: inherit;\n", " line-height: inherit;\n", " color: #393939;\n", " font-size: 14px;\n", " position: relative;\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " -webkit-appearance: textfield;\n", " -moz-appearance: textfield;\n", " appearance: textfield;\n", " }\n", " .flatpickr-time input.flatpickr-hour {\n", " font-weight: bold;\n", " }\n", " .flatpickr-time input.flatpickr-minute,\n", " .flatpickr-time input.flatpickr-second {\n", " font-weight: 400;\n", " }\n", " .flatpickr-time input:focus {\n", " outline: 0;\n", " border: 0;\n", " }\n", " .flatpickr-time .flatpickr-time-separator,\n", " .flatpickr-time .flatpickr-am-pm {\n", " height: inherit;\n", " float: left;\n", " line-height: inherit;\n", " color: #393939;\n", " font-weight: bold;\n", " width: 2%;\n", " -webkit-user-select: none;\n", " -moz-user-select: none;\n", " -ms-user-select: none;\n", " user-select: none;\n", " -webkit-align-self: center;\n", " -ms-flex-item-align: center;\n", " align-self: center;\n", " }\n", " .flatpickr-time .flatpickr-am-pm {\n", " outline: 0;\n", " width: 18%;\n", " cursor: pointer;\n", " text-align: center;\n", " font-weight: 400;\n", " }\n", " .flatpickr-time input:hover,\n", " .flatpickr-time .flatpickr-am-pm:hover,\n", " .flatpickr-time input:focus,\n", " .flatpickr-time .flatpickr-am-pm:focus {\n", " background: #eee;\n", " }\n", " .flatpickr-input[readonly] {\n", " cursor: pointer;\n", " }\n", " @-webkit-keyframes fpFadeInDown {\n", " from {\n", " opacity: 0;\n", " -webkit-transform: translate3d(0, -20px, 0);\n", " transform: translate3d(0, -20px, 0);\n", " }\n", " to {\n", " opacity: 1;\n", " -webkit-transform: translate3d(0, 0, 0);\n", " transform: translate3d(0, 0, 0);\n", " }\n", " }\n", " @keyframes fpFadeInDown {\n", " from {\n", " opacity: 0;\n", " -webkit-transform: translate3d(0, -20px, 0);\n", " transform: translate3d(0, -20px, 0);\n", " }\n", " to {\n", " opacity: 1;\n", " -webkit-transform: translate3d(0, 0, 0);\n", " transform: translate3d(0, 0, 0);\n", " }\n", " }\n", " .flatpickr-calendar {\n", " background: transparent;\n", " opacity: 0;\n", " display: none;\n", " text-align: center;\n", " visibility: hidden;\n", " padding: 0;\n", " -webkit-animation: none;\n", " animation: none;\n", " direction: ltr;\n", " border: 0;\n", " font-size: 14px;\n", " line-height: 24px;\n", " border-radius: 5px;\n", " position: absolute;\n", " width: 307.875px;\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " -ms-touch-action: manipulation;\n", " touch-action: manipulation;\n", " -webkit-box-shadow: 0 3px 13px rgba(0, 0, 0, 0.08);\n", " box-shadow: 0 3px 13px rgba(0, 0, 0, 0.08);\n", " }\n", " .flatpickr-calendar.open,\n", " .flatpickr-calendar.inline {\n", " opacity: 1;\n", " max-height: 640px;\n", " visibility: visible;\n", " }\n", " .flatpickr-calendar.open {\n", " display: inline-block;\n", " z-index: 99999;\n", " }\n", " .flatpickr-calendar.animate.open {\n", " -webkit-animation: fpFadeInDown 300ms cubic-bezier(0.23, 1, 0.32, 1);\n", " animation: fpFadeInDown 300ms cubic-bezier(0.23, 1, 0.32, 1);\n", " }\n", " .flatpickr-calendar.inline {\n", " display: block;\n", " position: relative;\n", " top: 2px;\n", " }\n", " .flatpickr-calendar.static {\n", " position: absolute;\n", " top: calc(100% + 2px);\n", " }\n", " .flatpickr-calendar.static.open {\n", " z-index: 999;\n", " display: block;\n", " }\n", " .flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+1) .flatpickr-day.inRange:nth-child(7n+7) {\n", " -webkit-box-shadow: none !important;\n", " box-shadow: none !important;\n", " }\n", " .flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+2) .flatpickr-day.inRange:nth-child(7n+1) {\n", " -webkit-box-shadow: -2px 0 0 #e6e6e6, 5px 0 0 #e6e6e6;\n", " box-shadow: -2px 0 0 #e6e6e6, 5px 0 0 #e6e6e6;\n", " }\n", " .flatpickr-calendar .hasWeeks .dayContainer,\n", " .flatpickr-calendar .hasTime .dayContainer {\n", " border-bottom: 0;\n", " border-bottom-right-radius: 0;\n", " border-bottom-left-radius: 0;\n", " }\n", " .flatpickr-calendar .hasWeeks .dayContainer {\n", " border-left: 0;\n", " }\n", " .flatpickr-calendar.showTimeInput.hasTime .flatpickr-time {\n", " height: 40px;\n", " border-top: 1px solid #eceef1;\n", " }\n", " .flatpickr-calendar.showTimeInput.hasTime .flatpickr-innerContainer {\n", " border-bottom: 0;\n", " }\n", " .flatpickr-calendar.showTimeInput.hasTime .flatpickr-time {\n", " border: 1px solid #eceef1;\n", " }\n", " .flatpickr-calendar.noCalendar.hasTime .flatpickr-time {\n", " height: auto;\n", " }\n", " .flatpickr-calendar:before,\n", " .flatpickr-calendar:after {\n", " position: absolute;\n", " display: block;\n", " pointer-events: none;\n", " border: solid transparent;\n", " content: '';\n", " height: 0;\n", " width: 0;\n", " left: 22px;\n", " }\n", " .flatpickr-calendar.rightMost:before,\n", " .flatpickr-calendar.rightMost:after {\n", " left: auto;\n", " right: 22px;\n", " }\n", " .flatpickr-calendar:before {\n", " border-width: 5px;\n", " margin: 0 -5px;\n", " }\n", " .flatpickr-calendar:after {\n", " border-width: 4px;\n", " margin: 0 -4px;\n", " }\n", " .flatpickr-calendar.arrowTop:before,\n", " .flatpickr-calendar.arrowTop:after {\n", " bottom: 100%;\n", " }\n", " .flatpickr-calendar.arrowTop:before {\n", " border-bottom-color: #eceef1;\n", " }\n", " .flatpickr-calendar.arrowTop:after {\n", " border-bottom-color: #eceef1;\n", " }\n", " .flatpickr-calendar.arrowBottom:before,\n", " .flatpickr-calendar.arrowBottom:after {\n", " top: 100%;\n", " }\n", " .flatpickr-calendar.arrowBottom:before {\n", " border-top-color: #eceef1;\n", " }\n", " .flatpickr-calendar.arrowBottom:after {\n", " border-top-color: #eceef1;\n", " }\n", " .flatpickr-calendar:focus {\n", " outline: 0;\n", " }\n", " .flatpickr-wrapper {\n", " position: relative;\n", " display: inline-block;\n", " }\n", " .flatpickr-months {\n", " display: -webkit-box;\n", " display: -webkit-flex;\n", " display: -ms-flexbox;\n", " display: flex;\n", " }\n", " .flatpickr-months .flatpickr-month {\n", " border-radius: 5px 5px 0 0;\n", " background: #eceef1;\n", " color: #5a6171;\n", " fill: #5a6171;\n", " height: 34px;\n", " line-height: 1;\n", " text-align: center;\n", " position: relative;\n", " -webkit-user-select: none;\n", " -moz-user-select: none;\n", " -ms-user-select: none;\n", " user-select: none;\n", " overflow: hidden;\n", " -webkit-box-flex: 1;\n", " -webkit-flex: 1;\n", " -ms-flex: 1;\n", " flex: 1;\n", " }\n", " .flatpickr-months .flatpickr-prev-month,\n", " .flatpickr-months .flatpickr-next-month {\n", " text-decoration: none;\n", " cursor: pointer;\n", " position: absolute;\n", " top: 0;\n", " height: 34px;\n", " padding: 10px;\n", " z-index: 3;\n", " color: #5a6171;\n", " fill: #5a6171;\n", " }\n", " .flatpickr-months .flatpickr-prev-month.flatpickr-disabled,\n", " .flatpickr-months .flatpickr-next-month.flatpickr-disabled {\n", " display: none;\n", " }\n", " .flatpickr-months .flatpickr-prev-month i,\n", " .flatpickr-months .flatpickr-next-month i {\n", " position: relative;\n", " }\n", " .flatpickr-months .flatpickr-prev-month.flatpickr-prev-month,\n", " .flatpickr-months .flatpickr-next-month.flatpickr-prev-month {\n", " /*\n", " /*rtl:begin:ignore*/\n", " /*\n", " */\n", " left: 0;\n", " /*\n", " /*rtl:end:ignore*/\n", " /*\n", " */\n", " }\n", " /*\n", " /*rtl:begin:ignore*/\n", " /*\n", " /*rtl:end:ignore*/\n", " .flatpickr-months .flatpickr-prev-month.flatpickr-next-month,\n", " .flatpickr-months .flatpickr-next-month.flatpickr-next-month {\n", " /*\n", " /*rtl:begin:ignore*/\n", " /*\n", " */\n", " right: 0;\n", " /*\n", " /*rtl:end:ignore*/\n", " /*\n", " */\n", " }\n", " /*\n", " /*rtl:begin:ignore*/\n", " /*\n", " /*rtl:end:ignore*/\n", " .flatpickr-months .flatpickr-prev-month:hover,\n", " .flatpickr-months .flatpickr-next-month:hover {\n", " color: #bbb;\n", " }\n", " .flatpickr-months .flatpickr-prev-month:hover svg,\n", " .flatpickr-months .flatpickr-next-month:hover svg {\n", " fill: #f64747;\n", " }\n", " .flatpickr-months .flatpickr-prev-month svg,\n", " .flatpickr-months .flatpickr-next-month svg {\n", " width: 14px;\n", " height: 14px;\n", " }\n", " .flatpickr-months .flatpickr-prev-month svg path,\n", " .flatpickr-months .flatpickr-next-month svg path {\n", " -webkit-transition: fill 0.1s;\n", " transition: fill 0.1s;\n", " fill: inherit;\n", " }\n", " .numInputWrapper {\n", " position: relative;\n", " height: auto;\n", " }\n", " .numInputWrapper input,\n", " .numInputWrapper span {\n", " display: inline-block;\n", " }\n", " .numInputWrapper input {\n", " width: 100%;\n", " }\n", " .numInputWrapper input::-ms-clear {\n", " display: none;\n", " }\n", " .numInputWrapper input::-webkit-outer-spin-button,\n", " .numInputWrapper input::-webkit-inner-spin-button {\n", " margin: 0;\n", " -webkit-appearance: none;\n", " }\n", " .numInputWrapper span {\n", " position: absolute;\n", " right: 0;\n", " width: 14px;\n", " padding: 0 4px 0 2px;\n", " height: 50%;\n", " line-height: 50%;\n", " opacity: 0;\n", " cursor: pointer;\n", " border: 1px solid rgba(72, 72, 72, 0.15);\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " }\n", " .numInputWrapper span:hover {\n", " background: rgba(0, 0, 0, 0.1);\n", " }\n", " .numInputWrapper span:active {\n", " background: rgba(0, 0, 0, 0.2);\n", " }\n", " .numInputWrapper span:after {\n", " display: block;\n", " content: \"\";\n", " position: absolute;\n", " }\n", " .numInputWrapper span.arrowUp {\n", " top: 0;\n", " border-bottom: 0;\n", " }\n", " .numInputWrapper span.arrowUp:after {\n", " border-left: 4px solid transparent;\n", " border-right: 4px solid transparent;\n", " border-bottom: 4px solid rgba(72, 72, 72, 0.6);\n", " top: 26%;\n", " }\n", " .numInputWrapper span.arrowDown {\n", " top: 50%;\n", " }\n", " .numInputWrapper span.arrowDown:after {\n", " border-left: 4px solid transparent;\n", " border-right: 4px solid transparent;\n", " border-top: 4px solid rgba(72, 72, 72, 0.6);\n", " top: 40%;\n", " }\n", " .numInputWrapper span svg {\n", " width: inherit;\n", " height: auto;\n", " }\n", " .numInputWrapper span svg path {\n", " fill: rgba(90, 97, 113, 0.5);\n", " }\n", " .numInputWrapper:hover {\n", " background: rgba(0, 0, 0, 0.05);\n", " }\n", " .numInputWrapper:hover span {\n", " opacity: 1;\n", " }\n", " .flatpickr-current-month {\n", " font-size: 135%;\n", " line-height: inherit;\n", " font-weight: 300;\n", " color: inherit;\n", " position: absolute;\n", " width: 75%;\n", " left: 12.5%;\n", " padding: 7.48px 0 0 0;\n", " line-height: 1;\n", " height: 34px;\n", " display: inline-block;\n", " text-align: center;\n", " -webkit-transform: translate3d(0px, 0px, 0px);\n", " transform: translate3d(0px, 0px, 0px);\n", " }\n", " .flatpickr-current-month span.cur-month {\n", " font-family: inherit;\n", " font-weight: 700;\n", " color: inherit;\n", " display: inline-block;\n", " margin-left: 0.5ch;\n", " padding: 0;\n", " }\n", " .flatpickr-current-month span.cur-month:hover {\n", " background: rgba(0, 0, 0, 0.05);\n", " }\n", " .flatpickr-current-month .numInputWrapper {\n", " width: 6ch;\n", " width: 7ch\\0;\n", " display: inline-block;\n", " }\n", " .flatpickr-current-month .numInputWrapper span.arrowUp:after {\n", " border-bottom-color: #5a6171;\n", " }\n", " .flatpickr-current-month .numInputWrapper span.arrowDown:after {\n", " border-top-color: #5a6171;\n", " }\n", " .flatpickr-current-month input.cur-year {\n", " background: transparent;\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " color: inherit;\n", " cursor: text;\n", " padding: 0 0 0 0.5ch;\n", " margin: 0;\n", " display: inline-block;\n", " font-size: inherit;\n", " font-family: inherit;\n", " font-weight: 300;\n", " line-height: inherit;\n", " height: auto;\n", " border: 0;\n", " border-radius: 0;\n", " vertical-align: initial;\n", " -webkit-appearance: textfield;\n", " -moz-appearance: textfield;\n", " appearance: textfield;\n", " }\n", " .flatpickr-current-month input.cur-year:focus {\n", " outline: 0;\n", " }\n", " .flatpickr-current-month input.cur-year[disabled],\n", " .flatpickr-current-month input.cur-year[disabled]:hover {\n", " font-size: 100%;\n", " color: rgba(90, 97, 113, 0.5);\n", " background: transparent;\n", " pointer-events: none;\n", " }\n", " .flatpickr-current-month .flatpickr-monthDropdown-months {\n", " appearance: menulist;\n", " background: #eceef1;\n", " border: none;\n", " border-radius: 0;\n", " box-sizing: border-box;\n", " color: inherit;\n", " cursor: pointer;\n", " font-size: inherit;\n", " font-family: inherit;\n", " font-weight: 300;\n", " height: auto;\n", " line-height: inherit;\n", " margin: -1px 0 0 0;\n", " outline: none;\n", " padding: 0 0 0 0.5ch;\n", " position: relative;\n", " vertical-align: initial;\n", " -webkit-box-sizing: border-box;\n", " -webkit-appearance: menulist;\n", " -moz-appearance: menulist;\n", " width: auto;\n", " }\n", " .flatpickr-current-month .flatpickr-monthDropdown-months:focus,\n", " .flatpickr-current-month .flatpickr-monthDropdown-months:active {\n", " outline: none;\n", " }\n", " .flatpickr-current-month .flatpickr-monthDropdown-months:hover {\n", " background: rgba(0, 0, 0, 0.05);\n", " }\n", " .flatpickr-current-month .flatpickr-monthDropdown-months .flatpickr-monthDropdown-month {\n", " background-color: #eceef1;\n", " outline: none;\n", " padding: 0;\n", " }\n", " .flatpickr-weekdays {\n", " background: #eceef1;\n", " text-align: center;\n", " overflow: hidden;\n", " width: 100%;\n", " display: -webkit-box;\n", " display: -webkit-flex;\n", " display: -ms-flexbox;\n", " display: flex;\n", " -webkit-box-align: center;\n", " -webkit-align-items: center;\n", " -ms-flex-align: center;\n", " align-items: center;\n", " height: 28px;\n", " }\n", " .flatpickr-weekdays .flatpickr-weekdaycontainer {\n", " display: -webkit-box;\n", " display: -webkit-flex;\n", " display: -ms-flexbox;\n", " display: flex;\n", " -webkit-box-flex: 1;\n", " -webkit-flex: 1;\n", " -ms-flex: 1;\n", " flex: 1;\n", " }\n", " span.flatpickr-weekday {\n", " cursor: default;\n", " font-size: 90%;\n", " background: #eceef1;\n", " color: #5a6171;\n", " line-height: 1;\n", " margin: 0;\n", " text-align: center;\n", " display: block;\n", " -webkit-box-flex: 1;\n", " -webkit-flex: 1;\n", " -ms-flex: 1;\n", " flex: 1;\n", " font-weight: bolder;\n", " }\n", " .dayContainer,\n", " .flatpickr-weeks {\n", " padding: 1px 0 0 0;\n", " }\n", " .flatpickr-days {\n", " position: relative;\n", " overflow: hidden;\n", " display: -webkit-box;\n", " display: -webkit-flex;\n", " display: -ms-flexbox;\n", " display: flex;\n", " -webkit-box-align: start;\n", " -webkit-align-items: flex-start;\n", " -ms-flex-align: start;\n", " align-items: flex-start;\n", " width: 307.875px;\n", " border-left: 1px solid #eceef1;\n", " border-right: 1px solid #eceef1;\n", " }\n", " .flatpickr-days:focus {\n", " outline: 0;\n", " }\n", " .dayContainer {\n", " padding: 0;\n", " outline: 0;\n", " text-align: left;\n", " width: 307.875px;\n", " min-width: 307.875px;\n", " max-width: 307.875px;\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " display: inline-block;\n", " display: -ms-flexbox;\n", " display: -webkit-box;\n", " display: -webkit-flex;\n", " display: flex;\n", " -webkit-flex-wrap: wrap;\n", " flex-wrap: wrap;\n", " -ms-flex-wrap: wrap;\n", " -ms-flex-pack: justify;\n", " -webkit-justify-content: space-around;\n", " justify-content: space-around;\n", " -webkit-transform: translate3d(0px, 0px, 0px);\n", " transform: translate3d(0px, 0px, 0px);\n", " opacity: 1;\n", " }\n", " .dayContainer + .dayContainer {\n", " -webkit-box-shadow: -1px 0 0 #eceef1;\n", " box-shadow: -1px 0 0 #eceef1;\n", " }\n", " .flatpickr-day {\n", " background: none;\n", " border: 1px solid transparent;\n", " border-radius: 150px;\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " color: #484848;\n", " cursor: pointer;\n", " font-weight: 400;\n", " width: 14.2857143%;\n", " -webkit-flex-basis: 14.2857143%;\n", " -ms-flex-preferred-size: 14.2857143%;\n", " flex-basis: 14.2857143%;\n", " max-width: 39px;\n", " height: 39px;\n", " line-height: 39px;\n", " margin: 0;\n", " display: inline-block;\n", " position: relative;\n", " -webkit-box-pack: center;\n", " -webkit-justify-content: center;\n", " -ms-flex-pack: center;\n", " justify-content: center;\n", " text-align: center;\n", " }\n", " .flatpickr-day.inRange,\n", " .flatpickr-day.prevMonthDay.inRange,\n", " .flatpickr-day.nextMonthDay.inRange,\n", " .flatpickr-day.today.inRange,\n", " .flatpickr-day.prevMonthDay.today.inRange,\n", " .flatpickr-day.nextMonthDay.today.inRange,\n", " .flatpickr-day:hover,\n", " .flatpickr-day.prevMonthDay:hover,\n", " .flatpickr-day.nextMonthDay:hover,\n", " .flatpickr-day:focus,\n", " .flatpickr-day.prevMonthDay:focus,\n", " .flatpickr-day.nextMonthDay:focus {\n", " cursor: pointer;\n", " outline: 0;\n", " background: #e2e2e2;\n", " border-color: #e2e2e2;\n", " }\n", " .flatpickr-day.today {\n", " border-color: #bbb;\n", " }\n", " .flatpickr-day.today:hover,\n", " .flatpickr-day.today:focus {\n", " border-color: #bbb;\n", " background: #bbb;\n", " color: #fff;\n", " }\n", " .flatpickr-day.selected,\n", " .flatpickr-day.startRange,\n", " .flatpickr-day.endRange,\n", " .flatpickr-day.selected.inRange,\n", " .flatpickr-day.startRange.inRange,\n", " .flatpickr-day.endRange.inRange,\n", " .flatpickr-day.selected:focus,\n", " .flatpickr-day.startRange:focus,\n", " .flatpickr-day.endRange:focus,\n", " .flatpickr-day.selected:hover,\n", " .flatpickr-day.startRange:hover,\n", " .flatpickr-day.endRange:hover,\n", " .flatpickr-day.selected.prevMonthDay,\n", " .flatpickr-day.startRange.prevMonthDay,\n", " .flatpickr-day.endRange.prevMonthDay,\n", " .flatpickr-day.selected.nextMonthDay,\n", " .flatpickr-day.startRange.nextMonthDay,\n", " .flatpickr-day.endRange.nextMonthDay {\n", " background: #ff5a5f;\n", " -webkit-box-shadow: none;\n", " box-shadow: none;\n", " color: #fff;\n", " border-color: #ff5a5f;\n", " }\n", " .flatpickr-day.selected.startRange,\n", " .flatpickr-day.startRange.startRange,\n", " .flatpickr-day.endRange.startRange {\n", " border-radius: 50px 0 0 50px;\n", " }\n", " .flatpickr-day.selected.endRange,\n", " .flatpickr-day.startRange.endRange,\n", " .flatpickr-day.endRange.endRange {\n", " border-radius: 0 50px 50px 0;\n", " }\n", " .flatpickr-day.selected.startRange + .endRange:not(:nth-child(7n+1)),\n", " .flatpickr-day.startRange.startRange + .endRange:not(:nth-child(7n+1)),\n", " .flatpickr-day.endRange.startRange + .endRange:not(:nth-child(7n+1)) {\n", " -webkit-box-shadow: -10px 0 0 #ff5a5f;\n", " box-shadow: -10px 0 0 #ff5a5f;\n", " }\n", " .flatpickr-day.selected.startRange.endRange,\n", " .flatpickr-day.startRange.startRange.endRange,\n", " .flatpickr-day.endRange.startRange.endRange {\n", " border-radius: 50px;\n", " }\n", " .flatpickr-day.inRange {\n", " border-radius: 0;\n", " -webkit-box-shadow: -5px 0 0 #e2e2e2, 5px 0 0 #e2e2e2;\n", " box-shadow: -5px 0 0 #e2e2e2, 5px 0 0 #e2e2e2;\n", " }\n", " .flatpickr-day.flatpickr-disabled,\n", " .flatpickr-day.flatpickr-disabled:hover,\n", " .flatpickr-day.prevMonthDay,\n", " .flatpickr-day.nextMonthDay,\n", " .flatpickr-day.notAllowed,\n", " .flatpickr-day.notAllowed.prevMonthDay,\n", " .flatpickr-day.notAllowed.nextMonthDay {\n", " color: rgba(72, 72, 72, 0.3);\n", " background: transparent;\n", " border-color: transparent;\n", " cursor: default;\n", " }\n", " .flatpickr-day.flatpickr-disabled,\n", " .flatpickr-day.flatpickr-disabled:hover {\n", " cursor: not-allowed;\n", " color: rgba(72, 72, 72, 0.1);\n", " }\n", " .flatpickr-day.week.selected {\n", " border-radius: 0;\n", " -webkit-box-shadow: -5px 0 0 #ff5a5f, 5px 0 0 #ff5a5f;\n", " box-shadow: -5px 0 0 #ff5a5f, 5px 0 0 #ff5a5f;\n", " }\n", " .flatpickr-day.hidden {\n", " visibility: hidden;\n", " }\n", " .rangeMode .flatpickr-day {\n", " margin-top: 1px;\n", " }\n", " .flatpickr-weekwrapper {\n", " float: left;\n", " }\n", " .flatpickr-weekwrapper .flatpickr-weeks {\n", " padding: 0 12px;\n", " border-left: 1px solid #eceef1;\n", " }\n", " .flatpickr-weekwrapper .flatpickr-weekday {\n", " float: none;\n", " width: 100%;\n", " line-height: 28px;\n", " }\n", " .flatpickr-weekwrapper span.flatpickr-day,\n", " .flatpickr-weekwrapper span.flatpickr-day:hover {\n", " display: block;\n", " width: 100%;\n", " max-width: none;\n", " color: rgba(72, 72, 72, 0.3);\n", " background: transparent;\n", " cursor: default;\n", " border: none;\n", " }\n", " .flatpickr-innerContainer {\n", " display: block;\n", " display: -webkit-box;\n", " display: -webkit-flex;\n", " display: -ms-flexbox;\n", " display: flex;\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " overflow: hidden;\n", " background: #fff;\n", " border-bottom: 1px solid #eceef1;\n", " }\n", " .flatpickr-rContainer {\n", " display: inline-block;\n", " padding: 0;\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " }\n", " .flatpickr-time {\n", " text-align: center;\n", " outline: 0;\n", " display: block;\n", " height: 0;\n", " line-height: 40px;\n", " max-height: 40px;\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " overflow: hidden;\n", " display: -webkit-box;\n", " display: -webkit-flex;\n", " display: -ms-flexbox;\n", " display: flex;\n", " background: #fff;\n", " border-radius: 0 0 5px 5px;\n", " }\n", " .flatpickr-time:after {\n", " content: \"\";\n", " display: table;\n", " clear: both;\n", " }\n", " .flatpickr-time .numInputWrapper {\n", " -webkit-box-flex: 1;\n", " -webkit-flex: 1;\n", " -ms-flex: 1;\n", " flex: 1;\n", " width: 40%;\n", " height: 40px;\n", " float: left;\n", " }\n", " .flatpickr-time .numInputWrapper span.arrowUp:after {\n", " border-bottom-color: #484848;\n", " }\n", " .flatpickr-time .numInputWrapper span.arrowDown:after {\n", " border-top-color: #484848;\n", " }\n", " .flatpickr-time.hasSeconds .numInputWrapper {\n", " width: 26%;\n", " }\n", " .flatpickr-time.time24hr .numInputWrapper {\n", " width: 49%;\n", " }\n", " .flatpickr-time input {\n", " background: transparent;\n", " -webkit-box-shadow: none;\n", " box-shadow: none;\n", " border: 0;\n", " border-radius: 0;\n", " text-align: center;\n", " margin: 0;\n", " padding: 0;\n", " height: inherit;\n", " line-height: inherit;\n", " color: #484848;\n", " font-size: 14px;\n", " position: relative;\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " -webkit-appearance: textfield;\n", " -moz-appearance: textfield;\n", " appearance: textfield;\n", " }\n", " .flatpickr-time input.flatpickr-hour {\n", " font-weight: bold;\n", " }\n", " .flatpickr-time input.flatpickr-minute,\n", " .flatpickr-time input.flatpickr-second {\n", " font-weight: 400;\n", " }\n", " .flatpickr-time input:focus {\n", " outline: 0;\n", " border: 0;\n", " }\n", " .flatpickr-time .flatpickr-time-separator,\n", " .flatpickr-time .flatpickr-am-pm {\n", " height: inherit;\n", " float: left;\n", " line-height: inherit;\n", " color: #484848;\n", " font-weight: bold;\n", " width: 2%;\n", " -webkit-user-select: none;\n", " -moz-user-select: none;\n", " -ms-user-select: none;\n", " user-select: none;\n", " -webkit-align-self: center;\n", " -ms-flex-item-align: center;\n", " align-self: center;\n", " }\n", " .flatpickr-time .flatpickr-am-pm {\n", " outline: 0;\n", " width: 18%;\n", " cursor: pointer;\n", " text-align: center;\n", " font-weight: 400;\n", " }\n", " .flatpickr-time input:hover,\n", " .flatpickr-time .flatpickr-am-pm:hover,\n", " .flatpickr-time input:focus,\n", " .flatpickr-time .flatpickr-am-pm:focus {\n", " background: #eaeaea;\n", " }\n", " .flatpickr-input[readonly] {\n", " cursor: pointer;\n", " }\n", " @-webkit-keyframes fpFadeInDown {\n", " from {\n", " opacity: 0;\n", " -webkit-transform: translate3d(0, -20px, 0);\n", " transform: translate3d(0, -20px, 0);\n", " }\n", " to {\n", " opacity: 1;\n", " -webkit-transform: translate3d(0, 0, 0);\n", " transform: translate3d(0, 0, 0);\n", " }\n", " }\n", " @keyframes fpFadeInDown {\n", " from {\n", " opacity: 0;\n", " -webkit-transform: translate3d(0, -20px, 0);\n", " transform: translate3d(0, -20px, 0);\n", " }\n", " to {\n", " opacity: 1;\n", " -webkit-transform: translate3d(0, 0, 0);\n", " transform: translate3d(0, 0, 0);\n", " }\n", " }\n", " span.flatpickr-day.selected {\n", " font-weight: bold;\n", " }\n", " `;\n", " exports.default = css;\n", " },\n", " 410: /* models/widgets/date_range_slider.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const timezone_1 = tslib_1.__importDefault(require(159) /* timezone */);\n", " const abstract_slider_1 = require(411) /* ./abstract_slider */;\n", " class DateRangeSliderView extends abstract_slider_1.AbstractRangeSliderView {\n", " }\n", " exports.DateRangeSliderView = DateRangeSliderView;\n", " DateRangeSliderView.__name__ = \"DateRangeSliderView\";\n", " class DateRangeSlider extends abstract_slider_1.AbstractSlider {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.behaviour = \"drag\";\n", " this.connected = [false, true, false];\n", " }\n", " static init_DateRangeSlider() {\n", " this.prototype.default_view = DateRangeSliderView;\n", " this.override({\n", " format: \"%d %b %Y\",\n", " });\n", " }\n", " _formatter(value, format) {\n", " return timezone_1.default(value, format);\n", " }\n", " }\n", " exports.DateRangeSlider = DateRangeSlider;\n", " DateRangeSlider.__name__ = \"DateRangeSlider\";\n", " DateRangeSlider.init_DateRangeSlider();\n", " },\n", " 411: /* models/widgets/abstract_slider.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const noUiSlider = tslib_1.__importStar(require(412) /* nouislider */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const control_1 = require(393) /* ./control */;\n", " const sliders_1 = require(413) /* ../../styles/widgets/sliders */;\n", " const inputs_1 = require(400) /* ../../styles/widgets/inputs */;\n", " const nouislider_css_1 = tslib_1.__importDefault(require(414) /* ../../styles/widgets/nouislider.css */);\n", " const sliders_css_1 = tslib_1.__importDefault(require(415) /* ../../styles/widgets/sliders.css */);\n", " class AbstractBaseSliderView extends control_1.ControlView {\n", " *controls() {\n", " yield this.slider_el;\n", " }\n", " get noUiSlider() {\n", " return this.slider_el.noUiSlider;\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " const { direction, orientation, tooltips } = this.model.properties;\n", " this.on_change([direction, orientation, tooltips], () => this.render());\n", " const { start, end, value, step, title } = this.model.properties;\n", " this.on_change([start, end, value, step], () => {\n", " const { start, end, value, step } = this._calc_to();\n", " this.noUiSlider.updateOptions({\n", " range: { min: start, max: end },\n", " start: value,\n", " step,\n", " });\n", " });\n", " const { bar_color } = this.model.properties;\n", " this.on_change(bar_color, () => {\n", " this._set_bar_color();\n", " });\n", " const { show_value } = this.model.properties;\n", " this.on_change([value, title, show_value], () => this._update_title());\n", " }\n", " styles() {\n", " return [...super.styles(), nouislider_css_1.default, sliders_css_1.default];\n", " }\n", " _update_title() {\n", " dom_1.empty(this.title_el);\n", " const hide_header = this.model.title == null || (this.model.title.length == 0 && !this.model.show_value);\n", " this.title_el.style.display = hide_header ? \"none\" : \"\";\n", " if (!hide_header) {\n", " if (this.model.title.length != 0)\n", " this.title_el.textContent = `${this.model.title}: `;\n", " if (this.model.show_value) {\n", " const { value } = this._calc_to();\n", " const pretty = value.map((v) => this.model.pretty(v)).join(\" .. \");\n", " this.title_el.appendChild(dom_1.span({ class: sliders_1.bk_slider_value }, pretty));\n", " }\n", " }\n", " }\n", " _set_bar_color() {\n", " if (!this.model.disabled) {\n", " const connect_el = this.slider_el.querySelector(\".noUi-connect\");\n", " connect_el.style.backgroundColor = this.model.bar_color;\n", " }\n", " }\n", " _keypress_handle(e, idx = 0) {\n", " const { start, value, end, step } = this._calc_to();\n", " const is_range = value.length == 2;\n", " let low = start;\n", " let high = end;\n", " if (is_range && idx == 0) {\n", " high = value[1];\n", " }\n", " else if (is_range && idx == 1) {\n", " low = value[0];\n", " }\n", " switch (e.which) {\n", " case 37: {\n", " value[idx] = Math.max(value[idx] - step, low);\n", " break;\n", " }\n", " case 39: {\n", " value[idx] = Math.min(value[idx] + step, high);\n", " break;\n", " }\n", " default:\n", " return;\n", " }\n", " if (is_range) {\n", " this.model.value = value;\n", " }\n", " else {\n", " this.model.value = value[0];\n", " }\n", " this.model.properties.value.change.emit();\n", " this.model.value_throttled = this.model.value;\n", " this.noUiSlider.set(value);\n", " }\n", " render() {\n", " super.render();\n", " const { start, end, value, step } = this._calc_to();\n", " let tooltips; // XXX\n", " if (this.model.tooltips) {\n", " const formatter = {\n", " to: (value) => this.model.pretty(value),\n", " };\n", " tooltips = array_1.repeat(formatter, value.length);\n", " }\n", " else\n", " tooltips = false;\n", " if (this.slider_el == null) {\n", " this.slider_el = dom_1.div();\n", " noUiSlider.create(this.slider_el, {\n", " range: { min: start, max: end },\n", " start: value,\n", " step,\n", " behaviour: this.model.behaviour,\n", " connect: this.model.connected,\n", " tooltips,\n", " orientation: this.model.orientation,\n", " direction: this.model.direction,\n", " });\n", " this.noUiSlider.on('slide', (_, __, values) => this._slide(values));\n", " this.noUiSlider.on('change', (_, __, values) => this._change(values));\n", " this._set_keypress_handles();\n", " const toggleTooltip = (i, show) => {\n", " if (!tooltips)\n", " return;\n", " const handle = this.slider_el.querySelectorAll(\".noUi-handle\")[i];\n", " const tooltip = handle.querySelector(\".noUi-tooltip\");\n", " tooltip.style.display = show ? 'block' : '';\n", " };\n", " this.noUiSlider.on('start', (_, i) => toggleTooltip(i, true));\n", " this.noUiSlider.on('end', (_, i) => toggleTooltip(i, false));\n", " }\n", " else {\n", " this.noUiSlider.updateOptions({\n", " range: { min: start, max: end },\n", " start: value,\n", " step,\n", " });\n", " }\n", " this._set_bar_color();\n", " if (this.model.disabled)\n", " this.slider_el.setAttribute('disabled', 'true');\n", " else\n", " this.slider_el.removeAttribute('disabled');\n", " this.title_el = dom_1.div({ class: sliders_1.bk_slider_title });\n", " this._update_title();\n", " this.group_el = dom_1.div({ class: inputs_1.bk_input_group }, this.title_el, this.slider_el);\n", " this.el.appendChild(this.group_el);\n", " }\n", " _slide(values) {\n", " this.model.value = this._calc_from(values);\n", " }\n", " _change(values) {\n", " this.model.value = this._calc_from(values);\n", " this.model.value_throttled = this.model.value;\n", " }\n", " }\n", " AbstractBaseSliderView.__name__ = \"AbstractBaseSliderView\";\n", " class AbstractSliderView extends AbstractBaseSliderView {\n", " _calc_to() {\n", " return {\n", " start: this.model.start,\n", " end: this.model.end,\n", " value: [this.model.value],\n", " step: this.model.step,\n", " };\n", " }\n", " _calc_from([value]) {\n", " if (Number.isInteger(this.model.start) && Number.isInteger(this.model.end) && Number.isInteger(this.model.step))\n", " return Math.round(value);\n", " else\n", " return value;\n", " }\n", " _set_keypress_handles() {\n", " // Add single cursor event\n", " const handle = this.slider_el.querySelector(\".noUi-handle\");\n", " handle.setAttribute('tabindex', '0');\n", " handle.addEventListener('keydown', (e) => this._keypress_handle(e));\n", " }\n", " }\n", " exports.AbstractSliderView = AbstractSliderView;\n", " AbstractSliderView.__name__ = \"AbstractSliderView\";\n", " class AbstractRangeSliderView extends AbstractBaseSliderView {\n", " _calc_to() {\n", " return {\n", " start: this.model.start,\n", " end: this.model.end,\n", " value: this.model.value,\n", " step: this.model.step,\n", " };\n", " }\n", " _calc_from(values) {\n", " return values;\n", " }\n", " _set_keypress_handles() {\n", " const handle_lower = this.slider_el.querySelector(\".noUi-handle-lower\");\n", " const handle_upper = this.slider_el.querySelector(\".noUi-handle-upper\");\n", " handle_lower.setAttribute('tabindex', '0');\n", " handle_lower.addEventListener('keydown', (e) => this._keypress_handle(e, 0));\n", " handle_upper.setAttribute('tabindex', '1');\n", " handle_upper.addEventListener('keydown', (e) => this._keypress_handle(e, 1));\n", " }\n", " }\n", " exports.AbstractRangeSliderView = AbstractRangeSliderView;\n", " AbstractRangeSliderView.__name__ = \"AbstractRangeSliderView\";\n", " class AbstractSlider extends control_1.Control {\n", " // TODO: __view_type__: AbstractSliderView\n", " constructor(attrs) {\n", " super(attrs);\n", " this.connected = false;\n", " }\n", " static init_AbstractSlider() {\n", " this.define({\n", " title: [p.String, \"\"],\n", " show_value: [p.Boolean, true],\n", " start: [p.Any],\n", " end: [p.Any],\n", " value: [p.Any],\n", " value_throttled: [p.Any],\n", " step: [p.Number, 1],\n", " format: [p.Any],\n", " direction: [p.Any, \"ltr\"],\n", " tooltips: [p.Boolean, true],\n", " bar_color: [p.Color, \"#e6e6e6\"],\n", " });\n", " }\n", " _formatter(value, _format) {\n", " return `${value}`;\n", " }\n", " pretty(value) {\n", " return this._formatter(value, this.format);\n", " }\n", " }\n", " exports.AbstractSlider = AbstractSlider;\n", " AbstractSlider.__name__ = \"AbstractSlider\";\n", " AbstractSlider.init_AbstractSlider();\n", " },\n", " 412: /* nouislider/distribute/nouislider.js */ function _(require, module, exports) {\n", " /*! nouislider - 14.5.0 - 5/11/2020 */\n", " (function (factory) {\n", " if (typeof define === \"function\" && define.amd) {\n", " // AMD. Register as an anonymous module.\n", " define([], factory);\n", " }\n", " else if (typeof exports === \"object\") {\n", " // Node/CommonJS\n", " module.exports = factory();\n", " }\n", " else {\n", " // Browser globals\n", " window.noUiSlider = factory();\n", " }\n", " })(function () {\n", " \"use strict\";\n", " var VERSION = \"14.5.0\";\n", " //region Helper Methods\n", " function isValidFormatter(entry) {\n", " return typeof entry === \"object\" && typeof entry.to === \"function\" && typeof entry.from === \"function\";\n", " }\n", " function removeElement(el) {\n", " el.parentElement.removeChild(el);\n", " }\n", " function isSet(value) {\n", " return value !== null && value !== undefined;\n", " }\n", " // Bindable version\n", " function preventDefault(e) {\n", " e.preventDefault();\n", " }\n", " // Removes duplicates from an array.\n", " function unique(array) {\n", " return array.filter(function (a) {\n", " return !this[a] ? (this[a] = true) : false;\n", " }, {});\n", " }\n", " // Round a value to the closest 'to'.\n", " function closest(value, to) {\n", " return Math.round(value / to) * to;\n", " }\n", " // Current position of an element relative to the document.\n", " function offset(elem, orientation) {\n", " var rect = elem.getBoundingClientRect();\n", " var doc = elem.ownerDocument;\n", " var docElem = doc.documentElement;\n", " var pageOffset = getPageOffset(doc);\n", " // getBoundingClientRect contains left scroll in Chrome on Android.\n", " // I haven't found a feature detection that proves this. Worst case\n", " // scenario on mis-match: the 'tap' feature on horizontal sliders breaks.\n", " if (/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)) {\n", " pageOffset.x = 0;\n", " }\n", " return orientation\n", " ? rect.top + pageOffset.y - docElem.clientTop\n", " : rect.left + pageOffset.x - docElem.clientLeft;\n", " }\n", " // Checks whether a value is numerical.\n", " function isNumeric(a) {\n", " return typeof a === \"number\" && !isNaN(a) && isFinite(a);\n", " }\n", " // Sets a class and removes it after [duration] ms.\n", " function addClassFor(element, className, duration) {\n", " if (duration > 0) {\n", " addClass(element, className);\n", " setTimeout(function () {\n", " removeClass(element, className);\n", " }, duration);\n", " }\n", " }\n", " // Limits a value to 0 - 100\n", " function limit(a) {\n", " return Math.max(Math.min(a, 100), 0);\n", " }\n", " // Wraps a variable as an array, if it isn't one yet.\n", " // Note that an input array is returned by reference!\n", " function asArray(a) {\n", " return Array.isArray(a) ? a : [a];\n", " }\n", " // Counts decimals\n", " function countDecimals(numStr) {\n", " numStr = String(numStr);\n", " var pieces = numStr.split(\".\");\n", " return pieces.length > 1 ? pieces[1].length : 0;\n", " }\n", " // http://youmightnotneedjquery.com/#add_class\n", " function addClass(el, className) {\n", " if (el.classList && !/\\s/.test(className)) {\n", " el.classList.add(className);\n", " }\n", " else {\n", " el.className += \" \" + className;\n", " }\n", " }\n", " // http://youmightnotneedjquery.com/#remove_class\n", " function removeClass(el, className) {\n", " if (el.classList && !/\\s/.test(className)) {\n", " el.classList.remove(className);\n", " }\n", " else {\n", " el.className = el.className.replace(new RegExp(\"(^|\\\\b)\" + className.split(\" \").join(\"|\") + \"(\\\\b|$)\", \"gi\"), \" \");\n", " }\n", " }\n", " // https://plainjs.com/javascript/attributes/adding-removing-and-testing-for-classes-9/\n", " function hasClass(el, className) {\n", " return el.classList\n", " ? el.classList.contains(className)\n", " : new RegExp(\"\\\\b\" + className + \"\\\\b\").test(el.className);\n", " }\n", " // https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollY#Notes\n", " function getPageOffset(doc) {\n", " var supportPageOffset = window.pageXOffset !== undefined;\n", " var isCSS1Compat = (doc.compatMode || \"\") === \"CSS1Compat\";\n", " var x = supportPageOffset\n", " ? window.pageXOffset\n", " : isCSS1Compat\n", " ? doc.documentElement.scrollLeft\n", " : doc.body.scrollLeft;\n", " var y = supportPageOffset\n", " ? window.pageYOffset\n", " : isCSS1Compat\n", " ? doc.documentElement.scrollTop\n", " : doc.body.scrollTop;\n", " return {\n", " x: x,\n", " y: y\n", " };\n", " }\n", " // we provide a function to compute constants instead\n", " // of accessing window.* as soon as the module needs it\n", " // so that we do not compute anything if not needed\n", " function getActions() {\n", " // Determine the events to bind. IE11 implements pointerEvents without\n", " // a prefix, which breaks compatibility with the IE10 implementation.\n", " return window.navigator.pointerEnabled\n", " ? {\n", " start: \"pointerdown\",\n", " move: \"pointermove\",\n", " end: \"pointerup\"\n", " }\n", " : window.navigator.msPointerEnabled\n", " ? {\n", " start: \"MSPointerDown\",\n", " move: \"MSPointerMove\",\n", " end: \"MSPointerUp\"\n", " }\n", " : {\n", " start: \"mousedown touchstart\",\n", " move: \"mousemove touchmove\",\n", " end: \"mouseup touchend\"\n", " };\n", " }\n", " // https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md\n", " // Issue #785\n", " function getSupportsPassive() {\n", " var supportsPassive = false;\n", " /* eslint-disable */\n", " try {\n", " var opts = Object.defineProperty({}, \"passive\", {\n", " get: function () {\n", " supportsPassive = true;\n", " }\n", " });\n", " window.addEventListener(\"test\", null, opts);\n", " }\n", " catch (e) { }\n", " /* eslint-enable */\n", " return supportsPassive;\n", " }\n", " function getSupportsTouchActionNone() {\n", " return window.CSS && CSS.supports && CSS.supports(\"touch-action\", \"none\");\n", " }\n", " //endregion\n", " //region Range Calculation\n", " // Determine the size of a sub-range in relation to a full range.\n", " function subRangeRatio(pa, pb) {\n", " return 100 / (pb - pa);\n", " }\n", " // (percentage) How many percent is this value of this range?\n", " function fromPercentage(range, value, startRange) {\n", " return (value * 100) / (range[startRange + 1] - range[startRange]);\n", " }\n", " // (percentage) Where is this value on this range?\n", " function toPercentage(range, value) {\n", " return fromPercentage(range, range[0] < 0 ? value + Math.abs(range[0]) : value - range[0], 0);\n", " }\n", " // (value) How much is this percentage on this range?\n", " function isPercentage(range, value) {\n", " return (value * (range[1] - range[0])) / 100 + range[0];\n", " }\n", " function getJ(value, arr) {\n", " var j = 1;\n", " while (value >= arr[j]) {\n", " j += 1;\n", " }\n", " return j;\n", " }\n", " // (percentage) Input a value, find where, on a scale of 0-100, it applies.\n", " function toStepping(xVal, xPct, value) {\n", " if (value >= xVal.slice(-1)[0]) {\n", " return 100;\n", " }\n", " var j = getJ(value, xVal);\n", " var va = xVal[j - 1];\n", " var vb = xVal[j];\n", " var pa = xPct[j - 1];\n", " var pb = xPct[j];\n", " return pa + toPercentage([va, vb], value) / subRangeRatio(pa, pb);\n", " }\n", " // (value) Input a percentage, find where it is on the specified range.\n", " function fromStepping(xVal, xPct, value) {\n", " // There is no range group that fits 100\n", " if (value >= 100) {\n", " return xVal.slice(-1)[0];\n", " }\n", " var j = getJ(value, xPct);\n", " var va = xVal[j - 1];\n", " var vb = xVal[j];\n", " var pa = xPct[j - 1];\n", " var pb = xPct[j];\n", " return isPercentage([va, vb], (value - pa) * subRangeRatio(pa, pb));\n", " }\n", " // (percentage) Get the step that applies at a certain value.\n", " function getStep(xPct, xSteps, snap, value) {\n", " if (value === 100) {\n", " return value;\n", " }\n", " var j = getJ(value, xPct);\n", " var a = xPct[j - 1];\n", " var b = xPct[j];\n", " // If 'snap' is set, steps are used as fixed points on the slider.\n", " if (snap) {\n", " // Find the closest position, a or b.\n", " if (value - a > (b - a) / 2) {\n", " return b;\n", " }\n", " return a;\n", " }\n", " if (!xSteps[j - 1]) {\n", " return value;\n", " }\n", " return xPct[j - 1] + closest(value - xPct[j - 1], xSteps[j - 1]);\n", " }\n", " function handleEntryPoint(index, value, that) {\n", " var percentage;\n", " // Wrap numerical input in an array.\n", " if (typeof value === \"number\") {\n", " value = [value];\n", " }\n", " // Reject any invalid input, by testing whether value is an array.\n", " if (!Array.isArray(value)) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'range' contains invalid value.\");\n", " }\n", " // Covert min/max syntax to 0 and 100.\n", " if (index === \"min\") {\n", " percentage = 0;\n", " }\n", " else if (index === \"max\") {\n", " percentage = 100;\n", " }\n", " else {\n", " percentage = parseFloat(index);\n", " }\n", " // Check for correct input.\n", " if (!isNumeric(percentage) || !isNumeric(value[0])) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'range' value isn't numeric.\");\n", " }\n", " // Store values.\n", " that.xPct.push(percentage);\n", " that.xVal.push(value[0]);\n", " // NaN will evaluate to false too, but to keep\n", " // logging clear, set step explicitly. Make sure\n", " // not to override the 'step' setting with false.\n", " if (!percentage) {\n", " if (!isNaN(value[1])) {\n", " that.xSteps[0] = value[1];\n", " }\n", " }\n", " else {\n", " that.xSteps.push(isNaN(value[1]) ? false : value[1]);\n", " }\n", " that.xHighestCompleteStep.push(0);\n", " }\n", " function handleStepPoint(i, n, that) {\n", " // Ignore 'false' stepping.\n", " if (!n) {\n", " return;\n", " }\n", " // Step over zero-length ranges (#948);\n", " if (that.xVal[i] === that.xVal[i + 1]) {\n", " that.xSteps[i] = that.xHighestCompleteStep[i] = that.xVal[i];\n", " return;\n", " }\n", " // Factor to range ratio\n", " that.xSteps[i] =\n", " fromPercentage([that.xVal[i], that.xVal[i + 1]], n, 0) / subRangeRatio(that.xPct[i], that.xPct[i + 1]);\n", " var totalSteps = (that.xVal[i + 1] - that.xVal[i]) / that.xNumSteps[i];\n", " var highestStep = Math.ceil(Number(totalSteps.toFixed(3)) - 1);\n", " var step = that.xVal[i] + that.xNumSteps[i] * highestStep;\n", " that.xHighestCompleteStep[i] = step;\n", " }\n", " //endregion\n", " //region Spectrum\n", " function Spectrum(entry, snap, singleStep) {\n", " this.xPct = [];\n", " this.xVal = [];\n", " this.xSteps = [singleStep || false];\n", " this.xNumSteps = [false];\n", " this.xHighestCompleteStep = [];\n", " this.snap = snap;\n", " var index;\n", " var ordered = []; // [0, 'min'], [1, '50%'], [2, 'max']\n", " // Map the object keys to an array.\n", " for (index in entry) {\n", " if (entry.hasOwnProperty(index)) {\n", " ordered.push([entry[index], index]);\n", " }\n", " }\n", " // Sort all entries by value (numeric sort).\n", " if (ordered.length && typeof ordered[0][0] === \"object\") {\n", " ordered.sort(function (a, b) {\n", " return a[0][0] - b[0][0];\n", " });\n", " }\n", " else {\n", " ordered.sort(function (a, b) {\n", " return a[0] - b[0];\n", " });\n", " }\n", " // Convert all entries to subranges.\n", " for (index = 0; index < ordered.length; index++) {\n", " handleEntryPoint(ordered[index][1], ordered[index][0], this);\n", " }\n", " // Store the actual step values.\n", " // xSteps is sorted in the same order as xPct and xVal.\n", " this.xNumSteps = this.xSteps.slice(0);\n", " // Convert all numeric steps to the percentage of the subrange they represent.\n", " for (index = 0; index < this.xNumSteps.length; index++) {\n", " handleStepPoint(index, this.xNumSteps[index], this);\n", " }\n", " }\n", " Spectrum.prototype.getDistance = function (value) {\n", " var index;\n", " var distances = [];\n", " for (index = 0; index < this.xNumSteps.length - 1; index++) {\n", " // last \"range\" can't contain step size as it is purely an endpoint.\n", " var step = this.xNumSteps[index];\n", " if (step && (value / step) % 1 !== 0) {\n", " throw new Error(\"noUiSlider (\" +\n", " VERSION +\n", " \"): 'limit', 'margin' and 'padding' of \" +\n", " this.xPct[index] +\n", " \"% range must be divisible by step.\");\n", " }\n", " // Calculate percentual distance in current range of limit, margin or padding\n", " distances[index] = fromPercentage(this.xVal, value, index);\n", " }\n", " return distances;\n", " };\n", " // Calculate the percentual distance over the whole scale of ranges.\n", " // direction: 0 = backwards / 1 = forwards\n", " Spectrum.prototype.getAbsoluteDistance = function (value, distances, direction) {\n", " var xPct_index = 0;\n", " // Calculate range where to start calculation\n", " if (value < this.xPct[this.xPct.length - 1]) {\n", " while (value > this.xPct[xPct_index + 1]) {\n", " xPct_index++;\n", " }\n", " }\n", " else if (value === this.xPct[this.xPct.length - 1]) {\n", " xPct_index = this.xPct.length - 2;\n", " }\n", " // If looking backwards and the value is exactly at a range separator then look one range further\n", " if (!direction && value === this.xPct[xPct_index + 1]) {\n", " xPct_index++;\n", " }\n", " var start_factor;\n", " var rest_factor = 1;\n", " var rest_rel_distance = distances[xPct_index];\n", " var range_pct = 0;\n", " var rel_range_distance = 0;\n", " var abs_distance_counter = 0;\n", " var range_counter = 0;\n", " // Calculate what part of the start range the value is\n", " if (direction) {\n", " start_factor = (value - this.xPct[xPct_index]) / (this.xPct[xPct_index + 1] - this.xPct[xPct_index]);\n", " }\n", " else {\n", " start_factor = (this.xPct[xPct_index + 1] - value) / (this.xPct[xPct_index + 1] - this.xPct[xPct_index]);\n", " }\n", " // Do until the complete distance across ranges is calculated\n", " while (rest_rel_distance > 0) {\n", " // Calculate the percentage of total range\n", " range_pct = this.xPct[xPct_index + 1 + range_counter] - this.xPct[xPct_index + range_counter];\n", " // Detect if the margin, padding or limit is larger then the current range and calculate\n", " if (distances[xPct_index + range_counter] * rest_factor + 100 - start_factor * 100 > 100) {\n", " // If larger then take the percentual distance of the whole range\n", " rel_range_distance = range_pct * start_factor;\n", " // Rest factor of relative percentual distance still to be calculated\n", " rest_factor = (rest_rel_distance - 100 * start_factor) / distances[xPct_index + range_counter];\n", " // Set start factor to 1 as for next range it does not apply.\n", " start_factor = 1;\n", " }\n", " else {\n", " // If smaller or equal then take the percentual distance of the calculate percentual part of that range\n", " rel_range_distance = ((distances[xPct_index + range_counter] * range_pct) / 100) * rest_factor;\n", " // No rest left as the rest fits in current range\n", " rest_factor = 0;\n", " }\n", " if (direction) {\n", " abs_distance_counter = abs_distance_counter - rel_range_distance;\n", " // Limit range to first range when distance becomes outside of minimum range\n", " if (this.xPct.length + range_counter >= 1) {\n", " range_counter--;\n", " }\n", " }\n", " else {\n", " abs_distance_counter = abs_distance_counter + rel_range_distance;\n", " // Limit range to last range when distance becomes outside of maximum range\n", " if (this.xPct.length - range_counter >= 1) {\n", " range_counter++;\n", " }\n", " }\n", " // Rest of relative percentual distance still to be calculated\n", " rest_rel_distance = distances[xPct_index + range_counter] * rest_factor;\n", " }\n", " return value + abs_distance_counter;\n", " };\n", " Spectrum.prototype.toStepping = function (value) {\n", " value = toStepping(this.xVal, this.xPct, value);\n", " return value;\n", " };\n", " Spectrum.prototype.fromStepping = function (value) {\n", " return fromStepping(this.xVal, this.xPct, value);\n", " };\n", " Spectrum.prototype.getStep = function (value) {\n", " value = getStep(this.xPct, this.xSteps, this.snap, value);\n", " return value;\n", " };\n", " Spectrum.prototype.getDefaultStep = function (value, isDown, size) {\n", " var j = getJ(value, this.xPct);\n", " // When at the top or stepping down, look at the previous sub-range\n", " if (value === 100 || (isDown && value === this.xPct[j - 1])) {\n", " j = Math.max(j - 1, 1);\n", " }\n", " return (this.xVal[j] - this.xVal[j - 1]) / size;\n", " };\n", " Spectrum.prototype.getNearbySteps = function (value) {\n", " var j = getJ(value, this.xPct);\n", " return {\n", " stepBefore: {\n", " startValue: this.xVal[j - 2],\n", " step: this.xNumSteps[j - 2],\n", " highestStep: this.xHighestCompleteStep[j - 2]\n", " },\n", " thisStep: {\n", " startValue: this.xVal[j - 1],\n", " step: this.xNumSteps[j - 1],\n", " highestStep: this.xHighestCompleteStep[j - 1]\n", " },\n", " stepAfter: {\n", " startValue: this.xVal[j],\n", " step: this.xNumSteps[j],\n", " highestStep: this.xHighestCompleteStep[j]\n", " }\n", " };\n", " };\n", " Spectrum.prototype.countStepDecimals = function () {\n", " var stepDecimals = this.xNumSteps.map(countDecimals);\n", " return Math.max.apply(null, stepDecimals);\n", " };\n", " // Outside testing\n", " Spectrum.prototype.convert = function (value) {\n", " return this.getStep(this.toStepping(value));\n", " };\n", " //endregion\n", " //region Options\n", " /*\tEvery input option is tested and parsed. This'll prevent\n", " endless validation in internal methods. These tests are\n", " structured with an item for every option available. An\n", " option can be marked as required by setting the 'r' flag.\n", " The testing function is provided with three arguments:\n", " - The provided value for the option;\n", " - A reference to the options object;\n", " - The name for the option;\n", " \n", " The testing function returns false when an error is detected,\n", " or true when everything is OK. It can also modify the option\n", " object, to make sure all values can be correctly looped elsewhere. */\n", " //region Defaults\n", " var defaultFormatter = {\n", " to: function (value) {\n", " return value !== undefined && value.toFixed(2);\n", " },\n", " from: Number\n", " };\n", " var cssClasses = {\n", " target: \"target\",\n", " base: \"base\",\n", " origin: \"origin\",\n", " handle: \"handle\",\n", " handleLower: \"handle-lower\",\n", " handleUpper: \"handle-upper\",\n", " touchArea: \"touch-area\",\n", " horizontal: \"horizontal\",\n", " vertical: \"vertical\",\n", " background: \"background\",\n", " connect: \"connect\",\n", " connects: \"connects\",\n", " ltr: \"ltr\",\n", " rtl: \"rtl\",\n", " textDirectionLtr: \"txt-dir-ltr\",\n", " textDirectionRtl: \"txt-dir-rtl\",\n", " draggable: \"draggable\",\n", " drag: \"state-drag\",\n", " tap: \"state-tap\",\n", " active: \"active\",\n", " tooltip: \"tooltip\",\n", " pips: \"pips\",\n", " pipsHorizontal: \"pips-horizontal\",\n", " pipsVertical: \"pips-vertical\",\n", " marker: \"marker\",\n", " markerHorizontal: \"marker-horizontal\",\n", " markerVertical: \"marker-vertical\",\n", " markerNormal: \"marker-normal\",\n", " markerLarge: \"marker-large\",\n", " markerSub: \"marker-sub\",\n", " value: \"value\",\n", " valueHorizontal: \"value-horizontal\",\n", " valueVertical: \"value-vertical\",\n", " valueNormal: \"value-normal\",\n", " valueLarge: \"value-large\",\n", " valueSub: \"value-sub\"\n", " };\n", " //endregion\n", " function validateFormat(entry) {\n", " // Any object with a to and from method is supported.\n", " if (isValidFormatter(entry)) {\n", " return true;\n", " }\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'format' requires 'to' and 'from' methods.\");\n", " }\n", " function testStep(parsed, entry) {\n", " if (!isNumeric(entry)) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'step' is not numeric.\");\n", " }\n", " // The step option can still be used to set stepping\n", " // for linear sliders. Overwritten if set in 'range'.\n", " parsed.singleStep = entry;\n", " }\n", " function testRange(parsed, entry) {\n", " // Filter incorrect input.\n", " if (typeof entry !== \"object\" || Array.isArray(entry)) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'range' is not an object.\");\n", " }\n", " // Catch missing start or end.\n", " if (entry.min === undefined || entry.max === undefined) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): Missing 'min' or 'max' in 'range'.\");\n", " }\n", " // Catch equal start or end.\n", " if (entry.min === entry.max) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'range' 'min' and 'max' cannot be equal.\");\n", " }\n", " parsed.spectrum = new Spectrum(entry, parsed.snap, parsed.singleStep);\n", " }\n", " function testStart(parsed, entry) {\n", " entry = asArray(entry);\n", " // Validate input. Values aren't tested, as the public .val method\n", " // will always provide a valid location.\n", " if (!Array.isArray(entry) || !entry.length) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'start' option is incorrect.\");\n", " }\n", " // Store the number of handles.\n", " parsed.handles = entry.length;\n", " // When the slider is initialized, the .val method will\n", " // be called with the start options.\n", " parsed.start = entry;\n", " }\n", " function testSnap(parsed, entry) {\n", " // Enforce 100% stepping within subranges.\n", " parsed.snap = entry;\n", " if (typeof entry !== \"boolean\") {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'snap' option must be a boolean.\");\n", " }\n", " }\n", " function testAnimate(parsed, entry) {\n", " // Enforce 100% stepping within subranges.\n", " parsed.animate = entry;\n", " if (typeof entry !== \"boolean\") {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'animate' option must be a boolean.\");\n", " }\n", " }\n", " function testAnimationDuration(parsed, entry) {\n", " parsed.animationDuration = entry;\n", " if (typeof entry !== \"number\") {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'animationDuration' option must be a number.\");\n", " }\n", " }\n", " function testConnect(parsed, entry) {\n", " var connect = [false];\n", " var i;\n", " // Map legacy options\n", " if (entry === \"lower\") {\n", " entry = [true, false];\n", " }\n", " else if (entry === \"upper\") {\n", " entry = [false, true];\n", " }\n", " // Handle boolean options\n", " if (entry === true || entry === false) {\n", " for (i = 1; i < parsed.handles; i++) {\n", " connect.push(entry);\n", " }\n", " connect.push(false);\n", " }\n", " // Reject invalid input\n", " else if (!Array.isArray(entry) || !entry.length || entry.length !== parsed.handles + 1) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'connect' option doesn't match handle count.\");\n", " }\n", " else {\n", " connect = entry;\n", " }\n", " parsed.connect = connect;\n", " }\n", " function testOrientation(parsed, entry) {\n", " // Set orientation to an a numerical value for easy\n", " // array selection.\n", " switch (entry) {\n", " case \"horizontal\":\n", " parsed.ort = 0;\n", " break;\n", " case \"vertical\":\n", " parsed.ort = 1;\n", " break;\n", " default:\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'orientation' option is invalid.\");\n", " }\n", " }\n", " function testMargin(parsed, entry) {\n", " if (!isNumeric(entry)) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'margin' option must be numeric.\");\n", " }\n", " // Issue #582\n", " if (entry === 0) {\n", " return;\n", " }\n", " parsed.margin = parsed.spectrum.getDistance(entry);\n", " }\n", " function testLimit(parsed, entry) {\n", " if (!isNumeric(entry)) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'limit' option must be numeric.\");\n", " }\n", " parsed.limit = parsed.spectrum.getDistance(entry);\n", " if (!parsed.limit || parsed.handles < 2) {\n", " throw new Error(\"noUiSlider (\" +\n", " VERSION +\n", " \"): 'limit' option is only supported on linear sliders with 2 or more handles.\");\n", " }\n", " }\n", " function testPadding(parsed, entry) {\n", " var index;\n", " if (!isNumeric(entry) && !Array.isArray(entry)) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'padding' option must be numeric or array of exactly 2 numbers.\");\n", " }\n", " if (Array.isArray(entry) && !(entry.length === 2 || isNumeric(entry[0]) || isNumeric(entry[1]))) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'padding' option must be numeric or array of exactly 2 numbers.\");\n", " }\n", " if (entry === 0) {\n", " return;\n", " }\n", " if (!Array.isArray(entry)) {\n", " entry = [entry, entry];\n", " }\n", " // 'getDistance' returns false for invalid values.\n", " parsed.padding = [parsed.spectrum.getDistance(entry[0]), parsed.spectrum.getDistance(entry[1])];\n", " for (index = 0; index < parsed.spectrum.xNumSteps.length - 1; index++) {\n", " // last \"range\" can't contain step size as it is purely an endpoint.\n", " if (parsed.padding[0][index] < 0 || parsed.padding[1][index] < 0) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'padding' option must be a positive number(s).\");\n", " }\n", " }\n", " var totalPadding = entry[0] + entry[1];\n", " var firstValue = parsed.spectrum.xVal[0];\n", " var lastValue = parsed.spectrum.xVal[parsed.spectrum.xVal.length - 1];\n", " if (totalPadding / (lastValue - firstValue) > 1) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'padding' option must not exceed 100% of the range.\");\n", " }\n", " }\n", " function testDirection(parsed, entry) {\n", " // Set direction as a numerical value for easy parsing.\n", " // Invert connection for RTL sliders, so that the proper\n", " // handles get the connect/background classes.\n", " switch (entry) {\n", " case \"ltr\":\n", " parsed.dir = 0;\n", " break;\n", " case \"rtl\":\n", " parsed.dir = 1;\n", " break;\n", " default:\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'direction' option was not recognized.\");\n", " }\n", " }\n", " function testBehaviour(parsed, entry) {\n", " // Make sure the input is a string.\n", " if (typeof entry !== \"string\") {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'behaviour' must be a string containing options.\");\n", " }\n", " // Check if the string contains any keywords.\n", " // None are required.\n", " var tap = entry.indexOf(\"tap\") >= 0;\n", " var drag = entry.indexOf(\"drag\") >= 0;\n", " var fixed = entry.indexOf(\"fixed\") >= 0;\n", " var snap = entry.indexOf(\"snap\") >= 0;\n", " var hover = entry.indexOf(\"hover\") >= 0;\n", " var unconstrained = entry.indexOf(\"unconstrained\") >= 0;\n", " if (fixed) {\n", " if (parsed.handles !== 2) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'fixed' behaviour must be used with 2 handles\");\n", " }\n", " // Use margin to enforce fixed state\n", " testMargin(parsed, parsed.start[1] - parsed.start[0]);\n", " }\n", " if (unconstrained && (parsed.margin || parsed.limit)) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'unconstrained' behaviour cannot be used with margin or limit\");\n", " }\n", " parsed.events = {\n", " tap: tap || snap,\n", " drag: drag,\n", " fixed: fixed,\n", " snap: snap,\n", " hover: hover,\n", " unconstrained: unconstrained\n", " };\n", " }\n", " function testTooltips(parsed, entry) {\n", " if (entry === false) {\n", " return;\n", " }\n", " if (entry === true) {\n", " parsed.tooltips = [];\n", " for (var i = 0; i < parsed.handles; i++) {\n", " parsed.tooltips.push(true);\n", " }\n", " }\n", " else {\n", " parsed.tooltips = asArray(entry);\n", " if (parsed.tooltips.length !== parsed.handles) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): must pass a formatter for all handles.\");\n", " }\n", " parsed.tooltips.forEach(function (formatter) {\n", " if (typeof formatter !== \"boolean\" &&\n", " (typeof formatter !== \"object\" || typeof formatter.to !== \"function\")) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'tooltips' must be passed a formatter or 'false'.\");\n", " }\n", " });\n", " }\n", " }\n", " function testAriaFormat(parsed, entry) {\n", " parsed.ariaFormat = entry;\n", " validateFormat(entry);\n", " }\n", " function testFormat(parsed, entry) {\n", " parsed.format = entry;\n", " validateFormat(entry);\n", " }\n", " function testKeyboardSupport(parsed, entry) {\n", " parsed.keyboardSupport = entry;\n", " if (typeof entry !== \"boolean\") {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'keyboardSupport' option must be a boolean.\");\n", " }\n", " }\n", " function testDocumentElement(parsed, entry) {\n", " // This is an advanced option. Passed values are used without validation.\n", " parsed.documentElement = entry;\n", " }\n", " function testCssPrefix(parsed, entry) {\n", " if (typeof entry !== \"string\" && entry !== false) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'cssPrefix' must be a string or `false`.\");\n", " }\n", " parsed.cssPrefix = entry;\n", " }\n", " function testCssClasses(parsed, entry) {\n", " if (typeof entry !== \"object\") {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'cssClasses' must be an object.\");\n", " }\n", " if (typeof parsed.cssPrefix === \"string\") {\n", " parsed.cssClasses = {};\n", " for (var key in entry) {\n", " if (!entry.hasOwnProperty(key)) {\n", " continue;\n", " }\n", " parsed.cssClasses[key] = parsed.cssPrefix + entry[key];\n", " }\n", " }\n", " else {\n", " parsed.cssClasses = entry;\n", " }\n", " }\n", " // Test all developer settings and parse to assumption-safe values.\n", " function testOptions(options) {\n", " // To prove a fix for #537, freeze options here.\n", " // If the object is modified, an error will be thrown.\n", " // Object.freeze(options);\n", " var parsed = {\n", " margin: 0,\n", " limit: 0,\n", " padding: 0,\n", " animate: true,\n", " animationDuration: 300,\n", " ariaFormat: defaultFormatter,\n", " format: defaultFormatter\n", " };\n", " // Tests are executed in the order they are presented here.\n", " var tests = {\n", " step: { r: false, t: testStep },\n", " start: { r: true, t: testStart },\n", " connect: { r: true, t: testConnect },\n", " direction: { r: true, t: testDirection },\n", " snap: { r: false, t: testSnap },\n", " animate: { r: false, t: testAnimate },\n", " animationDuration: { r: false, t: testAnimationDuration },\n", " range: { r: true, t: testRange },\n", " orientation: { r: false, t: testOrientation },\n", " margin: { r: false, t: testMargin },\n", " limit: { r: false, t: testLimit },\n", " padding: { r: false, t: testPadding },\n", " behaviour: { r: true, t: testBehaviour },\n", " ariaFormat: { r: false, t: testAriaFormat },\n", " format: { r: false, t: testFormat },\n", " tooltips: { r: false, t: testTooltips },\n", " keyboardSupport: { r: true, t: testKeyboardSupport },\n", " documentElement: { r: false, t: testDocumentElement },\n", " cssPrefix: { r: true, t: testCssPrefix },\n", " cssClasses: { r: true, t: testCssClasses }\n", " };\n", " var defaults = {\n", " connect: false,\n", " direction: \"ltr\",\n", " behaviour: \"tap\",\n", " orientation: \"horizontal\",\n", " keyboardSupport: true,\n", " cssPrefix: \"noUi-\",\n", " cssClasses: cssClasses\n", " };\n", " // AriaFormat defaults to regular format, if any.\n", " if (options.format && !options.ariaFormat) {\n", " options.ariaFormat = options.format;\n", " }\n", " // Run all options through a testing mechanism to ensure correct\n", " // input. It should be noted that options might get modified to\n", " // be handled properly. E.g. wrapping integers in arrays.\n", " Object.keys(tests).forEach(function (name) {\n", " // If the option isn't set, but it is required, throw an error.\n", " if (!isSet(options[name]) && defaults[name] === undefined) {\n", " if (tests[name].r) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): '\" + name + \"' is required.\");\n", " }\n", " return true;\n", " }\n", " tests[name].t(parsed, !isSet(options[name]) ? defaults[name] : options[name]);\n", " });\n", " // Forward pips options\n", " parsed.pips = options.pips;\n", " // All recent browsers accept unprefixed transform.\n", " // We need -ms- for IE9 and -webkit- for older Android;\n", " // Assume use of -webkit- if unprefixed and -ms- are not supported.\n", " // https://caniuse.com/#feat=transforms2d\n", " var d = document.createElement(\"div\");\n", " var msPrefix = d.style.msTransform !== undefined;\n", " var noPrefix = d.style.transform !== undefined;\n", " parsed.transformRule = noPrefix ? \"transform\" : msPrefix ? \"msTransform\" : \"webkitTransform\";\n", " // Pips don't move, so we can place them using left/top.\n", " var styles = [[\"left\", \"top\"], [\"right\", \"bottom\"]];\n", " parsed.style = styles[parsed.dir][parsed.ort];\n", " return parsed;\n", " }\n", " //endregion\n", " function scope(target, options, originalOptions) {\n", " var actions = getActions();\n", " var supportsTouchActionNone = getSupportsTouchActionNone();\n", " var supportsPassive = supportsTouchActionNone && getSupportsPassive();\n", " // All variables local to 'scope' are prefixed with 'scope_'\n", " // Slider DOM Nodes\n", " var scope_Target = target;\n", " var scope_Base;\n", " var scope_Handles;\n", " var scope_Connects;\n", " var scope_Pips;\n", " var scope_Tooltips;\n", " // Slider state values\n", " var scope_Spectrum = options.spectrum;\n", " var scope_Values = [];\n", " var scope_Locations = [];\n", " var scope_HandleNumbers = [];\n", " var scope_ActiveHandlesCount = 0;\n", " var scope_Events = {};\n", " // Exposed API\n", " var scope_Self;\n", " // Document Nodes\n", " var scope_Document = target.ownerDocument;\n", " var scope_DocumentElement = options.documentElement || scope_Document.documentElement;\n", " var scope_Body = scope_Document.body;\n", " // Pips constants\n", " var PIPS_NONE = -1;\n", " var PIPS_NO_VALUE = 0;\n", " var PIPS_LARGE_VALUE = 1;\n", " var PIPS_SMALL_VALUE = 2;\n", " // For horizontal sliders in standard ltr documents,\n", " // make .noUi-origin overflow to the left so the document doesn't scroll.\n", " var scope_DirOffset = scope_Document.dir === \"rtl\" || options.ort === 1 ? 0 : 100;\n", " // Creates a node, adds it to target, returns the new node.\n", " function addNodeTo(addTarget, className) {\n", " var div = scope_Document.createElement(\"div\");\n", " if (className) {\n", " addClass(div, className);\n", " }\n", " addTarget.appendChild(div);\n", " return div;\n", " }\n", " // Append a origin to the base\n", " function addOrigin(base, handleNumber) {\n", " var origin = addNodeTo(base, options.cssClasses.origin);\n", " var handle = addNodeTo(origin, options.cssClasses.handle);\n", " addNodeTo(handle, options.cssClasses.touchArea);\n", " handle.setAttribute(\"data-handle\", handleNumber);\n", " if (options.keyboardSupport) {\n", " // https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex\n", " // 0 = focusable and reachable\n", " handle.setAttribute(\"tabindex\", \"0\");\n", " handle.addEventListener(\"keydown\", function (event) {\n", " return eventKeydown(event, handleNumber);\n", " });\n", " }\n", " handle.setAttribute(\"role\", \"slider\");\n", " handle.setAttribute(\"aria-orientation\", options.ort ? \"vertical\" : \"horizontal\");\n", " if (handleNumber === 0) {\n", " addClass(handle, options.cssClasses.handleLower);\n", " }\n", " else if (handleNumber === options.handles - 1) {\n", " addClass(handle, options.cssClasses.handleUpper);\n", " }\n", " return origin;\n", " }\n", " // Insert nodes for connect elements\n", " function addConnect(base, add) {\n", " if (!add) {\n", " return false;\n", " }\n", " return addNodeTo(base, options.cssClasses.connect);\n", " }\n", " // Add handles to the slider base.\n", " function addElements(connectOptions, base) {\n", " var connectBase = addNodeTo(base, options.cssClasses.connects);\n", " scope_Handles = [];\n", " scope_Connects = [];\n", " scope_Connects.push(addConnect(connectBase, connectOptions[0]));\n", " // [::::O====O====O====]\n", " // connectOptions = [0, 1, 1, 1]\n", " for (var i = 0; i < options.handles; i++) {\n", " // Keep a list of all added handles.\n", " scope_Handles.push(addOrigin(base, i));\n", " scope_HandleNumbers[i] = i;\n", " scope_Connects.push(addConnect(connectBase, connectOptions[i + 1]));\n", " }\n", " }\n", " // Initialize a single slider.\n", " function addSlider(addTarget) {\n", " // Apply classes and data to the target.\n", " addClass(addTarget, options.cssClasses.target);\n", " if (options.dir === 0) {\n", " addClass(addTarget, options.cssClasses.ltr);\n", " }\n", " else {\n", " addClass(addTarget, options.cssClasses.rtl);\n", " }\n", " if (options.ort === 0) {\n", " addClass(addTarget, options.cssClasses.horizontal);\n", " }\n", " else {\n", " addClass(addTarget, options.cssClasses.vertical);\n", " }\n", " var textDirection = getComputedStyle(addTarget).direction;\n", " if (textDirection === \"rtl\") {\n", " addClass(addTarget, options.cssClasses.textDirectionRtl);\n", " }\n", " else {\n", " addClass(addTarget, options.cssClasses.textDirectionLtr);\n", " }\n", " return addNodeTo(addTarget, options.cssClasses.base);\n", " }\n", " function addTooltip(handle, handleNumber) {\n", " if (!options.tooltips[handleNumber]) {\n", " return false;\n", " }\n", " return addNodeTo(handle.firstChild, options.cssClasses.tooltip);\n", " }\n", " function isSliderDisabled() {\n", " return scope_Target.hasAttribute(\"disabled\");\n", " }\n", " // Disable the slider dragging if any handle is disabled\n", " function isHandleDisabled(handleNumber) {\n", " var handleOrigin = scope_Handles[handleNumber];\n", " return handleOrigin.hasAttribute(\"disabled\");\n", " }\n", " function removeTooltips() {\n", " if (scope_Tooltips) {\n", " removeEvent(\"update.tooltips\");\n", " scope_Tooltips.forEach(function (tooltip) {\n", " if (tooltip) {\n", " removeElement(tooltip);\n", " }\n", " });\n", " scope_Tooltips = null;\n", " }\n", " }\n", " // The tooltips option is a shorthand for using the 'update' event.\n", " function tooltips() {\n", " removeTooltips();\n", " // Tooltips are added with options.tooltips in original order.\n", " scope_Tooltips = scope_Handles.map(addTooltip);\n", " bindEvent(\"update.tooltips\", function (values, handleNumber, unencoded) {\n", " if (!scope_Tooltips[handleNumber]) {\n", " return;\n", " }\n", " var formattedValue = values[handleNumber];\n", " if (options.tooltips[handleNumber] !== true) {\n", " formattedValue = options.tooltips[handleNumber].to(unencoded[handleNumber]);\n", " }\n", " scope_Tooltips[handleNumber].innerHTML = formattedValue;\n", " });\n", " }\n", " function aria() {\n", " bindEvent(\"update\", function (values, handleNumber, unencoded, tap, positions) {\n", " // Update Aria Values for all handles, as a change in one changes min and max values for the next.\n", " scope_HandleNumbers.forEach(function (index) {\n", " var handle = scope_Handles[index];\n", " var min = checkHandlePosition(scope_Locations, index, 0, true, true, true);\n", " var max = checkHandlePosition(scope_Locations, index, 100, true, true, true);\n", " var now = positions[index];\n", " // Formatted value for display\n", " var text = options.ariaFormat.to(unencoded[index]);\n", " // Map to slider range values\n", " min = scope_Spectrum.fromStepping(min).toFixed(1);\n", " max = scope_Spectrum.fromStepping(max).toFixed(1);\n", " now = scope_Spectrum.fromStepping(now).toFixed(1);\n", " handle.children[0].setAttribute(\"aria-valuemin\", min);\n", " handle.children[0].setAttribute(\"aria-valuemax\", max);\n", " handle.children[0].setAttribute(\"aria-valuenow\", now);\n", " handle.children[0].setAttribute(\"aria-valuetext\", text);\n", " });\n", " });\n", " }\n", " function getGroup(mode, values, stepped) {\n", " // Use the range.\n", " if (mode === \"range\" || mode === \"steps\") {\n", " return scope_Spectrum.xVal;\n", " }\n", " if (mode === \"count\") {\n", " if (values < 2) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'values' (>= 2) required for mode 'count'.\");\n", " }\n", " // Divide 0 - 100 in 'count' parts.\n", " var interval = values - 1;\n", " var spread = 100 / interval;\n", " values = [];\n", " // List these parts and have them handled as 'positions'.\n", " while (interval--) {\n", " values[interval] = interval * spread;\n", " }\n", " values.push(100);\n", " mode = \"positions\";\n", " }\n", " if (mode === \"positions\") {\n", " // Map all percentages to on-range values.\n", " return values.map(function (value) {\n", " return scope_Spectrum.fromStepping(stepped ? scope_Spectrum.getStep(value) : value);\n", " });\n", " }\n", " if (mode === \"values\") {\n", " // If the value must be stepped, it needs to be converted to a percentage first.\n", " if (stepped) {\n", " return values.map(function (value) {\n", " // Convert to percentage, apply step, return to value.\n", " return scope_Spectrum.fromStepping(scope_Spectrum.getStep(scope_Spectrum.toStepping(value)));\n", " });\n", " }\n", " // Otherwise, we can simply use the values.\n", " return values;\n", " }\n", " }\n", " function generateSpread(density, mode, group) {\n", " function safeIncrement(value, increment) {\n", " // Avoid floating point variance by dropping the smallest decimal places.\n", " return (value + increment).toFixed(7) / 1;\n", " }\n", " var indexes = {};\n", " var firstInRange = scope_Spectrum.xVal[0];\n", " var lastInRange = scope_Spectrum.xVal[scope_Spectrum.xVal.length - 1];\n", " var ignoreFirst = false;\n", " var ignoreLast = false;\n", " var prevPct = 0;\n", " // Create a copy of the group, sort it and filter away all duplicates.\n", " group = unique(group.slice().sort(function (a, b) {\n", " return a - b;\n", " }));\n", " // Make sure the range starts with the first element.\n", " if (group[0] !== firstInRange) {\n", " group.unshift(firstInRange);\n", " ignoreFirst = true;\n", " }\n", " // Likewise for the last one.\n", " if (group[group.length - 1] !== lastInRange) {\n", " group.push(lastInRange);\n", " ignoreLast = true;\n", " }\n", " group.forEach(function (current, index) {\n", " // Get the current step and the lower + upper positions.\n", " var step;\n", " var i;\n", " var q;\n", " var low = current;\n", " var high = group[index + 1];\n", " var newPct;\n", " var pctDifference;\n", " var pctPos;\n", " var type;\n", " var steps;\n", " var realSteps;\n", " var stepSize;\n", " var isSteps = mode === \"steps\";\n", " // When using 'steps' mode, use the provided steps.\n", " // Otherwise, we'll step on to the next subrange.\n", " if (isSteps) {\n", " step = scope_Spectrum.xNumSteps[index];\n", " }\n", " // Default to a 'full' step.\n", " if (!step) {\n", " step = high - low;\n", " }\n", " // Low can be 0, so test for false. If high is undefined,\n", " // we are at the last subrange. Index 0 is already handled.\n", " if (low === false || high === undefined) {\n", " return;\n", " }\n", " // Make sure step isn't 0, which would cause an infinite loop (#654)\n", " step = Math.max(step, 0.0000001);\n", " // Find all steps in the subrange.\n", " for (i = low; i <= high; i = safeIncrement(i, step)) {\n", " // Get the percentage value for the current step,\n", " // calculate the size for the subrange.\n", " newPct = scope_Spectrum.toStepping(i);\n", " pctDifference = newPct - prevPct;\n", " steps = pctDifference / density;\n", " realSteps = Math.round(steps);\n", " // This ratio represents the amount of percentage-space a point indicates.\n", " // For a density 1 the points/percentage = 1. For density 2, that percentage needs to be re-divided.\n", " // Round the percentage offset to an even number, then divide by two\n", " // to spread the offset on both sides of the range.\n", " stepSize = pctDifference / realSteps;\n", " // Divide all points evenly, adding the correct number to this subrange.\n", " // Run up to <= so that 100% gets a point, event if ignoreLast is set.\n", " for (q = 1; q <= realSteps; q += 1) {\n", " // The ratio between the rounded value and the actual size might be ~1% off.\n", " // Correct the percentage offset by the number of points\n", " // per subrange. density = 1 will result in 100 points on the\n", " // full range, 2 for 50, 4 for 25, etc.\n", " pctPos = prevPct + q * stepSize;\n", " indexes[pctPos.toFixed(5)] = [scope_Spectrum.fromStepping(pctPos), 0];\n", " }\n", " // Determine the point type.\n", " type = group.indexOf(i) > -1 ? PIPS_LARGE_VALUE : isSteps ? PIPS_SMALL_VALUE : PIPS_NO_VALUE;\n", " // Enforce the 'ignoreFirst' option by overwriting the type for 0.\n", " if (!index && ignoreFirst && i !== high) {\n", " type = 0;\n", " }\n", " if (!(i === high && ignoreLast)) {\n", " // Mark the 'type' of this point. 0 = plain, 1 = real value, 2 = step value.\n", " indexes[newPct.toFixed(5)] = [i, type];\n", " }\n", " // Update the percentage count.\n", " prevPct = newPct;\n", " }\n", " });\n", " return indexes;\n", " }\n", " function addMarking(spread, filterFunc, formatter) {\n", " var element = scope_Document.createElement(\"div\");\n", " var valueSizeClasses = [];\n", " valueSizeClasses[PIPS_NO_VALUE] = options.cssClasses.valueNormal;\n", " valueSizeClasses[PIPS_LARGE_VALUE] = options.cssClasses.valueLarge;\n", " valueSizeClasses[PIPS_SMALL_VALUE] = options.cssClasses.valueSub;\n", " var markerSizeClasses = [];\n", " markerSizeClasses[PIPS_NO_VALUE] = options.cssClasses.markerNormal;\n", " markerSizeClasses[PIPS_LARGE_VALUE] = options.cssClasses.markerLarge;\n", " markerSizeClasses[PIPS_SMALL_VALUE] = options.cssClasses.markerSub;\n", " var valueOrientationClasses = [options.cssClasses.valueHorizontal, options.cssClasses.valueVertical];\n", " var markerOrientationClasses = [options.cssClasses.markerHorizontal, options.cssClasses.markerVertical];\n", " addClass(element, options.cssClasses.pips);\n", " addClass(element, options.ort === 0 ? options.cssClasses.pipsHorizontal : options.cssClasses.pipsVertical);\n", " function getClasses(type, source) {\n", " var a = source === options.cssClasses.value;\n", " var orientationClasses = a ? valueOrientationClasses : markerOrientationClasses;\n", " var sizeClasses = a ? valueSizeClasses : markerSizeClasses;\n", " return source + \" \" + orientationClasses[options.ort] + \" \" + sizeClasses[type];\n", " }\n", " function addSpread(offset, value, type) {\n", " // Apply the filter function, if it is set.\n", " type = filterFunc ? filterFunc(value, type) : type;\n", " if (type === PIPS_NONE) {\n", " return;\n", " }\n", " // Add a marker for every point\n", " var node = addNodeTo(element, false);\n", " node.className = getClasses(type, options.cssClasses.marker);\n", " node.style[options.style] = offset + \"%\";\n", " // Values are only appended for points marked '1' or '2'.\n", " if (type > PIPS_NO_VALUE) {\n", " node = addNodeTo(element, false);\n", " node.className = getClasses(type, options.cssClasses.value);\n", " node.setAttribute(\"data-value\", value);\n", " node.style[options.style] = offset + \"%\";\n", " node.innerHTML = formatter.to(value);\n", " }\n", " }\n", " // Append all points.\n", " Object.keys(spread).forEach(function (offset) {\n", " addSpread(offset, spread[offset][0], spread[offset][1]);\n", " });\n", " return element;\n", " }\n", " function removePips() {\n", " if (scope_Pips) {\n", " removeElement(scope_Pips);\n", " scope_Pips = null;\n", " }\n", " }\n", " function pips(grid) {\n", " // Fix #669\n", " removePips();\n", " var mode = grid.mode;\n", " var density = grid.density || 1;\n", " var filter = grid.filter || false;\n", " var values = grid.values || false;\n", " var stepped = grid.stepped || false;\n", " var group = getGroup(mode, values, stepped);\n", " var spread = generateSpread(density, mode, group);\n", " var format = grid.format || {\n", " to: Math.round\n", " };\n", " scope_Pips = scope_Target.appendChild(addMarking(spread, filter, format));\n", " return scope_Pips;\n", " }\n", " // Shorthand for base dimensions.\n", " function baseSize() {\n", " var rect = scope_Base.getBoundingClientRect();\n", " var alt = \"offset\" + [\"Width\", \"Height\"][options.ort];\n", " return options.ort === 0 ? rect.width || scope_Base[alt] : rect.height || scope_Base[alt];\n", " }\n", " // Handler for attaching events trough a proxy.\n", " function attachEvent(events, element, callback, data) {\n", " // This function can be used to 'filter' events to the slider.\n", " // element is a node, not a nodeList\n", " var method = function (e) {\n", " e = fixEvent(e, data.pageOffset, data.target || element);\n", " // fixEvent returns false if this event has a different target\n", " // when handling (multi-) touch events;\n", " if (!e) {\n", " return false;\n", " }\n", " // doNotReject is passed by all end events to make sure released touches\n", " // are not rejected, leaving the slider \"stuck\" to the cursor;\n", " if (isSliderDisabled() && !data.doNotReject) {\n", " return false;\n", " }\n", " // Stop if an active 'tap' transition is taking place.\n", " if (hasClass(scope_Target, options.cssClasses.tap) && !data.doNotReject) {\n", " return false;\n", " }\n", " // Ignore right or middle clicks on start #454\n", " if (events === actions.start && e.buttons !== undefined && e.buttons > 1) {\n", " return false;\n", " }\n", " // Ignore right or middle clicks on start #454\n", " if (data.hover && e.buttons) {\n", " return false;\n", " }\n", " // 'supportsPassive' is only true if a browser also supports touch-action: none in CSS.\n", " // iOS safari does not, so it doesn't get to benefit from passive scrolling. iOS does support\n", " // touch-action: manipulation, but that allows panning, which breaks\n", " // sliders after zooming/on non-responsive pages.\n", " // See: https://bugs.webkit.org/show_bug.cgi?id=133112\n", " if (!supportsPassive) {\n", " e.preventDefault();\n", " }\n", " e.calcPoint = e.points[options.ort];\n", " // Call the event handler with the event [ and additional data ].\n", " callback(e, data);\n", " };\n", " var methods = [];\n", " // Bind a closure on the target for every event type.\n", " events.split(\" \").forEach(function (eventName) {\n", " element.addEventListener(eventName, method, supportsPassive ? { passive: true } : false);\n", " methods.push([eventName, method]);\n", " });\n", " return methods;\n", " }\n", " // Provide a clean event with standardized offset values.\n", " function fixEvent(e, pageOffset, eventTarget) {\n", " // Filter the event to register the type, which can be\n", " // touch, mouse or pointer. Offset changes need to be\n", " // made on an event specific basis.\n", " var touch = e.type.indexOf(\"touch\") === 0;\n", " var mouse = e.type.indexOf(\"mouse\") === 0;\n", " var pointer = e.type.indexOf(\"pointer\") === 0;\n", " var x;\n", " var y;\n", " // IE10 implemented pointer events with a prefix;\n", " if (e.type.indexOf(\"MSPointer\") === 0) {\n", " pointer = true;\n", " }\n", " // The only thing one handle should be concerned about is the touches that originated on top of it.\n", " if (touch) {\n", " // Returns true if a touch originated on the target.\n", " var isTouchOnTarget = function (checkTouch) {\n", " return (checkTouch.target === eventTarget ||\n", " eventTarget.contains(checkTouch.target) ||\n", " (checkTouch.target.shadowRoot && checkTouch.target.shadowRoot.contains(eventTarget)));\n", " };\n", " // In the case of touchstart events, we need to make sure there is still no more than one\n", " // touch on the target so we look amongst all touches.\n", " if (e.type === \"touchstart\") {\n", " var targetTouches = Array.prototype.filter.call(e.touches, isTouchOnTarget);\n", " // Do not support more than one touch per handle.\n", " if (targetTouches.length > 1) {\n", " return false;\n", " }\n", " x = targetTouches[0].pageX;\n", " y = targetTouches[0].pageY;\n", " }\n", " else {\n", " // In the other cases, find on changedTouches is enough.\n", " var targetTouch = Array.prototype.find.call(e.changedTouches, isTouchOnTarget);\n", " // Cancel if the target touch has not moved.\n", " if (!targetTouch) {\n", " return false;\n", " }\n", " x = targetTouch.pageX;\n", " y = targetTouch.pageY;\n", " }\n", " }\n", " pageOffset = pageOffset || getPageOffset(scope_Document);\n", " if (mouse || pointer) {\n", " x = e.clientX + pageOffset.x;\n", " y = e.clientY + pageOffset.y;\n", " }\n", " e.pageOffset = pageOffset;\n", " e.points = [x, y];\n", " e.cursor = mouse || pointer; // Fix #435\n", " return e;\n", " }\n", " // Translate a coordinate in the document to a percentage on the slider\n", " function calcPointToPercentage(calcPoint) {\n", " var location = calcPoint - offset(scope_Base, options.ort);\n", " var proposal = (location * 100) / baseSize();\n", " // Clamp proposal between 0% and 100%\n", " // Out-of-bound coordinates may occur when .noUi-base pseudo-elements\n", " // are used (e.g. contained handles feature)\n", " proposal = limit(proposal);\n", " return options.dir ? 100 - proposal : proposal;\n", " }\n", " // Find handle closest to a certain percentage on the slider\n", " function getClosestHandle(clickedPosition) {\n", " var smallestDifference = 100;\n", " var handleNumber = false;\n", " scope_Handles.forEach(function (handle, index) {\n", " // Disabled handles are ignored\n", " if (isHandleDisabled(index)) {\n", " return;\n", " }\n", " var handlePosition = scope_Locations[index];\n", " var differenceWithThisHandle = Math.abs(handlePosition - clickedPosition);\n", " // Initial state\n", " var clickAtEdge = differenceWithThisHandle === 100 && smallestDifference === 100;\n", " // Difference with this handle is smaller than the previously checked handle\n", " var isCloser = differenceWithThisHandle < smallestDifference;\n", " var isCloserAfter = differenceWithThisHandle <= smallestDifference && clickedPosition > handlePosition;\n", " if (isCloser || isCloserAfter || clickAtEdge) {\n", " handleNumber = index;\n", " smallestDifference = differenceWithThisHandle;\n", " }\n", " });\n", " return handleNumber;\n", " }\n", " // Fire 'end' when a mouse or pen leaves the document.\n", " function documentLeave(event, data) {\n", " if (event.type === \"mouseout\" && event.target.nodeName === \"HTML\" && event.relatedTarget === null) {\n", " eventEnd(event, data);\n", " }\n", " }\n", " // Handle movement on document for handle and range drag.\n", " function eventMove(event, data) {\n", " // Fix #498\n", " // Check value of .buttons in 'start' to work around a bug in IE10 mobile (data.buttonsProperty).\n", " // https://connect.microsoft.com/IE/feedback/details/927005/mobile-ie10-windows-phone-buttons-property-of-pointermove-event-always-zero\n", " // IE9 has .buttons and .which zero on mousemove.\n", " // Firefox breaks the spec MDN defines.\n", " if (navigator.appVersion.indexOf(\"MSIE 9\") === -1 && event.buttons === 0 && data.buttonsProperty !== 0) {\n", " return eventEnd(event, data);\n", " }\n", " // Check if we are moving up or down\n", " var movement = (options.dir ? -1 : 1) * (event.calcPoint - data.startCalcPoint);\n", " // Convert the movement into a percentage of the slider width/height\n", " var proposal = (movement * 100) / data.baseSize;\n", " moveHandles(movement > 0, proposal, data.locations, data.handleNumbers);\n", " }\n", " // Unbind move events on document, call callbacks.\n", " function eventEnd(event, data) {\n", " // The handle is no longer active, so remove the class.\n", " if (data.handle) {\n", " removeClass(data.handle, options.cssClasses.active);\n", " scope_ActiveHandlesCount -= 1;\n", " }\n", " // Unbind the move and end events, which are added on 'start'.\n", " data.listeners.forEach(function (c) {\n", " scope_DocumentElement.removeEventListener(c[0], c[1]);\n", " });\n", " if (scope_ActiveHandlesCount === 0) {\n", " // Remove dragging class.\n", " removeClass(scope_Target, options.cssClasses.drag);\n", " setZindex();\n", " // Remove cursor styles and text-selection events bound to the body.\n", " if (event.cursor) {\n", " scope_Body.style.cursor = \"\";\n", " scope_Body.removeEventListener(\"selectstart\", preventDefault);\n", " }\n", " }\n", " data.handleNumbers.forEach(function (handleNumber) {\n", " fireEvent(\"change\", handleNumber);\n", " fireEvent(\"set\", handleNumber);\n", " fireEvent(\"end\", handleNumber);\n", " });\n", " }\n", " // Bind move events on document.\n", " function eventStart(event, data) {\n", " // Ignore event if any handle is disabled\n", " if (data.handleNumbers.some(isHandleDisabled)) {\n", " return false;\n", " }\n", " var handle;\n", " if (data.handleNumbers.length === 1) {\n", " var handleOrigin = scope_Handles[data.handleNumbers[0]];\n", " handle = handleOrigin.children[0];\n", " scope_ActiveHandlesCount += 1;\n", " // Mark the handle as 'active' so it can be styled.\n", " addClass(handle, options.cssClasses.active);\n", " }\n", " // A drag should never propagate up to the 'tap' event.\n", " event.stopPropagation();\n", " // Record the event listeners.\n", " var listeners = [];\n", " // Attach the move and end events.\n", " var moveEvent = attachEvent(actions.move, scope_DocumentElement, eventMove, {\n", " // The event target has changed so we need to propagate the original one so that we keep\n", " // relying on it to extract target touches.\n", " target: event.target,\n", " handle: handle,\n", " listeners: listeners,\n", " startCalcPoint: event.calcPoint,\n", " baseSize: baseSize(),\n", " pageOffset: event.pageOffset,\n", " handleNumbers: data.handleNumbers,\n", " buttonsProperty: event.buttons,\n", " locations: scope_Locations.slice()\n", " });\n", " var endEvent = attachEvent(actions.end, scope_DocumentElement, eventEnd, {\n", " target: event.target,\n", " handle: handle,\n", " listeners: listeners,\n", " doNotReject: true,\n", " handleNumbers: data.handleNumbers\n", " });\n", " var outEvent = attachEvent(\"mouseout\", scope_DocumentElement, documentLeave, {\n", " target: event.target,\n", " handle: handle,\n", " listeners: listeners,\n", " doNotReject: true,\n", " handleNumbers: data.handleNumbers\n", " });\n", " // We want to make sure we pushed the listeners in the listener list rather than creating\n", " // a new one as it has already been passed to the event handlers.\n", " listeners.push.apply(listeners, moveEvent.concat(endEvent, outEvent));\n", " // Text selection isn't an issue on touch devices,\n", " // so adding cursor styles can be skipped.\n", " if (event.cursor) {\n", " // Prevent the 'I' cursor and extend the range-drag cursor.\n", " scope_Body.style.cursor = getComputedStyle(event.target).cursor;\n", " // Mark the target with a dragging state.\n", " if (scope_Handles.length > 1) {\n", " addClass(scope_Target, options.cssClasses.drag);\n", " }\n", " // Prevent text selection when dragging the handles.\n", " // In noUiSlider <= 9.2.0, this was handled by calling preventDefault on mouse/touch start/move,\n", " // which is scroll blocking. The selectstart event is supported by FireFox starting from version 52,\n", " // meaning the only holdout is iOS Safari. This doesn't matter: text selection isn't triggered there.\n", " // The 'cursor' flag is false.\n", " // See: http://caniuse.com/#search=selectstart\n", " scope_Body.addEventListener(\"selectstart\", preventDefault, false);\n", " }\n", " data.handleNumbers.forEach(function (handleNumber) {\n", " fireEvent(\"start\", handleNumber);\n", " });\n", " }\n", " // Move closest handle to tapped location.\n", " function eventTap(event) {\n", " // The tap event shouldn't propagate up\n", " event.stopPropagation();\n", " var proposal = calcPointToPercentage(event.calcPoint);\n", " var handleNumber = getClosestHandle(proposal);\n", " // Tackle the case that all handles are 'disabled'.\n", " if (handleNumber === false) {\n", " return false;\n", " }\n", " // Flag the slider as it is now in a transitional state.\n", " // Transition takes a configurable amount of ms (default 300). Re-enable the slider after that.\n", " if (!options.events.snap) {\n", " addClassFor(scope_Target, options.cssClasses.tap, options.animationDuration);\n", " }\n", " setHandle(handleNumber, proposal, true, true);\n", " setZindex();\n", " fireEvent(\"slide\", handleNumber, true);\n", " fireEvent(\"update\", handleNumber, true);\n", " fireEvent(\"change\", handleNumber, true);\n", " fireEvent(\"set\", handleNumber, true);\n", " if (options.events.snap) {\n", " eventStart(event, { handleNumbers: [handleNumber] });\n", " }\n", " }\n", " // Fires a 'hover' event for a hovered mouse/pen position.\n", " function eventHover(event) {\n", " var proposal = calcPointToPercentage(event.calcPoint);\n", " var to = scope_Spectrum.getStep(proposal);\n", " var value = scope_Spectrum.fromStepping(to);\n", " Object.keys(scope_Events).forEach(function (targetEvent) {\n", " if (\"hover\" === targetEvent.split(\".\")[0]) {\n", " scope_Events[targetEvent].forEach(function (callback) {\n", " callback.call(scope_Self, value);\n", " });\n", " }\n", " });\n", " }\n", " // Handles keydown on focused handles\n", " // Don't move the document when pressing arrow keys on focused handles\n", " function eventKeydown(event, handleNumber) {\n", " if (isSliderDisabled() || isHandleDisabled(handleNumber)) {\n", " return false;\n", " }\n", " var horizontalKeys = [\"Left\", \"Right\"];\n", " var verticalKeys = [\"Down\", \"Up\"];\n", " var largeStepKeys = [\"PageDown\", \"PageUp\"];\n", " var edgeKeys = [\"Home\", \"End\"];\n", " if (options.dir && !options.ort) {\n", " // On an right-to-left slider, the left and right keys act inverted\n", " horizontalKeys.reverse();\n", " }\n", " else if (options.ort && !options.dir) {\n", " // On a top-to-bottom slider, the up and down keys act inverted\n", " verticalKeys.reverse();\n", " largeStepKeys.reverse();\n", " }\n", " // Strip \"Arrow\" for IE compatibility. https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key\n", " var key = event.key.replace(\"Arrow\", \"\");\n", " var isLargeDown = key === largeStepKeys[0];\n", " var isLargeUp = key === largeStepKeys[1];\n", " var isDown = key === verticalKeys[0] || key === horizontalKeys[0] || isLargeDown;\n", " var isUp = key === verticalKeys[1] || key === horizontalKeys[1] || isLargeUp;\n", " var isMin = key === edgeKeys[0];\n", " var isMax = key === edgeKeys[1];\n", " if (!isDown && !isUp && !isMin && !isMax) {\n", " return true;\n", " }\n", " event.preventDefault();\n", " var to;\n", " if (isUp || isDown) {\n", " var multiplier = 5;\n", " var direction = isDown ? 0 : 1;\n", " var steps = getNextStepsForHandle(handleNumber);\n", " var step = steps[direction];\n", " // At the edge of a slider, do nothing\n", " if (step === null) {\n", " return false;\n", " }\n", " // No step set, use the default of 10% of the sub-range\n", " if (step === false) {\n", " step = scope_Spectrum.getDefaultStep(scope_Locations[handleNumber], isDown, 10);\n", " }\n", " if (isLargeUp || isLargeDown) {\n", " step *= multiplier;\n", " }\n", " // Step over zero-length ranges (#948);\n", " step = Math.max(step, 0.0000001);\n", " // Decrement for down steps\n", " step = (isDown ? -1 : 1) * step;\n", " to = scope_Values[handleNumber] + step;\n", " }\n", " else if (isMax) {\n", " // End key\n", " to = options.spectrum.xVal[options.spectrum.xVal.length - 1];\n", " }\n", " else {\n", " // Home key\n", " to = options.spectrum.xVal[0];\n", " }\n", " setHandle(handleNumber, scope_Spectrum.toStepping(to), true, true);\n", " fireEvent(\"slide\", handleNumber);\n", " fireEvent(\"update\", handleNumber);\n", " fireEvent(\"change\", handleNumber);\n", " fireEvent(\"set\", handleNumber);\n", " return false;\n", " }\n", " // Attach events to several slider parts.\n", " function bindSliderEvents(behaviour) {\n", " // Attach the standard drag event to the handles.\n", " if (!behaviour.fixed) {\n", " scope_Handles.forEach(function (handle, index) {\n", " // These events are only bound to the visual handle\n", " // element, not the 'real' origin element.\n", " attachEvent(actions.start, handle.children[0], eventStart, {\n", " handleNumbers: [index]\n", " });\n", " });\n", " }\n", " // Attach the tap event to the slider base.\n", " if (behaviour.tap) {\n", " attachEvent(actions.start, scope_Base, eventTap, {});\n", " }\n", " // Fire hover events\n", " if (behaviour.hover) {\n", " attachEvent(actions.move, scope_Base, eventHover, {\n", " hover: true\n", " });\n", " }\n", " // Make the range draggable.\n", " if (behaviour.drag) {\n", " scope_Connects.forEach(function (connect, index) {\n", " if (connect === false || index === 0 || index === scope_Connects.length - 1) {\n", " return;\n", " }\n", " var handleBefore = scope_Handles[index - 1];\n", " var handleAfter = scope_Handles[index];\n", " var eventHolders = [connect];\n", " addClass(connect, options.cssClasses.draggable);\n", " // When the range is fixed, the entire range can\n", " // be dragged by the handles. The handle in the first\n", " // origin will propagate the start event upward,\n", " // but it needs to be bound manually on the other.\n", " if (behaviour.fixed) {\n", " eventHolders.push(handleBefore.children[0]);\n", " eventHolders.push(handleAfter.children[0]);\n", " }\n", " eventHolders.forEach(function (eventHolder) {\n", " attachEvent(actions.start, eventHolder, eventStart, {\n", " handles: [handleBefore, handleAfter],\n", " handleNumbers: [index - 1, index]\n", " });\n", " });\n", " });\n", " }\n", " }\n", " // Attach an event to this slider, possibly including a namespace\n", " function bindEvent(namespacedEvent, callback) {\n", " scope_Events[namespacedEvent] = scope_Events[namespacedEvent] || [];\n", " scope_Events[namespacedEvent].push(callback);\n", " // If the event bound is 'update,' fire it immediately for all handles.\n", " if (namespacedEvent.split(\".\")[0] === \"update\") {\n", " scope_Handles.forEach(function (a, index) {\n", " fireEvent(\"update\", index);\n", " });\n", " }\n", " }\n", " // Undo attachment of event\n", " function removeEvent(namespacedEvent) {\n", " var event = namespacedEvent && namespacedEvent.split(\".\")[0];\n", " var namespace = event && namespacedEvent.substring(event.length);\n", " Object.keys(scope_Events).forEach(function (bind) {\n", " var tEvent = bind.split(\".\")[0];\n", " var tNamespace = bind.substring(tEvent.length);\n", " if ((!event || event === tEvent) && (!namespace || namespace === tNamespace)) {\n", " delete scope_Events[bind];\n", " }\n", " });\n", " }\n", " // External event handling\n", " function fireEvent(eventName, handleNumber, tap) {\n", " Object.keys(scope_Events).forEach(function (targetEvent) {\n", " var eventType = targetEvent.split(\".\")[0];\n", " if (eventName === eventType) {\n", " scope_Events[targetEvent].forEach(function (callback) {\n", " callback.call(\n", " // Use the slider public API as the scope ('this')\n", " scope_Self, \n", " // Return values as array, so arg_1[arg_2] is always valid.\n", " scope_Values.map(options.format.to), \n", " // Handle index, 0 or 1\n", " handleNumber, \n", " // Un-formatted slider values\n", " scope_Values.slice(), \n", " // Event is fired by tap, true or false\n", " tap || false, \n", " // Left offset of the handle, in relation to the slider\n", " scope_Locations.slice(), \n", " // add the slider public API to an accessible parameter when this is unavailable\n", " scope_Self);\n", " });\n", " }\n", " });\n", " }\n", " // Split out the handle positioning logic so the Move event can use it, too\n", " function checkHandlePosition(reference, handleNumber, to, lookBackward, lookForward, getValue) {\n", " var distance;\n", " // For sliders with multiple handles, limit movement to the other handle.\n", " // Apply the margin option by adding it to the handle positions.\n", " if (scope_Handles.length > 1 && !options.events.unconstrained) {\n", " if (lookBackward && handleNumber > 0) {\n", " distance = scope_Spectrum.getAbsoluteDistance(reference[handleNumber - 1], options.margin, 0);\n", " to = Math.max(to, distance);\n", " }\n", " if (lookForward && handleNumber < scope_Handles.length - 1) {\n", " distance = scope_Spectrum.getAbsoluteDistance(reference[handleNumber + 1], options.margin, 1);\n", " to = Math.min(to, distance);\n", " }\n", " }\n", " // The limit option has the opposite effect, limiting handles to a\n", " // maximum distance from another. Limit must be > 0, as otherwise\n", " // handles would be unmovable.\n", " if (scope_Handles.length > 1 && options.limit) {\n", " if (lookBackward && handleNumber > 0) {\n", " distance = scope_Spectrum.getAbsoluteDistance(reference[handleNumber - 1], options.limit, 0);\n", " to = Math.min(to, distance);\n", " }\n", " if (lookForward && handleNumber < scope_Handles.length - 1) {\n", " distance = scope_Spectrum.getAbsoluteDistance(reference[handleNumber + 1], options.limit, 1);\n", " to = Math.max(to, distance);\n", " }\n", " }\n", " // The padding option keeps the handles a certain distance from the\n", " // edges of the slider. Padding must be > 0.\n", " if (options.padding) {\n", " if (handleNumber === 0) {\n", " distance = scope_Spectrum.getAbsoluteDistance(0, options.padding[0], 0);\n", " to = Math.max(to, distance);\n", " }\n", " if (handleNumber === scope_Handles.length - 1) {\n", " distance = scope_Spectrum.getAbsoluteDistance(100, options.padding[1], 1);\n", " to = Math.min(to, distance);\n", " }\n", " }\n", " to = scope_Spectrum.getStep(to);\n", " // Limit percentage to the 0 - 100 range\n", " to = limit(to);\n", " // Return false if handle can't move\n", " if (to === reference[handleNumber] && !getValue) {\n", " return false;\n", " }\n", " return to;\n", " }\n", " // Uses slider orientation to create CSS rules. a = base value;\n", " function inRuleOrder(v, a) {\n", " var o = options.ort;\n", " return (o ? a : v) + \", \" + (o ? v : a);\n", " }\n", " // Moves handle(s) by a percentage\n", " // (bool, % to move, [% where handle started, ...], [index in scope_Handles, ...])\n", " function moveHandles(upward, proposal, locations, handleNumbers) {\n", " var proposals = locations.slice();\n", " var b = [!upward, upward];\n", " var f = [upward, !upward];\n", " // Copy handleNumbers so we don't change the dataset\n", " handleNumbers = handleNumbers.slice();\n", " // Check to see which handle is 'leading'.\n", " // If that one can't move the second can't either.\n", " if (upward) {\n", " handleNumbers.reverse();\n", " }\n", " // Step 1: get the maximum percentage that any of the handles can move\n", " if (handleNumbers.length > 1) {\n", " handleNumbers.forEach(function (handleNumber, o) {\n", " var to = checkHandlePosition(proposals, handleNumber, proposals[handleNumber] + proposal, b[o], f[o], false);\n", " // Stop if one of the handles can't move.\n", " if (to === false) {\n", " proposal = 0;\n", " }\n", " else {\n", " proposal = to - proposals[handleNumber];\n", " proposals[handleNumber] = to;\n", " }\n", " });\n", " }\n", " // If using one handle, check backward AND forward\n", " else {\n", " b = f = [true];\n", " }\n", " var state = false;\n", " // Step 2: Try to set the handles with the found percentage\n", " handleNumbers.forEach(function (handleNumber, o) {\n", " state = setHandle(handleNumber, locations[handleNumber] + proposal, b[o], f[o]) || state;\n", " });\n", " // Step 3: If a handle moved, fire events\n", " if (state) {\n", " handleNumbers.forEach(function (handleNumber) {\n", " fireEvent(\"update\", handleNumber);\n", " fireEvent(\"slide\", handleNumber);\n", " });\n", " }\n", " }\n", " // Takes a base value and an offset. This offset is used for the connect bar size.\n", " // In the initial design for this feature, the origin element was 1% wide.\n", " // Unfortunately, a rounding bug in Chrome makes it impossible to implement this feature\n", " // in this manner: https://bugs.chromium.org/p/chromium/issues/detail?id=798223\n", " function transformDirection(a, b) {\n", " return options.dir ? 100 - a - b : a;\n", " }\n", " // Updates scope_Locations and scope_Values, updates visual state\n", " function updateHandlePosition(handleNumber, to) {\n", " // Update locations.\n", " scope_Locations[handleNumber] = to;\n", " // Convert the value to the slider stepping/range.\n", " scope_Values[handleNumber] = scope_Spectrum.fromStepping(to);\n", " var translation = 10 * (transformDirection(to, 0) - scope_DirOffset);\n", " var translateRule = \"translate(\" + inRuleOrder(translation + \"%\", \"0\") + \")\";\n", " scope_Handles[handleNumber].style[options.transformRule] = translateRule;\n", " updateConnect(handleNumber);\n", " updateConnect(handleNumber + 1);\n", " }\n", " // Handles before the slider middle are stacked later = higher,\n", " // Handles after the middle later is lower\n", " // [[7] [8] .......... | .......... [5] [4]\n", " function setZindex() {\n", " scope_HandleNumbers.forEach(function (handleNumber) {\n", " var dir = scope_Locations[handleNumber] > 50 ? -1 : 1;\n", " var zIndex = 3 + (scope_Handles.length + dir * handleNumber);\n", " scope_Handles[handleNumber].style.zIndex = zIndex;\n", " });\n", " }\n", " // Test suggested values and apply margin, step.\n", " function setHandle(handleNumber, to, lookBackward, lookForward) {\n", " to = checkHandlePosition(scope_Locations, handleNumber, to, lookBackward, lookForward, false);\n", " if (to === false) {\n", " return false;\n", " }\n", " updateHandlePosition(handleNumber, to);\n", " return true;\n", " }\n", " // Updates style attribute for connect nodes\n", " function updateConnect(index) {\n", " // Skip connects set to false\n", " if (!scope_Connects[index]) {\n", " return;\n", " }\n", " var l = 0;\n", " var h = 100;\n", " if (index !== 0) {\n", " l = scope_Locations[index - 1];\n", " }\n", " if (index !== scope_Connects.length - 1) {\n", " h = scope_Locations[index];\n", " }\n", " // We use two rules:\n", " // 'translate' to change the left/top offset;\n", " // 'scale' to change the width of the element;\n", " // As the element has a width of 100%, a translation of 100% is equal to 100% of the parent (.noUi-base)\n", " var connectWidth = h - l;\n", " var translateRule = \"translate(\" + inRuleOrder(transformDirection(l, connectWidth) + \"%\", \"0\") + \")\";\n", " var scaleRule = \"scale(\" + inRuleOrder(connectWidth / 100, \"1\") + \")\";\n", " scope_Connects[index].style[options.transformRule] = translateRule + \" \" + scaleRule;\n", " }\n", " // Parses value passed to .set method. Returns current value if not parse-able.\n", " function resolveToValue(to, handleNumber) {\n", " // Setting with null indicates an 'ignore'.\n", " // Inputting 'false' is invalid.\n", " if (to === null || to === false || to === undefined) {\n", " return scope_Locations[handleNumber];\n", " }\n", " // If a formatted number was passed, attempt to decode it.\n", " if (typeof to === \"number\") {\n", " to = String(to);\n", " }\n", " to = options.format.from(to);\n", " to = scope_Spectrum.toStepping(to);\n", " // If parsing the number failed, use the current value.\n", " if (to === false || isNaN(to)) {\n", " return scope_Locations[handleNumber];\n", " }\n", " return to;\n", " }\n", " // Set the slider value.\n", " function valueSet(input, fireSetEvent) {\n", " var values = asArray(input);\n", " var isInit = scope_Locations[0] === undefined;\n", " // Event fires by default\n", " fireSetEvent = fireSetEvent === undefined ? true : !!fireSetEvent;\n", " // Animation is optional.\n", " // Make sure the initial values were set before using animated placement.\n", " if (options.animate && !isInit) {\n", " addClassFor(scope_Target, options.cssClasses.tap, options.animationDuration);\n", " }\n", " // First pass, without lookAhead but with lookBackward. Values are set from left to right.\n", " scope_HandleNumbers.forEach(function (handleNumber) {\n", " setHandle(handleNumber, resolveToValue(values[handleNumber], handleNumber), true, false);\n", " });\n", " var i = scope_HandleNumbers.length === 1 ? 0 : 1;\n", " // Secondary passes. Now that all base values are set, apply constraints.\n", " // Iterate all handles to ensure constraints are applied for the entire slider (Issue #1009)\n", " for (; i < scope_HandleNumbers.length; ++i) {\n", " scope_HandleNumbers.forEach(function (handleNumber) {\n", " setHandle(handleNumber, scope_Locations[handleNumber], true, true);\n", " });\n", " }\n", " setZindex();\n", " scope_HandleNumbers.forEach(function (handleNumber) {\n", " fireEvent(\"update\", handleNumber);\n", " // Fire the event only for handles that received a new value, as per #579\n", " if (values[handleNumber] !== null && fireSetEvent) {\n", " fireEvent(\"set\", handleNumber);\n", " }\n", " });\n", " }\n", " // Reset slider to initial values\n", " function valueReset(fireSetEvent) {\n", " valueSet(options.start, fireSetEvent);\n", " }\n", " // Set value for a single handle\n", " function valueSetHandle(handleNumber, value, fireSetEvent) {\n", " // Ensure numeric input\n", " handleNumber = Number(handleNumber);\n", " if (!(handleNumber >= 0 && handleNumber < scope_HandleNumbers.length)) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): invalid handle number, got: \" + handleNumber);\n", " }\n", " // Look both backward and forward, since we don't want this handle to \"push\" other handles (#960);\n", " setHandle(handleNumber, resolveToValue(value, handleNumber), true, true);\n", " fireEvent(\"update\", handleNumber);\n", " if (fireSetEvent) {\n", " fireEvent(\"set\", handleNumber);\n", " }\n", " }\n", " // Get the slider value.\n", " function valueGet() {\n", " var values = scope_Values.map(options.format.to);\n", " // If only one handle is used, return a single value.\n", " if (values.length === 1) {\n", " return values[0];\n", " }\n", " return values;\n", " }\n", " // Removes classes from the root and empties it.\n", " function destroy() {\n", " for (var key in options.cssClasses) {\n", " if (!options.cssClasses.hasOwnProperty(key)) {\n", " continue;\n", " }\n", " removeClass(scope_Target, options.cssClasses[key]);\n", " }\n", " while (scope_Target.firstChild) {\n", " scope_Target.removeChild(scope_Target.firstChild);\n", " }\n", " delete scope_Target.noUiSlider;\n", " }\n", " function getNextStepsForHandle(handleNumber) {\n", " var location = scope_Locations[handleNumber];\n", " var nearbySteps = scope_Spectrum.getNearbySteps(location);\n", " var value = scope_Values[handleNumber];\n", " var increment = nearbySteps.thisStep.step;\n", " var decrement = null;\n", " // If snapped, directly use defined step value\n", " if (options.snap) {\n", " return [\n", " value - nearbySteps.stepBefore.startValue || null,\n", " nearbySteps.stepAfter.startValue - value || null\n", " ];\n", " }\n", " // If the next value in this step moves into the next step,\n", " // the increment is the start of the next step - the current value\n", " if (increment !== false) {\n", " if (value + increment > nearbySteps.stepAfter.startValue) {\n", " increment = nearbySteps.stepAfter.startValue - value;\n", " }\n", " }\n", " // If the value is beyond the starting point\n", " if (value > nearbySteps.thisStep.startValue) {\n", " decrement = nearbySteps.thisStep.step;\n", " }\n", " else if (nearbySteps.stepBefore.step === false) {\n", " decrement = false;\n", " }\n", " // If a handle is at the start of a step, it always steps back into the previous step first\n", " else {\n", " decrement = value - nearbySteps.stepBefore.highestStep;\n", " }\n", " // Now, if at the slider edges, there is no in/decrement\n", " if (location === 100) {\n", " increment = null;\n", " }\n", " else if (location === 0) {\n", " decrement = null;\n", " }\n", " // As per #391, the comparison for the decrement step can have some rounding issues.\n", " var stepDecimals = scope_Spectrum.countStepDecimals();\n", " // Round per #391\n", " if (increment !== null && increment !== false) {\n", " increment = Number(increment.toFixed(stepDecimals));\n", " }\n", " if (decrement !== null && decrement !== false) {\n", " decrement = Number(decrement.toFixed(stepDecimals));\n", " }\n", " return [decrement, increment];\n", " }\n", " // Get the current step size for the slider.\n", " function getNextSteps() {\n", " return scope_HandleNumbers.map(getNextStepsForHandle);\n", " }\n", " // Updateable: margin, limit, padding, step, range, animate, snap\n", " function updateOptions(optionsToUpdate, fireSetEvent) {\n", " // Spectrum is created using the range, snap, direction and step options.\n", " // 'snap' and 'step' can be updated.\n", " // If 'snap' and 'step' are not passed, they should remain unchanged.\n", " var v = valueGet();\n", " var updateAble = [\n", " \"margin\",\n", " \"limit\",\n", " \"padding\",\n", " \"range\",\n", " \"animate\",\n", " \"snap\",\n", " \"step\",\n", " \"format\",\n", " \"pips\",\n", " \"tooltips\"\n", " ];\n", " // Only change options that we're actually passed to update.\n", " updateAble.forEach(function (name) {\n", " // Check for undefined. null removes the value.\n", " if (optionsToUpdate[name] !== undefined) {\n", " originalOptions[name] = optionsToUpdate[name];\n", " }\n", " });\n", " var newOptions = testOptions(originalOptions);\n", " // Load new options into the slider state\n", " updateAble.forEach(function (name) {\n", " if (optionsToUpdate[name] !== undefined) {\n", " options[name] = newOptions[name];\n", " }\n", " });\n", " scope_Spectrum = newOptions.spectrum;\n", " // Limit, margin and padding depend on the spectrum but are stored outside of it. (#677)\n", " options.margin = newOptions.margin;\n", " options.limit = newOptions.limit;\n", " options.padding = newOptions.padding;\n", " // Update pips, removes existing.\n", " if (options.pips) {\n", " pips(options.pips);\n", " }\n", " else {\n", " removePips();\n", " }\n", " // Update tooltips, removes existing.\n", " if (options.tooltips) {\n", " tooltips();\n", " }\n", " else {\n", " removeTooltips();\n", " }\n", " // Invalidate the current positioning so valueSet forces an update.\n", " scope_Locations = [];\n", " valueSet(optionsToUpdate.start || v, fireSetEvent);\n", " }\n", " // Initialization steps\n", " function setupSlider() {\n", " // Create the base element, initialize HTML and set classes.\n", " // Add handles and connect elements.\n", " scope_Base = addSlider(scope_Target);\n", " addElements(options.connect, scope_Base);\n", " // Attach user events.\n", " bindSliderEvents(options.events);\n", " // Use the public value method to set the start values.\n", " valueSet(options.start);\n", " if (options.pips) {\n", " pips(options.pips);\n", " }\n", " if (options.tooltips) {\n", " tooltips();\n", " }\n", " aria();\n", " }\n", " setupSlider();\n", " // noinspection JSUnusedGlobalSymbols\n", " scope_Self = {\n", " destroy: destroy,\n", " steps: getNextSteps,\n", " on: bindEvent,\n", " off: removeEvent,\n", " get: valueGet,\n", " set: valueSet,\n", " setHandle: valueSetHandle,\n", " reset: valueReset,\n", " // Exposed for unit testing, don't use this in your application.\n", " __moveHandles: function (a, b, c) {\n", " moveHandles(a, b, scope_Locations, c);\n", " },\n", " options: originalOptions,\n", " updateOptions: updateOptions,\n", " target: scope_Target,\n", " removePips: removePips,\n", " removeTooltips: removeTooltips,\n", " getTooltips: function () {\n", " return scope_Tooltips;\n", " },\n", " getOrigins: function () {\n", " return scope_Handles;\n", " },\n", " pips: pips // Issue #594\n", " };\n", " return scope_Self;\n", " }\n", " // Run the standard initializer\n", " function initialize(target, originalOptions) {\n", " if (!target || !target.nodeName) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): create requires a single element, got: \" + target);\n", " }\n", " // Throw an error if the slider was already initialized.\n", " if (target.noUiSlider) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): Slider was already initialized.\");\n", " }\n", " // Test the options and create the slider environment;\n", " var options = testOptions(originalOptions, target);\n", " var api = scope(target, options, originalOptions);\n", " target.noUiSlider = api;\n", " return api;\n", " }\n", " // Use an object instead of a function for future expandability;\n", " return {\n", " // Exposed for unit testing, don't use this in your application.\n", " __spectrum: Spectrum,\n", " version: VERSION,\n", " // A reference to the default classes, allows global changes.\n", " // Use the cssClasses option for changes to one slider.\n", " cssClasses: cssClasses,\n", " create: initialize\n", " };\n", " });\n", " },\n", " 413: /* styles/widgets/sliders.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.bk_slider_value = \"bk-slider-value\";\n", " exports.bk_slider_title = \"bk-slider-title\";\n", " },\n", " 414: /* styles/widgets/nouislider.css.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const css = `\n", " .bk-root {\n", " /*! nouislider - 14.5.0 - 5/11/2020 */\n", " /* Functional styling;\n", " * These styles are required for noUiSlider to function.\n", " * You don't need to change these rules to apply your design.\n", " */\n", " /* Wrapper for all connect elements.\n", " */\n", " /* Offset direction\n", " */\n", " /* Give origins 0 height/width so they don't interfere with clicking the\n", " * connect elements.\n", " */\n", " /* Slider size and handle placement;\n", " */\n", " /* Styling;\n", " * Giving the connect element a border radius causes issues with using transform: scale\n", " */\n", " /* Handles and cursors;\n", " */\n", " /* Handle stripes;\n", " */\n", " /* Disabled state;\n", " */\n", " /* Base;\n", " *\n", " */\n", " /* Values;\n", " *\n", " */\n", " /* Markings;\n", " *\n", " */\n", " /* Horizontal layout;\n", " *\n", " */\n", " /* Vertical layout;\n", " *\n", " */\n", " }\n", " .bk-root .noUi-target,\n", " .bk-root .noUi-target * {\n", " -webkit-touch-callout: none;\n", " -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n", " -webkit-user-select: none;\n", " -ms-touch-action: none;\n", " touch-action: none;\n", " -ms-user-select: none;\n", " -moz-user-select: none;\n", " user-select: none;\n", " -moz-box-sizing: border-box;\n", " box-sizing: border-box;\n", " }\n", " .bk-root .noUi-target {\n", " position: relative;\n", " }\n", " .bk-root .noUi-base,\n", " .bk-root .noUi-connects {\n", " width: 100%;\n", " height: 100%;\n", " position: relative;\n", " z-index: 1;\n", " }\n", " .bk-root .noUi-connects {\n", " overflow: hidden;\n", " z-index: 0;\n", " }\n", " .bk-root .noUi-connect,\n", " .bk-root .noUi-origin {\n", " will-change: transform;\n", " position: absolute;\n", " z-index: 1;\n", " top: 0;\n", " right: 0;\n", " -ms-transform-origin: 0 0;\n", " -webkit-transform-origin: 0 0;\n", " -webkit-transform-style: preserve-3d;\n", " transform-origin: 0 0;\n", " transform-style: flat;\n", " }\n", " .bk-root .noUi-connect {\n", " height: 100%;\n", " width: 100%;\n", " }\n", " .bk-root .noUi-origin {\n", " height: 10%;\n", " width: 10%;\n", " }\n", " .bk-root .noUi-txt-dir-rtl.noUi-horizontal .noUi-origin {\n", " left: 0;\n", " right: auto;\n", " }\n", " .bk-root .noUi-vertical .noUi-origin {\n", " width: 0;\n", " }\n", " .bk-root .noUi-horizontal .noUi-origin {\n", " height: 0;\n", " }\n", " .bk-root .noUi-handle {\n", " -webkit-backface-visibility: hidden;\n", " backface-visibility: hidden;\n", " position: absolute;\n", " }\n", " .bk-root .noUi-touch-area {\n", " height: 100%;\n", " width: 100%;\n", " }\n", " .bk-root .noUi-state-tap .noUi-connect,\n", " .bk-root .noUi-state-tap .noUi-origin {\n", " -webkit-transition: transform 0.3s;\n", " transition: transform 0.3s;\n", " }\n", " .bk-root .noUi-state-drag * {\n", " cursor: inherit !important;\n", " }\n", " .bk-root .noUi-horizontal {\n", " height: 18px;\n", " }\n", " .bk-root .noUi-horizontal .noUi-handle {\n", " width: 34px;\n", " height: 28px;\n", " right: -17px;\n", " top: -6px;\n", " }\n", " .bk-root .noUi-vertical {\n", " width: 18px;\n", " }\n", " .bk-root .noUi-vertical .noUi-handle {\n", " width: 28px;\n", " height: 34px;\n", " right: -6px;\n", " top: -17px;\n", " }\n", " .bk-root .noUi-txt-dir-rtl.noUi-horizontal .noUi-handle {\n", " left: -17px;\n", " right: auto;\n", " }\n", " .bk-root .noUi-target {\n", " background: #FAFAFA;\n", " border-radius: 4px;\n", " border: 1px solid #D3D3D3;\n", " box-shadow: inset 0 1px 1px #F0F0F0, 0 3px 6px -5px #BBB;\n", " }\n", " .bk-root .noUi-connects {\n", " border-radius: 3px;\n", " }\n", " .bk-root .noUi-connect {\n", " background: #3FB8AF;\n", " }\n", " .bk-root .noUi-draggable {\n", " cursor: ew-resize;\n", " }\n", " .bk-root .noUi-vertical .noUi-draggable {\n", " cursor: ns-resize;\n", " }\n", " .bk-root .noUi-handle {\n", " border: 1px solid #D9D9D9;\n", " border-radius: 3px;\n", " background: #FFF;\n", " cursor: default;\n", " box-shadow: inset 0 0 1px #FFF, inset 0 1px 7px #EBEBEB, 0 3px 6px -3px #BBB;\n", " }\n", " .bk-root .noUi-active {\n", " box-shadow: inset 0 0 1px #FFF, inset 0 1px 7px #DDD, 0 3px 6px -3px #BBB;\n", " }\n", " .bk-root .noUi-handle:before,\n", " .bk-root .noUi-handle:after {\n", " content: \"\";\n", " display: block;\n", " position: absolute;\n", " height: 14px;\n", " width: 1px;\n", " background: #E8E7E6;\n", " left: 14px;\n", " top: 6px;\n", " }\n", " .bk-root .noUi-handle:after {\n", " left: 17px;\n", " }\n", " .bk-root .noUi-vertical .noUi-handle:before,\n", " .bk-root .noUi-vertical .noUi-handle:after {\n", " width: 14px;\n", " height: 1px;\n", " left: 6px;\n", " top: 14px;\n", " }\n", " .bk-root .noUi-vertical .noUi-handle:after {\n", " top: 17px;\n", " }\n", " .bk-root [disabled] .noUi-connect {\n", " background: #B8B8B8;\n", " }\n", " .bk-root [disabled].noUi-target,\n", " .bk-root [disabled].noUi-handle,\n", " .bk-root [disabled] .noUi-handle {\n", " cursor: not-allowed;\n", " }\n", " .bk-root .noUi-pips,\n", " .bk-root .noUi-pips * {\n", " -moz-box-sizing: border-box;\n", " box-sizing: border-box;\n", " }\n", " .bk-root .noUi-pips {\n", " position: absolute;\n", " color: #999;\n", " }\n", " .bk-root .noUi-value {\n", " position: absolute;\n", " white-space: nowrap;\n", " text-align: center;\n", " }\n", " .bk-root .noUi-value-sub {\n", " color: #ccc;\n", " font-size: 10px;\n", " }\n", " .bk-root .noUi-marker {\n", " position: absolute;\n", " background: #CCC;\n", " }\n", " .bk-root .noUi-marker-sub {\n", " background: #AAA;\n", " }\n", " .bk-root .noUi-marker-large {\n", " background: #AAA;\n", " }\n", " .bk-root .noUi-pips-horizontal {\n", " padding: 10px 0;\n", " height: 80px;\n", " top: 100%;\n", " left: 0;\n", " width: 100%;\n", " }\n", " .bk-root .noUi-value-horizontal {\n", " -webkit-transform: translate(-50%, 50%);\n", " transform: translate(-50%, 50%);\n", " }\n", " .bk-root .noUi-rtl .noUi-value-horizontal {\n", " -webkit-transform: translate(50%, 50%);\n", " transform: translate(50%, 50%);\n", " }\n", " .bk-root .noUi-marker-horizontal.noUi-marker {\n", " margin-left: -1px;\n", " width: 2px;\n", " height: 5px;\n", " }\n", " .bk-root .noUi-marker-horizontal.noUi-marker-sub {\n", " height: 10px;\n", " }\n", " .bk-root .noUi-marker-horizontal.noUi-marker-large {\n", " height: 15px;\n", " }\n", " .bk-root .noUi-pips-vertical {\n", " padding: 0 10px;\n", " height: 100%;\n", " top: 0;\n", " left: 100%;\n", " }\n", " .bk-root .noUi-value-vertical {\n", " -webkit-transform: translate(0, -50%);\n", " transform: translate(0, -50%);\n", " padding-left: 25px;\n", " }\n", " .bk-root .noUi-rtl .noUi-value-vertical {\n", " -webkit-transform: translate(0, 50%);\n", " transform: translate(0, 50%);\n", " }\n", " .bk-root .noUi-marker-vertical.noUi-marker {\n", " width: 5px;\n", " height: 2px;\n", " margin-top: -1px;\n", " }\n", " .bk-root .noUi-marker-vertical.noUi-marker-sub {\n", " width: 10px;\n", " }\n", " .bk-root .noUi-marker-vertical.noUi-marker-large {\n", " width: 15px;\n", " }\n", " .bk-root .noUi-tooltip {\n", " display: block;\n", " position: absolute;\n", " border: 1px solid #D9D9D9;\n", " border-radius: 3px;\n", " background: #fff;\n", " color: #000;\n", " padding: 5px;\n", " text-align: center;\n", " white-space: nowrap;\n", " }\n", " .bk-root .noUi-horizontal .noUi-tooltip {\n", " -webkit-transform: translate(-50%, 0);\n", " transform: translate(-50%, 0);\n", " left: 50%;\n", " bottom: 120%;\n", " }\n", " .bk-root .noUi-vertical .noUi-tooltip {\n", " -webkit-transform: translate(0, -50%);\n", " transform: translate(0, -50%);\n", " top: 50%;\n", " right: 120%;\n", " }\n", " .bk-root .noUi-horizontal .noUi-origin > .noUi-tooltip {\n", " -webkit-transform: translate(50%, 0);\n", " transform: translate(50%, 0);\n", " left: auto;\n", " bottom: 10px;\n", " }\n", " .bk-root .noUi-vertical .noUi-origin > .noUi-tooltip {\n", " -webkit-transform: translate(0, -18px);\n", " transform: translate(0, -18px);\n", " top: auto;\n", " right: 28px;\n", " }\n", " .bk-root .noUi-handle {\n", " cursor: grab;\n", " cursor: -webkit-grab;\n", " }\n", " .bk-root .noUi-handle.noUi-active {\n", " cursor: grabbing;\n", " cursor: -webkit-grabbing;\n", " }\n", " .bk-root .noUi-handle:after,\n", " .bk-root .noUi-handle:before {\n", " display: none;\n", " }\n", " .bk-root .noUi-tooltip {\n", " display: none;\n", " white-space: nowrap;\n", " }\n", " .bk-root .noUi-handle:hover .noUi-tooltip {\n", " display: block;\n", " }\n", " .bk-root .noUi-horizontal {\n", " width: 100%;\n", " height: 10px;\n", " }\n", " .bk-root .noUi-vertical {\n", " width: 10px;\n", " height: 100%;\n", " }\n", " .bk-root .noUi-horizontal .noUi-handle {\n", " width: 14px;\n", " height: 18px;\n", " right: -7px;\n", " top: -5px;\n", " }\n", " .bk-root .noUi-vertical .noUi-handle {\n", " width: 18px;\n", " height: 14px;\n", " right: -5px;\n", " top: -7px;\n", " }\n", " .bk-root .noUi-target.noUi-horizontal {\n", " margin: 5px 0px;\n", " }\n", " .bk-root .noUi-target.noUi-vertical {\n", " margin: 0px 5px;\n", " }\n", " `;\n", " exports.default = css;\n", " },\n", " 415: /* styles/widgets/sliders.css.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const css = `\n", " .bk-root .bk-slider-title {\n", " white-space: nowrap;\n", " }\n", " .bk-root .bk-slider-value {\n", " font-weight: 600;\n", " }\n", " `;\n", " exports.default = css;\n", " },\n", " 416: /* models/widgets/date_slider.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const timezone_1 = tslib_1.__importDefault(require(159) /* timezone */);\n", " const abstract_slider_1 = require(411) /* ./abstract_slider */;\n", " class DateSliderView extends abstract_slider_1.AbstractSliderView {\n", " }\n", " exports.DateSliderView = DateSliderView;\n", " DateSliderView.__name__ = \"DateSliderView\";\n", " class DateSlider extends abstract_slider_1.AbstractSlider {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.behaviour = \"tap\";\n", " this.connected = [true, false];\n", " }\n", " static init_DateSlider() {\n", " this.prototype.default_view = DateSliderView;\n", " this.override({\n", " format: \"%d %b %Y\",\n", " });\n", " }\n", " _formatter(value, format) {\n", " return timezone_1.default(value, format);\n", " }\n", " }\n", " exports.DateSlider = DateSlider;\n", " DateSlider.__name__ = \"DateSlider\";\n", " DateSlider.init_DateSlider();\n", " },\n", " 417: /* models/widgets/div.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const markup_1 = require(418) /* ./markup */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class DivView extends markup_1.MarkupView {\n", " render() {\n", " super.render();\n", " if (this.model.render_as_text)\n", " this.markup_el.textContent = this.model.text;\n", " else\n", " this.markup_el.innerHTML = this.model.text;\n", " }\n", " }\n", " exports.DivView = DivView;\n", " DivView.__name__ = \"DivView\";\n", " class Div extends markup_1.Markup {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Div() {\n", " this.prototype.default_view = DivView;\n", " this.define({\n", " render_as_text: [p.Boolean, false],\n", " });\n", " }\n", " }\n", " exports.Div = Div;\n", " Div.__name__ = \"Div\";\n", " Div.init_Div();\n", " },\n", " 418: /* models/widgets/markup.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const html_1 = require(193) /* ../../core/layout/html */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const widget_1 = require(458) /* ./widget */;\n", " const clearfix_1 = require(419) /* ../../styles/clearfix */;\n", " const clearfix_css_1 = tslib_1.__importDefault(require(420) /* ../../styles/clearfix.css */);\n", " class MarkupView extends widget_1.WidgetView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.change, () => {\n", " this.layout.invalidate_cache();\n", " this.render();\n", " this.root.compute_layout(); // XXX: invalidate_layout?\n", " });\n", " }\n", " styles() {\n", " return [...super.styles(), clearfix_css_1.default];\n", " }\n", " _update_layout() {\n", " this.layout = new html_1.CachedVariadicBox(this.el);\n", " this.layout.set_sizing(this.box_sizing());\n", " }\n", " render() {\n", " super.render();\n", " const style = Object.assign(Object.assign({}, this.model.style), { display: \"inline-block\" });\n", " this.markup_el = dom_1.div({ class: clearfix_1.bk_clearfix, style });\n", " this.el.appendChild(this.markup_el);\n", " }\n", " }\n", " exports.MarkupView = MarkupView;\n", " MarkupView.__name__ = \"MarkupView\";\n", " class Markup extends widget_1.Widget {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Markup() {\n", " this.define({\n", " text: [p.String, ''],\n", " style: [p.Any, {}],\n", " });\n", " }\n", " }\n", " exports.Markup = Markup;\n", " Markup.__name__ = \"Markup\";\n", " Markup.init_Markup();\n", " },\n", " 419: /* styles/clearfix.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.bk_clearfix = \"bk-clearfix\";\n", " },\n", " 420: /* styles/clearfix.css.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const css = `\n", " .bk-root .bk-clearfix:before,\n", " .bk-root .bk-clearfix:after {\n", " content: \"\";\n", " display: table;\n", " }\n", " .bk-root .bk-clearfix:after {\n", " clear: both;\n", " }\n", " `;\n", " exports.default = css;\n", " },\n", " 421: /* models/widgets/dropdown.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const abstract_button_1 = require(392) /* ./abstract_button */;\n", " const bokeh_events_1 = require(291) /* ../../core/bokeh_events */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const mixins_1 = require(146) /* ../../styles/mixins */;\n", " const buttons_1 = require(254) /* ../../styles/buttons */;\n", " const menus_1 = require(255) /* ../../styles/menus */;\n", " const menus_css_1 = tslib_1.__importDefault(require(257) /* ../../styles/menus.css */);\n", " class DropdownView extends abstract_button_1.AbstractButtonView {\n", " constructor() {\n", " super(...arguments);\n", " this._open = false;\n", " }\n", " styles() {\n", " return [...super.styles(), menus_css_1.default];\n", " }\n", " render() {\n", " super.render();\n", " const caret = dom_1.div({ class: [menus_1.bk_caret, mixins_1.bk_down] });\n", " if (!this.model.is_split)\n", " this.button_el.appendChild(caret);\n", " else {\n", " const toggle = this._render_button(caret);\n", " toggle.classList.add(buttons_1.bk_dropdown_toggle);\n", " toggle.addEventListener(\"click\", () => this._toggle_menu());\n", " this.group_el.appendChild(toggle);\n", " }\n", " const items = this.model.menu.map((item, i) => {\n", " if (item == null)\n", " return dom_1.div({ class: menus_1.bk_divider });\n", " else {\n", " const label = types_1.isString(item) ? item : item[0];\n", " const el = dom_1.div({}, label);\n", " el.addEventListener(\"click\", () => this._item_click(i));\n", " return el;\n", " }\n", " });\n", " this.menu = dom_1.div({ class: [menus_1.bk_menu, mixins_1.bk_below] }, items);\n", " this.el.appendChild(this.menu);\n", " dom_1.undisplay(this.menu);\n", " }\n", " _show_menu() {\n", " if (!this._open) {\n", " this._open = true;\n", " dom_1.display(this.menu);\n", " const listener = (event) => {\n", " const { target } = event;\n", " if (target instanceof HTMLElement && !this.el.contains(target)) {\n", " document.removeEventListener(\"click\", listener);\n", " this._hide_menu();\n", " }\n", " };\n", " document.addEventListener(\"click\", listener);\n", " }\n", " }\n", " _hide_menu() {\n", " if (this._open) {\n", " this._open = false;\n", " dom_1.undisplay(this.menu);\n", " }\n", " }\n", " _toggle_menu() {\n", " if (this._open)\n", " this._hide_menu();\n", " else\n", " this._show_menu();\n", " }\n", " click() {\n", " if (!this.model.is_split)\n", " this._toggle_menu();\n", " else {\n", " this._hide_menu();\n", " this.model.trigger_event(new bokeh_events_1.ButtonClick());\n", " super.click();\n", " }\n", " }\n", " _item_click(i) {\n", " this._hide_menu();\n", " const item = this.model.menu[i];\n", " if (item != null) {\n", " const value_or_callback = types_1.isString(item) ? item : item[1];\n", " if (types_1.isString(value_or_callback)) {\n", " this.model.trigger_event(new bokeh_events_1.MenuItemClick(value_or_callback));\n", " }\n", " else {\n", " value_or_callback.execute(this.model, { index: i }); // TODO\n", " }\n", " }\n", " }\n", " }\n", " exports.DropdownView = DropdownView;\n", " DropdownView.__name__ = \"DropdownView\";\n", " class Dropdown extends abstract_button_1.AbstractButton {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Dropdown() {\n", " this.prototype.default_view = DropdownView;\n", " this.define({\n", " split: [p.Boolean, false],\n", " menu: [p.Array, []],\n", " });\n", " this.override({\n", " label: \"Dropdown\",\n", " });\n", " }\n", " get is_split() {\n", " return this.split;\n", " }\n", " }\n", " exports.Dropdown = Dropdown;\n", " Dropdown.__name__ = \"Dropdown\";\n", " Dropdown.init_Dropdown();\n", " },\n", " 422: /* models/widgets/file_input.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const widget_1 = require(458) /* ./widget */;\n", " class FileInputView extends widget_1.WidgetView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.change, () => this.render());\n", " this.connect(this.model.properties.width.change, () => this.render());\n", " }\n", " render() {\n", " if (this.dialogEl == null) {\n", " this.dialogEl = document.createElement('input');\n", " this.dialogEl.type = \"file\";\n", " this.dialogEl.multiple = this.model.multiple;\n", " this.dialogEl.onchange = () => {\n", " const { files } = this.dialogEl;\n", " if (files != null) {\n", " this.load_files(files);\n", " }\n", " };\n", " this.el.appendChild(this.dialogEl);\n", " }\n", " if (this.model.accept != null && this.model.accept != '')\n", " this.dialogEl.accept = this.model.accept;\n", " this.dialogEl.style.width = `{this.model.width}px`;\n", " this.dialogEl.disabled = this.model.disabled;\n", " }\n", " async load_files(files) {\n", " const value = [];\n", " const filename = [];\n", " const mime_type = [];\n", " let i;\n", " for (i = 0; i < files.length; i++) {\n", " filename.push(files[i].name);\n", " const data_url = await this.readfile(files[i]);\n", " const [, mime, , data] = data_url.split(/[:;,]/, 4);\n", " value.push(data);\n", " mime_type.push(mime);\n", " }\n", " if (this.model.multiple) {\n", " this.model.filename = filename;\n", " this.model.mime_type = mime_type;\n", " this.model.value = value;\n", " }\n", " else {\n", " this.model.filename = filename[0];\n", " this.model.mime_type = mime_type[0];\n", " this.model.value = value[0];\n", " }\n", " }\n", " readfile(file) {\n", " return new Promise((resolve, reject) => {\n", " const reader = new FileReader();\n", " reader.onload = () => {\n", " var _a;\n", " const { result } = reader;\n", " if (result != null) {\n", " resolve(result);\n", " }\n", " else {\n", " reject((_a = reader.error) !== null && _a !== void 0 ? _a : new Error(`unable to read '${file.name}'`));\n", " }\n", " };\n", " reader.readAsDataURL(file);\n", " });\n", " }\n", " }\n", " exports.FileInputView = FileInputView;\n", " FileInputView.__name__ = \"FileInputView\";\n", " class FileInput extends widget_1.Widget {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_FileInput() {\n", " this.prototype.default_view = FileInputView;\n", " this.define({\n", " value: [p.Any, ''],\n", " mime_type: [p.Any, ''],\n", " filename: [p.Any, ''],\n", " accept: [p.String, ''],\n", " multiple: [p.Boolean, false],\n", " });\n", " }\n", " }\n", " exports.FileInput = FileInput;\n", " FileInput.__name__ = \"FileInput\";\n", " FileInput.init_FileInput();\n", " },\n", " 423: /* models/widgets/multiselect.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const input_widget_1 = require(398) /* ./input_widget */;\n", " const inputs_1 = require(400) /* ../../styles/widgets/inputs */;\n", " class MultiSelectView extends input_widget_1.InputWidgetView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.value.change, () => this.render_selection());\n", " this.connect(this.model.properties.options.change, () => this.render());\n", " this.connect(this.model.properties.name.change, () => this.render());\n", " this.connect(this.model.properties.title.change, () => this.render());\n", " this.connect(this.model.properties.size.change, () => this.render());\n", " this.connect(this.model.properties.disabled.change, () => this.render());\n", " }\n", " render() {\n", " super.render();\n", " const options = this.model.options.map((opt) => {\n", " let value, _label;\n", " if (types_1.isString(opt))\n", " value = _label = opt;\n", " else\n", " [value, _label] = opt;\n", " return dom_1.option({ value }, _label);\n", " });\n", " this.select_el = dom_1.select({\n", " multiple: true,\n", " class: inputs_1.bk_input,\n", " name: this.model.name,\n", " disabled: this.model.disabled,\n", " }, options);\n", " this.select_el.addEventListener(\"change\", () => this.change_input());\n", " this.group_el.appendChild(this.select_el);\n", " this.render_selection();\n", " }\n", " render_selection() {\n", " const selected = new Set(this.model.value);\n", " for (const el of this.el.querySelectorAll('option'))\n", " el.selected = selected.has(el.value);\n", " // Note that some browser implementations might not reduce\n", " // the number of visible options for size <= 3.\n", " this.select_el.size = this.model.size;\n", " }\n", " change_input() {\n", " const is_focused = this.el.querySelector('select:focus') != null;\n", " const values = [];\n", " for (const el of this.el.querySelectorAll('option')) {\n", " if (el.selected)\n", " values.push(el.value);\n", " }\n", " this.model.value = values;\n", " super.change_input();\n", " // Restore focus back to the and one can seamlessly scroll\n", " // up/down.\n", " if (is_focused)\n", " this.select_el.focus();\n", " }\n", " }\n", " exports.MultiSelectView = MultiSelectView;\n", " MultiSelectView.__name__ = \"MultiSelectView\";\n", " class MultiSelect extends input_widget_1.InputWidget {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_MultiSelect() {\n", " this.prototype.default_view = MultiSelectView;\n", " this.define({\n", " value: [p.Array, []],\n", " options: [p.Array, []],\n", " size: [p.Number, 4],\n", " });\n", " }\n", " }\n", " exports.MultiSelect = MultiSelect;\n", " MultiSelect.__name__ = \"MultiSelect\";\n", " MultiSelect.init_MultiSelect();\n", " },\n", " 424: /* models/widgets/paragraph.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const markup_1 = require(418) /* ./markup */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " class ParagraphView extends markup_1.MarkupView {\n", " render() {\n", " super.render();\n", " // This overrides default user-agent styling and helps layout work\n", " const content = dom_1.p({ style: { margin: 0 } }, this.model.text);\n", " this.markup_el.appendChild(content);\n", " }\n", " }\n", " exports.ParagraphView = ParagraphView;\n", " ParagraphView.__name__ = \"ParagraphView\";\n", " class Paragraph extends markup_1.Markup {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Paragraph() {\n", " this.prototype.default_view = ParagraphView;\n", " }\n", " }\n", " exports.Paragraph = Paragraph;\n", " Paragraph.__name__ = \"Paragraph\";\n", " Paragraph.init_Paragraph();\n", " },\n", " 425: /* models/widgets/password_input.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const text_input_1 = require(397) /* ./text_input */;\n", " class PasswordInputView extends text_input_1.TextInputView {\n", " render() {\n", " super.render();\n", " this.input_el.type = \"password\";\n", " }\n", " }\n", " exports.PasswordInputView = PasswordInputView;\n", " PasswordInputView.__name__ = \"PasswordInputView\";\n", " class PasswordInput extends text_input_1.TextInput {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_PasswordInput() {\n", " this.prototype.default_view = PasswordInputView;\n", " }\n", " }\n", " exports.PasswordInput = PasswordInput;\n", " PasswordInput.__name__ = \"PasswordInput\";\n", " PasswordInput.init_PasswordInput();\n", " },\n", " 426: /* models/widgets/multichoice.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const choices_js_1 = tslib_1.__importDefault(require(427) /* choices.js */);\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const inputs_1 = require(400) /* ../../styles/widgets/inputs */;\n", " const choices_css_1 = tslib_1.__importDefault(require(428) /* ../../styles/widgets/choices.css */);\n", " const input_widget_1 = require(398) /* ./input_widget */;\n", " class MultiChoiceView extends input_widget_1.InputWidgetView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.value.change, () => this.render_selection());\n", " this.connect(this.model.properties.disabled.change, () => this.set_disabled());\n", " this.connect(this.model.properties.max_items.change, () => this.render());\n", " this.connect(this.model.properties.option_limit.change, () => this.render());\n", " this.connect(this.model.properties.delete_button.change, () => this.render());\n", " this.connect(this.model.properties.placeholder.change, () => this.render());\n", " this.connect(this.model.properties.options.change, () => this.render());\n", " this.connect(this.model.properties.name.change, () => this.render());\n", " this.connect(this.model.properties.title.change, () => this.render());\n", " }\n", " styles() {\n", " return [...super.styles(), choices_css_1.default];\n", " }\n", " render() {\n", " super.render();\n", " const options = this.model.options.map((opt) => {\n", " let value, _label;\n", " if (types_1.isString(opt))\n", " value = _label = opt;\n", " else\n", " [value, _label] = opt;\n", " return dom_1.option({ value }, _label);\n", " });\n", " this.select_el = dom_1.select({\n", " multiple: true,\n", " class: inputs_1.bk_input,\n", " name: this.model.name,\n", " disabled: this.model.disabled,\n", " }, options);\n", " this.group_el.appendChild(this.select_el);\n", " this.render_selection();\n", " let item = \"choices__item\";\n", " let button = \"choices__button\";\n", " if (this.model.solid) {\n", " item = item + \" solid\";\n", " button = button + \" solid\";\n", " }\n", " else {\n", " item = item + \" light\";\n", " button = button + \" light\";\n", " }\n", " const opts = {\n", " removeItemButton: this.model.delete_button,\n", " classNames: { item, button },\n", " };\n", " if (this.model.placeholder !== null)\n", " opts.placeholderValue = this.model.placeholder;\n", " if (this.model.max_items !== null)\n", " opts.maxItemCount = this.model.max_items;\n", " if (this.model.option_limit !== null)\n", " opts.renderChoiceLimit = this.model.option_limit;\n", " this.choice_el = new choices_js_1.default(this.select_el, opts);\n", " this.select_el.addEventListener(\"change\", () => this.change_input());\n", " }\n", " render_selection() {\n", " const selected = new Set(this.model.value);\n", " for (const el of Array.from(this.el.querySelectorAll('option')))\n", " el.selected = selected.has(el.value);\n", " }\n", " set_disabled() {\n", " if (this.model.disabled)\n", " this.choice_el.disable();\n", " else\n", " this.choice_el.enable();\n", " }\n", " change_input() {\n", " const is_focused = this.el.querySelector('select:focus') != null;\n", " const values = [];\n", " for (const el of Array.from(this.el.querySelectorAll('option'))) {\n", " if (el.selected)\n", " values.push(el.value);\n", " }\n", " this.model.value = values;\n", " super.change_input();\n", " // Restore focus back to the and one can seamlessly scroll\n", " // up/down.\n", " if (is_focused)\n", " this.select_el.focus();\n", " }\n", " }\n", " exports.MultiChoiceView = MultiChoiceView;\n", " MultiChoiceView.__name__ = \"MultiChoiceView\";\n", " class MultiChoice extends input_widget_1.InputWidget {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_MultiChoice() {\n", " this.prototype.default_view = MultiChoiceView;\n", " this.define({\n", " value: [p.Array, []],\n", " options: [p.Array, []],\n", " max_items: [p.Number, null],\n", " delete_button: [p.Boolean, true],\n", " placeholder: [p.String, null],\n", " option_limit: [p.Number, null],\n", " solid: [p.Boolean, true],\n", " });\n", " }\n", " }\n", " exports.MultiChoice = MultiChoice;\n", " MultiChoice.__name__ = \"MultiChoice\";\n", " MultiChoice.init_MultiChoice();\n", " },\n", " 427: /* choices.js/public/assets/scripts/choices.js */ function _(require, module, exports) {\n", " /*! choices.js v9.0.1 | © 2019 Josh Johnson | https://github.com/jshjohnson/Choices#readme */\n", " (function webpackUniversalModuleDefinition(root, factory) {\n", " if (typeof exports === 'object' && typeof module === 'object')\n", " module.exports = factory();\n", " else if (typeof define === 'function' && define.amd)\n", " define([], factory);\n", " else if (typeof exports === 'object')\n", " exports[\"Choices\"] = factory();\n", " else\n", " root[\"Choices\"] = factory();\n", " })(window, function () {\n", " return /******/ (function (modules) {\n", " /******/ // The module cache\n", " /******/ var installedModules = {};\n", " /******/\n", " /******/ // The require function\n", " /******/ function __webpack_require__(moduleId) {\n", " /******/\n", " /******/ // Check if module is in cache\n", " /******/ if (installedModules[moduleId]) {\n", " /******/ return installedModules[moduleId].exports;\n", " /******/ }\n", " /******/ // Create a new module (and put it into the cache)\n", " /******/ var module = installedModules[moduleId] = {\n", " /******/ i: moduleId,\n", " /******/ l: false,\n", " /******/ exports: {}\n", " /******/ \n", " };\n", " /******/\n", " /******/ // Execute the module function\n", " /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n", " /******/\n", " /******/ // Flag the module as loaded\n", " /******/ module.l = true;\n", " /******/\n", " /******/ // Return the exports of the module\n", " /******/ return module.exports;\n", " /******/ \n", " }\n", " /******/\n", " /******/\n", " /******/ // expose the modules object (__webpack_modules__)\n", " /******/ __webpack_require__.m = modules;\n", " /******/\n", " /******/ // expose the module cache\n", " /******/ __webpack_require__.c = installedModules;\n", " /******/\n", " /******/ // define getter function for harmony exports\n", " /******/ __webpack_require__.d = function (exports, name, getter) {\n", " /******/ if (!__webpack_require__.o(exports, name)) {\n", " /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });\n", " /******/ }\n", " /******/ \n", " };\n", " /******/\n", " /******/ // define __esModule on exports\n", " /******/ __webpack_require__.r = function (exports) {\n", " /******/ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n", " /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n", " /******/ }\n", " /******/ Object.defineProperty(exports, '__esModule', { value: true });\n", " /******/ \n", " };\n", " /******/\n", " /******/ // create a fake namespace object\n", " /******/ // mode & 1: value is a module id, require it\n", " /******/ // mode & 2: merge all properties of value into the ns\n", " /******/ // mode & 4: return value when already ns object\n", " /******/ // mode & 8|1: behave like require\n", " /******/ __webpack_require__.t = function (value, mode) {\n", " /******/ if (mode & 1)\n", " value = __webpack_require__(value);\n", " /******/ if (mode & 8)\n", " return value;\n", " /******/ if ((mode & 4) && typeof value === 'object' && value && value.__esModule)\n", " return value;\n", " /******/ var ns = Object.create(null);\n", " /******/ __webpack_require__.r(ns);\n", " /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });\n", " /******/ if (mode & 2 && typeof value != 'string')\n", " for (var key in value)\n", " __webpack_require__.d(ns, key, function (key) { return value[key]; }.bind(null, key));\n", " /******/ return ns;\n", " /******/ \n", " };\n", " /******/\n", " /******/ // getDefaultExport function for compatibility with non-harmony modules\n", " /******/ __webpack_require__.n = function (module) {\n", " /******/ var getter = module && module.__esModule ?\n", " /******/ function getDefault() { return module['default']; } :\n", " /******/ function getModuleExports() { return module; };\n", " /******/ __webpack_require__.d(getter, 'a', getter);\n", " /******/ return getter;\n", " /******/ \n", " };\n", " /******/\n", " /******/ // Object.prototype.hasOwnProperty.call\n", " /******/ __webpack_require__.o = function (object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n", " /******/\n", " /******/ // __webpack_public_path__\n", " /******/ __webpack_require__.p = \"/public/assets/scripts/\";\n", " /******/\n", " /******/\n", " /******/ // Load entry module and return exports\n", " /******/ return __webpack_require__(__webpack_require__.s = 4);\n", " /******/ \n", " })([\n", " /* 0 */\n", " /***/ (function (module, exports, __webpack_require__) {\n", " \"use strict\";\n", " var isMergeableObject = function isMergeableObject(value) {\n", " return isNonNullObject(value)\n", " && !isSpecial(value);\n", " };\n", " function isNonNullObject(value) {\n", " return !!value && typeof value === 'object';\n", " }\n", " function isSpecial(value) {\n", " var stringValue = Object.prototype.toString.call(value);\n", " return stringValue === '[object RegExp]'\n", " || stringValue === '[object Date]'\n", " || isReactElement(value);\n", " }\n", " // see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25\n", " var canUseSymbol = typeof Symbol === 'function' && Symbol.for;\n", " var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;\n", " function isReactElement(value) {\n", " return value.$$typeof === REACT_ELEMENT_TYPE;\n", " }\n", " function emptyTarget(val) {\n", " return Array.isArray(val) ? [] : {};\n", " }\n", " function cloneUnlessOtherwiseSpecified(value, options) {\n", " return (options.clone !== false && options.isMergeableObject(value))\n", " ? deepmerge(emptyTarget(value), value, options)\n", " : value;\n", " }\n", " function defaultArrayMerge(target, source, options) {\n", " return target.concat(source).map(function (element) {\n", " return cloneUnlessOtherwiseSpecified(element, options);\n", " });\n", " }\n", " function getMergeFunction(key, options) {\n", " if (!options.customMerge) {\n", " return deepmerge;\n", " }\n", " var customMerge = options.customMerge(key);\n", " return typeof customMerge === 'function' ? customMerge : deepmerge;\n", " }\n", " function getEnumerableOwnPropertySymbols(target) {\n", " return Object.getOwnPropertySymbols\n", " ? Object.getOwnPropertySymbols(target).filter(function (symbol) {\n", " return target.propertyIsEnumerable(symbol);\n", " })\n", " : [];\n", " }\n", " function getKeys(target) {\n", " return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));\n", " }\n", " // Protects from prototype poisoning and unexpected merging up the prototype chain.\n", " function propertyIsUnsafe(target, key) {\n", " try {\n", " return (key in target) // Properties are safe to merge if they don't exist in the target yet,\n", " && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,\n", " && Object.propertyIsEnumerable.call(target, key)); // and also unsafe if they're nonenumerable.\n", " }\n", " catch (unused) {\n", " // Counterintuitively, it's safe to merge any property on a target that causes the `in` operator to throw.\n", " // This happens when trying to copy an object in the source over a plain string in the target.\n", " return false;\n", " }\n", " }\n", " function mergeObject(target, source, options) {\n", " var destination = {};\n", " if (options.isMergeableObject(target)) {\n", " getKeys(target).forEach(function (key) {\n", " destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);\n", " });\n", " }\n", " getKeys(source).forEach(function (key) {\n", " if (propertyIsUnsafe(target, key)) {\n", " return;\n", " }\n", " if (!options.isMergeableObject(source[key]) || !target[key]) {\n", " destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);\n", " }\n", " else {\n", " destination[key] = getMergeFunction(key, options)(target[key], source[key], options);\n", " }\n", " });\n", " return destination;\n", " }\n", " function deepmerge(target, source, options) {\n", " options = options || {};\n", " options.arrayMerge = options.arrayMerge || defaultArrayMerge;\n", " options.isMergeableObject = options.isMergeableObject || isMergeableObject;\n", " // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()\n", " // implementations can use it. The caller may not replace it.\n", " options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;\n", " var sourceIsArray = Array.isArray(source);\n", " var targetIsArray = Array.isArray(target);\n", " var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;\n", " if (!sourceAndTargetTypesMatch) {\n", " return cloneUnlessOtherwiseSpecified(source, options);\n", " }\n", " else if (sourceIsArray) {\n", " return options.arrayMerge(target, source, options);\n", " }\n", " else {\n", " return mergeObject(target, source, options);\n", " }\n", " }\n", " deepmerge.all = function deepmergeAll(array, options) {\n", " if (!Array.isArray(array)) {\n", " throw new Error('first argument should be an array');\n", " }\n", " return array.reduce(function (prev, next) {\n", " return deepmerge(prev, next, options);\n", " }, {});\n", " };\n", " var deepmerge_1 = deepmerge;\n", " module.exports = deepmerge_1;\n", " /***/ \n", " }),\n", " /* 1 */\n", " /***/ (function (module, __webpack_exports__, __webpack_require__) {\n", " \"use strict\";\n", " /* WEBPACK VAR INJECTION */ (function (global, module) {\n", " var _ponyfill_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3);\n", " /* global window */\n", " var root;\n", " if (typeof self !== 'undefined') {\n", " root = self;\n", " }\n", " else if (typeof window !== 'undefined') {\n", " root = window;\n", " }\n", " else if (typeof global !== 'undefined') {\n", " root = global;\n", " }\n", " else if (true) {\n", " root = module;\n", " }\n", " else { }\n", " var result = Object(_ponyfill_js__WEBPACK_IMPORTED_MODULE_0__[ /* default */\"a\"])(root);\n", " /* harmony default export */ __webpack_exports__[\"a\"] = (result);\n", " /* WEBPACK VAR INJECTION */ \n", " }.call(this, __webpack_require__(5), __webpack_require__(6)(module)));\n", " /***/ \n", " }),\n", " /* 2 */\n", " /***/ (function (module, exports, __webpack_require__) {\n", " /*!\n", " * Fuse.js v3.4.5 - Lightweight fuzzy-search (http://fusejs.io)\n", " *\n", " * Copyright (c) 2012-2017 Kirollos Risk (http://kiro.me)\n", " * All Rights Reserved. Apache Software License 2.0\n", " *\n", " * http://www.apache.org/licenses/LICENSE-2.0\n", " */\n", " !function (e, t) { true ? module.exports = t() : undefined; }(this, function () { return function (e) { var t = {}; function n(r) { if (t[r])\n", " return t[r].exports; var o = t[r] = { i: r, l: !1, exports: {} }; return e[r].call(o.exports, o, o.exports, n), o.l = !0, o.exports; } return n.m = e, n.c = t, n.d = function (e, t, r) { n.o(e, t) || Object.defineProperty(e, t, { enumerable: !0, get: r }); }, n.r = function (e) { \"undefined\" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { value: \"Module\" }), Object.defineProperty(e, \"__esModule\", { value: !0 }); }, n.t = function (e, t) { if (1 & t && (e = n(e)), 8 & t)\n", " return e; if (4 & t && \"object\" == typeof e && e && e.__esModule)\n", " return e; var r = Object.create(null); if (n.r(r), Object.defineProperty(r, \"default\", { enumerable: !0, value: e }), 2 & t && \"string\" != typeof e)\n", " for (var o in e)\n", " n.d(r, o, function (t) { return e[t]; }.bind(null, o)); return r; }, n.n = function (e) { var t = e && e.__esModule ? function () { return e.default; } : function () { return e; }; return n.d(t, \"a\", t), t; }, n.o = function (e, t) { return Object.prototype.hasOwnProperty.call(e, t); }, n.p = \"\", n(n.s = 1); }([function (e, t) { e.exports = function (e) { return Array.isArray ? Array.isArray(e) : \"[object Array]\" === Object.prototype.toString.call(e); }; }, function (e, t, n) { function r(e) { return (r = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (e) { return typeof e; } : function (e) { return e && \"function\" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? \"symbol\" : typeof e; })(e); } function o(e, t) { for (var n = 0; n < t.length; n++) {\n", " var r = t[n];\n", " r.enumerable = r.enumerable || !1, r.configurable = !0, \"value\" in r && (r.writable = !0), Object.defineProperty(e, r.key, r);\n", " } } var i = n(2), a = n(8), s = n(0), c = function () { function e(t, n) { var r = n.location, o = void 0 === r ? 0 : r, i = n.distance, s = void 0 === i ? 100 : i, c = n.threshold, h = void 0 === c ? .6 : c, l = n.maxPatternLength, u = void 0 === l ? 32 : l, f = n.caseSensitive, d = void 0 !== f && f, v = n.tokenSeparator, p = void 0 === v ? / +/g : v, g = n.findAllMatches, y = void 0 !== g && g, m = n.minMatchCharLength, k = void 0 === m ? 1 : m, S = n.id, x = void 0 === S ? null : S, b = n.keys, M = void 0 === b ? [] : b, _ = n.shouldSort, L = void 0 === _ || _, w = n.getFn, A = void 0 === w ? a : w, C = n.sortFn, I = void 0 === C ? function (e, t) { return e.score - t.score; } : C, O = n.tokenize, j = void 0 !== O && O, P = n.matchAllTokens, F = void 0 !== P && P, T = n.includeMatches, z = void 0 !== T && T, E = n.includeScore, K = void 0 !== E && E, $ = n.verbose, J = void 0 !== $ && $; !function (e, t) { if (!(e instanceof t))\n", " throw new TypeError(\"Cannot call a class as a function\"); }(this, e), this.options = { location: o, distance: s, threshold: h, maxPatternLength: u, isCaseSensitive: d, tokenSeparator: p, findAllMatches: y, minMatchCharLength: k, id: x, keys: M, includeMatches: z, includeScore: K, shouldSort: L, getFn: A, sortFn: I, verbose: J, tokenize: j, matchAllTokens: F }, this.setCollection(t); } var t, n, c; return t = e, (n = [{ key: \"setCollection\", value: function (e) { return this.list = e, e; } }, { key: \"search\", value: function (e) { var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : { limit: !1 }; this._log('---------\\nSearch pattern: \"'.concat(e, '\"')); var n = this._prepareSearchers(e), r = n.tokenSearchers, o = n.fullSearcher, i = this._search(r, o), a = i.weights, s = i.results; return this._computeScore(a, s), this.options.shouldSort && this._sort(s), t.limit && \"number\" == typeof t.limit && (s = s.slice(0, t.limit)), this._format(s); } }, { key: \"_prepareSearchers\", value: function () { var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : \"\", t = []; if (this.options.tokenize)\n", " for (var n = e.split(this.options.tokenSeparator), r = 0, o = n.length; r < o; r += 1)\n", " t.push(new i(n[r], this.options)); return { tokenSearchers: t, fullSearcher: new i(e, this.options) }; } }, { key: \"_search\", value: function () { var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [], t = arguments.length > 1 ? arguments[1] : void 0, n = this.list, r = {}, o = []; if (\"string\" == typeof n[0]) {\n", " for (var i = 0, a = n.length; i < a; i += 1)\n", " this._analyze({ key: \"\", value: n[i], record: i, index: i }, { resultMap: r, results: o, tokenSearchers: e, fullSearcher: t });\n", " return { weights: null, results: o };\n", " } for (var s = {}, c = 0, h = n.length; c < h; c += 1)\n", " for (var l = n[c], u = 0, f = this.options.keys.length; u < f; u += 1) {\n", " var d = this.options.keys[u];\n", " if (\"string\" != typeof d) {\n", " if (s[d.name] = { weight: 1 - d.weight || 1 }, d.weight <= 0 || d.weight > 1)\n", " throw new Error(\"Key weight has to be > 0 and <= 1\");\n", " d = d.name;\n", " }\n", " else\n", " s[d] = { weight: 1 };\n", " this._analyze({ key: d, value: this.options.getFn(l, d), record: l, index: c }, { resultMap: r, results: o, tokenSearchers: e, fullSearcher: t });\n", " } return { weights: s, results: o }; } }, { key: \"_analyze\", value: function (e, t) { var n = e.key, r = e.arrayIndex, o = void 0 === r ? -1 : r, i = e.value, a = e.record, c = e.index, h = t.tokenSearchers, l = void 0 === h ? [] : h, u = t.fullSearcher, f = void 0 === u ? [] : u, d = t.resultMap, v = void 0 === d ? {} : d, p = t.results, g = void 0 === p ? [] : p; if (null != i) {\n", " var y = !1, m = -1, k = 0;\n", " if (\"string\" == typeof i) {\n", " this._log(\"\\nKey: \".concat(\"\" === n ? \"-\" : n));\n", " var S = f.search(i);\n", " if (this._log('Full text: \"'.concat(i, '\", score: ').concat(S.score)), this.options.tokenize) {\n", " for (var x = i.split(this.options.tokenSeparator), b = [], M = 0; M < l.length; M += 1) {\n", " var _ = l[M];\n", " this._log('\\nPattern: \"'.concat(_.pattern, '\"'));\n", " for (var L = !1, w = 0; w < x.length; w += 1) {\n", " var A = x[w], C = _.search(A), I = {};\n", " C.isMatch ? (I[A] = C.score, y = !0, L = !0, b.push(C.score)) : (I[A] = 1, this.options.matchAllTokens || b.push(1)), this._log('Token: \"'.concat(A, '\", score: ').concat(I[A]));\n", " }\n", " L && (k += 1);\n", " }\n", " m = b[0];\n", " for (var O = b.length, j = 1; j < O; j += 1)\n", " m += b[j];\n", " m /= O, this._log(\"Token score average:\", m);\n", " }\n", " var P = S.score;\n", " m > -1 && (P = (P + m) / 2), this._log(\"Score average:\", P);\n", " var F = !this.options.tokenize || !this.options.matchAllTokens || k >= l.length;\n", " if (this._log(\"\\nCheck Matches: \".concat(F)), (y || S.isMatch) && F) {\n", " var T = v[c];\n", " T ? T.output.push({ key: n, arrayIndex: o, value: i, score: P, matchedIndices: S.matchedIndices }) : (v[c] = { item: a, output: [{ key: n, arrayIndex: o, value: i, score: P, matchedIndices: S.matchedIndices }] }, g.push(v[c]));\n", " }\n", " }\n", " else if (s(i))\n", " for (var z = 0, E = i.length; z < E; z += 1)\n", " this._analyze({ key: n, arrayIndex: z, value: i[z], record: a, index: c }, { resultMap: v, results: g, tokenSearchers: l, fullSearcher: f });\n", " } } }, { key: \"_computeScore\", value: function (e, t) { this._log(\"\\n\\nComputing score:\\n\"); for (var n = 0, r = t.length; n < r; n += 1) {\n", " for (var o = t[n].output, i = o.length, a = 1, s = 1, c = 0; c < i; c += 1) {\n", " var h = e ? e[o[c].key].weight : 1, l = (1 === h ? o[c].score : o[c].score || .001) * h;\n", " 1 !== h ? s = Math.min(s, l) : (o[c].nScore = l, a *= l);\n", " }\n", " t[n].score = 1 === s ? a : s, this._log(t[n]);\n", " } } }, { key: \"_sort\", value: function (e) { this._log(\"\\n\\nSorting....\"), e.sort(this.options.sortFn); } }, { key: \"_format\", value: function (e) { var t = []; if (this.options.verbose) {\n", " var n = [];\n", " this._log(\"\\n\\nOutput:\\n\\n\", JSON.stringify(e, function (e, t) { if (\"object\" === r(t) && null !== t) {\n", " if (-1 !== n.indexOf(t))\n", " return;\n", " n.push(t);\n", " } return t; })), n = null;\n", " } var o = []; this.options.includeMatches && o.push(function (e, t) { var n = e.output; t.matches = []; for (var r = 0, o = n.length; r < o; r += 1) {\n", " var i = n[r];\n", " if (0 !== i.matchedIndices.length) {\n", " var a = { indices: i.matchedIndices, value: i.value };\n", " i.key && (a.key = i.key), i.hasOwnProperty(\"arrayIndex\") && i.arrayIndex > -1 && (a.arrayIndex = i.arrayIndex), t.matches.push(a);\n", " }\n", " } }), this.options.includeScore && o.push(function (e, t) { t.score = e.score; }); for (var i = 0, a = e.length; i < a; i += 1) {\n", " var s = e[i];\n", " if (this.options.id && (s.item = this.options.getFn(s.item, this.options.id)[0]), o.length) {\n", " for (var c = { item: s.item }, h = 0, l = o.length; h < l; h += 1)\n", " o[h](s, c);\n", " t.push(c);\n", " }\n", " else\n", " t.push(s.item);\n", " } return t; } }, { key: \"_log\", value: function () { var e; this.options.verbose && (e = console).log.apply(e, arguments); } }]) && o(t.prototype, n), c && o(t, c), e; }(); e.exports = c; }, function (e, t, n) { function r(e, t) { for (var n = 0; n < t.length; n++) {\n", " var r = t[n];\n", " r.enumerable = r.enumerable || !1, r.configurable = !0, \"value\" in r && (r.writable = !0), Object.defineProperty(e, r.key, r);\n", " } } var o = n(3), i = n(4), a = n(7), s = function () { function e(t, n) { var r = n.location, o = void 0 === r ? 0 : r, i = n.distance, s = void 0 === i ? 100 : i, c = n.threshold, h = void 0 === c ? .6 : c, l = n.maxPatternLength, u = void 0 === l ? 32 : l, f = n.isCaseSensitive, d = void 0 !== f && f, v = n.tokenSeparator, p = void 0 === v ? / +/g : v, g = n.findAllMatches, y = void 0 !== g && g, m = n.minMatchCharLength, k = void 0 === m ? 1 : m; !function (e, t) { if (!(e instanceof t))\n", " throw new TypeError(\"Cannot call a class as a function\"); }(this, e), this.options = { location: o, distance: s, threshold: h, maxPatternLength: u, isCaseSensitive: d, tokenSeparator: p, findAllMatches: y, minMatchCharLength: k }, this.pattern = this.options.isCaseSensitive ? t : t.toLowerCase(), this.pattern.length <= u && (this.patternAlphabet = a(this.pattern)); } var t, n, s; return t = e, (n = [{ key: \"search\", value: function (e) { if (this.options.isCaseSensitive || (e = e.toLowerCase()), this.pattern === e)\n", " return { isMatch: !0, score: 0, matchedIndices: [[0, e.length - 1]] }; var t = this.options, n = t.maxPatternLength, r = t.tokenSeparator; if (this.pattern.length > n)\n", " return o(e, this.pattern, r); var a = this.options, s = a.location, c = a.distance, h = a.threshold, l = a.findAllMatches, u = a.minMatchCharLength; return i(e, this.pattern, this.patternAlphabet, { location: s, distance: c, threshold: h, findAllMatches: l, minMatchCharLength: u }); } }]) && r(t.prototype, n), s && r(t, s), e; }(); e.exports = s; }, function (e, t) { var n = /[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g; e.exports = function (e, t) { var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : / +/g, o = new RegExp(t.replace(n, \"\\\\$&\").replace(r, \"|\")), i = e.match(o), a = !!i, s = []; if (a)\n", " for (var c = 0, h = i.length; c < h; c += 1) {\n", " var l = i[c];\n", " s.push([e.indexOf(l), l.length - 1]);\n", " } return { score: a ? .5 : 1, isMatch: a, matchedIndices: s }; }; }, function (e, t, n) { var r = n(5), o = n(6); e.exports = function (e, t, n, i) { for (var a = i.location, s = void 0 === a ? 0 : a, c = i.distance, h = void 0 === c ? 100 : c, l = i.threshold, u = void 0 === l ? .6 : l, f = i.findAllMatches, d = void 0 !== f && f, v = i.minMatchCharLength, p = void 0 === v ? 1 : v, g = s, y = e.length, m = u, k = e.indexOf(t, g), S = t.length, x = [], b = 0; b < y; b += 1)\n", " x[b] = 0; if (-1 !== k) {\n", " var M = r(t, { errors: 0, currentLocation: k, expectedLocation: g, distance: h });\n", " if (m = Math.min(M, m), -1 !== (k = e.lastIndexOf(t, g + S))) {\n", " var _ = r(t, { errors: 0, currentLocation: k, expectedLocation: g, distance: h });\n", " m = Math.min(_, m);\n", " }\n", " } k = -1; for (var L = [], w = 1, A = S + y, C = 1 << S - 1, I = 0; I < S; I += 1) {\n", " for (var O = 0, j = A; O < j;) {\n", " r(t, { errors: I, currentLocation: g + j, expectedLocation: g, distance: h }) <= m ? O = j : A = j, j = Math.floor((A - O) / 2 + O);\n", " }\n", " A = j;\n", " var P = Math.max(1, g - j + 1), F = d ? y : Math.min(g + j, y) + S, T = Array(F + 2);\n", " T[F + 1] = (1 << I) - 1;\n", " for (var z = F; z >= P; z -= 1) {\n", " var E = z - 1, K = n[e.charAt(E)];\n", " if (K && (x[E] = 1), T[z] = (T[z + 1] << 1 | 1) & K, 0 !== I && (T[z] |= (L[z + 1] | L[z]) << 1 | 1 | L[z + 1]), T[z] & C && (w = r(t, { errors: I, currentLocation: E, expectedLocation: g, distance: h })) <= m) {\n", " if (m = w, (k = E) <= g)\n", " break;\n", " P = Math.max(1, 2 * g - k);\n", " }\n", " }\n", " if (r(t, { errors: I + 1, currentLocation: g, expectedLocation: g, distance: h }) > m)\n", " break;\n", " L = T;\n", " } return { isMatch: k >= 0, score: 0 === w ? .001 : w, matchedIndices: o(x, p) }; }; }, function (e, t) { e.exports = function (e, t) { var n = t.errors, r = void 0 === n ? 0 : n, o = t.currentLocation, i = void 0 === o ? 0 : o, a = t.expectedLocation, s = void 0 === a ? 0 : a, c = t.distance, h = void 0 === c ? 100 : c, l = r / e.length, u = Math.abs(s - i); return h ? l + u / h : u ? 1 : l; }; }, function (e, t) { e.exports = function () { for (var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [], t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1, n = [], r = -1, o = -1, i = 0, a = e.length; i < a; i += 1) {\n", " var s = e[i];\n", " s && -1 === r ? r = i : s || -1 === r || ((o = i - 1) - r + 1 >= t && n.push([r, o]), r = -1);\n", " } return e[i - 1] && i - r >= t && n.push([r, i - 1]), n; }; }, function (e, t) { e.exports = function (e) { for (var t = {}, n = e.length, r = 0; r < n; r += 1)\n", " t[e.charAt(r)] = 0; for (var o = 0; o < n; o += 1)\n", " t[e.charAt(o)] |= 1 << n - o - 1; return t; }; }, function (e, t, n) { var r = n(0); e.exports = function (e, t) { return function e(t, n, o) { if (n) {\n", " var i = n.indexOf(\".\"), a = n, s = null;\n", " -1 !== i && (a = n.slice(0, i), s = n.slice(i + 1));\n", " var c = t[a];\n", " if (null != c)\n", " if (s || \"string\" != typeof c && \"number\" != typeof c)\n", " if (r(c))\n", " for (var h = 0, l = c.length; h < l; h += 1)\n", " e(c[h], s, o);\n", " else\n", " s && e(c, s, o);\n", " else\n", " o.push(c.toString());\n", " }\n", " else\n", " o.push(t); return o; }(e, t, []); }; }]); });\n", " /***/ \n", " }),\n", " /* 3 */\n", " /***/ (function (module, __webpack_exports__, __webpack_require__) {\n", " \"use strict\";\n", " /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function () { return symbolObservablePonyfill; });\n", " function symbolObservablePonyfill(root) {\n", " var result;\n", " var Symbol = root.Symbol;\n", " if (typeof Symbol === 'function') {\n", " if (Symbol.observable) {\n", " result = Symbol.observable;\n", " }\n", " else {\n", " result = Symbol('observable');\n", " Symbol.observable = result;\n", " }\n", " }\n", " else {\n", " result = '@@observable';\n", " }\n", " return result;\n", " }\n", " ;\n", " /***/ \n", " }),\n", " /* 4 */\n", " /***/ (function (module, exports, __webpack_require__) {\n", " module.exports = __webpack_require__(7);\n", " /***/ \n", " }),\n", " /* 5 */\n", " /***/ (function (module, exports) {\n", " var g;\n", " // This works in non-strict mode\n", " g = (function () {\n", " return this;\n", " })();\n", " try {\n", " // This works if eval is allowed (see CSP)\n", " g = g || new Function(\"return this\")();\n", " }\n", " catch (e) {\n", " // This works if the window reference is available\n", " if (typeof window === \"object\")\n", " g = window;\n", " }\n", " // g can still be undefined, but nothing to do about it...\n", " // We return undefined, instead of nothing here, so it's\n", " // easier to handle this case. if(!global) { ...}\n", " module.exports = g;\n", " /***/ \n", " }),\n", " /* 6 */\n", " /***/ (function (module, exports) {\n", " module.exports = function (originalModule) {\n", " if (!originalModule.webpackPolyfill) {\n", " var module = Object.create(originalModule);\n", " // module.parent = undefined by default\n", " if (!module.children)\n", " module.children = [];\n", " Object.defineProperty(module, \"loaded\", {\n", " enumerable: true,\n", " get: function () {\n", " return module.l;\n", " }\n", " });\n", " Object.defineProperty(module, \"id\", {\n", " enumerable: true,\n", " get: function () {\n", " return module.i;\n", " }\n", " });\n", " Object.defineProperty(module, \"exports\", {\n", " enumerable: true\n", " });\n", " module.webpackPolyfill = 1;\n", " }\n", " return module;\n", " };\n", " /***/ \n", " }),\n", " /* 7 */\n", " /***/ (function (module, __webpack_exports__, __webpack_require__) {\n", " \"use strict\";\n", " __webpack_require__.r(__webpack_exports__);\n", " // EXTERNAL MODULE: ./node_modules/fuse.js/dist/fuse.js\n", " var dist_fuse = __webpack_require__(2);\n", " var fuse_default = /*#__PURE__*/ __webpack_require__.n(dist_fuse);\n", " // EXTERNAL MODULE: ./node_modules/deepmerge/dist/cjs.js\n", " var cjs = __webpack_require__(0);\n", " var cjs_default = /*#__PURE__*/ __webpack_require__.n(cjs);\n", " // EXTERNAL MODULE: ./node_modules/symbol-observable/es/index.js\n", " var es = __webpack_require__(1);\n", " // CONCATENATED MODULE: ./node_modules/redux/es/redux.js\n", " /**\n", " * These are private action types reserved by Redux.\n", " * For any unknown actions, you must return the current state.\n", " * If the current state is undefined, you must return the initial state.\n", " * Do not reference these action types directly in your code.\n", " */\n", " var randomString = function randomString() {\n", " return Math.random().toString(36).substring(7).split('').join('.');\n", " };\n", " var ActionTypes = {\n", " INIT: \"@@redux/INIT\" + randomString(),\n", " REPLACE: \"@@redux/REPLACE\" + randomString(),\n", " PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {\n", " return \"@@redux/PROBE_UNKNOWN_ACTION\" + randomString();\n", " }\n", " };\n", " /**\n", " * @param {any} obj The object to inspect.\n", " * @returns {boolean} True if the argument appears to be a plain object.\n", " */\n", " function isPlainObject(obj) {\n", " if (typeof obj !== 'object' || obj === null)\n", " return false;\n", " var proto = obj;\n", " while (Object.getPrototypeOf(proto) !== null) {\n", " proto = Object.getPrototypeOf(proto);\n", " }\n", " return Object.getPrototypeOf(obj) === proto;\n", " }\n", " /**\n", " * Creates a Redux store that holds the state tree.\n", " * The only way to change the data in the store is to call `dispatch()` on it.\n", " *\n", " * There should only be a single store in your app. To specify how different\n", " * parts of the state tree respond to actions, you may combine several reducers\n", " * into a single reducer function by using `combineReducers`.\n", " *\n", " * @param {Function} reducer A function that returns the next state tree, given\n", " * the current state tree and the action to handle.\n", " *\n", " * @param {any} [preloadedState] The initial state. You may optionally specify it\n", " * to hydrate the state from the server in universal apps, or to restore a\n", " * previously serialized user session.\n", " * If you use `combineReducers` to produce the root reducer function, this must be\n", " * an object with the same shape as `combineReducers` keys.\n", " *\n", " * @param {Function} [enhancer] The store enhancer. You may optionally specify it\n", " * to enhance the store with third-party capabilities such as middleware,\n", " * time travel, persistence, etc. The only store enhancer that ships with Redux\n", " * is `applyMiddleware()`.\n", " *\n", " * @returns {Store} A Redux store that lets you read the state, dispatch actions\n", " * and subscribe to changes.\n", " */\n", " function createStore(reducer, preloadedState, enhancer) {\n", " var _ref2;\n", " if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') {\n", " throw new Error('It looks like you are passing several store enhancers to ' + 'createStore(). This is not supported. Instead, compose them ' + 'together to a single function.');\n", " }\n", " if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {\n", " enhancer = preloadedState;\n", " preloadedState = undefined;\n", " }\n", " if (typeof enhancer !== 'undefined') {\n", " if (typeof enhancer !== 'function') {\n", " throw new Error('Expected the enhancer to be a function.');\n", " }\n", " return enhancer(createStore)(reducer, preloadedState);\n", " }\n", " if (typeof reducer !== 'function') {\n", " throw new Error('Expected the reducer to be a function.');\n", " }\n", " var currentReducer = reducer;\n", " var currentState = preloadedState;\n", " var currentListeners = [];\n", " var nextListeners = currentListeners;\n", " var isDispatching = false;\n", " /**\n", " * This makes a shallow copy of currentListeners so we can use\n", " * nextListeners as a temporary list while dispatching.\n", " *\n", " * This prevents any bugs around consumers calling\n", " * subscribe/unsubscribe in the middle of a dispatch.\n", " */\n", " function ensureCanMutateNextListeners() {\n", " if (nextListeners === currentListeners) {\n", " nextListeners = currentListeners.slice();\n", " }\n", " }\n", " /**\n", " * Reads the state tree managed by the store.\n", " *\n", " * @returns {any} The current state tree of your application.\n", " */\n", " function getState() {\n", " if (isDispatching) {\n", " throw new Error('You may not call store.getState() while the reducer is executing. ' + 'The reducer has already received the state as an argument. ' + 'Pass it down from the top reducer instead of reading it from the store.');\n", " }\n", " return currentState;\n", " }\n", " /**\n", " * Adds a change listener. It will be called any time an action is dispatched,\n", " * and some part of the state tree may potentially have changed. You may then\n", " * call `getState()` to read the current state tree inside the callback.\n", " *\n", " * You may call `dispatch()` from a change listener, with the following\n", " * caveats:\n", " *\n", " * 1. The subscriptions are snapshotted just before every `dispatch()` call.\n", " * If you subscribe or unsubscribe while the listeners are being invoked, this\n", " * will not have any effect on the `dispatch()` that is currently in progress.\n", " * However, the next `dispatch()` call, whether nested or not, will use a more\n", " * recent snapshot of the subscription list.\n", " *\n", " * 2. The listener should not expect to see all state changes, as the state\n", " * might have been updated multiple times during a nested `dispatch()` before\n", " * the listener is called. It is, however, guaranteed that all subscribers\n", " * registered before the `dispatch()` started will be called with the latest\n", " * state by the time it exits.\n", " *\n", " * @param {Function} listener A callback to be invoked on every dispatch.\n", " * @returns {Function} A function to remove this change listener.\n", " */\n", " function subscribe(listener) {\n", " if (typeof listener !== 'function') {\n", " throw new Error('Expected the listener to be a function.');\n", " }\n", " if (isDispatching) {\n", " throw new Error('You may not call store.subscribe() while the reducer is executing. ' + 'If you would like to be notified after the store has been updated, subscribe from a ' + 'component and invoke store.getState() in the callback to access the latest state. ' + 'See https://redux.js.org/api-reference/store#subscribe(listener) for more details.');\n", " }\n", " var isSubscribed = true;\n", " ensureCanMutateNextListeners();\n", " nextListeners.push(listener);\n", " return function unsubscribe() {\n", " if (!isSubscribed) {\n", " return;\n", " }\n", " if (isDispatching) {\n", " throw new Error('You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api-reference/store#subscribe(listener) for more details.');\n", " }\n", " isSubscribed = false;\n", " ensureCanMutateNextListeners();\n", " var index = nextListeners.indexOf(listener);\n", " nextListeners.splice(index, 1);\n", " };\n", " }\n", " /**\n", " * Dispatches an action. It is the only way to trigger a state change.\n", " *\n", " * The `reducer` function, used to create the store, will be called with the\n", " * current state tree and the given `action`. Its return value will\n", " * be considered the **next** state of the tree, and the change listeners\n", " * will be notified.\n", " *\n", " * The base implementation only supports plain object actions. If you want to\n", " * dispatch a Promise, an Observable, a thunk, or something else, you need to\n", " * wrap your store creating function into the corresponding middleware. For\n", " * example, see the documentation for the `redux-thunk` package. Even the\n", " * middleware will eventually dispatch plain object actions using this method.\n", " *\n", " * @param {Object} action A plain object representing “what changed”. It is\n", " * a good idea to keep actions serializable so you can record and replay user\n", " * sessions, or use the time travelling `redux-devtools`. An action must have\n", " * a `type` property which may not be `undefined`. It is a good idea to use\n", " * string constants for action types.\n", " *\n", " * @returns {Object} For convenience, the same action object you dispatched.\n", " *\n", " * Note that, if you use a custom middleware, it may wrap `dispatch()` to\n", " * return something else (for example, a Promise you can await).\n", " */\n", " function dispatch(action) {\n", " if (!isPlainObject(action)) {\n", " throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.');\n", " }\n", " if (typeof action.type === 'undefined') {\n", " throw new Error('Actions may not have an undefined \"type\" property. ' + 'Have you misspelled a constant?');\n", " }\n", " if (isDispatching) {\n", " throw new Error('Reducers may not dispatch actions.');\n", " }\n", " try {\n", " isDispatching = true;\n", " currentState = currentReducer(currentState, action);\n", " }\n", " finally {\n", " isDispatching = false;\n", " }\n", " var listeners = currentListeners = nextListeners;\n", " for (var i = 0; i < listeners.length; i++) {\n", " var listener = listeners[i];\n", " listener();\n", " }\n", " return action;\n", " }\n", " /**\n", " * Replaces the reducer currently used by the store to calculate the state.\n", " *\n", " * You might need this if your app implements code splitting and you want to\n", " * load some of the reducers dynamically. You might also need this if you\n", " * implement a hot reloading mechanism for Redux.\n", " *\n", " * @param {Function} nextReducer The reducer for the store to use instead.\n", " * @returns {void}\n", " */\n", " function replaceReducer(nextReducer) {\n", " if (typeof nextReducer !== 'function') {\n", " throw new Error('Expected the nextReducer to be a function.');\n", " }\n", " currentReducer = nextReducer; // This action has a similiar effect to ActionTypes.INIT.\n", " // Any reducers that existed in both the new and old rootReducer\n", " // will receive the previous state. This effectively populates\n", " // the new state tree with any relevant data from the old one.\n", " dispatch({\n", " type: ActionTypes.REPLACE\n", " });\n", " }\n", " /**\n", " * Interoperability point for observable/reactive libraries.\n", " * @returns {observable} A minimal observable of state changes.\n", " * For more information, see the observable proposal:\n", " * https://github.com/tc39/proposal-observable\n", " */\n", " function observable() {\n", " var _ref;\n", " var outerSubscribe = subscribe;\n", " return _ref = {\n", " /**\n", " * The minimal observable subscription method.\n", " * @param {Object} observer Any object that can be used as an observer.\n", " * The observer object should have a `next` method.\n", " * @returns {subscription} An object with an `unsubscribe` method that can\n", " * be used to unsubscribe the observable from the store, and prevent further\n", " * emission of values from the observable.\n", " */\n", " subscribe: function subscribe(observer) {\n", " if (typeof observer !== 'object' || observer === null) {\n", " throw new TypeError('Expected the observer to be an object.');\n", " }\n", " function observeState() {\n", " if (observer.next) {\n", " observer.next(getState());\n", " }\n", " }\n", " observeState();\n", " var unsubscribe = outerSubscribe(observeState);\n", " return {\n", " unsubscribe: unsubscribe\n", " };\n", " }\n", " }, _ref[es[\"a\" /* default */]] = function () {\n", " return this;\n", " }, _ref;\n", " } // When a store is created, an \"INIT\" action is dispatched so that every\n", " // reducer returns their initial state. This effectively populates\n", " // the initial state tree.\n", " dispatch({\n", " type: ActionTypes.INIT\n", " });\n", " return _ref2 = {\n", " dispatch: dispatch,\n", " subscribe: subscribe,\n", " getState: getState,\n", " replaceReducer: replaceReducer\n", " }, _ref2[es[\"a\" /* default */]] = observable, _ref2;\n", " }\n", " /**\n", " * Prints a warning in the console if it exists.\n", " *\n", " * @param {String} message The warning message.\n", " * @returns {void}\n", " */\n", " function warning(message) {\n", " /* eslint-disable no-console */\n", " if (typeof console !== 'undefined' && typeof console.error === 'function') {\n", " console.error(message);\n", " }\n", " /* eslint-enable no-console */\n", " try {\n", " // This error was thrown as a convenience so that if you enable\n", " // \"break on all exceptions\" in your console,\n", " // it would pause the execution at this line.\n", " throw new Error(message);\n", " }\n", " catch (e) { } // eslint-disable-line no-empty\n", " }\n", " function getUndefinedStateErrorMessage(key, action) {\n", " var actionType = action && action.type;\n", " var actionDescription = actionType && \"action \\\"\" + String(actionType) + \"\\\"\" || 'an action';\n", " return \"Given \" + actionDescription + \", reducer \\\"\" + key + \"\\\" returned undefined. \" + \"To ignore an action, you must explicitly return the previous state. \" + \"If you want this reducer to hold no value, you can return null instead of undefined.\";\n", " }\n", " function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {\n", " var reducerKeys = Object.keys(reducers);\n", " var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';\n", " if (reducerKeys.length === 0) {\n", " return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';\n", " }\n", " if (!isPlainObject(inputState)) {\n", " return \"The \" + argumentName + \" has unexpected type of \\\"\" + {}.toString.call(inputState).match(/\\s([a-z|A-Z]+)/)[1] + \"\\\". Expected argument to be an object with the following \" + (\"keys: \\\"\" + reducerKeys.join('\", \"') + \"\\\"\");\n", " }\n", " var unexpectedKeys = Object.keys(inputState).filter(function (key) {\n", " return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];\n", " });\n", " unexpectedKeys.forEach(function (key) {\n", " unexpectedKeyCache[key] = true;\n", " });\n", " if (action && action.type === ActionTypes.REPLACE)\n", " return;\n", " if (unexpectedKeys.length > 0) {\n", " return \"Unexpected \" + (unexpectedKeys.length > 1 ? 'keys' : 'key') + \" \" + (\"\\\"\" + unexpectedKeys.join('\", \"') + \"\\\" found in \" + argumentName + \". \") + \"Expected to find one of the known reducer keys instead: \" + (\"\\\"\" + reducerKeys.join('\", \"') + \"\\\". Unexpected keys will be ignored.\");\n", " }\n", " }\n", " function assertReducerShape(reducers) {\n", " Object.keys(reducers).forEach(function (key) {\n", " var reducer = reducers[key];\n", " var initialState = reducer(undefined, {\n", " type: ActionTypes.INIT\n", " });\n", " if (typeof initialState === 'undefined') {\n", " throw new Error(\"Reducer \\\"\" + key + \"\\\" returned undefined during initialization. \" + \"If the state passed to the reducer is undefined, you must \" + \"explicitly return the initial state. The initial state may \" + \"not be undefined. If you don't want to set a value for this reducer, \" + \"you can use null instead of undefined.\");\n", " }\n", " if (typeof reducer(undefined, {\n", " type: ActionTypes.PROBE_UNKNOWN_ACTION()\n", " }) === 'undefined') {\n", " throw new Error(\"Reducer \\\"\" + key + \"\\\" returned undefined when probed with a random type. \" + (\"Don't try to handle \" + ActionTypes.INIT + \" or other actions in \\\"redux/*\\\" \") + \"namespace. They are considered private. Instead, you must return the \" + \"current state for any unknown actions, unless it is undefined, \" + \"in which case you must return the initial state, regardless of the \" + \"action type. The initial state may not be undefined, but can be null.\");\n", " }\n", " });\n", " }\n", " /**\n", " * Turns an object whose values are different reducer functions, into a single\n", " * reducer function. It will call every child reducer, and gather their results\n", " * into a single state object, whose keys correspond to the keys of the passed\n", " * reducer functions.\n", " *\n", " * @param {Object} reducers An object whose values correspond to different\n", " * reducer functions that need to be combined into one. One handy way to obtain\n", " * it is to use ES6 `import * as reducers` syntax. The reducers may never return\n", " * undefined for any action. Instead, they should return their initial state\n", " * if the state passed to them was undefined, and the current state for any\n", " * unrecognized action.\n", " *\n", " * @returns {Function} A reducer function that invokes every reducer inside the\n", " * passed object, and builds a state object with the same shape.\n", " */\n", " function combineReducers(reducers) {\n", " var reducerKeys = Object.keys(reducers);\n", " var finalReducers = {};\n", " for (var i = 0; i < reducerKeys.length; i++) {\n", " var key = reducerKeys[i];\n", " if (false) { }\n", " if (typeof reducers[key] === 'function') {\n", " finalReducers[key] = reducers[key];\n", " }\n", " }\n", " var finalReducerKeys = Object.keys(finalReducers); // This is used to make sure we don't warn about the same\n", " // keys multiple times.\n", " var unexpectedKeyCache;\n", " if (false) { }\n", " var shapeAssertionError;\n", " try {\n", " assertReducerShape(finalReducers);\n", " }\n", " catch (e) {\n", " shapeAssertionError = e;\n", " }\n", " return function combination(state, action) {\n", " if (state === void 0) {\n", " state = {};\n", " }\n", " if (shapeAssertionError) {\n", " throw shapeAssertionError;\n", " }\n", " if (false) {\n", " var warningMessage;\n", " }\n", " var hasChanged = false;\n", " var nextState = {};\n", " for (var _i = 0; _i < finalReducerKeys.length; _i++) {\n", " var _key = finalReducerKeys[_i];\n", " var reducer = finalReducers[_key];\n", " var previousStateForKey = state[_key];\n", " var nextStateForKey = reducer(previousStateForKey, action);\n", " if (typeof nextStateForKey === 'undefined') {\n", " var errorMessage = getUndefinedStateErrorMessage(_key, action);\n", " throw new Error(errorMessage);\n", " }\n", " nextState[_key] = nextStateForKey;\n", " hasChanged = hasChanged || nextStateForKey !== previousStateForKey;\n", " }\n", " return hasChanged ? nextState : state;\n", " };\n", " }\n", " function bindActionCreator(actionCreator, dispatch) {\n", " return function () {\n", " return dispatch(actionCreator.apply(this, arguments));\n", " };\n", " }\n", " /**\n", " * Turns an object whose values are action creators, into an object with the\n", " * same keys, but with every function wrapped into a `dispatch` call so they\n", " * may be invoked directly. This is just a convenience method, as you can call\n", " * `store.dispatch(MyActionCreators.doSomething())` yourself just fine.\n", " *\n", " * For convenience, you can also pass an action creator as the first argument,\n", " * and get a dispatch wrapped function in return.\n", " *\n", " * @param {Function|Object} actionCreators An object whose values are action\n", " * creator functions. One handy way to obtain it is to use ES6 `import * as`\n", " * syntax. You may also pass a single function.\n", " *\n", " * @param {Function} dispatch The `dispatch` function available on your Redux\n", " * store.\n", " *\n", " * @returns {Function|Object} The object mimicking the original object, but with\n", " * every action creator wrapped into the `dispatch` call. If you passed a\n", " * function as `actionCreators`, the return value will also be a single\n", " * function.\n", " */\n", " function bindActionCreators(actionCreators, dispatch) {\n", " if (typeof actionCreators === 'function') {\n", " return bindActionCreator(actionCreators, dispatch);\n", " }\n", " if (typeof actionCreators !== 'object' || actionCreators === null) {\n", " throw new Error(\"bindActionCreators expected an object or a function, instead received \" + (actionCreators === null ? 'null' : typeof actionCreators) + \". \" + \"Did you write \\\"import ActionCreators from\\\" instead of \\\"import * as ActionCreators from\\\"?\");\n", " }\n", " var boundActionCreators = {};\n", " for (var key in actionCreators) {\n", " var actionCreator = actionCreators[key];\n", " if (typeof actionCreator === 'function') {\n", " boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);\n", " }\n", " }\n", " return boundActionCreators;\n", " }\n", " function _defineProperty(obj, key, value) {\n", " if (key in obj) {\n", " Object.defineProperty(obj, key, {\n", " value: value,\n", " enumerable: true,\n", " configurable: true,\n", " writable: true\n", " });\n", " }\n", " else {\n", " obj[key] = value;\n", " }\n", " return obj;\n", " }\n", " function ownKeys(object, enumerableOnly) {\n", " var keys = Object.keys(object);\n", " if (Object.getOwnPropertySymbols) {\n", " keys.push.apply(keys, Object.getOwnPropertySymbols(object));\n", " }\n", " if (enumerableOnly)\n", " keys = keys.filter(function (sym) {\n", " return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n", " });\n", " return keys;\n", " }\n", " function _objectSpread2(target) {\n", " for (var i = 1; i < arguments.length; i++) {\n", " var source = arguments[i] != null ? arguments[i] : {};\n", " if (i % 2) {\n", " ownKeys(source, true).forEach(function (key) {\n", " _defineProperty(target, key, source[key]);\n", " });\n", " }\n", " else if (Object.getOwnPropertyDescriptors) {\n", " Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n", " }\n", " else {\n", " ownKeys(source).forEach(function (key) {\n", " Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n", " });\n", " }\n", " }\n", " return target;\n", " }\n", " /**\n", " * Composes single-argument functions from right to left. The rightmost\n", " * function can take multiple arguments as it provides the signature for\n", " * the resulting composite function.\n", " *\n", " * @param {...Function} funcs The functions to compose.\n", " * @returns {Function} A function obtained by composing the argument functions\n", " * from right to left. For example, compose(f, g, h) is identical to doing\n", " * (...args) => f(g(h(...args))).\n", " */\n", " function compose() {\n", " for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {\n", " funcs[_key] = arguments[_key];\n", " }\n", " if (funcs.length === 0) {\n", " return function (arg) {\n", " return arg;\n", " };\n", " }\n", " if (funcs.length === 1) {\n", " return funcs[0];\n", " }\n", " return funcs.reduce(function (a, b) {\n", " return function () {\n", " return a(b.apply(void 0, arguments));\n", " };\n", " });\n", " }\n", " /**\n", " * Creates a store enhancer that applies middleware to the dispatch method\n", " * of the Redux store. This is handy for a variety of tasks, such as expressing\n", " * asynchronous actions in a concise manner, or logging every action payload.\n", " *\n", " * See `redux-thunk` package as an example of the Redux middleware.\n", " *\n", " * Because middleware is potentially asynchronous, this should be the first\n", " * store enhancer in the composition chain.\n", " *\n", " * Note that each middleware will be given the `dispatch` and `getState` functions\n", " * as named arguments.\n", " *\n", " * @param {...Function} middlewares The middleware chain to be applied.\n", " * @returns {Function} A store enhancer applying the middleware.\n", " */\n", " function applyMiddleware() {\n", " for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {\n", " middlewares[_key] = arguments[_key];\n", " }\n", " return function (createStore) {\n", " return function () {\n", " var store = createStore.apply(void 0, arguments);\n", " var _dispatch = function dispatch() {\n", " throw new Error('Dispatching while constructing your middleware is not allowed. ' + 'Other middleware would not be applied to this dispatch.');\n", " };\n", " var middlewareAPI = {\n", " getState: store.getState,\n", " dispatch: function dispatch() {\n", " return _dispatch.apply(void 0, arguments);\n", " }\n", " };\n", " var chain = middlewares.map(function (middleware) {\n", " return middleware(middlewareAPI);\n", " });\n", " _dispatch = compose.apply(void 0, chain)(store.dispatch);\n", " return _objectSpread2({}, store, {\n", " dispatch: _dispatch\n", " });\n", " };\n", " };\n", " }\n", " /*\n", " * This is a dummy function to check if the function name has been altered by minification.\n", " * If the function has been minified and NODE_ENV !== 'production', warn the user.\n", " */\n", " function isCrushed() { }\n", " if (false) { }\n", " // CONCATENATED MODULE: ./src/scripts/reducers/items.js\n", " var defaultState = [];\n", " function items_items(state, action) {\n", " if (state === void 0) {\n", " state = defaultState;\n", " }\n", " switch (action.type) {\n", " case 'ADD_ITEM':\n", " {\n", " // Add object to items array\n", " var newState = [].concat(state, [{\n", " id: action.id,\n", " choiceId: action.choiceId,\n", " groupId: action.groupId,\n", " value: action.value,\n", " label: action.label,\n", " active: true,\n", " highlighted: false,\n", " customProperties: action.customProperties,\n", " placeholder: action.placeholder || false,\n", " keyCode: null\n", " }]);\n", " return newState.map(function (obj) {\n", " var item = obj;\n", " item.highlighted = false;\n", " return item;\n", " });\n", " }\n", " case 'REMOVE_ITEM':\n", " {\n", " // Set item to inactive\n", " return state.map(function (obj) {\n", " var item = obj;\n", " if (item.id === action.id) {\n", " item.active = false;\n", " }\n", " return item;\n", " });\n", " }\n", " case 'HIGHLIGHT_ITEM':\n", " {\n", " return state.map(function (obj) {\n", " var item = obj;\n", " if (item.id === action.id) {\n", " item.highlighted = action.highlighted;\n", " }\n", " return item;\n", " });\n", " }\n", " default:\n", " {\n", " return state;\n", " }\n", " }\n", " }\n", " // CONCATENATED MODULE: ./src/scripts/reducers/groups.js\n", " var groups_defaultState = [];\n", " function groups(state, action) {\n", " if (state === void 0) {\n", " state = groups_defaultState;\n", " }\n", " switch (action.type) {\n", " case 'ADD_GROUP':\n", " {\n", " return [].concat(state, [{\n", " id: action.id,\n", " value: action.value,\n", " active: action.active,\n", " disabled: action.disabled\n", " }]);\n", " }\n", " case 'CLEAR_CHOICES':\n", " {\n", " return [];\n", " }\n", " default:\n", " {\n", " return state;\n", " }\n", " }\n", " }\n", " // CONCATENATED MODULE: ./src/scripts/reducers/choices.js\n", " var choices_defaultState = [];\n", " function choices_choices(state, action) {\n", " if (state === void 0) {\n", " state = choices_defaultState;\n", " }\n", " switch (action.type) {\n", " case 'ADD_CHOICE':\n", " {\n", " /*\n", " A disabled choice appears in the choice dropdown but cannot be selected\n", " A selected choice has been added to the passed input's value (added as an item)\n", " An active choice appears within the choice dropdown\n", " */\n", " return [].concat(state, [{\n", " id: action.id,\n", " elementId: action.elementId,\n", " groupId: action.groupId,\n", " value: action.value,\n", " label: action.label || action.value,\n", " disabled: action.disabled || false,\n", " selected: false,\n", " active: true,\n", " score: 9999,\n", " customProperties: action.customProperties,\n", " placeholder: action.placeholder || false,\n", " keyCode: null\n", " }]);\n", " }\n", " case 'ADD_ITEM':\n", " {\n", " // If all choices need to be activated\n", " if (action.activateOptions) {\n", " return state.map(function (obj) {\n", " var choice = obj;\n", " choice.active = action.active;\n", " return choice;\n", " });\n", " } // When an item is added and it has an associated choice,\n", " // we want to disable it so it can't be chosen again\n", " if (action.choiceId > -1) {\n", " return state.map(function (obj) {\n", " var choice = obj;\n", " if (choice.id === parseInt(action.choiceId, 10)) {\n", " choice.selected = true;\n", " }\n", " return choice;\n", " });\n", " }\n", " return state;\n", " }\n", " case 'REMOVE_ITEM':\n", " {\n", " // When an item is removed and it has an associated choice,\n", " // we want to re-enable it so it can be chosen again\n", " if (action.choiceId > -1) {\n", " return state.map(function (obj) {\n", " var choice = obj;\n", " if (choice.id === parseInt(action.choiceId, 10)) {\n", " choice.selected = false;\n", " }\n", " return choice;\n", " });\n", " }\n", " return state;\n", " }\n", " case 'FILTER_CHOICES':\n", " {\n", " return state.map(function (obj) {\n", " var choice = obj; // Set active state based on whether choice is\n", " // within filtered results\n", " choice.active = action.results.some(function (_ref) {\n", " var item = _ref.item, score = _ref.score;\n", " if (item.id === choice.id) {\n", " choice.score = score;\n", " return true;\n", " }\n", " return false;\n", " });\n", " return choice;\n", " });\n", " }\n", " case 'ACTIVATE_CHOICES':\n", " {\n", " return state.map(function (obj) {\n", " var choice = obj;\n", " choice.active = action.active;\n", " return choice;\n", " });\n", " }\n", " case 'CLEAR_CHOICES':\n", " {\n", " return choices_defaultState;\n", " }\n", " default:\n", " {\n", " return state;\n", " }\n", " }\n", " }\n", " // CONCATENATED MODULE: ./src/scripts/reducers/general.js\n", " var general_defaultState = {\n", " loading: false\n", " };\n", " var general = function general(state, action) {\n", " if (state === void 0) {\n", " state = general_defaultState;\n", " }\n", " switch (action.type) {\n", " case 'SET_IS_LOADING':\n", " {\n", " return {\n", " loading: action.isLoading\n", " };\n", " }\n", " default:\n", " {\n", " return state;\n", " }\n", " }\n", " };\n", " /* harmony default export */ var reducers_general = (general);\n", " // CONCATENATED MODULE: ./src/scripts/lib/utils.js\n", " /**\n", " * @param {number} min\n", " * @param {number} max\n", " * @returns {number}\n", " */\n", " var getRandomNumber = function getRandomNumber(min, max) {\n", " return Math.floor(Math.random() * (max - min) + min);\n", " };\n", " /**\n", " * @param {number} length\n", " * @returns {string}\n", " */\n", " var generateChars = function generateChars(length) {\n", " return Array.from({\n", " length: length\n", " }, function () {\n", " return getRandomNumber(0, 36).toString(36);\n", " }).join('');\n", " };\n", " /**\n", " * @param {HTMLInputElement | HTMLSelectElement} element\n", " * @param {string} prefix\n", " * @returns {string}\n", " */\n", " var generateId = function generateId(element, prefix) {\n", " var id = element.id || element.name && element.name + \"-\" + generateChars(2) || generateChars(4);\n", " id = id.replace(/(:|\\.|\\[|\\]|,)/g, '');\n", " id = prefix + \"-\" + id;\n", " return id;\n", " };\n", " /**\n", " * @param {any} obj\n", " * @returns {string}\n", " */\n", " var getType = function getType(obj) {\n", " return Object.prototype.toString.call(obj).slice(8, -1);\n", " };\n", " /**\n", " * @param {string} type\n", " * @param {any} obj\n", " * @returns {boolean}\n", " */\n", " var isType = function isType(type, obj) {\n", " return obj !== undefined && obj !== null && getType(obj) === type;\n", " };\n", " /**\n", " * @param {HTMLElement} element\n", " * @param {HTMLElement} [wrapper={HTMLDivElement}]\n", " * @returns {HTMLElement}\n", " */\n", " var utils_wrap = function wrap(element, wrapper) {\n", " if (wrapper === void 0) {\n", " wrapper = document.createElement('div');\n", " }\n", " if (element.nextSibling) {\n", " element.parentNode.insertBefore(wrapper, element.nextSibling);\n", " }\n", " else {\n", " element.parentNode.appendChild(wrapper);\n", " }\n", " return wrapper.appendChild(element);\n", " };\n", " /**\n", " * @param {Element} startEl\n", " * @param {string} selector\n", " * @param {1 | -1} direction\n", " * @returns {Element | undefined}\n", " */\n", " var getAdjacentEl = function getAdjacentEl(startEl, selector, direction) {\n", " if (direction === void 0) {\n", " direction = 1;\n", " }\n", " if (!(startEl instanceof Element) || typeof selector !== 'string') {\n", " return undefined;\n", " }\n", " var prop = (direction > 0 ? 'next' : 'previous') + \"ElementSibling\";\n", " var sibling = startEl[prop];\n", " while (sibling) {\n", " if (sibling.matches(selector)) {\n", " return sibling;\n", " }\n", " sibling = sibling[prop];\n", " }\n", " return sibling;\n", " };\n", " /**\n", " * @param {Element} element\n", " * @param {Element} parent\n", " * @param {-1 | 1} direction\n", " * @returns {boolean}\n", " */\n", " var isScrolledIntoView = function isScrolledIntoView(element, parent, direction) {\n", " if (direction === void 0) {\n", " direction = 1;\n", " }\n", " if (!element) {\n", " return false;\n", " }\n", " var isVisible;\n", " if (direction > 0) {\n", " // In view from bottom\n", " isVisible = parent.scrollTop + parent.offsetHeight >= element.offsetTop + element.offsetHeight;\n", " }\n", " else {\n", " // In view from top\n", " isVisible = element.offsetTop >= parent.scrollTop;\n", " }\n", " return isVisible;\n", " };\n", " /**\n", " * @param {any} value\n", " * @returns {any}\n", " */\n", " var sanitise = function sanitise(value) {\n", " if (typeof value !== 'string') {\n", " return value;\n", " }\n", " return value.replace(/&/g, '&').replace(/>/g, '&rt;').replace(/ (str: string) => Element}\n", " */\n", " var strToEl = function () {\n", " var tmpEl = document.createElement('div');\n", " return function (str) {\n", " var cleanedInput = str.trim();\n", " tmpEl.innerHTML = cleanedInput;\n", " var firldChild = tmpEl.children[0];\n", " while (tmpEl.firstChild) {\n", " tmpEl.removeChild(tmpEl.firstChild);\n", " }\n", " return firldChild;\n", " };\n", " }();\n", " /**\n", " * @param {{ label?: string, value: string }} a\n", " * @param {{ label?: string, value: string }} b\n", " * @returns {number}\n", " */\n", " var sortByAlpha = function sortByAlpha(_ref, _ref2) {\n", " var value = _ref.value, _ref$label = _ref.label, label = _ref$label === void 0 ? value : _ref$label;\n", " var value2 = _ref2.value, _ref2$label = _ref2.label, label2 = _ref2$label === void 0 ? value2 : _ref2$label;\n", " return label.localeCompare(label2, [], {\n", " sensitivity: 'base',\n", " ignorePunctuation: true,\n", " numeric: true\n", " });\n", " };\n", " /**\n", " * @param {{ score: number }} a\n", " * @param {{ score: number }} b\n", " */\n", " var sortByScore = function sortByScore(a, b) {\n", " return a.score - b.score;\n", " };\n", " /**\n", " * @param {HTMLElement} element\n", " * @param {string} type\n", " * @param {object} customArgs\n", " */\n", " var dispatchEvent = function dispatchEvent(element, type, customArgs) {\n", " if (customArgs === void 0) {\n", " customArgs = null;\n", " }\n", " var event = new CustomEvent(type, {\n", " detail: customArgs,\n", " bubbles: true,\n", " cancelable: true\n", " });\n", " return element.dispatchEvent(event);\n", " };\n", " /**\n", " * @param {array} array\n", " * @param {any} value\n", " * @param {string} [key=\"value\"]\n", " * @returns {boolean}\n", " */\n", " var existsInArray = function existsInArray(array, value, key) {\n", " if (key === void 0) {\n", " key = 'value';\n", " }\n", " return array.some(function (item) {\n", " if (typeof value === 'string') {\n", " return item[key] === value.trim();\n", " }\n", " return item[key] === value;\n", " });\n", " };\n", " /**\n", " * @param {any} obj\n", " * @returns {any}\n", " */\n", " var cloneObject = function cloneObject(obj) {\n", " return JSON.parse(JSON.stringify(obj));\n", " };\n", " /**\n", " * Returns an array of keys present on the first but missing on the second object\n", " * @param {object} a\n", " * @param {object} b\n", " * @returns {string[]}\n", " */\n", " var diff = function diff(a, b) {\n", " var aKeys = Object.keys(a).sort();\n", " var bKeys = Object.keys(b).sort();\n", " return aKeys.filter(function (i) {\n", " return bKeys.indexOf(i) < 0;\n", " });\n", " };\n", " // CONCATENATED MODULE: ./src/scripts/reducers/index.js\n", " var appReducer = combineReducers({\n", " items: items_items,\n", " groups: groups,\n", " choices: choices_choices,\n", " general: reducers_general\n", " });\n", " var reducers_rootReducer = function rootReducer(passedState, action) {\n", " var state = passedState; // If we are clearing all items, groups and options we reassign\n", " // state and then pass that state to our proper reducer. This isn't\n", " // mutating our actual state\n", " // See: http://stackoverflow.com/a/35641992\n", " if (action.type === 'CLEAR_ALL') {\n", " state = undefined;\n", " }\n", " else if (action.type === 'RESET_TO') {\n", " return cloneObject(action.state);\n", " }\n", " return appReducer(state, action);\n", " };\n", " /* harmony default export */ var reducers = (reducers_rootReducer);\n", " // CONCATENATED MODULE: ./src/scripts/store/store.js\n", " function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) {\n", " var descriptor = props[i];\n", " descriptor.enumerable = descriptor.enumerable || false;\n", " descriptor.configurable = true;\n", " if (\"value\" in descriptor)\n", " descriptor.writable = true;\n", " Object.defineProperty(target, descriptor.key, descriptor);\n", " } }\n", " function _createClass(Constructor, protoProps, staticProps) { if (protoProps)\n", " _defineProperties(Constructor.prototype, protoProps); if (staticProps)\n", " _defineProperties(Constructor, staticProps); return Constructor; }\n", " /**\n", " * @typedef {import('../../../types/index').Choices.Choice} Choice\n", " * @typedef {import('../../../types/index').Choices.Group} Group\n", " * @typedef {import('../../../types/index').Choices.Item} Item\n", " */\n", " var store_Store = \n", " /*#__PURE__*/\n", " function () {\n", " function Store() {\n", " this._store = createStore(reducers, window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__());\n", " }\n", " /**\n", " * Subscribe store to function call (wrapped Redux method)\n", " * @param {Function} onChange Function to trigger when state changes\n", " * @return\n", " */\n", " var _proto = Store.prototype;\n", " _proto.subscribe = function subscribe(onChange) {\n", " this._store.subscribe(onChange);\n", " };\n", " _proto.dispatch = function dispatch(action) {\n", " this._store.dispatch(action);\n", " };\n", " /**\n", " * Get loading state from store\n", " * @returns {boolean} Loading State\n", " */\n", " _proto.isLoading = function isLoading() {\n", " return this.state.general.loading;\n", " };\n", " _proto.getChoiceById = function getChoiceById(id) {\n", " return this.activeChoices.find(function (choice) {\n", " return choice.id === parseInt(id, 10);\n", " });\n", " };\n", " _proto.getGroupById = function getGroupById(id) {\n", " return this.groups.find(function (group) {\n", " return group.id === id;\n", " });\n", " };\n", " _createClass(Store, [{\n", " key: \"state\",\n", " get: function get() {\n", " return this._store.getState();\n", " }\n", " /**\n", " * Get items from store\n", " * @returns {Item[]} Item objects\n", " */\n", " }, {\n", " key: \"items\",\n", " get: function get() {\n", " return this.state.items;\n", " }\n", " /**\n", " * Get active items from store\n", " * @returns {Item[]} Item objects\n", " */\n", " }, {\n", " key: \"activeItems\",\n", " get: function get() {\n", " return this.items.filter(function (item) {\n", " return item.active === true;\n", " });\n", " }\n", " /**\n", " * Get highlighted items from store\n", " * @returns {Item[]} Item objects\n", " */\n", " }, {\n", " key: \"highlightedActiveItems\",\n", " get: function get() {\n", " return this.items.filter(function (item) {\n", " return item.active && item.highlighted;\n", " });\n", " }\n", " /**\n", " * Get choices from store\n", " * @returns {Choice[]} Option objects\n", " */\n", " }, {\n", " key: \"choices\",\n", " get: function get() {\n", " return this.state.choices;\n", " }\n", " /**\n", " * Get active choices from store\n", " * @returns {Choice[]} Option objects\n", " */\n", " }, {\n", " key: \"activeChoices\",\n", " get: function get() {\n", " return this.choices.filter(function (choice) {\n", " return choice.active === true;\n", " });\n", " }\n", " /**\n", " * Get selectable choices from store\n", " * @returns {Choice[]} Option objects\n", " */\n", " }, {\n", " key: \"selectableChoices\",\n", " get: function get() {\n", " return this.choices.filter(function (choice) {\n", " return choice.disabled !== true;\n", " });\n", " }\n", " /**\n", " * Get choices that can be searched (excluding placeholders)\n", " * @returns {Choice[]} Option objects\n", " */\n", " }, {\n", " key: \"searchableChoices\",\n", " get: function get() {\n", " return this.selectableChoices.filter(function (choice) {\n", " return choice.placeholder !== true;\n", " });\n", " }\n", " /**\n", " * Get placeholder choice from store\n", " * @returns {Choice | undefined} Found placeholder\n", " */\n", " }, {\n", " key: \"placeholderChoice\",\n", " get: function get() {\n", " return [].concat(this.choices).reverse().find(function (choice) {\n", " return choice.placeholder === true;\n", " });\n", " }\n", " /**\n", " * Get groups from store\n", " * @returns {Group[]} Group objects\n", " */\n", " }, {\n", " key: \"groups\",\n", " get: function get() {\n", " return this.state.groups;\n", " }\n", " /**\n", " * Get active groups from store\n", " * @returns {Group[]} Group objects\n", " */\n", " }, {\n", " key: \"activeGroups\",\n", " get: function get() {\n", " var groups = this.groups, choices = this.choices;\n", " return groups.filter(function (group) {\n", " var isActive = group.active === true && group.disabled === false;\n", " var hasActiveOptions = choices.some(function (choice) {\n", " return choice.active === true && choice.disabled === false;\n", " });\n", " return isActive && hasActiveOptions;\n", " }, []);\n", " }\n", " }]);\n", " return Store;\n", " }();\n", " // CONCATENATED MODULE: ./src/scripts/components/dropdown.js\n", " function dropdown_defineProperties(target, props) { for (var i = 0; i < props.length; i++) {\n", " var descriptor = props[i];\n", " descriptor.enumerable = descriptor.enumerable || false;\n", " descriptor.configurable = true;\n", " if (\"value\" in descriptor)\n", " descriptor.writable = true;\n", " Object.defineProperty(target, descriptor.key, descriptor);\n", " } }\n", " function dropdown_createClass(Constructor, protoProps, staticProps) { if (protoProps)\n", " dropdown_defineProperties(Constructor.prototype, protoProps); if (staticProps)\n", " dropdown_defineProperties(Constructor, staticProps); return Constructor; }\n", " /**\n", " * @typedef {import('../../../types/index').Choices.passedElement} passedElement\n", " * @typedef {import('../../../types/index').Choices.ClassNames} ClassNames\n", " */\n", " var Dropdown = \n", " /*#__PURE__*/\n", " function () {\n", " /**\n", " * @param {{\n", " * element: HTMLElement,\n", " * type: passedElement['type'],\n", " * classNames: ClassNames,\n", " * }} args\n", " */\n", " function Dropdown(_ref) {\n", " var element = _ref.element, type = _ref.type, classNames = _ref.classNames;\n", " this.element = element;\n", " this.classNames = classNames;\n", " this.type = type;\n", " this.isActive = false;\n", " }\n", " /**\n", " * Bottom position of dropdown in viewport coordinates\n", " * @returns {number} Vertical position\n", " */\n", " var _proto = Dropdown.prototype;\n", " /**\n", " * Find element that matches passed selector\n", " * @param {string} selector\n", " * @returns {HTMLElement | null}\n", " */\n", " _proto.getChild = function getChild(selector) {\n", " return this.element.querySelector(selector);\n", " };\n", " _proto.show = function show() {\n", " this.element.classList.add(this.classNames.activeState);\n", " this.element.setAttribute('aria-expanded', 'true');\n", " this.isActive = true;\n", " return this;\n", " };\n", " _proto.hide = function hide() {\n", " this.element.classList.remove(this.classNames.activeState);\n", " this.element.setAttribute('aria-expanded', 'false');\n", " this.isActive = false;\n", " return this;\n", " };\n", " dropdown_createClass(Dropdown, [{\n", " key: \"distanceFromTopWindow\",\n", " get: function get() {\n", " return this.element.getBoundingClientRect().bottom;\n", " }\n", " }]);\n", " return Dropdown;\n", " }();\n", " // CONCATENATED MODULE: ./src/scripts/constants.js\n", " /**\n", " * @typedef {import('../../types/index').Choices.ClassNames} ClassNames\n", " * @typedef {import('../../types/index').Choices.Options} Options\n", " */\n", " /** @type {ClassNames} */\n", " var DEFAULT_CLASSNAMES = {\n", " containerOuter: 'choices',\n", " containerInner: 'choices__inner',\n", " input: 'choices__input',\n", " inputCloned: 'choices__input--cloned',\n", " list: 'choices__list',\n", " listItems: 'choices__list--multiple',\n", " listSingle: 'choices__list--single',\n", " listDropdown: 'choices__list--dropdown',\n", " item: 'choices__item',\n", " itemSelectable: 'choices__item--selectable',\n", " itemDisabled: 'choices__item--disabled',\n", " itemChoice: 'choices__item--choice',\n", " placeholder: 'choices__placeholder',\n", " group: 'choices__group',\n", " groupHeading: 'choices__heading',\n", " button: 'choices__button',\n", " activeState: 'is-active',\n", " focusState: 'is-focused',\n", " openState: 'is-open',\n", " disabledState: 'is-disabled',\n", " highlightedState: 'is-highlighted',\n", " selectedState: 'is-selected',\n", " flippedState: 'is-flipped',\n", " loadingState: 'is-loading',\n", " noResults: 'has-no-results',\n", " noChoices: 'has-no-choices'\n", " };\n", " /** @type {Options} */\n", " var DEFAULT_CONFIG = {\n", " items: [],\n", " choices: [],\n", " silent: false,\n", " renderChoiceLimit: -1,\n", " maxItemCount: -1,\n", " addItems: true,\n", " addItemFilter: null,\n", " removeItems: true,\n", " removeItemButton: false,\n", " editItems: false,\n", " duplicateItemsAllowed: true,\n", " delimiter: ',',\n", " paste: true,\n", " searchEnabled: true,\n", " searchChoices: true,\n", " searchFloor: 1,\n", " searchResultLimit: 4,\n", " searchFields: ['label', 'value'],\n", " position: 'auto',\n", " resetScrollPosition: true,\n", " shouldSort: true,\n", " shouldSortItems: false,\n", " sorter: sortByAlpha,\n", " placeholder: true,\n", " placeholderValue: null,\n", " searchPlaceholderValue: null,\n", " prependValue: null,\n", " appendValue: null,\n", " renderSelectedChoices: 'auto',\n", " loadingText: 'Loading...',\n", " noResultsText: 'No results found',\n", " noChoicesText: 'No choices to choose from',\n", " itemSelectText: 'Press to select',\n", " uniqueItemText: 'Only unique values can be added',\n", " customAddItemText: 'Only values matching specific conditions can be added',\n", " addItemText: function addItemText(value) {\n", " return \"Press Enter to add \\\"\" + sanitise(value) + \"\\\"\";\n", " },\n", " maxItemText: function maxItemText(maxItemCount) {\n", " return \"Only \" + maxItemCount + \" values can be added\";\n", " },\n", " valueComparer: function valueComparer(value1, value2) {\n", " return value1 === value2;\n", " },\n", " fuseOptions: {\n", " includeScore: true\n", " },\n", " callbackOnInit: null,\n", " callbackOnCreateTemplates: null,\n", " classNames: DEFAULT_CLASSNAMES\n", " };\n", " var EVENTS = {\n", " showDropdown: 'showDropdown',\n", " hideDropdown: 'hideDropdown',\n", " change: 'change',\n", " choice: 'choice',\n", " search: 'search',\n", " addItem: 'addItem',\n", " removeItem: 'removeItem',\n", " highlightItem: 'highlightItem',\n", " highlightChoice: 'highlightChoice'\n", " };\n", " var ACTION_TYPES = {\n", " ADD_CHOICE: 'ADD_CHOICE',\n", " FILTER_CHOICES: 'FILTER_CHOICES',\n", " ACTIVATE_CHOICES: 'ACTIVATE_CHOICES',\n", " CLEAR_CHOICES: 'CLEAR_CHOICES',\n", " ADD_GROUP: 'ADD_GROUP',\n", " ADD_ITEM: 'ADD_ITEM',\n", " REMOVE_ITEM: 'REMOVE_ITEM',\n", " HIGHLIGHT_ITEM: 'HIGHLIGHT_ITEM',\n", " CLEAR_ALL: 'CLEAR_ALL'\n", " };\n", " var KEY_CODES = {\n", " BACK_KEY: 46,\n", " DELETE_KEY: 8,\n", " ENTER_KEY: 13,\n", " A_KEY: 65,\n", " ESC_KEY: 27,\n", " UP_KEY: 38,\n", " DOWN_KEY: 40,\n", " PAGE_UP_KEY: 33,\n", " PAGE_DOWN_KEY: 34\n", " };\n", " var TEXT_TYPE = 'text';\n", " var SELECT_ONE_TYPE = 'select-one';\n", " var SELECT_MULTIPLE_TYPE = 'select-multiple';\n", " var SCROLLING_SPEED = 4;\n", " // CONCATENATED MODULE: ./src/scripts/components/container.js\n", " /**\n", " * @typedef {import('../../../types/index').Choices.passedElement} passedElement\n", " * @typedef {import('../../../types/index').Choices.ClassNames} ClassNames\n", " */\n", " var container_Container = \n", " /*#__PURE__*/\n", " function () {\n", " /**\n", " * @param {{\n", " * element: HTMLElement,\n", " * type: passedElement['type'],\n", " * classNames: ClassNames,\n", " * position\n", " * }} args\n", " */\n", " function Container(_ref) {\n", " var element = _ref.element, type = _ref.type, classNames = _ref.classNames, position = _ref.position;\n", " this.element = element;\n", " this.classNames = classNames;\n", " this.type = type;\n", " this.position = position;\n", " this.isOpen = false;\n", " this.isFlipped = false;\n", " this.isFocussed = false;\n", " this.isDisabled = false;\n", " this.isLoading = false;\n", " this._onFocus = this._onFocus.bind(this);\n", " this._onBlur = this._onBlur.bind(this);\n", " }\n", " var _proto = Container.prototype;\n", " _proto.addEventListeners = function addEventListeners() {\n", " this.element.addEventListener('focus', this._onFocus);\n", " this.element.addEventListener('blur', this._onBlur);\n", " };\n", " _proto.removeEventListeners = function removeEventListeners() {\n", " this.element.removeEventListener('focus', this._onFocus);\n", " this.element.removeEventListener('blur', this._onBlur);\n", " };\n", " _proto.shouldFlip = function shouldFlip(dropdownPos) {\n", " if (typeof dropdownPos !== 'number') {\n", " return false;\n", " } // If flip is enabled and the dropdown bottom position is\n", " // greater than the window height flip the dropdown.\n", " var shouldFlip = false;\n", " if (this.position === 'auto') {\n", " shouldFlip = !window.matchMedia(\"(min-height: \" + (dropdownPos + 1) + \"px)\").matches;\n", " }\n", " else if (this.position === 'top') {\n", " shouldFlip = true;\n", " }\n", " return shouldFlip;\n", " };\n", " _proto.setActiveDescendant = function setActiveDescendant(activeDescendantID) {\n", " this.element.setAttribute('aria-activedescendant', activeDescendantID);\n", " };\n", " _proto.removeActiveDescendant = function removeActiveDescendant() {\n", " this.element.removeAttribute('aria-activedescendant');\n", " };\n", " _proto.open = function open(dropdownPos) {\n", " this.element.classList.add(this.classNames.openState);\n", " this.element.setAttribute('aria-expanded', 'true');\n", " this.isOpen = true;\n", " if (this.shouldFlip(dropdownPos)) {\n", " this.element.classList.add(this.classNames.flippedState);\n", " this.isFlipped = true;\n", " }\n", " };\n", " _proto.close = function close() {\n", " this.element.classList.remove(this.classNames.openState);\n", " this.element.setAttribute('aria-expanded', 'false');\n", " this.removeActiveDescendant();\n", " this.isOpen = false; // A dropdown flips if it does not have space within the page\n", " if (this.isFlipped) {\n", " this.element.classList.remove(this.classNames.flippedState);\n", " this.isFlipped = false;\n", " }\n", " };\n", " _proto.focus = function focus() {\n", " if (!this.isFocussed) {\n", " this.element.focus();\n", " }\n", " };\n", " _proto.addFocusState = function addFocusState() {\n", " this.element.classList.add(this.classNames.focusState);\n", " };\n", " _proto.removeFocusState = function removeFocusState() {\n", " this.element.classList.remove(this.classNames.focusState);\n", " };\n", " _proto.enable = function enable() {\n", " this.element.classList.remove(this.classNames.disabledState);\n", " this.element.removeAttribute('aria-disabled');\n", " if (this.type === SELECT_ONE_TYPE) {\n", " this.element.setAttribute('tabindex', '0');\n", " }\n", " this.isDisabled = false;\n", " };\n", " _proto.disable = function disable() {\n", " this.element.classList.add(this.classNames.disabledState);\n", " this.element.setAttribute('aria-disabled', 'true');\n", " if (this.type === SELECT_ONE_TYPE) {\n", " this.element.setAttribute('tabindex', '-1');\n", " }\n", " this.isDisabled = true;\n", " };\n", " _proto.wrap = function wrap(element) {\n", " utils_wrap(element, this.element);\n", " };\n", " _proto.unwrap = function unwrap(element) {\n", " // Move passed element outside this element\n", " this.element.parentNode.insertBefore(element, this.element); // Remove this element\n", " this.element.parentNode.removeChild(this.element);\n", " };\n", " _proto.addLoadingState = function addLoadingState() {\n", " this.element.classList.add(this.classNames.loadingState);\n", " this.element.setAttribute('aria-busy', 'true');\n", " this.isLoading = true;\n", " };\n", " _proto.removeLoadingState = function removeLoadingState() {\n", " this.element.classList.remove(this.classNames.loadingState);\n", " this.element.removeAttribute('aria-busy');\n", " this.isLoading = false;\n", " };\n", " _proto._onFocus = function _onFocus() {\n", " this.isFocussed = true;\n", " };\n", " _proto._onBlur = function _onBlur() {\n", " this.isFocussed = false;\n", " };\n", " return Container;\n", " }();\n", " // CONCATENATED MODULE: ./src/scripts/components/input.js\n", " function input_defineProperties(target, props) { for (var i = 0; i < props.length; i++) {\n", " var descriptor = props[i];\n", " descriptor.enumerable = descriptor.enumerable || false;\n", " descriptor.configurable = true;\n", " if (\"value\" in descriptor)\n", " descriptor.writable = true;\n", " Object.defineProperty(target, descriptor.key, descriptor);\n", " } }\n", " function input_createClass(Constructor, protoProps, staticProps) { if (protoProps)\n", " input_defineProperties(Constructor.prototype, protoProps); if (staticProps)\n", " input_defineProperties(Constructor, staticProps); return Constructor; }\n", " /**\n", " * @typedef {import('../../../types/index').Choices.passedElement} passedElement\n", " * @typedef {import('../../../types/index').Choices.ClassNames} ClassNames\n", " */\n", " var input_Input = \n", " /*#__PURE__*/\n", " function () {\n", " /**\n", " * @param {{\n", " * element: HTMLInputElement,\n", " * type: passedElement['type'],\n", " * classNames: ClassNames,\n", " * preventPaste: boolean\n", " * }} args\n", " */\n", " function Input(_ref) {\n", " var element = _ref.element, type = _ref.type, classNames = _ref.classNames, preventPaste = _ref.preventPaste;\n", " this.element = element;\n", " this.type = type;\n", " this.classNames = classNames;\n", " this.preventPaste = preventPaste;\n", " this.isFocussed = this.element === document.activeElement;\n", " this.isDisabled = element.disabled;\n", " this._onPaste = this._onPaste.bind(this);\n", " this._onInput = this._onInput.bind(this);\n", " this._onFocus = this._onFocus.bind(this);\n", " this._onBlur = this._onBlur.bind(this);\n", " }\n", " /**\n", " * @param {string} placeholder\n", " */\n", " var _proto = Input.prototype;\n", " _proto.addEventListeners = function addEventListeners() {\n", " this.element.addEventListener('paste', this._onPaste);\n", " this.element.addEventListener('input', this._onInput, {\n", " passive: true\n", " });\n", " this.element.addEventListener('focus', this._onFocus, {\n", " passive: true\n", " });\n", " this.element.addEventListener('blur', this._onBlur, {\n", " passive: true\n", " });\n", " };\n", " _proto.removeEventListeners = function removeEventListeners() {\n", " this.element.removeEventListener('input', this._onInput, {\n", " passive: true\n", " });\n", " this.element.removeEventListener('paste', this._onPaste);\n", " this.element.removeEventListener('focus', this._onFocus, {\n", " passive: true\n", " });\n", " this.element.removeEventListener('blur', this._onBlur, {\n", " passive: true\n", " });\n", " };\n", " _proto.enable = function enable() {\n", " this.element.removeAttribute('disabled');\n", " this.isDisabled = false;\n", " };\n", " _proto.disable = function disable() {\n", " this.element.setAttribute('disabled', '');\n", " this.isDisabled = true;\n", " };\n", " _proto.focus = function focus() {\n", " if (!this.isFocussed) {\n", " this.element.focus();\n", " }\n", " };\n", " _proto.blur = function blur() {\n", " if (this.isFocussed) {\n", " this.element.blur();\n", " }\n", " };\n", " _proto.clear = function clear(setWidth) {\n", " if (setWidth === void 0) {\n", " setWidth = true;\n", " }\n", " if (this.element.value) {\n", " this.element.value = '';\n", " }\n", " if (setWidth) {\n", " this.setWidth();\n", " }\n", " return this;\n", " };\n", " _proto.setWidth = function setWidth() {\n", " // Resize input to contents or placeholder\n", " var _this$element = this.element, style = _this$element.style, value = _this$element.value, placeholder = _this$element.placeholder;\n", " style.minWidth = placeholder.length + 1 + \"ch\";\n", " style.width = value.length + 1 + \"ch\";\n", " };\n", " _proto.setActiveDescendant = function setActiveDescendant(activeDescendantID) {\n", " this.element.setAttribute('aria-activedescendant', activeDescendantID);\n", " };\n", " _proto.removeActiveDescendant = function removeActiveDescendant() {\n", " this.element.removeAttribute('aria-activedescendant');\n", " };\n", " _proto._onInput = function _onInput() {\n", " if (this.type !== SELECT_ONE_TYPE) {\n", " this.setWidth();\n", " }\n", " };\n", " _proto._onPaste = function _onPaste(event) {\n", " if (this.preventPaste) {\n", " event.preventDefault();\n", " }\n", " };\n", " _proto._onFocus = function _onFocus() {\n", " this.isFocussed = true;\n", " };\n", " _proto._onBlur = function _onBlur() {\n", " this.isFocussed = false;\n", " };\n", " input_createClass(Input, [{\n", " key: \"placeholder\",\n", " set: function set(placeholder) {\n", " this.element.placeholder = placeholder;\n", " }\n", " /**\n", " * @returns {string}\n", " */\n", " }, {\n", " key: \"value\",\n", " get: function get() {\n", " return sanitise(this.element.value);\n", " }\n", " /**\n", " * @param {string} value\n", " */\n", " ,\n", " set: function set(value) {\n", " this.element.value = value;\n", " }\n", " }]);\n", " return Input;\n", " }();\n", " // CONCATENATED MODULE: ./src/scripts/components/list.js\n", " /**\n", " * @typedef {import('../../../types/index').Choices.Choice} Choice\n", " */\n", " var list_List = \n", " /*#__PURE__*/\n", " function () {\n", " /**\n", " * @param {{ element: HTMLElement }} args\n", " */\n", " function List(_ref) {\n", " var element = _ref.element;\n", " this.element = element;\n", " this.scrollPos = this.element.scrollTop;\n", " this.height = this.element.offsetHeight;\n", " }\n", " var _proto = List.prototype;\n", " _proto.clear = function clear() {\n", " this.element.innerHTML = '';\n", " };\n", " _proto.append = function append(node) {\n", " this.element.appendChild(node);\n", " };\n", " _proto.getChild = function getChild(selector) {\n", " return this.element.querySelector(selector);\n", " };\n", " _proto.hasChildren = function hasChildren() {\n", " return this.element.hasChildNodes();\n", " };\n", " _proto.scrollToTop = function scrollToTop() {\n", " this.element.scrollTop = 0;\n", " };\n", " _proto.scrollToChildElement = function scrollToChildElement(element, direction) {\n", " var _this = this;\n", " if (!element) {\n", " return;\n", " }\n", " var listHeight = this.element.offsetHeight; // Scroll position of dropdown\n", " var listScrollPosition = this.element.scrollTop + listHeight;\n", " var elementHeight = element.offsetHeight; // Distance from bottom of element to top of parent\n", " var elementPos = element.offsetTop + elementHeight; // Difference between the element and scroll position\n", " var destination = direction > 0 ? this.element.scrollTop + elementPos - listScrollPosition : element.offsetTop;\n", " requestAnimationFrame(function () {\n", " _this._animateScroll(destination, direction);\n", " });\n", " };\n", " _proto._scrollDown = function _scrollDown(scrollPos, strength, destination) {\n", " var easing = (destination - scrollPos) / strength;\n", " var distance = easing > 1 ? easing : 1;\n", " this.element.scrollTop = scrollPos + distance;\n", " };\n", " _proto._scrollUp = function _scrollUp(scrollPos, strength, destination) {\n", " var easing = (scrollPos - destination) / strength;\n", " var distance = easing > 1 ? easing : 1;\n", " this.element.scrollTop = scrollPos - distance;\n", " };\n", " _proto._animateScroll = function _animateScroll(destination, direction) {\n", " var _this2 = this;\n", " var strength = SCROLLING_SPEED;\n", " var choiceListScrollTop = this.element.scrollTop;\n", " var continueAnimation = false;\n", " if (direction > 0) {\n", " this._scrollDown(choiceListScrollTop, strength, destination);\n", " if (choiceListScrollTop < destination) {\n", " continueAnimation = true;\n", " }\n", " }\n", " else {\n", " this._scrollUp(choiceListScrollTop, strength, destination);\n", " if (choiceListScrollTop > destination) {\n", " continueAnimation = true;\n", " }\n", " }\n", " if (continueAnimation) {\n", " requestAnimationFrame(function () {\n", " _this2._animateScroll(destination, direction);\n", " });\n", " }\n", " };\n", " return List;\n", " }();\n", " // CONCATENATED MODULE: ./src/scripts/components/wrapped-element.js\n", " function wrapped_element_defineProperties(target, props) { for (var i = 0; i < props.length; i++) {\n", " var descriptor = props[i];\n", " descriptor.enumerable = descriptor.enumerable || false;\n", " descriptor.configurable = true;\n", " if (\"value\" in descriptor)\n", " descriptor.writable = true;\n", " Object.defineProperty(target, descriptor.key, descriptor);\n", " } }\n", " function wrapped_element_createClass(Constructor, protoProps, staticProps) { if (protoProps)\n", " wrapped_element_defineProperties(Constructor.prototype, protoProps); if (staticProps)\n", " wrapped_element_defineProperties(Constructor, staticProps); return Constructor; }\n", " /**\n", " * @typedef {import('../../../types/index').Choices.passedElement} passedElement\n", " * @typedef {import('../../../types/index').Choices.ClassNames} ClassNames\n", " */\n", " var wrapped_element_WrappedElement = \n", " /*#__PURE__*/\n", " function () {\n", " /**\n", " * @param {{\n", " * element: HTMLInputElement | HTMLSelectElement,\n", " * classNames: ClassNames,\n", " * }} args\n", " */\n", " function WrappedElement(_ref) {\n", " var element = _ref.element, classNames = _ref.classNames;\n", " this.element = element;\n", " this.classNames = classNames;\n", " if (!(element instanceof HTMLInputElement) && !(element instanceof HTMLSelectElement)) {\n", " throw new TypeError('Invalid element passed');\n", " }\n", " this.isDisabled = false;\n", " }\n", " var _proto = WrappedElement.prototype;\n", " _proto.conceal = function conceal() {\n", " // Hide passed input\n", " this.element.classList.add(this.classNames.input);\n", " this.element.hidden = true; // Remove element from tab index\n", " this.element.tabIndex = -1; // Backup original styles if any\n", " var origStyle = this.element.getAttribute('style');\n", " if (origStyle) {\n", " this.element.setAttribute('data-choice-orig-style', origStyle);\n", " }\n", " this.element.setAttribute('data-choice', 'active');\n", " };\n", " _proto.reveal = function reveal() {\n", " // Reinstate passed element\n", " this.element.classList.remove(this.classNames.input);\n", " this.element.hidden = false;\n", " this.element.removeAttribute('tabindex'); // Recover original styles if any\n", " var origStyle = this.element.getAttribute('data-choice-orig-style');\n", " if (origStyle) {\n", " this.element.removeAttribute('data-choice-orig-style');\n", " this.element.setAttribute('style', origStyle);\n", " }\n", " else {\n", " this.element.removeAttribute('style');\n", " }\n", " this.element.removeAttribute('data-choice'); // Re-assign values - this is weird, I know\n", " // @todo Figure out why we need to do this\n", " this.element.value = this.element.value; // eslint-disable-line no-self-assign\n", " };\n", " _proto.enable = function enable() {\n", " this.element.removeAttribute('disabled');\n", " this.element.disabled = false;\n", " this.isDisabled = false;\n", " };\n", " _proto.disable = function disable() {\n", " this.element.setAttribute('disabled', '');\n", " this.element.disabled = true;\n", " this.isDisabled = true;\n", " };\n", " _proto.triggerEvent = function triggerEvent(eventType, data) {\n", " dispatchEvent(this.element, eventType, data);\n", " };\n", " wrapped_element_createClass(WrappedElement, [{\n", " key: \"isActive\",\n", " get: function get() {\n", " return this.element.dataset.choice === 'active';\n", " }\n", " }, {\n", " key: \"dir\",\n", " get: function get() {\n", " return this.element.dir;\n", " }\n", " }, {\n", " key: \"value\",\n", " get: function get() {\n", " return this.element.value;\n", " },\n", " set: function set(value) {\n", " // you must define setter here otherwise it will be readonly property\n", " this.element.value = value;\n", " }\n", " }]);\n", " return WrappedElement;\n", " }();\n", " // CONCATENATED MODULE: ./src/scripts/components/wrapped-input.js\n", " function wrapped_input_defineProperties(target, props) { for (var i = 0; i < props.length; i++) {\n", " var descriptor = props[i];\n", " descriptor.enumerable = descriptor.enumerable || false;\n", " descriptor.configurable = true;\n", " if (\"value\" in descriptor)\n", " descriptor.writable = true;\n", " Object.defineProperty(target, descriptor.key, descriptor);\n", " } }\n", " function wrapped_input_createClass(Constructor, protoProps, staticProps) { if (protoProps)\n", " wrapped_input_defineProperties(Constructor.prototype, protoProps); if (staticProps)\n", " wrapped_input_defineProperties(Constructor, staticProps); return Constructor; }\n", " function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n", " /**\n", " * @typedef {import('../../../types/index').Choices.ClassNames} ClassNames\n", " * @typedef {import('../../../types/index').Choices.Item} Item\n", " */\n", " var WrappedInput = \n", " /*#__PURE__*/\n", " function (_WrappedElement) {\n", " _inheritsLoose(WrappedInput, _WrappedElement);\n", " /**\n", " * @param {{\n", " * element: HTMLInputElement,\n", " * classNames: ClassNames,\n", " * delimiter: string\n", " * }} args\n", " */\n", " function WrappedInput(_ref) {\n", " var _this;\n", " var element = _ref.element, classNames = _ref.classNames, delimiter = _ref.delimiter;\n", " _this = _WrappedElement.call(this, {\n", " element: element,\n", " classNames: classNames\n", " }) || this;\n", " _this.delimiter = delimiter;\n", " return _this;\n", " }\n", " /**\n", " * @returns {string}\n", " */\n", " wrapped_input_createClass(WrappedInput, [{\n", " key: \"value\",\n", " get: function get() {\n", " return this.element.value;\n", " }\n", " /**\n", " * @param {Item[]} items\n", " */\n", " ,\n", " set: function set(items) {\n", " var itemValues = items.map(function (_ref2) {\n", " var value = _ref2.value;\n", " return value;\n", " });\n", " var joinedValues = itemValues.join(this.delimiter);\n", " this.element.setAttribute('value', joinedValues);\n", " this.element.value = joinedValues;\n", " }\n", " }]);\n", " return WrappedInput;\n", " }(wrapped_element_WrappedElement);\n", " // CONCATENATED MODULE: ./src/scripts/components/wrapped-select.js\n", " function wrapped_select_defineProperties(target, props) { for (var i = 0; i < props.length; i++) {\n", " var descriptor = props[i];\n", " descriptor.enumerable = descriptor.enumerable || false;\n", " descriptor.configurable = true;\n", " if (\"value\" in descriptor)\n", " descriptor.writable = true;\n", " Object.defineProperty(target, descriptor.key, descriptor);\n", " } }\n", " function wrapped_select_createClass(Constructor, protoProps, staticProps) { if (protoProps)\n", " wrapped_select_defineProperties(Constructor.prototype, protoProps); if (staticProps)\n", " wrapped_select_defineProperties(Constructor, staticProps); return Constructor; }\n", " function wrapped_select_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n", " /**\n", " * @typedef {import('../../../types/index').Choices.ClassNames} ClassNames\n", " * @typedef {import('../../../types/index').Choices.Item} Item\n", " * @typedef {import('../../../types/index').Choices.Choice} Choice\n", " */\n", " var WrappedSelect = \n", " /*#__PURE__*/\n", " function (_WrappedElement) {\n", " wrapped_select_inheritsLoose(WrappedSelect, _WrappedElement);\n", " /**\n", " * @param {{\n", " * element: HTMLSelectElement,\n", " * classNames: ClassNames,\n", " * delimiter: string\n", " * template: function\n", " * }} args\n", " */\n", " function WrappedSelect(_ref) {\n", " var _this;\n", " var element = _ref.element, classNames = _ref.classNames, template = _ref.template;\n", " _this = _WrappedElement.call(this, {\n", " element: element,\n", " classNames: classNames\n", " }) || this;\n", " _this.template = template;\n", " return _this;\n", " }\n", " var _proto = WrappedSelect.prototype;\n", " /**\n", " * @param {DocumentFragment} fragment\n", " */\n", " _proto.appendDocFragment = function appendDocFragment(fragment) {\n", " this.element.innerHTML = '';\n", " this.element.appendChild(fragment);\n", " };\n", " wrapped_select_createClass(WrappedSelect, [{\n", " key: \"placeholderOption\",\n", " get: function get() {\n", " return this.element.querySelector('option[value=\"\"]') || // Backward compatibility layer for the non-standard placeholder attribute supported in older versions.\n", " this.element.querySelector('option[placeholder]');\n", " }\n", " /**\n", " * @returns {Element[]}\n", " */\n", " }, {\n", " key: \"optionGroups\",\n", " get: function get() {\n", " return Array.from(this.element.getElementsByTagName('OPTGROUP'));\n", " }\n", " /**\n", " * @returns {Item[] | Choice[]}\n", " */\n", " }, {\n", " key: \"options\",\n", " get: function get() {\n", " return Array.from(this.element.options);\n", " }\n", " /**\n", " * @param {Item[] | Choice[]} options\n", " */\n", " ,\n", " set: function set(options) {\n", " var _this2 = this;\n", " var fragment = document.createDocumentFragment();\n", " var addOptionToFragment = function addOptionToFragment(data) {\n", " // Create a standard select option\n", " var option = _this2.template(data); // Append it to fragment\n", " fragment.appendChild(option);\n", " }; // Add each list item to list\n", " options.forEach(function (optionData) {\n", " return addOptionToFragment(optionData);\n", " });\n", " this.appendDocFragment(fragment);\n", " }\n", " }]);\n", " return WrappedSelect;\n", " }(wrapped_element_WrappedElement);\n", " // CONCATENATED MODULE: ./src/scripts/components/index.js\n", " // CONCATENATED MODULE: ./src/scripts/templates.js\n", " /**\n", " * Helpers to create HTML elements used by Choices\n", " * Can be overridden by providing `callbackOnCreateTemplates` option\n", " * @typedef {import('../../types/index').Choices.Templates} Templates\n", " * @typedef {import('../../types/index').Choices.ClassNames} ClassNames\n", " * @typedef {import('../../types/index').Choices.Options} Options\n", " * @typedef {import('../../types/index').Choices.Item} Item\n", " * @typedef {import('../../types/index').Choices.Choice} Choice\n", " * @typedef {import('../../types/index').Choices.Group} Group\n", " */\n", " var TEMPLATES = \n", " /** @type {Templates} */\n", " {\n", " /**\n", " * @param {Partial} classNames\n", " * @param {\"ltr\" | \"rtl\" | \"auto\"} dir\n", " * @param {boolean} isSelectElement\n", " * @param {boolean} isSelectOneElement\n", " * @param {boolean} searchEnabled\n", " * @param {\"select-one\" | \"select-multiple\" | \"text\"} passedElementType\n", " */\n", " containerOuter: function containerOuter(_ref, dir, isSelectElement, isSelectOneElement, searchEnabled, passedElementType) {\n", " var _containerOuter = _ref.containerOuter;\n", " var div = Object.assign(document.createElement('div'), {\n", " className: _containerOuter\n", " });\n", " div.dataset.type = passedElementType;\n", " if (dir) {\n", " div.dir = dir;\n", " }\n", " if (isSelectOneElement) {\n", " div.tabIndex = 0;\n", " }\n", " if (isSelectElement) {\n", " div.setAttribute('role', searchEnabled ? 'combobox' : 'listbox');\n", " if (searchEnabled) {\n", " div.setAttribute('aria-autocomplete', 'list');\n", " }\n", " }\n", " div.setAttribute('aria-haspopup', 'true');\n", " div.setAttribute('aria-expanded', 'false');\n", " return div;\n", " },\n", " /**\n", " * @param {Partial} classNames\n", " */\n", " containerInner: function containerInner(_ref2) {\n", " var _containerInner = _ref2.containerInner;\n", " return Object.assign(document.createElement('div'), {\n", " className: _containerInner\n", " });\n", " },\n", " /**\n", " * @param {Partial} classNames\n", " * @param {boolean} isSelectOneElement\n", " */\n", " itemList: function itemList(_ref3, isSelectOneElement) {\n", " var list = _ref3.list, listSingle = _ref3.listSingle, listItems = _ref3.listItems;\n", " return Object.assign(document.createElement('div'), {\n", " className: list + \" \" + (isSelectOneElement ? listSingle : listItems)\n", " });\n", " },\n", " /**\n", " * @param {Partial} classNames\n", " * @param {string} value\n", " */\n", " placeholder: function placeholder(_ref4, value) {\n", " var _placeholder = _ref4.placeholder;\n", " return Object.assign(document.createElement('div'), {\n", " className: _placeholder,\n", " innerHTML: value\n", " });\n", " },\n", " /**\n", " * @param {Partial} classNames\n", " * @param {Item} item\n", " * @param {boolean} removeItemButton\n", " */\n", " item: function item(_ref5, _ref6, removeItemButton) {\n", " var _item = _ref5.item, button = _ref5.button, highlightedState = _ref5.highlightedState, itemSelectable = _ref5.itemSelectable, placeholder = _ref5.placeholder;\n", " var id = _ref6.id, value = _ref6.value, label = _ref6.label, customProperties = _ref6.customProperties, active = _ref6.active, disabled = _ref6.disabled, highlighted = _ref6.highlighted, isPlaceholder = _ref6.placeholder;\n", " var div = Object.assign(document.createElement('div'), {\n", " className: _item,\n", " innerHTML: label\n", " });\n", " Object.assign(div.dataset, {\n", " item: '',\n", " id: id,\n", " value: value,\n", " customProperties: customProperties\n", " });\n", " if (active) {\n", " div.setAttribute('aria-selected', 'true');\n", " }\n", " if (disabled) {\n", " div.setAttribute('aria-disabled', 'true');\n", " }\n", " if (isPlaceholder) {\n", " div.classList.add(placeholder);\n", " }\n", " div.classList.add(highlighted ? highlightedState : itemSelectable);\n", " if (removeItemButton) {\n", " if (disabled) {\n", " div.classList.remove(itemSelectable);\n", " }\n", " div.dataset.deletable = '';\n", " /** @todo This MUST be localizable, not hardcoded! */\n", " var REMOVE_ITEM_TEXT = 'Remove item';\n", " var removeButton = Object.assign(document.createElement('button'), {\n", " type: 'button',\n", " className: button,\n", " innerHTML: REMOVE_ITEM_TEXT\n", " });\n", " removeButton.setAttribute('aria-label', REMOVE_ITEM_TEXT + \": '\" + value + \"'\");\n", " removeButton.dataset.button = '';\n", " div.appendChild(removeButton);\n", " }\n", " return div;\n", " },\n", " /**\n", " * @param {Partial} classNames\n", " * @param {boolean} isSelectOneElement\n", " */\n", " choiceList: function choiceList(_ref7, isSelectOneElement) {\n", " var list = _ref7.list;\n", " var div = Object.assign(document.createElement('div'), {\n", " className: list\n", " });\n", " if (!isSelectOneElement) {\n", " div.setAttribute('aria-multiselectable', 'true');\n", " }\n", " div.setAttribute('role', 'listbox');\n", " return div;\n", " },\n", " /**\n", " * @param {Partial} classNames\n", " * @param {Group} group\n", " */\n", " choiceGroup: function choiceGroup(_ref8, _ref9) {\n", " var group = _ref8.group, groupHeading = _ref8.groupHeading, itemDisabled = _ref8.itemDisabled;\n", " var id = _ref9.id, value = _ref9.value, disabled = _ref9.disabled;\n", " var div = Object.assign(document.createElement('div'), {\n", " className: group + \" \" + (disabled ? itemDisabled : '')\n", " });\n", " div.setAttribute('role', 'group');\n", " Object.assign(div.dataset, {\n", " group: '',\n", " id: id,\n", " value: value\n", " });\n", " if (disabled) {\n", " div.setAttribute('aria-disabled', 'true');\n", " }\n", " div.appendChild(Object.assign(document.createElement('div'), {\n", " className: groupHeading,\n", " innerHTML: value\n", " }));\n", " return div;\n", " },\n", " /**\n", " * @param {Partial} classNames\n", " * @param {Choice} choice\n", " * @param {Options['itemSelectText']} selectText\n", " */\n", " choice: function choice(_ref10, _ref11, selectText) {\n", " var item = _ref10.item, itemChoice = _ref10.itemChoice, itemSelectable = _ref10.itemSelectable, selectedState = _ref10.selectedState, itemDisabled = _ref10.itemDisabled, placeholder = _ref10.placeholder;\n", " var id = _ref11.id, value = _ref11.value, label = _ref11.label, groupId = _ref11.groupId, elementId = _ref11.elementId, isDisabled = _ref11.disabled, isSelected = _ref11.selected, isPlaceholder = _ref11.placeholder;\n", " var div = Object.assign(document.createElement('div'), {\n", " id: elementId,\n", " innerHTML: label,\n", " className: item + \" \" + itemChoice\n", " });\n", " if (isSelected) {\n", " div.classList.add(selectedState);\n", " }\n", " if (isPlaceholder) {\n", " div.classList.add(placeholder);\n", " }\n", " div.setAttribute('role', groupId > 0 ? 'treeitem' : 'option');\n", " Object.assign(div.dataset, {\n", " choice: '',\n", " id: id,\n", " value: value,\n", " selectText: selectText\n", " });\n", " if (isDisabled) {\n", " div.classList.add(itemDisabled);\n", " div.dataset.choiceDisabled = '';\n", " div.setAttribute('aria-disabled', 'true');\n", " }\n", " else {\n", " div.classList.add(itemSelectable);\n", " div.dataset.choiceSelectable = '';\n", " }\n", " return div;\n", " },\n", " /**\n", " * @param {Partial} classNames\n", " * @param {string} placeholderValue\n", " */\n", " input: function input(_ref12, placeholderValue) {\n", " var _input = _ref12.input, inputCloned = _ref12.inputCloned;\n", " var inp = Object.assign(document.createElement('input'), {\n", " type: 'text',\n", " className: _input + \" \" + inputCloned,\n", " autocomplete: 'off',\n", " autocapitalize: 'off',\n", " spellcheck: false\n", " });\n", " inp.setAttribute('role', 'textbox');\n", " inp.setAttribute('aria-autocomplete', 'list');\n", " inp.setAttribute('aria-label', placeholderValue);\n", " return inp;\n", " },\n", " /**\n", " * @param {Partial} classNames\n", " */\n", " dropdown: function dropdown(_ref13) {\n", " var list = _ref13.list, listDropdown = _ref13.listDropdown;\n", " var div = document.createElement('div');\n", " div.classList.add(list, listDropdown);\n", " div.setAttribute('aria-expanded', 'false');\n", " return div;\n", " },\n", " /**\n", " *\n", " * @param {Partial} classNames\n", " * @param {string} innerHTML\n", " * @param {\"no-choices\" | \"no-results\" | \"\"} type\n", " */\n", " notice: function notice(_ref14, innerHTML, type) {\n", " var item = _ref14.item, itemChoice = _ref14.itemChoice, noResults = _ref14.noResults, noChoices = _ref14.noChoices;\n", " if (type === void 0) {\n", " type = '';\n", " }\n", " var classes = [item, itemChoice];\n", " if (type === 'no-choices') {\n", " classes.push(noChoices);\n", " }\n", " else if (type === 'no-results') {\n", " classes.push(noResults);\n", " }\n", " return Object.assign(document.createElement('div'), {\n", " innerHTML: innerHTML,\n", " className: classes.join(' ')\n", " });\n", " },\n", " /**\n", " * @param {Item} option\n", " */\n", " option: function option(_ref15) {\n", " var label = _ref15.label, value = _ref15.value, customProperties = _ref15.customProperties, active = _ref15.active, disabled = _ref15.disabled;\n", " var opt = new Option(label, value, false, active);\n", " if (customProperties) {\n", " opt.dataset.customProperties = customProperties;\n", " }\n", " opt.disabled = disabled;\n", " return opt;\n", " }\n", " };\n", " /* harmony default export */ var templates = (TEMPLATES);\n", " // CONCATENATED MODULE: ./src/scripts/actions/choices.js\n", " /**\n", " * @typedef {import('redux').Action} Action\n", " * @typedef {import('../../../types/index').Choices.Choice} Choice\n", " */\n", " /**\n", " * @argument {Choice} choice\n", " * @returns {Action & Choice}\n", " */\n", " var choices_addChoice = function addChoice(_ref) {\n", " var value = _ref.value, label = _ref.label, id = _ref.id, groupId = _ref.groupId, disabled = _ref.disabled, elementId = _ref.elementId, customProperties = _ref.customProperties, placeholder = _ref.placeholder, keyCode = _ref.keyCode;\n", " return {\n", " type: ACTION_TYPES.ADD_CHOICE,\n", " value: value,\n", " label: label,\n", " id: id,\n", " groupId: groupId,\n", " disabled: disabled,\n", " elementId: elementId,\n", " customProperties: customProperties,\n", " placeholder: placeholder,\n", " keyCode: keyCode\n", " };\n", " };\n", " /**\n", " * @argument {Choice[]} results\n", " * @returns {Action & { results: Choice[] }}\n", " */\n", " var choices_filterChoices = function filterChoices(results) {\n", " return {\n", " type: ACTION_TYPES.FILTER_CHOICES,\n", " results: results\n", " };\n", " };\n", " /**\n", " * @argument {boolean} active\n", " * @returns {Action & { active: boolean }}\n", " */\n", " var choices_activateChoices = function activateChoices(active) {\n", " if (active === void 0) {\n", " active = true;\n", " }\n", " return {\n", " type: ACTION_TYPES.ACTIVATE_CHOICES,\n", " active: active\n", " };\n", " };\n", " /**\n", " * @returns {Action}\n", " */\n", " var choices_clearChoices = function clearChoices() {\n", " return {\n", " type: ACTION_TYPES.CLEAR_CHOICES\n", " };\n", " };\n", " // CONCATENATED MODULE: ./src/scripts/actions/items.js\n", " /**\n", " * @typedef {import('redux').Action} Action\n", " * @typedef {import('../../../types/index').Choices.Item} Item\n", " */\n", " /**\n", " * @param {Item} item\n", " * @returns {Action & Item}\n", " */\n", " var items_addItem = function addItem(_ref) {\n", " var value = _ref.value, label = _ref.label, id = _ref.id, choiceId = _ref.choiceId, groupId = _ref.groupId, customProperties = _ref.customProperties, placeholder = _ref.placeholder, keyCode = _ref.keyCode;\n", " return {\n", " type: ACTION_TYPES.ADD_ITEM,\n", " value: value,\n", " label: label,\n", " id: id,\n", " choiceId: choiceId,\n", " groupId: groupId,\n", " customProperties: customProperties,\n", " placeholder: placeholder,\n", " keyCode: keyCode\n", " };\n", " };\n", " /**\n", " * @param {string} id\n", " * @param {string} choiceId\n", " * @returns {Action & { id: string, choiceId: string }}\n", " */\n", " var items_removeItem = function removeItem(id, choiceId) {\n", " return {\n", " type: ACTION_TYPES.REMOVE_ITEM,\n", " id: id,\n", " choiceId: choiceId\n", " };\n", " };\n", " /**\n", " * @param {string} id\n", " * @param {boolean} highlighted\n", " * @returns {Action & { id: string, highlighted: boolean }}\n", " */\n", " var items_highlightItem = function highlightItem(id, highlighted) {\n", " return {\n", " type: ACTION_TYPES.HIGHLIGHT_ITEM,\n", " id: id,\n", " highlighted: highlighted\n", " };\n", " };\n", " // CONCATENATED MODULE: ./src/scripts/actions/groups.js\n", " /**\n", " * @typedef {import('redux').Action} Action\n", " * @typedef {import('../../../types/index').Choices.Group} Group\n", " */\n", " /**\n", " * @param {Group} group\n", " * @returns {Action & Group}\n", " */\n", " var groups_addGroup = function addGroup(_ref) {\n", " var value = _ref.value, id = _ref.id, active = _ref.active, disabled = _ref.disabled;\n", " return {\n", " type: ACTION_TYPES.ADD_GROUP,\n", " value: value,\n", " id: id,\n", " active: active,\n", " disabled: disabled\n", " };\n", " };\n", " // CONCATENATED MODULE: ./src/scripts/actions/misc.js\n", " /**\n", " * @typedef {import('redux').Action} Action\n", " */\n", " /**\n", " * @returns {Action}\n", " */\n", " var clearAll = function clearAll() {\n", " return {\n", " type: 'CLEAR_ALL'\n", " };\n", " };\n", " /**\n", " * @param {any} state\n", " * @returns {Action & { state: object }}\n", " */\n", " var resetTo = function resetTo(state) {\n", " return {\n", " type: 'RESET_TO',\n", " state: state\n", " };\n", " };\n", " /**\n", " * @param {boolean} isLoading\n", " * @returns {Action & { isLoading: boolean }}\n", " */\n", " var setIsLoading = function setIsLoading(isLoading) {\n", " return {\n", " type: 'SET_IS_LOADING',\n", " isLoading: isLoading\n", " };\n", " };\n", " // CONCATENATED MODULE: ./src/scripts/choices.js\n", " function choices_defineProperties(target, props) { for (var i = 0; i < props.length; i++) {\n", " var descriptor = props[i];\n", " descriptor.enumerable = descriptor.enumerable || false;\n", " descriptor.configurable = true;\n", " if (\"value\" in descriptor)\n", " descriptor.writable = true;\n", " Object.defineProperty(target, descriptor.key, descriptor);\n", " } }\n", " function choices_createClass(Constructor, protoProps, staticProps) { if (protoProps)\n", " choices_defineProperties(Constructor.prototype, protoProps); if (staticProps)\n", " choices_defineProperties(Constructor, staticProps); return Constructor; }\n", " /** @see {@link http://browserhacks.com/#hack-acea075d0ac6954f275a70023906050c} */\n", " var IS_IE11 = '-ms-scroll-limit' in document.documentElement.style && '-ms-ime-align' in document.documentElement.style;\n", " /**\n", " * @typedef {import('../../types/index').Choices.Choice} Choice\n", " * @typedef {import('../../types/index').Choices.Item} Item\n", " * @typedef {import('../../types/index').Choices.Group} Group\n", " * @typedef {import('../../types/index').Choices.Options} Options\n", " */\n", " /** @type {Partial} */\n", " var USER_DEFAULTS = {};\n", " /**\n", " * Choices\n", " * @author Josh Johnson\n", " */\n", " var choices_Choices = \n", " /*#__PURE__*/\n", " function () {\n", " choices_createClass(Choices, null, [{\n", " key: \"defaults\",\n", " get: function get() {\n", " return Object.preventExtensions({\n", " get options() {\n", " return USER_DEFAULTS;\n", " },\n", " get templates() {\n", " return TEMPLATES;\n", " }\n", " });\n", " }\n", " /**\n", " * @param {string | HTMLInputElement | HTMLSelectElement} element\n", " * @param {Partial} userConfig\n", " */\n", " }]);\n", " function Choices(element, userConfig) {\n", " var _this = this;\n", " if (element === void 0) {\n", " element = '[data-choice]';\n", " }\n", " if (userConfig === void 0) {\n", " userConfig = {};\n", " }\n", " /** @type {Partial} */\n", " this.config = cjs_default.a.all([DEFAULT_CONFIG, Choices.defaults.options, userConfig], // When merging array configs, replace with a copy of the userConfig array,\n", " // instead of concatenating with the default array\n", " {\n", " arrayMerge: function arrayMerge(_, sourceArray) {\n", " return [].concat(sourceArray);\n", " }\n", " });\n", " var invalidConfigOptions = diff(this.config, DEFAULT_CONFIG);\n", " if (invalidConfigOptions.length) {\n", " console.warn('Unknown config option(s) passed', invalidConfigOptions.join(', '));\n", " }\n", " var passedElement = typeof element === 'string' ? document.querySelector(element) : element;\n", " if (!(passedElement instanceof HTMLInputElement || passedElement instanceof HTMLSelectElement)) {\n", " throw TypeError('Expected one of the following types text|select-one|select-multiple');\n", " }\n", " this._isTextElement = passedElement.type === TEXT_TYPE;\n", " this._isSelectOneElement = passedElement.type === SELECT_ONE_TYPE;\n", " this._isSelectMultipleElement = passedElement.type === SELECT_MULTIPLE_TYPE;\n", " this._isSelectElement = this._isSelectOneElement || this._isSelectMultipleElement;\n", " this.config.searchEnabled = this._isSelectMultipleElement || this.config.searchEnabled;\n", " if (!['auto', 'always'].includes(this.config.renderSelectedChoices)) {\n", " this.config.renderSelectedChoices = 'auto';\n", " }\n", " if (userConfig.addItemFilter && typeof userConfig.addItemFilter !== 'function') {\n", " var re = userConfig.addItemFilter instanceof RegExp ? userConfig.addItemFilter : new RegExp(userConfig.addItemFilter);\n", " this.config.addItemFilter = re.test.bind(re);\n", " }\n", " if (this._isTextElement) {\n", " this.passedElement = new WrappedInput({\n", " element: passedElement,\n", " classNames: this.config.classNames,\n", " delimiter: this.config.delimiter\n", " });\n", " }\n", " else {\n", " this.passedElement = new WrappedSelect({\n", " element: passedElement,\n", " classNames: this.config.classNames,\n", " template: function template(data) {\n", " return _this._templates.option(data);\n", " }\n", " });\n", " }\n", " this.initialised = false;\n", " this._store = new store_Store();\n", " this._initialState = {};\n", " this._currentState = {};\n", " this._prevState = {};\n", " this._currentValue = '';\n", " this._canSearch = this.config.searchEnabled;\n", " this._isScrollingOnIe = false;\n", " this._highlightPosition = 0;\n", " this._wasTap = true;\n", " this._placeholderValue = this._generatePlaceholderValue();\n", " this._baseId = generateId(this.passedElement.element, 'choices-');\n", " /**\n", " * setting direction in cases where it's explicitly set on passedElement\n", " * or when calculated direction is different from the document\n", " * @type {HTMLElement['dir']}\n", " */\n", " this._direction = this.passedElement.dir;\n", " if (!this._direction) {\n", " var _window$getComputedSt = window.getComputedStyle(this.passedElement.element), elementDirection = _window$getComputedSt.direction;\n", " var _window$getComputedSt2 = window.getComputedStyle(document.documentElement), documentDirection = _window$getComputedSt2.direction;\n", " if (elementDirection !== documentDirection) {\n", " this._direction = elementDirection;\n", " }\n", " }\n", " this._idNames = {\n", " itemChoice: 'item-choice'\n", " }; // Assign preset groups from passed element\n", " this._presetGroups = this.passedElement.optionGroups; // Assign preset options from passed element\n", " this._presetOptions = this.passedElement.options; // Assign preset choices from passed object\n", " this._presetChoices = this.config.choices; // Assign preset items from passed object first\n", " this._presetItems = this.config.items; // Add any values passed from attribute\n", " if (this.passedElement.value) {\n", " this._presetItems = this._presetItems.concat(this.passedElement.value.split(this.config.delimiter));\n", " } // Create array of choices from option elements\n", " if (this.passedElement.options) {\n", " this.passedElement.options.forEach(function (o) {\n", " _this._presetChoices.push({\n", " value: o.value,\n", " label: o.innerHTML,\n", " selected: o.selected,\n", " disabled: o.disabled || o.parentNode.disabled,\n", " placeholder: o.value === '' || o.hasAttribute('placeholder'),\n", " customProperties: o.getAttribute('data-custom-properties')\n", " });\n", " });\n", " }\n", " this._render = this._render.bind(this);\n", " this._onFocus = this._onFocus.bind(this);\n", " this._onBlur = this._onBlur.bind(this);\n", " this._onKeyUp = this._onKeyUp.bind(this);\n", " this._onKeyDown = this._onKeyDown.bind(this);\n", " this._onClick = this._onClick.bind(this);\n", " this._onTouchMove = this._onTouchMove.bind(this);\n", " this._onTouchEnd = this._onTouchEnd.bind(this);\n", " this._onMouseDown = this._onMouseDown.bind(this);\n", " this._onMouseOver = this._onMouseOver.bind(this);\n", " this._onFormReset = this._onFormReset.bind(this);\n", " this._onAKey = this._onAKey.bind(this);\n", " this._onEnterKey = this._onEnterKey.bind(this);\n", " this._onEscapeKey = this._onEscapeKey.bind(this);\n", " this._onDirectionKey = this._onDirectionKey.bind(this);\n", " this._onDeleteKey = this._onDeleteKey.bind(this); // If element has already been initialised with Choices, fail silently\n", " if (this.passedElement.isActive) {\n", " if (!this.config.silent) {\n", " console.warn('Trying to initialise Choices on element already initialised');\n", " }\n", " this.initialised = true;\n", " return;\n", " } // Let's go\n", " this.init();\n", " }\n", " var _proto = Choices.prototype;\n", " _proto.init = function init() {\n", " if (this.initialised) {\n", " return;\n", " }\n", " this._createTemplates();\n", " this._createElements();\n", " this._createStructure(); // Set initial state (We need to clone the state because some reducers\n", " // modify the inner objects properties in the state) 🤢\n", " this._initialState = cloneObject(this._store.state);\n", " this._store.subscribe(this._render);\n", " this._render();\n", " this._addEventListeners();\n", " var shouldDisable = !this.config.addItems || this.passedElement.element.hasAttribute('disabled');\n", " if (shouldDisable) {\n", " this.disable();\n", " }\n", " this.initialised = true;\n", " var callbackOnInit = this.config.callbackOnInit; // Run callback if it is a function\n", " if (callbackOnInit && typeof callbackOnInit === 'function') {\n", " callbackOnInit.call(this);\n", " }\n", " };\n", " _proto.destroy = function destroy() {\n", " if (!this.initialised) {\n", " return;\n", " }\n", " this._removeEventListeners();\n", " this.passedElement.reveal();\n", " this.containerOuter.unwrap(this.passedElement.element);\n", " this.clearStore();\n", " if (this._isSelectElement) {\n", " this.passedElement.options = this._presetOptions;\n", " }\n", " this._templates = null;\n", " this.initialised = false;\n", " };\n", " _proto.enable = function enable() {\n", " if (this.passedElement.isDisabled) {\n", " this.passedElement.enable();\n", " }\n", " if (this.containerOuter.isDisabled) {\n", " this._addEventListeners();\n", " this.input.enable();\n", " this.containerOuter.enable();\n", " }\n", " return this;\n", " };\n", " _proto.disable = function disable() {\n", " if (!this.passedElement.isDisabled) {\n", " this.passedElement.disable();\n", " }\n", " if (!this.containerOuter.isDisabled) {\n", " this._removeEventListeners();\n", " this.input.disable();\n", " this.containerOuter.disable();\n", " }\n", " return this;\n", " };\n", " _proto.highlightItem = function highlightItem(item, runEvent) {\n", " if (runEvent === void 0) {\n", " runEvent = true;\n", " }\n", " if (!item) {\n", " return this;\n", " }\n", " var id = item.id, _item$groupId = item.groupId, groupId = _item$groupId === void 0 ? -1 : _item$groupId, _item$value = item.value, value = _item$value === void 0 ? '' : _item$value, _item$label = item.label, label = _item$label === void 0 ? '' : _item$label;\n", " var group = groupId >= 0 ? this._store.getGroupById(groupId) : null;\n", " this._store.dispatch(items_highlightItem(id, true));\n", " if (runEvent) {\n", " this.passedElement.triggerEvent(EVENTS.highlightItem, {\n", " id: id,\n", " value: value,\n", " label: label,\n", " groupValue: group && group.value ? group.value : null\n", " });\n", " }\n", " return this;\n", " };\n", " _proto.unhighlightItem = function unhighlightItem(item) {\n", " if (!item) {\n", " return this;\n", " }\n", " var id = item.id, _item$groupId2 = item.groupId, groupId = _item$groupId2 === void 0 ? -1 : _item$groupId2, _item$value2 = item.value, value = _item$value2 === void 0 ? '' : _item$value2, _item$label2 = item.label, label = _item$label2 === void 0 ? '' : _item$label2;\n", " var group = groupId >= 0 ? this._store.getGroupById(groupId) : null;\n", " this._store.dispatch(items_highlightItem(id, false));\n", " this.passedElement.triggerEvent(EVENTS.highlightItem, {\n", " id: id,\n", " value: value,\n", " label: label,\n", " groupValue: group && group.value ? group.value : null\n", " });\n", " return this;\n", " };\n", " _proto.highlightAll = function highlightAll() {\n", " var _this2 = this;\n", " this._store.items.forEach(function (item) {\n", " return _this2.highlightItem(item);\n", " });\n", " return this;\n", " };\n", " _proto.unhighlightAll = function unhighlightAll() {\n", " var _this3 = this;\n", " this._store.items.forEach(function (item) {\n", " return _this3.unhighlightItem(item);\n", " });\n", " return this;\n", " };\n", " _proto.removeActiveItemsByValue = function removeActiveItemsByValue(value) {\n", " var _this4 = this;\n", " this._store.activeItems.filter(function (item) {\n", " return item.value === value;\n", " }).forEach(function (item) {\n", " return _this4._removeItem(item);\n", " });\n", " return this;\n", " };\n", " _proto.removeActiveItems = function removeActiveItems(excludedId) {\n", " var _this5 = this;\n", " this._store.activeItems.filter(function (_ref) {\n", " var id = _ref.id;\n", " return id !== excludedId;\n", " }).forEach(function (item) {\n", " return _this5._removeItem(item);\n", " });\n", " return this;\n", " };\n", " _proto.removeHighlightedItems = function removeHighlightedItems(runEvent) {\n", " var _this6 = this;\n", " if (runEvent === void 0) {\n", " runEvent = false;\n", " }\n", " this._store.highlightedActiveItems.forEach(function (item) {\n", " _this6._removeItem(item); // If this action was performed by the user\n", " // trigger the event\n", " if (runEvent) {\n", " _this6._triggerChange(item.value);\n", " }\n", " });\n", " return this;\n", " };\n", " _proto.showDropdown = function showDropdown(preventInputFocus) {\n", " var _this7 = this;\n", " if (this.dropdown.isActive) {\n", " return this;\n", " }\n", " requestAnimationFrame(function () {\n", " _this7.dropdown.show();\n", " _this7.containerOuter.open(_this7.dropdown.distanceFromTopWindow);\n", " if (!preventInputFocus && _this7._canSearch) {\n", " _this7.input.focus();\n", " }\n", " _this7.passedElement.triggerEvent(EVENTS.showDropdown, {});\n", " });\n", " return this;\n", " };\n", " _proto.hideDropdown = function hideDropdown(preventInputBlur) {\n", " var _this8 = this;\n", " if (!this.dropdown.isActive) {\n", " return this;\n", " }\n", " requestAnimationFrame(function () {\n", " _this8.dropdown.hide();\n", " _this8.containerOuter.close();\n", " if (!preventInputBlur && _this8._canSearch) {\n", " _this8.input.removeActiveDescendant();\n", " _this8.input.blur();\n", " }\n", " _this8.passedElement.triggerEvent(EVENTS.hideDropdown, {});\n", " });\n", " return this;\n", " };\n", " _proto.getValue = function getValue(valueOnly) {\n", " if (valueOnly === void 0) {\n", " valueOnly = false;\n", " }\n", " var values = this._store.activeItems.reduce(function (selectedItems, item) {\n", " var itemValue = valueOnly ? item.value : item;\n", " selectedItems.push(itemValue);\n", " return selectedItems;\n", " }, []);\n", " return this._isSelectOneElement ? values[0] : values;\n", " };\n", " _proto.setValue = function setValue(items) {\n", " var _this9 = this;\n", " if (!this.initialised) {\n", " return this;\n", " }\n", " items.forEach(function (value) {\n", " return _this9._setChoiceOrItem(value);\n", " });\n", " return this;\n", " };\n", " _proto.setChoiceByValue = function setChoiceByValue(value) {\n", " var _this10 = this;\n", " if (!this.initialised || this._isTextElement) {\n", " return this;\n", " } // If only one value has been passed, convert to array\n", " var choiceValue = Array.isArray(value) ? value : [value]; // Loop through each value and\n", " choiceValue.forEach(function (val) {\n", " return _this10._findAndSelectChoiceByValue(val);\n", " });\n", " return this;\n", " };\n", " _proto.setChoices = function setChoices(choicesArrayOrFetcher, value, label, replaceChoices) {\n", " var _this11 = this;\n", " if (choicesArrayOrFetcher === void 0) {\n", " choicesArrayOrFetcher = [];\n", " }\n", " if (value === void 0) {\n", " value = 'value';\n", " }\n", " if (label === void 0) {\n", " label = 'label';\n", " }\n", " if (replaceChoices === void 0) {\n", " replaceChoices = false;\n", " }\n", " if (!this.initialised) {\n", " throw new ReferenceError(\"setChoices was called on a non-initialized instance of Choices\");\n", " }\n", " if (!this._isSelectElement) {\n", " throw new TypeError(\"setChoices can't be used with INPUT based Choices\");\n", " }\n", " if (typeof value !== 'string' || !value) {\n", " throw new TypeError(\"value parameter must be a name of 'value' field in passed objects\");\n", " } // Clear choices if needed\n", " if (replaceChoices) {\n", " this.clearChoices();\n", " }\n", " if (typeof choicesArrayOrFetcher === 'function') {\n", " // it's a choices fetcher function\n", " var fetcher = choicesArrayOrFetcher(this);\n", " if (typeof Promise === 'function' && fetcher instanceof Promise) {\n", " // that's a promise\n", " // eslint-disable-next-line compat/compat\n", " return new Promise(function (resolve) {\n", " return requestAnimationFrame(resolve);\n", " }).then(function () {\n", " return _this11._handleLoadingState(true);\n", " }).then(function () {\n", " return fetcher;\n", " }).then(function (data) {\n", " return _this11.setChoices(data, value, label, replaceChoices);\n", " }).catch(function (err) {\n", " if (!_this11.config.silent) {\n", " console.error(err);\n", " }\n", " }).then(function () {\n", " return _this11._handleLoadingState(false);\n", " }).then(function () {\n", " return _this11;\n", " });\n", " } // function returned something else than promise, let's check if it's an array of choices\n", " if (!Array.isArray(fetcher)) {\n", " throw new TypeError(\".setChoices first argument function must return either array of choices or Promise, got: \" + typeof fetcher);\n", " } // recursion with results, it's sync and choices were cleared already\n", " return this.setChoices(fetcher, value, label, false);\n", " }\n", " if (!Array.isArray(choicesArrayOrFetcher)) {\n", " throw new TypeError(\".setChoices must be called either with array of choices with a function resulting into Promise of array of choices\");\n", " }\n", " this.containerOuter.removeLoadingState();\n", " this._startLoading();\n", " choicesArrayOrFetcher.forEach(function (groupOrChoice) {\n", " if (groupOrChoice.choices) {\n", " _this11._addGroup({\n", " id: parseInt(groupOrChoice.id, 10) || null,\n", " group: groupOrChoice,\n", " valueKey: value,\n", " labelKey: label\n", " });\n", " }\n", " else {\n", " _this11._addChoice({\n", " value: groupOrChoice[value],\n", " label: groupOrChoice[label],\n", " isSelected: groupOrChoice.selected,\n", " isDisabled: groupOrChoice.disabled,\n", " customProperties: groupOrChoice.customProperties,\n", " placeholder: groupOrChoice.placeholder\n", " });\n", " }\n", " });\n", " this._stopLoading();\n", " return this;\n", " };\n", " _proto.clearChoices = function clearChoices() {\n", " this._store.dispatch(choices_clearChoices());\n", " return this;\n", " };\n", " _proto.clearStore = function clearStore() {\n", " this._store.dispatch(clearAll());\n", " return this;\n", " };\n", " _proto.clearInput = function clearInput() {\n", " var shouldSetInputWidth = !this._isSelectOneElement;\n", " this.input.clear(shouldSetInputWidth);\n", " if (!this._isTextElement && this._canSearch) {\n", " this._isSearching = false;\n", " this._store.dispatch(choices_activateChoices(true));\n", " }\n", " return this;\n", " };\n", " _proto._render = function _render() {\n", " if (this._store.isLoading()) {\n", " return;\n", " }\n", " this._currentState = this._store.state;\n", " var stateChanged = this._currentState.choices !== this._prevState.choices || this._currentState.groups !== this._prevState.groups || this._currentState.items !== this._prevState.items;\n", " var shouldRenderChoices = this._isSelectElement;\n", " var shouldRenderItems = this._currentState.items !== this._prevState.items;\n", " if (!stateChanged) {\n", " return;\n", " }\n", " if (shouldRenderChoices) {\n", " this._renderChoices();\n", " }\n", " if (shouldRenderItems) {\n", " this._renderItems();\n", " }\n", " this._prevState = this._currentState;\n", " };\n", " _proto._renderChoices = function _renderChoices() {\n", " var _this12 = this;\n", " var _this$_store = this._store, activeGroups = _this$_store.activeGroups, activeChoices = _this$_store.activeChoices;\n", " var choiceListFragment = document.createDocumentFragment();\n", " this.choiceList.clear();\n", " if (this.config.resetScrollPosition) {\n", " requestAnimationFrame(function () {\n", " return _this12.choiceList.scrollToTop();\n", " });\n", " } // If we have grouped options\n", " if (activeGroups.length >= 1 && !this._isSearching) {\n", " // If we have a placeholder choice along with groups\n", " var activePlaceholders = activeChoices.filter(function (activeChoice) {\n", " return activeChoice.placeholder === true && activeChoice.groupId === -1;\n", " });\n", " if (activePlaceholders.length >= 1) {\n", " choiceListFragment = this._createChoicesFragment(activePlaceholders, choiceListFragment);\n", " }\n", " choiceListFragment = this._createGroupsFragment(activeGroups, activeChoices, choiceListFragment);\n", " }\n", " else if (activeChoices.length >= 1) {\n", " choiceListFragment = this._createChoicesFragment(activeChoices, choiceListFragment);\n", " } // If we have choices to show\n", " if (choiceListFragment.childNodes && choiceListFragment.childNodes.length > 0) {\n", " var activeItems = this._store.activeItems;\n", " var canAddItem = this._canAddItem(activeItems, this.input.value); // ...and we can select them\n", " if (canAddItem.response) {\n", " // ...append them and highlight the first choice\n", " this.choiceList.append(choiceListFragment);\n", " this._highlightChoice();\n", " }\n", " else {\n", " // ...otherwise show a notice\n", " this.choiceList.append(this._getTemplate('notice', canAddItem.notice));\n", " }\n", " }\n", " else {\n", " // Otherwise show a notice\n", " var dropdownItem;\n", " var notice;\n", " if (this._isSearching) {\n", " notice = typeof this.config.noResultsText === 'function' ? this.config.noResultsText() : this.config.noResultsText;\n", " dropdownItem = this._getTemplate('notice', notice, 'no-results');\n", " }\n", " else {\n", " notice = typeof this.config.noChoicesText === 'function' ? this.config.noChoicesText() : this.config.noChoicesText;\n", " dropdownItem = this._getTemplate('notice', notice, 'no-choices');\n", " }\n", " this.choiceList.append(dropdownItem);\n", " }\n", " };\n", " _proto._renderItems = function _renderItems() {\n", " var activeItems = this._store.activeItems || [];\n", " this.itemList.clear(); // Create a fragment to store our list items\n", " // (so we don't have to update the DOM for each item)\n", " var itemListFragment = this._createItemsFragment(activeItems); // If we have items to add, append them\n", " if (itemListFragment.childNodes) {\n", " this.itemList.append(itemListFragment);\n", " }\n", " };\n", " _proto._createGroupsFragment = function _createGroupsFragment(groups, choices, fragment) {\n", " var _this13 = this;\n", " if (fragment === void 0) {\n", " fragment = document.createDocumentFragment();\n", " }\n", " var getGroupChoices = function getGroupChoices(group) {\n", " return choices.filter(function (choice) {\n", " if (_this13._isSelectOneElement) {\n", " return choice.groupId === group.id;\n", " }\n", " return choice.groupId === group.id && (_this13.config.renderSelectedChoices === 'always' || !choice.selected);\n", " });\n", " }; // If sorting is enabled, filter groups\n", " if (this.config.shouldSort) {\n", " groups.sort(this.config.sorter);\n", " }\n", " groups.forEach(function (group) {\n", " var groupChoices = getGroupChoices(group);\n", " if (groupChoices.length >= 1) {\n", " var dropdownGroup = _this13._getTemplate('choiceGroup', group);\n", " fragment.appendChild(dropdownGroup);\n", " _this13._createChoicesFragment(groupChoices, fragment, true);\n", " }\n", " });\n", " return fragment;\n", " };\n", " _proto._createChoicesFragment = function _createChoicesFragment(choices, fragment, withinGroup) {\n", " var _this14 = this;\n", " if (fragment === void 0) {\n", " fragment = document.createDocumentFragment();\n", " }\n", " if (withinGroup === void 0) {\n", " withinGroup = false;\n", " }\n", " // Create a fragment to store our list items (so we don't have to update the DOM for each item)\n", " var _this$config = this.config, renderSelectedChoices = _this$config.renderSelectedChoices, searchResultLimit = _this$config.searchResultLimit, renderChoiceLimit = _this$config.renderChoiceLimit;\n", " var filter = this._isSearching ? sortByScore : this.config.sorter;\n", " var appendChoice = function appendChoice(choice) {\n", " var shouldRender = renderSelectedChoices === 'auto' ? _this14._isSelectOneElement || !choice.selected : true;\n", " if (shouldRender) {\n", " var dropdownItem = _this14._getTemplate('choice', choice, _this14.config.itemSelectText);\n", " fragment.appendChild(dropdownItem);\n", " }\n", " };\n", " var rendererableChoices = choices;\n", " if (renderSelectedChoices === 'auto' && !this._isSelectOneElement) {\n", " rendererableChoices = choices.filter(function (choice) {\n", " return !choice.selected;\n", " });\n", " } // Split array into placeholders and \"normal\" choices\n", " var _rendererableChoices$ = rendererableChoices.reduce(function (acc, choice) {\n", " if (choice.placeholder) {\n", " acc.placeholderChoices.push(choice);\n", " }\n", " else {\n", " acc.normalChoices.push(choice);\n", " }\n", " return acc;\n", " }, {\n", " placeholderChoices: [],\n", " normalChoices: []\n", " }), placeholderChoices = _rendererableChoices$.placeholderChoices, normalChoices = _rendererableChoices$.normalChoices; // If sorting is enabled or the user is searching, filter choices\n", " if (this.config.shouldSort || this._isSearching) {\n", " normalChoices.sort(filter);\n", " }\n", " var choiceLimit = rendererableChoices.length; // Prepend placeholeder\n", " var sortedChoices = this._isSelectOneElement ? [].concat(placeholderChoices, normalChoices) : normalChoices;\n", " if (this._isSearching) {\n", " choiceLimit = searchResultLimit;\n", " }\n", " else if (renderChoiceLimit && renderChoiceLimit > 0 && !withinGroup) {\n", " choiceLimit = renderChoiceLimit;\n", " } // Add each choice to dropdown within range\n", " for (var i = 0; i < choiceLimit; i += 1) {\n", " if (sortedChoices[i]) {\n", " appendChoice(sortedChoices[i]);\n", " }\n", " }\n", " return fragment;\n", " };\n", " _proto._createItemsFragment = function _createItemsFragment(items, fragment) {\n", " var _this15 = this;\n", " if (fragment === void 0) {\n", " fragment = document.createDocumentFragment();\n", " }\n", " // Create fragment to add elements to\n", " var _this$config2 = this.config, shouldSortItems = _this$config2.shouldSortItems, sorter = _this$config2.sorter, removeItemButton = _this$config2.removeItemButton; // If sorting is enabled, filter items\n", " if (shouldSortItems && !this._isSelectOneElement) {\n", " items.sort(sorter);\n", " }\n", " if (this._isTextElement) {\n", " // Update the value of the hidden input\n", " this.passedElement.value = items;\n", " }\n", " else {\n", " // Update the options of the hidden input\n", " this.passedElement.options = items;\n", " }\n", " var addItemToFragment = function addItemToFragment(item) {\n", " // Create new list element\n", " var listItem = _this15._getTemplate('item', item, removeItemButton); // Append it to list\n", " fragment.appendChild(listItem);\n", " }; // Add each list item to list\n", " items.forEach(addItemToFragment);\n", " return fragment;\n", " };\n", " _proto._triggerChange = function _triggerChange(value) {\n", " if (value === undefined || value === null) {\n", " return;\n", " }\n", " this.passedElement.triggerEvent(EVENTS.change, {\n", " value: value\n", " });\n", " };\n", " _proto._selectPlaceholderChoice = function _selectPlaceholderChoice() {\n", " var placeholderChoice = this._store.placeholderChoice;\n", " if (placeholderChoice) {\n", " this._addItem({\n", " value: placeholderChoice.value,\n", " label: placeholderChoice.label,\n", " choiceId: placeholderChoice.id,\n", " groupId: placeholderChoice.groupId,\n", " placeholder: placeholderChoice.placeholder\n", " });\n", " this._triggerChange(placeholderChoice.value);\n", " }\n", " };\n", " _proto._handleButtonAction = function _handleButtonAction(activeItems, element) {\n", " if (!activeItems || !element || !this.config.removeItems || !this.config.removeItemButton) {\n", " return;\n", " }\n", " var itemId = element.parentNode.getAttribute('data-id');\n", " var itemToRemove = activeItems.find(function (item) {\n", " return item.id === parseInt(itemId, 10);\n", " }); // Remove item associated with button\n", " this._removeItem(itemToRemove);\n", " this._triggerChange(itemToRemove.value);\n", " if (this._isSelectOneElement) {\n", " this._selectPlaceholderChoice();\n", " }\n", " };\n", " _proto._handleItemAction = function _handleItemAction(activeItems, element, hasShiftKey) {\n", " var _this16 = this;\n", " if (hasShiftKey === void 0) {\n", " hasShiftKey = false;\n", " }\n", " if (!activeItems || !element || !this.config.removeItems || this._isSelectOneElement) {\n", " return;\n", " }\n", " var passedId = element.getAttribute('data-id'); // We only want to select one item with a click\n", " // so we deselect any items that aren't the target\n", " // unless shift is being pressed\n", " activeItems.forEach(function (item) {\n", " if (item.id === parseInt(passedId, 10) && !item.highlighted) {\n", " _this16.highlightItem(item);\n", " }\n", " else if (!hasShiftKey && item.highlighted) {\n", " _this16.unhighlightItem(item);\n", " }\n", " }); // Focus input as without focus, a user cannot do anything with a\n", " // highlighted item\n", " this.input.focus();\n", " };\n", " _proto._handleChoiceAction = function _handleChoiceAction(activeItems, element) {\n", " if (!activeItems || !element) {\n", " return;\n", " } // If we are clicking on an option\n", " var id = element.dataset.id;\n", " var choice = this._store.getChoiceById(id);\n", " if (!choice) {\n", " return;\n", " }\n", " var passedKeyCode = activeItems[0] && activeItems[0].keyCode ? activeItems[0].keyCode : null;\n", " var hasActiveDropdown = this.dropdown.isActive; // Update choice keyCode\n", " choice.keyCode = passedKeyCode;\n", " this.passedElement.triggerEvent(EVENTS.choice, {\n", " choice: choice\n", " });\n", " if (!choice.selected && !choice.disabled) {\n", " var canAddItem = this._canAddItem(activeItems, choice.value);\n", " if (canAddItem.response) {\n", " this._addItem({\n", " value: choice.value,\n", " label: choice.label,\n", " choiceId: choice.id,\n", " groupId: choice.groupId,\n", " customProperties: choice.customProperties,\n", " placeholder: choice.placeholder,\n", " keyCode: choice.keyCode\n", " });\n", " this._triggerChange(choice.value);\n", " }\n", " }\n", " this.clearInput(); // We want to close the dropdown if we are dealing with a single select box\n", " if (hasActiveDropdown && this._isSelectOneElement) {\n", " this.hideDropdown(true);\n", " this.containerOuter.focus();\n", " }\n", " };\n", " _proto._handleBackspace = function _handleBackspace(activeItems) {\n", " if (!this.config.removeItems || !activeItems) {\n", " return;\n", " }\n", " var lastItem = activeItems[activeItems.length - 1];\n", " var hasHighlightedItems = activeItems.some(function (item) {\n", " return item.highlighted;\n", " }); // If editing the last item is allowed and there are not other selected items,\n", " // we can edit the item value. Otherwise if we can remove items, remove all selected items\n", " if (this.config.editItems && !hasHighlightedItems && lastItem) {\n", " this.input.value = lastItem.value;\n", " this.input.setWidth();\n", " this._removeItem(lastItem);\n", " this._triggerChange(lastItem.value);\n", " }\n", " else {\n", " if (!hasHighlightedItems) {\n", " // Highlight last item if none already highlighted\n", " this.highlightItem(lastItem, false);\n", " }\n", " this.removeHighlightedItems(true);\n", " }\n", " };\n", " _proto._startLoading = function _startLoading() {\n", " this._store.dispatch(setIsLoading(true));\n", " };\n", " _proto._stopLoading = function _stopLoading() {\n", " this._store.dispatch(setIsLoading(false));\n", " };\n", " _proto._handleLoadingState = function _handleLoadingState(setLoading) {\n", " if (setLoading === void 0) {\n", " setLoading = true;\n", " }\n", " var placeholderItem = this.itemList.getChild(\".\" + this.config.classNames.placeholder);\n", " if (setLoading) {\n", " this.disable();\n", " this.containerOuter.addLoadingState();\n", " if (this._isSelectOneElement) {\n", " if (!placeholderItem) {\n", " placeholderItem = this._getTemplate('placeholder', this.config.loadingText);\n", " this.itemList.append(placeholderItem);\n", " }\n", " else {\n", " placeholderItem.innerHTML = this.config.loadingText;\n", " }\n", " }\n", " else {\n", " this.input.placeholder = this.config.loadingText;\n", " }\n", " }\n", " else {\n", " this.enable();\n", " this.containerOuter.removeLoadingState();\n", " if (this._isSelectOneElement) {\n", " placeholderItem.innerHTML = this._placeholderValue || '';\n", " }\n", " else {\n", " this.input.placeholder = this._placeholderValue || '';\n", " }\n", " }\n", " };\n", " _proto._handleSearch = function _handleSearch(value) {\n", " if (!value || !this.input.isFocussed) {\n", " return;\n", " }\n", " var choices = this._store.choices;\n", " var _this$config3 = this.config, searchFloor = _this$config3.searchFloor, searchChoices = _this$config3.searchChoices;\n", " var hasUnactiveChoices = choices.some(function (option) {\n", " return !option.active;\n", " }); // Check that we have a value to search and the input was an alphanumeric character\n", " if (value && value.length >= searchFloor) {\n", " var resultCount = searchChoices ? this._searchChoices(value) : 0; // Trigger search event\n", " this.passedElement.triggerEvent(EVENTS.search, {\n", " value: value,\n", " resultCount: resultCount\n", " });\n", " }\n", " else if (hasUnactiveChoices) {\n", " // Otherwise reset choices to active\n", " this._isSearching = false;\n", " this._store.dispatch(choices_activateChoices(true));\n", " }\n", " };\n", " _proto._canAddItem = function _canAddItem(activeItems, value) {\n", " var canAddItem = true;\n", " var notice = typeof this.config.addItemText === 'function' ? this.config.addItemText(value) : this.config.addItemText;\n", " if (!this._isSelectOneElement) {\n", " var isDuplicateValue = existsInArray(activeItems, value);\n", " if (this.config.maxItemCount > 0 && this.config.maxItemCount <= activeItems.length) {\n", " // If there is a max entry limit and we have reached that limit\n", " // don't update\n", " canAddItem = false;\n", " notice = typeof this.config.maxItemText === 'function' ? this.config.maxItemText(this.config.maxItemCount) : this.config.maxItemText;\n", " }\n", " if (!this.config.duplicateItemsAllowed && isDuplicateValue && canAddItem) {\n", " canAddItem = false;\n", " notice = typeof this.config.uniqueItemText === 'function' ? this.config.uniqueItemText(value) : this.config.uniqueItemText;\n", " }\n", " if (this._isTextElement && this.config.addItems && canAddItem && typeof this.config.addItemFilter === 'function' && !this.config.addItemFilter(value)) {\n", " canAddItem = false;\n", " notice = typeof this.config.customAddItemText === 'function' ? this.config.customAddItemText(value) : this.config.customAddItemText;\n", " }\n", " }\n", " return {\n", " response: canAddItem,\n", " notice: notice\n", " };\n", " };\n", " _proto._searchChoices = function _searchChoices(value) {\n", " var newValue = typeof value === 'string' ? value.trim() : value;\n", " var currentValue = typeof this._currentValue === 'string' ? this._currentValue.trim() : this._currentValue;\n", " if (newValue.length < 1 && newValue === currentValue + \" \") {\n", " return 0;\n", " } // If new value matches the desired length and is not the same as the current value with a space\n", " var haystack = this._store.searchableChoices;\n", " var needle = newValue;\n", " var keys = [].concat(this.config.searchFields);\n", " var options = Object.assign(this.config.fuseOptions, {\n", " keys: keys\n", " });\n", " var fuse = new fuse_default.a(haystack, options);\n", " var results = fuse.search(needle);\n", " this._currentValue = newValue;\n", " this._highlightPosition = 0;\n", " this._isSearching = true;\n", " this._store.dispatch(choices_filterChoices(results));\n", " return results.length;\n", " };\n", " _proto._addEventListeners = function _addEventListeners() {\n", " var _document = document, documentElement = _document.documentElement; // capture events - can cancel event processing or propagation\n", " documentElement.addEventListener('touchend', this._onTouchEnd, true);\n", " this.containerOuter.element.addEventListener('keydown', this._onKeyDown, true);\n", " this.containerOuter.element.addEventListener('mousedown', this._onMouseDown, true); // passive events - doesn't call `preventDefault` or `stopPropagation`\n", " documentElement.addEventListener('click', this._onClick, {\n", " passive: true\n", " });\n", " documentElement.addEventListener('touchmove', this._onTouchMove, {\n", " passive: true\n", " });\n", " this.dropdown.element.addEventListener('mouseover', this._onMouseOver, {\n", " passive: true\n", " });\n", " if (this._isSelectOneElement) {\n", " this.containerOuter.element.addEventListener('focus', this._onFocus, {\n", " passive: true\n", " });\n", " this.containerOuter.element.addEventListener('blur', this._onBlur, {\n", " passive: true\n", " });\n", " }\n", " this.input.element.addEventListener('keyup', this._onKeyUp, {\n", " passive: true\n", " });\n", " this.input.element.addEventListener('focus', this._onFocus, {\n", " passive: true\n", " });\n", " this.input.element.addEventListener('blur', this._onBlur, {\n", " passive: true\n", " });\n", " if (this.input.element.form) {\n", " this.input.element.form.addEventListener('reset', this._onFormReset, {\n", " passive: true\n", " });\n", " }\n", " this.input.addEventListeners();\n", " };\n", " _proto._removeEventListeners = function _removeEventListeners() {\n", " var _document2 = document, documentElement = _document2.documentElement;\n", " documentElement.removeEventListener('touchend', this._onTouchEnd, true);\n", " this.containerOuter.element.removeEventListener('keydown', this._onKeyDown, true);\n", " this.containerOuter.element.removeEventListener('mousedown', this._onMouseDown, true);\n", " documentElement.removeEventListener('click', this._onClick);\n", " documentElement.removeEventListener('touchmove', this._onTouchMove);\n", " this.dropdown.element.removeEventListener('mouseover', this._onMouseOver);\n", " if (this._isSelectOneElement) {\n", " this.containerOuter.element.removeEventListener('focus', this._onFocus);\n", " this.containerOuter.element.removeEventListener('blur', this._onBlur);\n", " }\n", " this.input.element.removeEventListener('keyup', this._onKeyUp);\n", " this.input.element.removeEventListener('focus', this._onFocus);\n", " this.input.element.removeEventListener('blur', this._onBlur);\n", " if (this.input.element.form) {\n", " this.input.element.form.removeEventListener('reset', this._onFormReset);\n", " }\n", " this.input.removeEventListeners();\n", " };\n", " _proto._onKeyDown = function _onKeyDown(event) {\n", " var _keyDownActions;\n", " var target = event.target, keyCode = event.keyCode, ctrlKey = event.ctrlKey, metaKey = event.metaKey;\n", " var activeItems = this._store.activeItems;\n", " var hasFocusedInput = this.input.isFocussed;\n", " var hasActiveDropdown = this.dropdown.isActive;\n", " var hasItems = this.itemList.hasChildren();\n", " var keyString = String.fromCharCode(keyCode);\n", " var BACK_KEY = KEY_CODES.BACK_KEY, DELETE_KEY = KEY_CODES.DELETE_KEY, ENTER_KEY = KEY_CODES.ENTER_KEY, A_KEY = KEY_CODES.A_KEY, ESC_KEY = KEY_CODES.ESC_KEY, UP_KEY = KEY_CODES.UP_KEY, DOWN_KEY = KEY_CODES.DOWN_KEY, PAGE_UP_KEY = KEY_CODES.PAGE_UP_KEY, PAGE_DOWN_KEY = KEY_CODES.PAGE_DOWN_KEY;\n", " var hasCtrlDownKeyPressed = ctrlKey || metaKey; // If a user is typing and the dropdown is not active\n", " if (!this._isTextElement && /[a-zA-Z0-9-_ ]/.test(keyString)) {\n", " this.showDropdown();\n", " } // Map keys to key actions\n", " var keyDownActions = (_keyDownActions = {}, _keyDownActions[A_KEY] = this._onAKey, _keyDownActions[ENTER_KEY] = this._onEnterKey, _keyDownActions[ESC_KEY] = this._onEscapeKey, _keyDownActions[UP_KEY] = this._onDirectionKey, _keyDownActions[PAGE_UP_KEY] = this._onDirectionKey, _keyDownActions[DOWN_KEY] = this._onDirectionKey, _keyDownActions[PAGE_DOWN_KEY] = this._onDirectionKey, _keyDownActions[DELETE_KEY] = this._onDeleteKey, _keyDownActions[BACK_KEY] = this._onDeleteKey, _keyDownActions); // If keycode has a function, run it\n", " if (keyDownActions[keyCode]) {\n", " keyDownActions[keyCode]({\n", " event: event,\n", " target: target,\n", " keyCode: keyCode,\n", " metaKey: metaKey,\n", " activeItems: activeItems,\n", " hasFocusedInput: hasFocusedInput,\n", " hasActiveDropdown: hasActiveDropdown,\n", " hasItems: hasItems,\n", " hasCtrlDownKeyPressed: hasCtrlDownKeyPressed\n", " });\n", " }\n", " };\n", " _proto._onKeyUp = function _onKeyUp(_ref2) {\n", " var target = _ref2.target, keyCode = _ref2.keyCode;\n", " var value = this.input.value;\n", " var activeItems = this._store.activeItems;\n", " var canAddItem = this._canAddItem(activeItems, value);\n", " var backKey = KEY_CODES.BACK_KEY, deleteKey = KEY_CODES.DELETE_KEY; // We are typing into a text input and have a value, we want to show a dropdown\n", " // notice. Otherwise hide the dropdown\n", " if (this._isTextElement) {\n", " var canShowDropdownNotice = canAddItem.notice && value;\n", " if (canShowDropdownNotice) {\n", " var dropdownItem = this._getTemplate('notice', canAddItem.notice);\n", " this.dropdown.element.innerHTML = dropdownItem.outerHTML;\n", " this.showDropdown(true);\n", " }\n", " else {\n", " this.hideDropdown(true);\n", " }\n", " }\n", " else {\n", " var userHasRemovedValue = (keyCode === backKey || keyCode === deleteKey) && !target.value;\n", " var canReactivateChoices = !this._isTextElement && this._isSearching;\n", " var canSearch = this._canSearch && canAddItem.response;\n", " if (userHasRemovedValue && canReactivateChoices) {\n", " this._isSearching = false;\n", " this._store.dispatch(choices_activateChoices(true));\n", " }\n", " else if (canSearch) {\n", " this._handleSearch(this.input.value);\n", " }\n", " }\n", " this._canSearch = this.config.searchEnabled;\n", " };\n", " _proto._onAKey = function _onAKey(_ref3) {\n", " var hasItems = _ref3.hasItems, hasCtrlDownKeyPressed = _ref3.hasCtrlDownKeyPressed;\n", " // If CTRL + A or CMD + A have been pressed and there are items to select\n", " if (hasCtrlDownKeyPressed && hasItems) {\n", " this._canSearch = false;\n", " var shouldHightlightAll = this.config.removeItems && !this.input.value && this.input.element === document.activeElement;\n", " if (shouldHightlightAll) {\n", " this.highlightAll();\n", " }\n", " }\n", " };\n", " _proto._onEnterKey = function _onEnterKey(_ref4) {\n", " var event = _ref4.event, target = _ref4.target, activeItems = _ref4.activeItems, hasActiveDropdown = _ref4.hasActiveDropdown;\n", " var enterKey = KEY_CODES.ENTER_KEY;\n", " var targetWasButton = target.hasAttribute('data-button');\n", " if (this._isTextElement && target.value) {\n", " var value = this.input.value;\n", " var canAddItem = this._canAddItem(activeItems, value);\n", " if (canAddItem.response) {\n", " this.hideDropdown(true);\n", " this._addItem({\n", " value: value\n", " });\n", " this._triggerChange(value);\n", " this.clearInput();\n", " }\n", " }\n", " if (targetWasButton) {\n", " this._handleButtonAction(activeItems, target);\n", " event.preventDefault();\n", " }\n", " if (hasActiveDropdown) {\n", " var highlightedChoice = this.dropdown.getChild(\".\" + this.config.classNames.highlightedState);\n", " if (highlightedChoice) {\n", " // add enter keyCode value\n", " if (activeItems[0]) {\n", " activeItems[0].keyCode = enterKey; // eslint-disable-line no-param-reassign\n", " }\n", " this._handleChoiceAction(activeItems, highlightedChoice);\n", " }\n", " event.preventDefault();\n", " }\n", " else if (this._isSelectOneElement) {\n", " this.showDropdown();\n", " event.preventDefault();\n", " }\n", " };\n", " _proto._onEscapeKey = function _onEscapeKey(_ref5) {\n", " var hasActiveDropdown = _ref5.hasActiveDropdown;\n", " if (hasActiveDropdown) {\n", " this.hideDropdown(true);\n", " this.containerOuter.focus();\n", " }\n", " };\n", " _proto._onDirectionKey = function _onDirectionKey(_ref6) {\n", " var event = _ref6.event, hasActiveDropdown = _ref6.hasActiveDropdown, keyCode = _ref6.keyCode, metaKey = _ref6.metaKey;\n", " var downKey = KEY_CODES.DOWN_KEY, pageUpKey = KEY_CODES.PAGE_UP_KEY, pageDownKey = KEY_CODES.PAGE_DOWN_KEY; // If up or down key is pressed, traverse through options\n", " if (hasActiveDropdown || this._isSelectOneElement) {\n", " this.showDropdown();\n", " this._canSearch = false;\n", " var directionInt = keyCode === downKey || keyCode === pageDownKey ? 1 : -1;\n", " var skipKey = metaKey || keyCode === pageDownKey || keyCode === pageUpKey;\n", " var selectableChoiceIdentifier = '[data-choice-selectable]';\n", " var nextEl;\n", " if (skipKey) {\n", " if (directionInt > 0) {\n", " nextEl = this.dropdown.element.querySelector(selectableChoiceIdentifier + \":last-of-type\");\n", " }\n", " else {\n", " nextEl = this.dropdown.element.querySelector(selectableChoiceIdentifier);\n", " }\n", " }\n", " else {\n", " var currentEl = this.dropdown.element.querySelector(\".\" + this.config.classNames.highlightedState);\n", " if (currentEl) {\n", " nextEl = getAdjacentEl(currentEl, selectableChoiceIdentifier, directionInt);\n", " }\n", " else {\n", " nextEl = this.dropdown.element.querySelector(selectableChoiceIdentifier);\n", " }\n", " }\n", " if (nextEl) {\n", " // We prevent default to stop the cursor moving\n", " // when pressing the arrow\n", " if (!isScrolledIntoView(nextEl, this.choiceList.element, directionInt)) {\n", " this.choiceList.scrollToChildElement(nextEl, directionInt);\n", " }\n", " this._highlightChoice(nextEl);\n", " } // Prevent default to maintain cursor position whilst\n", " // traversing dropdown options\n", " event.preventDefault();\n", " }\n", " };\n", " _proto._onDeleteKey = function _onDeleteKey(_ref7) {\n", " var event = _ref7.event, target = _ref7.target, hasFocusedInput = _ref7.hasFocusedInput, activeItems = _ref7.activeItems;\n", " // If backspace or delete key is pressed and the input has no value\n", " if (hasFocusedInput && !target.value && !this._isSelectOneElement) {\n", " this._handleBackspace(activeItems);\n", " event.preventDefault();\n", " }\n", " };\n", " _proto._onTouchMove = function _onTouchMove() {\n", " if (this._wasTap) {\n", " this._wasTap = false;\n", " }\n", " };\n", " _proto._onTouchEnd = function _onTouchEnd(event) {\n", " var _ref8 = event || event.touches[0], target = _ref8.target;\n", " var touchWasWithinContainer = this._wasTap && this.containerOuter.element.contains(target);\n", " if (touchWasWithinContainer) {\n", " var containerWasExactTarget = target === this.containerOuter.element || target === this.containerInner.element;\n", " if (containerWasExactTarget) {\n", " if (this._isTextElement) {\n", " this.input.focus();\n", " }\n", " else if (this._isSelectMultipleElement) {\n", " this.showDropdown();\n", " }\n", " } // Prevents focus event firing\n", " event.stopPropagation();\n", " }\n", " this._wasTap = true;\n", " };\n", " _proto._onMouseDown = function _onMouseDown(event) {\n", " var target = event.target;\n", " if (!(target instanceof HTMLElement)) {\n", " return;\n", " } // If we have our mouse down on the scrollbar and are on IE11...\n", " if (IS_IE11 && this.choiceList.element.contains(target)) {\n", " // check if click was on a scrollbar area\n", " var firstChoice = \n", " /** @type {HTMLElement} */\n", " this.choiceList.element.firstElementChild;\n", " var isOnScrollbar = this._direction === 'ltr' ? event.offsetX >= firstChoice.offsetWidth : event.offsetX < firstChoice.offsetLeft;\n", " this._isScrollingOnIe = isOnScrollbar;\n", " }\n", " if (target === this.input.element) {\n", " return;\n", " }\n", " var item = target.closest('[data-button],[data-item],[data-choice]');\n", " if (item instanceof HTMLElement) {\n", " var hasShiftKey = event.shiftKey;\n", " var activeItems = this._store.activeItems;\n", " var dataset = item.dataset;\n", " if ('button' in dataset) {\n", " this._handleButtonAction(activeItems, item);\n", " }\n", " else if ('item' in dataset) {\n", " this._handleItemAction(activeItems, item, hasShiftKey);\n", " }\n", " else if ('choice' in dataset) {\n", " this._handleChoiceAction(activeItems, item);\n", " }\n", " }\n", " event.preventDefault();\n", " };\n", " _proto._onMouseOver = function _onMouseOver(_ref9) {\n", " var target = _ref9.target;\n", " if (target instanceof HTMLElement && 'choice' in target.dataset) {\n", " this._highlightChoice(target);\n", " }\n", " };\n", " _proto._onClick = function _onClick(_ref10) {\n", " var target = _ref10.target;\n", " var clickWasWithinContainer = this.containerOuter.element.contains(target);\n", " if (clickWasWithinContainer) {\n", " if (!this.dropdown.isActive && !this.containerOuter.isDisabled) {\n", " if (this._isTextElement) {\n", " if (document.activeElement !== this.input.element) {\n", " this.input.focus();\n", " }\n", " }\n", " else {\n", " this.showDropdown();\n", " this.containerOuter.focus();\n", " }\n", " }\n", " else if (this._isSelectOneElement && target !== this.input.element && !this.dropdown.element.contains(target)) {\n", " this.hideDropdown();\n", " }\n", " }\n", " else {\n", " var hasHighlightedItems = this._store.highlightedActiveItems.length > 0;\n", " if (hasHighlightedItems) {\n", " this.unhighlightAll();\n", " }\n", " this.containerOuter.removeFocusState();\n", " this.hideDropdown(true);\n", " }\n", " };\n", " _proto._onFocus = function _onFocus(_ref11) {\n", " var _this17 = this, _focusActions;\n", " var target = _ref11.target;\n", " var focusWasWithinContainer = this.containerOuter.element.contains(target);\n", " if (!focusWasWithinContainer) {\n", " return;\n", " }\n", " var focusActions = (_focusActions = {}, _focusActions[TEXT_TYPE] = function () {\n", " if (target === _this17.input.element) {\n", " _this17.containerOuter.addFocusState();\n", " }\n", " }, _focusActions[SELECT_ONE_TYPE] = function () {\n", " _this17.containerOuter.addFocusState();\n", " if (target === _this17.input.element) {\n", " _this17.showDropdown(true);\n", " }\n", " }, _focusActions[SELECT_MULTIPLE_TYPE] = function () {\n", " if (target === _this17.input.element) {\n", " _this17.showDropdown(true); // If element is a select box, the focused element is the container and the dropdown\n", " // isn't already open, focus and show dropdown\n", " _this17.containerOuter.addFocusState();\n", " }\n", " }, _focusActions);\n", " focusActions[this.passedElement.element.type]();\n", " };\n", " _proto._onBlur = function _onBlur(_ref12) {\n", " var _this18 = this;\n", " var target = _ref12.target;\n", " var blurWasWithinContainer = this.containerOuter.element.contains(target);\n", " if (blurWasWithinContainer && !this._isScrollingOnIe) {\n", " var _blurActions;\n", " var activeItems = this._store.activeItems;\n", " var hasHighlightedItems = activeItems.some(function (item) {\n", " return item.highlighted;\n", " });\n", " var blurActions = (_blurActions = {}, _blurActions[TEXT_TYPE] = function () {\n", " if (target === _this18.input.element) {\n", " _this18.containerOuter.removeFocusState();\n", " if (hasHighlightedItems) {\n", " _this18.unhighlightAll();\n", " }\n", " _this18.hideDropdown(true);\n", " }\n", " }, _blurActions[SELECT_ONE_TYPE] = function () {\n", " _this18.containerOuter.removeFocusState();\n", " if (target === _this18.input.element || target === _this18.containerOuter.element && !_this18._canSearch) {\n", " _this18.hideDropdown(true);\n", " }\n", " }, _blurActions[SELECT_MULTIPLE_TYPE] = function () {\n", " if (target === _this18.input.element) {\n", " _this18.containerOuter.removeFocusState();\n", " _this18.hideDropdown(true);\n", " if (hasHighlightedItems) {\n", " _this18.unhighlightAll();\n", " }\n", " }\n", " }, _blurActions);\n", " blurActions[this.passedElement.element.type]();\n", " }\n", " else {\n", " // On IE11, clicking the scollbar blurs our input and thus\n", " // closes the dropdown. To stop this, we refocus our input\n", " // if we know we are on IE *and* are scrolling.\n", " this._isScrollingOnIe = false;\n", " this.input.element.focus();\n", " }\n", " };\n", " _proto._onFormReset = function _onFormReset() {\n", " this._store.dispatch(resetTo(this._initialState));\n", " };\n", " _proto._highlightChoice = function _highlightChoice(el) {\n", " var _this19 = this;\n", " if (el === void 0) {\n", " el = null;\n", " }\n", " var choices = Array.from(this.dropdown.element.querySelectorAll('[data-choice-selectable]'));\n", " if (!choices.length) {\n", " return;\n", " }\n", " var passedEl = el;\n", " var highlightedChoices = Array.from(this.dropdown.element.querySelectorAll(\".\" + this.config.classNames.highlightedState)); // Remove any highlighted choices\n", " highlightedChoices.forEach(function (choice) {\n", " choice.classList.remove(_this19.config.classNames.highlightedState);\n", " choice.setAttribute('aria-selected', 'false');\n", " });\n", " if (passedEl) {\n", " this._highlightPosition = choices.indexOf(passedEl);\n", " }\n", " else {\n", " // Highlight choice based on last known highlight location\n", " if (choices.length > this._highlightPosition) {\n", " // If we have an option to highlight\n", " passedEl = choices[this._highlightPosition];\n", " }\n", " else {\n", " // Otherwise highlight the option before\n", " passedEl = choices[choices.length - 1];\n", " }\n", " if (!passedEl) {\n", " passedEl = choices[0];\n", " }\n", " }\n", " passedEl.classList.add(this.config.classNames.highlightedState);\n", " passedEl.setAttribute('aria-selected', 'true');\n", " this.passedElement.triggerEvent(EVENTS.highlightChoice, {\n", " el: passedEl\n", " });\n", " if (this.dropdown.isActive) {\n", " // IE11 ignores aria-label and blocks virtual keyboard\n", " // if aria-activedescendant is set without a dropdown\n", " this.input.setActiveDescendant(passedEl.id);\n", " this.containerOuter.setActiveDescendant(passedEl.id);\n", " }\n", " };\n", " _proto._addItem = function _addItem(_ref13) {\n", " var value = _ref13.value, _ref13$label = _ref13.label, label = _ref13$label === void 0 ? null : _ref13$label, _ref13$choiceId = _ref13.choiceId, choiceId = _ref13$choiceId === void 0 ? -1 : _ref13$choiceId, _ref13$groupId = _ref13.groupId, groupId = _ref13$groupId === void 0 ? -1 : _ref13$groupId, _ref13$customProperti = _ref13.customProperties, customProperties = _ref13$customProperti === void 0 ? null : _ref13$customProperti, _ref13$placeholder = _ref13.placeholder, placeholder = _ref13$placeholder === void 0 ? false : _ref13$placeholder, _ref13$keyCode = _ref13.keyCode, keyCode = _ref13$keyCode === void 0 ? null : _ref13$keyCode;\n", " var passedValue = typeof value === 'string' ? value.trim() : value;\n", " var passedKeyCode = keyCode;\n", " var passedCustomProperties = customProperties;\n", " var items = this._store.items;\n", " var passedLabel = label || passedValue;\n", " var passedOptionId = choiceId || -1;\n", " var group = groupId >= 0 ? this._store.getGroupById(groupId) : null;\n", " var id = items ? items.length + 1 : 1; // If a prepended value has been passed, prepend it\n", " if (this.config.prependValue) {\n", " passedValue = this.config.prependValue + passedValue.toString();\n", " } // If an appended value has been passed, append it\n", " if (this.config.appendValue) {\n", " passedValue += this.config.appendValue.toString();\n", " }\n", " this._store.dispatch(items_addItem({\n", " value: passedValue,\n", " label: passedLabel,\n", " id: id,\n", " choiceId: passedOptionId,\n", " groupId: groupId,\n", " customProperties: customProperties,\n", " placeholder: placeholder,\n", " keyCode: passedKeyCode\n", " }));\n", " if (this._isSelectOneElement) {\n", " this.removeActiveItems(id);\n", " } // Trigger change event\n", " this.passedElement.triggerEvent(EVENTS.addItem, {\n", " id: id,\n", " value: passedValue,\n", " label: passedLabel,\n", " customProperties: passedCustomProperties,\n", " groupValue: group && group.value ? group.value : undefined,\n", " keyCode: passedKeyCode\n", " });\n", " return this;\n", " };\n", " _proto._removeItem = function _removeItem(item) {\n", " if (!item || !isType('Object', item)) {\n", " return this;\n", " }\n", " var id = item.id, value = item.value, label = item.label, choiceId = item.choiceId, groupId = item.groupId;\n", " var group = groupId >= 0 ? this._store.getGroupById(groupId) : null;\n", " this._store.dispatch(items_removeItem(id, choiceId));\n", " if (group && group.value) {\n", " this.passedElement.triggerEvent(EVENTS.removeItem, {\n", " id: id,\n", " value: value,\n", " label: label,\n", " groupValue: group.value\n", " });\n", " }\n", " else {\n", " this.passedElement.triggerEvent(EVENTS.removeItem, {\n", " id: id,\n", " value: value,\n", " label: label\n", " });\n", " }\n", " return this;\n", " };\n", " _proto._addChoice = function _addChoice(_ref14) {\n", " var value = _ref14.value, _ref14$label = _ref14.label, label = _ref14$label === void 0 ? null : _ref14$label, _ref14$isSelected = _ref14.isSelected, isSelected = _ref14$isSelected === void 0 ? false : _ref14$isSelected, _ref14$isDisabled = _ref14.isDisabled, isDisabled = _ref14$isDisabled === void 0 ? false : _ref14$isDisabled, _ref14$groupId = _ref14.groupId, groupId = _ref14$groupId === void 0 ? -1 : _ref14$groupId, _ref14$customProperti = _ref14.customProperties, customProperties = _ref14$customProperti === void 0 ? null : _ref14$customProperti, _ref14$placeholder = _ref14.placeholder, placeholder = _ref14$placeholder === void 0 ? false : _ref14$placeholder, _ref14$keyCode = _ref14.keyCode, keyCode = _ref14$keyCode === void 0 ? null : _ref14$keyCode;\n", " if (typeof value === 'undefined' || value === null) {\n", " return;\n", " } // Generate unique id\n", " var choices = this._store.choices;\n", " var choiceLabel = label || value;\n", " var choiceId = choices ? choices.length + 1 : 1;\n", " var choiceElementId = this._baseId + \"-\" + this._idNames.itemChoice + \"-\" + choiceId;\n", " this._store.dispatch(choices_addChoice({\n", " id: choiceId,\n", " groupId: groupId,\n", " elementId: choiceElementId,\n", " value: value,\n", " label: choiceLabel,\n", " disabled: isDisabled,\n", " customProperties: customProperties,\n", " placeholder: placeholder,\n", " keyCode: keyCode\n", " }));\n", " if (isSelected) {\n", " this._addItem({\n", " value: value,\n", " label: choiceLabel,\n", " choiceId: choiceId,\n", " customProperties: customProperties,\n", " placeholder: placeholder,\n", " keyCode: keyCode\n", " });\n", " }\n", " };\n", " _proto._addGroup = function _addGroup(_ref15) {\n", " var _this20 = this;\n", " var group = _ref15.group, id = _ref15.id, _ref15$valueKey = _ref15.valueKey, valueKey = _ref15$valueKey === void 0 ? 'value' : _ref15$valueKey, _ref15$labelKey = _ref15.labelKey, labelKey = _ref15$labelKey === void 0 ? 'label' : _ref15$labelKey;\n", " var groupChoices = isType('Object', group) ? group.choices : Array.from(group.getElementsByTagName('OPTION'));\n", " var groupId = id || Math.floor(new Date().valueOf() * Math.random());\n", " var isDisabled = group.disabled ? group.disabled : false;\n", " if (groupChoices) {\n", " this._store.dispatch(groups_addGroup({\n", " value: group.label,\n", " id: groupId,\n", " active: true,\n", " disabled: isDisabled\n", " }));\n", " var addGroupChoices = function addGroupChoices(choice) {\n", " var isOptDisabled = choice.disabled || choice.parentNode && choice.parentNode.disabled;\n", " _this20._addChoice({\n", " value: choice[valueKey],\n", " label: isType('Object', choice) ? choice[labelKey] : choice.innerHTML,\n", " isSelected: choice.selected,\n", " isDisabled: isOptDisabled,\n", " groupId: groupId,\n", " customProperties: choice.customProperties,\n", " placeholder: choice.placeholder\n", " });\n", " };\n", " groupChoices.forEach(addGroupChoices);\n", " }\n", " else {\n", " this._store.dispatch(groups_addGroup({\n", " value: group.label,\n", " id: group.id,\n", " active: false,\n", " disabled: group.disabled\n", " }));\n", " }\n", " };\n", " _proto._getTemplate = function _getTemplate(template) {\n", " var _this$_templates$temp;\n", " if (!template) {\n", " return null;\n", " }\n", " var classNames = this.config.classNames;\n", " for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n", " args[_key - 1] = arguments[_key];\n", " }\n", " return (_this$_templates$temp = this._templates[template]).call.apply(_this$_templates$temp, [this, classNames].concat(args));\n", " };\n", " _proto._createTemplates = function _createTemplates() {\n", " var callbackOnCreateTemplates = this.config.callbackOnCreateTemplates;\n", " var userTemplates = {};\n", " if (callbackOnCreateTemplates && typeof callbackOnCreateTemplates === 'function') {\n", " userTemplates = callbackOnCreateTemplates.call(this, strToEl);\n", " }\n", " this._templates = cjs_default()(TEMPLATES, userTemplates);\n", " };\n", " _proto._createElements = function _createElements() {\n", " this.containerOuter = new container_Container({\n", " element: this._getTemplate('containerOuter', this._direction, this._isSelectElement, this._isSelectOneElement, this.config.searchEnabled, this.passedElement.element.type),\n", " classNames: this.config.classNames,\n", " type: this.passedElement.element.type,\n", " position: this.config.position\n", " });\n", " this.containerInner = new container_Container({\n", " element: this._getTemplate('containerInner'),\n", " classNames: this.config.classNames,\n", " type: this.passedElement.element.type,\n", " position: this.config.position\n", " });\n", " this.input = new input_Input({\n", " element: this._getTemplate('input', this._placeholderValue),\n", " classNames: this.config.classNames,\n", " type: this.passedElement.element.type,\n", " preventPaste: !this.config.paste\n", " });\n", " this.choiceList = new list_List({\n", " element: this._getTemplate('choiceList', this._isSelectOneElement)\n", " });\n", " this.itemList = new list_List({\n", " element: this._getTemplate('itemList', this._isSelectOneElement)\n", " });\n", " this.dropdown = new Dropdown({\n", " element: this._getTemplate('dropdown'),\n", " classNames: this.config.classNames,\n", " type: this.passedElement.element.type\n", " });\n", " };\n", " _proto._createStructure = function _createStructure() {\n", " // Hide original element\n", " this.passedElement.conceal(); // Wrap input in container preserving DOM ordering\n", " this.containerInner.wrap(this.passedElement.element); // Wrapper inner container with outer container\n", " this.containerOuter.wrap(this.containerInner.element);\n", " if (this._isSelectOneElement) {\n", " this.input.placeholder = this.config.searchPlaceholderValue || '';\n", " }\n", " else if (this._placeholderValue) {\n", " this.input.placeholder = this._placeholderValue;\n", " this.input.setWidth();\n", " }\n", " this.containerOuter.element.appendChild(this.containerInner.element);\n", " this.containerOuter.element.appendChild(this.dropdown.element);\n", " this.containerInner.element.appendChild(this.itemList.element);\n", " if (!this._isTextElement) {\n", " this.dropdown.element.appendChild(this.choiceList.element);\n", " }\n", " if (!this._isSelectOneElement) {\n", " this.containerInner.element.appendChild(this.input.element);\n", " }\n", " else if (this.config.searchEnabled) {\n", " this.dropdown.element.insertBefore(this.input.element, this.dropdown.element.firstChild);\n", " }\n", " if (this._isSelectElement) {\n", " this._highlightPosition = 0;\n", " this._isSearching = false;\n", " this._startLoading();\n", " if (this._presetGroups.length) {\n", " this._addPredefinedGroups(this._presetGroups);\n", " }\n", " else {\n", " this._addPredefinedChoices(this._presetChoices);\n", " }\n", " this._stopLoading();\n", " }\n", " if (this._isTextElement) {\n", " this._addPredefinedItems(this._presetItems);\n", " }\n", " };\n", " _proto._addPredefinedGroups = function _addPredefinedGroups(groups) {\n", " var _this21 = this;\n", " // If we have a placeholder option\n", " var placeholderChoice = this.passedElement.placeholderOption;\n", " if (placeholderChoice && placeholderChoice.parentNode.tagName === 'SELECT') {\n", " this._addChoice({\n", " value: placeholderChoice.value,\n", " label: placeholderChoice.innerHTML,\n", " isSelected: placeholderChoice.selected,\n", " isDisabled: placeholderChoice.disabled,\n", " placeholder: true\n", " });\n", " }\n", " groups.forEach(function (group) {\n", " return _this21._addGroup({\n", " group: group,\n", " id: group.id || null\n", " });\n", " });\n", " };\n", " _proto._addPredefinedChoices = function _addPredefinedChoices(choices) {\n", " var _this22 = this;\n", " // If sorting is enabled or the user is searching, filter choices\n", " if (this.config.shouldSort) {\n", " choices.sort(this.config.sorter);\n", " }\n", " var hasSelectedChoice = choices.some(function (choice) {\n", " return choice.selected;\n", " });\n", " var firstEnabledChoiceIndex = choices.findIndex(function (choice) {\n", " return choice.disabled === undefined || !choice.disabled;\n", " });\n", " choices.forEach(function (choice, index) {\n", " var value = choice.value, label = choice.label, customProperties = choice.customProperties, placeholder = choice.placeholder;\n", " if (_this22._isSelectElement) {\n", " // If the choice is actually a group\n", " if (choice.choices) {\n", " _this22._addGroup({\n", " group: choice,\n", " id: choice.id || null\n", " });\n", " }\n", " else {\n", " /**\n", " * If there is a selected choice already or the choice is not the first in\n", " * the array, add each choice normally.\n", " *\n", " * Otherwise we pre-select the first enabled choice in the array (\"select-one\" only)\n", " */\n", " var shouldPreselect = _this22._isSelectOneElement && !hasSelectedChoice && index === firstEnabledChoiceIndex;\n", " var isSelected = shouldPreselect ? true : choice.selected;\n", " var isDisabled = choice.disabled;\n", " _this22._addChoice({\n", " value: value,\n", " label: label,\n", " isSelected: isSelected,\n", " isDisabled: isDisabled,\n", " customProperties: customProperties,\n", " placeholder: placeholder\n", " });\n", " }\n", " }\n", " else {\n", " _this22._addChoice({\n", " value: value,\n", " label: label,\n", " isSelected: choice.selected,\n", " isDisabled: choice.disabled,\n", " customProperties: customProperties,\n", " placeholder: placeholder\n", " });\n", " }\n", " });\n", " };\n", " _proto._addPredefinedItems = function _addPredefinedItems(items) {\n", " var _this23 = this;\n", " items.forEach(function (item) {\n", " if (typeof item === 'object' && item.value) {\n", " _this23._addItem({\n", " value: item.value,\n", " label: item.label,\n", " choiceId: item.id,\n", " customProperties: item.customProperties,\n", " placeholder: item.placeholder\n", " });\n", " }\n", " if (typeof item === 'string') {\n", " _this23._addItem({\n", " value: item\n", " });\n", " }\n", " });\n", " };\n", " _proto._setChoiceOrItem = function _setChoiceOrItem(item) {\n", " var _this24 = this;\n", " var itemType = getType(item).toLowerCase();\n", " var handleType = {\n", " object: function object() {\n", " if (!item.value) {\n", " return;\n", " } // If we are dealing with a select input, we need to create an option first\n", " // that is then selected. For text inputs we can just add items normally.\n", " if (!_this24._isTextElement) {\n", " _this24._addChoice({\n", " value: item.value,\n", " label: item.label,\n", " isSelected: true,\n", " isDisabled: false,\n", " customProperties: item.customProperties,\n", " placeholder: item.placeholder\n", " });\n", " }\n", " else {\n", " _this24._addItem({\n", " value: item.value,\n", " label: item.label,\n", " choiceId: item.id,\n", " customProperties: item.customProperties,\n", " placeholder: item.placeholder\n", " });\n", " }\n", " },\n", " string: function string() {\n", " if (!_this24._isTextElement) {\n", " _this24._addChoice({\n", " value: item,\n", " label: item,\n", " isSelected: true,\n", " isDisabled: false\n", " });\n", " }\n", " else {\n", " _this24._addItem({\n", " value: item\n", " });\n", " }\n", " }\n", " };\n", " handleType[itemType]();\n", " };\n", " _proto._findAndSelectChoiceByValue = function _findAndSelectChoiceByValue(val) {\n", " var _this25 = this;\n", " var choices = this._store.choices; // Check 'value' property exists and the choice isn't already selected\n", " var foundChoice = choices.find(function (choice) {\n", " return _this25.config.valueComparer(choice.value, val);\n", " });\n", " if (foundChoice && !foundChoice.selected) {\n", " this._addItem({\n", " value: foundChoice.value,\n", " label: foundChoice.label,\n", " choiceId: foundChoice.id,\n", " groupId: foundChoice.groupId,\n", " customProperties: foundChoice.customProperties,\n", " placeholder: foundChoice.placeholder,\n", " keyCode: foundChoice.keyCode\n", " });\n", " }\n", " };\n", " _proto._generatePlaceholderValue = function _generatePlaceholderValue() {\n", " if (this._isSelectElement) {\n", " var placeholderOption = this.passedElement.placeholderOption;\n", " return placeholderOption ? placeholderOption.text : false;\n", " }\n", " var _this$config4 = this.config, placeholder = _this$config4.placeholder, placeholderValue = _this$config4.placeholderValue;\n", " var dataset = this.passedElement.element.dataset;\n", " if (placeholder) {\n", " if (placeholderValue) {\n", " return placeholderValue;\n", " }\n", " if (dataset.placeholder) {\n", " return dataset.placeholder;\n", " }\n", " }\n", " return false;\n", " };\n", " return Choices;\n", " }();\n", " /* harmony default export */ var scripts_choices = __webpack_exports__[\"default\"] = (choices_Choices);\n", " /***/ \n", " })\n", " /******/ \n", " ])[\"default\"];\n", " });\n", " },\n", " 428: /* styles/widgets/choices.css.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const css = `\n", " .bk-root {\n", " /*===============================\n", " = Choices =\n", " ===============================*/\n", " /*===== End of Choices ======*/\n", " }\n", " .bk-root .choices {\n", " position: relative;\n", " margin-bottom: 24px;\n", " font-size: 16px;\n", " }\n", " .bk-root .choices:focus {\n", " outline: none;\n", " }\n", " .bk-root .choices:last-child {\n", " margin-bottom: 0;\n", " }\n", " .bk-root .choices.is-disabled .choices__inner,\n", " .bk-root .choices.is-disabled .choices__input {\n", " background-color: #eaeaea;\n", " cursor: not-allowed;\n", " -webkit-user-select: none;\n", " -ms-user-select: none;\n", " user-select: none;\n", " }\n", " .bk-root .choices.is-disabled .choices__item {\n", " cursor: not-allowed;\n", " }\n", " .bk-root .choices [hidden] {\n", " display: none !important;\n", " }\n", " .bk-root .choices[data-type*='select-one'] {\n", " cursor: pointer;\n", " }\n", " .bk-root .choices[data-type*='select-one'] .choices__inner {\n", " padding-bottom: 7.5px;\n", " }\n", " .bk-root .choices[data-type*='select-one'] .choices__input {\n", " display: block;\n", " width: 100%;\n", " padding: 10px;\n", " border-bottom: 1px solid #dddddd;\n", " background-color: #ffffff;\n", " margin: 0;\n", " }\n", " .bk-root .choices[data-type*='select-one'] .choices__button {\n", " background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjMDAwIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg==);\n", " padding: 0;\n", " background-size: 8px;\n", " position: absolute;\n", " top: 50%;\n", " right: 0;\n", " margin-top: -10px;\n", " margin-right: 25px;\n", " height: 20px;\n", " width: 20px;\n", " border-radius: 10em;\n", " opacity: 0.5;\n", " }\n", " .bk-root .choices[data-type*='select-one'] .choices__button:hover,\n", " .bk-root .choices[data-type*='select-one'] .choices__button:focus {\n", " opacity: 1;\n", " }\n", " .bk-root .choices[data-type*='select-one'] .choices__button:focus {\n", " box-shadow: 0px 0px 0px 2px #00bcd4;\n", " }\n", " .bk-root .choices[data-type*='select-one'] .choices__item[data-value=''] .choices__button {\n", " display: none;\n", " }\n", " .bk-root .choices[data-type*='select-one']:after {\n", " content: '';\n", " height: 0;\n", " width: 0;\n", " border-style: solid;\n", " border-color: #333333 transparent transparent transparent;\n", " border-width: 5px;\n", " position: absolute;\n", " right: 11.5px;\n", " top: 50%;\n", " margin-top: -2.5px;\n", " pointer-events: none;\n", " }\n", " .bk-root .choices[data-type*='select-one'].is-open:after {\n", " border-color: transparent transparent #333333 transparent;\n", " margin-top: -7.5px;\n", " }\n", " .bk-root .choices[data-type*='select-one'][dir='rtl']:after {\n", " left: 11.5px;\n", " right: auto;\n", " }\n", " .bk-root .choices[data-type*='select-one'][dir='rtl'] .choices__button {\n", " right: auto;\n", " left: 0;\n", " margin-left: 25px;\n", " margin-right: 0;\n", " }\n", " .bk-root .choices[data-type*='select-multiple'] .choices__inner,\n", " .bk-root .choices[data-type*='text'] .choices__inner {\n", " cursor: text;\n", " }\n", " .bk-root .choices[data-type*='select-multiple'] .choices__button,\n", " .bk-root .choices[data-type*='text'] .choices__button {\n", " position: relative;\n", " display: inline-block;\n", " margin-top: 0;\n", " margin-right: -4px;\n", " margin-bottom: 0;\n", " margin-left: 8px;\n", " padding-left: 16px;\n", " border-left: 1px solid #008fa1;\n", " background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjRkZGIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg==);\n", " background-size: 8px;\n", " width: 8px;\n", " line-height: 1;\n", " opacity: 0.75;\n", " border-radius: 0;\n", " }\n", " .bk-root .choices[data-type*='select-multiple'] .choices__button:hover,\n", " .bk-root .choices[data-type*='select-multiple'] .choices__button:focus,\n", " .bk-root .choices[data-type*='text'] .choices__button:hover,\n", " .bk-root .choices[data-type*='text'] .choices__button:focus {\n", " opacity: 1;\n", " }\n", " .bk-root .choices__inner {\n", " display: inline-block;\n", " vertical-align: top;\n", " width: 100%;\n", " background-color: #f9f9f9;\n", " padding: 7.5px 7.5px 3.75px;\n", " border: 1px solid #dddddd;\n", " border-radius: 2.5px;\n", " font-size: 14px;\n", " min-height: 44px;\n", " overflow: hidden;\n", " }\n", " .bk-root .is-focused .choices__inner,\n", " .bk-root .is-open .choices__inner {\n", " border-color: #b7b7b7;\n", " }\n", " .bk-root .is-open .choices__inner {\n", " border-radius: 2.5px 2.5px 0 0;\n", " }\n", " .bk-root .is-flipped.is-open .choices__inner {\n", " border-radius: 0 0 2.5px 2.5px;\n", " }\n", " .bk-root .choices__list {\n", " margin: 0;\n", " padding-left: 0;\n", " list-style: none;\n", " }\n", " .bk-root .choices__list--single {\n", " display: inline-block;\n", " padding: 4px 16px 4px 4px;\n", " width: 100%;\n", " }\n", " .bk-root [dir='rtl'] .choices__list--single {\n", " padding-right: 4px;\n", " padding-left: 16px;\n", " }\n", " .bk-root .choices__list--single .choices__item {\n", " width: 100%;\n", " }\n", " .bk-root .choices__list--multiple {\n", " display: inline;\n", " }\n", " .bk-root .choices__list--multiple .choices__item {\n", " display: inline-block;\n", " vertical-align: middle;\n", " border-radius: 20px;\n", " padding: 4px 10px;\n", " font-size: 12px;\n", " font-weight: 500;\n", " margin-right: 3.75px;\n", " margin-bottom: 3.75px;\n", " background-color: #00bcd4;\n", " border: 1px solid #00a5bb;\n", " color: #ffffff;\n", " word-break: break-all;\n", " box-sizing: border-box;\n", " }\n", " .bk-root .choices__list--multiple .choices__item[data-deletable] {\n", " padding-right: 5px;\n", " }\n", " .bk-root [dir='rtl'] .choices__list--multiple .choices__item {\n", " margin-right: 0;\n", " margin-left: 3.75px;\n", " }\n", " .bk-root .choices__list--multiple .choices__item.is-highlighted {\n", " background-color: #00a5bb;\n", " border: 1px solid #008fa1;\n", " }\n", " .bk-root .is-disabled .choices__list--multiple .choices__item {\n", " background-color: #aaaaaa;\n", " border: 1px solid #919191;\n", " }\n", " .bk-root .choices__list--dropdown {\n", " visibility: hidden;\n", " z-index: 1;\n", " position: absolute;\n", " width: 100%;\n", " background-color: #ffffff;\n", " border: 1px solid #dddddd;\n", " top: 100%;\n", " margin-top: -1px;\n", " border-bottom-left-radius: 2.5px;\n", " border-bottom-right-radius: 2.5px;\n", " overflow: hidden;\n", " word-break: break-all;\n", " will-change: visibility;\n", " }\n", " .bk-root .choices__list--dropdown.is-active {\n", " visibility: visible;\n", " }\n", " .bk-root .is-open .choices__list--dropdown {\n", " border-color: #b7b7b7;\n", " }\n", " .bk-root .is-flipped .choices__list--dropdown {\n", " top: auto;\n", " bottom: 100%;\n", " margin-top: 0;\n", " margin-bottom: -1px;\n", " border-radius: 0.25rem 0.25rem 0 0;\n", " }\n", " .bk-root .choices__list--dropdown .choices__list {\n", " position: relative;\n", " max-height: 300px;\n", " overflow: auto;\n", " -webkit-overflow-scrolling: touch;\n", " will-change: scroll-position;\n", " }\n", " .bk-root .choices__list--dropdown .choices__item {\n", " position: relative;\n", " padding: 10px;\n", " font-size: 14px;\n", " }\n", " .bk-root [dir='rtl'] .choices__list--dropdown .choices__item {\n", " text-align: right;\n", " }\n", " @media (min-width: 640px) {\n", " .bk-root .choices__list--dropdown .choices__item--selectable {\n", " padding-right: 100px;\n", " }\n", " .bk-root .choices__list--dropdown .choices__item--selectable:after {\n", " content: attr(data-select-text);\n", " font-size: 12px;\n", " opacity: 0;\n", " position: absolute;\n", " right: 10px;\n", " top: 50%;\n", " transform: translateY(-50%);\n", " }\n", " .bk-root [dir='rtl'] .choices__list--dropdown .choices__item--selectable {\n", " text-align: right;\n", " padding-left: 100px;\n", " padding-right: 10px;\n", " }\n", " .bk-root [dir='rtl'] .choices__list--dropdown .choices__item--selectable:after {\n", " right: auto;\n", " left: 10px;\n", " }\n", " }\n", " .bk-root .choices__list--dropdown .choices__item--selectable.is-highlighted {\n", " background-color: #f2f2f2;\n", " }\n", " .bk-root .choices__list--dropdown .choices__item--selectable.is-highlighted:after {\n", " opacity: 0.5;\n", " }\n", " .bk-root .choices__item {\n", " cursor: default;\n", " }\n", " .bk-root .choices__item--selectable {\n", " cursor: pointer;\n", " }\n", " .bk-root .choices__item--disabled {\n", " cursor: not-allowed;\n", " -webkit-user-select: none;\n", " -ms-user-select: none;\n", " user-select: none;\n", " opacity: 0.5;\n", " }\n", " .bk-root .choices__heading {\n", " font-weight: 600;\n", " font-size: 12px;\n", " padding: 10px;\n", " border-bottom: 1px solid #f7f7f7;\n", " color: gray;\n", " }\n", " .bk-root .choices__button {\n", " text-indent: -9999px;\n", " -webkit-appearance: none;\n", " -moz-appearance: none;\n", " appearance: none;\n", " border: 0;\n", " background-color: transparent;\n", " background-repeat: no-repeat;\n", " background-position: center;\n", " cursor: pointer;\n", " }\n", " .bk-root .choices__button:focus {\n", " outline: none;\n", " }\n", " .bk-root .choices__input {\n", " display: inline-block;\n", " vertical-align: baseline;\n", " background-color: #f9f9f9;\n", " font-size: 14px;\n", " margin-bottom: 5px;\n", " border: 0;\n", " border-radius: 0;\n", " max-width: 100%;\n", " padding: 4px 0 4px 2px;\n", " }\n", " .bk-root .choices__input:focus {\n", " outline: 0;\n", " }\n", " .bk-root [dir='rtl'] .choices__input {\n", " padding-right: 2px;\n", " padding-left: 0;\n", " }\n", " .bk-root .choices__placeholder {\n", " opacity: 0.5;\n", " }\n", " .bk-root .choices {\n", " width: 100%;\n", " }\n", " .bk-root .choices__inner .choices__item.light {\n", " background-color: rgba(0, 126, 255, 0.08);\n", " border-radius: 5px;\n", " border: 1px solid rgba(0, 126, 255, 0.24);\n", " color: #007eff;\n", " }\n", " .bk-root .choices__inner .choices__item.solid {\n", " background-color: #1f77b4;\n", " border: none;\n", " border-radius: 5px;\n", " color: white;\n", " }\n", " .bk-root .choices__inner .choices__item.solid .is-highlighted {\n", " background-color: #1f77b4;\n", " border: none;\n", " }\n", " .bk-root .choices__input {\n", " background-color: transparent;\n", " }\n", " .bk-root .choices__inner {\n", " background: transparent;\n", " border: 1px solid darkgray;\n", " border-radius: 5px;\n", " min-height: unset;\n", " }\n", " .bk-root .choices__list {\n", " white-space: initial;\n", " }\n", " .bk-root .choices[data-type*=select-multiple] .choices__button.light {\n", " background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjMDA3ZWZmIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg==);\n", " }\n", " .bk-root .choices[data-type*=select-multiple] .choices__button.solid {\n", " background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjZmZmZmZmIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg==);\n", " border-left: 1px solid white;\n", " opacity: 1;\n", " }\n", " `;\n", " exports.default = css;\n", " },\n", " 429: /* models/widgets/pretext.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const markup_1 = require(418) /* ./markup */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " class PreTextView extends markup_1.MarkupView {\n", " render() {\n", " super.render();\n", " const content = dom_1.pre({ style: { overflow: \"auto\" } }, this.model.text);\n", " this.markup_el.appendChild(content);\n", " }\n", " }\n", " exports.PreTextView = PreTextView;\n", " PreTextView.__name__ = \"PreTextView\";\n", " class PreText extends markup_1.Markup {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_PreText() {\n", " this.prototype.default_view = PreTextView;\n", " }\n", " }\n", " exports.PreText = PreText;\n", " PreText.__name__ = \"PreText\";\n", " PreText.init_PreText();\n", " },\n", " 430: /* models/widgets/radio_button_group.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const button_group_1 = require(403) /* ./button_group */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const mixins_1 = require(146) /* ../../styles/mixins */;\n", " class RadioButtonGroupView extends button_group_1.ButtonGroupView {\n", " change_active(i) {\n", " if (this.model.active !== i) {\n", " this.model.active = i;\n", " }\n", " }\n", " _update_active() {\n", " const { active } = this.model;\n", " this._buttons.forEach((button, i) => {\n", " dom_1.classes(button).toggle(mixins_1.bk_active, active === i);\n", " });\n", " }\n", " }\n", " exports.RadioButtonGroupView = RadioButtonGroupView;\n", " RadioButtonGroupView.__name__ = \"RadioButtonGroupView\";\n", " class RadioButtonGroup extends button_group_1.ButtonGroup {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_RadioButtonGroup() {\n", " this.prototype.default_view = RadioButtonGroupView;\n", " this.define({\n", " active: [p.Any, null],\n", " });\n", " }\n", " }\n", " exports.RadioButtonGroup = RadioButtonGroup;\n", " RadioButtonGroup.__name__ = \"RadioButtonGroup\";\n", " RadioButtonGroup.init_RadioButtonGroup();\n", " },\n", " 431: /* models/widgets/radio_group.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const string_1 = require(24) /* ../../core/util/string */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const input_group_1 = require(405) /* ./input_group */;\n", " const mixins_1 = require(146) /* ../../styles/mixins */;\n", " const inputs_1 = require(400) /* ../../styles/widgets/inputs */;\n", " class RadioGroupView extends input_group_1.InputGroupView {\n", " render() {\n", " super.render();\n", " const group = dom_1.div({ class: [inputs_1.bk_input_group, this.model.inline ? mixins_1.bk_inline : null] });\n", " this.el.appendChild(group);\n", " const name = string_1.uniqueId();\n", " const { active, labels } = this.model;\n", " this._inputs = [];\n", " for (let i = 0; i < labels.length; i++) {\n", " const radio = dom_1.input({ type: `radio`, name, value: `${i}` });\n", " radio.addEventListener(\"change\", () => this.change_active(i));\n", " this._inputs.push(radio);\n", " if (this.model.disabled)\n", " radio.disabled = true;\n", " if (i == active)\n", " radio.checked = true;\n", " const label_el = dom_1.label({}, radio, dom_1.span({}, labels[i]));\n", " group.appendChild(label_el);\n", " }\n", " }\n", " change_active(i) {\n", " this.model.active = i;\n", " }\n", " }\n", " exports.RadioGroupView = RadioGroupView;\n", " RadioGroupView.__name__ = \"RadioGroupView\";\n", " class RadioGroup extends input_group_1.InputGroup {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_RadioGroup() {\n", " this.prototype.default_view = RadioGroupView;\n", " this.define({\n", " active: [p.Number],\n", " labels: [p.Array, []],\n", " inline: [p.Boolean, false],\n", " });\n", " }\n", " }\n", " exports.RadioGroup = RadioGroup;\n", " RadioGroup.__name__ = \"RadioGroup\";\n", " RadioGroup.init_RadioGroup();\n", " },\n", " 432: /* models/widgets/range_slider.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const numbro = tslib_1.__importStar(require(161) /* @bokeh/numbro */);\n", " const abstract_slider_1 = require(411) /* ./abstract_slider */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " class RangeSliderView extends abstract_slider_1.AbstractRangeSliderView {\n", " }\n", " exports.RangeSliderView = RangeSliderView;\n", " RangeSliderView.__name__ = \"RangeSliderView\";\n", " class RangeSlider extends abstract_slider_1.AbstractSlider {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.behaviour = \"drag\";\n", " this.connected = [false, true, false];\n", " }\n", " static init_RangeSlider() {\n", " this.prototype.default_view = RangeSliderView;\n", " this.override({\n", " format: \"0[.]00\",\n", " });\n", " }\n", " _formatter(value, format) {\n", " if (types_1.isString(format)) {\n", " return numbro.format(value, format);\n", " }\n", " else {\n", " return format.doFormat([value], { loc: 0 })[0];\n", " }\n", " }\n", " }\n", " exports.RangeSlider = RangeSlider;\n", " RangeSlider.__name__ = \"RangeSlider\";\n", " RangeSlider.init_RangeSlider();\n", " },\n", " 433: /* models/widgets/selectbox.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const object_1 = require(17) /* ../../core/util/object */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const input_widget_1 = require(398) /* ./input_widget */;\n", " const inputs_1 = require(400) /* ../../styles/widgets/inputs */;\n", " class SelectView extends input_widget_1.InputWidgetView {\n", " connect_signals() {\n", " super.connect_signals();\n", " const { value, options } = this.model.properties;\n", " this.on_change(value, () => {\n", " this._update_value();\n", " });\n", " this.on_change(options, () => {\n", " dom_1.empty(this.input_el);\n", " dom_1.append(this.input_el, ...this.options_el());\n", " });\n", " }\n", " options_el() {\n", " function build_options(values) {\n", " return values.map((el) => {\n", " let value, label;\n", " if (types_1.isString(el))\n", " value = label = el;\n", " else\n", " [value, label] = el;\n", " return dom_1.option({ value }, label);\n", " });\n", " }\n", " const { options } = this.model;\n", " if (types_1.isArray(options))\n", " return build_options(options);\n", " else\n", " return object_1.entries(options).map(([label, values]) => dom_1.optgroup({ label }, build_options(values)));\n", " }\n", " render() {\n", " super.render();\n", " this.input_el = dom_1.select({\n", " class: inputs_1.bk_input,\n", " name: this.model.name,\n", " disabled: this.model.disabled,\n", " }, this.options_el());\n", " this._update_value();\n", " this.input_el.addEventListener(\"change\", () => this.change_input());\n", " this.group_el.appendChild(this.input_el);\n", " }\n", " change_input() {\n", " const value = this.input_el.value;\n", " this.model.value = value;\n", " super.change_input();\n", " }\n", " _update_value() {\n", " const { value } = this.model;\n", " if (value != null && value.length != 0) {\n", " this.input_el.value = this.model.value;\n", " }\n", " }\n", " }\n", " exports.SelectView = SelectView;\n", " SelectView.__name__ = \"SelectView\";\n", " class Select extends input_widget_1.InputWidget {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Select() {\n", " this.prototype.default_view = SelectView;\n", " this.define({\n", " value: [p.String, ''],\n", " options: [p.Any, []],\n", " });\n", " }\n", " }\n", " exports.Select = Select;\n", " Select.__name__ = \"Select\";\n", " Select.init_Select();\n", " },\n", " 434: /* models/widgets/slider.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const numbro = tslib_1.__importStar(require(161) /* @bokeh/numbro */);\n", " const abstract_slider_1 = require(411) /* ./abstract_slider */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " class SliderView extends abstract_slider_1.AbstractSliderView {\n", " }\n", " exports.SliderView = SliderView;\n", " SliderView.__name__ = \"SliderView\";\n", " class Slider extends abstract_slider_1.AbstractSlider {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.behaviour = \"tap\";\n", " this.connected = [true, false];\n", " }\n", " static init_Slider() {\n", " this.prototype.default_view = SliderView;\n", " this.override({\n", " format: \"0[.]00\",\n", " });\n", " }\n", " _formatter(value, format) {\n", " if (types_1.isString(format)) {\n", " return numbro.format(value, format);\n", " }\n", " else {\n", " return format.doFormat([value], { loc: 0 })[0];\n", " }\n", " }\n", " }\n", " exports.Slider = Slider;\n", " Slider.__name__ = \"Slider\";\n", " Slider.init_Slider();\n", " },\n", " 435: /* models/widgets/spinner.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const input_widget_1 = require(398) /* ./input_widget */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const inputs_1 = require(400) /* ../../styles/widgets/inputs */;\n", " const { floor, max, min } = Math;\n", " function _get_sig_dig(num) {\n", " if (floor(num) !== num)\n", " return num.toFixed(16).replace(/0+$/, '').split(\".\")[1].length;\n", " return 0;\n", " }\n", " class SpinnerView extends input_widget_1.InputWidgetView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.low.change, () => {\n", " const { low } = this.model;\n", " if (low != null)\n", " this.input_el.min = low.toFixed(16);\n", " });\n", " this.connect(this.model.properties.high.change, () => {\n", " const { high } = this.model;\n", " if (high != null)\n", " this.input_el.max = high.toFixed(16);\n", " });\n", " this.connect(this.model.properties.step.change, () => {\n", " const { step } = this.model;\n", " this.input_el.step = step.toFixed(16);\n", " });\n", " this.connect(this.model.properties.value.change, () => {\n", " const { value, step } = this.model;\n", " this.input_el.value = value.toFixed(_get_sig_dig(step)).replace(/(\\.[0-9]*[1-9])0+$|\\.0*$/, '$1'); //trim last 0\n", " });\n", " this.connect(this.model.properties.disabled.change, () => {\n", " this.input_el.disabled = this.model.disabled;\n", " });\n", " }\n", " render() {\n", " super.render();\n", " this.input_el = dom_1.input({\n", " type: \"number\",\n", " class: inputs_1.bk_input,\n", " name: this.model.name,\n", " min: this.model.low,\n", " max: this.model.high,\n", " value: this.model.value,\n", " step: this.model.step,\n", " disabled: this.model.disabled,\n", " });\n", " this.input_el.addEventListener(\"change\", () => this.change_input());\n", " //this.input_el.addEventListener(\"input\", () => this.change_input())\n", " this.group_el.appendChild(this.input_el);\n", " }\n", " change_input() {\n", " if (this.input_el.value) { //if input is empty skip update\n", " const { step } = this.model;\n", " let new_value = Number(this.input_el.value);\n", " if (this.model.low != null)\n", " new_value = max(new_value, this.model.low);\n", " if (this.model.high != null)\n", " new_value = min(new_value, this.model.high);\n", " this.model.value = Number(new_value.toFixed(_get_sig_dig(step)));\n", " super.change_input();\n", " }\n", " }\n", " }\n", " exports.SpinnerView = SpinnerView;\n", " SpinnerView.__name__ = \"SpinnerView\";\n", " class Spinner extends input_widget_1.InputWidget {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Spinner() {\n", " this.prototype.default_view = SpinnerView;\n", " this.define({\n", " value: [p.Number, 0],\n", " low: [p.Number, null],\n", " high: [p.Number, null],\n", " step: [p.Number, 1],\n", " });\n", " }\n", " }\n", " exports.Spinner = Spinner;\n", " Spinner.__name__ = \"Spinner\";\n", " Spinner.init_Spinner();\n", " },\n", " 436: /* models/widgets/textarea_input.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const input_widget_1 = require(398) /* ./input_widget */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const inputs_1 = require(400) /* ../../styles/widgets/inputs */;\n", " class TextAreaInputView extends input_widget_1.InputWidgetView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.name.change, () => this.input_el.name = this.model.name || \"\");\n", " this.connect(this.model.properties.value.change, () => this.input_el.value = this.model.value);\n", " this.connect(this.model.properties.disabled.change, () => this.input_el.disabled = this.model.disabled);\n", " this.connect(this.model.properties.placeholder.change, () => this.input_el.placeholder = this.model.placeholder);\n", " this.connect(this.model.properties.rows.change, () => this.input_el.rows = this.model.rows);\n", " this.connect(this.model.properties.cols.change, () => this.input_el.cols = this.model.cols);\n", " this.connect(this.model.properties.max_length.change, () => this.input_el.maxLength = this.model.max_length);\n", " }\n", " render() {\n", " super.render();\n", " this.input_el = dom_1.textarea({\n", " class: inputs_1.bk_input,\n", " name: this.model.name,\n", " disabled: this.model.disabled,\n", " placeholder: this.model.placeholder,\n", " cols: this.model.cols,\n", " rows: this.model.rows,\n", " maxLength: this.model.max_length,\n", " });\n", " this.input_el.textContent = this.model.value;\n", " this.input_el.addEventListener(\"change\", () => this.change_input());\n", " this.group_el.appendChild(this.input_el);\n", " }\n", " change_input() {\n", " this.model.value = this.input_el.value;\n", " super.change_input();\n", " }\n", " }\n", " exports.TextAreaInputView = TextAreaInputView;\n", " TextAreaInputView.__name__ = \"TextAreaInputView\";\n", " class TextAreaInput extends input_widget_1.InputWidget {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_TextAreaInput() {\n", " this.prototype.default_view = TextAreaInputView;\n", " this.define({\n", " value: [p.String, \"\"],\n", " value_input: [p.String, \"\"],\n", " placeholder: [p.String, \"\"],\n", " cols: [p.Number, 20],\n", " rows: [p.Number, 2],\n", " max_length: [p.Number, 500],\n", " });\n", " }\n", " }\n", " exports.TextAreaInput = TextAreaInput;\n", " TextAreaInput.__name__ = \"TextAreaInput\";\n", " TextAreaInput.init_TextAreaInput();\n", " },\n", " 437: /* models/widgets/toggle.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const abstract_button_1 = require(392) /* ./abstract_button */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const mixins_1 = require(146) /* ../../styles/mixins */;\n", " class ToggleView extends abstract_button_1.AbstractButtonView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.active.change, () => this._update_active());\n", " }\n", " render() {\n", " super.render();\n", " this._update_active();\n", " }\n", " click() {\n", " this.model.active = !this.model.active;\n", " super.click();\n", " }\n", " _update_active() {\n", " dom_1.classes(this.button_el).toggle(mixins_1.bk_active, this.model.active);\n", " }\n", " }\n", " exports.ToggleView = ToggleView;\n", " ToggleView.__name__ = \"ToggleView\";\n", " class Toggle extends abstract_button_1.AbstractButton {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Toggle() {\n", " this.prototype.default_view = ToggleView;\n", " this.define({\n", " active: [p.Boolean, false],\n", " });\n", " this.override({\n", " label: \"Toggle\",\n", " });\n", " }\n", " }\n", " exports.Toggle = Toggle;\n", " Toggle.__name__ = \"Toggle\";\n", " Toggle.init_Toggle();\n", " },\n", " }, 390, {\"models/widgets/main\":390,\"models/widgets/index\":391,\"models/widgets/abstract_button\":392,\"models/widgets/control\":393,\"models/widgets/widget\":458,\"models/widgets/abstract_icon\":395,\"models/widgets/autocomplete_input\":396,\"models/widgets/text_input\":397,\"models/widgets/input_widget\":398,\"styles/widgets/inputs.css\":399,\"styles/widgets/inputs\":400,\"models/widgets/button\":401,\"models/widgets/checkbox_button_group\":402,\"models/widgets/button_group\":403,\"models/widgets/checkbox_group\":404,\"models/widgets/input_group\":405,\"models/widgets/color_picker\":406,\"models/widgets/date_picker\":407,\"styles/widgets/flatpickr.css\":409,\"models/widgets/date_range_slider\":410,\"models/widgets/abstract_slider\":411,\"styles/widgets/sliders\":413,\"styles/widgets/nouislider.css\":414,\"styles/widgets/sliders.css\":415,\"models/widgets/date_slider\":416,\"models/widgets/div\":417,\"models/widgets/markup\":418,\"styles/clearfix\":419,\"styles/clearfix.css\":420,\"models/widgets/dropdown\":421,\"models/widgets/file_input\":422,\"models/widgets/multiselect\":423,\"models/widgets/paragraph\":424,\"models/widgets/password_input\":425,\"models/widgets/multichoice\":426,\"styles/widgets/choices.css\":428,\"models/widgets/pretext\":429,\"models/widgets/radio_button_group\":430,\"models/widgets/radio_group\":431,\"models/widgets/range_slider\":432,\"models/widgets/selectbox\":433,\"models/widgets/slider\":434,\"models/widgets/spinner\":435,\"models/widgets/textarea_input\":436,\"models/widgets/toggle\":437}, {});\n", " })\n", "\n", " //# sourceMappingURL=bokeh-widgets.js.map\n", "\n", " /* END bokeh-widgets.js */\n", " },\n", " \n", " function(Bokeh) {\n", " /* BEGIN bokeh-tables.js */\n", " /*!\n", " * Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors\n", " * All rights reserved.\n", " * \n", " * Redistribution and use in source and binary forms, with or without modification,\n", " * are permitted provided that the following conditions are met:\n", " * \n", " * Redistributions of source code must retain the above copyright notice,\n", " * this list of conditions and the following disclaimer.\n", " * \n", " * Redistributions in binary form must reproduce the above copyright notice,\n", " * this list of conditions and the following disclaimer in the documentation\n", " * and/or other materials provided with the distribution.\n", " * \n", " * Neither the name of Anaconda nor the names of any contributors\n", " * may be used to endorse or promote products derived from this software\n", " * without specific prior written permission.\n", " * \n", " * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n", " * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n", " * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n", " * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n", " * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n", " * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n", " * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n", " * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n", " * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n", " * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n", " * THE POSSIBILITY OF SUCH DAMAGE.\n", " */\n", " (function(root, factory) {\n", " factory(root[\"Bokeh\"], \"2.1.1\");\n", " })(this, function(Bokeh, version) {\n", " var define;\n", " return (function(modules, entry, aliases, externals) {\n", " const bokeh = typeof Bokeh !== \"undefined\" && (version != null ? Bokeh[version] : Bokeh);\n", " if (bokeh != null) {\n", " return bokeh.register_plugin(modules, entry, aliases);\n", " } else {\n", " throw new Error(\"Cannot find Bokeh \" + version + \". You have to load it prior to loading plugins.\");\n", " }\n", " })\n", " ({\n", " 438: /* models/widgets/tables/main.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const Tables = tslib_1.__importStar(require(439) /* ./index */);\n", " exports.Tables = Tables;\n", " const base_1 = require(7) /* ../../../base */;\n", " base_1.register_models(Tables);\n", " },\n", " 439: /* models/widgets/tables/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " tslib_1.__exportStar(require(440) /* ./cell_editors */, exports);\n", " tslib_1.__exportStar(require(462) /* ./cell_formatters */, exports);\n", " var data_table_1 = require(441) /* ./data_table */;\n", " exports.DataTable = data_table_1.DataTable;\n", " var table_column_1 = require(465) /* ./table_column */;\n", " exports.TableColumn = table_column_1.TableColumn;\n", " var table_widget_1 = require(457) /* ./table_widget */;\n", " exports.TableWidget = table_widget_1.TableWidget;\n", " var row_aggregators_1 = require(466) /* ./row_aggregators */;\n", " exports.AvgAggregator = row_aggregators_1.AvgAggregator;\n", " exports.MinAggregator = row_aggregators_1.MinAggregator;\n", " exports.MaxAggregator = row_aggregators_1.MaxAggregator;\n", " exports.SumAggregator = row_aggregators_1.SumAggregator;\n", " var data_cube_1 = require(467) /* ./data_cube */;\n", " exports.GroupingInfo = data_cube_1.GroupingInfo;\n", " exports.DataCube = data_cube_1.DataCube;\n", " },\n", " 440: /* models/widgets/tables/cell_editors.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const dom_1 = require(68) /* ../../../core/dom */;\n", " const dom_view_1 = require(66) /* ../../../core/dom_view */;\n", " const model_1 = require(71) /* ../../../model */;\n", " const data_table_1 = require(441) /* ./data_table */;\n", " const tables_1 = require(459) /* ../../../styles/widgets/tables */;\n", " class CellEditorView extends dom_view_1.DOMView {\n", " constructor(options) {\n", " const { model, parent } = options.column;\n", " super(Object.assign({ model, parent }, options));\n", " this.args = options;\n", " this.initialize(); // XXX: no build_views()\n", " this.render(); // XXX: this isn't governed by layout\n", " }\n", " get emptyValue() {\n", " return null;\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.inputEl = this._createInput();\n", " this.defaultValue = null;\n", " }\n", " async lazy_initialize() {\n", " throw new Error(\"unsupported\");\n", " }\n", " css_classes() {\n", " return super.css_classes().concat(tables_1.bk_cell_editor);\n", " }\n", " render() {\n", " super.render();\n", " this.args.container.append(this.el);\n", " this.el.appendChild(this.inputEl);\n", " this.renderEditor();\n", " this.disableNavigation();\n", " }\n", " renderEditor() { }\n", " disableNavigation() {\n", " this.inputEl.addEventListener(\"keydown\", (event) => {\n", " switch (event.keyCode) {\n", " case dom_1.Keys.Left:\n", " case dom_1.Keys.Right:\n", " case dom_1.Keys.Up:\n", " case dom_1.Keys.Down:\n", " case dom_1.Keys.PageUp:\n", " case dom_1.Keys.PageDown:\n", " event.stopImmediatePropagation();\n", " }\n", " });\n", " }\n", " destroy() {\n", " this.remove();\n", " }\n", " focus() {\n", " this.inputEl.focus();\n", " }\n", " show() { }\n", " hide() { }\n", " position() { }\n", " getValue() {\n", " return this.inputEl.value;\n", " }\n", " setValue(val) {\n", " this.inputEl.value = val;\n", " }\n", " serializeValue() {\n", " return this.getValue();\n", " }\n", " isValueChanged() {\n", " return !(this.getValue() == \"\" && this.defaultValue == null) && this.getValue() !== this.defaultValue;\n", " }\n", " applyValue(item, state) {\n", " const grid_data = this.args.grid.getData();\n", " const offset = grid_data.index.indexOf(item[data_table_1.DTINDEX_NAME]);\n", " grid_data.setField(offset, this.args.column.field, state);\n", " }\n", " loadValue(item) {\n", " const value = item[this.args.column.field];\n", " this.defaultValue = value != null ? value : this.emptyValue;\n", " this.setValue(this.defaultValue);\n", " }\n", " validateValue(value) {\n", " if (this.args.column.validator) {\n", " const result = this.args.column.validator(value);\n", " if (!result.valid) {\n", " return result;\n", " }\n", " }\n", " return { valid: true, msg: null };\n", " }\n", " validate() {\n", " return this.validateValue(this.getValue());\n", " }\n", " }\n", " exports.CellEditorView = CellEditorView;\n", " CellEditorView.__name__ = \"CellEditorView\";\n", " class CellEditor extends model_1.Model {\n", " }\n", " exports.CellEditor = CellEditor;\n", " CellEditor.__name__ = \"CellEditor\";\n", " class StringEditorView extends CellEditorView {\n", " get emptyValue() {\n", " return \"\";\n", " }\n", " _createInput() {\n", " return dom_1.input({ type: \"text\" });\n", " }\n", " renderEditor() {\n", " //completions = @model.completions\n", " //if completions.length != 0\n", " // @inputEl.classList.add(\"bk-cell-editor-completion\")\n", " // $(@inputEl).autocomplete({source: completions})\n", " // $(@inputEl).autocomplete(\"widget\")\n", " this.inputEl.focus();\n", " this.inputEl.select();\n", " }\n", " loadValue(item) {\n", " super.loadValue(item);\n", " this.inputEl.defaultValue = this.defaultValue;\n", " this.inputEl.select();\n", " }\n", " }\n", " exports.StringEditorView = StringEditorView;\n", " StringEditorView.__name__ = \"StringEditorView\";\n", " class StringEditor extends CellEditor {\n", " static init_StringEditor() {\n", " this.prototype.default_view = StringEditorView;\n", " this.define({\n", " completions: [p.Array, []],\n", " });\n", " }\n", " }\n", " exports.StringEditor = StringEditor;\n", " StringEditor.__name__ = \"StringEditor\";\n", " StringEditor.init_StringEditor();\n", " class TextEditorView extends CellEditorView {\n", " _createInput() {\n", " return dom_1.textarea();\n", " }\n", " }\n", " exports.TextEditorView = TextEditorView;\n", " TextEditorView.__name__ = \"TextEditorView\";\n", " class TextEditor extends CellEditor {\n", " static init_TextEditor() {\n", " this.prototype.default_view = TextEditorView;\n", " }\n", " }\n", " exports.TextEditor = TextEditor;\n", " TextEditor.__name__ = \"TextEditor\";\n", " TextEditor.init_TextEditor();\n", " class SelectEditorView extends CellEditorView {\n", " _createInput() {\n", " return dom_1.select();\n", " }\n", " renderEditor() {\n", " for (const opt of this.model.options) {\n", " this.inputEl.appendChild(dom_1.option({ value: opt }, opt));\n", " }\n", " this.focus();\n", " }\n", " }\n", " exports.SelectEditorView = SelectEditorView;\n", " SelectEditorView.__name__ = \"SelectEditorView\";\n", " class SelectEditor extends CellEditor {\n", " static init_SelectEditor() {\n", " this.prototype.default_view = SelectEditorView;\n", " this.define({\n", " options: [p.Array, []],\n", " });\n", " }\n", " }\n", " exports.SelectEditor = SelectEditor;\n", " SelectEditor.__name__ = \"SelectEditor\";\n", " SelectEditor.init_SelectEditor();\n", " class PercentEditorView extends CellEditorView {\n", " _createInput() {\n", " return dom_1.input({ type: \"text\" });\n", " }\n", " }\n", " exports.PercentEditorView = PercentEditorView;\n", " PercentEditorView.__name__ = \"PercentEditorView\";\n", " class PercentEditor extends CellEditor {\n", " static init_PercentEditor() {\n", " this.prototype.default_view = PercentEditorView;\n", " }\n", " }\n", " exports.PercentEditor = PercentEditor;\n", " PercentEditor.__name__ = \"PercentEditor\";\n", " PercentEditor.init_PercentEditor();\n", " class CheckboxEditorView extends CellEditorView {\n", " _createInput() {\n", " return dom_1.input({ type: \"checkbox\", value: \"true\" });\n", " }\n", " renderEditor() {\n", " this.focus();\n", " }\n", " loadValue(item) {\n", " this.defaultValue = !!item[this.args.column.field];\n", " this.inputEl.checked = this.defaultValue;\n", " }\n", " serializeValue() {\n", " return this.inputEl.checked;\n", " }\n", " }\n", " exports.CheckboxEditorView = CheckboxEditorView;\n", " CheckboxEditorView.__name__ = \"CheckboxEditorView\";\n", " class CheckboxEditor extends CellEditor {\n", " static init_CheckboxEditor() {\n", " this.prototype.default_view = CheckboxEditorView;\n", " }\n", " }\n", " exports.CheckboxEditor = CheckboxEditor;\n", " CheckboxEditor.__name__ = \"CheckboxEditor\";\n", " CheckboxEditor.init_CheckboxEditor();\n", " class IntEditorView extends CellEditorView {\n", " _createInput() {\n", " return dom_1.input({ type: \"text\" });\n", " }\n", " renderEditor() {\n", " //$(@inputEl).spinner({step: @model.step})\n", " this.inputEl.focus();\n", " this.inputEl.select();\n", " }\n", " remove() {\n", " //$(@inputEl).spinner(\"destroy\")\n", " super.remove();\n", " }\n", " serializeValue() {\n", " return parseInt(this.getValue(), 10) || 0;\n", " }\n", " loadValue(item) {\n", " super.loadValue(item);\n", " this.inputEl.defaultValue = this.defaultValue;\n", " this.inputEl.select();\n", " }\n", " validateValue(value) {\n", " if (isNaN(value))\n", " return { valid: false, msg: \"Please enter a valid integer\" };\n", " else\n", " return super.validateValue(value);\n", " }\n", " }\n", " exports.IntEditorView = IntEditorView;\n", " IntEditorView.__name__ = \"IntEditorView\";\n", " class IntEditor extends CellEditor {\n", " static init_IntEditor() {\n", " this.prototype.default_view = IntEditorView;\n", " this.define({\n", " step: [p.Number, 1],\n", " });\n", " }\n", " }\n", " exports.IntEditor = IntEditor;\n", " IntEditor.__name__ = \"IntEditor\";\n", " IntEditor.init_IntEditor();\n", " class NumberEditorView extends CellEditorView {\n", " _createInput() {\n", " return dom_1.input({ type: \"text\" });\n", " }\n", " renderEditor() {\n", " //$(@inputEl).spinner({step: @model.step})\n", " this.inputEl.focus();\n", " this.inputEl.select();\n", " }\n", " remove() {\n", " //$(@inputEl).spinner(\"destroy\")\n", " super.remove();\n", " }\n", " serializeValue() {\n", " return parseFloat(this.getValue()) || 0.0;\n", " }\n", " loadValue(item) {\n", " super.loadValue(item);\n", " this.inputEl.defaultValue = this.defaultValue;\n", " this.inputEl.select();\n", " }\n", " validateValue(value) {\n", " if (isNaN(value))\n", " return { valid: false, msg: \"Please enter a valid number\" };\n", " else\n", " return super.validateValue(value);\n", " }\n", " }\n", " exports.NumberEditorView = NumberEditorView;\n", " NumberEditorView.__name__ = \"NumberEditorView\";\n", " class NumberEditor extends CellEditor {\n", " static init_NumberEditor() {\n", " this.prototype.default_view = NumberEditorView;\n", " this.define({\n", " step: [p.Number, 0.01],\n", " });\n", " }\n", " }\n", " exports.NumberEditor = NumberEditor;\n", " NumberEditor.__name__ = \"NumberEditor\";\n", " NumberEditor.init_NumberEditor();\n", " class TimeEditorView extends CellEditorView {\n", " _createInput() {\n", " return dom_1.input({ type: \"text\" });\n", " }\n", " }\n", " exports.TimeEditorView = TimeEditorView;\n", " TimeEditorView.__name__ = \"TimeEditorView\";\n", " class TimeEditor extends CellEditor {\n", " static init_TimeEditor() {\n", " this.prototype.default_view = TimeEditorView;\n", " }\n", " }\n", " exports.TimeEditor = TimeEditor;\n", " TimeEditor.__name__ = \"TimeEditor\";\n", " TimeEditor.init_TimeEditor();\n", " class DateEditorView extends CellEditorView {\n", " _createInput() {\n", " return dom_1.input({ type: \"text\" });\n", " }\n", " get emptyValue() {\n", " return new Date();\n", " }\n", " renderEditor() {\n", " //this.calendarOpen = false\n", " //@$datepicker = $(@inputEl).datepicker({\n", " // showOn: \"button\"\n", " // buttonImageOnly: true\n", " // beforeShow: () => @calendarOpen = true\n", " // onClose: () => @calendarOpen = false\n", " //})\n", " //@$datepicker.siblings(\".ui-datepicker-trigger\").css(\"vertical-align\": \"middle\")\n", " //@$datepicker.width(@$datepicker.width() - (14 + 2*4 + 4)) # img width + margins + edge distance\n", " this.inputEl.focus();\n", " this.inputEl.select();\n", " }\n", " destroy() {\n", " //$.datepicker.dpDiv.stop(true, true)\n", " //@$datepicker.datepicker(\"hide\")\n", " //@$datepicker.datepicker(\"destroy\")\n", " super.destroy();\n", " }\n", " show() {\n", " //if @calendarOpen\n", " // $.datepicker.dpDiv.stop(true, true).show()\n", " super.show();\n", " }\n", " hide() {\n", " //if @calendarOpen\n", " // $.datepicker.dpDiv.stop(true, true).hide()\n", " super.hide();\n", " }\n", " position( /*_position*/) {\n", " //if @calendarOpen\n", " // $.datepicker.dpDiv.css(top: position.top + 30, left: position.left)\n", " return super.position();\n", " }\n", " getValue() {\n", " //return @$datepicker.datepicker(\"getDate\").getTime()\n", " }\n", " setValue(_val) {\n", " //@$datepicker.datepicker(\"setDate\", new Date(val))\n", " }\n", " }\n", " exports.DateEditorView = DateEditorView;\n", " DateEditorView.__name__ = \"DateEditorView\";\n", " class DateEditor extends CellEditor {\n", " static init_DateEditor() {\n", " this.prototype.default_view = DateEditorView;\n", " }\n", " }\n", " exports.DateEditor = DateEditor;\n", " DateEditor.__name__ = \"DateEditor\";\n", " DateEditor.init_DateEditor();\n", " },\n", " 441: /* models/widgets/tables/data_table.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const slick_rowselectionmodel_1 = require(442) /* @bokeh/slickgrid/plugins/slick.rowselectionmodel */;\n", " const slick_checkboxselectcolumn_1 = require(446) /* @bokeh/slickgrid/plugins/slick.checkboxselectcolumn */;\n", " const slick_cellexternalcopymanager_1 = require(447) /* @bokeh/slickgrid/plugins/slick.cellexternalcopymanager */;\n", " const slickgrid_1 = require(448) /* @bokeh/slickgrid */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const string_1 = require(24) /* ../../../core/util/string */;\n", " const types_1 = require(8) /* ../../../core/util/types */;\n", " const array_1 = require(9) /* ../../../core/util/array */;\n", " const object_1 = require(17) /* ../../../core/util/object */;\n", " const logging_1 = require(72) /* ../../../core/logging */;\n", " const layout_1 = require(188) /* ../../../core/layout */;\n", " const table_widget_1 = require(457) /* ./table_widget */;\n", " const widget_1 = require(458) /* ../widget */;\n", " const tables_1 = require(459) /* ../../../styles/widgets/tables */;\n", " const slickgrid_css_1 = tslib_1.__importDefault(require(460) /* ../../../styles/widgets/slickgrid.css */);\n", " const tables_css_1 = tslib_1.__importDefault(require(461) /* ../../../styles/widgets/tables.css */);\n", " exports.DTINDEX_NAME = \"__bkdt_internal_index__\";\n", " class TableDataProvider {\n", " constructor(source, view) {\n", " this.init(source, view);\n", " }\n", " init(source, view) {\n", " if (exports.DTINDEX_NAME in source.data)\n", " throw new Error(`special name ${exports.DTINDEX_NAME} cannot be used as a data table column`);\n", " this.source = source;\n", " this.view = view;\n", " this.index = this.view.indices;\n", " }\n", " getLength() {\n", " return this.index.length;\n", " }\n", " getItem(offset) {\n", " const item = {};\n", " for (const field of object_1.keys(this.source.data)) {\n", " item[field] = this.source.data[field][this.index[offset]];\n", " }\n", " item[exports.DTINDEX_NAME] = this.index[offset];\n", " return item;\n", " }\n", " getField(offset, field) {\n", " // offset is the\n", " if (field == exports.DTINDEX_NAME) {\n", " return this.index[offset];\n", " }\n", " return this.source.data[field][this.index[offset]];\n", " }\n", " setField(offset, field, value) {\n", " // field assumed never to be internal index name (ctor would throw)\n", " const index = this.index[offset];\n", " this.source.patch({ [field]: [[index, value]] });\n", " }\n", " getItemMetadata(_index) {\n", " return null;\n", " }\n", " getRecords() {\n", " return array_1.range(0, this.getLength()).map((i) => this.getItem(i));\n", " }\n", " sort(columns) {\n", " let cols = columns.map((column) => [column.sortCol.field, column.sortAsc ? 1 : -1]);\n", " if (cols.length == 0) {\n", " cols = [[exports.DTINDEX_NAME, 1]];\n", " }\n", " const records = this.getRecords();\n", " const old_index = this.index.slice();\n", " this.index.sort(function (i1, i2) {\n", " for (const [field, sign] of cols) {\n", " const value1 = records[old_index.indexOf(i1)][field];\n", " const value2 = records[old_index.indexOf(i2)][field];\n", " const result = value1 == value2 ? 0 : value1 > value2 ? sign : -sign;\n", " if (result != 0)\n", " return result;\n", " }\n", " return 0;\n", " });\n", " }\n", " }\n", " exports.TableDataProvider = TableDataProvider;\n", " TableDataProvider.__name__ = \"TableDataProvider\";\n", " class DataTableView extends widget_1.WidgetView {\n", " constructor() {\n", " super(...arguments);\n", " this._in_selection_update = false;\n", " this._warned_not_reorderable = false;\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.change, () => this.render());\n", " this.connect(this.model.source.streaming, () => this.updateGrid());\n", " this.connect(this.model.source.patching, () => this.updateGrid());\n", " this.connect(this.model.source.change, () => this.updateGrid());\n", " this.connect(this.model.source.properties.data.change, () => this.updateGrid());\n", " this.connect(this.model.source.selected.change, () => this.updateSelection());\n", " this.connect(this.model.source.selected.properties.indices.change, () => this.updateSelection());\n", " }\n", " remove() {\n", " var _a;\n", " (_a = this.grid) === null || _a === void 0 ? void 0 : _a.destroy();\n", " super.remove();\n", " }\n", " styles() {\n", " return [...super.styles(), slickgrid_css_1.default, tables_css_1.default];\n", " }\n", " _update_layout() {\n", " this.layout = new layout_1.LayoutItem();\n", " this.layout.set_sizing(this.box_sizing());\n", " }\n", " update_position() {\n", " super.update_position();\n", " this.grid.resizeCanvas();\n", " }\n", " updateGrid() {\n", " // TODO (bev) This is to ensure that CDSView indices are properly computed\n", " // before passing to the DataProvider. This will result in extra calls to\n", " // compute_indices. This \"over execution\" will be addressed in a more\n", " // general look at events\n", " this.model.view.compute_indices();\n", " this.data.init(this.model.source, this.model.view);\n", " // This is obnoxious but there is no better way to programmatically force\n", " // a re-sort on the existing sorted columns until/if we start using DataView\n", " if (this.model.sortable) {\n", " const columns = this.grid.getColumns();\n", " const sorters = this.grid.getSortColumns().map((x) => ({\n", " sortCol: {\n", " field: columns[this.grid.getColumnIndex(x.columnId)].field,\n", " },\n", " sortAsc: x.sortAsc,\n", " }));\n", " this.data.sort(sorters);\n", " }\n", " this.grid.invalidate();\n", " this.grid.render();\n", " }\n", " updateSelection() {\n", " if (this._in_selection_update)\n", " return;\n", " const { selected } = this.model.source;\n", " const permuted_indices = selected.indices.map((x) => this.data.index.indexOf(x)).sort();\n", " this._in_selection_update = true;\n", " this.grid.setSelectedRows(permuted_indices);\n", " this._in_selection_update = false;\n", " // If the selection is not in the current slickgrid viewport, scroll the\n", " // datatable to start at the row before the first selected row, so that\n", " // the selection is immediately brought into view. We don't scroll when\n", " // the selection is already in the viewport so that selecting from the\n", " // datatable itself does not re-scroll.\n", " const cur_grid_range = this.grid.getViewport();\n", " const scroll_index = this.model.get_scroll_index(cur_grid_range, permuted_indices);\n", " if (scroll_index != null)\n", " this.grid.scrollRowToTop(scroll_index);\n", " }\n", " newIndexColumn() {\n", " return {\n", " id: string_1.uniqueId(),\n", " name: this.model.index_header,\n", " field: exports.DTINDEX_NAME,\n", " width: this.model.index_width,\n", " behavior: \"select\",\n", " cannotTriggerInsert: true,\n", " resizable: false,\n", " selectable: false,\n", " sortable: true,\n", " cssClass: tables_1.bk_cell_index,\n", " headerCssClass: tables_1.bk_header_index,\n", " };\n", " }\n", " css_classes() {\n", " return super.css_classes().concat(tables_1.bk_data_table);\n", " }\n", " render() {\n", " let checkboxSelector;\n", " let columns = this.model.columns.map((column) => {\n", " return Object.assign(Object.assign({}, column.toColumn()), { parent: this });\n", " });\n", " if (this.model.selectable == \"checkbox\") {\n", " checkboxSelector = new slick_checkboxselectcolumn_1.CheckboxSelectColumn({ cssClass: tables_1.bk_cell_select });\n", " columns.unshift(checkboxSelector.getColumnDefinition());\n", " }\n", " if (this.model.index_position != null) {\n", " const index_position = this.model.index_position;\n", " const index = this.newIndexColumn();\n", " // This is to be able to provide negative index behaviour that\n", " // matches what python users will expect\n", " if (index_position == -1)\n", " columns.push(index);\n", " else if (index_position < -1)\n", " columns.splice(index_position + 1, 0, index);\n", " else\n", " columns.splice(index_position, 0, index);\n", " }\n", " let { reorderable } = this.model;\n", " if (reorderable && !(typeof $ !== \"undefined\" && $.fn != null && $.fn.sortable != null)) {\n", " if (!this._warned_not_reorderable) {\n", " logging_1.logger.warn(\"jquery-ui is required to enable DataTable.reorderable\");\n", " this._warned_not_reorderable = true;\n", " }\n", " reorderable = false;\n", " }\n", " const options = {\n", " enableCellNavigation: this.model.selectable !== false,\n", " enableColumnReorder: reorderable,\n", " forceFitColumns: this.model.fit_columns,\n", " multiColumnSort: this.model.sortable,\n", " editable: this.model.editable,\n", " autoEdit: false,\n", " rowHeight: this.model.row_height,\n", " };\n", " this.data = new TableDataProvider(this.model.source, this.model.view);\n", " this.grid = new slickgrid_1.Grid(this.el, this.data, columns, options);\n", " this.grid.onSort.subscribe((_event, args) => {\n", " if (!this.model.sortable)\n", " return;\n", " columns = args.sortCols;\n", " this.data.sort(columns);\n", " this.grid.invalidate();\n", " this.updateSelection();\n", " this.grid.render();\n", " if (!this.model.header_row) {\n", " this._hide_header();\n", " }\n", " this.model.update_sort_columns(columns);\n", " });\n", " if (this.model.selectable !== false) {\n", " this.grid.setSelectionModel(new slick_rowselectionmodel_1.RowSelectionModel({ selectActiveRow: checkboxSelector == null }));\n", " if (checkboxSelector != null)\n", " this.grid.registerPlugin(checkboxSelector);\n", " const pluginOptions = {\n", " dataItemColumnValueExtractor(val, col) {\n", " // As defined in this file, Item can contain any type values\n", " let value = val[col.field];\n", " if (types_1.isString(value)) {\n", " value = value.replace(/\\n/g, \"\\\\n\");\n", " }\n", " return value;\n", " },\n", " includeHeaderWhenCopying: false,\n", " };\n", " this.grid.registerPlugin(new slick_cellexternalcopymanager_1.CellExternalCopyManager(pluginOptions));\n", " this.grid.onSelectedRowsChanged.subscribe((_event, args) => {\n", " if (this._in_selection_update) {\n", " return;\n", " }\n", " this.model.source.selected.indices = args.rows.map((i) => this.data.index[i]);\n", " });\n", " this.updateSelection();\n", " if (!this.model.header_row) {\n", " this._hide_header();\n", " }\n", " }\n", " }\n", " _hide_header() {\n", " for (const el of Array.from(this.el.querySelectorAll('.slick-header-columns'))) {\n", " el.style.height = \"0px\";\n", " }\n", " this.grid.resizeCanvas();\n", " }\n", " }\n", " exports.DataTableView = DataTableView;\n", " DataTableView.__name__ = \"DataTableView\";\n", " class DataTable extends table_widget_1.TableWidget {\n", " constructor(attrs) {\n", " super(attrs);\n", " this._sort_columns = [];\n", " }\n", " get sort_columns() { return this._sort_columns; }\n", " static init_DataTable() {\n", " this.prototype.default_view = DataTableView;\n", " this.define({\n", " columns: [p.Array, []],\n", " fit_columns: [p.Boolean, true],\n", " sortable: [p.Boolean, true],\n", " reorderable: [p.Boolean, true],\n", " editable: [p.Boolean, false],\n", " selectable: [p.Any, true],\n", " index_position: [p.Int, 0],\n", " index_header: [p.String, \"#\"],\n", " index_width: [p.Int, 40],\n", " scroll_to_selection: [p.Boolean, true],\n", " header_row: [p.Boolean, true],\n", " row_height: [p.Int, 25],\n", " });\n", " this.override({\n", " width: 600,\n", " height: 400,\n", " });\n", " }\n", " update_sort_columns(sortCols) {\n", " this._sort_columns = sortCols.map((x) => ({ field: x.sortCol.field, sortAsc: x.sortAsc }));\n", " return null;\n", " }\n", " get_scroll_index(grid_range, selected_indices) {\n", " if (!this.scroll_to_selection || (selected_indices.length == 0))\n", " return null;\n", " if (!array_1.some(selected_indices, i => grid_range.top <= i && i <= grid_range.bottom)) {\n", " return Math.max(0, Math.min(...selected_indices) - 1);\n", " }\n", " return null;\n", " }\n", " }\n", " exports.DataTable = DataTable;\n", " DataTable.__name__ = \"DataTable\";\n", " DataTable.init_DataTable();\n", " },\n", " 442: /* @bokeh/slickgrid/plugins/slick.rowselectionmodel.js */ function _(require, module, exports) {\n", " var $ = require(443) /* ../slick.jquery */;\n", " var Slick = require(445) /* ../slick.core */;\n", " function RowSelectionModel(options) {\n", " var _grid;\n", " var _ranges = [];\n", " var _self = this;\n", " var _handler = new Slick.EventHandler();\n", " var _inHandler;\n", " var _options;\n", " var _defaults = {\n", " selectActiveRow: true\n", " };\n", " function init(grid) {\n", " _options = $.extend(true, {}, _defaults, options);\n", " _grid = grid;\n", " _handler.subscribe(_grid.onActiveCellChanged, wrapHandler(handleActiveCellChange));\n", " _handler.subscribe(_grid.onKeyDown, wrapHandler(handleKeyDown));\n", " _handler.subscribe(_grid.onClick, wrapHandler(handleClick));\n", " }\n", " function destroy() {\n", " _handler.unsubscribeAll();\n", " }\n", " function wrapHandler(handler) {\n", " return function () {\n", " if (!_inHandler) {\n", " _inHandler = true;\n", " handler.apply(this, arguments);\n", " _inHandler = false;\n", " }\n", " };\n", " }\n", " function rangesToRows(ranges) {\n", " var rows = [];\n", " for (var i = 0; i < ranges.length; i++) {\n", " for (var j = ranges[i].fromRow; j <= ranges[i].toRow; j++) {\n", " rows.push(j);\n", " }\n", " }\n", " return rows;\n", " }\n", " function rowsToRanges(rows) {\n", " var ranges = [];\n", " var lastCell = _grid.getColumns().length - 1;\n", " for (var i = 0; i < rows.length; i++) {\n", " ranges.push(new Slick.Range(rows[i], 0, rows[i], lastCell));\n", " }\n", " return ranges;\n", " }\n", " function getRowsRange(from, to) {\n", " var i, rows = [];\n", " for (i = from; i <= to; i++) {\n", " rows.push(i);\n", " }\n", " for (i = to; i < from; i++) {\n", " rows.push(i);\n", " }\n", " return rows;\n", " }\n", " function getSelectedRows() {\n", " return rangesToRows(_ranges);\n", " }\n", " function setSelectedRows(rows) {\n", " setSelectedRanges(rowsToRanges(rows));\n", " }\n", " function setSelectedRanges(ranges) {\n", " // simple check for: empty selection didn't change, prevent firing onSelectedRangesChanged\n", " if ((!_ranges || _ranges.length === 0) && (!ranges || ranges.length === 0)) {\n", " return;\n", " }\n", " _ranges = ranges;\n", " _self.onSelectedRangesChanged.notify(_ranges);\n", " }\n", " function getSelectedRanges() {\n", " return _ranges;\n", " }\n", " function handleActiveCellChange(e, data) {\n", " if (_options.selectActiveRow && data.row != null) {\n", " setSelectedRanges([new Slick.Range(data.row, 0, data.row, _grid.getColumns().length - 1)]);\n", " }\n", " }\n", " function handleKeyDown(e) {\n", " var activeRow = _grid.getActiveCell();\n", " if (_grid.getOptions().multiSelect && activeRow\n", " && e.shiftKey && !e.ctrlKey && !e.altKey && !e.metaKey\n", " && (e.which == Slick.keyCode.UP || e.which == Slick.keyCode.DOWN)) {\n", " var selectedRows = getSelectedRows();\n", " selectedRows.sort(function (x, y) {\n", " return x - y;\n", " });\n", " if (!selectedRows.length) {\n", " selectedRows = [activeRow.row];\n", " }\n", " var top = selectedRows[0];\n", " var bottom = selectedRows[selectedRows.length - 1];\n", " var active;\n", " if (e.which == Slick.keyCode.DOWN) {\n", " active = activeRow.row < bottom || top == bottom ? ++bottom : ++top;\n", " }\n", " else {\n", " active = activeRow.row < bottom ? --bottom : --top;\n", " }\n", " if (active >= 0 && active < _grid.getDataLength()) {\n", " _grid.scrollRowIntoView(active);\n", " var tempRanges = rowsToRanges(getRowsRange(top, bottom));\n", " setSelectedRanges(tempRanges);\n", " }\n", " e.preventDefault();\n", " e.stopPropagation();\n", " }\n", " }\n", " function handleClick(e) {\n", " var cell = _grid.getCellFromEvent(e);\n", " if (!cell || !_grid.canCellBeActive(cell.row, cell.cell)) {\n", " return false;\n", " }\n", " if (!_grid.getOptions().multiSelect || (!e.ctrlKey && !e.shiftKey && !e.metaKey)) {\n", " return false;\n", " }\n", " var selection = rangesToRows(_ranges);\n", " var idx = $.inArray(cell.row, selection);\n", " if (idx === -1 && (e.ctrlKey || e.metaKey)) {\n", " selection.push(cell.row);\n", " _grid.setActiveCell(cell.row, cell.cell);\n", " }\n", " else if (idx !== -1 && (e.ctrlKey || e.metaKey)) {\n", " selection = $.grep(selection, function (o, i) {\n", " return (o !== cell.row);\n", " });\n", " _grid.setActiveCell(cell.row, cell.cell);\n", " }\n", " else if (selection.length && e.shiftKey) {\n", " var last = selection.pop();\n", " var from = Math.min(cell.row, last);\n", " var to = Math.max(cell.row, last);\n", " selection = [];\n", " for (var i = from; i <= to; i++) {\n", " if (i !== last) {\n", " selection.push(i);\n", " }\n", " }\n", " selection.push(last);\n", " _grid.setActiveCell(cell.row, cell.cell);\n", " }\n", " var tempRanges = rowsToRanges(selection);\n", " setSelectedRanges(tempRanges);\n", " e.stopImmediatePropagation();\n", " return true;\n", " }\n", " $.extend(this, {\n", " \"getSelectedRows\": getSelectedRows,\n", " \"setSelectedRows\": setSelectedRows,\n", " \"getSelectedRanges\": getSelectedRanges,\n", " \"setSelectedRanges\": setSelectedRanges,\n", " \"init\": init,\n", " \"destroy\": destroy,\n", " \"onSelectedRangesChanged\": new Slick.Event()\n", " });\n", " }\n", " module.exports = {\n", " \"RowSelectionModel\": RowSelectionModel\n", " };\n", " },\n", " 443: /* @bokeh/slickgrid/slick.jquery.js */ function _(require, module, exports) {\n", " module.exports = (typeof $ !== \"undefined\") ? $ : require(444) /* jquery */;\n", " },\n", " 444: /* jquery/dist/jquery.js */ function _(require, module, exports) {\n", " /*!\n", " * jQuery JavaScript Library v3.5.0\n", " * https://jquery.com/\n", " *\n", " * Includes Sizzle.js\n", " * https://sizzlejs.com/\n", " *\n", " * Copyright JS Foundation and other contributors\n", " * Released under the MIT license\n", " * https://jquery.org/license\n", " *\n", " * Date: 2020-04-10T15:07Z\n", " */\n", " (function (global, factory) {\n", " \"use strict\";\n", " if (typeof module === \"object\" && typeof module.exports === \"object\") {\n", " // For CommonJS and CommonJS-like environments where a proper `window`\n", " // is present, execute the factory and get jQuery.\n", " // For environments that do not have a `window` with a `document`\n", " // (such as Node.js), expose a factory as module.exports.\n", " // This accentuates the need for the creation of a real `window`.\n", " // e.g. var jQuery = require(\"jquery\")(window);\n", " // See ticket #14549 for more info.\n", " module.exports = global.document ?\n", " factory(global, true) :\n", " function (w) {\n", " if (!w.document) {\n", " throw new Error(\"jQuery requires a window with a document\");\n", " }\n", " return factory(w);\n", " };\n", " }\n", " else {\n", " factory(global);\n", " }\n", " // Pass this if window is not defined yet\n", " })(typeof window !== \"undefined\" ? window : this, function (window, noGlobal) {\n", " // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1\n", " // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode\n", " // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common\n", " // enough that all such attempts are guarded in a try block.\n", " \"use strict\";\n", " var arr = [];\n", " var getProto = Object.getPrototypeOf;\n", " var slice = arr.slice;\n", " var flat = arr.flat ? function (array) {\n", " return arr.flat.call(array);\n", " } : function (array) {\n", " return arr.concat.apply([], array);\n", " };\n", " var push = arr.push;\n", " var indexOf = arr.indexOf;\n", " var class2type = {};\n", " var toString = class2type.toString;\n", " var hasOwn = class2type.hasOwnProperty;\n", " var fnToString = hasOwn.toString;\n", " var ObjectFunctionString = fnToString.call(Object);\n", " var support = {};\n", " var isFunction = function isFunction(obj) {\n", " // Support: Chrome <=57, Firefox <=52\n", " // In some browsers, typeof returns \"function\" for HTML elements\n", " // (i.e., `typeof document.createElement( \"object\" ) === \"function\"`).\n", " // We don't want to classify *any* DOM node as a function.\n", " return typeof obj === \"function\" && typeof obj.nodeType !== \"number\";\n", " };\n", " var isWindow = function isWindow(obj) {\n", " return obj != null && obj === obj.window;\n", " };\n", " var document = window.document;\n", " var preservedScriptAttributes = {\n", " type: true,\n", " src: true,\n", " nonce: true,\n", " noModule: true\n", " };\n", " function DOMEval(code, node, doc) {\n", " doc = doc || document;\n", " var i, val, script = doc.createElement(\"script\");\n", " script.text = code;\n", " if (node) {\n", " for (i in preservedScriptAttributes) {\n", " // Support: Firefox 64+, Edge 18+\n", " // Some browsers don't support the \"nonce\" property on scripts.\n", " // On the other hand, just using `getAttribute` is not enough as\n", " // the `nonce` attribute is reset to an empty string whenever it\n", " // becomes browsing-context connected.\n", " // See https://github.com/whatwg/html/issues/2369\n", " // See https://html.spec.whatwg.org/#nonce-attributes\n", " // The `node.getAttribute` check was added for the sake of\n", " // `jQuery.globalEval` so that it can fake a nonce-containing node\n", " // via an object.\n", " val = node[i] || node.getAttribute && node.getAttribute(i);\n", " if (val) {\n", " script.setAttribute(i, val);\n", " }\n", " }\n", " }\n", " doc.head.appendChild(script).parentNode.removeChild(script);\n", " }\n", " function toType(obj) {\n", " if (obj == null) {\n", " return obj + \"\";\n", " }\n", " // Support: Android <=2.3 only (functionish RegExp)\n", " return typeof obj === \"object\" || typeof obj === \"function\" ?\n", " class2type[toString.call(obj)] || \"object\" :\n", " typeof obj;\n", " }\n", " /* global Symbol */\n", " // Defining this global in .eslintrc.json would create a danger of using the global\n", " // unguarded in another place, it seems safer to define global only for this module\n", " var version = \"3.5.0\", \n", " // Define a local copy of jQuery\n", " jQuery = function (selector, context) {\n", " // The jQuery object is actually just the init constructor 'enhanced'\n", " // Need init if jQuery is called (just allow error to be thrown if not included)\n", " return new jQuery.fn.init(selector, context);\n", " };\n", " jQuery.fn = jQuery.prototype = {\n", " // The current version of jQuery being used\n", " jquery: version,\n", " constructor: jQuery,\n", " // The default length of a jQuery object is 0\n", " length: 0,\n", " toArray: function () {\n", " return slice.call(this);\n", " },\n", " // Get the Nth element in the matched element set OR\n", " // Get the whole matched element set as a clean array\n", " get: function (num) {\n", " // Return all the elements in a clean array\n", " if (num == null) {\n", " return slice.call(this);\n", " }\n", " // Return just the one element from the set\n", " return num < 0 ? this[num + this.length] : this[num];\n", " },\n", " // Take an array of elements and push it onto the stack\n", " // (returning the new matched element set)\n", " pushStack: function (elems) {\n", " // Build a new jQuery matched element set\n", " var ret = jQuery.merge(this.constructor(), elems);\n", " // Add the old object onto the stack (as a reference)\n", " ret.prevObject = this;\n", " // Return the newly-formed element set\n", " return ret;\n", " },\n", " // Execute a callback for every element in the matched set.\n", " each: function (callback) {\n", " return jQuery.each(this, callback);\n", " },\n", " map: function (callback) {\n", " return this.pushStack(jQuery.map(this, function (elem, i) {\n", " return callback.call(elem, i, elem);\n", " }));\n", " },\n", " slice: function () {\n", " return this.pushStack(slice.apply(this, arguments));\n", " },\n", " first: function () {\n", " return this.eq(0);\n", " },\n", " last: function () {\n", " return this.eq(-1);\n", " },\n", " even: function () {\n", " return this.pushStack(jQuery.grep(this, function (_elem, i) {\n", " return (i + 1) % 2;\n", " }));\n", " },\n", " odd: function () {\n", " return this.pushStack(jQuery.grep(this, function (_elem, i) {\n", " return i % 2;\n", " }));\n", " },\n", " eq: function (i) {\n", " var len = this.length, j = +i + (i < 0 ? len : 0);\n", " return this.pushStack(j >= 0 && j < len ? [this[j]] : []);\n", " },\n", " end: function () {\n", " return this.prevObject || this.constructor();\n", " },\n", " // For internal use only.\n", " // Behaves like an Array's method, not like a jQuery method.\n", " push: push,\n", " sort: arr.sort,\n", " splice: arr.splice\n", " };\n", " jQuery.extend = jQuery.fn.extend = function () {\n", " var options, name, src, copy, copyIsArray, clone, target = arguments[0] || {}, i = 1, length = arguments.length, deep = false;\n", " // Handle a deep copy situation\n", " if (typeof target === \"boolean\") {\n", " deep = target;\n", " // Skip the boolean and the target\n", " target = arguments[i] || {};\n", " i++;\n", " }\n", " // Handle case when target is a string or something (possible in deep copy)\n", " if (typeof target !== \"object\" && !isFunction(target)) {\n", " target = {};\n", " }\n", " // Extend jQuery itself if only one argument is passed\n", " if (i === length) {\n", " target = this;\n", " i--;\n", " }\n", " for (; i < length; i++) {\n", " // Only deal with non-null/undefined values\n", " if ((options = arguments[i]) != null) {\n", " // Extend the base object\n", " for (name in options) {\n", " copy = options[name];\n", " // Prevent Object.prototype pollution\n", " // Prevent never-ending loop\n", " if (name === \"__proto__\" || target === copy) {\n", " continue;\n", " }\n", " // Recurse if we're merging plain objects or arrays\n", " if (deep && copy && (jQuery.isPlainObject(copy) ||\n", " (copyIsArray = Array.isArray(copy)))) {\n", " src = target[name];\n", " // Ensure proper type for the source value\n", " if (copyIsArray && !Array.isArray(src)) {\n", " clone = [];\n", " }\n", " else if (!copyIsArray && !jQuery.isPlainObject(src)) {\n", " clone = {};\n", " }\n", " else {\n", " clone = src;\n", " }\n", " copyIsArray = false;\n", " // Never move original objects, clone them\n", " target[name] = jQuery.extend(deep, clone, copy);\n", " // Don't bring in undefined values\n", " }\n", " else if (copy !== undefined) {\n", " target[name] = copy;\n", " }\n", " }\n", " }\n", " }\n", " // Return the modified object\n", " return target;\n", " };\n", " jQuery.extend({\n", " // Unique for each copy of jQuery on the page\n", " expando: \"jQuery\" + (version + Math.random()).replace(/\\D/g, \"\"),\n", " // Assume jQuery is ready without the ready module\n", " isReady: true,\n", " error: function (msg) {\n", " throw new Error(msg);\n", " },\n", " noop: function () { },\n", " isPlainObject: function (obj) {\n", " var proto, Ctor;\n", " // Detect obvious negatives\n", " // Use toString instead of jQuery.type to catch host objects\n", " if (!obj || toString.call(obj) !== \"[object Object]\") {\n", " return false;\n", " }\n", " proto = getProto(obj);\n", " // Objects with no prototype (e.g., `Object.create( null )`) are plain\n", " if (!proto) {\n", " return true;\n", " }\n", " // Objects with prototype are plain iff they were constructed by a global Object function\n", " Ctor = hasOwn.call(proto, \"constructor\") && proto.constructor;\n", " return typeof Ctor === \"function\" && fnToString.call(Ctor) === ObjectFunctionString;\n", " },\n", " isEmptyObject: function (obj) {\n", " var name;\n", " for (name in obj) {\n", " return false;\n", " }\n", " return true;\n", " },\n", " // Evaluates a script in a provided context; falls back to the global one\n", " // if not specified.\n", " globalEval: function (code, options, doc) {\n", " DOMEval(code, { nonce: options && options.nonce }, doc);\n", " },\n", " each: function (obj, callback) {\n", " var length, i = 0;\n", " if (isArrayLike(obj)) {\n", " length = obj.length;\n", " for (; i < length; i++) {\n", " if (callback.call(obj[i], i, obj[i]) === false) {\n", " break;\n", " }\n", " }\n", " }\n", " else {\n", " for (i in obj) {\n", " if (callback.call(obj[i], i, obj[i]) === false) {\n", " break;\n", " }\n", " }\n", " }\n", " return obj;\n", " },\n", " // results is for internal usage only\n", " makeArray: function (arr, results) {\n", " var ret = results || [];\n", " if (arr != null) {\n", " if (isArrayLike(Object(arr))) {\n", " jQuery.merge(ret, typeof arr === \"string\" ?\n", " [arr] : arr);\n", " }\n", " else {\n", " push.call(ret, arr);\n", " }\n", " }\n", " return ret;\n", " },\n", " inArray: function (elem, arr, i) {\n", " return arr == null ? -1 : indexOf.call(arr, elem, i);\n", " },\n", " // Support: Android <=4.0 only, PhantomJS 1 only\n", " // push.apply(_, arraylike) throws on ancient WebKit\n", " merge: function (first, second) {\n", " var len = +second.length, j = 0, i = first.length;\n", " for (; j < len; j++) {\n", " first[i++] = second[j];\n", " }\n", " first.length = i;\n", " return first;\n", " },\n", " grep: function (elems, callback, invert) {\n", " var callbackInverse, matches = [], i = 0, length = elems.length, callbackExpect = !invert;\n", " // Go through the array, only saving the items\n", " // that pass the validator function\n", " for (; i < length; i++) {\n", " callbackInverse = !callback(elems[i], i);\n", " if (callbackInverse !== callbackExpect) {\n", " matches.push(elems[i]);\n", " }\n", " }\n", " return matches;\n", " },\n", " // arg is for internal usage only\n", " map: function (elems, callback, arg) {\n", " var length, value, i = 0, ret = [];\n", " // Go through the array, translating each of the items to their new values\n", " if (isArrayLike(elems)) {\n", " length = elems.length;\n", " for (; i < length; i++) {\n", " value = callback(elems[i], i, arg);\n", " if (value != null) {\n", " ret.push(value);\n", " }\n", " }\n", " // Go through every key on the object,\n", " }\n", " else {\n", " for (i in elems) {\n", " value = callback(elems[i], i, arg);\n", " if (value != null) {\n", " ret.push(value);\n", " }\n", " }\n", " }\n", " // Flatten any nested arrays\n", " return flat(ret);\n", " },\n", " // A global GUID counter for objects\n", " guid: 1,\n", " // jQuery.support is not used in Core but other projects attach their\n", " // properties to it so it needs to exist.\n", " support: support\n", " });\n", " if (typeof Symbol === \"function\") {\n", " jQuery.fn[Symbol.iterator] = arr[Symbol.iterator];\n", " }\n", " // Populate the class2type map\n", " jQuery.each(\"Boolean Number String Function Array Date RegExp Object Error Symbol\".split(\" \"), function (_i, name) {\n", " class2type[\"[object \" + name + \"]\"] = name.toLowerCase();\n", " });\n", " function isArrayLike(obj) {\n", " // Support: real iOS 8.2 only (not reproducible in simulator)\n", " // `in` check used to prevent JIT error (gh-2145)\n", " // hasOwn isn't used here due to false negatives\n", " // regarding Nodelist length in IE\n", " var length = !!obj && \"length\" in obj && obj.length, type = toType(obj);\n", " if (isFunction(obj) || isWindow(obj)) {\n", " return false;\n", " }\n", " return type === \"array\" || length === 0 ||\n", " typeof length === \"number\" && length > 0 && (length - 1) in obj;\n", " }\n", " var Sizzle = \n", " /*!\n", " * Sizzle CSS Selector Engine v2.3.5\n", " * https://sizzlejs.com/\n", " *\n", " * Copyright JS Foundation and other contributors\n", " * Released under the MIT license\n", " * https://js.foundation/\n", " *\n", " * Date: 2020-03-14\n", " */\n", " (function (window) {\n", " var i, support, Expr, getText, isXML, tokenize, compile, select, outermostContext, sortInput, hasDuplicate, \n", " // Local document vars\n", " setDocument, document, docElem, documentIsHTML, rbuggyQSA, rbuggyMatches, matches, contains, \n", " // Instance-specific data\n", " expando = \"sizzle\" + 1 * new Date(), preferredDoc = window.document, dirruns = 0, done = 0, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), nonnativeSelectorCache = createCache(), sortOrder = function (a, b) {\n", " if (a === b) {\n", " hasDuplicate = true;\n", " }\n", " return 0;\n", " }, \n", " // Instance methods\n", " hasOwn = ({}).hasOwnProperty, arr = [], pop = arr.pop, pushNative = arr.push, push = arr.push, slice = arr.slice, \n", " // Use a stripped-down indexOf as it's faster than native\n", " // https://jsperf.com/thor-indexof-vs-for/5\n", " indexOf = function (list, elem) {\n", " var i = 0, len = list.length;\n", " for (; i < len; i++) {\n", " if (list[i] === elem) {\n", " return i;\n", " }\n", " }\n", " return -1;\n", " }, booleans = \"checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|\" +\n", " \"ismap|loop|multiple|open|readonly|required|scoped\", \n", " // Regular expressions\n", " // http://www.w3.org/TR/css3-selectors/#whitespace\n", " whitespace = \"[\\\\x20\\\\t\\\\r\\\\n\\\\f]\", \n", " // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram\n", " identifier = \"(?:\\\\\\\\[\\\\da-fA-F]{1,6}\" + whitespace +\n", " \"?|\\\\\\\\[^\\\\r\\\\n\\\\f]|[\\\\w-]|[^\\0-\\\\x7f])+\", \n", " // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors\n", " attributes = \"\\\\[\" + whitespace + \"*(\" + identifier + \")(?:\" + whitespace +\n", " // Operator (capture 2)\n", " \"*([*^$|!~]?=)\" + whitespace +\n", " // \"Attribute values must be CSS identifiers [capture 5]\n", " // or strings [capture 3 or capture 4]\"\n", " \"*(?:'((?:\\\\\\\\.|[^\\\\\\\\'])*)'|\\\"((?:\\\\\\\\.|[^\\\\\\\\\\\"])*)\\\"|(\" + identifier + \"))|)\" +\n", " whitespace + \"*\\\\]\", pseudos = \":(\" + identifier + \")(?:\\\\((\" +\n", " // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:\n", " // 1. quoted (capture 3; capture 4 or capture 5)\n", " \"('((?:\\\\\\\\.|[^\\\\\\\\'])*)'|\\\"((?:\\\\\\\\.|[^\\\\\\\\\\\"])*)\\\")|\" +\n", " // 2. simple (capture 6)\n", " \"((?:\\\\\\\\.|[^\\\\\\\\()[\\\\]]|\" + attributes + \")*)|\" +\n", " // 3. anything else (capture 2)\n", " \".*\" +\n", " \")\\\\)|)\", \n", " // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter\n", " rwhitespace = new RegExp(whitespace + \"+\", \"g\"), rtrim = new RegExp(\"^\" + whitespace + \"+|((?:^|[^\\\\\\\\])(?:\\\\\\\\.)*)\" +\n", " whitespace + \"+$\", \"g\"), rcomma = new RegExp(\"^\" + whitespace + \"*,\" + whitespace + \"*\"), rcombinators = new RegExp(\"^\" + whitespace + \"*([>+~]|\" + whitespace + \")\" + whitespace +\n", " \"*\"), rdescend = new RegExp(whitespace + \"|>\"), rpseudo = new RegExp(pseudos), ridentifier = new RegExp(\"^\" + identifier + \"$\"), matchExpr = {\n", " \"ID\": new RegExp(\"^#(\" + identifier + \")\"),\n", " \"CLASS\": new RegExp(\"^\\\\.(\" + identifier + \")\"),\n", " \"TAG\": new RegExp(\"^(\" + identifier + \"|[*])\"),\n", " \"ATTR\": new RegExp(\"^\" + attributes),\n", " \"PSEUDO\": new RegExp(\"^\" + pseudos),\n", " \"CHILD\": new RegExp(\"^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\\\(\" +\n", " whitespace + \"*(even|odd|(([+-]|)(\\\\d*)n|)\" + whitespace + \"*(?:([+-]|)\" +\n", " whitespace + \"*(\\\\d+)|))\" + whitespace + \"*\\\\)|)\", \"i\"),\n", " \"bool\": new RegExp(\"^(?:\" + booleans + \")$\", \"i\"),\n", " // For use in libraries implementing .is()\n", " // We use this for POS matching in `select`\n", " \"needsContext\": new RegExp(\"^\" + whitespace +\n", " \"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\\\(\" + whitespace +\n", " \"*((?:-\\\\d)?\\\\d*)\" + whitespace + \"*\\\\)|)(?=[^-]|$)\", \"i\")\n", " }, rhtml = /HTML$/i, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\\d$/i, rnative = /^[^{]+\\{\\s*\\[native \\w/, \n", " // Easily-parseable/retrievable ID or TAG or CLASS selectors\n", " rquickExpr = /^(?:#([\\w-]+)|(\\w+)|\\.([\\w-]+))$/, rsibling = /[+~]/, \n", " // CSS escapes\n", " // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters\n", " runescape = new RegExp(\"\\\\\\\\[\\\\da-fA-F]{1,6}\" + whitespace + \"?|\\\\\\\\([^\\\\r\\\\n\\\\f])\", \"g\"), funescape = function (escape, nonHex) {\n", " var high = \"0x\" + escape.slice(1) - 0x10000;\n", " return nonHex ?\n", " // Strip the backslash prefix from a non-hex escape sequence\n", " nonHex :\n", " // Replace a hexadecimal escape sequence with the encoded Unicode code point\n", " // Support: IE <=11+\n", " // For values outside the Basic Multilingual Plane (BMP), manually construct a\n", " // surrogate pair\n", " high < 0 ?\n", " String.fromCharCode(high + 0x10000) :\n", " String.fromCharCode(high >> 10 | 0xD800, high & 0x3FF | 0xDC00);\n", " }, \n", " // CSS string/identifier serialization\n", " // https://drafts.csswg.org/cssom/#common-serializing-idioms\n", " rcssescape = /([\\0-\\x1f\\x7f]|^-?\\d)|^-$|[^\\0-\\x1f\\x7f-\\uFFFF\\w-]/g, fcssescape = function (ch, asCodePoint) {\n", " if (asCodePoint) {\n", " // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER\n", " if (ch === \"\\0\") {\n", " return \"\\uFFFD\";\n", " }\n", " // Control characters and (dependent upon position) numbers get escaped as code points\n", " return ch.slice(0, -1) + \"\\\\\" +\n", " ch.charCodeAt(ch.length - 1).toString(16) + \" \";\n", " }\n", " // Other potentially-special ASCII characters get backslash-escaped\n", " return \"\\\\\" + ch;\n", " }, \n", " // Used for iframes\n", " // See setDocument()\n", " // Removing the function wrapper causes a \"Permission Denied\"\n", " // error in IE\n", " unloadHandler = function () {\n", " setDocument();\n", " }, inDisabledFieldset = addCombinator(function (elem) {\n", " return elem.disabled === true && elem.nodeName.toLowerCase() === \"fieldset\";\n", " }, { dir: \"parentNode\", next: \"legend\" });\n", " // Optimize for push.apply( _, NodeList )\n", " try {\n", " push.apply((arr = slice.call(preferredDoc.childNodes)), preferredDoc.childNodes);\n", " // Support: Android<4.0\n", " // Detect silently failing push.apply\n", " // eslint-disable-next-line no-unused-expressions\n", " arr[preferredDoc.childNodes.length].nodeType;\n", " }\n", " catch (e) {\n", " push = { apply: arr.length ?\n", " // Leverage slice if possible\n", " function (target, els) {\n", " pushNative.apply(target, slice.call(els));\n", " } :\n", " // Support: IE<9\n", " // Otherwise append directly\n", " function (target, els) {\n", " var j = target.length, i = 0;\n", " // Can't trust NodeList.length\n", " while ((target[j++] = els[i++])) { }\n", " target.length = j - 1;\n", " }\n", " };\n", " }\n", " function Sizzle(selector, context, results, seed) {\n", " var m, i, elem, nid, match, groups, newSelector, newContext = context && context.ownerDocument, \n", " // nodeType defaults to 9, since context defaults to document\n", " nodeType = context ? context.nodeType : 9;\n", " results = results || [];\n", " // Return early from calls with invalid selector or context\n", " if (typeof selector !== \"string\" || !selector ||\n", " nodeType !== 1 && nodeType !== 9 && nodeType !== 11) {\n", " return results;\n", " }\n", " // Try to shortcut find operations (as opposed to filters) in HTML documents\n", " if (!seed) {\n", " setDocument(context);\n", " context = context || document;\n", " if (documentIsHTML) {\n", " // If the selector is sufficiently simple, try using a \"get*By*\" DOM method\n", " // (excepting DocumentFragment context, where the methods don't exist)\n", " if (nodeType !== 11 && (match = rquickExpr.exec(selector))) {\n", " // ID selector\n", " if ((m = match[1])) {\n", " // Document context\n", " if (nodeType === 9) {\n", " if ((elem = context.getElementById(m))) {\n", " // Support: IE, Opera, Webkit\n", " // TODO: identify versions\n", " // getElementById can match elements by name instead of ID\n", " if (elem.id === m) {\n", " results.push(elem);\n", " return results;\n", " }\n", " }\n", " else {\n", " return results;\n", " }\n", " // Element context\n", " }\n", " else {\n", " // Support: IE, Opera, Webkit\n", " // TODO: identify versions\n", " // getElementById can match elements by name instead of ID\n", " if (newContext && (elem = newContext.getElementById(m)) &&\n", " contains(context, elem) &&\n", " elem.id === m) {\n", " results.push(elem);\n", " return results;\n", " }\n", " }\n", " // Type selector\n", " }\n", " else if (match[2]) {\n", " push.apply(results, context.getElementsByTagName(selector));\n", " return results;\n", " // Class selector\n", " }\n", " else if ((m = match[3]) && support.getElementsByClassName &&\n", " context.getElementsByClassName) {\n", " push.apply(results, context.getElementsByClassName(m));\n", " return results;\n", " }\n", " }\n", " // Take advantage of querySelectorAll\n", " if (support.qsa &&\n", " !nonnativeSelectorCache[selector + \" \"] &&\n", " (!rbuggyQSA || !rbuggyQSA.test(selector)) &&\n", " // Support: IE 8 only\n", " // Exclude object elements\n", " (nodeType !== 1 || context.nodeName.toLowerCase() !== \"object\")) {\n", " newSelector = selector;\n", " newContext = context;\n", " // qSA considers elements outside a scoping root when evaluating child or\n", " // descendant combinators, which is not what we want.\n", " // In such cases, we work around the behavior by prefixing every selector in the\n", " // list with an ID selector referencing the scope context.\n", " // The technique has to be used as well when a leading combinator is used\n", " // as such selectors are not recognized by querySelectorAll.\n", " // Thanks to Andrew Dupont for this technique.\n", " if (nodeType === 1 &&\n", " (rdescend.test(selector) || rcombinators.test(selector))) {\n", " // Expand context for sibling selectors\n", " newContext = rsibling.test(selector) && testContext(context.parentNode) ||\n", " context;\n", " // We can use :scope instead of the ID hack if the browser\n", " // supports it & if we're not changing the context.\n", " if (newContext !== context || !support.scope) {\n", " // Capture the context ID, setting it first if necessary\n", " if ((nid = context.getAttribute(\"id\"))) {\n", " nid = nid.replace(rcssescape, fcssescape);\n", " }\n", " else {\n", " context.setAttribute(\"id\", (nid = expando));\n", " }\n", " }\n", " // Prefix every selector in the list\n", " groups = tokenize(selector);\n", " i = groups.length;\n", " while (i--) {\n", " groups[i] = (nid ? \"#\" + nid : \":scope\") + \" \" +\n", " toSelector(groups[i]);\n", " }\n", " newSelector = groups.join(\",\");\n", " }\n", " try {\n", " push.apply(results, newContext.querySelectorAll(newSelector));\n", " return results;\n", " }\n", " catch (qsaError) {\n", " nonnativeSelectorCache(selector, true);\n", " }\n", " finally {\n", " if (nid === expando) {\n", " context.removeAttribute(\"id\");\n", " }\n", " }\n", " }\n", " }\n", " }\n", " // All others\n", " return select(selector.replace(rtrim, \"$1\"), context, results, seed);\n", " }\n", " /**\n", " * Create key-value caches of limited size\n", " * @returns {function(string, object)} Returns the Object data after storing it on itself with\n", " *\tproperty name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)\n", " *\tdeleting the oldest entry\n", " */\n", " function createCache() {\n", " var keys = [];\n", " function cache(key, value) {\n", " // Use (key + \" \") to avoid collision with native prototype properties (see Issue #157)\n", " if (keys.push(key + \" \") > Expr.cacheLength) {\n", " // Only keep the most recent entries\n", " delete cache[keys.shift()];\n", " }\n", " return (cache[key + \" \"] = value);\n", " }\n", " return cache;\n", " }\n", " /**\n", " * Mark a function for special use by Sizzle\n", " * @param {Function} fn The function to mark\n", " */\n", " function markFunction(fn) {\n", " fn[expando] = true;\n", " return fn;\n", " }\n", " /**\n", " * Support testing using an element\n", " * @param {Function} fn Passed the created element and returns a boolean result\n", " */\n", " function assert(fn) {\n", " var el = document.createElement(\"fieldset\");\n", " try {\n", " return !!fn(el);\n", " }\n", " catch (e) {\n", " return false;\n", " }\n", " finally {\n", " // Remove from its parent by default\n", " if (el.parentNode) {\n", " el.parentNode.removeChild(el);\n", " }\n", " // release memory in IE\n", " el = null;\n", " }\n", " }\n", " /**\n", " * Adds the same handler for all of the specified attrs\n", " * @param {String} attrs Pipe-separated list of attributes\n", " * @param {Function} handler The method that will be applied\n", " */\n", " function addHandle(attrs, handler) {\n", " var arr = attrs.split(\"|\"), i = arr.length;\n", " while (i--) {\n", " Expr.attrHandle[arr[i]] = handler;\n", " }\n", " }\n", " /**\n", " * Checks document order of two siblings\n", " * @param {Element} a\n", " * @param {Element} b\n", " * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b\n", " */\n", " function siblingCheck(a, b) {\n", " var cur = b && a, diff = cur && a.nodeType === 1 && b.nodeType === 1 &&\n", " a.sourceIndex - b.sourceIndex;\n", " // Use IE sourceIndex if available on both nodes\n", " if (diff) {\n", " return diff;\n", " }\n", " // Check if b follows a\n", " if (cur) {\n", " while ((cur = cur.nextSibling)) {\n", " if (cur === b) {\n", " return -1;\n", " }\n", " }\n", " }\n", " return a ? 1 : -1;\n", " }\n", " /**\n", " * Returns a function to use in pseudos for input types\n", " * @param {String} type\n", " */\n", " function createInputPseudo(type) {\n", " return function (elem) {\n", " var name = elem.nodeName.toLowerCase();\n", " return name === \"input\" && elem.type === type;\n", " };\n", " }\n", " /**\n", " * Returns a function to use in pseudos for buttons\n", " * @param {String} type\n", " */\n", " function createButtonPseudo(type) {\n", " return function (elem) {\n", " var name = elem.nodeName.toLowerCase();\n", " return (name === \"input\" || name === \"button\") && elem.type === type;\n", " };\n", " }\n", " /**\n", " * Returns a function to use in pseudos for :enabled/:disabled\n", " * @param {Boolean} disabled true for :disabled; false for :enabled\n", " */\n", " function createDisabledPseudo(disabled) {\n", " // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable\n", " return function (elem) {\n", " // Only certain elements can match :enabled or :disabled\n", " // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled\n", " // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled\n", " if (\"form\" in elem) {\n", " // Check for inherited disabledness on relevant non-disabled elements:\n", " // * listed form-associated elements in a disabled fieldset\n", " // https://html.spec.whatwg.org/multipage/forms.html#category-listed\n", " // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled\n", " // * option elements in a disabled optgroup\n", " // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled\n", " // All such elements have a \"form\" property.\n", " if (elem.parentNode && elem.disabled === false) {\n", " // Option elements defer to a parent optgroup if present\n", " if (\"label\" in elem) {\n", " if (\"label\" in elem.parentNode) {\n", " return elem.parentNode.disabled === disabled;\n", " }\n", " else {\n", " return elem.disabled === disabled;\n", " }\n", " }\n", " // Support: IE 6 - 11\n", " // Use the isDisabled shortcut property to check for disabled fieldset ancestors\n", " return elem.isDisabled === disabled ||\n", " // Where there is no isDisabled, check manually\n", " /* jshint -W018 */\n", " elem.isDisabled !== !disabled &&\n", " inDisabledFieldset(elem) === disabled;\n", " }\n", " return elem.disabled === disabled;\n", " // Try to winnow out elements that can't be disabled before trusting the disabled property.\n", " // Some victims get caught in our net (label, legend, menu, track), but it shouldn't\n", " // even exist on them, let alone have a boolean value.\n", " }\n", " else if (\"label\" in elem) {\n", " return elem.disabled === disabled;\n", " }\n", " // Remaining elements are neither :enabled nor :disabled\n", " return false;\n", " };\n", " }\n", " /**\n", " * Returns a function to use in pseudos for positionals\n", " * @param {Function} fn\n", " */\n", " function createPositionalPseudo(fn) {\n", " return markFunction(function (argument) {\n", " argument = +argument;\n", " return markFunction(function (seed, matches) {\n", " var j, matchIndexes = fn([], seed.length, argument), i = matchIndexes.length;\n", " // Match elements found at the specified indexes\n", " while (i--) {\n", " if (seed[(j = matchIndexes[i])]) {\n", " seed[j] = !(matches[j] = seed[j]);\n", " }\n", " }\n", " });\n", " });\n", " }\n", " /**\n", " * Checks a node for validity as a Sizzle context\n", " * @param {Element|Object=} context\n", " * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value\n", " */\n", " function testContext(context) {\n", " return context && typeof context.getElementsByTagName !== \"undefined\" && context;\n", " }\n", " // Expose support vars for convenience\n", " support = Sizzle.support = {};\n", " /**\n", " * Detects XML nodes\n", " * @param {Element|Object} elem An element or a document\n", " * @returns {Boolean} True iff elem is a non-HTML XML node\n", " */\n", " isXML = Sizzle.isXML = function (elem) {\n", " var namespace = elem.namespaceURI, docElem = (elem.ownerDocument || elem).documentElement;\n", " // Support: IE <=8\n", " // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes\n", " // https://bugs.jquery.com/ticket/4833\n", " return !rhtml.test(namespace || docElem && docElem.nodeName || \"HTML\");\n", " };\n", " /**\n", " * Sets document-related variables once based on the current document\n", " * @param {Element|Object} [doc] An element or document object to use to set the document\n", " * @returns {Object} Returns the current document\n", " */\n", " setDocument = Sizzle.setDocument = function (node) {\n", " var hasCompare, subWindow, doc = node ? node.ownerDocument || node : preferredDoc;\n", " // Return early if doc is invalid or already selected\n", " // Support: IE 11+, Edge 17 - 18+\n", " // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n", " // two documents; shallow comparisons work.\n", " // eslint-disable-next-line eqeqeq\n", " if (doc == document || doc.nodeType !== 9 || !doc.documentElement) {\n", " return document;\n", " }\n", " // Update global variables\n", " document = doc;\n", " docElem = document.documentElement;\n", " documentIsHTML = !isXML(document);\n", " // Support: IE 9 - 11+, Edge 12 - 18+\n", " // Accessing iframe documents after unload throws \"permission denied\" errors (jQuery #13936)\n", " // Support: IE 11+, Edge 17 - 18+\n", " // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n", " // two documents; shallow comparisons work.\n", " // eslint-disable-next-line eqeqeq\n", " if (preferredDoc != document &&\n", " (subWindow = document.defaultView) && subWindow.top !== subWindow) {\n", " // Support: IE 11, Edge\n", " if (subWindow.addEventListener) {\n", " subWindow.addEventListener(\"unload\", unloadHandler, false);\n", " // Support: IE 9 - 10 only\n", " }\n", " else if (subWindow.attachEvent) {\n", " subWindow.attachEvent(\"onunload\", unloadHandler);\n", " }\n", " }\n", " // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only,\n", " // Safari 4 - 5 only, Opera <=11.6 - 12.x only\n", " // IE/Edge & older browsers don't support the :scope pseudo-class.\n", " // Support: Safari 6.0 only\n", " // Safari 6.0 supports :scope but it's an alias of :root there.\n", " support.scope = assert(function (el) {\n", " docElem.appendChild(el).appendChild(document.createElement(\"div\"));\n", " return typeof el.querySelectorAll !== \"undefined\" &&\n", " !el.querySelectorAll(\":scope fieldset div\").length;\n", " });\n", " /* Attributes\n", " ---------------------------------------------------------------------- */\n", " // Support: IE<8\n", " // Verify that getAttribute really returns attributes and not properties\n", " // (excepting IE8 booleans)\n", " support.attributes = assert(function (el) {\n", " el.className = \"i\";\n", " return !el.getAttribute(\"className\");\n", " });\n", " /* getElement(s)By*\n", " ---------------------------------------------------------------------- */\n", " // Check if getElementsByTagName(\"*\") returns only elements\n", " support.getElementsByTagName = assert(function (el) {\n", " el.appendChild(document.createComment(\"\"));\n", " return !el.getElementsByTagName(\"*\").length;\n", " });\n", " // Support: IE<9\n", " support.getElementsByClassName = rnative.test(document.getElementsByClassName);\n", " // Support: IE<10\n", " // Check if getElementById returns elements by name\n", " // The broken getElementById methods don't pick up programmatically-set names,\n", " // so use a roundabout getElementsByName test\n", " support.getById = assert(function (el) {\n", " docElem.appendChild(el).id = expando;\n", " return !document.getElementsByName || !document.getElementsByName(expando).length;\n", " });\n", " // ID filter and find\n", " if (support.getById) {\n", " Expr.filter[\"ID\"] = function (id) {\n", " var attrId = id.replace(runescape, funescape);\n", " return function (elem) {\n", " return elem.getAttribute(\"id\") === attrId;\n", " };\n", " };\n", " Expr.find[\"ID\"] = function (id, context) {\n", " if (typeof context.getElementById !== \"undefined\" && documentIsHTML) {\n", " var elem = context.getElementById(id);\n", " return elem ? [elem] : [];\n", " }\n", " };\n", " }\n", " else {\n", " Expr.filter[\"ID\"] = function (id) {\n", " var attrId = id.replace(runescape, funescape);\n", " return function (elem) {\n", " var node = typeof elem.getAttributeNode !== \"undefined\" &&\n", " elem.getAttributeNode(\"id\");\n", " return node && node.value === attrId;\n", " };\n", " };\n", " // Support: IE 6 - 7 only\n", " // getElementById is not reliable as a find shortcut\n", " Expr.find[\"ID\"] = function (id, context) {\n", " if (typeof context.getElementById !== \"undefined\" && documentIsHTML) {\n", " var node, i, elems, elem = context.getElementById(id);\n", " if (elem) {\n", " // Verify the id attribute\n", " node = elem.getAttributeNode(\"id\");\n", " if (node && node.value === id) {\n", " return [elem];\n", " }\n", " // Fall back on getElementsByName\n", " elems = context.getElementsByName(id);\n", " i = 0;\n", " while ((elem = elems[i++])) {\n", " node = elem.getAttributeNode(\"id\");\n", " if (node && node.value === id) {\n", " return [elem];\n", " }\n", " }\n", " }\n", " return [];\n", " }\n", " };\n", " }\n", " // Tag\n", " Expr.find[\"TAG\"] = support.getElementsByTagName ?\n", " function (tag, context) {\n", " if (typeof context.getElementsByTagName !== \"undefined\") {\n", " return context.getElementsByTagName(tag);\n", " // DocumentFragment nodes don't have gEBTN\n", " }\n", " else if (support.qsa) {\n", " return context.querySelectorAll(tag);\n", " }\n", " } :\n", " function (tag, context) {\n", " var elem, tmp = [], i = 0, \n", " // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too\n", " results = context.getElementsByTagName(tag);\n", " // Filter out possible comments\n", " if (tag === \"*\") {\n", " while ((elem = results[i++])) {\n", " if (elem.nodeType === 1) {\n", " tmp.push(elem);\n", " }\n", " }\n", " return tmp;\n", " }\n", " return results;\n", " };\n", " // Class\n", " Expr.find[\"CLASS\"] = support.getElementsByClassName && function (className, context) {\n", " if (typeof context.getElementsByClassName !== \"undefined\" && documentIsHTML) {\n", " return context.getElementsByClassName(className);\n", " }\n", " };\n", " /* QSA/matchesSelector\n", " ---------------------------------------------------------------------- */\n", " // QSA and matchesSelector support\n", " // matchesSelector(:active) reports false when true (IE9/Opera 11.5)\n", " rbuggyMatches = [];\n", " // qSa(:focus) reports false when true (Chrome 21)\n", " // We allow this because of a bug in IE8/9 that throws an error\n", " // whenever `document.activeElement` is accessed on an iframe\n", " // So, we allow :focus to pass through QSA all the time to avoid the IE error\n", " // See https://bugs.jquery.com/ticket/13378\n", " rbuggyQSA = [];\n", " if ((support.qsa = rnative.test(document.querySelectorAll))) {\n", " // Build QSA regex\n", " // Regex strategy adopted from Diego Perini\n", " assert(function (el) {\n", " var input;\n", " // Select is set to empty string on purpose\n", " // This is to test IE's treatment of not explicitly\n", " // setting a boolean content attribute,\n", " // since its presence should be enough\n", " // https://bugs.jquery.com/ticket/12359\n", " docElem.appendChild(el).innerHTML = \"\" +\n", " \"\";\n", " // Support: IE8, Opera 11-12.16\n", " // Nothing should be selected when empty strings follow ^= or $= or *=\n", " // The test attribute must be unknown in Opera but \"safe\" for WinRT\n", " // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section\n", " if (el.querySelectorAll(\"[msallowcapture^='']\").length) {\n", " rbuggyQSA.push(\"[*^$]=\" + whitespace + \"*(?:''|\\\"\\\")\");\n", " }\n", " // Support: IE8\n", " // Boolean attributes and \"value\" are not treated correctly\n", " if (!el.querySelectorAll(\"[selected]\").length) {\n", " rbuggyQSA.push(\"\\\\[\" + whitespace + \"*(?:value|\" + booleans + \")\");\n", " }\n", " // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+\n", " if (!el.querySelectorAll(\"[id~=\" + expando + \"-]\").length) {\n", " rbuggyQSA.push(\"~=\");\n", " }\n", " // Support: IE 11+, Edge 15 - 18+\n", " // IE 11/Edge don't find elements on a `[name='']` query in some cases.\n", " // Adding a temporary attribute to the document before the selection works\n", " // around the issue.\n", " // Interestingly, IE 10 & older don't seem to have the issue.\n", " input = document.createElement(\"input\");\n", " input.setAttribute(\"name\", \"\");\n", " el.appendChild(input);\n", " if (!el.querySelectorAll(\"[name='']\").length) {\n", " rbuggyQSA.push(\"\\\\[\" + whitespace + \"*name\" + whitespace + \"*=\" +\n", " whitespace + \"*(?:''|\\\"\\\")\");\n", " }\n", " // Webkit/Opera - :checked should return selected option elements\n", " // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked\n", " // IE8 throws error here and will not see later tests\n", " if (!el.querySelectorAll(\":checked\").length) {\n", " rbuggyQSA.push(\":checked\");\n", " }\n", " // Support: Safari 8+, iOS 8+\n", " // https://bugs.webkit.org/show_bug.cgi?id=136851\n", " // In-page `selector#id sibling-combinator selector` fails\n", " if (!el.querySelectorAll(\"a#\" + expando + \"+*\").length) {\n", " rbuggyQSA.push(\".#.+[+~]\");\n", " }\n", " // Support: Firefox <=3.6 - 5 only\n", " // Old Firefox doesn't throw on a badly-escaped identifier.\n", " el.querySelectorAll(\"\\\\\\f\");\n", " rbuggyQSA.push(\"[\\\\r\\\\n\\\\f]\");\n", " });\n", " assert(function (el) {\n", " el.innerHTML = \"\" +\n", " \"\";\n", " // Support: Windows 8 Native Apps\n", " // The type and name attributes are restricted during .innerHTML assignment\n", " var input = document.createElement(\"input\");\n", " input.setAttribute(\"type\", \"hidden\");\n", " el.appendChild(input).setAttribute(\"name\", \"D\");\n", " // Support: IE8\n", " // Enforce case-sensitivity of name attribute\n", " if (el.querySelectorAll(\"[name=d]\").length) {\n", " rbuggyQSA.push(\"name\" + whitespace + \"*[*^$|!~]?=\");\n", " }\n", " // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)\n", " // IE8 throws error here and will not see later tests\n", " if (el.querySelectorAll(\":enabled\").length !== 2) {\n", " rbuggyQSA.push(\":enabled\", \":disabled\");\n", " }\n", " // Support: IE9-11+\n", " // IE's :disabled selector does not pick up the children of disabled fieldsets\n", " docElem.appendChild(el).disabled = true;\n", " if (el.querySelectorAll(\":disabled\").length !== 2) {\n", " rbuggyQSA.push(\":enabled\", \":disabled\");\n", " }\n", " // Support: Opera 10 - 11 only\n", " // Opera 10-11 does not throw on post-comma invalid pseudos\n", " el.querySelectorAll(\"*,:x\");\n", " rbuggyQSA.push(\",.*:\");\n", " });\n", " }\n", " if ((support.matchesSelector = rnative.test((matches = docElem.matches ||\n", " docElem.webkitMatchesSelector ||\n", " docElem.mozMatchesSelector ||\n", " docElem.oMatchesSelector ||\n", " docElem.msMatchesSelector)))) {\n", " assert(function (el) {\n", " // Check to see if it's possible to do matchesSelector\n", " // on a disconnected node (IE 9)\n", " support.disconnectedMatch = matches.call(el, \"*\");\n", " // This should fail with an exception\n", " // Gecko does not error, returns false instead\n", " matches.call(el, \"[s!='']:x\");\n", " rbuggyMatches.push(\"!=\", pseudos);\n", " });\n", " }\n", " rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join(\"|\"));\n", " rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join(\"|\"));\n", " /* Contains\n", " ---------------------------------------------------------------------- */\n", " hasCompare = rnative.test(docElem.compareDocumentPosition);\n", " // Element contains another\n", " // Purposefully self-exclusive\n", " // As in, an element does not contain itself\n", " contains = hasCompare || rnative.test(docElem.contains) ?\n", " function (a, b) {\n", " var adown = a.nodeType === 9 ? a.documentElement : a, bup = b && b.parentNode;\n", " return a === bup || !!(bup && bup.nodeType === 1 && (adown.contains ?\n", " adown.contains(bup) :\n", " a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16));\n", " } :\n", " function (a, b) {\n", " if (b) {\n", " while ((b = b.parentNode)) {\n", " if (b === a) {\n", " return true;\n", " }\n", " }\n", " }\n", " return false;\n", " };\n", " /* Sorting\n", " ---------------------------------------------------------------------- */\n", " // Document order sorting\n", " sortOrder = hasCompare ?\n", " function (a, b) {\n", " // Flag for duplicate removal\n", " if (a === b) {\n", " hasDuplicate = true;\n", " return 0;\n", " }\n", " // Sort on method existence if only one input has compareDocumentPosition\n", " var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;\n", " if (compare) {\n", " return compare;\n", " }\n", " // Calculate position if both inputs belong to the same document\n", " // Support: IE 11+, Edge 17 - 18+\n", " // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n", " // two documents; shallow comparisons work.\n", " // eslint-disable-next-line eqeqeq\n", " compare = (a.ownerDocument || a) == (b.ownerDocument || b) ?\n", " a.compareDocumentPosition(b) :\n", " // Otherwise we know they are disconnected\n", " 1;\n", " // Disconnected nodes\n", " if (compare & 1 ||\n", " (!support.sortDetached && b.compareDocumentPosition(a) === compare)) {\n", " // Choose the first element that is related to our preferred document\n", " // Support: IE 11+, Edge 17 - 18+\n", " // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n", " // two documents; shallow comparisons work.\n", " // eslint-disable-next-line eqeqeq\n", " if (a == document || a.ownerDocument == preferredDoc &&\n", " contains(preferredDoc, a)) {\n", " return -1;\n", " }\n", " // Support: IE 11+, Edge 17 - 18+\n", " // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n", " // two documents; shallow comparisons work.\n", " // eslint-disable-next-line eqeqeq\n", " if (b == document || b.ownerDocument == preferredDoc &&\n", " contains(preferredDoc, b)) {\n", " return 1;\n", " }\n", " // Maintain original order\n", " return sortInput ?\n", " (indexOf(sortInput, a) - indexOf(sortInput, b)) :\n", " 0;\n", " }\n", " return compare & 4 ? -1 : 1;\n", " } :\n", " function (a, b) {\n", " // Exit early if the nodes are identical\n", " if (a === b) {\n", " hasDuplicate = true;\n", " return 0;\n", " }\n", " var cur, i = 0, aup = a.parentNode, bup = b.parentNode, ap = [a], bp = [b];\n", " // Parentless nodes are either documents or disconnected\n", " if (!aup || !bup) {\n", " // Support: IE 11+, Edge 17 - 18+\n", " // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n", " // two documents; shallow comparisons work.\n", " /* eslint-disable eqeqeq */\n", " return a == document ? -1 :\n", " b == document ? 1 :\n", " /* eslint-enable eqeqeq */\n", " aup ? -1 :\n", " bup ? 1 :\n", " sortInput ?\n", " (indexOf(sortInput, a) - indexOf(sortInput, b)) :\n", " 0;\n", " // If the nodes are siblings, we can do a quick check\n", " }\n", " else if (aup === bup) {\n", " return siblingCheck(a, b);\n", " }\n", " // Otherwise we need full lists of their ancestors for comparison\n", " cur = a;\n", " while ((cur = cur.parentNode)) {\n", " ap.unshift(cur);\n", " }\n", " cur = b;\n", " while ((cur = cur.parentNode)) {\n", " bp.unshift(cur);\n", " }\n", " // Walk down the tree looking for a discrepancy\n", " while (ap[i] === bp[i]) {\n", " i++;\n", " }\n", " return i ?\n", " // Do a sibling check if the nodes have a common ancestor\n", " siblingCheck(ap[i], bp[i]) :\n", " // Otherwise nodes in our document sort first\n", " // Support: IE 11+, Edge 17 - 18+\n", " // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n", " // two documents; shallow comparisons work.\n", " /* eslint-disable eqeqeq */\n", " ap[i] == preferredDoc ? -1 :\n", " bp[i] == preferredDoc ? 1 :\n", " /* eslint-enable eqeqeq */\n", " 0;\n", " };\n", " return document;\n", " };\n", " Sizzle.matches = function (expr, elements) {\n", " return Sizzle(expr, null, null, elements);\n", " };\n", " Sizzle.matchesSelector = function (elem, expr) {\n", " setDocument(elem);\n", " if (support.matchesSelector && documentIsHTML &&\n", " !nonnativeSelectorCache[expr + \" \"] &&\n", " (!rbuggyMatches || !rbuggyMatches.test(expr)) &&\n", " (!rbuggyQSA || !rbuggyQSA.test(expr))) {\n", " try {\n", " var ret = matches.call(elem, expr);\n", " // IE 9's matchesSelector returns false on disconnected nodes\n", " if (ret || support.disconnectedMatch ||\n", " // As well, disconnected nodes are said to be in a document\n", " // fragment in IE 9\n", " elem.document && elem.document.nodeType !== 11) {\n", " return ret;\n", " }\n", " }\n", " catch (e) {\n", " nonnativeSelectorCache(expr, true);\n", " }\n", " }\n", " return Sizzle(expr, document, null, [elem]).length > 0;\n", " };\n", " Sizzle.contains = function (context, elem) {\n", " // Set document vars if needed\n", " // Support: IE 11+, Edge 17 - 18+\n", " // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n", " // two documents; shallow comparisons work.\n", " // eslint-disable-next-line eqeqeq\n", " if ((context.ownerDocument || context) != document) {\n", " setDocument(context);\n", " }\n", " return contains(context, elem);\n", " };\n", " Sizzle.attr = function (elem, name) {\n", " // Set document vars if needed\n", " // Support: IE 11+, Edge 17 - 18+\n", " // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n", " // two documents; shallow comparisons work.\n", " // eslint-disable-next-line eqeqeq\n", " if ((elem.ownerDocument || elem) != document) {\n", " setDocument(elem);\n", " }\n", " var fn = Expr.attrHandle[name.toLowerCase()], \n", " // Don't get fooled by Object.prototype properties (jQuery #13807)\n", " val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ?\n", " fn(elem, name, !documentIsHTML) :\n", " undefined;\n", " return val !== undefined ?\n", " val :\n", " support.attributes || !documentIsHTML ?\n", " elem.getAttribute(name) :\n", " (val = elem.getAttributeNode(name)) && val.specified ?\n", " val.value :\n", " null;\n", " };\n", " Sizzle.escape = function (sel) {\n", " return (sel + \"\").replace(rcssescape, fcssescape);\n", " };\n", " Sizzle.error = function (msg) {\n", " throw new Error(\"Syntax error, unrecognized expression: \" + msg);\n", " };\n", " /**\n", " * Document sorting and removing duplicates\n", " * @param {ArrayLike} results\n", " */\n", " Sizzle.uniqueSort = function (results) {\n", " var elem, duplicates = [], j = 0, i = 0;\n", " // Unless we *know* we can detect duplicates, assume their presence\n", " hasDuplicate = !support.detectDuplicates;\n", " sortInput = !support.sortStable && results.slice(0);\n", " results.sort(sortOrder);\n", " if (hasDuplicate) {\n", " while ((elem = results[i++])) {\n", " if (elem === results[i]) {\n", " j = duplicates.push(i);\n", " }\n", " }\n", " while (j--) {\n", " results.splice(duplicates[j], 1);\n", " }\n", " }\n", " // Clear input after sorting to release objects\n", " // See https://github.com/jquery/sizzle/pull/225\n", " sortInput = null;\n", " return results;\n", " };\n", " /**\n", " * Utility function for retrieving the text value of an array of DOM nodes\n", " * @param {Array|Element} elem\n", " */\n", " getText = Sizzle.getText = function (elem) {\n", " var node, ret = \"\", i = 0, nodeType = elem.nodeType;\n", " if (!nodeType) {\n", " // If no nodeType, this is expected to be an array\n", " while ((node = elem[i++])) {\n", " // Do not traverse comment nodes\n", " ret += getText(node);\n", " }\n", " }\n", " else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {\n", " // Use textContent for elements\n", " // innerText usage removed for consistency of new lines (jQuery #11153)\n", " if (typeof elem.textContent === \"string\") {\n", " return elem.textContent;\n", " }\n", " else {\n", " // Traverse its children\n", " for (elem = elem.firstChild; elem; elem = elem.nextSibling) {\n", " ret += getText(elem);\n", " }\n", " }\n", " }\n", " else if (nodeType === 3 || nodeType === 4) {\n", " return elem.nodeValue;\n", " }\n", " // Do not include comment or processing instruction nodes\n", " return ret;\n", " };\n", " Expr = Sizzle.selectors = {\n", " // Can be adjusted by the user\n", " cacheLength: 50,\n", " createPseudo: markFunction,\n", " match: matchExpr,\n", " attrHandle: {},\n", " find: {},\n", " relative: {\n", " \">\": { dir: \"parentNode\", first: true },\n", " \" \": { dir: \"parentNode\" },\n", " \"+\": { dir: \"previousSibling\", first: true },\n", " \"~\": { dir: \"previousSibling\" }\n", " },\n", " preFilter: {\n", " \"ATTR\": function (match) {\n", " match[1] = match[1].replace(runescape, funescape);\n", " // Move the given value to match[3] whether quoted or unquoted\n", " match[3] = (match[3] || match[4] ||\n", " match[5] || \"\").replace(runescape, funescape);\n", " if (match[2] === \"~=\") {\n", " match[3] = \" \" + match[3] + \" \";\n", " }\n", " return match.slice(0, 4);\n", " },\n", " \"CHILD\": function (match) {\n", " /* matches from matchExpr[\"CHILD\"]\n", " 1 type (only|nth|...)\n", " 2 what (child|of-type)\n", " 3 argument (even|odd|\\d*|\\d*n([+-]\\d+)?|...)\n", " 4 xn-component of xn+y argument ([+-]?\\d*n|)\n", " 5 sign of xn-component\n", " 6 x of xn-component\n", " 7 sign of y-component\n", " 8 y of y-component\n", " */\n", " match[1] = match[1].toLowerCase();\n", " if (match[1].slice(0, 3) === \"nth\") {\n", " // nth-* requires argument\n", " if (!match[3]) {\n", " Sizzle.error(match[0]);\n", " }\n", " // numeric x and y parameters for Expr.filter.CHILD\n", " // remember that false/true cast respectively to 0/1\n", " match[4] = +(match[4] ?\n", " match[5] + (match[6] || 1) :\n", " 2 * (match[3] === \"even\" || match[3] === \"odd\"));\n", " match[5] = +((match[7] + match[8]) || match[3] === \"odd\");\n", " // other types prohibit arguments\n", " }\n", " else if (match[3]) {\n", " Sizzle.error(match[0]);\n", " }\n", " return match;\n", " },\n", " \"PSEUDO\": function (match) {\n", " var excess, unquoted = !match[6] && match[2];\n", " if (matchExpr[\"CHILD\"].test(match[0])) {\n", " return null;\n", " }\n", " // Accept quoted arguments as-is\n", " if (match[3]) {\n", " match[2] = match[4] || match[5] || \"\";\n", " // Strip excess characters from unquoted arguments\n", " }\n", " else if (unquoted && rpseudo.test(unquoted) &&\n", " // Get excess from tokenize (recursively)\n", " (excess = tokenize(unquoted, true)) &&\n", " // advance to the next closing parenthesis\n", " (excess = unquoted.indexOf(\")\", unquoted.length - excess) - unquoted.length)) {\n", " // excess is a negative index\n", " match[0] = match[0].slice(0, excess);\n", " match[2] = unquoted.slice(0, excess);\n", " }\n", " // Return only captures needed by the pseudo filter method (type and argument)\n", " return match.slice(0, 3);\n", " }\n", " },\n", " filter: {\n", " \"TAG\": function (nodeNameSelector) {\n", " var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();\n", " return nodeNameSelector === \"*\" ?\n", " function () {\n", " return true;\n", " } :\n", " function (elem) {\n", " return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;\n", " };\n", " },\n", " \"CLASS\": function (className) {\n", " var pattern = classCache[className + \" \"];\n", " return pattern ||\n", " (pattern = new RegExp(\"(^|\" + whitespace +\n", " \")\" + className + \"(\" + whitespace + \"|$)\")) && classCache(className, function (elem) {\n", " return pattern.test(typeof elem.className === \"string\" && elem.className ||\n", " typeof elem.getAttribute !== \"undefined\" &&\n", " elem.getAttribute(\"class\") ||\n", " \"\");\n", " });\n", " },\n", " \"ATTR\": function (name, operator, check) {\n", " return function (elem) {\n", " var result = Sizzle.attr(elem, name);\n", " if (result == null) {\n", " return operator === \"!=\";\n", " }\n", " if (!operator) {\n", " return true;\n", " }\n", " result += \"\";\n", " /* eslint-disable max-len */\n", " return operator === \"=\" ? result === check :\n", " operator === \"!=\" ? result !== check :\n", " operator === \"^=\" ? check && result.indexOf(check) === 0 :\n", " operator === \"*=\" ? check && result.indexOf(check) > -1 :\n", " operator === \"$=\" ? check && result.slice(-check.length) === check :\n", " operator === \"~=\" ? (\" \" + result.replace(rwhitespace, \" \") + \" \").indexOf(check) > -1 :\n", " operator === \"|=\" ? result === check || result.slice(0, check.length + 1) === check + \"-\" :\n", " false;\n", " /* eslint-enable max-len */\n", " };\n", " },\n", " \"CHILD\": function (type, what, _argument, first, last) {\n", " var simple = type.slice(0, 3) !== \"nth\", forward = type.slice(-4) !== \"last\", ofType = what === \"of-type\";\n", " return first === 1 && last === 0 ?\n", " // Shortcut for :nth-*(n)\n", " function (elem) {\n", " return !!elem.parentNode;\n", " } :\n", " function (elem, _context, xml) {\n", " var cache, uniqueCache, outerCache, node, nodeIndex, start, dir = simple !== forward ? \"nextSibling\" : \"previousSibling\", parent = elem.parentNode, name = ofType && elem.nodeName.toLowerCase(), useCache = !xml && !ofType, diff = false;\n", " if (parent) {\n", " // :(first|last|only)-(child|of-type)\n", " if (simple) {\n", " while (dir) {\n", " node = elem;\n", " while ((node = node[dir])) {\n", " if (ofType ?\n", " node.nodeName.toLowerCase() === name :\n", " node.nodeType === 1) {\n", " return false;\n", " }\n", " }\n", " // Reverse direction for :only-* (if we haven't yet done so)\n", " start = dir = type === \"only\" && !start && \"nextSibling\";\n", " }\n", " return true;\n", " }\n", " start = [forward ? parent.firstChild : parent.lastChild];\n", " // non-xml :nth-child(...) stores cache data on `parent`\n", " if (forward && useCache) {\n", " // Seek `elem` from a previously-cached index\n", " // ...in a gzip-friendly way\n", " node = parent;\n", " outerCache = node[expando] || (node[expando] = {});\n", " // Support: IE <9 only\n", " // Defend against cloned attroperties (jQuery gh-1709)\n", " uniqueCache = outerCache[node.uniqueID] ||\n", " (outerCache[node.uniqueID] = {});\n", " cache = uniqueCache[type] || [];\n", " nodeIndex = cache[0] === dirruns && cache[1];\n", " diff = nodeIndex && cache[2];\n", " node = nodeIndex && parent.childNodes[nodeIndex];\n", " while ((node = ++nodeIndex && node && node[dir] ||\n", " // Fallback to seeking `elem` from the start\n", " (diff = nodeIndex = 0) || start.pop())) {\n", " // When found, cache indexes on `parent` and break\n", " if (node.nodeType === 1 && ++diff && node === elem) {\n", " uniqueCache[type] = [dirruns, nodeIndex, diff];\n", " break;\n", " }\n", " }\n", " }\n", " else {\n", " // Use previously-cached element index if available\n", " if (useCache) {\n", " // ...in a gzip-friendly way\n", " node = elem;\n", " outerCache = node[expando] || (node[expando] = {});\n", " // Support: IE <9 only\n", " // Defend against cloned attroperties (jQuery gh-1709)\n", " uniqueCache = outerCache[node.uniqueID] ||\n", " (outerCache[node.uniqueID] = {});\n", " cache = uniqueCache[type] || [];\n", " nodeIndex = cache[0] === dirruns && cache[1];\n", " diff = nodeIndex;\n", " }\n", " // xml :nth-child(...)\n", " // or :nth-last-child(...) or :nth(-last)?-of-type(...)\n", " if (diff === false) {\n", " // Use the same loop as above to seek `elem` from the start\n", " while ((node = ++nodeIndex && node && node[dir] ||\n", " (diff = nodeIndex = 0) || start.pop())) {\n", " if ((ofType ?\n", " node.nodeName.toLowerCase() === name :\n", " node.nodeType === 1) &&\n", " ++diff) {\n", " // Cache the index of each encountered element\n", " if (useCache) {\n", " outerCache = node[expando] ||\n", " (node[expando] = {});\n", " // Support: IE <9 only\n", " // Defend against cloned attroperties (jQuery gh-1709)\n", " uniqueCache = outerCache[node.uniqueID] ||\n", " (outerCache[node.uniqueID] = {});\n", " uniqueCache[type] = [dirruns, diff];\n", " }\n", " if (node === elem) {\n", " break;\n", " }\n", " }\n", " }\n", " }\n", " }\n", " // Incorporate the offset, then check against cycle size\n", " diff -= last;\n", " return diff === first || (diff % first === 0 && diff / first >= 0);\n", " }\n", " };\n", " },\n", " \"PSEUDO\": function (pseudo, argument) {\n", " // pseudo-class names are case-insensitive\n", " // http://www.w3.org/TR/selectors/#pseudo-classes\n", " // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters\n", " // Remember that setFilters inherits from pseudos\n", " var args, fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] ||\n", " Sizzle.error(\"unsupported pseudo: \" + pseudo);\n", " // The user may use createPseudo to indicate that\n", " // arguments are needed to create the filter function\n", " // just as Sizzle does\n", " if (fn[expando]) {\n", " return fn(argument);\n", " }\n", " // But maintain support for old signatures\n", " if (fn.length > 1) {\n", " args = [pseudo, pseudo, \"\", argument];\n", " return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ?\n", " markFunction(function (seed, matches) {\n", " var idx, matched = fn(seed, argument), i = matched.length;\n", " while (i--) {\n", " idx = indexOf(seed, matched[i]);\n", " seed[idx] = !(matches[idx] = matched[i]);\n", " }\n", " }) :\n", " function (elem) {\n", " return fn(elem, 0, args);\n", " };\n", " }\n", " return fn;\n", " }\n", " },\n", " pseudos: {\n", " // Potentially complex pseudos\n", " \"not\": markFunction(function (selector) {\n", " // Trim the selector passed to compile\n", " // to avoid treating leading and trailing\n", " // spaces as combinators\n", " var input = [], results = [], matcher = compile(selector.replace(rtrim, \"$1\"));\n", " return matcher[expando] ?\n", " markFunction(function (seed, matches, _context, xml) {\n", " var elem, unmatched = matcher(seed, null, xml, []), i = seed.length;\n", " // Match elements unmatched by `matcher`\n", " while (i--) {\n", " if ((elem = unmatched[i])) {\n", " seed[i] = !(matches[i] = elem);\n", " }\n", " }\n", " }) :\n", " function (elem, _context, xml) {\n", " input[0] = elem;\n", " matcher(input, null, xml, results);\n", " // Don't keep the element (issue #299)\n", " input[0] = null;\n", " return !results.pop();\n", " };\n", " }),\n", " \"has\": markFunction(function (selector) {\n", " return function (elem) {\n", " return Sizzle(selector, elem).length > 0;\n", " };\n", " }),\n", " \"contains\": markFunction(function (text) {\n", " text = text.replace(runescape, funescape);\n", " return function (elem) {\n", " return (elem.textContent || getText(elem)).indexOf(text) > -1;\n", " };\n", " }),\n", " // \"Whether an element is represented by a :lang() selector\n", " // is based solely on the element's language value\n", " // being equal to the identifier C,\n", " // or beginning with the identifier C immediately followed by \"-\".\n", " // The matching of C against the element's language value is performed case-insensitively.\n", " // The identifier C does not have to be a valid language name.\"\n", " // http://www.w3.org/TR/selectors/#lang-pseudo\n", " \"lang\": markFunction(function (lang) {\n", " // lang value must be a valid identifier\n", " if (!ridentifier.test(lang || \"\")) {\n", " Sizzle.error(\"unsupported lang: \" + lang);\n", " }\n", " lang = lang.replace(runescape, funescape).toLowerCase();\n", " return function (elem) {\n", " var elemLang;\n", " do {\n", " if ((elemLang = documentIsHTML ?\n", " elem.lang :\n", " elem.getAttribute(\"xml:lang\") || elem.getAttribute(\"lang\"))) {\n", " elemLang = elemLang.toLowerCase();\n", " return elemLang === lang || elemLang.indexOf(lang + \"-\") === 0;\n", " }\n", " } while ((elem = elem.parentNode) && elem.nodeType === 1);\n", " return false;\n", " };\n", " }),\n", " // Miscellaneous\n", " \"target\": function (elem) {\n", " var hash = window.location && window.location.hash;\n", " return hash && hash.slice(1) === elem.id;\n", " },\n", " \"root\": function (elem) {\n", " return elem === docElem;\n", " },\n", " \"focus\": function (elem) {\n", " return elem === document.activeElement &&\n", " (!document.hasFocus || document.hasFocus()) &&\n", " !!(elem.type || elem.href || ~elem.tabIndex);\n", " },\n", " // Boolean properties\n", " \"enabled\": createDisabledPseudo(false),\n", " \"disabled\": createDisabledPseudo(true),\n", " \"checked\": function (elem) {\n", " // In CSS3, :checked should return both checked and selected elements\n", " // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked\n", " var nodeName = elem.nodeName.toLowerCase();\n", " return (nodeName === \"input\" && !!elem.checked) ||\n", " (nodeName === \"option\" && !!elem.selected);\n", " },\n", " \"selected\": function (elem) {\n", " // Accessing this property makes selected-by-default\n", " // options in Safari work properly\n", " if (elem.parentNode) {\n", " // eslint-disable-next-line no-unused-expressions\n", " elem.parentNode.selectedIndex;\n", " }\n", " return elem.selected === true;\n", " },\n", " // Contents\n", " \"empty\": function (elem) {\n", " // http://www.w3.org/TR/selectors/#empty-pseudo\n", " // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),\n", " // but not by others (comment: 8; processing instruction: 7; etc.)\n", " // nodeType < 6 works because attributes (2) do not appear as children\n", " for (elem = elem.firstChild; elem; elem = elem.nextSibling) {\n", " if (elem.nodeType < 6) {\n", " return false;\n", " }\n", " }\n", " return true;\n", " },\n", " \"parent\": function (elem) {\n", " return !Expr.pseudos[\"empty\"](elem);\n", " },\n", " // Element/input types\n", " \"header\": function (elem) {\n", " return rheader.test(elem.nodeName);\n", " },\n", " \"input\": function (elem) {\n", " return rinputs.test(elem.nodeName);\n", " },\n", " \"button\": function (elem) {\n", " var name = elem.nodeName.toLowerCase();\n", " return name === \"input\" && elem.type === \"button\" || name === \"button\";\n", " },\n", " \"text\": function (elem) {\n", " var attr;\n", " return elem.nodeName.toLowerCase() === \"input\" &&\n", " elem.type === \"text\" &&\n", " // Support: IE<8\n", " // New HTML5 attribute values (e.g., \"search\") appear with elem.type === \"text\"\n", " ((attr = elem.getAttribute(\"type\")) == null ||\n", " attr.toLowerCase() === \"text\");\n", " },\n", " // Position-in-collection\n", " \"first\": createPositionalPseudo(function () {\n", " return [0];\n", " }),\n", " \"last\": createPositionalPseudo(function (_matchIndexes, length) {\n", " return [length - 1];\n", " }),\n", " \"eq\": createPositionalPseudo(function (_matchIndexes, length, argument) {\n", " return [argument < 0 ? argument + length : argument];\n", " }),\n", " \"even\": createPositionalPseudo(function (matchIndexes, length) {\n", " var i = 0;\n", " for (; i < length; i += 2) {\n", " matchIndexes.push(i);\n", " }\n", " return matchIndexes;\n", " }),\n", " \"odd\": createPositionalPseudo(function (matchIndexes, length) {\n", " var i = 1;\n", " for (; i < length; i += 2) {\n", " matchIndexes.push(i);\n", " }\n", " return matchIndexes;\n", " }),\n", " \"lt\": createPositionalPseudo(function (matchIndexes, length, argument) {\n", " var i = argument < 0 ?\n", " argument + length :\n", " argument > length ?\n", " length :\n", " argument;\n", " for (; --i >= 0;) {\n", " matchIndexes.push(i);\n", " }\n", " return matchIndexes;\n", " }),\n", " \"gt\": createPositionalPseudo(function (matchIndexes, length, argument) {\n", " var i = argument < 0 ? argument + length : argument;\n", " for (; ++i < length;) {\n", " matchIndexes.push(i);\n", " }\n", " return matchIndexes;\n", " })\n", " }\n", " };\n", " Expr.pseudos[\"nth\"] = Expr.pseudos[\"eq\"];\n", " // Add button/input type pseudos\n", " for (i in { radio: true, checkbox: true, file: true, password: true, image: true }) {\n", " Expr.pseudos[i] = createInputPseudo(i);\n", " }\n", " for (i in { submit: true, reset: true }) {\n", " Expr.pseudos[i] = createButtonPseudo(i);\n", " }\n", " // Easy API for creating new setFilters\n", " function setFilters() { }\n", " setFilters.prototype = Expr.filters = Expr.pseudos;\n", " Expr.setFilters = new setFilters();\n", " tokenize = Sizzle.tokenize = function (selector, parseOnly) {\n", " var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[selector + \" \"];\n", " if (cached) {\n", " return parseOnly ? 0 : cached.slice(0);\n", " }\n", " soFar = selector;\n", " groups = [];\n", " preFilters = Expr.preFilter;\n", " while (soFar) {\n", " // Comma and first run\n", " if (!matched || (match = rcomma.exec(soFar))) {\n", " if (match) {\n", " // Don't consume trailing commas as valid\n", " soFar = soFar.slice(match[0].length) || soFar;\n", " }\n", " groups.push((tokens = []));\n", " }\n", " matched = false;\n", " // Combinators\n", " if ((match = rcombinators.exec(soFar))) {\n", " matched = match.shift();\n", " tokens.push({\n", " value: matched,\n", " // Cast descendant combinators to space\n", " type: match[0].replace(rtrim, \" \")\n", " });\n", " soFar = soFar.slice(matched.length);\n", " }\n", " // Filters\n", " for (type in Expr.filter) {\n", " if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] ||\n", " (match = preFilters[type](match)))) {\n", " matched = match.shift();\n", " tokens.push({\n", " value: matched,\n", " type: type,\n", " matches: match\n", " });\n", " soFar = soFar.slice(matched.length);\n", " }\n", " }\n", " if (!matched) {\n", " break;\n", " }\n", " }\n", " // Return the length of the invalid excess\n", " // if we're just parsing\n", " // Otherwise, throw an error or return tokens\n", " return parseOnly ?\n", " soFar.length :\n", " soFar ?\n", " Sizzle.error(selector) :\n", " // Cache the tokens\n", " tokenCache(selector, groups).slice(0);\n", " };\n", " function toSelector(tokens) {\n", " var i = 0, len = tokens.length, selector = \"\";\n", " for (; i < len; i++) {\n", " selector += tokens[i].value;\n", " }\n", " return selector;\n", " }\n", " function addCombinator(matcher, combinator, base) {\n", " var dir = combinator.dir, skip = combinator.next, key = skip || dir, checkNonElements = base && key === \"parentNode\", doneName = done++;\n", " return combinator.first ?\n", " // Check against closest ancestor/preceding element\n", " function (elem, context, xml) {\n", " while ((elem = elem[dir])) {\n", " if (elem.nodeType === 1 || checkNonElements) {\n", " return matcher(elem, context, xml);\n", " }\n", " }\n", " return false;\n", " } :\n", " // Check against all ancestor/preceding elements\n", " function (elem, context, xml) {\n", " var oldCache, uniqueCache, outerCache, newCache = [dirruns, doneName];\n", " // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching\n", " if (xml) {\n", " while ((elem = elem[dir])) {\n", " if (elem.nodeType === 1 || checkNonElements) {\n", " if (matcher(elem, context, xml)) {\n", " return true;\n", " }\n", " }\n", " }\n", " }\n", " else {\n", " while ((elem = elem[dir])) {\n", " if (elem.nodeType === 1 || checkNonElements) {\n", " outerCache = elem[expando] || (elem[expando] = {});\n", " // Support: IE <9 only\n", " // Defend against cloned attroperties (jQuery gh-1709)\n", " uniqueCache = outerCache[elem.uniqueID] ||\n", " (outerCache[elem.uniqueID] = {});\n", " if (skip && skip === elem.nodeName.toLowerCase()) {\n", " elem = elem[dir] || elem;\n", " }\n", " else if ((oldCache = uniqueCache[key]) &&\n", " oldCache[0] === dirruns && oldCache[1] === doneName) {\n", " // Assign to newCache so results back-propagate to previous elements\n", " return (newCache[2] = oldCache[2]);\n", " }\n", " else {\n", " // Reuse newcache so results back-propagate to previous elements\n", " uniqueCache[key] = newCache;\n", " // A match means we're done; a fail means we have to keep checking\n", " if ((newCache[2] = matcher(elem, context, xml))) {\n", " return true;\n", " }\n", " }\n", " }\n", " }\n", " }\n", " return false;\n", " };\n", " }\n", " function elementMatcher(matchers) {\n", " return matchers.length > 1 ?\n", " function (elem, context, xml) {\n", " var i = matchers.length;\n", " while (i--) {\n", " if (!matchers[i](elem, context, xml)) {\n", " return false;\n", " }\n", " }\n", " return true;\n", " } :\n", " matchers[0];\n", " }\n", " function multipleContexts(selector, contexts, results) {\n", " var i = 0, len = contexts.length;\n", " for (; i < len; i++) {\n", " Sizzle(selector, contexts[i], results);\n", " }\n", " return results;\n", " }\n", " function condense(unmatched, map, filter, context, xml) {\n", " var elem, newUnmatched = [], i = 0, len = unmatched.length, mapped = map != null;\n", " for (; i < len; i++) {\n", " if ((elem = unmatched[i])) {\n", " if (!filter || filter(elem, context, xml)) {\n", " newUnmatched.push(elem);\n", " if (mapped) {\n", " map.push(i);\n", " }\n", " }\n", " }\n", " }\n", " return newUnmatched;\n", " }\n", " function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {\n", " if (postFilter && !postFilter[expando]) {\n", " postFilter = setMatcher(postFilter);\n", " }\n", " if (postFinder && !postFinder[expando]) {\n", " postFinder = setMatcher(postFinder, postSelector);\n", " }\n", " return markFunction(function (seed, results, context, xml) {\n", " var temp, i, elem, preMap = [], postMap = [], preexisting = results.length, \n", " // Get initial elements from seed or context\n", " elems = seed || multipleContexts(selector || \"*\", context.nodeType ? [context] : context, []), \n", " // Prefilter to get matcher input, preserving a map for seed-results synchronization\n", " matcherIn = preFilter && (seed || !selector) ?\n", " condense(elems, preMap, preFilter, context, xml) :\n", " elems, matcherOut = matcher ?\n", " // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,\n", " postFinder || (seed ? preFilter : preexisting || postFilter) ?\n", " // ...intermediate processing is necessary\n", " [] :\n", " // ...otherwise use results directly\n", " results :\n", " matcherIn;\n", " // Find primary matches\n", " if (matcher) {\n", " matcher(matcherIn, matcherOut, context, xml);\n", " }\n", " // Apply postFilter\n", " if (postFilter) {\n", " temp = condense(matcherOut, postMap);\n", " postFilter(temp, [], context, xml);\n", " // Un-match failing elements by moving them back to matcherIn\n", " i = temp.length;\n", " while (i--) {\n", " if ((elem = temp[i])) {\n", " matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem);\n", " }\n", " }\n", " }\n", " if (seed) {\n", " if (postFinder || preFilter) {\n", " if (postFinder) {\n", " // Get the final matcherOut by condensing this intermediate into postFinder contexts\n", " temp = [];\n", " i = matcherOut.length;\n", " while (i--) {\n", " if ((elem = matcherOut[i])) {\n", " // Restore matcherIn since elem is not yet a final match\n", " temp.push((matcherIn[i] = elem));\n", " }\n", " }\n", " postFinder(null, (matcherOut = []), temp, xml);\n", " }\n", " // Move matched elements from seed to results to keep them synchronized\n", " i = matcherOut.length;\n", " while (i--) {\n", " if ((elem = matcherOut[i]) &&\n", " (temp = postFinder ? indexOf(seed, elem) : preMap[i]) > -1) {\n", " seed[temp] = !(results[temp] = elem);\n", " }\n", " }\n", " }\n", " // Add elements to results, through postFinder if defined\n", " }\n", " else {\n", " matcherOut = condense(matcherOut === results ?\n", " matcherOut.splice(preexisting, matcherOut.length) :\n", " matcherOut);\n", " if (postFinder) {\n", " postFinder(null, results, matcherOut, xml);\n", " }\n", " else {\n", " push.apply(results, matcherOut);\n", " }\n", " }\n", " });\n", " }\n", " function matcherFromTokens(tokens) {\n", " var checkContext, matcher, j, len = tokens.length, leadingRelative = Expr.relative[tokens[0].type], implicitRelative = leadingRelative || Expr.relative[\" \"], i = leadingRelative ? 1 : 0, \n", " // The foundational matcher ensures that elements are reachable from top-level context(s)\n", " matchContext = addCombinator(function (elem) {\n", " return elem === checkContext;\n", " }, implicitRelative, true), matchAnyContext = addCombinator(function (elem) {\n", " return indexOf(checkContext, elem) > -1;\n", " }, implicitRelative, true), matchers = [function (elem, context, xml) {\n", " var ret = (!leadingRelative && (xml || context !== outermostContext)) || ((checkContext = context).nodeType ?\n", " matchContext(elem, context, xml) :\n", " matchAnyContext(elem, context, xml));\n", " // Avoid hanging onto element (issue #299)\n", " checkContext = null;\n", " return ret;\n", " }];\n", " for (; i < len; i++) {\n", " if ((matcher = Expr.relative[tokens[i].type])) {\n", " matchers = [addCombinator(elementMatcher(matchers), matcher)];\n", " }\n", " else {\n", " matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches);\n", " // Return special upon seeing a positional matcher\n", " if (matcher[expando]) {\n", " // Find the next relative operator (if any) for proper handling\n", " j = ++i;\n", " for (; j < len; j++) {\n", " if (Expr.relative[tokens[j].type]) {\n", " break;\n", " }\n", " }\n", " return setMatcher(i > 1 && elementMatcher(matchers), i > 1 && toSelector(\n", " // If the preceding token was a descendant combinator, insert an implicit any-element `*`\n", " tokens\n", " .slice(0, i - 1)\n", " .concat({ value: tokens[i - 2].type === \" \" ? \"*\" : \"\" })).replace(rtrim, \"$1\"), matcher, i < j && matcherFromTokens(tokens.slice(i, j)), j < len && matcherFromTokens((tokens = tokens.slice(j))), j < len && toSelector(tokens));\n", " }\n", " matchers.push(matcher);\n", " }\n", " }\n", " return elementMatcher(matchers);\n", " }\n", " function matcherFromGroupMatchers(elementMatchers, setMatchers) {\n", " var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function (seed, context, xml, results, outermost) {\n", " var elem, j, matcher, matchedCount = 0, i = \"0\", unmatched = seed && [], setMatched = [], contextBackup = outermostContext, \n", " // We must always have either seed elements or outermost context\n", " elems = seed || byElement && Expr.find[\"TAG\"](\"*\", outermost), \n", " // Use integer dirruns iff this is the outermost matcher\n", " dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), len = elems.length;\n", " if (outermost) {\n", " // Support: IE 11+, Edge 17 - 18+\n", " // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n", " // two documents; shallow comparisons work.\n", " // eslint-disable-next-line eqeqeq\n", " outermostContext = context == document || context || outermost;\n", " }\n", " // Add elements passing elementMatchers directly to results\n", " // Support: IE<9, Safari\n", " // Tolerate NodeList properties (IE: \"length\"; Safari: ) matching elements by id\n", " for (; i !== len && (elem = elems[i]) != null; i++) {\n", " if (byElement && elem) {\n", " j = 0;\n", " // Support: IE 11+, Edge 17 - 18+\n", " // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n", " // two documents; shallow comparisons work.\n", " // eslint-disable-next-line eqeqeq\n", " if (!context && elem.ownerDocument != document) {\n", " setDocument(elem);\n", " xml = !documentIsHTML;\n", " }\n", " while ((matcher = elementMatchers[j++])) {\n", " if (matcher(elem, context || document, xml)) {\n", " results.push(elem);\n", " break;\n", " }\n", " }\n", " if (outermost) {\n", " dirruns = dirrunsUnique;\n", " }\n", " }\n", " // Track unmatched elements for set filters\n", " if (bySet) {\n", " // They will have gone through all possible matchers\n", " if ((elem = !matcher && elem)) {\n", " matchedCount--;\n", " }\n", " // Lengthen the array for every element, matched or not\n", " if (seed) {\n", " unmatched.push(elem);\n", " }\n", " }\n", " }\n", " // `i` is now the count of elements visited above, and adding it to `matchedCount`\n", " // makes the latter nonnegative.\n", " matchedCount += i;\n", " // Apply set filters to unmatched elements\n", " // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`\n", " // equals `i`), unless we didn't visit _any_ elements in the above loop because we have\n", " // no element matchers and no seed.\n", " // Incrementing an initially-string \"0\" `i` allows `i` to remain a string only in that\n", " // case, which will result in a \"00\" `matchedCount` that differs from `i` but is also\n", " // numerically zero.\n", " if (bySet && i !== matchedCount) {\n", " j = 0;\n", " while ((matcher = setMatchers[j++])) {\n", " matcher(unmatched, setMatched, context, xml);\n", " }\n", " if (seed) {\n", " // Reintegrate element matches to eliminate the need for sorting\n", " if (matchedCount > 0) {\n", " while (i--) {\n", " if (!(unmatched[i] || setMatched[i])) {\n", " setMatched[i] = pop.call(results);\n", " }\n", " }\n", " }\n", " // Discard index placeholder values to get only actual matches\n", " setMatched = condense(setMatched);\n", " }\n", " // Add matches to results\n", " push.apply(results, setMatched);\n", " // Seedless set matches succeeding multiple successful matchers stipulate sorting\n", " if (outermost && !seed && setMatched.length > 0 &&\n", " (matchedCount + setMatchers.length) > 1) {\n", " Sizzle.uniqueSort(results);\n", " }\n", " }\n", " // Override manipulation of globals by nested matchers\n", " if (outermost) {\n", " dirruns = dirrunsUnique;\n", " outermostContext = contextBackup;\n", " }\n", " return unmatched;\n", " };\n", " return bySet ?\n", " markFunction(superMatcher) :\n", " superMatcher;\n", " }\n", " compile = Sizzle.compile = function (selector, match /* Internal Use Only */) {\n", " var i, setMatchers = [], elementMatchers = [], cached = compilerCache[selector + \" \"];\n", " if (!cached) {\n", " // Generate a function of recursive functions that can be used to check each element\n", " if (!match) {\n", " match = tokenize(selector);\n", " }\n", " i = match.length;\n", " while (i--) {\n", " cached = matcherFromTokens(match[i]);\n", " if (cached[expando]) {\n", " setMatchers.push(cached);\n", " }\n", " else {\n", " elementMatchers.push(cached);\n", " }\n", " }\n", " // Cache the compiled function\n", " cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers));\n", " // Save selector and tokenization\n", " cached.selector = selector;\n", " }\n", " return cached;\n", " };\n", " /**\n", " * A low-level selection function that works with Sizzle's compiled\n", " * selector functions\n", " * @param {String|Function} selector A selector or a pre-compiled\n", " * selector function built with Sizzle.compile\n", " * @param {Element} context\n", " * @param {Array} [results]\n", " * @param {Array} [seed] A set of elements to match against\n", " */\n", " select = Sizzle.select = function (selector, context, results, seed) {\n", " var i, tokens, token, type, find, compiled = typeof selector === \"function\" && selector, match = !seed && tokenize((selector = compiled.selector || selector));\n", " results = results || [];\n", " // Try to minimize operations if there is only one selector in the list and no seed\n", " // (the latter of which guarantees us context)\n", " if (match.length === 1) {\n", " // Reduce context if the leading compound selector is an ID\n", " tokens = match[0] = match[0].slice(0);\n", " if (tokens.length > 2 && (token = tokens[0]).type === \"ID\" &&\n", " context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {\n", " context = (Expr.find[\"ID\"](token.matches[0]\n", " .replace(runescape, funescape), context) || [])[0];\n", " if (!context) {\n", " return results;\n", " // Precompiled matchers will still verify ancestry, so step up a level\n", " }\n", " else if (compiled) {\n", " context = context.parentNode;\n", " }\n", " selector = selector.slice(tokens.shift().value.length);\n", " }\n", " // Fetch a seed set for right-to-left matching\n", " i = matchExpr[\"needsContext\"].test(selector) ? 0 : tokens.length;\n", " while (i--) {\n", " token = tokens[i];\n", " // Abort if we hit a combinator\n", " if (Expr.relative[(type = token.type)]) {\n", " break;\n", " }\n", " if ((find = Expr.find[type])) {\n", " // Search, expanding context for leading sibling combinators\n", " if ((seed = find(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testContext(context.parentNode) ||\n", " context))) {\n", " // If seed is empty or no tokens remain, we can return early\n", " tokens.splice(i, 1);\n", " selector = seed.length && toSelector(tokens);\n", " if (!selector) {\n", " push.apply(results, seed);\n", " return results;\n", " }\n", " break;\n", " }\n", " }\n", " }\n", " }\n", " // Compile and execute a filtering function if one is not provided\n", " // Provide `match` to avoid retokenization if we modified the selector above\n", " (compiled || compile(selector, match))(seed, context, !documentIsHTML, results, !context || rsibling.test(selector) && testContext(context.parentNode) || context);\n", " return results;\n", " };\n", " // One-time assignments\n", " // Sort stability\n", " support.sortStable = expando.split(\"\").sort(sortOrder).join(\"\") === expando;\n", " // Support: Chrome 14-35+\n", " // Always assume duplicates if they aren't passed to the comparison function\n", " support.detectDuplicates = !!hasDuplicate;\n", " // Initialize against the default document\n", " setDocument();\n", " // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)\n", " // Detached nodes confoundingly follow *each other*\n", " support.sortDetached = assert(function (el) {\n", " // Should return 1, but returns 4 (following)\n", " return el.compareDocumentPosition(document.createElement(\"fieldset\")) & 1;\n", " });\n", " // Support: IE<8\n", " // Prevent attribute/property \"interpolation\"\n", " // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx\n", " if (!assert(function (el) {\n", " el.innerHTML = \"\";\n", " return el.firstChild.getAttribute(\"href\") === \"#\";\n", " })) {\n", " addHandle(\"type|href|height|width\", function (elem, name, isXML) {\n", " if (!isXML) {\n", " return elem.getAttribute(name, name.toLowerCase() === \"type\" ? 1 : 2);\n", " }\n", " });\n", " }\n", " // Support: IE<9\n", " // Use defaultValue in place of getAttribute(\"value\")\n", " if (!support.attributes || !assert(function (el) {\n", " el.innerHTML = \"\";\n", " el.firstChild.setAttribute(\"value\", \"\");\n", " return el.firstChild.getAttribute(\"value\") === \"\";\n", " })) {\n", " addHandle(\"value\", function (elem, _name, isXML) {\n", " if (!isXML && elem.nodeName.toLowerCase() === \"input\") {\n", " return elem.defaultValue;\n", " }\n", " });\n", " }\n", " // Support: IE<9\n", " // Use getAttributeNode to fetch booleans when getAttribute lies\n", " if (!assert(function (el) {\n", " return el.getAttribute(\"disabled\") == null;\n", " })) {\n", " addHandle(booleans, function (elem, name, isXML) {\n", " var val;\n", " if (!isXML) {\n", " return elem[name] === true ? name.toLowerCase() :\n", " (val = elem.getAttributeNode(name)) && val.specified ?\n", " val.value :\n", " null;\n", " }\n", " });\n", " }\n", " return Sizzle;\n", " })(window);\n", " jQuery.find = Sizzle;\n", " jQuery.expr = Sizzle.selectors;\n", " // Deprecated\n", " jQuery.expr[\":\"] = jQuery.expr.pseudos;\n", " jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;\n", " jQuery.text = Sizzle.getText;\n", " jQuery.isXMLDoc = Sizzle.isXML;\n", " jQuery.contains = Sizzle.contains;\n", " jQuery.escapeSelector = Sizzle.escape;\n", " var dir = function (elem, dir, until) {\n", " var matched = [], truncate = until !== undefined;\n", " while ((elem = elem[dir]) && elem.nodeType !== 9) {\n", " if (elem.nodeType === 1) {\n", " if (truncate && jQuery(elem).is(until)) {\n", " break;\n", " }\n", " matched.push(elem);\n", " }\n", " }\n", " return matched;\n", " };\n", " var siblings = function (n, elem) {\n", " var matched = [];\n", " for (; n; n = n.nextSibling) {\n", " if (n.nodeType === 1 && n !== elem) {\n", " matched.push(n);\n", " }\n", " }\n", " return matched;\n", " };\n", " var rneedsContext = jQuery.expr.match.needsContext;\n", " function nodeName(elem, name) {\n", " return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();\n", " }\n", " ;\n", " var rsingleTag = (/^<([a-z][^\\/\\0>:\\x20\\t\\r\\n\\f]*)[\\x20\\t\\r\\n\\f]*\\/?>(?:<\\/\\1>|)$/i);\n", " // Implement the identical functionality for filter and not\n", " function winnow(elements, qualifier, not) {\n", " if (isFunction(qualifier)) {\n", " return jQuery.grep(elements, function (elem, i) {\n", " return !!qualifier.call(elem, i, elem) !== not;\n", " });\n", " }\n", " // Single element\n", " if (qualifier.nodeType) {\n", " return jQuery.grep(elements, function (elem) {\n", " return (elem === qualifier) !== not;\n", " });\n", " }\n", " // Arraylike of elements (jQuery, arguments, Array)\n", " if (typeof qualifier !== \"string\") {\n", " return jQuery.grep(elements, function (elem) {\n", " return (indexOf.call(qualifier, elem) > -1) !== not;\n", " });\n", " }\n", " // Filtered directly for both simple and complex selectors\n", " return jQuery.filter(qualifier, elements, not);\n", " }\n", " jQuery.filter = function (expr, elems, not) {\n", " var elem = elems[0];\n", " if (not) {\n", " expr = \":not(\" + expr + \")\";\n", " }\n", " if (elems.length === 1 && elem.nodeType === 1) {\n", " return jQuery.find.matchesSelector(elem, expr) ? [elem] : [];\n", " }\n", " return jQuery.find.matches(expr, jQuery.grep(elems, function (elem) {\n", " return elem.nodeType === 1;\n", " }));\n", " };\n", " jQuery.fn.extend({\n", " find: function (selector) {\n", " var i, ret, len = this.length, self = this;\n", " if (typeof selector !== \"string\") {\n", " return this.pushStack(jQuery(selector).filter(function () {\n", " for (i = 0; i < len; i++) {\n", " if (jQuery.contains(self[i], this)) {\n", " return true;\n", " }\n", " }\n", " }));\n", " }\n", " ret = this.pushStack([]);\n", " for (i = 0; i < len; i++) {\n", " jQuery.find(selector, self[i], ret);\n", " }\n", " return len > 1 ? jQuery.uniqueSort(ret) : ret;\n", " },\n", " filter: function (selector) {\n", " return this.pushStack(winnow(this, selector || [], false));\n", " },\n", " not: function (selector) {\n", " return this.pushStack(winnow(this, selector || [], true));\n", " },\n", " is: function (selector) {\n", " return !!winnow(this, \n", " // If this is a positional/relative selector, check membership in the returned set\n", " // so $(\"p:first\").is(\"p:last\") won't return true for a doc with two \"p\".\n", " typeof selector === \"string\" && rneedsContext.test(selector) ?\n", " jQuery(selector) :\n", " selector || [], false).length;\n", " }\n", " });\n", " // Initialize a jQuery object\n", " // A central reference to the root jQuery(document)\n", " var rootjQuery, \n", " // A simple way to check for HTML strings\n", " // Prioritize #id over to avoid XSS via location.hash (#9521)\n", " // Strict HTML recognition (#11290: must start with <)\n", " // Shortcut simple #id case for speed\n", " rquickExpr = /^(?:\\s*(<[\\w\\W]+>)[^>]*|#([\\w-]+))$/, init = jQuery.fn.init = function (selector, context, root) {\n", " var match, elem;\n", " // HANDLE: $(\"\"), $(null), $(undefined), $(false)\n", " if (!selector) {\n", " return this;\n", " }\n", " // Method init() accepts an alternate rootjQuery\n", " // so migrate can support jQuery.sub (gh-2101)\n", " root = root || rootjQuery;\n", " // Handle HTML strings\n", " if (typeof selector === \"string\") {\n", " if (selector[0] === \"<\" &&\n", " selector[selector.length - 1] === \">\" &&\n", " selector.length >= 3) {\n", " // Assume that strings that start and end with <> are HTML and skip the regex check\n", " match = [null, selector, null];\n", " }\n", " else {\n", " match = rquickExpr.exec(selector);\n", " }\n", " // Match html or make sure no context is specified for #id\n", " if (match && (match[1] || !context)) {\n", " // HANDLE: $(html) -> $(array)\n", " if (match[1]) {\n", " context = context instanceof jQuery ? context[0] : context;\n", " // Option to run scripts is true for back-compat\n", " // Intentionally let the error be thrown if parseHTML is not present\n", " jQuery.merge(this, jQuery.parseHTML(match[1], context && context.nodeType ? context.ownerDocument || context : document, true));\n", " // HANDLE: $(html, props)\n", " if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {\n", " for (match in context) {\n", " // Properties of context are called as methods if possible\n", " if (isFunction(this[match])) {\n", " this[match](context[match]);\n", " // ...and otherwise set as attributes\n", " }\n", " else {\n", " this.attr(match, context[match]);\n", " }\n", " }\n", " }\n", " return this;\n", " // HANDLE: $(#id)\n", " }\n", " else {\n", " elem = document.getElementById(match[2]);\n", " if (elem) {\n", " // Inject the element directly into the jQuery object\n", " this[0] = elem;\n", " this.length = 1;\n", " }\n", " return this;\n", " }\n", " // HANDLE: $(expr, $(...))\n", " }\n", " else if (!context || context.jquery) {\n", " return (context || root).find(selector);\n", " // HANDLE: $(expr, context)\n", " // (which is just equivalent to: $(context).find(expr)\n", " }\n", " else {\n", " return this.constructor(context).find(selector);\n", " }\n", " // HANDLE: $(DOMElement)\n", " }\n", " else if (selector.nodeType) {\n", " this[0] = selector;\n", " this.length = 1;\n", " return this;\n", " // HANDLE: $(function)\n", " // Shortcut for document ready\n", " }\n", " else if (isFunction(selector)) {\n", " return root.ready !== undefined ?\n", " root.ready(selector) :\n", " // Execute immediately if ready is not present\n", " selector(jQuery);\n", " }\n", " return jQuery.makeArray(selector, this);\n", " };\n", " // Give the init function the jQuery prototype for later instantiation\n", " init.prototype = jQuery.fn;\n", " // Initialize central reference\n", " rootjQuery = jQuery(document);\n", " var rparentsprev = /^(?:parents|prev(?:Until|All))/, \n", " // Methods guaranteed to produce a unique set when starting from a unique set\n", " guaranteedUnique = {\n", " children: true,\n", " contents: true,\n", " next: true,\n", " prev: true\n", " };\n", " jQuery.fn.extend({\n", " has: function (target) {\n", " var targets = jQuery(target, this), l = targets.length;\n", " return this.filter(function () {\n", " var i = 0;\n", " for (; i < l; i++) {\n", " if (jQuery.contains(this, targets[i])) {\n", " return true;\n", " }\n", " }\n", " });\n", " },\n", " closest: function (selectors, context) {\n", " var cur, i = 0, l = this.length, matched = [], targets = typeof selectors !== \"string\" && jQuery(selectors);\n", " // Positional selectors never match, since there's no _selection_ context\n", " if (!rneedsContext.test(selectors)) {\n", " for (; i < l; i++) {\n", " for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) {\n", " // Always skip document fragments\n", " if (cur.nodeType < 11 && (targets ?\n", " targets.index(cur) > -1 :\n", " // Don't pass non-elements to Sizzle\n", " cur.nodeType === 1 &&\n", " jQuery.find.matchesSelector(cur, selectors))) {\n", " matched.push(cur);\n", " break;\n", " }\n", " }\n", " }\n", " }\n", " return this.pushStack(matched.length > 1 ? jQuery.uniqueSort(matched) : matched);\n", " },\n", " // Determine the position of an element within the set\n", " index: function (elem) {\n", " // No argument, return index in parent\n", " if (!elem) {\n", " return (this[0] && this[0].parentNode) ? this.first().prevAll().length : -1;\n", " }\n", " // Index in selector\n", " if (typeof elem === \"string\") {\n", " return indexOf.call(jQuery(elem), this[0]);\n", " }\n", " // Locate the position of the desired element\n", " return indexOf.call(this, \n", " // If it receives a jQuery object, the first element is used\n", " elem.jquery ? elem[0] : elem);\n", " },\n", " add: function (selector, context) {\n", " return this.pushStack(jQuery.uniqueSort(jQuery.merge(this.get(), jQuery(selector, context))));\n", " },\n", " addBack: function (selector) {\n", " return this.add(selector == null ?\n", " this.prevObject : this.prevObject.filter(selector));\n", " }\n", " });\n", " function sibling(cur, dir) {\n", " while ((cur = cur[dir]) && cur.nodeType !== 1) { }\n", " return cur;\n", " }\n", " jQuery.each({\n", " parent: function (elem) {\n", " var parent = elem.parentNode;\n", " return parent && parent.nodeType !== 11 ? parent : null;\n", " },\n", " parents: function (elem) {\n", " return dir(elem, \"parentNode\");\n", " },\n", " parentsUntil: function (elem, _i, until) {\n", " return dir(elem, \"parentNode\", until);\n", " },\n", " next: function (elem) {\n", " return sibling(elem, \"nextSibling\");\n", " },\n", " prev: function (elem) {\n", " return sibling(elem, \"previousSibling\");\n", " },\n", " nextAll: function (elem) {\n", " return dir(elem, \"nextSibling\");\n", " },\n", " prevAll: function (elem) {\n", " return dir(elem, \"previousSibling\");\n", " },\n", " nextUntil: function (elem, _i, until) {\n", " return dir(elem, \"nextSibling\", until);\n", " },\n", " prevUntil: function (elem, _i, until) {\n", " return dir(elem, \"previousSibling\", until);\n", " },\n", " siblings: function (elem) {\n", " return siblings((elem.parentNode || {}).firstChild, elem);\n", " },\n", " children: function (elem) {\n", " return siblings(elem.firstChild);\n", " },\n", " contents: function (elem) {\n", " if (elem.contentDocument != null &&\n", " // Support: IE 11+\n", " // elements with no `data` attribute has an object\n", " // `contentDocument` with a `null` prototype.\n", " getProto(elem.contentDocument)) {\n", " return elem.contentDocument;\n", " }\n", " // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only\n", " // Treat the template element as a regular one in browsers that\n", " // don't support it.\n", " if (nodeName(elem, \"template\")) {\n", " elem = elem.content || elem;\n", " }\n", " return jQuery.merge([], elem.childNodes);\n", " }\n", " }, function (name, fn) {\n", " jQuery.fn[name] = function (until, selector) {\n", " var matched = jQuery.map(this, fn, until);\n", " if (name.slice(-5) !== \"Until\") {\n", " selector = until;\n", " }\n", " if (selector && typeof selector === \"string\") {\n", " matched = jQuery.filter(selector, matched);\n", " }\n", " if (this.length > 1) {\n", " // Remove duplicates\n", " if (!guaranteedUnique[name]) {\n", " jQuery.uniqueSort(matched);\n", " }\n", " // Reverse order for parents* and prev-derivatives\n", " if (rparentsprev.test(name)) {\n", " matched.reverse();\n", " }\n", " }\n", " return this.pushStack(matched);\n", " };\n", " });\n", " var rnothtmlwhite = (/[^\\x20\\t\\r\\n\\f]+/g);\n", " // Convert String-formatted options into Object-formatted ones\n", " function createOptions(options) {\n", " var object = {};\n", " jQuery.each(options.match(rnothtmlwhite) || [], function (_, flag) {\n", " object[flag] = true;\n", " });\n", " return object;\n", " }\n", " /*\n", " * Create a callback list using the following parameters:\n", " *\n", " *\toptions: an optional list of space-separated options that will change how\n", " *\t\t\tthe callback list behaves or a more traditional option object\n", " *\n", " * By default a callback list will act like an event callback list and can be\n", " * \"fired\" multiple times.\n", " *\n", " * Possible options:\n", " *\n", " *\tonce:\t\t\twill ensure the callback list can only be fired once (like a Deferred)\n", " *\n", " *\tmemory:\t\t\twill keep track of previous values and will call any callback added\n", " *\t\t\t\t\tafter the list has been fired right away with the latest \"memorized\"\n", " *\t\t\t\t\tvalues (like a Deferred)\n", " *\n", " *\tunique:\t\t\twill ensure a callback can only be added once (no duplicate in the list)\n", " *\n", " *\tstopOnFalse:\tinterrupt callings when a callback returns false\n", " *\n", " */\n", " jQuery.Callbacks = function (options) {\n", " // Convert options from String-formatted to Object-formatted if needed\n", " // (we check in cache first)\n", " options = typeof options === \"string\" ?\n", " createOptions(options) :\n", " jQuery.extend({}, options);\n", " var // Flag to know if list is currently firing\n", " firing, \n", " // Last fire value for non-forgettable lists\n", " memory, \n", " // Flag to know if list was already fired\n", " fired, \n", " // Flag to prevent firing\n", " locked, \n", " // Actual callback list\n", " list = [], \n", " // Queue of execution data for repeatable lists\n", " queue = [], \n", " // Index of currently firing callback (modified by add/remove as needed)\n", " firingIndex = -1, \n", " // Fire callbacks\n", " fire = function () {\n", " // Enforce single-firing\n", " locked = locked || options.once;\n", " // Execute callbacks for all pending executions,\n", " // respecting firingIndex overrides and runtime changes\n", " fired = firing = true;\n", " for (; queue.length; firingIndex = -1) {\n", " memory = queue.shift();\n", " while (++firingIndex < list.length) {\n", " // Run callback and check for early termination\n", " if (list[firingIndex].apply(memory[0], memory[1]) === false &&\n", " options.stopOnFalse) {\n", " // Jump to end and forget the data so .add doesn't re-fire\n", " firingIndex = list.length;\n", " memory = false;\n", " }\n", " }\n", " }\n", " // Forget the data if we're done with it\n", " if (!options.memory) {\n", " memory = false;\n", " }\n", " firing = false;\n", " // Clean up if we're done firing for good\n", " if (locked) {\n", " // Keep an empty list if we have data for future add calls\n", " if (memory) {\n", " list = [];\n", " // Otherwise, this object is spent\n", " }\n", " else {\n", " list = \"\";\n", " }\n", " }\n", " }, \n", " // Actual Callbacks object\n", " self = {\n", " // Add a callback or a collection of callbacks to the list\n", " add: function () {\n", " if (list) {\n", " // If we have memory from a past run, we should fire after adding\n", " if (memory && !firing) {\n", " firingIndex = list.length - 1;\n", " queue.push(memory);\n", " }\n", " (function add(args) {\n", " jQuery.each(args, function (_, arg) {\n", " if (isFunction(arg)) {\n", " if (!options.unique || !self.has(arg)) {\n", " list.push(arg);\n", " }\n", " }\n", " else if (arg && arg.length && toType(arg) !== \"string\") {\n", " // Inspect recursively\n", " add(arg);\n", " }\n", " });\n", " })(arguments);\n", " if (memory && !firing) {\n", " fire();\n", " }\n", " }\n", " return this;\n", " },\n", " // Remove a callback from the list\n", " remove: function () {\n", " jQuery.each(arguments, function (_, arg) {\n", " var index;\n", " while ((index = jQuery.inArray(arg, list, index)) > -1) {\n", " list.splice(index, 1);\n", " // Handle firing indexes\n", " if (index <= firingIndex) {\n", " firingIndex--;\n", " }\n", " }\n", " });\n", " return this;\n", " },\n", " // Check if a given callback is in the list.\n", " // If no argument is given, return whether or not list has callbacks attached.\n", " has: function (fn) {\n", " return fn ?\n", " jQuery.inArray(fn, list) > -1 :\n", " list.length > 0;\n", " },\n", " // Remove all callbacks from the list\n", " empty: function () {\n", " if (list) {\n", " list = [];\n", " }\n", " return this;\n", " },\n", " // Disable .fire and .add\n", " // Abort any current/pending executions\n", " // Clear all callbacks and values\n", " disable: function () {\n", " locked = queue = [];\n", " list = memory = \"\";\n", " return this;\n", " },\n", " disabled: function () {\n", " return !list;\n", " },\n", " // Disable .fire\n", " // Also disable .add unless we have memory (since it would have no effect)\n", " // Abort any pending executions\n", " lock: function () {\n", " locked = queue = [];\n", " if (!memory && !firing) {\n", " list = memory = \"\";\n", " }\n", " return this;\n", " },\n", " locked: function () {\n", " return !!locked;\n", " },\n", " // Call all callbacks with the given context and arguments\n", " fireWith: function (context, args) {\n", " if (!locked) {\n", " args = args || [];\n", " args = [context, args.slice ? args.slice() : args];\n", " queue.push(args);\n", " if (!firing) {\n", " fire();\n", " }\n", " }\n", " return this;\n", " },\n", " // Call all the callbacks with the given arguments\n", " fire: function () {\n", " self.fireWith(this, arguments);\n", " return this;\n", " },\n", " // To know if the callbacks have already been called at least once\n", " fired: function () {\n", " return !!fired;\n", " }\n", " };\n", " return self;\n", " };\n", " function Identity(v) {\n", " return v;\n", " }\n", " function Thrower(ex) {\n", " throw ex;\n", " }\n", " function adoptValue(value, resolve, reject, noValue) {\n", " var method;\n", " try {\n", " // Check for promise aspect first to privilege synchronous behavior\n", " if (value && isFunction((method = value.promise))) {\n", " method.call(value).done(resolve).fail(reject);\n", " // Other thenables\n", " }\n", " else if (value && isFunction((method = value.then))) {\n", " method.call(value, resolve, reject);\n", " // Other non-thenables\n", " }\n", " else {\n", " // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:\n", " // * false: [ value ].slice( 0 ) => resolve( value )\n", " // * true: [ value ].slice( 1 ) => resolve()\n", " resolve.apply(undefined, [value].slice(noValue));\n", " }\n", " // For Promises/A+, convert exceptions into rejections\n", " // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in\n", " // Deferred#then to conditionally suppress rejection.\n", " }\n", " catch (value) {\n", " // Support: Android 4.0 only\n", " // Strict mode functions invoked without .call/.apply get global-object context\n", " reject.apply(undefined, [value]);\n", " }\n", " }\n", " jQuery.extend({\n", " Deferred: function (func) {\n", " var tuples = [\n", " // action, add listener, callbacks,\n", " // ... .then handlers, argument index, [final state]\n", " [\"notify\", \"progress\", jQuery.Callbacks(\"memory\"),\n", " jQuery.Callbacks(\"memory\"), 2],\n", " [\"resolve\", \"done\", jQuery.Callbacks(\"once memory\"),\n", " jQuery.Callbacks(\"once memory\"), 0, \"resolved\"],\n", " [\"reject\", \"fail\", jQuery.Callbacks(\"once memory\"),\n", " jQuery.Callbacks(\"once memory\"), 1, \"rejected\"]\n", " ], state = \"pending\", promise = {\n", " state: function () {\n", " return state;\n", " },\n", " always: function () {\n", " deferred.done(arguments).fail(arguments);\n", " return this;\n", " },\n", " \"catch\": function (fn) {\n", " return promise.then(null, fn);\n", " },\n", " // Keep pipe for back-compat\n", " pipe: function ( /* fnDone, fnFail, fnProgress */) {\n", " var fns = arguments;\n", " return jQuery.Deferred(function (newDefer) {\n", " jQuery.each(tuples, function (_i, tuple) {\n", " // Map tuples (progress, done, fail) to arguments (done, fail, progress)\n", " var fn = isFunction(fns[tuple[4]]) && fns[tuple[4]];\n", " // deferred.progress(function() { bind to newDefer or newDefer.notify })\n", " // deferred.done(function() { bind to newDefer or newDefer.resolve })\n", " // deferred.fail(function() { bind to newDefer or newDefer.reject })\n", " deferred[tuple[1]](function () {\n", " var returned = fn && fn.apply(this, arguments);\n", " if (returned && isFunction(returned.promise)) {\n", " returned.promise()\n", " .progress(newDefer.notify)\n", " .done(newDefer.resolve)\n", " .fail(newDefer.reject);\n", " }\n", " else {\n", " newDefer[tuple[0] + \"With\"](this, fn ? [returned] : arguments);\n", " }\n", " });\n", " });\n", " fns = null;\n", " }).promise();\n", " },\n", " then: function (onFulfilled, onRejected, onProgress) {\n", " var maxDepth = 0;\n", " function resolve(depth, deferred, handler, special) {\n", " return function () {\n", " var that = this, args = arguments, mightThrow = function () {\n", " var returned, then;\n", " // Support: Promises/A+ section 2.3.3.3.3\n", " // https://promisesaplus.com/#point-59\n", " // Ignore double-resolution attempts\n", " if (depth < maxDepth) {\n", " return;\n", " }\n", " returned = handler.apply(that, args);\n", " // Support: Promises/A+ section 2.3.1\n", " // https://promisesaplus.com/#point-48\n", " if (returned === deferred.promise()) {\n", " throw new TypeError(\"Thenable self-resolution\");\n", " }\n", " // Support: Promises/A+ sections 2.3.3.1, 3.5\n", " // https://promisesaplus.com/#point-54\n", " // https://promisesaplus.com/#point-75\n", " // Retrieve `then` only once\n", " then = returned &&\n", " // Support: Promises/A+ section 2.3.4\n", " // https://promisesaplus.com/#point-64\n", " // Only check objects and functions for thenability\n", " (typeof returned === \"object\" ||\n", " typeof returned === \"function\") &&\n", " returned.then;\n", " // Handle a returned thenable\n", " if (isFunction(then)) {\n", " // Special processors (notify) just wait for resolution\n", " if (special) {\n", " then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special));\n", " // Normal processors (resolve) also hook into progress\n", " }\n", " else {\n", " // ...and disregard older resolution values\n", " maxDepth++;\n", " then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special), resolve(maxDepth, deferred, Identity, deferred.notifyWith));\n", " }\n", " // Handle all other returned values\n", " }\n", " else {\n", " // Only substitute handlers pass on context\n", " // and multiple values (non-spec behavior)\n", " if (handler !== Identity) {\n", " that = undefined;\n", " args = [returned];\n", " }\n", " // Process the value(s)\n", " // Default process is resolve\n", " (special || deferred.resolveWith)(that, args);\n", " }\n", " }, \n", " // Only normal processors (resolve) catch and reject exceptions\n", " process = special ?\n", " mightThrow :\n", " function () {\n", " try {\n", " mightThrow();\n", " }\n", " catch (e) {\n", " if (jQuery.Deferred.exceptionHook) {\n", " jQuery.Deferred.exceptionHook(e, process.stackTrace);\n", " }\n", " // Support: Promises/A+ section 2.3.3.3.4.1\n", " // https://promisesaplus.com/#point-61\n", " // Ignore post-resolution exceptions\n", " if (depth + 1 >= maxDepth) {\n", " // Only substitute handlers pass on context\n", " // and multiple values (non-spec behavior)\n", " if (handler !== Thrower) {\n", " that = undefined;\n", " args = [e];\n", " }\n", " deferred.rejectWith(that, args);\n", " }\n", " }\n", " };\n", " // Support: Promises/A+ section 2.3.3.3.1\n", " // https://promisesaplus.com/#point-57\n", " // Re-resolve promises immediately to dodge false rejection from\n", " // subsequent errors\n", " if (depth) {\n", " process();\n", " }\n", " else {\n", " // Call an optional hook to record the stack, in case of exception\n", " // since it's otherwise lost when execution goes async\n", " if (jQuery.Deferred.getStackHook) {\n", " process.stackTrace = jQuery.Deferred.getStackHook();\n", " }\n", " window.setTimeout(process);\n", " }\n", " };\n", " }\n", " return jQuery.Deferred(function (newDefer) {\n", " // progress_handlers.add( ... )\n", " tuples[0][3].add(resolve(0, newDefer, isFunction(onProgress) ?\n", " onProgress :\n", " Identity, newDefer.notifyWith));\n", " // fulfilled_handlers.add( ... )\n", " tuples[1][3].add(resolve(0, newDefer, isFunction(onFulfilled) ?\n", " onFulfilled :\n", " Identity));\n", " // rejected_handlers.add( ... )\n", " tuples[2][3].add(resolve(0, newDefer, isFunction(onRejected) ?\n", " onRejected :\n", " Thrower));\n", " }).promise();\n", " },\n", " // Get a promise for this deferred\n", " // If obj is provided, the promise aspect is added to the object\n", " promise: function (obj) {\n", " return obj != null ? jQuery.extend(obj, promise) : promise;\n", " }\n", " }, deferred = {};\n", " // Add list-specific methods\n", " jQuery.each(tuples, function (i, tuple) {\n", " var list = tuple[2], stateString = tuple[5];\n", " // promise.progress = list.add\n", " // promise.done = list.add\n", " // promise.fail = list.add\n", " promise[tuple[1]] = list.add;\n", " // Handle state\n", " if (stateString) {\n", " list.add(function () {\n", " // state = \"resolved\" (i.e., fulfilled)\n", " // state = \"rejected\"\n", " state = stateString;\n", " }, \n", " // rejected_callbacks.disable\n", " // fulfilled_callbacks.disable\n", " tuples[3 - i][2].disable, \n", " // rejected_handlers.disable\n", " // fulfilled_handlers.disable\n", " tuples[3 - i][3].disable, \n", " // progress_callbacks.lock\n", " tuples[0][2].lock, \n", " // progress_handlers.lock\n", " tuples[0][3].lock);\n", " }\n", " // progress_handlers.fire\n", " // fulfilled_handlers.fire\n", " // rejected_handlers.fire\n", " list.add(tuple[3].fire);\n", " // deferred.notify = function() { deferred.notifyWith(...) }\n", " // deferred.resolve = function() { deferred.resolveWith(...) }\n", " // deferred.reject = function() { deferred.rejectWith(...) }\n", " deferred[tuple[0]] = function () {\n", " deferred[tuple[0] + \"With\"](this === deferred ? undefined : this, arguments);\n", " return this;\n", " };\n", " // deferred.notifyWith = list.fireWith\n", " // deferred.resolveWith = list.fireWith\n", " // deferred.rejectWith = list.fireWith\n", " deferred[tuple[0] + \"With\"] = list.fireWith;\n", " });\n", " // Make the deferred a promise\n", " promise.promise(deferred);\n", " // Call given func if any\n", " if (func) {\n", " func.call(deferred, deferred);\n", " }\n", " // All done!\n", " return deferred;\n", " },\n", " // Deferred helper\n", " when: function (singleValue) {\n", " var \n", " // count of uncompleted subordinates\n", " remaining = arguments.length, \n", " // count of unprocessed arguments\n", " i = remaining, \n", " // subordinate fulfillment data\n", " resolveContexts = Array(i), resolveValues = slice.call(arguments), \n", " // the master Deferred\n", " master = jQuery.Deferred(), \n", " // subordinate callback factory\n", " updateFunc = function (i) {\n", " return function (value) {\n", " resolveContexts[i] = this;\n", " resolveValues[i] = arguments.length > 1 ? slice.call(arguments) : value;\n", " if (!(--remaining)) {\n", " master.resolveWith(resolveContexts, resolveValues);\n", " }\n", " };\n", " };\n", " // Single- and empty arguments are adopted like Promise.resolve\n", " if (remaining <= 1) {\n", " adoptValue(singleValue, master.done(updateFunc(i)).resolve, master.reject, !remaining);\n", " // Use .then() to unwrap secondary thenables (cf. gh-3000)\n", " if (master.state() === \"pending\" ||\n", " isFunction(resolveValues[i] && resolveValues[i].then)) {\n", " return master.then();\n", " }\n", " }\n", " // Multiple arguments are aggregated like Promise.all array elements\n", " while (i--) {\n", " adoptValue(resolveValues[i], updateFunc(i), master.reject);\n", " }\n", " return master.promise();\n", " }\n", " });\n", " // These usually indicate a programmer mistake during development,\n", " // warn about them ASAP rather than swallowing them by default.\n", " var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;\n", " jQuery.Deferred.exceptionHook = function (error, stack) {\n", " // Support: IE 8 - 9 only\n", " // Console exists when dev tools are open, which can happen at any time\n", " if (window.console && window.console.warn && error && rerrorNames.test(error.name)) {\n", " window.console.warn(\"jQuery.Deferred exception: \" + error.message, error.stack, stack);\n", " }\n", " };\n", " jQuery.readyException = function (error) {\n", " window.setTimeout(function () {\n", " throw error;\n", " });\n", " };\n", " // The deferred used on DOM ready\n", " var readyList = jQuery.Deferred();\n", " jQuery.fn.ready = function (fn) {\n", " readyList\n", " .then(fn)\n", " // Wrap jQuery.readyException in a function so that the lookup\n", " // happens at the time of error handling instead of callback\n", " // registration.\n", " .catch(function (error) {\n", " jQuery.readyException(error);\n", " });\n", " return this;\n", " };\n", " jQuery.extend({\n", " // Is the DOM ready to be used? Set to true once it occurs.\n", " isReady: false,\n", " // A counter to track how many items to wait for before\n", " // the ready event fires. See #6781\n", " readyWait: 1,\n", " // Handle when the DOM is ready\n", " ready: function (wait) {\n", " // Abort if there are pending holds or we're already ready\n", " if (wait === true ? --jQuery.readyWait : jQuery.isReady) {\n", " return;\n", " }\n", " // Remember that the DOM is ready\n", " jQuery.isReady = true;\n", " // If a normal DOM Ready event fired, decrement, and wait if need be\n", " if (wait !== true && --jQuery.readyWait > 0) {\n", " return;\n", " }\n", " // If there are functions bound, to execute\n", " readyList.resolveWith(document, [jQuery]);\n", " }\n", " });\n", " jQuery.ready.then = readyList.then;\n", " // The ready event handler and self cleanup method\n", " function completed() {\n", " document.removeEventListener(\"DOMContentLoaded\", completed);\n", " window.removeEventListener(\"load\", completed);\n", " jQuery.ready();\n", " }\n", " // Catch cases where $(document).ready() is called\n", " // after the browser event has already occurred.\n", " // Support: IE <=9 - 10 only\n", " // Older IE sometimes signals \"interactive\" too soon\n", " if (document.readyState === \"complete\" ||\n", " (document.readyState !== \"loading\" && !document.documentElement.doScroll)) {\n", " // Handle it asynchronously to allow scripts the opportunity to delay ready\n", " window.setTimeout(jQuery.ready);\n", " }\n", " else {\n", " // Use the handy event callback\n", " document.addEventListener(\"DOMContentLoaded\", completed);\n", " // A fallback to window.onload, that will always work\n", " window.addEventListener(\"load\", completed);\n", " }\n", " // Multifunctional method to get and set values of a collection\n", " // The value/s can optionally be executed if it's a function\n", " var access = function (elems, fn, key, value, chainable, emptyGet, raw) {\n", " var i = 0, len = elems.length, bulk = key == null;\n", " // Sets many values\n", " if (toType(key) === \"object\") {\n", " chainable = true;\n", " for (i in key) {\n", " access(elems, fn, i, key[i], true, emptyGet, raw);\n", " }\n", " // Sets one value\n", " }\n", " else if (value !== undefined) {\n", " chainable = true;\n", " if (!isFunction(value)) {\n", " raw = true;\n", " }\n", " if (bulk) {\n", " // Bulk operations run against the entire set\n", " if (raw) {\n", " fn.call(elems, value);\n", " fn = null;\n", " // ...except when executing function values\n", " }\n", " else {\n", " bulk = fn;\n", " fn = function (elem, _key, value) {\n", " return bulk.call(jQuery(elem), value);\n", " };\n", " }\n", " }\n", " if (fn) {\n", " for (; i < len; i++) {\n", " fn(elems[i], key, raw ?\n", " value :\n", " value.call(elems[i], i, fn(elems[i], key)));\n", " }\n", " }\n", " }\n", " if (chainable) {\n", " return elems;\n", " }\n", " // Gets\n", " if (bulk) {\n", " return fn.call(elems);\n", " }\n", " return len ? fn(elems[0], key) : emptyGet;\n", " };\n", " // Matches dashed string for camelizing\n", " var rmsPrefix = /^-ms-/, rdashAlpha = /-([a-z])/g;\n", " // Used by camelCase as callback to replace()\n", " function fcamelCase(_all, letter) {\n", " return letter.toUpperCase();\n", " }\n", " // Convert dashed to camelCase; used by the css and data modules\n", " // Support: IE <=9 - 11, Edge 12 - 15\n", " // Microsoft forgot to hump their vendor prefix (#9572)\n", " function camelCase(string) {\n", " return string.replace(rmsPrefix, \"ms-\").replace(rdashAlpha, fcamelCase);\n", " }\n", " var acceptData = function (owner) {\n", " // Accepts only:\n", " // - Node\n", " // - Node.ELEMENT_NODE\n", " // - Node.DOCUMENT_NODE\n", " // - Object\n", " // - Any\n", " return owner.nodeType === 1 || owner.nodeType === 9 || !(+owner.nodeType);\n", " };\n", " function Data() {\n", " this.expando = jQuery.expando + Data.uid++;\n", " }\n", " Data.uid = 1;\n", " Data.prototype = {\n", " cache: function (owner) {\n", " // Check if the owner object already has a cache\n", " var value = owner[this.expando];\n", " // If not, create one\n", " if (!value) {\n", " value = Object.create(null);\n", " // We can accept data for non-element nodes in modern browsers,\n", " // but we should not, see #8335.\n", " // Always return an empty object.\n", " if (acceptData(owner)) {\n", " // If it is a node unlikely to be stringify-ed or looped over\n", " // use plain assignment\n", " if (owner.nodeType) {\n", " owner[this.expando] = value;\n", " // Otherwise secure it in a non-enumerable property\n", " // configurable must be true to allow the property to be\n", " // deleted when data is removed\n", " }\n", " else {\n", " Object.defineProperty(owner, this.expando, {\n", " value: value,\n", " configurable: true\n", " });\n", " }\n", " }\n", " }\n", " return value;\n", " },\n", " set: function (owner, data, value) {\n", " var prop, cache = this.cache(owner);\n", " // Handle: [ owner, key, value ] args\n", " // Always use camelCase key (gh-2257)\n", " if (typeof data === \"string\") {\n", " cache[camelCase(data)] = value;\n", " // Handle: [ owner, { properties } ] args\n", " }\n", " else {\n", " // Copy the properties one-by-one to the cache object\n", " for (prop in data) {\n", " cache[camelCase(prop)] = data[prop];\n", " }\n", " }\n", " return cache;\n", " },\n", " get: function (owner, key) {\n", " return key === undefined ?\n", " this.cache(owner) :\n", " // Always use camelCase key (gh-2257)\n", " owner[this.expando] && owner[this.expando][camelCase(key)];\n", " },\n", " access: function (owner, key, value) {\n", " // In cases where either:\n", " //\n", " // 1. No key was specified\n", " // 2. A string key was specified, but no value provided\n", " //\n", " // Take the \"read\" path and allow the get method to determine\n", " // which value to return, respectively either:\n", " //\n", " // 1. The entire cache object\n", " // 2. The data stored at the key\n", " //\n", " if (key === undefined ||\n", " ((key && typeof key === \"string\") && value === undefined)) {\n", " return this.get(owner, key);\n", " }\n", " // When the key is not a string, or both a key and value\n", " // are specified, set or extend (existing objects) with either:\n", " //\n", " // 1. An object of properties\n", " // 2. A key and value\n", " //\n", " this.set(owner, key, value);\n", " // Since the \"set\" path can have two possible entry points\n", " // return the expected data based on which path was taken[*]\n", " return value !== undefined ? value : key;\n", " },\n", " remove: function (owner, key) {\n", " var i, cache = owner[this.expando];\n", " if (cache === undefined) {\n", " return;\n", " }\n", " if (key !== undefined) {\n", " // Support array or space separated string of keys\n", " if (Array.isArray(key)) {\n", " // If key is an array of keys...\n", " // We always set camelCase keys, so remove that.\n", " key = key.map(camelCase);\n", " }\n", " else {\n", " key = camelCase(key);\n", " // If a key with the spaces exists, use it.\n", " // Otherwise, create an array by matching non-whitespace\n", " key = key in cache ?\n", " [key] :\n", " (key.match(rnothtmlwhite) || []);\n", " }\n", " i = key.length;\n", " while (i--) {\n", " delete cache[key[i]];\n", " }\n", " }\n", " // Remove the expando if there's no more data\n", " if (key === undefined || jQuery.isEmptyObject(cache)) {\n", " // Support: Chrome <=35 - 45\n", " // Webkit & Blink performance suffers when deleting properties\n", " // from DOM nodes, so set to undefined instead\n", " // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)\n", " if (owner.nodeType) {\n", " owner[this.expando] = undefined;\n", " }\n", " else {\n", " delete owner[this.expando];\n", " }\n", " }\n", " },\n", " hasData: function (owner) {\n", " var cache = owner[this.expando];\n", " return cache !== undefined && !jQuery.isEmptyObject(cache);\n", " }\n", " };\n", " var dataPriv = new Data();\n", " var dataUser = new Data();\n", " //\tImplementation Summary\n", " //\n", " //\t1. Enforce API surface and semantic compatibility with 1.9.x branch\n", " //\t2. Improve the module's maintainability by reducing the storage\n", " //\t\tpaths to a single mechanism.\n", " //\t3. Use the same single mechanism to support \"private\" and \"user\" data.\n", " //\t4. _Never_ expose \"private\" data to user code (TODO: Drop _data, _removeData)\n", " //\t5. Avoid exposing implementation details on user objects (eg. expando properties)\n", " //\t6. Provide a clear path for implementation upgrade to WeakMap in 2014\n", " var rbrace = /^(?:\\{[\\w\\W]*\\}|\\[[\\w\\W]*\\])$/, rmultiDash = /[A-Z]/g;\n", " function getData(data) {\n", " if (data === \"true\") {\n", " return true;\n", " }\n", " if (data === \"false\") {\n", " return false;\n", " }\n", " if (data === \"null\") {\n", " return null;\n", " }\n", " // Only convert to a number if it doesn't change the string\n", " if (data === +data + \"\") {\n", " return +data;\n", " }\n", " if (rbrace.test(data)) {\n", " return JSON.parse(data);\n", " }\n", " return data;\n", " }\n", " function dataAttr(elem, key, data) {\n", " var name;\n", " // If nothing was found internally, try to fetch any\n", " // data from the HTML5 data-* attribute\n", " if (data === undefined && elem.nodeType === 1) {\n", " name = \"data-\" + key.replace(rmultiDash, \"-$&\").toLowerCase();\n", " data = elem.getAttribute(name);\n", " if (typeof data === \"string\") {\n", " try {\n", " data = getData(data);\n", " }\n", " catch (e) { }\n", " // Make sure we set the data so it isn't changed later\n", " dataUser.set(elem, key, data);\n", " }\n", " else {\n", " data = undefined;\n", " }\n", " }\n", " return data;\n", " }\n", " jQuery.extend({\n", " hasData: function (elem) {\n", " return dataUser.hasData(elem) || dataPriv.hasData(elem);\n", " },\n", " data: function (elem, name, data) {\n", " return dataUser.access(elem, name, data);\n", " },\n", " removeData: function (elem, name) {\n", " dataUser.remove(elem, name);\n", " },\n", " // TODO: Now that all calls to _data and _removeData have been replaced\n", " // with direct calls to dataPriv methods, these can be deprecated.\n", " _data: function (elem, name, data) {\n", " return dataPriv.access(elem, name, data);\n", " },\n", " _removeData: function (elem, name) {\n", " dataPriv.remove(elem, name);\n", " }\n", " });\n", " jQuery.fn.extend({\n", " data: function (key, value) {\n", " var i, name, data, elem = this[0], attrs = elem && elem.attributes;\n", " // Gets all values\n", " if (key === undefined) {\n", " if (this.length) {\n", " data = dataUser.get(elem);\n", " if (elem.nodeType === 1 && !dataPriv.get(elem, \"hasDataAttrs\")) {\n", " i = attrs.length;\n", " while (i--) {\n", " // Support: IE 11 only\n", " // The attrs elements can be null (#14894)\n", " if (attrs[i]) {\n", " name = attrs[i].name;\n", " if (name.indexOf(\"data-\") === 0) {\n", " name = camelCase(name.slice(5));\n", " dataAttr(elem, name, data[name]);\n", " }\n", " }\n", " }\n", " dataPriv.set(elem, \"hasDataAttrs\", true);\n", " }\n", " }\n", " return data;\n", " }\n", " // Sets multiple values\n", " if (typeof key === \"object\") {\n", " return this.each(function () {\n", " dataUser.set(this, key);\n", " });\n", " }\n", " return access(this, function (value) {\n", " var data;\n", " // The calling jQuery object (element matches) is not empty\n", " // (and therefore has an element appears at this[ 0 ]) and the\n", " // `value` parameter was not undefined. An empty jQuery object\n", " // will result in `undefined` for elem = this[ 0 ] which will\n", " // throw an exception if an attempt to read a data cache is made.\n", " if (elem && value === undefined) {\n", " // Attempt to get data from the cache\n", " // The key will always be camelCased in Data\n", " data = dataUser.get(elem, key);\n", " if (data !== undefined) {\n", " return data;\n", " }\n", " // Attempt to \"discover\" the data in\n", " // HTML5 custom data-* attrs\n", " data = dataAttr(elem, key);\n", " if (data !== undefined) {\n", " return data;\n", " }\n", " // We tried really hard, but the data doesn't exist.\n", " return;\n", " }\n", " // Set the data...\n", " this.each(function () {\n", " // We always store the camelCased key\n", " dataUser.set(this, key, value);\n", " });\n", " }, null, value, arguments.length > 1, null, true);\n", " },\n", " removeData: function (key) {\n", " return this.each(function () {\n", " dataUser.remove(this, key);\n", " });\n", " }\n", " });\n", " jQuery.extend({\n", " queue: function (elem, type, data) {\n", " var queue;\n", " if (elem) {\n", " type = (type || \"fx\") + \"queue\";\n", " queue = dataPriv.get(elem, type);\n", " // Speed up dequeue by getting out quickly if this is just a lookup\n", " if (data) {\n", " if (!queue || Array.isArray(data)) {\n", " queue = dataPriv.access(elem, type, jQuery.makeArray(data));\n", " }\n", " else {\n", " queue.push(data);\n", " }\n", " }\n", " return queue || [];\n", " }\n", " },\n", " dequeue: function (elem, type) {\n", " type = type || \"fx\";\n", " var queue = jQuery.queue(elem, type), startLength = queue.length, fn = queue.shift(), hooks = jQuery._queueHooks(elem, type), next = function () {\n", " jQuery.dequeue(elem, type);\n", " };\n", " // If the fx queue is dequeued, always remove the progress sentinel\n", " if (fn === \"inprogress\") {\n", " fn = queue.shift();\n", " startLength--;\n", " }\n", " if (fn) {\n", " // Add a progress sentinel to prevent the fx queue from being\n", " // automatically dequeued\n", " if (type === \"fx\") {\n", " queue.unshift(\"inprogress\");\n", " }\n", " // Clear up the last queue stop function\n", " delete hooks.stop;\n", " fn.call(elem, next, hooks);\n", " }\n", " if (!startLength && hooks) {\n", " hooks.empty.fire();\n", " }\n", " },\n", " // Not public - generate a queueHooks object, or return the current one\n", " _queueHooks: function (elem, type) {\n", " var key = type + \"queueHooks\";\n", " return dataPriv.get(elem, key) || dataPriv.access(elem, key, {\n", " empty: jQuery.Callbacks(\"once memory\").add(function () {\n", " dataPriv.remove(elem, [type + \"queue\", key]);\n", " })\n", " });\n", " }\n", " });\n", " jQuery.fn.extend({\n", " queue: function (type, data) {\n", " var setter = 2;\n", " if (typeof type !== \"string\") {\n", " data = type;\n", " type = \"fx\";\n", " setter--;\n", " }\n", " if (arguments.length < setter) {\n", " return jQuery.queue(this[0], type);\n", " }\n", " return data === undefined ?\n", " this :\n", " this.each(function () {\n", " var queue = jQuery.queue(this, type, data);\n", " // Ensure a hooks for this queue\n", " jQuery._queueHooks(this, type);\n", " if (type === \"fx\" && queue[0] !== \"inprogress\") {\n", " jQuery.dequeue(this, type);\n", " }\n", " });\n", " },\n", " dequeue: function (type) {\n", " return this.each(function () {\n", " jQuery.dequeue(this, type);\n", " });\n", " },\n", " clearQueue: function (type) {\n", " return this.queue(type || \"fx\", []);\n", " },\n", " // Get a promise resolved when queues of a certain type\n", " // are emptied (fx is the type by default)\n", " promise: function (type, obj) {\n", " var tmp, count = 1, defer = jQuery.Deferred(), elements = this, i = this.length, resolve = function () {\n", " if (!(--count)) {\n", " defer.resolveWith(elements, [elements]);\n", " }\n", " };\n", " if (typeof type !== \"string\") {\n", " obj = type;\n", " type = undefined;\n", " }\n", " type = type || \"fx\";\n", " while (i--) {\n", " tmp = dataPriv.get(elements[i], type + \"queueHooks\");\n", " if (tmp && tmp.empty) {\n", " count++;\n", " tmp.empty.add(resolve);\n", " }\n", " }\n", " resolve();\n", " return defer.promise(obj);\n", " }\n", " });\n", " var pnum = (/[+-]?(?:\\d*\\.|)\\d+(?:[eE][+-]?\\d+|)/).source;\n", " var rcssNum = new RegExp(\"^(?:([+-])=|)(\" + pnum + \")([a-z%]*)$\", \"i\");\n", " var cssExpand = [\"Top\", \"Right\", \"Bottom\", \"Left\"];\n", " var documentElement = document.documentElement;\n", " var isAttached = function (elem) {\n", " return jQuery.contains(elem.ownerDocument, elem);\n", " }, composed = { composed: true };\n", " // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only\n", " // Check attachment across shadow DOM boundaries when possible (gh-3504)\n", " // Support: iOS 10.0-10.2 only\n", " // Early iOS 10 versions support `attachShadow` but not `getRootNode`,\n", " // leading to errors. We need to check for `getRootNode`.\n", " if (documentElement.getRootNode) {\n", " isAttached = function (elem) {\n", " return jQuery.contains(elem.ownerDocument, elem) ||\n", " elem.getRootNode(composed) === elem.ownerDocument;\n", " };\n", " }\n", " var isHiddenWithinTree = function (elem, el) {\n", " // isHiddenWithinTree might be called from jQuery#filter function;\n", " // in that case, element will be second argument\n", " elem = el || elem;\n", " // Inline style trumps all\n", " return elem.style.display === \"none\" ||\n", " elem.style.display === \"\" &&\n", " // Otherwise, check computed style\n", " // Support: Firefox <=43 - 45\n", " // Disconnected elements can have computed display: none, so first confirm that elem is\n", " // in the document.\n", " isAttached(elem) &&\n", " jQuery.css(elem, \"display\") === \"none\";\n", " };\n", " function adjustCSS(elem, prop, valueParts, tween) {\n", " var adjusted, scale, maxIterations = 20, currentValue = tween ?\n", " function () {\n", " return tween.cur();\n", " } :\n", " function () {\n", " return jQuery.css(elem, prop, \"\");\n", " }, initial = currentValue(), unit = valueParts && valueParts[3] || (jQuery.cssNumber[prop] ? \"\" : \"px\"), \n", " // Starting value computation is required for potential unit mismatches\n", " initialInUnit = elem.nodeType &&\n", " (jQuery.cssNumber[prop] || unit !== \"px\" && +initial) &&\n", " rcssNum.exec(jQuery.css(elem, prop));\n", " if (initialInUnit && initialInUnit[3] !== unit) {\n", " // Support: Firefox <=54\n", " // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)\n", " initial = initial / 2;\n", " // Trust units reported by jQuery.css\n", " unit = unit || initialInUnit[3];\n", " // Iteratively approximate from a nonzero starting point\n", " initialInUnit = +initial || 1;\n", " while (maxIterations--) {\n", " // Evaluate and update our best guess (doubling guesses that zero out).\n", " // Finish if the scale equals or crosses 1 (making the old*new product non-positive).\n", " jQuery.style(elem, prop, initialInUnit + unit);\n", " if ((1 - scale) * (1 - (scale = currentValue() / initial || 0.5)) <= 0) {\n", " maxIterations = 0;\n", " }\n", " initialInUnit = initialInUnit / scale;\n", " }\n", " initialInUnit = initialInUnit * 2;\n", " jQuery.style(elem, prop, initialInUnit + unit);\n", " // Make sure we update the tween properties later on\n", " valueParts = valueParts || [];\n", " }\n", " if (valueParts) {\n", " initialInUnit = +initialInUnit || +initial || 0;\n", " // Apply relative offset (+=/-=) if specified\n", " adjusted = valueParts[1] ?\n", " initialInUnit + (valueParts[1] + 1) * valueParts[2] :\n", " +valueParts[2];\n", " if (tween) {\n", " tween.unit = unit;\n", " tween.start = initialInUnit;\n", " tween.end = adjusted;\n", " }\n", " }\n", " return adjusted;\n", " }\n", " var defaultDisplayMap = {};\n", " function getDefaultDisplay(elem) {\n", " var temp, doc = elem.ownerDocument, nodeName = elem.nodeName, display = defaultDisplayMap[nodeName];\n", " if (display) {\n", " return display;\n", " }\n", " temp = doc.body.appendChild(doc.createElement(nodeName));\n", " display = jQuery.css(temp, \"display\");\n", " temp.parentNode.removeChild(temp);\n", " if (display === \"none\") {\n", " display = \"block\";\n", " }\n", " defaultDisplayMap[nodeName] = display;\n", " return display;\n", " }\n", " function showHide(elements, show) {\n", " var display, elem, values = [], index = 0, length = elements.length;\n", " // Determine new display value for elements that need to change\n", " for (; index < length; index++) {\n", " elem = elements[index];\n", " if (!elem.style) {\n", " continue;\n", " }\n", " display = elem.style.display;\n", " if (show) {\n", " // Since we force visibility upon cascade-hidden elements, an immediate (and slow)\n", " // check is required in this first loop unless we have a nonempty display value (either\n", " // inline or about-to-be-restored)\n", " if (display === \"none\") {\n", " values[index] = dataPriv.get(elem, \"display\") || null;\n", " if (!values[index]) {\n", " elem.style.display = \"\";\n", " }\n", " }\n", " if (elem.style.display === \"\" && isHiddenWithinTree(elem)) {\n", " values[index] = getDefaultDisplay(elem);\n", " }\n", " }\n", " else {\n", " if (display !== \"none\") {\n", " values[index] = \"none\";\n", " // Remember what we're overwriting\n", " dataPriv.set(elem, \"display\", display);\n", " }\n", " }\n", " }\n", " // Set the display of the elements in a second loop to avoid constant reflow\n", " for (index = 0; index < length; index++) {\n", " if (values[index] != null) {\n", " elements[index].style.display = values[index];\n", " }\n", " }\n", " return elements;\n", " }\n", " jQuery.fn.extend({\n", " show: function () {\n", " return showHide(this, true);\n", " },\n", " hide: function () {\n", " return showHide(this);\n", " },\n", " toggle: function (state) {\n", " if (typeof state === \"boolean\") {\n", " return state ? this.show() : this.hide();\n", " }\n", " return this.each(function () {\n", " if (isHiddenWithinTree(this)) {\n", " jQuery(this).show();\n", " }\n", " else {\n", " jQuery(this).hide();\n", " }\n", " });\n", " }\n", " });\n", " var rcheckableType = (/^(?:checkbox|radio)$/i);\n", " var rtagName = (/<([a-z][^\\/\\0>\\x20\\t\\r\\n\\f]*)/i);\n", " var rscriptType = (/^$|^module$|\\/(?:java|ecma)script/i);\n", " (function () {\n", " var fragment = document.createDocumentFragment(), div = fragment.appendChild(document.createElement(\"div\")), input = document.createElement(\"input\");\n", " // Support: Android 4.0 - 4.3 only\n", " // Check state lost if the name is set (#11217)\n", " // Support: Windows Web Apps (WWA)\n", " // `name` and `type` must use .setAttribute for WWA (#14901)\n", " input.setAttribute(\"type\", \"radio\");\n", " input.setAttribute(\"checked\", \"checked\");\n", " input.setAttribute(\"name\", \"t\");\n", " div.appendChild(input);\n", " // Support: Android <=4.1 only\n", " // Older WebKit doesn't clone checked state correctly in fragments\n", " support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;\n", " // Support: IE <=11 only\n", " // Make sure textarea (and checkbox) defaultValue is properly cloned\n", " div.innerHTML = \"\";\n", " support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;\n", " // Support: IE <=9 only\n", " // IE <=9 replaces \";\n", " support.option = !!div.lastChild;\n", " })();\n", " // We have to close these tags to support XHTML (#13200)\n", " var wrapMap = {\n", " // XHTML parsers do not magically insert elements in the\n", " // same way that tag soup parsers do. So we cannot shorten\n", " // this by omitting or other required elements.\n", " thead: [1, \"\", \"
\"],\n", " col: [2, \"\", \"
\"],\n", " tr: [2, \"\", \"
\"],\n", " td: [3, \"\", \"
\"],\n", " _default: [0, \"\", \"\"]\n", " };\n", " wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;\n", " wrapMap.th = wrapMap.td;\n", " // Support: IE <=9 only\n", " if (!support.option) {\n", " wrapMap.optgroup = wrapMap.option = [1, \"\"];\n", " }\n", " function getAll(context, tag) {\n", " // Support: IE <=9 - 11 only\n", " // Use typeof to avoid zero-argument method invocation on host objects (#15151)\n", " var ret;\n", " if (typeof context.getElementsByTagName !== \"undefined\") {\n", " ret = context.getElementsByTagName(tag || \"*\");\n", " }\n", " else if (typeof context.querySelectorAll !== \"undefined\") {\n", " ret = context.querySelectorAll(tag || \"*\");\n", " }\n", " else {\n", " ret = [];\n", " }\n", " if (tag === undefined || tag && nodeName(context, tag)) {\n", " return jQuery.merge([context], ret);\n", " }\n", " return ret;\n", " }\n", " // Mark scripts as having already been evaluated\n", " function setGlobalEval(elems, refElements) {\n", " var i = 0, l = elems.length;\n", " for (; i < l; i++) {\n", " dataPriv.set(elems[i], \"globalEval\", !refElements || dataPriv.get(refElements[i], \"globalEval\"));\n", " }\n", " }\n", " var rhtml = /<|&#?\\w+;/;\n", " function buildFragment(elems, context, scripts, selection, ignored) {\n", " var elem, tmp, tag, wrap, attached, j, fragment = context.createDocumentFragment(), nodes = [], i = 0, l = elems.length;\n", " for (; i < l; i++) {\n", " elem = elems[i];\n", " if (elem || elem === 0) {\n", " // Add nodes directly\n", " if (toType(elem) === \"object\") {\n", " // Support: Android <=4.0 only, PhantomJS 1 only\n", " // push.apply(_, arraylike) throws on ancient WebKit\n", " jQuery.merge(nodes, elem.nodeType ? [elem] : elem);\n", " // Convert non-html into a text node\n", " }\n", " else if (!rhtml.test(elem)) {\n", " nodes.push(context.createTextNode(elem));\n", " // Convert html into DOM nodes\n", " }\n", " else {\n", " tmp = tmp || fragment.appendChild(context.createElement(\"div\"));\n", " // Deserialize a standard representation\n", " tag = (rtagName.exec(elem) || [\"\", \"\"])[1].toLowerCase();\n", " wrap = wrapMap[tag] || wrapMap._default;\n", " tmp.innerHTML = wrap[1] + jQuery.htmlPrefilter(elem) + wrap[2];\n", " // Descend through wrappers to the right content\n", " j = wrap[0];\n", " while (j--) {\n", " tmp = tmp.lastChild;\n", " }\n", " // Support: Android <=4.0 only, PhantomJS 1 only\n", " // push.apply(_, arraylike) throws on ancient WebKit\n", " jQuery.merge(nodes, tmp.childNodes);\n", " // Remember the top-level container\n", " tmp = fragment.firstChild;\n", " // Ensure the created nodes are orphaned (#12392)\n", " tmp.textContent = \"\";\n", " }\n", " }\n", " }\n", " // Remove wrapper from fragment\n", " fragment.textContent = \"\";\n", " i = 0;\n", " while ((elem = nodes[i++])) {\n", " // Skip elements already in the context collection (trac-4087)\n", " if (selection && jQuery.inArray(elem, selection) > -1) {\n", " if (ignored) {\n", " ignored.push(elem);\n", " }\n", " continue;\n", " }\n", " attached = isAttached(elem);\n", " // Append to fragment\n", " tmp = getAll(fragment.appendChild(elem), \"script\");\n", " // Preserve script evaluation history\n", " if (attached) {\n", " setGlobalEval(tmp);\n", " }\n", " // Capture executables\n", " if (scripts) {\n", " j = 0;\n", " while ((elem = tmp[j++])) {\n", " if (rscriptType.test(elem.type || \"\")) {\n", " scripts.push(elem);\n", " }\n", " }\n", " }\n", " }\n", " return fragment;\n", " }\n", " var rkeyEvent = /^key/, rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, rtypenamespace = /^([^.]*)(?:\\.(.+)|)/;\n", " function returnTrue() {\n", " return true;\n", " }\n", " function returnFalse() {\n", " return false;\n", " }\n", " // Support: IE <=9 - 11+\n", " // focus() and blur() are asynchronous, except when they are no-op.\n", " // So expect focus to be synchronous when the element is already active,\n", " // and blur to be synchronous when the element is not already active.\n", " // (focus and blur are always synchronous in other supported browsers,\n", " // this just defines when we can count on it).\n", " function expectSync(elem, type) {\n", " return (elem === safeActiveElement()) === (type === \"focus\");\n", " }\n", " // Support: IE <=9 only\n", " // Accessing document.activeElement can throw unexpectedly\n", " // https://bugs.jquery.com/ticket/13393\n", " function safeActiveElement() {\n", " try {\n", " return document.activeElement;\n", " }\n", " catch (err) { }\n", " }\n", " function on(elem, types, selector, data, fn, one) {\n", " var origFn, type;\n", " // Types can be a map of types/handlers\n", " if (typeof types === \"object\") {\n", " // ( types-Object, selector, data )\n", " if (typeof selector !== \"string\") {\n", " // ( types-Object, data )\n", " data = data || selector;\n", " selector = undefined;\n", " }\n", " for (type in types) {\n", " on(elem, type, selector, data, types[type], one);\n", " }\n", " return elem;\n", " }\n", " if (data == null && fn == null) {\n", " // ( types, fn )\n", " fn = selector;\n", " data = selector = undefined;\n", " }\n", " else if (fn == null) {\n", " if (typeof selector === \"string\") {\n", " // ( types, selector, fn )\n", " fn = data;\n", " data = undefined;\n", " }\n", " else {\n", " // ( types, data, fn )\n", " fn = data;\n", " data = selector;\n", " selector = undefined;\n", " }\n", " }\n", " if (fn === false) {\n", " fn = returnFalse;\n", " }\n", " else if (!fn) {\n", " return elem;\n", " }\n", " if (one === 1) {\n", " origFn = fn;\n", " fn = function (event) {\n", " // Can use an empty set, since event contains the info\n", " jQuery().off(event);\n", " return origFn.apply(this, arguments);\n", " };\n", " // Use same guid so caller can remove using origFn\n", " fn.guid = origFn.guid || (origFn.guid = jQuery.guid++);\n", " }\n", " return elem.each(function () {\n", " jQuery.event.add(this, types, fn, data, selector);\n", " });\n", " }\n", " /*\n", " * Helper functions for managing events -- not part of the public interface.\n", " * Props to Dean Edwards' addEvent library for many of the ideas.\n", " */\n", " jQuery.event = {\n", " global: {},\n", " add: function (elem, types, handler, data, selector) {\n", " var handleObjIn, eventHandle, tmp, events, t, handleObj, special, handlers, type, namespaces, origType, elemData = dataPriv.get(elem);\n", " // Only attach events to objects that accept data\n", " if (!acceptData(elem)) {\n", " return;\n", " }\n", " // Caller can pass in an object of custom data in lieu of the handler\n", " if (handler.handler) {\n", " handleObjIn = handler;\n", " handler = handleObjIn.handler;\n", " selector = handleObjIn.selector;\n", " }\n", " // Ensure that invalid selectors throw exceptions at attach time\n", " // Evaluate against documentElement in case elem is a non-element node (e.g., document)\n", " if (selector) {\n", " jQuery.find.matchesSelector(documentElement, selector);\n", " }\n", " // Make sure that the handler has a unique ID, used to find/remove it later\n", " if (!handler.guid) {\n", " handler.guid = jQuery.guid++;\n", " }\n", " // Init the element's event structure and main handler, if this is the first\n", " if (!(events = elemData.events)) {\n", " events = elemData.events = Object.create(null);\n", " }\n", " if (!(eventHandle = elemData.handle)) {\n", " eventHandle = elemData.handle = function (e) {\n", " // Discard the second event of a jQuery.event.trigger() and\n", " // when an event is called after a page has unloaded\n", " return typeof jQuery !== \"undefined\" && jQuery.event.triggered !== e.type ?\n", " jQuery.event.dispatch.apply(elem, arguments) : undefined;\n", " };\n", " }\n", " // Handle multiple events separated by a space\n", " types = (types || \"\").match(rnothtmlwhite) || [\"\"];\n", " t = types.length;\n", " while (t--) {\n", " tmp = rtypenamespace.exec(types[t]) || [];\n", " type = origType = tmp[1];\n", " namespaces = (tmp[2] || \"\").split(\".\").sort();\n", " // There *must* be a type, no attaching namespace-only handlers\n", " if (!type) {\n", " continue;\n", " }\n", " // If event changes its type, use the special event handlers for the changed type\n", " special = jQuery.event.special[type] || {};\n", " // If selector defined, determine special event api type, otherwise given type\n", " type = (selector ? special.delegateType : special.bindType) || type;\n", " // Update special based on newly reset type\n", " special = jQuery.event.special[type] || {};\n", " // handleObj is passed to all event handlers\n", " handleObj = jQuery.extend({\n", " type: type,\n", " origType: origType,\n", " data: data,\n", " handler: handler,\n", " guid: handler.guid,\n", " selector: selector,\n", " needsContext: selector && jQuery.expr.match.needsContext.test(selector),\n", " namespace: namespaces.join(\".\")\n", " }, handleObjIn);\n", " // Init the event handler queue if we're the first\n", " if (!(handlers = events[type])) {\n", " handlers = events[type] = [];\n", " handlers.delegateCount = 0;\n", " // Only use addEventListener if the special events handler returns false\n", " if (!special.setup ||\n", " special.setup.call(elem, data, namespaces, eventHandle) === false) {\n", " if (elem.addEventListener) {\n", " elem.addEventListener(type, eventHandle);\n", " }\n", " }\n", " }\n", " if (special.add) {\n", " special.add.call(elem, handleObj);\n", " if (!handleObj.handler.guid) {\n", " handleObj.handler.guid = handler.guid;\n", " }\n", " }\n", " // Add to the element's handler list, delegates in front\n", " if (selector) {\n", " handlers.splice(handlers.delegateCount++, 0, handleObj);\n", " }\n", " else {\n", " handlers.push(handleObj);\n", " }\n", " // Keep track of which events have ever been used, for event optimization\n", " jQuery.event.global[type] = true;\n", " }\n", " },\n", " // Detach an event or set of events from an element\n", " remove: function (elem, types, handler, selector, mappedTypes) {\n", " var j, origCount, tmp, events, t, handleObj, special, handlers, type, namespaces, origType, elemData = dataPriv.hasData(elem) && dataPriv.get(elem);\n", " if (!elemData || !(events = elemData.events)) {\n", " return;\n", " }\n", " // Once for each type.namespace in types; type may be omitted\n", " types = (types || \"\").match(rnothtmlwhite) || [\"\"];\n", " t = types.length;\n", " while (t--) {\n", " tmp = rtypenamespace.exec(types[t]) || [];\n", " type = origType = tmp[1];\n", " namespaces = (tmp[2] || \"\").split(\".\").sort();\n", " // Unbind all events (on this namespace, if provided) for the element\n", " if (!type) {\n", " for (type in events) {\n", " jQuery.event.remove(elem, type + types[t], handler, selector, true);\n", " }\n", " continue;\n", " }\n", " special = jQuery.event.special[type] || {};\n", " type = (selector ? special.delegateType : special.bindType) || type;\n", " handlers = events[type] || [];\n", " tmp = tmp[2] &&\n", " new RegExp(\"(^|\\\\.)\" + namespaces.join(\"\\\\.(?:.*\\\\.|)\") + \"(\\\\.|$)\");\n", " // Remove matching events\n", " origCount = j = handlers.length;\n", " while (j--) {\n", " handleObj = handlers[j];\n", " if ((mappedTypes || origType === handleObj.origType) &&\n", " (!handler || handler.guid === handleObj.guid) &&\n", " (!tmp || tmp.test(handleObj.namespace)) &&\n", " (!selector || selector === handleObj.selector ||\n", " selector === \"**\" && handleObj.selector)) {\n", " handlers.splice(j, 1);\n", " if (handleObj.selector) {\n", " handlers.delegateCount--;\n", " }\n", " if (special.remove) {\n", " special.remove.call(elem, handleObj);\n", " }\n", " }\n", " }\n", " // Remove generic event handler if we removed something and no more handlers exist\n", " // (avoids potential for endless recursion during removal of special event handlers)\n", " if (origCount && !handlers.length) {\n", " if (!special.teardown ||\n", " special.teardown.call(elem, namespaces, elemData.handle) === false) {\n", " jQuery.removeEvent(elem, type, elemData.handle);\n", " }\n", " delete events[type];\n", " }\n", " }\n", " // Remove data and the expando if it's no longer used\n", " if (jQuery.isEmptyObject(events)) {\n", " dataPriv.remove(elem, \"handle events\");\n", " }\n", " },\n", " dispatch: function (nativeEvent) {\n", " var i, j, ret, matched, handleObj, handlerQueue, args = new Array(arguments.length), \n", " // Make a writable jQuery.Event from the native event object\n", " event = jQuery.event.fix(nativeEvent), handlers = (dataPriv.get(this, \"events\") || Object.create(null))[event.type] || [], special = jQuery.event.special[event.type] || {};\n", " // Use the fix-ed jQuery.Event rather than the (read-only) native event\n", " args[0] = event;\n", " for (i = 1; i < arguments.length; i++) {\n", " args[i] = arguments[i];\n", " }\n", " event.delegateTarget = this;\n", " // Call the preDispatch hook for the mapped type, and let it bail if desired\n", " if (special.preDispatch && special.preDispatch.call(this, event) === false) {\n", " return;\n", " }\n", " // Determine handlers\n", " handlerQueue = jQuery.event.handlers.call(this, event, handlers);\n", " // Run delegates first; they may want to stop propagation beneath us\n", " i = 0;\n", " while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) {\n", " event.currentTarget = matched.elem;\n", " j = 0;\n", " while ((handleObj = matched.handlers[j++]) &&\n", " !event.isImmediatePropagationStopped()) {\n", " // If the event is namespaced, then each handler is only invoked if it is\n", " // specially universal or its namespaces are a superset of the event's.\n", " if (!event.rnamespace || handleObj.namespace === false ||\n", " event.rnamespace.test(handleObj.namespace)) {\n", " event.handleObj = handleObj;\n", " event.data = handleObj.data;\n", " ret = ((jQuery.event.special[handleObj.origType] || {}).handle ||\n", " handleObj.handler).apply(matched.elem, args);\n", " if (ret !== undefined) {\n", " if ((event.result = ret) === false) {\n", " event.preventDefault();\n", " event.stopPropagation();\n", " }\n", " }\n", " }\n", " }\n", " }\n", " // Call the postDispatch hook for the mapped type\n", " if (special.postDispatch) {\n", " special.postDispatch.call(this, event);\n", " }\n", " return event.result;\n", " },\n", " handlers: function (event, handlers) {\n", " var i, handleObj, sel, matchedHandlers, matchedSelectors, handlerQueue = [], delegateCount = handlers.delegateCount, cur = event.target;\n", " // Find delegate handlers\n", " if (delegateCount &&\n", " // Support: IE <=9\n", " // Black-hole SVG instance trees (trac-13180)\n", " cur.nodeType &&\n", " // Support: Firefox <=42\n", " // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)\n", " // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click\n", " // Support: IE 11 only\n", " // ...but not arrow key \"clicks\" of radio inputs, which can have `button` -1 (gh-2343)\n", " !(event.type === \"click\" && event.button >= 1)) {\n", " for (; cur !== this; cur = cur.parentNode || this) {\n", " // Don't check non-elements (#13208)\n", " // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)\n", " if (cur.nodeType === 1 && !(event.type === \"click\" && cur.disabled === true)) {\n", " matchedHandlers = [];\n", " matchedSelectors = {};\n", " for (i = 0; i < delegateCount; i++) {\n", " handleObj = handlers[i];\n", " // Don't conflict with Object.prototype properties (#13203)\n", " sel = handleObj.selector + \" \";\n", " if (matchedSelectors[sel] === undefined) {\n", " matchedSelectors[sel] = handleObj.needsContext ?\n", " jQuery(sel, this).index(cur) > -1 :\n", " jQuery.find(sel, this, null, [cur]).length;\n", " }\n", " if (matchedSelectors[sel]) {\n", " matchedHandlers.push(handleObj);\n", " }\n", " }\n", " if (matchedHandlers.length) {\n", " handlerQueue.push({ elem: cur, handlers: matchedHandlers });\n", " }\n", " }\n", " }\n", " }\n", " // Add the remaining (directly-bound) handlers\n", " cur = this;\n", " if (delegateCount < handlers.length) {\n", " handlerQueue.push({ elem: cur, handlers: handlers.slice(delegateCount) });\n", " }\n", " return handlerQueue;\n", " },\n", " addProp: function (name, hook) {\n", " Object.defineProperty(jQuery.Event.prototype, name, {\n", " enumerable: true,\n", " configurable: true,\n", " get: isFunction(hook) ?\n", " function () {\n", " if (this.originalEvent) {\n", " return hook(this.originalEvent);\n", " }\n", " } :\n", " function () {\n", " if (this.originalEvent) {\n", " return this.originalEvent[name];\n", " }\n", " },\n", " set: function (value) {\n", " Object.defineProperty(this, name, {\n", " enumerable: true,\n", " configurable: true,\n", " writable: true,\n", " value: value\n", " });\n", " }\n", " });\n", " },\n", " fix: function (originalEvent) {\n", " return originalEvent[jQuery.expando] ?\n", " originalEvent :\n", " new jQuery.Event(originalEvent);\n", " },\n", " special: {\n", " load: {\n", " // Prevent triggered image.load events from bubbling to window.load\n", " noBubble: true\n", " },\n", " click: {\n", " // Utilize native event to ensure correct state for checkable inputs\n", " setup: function (data) {\n", " // For mutual compressibility with _default, replace `this` access with a local var.\n", " // `|| data` is dead code meant only to preserve the variable through minification.\n", " var el = this || data;\n", " // Claim the first handler\n", " if (rcheckableType.test(el.type) &&\n", " el.click && nodeName(el, \"input\")) {\n", " // dataPriv.set( el, \"click\", ... )\n", " leverageNative(el, \"click\", returnTrue);\n", " }\n", " // Return false to allow normal processing in the caller\n", " return false;\n", " },\n", " trigger: function (data) {\n", " // For mutual compressibility with _default, replace `this` access with a local var.\n", " // `|| data` is dead code meant only to preserve the variable through minification.\n", " var el = this || data;\n", " // Force setup before triggering a click\n", " if (rcheckableType.test(el.type) &&\n", " el.click && nodeName(el, \"input\")) {\n", " leverageNative(el, \"click\");\n", " }\n", " // Return non-false to allow normal event-path propagation\n", " return true;\n", " },\n", " // For cross-browser consistency, suppress native .click() on links\n", " // Also prevent it if we're currently inside a leveraged native-event stack\n", " _default: function (event) {\n", " var target = event.target;\n", " return rcheckableType.test(target.type) &&\n", " target.click && nodeName(target, \"input\") &&\n", " dataPriv.get(target, \"click\") ||\n", " nodeName(target, \"a\");\n", " }\n", " },\n", " beforeunload: {\n", " postDispatch: function (event) {\n", " // Support: Firefox 20+\n", " // Firefox doesn't alert if the returnValue field is not set.\n", " if (event.result !== undefined && event.originalEvent) {\n", " event.originalEvent.returnValue = event.result;\n", " }\n", " }\n", " }\n", " }\n", " };\n", " // Ensure the presence of an event listener that handles manually-triggered\n", " // synthetic events by interrupting progress until reinvoked in response to\n", " // *native* events that it fires directly, ensuring that state changes have\n", " // already occurred before other listeners are invoked.\n", " function leverageNative(el, type, expectSync) {\n", " // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add\n", " if (!expectSync) {\n", " if (dataPriv.get(el, type) === undefined) {\n", " jQuery.event.add(el, type, returnTrue);\n", " }\n", " return;\n", " }\n", " // Register the controller as a special universal handler for all event namespaces\n", " dataPriv.set(el, type, false);\n", " jQuery.event.add(el, type, {\n", " namespace: false,\n", " handler: function (event) {\n", " var notAsync, result, saved = dataPriv.get(this, type);\n", " if ((event.isTrigger & 1) && this[type]) {\n", " // Interrupt processing of the outer synthetic .trigger()ed event\n", " // Saved data should be false in such cases, but might be a leftover capture object\n", " // from an async native handler (gh-4350)\n", " if (!saved.length) {\n", " // Store arguments for use when handling the inner native event\n", " // There will always be at least one argument (an event object), so this array\n", " // will not be confused with a leftover capture object.\n", " saved = slice.call(arguments);\n", " dataPriv.set(this, type, saved);\n", " // Trigger the native event and capture its result\n", " // Support: IE <=9 - 11+\n", " // focus() and blur() are asynchronous\n", " notAsync = expectSync(this, type);\n", " this[type]();\n", " result = dataPriv.get(this, type);\n", " if (saved !== result || notAsync) {\n", " dataPriv.set(this, type, false);\n", " }\n", " else {\n", " result = {};\n", " }\n", " if (saved !== result) {\n", " // Cancel the outer synthetic event\n", " event.stopImmediatePropagation();\n", " event.preventDefault();\n", " return result.value;\n", " }\n", " // If this is an inner synthetic event for an event with a bubbling surrogate\n", " // (focus or blur), assume that the surrogate already propagated from triggering the\n", " // native event and prevent that from happening again here.\n", " // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the\n", " // bubbling surrogate propagates *after* the non-bubbling base), but that seems\n", " // less bad than duplication.\n", " }\n", " else if ((jQuery.event.special[type] || {}).delegateType) {\n", " event.stopPropagation();\n", " }\n", " // If this is a native event triggered above, everything is now in order\n", " // Fire an inner synthetic event with the original arguments\n", " }\n", " else if (saved.length) {\n", " // ...and capture the result\n", " dataPriv.set(this, type, {\n", " value: jQuery.event.trigger(\n", " // Support: IE <=9 - 11+\n", " // Extend with the prototype to reset the above stopImmediatePropagation()\n", " jQuery.extend(saved[0], jQuery.Event.prototype), saved.slice(1), this)\n", " });\n", " // Abort handling of the native event\n", " event.stopImmediatePropagation();\n", " }\n", " }\n", " });\n", " }\n", " jQuery.removeEvent = function (elem, type, handle) {\n", " // This \"if\" is needed for plain objects\n", " if (elem.removeEventListener) {\n", " elem.removeEventListener(type, handle);\n", " }\n", " };\n", " jQuery.Event = function (src, props) {\n", " // Allow instantiation without the 'new' keyword\n", " if (!(this instanceof jQuery.Event)) {\n", " return new jQuery.Event(src, props);\n", " }\n", " // Event object\n", " if (src && src.type) {\n", " this.originalEvent = src;\n", " this.type = src.type;\n", " // Events bubbling up the document may have been marked as prevented\n", " // by a handler lower down the tree; reflect the correct value.\n", " this.isDefaultPrevented = src.defaultPrevented ||\n", " src.defaultPrevented === undefined &&\n", " // Support: Android <=2.3 only\n", " src.returnValue === false ?\n", " returnTrue :\n", " returnFalse;\n", " // Create target properties\n", " // Support: Safari <=6 - 7 only\n", " // Target should not be a text node (#504, #13143)\n", " this.target = (src.target && src.target.nodeType === 3) ?\n", " src.target.parentNode :\n", " src.target;\n", " this.currentTarget = src.currentTarget;\n", " this.relatedTarget = src.relatedTarget;\n", " // Event type\n", " }\n", " else {\n", " this.type = src;\n", " }\n", " // Put explicitly provided properties onto the event object\n", " if (props) {\n", " jQuery.extend(this, props);\n", " }\n", " // Create a timestamp if incoming event doesn't have one\n", " this.timeStamp = src && src.timeStamp || Date.now();\n", " // Mark it as fixed\n", " this[jQuery.expando] = true;\n", " };\n", " // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding\n", " // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html\n", " jQuery.Event.prototype = {\n", " constructor: jQuery.Event,\n", " isDefaultPrevented: returnFalse,\n", " isPropagationStopped: returnFalse,\n", " isImmediatePropagationStopped: returnFalse,\n", " isSimulated: false,\n", " preventDefault: function () {\n", " var e = this.originalEvent;\n", " this.isDefaultPrevented = returnTrue;\n", " if (e && !this.isSimulated) {\n", " e.preventDefault();\n", " }\n", " },\n", " stopPropagation: function () {\n", " var e = this.originalEvent;\n", " this.isPropagationStopped = returnTrue;\n", " if (e && !this.isSimulated) {\n", " e.stopPropagation();\n", " }\n", " },\n", " stopImmediatePropagation: function () {\n", " var e = this.originalEvent;\n", " this.isImmediatePropagationStopped = returnTrue;\n", " if (e && !this.isSimulated) {\n", " e.stopImmediatePropagation();\n", " }\n", " this.stopPropagation();\n", " }\n", " };\n", " // Includes all common event props including KeyEvent and MouseEvent specific props\n", " jQuery.each({\n", " altKey: true,\n", " bubbles: true,\n", " cancelable: true,\n", " changedTouches: true,\n", " ctrlKey: true,\n", " detail: true,\n", " eventPhase: true,\n", " metaKey: true,\n", " pageX: true,\n", " pageY: true,\n", " shiftKey: true,\n", " view: true,\n", " \"char\": true,\n", " code: true,\n", " charCode: true,\n", " key: true,\n", " keyCode: true,\n", " button: true,\n", " buttons: true,\n", " clientX: true,\n", " clientY: true,\n", " offsetX: true,\n", " offsetY: true,\n", " pointerId: true,\n", " pointerType: true,\n", " screenX: true,\n", " screenY: true,\n", " targetTouches: true,\n", " toElement: true,\n", " touches: true,\n", " which: function (event) {\n", " var button = event.button;\n", " // Add which for key events\n", " if (event.which == null && rkeyEvent.test(event.type)) {\n", " return event.charCode != null ? event.charCode : event.keyCode;\n", " }\n", " // Add which for click: 1 === left; 2 === middle; 3 === right\n", " if (!event.which && button !== undefined && rmouseEvent.test(event.type)) {\n", " if (button & 1) {\n", " return 1;\n", " }\n", " if (button & 2) {\n", " return 3;\n", " }\n", " if (button & 4) {\n", " return 2;\n", " }\n", " return 0;\n", " }\n", " return event.which;\n", " }\n", " }, jQuery.event.addProp);\n", " jQuery.each({ focus: \"focusin\", blur: \"focusout\" }, function (type, delegateType) {\n", " jQuery.event.special[type] = {\n", " // Utilize native event if possible so blur/focus sequence is correct\n", " setup: function () {\n", " // Claim the first handler\n", " // dataPriv.set( this, \"focus\", ... )\n", " // dataPriv.set( this, \"blur\", ... )\n", " leverageNative(this, type, expectSync);\n", " // Return false to allow normal processing in the caller\n", " return false;\n", " },\n", " trigger: function () {\n", " // Force setup before trigger\n", " leverageNative(this, type);\n", " // Return non-false to allow normal event-path propagation\n", " return true;\n", " },\n", " delegateType: delegateType\n", " };\n", " });\n", " // Create mouseenter/leave events using mouseover/out and event-time checks\n", " // so that event delegation works in jQuery.\n", " // Do the same for pointerenter/pointerleave and pointerover/pointerout\n", " //\n", " // Support: Safari 7 only\n", " // Safari sends mouseenter too often; see:\n", " // https://bugs.chromium.org/p/chromium/issues/detail?id=470258\n", " // for the description of the bug (it existed in older Chrome versions as well).\n", " jQuery.each({\n", " mouseenter: \"mouseover\",\n", " mouseleave: \"mouseout\",\n", " pointerenter: \"pointerover\",\n", " pointerleave: \"pointerout\"\n", " }, function (orig, fix) {\n", " jQuery.event.special[orig] = {\n", " delegateType: fix,\n", " bindType: fix,\n", " handle: function (event) {\n", " var ret, target = this, related = event.relatedTarget, handleObj = event.handleObj;\n", " // For mouseenter/leave call the handler if related is outside the target.\n", " // NB: No relatedTarget if the mouse left/entered the browser window\n", " if (!related || (related !== target && !jQuery.contains(target, related))) {\n", " event.type = handleObj.origType;\n", " ret = handleObj.handler.apply(this, arguments);\n", " event.type = fix;\n", " }\n", " return ret;\n", " }\n", " };\n", " });\n", " jQuery.fn.extend({\n", " on: function (types, selector, data, fn) {\n", " return on(this, types, selector, data, fn);\n", " },\n", " one: function (types, selector, data, fn) {\n", " return on(this, types, selector, data, fn, 1);\n", " },\n", " off: function (types, selector, fn) {\n", " var handleObj, type;\n", " if (types && types.preventDefault && types.handleObj) {\n", " // ( event ) dispatched jQuery.Event\n", " handleObj = types.handleObj;\n", " jQuery(types.delegateTarget).off(handleObj.namespace ?\n", " handleObj.origType + \".\" + handleObj.namespace :\n", " handleObj.origType, handleObj.selector, handleObj.handler);\n", " return this;\n", " }\n", " if (typeof types === \"object\") {\n", " // ( types-object [, selector] )\n", " for (type in types) {\n", " this.off(type, selector, types[type]);\n", " }\n", " return this;\n", " }\n", " if (selector === false || typeof selector === \"function\") {\n", " // ( types [, fn] )\n", " fn = selector;\n", " selector = undefined;\n", " }\n", " if (fn === false) {\n", " fn = returnFalse;\n", " }\n", " return this.each(function () {\n", " jQuery.event.remove(this, types, fn, selector);\n", " });\n", " }\n", " });\n", " var \n", " // Support: IE <=10 - 11, Edge 12 - 13 only\n", " // In IE/Edge using regex groups here causes severe slowdowns.\n", " // See https://connect.microsoft.com/IE/feedback/details/1736512/\n", " rnoInnerhtml = /\\s*$/g;\n", " // Prefer a tbody over its parent table for containing new rows\n", " function manipulationTarget(elem, content) {\n", " if (nodeName(elem, \"table\") &&\n", " nodeName(content.nodeType !== 11 ? content : content.firstChild, \"tr\")) {\n", " return jQuery(elem).children(\"tbody\")[0] || elem;\n", " }\n", " return elem;\n", " }\n", " // Replace/restore the type attribute of script elements for safe DOM manipulation\n", " function disableScript(elem) {\n", " elem.type = (elem.getAttribute(\"type\") !== null) + \"/\" + elem.type;\n", " return elem;\n", " }\n", " function restoreScript(elem) {\n", " if ((elem.type || \"\").slice(0, 5) === \"true/\") {\n", " elem.type = elem.type.slice(5);\n", " }\n", " else {\n", " elem.removeAttribute(\"type\");\n", " }\n", " return elem;\n", " }\n", " function cloneCopyEvent(src, dest) {\n", " var i, l, type, pdataOld, udataOld, udataCur, events;\n", " if (dest.nodeType !== 1) {\n", " return;\n", " }\n", " // 1. Copy private data: events, handlers, etc.\n", " if (dataPriv.hasData(src)) {\n", " pdataOld = dataPriv.get(src);\n", " events = pdataOld.events;\n", " if (events) {\n", " dataPriv.remove(dest, \"handle events\");\n", " for (type in events) {\n", " for (i = 0, l = events[type].length; i < l; i++) {\n", " jQuery.event.add(dest, type, events[type][i]);\n", " }\n", " }\n", " }\n", " }\n", " // 2. Copy user data\n", " if (dataUser.hasData(src)) {\n", " udataOld = dataUser.access(src);\n", " udataCur = jQuery.extend({}, udataOld);\n", " dataUser.set(dest, udataCur);\n", " }\n", " }\n", " // Fix IE bugs, see support tests\n", " function fixInput(src, dest) {\n", " var nodeName = dest.nodeName.toLowerCase();\n", " // Fails to persist the checked state of a cloned checkbox or radio button.\n", " if (nodeName === \"input\" && rcheckableType.test(src.type)) {\n", " dest.checked = src.checked;\n", " // Fails to return the selected option to the default selected state when cloning options\n", " }\n", " else if (nodeName === \"input\" || nodeName === \"textarea\") {\n", " dest.defaultValue = src.defaultValue;\n", " }\n", " }\n", " function domManip(collection, args, callback, ignored) {\n", " // Flatten any nested arrays\n", " args = flat(args);\n", " var fragment, first, scripts, hasScripts, node, doc, i = 0, l = collection.length, iNoClone = l - 1, value = args[0], valueIsFunction = isFunction(value);\n", " // We can't cloneNode fragments that contain checked, in WebKit\n", " if (valueIsFunction ||\n", " (l > 1 && typeof value === \"string\" &&\n", " !support.checkClone && rchecked.test(value))) {\n", " return collection.each(function (index) {\n", " var self = collection.eq(index);\n", " if (valueIsFunction) {\n", " args[0] = value.call(this, index, self.html());\n", " }\n", " domManip(self, args, callback, ignored);\n", " });\n", " }\n", " if (l) {\n", " fragment = buildFragment(args, collection[0].ownerDocument, false, collection, ignored);\n", " first = fragment.firstChild;\n", " if (fragment.childNodes.length === 1) {\n", " fragment = first;\n", " }\n", " // Require either new content or an interest in ignored elements to invoke the callback\n", " if (first || ignored) {\n", " scripts = jQuery.map(getAll(fragment, \"script\"), disableScript);\n", " hasScripts = scripts.length;\n", " // Use the original fragment for the last item\n", " // instead of the first because it can end up\n", " // being emptied incorrectly in certain situations (#8070).\n", " for (; i < l; i++) {\n", " node = fragment;\n", " if (i !== iNoClone) {\n", " node = jQuery.clone(node, true, true);\n", " // Keep references to cloned scripts for later restoration\n", " if (hasScripts) {\n", " // Support: Android <=4.0 only, PhantomJS 1 only\n", " // push.apply(_, arraylike) throws on ancient WebKit\n", " jQuery.merge(scripts, getAll(node, \"script\"));\n", " }\n", " }\n", " callback.call(collection[i], node, i);\n", " }\n", " if (hasScripts) {\n", " doc = scripts[scripts.length - 1].ownerDocument;\n", " // Reenable scripts\n", " jQuery.map(scripts, restoreScript);\n", " // Evaluate executable scripts on first document insertion\n", " for (i = 0; i < hasScripts; i++) {\n", " node = scripts[i];\n", " if (rscriptType.test(node.type || \"\") &&\n", " !dataPriv.access(node, \"globalEval\") &&\n", " jQuery.contains(doc, node)) {\n", " if (node.src && (node.type || \"\").toLowerCase() !== \"module\") {\n", " // Optional AJAX dependency, but won't run scripts if not present\n", " if (jQuery._evalUrl && !node.noModule) {\n", " jQuery._evalUrl(node.src, {\n", " nonce: node.nonce || node.getAttribute(\"nonce\")\n", " }, doc);\n", " }\n", " }\n", " else {\n", " DOMEval(node.textContent.replace(rcleanScript, \"\"), node, doc);\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " return collection;\n", " }\n", " function remove(elem, selector, keepData) {\n", " var node, nodes = selector ? jQuery.filter(selector, elem) : elem, i = 0;\n", " for (; (node = nodes[i]) != null; i++) {\n", " if (!keepData && node.nodeType === 1) {\n", " jQuery.cleanData(getAll(node));\n", " }\n", " if (node.parentNode) {\n", " if (keepData && isAttached(node)) {\n", " setGlobalEval(getAll(node, \"script\"));\n", " }\n", " node.parentNode.removeChild(node);\n", " }\n", " }\n", " return elem;\n", " }\n", " jQuery.extend({\n", " htmlPrefilter: function (html) {\n", " return html;\n", " },\n", " clone: function (elem, dataAndEvents, deepDataAndEvents) {\n", " var i, l, srcElements, destElements, clone = elem.cloneNode(true), inPage = isAttached(elem);\n", " // Fix IE cloning issues\n", " if (!support.noCloneChecked && (elem.nodeType === 1 || elem.nodeType === 11) &&\n", " !jQuery.isXMLDoc(elem)) {\n", " // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2\n", " destElements = getAll(clone);\n", " srcElements = getAll(elem);\n", " for (i = 0, l = srcElements.length; i < l; i++) {\n", " fixInput(srcElements[i], destElements[i]);\n", " }\n", " }\n", " // Copy the events from the original to the clone\n", " if (dataAndEvents) {\n", " if (deepDataAndEvents) {\n", " srcElements = srcElements || getAll(elem);\n", " destElements = destElements || getAll(clone);\n", " for (i = 0, l = srcElements.length; i < l; i++) {\n", " cloneCopyEvent(srcElements[i], destElements[i]);\n", " }\n", " }\n", " else {\n", " cloneCopyEvent(elem, clone);\n", " }\n", " }\n", " // Preserve script evaluation history\n", " destElements = getAll(clone, \"script\");\n", " if (destElements.length > 0) {\n", " setGlobalEval(destElements, !inPage && getAll(elem, \"script\"));\n", " }\n", " // Return the cloned set\n", " return clone;\n", " },\n", " cleanData: function (elems) {\n", " var data, elem, type, special = jQuery.event.special, i = 0;\n", " for (; (elem = elems[i]) !== undefined; i++) {\n", " if (acceptData(elem)) {\n", " if ((data = elem[dataPriv.expando])) {\n", " if (data.events) {\n", " for (type in data.events) {\n", " if (special[type]) {\n", " jQuery.event.remove(elem, type);\n", " // This is a shortcut to avoid jQuery.event.remove's overhead\n", " }\n", " else {\n", " jQuery.removeEvent(elem, type, data.handle);\n", " }\n", " }\n", " }\n", " // Support: Chrome <=35 - 45+\n", " // Assign undefined instead of using delete, see Data#remove\n", " elem[dataPriv.expando] = undefined;\n", " }\n", " if (elem[dataUser.expando]) {\n", " // Support: Chrome <=35 - 45+\n", " // Assign undefined instead of using delete, see Data#remove\n", " elem[dataUser.expando] = undefined;\n", " }\n", " }\n", " }\n", " }\n", " });\n", " jQuery.fn.extend({\n", " detach: function (selector) {\n", " return remove(this, selector, true);\n", " },\n", " remove: function (selector) {\n", " return remove(this, selector);\n", " },\n", " text: function (value) {\n", " return access(this, function (value) {\n", " return value === undefined ?\n", " jQuery.text(this) :\n", " this.empty().each(function () {\n", " if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {\n", " this.textContent = value;\n", " }\n", " });\n", " }, null, value, arguments.length);\n", " },\n", " append: function () {\n", " return domManip(this, arguments, function (elem) {\n", " if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {\n", " var target = manipulationTarget(this, elem);\n", " target.appendChild(elem);\n", " }\n", " });\n", " },\n", " prepend: function () {\n", " return domManip(this, arguments, function (elem) {\n", " if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {\n", " var target = manipulationTarget(this, elem);\n", " target.insertBefore(elem, target.firstChild);\n", " }\n", " });\n", " },\n", " before: function () {\n", " return domManip(this, arguments, function (elem) {\n", " if (this.parentNode) {\n", " this.parentNode.insertBefore(elem, this);\n", " }\n", " });\n", " },\n", " after: function () {\n", " return domManip(this, arguments, function (elem) {\n", " if (this.parentNode) {\n", " this.parentNode.insertBefore(elem, this.nextSibling);\n", " }\n", " });\n", " },\n", " empty: function () {\n", " var elem, i = 0;\n", " for (; (elem = this[i]) != null; i++) {\n", " if (elem.nodeType === 1) {\n", " // Prevent memory leaks\n", " jQuery.cleanData(getAll(elem, false));\n", " // Remove any remaining nodes\n", " elem.textContent = \"\";\n", " }\n", " }\n", " return this;\n", " },\n", " clone: function (dataAndEvents, deepDataAndEvents) {\n", " dataAndEvents = dataAndEvents == null ? false : dataAndEvents;\n", " deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;\n", " return this.map(function () {\n", " return jQuery.clone(this, dataAndEvents, deepDataAndEvents);\n", " });\n", " },\n", " html: function (value) {\n", " return access(this, function (value) {\n", " var elem = this[0] || {}, i = 0, l = this.length;\n", " if (value === undefined && elem.nodeType === 1) {\n", " return elem.innerHTML;\n", " }\n", " // See if we can take a shortcut and just use innerHTML\n", " if (typeof value === \"string\" && !rnoInnerhtml.test(value) &&\n", " !wrapMap[(rtagName.exec(value) || [\"\", \"\"])[1].toLowerCase()]) {\n", " value = jQuery.htmlPrefilter(value);\n", " try {\n", " for (; i < l; i++) {\n", " elem = this[i] || {};\n", " // Remove element nodes and prevent memory leaks\n", " if (elem.nodeType === 1) {\n", " jQuery.cleanData(getAll(elem, false));\n", " elem.innerHTML = value;\n", " }\n", " }\n", " elem = 0;\n", " // If using innerHTML throws an exception, use the fallback method\n", " }\n", " catch (e) { }\n", " }\n", " if (elem) {\n", " this.empty().append(value);\n", " }\n", " }, null, value, arguments.length);\n", " },\n", " replaceWith: function () {\n", " var ignored = [];\n", " // Make the changes, replacing each non-ignored context element with the new content\n", " return domManip(this, arguments, function (elem) {\n", " var parent = this.parentNode;\n", " if (jQuery.inArray(this, ignored) < 0) {\n", " jQuery.cleanData(getAll(this));\n", " if (parent) {\n", " parent.replaceChild(elem, this);\n", " }\n", " }\n", " // Force callback invocation\n", " }, ignored);\n", " }\n", " });\n", " jQuery.each({\n", " appendTo: \"append\",\n", " prependTo: \"prepend\",\n", " insertBefore: \"before\",\n", " insertAfter: \"after\",\n", " replaceAll: \"replaceWith\"\n", " }, function (name, original) {\n", " jQuery.fn[name] = function (selector) {\n", " var elems, ret = [], insert = jQuery(selector), last = insert.length - 1, i = 0;\n", " for (; i <= last; i++) {\n", " elems = i === last ? this : this.clone(true);\n", " jQuery(insert[i])[original](elems);\n", " // Support: Android <=4.0 only, PhantomJS 1 only\n", " // .get() because push.apply(_, arraylike) throws on ancient WebKit\n", " push.apply(ret, elems.get());\n", " }\n", " return this.pushStack(ret);\n", " };\n", " });\n", " var rnumnonpx = new RegExp(\"^(\" + pnum + \")(?!px)[a-z%]+$\", \"i\");\n", " var getStyles = function (elem) {\n", " // Support: IE <=11 only, Firefox <=30 (#15098, #14150)\n", " // IE throws on elements created in popups\n", " // FF meanwhile throws on frame elements through \"defaultView.getComputedStyle\"\n", " var view = elem.ownerDocument.defaultView;\n", " if (!view || !view.opener) {\n", " view = window;\n", " }\n", " return view.getComputedStyle(elem);\n", " };\n", " var swap = function (elem, options, callback) {\n", " var ret, name, old = {};\n", " // Remember the old values, and insert the new ones\n", " for (name in options) {\n", " old[name] = elem.style[name];\n", " elem.style[name] = options[name];\n", " }\n", " ret = callback.call(elem);\n", " // Revert the old values\n", " for (name in options) {\n", " elem.style[name] = old[name];\n", " }\n", " return ret;\n", " };\n", " var rboxStyle = new RegExp(cssExpand.join(\"|\"), \"i\");\n", " (function () {\n", " // Executing both pixelPosition & boxSizingReliable tests require only one layout\n", " // so they're executed at the same time to save the second computation.\n", " function computeStyleTests() {\n", " // This is a singleton, we need to execute it only once\n", " if (!div) {\n", " return;\n", " }\n", " container.style.cssText = \"position:absolute;left:-11111px;width:60px;\" +\n", " \"margin-top:1px;padding:0;border:0\";\n", " div.style.cssText =\n", " \"position:relative;display:block;box-sizing:border-box;overflow:scroll;\" +\n", " \"margin:auto;border:1px;padding:1px;\" +\n", " \"width:60%;top:1%\";\n", " documentElement.appendChild(container).appendChild(div);\n", " var divStyle = window.getComputedStyle(div);\n", " pixelPositionVal = divStyle.top !== \"1%\";\n", " // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44\n", " reliableMarginLeftVal = roundPixelMeasures(divStyle.marginLeft) === 12;\n", " // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3\n", " // Some styles come back with percentage values, even though they shouldn't\n", " div.style.right = \"60%\";\n", " pixelBoxStylesVal = roundPixelMeasures(divStyle.right) === 36;\n", " // Support: IE 9 - 11 only\n", " // Detect misreporting of content dimensions for box-sizing:border-box elements\n", " boxSizingReliableVal = roundPixelMeasures(divStyle.width) === 36;\n", " // Support: IE 9 only\n", " // Detect overflow:scroll screwiness (gh-3699)\n", " // Support: Chrome <=64\n", " // Don't get tricked when zoom affects offsetWidth (gh-4029)\n", " div.style.position = \"absolute\";\n", " scrollboxSizeVal = roundPixelMeasures(div.offsetWidth / 3) === 12;\n", " documentElement.removeChild(container);\n", " // Nullify the div so it wouldn't be stored in the memory and\n", " // it will also be a sign that checks already performed\n", " div = null;\n", " }\n", " function roundPixelMeasures(measure) {\n", " return Math.round(parseFloat(measure));\n", " }\n", " var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, reliableTrDimensionsVal, reliableMarginLeftVal, container = document.createElement(\"div\"), div = document.createElement(\"div\");\n", " // Finish early in limited (non-browser) environments\n", " if (!div.style) {\n", " return;\n", " }\n", " // Support: IE <=9 - 11 only\n", " // Style of cloned element affects source element cloned (#8908)\n", " div.style.backgroundClip = \"content-box\";\n", " div.cloneNode(true).style.backgroundClip = \"\";\n", " support.clearCloneStyle = div.style.backgroundClip === \"content-box\";\n", " jQuery.extend(support, {\n", " boxSizingReliable: function () {\n", " computeStyleTests();\n", " return boxSizingReliableVal;\n", " },\n", " pixelBoxStyles: function () {\n", " computeStyleTests();\n", " return pixelBoxStylesVal;\n", " },\n", " pixelPosition: function () {\n", " computeStyleTests();\n", " return pixelPositionVal;\n", " },\n", " reliableMarginLeft: function () {\n", " computeStyleTests();\n", " return reliableMarginLeftVal;\n", " },\n", " scrollboxSize: function () {\n", " computeStyleTests();\n", " return scrollboxSizeVal;\n", " },\n", " // Support: IE 9 - 11+, Edge 15 - 18+\n", " // IE/Edge misreport `getComputedStyle` of table rows with width/height\n", " // set in CSS while `offset*` properties report correct values.\n", " // Behavior in IE 9 is more subtle than in newer versions & it passes\n", " // some versions of this test; make sure not to make it pass there!\n", " reliableTrDimensions: function () {\n", " var table, tr, trChild, trStyle;\n", " if (reliableTrDimensionsVal == null) {\n", " table = document.createElement(\"table\");\n", " tr = document.createElement(\"tr\");\n", " trChild = document.createElement(\"div\");\n", " table.style.cssText = \"position:absolute;left:-11111px\";\n", " tr.style.height = \"1px\";\n", " trChild.style.height = \"9px\";\n", " documentElement\n", " .appendChild(table)\n", " .appendChild(tr)\n", " .appendChild(trChild);\n", " trStyle = window.getComputedStyle(tr);\n", " reliableTrDimensionsVal = parseInt(trStyle.height) > 3;\n", " documentElement.removeChild(table);\n", " }\n", " return reliableTrDimensionsVal;\n", " }\n", " });\n", " })();\n", " function curCSS(elem, name, computed) {\n", " var width, minWidth, maxWidth, ret, \n", " // Support: Firefox 51+\n", " // Retrieving style before computed somehow\n", " // fixes an issue with getting wrong values\n", " // on detached elements\n", " style = elem.style;\n", " computed = computed || getStyles(elem);\n", " // getPropertyValue is needed for:\n", " // .css('filter') (IE 9 only, #12537)\n", " // .css('--customProperty) (#3144)\n", " if (computed) {\n", " ret = computed.getPropertyValue(name) || computed[name];\n", " if (ret === \"\" && !isAttached(elem)) {\n", " ret = jQuery.style(elem, name);\n", " }\n", " // A tribute to the \"awesome hack by Dean Edwards\"\n", " // Android Browser returns percentage for some values,\n", " // but width seems to be reliably pixels.\n", " // This is against the CSSOM draft spec:\n", " // https://drafts.csswg.org/cssom/#resolved-values\n", " if (!support.pixelBoxStyles() && rnumnonpx.test(ret) && rboxStyle.test(name)) {\n", " // Remember the original values\n", " width = style.width;\n", " minWidth = style.minWidth;\n", " maxWidth = style.maxWidth;\n", " // Put in the new values to get a computed value out\n", " style.minWidth = style.maxWidth = style.width = ret;\n", " ret = computed.width;\n", " // Revert the changed values\n", " style.width = width;\n", " style.minWidth = minWidth;\n", " style.maxWidth = maxWidth;\n", " }\n", " }\n", " return ret !== undefined ?\n", " // Support: IE <=9 - 11 only\n", " // IE returns zIndex value as an integer.\n", " ret + \"\" :\n", " ret;\n", " }\n", " function addGetHookIf(conditionFn, hookFn) {\n", " // Define the hook, we'll check on the first run if it's really needed.\n", " return {\n", " get: function () {\n", " if (conditionFn()) {\n", " // Hook not needed (or it's not possible to use it due\n", " // to missing dependency), remove it.\n", " delete this.get;\n", " return;\n", " }\n", " // Hook needed; redefine it so that the support test is not executed again.\n", " return (this.get = hookFn).apply(this, arguments);\n", " }\n", " };\n", " }\n", " var cssPrefixes = [\"Webkit\", \"Moz\", \"ms\"], emptyStyle = document.createElement(\"div\").style, vendorProps = {};\n", " // Return a vendor-prefixed property or undefined\n", " function vendorPropName(name) {\n", " // Check for vendor prefixed names\n", " var capName = name[0].toUpperCase() + name.slice(1), i = cssPrefixes.length;\n", " while (i--) {\n", " name = cssPrefixes[i] + capName;\n", " if (name in emptyStyle) {\n", " return name;\n", " }\n", " }\n", " }\n", " // Return a potentially-mapped jQuery.cssProps or vendor prefixed property\n", " function finalPropName(name) {\n", " var final = jQuery.cssProps[name] || vendorProps[name];\n", " if (final) {\n", " return final;\n", " }\n", " if (name in emptyStyle) {\n", " return name;\n", " }\n", " return vendorProps[name] = vendorPropName(name) || name;\n", " }\n", " var \n", " // Swappable if display is none or starts with table\n", " // except \"table\", \"table-cell\", or \"table-caption\"\n", " // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display\n", " rdisplayswap = /^(none|table(?!-c[ea]).+)/, rcustomProp = /^--/, cssShow = { position: \"absolute\", visibility: \"hidden\", display: \"block\" }, cssNormalTransform = {\n", " letterSpacing: \"0\",\n", " fontWeight: \"400\"\n", " };\n", " function setPositiveNumber(_elem, value, subtract) {\n", " // Any relative (+/-) values have already been\n", " // normalized at this point\n", " var matches = rcssNum.exec(value);\n", " return matches ?\n", " // Guard against undefined \"subtract\", e.g., when used as in cssHooks\n", " Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || \"px\") :\n", " value;\n", " }\n", " function boxModelAdjustment(elem, dimension, box, isBorderBox, styles, computedVal) {\n", " var i = dimension === \"width\" ? 1 : 0, extra = 0, delta = 0;\n", " // Adjustment may not be necessary\n", " if (box === (isBorderBox ? \"border\" : \"content\")) {\n", " return 0;\n", " }\n", " for (; i < 4; i += 2) {\n", " // Both box models exclude margin\n", " if (box === \"margin\") {\n", " delta += jQuery.css(elem, box + cssExpand[i], true, styles);\n", " }\n", " // If we get here with a content-box, we're seeking \"padding\" or \"border\" or \"margin\"\n", " if (!isBorderBox) {\n", " // Add padding\n", " delta += jQuery.css(elem, \"padding\" + cssExpand[i], true, styles);\n", " // For \"border\" or \"margin\", add border\n", " if (box !== \"padding\") {\n", " delta += jQuery.css(elem, \"border\" + cssExpand[i] + \"Width\", true, styles);\n", " // But still keep track of it otherwise\n", " }\n", " else {\n", " extra += jQuery.css(elem, \"border\" + cssExpand[i] + \"Width\", true, styles);\n", " }\n", " // If we get here with a border-box (content + padding + border), we're seeking \"content\" or\n", " // \"padding\" or \"margin\"\n", " }\n", " else {\n", " // For \"content\", subtract padding\n", " if (box === \"content\") {\n", " delta -= jQuery.css(elem, \"padding\" + cssExpand[i], true, styles);\n", " }\n", " // For \"content\" or \"padding\", subtract border\n", " if (box !== \"margin\") {\n", " delta -= jQuery.css(elem, \"border\" + cssExpand[i] + \"Width\", true, styles);\n", " }\n", " }\n", " }\n", " // Account for positive content-box scroll gutter when requested by providing computedVal\n", " if (!isBorderBox && computedVal >= 0) {\n", " // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border\n", " // Assuming integer scroll gutter, subtract the rest and round down\n", " delta += Math.max(0, Math.ceil(elem[\"offset\" + dimension[0].toUpperCase() + dimension.slice(1)] -\n", " computedVal -\n", " delta -\n", " extra -\n", " 0.5\n", " // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter\n", " // Use an explicit zero to avoid NaN (gh-3964)\n", " )) || 0;\n", " }\n", " return delta;\n", " }\n", " function getWidthOrHeight(elem, dimension, extra) {\n", " // Start with computed style\n", " var styles = getStyles(elem), \n", " // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).\n", " // Fake content-box until we know it's needed to know the true value.\n", " boxSizingNeeded = !support.boxSizingReliable() || extra, isBorderBox = boxSizingNeeded &&\n", " jQuery.css(elem, \"boxSizing\", false, styles) === \"border-box\", valueIsBorderBox = isBorderBox, val = curCSS(elem, dimension, styles), offsetProp = \"offset\" + dimension[0].toUpperCase() + dimension.slice(1);\n", " // Support: Firefox <=54\n", " // Return a confounding non-pixel value or feign ignorance, as appropriate.\n", " if (rnumnonpx.test(val)) {\n", " if (!extra) {\n", " return val;\n", " }\n", " val = \"auto\";\n", " }\n", " // Support: IE 9 - 11 only\n", " // Use offsetWidth/offsetHeight for when box sizing is unreliable.\n", " // In those cases, the computed value can be trusted to be border-box.\n", " if ((!support.boxSizingReliable() && isBorderBox ||\n", " // Support: IE 10 - 11+, Edge 15 - 18+\n", " // IE/Edge misreport `getComputedStyle` of table rows with width/height\n", " // set in CSS while `offset*` properties report correct values.\n", " // Interestingly, in some cases IE 9 doesn't suffer from this issue.\n", " !support.reliableTrDimensions() && nodeName(elem, \"tr\") ||\n", " // Fall back to offsetWidth/offsetHeight when value is \"auto\"\n", " // This happens for inline elements with no explicit setting (gh-3571)\n", " val === \"auto\" ||\n", " // Support: Android <=4.1 - 4.3 only\n", " // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)\n", " !parseFloat(val) && jQuery.css(elem, \"display\", false, styles) === \"inline\") &&\n", " // Make sure the element is visible & connected\n", " elem.getClientRects().length) {\n", " isBorderBox = jQuery.css(elem, \"boxSizing\", false, styles) === \"border-box\";\n", " // Where available, offsetWidth/offsetHeight approximate border box dimensions.\n", " // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the\n", " // retrieved value as a content box dimension.\n", " valueIsBorderBox = offsetProp in elem;\n", " if (valueIsBorderBox) {\n", " val = elem[offsetProp];\n", " }\n", " }\n", " // Normalize \"\" and auto\n", " val = parseFloat(val) || 0;\n", " // Adjust for the element's box model\n", " return (val +\n", " boxModelAdjustment(elem, dimension, extra || (isBorderBox ? \"border\" : \"content\"), valueIsBorderBox, styles, \n", " // Provide the current computed size to request scroll gutter calculation (gh-3589)\n", " val)) + \"px\";\n", " }\n", " jQuery.extend({\n", " // Add in style property hooks for overriding the default\n", " // behavior of getting and setting a style property\n", " cssHooks: {\n", " opacity: {\n", " get: function (elem, computed) {\n", " if (computed) {\n", " // We should always get a number back from opacity\n", " var ret = curCSS(elem, \"opacity\");\n", " return ret === \"\" ? \"1\" : ret;\n", " }\n", " }\n", " }\n", " },\n", " // Don't automatically add \"px\" to these possibly-unitless properties\n", " cssNumber: {\n", " \"animationIterationCount\": true,\n", " \"columnCount\": true,\n", " \"fillOpacity\": true,\n", " \"flexGrow\": true,\n", " \"flexShrink\": true,\n", " \"fontWeight\": true,\n", " \"gridArea\": true,\n", " \"gridColumn\": true,\n", " \"gridColumnEnd\": true,\n", " \"gridColumnStart\": true,\n", " \"gridRow\": true,\n", " \"gridRowEnd\": true,\n", " \"gridRowStart\": true,\n", " \"lineHeight\": true,\n", " \"opacity\": true,\n", " \"order\": true,\n", " \"orphans\": true,\n", " \"widows\": true,\n", " \"zIndex\": true,\n", " \"zoom\": true\n", " },\n", " // Add in properties whose names you wish to fix before\n", " // setting or getting the value\n", " cssProps: {},\n", " // Get and set the style property on a DOM Node\n", " style: function (elem, name, value, extra) {\n", " // Don't set styles on text and comment nodes\n", " if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {\n", " return;\n", " }\n", " // Make sure that we're working with the right name\n", " var ret, type, hooks, origName = camelCase(name), isCustomProp = rcustomProp.test(name), style = elem.style;\n", " // Make sure that we're working with the right name. We don't\n", " // want to query the value if it is a CSS custom property\n", " // since they are user-defined.\n", " if (!isCustomProp) {\n", " name = finalPropName(origName);\n", " }\n", " // Gets hook for the prefixed version, then unprefixed version\n", " hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];\n", " // Check if we're setting a value\n", " if (value !== undefined) {\n", " type = typeof value;\n", " // Convert \"+=\" or \"-=\" to relative numbers (#7345)\n", " if (type === \"string\" && (ret = rcssNum.exec(value)) && ret[1]) {\n", " value = adjustCSS(elem, name, ret);\n", " // Fixes bug #9237\n", " type = \"number\";\n", " }\n", " // Make sure that null and NaN values aren't set (#7116)\n", " if (value == null || value !== value) {\n", " return;\n", " }\n", " // If a number was passed in, add the unit (except for certain CSS properties)\n", " // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append\n", " // \"px\" to a few hardcoded values.\n", " if (type === \"number\" && !isCustomProp) {\n", " value += ret && ret[3] || (jQuery.cssNumber[origName] ? \"\" : \"px\");\n", " }\n", " // background-* props affect original clone's values\n", " if (!support.clearCloneStyle && value === \"\" && name.indexOf(\"background\") === 0) {\n", " style[name] = \"inherit\";\n", " }\n", " // If a hook was provided, use that value, otherwise just set the specified value\n", " if (!hooks || !(\"set\" in hooks) ||\n", " (value = hooks.set(elem, value, extra)) !== undefined) {\n", " if (isCustomProp) {\n", " style.setProperty(name, value);\n", " }\n", " else {\n", " style[name] = value;\n", " }\n", " }\n", " }\n", " else {\n", " // If a hook was provided get the non-computed value from there\n", " if (hooks && \"get\" in hooks &&\n", " (ret = hooks.get(elem, false, extra)) !== undefined) {\n", " return ret;\n", " }\n", " // Otherwise just get the value from the style object\n", " return style[name];\n", " }\n", " },\n", " css: function (elem, name, extra, styles) {\n", " var val, num, hooks, origName = camelCase(name), isCustomProp = rcustomProp.test(name);\n", " // Make sure that we're working with the right name. We don't\n", " // want to modify the value if it is a CSS custom property\n", " // since they are user-defined.\n", " if (!isCustomProp) {\n", " name = finalPropName(origName);\n", " }\n", " // Try prefixed name followed by the unprefixed name\n", " hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];\n", " // If a hook was provided get the computed value from there\n", " if (hooks && \"get\" in hooks) {\n", " val = hooks.get(elem, true, extra);\n", " }\n", " // Otherwise, if a way to get the computed value exists, use that\n", " if (val === undefined) {\n", " val = curCSS(elem, name, styles);\n", " }\n", " // Convert \"normal\" to computed value\n", " if (val === \"normal\" && name in cssNormalTransform) {\n", " val = cssNormalTransform[name];\n", " }\n", " // Make numeric if forced or a qualifier was provided and val looks numeric\n", " if (extra === \"\" || extra) {\n", " num = parseFloat(val);\n", " return extra === true || isFinite(num) ? num || 0 : val;\n", " }\n", " return val;\n", " }\n", " });\n", " jQuery.each([\"height\", \"width\"], function (_i, dimension) {\n", " jQuery.cssHooks[dimension] = {\n", " get: function (elem, computed, extra) {\n", " if (computed) {\n", " // Certain elements can have dimension info if we invisibly show them\n", " // but it must have a current display style that would benefit\n", " return rdisplayswap.test(jQuery.css(elem, \"display\")) &&\n", " // Support: Safari 8+\n", " // Table columns in Safari have non-zero offsetWidth & zero\n", " // getBoundingClientRect().width unless display is changed.\n", " // Support: IE <=11 only\n", " // Running getBoundingClientRect on a disconnected node\n", " // in IE throws an error.\n", " (!elem.getClientRects().length || !elem.getBoundingClientRect().width) ?\n", " swap(elem, cssShow, function () {\n", " return getWidthOrHeight(elem, dimension, extra);\n", " }) :\n", " getWidthOrHeight(elem, dimension, extra);\n", " }\n", " },\n", " set: function (elem, value, extra) {\n", " var matches, styles = getStyles(elem), \n", " // Only read styles.position if the test has a chance to fail\n", " // to avoid forcing a reflow.\n", " scrollboxSizeBuggy = !support.scrollboxSize() &&\n", " styles.position === \"absolute\", \n", " // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)\n", " boxSizingNeeded = scrollboxSizeBuggy || extra, isBorderBox = boxSizingNeeded &&\n", " jQuery.css(elem, \"boxSizing\", false, styles) === \"border-box\", subtract = extra ?\n", " boxModelAdjustment(elem, dimension, extra, isBorderBox, styles) :\n", " 0;\n", " // Account for unreliable border-box dimensions by comparing offset* to computed and\n", " // faking a content-box to get border and padding (gh-3699)\n", " if (isBorderBox && scrollboxSizeBuggy) {\n", " subtract -= Math.ceil(elem[\"offset\" + dimension[0].toUpperCase() + dimension.slice(1)] -\n", " parseFloat(styles[dimension]) -\n", " boxModelAdjustment(elem, dimension, \"border\", false, styles) -\n", " 0.5);\n", " }\n", " // Convert to pixels if value adjustment is needed\n", " if (subtract && (matches = rcssNum.exec(value)) &&\n", " (matches[3] || \"px\") !== \"px\") {\n", " elem.style[dimension] = value;\n", " value = jQuery.css(elem, dimension);\n", " }\n", " return setPositiveNumber(elem, value, subtract);\n", " }\n", " };\n", " });\n", " jQuery.cssHooks.marginLeft = addGetHookIf(support.reliableMarginLeft, function (elem, computed) {\n", " if (computed) {\n", " return (parseFloat(curCSS(elem, \"marginLeft\")) ||\n", " elem.getBoundingClientRect().left -\n", " swap(elem, { marginLeft: 0 }, function () {\n", " return elem.getBoundingClientRect().left;\n", " })) + \"px\";\n", " }\n", " });\n", " // These hooks are used by animate to expand properties\n", " jQuery.each({\n", " margin: \"\",\n", " padding: \"\",\n", " border: \"Width\"\n", " }, function (prefix, suffix) {\n", " jQuery.cssHooks[prefix + suffix] = {\n", " expand: function (value) {\n", " var i = 0, expanded = {}, \n", " // Assumes a single number if not a string\n", " parts = typeof value === \"string\" ? value.split(\" \") : [value];\n", " for (; i < 4; i++) {\n", " expanded[prefix + cssExpand[i] + suffix] =\n", " parts[i] || parts[i - 2] || parts[0];\n", " }\n", " return expanded;\n", " }\n", " };\n", " if (prefix !== \"margin\") {\n", " jQuery.cssHooks[prefix + suffix].set = setPositiveNumber;\n", " }\n", " });\n", " jQuery.fn.extend({\n", " css: function (name, value) {\n", " return access(this, function (elem, name, value) {\n", " var styles, len, map = {}, i = 0;\n", " if (Array.isArray(name)) {\n", " styles = getStyles(elem);\n", " len = name.length;\n", " for (; i < len; i++) {\n", " map[name[i]] = jQuery.css(elem, name[i], false, styles);\n", " }\n", " return map;\n", " }\n", " return value !== undefined ?\n", " jQuery.style(elem, name, value) :\n", " jQuery.css(elem, name);\n", " }, name, value, arguments.length > 1);\n", " }\n", " });\n", " function Tween(elem, options, prop, end, easing) {\n", " return new Tween.prototype.init(elem, options, prop, end, easing);\n", " }\n", " jQuery.Tween = Tween;\n", " Tween.prototype = {\n", " constructor: Tween,\n", " init: function (elem, options, prop, end, easing, unit) {\n", " this.elem = elem;\n", " this.prop = prop;\n", " this.easing = easing || jQuery.easing._default;\n", " this.options = options;\n", " this.start = this.now = this.cur();\n", " this.end = end;\n", " this.unit = unit || (jQuery.cssNumber[prop] ? \"\" : \"px\");\n", " },\n", " cur: function () {\n", " var hooks = Tween.propHooks[this.prop];\n", " return hooks && hooks.get ?\n", " hooks.get(this) :\n", " Tween.propHooks._default.get(this);\n", " },\n", " run: function (percent) {\n", " var eased, hooks = Tween.propHooks[this.prop];\n", " if (this.options.duration) {\n", " this.pos = eased = jQuery.easing[this.easing](percent, this.options.duration * percent, 0, 1, this.options.duration);\n", " }\n", " else {\n", " this.pos = eased = percent;\n", " }\n", " this.now = (this.end - this.start) * eased + this.start;\n", " if (this.options.step) {\n", " this.options.step.call(this.elem, this.now, this);\n", " }\n", " if (hooks && hooks.set) {\n", " hooks.set(this);\n", " }\n", " else {\n", " Tween.propHooks._default.set(this);\n", " }\n", " return this;\n", " }\n", " };\n", " Tween.prototype.init.prototype = Tween.prototype;\n", " Tween.propHooks = {\n", " _default: {\n", " get: function (tween) {\n", " var result;\n", " // Use a property on the element directly when it is not a DOM element,\n", " // or when there is no matching style property that exists.\n", " if (tween.elem.nodeType !== 1 ||\n", " tween.elem[tween.prop] != null && tween.elem.style[tween.prop] == null) {\n", " return tween.elem[tween.prop];\n", " }\n", " // Passing an empty string as a 3rd parameter to .css will automatically\n", " // attempt a parseFloat and fallback to a string if the parse fails.\n", " // Simple values such as \"10px\" are parsed to Float;\n", " // complex values such as \"rotate(1rad)\" are returned as-is.\n", " result = jQuery.css(tween.elem, tween.prop, \"\");\n", " // Empty strings, null, undefined and \"auto\" are converted to 0.\n", " return !result || result === \"auto\" ? 0 : result;\n", " },\n", " set: function (tween) {\n", " // Use step hook for back compat.\n", " // Use cssHook if its there.\n", " // Use .style if available and use plain properties where available.\n", " if (jQuery.fx.step[tween.prop]) {\n", " jQuery.fx.step[tween.prop](tween);\n", " }\n", " else if (tween.elem.nodeType === 1 && (jQuery.cssHooks[tween.prop] ||\n", " tween.elem.style[finalPropName(tween.prop)] != null)) {\n", " jQuery.style(tween.elem, tween.prop, tween.now + tween.unit);\n", " }\n", " else {\n", " tween.elem[tween.prop] = tween.now;\n", " }\n", " }\n", " }\n", " };\n", " // Support: IE <=9 only\n", " // Panic based approach to setting things on disconnected nodes\n", " Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {\n", " set: function (tween) {\n", " if (tween.elem.nodeType && tween.elem.parentNode) {\n", " tween.elem[tween.prop] = tween.now;\n", " }\n", " }\n", " };\n", " jQuery.easing = {\n", " linear: function (p) {\n", " return p;\n", " },\n", " swing: function (p) {\n", " return 0.5 - Math.cos(p * Math.PI) / 2;\n", " },\n", " _default: \"swing\"\n", " };\n", " jQuery.fx = Tween.prototype.init;\n", " // Back compat <1.8 extension point\n", " jQuery.fx.step = {};\n", " var fxNow, inProgress, rfxtypes = /^(?:toggle|show|hide)$/, rrun = /queueHooks$/;\n", " function schedule() {\n", " if (inProgress) {\n", " if (document.hidden === false && window.requestAnimationFrame) {\n", " window.requestAnimationFrame(schedule);\n", " }\n", " else {\n", " window.setTimeout(schedule, jQuery.fx.interval);\n", " }\n", " jQuery.fx.tick();\n", " }\n", " }\n", " // Animations created synchronously will run synchronously\n", " function createFxNow() {\n", " window.setTimeout(function () {\n", " fxNow = undefined;\n", " });\n", " return (fxNow = Date.now());\n", " }\n", " // Generate parameters to create a standard animation\n", " function genFx(type, includeWidth) {\n", " var which, i = 0, attrs = { height: type };\n", " // If we include width, step value is 1 to do all cssExpand values,\n", " // otherwise step value is 2 to skip over Left and Right\n", " includeWidth = includeWidth ? 1 : 0;\n", " for (; i < 4; i += 2 - includeWidth) {\n", " which = cssExpand[i];\n", " attrs[\"margin\" + which] = attrs[\"padding\" + which] = type;\n", " }\n", " if (includeWidth) {\n", " attrs.opacity = attrs.width = type;\n", " }\n", " return attrs;\n", " }\n", " function createTween(value, prop, animation) {\n", " var tween, collection = (Animation.tweeners[prop] || []).concat(Animation.tweeners[\"*\"]), index = 0, length = collection.length;\n", " for (; index < length; index++) {\n", " if ((tween = collection[index].call(animation, prop, value))) {\n", " // We're done with this property\n", " return tween;\n", " }\n", " }\n", " }\n", " function defaultPrefilter(elem, props, opts) {\n", " var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, isBox = \"width\" in props || \"height\" in props, anim = this, orig = {}, style = elem.style, hidden = elem.nodeType && isHiddenWithinTree(elem), dataShow = dataPriv.get(elem, \"fxshow\");\n", " // Queue-skipping animations hijack the fx hooks\n", " if (!opts.queue) {\n", " hooks = jQuery._queueHooks(elem, \"fx\");\n", " if (hooks.unqueued == null) {\n", " hooks.unqueued = 0;\n", " oldfire = hooks.empty.fire;\n", " hooks.empty.fire = function () {\n", " if (!hooks.unqueued) {\n", " oldfire();\n", " }\n", " };\n", " }\n", " hooks.unqueued++;\n", " anim.always(function () {\n", " // Ensure the complete handler is called before this completes\n", " anim.always(function () {\n", " hooks.unqueued--;\n", " if (!jQuery.queue(elem, \"fx\").length) {\n", " hooks.empty.fire();\n", " }\n", " });\n", " });\n", " }\n", " // Detect show/hide animations\n", " for (prop in props) {\n", " value = props[prop];\n", " if (rfxtypes.test(value)) {\n", " delete props[prop];\n", " toggle = toggle || value === \"toggle\";\n", " if (value === (hidden ? \"hide\" : \"show\")) {\n", " // Pretend to be hidden if this is a \"show\" and\n", " // there is still data from a stopped show/hide\n", " if (value === \"show\" && dataShow && dataShow[prop] !== undefined) {\n", " hidden = true;\n", " // Ignore all other no-op show/hide data\n", " }\n", " else {\n", " continue;\n", " }\n", " }\n", " orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop);\n", " }\n", " }\n", " // Bail out if this is a no-op like .hide().hide()\n", " propTween = !jQuery.isEmptyObject(props);\n", " if (!propTween && jQuery.isEmptyObject(orig)) {\n", " return;\n", " }\n", " // Restrict \"overflow\" and \"display\" styles during box animations\n", " if (isBox && elem.nodeType === 1) {\n", " // Support: IE <=9 - 11, Edge 12 - 15\n", " // Record all 3 overflow attributes because IE does not infer the shorthand\n", " // from identically-valued overflowX and overflowY and Edge just mirrors\n", " // the overflowX value there.\n", " opts.overflow = [style.overflow, style.overflowX, style.overflowY];\n", " // Identify a display type, preferring old show/hide data over the CSS cascade\n", " restoreDisplay = dataShow && dataShow.display;\n", " if (restoreDisplay == null) {\n", " restoreDisplay = dataPriv.get(elem, \"display\");\n", " }\n", " display = jQuery.css(elem, \"display\");\n", " if (display === \"none\") {\n", " if (restoreDisplay) {\n", " display = restoreDisplay;\n", " }\n", " else {\n", " // Get nonempty value(s) by temporarily forcing visibility\n", " showHide([elem], true);\n", " restoreDisplay = elem.style.display || restoreDisplay;\n", " display = jQuery.css(elem, \"display\");\n", " showHide([elem]);\n", " }\n", " }\n", " // Animate inline elements as inline-block\n", " if (display === \"inline\" || display === \"inline-block\" && restoreDisplay != null) {\n", " if (jQuery.css(elem, \"float\") === \"none\") {\n", " // Restore the original display value at the end of pure show/hide animations\n", " if (!propTween) {\n", " anim.done(function () {\n", " style.display = restoreDisplay;\n", " });\n", " if (restoreDisplay == null) {\n", " display = style.display;\n", " restoreDisplay = display === \"none\" ? \"\" : display;\n", " }\n", " }\n", " style.display = \"inline-block\";\n", " }\n", " }\n", " }\n", " if (opts.overflow) {\n", " style.overflow = \"hidden\";\n", " anim.always(function () {\n", " style.overflow = opts.overflow[0];\n", " style.overflowX = opts.overflow[1];\n", " style.overflowY = opts.overflow[2];\n", " });\n", " }\n", " // Implement show/hide animations\n", " propTween = false;\n", " for (prop in orig) {\n", " // General show/hide setup for this element animation\n", " if (!propTween) {\n", " if (dataShow) {\n", " if (\"hidden\" in dataShow) {\n", " hidden = dataShow.hidden;\n", " }\n", " }\n", " else {\n", " dataShow = dataPriv.access(elem, \"fxshow\", { display: restoreDisplay });\n", " }\n", " // Store hidden/visible for toggle so `.stop().toggle()` \"reverses\"\n", " if (toggle) {\n", " dataShow.hidden = !hidden;\n", " }\n", " // Show elements before animating them\n", " if (hidden) {\n", " showHide([elem], true);\n", " }\n", " /* eslint-disable no-loop-func */\n", " anim.done(function () {\n", " /* eslint-enable no-loop-func */\n", " // The final step of a \"hide\" animation is actually hiding the element\n", " if (!hidden) {\n", " showHide([elem]);\n", " }\n", " dataPriv.remove(elem, \"fxshow\");\n", " for (prop in orig) {\n", " jQuery.style(elem, prop, orig[prop]);\n", " }\n", " });\n", " }\n", " // Per-property setup\n", " propTween = createTween(hidden ? dataShow[prop] : 0, prop, anim);\n", " if (!(prop in dataShow)) {\n", " dataShow[prop] = propTween.start;\n", " if (hidden) {\n", " propTween.end = propTween.start;\n", " propTween.start = 0;\n", " }\n", " }\n", " }\n", " }\n", " function propFilter(props, specialEasing) {\n", " var index, name, easing, value, hooks;\n", " // camelCase, specialEasing and expand cssHook pass\n", " for (index in props) {\n", " name = camelCase(index);\n", " easing = specialEasing[name];\n", " value = props[index];\n", " if (Array.isArray(value)) {\n", " easing = value[1];\n", " value = props[index] = value[0];\n", " }\n", " if (index !== name) {\n", " props[name] = value;\n", " delete props[index];\n", " }\n", " hooks = jQuery.cssHooks[name];\n", " if (hooks && \"expand\" in hooks) {\n", " value = hooks.expand(value);\n", " delete props[name];\n", " // Not quite $.extend, this won't overwrite existing keys.\n", " // Reusing 'index' because we have the correct \"name\"\n", " for (index in value) {\n", " if (!(index in props)) {\n", " props[index] = value[index];\n", " specialEasing[index] = easing;\n", " }\n", " }\n", " }\n", " else {\n", " specialEasing[name] = easing;\n", " }\n", " }\n", " }\n", " function Animation(elem, properties, options) {\n", " var result, stopped, index = 0, length = Animation.prefilters.length, deferred = jQuery.Deferred().always(function () {\n", " // Don't match elem in the :animated selector\n", " delete tick.elem;\n", " }), tick = function () {\n", " if (stopped) {\n", " return false;\n", " }\n", " var currentTime = fxNow || createFxNow(), remaining = Math.max(0, animation.startTime + animation.duration - currentTime), \n", " // Support: Android 2.3 only\n", " // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)\n", " temp = remaining / animation.duration || 0, percent = 1 - temp, index = 0, length = animation.tweens.length;\n", " for (; index < length; index++) {\n", " animation.tweens[index].run(percent);\n", " }\n", " deferred.notifyWith(elem, [animation, percent, remaining]);\n", " // If there's more to do, yield\n", " if (percent < 1 && length) {\n", " return remaining;\n", " }\n", " // If this was an empty animation, synthesize a final progress notification\n", " if (!length) {\n", " deferred.notifyWith(elem, [animation, 1, 0]);\n", " }\n", " // Resolve the animation and report its conclusion\n", " deferred.resolveWith(elem, [animation]);\n", " return false;\n", " }, animation = deferred.promise({\n", " elem: elem,\n", " props: jQuery.extend({}, properties),\n", " opts: jQuery.extend(true, {\n", " specialEasing: {},\n", " easing: jQuery.easing._default\n", " }, options),\n", " originalProperties: properties,\n", " originalOptions: options,\n", " startTime: fxNow || createFxNow(),\n", " duration: options.duration,\n", " tweens: [],\n", " createTween: function (prop, end) {\n", " var tween = jQuery.Tween(elem, animation.opts, prop, end, animation.opts.specialEasing[prop] || animation.opts.easing);\n", " animation.tweens.push(tween);\n", " return tween;\n", " },\n", " stop: function (gotoEnd) {\n", " var index = 0, \n", " // If we are going to the end, we want to run all the tweens\n", " // otherwise we skip this part\n", " length = gotoEnd ? animation.tweens.length : 0;\n", " if (stopped) {\n", " return this;\n", " }\n", " stopped = true;\n", " for (; index < length; index++) {\n", " animation.tweens[index].run(1);\n", " }\n", " // Resolve when we played the last frame; otherwise, reject\n", " if (gotoEnd) {\n", " deferred.notifyWith(elem, [animation, 1, 0]);\n", " deferred.resolveWith(elem, [animation, gotoEnd]);\n", " }\n", " else {\n", " deferred.rejectWith(elem, [animation, gotoEnd]);\n", " }\n", " return this;\n", " }\n", " }), props = animation.props;\n", " propFilter(props, animation.opts.specialEasing);\n", " for (; index < length; index++) {\n", " result = Animation.prefilters[index].call(animation, elem, props, animation.opts);\n", " if (result) {\n", " if (isFunction(result.stop)) {\n", " jQuery._queueHooks(animation.elem, animation.opts.queue).stop =\n", " result.stop.bind(result);\n", " }\n", " return result;\n", " }\n", " }\n", " jQuery.map(props, createTween, animation);\n", " if (isFunction(animation.opts.start)) {\n", " animation.opts.start.call(elem, animation);\n", " }\n", " // Attach callbacks from options\n", " animation\n", " .progress(animation.opts.progress)\n", " .done(animation.opts.done, animation.opts.complete)\n", " .fail(animation.opts.fail)\n", " .always(animation.opts.always);\n", " jQuery.fx.timer(jQuery.extend(tick, {\n", " elem: elem,\n", " anim: animation,\n", " queue: animation.opts.queue\n", " }));\n", " return animation;\n", " }\n", " jQuery.Animation = jQuery.extend(Animation, {\n", " tweeners: {\n", " \"*\": [function (prop, value) {\n", " var tween = this.createTween(prop, value);\n", " adjustCSS(tween.elem, prop, rcssNum.exec(value), tween);\n", " return tween;\n", " }]\n", " },\n", " tweener: function (props, callback) {\n", " if (isFunction(props)) {\n", " callback = props;\n", " props = [\"*\"];\n", " }\n", " else {\n", " props = props.match(rnothtmlwhite);\n", " }\n", " var prop, index = 0, length = props.length;\n", " for (; index < length; index++) {\n", " prop = props[index];\n", " Animation.tweeners[prop] = Animation.tweeners[prop] || [];\n", " Animation.tweeners[prop].unshift(callback);\n", " }\n", " },\n", " prefilters: [defaultPrefilter],\n", " prefilter: function (callback, prepend) {\n", " if (prepend) {\n", " Animation.prefilters.unshift(callback);\n", " }\n", " else {\n", " Animation.prefilters.push(callback);\n", " }\n", " }\n", " });\n", " jQuery.speed = function (speed, easing, fn) {\n", " var opt = speed && typeof speed === \"object\" ? jQuery.extend({}, speed) : {\n", " complete: fn || !fn && easing ||\n", " isFunction(speed) && speed,\n", " duration: speed,\n", " easing: fn && easing || easing && !isFunction(easing) && easing\n", " };\n", " // Go to the end state if fx are off\n", " if (jQuery.fx.off) {\n", " opt.duration = 0;\n", " }\n", " else {\n", " if (typeof opt.duration !== \"number\") {\n", " if (opt.duration in jQuery.fx.speeds) {\n", " opt.duration = jQuery.fx.speeds[opt.duration];\n", " }\n", " else {\n", " opt.duration = jQuery.fx.speeds._default;\n", " }\n", " }\n", " }\n", " // Normalize opt.queue - true/undefined/null -> \"fx\"\n", " if (opt.queue == null || opt.queue === true) {\n", " opt.queue = \"fx\";\n", " }\n", " // Queueing\n", " opt.old = opt.complete;\n", " opt.complete = function () {\n", " if (isFunction(opt.old)) {\n", " opt.old.call(this);\n", " }\n", " if (opt.queue) {\n", " jQuery.dequeue(this, opt.queue);\n", " }\n", " };\n", " return opt;\n", " };\n", " jQuery.fn.extend({\n", " fadeTo: function (speed, to, easing, callback) {\n", " // Show any hidden elements after setting opacity to 0\n", " return this.filter(isHiddenWithinTree).css(\"opacity\", 0).show()\n", " // Animate to the value specified\n", " .end().animate({ opacity: to }, speed, easing, callback);\n", " },\n", " animate: function (prop, speed, easing, callback) {\n", " var empty = jQuery.isEmptyObject(prop), optall = jQuery.speed(speed, easing, callback), doAnimation = function () {\n", " // Operate on a copy of prop so per-property easing won't be lost\n", " var anim = Animation(this, jQuery.extend({}, prop), optall);\n", " // Empty animations, or finishing resolves immediately\n", " if (empty || dataPriv.get(this, \"finish\")) {\n", " anim.stop(true);\n", " }\n", " };\n", " doAnimation.finish = doAnimation;\n", " return empty || optall.queue === false ?\n", " this.each(doAnimation) :\n", " this.queue(optall.queue, doAnimation);\n", " },\n", " stop: function (type, clearQueue, gotoEnd) {\n", " var stopQueue = function (hooks) {\n", " var stop = hooks.stop;\n", " delete hooks.stop;\n", " stop(gotoEnd);\n", " };\n", " if (typeof type !== \"string\") {\n", " gotoEnd = clearQueue;\n", " clearQueue = type;\n", " type = undefined;\n", " }\n", " if (clearQueue) {\n", " this.queue(type || \"fx\", []);\n", " }\n", " return this.each(function () {\n", " var dequeue = true, index = type != null && type + \"queueHooks\", timers = jQuery.timers, data = dataPriv.get(this);\n", " if (index) {\n", " if (data[index] && data[index].stop) {\n", " stopQueue(data[index]);\n", " }\n", " }\n", " else {\n", " for (index in data) {\n", " if (data[index] && data[index].stop && rrun.test(index)) {\n", " stopQueue(data[index]);\n", " }\n", " }\n", " }\n", " for (index = timers.length; index--;) {\n", " if (timers[index].elem === this &&\n", " (type == null || timers[index].queue === type)) {\n", " timers[index].anim.stop(gotoEnd);\n", " dequeue = false;\n", " timers.splice(index, 1);\n", " }\n", " }\n", " // Start the next in the queue if the last step wasn't forced.\n", " // Timers currently will call their complete callbacks, which\n", " // will dequeue but only if they were gotoEnd.\n", " if (dequeue || !gotoEnd) {\n", " jQuery.dequeue(this, type);\n", " }\n", " });\n", " },\n", " finish: function (type) {\n", " if (type !== false) {\n", " type = type || \"fx\";\n", " }\n", " return this.each(function () {\n", " var index, data = dataPriv.get(this), queue = data[type + \"queue\"], hooks = data[type + \"queueHooks\"], timers = jQuery.timers, length = queue ? queue.length : 0;\n", " // Enable finishing flag on private data\n", " data.finish = true;\n", " // Empty the queue first\n", " jQuery.queue(this, type, []);\n", " if (hooks && hooks.stop) {\n", " hooks.stop.call(this, true);\n", " }\n", " // Look for any active animations, and finish them\n", " for (index = timers.length; index--;) {\n", " if (timers[index].elem === this && timers[index].queue === type) {\n", " timers[index].anim.stop(true);\n", " timers.splice(index, 1);\n", " }\n", " }\n", " // Look for any animations in the old queue and finish them\n", " for (index = 0; index < length; index++) {\n", " if (queue[index] && queue[index].finish) {\n", " queue[index].finish.call(this);\n", " }\n", " }\n", " // Turn off finishing flag\n", " delete data.finish;\n", " });\n", " }\n", " });\n", " jQuery.each([\"toggle\", \"show\", \"hide\"], function (_i, name) {\n", " var cssFn = jQuery.fn[name];\n", " jQuery.fn[name] = function (speed, easing, callback) {\n", " return speed == null || typeof speed === \"boolean\" ?\n", " cssFn.apply(this, arguments) :\n", " this.animate(genFx(name, true), speed, easing, callback);\n", " };\n", " });\n", " // Generate shortcuts for custom animations\n", " jQuery.each({\n", " slideDown: genFx(\"show\"),\n", " slideUp: genFx(\"hide\"),\n", " slideToggle: genFx(\"toggle\"),\n", " fadeIn: { opacity: \"show\" },\n", " fadeOut: { opacity: \"hide\" },\n", " fadeToggle: { opacity: \"toggle\" }\n", " }, function (name, props) {\n", " jQuery.fn[name] = function (speed, easing, callback) {\n", " return this.animate(props, speed, easing, callback);\n", " };\n", " });\n", " jQuery.timers = [];\n", " jQuery.fx.tick = function () {\n", " var timer, i = 0, timers = jQuery.timers;\n", " fxNow = Date.now();\n", " for (; i < timers.length; i++) {\n", " timer = timers[i];\n", " // Run the timer and safely remove it when done (allowing for external removal)\n", " if (!timer() && timers[i] === timer) {\n", " timers.splice(i--, 1);\n", " }\n", " }\n", " if (!timers.length) {\n", " jQuery.fx.stop();\n", " }\n", " fxNow = undefined;\n", " };\n", " jQuery.fx.timer = function (timer) {\n", " jQuery.timers.push(timer);\n", " jQuery.fx.start();\n", " };\n", " jQuery.fx.interval = 13;\n", " jQuery.fx.start = function () {\n", " if (inProgress) {\n", " return;\n", " }\n", " inProgress = true;\n", " schedule();\n", " };\n", " jQuery.fx.stop = function () {\n", " inProgress = null;\n", " };\n", " jQuery.fx.speeds = {\n", " slow: 600,\n", " fast: 200,\n", " // Default speed\n", " _default: 400\n", " };\n", " // Based off of the plugin by Clint Helfers, with permission.\n", " // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/\n", " jQuery.fn.delay = function (time, type) {\n", " time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;\n", " type = type || \"fx\";\n", " return this.queue(type, function (next, hooks) {\n", " var timeout = window.setTimeout(next, time);\n", " hooks.stop = function () {\n", " window.clearTimeout(timeout);\n", " };\n", " });\n", " };\n", " (function () {\n", " var input = document.createElement(\"input\"), select = document.createElement(\"select\"), opt = select.appendChild(document.createElement(\"option\"));\n", " input.type = \"checkbox\";\n", " // Support: Android <=4.3 only\n", " // Default value for a checkbox should be \"on\"\n", " support.checkOn = input.value !== \"\";\n", " // Support: IE <=11 only\n", " // Must access selectedIndex to make default options select\n", " support.optSelected = opt.selected;\n", " // Support: IE <=11 only\n", " // An input loses its value after becoming a radio\n", " input = document.createElement(\"input\");\n", " input.value = \"t\";\n", " input.type = \"radio\";\n", " support.radioValue = input.value === \"t\";\n", " })();\n", " var boolHook, attrHandle = jQuery.expr.attrHandle;\n", " jQuery.fn.extend({\n", " attr: function (name, value) {\n", " return access(this, jQuery.attr, name, value, arguments.length > 1);\n", " },\n", " removeAttr: function (name) {\n", " return this.each(function () {\n", " jQuery.removeAttr(this, name);\n", " });\n", " }\n", " });\n", " jQuery.extend({\n", " attr: function (elem, name, value) {\n", " var ret, hooks, nType = elem.nodeType;\n", " // Don't get/set attributes on text, comment and attribute nodes\n", " if (nType === 3 || nType === 8 || nType === 2) {\n", " return;\n", " }\n", " // Fallback to prop when attributes are not supported\n", " if (typeof elem.getAttribute === \"undefined\") {\n", " return jQuery.prop(elem, name, value);\n", " }\n", " // Attribute hooks are determined by the lowercase version\n", " // Grab necessary hook if one is defined\n", " if (nType !== 1 || !jQuery.isXMLDoc(elem)) {\n", " hooks = jQuery.attrHooks[name.toLowerCase()] ||\n", " (jQuery.expr.match.bool.test(name) ? boolHook : undefined);\n", " }\n", " if (value !== undefined) {\n", " if (value === null) {\n", " jQuery.removeAttr(elem, name);\n", " return;\n", " }\n", " if (hooks && \"set\" in hooks &&\n", " (ret = hooks.set(elem, value, name)) !== undefined) {\n", " return ret;\n", " }\n", " elem.setAttribute(name, value + \"\");\n", " return value;\n", " }\n", " if (hooks && \"get\" in hooks && (ret = hooks.get(elem, name)) !== null) {\n", " return ret;\n", " }\n", " ret = jQuery.find.attr(elem, name);\n", " // Non-existent attributes return null, we normalize to undefined\n", " return ret == null ? undefined : ret;\n", " },\n", " attrHooks: {\n", " type: {\n", " set: function (elem, value) {\n", " if (!support.radioValue && value === \"radio\" &&\n", " nodeName(elem, \"input\")) {\n", " var val = elem.value;\n", " elem.setAttribute(\"type\", value);\n", " if (val) {\n", " elem.value = val;\n", " }\n", " return value;\n", " }\n", " }\n", " }\n", " },\n", " removeAttr: function (elem, value) {\n", " var name, i = 0, \n", " // Attribute names can contain non-HTML whitespace characters\n", " // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2\n", " attrNames = value && value.match(rnothtmlwhite);\n", " if (attrNames && elem.nodeType === 1) {\n", " while ((name = attrNames[i++])) {\n", " elem.removeAttribute(name);\n", " }\n", " }\n", " }\n", " });\n", " // Hooks for boolean attributes\n", " boolHook = {\n", " set: function (elem, value, name) {\n", " if (value === false) {\n", " // Remove boolean attributes when set to false\n", " jQuery.removeAttr(elem, name);\n", " }\n", " else {\n", " elem.setAttribute(name, name);\n", " }\n", " return name;\n", " }\n", " };\n", " jQuery.each(jQuery.expr.match.bool.source.match(/\\w+/g), function (_i, name) {\n", " var getter = attrHandle[name] || jQuery.find.attr;\n", " attrHandle[name] = function (elem, name, isXML) {\n", " var ret, handle, lowercaseName = name.toLowerCase();\n", " if (!isXML) {\n", " // Avoid an infinite loop by temporarily removing this function from the getter\n", " handle = attrHandle[lowercaseName];\n", " attrHandle[lowercaseName] = ret;\n", " ret = getter(elem, name, isXML) != null ?\n", " lowercaseName :\n", " null;\n", " attrHandle[lowercaseName] = handle;\n", " }\n", " return ret;\n", " };\n", " });\n", " var rfocusable = /^(?:input|select|textarea|button)$/i, rclickable = /^(?:a|area)$/i;\n", " jQuery.fn.extend({\n", " prop: function (name, value) {\n", " return access(this, jQuery.prop, name, value, arguments.length > 1);\n", " },\n", " removeProp: function (name) {\n", " return this.each(function () {\n", " delete this[jQuery.propFix[name] || name];\n", " });\n", " }\n", " });\n", " jQuery.extend({\n", " prop: function (elem, name, value) {\n", " var ret, hooks, nType = elem.nodeType;\n", " // Don't get/set properties on text, comment and attribute nodes\n", " if (nType === 3 || nType === 8 || nType === 2) {\n", " return;\n", " }\n", " if (nType !== 1 || !jQuery.isXMLDoc(elem)) {\n", " // Fix name and attach hooks\n", " name = jQuery.propFix[name] || name;\n", " hooks = jQuery.propHooks[name];\n", " }\n", " if (value !== undefined) {\n", " if (hooks && \"set\" in hooks &&\n", " (ret = hooks.set(elem, value, name)) !== undefined) {\n", " return ret;\n", " }\n", " return (elem[name] = value);\n", " }\n", " if (hooks && \"get\" in hooks && (ret = hooks.get(elem, name)) !== null) {\n", " return ret;\n", " }\n", " return elem[name];\n", " },\n", " propHooks: {\n", " tabIndex: {\n", " get: function (elem) {\n", " // Support: IE <=9 - 11 only\n", " // elem.tabIndex doesn't always return the\n", " // correct value when it hasn't been explicitly set\n", " // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/\n", " // Use proper attribute retrieval(#12072)\n", " var tabindex = jQuery.find.attr(elem, \"tabindex\");\n", " if (tabindex) {\n", " return parseInt(tabindex, 10);\n", " }\n", " if (rfocusable.test(elem.nodeName) ||\n", " rclickable.test(elem.nodeName) &&\n", " elem.href) {\n", " return 0;\n", " }\n", " return -1;\n", " }\n", " }\n", " },\n", " propFix: {\n", " \"for\": \"htmlFor\",\n", " \"class\": \"className\"\n", " }\n", " });\n", " // Support: IE <=11 only\n", " // Accessing the selectedIndex property\n", " // forces the browser to respect setting selected\n", " // on the option\n", " // The getter ensures a default option is selected\n", " // when in an optgroup\n", " // eslint rule \"no-unused-expressions\" is disabled for this code\n", " // since it considers such accessions noop\n", " if (!support.optSelected) {\n", " jQuery.propHooks.selected = {\n", " get: function (elem) {\n", " /* eslint no-unused-expressions: \"off\" */\n", " var parent = elem.parentNode;\n", " if (parent && parent.parentNode) {\n", " parent.parentNode.selectedIndex;\n", " }\n", " return null;\n", " },\n", " set: function (elem) {\n", " /* eslint no-unused-expressions: \"off\" */\n", " var parent = elem.parentNode;\n", " if (parent) {\n", " parent.selectedIndex;\n", " if (parent.parentNode) {\n", " parent.parentNode.selectedIndex;\n", " }\n", " }\n", " }\n", " };\n", " }\n", " jQuery.each([\n", " \"tabIndex\",\n", " \"readOnly\",\n", " \"maxLength\",\n", " \"cellSpacing\",\n", " \"cellPadding\",\n", " \"rowSpan\",\n", " \"colSpan\",\n", " \"useMap\",\n", " \"frameBorder\",\n", " \"contentEditable\"\n", " ], function () {\n", " jQuery.propFix[this.toLowerCase()] = this;\n", " });\n", " // Strip and collapse whitespace according to HTML spec\n", " // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace\n", " function stripAndCollapse(value) {\n", " var tokens = value.match(rnothtmlwhite) || [];\n", " return tokens.join(\" \");\n", " }\n", " function getClass(elem) {\n", " return elem.getAttribute && elem.getAttribute(\"class\") || \"\";\n", " }\n", " function classesToArray(value) {\n", " if (Array.isArray(value)) {\n", " return value;\n", " }\n", " if (typeof value === \"string\") {\n", " return value.match(rnothtmlwhite) || [];\n", " }\n", " return [];\n", " }\n", " jQuery.fn.extend({\n", " addClass: function (value) {\n", " var classes, elem, cur, curValue, clazz, j, finalValue, i = 0;\n", " if (isFunction(value)) {\n", " return this.each(function (j) {\n", " jQuery(this).addClass(value.call(this, j, getClass(this)));\n", " });\n", " }\n", " classes = classesToArray(value);\n", " if (classes.length) {\n", " while ((elem = this[i++])) {\n", " curValue = getClass(elem);\n", " cur = elem.nodeType === 1 && (\" \" + stripAndCollapse(curValue) + \" \");\n", " if (cur) {\n", " j = 0;\n", " while ((clazz = classes[j++])) {\n", " if (cur.indexOf(\" \" + clazz + \" \") < 0) {\n", " cur += clazz + \" \";\n", " }\n", " }\n", " // Only assign if different to avoid unneeded rendering.\n", " finalValue = stripAndCollapse(cur);\n", " if (curValue !== finalValue) {\n", " elem.setAttribute(\"class\", finalValue);\n", " }\n", " }\n", " }\n", " }\n", " return this;\n", " },\n", " removeClass: function (value) {\n", " var classes, elem, cur, curValue, clazz, j, finalValue, i = 0;\n", " if (isFunction(value)) {\n", " return this.each(function (j) {\n", " jQuery(this).removeClass(value.call(this, j, getClass(this)));\n", " });\n", " }\n", " if (!arguments.length) {\n", " return this.attr(\"class\", \"\");\n", " }\n", " classes = classesToArray(value);\n", " if (classes.length) {\n", " while ((elem = this[i++])) {\n", " curValue = getClass(elem);\n", " // This expression is here for better compressibility (see addClass)\n", " cur = elem.nodeType === 1 && (\" \" + stripAndCollapse(curValue) + \" \");\n", " if (cur) {\n", " j = 0;\n", " while ((clazz = classes[j++])) {\n", " // Remove *all* instances\n", " while (cur.indexOf(\" \" + clazz + \" \") > -1) {\n", " cur = cur.replace(\" \" + clazz + \" \", \" \");\n", " }\n", " }\n", " // Only assign if different to avoid unneeded rendering.\n", " finalValue = stripAndCollapse(cur);\n", " if (curValue !== finalValue) {\n", " elem.setAttribute(\"class\", finalValue);\n", " }\n", " }\n", " }\n", " }\n", " return this;\n", " },\n", " toggleClass: function (value, stateVal) {\n", " var type = typeof value, isValidValue = type === \"string\" || Array.isArray(value);\n", " if (typeof stateVal === \"boolean\" && isValidValue) {\n", " return stateVal ? this.addClass(value) : this.removeClass(value);\n", " }\n", " if (isFunction(value)) {\n", " return this.each(function (i) {\n", " jQuery(this).toggleClass(value.call(this, i, getClass(this), stateVal), stateVal);\n", " });\n", " }\n", " return this.each(function () {\n", " var className, i, self, classNames;\n", " if (isValidValue) {\n", " // Toggle individual class names\n", " i = 0;\n", " self = jQuery(this);\n", " classNames = classesToArray(value);\n", " while ((className = classNames[i++])) {\n", " // Check each className given, space separated list\n", " if (self.hasClass(className)) {\n", " self.removeClass(className);\n", " }\n", " else {\n", " self.addClass(className);\n", " }\n", " }\n", " // Toggle whole class name\n", " }\n", " else if (value === undefined || type === \"boolean\") {\n", " className = getClass(this);\n", " if (className) {\n", " // Store className if set\n", " dataPriv.set(this, \"__className__\", className);\n", " }\n", " // If the element has a class name or if we're passed `false`,\n", " // then remove the whole classname (if there was one, the above saved it).\n", " // Otherwise bring back whatever was previously saved (if anything),\n", " // falling back to the empty string if nothing was stored.\n", " if (this.setAttribute) {\n", " this.setAttribute(\"class\", className || value === false ?\n", " \"\" :\n", " dataPriv.get(this, \"__className__\") || \"\");\n", " }\n", " }\n", " });\n", " },\n", " hasClass: function (selector) {\n", " var className, elem, i = 0;\n", " className = \" \" + selector + \" \";\n", " while ((elem = this[i++])) {\n", " if (elem.nodeType === 1 &&\n", " (\" \" + stripAndCollapse(getClass(elem)) + \" \").indexOf(className) > -1) {\n", " return true;\n", " }\n", " }\n", " return false;\n", " }\n", " });\n", " var rreturn = /\\r/g;\n", " jQuery.fn.extend({\n", " val: function (value) {\n", " var hooks, ret, valueIsFunction, elem = this[0];\n", " if (!arguments.length) {\n", " if (elem) {\n", " hooks = jQuery.valHooks[elem.type] ||\n", " jQuery.valHooks[elem.nodeName.toLowerCase()];\n", " if (hooks &&\n", " \"get\" in hooks &&\n", " (ret = hooks.get(elem, \"value\")) !== undefined) {\n", " return ret;\n", " }\n", " ret = elem.value;\n", " // Handle most common string cases\n", " if (typeof ret === \"string\") {\n", " return ret.replace(rreturn, \"\");\n", " }\n", " // Handle cases where value is null/undef or number\n", " return ret == null ? \"\" : ret;\n", " }\n", " return;\n", " }\n", " valueIsFunction = isFunction(value);\n", " return this.each(function (i) {\n", " var val;\n", " if (this.nodeType !== 1) {\n", " return;\n", " }\n", " if (valueIsFunction) {\n", " val = value.call(this, i, jQuery(this).val());\n", " }\n", " else {\n", " val = value;\n", " }\n", " // Treat null/undefined as \"\"; convert numbers to string\n", " if (val == null) {\n", " val = \"\";\n", " }\n", " else if (typeof val === \"number\") {\n", " val += \"\";\n", " }\n", " else if (Array.isArray(val)) {\n", " val = jQuery.map(val, function (value) {\n", " return value == null ? \"\" : value + \"\";\n", " });\n", " }\n", " hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()];\n", " // If set returns undefined, fall back to normal setting\n", " if (!hooks || !(\"set\" in hooks) || hooks.set(this, val, \"value\") === undefined) {\n", " this.value = val;\n", " }\n", " });\n", " }\n", " });\n", " jQuery.extend({\n", " valHooks: {\n", " option: {\n", " get: function (elem) {\n", " var val = jQuery.find.attr(elem, \"value\");\n", " return val != null ?\n", " val :\n", " // Support: IE <=10 - 11 only\n", " // option.text throws exceptions (#14686, #14858)\n", " // Strip and collapse whitespace\n", " // https://html.spec.whatwg.org/#strip-and-collapse-whitespace\n", " stripAndCollapse(jQuery.text(elem));\n", " }\n", " },\n", " select: {\n", " get: function (elem) {\n", " var value, option, i, options = elem.options, index = elem.selectedIndex, one = elem.type === \"select-one\", values = one ? null : [], max = one ? index + 1 : options.length;\n", " if (index < 0) {\n", " i = max;\n", " }\n", " else {\n", " i = one ? index : 0;\n", " }\n", " // Loop through all the selected options\n", " for (; i < max; i++) {\n", " option = options[i];\n", " // Support: IE <=9 only\n", " // IE8-9 doesn't update selected after form reset (#2551)\n", " if ((option.selected || i === index) &&\n", " // Don't return options that are disabled or in a disabled optgroup\n", " !option.disabled &&\n", " (!option.parentNode.disabled ||\n", " !nodeName(option.parentNode, \"optgroup\"))) {\n", " // Get the specific value for the option\n", " value = jQuery(option).val();\n", " // We don't need an array for one selects\n", " if (one) {\n", " return value;\n", " }\n", " // Multi-Selects return an array\n", " values.push(value);\n", " }\n", " }\n", " return values;\n", " },\n", " set: function (elem, value) {\n", " var optionSet, option, options = elem.options, values = jQuery.makeArray(value), i = options.length;\n", " while (i--) {\n", " option = options[i];\n", " /* eslint-disable no-cond-assign */\n", " if (option.selected =\n", " jQuery.inArray(jQuery.valHooks.option.get(option), values) > -1) {\n", " optionSet = true;\n", " }\n", " /* eslint-enable no-cond-assign */\n", " }\n", " // Force browsers to behave consistently when non-matching value is set\n", " if (!optionSet) {\n", " elem.selectedIndex = -1;\n", " }\n", " return values;\n", " }\n", " }\n", " }\n", " });\n", " // Radios and checkboxes getter/setter\n", " jQuery.each([\"radio\", \"checkbox\"], function () {\n", " jQuery.valHooks[this] = {\n", " set: function (elem, value) {\n", " if (Array.isArray(value)) {\n", " return (elem.checked = jQuery.inArray(jQuery(elem).val(), value) > -1);\n", " }\n", " }\n", " };\n", " if (!support.checkOn) {\n", " jQuery.valHooks[this].get = function (elem) {\n", " return elem.getAttribute(\"value\") === null ? \"on\" : elem.value;\n", " };\n", " }\n", " });\n", " // Return jQuery for attributes-only inclusion\n", " support.focusin = \"onfocusin\" in window;\n", " var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, stopPropagationCallback = function (e) {\n", " e.stopPropagation();\n", " };\n", " jQuery.extend(jQuery.event, {\n", " trigger: function (event, data, elem, onlyHandlers) {\n", " var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, eventPath = [elem || document], type = hasOwn.call(event, \"type\") ? event.type : event, namespaces = hasOwn.call(event, \"namespace\") ? event.namespace.split(\".\") : [];\n", " cur = lastElement = tmp = elem = elem || document;\n", " // Don't do events on text and comment nodes\n", " if (elem.nodeType === 3 || elem.nodeType === 8) {\n", " return;\n", " }\n", " // focus/blur morphs to focusin/out; ensure we're not firing them right now\n", " if (rfocusMorph.test(type + jQuery.event.triggered)) {\n", " return;\n", " }\n", " if (type.indexOf(\".\") > -1) {\n", " // Namespaced trigger; create a regexp to match event type in handle()\n", " namespaces = type.split(\".\");\n", " type = namespaces.shift();\n", " namespaces.sort();\n", " }\n", " ontype = type.indexOf(\":\") < 0 && \"on\" + type;\n", " // Caller can pass in a jQuery.Event object, Object, or just an event type string\n", " event = event[jQuery.expando] ?\n", " event :\n", " new jQuery.Event(type, typeof event === \"object\" && event);\n", " // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)\n", " event.isTrigger = onlyHandlers ? 2 : 3;\n", " event.namespace = namespaces.join(\".\");\n", " event.rnamespace = event.namespace ?\n", " new RegExp(\"(^|\\\\.)\" + namespaces.join(\"\\\\.(?:.*\\\\.|)\") + \"(\\\\.|$)\") :\n", " null;\n", " // Clean up the event in case it is being reused\n", " event.result = undefined;\n", " if (!event.target) {\n", " event.target = elem;\n", " }\n", " // Clone any incoming data and prepend the event, creating the handler arg list\n", " data = data == null ?\n", " [event] :\n", " jQuery.makeArray(data, [event]);\n", " // Allow special events to draw outside the lines\n", " special = jQuery.event.special[type] || {};\n", " if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) {\n", " return;\n", " }\n", " // Determine event propagation path in advance, per W3C events spec (#9951)\n", " // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)\n", " if (!onlyHandlers && !special.noBubble && !isWindow(elem)) {\n", " bubbleType = special.delegateType || type;\n", " if (!rfocusMorph.test(bubbleType + type)) {\n", " cur = cur.parentNode;\n", " }\n", " for (; cur; cur = cur.parentNode) {\n", " eventPath.push(cur);\n", " tmp = cur;\n", " }\n", " // Only add window if we got to document (e.g., not plain obj or detached DOM)\n", " if (tmp === (elem.ownerDocument || document)) {\n", " eventPath.push(tmp.defaultView || tmp.parentWindow || window);\n", " }\n", " }\n", " // Fire handlers on the event path\n", " i = 0;\n", " while ((cur = eventPath[i++]) && !event.isPropagationStopped()) {\n", " lastElement = cur;\n", " event.type = i > 1 ?\n", " bubbleType :\n", " special.bindType || type;\n", " // jQuery handler\n", " handle = (dataPriv.get(cur, \"events\") || Object.create(null))[event.type] &&\n", " dataPriv.get(cur, \"handle\");\n", " if (handle) {\n", " handle.apply(cur, data);\n", " }\n", " // Native handler\n", " handle = ontype && cur[ontype];\n", " if (handle && handle.apply && acceptData(cur)) {\n", " event.result = handle.apply(cur, data);\n", " if (event.result === false) {\n", " event.preventDefault();\n", " }\n", " }\n", " }\n", " event.type = type;\n", " // If nobody prevented the default action, do it now\n", " if (!onlyHandlers && !event.isDefaultPrevented()) {\n", " if ((!special._default ||\n", " special._default.apply(eventPath.pop(), data) === false) &&\n", " acceptData(elem)) {\n", " // Call a native DOM method on the target with the same name as the event.\n", " // Don't do default actions on window, that's where global variables be (#6170)\n", " if (ontype && isFunction(elem[type]) && !isWindow(elem)) {\n", " // Don't re-trigger an onFOO event when we call its FOO() method\n", " tmp = elem[ontype];\n", " if (tmp) {\n", " elem[ontype] = null;\n", " }\n", " // Prevent re-triggering of the same event, since we already bubbled it above\n", " jQuery.event.triggered = type;\n", " if (event.isPropagationStopped()) {\n", " lastElement.addEventListener(type, stopPropagationCallback);\n", " }\n", " elem[type]();\n", " if (event.isPropagationStopped()) {\n", " lastElement.removeEventListener(type, stopPropagationCallback);\n", " }\n", " jQuery.event.triggered = undefined;\n", " if (tmp) {\n", " elem[ontype] = tmp;\n", " }\n", " }\n", " }\n", " }\n", " return event.result;\n", " },\n", " // Piggyback on a donor event to simulate a different one\n", " // Used only for `focus(in | out)` events\n", " simulate: function (type, elem, event) {\n", " var e = jQuery.extend(new jQuery.Event(), event, {\n", " type: type,\n", " isSimulated: true\n", " });\n", " jQuery.event.trigger(e, null, elem);\n", " }\n", " });\n", " jQuery.fn.extend({\n", " trigger: function (type, data) {\n", " return this.each(function () {\n", " jQuery.event.trigger(type, data, this);\n", " });\n", " },\n", " triggerHandler: function (type, data) {\n", " var elem = this[0];\n", " if (elem) {\n", " return jQuery.event.trigger(type, data, elem, true);\n", " }\n", " }\n", " });\n", " // Support: Firefox <=44\n", " // Firefox doesn't have focus(in | out) events\n", " // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787\n", " //\n", " // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1\n", " // focus(in | out) events fire after focus & blur events,\n", " // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order\n", " // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857\n", " if (!support.focusin) {\n", " jQuery.each({ focus: \"focusin\", blur: \"focusout\" }, function (orig, fix) {\n", " // Attach a single capturing handler on the document while someone wants focusin/focusout\n", " var handler = function (event) {\n", " jQuery.event.simulate(fix, event.target, jQuery.event.fix(event));\n", " };\n", " jQuery.event.special[fix] = {\n", " setup: function () {\n", " // Handle: regular nodes (via `this.ownerDocument`), window\n", " // (via `this.document`) & document (via `this`).\n", " var doc = this.ownerDocument || this.document || this, attaches = dataPriv.access(doc, fix);\n", " if (!attaches) {\n", " doc.addEventListener(orig, handler, true);\n", " }\n", " dataPriv.access(doc, fix, (attaches || 0) + 1);\n", " },\n", " teardown: function () {\n", " var doc = this.ownerDocument || this.document || this, attaches = dataPriv.access(doc, fix) - 1;\n", " if (!attaches) {\n", " doc.removeEventListener(orig, handler, true);\n", " dataPriv.remove(doc, fix);\n", " }\n", " else {\n", " dataPriv.access(doc, fix, attaches);\n", " }\n", " }\n", " };\n", " });\n", " }\n", " var location = window.location;\n", " var nonce = { guid: Date.now() };\n", " var rquery = (/\\?/);\n", " // Cross-browser xml parsing\n", " jQuery.parseXML = function (data) {\n", " var xml;\n", " if (!data || typeof data !== \"string\") {\n", " return null;\n", " }\n", " // Support: IE 9 - 11 only\n", " // IE throws on parseFromString with invalid input.\n", " try {\n", " xml = (new window.DOMParser()).parseFromString(data, \"text/xml\");\n", " }\n", " catch (e) {\n", " xml = undefined;\n", " }\n", " if (!xml || xml.getElementsByTagName(\"parsererror\").length) {\n", " jQuery.error(\"Invalid XML: \" + data);\n", " }\n", " return xml;\n", " };\n", " var rbracket = /\\[\\]$/, rCRLF = /\\r?\\n/g, rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, rsubmittable = /^(?:input|select|textarea|keygen)/i;\n", " function buildParams(prefix, obj, traditional, add) {\n", " var name;\n", " if (Array.isArray(obj)) {\n", " // Serialize array item.\n", " jQuery.each(obj, function (i, v) {\n", " if (traditional || rbracket.test(prefix)) {\n", " // Treat each array item as a scalar.\n", " add(prefix, v);\n", " }\n", " else {\n", " // Item is non-scalar (array or object), encode its numeric index.\n", " buildParams(prefix + \"[\" + (typeof v === \"object\" && v != null ? i : \"\") + \"]\", v, traditional, add);\n", " }\n", " });\n", " }\n", " else if (!traditional && toType(obj) === \"object\") {\n", " // Serialize object item.\n", " for (name in obj) {\n", " buildParams(prefix + \"[\" + name + \"]\", obj[name], traditional, add);\n", " }\n", " }\n", " else {\n", " // Serialize scalar item.\n", " add(prefix, obj);\n", " }\n", " }\n", " // Serialize an array of form elements or a set of\n", " // key/values into a query string\n", " jQuery.param = function (a, traditional) {\n", " var prefix, s = [], add = function (key, valueOrFunction) {\n", " // If value is a function, invoke it and use its return value\n", " var value = isFunction(valueOrFunction) ?\n", " valueOrFunction() :\n", " valueOrFunction;\n", " s[s.length] = encodeURIComponent(key) + \"=\" +\n", " encodeURIComponent(value == null ? \"\" : value);\n", " };\n", " if (a == null) {\n", " return \"\";\n", " }\n", " // If an array was passed in, assume that it is an array of form elements.\n", " if (Array.isArray(a) || (a.jquery && !jQuery.isPlainObject(a))) {\n", " // Serialize the form elements\n", " jQuery.each(a, function () {\n", " add(this.name, this.value);\n", " });\n", " }\n", " else {\n", " // If traditional, encode the \"old\" way (the way 1.3.2 or older\n", " // did it), otherwise encode params recursively.\n", " for (prefix in a) {\n", " buildParams(prefix, a[prefix], traditional, add);\n", " }\n", " }\n", " // Return the resulting serialization\n", " return s.join(\"&\");\n", " };\n", " jQuery.fn.extend({\n", " serialize: function () {\n", " return jQuery.param(this.serializeArray());\n", " },\n", " serializeArray: function () {\n", " return this.map(function () {\n", " // Can add propHook for \"elements\" to filter or add form elements\n", " var elements = jQuery.prop(this, \"elements\");\n", " return elements ? jQuery.makeArray(elements) : this;\n", " })\n", " .filter(function () {\n", " var type = this.type;\n", " // Use .is( \":disabled\" ) so that fieldset[disabled] works\n", " return this.name && !jQuery(this).is(\":disabled\") &&\n", " rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) &&\n", " (this.checked || !rcheckableType.test(type));\n", " })\n", " .map(function (_i, elem) {\n", " var val = jQuery(this).val();\n", " if (val == null) {\n", " return null;\n", " }\n", " if (Array.isArray(val)) {\n", " return jQuery.map(val, function (val) {\n", " return { name: elem.name, value: val.replace(rCRLF, \"\\r\\n\") };\n", " });\n", " }\n", " return { name: elem.name, value: val.replace(rCRLF, \"\\r\\n\") };\n", " }).get();\n", " }\n", " });\n", " var r20 = /%20/g, rhash = /#.*$/, rantiCache = /([?&])_=[^&]*/, rheaders = /^(.*?):[ \\t]*([^\\r\\n]*)$/mg, \n", " // #7653, #8125, #8152: local protocol detection\n", " rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, rnoContent = /^(?:GET|HEAD)$/, rprotocol = /^\\/\\//, \n", " /* Prefilters\n", " * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)\n", " * 2) These are called:\n", " * - BEFORE asking for a transport\n", " * - AFTER param serialization (s.data is a string if s.processData is true)\n", " * 3) key is the dataType\n", " * 4) the catchall symbol \"*\" can be used\n", " * 5) execution will start with transport dataType and THEN continue down to \"*\" if needed\n", " */\n", " prefilters = {}, \n", " /* Transports bindings\n", " * 1) key is the dataType\n", " * 2) the catchall symbol \"*\" can be used\n", " * 3) selection will start with transport dataType and THEN go to \"*\" if needed\n", " */\n", " transports = {}, \n", " // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression\n", " allTypes = \"*/\".concat(\"*\"), \n", " // Anchor tag for parsing the document origin\n", " originAnchor = document.createElement(\"a\");\n", " originAnchor.href = location.href;\n", " // Base \"constructor\" for jQuery.ajaxPrefilter and jQuery.ajaxTransport\n", " function addToPrefiltersOrTransports(structure) {\n", " // dataTypeExpression is optional and defaults to \"*\"\n", " return function (dataTypeExpression, func) {\n", " if (typeof dataTypeExpression !== \"string\") {\n", " func = dataTypeExpression;\n", " dataTypeExpression = \"*\";\n", " }\n", " var dataType, i = 0, dataTypes = dataTypeExpression.toLowerCase().match(rnothtmlwhite) || [];\n", " if (isFunction(func)) {\n", " // For each dataType in the dataTypeExpression\n", " while ((dataType = dataTypes[i++])) {\n", " // Prepend if requested\n", " if (dataType[0] === \"+\") {\n", " dataType = dataType.slice(1) || \"*\";\n", " (structure[dataType] = structure[dataType] || []).unshift(func);\n", " // Otherwise append\n", " }\n", " else {\n", " (structure[dataType] = structure[dataType] || []).push(func);\n", " }\n", " }\n", " }\n", " };\n", " }\n", " // Base inspection function for prefilters and transports\n", " function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) {\n", " var inspected = {}, seekingTransport = (structure === transports);\n", " function inspect(dataType) {\n", " var selected;\n", " inspected[dataType] = true;\n", " jQuery.each(structure[dataType] || [], function (_, prefilterOrFactory) {\n", " var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR);\n", " if (typeof dataTypeOrTransport === \"string\" &&\n", " !seekingTransport && !inspected[dataTypeOrTransport]) {\n", " options.dataTypes.unshift(dataTypeOrTransport);\n", " inspect(dataTypeOrTransport);\n", " return false;\n", " }\n", " else if (seekingTransport) {\n", " return !(selected = dataTypeOrTransport);\n", " }\n", " });\n", " return selected;\n", " }\n", " return inspect(options.dataTypes[0]) || !inspected[\"*\"] && inspect(\"*\");\n", " }\n", " // A special extend for ajax options\n", " // that takes \"flat\" options (not to be deep extended)\n", " // Fixes #9887\n", " function ajaxExtend(target, src) {\n", " var key, deep, flatOptions = jQuery.ajaxSettings.flatOptions || {};\n", " for (key in src) {\n", " if (src[key] !== undefined) {\n", " (flatOptions[key] ? target : (deep || (deep = {})))[key] = src[key];\n", " }\n", " }\n", " if (deep) {\n", " jQuery.extend(true, target, deep);\n", " }\n", " return target;\n", " }\n", " /* Handles responses to an ajax request:\n", " * - finds the right dataType (mediates between content-type and expected dataType)\n", " * - returns the corresponding response\n", " */\n", " function ajaxHandleResponses(s, jqXHR, responses) {\n", " var ct, type, finalDataType, firstDataType, contents = s.contents, dataTypes = s.dataTypes;\n", " // Remove auto dataType and get content-type in the process\n", " while (dataTypes[0] === \"*\") {\n", " dataTypes.shift();\n", " if (ct === undefined) {\n", " ct = s.mimeType || jqXHR.getResponseHeader(\"Content-Type\");\n", " }\n", " }\n", " // Check if we're dealing with a known content-type\n", " if (ct) {\n", " for (type in contents) {\n", " if (contents[type] && contents[type].test(ct)) {\n", " dataTypes.unshift(type);\n", " break;\n", " }\n", " }\n", " }\n", " // Check to see if we have a response for the expected dataType\n", " if (dataTypes[0] in responses) {\n", " finalDataType = dataTypes[0];\n", " }\n", " else {\n", " // Try convertible dataTypes\n", " for (type in responses) {\n", " if (!dataTypes[0] || s.converters[type + \" \" + dataTypes[0]]) {\n", " finalDataType = type;\n", " break;\n", " }\n", " if (!firstDataType) {\n", " firstDataType = type;\n", " }\n", " }\n", " // Or just use first one\n", " finalDataType = finalDataType || firstDataType;\n", " }\n", " // If we found a dataType\n", " // We add the dataType to the list if needed\n", " // and return the corresponding response\n", " if (finalDataType) {\n", " if (finalDataType !== dataTypes[0]) {\n", " dataTypes.unshift(finalDataType);\n", " }\n", " return responses[finalDataType];\n", " }\n", " }\n", " /* Chain conversions given the request and the original response\n", " * Also sets the responseXXX fields on the jqXHR instance\n", " */\n", " function ajaxConvert(s, response, jqXHR, isSuccess) {\n", " var conv2, current, conv, tmp, prev, converters = {}, \n", " // Work with a copy of dataTypes in case we need to modify it for conversion\n", " dataTypes = s.dataTypes.slice();\n", " // Create converters map with lowercased keys\n", " if (dataTypes[1]) {\n", " for (conv in s.converters) {\n", " converters[conv.toLowerCase()] = s.converters[conv];\n", " }\n", " }\n", " current = dataTypes.shift();\n", " // Convert to each sequential dataType\n", " while (current) {\n", " if (s.responseFields[current]) {\n", " jqXHR[s.responseFields[current]] = response;\n", " }\n", " // Apply the dataFilter if provided\n", " if (!prev && isSuccess && s.dataFilter) {\n", " response = s.dataFilter(response, s.dataType);\n", " }\n", " prev = current;\n", " current = dataTypes.shift();\n", " if (current) {\n", " // There's only work to do if current dataType is non-auto\n", " if (current === \"*\") {\n", " current = prev;\n", " // Convert response if prev dataType is non-auto and differs from current\n", " }\n", " else if (prev !== \"*\" && prev !== current) {\n", " // Seek a direct converter\n", " conv = converters[prev + \" \" + current] || converters[\"* \" + current];\n", " // If none found, seek a pair\n", " if (!conv) {\n", " for (conv2 in converters) {\n", " // If conv2 outputs current\n", " tmp = conv2.split(\" \");\n", " if (tmp[1] === current) {\n", " // If prev can be converted to accepted input\n", " conv = converters[prev + \" \" + tmp[0]] ||\n", " converters[\"* \" + tmp[0]];\n", " if (conv) {\n", " // Condense equivalence converters\n", " if (conv === true) {\n", " conv = converters[conv2];\n", " // Otherwise, insert the intermediate dataType\n", " }\n", " else if (converters[conv2] !== true) {\n", " current = tmp[0];\n", " dataTypes.unshift(tmp[1]);\n", " }\n", " break;\n", " }\n", " }\n", " }\n", " }\n", " // Apply converter (if not an equivalence)\n", " if (conv !== true) {\n", " // Unless errors are allowed to bubble, catch and return them\n", " if (conv && s.throws) {\n", " response = conv(response);\n", " }\n", " else {\n", " try {\n", " response = conv(response);\n", " }\n", " catch (e) {\n", " return {\n", " state: \"parsererror\",\n", " error: conv ? e : \"No conversion from \" + prev + \" to \" + current\n", " };\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " return { state: \"success\", data: response };\n", " }\n", " jQuery.extend({\n", " // Counter for holding the number of active queries\n", " active: 0,\n", " // Last-Modified header cache for next request\n", " lastModified: {},\n", " etag: {},\n", " ajaxSettings: {\n", " url: location.href,\n", " type: \"GET\",\n", " isLocal: rlocalProtocol.test(location.protocol),\n", " global: true,\n", " processData: true,\n", " async: true,\n", " contentType: \"application/x-www-form-urlencoded; charset=UTF-8\",\n", " /*\n", " timeout: 0,\n", " data: null,\n", " dataType: null,\n", " username: null,\n", " password: null,\n", " cache: null,\n", " throws: false,\n", " traditional: false,\n", " headers: {},\n", " */\n", " accepts: {\n", " \"*\": allTypes,\n", " text: \"text/plain\",\n", " html: \"text/html\",\n", " xml: \"application/xml, text/xml\",\n", " json: \"application/json, text/javascript\"\n", " },\n", " contents: {\n", " xml: /\\bxml\\b/,\n", " html: /\\bhtml/,\n", " json: /\\bjson\\b/\n", " },\n", " responseFields: {\n", " xml: \"responseXML\",\n", " text: \"responseText\",\n", " json: \"responseJSON\"\n", " },\n", " // Data converters\n", " // Keys separate source (or catchall \"*\") and destination types with a single space\n", " converters: {\n", " // Convert anything to text\n", " \"* text\": String,\n", " // Text to html (true = no transformation)\n", " \"text html\": true,\n", " // Evaluate text as a json expression\n", " \"text json\": JSON.parse,\n", " // Parse text as xml\n", " \"text xml\": jQuery.parseXML\n", " },\n", " // For options that shouldn't be deep extended:\n", " // you can add your own custom options here if\n", " // and when you create one that shouldn't be\n", " // deep extended (see ajaxExtend)\n", " flatOptions: {\n", " url: true,\n", " context: true\n", " }\n", " },\n", " // Creates a full fledged settings object into target\n", " // with both ajaxSettings and settings fields.\n", " // If target is omitted, writes into ajaxSettings.\n", " ajaxSetup: function (target, settings) {\n", " return settings ?\n", " // Building a settings object\n", " ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) :\n", " // Extending ajaxSettings\n", " ajaxExtend(jQuery.ajaxSettings, target);\n", " },\n", " ajaxPrefilter: addToPrefiltersOrTransports(prefilters),\n", " ajaxTransport: addToPrefiltersOrTransports(transports),\n", " // Main method\n", " ajax: function (url, options) {\n", " // If url is an object, simulate pre-1.5 signature\n", " if (typeof url === \"object\") {\n", " options = url;\n", " url = undefined;\n", " }\n", " // Force options to be an object\n", " options = options || {};\n", " var transport, \n", " // URL without anti-cache param\n", " cacheURL, \n", " // Response headers\n", " responseHeadersString, responseHeaders, \n", " // timeout handle\n", " timeoutTimer, \n", " // Url cleanup var\n", " urlAnchor, \n", " // Request state (becomes false upon send and true upon completion)\n", " completed, \n", " // To know if global events are to be dispatched\n", " fireGlobals, \n", " // Loop variable\n", " i, \n", " // uncached part of the url\n", " uncached, \n", " // Create the final options object\n", " s = jQuery.ajaxSetup({}, options), \n", " // Callbacks context\n", " callbackContext = s.context || s, \n", " // Context for global events is callbackContext if it is a DOM node or jQuery collection\n", " globalEventContext = s.context &&\n", " (callbackContext.nodeType || callbackContext.jquery) ?\n", " jQuery(callbackContext) :\n", " jQuery.event, \n", " // Deferreds\n", " deferred = jQuery.Deferred(), completeDeferred = jQuery.Callbacks(\"once memory\"), \n", " // Status-dependent callbacks\n", " statusCode = s.statusCode || {}, \n", " // Headers (they are sent all at once)\n", " requestHeaders = {}, requestHeadersNames = {}, \n", " // Default abort message\n", " strAbort = \"canceled\", \n", " // Fake xhr\n", " jqXHR = {\n", " readyState: 0,\n", " // Builds headers hashtable if needed\n", " getResponseHeader: function (key) {\n", " var match;\n", " if (completed) {\n", " if (!responseHeaders) {\n", " responseHeaders = {};\n", " while ((match = rheaders.exec(responseHeadersString))) {\n", " responseHeaders[match[1].toLowerCase() + \" \"] =\n", " (responseHeaders[match[1].toLowerCase() + \" \"] || [])\n", " .concat(match[2]);\n", " }\n", " }\n", " match = responseHeaders[key.toLowerCase() + \" \"];\n", " }\n", " return match == null ? null : match.join(\", \");\n", " },\n", " // Raw string\n", " getAllResponseHeaders: function () {\n", " return completed ? responseHeadersString : null;\n", " },\n", " // Caches the header\n", " setRequestHeader: function (name, value) {\n", " if (completed == null) {\n", " name = requestHeadersNames[name.toLowerCase()] =\n", " requestHeadersNames[name.toLowerCase()] || name;\n", " requestHeaders[name] = value;\n", " }\n", " return this;\n", " },\n", " // Overrides response content-type header\n", " overrideMimeType: function (type) {\n", " if (completed == null) {\n", " s.mimeType = type;\n", " }\n", " return this;\n", " },\n", " // Status-dependent callbacks\n", " statusCode: function (map) {\n", " var code;\n", " if (map) {\n", " if (completed) {\n", " // Execute the appropriate callbacks\n", " jqXHR.always(map[jqXHR.status]);\n", " }\n", " else {\n", " // Lazy-add the new callbacks in a way that preserves old ones\n", " for (code in map) {\n", " statusCode[code] = [statusCode[code], map[code]];\n", " }\n", " }\n", " }\n", " return this;\n", " },\n", " // Cancel the request\n", " abort: function (statusText) {\n", " var finalText = statusText || strAbort;\n", " if (transport) {\n", " transport.abort(finalText);\n", " }\n", " done(0, finalText);\n", " return this;\n", " }\n", " };\n", " // Attach deferreds\n", " deferred.promise(jqXHR);\n", " // Add protocol if not provided (prefilters might expect it)\n", " // Handle falsy url in the settings object (#10093: consistency with old signature)\n", " // We also use the url parameter if available\n", " s.url = ((url || s.url || location.href) + \"\")\n", " .replace(rprotocol, location.protocol + \"//\");\n", " // Alias method option to type as per ticket #12004\n", " s.type = options.method || options.type || s.method || s.type;\n", " // Extract dataTypes list\n", " s.dataTypes = (s.dataType || \"*\").toLowerCase().match(rnothtmlwhite) || [\"\"];\n", " // A cross-domain request is in order when the origin doesn't match the current origin.\n", " if (s.crossDomain == null) {\n", " urlAnchor = document.createElement(\"a\");\n", " // Support: IE <=8 - 11, Edge 12 - 15\n", " // IE throws exception on accessing the href property if url is malformed,\n", " // e.g. http://example.com:80x/\n", " try {\n", " urlAnchor.href = s.url;\n", " // Support: IE <=8 - 11 only\n", " // Anchor's host property isn't correctly set when s.url is relative\n", " urlAnchor.href = urlAnchor.href;\n", " s.crossDomain = originAnchor.protocol + \"//\" + originAnchor.host !==\n", " urlAnchor.protocol + \"//\" + urlAnchor.host;\n", " }\n", " catch (e) {\n", " // If there is an error parsing the URL, assume it is crossDomain,\n", " // it can be rejected by the transport if it is invalid\n", " s.crossDomain = true;\n", " }\n", " }\n", " // Convert data if not already a string\n", " if (s.data && s.processData && typeof s.data !== \"string\") {\n", " s.data = jQuery.param(s.data, s.traditional);\n", " }\n", " // Apply prefilters\n", " inspectPrefiltersOrTransports(prefilters, s, options, jqXHR);\n", " // If request was aborted inside a prefilter, stop there\n", " if (completed) {\n", " return jqXHR;\n", " }\n", " // We can fire global events as of now if asked to\n", " // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)\n", " fireGlobals = jQuery.event && s.global;\n", " // Watch for a new set of requests\n", " if (fireGlobals && jQuery.active++ === 0) {\n", " jQuery.event.trigger(\"ajaxStart\");\n", " }\n", " // Uppercase the type\n", " s.type = s.type.toUpperCase();\n", " // Determine if request has content\n", " s.hasContent = !rnoContent.test(s.type);\n", " // Save the URL in case we're toying with the If-Modified-Since\n", " // and/or If-None-Match header later on\n", " // Remove hash to simplify url manipulation\n", " cacheURL = s.url.replace(rhash, \"\");\n", " // More options handling for requests with no content\n", " if (!s.hasContent) {\n", " // Remember the hash so we can put it back\n", " uncached = s.url.slice(cacheURL.length);\n", " // If data is available and should be processed, append data to url\n", " if (s.data && (s.processData || typeof s.data === \"string\")) {\n", " cacheURL += (rquery.test(cacheURL) ? \"&\" : \"?\") + s.data;\n", " // #9682: remove data so that it's not used in an eventual retry\n", " delete s.data;\n", " }\n", " // Add or update anti-cache param if needed\n", " if (s.cache === false) {\n", " cacheURL = cacheURL.replace(rantiCache, \"$1\");\n", " uncached = (rquery.test(cacheURL) ? \"&\" : \"?\") + \"_=\" + (nonce.guid++) +\n", " uncached;\n", " }\n", " // Put hash and anti-cache on the URL that will be requested (gh-1732)\n", " s.url = cacheURL + uncached;\n", " // Change '%20' to '+' if this is encoded form body content (gh-2658)\n", " }\n", " else if (s.data && s.processData &&\n", " (s.contentType || \"\").indexOf(\"application/x-www-form-urlencoded\") === 0) {\n", " s.data = s.data.replace(r20, \"+\");\n", " }\n", " // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.\n", " if (s.ifModified) {\n", " if (jQuery.lastModified[cacheURL]) {\n", " jqXHR.setRequestHeader(\"If-Modified-Since\", jQuery.lastModified[cacheURL]);\n", " }\n", " if (jQuery.etag[cacheURL]) {\n", " jqXHR.setRequestHeader(\"If-None-Match\", jQuery.etag[cacheURL]);\n", " }\n", " }\n", " // Set the correct header, if data is being sent\n", " if (s.data && s.hasContent && s.contentType !== false || options.contentType) {\n", " jqXHR.setRequestHeader(\"Content-Type\", s.contentType);\n", " }\n", " // Set the Accepts header for the server, depending on the dataType\n", " jqXHR.setRequestHeader(\"Accept\", s.dataTypes[0] && s.accepts[s.dataTypes[0]] ?\n", " s.accepts[s.dataTypes[0]] +\n", " (s.dataTypes[0] !== \"*\" ? \", \" + allTypes + \"; q=0.01\" : \"\") :\n", " s.accepts[\"*\"]);\n", " // Check for headers option\n", " for (i in s.headers) {\n", " jqXHR.setRequestHeader(i, s.headers[i]);\n", " }\n", " // Allow custom headers/mimetypes and early abort\n", " if (s.beforeSend &&\n", " (s.beforeSend.call(callbackContext, jqXHR, s) === false || completed)) {\n", " // Abort if not done already and return\n", " return jqXHR.abort();\n", " }\n", " // Aborting is no longer a cancellation\n", " strAbort = \"abort\";\n", " // Install callbacks on deferreds\n", " completeDeferred.add(s.complete);\n", " jqXHR.done(s.success);\n", " jqXHR.fail(s.error);\n", " // Get transport\n", " transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR);\n", " // If no transport, we auto-abort\n", " if (!transport) {\n", " done(-1, \"No Transport\");\n", " }\n", " else {\n", " jqXHR.readyState = 1;\n", " // Send global event\n", " if (fireGlobals) {\n", " globalEventContext.trigger(\"ajaxSend\", [jqXHR, s]);\n", " }\n", " // If request was aborted inside ajaxSend, stop there\n", " if (completed) {\n", " return jqXHR;\n", " }\n", " // Timeout\n", " if (s.async && s.timeout > 0) {\n", " timeoutTimer = window.setTimeout(function () {\n", " jqXHR.abort(\"timeout\");\n", " }, s.timeout);\n", " }\n", " try {\n", " completed = false;\n", " transport.send(requestHeaders, done);\n", " }\n", " catch (e) {\n", " // Rethrow post-completion exceptions\n", " if (completed) {\n", " throw e;\n", " }\n", " // Propagate others as results\n", " done(-1, e);\n", " }\n", " }\n", " // Callback for when everything is done\n", " function done(status, nativeStatusText, responses, headers) {\n", " var isSuccess, success, error, response, modified, statusText = nativeStatusText;\n", " // Ignore repeat invocations\n", " if (completed) {\n", " return;\n", " }\n", " completed = true;\n", " // Clear timeout if it exists\n", " if (timeoutTimer) {\n", " window.clearTimeout(timeoutTimer);\n", " }\n", " // Dereference transport for early garbage collection\n", " // (no matter how long the jqXHR object will be used)\n", " transport = undefined;\n", " // Cache response headers\n", " responseHeadersString = headers || \"\";\n", " // Set readyState\n", " jqXHR.readyState = status > 0 ? 4 : 0;\n", " // Determine if successful\n", " isSuccess = status >= 200 && status < 300 || status === 304;\n", " // Get response data\n", " if (responses) {\n", " response = ajaxHandleResponses(s, jqXHR, responses);\n", " }\n", " // Use a noop converter for missing script\n", " if (!isSuccess && jQuery.inArray(\"script\", s.dataTypes) > -1) {\n", " s.converters[\"text script\"] = function () { };\n", " }\n", " // Convert no matter what (that way responseXXX fields are always set)\n", " response = ajaxConvert(s, response, jqXHR, isSuccess);\n", " // If successful, handle type chaining\n", " if (isSuccess) {\n", " // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.\n", " if (s.ifModified) {\n", " modified = jqXHR.getResponseHeader(\"Last-Modified\");\n", " if (modified) {\n", " jQuery.lastModified[cacheURL] = modified;\n", " }\n", " modified = jqXHR.getResponseHeader(\"etag\");\n", " if (modified) {\n", " jQuery.etag[cacheURL] = modified;\n", " }\n", " }\n", " // if no content\n", " if (status === 204 || s.type === \"HEAD\") {\n", " statusText = \"nocontent\";\n", " // if not modified\n", " }\n", " else if (status === 304) {\n", " statusText = \"notmodified\";\n", " // If we have data, let's convert it\n", " }\n", " else {\n", " statusText = response.state;\n", " success = response.data;\n", " error = response.error;\n", " isSuccess = !error;\n", " }\n", " }\n", " else {\n", " // Extract error from statusText and normalize for non-aborts\n", " error = statusText;\n", " if (status || !statusText) {\n", " statusText = \"error\";\n", " if (status < 0) {\n", " status = 0;\n", " }\n", " }\n", " }\n", " // Set data for the fake xhr object\n", " jqXHR.status = status;\n", " jqXHR.statusText = (nativeStatusText || statusText) + \"\";\n", " // Success/Error\n", " if (isSuccess) {\n", " deferred.resolveWith(callbackContext, [success, statusText, jqXHR]);\n", " }\n", " else {\n", " deferred.rejectWith(callbackContext, [jqXHR, statusText, error]);\n", " }\n", " // Status-dependent callbacks\n", " jqXHR.statusCode(statusCode);\n", " statusCode = undefined;\n", " if (fireGlobals) {\n", " globalEventContext.trigger(isSuccess ? \"ajaxSuccess\" : \"ajaxError\", [jqXHR, s, isSuccess ? success : error]);\n", " }\n", " // Complete\n", " completeDeferred.fireWith(callbackContext, [jqXHR, statusText]);\n", " if (fireGlobals) {\n", " globalEventContext.trigger(\"ajaxComplete\", [jqXHR, s]);\n", " // Handle the global AJAX counter\n", " if (!(--jQuery.active)) {\n", " jQuery.event.trigger(\"ajaxStop\");\n", " }\n", " }\n", " }\n", " return jqXHR;\n", " },\n", " getJSON: function (url, data, callback) {\n", " return jQuery.get(url, data, callback, \"json\");\n", " },\n", " getScript: function (url, callback) {\n", " return jQuery.get(url, undefined, callback, \"script\");\n", " }\n", " });\n", " jQuery.each([\"get\", \"post\"], function (_i, method) {\n", " jQuery[method] = function (url, data, callback, type) {\n", " // Shift arguments if data argument was omitted\n", " if (isFunction(data)) {\n", " type = type || callback;\n", " callback = data;\n", " data = undefined;\n", " }\n", " // The url can be an options object (which then must have .url)\n", " return jQuery.ajax(jQuery.extend({\n", " url: url,\n", " type: method,\n", " dataType: type,\n", " data: data,\n", " success: callback\n", " }, jQuery.isPlainObject(url) && url));\n", " };\n", " });\n", " jQuery.ajaxPrefilter(function (s) {\n", " var i;\n", " for (i in s.headers) {\n", " if (i.toLowerCase() === \"content-type\") {\n", " s.contentType = s.headers[i] || \"\";\n", " }\n", " }\n", " });\n", " jQuery._evalUrl = function (url, options, doc) {\n", " return jQuery.ajax({\n", " url: url,\n", " // Make this explicit, since user can override this through ajaxSetup (#11264)\n", " type: \"GET\",\n", " dataType: \"script\",\n", " cache: true,\n", " async: false,\n", " global: false,\n", " // Only evaluate the response if it is successful (gh-4126)\n", " // dataFilter is not invoked for failure responses, so using it instead\n", " // of the default converter is kludgy but it works.\n", " converters: {\n", " \"text script\": function () { }\n", " },\n", " dataFilter: function (response) {\n", " jQuery.globalEval(response, options, doc);\n", " }\n", " });\n", " };\n", " jQuery.fn.extend({\n", " wrapAll: function (html) {\n", " var wrap;\n", " if (this[0]) {\n", " if (isFunction(html)) {\n", " html = html.call(this[0]);\n", " }\n", " // The elements to wrap the target around\n", " wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);\n", " if (this[0].parentNode) {\n", " wrap.insertBefore(this[0]);\n", " }\n", " wrap.map(function () {\n", " var elem = this;\n", " while (elem.firstElementChild) {\n", " elem = elem.firstElementChild;\n", " }\n", " return elem;\n", " }).append(this);\n", " }\n", " return this;\n", " },\n", " wrapInner: function (html) {\n", " if (isFunction(html)) {\n", " return this.each(function (i) {\n", " jQuery(this).wrapInner(html.call(this, i));\n", " });\n", " }\n", " return this.each(function () {\n", " var self = jQuery(this), contents = self.contents();\n", " if (contents.length) {\n", " contents.wrapAll(html);\n", " }\n", " else {\n", " self.append(html);\n", " }\n", " });\n", " },\n", " wrap: function (html) {\n", " var htmlIsFunction = isFunction(html);\n", " return this.each(function (i) {\n", " jQuery(this).wrapAll(htmlIsFunction ? html.call(this, i) : html);\n", " });\n", " },\n", " unwrap: function (selector) {\n", " this.parent(selector).not(\"body\").each(function () {\n", " jQuery(this).replaceWith(this.childNodes);\n", " });\n", " return this;\n", " }\n", " });\n", " jQuery.expr.pseudos.hidden = function (elem) {\n", " return !jQuery.expr.pseudos.visible(elem);\n", " };\n", " jQuery.expr.pseudos.visible = function (elem) {\n", " return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);\n", " };\n", " jQuery.ajaxSettings.xhr = function () {\n", " try {\n", " return new window.XMLHttpRequest();\n", " }\n", " catch (e) { }\n", " };\n", " var xhrSuccessStatus = {\n", " // File protocol always yields status code 0, assume 200\n", " 0: 200,\n", " // Support: IE <=9 only\n", " // #1450: sometimes IE returns 1223 when it should be 204\n", " 1223: 204\n", " }, xhrSupported = jQuery.ajaxSettings.xhr();\n", " support.cors = !!xhrSupported && (\"withCredentials\" in xhrSupported);\n", " support.ajax = xhrSupported = !!xhrSupported;\n", " jQuery.ajaxTransport(function (options) {\n", " var callback, errorCallback;\n", " // Cross domain only allowed if supported through XMLHttpRequest\n", " if (support.cors || xhrSupported && !options.crossDomain) {\n", " return {\n", " send: function (headers, complete) {\n", " var i, xhr = options.xhr();\n", " xhr.open(options.type, options.url, options.async, options.username, options.password);\n", " // Apply custom fields if provided\n", " if (options.xhrFields) {\n", " for (i in options.xhrFields) {\n", " xhr[i] = options.xhrFields[i];\n", " }\n", " }\n", " // Override mime type if needed\n", " if (options.mimeType && xhr.overrideMimeType) {\n", " xhr.overrideMimeType(options.mimeType);\n", " }\n", " // X-Requested-With header\n", " // For cross-domain requests, seeing as conditions for a preflight are\n", " // akin to a jigsaw puzzle, we simply never set it to be sure.\n", " // (it can always be set on a per-request basis or even using ajaxSetup)\n", " // For same-domain requests, won't change header if already provided.\n", " if (!options.crossDomain && !headers[\"X-Requested-With\"]) {\n", " headers[\"X-Requested-With\"] = \"XMLHttpRequest\";\n", " }\n", " // Set headers\n", " for (i in headers) {\n", " xhr.setRequestHeader(i, headers[i]);\n", " }\n", " // Callback\n", " callback = function (type) {\n", " return function () {\n", " if (callback) {\n", " callback = errorCallback = xhr.onload =\n", " xhr.onerror = xhr.onabort = xhr.ontimeout =\n", " xhr.onreadystatechange = null;\n", " if (type === \"abort\") {\n", " xhr.abort();\n", " }\n", " else if (type === \"error\") {\n", " // Support: IE <=9 only\n", " // On a manual native abort, IE9 throws\n", " // errors on any property access that is not readyState\n", " if (typeof xhr.status !== \"number\") {\n", " complete(0, \"error\");\n", " }\n", " else {\n", " complete(\n", " // File: protocol always yields status 0; see #8605, #14207\n", " xhr.status, xhr.statusText);\n", " }\n", " }\n", " else {\n", " complete(xhrSuccessStatus[xhr.status] || xhr.status, xhr.statusText, \n", " // Support: IE <=9 only\n", " // IE9 has no XHR2 but throws on binary (trac-11426)\n", " // For XHR2 non-text, let the caller handle it (gh-2498)\n", " (xhr.responseType || \"text\") !== \"text\" ||\n", " typeof xhr.responseText !== \"string\" ?\n", " { binary: xhr.response } :\n", " { text: xhr.responseText }, xhr.getAllResponseHeaders());\n", " }\n", " }\n", " };\n", " };\n", " // Listen to events\n", " xhr.onload = callback();\n", " errorCallback = xhr.onerror = xhr.ontimeout = callback(\"error\");\n", " // Support: IE 9 only\n", " // Use onreadystatechange to replace onabort\n", " // to handle uncaught aborts\n", " if (xhr.onabort !== undefined) {\n", " xhr.onabort = errorCallback;\n", " }\n", " else {\n", " xhr.onreadystatechange = function () {\n", " // Check readyState before timeout as it changes\n", " if (xhr.readyState === 4) {\n", " // Allow onerror to be called first,\n", " // but that will not handle a native abort\n", " // Also, save errorCallback to a variable\n", " // as xhr.onerror cannot be accessed\n", " window.setTimeout(function () {\n", " if (callback) {\n", " errorCallback();\n", " }\n", " });\n", " }\n", " };\n", " }\n", " // Create the abort callback\n", " callback = callback(\"abort\");\n", " try {\n", " // Do send the request (this may raise an exception)\n", " xhr.send(options.hasContent && options.data || null);\n", " }\n", " catch (e) {\n", " // #14683: Only rethrow if this hasn't been notified as an error yet\n", " if (callback) {\n", " throw e;\n", " }\n", " }\n", " },\n", " abort: function () {\n", " if (callback) {\n", " callback();\n", " }\n", " }\n", " };\n", " }\n", " });\n", " // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)\n", " jQuery.ajaxPrefilter(function (s) {\n", " if (s.crossDomain) {\n", " s.contents.script = false;\n", " }\n", " });\n", " // Install script dataType\n", " jQuery.ajaxSetup({\n", " accepts: {\n", " script: \"text/javascript, application/javascript, \" +\n", " \"application/ecmascript, application/x-ecmascript\"\n", " },\n", " contents: {\n", " script: /\\b(?:java|ecma)script\\b/\n", " },\n", " converters: {\n", " \"text script\": function (text) {\n", " jQuery.globalEval(text);\n", " return text;\n", " }\n", " }\n", " });\n", " // Handle cache's special case and crossDomain\n", " jQuery.ajaxPrefilter(\"script\", function (s) {\n", " if (s.cache === undefined) {\n", " s.cache = false;\n", " }\n", " if (s.crossDomain) {\n", " s.type = \"GET\";\n", " }\n", " });\n", " // Bind script tag hack transport\n", " jQuery.ajaxTransport(\"script\", function (s) {\n", " // This transport only deals with cross domain or forced-by-attrs requests\n", " if (s.crossDomain || s.scriptAttrs) {\n", " var script, callback;\n", " return {\n", " send: function (_, complete) {\n", " script = jQuery(\"" ], "text/plain": [ "Header(sizing_mode='stretch_width')\n", " [0] Row(sizing_mode='stretch_width')\n", " [0] PanelLinkButton(str, image_url='https://panel.holoviz.org..., style={'background': 'black', ...}, theme='dark', width=140)\n", " [1] BinderLinkButton(str, branch='master', folder='examples/reference/widget..., link_url='https://mybinder.org/v2/g..., notebook='PerspectiveViewer.ipynb', repository='marcskovmadsen/awesome-pa...)\n", " [2] NBViewerLinkButton(str, branch='master', folder='examples/reference/widget..., link_url='https://nbviewer.jupyter...., notebook='PerspectiveViewer.ipynb', repository='marcskovmadsen/awesome-pa...)\n", " [1] Markdown(str, sizing_mode='stretch_width')" ] }, "execution_count": 1, "metadata": { "application/vnd.holoviews_exec.v0+json": { "id": "1001" } }, "output_type": "execute_result" } ], "source": [ "from awesome_panel_extensions.awesome_panel import notebook\n", "notebook.Header(folder=\"examples/reference/widgets\", notebook=\"PerspectiveViewer.ipynb\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# PerspectiveViewer - Reference Guide\n", "\n", "[Perspective](https://github.com/finos/perspective) ships with the `PerspectiveViewer`, which is an awesome **interactive Pivot Table + Chart** webcomponent. You can even use it for **streaming analytics**.\n", "\n", "\n", "\n", "The `PerspectiveViewer` enables the use of the `perspective-viewer` webcomponent in Panel.\n", "\n", "#### Parameters:\n", "\n", "* **``data``** (DataFrame): The data loaded to the viewer.\n", "\n", "\n", "* **``columns``** (list): A list of source columns to show as columns. For example `[\"x\", \"y\"]`.\n", "* **``columns_computed``** (list): A list of computed columns. For example [{\"name\":\"x+y\",\"func\":\"add\",\"inputs\":[\"x\",\"y\"]}].\n", "* **``columns_pivot``** (list): A list of source columns to pivot by. For example `[\"x\", \"y\"]`.\n", "* **``rows_pivot``** (list): A list of source columns to group by. For example `[\"x\", \"y\"]`.\n", "* **``aggregates``** (dict): How to aggregate. For example `{x: \"distinct count\"}`.\n", "* **``sort``** (list): How to sort. For example `[[\"x\",\"desc\"]]`.\n", "* **``filter``** (list): How to filter. For example `[[\"x\", \"<\", 3],[\"y\", \"contains\", \"abc\"]]`.\n", "\n", "\n", "* **``plugin``** (str): Determines how to display the data. One of `hypergrid`, `datagrid`, `d3_y_bar`, `d3_x_bar`, `d3_y_line`, `d3_y_area`, `d3_y_scatter`, `d3_xy_scatter`, `d3_treemap`, `d3_sunburst`, `d3_heatmap`, `d3_candlestick`, `d3_ohlc`.\n", "* **``theme``** (str): Determines the style. One of `perspective-viewer-material` (default), `perspective-viewer-material-dark`, `perspective-viewer-material-dense`, `perspective-viewer-material-dense-dark`, `perspective-viewer-vaporwave`.\n", "\n", "The `PerspectiveViewer` has the same layout and styling parameters as most other widgets. For example `width` and `sizing_mode`.\n", "\n", "___\n", "\n", "Let's start by importing the **dependencies**" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "application/javascript": [ "\n", "(function(root) {\n", " function now() {\n", " return new Date();\n", " }\n", "\n", " var force = true;\n", "\n", " if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n", " root._bokeh_onload_callbacks = [];\n", " root._bokeh_is_loading = undefined;\n", " }\n", "\n", " if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n", " root._bokeh_timeout = Date.now() + 5000;\n", " root._bokeh_failed_load = false;\n", " }\n", "\n", " function run_callbacks() {\n", " try {\n", " root._bokeh_onload_callbacks.forEach(function(callback) {\n", " if (callback != null)\n", " callback();\n", " });\n", " } finally {\n", " delete root._bokeh_onload_callbacks\n", " }\n", " console.debug(\"Bokeh: all callbacks have finished\");\n", " }\n", "\n", " function load_libs(css_urls, js_urls, callback) {\n", " if (css_urls == null) css_urls = [];\n", " if (js_urls == null) js_urls = [];\n", "\n", " root._bokeh_onload_callbacks.push(callback);\n", " if (root._bokeh_is_loading > 0) {\n", " console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n", " return null;\n", " }\n", " if (js_urls == null || js_urls.length === 0) {\n", " run_callbacks();\n", " return null;\n", " }\n", " console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n", " root._bokeh_is_loading = css_urls.length + js_urls.length;\n", "\n", " function on_load() {\n", " root._bokeh_is_loading--;\n", " if (root._bokeh_is_loading === 0) {\n", " console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n", " run_callbacks()\n", " }\n", " }\n", "\n", " function on_error() {\n", " console.error(\"failed to load \" + url);\n", " }\n", "\n", " for (var i = 0; i < css_urls.length; i++) {\n", " var url = css_urls[i];\n", " const element = document.createElement(\"link\");\n", " element.onload = on_load;\n", " element.onerror = on_error;\n", " element.rel = \"stylesheet\";\n", " element.type = \"text/css\";\n", " element.href = url;\n", " console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n", " document.body.appendChild(element);\n", " }\n", "\n", " if (window.requirejs) {\n", " window.requirejs.config({'paths': {'perspective': 'https://unpkg.com/@finos/perspective@0.5.2/dist/umd/perspective'}});\n", " window.requirejs.config({'paths': {'perspective-viewer': 'https://unpkg.com/@finos/perspective-viewer@0.5.2/dist/umd/perspective-viewer'}});\n", " window.requirejs.config({'paths': {'perspective-viewer-datagrid': 'https://unpkg.com/@finos/perspective-viewer-datagrid@0.5.2/dist/umd/perspective-viewer-datagrid'}});\n", " window.requirejs.config({'paths': {'perspective-viewer-hypergrid': 'https://unpkg.com/@finos/perspective-viewer-hypergrid@0.5.2/dist/umd/perspective-viewer-hypergrid'}});\n", " window.requirejs.config({'paths': {'perspective-viewer-d3fc': 'https://unpkg.com/@finos/perspective-viewer-d3fc@0.5.2/dist/umd/perspective-viewer-d3fc'}});\n", " require([\"perspective\", \"perspective-viewer\", \"perspective-viewer-datagrid\", \"perspective-viewer-hypergrid\", \"perspective-viewer-d3fc\"], function(perspective,perspective_viewer,perspective_viewer_datagrid,perspective_viewer_hypergrid,perspective_viewer_d3fc,) {\n", " window.perspective = perspective;\n", " window.perspective_viewer = perspective_viewer;\n", " window.perspective_viewer_datagrid = perspective_viewer_datagrid;\n", " window.perspective_viewer_hypergrid = perspective_viewer_hypergrid;\n", " window.perspective_viewer_d3fc = perspective_viewer_d3fc;\n", " run_callbacks();\n", " })\n", " } else {\n", " var skip = [];\n", " for (var i = 0; i < js_urls.length; i++) {\n", " var url = js_urls[i];\n", " if (skip.indexOf(url) >= 0) { on_load(); continue; }\n", " var element = document.createElement('script');\n", " element.onload = on_load;\n", " element.onerror = on_error;\n", " element.async = false;\n", " element.src = url;\n", " console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n", " document.head.appendChild(element);\n", " }\n", " }\n", " };\n", "\n", " function inject_raw_css(css) {\n", " const element = document.createElement(\"style\");\n", " element.appendChild(document.createTextNode(css));\n", " document.body.appendChild(element);\n", " }\n", "\n", " var js_urls = [\"https://unpkg.com/@finos/perspective@0.5.2/dist/umd/perspective.js\", \"https://unpkg.com/@finos/perspective-viewer@0.5.2/dist/umd/perspective-viewer.js\", \"https://unpkg.com/@finos/perspective-viewer-datagrid@0.5.2/dist/umd/perspective-viewer-datagrid.js\", \"https://unpkg.com/@finos/perspective-viewer-hypergrid@0.5.2/dist/umd/perspective-viewer-hypergrid.js\", \"https://unpkg.com/@finos/perspective-viewer-d3fc@0.5.2/dist/umd/perspective-viewer-d3fc.js\"];\n", " var css_urls = [\"https://unpkg.com/@finos/perspective-viewer@0.5.2/dist/umd/all-themes.css\"];\n", "\n", " var inline_js = [\n", " function(Bokeh) {\n", " inject_raw_css(\"table.panel-df {\\n margin-left: auto;\\n margin-right: auto;\\n border: none;\\n border-collapse: collapse;\\n border-spacing: 0;\\n color: black;\\n font-size: 12px;\\n table-layout: fixed;\\n width: 100%;\\n}\\n\\n.panel-df tr, .panel-df th, .panel-df td {\\n text-align: right;\\n vertical-align: middle;\\n padding: 0.5em 0.5em !important;\\n line-height: normal;\\n white-space: normal;\\n max-width: none;\\n border: none;\\n}\\n\\n.panel-df tbody {\\n display: table-row-group;\\n vertical-align: middle;\\n border-color: inherit;\\n}\\n\\n.panel-df tbody tr:nth-child(odd) {\\n background: #f5f5f5;\\n}\\n\\n.panel-df thead {\\n border-bottom: 1px solid black;\\n vertical-align: bottom;\\n}\\n\\n.panel-df tr:hover {\\n background: lightblue !important;\\n cursor: pointer;\\n}\\n\");\n", " },\n", " function(Bokeh) {\n", " inject_raw_css(\".json-formatter-row {\\n font-family: monospace;\\n}\\n.json-formatter-row,\\n.json-formatter-row a,\\n.json-formatter-row a:hover {\\n color: black;\\n text-decoration: none;\\n}\\n.json-formatter-row .json-formatter-row {\\n margin-left: 1rem;\\n}\\n.json-formatter-row .json-formatter-children.json-formatter-empty {\\n opacity: 0.5;\\n margin-left: 1rem;\\n}\\n.json-formatter-row .json-formatter-children.json-formatter-empty:after {\\n display: none;\\n}\\n.json-formatter-row .json-formatter-children.json-formatter-empty.json-formatter-object:after {\\n content: \\\"No properties\\\";\\n}\\n.json-formatter-row .json-formatter-children.json-formatter-empty.json-formatter-array:after {\\n content: \\\"[]\\\";\\n}\\n.json-formatter-row .json-formatter-string,\\n.json-formatter-row .json-formatter-stringifiable {\\n color: green;\\n white-space: pre;\\n word-wrap: break-word;\\n}\\n.json-formatter-row .json-formatter-number {\\n color: blue;\\n}\\n.json-formatter-row .json-formatter-boolean {\\n color: red;\\n}\\n.json-formatter-row .json-formatter-null {\\n color: #855A00;\\n}\\n.json-formatter-row .json-formatter-undefined {\\n color: #ca0b69;\\n}\\n.json-formatter-row .json-formatter-function {\\n color: #FF20ED;\\n}\\n.json-formatter-row .json-formatter-date {\\n background-color: rgba(0, 0, 0, 0.05);\\n}\\n.json-formatter-row .json-formatter-url {\\n text-decoration: underline;\\n color: blue;\\n cursor: pointer;\\n}\\n.json-formatter-row .json-formatter-bracket {\\n color: blue;\\n}\\n.json-formatter-row .json-formatter-key {\\n color: #00008B;\\n padding-right: 0.2rem;\\n}\\n.json-formatter-row .json-formatter-toggler-link {\\n cursor: pointer;\\n}\\n.json-formatter-row .json-formatter-toggler {\\n line-height: 1.2rem;\\n font-size: 0.7rem;\\n vertical-align: middle;\\n opacity: 0.6;\\n cursor: pointer;\\n padding-right: 0.2rem;\\n}\\n.json-formatter-row .json-formatter-toggler:after {\\n display: inline-block;\\n transition: transform 100ms ease-in;\\n content: \\\"\\\\25BA\\\";\\n}\\n.json-formatter-row > a > .json-formatter-preview-text {\\n opacity: 0;\\n transition: opacity 0.15s ease-in;\\n font-style: italic;\\n}\\n.json-formatter-row:hover > a > .json-formatter-preview-text {\\n opacity: 0.6;\\n}\\n.json-formatter-row.json-formatter-open > .json-formatter-toggler-link .json-formatter-toggler:after {\\n transform: rotate(90deg);\\n}\\n.json-formatter-row.json-formatter-open > .json-formatter-children:after {\\n display: inline-block;\\n}\\n.json-formatter-row.json-formatter-open > a > .json-formatter-preview-text {\\n display: none;\\n}\\n.json-formatter-row.json-formatter-open.json-formatter-empty:after {\\n display: block;\\n}\\n.json-formatter-dark.json-formatter-row {\\n font-family: monospace;\\n}\\n.json-formatter-dark.json-formatter-row,\\n.json-formatter-dark.json-formatter-row a,\\n.json-formatter-dark.json-formatter-row a:hover {\\n color: white;\\n text-decoration: none;\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-row {\\n margin-left: 1rem;\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-children.json-formatter-empty {\\n opacity: 0.5;\\n margin-left: 1rem;\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-children.json-formatter-empty:after {\\n display: none;\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-children.json-formatter-empty.json-formatter-object:after {\\n content: \\\"No properties\\\";\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-children.json-formatter-empty.json-formatter-array:after {\\n content: \\\"[]\\\";\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-string,\\n.json-formatter-dark.json-formatter-row .json-formatter-stringifiable {\\n color: #31F031;\\n white-space: pre;\\n word-wrap: break-word;\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-number {\\n color: #66C2FF;\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-boolean {\\n color: #EC4242;\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-null {\\n color: #EEC97D;\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-undefined {\\n color: #ef8fbe;\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-function {\\n color: #FD48CB;\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-date {\\n background-color: rgba(255, 255, 255, 0.05);\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-url {\\n text-decoration: underline;\\n color: #027BFF;\\n cursor: pointer;\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-bracket {\\n color: #9494FF;\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-key {\\n color: #23A0DB;\\n padding-right: 0.2rem;\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-toggler-link {\\n cursor: pointer;\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-toggler {\\n line-height: 1.2rem;\\n font-size: 0.7rem;\\n vertical-align: middle;\\n opacity: 0.6;\\n cursor: pointer;\\n padding-right: 0.2rem;\\n}\\n.json-formatter-dark.json-formatter-row .json-formatter-toggler:after {\\n display: inline-block;\\n transition: transform 100ms ease-in;\\n content: \\\"\\\\25BA\\\";\\n}\\n.json-formatter-dark.json-formatter-row > a > .json-formatter-preview-text {\\n opacity: 0;\\n transition: opacity 0.15s ease-in;\\n font-style: italic;\\n}\\n.json-formatter-dark.json-formatter-row:hover > a > .json-formatter-preview-text {\\n opacity: 0.6;\\n}\\n.json-formatter-dark.json-formatter-row.json-formatter-open > .json-formatter-toggler-link .json-formatter-toggler:after {\\n transform: rotate(90deg);\\n}\\n.json-formatter-dark.json-formatter-row.json-formatter-open > .json-formatter-children:after {\\n display: inline-block;\\n}\\n.json-formatter-dark.json-formatter-row.json-formatter-open > a > .json-formatter-preview-text {\\n display: none;\\n}\\n.json-formatter-dark.json-formatter-row.json-formatter-open.json-formatter-empty:after {\\n display: block;\\n}\\n\");\n", " },\n", " function(Bokeh) {\n", " inject_raw_css(\".codehilite .hll { background-color: #ffffcc }\\n.codehilite { background: #f8f8f8; }\\n.codehilite .c { color: #408080; font-style: italic } /* Comment */\\n.codehilite .err { border: 1px solid #FF0000 } /* Error */\\n.codehilite .k { color: #008000; font-weight: bold } /* Keyword */\\n.codehilite .o { color: #666666 } /* Operator */\\n.codehilite .ch { color: #408080; font-style: italic } /* Comment.Hashbang */\\n.codehilite .cm { color: #408080; font-style: italic } /* Comment.Multiline */\\n.codehilite .cp { color: #BC7A00 } /* Comment.Preproc */\\n.codehilite .cpf { color: #408080; font-style: italic } /* Comment.PreprocFile */\\n.codehilite .c1 { color: #408080; font-style: italic } /* Comment.Single */\\n.codehilite .cs { color: #408080; font-style: italic } /* Comment.Special */\\n.codehilite .gd { color: #A00000 } /* Generic.Deleted */\\n.codehilite .ge { font-style: italic } /* Generic.Emph */\\n.codehilite .gr { color: #FF0000 } /* Generic.Error */\\n.codehilite .gh { color: #000080; font-weight: bold } /* Generic.Heading */\\n.codehilite .gi { color: #00A000 } /* Generic.Inserted */\\n.codehilite .go { color: #888888 } /* Generic.Output */\\n.codehilite .gp { color: #000080; font-weight: bold } /* Generic.Prompt */\\n.codehilite .gs { font-weight: bold } /* Generic.Strong */\\n.codehilite .gu { color: #800080; font-weight: bold } /* Generic.Subheading */\\n.codehilite .gt { color: #0044DD } /* Generic.Traceback */\\n.codehilite .kc { color: #008000; font-weight: bold } /* Keyword.Constant */\\n.codehilite .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */\\n.codehilite .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */\\n.codehilite .kp { color: #008000 } /* Keyword.Pseudo */\\n.codehilite .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */\\n.codehilite .kt { color: #B00040 } /* Keyword.Type */\\n.codehilite .m { color: #666666 } /* Literal.Number */\\n.codehilite .s { color: #BA2121 } /* Literal.String */\\n.codehilite .na { color: #7D9029 } /* Name.Attribute */\\n.codehilite .nb { color: #008000 } /* Name.Builtin */\\n.codehilite .nc { color: #0000FF; font-weight: bold } /* Name.Class */\\n.codehilite .no { color: #880000 } /* Name.Constant */\\n.codehilite .nd { color: #AA22FF } /* Name.Decorator */\\n.codehilite .ni { color: #999999; font-weight: bold } /* Name.Entity */\\n.codehilite .ne { color: #D2413A; font-weight: bold } /* Name.Exception */\\n.codehilite .nf { color: #0000FF } /* Name.Function */\\n.codehilite .nl { color: #A0A000 } /* Name.Label */\\n.codehilite .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */\\n.codehilite .nt { color: #008000; font-weight: bold } /* Name.Tag */\\n.codehilite .nv { color: #19177C } /* Name.Variable */\\n.codehilite .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */\\n.codehilite .w { color: #bbbbbb } /* Text.Whitespace */\\n.codehilite .mb { color: #666666 } /* Literal.Number.Bin */\\n.codehilite .mf { color: #666666 } /* Literal.Number.Float */\\n.codehilite .mh { color: #666666 } /* Literal.Number.Hex */\\n.codehilite .mi { color: #666666 } /* Literal.Number.Integer */\\n.codehilite .mo { color: #666666 } /* Literal.Number.Oct */\\n.codehilite .sa { color: #BA2121 } /* Literal.String.Affix */\\n.codehilite .sb { color: #BA2121 } /* Literal.String.Backtick */\\n.codehilite .sc { color: #BA2121 } /* Literal.String.Char */\\n.codehilite .dl { color: #BA2121 } /* Literal.String.Delimiter */\\n.codehilite .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */\\n.codehilite .s2 { color: #BA2121 } /* Literal.String.Double */\\n.codehilite .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */\\n.codehilite .sh { color: #BA2121 } /* Literal.String.Heredoc */\\n.codehilite .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */\\n.codehilite .sx { color: #008000 } /* Literal.String.Other */\\n.codehilite .sr { color: #BB6688 } /* Literal.String.Regex */\\n.codehilite .s1 { color: #BA2121 } /* Literal.String.Single */\\n.codehilite .ss { color: #19177C } /* Literal.String.Symbol */\\n.codehilite .bp { color: #008000 } /* Name.Builtin.Pseudo */\\n.codehilite .fm { color: #0000FF } /* Name.Function.Magic */\\n.codehilite .vc { color: #19177C } /* Name.Variable.Class */\\n.codehilite .vg { color: #19177C } /* Name.Variable.Global */\\n.codehilite .vi { color: #19177C } /* Name.Variable.Instance */\\n.codehilite .vm { color: #19177C } /* Name.Variable.Magic */\\n.codehilite .il { color: #666666 } /* Literal.Number.Integer.Long */\\n\\n.markdown h1 { margin-block-start: 0.34em }\\n.markdown h2 { margin-block-start: 0.42em }\\n.markdown h3 { margin-block-start: 0.5em }\\n.markdown h4 { margin-block-start: 0.67em }\\n.markdown h5 { margin-block-start: 0.84em }\\n.markdown h6 { margin-block-start: 1.17em }\\n.markdown ul { padding-inline-start: 2em }\\n.markdown ol { padding-inline-start: 2em }\\n.markdown strong { font-weight: 600 }\\n.markdown a { color: -webkit-link }\\n.markdown a { color: -moz-hyperlinkText }\\n\");\n", " },\n", " function(Bokeh) {\n", " inject_raw_css(\".panel-widget-box {\\n\\tmin-height: 20px;\\n\\tbackground-color: #f5f5f5;\\n\\tborder: 1px solid #e3e3e3 !important;\\n\\tborder-radius: 4px;\\n\\t-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.05);\\n\\tbox-shadow: inset 0 1px 1px rgba(0,0,0,.05);\\n\\toverflow-x: hidden;\\n\\toverflow-y: hidden;\\n}\\n\\n.scrollable {\\n overflow: scroll;\\n}\\n\\nprogress {\\n\\tappearance: none;\\n\\t-moz-appearance: none;\\n\\t-webkit-appearance: none;\\n\\n\\tborder: none;\\n\\theight: 20px;\\n\\tbackground-color: whiteSmoke;\\n\\tborder-radius: 3px;\\n\\tbox-shadow: 0 2px 3px rgba(0,0,0,.5) inset;\\n\\tcolor: royalblue;\\n\\tposition: relative;\\n\\tmargin: 0 0 1.5em;\\n}\\n\\nprogress[value]::-webkit-progress-bar {\\n\\tbackground-color: whiteSmoke;\\n\\tborder-radius: 3px;\\n\\tbox-shadow: 0 2px 3px rgba(0,0,0,.5) inset;\\n}\\n\\nprogress[value]::-webkit-progress-value {\\n\\tposition: relative;\\n\\n\\tbackground-size: 35px 20px, 100% 100%, 100% 100%;\\n\\tborder-radius:3px;\\n}\\n\\nprogress.active:not([value])::before {\\n\\tbackground-position: 10%;\\n\\tanimation-name: stripes;\\n\\tanimation-duration: 3s;\\n\\tanimation-timing-function: linear;\\n\\tanimation-iteration-count: infinite;\\n}\\n\\nprogress[value]::-moz-progress-bar {\\n\\tbackground-size: 35px 20px, 100% 100%, 100% 100%;\\n\\tborder-radius:3px;\\n}\\n\\nprogress:not([value])::-moz-progress-bar {\\n\\tborder-radius:3px;\\n\\tbackground:\\n\\tlinear-gradient(-45deg, transparent 33%, rgba(0, 0, 0, 0.2) 33%, rgba(0, 0, 0, 0.2) 66%, transparent 66%) left/2.5em 1.5em;\\n\\n}\\n\\nprogress.active:not([value])::-moz-progress-bar {\\n\\tbackground-position: 10%;\\n\\tanimation-name: stripes;\\n\\tanimation-duration: 3s;\\n\\tanimation-timing-function: linear;\\n\\tanimation-iteration-count: infinite;\\n}\\n\\nprogress.active:not([value])::-webkit-progress-bar {\\n\\tbackground-position: 10%;\\n\\tanimation-name: stripes;\\n\\tanimation-duration: 3s;\\n\\tanimation-timing-function: linear;\\n\\tanimation-iteration-count: infinite;\\n}\\n\\nprogress.primary[value]::-webkit-progress-value { background-color: #007bff; }\\nprogress.primary:not([value])::before { background-color: #007bff; }\\nprogress.primary:not([value])::-webkit-progress-bar { background-color: #007bff; }\\nprogress.primary::-moz-progress-bar { background-color: #007bff; }\\n\\nprogress.secondary[value]::-webkit-progress-value { background-color: #6c757d; }\\nprogress.secondary:not([value])::before { background-color: #6c757d; }\\nprogress.secondary:not([value])::-webkit-progress-bar { background-color: #6c757d; }\\nprogress.secondary::-moz-progress-bar { background-color: #6c757d; }\\n\\nprogress.success[value]::-webkit-progress-value { background-color: #28a745; }\\nprogress.success:not([value])::before { background-color: #28a745; }\\nprogress.success:not([value])::-webkit-progress-bar { background-color: #28a745; }\\nprogress.success::-moz-progress-bar { background-color: #28a745; }\\n\\nprogress.danger[value]::-webkit-progress-value { background-color: #dc3545; }\\nprogress.danger:not([value])::before { background-color: #dc3545; }\\nprogress.danger:not([value])::-webkit-progress-bar { background-color: #dc3545; }\\nprogress.danger::-moz-progress-bar { background-color: #dc3545; }\\n\\nprogress.warning[value]::-webkit-progress-value { background-color: #ffc107; }\\nprogress.warning:not([value])::before { background-color: #ffc107; }\\nprogress.warning:not([value])::-webkit-progress-bar { background-color: #ffc107; }\\nprogress.warning::-moz-progress-bar { background-color: #ffc107; }\\n\\nprogress.info[value]::-webkit-progress-value { background-color: #17a2b8; }\\nprogress.info:not([value])::before { background-color: #17a2b8; }\\nprogress.info:not([value])::-webkit-progress-bar { background-color: #17a2b8; }\\nprogress.info::-moz-progress-bar { background-color: #17a2b8; }\\n\\nprogress.light[value]::-webkit-progress-value { background-color: #f8f9fa; }\\nprogress.light:not([value])::before { background-color: #f8f9fa; }\\nprogress.light:not([value])::-webkit-progress-bar { background-color: #f8f9fa; }\\nprogress.light::-moz-progress-bar { background-color: #f8f9fa; }\\n\\nprogress.dark[value]::-webkit-progress-value { background-color: #343a40; }\\nprogress.dark:not([value])::-webkit-progress-bar { background-color: #343a40; }\\nprogress.dark:not([value])::before { background-color: #343a40; }\\nprogress.dark::-moz-progress-bar { background-color: #343a40; }\\n\\nprogress:not([value])::-webkit-progress-bar {\\n\\tborder-radius: 3px;\\n\\tbackground:\\n\\tlinear-gradient(-45deg, transparent 33%, rgba(0, 0, 0, 0.2) 33%, rgba(0, 0, 0, 0.2) 66%, transparent 66%) left/2.5em 1.5em;\\n}\\nprogress:not([value])::before {\\n\\tcontent:\\\" \\\";\\n\\tposition:absolute;\\n\\theight: 20px;\\n\\ttop:0;\\n\\tleft:0;\\n\\tright:0;\\n\\tbottom:0;\\n\\tborder-radius: 3px;\\n\\tbackground:\\n\\tlinear-gradient(-45deg, transparent 33%, rgba(0, 0, 0, 0.2) 33%, rgba(0, 0, 0, 0.2) 66%, transparent 66%) left/2.5em 1.5em;\\n}\\n\\n@keyframes stripes {\\n from {background-position: 0%}\\n to {background-position: 100%}\\n}\\n\");\n", " },\n", " function(Bokeh) {\n", " /* BEGIN bokeh.js */\n", " /*!\n", " * Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors\n", " * All rights reserved.\n", " * \n", " * Redistribution and use in source and binary forms, with or without modification,\n", " * are permitted provided that the following conditions are met:\n", " * \n", " * Redistributions of source code must retain the above copyright notice,\n", " * this list of conditions and the following disclaimer.\n", " * \n", " * Redistributions in binary form must reproduce the above copyright notice,\n", " * this list of conditions and the following disclaimer in the documentation\n", " * and/or other materials provided with the distribution.\n", " * \n", " * Neither the name of Anaconda nor the names of any contributors\n", " * may be used to endorse or promote products derived from this software\n", " * without specific prior written permission.\n", " * \n", " * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n", " * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n", " * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n", " * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n", " * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n", " * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n", " * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n", " * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n", " * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n", " * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n", " * THE POSSIBILITY OF SUCH DAMAGE.\n", " */\n", " (function(root, factory) {\n", " const bokeh = factory();\n", " if (root.Bokeh === undefined) {\n", " root.Bokeh = bokeh;\n", " }\n", " const Bokeh = root.Bokeh;\n", " Bokeh[bokeh.version] = bokeh;\n", " })(this, function() {\n", " var define;\n", " var parent_require = typeof require === \"function\" && require\n", " return (function(modules, entry, aliases, externals) {\n", " if (aliases === undefined) aliases = {};\n", " if (externals === undefined) externals = {};\n", "\n", " var cache = {};\n", "\n", " var normalize = function(name) {\n", " if (typeof name === \"number\")\n", " return name;\n", "\n", " if (name === \"bokehjs\")\n", " return entry;\n", "\n", " var prefix = \"@bokehjs/\"\n", " if (name.slice(0, prefix.length) === prefix)\n", " name = name.slice(prefix.length)\n", "\n", " var alias = aliases[name]\n", " if (alias != null)\n", " return alias;\n", "\n", " var trailing = name.length > 0 && name[name.lenght-1] === \"/\";\n", " var index = aliases[name + (trailing ? \"\" : \"/\") + \"index\"];\n", " if (index != null)\n", " return index;\n", "\n", " return name;\n", " }\n", "\n", " var require = function(name) {\n", " var mod = cache[name];\n", " if (!mod) {\n", " var id = normalize(name);\n", "\n", " mod = cache[id];\n", " if (!mod) {\n", " if (!modules[id]) {\n", " if (externals[id] === false || (externals[id] == true && parent_require)) {\n", " try {\n", " mod = {exports: externals[id] ? parent_require(id) : {}};\n", " cache[id] = cache[name] = mod;\n", " return mod.exports;\n", " } catch (e) {}\n", " }\n", "\n", " var err = new Error(\"Cannot find module '\" + name + \"'\");\n", " err.code = 'MODULE_NOT_FOUND';\n", " throw err;\n", " }\n", "\n", " mod = {exports: {}};\n", " cache[id] = cache[name] = mod;\n", " modules[id].call(mod.exports, require, mod, mod.exports);\n", " } else\n", " cache[name] = mod;\n", " }\n", "\n", " return mod.exports;\n", " }\n", "\n", " var main = require(entry);\n", " main.require = require;\n", "\n", " if (typeof Proxy !== \"undefined\") {\n", " // allow Bokeh.loader[\"@bokehjs/module/name\"] syntax\n", " main.loader = new Proxy({}, {\n", " get: function(_obj, module) {\n", " return require(module);\n", " }\n", " });\n", " }\n", "\n", " main.register_plugin = function(plugin_modules, plugin_entry, plugin_aliases, plugin_externals) {\n", " if (plugin_aliases === undefined) plugin_aliases = {};\n", " if (plugin_externals === undefined) plugin_externals = {};\n", "\n", " for (var name in plugin_modules) {\n", " modules[name] = plugin_modules[name];\n", " }\n", "\n", " for (var name in plugin_aliases) {\n", " aliases[name] = plugin_aliases[name];\n", " }\n", "\n", " for (var name in plugin_externals) {\n", " externals[name] = plugin_externals[name];\n", " }\n", "\n", " var plugin = require(plugin_entry);\n", "\n", " for (var name in plugin) {\n", " main[name] = plugin[name];\n", " }\n", "\n", " return plugin;\n", " }\n", "\n", " return main;\n", " })\n", " ([\n", " /* main.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " tslib_1.__exportStar(require(2) /* ./index */, exports);\n", " },\n", " /* tslib/tslib.es6.js */ function _(require, module, exports) {\n", " /*! *****************************************************************************\n", " Copyright (c) Microsoft Corporation. All rights reserved.\n", " Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use\n", " this file except in compliance with the License. You may obtain a copy of the\n", " License at http://www.apache.org/licenses/LICENSE-2.0\n", " \n", " THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n", " KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\n", " WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\n", " MERCHANTABLITY OR NON-INFRINGEMENT.\n", " \n", " See the Apache Version 2.0 License for specific language governing permissions\n", " and limitations under the License.\n", " ***************************************************************************** */\n", " /* global Reflect, Promise */\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var extendStatics = function (d, b) {\n", " extendStatics = Object.setPrototypeOf ||\n", " ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n", " function (d, b) {\n", " for (var p in b)\n", " if (b.hasOwnProperty(p))\n", " d[p] = b[p];\n", " };\n", " return extendStatics(d, b);\n", " };\n", " function __extends(d, b) {\n", " extendStatics(d, b);\n", " function __() { this.constructor = d; }\n", " d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n", " }\n", " exports.__extends = __extends;\n", " exports.__assign = function () {\n", " exports.__assign = Object.assign || function __assign(t) {\n", " for (var s, i = 1, n = arguments.length; i < n; i++) {\n", " s = arguments[i];\n", " for (var p in s)\n", " if (Object.prototype.hasOwnProperty.call(s, p))\n", " t[p] = s[p];\n", " }\n", " return t;\n", " };\n", " return exports.__assign.apply(this, arguments);\n", " };\n", " function __rest(s, e) {\n", " var t = {};\n", " for (var p in s)\n", " if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n", " t[p] = s[p];\n", " if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n", " for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n", " if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n", " t[p[i]] = s[p[i]];\n", " }\n", " return t;\n", " }\n", " exports.__rest = __rest;\n", " function __decorate(decorators, target, key, desc) {\n", " var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n", " if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\")\n", " r = Reflect.decorate(decorators, target, key, desc);\n", " else\n", " for (var i = decorators.length - 1; i >= 0; i--)\n", " if (d = decorators[i])\n", " r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n", " return c > 3 && r && Object.defineProperty(target, key, r), r;\n", " }\n", " exports.__decorate = __decorate;\n", " function __param(paramIndex, decorator) {\n", " return function (target, key) { decorator(target, key, paramIndex); };\n", " }\n", " exports.__param = __param;\n", " function __metadata(metadataKey, metadataValue) {\n", " if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\")\n", " return Reflect.metadata(metadataKey, metadataValue);\n", " }\n", " exports.__metadata = __metadata;\n", " function __awaiter(thisArg, _arguments, P, generator) {\n", " function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n", " return new (P || (P = Promise))(function (resolve, reject) {\n", " function fulfilled(value) {\n", " try {\n", " step(generator.next(value));\n", " }\n", " catch (e) {\n", " reject(e);\n", " }\n", " }\n", " function rejected(value) {\n", " try {\n", " step(generator[\"throw\"](value));\n", " }\n", " catch (e) {\n", " reject(e);\n", " }\n", " }\n", " function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n", " step((generator = generator.apply(thisArg, _arguments || [])).next());\n", " });\n", " }\n", " exports.__awaiter = __awaiter;\n", " function __generator(thisArg, body) {\n", " var _ = { label: 0, sent: function () {\n", " if (t[0] & 1)\n", " throw t[1];\n", " return t[1];\n", " }, trys: [], ops: [] }, f, y, t, g;\n", " return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function () { return this; }), g;\n", " function verb(n) { return function (v) { return step([n, v]); }; }\n", " function step(op) {\n", " if (f)\n", " throw new TypeError(\"Generator is already executing.\");\n", " while (_)\n", " try {\n", " if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)\n", " return t;\n", " if (y = 0, t)\n", " op = [op[0] & 2, t.value];\n", " switch (op[0]) {\n", " case 0:\n", " case 1:\n", " t = op;\n", " break;\n", " case 4:\n", " _.label++;\n", " return { value: op[1], done: false };\n", " case 5:\n", " _.label++;\n", " y = op[1];\n", " op = [0];\n", " continue;\n", " case 7:\n", " op = _.ops.pop();\n", " _.trys.pop();\n", " continue;\n", " default:\n", " if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n", " _ = 0;\n", " continue;\n", " }\n", " if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {\n", " _.label = op[1];\n", " break;\n", " }\n", " if (op[0] === 6 && _.label < t[1]) {\n", " _.label = t[1];\n", " t = op;\n", " break;\n", " }\n", " if (t && _.label < t[2]) {\n", " _.label = t[2];\n", " _.ops.push(op);\n", " break;\n", " }\n", " if (t[2])\n", " _.ops.pop();\n", " _.trys.pop();\n", " continue;\n", " }\n", " op = body.call(thisArg, _);\n", " }\n", " catch (e) {\n", " op = [6, e];\n", " y = 0;\n", " }\n", " finally {\n", " f = t = 0;\n", " }\n", " if (op[0] & 5)\n", " throw op[1];\n", " return { value: op[0] ? op[1] : void 0, done: true };\n", " }\n", " }\n", " exports.__generator = __generator;\n", " function __exportStar(m, exports) {\n", " for (var p in m)\n", " if (!exports.hasOwnProperty(p))\n", " exports[p] = m[p];\n", " }\n", " exports.__exportStar = __exportStar;\n", " function __values(o) {\n", " var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n", " if (m)\n", " return m.call(o);\n", " if (o && typeof o.length === \"number\")\n", " return {\n", " next: function () {\n", " if (o && i >= o.length)\n", " o = void 0;\n", " return { value: o && o[i++], done: !o };\n", " }\n", " };\n", " throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n", " }\n", " exports.__values = __values;\n", " function __read(o, n) {\n", " var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n", " if (!m)\n", " return o;\n", " var i = m.call(o), r, ar = [], e;\n", " try {\n", " while ((n === void 0 || n-- > 0) && !(r = i.next()).done)\n", " ar.push(r.value);\n", " }\n", " catch (error) {\n", " e = { error: error };\n", " }\n", " finally {\n", " try {\n", " if (r && !r.done && (m = i[\"return\"]))\n", " m.call(i);\n", " }\n", " finally {\n", " if (e)\n", " throw e.error;\n", " }\n", " }\n", " return ar;\n", " }\n", " exports.__read = __read;\n", " function __spread() {\n", " for (var ar = [], i = 0; i < arguments.length; i++)\n", " ar = ar.concat(__read(arguments[i]));\n", " return ar;\n", " }\n", " exports.__spread = __spread;\n", " function __spreadArrays() {\n", " for (var s = 0, i = 0, il = arguments.length; i < il; i++)\n", " s += arguments[i].length;\n", " for (var r = Array(s), k = 0, i = 0; i < il; i++)\n", " for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n", " r[k] = a[j];\n", " return r;\n", " }\n", " exports.__spreadArrays = __spreadArrays;\n", " ;\n", " function __await(v) {\n", " return this instanceof __await ? (this.v = v, this) : new __await(v);\n", " }\n", " exports.__await = __await;\n", " function __asyncGenerator(thisArg, _arguments, generator) {\n", " if (!Symbol.asyncIterator)\n", " throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n", " var g = generator.apply(thisArg, _arguments || []), i, q = [];\n", " return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\n", " function verb(n) {\n", " if (g[n])\n", " i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); };\n", " }\n", " function resume(n, v) {\n", " try {\n", " step(g[n](v));\n", " }\n", " catch (e) {\n", " settle(q[0][3], e);\n", " }\n", " }\n", " function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n", " function fulfill(value) { resume(\"next\", value); }\n", " function reject(value) { resume(\"throw\", value); }\n", " function settle(f, v) {\n", " if (f(v), q.shift(), q.length)\n", " resume(q[0][0], q[0][1]);\n", " }\n", " }\n", " exports.__asyncGenerator = __asyncGenerator;\n", " function __asyncDelegator(o) {\n", " var i, p;\n", " return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n", " function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\n", " }\n", " exports.__asyncDelegator = __asyncDelegator;\n", " function __asyncValues(o) {\n", " if (!Symbol.asyncIterator)\n", " throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n", " var m = o[Symbol.asyncIterator], i;\n", " return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n", " function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n", " function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }\n", " }\n", " exports.__asyncValues = __asyncValues;\n", " function __makeTemplateObject(cooked, raw) {\n", " if (Object.defineProperty) {\n", " Object.defineProperty(cooked, \"raw\", { value: raw });\n", " }\n", " else {\n", " cooked.raw = raw;\n", " }\n", " return cooked;\n", " }\n", " exports.__makeTemplateObject = __makeTemplateObject;\n", " ;\n", " function __importStar(mod) {\n", " if (mod && mod.__esModule)\n", " return mod;\n", " var result = {};\n", " if (mod != null)\n", " for (var k in mod)\n", " if (Object.hasOwnProperty.call(mod, k))\n", " result[k] = mod[k];\n", " result.default = mod;\n", " return result;\n", " }\n", " exports.__importStar = __importStar;\n", " function __importDefault(mod) {\n", " return (mod && mod.__esModule) ? mod : { default: mod };\n", " }\n", " exports.__importDefault = __importDefault;\n", " function __classPrivateFieldGet(receiver, privateMap) {\n", " if (!privateMap.has(receiver)) {\n", " throw new TypeError(\"attempted to get private field on non-instance\");\n", " }\n", " return privateMap.get(receiver);\n", " }\n", " exports.__classPrivateFieldGet = __classPrivateFieldGet;\n", " function __classPrivateFieldSet(receiver, privateMap, value) {\n", " if (!privateMap.has(receiver)) {\n", " throw new TypeError(\"attempted to set private field on non-instance\");\n", " }\n", " privateMap.set(receiver, value);\n", " return value;\n", " }\n", " exports.__classPrivateFieldSet = __classPrivateFieldSet;\n", " },\n", " /* index.js */ function _(require, module, exports) {\n", " var __importStar = (this && this.__importStar) || function (mod) {\n", " if (mod && mod.__esModule)\n", " return mod;\n", " var result = {};\n", " if (mod != null)\n", " for (var k in mod)\n", " if (Object.hasOwnProperty.call(mod, k))\n", " result[k] = mod[k];\n", " result[\"default\"] = mod;\n", " return result;\n", " };\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var version_1 = require(3) /* ./version */;\n", " exports.version = version_1.version;\n", " var embed_1 = require(4) /* ./embed */;\n", " exports.index = embed_1.index;\n", " exports.embed = __importStar(require(4) /* ./embed */);\n", " exports.protocol = __importStar(require(367) /* ./protocol */);\n", " exports._testing = __importStar(require(368) /* ./testing */);\n", " var logging_1 = require(72) /* ./core/logging */;\n", " exports.logger = logging_1.logger;\n", " exports.set_log_level = logging_1.set_log_level;\n", " var settings_1 = require(22) /* ./core/settings */;\n", " exports.settings = settings_1.settings;\n", " var base_1 = require(7) /* ./base */;\n", " exports.Models = base_1.Models;\n", " var document_1 = require(5) /* ./document */;\n", " exports.documents = document_1.documents;\n", " var safely_1 = require(369) /* ./safely */;\n", " exports.safely = safely_1.safely;\n", " },\n", " /* version.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.version = \"2.1.1\";\n", " },\n", " /* embed/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const document_1 = require(5) /* ../document */;\n", " const logging_1 = require(72) /* ../core/logging */;\n", " const string_1 = require(24) /* ../core/util/string */;\n", " const types_1 = require(8) /* ../core/util/types */;\n", " const callback_1 = require(15) /* ../core/util/callback */;\n", " const standalone_1 = require(358) /* ./standalone */;\n", " const server_1 = require(360) /* ./server */;\n", " const dom_1 = require(359) /* ./dom */;\n", " var standalone_2 = require(358) /* ./standalone */;\n", " exports.add_document_standalone = standalone_2.add_document_standalone;\n", " exports.index = standalone_2.index;\n", " var server_2 = require(360) /* ./server */;\n", " exports.add_document_from_session = server_2.add_document_from_session;\n", " var notebook_1 = require(365) /* ./notebook */;\n", " exports.embed_items_notebook = notebook_1.embed_items_notebook;\n", " exports.kernels = notebook_1.kernels;\n", " var dom_2 = require(359) /* ./dom */;\n", " exports.BOKEH_ROOT = dom_2.BOKEH_ROOT;\n", " async function embed_item(item, target_id) {\n", " const docs_json = {};\n", " const doc_id = string_1.uuid4();\n", " docs_json[doc_id] = item.doc;\n", " if (target_id == null)\n", " target_id = item.target_id;\n", " const element = document.getElementById(target_id);\n", " if (element != null)\n", " element.classList.add(dom_1.BOKEH_ROOT);\n", " const roots = { [item.root_id]: target_id };\n", " const render_item = { roots, root_ids: [item.root_id], docid: doc_id };\n", " const [views] = await callback_1.defer(() => _embed_items(docs_json, [render_item]));\n", " return views;\n", " }\n", " exports.embed_item = embed_item;\n", " // TODO (bev) this is currently clunky. Standalone embeds only provide\n", " // the first two args, whereas server provide the app_app, and *may* prove and\n", " // absolute_url as well if non-relative links are needed for resources. This function\n", " // should probably be split in to two pieces to reflect the different usage patterns\n", " async function embed_items(docs_json, render_items, app_path, absolute_url) {\n", " return await callback_1.defer(() => _embed_items(docs_json, render_items, app_path, absolute_url));\n", " }\n", " exports.embed_items = embed_items;\n", " async function _embed_items(docs_json, render_items, app_path, absolute_url) {\n", " if (types_1.isString(docs_json))\n", " docs_json = JSON.parse(string_1.unescape(docs_json));\n", " const docs = {};\n", " for (const docid in docs_json) {\n", " const doc_json = docs_json[docid];\n", " docs[docid] = document_1.Document.from_json(doc_json);\n", " }\n", " const views = [];\n", " for (const item of render_items) {\n", " const element = dom_1._resolve_element(item);\n", " const roots = dom_1._resolve_root_elements(item);\n", " if (item.docid != null) {\n", " views.push(await standalone_1.add_document_standalone(docs[item.docid], element, roots, item.use_for_title));\n", " }\n", " else if (item.token != null) {\n", " const websocket_url = server_1._get_ws_url(app_path, absolute_url);\n", " logging_1.logger.debug(`embed: computed ws url: ${websocket_url}`);\n", " try {\n", " views.push(await server_1.add_document_from_session(websocket_url, item.token, element, roots, item.use_for_title));\n", " console.log(\"Bokeh items were rendered successfully\");\n", " }\n", " catch (error) {\n", " console.log(\"Error rendering Bokeh items:\", error);\n", " }\n", " }\n", " else\n", " throw new Error(`Error rendering Bokeh items: either 'docid' or 'token' was expected.`);\n", " }\n", " return views;\n", " }\n", " },\n", " /* document/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " tslib_1.__exportStar(require(6) /* ./document */, exports);\n", " tslib_1.__exportStar(require(105) /* ./events */, exports);\n", " },\n", " /* document/document.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const base_1 = require(7) /* ../base */;\n", " const version_1 = require(3) /* ../version */;\n", " const logging_1 = require(72) /* ../core/logging */;\n", " const bokeh_events_1 = require(291) /* ../core/bokeh_events */;\n", " const has_props_1 = require(13) /* ../core/has_props */;\n", " const signaling_1 = require(14) /* ../core/signaling */;\n", " const refs_1 = require(16) /* ../core/util/refs */;\n", " const serialization_1 = require(27) /* ../core/util/serialization */;\n", " const array_1 = require(9) /* ../core/util/array */;\n", " const sets = tslib_1.__importStar(require(104) /* ../core/util/set */);\n", " const eq_1 = require(25) /* ../core/util/eq */;\n", " const types_1 = require(8) /* ../core/util/types */;\n", " const layout_dom_1 = require(245) /* ../models/layouts/layout_dom */;\n", " const column_data_source_1 = require(76) /* ../models/sources/column_data_source */;\n", " const model_1 = require(71) /* ../model */;\n", " const events_1 = require(105) /* ./events */;\n", " // Dispatches events to the subscribed models\n", " class EventManager {\n", " constructor(document) {\n", " this.document = document;\n", " this.session = null;\n", " this.subscribed_models = new Set();\n", " }\n", " send_event(bokeh_event) {\n", " const event = new events_1.MessageSentEvent(this.document, \"bokeh_event\", bokeh_event.to_json());\n", " this.document._trigger_on_change(event);\n", " }\n", " trigger(event) {\n", " for (const model of this.subscribed_models) {\n", " if (event.origin != null && event.origin != model)\n", " continue;\n", " model._process_event(event);\n", " }\n", " }\n", " }\n", " exports.EventManager = EventManager;\n", " EventManager.__name__ = \"EventManager\";\n", " exports.documents = [];\n", " exports.DEFAULT_TITLE = \"Bokeh Application\";\n", " // This class should match the API of the Python Document class\n", " // as much as possible.\n", " class Document {\n", " constructor() {\n", " exports.documents.push(this);\n", " this._init_timestamp = Date.now();\n", " this._title = exports.DEFAULT_TITLE;\n", " this._roots = [];\n", " this._all_models = new Map();\n", " this._all_models_freeze_count = 0;\n", " this._callbacks = new Map();\n", " this._message_callbacks = new Map();\n", " this.event_manager = new EventManager(this);\n", " this.idle = new signaling_1.Signal0(this, \"idle\");\n", " this._idle_roots = new WeakMap(); // TODO: WeakSet would be better\n", " this._interactive_timestamp = null;\n", " this._interactive_plot = null;\n", " }\n", " get layoutables() {\n", " return this._roots.filter((root) => root instanceof layout_dom_1.LayoutDOM);\n", " }\n", " get is_idle() {\n", " for (const root of this.layoutables) {\n", " if (!this._idle_roots.has(root))\n", " return false;\n", " }\n", " return true;\n", " }\n", " notify_idle(model) {\n", " this._idle_roots.set(model, true);\n", " if (this.is_idle) {\n", " logging_1.logger.info(`document idle at ${Date.now() - this._init_timestamp} ms`);\n", " this.idle.emit();\n", " }\n", " }\n", " clear() {\n", " this._push_all_models_freeze();\n", " try {\n", " while (this._roots.length > 0) {\n", " this.remove_root(this._roots[0]);\n", " }\n", " }\n", " finally {\n", " this._pop_all_models_freeze();\n", " }\n", " }\n", " interactive_start(plot) {\n", " if (this._interactive_plot == null) {\n", " this._interactive_plot = plot;\n", " this._interactive_plot.trigger_event(new bokeh_events_1.LODStart());\n", " }\n", " this._interactive_timestamp = Date.now();\n", " }\n", " interactive_stop(plot) {\n", " if (this._interactive_plot != null && this._interactive_plot.id === plot.id) {\n", " this._interactive_plot.trigger_event(new bokeh_events_1.LODEnd());\n", " }\n", " this._interactive_plot = null;\n", " this._interactive_timestamp = null;\n", " }\n", " interactive_duration() {\n", " if (this._interactive_timestamp == null)\n", " return -1;\n", " else\n", " return Date.now() - this._interactive_timestamp;\n", " }\n", " destructively_move(dest_doc) {\n", " if (dest_doc === this) {\n", " throw new Error(\"Attempted to overwrite a document with itself\");\n", " }\n", " dest_doc.clear();\n", " // we have to remove ALL roots before adding any\n", " // to the new doc or else models referenced from multiple\n", " // roots could be in both docs at once, which isn't allowed.\n", " const roots = array_1.copy(this._roots);\n", " this.clear();\n", " for (const root of roots) {\n", " if (root.document != null)\n", " throw new Error(`Somehow we didn't detach ${root}`);\n", " }\n", " if (this._all_models.size != 0) {\n", " throw new Error(`this._all_models still had stuff in it: ${this._all_models}`);\n", " }\n", " for (const root of roots) {\n", " dest_doc.add_root(root);\n", " }\n", " dest_doc.set_title(this._title);\n", " }\n", " // TODO other fields of doc\n", " _push_all_models_freeze() {\n", " this._all_models_freeze_count += 1;\n", " }\n", " _pop_all_models_freeze() {\n", " this._all_models_freeze_count -= 1;\n", " if (this._all_models_freeze_count === 0) {\n", " this._recompute_all_models();\n", " }\n", " }\n", " /*protected*/ _invalidate_all_models() {\n", " logging_1.logger.debug(\"invalidating document models\");\n", " // if freeze count is > 0, we'll recompute on unfreeze\n", " if (this._all_models_freeze_count === 0) {\n", " this._recompute_all_models();\n", " }\n", " }\n", " _recompute_all_models() {\n", " let new_all_models_set = new Set();\n", " for (const r of this._roots) {\n", " new_all_models_set = sets.union(new_all_models_set, r.references());\n", " }\n", " const old_all_models_set = new Set(this._all_models.values());\n", " const to_detach = sets.difference(old_all_models_set, new_all_models_set);\n", " const to_attach = sets.difference(new_all_models_set, old_all_models_set);\n", " const recomputed = new Map();\n", " for (const model of new_all_models_set) {\n", " recomputed.set(model.id, model);\n", " }\n", " for (const d of to_detach) {\n", " d.detach_document();\n", " }\n", " for (const a of to_attach) {\n", " a.attach_document(this);\n", " }\n", " this._all_models = recomputed;\n", " }\n", " roots() {\n", " return this._roots;\n", " }\n", " add_root(model, setter_id) {\n", " logging_1.logger.debug(`Adding root: ${model}`);\n", " if (array_1.includes(this._roots, model))\n", " return;\n", " this._push_all_models_freeze();\n", " try {\n", " this._roots.push(model);\n", " }\n", " finally {\n", " this._pop_all_models_freeze();\n", " }\n", " this._trigger_on_change(new events_1.RootAddedEvent(this, model, setter_id));\n", " }\n", " remove_root(model, setter_id) {\n", " const i = this._roots.indexOf(model);\n", " if (i < 0)\n", " return;\n", " this._push_all_models_freeze();\n", " try {\n", " this._roots.splice(i, 1);\n", " }\n", " finally {\n", " this._pop_all_models_freeze();\n", " }\n", " this._trigger_on_change(new events_1.RootRemovedEvent(this, model, setter_id));\n", " }\n", " title() {\n", " return this._title;\n", " }\n", " set_title(title, setter_id) {\n", " if (title !== this._title) {\n", " this._title = title;\n", " this._trigger_on_change(new events_1.TitleChangedEvent(this, title, setter_id));\n", " }\n", " }\n", " get_model_by_id(model_id) {\n", " var _a;\n", " return (_a = this._all_models.get(model_id)) !== null && _a !== void 0 ? _a : null;\n", " }\n", " get_model_by_name(name) {\n", " const found = [];\n", " for (const model of this._all_models.values()) {\n", " if (model instanceof model_1.Model && model.name == name)\n", " found.push(model);\n", " }\n", " switch (found.length) {\n", " case 0:\n", " return null;\n", " case 1:\n", " return found[0];\n", " default:\n", " throw new Error(`Multiple models are named '${name}'`);\n", " }\n", " }\n", " on_message(msg_type, callback) {\n", " const message_callbacks = this._message_callbacks.get(msg_type);\n", " if (message_callbacks == null)\n", " this._message_callbacks.set(msg_type, new Set([callback]));\n", " else\n", " message_callbacks.add(callback);\n", " }\n", " remove_on_message(msg_type, callback) {\n", " var _a;\n", " (_a = this._message_callbacks.get(msg_type)) === null || _a === void 0 ? void 0 : _a.delete(callback);\n", " }\n", " _trigger_on_message(msg_type, msg_data) {\n", " const message_callbacks = this._message_callbacks.get(msg_type);\n", " if (message_callbacks != null) {\n", " for (const cb of message_callbacks) {\n", " cb(msg_data);\n", " }\n", " }\n", " }\n", " on_change(callback, allow_batches = false) {\n", " if (!this._callbacks.has(callback)) {\n", " this._callbacks.set(callback, allow_batches);\n", " }\n", " }\n", " remove_on_change(callback) {\n", " this._callbacks.delete(callback);\n", " }\n", " _trigger_on_change(event) {\n", " for (const [callback, allow_batches] of this._callbacks) {\n", " if (!allow_batches && event instanceof events_1.DocumentEventBatch) {\n", " for (const ev of event.events) {\n", " callback(ev);\n", " }\n", " }\n", " else {\n", " callback(event);\n", " }\n", " }\n", " }\n", " _notify_change(model, attr, old_value, new_value, options) {\n", " this._trigger_on_change(new events_1.ModelChangedEvent(this, model, attr, old_value, new_value, options === null || options === void 0 ? void 0 : options.setter_id, options === null || options === void 0 ? void 0 : options.hint));\n", " }\n", " static _references_json(references, include_defaults = true) {\n", " const references_json = [];\n", " for (const r of references) {\n", " const struct = r.struct();\n", " struct.attributes = r.attributes_as_json(include_defaults);\n", " // server doesn't want id in here since it's already in ref above\n", " delete struct.attributes.id;\n", " references_json.push(struct);\n", " }\n", " return references_json;\n", " }\n", " static _instantiate_object(obj_id, obj_type, obj_attrs) {\n", " const full_attrs = Object.assign(Object.assign({}, obj_attrs), { id: obj_id, __deferred__: true });\n", " const model = base_1.Models(obj_type);\n", " return new model(full_attrs);\n", " }\n", " // given a JSON representation of all models in a graph, return a\n", " // dict of new model objects\n", " static _instantiate_references_json(references_json, existing_models) {\n", " // Create all instances, but without setting their props\n", " const references = new Map();\n", " for (const obj of references_json) {\n", " const obj_id = obj.id;\n", " const obj_type = obj.type;\n", " const obj_attrs = obj.attributes || {};\n", " let instance = existing_models.get(obj_id);\n", " if (instance == null) {\n", " instance = Document._instantiate_object(obj_id, obj_type, obj_attrs);\n", " if (obj.subtype != null)\n", " instance.set_subtype(obj.subtype);\n", " }\n", " references.set(instance.id, instance);\n", " }\n", " return references;\n", " }\n", " // if v looks like a ref, or a collection, resolve it, otherwise return it unchanged\n", " // recurse into collections but not into HasProps\n", " static _resolve_refs(value, old_references, new_references, buffers) {\n", " function resolve_ref(v) {\n", " if (refs_1.is_ref(v)) {\n", " if (old_references.has(v.id))\n", " return old_references.get(v.id);\n", " else if (new_references.has(v.id))\n", " return new_references.get(v.id);\n", " else\n", " throw new Error(`reference ${JSON.stringify(v)} isn't known (not in Document?)`);\n", " }\n", " else if (serialization_1.is_NDArray_ref(v)) {\n", " return serialization_1.decode_NDArray(v, buffers);\n", " }\n", " else if (types_1.isArray(v))\n", " return resolve_array(v);\n", " else if (types_1.isPlainObject(v))\n", " return resolve_dict(v);\n", " else\n", " return v;\n", " }\n", " function resolve_array(array) {\n", " const results = [];\n", " for (const v of array) {\n", " results.push(resolve_ref(v));\n", " }\n", " return results;\n", " }\n", " function resolve_dict(dict) {\n", " const resolved = {};\n", " for (const k in dict) {\n", " const v = dict[k];\n", " resolved[k] = resolve_ref(v);\n", " }\n", " return resolved;\n", " }\n", " return resolve_ref(value);\n", " }\n", " // given a JSON representation of all models in a graph and new\n", " // model instances, set the properties on the models from the\n", " // JSON\n", " static _initialize_references_json(references_json, old_references, new_references, buffers) {\n", " const to_update = new Map();\n", " for (const { id, attributes } of references_json) {\n", " const is_new = !old_references.has(id);\n", " const instance = is_new ? new_references.get(id) : old_references.get(id);\n", " // replace references with actual instances in obj_attrs\n", " const resolved_attrs = Document._resolve_refs(attributes, old_references, new_references, buffers);\n", " instance.setv(resolved_attrs, { silent: true });\n", " to_update.set(id, { instance, is_new });\n", " }\n", " const ordered_instances = [];\n", " const handled = new Set();\n", " function finalize_all_by_dfs(v) {\n", " if (v instanceof has_props_1.HasProps) {\n", " // note that we ignore instances that aren't updated (not in to_update)\n", " if (to_update.has(v.id) && !handled.has(v.id)) {\n", " handled.add(v.id);\n", " const { instance, is_new } = to_update.get(v.id);\n", " const { attributes } = instance;\n", " for (const attr in attributes) {\n", " finalize_all_by_dfs(attributes[attr]);\n", " }\n", " if (is_new) {\n", " // Finalizing here just to avoid iterating\n", " // over `ordered_instances` twice.\n", " instance.finalize();\n", " // Preserving an ordered collection of instances\n", " // to avoid having to go through DFS again.\n", " ordered_instances.push(instance);\n", " }\n", " }\n", " }\n", " else if (types_1.isArray(v)) {\n", " for (const e of v)\n", " finalize_all_by_dfs(e);\n", " }\n", " else if (types_1.isPlainObject(v)) {\n", " for (const k in v)\n", " finalize_all_by_dfs(v[k]);\n", " }\n", " }\n", " for (const item of to_update.values()) {\n", " finalize_all_by_dfs(item.instance);\n", " }\n", " // `connect_signals` has to be executed last because it\n", " // may rely on properties of dependencies that are initialized\n", " // only in `finalize`. It's a problem that appears when\n", " // there are circular references, e.g. as in\n", " // CDS -> CustomJS (on data change) -> GlyphRenderer (in args) -> CDS.\n", " for (const instance of ordered_instances) {\n", " instance.connect_signals();\n", " }\n", " }\n", " static _event_for_attribute_change(changed_obj, key, new_value, doc, value_refs) {\n", " const changed_model = doc.get_model_by_id(changed_obj.id); // XXX!\n", " if (!changed_model.property(key).syncable)\n", " return null;\n", " else {\n", " const event = {\n", " kind: \"ModelChanged\",\n", " model: { id: changed_obj.id },\n", " attr: key,\n", " new: new_value,\n", " };\n", " has_props_1.HasProps._json_record_references(doc, new_value, value_refs, { recursive: true });\n", " return event;\n", " }\n", " }\n", " static _events_to_sync_objects(from_obj, to_obj, to_doc, value_refs) {\n", " const from_keys = Object.keys(from_obj.attributes); //XXX!\n", " const to_keys = Object.keys(to_obj.attributes); //XXX!\n", " const removed = array_1.difference(from_keys, to_keys);\n", " const added = array_1.difference(to_keys, from_keys);\n", " const shared = array_1.intersection(from_keys, to_keys);\n", " const events = [];\n", " for (const key of removed) {\n", " // we don't really have a \"remove\" event - not sure this ever\n", " // happens even. One way this could happen is if the server\n", " // does include_defaults=True and we do\n", " // include_defaults=false ... in that case it'd be best to\n", " // just ignore this probably. Warn about it, could mean\n", " // there's a bug if we don't have a key that the server sent.\n", " logging_1.logger.warn(`Server sent key ${key} but we don't seem to have it in our JSON`);\n", " }\n", " for (const key of added) {\n", " const new_value = to_obj.attributes[key]; // XXX!\n", " events.push(Document._event_for_attribute_change(from_obj, key, new_value, to_doc, value_refs));\n", " }\n", " for (const key of shared) {\n", " const old_value = from_obj.attributes[key]; // XXX!\n", " const new_value = to_obj.attributes[key]; // XXX!\n", " if (old_value == null && new_value == null) {\n", " }\n", " else if (old_value == null || new_value == null) {\n", " events.push(Document._event_for_attribute_change(from_obj, key, new_value, to_doc, value_refs));\n", " }\n", " else {\n", " if (!eq_1.isEqual(old_value, new_value))\n", " events.push(Document._event_for_attribute_change(from_obj, key, new_value, to_doc, value_refs));\n", " }\n", " }\n", " return events.filter((e) => e != null);\n", " }\n", " // we use this to detect changes during document deserialization\n", " // (in model constructors and initializers)\n", " static _compute_patch_since_json(from_json, to_doc) {\n", " const to_json = to_doc.to_json(false); // include_defaults=false\n", " function refs(json) {\n", " const result = new Map();\n", " for (const obj of json.roots.references)\n", " result.set(obj.id, obj);\n", " return result;\n", " }\n", " const from_references = refs(from_json);\n", " const from_roots = new Map();\n", " const from_root_ids = [];\n", " for (const r of from_json.roots.root_ids) {\n", " from_roots.set(r, from_references.get(r));\n", " from_root_ids.push(r);\n", " }\n", " const to_references = refs(to_json);\n", " const to_roots = new Map();\n", " const to_root_ids = [];\n", " for (const r of to_json.roots.root_ids) {\n", " to_roots.set(r, to_references.get(r));\n", " to_root_ids.push(r);\n", " }\n", " from_root_ids.sort();\n", " to_root_ids.sort();\n", " if (array_1.difference(from_root_ids, to_root_ids).length > 0 ||\n", " array_1.difference(to_root_ids, from_root_ids).length > 0) {\n", " // this would arise if someone does add_root/remove_root during\n", " // document deserialization, hopefully they won't ever do so.\n", " throw new Error(\"Not implemented: computing add/remove of document roots\");\n", " }\n", " const value_refs = new Set();\n", " let events = [];\n", " for (const id of to_doc._all_models.keys()) {\n", " if (from_references.has(id)) {\n", " const update_model_events = Document._events_to_sync_objects(from_references.get(id), to_references.get(id), to_doc, value_refs);\n", " events = events.concat(update_model_events);\n", " }\n", " }\n", " return {\n", " references: Document._references_json(value_refs, false),\n", " events,\n", " };\n", " }\n", " to_json_string(include_defaults = true) {\n", " return JSON.stringify(this.to_json(include_defaults));\n", " }\n", " to_json(include_defaults = true) {\n", " const root_ids = this._roots.map((r) => r.id);\n", " const root_references = this._all_models.values();\n", " return {\n", " version: version_1.version,\n", " title: this._title,\n", " roots: {\n", " root_ids,\n", " references: Document._references_json(root_references, include_defaults),\n", " },\n", " };\n", " }\n", " static from_json_string(s) {\n", " const json = JSON.parse(s);\n", " return Document.from_json(json);\n", " }\n", " static from_json(json) {\n", " logging_1.logger.debug(\"Creating Document from JSON\");\n", " function pyify(version) {\n", " return version.replace(/-(dev|rc)\\./, \"$1\");\n", " }\n", " const py_version = json.version; // XXX!\n", " const is_dev = py_version.indexOf('+') !== -1 || py_version.indexOf('-') !== -1;\n", " const versions_string = `Library versions: JS (${version_1.version}) / Python (${py_version})`;\n", " if (!is_dev && pyify(version_1.version) != py_version) {\n", " logging_1.logger.warn(\"JS/Python version mismatch\");\n", " logging_1.logger.warn(versions_string);\n", " }\n", " else\n", " logging_1.logger.debug(versions_string);\n", " const roots_json = json.roots;\n", " const root_ids = roots_json.root_ids;\n", " const references_json = roots_json.references;\n", " const references = Document._instantiate_references_json(references_json, new Map());\n", " Document._initialize_references_json(references_json, new Map(), references, new Map());\n", " const doc = new Document();\n", " for (const id of root_ids) {\n", " const root = references.get(id);\n", " if (root != null) {\n", " doc.add_root(root); // XXX: HasProps\n", " }\n", " }\n", " doc.set_title(json.title); // XXX!\n", " return doc;\n", " }\n", " replace_with_json(json) {\n", " const replacement = Document.from_json(json);\n", " replacement.destructively_move(this);\n", " }\n", " create_json_patch_string(events) {\n", " return JSON.stringify(this.create_json_patch(events));\n", " }\n", " create_json_patch(events) {\n", " const references = new Set();\n", " const json_events = [];\n", " for (const event of events) {\n", " if (event.document !== this) {\n", " logging_1.logger.warn(\"Cannot create a patch using events from a different document, event had \", event.document, \" we are \", this);\n", " throw new Error(\"Cannot create a patch using events from a different document\");\n", " }\n", " json_events.push(event.json(references));\n", " }\n", " return {\n", " events: json_events,\n", " references: Document._references_json(references),\n", " };\n", " }\n", " apply_json_patch(patch, buffers = new Map(), setter_id) {\n", " const references_json = patch.references;\n", " const events_json = patch.events;\n", " const references = Document._instantiate_references_json(references_json, this._all_models);\n", " if (!(buffers instanceof Map)) {\n", " buffers = new Map(buffers);\n", " }\n", " // The model being changed isn't always in references so add it in\n", " for (const event_json of events_json) {\n", " switch (event_json.kind) {\n", " case \"RootAdded\":\n", " case \"RootRemoved\":\n", " case \"ModelChanged\": {\n", " const model_id = event_json.model.id;\n", " const model = this._all_models.get(model_id);\n", " if (model != null) {\n", " references.set(model_id, model);\n", " }\n", " else if (!references.has(model_id)) {\n", " logging_1.logger.warn(`Got an event for unknown model ${event_json.model}\"`);\n", " throw new Error(\"event model wasn't known\");\n", " }\n", " break;\n", " }\n", " }\n", " }\n", " // split references into old and new so we know whether to initialize or update\n", " const old_references = new Map();\n", " const new_references = new Map();\n", " for (const [id, value] of references) {\n", " if (this._all_models.has(id))\n", " old_references.set(id, value);\n", " else\n", " new_references.set(id, value);\n", " }\n", " Document._initialize_references_json(references_json, old_references, new_references, buffers);\n", " for (const event_json of events_json) {\n", " switch (event_json.kind) {\n", " case 'MessageSent': {\n", " const { msg_type, msg_data } = event_json;\n", " let data;\n", " if (msg_data === undefined) {\n", " if (buffers.size == 1) {\n", " const [[, buffer]] = buffers;\n", " data = buffer;\n", " }\n", " else {\n", " throw new Error(\"expected exactly one buffer\");\n", " }\n", " }\n", " else {\n", " data = Document._resolve_refs(msg_data, old_references, new_references, buffers);\n", " }\n", " this._trigger_on_message(msg_type, data);\n", " break;\n", " }\n", " case 'ModelChanged': {\n", " const patched_id = event_json.model.id;\n", " const patched_obj = this._all_models.get(patched_id);\n", " if (patched_obj == null) {\n", " throw new Error(`Cannot apply patch to ${patched_id} which is not in the document`);\n", " }\n", " const attr = event_json.attr;\n", " const value = Document._resolve_refs(event_json.new, old_references, new_references, buffers);\n", " patched_obj.setv({ [attr]: value }, { setter_id });\n", " break;\n", " }\n", " case 'ColumnDataChanged': {\n", " const column_source_id = event_json.column_source.id;\n", " const column_source = this._all_models.get(column_source_id);\n", " if (column_source == null) {\n", " throw new Error(`Cannot stream to ${column_source_id} which is not in the document`);\n", " }\n", " const data = Document._resolve_refs(event_json.new, new Map(), new Map(), buffers);\n", " if (event_json.cols != null) {\n", " for (const k in column_source.data) {\n", " if (!(k in data)) {\n", " data[k] = column_source.data[k];\n", " }\n", " }\n", " }\n", " column_source.setv({ data }, { setter_id, check_eq: false });\n", " break;\n", " }\n", " case 'ColumnsStreamed': {\n", " const column_source_id = event_json.column_source.id;\n", " const column_source = this._all_models.get(column_source_id);\n", " if (column_source == null) {\n", " throw new Error(`Cannot stream to ${column_source_id} which is not in the document`);\n", " }\n", " if (!(column_source instanceof column_data_source_1.ColumnDataSource)) {\n", " throw new Error(\"Cannot stream to non-ColumnDataSource\");\n", " }\n", " const data = event_json.data;\n", " const rollover = event_json.rollover;\n", " column_source.stream(data, rollover, setter_id);\n", " break;\n", " }\n", " case 'ColumnsPatched': {\n", " const column_source_id = event_json.column_source.id;\n", " const column_source = this._all_models.get(column_source_id);\n", " if (column_source == null) {\n", " throw new Error(`Cannot patch ${column_source_id} which is not in the document`);\n", " }\n", " if (!(column_source instanceof column_data_source_1.ColumnDataSource)) {\n", " throw new Error(\"Cannot patch non-ColumnDataSource\");\n", " }\n", " const patches = event_json.patches;\n", " column_source.patch(patches, setter_id);\n", " break;\n", " }\n", " case 'RootAdded': {\n", " const root_id = event_json.model.id;\n", " const root_obj = references.get(root_id);\n", " this.add_root(root_obj, setter_id); // XXX: HasProps\n", " break;\n", " }\n", " case 'RootRemoved': {\n", " const root_id = event_json.model.id;\n", " const root_obj = references.get(root_id);\n", " this.remove_root(root_obj, setter_id); // XXX: HasProps\n", " break;\n", " }\n", " case 'TitleChanged': {\n", " this.set_title(event_json.title, setter_id);\n", " break;\n", " }\n", " default:\n", " throw new Error(\"Unknown patch event \" + JSON.stringify(event_json));\n", " }\n", " }\n", " }\n", " }\n", " exports.Document = Document;\n", " Document.__name__ = \"Document\";\n", " },\n", " /* base.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const types_1 = require(8) /* ./core/util/types */;\n", " const has_props_1 = require(13) /* ./core/has_props */;\n", " exports.overrides = {};\n", " const _all_models = new Map();\n", " exports.Models = ((name) => {\n", " const model = exports.overrides[name] || _all_models.get(name);\n", " if (model == null) {\n", " throw new Error(`Model '${name}' does not exist. This could be due to a widget or a custom model not being registered before first usage.`);\n", " }\n", " return model;\n", " });\n", " exports.Models.register = (name, model) => {\n", " exports.overrides[name] = model;\n", " };\n", " exports.Models.unregister = (name) => {\n", " delete exports.overrides[name];\n", " };\n", " function is_HasProps(obj) {\n", " return types_1.isObject(obj) && obj.prototype instanceof has_props_1.HasProps;\n", " }\n", " exports.Models.register_models = (models, force = false, errorFn) => {\n", " if (models == null)\n", " return;\n", " for (const name in models) {\n", " const model = models[name];\n", " if (is_HasProps(model)) {\n", " const qualified = model.__qualified__;\n", " if (force || !_all_models.has(qualified))\n", " _all_models.set(qualified, model);\n", " else if (errorFn != null)\n", " errorFn(qualified);\n", " else\n", " console.warn(`Model '${qualified}' was already registered`);\n", " }\n", " }\n", " };\n", " exports.register_models = exports.Models.register_models;\n", " exports.Models.registered_names = () => Array.from(_all_models.keys());\n", " // TODO: this doesn't belong here, but it's easier this way for backwards compatibility\n", " const AllModels = tslib_1.__importStar(require(29) /* ./models */);\n", " exports.register_models(AllModels);\n", " },\n", " /* core/util/types.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " // Underscore.js 1.8.3\n", " // http://underscorejs.org\n", " // (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n", " // Underscore may be freely distributed under the MIT license.\n", " const array_1 = require(9) /* ./array */;\n", " const toString = Object.prototype.toString;\n", " function isBoolean(obj) {\n", " return obj === true || obj === false || toString.call(obj) === '[object Boolean]';\n", " }\n", " exports.isBoolean = isBoolean;\n", " function isNumber(obj) {\n", " return toString.call(obj) === \"[object Number]\";\n", " }\n", " exports.isNumber = isNumber;\n", " function isInteger(obj) {\n", " return isNumber(obj) && Number.isInteger(obj);\n", " }\n", " exports.isInteger = isInteger;\n", " function isString(obj) {\n", " return toString.call(obj) === \"[object String]\";\n", " }\n", " exports.isString = isString;\n", " function isFunction(obj) {\n", " return toString.call(obj) === \"[object Function]\";\n", " }\n", " exports.isFunction = isFunction;\n", " function isArray(obj) {\n", " return Array.isArray(obj);\n", " }\n", " exports.isArray = isArray;\n", " function isArrayOf(arr, predicate) {\n", " return array_1.every(arr, predicate);\n", " }\n", " exports.isArrayOf = isArrayOf;\n", " function isArrayableOf(arr, predicate) {\n", " for (let i = 0, end = arr.length; i < end; i++) {\n", " if (!predicate(arr[i]))\n", " return false;\n", " }\n", " return true;\n", " }\n", " exports.isArrayableOf = isArrayableOf;\n", " function isTypedArray(obj) {\n", " return ArrayBuffer.isView(obj) && !(obj instanceof DataView);\n", " }\n", " exports.isTypedArray = isTypedArray;\n", " function isObject(obj) {\n", " const tp = typeof obj;\n", " return tp === 'function' || tp === 'object' && !!obj;\n", " }\n", " exports.isObject = isObject;\n", " function isPlainObject(obj) {\n", " return isObject(obj) && (obj.constructor == null || obj.constructor === Object);\n", " }\n", " exports.isPlainObject = isPlainObject;\n", " },\n", " /* core/util/array.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " // Underscore.js 1.8.3\n", " // http://underscorejs.org\n", " // (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n", " // Underscore may be freely distributed under the MIT license.\n", " const math_1 = require(10) /* ./math */;\n", " const assert_1 = require(11) /* ./assert */;\n", " const arrayable_1 = require(12) /* ./arrayable */;\n", " exports.map = arrayable_1.map;\n", " exports.reduce = arrayable_1.reduce;\n", " exports.min = arrayable_1.min;\n", " exports.min_by = arrayable_1.min_by;\n", " exports.max = arrayable_1.max;\n", " exports.max_by = arrayable_1.max_by;\n", " exports.sum = arrayable_1.sum;\n", " exports.cumsum = arrayable_1.cumsum;\n", " exports.every = arrayable_1.every;\n", " exports.some = arrayable_1.some;\n", " exports.find = arrayable_1.find;\n", " exports.find_last = arrayable_1.find_last;\n", " exports.find_index = arrayable_1.find_index;\n", " exports.find_last_index = arrayable_1.find_last_index;\n", " exports.sorted_index = arrayable_1.sorted_index;\n", " exports.is_empty = arrayable_1.is_empty;\n", " const slice = Array.prototype.slice;\n", " function head(array) {\n", " return array[0];\n", " }\n", " exports.head = head;\n", " function tail(array) {\n", " return array[array.length - 1];\n", " }\n", " exports.tail = tail;\n", " function last(array) {\n", " return array[array.length - 1];\n", " }\n", " exports.last = last;\n", " function copy(array) {\n", " return slice.call(array);\n", " }\n", " exports.copy = copy;\n", " function concat(arrays) {\n", " return [].concat(...arrays);\n", " }\n", " exports.concat = concat;\n", " function includes(array, value) {\n", " return array.indexOf(value) !== -1;\n", " }\n", " exports.includes = includes;\n", " exports.contains = includes;\n", " function nth(array, index) {\n", " return array[index >= 0 ? index : array.length + index];\n", " }\n", " exports.nth = nth;\n", " function zip(...arrays) {\n", " if (arrays.length == 0)\n", " return [];\n", " const n = arrayable_1.min(arrays.map((a) => a.length));\n", " const k = arrays.length;\n", " const result = new Array(n);\n", " for (let i = 0; i < n; i++) {\n", " result[i] = new Array(k);\n", " for (let j = 0; j < k; j++)\n", " result[i][j] = arrays[j][i];\n", " }\n", " return result;\n", " }\n", " exports.zip = zip;\n", " function unzip(array) {\n", " const n = array.length;\n", " const k = arrayable_1.min(array.map((a) => a.length));\n", " const results = Array(k);\n", " for (let j = 0; j < k; j++)\n", " results[j] = new Array(n);\n", " for (let i = 0; i < n; i++) {\n", " for (let j = 0; j < k; j++)\n", " results[j][i] = array[i][j];\n", " }\n", " return results;\n", " }\n", " exports.unzip = unzip;\n", " function range(start, stop, step = 1) {\n", " assert_1.assert(step > 0, \"'step' must be a positive number\");\n", " if (stop == null) {\n", " stop = start;\n", " start = 0;\n", " }\n", " const { max, ceil, abs } = Math;\n", " const delta = start <= stop ? step : -step;\n", " const length = max(ceil(abs(stop - start) / step), 0);\n", " const range = Array(length);\n", " for (let i = 0; i < length; i++, start += delta) {\n", " range[i] = start;\n", " }\n", " return range;\n", " }\n", " exports.range = range;\n", " function linspace(start, stop, num = 100) {\n", " const step = (stop - start) / (num - 1);\n", " const array = new Array(num);\n", " for (let i = 0; i < num; i++) {\n", " array[i] = start + step * i;\n", " }\n", " return array;\n", " }\n", " exports.linspace = linspace;\n", " function transpose(array) {\n", " const rows = array.length;\n", " const cols = array[0].length;\n", " const transposed = [];\n", " for (let j = 0; j < cols; j++) {\n", " transposed[j] = [];\n", " for (let i = 0; i < rows; i++) {\n", " transposed[j][i] = array[i][j];\n", " }\n", " }\n", " return transposed;\n", " }\n", " exports.transpose = transpose;\n", " function argmin(array) {\n", " return arrayable_1.min_by(range(array.length), (i) => array[i]);\n", " }\n", " exports.argmin = argmin;\n", " function argmax(array) {\n", " return arrayable_1.max_by(range(array.length), (i) => array[i]);\n", " }\n", " exports.argmax = argmax;\n", " function sort_by(array, key) {\n", " const tmp = array.map((value, index) => {\n", " return { value, index, key: key(value) };\n", " });\n", " tmp.sort((left, right) => {\n", " const a = left.key;\n", " const b = right.key;\n", " if (a !== b) {\n", " if (a > b || a === undefined)\n", " return 1;\n", " if (a < b || b === undefined)\n", " return -1;\n", " }\n", " return left.index - right.index;\n", " });\n", " return tmp.map((item) => item.value);\n", " }\n", " exports.sort_by = sort_by;\n", " function uniq(array) {\n", " const result = [];\n", " for (const value of array) {\n", " if (!includes(result, value)) {\n", " result.push(value);\n", " }\n", " }\n", " return result;\n", " }\n", " exports.uniq = uniq;\n", " function uniq_by(array, key) {\n", " const result = [];\n", " const seen = [];\n", " for (const value of array) {\n", " const computed = key(value);\n", " if (!includes(seen, computed)) {\n", " seen.push(computed);\n", " result.push(value);\n", " }\n", " }\n", " return result;\n", " }\n", " exports.uniq_by = uniq_by;\n", " function union(...arrays) {\n", " return uniq(concat(arrays));\n", " }\n", " exports.union = union;\n", " function intersection(array, ...arrays) {\n", " const result = [];\n", " top: for (const item of array) {\n", " if (includes(result, item))\n", " continue;\n", " for (const other of arrays) {\n", " if (!includes(other, item))\n", " continue top;\n", " }\n", " result.push(item);\n", " }\n", " return result;\n", " }\n", " exports.intersection = intersection;\n", " function difference(array, ...arrays) {\n", " const rest = concat(arrays);\n", " return array.filter((value) => !includes(rest, value));\n", " }\n", " exports.difference = difference;\n", " function remove_at(array, i) {\n", " const result = copy(array);\n", " result.splice(i, 1);\n", " return result;\n", " }\n", " exports.remove_at = remove_at;\n", " function remove_by(array, key) {\n", " for (let i = 0; i < array.length;) {\n", " if (key(array[i]))\n", " array.splice(i, 1);\n", " else\n", " i++;\n", " }\n", " }\n", " exports.remove_by = remove_by;\n", " // Shuffle a collection, using the modern version of the\n", " // [Fisher-Yates shuffle](http://en.wikipedia.org/wiki/Fisher–Yates_shuffle).\n", " function shuffle(array) {\n", " const length = array.length;\n", " const shuffled = new Array(length);\n", " for (let i = 0; i < length; i++) {\n", " const rand = math_1.randomIn(0, i);\n", " if (rand !== i)\n", " shuffled[i] = shuffled[rand];\n", " shuffled[rand] = array[i];\n", " }\n", " return shuffled;\n", " }\n", " exports.shuffle = shuffle;\n", " function pairwise(array, fn) {\n", " const n = array.length;\n", " const result = new Array(n - 1);\n", " for (let i = 0; i < n - 1; i++) {\n", " result[i] = fn(array[i], array[i + 1]);\n", " }\n", " return result;\n", " }\n", " exports.pairwise = pairwise;\n", " function reversed(array) {\n", " const n = array.length;\n", " const result = new Array(n);\n", " for (let i = 0; i < n; i++) {\n", " result[n - i - 1] = array[i];\n", " }\n", " return result;\n", " }\n", " exports.reversed = reversed;\n", " function repeat(value, n) {\n", " const result = new Array(n);\n", " for (let i = 0; i < n; i++) {\n", " result[i] = value;\n", " }\n", " return result;\n", " }\n", " exports.repeat = repeat;\n", " },\n", " /* core/util/math.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " function angle_norm(angle) {\n", " if (angle == 0) {\n", " return 0;\n", " }\n", " while (angle <= 0) {\n", " angle += 2 * Math.PI;\n", " }\n", " while (angle > 2 * Math.PI) {\n", " angle -= 2 * Math.PI;\n", " }\n", " return angle;\n", " }\n", " exports.angle_norm = angle_norm;\n", " function angle_dist(lhs, rhs) {\n", " return angle_norm(lhs - rhs);\n", " }\n", " exports.angle_dist = angle_dist;\n", " function angle_between(mid, lhs, rhs, direction) {\n", " const d = angle_dist(lhs, rhs);\n", " if (d == 0)\n", " return false;\n", " if (d == 2 * Math.PI)\n", " return true;\n", " const norm_mid = angle_norm(mid);\n", " const cond = angle_dist(lhs, norm_mid) <= d && angle_dist(norm_mid, rhs) <= d;\n", " return (direction == 0 /* clock */) ? cond : !cond;\n", " }\n", " exports.angle_between = angle_between;\n", " function random() {\n", " return Math.random();\n", " }\n", " exports.random = random;\n", " function randomIn(min, max) {\n", " if (max == null) {\n", " max = min;\n", " min = 0;\n", " }\n", " return min + Math.floor(Math.random() * (max - min + 1));\n", " }\n", " exports.randomIn = randomIn;\n", " function atan2(start, end) {\n", " /*\n", " * Calculate the angle between a line containing start and end points (composed\n", " * of [x, y] arrays) and the positive x-axis.\n", " */\n", " return Math.atan2(end[1] - start[1], end[0] - start[0]);\n", " }\n", " exports.atan2 = atan2;\n", " // http://www2.econ.osaka-u.ac.jp/~tanizaki/class/2013/econome3/13.pdf (Page 432)\n", " function rnorm(mu, sigma) {\n", " // Generate a random normal with a mean of 0 and a sigma of 1\n", " let r1;\n", " let r2;\n", " while (true) {\n", " r1 = random();\n", " r2 = random();\n", " r2 = (2 * r2 - 1) * Math.sqrt(2 * (1 / Math.E));\n", " if (-4 * r1 * r1 * Math.log(r1) >= r2 * r2)\n", " break;\n", " }\n", " let rn = r2 / r1;\n", " // Transform the standard normal to meet the characteristics that we want (mu, sigma)\n", " rn = mu + sigma * rn;\n", " return rn;\n", " }\n", " exports.rnorm = rnorm;\n", " function clamp(val, min, max) {\n", " if (val > max)\n", " return max;\n", " if (val < min)\n", " return min;\n", " return val;\n", " }\n", " exports.clamp = clamp;\n", " },\n", " /* core/util/assert.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " class AssertionError extends Error {\n", " }\n", " exports.AssertionError = AssertionError;\n", " AssertionError.__name__ = \"AssertionError\";\n", " function assert(condition, message) {\n", " if (condition === true || (condition !== false && condition()))\n", " return;\n", " throw new AssertionError(message !== null && message !== void 0 ? message : \"Assertion failed\");\n", " }\n", " exports.assert = assert;\n", " function unreachable() {\n", " throw new Error(\"unreachable code\");\n", " }\n", " exports.unreachable = unreachable;\n", " },\n", " /* core/util/arrayable.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " function is_empty(array) {\n", " return array.length == 0;\n", " }\n", " exports.is_empty = is_empty;\n", " function splice(array, start, k, ...items) {\n", " const len = array.length;\n", " if (start < 0)\n", " start += len;\n", " if (start < 0)\n", " start = 0;\n", " else if (start > len)\n", " start = len;\n", " if (k == null || k > len - start)\n", " k = len - start;\n", " else if (k < 0)\n", " k = 0;\n", " const n = len - k + items.length;\n", " const result = new array.constructor(n);\n", " let i = 0;\n", " for (; i < start; i++) {\n", " result[i] = array[i];\n", " }\n", " for (const item of items) {\n", " result[i++] = item;\n", " }\n", " for (let j = start + k; j < len; j++) {\n", " result[i++] = array[j];\n", " }\n", " return result;\n", " }\n", " exports.splice = splice;\n", " function head(array, n) {\n", " return splice(array, n, array.length - n);\n", " }\n", " exports.head = head;\n", " function insert(array, item, i) {\n", " return splice(array, i, 0, item);\n", " }\n", " exports.insert = insert;\n", " function append(array, item) {\n", " return splice(array, array.length, 0, item);\n", " }\n", " exports.append = append;\n", " function prepend(array, item) {\n", " return splice(array, 0, 0, item);\n", " }\n", " exports.prepend = prepend;\n", " function indexOf(array, item) {\n", " for (let i = 0, n = array.length; i < n; i++) {\n", " if (array[i] === item)\n", " return i;\n", " }\n", " return -1;\n", " }\n", " exports.indexOf = indexOf;\n", " function map(array, fn) {\n", " const n = array.length;\n", " const result = new array.constructor(n);\n", " for (let i = 0; i < n; i++) {\n", " result[i] = fn(array[i], i, array);\n", " }\n", " return result;\n", " }\n", " exports.map = map;\n", " function filter(array, pred) {\n", " const n = array.length;\n", " const result = new array.constructor(n);\n", " let k = 0;\n", " for (let i = 0; i < n; i++) {\n", " const value = array[i];\n", " if (pred(value, i, array))\n", " result[k++] = value;\n", " }\n", " return head(result, k);\n", " }\n", " exports.filter = filter;\n", " function reduce(array, fn, initial) {\n", " const n = array.length;\n", " if (initial === undefined && n == 0)\n", " throw new Error(\"can't reduce an empty array without an initial value\");\n", " let value;\n", " let i;\n", " if (initial === undefined) {\n", " value = array[0];\n", " i = 1;\n", " }\n", " else {\n", " value = initial;\n", " i = 0;\n", " }\n", " for (; i < n; i++) {\n", " value = fn(value, array[i], i, array);\n", " }\n", " return value;\n", " }\n", " exports.reduce = reduce;\n", " function min(array) {\n", " let value;\n", " let result = Infinity;\n", " for (let i = 0, length = array.length; i < length; i++) {\n", " value = array[i];\n", " if (value < result) {\n", " result = value;\n", " }\n", " }\n", " return result;\n", " }\n", " exports.min = min;\n", " function min_by(array, key) {\n", " if (array.length == 0)\n", " throw new Error(\"min_by() called with an empty array\");\n", " let result = array[0];\n", " let resultComputed = key(result);\n", " for (let i = 1, length = array.length; i < length; i++) {\n", " const value = array[i];\n", " const computed = key(value);\n", " if (computed < resultComputed) {\n", " result = value;\n", " resultComputed = computed;\n", " }\n", " }\n", " return result;\n", " }\n", " exports.min_by = min_by;\n", " function max(array) {\n", " let value;\n", " let result = -Infinity;\n", " for (let i = 0, length = array.length; i < length; i++) {\n", " value = array[i];\n", " if (value > result) {\n", " result = value;\n", " }\n", " }\n", " return result;\n", " }\n", " exports.max = max;\n", " function max_by(array, key) {\n", " if (array.length == 0)\n", " throw new Error(\"max_by() called with an empty array\");\n", " let result = array[0];\n", " let resultComputed = key(result);\n", " for (let i = 1, length = array.length; i < length; i++) {\n", " const value = array[i];\n", " const computed = key(value);\n", " if (computed > resultComputed) {\n", " result = value;\n", " resultComputed = computed;\n", " }\n", " }\n", " return result;\n", " }\n", " exports.max_by = max_by;\n", " function sum(array) {\n", " let result = 0;\n", " for (let i = 0, n = array.length; i < n; i++) {\n", " result += array[i];\n", " }\n", " return result;\n", " }\n", " exports.sum = sum;\n", " function cumsum(array) {\n", " const result = new array.constructor(array.length);\n", " reduce(array, (a, b, i) => result[i] = a + b, 0);\n", " return result;\n", " }\n", " exports.cumsum = cumsum;\n", " function every(array, predicate) {\n", " for (let i = 0, length = array.length; i < length; i++) {\n", " if (!predicate(array[i]))\n", " return false;\n", " }\n", " return true;\n", " }\n", " exports.every = every;\n", " function some(array, predicate) {\n", " for (let i = 0, length = array.length; i < length; i++) {\n", " if (predicate(array[i]))\n", " return true;\n", " }\n", " return false;\n", " }\n", " exports.some = some;\n", " function index_of(array, value) {\n", " for (let i = 0, length = array.length; i < length; i++) {\n", " if (array[i] === value)\n", " return i;\n", " }\n", " return -1;\n", " }\n", " exports.index_of = index_of;\n", " function _find_index(dir) {\n", " return function (array, predicate) {\n", " const length = array.length;\n", " let index = dir > 0 ? 0 : length - 1;\n", " for (; index >= 0 && index < length; index += dir) {\n", " if (predicate(array[index]))\n", " return index;\n", " }\n", " return -1;\n", " };\n", " }\n", " exports.find_index = _find_index(1);\n", " exports.find_last_index = _find_index(-1);\n", " function find(array, predicate) {\n", " const index = exports.find_index(array, predicate);\n", " return index == -1 ? undefined : array[index];\n", " }\n", " exports.find = find;\n", " function find_last(array, predicate) {\n", " const index = exports.find_last_index(array, predicate);\n", " return index == -1 ? undefined : array[index];\n", " }\n", " exports.find_last = find_last;\n", " function sorted_index(array, value) {\n", " let low = 0;\n", " let high = array.length;\n", " while (low < high) {\n", " const mid = Math.floor((low + high) / 2);\n", " if (array[mid] < value)\n", " low = mid + 1;\n", " else\n", " high = mid;\n", " }\n", " return low;\n", " }\n", " exports.sorted_index = sorted_index;\n", " },\n", " /* core/has_props.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const signaling_1 = require(14) /* ./signaling */;\n", " const refs_1 = require(16) /* ./util/refs */;\n", " const p = tslib_1.__importStar(require(18) /* ./properties */);\n", " const mixins = tslib_1.__importStar(require(23) /* ./property_mixins */);\n", " const string_1 = require(24) /* ./util/string */;\n", " const array_1 = require(9) /* ./util/array */;\n", " const object_1 = require(17) /* ./util/object */;\n", " const types_1 = require(8) /* ./util/types */;\n", " const eq_1 = require(25) /* ./util/eq */;\n", " const document_1 = require(5) /* ../document */;\n", " const ndarray_1 = require(26) /* ./util/ndarray */;\n", " const serialization_1 = require(27) /* ./util/serialization */;\n", " class HasProps extends signaling_1.Signalable() {\n", " constructor(attrs = {}) {\n", " var _a;\n", " super();\n", " this._subtype = undefined;\n", " this.document = null;\n", " this.destroyed = new signaling_1.Signal0(this, \"destroyed\");\n", " this.change = new signaling_1.Signal0(this, \"change\");\n", " this.transformchange = new signaling_1.Signal0(this, \"transformchange\");\n", " this.properties = {}; // Object.create(null)\n", " this._pending = false;\n", " this._changing = false;\n", " const get = attrs instanceof Map ? attrs.get : (name) => attrs[name];\n", " for (const [name, { type, default_value, options }] of object_1.entries(this._props)) {\n", " if (type != null)\n", " this.properties[name] = new type(this, name, default_value, get(name), options);\n", " else\n", " throw new Error(`undefined property type for ${this.type}.${name}`);\n", " }\n", " // allowing us to defer initialization when loading many models\n", " // when loading a bunch of models, we want to do initialization as a second pass\n", " // because other objects that this one depends on might not be loaded yet\n", " if (!((_a = get(\"__deferred__\")) !== null && _a !== void 0 ? _a : false)) {\n", " this.finalize();\n", " this.connect_signals();\n", " }\n", " }\n", " // XXX: setter is only required for backwards compatibility\n", " set type(name) {\n", " console.warn(\"prototype.type = 'ModelName' is deprecated, use static __name__ instead\");\n", " this.constructor.__name__ = name;\n", " }\n", " get type() {\n", " return this.constructor.__qualified__;\n", " }\n", " static get __qualified__() {\n", " const { __module__, __name__ } = this;\n", " return __module__ != null ? `${__module__}.${__name__}` : __name__;\n", " }\n", " static init_HasProps() {\n", " this.prototype._props = {};\n", " this.prototype._mixins = [];\n", " this.define({\n", " id: [p.String, () => string_1.uniqueId()],\n", " });\n", " }\n", " static _fix_default(default_value, _attr) {\n", " if (default_value === undefined)\n", " return undefined;\n", " else if (types_1.isFunction(default_value))\n", " return default_value;\n", " else if (!types_1.isObject(default_value))\n", " return () => default_value;\n", " else {\n", " //logger.warn(`${this.prototype.type}.${attr} uses unwrapped non-primitive default value`)\n", " if (types_1.isArray(default_value))\n", " return () => array_1.copy(default_value);\n", " else\n", " return () => object_1.clone(default_value);\n", " }\n", " }\n", " // TODO: don't use Partial<>, but exclude inherited properties\n", " static define(obj) {\n", " for (const [name, prop] of object_1.entries(obj)) {\n", " if (this.prototype._props[name] != null)\n", " throw new Error(`attempted to redefine property '${this.prototype.type}.${name}'`);\n", " if (this.prototype[name] != null)\n", " throw new Error(`attempted to redefine attribute '${this.prototype.type}.${name}'`);\n", " Object.defineProperty(this.prototype, name, {\n", " // XXX: don't use tail calls in getters/setters due to https://bugs.webkit.org/show_bug.cgi?id=164306\n", " get() {\n", " const value = this.properties[name].get_value();\n", " return value;\n", " },\n", " set(value) {\n", " this.setv({ [name]: value });\n", " return this;\n", " },\n", " configurable: false,\n", " enumerable: true,\n", " });\n", " const [type, default_value, options] = prop;\n", " const refined_prop = {\n", " type,\n", " default_value: this._fix_default(default_value, name),\n", " options,\n", " };\n", " const props = object_1.clone(this.prototype._props);\n", " props[name] = refined_prop;\n", " this.prototype._props = props;\n", " }\n", " }\n", " static internal(obj) {\n", " const _object = {};\n", " for (const [name, entry] of object_1.entries(obj)) {\n", " const [type, default_value, options = {}] = entry;\n", " _object[name] = [type, default_value, Object.assign(Object.assign({}, options), { internal: true })];\n", " }\n", " this.define(_object);\n", " }\n", " static mixins(defs) {\n", " if (!types_1.isArray(defs))\n", " defs = [defs];\n", " function resolve(kind) {\n", " switch (kind) {\n", " case \"line\": return mixins.LineVector;\n", " case \"fill\": return mixins.FillVector;\n", " case \"hatch\": return mixins.HatchVector;\n", " case \"text\": return mixins.TextVector;\n", " default:\n", " throw new Error(`Unknown property mixin kind '${kind}'`);\n", " }\n", " }\n", " function rename(prefix, mixin) {\n", " const result = {};\n", " for (const [name, prop] of object_1.entries(mixin)) {\n", " result[prefix + name] = prop;\n", " }\n", " return result;\n", " }\n", " function kind_of(mixin) {\n", " const [key] = Object.keys(mixin);\n", " const [kind] = key.split(\"_\", 1);\n", " return kind;\n", " }\n", " const mixin_defs = {};\n", " const names = [];\n", " for (const def of defs) {\n", " if (types_1.isString(def)) {\n", " // TODO: remove this branch in 3.0\n", " const [kind, prefix = \"\"] = def.split(\":\");\n", " const mixin = resolve(kind);\n", " names.push(def);\n", " object_1.extend(mixin_defs, rename(prefix, mixin));\n", " }\n", " else if (types_1.isArray(def)) {\n", " const [prefix, mixin] = def;\n", " names.push(`${kind_of(mixin)}:${prefix}`);\n", " object_1.extend(mixin_defs, rename(prefix, mixin));\n", " }\n", " else {\n", " const mixin = def;\n", " names.push(kind_of(mixin));\n", " object_1.extend(mixin_defs, mixin);\n", " }\n", " }\n", " this.define(mixin_defs);\n", " this.prototype._mixins = [...this.prototype._mixins, ...names];\n", " }\n", " static override(obj) {\n", " for (const [name, prop] of object_1.entries(obj)) {\n", " const default_value = this._fix_default(prop, name);\n", " const value = this.prototype._props[name];\n", " if (value == null)\n", " throw new Error(`attempted to override nonexistent '${this.prototype.type}.${name}'`);\n", " const props = object_1.clone(this.prototype._props);\n", " props[name] = Object.assign(Object.assign({}, value), { default_value });\n", " this.prototype._props = props;\n", " }\n", " }\n", " toString() {\n", " return `${this.type}(${this.id})`;\n", " }\n", " property(name) {\n", " const prop = this.properties[name];\n", " if (prop != null)\n", " return prop;\n", " else\n", " throw new Error(`unknown property ${this.type}.${name}`);\n", " }\n", " get attributes() {\n", " const attrs = {}; // Object.create(null)\n", " for (const prop of this) {\n", " attrs[prop.attr] = prop.get_value();\n", " }\n", " return attrs;\n", " }\n", " finalize() {\n", " for (const prop of this) {\n", " if (prop.spec.transform != null)\n", " this.connect(prop.spec.transform.change, () => this.transformchange.emit());\n", " }\n", " this.initialize();\n", " }\n", " initialize() { }\n", " connect_signals() { }\n", " disconnect_signals() {\n", " signaling_1.Signal.disconnectReceiver(this);\n", " }\n", " destroy() {\n", " this.disconnect_signals();\n", " this.destroyed.emit();\n", " }\n", " // Create a new model with identical attributes to this one.\n", " clone() {\n", " return new this.constructor(this.attributes);\n", " }\n", " // Set a hash of model attributes on the object, firing `\"change\"`. This is\n", " // the core primitive operation of a model, updating the data and notifying\n", " // anyone who needs to know about the change in state. The heart of the beast.\n", " _setv(changes, options) {\n", " // Extract attributes and options.\n", " const check_eq = options.check_eq;\n", " const silent = options.silent;\n", " const changed = [];\n", " const changing = this._changing;\n", " this._changing = true;\n", " for (const [prop, value] of changes) {\n", " if (check_eq === false || !eq_1.isEqual(prop.get_value(), value)) {\n", " prop.set_value(value);\n", " changed.push(prop);\n", " }\n", " }\n", " // Trigger all relevant attribute changes.\n", " if (!silent) {\n", " if (changed.length > 0)\n", " this._pending = true;\n", " for (const prop of changed) {\n", " prop.change.emit();\n", " }\n", " }\n", " // You might be wondering why there's a `while` loop here. Changes can\n", " // be recursively nested within `\"change\"` events.\n", " if (changing)\n", " return;\n", " if (!silent && !options.no_change) {\n", " while (this._pending) {\n", " this._pending = false;\n", " this.change.emit();\n", " }\n", " }\n", " this._pending = false;\n", " this._changing = false;\n", " }\n", " setv(changes, options = {}) {\n", " if (object_1.isEmpty(changes))\n", " return;\n", " const changed = new Map();\n", " const previous = new Map();\n", " for (const attr in changes) {\n", " if (!changes.hasOwnProperty(attr))\n", " continue;\n", " const prop = this.properties[attr];\n", " if (prop == null)\n", " throw new Error(`property ${this.type}.${attr} wasn't declared`);\n", " const value = changes[attr];\n", " changed.set(prop, value);\n", " previous.set(prop, prop.get_value());\n", " }\n", " this._setv(changed, options);\n", " const { document } = this;\n", " if (document != null) {\n", " const changed = [];\n", " for (const [prop, value] of previous) {\n", " changed.push([prop, value, prop.get_value()]);\n", " }\n", " for (const [, old_value, new_value] of changed) {\n", " if (this._needs_invalidate(old_value, new_value)) {\n", " document._invalidate_all_models();\n", " break;\n", " }\n", " }\n", " if (options.silent !== true) {\n", " this._push_changes(changed, options);\n", " }\n", " }\n", " }\n", " /** @deprecated */\n", " getv(name) {\n", " return this.property(name).get_value();\n", " }\n", " ref() {\n", " return { id: this.id };\n", " }\n", " struct() {\n", " const struct = {\n", " type: this.type,\n", " id: this.id,\n", " attributes: {},\n", " };\n", " if (this._subtype != null) {\n", " struct.subtype = this._subtype;\n", " }\n", " return struct;\n", " }\n", " // we only keep the subtype so we match Python;\n", " // only Python cares about this\n", " set_subtype(subtype) {\n", " this._subtype = subtype;\n", " }\n", " *[Symbol.iterator]() {\n", " for (const name in this.properties) {\n", " yield this.properties[name];\n", " }\n", " }\n", " *syncable_properties() {\n", " for (const prop of this) {\n", " if (prop.syncable)\n", " yield prop;\n", " }\n", " }\n", " /** @deprecated */\n", " serializable_attributes() {\n", " const attrs = {};\n", " for (const prop of this.syncable_properties()) {\n", " attrs[prop.attr] = prop.get_value();\n", " }\n", " return attrs;\n", " }\n", " static _value_to_json(value) {\n", " if (value instanceof HasProps)\n", " return value.ref();\n", " else if (ndarray_1.is_NDArray(value))\n", " return serialization_1.encode_NDArray(value);\n", " else if (types_1.isArray(value) || types_1.isTypedArray(value)) {\n", " const n = value.length;\n", " const ref_array = new Array(n);\n", " for (let i = 0; i < n; i++) {\n", " const v = value[i];\n", " ref_array[i] = HasProps._value_to_json(v);\n", " }\n", " return ref_array;\n", " }\n", " else if (types_1.isPlainObject(value)) {\n", " const ref_obj = {};\n", " for (const subkey in value) {\n", " if (value.hasOwnProperty(subkey))\n", " ref_obj[subkey] = HasProps._value_to_json(value[subkey]);\n", " }\n", " return ref_obj;\n", " }\n", " else\n", " return value;\n", " }\n", " // Convert attributes to \"shallow\" JSON (values which are themselves models\n", " // are included as just references)\n", " attributes_as_json(include_defaults = true, value_to_json = HasProps._value_to_json) {\n", " const attributes = {}; // Object.create(null)\n", " for (const prop of this) {\n", " if (prop.syncable && (include_defaults || prop.dirty)) {\n", " attributes[prop.attr] = value_to_json(prop.get_value());\n", " }\n", " }\n", " return attributes;\n", " }\n", " // this is like _value_record_references but expects to find refs\n", " // instead of models, and takes a doc to look up the refs in\n", " static _json_record_references(doc, v, refs, options) {\n", " const { recursive } = options;\n", " if (refs_1.is_ref(v)) {\n", " const model = doc.get_model_by_id(v.id);\n", " if (model != null && !refs.has(model)) {\n", " HasProps._value_record_references(model, refs, { recursive });\n", " }\n", " }\n", " else if (types_1.isArray(v)) {\n", " for (const elem of v)\n", " HasProps._json_record_references(doc, elem, refs, { recursive });\n", " }\n", " else if (types_1.isPlainObject(v)) {\n", " for (const k in v) {\n", " if (v.hasOwnProperty(k)) {\n", " const elem = v[k];\n", " HasProps._json_record_references(doc, elem, refs, { recursive });\n", " }\n", " }\n", " }\n", " }\n", " // add all references from 'v' to 'result', if recurse\n", " // is true then descend into refs, if false only\n", " // descend into non-refs\n", " static _value_record_references(v, refs, options) {\n", " const { recursive } = options;\n", " if (v instanceof HasProps) {\n", " if (!refs.has(v)) {\n", " refs.add(v);\n", " if (recursive) {\n", " const immediate = v._immediate_references();\n", " for (const obj of immediate)\n", " HasProps._value_record_references(obj, refs, { recursive: true });\n", " }\n", " }\n", " }\n", " else if (types_1.isArray(v)) {\n", " for (const elem of v)\n", " HasProps._value_record_references(elem, refs, { recursive });\n", " }\n", " else if (types_1.isPlainObject(v)) {\n", " for (const k in v) {\n", " if (v.hasOwnProperty(k)) {\n", " const elem = v[k];\n", " HasProps._value_record_references(elem, refs, { recursive });\n", " }\n", " }\n", " }\n", " }\n", " // Get models that are immediately referenced by our properties\n", " // (do not recurse, do not include ourselves)\n", " _immediate_references() {\n", " const refs = new Set();\n", " for (const prop of this.syncable_properties()) {\n", " const value = prop.get_value();\n", " HasProps._value_record_references(value, refs, { recursive: false });\n", " }\n", " return [...refs.values()];\n", " }\n", " references() {\n", " const refs = new Set();\n", " HasProps._value_record_references(this, refs, { recursive: true });\n", " return refs;\n", " }\n", " _doc_attached() { }\n", " _doc_detached() { }\n", " attach_document(doc) {\n", " // This should only be called by the Document implementation to set the document field\n", " if (this.document != null && this.document != doc)\n", " throw new Error(\"models must be owned by only a single document\");\n", " this.document = doc;\n", " this._doc_attached();\n", " }\n", " detach_document() {\n", " // This should only be called by the Document implementation to unset the document field\n", " this._doc_detached();\n", " this.document = null;\n", " }\n", " _needs_invalidate(old_value, new_value) {\n", " const new_refs = new Set();\n", " HasProps._value_record_references(new_value, new_refs, { recursive: false });\n", " const old_refs = new Set();\n", " HasProps._value_record_references(old_value, old_refs, { recursive: false });\n", " for (const new_id of new_refs) {\n", " if (!old_refs.has(new_id))\n", " return true;\n", " }\n", " for (const old_id of old_refs) {\n", " if (!new_refs.has(old_id))\n", " return true;\n", " }\n", " return false;\n", " }\n", " _push_changes(changes, options = {}) {\n", " const { document } = this;\n", " if (document == null)\n", " return;\n", " const { setter_id } = options;\n", " const events = [];\n", " for (const [prop, old_value, new_value] of changes) {\n", " if (prop.syncable)\n", " events.push(new document_1.ModelChangedEvent(document, this, prop.attr, old_value, new_value, setter_id));\n", " }\n", " if (events.length != 0) {\n", " let event;\n", " if (events.length == 1)\n", " [event] = events;\n", " else\n", " event = new document_1.DocumentEventBatch(document, events, setter_id);\n", " document._trigger_on_change(event);\n", " }\n", " }\n", " materialize_dataspecs(source) {\n", " // Note: this should be moved to a function separate from HasProps\n", " const data = {};\n", " for (const prop of this) {\n", " if (!(prop instanceof p.VectorSpec))\n", " continue;\n", " // this skips optional properties like radius for circles\n", " if (prop.optional && prop.spec.value == null && !prop.dirty)\n", " continue;\n", " const name = prop.attr;\n", " const array = prop.array(source);\n", " data[`_${name}`] = array;\n", " if (prop instanceof p.DistanceSpec)\n", " data[`max_${name}`] = array_1.max(array);\n", " }\n", " return data;\n", " }\n", " on_change(properties, fn) {\n", " for (const property of types_1.isArray(properties) ? properties : [properties]) {\n", " this.connect(property.change, fn);\n", " }\n", " }\n", " }\n", " exports.HasProps = HasProps;\n", " HasProps.init_HasProps();\n", " },\n", " /* core/signaling.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " // Based on https://github.com/phosphorjs/phosphor/blob/master/packages/signaling/src/index.ts\n", " const callback_1 = require(15) /* ./util/callback */;\n", " const array_1 = require(9) /* ./util/array */;\n", " class Signal {\n", " constructor(sender, name) {\n", " this.sender = sender;\n", " this.name = name;\n", " }\n", " connect(slot, context = null) {\n", " if (!receiversForSender.has(this.sender)) {\n", " receiversForSender.set(this.sender, []);\n", " }\n", " const receivers = receiversForSender.get(this.sender);\n", " if (findConnection(receivers, this, slot, context) != null) {\n", " return false;\n", " }\n", " const receiver = context || slot;\n", " if (!sendersForReceiver.has(receiver)) {\n", " sendersForReceiver.set(receiver, []);\n", " }\n", " const senders = sendersForReceiver.get(receiver);\n", " const connection = { signal: this, slot, context };\n", " receivers.push(connection);\n", " senders.push(connection);\n", " return true;\n", " }\n", " disconnect(slot, context = null) {\n", " const receivers = receiversForSender.get(this.sender);\n", " if (receivers == null || receivers.length === 0) {\n", " return false;\n", " }\n", " const connection = findConnection(receivers, this, slot, context);\n", " if (connection == null) {\n", " return false;\n", " }\n", " const receiver = context || slot;\n", " const senders = sendersForReceiver.get(receiver);\n", " connection.signal = null;\n", " scheduleCleanup(receivers);\n", " scheduleCleanup(senders);\n", " return true;\n", " }\n", " emit(args) {\n", " const receivers = receiversForSender.get(this.sender) || [];\n", " for (const { signal, slot, context } of receivers) {\n", " if (signal === this) {\n", " slot.call(context, args, this.sender);\n", " }\n", " }\n", " }\n", " }\n", " exports.Signal = Signal;\n", " Signal.__name__ = \"Signal\";\n", " class Signal0 extends Signal {\n", " emit() {\n", " super.emit(undefined);\n", " }\n", " }\n", " exports.Signal0 = Signal0;\n", " Signal0.__name__ = \"Signal0\";\n", " (function (Signal) {\n", " function disconnectBetween(sender, receiver) {\n", " const receivers = receiversForSender.get(sender);\n", " if (receivers == null || receivers.length === 0)\n", " return;\n", " const senders = sendersForReceiver.get(receiver);\n", " if (senders == null || senders.length === 0)\n", " return;\n", " for (const connection of senders) {\n", " if (connection.signal == null)\n", " return;\n", " if (connection.signal.sender === sender)\n", " connection.signal = null;\n", " }\n", " scheduleCleanup(receivers);\n", " scheduleCleanup(senders);\n", " }\n", " Signal.disconnectBetween = disconnectBetween;\n", " function disconnectSender(sender) {\n", " const receivers = receiversForSender.get(sender);\n", " if (receivers == null || receivers.length === 0)\n", " return;\n", " for (const connection of receivers) {\n", " if (connection.signal == null)\n", " return;\n", " const receiver = connection.context || connection.slot;\n", " connection.signal = null;\n", " scheduleCleanup(sendersForReceiver.get(receiver));\n", " }\n", " scheduleCleanup(receivers);\n", " }\n", " Signal.disconnectSender = disconnectSender;\n", " function disconnectReceiver(receiver) {\n", " const senders = sendersForReceiver.get(receiver);\n", " if (senders == null || senders.length === 0)\n", " return;\n", " for (const connection of senders) {\n", " if (connection.signal == null)\n", " return;\n", " const sender = connection.signal.sender;\n", " connection.signal = null;\n", " scheduleCleanup(receiversForSender.get(sender));\n", " }\n", " scheduleCleanup(senders);\n", " }\n", " Signal.disconnectReceiver = disconnectReceiver;\n", " function disconnectAll(obj) {\n", " const receivers = receiversForSender.get(obj);\n", " if (receivers != null && receivers.length !== 0) {\n", " for (const connection of receivers) {\n", " connection.signal = null;\n", " }\n", " scheduleCleanup(receivers);\n", " }\n", " const senders = sendersForReceiver.get(obj);\n", " if (senders != null && senders.length !== 0) {\n", " for (const connection of senders) {\n", " connection.signal = null;\n", " }\n", " scheduleCleanup(senders);\n", " }\n", " }\n", " Signal.disconnectAll = disconnectAll;\n", " })(Signal || (exports.Signal = Signal = {}));\n", " function Signalable() {\n", " return class {\n", " connect(signal, slot) {\n", " return signal.connect(slot, this);\n", " }\n", " disconnect(signal, slot) {\n", " return signal.disconnect(slot, this);\n", " }\n", " };\n", " }\n", " exports.Signalable = Signalable;\n", " const receiversForSender = new WeakMap();\n", " const sendersForReceiver = new WeakMap();\n", " function findConnection(conns, signal, slot, context) {\n", " return array_1.find(conns, conn => conn.signal === signal && conn.slot === slot && conn.context === context);\n", " }\n", " const dirty_set = new Set();\n", " function scheduleCleanup(connections) {\n", " if (dirty_set.size === 0) {\n", " callback_1.defer(cleanup_dirty_set);\n", " }\n", " dirty_set.add(connections);\n", " }\n", " function cleanup_dirty_set() {\n", " for (const connections of dirty_set) {\n", " array_1.remove_by(connections, (connection) => connection.signal == null);\n", " }\n", " dirty_set.clear();\n", " }\n", " },\n", " /* core/util/callback.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " // Underscore.js 1.8.3\n", " // http://underscorejs.org\n", " // (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n", " // Underscore may be freely distributed under the MIT license.\n", " function delay(func, wait) {\n", " return setTimeout(func, wait);\n", " }\n", " exports.delay = delay;\n", " const _defer = typeof requestAnimationFrame === \"function\" ? requestAnimationFrame : setImmediate;\n", " function defer(func) {\n", " return new Promise((resolve) => {\n", " _defer(() => resolve(func()));\n", " });\n", " }\n", " exports.defer = defer;\n", " function throttle(func, wait, options = {}) {\n", " let context, args, result;\n", " let timeout = null;\n", " let previous = 0;\n", " const later = function () {\n", " previous = options.leading === false ? 0 : Date.now();\n", " timeout = null;\n", " result = func.apply(context, args);\n", " if (!timeout)\n", " context = args = null;\n", " };\n", " return function () {\n", " const now = Date.now();\n", " if (!previous && options.leading === false)\n", " previous = now;\n", " const remaining = wait - (now - previous);\n", " context = this;\n", " args = arguments;\n", " if (remaining <= 0 || remaining > wait) {\n", " if (timeout) {\n", " clearTimeout(timeout);\n", " timeout = null;\n", " }\n", " previous = now;\n", " result = func.apply(context, args);\n", " if (!timeout)\n", " context = args = null;\n", " }\n", " else if (!timeout && options.trailing !== false) {\n", " timeout = setTimeout(later, remaining);\n", " }\n", " return result;\n", " };\n", " }\n", " exports.throttle = throttle;\n", " function once(func) {\n", " let done = false;\n", " let memo;\n", " return function () {\n", " if (!done) {\n", " done = true;\n", " memo = func();\n", " }\n", " return memo;\n", " };\n", " }\n", " exports.once = once;\n", " },\n", " /* core/util/refs.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const types_1 = require(8) /* ./types */;\n", " const object_1 = require(17) /* ./object */;\n", " // Determine whether an object has the proper format of a Bokeh reference\n", " //\n", " // @param arg [Object] the object to test\n", " // @return [bool] whether the object is a reference\n", " //\n", " // @note this function does not check that the id and types are valid,\n", " // only that the format is correct (all required keys are present)\n", " //\n", " function is_ref(arg) {\n", " if (types_1.isPlainObject(arg)) {\n", " const attrs = object_1.keys(arg);\n", " return attrs.length == 1 && attrs[0] == \"id\";\n", " }\n", " return false;\n", " }\n", " exports.is_ref = is_ref;\n", " },\n", " /* core/util/object.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const array_1 = require(9) /* ./array */;\n", " exports.keys = Object.keys, exports.values = Object.values, exports.entries = Object.entries, exports.extend = Object.assign;\n", " function clone(obj) {\n", " return Object.assign({}, obj);\n", " }\n", " exports.clone = clone;\n", " function merge(obj1, obj2) {\n", " /*\n", " * Returns an object with the array values for obj1 and obj2 unioned by key.\n", " */\n", " const result = Object.create(Object.prototype);\n", " const keys = array_1.concat([Object.keys(obj1), Object.keys(obj2)]);\n", " for (const key of keys) {\n", " const arr1 = obj1.hasOwnProperty(key) ? obj1[key] : [];\n", " const arr2 = obj2.hasOwnProperty(key) ? obj2[key] : [];\n", " result[key] = array_1.union(arr1, arr2);\n", " }\n", " return result;\n", " }\n", " exports.merge = merge;\n", " function size(obj) {\n", " return Object.keys(obj).length;\n", " }\n", " exports.size = size;\n", " function isEmpty(obj) {\n", " return size(obj) == 0;\n", " }\n", " exports.isEmpty = isEmpty;\n", " function to_object(map) {\n", " const obj = {};\n", " for (const [key, val] of map) {\n", " obj[key] = val;\n", " }\n", " return obj;\n", " }\n", " exports.to_object = to_object;\n", " },\n", " /* core/properties.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const signaling_1 = require(14) /* ./signaling */;\n", " const enums = tslib_1.__importStar(require(19) /* ./enums */);\n", " const array_1 = require(9) /* ./util/array */;\n", " const arrayable_1 = require(12) /* ./util/arrayable */;\n", " const color_1 = require(20) /* ./util/color */;\n", " const types_1 = require(8) /* ./util/types */;\n", " const settings_1 = require(22) /* ./settings */;\n", " function valueToString(value) {\n", " try {\n", " return JSON.stringify(value);\n", " }\n", " catch (_a) {\n", " return value.toString();\n", " }\n", " }\n", " function isSpec(obj) {\n", " return types_1.isPlainObject(obj) &&\n", " ((obj.value === undefined ? 0 : 1) +\n", " (obj.field === undefined ? 0 : 1) +\n", " (obj.expr === undefined ? 0 : 1) == 1); // garbage JS XOR\n", " }\n", " exports.isSpec = isSpec;\n", " class Property {\n", " constructor(obj, attr, default_value, initial_value, options = {}) {\n", " var _a, _b;\n", " this.obj = obj;\n", " this.attr = attr;\n", " this.default_value = default_value;\n", " this._dirty = false;\n", " this.change = new signaling_1.Signal0(this.obj, \"change\");\n", " this.internal = (_a = options.internal) !== null && _a !== void 0 ? _a : false;\n", " this.optional = (_b = options.optional) !== null && _b !== void 0 ? _b : false;\n", " let attr_value;\n", " if (initial_value !== undefined) {\n", " attr_value = initial_value;\n", " this._dirty = true;\n", " }\n", " else {\n", " const value = this._default_override();\n", " if (value !== undefined)\n", " attr_value = value;\n", " else if (default_value !== undefined)\n", " attr_value = default_value(obj);\n", " else {\n", " //throw new Error(\"no default\")\n", " attr_value = null; // XXX: nullable properties\n", " }\n", " }\n", " this._update(attr_value);\n", " }\n", " get syncable() {\n", " return !this.internal;\n", " }\n", " get_value() {\n", " return this.spec.value;\n", " }\n", " set_value(val) {\n", " this._update(val);\n", " this._dirty = true;\n", " }\n", " // abstract _intrinsic_default(): T\n", " _default_override() {\n", " return undefined;\n", " }\n", " get dirty() {\n", " return this._dirty;\n", " }\n", " //protected abstract _update(attr_value: T): void\n", " _update(attr_value) {\n", " if (attr_value != null) // XXX: non-nullalble types\n", " this.validate(attr_value);\n", " this.spec = { value: attr_value };\n", " }\n", " toString() {\n", " /*${this.name}*/\n", " return `Prop(${this.obj}.${this.attr}, spec: ${valueToString(this.spec)})`;\n", " }\n", " // ----- customizable policies\n", " normalize(values) {\n", " return values;\n", " }\n", " validate(value) {\n", " if (!this.valid(value))\n", " throw new Error(`${this.obj.type}.${this.attr} given invalid value: ${valueToString(value)}`);\n", " }\n", " valid(_value) {\n", " return true;\n", " }\n", " // ----- property accessors\n", " value(do_spec_transform = true) {\n", " if (this.spec.value === undefined)\n", " throw new Error(\"attempted to retrieve property value for property without value specification\");\n", " let ret = this.normalize([this.spec.value])[0];\n", " if (this.spec.transform != null && do_spec_transform)\n", " ret = this.spec.transform.compute(ret);\n", " return ret;\n", " }\n", " }\n", " exports.Property = Property;\n", " Property.__name__ = \"Property\";\n", " //\n", " // Primitive Properties\n", " //\n", " class Any extends Property {\n", " }\n", " exports.Any = Any;\n", " Any.__name__ = \"Any\";\n", " class Array extends Property {\n", " valid(value) {\n", " return types_1.isArray(value) || value instanceof Float64Array;\n", " }\n", " }\n", " exports.Array = Array;\n", " Array.__name__ = \"Array\";\n", " class Boolean extends Property {\n", " valid(value) {\n", " return types_1.isBoolean(value);\n", " }\n", " }\n", " exports.Boolean = Boolean;\n", " Boolean.__name__ = \"Boolean\";\n", " class Color extends Property {\n", " valid(value) {\n", " return types_1.isString(value) && color_1.is_color(value);\n", " }\n", " }\n", " exports.Color = Color;\n", " Color.__name__ = \"Color\";\n", " class Instance extends Property {\n", " }\n", " exports.Instance = Instance;\n", " Instance.__name__ = \"Instance\";\n", " class Number extends Property {\n", " valid(value) {\n", " return types_1.isNumber(value);\n", " }\n", " }\n", " exports.Number = Number;\n", " Number.__name__ = \"Number\";\n", " class Int extends Number {\n", " valid(value) {\n", " return types_1.isNumber(value) && (value | 0) == value;\n", " }\n", " }\n", " exports.Int = Int;\n", " Int.__name__ = \"Int\";\n", " class Angle extends Number {\n", " }\n", " exports.Angle = Angle;\n", " Angle.__name__ = \"Angle\";\n", " class Percent extends Number {\n", " valid(value) {\n", " return types_1.isNumber(value) && 0 <= value && value <= 1.0;\n", " }\n", " }\n", " exports.Percent = Percent;\n", " Percent.__name__ = \"Percent\";\n", " class String extends Property {\n", " valid(value) {\n", " return types_1.isString(value);\n", " }\n", " }\n", " exports.String = String;\n", " String.__name__ = \"String\";\n", " class NullString extends Property {\n", " valid(value) {\n", " return value === null || types_1.isString(value);\n", " }\n", " }\n", " exports.NullString = NullString;\n", " NullString.__name__ = \"NullString\";\n", " class FontSize extends String {\n", " }\n", " exports.FontSize = FontSize;\n", " FontSize.__name__ = \"FontSize\";\n", " class Font extends String {\n", " _default_override() {\n", " return settings_1.settings.dev ? \"Bokeh\" : undefined;\n", " }\n", " }\n", " exports.Font = Font;\n", " Font.__name__ = \"Font\";\n", " //\n", " // Enum properties\n", " //\n", " class EnumProperty extends Property {\n", " valid(value) {\n", " return types_1.isString(value) && array_1.includes(this.enum_values, value);\n", " }\n", " }\n", " exports.EnumProperty = EnumProperty;\n", " EnumProperty.__name__ = \"EnumProperty\";\n", " function Enum(values) {\n", " return class extends EnumProperty {\n", " get enum_values() {\n", " return values;\n", " }\n", " };\n", " }\n", " exports.Enum = Enum;\n", " class Direction extends EnumProperty {\n", " get enum_values() {\n", " return enums.Direction;\n", " }\n", " normalize(values) {\n", " const result = new Uint8Array(values.length);\n", " for (let i = 0; i < values.length; i++) {\n", " switch (values[i]) {\n", " case \"clock\":\n", " result[i] = 0;\n", " break;\n", " case \"anticlock\":\n", " result[i] = 1;\n", " break;\n", " }\n", " }\n", " return result;\n", " }\n", " }\n", " exports.Direction = Direction;\n", " Direction.__name__ = \"Direction\";\n", " exports.Anchor = Enum(enums.Anchor);\n", " exports.AngleUnits = Enum(enums.AngleUnits);\n", " exports.BoxOrigin = Enum(enums.BoxOrigin);\n", " exports.ButtonType = Enum(enums.ButtonType);\n", " exports.CalendarPosition = Enum(enums.CalendarPosition);\n", " exports.Dimension = Enum(enums.Dimension);\n", " exports.Dimensions = Enum(enums.Dimensions);\n", " exports.Distribution = Enum(enums.Distribution);\n", " exports.FontStyle = Enum(enums.FontStyle);\n", " exports.HatchPatternType = Enum(enums.HatchPatternType);\n", " exports.HTTPMethod = Enum(enums.HTTPMethod);\n", " exports.HexTileOrientation = Enum(enums.HexTileOrientation);\n", " exports.HoverMode = Enum(enums.HoverMode);\n", " exports.LatLon = Enum(enums.LatLon);\n", " exports.LegendClickPolicy = Enum(enums.LegendClickPolicy);\n", " exports.LegendLocation = Enum(enums.LegendLocation);\n", " exports.LineCap = Enum(enums.LineCap);\n", " exports.LineJoin = Enum(enums.LineJoin);\n", " exports.LinePolicy = Enum(enums.LinePolicy);\n", " exports.Location = Enum(enums.Location);\n", " exports.Logo = Enum(enums.Logo);\n", " exports.MarkerType = Enum(enums.MarkerType);\n", " exports.MutedPolicy = Enum(enums.MutedPolicy);\n", " exports.Orientation = Enum(enums.Orientation);\n", " exports.OutputBackend = Enum(enums.OutputBackend);\n", " exports.PaddingUnits = Enum(enums.PaddingUnits);\n", " exports.Place = Enum(enums.Place);\n", " exports.PointPolicy = Enum(enums.PointPolicy);\n", " exports.RadiusDimension = Enum(enums.RadiusDimension);\n", " exports.RenderLevel = Enum(enums.RenderLevel);\n", " exports.RenderMode = Enum(enums.RenderMode);\n", " exports.ResetPolicy = Enum(enums.ResetPolicy);\n", " exports.RoundingFunction = Enum(enums.RoundingFunction);\n", " exports.Side = Enum(enums.Side);\n", " exports.SizingMode = Enum(enums.SizingMode);\n", " exports.Sort = Enum(enums.Sort);\n", " exports.SpatialUnits = Enum(enums.SpatialUnits);\n", " exports.StartEnd = Enum(enums.StartEnd);\n", " exports.StepMode = Enum(enums.StepMode);\n", " exports.TapBehavior = Enum(enums.TapBehavior);\n", " exports.TextAlign = Enum(enums.TextAlign);\n", " exports.TextBaseline = Enum(enums.TextBaseline);\n", " exports.TextureRepetition = Enum(enums.TextureRepetition);\n", " exports.TickLabelOrientation = Enum(enums.TickLabelOrientation);\n", " exports.TooltipAttachment = Enum(enums.TooltipAttachment);\n", " exports.UpdateMode = Enum(enums.UpdateMode);\n", " exports.VerticalAlign = Enum(enums.VerticalAlign);\n", " //\n", " // DataSpec properties\n", " //\n", " class ScalarSpec extends Property {\n", " get_value() {\n", " // XXX: allow obj.x = null; obj.x == null\n", " return this.spec.value === null ? null : this.spec;\n", " }\n", " _update(attr_value) {\n", " if (isSpec(attr_value))\n", " this.spec = attr_value;\n", " else\n", " this.spec = { value: attr_value };\n", " if (this.spec.value != null)\n", " this.validate(this.spec.value);\n", " }\n", " }\n", " exports.ScalarSpec = ScalarSpec;\n", " ScalarSpec.__name__ = \"ScalarSpec\";\n", " class AnyScalar extends ScalarSpec {\n", " }\n", " exports.AnyScalar = AnyScalar;\n", " AnyScalar.__name__ = \"AnyScalar\";\n", " class ColorScalar extends ScalarSpec {\n", " }\n", " exports.ColorScalar = ColorScalar;\n", " ColorScalar.__name__ = \"ColorScalar\";\n", " class NumberScalar extends ScalarSpec {\n", " }\n", " exports.NumberScalar = NumberScalar;\n", " NumberScalar.__name__ = \"NumberScalar\";\n", " class StringScalar extends ScalarSpec {\n", " }\n", " exports.StringScalar = StringScalar;\n", " StringScalar.__name__ = \"StringScalar\";\n", " class NullStringScalar extends ScalarSpec {\n", " }\n", " exports.NullStringScalar = NullStringScalar;\n", " NullStringScalar.__name__ = \"NullStringScalar\";\n", " class ArrayScalar extends ScalarSpec {\n", " }\n", " exports.ArrayScalar = ArrayScalar;\n", " ArrayScalar.__name__ = \"ArrayScalar\";\n", " class LineJoinScalar extends ScalarSpec {\n", " }\n", " exports.LineJoinScalar = LineJoinScalar;\n", " LineJoinScalar.__name__ = \"LineJoinScalar\";\n", " class LineCapScalar extends ScalarSpec {\n", " }\n", " exports.LineCapScalar = LineCapScalar;\n", " LineCapScalar.__name__ = \"LineCapScalar\";\n", " class FontSizeScalar extends ScalarSpec {\n", " }\n", " exports.FontSizeScalar = FontSizeScalar;\n", " FontSizeScalar.__name__ = \"FontSizeScalar\";\n", " class FontStyleScalar extends ScalarSpec {\n", " }\n", " exports.FontStyleScalar = FontStyleScalar;\n", " FontStyleScalar.__name__ = \"FontStyleScalar\";\n", " class TextAlignScalar extends ScalarSpec {\n", " }\n", " exports.TextAlignScalar = TextAlignScalar;\n", " TextAlignScalar.__name__ = \"TextAlignScalar\";\n", " class TextBaselineScalar extends ScalarSpec {\n", " }\n", " exports.TextBaselineScalar = TextBaselineScalar;\n", " TextBaselineScalar.__name__ = \"TextBaselineScalar\";\n", " class VectorSpec extends Property {\n", " get_value() {\n", " // XXX: allow obj.x = null; obj.x == null\n", " return this.spec.value === null ? null : this.spec;\n", " }\n", " _update(attr_value) {\n", " if (isSpec(attr_value))\n", " this.spec = attr_value;\n", " else\n", " this.spec = { value: attr_value };\n", " if (this.spec.value != null)\n", " this.validate(this.spec.value);\n", " }\n", " array(source) {\n", " let ret;\n", " if (this.spec.field != null) {\n", " ret = this.normalize(source.get_column(this.spec.field));\n", " if (ret == null)\n", " throw new Error(`attempted to retrieve property array for nonexistent field '${this.spec.field}'`);\n", " }\n", " else if (this.spec.expr != null) {\n", " ret = this.normalize(this.spec.expr.v_compute(source));\n", " }\n", " else {\n", " let length = source.get_length();\n", " if (length == null)\n", " length = 1;\n", " const value = this.value(false); // don't apply any spec transform\n", " ret = array_1.repeat(value, length);\n", " }\n", " if (this.spec.transform != null)\n", " ret = this.spec.transform.v_compute(ret);\n", " return ret;\n", " }\n", " }\n", " exports.VectorSpec = VectorSpec;\n", " VectorSpec.__name__ = \"VectorSpec\";\n", " class DataSpec extends VectorSpec {\n", " }\n", " exports.DataSpec = DataSpec;\n", " DataSpec.__name__ = \"DataSpec\";\n", " class UnitsSpec extends VectorSpec {\n", " _update(attr_value) {\n", " super._update(attr_value);\n", " if (this.spec.units == null)\n", " this.spec.units = this.default_units;\n", " const units = this.spec.units;\n", " if (!array_1.includes(this.valid_units, units))\n", " throw new Error(`units must be one of ${this.valid_units.join(\", \")}; got: ${units}`);\n", " }\n", " get units() {\n", " return this.spec.units;\n", " }\n", " set units(units) {\n", " this.spec.units = units;\n", " }\n", " }\n", " exports.UnitsSpec = UnitsSpec;\n", " UnitsSpec.__name__ = \"UnitsSpec\";\n", " class AngleSpec extends UnitsSpec {\n", " get default_units() { return \"rad\"; }\n", " get valid_units() { return enums.AngleUnits; }\n", " normalize(values) {\n", " if (this.spec.units == \"deg\")\n", " values = arrayable_1.map(values, (x) => x * Math.PI / 180.0);\n", " values = arrayable_1.map(values, (x) => -x);\n", " return super.normalize(values);\n", " }\n", " }\n", " exports.AngleSpec = AngleSpec;\n", " AngleSpec.__name__ = \"AngleSpec\";\n", " class BooleanSpec extends DataSpec {\n", " }\n", " exports.BooleanSpec = BooleanSpec;\n", " BooleanSpec.__name__ = \"BooleanSpec\";\n", " class ColorSpec extends DataSpec {\n", " }\n", " exports.ColorSpec = ColorSpec;\n", " ColorSpec.__name__ = \"ColorSpec\";\n", " class CoordinateSpec extends DataSpec {\n", " }\n", " exports.CoordinateSpec = CoordinateSpec;\n", " CoordinateSpec.__name__ = \"CoordinateSpec\";\n", " class CoordinateSeqSpec extends DataSpec {\n", " }\n", " exports.CoordinateSeqSpec = CoordinateSeqSpec;\n", " CoordinateSeqSpec.__name__ = \"CoordinateSeqSpec\";\n", " class DistanceSpec extends UnitsSpec {\n", " get default_units() { return \"data\"; }\n", " get valid_units() { return enums.SpatialUnits; }\n", " }\n", " exports.DistanceSpec = DistanceSpec;\n", " DistanceSpec.__name__ = \"DistanceSpec\";\n", " class FontSizeSpec extends DataSpec {\n", " }\n", " exports.FontSizeSpec = FontSizeSpec;\n", " FontSizeSpec.__name__ = \"FontSizeSpec\";\n", " class MarkerSpec extends DataSpec {\n", " }\n", " exports.MarkerSpec = MarkerSpec;\n", " MarkerSpec.__name__ = \"MarkerSpec\";\n", " class NumberSpec extends DataSpec {\n", " }\n", " exports.NumberSpec = NumberSpec;\n", " NumberSpec.__name__ = \"NumberSpec\";\n", " class StringSpec extends DataSpec {\n", " }\n", " exports.StringSpec = StringSpec;\n", " StringSpec.__name__ = \"StringSpec\";\n", " class NullStringSpec extends DataSpec {\n", " }\n", " exports.NullStringSpec = NullStringSpec;\n", " NullStringSpec.__name__ = \"NullStringSpec\";\n", " },\n", " /* core/enums.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.Align = [\"start\", \"center\", \"end\"];\n", " exports.Anchor = [\n", " \"top_left\", \"top_center\", \"top_right\",\n", " \"center_left\", \"center\", \"center_right\",\n", " \"bottom_left\", \"bottom_center\", \"bottom_right\",\n", " ];\n", " exports.AngleUnits = [\"deg\", \"rad\"];\n", " exports.BoxOrigin = [\"corner\", \"center\"];\n", " exports.ButtonType = [\"default\", \"primary\", \"success\", \"warning\", \"danger\"];\n", " exports.CalendarPosition = [\"auto\", \"above\", \"below\"];\n", " exports.Dimension = [\"width\", \"height\"];\n", " exports.Dimensions = [\"width\", \"height\", \"both\"];\n", " exports.Direction = [\"clock\", \"anticlock\"];\n", " exports.Distribution = [\"uniform\", \"normal\"];\n", " exports.FontStyle = [\"normal\", \"italic\", \"bold\", \"bold italic\"];\n", " exports.HatchPatternType = [\n", " 'blank', 'dot', 'ring', 'horizontal_line', 'vertical_line', 'cross', 'horizontal_dash',\n", " 'vertical_dash', 'spiral', 'right_diagonal_line', 'left_diagonal_line', 'diagonal_cross',\n", " 'right_diagonal_dash', 'left_diagonal_dash', 'horizontal_wave', 'vertical_wave', 'criss_cross',\n", " ' ', '.', 'o', '-', '|', '+', '\"', ':', '@', '/', '\\\\', 'x', ',', '`', 'v', '>', '*',\n", " ];\n", " exports.HTTPMethod = [\"POST\", \"GET\"];\n", " exports.HexTileOrientation = [\"pointytop\", \"flattop\"];\n", " exports.HoverMode = [\"mouse\", \"hline\", \"vline\"];\n", " exports.LatLon = [\"lat\", \"lon\"];\n", " exports.LegendClickPolicy = [\"none\", \"hide\", \"mute\"];\n", " exports.LegendLocation = exports.Anchor;\n", " exports.LineCap = [\"butt\", \"round\", \"square\"];\n", " exports.LineJoin = [\"miter\", \"round\", \"bevel\"];\n", " exports.LinePolicy = [\"prev\", \"next\", \"nearest\", \"interp\", \"none\"];\n", " exports.Location = [\"above\", \"below\", \"left\", \"right\"];\n", " exports.Logo = [\"normal\", \"grey\"];\n", " exports.MarkerType = [\n", " \"asterisk\", \"circle\", \"circle_cross\", \"circle_dot\", \"circle_x\",\n", " \"circle_y\", \"cross\", \"dash\", \"diamond\", \"diamond_cross\", \"diamond_dot\",\n", " \"dot\", \"hex\", \"hex_dot\", \"inverted_triangle\", \"plus\", \"square\",\n", " \"square_cross\", \"square_dot\", \"square_pin\", \"square_x\", \"triangle\",\n", " \"triangle_dot\", \"triangle_pin\", \"x\", \"y\",\n", " ];\n", " exports.MutedPolicy = [\"show\", \"ignore\"];\n", " exports.Orientation = [\"vertical\", \"horizontal\"];\n", " exports.OutputBackend = [\"canvas\", \"svg\", \"webgl\"];\n", " exports.PaddingUnits = [\"percent\", \"absolute\"];\n", " exports.Place = [\"above\", \"below\", \"left\", \"right\", \"center\"];\n", " exports.PointPolicy = [\"snap_to_data\", \"follow_mouse\", \"none\"];\n", " exports.RadiusDimension = [\"x\", \"y\", \"max\", \"min\"];\n", " exports.RenderLevel = [\"image\", \"underlay\", \"glyph\", \"guide\", \"annotation\", \"overlay\"];\n", " exports.RenderMode = [\"canvas\", \"css\"];\n", " exports.ResetPolicy = [\"standard\", \"event_only\"];\n", " exports.RoundingFunction = [\"round\", \"nearest\", \"floor\", \"rounddown\", \"ceil\", \"roundup\"];\n", " exports.SelectionMode = [\"replace\", \"append\", \"intersect\", \"subtract\"];\n", " exports.Side = [\"above\", \"below\", \"left\", \"right\"];\n", " exports.SizingMode = [\"stretch_width\", \"stretch_height\", \"stretch_both\", \"scale_width\", \"scale_height\", \"scale_both\", \"fixed\"];\n", " exports.Sort = [\"ascending\", \"descending\"];\n", " exports.SpatialUnits = [\"screen\", \"data\"];\n", " exports.StartEnd = [\"start\", \"end\"];\n", " exports.StepMode = [\"after\", \"before\", \"center\"];\n", " exports.TapBehavior = [\"select\", \"inspect\"];\n", " exports.TextAlign = [\"left\", \"right\", \"center\"];\n", " exports.TextBaseline = [\"top\", \"middle\", \"bottom\", \"alphabetic\", \"hanging\", \"ideographic\"];\n", " exports.TextureRepetition = [\"repeat\", \"repeat_x\", \"repeat_y\", \"no_repeat\"];\n", " exports.TickLabelOrientation = [\"vertical\", \"horizontal\", \"parallel\", \"normal\"];\n", " exports.TooltipAttachment = [\"horizontal\", \"vertical\", \"left\", \"right\", \"above\", \"below\"];\n", " exports.UpdateMode = [\"replace\", \"append\"];\n", " exports.VerticalAlign = [\"top\", \"middle\", \"bottom\"];\n", " },\n", " /* core/util/color.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const svg_colors_1 = require(21) /* ./svg_colors */;\n", " const array_1 = require(9) /* ./array */;\n", " function is_color(value) {\n", " return svg_colors_1.is_svg_color(value.toLowerCase()) || value.substring(0, 1) == \"#\" || valid_rgb(value);\n", " }\n", " exports.is_color = is_color;\n", " function _component2hex(v) {\n", " const h = Number(v).toString(16);\n", " return h.length == 1 ? `0${h}` : h;\n", " }\n", " function rgb2hex(r, g, b) {\n", " const R = _component2hex(r & 0xFF);\n", " const G = _component2hex(g & 0xFF);\n", " const B = _component2hex(b & 0xFF);\n", " return `#${R}${G}${B}`;\n", " }\n", " exports.rgb2hex = rgb2hex;\n", " function color2hex(color) {\n", " color = color + '';\n", " if (color.indexOf('#') == 0)\n", " return color;\n", " else if (svg_colors_1.is_svg_color(color))\n", " return svg_colors_1.svg_colors[color];\n", " else if (color.indexOf('rgb') == 0) {\n", " const rgb = color.replace(/^rgba?\\(|\\s+|\\)$/g, '').split(',');\n", " let hex = rgb.slice(0, 3).map(_component2hex).join('');\n", " if (rgb.length == 4)\n", " hex += _component2hex(Math.floor(parseFloat(rgb[3]) * 255));\n", " return `#${hex.slice(0, 8)}`; // can also be rgba\n", " }\n", " else\n", " return color;\n", " }\n", " exports.color2hex = color2hex;\n", " function color2rgba(color, alpha = 1.0) {\n", " if (!color) // NaN, null, '', etc.\n", " return [0, 0, 0, 0]; // transparent\n", " // Convert to hex and then to clean version of 6 or 8 chars\n", " let hex = color2hex(color);\n", " hex = hex.replace(/ |#/g, '');\n", " if (hex.length <= 4) {\n", " hex = hex.replace(/(.)/g, '$1$1');\n", " }\n", " // Convert pairs to numbers\n", " const rgba = hex.match(/../g).map((i) => parseInt(i, 16) / 255);\n", " // Ensure correct length, add alpha if necessary\n", " while (rgba.length < 3)\n", " rgba.push(0);\n", " if (rgba.length < 4)\n", " rgba.push(alpha);\n", " return rgba.slice(0, 4);\n", " }\n", " exports.color2rgba = color2rgba;\n", " function color2css(color, alpha = 1.0) {\n", " if (alpha == 1.0)\n", " return color;\n", " else {\n", " const [r, g, b, a] = color2rgba(color, alpha);\n", " return `rgba(${r * 255},${g * 255},${b * 255},${a})`;\n", " }\n", " }\n", " exports.color2css = color2css;\n", " function valid_rgb(value) {\n", " let params;\n", " switch (value.substring(0, 4)) {\n", " case \"rgba\": {\n", " params = { start: \"rgba(\", len: 4, alpha: true };\n", " break;\n", " }\n", " case \"rgb(\": {\n", " params = { start: \"rgb(\", len: 3, alpha: false };\n", " break;\n", " }\n", " default:\n", " return false;\n", " }\n", " // if '.' and then ',' found, we know decimals are used on rgb\n", " if (new RegExp(\".*?(\\\\.).*(,)\").test(value))\n", " return false;\n", " // throw new Error(`color expects integers for rgb in rgb/rgba tuple, received ${value}`)\n", " // extract the numerical values from inside parens\n", " const contents = value.replace(params.start, \"\").replace(\")\", \"\").split(',').map(parseFloat);\n", " // check length of array based on rgb/rgba\n", " if (contents.length != params.len)\n", " return false;\n", " // throw new Error(`color expects rgba ${params.len}-tuple, received ${value}`)\n", " // check for valid numerical values for rgba\n", " if (params.alpha && !(0 <= contents[3] && contents[3] <= 1))\n", " return false;\n", " // throw new Error(\"color expects rgba 4-tuple to have alpha value between 0 and 1\")\n", " if (array_1.includes(contents.slice(0, 3).map((rgb) => 0 <= rgb && rgb <= 255), false))\n", " return false;\n", " // throw new Error(\"color expects rgb to have value between 0 and 255\")\n", " return true;\n", " }\n", " exports.valid_rgb = valid_rgb;\n", " },\n", " /* core/util/svg_colors.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.svg_colors = {\n", " indianred: \"#CD5C5C\",\n", " lightcoral: \"#F08080\",\n", " salmon: \"#FA8072\",\n", " darksalmon: \"#E9967A\",\n", " lightsalmon: \"#FFA07A\",\n", " crimson: \"#DC143C\",\n", " red: \"#FF0000\",\n", " firebrick: \"#B22222\",\n", " darkred: \"#8B0000\",\n", " pink: \"#FFC0CB\",\n", " lightpink: \"#FFB6C1\",\n", " hotpink: \"#FF69B4\",\n", " deeppink: \"#FF1493\",\n", " mediumvioletred: \"#C71585\",\n", " palevioletred: \"#DB7093\",\n", " coral: \"#FF7F50\",\n", " tomato: \"#FF6347\",\n", " orangered: \"#FF4500\",\n", " darkorange: \"#FF8C00\",\n", " orange: \"#FFA500\",\n", " gold: \"#FFD700\",\n", " yellow: \"#FFFF00\",\n", " lightyellow: \"#FFFFE0\",\n", " lemonchiffon: \"#FFFACD\",\n", " lightgoldenrodyellow: \"#FAFAD2\",\n", " papayawhip: \"#FFEFD5\",\n", " moccasin: \"#FFE4B5\",\n", " peachpuff: \"#FFDAB9\",\n", " palegoldenrod: \"#EEE8AA\",\n", " khaki: \"#F0E68C\",\n", " darkkhaki: \"#BDB76B\",\n", " lavender: \"#E6E6FA\",\n", " thistle: \"#D8BFD8\",\n", " plum: \"#DDA0DD\",\n", " violet: \"#EE82EE\",\n", " orchid: \"#DA70D6\",\n", " fuchsia: \"#FF00FF\",\n", " magenta: \"#FF00FF\",\n", " mediumorchid: \"#BA55D3\",\n", " mediumpurple: \"#9370DB\",\n", " blueviolet: \"#8A2BE2\",\n", " darkviolet: \"#9400D3\",\n", " darkorchid: \"#9932CC\",\n", " darkmagenta: \"#8B008B\",\n", " purple: \"#800080\",\n", " indigo: \"#4B0082\",\n", " slateblue: \"#6A5ACD\",\n", " darkslateblue: \"#483D8B\",\n", " mediumslateblue: \"#7B68EE\",\n", " greenyellow: \"#ADFF2F\",\n", " chartreuse: \"#7FFF00\",\n", " lawngreen: \"#7CFC00\",\n", " lime: \"#00FF00\",\n", " limegreen: \"#32CD32\",\n", " palegreen: \"#98FB98\",\n", " lightgreen: \"#90EE90\",\n", " mediumspringgreen: \"#00FA9A\",\n", " springgreen: \"#00FF7F\",\n", " mediumseagreen: \"#3CB371\",\n", " seagreen: \"#2E8B57\",\n", " forestgreen: \"#228B22\",\n", " green: \"#008000\",\n", " darkgreen: \"#006400\",\n", " yellowgreen: \"#9ACD32\",\n", " olivedrab: \"#6B8E23\",\n", " olive: \"#808000\",\n", " darkolivegreen: \"#556B2F\",\n", " mediumaquamarine: \"#66CDAA\",\n", " darkseagreen: \"#8FBC8F\",\n", " lightseagreen: \"#20B2AA\",\n", " darkcyan: \"#008B8B\",\n", " teal: \"#008080\",\n", " aqua: \"#00FFFF\",\n", " cyan: \"#00FFFF\",\n", " lightcyan: \"#E0FFFF\",\n", " paleturquoise: \"#AFEEEE\",\n", " aquamarine: \"#7FFFD4\",\n", " turquoise: \"#40E0D0\",\n", " mediumturquoise: \"#48D1CC\",\n", " darkturquoise: \"#00CED1\",\n", " cadetblue: \"#5F9EA0\",\n", " steelblue: \"#4682B4\",\n", " lightsteelblue: \"#B0C4DE\",\n", " powderblue: \"#B0E0E6\",\n", " lightblue: \"#ADD8E6\",\n", " skyblue: \"#87CEEB\",\n", " lightskyblue: \"#87CEFA\",\n", " deepskyblue: \"#00BFFF\",\n", " dodgerblue: \"#1E90FF\",\n", " cornflowerblue: \"#6495ED\",\n", " royalblue: \"#4169E1\",\n", " blue: \"#0000FF\",\n", " mediumblue: \"#0000CD\",\n", " darkblue: \"#00008B\",\n", " navy: \"#000080\",\n", " midnightblue: \"#191970\",\n", " cornsilk: \"#FFF8DC\",\n", " blanchedalmond: \"#FFEBCD\",\n", " bisque: \"#FFE4C4\",\n", " navajowhite: \"#FFDEAD\",\n", " wheat: \"#F5DEB3\",\n", " burlywood: \"#DEB887\",\n", " tan: \"#D2B48C\",\n", " rosybrown: \"#BC8F8F\",\n", " sandybrown: \"#F4A460\",\n", " goldenrod: \"#DAA520\",\n", " darkgoldenrod: \"#B8860B\",\n", " peru: \"#CD853F\",\n", " chocolate: \"#D2691E\",\n", " saddlebrown: \"#8B4513\",\n", " sienna: \"#A0522D\",\n", " brown: \"#A52A2A\",\n", " maroon: \"#800000\",\n", " white: \"#FFFFFF\",\n", " snow: \"#FFFAFA\",\n", " honeydew: \"#F0FFF0\",\n", " mintcream: \"#F5FFFA\",\n", " azure: \"#F0FFFF\",\n", " aliceblue: \"#F0F8FF\",\n", " ghostwhite: \"#F8F8FF\",\n", " whitesmoke: \"#F5F5F5\",\n", " seashell: \"#FFF5EE\",\n", " beige: \"#F5F5DC\",\n", " oldlace: \"#FDF5E6\",\n", " floralwhite: \"#FFFAF0\",\n", " ivory: \"#FFFFF0\",\n", " antiquewhite: \"#FAEBD7\",\n", " linen: \"#FAF0E6\",\n", " lavenderblush: \"#FFF0F5\",\n", " mistyrose: \"#FFE4E1\",\n", " gainsboro: \"#DCDCDC\",\n", " lightgray: \"#D3D3D3\",\n", " lightgrey: \"#D3D3D3\",\n", " silver: \"#C0C0C0\",\n", " darkgray: \"#A9A9A9\",\n", " darkgrey: \"#A9A9A9\",\n", " gray: \"#808080\",\n", " grey: \"#808080\",\n", " dimgray: \"#696969\",\n", " dimgrey: \"#696969\",\n", " lightslategray: \"#778899\",\n", " lightslategrey: \"#778899\",\n", " slategray: \"#708090\",\n", " slategrey: \"#708090\",\n", " darkslategray: \"#2F4F4F\",\n", " darkslategrey: \"#2F4F4F\",\n", " black: \"#000000\",\n", " };\n", " function is_svg_color(color) {\n", " return color in exports.svg_colors;\n", " }\n", " exports.is_svg_color = is_svg_color;\n", " },\n", " /* core/settings.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " class Settings {\n", " constructor() {\n", " this._dev = false;\n", " }\n", " set dev(dev) {\n", " this._dev = dev;\n", " }\n", " get dev() {\n", " return this._dev;\n", " }\n", " }\n", " exports.Settings = Settings;\n", " Settings.__name__ = \"Settings\";\n", " exports.settings = new Settings();\n", " },\n", " /* core/property_mixins.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const p = tslib_1.__importStar(require(18) /* ./properties */);\n", " exports.Line = {\n", " line_color: [p.Color, \"black\"],\n", " line_alpha: [p.Number, 1.0],\n", " line_width: [p.Number, 1],\n", " line_join: [p.LineJoin, \"bevel\"],\n", " line_cap: [p.LineCap, \"butt\"],\n", " line_dash: [p.Array, []],\n", " line_dash_offset: [p.Number, 0],\n", " };\n", " exports.Fill = {\n", " fill_color: [p.Color, \"gray\"],\n", " fill_alpha: [p.Number, 1.0],\n", " };\n", " exports.Hatch = {\n", " hatch_color: [p.Color, \"black\"],\n", " hatch_alpha: [p.Number, 1.0],\n", " hatch_scale: [p.Number, 12.0],\n", " hatch_pattern: [p.NullString, null],\n", " hatch_weight: [p.Number, 1.0],\n", " hatch_extra: [p.Any, {}],\n", " };\n", " exports.Text = {\n", " text_color: [p.Color, \"#444444\"],\n", " text_alpha: [p.Number, 1.0],\n", " text_font: [p.Font, \"helvetica\"],\n", " text_font_size: [p.FontSize, \"16px\"],\n", " text_font_style: [p.FontStyle, \"normal\"],\n", " text_align: [p.TextAlign, \"left\"],\n", " text_baseline: [p.TextBaseline, \"bottom\"],\n", " text_line_height: [p.Number, 1.2],\n", " };\n", " exports.LineScalar = {\n", " line_color: [p.ColorScalar, \"black\"],\n", " line_alpha: [p.NumberScalar, 1.0],\n", " line_width: [p.NumberScalar, 1],\n", " line_join: [p.LineJoinScalar, \"bevel\"],\n", " line_cap: [p.LineCapScalar, \"butt\"],\n", " line_dash: [p.ArrayScalar, []],\n", " line_dash_offset: [p.NumberScalar, 0],\n", " };\n", " exports.FillScalar = {\n", " fill_color: [p.ColorScalar, \"gray\"],\n", " fill_alpha: [p.NumberScalar, 1.0],\n", " };\n", " exports.HatchScalar = {\n", " hatch_color: [p.ColorScalar, \"black\"],\n", " hatch_alpha: [p.NumberScalar, 1.0],\n", " hatch_scale: [p.NumberScalar, 12.0],\n", " hatch_pattern: [p.NullStringScalar, null],\n", " hatch_weight: [p.NumberScalar, 1.0],\n", " hatch_extra: [p.AnyScalar, {}],\n", " };\n", " exports.TextScalar = {\n", " text_color: [p.ColorScalar, \"#444444\"],\n", " text_alpha: [p.NumberScalar, 1.0],\n", " text_font: [p.Font, \"helvetica\"],\n", " text_font_size: [p.FontSizeScalar, \"16px\"],\n", " text_font_style: [p.FontStyleScalar, \"normal\"],\n", " text_align: [p.TextAlignScalar, \"left\"],\n", " text_baseline: [p.TextBaselineScalar, \"bottom\"],\n", " text_line_height: [p.NumberScalar, 1.2],\n", " };\n", " exports.LineVector = {\n", " line_color: [p.ColorSpec, \"black\"],\n", " line_alpha: [p.NumberSpec, 1.0],\n", " line_width: [p.NumberSpec, 1],\n", " line_join: [p.LineJoin, \"bevel\"],\n", " line_cap: [p.LineCap, \"butt\"],\n", " line_dash: [p.Array, []],\n", " line_dash_offset: [p.Number, 0],\n", " };\n", " exports.FillVector = {\n", " fill_color: [p.ColorSpec, \"gray\"],\n", " fill_alpha: [p.NumberSpec, 1.0],\n", " };\n", " exports.HatchVector = {\n", " hatch_color: [p.ColorSpec, \"black\"],\n", " hatch_alpha: [p.NumberSpec, 1.0],\n", " hatch_scale: [p.NumberSpec, 12.0],\n", " hatch_pattern: [p.NullStringSpec, null],\n", " hatch_weight: [p.NumberSpec, 1.0],\n", " hatch_extra: [p.Any, {}],\n", " };\n", " exports.TextVector = {\n", " text_color: [p.ColorSpec, \"#444444\"],\n", " text_alpha: [p.NumberSpec, 1.0],\n", " text_font: [p.Font, \"helvetica\"],\n", " text_font_size: [p.FontSizeSpec, \"16px\"],\n", " text_font_style: [p.FontStyle, \"normal\"],\n", " text_align: [p.TextAlign, \"left\"],\n", " text_baseline: [p.TextBaseline, \"bottom\"],\n", " text_line_height: [p.Number, 1.2],\n", " };\n", " },\n", " /* core/util/string.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const settings_1 = require(22) /* ../settings */;\n", " function startsWith(str, searchString, position = 0) {\n", " return str.substr(position, searchString.length) == searchString;\n", " }\n", " exports.startsWith = startsWith;\n", " function uuid4() {\n", " // from ipython project\n", " // http://www.ietf.org/rfc/rfc4122.txt\n", " const s = new Array(32);\n", " const hexDigits = \"0123456789ABCDEF\";\n", " for (let i = 0; i < 32; i++) {\n", " s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);\n", " }\n", " s[12] = \"4\"; // bits 12-15 of the time_hi_and_version field to 0010\n", " s[16] = hexDigits.substr((s[16].charCodeAt(0) & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01\n", " return s.join(\"\");\n", " }\n", " exports.uuid4 = uuid4;\n", " let counter = 1000;\n", " function uniqueId(prefix) {\n", " const id = settings_1.settings.dev ? `j${counter++}` : uuid4();\n", " if (prefix != null)\n", " return `${prefix}-${id}`;\n", " else\n", " return id;\n", " }\n", " exports.uniqueId = uniqueId;\n", " function escape(s) {\n", " return s.replace(/(?:[&<>\"'`])/g, (ch) => {\n", " switch (ch) {\n", " case '&': return '&';\n", " case '<': return '<';\n", " case '>': return '>';\n", " case '\"': return '"';\n", " case \"'\": return ''';\n", " case '`': return '`';\n", " default: return ch;\n", " }\n", " });\n", " }\n", " exports.escape = escape;\n", " function unescape(s) {\n", " return s.replace(/&(amp|lt|gt|quot|#x27|#x60);/g, (_, entity) => {\n", " switch (entity) {\n", " case 'amp': return '&';\n", " case 'lt': return '<';\n", " case 'gt': return '>';\n", " case 'quot': return '\"';\n", " case '#x27': return \"'\";\n", " case '#x60': return '`';\n", " default: return entity;\n", " }\n", " });\n", " }\n", " exports.unescape = unescape;\n", " function use_strict(code) {\n", " return `'use strict';\\n${code}`;\n", " }\n", " exports.use_strict = use_strict;\n", " },\n", " /* core/util/eq.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " // Underscore.js 1.8.3\n", " // http://underscorejs.org\n", " // (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n", " // Underscore may be freely distributed under the MIT license.\n", " const types_1 = require(8) /* ./types */;\n", " const toString = Object.prototype.toString;\n", " // Internal recursive comparison function for `isEqual`.\n", " function eq(a, b, aStack, bStack) {\n", " // Identical objects are equal. `0 === -0`, but they aren't identical.\n", " // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).\n", " if (a === b)\n", " return a !== 0 || 1 / a === 1 / b;\n", " // A strict comparison is necessary because `null == undefined`.\n", " if (a == null || b == null)\n", " return a === b;\n", " // Compare `[[Class]]` names.\n", " const className = toString.call(a);\n", " if (className !== toString.call(b))\n", " return false;\n", " switch (className) {\n", " // Strings, numbers, regular expressions, dates, and booleans are compared by value.\n", " case '[object RegExp]':\n", " // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')\n", " case '[object String]':\n", " // Primitives and their corresponding object wrappers are equivalent; thus, `\"5\"` is\n", " // equivalent to `new String(\"5\")`.\n", " return '' + a === '' + b;\n", " case '[object Number]':\n", " // `NaN`s are equivalent, but non-reflexive.\n", " // Object(NaN) is equivalent to NaN\n", " if (+a !== +a)\n", " return +b !== +b;\n", " // An `egal` comparison is performed for other numeric values.\n", " return +a === 0 ? 1 / +a === 1 / b : +a === +b;\n", " case '[object Date]':\n", " case '[object Boolean]':\n", " // Coerce dates and booleans to numeric primitive values. Dates are compared by their\n", " // millisecond representations. Note that invalid dates with millisecond representations\n", " // of `NaN` are not equivalent.\n", " return +a === +b;\n", " }\n", " const areArrays = className === '[object Array]';\n", " if (!areArrays) {\n", " if (typeof a != 'object' || typeof b != 'object')\n", " return false;\n", " // Objects with different constructors are not equivalent, but `Object`s or `Array`s\n", " // from different frames are.\n", " const aCtor = a.constructor, bCtor = b.constructor;\n", " if (aCtor !== bCtor && !(types_1.isFunction(aCtor) && aCtor instanceof aCtor &&\n", " types_1.isFunction(bCtor) && bCtor instanceof bCtor)\n", " && ('constructor' in a && 'constructor' in b)) {\n", " return false;\n", " }\n", " }\n", " // Assume equality for cyclic structures. The algorithm for detecting cyclic\n", " // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.\n", " // Initializing stack of traversed objects.\n", " // It's done here since we only need them for objects and arrays comparison.\n", " aStack = aStack || [];\n", " bStack = bStack || [];\n", " let length = aStack.length;\n", " while (length--) {\n", " // Linear search. Performance is inversely proportional to the number of\n", " // unique nested structures.\n", " if (aStack[length] === a)\n", " return bStack[length] === b;\n", " }\n", " // Add the first object to the stack of traversed objects.\n", " aStack.push(a);\n", " bStack.push(b);\n", " // Recursively compare objects and arrays.\n", " if (areArrays) {\n", " // Compare array lengths to determine if a deep comparison is necessary.\n", " length = a.length;\n", " if (length !== b.length)\n", " return false;\n", " // Deep compare the contents, ignoring non-numeric properties.\n", " while (length--) {\n", " if (!eq(a[length], b[length], aStack, bStack))\n", " return false;\n", " }\n", " }\n", " else {\n", " // Deep compare objects.\n", " const keys = Object.keys(a);\n", " let key;\n", " length = keys.length;\n", " // Ensure that both objects contain the same number of properties before comparing deep equality.\n", " if (Object.keys(b).length !== length)\n", " return false;\n", " while (length--) {\n", " // Deep compare each member\n", " key = keys[length];\n", " if (!(b.hasOwnProperty(key) && eq(a[key], b[key], aStack, bStack)))\n", " return false;\n", " }\n", " }\n", " // Remove the first object from the stack of traversed objects.\n", " aStack.pop();\n", " bStack.pop();\n", " return true;\n", " }\n", " // Perform a deep comparison to check if two objects are equal.\n", " function isEqual(a, b) {\n", " return eq(a, b);\n", " }\n", " exports.isEqual = isEqual;\n", " },\n", " /* core/util/ndarray.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const types_1 = require(8) /* ./types */;\n", " const assert_1 = require(11) /* ./assert */;\n", " const __ndarray__ = Symbol(\"__ndarray__\");\n", " class Uint8NDArray extends Uint8Array {\n", " constructor(seq, shape) {\n", " super(seq);\n", " this.__ndarray__ = __ndarray__;\n", " this.dtype = \"uint8\";\n", " this.shape = shape !== null && shape !== void 0 ? shape : [this.length];\n", " }\n", " }\n", " exports.Uint8NDArray = Uint8NDArray;\n", " Uint8NDArray.__name__ = \"Uint8NDArray\";\n", " class Int8NDArray extends Int8Array {\n", " constructor(seq, shape) {\n", " super(seq);\n", " this.__ndarray__ = __ndarray__;\n", " this.dtype = \"int8\";\n", " this.shape = shape !== null && shape !== void 0 ? shape : (is_NDArray(seq) ? seq.shape : [this.length]);\n", " }\n", " }\n", " exports.Int8NDArray = Int8NDArray;\n", " Int8NDArray.__name__ = \"Int8NDArray\";\n", " class Uint16NDArray extends Uint16Array {\n", " constructor(seq, shape) {\n", " super(seq);\n", " this.__ndarray__ = __ndarray__;\n", " this.dtype = \"uint16\";\n", " this.shape = shape !== null && shape !== void 0 ? shape : (is_NDArray(seq) ? seq.shape : [this.length]);\n", " }\n", " }\n", " exports.Uint16NDArray = Uint16NDArray;\n", " Uint16NDArray.__name__ = \"Uint16NDArray\";\n", " class Int16NDArray extends Int16Array {\n", " constructor(seq, shape) {\n", " super(seq);\n", " this.__ndarray__ = __ndarray__;\n", " this.dtype = \"int16\";\n", " this.shape = shape !== null && shape !== void 0 ? shape : (is_NDArray(seq) ? seq.shape : [this.length]);\n", " }\n", " }\n", " exports.Int16NDArray = Int16NDArray;\n", " Int16NDArray.__name__ = \"Int16NDArray\";\n", " class Uint32NDArray extends Uint32Array {\n", " constructor(seq, shape) {\n", " super(seq);\n", " this.__ndarray__ = __ndarray__;\n", " this.dtype = \"uint32\";\n", " this.shape = shape !== null && shape !== void 0 ? shape : (is_NDArray(seq) ? seq.shape : [this.length]);\n", " }\n", " }\n", " exports.Uint32NDArray = Uint32NDArray;\n", " Uint32NDArray.__name__ = \"Uint32NDArray\";\n", " class Int32NDArray extends Int32Array {\n", " constructor(seq, shape) {\n", " super(seq);\n", " this.__ndarray__ = __ndarray__;\n", " this.dtype = \"int32\";\n", " this.shape = shape !== null && shape !== void 0 ? shape : (is_NDArray(seq) ? seq.shape : [this.length]);\n", " }\n", " }\n", " exports.Int32NDArray = Int32NDArray;\n", " Int32NDArray.__name__ = \"Int32NDArray\";\n", " class Float32NDArray extends Float32Array {\n", " constructor(seq, shape) {\n", " super(seq);\n", " this.__ndarray__ = __ndarray__;\n", " this.dtype = \"float32\";\n", " this.shape = shape !== null && shape !== void 0 ? shape : (is_NDArray(seq) ? seq.shape : [this.length]);\n", " }\n", " }\n", " exports.Float32NDArray = Float32NDArray;\n", " Float32NDArray.__name__ = \"Float32NDArray\";\n", " class Float64NDArray extends Float64Array {\n", " constructor(seq, shape) {\n", " super(seq);\n", " this.__ndarray__ = __ndarray__;\n", " this.dtype = \"float64\";\n", " this.shape = shape !== null && shape !== void 0 ? shape : (is_NDArray(seq) ? seq.shape : [this.length]);\n", " }\n", " }\n", " exports.Float64NDArray = Float64NDArray;\n", " Float64NDArray.__name__ = \"Float64NDArray\";\n", " function is_NDArray(v) {\n", " return types_1.isObject(v) && v.__ndarray__ == __ndarray__;\n", " }\n", " exports.is_NDArray = is_NDArray;\n", " function ndarray(array, options = {}) {\n", " let { dtype } = options;\n", " if (dtype == null) {\n", " if (array instanceof ArrayBuffer || types_1.isArray(array)) {\n", " dtype = \"float64\";\n", " }\n", " else {\n", " dtype = (() => {\n", " switch (true) {\n", " case array instanceof Uint8Array: return \"uint8\";\n", " case array instanceof Int8Array: return \"int8\";\n", " case array instanceof Uint16Array: return \"uint16\";\n", " case array instanceof Int16Array: return \"int16\";\n", " case array instanceof Uint32Array: return \"uint32\";\n", " case array instanceof Int32Array: return \"int32\";\n", " case array instanceof Float32Array: return \"float32\";\n", " case array instanceof Float64Array: return \"float64\";\n", " default:\n", " assert_1.unreachable();\n", " }\n", " })();\n", " }\n", " }\n", " const { shape } = options;\n", " switch (dtype) {\n", " case \"uint8\": return new Uint8NDArray(array, shape);\n", " case \"int8\": return new Int8NDArray(array, shape);\n", " case \"uint16\": return new Uint16NDArray(array, shape);\n", " case \"int16\": return new Int16NDArray(array, shape);\n", " case \"uint32\": return new Uint32NDArray(array, shape);\n", " case \"int32\": return new Int32NDArray(array, shape);\n", " case \"float32\": return new Float32NDArray(array, shape);\n", " case \"float64\": return new Float64NDArray(array, shape);\n", " }\n", " }\n", " exports.ndarray = ndarray;\n", " },\n", " /* core/util/serialization.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const types_1 = require(8) /* ./types */;\n", " const compat_1 = require(28) /* ./compat */;\n", " const ndarray = tslib_1.__importStar(require(26) /* ./ndarray */);\n", " function buffer_to_base64(buffer) {\n", " const bytes = new Uint8Array(buffer);\n", " const chars = Array.from(bytes).map((b) => String.fromCharCode(b));\n", " return btoa(chars.join(\"\"));\n", " }\n", " exports.buffer_to_base64 = buffer_to_base64;\n", " function base64_to_buffer(base64) {\n", " const binary_string = atob(base64);\n", " const len = binary_string.length;\n", " const bytes = new Uint8Array(len);\n", " for (let i = 0, end = len; i < end; i++) {\n", " bytes[i] = binary_string.charCodeAt(i);\n", " }\n", " return bytes.buffer;\n", " }\n", " exports.base64_to_buffer = base64_to_buffer;\n", " exports.BYTE_ORDER = compat_1.is_little_endian ? \"little\" : \"big\";\n", " function swap16(a) {\n", " const x = new Uint8Array(a.buffer, a.byteOffset, a.length * 2);\n", " for (let i = 0, end = x.length; i < end; i += 2) {\n", " const t = x[i];\n", " x[i] = x[i + 1];\n", " x[i + 1] = t;\n", " }\n", " }\n", " exports.swap16 = swap16;\n", " function swap32(a) {\n", " const x = new Uint8Array(a.buffer, a.byteOffset, a.length * 4);\n", " for (let i = 0, end = x.length; i < end; i += 4) {\n", " let t = x[i];\n", " x[i] = x[i + 3];\n", " x[i + 3] = t;\n", " t = x[i + 1];\n", " x[i + 1] = x[i + 2];\n", " x[i + 2] = t;\n", " }\n", " }\n", " exports.swap32 = swap32;\n", " function swap64(a) {\n", " const x = new Uint8Array(a.buffer, a.byteOffset, a.length * 8);\n", " for (let i = 0, end = x.length; i < end; i += 8) {\n", " let t = x[i];\n", " x[i] = x[i + 7];\n", " x[i + 7] = t;\n", " t = x[i + 1];\n", " x[i + 1] = x[i + 6];\n", " x[i + 6] = t;\n", " t = x[i + 2];\n", " x[i + 2] = x[i + 5];\n", " x[i + 5] = t;\n", " t = x[i + 3];\n", " x[i + 3] = x[i + 4];\n", " x[i + 4] = t;\n", " }\n", " }\n", " exports.swap64 = swap64;\n", " function is_NDArray_ref(v) {\n", " return types_1.isPlainObject(v) && (\"__buffer__\" in v || \"__ndarray__\" in v);\n", " }\n", " exports.is_NDArray_ref = is_NDArray_ref;\n", " function decode_NDArray(ref, buffers) {\n", " const { shape, dtype, order } = ref;\n", " let bytes;\n", " if (\"__buffer__\" in ref) {\n", " const buffer = buffers.get(ref.__buffer__);\n", " if (buffer != null)\n", " bytes = buffer;\n", " else\n", " throw new Error(`buffer for ${ref.__buffer__} not found`);\n", " }\n", " else {\n", " bytes = base64_to_buffer(ref.__ndarray__);\n", " }\n", " const array = (() => {\n", " switch (dtype) {\n", " case \"uint8\": return new ndarray.Uint8NDArray(bytes, shape);\n", " case \"int8\": return new ndarray.Int8NDArray(bytes, shape);\n", " case \"uint16\": return new ndarray.Uint16NDArray(bytes, shape);\n", " case \"int16\": return new ndarray.Int16NDArray(bytes, shape);\n", " case \"uint32\": return new ndarray.Uint32NDArray(bytes, shape);\n", " case \"int32\": return new ndarray.Int32NDArray(bytes, shape);\n", " case \"float32\": return new ndarray.Float32NDArray(bytes, shape);\n", " case \"float64\": return new ndarray.Float64NDArray(bytes, shape);\n", " }\n", " })();\n", " if (order !== exports.BYTE_ORDER) {\n", " switch (array.BYTES_PER_ELEMENT) {\n", " case 2:\n", " swap16(array);\n", " break;\n", " case 4:\n", " swap32(array);\n", " break;\n", " case 8:\n", " swap64(array);\n", " break;\n", " }\n", " }\n", " return array;\n", " }\n", " exports.decode_NDArray = decode_NDArray;\n", " function encode_NDArray(array, buffers) {\n", " const data = {\n", " order: exports.BYTE_ORDER,\n", " dtype: array.dtype,\n", " shape: array.shape,\n", " };\n", " if (buffers != null) {\n", " const __buffer__ = `${buffers.size}`;\n", " buffers.set(__buffer__, array.buffer);\n", " return Object.assign({ __buffer__ }, data);\n", " }\n", " else {\n", " const __ndarray__ = buffer_to_base64(array.buffer);\n", " return Object.assign({ __ndarray__ }, data);\n", " }\n", " }\n", " exports.encode_NDArray = encode_NDArray;\n", " },\n", " /* core/util/compat.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.is_ie = (() => {\n", " const ua = typeof navigator !== \"undefined\" ? navigator.userAgent : \"\";\n", " return ua.indexOf('MSIE') >= 0 || ua.indexOf('Trident') > 0 || ua.indexOf('Edge') > 0;\n", " })();\n", " exports.is_mobile = (() => {\n", " return typeof window !== \"undefined\" && (\"ontouchstart\" in window || navigator.maxTouchPoints > 0);\n", " })();\n", " exports.is_little_endian = (() => {\n", " const buf = new ArrayBuffer(4);\n", " const buf8 = new Uint8Array(buf);\n", " const buf32 = new Uint32Array(buf);\n", " buf32[1] = 0x0a0b0c0d;\n", " let little_endian = true;\n", " if (buf8[4] == 0x0a && buf8[5] == 0x0b && buf8[6] == 0x0c && buf8[7] == 0x0d) {\n", " little_endian = false;\n", " }\n", " return little_endian;\n", " })();\n", " },\n", " /* models/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " tslib_1.__exportStar(require(30) /* ./annotations */, exports);\n", " tslib_1.__exportStar(require(149) /* ./axes */, exports);\n", " tslib_1.__exportStar(require(176) /* ./callbacks */, exports);\n", " tslib_1.__exportStar(require(180) /* ./canvas */, exports);\n", " tslib_1.__exportStar(require(194) /* ./expressions */, exports);\n", " tslib_1.__exportStar(require(198) /* ./filters */, exports);\n", " tslib_1.__exportStar(require(204) /* ./formatters */, exports);\n", " tslib_1.__exportStar(require(208) /* ./glyphs */, exports);\n", " tslib_1.__exportStar(require(238) /* ./graphs */, exports);\n", " tslib_1.__exportStar(require(241) /* ./grids */, exports);\n", " tslib_1.__exportStar(require(243) /* ./layouts */, exports);\n", " tslib_1.__exportStar(require(260) /* ./mappers */, exports);\n", " tslib_1.__exportStar(require(123) /* ./transforms */, exports);\n", " tslib_1.__exportStar(require(266) /* ./markers */, exports);\n", " tslib_1.__exportStar(require(270) /* ./plots */, exports);\n", " tslib_1.__exportStar(require(297) /* ./ranges */, exports);\n", " tslib_1.__exportStar(require(298) /* ./renderers */, exports);\n", " tslib_1.__exportStar(require(299) /* ./scales */, exports);\n", " tslib_1.__exportStar(require(300) /* ./selections */, exports);\n", " tslib_1.__exportStar(require(301) /* ./sources */, exports);\n", " tslib_1.__exportStar(require(306) /* ./tickers */, exports);\n", " tslib_1.__exportStar(require(308) /* ./tiles */, exports);\n", " tslib_1.__exportStar(require(319) /* ./textures */, exports);\n", " tslib_1.__exportStar(require(323) /* ./tools */, exports);\n", " },\n", " /* models/annotations/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var annotation_1 = require(31) /* ./annotation */;\n", " exports.Annotation = annotation_1.Annotation;\n", " var arrow_1 = require(74) /* ./arrow */;\n", " exports.Arrow = arrow_1.Arrow;\n", " var arrow_head_1 = require(75) /* ./arrow_head */;\n", " exports.ArrowHead = arrow_head_1.ArrowHead;\n", " var arrow_head_2 = require(75) /* ./arrow_head */;\n", " exports.OpenHead = arrow_head_2.OpenHead;\n", " var arrow_head_3 = require(75) /* ./arrow_head */;\n", " exports.NormalHead = arrow_head_3.NormalHead;\n", " var arrow_head_4 = require(75) /* ./arrow_head */;\n", " exports.TeeHead = arrow_head_4.TeeHead;\n", " var arrow_head_5 = require(75) /* ./arrow_head */;\n", " exports.VeeHead = arrow_head_5.VeeHead;\n", " var band_1 = require(106) /* ./band */;\n", " exports.Band = band_1.Band;\n", " var box_annotation_1 = require(107) /* ./box_annotation */;\n", " exports.BoxAnnotation = box_annotation_1.BoxAnnotation;\n", " var color_bar_1 = require(108) /* ./color_bar */;\n", " exports.ColorBar = color_bar_1.ColorBar;\n", " var label_1 = require(133) /* ./label */;\n", " exports.Label = label_1.Label;\n", " var label_set_1 = require(135) /* ./label_set */;\n", " exports.LabelSet = label_set_1.LabelSet;\n", " var legend_1 = require(136) /* ./legend */;\n", " exports.Legend = legend_1.Legend;\n", " var legend_item_1 = require(137) /* ./legend_item */;\n", " exports.LegendItem = legend_item_1.LegendItem;\n", " var poly_annotation_1 = require(139) /* ./poly_annotation */;\n", " exports.PolyAnnotation = poly_annotation_1.PolyAnnotation;\n", " var slope_1 = require(140) /* ./slope */;\n", " exports.Slope = slope_1.Slope;\n", " var span_1 = require(141) /* ./span */;\n", " exports.Span = span_1.Span;\n", " var text_annotation_1 = require(134) /* ./text_annotation */;\n", " exports.TextAnnotation = text_annotation_1.TextAnnotation;\n", " var title_1 = require(142) /* ./title */;\n", " exports.Title = title_1.Title;\n", " var toolbar_panel_1 = require(143) /* ./toolbar_panel */;\n", " exports.ToolbarPanel = toolbar_panel_1.ToolbarPanel;\n", " var tooltip_1 = require(144) /* ./tooltip */;\n", " exports.Tooltip = tooltip_1.Tooltip;\n", " var whisker_1 = require(148) /* ./whisker */;\n", " exports.Whisker = whisker_1.Whisker;\n", " },\n", " /* models/annotations/annotation.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const proj = tslib_1.__importStar(require(32) /* ../../core/util/projections */);\n", " const object_1 = require(17) /* ../../core/util/object */;\n", " const renderer_1 = require(65) /* ../renderers/renderer */;\n", " const annotations_css_1 = tslib_1.__importDefault(require(73) /* ../../styles/annotations.css */);\n", " class AnnotationView extends renderer_1.RendererView {\n", " get panel() {\n", " return this.layout;\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " const p = this.model.properties;\n", " this.on_change(p.visible, () => this.plot_view.request_layout());\n", " }\n", " styles() {\n", " return [...super.styles(), annotations_css_1.default];\n", " }\n", " get_size() {\n", " if (this.model.visible) {\n", " const { width, height } = this._get_size();\n", " return { width: Math.round(width), height: Math.round(height) };\n", " }\n", " else\n", " return { width: 0, height: 0 };\n", " }\n", " _get_size() {\n", " throw new Error(\"not implemented\");\n", " }\n", " set_data(source) {\n", " const data = this.model.materialize_dataspecs(source);\n", " object_1.extend(this, data);\n", " if (this.plot_model.use_map) {\n", " const self = this;\n", " if (self._x != null)\n", " [self._x, self._y] = proj.project_xy(self._x, self._y);\n", " if (self._xs != null)\n", " [self._xs, self._ys] = proj.project_xsys(self._xs, self._ys);\n", " }\n", " }\n", " get needs_clip() {\n", " return this.layout == null; // TODO: change this, when center layout is fully implemented\n", " }\n", " serializable_state() {\n", " const state = super.serializable_state();\n", " return this.layout == null ? state : Object.assign(Object.assign({}, state), { bbox: this.layout.bbox.box });\n", " }\n", " }\n", " exports.AnnotationView = AnnotationView;\n", " AnnotationView.__name__ = \"AnnotationView\";\n", " class Annotation extends renderer_1.Renderer {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Annotation() {\n", " this.override({\n", " level: 'annotation',\n", " });\n", " }\n", " }\n", " exports.Annotation = Annotation;\n", " Annotation.__name__ = \"Annotation\";\n", " Annotation.init_Annotation();\n", " },\n", " /* core/util/projections.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const core_1 = tslib_1.__importDefault(require(33) /* proj4/lib/core */);\n", " const Proj_1 = tslib_1.__importDefault(require(34) /* proj4/lib/Proj */);\n", " const mercator = new Proj_1.default('GOOGLE');\n", " const wgs84 = new Proj_1.default('WGS84');\n", " exports.wgs84_mercator = core_1.default(wgs84, mercator);\n", " const mercator_bounds = {\n", " lon: [-20026376.39, 20026376.39],\n", " lat: [-20048966.10, 20048966.10],\n", " };\n", " const latlon_bounds = {\n", " lon: [-180, 180],\n", " lat: [-85.06, 85.06],\n", " };\n", " function clip_mercator(low, high, dimension) {\n", " const [min, max] = mercator_bounds[dimension];\n", " return [Math.max(low, min), Math.min(high, max)];\n", " }\n", " exports.clip_mercator = clip_mercator;\n", " function in_bounds(value, dimension) {\n", " const [min, max] = latlon_bounds[dimension];\n", " return min < value && value < max;\n", " }\n", " exports.in_bounds = in_bounds;\n", " function project_xy(x, y) {\n", " const n = Math.min(x.length, y.length);\n", " const merc_x_s = new Array(n);\n", " const merc_y_s = new Array(n);\n", " for (let i = 0; i < n; i++) {\n", " const [merc_x, merc_y] = exports.wgs84_mercator.forward([x[i], y[i]]);\n", " merc_x_s[i] = merc_x;\n", " merc_y_s[i] = merc_y;\n", " }\n", " return [merc_x_s, merc_y_s];\n", " }\n", " exports.project_xy = project_xy;\n", " function project_xsys(xs, ys) {\n", " const n = Math.min(xs.length, ys.length);\n", " const merc_xs_s = new Array(n);\n", " const merc_ys_s = new Array(n);\n", " for (let i = 0; i < n; i++) {\n", " const [merc_x_s, merc_y_s] = project_xy(xs[i], ys[i]);\n", " merc_xs_s[i] = merc_x_s;\n", " merc_ys_s[i] = merc_y_s;\n", " }\n", " return [merc_xs_s, merc_ys_s];\n", " }\n", " exports.project_xsys = project_xsys;\n", " },\n", " /* proj4/lib/core.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const Proj_1 = tslib_1.__importDefault(require(34) /* ./Proj */);\n", " const transform_1 = tslib_1.__importDefault(require(59) /* ./transform */);\n", " var wgs84 = Proj_1.default('WGS84');\n", " function transformer(from, to, coords) {\n", " var transformedArray, out, keys;\n", " if (Array.isArray(coords)) {\n", " transformedArray = transform_1.default(from, to, coords) || { x: NaN, y: NaN };\n", " if (coords.length > 2) {\n", " if ((typeof from.name !== 'undefined' && from.name === 'geocent') || (typeof to.name !== 'undefined' && to.name === 'geocent')) {\n", " if (typeof transformedArray.z === 'number') {\n", " return [transformedArray.x, transformedArray.y, transformedArray.z].concat(coords.splice(3));\n", " }\n", " else {\n", " return [transformedArray.x, transformedArray.y, coords[2]].concat(coords.splice(3));\n", " }\n", " }\n", " else {\n", " return [transformedArray.x, transformedArray.y].concat(coords.splice(2));\n", " }\n", " }\n", " else {\n", " return [transformedArray.x, transformedArray.y];\n", " }\n", " }\n", " else {\n", " out = transform_1.default(from, to, coords);\n", " keys = Object.keys(coords);\n", " if (keys.length === 2) {\n", " return out;\n", " }\n", " keys.forEach(function (key) {\n", " if ((typeof from.name !== 'undefined' && from.name === 'geocent') || (typeof to.name !== 'undefined' && to.name === 'geocent')) {\n", " if (key === 'x' || key === 'y' || key === 'z') {\n", " return;\n", " }\n", " }\n", " else {\n", " if (key === 'x' || key === 'y') {\n", " return;\n", " }\n", " }\n", " out[key] = coords[key];\n", " });\n", " return out;\n", " }\n", " }\n", " function checkProj(item) {\n", " if (item instanceof Proj_1.default) {\n", " return item;\n", " }\n", " if (item.oProj) {\n", " return item.oProj;\n", " }\n", " return Proj_1.default(item);\n", " }\n", " function proj4(fromProj, toProj, coord) {\n", " fromProj = checkProj(fromProj);\n", " var single = false;\n", " var obj;\n", " if (typeof toProj === 'undefined') {\n", " toProj = fromProj;\n", " fromProj = wgs84;\n", " single = true;\n", " }\n", " else if (typeof toProj.x !== 'undefined' || Array.isArray(toProj)) {\n", " coord = toProj;\n", " toProj = fromProj;\n", " fromProj = wgs84;\n", " single = true;\n", " }\n", " toProj = checkProj(toProj);\n", " if (coord) {\n", " return transformer(fromProj, toProj, coord);\n", " }\n", " else {\n", " obj = {\n", " forward: function (coords) {\n", " return transformer(fromProj, toProj, coords);\n", " },\n", " inverse: function (coords) {\n", " return transformer(toProj, fromProj, coords);\n", " }\n", " };\n", " if (single) {\n", " obj.oProj = toProj;\n", " }\n", " return obj;\n", " }\n", " }\n", " exports.default = proj4;\n", " },\n", " /* proj4/lib/Proj.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const parseCode_1 = tslib_1.__importDefault(require(35) /* ./parseCode */);\n", " const extend_1 = tslib_1.__importDefault(require(46) /* ./extend */);\n", " const projections_1 = tslib_1.__importDefault(require(47) /* ./projections */);\n", " const deriveConstants_1 = require(55) /* ./deriveConstants */;\n", " const Datum_1 = tslib_1.__importDefault(require(57) /* ./constants/Datum */);\n", " const datum_1 = tslib_1.__importDefault(require(58) /* ./datum */);\n", " const match_1 = tslib_1.__importDefault(require(42) /* ./match */);\n", " function Projection(srsCode, callback) {\n", " if (!(this instanceof Projection)) {\n", " return new Projection(srsCode);\n", " }\n", " callback = callback || function (error) {\n", " if (error) {\n", " throw error;\n", " }\n", " };\n", " var json = parseCode_1.default(srsCode);\n", " if (typeof json !== 'object') {\n", " callback(srsCode);\n", " return;\n", " }\n", " var ourProj = Projection.projections.get(json.projName);\n", " if (!ourProj) {\n", " callback(srsCode);\n", " return;\n", " }\n", " if (json.datumCode && json.datumCode !== 'none') {\n", " var datumDef = match_1.default(Datum_1.default, json.datumCode);\n", " if (datumDef) {\n", " json.datum_params = datumDef.towgs84 ? datumDef.towgs84.split(',') : null;\n", " json.ellps = datumDef.ellipse;\n", " json.datumName = datumDef.datumName ? datumDef.datumName : json.datumCode;\n", " }\n", " }\n", " json.k0 = json.k0 || 1.0;\n", " json.axis = json.axis || 'enu';\n", " json.ellps = json.ellps || 'wgs84';\n", " var sphere_ = deriveConstants_1.sphere(json.a, json.b, json.rf, json.ellps, json.sphere);\n", " var ecc = deriveConstants_1.eccentricity(sphere_.a, sphere_.b, sphere_.rf, json.R_A);\n", " var datumObj = json.datum || datum_1.default(json.datumCode, json.datum_params, sphere_.a, sphere_.b, ecc.es, ecc.ep2);\n", " extend_1.default(this, json); // transfer everything over from the projection because we don't know what we'll need\n", " extend_1.default(this, ourProj); // transfer all the methods from the projection\n", " // copy the 4 things over we calulated in deriveConstants.sphere\n", " this.a = sphere_.a;\n", " this.b = sphere_.b;\n", " this.rf = sphere_.rf;\n", " this.sphere = sphere_.sphere;\n", " // copy the 3 things we calculated in deriveConstants.eccentricity\n", " this.es = ecc.es;\n", " this.e = ecc.e;\n", " this.ep2 = ecc.ep2;\n", " // add in the datum object\n", " this.datum = datumObj;\n", " // init the projection\n", " this.init();\n", " // legecy callback from back in the day when it went to spatialreference.org\n", " callback(null, this);\n", " }\n", " Projection.projections = projections_1.default;\n", " Projection.projections.start();\n", " exports.default = Projection;\n", " },\n", " /* proj4/lib/parseCode.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const defs_1 = tslib_1.__importDefault(require(36) /* ./defs */);\n", " const wkt_parser_1 = tslib_1.__importDefault(require(43) /* wkt-parser */);\n", " const projString_1 = tslib_1.__importDefault(require(38) /* ./projString */);\n", " const match_1 = tslib_1.__importDefault(require(42) /* ./match */);\n", " function testObj(code) {\n", " return typeof code === 'string';\n", " }\n", " function testDef(code) {\n", " return code in defs_1.default;\n", " }\n", " var codeWords = ['PROJECTEDCRS', 'PROJCRS', 'GEOGCS', 'GEOCCS', 'PROJCS', 'LOCAL_CS', 'GEODCRS', 'GEODETICCRS', 'GEODETICDATUM', 'ENGCRS', 'ENGINEERINGCRS'];\n", " function testWKT(code) {\n", " return codeWords.some(function (word) {\n", " return code.indexOf(word) > -1;\n", " });\n", " }\n", " var codes = ['3857', '900913', '3785', '102113'];\n", " function checkMercator(item) {\n", " var auth = match_1.default(item, 'authority');\n", " if (!auth) {\n", " return;\n", " }\n", " var code = match_1.default(auth, 'epsg');\n", " return code && codes.indexOf(code) > -1;\n", " }\n", " function checkProjStr(item) {\n", " var ext = match_1.default(item, 'extension');\n", " if (!ext) {\n", " return;\n", " }\n", " return match_1.default(ext, 'proj4');\n", " }\n", " function testProj(code) {\n", " return code[0] === '+';\n", " }\n", " function parse(code) {\n", " if (testObj(code)) {\n", " //check to see if this is a WKT string\n", " if (testDef(code)) {\n", " return defs_1.default[code];\n", " }\n", " if (testWKT(code)) {\n", " var out = wkt_parser_1.default(code);\n", " // test of spetial case, due to this being a very common and often malformed\n", " if (checkMercator(out)) {\n", " return defs_1.default['EPSG:3857'];\n", " }\n", " var maybeProjStr = checkProjStr(out);\n", " if (maybeProjStr) {\n", " return projString_1.default(maybeProjStr);\n", " }\n", " return out;\n", " }\n", " if (testProj(code)) {\n", " return projString_1.default(code);\n", " }\n", " }\n", " else {\n", " return code;\n", " }\n", " }\n", " exports.default = parse;\n", " },\n", " /* proj4/lib/defs.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const global_1 = tslib_1.__importDefault(require(37) /* ./global */);\n", " const projString_1 = tslib_1.__importDefault(require(38) /* ./projString */);\n", " const wkt_parser_1 = tslib_1.__importDefault(require(43) /* wkt-parser */);\n", " function defs(name) {\n", " /*global console*/\n", " var that = this;\n", " if (arguments.length === 2) {\n", " var def = arguments[1];\n", " if (typeof def === 'string') {\n", " if (def.charAt(0) === '+') {\n", " defs[name] = projString_1.default(arguments[1]);\n", " }\n", " else {\n", " defs[name] = wkt_parser_1.default(arguments[1]);\n", " }\n", " }\n", " else {\n", " defs[name] = def;\n", " }\n", " }\n", " else if (arguments.length === 1) {\n", " if (Array.isArray(name)) {\n", " return name.map(function (v) {\n", " if (Array.isArray(v)) {\n", " defs.apply(that, v);\n", " }\n", " else {\n", " defs(v);\n", " }\n", " });\n", " }\n", " else if (typeof name === 'string') {\n", " if (name in defs) {\n", " return defs[name];\n", " }\n", " }\n", " else if ('EPSG' in name) {\n", " defs['EPSG:' + name.EPSG] = name;\n", " }\n", " else if ('ESRI' in name) {\n", " defs['ESRI:' + name.ESRI] = name;\n", " }\n", " else if ('IAU2000' in name) {\n", " defs['IAU2000:' + name.IAU2000] = name;\n", " }\n", " else {\n", " console.log(name);\n", " }\n", " return;\n", " }\n", " }\n", " global_1.default(defs);\n", " exports.default = defs;\n", " },\n", " /* proj4/lib/global.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " function default_1(defs) {\n", " defs('EPSG:4326', \"+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees\");\n", " defs('EPSG:4269', \"+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees\");\n", " defs('EPSG:3857', \"+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs\");\n", " defs.WGS84 = defs['EPSG:4326'];\n", " defs['EPSG:3785'] = defs['EPSG:3857']; // maintain backward compat, official code is 3857\n", " defs.GOOGLE = defs['EPSG:3857'];\n", " defs['EPSG:900913'] = defs['EPSG:3857'];\n", " defs['EPSG:102113'] = defs['EPSG:3857'];\n", " }\n", " exports.default = default_1;\n", " },\n", " /* proj4/lib/projString.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const values_1 = require(39) /* ./constants/values */;\n", " const PrimeMeridian_1 = tslib_1.__importDefault(require(40) /* ./constants/PrimeMeridian */);\n", " const units_1 = tslib_1.__importDefault(require(41) /* ./constants/units */);\n", " const match_1 = tslib_1.__importDefault(require(42) /* ./match */);\n", " function default_1(defData) {\n", " var self = {};\n", " var paramObj = defData.split('+').map(function (v) {\n", " return v.trim();\n", " }).filter(function (a) {\n", " return a;\n", " }).reduce(function (p, a) {\n", " var split = a.split('=');\n", " split.push(true);\n", " p[split[0].toLowerCase()] = split[1];\n", " return p;\n", " }, {});\n", " var paramName, paramVal, paramOutname;\n", " var params = {\n", " proj: 'projName',\n", " datum: 'datumCode',\n", " rf: function (v) {\n", " self.rf = parseFloat(v);\n", " },\n", " lat_0: function (v) {\n", " self.lat0 = v * values_1.D2R;\n", " },\n", " lat_1: function (v) {\n", " self.lat1 = v * values_1.D2R;\n", " },\n", " lat_2: function (v) {\n", " self.lat2 = v * values_1.D2R;\n", " },\n", " lat_ts: function (v) {\n", " self.lat_ts = v * values_1.D2R;\n", " },\n", " lon_0: function (v) {\n", " self.long0 = v * values_1.D2R;\n", " },\n", " lon_1: function (v) {\n", " self.long1 = v * values_1.D2R;\n", " },\n", " lon_2: function (v) {\n", " self.long2 = v * values_1.D2R;\n", " },\n", " alpha: function (v) {\n", " self.alpha = parseFloat(v) * values_1.D2R;\n", " },\n", " lonc: function (v) {\n", " self.longc = v * values_1.D2R;\n", " },\n", " x_0: function (v) {\n", " self.x0 = parseFloat(v);\n", " },\n", " y_0: function (v) {\n", " self.y0 = parseFloat(v);\n", " },\n", " k_0: function (v) {\n", " self.k0 = parseFloat(v);\n", " },\n", " k: function (v) {\n", " self.k0 = parseFloat(v);\n", " },\n", " a: function (v) {\n", " self.a = parseFloat(v);\n", " },\n", " b: function (v) {\n", " self.b = parseFloat(v);\n", " },\n", " r_a: function () {\n", " self.R_A = true;\n", " },\n", " zone: function (v) {\n", " self.zone = parseInt(v, 10);\n", " },\n", " south: function () {\n", " self.utmSouth = true;\n", " },\n", " towgs84: function (v) {\n", " self.datum_params = v.split(\",\").map(function (a) {\n", " return parseFloat(a);\n", " });\n", " },\n", " to_meter: function (v) {\n", " self.to_meter = parseFloat(v);\n", " },\n", " units: function (v) {\n", " self.units = v;\n", " var unit = match_1.default(units_1.default, v);\n", " if (unit) {\n", " self.to_meter = unit.to_meter;\n", " }\n", " },\n", " from_greenwich: function (v) {\n", " self.from_greenwich = v * values_1.D2R;\n", " },\n", " pm: function (v) {\n", " var pm = match_1.default(PrimeMeridian_1.default, v);\n", " self.from_greenwich = (pm ? pm : parseFloat(v)) * values_1.D2R;\n", " },\n", " nadgrids: function (v) {\n", " if (v === '@null') {\n", " self.datumCode = 'none';\n", " }\n", " else {\n", " self.nadgrids = v;\n", " }\n", " },\n", " axis: function (v) {\n", " var legalAxis = \"ewnsud\";\n", " if (v.length === 3 && legalAxis.indexOf(v.substr(0, 1)) !== -1 && legalAxis.indexOf(v.substr(1, 1)) !== -1 && legalAxis.indexOf(v.substr(2, 1)) !== -1) {\n", " self.axis = v;\n", " }\n", " }\n", " };\n", " for (paramName in paramObj) {\n", " paramVal = paramObj[paramName];\n", " if (paramName in params) {\n", " paramOutname = params[paramName];\n", " if (typeof paramOutname === 'function') {\n", " paramOutname(paramVal);\n", " }\n", " else {\n", " self[paramOutname] = paramVal;\n", " }\n", " }\n", " else {\n", " self[paramName] = paramVal;\n", " }\n", " }\n", " if (typeof self.datumCode === 'string' && self.datumCode !== \"WGS84\") {\n", " self.datumCode = self.datumCode.toLowerCase();\n", " }\n", " return self;\n", " }\n", " exports.default = default_1;\n", " },\n", " /* proj4/lib/constants/values.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.PJD_3PARAM = 1;\n", " exports.PJD_7PARAM = 2;\n", " exports.PJD_WGS84 = 4; // WGS84 or equivalent\n", " exports.PJD_NODATUM = 5; // WGS84 or equivalent\n", " exports.SEC_TO_RAD = 4.84813681109535993589914102357e-6;\n", " exports.HALF_PI = Math.PI / 2;\n", " // ellipoid pj_set_ell.c\n", " exports.SIXTH = 0.1666666666666666667;\n", " /* 1/6 */\n", " exports.RA4 = 0.04722222222222222222;\n", " /* 17/360 */\n", " exports.RA6 = 0.02215608465608465608;\n", " exports.EPSLN = 1.0e-10;\n", " // you'd think you could use Number.EPSILON above but that makes\n", " // Mollweide get into an infinate loop.\n", " exports.D2R = 0.01745329251994329577;\n", " exports.R2D = 57.29577951308232088;\n", " exports.FORTPI = Math.PI / 4;\n", " exports.TWO_PI = Math.PI * 2;\n", " // SPI is slightly greater than Math.PI, so values that exceed the -180..180\n", " // degree range by a tiny amount don't get wrapped. This prevents points that\n", " // have drifted from their original location along the 180th meridian (due to\n", " // floating point error) from changing their sign.\n", " exports.SPI = 3.14159265359;\n", " },\n", " /* proj4/lib/constants/PrimeMeridian.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var exports$1 = {};\n", " exports.default = exports$1;\n", " exports$1.greenwich = 0.0; //\"0dE\",\n", " exports$1.lisbon = -9.131906111111; //\"9d07'54.862\\\"W\",\n", " exports$1.paris = 2.337229166667; //\"2d20'14.025\\\"E\",\n", " exports$1.bogota = -74.080916666667; //\"74d04'51.3\\\"W\",\n", " exports$1.madrid = -3.687938888889; //\"3d41'16.58\\\"W\",\n", " exports$1.rome = 12.452333333333; //\"12d27'8.4\\\"E\",\n", " exports$1.bern = 7.439583333333; //\"7d26'22.5\\\"E\",\n", " exports$1.jakarta = 106.807719444444; //\"106d48'27.79\\\"E\",\n", " exports$1.ferro = -17.666666666667; //\"17d40'W\",\n", " exports$1.brussels = 4.367975; //\"4d22'4.71\\\"E\",\n", " exports$1.stockholm = 18.058277777778; //\"18d3'29.8\\\"E\",\n", " exports$1.athens = 23.7163375; //\"23d42'58.815\\\"E\",\n", " exports$1.oslo = 10.722916666667; //\"10d43'22.5\\\"E\"\n", " },\n", " /* proj4/lib/constants/units.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.default = {\n", " ft: { to_meter: 0.3048 },\n", " 'us-ft': { to_meter: 1200 / 3937 }\n", " };\n", " },\n", " /* proj4/lib/match.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var ignoredChar = /[\\s_\\-\\/\\(\\)]/g;\n", " function match(obj, key) {\n", " if (obj[key]) {\n", " return obj[key];\n", " }\n", " var keys = Object.keys(obj);\n", " var lkey = key.toLowerCase().replace(ignoredChar, '');\n", " var i = -1;\n", " var testkey, processedKey;\n", " while (++i < keys.length) {\n", " testkey = keys[i];\n", " processedKey = testkey.toLowerCase().replace(ignoredChar, '');\n", " if (processedKey === lkey) {\n", " return obj[testkey];\n", " }\n", " }\n", " }\n", " exports.default = match;\n", " },\n", " /* wkt-parser/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " var D2R = 0.01745329251994329577;\n", " const parser_1 = tslib_1.__importDefault(require(44) /* ./parser */);\n", " const process_1 = require(45) /* ./process */;\n", " function rename(obj, params) {\n", " var outName = params[0];\n", " var inName = params[1];\n", " if (!(outName in obj) && (inName in obj)) {\n", " obj[outName] = obj[inName];\n", " if (params.length === 3) {\n", " obj[outName] = params[2](obj[outName]);\n", " }\n", " }\n", " }\n", " function d2r(input) {\n", " return input * D2R;\n", " }\n", " function cleanWKT(wkt) {\n", " if (wkt.type === 'GEOGCS') {\n", " wkt.projName = 'longlat';\n", " }\n", " else if (wkt.type === 'LOCAL_CS') {\n", " wkt.projName = 'identity';\n", " wkt.local = true;\n", " }\n", " else {\n", " if (typeof wkt.PROJECTION === 'object') {\n", " wkt.projName = Object.keys(wkt.PROJECTION)[0];\n", " }\n", " else {\n", " wkt.projName = wkt.PROJECTION;\n", " }\n", " }\n", " if (wkt.AXIS) {\n", " var axisOrder = '';\n", " for (var i = 0, ii = wkt.AXIS.length; i < ii; ++i) {\n", " var axis = wkt.AXIS[i];\n", " var descriptor = axis[0].toLowerCase();\n", " if (descriptor.indexOf('north') !== -1) {\n", " axisOrder += 'n';\n", " }\n", " else if (descriptor.indexOf('south') !== -1) {\n", " axisOrder += 's';\n", " }\n", " else if (descriptor.indexOf('east') !== -1) {\n", " axisOrder += 'e';\n", " }\n", " else if (descriptor.indexOf('west') !== -1) {\n", " axisOrder += 'w';\n", " }\n", " }\n", " if (axisOrder.length === 2) {\n", " axisOrder += 'u';\n", " }\n", " if (axisOrder.length === 3) {\n", " wkt.axis = axisOrder;\n", " }\n", " }\n", " if (wkt.UNIT) {\n", " wkt.units = wkt.UNIT.name.toLowerCase();\n", " if (wkt.units === 'metre') {\n", " wkt.units = 'meter';\n", " }\n", " if (wkt.UNIT.convert) {\n", " if (wkt.type === 'GEOGCS') {\n", " if (wkt.DATUM && wkt.DATUM.SPHEROID) {\n", " wkt.to_meter = wkt.UNIT.convert * wkt.DATUM.SPHEROID.a;\n", " }\n", " }\n", " else {\n", " wkt.to_meter = wkt.UNIT.convert;\n", " }\n", " }\n", " }\n", " var geogcs = wkt.GEOGCS;\n", " if (wkt.type === 'GEOGCS') {\n", " geogcs = wkt;\n", " }\n", " if (geogcs) {\n", " //if(wkt.GEOGCS.PRIMEM&&wkt.GEOGCS.PRIMEM.convert){\n", " // wkt.from_greenwich=wkt.GEOGCS.PRIMEM.convert*D2R;\n", " //}\n", " if (geogcs.DATUM) {\n", " wkt.datumCode = geogcs.DATUM.name.toLowerCase();\n", " }\n", " else {\n", " wkt.datumCode = geogcs.name.toLowerCase();\n", " }\n", " if (wkt.datumCode.slice(0, 2) === 'd_') {\n", " wkt.datumCode = wkt.datumCode.slice(2);\n", " }\n", " if (wkt.datumCode === 'new_zealand_geodetic_datum_1949' || wkt.datumCode === 'new_zealand_1949') {\n", " wkt.datumCode = 'nzgd49';\n", " }\n", " if (wkt.datumCode === 'wgs_1984' || wkt.datumCode === 'world_geodetic_system_1984') {\n", " if (wkt.PROJECTION === 'Mercator_Auxiliary_Sphere') {\n", " wkt.sphere = true;\n", " }\n", " wkt.datumCode = 'wgs84';\n", " }\n", " if (wkt.datumCode.slice(-6) === '_ferro') {\n", " wkt.datumCode = wkt.datumCode.slice(0, -6);\n", " }\n", " if (wkt.datumCode.slice(-8) === '_jakarta') {\n", " wkt.datumCode = wkt.datumCode.slice(0, -8);\n", " }\n", " if (~wkt.datumCode.indexOf('belge')) {\n", " wkt.datumCode = 'rnb72';\n", " }\n", " if (geogcs.DATUM && geogcs.DATUM.SPHEROID) {\n", " wkt.ellps = geogcs.DATUM.SPHEROID.name.replace('_19', '').replace(/[Cc]larke\\_18/, 'clrk');\n", " if (wkt.ellps.toLowerCase().slice(0, 13) === 'international') {\n", " wkt.ellps = 'intl';\n", " }\n", " wkt.a = geogcs.DATUM.SPHEROID.a;\n", " wkt.rf = parseFloat(geogcs.DATUM.SPHEROID.rf, 10);\n", " }\n", " if (geogcs.DATUM && geogcs.DATUM.TOWGS84) {\n", " wkt.datum_params = geogcs.DATUM.TOWGS84;\n", " }\n", " if (~wkt.datumCode.indexOf('osgb_1936')) {\n", " wkt.datumCode = 'osgb36';\n", " }\n", " if (~wkt.datumCode.indexOf('osni_1952')) {\n", " wkt.datumCode = 'osni52';\n", " }\n", " if (~wkt.datumCode.indexOf('tm65')\n", " || ~wkt.datumCode.indexOf('geodetic_datum_of_1965')) {\n", " wkt.datumCode = 'ire65';\n", " }\n", " if (wkt.datumCode === 'ch1903+') {\n", " wkt.datumCode = 'ch1903';\n", " }\n", " if (~wkt.datumCode.indexOf('israel')) {\n", " wkt.datumCode = 'isr93';\n", " }\n", " }\n", " if (wkt.b && !isFinite(wkt.b)) {\n", " wkt.b = wkt.a;\n", " }\n", " function toMeter(input) {\n", " var ratio = wkt.to_meter || 1;\n", " return input * ratio;\n", " }\n", " var renamer = function (a) {\n", " return rename(wkt, a);\n", " };\n", " var list = [\n", " ['standard_parallel_1', 'Standard_Parallel_1'],\n", " ['standard_parallel_2', 'Standard_Parallel_2'],\n", " ['false_easting', 'False_Easting'],\n", " ['false_northing', 'False_Northing'],\n", " ['central_meridian', 'Central_Meridian'],\n", " ['latitude_of_origin', 'Latitude_Of_Origin'],\n", " ['latitude_of_origin', 'Central_Parallel'],\n", " ['scale_factor', 'Scale_Factor'],\n", " ['k0', 'scale_factor'],\n", " ['latitude_of_center', 'Latitude_Of_Center'],\n", " ['latitude_of_center', 'Latitude_of_center'],\n", " ['lat0', 'latitude_of_center', d2r],\n", " ['longitude_of_center', 'Longitude_Of_Center'],\n", " ['longitude_of_center', 'Longitude_of_center'],\n", " ['longc', 'longitude_of_center', d2r],\n", " ['x0', 'false_easting', toMeter],\n", " ['y0', 'false_northing', toMeter],\n", " ['long0', 'central_meridian', d2r],\n", " ['lat0', 'latitude_of_origin', d2r],\n", " ['lat0', 'standard_parallel_1', d2r],\n", " ['lat1', 'standard_parallel_1', d2r],\n", " ['lat2', 'standard_parallel_2', d2r],\n", " ['azimuth', 'Azimuth'],\n", " ['alpha', 'azimuth', d2r],\n", " ['srsCode', 'name']\n", " ];\n", " list.forEach(renamer);\n", " if (!wkt.long0 && wkt.longc && (wkt.projName === 'Albers_Conic_Equal_Area' || wkt.projName === 'Lambert_Azimuthal_Equal_Area')) {\n", " wkt.long0 = wkt.longc;\n", " }\n", " if (!wkt.lat_ts && wkt.lat1 && (wkt.projName === 'Stereographic_South_Pole' || wkt.projName === 'Polar Stereographic (variant B)')) {\n", " wkt.lat0 = d2r(wkt.lat1 > 0 ? 90 : -90);\n", " wkt.lat_ts = wkt.lat1;\n", " }\n", " }\n", " function default_1(wkt) {\n", " var lisp = parser_1.default(wkt);\n", " var type = lisp.shift();\n", " var name = lisp.shift();\n", " lisp.unshift(['name', name]);\n", " lisp.unshift(['type', type]);\n", " var obj = {};\n", " process_1.sExpr(lisp, obj);\n", " cleanWKT(obj);\n", " return obj;\n", " }\n", " exports.default = default_1;\n", " },\n", " /* wkt-parser/parser.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.default = parseString;\n", " var NEUTRAL = 1;\n", " var KEYWORD = 2;\n", " var NUMBER = 3;\n", " var QUOTED = 4;\n", " var AFTERQUOTE = 5;\n", " var ENDED = -1;\n", " var whitespace = /\\s/;\n", " var latin = /[A-Za-z]/;\n", " var keyword = /[A-Za-z84]/;\n", " var endThings = /[,\\]]/;\n", " var digets = /[\\d\\.E\\-\\+]/;\n", " // const ignoredChar = /[\\s_\\-\\/\\(\\)]/g;\n", " function Parser(text) {\n", " if (typeof text !== 'string') {\n", " throw new Error('not a string');\n", " }\n", " this.text = text.trim();\n", " this.level = 0;\n", " this.place = 0;\n", " this.root = null;\n", " this.stack = [];\n", " this.currentObject = null;\n", " this.state = NEUTRAL;\n", " }\n", " Parser.prototype.readCharicter = function () {\n", " var char = this.text[this.place++];\n", " if (this.state !== QUOTED) {\n", " while (whitespace.test(char)) {\n", " if (this.place >= this.text.length) {\n", " return;\n", " }\n", " char = this.text[this.place++];\n", " }\n", " }\n", " switch (this.state) {\n", " case NEUTRAL:\n", " return this.neutral(char);\n", " case KEYWORD:\n", " return this.keyword(char);\n", " case QUOTED:\n", " return this.quoted(char);\n", " case AFTERQUOTE:\n", " return this.afterquote(char);\n", " case NUMBER:\n", " return this.number(char);\n", " case ENDED:\n", " return;\n", " }\n", " };\n", " Parser.prototype.afterquote = function (char) {\n", " if (char === '\"') {\n", " this.word += '\"';\n", " this.state = QUOTED;\n", " return;\n", " }\n", " if (endThings.test(char)) {\n", " this.word = this.word.trim();\n", " this.afterItem(char);\n", " return;\n", " }\n", " throw new Error('havn\\'t handled \"' + char + '\" in afterquote yet, index ' + this.place);\n", " };\n", " Parser.prototype.afterItem = function (char) {\n", " if (char === ',') {\n", " if (this.word !== null) {\n", " this.currentObject.push(this.word);\n", " }\n", " this.word = null;\n", " this.state = NEUTRAL;\n", " return;\n", " }\n", " if (char === ']') {\n", " this.level--;\n", " if (this.word !== null) {\n", " this.currentObject.push(this.word);\n", " this.word = null;\n", " }\n", " this.state = NEUTRAL;\n", " this.currentObject = this.stack.pop();\n", " if (!this.currentObject) {\n", " this.state = ENDED;\n", " }\n", " return;\n", " }\n", " };\n", " Parser.prototype.number = function (char) {\n", " if (digets.test(char)) {\n", " this.word += char;\n", " return;\n", " }\n", " if (endThings.test(char)) {\n", " this.word = parseFloat(this.word);\n", " this.afterItem(char);\n", " return;\n", " }\n", " throw new Error('havn\\'t handled \"' + char + '\" in number yet, index ' + this.place);\n", " };\n", " Parser.prototype.quoted = function (char) {\n", " if (char === '\"') {\n", " this.state = AFTERQUOTE;\n", " return;\n", " }\n", " this.word += char;\n", " return;\n", " };\n", " Parser.prototype.keyword = function (char) {\n", " if (keyword.test(char)) {\n", " this.word += char;\n", " return;\n", " }\n", " if (char === '[') {\n", " var newObjects = [];\n", " newObjects.push(this.word);\n", " this.level++;\n", " if (this.root === null) {\n", " this.root = newObjects;\n", " }\n", " else {\n", " this.currentObject.push(newObjects);\n", " }\n", " this.stack.push(this.currentObject);\n", " this.currentObject = newObjects;\n", " this.state = NEUTRAL;\n", " return;\n", " }\n", " if (endThings.test(char)) {\n", " this.afterItem(char);\n", " return;\n", " }\n", " throw new Error('havn\\'t handled \"' + char + '\" in keyword yet, index ' + this.place);\n", " };\n", " Parser.prototype.neutral = function (char) {\n", " if (latin.test(char)) {\n", " this.word = char;\n", " this.state = KEYWORD;\n", " return;\n", " }\n", " if (char === '\"') {\n", " this.word = '';\n", " this.state = QUOTED;\n", " return;\n", " }\n", " if (digets.test(char)) {\n", " this.word = char;\n", " this.state = NUMBER;\n", " return;\n", " }\n", " if (endThings.test(char)) {\n", " this.afterItem(char);\n", " return;\n", " }\n", " throw new Error('havn\\'t handled \"' + char + '\" in neutral yet, index ' + this.place);\n", " };\n", " Parser.prototype.output = function () {\n", " while (this.place < this.text.length) {\n", " this.readCharicter();\n", " }\n", " if (this.state === ENDED) {\n", " return this.root;\n", " }\n", " throw new Error('unable to parse string \"' + this.text + '\". State is ' + this.state);\n", " };\n", " function parseString(txt) {\n", " var parser = new Parser(txt);\n", " return parser.output();\n", " }\n", " },\n", " /* wkt-parser/process.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " function mapit(obj, key, value) {\n", " if (Array.isArray(key)) {\n", " value.unshift(key);\n", " key = null;\n", " }\n", " var thing = key ? {} : obj;\n", " var out = value.reduce(function (newObj, item) {\n", " sExpr(item, newObj);\n", " return newObj;\n", " }, thing);\n", " if (key) {\n", " obj[key] = out;\n", " }\n", " }\n", " function sExpr(v, obj) {\n", " if (!Array.isArray(v)) {\n", " obj[v] = true;\n", " return;\n", " }\n", " var key = v.shift();\n", " if (key === 'PARAMETER') {\n", " key = v.shift();\n", " }\n", " if (v.length === 1) {\n", " if (Array.isArray(v[0])) {\n", " obj[key] = {};\n", " sExpr(v[0], obj[key]);\n", " return;\n", " }\n", " obj[key] = v[0];\n", " return;\n", " }\n", " if (!v.length) {\n", " obj[key] = true;\n", " return;\n", " }\n", " if (key === 'TOWGS84') {\n", " obj[key] = v;\n", " return;\n", " }\n", " if (key === 'AXIS') {\n", " if (!(key in obj)) {\n", " obj[key] = [];\n", " }\n", " obj[key].push(v);\n", " return;\n", " }\n", " if (!Array.isArray(key)) {\n", " obj[key] = {};\n", " }\n", " var i;\n", " switch (key) {\n", " case 'UNIT':\n", " case 'PRIMEM':\n", " case 'VERT_DATUM':\n", " obj[key] = {\n", " name: v[0].toLowerCase(),\n", " convert: v[1]\n", " };\n", " if (v.length === 3) {\n", " sExpr(v[2], obj[key]);\n", " }\n", " return;\n", " case 'SPHEROID':\n", " case 'ELLIPSOID':\n", " obj[key] = {\n", " name: v[0],\n", " a: v[1],\n", " rf: v[2]\n", " };\n", " if (v.length === 4) {\n", " sExpr(v[3], obj[key]);\n", " }\n", " return;\n", " case 'PROJECTEDCRS':\n", " case 'PROJCRS':\n", " case 'GEOGCS':\n", " case 'GEOCCS':\n", " case 'PROJCS':\n", " case 'LOCAL_CS':\n", " case 'GEODCRS':\n", " case 'GEODETICCRS':\n", " case 'GEODETICDATUM':\n", " case 'EDATUM':\n", " case 'ENGINEERINGDATUM':\n", " case 'VERT_CS':\n", " case 'VERTCRS':\n", " case 'VERTICALCRS':\n", " case 'COMPD_CS':\n", " case 'COMPOUNDCRS':\n", " case 'ENGINEERINGCRS':\n", " case 'ENGCRS':\n", " case 'FITTED_CS':\n", " case 'LOCAL_DATUM':\n", " case 'DATUM':\n", " v[0] = ['name', v[0]];\n", " mapit(obj, key, v);\n", " return;\n", " default:\n", " i = -1;\n", " while (++i < v.length) {\n", " if (!Array.isArray(v[i])) {\n", " return sExpr(v, obj[key]);\n", " }\n", " }\n", " return mapit(obj, key, v);\n", " }\n", " }\n", " exports.sExpr = sExpr;\n", " },\n", " /* proj4/lib/extend.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " function default_1(destination, source) {\n", " destination = destination || {};\n", " var value, property;\n", " if (!source) {\n", " return destination;\n", " }\n", " for (property in source) {\n", " value = source[property];\n", " if (value !== undefined) {\n", " destination[property] = value;\n", " }\n", " }\n", " return destination;\n", " }\n", " exports.default = default_1;\n", " },\n", " /* proj4/lib/projections.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const merc_1 = tslib_1.__importDefault(require(48) /* ./projections/merc */);\n", " const longlat_1 = tslib_1.__importDefault(require(54) /* ./projections/longlat */);\n", " var projs = [merc_1.default, longlat_1.default];\n", " var names = {};\n", " var projStore = [];\n", " function add(proj, i) {\n", " var len = projStore.length;\n", " if (!proj.names) {\n", " console.log(i);\n", " return true;\n", " }\n", " projStore[len] = proj;\n", " proj.names.forEach(function (n) {\n", " names[n.toLowerCase()] = len;\n", " });\n", " return this;\n", " }\n", " exports.add = add;\n", " function get(name) {\n", " if (!name) {\n", " return false;\n", " }\n", " var n = name.toLowerCase();\n", " if (typeof names[n] !== 'undefined' && projStore[names[n]]) {\n", " return projStore[names[n]];\n", " }\n", " }\n", " exports.get = get;\n", " function start() {\n", " projs.forEach(add);\n", " }\n", " exports.start = start;\n", " exports.default = {\n", " start: start,\n", " add: add,\n", " get: get\n", " };\n", " },\n", " /* proj4/lib/projections/merc.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const msfnz_1 = tslib_1.__importDefault(require(49) /* ../common/msfnz */);\n", " const adjust_lon_1 = tslib_1.__importDefault(require(50) /* ../common/adjust_lon */);\n", " const tsfnz_1 = tslib_1.__importDefault(require(52) /* ../common/tsfnz */);\n", " const phi2z_1 = tslib_1.__importDefault(require(53) /* ../common/phi2z */);\n", " const values_1 = require(39) /* ../constants/values */;\n", " function init() {\n", " var con = this.b / this.a;\n", " this.es = 1 - con * con;\n", " if (!('x0' in this)) {\n", " this.x0 = 0;\n", " }\n", " if (!('y0' in this)) {\n", " this.y0 = 0;\n", " }\n", " this.e = Math.sqrt(this.es);\n", " if (this.lat_ts) {\n", " if (this.sphere) {\n", " this.k0 = Math.cos(this.lat_ts);\n", " }\n", " else {\n", " this.k0 = msfnz_1.default(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts));\n", " }\n", " }\n", " else {\n", " if (!this.k0) {\n", " if (this.k) {\n", " this.k0 = this.k;\n", " }\n", " else {\n", " this.k0 = 1;\n", " }\n", " }\n", " }\n", " }\n", " exports.init = init;\n", " /* Mercator forward equations--mapping lat,long to x,y\n", " --------------------------------------------------*/\n", " function forward(p) {\n", " var lon = p.x;\n", " var lat = p.y;\n", " // convert to radians\n", " if (lat * values_1.R2D > 90 && lat * values_1.R2D < -90 && lon * values_1.R2D > 180 && lon * values_1.R2D < -180) {\n", " return null;\n", " }\n", " var x, y;\n", " if (Math.abs(Math.abs(lat) - values_1.HALF_PI) <= values_1.EPSLN) {\n", " return null;\n", " }\n", " else {\n", " if (this.sphere) {\n", " x = this.x0 + this.a * this.k0 * adjust_lon_1.default(lon - this.long0);\n", " y = this.y0 + this.a * this.k0 * Math.log(Math.tan(values_1.FORTPI + 0.5 * lat));\n", " }\n", " else {\n", " var sinphi = Math.sin(lat);\n", " var ts = tsfnz_1.default(this.e, lat, sinphi);\n", " x = this.x0 + this.a * this.k0 * adjust_lon_1.default(lon - this.long0);\n", " y = this.y0 - this.a * this.k0 * Math.log(ts);\n", " }\n", " p.x = x;\n", " p.y = y;\n", " return p;\n", " }\n", " }\n", " exports.forward = forward;\n", " /* Mercator inverse equations--mapping x,y to lat/long\n", " --------------------------------------------------*/\n", " function inverse(p) {\n", " var x = p.x - this.x0;\n", " var y = p.y - this.y0;\n", " var lon, lat;\n", " if (this.sphere) {\n", " lat = values_1.HALF_PI - 2 * Math.atan(Math.exp(-y / (this.a * this.k0)));\n", " }\n", " else {\n", " var ts = Math.exp(-y / (this.a * this.k0));\n", " lat = phi2z_1.default(this.e, ts);\n", " if (lat === -9999) {\n", " return null;\n", " }\n", " }\n", " lon = adjust_lon_1.default(this.long0 + x / (this.a * this.k0));\n", " p.x = lon;\n", " p.y = lat;\n", " return p;\n", " }\n", " exports.inverse = inverse;\n", " exports.names = [\"Mercator\", \"Popular Visualisation Pseudo Mercator\", \"Mercator_1SP\", \"Mercator_Auxiliary_Sphere\", \"merc\"];\n", " exports.default = {\n", " init: init,\n", " forward: forward,\n", " inverse: inverse,\n", " names: exports.names\n", " };\n", " },\n", " /* proj4/lib/common/msfnz.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " function default_1(eccent, sinphi, cosphi) {\n", " var con = eccent * sinphi;\n", " return cosphi / (Math.sqrt(1 - con * con));\n", " }\n", " exports.default = default_1;\n", " },\n", " /* proj4/lib/common/adjust_lon.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const values_1 = require(39) /* ../constants/values */;\n", " const sign_1 = tslib_1.__importDefault(require(51) /* ./sign */);\n", " function default_1(x) {\n", " return (Math.abs(x) <= values_1.SPI) ? x : (x - (sign_1.default(x) * values_1.TWO_PI));\n", " }\n", " exports.default = default_1;\n", " },\n", " /* proj4/lib/common/sign.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " function default_1(x) {\n", " return x < 0 ? -1 : 1;\n", " }\n", " exports.default = default_1;\n", " },\n", " /* proj4/lib/common/tsfnz.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const values_1 = require(39) /* ../constants/values */;\n", " function default_1(eccent, phi, sinphi) {\n", " var con = eccent * sinphi;\n", " var com = 0.5 * eccent;\n", " con = Math.pow(((1 - con) / (1 + con)), com);\n", " return (Math.tan(0.5 * (values_1.HALF_PI - phi)) / con);\n", " }\n", " exports.default = default_1;\n", " },\n", " /* proj4/lib/common/phi2z.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const values_1 = require(39) /* ../constants/values */;\n", " function default_1(eccent, ts) {\n", " var eccnth = 0.5 * eccent;\n", " var con, dphi;\n", " var phi = values_1.HALF_PI - 2 * Math.atan(ts);\n", " for (var i = 0; i <= 15; i++) {\n", " con = eccent * Math.sin(phi);\n", " dphi = values_1.HALF_PI - 2 * Math.atan(ts * (Math.pow(((1 - con) / (1 + con)), eccnth))) - phi;\n", " phi += dphi;\n", " if (Math.abs(dphi) <= 0.0000000001) {\n", " return phi;\n", " }\n", " }\n", " //console.log(\"phi2z has NoConvergence\");\n", " return -9999;\n", " }\n", " exports.default = default_1;\n", " },\n", " /* proj4/lib/projections/longlat.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " function init() {\n", " //no-op for longlat\n", " }\n", " exports.init = init;\n", " function identity(pt) {\n", " return pt;\n", " }\n", " exports.forward = identity;\n", " exports.inverse = identity;\n", " exports.names = [\"longlat\", \"identity\"];\n", " exports.default = {\n", " init: init,\n", " forward: identity,\n", " inverse: identity,\n", " names: exports.names\n", " };\n", " },\n", " /* proj4/lib/deriveConstants.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const values_1 = require(39) /* ./constants/values */;\n", " const Ellipsoid_1 = tslib_1.__importStar(require(56) /* ./constants/Ellipsoid */);\n", " const match_1 = tslib_1.__importDefault(require(42) /* ./match */);\n", " function eccentricity(a, b, rf, R_A) {\n", " var a2 = a * a; // used in geocentric\n", " var b2 = b * b; // used in geocentric\n", " var es = (a2 - b2) / a2; // e ^ 2\n", " var e = 0;\n", " if (R_A) {\n", " a *= 1 - es * (values_1.SIXTH + es * (values_1.RA4 + es * values_1.RA6));\n", " a2 = a * a;\n", " es = 0;\n", " }\n", " else {\n", " e = Math.sqrt(es); // eccentricity\n", " }\n", " var ep2 = (a2 - b2) / b2; // used in geocentric\n", " return {\n", " es: es,\n", " e: e,\n", " ep2: ep2\n", " };\n", " }\n", " exports.eccentricity = eccentricity;\n", " function sphere(a, b, rf, ellps, sphere) {\n", " if (!a) { // do we have an ellipsoid?\n", " var ellipse = match_1.default(Ellipsoid_1.default, ellps);\n", " if (!ellipse) {\n", " ellipse = Ellipsoid_1.WGS84;\n", " }\n", " a = ellipse.a;\n", " b = ellipse.b;\n", " rf = ellipse.rf;\n", " }\n", " if (rf && !b) {\n", " b = (1.0 - 1.0 / rf) * a;\n", " }\n", " if (rf === 0 || Math.abs(a - b) < values_1.EPSLN) {\n", " sphere = true;\n", " b = a;\n", " }\n", " return {\n", " a: a,\n", " b: b,\n", " rf: rf,\n", " sphere: sphere\n", " };\n", " }\n", " exports.sphere = sphere;\n", " },\n", " /* proj4/lib/constants/Ellipsoid.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var exports$1 = {};\n", " exports.default = exports$1;\n", " exports$1.MERIT = {\n", " a: 6378137.0,\n", " rf: 298.257,\n", " ellipseName: \"MERIT 1983\"\n", " };\n", " exports$1.SGS85 = {\n", " a: 6378136.0,\n", " rf: 298.257,\n", " ellipseName: \"Soviet Geodetic System 85\"\n", " };\n", " exports$1.GRS80 = {\n", " a: 6378137.0,\n", " rf: 298.257222101,\n", " ellipseName: \"GRS 1980(IUGG, 1980)\"\n", " };\n", " exports$1.IAU76 = {\n", " a: 6378140.0,\n", " rf: 298.257,\n", " ellipseName: \"IAU 1976\"\n", " };\n", " exports$1.airy = {\n", " a: 6377563.396,\n", " b: 6356256.910,\n", " ellipseName: \"Airy 1830\"\n", " };\n", " exports$1.APL4 = {\n", " a: 6378137,\n", " rf: 298.25,\n", " ellipseName: \"Appl. Physics. 1965\"\n", " };\n", " exports$1.NWL9D = {\n", " a: 6378145.0,\n", " rf: 298.25,\n", " ellipseName: \"Naval Weapons Lab., 1965\"\n", " };\n", " exports$1.mod_airy = {\n", " a: 6377340.189,\n", " b: 6356034.446,\n", " ellipseName: \"Modified Airy\"\n", " };\n", " exports$1.andrae = {\n", " a: 6377104.43,\n", " rf: 300.0,\n", " ellipseName: \"Andrae 1876 (Den., Iclnd.)\"\n", " };\n", " exports$1.aust_SA = {\n", " a: 6378160.0,\n", " rf: 298.25,\n", " ellipseName: \"Australian Natl & S. Amer. 1969\"\n", " };\n", " exports$1.GRS67 = {\n", " a: 6378160.0,\n", " rf: 298.2471674270,\n", " ellipseName: \"GRS 67(IUGG 1967)\"\n", " };\n", " exports$1.bessel = {\n", " a: 6377397.155,\n", " rf: 299.1528128,\n", " ellipseName: \"Bessel 1841\"\n", " };\n", " exports$1.bess_nam = {\n", " a: 6377483.865,\n", " rf: 299.1528128,\n", " ellipseName: \"Bessel 1841 (Namibia)\"\n", " };\n", " exports$1.clrk66 = {\n", " a: 6378206.4,\n", " b: 6356583.8,\n", " ellipseName: \"Clarke 1866\"\n", " };\n", " exports$1.clrk80 = {\n", " a: 6378249.145,\n", " rf: 293.4663,\n", " ellipseName: \"Clarke 1880 mod.\"\n", " };\n", " exports$1.clrk58 = {\n", " a: 6378293.645208759,\n", " rf: 294.2606763692654,\n", " ellipseName: \"Clarke 1858\"\n", " };\n", " exports$1.CPM = {\n", " a: 6375738.7,\n", " rf: 334.29,\n", " ellipseName: \"Comm. des Poids et Mesures 1799\"\n", " };\n", " exports$1.delmbr = {\n", " a: 6376428.0,\n", " rf: 311.5,\n", " ellipseName: \"Delambre 1810 (Belgium)\"\n", " };\n", " exports$1.engelis = {\n", " a: 6378136.05,\n", " rf: 298.2566,\n", " ellipseName: \"Engelis 1985\"\n", " };\n", " exports$1.evrst30 = {\n", " a: 6377276.345,\n", " rf: 300.8017,\n", " ellipseName: \"Everest 1830\"\n", " };\n", " exports$1.evrst48 = {\n", " a: 6377304.063,\n", " rf: 300.8017,\n", " ellipseName: \"Everest 1948\"\n", " };\n", " exports$1.evrst56 = {\n", " a: 6377301.243,\n", " rf: 300.8017,\n", " ellipseName: \"Everest 1956\"\n", " };\n", " exports$1.evrst69 = {\n", " a: 6377295.664,\n", " rf: 300.8017,\n", " ellipseName: \"Everest 1969\"\n", " };\n", " exports$1.evrstSS = {\n", " a: 6377298.556,\n", " rf: 300.8017,\n", " ellipseName: \"Everest (Sabah & Sarawak)\"\n", " };\n", " exports$1.fschr60 = {\n", " a: 6378166.0,\n", " rf: 298.3,\n", " ellipseName: \"Fischer (Mercury Datum) 1960\"\n", " };\n", " exports$1.fschr60m = {\n", " a: 6378155.0,\n", " rf: 298.3,\n", " ellipseName: \"Fischer 1960\"\n", " };\n", " exports$1.fschr68 = {\n", " a: 6378150.0,\n", " rf: 298.3,\n", " ellipseName: \"Fischer 1968\"\n", " };\n", " exports$1.helmert = {\n", " a: 6378200.0,\n", " rf: 298.3,\n", " ellipseName: \"Helmert 1906\"\n", " };\n", " exports$1.hough = {\n", " a: 6378270.0,\n", " rf: 297.0,\n", " ellipseName: \"Hough\"\n", " };\n", " exports$1.intl = {\n", " a: 6378388.0,\n", " rf: 297.0,\n", " ellipseName: \"International 1909 (Hayford)\"\n", " };\n", " exports$1.kaula = {\n", " a: 6378163.0,\n", " rf: 298.24,\n", " ellipseName: \"Kaula 1961\"\n", " };\n", " exports$1.lerch = {\n", " a: 6378139.0,\n", " rf: 298.257,\n", " ellipseName: \"Lerch 1979\"\n", " };\n", " exports$1.mprts = {\n", " a: 6397300.0,\n", " rf: 191.0,\n", " ellipseName: \"Maupertius 1738\"\n", " };\n", " exports$1.new_intl = {\n", " a: 6378157.5,\n", " b: 6356772.2,\n", " ellipseName: \"New International 1967\"\n", " };\n", " exports$1.plessis = {\n", " a: 6376523.0,\n", " rf: 6355863.0,\n", " ellipseName: \"Plessis 1817 (France)\"\n", " };\n", " exports$1.krass = {\n", " a: 6378245.0,\n", " rf: 298.3,\n", " ellipseName: \"Krassovsky, 1942\"\n", " };\n", " exports$1.SEasia = {\n", " a: 6378155.0,\n", " b: 6356773.3205,\n", " ellipseName: \"Southeast Asia\"\n", " };\n", " exports$1.walbeck = {\n", " a: 6376896.0,\n", " b: 6355834.8467,\n", " ellipseName: \"Walbeck\"\n", " };\n", " exports$1.WGS60 = {\n", " a: 6378165.0,\n", " rf: 298.3,\n", " ellipseName: \"WGS 60\"\n", " };\n", " exports$1.WGS66 = {\n", " a: 6378145.0,\n", " rf: 298.25,\n", " ellipseName: \"WGS 66\"\n", " };\n", " exports$1.WGS7 = {\n", " a: 6378135.0,\n", " rf: 298.26,\n", " ellipseName: \"WGS 72\"\n", " };\n", " exports.WGS84 = exports$1.WGS84 = {\n", " a: 6378137.0,\n", " rf: 298.257223563,\n", " ellipseName: \"WGS 84\"\n", " };\n", " exports$1.sphere = {\n", " a: 6370997.0,\n", " b: 6370997.0,\n", " ellipseName: \"Normal Sphere (r=6370997)\"\n", " };\n", " },\n", " /* proj4/lib/constants/Datum.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var exports$1 = {};\n", " exports.default = exports$1;\n", " exports$1.wgs84 = {\n", " towgs84: \"0,0,0\",\n", " ellipse: \"WGS84\",\n", " datumName: \"WGS84\"\n", " };\n", " exports$1.ch1903 = {\n", " towgs84: \"674.374,15.056,405.346\",\n", " ellipse: \"bessel\",\n", " datumName: \"swiss\"\n", " };\n", " exports$1.ggrs87 = {\n", " towgs84: \"-199.87,74.79,246.62\",\n", " ellipse: \"GRS80\",\n", " datumName: \"Greek_Geodetic_Reference_System_1987\"\n", " };\n", " exports$1.nad83 = {\n", " towgs84: \"0,0,0\",\n", " ellipse: \"GRS80\",\n", " datumName: \"North_American_Datum_1983\"\n", " };\n", " exports$1.nad27 = {\n", " nadgrids: \"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat\",\n", " ellipse: \"clrk66\",\n", " datumName: \"North_American_Datum_1927\"\n", " };\n", " exports$1.potsdam = {\n", " towgs84: \"606.0,23.0,413.0\",\n", " ellipse: \"bessel\",\n", " datumName: \"Potsdam Rauenberg 1950 DHDN\"\n", " };\n", " exports$1.carthage = {\n", " towgs84: \"-263.0,6.0,431.0\",\n", " ellipse: \"clark80\",\n", " datumName: \"Carthage 1934 Tunisia\"\n", " };\n", " exports$1.hermannskogel = {\n", " towgs84: \"653.0,-212.0,449.0\",\n", " ellipse: \"bessel\",\n", " datumName: \"Hermannskogel\"\n", " };\n", " exports$1.osni52 = {\n", " towgs84: \"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15\",\n", " ellipse: \"airy\",\n", " datumName: \"Irish National\"\n", " };\n", " exports$1.ire65 = {\n", " towgs84: \"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15\",\n", " ellipse: \"mod_airy\",\n", " datumName: \"Ireland 1965\"\n", " };\n", " exports$1.rassadiran = {\n", " towgs84: \"-133.63,-157.5,-158.62\",\n", " ellipse: \"intl\",\n", " datumName: \"Rassadiran\"\n", " };\n", " exports$1.nzgd49 = {\n", " towgs84: \"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993\",\n", " ellipse: \"intl\",\n", " datumName: \"New Zealand Geodetic Datum 1949\"\n", " };\n", " exports$1.osgb36 = {\n", " towgs84: \"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894\",\n", " ellipse: \"airy\",\n", " datumName: \"Airy 1830\"\n", " };\n", " exports$1.s_jtsk = {\n", " towgs84: \"589,76,480\",\n", " ellipse: 'bessel',\n", " datumName: 'S-JTSK (Ferro)'\n", " };\n", " exports$1.beduaram = {\n", " towgs84: '-106,-87,188',\n", " ellipse: 'clrk80',\n", " datumName: 'Beduaram'\n", " };\n", " exports$1.gunung_segara = {\n", " towgs84: '-403,684,41',\n", " ellipse: 'bessel',\n", " datumName: 'Gunung Segara Jakarta'\n", " };\n", " exports$1.rnb72 = {\n", " towgs84: \"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1\",\n", " ellipse: \"intl\",\n", " datumName: \"Reseau National Belge 1972\"\n", " };\n", " },\n", " /* proj4/lib/datum.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const values_1 = require(39) /* ./constants/values */;\n", " function datum(datumCode, datum_params, a, b, es, ep2) {\n", " var out = {};\n", " if (datumCode === undefined || datumCode === 'none') {\n", " out.datum_type = values_1.PJD_NODATUM;\n", " }\n", " else {\n", " out.datum_type = values_1.PJD_WGS84;\n", " }\n", " if (datum_params) {\n", " out.datum_params = datum_params.map(parseFloat);\n", " if (out.datum_params[0] !== 0 || out.datum_params[1] !== 0 || out.datum_params[2] !== 0) {\n", " out.datum_type = values_1.PJD_3PARAM;\n", " }\n", " if (out.datum_params.length > 3) {\n", " if (out.datum_params[3] !== 0 || out.datum_params[4] !== 0 || out.datum_params[5] !== 0 || out.datum_params[6] !== 0) {\n", " out.datum_type = values_1.PJD_7PARAM;\n", " out.datum_params[3] *= values_1.SEC_TO_RAD;\n", " out.datum_params[4] *= values_1.SEC_TO_RAD;\n", " out.datum_params[5] *= values_1.SEC_TO_RAD;\n", " out.datum_params[6] = (out.datum_params[6] / 1000000.0) + 1.0;\n", " }\n", " }\n", " }\n", " out.a = a; //datum object also uses these values\n", " out.b = b;\n", " out.es = es;\n", " out.ep2 = ep2;\n", " return out;\n", " }\n", " exports.default = datum;\n", " },\n", " /* proj4/lib/transform.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const values_1 = require(39) /* ./constants/values */;\n", " const datum_transform_1 = tslib_1.__importDefault(require(60) /* ./datum_transform */);\n", " const adjust_axis_1 = tslib_1.__importDefault(require(62) /* ./adjust_axis */);\n", " const Proj_1 = tslib_1.__importDefault(require(34) /* ./Proj */);\n", " const toPoint_1 = tslib_1.__importDefault(require(63) /* ./common/toPoint */);\n", " const checkSanity_1 = tslib_1.__importDefault(require(64) /* ./checkSanity */);\n", " function checkNotWGS(source, dest) {\n", " return ((source.datum.datum_type === values_1.PJD_3PARAM || source.datum.datum_type === values_1.PJD_7PARAM) && dest.datumCode !== 'WGS84') || ((dest.datum.datum_type === values_1.PJD_3PARAM || dest.datum.datum_type === values_1.PJD_7PARAM) && source.datumCode !== 'WGS84');\n", " }\n", " function transform(source, dest, point) {\n", " var wgs84;\n", " if (Array.isArray(point)) {\n", " point = toPoint_1.default(point);\n", " }\n", " checkSanity_1.default(point);\n", " // Workaround for datum shifts towgs84, if either source or destination projection is not wgs84\n", " if (source.datum && dest.datum && checkNotWGS(source, dest)) {\n", " wgs84 = new Proj_1.default('WGS84');\n", " point = transform(source, wgs84, point);\n", " source = wgs84;\n", " }\n", " // DGR, 2010/11/12\n", " if (source.axis !== 'enu') {\n", " point = adjust_axis_1.default(source, false, point);\n", " }\n", " // Transform source points to long/lat, if they aren't already.\n", " if (source.projName === 'longlat') {\n", " point = {\n", " x: point.x * values_1.D2R,\n", " y: point.y * values_1.D2R,\n", " z: point.z || 0\n", " };\n", " }\n", " else {\n", " if (source.to_meter) {\n", " point = {\n", " x: point.x * source.to_meter,\n", " y: point.y * source.to_meter,\n", " z: point.z || 0\n", " };\n", " }\n", " point = source.inverse(point); // Convert Cartesian to longlat\n", " }\n", " // Adjust for the prime meridian if necessary\n", " if (source.from_greenwich) {\n", " point.x += source.from_greenwich;\n", " }\n", " // Convert datums if needed, and if possible.\n", " point = datum_transform_1.default(source.datum, dest.datum, point);\n", " // Adjust for the prime meridian if necessary\n", " if (dest.from_greenwich) {\n", " point = {\n", " x: point.x - dest.from_greenwich,\n", " y: point.y,\n", " z: point.z || 0\n", " };\n", " }\n", " if (dest.projName === 'longlat') {\n", " // convert radians to decimal degrees\n", " point = {\n", " x: point.x * values_1.R2D,\n", " y: point.y * values_1.R2D,\n", " z: point.z || 0\n", " };\n", " }\n", " else { // else project\n", " point = dest.forward(point);\n", " if (dest.to_meter) {\n", " point = {\n", " x: point.x / dest.to_meter,\n", " y: point.y / dest.to_meter,\n", " z: point.z || 0\n", " };\n", " }\n", " }\n", " // DGR, 2010/11/12\n", " if (dest.axis !== 'enu') {\n", " return adjust_axis_1.default(dest, true, point);\n", " }\n", " return point;\n", " }\n", " exports.default = transform;\n", " },\n", " /* proj4/lib/datum_transform.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const values_1 = require(39) /* ./constants/values */;\n", " const datumUtils_1 = require(61) /* ./datumUtils */;\n", " function checkParams(type) {\n", " return (type === values_1.PJD_3PARAM || type === values_1.PJD_7PARAM);\n", " }\n", " function default_1(source, dest, point) {\n", " // Short cut if the datums are identical.\n", " if (datumUtils_1.compareDatums(source, dest)) {\n", " return point; // in this case, zero is sucess,\n", " // whereas cs_compare_datums returns 1 to indicate TRUE\n", " // confusing, should fix this\n", " }\n", " // Explicitly skip datum transform by setting 'datum=none' as parameter for either source or dest\n", " if (source.datum_type === values_1.PJD_NODATUM || dest.datum_type === values_1.PJD_NODATUM) {\n", " return point;\n", " }\n", " // If this datum requires grid shifts, then apply it to geodetic coordinates.\n", " // Do we need to go through geocentric coordinates?\n", " if (source.es === dest.es && source.a === dest.a && !checkParams(source.datum_type) && !checkParams(dest.datum_type)) {\n", " return point;\n", " }\n", " // Convert to geocentric coordinates.\n", " point = datumUtils_1.geodeticToGeocentric(point, source.es, source.a);\n", " // Convert between datums\n", " if (checkParams(source.datum_type)) {\n", " point = datumUtils_1.geocentricToWgs84(point, source.datum_type, source.datum_params);\n", " }\n", " if (checkParams(dest.datum_type)) {\n", " point = datumUtils_1.geocentricFromWgs84(point, dest.datum_type, dest.datum_params);\n", " }\n", " return datumUtils_1.geocentricToGeodetic(point, dest.es, dest.a, dest.b);\n", " }\n", " exports.default = default_1;\n", " },\n", " /* proj4/lib/datumUtils.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const values_1 = require(39) /* ./constants/values */;\n", " function compareDatums(source, dest) {\n", " if (source.datum_type !== dest.datum_type) {\n", " return false; // false, datums are not equal\n", " }\n", " else if (source.a !== dest.a || Math.abs(source.es - dest.es) > 0.000000000050) {\n", " // the tolerance for es is to ensure that GRS80 and WGS84\n", " // are considered identical\n", " return false;\n", " }\n", " else if (source.datum_type === values_1.PJD_3PARAM) {\n", " return (source.datum_params[0] === dest.datum_params[0] && source.datum_params[1] === dest.datum_params[1] && source.datum_params[2] === dest.datum_params[2]);\n", " }\n", " else if (source.datum_type === values_1.PJD_7PARAM) {\n", " return (source.datum_params[0] === dest.datum_params[0] && source.datum_params[1] === dest.datum_params[1] && source.datum_params[2] === dest.datum_params[2] && source.datum_params[3] === dest.datum_params[3] && source.datum_params[4] === dest.datum_params[4] && source.datum_params[5] === dest.datum_params[5] && source.datum_params[6] === dest.datum_params[6]);\n", " }\n", " else {\n", " return true; // datums are equal\n", " }\n", " } // cs_compare_datums()\n", " exports.compareDatums = compareDatums;\n", " /*\n", " * The function Convert_Geodetic_To_Geocentric converts geodetic coordinates\n", " * (latitude, longitude, and height) to geocentric coordinates (X, Y, Z),\n", " * according to the current ellipsoid parameters.\n", " *\n", " * Latitude : Geodetic latitude in radians (input)\n", " * Longitude : Geodetic longitude in radians (input)\n", " * Height : Geodetic height, in meters (input)\n", " * X : Calculated Geocentric X coordinate, in meters (output)\n", " * Y : Calculated Geocentric Y coordinate, in meters (output)\n", " * Z : Calculated Geocentric Z coordinate, in meters (output)\n", " *\n", " */\n", " function geodeticToGeocentric(p, es, a) {\n", " var Longitude = p.x;\n", " var Latitude = p.y;\n", " var Height = p.z ? p.z : 0; //Z value not always supplied\n", " var Rn; /* Earth radius at location */\n", " var Sin_Lat; /* Math.sin(Latitude) */\n", " var Sin2_Lat; /* Square of Math.sin(Latitude) */\n", " var Cos_Lat; /* Math.cos(Latitude) */\n", " /*\n", " ** Don't blow up if Latitude is just a little out of the value\n", " ** range as it may just be a rounding issue. Also removed longitude\n", " ** test, it should be wrapped by Math.cos() and Math.sin(). NFW for PROJ.4, Sep/2001.\n", " */\n", " if (Latitude < -values_1.HALF_PI && Latitude > -1.001 * values_1.HALF_PI) {\n", " Latitude = -values_1.HALF_PI;\n", " }\n", " else if (Latitude > values_1.HALF_PI && Latitude < 1.001 * values_1.HALF_PI) {\n", " Latitude = values_1.HALF_PI;\n", " }\n", " else if (Latitude < -values_1.HALF_PI) {\n", " /* Latitude out of range */\n", " //..reportError('geocent:lat out of range:' + Latitude);\n", " return { x: -Infinity, y: -Infinity, z: p.z };\n", " }\n", " else if (Latitude > values_1.HALF_PI) {\n", " /* Latitude out of range */\n", " return { x: Infinity, y: Infinity, z: p.z };\n", " }\n", " if (Longitude > Math.PI) {\n", " Longitude -= (2 * Math.PI);\n", " }\n", " Sin_Lat = Math.sin(Latitude);\n", " Cos_Lat = Math.cos(Latitude);\n", " Sin2_Lat = Sin_Lat * Sin_Lat;\n", " Rn = a / (Math.sqrt(1.0e0 - es * Sin2_Lat));\n", " return {\n", " x: (Rn + Height) * Cos_Lat * Math.cos(Longitude),\n", " y: (Rn + Height) * Cos_Lat * Math.sin(Longitude),\n", " z: ((Rn * (1 - es)) + Height) * Sin_Lat\n", " };\n", " } // cs_geodetic_to_geocentric()\n", " exports.geodeticToGeocentric = geodeticToGeocentric;\n", " function geocentricToGeodetic(p, es, a, b) {\n", " /* local defintions and variables */\n", " /* end-criterium of loop, accuracy of sin(Latitude) */\n", " var genau = 1e-12;\n", " var genau2 = (genau * genau);\n", " var maxiter = 30;\n", " var P; /* distance between semi-minor axis and location */\n", " var RR; /* distance between center and location */\n", " var CT; /* sin of geocentric latitude */\n", " var ST; /* cos of geocentric latitude */\n", " var RX;\n", " var RK;\n", " var RN; /* Earth radius at location */\n", " var CPHI0; /* cos of start or old geodetic latitude in iterations */\n", " var SPHI0; /* sin of start or old geodetic latitude in iterations */\n", " var CPHI; /* cos of searched geodetic latitude */\n", " var SPHI; /* sin of searched geodetic latitude */\n", " var SDPHI; /* end-criterium: addition-theorem of sin(Latitude(iter)-Latitude(iter-1)) */\n", " var iter; /* # of continous iteration, max. 30 is always enough (s.a.) */\n", " var X = p.x;\n", " var Y = p.y;\n", " var Z = p.z ? p.z : 0.0; //Z value not always supplied\n", " var Longitude;\n", " var Latitude;\n", " var Height;\n", " P = Math.sqrt(X * X + Y * Y);\n", " RR = Math.sqrt(X * X + Y * Y + Z * Z);\n", " /* special cases for latitude and longitude */\n", " if (P / a < genau) {\n", " /* special case, if P=0. (X=0., Y=0.) */\n", " Longitude = 0.0;\n", " /* if (X,Y,Z)=(0.,0.,0.) then Height becomes semi-minor axis\n", " * of ellipsoid (=center of mass), Latitude becomes PI/2 */\n", " if (RR / a < genau) {\n", " Latitude = values_1.HALF_PI;\n", " Height = -b;\n", " return {\n", " x: p.x,\n", " y: p.y,\n", " z: p.z\n", " };\n", " }\n", " }\n", " else {\n", " /* ellipsoidal (geodetic) longitude\n", " * interval: -PI < Longitude <= +PI */\n", " Longitude = Math.atan2(Y, X);\n", " }\n", " /* --------------------------------------------------------------\n", " * Following iterative algorithm was developped by\n", " * \"Institut for Erdmessung\", University of Hannover, July 1988.\n", " * Internet: www.ife.uni-hannover.de\n", " * Iterative computation of CPHI,SPHI and Height.\n", " * Iteration of CPHI and SPHI to 10**-12 radian resp.\n", " * 2*10**-7 arcsec.\n", " * --------------------------------------------------------------\n", " */\n", " CT = Z / RR;\n", " ST = P / RR;\n", " RX = 1.0 / Math.sqrt(1.0 - es * (2.0 - es) * ST * ST);\n", " CPHI0 = ST * (1.0 - es) * RX;\n", " SPHI0 = CT * RX;\n", " iter = 0;\n", " /* loop to find sin(Latitude) resp. Latitude\n", " * until |sin(Latitude(iter)-Latitude(iter-1))| < genau */\n", " do {\n", " iter++;\n", " RN = a / Math.sqrt(1.0 - es * SPHI0 * SPHI0);\n", " /* ellipsoidal (geodetic) height */\n", " Height = P * CPHI0 + Z * SPHI0 - RN * (1.0 - es * SPHI0 * SPHI0);\n", " RK = es * RN / (RN + Height);\n", " RX = 1.0 / Math.sqrt(1.0 - RK * (2.0 - RK) * ST * ST);\n", " CPHI = ST * (1.0 - RK) * RX;\n", " SPHI = CT * RX;\n", " SDPHI = SPHI * CPHI0 - CPHI * SPHI0;\n", " CPHI0 = CPHI;\n", " SPHI0 = SPHI;\n", " } while (SDPHI * SDPHI > genau2 && iter < maxiter);\n", " /* ellipsoidal (geodetic) latitude */\n", " Latitude = Math.atan(SPHI / Math.abs(CPHI));\n", " return {\n", " x: Longitude,\n", " y: Latitude,\n", " z: Height\n", " };\n", " } // cs_geocentric_to_geodetic()\n", " exports.geocentricToGeodetic = geocentricToGeodetic;\n", " /****************************************************************/\n", " // pj_geocentic_to_wgs84( p )\n", " // p = point to transform in geocentric coordinates (x,y,z)\n", " /** point object, nothing fancy, just allows values to be\n", " passed back and forth by reference rather than by value.\n", " Other point classes may be used as long as they have\n", " x and y properties, which will get modified in the transform method.\n", " */\n", " function geocentricToWgs84(p, datum_type, datum_params) {\n", " if (datum_type === values_1.PJD_3PARAM) {\n", " // if( x[io] === HUGE_VAL )\n", " // continue;\n", " return {\n", " x: p.x + datum_params[0],\n", " y: p.y + datum_params[1],\n", " z: p.z + datum_params[2],\n", " };\n", " }\n", " else if (datum_type === values_1.PJD_7PARAM) {\n", " var Dx_BF = datum_params[0];\n", " var Dy_BF = datum_params[1];\n", " var Dz_BF = datum_params[2];\n", " var Rx_BF = datum_params[3];\n", " var Ry_BF = datum_params[4];\n", " var Rz_BF = datum_params[5];\n", " var M_BF = datum_params[6];\n", " // if( x[io] === HUGE_VAL )\n", " // continue;\n", " return {\n", " x: M_BF * (p.x - Rz_BF * p.y + Ry_BF * p.z) + Dx_BF,\n", " y: M_BF * (Rz_BF * p.x + p.y - Rx_BF * p.z) + Dy_BF,\n", " z: M_BF * (-Ry_BF * p.x + Rx_BF * p.y + p.z) + Dz_BF\n", " };\n", " }\n", " } // cs_geocentric_to_wgs84\n", " exports.geocentricToWgs84 = geocentricToWgs84;\n", " /****************************************************************/\n", " // pj_geocentic_from_wgs84()\n", " // coordinate system definition,\n", " // point to transform in geocentric coordinates (x,y,z)\n", " function geocentricFromWgs84(p, datum_type, datum_params) {\n", " if (datum_type === values_1.PJD_3PARAM) {\n", " //if( x[io] === HUGE_VAL )\n", " // continue;\n", " return {\n", " x: p.x - datum_params[0],\n", " y: p.y - datum_params[1],\n", " z: p.z - datum_params[2],\n", " };\n", " }\n", " else if (datum_type === values_1.PJD_7PARAM) {\n", " var Dx_BF = datum_params[0];\n", " var Dy_BF = datum_params[1];\n", " var Dz_BF = datum_params[2];\n", " var Rx_BF = datum_params[3];\n", " var Ry_BF = datum_params[4];\n", " var Rz_BF = datum_params[5];\n", " var M_BF = datum_params[6];\n", " var x_tmp = (p.x - Dx_BF) / M_BF;\n", " var y_tmp = (p.y - Dy_BF) / M_BF;\n", " var z_tmp = (p.z - Dz_BF) / M_BF;\n", " //if( x[io] === HUGE_VAL )\n", " // continue;\n", " return {\n", " x: x_tmp + Rz_BF * y_tmp - Ry_BF * z_tmp,\n", " y: -Rz_BF * x_tmp + y_tmp + Rx_BF * z_tmp,\n", " z: Ry_BF * x_tmp - Rx_BF * y_tmp + z_tmp\n", " };\n", " } //cs_geocentric_from_wgs84()\n", " }\n", " exports.geocentricFromWgs84 = geocentricFromWgs84;\n", " },\n", " /* proj4/lib/adjust_axis.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " function default_1(crs, denorm, point) {\n", " var xin = point.x, yin = point.y, zin = point.z || 0.0;\n", " var v, t, i;\n", " var out = {};\n", " for (i = 0; i < 3; i++) {\n", " if (denorm && i === 2 && point.z === undefined) {\n", " continue;\n", " }\n", " if (i === 0) {\n", " v = xin;\n", " if (\"ew\".indexOf(crs.axis[i]) !== -1) {\n", " t = 'x';\n", " }\n", " else {\n", " t = 'y';\n", " }\n", " }\n", " else if (i === 1) {\n", " v = yin;\n", " if (\"ns\".indexOf(crs.axis[i]) !== -1) {\n", " t = 'y';\n", " }\n", " else {\n", " t = 'x';\n", " }\n", " }\n", " else {\n", " v = zin;\n", " t = 'z';\n", " }\n", " switch (crs.axis[i]) {\n", " case 'e':\n", " case 'w':\n", " case 'n':\n", " case 's':\n", " out[t] = v;\n", " break;\n", " case 'u':\n", " if (point[t] !== undefined) {\n", " out.z = v;\n", " }\n", " break;\n", " case 'd':\n", " if (point[t] !== undefined) {\n", " out.z = -v;\n", " }\n", " break;\n", " default:\n", " //console.log(\"ERROR: unknow axis (\"+crs.axis[i]+\") - check definition of \"+crs.projName);\n", " return null;\n", " }\n", " }\n", " return out;\n", " }\n", " exports.default = default_1;\n", " },\n", " /* proj4/lib/common/toPoint.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " function default_1(array) {\n", " var out = {\n", " x: array[0],\n", " y: array[1]\n", " };\n", " if (array.length > 2) {\n", " out.z = array[2];\n", " }\n", " if (array.length > 3) {\n", " out.m = array[3];\n", " }\n", " return out;\n", " }\n", " exports.default = default_1;\n", " },\n", " /* proj4/lib/checkSanity.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " function default_1(point) {\n", " checkCoord(point.x);\n", " checkCoord(point.y);\n", " }\n", " exports.default = default_1;\n", " function checkCoord(num) {\n", " if (typeof Number.isFinite === 'function') {\n", " if (Number.isFinite(num)) {\n", " return;\n", " }\n", " throw new TypeError('coordinates must be finite numbers');\n", " }\n", " if (typeof num !== 'number' || num !== num || !isFinite(num)) {\n", " throw new TypeError('coordinates must be finite numbers');\n", " }\n", " }\n", " },\n", " /* models/renderers/renderer.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const dom_view_1 = require(66) /* ../../core/dom_view */;\n", " const visuals = tslib_1.__importStar(require(70) /* ../../core/visuals */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const model_1 = require(71) /* ../../model */;\n", " // This shouldn't be a DOMView, but annotations create a mess.\n", " class RendererView extends dom_view_1.DOMView {\n", " initialize() {\n", " super.initialize();\n", " this.visuals = new visuals.Visuals(this.model);\n", " this._has_finished = true; // XXX: should be in render() but subclasses don't respect super()\n", " }\n", " get plot_view() {\n", " return this.parent;\n", " }\n", " get plot_model() {\n", " return this.parent.model;\n", " }\n", " get layer() {\n", " const { canvas_view } = this.plot_view;\n", " return this.model.level == \"overlay\" ? canvas_view.overlays : canvas_view.primary;\n", " }\n", " request_render() {\n", " this.plot_view.request_render();\n", " }\n", " map_to_screen(x, y) {\n", " return this.plot_view.map_to_screen(x, y, this.model.x_range_name, this.model.y_range_name);\n", " }\n", " get needs_clip() {\n", " return false;\n", " }\n", " notify_finished() {\n", " this.plot_view.notify_finished();\n", " }\n", " get has_webgl() {\n", " return false;\n", " }\n", " }\n", " exports.RendererView = RendererView;\n", " RendererView.__name__ = \"RendererView\";\n", " class Renderer extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Renderer() {\n", " this.define({\n", " level: [p.RenderLevel],\n", " visible: [p.Boolean, true],\n", " });\n", " }\n", " }\n", " exports.Renderer = Renderer;\n", " Renderer.__name__ = \"Renderer\";\n", " Renderer.init_Renderer();\n", " },\n", " /* core/dom_view.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const view_1 = require(67) /* ./view */;\n", " const dom_1 = require(68) /* ./dom */;\n", " const DOM = tslib_1.__importStar(require(68) /* ./dom */);\n", " const root_css_1 = tslib_1.__importDefault(require(69) /* ../styles/root.css */);\n", " class DOMView extends view_1.View {\n", " initialize() {\n", " super.initialize();\n", " this._has_finished = false;\n", " if (this.is_root) {\n", " this._stylesheet = dom_1.stylesheet;\n", " }\n", " this._inject_styles();\n", " this.el = this._createElement();\n", " }\n", " remove() {\n", " DOM.removeElement(this.el);\n", " super.remove();\n", " }\n", " css_classes() {\n", " return [];\n", " }\n", " styles() {\n", " return [root_css_1.default];\n", " }\n", " cursor(_sx, _sy) {\n", " return null;\n", " }\n", " render() { }\n", " renderTo(element) {\n", " element.appendChild(this.el);\n", " this.render();\n", " }\n", " has_finished() {\n", " return this._has_finished;\n", " }\n", " get is_idle() {\n", " return this.has_finished();\n", " }\n", " get stylesheet() {\n", " if (this.is_root)\n", " return this._stylesheet;\n", " else\n", " return this.root.stylesheet;\n", " }\n", " _inject_styles() {\n", " const { stylesheet } = this;\n", " for (const style of this.styles()) {\n", " stylesheet.append(style);\n", " }\n", " }\n", " _createElement() {\n", " return DOM.createElement(this.tagName, { class: this.css_classes() });\n", " }\n", " }\n", " exports.DOMView = DOMView;\n", " DOMView.__name__ = \"DOMView\";\n", " DOMView.prototype.tagName = \"div\";\n", " },\n", " /* core/view.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const signaling_1 = require(14) /* ./signaling */;\n", " const types_1 = require(8) /* ./util/types */;\n", " class View {\n", " constructor(options) {\n", " this.removed = new signaling_1.Signal0(this, \"removed\");\n", " this._ready = Promise.resolve(undefined);\n", " if (options.model != null)\n", " this.model = options.model;\n", " else\n", " throw new Error(\"model of a view wasn't configured\");\n", " this._parent = options.parent;\n", " }\n", " get ready() {\n", " return this._ready;\n", " }\n", " connect(signal, slot) {\n", " const new_slot = (args, sender) => {\n", " const promise = Promise.resolve(slot.call(this, args, sender));\n", " this._ready = this._ready.then(() => promise);\n", " };\n", " return signal.connect(new_slot, this);\n", " }\n", " disconnect(signal, slot) {\n", " return signal.disconnect(slot, this);\n", " }\n", " initialize() { }\n", " async lazy_initialize() { }\n", " remove() {\n", " this._parent = undefined;\n", " this.disconnect_signals();\n", " this.removed.emit();\n", " }\n", " toString() {\n", " return `${this.model.type}View(${this.model.id})`;\n", " }\n", " serializable_state() {\n", " return { type: this.model.type };\n", " }\n", " get parent() {\n", " if (this._parent !== undefined)\n", " return this._parent;\n", " else\n", " throw new Error(\"parent of a view wasn't configured\");\n", " }\n", " get is_root() {\n", " return this.parent === null;\n", " }\n", " get root() {\n", " return this.is_root ? this : this.parent.root;\n", " }\n", " assert_root() {\n", " if (!this.is_root)\n", " throw new Error(`${this.toString()} is not a root layout`);\n", " }\n", " connect_signals() { }\n", " disconnect_signals() {\n", " signaling_1.Signal.disconnectReceiver(this);\n", " }\n", " on_change(properties, fn) {\n", " for (const property of types_1.isArray(properties) ? properties : [properties]) {\n", " this.connect(property.change, fn);\n", " }\n", " }\n", " }\n", " exports.View = View;\n", " View.__name__ = \"View\";\n", " },\n", " /* core/dom.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const types_1 = require(8) /* ./util/types */;\n", " const _createElement = (tag) => {\n", " return (attrs = {}, ...children) => {\n", " const element = document.createElement(tag);\n", " element.classList.add(\"bk\");\n", " for (const attr in attrs) {\n", " let value = attrs[attr];\n", " if (value == null || types_1.isBoolean(value) && !value)\n", " continue;\n", " if (attr === \"class\") {\n", " if (types_1.isString(value))\n", " value = value.split(/\\s+/);\n", " if (types_1.isArray(value)) {\n", " for (const cls of value) {\n", " if (cls != null)\n", " element.classList.add(cls);\n", " }\n", " continue;\n", " }\n", " }\n", " if (attr === \"style\" && types_1.isPlainObject(value)) {\n", " for (const prop in value) {\n", " element.style[prop] = value[prop];\n", " }\n", " continue;\n", " }\n", " if (attr === \"data\" && types_1.isPlainObject(value)) {\n", " for (const key in value) {\n", " element.dataset[key] = value[key]; // XXX: attrs needs a better type\n", " }\n", " continue;\n", " }\n", " element.setAttribute(attr, value);\n", " }\n", " function append(child) {\n", " if (child instanceof Element)\n", " element.appendChild(child);\n", " else if (types_1.isString(child))\n", " element.appendChild(document.createTextNode(child));\n", " else if (child != null && child !== false)\n", " throw new Error(`expected a DOM element, string, false or null, got ${JSON.stringify(child)}`);\n", " }\n", " for (const child of children) {\n", " if (types_1.isArray(child)) {\n", " for (const _child of child)\n", " append(_child);\n", " }\n", " else\n", " append(child);\n", " }\n", " return element;\n", " };\n", " };\n", " function createElement(tag, attrs, ...children) {\n", " return _createElement(tag)(attrs, ...children);\n", " }\n", " exports.createElement = createElement;\n", " exports.div = _createElement(\"div\"), exports.span = _createElement(\"span\"), exports.canvas = _createElement(\"canvas\"), exports.link = _createElement(\"link\"), exports.style = _createElement(\"style\"), exports.a = _createElement(\"a\"), exports.p = _createElement(\"p\"), exports.i = _createElement(\"i\"), exports.pre = _createElement(\"pre\"), exports.button = _createElement(\"button\"), exports.label = _createElement(\"label\"), exports.input = _createElement(\"input\"), exports.select = _createElement(\"select\"), exports.option = _createElement(\"option\"), exports.optgroup = _createElement(\"optgroup\"), exports.textarea = _createElement(\"textarea\");\n", " function nbsp() {\n", " return document.createTextNode(\"\\u00a0\");\n", " }\n", " exports.nbsp = nbsp;\n", " function append(element, ...children) {\n", " for (const child of children)\n", " element.appendChild(child);\n", " }\n", " exports.append = append;\n", " function remove(element) {\n", " const parent = element.parentNode;\n", " if (parent != null) {\n", " parent.removeChild(element);\n", " }\n", " }\n", " exports.remove = remove;\n", " exports.removeElement = remove;\n", " function replaceWith(element, replacement) {\n", " const parent = element.parentNode;\n", " if (parent != null) {\n", " parent.replaceChild(replacement, element);\n", " }\n", " }\n", " exports.replaceWith = replaceWith;\n", " function prepend(element, ...nodes) {\n", " const first = element.firstChild;\n", " for (const node of nodes) {\n", " element.insertBefore(node, first);\n", " }\n", " }\n", " exports.prepend = prepend;\n", " function empty(element, attrs = false) {\n", " let child;\n", " while (child = element.firstChild) {\n", " element.removeChild(child);\n", " }\n", " if (attrs) {\n", " for (const attr of element.attributes) {\n", " element.removeAttributeNode(attr);\n", " }\n", " }\n", " }\n", " exports.empty = empty;\n", " function display(element) {\n", " element.style.display = \"\";\n", " }\n", " exports.display = display;\n", " function undisplay(element) {\n", " element.style.display = \"none\";\n", " }\n", " exports.undisplay = undisplay;\n", " function show(element) {\n", " element.style.visibility = \"\";\n", " }\n", " exports.show = show;\n", " function hide(element) {\n", " element.style.visibility = \"hidden\";\n", " }\n", " exports.hide = hide;\n", " function offset(element) {\n", " const rect = element.getBoundingClientRect();\n", " return {\n", " top: rect.top + window.pageYOffset - document.documentElement.clientTop,\n", " left: rect.left + window.pageXOffset - document.documentElement.clientLeft,\n", " };\n", " }\n", " exports.offset = offset;\n", " function matches(el, selector) {\n", " const p = Element.prototype;\n", " const f = p.matches || p.webkitMatchesSelector || p.mozMatchesSelector || p.msMatchesSelector;\n", " return f.call(el, selector);\n", " }\n", " exports.matches = matches;\n", " function parent(el, selector) {\n", " let node = el;\n", " while (node = node.parentElement) {\n", " if (matches(node, selector))\n", " return node;\n", " }\n", " return null;\n", " }\n", " exports.parent = parent;\n", " function num(value) {\n", " return parseFloat(value) || 0;\n", " }\n", " function extents(el) {\n", " const style = getComputedStyle(el);\n", " return {\n", " border: {\n", " top: num(style.borderTopWidth),\n", " bottom: num(style.borderBottomWidth),\n", " left: num(style.borderLeftWidth),\n", " right: num(style.borderRightWidth),\n", " },\n", " margin: {\n", " top: num(style.marginTop),\n", " bottom: num(style.marginBottom),\n", " left: num(style.marginLeft),\n", " right: num(style.marginRight),\n", " },\n", " padding: {\n", " top: num(style.paddingTop),\n", " bottom: num(style.paddingBottom),\n", " left: num(style.paddingLeft),\n", " right: num(style.paddingRight),\n", " },\n", " };\n", " }\n", " exports.extents = extents;\n", " function size(el) {\n", " const rect = el.getBoundingClientRect();\n", " return {\n", " width: Math.ceil(rect.width),\n", " height: Math.ceil(rect.height),\n", " };\n", " }\n", " exports.size = size;\n", " function scroll_size(el) {\n", " return {\n", " width: Math.ceil(el.scrollWidth),\n", " height: Math.ceil(el.scrollHeight),\n", " };\n", " }\n", " exports.scroll_size = scroll_size;\n", " function outer_size(el) {\n", " const { margin: { left, right, top, bottom } } = extents(el);\n", " const { width, height } = size(el);\n", " return {\n", " width: Math.ceil(width + left + right),\n", " height: Math.ceil(height + top + bottom),\n", " };\n", " }\n", " exports.outer_size = outer_size;\n", " function content_size(el) {\n", " const { left, top } = el.getBoundingClientRect();\n", " const { padding } = extents(el);\n", " let width = 0;\n", " let height = 0;\n", " for (const child of el.children) {\n", " const rect = child.getBoundingClientRect();\n", " width = Math.max(width, Math.ceil(rect.left - left - padding.left + rect.width));\n", " height = Math.max(height, Math.ceil(rect.top - top - padding.top + rect.height));\n", " }\n", " return { width, height };\n", " }\n", " exports.content_size = content_size;\n", " function position(el, box, margin) {\n", " const { style } = el;\n", " style.left = `${box.x}px`;\n", " style.top = `${box.y}px`;\n", " style.width = `${box.width}px`;\n", " style.height = `${box.height}px`;\n", " if (margin == null)\n", " style.margin = \"\";\n", " else {\n", " const { top, right, bottom, left } = margin;\n", " style.margin = `${top}px ${right}px ${bottom}px ${left}px`;\n", " }\n", " }\n", " exports.position = position;\n", " function children(el) {\n", " return Array.from(el.children);\n", " }\n", " exports.children = children;\n", " class ClassList {\n", " constructor(el) {\n", " this.el = el;\n", " this.classList = el.classList;\n", " }\n", " get values() {\n", " const values = [];\n", " for (let i = 0; i < this.classList.length; i++) {\n", " const item = this.classList.item(i);\n", " if (item != null)\n", " values.push(item);\n", " }\n", " return values;\n", " }\n", " has(cls) {\n", " return this.classList.contains(cls);\n", " }\n", " add(...classes) {\n", " for (const cls of classes)\n", " this.classList.add(cls);\n", " return this;\n", " }\n", " remove(...classes) {\n", " for (const cls of classes)\n", " this.classList.remove(cls);\n", " return this;\n", " }\n", " clear() {\n", " for (const cls of this.values) {\n", " if (cls != \"bk\")\n", " this.classList.remove(cls);\n", " }\n", " return this;\n", " }\n", " toggle(cls, activate) {\n", " const add = activate != null ? activate : !this.has(cls);\n", " if (add)\n", " this.add(cls);\n", " else\n", " this.remove(cls);\n", " return this;\n", " }\n", " }\n", " exports.ClassList = ClassList;\n", " ClassList.__name__ = \"ClassList\";\n", " function classes(el) {\n", " return new ClassList(el);\n", " }\n", " exports.classes = classes;\n", " function toggle_attribute(el, attr, state) {\n", " if (state == null) {\n", " state = !el.hasAttribute(attr);\n", " }\n", " if (state)\n", " el.setAttribute(attr, \"true\");\n", " else\n", " el.removeAttribute(attr);\n", " }\n", " exports.toggle_attribute = toggle_attribute;\n", " (function (Keys) {\n", " Keys[Keys[\"Backspace\"] = 8] = \"Backspace\";\n", " Keys[Keys[\"Tab\"] = 9] = \"Tab\";\n", " Keys[Keys[\"Enter\"] = 13] = \"Enter\";\n", " Keys[Keys[\"Esc\"] = 27] = \"Esc\";\n", " Keys[Keys[\"PageUp\"] = 33] = \"PageUp\";\n", " Keys[Keys[\"PageDown\"] = 34] = \"PageDown\";\n", " Keys[Keys[\"Left\"] = 37] = \"Left\";\n", " Keys[Keys[\"Up\"] = 38] = \"Up\";\n", " Keys[Keys[\"Right\"] = 39] = \"Right\";\n", " Keys[Keys[\"Down\"] = 40] = \"Down\";\n", " Keys[Keys[\"Delete\"] = 46] = \"Delete\";\n", " })(exports.Keys || (exports.Keys = {}));\n", " function undisplayed(el, fn) {\n", " const { display } = el.style;\n", " el.style.display = \"none\";\n", " try {\n", " return fn();\n", " }\n", " finally {\n", " el.style.display = display;\n", " }\n", " }\n", " exports.undisplayed = undisplayed;\n", " function unsized(el, fn) {\n", " return sized(el, {}, fn);\n", " }\n", " exports.unsized = unsized;\n", " function sized(el, size, fn) {\n", " const { width, height, position, display } = el.style;\n", " el.style.position = \"absolute\";\n", " el.style.display = \"\";\n", " el.style.width = size.width != null && size.width != Infinity ? `${size.width}px` : \"auto\";\n", " el.style.height = size.height != null && size.height != Infinity ? `${size.height}px` : \"auto\";\n", " try {\n", " return fn();\n", " }\n", " finally {\n", " el.style.position = position;\n", " el.style.display = display;\n", " el.style.width = width;\n", " el.style.height = height;\n", " }\n", " }\n", " exports.sized = sized;\n", " class StyleSheet {\n", " constructor(root) {\n", " this.root = root;\n", " this.known = new Set();\n", " this.style = exports.style({ type: \"text/css\" });\n", " prepend(root, this.style);\n", " }\n", " append(css) {\n", " if (!this.known.has(css)) {\n", " this.style.appendChild(document.createTextNode(css));\n", " this.known.add(css);\n", " }\n", " }\n", " }\n", " exports.StyleSheet = StyleSheet;\n", " StyleSheet.__name__ = \"StyleSheet\";\n", " exports.stylesheet = new StyleSheet(document.head);\n", " },\n", " /* styles/root.css.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const css = `\n", " .bk-root {\n", " position: relative;\n", " width: auto;\n", " height: auto;\n", " z-index: 0;\n", " box-sizing: border-box;\n", " font-family: Helvetica, Arial, sans-serif;\n", " font-size: 13px;\n", " }\n", " .bk-root .bk,\n", " .bk-root .bk:before,\n", " .bk-root .bk:after {\n", " box-sizing: inherit;\n", " margin: 0;\n", " border: 0;\n", " padding: 0;\n", " background-image: none;\n", " font-family: inherit;\n", " font-size: 100%;\n", " line-height: 1.42857143;\n", " }\n", " .bk-root pre.bk {\n", " font-family: Courier, monospace;\n", " }\n", " `;\n", " exports.default = css;\n", " },\n", " /* core/visuals.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const mixins = tslib_1.__importStar(require(23) /* ./property_mixins */);\n", " const p = tslib_1.__importStar(require(18) /* ./properties */);\n", " const color_1 = require(20) /* ./util/color */;\n", " const arrayable_1 = require(12) /* ./util/arrayable */;\n", " function _horz(ctx, h, h2) {\n", " ctx.moveTo(0, h2 + 0.5);\n", " ctx.lineTo(h, h2 + 0.5);\n", " ctx.stroke();\n", " }\n", " function _vert(ctx, h, h2) {\n", " ctx.moveTo(h2 + 0.5, 0);\n", " ctx.lineTo(h2 + 0.5, h);\n", " ctx.stroke();\n", " }\n", " function _x(ctx, h) {\n", " ctx.moveTo(0, h);\n", " ctx.lineTo(h, 0);\n", " ctx.stroke();\n", " ctx.moveTo(0, 0);\n", " ctx.lineTo(h, h);\n", " ctx.stroke();\n", " }\n", " function _get_canvas(size) {\n", " const canvas = document.createElement('canvas');\n", " canvas.width = size;\n", " canvas.height = size;\n", " return canvas;\n", " }\n", " function create_hatch_canvas(hatch_pattern, hatch_color, hatch_scale, hatch_weight) {\n", " const h = hatch_scale;\n", " const h2 = h / 2;\n", " const h4 = h2 / 2;\n", " const canvas = _get_canvas(hatch_scale);\n", " const ctx = canvas.getContext(\"2d\");\n", " ctx.strokeStyle = hatch_color;\n", " ctx.lineCap = \"square\";\n", " ctx.fillStyle = hatch_color;\n", " ctx.lineWidth = hatch_weight;\n", " switch (hatch_pattern) {\n", " // we should not need these if code conditions on hatch.doit, but\n", " // include them here just for completeness\n", " case \" \":\n", " case \"blank\":\n", " break;\n", " case \".\":\n", " case \"dot\":\n", " ctx.arc(h2, h2, h2 / 2, 0, 2 * Math.PI, true);\n", " ctx.fill();\n", " break;\n", " case \"o\":\n", " case \"ring\":\n", " ctx.arc(h2, h2, h2 / 2, 0, 2 * Math.PI, true);\n", " ctx.stroke();\n", " break;\n", " case \"-\":\n", " case \"horizontal_line\":\n", " _horz(ctx, h, h2);\n", " break;\n", " case \"|\":\n", " case \"vertical_line\":\n", " _vert(ctx, h, h2);\n", " break;\n", " case \"+\":\n", " case \"cross\":\n", " _horz(ctx, h, h2);\n", " _vert(ctx, h, h2);\n", " break;\n", " case \"\\\"\":\n", " case \"horizontal_dash\":\n", " _horz(ctx, h2, h2);\n", " break;\n", " case \":\":\n", " case \"vertical_dash\":\n", " _vert(ctx, h2, h2);\n", " break;\n", " case \"@\":\n", " case \"spiral\":\n", " const h30 = h / 30;\n", " ctx.moveTo(h2, h2);\n", " for (let i = 0; i < 360; i++) {\n", " const angle = 0.1 * i;\n", " const x = h2 + (h30 * angle) * Math.cos(angle);\n", " const y = h2 + (h30 * angle) * Math.sin(angle);\n", " ctx.lineTo(x, y);\n", " }\n", " ctx.stroke();\n", " break;\n", " case \"/\":\n", " case \"right_diagonal_line\":\n", " ctx.moveTo(-h4 + 0.5, h);\n", " ctx.lineTo(h4 + 0.5, 0);\n", " ctx.stroke();\n", " ctx.moveTo(h4 + 0.5, h);\n", " ctx.lineTo(3 * h4 + 0.5, 0);\n", " ctx.stroke();\n", " ctx.moveTo(3 * h4 + 0.5, h);\n", " ctx.lineTo(5 * h4 + 0.5, 0);\n", " ctx.stroke();\n", " ctx.stroke();\n", " break;\n", " case \"\\\\\":\n", " case \"left_diagonal_line\":\n", " ctx.moveTo(h4 + 0.5, h);\n", " ctx.lineTo(-h4 + 0.5, 0);\n", " ctx.stroke();\n", " ctx.moveTo(3 * h4 + 0.5, h);\n", " ctx.lineTo(h4 + 0.5, 0);\n", " ctx.stroke();\n", " ctx.moveTo(5 * h4 + 0.5, h);\n", " ctx.lineTo(3 * h4 + 0.5, 0);\n", " ctx.stroke();\n", " ctx.stroke();\n", " break;\n", " case \"x\":\n", " case \"diagonal_cross\":\n", " _x(ctx, h);\n", " break;\n", " case \",\":\n", " case \"right_diagonal_dash\":\n", " ctx.moveTo(h4 + 0.5, 3 * h4 + 0.5);\n", " ctx.lineTo(3 * h4 + 0.5, h4 + 0.5);\n", " ctx.stroke();\n", " break;\n", " case \"`\":\n", " case \"left_diagonal_dash\":\n", " ctx.moveTo(h4 + 0.5, h4 + 0.5);\n", " ctx.lineTo(3 * h4 + 0.5, 3 * h4 + 0.5);\n", " ctx.stroke();\n", " break;\n", " case \"v\":\n", " case \"horizontal_wave\":\n", " ctx.moveTo(0, h4);\n", " ctx.lineTo(h2, 3 * h4);\n", " ctx.lineTo(h, h4);\n", " ctx.stroke();\n", " break;\n", " case \">\":\n", " case \"vertical_wave\":\n", " ctx.moveTo(h4, 0);\n", " ctx.lineTo(3 * h4, h2);\n", " ctx.lineTo(h4, h);\n", " ctx.stroke();\n", " break;\n", " case \"*\":\n", " case \"criss_cross\":\n", " _x(ctx, h);\n", " _horz(ctx, h, h2);\n", " _vert(ctx, h, h2);\n", " break;\n", " }\n", " return canvas;\n", " }\n", " class ContextProperties {\n", " constructor(obj, prefix = \"\") {\n", " this.obj = obj;\n", " this.prefix = prefix;\n", " this.cache = {};\n", " for (const attr of this.attrs)\n", " this[attr] = obj.properties[prefix + attr];\n", " }\n", " warm_cache(source) {\n", " for (const attr of this.attrs) {\n", " const prop = this.obj.properties[this.prefix + attr];\n", " if (prop.spec.value !== undefined) // TODO (bev) better test?\n", " this.cache[attr] = prop.spec.value;\n", " else if (source != null && prop instanceof p.VectorSpec)\n", " this.cache[attr + \"_array\"] = prop.array(source);\n", " else\n", " throw new Error(\"source is required with a vectorized visual property\");\n", " }\n", " }\n", " cache_select(attr, i) {\n", " const prop = this.obj.properties[this.prefix + attr];\n", " let value;\n", " if (prop.spec.value !== undefined) // TODO (bev) better test?\n", " this.cache[attr] = value = prop.spec.value;\n", " else\n", " this.cache[attr] = value = this.cache[attr + \"_array\"][i];\n", " return value;\n", " }\n", " get_array(attr) {\n", " const array = this.cache[attr + \"_array\"];\n", " if (this.all_indices != null) {\n", " return arrayable_1.map(this.all_indices, (i) => array[i]);\n", " }\n", " else {\n", " return array;\n", " }\n", " }\n", " set_vectorize(ctx, i) {\n", " if (this.all_indices != null) // all_indices is set by a Visuals instance associated with a CDSView\n", " this._set_vectorize(ctx, this.all_indices[i]);\n", " else // all_indices is not set for annotations which may have vectorized visual props\n", " this._set_vectorize(ctx, i);\n", " }\n", " }\n", " exports.ContextProperties = ContextProperties;\n", " ContextProperties.__name__ = \"ContextProperties\";\n", " class Line extends ContextProperties {\n", " set_value(ctx) {\n", " ctx.strokeStyle = this.line_color.value();\n", " ctx.globalAlpha = this.line_alpha.value();\n", " ctx.lineWidth = this.line_width.value();\n", " ctx.lineJoin = this.line_join.value();\n", " ctx.lineCap = this.line_cap.value();\n", " ctx.setLineDash(this.line_dash.value());\n", " ctx.setLineDashOffset(this.line_dash_offset.value());\n", " }\n", " get doit() {\n", " return !(this.line_color.spec.value === null ||\n", " this.line_alpha.spec.value == 0 ||\n", " this.line_width.spec.value == 0);\n", " }\n", " _set_vectorize(ctx, i) {\n", " this.cache_select(\"line_color\", i);\n", " ctx.strokeStyle = this.cache.line_color;\n", " this.cache_select(\"line_alpha\", i);\n", " ctx.globalAlpha = this.cache.line_alpha;\n", " this.cache_select(\"line_width\", i);\n", " ctx.lineWidth = this.cache.line_width;\n", " this.cache_select(\"line_join\", i);\n", " ctx.lineJoin = this.cache.line_join;\n", " this.cache_select(\"line_cap\", i);\n", " ctx.lineCap = this.cache.line_cap;\n", " this.cache_select(\"line_dash\", i);\n", " ctx.setLineDash(this.cache.line_dash);\n", " this.cache_select(\"line_dash_offset\", i);\n", " ctx.setLineDashOffset(this.cache.line_dash_offset);\n", " }\n", " color_value() {\n", " return color_1.color2css(this.line_color.value(), this.line_alpha.value());\n", " }\n", " }\n", " exports.Line = Line;\n", " Line.__name__ = \"Line\";\n", " Line.prototype.attrs = Object.keys(mixins.LineVector);\n", " class Fill extends ContextProperties {\n", " set_value(ctx) {\n", " ctx.fillStyle = this.fill_color.value();\n", " ctx.globalAlpha = this.fill_alpha.value();\n", " }\n", " get doit() {\n", " return !(this.fill_color.spec.value === null ||\n", " this.fill_alpha.spec.value == 0);\n", " }\n", " _set_vectorize(ctx, i) {\n", " this.cache_select(\"fill_color\", i);\n", " ctx.fillStyle = this.cache.fill_color;\n", " this.cache_select(\"fill_alpha\", i);\n", " ctx.globalAlpha = this.cache.fill_alpha;\n", " }\n", " color_value() {\n", " return color_1.color2css(this.fill_color.value(), this.fill_alpha.value());\n", " }\n", " }\n", " exports.Fill = Fill;\n", " Fill.__name__ = \"Fill\";\n", " Fill.prototype.attrs = Object.keys(mixins.FillVector);\n", " class Hatch extends ContextProperties {\n", " cache_select(name, i) {\n", " let value;\n", " if (name == \"pattern\") {\n", " this.cache_select(\"hatch_color\", i);\n", " this.cache_select(\"hatch_scale\", i);\n", " this.cache_select(\"hatch_pattern\", i);\n", " this.cache_select(\"hatch_weight\", i);\n", " const { hatch_color, hatch_scale, hatch_pattern, hatch_weight, hatch_extra } = this.cache;\n", " if (hatch_extra != null && hatch_extra.hasOwnProperty(hatch_pattern)) {\n", " const custom = hatch_extra[hatch_pattern];\n", " this.cache.pattern = custom.get_pattern(hatch_color, hatch_scale, hatch_weight);\n", " }\n", " else {\n", " this.cache.pattern = (ctx) => {\n", " const canvas = create_hatch_canvas(hatch_pattern, hatch_color, hatch_scale, hatch_weight);\n", " return ctx.createPattern(canvas, 'repeat');\n", " };\n", " }\n", " }\n", " else\n", " value = super.cache_select(name, i);\n", " return value;\n", " }\n", " _try_defer(defer_func) {\n", " const { hatch_pattern, hatch_extra } = this.cache;\n", " if (hatch_extra != null && hatch_extra.hasOwnProperty(hatch_pattern)) {\n", " const custom = hatch_extra[hatch_pattern];\n", " custom.onload(defer_func);\n", " }\n", " }\n", " get doit() {\n", " return !(this.hatch_color.spec.value === null ||\n", " this.hatch_alpha.spec.value == 0 ||\n", " this.hatch_pattern.spec.value == \" \" ||\n", " this.hatch_pattern.spec.value == \"blank\" ||\n", " this.hatch_pattern.spec.value === null);\n", " }\n", " doit2(ctx, i, ready_func, defer_func) {\n", " if (!this.doit) {\n", " return;\n", " }\n", " this.cache_select(\"pattern\", i);\n", " const pattern = this.cache.pattern(ctx);\n", " if (pattern == null) {\n", " this._try_defer(defer_func);\n", " }\n", " else {\n", " this.set_vectorize(ctx, i);\n", " ready_func();\n", " }\n", " }\n", " _set_vectorize(ctx, i) {\n", " this.cache_select(\"pattern\", i);\n", " ctx.fillStyle = this.cache.pattern(ctx);\n", " this.cache_select(\"hatch_alpha\", i);\n", " ctx.globalAlpha = this.cache.hatch_alpha;\n", " }\n", " color_value() {\n", " return color_1.color2css(this.hatch_color.value(), this.hatch_alpha.value());\n", " }\n", " }\n", " exports.Hatch = Hatch;\n", " Hatch.__name__ = \"Hatch\";\n", " Hatch.prototype.attrs = Object.keys(mixins.HatchVector);\n", " class Text extends ContextProperties {\n", " color_value() {\n", " return color_1.color2css(this.text_color.value(), this.text_alpha.value());\n", " }\n", " font_value() {\n", " const text_font = this.text_font.value();\n", " const text_font_size = this.text_font_size.value();\n", " const text_font_style = this.text_font_style.value();\n", " return `${text_font_style} ${text_font_size} ${text_font}`;\n", " }\n", " v_font_value(i) {\n", " super.cache_select(\"text_font_style\", i);\n", " super.cache_select(\"text_font_size\", i);\n", " super.cache_select(\"text_font\", i);\n", " const { text_font_style, text_font_size, text_font } = this.cache;\n", " return `${text_font_style} ${text_font_size} ${text_font}`;\n", " }\n", " cache_select(name, i) {\n", " let value;\n", " if (name == \"font\") {\n", " this.cache.font = value = this.v_font_value(i);\n", " }\n", " else\n", " value = super.cache_select(name, i);\n", " return value;\n", " }\n", " set_value(ctx) {\n", " ctx.font = this.font_value();\n", " ctx.fillStyle = this.text_color.value();\n", " ctx.globalAlpha = this.text_alpha.value();\n", " ctx.textAlign = this.text_align.value();\n", " ctx.textBaseline = this.text_baseline.value();\n", " }\n", " get doit() {\n", " return !(this.text_color.spec.value === null ||\n", " this.text_alpha.spec.value == 0);\n", " }\n", " _set_vectorize(ctx, i) {\n", " this.cache_select(\"font\", i);\n", " ctx.font = this.cache.font;\n", " this.cache_select(\"text_color\", i);\n", " ctx.fillStyle = this.cache.text_color;\n", " this.cache_select(\"text_alpha\", i);\n", " ctx.globalAlpha = this.cache.text_alpha;\n", " this.cache_select(\"text_align\", i);\n", " ctx.textAlign = this.cache.text_align;\n", " this.cache_select(\"text_baseline\", i);\n", " ctx.textBaseline = this.cache.text_baseline;\n", " }\n", " }\n", " exports.Text = Text;\n", " Text.__name__ = \"Text\";\n", " Text.prototype.attrs = Object.keys(mixins.TextVector);\n", " class Visuals {\n", " constructor(model) {\n", " for (const mixin of model._mixins) {\n", " const [name, prefix = \"\"] = mixin.split(\":\");\n", " let cls;\n", " switch (name) {\n", " case \"line\":\n", " cls = Line;\n", " break;\n", " case \"fill\":\n", " cls = Fill;\n", " break;\n", " case \"hatch\":\n", " cls = Hatch;\n", " break;\n", " case \"text\":\n", " cls = Text;\n", " break;\n", " default:\n", " throw new Error(`unknown visual: ${name}`);\n", " }\n", " this[prefix + name] = new cls(model, prefix);\n", " }\n", " }\n", " warm_cache(source) {\n", " for (const name in this) {\n", " if (this.hasOwnProperty(name)) {\n", " const prop = this[name];\n", " if (prop instanceof ContextProperties)\n", " prop.warm_cache(source);\n", " }\n", " }\n", " }\n", " set_all_indices(all_indices) {\n", " for (const name in this) {\n", " if (this.hasOwnProperty(name)) {\n", " const prop = this[name];\n", " if (prop instanceof ContextProperties)\n", " prop.all_indices = all_indices;\n", " }\n", " }\n", " }\n", " }\n", " exports.Visuals = Visuals;\n", " Visuals.__name__ = \"Visuals\";\n", " },\n", " /* model.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const has_props_1 = require(13) /* ./core/has_props */;\n", " const p = tslib_1.__importStar(require(18) /* ./core/properties */);\n", " const types_1 = require(8) /* ./core/util/types */;\n", " const object_1 = require(17) /* ./core/util/object */;\n", " const logging_1 = require(72) /* ./core/logging */;\n", " class Model extends has_props_1.HasProps {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Model() {\n", " this.define({\n", " tags: [p.Array, []],\n", " name: [p.String],\n", " js_property_callbacks: [p.Any, {}],\n", " js_event_callbacks: [p.Any, {}],\n", " subscribed_events: [p.Array, []],\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " this._js_callbacks = new Map();\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this._update_property_callbacks();\n", " this.connect(this.properties.js_property_callbacks.change, () => this._update_property_callbacks());\n", " this.connect(this.properties.js_event_callbacks.change, () => this._update_event_callbacks());\n", " this.connect(this.properties.subscribed_events.change, () => this._update_event_callbacks());\n", " }\n", " /*protected*/ _process_event(event) {\n", " for (const callback of this.js_event_callbacks[event.event_name] || [])\n", " callback.execute(event);\n", " if (this.document != null && this.subscribed_events.some((m) => m == event.event_name))\n", " this.document.event_manager.send_event(event);\n", " }\n", " trigger_event(event) {\n", " if (this.document != null) {\n", " event.origin = this;\n", " this.document.event_manager.trigger(event);\n", " }\n", " }\n", " _update_event_callbacks() {\n", " if (this.document == null) {\n", " // File an issue: SidePanel in particular seems to have this issue\n", " logging_1.logger.warn('WARNING: Document not defined for updating event callbacks');\n", " return;\n", " }\n", " this.document.event_manager.subscribed_models.add(this);\n", " }\n", " _update_property_callbacks() {\n", " const signal_for = (event) => {\n", " const [evt, attr = null] = event.split(\":\");\n", " return attr != null ? this.properties[attr][evt] : this[evt];\n", " };\n", " for (const [event, callbacks] of this._js_callbacks) {\n", " const signal = signal_for(event);\n", " for (const cb of callbacks)\n", " this.disconnect(signal, cb);\n", " }\n", " this._js_callbacks.clear();\n", " for (const [event, callbacks] of object_1.entries(this.js_property_callbacks)) {\n", " const wrappers = callbacks.map((cb) => () => cb.execute(this));\n", " this._js_callbacks.set(event, wrappers);\n", " const signal = signal_for(event);\n", " for (const cb of wrappers)\n", " this.connect(signal, cb);\n", " }\n", " }\n", " _doc_attached() {\n", " if (!object_1.isEmpty(this.js_event_callbacks) || this.subscribed_events.length != 0)\n", " this._update_event_callbacks();\n", " }\n", " _doc_detached() {\n", " this.document.event_manager.subscribed_models.delete(this);\n", " }\n", " select(selector) {\n", " if (types_1.isString(selector))\n", " return [...this.references()].filter((ref) => ref instanceof Model && ref.name === selector);\n", " else if (selector.prototype instanceof has_props_1.HasProps)\n", " return [...this.references()].filter((ref) => ref instanceof selector);\n", " else\n", " throw new Error(\"invalid selector\");\n", " }\n", " select_one(selector) {\n", " const result = this.select(selector);\n", " switch (result.length) {\n", " case 0:\n", " return null;\n", " case 1:\n", " return result[0];\n", " default:\n", " throw new Error(\"found more than one object matching given selector\");\n", " }\n", " }\n", " }\n", " exports.Model = Model;\n", " Model.__name__ = \"Model\";\n", " Model.init_Model();\n", " },\n", " /* core/logging.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " // This is based on https://github.com/pimterry/loglevel\n", " const types_1 = require(8) /* ./util/types */;\n", " const _loggers = {};\n", " class LogLevel {\n", " constructor(name, level) {\n", " this.name = name;\n", " this.level = level;\n", " }\n", " }\n", " exports.LogLevel = LogLevel;\n", " LogLevel.__name__ = \"LogLevel\";\n", " class Logger {\n", " constructor(name, level = Logger.INFO) {\n", " this._name = name;\n", " this.set_level(level);\n", " }\n", " static get levels() {\n", " return Object.keys(Logger.log_levels);\n", " }\n", " static get(name, level = Logger.INFO) {\n", " if (name.length > 0) {\n", " let logger = _loggers[name];\n", " if (logger == null)\n", " _loggers[name] = logger = new Logger(name, level);\n", " return logger;\n", " }\n", " else\n", " throw new TypeError(\"Logger.get() expects a non-empty string name and an optional log-level\");\n", " }\n", " get level() {\n", " return this.get_level();\n", " }\n", " get_level() {\n", " return this._log_level;\n", " }\n", " set_level(log_level) {\n", " if (log_level instanceof LogLevel)\n", " this._log_level = log_level;\n", " else if (types_1.isString(log_level) && Logger.log_levels[log_level] != null)\n", " this._log_level = Logger.log_levels[log_level];\n", " else\n", " throw new Error(\"Logger.set_level() expects a log-level object or a string name of a log-level\");\n", " const logger_name = `[${this._name}]`;\n", " for (const name in Logger.log_levels) {\n", " const log_level = Logger.log_levels[name];\n", " if (log_level.level < this._log_level.level || this._log_level.level === Logger.OFF.level)\n", " this[name] = function () { };\n", " else\n", " this[name] = _method_factory(name, logger_name);\n", " }\n", " }\n", " trace(..._args) { }\n", " debug(..._args) { }\n", " info(..._args) { }\n", " warn(..._args) { }\n", " error(..._args) { }\n", " }\n", " exports.Logger = Logger;\n", " Logger.__name__ = \"Logger\";\n", " Logger.TRACE = new LogLevel(\"trace\", 0);\n", " Logger.DEBUG = new LogLevel(\"debug\", 1);\n", " Logger.INFO = new LogLevel(\"info\", 2);\n", " Logger.WARN = new LogLevel(\"warn\", 6);\n", " Logger.ERROR = new LogLevel(\"error\", 7);\n", " Logger.FATAL = new LogLevel(\"fatal\", 8);\n", " Logger.OFF = new LogLevel(\"off\", 9);\n", " Logger.log_levels = {\n", " trace: Logger.TRACE,\n", " debug: Logger.DEBUG,\n", " info: Logger.INFO,\n", " warn: Logger.WARN,\n", " error: Logger.ERROR,\n", " fatal: Logger.FATAL,\n", " off: Logger.OFF,\n", " };\n", " function _method_factory(method_name, logger_name) {\n", " if (console[method_name] != null)\n", " return console[method_name].bind(console, logger_name);\n", " else if (console.log != null)\n", " return console.log.bind(console, logger_name);\n", " else\n", " return function () { };\n", " }\n", " exports.logger = Logger.get(\"bokeh\");\n", " function set_log_level(level) {\n", " const previous_level = exports.logger.level;\n", " if (types_1.isString(level) && Logger.log_levels[level] == null) {\n", " console.log(`[bokeh] unrecognized logging level '${level}' passed to Bokeh.set_log_level(), ignoring`);\n", " console.log(`[bokeh] valid log levels are: ${Logger.levels.join(', ')}`);\n", " }\n", " else {\n", " console.log(`[bokeh] setting log level to: '${types_1.isString(level) ? level : level.level}'`);\n", " exports.logger.set_level(level);\n", " }\n", " return previous_level;\n", " }\n", " exports.set_log_level = set_log_level;\n", " function with_log_level(level, fn) {\n", " const original = set_log_level(level);\n", " try {\n", " fn();\n", " }\n", " finally {\n", " set_log_level(original);\n", " }\n", " }\n", " exports.with_log_level = with_log_level;\n", " },\n", " /* styles/annotations.css.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const css = `\n", " .bk-root .bk-shading {\n", " position: absolute;\n", " display: block;\n", " border: 1px dashed green;\n", " }\n", " `;\n", " exports.default = css;\n", " },\n", " /* models/annotations/arrow.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const annotation_1 = require(31) /* ./annotation */;\n", " const arrow_head_1 = require(75) /* ./arrow_head */;\n", " const column_data_source_1 = require(76) /* ../sources/column_data_source */;\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const math_1 = require(10) /* ../../core/util/math */;\n", " class ArrowView extends annotation_1.AnnotationView {\n", " initialize() {\n", " super.initialize();\n", " if (this.model.source == null)\n", " this.model.source = new column_data_source_1.ColumnDataSource();\n", " this.set_data(this.model.source);\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.change, () => this.set_data(this.model.source));\n", " this.connect(this.model.source.streaming, () => this.set_data(this.model.source));\n", " this.connect(this.model.source.patching, () => this.set_data(this.model.source));\n", " }\n", " set_data(source) {\n", " super.set_data(source);\n", " this.visuals.warm_cache(source);\n", " this.plot_view.request_render();\n", " }\n", " _map_data() {\n", " const { frame } = this.plot_view;\n", " let sx_start, sy_start;\n", " if (this.model.start_units == 'data') {\n", " sx_start = frame.xscales[this.model.x_range_name].v_compute(this._x_start);\n", " sy_start = frame.yscales[this.model.y_range_name].v_compute(this._y_start);\n", " }\n", " else {\n", " sx_start = frame.xview.v_compute(this._x_start);\n", " sy_start = frame.yview.v_compute(this._y_start);\n", " }\n", " let sx_end, sy_end;\n", " if (this.model.end_units == 'data') {\n", " sx_end = frame.xscales[this.model.x_range_name].v_compute(this._x_end);\n", " sy_end = frame.yscales[this.model.y_range_name].v_compute(this._y_end);\n", " }\n", " else {\n", " sx_end = frame.xview.v_compute(this._x_end);\n", " sy_end = frame.yview.v_compute(this._y_end);\n", " }\n", " return [[sx_start, sy_start], [sx_end, sy_end]];\n", " }\n", " render() {\n", " if (!this.model.visible)\n", " return;\n", " const { ctx } = this.layer;\n", " ctx.save();\n", " // Order in this function is important. First we draw all the arrow heads.\n", " const [start, end] = this._map_data();\n", " if (this.model.end != null)\n", " this._arrow_head(ctx, \"render\", this.model.end, start, end);\n", " if (this.model.start != null)\n", " this._arrow_head(ctx, \"render\", this.model.start, end, start);\n", " // Next we call .clip on all the arrow heads, inside an initial canvas sized\n", " // rect, to create an \"inverted\" clip region for the arrow heads\n", " ctx.beginPath();\n", " const { x, y, width, height } = this.plot_view.frame.bbox;\n", " ctx.rect(x, y, width, height);\n", " if (this.model.end != null)\n", " this._arrow_head(ctx, \"clip\", this.model.end, start, end);\n", " if (this.model.start != null)\n", " this._arrow_head(ctx, \"clip\", this.model.start, end, start);\n", " ctx.closePath();\n", " ctx.clip();\n", " // Finally we draw the arrow body, with the clipping regions set up. This prevents\n", " // \"fat\" arrows from overlapping the arrow head in a bad way.\n", " this._arrow_body(ctx, start, end);\n", " ctx.restore();\n", " }\n", " _arrow_head(ctx, action, head, start, end) {\n", " for (let i = 0, _end = this._x_start.length; i < _end; i++) {\n", " // arrow head runs orthogonal to arrow body\n", " const angle = Math.PI / 2 + math_1.atan2([start[0][i], start[1][i]], [end[0][i], end[1][i]]);\n", " ctx.save();\n", " ctx.translate(end[0][i], end[1][i]);\n", " ctx.rotate(angle);\n", " if (action == \"render\")\n", " head.render(ctx, i);\n", " else if (action == \"clip\")\n", " head.clip(ctx, i);\n", " ctx.restore();\n", " }\n", " }\n", " _arrow_body(ctx, start, end) {\n", " if (!this.visuals.line.doit)\n", " return;\n", " for (let i = 0, n = this._x_start.length; i < n; i++) {\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.beginPath();\n", " ctx.moveTo(start[0][i], start[1][i]);\n", " ctx.lineTo(end[0][i], end[1][i]);\n", " ctx.stroke();\n", " }\n", " }\n", " }\n", " exports.ArrowView = ArrowView;\n", " ArrowView.__name__ = \"ArrowView\";\n", " class Arrow extends annotation_1.Annotation {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Arrow() {\n", " this.prototype.default_view = ArrowView;\n", " this.mixins(property_mixins_1.LineVector);\n", " this.define({\n", " x_start: [p.NumberSpec],\n", " y_start: [p.NumberSpec],\n", " start_units: [p.SpatialUnits, 'data'],\n", " start: [p.Instance, null],\n", " x_end: [p.NumberSpec],\n", " y_end: [p.NumberSpec],\n", " end_units: [p.SpatialUnits, 'data'],\n", " end: [p.Instance, () => new arrow_head_1.OpenHead({})],\n", " source: [p.Instance],\n", " x_range_name: [p.String, 'default'],\n", " y_range_name: [p.String, 'default'],\n", " });\n", " }\n", " }\n", " exports.Arrow = Arrow;\n", " Arrow.__name__ = \"Arrow\";\n", " Arrow.init_Arrow();\n", " },\n", " /* models/annotations/arrow_head.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const annotation_1 = require(31) /* ./annotation */;\n", " const visuals_1 = require(70) /* ../../core/visuals */;\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class ArrowHead extends annotation_1.Annotation {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ArrowHead() {\n", " this.define({\n", " size: [p.Number, 25],\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.visuals = new visuals_1.Visuals(this);\n", " }\n", " }\n", " exports.ArrowHead = ArrowHead;\n", " ArrowHead.__name__ = \"ArrowHead\";\n", " ArrowHead.init_ArrowHead();\n", " class OpenHead extends ArrowHead {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_OpenHead() {\n", " this.mixins(property_mixins_1.LineVector);\n", " }\n", " clip(ctx, i) {\n", " // This method should not begin or close a path\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.moveTo(0.5 * this.size, this.size);\n", " ctx.lineTo(0.5 * this.size, -2);\n", " ctx.lineTo(-0.5 * this.size, -2);\n", " ctx.lineTo(-0.5 * this.size, this.size);\n", " ctx.lineTo(0, 0);\n", " ctx.lineTo(0.5 * this.size, this.size);\n", " }\n", " render(ctx, i) {\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.beginPath();\n", " ctx.moveTo(0.5 * this.size, this.size);\n", " ctx.lineTo(0, 0);\n", " ctx.lineTo(-0.5 * this.size, this.size);\n", " ctx.stroke();\n", " }\n", " }\n", " }\n", " exports.OpenHead = OpenHead;\n", " OpenHead.__name__ = \"OpenHead\";\n", " OpenHead.init_OpenHead();\n", " class NormalHead extends ArrowHead {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_NormalHead() {\n", " this.mixins([property_mixins_1.LineVector, property_mixins_1.FillVector]);\n", " this.override({\n", " fill_color: 'black',\n", " });\n", " }\n", " clip(ctx, i) {\n", " // This method should not begin or close a path\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.moveTo(0.5 * this.size, this.size);\n", " ctx.lineTo(0.5 * this.size, -2);\n", " ctx.lineTo(-0.5 * this.size, -2);\n", " ctx.lineTo(-0.5 * this.size, this.size);\n", " ctx.lineTo(0.5 * this.size, this.size);\n", " }\n", " render(ctx, i) {\n", " if (this.visuals.fill.doit) {\n", " this.visuals.fill.set_vectorize(ctx, i);\n", " this._normal(ctx, i);\n", " ctx.fill();\n", " }\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_vectorize(ctx, i);\n", " this._normal(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " _normal(ctx, _i) {\n", " ctx.beginPath();\n", " ctx.moveTo(0.5 * this.size, this.size);\n", " ctx.lineTo(0, 0);\n", " ctx.lineTo(-0.5 * this.size, this.size);\n", " ctx.closePath();\n", " }\n", " }\n", " exports.NormalHead = NormalHead;\n", " NormalHead.__name__ = \"NormalHead\";\n", " NormalHead.init_NormalHead();\n", " class VeeHead extends ArrowHead {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_VeeHead() {\n", " this.mixins([property_mixins_1.LineVector, property_mixins_1.FillVector]);\n", " this.override({\n", " fill_color: 'black',\n", " });\n", " }\n", " clip(ctx, i) {\n", " // This method should not begin or close a path\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.moveTo(0.5 * this.size, this.size);\n", " ctx.lineTo(0.5 * this.size, -2);\n", " ctx.lineTo(-0.5 * this.size, -2);\n", " ctx.lineTo(-0.5 * this.size, this.size);\n", " ctx.lineTo(0, 0.5 * this.size);\n", " ctx.lineTo(0.5 * this.size, this.size);\n", " }\n", " render(ctx, i) {\n", " if (this.visuals.fill.doit) {\n", " this.visuals.fill.set_vectorize(ctx, i);\n", " this._vee(ctx, i);\n", " ctx.fill();\n", " }\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_vectorize(ctx, i);\n", " this._vee(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " _vee(ctx, _i) {\n", " ctx.beginPath();\n", " ctx.moveTo(0.5 * this.size, this.size);\n", " ctx.lineTo(0, 0);\n", " ctx.lineTo(-0.5 * this.size, this.size);\n", " ctx.lineTo(0, 0.5 * this.size);\n", " ctx.closePath();\n", " }\n", " }\n", " exports.VeeHead = VeeHead;\n", " VeeHead.__name__ = \"VeeHead\";\n", " VeeHead.init_VeeHead();\n", " class TeeHead extends ArrowHead {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_TeeHead() {\n", " this.mixins(property_mixins_1.LineVector);\n", " }\n", " render(ctx, i) {\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.beginPath();\n", " ctx.moveTo(0.5 * this.size, 0);\n", " ctx.lineTo(-0.5 * this.size, 0);\n", " ctx.stroke();\n", " }\n", " }\n", " clip(_ctx, _i) { }\n", " }\n", " exports.TeeHead = TeeHead;\n", " TeeHead.__name__ = \"TeeHead\";\n", " TeeHead.init_TeeHead();\n", " },\n", " /* models/sources/column_data_source.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const columnar_data_source_1 = require(77) /* ./columnar_data_source */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const object_1 = require(17) /* ../../core/util/object */;\n", " const typed_array = tslib_1.__importStar(require(103) /* ../../core/util/typed_array */);\n", " const set_1 = require(104) /* ../../core/util/set */;\n", " const events_1 = require(105) /* ../../document/events */;\n", " //exported for testing\n", " function stream_to_column(col, new_col, rollover) {\n", " if (types_1.isArray(col)) {\n", " const result = col.concat(new_col);\n", " if (rollover != null && result.length > rollover)\n", " return result.slice(-rollover);\n", " else\n", " return result;\n", " }\n", " else if (types_1.isTypedArray(col)) {\n", " const total_len = col.length + new_col.length;\n", " // handle rollover case for typed arrays\n", " if (rollover != null && total_len > rollover) {\n", " const start = total_len - rollover;\n", " const end = col.length;\n", " // resize col if it is shorter than the rollover length\n", " let result;\n", " if (col.length < rollover) {\n", " result = new col.constructor(rollover);\n", " result.set(col, 0);\n", " }\n", " else\n", " result = col;\n", " // shift values in original col to accommodate new_col\n", " for (let i = start, endi = end; i < endi; i++) {\n", " result[i - start] = result[i];\n", " }\n", " // update end values in col with new_col\n", " for (let i = 0, endi = new_col.length; i < endi; i++) {\n", " result[i + (end - start)] = new_col[i];\n", " }\n", " return result;\n", " }\n", " else {\n", " const tmp = new col.constructor(new_col);\n", " return typed_array.concat(col, tmp);\n", " }\n", " }\n", " else\n", " throw new Error(\"unsupported array types\");\n", " }\n", " exports.stream_to_column = stream_to_column;\n", " // exported for testing\n", " function slice(ind, length) {\n", " let start, step, stop;\n", " if (types_1.isNumber(ind)) {\n", " start = ind;\n", " stop = ind + 1;\n", " step = 1;\n", " }\n", " else {\n", " start = ind.start != null ? ind.start : 0;\n", " stop = ind.stop != null ? ind.stop : length;\n", " step = ind.step != null ? ind.step : 1;\n", " }\n", " return [start, stop, step];\n", " }\n", " exports.slice = slice;\n", " // exported for testing\n", " function patch_to_column(col, patch) {\n", " const patched = new Set();\n", " let patched_range = false;\n", " for (const [ind, val] of patch) {\n", " // make the single index case look like the length-3 multi-index case\n", " let shape;\n", " let item;\n", " let index;\n", " let value;\n", " if (types_1.isArray(ind)) {\n", " const [i] = ind;\n", " patched.add(i);\n", " shape = col[i].shape;\n", " item = col[i];\n", " value = val;\n", " // this is basically like NumPy's \"newaxis\", inserting an empty dimension\n", " // makes length 2 and 3 multi-index cases uniform, so that the same code\n", " // can handle both\n", " if (ind.length === 2) {\n", " shape = [1, shape[0]];\n", " index = [ind[0], 0, ind[1]];\n", " }\n", " else\n", " index = ind;\n", " }\n", " else {\n", " if (types_1.isNumber(ind)) {\n", " value = [val];\n", " patched.add(ind);\n", " }\n", " else {\n", " value = val;\n", " patched_range = true;\n", " }\n", " index = [0, 0, ind];\n", " shape = [1, col.length];\n", " item = col;\n", " }\n", " // now this one nested loop handles all cases\n", " let flat_index = 0;\n", " const [istart, istop, istep] = slice(index[1], shape[0]);\n", " const [jstart, jstop, jstep] = slice(index[2], shape[1]);\n", " for (let i = istart; i < istop; i += istep) {\n", " for (let j = jstart; j < jstop; j += jstep) {\n", " if (patched_range) {\n", " patched.add(j);\n", " }\n", " item[i * shape[1] + j] = value[flat_index];\n", " flat_index++;\n", " }\n", " }\n", " }\n", " return patched;\n", " }\n", " exports.patch_to_column = patch_to_column;\n", " class ColumnDataSource extends columnar_data_source_1.ColumnarDataSource {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ColumnDataSource() {\n", " this.define({\n", " data: [p.Any, {}],\n", " });\n", " }\n", " stream(new_data, rollover, setter_id) {\n", " const { data } = this;\n", " for (const k in new_data) {\n", " data[k] = stream_to_column(data[k], new_data[k], rollover);\n", " }\n", " this.setv({ data }, { silent: true });\n", " this.streaming.emit();\n", " if (this.document != null) {\n", " const hint = new events_1.ColumnsStreamedEvent(this.document, this.ref(), new_data, rollover);\n", " this.document._notify_change(this, 'data', null, null, { setter_id, hint });\n", " }\n", " }\n", " patch(patches, setter_id) {\n", " const { data } = this;\n", " let patched = new Set();\n", " for (const [column, patch] of object_1.entries(patches)) {\n", " patched = set_1.union(patched, patch_to_column(data[column], patch)); // XXX\n", " }\n", " this.setv({ data }, { silent: true });\n", " this.patching.emit([...patched]);\n", " if (this.document != null) {\n", " const hint = new events_1.ColumnsPatchedEvent(this.document, this.ref(), patches);\n", " this.document._notify_change(this, 'data', null, null, { setter_id, hint });\n", " }\n", " }\n", " }\n", " exports.ColumnDataSource = ColumnDataSource;\n", " ColumnDataSource.__name__ = \"ColumnDataSource\";\n", " ColumnDataSource.init_ColumnDataSource();\n", " },\n", " /* models/sources/columnar_data_source.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const data_source_1 = require(78) /* ./data_source */;\n", " const signaling_1 = require(14) /* ../../core/signaling */;\n", " const logging_1 = require(72) /* ../../core/logging */;\n", " const selection_manager_1 = require(80) /* ../../core/selection_manager */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const object_1 = require(17) /* ../../core/util/object */;\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " const interaction_policy_1 = require(102) /* ../selections/interaction_policy */;\n", " class ColumnarDataSource extends data_source_1.DataSource {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " get_array(key) {\n", " let column = this.data[key];\n", " if (column == null)\n", " this.data[key] = column = [];\n", " else if (!types_1.isArray(column))\n", " this.data[key] = column = Array.from(column);\n", " return column;\n", " }\n", " static init_ColumnarDataSource() {\n", " this.define({\n", " selection_policy: [p.Instance, () => new interaction_policy_1.UnionRenderers()],\n", " });\n", " this.internal({\n", " selection_manager: [p.Instance, (self) => new selection_manager_1.SelectionManager({ source: self })],\n", " inspected: [p.Instance, () => new selection_1.Selection()],\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " this._select = new signaling_1.Signal0(this, \"select\");\n", " this.inspect = new signaling_1.Signal(this, \"inspect\"); // XXX: <[indices, tool, renderer-view, source, data], this>\n", " this.streaming = new signaling_1.Signal0(this, \"streaming\");\n", " this.patching = new signaling_1.Signal(this, \"patching\");\n", " }\n", " get_column(colname) {\n", " const column = this.data[colname];\n", " return column != null ? column : null;\n", " }\n", " columns() {\n", " // return the column names in this data source\n", " return object_1.keys(this.data);\n", " }\n", " get_length(soft = true) {\n", " const lengths = array_1.uniq(object_1.values(this.data).map((v) => v.length));\n", " switch (lengths.length) {\n", " case 0: {\n", " return null; // XXX: don't guess, treat on case-by-case basis\n", " }\n", " case 1: {\n", " return lengths[0];\n", " }\n", " default: {\n", " const msg = \"data source has columns of inconsistent lengths\";\n", " if (soft) {\n", " logging_1.logger.warn(msg);\n", " return lengths.sort()[0];\n", " }\n", " else\n", " throw new Error(msg);\n", " }\n", " }\n", " }\n", " get_indices() {\n", " const length = this.get_length();\n", " return array_1.range(0, length != null ? length : 1);\n", " //TODO: returns [0] when no data, should it?\n", " }\n", " clear() {\n", " const empty = {};\n", " for (const col of this.columns()) {\n", " empty[col] = new this.data[col].constructor(0);\n", " }\n", " this.data = empty;\n", " }\n", " }\n", " exports.ColumnarDataSource = ColumnarDataSource;\n", " ColumnarDataSource.__name__ = \"ColumnarDataSource\";\n", " ColumnarDataSource.init_ColumnarDataSource();\n", " },\n", " /* models/sources/data_source.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const model_1 = require(71) /* ../../model */;\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class DataSource extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_DataSource() {\n", " this.define({\n", " selected: [p.Instance, () => new selection_1.Selection()],\n", " });\n", " }\n", " }\n", " exports.DataSource = DataSource;\n", " DataSource.__name__ = \"DataSource\";\n", " DataSource.init_DataSource();\n", " },\n", " /* models/selections/selection.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const model_1 = require(71) /* ../../model */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const object_1 = require(17) /* ../../core/util/object */;\n", " class Selection extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Selection() {\n", " this.define({\n", " indices: [p.Array, []],\n", " line_indices: [p.Array, []],\n", " multiline_indices: [p.Any, {}],\n", " });\n", " this.internal({\n", " selected_glyphs: [p.Array, []],\n", " get_view: [p.Any],\n", " image_indices: [p.Array, []],\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.get_view = () => null;\n", " }\n", " static from_hits(hits) {\n", " const indices = array_1.sort_by(hits, ([, dist]) => dist).map(([i]) => i);\n", " return new Selection({ indices });\n", " }\n", " get selected_glyph() {\n", " return this.selected_glyphs.length > 0 ? this.selected_glyphs[0] : null;\n", " }\n", " add_to_selected_glyphs(glyph) {\n", " this.selected_glyphs.push(glyph);\n", " }\n", " update(selection, _final = true, mode = \"replace\") {\n", " switch (mode) {\n", " case \"replace\": {\n", " this.indices = selection.indices;\n", " this.line_indices = selection.line_indices;\n", " this.selected_glyphs = selection.selected_glyphs;\n", " this.get_view = selection.get_view;\n", " this.multiline_indices = selection.multiline_indices;\n", " this.image_indices = selection.image_indices;\n", " break;\n", " }\n", " case \"append\": {\n", " this.update_through_union(selection);\n", " break;\n", " }\n", " case \"intersect\": {\n", " this.update_through_intersection(selection);\n", " break;\n", " }\n", " case \"subtract\": {\n", " this.update_through_subtraction(selection);\n", " break;\n", " }\n", " }\n", " }\n", " clear() {\n", " this.indices = [];\n", " this.line_indices = [];\n", " this.multiline_indices = {};\n", " this.get_view = () => null;\n", " this.selected_glyphs = [];\n", " }\n", " is_empty() {\n", " return this.indices.length == 0 && this.line_indices.length == 0 && this.image_indices.length == 0;\n", " }\n", " update_through_union(other) {\n", " this.indices = array_1.union(this.indices, other.indices);\n", " this.selected_glyphs = array_1.union(other.selected_glyphs, this.selected_glyphs);\n", " this.line_indices = array_1.union(other.line_indices, this.line_indices);\n", " if (!this.get_view())\n", " this.get_view = other.get_view;\n", " this.multiline_indices = object_1.merge(other.multiline_indices, this.multiline_indices);\n", " }\n", " update_through_intersection(other) {\n", " this.indices = array_1.intersection(this.indices, other.indices);\n", " // TODO: think through and fix any logic below\n", " this.selected_glyphs = array_1.union(other.selected_glyphs, this.selected_glyphs);\n", " this.line_indices = array_1.union(other.line_indices, this.line_indices);\n", " if (!this.get_view())\n", " this.get_view = other.get_view;\n", " this.multiline_indices = object_1.merge(other.multiline_indices, this.multiline_indices);\n", " }\n", " update_through_subtraction(other) {\n", " this.indices = array_1.difference(this.indices, other.indices);\n", " // TODO: think through and fix any logic below\n", " this.selected_glyphs = array_1.union(other.selected_glyphs, this.selected_glyphs);\n", " this.line_indices = array_1.union(other.line_indices, this.line_indices);\n", " if (!this.get_view())\n", " this.get_view = other.get_view;\n", " this.multiline_indices = object_1.merge(other.multiline_indices, this.multiline_indices);\n", " }\n", " }\n", " exports.Selection = Selection;\n", " Selection.__name__ = \"Selection\";\n", " Selection.init_Selection();\n", " },\n", " /* core/selection_manager.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const has_props_1 = require(13) /* ./has_props */;\n", " const selection_1 = require(79) /* ../models/selections/selection */;\n", " const glyph_renderer_1 = require(81) /* ../models/renderers/glyph_renderer */;\n", " const graph_renderer_1 = require(100) /* ../models/renderers/graph_renderer */;\n", " const p = tslib_1.__importStar(require(18) /* ./properties */);\n", " class SelectionManager extends has_props_1.HasProps {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.inspectors = new Map();\n", " }\n", " static init_SelectionManager() {\n", " this.internal({\n", " source: [p.Any],\n", " });\n", " }\n", " select(renderer_views, geometry, final, mode = \"replace\") {\n", " // divide renderers into glyph_renderers or graph_renderers\n", " const glyph_renderer_views = [];\n", " const graph_renderer_views = [];\n", " for (const r of renderer_views) {\n", " if (r instanceof glyph_renderer_1.GlyphRendererView)\n", " glyph_renderer_views.push(r);\n", " else if (r instanceof graph_renderer_1.GraphRendererView)\n", " graph_renderer_views.push(r);\n", " }\n", " let did_hit = false;\n", " // graph renderer case\n", " for (const r of graph_renderer_views) {\n", " const hit_test_result = r.model.selection_policy.hit_test(geometry, r);\n", " did_hit = did_hit || r.model.selection_policy.do_selection(hit_test_result, r.model, final, mode);\n", " }\n", " // glyph renderers\n", " if (glyph_renderer_views.length > 0) {\n", " const hit_test_result = this.source.selection_policy.hit_test(geometry, glyph_renderer_views);\n", " did_hit = did_hit || this.source.selection_policy.do_selection(hit_test_result, this.source, final, mode);\n", " }\n", " return did_hit;\n", " }\n", " inspect(renderer_view, geometry) {\n", " let did_hit = false;\n", " if (renderer_view instanceof glyph_renderer_1.GlyphRendererView) {\n", " const hit_test_result = renderer_view.hit_test(geometry);\n", " if (hit_test_result != null) {\n", " did_hit = !hit_test_result.is_empty();\n", " const inspection = this.get_or_create_inspector(renderer_view.model);\n", " inspection.update(hit_test_result, true, \"replace\");\n", " this.source.setv({ inspected: inspection }, { silent: true });\n", " this.source.inspect.emit([renderer_view, { geometry }]);\n", " }\n", " }\n", " else if (renderer_view instanceof graph_renderer_1.GraphRendererView) {\n", " const hit_test_result = renderer_view.model.inspection_policy.hit_test(geometry, renderer_view);\n", " did_hit = did_hit || renderer_view.model.inspection_policy.do_inspection(hit_test_result, geometry, renderer_view, false, \"replace\");\n", " }\n", " return did_hit;\n", " }\n", " clear(rview) {\n", " this.source.selected.clear();\n", " if (rview != null)\n", " this.get_or_create_inspector(rview.model).clear();\n", " }\n", " get_or_create_inspector(renderer) {\n", " let selection = this.inspectors.get(renderer);\n", " if (selection == null) {\n", " selection = new selection_1.Selection();\n", " this.inspectors.set(renderer, selection);\n", " }\n", " return selection;\n", " }\n", " }\n", " exports.SelectionManager = SelectionManager;\n", " SelectionManager.__name__ = \"SelectionManager\";\n", " SelectionManager.init_SelectionManager();\n", " },\n", " /* models/renderers/glyph_renderer.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const data_renderer_1 = require(82) /* ./data_renderer */;\n", " const line_1 = require(83) /* ../glyphs/line */;\n", " const patch_1 = require(94) /* ../glyphs/patch */;\n", " const harea_1 = require(95) /* ../glyphs/harea */;\n", " const varea_1 = require(97) /* ../glyphs/varea */;\n", " const cds_view_1 = require(98) /* ../sources/cds_view */;\n", " const logging_1 = require(72) /* ../../core/logging */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const arrayable_1 = require(12) /* ../../core/util/arrayable */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const object_1 = require(17) /* ../../core/util/object */;\n", " const build_views_1 = require(99) /* ../../core/build_views */;\n", " const factor_range_1 = require(90) /* ../ranges/factor_range */;\n", " const selection_defaults = {\n", " fill: {},\n", " line: {},\n", " };\n", " const decimated_defaults = {\n", " fill: { fill_alpha: 0.3, fill_color: \"grey\" },\n", " line: { line_alpha: 0.3, line_color: \"grey\" },\n", " };\n", " const nonselection_defaults = {\n", " fill: { fill_alpha: 0.2 },\n", " line: {},\n", " };\n", " class GlyphRendererView extends data_renderer_1.DataRendererView {\n", " async lazy_initialize() {\n", " await super.lazy_initialize();\n", " const base_glyph = this.model.glyph;\n", " const has_fill = array_1.includes(base_glyph._mixins, \"fill\");\n", " const has_line = array_1.includes(base_glyph._mixins, \"line\");\n", " const glyph_attrs = object_1.clone(base_glyph.attributes);\n", " delete glyph_attrs.id;\n", " function mk_glyph(defaults) {\n", " const attrs = object_1.clone(glyph_attrs);\n", " if (has_fill)\n", " object_1.extend(attrs, defaults.fill);\n", " if (has_line)\n", " object_1.extend(attrs, defaults.line);\n", " return new base_glyph.constructor(attrs);\n", " }\n", " this.glyph = await this.build_glyph_view(base_glyph);\n", " let { selection_glyph } = this.model;\n", " if (selection_glyph == null)\n", " selection_glyph = mk_glyph({ fill: {}, line: {} });\n", " else if (selection_glyph === \"auto\")\n", " selection_glyph = mk_glyph(selection_defaults);\n", " this.selection_glyph = await this.build_glyph_view(selection_glyph);\n", " let { nonselection_glyph } = this.model;\n", " if ((nonselection_glyph == null))\n", " nonselection_glyph = mk_glyph({ fill: {}, line: {} });\n", " else if (nonselection_glyph === \"auto\")\n", " nonselection_glyph = mk_glyph(nonselection_defaults);\n", " this.nonselection_glyph = await this.build_glyph_view(nonselection_glyph);\n", " const { hover_glyph } = this.model;\n", " if (hover_glyph != null)\n", " this.hover_glyph = await this.build_glyph_view(hover_glyph);\n", " const { muted_glyph } = this.model;\n", " if (muted_glyph != null)\n", " this.muted_glyph = await this.build_glyph_view(muted_glyph);\n", " const decimated_glyph = mk_glyph(decimated_defaults);\n", " this.decimated_glyph = await this.build_glyph_view(decimated_glyph);\n", " this.xscale = this.plot_view.frame.xscales[this.model.x_range_name];\n", " this.yscale = this.plot_view.frame.yscales[this.model.y_range_name];\n", " this.set_data(false);\n", " }\n", " async build_glyph_view(glyph) {\n", " return build_views_1.build_view(glyph, { parent: this });\n", " }\n", " remove() {\n", " var _a, _b;\n", " this.glyph.remove();\n", " this.selection_glyph.remove();\n", " this.nonselection_glyph.remove();\n", " (_a = this.hover_glyph) === null || _a === void 0 ? void 0 : _a.remove();\n", " (_b = this.muted_glyph) === null || _b === void 0 ? void 0 : _b.remove();\n", " this.decimated_glyph.remove();\n", " super.remove();\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.change, () => this.request_render());\n", " this.connect(this.model.glyph.change, () => this.set_data());\n", " this.connect(this.model.data_source.change, () => this.set_data());\n", " this.connect(this.model.data_source.streaming, () => this.set_data());\n", " this.connect(this.model.data_source.patching, (indices /* XXX: WHY? */) => this.set_data(true, indices));\n", " this.connect(this.model.data_source.selected.change, () => this.request_render());\n", " this.connect(this.model.data_source._select, () => this.request_render());\n", " if (this.hover_glyph != null)\n", " this.connect(this.model.data_source.inspect, () => this.request_render());\n", " this.connect(this.model.properties.view.change, () => this.set_data());\n", " this.connect(this.model.view.change, () => this.set_data());\n", " this.connect(this.model.properties.visible.change, () => this.plot_view.update_dataranges());\n", " const { x_ranges, y_ranges } = this.plot_view.frame;\n", " for (const name in x_ranges) {\n", " const rng = x_ranges[name];\n", " if (rng instanceof factor_range_1.FactorRange)\n", " this.connect(rng.change, () => this.set_data());\n", " }\n", " for (const name in y_ranges) {\n", " const rng = y_ranges[name];\n", " if (rng instanceof factor_range_1.FactorRange)\n", " this.connect(rng.change, () => this.set_data());\n", " }\n", " this.connect(this.model.glyph.transformchange, () => this.set_data());\n", " }\n", " have_selection_glyphs() {\n", " return this.selection_glyph != null && this.nonselection_glyph != null;\n", " }\n", " // in case of partial updates like patching, the list of indices that actually\n", " // changed may be passed as the \"indices\" parameter to afford any optional optimizations\n", " set_data(request_render = true, indices = null) {\n", " const t0 = Date.now();\n", " const source = this.model.data_source;\n", " this.all_indices = this.model.view.indices;\n", " // TODO (bev) this is a bit clunky, need to make sure glyphs use the correct ranges when they call\n", " // mapping functions on the base Renderer class\n", " this.glyph.model.setv({ x_range_name: this.model.x_range_name,\n", " y_range_name: this.model.y_range_name }, { silent: true });\n", " this.glyph.set_data(source, this.all_indices, indices);\n", " this.glyph.set_visuals(source, this.all_indices);\n", " this.decimated_glyph.set_visuals(source, this.all_indices);\n", " if (this.have_selection_glyphs()) {\n", " this.selection_glyph.set_visuals(source, this.all_indices);\n", " this.nonselection_glyph.set_visuals(source, this.all_indices);\n", " }\n", " if (this.hover_glyph != null)\n", " this.hover_glyph.set_visuals(source, this.all_indices);\n", " if (this.muted_glyph != null)\n", " this.muted_glyph.set_visuals(source, this.all_indices);\n", " const { lod_factor } = this.plot_model;\n", " this.decimated = [];\n", " for (let i = 0, end = Math.floor(this.all_indices.length / lod_factor); i < end; i++) {\n", " this.decimated.push(i * lod_factor);\n", " }\n", " const dt = Date.now() - t0;\n", " logging_1.logger.debug(`${this.glyph.model.type} ${this.model}): set_data finished in ${dt}ms`);\n", " this.set_data_timestamp = Date.now();\n", " if (request_render)\n", " this.request_render();\n", " }\n", " get has_webgl() {\n", " return this.glyph.has_webgl;\n", " }\n", " render() {\n", " if (!this.model.visible)\n", " return;\n", " const t0 = Date.now();\n", " const glsupport = this.has_webgl;\n", " this.glyph.map_data();\n", " const dtmap = Date.now() - t0;\n", " const tmask = Date.now();\n", " // all_indices is in full data space, indices is converted to subset space\n", " // either by mask_data (that uses the spatial index) or manually\n", " let indices = this.glyph.mask_data(this.all_indices);\n", " if (indices.length === this.all_indices.length) {\n", " indices = array_1.range(0, this.all_indices.length);\n", " }\n", " const dtmask = Date.now() - tmask;\n", " const { ctx } = this.layer;\n", " ctx.save();\n", " // selected is in full set space\n", " const { selected } = this.model.data_source;\n", " let selected_full_indices;\n", " if (!selected || selected.is_empty())\n", " selected_full_indices = [];\n", " else {\n", " if (this.glyph instanceof line_1.LineView && selected.selected_glyph === this.glyph.model)\n", " selected_full_indices = this.model.view.convert_indices_from_subset(indices);\n", " else\n", " selected_full_indices = selected.indices;\n", " }\n", " // inspected is in full set space\n", " const { inspected } = this.model.data_source;\n", " const inspected_full_indices = new Set((() => {\n", " if (!inspected || inspected.is_empty())\n", " return [];\n", " else {\n", " if (inspected.selected_glyph)\n", " return this.model.view.convert_indices_from_subset(indices);\n", " else if (inspected.indices.length > 0)\n", " return inspected.indices;\n", " else {\n", " // TODO: return inspected.multiline_indices.keys()\n", " return Object.keys(inspected.multiline_indices).map((i) => parseInt(i));\n", " }\n", " }\n", " })());\n", " // inspected is transformed to subset space\n", " const inspected_subset_indices = arrayable_1.filter(indices, (i) => inspected_full_indices.has(this.all_indices[i]));\n", " const { lod_threshold } = this.plot_model;\n", " let glyph;\n", " let nonselection_glyph;\n", " let selection_glyph;\n", " if ((this.model.document != null ? this.model.document.interactive_duration() > 0 : false)\n", " && !glsupport && lod_threshold != null && this.all_indices.length > lod_threshold) {\n", " // Render decimated during interaction if too many elements and not using GL\n", " indices = this.decimated;\n", " glyph = this.decimated_glyph;\n", " nonselection_glyph = this.decimated_glyph;\n", " selection_glyph = this.selection_glyph;\n", " }\n", " else {\n", " glyph = this.model.muted && this.muted_glyph != null ? this.muted_glyph : this.glyph;\n", " nonselection_glyph = this.nonselection_glyph;\n", " selection_glyph = this.selection_glyph;\n", " }\n", " if (this.hover_glyph != null && inspected_subset_indices.length)\n", " indices = array_1.difference(indices, inspected_subset_indices);\n", " // Render with no selection\n", " let dtselect = null;\n", " let trender;\n", " if (!(selected_full_indices.length && this.have_selection_glyphs())) {\n", " trender = Date.now();\n", " if (this.glyph instanceof line_1.LineView) {\n", " if (this.hover_glyph && inspected_subset_indices.length)\n", " this.hover_glyph.render(ctx, this.model.view.convert_indices_from_subset(inspected_subset_indices), this.glyph);\n", " else\n", " glyph.render(ctx, this.all_indices, this.glyph);\n", " }\n", " else if (this.glyph instanceof patch_1.PatchView || this.glyph instanceof harea_1.HAreaView || this.glyph instanceof varea_1.VAreaView) {\n", " if (inspected.selected_glyphs.length == 0 || this.hover_glyph == null) {\n", " glyph.render(ctx, this.all_indices, this.glyph);\n", " }\n", " else {\n", " for (const sglyph of inspected.selected_glyphs) {\n", " if (sglyph == this.glyph.model)\n", " this.hover_glyph.render(ctx, this.all_indices, this.glyph);\n", " }\n", " }\n", " }\n", " else {\n", " glyph.render(ctx, indices, this.glyph);\n", " if (this.hover_glyph && inspected_subset_indices.length)\n", " this.hover_glyph.render(ctx, inspected_subset_indices, this.glyph);\n", " }\n", " // Render with selection\n", " }\n", " else {\n", " // reset the selection mask\n", " const tselect = Date.now();\n", " const selected_mask = {};\n", " for (const i of selected_full_indices) {\n", " selected_mask[i] = true;\n", " }\n", " // intersect/different selection with render mask\n", " const selected_subset_indices = new Array();\n", " const nonselected_subset_indices = new Array();\n", " // now, selected is changed to subset space, except for Line glyph\n", " if (this.glyph instanceof line_1.LineView) {\n", " for (const i of this.all_indices) {\n", " if (selected_mask[i] != null)\n", " selected_subset_indices.push(i);\n", " else\n", " nonselected_subset_indices.push(i);\n", " }\n", " }\n", " else {\n", " for (const i of indices) {\n", " if (selected_mask[this.all_indices[i]] != null)\n", " selected_subset_indices.push(i);\n", " else\n", " nonselected_subset_indices.push(i);\n", " }\n", " }\n", " dtselect = Date.now() - tselect;\n", " trender = Date.now();\n", " nonselection_glyph.render(ctx, nonselected_subset_indices, this.glyph);\n", " selection_glyph.render(ctx, selected_subset_indices, this.glyph);\n", " if (this.hover_glyph != null) {\n", " if (this.glyph instanceof line_1.LineView)\n", " this.hover_glyph.render(ctx, this.model.view.convert_indices_from_subset(inspected_subset_indices), this.glyph);\n", " else\n", " this.hover_glyph.render(ctx, inspected_subset_indices, this.glyph);\n", " }\n", " }\n", " const dtrender = Date.now() - trender;\n", " this.last_dtrender = dtrender;\n", " const dttot = Date.now() - t0;\n", " logging_1.logger.debug(`${this.glyph.model.type} ${this.model}: render finished in ${dttot}ms`);\n", " logging_1.logger.trace(` - map_data finished in : ${dtmap}ms`);\n", " logging_1.logger.trace(` - mask_data finished in : ${dtmask}ms`);\n", " if (dtselect != null) {\n", " logging_1.logger.trace(` - selection mask finished in : ${dtselect}ms`);\n", " }\n", " logging_1.logger.trace(` - glyph renders finished in : ${dtrender}ms`);\n", " ctx.restore();\n", " }\n", " draw_legend(ctx, x0, x1, y0, y1, field, label, index) {\n", " if (index == null)\n", " index = this.model.get_reference_point(field, label);\n", " this.glyph.draw_legend_for_index(ctx, { x0, x1, y0, y1 }, index);\n", " }\n", " hit_test(geometry) {\n", " if (!this.model.visible)\n", " return null;\n", " const hit_test_result = this.glyph.hit_test(geometry);\n", " // glyphs that don't have hit-testing implemented will return null\n", " if (hit_test_result == null)\n", " return null;\n", " return this.model.view.convert_selection_from_subset(hit_test_result);\n", " }\n", " }\n", " exports.GlyphRendererView = GlyphRendererView;\n", " GlyphRendererView.__name__ = \"GlyphRendererView\";\n", " class GlyphRenderer extends data_renderer_1.DataRenderer {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_GlyphRenderer() {\n", " this.prototype.default_view = GlyphRendererView;\n", " this.define({\n", " data_source: [p.Instance],\n", " view: [p.Instance, () => new cds_view_1.CDSView()],\n", " glyph: [p.Instance],\n", " hover_glyph: [p.Instance],\n", " nonselection_glyph: [p.Any, 'auto'],\n", " selection_glyph: [p.Any, 'auto'],\n", " muted_glyph: [p.Instance],\n", " muted: [p.Boolean, false],\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " if (this.view.source == null) {\n", " this.view.source = this.data_source;\n", " this.view.compute_indices();\n", " }\n", " }\n", " get_reference_point(field, value) {\n", " let index = 0;\n", " if (field != null) {\n", " const data = this.data_source.get_column(field);\n", " if (data != null) {\n", " const i = arrayable_1.indexOf(data, value);\n", " if (i != -1)\n", " index = i;\n", " }\n", " }\n", " return index;\n", " }\n", " get_selection_manager() {\n", " return this.data_source.selection_manager;\n", " }\n", " }\n", " exports.GlyphRenderer = GlyphRenderer;\n", " GlyphRenderer.__name__ = \"GlyphRenderer\";\n", " GlyphRenderer.init_GlyphRenderer();\n", " },\n", " /* models/renderers/data_renderer.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const renderer_1 = require(65) /* ./renderer */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class DataRendererView extends renderer_1.RendererView {\n", " }\n", " exports.DataRendererView = DataRendererView;\n", " DataRendererView.__name__ = \"DataRendererView\";\n", " class DataRenderer extends renderer_1.Renderer {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_DataRenderer() {\n", " this.define({\n", " x_range_name: [p.String, 'default'],\n", " y_range_name: [p.String, 'default'],\n", " });\n", " this.override({\n", " level: 'glyph',\n", " });\n", " }\n", " }\n", " exports.DataRenderer = DataRenderer;\n", " DataRenderer.__name__ = \"DataRenderer\";\n", " DataRenderer.init_DataRenderer();\n", " },\n", " /* models/glyphs/line.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const xy_glyph_1 = require(84) /* ./xy_glyph */;\n", " const utils_1 = require(92) /* ./utils */;\n", " const mixins = tslib_1.__importStar(require(23) /* ../../core/property_mixins */);\n", " const hittest = tslib_1.__importStar(require(93) /* ../../core/hittest */);\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class LineView extends xy_glyph_1.XYGlyphView {\n", " _render(ctx, indices, { sx, sy }) {\n", " let drawing = false;\n", " let last_index = null;\n", " this.visuals.line.set_value(ctx);\n", " for (const i of indices) {\n", " if (drawing) {\n", " if (!isFinite(sx[i] + sy[i])) {\n", " ctx.stroke();\n", " ctx.beginPath();\n", " drawing = false;\n", " last_index = i;\n", " continue;\n", " }\n", " if (last_index != null && i - last_index > 1) {\n", " ctx.stroke();\n", " drawing = false;\n", " }\n", " }\n", " if (drawing)\n", " ctx.lineTo(sx[i], sy[i]);\n", " else {\n", " ctx.beginPath();\n", " ctx.moveTo(sx[i], sy[i]);\n", " drawing = true;\n", " }\n", " last_index = i;\n", " }\n", " if (drawing)\n", " ctx.stroke();\n", " }\n", " _hit_point(geometry) {\n", " /* Check if the point geometry hits this line glyph and return an object\n", " that describes the hit result:\n", " Args:\n", " * geometry (object): object with the following keys\n", " * sx (float): screen x coordinate of the point\n", " * sy (float): screen y coordinate of the point\n", " * type (str): type of geometry (in this case it's a point)\n", " */\n", " const result = new selection_1.Selection();\n", " const point = { x: geometry.sx, y: geometry.sy };\n", " let shortest = 9999;\n", " const threshold = Math.max(2, this.visuals.line.line_width.value() / 2);\n", " for (let i = 0, end = this.sx.length - 1; i < end; i++) {\n", " const p0 = { x: this.sx[i], y: this.sy[i] };\n", " const p1 = { x: this.sx[i + 1], y: this.sy[i + 1] };\n", " const dist = hittest.dist_to_segment(point, p0, p1);\n", " if (dist < threshold && dist < shortest) {\n", " shortest = dist;\n", " result.add_to_selected_glyphs(this.model);\n", " result.get_view = () => this;\n", " result.line_indices = [i];\n", " }\n", " }\n", " return result;\n", " }\n", " _hit_span(geometry) {\n", " const { sx, sy } = geometry;\n", " const result = new selection_1.Selection();\n", " let val;\n", " let values;\n", " if (geometry.direction == 'v') {\n", " val = this.renderer.yscale.invert(sy);\n", " values = this._y;\n", " }\n", " else {\n", " val = this.renderer.xscale.invert(sx);\n", " values = this._x;\n", " }\n", " for (let i = 0, end = values.length - 1; i < end; i++) {\n", " if ((values[i] <= val && val <= values[i + 1]) || (values[i + 1] <= val && val <= values[i])) {\n", " result.add_to_selected_glyphs(this.model);\n", " result.get_view = () => this;\n", " result.line_indices.push(i);\n", " }\n", " }\n", " return result;\n", " }\n", " get_interpolation_hit(i, geometry) {\n", " const [x2, y2, x3, y3] = [this._x[i], this._y[i], this._x[i + 1], this._y[i + 1]];\n", " return utils_1.line_interpolation(this.renderer, geometry, x2, y2, x3, y3);\n", " }\n", " draw_legend_for_index(ctx, bbox, index) {\n", " utils_1.generic_line_legend(this.visuals, ctx, bbox, index);\n", " }\n", " }\n", " exports.LineView = LineView;\n", " LineView.__name__ = \"LineView\";\n", " class Line extends xy_glyph_1.XYGlyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Line() {\n", " this.prototype.default_view = LineView;\n", " this.mixins(mixins.Line /*Scalar*/);\n", " }\n", " }\n", " exports.Line = Line;\n", " Line.__name__ = \"Line\";\n", " Line.init_Line();\n", " },\n", " /* models/glyphs/xy_glyph.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const spatial_1 = require(85) /* ../../core/util/spatial */;\n", " const glyph_1 = require(89) /* ./glyph */;\n", " class XYGlyphView extends glyph_1.GlyphView {\n", " _index_data() {\n", " const points = [];\n", " for (let i = 0, end = this._x.length; i < end; i++) {\n", " const x = this._x[i];\n", " const y = this._y[i];\n", " if (isNaN(x + y) || !isFinite(x + y))\n", " continue;\n", " points.push({ x0: x, y0: y, x1: x, y1: y, i });\n", " }\n", " return new spatial_1.SpatialIndex(points);\n", " }\n", " scenterx(i) {\n", " return this.sx[i];\n", " }\n", " scentery(i) {\n", " return this.sy[i];\n", " }\n", " }\n", " exports.XYGlyphView = XYGlyphView;\n", " XYGlyphView.__name__ = \"XYGlyphView\";\n", " class XYGlyph extends glyph_1.Glyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_XYGlyph() {\n", " this.coords([['x', 'y']]);\n", " }\n", " }\n", " exports.XYGlyph = XYGlyph;\n", " XYGlyph.__name__ = \"XYGlyph\";\n", " XYGlyph.init_XYGlyph();\n", " },\n", " /* core/util/spatial.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const flatbush_1 = tslib_1.__importDefault(require(86) /* flatbush */);\n", " const bbox_1 = require(88) /* ./bbox */;\n", " class SpatialIndex {\n", " constructor(points) {\n", " this.points = points;\n", " this.index = null;\n", " if (points.length > 0) {\n", " this.index = new flatbush_1.default(points.length);\n", " for (const p of points) {\n", " const { x0, y0, x1, y1 } = p;\n", " this.index.add(x0, y0, x1, y1);\n", " }\n", " this.index.finish();\n", " }\n", " }\n", " _normalize(rect) {\n", " let { x0, y0, x1, y1 } = rect;\n", " if (x0 > x1)\n", " [x0, x1] = [x1, x0];\n", " if (y0 > y1)\n", " [y0, y1] = [y1, y0];\n", " return { x0, y0, x1, y1 };\n", " }\n", " get bbox() {\n", " if (this.index == null)\n", " return bbox_1.empty();\n", " else {\n", " const { minX, minY, maxX, maxY } = this.index;\n", " return { x0: minX, y0: minY, x1: maxX, y1: maxY };\n", " }\n", " }\n", " search(rect) {\n", " if (this.index == null)\n", " return [];\n", " else {\n", " const { x0, y0, x1, y1 } = this._normalize(rect);\n", " const indices = this.index.search(x0, y0, x1, y1);\n", " return indices.map((j) => this.points[j]);\n", " }\n", " }\n", " indices(rect) {\n", " return this.search(rect).map(({ i }) => i);\n", " }\n", " }\n", " exports.SpatialIndex = SpatialIndex;\n", " SpatialIndex.__name__ = \"SpatialIndex\";\n", " },\n", " /* flatbush/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const flatqueue_1 = tslib_1.__importDefault(require(87) /* flatqueue */);\n", " const ARRAY_TYPES = [\n", " Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array,\n", " Int32Array, Uint32Array, Float32Array, Float64Array\n", " ];\n", " const VERSION = 3; // serialized format version\n", " class Flatbush {\n", " static from(data) {\n", " if (!(data instanceof ArrayBuffer)) {\n", " throw new Error('Data must be an instance of ArrayBuffer.');\n", " }\n", " const [magic, versionAndType] = new Uint8Array(data, 0, 2);\n", " if (magic !== 0xfb) {\n", " throw new Error('Data does not appear to be in a Flatbush format.');\n", " }\n", " if (versionAndType >> 4 !== VERSION) {\n", " throw new Error(`Got v${versionAndType >> 4} data when expected v${VERSION}.`);\n", " }\n", " const [nodeSize] = new Uint16Array(data, 2, 1);\n", " const [numItems] = new Uint32Array(data, 4, 1);\n", " return new Flatbush(numItems, nodeSize, ARRAY_TYPES[versionAndType & 0x0f], data);\n", " }\n", " constructor(numItems, nodeSize = 16, ArrayType = Float64Array, data) {\n", " if (numItems === undefined)\n", " throw new Error('Missing required argument: numItems.');\n", " if (isNaN(numItems) || numItems <= 0)\n", " throw new Error(`Unpexpected numItems value: ${numItems}.`);\n", " this.numItems = +numItems;\n", " this.nodeSize = Math.min(Math.max(+nodeSize, 2), 65535);\n", " // calculate the total number of nodes in the R-tree to allocate space for\n", " // and the index of each tree level (used in search later)\n", " let n = numItems;\n", " let numNodes = n;\n", " this._levelBounds = [n * 4];\n", " do {\n", " n = Math.ceil(n / this.nodeSize);\n", " numNodes += n;\n", " this._levelBounds.push(numNodes * 4);\n", " } while (n !== 1);\n", " this.ArrayType = ArrayType || Float64Array;\n", " this.IndexArrayType = numNodes < 16384 ? Uint16Array : Uint32Array;\n", " const arrayTypeIndex = ARRAY_TYPES.indexOf(this.ArrayType);\n", " const nodesByteSize = numNodes * 4 * this.ArrayType.BYTES_PER_ELEMENT;\n", " if (arrayTypeIndex < 0) {\n", " throw new Error(`Unexpected typed array class: ${ArrayType}.`);\n", " }\n", " if (data && (data instanceof ArrayBuffer)) {\n", " this.data = data;\n", " this._boxes = new this.ArrayType(this.data, 8, numNodes * 4);\n", " this._indices = new this.IndexArrayType(this.data, 8 + nodesByteSize, numNodes);\n", " this._pos = numNodes * 4;\n", " this.minX = this._boxes[this._pos - 4];\n", " this.minY = this._boxes[this._pos - 3];\n", " this.maxX = this._boxes[this._pos - 2];\n", " this.maxY = this._boxes[this._pos - 1];\n", " }\n", " else {\n", " this.data = new ArrayBuffer(8 + nodesByteSize + numNodes * this.IndexArrayType.BYTES_PER_ELEMENT);\n", " this._boxes = new this.ArrayType(this.data, 8, numNodes * 4);\n", " this._indices = new this.IndexArrayType(this.data, 8 + nodesByteSize, numNodes);\n", " this._pos = 0;\n", " this.minX = Infinity;\n", " this.minY = Infinity;\n", " this.maxX = -Infinity;\n", " this.maxY = -Infinity;\n", " new Uint8Array(this.data, 0, 2).set([0xfb, (VERSION << 4) + arrayTypeIndex]);\n", " new Uint16Array(this.data, 2, 1)[0] = nodeSize;\n", " new Uint32Array(this.data, 4, 1)[0] = numItems;\n", " }\n", " // a priority queue for k-nearest-neighbors queries\n", " this._queue = new flatqueue_1.default();\n", " }\n", " add(minX, minY, maxX, maxY) {\n", " const index = this._pos >> 2;\n", " this._indices[index] = index;\n", " this._boxes[this._pos++] = minX;\n", " this._boxes[this._pos++] = minY;\n", " this._boxes[this._pos++] = maxX;\n", " this._boxes[this._pos++] = maxY;\n", " if (minX < this.minX)\n", " this.minX = minX;\n", " if (minY < this.minY)\n", " this.minY = minY;\n", " if (maxX > this.maxX)\n", " this.maxX = maxX;\n", " if (maxY > this.maxY)\n", " this.maxY = maxY;\n", " return index;\n", " }\n", " finish() {\n", " if (this._pos >> 2 !== this.numItems) {\n", " throw new Error(`Added ${this._pos >> 2} items when expected ${this.numItems}.`);\n", " }\n", " if (this.numItems <= this.nodeSize) {\n", " // only one node, skip sorting and just fill the root box\n", " this._boxes[this._pos++] = this.minX;\n", " this._boxes[this._pos++] = this.minY;\n", " this._boxes[this._pos++] = this.maxX;\n", " this._boxes[this._pos++] = this.maxY;\n", " return;\n", " }\n", " const width = this.maxX - this.minX;\n", " const height = this.maxY - this.minY;\n", " const hilbertValues = new Uint32Array(this.numItems);\n", " const hilbertMax = (1 << 16) - 1;\n", " // map item centers into Hilbert coordinate space and calculate Hilbert values\n", " for (let i = 0; i < this.numItems; i++) {\n", " let pos = 4 * i;\n", " const minX = this._boxes[pos++];\n", " const minY = this._boxes[pos++];\n", " const maxX = this._boxes[pos++];\n", " const maxY = this._boxes[pos++];\n", " const x = Math.floor(hilbertMax * ((minX + maxX) / 2 - this.minX) / width);\n", " const y = Math.floor(hilbertMax * ((minY + maxY) / 2 - this.minY) / height);\n", " hilbertValues[i] = hilbert(x, y);\n", " }\n", " // sort items by their Hilbert value (for packing later)\n", " sort(hilbertValues, this._boxes, this._indices, 0, this.numItems - 1, this.nodeSize);\n", " // generate nodes at each tree level, bottom-up\n", " for (let i = 0, pos = 0; i < this._levelBounds.length - 1; i++) {\n", " const end = this._levelBounds[i];\n", " // generate a parent node for each block of consecutive nodes\n", " while (pos < end) {\n", " const nodeIndex = pos;\n", " // calculate bbox for the new node\n", " let nodeMinX = Infinity;\n", " let nodeMinY = Infinity;\n", " let nodeMaxX = -Infinity;\n", " let nodeMaxY = -Infinity;\n", " for (let i = 0; i < this.nodeSize && pos < end; i++) {\n", " nodeMinX = Math.min(nodeMinX, this._boxes[pos++]);\n", " nodeMinY = Math.min(nodeMinY, this._boxes[pos++]);\n", " nodeMaxX = Math.max(nodeMaxX, this._boxes[pos++]);\n", " nodeMaxY = Math.max(nodeMaxY, this._boxes[pos++]);\n", " }\n", " // add the new node to the tree data\n", " this._indices[this._pos >> 2] = nodeIndex;\n", " this._boxes[this._pos++] = nodeMinX;\n", " this._boxes[this._pos++] = nodeMinY;\n", " this._boxes[this._pos++] = nodeMaxX;\n", " this._boxes[this._pos++] = nodeMaxY;\n", " }\n", " }\n", " }\n", " search(minX, minY, maxX, maxY, filterFn) {\n", " if (this._pos !== this._boxes.length) {\n", " throw new Error('Data not yet indexed - call index.finish().');\n", " }\n", " let nodeIndex = this._boxes.length - 4;\n", " const queue = [];\n", " const results = [];\n", " while (nodeIndex !== undefined) {\n", " // find the end index of the node\n", " const end = Math.min(nodeIndex + this.nodeSize * 4, upperBound(nodeIndex, this._levelBounds));\n", " // search through child nodes\n", " for (let pos = nodeIndex; pos < end; pos += 4) {\n", " const index = this._indices[pos >> 2] | 0;\n", " // check if node bbox intersects with query bbox\n", " if (maxX < this._boxes[pos])\n", " continue; // maxX < nodeMinX\n", " if (maxY < this._boxes[pos + 1])\n", " continue; // maxY < nodeMinY\n", " if (minX > this._boxes[pos + 2])\n", " continue; // minX > nodeMaxX\n", " if (minY > this._boxes[pos + 3])\n", " continue; // minY > nodeMaxY\n", " if (nodeIndex < this.numItems * 4) {\n", " if (filterFn === undefined || filterFn(index)) {\n", " results.push(index); // leaf item\n", " }\n", " }\n", " else {\n", " queue.push(index); // node; add it to the search queue\n", " }\n", " }\n", " nodeIndex = queue.pop();\n", " }\n", " return results;\n", " }\n", " neighbors(x, y, maxResults = Infinity, maxDistance = Infinity, filterFn) {\n", " if (this._pos !== this._boxes.length) {\n", " throw new Error('Data not yet indexed - call index.finish().');\n", " }\n", " let nodeIndex = this._boxes.length - 4;\n", " const q = this._queue;\n", " const results = [];\n", " const maxDistSquared = maxDistance * maxDistance;\n", " while (nodeIndex !== undefined) {\n", " // find the end index of the node\n", " const end = Math.min(nodeIndex + this.nodeSize * 4, upperBound(nodeIndex, this._levelBounds));\n", " // add child nodes to the queue\n", " for (let pos = nodeIndex; pos < end; pos += 4) {\n", " const index = this._indices[pos >> 2] | 0;\n", " const dx = axisDist(x, this._boxes[pos], this._boxes[pos + 2]);\n", " const dy = axisDist(y, this._boxes[pos + 1], this._boxes[pos + 3]);\n", " const dist = dx * dx + dy * dy;\n", " if (nodeIndex < this.numItems * 4) { // leaf node\n", " if (filterFn === undefined || filterFn(index)) {\n", " // put a negative index if it's an item rather than a node, to recognize later\n", " q.push(-index - 1, dist);\n", " }\n", " }\n", " else {\n", " q.push(index, dist);\n", " }\n", " }\n", " // pop items from the queue\n", " while (q.length && q.peek() < 0) {\n", " const dist = q.peekValue();\n", " if (dist > maxDistSquared) {\n", " q.clear();\n", " return results;\n", " }\n", " results.push(-q.pop() - 1);\n", " if (results.length === maxResults) {\n", " q.clear();\n", " return results;\n", " }\n", " }\n", " nodeIndex = q.pop();\n", " }\n", " q.clear();\n", " return results;\n", " }\n", " }\n", " exports.default = Flatbush;\n", " function axisDist(k, min, max) {\n", " return k < min ? min - k : k <= max ? 0 : k - max;\n", " }\n", " // binary search for the first value in the array bigger than the given\n", " function upperBound(value, arr) {\n", " let i = 0;\n", " let j = arr.length - 1;\n", " while (i < j) {\n", " const m = (i + j) >> 1;\n", " if (arr[m] > value) {\n", " j = m;\n", " }\n", " else {\n", " i = m + 1;\n", " }\n", " }\n", " return arr[i];\n", " }\n", " // custom quicksort that partially sorts bbox data alongside the hilbert values\n", " function sort(values, boxes, indices, left, right, nodeSize) {\n", " if (Math.floor(left / nodeSize) >= Math.floor(right / nodeSize))\n", " return;\n", " const pivot = values[(left + right) >> 1];\n", " let i = left - 1;\n", " let j = right + 1;\n", " while (true) {\n", " do\n", " i++;\n", " while (values[i] < pivot);\n", " do\n", " j--;\n", " while (values[j] > pivot);\n", " if (i >= j)\n", " break;\n", " swap(values, boxes, indices, i, j);\n", " }\n", " sort(values, boxes, indices, left, j, nodeSize);\n", " sort(values, boxes, indices, j + 1, right, nodeSize);\n", " }\n", " // swap two values and two corresponding boxes\n", " function swap(values, boxes, indices, i, j) {\n", " const temp = values[i];\n", " values[i] = values[j];\n", " values[j] = temp;\n", " const k = 4 * i;\n", " const m = 4 * j;\n", " const a = boxes[k];\n", " const b = boxes[k + 1];\n", " const c = boxes[k + 2];\n", " const d = boxes[k + 3];\n", " boxes[k] = boxes[m];\n", " boxes[k + 1] = boxes[m + 1];\n", " boxes[k + 2] = boxes[m + 2];\n", " boxes[k + 3] = boxes[m + 3];\n", " boxes[m] = a;\n", " boxes[m + 1] = b;\n", " boxes[m + 2] = c;\n", " boxes[m + 3] = d;\n", " const e = indices[i];\n", " indices[i] = indices[j];\n", " indices[j] = e;\n", " }\n", " // Fast Hilbert curve algorithm by http://threadlocalmutex.com/\n", " // Ported from C++ https://github.com/rawrunprotected/hilbert_curves (public domain)\n", " function hilbert(x, y) {\n", " let a = x ^ y;\n", " let b = 0xFFFF ^ a;\n", " let c = 0xFFFF ^ (x | y);\n", " let d = x & (y ^ 0xFFFF);\n", " let A = a | (b >> 1);\n", " let B = (a >> 1) ^ a;\n", " let C = ((c >> 1) ^ (b & (d >> 1))) ^ c;\n", " let D = ((a & (c >> 1)) ^ (d >> 1)) ^ d;\n", " a = A;\n", " b = B;\n", " c = C;\n", " d = D;\n", " A = ((a & (a >> 2)) ^ (b & (b >> 2)));\n", " B = ((a & (b >> 2)) ^ (b & ((a ^ b) >> 2)));\n", " C ^= ((a & (c >> 2)) ^ (b & (d >> 2)));\n", " D ^= ((b & (c >> 2)) ^ ((a ^ b) & (d >> 2)));\n", " a = A;\n", " b = B;\n", " c = C;\n", " d = D;\n", " A = ((a & (a >> 4)) ^ (b & (b >> 4)));\n", " B = ((a & (b >> 4)) ^ (b & ((a ^ b) >> 4)));\n", " C ^= ((a & (c >> 4)) ^ (b & (d >> 4)));\n", " D ^= ((b & (c >> 4)) ^ ((a ^ b) & (d >> 4)));\n", " a = A;\n", " b = B;\n", " c = C;\n", " d = D;\n", " C ^= ((a & (c >> 8)) ^ (b & (d >> 8)));\n", " D ^= ((b & (c >> 8)) ^ ((a ^ b) & (d >> 8)));\n", " a = C ^ (C >> 1);\n", " b = D ^ (D >> 1);\n", " let i0 = x ^ y;\n", " let i1 = b | (0xFFFF ^ (i0 | a));\n", " i0 = (i0 | (i0 << 8)) & 0x00FF00FF;\n", " i0 = (i0 | (i0 << 4)) & 0x0F0F0F0F;\n", " i0 = (i0 | (i0 << 2)) & 0x33333333;\n", " i0 = (i0 | (i0 << 1)) & 0x55555555;\n", " i1 = (i1 | (i1 << 8)) & 0x00FF00FF;\n", " i1 = (i1 | (i1 << 4)) & 0x0F0F0F0F;\n", " i1 = (i1 | (i1 << 2)) & 0x33333333;\n", " i1 = (i1 | (i1 << 1)) & 0x55555555;\n", " return ((i1 << 1) | i0) >>> 0;\n", " }\n", " },\n", " /* flatqueue/index.mjs */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " class FlatQueue {\n", " constructor() {\n", " this.ids = [];\n", " this.values = [];\n", " this.length = 0;\n", " }\n", " clear() {\n", " this.length = 0;\n", " }\n", " push(id, value) {\n", " let pos = this.length++;\n", " this.ids[pos] = id;\n", " this.values[pos] = value;\n", " while (pos > 0) {\n", " const parent = (pos - 1) >> 1;\n", " const parentValue = this.values[parent];\n", " if (value >= parentValue)\n", " break;\n", " this.ids[pos] = this.ids[parent];\n", " this.values[pos] = parentValue;\n", " pos = parent;\n", " }\n", " this.ids[pos] = id;\n", " this.values[pos] = value;\n", " }\n", " pop() {\n", " if (this.length === 0)\n", " return undefined;\n", " const top = this.ids[0];\n", " this.length--;\n", " if (this.length > 0) {\n", " const id = this.ids[0] = this.ids[this.length];\n", " const value = this.values[0] = this.values[this.length];\n", " const halfLength = this.length >> 1;\n", " let pos = 0;\n", " while (pos < halfLength) {\n", " let left = (pos << 1) + 1;\n", " const right = left + 1;\n", " let bestIndex = this.ids[left];\n", " let bestValue = this.values[left];\n", " const rightValue = this.values[right];\n", " if (right < this.length && rightValue < bestValue) {\n", " left = right;\n", " bestIndex = this.ids[right];\n", " bestValue = rightValue;\n", " }\n", " if (bestValue >= value)\n", " break;\n", " this.ids[pos] = bestIndex;\n", " this.values[pos] = bestValue;\n", " pos = left;\n", " }\n", " this.ids[pos] = id;\n", " this.values[pos] = value;\n", " }\n", " return top;\n", " }\n", " peek() {\n", " if (this.length === 0)\n", " return undefined;\n", " return this.ids[0];\n", " }\n", " peekValue() {\n", " if (this.length === 0)\n", " return undefined;\n", " return this.values[0];\n", " }\n", " }\n", " exports.default = FlatQueue;\n", " },\n", " /* core/util/bbox.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const { min, max } = Math;\n", " function empty() {\n", " return {\n", " x0: Infinity,\n", " y0: Infinity,\n", " x1: -Infinity,\n", " y1: -Infinity,\n", " };\n", " }\n", " exports.empty = empty;\n", " function positive_x() {\n", " return {\n", " x0: Number.MIN_VALUE,\n", " y0: -Infinity,\n", " x1: Infinity,\n", " y1: Infinity,\n", " };\n", " }\n", " exports.positive_x = positive_x;\n", " function positive_y() {\n", " return {\n", " x0: -Infinity,\n", " y0: Number.MIN_VALUE,\n", " x1: Infinity,\n", " y1: Infinity,\n", " };\n", " }\n", " exports.positive_y = positive_y;\n", " function union(a, b) {\n", " return {\n", " x0: min(a.x0, b.x0),\n", " x1: max(a.x1, b.x1),\n", " y0: min(a.y0, b.y0),\n", " y1: max(a.y1, b.y1),\n", " };\n", " }\n", " exports.union = union;\n", " class BBox {\n", " constructor(box) {\n", " if (box == null) {\n", " this.x0 = 0;\n", " this.y0 = 0;\n", " this.x1 = 0;\n", " this.y1 = 0;\n", " }\n", " else if ('x0' in box) {\n", " const { x0, y0, x1, y1 } = box;\n", " if (!(x0 <= x1 && y0 <= y1))\n", " throw new Error(`invalid bbox {x0: ${x0}, y0: ${y0}, x1: ${x1}, y1: ${y1}}`);\n", " this.x0 = x0;\n", " this.y0 = y0;\n", " this.x1 = x1;\n", " this.y1 = y1;\n", " }\n", " else if (\"x\" in box) {\n", " const { x, y, width, height } = box;\n", " if (!(width >= 0 && height >= 0))\n", " throw new Error(`invalid bbox {x: ${x}, y: ${y}, width: ${width}, height: ${height}}`);\n", " this.x0 = x;\n", " this.y0 = y;\n", " this.x1 = x + width;\n", " this.y1 = y + height;\n", " }\n", " else {\n", " let left, right;\n", " let top, bottom;\n", " if (\"width\" in box) {\n", " if (\"left\" in box) {\n", " left = box.left;\n", " right = left + box.width;\n", " }\n", " else if (\"right\" in box) {\n", " right = box.right;\n", " left = right - box.width;\n", " }\n", " else {\n", " const w2 = box.width / 2;\n", " left = box.hcenter - w2;\n", " right = box.hcenter + w2;\n", " }\n", " }\n", " else {\n", " left = box.left;\n", " right = box.right;\n", " }\n", " if (\"height\" in box) {\n", " if (\"top\" in box) {\n", " top = box.top;\n", " bottom = top + box.height;\n", " }\n", " else if (\"bottom\" in box) {\n", " bottom = box.bottom;\n", " top = bottom - box.height;\n", " }\n", " else {\n", " const h2 = box.height / 2;\n", " top = box.vcenter - h2;\n", " bottom = box.vcenter + h2;\n", " }\n", " }\n", " else {\n", " top = box.top;\n", " bottom = box.bottom;\n", " }\n", " if (!(left <= right && top <= bottom))\n", " throw new Error(`invalid bbox {left: ${left}, top: ${top}, right: ${right}, bottom: ${bottom}}`);\n", " this.x0 = left;\n", " this.y0 = top;\n", " this.x1 = right;\n", " this.y1 = bottom;\n", " }\n", " }\n", " toString() {\n", " return `BBox({left: ${this.left}, top: ${this.top}, width: ${this.width}, height: ${this.height}})`;\n", " }\n", " get left() { return this.x0; }\n", " get top() { return this.y0; }\n", " get right() { return this.x1; }\n", " get bottom() { return this.y1; }\n", " get p0() { return [this.x0, this.y0]; }\n", " get p1() { return [this.x1, this.y1]; }\n", " get x() { return this.x0; }\n", " get y() { return this.y0; }\n", " get width() { return this.x1 - this.x0; }\n", " get height() { return this.y1 - this.y0; }\n", " get rect() { return { x0: this.x0, y0: this.y0, x1: this.x1, y1: this.y1 }; }\n", " get box() { return { x: this.x, y: this.y, width: this.width, height: this.height }; }\n", " get h_range() { return { start: this.x0, end: this.x1 }; }\n", " get v_range() { return { start: this.y0, end: this.y1 }; }\n", " get ranges() { return [this.h_range, this.v_range]; }\n", " get aspect() { return this.width / this.height; }\n", " get hcenter() { return (this.left + this.right) / 2; }\n", " get vcenter() { return (this.top + this.bottom) / 2; }\n", " contains(x, y) {\n", " return x >= this.x0 && x <= this.x1 && y >= this.y0 && y <= this.y1;\n", " }\n", " clip(x, y) {\n", " if (x < this.x0)\n", " x = this.x0;\n", " else if (x > this.x1)\n", " x = this.x1;\n", " if (y < this.y0)\n", " y = this.y0;\n", " else if (y > this.y1)\n", " y = this.y1;\n", " return [x, y];\n", " }\n", " union(that) {\n", " return new BBox({\n", " x0: min(this.x0, that.x0),\n", " y0: min(this.y0, that.y0),\n", " x1: max(this.x1, that.x1),\n", " y1: max(this.y1, that.y1),\n", " });\n", " }\n", " equals(that) {\n", " return this.x0 == that.x0 && this.y0 == that.y0 && this.x1 == that.x1 && this.y1 == that.y1;\n", " }\n", " get xview() {\n", " return {\n", " compute: (x) => {\n", " return this.left + x;\n", " },\n", " v_compute: (xx) => {\n", " const _xx = new Float64Array(xx.length);\n", " const left = this.left;\n", " for (let i = 0; i < xx.length; i++) {\n", " _xx[i] = left + xx[i];\n", " }\n", " return _xx;\n", " },\n", " };\n", " }\n", " get yview() {\n", " return {\n", " compute: (y) => {\n", " return this.bottom - y;\n", " },\n", " v_compute: (yy) => {\n", " const _yy = new Float64Array(yy.length);\n", " const bottom = this.bottom;\n", " for (let i = 0; i < yy.length; i++) {\n", " _yy[i] = bottom - yy[i];\n", " }\n", " return _yy;\n", " },\n", " };\n", " }\n", " }\n", " exports.BBox = BBox;\n", " BBox.__name__ = \"BBox\";\n", " },\n", " /* models/glyphs/glyph.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const bbox = tslib_1.__importStar(require(88) /* ../../core/util/bbox */);\n", " const proj = tslib_1.__importStar(require(32) /* ../../core/util/projections */);\n", " const visuals = tslib_1.__importStar(require(70) /* ../../core/visuals */);\n", " const view_1 = require(67) /* ../../core/view */;\n", " const model_1 = require(71) /* ../../model */;\n", " const logging_1 = require(72) /* ../../core/logging */;\n", " const arrayable_1 = require(12) /* ../../core/util/arrayable */;\n", " const object_1 = require(17) /* ../../core/util/object */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const line_1 = require(83) /* ./line */;\n", " const factor_range_1 = require(90) /* ../ranges/factor_range */;\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class GlyphView extends view_1.View {\n", " constructor() {\n", " super(...arguments);\n", " this._nohit_warned = new Set();\n", " }\n", " get renderer() {\n", " return this.parent;\n", " }\n", " get has_webgl() {\n", " return this.glglyph != null;\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.visuals = new visuals.Visuals(this.model);\n", " }\n", " async lazy_initialize() {\n", " await super.lazy_initialize();\n", " const { webgl } = this.renderer.plot_view.canvas_view;\n", " if (webgl != null) {\n", " let webgl_module = null;\n", " try {\n", " webgl_module = await Promise.resolve().then(() => tslib_1.__importStar(require(371) /* ./webgl/index */));\n", " }\n", " catch (e) {\n", " // TODO: this exposes the underyling module system\n", " if (e.code === 'MODULE_NOT_FOUND')\n", " logging_1.logger.warn('WebGL was requested and is supported, but bokeh-gl(.min).js is not available, falling back to 2D rendering.');\n", " else\n", " throw e;\n", " }\n", " if (webgl_module != null) {\n", " const Cls = webgl_module[this.model.type + 'GLGlyph'];\n", " if (Cls != null)\n", " this.glglyph = new Cls(webgl.gl, this);\n", " }\n", " }\n", " }\n", " set_visuals(source, indices) {\n", " this.visuals.set_all_indices(indices);\n", " this.visuals.warm_cache(source);\n", " if (this.glglyph != null)\n", " this.glglyph.set_visuals_changed();\n", " }\n", " render(ctx, indices, data) {\n", " ctx.beginPath();\n", " if (this.glglyph != null) {\n", " if (this.glglyph.render(ctx, indices, data))\n", " return;\n", " }\n", " this._render(ctx, indices, data);\n", " }\n", " has_finished() {\n", " return true;\n", " }\n", " notify_finished() {\n", " this.renderer.notify_finished();\n", " }\n", " _bounds(bounds) {\n", " return bounds;\n", " }\n", " bounds() {\n", " return this._bounds(this.index.bbox);\n", " }\n", " log_bounds() {\n", " const bb = bbox.empty();\n", " const positive_x_bbs = this.index.search(bbox.positive_x());\n", " for (const x of positive_x_bbs) {\n", " if (x.x0 < bb.x0)\n", " bb.x0 = x.x0;\n", " if (x.x1 > bb.x1)\n", " bb.x1 = x.x1;\n", " }\n", " const positive_y_bbs = this.index.search(bbox.positive_y());\n", " for (const y of positive_y_bbs) {\n", " if (y.y0 < bb.y0)\n", " bb.y0 = y.y0;\n", " if (y.y1 > bb.y1)\n", " bb.y1 = y.y1;\n", " }\n", " return this._bounds(bb);\n", " }\n", " get_anchor_point(anchor, i, [sx, sy]) {\n", " switch (anchor) {\n", " case \"center\": return { x: this.scenterx(i, sx, sy), y: this.scentery(i, sx, sy) };\n", " default: return null;\n", " }\n", " }\n", " sdist(scale, pts, spans, pts_location = \"edge\", dilate = false) {\n", " let pt0;\n", " let pt1;\n", " const n = pts.length;\n", " if (pts_location == 'center') {\n", " const halfspan = arrayable_1.map(spans, (d) => d / 2);\n", " pt0 = new Float64Array(n);\n", " for (let i = 0; i < n; i++) {\n", " pt0[i] = pts[i] - halfspan[i];\n", " }\n", " pt1 = new Float64Array(n);\n", " for (let i = 0; i < n; i++) {\n", " pt1[i] = pts[i] + halfspan[i];\n", " }\n", " }\n", " else {\n", " pt0 = pts;\n", " pt1 = new Float64Array(n);\n", " for (let i = 0; i < n; i++) {\n", " pt1[i] = pt0[i] + spans[i];\n", " }\n", " }\n", " const spt0 = scale.v_compute(pt0);\n", " const spt1 = scale.v_compute(pt1);\n", " if (dilate)\n", " return arrayable_1.map(spt0, (_, i) => Math.ceil(Math.abs(spt1[i] - spt0[i])));\n", " else\n", " return arrayable_1.map(spt0, (_, i) => Math.abs(spt1[i] - spt0[i]));\n", " }\n", " draw_legend_for_index(_ctx, _bbox, _index) { }\n", " hit_test(geometry) {\n", " switch (geometry.type) {\n", " case \"point\":\n", " if (this._hit_point != null)\n", " return this._hit_point(geometry);\n", " break;\n", " case \"span\":\n", " if (this._hit_span != null)\n", " return this._hit_span(geometry);\n", " break;\n", " case \"rect\":\n", " if (this._hit_rect != null)\n", " return this._hit_rect(geometry);\n", " break;\n", " case \"poly\":\n", " if (this._hit_poly != null)\n", " return this._hit_poly(geometry);\n", " break;\n", " }\n", " if (!this._nohit_warned.has(geometry.type)) {\n", " logging_1.logger.debug(`'${geometry.type}' selection not available for ${this.model.type}`);\n", " this._nohit_warned.add(geometry.type);\n", " }\n", " return null;\n", " }\n", " _hit_rect_against_index(geometry) {\n", " const { sx0, sx1, sy0, sy1 } = geometry;\n", " const [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " const [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " const indices = this.index.indices({ x0, x1, y0, y1 });\n", " return new selection_1.Selection({ indices });\n", " }\n", " set_data(source, indices, indices_to_update) {\n", " let data = this.model.materialize_dataspecs(source);\n", " if (indices && !(this instanceof line_1.LineView)) {\n", " const data_subset = {};\n", " for (const k in data) {\n", " const v = data[k];\n", " if (k.charAt(0) === '_')\n", " data_subset[k] = indices.map((i) => v[i]);\n", " else\n", " data_subset[k] = v;\n", " }\n", " data = data_subset;\n", " }\n", " const self = this;\n", " object_1.extend(self, data);\n", " // TODO (bev) Should really probably delegate computing projected\n", " // coordinates to glyphs, instead of centralizing here in one place.\n", " if (this.renderer.plot_view.model.use_map) {\n", " if (self._x != null)\n", " [self._x, self._y] = proj.project_xy(self._x, self._y);\n", " if (self._xs != null)\n", " [self._xs, self._ys] = proj.project_xsys(self._xs, self._ys);\n", " if (self._x0 != null)\n", " [self._x0, self._y0] = proj.project_xy(self._x0, self._y0);\n", " if (self._x1 != null)\n", " [self._x1, self._y1] = proj.project_xy(self._x1, self._y1);\n", " }\n", " // if we have any coordinates that are categorical, convert them to\n", " // synthetic coords here\n", " if (this.renderer.plot_view.frame.x_ranges != null) { // XXXX JUST TEMP FOR TESTS TO PASS\n", " const xr = this.renderer.plot_view.frame.x_ranges[this.model.x_range_name];\n", " const yr = this.renderer.plot_view.frame.y_ranges[this.model.y_range_name];\n", " for (let [xname, yname] of this.model._coords) {\n", " xname = `_${xname}`;\n", " yname = `_${yname}`;\n", " // TODO (bev) more robust detection of multi-glyph case\n", " // hand multi glyph case\n", " if (self._xs != null) {\n", " if (xr instanceof factor_range_1.FactorRange) {\n", " self[xname] = arrayable_1.map(self[xname], (arr) => xr.v_synthetic(arr));\n", " }\n", " if (yr instanceof factor_range_1.FactorRange) {\n", " self[yname] = arrayable_1.map(self[yname], (arr) => yr.v_synthetic(arr));\n", " }\n", " }\n", " else {\n", " // hand standard glyph case\n", " if (xr instanceof factor_range_1.FactorRange) {\n", " self[xname] = xr.v_synthetic(self[xname]);\n", " }\n", " if (yr instanceof factor_range_1.FactorRange) {\n", " self[yname] = yr.v_synthetic(self[yname]);\n", " }\n", " }\n", " }\n", " }\n", " if (this.glglyph != null)\n", " this.glglyph.set_data_changed(self._x.length);\n", " this._set_data(indices_to_update); //TODO doesn't take subset indices into account\n", " this.index_data();\n", " }\n", " _set_data(_indices) { }\n", " index_data() {\n", " this.index = this._index_data();\n", " }\n", " mask_data(indices) {\n", " // WebGL can do the clipping much more efficiently\n", " if (this.glglyph != null || this._mask_data == null)\n", " return indices;\n", " else\n", " return this._mask_data();\n", " }\n", " map_data() {\n", " // TODO: if using gl, skip this (when is this called?)\n", " // map all the coordinate fields\n", " const self = this;\n", " for (let [xname, yname] of this.model._coords) {\n", " const sxname = `s${xname}`;\n", " const syname = `s${yname}`;\n", " xname = `_${xname}`;\n", " yname = `_${yname}`;\n", " if (self[xname] != null && (types_1.isArray(self[xname][0]) || types_1.isTypedArray(self[xname][0]))) {\n", " const n = self[xname].length;\n", " self[sxname] = new Array(n);\n", " self[syname] = new Array(n);\n", " for (let i = 0; i < n; i++) {\n", " const [sx, sy] = this.map_to_screen(self[xname][i], self[yname][i]);\n", " self[sxname][i] = sx;\n", " self[syname][i] = sy;\n", " }\n", " }\n", " else\n", " [self[sxname], self[syname]] = this.map_to_screen(self[xname], self[yname]);\n", " }\n", " this._map_data();\n", " }\n", " // This is where specs not included in coords are computed, e.g. radius.\n", " _map_data() { }\n", " map_to_screen(x, y) {\n", " return this.renderer.plot_view.map_to_screen(x, y, this.model.x_range_name, this.model.y_range_name);\n", " }\n", " }\n", " exports.GlyphView = GlyphView;\n", " GlyphView.__name__ = \"GlyphView\";\n", " class Glyph extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Glyph() {\n", " this.prototype._coords = [];\n", " this.internal({\n", " x_range_name: [p.String, 'default'],\n", " y_range_name: [p.String, 'default'],\n", " });\n", " }\n", " static coords(coords) {\n", " const _coords = this.prototype._coords.concat(coords);\n", " this.prototype._coords = _coords;\n", " const result = {};\n", " for (const [x, y] of coords) {\n", " result[x] = [p.CoordinateSpec];\n", " result[y] = [p.CoordinateSpec];\n", " }\n", " this.define(result);\n", " }\n", " }\n", " exports.Glyph = Glyph;\n", " Glyph.__name__ = \"Glyph\";\n", " Glyph.init_Glyph();\n", " },\n", " /* models/ranges/factor_range.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const range_1 = require(91) /* ./range */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const arrayable_1 = require(12) /* ../../core/util/arrayable */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const assert_1 = require(11) /* ../../core/util/assert */;\n", " function map_one_level(factors, padding, offset = 0) {\n", " const mapping = new Map();\n", " for (let i = 0; i < factors.length; i++) {\n", " const factor = factors[i];\n", " if (!mapping.has(factor))\n", " mapping.set(factor, { value: 0.5 + i * (1 + padding) + offset });\n", " else\n", " throw new Error(`duplicate factor or subfactor: ${factor}`);\n", " }\n", " return [mapping, (factors.length - 1) * padding];\n", " }\n", " exports.map_one_level = map_one_level;\n", " function map_two_levels(factors, outer_pad, factor_pad, offset = 0) {\n", " var _a;\n", " const mapping = new Map();\n", " const tops = new Map();\n", " for (const [f0, f1] of factors) {\n", " const top = (_a = tops.get(f0)) !== null && _a !== void 0 ? _a : [];\n", " tops.set(f0, [...top, f1]);\n", " }\n", " let suboffset = offset;\n", " let total_subpad = 0;\n", " for (const [f0, top] of tops) {\n", " const n = top.length;\n", " const [submap, subpad] = map_one_level(top, factor_pad, suboffset);\n", " total_subpad += subpad;\n", " const subtot = array_1.sum(top.map((f1) => submap.get(f1).value));\n", " mapping.set(f0, { value: subtot / n, mapping: submap });\n", " suboffset += n + outer_pad + subpad;\n", " }\n", " return [mapping, (tops.size - 1) * outer_pad + total_subpad];\n", " }\n", " exports.map_two_levels = map_two_levels;\n", " function map_three_levels(factors, outer_pad, inner_pad, factor_pad, offset = 0) {\n", " var _a;\n", " const mapping = new Map();\n", " const tops = new Map();\n", " for (const [f0, f1, f2] of factors) {\n", " const top = (_a = tops.get(f0)) !== null && _a !== void 0 ? _a : [];\n", " tops.set(f0, [...top, [f1, f2]]);\n", " }\n", " let suboffset = offset;\n", " let total_subpad = 0;\n", " for (const [f0, top] of tops) {\n", " const n = top.length;\n", " const [submap, subpad] = map_two_levels(top, inner_pad, factor_pad, suboffset);\n", " total_subpad += subpad;\n", " const subtot = array_1.sum(top.map(([f1]) => submap.get(f1).value));\n", " mapping.set(f0, { value: subtot / n, mapping: submap });\n", " suboffset += n + outer_pad + subpad;\n", " }\n", " return [mapping, (tops.size - 1) * outer_pad + total_subpad];\n", " }\n", " exports.map_three_levels = map_three_levels;\n", " class FactorRange extends range_1.Range {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_FactorRange() {\n", " this.define({\n", " factors: [p.Array, []],\n", " factor_padding: [p.Number, 0],\n", " subgroup_padding: [p.Number, 0.8],\n", " group_padding: [p.Number, 1.4],\n", " range_padding: [p.Number, 0],\n", " range_padding_units: [p.PaddingUnits, \"percent\"],\n", " start: [p.Number],\n", " end: [p.Number],\n", " });\n", " this.internal({\n", " levels: [p.Number],\n", " mids: [p.Array, null],\n", " tops: [p.Array, null],\n", " });\n", " }\n", " get min() {\n", " return this.start;\n", " }\n", " get max() {\n", " return this.end;\n", " }\n", " initialize() {\n", " super.initialize();\n", " this._init(true);\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.properties.factors.change, () => this.reset());\n", " this.connect(this.properties.factor_padding.change, () => this.reset());\n", " this.connect(this.properties.group_padding.change, () => this.reset());\n", " this.connect(this.properties.subgroup_padding.change, () => this.reset());\n", " this.connect(this.properties.range_padding.change, () => this.reset());\n", " this.connect(this.properties.range_padding_units.change, () => this.reset());\n", " }\n", " reset() {\n", " this._init(false);\n", " this.change.emit();\n", " }\n", " _lookup(x) {\n", " switch (x.length) {\n", " case 1: {\n", " const [f0] = x;\n", " const mapping = this._mapping;\n", " const y0 = mapping.get(f0);\n", " return y0 != null ? y0.value : NaN;\n", " }\n", " case 2: {\n", " const [f0, f1] = x;\n", " const mapping = this._mapping;\n", " const y0 = mapping.get(f0);\n", " if (y0 != null) {\n", " const y1 = y0.mapping.get(f1);\n", " if (y1 != null)\n", " return y1.value;\n", " }\n", " return NaN;\n", " }\n", " case 3: {\n", " const [f0, f1, f2] = x;\n", " const mapping = this._mapping;\n", " const y0 = mapping.get(f0);\n", " if (y0 != null) {\n", " const y1 = y0.mapping.get(f1);\n", " if (y1 != null) {\n", " const y2 = y1.mapping.get(f2);\n", " if (y2 != null)\n", " return y2.value;\n", " }\n", " }\n", " return NaN;\n", " }\n", " default:\n", " assert_1.unreachable();\n", " }\n", " }\n", " // convert a string factor into a synthetic coordinate\n", " synthetic(x) {\n", " if (types_1.isNumber(x))\n", " return x;\n", " if (types_1.isString(x))\n", " return this._lookup([x]);\n", " let offset = 0;\n", " const off = x[x.length - 1];\n", " if (types_1.isNumber(off)) {\n", " offset = off;\n", " x = x.slice(0, -1);\n", " }\n", " return this._lookup(x) + offset;\n", " }\n", " // convert an array of string factors into synthetic coordinates\n", " v_synthetic(xs) {\n", " return arrayable_1.map(xs, (x) => this.synthetic(x));\n", " }\n", " _init(silent) {\n", " const { levels, mapping, tops, mids, inside_padding } = (() => {\n", " if (array_1.every(this.factors, types_1.isString)) {\n", " const factors = this.factors;\n", " const [mapping, inside_padding] = map_one_level(factors, this.factor_padding);\n", " const tops = null;\n", " const mids = null;\n", " return { levels: 1, mapping, tops, mids, inside_padding };\n", " }\n", " else if (array_1.every(this.factors, (x) => types_1.isArray(x) && x.length == 2 && types_1.isString(x[0]) && types_1.isString(x[1]))) {\n", " const factors = this.factors;\n", " const [mapping, inside_padding] = map_two_levels(factors, this.group_padding, this.factor_padding);\n", " const tops = [...mapping.keys()];\n", " const mids = null;\n", " return { levels: 2, mapping, tops, mids, inside_padding };\n", " }\n", " else if (array_1.every(this.factors, (x) => types_1.isArray(x) && x.length == 3 && types_1.isString(x[0]) && types_1.isString(x[1]) && types_1.isString(x[2]))) {\n", " const factors = this.factors;\n", " const [mapping, inside_padding] = map_three_levels(factors, this.group_padding, this.subgroup_padding, this.factor_padding);\n", " const tops = [...mapping.keys()];\n", " const mids = [];\n", " for (const [f0, L2] of mapping) {\n", " for (const f1 of L2.mapping.keys()) {\n", " mids.push([f0, f1]);\n", " }\n", " }\n", " return { levels: 3, mapping, tops, mids, inside_padding };\n", " }\n", " else\n", " assert_1.unreachable();\n", " })();\n", " this._mapping = mapping;\n", " this.tops = tops;\n", " this.mids = mids;\n", " let start = 0;\n", " let end = this.factors.length + inside_padding;\n", " if (this.range_padding_units == \"percent\") {\n", " const half_span = (end - start) * this.range_padding / 2;\n", " start -= half_span;\n", " end += half_span;\n", " }\n", " else {\n", " start -= this.range_padding;\n", " end += this.range_padding;\n", " }\n", " this.setv({ start, end, levels }, { silent });\n", " if (this.bounds == \"auto\")\n", " this.setv({ bounds: [start, end] }, { silent: true });\n", " }\n", " }\n", " exports.FactorRange = FactorRange;\n", " FactorRange.__name__ = \"FactorRange\";\n", " FactorRange.init_FactorRange();\n", " },\n", " /* models/ranges/range.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const model_1 = require(71) /* ../../model */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class Range extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.have_updated_interactively = false;\n", " }\n", " static init_Range() {\n", " this.define({\n", " bounds: [p.Any],\n", " min_interval: [p.Any],\n", " max_interval: [p.Any],\n", " });\n", " this.internal({\n", " plots: [p.Array, []],\n", " });\n", " }\n", " get is_reversed() {\n", " return this.start > this.end;\n", " }\n", " }\n", " exports.Range = Range;\n", " Range.__name__ = \"Range\";\n", " Range.init_Range();\n", " },\n", " /* models/glyphs/utils.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const hittest = tslib_1.__importStar(require(93) /* ../../core/hittest */);\n", " function generic_line_legend(visuals, ctx, { x0, x1, y0, y1 }, index) {\n", " ctx.save();\n", " ctx.beginPath();\n", " ctx.moveTo(x0, (y0 + y1) / 2);\n", " ctx.lineTo(x1, (y0 + y1) / 2);\n", " if (visuals.line.doit) {\n", " visuals.line.set_vectorize(ctx, index);\n", " ctx.stroke();\n", " }\n", " ctx.restore();\n", " }\n", " exports.generic_line_legend = generic_line_legend;\n", " function generic_area_legend(visuals, ctx, { x0, x1, y0, y1 }, index) {\n", " const w = Math.abs(x1 - x0);\n", " const dw = w * 0.1;\n", " const h = Math.abs(y1 - y0);\n", " const dh = h * 0.1;\n", " const sx0 = x0 + dw;\n", " const sx1 = x1 - dw;\n", " const sy0 = y0 + dh;\n", " const sy1 = y1 - dh;\n", " if (visuals.fill.doit) {\n", " visuals.fill.set_vectorize(ctx, index);\n", " ctx.fillRect(sx0, sy0, sx1 - sx0, sy1 - sy0);\n", " }\n", " if (visuals.hatch != null && visuals.hatch.doit) {\n", " visuals.hatch.set_vectorize(ctx, index);\n", " ctx.fillRect(sx0, sy0, sx1 - sx0, sy1 - sy0);\n", " }\n", " if (visuals.line && visuals.line.doit) {\n", " ctx.beginPath();\n", " ctx.rect(sx0, sy0, sx1 - sx0, sy1 - sy0);\n", " visuals.line.set_vectorize(ctx, index);\n", " ctx.stroke();\n", " }\n", " }\n", " exports.generic_area_legend = generic_area_legend;\n", " function line_interpolation(renderer, geometry, x2, y2, x3, y3) {\n", " const { sx, sy } = geometry;\n", " let x0, x1;\n", " let y0, y1;\n", " if (geometry.type == 'point') {\n", " // The +/- adjustments here are to dilate the hit point into a virtual \"segment\" to use below\n", " [y0, y1] = renderer.yscale.r_invert(sy - 1, sy + 1);\n", " [x0, x1] = renderer.xscale.r_invert(sx - 1, sx + 1);\n", " }\n", " else {\n", " // The +/- adjustments here are to handle cases such as purely horizontal or vertical lines\n", " if (geometry.direction == 'v') {\n", " [y0, y1] = renderer.yscale.r_invert(sy, sy);\n", " [x0, x1] = [Math.min(x2 - 1, x3 - 1), Math.max(x2 + 1, x3 + 1)];\n", " }\n", " else {\n", " [x0, x1] = renderer.xscale.r_invert(sx, sx);\n", " [y0, y1] = [Math.min(y2 - 1, y3 - 1), Math.max(y2 + 1, y3 + 1)];\n", " }\n", " }\n", " const { x, y } = hittest.check_2_segments_intersect(x0, y0, x1, y1, x2, y2, x3, y3);\n", " return [x, y]; // XXX: null is not handled at use sites\n", " }\n", " exports.line_interpolation = line_interpolation;\n", " },\n", " /* core/hittest.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " function point_in_poly(x, y, px, py) {\n", " let inside = false;\n", " let x1 = px[px.length - 1];\n", " let y1 = py[py.length - 1];\n", " for (let i = 0; i < px.length; i++) {\n", " const x2 = px[i];\n", " const y2 = py[i];\n", " if ((y1 < y) != (y2 < y)) {\n", " if ((x1 + (y - y1) / (y2 - y1) * (x2 - x1)) < x)\n", " inside = !inside;\n", " }\n", " x1 = x2;\n", " y1 = y2;\n", " }\n", " return inside;\n", " }\n", " exports.point_in_poly = point_in_poly;\n", " function point_in_ellipse(x, y, angle, b, a, x0, y0) {\n", " const A = ((Math.cos(angle) / a) ** 2 + (Math.sin(angle) / b) ** 2);\n", " const B = 2 * Math.cos(angle) * Math.sin(angle) * ((1 / a) ** 2 - (1 / b) ** 2);\n", " const C = ((Math.cos(angle) / b) ** 2 + (Math.sin(angle) / a) ** 2);\n", " const eqn = A * (x - x0) ** 2 + B * (x - x0) * (y - y0) + C * (y - y0) ** 2;\n", " const inside = eqn <= 1;\n", " return inside;\n", " }\n", " exports.point_in_ellipse = point_in_ellipse;\n", " function sqr(x) {\n", " return x * x;\n", " }\n", " function dist_2_pts(p0, p1) {\n", " return sqr(p0.x - p1.x) + sqr(p0.y - p1.y);\n", " }\n", " exports.dist_2_pts = dist_2_pts;\n", " function dist_to_segment_squared(p, v, w) {\n", " const l2 = dist_2_pts(v, w);\n", " if (l2 == 0)\n", " return dist_2_pts(p, v);\n", " const t = ((p.x - v.x) * (w.x - v.x) + (p.y - v.y) * (w.y - v.y)) / l2;\n", " if (t < 0)\n", " return dist_2_pts(p, v);\n", " if (t > 1)\n", " return dist_2_pts(p, w);\n", " const q = { x: v.x + t * (w.x - v.x), y: v.y + t * (w.y - v.y) };\n", " return dist_2_pts(p, q);\n", " }\n", " exports.dist_to_segment_squared = dist_to_segment_squared;\n", " function dist_to_segment(p, v, w) {\n", " return Math.sqrt(dist_to_segment_squared(p, v, w));\n", " }\n", " exports.dist_to_segment = dist_to_segment;\n", " function check_2_segments_intersect(l0_x0, l0_y0, l0_x1, l0_y1, l1_x0, l1_y0, l1_x1, l1_y1) {\n", " /*\n", " * Check if 2 segments (l0 and l1) intersect. Returns a structure with\n", " * the following attributes:\n", " * * hit (boolean): whether the 2 segments intersect\n", " * * x (float): x coordinate of the intersection point\n", " * * y (float): y coordinate of the intersection point\n", " */\n", " const den = ((l1_y1 - l1_y0) * (l0_x1 - l0_x0)) - ((l1_x1 - l1_x0) * (l0_y1 - l0_y0));\n", " if (den == 0) {\n", " return { hit: false, x: null, y: null };\n", " }\n", " else {\n", " let a = l0_y0 - l1_y0;\n", " let b = l0_x0 - l1_x0;\n", " const num1 = ((l1_x1 - l1_x0) * a) - ((l1_y1 - l1_y0) * b);\n", " const num2 = ((l0_x1 - l0_x0) * a) - ((l0_y1 - l0_y0) * b);\n", " a = num1 / den;\n", " b = num2 / den;\n", " const x = l0_x0 + (a * (l0_x1 - l0_x0));\n", " const y = l0_y0 + (a * (l0_y1 - l0_y0));\n", " return { hit: (a > 0 && a < 1) && (b > 0 && b < 1), x, y };\n", " }\n", " }\n", " exports.check_2_segments_intersect = check_2_segments_intersect;\n", " },\n", " /* models/glyphs/patch.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const xy_glyph_1 = require(84) /* ./xy_glyph */;\n", " const utils_1 = require(92) /* ./utils */;\n", " const hittest = tslib_1.__importStar(require(93) /* ../../core/hittest */);\n", " const mixins = tslib_1.__importStar(require(23) /* ../../core/property_mixins */);\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class PatchView extends xy_glyph_1.XYGlyphView {\n", " _inner_loop(ctx, indices, sx, sy, func) {\n", " for (const i of indices) {\n", " if (i == 0) {\n", " ctx.beginPath();\n", " ctx.moveTo(sx[i], sy[i]);\n", " continue;\n", " }\n", " else if (isNaN(sx[i] + sy[i])) {\n", " ctx.closePath();\n", " func.apply(ctx);\n", " ctx.beginPath();\n", " continue;\n", " }\n", " else\n", " ctx.lineTo(sx[i], sy[i]);\n", " }\n", " ctx.closePath();\n", " func.call(ctx);\n", " }\n", " _render(ctx, indices, { sx, sy }) {\n", " if (this.visuals.fill.doit) {\n", " this.visuals.fill.set_value(ctx);\n", " this._inner_loop(ctx, indices, sx, sy, ctx.fill);\n", " }\n", " this.visuals.hatch.doit2(ctx, 0, () => this._inner_loop(ctx, indices, sx, sy, ctx.fill), () => this.renderer.request_render());\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_value(ctx);\n", " this._inner_loop(ctx, indices, sx, sy, ctx.stroke);\n", " }\n", " }\n", " draw_legend_for_index(ctx, bbox, index) {\n", " utils_1.generic_area_legend(this.visuals, ctx, bbox, index);\n", " }\n", " _hit_point(geometry) {\n", " const result = new selection_1.Selection();\n", " if (hittest.point_in_poly(geometry.sx, geometry.sy, this.sx, this.sy)) {\n", " result.add_to_selected_glyphs(this.model);\n", " result.get_view = () => this;\n", " }\n", " return result;\n", " }\n", " }\n", " exports.PatchView = PatchView;\n", " PatchView.__name__ = \"PatchView\";\n", " class Patch extends xy_glyph_1.XYGlyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Patch() {\n", " this.prototype.default_view = PatchView;\n", " this.mixins([mixins.Line /*Scalar*/, mixins.Fill /*Scalar*/, mixins.Hatch /*Scalar*/]);\n", " }\n", " }\n", " exports.Patch = Patch;\n", " Patch.__name__ = \"Patch\";\n", " Patch.init_Patch();\n", " },\n", " /* models/glyphs/harea.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const area_1 = require(96) /* ./area */;\n", " const spatial_1 = require(85) /* ../../core/util/spatial */;\n", " const hittest = tslib_1.__importStar(require(93) /* ../../core/hittest */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class HAreaView extends area_1.AreaView {\n", " _index_data() {\n", " const points = [];\n", " for (let i = 0, end = this._x1.length; i < end; i++) {\n", " const x1 = this._x1[i];\n", " const x2 = this._x2[i];\n", " const y = this._y[i];\n", " if (isNaN(x1 + x2 + y) || !isFinite(x1 + x2 + y))\n", " continue;\n", " points.push({ x0: Math.min(x1, x2), y0: y, x1: Math.max(x1, x2), y1: y, i });\n", " }\n", " return new spatial_1.SpatialIndex(points);\n", " }\n", " _inner(ctx, sx1, sx2, sy, func) {\n", " ctx.beginPath();\n", " for (let i = 0, end = sx1.length; i < end; i++) {\n", " ctx.lineTo(sx1[i], sy[i]);\n", " }\n", " // iterate backwards so that the upper end is below the lower start\n", " for (let i = sx2.length - 1; i >= 0; i--) {\n", " ctx.lineTo(sx2[i], sy[i]);\n", " }\n", " ctx.closePath();\n", " func.call(ctx);\n", " }\n", " _render(ctx, _indices, { sx1, sx2, sy }) {\n", " if (this.visuals.fill.doit) {\n", " this.visuals.fill.set_value(ctx);\n", " this._inner(ctx, sx1, sx2, sy, ctx.fill);\n", " }\n", " this.visuals.hatch.doit2(ctx, 0, () => this._inner(ctx, sx1, sx2, sy, ctx.fill), () => this.renderer.request_render());\n", " }\n", " _hit_point(geometry) {\n", " const L = this.sy.length;\n", " const sx = new Float64Array(2 * L);\n", " const sy = new Float64Array(2 * L);\n", " for (let i = 0, end = L; i < end; i++) {\n", " sx[i] = this.sx1[i];\n", " sy[i] = this.sy[i];\n", " sx[L + i] = this.sx2[L - i - 1];\n", " sy[L + i] = this.sy[L - i - 1];\n", " }\n", " const result = new selection_1.Selection();\n", " if (hittest.point_in_poly(geometry.sx, geometry.sy, sx, sy)) {\n", " result.add_to_selected_glyphs(this.model);\n", " result.get_view = () => this;\n", " }\n", " return result;\n", " }\n", " scenterx(i) {\n", " return (this.sx1[i] + this.sx2[i]) / 2;\n", " }\n", " scentery(i) {\n", " return this.sy[i];\n", " }\n", " _map_data() {\n", " this.sx1 = this.renderer.xscale.v_compute(this._x1);\n", " this.sx2 = this.renderer.xscale.v_compute(this._x2);\n", " this.sy = this.renderer.yscale.v_compute(this._y);\n", " }\n", " }\n", " exports.HAreaView = HAreaView;\n", " HAreaView.__name__ = \"HAreaView\";\n", " class HArea extends area_1.Area {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_HArea() {\n", " this.prototype.default_view = HAreaView;\n", " this.define({\n", " x1: [p.CoordinateSpec],\n", " x2: [p.CoordinateSpec],\n", " y: [p.CoordinateSpec],\n", " });\n", " }\n", " }\n", " exports.HArea = HArea;\n", " HArea.__name__ = \"HArea\";\n", " HArea.init_HArea();\n", " },\n", " /* models/glyphs/area.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const glyph_1 = require(89) /* ./glyph */;\n", " const utils_1 = require(92) /* ./utils */;\n", " const mixins = tslib_1.__importStar(require(23) /* ../../core/property_mixins */);\n", " class AreaView extends glyph_1.GlyphView {\n", " draw_legend_for_index(ctx, bbox, index) {\n", " utils_1.generic_area_legend(this.visuals, ctx, bbox, index);\n", " }\n", " }\n", " exports.AreaView = AreaView;\n", " AreaView.__name__ = \"AreaView\";\n", " class Area extends glyph_1.Glyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Area() {\n", " this.mixins([mixins.Fill /*Scalar*/, mixins.HatchVector]);\n", " }\n", " }\n", " exports.Area = Area;\n", " Area.__name__ = \"Area\";\n", " Area.init_Area();\n", " },\n", " /* models/glyphs/varea.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const area_1 = require(96) /* ./area */;\n", " const spatial_1 = require(85) /* ../../core/util/spatial */;\n", " const hittest = tslib_1.__importStar(require(93) /* ../../core/hittest */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class VAreaView extends area_1.AreaView {\n", " _index_data() {\n", " const points = [];\n", " for (let i = 0, end = this._x.length; i < end; i++) {\n", " const x = this._x[i];\n", " const y1 = this._y1[i];\n", " const y2 = this._y2[i];\n", " if (isNaN(x + y1 + y2) || !isFinite(x + y1 + y2))\n", " continue;\n", " points.push({ x0: x, y0: Math.min(y1, y2), x1: x, y1: Math.max(y1, y2), i });\n", " }\n", " return new spatial_1.SpatialIndex(points);\n", " }\n", " _inner(ctx, sx, sy1, sy2, func) {\n", " ctx.beginPath();\n", " for (let i = 0, end = sy1.length; i < end; i++) {\n", " ctx.lineTo(sx[i], sy1[i]);\n", " }\n", " // iterate backwards so that the upper end is below the lower start\n", " for (let i = sy2.length - 1; i >= 0; i--) {\n", " ctx.lineTo(sx[i], sy2[i]);\n", " }\n", " ctx.closePath();\n", " func.call(ctx);\n", " }\n", " _render(ctx, _indices, { sx, sy1, sy2 }) {\n", " if (this.visuals.fill.doit) {\n", " this.visuals.fill.set_value(ctx);\n", " this._inner(ctx, sx, sy1, sy2, ctx.fill);\n", " }\n", " this.visuals.hatch.doit2(ctx, 0, () => this._inner(ctx, sx, sy1, sy2, ctx.fill), () => this.renderer.request_render());\n", " }\n", " scenterx(i) {\n", " return this.sx[i];\n", " }\n", " scentery(i) {\n", " return (this.sy1[i] + this.sy2[i]) / 2;\n", " }\n", " _hit_point(geometry) {\n", " const L = this.sx.length;\n", " const sx = new Float64Array(2 * L);\n", " const sy = new Float64Array(2 * L);\n", " for (let i = 0, end = L; i < end; i++) {\n", " sx[i] = this.sx[i];\n", " sy[i] = this.sy1[i];\n", " sx[L + i] = this.sx[L - i - 1];\n", " sy[L + i] = this.sy2[L - i - 1];\n", " }\n", " const result = new selection_1.Selection();\n", " if (hittest.point_in_poly(geometry.sx, geometry.sy, sx, sy)) {\n", " result.add_to_selected_glyphs(this.model);\n", " result.get_view = () => this;\n", " }\n", " return result;\n", " }\n", " _map_data() {\n", " this.sx = this.renderer.xscale.v_compute(this._x);\n", " this.sy1 = this.renderer.yscale.v_compute(this._y1);\n", " this.sy2 = this.renderer.yscale.v_compute(this._y2);\n", " }\n", " }\n", " exports.VAreaView = VAreaView;\n", " VAreaView.__name__ = \"VAreaView\";\n", " class VArea extends area_1.Area {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_VArea() {\n", " this.prototype.default_view = VAreaView;\n", " this.define({\n", " x: [p.CoordinateSpec],\n", " y1: [p.CoordinateSpec],\n", " y2: [p.CoordinateSpec],\n", " });\n", " }\n", " }\n", " exports.VArea = VArea;\n", " VArea.__name__ = \"VArea\";\n", " VArea.init_VArea();\n", " },\n", " /* models/sources/cds_view.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const model_1 = require(71) /* ../../model */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const columnar_data_source_1 = require(77) /* ./columnar_data_source */;\n", " class CDSView extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_CDSView() {\n", " this.define({\n", " filters: [p.Array, []],\n", " source: [p.Instance],\n", " });\n", " this.internal({\n", " indices: [p.Array, []],\n", " indices_map: [p.Any, {}],\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.compute_indices();\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.properties.filters.change, () => {\n", " this.compute_indices();\n", " this.change.emit();\n", " });\n", " const connect_listeners = () => {\n", " const fn = () => this.compute_indices();\n", " if (this.source != null) {\n", " this.connect(this.source.change, fn);\n", " if (this.source instanceof columnar_data_source_1.ColumnarDataSource) {\n", " this.connect(this.source.streaming, fn);\n", " this.connect(this.source.patching, fn);\n", " }\n", " }\n", " };\n", " let initialized = this.source != null;\n", " if (initialized)\n", " connect_listeners();\n", " else {\n", " this.connect(this.properties.source.change, () => {\n", " if (!initialized) {\n", " connect_listeners();\n", " initialized = true;\n", " }\n", " });\n", " }\n", " }\n", " compute_indices() {\n", " const indices = this.filters\n", " .map((filter) => filter.compute_indices(this.source))\n", " .filter((indices) => indices != null);\n", " if (indices.length > 0)\n", " this.indices = array_1.intersection.apply(this, indices);\n", " else if (this.source instanceof columnar_data_source_1.ColumnarDataSource)\n", " this.indices = this.source.get_indices();\n", " this.indices_map_to_subset();\n", " }\n", " indices_map_to_subset() {\n", " this.indices_map = {};\n", " for (let i = 0; i < this.indices.length; i++) {\n", " this.indices_map[this.indices[i]] = i;\n", " }\n", " }\n", " convert_selection_from_subset(selection_subset) {\n", " const selection_full = new selection_1.Selection();\n", " selection_full.update_through_union(selection_subset);\n", " const indices_1d = selection_subset.indices.map((i) => this.indices[i]);\n", " selection_full.indices = indices_1d;\n", " selection_full.image_indices = selection_subset.image_indices;\n", " return selection_full;\n", " }\n", " convert_selection_to_subset(selection_full) {\n", " const selection_subset = new selection_1.Selection();\n", " selection_subset.update_through_union(selection_full);\n", " const indices_1d = selection_full.indices.map((i) => this.indices_map[i]);\n", " selection_subset.indices = indices_1d;\n", " selection_subset.image_indices = selection_full.image_indices;\n", " return selection_subset;\n", " }\n", " convert_indices_from_subset(indices) {\n", " return indices.map((i) => this.indices[i]);\n", " }\n", " }\n", " exports.CDSView = CDSView;\n", " CDSView.__name__ = \"CDSView\";\n", " CDSView.init_CDSView();\n", " },\n", " /* core/build_views.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const array_1 = require(9) /* ./util/array */;\n", " async function _build_view(view_cls, model, options) {\n", " const view = new view_cls(Object.assign(Object.assign({}, options), { model }));\n", " view.initialize();\n", " await view.lazy_initialize();\n", " return view;\n", " }\n", " async function build_view(model, options = { parent: null }, cls = (model) => model.default_view) {\n", " const view = await _build_view(cls(model), model, options);\n", " view.connect_signals();\n", " return view;\n", " }\n", " exports.build_view = build_view;\n", " async function build_views(view_storage, models, options = { parent: null }, cls = (model) => model.default_view) {\n", " const to_remove = array_1.difference([...view_storage.keys()], models);\n", " for (const model of to_remove) {\n", " view_storage.get(model).remove();\n", " view_storage.delete(model);\n", " }\n", " const created_views = [];\n", " const new_models = models.filter((model) => !view_storage.has(model));\n", " for (const model of new_models) {\n", " const view = await _build_view(cls(model), model, options);\n", " view_storage.set(model, view);\n", " created_views.push(view);\n", " }\n", " for (const view of created_views)\n", " view.connect_signals();\n", " return created_views;\n", " }\n", " exports.build_views = build_views;\n", " function remove_views(view_storage) {\n", " for (const [model, view] of view_storage) {\n", " view.remove();\n", " view_storage.delete(model);\n", " }\n", " }\n", " exports.remove_views = remove_views;\n", " },\n", " /* models/renderers/graph_renderer.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const data_renderer_1 = require(82) /* ./data_renderer */;\n", " const graph_hit_test_policy_1 = require(101) /* ../graphs/graph_hit_test_policy */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const build_views_1 = require(99) /* ../../core/build_views */;\n", " class GraphRendererView extends data_renderer_1.DataRendererView {\n", " initialize() {\n", " super.initialize();\n", " this.xscale = this.plot_view.frame.xscales.default;\n", " this.yscale = this.plot_view.frame.yscales.default;\n", " this._renderer_views = new Map();\n", " }\n", " async lazy_initialize() {\n", " [this.node_view, this.edge_view] = await build_views_1.build_views(this._renderer_views, [\n", " this.model.node_renderer,\n", " this.model.edge_renderer,\n", " ], { parent: this.parent });\n", " this.set_data();\n", " }\n", " remove() {\n", " build_views_1.remove_views(this._renderer_views);\n", " super.remove();\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.layout_provider.change, () => this.set_data());\n", " this.connect(this.model.node_renderer.data_source._select, () => this.set_data());\n", " this.connect(this.model.node_renderer.data_source.inspect, () => this.set_data());\n", " this.connect(this.model.node_renderer.data_source.change, () => this.set_data());\n", " this.connect(this.model.edge_renderer.data_source._select, () => this.set_data());\n", " this.connect(this.model.edge_renderer.data_source.inspect, () => this.set_data());\n", " this.connect(this.model.edge_renderer.data_source.change, () => this.set_data());\n", " const { x_ranges, y_ranges } = this.plot_view.frame;\n", " for (const name in x_ranges) {\n", " const rng = x_ranges[name];\n", " this.connect(rng.change, () => this.set_data());\n", " }\n", " for (const name in y_ranges) {\n", " const rng = y_ranges[name];\n", " this.connect(rng.change, () => this.set_data());\n", " }\n", " }\n", " set_data(request_render = true) {\n", " // TODO (bev) this is a bit clunky, need to make sure glyphs use the correct ranges when they call\n", " // mapping functions on the base Renderer class\n", " this.node_view.glyph.model.setv({ x_range_name: this.model.x_range_name, y_range_name: this.model.y_range_name }, { silent: true });\n", " this.edge_view.glyph.model.setv({ x_range_name: this.model.x_range_name, y_range_name: this.model.y_range_name }, { silent: true });\n", " // XXX\n", " const node_glyph = this.node_view.glyph;\n", " [node_glyph._x, node_glyph._y] =\n", " this.model.layout_provider.get_node_coordinates(this.model.node_renderer.data_source);\n", " const edge_glyph = this.edge_view.glyph;\n", " [edge_glyph._xs, edge_glyph._ys] =\n", " this.model.layout_provider.get_edge_coordinates(this.model.edge_renderer.data_source);\n", " node_glyph.index_data();\n", " edge_glyph.index_data();\n", " if (request_render)\n", " this.request_render();\n", " }\n", " render() {\n", " this.edge_view.render();\n", " this.node_view.render();\n", " }\n", " }\n", " exports.GraphRendererView = GraphRendererView;\n", " GraphRendererView.__name__ = \"GraphRendererView\";\n", " class GraphRenderer extends data_renderer_1.DataRenderer {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_GraphRenderer() {\n", " this.prototype.default_view = GraphRendererView;\n", " this.define({\n", " layout_provider: [p.Instance],\n", " node_renderer: [p.Instance],\n", " edge_renderer: [p.Instance],\n", " selection_policy: [p.Instance, () => new graph_hit_test_policy_1.NodesOnly()],\n", " inspection_policy: [p.Instance, () => new graph_hit_test_policy_1.NodesOnly()],\n", " });\n", " }\n", " get_selection_manager() {\n", " return this.node_renderer.data_source.selection_manager;\n", " }\n", " }\n", " exports.GraphRenderer = GraphRenderer;\n", " GraphRenderer.__name__ = \"GraphRenderer\";\n", " GraphRenderer.init_GraphRenderer();\n", " },\n", " /* models/graphs/graph_hit_test_policy.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const model_1 = require(71) /* ../../model */;\n", " const arrayable_1 = require(12) /* ../../core/util/arrayable */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class GraphHitTestPolicy extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " _hit_test_nodes(geometry, graph_view) {\n", " if (!graph_view.model.visible)\n", " return null;\n", " const hit_test_result = graph_view.node_view.glyph.hit_test(geometry);\n", " if (hit_test_result == null)\n", " return null;\n", " else\n", " return graph_view.node_view.model.view.convert_selection_from_subset(hit_test_result);\n", " }\n", " _hit_test_edges(geometry, graph_view) {\n", " if (!graph_view.model.visible)\n", " return null;\n", " const hit_test_result = graph_view.edge_view.glyph.hit_test(geometry);\n", " if (hit_test_result == null)\n", " return null;\n", " else\n", " return graph_view.edge_view.model.view.convert_selection_from_subset(hit_test_result);\n", " }\n", " }\n", " exports.GraphHitTestPolicy = GraphHitTestPolicy;\n", " GraphHitTestPolicy.__name__ = \"GraphHitTestPolicy\";\n", " class NodesOnly extends GraphHitTestPolicy {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " hit_test(geometry, graph_view) {\n", " return this._hit_test_nodes(geometry, graph_view);\n", " }\n", " do_selection(hit_test_result, graph, final, mode) {\n", " if (hit_test_result == null)\n", " return false;\n", " const node_selection = graph.node_renderer.data_source.selected;\n", " node_selection.update(hit_test_result, final, mode);\n", " graph.node_renderer.data_source._select.emit();\n", " return !node_selection.is_empty();\n", " }\n", " do_inspection(hit_test_result, geometry, graph_view, final, mode) {\n", " if (hit_test_result == null)\n", " return false;\n", " const node_inspection = graph_view.model.get_selection_manager().get_or_create_inspector(graph_view.node_view.model);\n", " node_inspection.update(hit_test_result, final, mode);\n", " // silently set inspected attr to avoid triggering data_source.change event and rerender\n", " graph_view.node_view.model.data_source.setv({ inspected: node_inspection }, { silent: true });\n", " graph_view.node_view.model.data_source.inspect.emit([graph_view.node_view, { geometry }]);\n", " return !node_inspection.is_empty();\n", " }\n", " }\n", " exports.NodesOnly = NodesOnly;\n", " NodesOnly.__name__ = \"NodesOnly\";\n", " class NodesAndLinkedEdges extends GraphHitTestPolicy {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " hit_test(geometry, graph_view) {\n", " return this._hit_test_nodes(geometry, graph_view);\n", " }\n", " get_linked_edges(node_source, edge_source, mode) {\n", " let node_indices = [];\n", " if (mode == 'selection') {\n", " node_indices = node_source.selected.indices.map((i) => node_source.data.index[i]);\n", " }\n", " else if (mode == 'inspection') {\n", " node_indices = node_source.inspected.indices.map((i) => node_source.data.index[i]);\n", " }\n", " const edge_indices = [];\n", " for (let i = 0; i < edge_source.data.start.length; i++) {\n", " if (array_1.contains(node_indices, edge_source.data.start[i]) || array_1.contains(node_indices, edge_source.data.end[i]))\n", " edge_indices.push(i);\n", " }\n", " const linked_edges = new selection_1.Selection();\n", " for (const i of edge_indices) {\n", " linked_edges.multiline_indices[i] = [0]; //currently only supports 2-element multilines, so this is all of it\n", " }\n", " linked_edges.indices = edge_indices;\n", " return linked_edges;\n", " }\n", " do_selection(hit_test_result, graph, final, mode) {\n", " if (hit_test_result == null)\n", " return false;\n", " const node_selection = graph.node_renderer.data_source.selected;\n", " node_selection.update(hit_test_result, final, mode);\n", " const edge_selection = graph.edge_renderer.data_source.selected;\n", " const linked_edges_selection = this.get_linked_edges(graph.node_renderer.data_source, graph.edge_renderer.data_source, 'selection');\n", " edge_selection.update(linked_edges_selection, final, mode);\n", " graph.node_renderer.data_source._select.emit();\n", " return !node_selection.is_empty();\n", " }\n", " do_inspection(hit_test_result, geometry, graph_view, final, mode) {\n", " if (hit_test_result == null)\n", " return false;\n", " const node_inspection = graph_view.node_view.model.data_source.selection_manager.get_or_create_inspector(graph_view.node_view.model);\n", " node_inspection.update(hit_test_result, final, mode);\n", " graph_view.node_view.model.data_source.setv({ inspected: node_inspection }, { silent: true });\n", " const edge_inspection = graph_view.edge_view.model.data_source.selection_manager.get_or_create_inspector(graph_view.edge_view.model);\n", " const linked_edges = this.get_linked_edges(graph_view.node_view.model.data_source, graph_view.edge_view.model.data_source, 'inspection');\n", " edge_inspection.update(linked_edges, final, mode);\n", " //silently set inspected attr to avoid triggering data_source.change event and rerender\n", " graph_view.edge_view.model.data_source.setv({ inspected: edge_inspection }, { silent: true });\n", " graph_view.node_view.model.data_source.inspect.emit([graph_view.node_view, { geometry }]);\n", " return !node_inspection.is_empty();\n", " }\n", " }\n", " exports.NodesAndLinkedEdges = NodesAndLinkedEdges;\n", " NodesAndLinkedEdges.__name__ = \"NodesAndLinkedEdges\";\n", " class EdgesAndLinkedNodes extends GraphHitTestPolicy {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " hit_test(geometry, graph_view) {\n", " return this._hit_test_edges(geometry, graph_view);\n", " }\n", " get_linked_nodes(node_source, edge_source, mode) {\n", " let edge_indices = [];\n", " if (mode == 'selection')\n", " edge_indices = edge_source.selected.indices;\n", " else if (mode == 'inspection')\n", " edge_indices = edge_source.inspected.indices;\n", " const nodes = [];\n", " for (const i of edge_indices) {\n", " nodes.push(edge_source.data.start[i]);\n", " nodes.push(edge_source.data.end[i]);\n", " }\n", " const node_indices = array_1.uniq(nodes).map((i) => arrayable_1.indexOf(node_source.data.index, i));\n", " return new selection_1.Selection({ indices: node_indices });\n", " }\n", " do_selection(hit_test_result, graph, final, mode) {\n", " if (hit_test_result == null)\n", " return false;\n", " const edge_selection = graph.edge_renderer.data_source.selected;\n", " edge_selection.update(hit_test_result, final, mode);\n", " const node_selection = graph.node_renderer.data_source.selected;\n", " const linked_nodes = this.get_linked_nodes(graph.node_renderer.data_source, graph.edge_renderer.data_source, 'selection');\n", " node_selection.update(linked_nodes, final, mode);\n", " graph.edge_renderer.data_source._select.emit();\n", " return !edge_selection.is_empty();\n", " }\n", " do_inspection(hit_test_result, geometry, graph_view, final, mode) {\n", " if (hit_test_result == null)\n", " return false;\n", " const edge_inspection = graph_view.edge_view.model.data_source.selection_manager.get_or_create_inspector(graph_view.edge_view.model);\n", " edge_inspection.update(hit_test_result, final, mode);\n", " graph_view.edge_view.model.data_source.setv({ inspected: edge_inspection }, { silent: true });\n", " const node_inspection = graph_view.node_view.model.data_source.selection_manager.get_or_create_inspector(graph_view.node_view.model);\n", " const linked_nodes = this.get_linked_nodes(graph_view.node_view.model.data_source, graph_view.edge_view.model.data_source, 'inspection');\n", " node_inspection.update(linked_nodes, final, mode);\n", " // silently set inspected attr to avoid triggering data_source.change event and rerender\n", " graph_view.node_view.model.data_source.setv({ inspected: node_inspection }, { silent: true });\n", " graph_view.edge_view.model.data_source.inspect.emit([graph_view.edge_view, { geometry }]);\n", " return !edge_inspection.is_empty();\n", " }\n", " }\n", " exports.EdgesAndLinkedNodes = EdgesAndLinkedNodes;\n", " EdgesAndLinkedNodes.__name__ = \"EdgesAndLinkedNodes\";\n", " },\n", " /* models/selections/interaction_policy.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const model_1 = require(71) /* ../../model */;\n", " class SelectionPolicy extends model_1.Model {\n", " do_selection(hit_test_result, source, final, mode) {\n", " if (hit_test_result === null) {\n", " return false;\n", " }\n", " else {\n", " source.selected.update(hit_test_result, final, mode);\n", " source._select.emit();\n", " return !source.selected.is_empty();\n", " }\n", " }\n", " }\n", " exports.SelectionPolicy = SelectionPolicy;\n", " SelectionPolicy.__name__ = \"SelectionPolicy\";\n", " class IntersectRenderers extends SelectionPolicy {\n", " hit_test(geometry, renderer_views) {\n", " const hit_test_result_renderers = [];\n", " for (const r of renderer_views) {\n", " const result = r.hit_test(geometry);\n", " if (result !== null)\n", " hit_test_result_renderers.push(result);\n", " }\n", " if (hit_test_result_renderers.length > 0) {\n", " const hit_test_result = hit_test_result_renderers[0];\n", " for (const hit_test_result_other of hit_test_result_renderers) {\n", " hit_test_result.update_through_intersection(hit_test_result_other);\n", " }\n", " return hit_test_result;\n", " }\n", " else {\n", " return null;\n", " }\n", " }\n", " }\n", " exports.IntersectRenderers = IntersectRenderers;\n", " IntersectRenderers.__name__ = \"IntersectRenderers\";\n", " class UnionRenderers extends SelectionPolicy {\n", " hit_test(geometry, renderer_views) {\n", " const hit_test_result_renderers = [];\n", " for (const r of renderer_views) {\n", " const result = r.hit_test(geometry);\n", " if (result !== null)\n", " hit_test_result_renderers.push(result);\n", " }\n", " if (hit_test_result_renderers.length > 0) {\n", " const hit_test_result = hit_test_result_renderers[0];\n", " for (const hit_test_result_other of hit_test_result_renderers) {\n", " hit_test_result.update_through_union(hit_test_result_other);\n", " }\n", " return hit_test_result;\n", " }\n", " else {\n", " return null;\n", " }\n", " }\n", " }\n", " exports.UnionRenderers = UnionRenderers;\n", " UnionRenderers.__name__ = \"UnionRenderers\";\n", " },\n", " /* core/util/typed_array.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " function concat(array0, ...arrays) {\n", " let n = array0.length;\n", " for (const array of arrays)\n", " n += array.length;\n", " const result = new array0.constructor(n);\n", " result.set(array0, 0);\n", " let i = array0.length;\n", " for (const array of arrays) {\n", " result.set(array, i);\n", " i += array.length;\n", " }\n", " return result;\n", " }\n", " exports.concat = concat;\n", " },\n", " /* core/util/set.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " function union(...sets) {\n", " const result = new Set();\n", " for (const set of sets) {\n", " for (const item of set) {\n", " result.add(item);\n", " }\n", " }\n", " return result;\n", " }\n", " exports.union = union;\n", " function intersection(set, ...sets) {\n", " const result = new Set();\n", " top: for (const item of set) {\n", " for (const other of sets) {\n", " if (!other.has(item))\n", " continue top;\n", " }\n", " result.add(item);\n", " }\n", " return result;\n", " }\n", " exports.intersection = intersection;\n", " function difference(set, ...sets) {\n", " const result = new Set(set);\n", " for (const item of union(...sets)) {\n", " result.delete(item);\n", " }\n", " return result;\n", " }\n", " exports.difference = difference;\n", " },\n", " /* document/events.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const has_props_1 = require(13) /* ../core/has_props */;\n", " class DocumentEvent {\n", " constructor(document) {\n", " this.document = document;\n", " }\n", " }\n", " exports.DocumentEvent = DocumentEvent;\n", " DocumentEvent.__name__ = \"DocumentEvent\";\n", " class DocumentEventBatch extends DocumentEvent {\n", " constructor(document, events, setter_id) {\n", " super(document);\n", " this.events = events;\n", " this.setter_id = setter_id;\n", " }\n", " }\n", " exports.DocumentEventBatch = DocumentEventBatch;\n", " DocumentEventBatch.__name__ = \"DocumentEventBatch\";\n", " class DocumentChangedEvent extends DocumentEvent {\n", " }\n", " exports.DocumentChangedEvent = DocumentChangedEvent;\n", " DocumentChangedEvent.__name__ = \"DocumentChangedEvent\";\n", " class MessageSentEvent extends DocumentChangedEvent {\n", " constructor(document, msg_type, msg_data) {\n", " super(document);\n", " this.msg_type = msg_type;\n", " this.msg_data = msg_data;\n", " }\n", " json(_references) {\n", " const value = this.msg_data;\n", " const value_json = has_props_1.HasProps._value_to_json(value);\n", " const value_refs = new Set();\n", " has_props_1.HasProps._value_record_references(value, value_refs, { recursive: true });\n", " /* XXX: this will cause all referenced models to be reinitialized\n", " for (const id in value_refs) {\n", " references[id] = value_refs[id]\n", " }\n", " */\n", " return {\n", " kind: \"MessageSent\",\n", " msg_type: this.msg_type,\n", " msg_data: value_json,\n", " };\n", " }\n", " }\n", " exports.MessageSentEvent = MessageSentEvent;\n", " MessageSentEvent.__name__ = \"MessageSentEvent\";\n", " class ModelChangedEvent extends DocumentChangedEvent {\n", " constructor(document, model, attr, old, new_, setter_id, hint) {\n", " super(document);\n", " this.model = model;\n", " this.attr = attr;\n", " this.old = old;\n", " this.new_ = new_;\n", " this.setter_id = setter_id;\n", " this.hint = hint;\n", " }\n", " json(references) {\n", " if (this.attr === \"id\") {\n", " throw new Error(\"'id' field should never change, whatever code just set it is wrong\");\n", " }\n", " if (this.hint != null)\n", " return this.hint.json(references);\n", " const value = this.new_;\n", " const value_json = has_props_1.HasProps._value_to_json(value);\n", " const value_refs = new Set();\n", " has_props_1.HasProps._value_record_references(value, value_refs, { recursive: true });\n", " if (value_refs.has(this.model) && this.model !== value) {\n", " // we know we don't want a whole new copy of the obj we're\n", " // patching unless it's also the value itself\n", " value_refs.delete(this.model);\n", " }\n", " for (const ref of value_refs) {\n", " references.add(ref);\n", " }\n", " return {\n", " kind: \"ModelChanged\",\n", " model: this.model.ref(),\n", " attr: this.attr,\n", " new: value_json,\n", " };\n", " }\n", " }\n", " exports.ModelChangedEvent = ModelChangedEvent;\n", " ModelChangedEvent.__name__ = \"ModelChangedEvent\";\n", " class ColumnsPatchedEvent extends DocumentChangedEvent {\n", " constructor(document, column_source, patches) {\n", " super(document);\n", " this.column_source = column_source;\n", " this.patches = patches;\n", " }\n", " json(_references) {\n", " return {\n", " kind: \"ColumnsPatched\",\n", " column_source: this.column_source,\n", " patches: this.patches,\n", " };\n", " }\n", " }\n", " exports.ColumnsPatchedEvent = ColumnsPatchedEvent;\n", " ColumnsPatchedEvent.__name__ = \"ColumnsPatchedEvent\";\n", " class ColumnsStreamedEvent extends DocumentChangedEvent {\n", " constructor(document, column_source, data, rollover) {\n", " super(document);\n", " this.column_source = column_source;\n", " this.data = data;\n", " this.rollover = rollover;\n", " }\n", " json(_references) {\n", " return {\n", " kind: \"ColumnsStreamed\",\n", " column_source: this.column_source,\n", " data: this.data,\n", " rollover: this.rollover,\n", " };\n", " }\n", " }\n", " exports.ColumnsStreamedEvent = ColumnsStreamedEvent;\n", " ColumnsStreamedEvent.__name__ = \"ColumnsStreamedEvent\";\n", " class TitleChangedEvent extends DocumentChangedEvent {\n", " constructor(document, title, setter_id) {\n", " super(document);\n", " this.title = title;\n", " this.setter_id = setter_id;\n", " }\n", " json(_references) {\n", " return {\n", " kind: \"TitleChanged\",\n", " title: this.title,\n", " };\n", " }\n", " }\n", " exports.TitleChangedEvent = TitleChangedEvent;\n", " TitleChangedEvent.__name__ = \"TitleChangedEvent\";\n", " class RootAddedEvent extends DocumentChangedEvent {\n", " constructor(document, model, setter_id) {\n", " super(document);\n", " this.model = model;\n", " this.setter_id = setter_id;\n", " }\n", " json(references) {\n", " has_props_1.HasProps._value_record_references(this.model, references, { recursive: true });\n", " return {\n", " kind: \"RootAdded\",\n", " model: this.model.ref(),\n", " };\n", " }\n", " }\n", " exports.RootAddedEvent = RootAddedEvent;\n", " RootAddedEvent.__name__ = \"RootAddedEvent\";\n", " class RootRemovedEvent extends DocumentChangedEvent {\n", " constructor(document, model, setter_id) {\n", " super(document);\n", " this.model = model;\n", " this.setter_id = setter_id;\n", " }\n", " json(_references) {\n", " return {\n", " kind: \"RootRemoved\",\n", " model: this.model.ref(),\n", " };\n", " }\n", " }\n", " exports.RootRemovedEvent = RootRemovedEvent;\n", " RootRemovedEvent.__name__ = \"RootRemovedEvent\";\n", " },\n", " /* models/annotations/band.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const annotation_1 = require(31) /* ./annotation */;\n", " const column_data_source_1 = require(76) /* ../sources/column_data_source */;\n", " const mixins = tslib_1.__importStar(require(23) /* ../../core/property_mixins */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class BandView extends annotation_1.AnnotationView {\n", " initialize() {\n", " super.initialize();\n", " this.set_data(this.model.source);\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.source.streaming, () => this.set_data(this.model.source));\n", " this.connect(this.model.source.patching, () => this.set_data(this.model.source));\n", " this.connect(this.model.source.change, () => this.set_data(this.model.source));\n", " }\n", " set_data(source) {\n", " super.set_data(source);\n", " this.visuals.warm_cache(source);\n", " this.plot_view.request_render();\n", " }\n", " _map_data() {\n", " const { frame } = this.plot_view;\n", " const dim = this.model.dimension;\n", " const xscale = frame.xscales[this.model.x_range_name];\n", " const yscale = frame.yscales[this.model.y_range_name];\n", " const limit_scale = dim == \"height\" ? yscale : xscale;\n", " const base_scale = dim == \"height\" ? xscale : yscale;\n", " const limit_view = dim == \"height\" ? frame.yview : frame.xview;\n", " const base_view = dim == \"height\" ? frame.xview : frame.yview;\n", " let _lower_sx;\n", " if (this.model.properties.lower.units == \"data\")\n", " _lower_sx = limit_scale.v_compute(this._lower);\n", " else\n", " _lower_sx = limit_view.v_compute(this._lower);\n", " let _upper_sx;\n", " if (this.model.properties.upper.units == \"data\")\n", " _upper_sx = limit_scale.v_compute(this._upper);\n", " else\n", " _upper_sx = limit_view.v_compute(this._upper);\n", " let _base_sx;\n", " if (this.model.properties.base.units == \"data\")\n", " _base_sx = base_scale.v_compute(this._base);\n", " else\n", " _base_sx = base_view.v_compute(this._base);\n", " const [i, j] = dim == 'height' ? [1, 0] : [0, 1];\n", " const _lower = [_lower_sx, _base_sx];\n", " const _upper = [_upper_sx, _base_sx];\n", " this._lower_sx = _lower[i];\n", " this._lower_sy = _lower[j];\n", " this._upper_sx = _upper[i];\n", " this._upper_sy = _upper[j];\n", " }\n", " render() {\n", " if (!this.model.visible)\n", " return;\n", " this._map_data();\n", " const { ctx } = this.layer;\n", " // Draw the band body\n", " ctx.beginPath();\n", " ctx.moveTo(this._lower_sx[0], this._lower_sy[0]);\n", " for (let i = 0, end = this._lower_sx.length; i < end; i++) {\n", " ctx.lineTo(this._lower_sx[i], this._lower_sy[i]);\n", " }\n", " // iterate backwards so that the upper end is below the lower start\n", " for (let i = this._upper_sx.length - 1; i >= 0; i--) {\n", " ctx.lineTo(this._upper_sx[i], this._upper_sy[i]);\n", " }\n", " ctx.closePath();\n", " if (this.visuals.fill.doit) {\n", " this.visuals.fill.set_value(ctx);\n", " ctx.fill();\n", " }\n", " // Draw the lower band edge\n", " ctx.beginPath();\n", " ctx.moveTo(this._lower_sx[0], this._lower_sy[0]);\n", " for (let i = 0, end = this._lower_sx.length; i < end; i++) {\n", " ctx.lineTo(this._lower_sx[i], this._lower_sy[i]);\n", " }\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_value(ctx);\n", " ctx.stroke();\n", " }\n", " // Draw the upper band edge\n", " ctx.beginPath();\n", " ctx.moveTo(this._upper_sx[0], this._upper_sy[0]);\n", " for (let i = 0, end = this._upper_sx.length; i < end; i++) {\n", " ctx.lineTo(this._upper_sx[i], this._upper_sy[i]);\n", " }\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_value(ctx);\n", " ctx.stroke();\n", " }\n", " }\n", " }\n", " exports.BandView = BandView;\n", " BandView.__name__ = \"BandView\";\n", " class Band extends annotation_1.Annotation {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Band() {\n", " this.prototype.default_view = BandView;\n", " this.mixins([mixins.Line /*Scalar*/, mixins.Fill /*Scalar*/]);\n", " this.define({\n", " lower: [p.DistanceSpec],\n", " upper: [p.DistanceSpec],\n", " base: [p.DistanceSpec],\n", " dimension: [p.Dimension, 'height'],\n", " source: [p.Instance, () => new column_data_source_1.ColumnDataSource()],\n", " x_range_name: [p.String, 'default'],\n", " y_range_name: [p.String, 'default'],\n", " });\n", " this.override({\n", " fill_color: \"#fff9ba\",\n", " fill_alpha: 0.4,\n", " line_color: \"#cccccc\",\n", " line_alpha: 0.3,\n", " });\n", " }\n", " }\n", " exports.Band = Band;\n", " Band.__name__ = \"Band\";\n", " Band.init_Band();\n", " },\n", " /* models/annotations/box_annotation.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const annotation_1 = require(31) /* ./annotation */;\n", " const signaling_1 = require(14) /* ../../core/signaling */;\n", " const mixins = tslib_1.__importStar(require(23) /* ../../core/property_mixins */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const bbox_1 = require(88) /* ../../core/util/bbox */;\n", " exports.EDGE_TOLERANCE = 2.5;\n", " class BoxAnnotationView extends annotation_1.AnnotationView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.change, () => this.plot_view.request_paint(this));\n", " this.connect(this.model.data_update, () => this.plot_view.request_paint(this));\n", " }\n", " render() {\n", " if (!this.model.visible)\n", " return;\n", " // don't render if *all* position are null\n", " if (this.model.left == null && this.model.right == null && this.model.top == null && this.model.bottom == null) {\n", " return;\n", " }\n", " const { frame } = this.plot_view;\n", " const xscale = frame.xscales[this.model.x_range_name];\n", " const yscale = frame.yscales[this.model.y_range_name];\n", " const _calc_dim = (dim, dim_units, scale, view, frame_extrema) => {\n", " let sdim;\n", " if (dim != null) {\n", " if (this.model.screen)\n", " sdim = dim;\n", " else {\n", " if (dim_units == 'data')\n", " sdim = scale.compute(dim);\n", " else\n", " sdim = view.compute(dim);\n", " }\n", " }\n", " else\n", " sdim = frame_extrema;\n", " return sdim;\n", " };\n", " this.sleft = _calc_dim(this.model.left, this.model.left_units, xscale, frame.xview, frame._left.value);\n", " this.sright = _calc_dim(this.model.right, this.model.right_units, xscale, frame.xview, frame._right.value);\n", " this.stop = _calc_dim(this.model.top, this.model.top_units, yscale, frame.yview, frame._top.value);\n", " this.sbottom = _calc_dim(this.model.bottom, this.model.bottom_units, yscale, frame.yview, frame._bottom.value);\n", " this._paint_box(this.sleft, this.sright, this.sbottom, this.stop);\n", " }\n", " _paint_box(sleft, sright, sbottom, stop) {\n", " const { ctx } = this.layer;\n", " ctx.save();\n", " ctx.beginPath();\n", " ctx.rect(sleft, stop, sright - sleft, sbottom - stop);\n", " if (this.visuals.fill.doit) {\n", " this.visuals.fill.set_value(ctx);\n", " ctx.fill();\n", " }\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_value(ctx);\n", " ctx.stroke();\n", " }\n", " ctx.restore();\n", " }\n", " interactive_bbox() {\n", " const tol = this.model.properties.line_width.value() + exports.EDGE_TOLERANCE;\n", " return new bbox_1.BBox({\n", " x0: this.sleft - tol,\n", " y0: this.stop - tol,\n", " x1: this.sright + tol,\n", " y1: this.sbottom + tol,\n", " });\n", " }\n", " interactive_hit(sx, sy) {\n", " if (this.model.in_cursor == null)\n", " return false;\n", " const bbox = this.interactive_bbox();\n", " return bbox.contains(sx, sy);\n", " }\n", " cursor(sx, sy) {\n", " const tol = 3;\n", " if (Math.abs(sx - this.sleft) < tol || Math.abs(sx - this.sright) < tol)\n", " return this.model.ew_cursor;\n", " else if (Math.abs(sy - this.sbottom) < tol || Math.abs(sy - this.stop) < tol)\n", " return this.model.ns_cursor;\n", " else if (sx > this.sleft && sx < this.sright && sy > this.stop && sy < this.sbottom)\n", " return this.model.in_cursor;\n", " else\n", " return null;\n", " }\n", " }\n", " exports.BoxAnnotationView = BoxAnnotationView;\n", " BoxAnnotationView.__name__ = \"BoxAnnotationView\";\n", " class BoxAnnotation extends annotation_1.Annotation {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_BoxAnnotation() {\n", " this.prototype.default_view = BoxAnnotationView;\n", " this.mixins([mixins.Line /*Scalar*/, mixins.Fill /*Scalar*/]);\n", " this.define({\n", " render_mode: [p.RenderMode, 'canvas'],\n", " x_range_name: [p.String, 'default'],\n", " y_range_name: [p.String, 'default'],\n", " top: [p.Number, null],\n", " top_units: [p.SpatialUnits, 'data'],\n", " bottom: [p.Number, null],\n", " bottom_units: [p.SpatialUnits, 'data'],\n", " left: [p.Number, null],\n", " left_units: [p.SpatialUnits, 'data'],\n", " right: [p.Number, null],\n", " right_units: [p.SpatialUnits, 'data'],\n", " });\n", " this.internal({\n", " screen: [p.Boolean, false],\n", " ew_cursor: [p.String, null],\n", " ns_cursor: [p.String, null],\n", " in_cursor: [p.String, null],\n", " });\n", " this.override({\n", " fill_color: '#fff9ba',\n", " fill_alpha: 0.4,\n", " line_color: '#cccccc',\n", " line_alpha: 0.3,\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.data_update = new signaling_1.Signal0(this, \"data_update\");\n", " }\n", " update({ left, right, top, bottom }) {\n", " this.setv({ left, right, top, bottom, screen: true }, { silent: true });\n", " this.data_update.emit();\n", " }\n", " }\n", " exports.BoxAnnotation = BoxAnnotation;\n", " BoxAnnotation.__name__ = \"BoxAnnotation\";\n", " BoxAnnotation.init_BoxAnnotation();\n", " },\n", " /* models/annotations/color_bar.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const annotation_1 = require(31) /* ./annotation */;\n", " const basic_ticker_1 = require(109) /* ../tickers/basic_ticker */;\n", " const basic_tick_formatter_1 = require(113) /* ../formatters/basic_tick_formatter */;\n", " const linear_color_mapper_1 = require(115) /* ../mappers/linear_color_mapper */;\n", " const linear_scale_1 = require(120) /* ../scales/linear_scale */;\n", " const log_scale_1 = require(130) /* ../scales/log_scale */;\n", " const range1d_1 = require(131) /* ../ranges/range1d */;\n", " const mixins = tslib_1.__importStar(require(23) /* ../../core/property_mixins */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const text_util = tslib_1.__importStar(require(132) /* ../../core/util/text */);\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const arrayable_1 = require(12) /* ../../core/util/arrayable */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const assert_1 = require(11) /* ../../core/util/assert */;\n", " const SHORT_DIM = 25;\n", " const LONG_DIM_MIN_SCALAR = 0.3;\n", " const LONG_DIM_MAX_SCALAR = 0.8;\n", " class ColorBarView extends annotation_1.AnnotationView {\n", " initialize() {\n", " super.initialize();\n", " this._set_canvas_image();\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.visible.change, () => this.plot_view.request_render());\n", " this.connect(this.model.ticker.change, () => this.plot_view.request_render());\n", " this.connect(this.model.formatter.change, () => this.plot_view.request_render());\n", " if (this.model.color_mapper != null) {\n", " this.connect(this.model.color_mapper.change, () => {\n", " this._set_canvas_image();\n", " this.plot_view.request_render();\n", " });\n", " }\n", " }\n", " _get_size() {\n", " if (this.model.color_mapper == null)\n", " return { width: 0, height: 0 };\n", " else {\n", " const { width, height } = this.compute_legend_dimensions();\n", " return { width, height };\n", " }\n", " }\n", " _set_canvas_image() {\n", " if (this.model.color_mapper == null)\n", " return;\n", " let { palette } = this.model.color_mapper;\n", " if (this.model.orientation == 'vertical')\n", " palette = array_1.reversed(palette);\n", " let w, h;\n", " switch (this.model.orientation) {\n", " case \"vertical\": {\n", " [w, h] = [1, palette.length];\n", " break;\n", " }\n", " case \"horizontal\": {\n", " [w, h] = [palette.length, 1];\n", " break;\n", " }\n", " }\n", " const canvas = document.createElement('canvas');\n", " canvas.width = w;\n", " canvas.height = h;\n", " const image_ctx = canvas.getContext('2d');\n", " const image_data = image_ctx.getImageData(0, 0, w, h);\n", " // We always want to draw the entire palette linearly, so we create a new\n", " // LinearColorMapper instance and map a monotonic range of values with\n", " // length = palette.length to get each palette color in order.\n", " const cmap = new linear_color_mapper_1.LinearColorMapper({ palette }).rgba_mapper;\n", " const buf8 = cmap.v_compute(array_1.range(0, palette.length));\n", " image_data.data.set(buf8);\n", " image_ctx.putImageData(image_data, 0, 0);\n", " this.image = canvas;\n", " }\n", " compute_legend_dimensions() {\n", " const image_dimensions = this._computed_image_dimensions();\n", " const [image_height, image_width] = [image_dimensions.height, image_dimensions.width];\n", " const label_extent = this._get_label_extent();\n", " const title_extent = this._title_extent();\n", " const tick_extent = this._tick_extent();\n", " const { padding } = this.model;\n", " let legend_height, legend_width;\n", " switch (this.model.orientation) {\n", " case \"vertical\":\n", " legend_height = image_height + title_extent + 2 * padding;\n", " legend_width = image_width + tick_extent + label_extent + 2 * padding;\n", " break;\n", " case \"horizontal\":\n", " legend_height = image_height + title_extent + tick_extent + label_extent + 2 * padding;\n", " legend_width = image_width + 2 * padding;\n", " break;\n", " }\n", " return { width: legend_width, height: legend_height };\n", " }\n", " compute_legend_location() {\n", " const legend_dimensions = this.compute_legend_dimensions();\n", " const [legend_height, legend_width] = [legend_dimensions.height, legend_dimensions.width];\n", " const legend_margin = this.model.margin;\n", " const panel = this.panel != null ? this.panel : this.plot_view.frame;\n", " const [hr, vr] = panel.bbox.ranges;\n", " const { location } = this.model;\n", " let sx, sy;\n", " if (types_1.isString(location)) {\n", " switch (location) {\n", " case 'top_left':\n", " sx = hr.start + legend_margin;\n", " sy = vr.start + legend_margin;\n", " break;\n", " case 'top_center':\n", " sx = (hr.end + hr.start) / 2 - legend_width / 2;\n", " sy = vr.start + legend_margin;\n", " break;\n", " case 'top_right':\n", " sx = hr.end - legend_margin - legend_width;\n", " sy = vr.start + legend_margin;\n", " break;\n", " case 'bottom_right':\n", " sx = hr.end - legend_margin - legend_width;\n", " sy = vr.end - legend_margin - legend_height;\n", " break;\n", " case 'bottom_center':\n", " sx = (hr.end + hr.start) / 2 - legend_width / 2;\n", " sy = vr.end - legend_margin - legend_height;\n", " break;\n", " case 'bottom_left':\n", " sx = hr.start + legend_margin;\n", " sy = vr.end - legend_margin - legend_height;\n", " break;\n", " case 'center_left':\n", " sx = hr.start + legend_margin;\n", " sy = (vr.end + vr.start) / 2 - legend_height / 2;\n", " break;\n", " case 'center':\n", " sx = (hr.end + hr.start) / 2 - legend_width / 2;\n", " sy = (vr.end + vr.start) / 2 - legend_height / 2;\n", " break;\n", " case 'center_right':\n", " sx = hr.end - legend_margin - legend_width;\n", " sy = (vr.end + vr.start) / 2 - legend_height / 2;\n", " break;\n", " }\n", " }\n", " else if (types_1.isArray(location) && location.length == 2) {\n", " const [vx, vy] = location;\n", " sx = panel.xview.compute(vx);\n", " sy = panel.yview.compute(vy) - legend_height;\n", " }\n", " else\n", " assert_1.unreachable();\n", " return { sx, sy };\n", " }\n", " render() {\n", " if (!this.model.visible || this.model.color_mapper == null)\n", " return;\n", " const { ctx } = this.layer;\n", " ctx.save();\n", " const { sx, sy } = this.compute_legend_location();\n", " ctx.translate(sx, sy);\n", " this._draw_bbox(ctx);\n", " const image_offset = this._get_image_offset();\n", " ctx.translate(image_offset.x, image_offset.y);\n", " this._draw_image(ctx);\n", " if (this.model.color_mapper.low != null && this.model.color_mapper.high != null) {\n", " const tick_info = this.tick_info();\n", " this._draw_major_ticks(ctx, tick_info);\n", " this._draw_minor_ticks(ctx, tick_info);\n", " this._draw_major_labels(ctx, tick_info);\n", " }\n", " if (this.model.title)\n", " this._draw_title(ctx);\n", " ctx.restore();\n", " }\n", " _draw_bbox(ctx) {\n", " const bbox = this.compute_legend_dimensions();\n", " ctx.save();\n", " if (this.visuals.background_fill.doit) {\n", " this.visuals.background_fill.set_value(ctx);\n", " ctx.fillRect(0, 0, bbox.width, bbox.height);\n", " }\n", " if (this.visuals.border_line.doit) {\n", " this.visuals.border_line.set_value(ctx);\n", " ctx.strokeRect(0, 0, bbox.width, bbox.height);\n", " }\n", " ctx.restore();\n", " }\n", " _draw_image(ctx) {\n", " const image = this._computed_image_dimensions();\n", " ctx.save();\n", " ctx.setImageSmoothingEnabled(false);\n", " ctx.globalAlpha = this.model.scale_alpha;\n", " ctx.drawImage(this.image, 0, 0, image.width, image.height);\n", " if (this.visuals.bar_line.doit) {\n", " this.visuals.bar_line.set_value(ctx);\n", " ctx.strokeRect(0, 0, image.width, image.height);\n", " }\n", " ctx.restore();\n", " }\n", " _draw_major_ticks(ctx, tick_info) {\n", " if (!this.visuals.major_tick_line.doit)\n", " return;\n", " const [nx, ny] = this._normals();\n", " const image = this._computed_image_dimensions();\n", " const [x_offset, y_offset] = [image.width * nx, image.height * ny];\n", " const [sx, sy] = tick_info.coords.major;\n", " const tin = this.model.major_tick_in;\n", " const tout = this.model.major_tick_out;\n", " ctx.save();\n", " ctx.translate(x_offset, y_offset);\n", " this.visuals.major_tick_line.set_value(ctx);\n", " for (let i = 0, end = sx.length; i < end; i++) {\n", " ctx.beginPath();\n", " ctx.moveTo(Math.round(sx[i] + nx * tout), Math.round(sy[i] + ny * tout));\n", " ctx.lineTo(Math.round(sx[i] - nx * tin), Math.round(sy[i] - ny * tin));\n", " ctx.stroke();\n", " }\n", " ctx.restore();\n", " }\n", " _draw_minor_ticks(ctx, tick_info) {\n", " if (!this.visuals.minor_tick_line.doit)\n", " return;\n", " const [nx, ny] = this._normals();\n", " const image = this._computed_image_dimensions();\n", " const [x_offset, y_offset] = [image.width * nx, image.height * ny];\n", " const [sx, sy] = tick_info.coords.minor;\n", " const tin = this.model.minor_tick_in;\n", " const tout = this.model.minor_tick_out;\n", " ctx.save();\n", " ctx.translate(x_offset, y_offset);\n", " this.visuals.minor_tick_line.set_value(ctx);\n", " for (let i = 0, end = sx.length; i < end; i++) {\n", " ctx.beginPath();\n", " ctx.moveTo(Math.round(sx[i] + nx * tout), Math.round(sy[i] + ny * tout));\n", " ctx.lineTo(Math.round(sx[i] - nx * tin), Math.round(sy[i] - ny * tin));\n", " ctx.stroke();\n", " }\n", " ctx.restore();\n", " }\n", " _draw_major_labels(ctx, tick_info) {\n", " if (!this.visuals.major_label_text.doit)\n", " return;\n", " const [nx, ny] = this._normals();\n", " const image = this._computed_image_dimensions();\n", " const [x_offset, y_offset] = [image.width * nx, image.height * ny];\n", " const standoff = (this.model.label_standoff + this._tick_extent());\n", " const [x_standoff, y_standoff] = [standoff * nx, standoff * ny];\n", " const [sx, sy] = tick_info.coords.major;\n", " const formatted_labels = tick_info.labels.major;\n", " this.visuals.major_label_text.set_value(ctx);\n", " ctx.save();\n", " ctx.translate(x_offset + x_standoff, y_offset + y_standoff);\n", " for (let i = 0, end = sx.length; i < end; i++) {\n", " ctx.fillText(formatted_labels[i], Math.round(sx[i] + nx * this.model.label_standoff), Math.round(sy[i] + ny * this.model.label_standoff));\n", " }\n", " ctx.restore();\n", " }\n", " _draw_title(ctx) {\n", " if (!this.visuals.title_text.doit)\n", " return;\n", " ctx.save();\n", " this.visuals.title_text.set_value(ctx);\n", " ctx.fillText(this.model.title, 0, -this.model.title_standoff);\n", " ctx.restore();\n", " }\n", " /*protected*/ _get_label_extent() {\n", " const major_labels = this.tick_info().labels.major;\n", " let label_extent;\n", " if (this.model.color_mapper.low != null && this.model.color_mapper.high != null && !array_1.is_empty(major_labels)) {\n", " const { ctx } = this.layer;\n", " ctx.save();\n", " this.visuals.major_label_text.set_value(ctx);\n", " switch (this.model.orientation) {\n", " case \"vertical\":\n", " label_extent = array_1.max((major_labels.map((label) => ctx.measureText(label.toString()).width)));\n", " break;\n", " case \"horizontal\":\n", " label_extent = text_util.measure_font(this.visuals.major_label_text.font_value()).height;\n", " break;\n", " }\n", " label_extent += this.model.label_standoff;\n", " ctx.restore();\n", " }\n", " else\n", " label_extent = 0;\n", " return label_extent;\n", " }\n", " /*protected*/ _get_image_offset() {\n", " // Returns image offset relative to legend bounding box\n", " const x = this.model.padding;\n", " const y = this.model.padding + this._title_extent();\n", " return { x, y };\n", " }\n", " // {{{ TODO: state\n", " _normals() {\n", " return this.model.orientation == 'vertical' ? [1, 0] : [0, 1];\n", " }\n", " _title_extent() {\n", " const font_value = this.model.title_text_font + \" \" + this.model.title_text_font_size + \" \" + this.model.title_text_font_style;\n", " const title_extent = this.model.title ? text_util.measure_font(font_value).height + this.model.title_standoff : 0;\n", " return title_extent;\n", " }\n", " _tick_extent() {\n", " if (this.model.color_mapper.low != null && this.model.color_mapper.high != null)\n", " return array_1.max([this.model.major_tick_out, this.model.minor_tick_out]);\n", " else\n", " return 0;\n", " }\n", " _computed_image_dimensions() {\n", " /*\n", " Heuristics to determine ColorBar image dimensions if set to \"auto\"\n", " \n", " Note: Returns the height/width values for the ColorBar's scale image, not\n", " the dimensions of the entire ColorBar.\n", " \n", " If the short dimension (the width of a vertical bar or height of a\n", " horizontal bar) is set to \"auto\", the resulting dimension will be set to\n", " 25 px.\n", " \n", " For a ColorBar in a side panel with the long dimension (the height of a\n", " vertical bar or width of a horizontal bar) set to \"auto\", the\n", " resulting dimension will be as long as the adjacent frame edge, so that the\n", " bar \"fits\" to the plot.\n", " \n", " For a ColorBar in the plot frame with the long dimension set to \"auto\", the\n", " resulting dimension will be the greater of:\n", " * The length of the color palette * 25px\n", " * The parallel frame dimension * 0.30\n", " (i.e the frame height for a vertical ColorBar)\n", " But not greater than:\n", " * The parallel frame dimension * 0.80\n", " */\n", " const frame_height = this.plot_view.frame._height.value;\n", " const frame_width = this.plot_view.frame._width.value;\n", " const title_extent = this._title_extent();\n", " let height, width;\n", " switch (this.model.orientation) {\n", " case \"vertical\": {\n", " if (this.model.height == 'auto') {\n", " if (this.panel != null)\n", " height = frame_height - 2 * this.model.padding - title_extent;\n", " else {\n", " height = array_1.max([this.model.color_mapper.palette.length * SHORT_DIM, frame_height * LONG_DIM_MIN_SCALAR]);\n", " height = array_1.min([height, frame_height * LONG_DIM_MAX_SCALAR - 2 * this.model.padding - title_extent]);\n", " }\n", " }\n", " else\n", " height = this.model.height;\n", " width = this.model.width == 'auto' ? SHORT_DIM : this.model.width;\n", " break;\n", " }\n", " case \"horizontal\": {\n", " height = this.model.height == 'auto' ? SHORT_DIM : this.model.height;\n", " if (this.model.width == 'auto') {\n", " if (this.panel != null)\n", " width = frame_width - 2 * this.model.padding;\n", " else {\n", " width = array_1.max([this.model.color_mapper.palette.length * SHORT_DIM, frame_width * LONG_DIM_MIN_SCALAR]);\n", " width = array_1.min([width, frame_width * LONG_DIM_MAX_SCALAR - 2 * this.model.padding]);\n", " }\n", " }\n", " else\n", " width = this.model.width;\n", " break;\n", " }\n", " }\n", " return { width, height };\n", " }\n", " /*protected*/ _tick_coordinate_scale(scale_length) {\n", " /*\n", " Creates and returns a scale instance that maps the `color_mapper` range\n", " (low to high) to a screen space range equal to the length of the ColorBar's\n", " scale image. The scale is used to calculate the tick coordinates in screen\n", " coordinates for plotting purposes.\n", " \n", " Note: the type of color_mapper has to match the type of scale (i.e.\n", " a LinearColorMapper will require a corresponding LinearScale instance).\n", " */\n", " const ranges = {\n", " source_range: new range1d_1.Range1d({\n", " start: this.model.color_mapper.low,\n", " end: this.model.color_mapper.high,\n", " }),\n", " target_range: new range1d_1.Range1d({\n", " start: 0,\n", " end: scale_length,\n", " }),\n", " };\n", " switch (this.model.color_mapper.type) {\n", " case \"LinearColorMapper\": return new linear_scale_1.LinearScale(ranges);\n", " case \"LogColorMapper\": return new log_scale_1.LogScale(ranges);\n", " default:\n", " assert_1.unreachable();\n", " }\n", " }\n", " _format_major_labels(initial_labels, major_ticks) {\n", " // XXX: passing null as cross_loc probably means MercatorTickFormatters, etc\n", " // will not function properly in conjunction with colorbars\n", " const formatted_labels = this.model.formatter.doFormat(initial_labels, null);\n", " for (let i = 0, end = major_ticks.length; i < end; i++) {\n", " if (major_ticks[i] in this.model.major_label_overrides)\n", " formatted_labels[i] = this.model.major_label_overrides[major_ticks[i]];\n", " }\n", " return formatted_labels;\n", " }\n", " tick_info() {\n", " const image_dimensions = this._computed_image_dimensions();\n", " let scale_length;\n", " switch (this.model.orientation) {\n", " case \"vertical\": {\n", " scale_length = image_dimensions.height;\n", " break;\n", " }\n", " case \"horizontal\": {\n", " scale_length = image_dimensions.width;\n", " break;\n", " }\n", " }\n", " const scale = this._tick_coordinate_scale(scale_length);\n", " const [i, j] = this._normals();\n", " const [start, end] = [this.model.color_mapper.low, this.model.color_mapper.high];\n", " // XXX: passing null as cross_loc probably means MercatorTickers, etc\n", " // will not function properly in conjunction with colorbars\n", " const ticks = this.model.ticker.get_ticks(start, end, null, null, this.model.ticker.desired_num_ticks);\n", " const majors = ticks.major;\n", " const minors = ticks.minor;\n", " const major_coords = [[], []];\n", " const minor_coords = [[], []];\n", " for (let ii = 0, _end = majors.length; ii < _end; ii++) {\n", " if (majors[ii] < start || majors[ii] > end)\n", " continue;\n", " major_coords[i].push(majors[ii]);\n", " major_coords[j].push(0);\n", " }\n", " for (let ii = 0, _end = minors.length; ii < _end; ii++) {\n", " if (minors[ii] < start || minors[ii] > end)\n", " continue;\n", " minor_coords[i].push(minors[ii]);\n", " minor_coords[j].push(0);\n", " }\n", " const labels = { major: this._format_major_labels(major_coords[i], majors) };\n", " const coords = {\n", " major: [[], []],\n", " minor: [[], []],\n", " };\n", " coords.major[i] = scale.v_compute(major_coords[i]);\n", " coords.minor[i] = scale.v_compute(minor_coords[i]);\n", " coords.major[j] = major_coords[j];\n", " coords.minor[j] = minor_coords[j];\n", " // Because we want the scale to be reversed\n", " if (this.model.orientation == 'vertical') {\n", " coords.major[i] = arrayable_1.map(coords.major[i], (coord) => scale_length - coord);\n", " coords.minor[i] = arrayable_1.map(coords.minor[i], (coord) => scale_length - coord);\n", " }\n", " return { coords, labels };\n", " }\n", " }\n", " exports.ColorBarView = ColorBarView;\n", " ColorBarView.__name__ = \"ColorBarView\";\n", " class ColorBar extends annotation_1.Annotation {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ColorBar() {\n", " this.prototype.default_view = ColorBarView;\n", " this.mixins([\n", " [\"major_label_\", mixins.Text],\n", " [\"title_\", mixins.Text],\n", " [\"major_tick_\", mixins.Line],\n", " [\"minor_tick_\", mixins.Line],\n", " [\"border_\", mixins.Line],\n", " [\"bar_\", mixins.Line],\n", " [\"background_\", mixins.Fill],\n", " ]);\n", " this.define({\n", " location: [p.Any, 'top_right'],\n", " orientation: [p.Orientation, 'vertical'],\n", " title: [p.String],\n", " title_standoff: [p.Number, 2],\n", " width: [p.Any, 'auto'],\n", " height: [p.Any, 'auto'],\n", " scale_alpha: [p.Number, 1.0],\n", " ticker: [p.Instance, () => new basic_ticker_1.BasicTicker()],\n", " formatter: [p.Instance, () => new basic_tick_formatter_1.BasicTickFormatter()],\n", " major_label_overrides: [p.Any, {}],\n", " color_mapper: [p.Instance],\n", " label_standoff: [p.Number, 5],\n", " margin: [p.Number, 30],\n", " padding: [p.Number, 10],\n", " major_tick_in: [p.Number, 5],\n", " major_tick_out: [p.Number, 0],\n", " minor_tick_in: [p.Number, 0],\n", " minor_tick_out: [p.Number, 0],\n", " });\n", " this.override({\n", " background_fill_color: \"#ffffff\",\n", " background_fill_alpha: 0.95,\n", " bar_line_color: null,\n", " border_line_color: null,\n", " major_label_text_align: \"center\",\n", " major_label_text_baseline: \"middle\",\n", " major_label_text_font_size: \"11px\",\n", " major_tick_line_color: \"#ffffff\",\n", " minor_tick_line_color: null,\n", " title_text_font_size: \"13px\",\n", " title_text_font_style: \"italic\",\n", " });\n", " }\n", " }\n", " exports.ColorBar = ColorBar;\n", " ColorBar.__name__ = \"ColorBar\";\n", " ColorBar.init_ColorBar();\n", " },\n", " /* models/tickers/basic_ticker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const adaptive_ticker_1 = require(110) /* ./adaptive_ticker */;\n", " class BasicTicker extends adaptive_ticker_1.AdaptiveTicker {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " }\n", " exports.BasicTicker = BasicTicker;\n", " BasicTicker.__name__ = \"BasicTicker\";\n", " },\n", " /* models/tickers/adaptive_ticker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const continuous_ticker_1 = require(111) /* ./continuous_ticker */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " // Forces a number x into a specified range [min_val, max_val].\n", " function clamp(x, min_val, max_val) {\n", " return Math.max(min_val, Math.min(max_val, x));\n", " }\n", " // A log function with an optional base.\n", " function log(x, base = Math.E) {\n", " return Math.log(x) / Math.log(base);\n", " }\n", " class AdaptiveTicker extends continuous_ticker_1.ContinuousTicker {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_AdaptiveTicker() {\n", " this.define({\n", " base: [p.Number, 10.0],\n", " mantissas: [p.Array, [1, 2, 5]],\n", " min_interval: [p.Number, 0.0],\n", " max_interval: [p.Number],\n", " });\n", " }\n", " // These arguments control the range of possible intervals. The interval I\n", " // returned by get_interval() will be the one that most closely matches the\n", " // desired number of ticks, subject to the following constraints:\n", " // I = (M * B^N), where\n", " // M is a member of mantissas,\n", " // B is base,\n", " // and N is an integer;\n", " // and min_interval <= I <= max_interval.\n", " initialize() {\n", " super.initialize();\n", " const prefix_mantissa = array_1.nth(this.mantissas, -1) / this.base;\n", " const suffix_mantissa = array_1.nth(this.mantissas, 0) * this.base;\n", " this.extended_mantissas = [prefix_mantissa, ...this.mantissas, suffix_mantissa];\n", " this.base_factor = this.get_min_interval() === 0.0 ? 1.0 : this.get_min_interval();\n", " }\n", " get_interval(data_low, data_high, desired_n_ticks) {\n", " const data_range = data_high - data_low;\n", " const ideal_interval = this.get_ideal_interval(data_low, data_high, desired_n_ticks);\n", " const interval_exponent = Math.floor(log(ideal_interval / this.base_factor, this.base));\n", " const ideal_magnitude = this.base ** interval_exponent * this.base_factor;\n", " // An untested optimization.\n", " // const ideal_mantissa = ideal_interval / ideal_magnitude\n", " // index = sorted_index(this.extended_mantissas, ideal_mantissa)\n", " // candidate_mantissas = this.extended_mantissas[index..index + 1]\n", " const candidate_mantissas = this.extended_mantissas;\n", " const errors = candidate_mantissas.map((mantissa) => {\n", " return Math.abs(desired_n_ticks - (data_range / (mantissa * ideal_magnitude)));\n", " });\n", " const best_mantissa = candidate_mantissas[array_1.argmin(errors)];\n", " const interval = best_mantissa * ideal_magnitude;\n", " return clamp(interval, this.get_min_interval(), this.get_max_interval());\n", " }\n", " }\n", " exports.AdaptiveTicker = AdaptiveTicker;\n", " AdaptiveTicker.__name__ = \"AdaptiveTicker\";\n", " AdaptiveTicker.init_AdaptiveTicker();\n", " },\n", " /* models/tickers/continuous_ticker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const ticker_1 = require(112) /* ./ticker */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " class ContinuousTicker extends ticker_1.Ticker {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ContinuousTicker() {\n", " this.define({\n", " num_minor_ticks: [p.Number, 5],\n", " desired_num_ticks: [p.Number, 6],\n", " });\n", " }\n", " get_ticks(data_low, data_high, _range, cross_loc, _) {\n", " return this.get_ticks_no_defaults(data_low, data_high, cross_loc, this.desired_num_ticks);\n", " }\n", " // The version of get_ticks() that does the work (and the version that\n", " // should be overridden in subclasses).\n", " get_ticks_no_defaults(data_low, data_high, _cross_loc, desired_n_ticks) {\n", " const interval = this.get_interval(data_low, data_high, desired_n_ticks);\n", " const start_factor = Math.floor(data_low / interval);\n", " const end_factor = Math.ceil(data_high / interval);\n", " let factors;\n", " if (isNaN(start_factor) || isNaN(end_factor))\n", " factors = [];\n", " else\n", " factors = array_1.range(start_factor, end_factor + 1);\n", " const ticks = factors\n", " .map((factor) => factor * interval)\n", " .filter((tick) => data_low <= tick && tick <= data_high);\n", " const num_minor_ticks = this.num_minor_ticks;\n", " const minor_ticks = [];\n", " if (num_minor_ticks > 0 && ticks.length > 0) {\n", " const minor_interval = interval / num_minor_ticks;\n", " const minor_offsets = array_1.range(0, num_minor_ticks).map((i) => i * minor_interval);\n", " for (const x of minor_offsets.slice(1)) {\n", " const mt = ticks[0] - x;\n", " if (data_low <= mt && mt <= data_high) {\n", " minor_ticks.push(mt);\n", " }\n", " }\n", " for (const tick of ticks) {\n", " for (const x of minor_offsets) {\n", " const mt = tick + x;\n", " if (data_low <= mt && mt <= data_high) {\n", " minor_ticks.push(mt);\n", " }\n", " }\n", " }\n", " }\n", " return {\n", " major: ticks,\n", " minor: minor_ticks,\n", " };\n", " }\n", " // Returns the smallest interval that can be returned by get_interval().\n", " get_min_interval() {\n", " return this.min_interval;\n", " }\n", " // Returns the largest interval that can be returned by get_interval().\n", " get_max_interval() {\n", " return this.max_interval != null ? this.max_interval : Infinity;\n", " }\n", " // Returns the interval size that would produce exactly the number of\n", " // desired ticks. (In general we won't use exactly this interval, because\n", " // we want the ticks to be round numbers.)\n", " get_ideal_interval(data_low, data_high, desired_n_ticks) {\n", " const data_range = data_high - data_low;\n", " return data_range / desired_n_ticks;\n", " }\n", " }\n", " exports.ContinuousTicker = ContinuousTicker;\n", " ContinuousTicker.__name__ = \"ContinuousTicker\";\n", " ContinuousTicker.init_ContinuousTicker();\n", " },\n", " /* models/tickers/ticker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const model_1 = require(71) /* ../../model */;\n", " class Ticker extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " }\n", " exports.Ticker = Ticker;\n", " Ticker.__name__ = \"Ticker\";\n", " },\n", " /* models/formatters/basic_tick_formatter.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const tick_formatter_1 = require(114) /* ./tick_formatter */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class BasicTickFormatter extends tick_formatter_1.TickFormatter {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.last_precision = 3;\n", " }\n", " static init_BasicTickFormatter() {\n", " this.define({\n", " precision: [p.Any, 'auto'],\n", " use_scientific: [p.Boolean, true],\n", " power_limit_high: [p.Number, 5],\n", " power_limit_low: [p.Number, -3],\n", " });\n", " }\n", " get scientific_limit_low() {\n", " return 10.0 ** this.power_limit_low;\n", " }\n", " get scientific_limit_high() {\n", " return 10.0 ** this.power_limit_high;\n", " }\n", " _need_sci(ticks) {\n", " if (!this.use_scientific)\n", " return false;\n", " const { scientific_limit_high } = this;\n", " const { scientific_limit_low } = this;\n", " const zeroish = ticks.length < 2 ? 0 : Math.abs(ticks[1] - ticks[0]) / 10000;\n", " for (const tick of ticks) {\n", " const tick_abs = Math.abs(tick);\n", " if (tick_abs <= zeroish)\n", " continue;\n", " if (tick_abs >= scientific_limit_high || tick_abs <= scientific_limit_low) {\n", " return true;\n", " }\n", " }\n", " return false;\n", " }\n", " _format_with_precision(ticks, need_sci, precision) {\n", " const labels = new Array(ticks.length);\n", " if (need_sci) {\n", " for (let i = 0, end = ticks.length; i < end; i++) {\n", " labels[i] = ticks[i].toExponential(precision);\n", " }\n", " }\n", " else {\n", " for (let i = 0, end = ticks.length; i < end; i++) {\n", " // strip trailing zeros\n", " labels[i] = ticks[i].toFixed(precision).replace(/(\\.[0-9]*?)0+$/, \"$1\").replace(/\\.$/, \"\");\n", " }\n", " }\n", " return labels;\n", " }\n", " _auto_precision(ticks, need_sci) {\n", " const labels = new Array(ticks.length);\n", " const asc = this.last_precision <= 15;\n", " outer: for (let x = this.last_precision; asc ? x <= 15 : x >= 1; asc ? x++ : x--) {\n", " if (need_sci) {\n", " labels[0] = ticks[0].toExponential(x);\n", " for (let i = 1; i < ticks.length; i++) {\n", " if (labels[i] == labels[i - 1]) {\n", " continue outer;\n", " }\n", " }\n", " this.last_precision = x;\n", " break;\n", " }\n", " else {\n", " labels[0] = ticks[0].toFixed(x).replace(/(\\.[0-9]*?)0+$/, \"$1\").replace(/\\.$/, \"\");\n", " for (let i = 1; i < ticks.length; i++) {\n", " labels[i] = ticks[i].toFixed(x).replace(/(\\.[0-9]*?)0+$/, \"$1\").replace(/\\.$/, \"\");\n", " if (labels[i] == labels[i - 1]) {\n", " continue outer;\n", " }\n", " }\n", " this.last_precision = x;\n", " break;\n", " }\n", " }\n", " return this.last_precision;\n", " }\n", " doFormat(ticks, _opts) {\n", " if (ticks.length == 0)\n", " return [];\n", " const need_sci = this._need_sci(ticks);\n", " const precision = this.precision == \"auto\" ? this._auto_precision(ticks, need_sci) : this.precision;\n", " return this._format_with_precision(ticks, need_sci, precision);\n", " }\n", " }\n", " exports.BasicTickFormatter = BasicTickFormatter;\n", " BasicTickFormatter.__name__ = \"BasicTickFormatter\";\n", " BasicTickFormatter.init_BasicTickFormatter();\n", " },\n", " /* models/formatters/tick_formatter.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const model_1 = require(71) /* ../../model */;\n", " class TickFormatter extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " }\n", " exports.TickFormatter = TickFormatter;\n", " TickFormatter.__name__ = \"TickFormatter\";\n", " },\n", " /* models/mappers/linear_color_mapper.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const continuous_color_mapper_1 = require(116) /* ./continuous_color_mapper */;\n", " const arrayable_1 = require(12) /* ../../core/util/arrayable */;\n", " class LinearColorMapper extends continuous_color_mapper_1.ContinuousColorMapper {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " _v_compute(data, values, palette, colors) {\n", " const { nan_color, low_color, high_color } = colors;\n", " const low = this.low != null ? this.low : arrayable_1.min(data);\n", " const high = this.high != null ? this.high : arrayable_1.max(data);\n", " const max_key = palette.length - 1;\n", " const norm_factor = 1 / (high - low);\n", " const normed_interval = 1 / palette.length;\n", " for (let i = 0, end = data.length; i < end; i++) {\n", " const d = data[i];\n", " if (isNaN(d)) {\n", " values[i] = nan_color;\n", " continue;\n", " }\n", " // This handles the edge case where d == high, since the code below maps\n", " // values exactly equal to high to palette.length, which is greater than\n", " // max_key\n", " if (d == high) {\n", " values[i] = palette[max_key];\n", " continue;\n", " }\n", " const normed_d = (d - low) * norm_factor;\n", " const key = Math.floor(normed_d / normed_interval);\n", " if (key < 0)\n", " values[i] = low_color != null ? low_color : palette[0];\n", " else if (key > max_key)\n", " values[i] = high_color != null ? high_color : palette[max_key];\n", " else\n", " values[i] = palette[key];\n", " }\n", " }\n", " }\n", " exports.LinearColorMapper = LinearColorMapper;\n", " LinearColorMapper.__name__ = \"LinearColorMapper\";\n", " },\n", " /* models/mappers/continuous_color_mapper.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const color_mapper_1 = require(117) /* ./color_mapper */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class ContinuousColorMapper extends color_mapper_1.ColorMapper {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ContinuousColorMapper() {\n", " this.define({\n", " high: [p.Number],\n", " low: [p.Number],\n", " high_color: [p.Color],\n", " low_color: [p.Color],\n", " });\n", " }\n", " _colors(conv) {\n", " return Object.assign(Object.assign({}, super._colors(conv)), { low_color: this.low_color != null ? conv(this.low_color) : undefined, high_color: this.high_color != null ? conv(this.high_color) : undefined });\n", " }\n", " }\n", " exports.ContinuousColorMapper = ContinuousColorMapper;\n", " ContinuousColorMapper.__name__ = \"ContinuousColorMapper\";\n", " ContinuousColorMapper.init_ContinuousColorMapper();\n", " },\n", " /* models/mappers/color_mapper.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const mapper_1 = require(118) /* ./mapper */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const color_1 = require(20) /* ../../core/util/color */;\n", " const compat_1 = require(28) /* ../../core/util/compat */;\n", " function _convert_color(color) {\n", " if (types_1.isNumber(color))\n", " return color;\n", " if (color[0] != \"#\")\n", " color = color_1.color2hex(color);\n", " if (color.length != 9)\n", " color = color + 'ff';\n", " return parseInt(color.slice(1), 16);\n", " }\n", " exports._convert_color = _convert_color;\n", " function _convert_palette(palette) {\n", " const new_palette = new Uint32Array(palette.length);\n", " for (let i = 0, end = palette.length; i < end; i++)\n", " new_palette[i] = _convert_color(palette[i]);\n", " return new_palette;\n", " }\n", " exports._convert_palette = _convert_palette;\n", " function _uint32_to_rgba(values) {\n", " if (compat_1.is_little_endian) {\n", " const view = new DataView(values.buffer);\n", " for (let i = 0, end = values.length; i < end; i++)\n", " view.setUint32(i * 4, values[i]);\n", " }\n", " return new Uint8Array(values.buffer);\n", " }\n", " exports._uint32_to_rgba = _uint32_to_rgba;\n", " class ColorMapper extends mapper_1.Mapper {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ColorMapper() {\n", " this.define({\n", " palette: [p.Any],\n", " nan_color: [p.Color, \"gray\"],\n", " });\n", " }\n", " v_compute(xs) {\n", " const values = new Array(xs.length);\n", " this._v_compute(xs, values, this.palette, this._colors((c) => c));\n", " return values;\n", " }\n", " get rgba_mapper() {\n", " const self = this;\n", " const palette = _convert_palette(this.palette);\n", " const colors = this._colors(_convert_color);\n", " return {\n", " v_compute(xs) {\n", " const values = new Uint32Array(xs.length);\n", " self._v_compute(xs, values, palette, colors);\n", " return _uint32_to_rgba(values);\n", " },\n", " };\n", " }\n", " _colors(conv) {\n", " return { nan_color: conv(this.nan_color) };\n", " }\n", " }\n", " exports.ColorMapper = ColorMapper;\n", " ColorMapper.__name__ = \"ColorMapper\";\n", " ColorMapper.init_ColorMapper();\n", " },\n", " /* models/mappers/mapper.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const transform_1 = require(119) /* ../transforms/transform */;\n", " class Mapper extends transform_1.Transform {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " compute(_x) {\n", " // If it's just a single value, then a mapper doesn't really make sense.\n", " throw new Error(\"mapping single values is not supported\");\n", " }\n", " }\n", " exports.Mapper = Mapper;\n", " Mapper.__name__ = \"Mapper\";\n", " },\n", " /* models/transforms/transform.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const model_1 = require(71) /* ../../model */;\n", " class Transform extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " }\n", " exports.Transform = Transform;\n", " Transform.__name__ = \"Transform\";\n", " },\n", " /* models/scales/linear_scale.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const continuous_scale_1 = require(121) /* ./continuous_scale */;\n", " class LinearScale extends continuous_scale_1.ContinuousScale {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " compute(x) {\n", " return this._linear_compute(x);\n", " }\n", " v_compute(xs) {\n", " return this._linear_v_compute(xs);\n", " }\n", " invert(xprime) {\n", " return this._linear_invert(xprime);\n", " }\n", " v_invert(xprimes) {\n", " return this._linear_v_invert(xprimes);\n", " }\n", " }\n", " exports.LinearScale = LinearScale;\n", " LinearScale.__name__ = \"LinearScale\";\n", " },\n", " /* models/scales/continuous_scale.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const scale_1 = require(122) /* ./scale */;\n", " class ContinuousScale extends scale_1.Scale {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " }\n", " exports.ContinuousScale = ContinuousScale;\n", " ContinuousScale.__name__ = \"ContinuousScale\";\n", " },\n", " /* models/scales/scale.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const transforms_1 = require(123) /* ../transforms */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class Scale extends transforms_1.Transform {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Scale() {\n", " this.internal({\n", " source_range: [p.Any],\n", " target_range: [p.Any],\n", " });\n", " }\n", " r_compute(x0, x1) {\n", " if (this.target_range.is_reversed)\n", " return [this.compute(x1), this.compute(x0)];\n", " else\n", " return [this.compute(x0), this.compute(x1)];\n", " }\n", " r_invert(sx0, sx1) {\n", " if (this.target_range.is_reversed)\n", " return [this.invert(sx1), this.invert(sx0)];\n", " else\n", " return [this.invert(sx0), this.invert(sx1)];\n", " }\n", " // These are needed by both LinearScale and CategoricalScale and this is the\n", " // only common ancestor. TODO: Proper MI/Mixin would be better.\n", " _linear_compute(x) {\n", " const [factor, offset] = this._linear_compute_state();\n", " return factor * x + offset;\n", " }\n", " _linear_v_compute(xs) {\n", " const [factor, offset] = this._linear_compute_state();\n", " const result = new Float64Array(xs.length);\n", " for (let i = 0; i < xs.length; i++)\n", " result[i] = factor * xs[i] + offset;\n", " return result;\n", " }\n", " _linear_invert(xprime) {\n", " const [factor, offset] = this._linear_compute_state();\n", " return (xprime - offset) / factor;\n", " }\n", " _linear_v_invert(xprimes) {\n", " const [factor, offset] = this._linear_compute_state();\n", " const result = new Float64Array(xprimes.length);\n", " for (let i = 0; i < xprimes.length; i++)\n", " result[i] = (xprimes[i] - offset) / factor;\n", " return result;\n", " }\n", " /*protected*/ _linear_compute_state() {\n", " //\n", " // (t1 - t0) (t1 - t0)\n", " // --------- * x - --------- * s0 + t0\n", " // (s1 - s0) (s1 - s0)\n", " //\n", " // [ factor ] [ offset ]\n", " //\n", " const source_start = this.source_range.start;\n", " const source_end = this.source_range.end;\n", " const target_start = this.target_range.start;\n", " const target_end = this.target_range.end;\n", " const factor = (target_end - target_start) / (source_end - source_start);\n", " const offset = -(factor * source_start) + target_start;\n", " return [factor, offset];\n", " }\n", " }\n", " exports.Scale = Scale;\n", " Scale.__name__ = \"Scale\";\n", " Scale.init_Scale();\n", " },\n", " /* models/transforms/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var customjs_transform_1 = require(124) /* ./customjs_transform */;\n", " exports.CustomJSTransform = customjs_transform_1.CustomJSTransform;\n", " var dodge_1 = require(125) /* ./dodge */;\n", " exports.Dodge = dodge_1.Dodge;\n", " var interpolator_1 = require(126) /* ./interpolator */;\n", " exports.Interpolator = interpolator_1.Interpolator;\n", " var jitter_1 = require(127) /* ./jitter */;\n", " exports.Jitter = jitter_1.Jitter;\n", " var linear_interpolator_1 = require(128) /* ./linear_interpolator */;\n", " exports.LinearInterpolator = linear_interpolator_1.LinearInterpolator;\n", " var step_interpolator_1 = require(129) /* ./step_interpolator */;\n", " exports.StepInterpolator = step_interpolator_1.StepInterpolator;\n", " var transform_1 = require(119) /* ./transform */;\n", " exports.Transform = transform_1.Transform;\n", " },\n", " /* models/transforms/customjs_transform.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const transform_1 = require(119) /* ./transform */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const object_1 = require(17) /* ../../core/util/object */;\n", " const string_1 = require(24) /* ../../core/util/string */;\n", " class CustomJSTransform extends transform_1.Transform {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_CustomJSTransform() {\n", " this.define({\n", " args: [p.Any, {}],\n", " func: [p.String, \"\"],\n", " v_func: [p.String, \"\"],\n", " });\n", " }\n", " get names() {\n", " return object_1.keys(this.args);\n", " }\n", " get values() {\n", " return object_1.values(this.args);\n", " }\n", " _make_transform(name, func) {\n", " return new Function(...this.names, name, string_1.use_strict(func));\n", " }\n", " get scalar_transform() {\n", " return this._make_transform(\"x\", this.func);\n", " }\n", " get vector_transform() {\n", " return this._make_transform(\"xs\", this.v_func);\n", " }\n", " compute(x) {\n", " return this.scalar_transform(...this.values, x);\n", " }\n", " v_compute(xs) {\n", " return this.vector_transform(...this.values, xs);\n", " }\n", " }\n", " exports.CustomJSTransform = CustomJSTransform;\n", " CustomJSTransform.__name__ = \"CustomJSTransform\";\n", " CustomJSTransform.init_CustomJSTransform();\n", " },\n", " /* models/transforms/dodge.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const transform_1 = require(119) /* ./transform */;\n", " const factor_range_1 = require(90) /* ../ranges/factor_range */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " class Dodge extends transform_1.Transform {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Dodge() {\n", " this.define({\n", " value: [p.Number, 0],\n", " range: [p.Instance],\n", " });\n", " }\n", " // XXX: this is repeated in ./jitter.ts\n", " v_compute(xs0) {\n", " let xs;\n", " if (this.range instanceof factor_range_1.FactorRange)\n", " xs = this.range.v_synthetic(xs0);\n", " else if (types_1.isArrayableOf(xs0, types_1.isNumber))\n", " xs = xs0;\n", " else\n", " throw new Error(\"unexpected\");\n", " const result = new Float64Array(xs.length);\n", " for (let i = 0; i < xs.length; i++) {\n", " const x = xs[i];\n", " result[i] = this._compute(x);\n", " }\n", " return result;\n", " }\n", " compute(x) {\n", " if (this.range instanceof factor_range_1.FactorRange)\n", " return this._compute(this.range.synthetic(x));\n", " else if (types_1.isNumber(x))\n", " return this._compute(x);\n", " else\n", " throw new Error(\"unexpected\");\n", " }\n", " _compute(x) {\n", " return x + this.value;\n", " }\n", " }\n", " exports.Dodge = Dodge;\n", " Dodge.__name__ = \"Dodge\";\n", " Dodge.init_Dodge();\n", " },\n", " /* models/transforms/interpolator.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const transform_1 = require(119) /* ./transform */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " class Interpolator extends transform_1.Transform {\n", " constructor(attrs) {\n", " super(attrs);\n", " this._sorted_dirty = true;\n", " }\n", " static init_Interpolator() {\n", " this.define({\n", " x: [p.Any],\n", " y: [p.Any],\n", " data: [p.Any],\n", " clip: [p.Boolean, true],\n", " });\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.change, () => this._sorted_dirty = true);\n", " }\n", " v_compute(xs) {\n", " const result = new Float64Array(xs.length);\n", " for (let i = 0; i < xs.length; i++) {\n", " const x = xs[i];\n", " result[i] = this.compute(x);\n", " }\n", " return result;\n", " }\n", " sort(descending = false) {\n", " if (!this._sorted_dirty)\n", " return;\n", " let tsx;\n", " let tsy;\n", " if (types_1.isString(this.x) && types_1.isString(this.y) && this.data != null) {\n", " const column_names = this.data.columns();\n", " if (!array_1.includes(column_names, this.x))\n", " throw new Error(\"The x parameter does not correspond to a valid column name defined in the data parameter\");\n", " if (!array_1.includes(column_names, this.y))\n", " throw new Error(\"The y parameter does not correspond to a valid column name defined in the data parameter\");\n", " tsx = this.data.get_column(this.x);\n", " tsy = this.data.get_column(this.y);\n", " }\n", " else if (types_1.isArray(this.x) && types_1.isArray(this.y)) {\n", " tsx = this.x;\n", " tsy = this.y;\n", " }\n", " else {\n", " throw new Error(\"parameters 'x' and 'y' must be both either string fields or arrays\");\n", " }\n", " if (tsx.length !== tsy.length)\n", " throw new Error(\"The length for x and y do not match\");\n", " if (tsx.length < 2)\n", " throw new Error(\"x and y must have at least two elements to support interpolation\");\n", " // The following sorting code is referenced from:\n", " // http://stackoverflow.com/questions/11499268/sort-two-arrays-the-same-way\n", " const list = [];\n", " for (const j in tsx) {\n", " list.push({ x: tsx[j], y: tsy[j] });\n", " }\n", " if (descending)\n", " list.sort((a, b) => a.x > b.x ? -1 : (a.x == b.x ? 0 : 1));\n", " else\n", " list.sort((a, b) => a.x < b.x ? -1 : (a.x == b.x ? 0 : 1));\n", " this._x_sorted = [];\n", " this._y_sorted = [];\n", " for (const { x, y } of list) {\n", " this._x_sorted.push(x);\n", " this._y_sorted.push(y);\n", " }\n", " this._sorted_dirty = false;\n", " }\n", " }\n", " exports.Interpolator = Interpolator;\n", " Interpolator.__name__ = \"Interpolator\";\n", " Interpolator.init_Interpolator();\n", " },\n", " /* models/transforms/jitter.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const transform_1 = require(119) /* ./transform */;\n", " const factor_range_1 = require(90) /* ../ranges/factor_range */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const bokeh_math = tslib_1.__importStar(require(10) /* ../../core/util/math */);\n", " class Jitter extends transform_1.Transform {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Jitter() {\n", " this.define({\n", " mean: [p.Number, 0],\n", " width: [p.Number, 1],\n", " distribution: [p.Distribution, 'uniform'],\n", " range: [p.Instance],\n", " });\n", " this.internal({\n", " previous_values: [p.Array],\n", " });\n", " }\n", " v_compute(xs0) {\n", " if (this.previous_values != null && this.previous_values.length == xs0.length)\n", " return this.previous_values;\n", " let xs;\n", " if (this.range instanceof factor_range_1.FactorRange)\n", " xs = this.range.v_synthetic(xs0);\n", " else if (types_1.isArrayableOf(xs0, types_1.isNumber))\n", " xs = xs0;\n", " else\n", " throw new Error(\"unexpected\");\n", " const result = new Float64Array(xs.length);\n", " for (let i = 0; i < xs.length; i++) {\n", " const x = xs[i];\n", " result[i] = this._compute(x);\n", " }\n", " this.previous_values = result;\n", " return result;\n", " }\n", " compute(x) {\n", " if (this.range instanceof factor_range_1.FactorRange)\n", " return this._compute(this.range.synthetic(x));\n", " else if (types_1.isNumber(x))\n", " return this._compute(x);\n", " else\n", " throw new Error(\"unexpected\");\n", " }\n", " _compute(x) {\n", " switch (this.distribution) {\n", " case \"uniform\":\n", " return x + this.mean + (bokeh_math.random() - 0.5) * this.width;\n", " case \"normal\":\n", " return x + bokeh_math.rnorm(this.mean, this.width);\n", " }\n", " }\n", " }\n", " exports.Jitter = Jitter;\n", " Jitter.__name__ = \"Jitter\";\n", " Jitter.init_Jitter();\n", " },\n", " /* models/transforms/linear_interpolator.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const interpolator_1 = require(126) /* ./interpolator */;\n", " class LinearInterpolator extends interpolator_1.Interpolator {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " compute(x) {\n", " this.sort(false);\n", " if (this.clip) {\n", " if (x < this._x_sorted[0] || x > this._x_sorted[this._x_sorted.length - 1])\n", " return NaN;\n", " }\n", " else {\n", " if (x < this._x_sorted[0])\n", " return this._y_sorted[0];\n", " if (x > this._x_sorted[this._x_sorted.length - 1])\n", " return this._y_sorted[this._y_sorted.length - 1];\n", " }\n", " if (x == this._x_sorted[0])\n", " return this._y_sorted[0];\n", " const ind = array_1.find_last_index(this._x_sorted, num => num < x);\n", " const x1 = this._x_sorted[ind];\n", " const x2 = this._x_sorted[ind + 1];\n", " const y1 = this._y_sorted[ind];\n", " const y2 = this._y_sorted[ind + 1];\n", " return y1 + (((x - x1) / (x2 - x1)) * (y2 - y1));\n", " }\n", " }\n", " exports.LinearInterpolator = LinearInterpolator;\n", " LinearInterpolator.__name__ = \"LinearInterpolator\";\n", " },\n", " /* models/transforms/step_interpolator.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const interpolator_1 = require(126) /* ./interpolator */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " class StepInterpolator extends interpolator_1.Interpolator {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_StepInterpolator() {\n", " this.define({\n", " mode: [p.StepMode, \"after\"],\n", " });\n", " }\n", " compute(x) {\n", " this.sort(false);\n", " if (this.clip) {\n", " if (x < this._x_sorted[0] || x > this._x_sorted[this._x_sorted.length - 1])\n", " return NaN;\n", " }\n", " else {\n", " if (x < this._x_sorted[0])\n", " return this._y_sorted[0];\n", " if (x > this._x_sorted[this._x_sorted.length - 1])\n", " return this._y_sorted[this._y_sorted.length - 1];\n", " }\n", " let ind;\n", " switch (this.mode) {\n", " case \"after\": {\n", " ind = array_1.find_last_index(this._x_sorted, num => x >= num);\n", " break;\n", " }\n", " case \"before\": {\n", " ind = array_1.find_index(this._x_sorted, num => x <= num);\n", " break;\n", " }\n", " case \"center\": {\n", " const diffs = this._x_sorted.map((tx) => Math.abs(tx - x));\n", " const mdiff = array_1.min(diffs);\n", " ind = array_1.find_index(diffs, num => mdiff === num);\n", " break;\n", " }\n", " default:\n", " throw new Error(`unknown mode: ${this.mode}`);\n", " }\n", " return ind != -1 ? this._y_sorted[ind] : NaN;\n", " }\n", " }\n", " exports.StepInterpolator = StepInterpolator;\n", " StepInterpolator.__name__ = \"StepInterpolator\";\n", " StepInterpolator.init_StepInterpolator();\n", " },\n", " /* models/scales/log_scale.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const continuous_scale_1 = require(121) /* ./continuous_scale */;\n", " class LogScale extends continuous_scale_1.ContinuousScale {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " compute(x) {\n", " const [factor, offset, inter_factor, inter_offset] = this._compute_state();\n", " let value;\n", " if (inter_factor == 0)\n", " value = 0;\n", " else {\n", " const _x = (Math.log(x) - inter_offset) / inter_factor;\n", " if (isFinite(_x))\n", " value = _x * factor + offset;\n", " else\n", " value = NaN;\n", " }\n", " return value;\n", " }\n", " v_compute(xs) {\n", " const [factor, offset, inter_factor, inter_offset] = this._compute_state();\n", " const result = new Float64Array(xs.length);\n", " if (inter_factor == 0) {\n", " for (let i = 0; i < xs.length; i++)\n", " result[i] = 0;\n", " }\n", " else {\n", " for (let i = 0; i < xs.length; i++) {\n", " const _x = (Math.log(xs[i]) - inter_offset) / inter_factor;\n", " let value;\n", " if (isFinite(_x))\n", " value = _x * factor + offset;\n", " else\n", " value = NaN;\n", " result[i] = value;\n", " }\n", " }\n", " return result;\n", " }\n", " invert(xprime) {\n", " const [factor, offset, inter_factor, inter_offset] = this._compute_state();\n", " const value = (xprime - offset) / factor;\n", " return Math.exp(inter_factor * value + inter_offset);\n", " }\n", " v_invert(xprimes) {\n", " const [factor, offset, inter_factor, inter_offset] = this._compute_state();\n", " const result = new Float64Array(xprimes.length);\n", " for (let i = 0; i < xprimes.length; i++) {\n", " const value = (xprimes[i] - offset) / factor;\n", " result[i] = Math.exp(inter_factor * value + inter_offset);\n", " }\n", " return result;\n", " }\n", " _get_safe_factor(orig_start, orig_end) {\n", " let start = orig_start < 0 ? 0 : orig_start;\n", " let end = orig_end < 0 ? 0 : orig_end;\n", " if (start == end) {\n", " if (start == 0)\n", " [start, end] = [1, 10];\n", " else {\n", " const log_val = Math.log(start) / Math.log(10);\n", " start = 10 ** Math.floor(log_val);\n", " if (Math.ceil(log_val) != Math.floor(log_val))\n", " end = 10 ** Math.ceil(log_val);\n", " else\n", " end = 10 ** (Math.ceil(log_val) + 1);\n", " }\n", " }\n", " return [start, end];\n", " }\n", " /*protected*/ _compute_state() {\n", " const source_start = this.source_range.start;\n", " const source_end = this.source_range.end;\n", " const target_start = this.target_range.start;\n", " const target_end = this.target_range.end;\n", " const screen_range = target_end - target_start;\n", " const [start, end] = this._get_safe_factor(source_start, source_end);\n", " let inter_factor;\n", " let inter_offset;\n", " if (start == 0) {\n", " inter_factor = Math.log(end);\n", " inter_offset = 0;\n", " }\n", " else {\n", " inter_factor = Math.log(end) - Math.log(start);\n", " inter_offset = Math.log(start);\n", " }\n", " const factor = screen_range;\n", " const offset = target_start;\n", " return [factor, offset, inter_factor, inter_offset];\n", " }\n", " }\n", " exports.LogScale = LogScale;\n", " LogScale.__name__ = \"LogScale\";\n", " },\n", " /* models/ranges/range1d.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const range_1 = require(91) /* ./range */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class Range1d extends range_1.Range {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Range1d() {\n", " this.define({\n", " start: [p.Number, 0],\n", " end: [p.Number, 1],\n", " reset_start: [p.Number],\n", " reset_end: [p.Number],\n", " });\n", " }\n", " _set_auto_bounds() {\n", " if (this.bounds == 'auto') {\n", " const min = Math.min(this.reset_start, this.reset_end);\n", " const max = Math.max(this.reset_start, this.reset_end);\n", " this.setv({ bounds: [min, max] }, { silent: true });\n", " }\n", " }\n", " initialize() {\n", " super.initialize();\n", " if (this.reset_start == null) {\n", " this.reset_start = this.start;\n", " }\n", " if (this.reset_end == null) {\n", " this.reset_end = this.end;\n", " }\n", " this._set_auto_bounds();\n", " }\n", " get min() {\n", " return Math.min(this.start, this.end);\n", " }\n", " get max() {\n", " return Math.max(this.start, this.end);\n", " }\n", " reset() {\n", " this._set_auto_bounds();\n", " if (this.start != this.reset_start || this.end != this.reset_end)\n", " this.setv({ start: this.reset_start, end: this.reset_end });\n", " else\n", " this.change.emit();\n", " }\n", " }\n", " exports.Range1d = Range1d;\n", " Range1d.__name__ = \"Range1d\";\n", " Range1d.init_Range1d();\n", " },\n", " /* core/util/text.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const dom_1 = require(68) /* ../dom */;\n", " const _font_cache = new Map();\n", " function measure_font(font) {\n", " const metrics = _font_cache.get(font);\n", " if (metrics != null)\n", " return metrics;\n", " const text = dom_1.span({ style: { font } }, \"Hg\");\n", " const block = dom_1.div({ style: { display: \"inline-block\", width: \"1px\", height: \"0px\" } });\n", " const elem = dom_1.div({}, text, block);\n", " document.body.appendChild(elem);\n", " try {\n", " block.style.verticalAlign = \"baseline\";\n", " const ascent = dom_1.offset(block).top - dom_1.offset(text).top;\n", " block.style.verticalAlign = \"bottom\";\n", " const height = dom_1.offset(block).top - dom_1.offset(text).top;\n", " const result = { height, ascent, descent: height - ascent };\n", " _font_cache.set(font, result);\n", " return result;\n", " }\n", " finally {\n", " document.body.removeChild(elem);\n", " }\n", " }\n", " exports.measure_font = measure_font;\n", " const _text_cache = new Map();\n", " function measure_text(text, font) {\n", " let size_cache = _text_cache.get(font);\n", " if (size_cache != null) {\n", " const size = size_cache.get(text);\n", " if (size != null)\n", " return size;\n", " }\n", " else {\n", " size_cache = new Map();\n", " _text_cache.set(font, size_cache);\n", " }\n", " const el = dom_1.div({ style: { display: \"inline-block\", \"white-space\": \"nowrap\", font } }, text);\n", " document.body.appendChild(el);\n", " try {\n", " const { width, height } = el.getBoundingClientRect();\n", " size_cache.set(text, { width, height });\n", " return { width, height };\n", " }\n", " finally {\n", " document.body.removeChild(el);\n", " }\n", " }\n", " exports.measure_text = measure_text;\n", " },\n", " /* models/annotations/label.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const text_annotation_1 = require(134) /* ./text_annotation */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const mixins = tslib_1.__importStar(require(23) /* ../../core/property_mixins */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class LabelView extends text_annotation_1.TextAnnotationView {\n", " initialize() {\n", " super.initialize();\n", " this.visuals.warm_cache();\n", " }\n", " _get_size() {\n", " const { ctx } = this.layer;\n", " this.visuals.text.set_value(ctx);\n", " const { width, ascent } = ctx.measureText(this.model.text);\n", " return { width, height: ascent };\n", " }\n", " render() {\n", " if (!this.model.visible && this.model.render_mode == 'css')\n", " dom_1.undisplay(this.el);\n", " if (!this.model.visible)\n", " return;\n", " // Here because AngleSpec does units transform and label doesn't support specs\n", " let angle;\n", " switch (this.model.angle_units) {\n", " case \"rad\": {\n", " angle = -this.model.angle;\n", " break;\n", " }\n", " case \"deg\": {\n", " angle = (-this.model.angle * Math.PI) / 180.0;\n", " break;\n", " }\n", " }\n", " const panel = this.panel != null ? this.panel : this.plot_view.frame;\n", " const xscale = this.plot_view.frame.xscales[this.model.x_range_name];\n", " const yscale = this.plot_view.frame.yscales[this.model.y_range_name];\n", " let sx = this.model.x_units == \"data\" ? xscale.compute(this.model.x) : panel.xview.compute(this.model.x);\n", " let sy = this.model.y_units == \"data\" ? yscale.compute(this.model.y) : panel.yview.compute(this.model.y);\n", " sx += this.model.x_offset;\n", " sy -= this.model.y_offset;\n", " const draw = this.model.render_mode == 'canvas' ? this._canvas_text.bind(this) : this._css_text.bind(this);\n", " draw(this.layer.ctx, this.model.text, sx, sy, angle);\n", " }\n", " }\n", " exports.LabelView = LabelView;\n", " LabelView.__name__ = \"LabelView\";\n", " class Label extends text_annotation_1.TextAnnotation {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Label() {\n", " this.prototype.default_view = LabelView;\n", " this.mixins([\n", " mixins.Text /*Scalar*/,\n", " [\"border_\", mixins.Line],\n", " [\"background_\", mixins.Fill],\n", " ]);\n", " this.define({\n", " x: [p.Number],\n", " x_units: [p.SpatialUnits, 'data'],\n", " y: [p.Number],\n", " y_units: [p.SpatialUnits, 'data'],\n", " text: [p.String],\n", " angle: [p.Angle, 0],\n", " angle_units: [p.AngleUnits, 'rad'],\n", " x_offset: [p.Number, 0],\n", " y_offset: [p.Number, 0],\n", " x_range_name: [p.String, 'default'],\n", " y_range_name: [p.String, 'default'],\n", " });\n", " this.override({\n", " background_fill_color: null,\n", " border_line_color: null,\n", " });\n", " }\n", " }\n", " exports.Label = Label;\n", " Label.__name__ = \"Label\";\n", " Label.init_Label();\n", " },\n", " /* models/annotations/text_annotation.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const annotation_1 = require(31) /* ./annotation */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const text_1 = require(132) /* ../../core/util/text */;\n", " const assert_1 = require(11) /* ../../core/util/assert */;\n", " class TextAnnotationView extends annotation_1.AnnotationView {\n", " constructor() {\n", " super(...arguments);\n", " this.rotate = true;\n", " }\n", " initialize() {\n", " super.initialize();\n", " if (this.model.render_mode == 'css') {\n", " this.plot_view.canvas_view.add_overlay(this.el);\n", " }\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " if (this.model.render_mode == 'css') {\n", " // dispatch CSS update immediately\n", " this.connect(this.model.change, () => this.render());\n", " }\n", " else {\n", " this.connect(this.model.change, () => this.plot_view.request_render());\n", " }\n", " }\n", " _calculate_text_dimensions(ctx, text) {\n", " const { width } = ctx.measureText(text);\n", " const { height } = text_1.measure_font(this.visuals.text.font_value());\n", " return [width, height];\n", " }\n", " _calculate_bounding_box_dimensions(ctx, text) {\n", " const [width, height] = this._calculate_text_dimensions(ctx, text);\n", " let x_offset;\n", " switch (ctx.textAlign) {\n", " case 'left':\n", " x_offset = 0;\n", " break;\n", " case 'center':\n", " x_offset = -width / 2;\n", " break;\n", " case 'right':\n", " x_offset = -width;\n", " break;\n", " default:\n", " assert_1.unreachable();\n", " }\n", " // guestimated from https://www.w3.org/TR/2dcontext/#dom-context-2d-textbaseline\n", " let y_offset;\n", " switch (ctx.textBaseline) {\n", " case 'top':\n", " y_offset = 0.0;\n", " break;\n", " case 'middle':\n", " y_offset = -0.5 * height;\n", " break;\n", " case 'bottom':\n", " y_offset = -1.0 * height;\n", " break;\n", " case 'alphabetic':\n", " y_offset = -0.8 * height;\n", " break;\n", " case 'hanging':\n", " y_offset = -0.17 * height;\n", " break;\n", " case 'ideographic':\n", " y_offset = -0.83 * height;\n", " break;\n", " default:\n", " assert_1.unreachable();\n", " }\n", " return [x_offset, y_offset, width, height];\n", " }\n", " _canvas_text(ctx, text, sx, sy, angle) {\n", " this.visuals.text.set_value(ctx);\n", " const bbox_dims = this._calculate_bounding_box_dimensions(ctx, text);\n", " ctx.save();\n", " ctx.beginPath();\n", " ctx.translate(sx, sy);\n", " if (angle)\n", " ctx.rotate(angle);\n", " ctx.rect(bbox_dims[0], bbox_dims[1], bbox_dims[2], bbox_dims[3]);\n", " if (this.visuals.background_fill.doit) {\n", " this.visuals.background_fill.set_value(ctx);\n", " ctx.fill();\n", " }\n", " if (this.visuals.border_line.doit) {\n", " this.visuals.border_line.set_value(ctx);\n", " ctx.stroke();\n", " }\n", " if (this.visuals.text.doit) {\n", " this.visuals.text.set_value(ctx);\n", " ctx.fillText(text, 0, 0);\n", " }\n", " ctx.restore();\n", " }\n", " _css_text(ctx, text, sx, sy, angle) {\n", " dom_1.undisplay(this.el);\n", " this.visuals.text.set_value(ctx);\n", " const bbox_dims = this._calculate_bounding_box_dimensions(ctx, text);\n", " // attempt to support vector string-style (\"8 4 8\") line dashing for css mode\n", " const ld = this.visuals.border_line.line_dash.value();\n", " const line_dash = ld.length < 2 ? \"solid\" : \"dashed\";\n", " this.visuals.border_line.set_value(ctx);\n", " this.visuals.background_fill.set_value(ctx);\n", " this.el.style.position = 'absolute';\n", " this.el.style.left = `${sx + bbox_dims[0]}px`;\n", " this.el.style.top = `${sy + bbox_dims[1]}px`;\n", " this.el.style.color = `${this.visuals.text.text_color.value()}`;\n", " this.el.style.opacity = `${this.visuals.text.text_alpha.value()}`;\n", " this.el.style.font = `${this.visuals.text.font_value()}`;\n", " this.el.style.lineHeight = \"normal\"; // needed to prevent ipynb css override\n", " if (angle) {\n", " this.el.style.transform = `rotate(${angle}rad)`;\n", " }\n", " if (this.visuals.background_fill.doit) {\n", " this.el.style.backgroundColor = `${this.visuals.background_fill.color_value()}`;\n", " }\n", " if (this.visuals.border_line.doit) {\n", " this.el.style.borderStyle = `${line_dash}`;\n", " this.el.style.borderWidth = `${this.visuals.border_line.line_width.value()}px`;\n", " this.el.style.borderColor = `${this.visuals.border_line.color_value()}`;\n", " }\n", " this.el.textContent = text;\n", " dom_1.display(this.el);\n", " }\n", " }\n", " exports.TextAnnotationView = TextAnnotationView;\n", " TextAnnotationView.__name__ = \"TextAnnotationView\";\n", " class TextAnnotation extends annotation_1.Annotation {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_TextAnnotation() {\n", " this.define({\n", " render_mode: [p.RenderMode, \"canvas\"],\n", " });\n", " }\n", " }\n", " exports.TextAnnotation = TextAnnotation;\n", " TextAnnotation.__name__ = \"TextAnnotation\";\n", " TextAnnotation.init_TextAnnotation();\n", " },\n", " /* models/annotations/label_set.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const text_annotation_1 = require(134) /* ./text_annotation */;\n", " const column_data_source_1 = require(76) /* ../sources/column_data_source */;\n", " const mixins = tslib_1.__importStar(require(23) /* ../../core/property_mixins */);\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class LabelSetView extends text_annotation_1.TextAnnotationView {\n", " initialize() {\n", " super.initialize();\n", " this.set_data(this.model.source);\n", " if (this.model.render_mode == 'css') {\n", " for (let i = 0, end = this._text.length; i < end; i++) {\n", " const el = dom_1.div({ style: { display: \"none\" } });\n", " this.el.appendChild(el);\n", " }\n", " }\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " if (this.model.render_mode == 'css') {\n", " // dispatch CSS update immediately\n", " this.connect(this.model.change, () => {\n", " this.set_data(this.model.source);\n", " this.render();\n", " });\n", " this.connect(this.model.source.streaming, () => {\n", " this.set_data(this.model.source);\n", " this.render();\n", " });\n", " this.connect(this.model.source.patching, () => {\n", " this.set_data(this.model.source);\n", " this.render();\n", " });\n", " this.connect(this.model.source.change, () => {\n", " this.set_data(this.model.source);\n", " this.render();\n", " });\n", " }\n", " else {\n", " this.connect(this.model.change, () => {\n", " this.set_data(this.model.source);\n", " this.plot_view.request_render();\n", " });\n", " this.connect(this.model.source.streaming, () => {\n", " this.set_data(this.model.source);\n", " this.plot_view.request_render();\n", " });\n", " this.connect(this.model.source.patching, () => {\n", " this.set_data(this.model.source);\n", " this.plot_view.request_render();\n", " });\n", " this.connect(this.model.source.change, () => {\n", " this.set_data(this.model.source);\n", " this.plot_view.request_render();\n", " });\n", " }\n", " }\n", " set_data(source) {\n", " super.set_data(source);\n", " this.visuals.warm_cache(source);\n", " }\n", " _map_data() {\n", " const xscale = this.plot_view.frame.xscales[this.model.x_range_name];\n", " const yscale = this.plot_view.frame.yscales[this.model.y_range_name];\n", " const panel = this.panel != null ? this.panel : this.plot_view.frame;\n", " const sx = this.model.x_units == \"data\" ? xscale.v_compute(this._x) : panel.xview.v_compute(this._x);\n", " const sy = this.model.y_units == \"data\" ? yscale.v_compute(this._y) : panel.yview.v_compute(this._y);\n", " return [sx, sy];\n", " }\n", " render() {\n", " if (!this.model.visible && this.model.render_mode == 'css')\n", " dom_1.undisplay(this.el);\n", " if (!this.model.visible)\n", " return;\n", " const draw = this.model.render_mode == 'canvas' ? this._v_canvas_text.bind(this) : this._v_css_text.bind(this);\n", " const { ctx } = this.layer;\n", " const [sx, sy] = this._map_data();\n", " for (let i = 0, end = this._text.length; i < end; i++) {\n", " draw(ctx, i, this._text[i], sx[i] + this._x_offset[i], sy[i] - this._y_offset[i], this._angle[i]);\n", " }\n", " }\n", " _get_size() {\n", " const { ctx } = this.layer;\n", " this.visuals.text.set_value(ctx);\n", " const { width, ascent } = ctx.measureText(this._text[0]);\n", " return { width, height: ascent };\n", " }\n", " _v_canvas_text(ctx, i, text, sx, sy, angle) {\n", " this.visuals.text.set_vectorize(ctx, i);\n", " const bbox_dims = this._calculate_bounding_box_dimensions(ctx, text);\n", " ctx.save();\n", " ctx.beginPath();\n", " ctx.translate(sx, sy);\n", " ctx.rotate(angle);\n", " ctx.rect(bbox_dims[0], bbox_dims[1], bbox_dims[2], bbox_dims[3]);\n", " if (this.visuals.background_fill.doit) {\n", " this.visuals.background_fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (this.visuals.border_line.doit) {\n", " this.visuals.border_line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " if (this.visuals.text.doit) {\n", " this.visuals.text.set_vectorize(ctx, i);\n", " ctx.fillText(text, 0, 0);\n", " }\n", " ctx.restore();\n", " }\n", " _v_css_text(ctx, i, text, sx, sy, angle) {\n", " const el = this.el.children[i];\n", " el.textContent = text;\n", " this.visuals.text.set_vectorize(ctx, i);\n", " const bbox_dims = this._calculate_bounding_box_dimensions(ctx, text);\n", " // attempt to support vector-style (\"8 4 8\") line dashing for css mode\n", " const ld = this.visuals.border_line.line_dash.value();\n", " const line_dash = ld.length < 2 ? \"solid\" : \"dashed\";\n", " this.visuals.border_line.set_vectorize(ctx, i);\n", " this.visuals.background_fill.set_vectorize(ctx, i);\n", " el.style.position = 'absolute';\n", " el.style.left = `${sx + bbox_dims[0]}px`;\n", " el.style.top = `${sy + bbox_dims[1]}px`;\n", " el.style.color = `${this.visuals.text.text_color.value()}`;\n", " el.style.opacity = `${this.visuals.text.text_alpha.value()}`;\n", " el.style.font = `${this.visuals.text.font_value()}`;\n", " el.style.lineHeight = \"normal\"; // needed to prevent ipynb css override\n", " if (angle) {\n", " el.style.transform = `rotate(${angle}rad)`;\n", " }\n", " if (this.visuals.background_fill.doit) {\n", " el.style.backgroundColor = `${this.visuals.background_fill.color_value()}`;\n", " }\n", " if (this.visuals.border_line.doit) {\n", " el.style.borderStyle = `${line_dash}`;\n", " el.style.borderWidth = `${this.visuals.border_line.line_width.value()}px`;\n", " el.style.borderColor = `${this.visuals.border_line.color_value()}`;\n", " }\n", " dom_1.display(el);\n", " }\n", " }\n", " exports.LabelSetView = LabelSetView;\n", " LabelSetView.__name__ = \"LabelSetView\";\n", " class LabelSet extends text_annotation_1.TextAnnotation {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_LabelSet() {\n", " this.prototype.default_view = LabelSetView;\n", " this.mixins([\n", " mixins.TextVector,\n", " [\"border_\", mixins.LineVector],\n", " [\"background_\", mixins.FillVector],\n", " ]);\n", " this.define({\n", " x: [p.NumberSpec],\n", " y: [p.NumberSpec],\n", " x_units: [p.SpatialUnits, 'data'],\n", " y_units: [p.SpatialUnits, 'data'],\n", " text: [p.StringSpec, { field: \"text\" }],\n", " angle: [p.AngleSpec, 0],\n", " x_offset: [p.NumberSpec, { value: 0 }],\n", " y_offset: [p.NumberSpec, { value: 0 }],\n", " source: [p.Instance, () => new column_data_source_1.ColumnDataSource()],\n", " x_range_name: [p.String, 'default'],\n", " y_range_name: [p.String, 'default'],\n", " });\n", " this.override({\n", " background_fill_color: null,\n", " border_line_color: null,\n", " });\n", " }\n", " }\n", " exports.LabelSet = LabelSet;\n", " LabelSet.__name__ = \"LabelSet\";\n", " LabelSet.init_LabelSet();\n", " },\n", " /* models/annotations/legend.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const annotation_1 = require(31) /* ./annotation */;\n", " const mixins = tslib_1.__importStar(require(23) /* ../../core/property_mixins */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const signaling_1 = require(14) /* ../../core/signaling */;\n", " const text_1 = require(132) /* ../../core/util/text */;\n", " const bbox_1 = require(88) /* ../../core/util/bbox */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const assert_1 = require(11) /* ../../core/util/assert */;\n", " class LegendView extends annotation_1.AnnotationView {\n", " cursor(_sx, _sy) {\n", " return this.model.click_policy == \"none\" ? null : \"pointer\";\n", " }\n", " get legend_padding() {\n", " return this.visuals.border_line.line_color.value() != null ? this.model.padding : 0;\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.change, () => this.plot_view.request_render());\n", " this.connect(this.model.item_change, () => this.plot_view.request_render());\n", " }\n", " compute_legend_bbox() {\n", " const legend_names = this.model.get_legend_names();\n", " const { glyph_height, glyph_width } = this.model;\n", " const { label_height, label_width } = this.model;\n", " this.max_label_height = array_1.max([text_1.measure_font(this.visuals.label_text.font_value()).height, label_height, glyph_height]);\n", " // this is to measure text properties\n", " const { ctx } = this.layer;\n", " ctx.save();\n", " this.visuals.label_text.set_value(ctx);\n", " this.text_widths = new Map();\n", " for (const name of legend_names) {\n", " this.text_widths.set(name, array_1.max([ctx.measureText(name).width, label_width]));\n", " }\n", " this.visuals.title_text.set_value(ctx);\n", " this.title_height = this.model.title ? text_1.measure_font(this.visuals.title_text.font_value()).height + this.model.title_standoff : 0;\n", " this.title_width = this.model.title ? ctx.measureText(this.model.title).width : 0;\n", " ctx.restore();\n", " const max_label_width = Math.max(array_1.max([...this.text_widths.values()]), 0);\n", " const legend_margin = this.model.margin;\n", " const { legend_padding } = this;\n", " const legend_spacing = this.model.spacing;\n", " const { label_standoff } = this.model;\n", " let legend_height, legend_width;\n", " if (this.model.orientation == \"vertical\") {\n", " legend_height = legend_names.length * this.max_label_height + Math.max(legend_names.length - 1, 0) * legend_spacing + 2 * legend_padding + this.title_height;\n", " legend_width = array_1.max([(max_label_width + glyph_width + label_standoff + 2 * legend_padding), this.title_width + 2 * legend_padding]);\n", " }\n", " else {\n", " let item_width = 2 * legend_padding + Math.max(legend_names.length - 1, 0) * legend_spacing;\n", " for (const [, width] of this.text_widths) {\n", " item_width += array_1.max([width, label_width]) + glyph_width + label_standoff;\n", " }\n", " legend_width = array_1.max([this.title_width + 2 * legend_padding, item_width]);\n", " legend_height = this.max_label_height + this.title_height + 2 * legend_padding;\n", " }\n", " const panel = this.panel != null ? this.panel : this.plot_view.frame;\n", " const [hr, vr] = panel.bbox.ranges;\n", " const { location } = this.model;\n", " let sx, sy;\n", " if (types_1.isString(location)) {\n", " switch (location) {\n", " case 'top_left':\n", " sx = hr.start + legend_margin;\n", " sy = vr.start + legend_margin;\n", " break;\n", " case 'top_center':\n", " sx = (hr.end + hr.start) / 2 - legend_width / 2;\n", " sy = vr.start + legend_margin;\n", " break;\n", " case 'top_right':\n", " sx = hr.end - legend_margin - legend_width;\n", " sy = vr.start + legend_margin;\n", " break;\n", " case 'bottom_right':\n", " sx = hr.end - legend_margin - legend_width;\n", " sy = vr.end - legend_margin - legend_height;\n", " break;\n", " case 'bottom_center':\n", " sx = (hr.end + hr.start) / 2 - legend_width / 2;\n", " sy = vr.end - legend_margin - legend_height;\n", " break;\n", " case 'bottom_left':\n", " sx = hr.start + legend_margin;\n", " sy = vr.end - legend_margin - legend_height;\n", " break;\n", " case 'center_left':\n", " sx = hr.start + legend_margin;\n", " sy = (vr.end + vr.start) / 2 - legend_height / 2;\n", " break;\n", " case 'center':\n", " sx = (hr.end + hr.start) / 2 - legend_width / 2;\n", " sy = (vr.end + vr.start) / 2 - legend_height / 2;\n", " break;\n", " case 'center_right':\n", " sx = hr.end - legend_margin - legend_width;\n", " sy = (vr.end + vr.start) / 2 - legend_height / 2;\n", " break;\n", " }\n", " }\n", " else if (types_1.isArray(location) && location.length == 2) {\n", " const [vx, vy] = location;\n", " sx = panel.xview.compute(vx);\n", " sy = panel.yview.compute(vy) - legend_height;\n", " }\n", " else\n", " assert_1.unreachable();\n", " return new bbox_1.BBox({ left: sx, top: sy, width: legend_width, height: legend_height });\n", " }\n", " interactive_bbox() {\n", " return this.compute_legend_bbox();\n", " }\n", " interactive_hit(sx, sy) {\n", " const bbox = this.interactive_bbox();\n", " return bbox.contains(sx, sy);\n", " }\n", " on_hit(sx, sy) {\n", " let yoffset;\n", " const { glyph_width } = this.model;\n", " const { legend_padding } = this;\n", " const legend_spacing = this.model.spacing;\n", " const { label_standoff } = this.model;\n", " let xoffset = (yoffset = legend_padding);\n", " const legend_bbox = this.compute_legend_bbox();\n", " const vertical = this.model.orientation == \"vertical\";\n", " for (const item of this.model.items) {\n", " const labels = item.get_labels_list_from_label_prop();\n", " for (const label of labels) {\n", " const x1 = legend_bbox.x + xoffset;\n", " const y1 = legend_bbox.y + yoffset + this.title_height;\n", " let w, h;\n", " if (vertical)\n", " [w, h] = [legend_bbox.width - 2 * legend_padding, this.max_label_height];\n", " else\n", " [w, h] = [this.text_widths.get(label) + glyph_width + label_standoff, this.max_label_height];\n", " const bbox = new bbox_1.BBox({ left: x1, top: y1, width: w, height: h });\n", " if (bbox.contains(sx, sy)) {\n", " switch (this.model.click_policy) {\n", " case \"hide\": {\n", " for (const r of item.renderers)\n", " r.visible = !r.visible;\n", " break;\n", " }\n", " case \"mute\": {\n", " for (const r of item.renderers)\n", " r.muted = !r.muted;\n", " break;\n", " }\n", " }\n", " return true;\n", " }\n", " if (vertical)\n", " yoffset += this.max_label_height + legend_spacing;\n", " else\n", " xoffset += this.text_widths.get(label) + glyph_width + label_standoff + legend_spacing;\n", " }\n", " }\n", " return false;\n", " }\n", " render() {\n", " if (!this.model.visible)\n", " return;\n", " if (this.model.items.length == 0)\n", " return;\n", " // set a backref on render so that items can later signal item_change upates\n", " // on the model to trigger a re-render\n", " for (const item of this.model.items) {\n", " item.legend = this.model;\n", " }\n", " const { ctx } = this.layer;\n", " const bbox = this.compute_legend_bbox();\n", " ctx.save();\n", " this._draw_legend_box(ctx, bbox);\n", " this._draw_legend_items(ctx, bbox);\n", " if (this.model.title)\n", " this._draw_title(ctx, bbox);\n", " ctx.restore();\n", " }\n", " _draw_legend_box(ctx, bbox) {\n", " ctx.beginPath();\n", " ctx.rect(bbox.x, bbox.y, bbox.width, bbox.height);\n", " this.visuals.background_fill.set_value(ctx);\n", " ctx.fill();\n", " if (this.visuals.border_line.doit) {\n", " this.visuals.border_line.set_value(ctx);\n", " ctx.stroke();\n", " }\n", " }\n", " _draw_legend_items(ctx, bbox) {\n", " const { glyph_width, glyph_height } = this.model;\n", " const { legend_padding } = this;\n", " const legend_spacing = this.model.spacing;\n", " const { label_standoff } = this.model;\n", " let xoffset = legend_padding;\n", " let yoffset = legend_padding;\n", " const vertical = this.model.orientation == \"vertical\";\n", " for (const item of this.model.items) {\n", " const labels = item.get_labels_list_from_label_prop();\n", " const field = item.get_field_from_label_prop();\n", " if (labels.length == 0)\n", " continue;\n", " const active = (() => {\n", " switch (this.model.click_policy) {\n", " case \"none\": return true;\n", " case \"hide\": return array_1.every(item.renderers, r => r.visible);\n", " case \"mute\": return array_1.every(item.renderers, r => !r.muted);\n", " }\n", " })();\n", " for (const label of labels) {\n", " const x1 = bbox.x + xoffset;\n", " const y1 = bbox.y + yoffset + this.title_height;\n", " const x2 = x1 + glyph_width;\n", " const y2 = y1 + glyph_height;\n", " if (vertical)\n", " yoffset += this.max_label_height + legend_spacing;\n", " else\n", " xoffset += this.text_widths.get(label) + glyph_width + label_standoff + legend_spacing;\n", " this.visuals.label_text.set_value(ctx);\n", " ctx.fillText(label, x2 + label_standoff, y1 + this.max_label_height / 2.0);\n", " for (const r of item.renderers) {\n", " const view = this.plot_view.renderer_views.get(r);\n", " view.draw_legend(ctx, x1, x2, y1, y2, field, label, item.index);\n", " }\n", " if (!active) {\n", " let w, h;\n", " if (vertical)\n", " [w, h] = [bbox.width - 2 * legend_padding, this.max_label_height];\n", " else\n", " [w, h] = [this.text_widths.get(label) + glyph_width + label_standoff, this.max_label_height];\n", " ctx.beginPath();\n", " ctx.rect(x1, y1, w, h);\n", " this.visuals.inactive_fill.set_value(ctx);\n", " ctx.fill();\n", " }\n", " }\n", " }\n", " }\n", " _draw_title(ctx, bbox) {\n", " if (!this.visuals.title_text.doit)\n", " return;\n", " ctx.save();\n", " ctx.translate(bbox.x0, bbox.y0 + this.title_height);\n", " this.visuals.title_text.set_value(ctx);\n", " ctx.fillText(this.model.title, this.legend_padding, this.legend_padding - this.model.title_standoff);\n", " ctx.restore();\n", " }\n", " _get_size() {\n", " const { width, height } = this.compute_legend_bbox();\n", " return {\n", " width: width + 2 * this.model.margin,\n", " height: height + 2 * this.model.margin,\n", " };\n", " }\n", " }\n", " exports.LegendView = LegendView;\n", " LegendView.__name__ = \"LegendView\";\n", " class Legend extends annotation_1.Annotation {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.item_change = new signaling_1.Signal0(this, \"item_change\");\n", " }\n", " static init_Legend() {\n", " this.prototype.default_view = LegendView;\n", " this.mixins([\n", " [\"label_\", mixins.Text],\n", " [\"title_\", mixins.Text],\n", " [\"inactive_\", mixins.Fill],\n", " [\"border_\", mixins.Line],\n", " [\"background_\", mixins.Fill],\n", " ]);\n", " this.define({\n", " orientation: [p.Orientation, 'vertical'],\n", " location: [p.Any, 'top_right'],\n", " title: [p.String],\n", " title_standoff: [p.Number, 5],\n", " label_standoff: [p.Number, 5],\n", " glyph_height: [p.Number, 20],\n", " glyph_width: [p.Number, 20],\n", " label_height: [p.Number, 20],\n", " label_width: [p.Number, 20],\n", " margin: [p.Number, 10],\n", " padding: [p.Number, 10],\n", " spacing: [p.Number, 3],\n", " items: [p.Array, []],\n", " click_policy: [p.Any, \"none\"],\n", " });\n", " this.override({\n", " border_line_color: \"#e5e5e5\",\n", " border_line_alpha: 0.5,\n", " border_line_width: 1,\n", " background_fill_color: \"#ffffff\",\n", " background_fill_alpha: 0.95,\n", " inactive_fill_color: \"white\",\n", " inactive_fill_alpha: 0.7,\n", " label_text_font_size: \"13px\",\n", " label_text_baseline: \"middle\",\n", " title_text_font_size: \"13px\",\n", " title_text_font_style: \"italic\",\n", " });\n", " }\n", " get_legend_names() {\n", " const legend_names = [];\n", " for (const item of this.items) {\n", " const labels = item.get_labels_list_from_label_prop();\n", " legend_names.push(...labels);\n", " }\n", " return legend_names;\n", " }\n", " }\n", " exports.Legend = Legend;\n", " Legend.__name__ = \"Legend\";\n", " Legend.init_Legend();\n", " },\n", " /* models/annotations/legend_item.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const model_1 = require(71) /* ../../model */;\n", " const columnar_data_source_1 = require(77) /* ../sources/columnar_data_source */;\n", " const vectorization_1 = require(138) /* ../../core/vectorization */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const logging_1 = require(72) /* ../../core/logging */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " class LegendItem extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_LegendItem() {\n", " this.define({\n", " label: [p.StringSpec, null],\n", " renderers: [p.Array, []],\n", " index: [p.Number, null],\n", " });\n", " }\n", " /*protected*/ _check_data_sources_on_renderers() {\n", " const field = this.get_field_from_label_prop();\n", " if (field != null) {\n", " if (this.renderers.length < 1) {\n", " return false;\n", " }\n", " const source = this.renderers[0].data_source;\n", " if (source != null) {\n", " for (const r of this.renderers) {\n", " if (r.data_source != source) {\n", " return false;\n", " }\n", " }\n", " }\n", " }\n", " return true;\n", " }\n", " /*protected*/ _check_field_label_on_data_source() {\n", " const field = this.get_field_from_label_prop();\n", " if (field != null) {\n", " if (this.renderers.length < 1) {\n", " return false;\n", " }\n", " const source = this.renderers[0].data_source;\n", " if (source != null && !array_1.includes(source.columns(), field)) {\n", " return false;\n", " }\n", " }\n", " return true;\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.legend = null;\n", " this.connect(this.change, () => {\n", " if (this.legend != null)\n", " this.legend.item_change.emit();\n", " });\n", " // Validate data_sources match\n", " const data_source_validation = this._check_data_sources_on_renderers();\n", " if (!data_source_validation)\n", " logging_1.logger.error(\"Non matching data sources on legend item renderers\");\n", " // Validate label in data_source\n", " const field_validation = this._check_field_label_on_data_source();\n", " if (!field_validation)\n", " logging_1.logger.error(`Bad column name on label: ${this.label}`);\n", " }\n", " get_field_from_label_prop() {\n", " const { label } = this;\n", " return vectorization_1.isField(label) ? label.field : null;\n", " }\n", " get_labels_list_from_label_prop() {\n", " // Always return a list of the labels\n", " if (vectorization_1.isValue(this.label)) {\n", " const { value } = this.label;\n", " return value != null ? [value] : [];\n", " }\n", " const field = this.get_field_from_label_prop();\n", " if (field != null) {\n", " let source;\n", " if (this.renderers[0] && this.renderers[0].data_source != null)\n", " source = this.renderers[0].data_source;\n", " else\n", " return [\"No source found\"];\n", " if (source instanceof columnar_data_source_1.ColumnarDataSource) {\n", " const data = source.get_column(field);\n", " if (data != null)\n", " return array_1.uniq(Array.from(data));\n", " else\n", " return [\"Invalid field\"];\n", " }\n", " }\n", " return [];\n", " }\n", " }\n", " exports.LegendItem = LegendItem;\n", " LegendItem.__name__ = \"LegendItem\";\n", " LegendItem.init_LegendItem();\n", " },\n", " /* core/vectorization.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const types_1 = require(8) /* ./util/types */;\n", " function isValue(obj) {\n", " return types_1.isPlainObject(obj) && \"value\" in obj;\n", " }\n", " exports.isValue = isValue;\n", " function isField(obj) {\n", " return types_1.isPlainObject(obj) && \"field\" in obj;\n", " }\n", " exports.isField = isField;\n", " },\n", " /* models/annotations/poly_annotation.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const annotation_1 = require(31) /* ./annotation */;\n", " const mixins = tslib_1.__importStar(require(23) /* ../../core/property_mixins */);\n", " const signaling_1 = require(14) /* ../../core/signaling */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class PolyAnnotationView extends annotation_1.AnnotationView {\n", " connect_signals() {\n", " super.connect_signals();\n", " // need to respond to either normal BB change events or silent\n", " // \"data only updates\" that tools might want to use\n", " this.connect(this.model.change, () => this.plot_view.request_render());\n", " this.connect(this.model.data_update, () => this.plot_view.request_render());\n", " }\n", " render() {\n", " if (!this.model.visible)\n", " return;\n", " const { xs, ys } = this.model;\n", " if (xs.length != ys.length)\n", " return;\n", " if (xs.length < 3 || ys.length < 3)\n", " return;\n", " const { frame } = this.plot_view;\n", " const { ctx } = this.layer;\n", " for (let i = 0, end = xs.length; i < end; i++) {\n", " let sx;\n", " if (this.model.xs_units == 'screen')\n", " sx = this.model.screen ? xs[i] : frame.xview.compute(xs[i]);\n", " else\n", " throw new Error(\"not implemented\");\n", " let sy;\n", " if (this.model.ys_units == 'screen')\n", " sy = this.model.screen ? ys[i] : frame.yview.compute(ys[i]);\n", " else\n", " throw new Error(\"not implemented\");\n", " if (i == 0) {\n", " ctx.beginPath();\n", " ctx.moveTo(sx, sy);\n", " }\n", " else {\n", " ctx.lineTo(sx, sy);\n", " }\n", " }\n", " ctx.closePath();\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_value(ctx);\n", " ctx.stroke();\n", " }\n", " if (this.visuals.fill.doit) {\n", " this.visuals.fill.set_value(ctx);\n", " ctx.fill();\n", " }\n", " }\n", " }\n", " exports.PolyAnnotationView = PolyAnnotationView;\n", " PolyAnnotationView.__name__ = \"PolyAnnotationView\";\n", " class PolyAnnotation extends annotation_1.Annotation {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_PolyAnnotation() {\n", " this.prototype.default_view = PolyAnnotationView;\n", " this.mixins([mixins.Line /*Scalar*/, mixins.Fill /*Scalar*/]);\n", " this.define({\n", " xs: [p.Array, []],\n", " xs_units: [p.SpatialUnits, 'data'],\n", " ys: [p.Array, []],\n", " ys_units: [p.SpatialUnits, 'data'],\n", " x_range_name: [p.String, 'default'],\n", " y_range_name: [p.String, 'default'],\n", " });\n", " this.internal({\n", " screen: [p.Boolean, false],\n", " });\n", " this.override({\n", " fill_color: \"#fff9ba\",\n", " fill_alpha: 0.4,\n", " line_color: \"#cccccc\",\n", " line_alpha: 0.3,\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.data_update = new signaling_1.Signal0(this, \"data_update\");\n", " }\n", " update({ xs, ys }) {\n", " this.setv({ xs, ys, screen: true }, { silent: true });\n", " this.data_update.emit();\n", " }\n", " }\n", " exports.PolyAnnotation = PolyAnnotation;\n", " PolyAnnotation.__name__ = \"PolyAnnotation\";\n", " PolyAnnotation.init_PolyAnnotation();\n", " },\n", " /* models/annotations/slope.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const annotation_1 = require(31) /* ./annotation */;\n", " const mixins = tslib_1.__importStar(require(23) /* ../../core/property_mixins */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class SlopeView extends annotation_1.AnnotationView {\n", " initialize() {\n", " super.initialize();\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.change, () => this.plot_view.request_render());\n", " }\n", " render() {\n", " if (!this.model.visible)\n", " return;\n", " this._draw_slope();\n", " }\n", " _draw_slope() {\n", " const gradient = this.model.gradient;\n", " const y_intercept = this.model.y_intercept;\n", " if (gradient == null || y_intercept == null) {\n", " return;\n", " }\n", " const { frame } = this.plot_view;\n", " const xscale = frame.xscales[this.model.x_range_name];\n", " const yscale = frame.yscales[this.model.y_range_name];\n", " const sy_start = frame._top.value;\n", " const sy_end = sy_start + frame._height.value;\n", " const y_start = yscale.invert(sy_start);\n", " const y_end = yscale.invert(sy_end);\n", " const x_start = (y_start - y_intercept) / gradient;\n", " const x_end = (y_end - y_intercept) / gradient;\n", " const sx_start = xscale.compute(x_start);\n", " const sx_end = xscale.compute(x_end);\n", " const { ctx } = this.layer;\n", " ctx.save();\n", " ctx.beginPath();\n", " this.visuals.line.set_value(ctx);\n", " ctx.moveTo(sx_start, sy_start);\n", " ctx.lineTo(sx_end, sy_end);\n", " ctx.stroke();\n", " ctx.restore();\n", " }\n", " }\n", " exports.SlopeView = SlopeView;\n", " SlopeView.__name__ = \"SlopeView\";\n", " class Slope extends annotation_1.Annotation {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Slope() {\n", " this.prototype.default_view = SlopeView;\n", " this.mixins(mixins.Line /*Scalar*/);\n", " this.define({\n", " gradient: [p.Number, null],\n", " y_intercept: [p.Number, null],\n", " x_range_name: [p.String, 'default'],\n", " y_range_name: [p.String, 'default'],\n", " });\n", " this.override({\n", " line_color: 'black',\n", " });\n", " }\n", " }\n", " exports.Slope = Slope;\n", " Slope.__name__ = \"Slope\";\n", " Slope.init_Slope();\n", " },\n", " /* models/annotations/span.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const annotation_1 = require(31) /* ./annotation */;\n", " const mixins = tslib_1.__importStar(require(23) /* ../../core/property_mixins */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class SpanView extends annotation_1.AnnotationView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.change, () => this.plot_view.request_paint(this));\n", " }\n", " render() {\n", " if (!this.model.visible)\n", " return;\n", " const { location } = this.model;\n", " if (location == null) {\n", " return;\n", " }\n", " const { frame } = this.plot_view;\n", " const xscale = frame.xscales[this.model.x_range_name];\n", " const yscale = frame.yscales[this.model.y_range_name];\n", " const _calc_dim = (scale, view) => {\n", " if (this.model.location_units == 'data')\n", " return scale.compute(location);\n", " else\n", " return this.model.for_hover ? location : view.compute(location);\n", " };\n", " let height, sleft, stop, width;\n", " if (this.model.dimension == 'width') {\n", " stop = _calc_dim(yscale, frame.yview);\n", " sleft = frame._left.value;\n", " width = frame._width.value;\n", " height = this.model.properties.line_width.value();\n", " }\n", " else {\n", " stop = frame._top.value;\n", " sleft = _calc_dim(xscale, frame.xview);\n", " width = this.model.properties.line_width.value();\n", " height = frame._height.value;\n", " }\n", " const { ctx } = this.layer;\n", " ctx.save();\n", " ctx.beginPath();\n", " this.visuals.line.set_value(ctx);\n", " ctx.moveTo(sleft, stop);\n", " if (this.model.dimension == \"width\") {\n", " ctx.lineTo(sleft + width, stop);\n", " }\n", " else {\n", " ctx.lineTo(sleft, stop + height);\n", " }\n", " ctx.stroke();\n", " ctx.restore();\n", " }\n", " }\n", " exports.SpanView = SpanView;\n", " SpanView.__name__ = \"SpanView\";\n", " class Span extends annotation_1.Annotation {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Span() {\n", " this.prototype.default_view = SpanView;\n", " this.mixins(mixins.Line /*Scalar*/);\n", " this.define({\n", " render_mode: [p.RenderMode, 'canvas'],\n", " x_range_name: [p.String, 'default'],\n", " y_range_name: [p.String, 'default'],\n", " location: [p.Number, null],\n", " location_units: [p.SpatialUnits, 'data'],\n", " dimension: [p.Dimension, 'width'],\n", " });\n", " this.override({\n", " line_color: 'black',\n", " });\n", " this.internal({\n", " for_hover: [p.Boolean, false],\n", " });\n", " }\n", " }\n", " exports.Span = Span;\n", " Span.__name__ = \"Span\";\n", " Span.init_Span();\n", " },\n", " /* models/annotations/title.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const text_annotation_1 = require(134) /* ./text_annotation */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const visuals_1 = require(70) /* ../../core/visuals */;\n", " const mixins = tslib_1.__importStar(require(23) /* ../../core/property_mixins */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class TitleView extends text_annotation_1.TextAnnotationView {\n", " initialize() {\n", " super.initialize();\n", " this.visuals.text = new visuals_1.Text(this.model);\n", " }\n", " _get_location() {\n", " const panel = this.panel;\n", " const hmargin = this.model.offset;\n", " const vmargin = 5;\n", " let sx, sy;\n", " switch (panel.side) {\n", " case 'above':\n", " case 'below': {\n", " switch (this.model.vertical_align) {\n", " case 'top':\n", " sy = panel._top.value + vmargin;\n", " break;\n", " case 'middle':\n", " sy = panel._vcenter.value;\n", " break;\n", " case 'bottom':\n", " sy = panel._bottom.value - vmargin;\n", " break;\n", " }\n", " switch (this.model.align) {\n", " case 'left':\n", " sx = panel._left.value + hmargin;\n", " break;\n", " case 'center':\n", " sx = panel._hcenter.value;\n", " break;\n", " case 'right':\n", " sx = panel._right.value - hmargin;\n", " break;\n", " }\n", " break;\n", " }\n", " case 'left': {\n", " switch (this.model.vertical_align) {\n", " case 'top':\n", " sx = panel._left.value - vmargin;\n", " break;\n", " case 'middle':\n", " sx = panel._hcenter.value;\n", " break;\n", " case 'bottom':\n", " sx = panel._right.value + vmargin;\n", " break;\n", " }\n", " switch (this.model.align) {\n", " case 'left':\n", " sy = panel._bottom.value - hmargin;\n", " break;\n", " case 'center':\n", " sy = panel._vcenter.value;\n", " break;\n", " case 'right':\n", " sy = panel._top.value + hmargin;\n", " break;\n", " }\n", " break;\n", " }\n", " case 'right': {\n", " switch (this.model.vertical_align) {\n", " case 'top':\n", " sx = panel._right.value - vmargin;\n", " break;\n", " case 'middle':\n", " sx = panel._hcenter.value;\n", " break;\n", " case 'bottom':\n", " sx = panel._left.value + vmargin;\n", " break;\n", " }\n", " switch (this.model.align) {\n", " case 'left':\n", " sy = panel._top.value + hmargin;\n", " break;\n", " case 'center':\n", " sy = panel._vcenter.value;\n", " break;\n", " case 'right':\n", " sy = panel._bottom.value - hmargin;\n", " break;\n", " }\n", " break;\n", " }\n", " }\n", " return [sx, sy];\n", " }\n", " render() {\n", " if (!this.model.visible) {\n", " if (this.model.render_mode == 'css')\n", " dom_1.undisplay(this.el);\n", " return;\n", " }\n", " const { text } = this.model;\n", " if (text == null || text.length == 0)\n", " return;\n", " this.model.text_baseline = this.model.vertical_align;\n", " this.model.text_align = this.model.align;\n", " const [sx, sy] = this._get_location();\n", " const angle = this.panel.get_label_angle_heuristic('parallel');\n", " const draw = this.model.render_mode == 'canvas' ? this._canvas_text.bind(this) : this._css_text.bind(this);\n", " draw(this.layer.ctx, text, sx, sy, angle);\n", " }\n", " _get_size() {\n", " const { text } = this.model;\n", " if (text == null || text.length == 0)\n", " return { width: 0, height: 0 };\n", " else {\n", " this.visuals.text.set_value(this.layer.ctx);\n", " const { width, ascent } = this.layer.ctx.measureText(text);\n", " return { width, height: ascent * this.visuals.text.text_line_height.value() + 10 };\n", " }\n", " }\n", " }\n", " exports.TitleView = TitleView;\n", " TitleView.__name__ = \"TitleView\";\n", " class Title extends text_annotation_1.TextAnnotation {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Title() {\n", " this.prototype.default_view = TitleView;\n", " this.mixins([\n", " [\"border_\", mixins.Line],\n", " [\"background_\", mixins.Fill],\n", " ]);\n", " this.define({\n", " text: [p.String],\n", " text_font: [p.Font, 'helvetica'],\n", " text_font_size: [p.StringSpec, '13px'],\n", " text_font_style: [p.FontStyle, 'bold'],\n", " text_color: [p.ColorSpec, '#444444'],\n", " text_alpha: [p.NumberSpec, 1.0],\n", " text_line_height: [p.Number, 1.0],\n", " vertical_align: [p.VerticalAlign, 'bottom'],\n", " align: [p.TextAlign, 'left'],\n", " offset: [p.Number, 0],\n", " });\n", " this.override({\n", " background_fill_color: null,\n", " border_line_color: null,\n", " });\n", " this.internal({\n", " text_align: [p.TextAlign, 'left'],\n", " text_baseline: [p.TextBaseline, 'bottom'],\n", " });\n", " }\n", " }\n", " exports.Title = Title;\n", " Title.__name__ = \"Title\";\n", " Title.init_Title();\n", " },\n", " /* models/annotations/toolbar_panel.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const annotation_1 = require(31) /* ./annotation */;\n", " const build_views_1 = require(99) /* ../../core/build_views */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class ToolbarPanelView extends annotation_1.AnnotationView {\n", " constructor() {\n", " super(...arguments);\n", " this.rotate = true;\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.plot_view.canvas_view.add_event(this.el);\n", " }\n", " async lazy_initialize() {\n", " this._toolbar_view = await build_views_1.build_view(this.model.toolbar, { parent: this });\n", " this.plot_view.visibility_callbacks.push((visible) => this._toolbar_view.set_visibility(visible));\n", " }\n", " remove() {\n", " this._toolbar_view.remove();\n", " super.remove();\n", " }\n", " render() {\n", " super.render();\n", " if (!this.model.visible) {\n", " dom_1.undisplay(this.el);\n", " return;\n", " }\n", " this.el.style.position = \"absolute\";\n", " this.el.style.overflow = \"hidden\";\n", " dom_1.position(this.el, this.panel.bbox);\n", " this._toolbar_view.render();\n", " dom_1.empty(this.el);\n", " this.el.appendChild(this._toolbar_view.el);\n", " dom_1.display(this.el);\n", " }\n", " _get_size() {\n", " const { tools, logo } = this.model.toolbar;\n", " return {\n", " width: tools.length * 30 + (logo != null ? 25 : 0),\n", " height: 30,\n", " };\n", " }\n", " }\n", " exports.ToolbarPanelView = ToolbarPanelView;\n", " ToolbarPanelView.__name__ = \"ToolbarPanelView\";\n", " class ToolbarPanel extends annotation_1.Annotation {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ToolbarPanel() {\n", " this.prototype.default_view = ToolbarPanelView;\n", " this.define({\n", " toolbar: [p.Instance],\n", " });\n", " }\n", " }\n", " exports.ToolbarPanel = ToolbarPanel;\n", " ToolbarPanel.__name__ = \"ToolbarPanel\";\n", " ToolbarPanel.init_ToolbarPanel();\n", " },\n", " /* models/annotations/tooltip.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const annotation_1 = require(31) /* ./annotation */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const tooltips_1 = require(145) /* ../../styles/tooltips */;\n", " const mixins_1 = require(146) /* ../../styles/mixins */;\n", " const tooltips_css_1 = tslib_1.__importDefault(require(147) /* ../../styles/tooltips.css */);\n", " function compute_side(attachment, sx, sy, hcenter, vcenter) {\n", " switch (attachment) {\n", " case \"horizontal\":\n", " return sx < hcenter ? \"right\" : \"left\";\n", " case \"vertical\":\n", " return sy < vcenter ? \"below\" : \"above\";\n", " default:\n", " return attachment;\n", " }\n", " }\n", " exports.compute_side = compute_side;\n", " class TooltipView extends annotation_1.AnnotationView {\n", " initialize() {\n", " super.initialize();\n", " // TODO (bev) really probably need multiple divs\n", " this.plot_view.canvas_view.add_overlay(this.el);\n", " dom_1.undisplay(this.el);\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.data.change, () => this._draw_tips());\n", " }\n", " styles() {\n", " return [...super.styles(), tooltips_css_1.default];\n", " }\n", " css_classes() {\n", " return super.css_classes().concat(tooltips_1.bk_tooltip);\n", " }\n", " render() {\n", " if (!this.model.visible)\n", " return;\n", " this._draw_tips();\n", " }\n", " _draw_tips() {\n", " const { data } = this.model;\n", " dom_1.empty(this.el);\n", " dom_1.undisplay(this.el);\n", " if (this.model.custom)\n", " this.el.classList.add(tooltips_1.bk_tooltip_custom);\n", " else\n", " this.el.classList.remove(tooltips_1.bk_tooltip_custom);\n", " if (data.length == 0)\n", " return;\n", " const { frame } = this.plot_view;\n", " for (const [sx, sy, content] of data) {\n", " if (this.model.inner_only && !frame.bbox.contains(sx, sy))\n", " continue;\n", " const tip = dom_1.div({}, content);\n", " this.el.appendChild(tip);\n", " }\n", " const [sx, sy] = data[data.length - 1]; // XXX: this previously depended on {sx, sy} leaking from the for-loop\n", " const side = compute_side(this.model.attachment, sx, sy, frame._hcenter.value, frame._vcenter.value);\n", " this.el.classList.remove(mixins_1.bk_right);\n", " this.el.classList.remove(mixins_1.bk_left);\n", " this.el.classList.remove(mixins_1.bk_above);\n", " this.el.classList.remove(mixins_1.bk_below);\n", " const arrow_size = 10; // XXX: keep in sync with less\n", " dom_1.display(this.el); // XXX: {offset,client}Width() gives 0 when display=\"none\"\n", " // slightly confusing: side \"left\" (for example) is relative to point that\n", " // is being annotated but CS class \".bk-left\" is relative to the tooltip itself\n", " let top;\n", " let left = 0;\n", " let right = 0;\n", " switch (side) {\n", " case \"right\":\n", " this.el.classList.add(mixins_1.bk_left);\n", " left = sx + (this.el.offsetWidth - this.el.clientWidth) + arrow_size;\n", " top = sy - this.el.offsetHeight / 2;\n", " break;\n", " case \"left\":\n", " this.el.classList.add(mixins_1.bk_right);\n", " right = (this.plot_view.layout.bbox.width - sx) + arrow_size;\n", " top = sy - this.el.offsetHeight / 2;\n", " break;\n", " case \"below\":\n", " this.el.classList.add(mixins_1.bk_above);\n", " top = sy + (this.el.offsetHeight - this.el.clientHeight) + arrow_size;\n", " left = Math.round(sx - this.el.offsetWidth / 2);\n", " break;\n", " case \"above\":\n", " this.el.classList.add(mixins_1.bk_below);\n", " top = sy - this.el.offsetHeight - arrow_size;\n", " left = Math.round(sx - this.el.offsetWidth / 2);\n", " break;\n", " }\n", " if (this.model.show_arrow)\n", " this.el.classList.add(tooltips_1.bk_tooltip_arrow);\n", " // TODO (bev) this is not currently bulletproof. If there are\n", " // two hits, not colocated and one is off the screen, that can\n", " // be problematic\n", " if (this.el.childNodes.length > 0) {\n", " this.el.style.top = `${top}px`;\n", " this.el.style.left = left ? `${left}px` : 'auto';\n", " this.el.style.right = right ? `${right}px` : 'auto';\n", " }\n", " else\n", " dom_1.undisplay(this.el);\n", " }\n", " }\n", " exports.TooltipView = TooltipView;\n", " TooltipView.__name__ = \"TooltipView\";\n", " class Tooltip extends annotation_1.Annotation {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Tooltip() {\n", " this.prototype.default_view = TooltipView;\n", " this.define({\n", " attachment: [p.TooltipAttachment, 'horizontal'],\n", " inner_only: [p.Boolean, true],\n", " show_arrow: [p.Boolean, true],\n", " });\n", " this.override({\n", " level: 'overlay',\n", " });\n", " this.internal({\n", " data: [p.Any, []],\n", " custom: [p.Any],\n", " });\n", " }\n", " clear() {\n", " this.data = [];\n", " }\n", " add(sx, sy, content) {\n", " this.data = this.data.concat([[sx, sy, content]]);\n", " }\n", " }\n", " exports.Tooltip = Tooltip;\n", " Tooltip.__name__ = \"Tooltip\";\n", " Tooltip.init_Tooltip();\n", " },\n", " /* styles/tooltips.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.bk_tooltip = \"bk-tooltip\";\n", " exports.bk_tooltip_arrow = \"bk-tooltip-arrow\";\n", " exports.bk_tooltip_custom = \"bk-tooltip-custom\";\n", " exports.bk_tooltip_row_label = \"bk-tooltip-row-label\";\n", " exports.bk_tooltip_row_value = \"bk-tooltip-row-value\";\n", " exports.bk_tooltip_color_block = \"bk-tooltip-color-block\";\n", " },\n", " /* styles/mixins.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.bk_active = \"bk-active\";\n", " exports.bk_inline = \"bk-inline\";\n", " exports.bk_left = \"bk-left\";\n", " exports.bk_right = \"bk-right\";\n", " exports.bk_above = \"bk-above\";\n", " exports.bk_below = \"bk-below\";\n", " exports.bk_up = \"bk-up\";\n", " exports.bk_down = \"bk-down\";\n", " function bk_side(side) {\n", " switch (side) {\n", " case \"above\": return exports.bk_above;\n", " case \"below\": return exports.bk_below;\n", " case \"left\": return exports.bk_left;\n", " case \"right\": return exports.bk_right;\n", " }\n", " }\n", " exports.bk_side = bk_side;\n", " },\n", " /* styles/tooltips.css.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const css = `\n", " .bk-root {\n", " /* Same border color used everywhere */\n", " /* Gray of icons */\n", " }\n", " .bk-root .bk-tooltip {\n", " font-weight: 300;\n", " font-size: 12px;\n", " position: absolute;\n", " padding: 5px;\n", " border: 1px solid #e5e5e5;\n", " color: #2f2f2f;\n", " background-color: white;\n", " pointer-events: none;\n", " opacity: 0.95;\n", " z-index: 100;\n", " }\n", " .bk-root .bk-tooltip > div:not(:first-child) {\n", " /* gives space when multiple elements are being hovered over */\n", " margin-top: 5px;\n", " border-top: #e5e5e5 1px dashed;\n", " }\n", " .bk-root .bk-tooltip.bk-left.bk-tooltip-arrow::before {\n", " position: absolute;\n", " margin: -7px 0 0 0;\n", " top: 50%;\n", " width: 0;\n", " height: 0;\n", " border-style: solid;\n", " border-width: 7px 0 7px 0;\n", " border-color: transparent;\n", " content: \" \";\n", " display: block;\n", " left: -10px;\n", " border-right-width: 10px;\n", " border-right-color: #909599;\n", " }\n", " .bk-root .bk-tooltip.bk-left::before {\n", " left: -10px;\n", " border-right-width: 10px;\n", " border-right-color: #909599;\n", " }\n", " .bk-root .bk-tooltip.bk-right.bk-tooltip-arrow::after {\n", " position: absolute;\n", " margin: -7px 0 0 0;\n", " top: 50%;\n", " width: 0;\n", " height: 0;\n", " border-style: solid;\n", " border-width: 7px 0 7px 0;\n", " border-color: transparent;\n", " content: \" \";\n", " display: block;\n", " right: -10px;\n", " border-left-width: 10px;\n", " border-left-color: #909599;\n", " }\n", " .bk-root .bk-tooltip.bk-right::after {\n", " right: -10px;\n", " border-left-width: 10px;\n", " border-left-color: #909599;\n", " }\n", " .bk-root .bk-tooltip.bk-above::before {\n", " position: absolute;\n", " margin: 0 0 0 -7px;\n", " left: 50%;\n", " width: 0;\n", " height: 0;\n", " border-style: solid;\n", " border-width: 0 7px 0 7px;\n", " border-color: transparent;\n", " content: \" \";\n", " display: block;\n", " top: -10px;\n", " border-bottom-width: 10px;\n", " border-bottom-color: #909599;\n", " }\n", " .bk-root .bk-tooltip.bk-below::after {\n", " position: absolute;\n", " margin: 0 0 0 -7px;\n", " left: 50%;\n", " width: 0;\n", " height: 0;\n", " border-style: solid;\n", " border-width: 0 7px 0 7px;\n", " border-color: transparent;\n", " content: \" \";\n", " display: block;\n", " bottom: -10px;\n", " border-top-width: 10px;\n", " border-top-color: #909599;\n", " }\n", " .bk-root .bk-tooltip-row-label {\n", " text-align: right;\n", " color: #26aae1;\n", " /* blue from toolbar highlighting */\n", " }\n", " .bk-root .bk-tooltip-row-value {\n", " color: default;\n", " /* seems to be necessary for notebook */\n", " }\n", " .bk-root .bk-tooltip-color-block {\n", " width: 12px;\n", " height: 12px;\n", " margin-left: 5px;\n", " margin-right: 5px;\n", " outline: #dddddd solid 1px;\n", " display: inline-block;\n", " }\n", " `;\n", " exports.default = css;\n", " },\n", " /* models/annotations/whisker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const annotation_1 = require(31) /* ./annotation */;\n", " const column_data_source_1 = require(76) /* ../sources/column_data_source */;\n", " const arrow_head_1 = require(75) /* ./arrow_head */;\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class WhiskerView extends annotation_1.AnnotationView {\n", " initialize() {\n", " super.initialize();\n", " this.set_data(this.model.source);\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.source.streaming, () => this.set_data(this.model.source));\n", " this.connect(this.model.source.patching, () => this.set_data(this.model.source));\n", " this.connect(this.model.source.change, () => this.set_data(this.model.source));\n", " }\n", " set_data(source) {\n", " super.set_data(source);\n", " this.visuals.warm_cache(source);\n", " this.plot_view.request_render();\n", " }\n", " _map_data() {\n", " const { frame } = this.plot_view;\n", " const dim = this.model.dimension;\n", " const xscale = frame.xscales[this.model.x_range_name];\n", " const yscale = frame.yscales[this.model.y_range_name];\n", " const limit_scale = dim == \"height\" ? yscale : xscale;\n", " const base_scale = dim == \"height\" ? xscale : yscale;\n", " const limit_view = dim == \"height\" ? frame.yview : frame.xview;\n", " const base_view = dim == \"height\" ? frame.xview : frame.yview;\n", " let _lower_sx;\n", " if (this.model.properties.lower.units == \"data\")\n", " _lower_sx = limit_scale.v_compute(this._lower);\n", " else\n", " _lower_sx = limit_view.v_compute(this._lower);\n", " let _upper_sx;\n", " if (this.model.properties.upper.units == \"data\")\n", " _upper_sx = limit_scale.v_compute(this._upper);\n", " else\n", " _upper_sx = limit_view.v_compute(this._upper);\n", " let _base_sx;\n", " if (this.model.properties.base.units == \"data\")\n", " _base_sx = base_scale.v_compute(this._base);\n", " else\n", " _base_sx = base_view.v_compute(this._base);\n", " const [i, j] = dim == 'height' ? [1, 0] : [0, 1];\n", " const _lower = [_lower_sx, _base_sx];\n", " const _upper = [_upper_sx, _base_sx];\n", " this._lower_sx = _lower[i];\n", " this._lower_sy = _lower[j];\n", " this._upper_sx = _upper[i];\n", " this._upper_sy = _upper[j];\n", " }\n", " render() {\n", " if (!this.model.visible)\n", " return;\n", " this._map_data();\n", " const { ctx } = this.layer;\n", " if (this.visuals.line.doit) {\n", " for (let i = 0, end = this._lower_sx.length; i < end; i++) {\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.beginPath();\n", " ctx.moveTo(this._lower_sx[i], this._lower_sy[i]);\n", " ctx.lineTo(this._upper_sx[i], this._upper_sy[i]);\n", " ctx.stroke();\n", " }\n", " }\n", " const angle = this.model.dimension == \"height\" ? 0 : Math.PI / 2;\n", " if (this.model.lower_head != null) {\n", " for (let i = 0, end = this._lower_sx.length; i < end; i++) {\n", " ctx.save();\n", " ctx.translate(this._lower_sx[i], this._lower_sy[i]);\n", " ctx.rotate(angle + Math.PI);\n", " this.model.lower_head.render(ctx, i);\n", " ctx.restore();\n", " }\n", " }\n", " if (this.model.upper_head != null) {\n", " for (let i = 0, end = this._upper_sx.length; i < end; i++) {\n", " ctx.save();\n", " ctx.translate(this._upper_sx[i], this._upper_sy[i]);\n", " ctx.rotate(angle);\n", " this.model.upper_head.render(ctx, i);\n", " ctx.restore();\n", " }\n", " }\n", " }\n", " }\n", " exports.WhiskerView = WhiskerView;\n", " WhiskerView.__name__ = \"WhiskerView\";\n", " class Whisker extends annotation_1.Annotation {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Whisker() {\n", " this.prototype.default_view = WhiskerView;\n", " this.mixins(property_mixins_1.LineVector);\n", " this.define({\n", " lower: [p.DistanceSpec],\n", " lower_head: [p.Instance, () => new arrow_head_1.TeeHead({ level: \"underlay\", size: 10 })],\n", " upper: [p.DistanceSpec],\n", " upper_head: [p.Instance, () => new arrow_head_1.TeeHead({ level: \"underlay\", size: 10 })],\n", " base: [p.DistanceSpec],\n", " dimension: [p.Dimension, 'height'],\n", " source: [p.Instance, () => new column_data_source_1.ColumnDataSource()],\n", " x_range_name: [p.String, 'default'],\n", " y_range_name: [p.String, 'default'],\n", " });\n", " this.override({\n", " level: 'underlay',\n", " });\n", " }\n", " }\n", " exports.Whisker = Whisker;\n", " Whisker.__name__ = \"Whisker\";\n", " Whisker.init_Whisker();\n", " },\n", " /* models/axes/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var axis_1 = require(150) /* ./axis */;\n", " exports.Axis = axis_1.Axis;\n", " var categorical_axis_1 = require(152) /* ./categorical_axis */;\n", " exports.CategoricalAxis = categorical_axis_1.CategoricalAxis;\n", " var continuous_axis_1 = require(155) /* ./continuous_axis */;\n", " exports.ContinuousAxis = continuous_axis_1.ContinuousAxis;\n", " var datetime_axis_1 = require(156) /* ./datetime_axis */;\n", " exports.DatetimeAxis = datetime_axis_1.DatetimeAxis;\n", " var linear_axis_1 = require(157) /* ./linear_axis */;\n", " exports.LinearAxis = linear_axis_1.LinearAxis;\n", " var log_axis_1 = require(170) /* ./log_axis */;\n", " exports.LogAxis = log_axis_1.LogAxis;\n", " var mercator_axis_1 = require(173) /* ./mercator_axis */;\n", " exports.MercatorAxis = mercator_axis_1.MercatorAxis;\n", " },\n", " /* models/axes/axis.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const guide_renderer_1 = require(151) /* ../renderers/guide_renderer */;\n", " const mixins = tslib_1.__importStar(require(23) /* ../../core/property_mixins */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const factor_range_1 = require(90) /* ../ranges/factor_range */;\n", " const { abs, min, max } = Math;\n", " class AxisView extends guide_renderer_1.GuideRendererView {\n", " constructor() {\n", " super(...arguments);\n", " this.rotate = true;\n", " }\n", " get panel() {\n", " return this.layout;\n", " }\n", " render() {\n", " if (!this.model.visible)\n", " return;\n", " const extents = {\n", " tick: this._tick_extent(),\n", " tick_label: this._tick_label_extents(),\n", " axis_label: this._axis_label_extent(),\n", " };\n", " const tick_coords = this.tick_coords;\n", " const ctx = this.layer.ctx;\n", " ctx.save();\n", " this._draw_rule(ctx, extents);\n", " this._draw_major_ticks(ctx, extents, tick_coords);\n", " this._draw_minor_ticks(ctx, extents, tick_coords);\n", " this._draw_major_labels(ctx, extents, tick_coords);\n", " this._draw_axis_label(ctx, extents, tick_coords);\n", " if (this._render != null)\n", " this._render(ctx, extents, tick_coords);\n", " ctx.restore();\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.change, () => this.plot_view.request_paint());\n", " const p = this.model.properties;\n", " this.on_change(p.visible, () => this.plot_view.request_layout());\n", " }\n", " get_size() {\n", " if (this.model.visible && this.model.fixed_location == null) {\n", " const size = this._get_size();\n", " return { width: 0 /* max */, height: Math.round(size) };\n", " }\n", " else\n", " return { width: 0, height: 0 };\n", " }\n", " _get_size() {\n", " return this._tick_extent() + this._tick_label_extent() + this._axis_label_extent();\n", " }\n", " get needs_clip() {\n", " return this.model.fixed_location != null;\n", " }\n", " // drawing sub functions -----------------------------------------------------\n", " _draw_rule(ctx, _extents) {\n", " if (!this.visuals.axis_line.doit)\n", " return;\n", " const [xs, ys] = this.rule_coords;\n", " const [sxs, sys] = this.plot_view.map_to_screen(xs, ys, this.model.x_range_name, this.model.y_range_name);\n", " const [nx, ny] = this.normals;\n", " const [xoff, yoff] = this.offsets;\n", " this.visuals.axis_line.set_value(ctx);\n", " ctx.beginPath();\n", " ctx.moveTo(Math.round(sxs[0] + nx * xoff), Math.round(sys[0] + ny * yoff));\n", " for (let i = 1; i < sxs.length; i++) {\n", " const sx = Math.round(sxs[i] + nx * xoff);\n", " const sy = Math.round(sys[i] + ny * yoff);\n", " ctx.lineTo(sx, sy);\n", " }\n", " ctx.stroke();\n", " }\n", " _draw_major_ticks(ctx, _extents, tick_coords) {\n", " const tin = this.model.major_tick_in;\n", " const tout = this.model.major_tick_out;\n", " const visuals = this.visuals.major_tick_line;\n", " this._draw_ticks(ctx, tick_coords.major, tin, tout, visuals);\n", " }\n", " _draw_minor_ticks(ctx, _extents, tick_coords) {\n", " const tin = this.model.minor_tick_in;\n", " const tout = this.model.minor_tick_out;\n", " const visuals = this.visuals.minor_tick_line;\n", " this._draw_ticks(ctx, tick_coords.minor, tin, tout, visuals);\n", " }\n", " _draw_major_labels(ctx, extents, tick_coords) {\n", " const coords = tick_coords.major;\n", " const labels = this.compute_labels(coords[this.dimension]);\n", " const orient = this.model.major_label_orientation;\n", " const standoff = extents.tick + this.model.major_label_standoff;\n", " const visuals = this.visuals.major_label_text;\n", " this._draw_oriented_labels(ctx, labels, coords, orient, this.panel.side, standoff, visuals);\n", " }\n", " _draw_axis_label(ctx, extents, _tick_coords) {\n", " if (this.model.axis_label == null || this.model.axis_label.length == 0 || this.model.fixed_location != null)\n", " return;\n", " let sx;\n", " let sy;\n", " switch (this.panel.side) {\n", " case \"above\":\n", " sx = this.panel._hcenter.value;\n", " sy = this.panel._bottom.value;\n", " break;\n", " case \"below\":\n", " sx = this.panel._hcenter.value;\n", " sy = this.panel._top.value;\n", " break;\n", " case \"left\":\n", " sx = this.panel._right.value;\n", " sy = this.panel._vcenter.value;\n", " break;\n", " case \"right\":\n", " sx = this.panel._left.value;\n", " sy = this.panel._vcenter.value;\n", " break;\n", " default:\n", " throw new Error(`unknown side: ${this.panel.side}`);\n", " }\n", " const coords = [[sx], [sy]];\n", " const standoff = extents.tick + array_1.sum(extents.tick_label) + this.model.axis_label_standoff;\n", " const visuals = this.visuals.axis_label_text;\n", " this._draw_oriented_labels(ctx, [this.model.axis_label], coords, 'parallel', this.panel.side, standoff, visuals, \"screen\");\n", " }\n", " _draw_ticks(ctx, coords, tin, tout, visuals) {\n", " if (!visuals.doit)\n", " return;\n", " const [x, y] = coords;\n", " const [sxs, sys] = this.plot_view.map_to_screen(x, y, this.model.x_range_name, this.model.y_range_name);\n", " const [nx, ny] = this.normals;\n", " const [xoff, yoff] = this.offsets;\n", " const [nxin, nyin] = [nx * (xoff - tin), ny * (yoff - tin)];\n", " const [nxout, nyout] = [nx * (xoff + tout), ny * (yoff + tout)];\n", " visuals.set_value(ctx);\n", " for (let i = 0; i < sxs.length; i++) {\n", " const sx0 = Math.round(sxs[i] + nxout);\n", " const sy0 = Math.round(sys[i] + nyout);\n", " const sx1 = Math.round(sxs[i] + nxin);\n", " const sy1 = Math.round(sys[i] + nyin);\n", " ctx.beginPath();\n", " ctx.moveTo(sx0, sy0);\n", " ctx.lineTo(sx1, sy1);\n", " ctx.stroke();\n", " }\n", " }\n", " _draw_oriented_labels(ctx, labels, coords, orient, _side, standoff, visuals, units = \"data\") {\n", " if (!visuals.doit || labels.length == 0)\n", " return;\n", " let sxs, sys;\n", " let xoff, yoff;\n", " if (units == \"screen\") {\n", " [sxs, sys] = coords;\n", " [xoff, yoff] = [0, 0];\n", " }\n", " else {\n", " const [dxs, dys] = coords;\n", " [sxs, sys] = this.plot_view.map_to_screen(dxs, dys, this.model.x_range_name, this.model.y_range_name);\n", " [xoff, yoff] = this.offsets;\n", " }\n", " const [nx, ny] = this.normals;\n", " const nxd = nx * (xoff + standoff);\n", " const nyd = ny * (yoff + standoff);\n", " visuals.set_value(ctx);\n", " this.panel.apply_label_text_heuristics(ctx, orient);\n", " let angle;\n", " if (types_1.isString(orient))\n", " angle = this.panel.get_label_angle_heuristic(orient);\n", " else\n", " angle = -orient;\n", " for (let i = 0; i < sxs.length; i++) {\n", " const sx = Math.round(sxs[i] + nxd);\n", " const sy = Math.round(sys[i] + nyd);\n", " ctx.translate(sx, sy);\n", " ctx.rotate(angle);\n", " ctx.fillText(labels[i], 0, 0);\n", " ctx.rotate(-angle);\n", " ctx.translate(-sx, -sy);\n", " }\n", " }\n", " // extents sub functions -----------------------------------------------------\n", " /*protected*/ _axis_label_extent() {\n", " if (this.model.axis_label == null || this.model.axis_label == \"\")\n", " return 0;\n", " const standoff = this.model.axis_label_standoff;\n", " const visuals = this.visuals.axis_label_text;\n", " return this._oriented_labels_extent([this.model.axis_label], \"parallel\", this.panel.side, standoff, visuals);\n", " }\n", " /*protected*/ _tick_extent() {\n", " return this.model.major_tick_out;\n", " }\n", " /*protected*/ _tick_label_extent() {\n", " return array_1.sum(this._tick_label_extents());\n", " }\n", " _tick_label_extents() {\n", " const coords = this.tick_coords.major;\n", " const labels = this.compute_labels(coords[this.dimension]);\n", " const orient = this.model.major_label_orientation;\n", " const standoff = this.model.major_label_standoff;\n", " const visuals = this.visuals.major_label_text;\n", " return [this._oriented_labels_extent(labels, orient, this.panel.side, standoff, visuals)];\n", " }\n", " _oriented_labels_extent(labels, orient, side, standoff, visuals) {\n", " if (labels.length == 0)\n", " return 0;\n", " const ctx = this.layer.ctx;\n", " visuals.set_value(ctx);\n", " let hscale;\n", " let angle;\n", " if (types_1.isString(orient)) {\n", " hscale = 1;\n", " angle = this.panel.get_label_angle_heuristic(orient);\n", " }\n", " else {\n", " hscale = 2;\n", " angle = -orient;\n", " }\n", " angle = Math.abs(angle);\n", " const c = Math.cos(angle);\n", " const s = Math.sin(angle);\n", " let extent = 0;\n", " for (let i = 0; i < labels.length; i++) {\n", " const w = ctx.measureText(labels[i]).width * 1.1;\n", " const h = ctx.measureText(labels[i]).ascent * 0.9;\n", " let val;\n", " if (side == \"above\" || side == \"below\")\n", " val = w * s + (h / hscale) * c;\n", " else\n", " val = w * c + (h / hscale) * s;\n", " // update extent if current value is larger\n", " if (val > extent)\n", " extent = val;\n", " }\n", " // only apply the standoff if we already have non-zero extent\n", " if (extent > 0)\n", " extent += standoff;\n", " return extent;\n", " }\n", " // {{{ TODO: state\n", " get normals() {\n", " return this.panel.normals;\n", " }\n", " get dimension() {\n", " return this.panel.dimension;\n", " }\n", " compute_labels(ticks) {\n", " const labels = this.model.formatter.doFormat(ticks, this);\n", " for (let i = 0; i < ticks.length; i++) {\n", " if (ticks[i] in this.model.major_label_overrides)\n", " labels[i] = this.model.major_label_overrides[ticks[i]];\n", " }\n", " return labels;\n", " }\n", " get offsets() {\n", " // If we have a fixed_position then we should respect that exactly and\n", " // not apply any offsets (https://github.com/bokeh/bokeh/issues/8552)\n", " if (this.model.fixed_location != null)\n", " return [0, 0];\n", " const { frame } = this.plot_view;\n", " let [xoff, yoff] = [0, 0];\n", " switch (this.panel.side) {\n", " case \"below\":\n", " yoff = abs(this.panel._top.value - frame._bottom.value);\n", " break;\n", " case \"above\":\n", " yoff = abs(this.panel._bottom.value - frame._top.value);\n", " break;\n", " case \"right\":\n", " xoff = abs(this.panel._left.value - frame._right.value);\n", " break;\n", " case \"left\":\n", " xoff = abs(this.panel._right.value - frame._left.value);\n", " break;\n", " }\n", " return [xoff, yoff];\n", " }\n", " get ranges() {\n", " const i = this.dimension;\n", " const j = (i + 1) % 2;\n", " const { frame } = this.plot_view;\n", " const ranges = [\n", " frame.x_ranges[this.model.x_range_name],\n", " frame.y_ranges[this.model.y_range_name],\n", " ];\n", " return [ranges[i], ranges[j]];\n", " }\n", " get computed_bounds() {\n", " const [range] = this.ranges;\n", " const user_bounds = this.model.bounds; // XXX: ? 'auto'\n", " const range_bounds = [range.min, range.max];\n", " if (user_bounds == 'auto')\n", " return [range.min, range.max];\n", " else if (types_1.isArray(user_bounds)) {\n", " let start;\n", " let end;\n", " const [user_start, user_end] = user_bounds;\n", " const [range_start, range_end] = range_bounds;\n", " if (abs(user_start - user_end) > abs(range_start - range_end)) {\n", " start = max(min(user_start, user_end), range_start);\n", " end = min(max(user_start, user_end), range_end);\n", " }\n", " else {\n", " start = min(user_start, user_end);\n", " end = max(user_start, user_end);\n", " }\n", " return [start, end];\n", " }\n", " else\n", " throw new Error(`user bounds '${user_bounds}' not understood`);\n", " }\n", " get rule_coords() {\n", " const i = this.dimension;\n", " const j = (i + 1) % 2;\n", " const [range] = this.ranges;\n", " const [start, end] = this.computed_bounds;\n", " const xs = new Array(2);\n", " const ys = new Array(2);\n", " const coords = [xs, ys];\n", " coords[i][0] = Math.max(start, range.min);\n", " coords[i][1] = Math.min(end, range.max);\n", " if (coords[i][0] > coords[i][1])\n", " coords[i][0] = coords[i][1] = NaN;\n", " coords[j][0] = this.loc;\n", " coords[j][1] = this.loc;\n", " return coords;\n", " }\n", " get tick_coords() {\n", " const i = this.dimension;\n", " const j = (i + 1) % 2;\n", " const [range] = this.ranges;\n", " const [start, end] = this.computed_bounds;\n", " const ticks = this.model.ticker.get_ticks(start, end, range, this.loc, {});\n", " const majors = ticks.major;\n", " const minors = ticks.minor;\n", " const xs = [];\n", " const ys = [];\n", " const coords = [xs, ys];\n", " const minor_xs = [];\n", " const minor_ys = [];\n", " const minor_coords = [minor_xs, minor_ys];\n", " const [range_min, range_max] = [range.min, range.max];\n", " for (let ii = 0; ii < majors.length; ii++) {\n", " if (majors[ii] < range_min || majors[ii] > range_max)\n", " continue;\n", " coords[i].push(majors[ii]);\n", " coords[j].push(this.loc);\n", " }\n", " for (let ii = 0; ii < minors.length; ii++) {\n", " if (minors[ii] < range_min || minors[ii] > range_max)\n", " continue;\n", " minor_coords[i].push(minors[ii]);\n", " minor_coords[j].push(this.loc);\n", " }\n", " return {\n", " major: coords,\n", " minor: minor_coords,\n", " };\n", " }\n", " get loc() {\n", " const { fixed_location } = this.model;\n", " if (fixed_location != null) {\n", " if (types_1.isNumber(fixed_location))\n", " return fixed_location;\n", " const [, cross_range] = this.ranges;\n", " if (cross_range instanceof factor_range_1.FactorRange)\n", " return cross_range.synthetic(fixed_location);\n", " throw new Error(\"unexpected\");\n", " }\n", " const [, cross_range] = this.ranges;\n", " switch (this.panel.side) {\n", " case 'left':\n", " case 'below':\n", " return cross_range.start;\n", " case 'right':\n", " case 'above':\n", " return cross_range.end;\n", " }\n", " }\n", " // }}}\n", " serializable_state() {\n", " return Object.assign(Object.assign({}, super.serializable_state()), { bbox: this.layout.bbox.box });\n", " }\n", " }\n", " exports.AxisView = AxisView;\n", " AxisView.__name__ = \"AxisView\";\n", " class Axis extends guide_renderer_1.GuideRenderer {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Axis() {\n", " this.prototype.default_view = AxisView;\n", " this.mixins([\n", " [\"axis_\", mixins.Line],\n", " [\"major_tick_\", mixins.Line],\n", " [\"minor_tick_\", mixins.Line],\n", " [\"major_label_\", mixins.Text],\n", " [\"axis_label_\", mixins.Text],\n", " ]);\n", " this.define({\n", " bounds: [p.Any, 'auto'],\n", " ticker: [p.Instance],\n", " formatter: [p.Instance],\n", " x_range_name: [p.String, 'default'],\n", " y_range_name: [p.String, 'default'],\n", " axis_label: [p.String, ''],\n", " axis_label_standoff: [p.Int, 5],\n", " major_label_standoff: [p.Int, 5],\n", " major_label_orientation: [p.Any, \"horizontal\"],\n", " major_label_overrides: [p.Any, {}],\n", " major_tick_in: [p.Number, 2],\n", " major_tick_out: [p.Number, 6],\n", " minor_tick_in: [p.Number, 0],\n", " minor_tick_out: [p.Number, 4],\n", " fixed_location: [p.Any, null],\n", " });\n", " this.override({\n", " axis_line_color: 'black',\n", " major_tick_line_color: 'black',\n", " minor_tick_line_color: 'black',\n", " major_label_text_font_size: \"11px\",\n", " major_label_text_align: \"center\",\n", " major_label_text_baseline: \"alphabetic\",\n", " axis_label_text_font_size: \"13px\",\n", " axis_label_text_font_style: \"italic\",\n", " });\n", " }\n", " }\n", " exports.Axis = Axis;\n", " Axis.__name__ = \"Axis\";\n", " Axis.init_Axis();\n", " },\n", " /* models/renderers/guide_renderer.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const renderer_1 = require(65) /* ./renderer */;\n", " class GuideRendererView extends renderer_1.RendererView {\n", " }\n", " exports.GuideRendererView = GuideRendererView;\n", " GuideRendererView.__name__ = \"GuideRendererView\";\n", " class GuideRenderer extends renderer_1.Renderer {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_GuideRenderer() {\n", " this.override({\n", " level: \"guide\",\n", " });\n", " }\n", " }\n", " exports.GuideRenderer = GuideRenderer;\n", " GuideRenderer.__name__ = \"GuideRenderer\";\n", " GuideRenderer.init_GuideRenderer();\n", " },\n", " /* models/axes/categorical_axis.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const axis_1 = require(150) /* ./axis */;\n", " const categorical_ticker_1 = require(153) /* ../tickers/categorical_ticker */;\n", " const categorical_tick_formatter_1 = require(154) /* ../formatters/categorical_tick_formatter */;\n", " const mixins = tslib_1.__importStar(require(23) /* ../../core/property_mixins */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class CategoricalAxisView extends axis_1.AxisView {\n", " _render(ctx, extents, tick_coords) {\n", " this._draw_group_separators(ctx, extents, tick_coords);\n", " }\n", " _draw_group_separators(ctx, _extents, _tick_coords) {\n", " const [range] = this.ranges;\n", " const [start, end] = this.computed_bounds;\n", " if (!range.tops || range.tops.length < 2 || !this.visuals.separator_line.doit)\n", " return;\n", " const dim = this.dimension;\n", " const alt = (dim + 1) % 2;\n", " const coords = [[], []];\n", " let ind = 0;\n", " for (let i = 0; i < range.tops.length - 1; i++) {\n", " let first, last;\n", " for (let j = ind; j < range.factors.length; j++) {\n", " if (range.factors[j][0] == range.tops[i + 1]) {\n", " [first, last] = [range.factors[j - 1], range.factors[j]];\n", " ind = j;\n", " break;\n", " }\n", " }\n", " const pt = (range.synthetic(first) + range.synthetic(last)) / 2;\n", " if (pt > start && pt < end) {\n", " coords[dim].push(pt);\n", " coords[alt].push(this.loc);\n", " }\n", " }\n", " const tex = this._tick_label_extent();\n", " this._draw_ticks(ctx, coords, -3, (tex - 6), this.visuals.separator_line);\n", " }\n", " _draw_major_labels(ctx, extents, _tick_coords) {\n", " const info = this._get_factor_info();\n", " let standoff = extents.tick + this.model.major_label_standoff;\n", " for (let i = 0; i < info.length; i++) {\n", " const [labels, coords, orient, visuals] = info[i];\n", " this._draw_oriented_labels(ctx, labels, coords, orient, this.panel.side, standoff, visuals);\n", " standoff += extents.tick_label[i];\n", " }\n", " }\n", " _tick_label_extents() {\n", " const info = this._get_factor_info();\n", " const extents = [];\n", " for (const [labels, , orient, visuals] of info) {\n", " const extent = this._oriented_labels_extent(labels, orient, this.panel.side, this.model.major_label_standoff, visuals);\n", " extents.push(extent);\n", " }\n", " return extents;\n", " }\n", " _get_factor_info() {\n", " const [range] = this.ranges;\n", " const [start, end] = this.computed_bounds;\n", " const loc = this.loc;\n", " const ticks = this.model.ticker.get_ticks(start, end, range, loc, {});\n", " const coords = this.tick_coords;\n", " const info = [];\n", " if (range.levels == 1) {\n", " const major = ticks.major;\n", " const labels = this.model.formatter.doFormat(major, this);\n", " info.push([labels, coords.major, this.model.major_label_orientation, this.visuals.major_label_text]);\n", " }\n", " else if (range.levels == 2) {\n", " const major = ticks.major.map((x) => x[1]);\n", " const labels = this.model.formatter.doFormat(major, this);\n", " info.push([labels, coords.major, this.model.major_label_orientation, this.visuals.major_label_text]);\n", " info.push([ticks.tops, coords.tops, this.model.group_label_orientation, this.visuals.group_text]);\n", " }\n", " else if (range.levels == 3) {\n", " const major = ticks.major.map((x) => x[2]);\n", " const labels = this.model.formatter.doFormat(major, this);\n", " const mid_labels = ticks.mids.map((x) => x[1]);\n", " info.push([labels, coords.major, this.model.major_label_orientation, this.visuals.major_label_text]);\n", " info.push([mid_labels, coords.mids, this.model.subgroup_label_orientation, this.visuals.subgroup_text]);\n", " info.push([ticks.tops, coords.tops, this.model.group_label_orientation, this.visuals.group_text]);\n", " }\n", " return info;\n", " }\n", " // {{{ TODO: state\n", " get tick_coords() {\n", " const i = this.dimension;\n", " const j = (i + 1) % 2;\n", " const [range] = this.ranges;\n", " const [start, end] = this.computed_bounds;\n", " const ticks = this.model.ticker.get_ticks(start, end, range, this.loc, {});\n", " const coords = {\n", " major: [[], []],\n", " mids: [[], []],\n", " tops: [[], []],\n", " minor: [[], []],\n", " };\n", " coords.major[i] = ticks.major;\n", " coords.major[j] = ticks.major.map((_x) => this.loc);\n", " if (range.levels == 3) {\n", " coords.mids[i] = ticks.mids;\n", " coords.mids[j] = ticks.mids.map((_x) => this.loc);\n", " }\n", " if (range.levels > 1) {\n", " coords.tops[i] = ticks.tops;\n", " coords.tops[j] = ticks.tops.map((_x) => this.loc);\n", " }\n", " return coords;\n", " }\n", " }\n", " exports.CategoricalAxisView = CategoricalAxisView;\n", " CategoricalAxisView.__name__ = \"CategoricalAxisView\";\n", " class CategoricalAxis extends axis_1.Axis {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_CategoricalAxis() {\n", " this.prototype.default_view = CategoricalAxisView;\n", " this.mixins([\n", " [\"separator_\", mixins.Line],\n", " [\"group_\", mixins.Text],\n", " [\"subgroup_\", mixins.Text],\n", " ]);\n", " this.define({\n", " group_label_orientation: [p.Any, \"parallel\"],\n", " subgroup_label_orientation: [p.Any, \"parallel\"],\n", " });\n", " this.override({\n", " ticker: () => new categorical_ticker_1.CategoricalTicker(),\n", " formatter: () => new categorical_tick_formatter_1.CategoricalTickFormatter(),\n", " separator_line_color: \"lightgrey\",\n", " separator_line_width: 2,\n", " group_text_font_style: \"bold\",\n", " group_text_font_size: \"11px\",\n", " group_text_color: \"grey\",\n", " subgroup_text_font_style: \"bold\",\n", " subgroup_text_font_size: \"11px\",\n", " });\n", " }\n", " }\n", " exports.CategoricalAxis = CategoricalAxis;\n", " CategoricalAxis.__name__ = \"CategoricalAxis\";\n", " CategoricalAxis.init_CategoricalAxis();\n", " },\n", " /* models/tickers/categorical_ticker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const ticker_1 = require(112) /* ./ticker */;\n", " class CategoricalTicker extends ticker_1.Ticker {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " get_ticks(start, end, range, _cross_loc, _) {\n", " const majors = this._collect(range.factors, range, start, end);\n", " const tops = this._collect(range.tops || [], range, start, end);\n", " const mids = this._collect(range.mids || [], range, start, end);\n", " return {\n", " major: majors,\n", " minor: [],\n", " tops,\n", " mids,\n", " };\n", " }\n", " _collect(factors, range, start, end) {\n", " const result = [];\n", " for (const factor of factors) {\n", " const coord = range.synthetic(factor);\n", " if (coord > start && coord < end)\n", " result.push(factor);\n", " }\n", " return result;\n", " }\n", " }\n", " exports.CategoricalTicker = CategoricalTicker;\n", " CategoricalTicker.__name__ = \"CategoricalTicker\";\n", " },\n", " /* models/formatters/categorical_tick_formatter.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tick_formatter_1 = require(114) /* ./tick_formatter */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " class CategoricalTickFormatter extends tick_formatter_1.TickFormatter {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " doFormat(ticks, _opts) {\n", " return array_1.copy(ticks);\n", " }\n", " }\n", " exports.CategoricalTickFormatter = CategoricalTickFormatter;\n", " CategoricalTickFormatter.__name__ = \"CategoricalTickFormatter\";\n", " },\n", " /* models/axes/continuous_axis.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const axis_1 = require(150) /* ./axis */;\n", " class ContinuousAxis extends axis_1.Axis {\n", " // TODO: __view_type__: ContinuousAxisView\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " }\n", " exports.ContinuousAxis = ContinuousAxis;\n", " ContinuousAxis.__name__ = \"ContinuousAxis\";\n", " },\n", " /* models/axes/datetime_axis.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const linear_axis_1 = require(157) /* ./linear_axis */;\n", " const datetime_tick_formatter_1 = require(158) /* ../formatters/datetime_tick_formatter */;\n", " const datetime_ticker_1 = require(163) /* ../tickers/datetime_ticker */;\n", " class DatetimeAxisView extends linear_axis_1.LinearAxisView {\n", " }\n", " exports.DatetimeAxisView = DatetimeAxisView;\n", " DatetimeAxisView.__name__ = \"DatetimeAxisView\";\n", " class DatetimeAxis extends linear_axis_1.LinearAxis {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_DatetimeAxis() {\n", " this.prototype.default_view = DatetimeAxisView;\n", " this.override({\n", " ticker: () => new datetime_ticker_1.DatetimeTicker(),\n", " formatter: () => new datetime_tick_formatter_1.DatetimeTickFormatter(),\n", " });\n", " }\n", " }\n", " exports.DatetimeAxis = DatetimeAxis;\n", " DatetimeAxis.__name__ = \"DatetimeAxis\";\n", " DatetimeAxis.init_DatetimeAxis();\n", " },\n", " /* models/axes/linear_axis.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const axis_1 = require(150) /* ./axis */;\n", " const continuous_axis_1 = require(155) /* ./continuous_axis */;\n", " const basic_tick_formatter_1 = require(113) /* ../formatters/basic_tick_formatter */;\n", " const basic_ticker_1 = require(109) /* ../tickers/basic_ticker */;\n", " class LinearAxisView extends axis_1.AxisView {\n", " }\n", " exports.LinearAxisView = LinearAxisView;\n", " LinearAxisView.__name__ = \"LinearAxisView\";\n", " class LinearAxis extends continuous_axis_1.ContinuousAxis {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_LinearAxis() {\n", " this.prototype.default_view = LinearAxisView;\n", " this.override({\n", " ticker: () => new basic_ticker_1.BasicTicker(),\n", " formatter: () => new basic_tick_formatter_1.BasicTickFormatter(),\n", " });\n", " }\n", " }\n", " exports.LinearAxis = LinearAxis;\n", " LinearAxis.__name__ = \"LinearAxis\";\n", " LinearAxis.init_LinearAxis();\n", " },\n", " /* models/formatters/datetime_tick_formatter.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const timezone_1 = tslib_1.__importDefault(require(159) /* timezone */);\n", " const tick_formatter_1 = require(114) /* ./tick_formatter */;\n", " const logging_1 = require(72) /* ../../core/logging */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const templating_1 = require(160) /* ../../core/util/templating */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " function _us(t) {\n", " // From double-precision unix (millisecond) timestamp get\n", " // microsecond since last second. Precision seems to run\n", " // out around the hundreds of nanoseconds scale, so rounding\n", " // to the nearest microsecond should round to a nice\n", " // microsecond / millisecond tick.\n", " return Math.round(((t / 1000) % 1) * 1000000);\n", " }\n", " function _array(t) {\n", " return timezone_1.default(t, \"%Y %m %d %H %M %S\").split(/\\s+/).map(e => parseInt(e, 10));\n", " }\n", " function _strftime(t, format) {\n", " if (types_1.isFunction(format)) {\n", " return format(t);\n", " }\n", " else {\n", " // Python's datetime library augments the microsecond directive %f, which is not\n", " // supported by the javascript library timezone: http://bigeasy.github.io/timezone/.\n", " // Use a regular expression to replace %f directive with microseconds.\n", " // TODO: what should we do for negative microsecond strings?\n", " const microsecond_replacement_string = templating_1.sprintf(\"$1%06d\", _us(t));\n", " format = format.replace(/((^|[^%])(%%)*)%f/, microsecond_replacement_string);\n", " if (format.indexOf(\"%\") == -1) {\n", " // timezone seems to ignore any strings without any formatting directives,\n", " // and just return the time argument back instead of the string argument.\n", " // But we want the string argument, in case a user supplies a format string\n", " // which doesn't contain a formatting directive or is only using %f.\n", " return format;\n", " }\n", " return timezone_1.default(t, format);\n", " }\n", " }\n", " // Labels of time units, from finest to coarsest.\n", " const format_order = [\n", " 'microseconds', 'milliseconds', 'seconds', 'minsec', 'minutes', 'hourmin', 'hours', 'days', 'months', 'years',\n", " ];\n", " class DatetimeTickFormatter extends tick_formatter_1.TickFormatter {\n", " constructor(attrs) {\n", " super(attrs);\n", " // Whether or not to strip the leading zeros on tick labels.\n", " this.strip_leading_zeros = true;\n", " }\n", " static init_DatetimeTickFormatter() {\n", " this.define({\n", " microseconds: [p.Array, ['%fus']],\n", " milliseconds: [p.Array, ['%3Nms', '%S.%3Ns']],\n", " seconds: [p.Array, ['%Ss']],\n", " minsec: [p.Array, [':%M:%S']],\n", " minutes: [p.Array, [':%M', '%Mm']],\n", " hourmin: [p.Array, ['%H:%M']],\n", " hours: [p.Array, ['%Hh', '%H:%M']],\n", " days: [p.Array, ['%m/%d', '%a%d']],\n", " months: [p.Array, ['%m/%Y', '%b %Y']],\n", " years: [p.Array, ['%Y']],\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " // TODO (bev) trigger update on format change\n", " this._update_width_formats();\n", " }\n", " _update_width_formats() {\n", " const now = +timezone_1.default(new Date());\n", " const _widths = function (fmt_strings) {\n", " const sizes = fmt_strings.map((fmt_string) => _strftime(now, fmt_string).length);\n", " const sorted = array_1.sort_by(array_1.zip(sizes, fmt_strings), ([size]) => size);\n", " return array_1.unzip(sorted);\n", " };\n", " this._width_formats = {\n", " microseconds: _widths(this.microseconds),\n", " milliseconds: _widths(this.milliseconds),\n", " seconds: _widths(this.seconds),\n", " minsec: _widths(this.minsec),\n", " minutes: _widths(this.minutes),\n", " hourmin: _widths(this.hourmin),\n", " hours: _widths(this.hours),\n", " days: _widths(this.days),\n", " months: _widths(this.months),\n", " years: _widths(this.years),\n", " };\n", " }\n", " // FIXME There is some unfortunate flicker when panning/zooming near the\n", " // span boundaries.\n", " // FIXME Rounding is weird at the 20-us scale and below.\n", " _get_resolution_str(resolution_secs, span_secs) {\n", " // Our resolution boundaries should not be round numbers, because we want\n", " // them to fall between the possible tick intervals (which *are* round\n", " // numbers, as we've worked hard to ensure). Consequently, we adjust the\n", " // resolution upwards a small amount (less than any possible step in\n", " // scales) to make the effective boundaries slightly lower.\n", " const adjusted_secs = resolution_secs * 1.1;\n", " switch (false) {\n", " case !(adjusted_secs < 1e-3): return \"microseconds\";\n", " case !(adjusted_secs < 1.0): return \"milliseconds\";\n", " case !(adjusted_secs < 60): return span_secs >= 60 ? \"minsec\" : \"seconds\";\n", " case !(adjusted_secs < 3600): return span_secs >= 3600 ? \"hourmin\" : \"minutes\";\n", " case !(adjusted_secs < (24 * 3600)): return \"hours\";\n", " case !(adjusted_secs < (31 * 24 * 3600)): return \"days\";\n", " case !(adjusted_secs < (365 * 24 * 3600)): return \"months\";\n", " default: return \"years\";\n", " }\n", " }\n", " doFormat(ticks, _opts) {\n", " // In order to pick the right set of labels, we need to determine\n", " // the resolution of the ticks. We can do this using a ticker if\n", " // it's provided, or by computing the resolution from the actual\n", " // ticks we've been given.\n", " if (ticks.length == 0)\n", " return [];\n", " const span = Math.abs(ticks[ticks.length - 1] - ticks[0]) / 1000.0;\n", " const r = span / (ticks.length - 1);\n", " const resol = this._get_resolution_str(r, span);\n", " const [, [format]] = this._width_formats[resol];\n", " // Apply the format to the tick values\n", " const labels = [];\n", " const resol_ndx = format_order.indexOf(resol);\n", " // This dictionary maps the name of a time resolution (in @format_order)\n", " // to its index in a time.localtime() timetuple. The default is to map\n", " // everything to index 0, which is year. This is not ideal; it might cause\n", " // a problem with the tick at midnight, january 1st, 0 a.d. being incorrectly\n", " // promoted at certain tick resolutions.\n", " const time_tuple_ndx_for_resol = {};\n", " for (const fmt of format_order) {\n", " time_tuple_ndx_for_resol[fmt] = 0;\n", " }\n", " time_tuple_ndx_for_resol.seconds = 5;\n", " time_tuple_ndx_for_resol.minsec = 4;\n", " time_tuple_ndx_for_resol.minutes = 4;\n", " time_tuple_ndx_for_resol.hourmin = 3;\n", " time_tuple_ndx_for_resol.hours = 3;\n", " // As we format each tick, check to see if we are at a boundary of the\n", " // next higher unit of time. If so, replace the current format with one\n", " // from that resolution. This is not the best heuristic in the world,\n", " // but it works! There is some trickiness here due to having to deal\n", " // with hybrid formats in a reasonable manner.\n", " for (const t of ticks) {\n", " let s, tm;\n", " try {\n", " tm = _array(t);\n", " s = _strftime(t, format);\n", " }\n", " catch (error) {\n", " logging_1.logger.warn(`unable to format tick for timestamp value ${t}`);\n", " logging_1.logger.warn(` - ${error}`);\n", " labels.push(\"ERR\");\n", " continue;\n", " }\n", " let hybrid_handled = false;\n", " let next_ndx = resol_ndx;\n", " // The way to check that we are at the boundary of the next unit of\n", " // time is by checking that we have 0 units of the resolution, i.e.\n", " // we are at zero minutes, so display hours, or we are at zero seconds,\n", " // so display minutes (and if that is zero as well, then display hours).\n", " while (tm[time_tuple_ndx_for_resol[format_order[next_ndx]]] == 0) {\n", " let next_format;\n", " next_ndx += 1;\n", " if (next_ndx == format_order.length)\n", " break;\n", " if ((resol == \"minsec\" || resol == \"hourmin\") && !hybrid_handled) {\n", " if ((resol == \"minsec\" && tm[4] == 0 && tm[5] != 0) || (resol == \"hourmin\" && tm[3] == 0 && tm[4] != 0)) {\n", " next_format = this._width_formats[format_order[resol_ndx - 1]][1][0];\n", " s = _strftime(t, next_format);\n", " break;\n", " }\n", " else {\n", " hybrid_handled = true;\n", " }\n", " }\n", " next_format = this._width_formats[format_order[next_ndx]][1][0];\n", " s = _strftime(t, next_format);\n", " }\n", " // TODO: should expose this in api. %H, %d, etc use leading zeros and\n", " // users might prefer to see them lined up correctly.\n", " if (this.strip_leading_zeros) {\n", " let ss = s.replace(/^0+/g, \"\");\n", " if (ss != s && isNaN(parseInt(ss))) {\n", " // If the string can now be parsed as starting with an integer, then\n", " // leave all zeros stripped, otherwise start with a zero. Hence:\n", " // A label such as '000ms' should leave one zero.\n", " // A label such as '001ms' or '0-1ms' should not leave a leading zero.\n", " ss = `0${ss}`;\n", " }\n", " labels.push(ss);\n", " }\n", " else\n", " labels.push(s);\n", " }\n", " return labels;\n", " }\n", " }\n", " exports.DatetimeTickFormatter = DatetimeTickFormatter;\n", " DatetimeTickFormatter.__name__ = \"DatetimeTickFormatter\";\n", " DatetimeTickFormatter.init_DatetimeTickFormatter();\n", " },\n", " /* timezone/index.js */ function _(require, module, exports) {\n", " !function (definition) {\n", " if (typeof module == \"object\" && module.exports)\n", " module.exports = definition();\n", " else if (typeof define == \"function\")\n", " define(definition);\n", " else\n", " this.tz = definition();\n", " }(function () {\n", " /*\n", " function die () {\n", " console.log.apply(console, __slice.call(arguments, 0));\n", " return process.exit(1);\n", " }\n", " \n", " function say () { return console.log.apply(console, __slice.call(arguments, 0)) }\n", " */\n", " function actualize(entry, rule, year) {\n", " var actualized, date = rule.day[1];\n", " do {\n", " actualized = new Date(Date.UTC(year, rule.month, Math.abs(date++)));\n", " } while (rule.day[0] < 7 && actualized.getUTCDay() != rule.day[0]);\n", " actualized = {\n", " clock: rule.clock,\n", " sort: actualized.getTime(),\n", " rule: rule,\n", " save: rule.save * 6e4,\n", " offset: entry.offset\n", " };\n", " actualized[actualized.clock] = actualized.sort + rule.time * 6e4;\n", " if (actualized.posix) {\n", " actualized.wallclock = actualized[actualized.clock] + (entry.offset + rule.saved);\n", " }\n", " else {\n", " actualized.posix = actualized[actualized.clock] - (entry.offset + rule.saved);\n", " }\n", " return actualized;\n", " }\n", " function find(request, clock, time) {\n", " var i, I, entry, found, zone = request[request.zone], actualized = [], abbrev, rules, j, year = new Date(time).getUTCFullYear(), off = 1;\n", " for (i = 1, I = zone.length; i < I; i++)\n", " if (zone[i][clock] <= time)\n", " break;\n", " entry = zone[i];\n", " if (entry.rules) {\n", " rules = request[entry.rules];\n", " for (j = year + 1; j >= year - off; --j)\n", " for (i = 0, I = rules.length; i < I; i++)\n", " if (rules[i].from <= j && j <= rules[i].to)\n", " actualized.push(actualize(entry, rules[i], j));\n", " else if (rules[i].to < j && off == 1)\n", " off = j - rules[i].to;\n", " actualized.sort(function (a, b) { return a.sort - b.sort; });\n", " for (i = 0, I = actualized.length; i < I; i++) {\n", " if (time >= actualized[i][clock] && actualized[i][actualized[i].clock] > entry[actualized[i].clock])\n", " found = actualized[i];\n", " }\n", " }\n", " if (found) {\n", " if (abbrev = /^(.*)\\/(.*)$/.exec(entry.format)) {\n", " found.abbrev = abbrev[found.save ? 2 : 1];\n", " }\n", " else {\n", " found.abbrev = entry.format.replace(/%s/, found.rule.letter);\n", " }\n", " }\n", " return found || entry;\n", " }\n", " function convertToWallclock(request, posix) {\n", " if (request.zone == \"UTC\")\n", " return posix;\n", " request.entry = find(request, \"posix\", posix);\n", " return posix + request.entry.offset + request.entry.save;\n", " }\n", " function convertToPOSIX(request, wallclock) {\n", " if (request.zone == \"UTC\")\n", " return wallclock;\n", " var entry, diff;\n", " request.entry = entry = find(request, \"wallclock\", wallclock);\n", " diff = wallclock - entry.wallclock;\n", " return 0 < diff && diff < entry.save ? null : wallclock - entry.offset - entry.save;\n", " }\n", " function adjust(request, posix, match) {\n", " var increment = +(match[1] + 1) // conversion necessary for week day addition\n", " , offset = match[2] * increment, index = UNITS.indexOf(match[3].toLowerCase()), date;\n", " if (index > 9) {\n", " posix += offset * TIME[index - 10];\n", " }\n", " else {\n", " date = new Date(convertToWallclock(request, posix));\n", " if (index < 7) {\n", " while (offset) {\n", " date.setUTCDate(date.getUTCDate() + increment);\n", " if (date.getUTCDay() == index)\n", " offset -= increment;\n", " }\n", " }\n", " else if (index == 7) {\n", " date.setUTCFullYear(date.getUTCFullYear() + offset);\n", " }\n", " else if (index == 8) {\n", " date.setUTCMonth(date.getUTCMonth() + offset);\n", " }\n", " else {\n", " date.setUTCDate(date.getUTCDate() + offset);\n", " }\n", " if ((posix = convertToPOSIX(request, date.getTime())) == null) {\n", " posix = convertToPOSIX(request, date.getTime() + 864e5 * increment) - 864e5 * increment;\n", " }\n", " }\n", " return posix;\n", " }\n", " function convert(vargs) {\n", " if (!vargs.length)\n", " return \"1.0.23\";\n", " var request = Object.create(this), adjustments = [], i, I, $, argument, date;\n", " for (i = 0; i < vargs.length; i++) { // leave the for loop alone, it works.\n", " argument = vargs[i];\n", " // https://twitter.com/bigeasy/status/215112186572439552\n", " if (Array.isArray(argument)) {\n", " if (!i && !isNaN(argument[1])) {\n", " date = argument;\n", " }\n", " else {\n", " argument.splice.apply(vargs, [i--, 1].concat(argument));\n", " }\n", " }\n", " else if (isNaN(argument)) {\n", " $ = typeof argument;\n", " if ($ == \"string\") {\n", " if (~argument.indexOf(\"%\")) {\n", " request.format = argument;\n", " }\n", " else if (!i && argument == \"*\") {\n", " date = argument;\n", " }\n", " else if (!i && ($ = /^(\\d{4})-(\\d{2})-(\\d{2})(?:[T\\s](\\d{2}):(\\d{2})(?::(\\d{2})(?:\\.(\\d+))?)?(Z|(([+-])(\\d{2}(:\\d{2}){0,2})))?)?$/.exec(argument))) {\n", " date = [];\n", " date.push.apply(date, $.slice(1, 8));\n", " if ($[9]) {\n", " date.push($[10] + 1);\n", " date.push.apply(date, $[11].split(/:/));\n", " }\n", " else if ($[8]) {\n", " date.push(1);\n", " }\n", " }\n", " else if (/^\\w{2,3}_\\w{2}$/.test(argument)) {\n", " request.locale = argument;\n", " }\n", " else if ($ = UNIT_RE.exec(argument)) {\n", " adjustments.push($);\n", " }\n", " else {\n", " request.zone = argument;\n", " }\n", " }\n", " else if ($ == \"function\") {\n", " if ($ = argument.call(request))\n", " return $;\n", " }\n", " else if (/^\\w{2,3}_\\w{2}$/.test(argument.name)) {\n", " request[argument.name] = argument;\n", " }\n", " else if (argument.zones) {\n", " for ($ in argument.zones)\n", " request[$] = argument.zones[$];\n", " for ($ in argument.rules)\n", " request[$] = argument.rules[$];\n", " }\n", " }\n", " else if (!i) {\n", " date = argument;\n", " }\n", " }\n", " if (!request[request.locale])\n", " delete request.locale;\n", " if (!request[request.zone])\n", " delete request.zone;\n", " if (date != null) {\n", " if (date == \"*\") {\n", " date = request.clock();\n", " }\n", " else if (Array.isArray(date)) {\n", " $ = [];\n", " I = !date[7];\n", " for (i = 0; i < 11; i++)\n", " $[i] = +(date[i] || 0); // conversion necessary for decrement\n", " --$[1]; // Grr..\n", " date = Date.UTC.apply(Date.UTC, $) + -$[7] * ($[8] * 36e5 + $[9] * 6e4 + $[10] * 1e3);\n", " }\n", " else {\n", " date = Math.floor(date);\n", " }\n", " if (!isNaN(date)) {\n", " if (I)\n", " date = convertToPOSIX(request, date);\n", " if (date == null)\n", " return date;\n", " for (i = 0, I = adjustments.length; i < I; i++) {\n", " date = adjust(request, date, adjustments[i]);\n", " }\n", " if (!request.format)\n", " return date;\n", " $ = new Date(convertToWallclock(request, date));\n", " return request.format.replace(/%([-0_^]?)(:{0,3})(\\d*)(.)/g, function (value, flag, colons, padding, specifier) {\n", " var f, fill = \"0\", pad;\n", " if (f = request[specifier]) {\n", " value = String(f.call(request, $, date, flag, colons.length));\n", " if ((flag || f.style) == \"_\")\n", " fill = \" \";\n", " pad = flag == \"-\" ? 0 : f.pad || 0;\n", " while (value.length < pad)\n", " value = fill + value;\n", " pad = flag == \"-\" ? 0 : padding || f.pad;\n", " while (value.length < pad)\n", " value = fill + value;\n", " if (specifier == \"N\" && pad < value.length)\n", " value = value.slice(0, pad);\n", " if (flag == \"^\")\n", " value = value.toUpperCase();\n", " }\n", " return value;\n", " });\n", " }\n", " }\n", " return function () { return request.convert(arguments); };\n", " }\n", " var context = { clock: function () { return +(new Date()); },\n", " zone: \"UTC\",\n", " entry: { abbrev: \"UTC\", offset: 0, save: 0 },\n", " UTC: 1,\n", " z: function (date, posix, flag, delimiters) {\n", " var offset = this.entry.offset + this.entry.save, seconds = Math.abs(offset / 1000), parts = [], part = 3600, i, z;\n", " for (i = 0; i < 3; i++) {\n", " parts.push((\"0\" + Math.floor(seconds / part)).slice(-2));\n", " seconds %= part;\n", " part /= 60;\n", " }\n", " if (flag == \"^\" && !offset)\n", " return \"Z\";\n", " if (flag == \"^\")\n", " delimiters = 3;\n", " if (delimiters == 3) {\n", " z = parts.join(\":\");\n", " z = z.replace(/:00$/, \"\");\n", " if (flag != \"^\")\n", " z = z.replace(/:00$/, \"\");\n", " }\n", " else if (delimiters) {\n", " z = parts.slice(0, delimiters + 1).join(\":\");\n", " if (flag == \"^\")\n", " z = z.replace(/:00$/, \"\");\n", " }\n", " else {\n", " z = parts.slice(0, 2).join(\"\");\n", " }\n", " z = (offset < 0 ? \"-\" : \"+\") + z;\n", " z = z.replace(/([-+])(0)/, { \"_\": \" $1\", \"-\": \"$1\" }[flag] || \"$1$2\");\n", " return z;\n", " },\n", " \"%\": function (date) { return \"%\"; },\n", " n: function (date) { return \"\\n\"; },\n", " t: function (date) { return \"\\t\"; },\n", " U: function (date) { return weekOfYear(date, 0); },\n", " W: function (date) { return weekOfYear(date, 1); },\n", " V: function (date) { return isoWeek(date)[0]; },\n", " G: function (date) { return isoWeek(date)[1]; },\n", " g: function (date) { return isoWeek(date)[1] % 100; },\n", " j: function (date) { return Math.floor((date.getTime() - Date.UTC(date.getUTCFullYear(), 0)) / 864e5) + 1; },\n", " s: function (date) { return Math.floor(date.getTime() / 1000); },\n", " C: function (date) { return Math.floor(date.getUTCFullYear() / 100); },\n", " N: function (date) { return date.getTime() % 1000 * 1000000; },\n", " m: function (date) { return date.getUTCMonth() + 1; },\n", " Y: function (date) { return date.getUTCFullYear(); },\n", " y: function (date) { return date.getUTCFullYear() % 100; },\n", " H: function (date) { return date.getUTCHours(); },\n", " M: function (date) { return date.getUTCMinutes(); },\n", " S: function (date) { return date.getUTCSeconds(); },\n", " e: function (date) { return date.getUTCDate(); },\n", " d: function (date) { return date.getUTCDate(); },\n", " u: function (date) { return date.getUTCDay() || 7; },\n", " w: function (date) { return date.getUTCDay(); },\n", " l: function (date) { return date.getUTCHours() % 12 || 12; },\n", " I: function (date) { return date.getUTCHours() % 12 || 12; },\n", " k: function (date) { return date.getUTCHours(); },\n", " Z: function (date) { return this.entry.abbrev; },\n", " a: function (date) { return this[this.locale].day.abbrev[date.getUTCDay()]; },\n", " A: function (date) { return this[this.locale].day.full[date.getUTCDay()]; },\n", " h: function (date) { return this[this.locale].month.abbrev[date.getUTCMonth()]; },\n", " b: function (date) { return this[this.locale].month.abbrev[date.getUTCMonth()]; },\n", " B: function (date) { return this[this.locale].month.full[date.getUTCMonth()]; },\n", " P: function (date) { return this[this.locale].meridiem[Math.floor(date.getUTCHours() / 12)].toLowerCase(); },\n", " p: function (date) { return this[this.locale].meridiem[Math.floor(date.getUTCHours() / 12)]; },\n", " R: function (date, posix) { return this.convert([posix, \"%H:%M\"]); },\n", " T: function (date, posix) { return this.convert([posix, \"%H:%M:%S\"]); },\n", " D: function (date, posix) { return this.convert([posix, \"%m/%d/%y\"]); },\n", " F: function (date, posix) { return this.convert([posix, \"%Y-%m-%d\"]); },\n", " x: function (date, posix) { return this.convert([posix, this[this.locale].date]); },\n", " r: function (date, posix) { return this.convert([posix, this[this.locale].time12 || '%I:%M:%S']); },\n", " X: function (date, posix) { return this.convert([posix, this[this.locale].time24]); },\n", " c: function (date, posix) { return this.convert([posix, this[this.locale].dateTime]); },\n", " convert: convert,\n", " locale: \"en_US\",\n", " en_US: {\n", " date: \"%m/%d/%Y\",\n", " time24: \"%I:%M:%S %p\",\n", " time12: \"%I:%M:%S %p\",\n", " dateTime: \"%a %d %b %Y %I:%M:%S %p %Z\",\n", " meridiem: [\"AM\", \"PM\"],\n", " month: {\n", " abbrev: \"Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec\".split(\"|\"),\n", " full: \"January|February|March|April|May|June|July|August|September|October|November|December\".split(\"|\")\n", " },\n", " day: {\n", " abbrev: \"Sun|Mon|Tue|Wed|Thu|Fri|Sat\".split(\"|\"),\n", " full: \"Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday\".split(\"|\")\n", " }\n", " }\n", " };\n", " var UNITS = \"Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|year|month|day|hour|minute|second|millisecond\", UNIT_RE = new RegExp(\"^\\\\s*([+-])(\\\\d+)\\\\s+(\" + UNITS + \")s?\\\\s*$\", \"i\"), TIME = [36e5, 6e4, 1e3, 1];\n", " UNITS = UNITS.toLowerCase().split(\"|\");\n", " \"delmHMSUWVgCIky\".replace(/./g, function (e) { context[e].pad = 2; });\n", " context.N.pad = 9;\n", " context.j.pad = 3;\n", " context.k.style = \"_\";\n", " context.l.style = \"_\";\n", " context.e.style = \"_\";\n", " function weekOfYear(date, startOfWeek) {\n", " var diff, nyd, weekStart;\n", " nyd = new Date(Date.UTC(date.getUTCFullYear(), 0));\n", " diff = Math.floor((date.getTime() - nyd.getTime()) / 864e5);\n", " if (nyd.getUTCDay() == startOfWeek) {\n", " weekStart = 0;\n", " }\n", " else {\n", " weekStart = 7 - nyd.getUTCDay() + startOfWeek;\n", " if (weekStart == 8) {\n", " weekStart = 1;\n", " }\n", " }\n", " return diff >= weekStart ? Math.floor((diff - weekStart) / 7) + 1 : 0;\n", " }\n", " function isoWeek(date) {\n", " var nyd, nyy, week;\n", " nyy = date.getUTCFullYear();\n", " nyd = new Date(Date.UTC(nyy, 0)).getUTCDay();\n", " week = weekOfYear(date, 1) + (nyd > 1 && nyd <= 4 ? 1 : 0);\n", " if (!week) {\n", " nyy = date.getUTCFullYear() - 1;\n", " nyd = new Date(Date.UTC(nyy, 0)).getUTCDay();\n", " week = nyd == 4 || (nyd == 3 && new Date(nyy, 1, 29).getDate() == 29) ? 53 : 52;\n", " return [week, date.getUTCFullYear() - 1];\n", " }\n", " else if (week == 53 && !(nyd == 4 || (nyd == 3 && new Date(nyy, 1, 29).getDate() == 29))) {\n", " return [1, date.getUTCFullYear() + 1];\n", " }\n", " else {\n", " return [week, date.getUTCFullYear()];\n", " }\n", " }\n", " return function () { return context.convert(arguments); };\n", " });\n", " },\n", " /* core/util/templating.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const Numbro = tslib_1.__importStar(require(161) /* @bokeh/numbro */);\n", " const sprintf_js_1 = require(162) /* sprintf-js */;\n", " const timezone_1 = tslib_1.__importDefault(require(159) /* timezone */);\n", " const string_1 = require(24) /* ./string */;\n", " const types_1 = require(8) /* ./types */;\n", " exports.DEFAULT_FORMATTERS = {\n", " numeral: (value, format, _special_vars) => Numbro.format(value, format),\n", " datetime: (value, format, _special_vars) => timezone_1.default(value, format),\n", " printf: (value, format, _special_vars) => sprintf(format, value),\n", " };\n", " function sprintf(format, ...args) {\n", " return sprintf_js_1.sprintf(format, ...args);\n", " }\n", " exports.sprintf = sprintf;\n", " function basic_formatter(value, _format, _special_vars) {\n", " if (types_1.isNumber(value)) {\n", " const format = (() => {\n", " switch (false) {\n", " case Math.floor(value) != value:\n", " return \"%d\";\n", " case !(Math.abs(value) > 0.1) || !(Math.abs(value) < 1000):\n", " return \"%0.3f\";\n", " default:\n", " return \"%0.3e\";\n", " }\n", " })();\n", " return sprintf(format, value);\n", " }\n", " else\n", " return `${value}`; // get strings for categorical types\n", " }\n", " exports.basic_formatter = basic_formatter;\n", " function get_formatter(raw_spec, format, formatters) {\n", " // no format, use default built in formatter\n", " if (format == null)\n", " return basic_formatter;\n", " // format spec in the formatters dict, use that\n", " if (formatters != null && raw_spec in formatters) {\n", " const formatter = formatters[raw_spec];\n", " if (types_1.isString(formatter)) {\n", " if (formatter in exports.DEFAULT_FORMATTERS)\n", " return exports.DEFAULT_FORMATTERS[formatter];\n", " else\n", " throw new Error(`Unknown tooltip field formatter type '${formatter}'`);\n", " }\n", " return function (value, format, special_vars) {\n", " return formatter.format(value, format, special_vars);\n", " };\n", " }\n", " // otherwise use \"numeral\" as default\n", " return exports.DEFAULT_FORMATTERS.numeral;\n", " }\n", " exports.get_formatter = get_formatter;\n", " function _get_special_value(name, special_vars) {\n", " if (name in special_vars)\n", " return special_vars[name];\n", " else\n", " throw new Error(`Unknown special variable '\\$${name}'`);\n", " }\n", " function _get_column_value(name, data_source, i) {\n", " const column = data_source.get_column(name);\n", " // missing column\n", " if (column == null)\n", " return null;\n", " // typical (non-image) index\n", " if (types_1.isNumber(i))\n", " return column[i];\n", " // image index\n", " const data = column[i.index];\n", " if (types_1.isTypedArray(data) || types_1.isArray(data)) {\n", " // inspect array of arrays\n", " if (types_1.isArray(data[0])) {\n", " const row = data[i.dim2];\n", " return row[i.dim1];\n", " }\n", " else\n", " return data[i.flat_index]; // inspect flat array\n", " }\n", " else\n", " return data; // inspect per-image scalar data\n", " }\n", " function get_value(raw_name, data_source, i, special_vars) {\n", " if (raw_name[0] == \"$\") {\n", " const name = raw_name.substring(1);\n", " return _get_special_value(name, special_vars);\n", " }\n", " else {\n", " const name = raw_name.substring(1).replace(/[{}]/g, \"\");\n", " return _get_column_value(name, data_source, i);\n", " }\n", " }\n", " exports.get_value = get_value;\n", " function replace_placeholders(str, data_source, i, formatters, special_vars = {}) {\n", " // this handles the special case @$name, replacing it with an @var corresponding to special_vars.name\n", " str = str.replace(/@\\$name/g, (_match) => `@{${special_vars.name}}`);\n", " //\n", " // (?:\\$\\w+) - special vars: $x\n", " // (?:@\\w+) - simple names: @foo\n", " // (?:@{(?:[^{}]+)})) - full names: @{one two}\n", " //\n", " // (?:{([^{}]+)})? - (optional) format for all of the above: @foo{fmt}\n", " //\n", " str = str.replace(/((?:\\$\\w+)|(?:@\\w+)|(?:@{(?:[^{}]+)}))(?:{([^{}]+)})?/g, (_match, spec, format) => {\n", " const value = get_value(spec, data_source, i, special_vars);\n", " // missing value, return ???\n", " if (value == null)\n", " return `${string_1.escape(\"???\")}`;\n", " // 'safe' format, return the value as-is\n", " if (format == 'safe')\n", " return `${value}`;\n", " // format and escape everything else\n", " const formatter = get_formatter(spec, format, formatters);\n", " return `${string_1.escape(formatter(value, format, special_vars))}`;\n", " });\n", " return str;\n", " }\n", " exports.replace_placeholders = replace_placeholders;\n", " },\n", " /* @bokeh/numbro/numbro.js */ function _(require, module, exports) {\n", " /*!\n", " * numbro.js\n", " * version : 1.6.2\n", " * author : Företagsplatsen AB\n", " * license : MIT\n", " * http://www.foretagsplatsen.se\n", " */\n", " /************************************\n", " Constants\n", " ************************************/\n", " var numbro, VERSION = '1.6.2', \n", " // internal storage for culture config files\n", " cultures = {}, \n", " // Todo: Remove in 2.0.0\n", " languages = cultures, currentCulture = 'en-US', zeroFormat = null, defaultFormat = '0,0', defaultCurrencyFormat = '0$', \n", " // check for nodeJS\n", " hasModule = (typeof module !== 'undefined' && module.exports), \n", " // default culture\n", " enUS = {\n", " delimiters: {\n", " thousands: ',',\n", " decimal: '.'\n", " },\n", " abbreviations: {\n", " thousand: 'k',\n", " million: 'm',\n", " billion: 'b',\n", " trillion: 't'\n", " },\n", " ordinal: function (number) {\n", " var b = number % 10;\n", " return (~~(number % 100 / 10) === 1) ? 'th' :\n", " (b === 1) ? 'st' :\n", " (b === 2) ? 'nd' :\n", " (b === 3) ? 'rd' : 'th';\n", " },\n", " currency: {\n", " symbol: '$',\n", " position: 'prefix'\n", " },\n", " defaults: {\n", " currencyFormat: ',0000 a'\n", " },\n", " formats: {\n", " fourDigits: '0000 a',\n", " fullWithTwoDecimals: '$ ,0.00',\n", " fullWithTwoDecimalsNoCurrency: ',0.00'\n", " }\n", " };\n", " /************************************\n", " Constructors\n", " ************************************/\n", " // Numbro prototype object\n", " function Numbro(number) {\n", " this._value = number;\n", " }\n", " function zeroes(count) {\n", " var i, ret = '';\n", " for (i = 0; i < count; i++) {\n", " ret += '0';\n", " }\n", " return ret;\n", " }\n", " /**\n", " * Implementation of toFixed() for numbers with exponent > 21\n", " *\n", " *\n", " */\n", " function toFixedLarge(value, precision) {\n", " var mantissa, beforeDec, afterDec, exponent, str;\n", " str = value.toString();\n", " mantissa = str.split('e')[0];\n", " exponent = str.split('e')[1];\n", " beforeDec = mantissa.split('.')[0];\n", " afterDec = mantissa.split('.')[1] || '';\n", " str = beforeDec + afterDec + zeroes(exponent - afterDec.length);\n", " if (precision > 0) {\n", " str += '.' + zeroes(precision);\n", " }\n", " return str;\n", " }\n", " /**\n", " * Implementation of toFixed() that treats floats more like decimals\n", " *\n", " * Fixes binary rounding issues (eg. (0.615).toFixed(2) === '0.61') that present\n", " * problems for accounting- and finance-related software.\n", " */\n", " function toFixed(value, precision, roundingFunction, optionals) {\n", " var power = Math.pow(10, precision), optionalsRegExp, output;\n", " if (value.toFixed(0).search('e') > -1) {\n", " // Above 1e21, toFixed returns scientific notation, which\n", " // is useless and unexpected\n", " output = toFixedLarge(value, precision);\n", " }\n", " else {\n", " //roundingFunction = (roundingFunction !== undefined ? roundingFunction : Math.round);\n", " // Multiply up by precision, round accurately, then divide and use native toFixed():\n", " output = (roundingFunction(value * power) / power).toFixed(precision);\n", " }\n", " if (optionals) {\n", " optionalsRegExp = new RegExp('0{1,' + optionals + '}$');\n", " output = output.replace(optionalsRegExp, '');\n", " }\n", " return output;\n", " }\n", " /************************************\n", " Formatting\n", " ************************************/\n", " // determine what type of formatting we need to do\n", " function formatNumbro(value, format, roundingFunction) {\n", " var output;\n", " // TODO: do something with `language`\n", " // figure out what kind of format we are dealing with\n", " if (format.indexOf('$') > -1) { // currency!!!!!\n", " output = formatCurrency(value, format, roundingFunction);\n", " }\n", " else if (format.indexOf('%') > -1) { // percentage\n", " output = formatPercentage(value, format, roundingFunction);\n", " }\n", " else if (format.indexOf(':') > -1) { // time\n", " output = formatTime(value);\n", " }\n", " else { // plain ol' numbers or bytes\n", " output = formatNumber(value, format, roundingFunction);\n", " }\n", " // return string\n", " return output;\n", " }\n", " function formatCurrency(value, originalFormat, roundingFunction) {\n", " var format = originalFormat, symbolIndex = format.indexOf('$'), openParenIndex = format.indexOf('('), plusSignIndex = format.indexOf('+'), minusSignIndex = format.indexOf('-'), space = '', decimalSeparator = '', spliceIndex, output;\n", " if (format.indexOf('$') === -1) {\n", " // Use defaults instead of the format provided\n", " if (cultures[currentCulture].currency.position === 'infix') {\n", " decimalSeparator = cultures[currentCulture].currency.symbol;\n", " if (cultures[currentCulture].currency.spaceSeparated) {\n", " decimalSeparator = ' ' + decimalSeparator + ' ';\n", " }\n", " }\n", " else if (cultures[currentCulture].currency.spaceSeparated) {\n", " space = ' ';\n", " }\n", " }\n", " else {\n", " // check for space before or after currency\n", " if (format.indexOf(' $') > -1) {\n", " space = ' ';\n", " format = format.replace(' $', '');\n", " }\n", " else if (format.indexOf('$ ') > -1) {\n", " space = ' ';\n", " format = format.replace('$ ', '');\n", " }\n", " else {\n", " format = format.replace('$', '');\n", " }\n", " }\n", " // Format The Number\n", " output = formatNumber(value, format, roundingFunction, decimalSeparator);\n", " if (originalFormat.indexOf('$') === -1) {\n", " // Use defaults instead of the format provided\n", " switch (cultures[currentCulture].currency.position) {\n", " case 'postfix':\n", " if (output.indexOf(')') > -1) {\n", " output = output.split('');\n", " output.splice(-1, 0, space + cultures[currentCulture].currency.symbol);\n", " output = output.join('');\n", " }\n", " else {\n", " output = output + space + cultures[currentCulture].currency.symbol;\n", " }\n", " break;\n", " case 'infix':\n", " break;\n", " case 'prefix':\n", " if (output.indexOf('(') > -1 || output.indexOf('-') > -1) {\n", " output = output.split('');\n", " spliceIndex = Math.max(openParenIndex, minusSignIndex) + 1;\n", " output.splice(spliceIndex, 0, cultures[currentCulture].currency.symbol + space);\n", " output = output.join('');\n", " }\n", " else {\n", " output = cultures[currentCulture].currency.symbol + space + output;\n", " }\n", " break;\n", " default:\n", " throw Error('Currency position should be among [\"prefix\", \"infix\", \"postfix\"]');\n", " }\n", " }\n", " else {\n", " // position the symbol\n", " if (symbolIndex <= 1) {\n", " if (output.indexOf('(') > -1 || output.indexOf('+') > -1 || output.indexOf('-') > -1) {\n", " output = output.split('');\n", " spliceIndex = 1;\n", " if (symbolIndex < openParenIndex || symbolIndex < plusSignIndex || symbolIndex < minusSignIndex) {\n", " // the symbol appears before the \"(\", \"+\" or \"-\"\n", " spliceIndex = 0;\n", " }\n", " output.splice(spliceIndex, 0, cultures[currentCulture].currency.symbol + space);\n", " output = output.join('');\n", " }\n", " else {\n", " output = cultures[currentCulture].currency.symbol + space + output;\n", " }\n", " }\n", " else {\n", " if (output.indexOf(')') > -1) {\n", " output = output.split('');\n", " output.splice(-1, 0, space + cultures[currentCulture].currency.symbol);\n", " output = output.join('');\n", " }\n", " else {\n", " output = output + space + cultures[currentCulture].currency.symbol;\n", " }\n", " }\n", " }\n", " return output;\n", " }\n", " function formatPercentage(value, format, roundingFunction) {\n", " var space = '', output;\n", " value = value * 100;\n", " // check for space before %\n", " if (format.indexOf(' %') > -1) {\n", " space = ' ';\n", " format = format.replace(' %', '');\n", " }\n", " else {\n", " format = format.replace('%', '');\n", " }\n", " output = formatNumber(value, format, roundingFunction);\n", " if (output.indexOf(')') > -1) {\n", " output = output.split('');\n", " output.splice(-1, 0, space + '%');\n", " output = output.join('');\n", " }\n", " else {\n", " output = output + space + '%';\n", " }\n", " return output;\n", " }\n", " function formatTime(value) {\n", " var hours = Math.floor(value / 60 / 60), minutes = Math.floor((value - (hours * 60 * 60)) / 60), seconds = Math.round(value - (hours * 60 * 60) - (minutes * 60));\n", " return hours + ':' +\n", " ((minutes < 10) ? '0' + minutes : minutes) + ':' +\n", " ((seconds < 10) ? '0' + seconds : seconds);\n", " }\n", " function formatNumber(value, format, roundingFunction, sep) {\n", " var negP = false, signed = false, optDec = false, abbr = '', i, abbrK = false, // force abbreviation to thousands\n", " abbrM = false, // force abbreviation to millions\n", " abbrB = false, // force abbreviation to billions\n", " abbrT = false, // force abbreviation to trillions\n", " abbrForce = false, // force abbreviation\n", " bytes = '', ord = '', abs = Math.abs(value), binarySuffixes = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'], decimalSuffixes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], min, max, power, totalLength, length, minimumPrecision, pow, w, intPrecision, precision, prefix, postfix, thousands, d = '', forcedNeg = false, neg = false, indexOpenP, size, indexMinus, paren = '', minlen;\n", " // check if number is zero and a custom zero format has been set\n", " if (value === 0 && zeroFormat !== null) {\n", " return zeroFormat;\n", " }\n", " if (!isFinite(value)) {\n", " return '' + value;\n", " }\n", " if (format.indexOf('{') === 0) {\n", " var end = format.indexOf('}');\n", " if (end === -1) {\n", " throw Error('Format should also contain a \"}\"');\n", " }\n", " prefix = format.slice(1, end);\n", " format = format.slice(end + 1);\n", " }\n", " else {\n", " prefix = '';\n", " }\n", " if (format.indexOf('}') === format.length - 1) {\n", " var start = format.indexOf('{');\n", " if (start === -1) {\n", " throw Error('Format should also contain a \"{\"');\n", " }\n", " postfix = format.slice(start + 1, -1);\n", " format = format.slice(0, start + 1);\n", " }\n", " else {\n", " postfix = '';\n", " }\n", " // check for min length\n", " var info;\n", " if (format.indexOf('.') === -1) {\n", " info = format.match(/([0-9]+).*/);\n", " }\n", " else {\n", " info = format.match(/([0-9]+)\\..*/);\n", " }\n", " minlen = info === null ? -1 : info[1].length;\n", " // see if we should use parentheses for negative number or if we should prefix with a sign\n", " // if both are present we default to parentheses\n", " if (format.indexOf('-') !== -1) {\n", " forcedNeg = true;\n", " }\n", " if (format.indexOf('(') > -1) {\n", " negP = true;\n", " format = format.slice(1, -1);\n", " }\n", " else if (format.indexOf('+') > -1) {\n", " signed = true;\n", " format = format.replace(/\\+/g, '');\n", " }\n", " // see if abbreviation is wanted\n", " if (format.indexOf('a') > -1) {\n", " intPrecision = format.split('.')[0].match(/[0-9]+/g) || ['0'];\n", " intPrecision = parseInt(intPrecision[0], 10);\n", " // check if abbreviation is specified\n", " abbrK = format.indexOf('aK') >= 0;\n", " abbrM = format.indexOf('aM') >= 0;\n", " abbrB = format.indexOf('aB') >= 0;\n", " abbrT = format.indexOf('aT') >= 0;\n", " abbrForce = abbrK || abbrM || abbrB || abbrT;\n", " // check for space before abbreviation\n", " if (format.indexOf(' a') > -1) {\n", " abbr = ' ';\n", " format = format.replace(' a', '');\n", " }\n", " else {\n", " format = format.replace('a', '');\n", " }\n", " totalLength = Math.floor(Math.log(abs) / Math.LN10) + 1;\n", " minimumPrecision = totalLength % 3;\n", " minimumPrecision = minimumPrecision === 0 ? 3 : minimumPrecision;\n", " if (intPrecision && abs !== 0) {\n", " length = Math.floor(Math.log(abs) / Math.LN10) + 1 - intPrecision;\n", " pow = 3 * ~~((Math.min(intPrecision, totalLength) - minimumPrecision) / 3);\n", " abs = abs / Math.pow(10, pow);\n", " if (format.indexOf('.') === -1 && intPrecision > 3) {\n", " format += '[.]';\n", " size = length === 0 ? 0 : 3 * ~~(length / 3) - length;\n", " size = size < 0 ? size + 3 : size;\n", " for (i = 0; i < size; i++) {\n", " format += '0';\n", " }\n", " }\n", " }\n", " if (Math.floor(Math.log(Math.abs(value)) / Math.LN10) + 1 !== intPrecision) {\n", " if (abs >= Math.pow(10, 12) && !abbrForce || abbrT) {\n", " // trillion\n", " abbr = abbr + cultures[currentCulture].abbreviations.trillion;\n", " value = value / Math.pow(10, 12);\n", " }\n", " else if (abs < Math.pow(10, 12) && abs >= Math.pow(10, 9) && !abbrForce || abbrB) {\n", " // billion\n", " abbr = abbr + cultures[currentCulture].abbreviations.billion;\n", " value = value / Math.pow(10, 9);\n", " }\n", " else if (abs < Math.pow(10, 9) && abs >= Math.pow(10, 6) && !abbrForce || abbrM) {\n", " // million\n", " abbr = abbr + cultures[currentCulture].abbreviations.million;\n", " value = value / Math.pow(10, 6);\n", " }\n", " else if (abs < Math.pow(10, 6) && abs >= Math.pow(10, 3) && !abbrForce || abbrK) {\n", " // thousand\n", " abbr = abbr + cultures[currentCulture].abbreviations.thousand;\n", " value = value / Math.pow(10, 3);\n", " }\n", " }\n", " }\n", " // see if we are formatting binary bytes\n", " if (format.indexOf('b') > -1) {\n", " // check for space before\n", " if (format.indexOf(' b') > -1) {\n", " bytes = ' ';\n", " format = format.replace(' b', '');\n", " }\n", " else {\n", " format = format.replace('b', '');\n", " }\n", " for (power = 0; power <= binarySuffixes.length; power++) {\n", " min = Math.pow(1024, power);\n", " max = Math.pow(1024, power + 1);\n", " if (value >= min && value < max) {\n", " bytes = bytes + binarySuffixes[power];\n", " if (min > 0) {\n", " value = value / min;\n", " }\n", " break;\n", " }\n", " }\n", " }\n", " // see if we are formatting decimal bytes\n", " if (format.indexOf('d') > -1) {\n", " // check for space before\n", " if (format.indexOf(' d') > -1) {\n", " bytes = ' ';\n", " format = format.replace(' d', '');\n", " }\n", " else {\n", " format = format.replace('d', '');\n", " }\n", " for (power = 0; power <= decimalSuffixes.length; power++) {\n", " min = Math.pow(1000, power);\n", " max = Math.pow(1000, power + 1);\n", " if (value >= min && value < max) {\n", " bytes = bytes + decimalSuffixes[power];\n", " if (min > 0) {\n", " value = value / min;\n", " }\n", " break;\n", " }\n", " }\n", " }\n", " // see if ordinal is wanted\n", " if (format.indexOf('o') > -1) {\n", " // check for space before\n", " if (format.indexOf(' o') > -1) {\n", " ord = ' ';\n", " format = format.replace(' o', '');\n", " }\n", " else {\n", " format = format.replace('o', '');\n", " }\n", " if (cultures[currentCulture].ordinal) {\n", " ord = ord + cultures[currentCulture].ordinal(value);\n", " }\n", " }\n", " if (format.indexOf('[.]') > -1) {\n", " optDec = true;\n", " format = format.replace('[.]', '.');\n", " }\n", " w = value.toString().split('.')[0];\n", " precision = format.split('.')[1];\n", " thousands = format.indexOf(',');\n", " if (precision) {\n", " if (precision.indexOf('*') !== -1) {\n", " d = toFixed(value, value.toString().split('.')[1].length, roundingFunction);\n", " }\n", " else {\n", " if (precision.indexOf('[') > -1) {\n", " precision = precision.replace(']', '');\n", " precision = precision.split('[');\n", " d = toFixed(value, (precision[0].length + precision[1].length), roundingFunction, precision[1].length);\n", " }\n", " else {\n", " d = toFixed(value, precision.length, roundingFunction);\n", " }\n", " }\n", " w = d.split('.')[0];\n", " if (d.split('.')[1].length) {\n", " var p = sep ? abbr + sep : cultures[currentCulture].delimiters.decimal;\n", " d = p + d.split('.')[1];\n", " }\n", " else {\n", " d = '';\n", " }\n", " if (optDec && Number(d.slice(1)) === 0) {\n", " d = '';\n", " }\n", " }\n", " else {\n", " w = toFixed(value, null, roundingFunction);\n", " }\n", " // format number\n", " if (w.indexOf('-') > -1) {\n", " w = w.slice(1);\n", " neg = true;\n", " }\n", " if (w.length < minlen) {\n", " w = new Array(minlen - w.length + 1).join('0') + w;\n", " }\n", " if (thousands > -1) {\n", " w = w.toString().replace(/(\\d)(?=(\\d{3})+(?!\\d))/g, '$1' +\n", " cultures[currentCulture].delimiters.thousands);\n", " }\n", " if (format.indexOf('.') === 0) {\n", " w = '';\n", " }\n", " indexOpenP = format.indexOf('(');\n", " indexMinus = format.indexOf('-');\n", " if (indexOpenP < indexMinus) {\n", " paren = ((negP && neg) ? '(' : '') + (((forcedNeg && neg) || (!negP && neg)) ? '-' : '');\n", " }\n", " else {\n", " paren = (((forcedNeg && neg) || (!negP && neg)) ? '-' : '') + ((negP && neg) ? '(' : '');\n", " }\n", " return prefix +\n", " paren + ((!neg && signed && value !== 0) ? '+' : '') +\n", " w + d +\n", " ((ord) ? ord : '') +\n", " ((abbr && !sep) ? abbr : '') +\n", " ((bytes) ? bytes : '') +\n", " ((negP && neg) ? ')' : '') +\n", " postfix;\n", " }\n", " /************************************\n", " Top Level Functions\n", " ************************************/\n", " numbro = function (input) {\n", " if (numbro.isNumbro(input)) {\n", " input = input.value();\n", " }\n", " else if (input === 0 || typeof input === 'undefined') {\n", " input = 0;\n", " }\n", " else if (!Number(input)) {\n", " input = numbro.fn.unformat(input);\n", " }\n", " return new Numbro(Number(input));\n", " };\n", " // version number\n", " numbro.version = VERSION;\n", " // compare numbro object\n", " numbro.isNumbro = function (obj) {\n", " return obj instanceof Numbro;\n", " };\n", " /**\n", " * This function allow the user to set a new language with a fallback if\n", " * the language does not exist. If no fallback language is provided,\n", " * it fallbacks to english.\n", " *\n", " * @deprecated Since in version 1.6.0. It will be deleted in version 2.0\n", " * `setCulture` should be used instead.\n", " */\n", " numbro.setLanguage = function (newLanguage, fallbackLanguage) {\n", " console.warn('`setLanguage` is deprecated since version 1.6.0. Use `setCulture` instead');\n", " var key = newLanguage, prefix = newLanguage.split('-')[0], matchingLanguage = null;\n", " if (!languages[key]) {\n", " Object.keys(languages).forEach(function (language) {\n", " if (!matchingLanguage && language.split('-')[0] === prefix) {\n", " matchingLanguage = language;\n", " }\n", " });\n", " key = matchingLanguage || fallbackLanguage || 'en-US';\n", " }\n", " chooseCulture(key);\n", " };\n", " /**\n", " * This function allow the user to set a new culture with a fallback if\n", " * the culture does not exist. If no fallback culture is provided,\n", " * it fallbacks to \"en-US\".\n", " */\n", " numbro.setCulture = function (newCulture, fallbackCulture) {\n", " var key = newCulture, suffix = newCulture.split('-')[1], matchingCulture = null;\n", " if (!cultures[key]) {\n", " if (suffix) {\n", " Object.keys(cultures).forEach(function (language) {\n", " if (!matchingCulture && language.split('-')[1] === suffix) {\n", " matchingCulture = language;\n", " }\n", " });\n", " }\n", " key = matchingCulture || fallbackCulture || 'en-US';\n", " }\n", " chooseCulture(key);\n", " };\n", " /**\n", " * This function will load languages and then set the global language. If\n", " * no arguments are passed in, it will simply return the current global\n", " * language key.\n", " *\n", " * @deprecated Since in version 1.6.0. It will be deleted in version 2.0\n", " * `culture` should be used instead.\n", " */\n", " numbro.language = function (key, values) {\n", " console.warn('`language` is deprecated since version 1.6.0. Use `culture` instead');\n", " if (!key) {\n", " return currentCulture;\n", " }\n", " if (key && !values) {\n", " if (!languages[key]) {\n", " throw new Error('Unknown language : ' + key);\n", " }\n", " chooseCulture(key);\n", " }\n", " if (values || !languages[key]) {\n", " setCulture(key, values);\n", " }\n", " return numbro;\n", " };\n", " /**\n", " * This function will load cultures and then set the global culture. If\n", " * no arguments are passed in, it will simply return the current global\n", " * culture code.\n", " */\n", " numbro.culture = function (code, values) {\n", " if (!code) {\n", " return currentCulture;\n", " }\n", " if (code && !values) {\n", " if (!cultures[code]) {\n", " throw new Error('Unknown culture : ' + code);\n", " }\n", " chooseCulture(code);\n", " }\n", " if (values || !cultures[code]) {\n", " setCulture(code, values);\n", " }\n", " return numbro;\n", " };\n", " /**\n", " * This function provides access to the loaded language data. If\n", " * no arguments are passed in, it will simply return the current\n", " * global language object.\n", " *\n", " * @deprecated Since in version 1.6.0. It will be deleted in version 2.0\n", " * `culture` should be used instead.\n", " */\n", " numbro.languageData = function (key) {\n", " console.warn('`languageData` is deprecated since version 1.6.0. Use `cultureData` instead');\n", " if (!key) {\n", " return languages[currentCulture];\n", " }\n", " if (!languages[key]) {\n", " throw new Error('Unknown language : ' + key);\n", " }\n", " return languages[key];\n", " };\n", " /**\n", " * This function provides access to the loaded culture data. If\n", " * no arguments are passed in, it will simply return the current\n", " * global culture object.\n", " */\n", " numbro.cultureData = function (code) {\n", " if (!code) {\n", " return cultures[currentCulture];\n", " }\n", " if (!cultures[code]) {\n", " throw new Error('Unknown culture : ' + code);\n", " }\n", " return cultures[code];\n", " };\n", " numbro.culture('en-US', enUS);\n", " /**\n", " * @deprecated Since in version 1.6.0. It will be deleted in version 2.0\n", " * `cultures` should be used instead.\n", " */\n", " numbro.languages = function () {\n", " console.warn('`languages` is deprecated since version 1.6.0. Use `cultures` instead');\n", " return languages;\n", " };\n", " numbro.cultures = function () {\n", " return cultures;\n", " };\n", " numbro.zeroFormat = function (format) {\n", " zeroFormat = typeof (format) === 'string' ? format : null;\n", " };\n", " numbro.defaultFormat = function (format) {\n", " defaultFormat = typeof (format) === 'string' ? format : '0.0';\n", " };\n", " numbro.defaultCurrencyFormat = function (format) {\n", " defaultCurrencyFormat = typeof (format) === 'string' ? format : '0$';\n", " };\n", " numbro.validate = function (val, culture) {\n", " var _decimalSep, _thousandSep, _currSymbol, _valArray, _abbrObj, _thousandRegEx, cultureData, temp;\n", " //coerce val to string\n", " if (typeof val !== 'string') {\n", " val += '';\n", " if (console.warn) {\n", " console.warn('Numbro.js: Value is not string. It has been co-erced to: ', val);\n", " }\n", " }\n", " //trim whitespaces from either sides\n", " val = val.trim();\n", " //if val is just digits return true\n", " if (!!val.match(/^\\d+$/)) {\n", " return true;\n", " }\n", " //if val is empty return false\n", " if (val === '') {\n", " return false;\n", " }\n", " //get the decimal and thousands separator from numbro.cultureData\n", " try {\n", " //check if the culture is understood by numbro. if not, default it to current culture\n", " cultureData = numbro.cultureData(culture);\n", " }\n", " catch (e) {\n", " cultureData = numbro.cultureData(numbro.culture());\n", " }\n", " //setup the delimiters and currency symbol based on culture\n", " _currSymbol = cultureData.currency.symbol;\n", " _abbrObj = cultureData.abbreviations;\n", " _decimalSep = cultureData.delimiters.decimal;\n", " if (cultureData.delimiters.thousands === '.') {\n", " _thousandSep = '\\\\.';\n", " }\n", " else {\n", " _thousandSep = cultureData.delimiters.thousands;\n", " }\n", " // validating currency symbol\n", " temp = val.match(/^[^\\d]+/);\n", " if (temp !== null) {\n", " val = val.substr(1);\n", " if (temp[0] !== _currSymbol) {\n", " return false;\n", " }\n", " }\n", " //validating abbreviation symbol\n", " temp = val.match(/[^\\d]+$/);\n", " if (temp !== null) {\n", " val = val.slice(0, -1);\n", " if (temp[0] !== _abbrObj.thousand && temp[0] !== _abbrObj.million &&\n", " temp[0] !== _abbrObj.billion && temp[0] !== _abbrObj.trillion) {\n", " return false;\n", " }\n", " }\n", " _thousandRegEx = new RegExp(_thousandSep + '{2}');\n", " if (!val.match(/[^\\d.,]/g)) {\n", " _valArray = val.split(_decimalSep);\n", " if (_valArray.length > 2) {\n", " return false;\n", " }\n", " else {\n", " if (_valArray.length < 2) {\n", " return (!!_valArray[0].match(/^\\d+.*\\d$/) && !_valArray[0].match(_thousandRegEx));\n", " }\n", " else {\n", " if (_valArray[0].length === 1) {\n", " return (!!_valArray[0].match(/^\\d+$/) &&\n", " !_valArray[0].match(_thousandRegEx) &&\n", " !!_valArray[1].match(/^\\d+$/));\n", " }\n", " else {\n", " return (!!_valArray[0].match(/^\\d+.*\\d$/) &&\n", " !_valArray[0].match(_thousandRegEx) &&\n", " !!_valArray[1].match(/^\\d+$/));\n", " }\n", " }\n", " }\n", " }\n", " return false;\n", " };\n", " /************************************\n", " Helpers\n", " ************************************/\n", " function setCulture(code, values) {\n", " cultures[code] = values;\n", " }\n", " function chooseCulture(code) {\n", " currentCulture = code;\n", " var defaults = cultures[code].defaults;\n", " if (defaults && defaults.format) {\n", " numbro.defaultFormat(defaults.format);\n", " }\n", " if (defaults && defaults.currencyFormat) {\n", " numbro.defaultCurrencyFormat(defaults.currencyFormat);\n", " }\n", " }\n", " function format(input, formatString, language, roundingFunction) {\n", " if (language != null && language !== numbro.culture()) {\n", " numbro.setCulture(language);\n", " }\n", " return formatNumbro(Number(input), formatString != null ? formatString : defaultFormat, roundingFunction == null ? Math.round : roundingFunction);\n", " }\n", " module.exports = { \"format\": format };\n", " },\n", " /* sprintf-js/src/sprintf.js */ function _(require, module, exports) {\n", " /* global window, exports, define */\n", " !function () {\n", " 'use strict';\n", " var re = {\n", " not_string: /[^s]/,\n", " not_bool: /[^t]/,\n", " not_type: /[^T]/,\n", " not_primitive: /[^v]/,\n", " number: /[diefg]/,\n", " numeric_arg: /[bcdiefguxX]/,\n", " json: /[j]/,\n", " not_json: /[^j]/,\n", " text: /^[^\\x25]+/,\n", " modulo: /^\\x25{2}/,\n", " placeholder: /^\\x25(?:([1-9]\\d*)\\$|\\(([^)]+)\\))?(\\+)?(0|'[^$])?(-)?(\\d+)?(?:\\.(\\d+))?([b-gijostTuvxX])/,\n", " key: /^([a-z_][a-z_\\d]*)/i,\n", " key_access: /^\\.([a-z_][a-z_\\d]*)/i,\n", " index_access: /^\\[(\\d+)\\]/,\n", " sign: /^[+-]/\n", " };\n", " function sprintf(key) {\n", " // `arguments` is not an array, but should be fine for this call\n", " return sprintf_format(sprintf_parse(key), arguments);\n", " }\n", " function vsprintf(fmt, argv) {\n", " return sprintf.apply(null, [fmt].concat(argv || []));\n", " }\n", " function sprintf_format(parse_tree, argv) {\n", " var cursor = 1, tree_length = parse_tree.length, arg, output = '', i, k, ph, pad, pad_character, pad_length, is_positive, sign;\n", " for (i = 0; i < tree_length; i++) {\n", " if (typeof parse_tree[i] === 'string') {\n", " output += parse_tree[i];\n", " }\n", " else if (typeof parse_tree[i] === 'object') {\n", " ph = parse_tree[i]; // convenience purposes only\n", " if (ph.keys) { // keyword argument\n", " arg = argv[cursor];\n", " for (k = 0; k < ph.keys.length; k++) {\n", " if (arg == undefined) {\n", " throw new Error(sprintf('[sprintf] Cannot access property \"%s\" of undefined value \"%s\"', ph.keys[k], ph.keys[k - 1]));\n", " }\n", " arg = arg[ph.keys[k]];\n", " }\n", " }\n", " else if (ph.param_no) { // positional argument (explicit)\n", " arg = argv[ph.param_no];\n", " }\n", " else { // positional argument (implicit)\n", " arg = argv[cursor++];\n", " }\n", " if (re.not_type.test(ph.type) && re.not_primitive.test(ph.type) && arg instanceof Function) {\n", " arg = arg();\n", " }\n", " if (re.numeric_arg.test(ph.type) && (typeof arg !== 'number' && isNaN(arg))) {\n", " throw new TypeError(sprintf('[sprintf] expecting number but found %T', arg));\n", " }\n", " if (re.number.test(ph.type)) {\n", " is_positive = arg >= 0;\n", " }\n", " switch (ph.type) {\n", " case 'b':\n", " arg = parseInt(arg, 10).toString(2);\n", " break;\n", " case 'c':\n", " arg = String.fromCharCode(parseInt(arg, 10));\n", " break;\n", " case 'd':\n", " case 'i':\n", " arg = parseInt(arg, 10);\n", " break;\n", " case 'j':\n", " arg = JSON.stringify(arg, null, ph.width ? parseInt(ph.width) : 0);\n", " break;\n", " case 'e':\n", " arg = ph.precision ? parseFloat(arg).toExponential(ph.precision) : parseFloat(arg).toExponential();\n", " break;\n", " case 'f':\n", " arg = ph.precision ? parseFloat(arg).toFixed(ph.precision) : parseFloat(arg);\n", " break;\n", " case 'g':\n", " arg = ph.precision ? String(Number(arg.toPrecision(ph.precision))) : parseFloat(arg);\n", " break;\n", " case 'o':\n", " arg = (parseInt(arg, 10) >>> 0).toString(8);\n", " break;\n", " case 's':\n", " arg = String(arg);\n", " arg = (ph.precision ? arg.substring(0, ph.precision) : arg);\n", " break;\n", " case 't':\n", " arg = String(!!arg);\n", " arg = (ph.precision ? arg.substring(0, ph.precision) : arg);\n", " break;\n", " case 'T':\n", " arg = Object.prototype.toString.call(arg).slice(8, -1).toLowerCase();\n", " arg = (ph.precision ? arg.substring(0, ph.precision) : arg);\n", " break;\n", " case 'u':\n", " arg = parseInt(arg, 10) >>> 0;\n", " break;\n", " case 'v':\n", " arg = arg.valueOf();\n", " arg = (ph.precision ? arg.substring(0, ph.precision) : arg);\n", " break;\n", " case 'x':\n", " arg = (parseInt(arg, 10) >>> 0).toString(16);\n", " break;\n", " case 'X':\n", " arg = (parseInt(arg, 10) >>> 0).toString(16).toUpperCase();\n", " break;\n", " }\n", " if (re.json.test(ph.type)) {\n", " output += arg;\n", " }\n", " else {\n", " if (re.number.test(ph.type) && (!is_positive || ph.sign)) {\n", " sign = is_positive ? '+' : '-';\n", " arg = arg.toString().replace(re.sign, '');\n", " }\n", " else {\n", " sign = '';\n", " }\n", " pad_character = ph.pad_char ? ph.pad_char === '0' ? '0' : ph.pad_char.charAt(1) : ' ';\n", " pad_length = ph.width - (sign + arg).length;\n", " pad = ph.width ? (pad_length > 0 ? pad_character.repeat(pad_length) : '') : '';\n", " output += ph.align ? sign + arg + pad : (pad_character === '0' ? sign + pad + arg : pad + sign + arg);\n", " }\n", " }\n", " }\n", " return output;\n", " }\n", " var sprintf_cache = Object.create(null);\n", " function sprintf_parse(fmt) {\n", " if (sprintf_cache[fmt]) {\n", " return sprintf_cache[fmt];\n", " }\n", " var _fmt = fmt, match, parse_tree = [], arg_names = 0;\n", " while (_fmt) {\n", " if ((match = re.text.exec(_fmt)) !== null) {\n", " parse_tree.push(match[0]);\n", " }\n", " else if ((match = re.modulo.exec(_fmt)) !== null) {\n", " parse_tree.push('%');\n", " }\n", " else if ((match = re.placeholder.exec(_fmt)) !== null) {\n", " if (match[2]) {\n", " arg_names |= 1;\n", " var field_list = [], replacement_field = match[2], field_match = [];\n", " if ((field_match = re.key.exec(replacement_field)) !== null) {\n", " field_list.push(field_match[1]);\n", " while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') {\n", " if ((field_match = re.key_access.exec(replacement_field)) !== null) {\n", " field_list.push(field_match[1]);\n", " }\n", " else if ((field_match = re.index_access.exec(replacement_field)) !== null) {\n", " field_list.push(field_match[1]);\n", " }\n", " else {\n", " throw new SyntaxError('[sprintf] failed to parse named argument key');\n", " }\n", " }\n", " }\n", " else {\n", " throw new SyntaxError('[sprintf] failed to parse named argument key');\n", " }\n", " match[2] = field_list;\n", " }\n", " else {\n", " arg_names |= 2;\n", " }\n", " if (arg_names === 3) {\n", " throw new Error('[sprintf] mixing positional and named placeholders is not (yet) supported');\n", " }\n", " parse_tree.push({\n", " placeholder: match[0],\n", " param_no: match[1],\n", " keys: match[2],\n", " sign: match[3],\n", " pad_char: match[4],\n", " align: match[5],\n", " width: match[6],\n", " precision: match[7],\n", " type: match[8]\n", " });\n", " }\n", " else {\n", " throw new SyntaxError('[sprintf] unexpected placeholder');\n", " }\n", " _fmt = _fmt.substring(match[0].length);\n", " }\n", " return sprintf_cache[fmt] = parse_tree;\n", " }\n", " /**\n", " * export to either browser or node.js\n", " */\n", " /* eslint-disable quote-props */\n", " if (typeof exports !== 'undefined') {\n", " exports['sprintf'] = sprintf;\n", " exports['vsprintf'] = vsprintf;\n", " }\n", " if (typeof window !== 'undefined') {\n", " window['sprintf'] = sprintf;\n", " window['vsprintf'] = vsprintf;\n", " if (typeof define === 'function' && define['amd']) {\n", " define(function () {\n", " return {\n", " 'sprintf': sprintf,\n", " 'vsprintf': vsprintf\n", " };\n", " });\n", " }\n", " }\n", " /* eslint-enable quote-props */\n", " }(); // eslint-disable-line\n", " },\n", " /* models/tickers/datetime_ticker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const adaptive_ticker_1 = require(110) /* ./adaptive_ticker */;\n", " const composite_ticker_1 = require(164) /* ./composite_ticker */;\n", " const days_ticker_1 = require(165) /* ./days_ticker */;\n", " const months_ticker_1 = require(168) /* ./months_ticker */;\n", " const years_ticker_1 = require(169) /* ./years_ticker */;\n", " const util_1 = require(167) /* ./util */;\n", " class DatetimeTicker extends composite_ticker_1.CompositeTicker {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_DatetimeTicker() {\n", " this.override({\n", " num_minor_ticks: 0,\n", " tickers: () => [\n", " // Sub-second.\n", " new adaptive_ticker_1.AdaptiveTicker({\n", " mantissas: [1, 2, 5],\n", " base: 10,\n", " min_interval: 0,\n", " max_interval: 500 * util_1.ONE_MILLI,\n", " num_minor_ticks: 0,\n", " }),\n", " // Seconds, minutes.\n", " new adaptive_ticker_1.AdaptiveTicker({\n", " mantissas: [1, 2, 5, 10, 15, 20, 30],\n", " base: 60,\n", " min_interval: util_1.ONE_SECOND,\n", " max_interval: 30 * util_1.ONE_MINUTE,\n", " num_minor_ticks: 0,\n", " }),\n", " // Hours.\n", " new adaptive_ticker_1.AdaptiveTicker({\n", " mantissas: [1, 2, 4, 6, 8, 12],\n", " base: 24.0,\n", " min_interval: util_1.ONE_HOUR,\n", " max_interval: 12 * util_1.ONE_HOUR,\n", " num_minor_ticks: 0,\n", " }),\n", " // Days.\n", " new days_ticker_1.DaysTicker({ days: array_1.range(1, 32) }),\n", " new days_ticker_1.DaysTicker({ days: array_1.range(1, 31, 3) }),\n", " new days_ticker_1.DaysTicker({ days: [1, 8, 15, 22] }),\n", " new days_ticker_1.DaysTicker({ days: [1, 15] }),\n", " // Months.\n", " new months_ticker_1.MonthsTicker({ months: array_1.range(0, 12, 1) }),\n", " new months_ticker_1.MonthsTicker({ months: array_1.range(0, 12, 2) }),\n", " new months_ticker_1.MonthsTicker({ months: array_1.range(0, 12, 4) }),\n", " new months_ticker_1.MonthsTicker({ months: array_1.range(0, 12, 6) }),\n", " // Years\n", " new years_ticker_1.YearsTicker({}),\n", " ],\n", " });\n", " }\n", " }\n", " exports.DatetimeTicker = DatetimeTicker;\n", " DatetimeTicker.__name__ = \"DatetimeTicker\";\n", " DatetimeTicker.init_DatetimeTicker();\n", " },\n", " /* models/tickers/composite_ticker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const continuous_ticker_1 = require(111) /* ./continuous_ticker */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " class CompositeTicker extends continuous_ticker_1.ContinuousTicker {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_CompositeTicker() {\n", " this.define({\n", " tickers: [p.Array, []],\n", " });\n", " }\n", " // The tickers should be in order of increasing interval size; specifically,\n", " // if S comes before T, then it should be the case that\n", " // S.get_max_interval() < T.get_min_interval().\n", " // FIXME Enforce this automatically.\n", " get min_intervals() {\n", " return this.tickers.map((ticker) => ticker.get_min_interval());\n", " }\n", " get max_intervals() {\n", " return this.tickers.map((ticker) => ticker.get_max_interval());\n", " }\n", " get min_interval() {\n", " return this.min_intervals[0];\n", " }\n", " get max_interval() {\n", " return this.max_intervals[0];\n", " }\n", " get_best_ticker(data_low, data_high, desired_n_ticks) {\n", " const data_range = data_high - data_low;\n", " const ideal_interval = this.get_ideal_interval(data_low, data_high, desired_n_ticks);\n", " const ticker_ndxs = [\n", " array_1.sorted_index(this.min_intervals, ideal_interval) - 1,\n", " array_1.sorted_index(this.max_intervals, ideal_interval),\n", " ];\n", " const intervals = [\n", " this.min_intervals[ticker_ndxs[0]],\n", " this.max_intervals[ticker_ndxs[1]],\n", " ];\n", " const errors = intervals.map((interval) => {\n", " return Math.abs(desired_n_ticks - (data_range / interval));\n", " });\n", " let best_ticker;\n", " if (array_1.is_empty(errors.filter((e) => !isNaN(e)))) {\n", " // this can happen if the data isn't loaded yet, we just default to the first scale\n", " best_ticker = this.tickers[0];\n", " }\n", " else {\n", " const best_index = array_1.argmin(errors);\n", " const best_ticker_ndx = ticker_ndxs[best_index];\n", " best_ticker = this.tickers[best_ticker_ndx];\n", " }\n", " return best_ticker;\n", " }\n", " get_interval(data_low, data_high, desired_n_ticks) {\n", " const best_ticker = this.get_best_ticker(data_low, data_high, desired_n_ticks);\n", " return best_ticker.get_interval(data_low, data_high, desired_n_ticks);\n", " }\n", " get_ticks_no_defaults(data_low, data_high, cross_loc, desired_n_ticks) {\n", " const best_ticker = this.get_best_ticker(data_low, data_high, desired_n_ticks);\n", " return best_ticker.get_ticks_no_defaults(data_low, data_high, cross_loc, desired_n_ticks);\n", " }\n", " }\n", " exports.CompositeTicker = CompositeTicker;\n", " CompositeTicker.__name__ = \"CompositeTicker\";\n", " CompositeTicker.init_CompositeTicker();\n", " },\n", " /* models/tickers/days_ticker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const single_interval_ticker_1 = require(166) /* ./single_interval_ticker */;\n", " const util_1 = require(167) /* ./util */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " // Given a start and end time in millis, returns the shortest array of\n", " // consecutive months (as Dates) that surrounds both times.\n", " function date_range_by_month(start_time, end_time) {\n", " const start_date = util_1.last_month_no_later_than(new Date(start_time));\n", " const end_date = util_1.last_month_no_later_than(new Date(end_time));\n", " // XXX This is not a reliable technique in general, but it should be\n", " // safe when the day of the month is 1. (The problem case is this:\n", " // Mar 31 -> Apr 31, which becomes May 1.)\n", " end_date.setUTCMonth(end_date.getUTCMonth() + 1);\n", " const dates = [];\n", " const date = start_date;\n", " while (true) {\n", " dates.push(util_1.copy_date(date));\n", " date.setUTCMonth(date.getUTCMonth() + 1);\n", " if (date > end_date)\n", " break;\n", " }\n", " return dates;\n", " }\n", " class DaysTicker extends single_interval_ticker_1.SingleIntervalTicker {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_DaysTicker() {\n", " this.define({\n", " days: [p.Array, []],\n", " });\n", " this.override({\n", " num_minor_ticks: 0,\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " const days = this.days;\n", " if (days.length > 1)\n", " this.interval = (days[1] - days[0]) * util_1.ONE_DAY;\n", " else\n", " this.interval = 31 * util_1.ONE_DAY;\n", " }\n", " get_ticks_no_defaults(data_low, data_high, _cross_loc, _desired_n_ticks) {\n", " const month_dates = date_range_by_month(data_low, data_high);\n", " const days = this.days;\n", " const days_of_month = (month_date, interval) => {\n", " const current_month = month_date.getUTCMonth();\n", " const dates = [];\n", " for (const day of days) {\n", " const day_date = util_1.copy_date(month_date);\n", " day_date.setUTCDate(day);\n", " // We can't use all of the values in this.days, because they may not\n", " // fall within the current month. In fact, if, e.g., our month is 28 days\n", " // and we're marking every third day, we don't want day 28 to show up\n", " // because it'll be right next to the 1st of the next month. So we\n", " // make sure we have a bit of room before we include a day.\n", " // TODO (bev) The above description does not exactly work because JS Date\n", " // is broken and will happily consider \"Feb 28 + 3*ONE_DAY\" to have month \"2\"\n", " const future_date = new Date(day_date.getTime() + (interval / 2));\n", " if (future_date.getUTCMonth() == current_month)\n", " dates.push(day_date);\n", " }\n", " return dates;\n", " };\n", " const interval = this.interval;\n", " const day_dates = array_1.concat(month_dates.map((date) => days_of_month(date, interval)));\n", " const all_ticks = day_dates.map((day_date) => day_date.getTime());\n", " const ticks_in_range = all_ticks.filter((tick) => data_low <= tick && tick <= data_high);\n", " return {\n", " major: ticks_in_range,\n", " minor: [],\n", " };\n", " }\n", " }\n", " exports.DaysTicker = DaysTicker;\n", " DaysTicker.__name__ = \"DaysTicker\";\n", " DaysTicker.init_DaysTicker();\n", " },\n", " /* models/tickers/single_interval_ticker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const continuous_ticker_1 = require(111) /* ./continuous_ticker */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class SingleIntervalTicker extends continuous_ticker_1.ContinuousTicker {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_SingleIntervalTicker() {\n", " this.define({\n", " interval: [p.Number],\n", " });\n", " }\n", " get_interval(_data_low, _data_high, _n_desired_ticks) {\n", " return this.interval;\n", " }\n", " get min_interval() {\n", " return this.interval;\n", " }\n", " get max_interval() {\n", " return this.interval;\n", " }\n", " }\n", " exports.SingleIntervalTicker = SingleIntervalTicker;\n", " SingleIntervalTicker.__name__ = \"SingleIntervalTicker\";\n", " SingleIntervalTicker.init_SingleIntervalTicker();\n", " },\n", " /* models/tickers/util.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " // TODO Clear out debugging code, etc.\n", " // TODO Organize helper functions.\n", " // TODO The years ticker doesn't always use the roundest numbers; it should\n", " // probably use a special ticker.\n", " // TODO Add tests.\n", " // TODO There used to be a TODO: restore memoization. So.... do that?\n", " // TODO Instead of a get_ticks() method, there used to be an auto_ticks()\n", " // function that took a lot of fancy arguments, but those arguments weren't\n", " // used anywhere. Should we restore them?\n", " // Some time constants, in milliseconds.\n", " exports.ONE_MILLI = 1.0;\n", " exports.ONE_SECOND = 1000.0;\n", " exports.ONE_MINUTE = 60.0 * exports.ONE_SECOND;\n", " exports.ONE_HOUR = 60 * exports.ONE_MINUTE;\n", " exports.ONE_DAY = 24 * exports.ONE_HOUR;\n", " exports.ONE_MONTH = 30 * exports.ONE_DAY; // An approximation, obviously.\n", " exports.ONE_YEAR = 365 * exports.ONE_DAY;\n", " // ---------------------------------------------------------------------------\n", " // Date/time utility functions\n", " // ---------------------------------------------------------------------------\n", " // Makes a copy of a date object.\n", " function copy_date(date) {\n", " return new Date(date.getTime());\n", " }\n", " exports.copy_date = copy_date;\n", " // Rounds a date down to the month.\n", " function last_month_no_later_than(date) {\n", " const new_date = copy_date(date);\n", " new_date.setUTCDate(1);\n", " new_date.setUTCHours(0);\n", " new_date.setUTCMinutes(0);\n", " new_date.setUTCSeconds(0);\n", " new_date.setUTCMilliseconds(0);\n", " return new_date;\n", " }\n", " exports.last_month_no_later_than = last_month_no_later_than;\n", " // Rounds a date down to the year.\n", " function last_year_no_later_than(date) {\n", " const new_date = last_month_no_later_than(date);\n", " new_date.setUTCMonth(0);\n", " return new_date;\n", " }\n", " exports.last_year_no_later_than = last_year_no_later_than;\n", " },\n", " /* models/tickers/months_ticker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const single_interval_ticker_1 = require(166) /* ./single_interval_ticker */;\n", " const util_1 = require(167) /* ./util */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " // Given a start and end time in millis, returns the shortest array of\n", " // consecutive years (as Dates) that surrounds both times.\n", " function date_range_by_year(start_time, end_time) {\n", " const start_date = util_1.last_year_no_later_than(new Date(start_time));\n", " const end_date = util_1.last_year_no_later_than(new Date(end_time));\n", " end_date.setUTCFullYear(end_date.getUTCFullYear() + 1);\n", " const dates = [];\n", " const date = start_date;\n", " while (true) {\n", " dates.push(util_1.copy_date(date));\n", " date.setUTCFullYear(date.getUTCFullYear() + 1);\n", " if (date > end_date)\n", " break;\n", " }\n", " return dates;\n", " }\n", " class MonthsTicker extends single_interval_ticker_1.SingleIntervalTicker {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_MonthsTicker() {\n", " this.define({\n", " months: [p.Array, []],\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " const months = this.months;\n", " if (months.length > 1)\n", " this.interval = (months[1] - months[0]) * util_1.ONE_MONTH;\n", " else\n", " this.interval = 12 * util_1.ONE_MONTH;\n", " }\n", " get_ticks_no_defaults(data_low, data_high, _cross_loc, _desired_n_ticks) {\n", " const year_dates = date_range_by_year(data_low, data_high);\n", " const months = this.months;\n", " const months_of_year = (year_date) => {\n", " return months.map((month) => {\n", " const month_date = util_1.copy_date(year_date);\n", " month_date.setUTCMonth(month);\n", " return month_date;\n", " });\n", " };\n", " const month_dates = array_1.concat(year_dates.map(months_of_year));\n", " const all_ticks = month_dates.map((month_date) => month_date.getTime());\n", " const ticks_in_range = all_ticks.filter((tick) => data_low <= tick && tick <= data_high);\n", " return {\n", " major: ticks_in_range,\n", " minor: [],\n", " };\n", " }\n", " }\n", " exports.MonthsTicker = MonthsTicker;\n", " MonthsTicker.__name__ = \"MonthsTicker\";\n", " MonthsTicker.init_MonthsTicker();\n", " },\n", " /* models/tickers/years_ticker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const basic_ticker_1 = require(109) /* ./basic_ticker */;\n", " const single_interval_ticker_1 = require(166) /* ./single_interval_ticker */;\n", " const util_1 = require(167) /* ./util */;\n", " class YearsTicker extends single_interval_ticker_1.SingleIntervalTicker {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.interval = util_1.ONE_YEAR;\n", " this.basic_ticker = new basic_ticker_1.BasicTicker({ num_minor_ticks: 0 });\n", " }\n", " get_ticks_no_defaults(data_low, data_high, cross_loc, desired_n_ticks) {\n", " const start_year = util_1.last_year_no_later_than(new Date(data_low)).getUTCFullYear();\n", " const end_year = util_1.last_year_no_later_than(new Date(data_high)).getUTCFullYear();\n", " const years = this.basic_ticker.get_ticks_no_defaults(start_year, end_year, cross_loc, desired_n_ticks).major;\n", " const all_ticks = years.map((year) => Date.UTC(year, 0, 1));\n", " const ticks_in_range = all_ticks.filter((tick) => data_low <= tick && tick <= data_high);\n", " return {\n", " major: ticks_in_range,\n", " minor: [],\n", " };\n", " }\n", " }\n", " exports.YearsTicker = YearsTicker;\n", " YearsTicker.__name__ = \"YearsTicker\";\n", " },\n", " /* models/axes/log_axis.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const axis_1 = require(150) /* ./axis */;\n", " const continuous_axis_1 = require(155) /* ./continuous_axis */;\n", " const log_tick_formatter_1 = require(171) /* ../formatters/log_tick_formatter */;\n", " const log_ticker_1 = require(172) /* ../tickers/log_ticker */;\n", " class LogAxisView extends axis_1.AxisView {\n", " }\n", " exports.LogAxisView = LogAxisView;\n", " LogAxisView.__name__ = \"LogAxisView\";\n", " class LogAxis extends continuous_axis_1.ContinuousAxis {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_LogAxis() {\n", " this.prototype.default_view = LogAxisView;\n", " this.override({\n", " ticker: () => new log_ticker_1.LogTicker(),\n", " formatter: () => new log_tick_formatter_1.LogTickFormatter(),\n", " });\n", " }\n", " }\n", " exports.LogAxis = LogAxis;\n", " LogAxis.__name__ = \"LogAxis\";\n", " LogAxis.init_LogAxis();\n", " },\n", " /* models/formatters/log_tick_formatter.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const tick_formatter_1 = require(114) /* ./tick_formatter */;\n", " const basic_tick_formatter_1 = require(113) /* ./basic_tick_formatter */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class LogTickFormatter extends tick_formatter_1.TickFormatter {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_LogTickFormatter() {\n", " this.define({\n", " ticker: [p.Instance, null],\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.basic_formatter = new basic_tick_formatter_1.BasicTickFormatter();\n", " }\n", " doFormat(ticks, opts) {\n", " if (ticks.length == 0)\n", " return [];\n", " const base = this.ticker != null ? this.ticker.base : 10;\n", " let small_interval = false;\n", " const labels = new Array(ticks.length);\n", " for (let i = 0, end = ticks.length; i < end; i++) {\n", " labels[i] = `${base}^${Math.round(Math.log(ticks[i]) / Math.log(base))}`;\n", " if (i > 0 && labels[i] == labels[i - 1]) {\n", " small_interval = true;\n", " break;\n", " }\n", " }\n", " if (small_interval)\n", " return this.basic_formatter.doFormat(ticks, opts);\n", " else\n", " return labels;\n", " }\n", " }\n", " exports.LogTickFormatter = LogTickFormatter;\n", " LogTickFormatter.__name__ = \"LogTickFormatter\";\n", " LogTickFormatter.init_LogTickFormatter();\n", " },\n", " /* models/tickers/log_ticker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const adaptive_ticker_1 = require(110) /* ./adaptive_ticker */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " class LogTicker extends adaptive_ticker_1.AdaptiveTicker {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_LogTicker() {\n", " this.override({\n", " mantissas: [1, 5],\n", " });\n", " }\n", " get_ticks_no_defaults(data_low, data_high, _cross_loc, desired_n_ticks) {\n", " const num_minor_ticks = this.num_minor_ticks;\n", " const minor_ticks = [];\n", " const base = this.base;\n", " const log_low = Math.log(data_low) / Math.log(base);\n", " const log_high = Math.log(data_high) / Math.log(base);\n", " const log_interval = log_high - log_low;\n", " let ticks;\n", " if (!isFinite(log_interval)) {\n", " ticks = [];\n", " }\n", " else if (log_interval < 2) { // treat as linear ticker\n", " const interval = this.get_interval(data_low, data_high, desired_n_ticks);\n", " const start_factor = Math.floor(data_low / interval);\n", " const end_factor = Math.ceil(data_high / interval);\n", " ticks = array_1.range(start_factor, end_factor + 1)\n", " .filter((factor) => factor != 0)\n", " .map((factor) => factor * interval)\n", " .filter((tick) => data_low <= tick && tick <= data_high);\n", " if (num_minor_ticks > 0 && ticks.length > 0) {\n", " const minor_interval = interval / num_minor_ticks;\n", " const minor_offsets = array_1.range(0, num_minor_ticks).map((i) => i * minor_interval);\n", " for (const x of minor_offsets.slice(1)) {\n", " minor_ticks.push(ticks[0] - x);\n", " }\n", " for (const tick of ticks) {\n", " for (const x of minor_offsets) {\n", " minor_ticks.push(tick + x);\n", " }\n", " }\n", " }\n", " }\n", " else {\n", " const startlog = Math.ceil(log_low * 0.999999);\n", " const endlog = Math.floor(log_high * 1.000001);\n", " const interval = Math.ceil((endlog - startlog) / 9.0);\n", " ticks = array_1.range(startlog - 1, endlog + 1, interval)\n", " .map((i) => base ** i);\n", " if (num_minor_ticks > 0 && ticks.length > 0) {\n", " const minor_interval = base ** interval / num_minor_ticks;\n", " const minor_offsets = array_1.range(1, num_minor_ticks + 1).map((i) => i * minor_interval);\n", " for (const x of minor_offsets) {\n", " minor_ticks.push(ticks[0] / x);\n", " }\n", " minor_ticks.push(ticks[0]);\n", " for (const tick of ticks) {\n", " for (const x of minor_offsets) {\n", " minor_ticks.push(tick * x);\n", " }\n", " }\n", " }\n", " }\n", " return {\n", " major: ticks.filter((tick) => data_low <= tick && tick <= data_high),\n", " minor: minor_ticks.filter((tick) => data_low <= tick && tick <= data_high),\n", " };\n", " }\n", " }\n", " exports.LogTicker = LogTicker;\n", " LogTicker.__name__ = \"LogTicker\";\n", " LogTicker.init_LogTicker();\n", " },\n", " /* models/axes/mercator_axis.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const axis_1 = require(150) /* ./axis */;\n", " const linear_axis_1 = require(157) /* ./linear_axis */;\n", " const mercator_tick_formatter_1 = require(174) /* ../formatters/mercator_tick_formatter */;\n", " const mercator_ticker_1 = require(175) /* ../tickers/mercator_ticker */;\n", " class MercatorAxisView extends axis_1.AxisView {\n", " }\n", " exports.MercatorAxisView = MercatorAxisView;\n", " MercatorAxisView.__name__ = \"MercatorAxisView\";\n", " class MercatorAxis extends linear_axis_1.LinearAxis {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_MercatorAxis() {\n", " this.prototype.default_view = MercatorAxisView;\n", " this.override({\n", " ticker: () => new mercator_ticker_1.MercatorTicker({ dimension: \"lat\" }),\n", " formatter: () => new mercator_tick_formatter_1.MercatorTickFormatter({ dimension: \"lat\" }),\n", " });\n", " }\n", " }\n", " exports.MercatorAxis = MercatorAxis;\n", " MercatorAxis.__name__ = \"MercatorAxis\";\n", " MercatorAxis.init_MercatorAxis();\n", " },\n", " /* models/formatters/mercator_tick_formatter.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const basic_tick_formatter_1 = require(113) /* ./basic_tick_formatter */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const projections_1 = require(32) /* ../../core/util/projections */;\n", " class MercatorTickFormatter extends basic_tick_formatter_1.BasicTickFormatter {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_MercatorTickFormatter() {\n", " this.define({\n", " dimension: [p.LatLon],\n", " });\n", " }\n", " doFormat(ticks, opts) {\n", " if (this.dimension == null)\n", " throw new Error(\"MercatorTickFormatter.dimension not configured\");\n", " if (ticks.length == 0)\n", " return [];\n", " const n = ticks.length;\n", " const proj_ticks = new Array(n);\n", " if (this.dimension == \"lon\") {\n", " for (let i = 0; i < n; i++) {\n", " const [lon] = projections_1.wgs84_mercator.inverse([ticks[i], opts.loc]);\n", " proj_ticks[i] = lon;\n", " }\n", " }\n", " else {\n", " for (let i = 0; i < n; i++) {\n", " const [, lat] = projections_1.wgs84_mercator.inverse([opts.loc, ticks[i]]);\n", " proj_ticks[i] = lat;\n", " }\n", " }\n", " return super.doFormat(proj_ticks, opts);\n", " }\n", " }\n", " exports.MercatorTickFormatter = MercatorTickFormatter;\n", " MercatorTickFormatter.__name__ = \"MercatorTickFormatter\";\n", " MercatorTickFormatter.init_MercatorTickFormatter();\n", " },\n", " /* models/tickers/mercator_ticker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const basic_ticker_1 = require(109) /* ./basic_ticker */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const projections_1 = require(32) /* ../../core/util/projections */;\n", " class MercatorTicker extends basic_ticker_1.BasicTicker {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_MercatorTicker() {\n", " this.define({\n", " dimension: [p.LatLon],\n", " });\n", " }\n", " get_ticks_no_defaults(data_low, data_high, cross_loc, desired_n_ticks) {\n", " if (this.dimension == null) {\n", " throw new Error(\"MercatorTicker.dimension not configured\");\n", " }\n", " [data_low, data_high] = projections_1.clip_mercator(data_low, data_high, this.dimension);\n", " let proj_low, proj_high, proj_cross_loc;\n", " if (this.dimension === \"lon\") {\n", " [proj_low, proj_cross_loc] = projections_1.wgs84_mercator.inverse([data_low, cross_loc]); // lgtm [js/useless-assignment-to-local]\n", " [proj_high, proj_cross_loc] = projections_1.wgs84_mercator.inverse([data_high, cross_loc]);\n", " }\n", " else {\n", " [proj_cross_loc, proj_low] = projections_1.wgs84_mercator.inverse([cross_loc, data_low]); // lgtm [js/useless-assignment-to-local]\n", " [proj_cross_loc, proj_high] = projections_1.wgs84_mercator.inverse([cross_loc, data_high]);\n", " }\n", " const proj_ticks = super.get_ticks_no_defaults(proj_low, proj_high, cross_loc, desired_n_ticks);\n", " const major = [];\n", " const minor = [];\n", " if (this.dimension === \"lon\") {\n", " for (const tick of proj_ticks.major) {\n", " if (projections_1.in_bounds(tick, 'lon')) {\n", " const [lon] = projections_1.wgs84_mercator.forward([tick, proj_cross_loc]);\n", " major.push(lon);\n", " }\n", " }\n", " for (const tick of proj_ticks.minor) {\n", " if (projections_1.in_bounds(tick, 'lon')) {\n", " const [lon] = projections_1.wgs84_mercator.forward([tick, proj_cross_loc]);\n", " minor.push(lon);\n", " }\n", " }\n", " }\n", " else {\n", " for (const tick of proj_ticks.major) {\n", " if (projections_1.in_bounds(tick, 'lat')) {\n", " const [, lat] = projections_1.wgs84_mercator.forward([proj_cross_loc, tick]);\n", " major.push(lat);\n", " }\n", " }\n", " for (const tick of proj_ticks.minor) {\n", " if (projections_1.in_bounds(tick, 'lat')) {\n", " const [, lat] = projections_1.wgs84_mercator.forward([proj_cross_loc, tick]);\n", " minor.push(lat);\n", " }\n", " }\n", " }\n", " return { major, minor };\n", " }\n", " }\n", " exports.MercatorTicker = MercatorTicker;\n", " MercatorTicker.__name__ = \"MercatorTicker\";\n", " MercatorTicker.init_MercatorTicker();\n", " },\n", " /* models/callbacks/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var customjs_1 = require(177) /* ./customjs */;\n", " exports.CustomJS = customjs_1.CustomJS;\n", " var open_url_1 = require(179) /* ./open_url */;\n", " exports.OpenURL = open_url_1.OpenURL;\n", " },\n", " /* models/callbacks/customjs.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const callback_1 = require(178) /* ./callback */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const object_1 = require(17) /* ../../core/util/object */;\n", " const string_1 = require(24) /* ../../core/util/string */;\n", " class CustomJS extends callback_1.Callback {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_CustomJS() {\n", " this.define({\n", " args: [p.Any, {}],\n", " code: [p.String, ''],\n", " });\n", " }\n", " get names() {\n", " return object_1.keys(this.args);\n", " }\n", " get values() {\n", " return object_1.values(this.args);\n", " }\n", " get func() {\n", " const code = string_1.use_strict(this.code);\n", " return new Function(...this.names, \"cb_obj\", \"cb_data\", code);\n", " }\n", " execute(cb_obj, cb_data = {}) {\n", " return this.func.apply(cb_obj, this.values.concat(cb_obj, cb_data));\n", " }\n", " }\n", " exports.CustomJS = CustomJS;\n", " CustomJS.__name__ = \"CustomJS\";\n", " CustomJS.init_CustomJS();\n", " },\n", " /* models/callbacks/callback.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const model_1 = require(71) /* ../../model */;\n", " class Callback extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " }\n", " exports.Callback = Callback;\n", " Callback.__name__ = \"Callback\";\n", " },\n", " /* models/callbacks/open_url.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const callback_1 = require(178) /* ./callback */;\n", " const templating_1 = require(160) /* ../../core/util/templating */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class OpenURL extends callback_1.Callback {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_OpenURL() {\n", " this.define({\n", " url: [p.String, 'http://'],\n", " same_tab: [p.Boolean, false],\n", " });\n", " }\n", " execute(_cb_obj, { source }) {\n", " const open_url = (i) => {\n", " const url = templating_1.replace_placeholders(this.url, source, i);\n", " if (this.same_tab)\n", " window.location.href = url;\n", " else\n", " window.open(url);\n", " };\n", " const { selected } = source;\n", " for (const i of selected.indices)\n", " open_url(i);\n", " for (const i of selected.line_indices)\n", " open_url(i);\n", " // TODO: multiline_indices: {[key: string]: number[]}\n", " }\n", " }\n", " exports.OpenURL = OpenURL;\n", " OpenURL.__name__ = \"OpenURL\";\n", " OpenURL.init_OpenURL();\n", " },\n", " /* models/canvas/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var canvas_1 = require(181) /* ./canvas */;\n", " exports.Canvas = canvas_1.Canvas;\n", " var cartesian_frame_1 = require(184) /* ./cartesian_frame */;\n", " exports.CartesianFrame = cartesian_frame_1.CartesianFrame;\n", " },\n", " /* models/canvas/canvas.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const has_props_1 = require(13) /* ../../core/has_props */;\n", " const dom_view_1 = require(66) /* ../../core/dom_view */;\n", " const logging_1 = require(72) /* ../../core/logging */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const object_1 = require(17) /* ../../core/util/object */;\n", " const bbox_1 = require(88) /* ../../core/util/bbox */;\n", " const canvas_1 = require(182) /* ../../core/util/canvas */;\n", " const svg_1 = require(183) /* ../../core/util/svg */;\n", " const global_webgl = (() => {\n", " // We use a global invisible canvas and gl context. By having a global context,\n", " // we avoid the limitation of max 16 contexts that most browsers have.\n", " const canvas = document.createElement(\"canvas\");\n", " const gl = canvas.getContext(\"webgl\", { premultipliedAlpha: true });\n", " // If WebGL is available, we store a reference to the gl canvas on\n", " // the ctx object, because that's what gets passed everywhere.\n", " if (gl != null)\n", " return { canvas, gl };\n", " else {\n", " logging_1.logger.trace(\"WebGL is not supported\");\n", " return undefined;\n", " }\n", " })();\n", " const style = {\n", " position: \"absolute\",\n", " top: \"0\",\n", " left: \"0\",\n", " width: \"100%\",\n", " height: \"100%\",\n", " };\n", " class CanvasLayer {\n", " constructor(backend, hidpi) {\n", " this.backend = backend;\n", " this.hidpi = hidpi;\n", " this.pixel_ratio = 1;\n", " this.bbox = new bbox_1.BBox();\n", " switch (backend) {\n", " case \"webgl\":\n", " case \"canvas\": {\n", " this._el = this._canvas = dom_1.canvas({ style });\n", " const ctx = this.canvas.getContext('2d');\n", " if (ctx == null)\n", " throw new Error(\"unable to obtain 2D rendering context\");\n", " this._ctx = ctx;\n", " if (hidpi) {\n", " this.pixel_ratio = devicePixelRatio;\n", " }\n", " break;\n", " }\n", " case \"svg\": {\n", " const ctx = new svg_1.SVGRenderingContext2D();\n", " this._ctx = ctx;\n", " this._canvas = ctx.getSvg();\n", " this._el = dom_1.div({ style }, this._canvas);\n", " break;\n", " }\n", " }\n", " canvas_1.fixup_ctx(this._ctx);\n", " }\n", " get canvas() {\n", " return this._canvas;\n", " }\n", " get ctx() {\n", " return this._ctx;\n", " }\n", " get el() {\n", " return this._el;\n", " }\n", " resize(width, height) {\n", " this.bbox = new bbox_1.BBox({ left: 0, top: 0, width, height });\n", " const target = this._ctx instanceof svg_1.SVGRenderingContext2D ? this._ctx : this.canvas;\n", " target.width = width * this.pixel_ratio;\n", " target.height = height * this.pixel_ratio;\n", " }\n", " prepare() {\n", " const { ctx, hidpi, pixel_ratio } = this;\n", " ctx.save();\n", " if (hidpi) {\n", " ctx.scale(pixel_ratio, pixel_ratio);\n", " ctx.translate(0.5, 0.5);\n", " }\n", " this.clear();\n", " }\n", " clear() {\n", " const { x, y, width, height } = this.bbox;\n", " this.ctx.clearRect(x, y, width, height);\n", " }\n", " finish() {\n", " this.ctx.restore();\n", " }\n", " save(name) {\n", " const { _canvas } = this;\n", " if (_canvas instanceof HTMLCanvasElement) {\n", " if (_canvas.msToBlob != null) {\n", " const blob = _canvas.msToBlob();\n", " window.navigator.msSaveBlob(blob, name);\n", " }\n", " else {\n", " const link = document.createElement(\"a\");\n", " link.href = _canvas.toDataURL(\"image/png\");\n", " link.download = name + \".png\";\n", " link.target = \"_blank\";\n", " link.dispatchEvent(new MouseEvent(\"click\"));\n", " }\n", " }\n", " else {\n", " const ctx = this._ctx;\n", " const svg = ctx.getSerializedSvg(true);\n", " const svgblob = new Blob([svg], { type: \"text/plain\" });\n", " const downloadLink = document.createElement(\"a\");\n", " downloadLink.download = name + \".svg\";\n", " downloadLink.innerHTML = \"Download svg\";\n", " downloadLink.href = window.URL.createObjectURL(svgblob);\n", " downloadLink.onclick = (event) => document.body.removeChild(event.target);\n", " downloadLink.style.display = \"none\";\n", " document.body.appendChild(downloadLink);\n", " downloadLink.click();\n", " }\n", " }\n", " }\n", " exports.CanvasLayer = CanvasLayer;\n", " CanvasLayer.__name__ = \"CanvasLayer\";\n", " class CanvasView extends dom_view_1.DOMView {\n", " initialize() {\n", " super.initialize();\n", " const { output_backend, hidpi } = this.model;\n", " if (output_backend == \"webgl\") {\n", " this.webgl = global_webgl;\n", " }\n", " this.underlays_el = dom_1.div({ style });\n", " this.primary = new CanvasLayer(output_backend, hidpi);\n", " this.overlays = new CanvasLayer(output_backend, hidpi);\n", " this.overlays_el = dom_1.div({ style });\n", " this.events_el = dom_1.div({ class: \"bk-canvas-events\", style });\n", " const elements = [\n", " this.underlays_el,\n", " this.primary.el,\n", " this.overlays.el,\n", " this.overlays_el,\n", " this.events_el,\n", " ];\n", " object_1.extend(this.el.style, style);\n", " dom_1.append(this.el, ...elements);\n", " logging_1.logger.debug(\"CanvasView initialized\");\n", " }\n", " add_underlay(el) {\n", " this.underlays_el.appendChild(el);\n", " }\n", " add_overlay(el) {\n", " this.overlays_el.appendChild(el);\n", " }\n", " add_event(el) {\n", " this.events_el.appendChild(el);\n", " }\n", " get pixel_ratio() {\n", " return this.primary.pixel_ratio; // XXX: primary\n", " }\n", " resize(width, height) {\n", " this.bbox = new bbox_1.BBox({ left: 0, top: 0, width, height });\n", " this.primary.resize(width, height);\n", " this.overlays.resize(width, height);\n", " }\n", " prepare_webgl(frame_box) {\n", " // Prepare WebGL for a drawing pass\n", " const { webgl } = this;\n", " if (webgl != null) {\n", " // Sync canvas size\n", " const { width, height } = this.bbox;\n", " webgl.canvas.width = this.pixel_ratio * width;\n", " webgl.canvas.height = this.pixel_ratio * height;\n", " const { gl } = webgl;\n", " // Clipping\n", " gl.enable(gl.SCISSOR_TEST);\n", " const [sx, sy, w, h] = frame_box;\n", " const { xview, yview } = this.bbox;\n", " const vx = xview.compute(sx);\n", " const vy = yview.compute(sy + h);\n", " const ratio = this.pixel_ratio;\n", " gl.scissor(ratio * vx, ratio * vy, ratio * w, ratio * h); // lower left corner, width, height\n", " // Setup blending\n", " gl.enable(gl.BLEND);\n", " gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE_MINUS_DST_ALPHA, gl.ONE); // premultipliedAlpha == true\n", " }\n", " }\n", " clear_webgl() {\n", " const { webgl } = this;\n", " if (webgl != null) {\n", " // Prepare GL for drawing\n", " const { gl, canvas } = webgl;\n", " gl.viewport(0, 0, canvas.width, canvas.height);\n", " gl.clearColor(0, 0, 0, 0);\n", " gl.clear(gl.COLOR_BUFFER_BIT || gl.DEPTH_BUFFER_BIT);\n", " }\n", " }\n", " blit_webgl(ctx) {\n", " // This should be called when the ctx has no state except the HIDPI transform\n", " const { webgl } = this;\n", " if (webgl != null) {\n", " // Blit gl canvas into the 2D canvas. To do 1-on-1 blitting, we need\n", " // to remove the hidpi transform, then blit, then restore.\n", " // ctx.globalCompositeOperation = \"source-over\" -> OK; is the default\n", " logging_1.logger.debug('drawing with WebGL');\n", " ctx.restore();\n", " ctx.drawImage(webgl.canvas, 0, 0);\n", " // Set back hidpi transform\n", " ctx.save();\n", " if (this.model.hidpi) {\n", " const ratio = this.pixel_ratio;\n", " ctx.scale(ratio, ratio);\n", " ctx.translate(0.5, 0.5);\n", " }\n", " }\n", " }\n", " save(name) {\n", " const { output_backend } = this.model;\n", " const { width, height } = this.bbox;\n", " const composite = new CanvasLayer(output_backend, false);\n", " composite.resize(width, height);\n", " composite.ctx.drawImage(this.primary.canvas, 0, 0);\n", " composite.ctx.drawImage(this.overlays.canvas, 0, 0);\n", " composite.save(name);\n", " }\n", " }\n", " exports.CanvasView = CanvasView;\n", " CanvasView.__name__ = \"CanvasView\";\n", " class Canvas extends has_props_1.HasProps {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Canvas() {\n", " this.prototype.default_view = CanvasView;\n", " this.internal({\n", " hidpi: [p.Boolean, true],\n", " output_backend: [p.OutputBackend, \"canvas\"],\n", " });\n", " }\n", " }\n", " exports.Canvas = Canvas;\n", " Canvas.__name__ = \"Canvas\";\n", " Canvas.init_Canvas();\n", " },\n", " /* core/util/canvas.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " function fixup_line_dash(ctx) {\n", " if (!ctx.setLineDash) {\n", " ctx.setLineDash = (dash) => {\n", " ctx.mozDash = dash;\n", " ctx.webkitLineDash = dash;\n", " };\n", " }\n", " if (!ctx.getLineDash) {\n", " ctx.getLineDash = () => {\n", " return ctx.mozDash;\n", " };\n", " }\n", " }\n", " function fixup_line_dash_offset(ctx) {\n", " ctx.setLineDashOffset = (offset) => {\n", " ctx.lineDashOffset = offset;\n", " ctx.mozDashOffset = offset;\n", " ctx.webkitLineDashOffset = offset;\n", " };\n", " ctx.getLineDashOffset = () => {\n", " return ctx.mozDashOffset;\n", " };\n", " }\n", " function fixup_image_smoothing(ctx) {\n", " ctx.setImageSmoothingEnabled = (value) => {\n", " ctx.imageSmoothingEnabled = value;\n", " ctx.mozImageSmoothingEnabled = value;\n", " ctx.oImageSmoothingEnabled = value;\n", " ctx.webkitImageSmoothingEnabled = value;\n", " ctx.msImageSmoothingEnabled = value;\n", " };\n", " ctx.getImageSmoothingEnabled = () => {\n", " const val = ctx.imageSmoothingEnabled;\n", " return val != null ? val : true;\n", " };\n", " }\n", " function fixup_measure_text(ctx) {\n", " if (ctx.measureText && ctx.html5MeasureText == null) {\n", " ctx.html5MeasureText = ctx.measureText;\n", " ctx.measureText = (text) => {\n", " const textMetrics = ctx.html5MeasureText(text);\n", " // fake it til you make it\n", " textMetrics.ascent = ctx.html5MeasureText(\"m\").width * 1.6;\n", " return textMetrics;\n", " };\n", " }\n", " }\n", " function fixup_ellipse(ctx) {\n", " // implementing the ctx.ellipse function with bezier curves\n", " // we don't implement the startAngle, endAngle and anticlockwise arguments.\n", " function ellipse_bezier(x, y, radiusX, radiusY, rotation, _startAngle, _endAngle, anticlockwise = false) {\n", " const c = 0.551784; // see http://www.tinaja.com/glib/ellipse4.pdf\n", " ctx.translate(x, y);\n", " ctx.rotate(rotation);\n", " let rx = radiusX;\n", " let ry = radiusY;\n", " if (anticlockwise) {\n", " rx = -radiusX;\n", " ry = -radiusY;\n", " }\n", " ctx.moveTo(-rx, 0); // start point of first curve\n", " ctx.bezierCurveTo(-rx, ry * c, -rx * c, ry, 0, ry);\n", " ctx.bezierCurveTo(rx * c, ry, rx, ry * c, rx, 0);\n", " ctx.bezierCurveTo(rx, -ry * c, rx * c, -ry, 0, -ry);\n", " ctx.bezierCurveTo(-rx * c, -ry, -rx, -ry * c, -rx, 0);\n", " ctx.rotate(-rotation);\n", " ctx.translate(-x, -y);\n", " }\n", " if (!ctx.ellipse)\n", " ctx.ellipse = ellipse_bezier;\n", " }\n", " function fixup_ctx(ctx) {\n", " fixup_line_dash(ctx);\n", " fixup_line_dash_offset(ctx);\n", " fixup_image_smoothing(ctx);\n", " fixup_measure_text(ctx);\n", " fixup_ellipse(ctx);\n", " }\n", " exports.fixup_ctx = fixup_ctx;\n", " },\n", " /* core/util/svg.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " /**\n", " * Based on https://github.com/gliffy/canvas2svg\n", " */\n", " const types_1 = require(8) /* ./types */;\n", " function svg_children(node) {\n", " return [...node.childNodes];\n", " }\n", " // helper function that generates a random string\n", " function randomString(holder) {\n", " if (!holder) {\n", " throw new Error(\"cannot create a random attribute name for an undefined object\");\n", " }\n", " const chars = \"ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz\";\n", " let randomstring = \"\";\n", " do {\n", " randomstring = \"\";\n", " for (let i = 0; i < 12; i++) {\n", " randomstring += chars[Math.floor(Math.random() * chars.length)];\n", " }\n", " } while (holder[randomstring]);\n", " return randomstring;\n", " }\n", " // helper function to map named to numbered entities\n", " function createNamedToNumberedLookup(input, radix) {\n", " const lookup = new Map();\n", " const items = input.split(',');\n", " radix = radix || 10;\n", " // Map from named to numbered entities.\n", " for (let i = 0; i < items.length; i += 2) {\n", " const entity = '&' + items[i + 1] + ';';\n", " const base10 = parseInt(items[i], radix);\n", " lookup.set(entity, '&#' + base10 + ';');\n", " }\n", " // FF and IE need to create a regex from hex values ie   == \\xa0\n", " lookup.set(\"\\\\xa0\", ' ');\n", " return lookup;\n", " }\n", " // helper function to map canvas-textAlign to svg-textAnchor\n", " function getTextAnchor(textAlign) {\n", " // TODO: support rtl languages\n", " const mapping = { left: \"start\", right: \"end\", center: \"middle\", start: \"start\", end: \"end\" };\n", " return mapping[textAlign] || mapping.start;\n", " }\n", " // helper function to map canvas-textBaseline to svg-dominantBaseline\n", " function getDominantBaseline(textBaseline) {\n", " // INFO: not supported in all browsers\n", " const mapping = { alphabetic: \"alphabetic\", hanging: \"hanging\", top: \"text-before-edge\", bottom: \"text-after-edge\", middle: \"central\" };\n", " return mapping[textBaseline] || mapping.alphabetic;\n", " }\n", " // Unpack entities lookup where the numbers are in radix 32 to reduce the size\n", " // entity mapping courtesy of tinymce\n", " const namedEntities = createNamedToNumberedLookup('50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,' +\n", " '5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,' +\n", " '5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,' +\n", " '5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,' +\n", " '68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,' +\n", " '6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,' +\n", " '6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,' +\n", " '75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,' +\n", " '7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,' +\n", " '7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,' +\n", " 'sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,' +\n", " 'st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,' +\n", " 't9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,' +\n", " 'tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,' +\n", " 'u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,' +\n", " '81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,' +\n", " '8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,' +\n", " '8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,' +\n", " '8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,' +\n", " '8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,' +\n", " 'nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,' +\n", " 'rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,' +\n", " 'Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,' +\n", " '80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,' +\n", " '811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro', 32);\n", " // Some basic mappings for attributes and default values.\n", " const STYLES = {\n", " strokeStyle: {\n", " svgAttr: \"stroke\",\n", " canvas: \"#000000\",\n", " svg: \"none\",\n", " apply: \"stroke\",\n", " },\n", " fillStyle: {\n", " svgAttr: \"fill\",\n", " canvas: \"#000000\",\n", " svg: null,\n", " apply: \"fill\",\n", " },\n", " lineCap: {\n", " svgAttr: \"stroke-linecap\",\n", " canvas: \"butt\",\n", " svg: \"butt\",\n", " apply: \"stroke\",\n", " },\n", " lineJoin: {\n", " svgAttr: \"stroke-linejoin\",\n", " canvas: \"miter\",\n", " svg: \"miter\",\n", " apply: \"stroke\",\n", " },\n", " miterLimit: {\n", " svgAttr: \"stroke-miterlimit\",\n", " canvas: 10,\n", " svg: 4,\n", " apply: \"stroke\",\n", " },\n", " lineWidth: {\n", " svgAttr: \"stroke-width\",\n", " canvas: 1,\n", " svg: 1,\n", " apply: \"stroke\",\n", " },\n", " globalAlpha: {\n", " svgAttr: \"opacity\",\n", " canvas: 1,\n", " svg: 1,\n", " apply: \"fill stroke\",\n", " },\n", " font: {\n", " // font converts to multiple svg attributes, there is custom logic for this\n", " canvas: \"10px sans-serif\",\n", " },\n", " shadowColor: {\n", " canvas: \"#000000\",\n", " },\n", " shadowOffsetX: {\n", " canvas: 0,\n", " },\n", " shadowOffsetY: {\n", " canvas: 0,\n", " },\n", " shadowBlur: {\n", " canvas: 0,\n", " },\n", " textAlign: {\n", " canvas: \"start\",\n", " },\n", " textBaseline: {\n", " canvas: \"alphabetic\",\n", " },\n", " lineDash: {\n", " svgAttr: \"stroke-dasharray\",\n", " canvas: [],\n", " svg: null,\n", " apply: \"stroke\",\n", " },\n", " };\n", " class CanvasGradient {\n", " constructor(gradientNode, ctx) {\n", " this.__root = gradientNode;\n", " this.__ctx = ctx;\n", " }\n", " /**\n", " * Adds a color stop to the gradient root\n", " */\n", " addColorStop(offset, color) {\n", " const stop = this.__ctx.__createElement(\"stop\");\n", " stop.setAttribute(\"offset\", `${offset}`);\n", " if (color.indexOf(\"rgba\") !== -1) {\n", " // separate alpha value, since webkit can't handle it\n", " const regex = /rgba\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d?\\.?\\d*)\\s*\\)/gi;\n", " const matches = regex.exec(color);\n", " const [, r, g, b, a] = matches;\n", " stop.setAttribute(\"stop-color\", `rgb(${r},${g},${b})`);\n", " stop.setAttribute(\"stop-opacity\", a);\n", " }\n", " else {\n", " stop.setAttribute(\"stop-color\", color);\n", " }\n", " this.__root.appendChild(stop);\n", " }\n", " }\n", " CanvasGradient.__name__ = \"CanvasGradient\";\n", " class CanvasPattern {\n", " constructor(pattern, ctx) {\n", " this.__root = pattern;\n", " this.__ctx = ctx;\n", " }\n", " }\n", " CanvasPattern.__name__ = \"CanvasPattern\";\n", " /**\n", " * The mock canvas context\n", " * @param o - options include:\n", " * ctx - existing Context2D to wrap around\n", " * width - width of your canvas (defaults to 500)\n", " * height - height of your canvas (defaults to 500)\n", " * enableMirroring - enables canvas mirroring (get image data) (defaults to false)\n", " * document - the document object (defaults to the current document)\n", " */\n", " class SVGRenderingContext2D /*implements CanvasRenderingContext2D*/ {\n", " constructor(options) {\n", " var _a, _b, _c, _d;\n", " this.__currentPosition = null;\n", " this.__currentElementsToStyle = null;\n", " this.enableMirroring = (_a = options === null || options === void 0 ? void 0 : options.enableMirroring) !== null && _a !== void 0 ? _a : false;\n", " this.__document = (_b = options === null || options === void 0 ? void 0 : options.document) !== null && _b !== void 0 ? _b : document;\n", " // allow passing in an existing context to wrap around\n", " // if a context is passed in, we know a canvas already exist\n", " if (options === null || options === void 0 ? void 0 : options.ctx) {\n", " this.__ctx = options.ctx;\n", " }\n", " else {\n", " this.__canvas = this.__document.createElement(\"canvas\");\n", " this.__ctx = this.__canvas.getContext(\"2d\");\n", " }\n", " this.__setDefaultStyles();\n", " this.__stack = [this.__getStyleState()];\n", " this.__groupStack = [];\n", " // the root svg element\n", " this.__root = this.__document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n", " this.__root.setAttribute(\"version\", \"1.1\");\n", " this.__root.setAttribute(\"xmlns\", \"http://www.w3.org/2000/svg\");\n", " this.__root.setAttributeNS(\"http://www.w3.org/2000/xmlns/\", \"xmlns:xlink\", \"http://www.w3.org/1999/xlink\");\n", " this.width = (_c = options === null || options === void 0 ? void 0 : options.width) !== null && _c !== void 0 ? _c : 500;\n", " this.height = (_d = options === null || options === void 0 ? void 0 : options.height) !== null && _d !== void 0 ? _d : 500;\n", " // make sure we don't generate the same ids in defs\n", " this.__ids = {};\n", " // defs tag\n", " this.__defs = this.__document.createElementNS(\"http://www.w3.org/2000/svg\", \"defs\");\n", " this.__root.appendChild(this.__defs);\n", " // also add a group child. the svg element can't use the transform attribute\n", " this.__currentElement = this.__document.createElementNS(\"http://www.w3.org/2000/svg\", \"g\");\n", " this.__root.appendChild(this.__currentElement);\n", " }\n", " get canvas() {\n", " // XXX: point back to this instance\n", " return this;\n", " }\n", " get width() {\n", " return this._width;\n", " }\n", " set width(width) {\n", " this._width = width;\n", " this.__root.setAttribute(\"width\", `${width}`);\n", " }\n", " get height() {\n", " return this._height;\n", " }\n", " set height(height) {\n", " this._height = height;\n", " this.__root.setAttribute(\"height\", `${height}`);\n", " }\n", " /**\n", " * Creates the specified svg element\n", " */\n", " __createElement(elementName, properties = {}, resetFill = false) {\n", " const element = this.__document.createElementNS(\"http://www.w3.org/2000/svg\", elementName);\n", " if (resetFill) {\n", " // if fill or stroke is not specified, the svg element should not display. By default SVG's fill is black.\n", " element.setAttribute(\"fill\", \"none\");\n", " element.setAttribute(\"stroke\", \"none\");\n", " }\n", " const keys = Object.keys(properties);\n", " for (const key of keys) {\n", " element.setAttribute(key, `${properties[key]}`);\n", " }\n", " return element;\n", " }\n", " /**\n", " * Applies default canvas styles to the context\n", " */\n", " __setDefaultStyles() {\n", " // default 2d canvas context properties see:http://www.w3.org/TR/2dcontext/\n", " const keys = Object.keys(STYLES);\n", " const self = this;\n", " for (let i = 0; i < keys.length; i++) {\n", " const key = keys[i];\n", " self[key] = STYLES[key].canvas;\n", " }\n", " }\n", " /**\n", " * Applies styles on restore\n", " */\n", " __applyStyleState(styleState) {\n", " const keys = Object.keys(styleState);\n", " const self = this;\n", " for (let i = 0; i < keys.length; i++) {\n", " const key = keys[i];\n", " self[key] = styleState[key];\n", " }\n", " }\n", " /**\n", " * Gets the current style state\n", " */\n", " __getStyleState() {\n", " const keys = Object.keys(STYLES);\n", " const styleState = {};\n", " for (let i = 0; i < keys.length; i++) {\n", " const key = keys[i];\n", " styleState[key] = this[key];\n", " }\n", " return styleState;\n", " }\n", " /**\n", " * Apples the current styles to the current SVG element. On \"ctx.fill\" or \"ctx.stroke\"\n", " */\n", " __applyStyleToCurrentElement(type) {\n", " let currentElement = this.__currentElement;\n", " const currentStyleGroup = this.__currentElementsToStyle;\n", " if (currentStyleGroup != null) {\n", " currentElement.setAttribute(type, \"\");\n", " currentElement = currentStyleGroup.element;\n", " for (const node of currentStyleGroup.children) {\n", " node.setAttribute(type, \"\");\n", " }\n", " }\n", " const keys = Object.keys(STYLES);\n", " for (let i = 0; i < keys.length; i++) {\n", " const style = STYLES[keys[i]];\n", " const value = this[keys[i]];\n", " if (style.apply) {\n", " // is this a gradient or pattern?\n", " if (value instanceof CanvasPattern) {\n", " // pattern\n", " if (value.__ctx) {\n", " // copy over defs\n", " while (value.__ctx.__defs.childNodes.length) {\n", " const id = svg_children(value.__ctx.__defs)[0].getAttribute(\"id\");\n", " this.__ids[id] = id;\n", " this.__defs.appendChild(value.__ctx.__defs.childNodes[0]);\n", " }\n", " }\n", " const id = value.__root.getAttribute(\"id\");\n", " currentElement.setAttribute(style.apply, `url(#${id})`);\n", " }\n", " else if (value instanceof CanvasGradient) {\n", " // gradient\n", " const id = value.__root.getAttribute(\"id\");\n", " currentElement.setAttribute(style.apply, `url(#${id})`);\n", " }\n", " else if (style.apply.indexOf(type) !== -1 && style.svg !== value) {\n", " if ((style.svgAttr === \"stroke\" || style.svgAttr === \"fill\") && types_1.isString(value) && value.indexOf(\"rgba\") !== -1) {\n", " // separate alpha value, since illustrator can't handle it\n", " const regex = /rgba\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d?\\.?\\d*)\\s*\\)/gi;\n", " const matches = regex.exec(value);\n", " const [, r, g, b, a] = matches;\n", " currentElement.setAttribute(style.svgAttr, `rgb(${r},${g},${b})`);\n", " // should take globalAlpha here\n", " let opacity = parseFloat(a);\n", " const globalAlpha = this.globalAlpha;\n", " if (globalAlpha != null) {\n", " opacity *= globalAlpha;\n", " }\n", " currentElement.setAttribute(style.svgAttr + \"-opacity\", `${opacity}`);\n", " }\n", " else {\n", " let attr = style.svgAttr;\n", " if (keys[i] === 'globalAlpha') {\n", " attr = type + '-' + style.svgAttr;\n", " if (currentElement.getAttribute(attr)) {\n", " // fill-opacity or stroke-opacity has already been set by stroke or fill.\n", " continue;\n", " }\n", " }\n", " // otherwise only update attribute if right type, and not svg default\n", " currentElement.setAttribute(attr, `${value}`);\n", " }\n", " }\n", " }\n", " }\n", " }\n", " /**\n", " * Will return the closest group or svg node. May return the current element.\n", " */\n", " __closestGroupOrSvg(node = this.__currentElement) {\n", " if (node.nodeName === \"g\" || node.nodeName === \"svg\") {\n", " return node;\n", " }\n", " else {\n", " return this.__closestGroupOrSvg(node.parentNode);\n", " }\n", " }\n", " /**\n", " * Returns the serialized value of the svg so far\n", " * @param fixNamedEntities - Standalone SVG doesn't support named entities, which document.createTextNode encodes.\n", " * If true, we attempt to find all named entities and encode it as a numeric entity.\n", " * @return serialized svg\n", " */\n", " getSerializedSvg(fixNamedEntities = false) {\n", " let serialized = new XMLSerializer().serializeToString(this.__root);\n", " // IE search for a duplicate xmnls because they didn't implement setAttributeNS correctly\n", " const xmlns = /xmlns=\"http:\\/\\/www\\.w3\\.org\\/2000\\/svg\".+xmlns=\"http:\\/\\/www\\.w3\\.org\\/2000\\/svg/gi;\n", " if (xmlns.test(serialized)) {\n", " serialized = serialized.replace('xmlns=\"http://www.w3.org/2000/svg', 'xmlns:xlink=\"http://www.w3.org/1999/xlink');\n", " }\n", " if (fixNamedEntities) {\n", " // loop over each named entity and replace with the proper equivalent.\n", " for (const [key, value] of namedEntities) {\n", " const regexp = new RegExp(key, \"gi\");\n", " if (regexp.test(serialized)) {\n", " serialized = serialized.replace(regexp, value);\n", " }\n", " }\n", " }\n", " return serialized;\n", " }\n", " getSvg() {\n", " return this.__root;\n", " }\n", " /**\n", " * Will generate a group tag.\n", " */\n", " save() {\n", " const group = this.__createElement(\"g\");\n", " const parent = this.__closestGroupOrSvg();\n", " this.__groupStack.push(parent);\n", " parent.appendChild(group);\n", " this.__currentElement = group;\n", " this.__stack.push(this.__getStyleState());\n", " }\n", " /**\n", " * Sets current element to parent, or just root if already root\n", " */\n", " restore() {\n", " this.__currentElement = this.__groupStack.pop();\n", " this.__currentElementsToStyle = null;\n", " // Clearing canvas will make the poped group invalid, currentElement is set to the root group node.\n", " if (!this.__currentElement) {\n", " this.__currentElement = svg_children(this.__root)[1];\n", " }\n", " const state = this.__stack.pop();\n", " this.__applyStyleState(state);\n", " }\n", " /**\n", " * Helper method to add transform\n", " */\n", " __addTransform(t) {\n", " // if the current element has siblings, add another group\n", " const parent = this.__closestGroupOrSvg();\n", " if (parent.childNodes.length > 0) {\n", " if (this.__currentElement.nodeName === \"path\") {\n", " if (!this.__currentElementsToStyle) {\n", " this.__currentElementsToStyle = { element: parent, children: [] };\n", " }\n", " this.__currentElementsToStyle.children.push(this.__currentElement);\n", " this.__applyCurrentDefaultPath();\n", " }\n", " const group = this.__createElement(\"g\");\n", " parent.appendChild(group);\n", " this.__currentElement = group;\n", " }\n", " let transform = this.__currentElement.getAttribute(\"transform\");\n", " if (transform) {\n", " if (transform.includes(t))\n", " return;\n", " transform += \" \";\n", " }\n", " else {\n", " transform = \"\";\n", " }\n", " transform += t;\n", " this.__currentElement.setAttribute(\"transform\", transform);\n", " }\n", " /**\n", " * scales the current element\n", " */\n", " scale(x, y) {\n", " this.__addTransform(`scale(${x},${y !== null && y !== void 0 ? y : x})`);\n", " }\n", " /**\n", " * rotates the current element\n", " */\n", " rotate(angle) {\n", " const degrees = (angle * 180 / Math.PI);\n", " const [cx, cy] = [0, 0];\n", " this.__addTransform(`rotate(${degrees},${cx},${cy})`);\n", " }\n", " /**\n", " * translates the current element\n", " */\n", " translate(x, y) {\n", " this.__addTransform(`translate(${x},${y})`);\n", " }\n", " /**\n", " * applies a transform to the current element\n", " */\n", " transform(a, b, c, d, e, f) {\n", " this.__addTransform(`matrix(${a},${b},${c},${d},${e},${f})`);\n", " }\n", " /**\n", " * Create a new Path Element\n", " */\n", " beginPath() {\n", " // Note that there is only one current default path, it is not part of the drawing state.\n", " // See also: https://html.spec.whatwg.org/multipage/scripting.html#current-default-path\n", " this.__currentDefaultPath = \"\";\n", " this.__currentPosition = null;\n", " const path = this.__createElement(\"path\", {}, true);\n", " const parent = this.__closestGroupOrSvg();\n", " parent.appendChild(path);\n", " this.__currentElement = path;\n", " }\n", " /**\n", " * Helper function to apply currentDefaultPath to current path element\n", " */\n", " __applyCurrentDefaultPath() {\n", " const currentElement = this.__currentElement;\n", " if (currentElement.nodeName === \"path\") {\n", " currentElement.setAttribute(\"d\", this.__currentDefaultPath);\n", " }\n", " else {\n", " console.error(\"Attempted to apply path command to node\", currentElement.nodeName);\n", " }\n", " }\n", " /**\n", " * Helper function to add path command\n", " */\n", " __addPathCommand(command) {\n", " this.__currentDefaultPath += \" \";\n", " this.__currentDefaultPath += command;\n", " }\n", " /**\n", " * Adds the move command to the current path element,\n", " * if the currentPathElement is not empty create a new path element\n", " */\n", " moveTo(x, y) {\n", " if (this.__currentElement.nodeName !== \"path\") {\n", " this.beginPath();\n", " }\n", " // creates a new subpath with the given point\n", " this.__currentPosition = { x, y };\n", " this.__addPathCommand(`M ${x} ${y}`);\n", " }\n", " /**\n", " * Closes the current path\n", " */\n", " closePath() {\n", " if (this.__currentDefaultPath) {\n", " this.__addPathCommand(\"Z\");\n", " }\n", " }\n", " /**\n", " * Adds a line to command\n", " */\n", " lineTo(x, y) {\n", " this.__currentPosition = { x, y };\n", " if (this.__currentDefaultPath.indexOf('M') > -1) {\n", " this.__addPathCommand(`L ${x} ${y}`);\n", " }\n", " else {\n", " this.__addPathCommand(`M ${x} ${y}`);\n", " }\n", " }\n", " /**\n", " * Add a bezier command\n", " */\n", " bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y) {\n", " this.__currentPosition = { x, y };\n", " this.__addPathCommand(`C ${cp1x} ${cp1y} ${cp2x} ${cp2y} ${x} ${y}`);\n", " }\n", " /**\n", " * Adds a quadratic curve to command\n", " */\n", " quadraticCurveTo(cpx, cpy, x, y) {\n", " this.__currentPosition = { x, y };\n", " this.__addPathCommand(`Q ${cpx} ${cpy} ${x} ${y}`);\n", " }\n", " /**\n", " * Adds the arcTo to the current path\n", " *\n", " * @see http://www.w3.org/TR/2015/WD-2dcontext-20150514/#dom-context-2d-arcto\n", " */\n", " arcTo(x1, y1, x2, y2, radius) {\n", " // Let the point (x0, y0) be the last point in the subpath.\n", " if (this.__currentPosition == null)\n", " return;\n", " const x0 = this.__currentPosition.x;\n", " const y0 = this.__currentPosition.y;\n", " // Negative values for radius must cause the implementation to throw an IndexSizeError exception.\n", " if (radius < 0) {\n", " throw new Error(\"IndexSizeError: The radius provided (\" + radius + \") is negative.\");\n", " }\n", " // If the point (x0, y0) is equal to the point (x1, y1),\n", " // or if the point (x1, y1) is equal to the point (x2, y2),\n", " // or if the radius radius is zero,\n", " // then the method must add the point (x1, y1) to the subpath,\n", " // and connect that point to the previous point (x0, y0) by a straight line.\n", " if (((x0 === x1) && (y0 === y1)) || ((x1 === x2) && (y1 === y2)) || (radius === 0)) {\n", " this.lineTo(x1, y1);\n", " return;\n", " }\n", " function normalize([x, y]) {\n", " const len = Math.sqrt(x ** 2 + y ** 2);\n", " return [x / len, y / len];\n", " }\n", " // Otherwise, if the points (x0, y0), (x1, y1), and (x2, y2) all lie on a single straight line,\n", " // then the method must add the point (x1, y1) to the subpath,\n", " // and connect that point to the previous point (x0, y0) by a straight line.\n", " const unit_vec_p1_p0 = normalize([x0 - x1, y0 - y1]);\n", " const unit_vec_p1_p2 = normalize([x2 - x1, y2 - y1]);\n", " if (unit_vec_p1_p0[0] * unit_vec_p1_p2[1] === unit_vec_p1_p0[1] * unit_vec_p1_p2[0]) {\n", " this.lineTo(x1, y1);\n", " return;\n", " }\n", " // Otherwise, let The Arc be the shortest arc given by circumference of the circle that has radius radius,\n", " // and that has one point tangent to the half-infinite line that crosses the point (x0, y0) and ends at the point (x1, y1),\n", " // and that has a different point tangent to the half-infinite line that ends at the point (x1, y1), and crosses the point (x2, y2).\n", " // The points at which this circle touches these two lines are called the start and end tangent points respectively.\n", " // note that both vectors are unit vectors, so the length is 1\n", " const cos = (unit_vec_p1_p0[0] * unit_vec_p1_p2[0] + unit_vec_p1_p0[1] * unit_vec_p1_p2[1]);\n", " const theta = Math.acos(Math.abs(cos));\n", " // Calculate origin\n", " const unit_vec_p1_origin = normalize([\n", " unit_vec_p1_p0[0] + unit_vec_p1_p2[0],\n", " unit_vec_p1_p0[1] + unit_vec_p1_p2[1],\n", " ]);\n", " const len_p1_origin = radius / Math.sin(theta / 2);\n", " const x = x1 + len_p1_origin * unit_vec_p1_origin[0];\n", " const y = y1 + len_p1_origin * unit_vec_p1_origin[1];\n", " // Calculate start angle and end angle\n", " // rotate 90deg clockwise (note that y axis points to its down)\n", " const unit_vec_origin_start_tangent = [\n", " -unit_vec_p1_p0[1],\n", " unit_vec_p1_p0[0],\n", " ];\n", " // rotate 90deg counter clockwise (note that y axis points to its down)\n", " const unit_vec_origin_end_tangent = [\n", " unit_vec_p1_p2[1],\n", " -unit_vec_p1_p2[0],\n", " ];\n", " function getAngle(vector) {\n", " // get angle (clockwise) between vector and (1, 0)\n", " const x = vector[0];\n", " const y = vector[1];\n", " if (y >= 0) { // note that y axis points to its down\n", " return Math.acos(x);\n", " }\n", " else {\n", " return -Math.acos(x);\n", " }\n", " }\n", " const startAngle = getAngle(unit_vec_origin_start_tangent);\n", " const endAngle = getAngle(unit_vec_origin_end_tangent);\n", " // Connect the point (x0, y0) to the start tangent point by a straight line\n", " this.lineTo(x + unit_vec_origin_start_tangent[0] * radius, y + unit_vec_origin_start_tangent[1] * radius);\n", " // Connect the start tangent point to the end tangent point by arc\n", " // and adding the end tangent point to the subpath.\n", " this.arc(x, y, radius, startAngle, endAngle);\n", " }\n", " /**\n", " * Sets the stroke property on the current element\n", " */\n", " stroke() {\n", " if (this.__currentElement.nodeName === \"path\") {\n", " this.__currentElement.setAttribute(\"paint-order\", \"fill stroke markers\");\n", " }\n", " this.__applyCurrentDefaultPath();\n", " this.__applyStyleToCurrentElement(\"stroke\");\n", " }\n", " /**\n", " * Sets fill properties on the current element\n", " */\n", " fill() {\n", " if (this.__currentElement.nodeName === \"path\") {\n", " this.__currentElement.setAttribute(\"paint-order\", \"stroke fill markers\");\n", " }\n", " this.__applyCurrentDefaultPath();\n", " this.__applyStyleToCurrentElement(\"fill\");\n", " }\n", " /**\n", " * Adds a rectangle to the path.\n", " */\n", " rect(x, y, width, height) {\n", " if (this.__currentElement.nodeName !== \"path\") {\n", " this.beginPath();\n", " }\n", " this.moveTo(x, y);\n", " this.lineTo(x + width, y);\n", " this.lineTo(x + width, y + height);\n", " this.lineTo(x, y + height);\n", " this.lineTo(x, y);\n", " this.closePath();\n", " }\n", " /**\n", " * adds a rectangle element\n", " */\n", " fillRect(x, y, width, height) {\n", " const rect = this.__createElement(\"rect\", { x, y, width, height }, true);\n", " const parent = this.__closestGroupOrSvg();\n", " parent.appendChild(rect);\n", " this.__currentElement = rect;\n", " this.__applyStyleToCurrentElement(\"fill\");\n", " }\n", " /**\n", " * Draws a rectangle with no fill\n", " * @param x\n", " * @param y\n", " * @param width\n", " * @param height\n", " */\n", " strokeRect(x, y, width, height) {\n", " const rect = this.__createElement(\"rect\", { x, y, width, height }, true);\n", " const parent = this.__closestGroupOrSvg();\n", " parent.appendChild(rect);\n", " this.__currentElement = rect;\n", " this.__applyStyleToCurrentElement(\"stroke\");\n", " }\n", " /**\n", " * Clear entire canvas:\n", " * 1. save current transforms\n", " * 2. remove all the childNodes of the root g element\n", " */\n", " __clearCanvas() {\n", " const current = this.__closestGroupOrSvg();\n", " const transform = current.getAttribute(\"transform\");\n", " const rootGroup = svg_children(this.__root)[1];\n", " const childNodes = rootGroup.childNodes;\n", " for (let i = childNodes.length - 1; i >= 0; i--) {\n", " if (childNodes[i]) {\n", " rootGroup.removeChild(childNodes[i]);\n", " }\n", " }\n", " this.__currentElement = rootGroup;\n", " // reset __groupStack as all the child group nodes are all removed.\n", " this.__groupStack = [];\n", " if (transform) {\n", " this.__addTransform(transform);\n", " }\n", " }\n", " /**\n", " * \"Clears\" a canvas by just drawing a white rectangle in the current group.\n", " */\n", " clearRect(x, y, width, height) {\n", " if (x === 0 && y === 0 && width === this.width && height === this.height) {\n", " this.__clearCanvas();\n", " return;\n", " }\n", " const rect = this.__createElement(\"rect\", { x, y, width, height, fill: \"#FFFFFF\" }, true);\n", " const parent = this.__closestGroupOrSvg();\n", " parent.appendChild(rect);\n", " }\n", " /**\n", " * Adds a linear gradient to a defs tag.\n", " * Returns a canvas gradient object that has a reference to it's parent def\n", " */\n", " createLinearGradient(x1, y1, x2, y2) {\n", " const grad = this.__createElement(\"linearGradient\", {\n", " id: randomString(this.__ids),\n", " x1: x1 + \"px\",\n", " x2: x2 + \"px\",\n", " y1: y1 + \"px\",\n", " y2: y2 + \"px\",\n", " gradientUnits: \"userSpaceOnUse\",\n", " }, false);\n", " this.__defs.appendChild(grad);\n", " return new CanvasGradient(grad, this);\n", " }\n", " /**\n", " * Adds a radial gradient to a defs tag.\n", " * Returns a canvas gradient object that has a reference to it's parent def\n", " */\n", " createRadialGradient(x0, y0, _r0, x1, y1, r1) {\n", " const grad = this.__createElement(\"radialGradient\", {\n", " id: randomString(this.__ids),\n", " cx: x1 + \"px\",\n", " cy: y1 + \"px\",\n", " r: r1 + \"px\",\n", " fx: x0 + \"px\",\n", " fy: y0 + \"px\",\n", " gradientUnits: \"userSpaceOnUse\",\n", " }, false);\n", " this.__defs.appendChild(grad);\n", " return new CanvasGradient(grad, this);\n", " }\n", " /**\n", " * Parses the font string and returns svg mapping\n", " */\n", " __parseFont() {\n", " const regex = /^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))(?:\\s*\\/\\s*(normal|[.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])))?\\s*([-,\\'\\\"\\sa-z0-9]+?)\\s*$/i;\n", " const fontPart = regex.exec(this.font);\n", " const data = {\n", " style: fontPart[1] || 'normal',\n", " size: fontPart[4] || '10px',\n", " family: fontPart[6] || 'sans-serif',\n", " weight: fontPart[3] || 'normal',\n", " decoration: fontPart[2] || 'normal',\n", " };\n", " // canvas doesn't support underline natively, but we can pass this attribute\n", " if (this.__fontUnderline === \"underline\") {\n", " data.decoration = \"underline\";\n", " }\n", " // canvas also doesn't support linking, but we can pass this as well\n", " if (this.__fontHref != null) {\n", " data.href = this.__fontHref;\n", " }\n", " return data;\n", " }\n", " /**\n", " * Helper to link text fragments\n", " */\n", " __wrapTextLink(font, element) {\n", " if (font.href) {\n", " const a = this.__createElement(\"a\");\n", " a.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", font.href);\n", " a.appendChild(element);\n", " return a;\n", " }\n", " return element;\n", " }\n", " /**\n", " * Fills or strokes text\n", " */\n", " __applyText(text, x, y, action) {\n", " const font = this.__parseFont();\n", " const parent = this.__closestGroupOrSvg();\n", " const textElement = this.__createElement(\"text\", {\n", " \"font-family\": font.family,\n", " \"font-size\": font.size,\n", " \"font-style\": font.style,\n", " \"font-weight\": font.weight,\n", " \"text-decoration\": font.decoration,\n", " x,\n", " y,\n", " \"text-anchor\": getTextAnchor(this.textAlign),\n", " \"dominant-baseline\": getDominantBaseline(this.textBaseline),\n", " }, true);\n", " textElement.appendChild(this.__document.createTextNode(text));\n", " this.__currentElement = textElement;\n", " this.__applyStyleToCurrentElement(action);\n", " parent.appendChild(this.__wrapTextLink(font, textElement));\n", " }\n", " /**\n", " * Creates a text element\n", " */\n", " fillText(text, x, y) {\n", " this.__applyText(text, x, y, \"fill\");\n", " }\n", " /**\n", " * Strokes text\n", " */\n", " strokeText(text, x, y) {\n", " this.__applyText(text, x, y, \"stroke\");\n", " }\n", " /**\n", " * No need to implement this for svg.\n", " */\n", " measureText(text) {\n", " this.__ctx.font = this.font;\n", " return this.__ctx.measureText(text);\n", " }\n", " arc(x, y, radius, startAngle, endAngle, counterClockwise = false) {\n", " // in canvas no circle is drawn if no angle is provided.\n", " if (startAngle === endAngle) {\n", " return;\n", " }\n", " startAngle = startAngle % (2 * Math.PI);\n", " endAngle = endAngle % (2 * Math.PI);\n", " if (startAngle === endAngle) {\n", " // circle time! subtract some of the angle so svg is happy (svg elliptical arc can't draw a full circle)\n", " endAngle = ((endAngle + (2 * Math.PI)) - 0.001 * (counterClockwise ? -1 : 1)) % (2 * Math.PI);\n", " }\n", " const endX = x + radius * Math.cos(endAngle);\n", " const endY = y + radius * Math.sin(endAngle);\n", " const startX = x + radius * Math.cos(startAngle);\n", " const startY = y + radius * Math.sin(startAngle);\n", " const sweepFlag = counterClockwise ? 0 : 1;\n", " let largeArcFlag = 0;\n", " let diff = endAngle - startAngle;\n", " // https://github.com/gliffy/canvas2svg/issues/4\n", " if (diff < 0) {\n", " diff += 2 * Math.PI;\n", " }\n", " if (counterClockwise) {\n", " largeArcFlag = diff > Math.PI ? 0 : 1;\n", " }\n", " else {\n", " largeArcFlag = diff > Math.PI ? 1 : 0;\n", " }\n", " this.moveTo(startX, startY);\n", " const rx = radius;\n", " const ry = radius;\n", " const xAxisRotation = 0;\n", " this.__addPathCommand(`A ${rx} ${ry} ${xAxisRotation} ${largeArcFlag} ${sweepFlag} ${endX} ${endY}`);\n", " this.__currentPosition = { x: endX, y: endY };\n", " }\n", " /**\n", " * Generates a ClipPath from the clip command.\n", " */\n", " clip() {\n", " const group = this.__closestGroupOrSvg();\n", " const clipPath = this.__createElement(\"clipPath\");\n", " const id = randomString(this.__ids);\n", " const newGroup = this.__createElement(\"g\");\n", " this.__applyCurrentDefaultPath();\n", " group.removeChild(this.__currentElement);\n", " clipPath.setAttribute(\"id\", id);\n", " clipPath.appendChild(this.__currentElement);\n", " this.__defs.appendChild(clipPath);\n", " // set the clip path to this group\n", " group.setAttribute(\"clip-path\", `url(#${id})`);\n", " // clip paths can be scaled and transformed, we need to add another wrapper group to avoid later transformations\n", " // to this path\n", " group.appendChild(newGroup);\n", " this.__currentElement = newGroup;\n", " }\n", " /**\n", " * Draws a canvas, image or mock context to this canvas.\n", " * Note that all svg dom manipulation uses node.childNodes rather than node.children for IE support.\n", " * http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-context-2d-drawimage\n", " */\n", " drawImage(image, ...args) {\n", " let dx, dy;\n", " let dw, dh;\n", " let sx, sy;\n", " let sw, sh;\n", " if (args.length == 2) {\n", " [dx, dy] = args;\n", " sx = 0;\n", " sy = 0;\n", " sw = image.width;\n", " sh = image.height;\n", " dw = sw;\n", " dh = sh;\n", " }\n", " else if (args.length == 4) {\n", " [dx, dy, dw, dh] = args;\n", " sx = 0;\n", " sy = 0;\n", " sw = image.width;\n", " sh = image.height;\n", " }\n", " else if (args.length === 8) {\n", " [sx, sy, sw, sh, dx, dy, dw, dh] = args;\n", " }\n", " else {\n", " throw new Error(`Inavlid number of arguments passed to drawImage: ${arguments.length}`);\n", " }\n", " // parent, svg, defs, group, currentElement, svgImage, canvas, context, id\n", " const parent = this.__closestGroupOrSvg();\n", " const translateDirective = \"translate(\" + dx + \", \" + dy + \")\";\n", " if (image instanceof SVGRenderingContext2D) {\n", " // In the future we may want to clone nodes instead.\n", " // also I'm currently ignoring dw, dh, sw, sh, sx, sy for a mock context.\n", " const svg = image.getSvg().cloneNode(true);\n", " if (svg.childNodes && svg.childNodes.length > 1) {\n", " const defs = svg_children(svg)[0];\n", " while (defs.childNodes.length) {\n", " const id = svg_children(defs)[0].getAttribute(\"id\");\n", " this.__ids[id] = id;\n", " this.__defs.appendChild(svg_children(defs)[0]);\n", " }\n", " const group = svg_children(svg)[1];\n", " if (group) {\n", " // save original transform\n", " const originTransform = group.getAttribute(\"transform\");\n", " let transformDirective;\n", " if (originTransform) {\n", " transformDirective = originTransform + \" \" + translateDirective;\n", " }\n", " else {\n", " transformDirective = translateDirective;\n", " }\n", " group.setAttribute(\"transform\", transformDirective);\n", " parent.appendChild(group);\n", " }\n", " }\n", " }\n", " else if (image instanceof HTMLImageElement || image instanceof SVGImageElement) {\n", " const svgImage = this.__createElement(\"image\");\n", " svgImage.setAttribute(\"width\", `${dw}`);\n", " svgImage.setAttribute(\"height\", `${dh}`);\n", " svgImage.setAttribute(\"preserveAspectRatio\", \"none\");\n", " if (sx || sy || sw !== image.width || sh !== image.height) {\n", " // crop the image using a temporary canvas\n", " const canvas = this.__document.createElement(\"canvas\");\n", " canvas.width = dw;\n", " canvas.height = dh;\n", " const context = canvas.getContext(\"2d\");\n", " context.drawImage(image, sx, sy, sw, sh, 0, 0, dw, dh);\n", " image = canvas;\n", " }\n", " svgImage.setAttribute(\"transform\", translateDirective);\n", " const url = image instanceof HTMLCanvasElement ? image.toDataURL() : image.getAttribute(\"src\");\n", " svgImage.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", url);\n", " parent.appendChild(svgImage);\n", " }\n", " else if (image instanceof HTMLCanvasElement) {\n", " const svgImage = this.__createElement(\"image\");\n", " svgImage.setAttribute(\"width\", `${dw}`);\n", " svgImage.setAttribute(\"height\", `${dh}`);\n", " svgImage.setAttribute(\"preserveAspectRatio\", \"none\");\n", " // draw canvas onto temporary canvas so that smoothing can be handled\n", " const canvas = this.__document.createElement(\"canvas\");\n", " canvas.width = dw;\n", " canvas.height = dh;\n", " const context = canvas.getContext(\"2d\");\n", " context.imageSmoothingEnabled = false;\n", " //context.mozImageSmoothingEnabled = false\n", " //context.oImageSmoothingEnabled = false\n", " //context.webkitImageSmoothingEnabled = false\n", " context.drawImage(image, sx, sy, sw, sh, 0, 0, dw, dh);\n", " image = canvas;\n", " svgImage.setAttribute(\"transform\", translateDirective);\n", " svgImage.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", image.toDataURL());\n", " parent.appendChild(svgImage);\n", " }\n", " }\n", " /**\n", " * Generates a pattern tag\n", " */\n", " createPattern(image, _repetition) {\n", " const pattern = this.__document.createElementNS(\"http://www.w3.org/2000/svg\", \"pattern\");\n", " const id = randomString(this.__ids);\n", " pattern.setAttribute(\"id\", id);\n", " pattern.setAttribute(\"width\", `${image.width}`);\n", " pattern.setAttribute(\"height\", `${image.height}`);\n", " let img;\n", " if (image instanceof HTMLCanvasElement || image instanceof HTMLImageElement || image instanceof SVGImageElement) {\n", " img = this.__document.createElementNS(\"http://www.w3.org/2000/svg\", \"image\");\n", " img.setAttribute(\"width\", `${image.width}`);\n", " img.setAttribute(\"height\", `${image.height}`);\n", " const url = image instanceof HTMLCanvasElement ? image.toDataURL() : image.getAttribute(\"src\");\n", " img.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", url);\n", " pattern.appendChild(img);\n", " this.__defs.appendChild(pattern);\n", " }\n", " else if (image instanceof SVGRenderingContext2D) {\n", " pattern.appendChild(image.__root.childNodes[1]);\n", " this.__defs.appendChild(pattern);\n", " }\n", " return new CanvasPattern(pattern, this);\n", " }\n", " setLineDash(dashArray) {\n", " if (dashArray && dashArray.length > 0) {\n", " this.lineDash = dashArray.join(\",\");\n", " }\n", " else {\n", " this.lineDash = null;\n", " }\n", " }\n", " }\n", " exports.SVGRenderingContext2D = SVGRenderingContext2D;\n", " SVGRenderingContext2D.__name__ = \"SVGRenderingContext2D\";\n", " },\n", " /* models/canvas/cartesian_frame.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const categorical_scale_1 = require(185) /* ../scales/categorical_scale */;\n", " const continuous_scale_1 = require(121) /* ../scales/continuous_scale */;\n", " const log_scale_1 = require(130) /* ../scales/log_scale */;\n", " const range1d_1 = require(131) /* ../ranges/range1d */;\n", " const data_range1d_1 = require(186) /* ../ranges/data_range1d */;\n", " const factor_range_1 = require(90) /* ../ranges/factor_range */;\n", " const layout_1 = require(188) /* ../../core/layout */;\n", " class CartesianFrame extends layout_1.LayoutItem {\n", " constructor(x_scale, y_scale, x_range, y_range, extra_x_ranges = {}, extra_y_ranges = {}) {\n", " super();\n", " this.x_scale = x_scale;\n", " this.y_scale = y_scale;\n", " this.x_range = x_range;\n", " this.y_range = y_range;\n", " this.extra_x_ranges = extra_x_ranges;\n", " this.extra_y_ranges = extra_y_ranges;\n", " this._configure_scales();\n", " }\n", " map_to_screen(x, y, x_name = \"default\", y_name = \"default\") {\n", " const sx = this.xscales[x_name].v_compute(x);\n", " const sy = this.yscales[y_name].v_compute(y);\n", " return [sx, sy];\n", " }\n", " _get_ranges(range, extra_ranges) {\n", " return Object.assign(Object.assign({}, extra_ranges), { default: range });\n", " }\n", " /*protected*/ _get_scales(scale, ranges, frame_range) {\n", " const scales = {};\n", " for (const name in ranges) {\n", " const range = ranges[name];\n", " if (range instanceof data_range1d_1.DataRange1d || range instanceof range1d_1.Range1d) {\n", " if (!(scale instanceof continuous_scale_1.ContinuousScale))\n", " throw new Error(`Range ${range.type} is incompatible is Scale ${scale.type}`);\n", " }\n", " if (range instanceof factor_range_1.FactorRange) {\n", " if (!(scale instanceof categorical_scale_1.CategoricalScale))\n", " throw new Error(`Range ${range.type} is incompatible is Scale ${scale.type}`);\n", " }\n", " if (scale instanceof log_scale_1.LogScale && range instanceof data_range1d_1.DataRange1d)\n", " range.scale_hint = \"log\";\n", " const s = scale.clone();\n", " s.setv({ source_range: range, target_range: frame_range });\n", " scales[name] = s;\n", " }\n", " return scales;\n", " }\n", " _configure_frame_ranges() {\n", " // data to/from screen space transform (left-bottom <-> left-top origin)\n", " this._h_target = new range1d_1.Range1d({ start: this._left.value, end: this._right.value });\n", " this._v_target = new range1d_1.Range1d({ start: this._bottom.value, end: this._top.value });\n", " }\n", " _configure_scales() {\n", " this._configure_frame_ranges();\n", " this._x_ranges = this._get_ranges(this.x_range, this.extra_x_ranges);\n", " this._y_ranges = this._get_ranges(this.y_range, this.extra_y_ranges);\n", " this._xscales = this._get_scales(this.x_scale, this._x_ranges, this._h_target);\n", " this._yscales = this._get_scales(this.y_scale, this._y_ranges, this._v_target);\n", " }\n", " _update_scales() {\n", " this._configure_frame_ranges();\n", " for (const name in this._xscales) {\n", " const scale = this._xscales[name];\n", " scale.target_range = this._h_target;\n", " }\n", " for (const name in this._yscales) {\n", " const scale = this._yscales[name];\n", " scale.target_range = this._v_target;\n", " }\n", " }\n", " _set_geometry(outer, inner) {\n", " super._set_geometry(outer, inner);\n", " this._update_scales();\n", " }\n", " get x_ranges() {\n", " return this._x_ranges;\n", " }\n", " get y_ranges() {\n", " return this._y_ranges;\n", " }\n", " get xscales() {\n", " return this._xscales;\n", " }\n", " get yscales() {\n", " return this._yscales;\n", " }\n", " }\n", " exports.CartesianFrame = CartesianFrame;\n", " CartesianFrame.__name__ = \"CartesianFrame\";\n", " },\n", " /* models/scales/categorical_scale.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const scale_1 = require(122) /* ./scale */;\n", " class CategoricalScale extends scale_1.Scale {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " compute(x) {\n", " return super._linear_compute(this.source_range.synthetic(x));\n", " }\n", " v_compute(xs) {\n", " return super._linear_v_compute(this.source_range.v_synthetic(xs));\n", " }\n", " invert(xprime) {\n", " return this._linear_invert(xprime);\n", " }\n", " v_invert(xprimes) {\n", " return this._linear_v_invert(xprimes);\n", " }\n", " }\n", " exports.CategoricalScale = CategoricalScale;\n", " CategoricalScale.__name__ = \"CategoricalScale\";\n", " },\n", " /* models/ranges/data_range1d.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const data_range_1 = require(187) /* ./data_range */;\n", " const glyph_renderer_1 = require(81) /* ../renderers/glyph_renderer */;\n", " const logging_1 = require(72) /* ../../core/logging */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const bbox = tslib_1.__importStar(require(88) /* ../../core/util/bbox */);\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " class DataRange1d extends data_range_1.DataRange {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.have_updated_interactively = false;\n", " }\n", " static init_DataRange1d() {\n", " this.define({\n", " start: [p.Number],\n", " end: [p.Number],\n", " range_padding: [p.Number, 0.1],\n", " range_padding_units: [p.PaddingUnits, \"percent\"],\n", " flipped: [p.Boolean, false],\n", " follow: [p.StartEnd],\n", " follow_interval: [p.Number],\n", " default_span: [p.Number, 2],\n", " only_visible: [p.Boolean, false],\n", " });\n", " this.internal({\n", " scale_hint: [p.String, 'auto'],\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " this._initial_start = this.start;\n", " this._initial_end = this.end;\n", " this._initial_range_padding = this.range_padding;\n", " this._initial_range_padding_units = this.range_padding_units;\n", " this._initial_follow = this.follow;\n", " this._initial_follow_interval = this.follow_interval;\n", " this._initial_default_span = this.default_span;\n", " this._plot_bounds = new Map();\n", " }\n", " get min() {\n", " return Math.min(this.start, this.end);\n", " }\n", " get max() {\n", " return Math.max(this.start, this.end);\n", " }\n", " computed_renderers() {\n", " // TODO (bev) check that renderers actually configured with this range\n", " const names = this.names;\n", " let renderers = this.renderers;\n", " if (renderers.length == 0) {\n", " for (const plot of this.plots) {\n", " const rs = plot.renderers.filter((r) => r instanceof glyph_renderer_1.GlyphRenderer);\n", " renderers = renderers.concat(rs);\n", " }\n", " }\n", " if (names.length > 0)\n", " renderers = renderers.filter((r) => array_1.includes(names, r.name));\n", " logging_1.logger.debug(`computed ${renderers.length} renderers for ${this}`);\n", " for (const renderer of renderers) {\n", " logging_1.logger.trace(` - ${renderer}`);\n", " }\n", " return renderers;\n", " }\n", " /*protected*/ _compute_plot_bounds(renderers, bounds) {\n", " let result = bbox.empty();\n", " for (const r of renderers) {\n", " const rect = bounds.get(r);\n", " if (rect != null && (r.visible || !this.only_visible)) {\n", " result = bbox.union(result, rect);\n", " }\n", " }\n", " return result;\n", " }\n", " adjust_bounds_for_aspect(bounds, ratio) {\n", " const result = bbox.empty();\n", " let width = bounds.x1 - bounds.x0;\n", " if (width <= 0) {\n", " width = 1.0;\n", " }\n", " let height = bounds.y1 - bounds.y0;\n", " if (height <= 0) {\n", " height = 1.0;\n", " }\n", " const xcenter = 0.5 * (bounds.x1 + bounds.x0);\n", " const ycenter = 0.5 * (bounds.y1 + bounds.y0);\n", " if (width < ratio * height) {\n", " width = ratio * height;\n", " }\n", " else {\n", " height = width / ratio;\n", " }\n", " result.x1 = xcenter + 0.5 * width;\n", " result.x0 = xcenter - 0.5 * width;\n", " result.y1 = ycenter + 0.5 * height;\n", " result.y0 = ycenter - 0.5 * height;\n", " return result;\n", " }\n", " /*protected*/ _compute_min_max(plot_bounds, dimension) {\n", " let overall = bbox.empty();\n", " for (const rect of plot_bounds) {\n", " overall = bbox.union(overall, rect);\n", " }\n", " let min, max;\n", " if (dimension == 0)\n", " [min, max] = [overall.x0, overall.x1];\n", " else\n", " [min, max] = [overall.y0, overall.y1];\n", " return [min, max];\n", " }\n", " /*protected*/ _compute_range(min, max) {\n", " const range_padding = this.range_padding; // XXX: ? 0\n", " let start, end;\n", " if (this._initial_start != null)\n", " min = this._initial_start;\n", " if (this._initial_end != null)\n", " max = this._initial_end;\n", " if (this.scale_hint == \"log\") {\n", " if (isNaN(min) || !isFinite(min) || min <= 0) {\n", " if (isNaN(max) || !isFinite(max) || max <= 0)\n", " min = 0.1;\n", " else\n", " min = max / 100;\n", " logging_1.logger.warn(`could not determine minimum data value for log axis, DataRange1d using value ${min}`);\n", " }\n", " if (isNaN(max) || !isFinite(max) || max <= 0) {\n", " if (isNaN(min) || !isFinite(min) || min <= 0)\n", " max = 10;\n", " else\n", " max = min * 100;\n", " logging_1.logger.warn(`could not determine maximum data value for log axis, DataRange1d using value ${max}`);\n", " }\n", " let center, span;\n", " if (max == min) {\n", " span = this.default_span + 0.001;\n", " center = Math.log(min) / Math.log(10);\n", " }\n", " else {\n", " let log_min, log_max;\n", " if (this.range_padding_units == \"percent\") {\n", " log_min = Math.log(min) / Math.log(10);\n", " log_max = Math.log(max) / Math.log(10);\n", " span = (log_max - log_min) * (1 + range_padding);\n", " }\n", " else {\n", " log_min = Math.log(min - range_padding) / Math.log(10);\n", " log_max = Math.log(max + range_padding) / Math.log(10);\n", " span = log_max - log_min;\n", " }\n", " center = (log_min + log_max) / 2.0;\n", " }\n", " start = 10 ** (center - span / 2.0);\n", " end = 10 ** (center + span / 2.0);\n", " }\n", " else {\n", " let span;\n", " if (max == min)\n", " span = this.default_span;\n", " else {\n", " if (this.range_padding_units == \"percent\")\n", " span = (max - min) * (1 + range_padding);\n", " else\n", " span = (max - min) + 2 * range_padding;\n", " }\n", " const center = (max + min) / 2.0;\n", " start = center - span / 2.0;\n", " end = center + span / 2.0;\n", " }\n", " let follow_sign = +1;\n", " if (this.flipped) {\n", " [start, end] = [end, start];\n", " follow_sign = -1;\n", " }\n", " const follow_interval = this.follow_interval;\n", " if (follow_interval != null && Math.abs(start - end) > follow_interval) {\n", " if (this.follow == 'start')\n", " end = start + follow_sign * follow_interval;\n", " else if (this.follow == 'end')\n", " start = end - follow_sign * follow_interval;\n", " }\n", " return [start, end];\n", " }\n", " update(bounds, dimension, plot, ratio) {\n", " if (this.have_updated_interactively)\n", " return;\n", " const renderers = this.computed_renderers();\n", " // update the raw data bounds for all renderers we care about\n", " let total_bounds = this._compute_plot_bounds(renderers, bounds);\n", " if (ratio != null)\n", " total_bounds = this.adjust_bounds_for_aspect(total_bounds, ratio);\n", " this._plot_bounds.set(plot, total_bounds);\n", " // compute the min/mix for our specified dimension\n", " const [min, max] = this._compute_min_max(this._plot_bounds.values(), dimension);\n", " // derive start, end from bounds and data range config\n", " let [start, end] = this._compute_range(min, max);\n", " if (this._initial_start != null) {\n", " if (this.scale_hint == \"log\") {\n", " if (this._initial_start > 0)\n", " start = this._initial_start;\n", " }\n", " else\n", " start = this._initial_start;\n", " }\n", " if (this._initial_end != null) {\n", " if (this.scale_hint == \"log\") {\n", " if (this._initial_end > 0)\n", " end = this._initial_end;\n", " }\n", " else\n", " end = this._initial_end;\n", " }\n", " // only trigger updates when there are changes\n", " const [_start, _end] = [this.start, this.end];\n", " if (start != _start || end != _end) {\n", " const new_range = {};\n", " if (start != _start)\n", " new_range.start = start;\n", " if (end != _end)\n", " new_range.end = end;\n", " this.setv(new_range);\n", " }\n", " if (this.bounds == 'auto')\n", " this.setv({ bounds: [start, end] }, { silent: true });\n", " this.change.emit();\n", " }\n", " reset() {\n", " this.have_updated_interactively = false;\n", " // change events silenced as PlotView.update_dataranges triggers property callbacks\n", " this.setv({\n", " range_padding: this._initial_range_padding,\n", " range_padding_units: this._initial_range_padding_units,\n", " follow: this._initial_follow,\n", " follow_interval: this._initial_follow_interval,\n", " default_span: this._initial_default_span,\n", " }, { silent: true });\n", " this.change.emit();\n", " }\n", " }\n", " exports.DataRange1d = DataRange1d;\n", " DataRange1d.__name__ = \"DataRange1d\";\n", " DataRange1d.init_DataRange1d();\n", " },\n", " /* models/ranges/data_range.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const range_1 = require(91) /* ./range */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class DataRange extends range_1.Range {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_DataRange() {\n", " this.define({\n", " names: [p.Array, []],\n", " renderers: [p.Array, []],\n", " });\n", " }\n", " }\n", " exports.DataRange = DataRange;\n", " DataRange.__name__ = \"DataRange\";\n", " DataRange.init_DataRange();\n", " },\n", " /* core/layout/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var types_1 = require(189) /* ./types */;\n", " exports.Sizeable = types_1.Sizeable;\n", " var layoutable_1 = require(190) /* ./layoutable */;\n", " exports.Layoutable = layoutable_1.Layoutable;\n", " exports.LayoutItem = layoutable_1.LayoutItem;\n", " var alignments_1 = require(191) /* ./alignments */;\n", " exports.HStack = alignments_1.HStack;\n", " exports.VStack = alignments_1.VStack;\n", " exports.AnchorLayout = alignments_1.AnchorLayout;\n", " var grid_1 = require(192) /* ./grid */;\n", " exports.Grid = grid_1.Grid;\n", " exports.Row = grid_1.Row;\n", " exports.Column = grid_1.Column;\n", " var html_1 = require(193) /* ./html */;\n", " exports.ContentBox = html_1.ContentBox;\n", " exports.VariadicBox = html_1.VariadicBox;\n", " },\n", " /* core/layout/types.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const { min, max } = Math;\n", " class Sizeable {\n", " constructor(size = {}) {\n", " this.width = size.width != null ? size.width : 0;\n", " this.height = size.height != null ? size.height : 0;\n", " }\n", " bounded_to({ width, height }) {\n", " return new Sizeable({\n", " width: this.width == Infinity && width != null ? width : this.width,\n", " height: this.height == Infinity && height != null ? height : this.height,\n", " });\n", " }\n", " expanded_to({ width, height }) {\n", " return new Sizeable({\n", " width: width != Infinity ? max(this.width, width) : this.width,\n", " height: height != Infinity ? max(this.height, height) : this.height,\n", " });\n", " }\n", " expand_to({ width, height }) {\n", " this.width = max(this.width, width);\n", " this.height = max(this.height, height);\n", " }\n", " narrowed_to({ width, height }) {\n", " return new Sizeable({\n", " width: min(this.width, width),\n", " height: min(this.height, height),\n", " });\n", " }\n", " narrow_to({ width, height }) {\n", " this.width = min(this.width, width);\n", " this.height = min(this.height, height);\n", " }\n", " grow_by({ left, right, top, bottom }) {\n", " const width = this.width + left + right;\n", " const height = this.height + top + bottom;\n", " return new Sizeable({ width, height });\n", " }\n", " shrink_by({ left, right, top, bottom }) {\n", " const width = max(this.width - left - right, 0);\n", " const height = max(this.height - top - bottom, 0);\n", " return new Sizeable({ width, height });\n", " }\n", " map(w_fn, h_fn) {\n", " return new Sizeable({\n", " width: w_fn(this.width),\n", " height: (h_fn != null ? h_fn : w_fn)(this.height),\n", " });\n", " }\n", " }\n", " exports.Sizeable = Sizeable;\n", " Sizeable.__name__ = \"Sizeable\";\n", " },\n", " /* core/layout/layoutable.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const types_1 = require(189) /* ./types */;\n", " const bbox_1 = require(88) /* ../util/bbox */;\n", " const { min, max, round } = Math;\n", " class Layoutable {\n", " constructor() {\n", " this._bbox = new bbox_1.BBox();\n", " this._inner_bbox = new bbox_1.BBox();\n", " const layout = this;\n", " this._top = { get value() { return layout.bbox.top; } };\n", " this._left = { get value() { return layout.bbox.left; } };\n", " this._width = { get value() { return layout.bbox.width; } };\n", " this._height = { get value() { return layout.bbox.height; } };\n", " this._right = { get value() { return layout.bbox.right; } };\n", " this._bottom = { get value() { return layout.bbox.bottom; } };\n", " this._hcenter = { get value() { return layout.bbox.hcenter; } };\n", " this._vcenter = { get value() { return layout.bbox.vcenter; } };\n", " }\n", " get bbox() {\n", " return this._bbox;\n", " }\n", " get inner_bbox() {\n", " return this._inner_bbox;\n", " }\n", " get sizing() {\n", " return this._sizing;\n", " }\n", " set_sizing(sizing) {\n", " const width_policy = sizing.width_policy || \"fit\";\n", " const width = sizing.width;\n", " const min_width = sizing.min_width != null ? sizing.min_width : 0;\n", " const max_width = sizing.max_width != null ? sizing.max_width : Infinity;\n", " const height_policy = sizing.height_policy || \"fit\";\n", " const height = sizing.height;\n", " const min_height = sizing.min_height != null ? sizing.min_height : 0;\n", " const max_height = sizing.max_height != null ? sizing.max_height : Infinity;\n", " const aspect = sizing.aspect;\n", " const margin = sizing.margin || { top: 0, right: 0, bottom: 0, left: 0 };\n", " const visible = sizing.visible !== false;\n", " const halign = sizing.halign || \"start\";\n", " const valign = sizing.valign || \"start\";\n", " this._sizing = {\n", " width_policy, min_width, width, max_width,\n", " height_policy, min_height, height, max_height,\n", " aspect,\n", " margin,\n", " visible,\n", " halign,\n", " valign,\n", " size: { width, height },\n", " min_size: { width: min_width, height: min_height },\n", " max_size: { width: max_width, height: max_height },\n", " };\n", " this._init();\n", " }\n", " _init() { }\n", " _set_geometry(outer, inner) {\n", " this._bbox = outer;\n", " this._inner_bbox = inner;\n", " }\n", " set_geometry(outer, inner) {\n", " this._set_geometry(outer, inner || outer);\n", " }\n", " is_width_expanding() {\n", " return this.sizing.width_policy == \"max\";\n", " }\n", " is_height_expanding() {\n", " return this.sizing.height_policy == \"max\";\n", " }\n", " apply_aspect(viewport, { width, height }) {\n", " const { aspect } = this.sizing;\n", " if (aspect != null) {\n", " const { width_policy, height_policy } = this.sizing;\n", " const gt = (width, height) => {\n", " const policies = { max: 4, fit: 3, min: 2, fixed: 1 };\n", " return policies[width] > policies[height];\n", " };\n", " if (width_policy != \"fixed\" && height_policy != \"fixed\") {\n", " if (width_policy == height_policy) {\n", " const w_width = width;\n", " const w_height = round(width / aspect);\n", " const h_width = round(height * aspect);\n", " const h_height = height;\n", " const w_diff = Math.abs(viewport.width - w_width) + Math.abs(viewport.height - w_height);\n", " const h_diff = Math.abs(viewport.width - h_width) + Math.abs(viewport.height - h_height);\n", " if (w_diff <= h_diff) {\n", " width = w_width;\n", " height = w_height;\n", " }\n", " else {\n", " width = h_width;\n", " height = h_height;\n", " }\n", " }\n", " else if (gt(width_policy, height_policy)) {\n", " height = round(width / aspect);\n", " }\n", " else {\n", " width = round(height * aspect);\n", " }\n", " }\n", " else if (width_policy == \"fixed\") {\n", " height = round(width / aspect);\n", " }\n", " else if (height_policy == \"fixed\") {\n", " width = round(height * aspect);\n", " }\n", " }\n", " return { width, height };\n", " }\n", " measure(viewport_size) {\n", " if (!this.sizing.visible)\n", " return { width: 0, height: 0 };\n", " const exact_width = (width) => {\n", " return this.sizing.width_policy == \"fixed\" && this.sizing.width != null ? this.sizing.width : width;\n", " };\n", " const exact_height = (height) => {\n", " return this.sizing.height_policy == \"fixed\" && this.sizing.height != null ? this.sizing.height : height;\n", " };\n", " const viewport = new types_1.Sizeable(viewport_size)\n", " .shrink_by(this.sizing.margin)\n", " .map(exact_width, exact_height);\n", " const computed = this._measure(viewport);\n", " const clipped = this.clip_size(computed);\n", " const width = exact_width(clipped.width);\n", " const height = exact_height(clipped.height);\n", " const size = this.apply_aspect(viewport, { width, height });\n", " return Object.assign(Object.assign({}, computed), size);\n", " }\n", " compute(viewport = {}) {\n", " const size_hint = this.measure({\n", " width: viewport.width != null && this.is_width_expanding() ? viewport.width : Infinity,\n", " height: viewport.height != null && this.is_height_expanding() ? viewport.height : Infinity,\n", " });\n", " const { width, height } = size_hint;\n", " const outer = new bbox_1.BBox({ left: 0, top: 0, width, height });\n", " let inner = undefined;\n", " if (size_hint.inner != null) {\n", " const { left, top, right, bottom } = size_hint.inner;\n", " inner = new bbox_1.BBox({ left, top, right: width - right, bottom: height - bottom });\n", " }\n", " this.set_geometry(outer, inner);\n", " }\n", " get xview() {\n", " return this.bbox.xview;\n", " }\n", " get yview() {\n", " return this.bbox.yview;\n", " }\n", " clip_width(width) {\n", " return max(this.sizing.min_width, min(width, this.sizing.max_width));\n", " }\n", " clip_height(height) {\n", " return max(this.sizing.min_height, min(height, this.sizing.max_height));\n", " }\n", " clip_size({ width, height }) {\n", " return {\n", " width: this.clip_width(width),\n", " height: this.clip_height(height),\n", " };\n", " }\n", " }\n", " exports.Layoutable = Layoutable;\n", " Layoutable.__name__ = \"Layoutable\";\n", " class LayoutItem extends Layoutable {\n", " /*\n", " constructor(readonly measure_fn: (viewport: Size) => Size) {\n", " super()\n", " }\n", " protected _measure(viewport: Size): SizeHint {\n", " return this.measure_fn(viewport)\n", " }\n", " protected _measure(viewport: Size): SizeHint {\n", " return {\n", " width: viewport.width != Infinity ? viewport.width : this.sizing.min_width,\n", " height: viewport.height != Infinity ? viewport.height : this.sizing.min_width,\n", " }\n", " }\n", " */\n", " _measure(viewport) {\n", " const { width_policy, height_policy } = this.sizing;\n", " let width;\n", " if (viewport.width == Infinity) {\n", " width = this.sizing.width != null ? this.sizing.width : 0;\n", " }\n", " else {\n", " switch (width_policy) {\n", " case \"fixed\": {\n", " width = this.sizing.width != null ? this.sizing.width : 0;\n", " break;\n", " }\n", " case \"min\": {\n", " width = this.sizing.width != null ? min(viewport.width, this.sizing.width) : 0;\n", " break;\n", " }\n", " case \"fit\": {\n", " width = this.sizing.width != null ? min(viewport.width, this.sizing.width) : viewport.width;\n", " break;\n", " }\n", " case \"max\": {\n", " width = this.sizing.width != null ? max(viewport.width, this.sizing.width) : viewport.width;\n", " break;\n", " }\n", " }\n", " }\n", " let height;\n", " if (viewport.height == Infinity) {\n", " height = this.sizing.height != null ? this.sizing.height : 0;\n", " }\n", " else {\n", " switch (height_policy) {\n", " case \"fixed\": {\n", " height = this.sizing.height != null ? this.sizing.height : 0;\n", " break;\n", " }\n", " case \"min\": {\n", " height = this.sizing.height != null ? min(viewport.height, this.sizing.height) : 0;\n", " break;\n", " }\n", " case \"fit\": {\n", " height = this.sizing.height != null ? min(viewport.height, this.sizing.height) : viewport.height;\n", " break;\n", " }\n", " case \"max\": {\n", " height = this.sizing.height != null ? max(viewport.height, this.sizing.height) : viewport.height;\n", " break;\n", " }\n", " }\n", " }\n", " return { width, height };\n", " }\n", " }\n", " exports.LayoutItem = LayoutItem;\n", " LayoutItem.__name__ = \"LayoutItem\";\n", " class ContentLayoutable extends Layoutable {\n", " _measure(viewport) {\n", " const content_size = this._content_size();\n", " const bounds = viewport\n", " .bounded_to(this.sizing.size)\n", " .bounded_to(content_size);\n", " const width = (() => {\n", " switch (this.sizing.width_policy) {\n", " case \"fixed\":\n", " return this.sizing.width != null ? this.sizing.width : content_size.width;\n", " case \"min\":\n", " return content_size.width;\n", " case \"fit\":\n", " return bounds.width;\n", " case \"max\":\n", " return Math.max(content_size.width, bounds.width);\n", " }\n", " })();\n", " const height = (() => {\n", " switch (this.sizing.height_policy) {\n", " case \"fixed\":\n", " return this.sizing.height != null ? this.sizing.height : content_size.height;\n", " case \"min\":\n", " return content_size.height;\n", " case \"fit\":\n", " return bounds.height;\n", " case \"max\":\n", " return Math.max(content_size.height, bounds.height);\n", " }\n", " })();\n", " return { width, height };\n", " }\n", " }\n", " exports.ContentLayoutable = ContentLayoutable;\n", " ContentLayoutable.__name__ = \"ContentLayoutable\";\n", " },\n", " /* core/layout/alignments.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const layoutable_1 = require(190) /* ./layoutable */;\n", " const bbox_1 = require(88) /* ../util/bbox */;\n", " class Stack extends layoutable_1.Layoutable {\n", " constructor() {\n", " super(...arguments);\n", " this.children = [];\n", " }\n", " }\n", " exports.Stack = Stack;\n", " Stack.__name__ = \"Stack\";\n", " class HStack extends Stack {\n", " _measure(_viewport) {\n", " let width = 0;\n", " let height = 0;\n", " for (const child of this.children) {\n", " const size_hint = child.measure({ width: 0, height: 0 });\n", " width += size_hint.width;\n", " height = Math.max(height, size_hint.height);\n", " }\n", " return { width, height };\n", " }\n", " _set_geometry(outer, inner) {\n", " super._set_geometry(outer, inner);\n", " const { top, bottom } = outer;\n", " let { left } = outer;\n", " for (const child of this.children) {\n", " const { width } = child.measure({ width: 0, height: 0 });\n", " child.set_geometry(new bbox_1.BBox({ left, width, top, bottom }));\n", " left += width;\n", " }\n", " }\n", " }\n", " exports.HStack = HStack;\n", " HStack.__name__ = \"HStack\";\n", " class VStack extends Stack {\n", " _measure(_viewport) {\n", " let width = 0;\n", " let height = 0;\n", " for (const child of this.children) {\n", " const size_hint = child.measure({ width: 0, height: 0 });\n", " width = Math.max(width, size_hint.width);\n", " height += size_hint.height;\n", " }\n", " return { width, height };\n", " }\n", " _set_geometry(outer, inner) {\n", " super._set_geometry(outer, inner);\n", " const { left, right } = outer;\n", " let { top } = outer;\n", " for (const child of this.children) {\n", " const { height } = child.measure({ width: 0, height: 0 });\n", " child.set_geometry(new bbox_1.BBox({ top, height, left, right }));\n", " top += height;\n", " }\n", " }\n", " }\n", " exports.VStack = VStack;\n", " VStack.__name__ = \"VStack\";\n", " class AnchorLayout extends layoutable_1.Layoutable {\n", " constructor() {\n", " super(...arguments);\n", " this.children = [];\n", " }\n", " _measure(viewport) {\n", " let width = 0;\n", " let height = 0;\n", " for (const { layout } of this.children) {\n", " const size_hint = layout.measure(viewport);\n", " width = Math.max(width, size_hint.width);\n", " height = Math.max(height, size_hint.height);\n", " }\n", " return { width, height };\n", " }\n", " _set_geometry(outer, inner) {\n", " super._set_geometry(outer, inner);\n", " for (const { layout, anchor, margin } of this.children) {\n", " const { left, right, top, bottom, hcenter, vcenter } = outer;\n", " const { width, height } = layout.measure(outer);\n", " let bbox;\n", " switch (anchor) {\n", " case 'top_left':\n", " bbox = new bbox_1.BBox({ left: left + margin, top: top + margin, width, height });\n", " break;\n", " case 'top_center':\n", " bbox = new bbox_1.BBox({ hcenter, top: top + margin, width, height });\n", " break;\n", " case 'top_right':\n", " bbox = new bbox_1.BBox({ right: right - margin, top: top + margin, width, height });\n", " break;\n", " case 'bottom_right':\n", " bbox = new bbox_1.BBox({ right: right - margin, bottom: bottom - margin, width, height });\n", " break;\n", " case 'bottom_center':\n", " bbox = new bbox_1.BBox({ hcenter, bottom: bottom - margin, width, height });\n", " break;\n", " case 'bottom_left':\n", " bbox = new bbox_1.BBox({ left: left + margin, bottom: bottom - margin, width, height });\n", " break;\n", " case 'center_left':\n", " bbox = new bbox_1.BBox({ left: left + margin, vcenter, width, height });\n", " break;\n", " case 'center':\n", " bbox = new bbox_1.BBox({ hcenter, vcenter, width, height });\n", " break;\n", " case 'center_right':\n", " bbox = new bbox_1.BBox({ right: right - margin, vcenter, width, height });\n", " break;\n", " }\n", " layout.set_geometry(bbox);\n", " }\n", " }\n", " }\n", " exports.AnchorLayout = AnchorLayout;\n", " AnchorLayout.__name__ = \"AnchorLayout\";\n", " },\n", " /* core/layout/grid.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const types_1 = require(189) /* ./types */;\n", " const layoutable_1 = require(190) /* ./layoutable */;\n", " const types_2 = require(8) /* ../util/types */;\n", " const bbox_1 = require(88) /* ../util/bbox */;\n", " const array_1 = require(9) /* ../util/array */;\n", " const { max, round } = Math;\n", " class DefaultMap {\n", " constructor(def) {\n", " this.def = def;\n", " this._map = new Map();\n", " }\n", " get(key) {\n", " let value = this._map.get(key);\n", " if (value === undefined) {\n", " value = this.def();\n", " this._map.set(key, value);\n", " }\n", " return value;\n", " }\n", " apply(key, fn) {\n", " const value = this.get(key);\n", " this._map.set(key, fn(value));\n", " }\n", " }\n", " DefaultMap.__name__ = \"DefaultMap\";\n", " class Container {\n", " constructor() {\n", " this._items = [];\n", " this._nrows = 0;\n", " this._ncols = 0;\n", " }\n", " get nrows() {\n", " return this._nrows;\n", " }\n", " get ncols() {\n", " return this._ncols;\n", " }\n", " add(span, data) {\n", " const { r1, c1 } = span;\n", " this._nrows = max(this._nrows, r1 + 1);\n", " this._ncols = max(this._ncols, c1 + 1);\n", " this._items.push({ span, data });\n", " }\n", " at(r, c) {\n", " const selected = this._items.filter(({ span }) => {\n", " return span.r0 <= r && r <= span.r1 &&\n", " span.c0 <= c && c <= span.c1;\n", " });\n", " return selected.map(({ data }) => data);\n", " }\n", " row(r) {\n", " const selected = this._items.filter(({ span }) => span.r0 <= r && r <= span.r1);\n", " return selected.map(({ data }) => data);\n", " }\n", " col(c) {\n", " const selected = this._items.filter(({ span }) => span.c0 <= c && c <= span.c1);\n", " return selected.map(({ data }) => data);\n", " }\n", " foreach(fn) {\n", " for (const { span, data } of this._items) {\n", " fn(span, data);\n", " }\n", " }\n", " map(fn) {\n", " const result = new Container();\n", " for (const { span, data } of this._items) {\n", " result.add(span, fn(span, data));\n", " }\n", " return result;\n", " }\n", " }\n", " Container.__name__ = \"Container\";\n", " class Grid extends layoutable_1.Layoutable {\n", " constructor(items = []) {\n", " super();\n", " this.items = items;\n", " this.rows = \"auto\";\n", " this.cols = \"auto\";\n", " this.spacing = 0;\n", " this.absolute = false;\n", " }\n", " is_width_expanding() {\n", " if (super.is_width_expanding())\n", " return true;\n", " if (this.sizing.width_policy == \"fixed\")\n", " return false;\n", " const { cols } = this._state;\n", " return array_1.some(cols, (col) => col.policy == \"max\");\n", " }\n", " is_height_expanding() {\n", " if (super.is_height_expanding())\n", " return true;\n", " if (this.sizing.height_policy == \"fixed\")\n", " return false;\n", " const { rows } = this._state;\n", " return array_1.some(rows, (row) => row.policy == \"max\");\n", " }\n", " _init() {\n", " super._init();\n", " const items = new Container();\n", " for (const { layout, row, col, row_span, col_span } of this.items) {\n", " if (layout.sizing.visible) {\n", " const r0 = row;\n", " const c0 = col;\n", " const r1 = row + (row_span != null ? row_span : 1) - 1;\n", " const c1 = col + (col_span != null ? col_span : 1) - 1;\n", " items.add({ r0, c0, r1, c1 }, layout);\n", " }\n", " }\n", " const { nrows, ncols } = items;\n", " const rows = new Array(nrows);\n", " for (let y = 0; y < nrows; y++) {\n", " const row = (() => {\n", " const sizing = types_2.isPlainObject(this.rows) ? this.rows[y] || this.rows[\"*\"] : this.rows;\n", " if (sizing == null)\n", " return { policy: \"auto\" };\n", " else if (types_2.isNumber(sizing))\n", " return { policy: \"fixed\", height: sizing };\n", " else if (types_2.isString(sizing))\n", " return { policy: sizing };\n", " else\n", " return sizing;\n", " })();\n", " const align = row.align || \"auto\";\n", " if (row.policy == \"fixed\")\n", " rows[y] = { policy: \"fixed\", height: row.height, align };\n", " else if (row.policy == \"min\")\n", " rows[y] = { policy: \"min\", align };\n", " else if (row.policy == \"fit\" || row.policy == \"max\")\n", " rows[y] = { policy: row.policy, flex: row.flex || 1, align };\n", " else if (row.policy == \"auto\") {\n", " if (array_1.some(items.row(y), (layout) => layout.is_height_expanding()))\n", " rows[y] = { policy: \"max\", flex: 1, align };\n", " else\n", " rows[y] = { policy: \"min\", align };\n", " }\n", " else\n", " throw new Error(\"unrechable\");\n", " }\n", " const cols = new Array(ncols);\n", " for (let x = 0; x < ncols; x++) {\n", " const col = (() => {\n", " const sizing = types_2.isPlainObject(this.cols) ? this.cols[x] || this.cols[\"*\"] : this.cols;\n", " if (sizing == null)\n", " return { policy: \"auto\" };\n", " else if (types_2.isNumber(sizing))\n", " return { policy: \"fixed\", width: sizing };\n", " else if (types_2.isString(sizing))\n", " return { policy: sizing };\n", " else\n", " return sizing;\n", " })();\n", " const align = col.align || \"auto\";\n", " if (col.policy == \"fixed\")\n", " cols[x] = { policy: \"fixed\", width: col.width, align };\n", " else if (col.policy == \"min\")\n", " cols[x] = { policy: \"min\", align };\n", " else if (col.policy == \"fit\" || col.policy == \"max\")\n", " cols[x] = { policy: col.policy, flex: col.flex || 1, align };\n", " else if (col.policy == \"auto\") {\n", " if (array_1.some(items.col(x), (layout) => layout.is_width_expanding()))\n", " cols[x] = { policy: \"max\", flex: 1, align };\n", " else\n", " cols[x] = { policy: \"min\", align };\n", " }\n", " else\n", " throw new Error(\"unrechable\");\n", " }\n", " const [rspacing, cspacing] = types_2.isNumber(this.spacing) ? [this.spacing, this.spacing] : this.spacing;\n", " this._state = { items, nrows, ncols, rows, cols, rspacing, cspacing };\n", " }\n", " _measure_totals(row_heights, col_widths) {\n", " const { nrows, ncols, rspacing, cspacing } = this._state;\n", " return {\n", " height: array_1.sum(row_heights) + (nrows - 1) * rspacing,\n", " width: array_1.sum(col_widths) + (ncols - 1) * cspacing,\n", " };\n", " }\n", " _measure_cells(cell_viewport) {\n", " const { items, nrows, ncols, rows, cols, rspacing, cspacing } = this._state;\n", " const row_heights = new Array(nrows);\n", " for (let r = 0; r < nrows; r++) {\n", " const row = rows[r];\n", " row_heights[r] = row.policy == \"fixed\" ? row.height : 0;\n", " }\n", " const col_widths = new Array(ncols);\n", " for (let c = 0; c < ncols; c++) {\n", " const col = cols[c];\n", " col_widths[c] = col.policy == \"fixed\" ? col.width : 0;\n", " }\n", " const size_hints = new Container();\n", " items.foreach((span, layout) => {\n", " const { r0, c0, r1, c1 } = span;\n", " const rspace = (r1 - r0) * rspacing;\n", " const cspace = (c1 - c0) * cspacing;\n", " let height = 0;\n", " for (let r = r0; r <= r1; r++) {\n", " height += cell_viewport(r, c0).height;\n", " }\n", " height += rspace;\n", " let width = 0;\n", " for (let c = c0; c <= c1; c++) {\n", " width += cell_viewport(r0, c).width;\n", " }\n", " width += cspace;\n", " const size_hint = layout.measure({ width, height });\n", " size_hints.add(span, { layout, size_hint });\n", " const size = new types_1.Sizeable(size_hint).grow_by(layout.sizing.margin);\n", " size.height -= rspace;\n", " size.width -= cspace;\n", " const radjustable = [];\n", " for (let r = r0; r <= r1; r++) {\n", " const row = rows[r];\n", " if (row.policy == \"fixed\")\n", " size.height -= row.height;\n", " else\n", " radjustable.push(r);\n", " }\n", " if (size.height > 0) {\n", " const rheight = round(size.height / radjustable.length);\n", " for (const r of radjustable) {\n", " row_heights[r] = max(row_heights[r], rheight);\n", " }\n", " }\n", " const cadjustable = [];\n", " for (let c = c0; c <= c1; c++) {\n", " const col = cols[c];\n", " if (col.policy == \"fixed\")\n", " size.width -= col.width;\n", " else\n", " cadjustable.push(c);\n", " }\n", " if (size.width > 0) {\n", " const cwidth = round(size.width / cadjustable.length);\n", " for (const c of cadjustable) {\n", " col_widths[c] = max(col_widths[c], cwidth);\n", " }\n", " }\n", " });\n", " const size = this._measure_totals(row_heights, col_widths);\n", " return { size, row_heights, col_widths, size_hints };\n", " }\n", " _measure_grid(viewport) {\n", " const { nrows, ncols, rows, cols, rspacing, cspacing } = this._state;\n", " const preferred = this._measure_cells((y, x) => {\n", " const row = rows[y];\n", " const col = cols[x];\n", " return {\n", " width: col.policy == \"fixed\" ? col.width : Infinity,\n", " height: row.policy == \"fixed\" ? row.height : Infinity,\n", " };\n", " });\n", " let available_height;\n", " if (this.sizing.height_policy == \"fixed\" && this.sizing.height != null)\n", " available_height = this.sizing.height;\n", " else if (viewport.height != Infinity && this.is_height_expanding())\n", " available_height = viewport.height;\n", " else\n", " available_height = preferred.size.height;\n", " let height_flex = 0;\n", " for (let y = 0; y < nrows; y++) {\n", " const row = rows[y];\n", " if (row.policy == \"fit\" || row.policy == \"max\")\n", " height_flex += row.flex;\n", " else\n", " available_height -= preferred.row_heights[y];\n", " }\n", " available_height -= (nrows - 1) * rspacing;\n", " if (height_flex != 0 && available_height > 0) {\n", " for (let y = 0; y < nrows; y++) {\n", " const row = rows[y];\n", " if (row.policy == \"fit\" || row.policy == \"max\") {\n", " const height = round(available_height * (row.flex / height_flex));\n", " available_height -= height;\n", " preferred.row_heights[y] = height;\n", " height_flex -= row.flex;\n", " }\n", " }\n", " }\n", " else if (available_height < 0) {\n", " let nadjustable = 0;\n", " for (let y = 0; y < nrows; y++) {\n", " const row = rows[y];\n", " if (row.policy != \"fixed\")\n", " nadjustable++;\n", " }\n", " let overflow_height = -available_height;\n", " for (let y = 0; y < nrows; y++) {\n", " const row = rows[y];\n", " if (row.policy != \"fixed\") {\n", " const height = preferred.row_heights[y];\n", " const cutoff = round(overflow_height / nadjustable);\n", " preferred.row_heights[y] = max(height - cutoff, 0);\n", " overflow_height -= cutoff > height ? height : cutoff;\n", " nadjustable--;\n", " }\n", " }\n", " }\n", " let available_width;\n", " if (this.sizing.width_policy == \"fixed\" && this.sizing.width != null)\n", " available_width = this.sizing.width;\n", " else if (viewport.width != Infinity && this.is_width_expanding())\n", " available_width = viewport.width;\n", " else\n", " available_width = preferred.size.width;\n", " let width_flex = 0;\n", " for (let x = 0; x < ncols; x++) {\n", " const col = cols[x];\n", " if (col.policy == \"fit\" || col.policy == \"max\")\n", " width_flex += col.flex;\n", " else\n", " available_width -= preferred.col_widths[x];\n", " }\n", " available_width -= (ncols - 1) * cspacing;\n", " if (width_flex != 0 && available_width > 0) {\n", " for (let x = 0; x < ncols; x++) {\n", " const col = cols[x];\n", " if (col.policy == \"fit\" || col.policy == \"max\") {\n", " const width = round(available_width * (col.flex / width_flex));\n", " available_width -= width;\n", " preferred.col_widths[x] = width;\n", " width_flex -= col.flex;\n", " }\n", " }\n", " }\n", " else if (available_width < 0) {\n", " let nadjustable = 0;\n", " for (let x = 0; x < ncols; x++) {\n", " const col = cols[x];\n", " if (col.policy != \"fixed\")\n", " nadjustable++;\n", " }\n", " let overflow_width = -available_width;\n", " for (let x = 0; x < ncols; x++) {\n", " const col = cols[x];\n", " if (col.policy != \"fixed\") {\n", " const width = preferred.col_widths[x];\n", " const cutoff = round(overflow_width / nadjustable);\n", " preferred.col_widths[x] = max(width - cutoff, 0);\n", " overflow_width -= cutoff > width ? width : cutoff;\n", " nadjustable--;\n", " }\n", " }\n", " }\n", " const { row_heights, col_widths, size_hints } = this._measure_cells((y, x) => {\n", " return {\n", " width: preferred.col_widths[x],\n", " height: preferred.row_heights[y],\n", " };\n", " });\n", " const size = this._measure_totals(row_heights, col_widths);\n", " return { size, row_heights, col_widths, size_hints };\n", " }\n", " _measure(viewport) {\n", " const { size } = this._measure_grid(viewport);\n", " return size;\n", " }\n", " _set_geometry(outer, inner) {\n", " super._set_geometry(outer, inner);\n", " const { nrows, ncols, rspacing, cspacing } = this._state;\n", " const { row_heights, col_widths, size_hints } = this._measure_grid(outer);\n", " const rows = this._state.rows.map((row, r) => {\n", " return Object.assign(Object.assign({}, row), { top: 0, height: row_heights[r], get bottom() { return this.top + this.height; } });\n", " });\n", " const cols = this._state.cols.map((col, c) => {\n", " return Object.assign(Object.assign({}, col), { left: 0, width: col_widths[c], get right() { return this.left + this.width; } });\n", " });\n", " const items = size_hints.map((_, item) => {\n", " return Object.assign(Object.assign({}, item), { outer: new bbox_1.BBox(), inner: new bbox_1.BBox() });\n", " });\n", " for (let r = 0, top = !this.absolute ? 0 : outer.top; r < nrows; r++) {\n", " const row = rows[r];\n", " row.top = top;\n", " top += row.height + rspacing;\n", " }\n", " for (let c = 0, left = !this.absolute ? 0 : outer.left; c < ncols; c++) {\n", " const col = cols[c];\n", " col.left = left;\n", " left += col.width + cspacing;\n", " }\n", " function span_width(c0, c1) {\n", " let width = (c1 - c0) * cspacing;\n", " for (let c = c0; c <= c1; c++) {\n", " width += cols[c].width;\n", " }\n", " return width;\n", " }\n", " function span_height(r0, r1) {\n", " let height = (r1 - r0) * rspacing;\n", " for (let r = r0; r <= r1; r++) {\n", " height += rows[r].height;\n", " }\n", " return height;\n", " }\n", " items.foreach(({ r0, c0, r1, c1 }, item) => {\n", " const { layout, size_hint } = item;\n", " const { sizing } = layout;\n", " const { width, height } = size_hint;\n", " const span = {\n", " width: span_width(c0, c1),\n", " height: span_height(r0, r1),\n", " };\n", " const halign = c0 == c1 && cols[c0].align != \"auto\" ? cols[c0].align : sizing.halign;\n", " const valign = r0 == r1 && rows[r0].align != \"auto\" ? rows[r0].align : sizing.valign;\n", " let left = cols[c0].left;\n", " if (halign == \"start\")\n", " left += sizing.margin.left;\n", " else if (halign == \"center\")\n", " left += round((span.width - width) / 2);\n", " else if (halign == \"end\")\n", " left += span.width - sizing.margin.right - width;\n", " let top = rows[r0].top;\n", " if (valign == \"start\")\n", " top += sizing.margin.top;\n", " else if (valign == \"center\")\n", " top += round((span.height - height) / 2);\n", " else if (valign == \"end\")\n", " top += span.height - sizing.margin.bottom - height;\n", " item.outer = new bbox_1.BBox({ left, top, width, height });\n", " });\n", " const row_aligns = rows.map(() => {\n", " return {\n", " start: new DefaultMap(() => 0),\n", " end: new DefaultMap(() => 0),\n", " };\n", " });\n", " const col_aligns = cols.map(() => {\n", " return {\n", " start: new DefaultMap(() => 0),\n", " end: new DefaultMap(() => 0),\n", " };\n", " });\n", " items.foreach(({ r0, c0, r1, c1 }, { size_hint, outer }) => {\n", " const { inner } = size_hint;\n", " if (inner != null) {\n", " row_aligns[r0].start.apply(outer.top, (v) => max(v, inner.top));\n", " row_aligns[r1].end.apply(rows[r1].bottom - outer.bottom, (v) => max(v, inner.bottom));\n", " col_aligns[c0].start.apply(outer.left, (v) => max(v, inner.left));\n", " col_aligns[c1].end.apply(cols[c1].right - outer.right, (v) => max(v, inner.right));\n", " }\n", " });\n", " items.foreach(({ r0, c0, r1, c1 }, item) => {\n", " const { size_hint, outer } = item;\n", " function inner_bbox({ left, right, top, bottom }) {\n", " const width = outer.width - left - right;\n", " const height = outer.height - top - bottom;\n", " return new bbox_1.BBox({ left, top, width, height });\n", " }\n", " if (size_hint.inner != null) {\n", " let inner = inner_bbox(size_hint.inner);\n", " if (size_hint.align !== false) {\n", " const top = row_aligns[r0].start.get(outer.top);\n", " const bottom = row_aligns[r1].end.get(rows[r1].bottom - outer.bottom);\n", " const left = col_aligns[c0].start.get(outer.left);\n", " const right = col_aligns[c1].end.get(cols[c1].right - outer.right);\n", " try {\n", " inner = inner_bbox({ top, bottom, left, right });\n", " }\n", " catch (_a) { }\n", " }\n", " item.inner = inner;\n", " }\n", " else\n", " item.inner = outer;\n", " });\n", " items.foreach((_, { layout, outer, inner }) => {\n", " layout.set_geometry(outer, inner);\n", " });\n", " }\n", " }\n", " exports.Grid = Grid;\n", " Grid.__name__ = \"Grid\";\n", " class Row extends Grid {\n", " constructor(items) {\n", " super();\n", " this.items = items.map((item, i) => ({ layout: item, row: 0, col: i }));\n", " this.rows = \"fit\";\n", " }\n", " }\n", " exports.Row = Row;\n", " Row.__name__ = \"Row\";\n", " class Column extends Grid {\n", " constructor(items) {\n", " super();\n", " this.items = items.map((item, i) => ({ layout: item, row: i, col: 0 }));\n", " this.cols = \"fit\";\n", " }\n", " }\n", " exports.Column = Column;\n", " Column.__name__ = \"Column\";\n", " },\n", " /* core/layout/html.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const layoutable_1 = require(190) /* ./layoutable */;\n", " const types_1 = require(189) /* ./types */;\n", " const dom_1 = require(68) /* ../dom */;\n", " class ContentBox extends layoutable_1.ContentLayoutable {\n", " constructor(el) {\n", " super();\n", " this.content_size = dom_1.unsized(el, () => new types_1.Sizeable(dom_1.size(el)));\n", " }\n", " _content_size() {\n", " return this.content_size;\n", " }\n", " }\n", " exports.ContentBox = ContentBox;\n", " ContentBox.__name__ = \"ContentBox\";\n", " class VariadicBox extends layoutable_1.Layoutable {\n", " constructor(el) {\n", " super();\n", " this.el = el;\n", " }\n", " _measure(viewport) {\n", " const bounded = new types_1.Sizeable(viewport).bounded_to(this.sizing.size);\n", " return dom_1.sized(this.el, bounded, () => {\n", " const content = new types_1.Sizeable(dom_1.content_size(this.el));\n", " const { border, padding } = dom_1.extents(this.el);\n", " return content.grow_by(border).grow_by(padding).map(Math.ceil);\n", " });\n", " }\n", " }\n", " exports.VariadicBox = VariadicBox;\n", " VariadicBox.__name__ = \"VariadicBox\";\n", " class CachedVariadicBox extends VariadicBox {\n", " constructor(el) {\n", " super(el);\n", " this._cache = new Map();\n", " }\n", " _measure(viewport) {\n", " const { width, height } = viewport;\n", " const key = `${width},${height}`;\n", " let size_hint = this._cache.get(key);\n", " if (size_hint == null) {\n", " size_hint = super._measure(viewport);\n", " this._cache.set(key, size_hint);\n", " }\n", " return size_hint;\n", " }\n", " invalidate_cache() {\n", " this._cache.clear();\n", " }\n", " }\n", " exports.CachedVariadicBox = CachedVariadicBox;\n", " CachedVariadicBox.__name__ = \"CachedVariadicBox\";\n", " },\n", " /* models/expressions/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var expression_1 = require(195) /* ./expression */;\n", " exports.Expression = expression_1.Expression;\n", " var stack_1 = require(196) /* ./stack */;\n", " exports.Stack = stack_1.Stack;\n", " var cumsum_1 = require(197) /* ./cumsum */;\n", " exports.CumSum = cumsum_1.CumSum;\n", " },\n", " /* models/expressions/expression.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const model_1 = require(71) /* ../../model */;\n", " class Expression extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " initialize() {\n", " super.initialize();\n", " this._connected = new Set();\n", " this._result = new Map();\n", " }\n", " v_compute(source) {\n", " if (!this._connected.has(source)) {\n", " this.connect(source.change, () => this._result.delete(source));\n", " this.connect(source.patching, () => this._result.delete(source));\n", " this.connect(source.streaming, () => this._result.delete(source));\n", " this._connected.add(source);\n", " }\n", " let result = this._result.get(source);\n", " if (result == null) {\n", " result = this._v_compute(source);\n", " this._result.set(source, result);\n", " }\n", " return result;\n", " }\n", " }\n", " exports.Expression = Expression;\n", " Expression.__name__ = \"Expression\";\n", " },\n", " /* models/expressions/stack.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const expression_1 = require(195) /* ./expression */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class Stack extends expression_1.Expression {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Stack() {\n", " this.define({\n", " fields: [p.Array, []],\n", " });\n", " }\n", " _v_compute(source) {\n", " var _a;\n", " const n = (_a = source.get_length()) !== null && _a !== void 0 ? _a : 0;\n", " const result = new Float64Array(n);\n", " for (const f of this.fields) {\n", " const column = source.data[f];\n", " if (column != null) {\n", " for (let i = 0, k = Math.min(n, column.length); i < k; i++) {\n", " result[i] += column[i];\n", " }\n", " }\n", " }\n", " return result;\n", " }\n", " }\n", " exports.Stack = Stack;\n", " Stack.__name__ = \"Stack\";\n", " Stack.init_Stack();\n", " },\n", " /* models/expressions/cumsum.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const expression_1 = require(195) /* ./expression */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class CumSum extends expression_1.Expression {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_CumSum() {\n", " this.define({\n", " field: [p.String],\n", " include_zero: [p.Boolean, false],\n", " });\n", " }\n", " _v_compute(source) {\n", " const result = new Float64Array(source.get_length() || 0);\n", " const col = source.data[this.field];\n", " const offset = this.include_zero ? 1 : 0;\n", " result[0] = this.include_zero ? 0 : col[0];\n", " for (let i = 1; i < result.length; i++) {\n", " result[i] = result[i - 1] + col[i - offset];\n", " }\n", " return result;\n", " }\n", " }\n", " exports.CumSum = CumSum;\n", " CumSum.__name__ = \"CumSum\";\n", " CumSum.init_CumSum();\n", " },\n", " /* models/filters/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var boolean_filter_1 = require(199) /* ./boolean_filter */;\n", " exports.BooleanFilter = boolean_filter_1.BooleanFilter;\n", " var customjs_filter_1 = require(201) /* ./customjs_filter */;\n", " exports.CustomJSFilter = customjs_filter_1.CustomJSFilter;\n", " var filter_1 = require(200) /* ./filter */;\n", " exports.Filter = filter_1.Filter;\n", " var group_filter_1 = require(202) /* ./group_filter */;\n", " exports.GroupFilter = group_filter_1.GroupFilter;\n", " var index_filter_1 = require(203) /* ./index_filter */;\n", " exports.IndexFilter = index_filter_1.IndexFilter;\n", " },\n", " /* models/filters/boolean_filter.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const filter_1 = require(200) /* ./filter */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const logging_1 = require(72) /* ../../core/logging */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " class BooleanFilter extends filter_1.Filter {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_BooleanFilter() {\n", " this.define({\n", " booleans: [p.Array, null],\n", " });\n", " }\n", " compute_indices(source) {\n", " const booleans = this.booleans;\n", " if (booleans != null && booleans.length > 0) {\n", " if (array_1.every(booleans, types_1.isBoolean)) {\n", " if (booleans.length !== source.get_length()) {\n", " logging_1.logger.warn(`${this}: length of booleans doesn't match data source`);\n", " }\n", " return array_1.range(0, booleans.length).filter((i) => booleans[i] === true);\n", " }\n", " else {\n", " logging_1.logger.warn(`${this}: booleans should be array of booleans, defaulting to no filtering`);\n", " return null;\n", " }\n", " }\n", " else {\n", " if (booleans != null && booleans.length == 0)\n", " logging_1.logger.warn(`${this}: booleans is empty, defaulting to no filtering`);\n", " else\n", " logging_1.logger.warn(`${this}: booleans was not set, defaulting to no filtering`);\n", " return null;\n", " }\n", " }\n", " }\n", " exports.BooleanFilter = BooleanFilter;\n", " BooleanFilter.__name__ = \"BooleanFilter\";\n", " BooleanFilter.init_BooleanFilter();\n", " },\n", " /* models/filters/filter.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const model_1 = require(71) /* ../../model */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const logging_1 = require(72) /* ../../core/logging */;\n", " class Filter extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Filter() {\n", " this.define({\n", " filter: [p.Array, null],\n", " });\n", " }\n", " compute_indices(_source) {\n", " const filter = this.filter;\n", " if (filter != null) {\n", " if (types_1.isArrayOf(filter, types_1.isBoolean)) {\n", " return array_1.range(0, filter.length).filter((i) => filter[i] === true);\n", " }\n", " if (types_1.isArrayOf(filter, types_1.isInteger)) {\n", " return filter;\n", " }\n", " logging_1.logger.warn(`${this}: filter should either be array of only booleans or only integers, defaulting to no filtering`);\n", " return null;\n", " }\n", " else {\n", " logging_1.logger.warn(`${this}: filter was not set to be an array, defaulting to no filtering`);\n", " return null;\n", " }\n", " }\n", " }\n", " exports.Filter = Filter;\n", " Filter.__name__ = \"Filter\";\n", " Filter.init_Filter();\n", " },\n", " /* models/filters/customjs_filter.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const filter_1 = require(200) /* ./filter */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const object_1 = require(17) /* ../../core/util/object */;\n", " const string_1 = require(24) /* ../../core/util/string */;\n", " class CustomJSFilter extends filter_1.Filter {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_CustomJSFilter() {\n", " this.define({\n", " args: [p.Any, {}],\n", " code: [p.String, ''],\n", " });\n", " }\n", " get names() {\n", " return object_1.keys(this.args);\n", " }\n", " get values() {\n", " return object_1.values(this.args);\n", " }\n", " get func() {\n", " const code = string_1.use_strict(this.code);\n", " return new Function(...this.names, \"source\", code);\n", " }\n", " compute_indices(source) {\n", " this.filter = this.func(...this.values, source);\n", " return super.compute_indices(source);\n", " }\n", " }\n", " exports.CustomJSFilter = CustomJSFilter;\n", " CustomJSFilter.__name__ = \"CustomJSFilter\";\n", " CustomJSFilter.init_CustomJSFilter();\n", " },\n", " /* models/filters/group_filter.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const filter_1 = require(200) /* ./filter */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const logging_1 = require(72) /* ../../core/logging */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " class GroupFilter extends filter_1.Filter {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.indices = null;\n", " }\n", " static init_GroupFilter() {\n", " this.define({\n", " column_name: [p.String],\n", " group: [p.String],\n", " });\n", " }\n", " compute_indices(source) {\n", " const column = source.get_column(this.column_name);\n", " if (column == null) {\n", " logging_1.logger.warn(\"group filter: groupby column not found in data source\");\n", " return null;\n", " }\n", " else {\n", " this.indices = array_1.range(0, source.get_length() || 0).filter((i) => column[i] === this.group);\n", " if (this.indices.length === 0) {\n", " logging_1.logger.warn(`group filter: group '${this.group}' did not match any values in column '${this.column_name}'`);\n", " }\n", " return this.indices;\n", " }\n", " }\n", " }\n", " exports.GroupFilter = GroupFilter;\n", " GroupFilter.__name__ = \"GroupFilter\";\n", " GroupFilter.init_GroupFilter();\n", " },\n", " /* models/filters/index_filter.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const filter_1 = require(200) /* ./filter */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const logging_1 = require(72) /* ../../core/logging */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " class IndexFilter extends filter_1.Filter {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_IndexFilter() {\n", " this.define({\n", " indices: [p.Array, null],\n", " });\n", " }\n", " compute_indices(_source) {\n", " if (this.indices != null) {\n", " if (array_1.every(this.indices, types_1.isInteger))\n", " return this.indices;\n", " else {\n", " logging_1.logger.warn(`${this}: indices should be array of integers, defaulting to no filtering`);\n", " return null;\n", " }\n", " }\n", " else {\n", " logging_1.logger.warn(`${this}: indices was not set, defaulting to no filtering`);\n", " return null;\n", " }\n", " }\n", " }\n", " exports.IndexFilter = IndexFilter;\n", " IndexFilter.__name__ = \"IndexFilter\";\n", " IndexFilter.init_IndexFilter();\n", " },\n", " /* models/formatters/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var basic_tick_formatter_1 = require(113) /* ./basic_tick_formatter */;\n", " exports.BasicTickFormatter = basic_tick_formatter_1.BasicTickFormatter;\n", " var categorical_tick_formatter_1 = require(154) /* ./categorical_tick_formatter */;\n", " exports.CategoricalTickFormatter = categorical_tick_formatter_1.CategoricalTickFormatter;\n", " var datetime_tick_formatter_1 = require(158) /* ./datetime_tick_formatter */;\n", " exports.DatetimeTickFormatter = datetime_tick_formatter_1.DatetimeTickFormatter;\n", " var func_tick_formatter_1 = require(205) /* ./func_tick_formatter */;\n", " exports.FuncTickFormatter = func_tick_formatter_1.FuncTickFormatter;\n", " var log_tick_formatter_1 = require(171) /* ./log_tick_formatter */;\n", " exports.LogTickFormatter = log_tick_formatter_1.LogTickFormatter;\n", " var mercator_tick_formatter_1 = require(174) /* ./mercator_tick_formatter */;\n", " exports.MercatorTickFormatter = mercator_tick_formatter_1.MercatorTickFormatter;\n", " var numeral_tick_formatter_1 = require(206) /* ./numeral_tick_formatter */;\n", " exports.NumeralTickFormatter = numeral_tick_formatter_1.NumeralTickFormatter;\n", " var printf_tick_formatter_1 = require(207) /* ./printf_tick_formatter */;\n", " exports.PrintfTickFormatter = printf_tick_formatter_1.PrintfTickFormatter;\n", " var tick_formatter_1 = require(114) /* ./tick_formatter */;\n", " exports.TickFormatter = tick_formatter_1.TickFormatter;\n", " },\n", " /* models/formatters/func_tick_formatter.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const tick_formatter_1 = require(114) /* ./tick_formatter */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const object_1 = require(17) /* ../../core/util/object */;\n", " const string_1 = require(24) /* ../../core/util/string */;\n", " class FuncTickFormatter extends tick_formatter_1.TickFormatter {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_FuncTickFormatter() {\n", " this.define({\n", " args: [p.Any, {}],\n", " code: [p.String, ''],\n", " });\n", " }\n", " get names() {\n", " return object_1.keys(this.args);\n", " }\n", " get values() {\n", " return object_1.values(this.args);\n", " }\n", " /*protected*/ _make_func() {\n", " const code = string_1.use_strict(this.code);\n", " return new Function(\"tick\", \"index\", \"ticks\", ...this.names, code);\n", " }\n", " doFormat(ticks, _opts) {\n", " const cache = {};\n", " const func = this._make_func().bind(cache);\n", " return ticks.map((tick, index, ticks) => func(tick, index, ticks, ...this.values));\n", " }\n", " }\n", " exports.FuncTickFormatter = FuncTickFormatter;\n", " FuncTickFormatter.__name__ = \"FuncTickFormatter\";\n", " FuncTickFormatter.init_FuncTickFormatter();\n", " },\n", " /* models/formatters/numeral_tick_formatter.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const Numbro = tslib_1.__importStar(require(161) /* @bokeh/numbro */);\n", " const tick_formatter_1 = require(114) /* ./tick_formatter */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class NumeralTickFormatter extends tick_formatter_1.TickFormatter {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_NumeralTickFormatter() {\n", " this.define({\n", " // TODO (bev) all of these could be tightened up\n", " format: [p.String, '0,0'],\n", " language: [p.String, 'en'],\n", " rounding: [p.RoundingFunction, 'round'],\n", " });\n", " }\n", " get _rounding_fn() {\n", " switch (this.rounding) {\n", " case \"round\":\n", " case \"nearest\":\n", " return Math.round;\n", " case \"floor\":\n", " case \"rounddown\":\n", " return Math.floor;\n", " case \"ceil\":\n", " case \"roundup\":\n", " return Math.ceil;\n", " }\n", " }\n", " doFormat(ticks, _opts) {\n", " const { format, language, _rounding_fn } = this;\n", " return ticks.map((tick) => Numbro.format(tick, format, language, _rounding_fn));\n", " }\n", " }\n", " exports.NumeralTickFormatter = NumeralTickFormatter;\n", " NumeralTickFormatter.__name__ = \"NumeralTickFormatter\";\n", " NumeralTickFormatter.init_NumeralTickFormatter();\n", " },\n", " /* models/formatters/printf_tick_formatter.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const tick_formatter_1 = require(114) /* ./tick_formatter */;\n", " const templating_1 = require(160) /* ../../core/util/templating */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class PrintfTickFormatter extends tick_formatter_1.TickFormatter {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_PrintfTickFormatter() {\n", " this.define({\n", " format: [p.String, '%s'],\n", " });\n", " }\n", " doFormat(ticks, _opts) {\n", " return ticks.map((tick) => templating_1.sprintf(this.format, tick));\n", " }\n", " }\n", " exports.PrintfTickFormatter = PrintfTickFormatter;\n", " PrintfTickFormatter.__name__ = \"PrintfTickFormatter\";\n", " PrintfTickFormatter.init_PrintfTickFormatter();\n", " },\n", " /* models/glyphs/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var annular_wedge_1 = require(209) /* ./annular_wedge */;\n", " exports.AnnularWedge = annular_wedge_1.AnnularWedge;\n", " var annulus_1 = require(210) /* ./annulus */;\n", " exports.Annulus = annulus_1.Annulus;\n", " var arc_1 = require(211) /* ./arc */;\n", " exports.Arc = arc_1.Arc;\n", " var bezier_1 = require(212) /* ./bezier */;\n", " exports.Bezier = bezier_1.Bezier;\n", " var circle_1 = require(213) /* ./circle */;\n", " exports.Circle = circle_1.Circle;\n", " var center_rotatable_1 = require(214) /* ./center_rotatable */;\n", " exports.CenterRotatable = center_rotatable_1.CenterRotatable;\n", " var ellipse_1 = require(215) /* ./ellipse */;\n", " exports.Ellipse = ellipse_1.Ellipse;\n", " var ellipse_oval_1 = require(216) /* ./ellipse_oval */;\n", " exports.EllipseOval = ellipse_oval_1.EllipseOval;\n", " var glyph_1 = require(89) /* ./glyph */;\n", " exports.Glyph = glyph_1.Glyph;\n", " var harea_1 = require(95) /* ./harea */;\n", " exports.HArea = harea_1.HArea;\n", " var hbar_1 = require(217) /* ./hbar */;\n", " exports.HBar = hbar_1.HBar;\n", " var hex_tile_1 = require(219) /* ./hex_tile */;\n", " exports.HexTile = hex_tile_1.HexTile;\n", " var image_1 = require(220) /* ./image */;\n", " exports.Image = image_1.Image;\n", " var image_rgba_1 = require(222) /* ./image_rgba */;\n", " exports.ImageRGBA = image_rgba_1.ImageRGBA;\n", " var image_url_1 = require(223) /* ./image_url */;\n", " exports.ImageURL = image_url_1.ImageURL;\n", " var line_1 = require(83) /* ./line */;\n", " exports.Line = line_1.Line;\n", " var multi_line_1 = require(225) /* ./multi_line */;\n", " exports.MultiLine = multi_line_1.MultiLine;\n", " var multi_polygons_1 = require(226) /* ./multi_polygons */;\n", " exports.MultiPolygons = multi_polygons_1.MultiPolygons;\n", " var oval_1 = require(227) /* ./oval */;\n", " exports.Oval = oval_1.Oval;\n", " var patch_1 = require(94) /* ./patch */;\n", " exports.Patch = patch_1.Patch;\n", " var patches_1 = require(228) /* ./patches */;\n", " exports.Patches = patches_1.Patches;\n", " var quad_1 = require(229) /* ./quad */;\n", " exports.Quad = quad_1.Quad;\n", " var quadratic_1 = require(230) /* ./quadratic */;\n", " exports.Quadratic = quadratic_1.Quadratic;\n", " var ray_1 = require(231) /* ./ray */;\n", " exports.Ray = ray_1.Ray;\n", " var rect_1 = require(232) /* ./rect */;\n", " exports.Rect = rect_1.Rect;\n", " var segment_1 = require(233) /* ./segment */;\n", " exports.Segment = segment_1.Segment;\n", " var step_1 = require(234) /* ./step */;\n", " exports.Step = step_1.Step;\n", " var text_1 = require(235) /* ./text */;\n", " exports.Text = text_1.Text;\n", " var varea_1 = require(97) /* ./varea */;\n", " exports.VArea = varea_1.VArea;\n", " var vbar_1 = require(236) /* ./vbar */;\n", " exports.VBar = vbar_1.VBar;\n", " var wedge_1 = require(237) /* ./wedge */;\n", " exports.Wedge = wedge_1.Wedge;\n", " var xy_glyph_1 = require(84) /* ./xy_glyph */;\n", " exports.XYGlyph = xy_glyph_1.XYGlyph;\n", " },\n", " /* models/glyphs/annular_wedge.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const xy_glyph_1 = require(84) /* ./xy_glyph */;\n", " const utils_1 = require(92) /* ./utils */;\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const math_1 = require(10) /* ../../core/util/math */;\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class AnnularWedgeView extends xy_glyph_1.XYGlyphView {\n", " _map_data() {\n", " if (this.model.properties.inner_radius.units == \"data\")\n", " this.sinner_radius = this.sdist(this.renderer.xscale, this._x, this._inner_radius);\n", " else\n", " this.sinner_radius = this._inner_radius;\n", " if (this.model.properties.outer_radius.units == \"data\")\n", " this.souter_radius = this.sdist(this.renderer.xscale, this._x, this._outer_radius);\n", " else\n", " this.souter_radius = this._outer_radius;\n", " this._angle = new Float32Array(this._start_angle.length);\n", " for (let i = 0, end = this._start_angle.length; i < end; i++) {\n", " this._angle[i] = this._end_angle[i] - this._start_angle[i];\n", " }\n", " }\n", " _render(ctx, indices, { sx, sy, _start_angle, _angle, sinner_radius, souter_radius }) {\n", " const direction = this.model.properties.direction.value();\n", " for (const i of indices) {\n", " if (isNaN(sx[i] + sy[i] + sinner_radius[i] + souter_radius[i] + _start_angle[i] + _angle[i]))\n", " continue;\n", " ctx.translate(sx[i], sy[i]);\n", " ctx.rotate(_start_angle[i]);\n", " ctx.moveTo(souter_radius[i], 0);\n", " ctx.beginPath();\n", " ctx.arc(0, 0, souter_radius[i], 0, _angle[i], direction);\n", " ctx.rotate(_angle[i]);\n", " ctx.lineTo(sinner_radius[i], 0);\n", " ctx.arc(0, 0, sinner_radius[i], 0, -_angle[i], !direction);\n", " ctx.closePath();\n", " ctx.rotate(-_angle[i] - _start_angle[i]);\n", " ctx.translate(-sx[i], -sy[i]);\n", " if (this.visuals.fill.doit) {\n", " this.visuals.fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " }\n", " _hit_point(geometry) {\n", " const { sx, sy } = geometry;\n", " const x = this.renderer.xscale.invert(sx);\n", " const y = this.renderer.yscale.invert(sy);\n", " // check radius first\n", " let x0, y0;\n", " let x1, y1;\n", " if (this.model.properties.outer_radius.units == \"data\") {\n", " x0 = x - this.max_outer_radius;\n", " x1 = x + this.max_outer_radius;\n", " y0 = y - this.max_outer_radius;\n", " y1 = y + this.max_outer_radius;\n", " }\n", " else {\n", " const sx0 = sx - this.max_outer_radius;\n", " const sx1 = sx + this.max_outer_radius;\n", " [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " const sy0 = sy - this.max_outer_radius;\n", " const sy1 = sy + this.max_outer_radius;\n", " [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " }\n", " const candidates = [];\n", " for (const i of this.index.indices({ x0, x1, y0, y1 })) {\n", " const or2 = this.souter_radius[i] ** 2;\n", " const ir2 = this.sinner_radius[i] ** 2;\n", " const [sx0, sx1] = this.renderer.xscale.r_compute(x, this._x[i]);\n", " const [sy0, sy1] = this.renderer.yscale.r_compute(y, this._y[i]);\n", " const dist = (sx0 - sx1) ** 2 + (sy0 - sy1) ** 2;\n", " if (dist <= or2 && dist >= ir2)\n", " candidates.push([i, dist]);\n", " }\n", " const direction = this.model.properties.direction.value();\n", " const hits = [];\n", " for (const [i, dist] of candidates) {\n", " // NOTE: minus the angle because JS uses non-mathy convention for angles\n", " const angle = Math.atan2(sy - this.sy[i], sx - this.sx[i]);\n", " if (math_1.angle_between(-angle, -this._start_angle[i], -this._end_angle[i], direction)) {\n", " hits.push([i, dist]);\n", " }\n", " }\n", " return selection_1.Selection.from_hits(hits);\n", " }\n", " draw_legend_for_index(ctx, bbox, index) {\n", " utils_1.generic_area_legend(this.visuals, ctx, bbox, index);\n", " }\n", " _scenterxy(i) {\n", " const r = (this.sinner_radius[i] + this.souter_radius[i]) / 2;\n", " const a = (this._start_angle[i] + this._end_angle[i]) / 2;\n", " return { x: this.sx[i] + (r * Math.cos(a)), y: this.sy[i] + (r * Math.sin(a)) };\n", " }\n", " scenterx(i) {\n", " return this._scenterxy(i).x;\n", " }\n", " scentery(i) {\n", " return this._scenterxy(i).y;\n", " }\n", " }\n", " exports.AnnularWedgeView = AnnularWedgeView;\n", " AnnularWedgeView.__name__ = \"AnnularWedgeView\";\n", " class AnnularWedge extends xy_glyph_1.XYGlyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_AnnularWedge() {\n", " this.prototype.default_view = AnnularWedgeView;\n", " this.mixins([property_mixins_1.LineVector, property_mixins_1.FillVector]);\n", " this.define({\n", " direction: [p.Direction, 'anticlock'],\n", " inner_radius: [p.DistanceSpec],\n", " outer_radius: [p.DistanceSpec],\n", " start_angle: [p.AngleSpec],\n", " end_angle: [p.AngleSpec],\n", " });\n", " }\n", " }\n", " exports.AnnularWedge = AnnularWedge;\n", " AnnularWedge.__name__ = \"AnnularWedge\";\n", " AnnularWedge.init_AnnularWedge();\n", " },\n", " /* models/glyphs/annulus.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const xy_glyph_1 = require(84) /* ./xy_glyph */;\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const compat_1 = require(28) /* ../../core/util/compat */;\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class AnnulusView extends xy_glyph_1.XYGlyphView {\n", " _map_data() {\n", " if (this.model.properties.inner_radius.units == \"data\")\n", " this.sinner_radius = this.sdist(this.renderer.xscale, this._x, this._inner_radius);\n", " else\n", " this.sinner_radius = this._inner_radius;\n", " if (this.model.properties.outer_radius.units == \"data\")\n", " this.souter_radius = this.sdist(this.renderer.xscale, this._x, this._outer_radius);\n", " else\n", " this.souter_radius = this._outer_radius;\n", " }\n", " _render(ctx, indices, { sx, sy, sinner_radius, souter_radius }) {\n", " for (const i of indices) {\n", " if (isNaN(sx[i] + sy[i] + sinner_radius[i] + souter_radius[i]))\n", " continue;\n", " // Because this visual has a whole in it, it proved \"challenging\"\n", " // for some browsers to render if drawn in one go --- i.e. it did not\n", " // work on IE. If we render in two parts (upper and lower part),\n", " // it is unambiguous what part should be filled. The line is\n", " // better drawn in one go though, otherwise the part where the pieces\n", " // meet will not be fully closed due to aa.\n", " if (this.visuals.fill.doit) {\n", " this.visuals.fill.set_vectorize(ctx, i);\n", " ctx.beginPath();\n", " if (compat_1.is_ie) {\n", " // Draw two halves of the donut. Works on IE, but causes an aa line on Safari.\n", " for (const clockwise of [false, true]) {\n", " ctx.arc(sx[i], sy[i], sinner_radius[i], 0, Math.PI, clockwise);\n", " ctx.arc(sx[i], sy[i], souter_radius[i], Math.PI, 0, !clockwise);\n", " }\n", " }\n", " else {\n", " // Draw donut in one go. Does not work on iE.\n", " ctx.arc(sx[i], sy[i], sinner_radius[i], 0, 2 * Math.PI, true);\n", " ctx.arc(sx[i], sy[i], souter_radius[i], 2 * Math.PI, 0, false);\n", " }\n", " ctx.fill();\n", " }\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.beginPath();\n", " ctx.arc(sx[i], sy[i], sinner_radius[i], 0, 2 * Math.PI);\n", " ctx.moveTo(sx[i] + souter_radius[i], sy[i]);\n", " ctx.arc(sx[i], sy[i], souter_radius[i], 0, 2 * Math.PI);\n", " ctx.stroke();\n", " }\n", " }\n", " }\n", " _hit_point(geometry) {\n", " const { sx, sy } = geometry;\n", " const x = this.renderer.xscale.invert(sx);\n", " const y = this.renderer.yscale.invert(sy);\n", " let x0, y0;\n", " let x1, y1;\n", " if (this.model.properties.outer_radius.units == \"data\") {\n", " x0 = x - this.max_outer_radius;\n", " x1 = x + this.max_outer_radius;\n", " y0 = y - this.max_outer_radius;\n", " y1 = y + this.max_outer_radius;\n", " }\n", " else {\n", " const sx0 = sx - this.max_outer_radius;\n", " const sx1 = sx + this.max_outer_radius;\n", " [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " const sy0 = sy - this.max_outer_radius;\n", " const sy1 = sy + this.max_outer_radius;\n", " [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " }\n", " const hits = [];\n", " for (const i of this.index.indices({ x0, x1, y0, y1 })) {\n", " const or2 = this.souter_radius[i] ** 2;\n", " const ir2 = this.sinner_radius[i] ** 2;\n", " const [sx0, sx1] = this.renderer.xscale.r_compute(x, this._x[i]);\n", " const [sy0, sy1] = this.renderer.yscale.r_compute(y, this._y[i]);\n", " const dist = (sx0 - sx1) ** 2 + (sy0 - sy1) ** 2;\n", " if (dist <= or2 && dist >= ir2)\n", " hits.push([i, dist]);\n", " }\n", " return selection_1.Selection.from_hits(hits);\n", " }\n", " draw_legend_for_index(ctx, { x0, y0, x1, y1 }, index) {\n", " const len = index + 1;\n", " const sx = new Array(len);\n", " sx[index] = (x0 + x1) / 2;\n", " const sy = new Array(len);\n", " sy[index] = (y0 + y1) / 2;\n", " const r = Math.min(Math.abs(x1 - x0), Math.abs(y1 - y0)) * 0.5;\n", " const sinner_radius = new Array(len);\n", " sinner_radius[index] = r * 0.4;\n", " const souter_radius = new Array(len);\n", " souter_radius[index] = r * 0.8;\n", " this._render(ctx, [index], { sx, sy, sinner_radius, souter_radius }); // XXX\n", " }\n", " }\n", " exports.AnnulusView = AnnulusView;\n", " AnnulusView.__name__ = \"AnnulusView\";\n", " class Annulus extends xy_glyph_1.XYGlyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Annulus() {\n", " this.prototype.default_view = AnnulusView;\n", " this.mixins([property_mixins_1.LineVector, property_mixins_1.FillVector]);\n", " this.define({\n", " inner_radius: [p.DistanceSpec],\n", " outer_radius: [p.DistanceSpec],\n", " });\n", " }\n", " }\n", " exports.Annulus = Annulus;\n", " Annulus.__name__ = \"Annulus\";\n", " Annulus.init_Annulus();\n", " },\n", " /* models/glyphs/arc.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const xy_glyph_1 = require(84) /* ./xy_glyph */;\n", " const utils_1 = require(92) /* ./utils */;\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class ArcView extends xy_glyph_1.XYGlyphView {\n", " _map_data() {\n", " if (this.model.properties.radius.units == \"data\")\n", " this.sradius = this.sdist(this.renderer.xscale, this._x, this._radius);\n", " else\n", " this.sradius = this._radius;\n", " }\n", " _render(ctx, indices, { sx, sy, sradius, _start_angle, _end_angle }) {\n", " if (this.visuals.line.doit) {\n", " const direction = this.model.properties.direction.value();\n", " for (const i of indices) {\n", " if (isNaN(sx[i] + sy[i] + sradius[i] + _start_angle[i] + _end_angle[i]))\n", " continue;\n", " ctx.beginPath();\n", " ctx.arc(sx[i], sy[i], sradius[i], _start_angle[i], _end_angle[i], direction);\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " }\n", " draw_legend_for_index(ctx, bbox, index) {\n", " utils_1.generic_line_legend(this.visuals, ctx, bbox, index);\n", " }\n", " }\n", " exports.ArcView = ArcView;\n", " ArcView.__name__ = \"ArcView\";\n", " class Arc extends xy_glyph_1.XYGlyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Arc() {\n", " this.prototype.default_view = ArcView;\n", " this.mixins(property_mixins_1.LineVector);\n", " this.define({\n", " direction: [p.Direction, 'anticlock'],\n", " radius: [p.DistanceSpec],\n", " start_angle: [p.AngleSpec],\n", " end_angle: [p.AngleSpec],\n", " });\n", " }\n", " }\n", " exports.Arc = Arc;\n", " Arc.__name__ = \"Arc\";\n", " Arc.init_Arc();\n", " },\n", " /* models/glyphs/bezier.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const spatial_1 = require(85) /* ../../core/util/spatial */;\n", " const glyph_1 = require(89) /* ./glyph */;\n", " const utils_1 = require(92) /* ./utils */;\n", " // algorithm adapted from http://stackoverflow.com/a/14429749/3406693\n", " function _cbb(x0, y0, x1, y1, x2, y2, x3, y3) {\n", " const tvalues = [];\n", " const bounds = [[], []];\n", " for (let i = 0; i <= 2; i++) {\n", " let a, b, c;\n", " if (i === 0) {\n", " b = ((6 * x0) - (12 * x1)) + (6 * x2);\n", " a = (((-3 * x0) + (9 * x1)) - (9 * x2)) + (3 * x3);\n", " c = (3 * x1) - (3 * x0);\n", " }\n", " else {\n", " b = ((6 * y0) - (12 * y1)) + (6 * y2);\n", " a = (((-3 * y0) + (9 * y1)) - (9 * y2)) + (3 * y3);\n", " c = (3 * y1) - (3 * y0);\n", " }\n", " if (Math.abs(a) < 1e-12) { // Numerical robustness\n", " if (Math.abs(b) < 1e-12) // Numerical robustness\n", " continue;\n", " const t = -c / b;\n", " if (0 < t && t < 1)\n", " tvalues.push(t);\n", " continue;\n", " }\n", " const b2ac = (b * b) - (4 * c * a);\n", " const sqrtb2ac = Math.sqrt(b2ac);\n", " if (b2ac < 0)\n", " continue;\n", " const t1 = (-b + sqrtb2ac) / (2 * a);\n", " if (0 < t1 && t1 < 1)\n", " tvalues.push(t1);\n", " const t2 = (-b - sqrtb2ac) / (2 * a);\n", " if (0 < t2 && t2 < 1)\n", " tvalues.push(t2);\n", " }\n", " let j = tvalues.length;\n", " const jlen = j;\n", " while (j--) {\n", " const t = tvalues[j];\n", " const mt = 1 - t;\n", " const x = (mt * mt * mt * x0) + (3 * mt * mt * t * x1) + (3 * mt * t * t * x2) + (t * t * t * x3);\n", " bounds[0][j] = x;\n", " const y = (mt * mt * mt * y0) + (3 * mt * mt * t * y1) + (3 * mt * t * t * y2) + (t * t * t * y3);\n", " bounds[1][j] = y;\n", " }\n", " bounds[0][jlen] = x0;\n", " bounds[1][jlen] = y0;\n", " bounds[0][jlen + 1] = x3;\n", " bounds[1][jlen + 1] = y3;\n", " return [\n", " Math.min(...bounds[0]),\n", " Math.max(...bounds[1]),\n", " Math.max(...bounds[0]),\n", " Math.min(...bounds[1]),\n", " ];\n", " }\n", " class BezierView extends glyph_1.GlyphView {\n", " _index_data() {\n", " const points = [];\n", " for (let i = 0, end = this._x0.length; i < end; i++) {\n", " if (isNaN(this._x0[i] + this._x1[i] + this._y0[i] + this._y1[i] + this._cx0[i] + this._cy0[i] + this._cx1[i] + this._cy1[i]))\n", " continue;\n", " const [x0, y0, x1, y1] = _cbb(this._x0[i], this._y0[i], this._x1[i], this._y1[i], this._cx0[i], this._cy0[i], this._cx1[i], this._cy1[i]);\n", " points.push({ x0, y0, x1, y1, i });\n", " }\n", " return new spatial_1.SpatialIndex(points);\n", " }\n", " _render(ctx, indices, { sx0, sy0, sx1, sy1, scx0, scy0, scx1, scy1 }) {\n", " if (this.visuals.line.doit) {\n", " for (const i of indices) {\n", " if (isNaN(sx0[i] + sy0[i] + sx1[i] + sy1[i] + scx0[i] + scy0[i] + scx1[i] + scy1[i]))\n", " continue;\n", " ctx.beginPath();\n", " ctx.moveTo(sx0[i], sy0[i]);\n", " ctx.bezierCurveTo(scx0[i], scy0[i], scx1[i], scy1[i], sx1[i], sy1[i]);\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " }\n", " draw_legend_for_index(ctx, bbox, index) {\n", " utils_1.generic_line_legend(this.visuals, ctx, bbox, index);\n", " }\n", " scenterx() {\n", " throw new Error(\"not implemented\");\n", " }\n", " scentery() {\n", " throw new Error(\"not implemented\");\n", " }\n", " }\n", " exports.BezierView = BezierView;\n", " BezierView.__name__ = \"BezierView\";\n", " class Bezier extends glyph_1.Glyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Bezier() {\n", " this.prototype.default_view = BezierView;\n", " this.coords([['x0', 'y0'], ['x1', 'y1'], ['cx0', 'cy0'], ['cx1', 'cy1']]);\n", " this.mixins(property_mixins_1.LineVector);\n", " }\n", " }\n", " exports.Bezier = Bezier;\n", " Bezier.__name__ = \"Bezier\";\n", " Bezier.init_Bezier();\n", " },\n", " /* models/glyphs/circle.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const xy_glyph_1 = require(84) /* ./xy_glyph */;\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const hittest = tslib_1.__importStar(require(93) /* ../../core/hittest */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const arrayable_1 = require(12) /* ../../core/util/arrayable */;\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class CircleView extends xy_glyph_1.XYGlyphView {\n", " _map_data() {\n", " // XXX: Order is important here: size is always present (at least\n", " // a default), but radius is only present if a user specifies it.\n", " if (this._radius != null) {\n", " if (this.model.properties.radius.units == \"data\") {\n", " switch (this.model.radius_dimension) {\n", " case \"x\": {\n", " this.sradius = this.sdist(this.renderer.xscale, this._x, this._radius);\n", " break;\n", " }\n", " case \"y\": {\n", " this.sradius = this.sdist(this.renderer.yscale, this._y, this._radius);\n", " break;\n", " }\n", " case \"max\": {\n", " const sradius_x = this.sdist(this.renderer.xscale, this._x, this._radius);\n", " const sradius_y = this.sdist(this.renderer.yscale, this._y, this._radius);\n", " this.sradius = arrayable_1.map(sradius_x, (s, i) => Math.max(s, sradius_y[i]));\n", " break;\n", " }\n", " case \"min\": {\n", " const sradius_x = this.sdist(this.renderer.xscale, this._x, this._radius);\n", " const sradius_y = this.sdist(this.renderer.yscale, this._y, this._radius);\n", " this.sradius = arrayable_1.map(sradius_x, (s, i) => Math.min(s, sradius_y[i]));\n", " break;\n", " }\n", " }\n", " }\n", " else {\n", " this.sradius = this._radius;\n", " this.max_size = 2 * this.max_radius;\n", " }\n", " }\n", " else\n", " this.sradius = arrayable_1.map(this._size, (s) => s / 2);\n", " }\n", " _mask_data() {\n", " const [hr, vr] = this.renderer.plot_view.frame.bbox.ranges;\n", " let x0, y0;\n", " let x1, y1;\n", " if (this._radius != null && this.model.properties.radius.units == \"data\") {\n", " const sx0 = hr.start;\n", " const sx1 = hr.end;\n", " [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " x0 -= this.max_radius;\n", " x1 += this.max_radius;\n", " const sy0 = vr.start;\n", " const sy1 = vr.end;\n", " [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " y0 -= this.max_radius;\n", " y1 += this.max_radius;\n", " }\n", " else {\n", " const sx0 = hr.start - this.max_size;\n", " const sx1 = hr.end + this.max_size;\n", " [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " const sy0 = vr.start - this.max_size;\n", " const sy1 = vr.end + this.max_size;\n", " [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " }\n", " return this.index.indices({ x0, x1, y0, y1 });\n", " }\n", " _render(ctx, indices, { sx, sy, sradius }) {\n", " for (const i of indices) {\n", " if (isNaN(sx[i] + sy[i] + sradius[i]))\n", " continue;\n", " ctx.beginPath();\n", " ctx.arc(sx[i], sy[i], sradius[i], 0, 2 * Math.PI, false);\n", " if (this.visuals.fill.doit) {\n", " this.visuals.fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " }\n", " _hit_point(geometry) {\n", " const { sx, sy } = geometry;\n", " const x = this.renderer.xscale.invert(sx);\n", " const y = this.renderer.yscale.invert(sy);\n", " let x0, x1, y0, y1;\n", " if (this._radius != null && this.model.properties.radius.units == \"data\") {\n", " x0 = x - this.max_radius;\n", " x1 = x + this.max_radius;\n", " y0 = y - this.max_radius;\n", " y1 = y + this.max_radius;\n", " }\n", " else {\n", " const sx0 = sx - this.max_size;\n", " const sx1 = sx + this.max_size;\n", " [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " const sy0 = sy - this.max_size;\n", " const sy1 = sy + this.max_size;\n", " [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " }\n", " const candidates = this.index.indices({ x0, x1, y0, y1 });\n", " const hits = [];\n", " if (this._radius != null && this.model.properties.radius.units == \"data\") {\n", " for (const i of candidates) {\n", " const r2 = this.sradius[i] ** 2;\n", " const [sx0, sx1] = this.renderer.xscale.r_compute(x, this._x[i]);\n", " const [sy0, sy1] = this.renderer.yscale.r_compute(y, this._y[i]);\n", " const dist = (sx0 - sx1) ** 2 + (sy0 - sy1) ** 2;\n", " if (dist <= r2) {\n", " hits.push([i, dist]);\n", " }\n", " }\n", " }\n", " else {\n", " for (const i of candidates) {\n", " const r2 = this.sradius[i] ** 2;\n", " const dist = (this.sx[i] - sx) ** 2 + (this.sy[i] - sy) ** 2;\n", " if (dist <= r2) {\n", " hits.push([i, dist]);\n", " }\n", " }\n", " }\n", " return selection_1.Selection.from_hits(hits);\n", " }\n", " _hit_span(geometry) {\n", " const { sx, sy } = geometry;\n", " const bounds = this.bounds();\n", " let x0, x1, y0, y1;\n", " if (geometry.direction == 'h') {\n", " // use circle bounds instead of current pointer y coordinates\n", " let sx0, sx1;\n", " y0 = bounds.y0;\n", " y1 = bounds.y1;\n", " if (this._radius != null && this.model.properties.radius.units == \"data\") {\n", " sx0 = sx - this.max_radius;\n", " sx1 = sx + this.max_radius;\n", " [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " }\n", " else {\n", " const ms = this.max_size / 2;\n", " sx0 = sx - ms;\n", " sx1 = sx + ms;\n", " [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " }\n", " }\n", " else {\n", " // use circle bounds instead of current pointer x coordinates\n", " let sy0, sy1;\n", " x0 = bounds.x0;\n", " x1 = bounds.x1;\n", " if (this._radius != null && this.model.properties.radius.units == \"data\") {\n", " sy0 = sy - this.max_radius;\n", " sy1 = sy + this.max_radius;\n", " [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " }\n", " else {\n", " const ms = this.max_size / 2;\n", " sy0 = sy - ms;\n", " sy1 = sy + ms;\n", " [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " }\n", " }\n", " const indices = this.index.indices({ x0, x1, y0, y1 });\n", " return new selection_1.Selection({ indices });\n", " }\n", " _hit_rect(geometry) {\n", " const { sx0, sx1, sy0, sy1 } = geometry;\n", " const [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " const [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " const indices = this.index.indices({ x0, x1, y0, y1 });\n", " return new selection_1.Selection({ indices });\n", " }\n", " _hit_poly(geometry) {\n", " const { sx, sy } = geometry;\n", " // TODO (bev) use spatial index to pare candidate list\n", " const candidates = array_1.range(0, this.sx.length);\n", " const indices = [];\n", " for (let i = 0, end = candidates.length; i < end; i++) {\n", " const index = candidates[i];\n", " if (hittest.point_in_poly(this.sx[i], this.sy[i], sx, sy)) {\n", " indices.push(index);\n", " }\n", " }\n", " return new selection_1.Selection({ indices });\n", " }\n", " // circle does not inherit from marker (since it also accepts radius) so we\n", " // must supply a draw_legend for it here\n", " draw_legend_for_index(ctx, { x0, y0, x1, y1 }, index) {\n", " // using objects like this seems a little wonky, since the keys are coerced to\n", " // stings, but it works\n", " const len = index + 1;\n", " const sx = new Array(len);\n", " sx[index] = (x0 + x1) / 2;\n", " const sy = new Array(len);\n", " sy[index] = (y0 + y1) / 2;\n", " const sradius = new Array(len);\n", " sradius[index] = Math.min(Math.abs(x1 - x0), Math.abs(y1 - y0)) * 0.2;\n", " this._render(ctx, [index], { sx, sy, sradius }); // XXX\n", " }\n", " }\n", " exports.CircleView = CircleView;\n", " CircleView.__name__ = \"CircleView\";\n", " class Circle extends xy_glyph_1.XYGlyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Circle() {\n", " this.prototype.default_view = CircleView;\n", " this.mixins([property_mixins_1.LineVector, property_mixins_1.FillVector]);\n", " this.define({\n", " angle: [p.AngleSpec, 0],\n", " size: [p.DistanceSpec, { units: \"screen\", value: 4 }],\n", " radius: [p.DistanceSpec, undefined, { optional: true }],\n", " radius_dimension: [p.RadiusDimension, 'x'],\n", " });\n", " }\n", " }\n", " exports.Circle = Circle;\n", " Circle.__name__ = \"Circle\";\n", " Circle.init_Circle();\n", " },\n", " /* models/glyphs/center_rotatable.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const xy_glyph_1 = require(84) /* ./xy_glyph */;\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class CenterRotatableView extends xy_glyph_1.XYGlyphView {\n", " }\n", " exports.CenterRotatableView = CenterRotatableView;\n", " CenterRotatableView.__name__ = \"CenterRotatableView\";\n", " class CenterRotatable extends xy_glyph_1.XYGlyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_CenterRotatable() {\n", " this.mixins([property_mixins_1.LineVector, property_mixins_1.FillVector]);\n", " this.define({\n", " angle: [p.AngleSpec, 0],\n", " width: [p.DistanceSpec],\n", " height: [p.DistanceSpec],\n", " });\n", " }\n", " }\n", " exports.CenterRotatable = CenterRotatable;\n", " CenterRotatable.__name__ = \"CenterRotatable\";\n", " CenterRotatable.init_CenterRotatable();\n", " },\n", " /* models/glyphs/ellipse.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const ellipse_oval_1 = require(216) /* ./ellipse_oval */;\n", " class EllipseView extends ellipse_oval_1.EllipseOvalView {\n", " }\n", " exports.EllipseView = EllipseView;\n", " EllipseView.__name__ = \"EllipseView\";\n", " class Ellipse extends ellipse_oval_1.EllipseOval {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Ellipse() {\n", " this.prototype.default_view = EllipseView;\n", " }\n", " }\n", " exports.Ellipse = Ellipse;\n", " Ellipse.__name__ = \"Ellipse\";\n", " Ellipse.init_Ellipse();\n", " },\n", " /* models/glyphs/ellipse_oval.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const center_rotatable_1 = require(214) /* ./center_rotatable */;\n", " const hittest = tslib_1.__importStar(require(93) /* ../../core/hittest */);\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class EllipseOvalView extends center_rotatable_1.CenterRotatableView {\n", " _set_data() {\n", " this.max_w2 = 0;\n", " if (this.model.properties.width.units == \"data\")\n", " this.max_w2 = this.max_width / 2;\n", " this.max_h2 = 0;\n", " if (this.model.properties.height.units == \"data\")\n", " this.max_h2 = this.max_height / 2;\n", " }\n", " _map_data() {\n", " if (this.model.properties.width.units == \"data\")\n", " this.sw = this.sdist(this.renderer.xscale, this._x, this._width, 'center');\n", " else\n", " this.sw = this._width;\n", " if (this.model.properties.height.units == \"data\")\n", " this.sh = this.sdist(this.renderer.yscale, this._y, this._height, 'center');\n", " else\n", " this.sh = this._height;\n", " }\n", " _render(ctx, indices, { sx, sy, sw, sh, _angle }) {\n", " for (const i of indices) {\n", " if (isNaN(sx[i] + sy[i] + sw[i] + sh[i] + _angle[i]))\n", " continue;\n", " ctx.beginPath();\n", " ctx.ellipse(sx[i], sy[i], sw[i] / 2.0, sh[i] / 2.0, _angle[i], 0, 2 * Math.PI);\n", " if (this.visuals.fill.doit) {\n", " this.visuals.fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " }\n", " _hit_point(geometry) {\n", " let x0, x1, y0, y1, cond, dist, sx0, sx1, sy0, sy1;\n", " const { sx, sy } = geometry;\n", " const x = this.renderer.xscale.invert(sx);\n", " const y = this.renderer.yscale.invert(sy);\n", " if (this.model.properties.width.units == \"data\") {\n", " x0 = x - this.max_width;\n", " x1 = x + this.max_width;\n", " }\n", " else {\n", " sx0 = sx - this.max_width;\n", " sx1 = sx + this.max_width;\n", " [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " }\n", " if (this.model.properties.height.units == \"data\") {\n", " y0 = y - this.max_height;\n", " y1 = y + this.max_height;\n", " }\n", " else {\n", " sy0 = sy - this.max_height;\n", " sy1 = sy + this.max_height;\n", " [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " }\n", " const candidates = this.index.indices({ x0, x1, y0, y1 });\n", " const hits = [];\n", " for (const i of candidates) {\n", " cond = hittest.point_in_ellipse(sx, sy, this._angle[i], this.sh[i] / 2, this.sw[i] / 2, this.sx[i], this.sy[i]);\n", " if (cond) {\n", " [sx0, sx1] = this.renderer.xscale.r_compute(x, this._x[i]);\n", " [sy0, sy1] = this.renderer.yscale.r_compute(y, this._y[i]);\n", " dist = (sx0 - sx1) ** 2 + (sy0 - sy1) ** 2;\n", " hits.push([i, dist]);\n", " }\n", " }\n", " return selection_1.Selection.from_hits(hits);\n", " }\n", " draw_legend_for_index(ctx, { x0, y0, x1, y1 }, index) {\n", " const len = index + 1;\n", " const sx = new Array(len);\n", " sx[index] = (x0 + x1) / 2;\n", " const sy = new Array(len);\n", " sy[index] = (y0 + y1) / 2;\n", " const scale = this.sw[index] / this.sh[index];\n", " const d = Math.min(Math.abs(x1 - x0), Math.abs(y1 - y0)) * 0.8;\n", " const sw = new Array(len);\n", " const sh = new Array(len);\n", " if (scale > 1) {\n", " sw[index] = d;\n", " sh[index] = d / scale;\n", " }\n", " else {\n", " sw[index] = d * scale;\n", " sh[index] = d;\n", " }\n", " this._render(ctx, [index], { sx, sy, sw, sh, _angle: [0] }); // XXX\n", " }\n", " _bounds({ x0, x1, y0, y1 }) {\n", " return {\n", " x0: x0 - this.max_w2,\n", " x1: x1 + this.max_w2,\n", " y0: y0 - this.max_h2,\n", " y1: y1 + this.max_h2,\n", " };\n", " }\n", " }\n", " exports.EllipseOvalView = EllipseOvalView;\n", " EllipseOvalView.__name__ = \"EllipseOvalView\";\n", " class EllipseOval extends center_rotatable_1.CenterRotatable {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " }\n", " exports.EllipseOval = EllipseOval;\n", " EllipseOval.__name__ = \"EllipseOval\";\n", " },\n", " /* models/glyphs/hbar.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const box_1 = require(218) /* ./box */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class HBarView extends box_1.BoxView {\n", " scenterx(i) {\n", " return (this.sleft[i] + this.sright[i]) / 2;\n", " }\n", " scentery(i) {\n", " return this.sy[i];\n", " }\n", " _index_data() {\n", " return this._index_box(this._y.length);\n", " }\n", " _lrtb(i) {\n", " const l = Math.min(this._left[i], this._right[i]);\n", " const r = Math.max(this._left[i], this._right[i]);\n", " const t = this._y[i] + 0.5 * this._height[i];\n", " const b = this._y[i] - 0.5 * this._height[i];\n", " return [l, r, t, b];\n", " }\n", " _map_data() {\n", " this.sy = this.renderer.yscale.v_compute(this._y);\n", " this.sh = this.sdist(this.renderer.yscale, this._y, this._height, \"center\");\n", " this.sleft = this.renderer.xscale.v_compute(this._left);\n", " this.sright = this.renderer.xscale.v_compute(this._right);\n", " const n = this.sy.length;\n", " this.stop = new Float64Array(n);\n", " this.sbottom = new Float64Array(n);\n", " for (let i = 0; i < n; i++) {\n", " this.stop[i] = this.sy[i] - this.sh[i] / 2;\n", " this.sbottom[i] = this.sy[i] + this.sh[i] / 2;\n", " }\n", " this._clamp_viewport();\n", " }\n", " }\n", " exports.HBarView = HBarView;\n", " HBarView.__name__ = \"HBarView\";\n", " class HBar extends box_1.Box {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_HBar() {\n", " this.prototype.default_view = HBarView;\n", " this.coords([['left', 'y']]);\n", " this.define({\n", " height: [p.NumberSpec],\n", " right: [p.CoordinateSpec],\n", " });\n", " this.override({ left: 0 });\n", " }\n", " }\n", " exports.HBar = HBar;\n", " HBar.__name__ = \"HBar\";\n", " HBar.init_HBar();\n", " },\n", " /* models/glyphs/box.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const spatial_1 = require(85) /* ../../core/util/spatial */;\n", " const glyph_1 = require(89) /* ./glyph */;\n", " const utils_1 = require(92) /* ./utils */;\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class BoxView extends glyph_1.GlyphView {\n", " get_anchor_point(anchor, i, _spt) {\n", " const left = Math.min(this.sleft[i], this.sright[i]);\n", " const right = Math.max(this.sright[i], this.sleft[i]);\n", " const top = Math.min(this.stop[i], this.sbottom[i]); // screen coordinates !!!\n", " const bottom = Math.max(this.sbottom[i], this.stop[i]); //\n", " switch (anchor) {\n", " case \"top_left\": return { x: left, y: top };\n", " case \"top_center\": return { x: (left + right) / 2, y: top };\n", " case \"top_right\": return { x: right, y: top };\n", " case \"bottom_left\": return { x: left, y: bottom };\n", " case \"bottom_center\": return { x: (left + right) / 2, y: bottom };\n", " case \"bottom_right\": return { x: right, y: bottom };\n", " case \"center_left\": return { x: left, y: (top + bottom) / 2 };\n", " case \"center\": return { x: (left + right) / 2, y: (top + bottom) / 2 };\n", " case \"center_right\": return { x: right, y: (top + bottom) / 2 };\n", " default: return null;\n", " }\n", " }\n", " _index_box(len) {\n", " const points = [];\n", " for (let i = 0; i < len; i++) {\n", " const [l, r, t, b] = this._lrtb(i);\n", " if (isNaN(l + r + t + b) || !isFinite(l + r + t + b))\n", " continue;\n", " points.push({\n", " x0: Math.min(l, r),\n", " y0: Math.min(t, b),\n", " x1: Math.max(r, l),\n", " y1: Math.max(t, b),\n", " i,\n", " });\n", " }\n", " return new spatial_1.SpatialIndex(points);\n", " }\n", " _render(ctx, indices, { sleft, sright, stop, sbottom }) {\n", " for (const i of indices) {\n", " if (isNaN(sleft[i] + stop[i] + sright[i] + sbottom[i]))\n", " continue;\n", " ctx.rect(sleft[i], stop[i], sright[i] - sleft[i], sbottom[i] - stop[i]);\n", " if (this.visuals.fill.doit) {\n", " this.visuals.fill.set_vectorize(ctx, i);\n", " ctx.beginPath();\n", " ctx.rect(sleft[i], stop[i], sright[i] - sleft[i], sbottom[i] - stop[i]);\n", " ctx.fill();\n", " }\n", " this.visuals.hatch.doit2(ctx, i, () => {\n", " ctx.beginPath();\n", " ctx.rect(sleft[i], stop[i], sright[i] - sleft[i], sbottom[i] - stop[i]);\n", " ctx.fill();\n", " }, () => this.renderer.request_render());\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.beginPath();\n", " ctx.rect(sleft[i], stop[i], sright[i] - sleft[i], sbottom[i] - stop[i]);\n", " ctx.stroke();\n", " }\n", " }\n", " }\n", " // We need to clamp the endpoints inside the viewport, because various browser canvas\n", " // implementations have issues drawing rects with enpoints far outside the viewport\n", " _clamp_viewport() {\n", " const hr = this.renderer.plot_view.frame.bbox.h_range;\n", " const vr = this.renderer.plot_view.frame.bbox.v_range;\n", " const n = this.stop.length;\n", " for (let i = 0; i < n; i++) {\n", " this.stop[i] = Math.max(this.stop[i], vr.start);\n", " this.sbottom[i] = Math.min(this.sbottom[i], vr.end);\n", " this.sleft[i] = Math.max(this.sleft[i], hr.start);\n", " this.sright[i] = Math.min(this.sright[i], hr.end);\n", " }\n", " }\n", " _hit_rect(geometry) {\n", " return this._hit_rect_against_index(geometry);\n", " }\n", " _hit_point(geometry) {\n", " const { sx, sy } = geometry;\n", " const x = this.renderer.xscale.invert(sx);\n", " const y = this.renderer.yscale.invert(sy);\n", " const indices = this.index.indices({ x0: x, y0: y, x1: x, y1: y });\n", " return new selection_1.Selection({ indices });\n", " }\n", " _hit_span(geometry) {\n", " const { sx, sy } = geometry;\n", " let indices;\n", " if (geometry.direction == 'v') {\n", " const y = this.renderer.yscale.invert(sy);\n", " const hr = this.renderer.plot_view.frame.bbox.h_range;\n", " const [x0, x1] = this.renderer.xscale.r_invert(hr.start, hr.end);\n", " indices = this.index.indices({ x0, y0: y, x1, y1: y });\n", " }\n", " else {\n", " const x = this.renderer.xscale.invert(sx);\n", " const vr = this.renderer.plot_view.frame.bbox.v_range;\n", " const [y0, y1] = this.renderer.yscale.r_invert(vr.start, vr.end);\n", " indices = this.index.indices({ x0: x, y0, x1: x, y1 });\n", " }\n", " return new selection_1.Selection({ indices });\n", " }\n", " draw_legend_for_index(ctx, bbox, index) {\n", " utils_1.generic_area_legend(this.visuals, ctx, bbox, index);\n", " }\n", " }\n", " exports.BoxView = BoxView;\n", " BoxView.__name__ = \"BoxView\";\n", " class Box extends glyph_1.Glyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Box() {\n", " this.mixins([property_mixins_1.LineVector, property_mixins_1.FillVector, property_mixins_1.HatchVector]);\n", " }\n", " }\n", " exports.Box = Box;\n", " Box.__name__ = \"Box\";\n", " Box.init_Box();\n", " },\n", " /* models/glyphs/hex_tile.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const glyph_1 = require(89) /* ./glyph */;\n", " const hittest = tslib_1.__importStar(require(93) /* ../../core/hittest */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const spatial_1 = require(85) /* ../../core/util/spatial */;\n", " const utils_1 = require(92) /* ./utils */;\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class HexTileView extends glyph_1.GlyphView {\n", " scenterx(i) { return this.sx[i]; }\n", " scentery(i) { return this.sy[i]; }\n", " _set_data() {\n", " const n = this._q.length;\n", " const size = this.model.size;\n", " const aspect_scale = this.model.aspect_scale;\n", " this._x = new Float64Array(n);\n", " this._y = new Float64Array(n);\n", " if (this.model.orientation == \"pointytop\") {\n", " for (let i = 0; i < n; i++) {\n", " this._x[i] = size * Math.sqrt(3) * (this._q[i] + this._r[i] / 2) / aspect_scale;\n", " this._y[i] = -size * 3 / 2 * this._r[i];\n", " }\n", " }\n", " else {\n", " for (let i = 0; i < n; i++) {\n", " this._x[i] = size * 3 / 2 * this._q[i];\n", " this._y[i] = -size * Math.sqrt(3) * (this._r[i] + this._q[i] / 2) * aspect_scale;\n", " }\n", " }\n", " }\n", " _index_data() {\n", " let ysize = this.model.size;\n", " let xsize = Math.sqrt(3) * ysize / 2;\n", " if (this.model.orientation == \"flattop\") {\n", " [xsize, ysize] = [ysize, xsize];\n", " ysize *= this.model.aspect_scale;\n", " }\n", " else\n", " xsize /= this.model.aspect_scale;\n", " const points = [];\n", " for (let i = 0; i < this._x.length; i++) {\n", " const x = this._x[i];\n", " const y = this._y[i];\n", " if (isNaN(x + y) || !isFinite(x + y))\n", " continue;\n", " points.push({ x0: x - xsize, y0: y - ysize, x1: x + xsize, y1: y + ysize, i });\n", " }\n", " return new spatial_1.SpatialIndex(points);\n", " }\n", " // overriding map_data instead of _map_data because the default automatic mappings\n", " // for other glyphs (with cartesian coordinates) is not useful\n", " map_data() {\n", " [this.sx, this.sy] = this.map_to_screen(this._x, this._y);\n", " [this.svx, this.svy] = this._get_unscaled_vertices();\n", " }\n", " _get_unscaled_vertices() {\n", " const size = this.model.size;\n", " const aspect_scale = this.model.aspect_scale;\n", " if (this.model.orientation == \"pointytop\") {\n", " const rscale = this.renderer.yscale;\n", " const hscale = this.renderer.xscale;\n", " const r = Math.abs(rscale.compute(0) - rscale.compute(size)); // assumes linear scale\n", " const h = Math.sqrt(3) / 2 * Math.abs(hscale.compute(0) - hscale.compute(size)) / aspect_scale; // assumes linear scale\n", " const r2 = r / 2.0;\n", " const svx = [0, -h, -h, 0, h, h];\n", " const svy = [r, r2, -r2, -r, -r2, r2];\n", " return [svx, svy];\n", " }\n", " else {\n", " const rscale = this.renderer.xscale;\n", " const hscale = this.renderer.yscale;\n", " const r = Math.abs(rscale.compute(0) - rscale.compute(size)); // assumes linear scale\n", " const h = Math.sqrt(3) / 2 * Math.abs(hscale.compute(0) - hscale.compute(size)) * aspect_scale; // assumes linear scale\n", " const r2 = r / 2.0;\n", " const svx = [r, r2, -r2, -r, -r2, r2];\n", " const svy = [0, -h, -h, 0, h, h];\n", " return [svx, svy];\n", " }\n", " }\n", " _render(ctx, indices, { sx, sy, svx, svy, _scale }) {\n", " for (const i of indices) {\n", " if (isNaN(sx[i] + sy[i] + _scale[i]))\n", " continue;\n", " ctx.translate(sx[i], sy[i]);\n", " ctx.beginPath();\n", " for (let j = 0; j < 6; j++) {\n", " ctx.lineTo(svx[j] * _scale[i], svy[j] * _scale[i]);\n", " }\n", " ctx.closePath();\n", " ctx.translate(-sx[i], -sy[i]);\n", " if (this.visuals.fill.doit) {\n", " this.visuals.fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " }\n", " _hit_point(geometry) {\n", " const { sx, sy } = geometry;\n", " const x = this.renderer.xscale.invert(sx);\n", " const y = this.renderer.yscale.invert(sy);\n", " const candidates = this.index.indices({ x0: x, y0: y, x1: x, y1: y });\n", " const indices = [];\n", " for (const i of candidates) {\n", " if (hittest.point_in_poly(sx - this.sx[i], sy - this.sy[i], this.svx, this.svy)) {\n", " indices.push(i);\n", " }\n", " }\n", " return new selection_1.Selection({ indices });\n", " }\n", " _hit_span(geometry) {\n", " const { sx, sy } = geometry;\n", " let indices;\n", " if (geometry.direction == 'v') {\n", " const y = this.renderer.yscale.invert(sy);\n", " const hr = this.renderer.plot_view.frame.bbox.h_range;\n", " const [x0, x1] = this.renderer.xscale.r_invert(hr.start, hr.end);\n", " indices = this.index.indices({ x0, y0: y, x1, y1: y });\n", " }\n", " else {\n", " const x = this.renderer.xscale.invert(sx);\n", " const vr = this.renderer.plot_view.frame.bbox.v_range;\n", " const [y0, y1] = this.renderer.yscale.r_invert(vr.start, vr.end);\n", " indices = this.index.indices({ x0: x, y0, x1: x, y1 });\n", " }\n", " return new selection_1.Selection({ indices });\n", " }\n", " _hit_rect(geometry) {\n", " const { sx0, sx1, sy0, sy1 } = geometry;\n", " const [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " const [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " const indices = this.index.indices({ x0, x1, y0, y1 });\n", " return new selection_1.Selection({ indices });\n", " }\n", " draw_legend_for_index(ctx, bbox, index) {\n", " utils_1.generic_area_legend(this.visuals, ctx, bbox, index);\n", " }\n", " }\n", " exports.HexTileView = HexTileView;\n", " HexTileView.__name__ = \"HexTileView\";\n", " class HexTile extends glyph_1.Glyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_HexTile() {\n", " this.prototype.default_view = HexTileView;\n", " this.coords([['r', 'q']]);\n", " this.mixins([property_mixins_1.LineVector, property_mixins_1.FillVector]);\n", " this.define({\n", " size: [p.Number, 1.0],\n", " aspect_scale: [p.Number, 1.0],\n", " scale: [p.NumberSpec, 1.0],\n", " orientation: [p.HexTileOrientation, \"pointytop\"],\n", " });\n", " this.override({ line_color: null });\n", " }\n", " }\n", " exports.HexTile = HexTile;\n", " HexTile.__name__ = \"HexTile\";\n", " HexTile.init_HexTile();\n", " },\n", " /* models/glyphs/image.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const image_base_1 = require(221) /* ./image_base */;\n", " const linear_color_mapper_1 = require(115) /* ../mappers/linear_color_mapper */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class ImageView extends image_base_1.ImageBaseView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.color_mapper.change, () => this._update_image());\n", " }\n", " _update_image() {\n", " // Only reset image_data if already initialized\n", " if (this.image_data != null) {\n", " this._set_data(null);\n", " this.renderer.plot_view.request_render();\n", " }\n", " }\n", " _flat_img_to_buf8(img) {\n", " const cmap = this.model.color_mapper.rgba_mapper;\n", " return cmap.v_compute(img);\n", " }\n", " }\n", " exports.ImageView = ImageView;\n", " ImageView.__name__ = \"ImageView\";\n", " // NOTE: this needs to be redefined here, because palettes are located in bokeh-api.js bundle\n", " const Greys9 = () => [\"#000000\", \"#252525\", \"#525252\", \"#737373\", \"#969696\", \"#bdbdbd\", \"#d9d9d9\", \"#f0f0f0\", \"#ffffff\"];\n", " class Image extends image_base_1.ImageBase {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Image() {\n", " this.prototype.default_view = ImageView;\n", " this.define({\n", " color_mapper: [p.Instance, () => new linear_color_mapper_1.LinearColorMapper({ palette: Greys9() })],\n", " });\n", " }\n", " }\n", " exports.Image = Image;\n", " Image.__name__ = \"Image\";\n", " Image.init_Image();\n", " },\n", " /* models/glyphs/image_base.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const xy_glyph_1 = require(84) /* ./xy_glyph */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " const spatial_1 = require(85) /* ../../core/util/spatial */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const ndarray_1 = require(26) /* ../../core/util/ndarray */;\n", " class ImageBaseView extends xy_glyph_1.XYGlyphView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.global_alpha.change, () => this.renderer.request_render());\n", " }\n", " _render(ctx, indices, { image_data, sx, sy, sw, sh }) {\n", " const old_smoothing = ctx.getImageSmoothingEnabled();\n", " ctx.setImageSmoothingEnabled(false);\n", " ctx.globalAlpha = this.model.global_alpha;\n", " for (const i of indices) {\n", " if (image_data[i] == null || isNaN(sx[i] + sy[i] + sw[i] + sh[i]))\n", " continue;\n", " const y_offset = sy[i];\n", " ctx.translate(0, y_offset);\n", " ctx.scale(1, -1);\n", " ctx.translate(0, -y_offset);\n", " ctx.drawImage(image_data[i], sx[i] | 0, sy[i] | 0, sw[i], sh[i]);\n", " ctx.translate(0, y_offset);\n", " ctx.scale(1, -1);\n", " ctx.translate(0, -y_offset);\n", " }\n", " ctx.setImageSmoothingEnabled(old_smoothing);\n", " }\n", " _set_data(indices) {\n", " this._set_width_heigh_data();\n", " for (let i = 0, end = this._image.length; i < end; i++) {\n", " if (indices != null && indices.indexOf(i) < 0)\n", " continue;\n", " const img = this._image[i];\n", " let flat_img;\n", " if (ndarray_1.is_NDArray(img)) {\n", " flat_img = img;\n", " this._height[i] = img.shape[0];\n", " this._width[i] = img.shape[1];\n", " }\n", " else {\n", " flat_img = array_1.concat(img);\n", " this._height[i] = img.length;\n", " this._width[i] = img[0].length;\n", " }\n", " const buf8 = this._flat_img_to_buf8(flat_img);\n", " this._set_image_data_from_buffer(i, buf8);\n", " }\n", " }\n", " _index_data() {\n", " const points = [];\n", " for (let i = 0, end = this._x.length; i < end; i++) {\n", " const [l, r, t, b] = this._lrtb(i);\n", " if (isNaN(l + r + t + b) || !isFinite(l + r + t + b)) {\n", " continue;\n", " }\n", " points.push({ x0: l, y0: b, x1: r, y1: t, i });\n", " }\n", " return new spatial_1.SpatialIndex(points);\n", " }\n", " _lrtb(i) {\n", " const xr = this.renderer.xscale.source_range;\n", " const x1 = this._x[i];\n", " const x2 = xr.is_reversed ? x1 - this._dw[i] : x1 + this._dw[i];\n", " const yr = this.renderer.yscale.source_range;\n", " const y1 = this._y[i];\n", " const y2 = yr.is_reversed ? y1 - this._dh[i] : y1 + this._dh[i];\n", " const [l, r] = x1 < x2 ? [x1, x2] : [x2, x1];\n", " const [b, t] = y1 < y2 ? [y1, y2] : [y2, y1];\n", " return [l, r, t, b];\n", " }\n", " _set_width_heigh_data() {\n", " if (this.image_data == null || this.image_data.length != this._image.length)\n", " this.image_data = new Array(this._image.length);\n", " if (this._width == null || this._width.length != this._image.length)\n", " this._width = new Array(this._image.length);\n", " if (this._height == null || this._height.length != this._image.length)\n", " this._height = new Array(this._image.length);\n", " }\n", " _get_or_create_canvas(i) {\n", " const _image_data = this.image_data[i];\n", " if (_image_data != null && _image_data.width == this._width[i] &&\n", " _image_data.height == this._height[i])\n", " return _image_data;\n", " else {\n", " const canvas = document.createElement('canvas');\n", " canvas.width = this._width[i];\n", " canvas.height = this._height[i];\n", " return canvas;\n", " }\n", " }\n", " _set_image_data_from_buffer(i, buf8) {\n", " const canvas = this._get_or_create_canvas(i);\n", " const ctx = canvas.getContext('2d');\n", " const image_data = ctx.getImageData(0, 0, this._width[i], this._height[i]);\n", " image_data.data.set(buf8);\n", " ctx.putImageData(image_data, 0, 0);\n", " this.image_data[i] = canvas;\n", " }\n", " _map_data() {\n", " switch (this.model.properties.dw.units) {\n", " case \"data\": {\n", " this.sw = this.sdist(this.renderer.xscale, this._x, this._dw, 'edge', this.model.dilate);\n", " break;\n", " }\n", " case \"screen\": {\n", " this.sw = this._dw;\n", " break;\n", " }\n", " }\n", " switch (this.model.properties.dh.units) {\n", " case \"data\": {\n", " this.sh = this.sdist(this.renderer.yscale, this._y, this._dh, 'edge', this.model.dilate);\n", " break;\n", " }\n", " case \"screen\": {\n", " this.sh = this._dh;\n", " break;\n", " }\n", " }\n", " }\n", " _image_index(index, x, y) {\n", " const [l, r, t, b] = this._lrtb(index);\n", " const width = this._width[index];\n", " const height = this._height[index];\n", " const dx = (r - l) / width;\n", " const dy = (t - b) / height;\n", " let dim1 = Math.floor((x - l) / dx);\n", " let dim2 = Math.floor((y - b) / dy);\n", " if (this.renderer.xscale.source_range.is_reversed)\n", " dim1 = width - dim1 - 1;\n", " if (this.renderer.yscale.source_range.is_reversed)\n", " dim2 = height - dim2 - 1;\n", " return { index, dim1, dim2, flat_index: dim2 * width + dim1 };\n", " }\n", " _hit_point(geometry) {\n", " const { sx, sy } = geometry;\n", " const x = this.renderer.xscale.invert(sx);\n", " const y = this.renderer.yscale.invert(sy);\n", " const candidates = this.index.indices({ x0: x, x1: x, y0: y, y1: y });\n", " const result = new selection_1.Selection();\n", " for (const index of candidates) {\n", " if (sx != Infinity && sy != Infinity) {\n", " result.image_indices.push(this._image_index(index, x, y));\n", " }\n", " }\n", " return result;\n", " }\n", " }\n", " exports.ImageBaseView = ImageBaseView;\n", " ImageBaseView.__name__ = \"ImageBaseView\";\n", " class ImageBase extends xy_glyph_1.XYGlyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ImageBase() {\n", " this.define({\n", " image: [p.NumberSpec],\n", " dw: [p.DistanceSpec],\n", " dh: [p.DistanceSpec],\n", " dilate: [p.Boolean, false],\n", " global_alpha: [p.Number, 1.0],\n", " });\n", " }\n", " }\n", " exports.ImageBase = ImageBase;\n", " ImageBase.__name__ = \"ImageBase\";\n", " ImageBase.init_ImageBase();\n", " },\n", " /* models/glyphs/image_rgba.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const image_base_1 = require(221) /* ./image_base */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " class ImageRGBAView extends image_base_1.ImageBaseView {\n", " _flat_img_to_buf8(img) {\n", " let array;\n", " if (types_1.isArray(img)) {\n", " array = new Uint32Array(img);\n", " }\n", " else {\n", " array = img;\n", " }\n", " return new Uint8Array(array.buffer);\n", " }\n", " }\n", " exports.ImageRGBAView = ImageRGBAView;\n", " ImageRGBAView.__name__ = \"ImageRGBAView\";\n", " class ImageRGBA extends image_base_1.ImageBase {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ImageRGBA() {\n", " this.prototype.default_view = ImageRGBAView;\n", " }\n", " }\n", " exports.ImageRGBA = ImageRGBA;\n", " ImageRGBA.__name__ = \"ImageRGBA\";\n", " ImageRGBA.init_ImageRGBA();\n", " },\n", " /* models/glyphs/image_url.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const xy_glyph_1 = require(84) /* ./xy_glyph */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const arrayable_1 = require(12) /* ../../core/util/arrayable */;\n", " const spatial_1 = require(85) /* ../../core/util/spatial */;\n", " const image_1 = require(224) /* ../../core/util/image */;\n", " class ImageURLView extends xy_glyph_1.XYGlyphView {\n", " constructor() {\n", " super(...arguments);\n", " this._images_rendered = false;\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.connect(this.model.properties.global_alpha.change, () => this.renderer.request_render());\n", " }\n", " _index_data() {\n", " return new spatial_1.SpatialIndex([]);\n", " }\n", " _set_data() {\n", " if (this.image == null || this.image.length != this._url.length)\n", " this.image = arrayable_1.map(this._url, () => null);\n", " const { retry_attempts, retry_timeout } = this.model;\n", " for (let i = 0, end = this._url.length; i < end; i++) {\n", " const url = this._url[i];\n", " if (url == null || url == \"\")\n", " continue;\n", " new image_1.ImageLoader(url, {\n", " loaded: (image) => {\n", " this.image[i] = image;\n", " this.renderer.request_render();\n", " },\n", " attempts: retry_attempts + 1,\n", " timeout: retry_timeout,\n", " });\n", " }\n", " const w_data = this.model.properties.w.units == \"data\";\n", " const h_data = this.model.properties.h.units == \"data\";\n", " const n = this._x.length;\n", " const xs = new Array(w_data ? 2 * n : n);\n", " const ys = new Array(h_data ? 2 * n : n);\n", " for (let i = 0; i < n; i++) {\n", " xs[i] = this._x[i];\n", " ys[i] = this._y[i];\n", " }\n", " // if the width/height are in screen units, don't try to include them in bounds\n", " if (w_data) {\n", " for (let i = 0; i < n; i++)\n", " xs[n + i] = this._x[i] + this._w[i];\n", " }\n", " if (h_data) {\n", " for (let i = 0; i < n; i++)\n", " ys[n + i] = this._y[i] + this._h[i];\n", " }\n", " const x0 = arrayable_1.min(xs);\n", " const x1 = arrayable_1.max(xs);\n", " const y0 = arrayable_1.min(ys);\n", " const y1 = arrayable_1.max(ys);\n", " this._bounds_rect = { x0, x1, y0, y1 };\n", " }\n", " has_finished() {\n", " return super.has_finished() && this._images_rendered == true;\n", " }\n", " _map_data() {\n", " // Better to check this.model.w and this.model.h for null since the set_data\n", " // machinery will have converted this._w and this._w to lists of null\n", " const ws = this.model.w != null ? this._w : arrayable_1.map(this._x, () => NaN);\n", " const hs = this.model.h != null ? this._h : arrayable_1.map(this._x, () => NaN);\n", " switch (this.model.properties.w.units) {\n", " case \"data\": {\n", " this.sw = this.sdist(this.renderer.xscale, this._x, ws, \"edge\", this.model.dilate);\n", " break;\n", " }\n", " case \"screen\": {\n", " this.sw = ws;\n", " break;\n", " }\n", " }\n", " switch (this.model.properties.h.units) {\n", " case \"data\": {\n", " this.sh = this.sdist(this.renderer.yscale, this._y, hs, \"edge\", this.model.dilate);\n", " break;\n", " }\n", " case \"screen\": {\n", " this.sh = hs;\n", " break;\n", " }\n", " }\n", " }\n", " _render(ctx, indices, { image, sx, sy, sw, sh, _angle }) {\n", " // TODO (bev): take actual border width into account when clipping\n", " const { frame } = this.renderer.plot_view;\n", " ctx.rect(frame._left.value + 1, frame._top.value + 1, frame._width.value - 2, frame._height.value - 2);\n", " ctx.clip();\n", " let finished = true;\n", " for (const i of indices) {\n", " if (isNaN(sx[i] + sy[i] + _angle[i]))\n", " continue;\n", " const img = image[i];\n", " if (img == null) {\n", " finished = false;\n", " continue;\n", " }\n", " this._render_image(ctx, i, img, sx, sy, sw, sh, _angle);\n", " }\n", " if (finished && !this._images_rendered) {\n", " this._images_rendered = true;\n", " this.notify_finished();\n", " }\n", " }\n", " _final_sx_sy(anchor, sx, sy, sw, sh) {\n", " switch (anchor) {\n", " case 'top_left': return [sx, sy];\n", " case 'top_center': return [sx - (sw / 2), sy];\n", " case 'top_right': return [sx - sw, sy];\n", " case 'center_right': return [sx - sw, sy - (sh / 2)];\n", " case 'bottom_right': return [sx - sw, sy - sh];\n", " case 'bottom_center': return [sx - (sw / 2), sy - sh];\n", " case 'bottom_left': return [sx, sy - sh];\n", " case 'center_left': return [sx, sy - (sh / 2)];\n", " case 'center': return [sx - (sw / 2), sy - (sh / 2)];\n", " }\n", " }\n", " _render_image(ctx, i, image, sx, sy, sw, sh, angle) {\n", " if (isNaN(sw[i]))\n", " sw[i] = image.width;\n", " if (isNaN(sh[i]))\n", " sh[i] = image.height;\n", " const { anchor } = this.model;\n", " const [sxi, syi] = this._final_sx_sy(anchor, sx[i], sy[i], sw[i], sh[i]);\n", " ctx.save();\n", " ctx.globalAlpha = this.model.global_alpha;\n", " const sw2 = sw[i] / 2;\n", " const sh2 = sh[i] / 2;\n", " if (angle[i]) {\n", " ctx.translate(sxi, syi);\n", " //rotation about center of image\n", " ctx.translate(sw2, sh2);\n", " ctx.rotate(angle[i]);\n", " ctx.translate(-sw2, -sh2);\n", " ctx.drawImage(image, 0, 0, sw[i], sh[i]);\n", " ctx.translate(sw2, sh2);\n", " ctx.rotate(-angle[i]);\n", " ctx.translate(-sw2, -sh2);\n", " ctx.translate(-sxi, -syi);\n", " }\n", " else\n", " ctx.drawImage(image, sxi, syi, sw[i], sh[i]);\n", " ctx.restore();\n", " }\n", " bounds() {\n", " return this._bounds_rect;\n", " }\n", " }\n", " exports.ImageURLView = ImageURLView;\n", " ImageURLView.__name__ = \"ImageURLView\";\n", " class ImageURL extends xy_glyph_1.XYGlyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ImageURL() {\n", " this.prototype.default_view = ImageURLView;\n", " this.define({\n", " url: [p.StringSpec],\n", " anchor: [p.Anchor, 'top_left'],\n", " global_alpha: [p.Number, 1.0],\n", " angle: [p.AngleSpec, 0],\n", " w: [p.DistanceSpec],\n", " h: [p.DistanceSpec],\n", " dilate: [p.Boolean, false],\n", " retry_attempts: [p.Number, 0],\n", " retry_timeout: [p.Number, 0],\n", " });\n", " }\n", " }\n", " exports.ImageURL = ImageURL;\n", " ImageURL.__name__ = \"ImageURL\";\n", " ImageURL.init_ImageURL();\n", " },\n", " /* core/util/image.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const logging_1 = require(72) /* ../logging */;\n", " class ImageLoader {\n", " constructor(url, options = {}) {\n", " this._image = new Image();\n", " this._finished = false;\n", " const { attempts = 1, timeout = 1 } = options;\n", " this.promise = new Promise((resolve, _reject) => {\n", " this._image.crossOrigin = \"anonymous\";\n", " let retries = 0;\n", " this._image.onerror = () => {\n", " if (++retries == attempts) {\n", " const message = `unable to load ${url} image after ${attempts} attempts`;\n", " logging_1.logger.warn(message);\n", " if (this._image.crossOrigin != null) {\n", " logging_1.logger.warn(`attempting to load ${url} without a cross origin policy`);\n", " this._image.crossOrigin = null;\n", " retries = 0;\n", " }\n", " else {\n", " if (options.failed != null)\n", " options.failed();\n", " return; // XXX reject(new Error(message))\n", " }\n", " }\n", " setTimeout(() => this._image.src = url, timeout);\n", " };\n", " this._image.onload = () => {\n", " this._finished = true;\n", " if (options.loaded != null)\n", " options.loaded(this._image);\n", " resolve(this._image);\n", " };\n", " this._image.src = url;\n", " });\n", " }\n", " get finished() {\n", " return this._finished;\n", " }\n", " get image() {\n", " return this._image;\n", " }\n", " }\n", " exports.ImageLoader = ImageLoader;\n", " ImageLoader.__name__ = \"ImageLoader\";\n", " },\n", " /* models/glyphs/multi_line.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const spatial_1 = require(85) /* ../../core/util/spatial */;\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const hittest = tslib_1.__importStar(require(93) /* ../../core/hittest */);\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const object_1 = require(17) /* ../../core/util/object */;\n", " const glyph_1 = require(89) /* ./glyph */;\n", " const utils_1 = require(92) /* ./utils */;\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class MultiLineView extends glyph_1.GlyphView {\n", " _index_data() {\n", " const points = [];\n", " for (let i = 0, end = this._xs.length; i < end; i++) {\n", " if (this._xs[i] == null || this._xs[i].length === 0)\n", " continue;\n", " const _xsi = this._xs[i];\n", " const xs = [];\n", " for (let j = 0, n = _xsi.length; j < n; j++) {\n", " const x = _xsi[j];\n", " if (!isNaN(x))\n", " xs.push(x);\n", " }\n", " const _ysi = this._ys[i];\n", " const ys = [];\n", " for (let j = 0, n = _ysi.length; j < n; j++) {\n", " const y = _ysi[j];\n", " if (!isNaN(y))\n", " ys.push(y);\n", " }\n", " const [x0, x1] = [array_1.min(xs), array_1.max(xs)];\n", " const [y0, y1] = [array_1.min(ys), array_1.max(ys)];\n", " points.push({ x0, y0, x1, y1, i });\n", " }\n", " return new spatial_1.SpatialIndex(points);\n", " }\n", " _render(ctx, indices, { sxs, sys }) {\n", " for (const i of indices) {\n", " const [sx, sy] = [sxs[i], sys[i]];\n", " this.visuals.line.set_vectorize(ctx, i);\n", " for (let j = 0, end = sx.length; j < end; j++) {\n", " if (j == 0) {\n", " ctx.beginPath();\n", " ctx.moveTo(sx[j], sy[j]);\n", " continue;\n", " }\n", " else if (isNaN(sx[j]) || isNaN(sy[j])) {\n", " ctx.stroke();\n", " ctx.beginPath();\n", " continue;\n", " }\n", " else\n", " ctx.lineTo(sx[j], sy[j]);\n", " }\n", " ctx.stroke();\n", " }\n", " }\n", " _hit_point(geometry) {\n", " const point = { x: geometry.sx, y: geometry.sy };\n", " let shortest = 9999;\n", " const hits = new Map();\n", " for (let i = 0, end = this.sxs.length; i < end; i++) {\n", " const threshold = Math.max(2, this.visuals.line.cache_select('line_width', i) / 2);\n", " let points = null;\n", " for (let j = 0, endj = this.sxs[i].length - 1; j < endj; j++) {\n", " const p0 = { x: this.sxs[i][j], y: this.sys[i][j] };\n", " const p1 = { x: this.sxs[i][j + 1], y: this.sys[i][j + 1] };\n", " const dist = hittest.dist_to_segment(point, p0, p1);\n", " if (dist < threshold && dist < shortest) {\n", " shortest = dist;\n", " points = [j];\n", " }\n", " }\n", " if (points != null) {\n", " hits.set(i, points);\n", " }\n", " }\n", " return new selection_1.Selection({\n", " indices: [...hits.keys()],\n", " multiline_indices: object_1.to_object(hits),\n", " });\n", " }\n", " _hit_span(geometry) {\n", " const { sx, sy } = geometry;\n", " let val;\n", " let values;\n", " if (geometry.direction === 'v') {\n", " val = this.renderer.yscale.invert(sy);\n", " values = this._ys;\n", " }\n", " else {\n", " val = this.renderer.xscale.invert(sx);\n", " values = this._xs;\n", " }\n", " const hits = new Map();\n", " for (let i = 0, end = values.length; i < end; i++) {\n", " const points = [];\n", " for (let j = 0, endj = values[i].length - 1; j < endj; j++) {\n", " if (values[i][j] <= val && val <= values[i][j + 1])\n", " points.push(j);\n", " }\n", " if (points.length > 0) {\n", " hits.set(i, points);\n", " }\n", " }\n", " return new selection_1.Selection({\n", " indices: [...hits.keys()],\n", " multiline_indices: object_1.to_object(hits),\n", " });\n", " }\n", " get_interpolation_hit(i, point_i, geometry) {\n", " const [x2, y2, x3, y3] = [this._xs[i][point_i], this._ys[i][point_i], this._xs[i][point_i + 1], this._ys[i][point_i + 1]];\n", " return utils_1.line_interpolation(this.renderer, geometry, x2, y2, x3, y3);\n", " }\n", " draw_legend_for_index(ctx, bbox, index) {\n", " utils_1.generic_line_legend(this.visuals, ctx, bbox, index);\n", " }\n", " scenterx() {\n", " throw new Error(\"not implemented\");\n", " }\n", " scentery() {\n", " throw new Error(\"not implemented\");\n", " }\n", " }\n", " exports.MultiLineView = MultiLineView;\n", " MultiLineView.__name__ = \"MultiLineView\";\n", " class MultiLine extends glyph_1.Glyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_MultiLine() {\n", " this.prototype.default_view = MultiLineView;\n", " this.coords([['xs', 'ys']]);\n", " this.mixins(property_mixins_1.LineVector);\n", " }\n", " }\n", " exports.MultiLine = MultiLine;\n", " MultiLine.__name__ = \"MultiLine\";\n", " MultiLine.init_MultiLine();\n", " },\n", " /* models/glyphs/multi_polygons.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const spatial_1 = require(85) /* ../../core/util/spatial */;\n", " const glyph_1 = require(89) /* ./glyph */;\n", " const utils_1 = require(92) /* ./utils */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const arrayable_1 = require(12) /* ../../core/util/arrayable */;\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const hittest = tslib_1.__importStar(require(93) /* ../../core/hittest */);\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const assert_1 = require(11) /* ../../core/util/assert */;\n", " class MultiPolygonsView extends glyph_1.GlyphView {\n", " _index_data() {\n", " const points = [];\n", " for (let i = 0, end = this._xs.length; i < end; i++) {\n", " for (let j = 0, endj = this._xs[i].length; j < endj; j++) {\n", " const xs = this._xs[i][j][0]; // do not use holes\n", " const ys = this._ys[i][j][0]; // do not use holes\n", " if (xs.length == 0)\n", " continue;\n", " points.push({ x0: array_1.min(xs), y0: array_1.min(ys), x1: array_1.max(xs), y1: array_1.max(ys), i });\n", " }\n", " }\n", " this.hole_index = this._index_hole_data(); // should this be set here?\n", " return new spatial_1.SpatialIndex(points);\n", " }\n", " _index_hole_data() {\n", " // need advice on how to use this sure if this could be more useful\n", " const points = [];\n", " for (let i = 0, end = this._xs.length; i < end; i++) {\n", " for (let j = 0, endj = this._xs[i].length; j < endj; j++) {\n", " if (this._xs[i][j].length > 1) {\n", " for (let k = 1, endk = this._xs[i][j].length; k < endk; k++) {\n", " const xs = this._xs[i][j][k]; // only use holes\n", " const ys = this._ys[i][j][k]; // only use holes\n", " if (xs.length == 0)\n", " continue;\n", " points.push({ x0: array_1.min(xs), y0: array_1.min(ys), x1: array_1.max(xs), y1: array_1.max(ys), i });\n", " }\n", " }\n", " }\n", " }\n", " return new spatial_1.SpatialIndex(points);\n", " }\n", " _mask_data() {\n", " const xr = this.renderer.plot_view.frame.x_ranges.default;\n", " const [x0, x1] = [xr.min, xr.max];\n", " const yr = this.renderer.plot_view.frame.y_ranges.default;\n", " const [y0, y1] = [yr.min, yr.max];\n", " const indices = this.index.indices({ x0, x1, y0, y1 });\n", " // TODO this is probably needed in patches as well so that we don't draw glyphs multiple times\n", " return indices.sort((a, b) => a - b).filter((value, index, array) => {\n", " return (index === 0) || (value !== array[index - 1]);\n", " });\n", " }\n", " _inner_loop(ctx, sx, sy) {\n", " ctx.beginPath();\n", " for (let j = 0, endj = sx.length; j < endj; j++) {\n", " for (let k = 0, endk = sx[j].length; k < endk; k++) {\n", " const _sx = sx[j][k];\n", " const _sy = sy[j][k];\n", " for (let l = 0, endl = _sx.length; l < endl; l++) {\n", " if (l == 0) {\n", " ctx.moveTo(_sx[l], _sy[l]);\n", " continue;\n", " }\n", " else\n", " ctx.lineTo(_sx[l], _sy[l]);\n", " }\n", " ctx.closePath();\n", " }\n", " }\n", " }\n", " _render(ctx, indices, { sxs, sys }) {\n", " if (this.visuals.fill.doit || this.visuals.line.doit) {\n", " for (const i of indices) {\n", " const [sx, sy] = [sxs[i], sys[i]];\n", " if (this.visuals.fill.doit) {\n", " this.visuals.fill.set_vectorize(ctx, i);\n", " this._inner_loop(ctx, sx, sy);\n", " ctx.fill(\"evenodd\");\n", " }\n", " this.visuals.hatch.doit2(ctx, i, () => {\n", " this._inner_loop(ctx, sx, sy);\n", " ctx.fill(\"evenodd\");\n", " }, () => this.renderer.request_render());\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_vectorize(ctx, i);\n", " this._inner_loop(ctx, sx, sy);\n", " ctx.stroke();\n", " }\n", " }\n", " }\n", " }\n", " _hit_rect(geometry) {\n", " const { sx0, sx1, sy0, sy1 } = geometry;\n", " const xs = [sx0, sx1, sx1, sx0];\n", " const ys = [sy0, sy0, sy1, sy1];\n", " const [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " const [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " const candidates = this.index.indices({ x0, x1, y0, y1 });\n", " const indices = [];\n", " for (let i = 0, end = candidates.length; i < end; i++) {\n", " const index = candidates[i];\n", " const sxss = this.sxs[index];\n", " const syss = this.sys[index];\n", " let hit = true;\n", " for (let j = 0, endj = sxss.length; j < endj; j++) {\n", " for (let k = 0, endk = sxss[j][0].length; k < endk; k++) {\n", " const sx = sxss[j][0][k];\n", " const sy = syss[j][0][k];\n", " if (!hittest.point_in_poly(sx, sy, xs, ys)) {\n", " hit = false;\n", " break;\n", " }\n", " }\n", " if (!hit)\n", " break;\n", " }\n", " if (hit) {\n", " indices.push(index);\n", " }\n", " }\n", " return new selection_1.Selection({ indices });\n", " }\n", " _hit_point(geometry) {\n", " const { sx, sy } = geometry;\n", " const x = this.renderer.xscale.invert(sx);\n", " const y = this.renderer.yscale.invert(sy);\n", " const candidates = this.index.indices({ x0: x, y0: y, x1: x, y1: y });\n", " const hole_candidates = this.hole_index.indices({ x0: x, y0: y, x1: x, y1: y });\n", " const indices = [];\n", " for (let i = 0, end = candidates.length; i < end; i++) {\n", " const index = candidates[i];\n", " const sxs = this.sxs[index];\n", " const sys = this.sys[index];\n", " for (let j = 0, endj = sxs.length; j < endj; j++) {\n", " const nk = sxs[j].length;\n", " if (hittest.point_in_poly(sx, sy, sxs[j][0], sys[j][0])) {\n", " if (nk == 1) {\n", " indices.push(index);\n", " }\n", " else if (hole_candidates.indexOf(index) == -1) {\n", " indices.push(index);\n", " }\n", " else if (nk > 1) {\n", " let in_a_hole = false;\n", " for (let k = 1; k < nk; k++) {\n", " const sxs_k = sxs[j][k];\n", " const sys_k = sys[j][k];\n", " if (hittest.point_in_poly(sx, sy, sxs_k, sys_k)) {\n", " in_a_hole = true;\n", " break;\n", " }\n", " else {\n", " continue;\n", " }\n", " }\n", " if (!in_a_hole) {\n", " indices.push(index);\n", " }\n", " }\n", " }\n", " }\n", " }\n", " return new selection_1.Selection({ indices });\n", " }\n", " _get_snap_coord(array) {\n", " return arrayable_1.sum(array) / array.length;\n", " }\n", " scenterx(i, sx, sy) {\n", " if (this.sxs[i].length == 1) {\n", " // We don't have discontinuous objects so we're ok\n", " return this._get_snap_coord(this.sxs[i][0][0]);\n", " }\n", " else {\n", " // We have discontinuous objects, so we need to find which\n", " // one we're in, we can use point_in_poly again\n", " const sxs = this.sxs[i];\n", " const sys = this.sys[i];\n", " for (let j = 0, end = sxs.length; j < end; j++) {\n", " if (hittest.point_in_poly(sx, sy, sxs[j][0], sys[j][0]))\n", " return this._get_snap_coord(sxs[j][0]);\n", " }\n", " }\n", " assert_1.unreachable();\n", " }\n", " scentery(i, sx, sy) {\n", " if (this.sys[i].length == 1) {\n", " // We don't have discontinuous objects so we're ok\n", " return this._get_snap_coord(this.sys[i][0][0]);\n", " }\n", " else {\n", " // We have discontinuous objects, so we need to find which\n", " // one we're in, we can use point_in_poly again\n", " const sxs = this.sxs[i];\n", " const sys = this.sys[i];\n", " for (let j = 0, end = sxs.length; j < end; j++) {\n", " if (hittest.point_in_poly(sx, sy, sxs[j][0], sys[j][0]))\n", " return this._get_snap_coord(sys[j][0]);\n", " }\n", " }\n", " assert_1.unreachable();\n", " }\n", " map_data() {\n", " const self = this;\n", " for (let [xname, yname] of this.model._coords) {\n", " const sxname = `s${xname}`;\n", " const syname = `s${yname}`;\n", " xname = `_${xname}`;\n", " yname = `_${yname}`;\n", " if (self[xname] != null && (types_1.isArray(self[xname][0]) || types_1.isTypedArray(self[xname][0]))) {\n", " const ni = self[xname].length;\n", " self[sxname] = new Array(ni);\n", " self[syname] = new Array(ni);\n", " for (let i = 0; i < ni; i++) {\n", " const nj = self[xname][i].length;\n", " self[sxname][i] = new Array(nj);\n", " self[syname][i] = new Array(nj);\n", " for (let j = 0; j < nj; j++) {\n", " const nk = self[xname][i][j].length;\n", " self[sxname][i][j] = new Array(nk);\n", " self[syname][i][j] = new Array(nk);\n", " for (let k = 0; k < nk; k++) {\n", " const [sx, sy] = this.map_to_screen(self[xname][i][j][k], self[yname][i][j][k]);\n", " self[sxname][i][j][k] = sx;\n", " self[syname][i][j][k] = sy;\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " draw_legend_for_index(ctx, bbox, index) {\n", " utils_1.generic_area_legend(this.visuals, ctx, bbox, index);\n", " }\n", " }\n", " exports.MultiPolygonsView = MultiPolygonsView;\n", " MultiPolygonsView.__name__ = \"MultiPolygonsView\";\n", " class MultiPolygons extends glyph_1.Glyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_MultiPolygons() {\n", " this.prototype.default_view = MultiPolygonsView;\n", " this.coords([['xs', 'ys']]);\n", " this.mixins([property_mixins_1.LineVector, property_mixins_1.FillVector, property_mixins_1.HatchVector]);\n", " }\n", " }\n", " exports.MultiPolygons = MultiPolygons;\n", " MultiPolygons.__name__ = \"MultiPolygons\";\n", " MultiPolygons.init_MultiPolygons();\n", " },\n", " /* models/glyphs/oval.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const ellipse_oval_1 = require(216) /* ./ellipse_oval */;\n", " class OvalView extends ellipse_oval_1.EllipseOvalView {\n", " _map_data() {\n", " super._map_data();\n", " // oval drawn from bezier curves = ellipse with width reduced by 3/4\n", " const { sw } = this;\n", " const n = sw.length;\n", " for (let i = 0; i < n; i++) {\n", " sw[i] *= 0.75;\n", " }\n", " }\n", " }\n", " exports.OvalView = OvalView;\n", " OvalView.__name__ = \"OvalView\";\n", " class Oval extends ellipse_oval_1.EllipseOval {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Oval() {\n", " this.prototype.default_view = OvalView;\n", " }\n", " }\n", " exports.Oval = Oval;\n", " Oval.__name__ = \"Oval\";\n", " Oval.init_Oval();\n", " },\n", " /* models/glyphs/patches.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const spatial_1 = require(85) /* ../../core/util/spatial */;\n", " const glyph_1 = require(89) /* ./glyph */;\n", " const utils_1 = require(92) /* ./utils */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const arrayable_1 = require(12) /* ../../core/util/arrayable */;\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const hittest = tslib_1.__importStar(require(93) /* ../../core/hittest */);\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " const assert_1 = require(11) /* ../../core/util/assert */;\n", " class PatchesView extends glyph_1.GlyphView {\n", " _build_discontinuous_object(nanned_qs) {\n", " // _s is this.xs, this.ys, this.sxs, this.sys\n", " // an object of n 1-d arrays in either data or screen units\n", " //\n", " // Each 1-d array gets broken to an array of arrays split\n", " // on any NaNs\n", " //\n", " // So:\n", " // { 0: [x11, x12],\n", " // 1: [x21, x22, x23],\n", " // 2: [x31, NaN, x32]\n", " // }\n", " // becomes\n", " // { 0: [[x11, x12]],\n", " // 1: [[x21, x22, x23]],\n", " // 2: [[x31],[x32]]\n", " // }\n", " const ds = [];\n", " for (let i = 0, end = nanned_qs.length; i < end; i++) {\n", " ds[i] = [];\n", " let qs = array_1.copy(nanned_qs[i]);\n", " while (qs.length > 0) {\n", " const nan_index = array_1.find_last_index(qs, (q) => isNaN(q));\n", " let qs_part;\n", " if (nan_index >= 0)\n", " qs_part = qs.splice(nan_index);\n", " else {\n", " qs_part = qs;\n", " qs = [];\n", " }\n", " const denanned = qs_part.filter((q) => !isNaN(q));\n", " ds[i].push(denanned);\n", " }\n", " }\n", " return ds;\n", " }\n", " _index_data() {\n", " const xss = this._build_discontinuous_object(this._xs); // XXX\n", " const yss = this._build_discontinuous_object(this._ys); // XXX\n", " const points = [];\n", " for (let i = 0, end = this._xs.length; i < end; i++) {\n", " for (let j = 0, endj = xss[i].length; j < endj; j++) {\n", " const xs = xss[i][j];\n", " const ys = yss[i][j];\n", " if (xs.length == 0)\n", " continue;\n", " points.push({ x0: array_1.min(xs), y0: array_1.min(ys), x1: array_1.max(xs), y1: array_1.max(ys), i });\n", " }\n", " }\n", " return new spatial_1.SpatialIndex(points);\n", " }\n", " _mask_data() {\n", " const xr = this.renderer.plot_view.frame.x_ranges.default;\n", " const [x0, x1] = [xr.min, xr.max];\n", " const yr = this.renderer.plot_view.frame.y_ranges.default;\n", " const [y0, y1] = [yr.min, yr.max];\n", " const indices = this.index.indices({ x0, x1, y0, y1 });\n", " // TODO (bev) this should be under test\n", " return indices.sort((a, b) => a - b);\n", " }\n", " _inner_loop(ctx, sx, sy, func) {\n", " for (let j = 0, end = sx.length; j < end; j++) {\n", " if (j == 0) {\n", " ctx.beginPath();\n", " ctx.moveTo(sx[j], sy[j]);\n", " continue;\n", " }\n", " else if (isNaN(sx[j] + sy[j])) {\n", " ctx.closePath();\n", " func.apply(ctx);\n", " ctx.beginPath();\n", " continue;\n", " }\n", " else\n", " ctx.lineTo(sx[j], sy[j]);\n", " }\n", " ctx.closePath();\n", " func.call(ctx);\n", " }\n", " _render(ctx, indices, { sxs, sys }) {\n", " // this.sxss and this.syss are used by _hit_point and sxc, syc\n", " // This is the earliest we can build them, and only build them once\n", " this.sxss = this._build_discontinuous_object(sxs); // XXX\n", " this.syss = this._build_discontinuous_object(sys); // XXX\n", " for (const i of indices) {\n", " const [sx, sy] = [sxs[i], sys[i]];\n", " if (this.visuals.fill.doit) {\n", " this.visuals.fill.set_vectorize(ctx, i);\n", " this._inner_loop(ctx, sx, sy, ctx.fill);\n", " }\n", " this.visuals.hatch.doit2(ctx, i, () => this._inner_loop(ctx, sx, sy, ctx.fill), () => this.renderer.request_render());\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_vectorize(ctx, i);\n", " this._inner_loop(ctx, sx, sy, ctx.stroke);\n", " }\n", " }\n", " }\n", " _hit_rect(geometry) {\n", " const { sx0, sx1, sy0, sy1 } = geometry;\n", " const xs = [sx0, sx1, sx1, sx0];\n", " const ys = [sy0, sy0, sy1, sy1];\n", " const [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " const [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " const candidates = this.index.indices({ x0, x1, y0, y1 });\n", " const indices = [];\n", " for (let i = 0, end = candidates.length; i < end; i++) {\n", " const index = candidates[i];\n", " const sxss = this.sxs[index];\n", " const syss = this.sys[index];\n", " let hit = true;\n", " for (let j = 0, endj = sxss.length; j < endj; j++) {\n", " const sx = sxss[j];\n", " const sy = syss[j];\n", " if (!hittest.point_in_poly(sx, sy, xs, ys)) {\n", " hit = false;\n", " break;\n", " }\n", " }\n", " if (hit) {\n", " indices.push(index);\n", " }\n", " }\n", " return new selection_1.Selection({ indices });\n", " }\n", " _hit_point(geometry) {\n", " const { sx, sy } = geometry;\n", " const x = this.renderer.xscale.invert(sx);\n", " const y = this.renderer.yscale.invert(sy);\n", " const candidates = this.index.indices({ x0: x, y0: y, x1: x, y1: y });\n", " const indices = [];\n", " for (let i = 0, end = candidates.length; i < end; i++) {\n", " const index = candidates[i];\n", " const sxs = this.sxss[index];\n", " const sys = this.syss[index];\n", " for (let j = 0, endj = sxs.length; j < endj; j++) {\n", " if (hittest.point_in_poly(sx, sy, sxs[j], sys[j])) {\n", " indices.push(index);\n", " }\n", " }\n", " }\n", " return new selection_1.Selection({ indices });\n", " }\n", " _get_snap_coord(array) {\n", " return arrayable_1.sum(array) / array.length;\n", " }\n", " scenterx(i, sx, sy) {\n", " if (this.sxss[i].length == 1) {\n", " // We don't have discontinuous objects so we're ok\n", " return this._get_snap_coord(this.sxs[i]);\n", " }\n", " else {\n", " // We have discontinuous objects, so we need to find which\n", " // one we're in, we can use point_in_poly again\n", " const sxs = this.sxss[i];\n", " const sys = this.syss[i];\n", " for (let j = 0, end = sxs.length; j < end; j++) {\n", " if (hittest.point_in_poly(sx, sy, sxs[j], sys[j]))\n", " return this._get_snap_coord(sxs[j]);\n", " }\n", " }\n", " assert_1.unreachable();\n", " }\n", " scentery(i, sx, sy) {\n", " if (this.syss[i].length == 1) {\n", " // We don't have discontinuous objects so we're ok\n", " return this._get_snap_coord(this.sys[i]);\n", " }\n", " else {\n", " // We have discontinuous objects, so we need to find which\n", " // one we're in, we can use point_in_poly again\n", " const sxs = this.sxss[i];\n", " const sys = this.syss[i];\n", " for (let j = 0, end = sxs.length; j < end; j++) {\n", " if (hittest.point_in_poly(sx, sy, sxs[j], sys[j]))\n", " return this._get_snap_coord(sys[j]);\n", " }\n", " }\n", " assert_1.unreachable();\n", " }\n", " draw_legend_for_index(ctx, bbox, index) {\n", " utils_1.generic_area_legend(this.visuals, ctx, bbox, index);\n", " }\n", " }\n", " exports.PatchesView = PatchesView;\n", " PatchesView.__name__ = \"PatchesView\";\n", " class Patches extends glyph_1.Glyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Patches() {\n", " this.prototype.default_view = PatchesView;\n", " this.coords([['xs', 'ys']]);\n", " this.mixins([property_mixins_1.LineVector, property_mixins_1.FillVector, property_mixins_1.HatchVector]);\n", " }\n", " }\n", " exports.Patches = Patches;\n", " Patches.__name__ = \"Patches\";\n", " Patches.init_Patches();\n", " },\n", " /* models/glyphs/quad.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const box_1 = require(218) /* ./box */;\n", " class QuadView extends box_1.BoxView {\n", " scenterx(i) {\n", " return (this.sleft[i] + this.sright[i]) / 2;\n", " }\n", " scentery(i) {\n", " return (this.stop[i] + this.sbottom[i]) / 2;\n", " }\n", " _index_data() {\n", " return this._index_box(this._right.length);\n", " }\n", " _lrtb(i) {\n", " const l = this._left[i];\n", " const r = this._right[i];\n", " const t = this._top[i];\n", " const b = this._bottom[i];\n", " return [l, r, t, b];\n", " }\n", " }\n", " exports.QuadView = QuadView;\n", " QuadView.__name__ = \"QuadView\";\n", " class Quad extends box_1.Box {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Quad() {\n", " this.prototype.default_view = QuadView;\n", " this.coords([['right', 'bottom'], ['left', 'top']]);\n", " }\n", " }\n", " exports.Quad = Quad;\n", " Quad.__name__ = \"Quad\";\n", " Quad.init_Quad();\n", " },\n", " /* models/glyphs/quadratic.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const spatial_1 = require(85) /* ../../core/util/spatial */;\n", " const glyph_1 = require(89) /* ./glyph */;\n", " const utils_1 = require(92) /* ./utils */;\n", " // Formula from: http://pomax.nihongoresources.com/pages/bezier/\n", " //\n", " // if segment is quadratic bezier do:\n", " // for both directions do:\n", " // if control between start and end, compute linear bounding box\n", " // otherwise, compute\n", " // bound = u(1-t)^2 + 2v(1-t)t + wt^2\n", " // (with t = ((u-v) / (u-2v+w)), with {u = start, v = control, w = end})\n", " // if control precedes start, min = bound, otherwise max = bound\n", " function _qbb(u, v, w) {\n", " if (v == (u + w) / 2)\n", " return [u, w];\n", " else {\n", " const t = (u - v) / ((u - (2 * v)) + w);\n", " const bd = (u * (1 - t) ** 2) + (2 * v * (1 - t) * t) + (w * t ** 2);\n", " return [Math.min(u, w, bd), Math.max(u, w, bd)];\n", " }\n", " }\n", " class QuadraticView extends glyph_1.GlyphView {\n", " _index_data() {\n", " const points = [];\n", " for (let i = 0, end = this._x0.length; i < end; i++) {\n", " if (isNaN(this._x0[i] + this._x1[i] + this._y0[i] + this._y1[i] + this._cx[i] + this._cy[i]))\n", " continue;\n", " const [x0, x1] = _qbb(this._x0[i], this._cx[i], this._x1[i]);\n", " const [y0, y1] = _qbb(this._y0[i], this._cy[i], this._y1[i]);\n", " points.push({ x0, y0, x1, y1, i });\n", " }\n", " return new spatial_1.SpatialIndex(points);\n", " }\n", " _render(ctx, indices, { sx0, sy0, sx1, sy1, scx, scy }) {\n", " if (this.visuals.line.doit) {\n", " for (const i of indices) {\n", " if (isNaN(sx0[i] + sy0[i] + sx1[i] + sy1[i] + scx[i] + scy[i]))\n", " continue;\n", " ctx.beginPath();\n", " ctx.moveTo(sx0[i], sy0[i]);\n", " ctx.quadraticCurveTo(scx[i], scy[i], sx1[i], sy1[i]);\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " }\n", " draw_legend_for_index(ctx, bbox, index) {\n", " utils_1.generic_line_legend(this.visuals, ctx, bbox, index);\n", " }\n", " scenterx() {\n", " throw new Error(\"not implemented\");\n", " }\n", " scentery() {\n", " throw new Error(\"not implemented\");\n", " }\n", " }\n", " exports.QuadraticView = QuadraticView;\n", " QuadraticView.__name__ = \"QuadraticView\";\n", " class Quadratic extends glyph_1.Glyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Quadratic() {\n", " this.prototype.default_view = QuadraticView;\n", " this.coords([['x0', 'y0'], ['x1', 'y1'], ['cx', 'cy']]);\n", " this.mixins(property_mixins_1.LineVector);\n", " }\n", " }\n", " exports.Quadratic = Quadratic;\n", " Quadratic.__name__ = \"Quadratic\";\n", " Quadratic.init_Quadratic();\n", " },\n", " /* models/glyphs/ray.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const xy_glyph_1 = require(84) /* ./xy_glyph */;\n", " const utils_1 = require(92) /* ./utils */;\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class RayView extends xy_glyph_1.XYGlyphView {\n", " _map_data() {\n", " if (this.model.properties.length.units == \"data\")\n", " this.slength = this.sdist(this.renderer.xscale, this._x, this._length);\n", " else\n", " this.slength = this._length;\n", " }\n", " _render(ctx, indices, { sx, sy, slength, _angle }) {\n", " if (this.visuals.line.doit) {\n", " const width = this.renderer.plot_view.frame._width.value;\n", " const height = this.renderer.plot_view.frame._height.value;\n", " const inf_len = 2 * (width + height);\n", " for (let i = 0, end = slength.length; i < end; i++) {\n", " if (slength[i] == 0)\n", " slength[i] = inf_len;\n", " }\n", " for (const i of indices) {\n", " if (isNaN(sx[i] + sy[i] + _angle[i] + slength[i]))\n", " continue;\n", " ctx.translate(sx[i], sy[i]);\n", " ctx.rotate(_angle[i]);\n", " ctx.beginPath();\n", " ctx.moveTo(0, 0);\n", " ctx.lineTo(slength[i], 0);\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " ctx.rotate(-_angle[i]);\n", " ctx.translate(-sx[i], -sy[i]);\n", " }\n", " }\n", " }\n", " draw_legend_for_index(ctx, bbox, index) {\n", " utils_1.generic_line_legend(this.visuals, ctx, bbox, index);\n", " }\n", " }\n", " exports.RayView = RayView;\n", " RayView.__name__ = \"RayView\";\n", " class Ray extends xy_glyph_1.XYGlyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Ray() {\n", " this.prototype.default_view = RayView;\n", " this.mixins(property_mixins_1.LineVector);\n", " this.define({\n", " length: [p.DistanceSpec],\n", " angle: [p.AngleSpec],\n", " });\n", " }\n", " }\n", " exports.Ray = Ray;\n", " Ray.__name__ = \"Ray\";\n", " Ray.init_Ray();\n", " },\n", " /* models/glyphs/rect.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const center_rotatable_1 = require(214) /* ./center_rotatable */;\n", " const utils_1 = require(92) /* ./utils */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const arrayable_1 = require(12) /* ../../core/util/arrayable */;\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class RectView extends center_rotatable_1.CenterRotatableView {\n", " _set_data() {\n", " this.max_w2 = 0;\n", " if (this.model.properties.width.units == \"data\")\n", " this.max_w2 = this.max_width / 2;\n", " this.max_h2 = 0;\n", " if (this.model.properties.height.units == \"data\")\n", " this.max_h2 = this.max_height / 2;\n", " }\n", " _map_data() {\n", " if (this.model.properties.width.units == \"data\")\n", " [this.sw, this.sx0] = this._map_dist_corner_for_data_side_length(this._x, this._width, this.renderer.xscale);\n", " else {\n", " this.sw = this._width;\n", " const n = this.sx.length;\n", " this.sx0 = new Float64Array(n);\n", " for (let i = 0; i < n; i++)\n", " this.sx0[i] = this.sx[i] - this.sw[i] / 2;\n", " }\n", " if (this.model.properties.height.units == \"data\")\n", " [this.sh, this.sy1] = this._map_dist_corner_for_data_side_length(this._y, this._height, this.renderer.yscale);\n", " else {\n", " this.sh = this._height;\n", " const n = this.sy.length;\n", " this.sy1 = new Float64Array(n);\n", " for (let i = 0; i < n; i++)\n", " this.sy1[i] = this.sy[i] - this.sh[i] / 2;\n", " }\n", " const n = this.sw.length;\n", " this.ssemi_diag = new Float64Array(n);\n", " for (let i = 0; i < n; i++)\n", " this.ssemi_diag[i] = Math.sqrt((this.sw[i] / 2 * this.sw[i]) / 2 + (this.sh[i] / 2 * this.sh[i]) / 2);\n", " }\n", " _render(ctx, indices, { sx, sy, sx0, sy1, sw, sh, _angle }) {\n", " if (this.visuals.fill.doit) {\n", " for (const i of indices) {\n", " if (isNaN(sx[i] + sy[i] + sx0[i] + sy1[i] + sw[i] + sh[i] + _angle[i]))\n", " continue;\n", " //no need to test the return value, we call fillRect for every glyph anyway\n", " this.visuals.fill.set_vectorize(ctx, i);\n", " if (_angle[i]) {\n", " ctx.translate(sx[i], sy[i]);\n", " ctx.rotate(_angle[i]);\n", " ctx.fillRect(-sw[i] / 2, -sh[i] / 2, sw[i], sh[i]);\n", " ctx.rotate(-_angle[i]);\n", " ctx.translate(-sx[i], -sy[i]);\n", " }\n", " else\n", " ctx.fillRect(sx0[i], sy1[i], sw[i], sh[i]);\n", " }\n", " }\n", " if (this.visuals.line.doit) {\n", " ctx.beginPath();\n", " for (const i of indices) {\n", " if (isNaN(sx[i] + sy[i] + sx0[i] + sy1[i] + sw[i] + sh[i] + _angle[i]))\n", " continue;\n", " // fillRect does not fill zero-height or -width rects, but rect(...)\n", " // does seem to stroke them (1px wide or tall). Explicitly ignore rects\n", " // with zero width or height to be consistent\n", " if (sw[i] == 0 || sh[i] == 0)\n", " continue;\n", " if (_angle[i]) {\n", " ctx.translate(sx[i], sy[i]);\n", " ctx.rotate(_angle[i]);\n", " ctx.rect(-sw[i] / 2, -sh[i] / 2, sw[i], sh[i]);\n", " ctx.rotate(-_angle[i]);\n", " ctx.translate(-sx[i], -sy[i]);\n", " }\n", " else\n", " ctx.rect(sx0[i], sy1[i], sw[i], sh[i]);\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " ctx.beginPath();\n", " }\n", " ctx.stroke();\n", " }\n", " }\n", " _hit_rect(geometry) {\n", " return this._hit_rect_against_index(geometry);\n", " }\n", " _hit_point(geometry) {\n", " let { sx, sy } = geometry;\n", " const x = this.renderer.xscale.invert(sx);\n", " const y = this.renderer.yscale.invert(sy);\n", " const scenter_x = [];\n", " for (let i = 0, end = this.sx0.length; i < end; i++) {\n", " scenter_x.push(this.sx0[i] + this.sw[i] / 2);\n", " }\n", " const scenter_y = [];\n", " for (let i = 0, end = this.sy1.length; i < end; i++) {\n", " scenter_y.push(this.sy1[i] + this.sh[i] / 2);\n", " }\n", " const max_x2_ddist = arrayable_1.max(this._ddist(0, scenter_x, this.ssemi_diag));\n", " const max_y2_ddist = arrayable_1.max(this._ddist(1, scenter_y, this.ssemi_diag));\n", " const x0 = x - max_x2_ddist;\n", " const x1 = x + max_x2_ddist;\n", " const y0 = y - max_y2_ddist;\n", " const y1 = y + max_y2_ddist;\n", " const indices = [];\n", " for (const i of this.index.indices({ x0, x1, y0, y1 })) {\n", " let height_in, width_in;\n", " if (this._angle[i]) {\n", " const s = Math.sin(-this._angle[i]);\n", " const c = Math.cos(-this._angle[i]);\n", " const px = c * (sx - this.sx[i]) - s * (sy - this.sy[i]) + this.sx[i];\n", " const py = s * (sx - this.sx[i]) + c * (sy - this.sy[i]) + this.sy[i];\n", " sx = px;\n", " sy = py;\n", " width_in = Math.abs(this.sx[i] - sx) <= this.sw[i] / 2;\n", " height_in = Math.abs(this.sy[i] - sy) <= this.sh[i] / 2;\n", " }\n", " else {\n", " width_in = (sx - this.sx0[i] <= this.sw[i]) && (sx - this.sx0[i] >= 0);\n", " height_in = (sy - this.sy1[i] <= this.sh[i]) && (sy - this.sy1[i] >= 0);\n", " }\n", " if (height_in && width_in) {\n", " indices.push(i);\n", " }\n", " }\n", " return new selection_1.Selection({ indices });\n", " }\n", " _map_dist_corner_for_data_side_length(coord, side_length, scale) {\n", " const n = coord.length;\n", " const pt0 = new Float64Array(n);\n", " const pt1 = new Float64Array(n);\n", " for (let i = 0; i < n; i++) {\n", " pt0[i] = Number(coord[i]) - side_length[i] / 2;\n", " pt1[i] = Number(coord[i]) + side_length[i] / 2;\n", " }\n", " const spt0 = scale.v_compute(pt0);\n", " const spt1 = scale.v_compute(pt1);\n", " const sside_length = this.sdist(scale, pt0, side_length, 'edge', this.model.dilate);\n", " let spt_corner = spt0;\n", " for (let i = 0, end = spt0.length; i < end; i++) {\n", " if (spt0[i] != spt1[i]) {\n", " spt_corner = spt0[i] < spt1[i] ? spt0 : spt1;\n", " break;\n", " }\n", " }\n", " return [sside_length, spt_corner];\n", " }\n", " _ddist(dim, spts, spans) {\n", " const scale = dim == 0 ? this.renderer.xscale : this.renderer.yscale;\n", " const spt0 = spts;\n", " const m = spt0.length;\n", " const spt1 = new Float64Array(m);\n", " for (let i = 0; i < m; i++)\n", " spt1[i] = spt0[i] + spans[i];\n", " const pt0 = scale.v_invert(spt0);\n", " const pt1 = scale.v_invert(spt1);\n", " const n = pt0.length;\n", " const ddist = new Float64Array(n);\n", " for (let i = 0; i < n; i++)\n", " ddist[i] = Math.abs(pt1[i] - pt0[i]);\n", " return ddist;\n", " }\n", " draw_legend_for_index(ctx, bbox, index) {\n", " utils_1.generic_area_legend(this.visuals, ctx, bbox, index);\n", " }\n", " _bounds({ x0, x1, y0, y1 }) {\n", " return {\n", " x0: x0 - this.max_w2,\n", " x1: x1 + this.max_w2,\n", " y0: y0 - this.max_h2,\n", " y1: y1 + this.max_h2,\n", " };\n", " }\n", " }\n", " exports.RectView = RectView;\n", " RectView.__name__ = \"RectView\";\n", " class Rect extends center_rotatable_1.CenterRotatable {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Rect() {\n", " this.prototype.default_view = RectView;\n", " this.define({\n", " dilate: [p.Boolean, false],\n", " });\n", " }\n", " }\n", " exports.Rect = Rect;\n", " Rect.__name__ = \"Rect\";\n", " Rect.init_Rect();\n", " },\n", " /* models/glyphs/segment.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const hittest = tslib_1.__importStar(require(93) /* ../../core/hittest */);\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const spatial_1 = require(85) /* ../../core/util/spatial */;\n", " const glyph_1 = require(89) /* ./glyph */;\n", " const utils_1 = require(92) /* ./utils */;\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class SegmentView extends glyph_1.GlyphView {\n", " _index_data() {\n", " const points = [];\n", " for (let i = 0, end = this._x0.length; i < end; i++) {\n", " const x0 = this._x0[i];\n", " const x1 = this._x1[i];\n", " const y0 = this._y0[i];\n", " const y1 = this._y1[i];\n", " if (!isNaN(x0 + x1 + y0 + y1)) {\n", " points.push({\n", " x0: Math.min(x0, x1),\n", " y0: Math.min(y0, y1),\n", " x1: Math.max(x0, x1),\n", " y1: Math.max(y0, y1),\n", " i,\n", " });\n", " }\n", " }\n", " return new spatial_1.SpatialIndex(points);\n", " }\n", " _render(ctx, indices, { sx0, sy0, sx1, sy1 }) {\n", " if (this.visuals.line.doit) {\n", " for (const i of indices) {\n", " if (isNaN(sx0[i] + sy0[i] + sx1[i] + sy1[i]))\n", " continue;\n", " ctx.beginPath();\n", " ctx.moveTo(sx0[i], sy0[i]);\n", " ctx.lineTo(sx1[i], sy1[i]);\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " }\n", " _hit_point(geometry) {\n", " const { sx, sy } = geometry;\n", " const point = { x: sx, y: sy };\n", " const lw_voffset = 2; // FIXME: Use maximum of segments line_width/2 instead of magic constant 2\n", " const [x0, x1] = this.renderer.xscale.r_invert(sx - lw_voffset, sx + lw_voffset);\n", " const [y0, y1] = this.renderer.yscale.r_invert(sy - lw_voffset, sy + lw_voffset);\n", " const candidates = this.index.indices({ x0, y0, x1, y1 });\n", " const indices = [];\n", " for (const i of candidates) {\n", " const threshold2 = Math.max(2, this.visuals.line.cache_select('line_width', i) / 2) ** 2;\n", " const p0 = { x: this.sx0[i], y: this.sy0[i] };\n", " const p1 = { x: this.sx1[i], y: this.sy1[i] };\n", " const dist2 = hittest.dist_to_segment_squared(point, p0, p1);\n", " if (dist2 < threshold2) {\n", " indices.push(i);\n", " }\n", " }\n", " return new selection_1.Selection({ indices });\n", " }\n", " _hit_span(geometry) {\n", " const [hr, vr] = this.renderer.plot_view.frame.bbox.ranges;\n", " const { sx, sy } = geometry;\n", " let v0;\n", " let v1;\n", " let val;\n", " if (geometry.direction == 'v') {\n", " val = this.renderer.yscale.invert(sy);\n", " [v0, v1] = [this._y0, this._y1];\n", " }\n", " else {\n", " val = this.renderer.xscale.invert(sx);\n", " [v0, v1] = [this._x0, this._x1];\n", " }\n", " const indices = [];\n", " const [x0, x1] = this.renderer.xscale.r_invert(hr.start, hr.end);\n", " const [y0, y1] = this.renderer.yscale.r_invert(vr.start, vr.end);\n", " const candidates = this.index.indices({ x0, y0, x1, y1 });\n", " for (const i of candidates) {\n", " if ((v0[i] <= val && val <= v1[i]) || (v1[i] <= val && val <= v0[i]))\n", " indices.push(i);\n", " const threshold = 1.5 + (this.visuals.line.cache_select('line_width', i) / 2); // Maximum pixel difference to detect hit\n", " if (v0[i] == v1[i]) {\n", " if (geometry.direction == 'h') {\n", " if (Math.abs(this.sx0[i] - sx) <= threshold) {\n", " indices.push(i);\n", " }\n", " }\n", " else {\n", " if (Math.abs(this.sy0[i] - sy) <= threshold) {\n", " indices.push(i);\n", " }\n", " }\n", " }\n", " }\n", " return new selection_1.Selection({ indices });\n", " }\n", " scenterx(i) {\n", " return (this.sx0[i] + this.sx1[i]) / 2;\n", " }\n", " scentery(i) {\n", " return (this.sy0[i] + this.sy1[i]) / 2;\n", " }\n", " draw_legend_for_index(ctx, bbox, index) {\n", " utils_1.generic_line_legend(this.visuals, ctx, bbox, index);\n", " }\n", " }\n", " exports.SegmentView = SegmentView;\n", " SegmentView.__name__ = \"SegmentView\";\n", " class Segment extends glyph_1.Glyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Segment() {\n", " this.prototype.default_view = SegmentView;\n", " this.coords([['x0', 'y0'], ['x1', 'y1']]);\n", " this.mixins(property_mixins_1.LineVector);\n", " }\n", " }\n", " exports.Segment = Segment;\n", " Segment.__name__ = \"Segment\";\n", " Segment.init_Segment();\n", " },\n", " /* models/glyphs/step.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const xy_glyph_1 = require(84) /* ./xy_glyph */;\n", " const utils_1 = require(92) /* ./utils */;\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class StepView extends xy_glyph_1.XYGlyphView {\n", " _render(ctx, indices, { sx, sy }) {\n", " let drawing = false;\n", " let last_index = null;\n", " this.visuals.line.set_value(ctx);\n", " const L = indices.length;\n", " if (L < 2)\n", " return;\n", " ctx.beginPath();\n", " ctx.moveTo(sx[0], sy[0]);\n", " for (const i of indices) {\n", " let x1, x2;\n", " let y1, y2;\n", " switch (this.model.mode) {\n", " case \"before\": {\n", " [x1, y1] = [sx[i - 1], sy[i]];\n", " [x2, y2] = [sx[i], sy[i]];\n", " break;\n", " }\n", " case \"after\": {\n", " [x1, y1] = [sx[i], sy[i - 1]];\n", " [x2, y2] = [sx[i], sy[i]];\n", " break;\n", " }\n", " case \"center\": {\n", " const xm = (sx[i - 1] + sx[i]) / 2;\n", " [x1, y1] = [xm, sy[i - 1]];\n", " [x2, y2] = [xm, sy[i]];\n", " break;\n", " }\n", " default:\n", " throw new Error(\"unexpected\");\n", " }\n", " if (drawing) {\n", " if (!isFinite(sx[i] + sy[i])) {\n", " ctx.stroke();\n", " ctx.beginPath();\n", " drawing = false;\n", " last_index = i;\n", " continue;\n", " }\n", " if (last_index != null && i - last_index > 1) {\n", " ctx.stroke();\n", " drawing = false;\n", " }\n", " }\n", " if (drawing) {\n", " ctx.lineTo(x1, y1);\n", " ctx.lineTo(x2, y2);\n", " }\n", " else {\n", " ctx.beginPath();\n", " ctx.moveTo(sx[i], sy[i]);\n", " drawing = true;\n", " }\n", " last_index = i;\n", " }\n", " ctx.lineTo(sx[L - 1], sy[L - 1]);\n", " ctx.stroke();\n", " }\n", " draw_legend_for_index(ctx, bbox, index) {\n", " utils_1.generic_line_legend(this.visuals, ctx, bbox, index);\n", " }\n", " }\n", " exports.StepView = StepView;\n", " StepView.__name__ = \"StepView\";\n", " class Step extends xy_glyph_1.XYGlyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Step() {\n", " this.prototype.default_view = StepView;\n", " this.mixins(property_mixins_1.LineVector);\n", " this.define({\n", " mode: [p.StepMode, \"before\"],\n", " });\n", " }\n", " }\n", " exports.Step = Step;\n", " Step.__name__ = \"Step\";\n", " Step.init_Step();\n", " },\n", " /* models/glyphs/text.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const xy_glyph_1 = require(84) /* ./xy_glyph */;\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const hittest = tslib_1.__importStar(require(93) /* ../../core/hittest */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const text_1 = require(132) /* ../../core/util/text */;\n", " const assert_1 = require(11) /* ../../core/util/assert */;\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class TextView extends xy_glyph_1.XYGlyphView {\n", " _rotate_point(x, y, xoff, yoff, angle) {\n", " const sxr = (x - xoff) * Math.cos(angle) - (y - yoff) * Math.sin(angle) + xoff;\n", " const syr = (x - xoff) * Math.sin(angle) + (y - yoff) * Math.cos(angle) + yoff;\n", " return [sxr, syr];\n", " }\n", " _text_bounds(x0, y0, width, height) {\n", " const xvals = [x0, x0 + width, x0 + width, x0, x0];\n", " const yvals = [y0, y0, y0 - height, y0 - height, y0];\n", " return [xvals, yvals];\n", " }\n", " _render(ctx, indices, { sx, sy, _x_offset, _y_offset, _angle, _text }) {\n", " this._sys = [];\n", " this._sxs = [];\n", " for (const i of indices) {\n", " this._sxs[i] = [];\n", " this._sys[i] = [];\n", " if (isNaN(sx[i] + sy[i] + _x_offset[i] + _y_offset[i] + _angle[i]) || _text[i] == null)\n", " continue;\n", " if (this.visuals.text.doit) {\n", " const text = `${_text[i]}`;\n", " ctx.save();\n", " ctx.translate(sx[i] + _x_offset[i], sy[i] + _y_offset[i]);\n", " ctx.rotate(_angle[i]);\n", " this.visuals.text.set_vectorize(ctx, i);\n", " const font = this.visuals.text.cache_select(\"font\", i);\n", " const { height } = text_1.measure_font(font);\n", " const line_height = this.visuals.text.text_line_height.value() * height;\n", " if (text.indexOf(\"\\n\") == -1) {\n", " ctx.fillText(text, 0, 0);\n", " const x0 = sx[i] + _x_offset[i];\n", " const y0 = sy[i] + _y_offset[i];\n", " const width = ctx.measureText(text).width;\n", " const [xvalues, yvalues] = this._text_bounds(x0, y0, width, line_height);\n", " this._sxs[i].push(xvalues);\n", " this._sys[i].push(yvalues);\n", " }\n", " else {\n", " const lines = text.split(\"\\n\");\n", " const block_height = line_height * lines.length;\n", " const baseline = this.visuals.text.cache_select(\"text_baseline\", i);\n", " let y;\n", " switch (baseline) {\n", " case \"top\": {\n", " y = 0;\n", " break;\n", " }\n", " case \"middle\": {\n", " y = (-block_height / 2) + (line_height / 2);\n", " break;\n", " }\n", " case \"bottom\": {\n", " y = -block_height + line_height;\n", " break;\n", " }\n", " default: {\n", " y = 0;\n", " console.warn(`'${baseline}' baseline not supported with multi line text`);\n", " }\n", " }\n", " for (const line of lines) {\n", " ctx.fillText(line, 0, y);\n", " const x0 = sx[i] + _x_offset[i];\n", " const y0 = y + sy[i] + _y_offset[i];\n", " const width = ctx.measureText(line).width;\n", " const [xvalues, yvalues] = this._text_bounds(x0, y0, width, line_height);\n", " this._sxs[i].push(xvalues);\n", " this._sys[i].push(yvalues);\n", " y += line_height;\n", " }\n", " }\n", " ctx.restore();\n", " }\n", " }\n", " }\n", " _hit_point(geometry) {\n", " const { sx, sy } = geometry;\n", " const indices = [];\n", " for (let i = 0; i < this._sxs.length; i++) {\n", " const sxs = this._sxs[i];\n", " const sys = this._sys[i];\n", " const n = sxs.length;\n", " for (let j = 0, endj = n; j < endj; j++) {\n", " const [sxr, syr] = this._rotate_point(sx, sy, sxs[n - 1][0], sys[n - 1][0], -this._angle[i]);\n", " if (hittest.point_in_poly(sxr, syr, sxs[j], sys[j])) {\n", " indices.push(i);\n", " }\n", " }\n", " }\n", " return new selection_1.Selection({ indices });\n", " }\n", " _scenterxy(i) {\n", " const sxs = this._sxs[i];\n", " const sys = this._sys[i];\n", " assert_1.assert(sxs.length != 0 && sys.length != 0);\n", " const sx0 = sxs[0][0];\n", " const sy0 = sys[0][0];\n", " const sxc = (sxs[0][2] + sx0) / 2;\n", " const syc = (sys[0][2] + sy0) / 2;\n", " const [sxcr, sycr] = this._rotate_point(sxc, syc, sx0, sy0, this._angle[i]);\n", " return { x: sxcr, y: sycr };\n", " }\n", " scenterx(i) {\n", " return this._scenterxy(i).x;\n", " }\n", " scentery(i) {\n", " return this._scenterxy(i).y;\n", " }\n", " }\n", " exports.TextView = TextView;\n", " TextView.__name__ = \"TextView\";\n", " class Text extends xy_glyph_1.XYGlyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Text() {\n", " this.prototype.default_view = TextView;\n", " this.mixins(property_mixins_1.TextVector);\n", " this.define({\n", " text: [p.NullStringSpec, { field: \"text\" }],\n", " angle: [p.AngleSpec, 0],\n", " x_offset: [p.NumberSpec, 0],\n", " y_offset: [p.NumberSpec, 0],\n", " });\n", " }\n", " }\n", " exports.Text = Text;\n", " Text.__name__ = \"Text\";\n", " Text.init_Text();\n", " },\n", " /* models/glyphs/vbar.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const box_1 = require(218) /* ./box */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class VBarView extends box_1.BoxView {\n", " scenterx(i) {\n", " return this.sx[i];\n", " }\n", " scentery(i) {\n", " return (this.stop[i] + this.sbottom[i]) / 2;\n", " }\n", " _index_data() {\n", " return this._index_box(this._x.length);\n", " }\n", " _lrtb(i) {\n", " const l = this._x[i] - (this._width[i] / 2);\n", " const r = this._x[i] + (this._width[i] / 2);\n", " const t = Math.max(this._top[i], this._bottom[i]);\n", " const b = Math.min(this._top[i], this._bottom[i]);\n", " return [l, r, t, b];\n", " }\n", " _map_data() {\n", " this.sx = this.renderer.xscale.v_compute(this._x);\n", " this.sw = this.sdist(this.renderer.xscale, this._x, this._width, \"center\");\n", " this.stop = this.renderer.yscale.v_compute(this._top);\n", " this.sbottom = this.renderer.yscale.v_compute(this._bottom);\n", " const n = this.sx.length;\n", " this.sleft = new Float64Array(n);\n", " this.sright = new Float64Array(n);\n", " for (let i = 0; i < n; i++) {\n", " this.sleft[i] = this.sx[i] - this.sw[i] / 2;\n", " this.sright[i] = this.sx[i] + this.sw[i] / 2;\n", " }\n", " this._clamp_viewport();\n", " }\n", " }\n", " exports.VBarView = VBarView;\n", " VBarView.__name__ = \"VBarView\";\n", " class VBar extends box_1.Box {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_VBar() {\n", " this.prototype.default_view = VBarView;\n", " this.coords([['x', 'bottom']]);\n", " this.define({\n", " width: [p.NumberSpec],\n", " top: [p.CoordinateSpec],\n", " });\n", " this.override({\n", " bottom: 0,\n", " });\n", " }\n", " }\n", " exports.VBar = VBar;\n", " VBar.__name__ = \"VBar\";\n", " VBar.init_VBar();\n", " },\n", " /* models/glyphs/wedge.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const xy_glyph_1 = require(84) /* ./xy_glyph */;\n", " const utils_1 = require(92) /* ./utils */;\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const math_1 = require(10) /* ../../core/util/math */;\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class WedgeView extends xy_glyph_1.XYGlyphView {\n", " _map_data() {\n", " if (this.model.properties.radius.units == \"data\")\n", " this.sradius = this.sdist(this.renderer.xscale, this._x, this._radius);\n", " else\n", " this.sradius = this._radius;\n", " }\n", " _render(ctx, indices, { sx, sy, sradius, _start_angle, _end_angle }) {\n", " const direction = this.model.properties.direction.value();\n", " for (const i of indices) {\n", " if (isNaN(sx[i] + sy[i] + sradius[i] + _start_angle[i] + _end_angle[i]))\n", " continue;\n", " ctx.beginPath();\n", " ctx.arc(sx[i], sy[i], sradius[i], _start_angle[i], _end_angle[i], direction);\n", " ctx.lineTo(sx[i], sy[i]);\n", " ctx.closePath();\n", " if (this.visuals.fill.doit) {\n", " this.visuals.fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (this.visuals.line.doit) {\n", " this.visuals.line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " }\n", " _hit_point(geometry) {\n", " let dist, sx0, sx1, sy0, sy1, x0, x1, y0, y1;\n", " const { sx, sy } = geometry;\n", " const x = this.renderer.xscale.invert(sx);\n", " const y = this.renderer.yscale.invert(sy);\n", " // check diameter first\n", " const max_diameter = 2 * this.max_radius;\n", " if (this.model.properties.radius.units === \"data\") {\n", " x0 = x - max_diameter;\n", " x1 = x + max_diameter;\n", " y0 = y - max_diameter;\n", " y1 = y + max_diameter;\n", " }\n", " else {\n", " sx0 = sx - max_diameter;\n", " sx1 = sx + max_diameter;\n", " [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " sy0 = sy - max_diameter;\n", " sy1 = sy + max_diameter;\n", " [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " }\n", " const candidates = [];\n", " for (const i of this.index.indices({ x0, x1, y0, y1 })) {\n", " const r2 = this.sradius[i] ** 2;\n", " [sx0, sx1] = this.renderer.xscale.r_compute(x, this._x[i]);\n", " [sy0, sy1] = this.renderer.yscale.r_compute(y, this._y[i]);\n", " dist = (sx0 - sx1) ** 2 + (sy0 - sy1) ** 2;\n", " if (dist <= r2) {\n", " candidates.push([i, dist]);\n", " }\n", " }\n", " const direction = this.model.properties.direction.value();\n", " const hits = [];\n", " for (const [i, dist] of candidates) {\n", " // NOTE: minus the angle because JS uses non-mathy convention for angles\n", " const angle = Math.atan2(sy - this.sy[i], sx - this.sx[i]);\n", " if (math_1.angle_between(-angle, -this._start_angle[i], -this._end_angle[i], direction)) {\n", " hits.push([i, dist]);\n", " }\n", " }\n", " return selection_1.Selection.from_hits(hits);\n", " }\n", " draw_legend_for_index(ctx, bbox, index) {\n", " utils_1.generic_area_legend(this.visuals, ctx, bbox, index);\n", " }\n", " _scenterxy(i) {\n", " const r = this.sradius[i] / 2;\n", " const a = (this._start_angle[i] + this._end_angle[i]) / 2;\n", " return { x: this.sx[i] + (r * Math.cos(a)), y: this.sy[i] + (r * Math.sin(a)) };\n", " }\n", " scenterx(i) {\n", " return this._scenterxy(i).x;\n", " }\n", " scentery(i) {\n", " return this._scenterxy(i).y;\n", " }\n", " }\n", " exports.WedgeView = WedgeView;\n", " WedgeView.__name__ = \"WedgeView\";\n", " class Wedge extends xy_glyph_1.XYGlyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Wedge() {\n", " this.prototype.default_view = WedgeView;\n", " this.mixins([property_mixins_1.LineVector, property_mixins_1.FillVector]);\n", " this.define({\n", " direction: [p.Direction, 'anticlock'],\n", " radius: [p.DistanceSpec],\n", " start_angle: [p.AngleSpec],\n", " end_angle: [p.AngleSpec],\n", " });\n", " }\n", " }\n", " exports.Wedge = Wedge;\n", " Wedge.__name__ = \"Wedge\";\n", " Wedge.init_Wedge();\n", " },\n", " /* models/graphs/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " tslib_1.__exportStar(require(101) /* ./graph_hit_test_policy */, exports);\n", " tslib_1.__exportStar(require(239) /* ./layout_provider */, exports);\n", " tslib_1.__exportStar(require(240) /* ./static_layout_provider */, exports);\n", " },\n", " /* models/graphs/layout_provider.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const model_1 = require(71) /* ../../model */;\n", " class LayoutProvider extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " }\n", " exports.LayoutProvider = LayoutProvider;\n", " LayoutProvider.__name__ = \"LayoutProvider\";\n", " },\n", " /* models/graphs/static_layout_provider.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const layout_provider_1 = require(239) /* ./layout_provider */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class StaticLayoutProvider extends layout_provider_1.LayoutProvider {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_StaticLayoutProvider() {\n", " this.define({\n", " graph_layout: [p.Any, {}],\n", " });\n", " }\n", " get_node_coordinates(node_source) {\n", " const xs = [];\n", " const ys = [];\n", " const index = node_source.data.index;\n", " for (let i = 0, end = index.length; i < end; i++) {\n", " const point = this.graph_layout[index[i]];\n", " const [x, y] = point != null ? point : [NaN, NaN];\n", " xs.push(x);\n", " ys.push(y);\n", " }\n", " return [xs, ys];\n", " }\n", " get_edge_coordinates(edge_source) {\n", " const xs = [];\n", " const ys = [];\n", " const starts = edge_source.data.start;\n", " const ends = edge_source.data.end;\n", " const has_paths = (edge_source.data.xs != null) && (edge_source.data.ys != null);\n", " for (let i = 0, endi = starts.length; i < endi; i++) {\n", " const in_layout = (this.graph_layout[starts[i]] != null) && (this.graph_layout[ends[i]] != null);\n", " if (has_paths && in_layout) {\n", " xs.push(edge_source.data.xs[i]);\n", " ys.push(edge_source.data.ys[i]);\n", " }\n", " else {\n", " let end, start;\n", " if (in_layout)\n", " [start, end] = [this.graph_layout[starts[i]], this.graph_layout[ends[i]]];\n", " else\n", " [start, end] = [[NaN, NaN], [NaN, NaN]];\n", " xs.push([start[0], end[0]]);\n", " ys.push([start[1], end[1]]);\n", " }\n", " }\n", " return [xs, ys];\n", " }\n", " }\n", " exports.StaticLayoutProvider = StaticLayoutProvider;\n", " StaticLayoutProvider.__name__ = \"StaticLayoutProvider\";\n", " StaticLayoutProvider.init_StaticLayoutProvider();\n", " },\n", " /* models/grids/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var grid_1 = require(242) /* ./grid */;\n", " exports.Grid = grid_1.Grid;\n", " },\n", " /* models/grids/grid.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const guide_renderer_1 = require(151) /* ../renderers/guide_renderer */;\n", " const mixins = tslib_1.__importStar(require(23) /* ../../core/property_mixins */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " class GridView extends guide_renderer_1.GuideRendererView {\n", " render() {\n", " if (!this.model.visible)\n", " return;\n", " const ctx = this.layer.ctx;\n", " ctx.save();\n", " this._draw_regions(ctx);\n", " this._draw_minor_grids(ctx);\n", " this._draw_grids(ctx);\n", " ctx.restore();\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.change, () => this.request_render());\n", " }\n", " _draw_regions(ctx) {\n", " if (!this.visuals.band_fill.doit && !this.visuals.band_hatch.doit)\n", " return;\n", " this.visuals.band_fill.set_value(ctx);\n", " const [xs, ys] = this.grid_coords('major', false);\n", " for (let i = 0; i < xs.length - 1; i++) {\n", " if (i % 2 != 1)\n", " continue;\n", " const [sx0, sy0] = this.plot_view.map_to_screen(xs[i], ys[i], this.model.x_range_name, this.model.y_range_name);\n", " const [sx1, sy1] = this.plot_view.map_to_screen(xs[i + 1], ys[i + 1], this.model.x_range_name, this.model.y_range_name);\n", " if (this.visuals.band_fill.doit)\n", " ctx.fillRect(sx0[0], sy0[0], sx1[1] - sx0[0], sy1[1] - sy0[0]);\n", " this.visuals.band_hatch.doit2(ctx, i, () => {\n", " ctx.fillRect(sx0[0], sy0[0], sx1[1] - sx0[0], sy1[1] - sy0[0]);\n", " }, () => this.request_render());\n", " }\n", " }\n", " _draw_grids(ctx) {\n", " if (!this.visuals.grid_line.doit)\n", " return;\n", " const [xs, ys] = this.grid_coords('major');\n", " this._draw_grid_helper(ctx, this.visuals.grid_line, xs, ys);\n", " }\n", " _draw_minor_grids(ctx) {\n", " if (!this.visuals.minor_grid_line.doit)\n", " return;\n", " const [xs, ys] = this.grid_coords('minor');\n", " this._draw_grid_helper(ctx, this.visuals.minor_grid_line, xs, ys);\n", " }\n", " _draw_grid_helper(ctx, visuals, xs, ys) {\n", " visuals.set_value(ctx);\n", " for (let i = 0; i < xs.length; i++) {\n", " const [sx, sy] = this.plot_view.map_to_screen(xs[i], ys[i], this.model.x_range_name, this.model.y_range_name);\n", " ctx.beginPath();\n", " ctx.moveTo(Math.round(sx[0]), Math.round(sy[0]));\n", " for (let i = 1; i < sx.length; i++)\n", " ctx.lineTo(Math.round(sx[i]), Math.round(sy[i]));\n", " ctx.stroke();\n", " }\n", " }\n", " // {{{ TODO: state\n", " ranges() {\n", " const i = this.model.dimension;\n", " const j = (i + 1) % 2;\n", " const frame = this.plot_view.frame;\n", " const ranges = [\n", " frame.x_ranges[this.model.x_range_name],\n", " frame.y_ranges[this.model.y_range_name],\n", " ];\n", " return [ranges[i], ranges[j]];\n", " }\n", " computed_bounds() {\n", " const [range] = this.ranges();\n", " const user_bounds = this.model.bounds;\n", " const range_bounds = [range.min, range.max];\n", " let start;\n", " let end;\n", " if (types_1.isArray(user_bounds)) {\n", " start = Math.min(user_bounds[0], user_bounds[1]);\n", " end = Math.max(user_bounds[0], user_bounds[1]);\n", " if (start < range_bounds[0])\n", " start = range_bounds[0];\n", " // XXX:\n", " //else if (start > range_bounds[1])\n", " // start = null\n", " if (end > range_bounds[1])\n", " end = range_bounds[1];\n", " // XXX:\n", " //else if (end < range_bounds[0])\n", " // end = null\n", " }\n", " else {\n", " [start, end] = range_bounds;\n", " for (const axis_view of this.plot_view.axis_views) {\n", " if (axis_view.dimension == this.model.dimension\n", " && axis_view.model.x_range_name == this.model.x_range_name\n", " && axis_view.model.y_range_name == this.model.y_range_name) {\n", " [start, end] = axis_view.computed_bounds;\n", " }\n", " }\n", " }\n", " return [start, end];\n", " }\n", " grid_coords(location, exclude_ends = true) {\n", " const i = this.model.dimension;\n", " const j = (i + 1) % 2;\n", " const [range, cross_range] = this.ranges();\n", " let [start, end] = this.computed_bounds();\n", " [start, end] = [Math.min(start, end), Math.max(start, end)];\n", " const coords = [[], []];\n", " // TODO: (bev) using cross_range.min for cross_loc is a bit of a cheat. Since we\n", " // currently only support \"straight line\" grids, this should be OK for now. If\n", " // we ever want to support \"curved\" grids, e.g. for some projections, we may\n", " // have to communicate more than just a single cross location.\n", " const ticker = this.model.get_ticker();\n", " if (ticker == null) {\n", " return coords;\n", " }\n", " const ticks = ticker.get_ticks(start, end, range, cross_range.min, {})[location];\n", " const min = range.min;\n", " const max = range.max;\n", " const cmin = cross_range.min;\n", " const cmax = cross_range.max;\n", " if (!exclude_ends) {\n", " if (ticks[0] != min)\n", " ticks.splice(0, 0, min);\n", " if (ticks[ticks.length - 1] != max)\n", " ticks.push(max);\n", " }\n", " for (let ii = 0; ii < ticks.length; ii++) {\n", " if ((ticks[ii] == min || ticks[ii] == max) && exclude_ends)\n", " continue;\n", " const dim_i = [];\n", " const dim_j = [];\n", " const N = 2;\n", " for (let n = 0; n < N; n++) {\n", " const loc = cmin + (cmax - cmin) / (N - 1) * n;\n", " dim_i.push(ticks[ii]);\n", " dim_j.push(loc);\n", " }\n", " coords[i].push(dim_i);\n", " coords[j].push(dim_j);\n", " }\n", " return coords;\n", " }\n", " }\n", " exports.GridView = GridView;\n", " GridView.__name__ = \"GridView\";\n", " class Grid extends guide_renderer_1.GuideRenderer {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Grid() {\n", " this.prototype.default_view = GridView;\n", " this.mixins([\n", " [\"grid_\", mixins.Line],\n", " [\"minor_grid_\", mixins.Line],\n", " [\"band_\", mixins.Fill],\n", " [\"band_\", mixins.Hatch],\n", " ]);\n", " this.define({\n", " bounds: [p.Any, 'auto'],\n", " dimension: [p.Any, 0],\n", " axis: [p.Instance],\n", " ticker: [p.Instance],\n", " x_range_name: [p.String, 'default'],\n", " y_range_name: [p.String, 'default'],\n", " });\n", " this.override({\n", " level: \"underlay\",\n", " band_fill_color: null,\n", " band_fill_alpha: 0,\n", " grid_line_color: '#e5e5e5',\n", " minor_grid_line_color: null,\n", " });\n", " }\n", " get_ticker() {\n", " if (this.ticker != null) {\n", " return this.ticker;\n", " }\n", " if (this.axis != null) {\n", " return this.axis.ticker;\n", " }\n", " return null;\n", " }\n", " }\n", " exports.Grid = Grid;\n", " Grid.__name__ = \"Grid\";\n", " Grid.init_Grid();\n", " },\n", " /* models/layouts/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var box_1 = require(244) /* ./box */;\n", " exports.Box = box_1.Box;\n", " var column_1 = require(247) /* ./column */;\n", " exports.Column = column_1.Column;\n", " var grid_box_1 = require(248) /* ./grid_box */;\n", " exports.GridBox = grid_box_1.GridBox;\n", " var html_box_1 = require(249) /* ./html_box */;\n", " exports.HTMLBox = html_box_1.HTMLBox;\n", " var layout_dom_1 = require(245) /* ./layout_dom */;\n", " exports.LayoutDOM = layout_dom_1.LayoutDOM;\n", " var row_1 = require(250) /* ./row */;\n", " exports.Row = row_1.Row;\n", " var spacer_1 = require(251) /* ./spacer */;\n", " exports.Spacer = spacer_1.Spacer;\n", " var tabs_1 = require(252) /* ./tabs */;\n", " exports.Panel = tabs_1.Panel;\n", " exports.Tabs = tabs_1.Tabs;\n", " var widget_box_1 = require(259) /* ./widget_box */;\n", " exports.WidgetBox = widget_box_1.WidgetBox;\n", " },\n", " /* models/layouts/box.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const layout_dom_1 = require(245) /* ./layout_dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class BoxView extends layout_dom_1.LayoutDOMView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.children.change, () => this.rebuild());\n", " }\n", " get child_models() {\n", " return this.model.children;\n", " }\n", " }\n", " exports.BoxView = BoxView;\n", " BoxView.__name__ = \"BoxView\";\n", " class Box extends layout_dom_1.LayoutDOM {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Box() {\n", " this.define({\n", " children: [p.Array, []],\n", " spacing: [p.Number, 0],\n", " });\n", " }\n", " }\n", " exports.Box = Box;\n", " Box.__name__ = \"Box\";\n", " Box.init_Box();\n", " },\n", " /* models/layouts/layout_dom.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const model_1 = require(71) /* ../../model */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const logging_1 = require(72) /* ../../core/logging */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const build_views_1 = require(99) /* ../../core/build_views */;\n", " const dom_view_1 = require(66) /* ../../core/dom_view */;\n", " const root_1 = require(246) /* ../../styles/root */;\n", " class LayoutDOMView extends dom_view_1.DOMView {\n", " constructor() {\n", " super(...arguments);\n", " this._idle_notified = false;\n", " this._offset_parent = null;\n", " this._viewport = {};\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.el.style.position = this.is_root ? \"relative\" : \"absolute\";\n", " this._child_views = new Map();\n", " }\n", " async lazy_initialize() {\n", " await this.build_child_views();\n", " }\n", " remove() {\n", " for (const child_view of this.child_views)\n", " child_view.remove();\n", " this._child_views.clear();\n", " super.remove();\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " if (this.is_root) {\n", " this._on_resize = () => this.resize_layout();\n", " window.addEventListener(\"resize\", this._on_resize);\n", " this._parent_observer = setInterval(() => {\n", " const offset_parent = this.el.offsetParent;\n", " if (this._offset_parent != offset_parent) {\n", " this._offset_parent = offset_parent;\n", " if (offset_parent != null) {\n", " this.compute_viewport();\n", " this.invalidate_layout();\n", " }\n", " }\n", " }, 250);\n", " }\n", " const p = this.model.properties;\n", " this.on_change([\n", " p.width, p.height,\n", " p.min_width, p.min_height,\n", " p.max_width, p.max_height,\n", " p.margin,\n", " p.width_policy, p.height_policy, p.sizing_mode,\n", " p.aspect_ratio,\n", " p.visible,\n", " ], () => this.invalidate_layout());\n", " this.on_change([\n", " p.background,\n", " p.css_classes,\n", " ], () => this.invalidate_render());\n", " }\n", " disconnect_signals() {\n", " if (this._parent_observer != null)\n", " clearTimeout(this._parent_observer);\n", " if (this._on_resize != null)\n", " window.removeEventListener(\"resize\", this._on_resize);\n", " super.disconnect_signals();\n", " }\n", " css_classes() {\n", " return super.css_classes().concat(this.model.css_classes);\n", " }\n", " get child_views() {\n", " return this.child_models.map((child) => this._child_views.get(child));\n", " }\n", " async build_child_views() {\n", " await build_views_1.build_views(this._child_views, this.child_models, { parent: this });\n", " }\n", " render() {\n", " super.render();\n", " dom_1.empty(this.el); // XXX: this should be in super\n", " const { background } = this.model;\n", " this.el.style.backgroundColor = background != null ? background : \"\";\n", " dom_1.classes(this.el).clear().add(...this.css_classes());\n", " for (const child_view of this.child_views) {\n", " this.el.appendChild(child_view.el);\n", " child_view.render();\n", " }\n", " }\n", " update_layout() {\n", " for (const child_view of this.child_views)\n", " child_view.update_layout();\n", " this._update_layout();\n", " }\n", " update_position() {\n", " this.el.style.display = this.model.visible ? \"block\" : \"none\";\n", " const margin = this.is_root ? this.layout.sizing.margin : undefined;\n", " dom_1.position(this.el, this.layout.bbox, margin);\n", " for (const child_view of this.child_views)\n", " child_view.update_position();\n", " }\n", " after_layout() {\n", " for (const child_view of this.child_views)\n", " child_view.after_layout();\n", " this._has_finished = true;\n", " }\n", " compute_viewport() {\n", " this._viewport = this._viewport_size();\n", " }\n", " renderTo(element) {\n", " element.appendChild(this.el);\n", " this._offset_parent = this.el.offsetParent;\n", " this.compute_viewport();\n", " this.build();\n", " }\n", " build() {\n", " this.assert_root();\n", " this.render();\n", " this.update_layout();\n", " this.compute_layout();\n", " return this;\n", " }\n", " async rebuild() {\n", " await this.build_child_views();\n", " this.invalidate_render();\n", " }\n", " compute_layout() {\n", " const start = Date.now();\n", " this.layout.compute(this._viewport);\n", " this.update_position();\n", " this.after_layout();\n", " logging_1.logger.debug(`layout computed in ${Date.now() - start} ms`);\n", " this.notify_finished();\n", " }\n", " resize_layout() {\n", " this.root.compute_viewport();\n", " this.root.compute_layout();\n", " }\n", " invalidate_layout() {\n", " this.root.update_layout();\n", " this.root.compute_layout();\n", " }\n", " invalidate_render() {\n", " this.render();\n", " this.invalidate_layout();\n", " }\n", " has_finished() {\n", " if (!super.has_finished())\n", " return false;\n", " for (const child_view of this.child_views) {\n", " if (!child_view.has_finished())\n", " return false;\n", " }\n", " return true;\n", " }\n", " notify_finished() {\n", " if (!this.is_root)\n", " this.root.notify_finished();\n", " else {\n", " if (!this._idle_notified && this.has_finished()) {\n", " if (this.model.document != null) {\n", " this._idle_notified = true;\n", " this.model.document.notify_idle(this.model);\n", " }\n", " }\n", " }\n", " }\n", " _width_policy() {\n", " return this.model.width != null ? \"fixed\" : \"fit\";\n", " }\n", " _height_policy() {\n", " return this.model.height != null ? \"fixed\" : \"fit\";\n", " }\n", " box_sizing() {\n", " let { width_policy, height_policy, aspect_ratio } = this.model;\n", " if (width_policy == \"auto\")\n", " width_policy = this._width_policy();\n", " if (height_policy == \"auto\")\n", " height_policy = this._height_policy();\n", " const { sizing_mode } = this.model;\n", " if (sizing_mode != null) {\n", " if (sizing_mode == \"fixed\")\n", " width_policy = height_policy = \"fixed\";\n", " else if (sizing_mode == \"stretch_both\")\n", " width_policy = height_policy = \"max\";\n", " else if (sizing_mode == \"stretch_width\")\n", " width_policy = \"max\";\n", " else if (sizing_mode == \"stretch_height\")\n", " height_policy = \"max\";\n", " else {\n", " if (aspect_ratio == null)\n", " aspect_ratio = \"auto\";\n", " switch (sizing_mode) {\n", " case \"scale_width\":\n", " width_policy = \"max\";\n", " height_policy = \"min\";\n", " break;\n", " case \"scale_height\":\n", " width_policy = \"min\";\n", " height_policy = \"max\";\n", " break;\n", " case \"scale_both\":\n", " width_policy = \"max\";\n", " height_policy = \"max\";\n", " break;\n", " }\n", " }\n", " }\n", " const sizing = { width_policy, height_policy };\n", " const { min_width, min_height } = this.model;\n", " if (min_width != null)\n", " sizing.min_width = min_width;\n", " if (min_height != null)\n", " sizing.min_height = min_height;\n", " const { width, height } = this.model;\n", " if (width != null)\n", " sizing.width = width;\n", " if (height != null)\n", " sizing.height = height;\n", " const { max_width, max_height } = this.model;\n", " if (max_width != null)\n", " sizing.max_width = max_width;\n", " if (max_height != null)\n", " sizing.max_height = max_height;\n", " if (aspect_ratio == \"auto\" && width != null && height != null)\n", " sizing.aspect = width / height;\n", " else if (types_1.isNumber(aspect_ratio))\n", " sizing.aspect = aspect_ratio;\n", " const { margin } = this.model;\n", " if (margin != null) {\n", " if (types_1.isNumber(margin))\n", " sizing.margin = { top: margin, right: margin, bottom: margin, left: margin };\n", " else if (margin.length == 2) {\n", " const [vertical, horizontal] = margin;\n", " sizing.margin = { top: vertical, right: horizontal, bottom: vertical, left: horizontal };\n", " }\n", " else {\n", " const [top, right, bottom, left] = margin;\n", " sizing.margin = { top, right, bottom, left };\n", " }\n", " }\n", " sizing.visible = this.model.visible;\n", " const { align } = this.model;\n", " if (types_1.isArray(align))\n", " [sizing.halign, sizing.valign] = align;\n", " else\n", " sizing.halign = sizing.valign = align;\n", " return sizing;\n", " }\n", " _viewport_size() {\n", " return dom_1.undisplayed(this.el, () => {\n", " let measuring = this.el;\n", " while (measuring = measuring.parentElement) {\n", " // .bk-root element doesn't bring any value\n", " if (measuring.classList.contains(root_1.bk_root))\n", " continue;\n", " // we reached element, so use viewport size\n", " if (measuring == document.body) {\n", " const { margin: { left, right, top, bottom } } = dom_1.extents(document.body);\n", " const width = Math.ceil(document.documentElement.clientWidth - left - right);\n", " const height = Math.ceil(document.documentElement.clientHeight - top - bottom);\n", " return { width, height };\n", " }\n", " // stop on first element with sensible dimensions\n", " const { padding: { left, right, top, bottom } } = dom_1.extents(measuring);\n", " const { width, height } = measuring.getBoundingClientRect();\n", " const inner_width = Math.ceil(width - left - right);\n", " const inner_height = Math.ceil(height - top - bottom);\n", " if (inner_width > 0 || inner_height > 0)\n", " return {\n", " width: inner_width > 0 ? inner_width : undefined,\n", " height: inner_height > 0 ? inner_height : undefined,\n", " };\n", " }\n", " // this element is detached from DOM\n", " return {};\n", " });\n", " }\n", " serializable_state() {\n", " return Object.assign(Object.assign({}, super.serializable_state()), { bbox: this.layout.bbox.box, children: this.child_views.map((child) => child.serializable_state()) });\n", " }\n", " }\n", " exports.LayoutDOMView = LayoutDOMView;\n", " LayoutDOMView.__name__ = \"LayoutDOMView\";\n", " class LayoutDOM extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_LayoutDOM() {\n", " this.define({\n", " width: [p.Number, null],\n", " height: [p.Number, null],\n", " min_width: [p.Number, null],\n", " min_height: [p.Number, null],\n", " max_width: [p.Number, null],\n", " max_height: [p.Number, null],\n", " margin: [p.Any, [0, 0, 0, 0]],\n", " width_policy: [p.Any, \"auto\"],\n", " height_policy: [p.Any, \"auto\"],\n", " aspect_ratio: [p.Any, null],\n", " sizing_mode: [p.SizingMode, null],\n", " visible: [p.Boolean, true],\n", " disabled: [p.Boolean, false],\n", " align: [p.Any, \"start\"],\n", " background: [p.Color, null],\n", " css_classes: [p.Array, []],\n", " });\n", " }\n", " }\n", " exports.LayoutDOM = LayoutDOM;\n", " LayoutDOM.__name__ = \"LayoutDOM\";\n", " LayoutDOM.init_LayoutDOM();\n", " },\n", " /* styles/root.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.bk_root = \"bk-root\";\n", " },\n", " /* models/layouts/column.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const box_1 = require(244) /* ./box */;\n", " const grid_1 = require(192) /* ../../core/layout/grid */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class ColumnView extends box_1.BoxView {\n", " _update_layout() {\n", " const items = this.child_views.map((child) => child.layout);\n", " this.layout = new grid_1.Column(items);\n", " this.layout.rows = this.model.rows;\n", " this.layout.spacing = [this.model.spacing, 0];\n", " this.layout.set_sizing(this.box_sizing());\n", " }\n", " }\n", " exports.ColumnView = ColumnView;\n", " ColumnView.__name__ = \"ColumnView\";\n", " class Column extends box_1.Box {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Column() {\n", " this.prototype.default_view = ColumnView;\n", " this.define({\n", " rows: [p.Any, \"auto\"],\n", " });\n", " }\n", " }\n", " exports.Column = Column;\n", " Column.__name__ = \"Column\";\n", " Column.init_Column();\n", " },\n", " /* models/layouts/grid_box.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const layout_dom_1 = require(245) /* ./layout_dom */;\n", " const grid_1 = require(192) /* ../../core/layout/grid */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class GridBoxView extends layout_dom_1.LayoutDOMView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.children.change, () => this.rebuild());\n", " }\n", " get child_models() {\n", " return this.model.children.map(([child]) => child);\n", " }\n", " _update_layout() {\n", " this.layout = new grid_1.Grid();\n", " this.layout.rows = this.model.rows;\n", " this.layout.cols = this.model.cols;\n", " this.layout.spacing = this.model.spacing;\n", " for (const [child, row, col, row_span, col_span] of this.model.children) {\n", " const child_view = this._child_views.get(child);\n", " this.layout.items.push({ layout: child_view.layout, row, col, row_span, col_span });\n", " }\n", " this.layout.set_sizing(this.box_sizing());\n", " }\n", " }\n", " exports.GridBoxView = GridBoxView;\n", " GridBoxView.__name__ = \"GridBoxView\";\n", " class GridBox extends layout_dom_1.LayoutDOM {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_GridBox() {\n", " this.prototype.default_view = GridBoxView;\n", " this.define({\n", " children: [p.Array, []],\n", " rows: [p.Any, \"auto\"],\n", " cols: [p.Any, \"auto\"],\n", " spacing: [p.Any, 0],\n", " });\n", " }\n", " }\n", " exports.GridBox = GridBox;\n", " GridBox.__name__ = \"GridBox\";\n", " GridBox.init_GridBox();\n", " },\n", " /* models/layouts/html_box.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const layout_dom_1 = require(245) /* ../layouts/layout_dom */;\n", " const layout_1 = require(188) /* ../../core/layout */;\n", " class HTMLBoxView extends layout_dom_1.LayoutDOMView {\n", " get child_models() {\n", " return [];\n", " }\n", " _update_layout() {\n", " this.layout = new layout_1.ContentBox(this.el);\n", " this.layout.set_sizing(this.box_sizing());\n", " }\n", " }\n", " exports.HTMLBoxView = HTMLBoxView;\n", " HTMLBoxView.__name__ = \"HTMLBoxView\";\n", " class HTMLBox extends layout_dom_1.LayoutDOM {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " }\n", " exports.HTMLBox = HTMLBox;\n", " HTMLBox.__name__ = \"HTMLBox\";\n", " },\n", " /* models/layouts/row.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const box_1 = require(244) /* ./box */;\n", " const grid_1 = require(192) /* ../../core/layout/grid */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class RowView extends box_1.BoxView {\n", " _update_layout() {\n", " const items = this.child_views.map((child) => child.layout);\n", " this.layout = new grid_1.Row(items);\n", " this.layout.cols = this.model.cols;\n", " this.layout.spacing = [0, this.model.spacing];\n", " this.layout.set_sizing(this.box_sizing());\n", " }\n", " }\n", " exports.RowView = RowView;\n", " RowView.__name__ = \"RowView\";\n", " class Row extends box_1.Box {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Row() {\n", " this.prototype.default_view = RowView;\n", " this.define({\n", " cols: [p.Any, \"auto\"],\n", " });\n", " }\n", " }\n", " exports.Row = Row;\n", " Row.__name__ = \"Row\";\n", " Row.init_Row();\n", " },\n", " /* models/layouts/spacer.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const layout_dom_1 = require(245) /* ./layout_dom */;\n", " const layout_1 = require(188) /* ../../core/layout */;\n", " class SpacerView extends layout_dom_1.LayoutDOMView {\n", " get child_models() {\n", " return [];\n", " }\n", " _update_layout() {\n", " this.layout = new layout_1.LayoutItem();\n", " this.layout.set_sizing(this.box_sizing());\n", " }\n", " }\n", " exports.SpacerView = SpacerView;\n", " SpacerView.__name__ = \"SpacerView\";\n", " class Spacer extends layout_dom_1.LayoutDOM {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Spacer() {\n", " this.prototype.default_view = SpacerView;\n", " }\n", " }\n", " exports.Spacer = Spacer;\n", " Spacer.__name__ = \"Spacer\";\n", " Spacer.init_Spacer();\n", " },\n", " /* models/layouts/tabs.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const layout_1 = require(188) /* ../../core/layout */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const layout_dom_1 = require(245) /* ./layout_dom */;\n", " const model_1 = require(71) /* ../../model */;\n", " const mixins_1 = require(146) /* ../../styles/mixins */;\n", " const tabs_1 = require(253) /* ../../styles/tabs */;\n", " const buttons_1 = require(254) /* ../../styles/buttons */;\n", " const menus_1 = require(255) /* ../../styles/menus */;\n", " const buttons_css_1 = tslib_1.__importDefault(require(256) /* ../../styles/buttons.css */);\n", " const menus_css_1 = tslib_1.__importDefault(require(257) /* ../../styles/menus.css */);\n", " const tabs_css_1 = tslib_1.__importDefault(require(258) /* ../../styles/tabs.css */);\n", " class TabsView extends layout_dom_1.LayoutDOMView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.tabs.change, () => this.rebuild());\n", " this.connect(this.model.properties.active.change, () => this.on_active_change());\n", " }\n", " styles() {\n", " return [...super.styles(), buttons_css_1.default, menus_css_1.default, tabs_css_1.default];\n", " }\n", " get child_models() {\n", " return this.model.tabs.map((tab) => tab.child);\n", " }\n", " _update_layout() {\n", " const loc = this.model.tabs_location;\n", " const vertical = loc == \"above\" || loc == \"below\";\n", " // XXX: this is a hack, this should be handled by \"fit\" policy in grid layout\n", " const { scroll_el, headers_el } = this;\n", " this.header = new class extends layout_1.ContentBox {\n", " _measure(viewport) {\n", " const min_headers = 3;\n", " const scroll = dom_1.size(scroll_el);\n", " const headers = dom_1.children(headers_el).slice(0, min_headers).map((el) => dom_1.size(el));\n", " const { width, height } = super._measure(viewport);\n", " if (vertical) {\n", " const min_width = scroll.width + array_1.sum(headers.map((size) => size.width));\n", " return { width: viewport.width != Infinity ? viewport.width : min_width, height };\n", " }\n", " else {\n", " const min_height = scroll.height + array_1.sum(headers.map((size) => size.height));\n", " return { width, height: viewport.height != Infinity ? viewport.height : min_height };\n", " }\n", " }\n", " }(this.header_el);\n", " if (vertical)\n", " this.header.set_sizing({ width_policy: \"fit\", height_policy: \"fixed\" });\n", " else\n", " this.header.set_sizing({ width_policy: \"fixed\", height_policy: \"fit\" });\n", " let row = 1;\n", " let col = 1;\n", " switch (loc) {\n", " case \"above\":\n", " row -= 1;\n", " break;\n", " case \"below\":\n", " row += 1;\n", " break;\n", " case \"left\":\n", " col -= 1;\n", " break;\n", " case \"right\":\n", " col += 1;\n", " break;\n", " }\n", " const header = { layout: this.header, row, col };\n", " const panels = this.child_views.map((child_view) => {\n", " return { layout: child_view.layout, row: 1, col: 1 };\n", " });\n", " this.layout = new layout_1.Grid([header, ...panels]);\n", " this.layout.set_sizing(this.box_sizing());\n", " }\n", " update_position() {\n", " super.update_position();\n", " this.header_el.style.position = \"absolute\"; // XXX: do it in position()\n", " dom_1.position(this.header_el, this.header.bbox);\n", " const loc = this.model.tabs_location;\n", " const vertical = loc == \"above\" || loc == \"below\";\n", " const scroll_el_size = dom_1.size(this.scroll_el);\n", " const headers_el_size = dom_1.scroll_size(this.headers_el);\n", " if (vertical) {\n", " const { width } = this.header.bbox;\n", " if (headers_el_size.width > width) {\n", " this.wrapper_el.style.maxWidth = `${width - scroll_el_size.width}px`;\n", " dom_1.display(this.scroll_el);\n", " }\n", " else {\n", " this.wrapper_el.style.maxWidth = \"\";\n", " dom_1.undisplay(this.scroll_el);\n", " }\n", " }\n", " else {\n", " const { height } = this.header.bbox;\n", " if (headers_el_size.height > height) {\n", " this.wrapper_el.style.maxHeight = `${height - scroll_el_size.height}px`;\n", " dom_1.display(this.scroll_el);\n", " }\n", " else {\n", " this.wrapper_el.style.maxHeight = \"\";\n", " dom_1.undisplay(this.scroll_el);\n", " }\n", " }\n", " const { child_views } = this;\n", " for (const child_view of child_views)\n", " dom_1.hide(child_view.el);\n", " const tab = child_views[this.model.active];\n", " if (tab != null)\n", " dom_1.show(tab.el);\n", " }\n", " render() {\n", " super.render();\n", " const { active } = this.model;\n", " const loc = this.model.tabs_location;\n", " const vertical = loc == \"above\" || loc == \"below\";\n", " const headers = this.model.tabs.map((tab, i) => {\n", " const el = dom_1.div({ class: [tabs_1.bk_tab, i == active ? mixins_1.bk_active : null] }, tab.title);\n", " el.addEventListener(\"click\", (event) => {\n", " if (event.target == event.currentTarget)\n", " this.change_active(i);\n", " });\n", " if (tab.closable) {\n", " const close_el = dom_1.div({ class: tabs_1.bk_close });\n", " close_el.addEventListener(\"click\", (event) => {\n", " if (event.target == event.currentTarget) {\n", " this.model.tabs = array_1.remove_at(this.model.tabs, i);\n", " const ntabs = this.model.tabs.length;\n", " if (this.model.active > ntabs - 1)\n", " this.model.active = ntabs - 1;\n", " }\n", " });\n", " el.appendChild(close_el);\n", " }\n", " return el;\n", " });\n", " this.headers_el = dom_1.div({ class: [tabs_1.bk_headers] }, headers);\n", " this.wrapper_el = dom_1.div({ class: tabs_1.bk_headers_wrapper }, this.headers_el);\n", " const left_el = dom_1.div({ class: [buttons_1.bk_btn, buttons_1.bk_btn_default], disabled: \"\" }, dom_1.div({ class: [menus_1.bk_caret, mixins_1.bk_left] }));\n", " const right_el = dom_1.div({ class: [buttons_1.bk_btn, buttons_1.bk_btn_default] }, dom_1.div({ class: [menus_1.bk_caret, mixins_1.bk_right] }));\n", " let scroll_index = 0;\n", " const do_scroll = (dir) => {\n", " return () => {\n", " const ntabs = this.model.tabs.length;\n", " if (dir == \"left\")\n", " scroll_index = Math.max(scroll_index - 1, 0);\n", " else\n", " scroll_index = Math.min(scroll_index + 1, ntabs - 1);\n", " if (scroll_index == 0)\n", " left_el.setAttribute(\"disabled\", \"\");\n", " else\n", " left_el.removeAttribute(\"disabled\");\n", " if (scroll_index == ntabs - 1)\n", " right_el.setAttribute(\"disabled\", \"\");\n", " else\n", " right_el.removeAttribute(\"disabled\");\n", " const sizes = dom_1.children(this.headers_el)\n", " .slice(0, scroll_index)\n", " .map((el) => el.getBoundingClientRect());\n", " if (vertical) {\n", " const left = -array_1.sum(sizes.map((size) => size.width));\n", " this.headers_el.style.left = `${left}px`;\n", " }\n", " else {\n", " const top = -array_1.sum(sizes.map((size) => size.height));\n", " this.headers_el.style.top = `${top}px`;\n", " }\n", " };\n", " };\n", " left_el.addEventListener(\"click\", do_scroll(\"left\"));\n", " right_el.addEventListener(\"click\", do_scroll(\"right\"));\n", " this.scroll_el = dom_1.div({ class: buttons_1.bk_btn_group }, left_el, right_el);\n", " this.header_el = dom_1.div({ class: [tabs_1.bk_tabs_header, mixins_1.bk_side(loc)] }, this.scroll_el, this.wrapper_el);\n", " this.el.appendChild(this.header_el);\n", " }\n", " change_active(i) {\n", " if (i != this.model.active) {\n", " this.model.active = i;\n", " }\n", " }\n", " on_active_change() {\n", " const i = this.model.active;\n", " const headers = dom_1.children(this.headers_el);\n", " for (const el of headers)\n", " el.classList.remove(mixins_1.bk_active);\n", " headers[i].classList.add(mixins_1.bk_active);\n", " const { child_views } = this;\n", " for (const child_view of child_views)\n", " dom_1.hide(child_view.el);\n", " dom_1.show(child_views[i].el);\n", " }\n", " }\n", " exports.TabsView = TabsView;\n", " TabsView.__name__ = \"TabsView\";\n", " class Tabs extends layout_dom_1.LayoutDOM {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Tabs() {\n", " this.prototype.default_view = TabsView;\n", " this.define({\n", " tabs: [p.Array, []],\n", " tabs_location: [p.Location, \"above\"],\n", " active: [p.Number, 0],\n", " });\n", " }\n", " }\n", " exports.Tabs = Tabs;\n", " Tabs.__name__ = \"Tabs\";\n", " Tabs.init_Tabs();\n", " class Panel extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Panel() {\n", " this.define({\n", " title: [p.String, \"\"],\n", " child: [p.Instance],\n", " closable: [p.Boolean, false],\n", " });\n", " }\n", " }\n", " exports.Panel = Panel;\n", " Panel.__name__ = \"Panel\";\n", " Panel.init_Panel();\n", " },\n", " /* styles/tabs.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.bk_tabs_header = \"bk-tabs-header\";\n", " exports.bk_headers_wrapper = \"bk-headers-wrapper\";\n", " exports.bk_headers = \"bk-headers\";\n", " exports.bk_tab = \"bk-tab\";\n", " exports.bk_close = \"bk-close\";\n", " },\n", " /* styles/buttons.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.bk_btn = \"bk-btn\";\n", " exports.bk_btn_group = \"bk-btn-group\";\n", " exports.bk_btn_default = \"bk-btn-default\";\n", " exports.bk_btn_primary = \"bk-btn-primary\";\n", " exports.bk_btn_success = \"bk-btn-success\";\n", " exports.bk_btn_warning = \"bk-btn-warning\";\n", " exports.bk_btn_danger = \"bk-btn-danger\";\n", " function bk_btn_type(button_type) {\n", " switch (button_type) {\n", " case \"default\": return exports.bk_btn_default;\n", " case \"primary\": return exports.bk_btn_primary;\n", " case \"success\": return exports.bk_btn_success;\n", " case \"warning\": return exports.bk_btn_warning;\n", " case \"danger\": return exports.bk_btn_danger;\n", " }\n", " }\n", " exports.bk_btn_type = bk_btn_type;\n", " exports.bk_dropdown_toggle = \"bk-dropdown-toggle\";\n", " },\n", " /* styles/menus.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.bk_menu = \"bk-menu\";\n", " exports.bk_caret = \"bk-caret\";\n", " exports.bk_divider = \"bk-divider\";\n", " },\n", " /* styles/buttons.css.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const css = `\n", " .bk-root .bk-btn {\n", " height: 100%;\n", " display: inline-block;\n", " text-align: center;\n", " vertical-align: middle;\n", " white-space: nowrap;\n", " cursor: pointer;\n", " padding: 6px 12px;\n", " font-size: 12px;\n", " border: 1px solid transparent;\n", " border-radius: 4px;\n", " outline: 0;\n", " user-select: none;\n", " -ms-user-select: none;\n", " -moz-user-select: none;\n", " -webkit-user-select: none;\n", " }\n", " .bk-root .bk-btn:hover,\n", " .bk-root .bk-btn:focus {\n", " text-decoration: none;\n", " }\n", " .bk-root .bk-btn:active,\n", " .bk-root .bk-btn.bk-active {\n", " background-image: none;\n", " box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);\n", " }\n", " .bk-root .bk-btn[disabled] {\n", " cursor: not-allowed;\n", " pointer-events: none;\n", " opacity: 0.65;\n", " box-shadow: none;\n", " }\n", " .bk-root .bk-btn-default {\n", " color: #333;\n", " background-color: #fff;\n", " border-color: #ccc;\n", " }\n", " .bk-root .bk-btn-default:hover {\n", " background-color: #f5f5f5;\n", " border-color: #b8b8b8;\n", " }\n", " .bk-root .bk-btn-default.bk-active {\n", " background-color: #ebebeb;\n", " border-color: #adadad;\n", " }\n", " .bk-root .bk-btn-default[disabled],\n", " .bk-root .bk-btn-default[disabled]:hover,\n", " .bk-root .bk-btn-default[disabled]:focus,\n", " .bk-root .bk-btn-default[disabled]:active,\n", " .bk-root .bk-btn-default[disabled].bk-active {\n", " background-color: #e6e6e6;\n", " border-color: #ccc;\n", " }\n", " .bk-root .bk-btn-primary {\n", " color: #fff;\n", " background-color: #428bca;\n", " border-color: #357ebd;\n", " }\n", " .bk-root .bk-btn-primary:hover {\n", " background-color: #3681c1;\n", " border-color: #2c699e;\n", " }\n", " .bk-root .bk-btn-primary.bk-active {\n", " background-color: #3276b1;\n", " border-color: #285e8e;\n", " }\n", " .bk-root .bk-btn-primary[disabled],\n", " .bk-root .bk-btn-primary[disabled]:hover,\n", " .bk-root .bk-btn-primary[disabled]:focus,\n", " .bk-root .bk-btn-primary[disabled]:active,\n", " .bk-root .bk-btn-primary[disabled].bk-active {\n", " background-color: #506f89;\n", " border-color: #357ebd;\n", " }\n", " .bk-root .bk-btn-success {\n", " color: #fff;\n", " background-color: #5cb85c;\n", " border-color: #4cae4c;\n", " }\n", " .bk-root .bk-btn-success:hover {\n", " background-color: #4eb24e;\n", " border-color: #409240;\n", " }\n", " .bk-root .bk-btn-success.bk-active {\n", " background-color: #47a447;\n", " border-color: #398439;\n", " }\n", " .bk-root .bk-btn-success[disabled],\n", " .bk-root .bk-btn-success[disabled]:hover,\n", " .bk-root .bk-btn-success[disabled]:focus,\n", " .bk-root .bk-btn-success[disabled]:active,\n", " .bk-root .bk-btn-success[disabled].bk-active {\n", " background-color: #667b66;\n", " border-color: #4cae4c;\n", " }\n", " .bk-root .bk-btn-warning {\n", " color: #fff;\n", " background-color: #f0ad4e;\n", " border-color: #eea236;\n", " }\n", " .bk-root .bk-btn-warning:hover {\n", " background-color: #eea43b;\n", " border-color: #e89014;\n", " }\n", " .bk-root .bk-btn-warning.bk-active {\n", " background-color: #ed9c28;\n", " border-color: #d58512;\n", " }\n", " .bk-root .bk-btn-warning[disabled],\n", " .bk-root .bk-btn-warning[disabled]:hover,\n", " .bk-root .bk-btn-warning[disabled]:focus,\n", " .bk-root .bk-btn-warning[disabled]:active,\n", " .bk-root .bk-btn-warning[disabled].bk-active {\n", " background-color: #c89143;\n", " border-color: #eea236;\n", " }\n", " .bk-root .bk-btn-danger {\n", " color: #fff;\n", " background-color: #d9534f;\n", " border-color: #d43f3a;\n", " }\n", " .bk-root .bk-btn-danger:hover {\n", " background-color: #d5433e;\n", " border-color: #bd2d29;\n", " }\n", " .bk-root .bk-btn-danger.bk-active {\n", " background-color: #d2322d;\n", " border-color: #ac2925;\n", " }\n", " .bk-root .bk-btn-danger[disabled],\n", " .bk-root .bk-btn-danger[disabled]:hover,\n", " .bk-root .bk-btn-danger[disabled]:focus,\n", " .bk-root .bk-btn-danger[disabled]:active,\n", " .bk-root .bk-btn-danger[disabled].bk-active {\n", " background-color: #a55350;\n", " border-color: #d43f3a;\n", " }\n", " .bk-root .bk-btn-group {\n", " height: 100%;\n", " display: flex;\n", " display: -webkit-flex;\n", " flex-wrap: nowrap;\n", " -webkit-flex-wrap: nowrap;\n", " align-items: center;\n", " -webkit-align-items: center;\n", " flex-direction: row;\n", " -webkit-flex-direction: row;\n", " }\n", " .bk-root .bk-btn-group > .bk-btn {\n", " flex-grow: 1;\n", " -webkit-flex-grow: 1;\n", " }\n", " .bk-root .bk-btn-group > .bk-btn + .bk-btn {\n", " margin-left: -1px;\n", " }\n", " .bk-root .bk-btn-group > .bk-btn:first-child:not(:last-child) {\n", " border-bottom-right-radius: 0;\n", " border-top-right-radius: 0;\n", " }\n", " .bk-root .bk-btn-group > .bk-btn:not(:first-child):last-child {\n", " border-bottom-left-radius: 0;\n", " border-top-left-radius: 0;\n", " }\n", " .bk-root .bk-btn-group > .bk-btn:not(:first-child):not(:last-child) {\n", " border-radius: 0;\n", " }\n", " .bk-root .bk-btn-group .bk-dropdown-toggle {\n", " flex: 0 0 0;\n", " -webkit-flex: 0 0 0;\n", " padding: 6px 6px;\n", " }\n", " `;\n", " exports.default = css;\n", " },\n", " /* styles/menus.css.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const css = `\n", " .bk-root .bk-menu-icon {\n", " width: 28px;\n", " height: 28px;\n", " background-size: 60%;\n", " background-color: transparent;\n", " background-repeat: no-repeat;\n", " background-position: center center;\n", " }\n", " .bk-root .bk-context-menu {\n", " position: absolute;\n", " display: inline-flex;\n", " display: -webkit-inline-flex;\n", " flex-wrap: nowrap;\n", " -webkit-flex-wrap: nowrap;\n", " user-select: none;\n", " -ms-user-select: none;\n", " -moz-user-select: none;\n", " -webkit-user-select: none;\n", " width: auto;\n", " height: auto;\n", " z-index: 100;\n", " cursor: pointer;\n", " font-size: 12px;\n", " background-color: #fff;\n", " border: 1px solid #ccc;\n", " border-radius: 4px;\n", " box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);\n", " }\n", " .bk-root .bk-context-menu.bk-horizontal {\n", " flex-direction: row;\n", " -webkit-flex-direction: row;\n", " }\n", " .bk-root .bk-context-menu.bk-vertical {\n", " flex-direction: column;\n", " -webkit-flex-direction: column;\n", " }\n", " .bk-root .bk-context-menu > .bk-divider {\n", " cursor: default;\n", " overflow: hidden;\n", " background-color: #e5e5e5;\n", " }\n", " .bk-root .bk-context-menu.bk-horizontal > .bk-divider {\n", " width: 1px;\n", " margin: 5px 0;\n", " }\n", " .bk-root .bk-context-menu.bk-vertical > .bk-divider {\n", " height: 1px;\n", " margin: 0 5px;\n", " }\n", " .bk-root .bk-context-menu > :not(.bk-divider) {\n", " border: 1px solid transparent;\n", " }\n", " .bk-root .bk-context-menu > :not(.bk-divider).bk-active {\n", " border-color: #26aae1;\n", " }\n", " .bk-root .bk-context-menu > :not(.bk-divider):hover {\n", " background-color: #f9f9f9;\n", " }\n", " .bk-root .bk-context-menu.bk-horizontal > :not(.bk-divider):first-child {\n", " border-top-left-radius: 4px;\n", " border-bottom-left-radius: 4px;\n", " }\n", " .bk-root .bk-context-menu.bk-horizontal > :not(.bk-divider):last-child {\n", " border-top-right-radius: 4px;\n", " border-bottom-right-radius: 4px;\n", " }\n", " .bk-root .bk-context-menu.bk-vertical > :not(.bk-divider):first-child {\n", " border-top-left-radius: 4px;\n", " border-top-right-radius: 4px;\n", " }\n", " .bk-root .bk-context-menu.bk-vertical > :not(.bk-divider):last-child {\n", " border-bottom-left-radius: 4px;\n", " border-bottom-right-radius: 4px;\n", " }\n", " .bk-root .bk-menu {\n", " position: absolute;\n", " left: 0;\n", " width: 100%;\n", " z-index: 100;\n", " cursor: pointer;\n", " font-size: 12px;\n", " background-color: #fff;\n", " border: 1px solid #ccc;\n", " border-radius: 4px;\n", " box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);\n", " }\n", " .bk-root .bk-menu.bk-above {\n", " bottom: 100%;\n", " }\n", " .bk-root .bk-menu.bk-below {\n", " top: 100%;\n", " }\n", " .bk-root .bk-menu > .bk-divider {\n", " height: 1px;\n", " margin: 7.5px 0;\n", " overflow: hidden;\n", " background-color: #e5e5e5;\n", " }\n", " .bk-root .bk-menu > :not(.bk-divider) {\n", " padding: 6px 12px;\n", " }\n", " .bk-root .bk-menu > :not(.bk-divider):hover,\n", " .bk-root .bk-menu > :not(.bk-divider).bk-active {\n", " background-color: #e6e6e6;\n", " }\n", " .bk-root .bk-caret {\n", " display: inline-block;\n", " vertical-align: middle;\n", " width: 0;\n", " height: 0;\n", " margin: 0 5px;\n", " }\n", " .bk-root .bk-caret.bk-down {\n", " border-top: 4px solid;\n", " }\n", " .bk-root .bk-caret.bk-up {\n", " border-bottom: 4px solid;\n", " }\n", " .bk-root .bk-caret.bk-down,\n", " .bk-root .bk-caret.bk-up {\n", " border-right: 4px solid transparent;\n", " border-left: 4px solid transparent;\n", " }\n", " .bk-root .bk-caret.bk-left {\n", " border-right: 4px solid;\n", " }\n", " .bk-root .bk-caret.bk-right {\n", " border-left: 4px solid;\n", " }\n", " .bk-root .bk-caret.bk-left,\n", " .bk-root .bk-caret.bk-right {\n", " border-top: 4px solid transparent;\n", " border-bottom: 4px solid transparent;\n", " }\n", " `;\n", " exports.default = css;\n", " },\n", " /* styles/tabs.css.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const css = `\n", " .bk-root .bk-tabs-header {\n", " display: flex;\n", " display: -webkit-flex;\n", " flex-wrap: nowrap;\n", " -webkit-flex-wrap: nowrap;\n", " align-items: center;\n", " -webkit-align-items: center;\n", " overflow: hidden;\n", " user-select: none;\n", " -ms-user-select: none;\n", " -moz-user-select: none;\n", " -webkit-user-select: none;\n", " }\n", " .bk-root .bk-tabs-header .bk-btn-group {\n", " height: auto;\n", " margin-right: 5px;\n", " }\n", " .bk-root .bk-tabs-header .bk-btn-group > .bk-btn {\n", " flex-grow: 0;\n", " -webkit-flex-grow: 0;\n", " height: auto;\n", " padding: 4px 4px;\n", " }\n", " .bk-root .bk-tabs-header .bk-headers-wrapper {\n", " flex-grow: 1;\n", " -webkit-flex-grow: 1;\n", " overflow: hidden;\n", " color: #666666;\n", " }\n", " .bk-root .bk-tabs-header.bk-above .bk-headers-wrapper {\n", " border-bottom: 1px solid #e6e6e6;\n", " }\n", " .bk-root .bk-tabs-header.bk-right .bk-headers-wrapper {\n", " border-left: 1px solid #e6e6e6;\n", " }\n", " .bk-root .bk-tabs-header.bk-below .bk-headers-wrapper {\n", " border-top: 1px solid #e6e6e6;\n", " }\n", " .bk-root .bk-tabs-header.bk-left .bk-headers-wrapper {\n", " border-right: 1px solid #e6e6e6;\n", " }\n", " .bk-root .bk-tabs-header.bk-above,\n", " .bk-root .bk-tabs-header.bk-below {\n", " flex-direction: row;\n", " -webkit-flex-direction: row;\n", " }\n", " .bk-root .bk-tabs-header.bk-above .bk-headers,\n", " .bk-root .bk-tabs-header.bk-below .bk-headers {\n", " flex-direction: row;\n", " -webkit-flex-direction: row;\n", " }\n", " .bk-root .bk-tabs-header.bk-left,\n", " .bk-root .bk-tabs-header.bk-right {\n", " flex-direction: column;\n", " -webkit-flex-direction: column;\n", " }\n", " .bk-root .bk-tabs-header.bk-left .bk-headers,\n", " .bk-root .bk-tabs-header.bk-right .bk-headers {\n", " flex-direction: column;\n", " -webkit-flex-direction: column;\n", " }\n", " .bk-root .bk-tabs-header .bk-headers {\n", " position: relative;\n", " display: flex;\n", " display: -webkit-flex;\n", " flex-wrap: nowrap;\n", " -webkit-flex-wrap: nowrap;\n", " align-items: center;\n", " -webkit-align-items: center;\n", " }\n", " .bk-root .bk-tabs-header .bk-tab {\n", " padding: 4px 8px;\n", " border: solid transparent;\n", " white-space: nowrap;\n", " cursor: pointer;\n", " }\n", " .bk-root .bk-tabs-header .bk-tab:hover {\n", " background-color: #f2f2f2;\n", " }\n", " .bk-root .bk-tabs-header .bk-tab.bk-active {\n", " color: #4d4d4d;\n", " background-color: white;\n", " border-color: #e6e6e6;\n", " }\n", " .bk-root .bk-tabs-header .bk-tab .bk-close {\n", " margin-left: 10px;\n", " }\n", " .bk-root .bk-tabs-header.bk-above .bk-tab {\n", " border-width: 3px 1px 0px 1px;\n", " border-radius: 4px 4px 0 0;\n", " }\n", " .bk-root .bk-tabs-header.bk-right .bk-tab {\n", " border-width: 1px 3px 1px 0px;\n", " border-radius: 0 4px 4px 0;\n", " }\n", " .bk-root .bk-tabs-header.bk-below .bk-tab {\n", " border-width: 0px 1px 3px 1px;\n", " border-radius: 0 0 4px 4px;\n", " }\n", " .bk-root .bk-tabs-header.bk-left .bk-tab {\n", " border-width: 1px 0px 1px 3px;\n", " border-radius: 4px 0 0 4px;\n", " }\n", " .bk-root .bk-close {\n", " display: inline-block;\n", " width: 10px;\n", " height: 10px;\n", " vertical-align: middle;\n", " background-image: url('data:image/svg+xml;utf8,\\\n", " \\\n", " \\\n", " \\\n", " ');\n", " }\n", " .bk-root .bk-close:hover {\n", " background-image: url('data:image/svg+xml;utf8,\\\n", " \\\n", " \\\n", " \\\n", " ');\n", " }\n", " `;\n", " exports.default = css;\n", " },\n", " /* models/layouts/widget_box.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const column_1 = require(247) /* ./column */;\n", " class WidgetBoxView extends column_1.ColumnView {\n", " }\n", " exports.WidgetBoxView = WidgetBoxView;\n", " WidgetBoxView.__name__ = \"WidgetBoxView\";\n", " class WidgetBox extends column_1.Column {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_WidgetBox() {\n", " this.prototype.default_view = WidgetBoxView;\n", " }\n", " }\n", " exports.WidgetBox = WidgetBox;\n", " WidgetBox.__name__ = \"WidgetBox\";\n", " WidgetBox.init_WidgetBox();\n", " },\n", " /* models/mappers/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var categorical_color_mapper_1 = require(261) /* ./categorical_color_mapper */;\n", " exports.CategoricalColorMapper = categorical_color_mapper_1.CategoricalColorMapper;\n", " var categorical_marker_mapper_1 = require(263) /* ./categorical_marker_mapper */;\n", " exports.CategoricalMarkerMapper = categorical_marker_mapper_1.CategoricalMarkerMapper;\n", " var categorical_pattern_mapper_1 = require(264) /* ./categorical_pattern_mapper */;\n", " exports.CategoricalPatternMapper = categorical_pattern_mapper_1.CategoricalPatternMapper;\n", " var continuous_color_mapper_1 = require(116) /* ./continuous_color_mapper */;\n", " exports.ContinuousColorMapper = continuous_color_mapper_1.ContinuousColorMapper;\n", " var color_mapper_1 = require(117) /* ./color_mapper */;\n", " exports.ColorMapper = color_mapper_1.ColorMapper;\n", " var linear_color_mapper_1 = require(115) /* ./linear_color_mapper */;\n", " exports.LinearColorMapper = linear_color_mapper_1.LinearColorMapper;\n", " var log_color_mapper_1 = require(265) /* ./log_color_mapper */;\n", " exports.LogColorMapper = log_color_mapper_1.LogColorMapper;\n", " },\n", " /* models/mappers/categorical_color_mapper.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const categorical_mapper_1 = require(262) /* ./categorical_mapper */;\n", " const color_mapper_1 = require(117) /* ./color_mapper */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class CategoricalColorMapper extends color_mapper_1.ColorMapper {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_CategoricalColorMapper() {\n", " this.define({\n", " factors: [p.Array],\n", " start: [p.Number, 0],\n", " end: [p.Number],\n", " });\n", " }\n", " _v_compute(data, values, palette, { nan_color }) {\n", " categorical_mapper_1.cat_v_compute(data, this.factors, palette, values, this.start, this.end, nan_color);\n", " }\n", " }\n", " exports.CategoricalColorMapper = CategoricalColorMapper;\n", " CategoricalColorMapper.__name__ = \"CategoricalColorMapper\";\n", " CategoricalColorMapper.init_CategoricalColorMapper();\n", " },\n", " /* models/mappers/categorical_mapper.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const arrayable_1 = require(12) /* ../../core/util/arrayable */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " function _cat_equals(a, b) {\n", " if (a.length != b.length)\n", " return false;\n", " for (let i = 0, end = a.length; i < end; i++) {\n", " if (a[i] !== b[i])\n", " return false;\n", " }\n", " return true;\n", " }\n", " exports._cat_equals = _cat_equals;\n", " function cat_v_compute(data, factors, targets, values, start, end, extra_value) {\n", " for (let i = 0, N = data.length; i < N; i++) {\n", " let d = data[i];\n", " let key;\n", " if (types_1.isString(d))\n", " key = arrayable_1.index_of(factors, d);\n", " else {\n", " if (start != null) {\n", " if (end != null)\n", " d = d.slice(start, end);\n", " else\n", " d = d.slice(start);\n", " }\n", " else if (end != null)\n", " d = d.slice(0, end);\n", " if (d.length == 1)\n", " key = arrayable_1.index_of(factors, d[0]);\n", " else\n", " key = arrayable_1.find_index(factors, (x) => _cat_equals(x, d));\n", " }\n", " let value;\n", " if (key < 0 || key >= targets.length)\n", " value = extra_value;\n", " else\n", " value = targets[key];\n", " values[i] = value;\n", " }\n", " }\n", " exports.cat_v_compute = cat_v_compute;\n", " },\n", " /* models/mappers/categorical_marker_mapper.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const categorical_mapper_1 = require(262) /* ./categorical_mapper */;\n", " const mapper_1 = require(118) /* ./mapper */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class CategoricalMarkerMapper extends mapper_1.Mapper {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_CategoricalMarkerMapper() {\n", " this.define({\n", " factors: [p.Array],\n", " markers: [p.Array],\n", " start: [p.Number, 0],\n", " end: [p.Number],\n", " default_value: [p.MarkerType, \"circle\"],\n", " });\n", " }\n", " v_compute(xs) {\n", " const values = new Array(xs.length);\n", " categorical_mapper_1.cat_v_compute(xs, this.factors, this.markers, values, this.start, this.end, this.default_value);\n", " return values;\n", " }\n", " }\n", " exports.CategoricalMarkerMapper = CategoricalMarkerMapper;\n", " CategoricalMarkerMapper.__name__ = \"CategoricalMarkerMapper\";\n", " CategoricalMarkerMapper.init_CategoricalMarkerMapper();\n", " },\n", " /* models/mappers/categorical_pattern_mapper.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const categorical_mapper_1 = require(262) /* ./categorical_mapper */;\n", " const mapper_1 = require(118) /* ./mapper */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class CategoricalPatternMapper extends mapper_1.Mapper {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_CategoricalPatternMapper() {\n", " this.define({\n", " factors: [p.Array],\n", " patterns: [p.Array],\n", " start: [p.Number, 0],\n", " end: [p.Number],\n", " default_value: [p.HatchPatternType, \" \"],\n", " });\n", " }\n", " v_compute(xs) {\n", " const values = new Array(xs.length);\n", " categorical_mapper_1.cat_v_compute(xs, this.factors, this.patterns, values, this.start, this.end, this.default_value);\n", " return values;\n", " }\n", " }\n", " exports.CategoricalPatternMapper = CategoricalPatternMapper;\n", " CategoricalPatternMapper.__name__ = \"CategoricalPatternMapper\";\n", " CategoricalPatternMapper.init_CategoricalPatternMapper();\n", " },\n", " /* models/mappers/log_color_mapper.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const continuous_color_mapper_1 = require(116) /* ./continuous_color_mapper */;\n", " const arrayable_1 = require(12) /* ../../core/util/arrayable */;\n", " class LogColorMapper extends continuous_color_mapper_1.ContinuousColorMapper {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " _v_compute(data, values, palette, colors) {\n", " const { nan_color, low_color, high_color } = colors;\n", " const n = palette.length;\n", " const low = this.low != null ? this.low : arrayable_1.min(data);\n", " const high = this.high != null ? this.high : arrayable_1.max(data);\n", " const scale = n / (Math.log(high) - Math.log(low)); // subtract the low offset\n", " const max_key = palette.length - 1;\n", " for (let i = 0, end = data.length; i < end; i++) {\n", " const d = data[i];\n", " // Check NaN\n", " if (isNaN(d)) {\n", " values[i] = nan_color;\n", " continue;\n", " }\n", " if (d > high) {\n", " values[i] = high_color != null ? high_color : palette[max_key];\n", " continue;\n", " }\n", " // This handles the edge case where d == high, since the code below maps\n", " // values exactly equal to high to palette.length, which is greater than\n", " // max_key\n", " if (d == high) {\n", " values[i] = palette[max_key];\n", " continue;\n", " }\n", " if (d < low) {\n", " values[i] = low_color != null ? low_color : palette[0];\n", " continue;\n", " }\n", " // Get the key\n", " const log = Math.log(d) - Math.log(low); // subtract the low offset\n", " let key = Math.floor(log * scale);\n", " // Deal with upper bound\n", " if (key > max_key)\n", " key = max_key;\n", " values[i] = palette[key];\n", " }\n", " }\n", " }\n", " exports.LogColorMapper = LogColorMapper;\n", " LogColorMapper.__name__ = \"LogColorMapper\";\n", " },\n", " /* models/markers/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " tslib_1.__exportStar(require(267) /* ./defs */, exports);\n", " var marker_1 = require(268) /* ./marker */;\n", " exports.Marker = marker_1.Marker;\n", " var scatter_1 = require(269) /* ./scatter */;\n", " exports.Scatter = scatter_1.Scatter;\n", " },\n", " /* models/markers/defs.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const marker_1 = require(268) /* ./marker */;\n", " const SQ3 = Math.sqrt(3);\n", " function _one_line(ctx, r) {\n", " ctx.moveTo(-r, 0);\n", " ctx.lineTo(r, 0);\n", " }\n", " function _one_x(ctx, r) {\n", " ctx.rotate(Math.PI / 4);\n", " _one_cross(ctx, r);\n", " ctx.rotate(-Math.PI / 4);\n", " }\n", " function _one_y(ctx, r) {\n", " const h = r * SQ3;\n", " const a = h / 3;\n", " ctx.moveTo(-h / 2, -a);\n", " ctx.lineTo(0, 0);\n", " ctx.lineTo(h / 2, -a);\n", " ctx.lineTo(0, 0);\n", " ctx.lineTo(0, r);\n", " }\n", " function _one_cross(ctx, r) {\n", " ctx.moveTo(0, r);\n", " ctx.lineTo(0, -r);\n", " ctx.moveTo(-r, 0);\n", " ctx.lineTo(r, 0);\n", " }\n", " function _one_dot(ctx, r) {\n", " ctx.beginPath();\n", " ctx.arc(0, 0, r / 4, 0, 2 * Math.PI, false);\n", " ctx.closePath();\n", " }\n", " function _one_diamond(ctx, r) {\n", " ctx.moveTo(0, r);\n", " ctx.lineTo(r / 1.5, 0);\n", " ctx.lineTo(0, -r);\n", " ctx.lineTo(-r / 1.5, 0);\n", " ctx.closePath();\n", " }\n", " function _one_hex(ctx, r) {\n", " const r2 = r / 2;\n", " const h = SQ3 * r2;\n", " ctx.moveTo(r, 0);\n", " ctx.lineTo(r2, -h);\n", " ctx.lineTo(-r2, -h);\n", " ctx.lineTo(-r, 0);\n", " ctx.lineTo(-r2, h);\n", " ctx.lineTo(r2, h);\n", " ctx.closePath();\n", " }\n", " function _one_tri(ctx, r) {\n", " const h = r * SQ3;\n", " const a = h / 3;\n", " ctx.moveTo(-r, a);\n", " ctx.lineTo(r, a);\n", " ctx.lineTo(0, a - h);\n", " ctx.closePath();\n", " }\n", " function asterisk(ctx, i, r, line, _fill) {\n", " _one_cross(ctx, r);\n", " _one_x(ctx, r);\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " function circle(ctx, i, r, line, fill) {\n", " ctx.arc(0, 0, r, 0, 2 * Math.PI, false);\n", " if (fill.doit) {\n", " fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " function circle_cross(ctx, i, r, line, fill) {\n", " ctx.arc(0, 0, r, 0, 2 * Math.PI, false);\n", " if (fill.doit) {\n", " fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " _one_cross(ctx, r);\n", " ctx.stroke();\n", " }\n", " }\n", " function circle_dot(ctx, i, r, line, fill) {\n", " circle(ctx, i, r, line, fill);\n", " dot(ctx, i, r, line, fill);\n", " }\n", " function circle_y(ctx, i, r, line, fill) {\n", " ctx.arc(0, 0, r, 0, 2 * Math.PI, false);\n", " if (fill.doit) {\n", " fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " _one_y(ctx, r);\n", " ctx.stroke();\n", " }\n", " }\n", " function circle_x(ctx, i, r, line, fill) {\n", " ctx.arc(0, 0, r, 0, 2 * Math.PI, false);\n", " if (fill.doit) {\n", " fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " _one_x(ctx, r);\n", " ctx.stroke();\n", " }\n", " }\n", " function cross(ctx, i, r, line, _fill) {\n", " _one_cross(ctx, r);\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " function diamond(ctx, i, r, line, fill) {\n", " _one_diamond(ctx, r);\n", " if (fill.doit) {\n", " fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " function diamond_cross(ctx, i, r, line, fill) {\n", " _one_diamond(ctx, r);\n", " if (fill.doit) {\n", " fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " ctx.moveTo(0, r);\n", " ctx.lineTo(0, -r);\n", " ctx.moveTo(-r / 1.5, 0);\n", " ctx.lineTo(r / 1.5, 0);\n", " ctx.stroke();\n", " }\n", " }\n", " function diamond_dot(ctx, i, r, line, fill) {\n", " diamond(ctx, i, r, line, fill);\n", " dot(ctx, i, r, line, fill);\n", " }\n", " function dot(ctx, i, r, line, _fill) {\n", " _one_dot(ctx, r);\n", " line.set_vectorize(ctx, i);\n", " ctx.fillStyle = ctx.strokeStyle; // NOTE: dots use line color for fill to match\n", " ctx.fill();\n", " }\n", " function hex(ctx, i, r, line, fill) {\n", " _one_hex(ctx, r);\n", " if (fill.doit) {\n", " fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " function hex_dot(ctx, i, r, line, fill) {\n", " hex(ctx, i, r, line, fill);\n", " dot(ctx, i, r, line, fill);\n", " }\n", " function inverted_triangle(ctx, i, r, line, fill) {\n", " ctx.rotate(Math.PI);\n", " _one_tri(ctx, r);\n", " ctx.rotate(-Math.PI);\n", " if (fill.doit) {\n", " fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " function plus(ctx, i, r, line, fill) {\n", " const a = 3 * r / 8;\n", " const b = r;\n", " const xs = [a, a, b, b, a, a, -a, -a, -b, -b, -a, -a];\n", " const ys = [b, a, a, -a, -a, -b, -b, -a, -a, a, a, b];\n", " ctx.moveTo(xs[0], ys[0]);\n", " for (i = 1; i < 12; i++)\n", " ctx.lineTo(xs[i], ys[i]);\n", " ctx.closePath();\n", " if (fill.doit) {\n", " fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " function square(ctx, i, r, line, fill) {\n", " const size = 2 * r;\n", " ctx.rect(-r, -r, size, size);\n", " if (fill.doit) {\n", " fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " function square_pin(ctx, i, r, line, fill) {\n", " const a = 3 * r / 8;\n", " ctx.moveTo(-r, -r);\n", " /* eslint-disable space-in-parens */\n", " ctx.quadraticCurveTo(0, -a, r, -r);\n", " ctx.quadraticCurveTo(a, 0, r, r);\n", " ctx.quadraticCurveTo(0, a, -r, r);\n", " ctx.quadraticCurveTo(-a, 0, -r, -r);\n", " /* eslint-ensable space-in-parens */\n", " ctx.closePath();\n", " if (fill.doit) {\n", " fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " function square_cross(ctx, i, r, line, fill) {\n", " const size = 2 * r;\n", " ctx.rect(-r, -r, size, size);\n", " if (fill.doit) {\n", " fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " _one_cross(ctx, r);\n", " ctx.stroke();\n", " }\n", " }\n", " function square_dot(ctx, i, r, line, fill) {\n", " square(ctx, i, r, line, fill);\n", " dot(ctx, i, r, line, fill);\n", " }\n", " function square_x(ctx, i, r, line, fill) {\n", " const size = 2 * r;\n", " ctx.rect(-r, -r, size, size);\n", " if (fill.doit) {\n", " fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " ctx.moveTo(-r, r);\n", " ctx.lineTo(r, -r);\n", " ctx.moveTo(-r, -r);\n", " ctx.lineTo(r, r);\n", " ctx.stroke();\n", " }\n", " }\n", " function triangle(ctx, i, r, line, fill) {\n", " _one_tri(ctx, r);\n", " if (fill.doit) {\n", " fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " function triangle_dot(ctx, i, r, line, fill) {\n", " triangle(ctx, i, r, line, fill);\n", " dot(ctx, i, r, line, fill);\n", " }\n", " function triangle_pin(ctx, i, r, line, fill) {\n", " const h = r * SQ3;\n", " const a = h / 3;\n", " const b = 3 * a / 8;\n", " ctx.moveTo(-r, a);\n", " ctx.quadraticCurveTo(0, b, r, a);\n", " ctx.quadraticCurveTo(SQ3 * b / 2, b / 2, 0, a - h);\n", " ctx.quadraticCurveTo(-SQ3 * b / 2, b / 2, -r, a);\n", " ctx.closePath();\n", " if (fill.doit) {\n", " fill.set_vectorize(ctx, i);\n", " ctx.fill();\n", " }\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " function dash(ctx, i, r, line, _fill) {\n", " _one_line(ctx, r);\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " function x(ctx, i, r, line, _fill) {\n", " _one_x(ctx, r);\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " function y(ctx, i, r, line, _fill) {\n", " _one_y(ctx, r);\n", " if (line.doit) {\n", " line.set_vectorize(ctx, i);\n", " ctx.stroke();\n", " }\n", " }\n", " function _mk_model(type, f) {\n", " var _a;\n", " const view = class extends marker_1.MarkerView {\n", " static initClass() {\n", " this.prototype._render_one = f;\n", " }\n", " };\n", " view.initClass();\n", " const model = (_a = class extends marker_1.Marker {\n", " static initClass() {\n", " this.prototype.default_view = view;\n", " }\n", " },\n", " _a.__name__ = type,\n", " _a);\n", " model.initClass();\n", " return model;\n", " }\n", " // markers are final, so no need to export views\n", " exports.Asterisk = _mk_model('Asterisk', asterisk);\n", " exports.CircleCross = _mk_model('CircleCross', circle_cross);\n", " exports.CircleDot = _mk_model('CircleDot', circle_dot);\n", " exports.CircleY = _mk_model('CircleY', circle_y);\n", " exports.CircleX = _mk_model('CircleX', circle_x);\n", " exports.Cross = _mk_model('Cross', cross);\n", " exports.Dash = _mk_model('Dash', dash);\n", " exports.Diamond = _mk_model('Diamond', diamond);\n", " exports.DiamondCross = _mk_model('DiamondCross', diamond_cross);\n", " exports.DiamondDot = _mk_model('DiamondDot', diamond_dot);\n", " exports.Dot = _mk_model('Dot', dot);\n", " exports.Hex = _mk_model('Hex', hex);\n", " exports.HexDot = _mk_model('HexDot', hex_dot);\n", " exports.InvertedTriangle = _mk_model('InvertedTriangle', inverted_triangle);\n", " exports.Plus = _mk_model('Plus', plus);\n", " exports.Square = _mk_model('Square', square);\n", " exports.SquareCross = _mk_model('SquareCross', square_cross);\n", " exports.SquareDot = _mk_model('SquareDot', square_dot);\n", " exports.SquarePin = _mk_model('SquarePin', square_pin);\n", " exports.SquareX = _mk_model('SquareX', square_x);\n", " exports.Triangle = _mk_model('Triangle', triangle);\n", " exports.TriangleDot = _mk_model('TriangleDot', triangle_dot);\n", " exports.TrianglePin = _mk_model('TrianglePin', triangle_pin);\n", " exports.X = _mk_model('X', x);\n", " exports.Y = _mk_model('Y', y);\n", " exports.marker_funcs = {\n", " asterisk,\n", " circle,\n", " circle_cross,\n", " circle_dot,\n", " circle_y,\n", " circle_x,\n", " cross,\n", " diamond,\n", " diamond_dot,\n", " diamond_cross,\n", " dot,\n", " hex,\n", " hex_dot,\n", " inverted_triangle,\n", " plus,\n", " square,\n", " square_cross,\n", " square_dot,\n", " square_pin,\n", " square_x,\n", " triangle,\n", " triangle_dot,\n", " triangle_pin,\n", " dash,\n", " x,\n", " y,\n", " };\n", " },\n", " /* models/markers/marker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const xy_glyph_1 = require(84) /* ../glyphs/xy_glyph */;\n", " const property_mixins_1 = require(23) /* ../../core/property_mixins */;\n", " const hittest = tslib_1.__importStar(require(93) /* ../../core/hittest */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const selection_1 = require(79) /* ../selections/selection */;\n", " class MarkerView extends xy_glyph_1.XYGlyphView {\n", " _render(ctx, indices, { sx, sy, _size, _angle }) {\n", " for (const i of indices) {\n", " if (isNaN(sx[i] + sy[i] + _size[i] + _angle[i]))\n", " continue;\n", " const r = _size[i] / 2;\n", " ctx.beginPath();\n", " ctx.translate(sx[i], sy[i]);\n", " if (_angle[i])\n", " ctx.rotate(_angle[i]);\n", " this._render_one(ctx, i, r, this.visuals.line, this.visuals.fill);\n", " if (_angle[i])\n", " ctx.rotate(-_angle[i]);\n", " ctx.translate(-sx[i], -sy[i]);\n", " }\n", " }\n", " _mask_data() {\n", " // dilate the inner screen region by max_size and map back to data space for use in\n", " // spatial query\n", " const hr = this.renderer.plot_view.frame.bbox.h_range;\n", " const sx0 = hr.start - this.max_size;\n", " const sx1 = hr.end + this.max_size;\n", " const [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " const vr = this.renderer.plot_view.frame.bbox.v_range;\n", " const sy0 = vr.start - this.max_size;\n", " const sy1 = vr.end + this.max_size;\n", " const [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " return this.index.indices({ x0, x1, y0, y1 });\n", " }\n", " _hit_point(geometry) {\n", " const { sx, sy } = geometry;\n", " const sx0 = sx - this.max_size;\n", " const sx1 = sx + this.max_size;\n", " const [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " const sy0 = sy - this.max_size;\n", " const sy1 = sy + this.max_size;\n", " const [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " const candidates = this.index.indices({ x0, x1, y0, y1 });\n", " const hits = [];\n", " for (const i of candidates) {\n", " const s2 = this._size[i] / 2;\n", " const dist = Math.abs(this.sx[i] - sx) + Math.abs(this.sy[i] - sy);\n", " if (Math.abs(this.sx[i] - sx) <= s2 && Math.abs(this.sy[i] - sy) <= s2) {\n", " hits.push([i, dist]);\n", " }\n", " }\n", " return selection_1.Selection.from_hits(hits);\n", " }\n", " _hit_span(geometry) {\n", " const { sx, sy } = geometry;\n", " const bounds = this.bounds();\n", " const ms = this.max_size / 2;\n", " let x0, x1, y0, y1;\n", " if (geometry.direction == 'h') {\n", " y0 = bounds.y0;\n", " y1 = bounds.y1;\n", " const sx0 = sx - ms;\n", " const sx1 = sx + ms;\n", " [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " }\n", " else {\n", " x0 = bounds.x0;\n", " x1 = bounds.x1;\n", " const sy0 = sy - ms;\n", " const sy1 = sy + ms;\n", " [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " }\n", " const indices = this.index.indices({ x0, x1, y0, y1 });\n", " return new selection_1.Selection({ indices });\n", " }\n", " _hit_rect(geometry) {\n", " const { sx0, sx1, sy0, sy1 } = geometry;\n", " const [x0, x1] = this.renderer.xscale.r_invert(sx0, sx1);\n", " const [y0, y1] = this.renderer.yscale.r_invert(sy0, sy1);\n", " const indices = this.index.indices({ x0, x1, y0, y1 });\n", " return new selection_1.Selection({ indices });\n", " }\n", " _hit_poly(geometry) {\n", " const { sx, sy } = geometry;\n", " // TODO (bev) use spatial index to pare candidate list\n", " const candidates = array_1.range(0, this.sx.length);\n", " const indices = [];\n", " for (let i = 0, end = candidates.length; i < end; i++) {\n", " const index = candidates[i];\n", " if (hittest.point_in_poly(this.sx[i], this.sy[i], sx, sy)) {\n", " indices.push(index);\n", " }\n", " }\n", " return new selection_1.Selection({ indices });\n", " }\n", " draw_legend_for_index(ctx, { x0, x1, y0, y1 }, index) {\n", " // using objects like this seems a little wonky, since the keys are coerced to\n", " // stings, but it works\n", " const len = index + 1;\n", " const sx = new Array(len);\n", " sx[index] = (x0 + x1) / 2;\n", " const sy = new Array(len);\n", " sy[index] = (y0 + y1) / 2;\n", " const size = new Array(len);\n", " size[index] = Math.min(Math.abs(x1 - x0), Math.abs(y1 - y0)) * 0.4;\n", " const angle = new Array(len);\n", " angle[index] = 0; // don't attempt to match glyph angle\n", " this._render(ctx, [index], { sx, sy, _size: size, _angle: angle }); // XXX\n", " }\n", " }\n", " exports.MarkerView = MarkerView;\n", " MarkerView.__name__ = \"MarkerView\";\n", " class Marker extends xy_glyph_1.XYGlyph {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Marker() {\n", " this.mixins([property_mixins_1.LineVector, property_mixins_1.FillVector]);\n", " this.define({\n", " size: [p.DistanceSpec, { units: \"screen\", value: 4 }],\n", " angle: [p.AngleSpec, 0],\n", " });\n", " }\n", " }\n", " exports.Marker = Marker;\n", " Marker.__name__ = \"Marker\";\n", " Marker.init_Marker();\n", " },\n", " /* models/markers/scatter.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const marker_1 = require(268) /* ./marker */;\n", " const defs_1 = require(267) /* ./defs */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class ScatterView extends marker_1.MarkerView {\n", " _render(ctx, indices, { sx, sy, _size, _angle, _marker }) {\n", " for (const i of indices) {\n", " if (isNaN(sx[i] + sy[i] + _size[i] + _angle[i]) || _marker[i] == null)\n", " continue;\n", " const r = _size[i] / 2;\n", " ctx.beginPath();\n", " ctx.translate(sx[i], sy[i]);\n", " if (_angle[i])\n", " ctx.rotate(_angle[i]);\n", " defs_1.marker_funcs[_marker[i]](ctx, i, r, this.visuals.line, this.visuals.fill);\n", " if (_angle[i])\n", " ctx.rotate(-_angle[i]);\n", " ctx.translate(-sx[i], -sy[i]);\n", " }\n", " }\n", " draw_legend_for_index(ctx, { x0, x1, y0, y1 }, index) {\n", " // using objects like this seems a little wonky, since the keys are coerced to\n", " // stings, but it works\n", " const len = index + 1;\n", " const sx = new Array(len);\n", " sx[index] = (x0 + x1) / 2;\n", " const sy = new Array(len);\n", " sy[index] = (y0 + y1) / 2;\n", " const size = new Array(len);\n", " size[index] = Math.min(Math.abs(x1 - x0), Math.abs(y1 - y0)) * 0.4;\n", " const angle = new Array(len);\n", " angle[index] = 0; // don't attempt to match glyph angle\n", " const marker = new Array(len);\n", " marker[index] = this._marker[index];\n", " this._render(ctx, [index], { sx, sy, _size: size, _angle: angle, _marker: marker }); // XXX\n", " }\n", " }\n", " exports.ScatterView = ScatterView;\n", " ScatterView.__name__ = \"ScatterView\";\n", " class Scatter extends marker_1.Marker {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Scatter() {\n", " this.prototype.default_view = ScatterView;\n", " this.define({\n", " marker: [p.MarkerSpec, { value: \"circle\" }],\n", " });\n", " }\n", " }\n", " exports.Scatter = Scatter;\n", " Scatter.__name__ = \"Scatter\";\n", " Scatter.init_Scatter();\n", " },\n", " /* models/plots/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var gmap_plot_1 = require(271) /* ./gmap_plot */;\n", " exports.MapOptions = gmap_plot_1.MapOptions;\n", " var gmap_plot_2 = require(271) /* ./gmap_plot */;\n", " exports.GMapOptions = gmap_plot_2.GMapOptions;\n", " var gmap_plot_3 = require(271) /* ./gmap_plot */;\n", " exports.GMapPlot = gmap_plot_3.GMapPlot;\n", " var plot_1 = require(272) /* ./plot */;\n", " exports.Plot = plot_1.Plot;\n", " },\n", " /* models/plots/gmap_plot.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const logging_1 = require(72) /* ../../core/logging */;\n", " const plot_1 = require(272) /* ./plot */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const model_1 = require(71) /* ../../model */;\n", " const range1d_1 = require(131) /* ../ranges/range1d */;\n", " const gmap_plot_canvas_1 = require(296) /* ./gmap_plot_canvas */;\n", " exports.GMapPlotView = gmap_plot_canvas_1.GMapPlotView;\n", " class MapOptions extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_MapOptions() {\n", " this.define({\n", " lat: [p.Number],\n", " lng: [p.Number],\n", " zoom: [p.Number, 12],\n", " });\n", " }\n", " }\n", " exports.MapOptions = MapOptions;\n", " MapOptions.__name__ = \"MapOptions\";\n", " MapOptions.init_MapOptions();\n", " class GMapOptions extends MapOptions {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_GMapOptions() {\n", " this.define({\n", " map_type: [p.String, \"roadmap\"],\n", " scale_control: [p.Boolean, false],\n", " styles: [p.String],\n", " tilt: [p.Int, 45],\n", " });\n", " }\n", " }\n", " exports.GMapOptions = GMapOptions;\n", " GMapOptions.__name__ = \"GMapOptions\";\n", " GMapOptions.init_GMapOptions();\n", " class GMapPlot extends plot_1.Plot {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_GMapPlot() {\n", " this.prototype.default_view = gmap_plot_canvas_1.GMapPlotView;\n", " // This seems to be necessary so that everything can initialize.\n", " // Feels very clumsy, but I'm not sure how the properties system wants\n", " // to handle something like this situation.\n", " this.define({\n", " map_options: [p.Instance],\n", " api_key: [p.String],\n", " });\n", " this.override({\n", " x_range: () => new range1d_1.Range1d(),\n", " y_range: () => new range1d_1.Range1d(),\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.use_map = true;\n", " if (!this.api_key)\n", " logging_1.logger.error(\"api_key is required. See https://developers.google.com/maps/documentation/javascript/get-api-key for more information on how to obtain your own.\");\n", " }\n", " }\n", " exports.GMapPlot = GMapPlot;\n", " GMapPlot.__name__ = \"GMapPlot\";\n", " GMapPlot.init_GMapPlot();\n", " },\n", " /* models/plots/plot.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const mixins = tslib_1.__importStar(require(23) /* ../../core/property_mixins */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const signaling_1 = require(14) /* ../../core/signaling */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const object_1 = require(17) /* ../../core/util/object */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const layout_dom_1 = require(245) /* ../layouts/layout_dom */;\n", " const title_1 = require(142) /* ../annotations/title */;\n", " const linear_scale_1 = require(120) /* ../scales/linear_scale */;\n", " const toolbar_1 = require(273) /* ../tools/toolbar */;\n", " const column_data_source_1 = require(76) /* ../sources/column_data_source */;\n", " const glyph_renderer_1 = require(81) /* ../renderers/glyph_renderer */;\n", " const data_range1d_1 = require(186) /* ../ranges/data_range1d */;\n", " const plot_canvas_1 = require(290) /* ./plot_canvas */;\n", " exports.PlotView = plot_canvas_1.PlotView;\n", " class Plot extends layout_dom_1.LayoutDOM {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Plot() {\n", " this.prototype.default_view = plot_canvas_1.PlotView;\n", " this.mixins([\n", " [\"outline_\", mixins.Line],\n", " [\"background_\", mixins.Fill],\n", " [\"border_\", mixins.Fill],\n", " ]);\n", " this.define({\n", " toolbar: [p.Instance, () => new toolbar_1.Toolbar()],\n", " toolbar_location: [p.Location, 'right'],\n", " toolbar_sticky: [p.Boolean, true],\n", " plot_width: [p.Number, 600],\n", " plot_height: [p.Number, 600],\n", " frame_width: [p.Number, null],\n", " frame_height: [p.Number, null],\n", " title: [p.Any, () => new title_1.Title({ text: \"\" })],\n", " title_location: [p.Location, 'above'],\n", " above: [p.Array, []],\n", " below: [p.Array, []],\n", " left: [p.Array, []],\n", " right: [p.Array, []],\n", " center: [p.Array, []],\n", " renderers: [p.Array, []],\n", " x_range: [p.Instance, () => new data_range1d_1.DataRange1d()],\n", " extra_x_ranges: [p.Any, {}],\n", " y_range: [p.Instance, () => new data_range1d_1.DataRange1d()],\n", " extra_y_ranges: [p.Any, {}],\n", " x_scale: [p.Instance, () => new linear_scale_1.LinearScale()],\n", " y_scale: [p.Instance, () => new linear_scale_1.LinearScale()],\n", " lod_factor: [p.Number, 10],\n", " lod_interval: [p.Number, 300],\n", " lod_threshold: [p.Number, 2000],\n", " lod_timeout: [p.Number, 500],\n", " hidpi: [p.Boolean, true],\n", " output_backend: [p.OutputBackend, \"canvas\"],\n", " min_border: [p.Number, 5],\n", " min_border_top: [p.Number, null],\n", " min_border_left: [p.Number, null],\n", " min_border_bottom: [p.Number, null],\n", " min_border_right: [p.Number, null],\n", " inner_width: [p.Number],\n", " inner_height: [p.Number],\n", " outer_width: [p.Number],\n", " outer_height: [p.Number],\n", " match_aspect: [p.Boolean, false],\n", " aspect_scale: [p.Number, 1],\n", " reset_policy: [p.ResetPolicy, \"standard\"],\n", " });\n", " this.override({\n", " outline_line_color: \"#e5e5e5\",\n", " border_fill_color: \"#ffffff\",\n", " background_fill_color: \"#ffffff\",\n", " });\n", " }\n", " // TODO: change this when we drop ES5 compatibility (https://github.com/microsoft/TypeScript/issues/338)\n", " get width() {\n", " // const width = super.width\n", " const width = this.properties.width.get_value();\n", " return width != null ? width : this.plot_width;\n", " }\n", " set width(width) {\n", " this.setv({ width, plot_width: width });\n", " }\n", " get height() {\n", " // const height = super.height\n", " const height = this.properties.height.get_value();\n", " return height != null ? height : this.plot_height;\n", " }\n", " set height(height) {\n", " this.setv({ height, plot_height: height });\n", " }\n", " _doc_attached() {\n", " super._doc_attached();\n", " this._push_changes([\n", " [this.properties.inner_height, null, this.inner_height],\n", " [this.properties.inner_width, null, this.inner_width],\n", " ]);\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.reset = new signaling_1.Signal0(this, \"reset\");\n", " for (const xr of object_1.values(this.extra_x_ranges).concat(this.x_range)) {\n", " let plots = xr.plots;\n", " if (types_1.isArray(plots)) {\n", " plots = plots.concat(this);\n", " xr.setv({ plots }, { silent: true });\n", " }\n", " }\n", " for (const yr of object_1.values(this.extra_y_ranges).concat(this.y_range)) {\n", " let plots = yr.plots;\n", " if (types_1.isArray(plots)) {\n", " plots = plots.concat(this);\n", " yr.setv({ plots }, { silent: true });\n", " }\n", " }\n", " }\n", " add_layout(renderer, side = \"center\") {\n", " const renderers = this.properties[side].get_value();\n", " this.setv({ [side]: [...renderers, renderer] });\n", " }\n", " remove_layout(renderer) {\n", " const del = (items) => {\n", " array_1.remove_by(items, (item) => item == renderer);\n", " };\n", " del(this.left);\n", " del(this.right);\n", " del(this.above);\n", " del(this.below);\n", " del(this.center);\n", " }\n", " add_renderers(...renderers) {\n", " this.renderers = this.renderers.concat(renderers);\n", " }\n", " add_glyph(glyph, source = new column_data_source_1.ColumnDataSource(), extra_attrs = {}) {\n", " const attrs = Object.assign(Object.assign({}, extra_attrs), { data_source: source, glyph });\n", " const renderer = new glyph_renderer_1.GlyphRenderer(attrs);\n", " this.add_renderers(renderer);\n", " return renderer;\n", " }\n", " add_tools(...tools) {\n", " this.toolbar.tools = this.toolbar.tools.concat(tools);\n", " }\n", " get panels() {\n", " return [...this.side_panels, ...this.center];\n", " }\n", " get side_panels() {\n", " const { above, below, left, right } = this;\n", " return array_1.concat([above, below, left, right]);\n", " }\n", " }\n", " exports.Plot = Plot;\n", " Plot.__name__ = \"Plot\";\n", " Plot.init_Plot();\n", " },\n", " /* models/tools/toolbar.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const inspect_tool_1 = require(274) /* ./inspectors/inspect_tool */;\n", " const toolbar_base_1 = require(283) /* ./toolbar_base */;\n", " const _get_active_attr = (et) => {\n", " switch (et) {\n", " case 'tap': return 'active_tap';\n", " case 'pan': return 'active_drag';\n", " case 'pinch':\n", " case 'scroll': return 'active_scroll';\n", " case 'multi': return 'active_multi';\n", " }\n", " return null;\n", " };\n", " const _supports_auto = (et) => {\n", " return et == 'tap' || et == 'pan';\n", " };\n", " class Toolbar extends toolbar_base_1.ToolbarBase {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Toolbar() {\n", " this.prototype.default_view = toolbar_base_1.ToolbarBaseView;\n", " this.define({\n", " active_drag: [p.Any, 'auto'],\n", " active_inspect: [p.Any, 'auto'],\n", " active_scroll: [p.Any, 'auto'],\n", " active_tap: [p.Any, 'auto'],\n", " active_multi: [p.Any, null],\n", " });\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " const { tools, active_drag, active_inspect, active_scroll, active_tap, active_multi } = this.properties;\n", " this.on_change([tools, active_drag, active_inspect, active_scroll, active_tap, active_multi], () => this._init_tools());\n", " }\n", " _init_tools() {\n", " super._init_tools();\n", " if (this.active_inspect == 'auto') {\n", " // do nothing as all tools are active be default\n", " }\n", " else if (this.active_inspect instanceof inspect_tool_1.InspectTool) {\n", " let found = false;\n", " for (const inspector of this.inspectors) {\n", " if (inspector != this.active_inspect)\n", " inspector.active = false;\n", " else\n", " found = true;\n", " }\n", " if (!found) {\n", " this.active_inspect = null;\n", " }\n", " }\n", " else if (types_1.isArray(this.active_inspect)) {\n", " const active_inspect = array_1.intersection(this.active_inspect, this.inspectors);\n", " if (active_inspect.length != this.active_inspect.length) {\n", " this.active_inspect = active_inspect;\n", " }\n", " for (const inspector of this.inspectors) {\n", " if (!array_1.includes(this.active_inspect, inspector))\n", " inspector.active = false;\n", " }\n", " }\n", " else if (this.active_inspect == null) {\n", " for (const inspector of this.inspectors)\n", " inspector.active = false;\n", " }\n", " const _activate_gesture = (tool) => {\n", " if (tool.active) {\n", " // tool was activated by a proxy, but we need to finish configuration manually\n", " this._active_change(tool);\n", " }\n", " else\n", " tool.active = true;\n", " };\n", " // Connecting signals has to be done before changing the active state of the tools.\n", " for (const et in this.gestures) {\n", " const gesture = this.gestures[et];\n", " gesture.tools = array_1.sort_by(gesture.tools, (tool) => tool.default_order);\n", " for (const tool of gesture.tools) {\n", " this.connect(tool.properties.active.change, () => this._active_change(tool));\n", " }\n", " }\n", " for (const et in this.gestures) {\n", " const active_attr = _get_active_attr(et);\n", " if (active_attr) {\n", " const active_tool = this[active_attr];\n", " if (active_tool == 'auto') {\n", " const gesture = this.gestures[et];\n", " if (gesture.tools.length != 0 && _supports_auto(et)) {\n", " _activate_gesture(gesture.tools[0]);\n", " }\n", " }\n", " else if (active_tool != null) {\n", " if (array_1.includes(this.tools, active_tool)) {\n", " _activate_gesture(active_tool);\n", " }\n", " else {\n", " this[active_attr] = null;\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " exports.Toolbar = Toolbar;\n", " Toolbar.__name__ = \"Toolbar\";\n", " Toolbar.init_Toolbar();\n", " },\n", " /* models/tools/inspectors/inspect_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const button_tool_1 = require(275) /* ../button_tool */;\n", " const on_off_button_1 = require(282) /* ../on_off_button */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " class InspectToolView extends button_tool_1.ButtonToolView {\n", " }\n", " exports.InspectToolView = InspectToolView;\n", " InspectToolView.__name__ = \"InspectToolView\";\n", " class InspectTool extends button_tool_1.ButtonTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.event_type = \"move\";\n", " }\n", " static init_InspectTool() {\n", " this.prototype.button_view = on_off_button_1.OnOffButtonView;\n", " this.define({\n", " toggleable: [p.Boolean, true],\n", " });\n", " this.override({\n", " active: true,\n", " });\n", " }\n", " }\n", " exports.InspectTool = InspectTool;\n", " InspectTool.__name__ = \"InspectTool\";\n", " InspectTool.init_InspectTool();\n", " },\n", " /* models/tools/button_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const hammerjs_1 = tslib_1.__importDefault(require(276) /* hammerjs */);\n", " const dom_view_1 = require(66) /* ../../core/dom_view */;\n", " const tool_1 = require(277) /* ./tool */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const string_1 = require(24) /* ../../core/util/string */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const toolbar_1 = require(278) /* ../../styles/toolbar */;\n", " const toolbar_css_1 = tslib_1.__importDefault(require(279) /* ../../styles/toolbar.css */);\n", " const icons_css_1 = tslib_1.__importDefault(require(280) /* ../../styles/icons.css */);\n", " const menus_css_1 = tslib_1.__importDefault(require(257) /* ../../styles/menus.css */);\n", " const menus_1 = require(281) /* ../../core/util/menus */;\n", " class ButtonToolButtonView extends dom_view_1.DOMView {\n", " initialize() {\n", " super.initialize();\n", " const items = this.model.menu;\n", " if (items != null) {\n", " const location = this.parent.model.toolbar_location;\n", " const reverse = location == \"left\" || location == \"above\";\n", " const orientation = this.parent.model.horizontal ? \"vertical\" : \"horizontal\";\n", " this._menu = new menus_1.ContextMenu(!reverse ? items : array_1.reversed(items), {\n", " orientation,\n", " prevent_hide: (event) => event.target == this.el,\n", " });\n", " }\n", " this._hammer = new hammerjs_1.default(this.el, {\n", " touchAction: \"auto\",\n", " inputClass: hammerjs_1.default.TouchMouseInput,\n", " });\n", " this.connect(this.model.change, () => this.render());\n", " this._hammer.on(\"tap\", (e) => {\n", " var _a;\n", " if ((_a = this._menu) === null || _a === void 0 ? void 0 : _a.is_open) {\n", " this._menu.hide();\n", " return;\n", " }\n", " if (e.target == this.el) {\n", " this._clicked();\n", " }\n", " });\n", " this._hammer.on(\"press\", () => this._pressed());\n", " }\n", " remove() {\n", " var _a;\n", " this._hammer.destroy();\n", " (_a = this._menu) === null || _a === void 0 ? void 0 : _a.remove();\n", " super.remove();\n", " }\n", " styles() {\n", " return [...super.styles(), toolbar_css_1.default, icons_css_1.default, menus_css_1.default];\n", " }\n", " css_classes() {\n", " return super.css_classes().concat(toolbar_1.bk_toolbar_button);\n", " }\n", " render() {\n", " dom_1.empty(this.el);\n", " const icon = this.model.computed_icon;\n", " if (types_1.isString(icon)) {\n", " if (string_1.startsWith(icon, \"data:image\"))\n", " this.el.style.backgroundImage = \"url('\" + icon + \"')\";\n", " else\n", " this.el.classList.add(icon);\n", " }\n", " this.el.title = this.model.tooltip;\n", " if (this._menu != null) {\n", " this.root.el.appendChild(this._menu.el);\n", " }\n", " }\n", " _pressed() {\n", " var _a;\n", " const { left, top, right, bottom } = this.el.getBoundingClientRect();\n", " const at = (() => {\n", " switch (this.parent.model.toolbar_location) {\n", " case \"right\":\n", " return { right: left, top };\n", " case \"left\":\n", " return { left: right, top };\n", " case \"above\":\n", " return { left, top: bottom };\n", " case \"below\":\n", " return { left, bottom: top };\n", " }\n", " })();\n", " (_a = this._menu) === null || _a === void 0 ? void 0 : _a.toggle(at);\n", " }\n", " }\n", " exports.ButtonToolButtonView = ButtonToolButtonView;\n", " ButtonToolButtonView.__name__ = \"ButtonToolButtonView\";\n", " class ButtonToolView extends tool_1.ToolView {\n", " }\n", " exports.ButtonToolView = ButtonToolView;\n", " ButtonToolView.__name__ = \"ButtonToolView\";\n", " class ButtonTool extends tool_1.Tool {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ButtonTool() {\n", " this.internal({\n", " disabled: [p.Boolean, false],\n", " });\n", " }\n", " get tooltip() {\n", " return this.tool_name;\n", " }\n", " get computed_icon() {\n", " return this.icon;\n", " }\n", " get menu() {\n", " return null;\n", " }\n", " }\n", " exports.ButtonTool = ButtonTool;\n", " ButtonTool.__name__ = \"ButtonTool\";\n", " ButtonTool.init_ButtonTool();\n", " },\n", " /* hammerjs/hammer.js */ function _(require, module, exports) {\n", " /*! Hammer.JS - v2.0.7 - 2016-04-22\n", " * http://hammerjs.github.io/\n", " *\n", " * Copyright (c) 2016 Jorik Tangelder;\n", " * Licensed under the MIT license */\n", " (function (window, document, exportName, undefined) {\n", " 'use strict';\n", " var VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];\n", " var TEST_ELEMENT = document.createElement('div');\n", " var TYPE_FUNCTION = 'function';\n", " var round = Math.round;\n", " var abs = Math.abs;\n", " var now = Date.now;\n", " /**\n", " * set a timeout with a given scope\n", " * @param {Function} fn\n", " * @param {Number} timeout\n", " * @param {Object} context\n", " * @returns {number}\n", " */\n", " function setTimeoutContext(fn, timeout, context) {\n", " return setTimeout(bindFn(fn, context), timeout);\n", " }\n", " /**\n", " * if the argument is an array, we want to execute the fn on each entry\n", " * if it aint an array we don't want to do a thing.\n", " * this is used by all the methods that accept a single and array argument.\n", " * @param {*|Array} arg\n", " * @param {String} fn\n", " * @param {Object} [context]\n", " * @returns {Boolean}\n", " */\n", " function invokeArrayArg(arg, fn, context) {\n", " if (Array.isArray(arg)) {\n", " each(arg, context[fn], context);\n", " return true;\n", " }\n", " return false;\n", " }\n", " /**\n", " * walk objects and arrays\n", " * @param {Object} obj\n", " * @param {Function} iterator\n", " * @param {Object} context\n", " */\n", " function each(obj, iterator, context) {\n", " var i;\n", " if (!obj) {\n", " return;\n", " }\n", " if (obj.forEach) {\n", " obj.forEach(iterator, context);\n", " }\n", " else if (obj.length !== undefined) {\n", " i = 0;\n", " while (i < obj.length) {\n", " iterator.call(context, obj[i], i, obj);\n", " i++;\n", " }\n", " }\n", " else {\n", " for (i in obj) {\n", " obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);\n", " }\n", " }\n", " }\n", " /**\n", " * wrap a method with a deprecation warning and stack trace\n", " * @param {Function} method\n", " * @param {String} name\n", " * @param {String} message\n", " * @returns {Function} A new function wrapping the supplied method.\n", " */\n", " function deprecate(method, name, message) {\n", " var deprecationMessage = 'DEPRECATED METHOD: ' + name + '\\n' + message + ' AT \\n';\n", " return function () {\n", " var e = new Error('get-stack-trace');\n", " var stack = e && e.stack ? e.stack.replace(/^[^\\(]+?[\\n$]/gm, '')\n", " .replace(/^\\s+at\\s+/gm, '')\n", " .replace(/^Object.\\s*\\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';\n", " var log = window.console && (window.console.warn || window.console.log);\n", " if (log) {\n", " log.call(window.console, deprecationMessage, stack);\n", " }\n", " return method.apply(this, arguments);\n", " };\n", " }\n", " /**\n", " * extend object.\n", " * means that properties in dest will be overwritten by the ones in src.\n", " * @param {Object} target\n", " * @param {...Object} objects_to_assign\n", " * @returns {Object} target\n", " */\n", " var assign;\n", " if (typeof Object.assign !== 'function') {\n", " assign = function assign(target) {\n", " if (target === undefined || target === null) {\n", " throw new TypeError('Cannot convert undefined or null to object');\n", " }\n", " var output = Object(target);\n", " for (var index = 1; index < arguments.length; index++) {\n", " var source = arguments[index];\n", " if (source !== undefined && source !== null) {\n", " for (var nextKey in source) {\n", " if (source.hasOwnProperty(nextKey)) {\n", " output[nextKey] = source[nextKey];\n", " }\n", " }\n", " }\n", " }\n", " return output;\n", " };\n", " }\n", " else {\n", " assign = Object.assign;\n", " }\n", " /**\n", " * extend object.\n", " * means that properties in dest will be overwritten by the ones in src.\n", " * @param {Object} dest\n", " * @param {Object} src\n", " * @param {Boolean} [merge=false]\n", " * @returns {Object} dest\n", " */\n", " var extend = deprecate(function extend(dest, src, merge) {\n", " var keys = Object.keys(src);\n", " var i = 0;\n", " while (i < keys.length) {\n", " if (!merge || (merge && dest[keys[i]] === undefined)) {\n", " dest[keys[i]] = src[keys[i]];\n", " }\n", " i++;\n", " }\n", " return dest;\n", " }, 'extend', 'Use `assign`.');\n", " /**\n", " * merge the values from src in the dest.\n", " * means that properties that exist in dest will not be overwritten by src\n", " * @param {Object} dest\n", " * @param {Object} src\n", " * @returns {Object} dest\n", " */\n", " var merge = deprecate(function merge(dest, src) {\n", " return extend(dest, src, true);\n", " }, 'merge', 'Use `assign`.');\n", " /**\n", " * simple class inheritance\n", " * @param {Function} child\n", " * @param {Function} base\n", " * @param {Object} [properties]\n", " */\n", " function inherit(child, base, properties) {\n", " var baseP = base.prototype, childP;\n", " childP = child.prototype = Object.create(baseP);\n", " childP.constructor = child;\n", " childP._super = baseP;\n", " if (properties) {\n", " assign(childP, properties);\n", " }\n", " }\n", " /**\n", " * simple function bind\n", " * @param {Function} fn\n", " * @param {Object} context\n", " * @returns {Function}\n", " */\n", " function bindFn(fn, context) {\n", " return function boundFn() {\n", " return fn.apply(context, arguments);\n", " };\n", " }\n", " /**\n", " * let a boolean value also be a function that must return a boolean\n", " * this first item in args will be used as the context\n", " * @param {Boolean|Function} val\n", " * @param {Array} [args]\n", " * @returns {Boolean}\n", " */\n", " function boolOrFn(val, args) {\n", " if (typeof val == TYPE_FUNCTION) {\n", " return val.apply(args ? args[0] || undefined : undefined, args);\n", " }\n", " return val;\n", " }\n", " /**\n", " * use the val2 when val1 is undefined\n", " * @param {*} val1\n", " * @param {*} val2\n", " * @returns {*}\n", " */\n", " function ifUndefined(val1, val2) {\n", " return (val1 === undefined) ? val2 : val1;\n", " }\n", " /**\n", " * addEventListener with multiple events at once\n", " * @param {EventTarget} target\n", " * @param {String} types\n", " * @param {Function} handler\n", " */\n", " function addEventListeners(target, types, handler) {\n", " each(splitStr(types), function (type) {\n", " target.addEventListener(type, handler, false);\n", " });\n", " }\n", " /**\n", " * removeEventListener with multiple events at once\n", " * @param {EventTarget} target\n", " * @param {String} types\n", " * @param {Function} handler\n", " */\n", " function removeEventListeners(target, types, handler) {\n", " each(splitStr(types), function (type) {\n", " target.removeEventListener(type, handler, false);\n", " });\n", " }\n", " /**\n", " * find if a node is in the given parent\n", " * @method hasParent\n", " * @param {HTMLElement} node\n", " * @param {HTMLElement} parent\n", " * @return {Boolean} found\n", " */\n", " function hasParent(node, parent) {\n", " while (node) {\n", " if (node == parent) {\n", " return true;\n", " }\n", " node = node.parentNode;\n", " }\n", " return false;\n", " }\n", " /**\n", " * small indexOf wrapper\n", " * @param {String} str\n", " * @param {String} find\n", " * @returns {Boolean} found\n", " */\n", " function inStr(str, find) {\n", " return str.indexOf(find) > -1;\n", " }\n", " /**\n", " * split string on whitespace\n", " * @param {String} str\n", " * @returns {Array} words\n", " */\n", " function splitStr(str) {\n", " return str.trim().split(/\\s+/g);\n", " }\n", " /**\n", " * find if a array contains the object using indexOf or a simple polyFill\n", " * @param {Array} src\n", " * @param {String} find\n", " * @param {String} [findByKey]\n", " * @return {Boolean|Number} false when not found, or the index\n", " */\n", " function inArray(src, find, findByKey) {\n", " if (src.indexOf && !findByKey) {\n", " return src.indexOf(find);\n", " }\n", " else {\n", " var i = 0;\n", " while (i < src.length) {\n", " if ((findByKey && src[i][findByKey] == find) || (!findByKey && src[i] === find)) {\n", " return i;\n", " }\n", " i++;\n", " }\n", " return -1;\n", " }\n", " }\n", " /**\n", " * convert array-like objects to real arrays\n", " * @param {Object} obj\n", " * @returns {Array}\n", " */\n", " function toArray(obj) {\n", " return Array.prototype.slice.call(obj, 0);\n", " }\n", " /**\n", " * unique array with objects based on a key (like 'id') or just by the array's value\n", " * @param {Array} src [{id:1},{id:2},{id:1}]\n", " * @param {String} [key]\n", " * @param {Boolean} [sort=False]\n", " * @returns {Array} [{id:1},{id:2}]\n", " */\n", " function uniqueArray(src, key, sort) {\n", " var results = [];\n", " var values = [];\n", " var i = 0;\n", " while (i < src.length) {\n", " var val = key ? src[i][key] : src[i];\n", " if (inArray(values, val) < 0) {\n", " results.push(src[i]);\n", " }\n", " values[i] = val;\n", " i++;\n", " }\n", " if (sort) {\n", " if (!key) {\n", " results = results.sort();\n", " }\n", " else {\n", " results = results.sort(function sortUniqueArray(a, b) {\n", " return a[key] > b[key];\n", " });\n", " }\n", " }\n", " return results;\n", " }\n", " /**\n", " * get the prefixed property\n", " * @param {Object} obj\n", " * @param {String} property\n", " * @returns {String|Undefined} prefixed\n", " */\n", " function prefixed(obj, property) {\n", " var prefix, prop;\n", " var camelProp = property[0].toUpperCase() + property.slice(1);\n", " var i = 0;\n", " while (i < VENDOR_PREFIXES.length) {\n", " prefix = VENDOR_PREFIXES[i];\n", " prop = (prefix) ? prefix + camelProp : property;\n", " if (prop in obj) {\n", " return prop;\n", " }\n", " i++;\n", " }\n", " return undefined;\n", " }\n", " /**\n", " * get a unique id\n", " * @returns {number} uniqueId\n", " */\n", " var _uniqueId = 1;\n", " function uniqueId() {\n", " return _uniqueId++;\n", " }\n", " /**\n", " * get the window object of an element\n", " * @param {HTMLElement} element\n", " * @returns {DocumentView|Window}\n", " */\n", " function getWindowForElement(element) {\n", " var doc = element.ownerDocument || element;\n", " return (doc.defaultView || doc.parentWindow || window);\n", " }\n", " var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;\n", " var SUPPORT_TOUCH = ('ontouchstart' in window);\n", " var SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined;\n", " var SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);\n", " var INPUT_TYPE_TOUCH = 'touch';\n", " var INPUT_TYPE_PEN = 'pen';\n", " var INPUT_TYPE_MOUSE = 'mouse';\n", " var INPUT_TYPE_KINECT = 'kinect';\n", " var COMPUTE_INTERVAL = 25;\n", " var INPUT_START = 1;\n", " var INPUT_MOVE = 2;\n", " var INPUT_END = 4;\n", " var INPUT_CANCEL = 8;\n", " var DIRECTION_NONE = 1;\n", " var DIRECTION_LEFT = 2;\n", " var DIRECTION_RIGHT = 4;\n", " var DIRECTION_UP = 8;\n", " var DIRECTION_DOWN = 16;\n", " var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;\n", " var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;\n", " var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;\n", " var PROPS_XY = ['x', 'y'];\n", " var PROPS_CLIENT_XY = ['clientX', 'clientY'];\n", " /**\n", " * create new input type manager\n", " * @param {Manager} manager\n", " * @param {Function} callback\n", " * @returns {Input}\n", " * @constructor\n", " */\n", " function Input(manager, callback) {\n", " var self = this;\n", " this.manager = manager;\n", " this.callback = callback;\n", " this.element = manager.element;\n", " this.target = manager.options.inputTarget;\n", " // smaller wrapper around the handler, for the scope and the enabled state of the manager,\n", " // so when disabled the input events are completely bypassed.\n", " this.domHandler = function (ev) {\n", " if (boolOrFn(manager.options.enable, [manager])) {\n", " self.handler(ev);\n", " }\n", " };\n", " this.init();\n", " }\n", " Input.prototype = {\n", " /**\n", " * should handle the inputEvent data and trigger the callback\n", " * @virtual\n", " */\n", " handler: function () { },\n", " /**\n", " * bind the events\n", " */\n", " init: function () {\n", " this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);\n", " this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);\n", " this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n", " },\n", " /**\n", " * unbind the events\n", " */\n", " destroy: function () {\n", " this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);\n", " this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);\n", " this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n", " }\n", " };\n", " /**\n", " * create new input type manager\n", " * called by the Manager constructor\n", " * @param {Hammer} manager\n", " * @returns {Input}\n", " */\n", " function createInputInstance(manager) {\n", " var Type;\n", " var inputClass = manager.options.inputClass;\n", " if (inputClass) {\n", " Type = inputClass;\n", " }\n", " else if (SUPPORT_POINTER_EVENTS) {\n", " Type = PointerEventInput;\n", " }\n", " else if (SUPPORT_ONLY_TOUCH) {\n", " Type = TouchInput;\n", " }\n", " else if (!SUPPORT_TOUCH) {\n", " Type = MouseInput;\n", " }\n", " else {\n", " Type = TouchMouseInput;\n", " }\n", " return new (Type)(manager, inputHandler);\n", " }\n", " /**\n", " * handle input events\n", " * @param {Manager} manager\n", " * @param {String} eventType\n", " * @param {Object} input\n", " */\n", " function inputHandler(manager, eventType, input) {\n", " var pointersLen = input.pointers.length;\n", " var changedPointersLen = input.changedPointers.length;\n", " var isFirst = (eventType & INPUT_START && (pointersLen - changedPointersLen === 0));\n", " var isFinal = (eventType & (INPUT_END | INPUT_CANCEL) && (pointersLen - changedPointersLen === 0));\n", " input.isFirst = !!isFirst;\n", " input.isFinal = !!isFinal;\n", " if (isFirst) {\n", " manager.session = {};\n", " }\n", " // source event is the normalized value of the domEvents\n", " // like 'touchstart, mouseup, pointerdown'\n", " input.eventType = eventType;\n", " // compute scale, rotation etc\n", " computeInputData(manager, input);\n", " // emit secret event\n", " manager.emit('hammer.input', input);\n", " manager.recognize(input);\n", " manager.session.prevInput = input;\n", " }\n", " /**\n", " * extend the data with some usable properties like scale, rotate, velocity etc\n", " * @param {Object} manager\n", " * @param {Object} input\n", " */\n", " function computeInputData(manager, input) {\n", " var session = manager.session;\n", " var pointers = input.pointers;\n", " var pointersLength = pointers.length;\n", " // store the first input to calculate the distance and direction\n", " if (!session.firstInput) {\n", " session.firstInput = simpleCloneInputData(input);\n", " }\n", " // to compute scale and rotation we need to store the multiple touches\n", " if (pointersLength > 1 && !session.firstMultiple) {\n", " session.firstMultiple = simpleCloneInputData(input);\n", " }\n", " else if (pointersLength === 1) {\n", " session.firstMultiple = false;\n", " }\n", " var firstInput = session.firstInput;\n", " var firstMultiple = session.firstMultiple;\n", " var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;\n", " var center = input.center = getCenter(pointers);\n", " input.timeStamp = now();\n", " input.deltaTime = input.timeStamp - firstInput.timeStamp;\n", " input.angle = getAngle(offsetCenter, center);\n", " input.distance = getDistance(offsetCenter, center);\n", " computeDeltaXY(session, input);\n", " input.offsetDirection = getDirection(input.deltaX, input.deltaY);\n", " var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);\n", " input.overallVelocityX = overallVelocity.x;\n", " input.overallVelocityY = overallVelocity.y;\n", " input.overallVelocity = (abs(overallVelocity.x) > abs(overallVelocity.y)) ? overallVelocity.x : overallVelocity.y;\n", " input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;\n", " input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;\n", " input.maxPointers = !session.prevInput ? input.pointers.length : ((input.pointers.length >\n", " session.prevInput.maxPointers) ? input.pointers.length : session.prevInput.maxPointers);\n", " computeIntervalInputData(session, input);\n", " // find the correct target\n", " var target = manager.element;\n", " if (hasParent(input.srcEvent.target, target)) {\n", " target = input.srcEvent.target;\n", " }\n", " input.target = target;\n", " }\n", " function computeDeltaXY(session, input) {\n", " var center = input.center;\n", " var offset = session.offsetDelta || {};\n", " var prevDelta = session.prevDelta || {};\n", " var prevInput = session.prevInput || {};\n", " if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {\n", " prevDelta = session.prevDelta = {\n", " x: prevInput.deltaX || 0,\n", " y: prevInput.deltaY || 0\n", " };\n", " offset = session.offsetDelta = {\n", " x: center.x,\n", " y: center.y\n", " };\n", " }\n", " input.deltaX = prevDelta.x + (center.x - offset.x);\n", " input.deltaY = prevDelta.y + (center.y - offset.y);\n", " }\n", " /**\n", " * velocity is calculated every x ms\n", " * @param {Object} session\n", " * @param {Object} input\n", " */\n", " function computeIntervalInputData(session, input) {\n", " var last = session.lastInterval || input, deltaTime = input.timeStamp - last.timeStamp, velocity, velocityX, velocityY, direction;\n", " if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {\n", " var deltaX = input.deltaX - last.deltaX;\n", " var deltaY = input.deltaY - last.deltaY;\n", " var v = getVelocity(deltaTime, deltaX, deltaY);\n", " velocityX = v.x;\n", " velocityY = v.y;\n", " velocity = (abs(v.x) > abs(v.y)) ? v.x : v.y;\n", " direction = getDirection(deltaX, deltaY);\n", " session.lastInterval = input;\n", " }\n", " else {\n", " // use latest velocity info if it doesn't overtake a minimum period\n", " velocity = last.velocity;\n", " velocityX = last.velocityX;\n", " velocityY = last.velocityY;\n", " direction = last.direction;\n", " }\n", " input.velocity = velocity;\n", " input.velocityX = velocityX;\n", " input.velocityY = velocityY;\n", " input.direction = direction;\n", " }\n", " /**\n", " * create a simple clone from the input used for storage of firstInput and firstMultiple\n", " * @param {Object} input\n", " * @returns {Object} clonedInputData\n", " */\n", " function simpleCloneInputData(input) {\n", " // make a simple copy of the pointers because we will get a reference if we don't\n", " // we only need clientXY for the calculations\n", " var pointers = [];\n", " var i = 0;\n", " while (i < input.pointers.length) {\n", " pointers[i] = {\n", " clientX: round(input.pointers[i].clientX),\n", " clientY: round(input.pointers[i].clientY)\n", " };\n", " i++;\n", " }\n", " return {\n", " timeStamp: now(),\n", " pointers: pointers,\n", " center: getCenter(pointers),\n", " deltaX: input.deltaX,\n", " deltaY: input.deltaY\n", " };\n", " }\n", " /**\n", " * get the center of all the pointers\n", " * @param {Array} pointers\n", " * @return {Object} center contains `x` and `y` properties\n", " */\n", " function getCenter(pointers) {\n", " var pointersLength = pointers.length;\n", " // no need to loop when only one touch\n", " if (pointersLength === 1) {\n", " return {\n", " x: round(pointers[0].clientX),\n", " y: round(pointers[0].clientY)\n", " };\n", " }\n", " var x = 0, y = 0, i = 0;\n", " while (i < pointersLength) {\n", " x += pointers[i].clientX;\n", " y += pointers[i].clientY;\n", " i++;\n", " }\n", " return {\n", " x: round(x / pointersLength),\n", " y: round(y / pointersLength)\n", " };\n", " }\n", " /**\n", " * calculate the velocity between two points. unit is in px per ms.\n", " * @param {Number} deltaTime\n", " * @param {Number} x\n", " * @param {Number} y\n", " * @return {Object} velocity `x` and `y`\n", " */\n", " function getVelocity(deltaTime, x, y) {\n", " return {\n", " x: x / deltaTime || 0,\n", " y: y / deltaTime || 0\n", " };\n", " }\n", " /**\n", " * get the direction between two points\n", " * @param {Number} x\n", " * @param {Number} y\n", " * @return {Number} direction\n", " */\n", " function getDirection(x, y) {\n", " if (x === y) {\n", " return DIRECTION_NONE;\n", " }\n", " if (abs(x) >= abs(y)) {\n", " return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;\n", " }\n", " return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;\n", " }\n", " /**\n", " * calculate the absolute distance between two points\n", " * @param {Object} p1 {x, y}\n", " * @param {Object} p2 {x, y}\n", " * @param {Array} [props] containing x and y keys\n", " * @return {Number} distance\n", " */\n", " function getDistance(p1, p2, props) {\n", " if (!props) {\n", " props = PROPS_XY;\n", " }\n", " var x = p2[props[0]] - p1[props[0]], y = p2[props[1]] - p1[props[1]];\n", " return Math.sqrt((x * x) + (y * y));\n", " }\n", " /**\n", " * calculate the angle between two coordinates\n", " * @param {Object} p1\n", " * @param {Object} p2\n", " * @param {Array} [props] containing x and y keys\n", " * @return {Number} angle\n", " */\n", " function getAngle(p1, p2, props) {\n", " if (!props) {\n", " props = PROPS_XY;\n", " }\n", " var x = p2[props[0]] - p1[props[0]], y = p2[props[1]] - p1[props[1]];\n", " return Math.atan2(y, x) * 180 / Math.PI;\n", " }\n", " /**\n", " * calculate the rotation degrees between two pointersets\n", " * @param {Array} start array of pointers\n", " * @param {Array} end array of pointers\n", " * @return {Number} rotation\n", " */\n", " function getRotation(start, end) {\n", " return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);\n", " }\n", " /**\n", " * calculate the scale factor between two pointersets\n", " * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out\n", " * @param {Array} start array of pointers\n", " * @param {Array} end array of pointers\n", " * @return {Number} scale\n", " */\n", " function getScale(start, end) {\n", " return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);\n", " }\n", " var MOUSE_INPUT_MAP = {\n", " mousedown: INPUT_START,\n", " mousemove: INPUT_MOVE,\n", " mouseup: INPUT_END\n", " };\n", " var MOUSE_ELEMENT_EVENTS = 'mousedown';\n", " var MOUSE_WINDOW_EVENTS = 'mousemove mouseup';\n", " /**\n", " * Mouse events input\n", " * @constructor\n", " * @extends Input\n", " */\n", " function MouseInput() {\n", " this.evEl = MOUSE_ELEMENT_EVENTS;\n", " this.evWin = MOUSE_WINDOW_EVENTS;\n", " this.pressed = false; // mousedown state\n", " Input.apply(this, arguments);\n", " }\n", " inherit(MouseInput, Input, {\n", " /**\n", " * handle mouse events\n", " * @param {Object} ev\n", " */\n", " handler: function MEhandler(ev) {\n", " var eventType = MOUSE_INPUT_MAP[ev.type];\n", " // on start we want to have the left mouse button down\n", " if (eventType & INPUT_START && ev.button === 0) {\n", " this.pressed = true;\n", " }\n", " if (eventType & INPUT_MOVE && ev.which !== 1) {\n", " eventType = INPUT_END;\n", " }\n", " // mouse must be down\n", " if (!this.pressed) {\n", " return;\n", " }\n", " if (eventType & INPUT_END) {\n", " this.pressed = false;\n", " }\n", " this.callback(this.manager, eventType, {\n", " pointers: [ev],\n", " changedPointers: [ev],\n", " pointerType: INPUT_TYPE_MOUSE,\n", " srcEvent: ev\n", " });\n", " }\n", " });\n", " var POINTER_INPUT_MAP = {\n", " pointerdown: INPUT_START,\n", " pointermove: INPUT_MOVE,\n", " pointerup: INPUT_END,\n", " pointercancel: INPUT_CANCEL,\n", " pointerout: INPUT_CANCEL\n", " };\n", " // in IE10 the pointer types is defined as an enum\n", " var IE10_POINTER_TYPE_ENUM = {\n", " 2: INPUT_TYPE_TOUCH,\n", " 3: INPUT_TYPE_PEN,\n", " 4: INPUT_TYPE_MOUSE,\n", " 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816\n", " };\n", " var POINTER_ELEMENT_EVENTS = 'pointerdown';\n", " var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';\n", " // IE10 has prefixed support, and case-sensitive\n", " if (window.MSPointerEvent && !window.PointerEvent) {\n", " POINTER_ELEMENT_EVENTS = 'MSPointerDown';\n", " POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';\n", " }\n", " /**\n", " * Pointer events input\n", " * @constructor\n", " * @extends Input\n", " */\n", " function PointerEventInput() {\n", " this.evEl = POINTER_ELEMENT_EVENTS;\n", " this.evWin = POINTER_WINDOW_EVENTS;\n", " Input.apply(this, arguments);\n", " this.store = (this.manager.session.pointerEvents = []);\n", " }\n", " inherit(PointerEventInput, Input, {\n", " /**\n", " * handle mouse events\n", " * @param {Object} ev\n", " */\n", " handler: function PEhandler(ev) {\n", " var store = this.store;\n", " var removePointer = false;\n", " var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');\n", " var eventType = POINTER_INPUT_MAP[eventTypeNormalized];\n", " var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;\n", " var isTouch = (pointerType == INPUT_TYPE_TOUCH);\n", " // get index of the event in the store\n", " var storeIndex = inArray(store, ev.pointerId, 'pointerId');\n", " // start and mouse must be down\n", " if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {\n", " if (storeIndex < 0) {\n", " store.push(ev);\n", " storeIndex = store.length - 1;\n", " }\n", " }\n", " else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n", " removePointer = true;\n", " }\n", " // it not found, so the pointer hasn't been down (so it's probably a hover)\n", " if (storeIndex < 0) {\n", " return;\n", " }\n", " // update the event in the store\n", " store[storeIndex] = ev;\n", " this.callback(this.manager, eventType, {\n", " pointers: store,\n", " changedPointers: [ev],\n", " pointerType: pointerType,\n", " srcEvent: ev\n", " });\n", " if (removePointer) {\n", " // remove from the store\n", " store.splice(storeIndex, 1);\n", " }\n", " }\n", " });\n", " var SINGLE_TOUCH_INPUT_MAP = {\n", " touchstart: INPUT_START,\n", " touchmove: INPUT_MOVE,\n", " touchend: INPUT_END,\n", " touchcancel: INPUT_CANCEL\n", " };\n", " var SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';\n", " var SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';\n", " /**\n", " * Touch events input\n", " * @constructor\n", " * @extends Input\n", " */\n", " function SingleTouchInput() {\n", " this.evTarget = SINGLE_TOUCH_TARGET_EVENTS;\n", " this.evWin = SINGLE_TOUCH_WINDOW_EVENTS;\n", " this.started = false;\n", " Input.apply(this, arguments);\n", " }\n", " inherit(SingleTouchInput, Input, {\n", " handler: function TEhandler(ev) {\n", " var type = SINGLE_TOUCH_INPUT_MAP[ev.type];\n", " // should we handle the touch events?\n", " if (type === INPUT_START) {\n", " this.started = true;\n", " }\n", " if (!this.started) {\n", " return;\n", " }\n", " var touches = normalizeSingleTouches.call(this, ev, type);\n", " // when done, reset the started state\n", " if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {\n", " this.started = false;\n", " }\n", " this.callback(this.manager, type, {\n", " pointers: touches[0],\n", " changedPointers: touches[1],\n", " pointerType: INPUT_TYPE_TOUCH,\n", " srcEvent: ev\n", " });\n", " }\n", " });\n", " /**\n", " * @this {TouchInput}\n", " * @param {Object} ev\n", " * @param {Number} type flag\n", " * @returns {undefined|Array} [all, changed]\n", " */\n", " function normalizeSingleTouches(ev, type) {\n", " var all = toArray(ev.touches);\n", " var changed = toArray(ev.changedTouches);\n", " if (type & (INPUT_END | INPUT_CANCEL)) {\n", " all = uniqueArray(all.concat(changed), 'identifier', true);\n", " }\n", " return [all, changed];\n", " }\n", " var TOUCH_INPUT_MAP = {\n", " touchstart: INPUT_START,\n", " touchmove: INPUT_MOVE,\n", " touchend: INPUT_END,\n", " touchcancel: INPUT_CANCEL\n", " };\n", " var TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';\n", " /**\n", " * Multi-user touch events input\n", " * @constructor\n", " * @extends Input\n", " */\n", " function TouchInput() {\n", " this.evTarget = TOUCH_TARGET_EVENTS;\n", " this.targetIds = {};\n", " Input.apply(this, arguments);\n", " }\n", " inherit(TouchInput, Input, {\n", " handler: function MTEhandler(ev) {\n", " var type = TOUCH_INPUT_MAP[ev.type];\n", " var touches = getTouches.call(this, ev, type);\n", " if (!touches) {\n", " return;\n", " }\n", " this.callback(this.manager, type, {\n", " pointers: touches[0],\n", " changedPointers: touches[1],\n", " pointerType: INPUT_TYPE_TOUCH,\n", " srcEvent: ev\n", " });\n", " }\n", " });\n", " /**\n", " * @this {TouchInput}\n", " * @param {Object} ev\n", " * @param {Number} type flag\n", " * @returns {undefined|Array} [all, changed]\n", " */\n", " function getTouches(ev, type) {\n", " var allTouches = toArray(ev.touches);\n", " var targetIds = this.targetIds;\n", " // when there is only one touch, the process can be simplified\n", " if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {\n", " targetIds[allTouches[0].identifier] = true;\n", " return [allTouches, allTouches];\n", " }\n", " var i, targetTouches, changedTouches = toArray(ev.changedTouches), changedTargetTouches = [], target = this.target;\n", " // get target touches from touches\n", " targetTouches = allTouches.filter(function (touch) {\n", " return hasParent(touch.target, target);\n", " });\n", " // collect touches\n", " if (type === INPUT_START) {\n", " i = 0;\n", " while (i < targetTouches.length) {\n", " targetIds[targetTouches[i].identifier] = true;\n", " i++;\n", " }\n", " }\n", " // filter changed touches to only contain touches that exist in the collected target ids\n", " i = 0;\n", " while (i < changedTouches.length) {\n", " if (targetIds[changedTouches[i].identifier]) {\n", " changedTargetTouches.push(changedTouches[i]);\n", " }\n", " // cleanup removed touches\n", " if (type & (INPUT_END | INPUT_CANCEL)) {\n", " delete targetIds[changedTouches[i].identifier];\n", " }\n", " i++;\n", " }\n", " if (!changedTargetTouches.length) {\n", " return;\n", " }\n", " return [\n", " // merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'\n", " uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true),\n", " changedTargetTouches\n", " ];\n", " }\n", " /**\n", " * Combined touch and mouse input\n", " *\n", " * Touch has a higher priority then mouse, and while touching no mouse events are allowed.\n", " * This because touch devices also emit mouse events while doing a touch.\n", " *\n", " * @constructor\n", " * @extends Input\n", " */\n", " var DEDUP_TIMEOUT = 2500;\n", " var DEDUP_DISTANCE = 25;\n", " function TouchMouseInput() {\n", " Input.apply(this, arguments);\n", " var handler = bindFn(this.handler, this);\n", " this.touch = new TouchInput(this.manager, handler);\n", " this.mouse = new MouseInput(this.manager, handler);\n", " this.primaryTouch = null;\n", " this.lastTouches = [];\n", " }\n", " inherit(TouchMouseInput, Input, {\n", " /**\n", " * handle mouse and touch events\n", " * @param {Hammer} manager\n", " * @param {String} inputEvent\n", " * @param {Object} inputData\n", " */\n", " handler: function TMEhandler(manager, inputEvent, inputData) {\n", " var isTouch = (inputData.pointerType == INPUT_TYPE_TOUCH), isMouse = (inputData.pointerType == INPUT_TYPE_MOUSE);\n", " if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) {\n", " return;\n", " }\n", " // when we're in a touch event, record touches to de-dupe synthetic mouse event\n", " if (isTouch) {\n", " recordTouches.call(this, inputEvent, inputData);\n", " }\n", " else if (isMouse && isSyntheticEvent.call(this, inputData)) {\n", " return;\n", " }\n", " this.callback(manager, inputEvent, inputData);\n", " },\n", " /**\n", " * remove the event listeners\n", " */\n", " destroy: function destroy() {\n", " this.touch.destroy();\n", " this.mouse.destroy();\n", " }\n", " });\n", " function recordTouches(eventType, eventData) {\n", " if (eventType & INPUT_START) {\n", " this.primaryTouch = eventData.changedPointers[0].identifier;\n", " setLastTouch.call(this, eventData);\n", " }\n", " else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n", " setLastTouch.call(this, eventData);\n", " }\n", " }\n", " function setLastTouch(eventData) {\n", " var touch = eventData.changedPointers[0];\n", " if (touch.identifier === this.primaryTouch) {\n", " var lastTouch = { x: touch.clientX, y: touch.clientY };\n", " this.lastTouches.push(lastTouch);\n", " var lts = this.lastTouches;\n", " var removeLastTouch = function () {\n", " var i = lts.indexOf(lastTouch);\n", " if (i > -1) {\n", " lts.splice(i, 1);\n", " }\n", " };\n", " setTimeout(removeLastTouch, DEDUP_TIMEOUT);\n", " }\n", " }\n", " function isSyntheticEvent(eventData) {\n", " var x = eventData.srcEvent.clientX, y = eventData.srcEvent.clientY;\n", " for (var i = 0; i < this.lastTouches.length; i++) {\n", " var t = this.lastTouches[i];\n", " var dx = Math.abs(x - t.x), dy = Math.abs(y - t.y);\n", " if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) {\n", " return true;\n", " }\n", " }\n", " return false;\n", " }\n", " var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');\n", " var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;\n", " // magical touchAction value\n", " var TOUCH_ACTION_COMPUTE = 'compute';\n", " var TOUCH_ACTION_AUTO = 'auto';\n", " var TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented\n", " var TOUCH_ACTION_NONE = 'none';\n", " var TOUCH_ACTION_PAN_X = 'pan-x';\n", " var TOUCH_ACTION_PAN_Y = 'pan-y';\n", " var TOUCH_ACTION_MAP = getTouchActionProps();\n", " /**\n", " * Touch Action\n", " * sets the touchAction property or uses the js alternative\n", " * @param {Manager} manager\n", " * @param {String} value\n", " * @constructor\n", " */\n", " function TouchAction(manager, value) {\n", " this.manager = manager;\n", " this.set(value);\n", " }\n", " TouchAction.prototype = {\n", " /**\n", " * set the touchAction value on the element or enable the polyfill\n", " * @param {String} value\n", " */\n", " set: function (value) {\n", " // find out the touch-action by the event handlers\n", " if (value == TOUCH_ACTION_COMPUTE) {\n", " value = this.compute();\n", " }\n", " if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) {\n", " this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;\n", " }\n", " this.actions = value.toLowerCase().trim();\n", " },\n", " /**\n", " * just re-set the touchAction value\n", " */\n", " update: function () {\n", " this.set(this.manager.options.touchAction);\n", " },\n", " /**\n", " * compute the value for the touchAction property based on the recognizer's settings\n", " * @returns {String} value\n", " */\n", " compute: function () {\n", " var actions = [];\n", " each(this.manager.recognizers, function (recognizer) {\n", " if (boolOrFn(recognizer.options.enable, [recognizer])) {\n", " actions = actions.concat(recognizer.getTouchAction());\n", " }\n", " });\n", " return cleanTouchActions(actions.join(' '));\n", " },\n", " /**\n", " * this method is called on each input cycle and provides the preventing of the browser behavior\n", " * @param {Object} input\n", " */\n", " preventDefaults: function (input) {\n", " var srcEvent = input.srcEvent;\n", " var direction = input.offsetDirection;\n", " // if the touch action did prevented once this session\n", " if (this.manager.session.prevented) {\n", " srcEvent.preventDefault();\n", " return;\n", " }\n", " var actions = this.actions;\n", " var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE];\n", " var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y];\n", " var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X];\n", " if (hasNone) {\n", " //do not prevent defaults if this is a tap gesture\n", " var isTapPointer = input.pointers.length === 1;\n", " var isTapMovement = input.distance < 2;\n", " var isTapTouchTime = input.deltaTime < 250;\n", " if (isTapPointer && isTapMovement && isTapTouchTime) {\n", " return;\n", " }\n", " }\n", " if (hasPanX && hasPanY) {\n", " // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent\n", " return;\n", " }\n", " if (hasNone ||\n", " (hasPanY && direction & DIRECTION_HORIZONTAL) ||\n", " (hasPanX && direction & DIRECTION_VERTICAL)) {\n", " return this.preventSrc(srcEvent);\n", " }\n", " },\n", " /**\n", " * call preventDefault to prevent the browser's default behavior (scrolling in most cases)\n", " * @param {Object} srcEvent\n", " */\n", " preventSrc: function (srcEvent) {\n", " this.manager.session.prevented = true;\n", " srcEvent.preventDefault();\n", " }\n", " };\n", " /**\n", " * when the touchActions are collected they are not a valid value, so we need to clean things up. *\n", " * @param {String} actions\n", " * @returns {*}\n", " */\n", " function cleanTouchActions(actions) {\n", " // none\n", " if (inStr(actions, TOUCH_ACTION_NONE)) {\n", " return TOUCH_ACTION_NONE;\n", " }\n", " var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);\n", " var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);\n", " // if both pan-x and pan-y are set (different recognizers\n", " // for different directions, e.g. horizontal pan but vertical swipe?)\n", " // we need none (as otherwise with pan-x pan-y combined none of these\n", " // recognizers will work, since the browser would handle all panning\n", " if (hasPanX && hasPanY) {\n", " return TOUCH_ACTION_NONE;\n", " }\n", " // pan-x OR pan-y\n", " if (hasPanX || hasPanY) {\n", " return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;\n", " }\n", " // manipulation\n", " if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {\n", " return TOUCH_ACTION_MANIPULATION;\n", " }\n", " return TOUCH_ACTION_AUTO;\n", " }\n", " function getTouchActionProps() {\n", " if (!NATIVE_TOUCH_ACTION) {\n", " return false;\n", " }\n", " var touchMap = {};\n", " var cssSupports = window.CSS && window.CSS.supports;\n", " ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function (val) {\n", " // If css.supports is not supported but there is native touch-action assume it supports\n", " // all values. This is the case for IE 10 and 11.\n", " touchMap[val] = cssSupports ? window.CSS.supports('touch-action', val) : true;\n", " });\n", " return touchMap;\n", " }\n", " /**\n", " * Recognizer flow explained; *\n", " * All recognizers have the initial state of POSSIBLE when a input session starts.\n", " * The definition of a input session is from the first input until the last input, with all it's movement in it. *\n", " * Example session for mouse-input: mousedown -> mousemove -> mouseup\n", " *\n", " * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed\n", " * which determines with state it should be.\n", " *\n", " * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to\n", " * POSSIBLE to give it another change on the next cycle.\n", " *\n", " * Possible\n", " * |\n", " * +-----+---------------+\n", " * | |\n", " * +-----+-----+ |\n", " * | | |\n", " * Failed Cancelled |\n", " * +-------+------+\n", " * | |\n", " * Recognized Began\n", " * |\n", " * Changed\n", " * |\n", " * Ended/Recognized\n", " */\n", " var STATE_POSSIBLE = 1;\n", " var STATE_BEGAN = 2;\n", " var STATE_CHANGED = 4;\n", " var STATE_ENDED = 8;\n", " var STATE_RECOGNIZED = STATE_ENDED;\n", " var STATE_CANCELLED = 16;\n", " var STATE_FAILED = 32;\n", " /**\n", " * Recognizer\n", " * Every recognizer needs to extend from this class.\n", " * @constructor\n", " * @param {Object} options\n", " */\n", " function Recognizer(options) {\n", " this.options = assign({}, this.defaults, options || {});\n", " this.id = uniqueId();\n", " this.manager = null;\n", " // default is enable true\n", " this.options.enable = ifUndefined(this.options.enable, true);\n", " this.state = STATE_POSSIBLE;\n", " this.simultaneous = {};\n", " this.requireFail = [];\n", " }\n", " Recognizer.prototype = {\n", " /**\n", " * @virtual\n", " * @type {Object}\n", " */\n", " defaults: {},\n", " /**\n", " * set options\n", " * @param {Object} options\n", " * @return {Recognizer}\n", " */\n", " set: function (options) {\n", " assign(this.options, options);\n", " // also update the touchAction, in case something changed about the directions/enabled state\n", " this.manager && this.manager.touchAction.update();\n", " return this;\n", " },\n", " /**\n", " * recognize simultaneous with an other recognizer.\n", " * @param {Recognizer} otherRecognizer\n", " * @returns {Recognizer} this\n", " */\n", " recognizeWith: function (otherRecognizer) {\n", " if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {\n", " return this;\n", " }\n", " var simultaneous = this.simultaneous;\n", " otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n", " if (!simultaneous[otherRecognizer.id]) {\n", " simultaneous[otherRecognizer.id] = otherRecognizer;\n", " otherRecognizer.recognizeWith(this);\n", " }\n", " return this;\n", " },\n", " /**\n", " * drop the simultaneous link. it doesnt remove the link on the other recognizer.\n", " * @param {Recognizer} otherRecognizer\n", " * @returns {Recognizer} this\n", " */\n", " dropRecognizeWith: function (otherRecognizer) {\n", " if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {\n", " return this;\n", " }\n", " otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n", " delete this.simultaneous[otherRecognizer.id];\n", " return this;\n", " },\n", " /**\n", " * recognizer can only run when an other is failing\n", " * @param {Recognizer} otherRecognizer\n", " * @returns {Recognizer} this\n", " */\n", " requireFailure: function (otherRecognizer) {\n", " if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {\n", " return this;\n", " }\n", " var requireFail = this.requireFail;\n", " otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n", " if (inArray(requireFail, otherRecognizer) === -1) {\n", " requireFail.push(otherRecognizer);\n", " otherRecognizer.requireFailure(this);\n", " }\n", " return this;\n", " },\n", " /**\n", " * drop the requireFailure link. it does not remove the link on the other recognizer.\n", " * @param {Recognizer} otherRecognizer\n", " * @returns {Recognizer} this\n", " */\n", " dropRequireFailure: function (otherRecognizer) {\n", " if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {\n", " return this;\n", " }\n", " otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n", " var index = inArray(this.requireFail, otherRecognizer);\n", " if (index > -1) {\n", " this.requireFail.splice(index, 1);\n", " }\n", " return this;\n", " },\n", " /**\n", " * has require failures boolean\n", " * @returns {boolean}\n", " */\n", " hasRequireFailures: function () {\n", " return this.requireFail.length > 0;\n", " },\n", " /**\n", " * if the recognizer can recognize simultaneous with an other recognizer\n", " * @param {Recognizer} otherRecognizer\n", " * @returns {Boolean}\n", " */\n", " canRecognizeWith: function (otherRecognizer) {\n", " return !!this.simultaneous[otherRecognizer.id];\n", " },\n", " /**\n", " * You should use `tryEmit` instead of `emit` directly to check\n", " * that all the needed recognizers has failed before emitting.\n", " * @param {Object} input\n", " */\n", " emit: function (input) {\n", " var self = this;\n", " var state = this.state;\n", " function emit(event) {\n", " self.manager.emit(event, input);\n", " }\n", " // 'panstart' and 'panmove'\n", " if (state < STATE_ENDED) {\n", " emit(self.options.event + stateStr(state));\n", " }\n", " emit(self.options.event); // simple 'eventName' events\n", " if (input.additionalEvent) { // additional event(panleft, panright, pinchin, pinchout...)\n", " emit(input.additionalEvent);\n", " }\n", " // panend and pancancel\n", " if (state >= STATE_ENDED) {\n", " emit(self.options.event + stateStr(state));\n", " }\n", " },\n", " /**\n", " * Check that all the require failure recognizers has failed,\n", " * if true, it emits a gesture event,\n", " * otherwise, setup the state to FAILED.\n", " * @param {Object} input\n", " */\n", " tryEmit: function (input) {\n", " if (this.canEmit()) {\n", " return this.emit(input);\n", " }\n", " // it's failing anyway\n", " this.state = STATE_FAILED;\n", " },\n", " /**\n", " * can we emit?\n", " * @returns {boolean}\n", " */\n", " canEmit: function () {\n", " var i = 0;\n", " while (i < this.requireFail.length) {\n", " if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {\n", " return false;\n", " }\n", " i++;\n", " }\n", " return true;\n", " },\n", " /**\n", " * update the recognizer\n", " * @param {Object} inputData\n", " */\n", " recognize: function (inputData) {\n", " // make a new copy of the inputData\n", " // so we can change the inputData without messing up the other recognizers\n", " var inputDataClone = assign({}, inputData);\n", " // is is enabled and allow recognizing?\n", " if (!boolOrFn(this.options.enable, [this, inputDataClone])) {\n", " this.reset();\n", " this.state = STATE_FAILED;\n", " return;\n", " }\n", " // reset when we've reached the end\n", " if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {\n", " this.state = STATE_POSSIBLE;\n", " }\n", " this.state = this.process(inputDataClone);\n", " // the recognizer has recognized a gesture\n", " // so trigger an event\n", " if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {\n", " this.tryEmit(inputDataClone);\n", " }\n", " },\n", " /**\n", " * return the state of the recognizer\n", " * the actual recognizing happens in this method\n", " * @virtual\n", " * @param {Object} inputData\n", " * @returns {Const} STATE\n", " */\n", " process: function (inputData) { },\n", " /**\n", " * return the preferred touch-action\n", " * @virtual\n", " * @returns {Array}\n", " */\n", " getTouchAction: function () { },\n", " /**\n", " * called when the gesture isn't allowed to recognize\n", " * like when another is being recognized or it is disabled\n", " * @virtual\n", " */\n", " reset: function () { }\n", " };\n", " /**\n", " * get a usable string, used as event postfix\n", " * @param {Const} state\n", " * @returns {String} state\n", " */\n", " function stateStr(state) {\n", " if (state & STATE_CANCELLED) {\n", " return 'cancel';\n", " }\n", " else if (state & STATE_ENDED) {\n", " return 'end';\n", " }\n", " else if (state & STATE_CHANGED) {\n", " return 'move';\n", " }\n", " else if (state & STATE_BEGAN) {\n", " return 'start';\n", " }\n", " return '';\n", " }\n", " /**\n", " * direction cons to string\n", " * @param {Const} direction\n", " * @returns {String}\n", " */\n", " function directionStr(direction) {\n", " if (direction == DIRECTION_DOWN) {\n", " return 'down';\n", " }\n", " else if (direction == DIRECTION_UP) {\n", " return 'up';\n", " }\n", " else if (direction == DIRECTION_LEFT) {\n", " return 'left';\n", " }\n", " else if (direction == DIRECTION_RIGHT) {\n", " return 'right';\n", " }\n", " return '';\n", " }\n", " /**\n", " * get a recognizer by name if it is bound to a manager\n", " * @param {Recognizer|String} otherRecognizer\n", " * @param {Recognizer} recognizer\n", " * @returns {Recognizer}\n", " */\n", " function getRecognizerByNameIfManager(otherRecognizer, recognizer) {\n", " var manager = recognizer.manager;\n", " if (manager) {\n", " return manager.get(otherRecognizer);\n", " }\n", " return otherRecognizer;\n", " }\n", " /**\n", " * This recognizer is just used as a base for the simple attribute recognizers.\n", " * @constructor\n", " * @extends Recognizer\n", " */\n", " function AttrRecognizer() {\n", " Recognizer.apply(this, arguments);\n", " }\n", " inherit(AttrRecognizer, Recognizer, {\n", " /**\n", " * @namespace\n", " * @memberof AttrRecognizer\n", " */\n", " defaults: {\n", " /**\n", " * @type {Number}\n", " * @default 1\n", " */\n", " pointers: 1\n", " },\n", " /**\n", " * Used to check if it the recognizer receives valid input, like input.distance > 10.\n", " * @memberof AttrRecognizer\n", " * @param {Object} input\n", " * @returns {Boolean} recognized\n", " */\n", " attrTest: function (input) {\n", " var optionPointers = this.options.pointers;\n", " return optionPointers === 0 || input.pointers.length === optionPointers;\n", " },\n", " /**\n", " * Process the input and return the state for the recognizer\n", " * @memberof AttrRecognizer\n", " * @param {Object} input\n", " * @returns {*} State\n", " */\n", " process: function (input) {\n", " var state = this.state;\n", " var eventType = input.eventType;\n", " var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);\n", " var isValid = this.attrTest(input);\n", " // on cancel input and we've recognized before, return STATE_CANCELLED\n", " if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {\n", " return state | STATE_CANCELLED;\n", " }\n", " else if (isRecognized || isValid) {\n", " if (eventType & INPUT_END) {\n", " return state | STATE_ENDED;\n", " }\n", " else if (!(state & STATE_BEGAN)) {\n", " return STATE_BEGAN;\n", " }\n", " return state | STATE_CHANGED;\n", " }\n", " return STATE_FAILED;\n", " }\n", " });\n", " /**\n", " * Pan\n", " * Recognized when the pointer is down and moved in the allowed direction.\n", " * @constructor\n", " * @extends AttrRecognizer\n", " */\n", " function PanRecognizer() {\n", " AttrRecognizer.apply(this, arguments);\n", " this.pX = null;\n", " this.pY = null;\n", " }\n", " inherit(PanRecognizer, AttrRecognizer, {\n", " /**\n", " * @namespace\n", " * @memberof PanRecognizer\n", " */\n", " defaults: {\n", " event: 'pan',\n", " threshold: 10,\n", " pointers: 1,\n", " direction: DIRECTION_ALL\n", " },\n", " getTouchAction: function () {\n", " var direction = this.options.direction;\n", " var actions = [];\n", " if (direction & DIRECTION_HORIZONTAL) {\n", " actions.push(TOUCH_ACTION_PAN_Y);\n", " }\n", " if (direction & DIRECTION_VERTICAL) {\n", " actions.push(TOUCH_ACTION_PAN_X);\n", " }\n", " return actions;\n", " },\n", " directionTest: function (input) {\n", " var options = this.options;\n", " var hasMoved = true;\n", " var distance = input.distance;\n", " var direction = input.direction;\n", " var x = input.deltaX;\n", " var y = input.deltaY;\n", " // lock to axis?\n", " if (!(direction & options.direction)) {\n", " if (options.direction & DIRECTION_HORIZONTAL) {\n", " direction = (x === 0) ? DIRECTION_NONE : (x < 0) ? DIRECTION_LEFT : DIRECTION_RIGHT;\n", " hasMoved = x != this.pX;\n", " distance = Math.abs(input.deltaX);\n", " }\n", " else {\n", " direction = (y === 0) ? DIRECTION_NONE : (y < 0) ? DIRECTION_UP : DIRECTION_DOWN;\n", " hasMoved = y != this.pY;\n", " distance = Math.abs(input.deltaY);\n", " }\n", " }\n", " input.direction = direction;\n", " return hasMoved && distance > options.threshold && direction & options.direction;\n", " },\n", " attrTest: function (input) {\n", " return AttrRecognizer.prototype.attrTest.call(this, input) &&\n", " (this.state & STATE_BEGAN || (!(this.state & STATE_BEGAN) && this.directionTest(input)));\n", " },\n", " emit: function (input) {\n", " this.pX = input.deltaX;\n", " this.pY = input.deltaY;\n", " var direction = directionStr(input.direction);\n", " if (direction) {\n", " input.additionalEvent = this.options.event + direction;\n", " }\n", " this._super.emit.call(this, input);\n", " }\n", " });\n", " /**\n", " * Pinch\n", " * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).\n", " * @constructor\n", " * @extends AttrRecognizer\n", " */\n", " function PinchRecognizer() {\n", " AttrRecognizer.apply(this, arguments);\n", " }\n", " inherit(PinchRecognizer, AttrRecognizer, {\n", " /**\n", " * @namespace\n", " * @memberof PinchRecognizer\n", " */\n", " defaults: {\n", " event: 'pinch',\n", " threshold: 0,\n", " pointers: 2\n", " },\n", " getTouchAction: function () {\n", " return [TOUCH_ACTION_NONE];\n", " },\n", " attrTest: function (input) {\n", " return this._super.attrTest.call(this, input) &&\n", " (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);\n", " },\n", " emit: function (input) {\n", " if (input.scale !== 1) {\n", " var inOut = input.scale < 1 ? 'in' : 'out';\n", " input.additionalEvent = this.options.event + inOut;\n", " }\n", " this._super.emit.call(this, input);\n", " }\n", " });\n", " /**\n", " * Press\n", " * Recognized when the pointer is down for x ms without any movement.\n", " * @constructor\n", " * @extends Recognizer\n", " */\n", " function PressRecognizer() {\n", " Recognizer.apply(this, arguments);\n", " this._timer = null;\n", " this._input = null;\n", " }\n", " inherit(PressRecognizer, Recognizer, {\n", " /**\n", " * @namespace\n", " * @memberof PressRecognizer\n", " */\n", " defaults: {\n", " event: 'press',\n", " pointers: 1,\n", " time: 251,\n", " threshold: 9 // a minimal movement is ok, but keep it low\n", " },\n", " getTouchAction: function () {\n", " return [TOUCH_ACTION_AUTO];\n", " },\n", " process: function (input) {\n", " var options = this.options;\n", " var validPointers = input.pointers.length === options.pointers;\n", " var validMovement = input.distance < options.threshold;\n", " var validTime = input.deltaTime > options.time;\n", " this._input = input;\n", " // we only allow little movement\n", " // and we've reached an end event, so a tap is possible\n", " if (!validMovement || !validPointers || (input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime)) {\n", " this.reset();\n", " }\n", " else if (input.eventType & INPUT_START) {\n", " this.reset();\n", " this._timer = setTimeoutContext(function () {\n", " this.state = STATE_RECOGNIZED;\n", " this.tryEmit();\n", " }, options.time, this);\n", " }\n", " else if (input.eventType & INPUT_END) {\n", " return STATE_RECOGNIZED;\n", " }\n", " return STATE_FAILED;\n", " },\n", " reset: function () {\n", " clearTimeout(this._timer);\n", " },\n", " emit: function (input) {\n", " if (this.state !== STATE_RECOGNIZED) {\n", " return;\n", " }\n", " if (input && (input.eventType & INPUT_END)) {\n", " this.manager.emit(this.options.event + 'up', input);\n", " }\n", " else {\n", " this._input.timeStamp = now();\n", " this.manager.emit(this.options.event, this._input);\n", " }\n", " }\n", " });\n", " /**\n", " * Rotate\n", " * Recognized when two or more pointer are moving in a circular motion.\n", " * @constructor\n", " * @extends AttrRecognizer\n", " */\n", " function RotateRecognizer() {\n", " AttrRecognizer.apply(this, arguments);\n", " }\n", " inherit(RotateRecognizer, AttrRecognizer, {\n", " /**\n", " * @namespace\n", " * @memberof RotateRecognizer\n", " */\n", " defaults: {\n", " event: 'rotate',\n", " threshold: 0,\n", " pointers: 2\n", " },\n", " getTouchAction: function () {\n", " return [TOUCH_ACTION_NONE];\n", " },\n", " attrTest: function (input) {\n", " return this._super.attrTest.call(this, input) &&\n", " (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);\n", " }\n", " });\n", " /**\n", " * Swipe\n", " * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.\n", " * @constructor\n", " * @extends AttrRecognizer\n", " */\n", " function SwipeRecognizer() {\n", " AttrRecognizer.apply(this, arguments);\n", " }\n", " inherit(SwipeRecognizer, AttrRecognizer, {\n", " /**\n", " * @namespace\n", " * @memberof SwipeRecognizer\n", " */\n", " defaults: {\n", " event: 'swipe',\n", " threshold: 10,\n", " velocity: 0.3,\n", " direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,\n", " pointers: 1\n", " },\n", " getTouchAction: function () {\n", " return PanRecognizer.prototype.getTouchAction.call(this);\n", " },\n", " attrTest: function (input) {\n", " var direction = this.options.direction;\n", " var velocity;\n", " if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {\n", " velocity = input.overallVelocity;\n", " }\n", " else if (direction & DIRECTION_HORIZONTAL) {\n", " velocity = input.overallVelocityX;\n", " }\n", " else if (direction & DIRECTION_VERTICAL) {\n", " velocity = input.overallVelocityY;\n", " }\n", " return this._super.attrTest.call(this, input) &&\n", " direction & input.offsetDirection &&\n", " input.distance > this.options.threshold &&\n", " input.maxPointers == this.options.pointers &&\n", " abs(velocity) > this.options.velocity && input.eventType & INPUT_END;\n", " },\n", " emit: function (input) {\n", " var direction = directionStr(input.offsetDirection);\n", " if (direction) {\n", " this.manager.emit(this.options.event + direction, input);\n", " }\n", " this.manager.emit(this.options.event, input);\n", " }\n", " });\n", " /**\n", " * A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur\n", " * between the given interval and position. The delay option can be used to recognize multi-taps without firing\n", " * a single tap.\n", " *\n", " * The eventData from the emitted event contains the property `tapCount`, which contains the amount of\n", " * multi-taps being recognized.\n", " * @constructor\n", " * @extends Recognizer\n", " */\n", " function TapRecognizer() {\n", " Recognizer.apply(this, arguments);\n", " // previous time and center,\n", " // used for tap counting\n", " this.pTime = false;\n", " this.pCenter = false;\n", " this._timer = null;\n", " this._input = null;\n", " this.count = 0;\n", " }\n", " inherit(TapRecognizer, Recognizer, {\n", " /**\n", " * @namespace\n", " * @memberof PinchRecognizer\n", " */\n", " defaults: {\n", " event: 'tap',\n", " pointers: 1,\n", " taps: 1,\n", " interval: 300,\n", " time: 250,\n", " threshold: 9,\n", " posThreshold: 10 // a multi-tap can be a bit off the initial position\n", " },\n", " getTouchAction: function () {\n", " return [TOUCH_ACTION_MANIPULATION];\n", " },\n", " process: function (input) {\n", " var options = this.options;\n", " var validPointers = input.pointers.length === options.pointers;\n", " var validMovement = input.distance < options.threshold;\n", " var validTouchTime = input.deltaTime < options.time;\n", " this.reset();\n", " if ((input.eventType & INPUT_START) && (this.count === 0)) {\n", " return this.failTimeout();\n", " }\n", " // we only allow little movement\n", " // and we've reached an end event, so a tap is possible\n", " if (validMovement && validTouchTime && validPointers) {\n", " if (input.eventType != INPUT_END) {\n", " return this.failTimeout();\n", " }\n", " var validInterval = this.pTime ? (input.timeStamp - this.pTime < options.interval) : true;\n", " var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;\n", " this.pTime = input.timeStamp;\n", " this.pCenter = input.center;\n", " if (!validMultiTap || !validInterval) {\n", " this.count = 1;\n", " }\n", " else {\n", " this.count += 1;\n", " }\n", " this._input = input;\n", " // if tap count matches we have recognized it,\n", " // else it has began recognizing...\n", " var tapCount = this.count % options.taps;\n", " if (tapCount === 0) {\n", " // no failing requirements, immediately trigger the tap event\n", " // or wait as long as the multitap interval to trigger\n", " if (!this.hasRequireFailures()) {\n", " return STATE_RECOGNIZED;\n", " }\n", " else {\n", " this._timer = setTimeoutContext(function () {\n", " this.state = STATE_RECOGNIZED;\n", " this.tryEmit();\n", " }, options.interval, this);\n", " return STATE_BEGAN;\n", " }\n", " }\n", " }\n", " return STATE_FAILED;\n", " },\n", " failTimeout: function () {\n", " this._timer = setTimeoutContext(function () {\n", " this.state = STATE_FAILED;\n", " }, this.options.interval, this);\n", " return STATE_FAILED;\n", " },\n", " reset: function () {\n", " clearTimeout(this._timer);\n", " },\n", " emit: function () {\n", " if (this.state == STATE_RECOGNIZED) {\n", " this._input.tapCount = this.count;\n", " this.manager.emit(this.options.event, this._input);\n", " }\n", " }\n", " });\n", " /**\n", " * Simple way to create a manager with a default set of recognizers.\n", " * @param {HTMLElement} element\n", " * @param {Object} [options]\n", " * @constructor\n", " */\n", " function Hammer(element, options) {\n", " options = options || {};\n", " options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset);\n", " return new Manager(element, options);\n", " }\n", " /**\n", " * @const {string}\n", " */\n", " Hammer.VERSION = '2.0.7';\n", " /**\n", " * default settings\n", " * @namespace\n", " */\n", " Hammer.defaults = {\n", " /**\n", " * set if DOM events are being triggered.\n", " * But this is slower and unused by simple implementations, so disabled by default.\n", " * @type {Boolean}\n", " * @default false\n", " */\n", " domEvents: false,\n", " /**\n", " * The value for the touchAction property/fallback.\n", " * When set to `compute` it will magically set the correct value based on the added recognizers.\n", " * @type {String}\n", " * @default compute\n", " */\n", " touchAction: TOUCH_ACTION_COMPUTE,\n", " /**\n", " * @type {Boolean}\n", " * @default true\n", " */\n", " enable: true,\n", " /**\n", " * EXPERIMENTAL FEATURE -- can be removed/changed\n", " * Change the parent input target element.\n", " * If Null, then it is being set the to main element.\n", " * @type {Null|EventTarget}\n", " * @default null\n", " */\n", " inputTarget: null,\n", " /**\n", " * force an input class\n", " * @type {Null|Function}\n", " * @default null\n", " */\n", " inputClass: null,\n", " /**\n", " * Default recognizer setup when calling `Hammer()`\n", " * When creating a new Manager these will be skipped.\n", " * @type {Array}\n", " */\n", " preset: [\n", " // RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]\n", " [RotateRecognizer, { enable: false }],\n", " [PinchRecognizer, { enable: false }, ['rotate']],\n", " [SwipeRecognizer, { direction: DIRECTION_HORIZONTAL }],\n", " [PanRecognizer, { direction: DIRECTION_HORIZONTAL }, ['swipe']],\n", " [TapRecognizer],\n", " [TapRecognizer, { event: 'doubletap', taps: 2 }, ['tap']],\n", " [PressRecognizer]\n", " ],\n", " /**\n", " * Some CSS properties can be used to improve the working of Hammer.\n", " * Add them to this method and they will be set when creating a new Manager.\n", " * @namespace\n", " */\n", " cssProps: {\n", " /**\n", " * Disables text selection to improve the dragging gesture. Mainly for desktop browsers.\n", " * @type {String}\n", " * @default 'none'\n", " */\n", " userSelect: 'none',\n", " /**\n", " * Disable the Windows Phone grippers when pressing an element.\n", " * @type {String}\n", " * @default 'none'\n", " */\n", " touchSelect: 'none',\n", " /**\n", " * Disables the default callout shown when you touch and hold a touch target.\n", " * On iOS, when you touch and hold a touch target such as a link, Safari displays\n", " * a callout containing information about the link. This property allows you to disable that callout.\n", " * @type {String}\n", " * @default 'none'\n", " */\n", " touchCallout: 'none',\n", " /**\n", " * Specifies whether zooming is enabled. Used by IE10>\n", " * @type {String}\n", " * @default 'none'\n", " */\n", " contentZooming: 'none',\n", " /**\n", " * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.\n", " * @type {String}\n", " * @default 'none'\n", " */\n", " userDrag: 'none',\n", " /**\n", " * Overrides the highlight color shown when the user taps a link or a JavaScript\n", " * clickable element in iOS. This property obeys the alpha value, if specified.\n", " * @type {String}\n", " * @default 'rgba(0,0,0,0)'\n", " */\n", " tapHighlightColor: 'rgba(0,0,0,0)'\n", " }\n", " };\n", " var STOP = 1;\n", " var FORCED_STOP = 2;\n", " /**\n", " * Manager\n", " * @param {HTMLElement} element\n", " * @param {Object} [options]\n", " * @constructor\n", " */\n", " function Manager(element, options) {\n", " this.options = assign({}, Hammer.defaults, options || {});\n", " this.options.inputTarget = this.options.inputTarget || element;\n", " this.handlers = {};\n", " this.session = {};\n", " this.recognizers = [];\n", " this.oldCssProps = {};\n", " this.element = element;\n", " this.input = createInputInstance(this);\n", " this.touchAction = new TouchAction(this, this.options.touchAction);\n", " toggleCssProps(this, true);\n", " each(this.options.recognizers, function (item) {\n", " var recognizer = this.add(new (item[0])(item[1]));\n", " item[2] && recognizer.recognizeWith(item[2]);\n", " item[3] && recognizer.requireFailure(item[3]);\n", " }, this);\n", " }\n", " Manager.prototype = {\n", " /**\n", " * set options\n", " * @param {Object} options\n", " * @returns {Manager}\n", " */\n", " set: function (options) {\n", " assign(this.options, options);\n", " // Options that need a little more setup\n", " if (options.touchAction) {\n", " this.touchAction.update();\n", " }\n", " if (options.inputTarget) {\n", " // Clean up existing event listeners and reinitialize\n", " this.input.destroy();\n", " this.input.target = options.inputTarget;\n", " this.input.init();\n", " }\n", " return this;\n", " },\n", " /**\n", " * stop recognizing for this session.\n", " * This session will be discarded, when a new [input]start event is fired.\n", " * When forced, the recognizer cycle is stopped immediately.\n", " * @param {Boolean} [force]\n", " */\n", " stop: function (force) {\n", " this.session.stopped = force ? FORCED_STOP : STOP;\n", " },\n", " /**\n", " * run the recognizers!\n", " * called by the inputHandler function on every movement of the pointers (touches)\n", " * it walks through all the recognizers and tries to detect the gesture that is being made\n", " * @param {Object} inputData\n", " */\n", " recognize: function (inputData) {\n", " var session = this.session;\n", " if (session.stopped) {\n", " return;\n", " }\n", " // run the touch-action polyfill\n", " this.touchAction.preventDefaults(inputData);\n", " var recognizer;\n", " var recognizers = this.recognizers;\n", " // this holds the recognizer that is being recognized.\n", " // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED\n", " // if no recognizer is detecting a thing, it is set to `null`\n", " var curRecognizer = session.curRecognizer;\n", " // reset when the last recognizer is recognized\n", " // or when we're in a new session\n", " if (!curRecognizer || (curRecognizer && curRecognizer.state & STATE_RECOGNIZED)) {\n", " curRecognizer = session.curRecognizer = null;\n", " }\n", " var i = 0;\n", " while (i < recognizers.length) {\n", " recognizer = recognizers[i];\n", " // find out if we are allowed try to recognize the input for this one.\n", " // 1. allow if the session is NOT forced stopped (see the .stop() method)\n", " // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one\n", " // that is being recognized.\n", " // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.\n", " // this can be setup with the `recognizeWith()` method on the recognizer.\n", " if (session.stopped !== FORCED_STOP && ( // 1\n", " !curRecognizer || recognizer == curRecognizer || // 2\n", " recognizer.canRecognizeWith(curRecognizer))) { // 3\n", " recognizer.recognize(inputData);\n", " }\n", " else {\n", " recognizer.reset();\n", " }\n", " // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the\n", " // current active recognizer. but only if we don't already have an active recognizer\n", " if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {\n", " curRecognizer = session.curRecognizer = recognizer;\n", " }\n", " i++;\n", " }\n", " },\n", " /**\n", " * get a recognizer by its event name.\n", " * @param {Recognizer|String} recognizer\n", " * @returns {Recognizer|Null}\n", " */\n", " get: function (recognizer) {\n", " if (recognizer instanceof Recognizer) {\n", " return recognizer;\n", " }\n", " var recognizers = this.recognizers;\n", " for (var i = 0; i < recognizers.length; i++) {\n", " if (recognizers[i].options.event == recognizer) {\n", " return recognizers[i];\n", " }\n", " }\n", " return null;\n", " },\n", " /**\n", " * add a recognizer to the manager\n", " * existing recognizers with the same event name will be removed\n", " * @param {Recognizer} recognizer\n", " * @returns {Recognizer|Manager}\n", " */\n", " add: function (recognizer) {\n", " if (invokeArrayArg(recognizer, 'add', this)) {\n", " return this;\n", " }\n", " // remove existing\n", " var existing = this.get(recognizer.options.event);\n", " if (existing) {\n", " this.remove(existing);\n", " }\n", " this.recognizers.push(recognizer);\n", " recognizer.manager = this;\n", " this.touchAction.update();\n", " return recognizer;\n", " },\n", " /**\n", " * remove a recognizer by name or instance\n", " * @param {Recognizer|String} recognizer\n", " * @returns {Manager}\n", " */\n", " remove: function (recognizer) {\n", " if (invokeArrayArg(recognizer, 'remove', this)) {\n", " return this;\n", " }\n", " recognizer = this.get(recognizer);\n", " // let's make sure this recognizer exists\n", " if (recognizer) {\n", " var recognizers = this.recognizers;\n", " var index = inArray(recognizers, recognizer);\n", " if (index !== -1) {\n", " recognizers.splice(index, 1);\n", " this.touchAction.update();\n", " }\n", " }\n", " return this;\n", " },\n", " /**\n", " * bind event\n", " * @param {String} events\n", " * @param {Function} handler\n", " * @returns {EventEmitter} this\n", " */\n", " on: function (events, handler) {\n", " if (events === undefined) {\n", " return;\n", " }\n", " if (handler === undefined) {\n", " return;\n", " }\n", " var handlers = this.handlers;\n", " each(splitStr(events), function (event) {\n", " handlers[event] = handlers[event] || [];\n", " handlers[event].push(handler);\n", " });\n", " return this;\n", " },\n", " /**\n", " * unbind event, leave emit blank to remove all handlers\n", " * @param {String} events\n", " * @param {Function} [handler]\n", " * @returns {EventEmitter} this\n", " */\n", " off: function (events, handler) {\n", " if (events === undefined) {\n", " return;\n", " }\n", " var handlers = this.handlers;\n", " each(splitStr(events), function (event) {\n", " if (!handler) {\n", " delete handlers[event];\n", " }\n", " else {\n", " handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);\n", " }\n", " });\n", " return this;\n", " },\n", " /**\n", " * emit event to the listeners\n", " * @param {String} event\n", " * @param {Object} data\n", " */\n", " emit: function (event, data) {\n", " // we also want to trigger dom events\n", " if (this.options.domEvents) {\n", " triggerDomEvent(event, data);\n", " }\n", " // no handlers, so skip it all\n", " var handlers = this.handlers[event] && this.handlers[event].slice();\n", " if (!handlers || !handlers.length) {\n", " return;\n", " }\n", " data.type = event;\n", " data.preventDefault = function () {\n", " data.srcEvent.preventDefault();\n", " };\n", " var i = 0;\n", " while (i < handlers.length) {\n", " handlers[i](data);\n", " i++;\n", " }\n", " },\n", " /**\n", " * destroy the manager and unbinds all events\n", " * it doesn't unbind dom events, that is the user own responsibility\n", " */\n", " destroy: function () {\n", " this.element && toggleCssProps(this, false);\n", " this.handlers = {};\n", " this.session = {};\n", " this.input.destroy();\n", " this.element = null;\n", " }\n", " };\n", " /**\n", " * add/remove the css properties as defined in manager.options.cssProps\n", " * @param {Manager} manager\n", " * @param {Boolean} add\n", " */\n", " function toggleCssProps(manager, add) {\n", " var element = manager.element;\n", " if (!element.style) {\n", " return;\n", " }\n", " var prop;\n", " each(manager.options.cssProps, function (value, name) {\n", " prop = prefixed(element.style, name);\n", " if (add) {\n", " manager.oldCssProps[prop] = element.style[prop];\n", " element.style[prop] = value;\n", " }\n", " else {\n", " element.style[prop] = manager.oldCssProps[prop] || '';\n", " }\n", " });\n", " if (!add) {\n", " manager.oldCssProps = {};\n", " }\n", " }\n", " /**\n", " * trigger dom event\n", " * @param {String} event\n", " * @param {Object} data\n", " */\n", " function triggerDomEvent(event, data) {\n", " var gestureEvent = document.createEvent('Event');\n", " gestureEvent.initEvent(event, true, true);\n", " gestureEvent.gesture = data;\n", " data.target.dispatchEvent(gestureEvent);\n", " }\n", " assign(Hammer, {\n", " INPUT_START: INPUT_START,\n", " INPUT_MOVE: INPUT_MOVE,\n", " INPUT_END: INPUT_END,\n", " INPUT_CANCEL: INPUT_CANCEL,\n", " STATE_POSSIBLE: STATE_POSSIBLE,\n", " STATE_BEGAN: STATE_BEGAN,\n", " STATE_CHANGED: STATE_CHANGED,\n", " STATE_ENDED: STATE_ENDED,\n", " STATE_RECOGNIZED: STATE_RECOGNIZED,\n", " STATE_CANCELLED: STATE_CANCELLED,\n", " STATE_FAILED: STATE_FAILED,\n", " DIRECTION_NONE: DIRECTION_NONE,\n", " DIRECTION_LEFT: DIRECTION_LEFT,\n", " DIRECTION_RIGHT: DIRECTION_RIGHT,\n", " DIRECTION_UP: DIRECTION_UP,\n", " DIRECTION_DOWN: DIRECTION_DOWN,\n", " DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL,\n", " DIRECTION_VERTICAL: DIRECTION_VERTICAL,\n", " DIRECTION_ALL: DIRECTION_ALL,\n", " Manager: Manager,\n", " Input: Input,\n", " TouchAction: TouchAction,\n", " TouchInput: TouchInput,\n", " MouseInput: MouseInput,\n", " PointerEventInput: PointerEventInput,\n", " TouchMouseInput: TouchMouseInput,\n", " SingleTouchInput: SingleTouchInput,\n", " Recognizer: Recognizer,\n", " AttrRecognizer: AttrRecognizer,\n", " Tap: TapRecognizer,\n", " Pan: PanRecognizer,\n", " Swipe: SwipeRecognizer,\n", " Pinch: PinchRecognizer,\n", " Rotate: RotateRecognizer,\n", " Press: PressRecognizer,\n", " on: addEventListeners,\n", " off: removeEventListeners,\n", " each: each,\n", " merge: merge,\n", " extend: extend,\n", " assign: assign,\n", " inherit: inherit,\n", " bindFn: bindFn,\n", " prefixed: prefixed\n", " });\n", " // this prevents errors when Hammer is loaded in the presence of an AMD\n", " // style loader but by script tag, not by the loader.\n", " var freeGlobal = (typeof window !== 'undefined' ? window : (typeof self !== 'undefined' ? self : {})); // jshint ignore:line\n", " freeGlobal.Hammer = Hammer;\n", " if (typeof define === 'function' && define.amd) {\n", " define(function () {\n", " return Hammer;\n", " });\n", " }\n", " else if (typeof module != 'undefined' && module.exports) {\n", " module.exports = Hammer;\n", " }\n", " else {\n", " window[exportName] = Hammer;\n", " }\n", " })(window, document, 'Hammer');\n", " },\n", " /* models/tools/tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const view_1 = require(67) /* ../../core/view */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const model_1 = require(71) /* ../../model */;\n", " class ToolView extends view_1.View {\n", " get plot_view() {\n", " return this.parent;\n", " }\n", " get plot_model() {\n", " return this.parent.model;\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.active.change, () => {\n", " if (this.model.active)\n", " this.activate();\n", " else\n", " this.deactivate();\n", " });\n", " }\n", " // activate is triggered by toolbar ui actions\n", " activate() { }\n", " // deactivate is triggered by toolbar ui actions\n", " deactivate() { }\n", " }\n", " exports.ToolView = ToolView;\n", " ToolView.__name__ = \"ToolView\";\n", " class Tool extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Tool() {\n", " this.prototype._known_aliases = new Map();\n", " this.internal({\n", " active: [p.Boolean, false],\n", " });\n", " }\n", " get synthetic_renderers() {\n", " return [];\n", " }\n", " // utility function to return a tool name, modified\n", " // by the active dimensions. Used by tools that have dimensions\n", " _get_dim_tooltip(name, dims) {\n", " switch (dims) {\n", " case \"width\": return `${name} (x-axis)`;\n", " case \"height\": return `${name} (y-axis)`;\n", " case \"both\": return name;\n", " }\n", " }\n", " // utility function to get limits along both dimensions, given\n", " // optional dimensional constraints\n", " _get_dim_limits([sx0, sy0], [sx1, sy1], frame, dims) {\n", " const hr = frame.bbox.h_range;\n", " let sxlim;\n", " if (dims == 'width' || dims == 'both') {\n", " sxlim = [array_1.min([sx0, sx1]), array_1.max([sx0, sx1])];\n", " sxlim = [array_1.max([sxlim[0], hr.start]), array_1.min([sxlim[1], hr.end])];\n", " }\n", " else\n", " sxlim = [hr.start, hr.end];\n", " const vr = frame.bbox.v_range;\n", " let sylim;\n", " if (dims == 'height' || dims == 'both') {\n", " sylim = [array_1.min([sy0, sy1]), array_1.max([sy0, sy1])];\n", " sylim = [array_1.max([sylim[0], vr.start]), array_1.min([sylim[1], vr.end])];\n", " }\n", " else\n", " sylim = [vr.start, vr.end];\n", " return [sxlim, sylim];\n", " }\n", " static register_alias(name, fn) {\n", " this.prototype._known_aliases.set(name, fn);\n", " }\n", " static from_string(name) {\n", " const fn = this.prototype._known_aliases.get(name);\n", " if (fn != null)\n", " return fn();\n", " else {\n", " const names = [...this.prototype._known_aliases.keys()];\n", " throw new Error(`unexpected tool name '${name}', possible tools are ${names.join(\", \")}`);\n", " }\n", " }\n", " }\n", " exports.Tool = Tool;\n", " Tool.__name__ = \"Tool\";\n", " Tool.init_Tool();\n", " },\n", " /* styles/toolbar.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.bk_toolbar = \"bk-toolbar\";\n", " exports.bk_toolbar_hidden = \"bk-toolbar-hidden\";\n", " exports.bk_toolbar_button = \"bk-toolbar-button\";\n", " exports.bk_button_bar = \"bk-button-bar\";\n", " exports.bk_toolbar_button_custom_action = \"bk-toolbar-button-custom-action\";\n", " },\n", " /* styles/toolbar.css.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const css = `\n", " .bk-root .bk-toolbar-hidden {\n", " visibility: hidden;\n", " opacity: 0;\n", " transition: visibility 0.3s linear, opacity 0.3s linear;\n", " }\n", " .bk-root .bk-toolbar,\n", " .bk-root .bk-button-bar {\n", " display: flex;\n", " display: -webkit-flex;\n", " flex-wrap: nowrap;\n", " -webkit-flex-wrap: nowrap;\n", " align-items: center;\n", " -webkit-align-items: center;\n", " user-select: none;\n", " -ms-user-select: none;\n", " -moz-user-select: none;\n", " -webkit-user-select: none;\n", " }\n", " .bk-root .bk-toolbar .bk-logo {\n", " flex-shrink: 0;\n", " -webkit-flex-shrink: 0;\n", " }\n", " .bk-root .bk-toolbar.bk-above,\n", " .bk-root .bk-toolbar.bk-below {\n", " flex-direction: row;\n", " -webkit-flex-direction: row;\n", " justify-content: flex-end;\n", " -webkit-justify-content: flex-end;\n", " }\n", " .bk-root .bk-toolbar.bk-above .bk-button-bar,\n", " .bk-root .bk-toolbar.bk-below .bk-button-bar {\n", " display: flex;\n", " display: -webkit-flex;\n", " flex-direction: row;\n", " -webkit-flex-direction: row;\n", " }\n", " .bk-root .bk-toolbar.bk-above .bk-logo,\n", " .bk-root .bk-toolbar.bk-below .bk-logo {\n", " order: 1;\n", " -webkit-order: 1;\n", " margin-left: 5px;\n", " margin-right: 0px;\n", " }\n", " .bk-root .bk-toolbar.bk-left,\n", " .bk-root .bk-toolbar.bk-right {\n", " flex-direction: column;\n", " -webkit-flex-direction: column;\n", " justify-content: flex-start;\n", " -webkit-justify-content: flex-start;\n", " }\n", " .bk-root .bk-toolbar.bk-left .bk-button-bar,\n", " .bk-root .bk-toolbar.bk-right .bk-button-bar {\n", " display: flex;\n", " display: -webkit-flex;\n", " flex-direction: column;\n", " -webkit-flex-direction: column;\n", " }\n", " .bk-root .bk-toolbar.bk-left .bk-logo,\n", " .bk-root .bk-toolbar.bk-right .bk-logo {\n", " order: 0;\n", " -webkit-order: 0;\n", " margin-bottom: 5px;\n", " margin-top: 0px;\n", " }\n", " .bk-root .bk-toolbar-button {\n", " width: 30px;\n", " height: 30px;\n", " cursor: pointer;\n", " background-size: 60%;\n", " background-color: transparent;\n", " background-repeat: no-repeat;\n", " background-position: center center;\n", " }\n", " .bk-root .bk-toolbar-button:hover {\n", " background-color: rgba(192, 192, 192, 0.15);\n", " }\n", " .bk-root .bk-toolbar-button:focus {\n", " outline: none;\n", " }\n", " .bk-root .bk-toolbar-button::-moz-focus-inner {\n", " border: 0;\n", " }\n", " .bk-root .bk-toolbar.bk-above .bk-toolbar-button {\n", " border-bottom: 2px solid transparent;\n", " }\n", " .bk-root .bk-toolbar.bk-above .bk-toolbar-button.bk-active {\n", " border-bottom-color: #26aae1;\n", " }\n", " .bk-root .bk-toolbar.bk-below .bk-toolbar-button {\n", " border-top: 2px solid transparent;\n", " }\n", " .bk-root .bk-toolbar.bk-below .bk-toolbar-button.bk-active {\n", " border-top-color: #26aae1;\n", " }\n", " .bk-root .bk-toolbar.bk-right .bk-toolbar-button {\n", " border-left: 2px solid transparent;\n", " }\n", " .bk-root .bk-toolbar.bk-right .bk-toolbar-button.bk-active {\n", " border-left-color: #26aae1;\n", " }\n", " .bk-root .bk-toolbar.bk-left .bk-toolbar-button {\n", " border-right: 2px solid transparent;\n", " }\n", " .bk-root .bk-toolbar.bk-left .bk-toolbar-button.bk-active {\n", " border-right-color: #26aae1;\n", " }\n", " .bk-root .bk-button-bar + .bk-button-bar:before {\n", " content: \" \";\n", " display: inline-block;\n", " background-color: lightgray;\n", " }\n", " .bk-root .bk-toolbar.bk-above .bk-button-bar + .bk-button-bar:before,\n", " .bk-root .bk-toolbar.bk-below .bk-button-bar + .bk-button-bar:before {\n", " height: 10px;\n", " width: 1px;\n", " }\n", " .bk-root .bk-toolbar.bk-left .bk-button-bar + .bk-button-bar:before,\n", " .bk-root .bk-toolbar.bk-right .bk-button-bar + .bk-button-bar:before {\n", " height: 1px;\n", " width: 10px;\n", " }\n", " `;\n", " exports.default = css;\n", " },\n", " /* styles/icons.css.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const css = `\n", " .bk-root .bk-tool-icon-replace-mode {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH5AUFFxokK3gniQAAAHpJREFUWMNjXLhsJcNAAiaGAQajDhhwB7DgEP+PxmeksvjgDwFcLmYkUh2hkBj8IcBIZXsYh1w2/I8v3sgAOM0bLYhGc8GgrwuICgldfQO88pcvXvg/aOuCUQeM5oLRuoCFCJcTbOMh5XOiW0JDNhdQS3y0IBp1ABwAAF8KGrhC1Eg6AAAAAElFTkSuQmCC\");\n", " }\n", " .bk-root .bk-tool-icon-append-mode {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH5AUFFxkZWD04WwAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAAoUlEQVRYw+1WQQ6AIAwrhO8Y/bIXEz9jIMSDr8ETCUEPQzA4pMeFLKNbu4l5WR0CDOMEALBGIzMuQIBEZQjPgP9JLjwTfBjY9sO9lZsFA9IafZng3BlIyVefgd8XQFZBAWe8jfNxwsDhir6rzoCiPiy1K+J8/FRQemv2XfAdFcQ9znU4Viqg9ta1qYJ+D1BnAIBrkgGVOrXNqUA9rbyZm/AEzFh4jEeY/soAAAAASUVORK5CYII=\");\n", " }\n", " .bk-root .bk-tool-icon-intersect-mode {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH5AUFFxkrkOpp2wAAAPhJREFUWMPtV1EKwjAMTUavI3oawR/vtn5srJdREfzwMvHHQlcT2mpdMzFfWxiP5r2+JMN+mAiCOB72CABgR1cln4oOGocJnuMTSxWk8jMm7OggYkYXA9gPE3uyd8NXHONJ+eYMdE/NqCJmEZ5ZqlJJ4sUksKN7cYSaPoCZFWR1QI+Xm1fBACU63Cw22x0AAJxudwrffVwvZ+JmQdAHZkw0d4EpAMCw8k87pMdbnwtizQumJYv3nwV6XOA1qbUT/oQLUJgFRbsiNwFVucBIlyR3p0tdMp+XmFjfLKi1LatyAXtCRjPWBdL3Ke3VuACJKFfDr/xFN2fgAR/Go0qaLlmEAAAAAElFTkSuQmCC\");\n", " }\n", " .bk-root .bk-tool-icon-subtract-mode {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH5AUFFxgsF5XNOQAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAABFUlEQVRYw9VWUQqDMAxNpWfxQxD1MoP97G7zQ5mH2RTZYLtM9lWoMbXtxLXNX4OG9r28l4hrd0PQoqxqAACYpxH25C/nkwCHyCBwSPoS09k1T5Fo+4EiExcC4v584xGFmyIXHBLRISAVZyZufUPVa4rcrwmPDgr93ylo+2GliLRUYHK6th/o/6r7nfLpqaCsagEA8Hh9FmcNKeRmgeYDC+SCq0B6FFi8/BcV6BdR9cL3gCv3ijPKOacsn3rBEcjmaVxpfGcg4wHxzgJJnc6241Hn23DERFRAu1bNcWa3Q0uXi62XR6sCaWoSejbtdLYmU3kTEunNgj0bUbQqYG/IcMaqwPS9jftoVCAQ0ZVDJwf0zQdH4AsyW6fpQu4YegAAAABJRU5ErkJggg==\");\n", " }\n", " .bk-root .bk-tool-icon-clear-selection {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH5AUGEhcuan3d3wAAAoRJREFUWMPtlzFP3EAQhd+b3TNSzg0N5TWXLkJQUUaKhIQ4fgP/g5ArrriE/I3opEgRrZtIVJR0FJQ010SioUmEZHtnUpwN9gWHGA5BJCy58MraffvmfZ41v3z9hqe8BE98vQh4cgG+Ydzmnrng8efvQJNi/uN7dznx/B3ggtfhf4ehNdUttRzBDIm/2VTiiWCG1HK0nc+3UWtq8BQIiEEakEQOADBIA4QCQmBqoHBhFNR27ikQSmGdYCdTqCpEHMDZmEKRWUBEv1gBDg5SzRJnpopILWICgWuRYflLamuzxB2BmtYqSRIka5VWU8QduXO+1hRc5YZu5GAwmP2ZJzND0IBu5HCV2+NQcAhAVRsnC2IbPzPdSjzd6to6VtfWkXi6YLaVWr7xoAwkfpb8MnC3SH7rKSMBe4M0jA/OTicFIbtCGRIyNbURhcf3ErCd6YwA1m0HgAxhw1NGQnlXBHG4kylVlSJuH0RfIP2CkL2I/qS1gIAAQiBl1QwFggIHtyxgrxK5PgyfC0JWKoT0HLh8LwoietB4TYKaIl7yeNURxB05UtMxDOcVQlZIrlRKdK6m47gjR/fuBRQihyLArtNeJD50Izcx2Eczu7iFkIug4VM3cpOr3MKDekFED0fWUHv9Zq0kpLnridjhY3XDg7NTN0jDrhO3X7O9Wg7wwyANu4mnayNg3gmbu0tCNoUyBNGv2l4rB9EXynA7082FOxAQLhU6rQVO9T2AvWowFToNCJcPORGxIRcnpjZSKATSU9NxvOQnAPArDSaQoUKnNI4iufkGtD4P3EHIcWZhz4HLceSOyrR3Izf5memPAL2cX3yhAkonysZVaWLBkd9dw1Ivv2a/AYPkK+ty1U1DAAAAAElFTkSuQmCC\");\n", " }\n", " .bk-root .bk-tool-icon-box-select {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEg0kduFrowAAAIdJREFUWMPtVtEKwCAI9KL//4e9DPZ3+wP3KgOjNZouFYI4C8q7s7DtB1lGIeMoRMRinCLXg/ML3EcFqpjjloOyZxRntxpwQ8HsgHYARKFAtSFrCg3TCdMFCE1BuuALEXJLjC4qENsFVXCESZw38/kWLOkC/K4PcOc/Hj03WkoDT3EaWW9egQul6CUbq90JTwAAAABJRU5ErkJggg==\");\n", " }\n", " .bk-root .bk-tool-icon-box-zoom {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEg82t254aQAAAkBJREFUWMPN11+E1FEUB/DPTFn2qaeIpcSwr5NlUyJiKWVXWUqvlUh/iE3RY9mUekkPPURtLKNRrFJEeuphGfUUaVliiX1aVjGs6aG7+XX9ZnZ+d2fTl2vmnHvPPfeee/79Sk+may2/UQq/q7Qu+bAJoxjHIKqB/wlfUMcMVqI9bLZ+DGIKwzlzQ2GcxCx2xwvKOUKlaHTiX8bHNspjDONHkOmJBW5jIof/FvPh/06MZOb6cRc7cGn1AKUE5cdzlM/gAr5F/O24H3xkFRfxAbVygvK+cIsspjGWo1zgjeFpxL+BvnLw7laBA4xjIFJwrgu52DoVjKdY4HBEX8dSF3JLYe1fe6UcYCii3xWQjdfuSTnAtoheKCC7GNED5Zx4L4qt61jbTLHA94geKSC7P7ZeShQ0Inoi1IJuEOeORooFXkV0FZNdZs5qvFfKAeqYy7nZ6yg//HG0MBfffh71lFrQDCW2EvEP4mt4okZUDftz9rmGZkotmMxJRtlisy+MTniAWrty3AlXw0hFM2TD89l+oNsoOJXjbIs4EpqNtTCLXbiZ0g+M4mFObj8U3vsNjoZCVcmk60ZwthpepLZkB/AsivWfOJZxtpUQHfWib7KWDwzjeegBZJSdKFiE2qJTFFTwElsi/unQ/awXrU4WGMD7nOJxBY/1EO2iYConq93CHT1GOwucjdqnRyFz+VcHmMNefMY9nNkA3SWUOoXhQviSWQ4huLIRFlirFixnQq/XaKXUgg2xQNGv4V7x/RcW+AXPB3h7H1PaiQAAAABJRU5ErkJggg==\");\n", " }\n", " .bk-root .bk-tool-icon-zoom-in {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEgsUBmL8iQAAA2JJREFUWMO9l12IlFUYx3//MzPrLpSjkm5oN4FFIWVEl66IQlFYwtLOzozsjHdGRSCRF0sfBEXRVV0FQuQiLm5CZNBFgRRaRLVFhbJ2EdiN5gbK7toObTPn6eYdPTvNzPvOBz5Xh/ec5/n/n89zXtEHmZqeSXSuXBz/3zfdKvBWJHQrwZuRcP0El+QkbQXeBX6WZEgm6TtJk5lM5o4Lc+cV6qpf4Ga20Tm338zeATItVK9Ker6yvPzp4NDQ3+XieGsCU9MzTYumGbhz7m4ze9/MHgvBgItACrgfGAj2jgAvAYs3wlEujjc13kii8YyZrXXOfWhmo9GnFUlvOOemarVapVqtkslksmb2KjARqL62ecuWN9NxbRInzrldAXhV0uFSIfdew7G/gNLU9MwS8CwSmE3Oz88fcXG5blfpqVRq0Ix8VIAAX0XgrVL7HDCHGcCaWrV60LUBN8Dae58aQIxEqcA592I9M610JL0cpG/U9TIHJNKY3RV5z0R+7Nd4HZ0P1g/2RMBuegLAsRMnb4vT8d5vqKfMzOgtAlADrkmqGywmiMBTwfr3dC9j1Xv/r6Tvg/5/5ejxE6cO7M9faVbQZrYNOFSPmqQvVo9FKexvi5uWX58943aM7DwAfBDY+FbSCxP5sdkGx55GeguzrUEXPaSo2pFkAbiSZQCAzZJOmdkjwd6SpB/M7KykQTPbA2wDhoIzRzcNDx9MJwGNIXdJ0mEzmwbujL7dbma7gd03A7lKfnTOvf74nl0r6bonTUbujRSUCrm2d4L3/kvn3JPe+8+BDW2i9o+kT7z3kxP5sYsA6W47oE64TsR7P9tQL4vA2mh9WdIscKxUyJ0M7aR7acOGzikD65EQLEjaa2ZXzMwDFeB6qZBbbLTRE4EGeSaozNOZgYFf8qP7lmIvs354n0qlHpB0T7B9Ogl4IgJJrmjv/SiQjbrkD+BMUkfSbYATPdckrTOzkciWAXOlQu5cYgLdPEIapud9wMOR9zVJH3ViKx333mtHMJvNuoWFhZ3A+ojMcja77njXBEKwJJfTcqUyCIQ34Mf7nnh0paMnXacFuGoC1mr3AtuDfLzd8Zuyl+rfuGn4HLAD+Az4qZQf+61TAj0Noj8vX6oC35SL43u7teG6rf5+iXppwW7/JUL5D03qaFRvvUe+AAAAAElFTkSuQmCC\");\n", " }\n", " .bk-root .bk-tool-icon-zoom-out {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEgsHgty9VwAAA0FJREFUWMO9l09oXFUUxn/fmXlpItppi22k7UJBRSlVkCytSAuKUloIdjKT0El3FXVXdVFKRVAQV7qQohsNwdA0UFvBhYtqUVyIVlRaogtFQVq7qSTVjA3z3nHzBq/jvPmTN/Ss7rv3nvN99/y794kByMzcfE/7picn/jenmwWeRUI3E7wdCRskuCSTdDfwBvCtJEdySV9KOhpF0e0/LF5SqKtBgbv7ZjObcvfXgShD9Zqk5+orKx8Oj4z8NT05kU1gZm6+bdK0Azezu9z9hLs/HoIBvwAF4H5gKFh7B3gBWFY3460kWve4+3oze9fdx9OpVUmvmNlMHMf1RqNBFEUldz8OHAxUX9q6bduryut+Sfvc/Wz62ZD0fK1afjND9y3gGSRwv1GMojstTxUUCoVhdyopEYDzKXjWwZ4FFnEHWBc3Goet00m7lZlZYQixKw0FZnakGZksHUnHgvCN5/KARBH37enpOVg58H13HV0Kxg/kIuD/ngSA2ZMLt3bTSZJkUzNk7k4+D0AM/CGpaXCyBw/sC8Y/qZd2GpZiuL9YLN4Sx/HpoP5/c/exQ1OVq+1yyt13SLoArEsJnMjlgfOffvK3u58Kprab2QezJxfG2iTzUzI70wRPG9jbmpmb95SNB9mpzp7/j2yVdNbdx4K565K+cvfPJQ27+x5gBzAS7Hlvy+jo4WIvoC3kWpcvS3rR3eeAO9K529x9N7C7zX6AC2b28hN7Hl1Vt44niVq13LUjmtlYkiQfA5s6eO+GpDNJkhw9NFX5ueNt2ARodyF1IHIN2JiOl4H16fiKpK+B2Vq1vBAqFAf4IJkGNiIhWJK0192vunsC1IE/a9XycquNXARa5OnApeeioaHvKuP7r3dTGsiLqFAo7JR0T7B8rhfwXARa2us4UEqr5Ffgs151i/08oTNKdIO770ptObBYq5Yv5ibQq/sl3Qc8lJ4+lnSqH1vFfp9koZRKJVtaWnqkWXqSVkqlDe+vmUDWpZMlK/X6MBDegKf3P/nYaj8ErN9fqZBYEsf3Ag8G8Xit33BaniTcvGX0IvAw8BHwTa1y4Md+CeRqRL9fudwAvpienNi7Vhu21uwflOT+L+i1X2TJP57iUvUFtHWsAAAAAElFTkSuQmCC\");\n", " }\n", " .bk-root .bk-tool-icon-help {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAABltpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iCiAgICAgICAgICAgIHhtbG5zOmV4aWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20vZXhpZi8xLjAvIgogICAgICAgICAgICB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIKICAgICAgICAgICAgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiCiAgICAgICAgICAgIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIKICAgICAgICAgICAgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIj4KICAgICAgICAgPHRpZmY6UmVzb2x1dGlvblVuaXQ+MjwvdGlmZjpSZXNvbHV0aW9uVW5pdD4KICAgICAgICAgPHRpZmY6Q29tcHJlc3Npb24+NTwvdGlmZjpDb21wcmVzc2lvbj4KICAgICAgICAgPHRpZmY6WFJlc29sdXRpb24+NzI8L3RpZmY6WFJlc29sdXRpb24+CiAgICAgICAgIDx0aWZmOk9yaWVudGF0aW9uPjE8L3RpZmY6T3JpZW50YXRpb24+CiAgICAgICAgIDx0aWZmOllSZXNvbHV0aW9uPjcyPC90aWZmOllSZXNvbHV0aW9uPgogICAgICAgICA8ZXhpZjpQaXhlbFlEaW1lbnNpb24+MzI8L2V4aWY6UGl4ZWxZRGltZW5zaW9uPgogICAgICAgICA8ZXhpZjpQaXhlbFhEaW1lbnNpb24+MzI8L2V4aWY6UGl4ZWxYRGltZW5zaW9uPgogICAgICAgICA8ZXhpZjpDb2xvclNwYWNlPjE8L2V4aWY6Q29sb3JTcGFjZT4KICAgICAgICAgPHhtcE1NOkluc3RhbmNlSUQ+eG1wLmlpZDpBODVDNDBDMzIwQjMxMUU0ODREQUYzNzM5QTM2MjBCRTwveG1wTU06SW5zdGFuY2VJRD4KICAgICAgICAgPHhtcE1NOkRvY3VtZW50SUQ+eG1wLmRpZDpBODVDNDBDNDIwQjMxMUU0ODREQUYzNzM5QTM2MjBCRTwveG1wTU06RG9jdW1lbnRJRD4KICAgICAgICAgPHhtcE1NOkRlcml2ZWRGcm9tIHJkZjpwYXJzZVR5cGU9IlJlc291cmNlIj4KICAgICAgICAgICAgPHN0UmVmOmluc3RhbmNlSUQ+eG1wLmlpZDpBODVDNDBDMTIwQjMxMUU0ODREQUYzNzM5QTM2MjBCRTwvc3RSZWY6aW5zdGFuY2VJRD4KICAgICAgICAgICAgPHN0UmVmOmRvY3VtZW50SUQ+eG1wLmRpZDpBODVDNDBDMjIwQjMxMUU0ODREQUYzNzM5QTM2MjBCRTwvc3RSZWY6ZG9jdW1lbnRJRD4KICAgICAgICAgPC94bXBNTTpEZXJpdmVkRnJvbT4KICAgICAgICAgPGRjOnN1YmplY3Q+CiAgICAgICAgICAgIDxyZGY6U2VxLz4KICAgICAgICAgPC9kYzpzdWJqZWN0PgogICAgICAgICA8eG1wOk1vZGlmeURhdGU+MjAxNjoxMToyOCAxMToxMTo4MjwveG1wOk1vZGlmeURhdGU+CiAgICAgICAgIDx4bXA6Q3JlYXRvclRvb2w+UGl4ZWxtYXRvciAzLjY8L3htcDpDcmVhdG9yVG9vbD4KICAgICAgPC9yZGY6RGVzY3JpcHRpb24+CiAgIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+Cphjt2AAAAT7SURBVFgJxRdbaFxFdGb2bhui227BWrsVKYgf2kJUbP9EUPuzEB803WTXJjH61Q/7Ya1+CMYKEVTsh4J/EpvY7BoabUiNiA8s1p+4KIhpoUUEselHqyS76TbZ3HuP58ydc3d2u4+IkQxczpz3mZkzZ86VYpXjvenpjZsLhUcliE4AuUuASAgptmt1EFdwPiclzIIUUwubNn17OJlcXo1p2UpodHRiux9xB1Eug1+slbzhFxGOKc851tu7/0oznYYBDA8Pt0U2tL8KQryIq2tvZqQhD0QJHRz3yqWhgYGBpXpydQMwqz6NCnurleCSADkJEfgKfOePqL80R/wV1ZaQyr1LenKfkPCkEPKeaj0xg7vxVL3duCmA0Vyuw/fl52hgBxsBED+h4Cv9z3R/zbRm8MTJTx7HQN7GQB6w5C4L4SX7M5lfLBpurjXMyvNIShiyi0l1pL8n9b7EDGPR8fHxzSsQ6XDB3618/xqo6Pk25V5MpVJllgHM1BO58RdQ612kOYZ+GXdij70TYQB05mpj+1kU5G2fB+l3PZtOf8NGx6ambnMXb3yAxg8wjSEG6OKKR9oicBQD+ZvpH2Wzj0lQpxCPG9qMv1x6hHNCsSAlHM7ZOa682vlI9tRDbvHGbD3nZAPpDoD/3JIrLpAs26UFkC3EMUA99hpfGtEBfJjNJnS2Gwnadnvl+Xw+iuc3DAJuNyIaSCHpilVldyDjjUxj3WDZIAhxhHHyRcdNuA7AAfUaXzVKODpzFiZ4/uLvh5G+m2no+C/pyIf7MqlEJB7bpqR6nXkEUfbeawuLaZsW2ISfNQ2vtaktQlGFQyIVGT0o2+2EC4iQNGwjBIN9qdQ5Qg4mk4X4rW3vCClLtowE2FOFUxKDfNmiZci3ovKKRFPh4FK9q4Zbdr+lKKJiA13TcHR2dmLBgdmQ0GAS2MZaEowY+XbAk09IvgtYZGp16SyvFhaHcIUh645t8T9DBCcnz5zZ4hZLu3DzK2QlL1QQa0Y+pHiJKPSuOGj3PmZTheM5w2TwqBxnvBZOTk7G5gvXJ5Aelms8wnJURL+olSWcfEhf6gDoUXPMq6ZlqbzWU2pE+3hi4s6F68tfIj9cBMlikr7Z0/P0b/X0yIcUXsDCF1WhtL4OROHaXk+xlkbV0Cu732Nmhc4peaWSg73pA8dq5RkvO37ldUTfXCKZv2q45MkhvG87WQEzpCCUSvV1d9GONBy3lMvgKSwrZig8gjAietWY0QriylO2jIo4yVbOSb7KB/qmI9BPKjHpSSXYauRyn92Nq9/Kcrj13x3s3v8D481glQ/0raiNYgX9njPSBOImbrHZePl+tfFmc9sH+Xaoh8NjOKSVdDMhjjYzQLy+dFceH5+IJQf9VYXX4tROg4ZFU8m31M3mfPEqUoJqCGJfvWpo2xnNfdrhC28n06SCeSzNZxlvBINGRXCtKS7EY1uV6V7HWAm38y1cXaXsMcOCvr9ySPj+af7A1U2HJXHzVNvUXVLIGyPf+jV0pf8GHoN+TLAyPkidTCi2RpPApmnR0Bd1zGRaB/B8Oj2HSw7LLbVR1MmskW8RdEWVXSJf3JbpAMgRtc4IZoxTh9qotQjCasm46M0YX9pV1VmbpvRH5OwwgdRtSg2vKaAz/1dNKVtb17Y8DCL4HVufHxMOYl1/zTgIgiYvBnFKfaNp3YjTdPz3n9Na8//X7/k/O1tdwopcZlcAAAAASUVORK5CYII=\");\n", " }\n", " .bk-root .bk-tool-icon-hover {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEg4oVHp0SwAAAQJJREFUWMPtlsENgzAMRb8RQ5VJItFDOgaZAMaAA0iZpN3KPZSoEEHSQBCViI/G8pfNt/KAFFcPshPdoAGgZkYVVYjQAFCyFLN8tlAbXRwAxp61nc9XCkGERpZCxRDvBl0zoxp7K98GAACxxH29srNNmPsK2l7zHoHHXZDr+/9vwDfB3kgeSB5IHkgeOH0DmesJjSXi6pUvkYt5u9teVy6aWREDM0D0BRvmGRV5N6DsQkMzI64FidtI5t3AOKWaFhuioY8dlYf9TO1PREUh/9HVeAqzIThHgWZ6MuNmC1jiL1mK4pAzlKUojEmNsxcmL0J60tazWjLZFpClPbd9BMJfL95145YajN5RHQAAAABJRU5ErkJggg==\");\n", " }\n", " .bk-root .bk-tool-icon-crosshair {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAADEUlEQVRYR81XXVIaQRCeHqug8CXmBNETaE4gniDwIgpVspxAbxC9ATkBkCpQ8gKeQDiB5AQxNyAvUlrldr7eHxyGXZi1rMJ5opbp7m++7un+htSGF204vsoMoNXrlzSpfWa1oxQfhAegCZGaEtPorHo8znIoJwCt6+td8uk7ApUQCIHTF4BNAWzImq8ap6cP68CsBdDp9i9ZqXM7ML79g/EnCWD+jgMKENKqWT+tXK0CkQqgNRjs0OxpQIqKhoMxaG6/6JeRnK7T6yO2UvVqhYSlLX+ryORfgKn9ORDFIy7ky41yGcwsr0QAQfDH5zucOswx819fs4egI9OFCcD8DjBF7VNbEX0JzdWEt3NHSSASAcCxBDqMgt/623kvyTgNgNjJIfTjk4D4FqaJR1715MjmYAmA5Bx3AwUXQL+t105KaTlcBSC26XRvhjEIoLiq1yqXpr8FAGG16/ug4IT27fxBWu7EiQuAiImJpEMKE6nYM30uAIDDttSUOPfJP7JzbjPhAiBIh9QE67vIvoOi9WJfCwDavf40ulpjbCqmUf+W753ezURuh7Dg1SqflwAEHU6pgfyBq9Y4qx0LG++2fnZ/eUzcstmdM2AWH+jfc+liWdBJfSENf8Lifi3GVwC9mybOfi5dzatWVrbbLIHNva8p5h/16gkaFiLGGxbufkoE6XguwePiXLF3XmMfCUCUAqtKXU7sumd1CowOuJEi3Pg1FBpjitIGhyvVSfvmjci6ZR+rFQfDiPVE2jFYeICQ+PoewwjC5h7CZld6DBdyu6nDSKgzOyIMhmhK5TTqXYbRorZYM46TmpKAAOrGWwSJJekSB1yqJNOzp1Gs7YJ0EDeySDIMtJbQHh6Kf/uFfNFZkolJICRmz0P8DKWZuIG2g1hpok+Mk0Qphs0h9lzMtWRoNvYLuVImUWrmPJDlBKeRBDfATGOpHkhw670QSHWGLLckmF1PTsMlYqMJpyUbiO0weiMMceqLVTcotnMCYAYJJbcuQrVgZFP0NOOJYpr62pf3AmrHfWUG4O7abefGAfwH7EXSMJafOlYAAAAASUVORK5CYII=\");\n", " }\n", " .bk-root .bk-tool-icon-lasso-select {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEgwlGP1qdAAABMBJREFUWMO9V1uIVVUY/r61z57ZMx4DnbzgkbQXL5iCJphlWdpIGY4jpFBkEiU9ZNaDRRcITcIwMwgxoQtU2IMXdAZfMjFvpERXYiSbysyBEXFmyuHMnLP32uvrwT2xnY5nxvHQ93Jg7fWv71/r//7L4a59TRgqJk+Z6v3a+sv0OI5nk5wu6VaSVZImAThHsgjgrKTvM5nMUWvtmf5n8HodCIKgOgzDhc65pSTrJQWDsSNpJX1ljHnDOfdT37oZLLHv+8OMMasKhcIJ59xHAJYMlhwAJGUAzJfUTHLFuFzOG5QDU6dNMyQfs9Yedc5tBpAD4IYYNQGoBrDtQnt7/b0LFrJsCHzfn2itfQfAnZLiazytA3AaQAuAiwDaEgeNpGkkswAWSBqRONB38b88z5uTKePt6iiKXkk8jq+iJC5LOmiMaTLGHLPWhmWeHr7vV0dRtATAapAzIVmSo51zyzIlbm2stesFPA6pKk0r6Ryg93y/ek8YFvPOOTg3cDSiKCoC2OP7/rEoirYm4rUkF12lAWNM1lr7lqQn0+QA8gI2jBg5cj6Aj8OwmB+KAKIoukhyp6SRJAUgl0ndPLDWPi9pJQCbuviXvu+/GIZhW1dnJ24UJFuTjCCA2ADA8sYGWmsXS3qmL94kDYAtkh4Nw7ANlQJ5U6INT1KrAYC9zQdykl7nFSj5fXp5Y8NWVBhy7mUAjqShMYdMXV2dJ2klyRwAJ8lIeuGWCRMP7N7frEqSG2OmAFhKshNAp5wrmO7u7jEAngPQm1S2z2pqapr+OPt7XEly0oxwzq2RdFmSD2AMgKKJouhhAL4kA+Cs53l7e3t7uytJHgRBreTWkXwkKVJnJD0B4GAGwIJE9R6AFufc6UqSZ7PZbD6ff5dkA4CQZEHSqwAOISmXtwGIE+F1SeqqIP8d+Xz+C0mLJYWSAODteXffczjdDQNJ0BWMCoLg5gqIbRTJNwHsljQhUb0luWPM2LE7Thw/9m/5NCT/TByxAOYWi8X6/gdWV1dnfN8fNRBxJpMZTXKdc+6IpFVJWAEgkvSJpA0X2tvtVTaSjgOYBCAEEADYSHK87/sfhmEYA9gShuEDkgzJHyWtB/B1irQ2juP7ADxkrX0wOUOpzmdpzEY590HJ7Ni1r2kSyZOSiv2+hSRjSTXp/QAukzySNJOJkmalyNIl10hqMcasdc61XDNcQRD8BnITgNp+36r6kfcNFMMlLQGwTNLMEuQGQBfJl2bdPru+HDkAZAqFQux53jZHEsC6aw0eg2gylNRBcqcx5v04ji999+03AwsWAOI4Lsy9a94WkisAnE5a5WCJYwCfA1g7LJudI2lTHMeXBm1faiQzxkyRtF3S5CTupeAB+KG2tnZFT0/P30NO2VKLzrmfAbwGMipjG5Oc0dPTc0Md05SZ5U4Q2FxChErtEYD7jTGNQ3UgM8Asv90Yc9I5LSKRlXSI5CxJa0jWSALJjKRnAewfkniT+vwf7N7fXHK9rq7O7+jo+BTA/NRrdBpjnnLOnUrvXd7YMPQXSBunneno6IhIHgYwW1JtkgmBpBkATlVMAwOk3nFJ+VSoqgCMr6gIy2FcLtdKspAedyQN/98caDt/3kpyabUmf8WvG/8A1vODTBVE/0MAAAAASUVORK5CYII=\");\n", " }\n", " .bk-root .bk-tool-icon-pan {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEg4lKssI9gAAAOtJREFUWMPVll0KwyAMgNPgoc0JzDX2Mtgp3csKErSamGabIEUo/T6bHz0ezxdsjPJ5kvUDaROem7VJAp3gufkbtwtI+JYEOsHNEugIN0mgM1wtsVoF1MnyKtZHZBW4DVxoMh6jaAW0MTfnBAbALyUwCD6UwEB4VyJN4FXx4aqUAACgFLjzrsRP9AECAP4Cm88QtJeJrGivdeNdPpko+j1H7XzUB+6WYHmo4eDk4wj41XFMEfBZGXpK0F/eB+QhVcXslVo7i6eANjF5NYSojCN7wi05MJNgbfKiMaPZA75TBVKCrWWbnGrb3DPePZ9Bcbe/QecAAAAASUVORK5CYII=\");\n", " }\n", " .bk-root .bk-tool-icon-xpan {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEg4X4hxZdgAAAMpJREFUWMPtlsEKwjAMhr/pwOOedINJe/PobWXCfAIvgo/nA4heOiilZQqN2yE5lpD/I38SWt3uD9aMHSuHAiiAAmwaYCqoM/0KMABtQYDW11wEaHyiEei28bWb8LGOkk5C4iEEgE11YBQWDyHGuAMD0CeS30IQPfACbC3o+Vd2bOIOWMCtoO1mC+ap3CfmoCokFs/SZd6E0ILjnzrhvFbyEJ2FIZzXyB6iZ3AkjITn8WOdSbbAoaD4NSW+tIZdQYBOPyQKoAAKkIsPv0se4A/1UC0AAAAASUVORK5CYII=\");\n", " }\n", " .bk-root .bk-tool-icon-ypan {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEg4anK0lywAAAMVJREFUWMPtlzEKwzAMRX/S7rlpIMXeOnaLaME36FLo8XqCdNFghGljyc4kgQi2Q/SUj0F/eL7eMMTKz6j9wNlYPGRrFcSoLH4XxQPvdQeYuPOlcLbw2dRTgqvoXEaolWM0aP4LYm0NkHYWzyFSSwlmzjw2sR6OvAXNwgEcwAEcwAEcwAEcoGYk20SiMCHlmVoCzACoojEqjHBmCeJOCOo1lgPA7Q8E8TvdjMmHuzsV3NFD4w+1t+Ai/gTx3qHuOFqdMQB8ASMwJX0IEHOeAAAAAElFTkSuQmCC\");\n", " }\n", " .bk-root .bk-tool-icon-range {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAABCJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iCiAgICAgICAgICAgIHhtbG5zOmV4aWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20vZXhpZi8xLjAvIgogICAgICAgICAgICB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iCiAgICAgICAgICAgIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyI+CiAgICAgICAgIDx0aWZmOlJlc29sdXRpb25Vbml0PjI8L3RpZmY6UmVzb2x1dGlvblVuaXQ+CiAgICAgICAgIDx0aWZmOkNvbXByZXNzaW9uPjU8L3RpZmY6Q29tcHJlc3Npb24+CiAgICAgICAgIDx0aWZmOlhSZXNvbHV0aW9uPjcyPC90aWZmOlhSZXNvbHV0aW9uPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICAgICA8dGlmZjpZUmVzb2x1dGlvbj43MjwvdGlmZjpZUmVzb2x1dGlvbj4KICAgICAgICAgPGV4aWY6UGl4ZWxYRGltZW5zaW9uPjMyPC9leGlmOlBpeGVsWERpbWVuc2lvbj4KICAgICAgICAgPGV4aWY6Q29sb3JTcGFjZT4xPC9leGlmOkNvbG9yU3BhY2U+CiAgICAgICAgIDxleGlmOlBpeGVsWURpbWVuc2lvbj4zMjwvZXhpZjpQaXhlbFlEaW1lbnNpb24+CiAgICAgICAgIDxkYzpzdWJqZWN0PgogICAgICAgICAgICA8cmRmOkJhZy8+CiAgICAgICAgIDwvZGM6c3ViamVjdD4KICAgICAgICAgPHhtcDpNb2RpZnlEYXRlPjIwMTgtMDQtMjhUMTQ6MDQ6NDk8L3htcDpNb2RpZnlEYXRlPgogICAgICAgICA8eG1wOkNyZWF0b3JUb29sPlBpeGVsbWF0b3IgMy43PC94bXA6Q3JlYXRvclRvb2w+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgrsrWBhAAAD60lEQVRYCcVWv2scRxSemZ097SHbSeWkcYwwclDhzr1Q5T6QE1LghP6BGNIYJGRWNlaZItiFK1mr+JAu4HQu0kjpU8sgF3ITAsaFg0hOvt2Zyfvmdsa7a610Unx44Zgf773vvfneezPHNzrbhn3CT3xC3wPXYOC8LDzqdi8YY/gwh4BeknS/2th6dr2kf94AOp3OFyWgMyziOPbMDxV9FTtJnl1ut795Xd0/YQ0/vtYQwMT1KXWCfr2IjOWwtNehwN4xL9ykTrm6Pzl58yLn3J+mKh9mXbT3uRjGEDph+O8/TjfP5dBp7Ha7AX7O3o5nZeD/0E/OGyXntDgzA0X6qmCnrVutVlrUWV9f/3xo+pwhGDhvEPHOjoxnZjJggXmMHzBQ7NGNp9vxk61fr0HR7e/u7pZzCGHlc7qwBYYTT7tJYSx1AQzppyFPft5apta9w7SKcn0b7P7+/jCsDQ5mbc0dCmIJGDN0ehdcjsmkm6A6KUeKFOTE11PLxrC7Ukqh3ylL2fT0NAP9q6ur6rRCJJYsbKB0JsbCKMuy+xREePDyxQPCz+Crlw062QcA5wBOOt1l6vIl2WiI9F1fN6Q+BBqit6hEC4Hk08GQJMn4myjSP7RavVxgdaVUh/3U6HCMsPr9pYnJKRziHtWQ+un58+hGs6nsjQSjpuTyKGN3CX+FBwHXSiEVgjP+O8X6N12kIePES+GzTKAkGbNp8yJsGUMVzz8jPKReiyAQRimy5/cjye5RpF8utFp/+nwmT7d/NMzcFkS7yjJNGDaPURQxIQThEQy0SyF4l5WJYYhBa816vZ6dU7A6CAhbZVow/pDe0O9hVOoCi13r4BgBAvJHqMSQL2vE/iH6IAXEwgrRVUmBoRRwnwJQT98xEeVeSUyB4dJ5nwJBKdCFFGRmUCcu7rwIYypCTblaChuNBhWODrman5ub+4v0rMNBt8z6Ezh7GksJQpCbm79cMQE7QBFm/X6f0rjWnv8WRYg/QdbUpwDAEBy8vPyA8rNGzg3a8MiElwiM7dAtRqNoNptjGPM1laVxP9umWEMGLOKhKUOJDtBwDmzsw9fC/CzHr9SGuCTi2LbbKvVtmqXpCjMihBFa79Wrt5fGx9PDzc3fmu32Lf8qFliwU9emKhBSp+kRKn/hu9k1COEDbFdt/BoKWOAkuEbdVYyoIXv8+I/QK9dMHEb1Knb7MHOv8LFFOsjzCVHWOD7Ltn+MXCRF4729vWMDK+p8rLkvwjLg4N4v741m5YuwCI9CvHp1Ha8gFdBoPnQAkGsYYGxxcfEI7QQlFCTGUXwjAz4tWF+EpymOWu7fglE7qsOvrYE6g4+9/x/vhRbMdLOCFgAAAABJRU5ErkJggg==\");\n", " }\n", " .bk-root .bk-tool-icon-polygon-select {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEjc1OfiVKAAAAe1JREFUWMPt1r9rU1EUB/DPK0XbqphFHETo4OCiFhwF0V1KHbRSROLqon+AUMVRRFBwEbRFMBiV+mMW/wIxi5OD1kERRVKRJHUwLvfBTZrU5OWBGXLgQu7Jfe98z/ec7z0vKa88b2q1BDtRHdAPBaylm1NzsxsOjPnPNt6WSWprbft+/c3I3zOAjhT1Y4+fvcjEQJIXnVECSa+AhqIHqlHH5lWCZoe+Gk4GRgDG86j9SAUdlDBSQaZhlOkuHyoVdJmsw98D1S5fM4NYM1LCpqM+Lwa240oLgmZzpVZvzKT75VLZcqksSZKWlQeAy/iORVwIvh31xvotvK7VG3Px4aWHj3Jl4C2uYSvq+Bn8v6LLbaVWb9zsBiKLCvbiNG7gLm7jAYqbPHMJMziZ9lsKoh8GtqCEVVzHftwJn+TFHp4/hg8BSCYVfMOZoPEv2NZGdy9WCGUr9toDR3E2/H4V6nwRe/BmgN65H1ZhvMuB3XiKIyFoGefwO6ysVkUlrNUNsyAK/jli533Q+Y8cJFvAeXyMS1CI/jiMr/gUtD2LQwMGr4R3p7bY3oQHQ5b38CT4D2AXXg6YcQXHpyYnlqKsi5iOAVSwL9zd7zJ09r+Cpwq72omFMazjT9Dnibym0dTkRDUKrrgwH7MwXVyYB38BstaGDfLUTsgAAAAASUVORK5CYII=\");\n", " }\n", " .bk-root .bk-tool-icon-redo {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEg4itK+dVQAAAaFJREFUWMPt1L1rFFEUBfDfJDaBBSslIFjbaSFp1FJQFMVCHkzhKIqdUYOCoBgErVz8rCwiTDMwBCIKipDWyip/gxAIWAmBgBC0eYFh2Gx2l9lFcA5M8e59782Zc84dWrT435Hs1siLchqn43MS0zgW22vYxjesYjVLw3YjBPKinMUTBOwf8J5fKLGYpWFjJAJ5Uc7gIW6jM6Kim3iNZ1katgYmEL/6I+YasvY7Lg6iRpIX5VF8wuEe/XV8wGf8jN6LWTiAc7iEQ7ucPZ+lYW0vAtfwvlbfwCKW9gpXDOv1mJvZHiSO91MiyYsyiQSuxtpXXM7SsDmM5nlRdrCMMz3sOJWl4Xevc/vwBzdwAl+yNNwZxfRI+GxelK9ikHcwh8d4NNR/YFRES1ZwoTYdR7I0rNf3TzVNIGbmSvR/Bx08mIgCFSVu4l2ltIWD9WxNGR+W8KOynqnZ0rwCeVG+wa0hjrxtWoF5dAfc28V8Mib/n+Nev5dnabg/zgw87aNEN/bHOwVRiRe4Wym9zNKwMKkpgIWKEt24njxiJlq0aPFv4i9ZWXMSPPhE/QAAAABJRU5ErkJggg==\");\n", " }\n", " .bk-root .bk-tool-icon-reset {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEg4gWqH8eQAABLdJREFUWMPtlktsVGUUx3/nfvfOlLQaY2IiRRMQIRpI0PjamJhoVASDvNpCpYw1vJQYSVwZwIVQF6wwRHmkAUof9ElrI6VqDAXcID4TF0IiYQMkSlTokNCZ+b7jove2t+NMH7rQBWd3v+989/zP+Z8X3Jb/WGQySvUNTQBJESkNguAVYIWqzhaRhwBU9WcR+QXoymazn6jqzUQiMQSQzWZRVdal1vwzAI2tHQBPOuc2AbWTdOyQ53n7nHNfRwee51GzqoIQMCLDpr3x/tLQ0oZzrk5Vj0/BOEBt+KYuOlBVGlrahr0Wob27t3gEjnZ2AyQzmUwHsDgP6J/AYRE553neDwDOuUdU9QngNeCumK4TkRMhZUORcYC1qysLA6iuSQHIwkWLD6lqapQsuSmwTVV3h99I7EcAR462A2xR2Ilq6ehTaejvO1774kuLNALR33eclsaGsQDe3fYegHl43vyNwEeqGl1963mm2jl7YZRTQ82qlWP4HM6ZToC5ztkW4LHQoALru7s6Di5dvlIj/e6ujrEAWoZDn8hmMjXATMACGaAVuBjXTVVXFc/AxhaA+4zvn1DV+eHxVWPMAmvtb5GeMWZyZVhI2rt7qVy2pOh9U1snwIPW2vMi4oWJuBPYHkVAVScPoKmtkzVVK6cEMsyJraHhiCqJqJUwj/JRz7TW1iSSyR2rVyylqa0Ta+24Ic8vXaAEmDFc/l5Z2A/80OibuVyuz/f9ElUdHCmvw82t5HK5h6y1PYhsz2YyGw43t2KtBZHIGwB6+j4rCkBVUdV7gXrggnPuu8h4eP+xMeZS2D0rJYZ6AdAMzAt1b4nI26p6IFZOY8pugijcKSIHVLUK0LyST4vnrVfnWr3mjmP4QTATaERkXkypRFX3isjmuHdRJEK6Ckqquopp06bdKCkp2Sgi7XnGLcg7gzeutwNIiPYc8HixqIrIOlU9ONVIhHPEd851icgSVXUiskVV94gIqoonIt0i8gfQCfwae38e6BWRXuBZz5jZ8VbaOE4EIqlZVUEQBLlkMplS1QER2RwkEnsSyaREDUzyeNsvIhvCMqkH1kdIJ2o+k8iJB1LVVRfjZ6nqqlEAIbdVQGto8Lrv+/dbawcjAL7vc+6bs+zetetfLSHxniIFGofGGsU2oC7eOCbDfZ7nQawBOSAX74SF9oEPImOq+r7nmVmxb5raukZa8UReGmNmhbMkAwwBH467EYVZe49z7kdgenj8k7V2oTHm8kgdWcvrNdVFjR8cHkYzjDH9wLjDaEwEzpwa4MypgWvAjtjxfGNMj4jMiT+M+kFsZI/Q6Pv+HGNMT8w4wI7TAyevxXVPD5z8+zD64tRXAMHVK1eaVLUyVvuDqroV2BOnJF4ZIedviUidqt4Re9s+vbx8zZXLl7PR2+nl5Tz/zNOFp2FzxzGAklw22wUsLLaSKXwf8vhosZUM6PeDYEUum70VHfpBwKsVyyfeikOP6oBNwN1TrLbfgX3A1kKLzKeff8nLLzw38T5wZDgxn1LnNk5lLRfP26/OnR2hwfNYW2Atn9RCsrf+EECyrKysDFimqhXhyjY3VLkAXBKRDqA7nU6nS0tLhyIj6XSaN9bVclv+l/IXAmkwvZc+jNUAAAAASUVORK5CYII=\");\n", " }\n", " .bk-root .bk-tool-icon-save {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEg4UexUIzAAAAIRJREFUWMNjXLhs5X+GAQRMDAMMWJDYjGhyf7CoIQf8x2H+f0KGM9M7BBio5FNcITo408CoA0YdQM1cwEhtB/ylgqMkCJmFLwrOQguj/xTg50hmkeyARAYGhlNUCIXjDAwM0eREwTUGBgbz0Ww46oBRB4w6YNQBow4YdcCIahP+H5EhAAAH2R8hH3Rg0QAAAABJRU5ErkJggg==\");\n", " }\n", " .bk-root .bk-tool-icon-tap-select {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2hpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYxIDY0LjE0MDk0OSwgMjAxMC8xMi8wNy0xMDo1NzowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo3NzIwRUFGMDYyMjE2ODExOTdBNUNBNjVEQTY5OTRDRSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpCOTJBQzE0RDQ0RDUxMUU0QTE0ODk2NTE1M0M0MkZENCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpCOTJBQzE0QzQ0RDUxMUU0QTE0ODk2NTE1M0M0MkZENCIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M1LjEgTWFjaW50b3NoIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OTQ0QzIwMUM1RjIxNjgxMUE3QkFFMzhGRjc2NTI3MjgiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6NzcyMEVBRjA2MjIxNjgxMTk3QTVDQTY1REE2OTk0Q0UiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6eYZ88AAADLklEQVR42rSXf2TUYRzHv7tuGcfE6Vwb5zLSSjEj7Y9KWqfEmFZJP+yPMdKKmUrrn0iUfjhWlLFi6YfNrF+StBoTo39iYkTGco4xxxG59P7k/T2PT8/37nu3bx9ezvPj+zyf5/PreS78bGLS8SmrwE6yje3NHJsDBTALpknBz6JhH3NiYAB0gHqPOVv52wJ6QQ48BzdAttTioRJjdeA8mAHHS2xuk3p+M8M16ipVQE49Ds6CiFO9RLjGONf05QLx6wPQaBlbBlPgJVgkP0ETiIJ2sB/E1XfimjfgBOOlKDUqCGOcqBcQnw6BYW5YTo4wbvQhMmCfGRemC2rBiGXzWUb+kM/NRZ6CHWBM9ce5R61NgX6ayhSJ5EPlItlDRNkz4JbFHf06BkSzHjXxM+gDv1S/mPUo2AXWgt9UUHL/IVhS8yUV1/EbV3o4N+NaoE9Fu/i827K5pNYHnqAVJECShWmAaddpscYFFXwR7vnXBRGlnUN/L6kqKJlxnRUuDbaDBiL+vst5d4gpcpBrqk/2jIgCKVUolhntplzivHmwh4stGOPfwBWwl/2dpp8p7xjQZqFLiQJtauKkivYm+kzccpK57yXfOUe+P23JqAnVbhMFmlXntCWnxbT31am9ZJ4BJifsUmNTqt0cYhA5ypympPg7VkEKunPbVb8cIG+0kyHLJZNR7fUMooUKFHAPkfQo58VLK+RzwRDd4FdWG9mjpaAXzqkJa1R7kQttqEABWXMjOOxxVRfnhRm5URX1prk/0pQHwNcKlchZ+jdpC+hFdVqO0my9Hj5dkYgCn1Rfh/KdlNDHrJhPqlDih+IfBd6qwpOgEqYMsorJ2HtWxtagLJDn/W3KRfPOZhoeBJfZPgVeGKeKrkQBh5dLXl25Ny3pc4/1fkTdbvFqFQgbxWeYD0hXulhQ0pYiM1jG547fcbMQpVnHTZEn9W3ljsCzwHxCdVteNHIZvQa7/7cC7nV6zHIfyFP9EXjFa7YxKAVqPP4bxhhoLWW+z9JyCb6M/MREg59/RlmmXbmneIybB+YC/ay+yrffqEddDzwGvKxxDmzhc0tc80XVgblqFfgjwAAPubcGjAOl1wAAAABJRU5ErkJggg==\");\n", " }\n", " .bk-root .bk-tool-icon-undo {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEg4em8Dh0gAAAatJREFUWMPt1rFrFFEQBvDfGhACASshkL/ALpWVrSAKEQV5sIULWlgZNSgIFkGIVQ412gkBt1lYLERREFJqJRaW1oHAoZUQsDqwecWy7N3tbe6C4H2wxc682Zn3zTfvLXPM8b8j6RqYF+UCzsfnHBawGt3fMcAX7GEvS8NgKgXkRbmMxwg41TLsN0psZmnodyogL8pFPMIdLHUk7hA7eJKl4U/rAuKu3+HslFr/FZezNPSTFslX8QErDe4DvMVH/Iq9F7VwGpdwZUjsPtaSFjv/1vCBPjaxO0xcNbHejLpZrrlvJCMCT+JzA+2fcC1Lw+GE4l3CG1yIptfjCtiKoqtiJ0vD3aM0Py/K57iIMxgkQxat4EdN7e9xdRzlk+LEEPvDWvIDXJ928sYxjL36icWK+VaWhlezOIqbGFirJd/H7szugrwoX+D2BDEvszSsT5OBdfRaru/F9dPXQF6U27g/KnmWhgctxqyzBrZGMNGL/rHI0nDkKXiKexXTsywNGx0OnFbFNk3BRoWJXnw//j+ivCi32/S8CxPVNiWOAdUiJtXITIqYY45/Cn8B2D97FYW2H+IAAAAASUVORK5CYII=\");\n", " }\n", " .bk-root .bk-tool-icon-wheel-pan {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEgswOmEYWAAABddJREFUWMO9l09oXNcVxn/n3vc0fzRjj2RHyIZ6ERuy6CarxJtS0pQSCsXNpqGFWK5tTHAwyqIGN7VdEts1LV04BEoxdlJnUbfNogtDCYWQRZOSxtAUCoFiJY0pWJVUjeTKM9LMe+9+Xcyb8ZMychuofeHCffeee7/vnXvOuefYlV/+mv932//tb91z/Y2rvxmMHQ+4FcEfOIGN4A+UwDDwoQScc7vM7AIwB8yZ2QXn3K77Ab6OgJnVgeOSbkqaBiaACUnTkm4Cx3OZzwf+qzcRQup1zNZ9RwDe+0YI4YKZTUn6zCGSMLOfAF/03r+QZdnyfwO+ePEiI6N1nPMgMDMkETLRbd2mXG8gCbd9YiIKIUxLKoLfBN7I+80+CUlTIYTp7RMT0b3Af37p8kh5y9gZcy4Fzt+5szqSaxkzUR7dwtrKMmaGW242d0t6vrD/He/90865o865o977p4F3Ctp4frnZ3L0Z+OryUrVSrZ0z8ZxhHjhcq1XPrS43q/0flDlK9XpPA2ma7gMeyvfPx3H8TJZlH4YQWiGEVpZlH8Zx/Awwn8s8lKbpvmq1ahvB641SXNk6dhLskNA2MIBtwKHK1vGTW8bKMRbAMgyPqWeETxUM8VSSJAv52JmZA0iSZMHMThWwnipXKp8hsLLcSaIR92oU8xjSayCQXotiHotG3Ku3m+0EOQwPQCDggMf7BzQajSs5eAk4B5zLx4O1vD2eJMmAQKliscgASJMw21pansFs1swQ/DNLmUmTMNuXX+taXHTDaj5OW612R1JZ0nFJJ/J+XFJ5aWmpA6S5bHV8fHsPHFU6q3pJCjtFxtrKMuXRLUUXXxdrRLazFOtUolZlsGhmACsgnHPTwJnCnjP5HMBKLotzxsTE9rgDL0t6LoriKsDIaB31ZEK+JxQJRHFUBR2NqLw8OTkZR0OC0ntm9k1JWU7OA4vD/mZ+YfElsANmNEKi75vztzB5M8uAr+bx48me88g757PQ1U5zNg52YH7hX8l6f+4Fi3c3BqHNmkI4YQOV2MGCNu9qHPYCewfzbrC+XSGcWEcgTRKA3wFfyzdDz5d+D3x9CIcfA4eBbQS9LscskgfLnHNPAnslvS/pbZDHLLPADpx9N9fqpSIBH8cxWZY9m6bpb4Ev5fN/iKLo2TRNgdx/eo8Wk5O7Ts/N/SOSdMjHdj4kmgkIEJLJzPZKetvMTkIvFLsR25Ml2gfuF5M7vnA66sdooJYkCSGERe/9VAjhzRxoKk3Tvg3U8nulVqvx8cyNpER2umM+SdOkbc5B8JhpqBdIgTRR24h+lpKen731aRIN7thscH9Zlv0d2F8YD2TIX7F2uw3A7ZWV1a0TYz9ca8cJZHRbuRuaDfUCw9/qJHamPOKToAwHtHN6lMvlSkH2o7wDMDo6WuGuQbbn5+YAKNcb3J5fSvrhtTY+vsOPuD1IOyRhMOkj9kSx29HfXB5RUnS964NT2+3vbGbxG9auO2cDNuV6A8NTb5TitBuOpQkfYD2vwOxgmvBB2g3Hto5X42EJyVsFlztbKpXGNgqVSqUxSWcLU2+tdToa9hasLjfPYlwGa+bTi8Dl1dvNsyvNtQQL9MO2w+HM7BqwlAtPdrvdq9773WAVsIr3fne3270KTOYyS2Z2bbXdHhogKmPj7YWF+VOSXs/v/9KdO+0fVBrjbRkgB/KIDBnYu9f/7D+ZmfmRxPd6qwB8YmZXcq1MAQ/nJhTM+OnDe/a8+PGNG9lm19V/D1Qw7HXZlcRa69+U6w38l5/4ipxzf5X0CPBILjcGPJH34pVcc8692FxcXLlXRnTwwH7+9P4f8aWe3fY59LIqo1NMyQBCCHNmdgx4BegUWefjDvCKmR0LIcz9L8nokSNH+PRvH4HC3YQ098pSbevg24qlmZmNmtmjkg4D3+j/tZldkvQXSa3PW5ptlpL3ZaIN99OS9F7+IgKUgSyEkNyv2nHT7DZX0dr9rpjua2l2r4rogRAYVqZvnPsPqVnpEXjEaB4AAAAASUVORK5CYII=\");\n", " }\n", " .bk-root .bk-tool-icon-wheel-zoom {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEgskILvMJQAABTtJREFUWMPdl1+MXVUVxn/fPvf2zrSFmUKnoBCUdjRoVaIxEpO2JhilMYBCtBQS2hejpg1Uo2NUrIFAoyGmtiE+GHwQGtvQJhqDmKYRBv+URFsFDNCSptH60DJTO3dKnX/33rM/H7rvsDu9M20fDMaVnGTvtb69z7fWXmvtc/TEzqd4OyXwNsv/FwFJQVI/sA14SZKRLOlPkr5TrVYXHz70quYkEEK4TtI2YAgYkrQthHDdhV5uuw+43/ZrwCbgRttgY/tjtrc0m83X3/f+D6ydnJhYcB4BSZcBA7aP2d4ELAGW2N5k+xgwkDB0IH19CGGH7R8B1aQeAf4KvAw0ku4K2zu7uru3ApdPEyiKohd4TNKjtjt5h6RHgccSNrddbvuHtm9Jqoak7xVF8WFgdavV+pSk5cCObNmXgK++85prCj3z28HKqZMnH7D9YAY4BvwujT8BvCuL1INX9vVt+dfwcCvNb7f9q2RuSfrGvWu/sL2Nf3LX7pzvj4ENSGBPVarVd4fRkZFltjdmoMGiKO4IIWwIIWwoiuIOYDDzeOPoyMiyFLkum7WJCMDztrcrTTrIRuAQZ6NcK1utL4dWq/VZoC8BhqvV6l1lWb4YYxyLMY6VZflitVq9CxhOmL60hhCKeYiV7WMKIXw9jT1HpXw3c+bOAKzOjJubzebJrKQCQLPZPClpc7bP6rMYKtjXth2OMf7tIkr11Wz8oQDc1Fb09vY+kQw1YAuwJY2nbUluAnCWpKkaFl6IQIzxivaR2SYA89sJVK/Xp2x32R6w/a30DNjuqtfrU0ArYecDCEqgLqm94T0dEm9mBG7PxkdDlkBnkhebgIezNQ8nHcCZPL9ijE1Jf/bZZoPtzbavmqNZLbf9tSxq+yoduuJ+SZ+zXSZyBXCqU+d8fvC5yRUrV+0G2j3g2hDCLyXd/+Su3QdnvP/zCuH72LWsgf2k0oHlH2c2odlkxcpVEdgr6aDtjyb8x20/J+mA7T9I6rL9SWA5dne2/GdXLl58qNJh398An85yTMA+4DOz8Dgu6Zu2dwJXJ91ltm8Gbp7Fgb+EEB4aHhpq5CEtACqVyr3AC0AlPS8k3TSmQ2YPhhBuS/1/LpmS9JTtNTHGfwBU2uUALARotVqniqJYH2Pck85pfavVaufAwnQvnHc0McaDKVptebN94QAnJB0EdtjekydyZXqjs/0ZgLIs/w6sy8bnYGYJ63pgERKC05JutT1kOwITwL9tvzlzUQUYB+Zjs2DBgu6xsbGJZHstByZbezregcBXeCsEz1bnzXt5anLyzLq71zDLxTRdVgemdx0fv2e2w5thO5DbiqL4oKT3ZKpnpyYnz+SY2ZpTAPZmJfdIrVZbNBNUq9UW2X4kU+2dcf53Aj1pj2PA7y/6m1DS00A9za9uNBq7iqJYBuoGdRdFsazRaOzKSqye1rTbaa/tlbYrqXQP2X4FIA9/J1l39xrC0v7+w5IeB8XkwS1lWe6TGJAYKMty31tfO4qSHl/a3384I3CDpI+kzC4lnRfrue6GytEjR8oQwlY73gC0L4qlth/q0M1/LYWtR48cKQF6enrC6dOnVwGLEpnxnp7en4+O1i/tszzGOCTpPmB7ahb57QUwBWyXdF+McWg6MScmuoA8OX8xOlpvXGz422XYTsB/SnpA0h7bX5R0WzI9HUL4qe2XbI+dk3xl+V7gxoztD5jRI+YK/zkEEokx2/uB/RdzIfUtueqVN04cXwF8G3iHY3z9Urw/j8ClyhsnjrcS2Vv/J/8NLxT+/zqBTkcxU/cfEkyEAu3kmjAAAAAASUVORK5CYII=\");\n", " }\n", " .bk-root .bk-tool-icon-box-edit {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEg4QfHjM1QAAAGRJREFUWMNjXLhsJcNAAiaGAQYsDAwM/+lsJ+OgCwGsLqMB+D8o08CoA0YdMOqAUQewDFQdMBoFIyoN/B/U7YFRB7DQIc7xyo9GwbBMA4xDqhxgISH1klXbDYk0QOseEeOgDgEAIS0JQleje6IAAAAASUVORK5CYII=\");\n", " }\n", " .bk-root .bk-tool-icon-freehand-draw {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAADTElEQVRYCeWWTWwMYRjH/88721X1lZJIGxJxcEE4OOiBgzjXWh8TJKR76kWacOBGxdEJIdk4VChZI/phidRBHMRRIr7DSUiaSCRFRM3u88gz+o7Z6bBTdjmYZPf9eJ55fv/5zzvvDPC/H9QsA66Olo9Ga+/MdR+Ljm2/KQIULsz9FqItGdOfJKLhApLgVkiSCGODjWit7QpKWy+TNrFeXvzKVUT8NiTVaIgDcbiCFJ7GiT8WkARXAdYBK0Lbhi/CenArRNskuM7/tgNp4ArQ42dwjf3WY5gWTqC7O/NbNn2Xkfw/YwdSw/We14HP2IEZwX+y9cZ9SH0LmgFP7UCz4KkENBNeV0Cz4b8U8DfgKiDxMWwUXETqLvJpCQpXZfawbzS7t9v5pL19cHBwfja7YA0y/lyCM0+E5hv5+piZXwKYcF23as+37bTXsQVqgkL0p/34fHR7DcBtbetFsBmGDwMOJCggYG55yw7dMlk6DuC1Bdu2RsCU9TYWQq2IoGbsreZ5NzvEqfSBsIsIy8OTbcdgiRHeh4o8AFAEwDakbY2AaCCpH7V9aGhoUUUy3UyVbkPYFuYLDlUZH8XBpwxkK0Dbgxg5HcVi0ent7a0RULMIozaHBSMfF9b2SzdutFcFB2FkwMIJOG6qfteXOa1nHZ48tyefuwyfT9s6wtzZ3t7eZse2DR2I228TtHXzuWCx9g8MtK5cuHCZTH4tiHEOa4xFngvTyS8f35d6enomiCi4/foEXBkZaQuukChL4FYA2Whd7YcC4gEdW3CpdL3LtGAVCVYJywEyTpAuJKeMOKXZs/Bw947C50KhUFOG4cwz35cjWNBlHGeD53n3xsfHP/T19U1qciggar8Fa4I3PHobIotBWBtc2hSiChyZxVzM53Pv7FVH6Tp3uVy+g0r1ImD2GjIrQGYIxjnfuXTZGICS5k/bBwJoubwEFX4TLah9EXomJGMA3za+f9913Yl4TnzsDQ+vE6YTZOjHh4ngibstt1pzQwd04F0bPStEBpXqRoBeQ/AKghfBnOEKgS+Q7z91Xfdz/HGKg8Ox7z8iYD9z6wqTkZFgnvhMGP9VZ2or1XVkPM9z0mytSfVsHa1RLBZbLoyNzUnK+ydz3wC6I9x+lwbngwAAAABJRU5ErkJggg==\");\n", " }\n", " .bk-root .bk-tool-icon-poly-draw {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEjglo9eZgwAAAc5JREFUWMPt1zFrU1EUB/DfS4OmVTGDIChCP4BgnQXRxVHqIJUupp9AB8VBQcRBQUXIB9DWQoMRiXZzcnQSA34A7aAuHSJKkgo2LvfBrU3aJnlYkBy4vHcP557zP/9z3r33JdXa647N0kHSZd5Nn0rSxc8G3cXp85sMcnZZ8vge3osZ+l3vB8CWFA0iL14t79h210swAjACMAIwAjACkB90D/8/GchI9ve4nPwTBh5E9ws7OepzGWb9EddSn51Op9ZstadSg4VK1UKlKkmSDSMLALewiuNh/hVJq71Wxttmqz0dG88vPc+MgWP4grvYG3SLOBrZFFFrttqPe4HIDxh4GSei+98iSlusuYopXEAjBtEPA3tQwUpwluAbDm4TPJUz+BTW9l2Ce6G7L0X/Bw8D3T/7SKKIDzHg7QCcxjvcQAEtXAnrrg/RP0/DKPbqgcN4iVOR7gcO4dcQgRuoh7HSqwlP4n20m63jJu5n8MkWMYfP3UowhzdR8FU8w9iQwevBdyq3/27CMRzAE5yLuvsRLg+ZcR1nJ8YL81HWJUzGAPaFZwe/Q5MdyYDyNHgjzO90YyGHtVDncuiJchaHw8R4oREFV5qdiVmYLM3OgD9k5209/atmIAAAAABJRU5ErkJggg==\");\n", " }\n", " .bk-root .bk-tool-icon-point-draw {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gEMEiERGWPELgAAA4RJREFUWMO1lr1uG1cQhb9ztdRSP7AF1QxgwKlcuZSqRC9gWUUUINWqTh5AnaFOnVPEteQmRuhCURqWsSqqc9IolREXdEvQBElxtdw7KURSFEVKu4w8wAKLxdw9Z+bMnRmZGXfZ29//II8th4WwGVNyIoQLYB5vxA9Caq04iUd9A+7ZlsNC2I7TdSd2hZXMJKlnTqp9jtl/GBaqoyQ0noFKpUIzBicYYc+DEFpxkglc4oVJa5gvDn8v1xV2irG3FM4NSVwjUKlUaMcpJhCGmSEJQ6QGD8M5WnHCd8+f3QCXpPLx8WNwv0j6Bm9FMK7FJ3WBE+R/2t7c/GBmFvSBrzRTCsyTDjXrxUgEMtpxynJYmJoBJ4VAybwVARgvL7Oik0okCodnKpVKX7P0leiVMb0VvbJT+upznK4vh0GIeQwwQStJkHQD3MwsCALTJRG7Qrdrj5m/djgYaIa0hlkRdJk26XEgC9txurccBtVW3IudBImmZuACUP+ZlIDBt9FKcubYNTcAH/X0RYM1E7utJPlqe+uZzPxUcEkiSS4sTT95n15Mud0xWC0o2PAWOCdK3KYZlFxfM+tHOcnMzNr1es18ug+cgsVjP4yBU/Ppfrter1m/+l0+zYygML1xRVHU7TSb1cSzBzoBzszsH+AMdJJ49jrNZjWKou6wBnwOzcyndBpNbuueURR1Dw8Pq35p9cc5p/Dy9Dypt7jXrtdGwQECS9NPhr6Gq6txUzNigE6zydLK6lTw12/KT4FGFEUfJX2YJNONq5tVs4ODA7sD/DnwJ/BoADZuE3tHFs12dna6d4C/BI6AlbyzI8ii2TTw12/KK33gb2cdXsNZoAntbZC2SeO4c9592k/5eNQbiwvFd1kJuFGwLJr1wSPg/SwpvyFBHufOeXcFeAlE97U/uCxOY+P3b+Bn4B3Q+L8EdJfD4a+/AbC4UBzPxiPg3wlHZquB28Cn2IuR9x3gr3uV4DbwfvSDOvi4uFA8BDZmIRHkjHpS9Ht9iRqd8+5G3g05mAGcQbsdiX5QJ428G7Kygo8XYdb1/K4NWVmjzkNge2sz84bs+ELmpDDLtqWsNZBXgvmw8CTtpWVMT7x5YWBjLARnwZfKQNYN2U2LPvrh+5nBt7c2M2/It9bArCTKR8eZN+SJ13AScPnoODeRdqNenH+wul5w2gUr2WUjMFAt8bZ/0axX/wNnv4H8vTFb1QAAAABJRU5ErkJggg==\");\n", " }\n", " .bk-root .bk-tool-icon-poly-edit {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gELFi46qJmxxAAABV9JREFUWMOdl19vFFUYxn9n9u9sCyylUIzWUoMQBAWCMdEEIt6xIRQSLIEKtvHe6AcA4yeQb7CAUNJy0daLeomJN8SEULAC2kBBapBKoLvbmdl/c14vdmY7u91tF95kknPOnHmf95znPc97Ro2OTeBbdjFDT3c32ZxVHUOE9kSMB0/m6ExuoJn1H+ur6Y+OTfD50SMN5168OgrAlyf7CfuD+z7+iDs3p8hkLUQ0iFQ/yFl5Nm/qonfHVva+s32Zw9GxCYILsZ08tpNfBhbs+1YN4OH9+7huGdECSBVfqUosbsllfmauBqiR+cCNwOr7AEo8pPHJnymXykhg5fUWjoQpl0vVvhZhbSzGoUOHqgBlt6B6uruj2Zy1E9jo0fhfeyL2x4Mnc8VErK0KUEOB64JSyptfG4RSytsJjUJVxw2lsFy3urL9nx1Qd25ObctkrVMi+jQivd7U2ZyV/3Hzpq7h3h1b/7p9Y0o8v8rwAbTWrGpSocN/FGDlbAI0Rl23PCBan0Ok158H9Ipwzi25A/Mzc9Gl/BYx/E4kYqC1NKRARNAaDCNUM27Z+Zr+ouXs0q4+LSLBHPYCFkTkC6uU39kwCdsS7WRKmaYUiAhdnZ3MPX2K4+QjQI+C94A93rMzm8ltMwyDeDzWjMZeEb2pYQDdW3vITU2jtUZ5QThOPgm8C7wP7J15OPsBsB3oWpGnVWisCeDS1VHj4vBI92+/3tgB7Ab2AruAXiDBK5oIOkhtkEYRNRuJhObrd8Dl9ewf4D5wG7hVLpen29vb5wzD+BrkbBMaL3d1dk5nsrnlFDTTFWAWmAZueWD3gCemGde2k2fw1Al1YXhEvjozoO49eczdqekrWmsc2zlrmvEKOGoW1GUjFLqSk2KpJrCLwyMCPAP+BO54QL8DM6YZX/ClsP9YnwKkXnIBP4jdIpJRpdJTCYdMwwi98KU0Hjc/dDILNyUcwTCWdOSMJ0TRmBktGRhLugu0xyLk7CIqVNm+0bGJptl1YXikD0grpY4Rjc4a8Fbgdab/6OGbAJeCUuyJnnHmZH9pbSyGuBXV8NUwlUpR1EWyixmSyTWEwqGlJ2Swbo2JXbAAfgDGgGQA9I1A9t1tlq0AxrXxn0ilUpw4fhQqYkH/sT41OTnJJwf2s6FjI5mshdYa7bqVR2uezr9MJmJt14FvGrh/O9D+e6UkM/xyCuCqEKCYnJyUTKFQrZDHjxzGshwWLQcRsOz8Hi85P23id0ug/XilAMLBmm4tPGdoaKjSH5+oAGrhwvBI9SjZTn4QSK9yenoD7dlrExPoJlXW8G8ytpNHxRKk02lGxsdRKFwXLNvx5yY94HQLGhGk4LFCYQSqaE0AwWM1eOoEbR0dKBSW7bC4mKuffxs4D/wCLKwQQPAUzIkslfp6cVomROWSolh0GjldAM4nzDi2k9/i5UAzC9aKfwNJ3zgJg9YEvN6+C7SHgKm69+sD7RfNnKTTaZRPQfAut4oFV//IS7gkcB34VlVo8kGzphlfB+DU+TfNGBpZtRastvrvARJmfMF28ge9sc2B9/PNnCilMIDwK6y8/ow/Ai4kvILTljAXvDvEvrqKSUs60KolzPjBxspavQD2tKqCAGF/Ba+xE/Wbilu54wZV8NEKF5fXzQHl/bh4hUsE0WAXSlDMYcQSrQXgCmsTseXHsJkNnjqBFGwKJaHsKlxtUHYVhbLCzr1kaOA4bcn1y1Swmb+iLpJKpVrfgdpfsiVVCYcgluwgnU7jEgJ4s5UkLFtWYyHyEg0/N1q1tmQH+YXnAMFr97Nmv3p+0QsHQRsF8qpBOE5+rb9Nkaj50tVQKjqh4OU3GNL/1/So3vuUgbAAAAAASUVORK5CYII=\");\n", " }\n", " .bk-root .bk-tool-icon-line-edit {\n", " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAG/3pUWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYAAHjarVdpknSpDfzPKXwEJBDLccQW4Rv4+E4BtXR198znCdeLLijgQUoppWg3//Pv5f6FDwefXJRcUk3J4xNrrKzoFH8+pyUf9/f+8J3C7y/j7jnBGApow/mZ5l2vGJfXCzne8fZ13OV+9yl3ozvx2DDYyXbauCDvRoHPON3frl5Imt7MuX8hH0seiz9/xwxnDMFgYMczUPD7m89J4fwp/iK+OVRbiMf6gm8K4bv/3NN1Pzjw2fvwn+93PLzccTZ6mJU+/HTHSX723/bSOyLi58n8jmiqz/798+a/tUZZax7rNCKOakzXqIcpu4eFDe483kh4Mv4E/byfiqd49R2OHzC1Od/woxLD44siDVJaNHfbqQNi5MkZLXPnsMdKyFy5gwwCHXhocXahhhEK+OhgLmCYn1hon1vtPBxWcPIgrGTCZrR5fHvc58A/fb5stJaFOZEvT18BF1t8AYYxZ99YBUJoXZ/K9i+50/jPjxEbwKBsNxcYqL6dLZrQK7bC5jl4cVga/Ql5yuNuABfhbAEYCmDAJwpCiXxmzkTwYwE/CuQcIjcwQOKEB1ByDCGBnMJ2Nt7JtNey8BmGvIAICSlkUFODgqwYJSbkW0EIqZMgUUSSZClSRVNIMUlKKSfTKc0hxyw55ZxLrllLKLFISSWXUmrRyjVAxsTVVHMttVZVHKpRsZdivWKgcQstNmmp5VZabdoRPj126annXnrtOniEAQlwI408yqhDJ02E0oxTZpp5llmnLsTaCisuWWnlVVZd+mTtsvqVtU/m/po1uqzxJsrW5RdrGM75sQWZnIhxBsY4EhjPxgACmo0zXyhGNuaMM185uBCEgVKMnEHGGBiMk1gWPbl7Mfcrbw7e/V9545+Yc0bd/4M5Z9S9Mfedtx9YG7rlNmyCLAvhUyhkQPrNhvO5AJFnrZIR0plaLL5liQYdDi5TubaIokFDkmoFEB8CzxZVxemssDqthPhUblPgW1iQU5g6XwNwyVI7bUFRm035iNziMkgWvEso2SXnsJfveR0Y4SlVF8YWC1pVQhJiQa8JwDvlMNIxAfq3F7GDObHU1LlhzlZaWwNp6BvACxAgInGXlllMGZCpEnZHrGA6GM2718xuFcz7YdUQxzEEfjdWz4GlkcwaonT0pgA6mB25grPILtnSMhuCpsGhmMU6uJbixJs4lbKHqh+wos1jW2rchyGRCIvN9MXu+KAmMSfAlIKVvi/tybhCPJZCu2Ow9pLdyo427+X2ovMBmKNu8PA0zgl3fS0PB1DWWkVYB47bkyiJHhkFPzTzCjzn4Dq1mqoIWzCmcDGsHQmQAQdEHsixK1IXESd5rLU7THVJNV8obHS8sZeN0G5Jdt5pQTVKCCbgK1hItTS8o92iEZpuWJ/oC2r/0+zTmhvFXoaMVKRe27altDtid6OvG1hENVwBnC61KKugNoemOiPCCNb3GoHAZOFuDxxPsD+07nbSPcr/o1Zmc4jARhotrA5F5ZcjP9rPk90vR8A+k028A+8+5wKlHVID542sMzMCuXktkRzUCpE+xCBZywjNcJITx0II9x5948CekBl4XaC5OCX2nCyObdwN3HwQh5DWL/BBEkhDYHn/vpXNgZkVTZs8rj+HO8JFC6qvDVhgAEQSYCDyC86rMhG1WPzAVB9ZldDWG6EzDcFiqJBDvFS8mXDv3SK2LPoguVB2kwUx7UL5KqZWiEzocsbvSjNnaYDNtcYJuA5cDcsrvHd6yCxGjqvl9+wh3Qh8Kc9py8sNW8ncU8qwxdPj1qIGfrPqlXeoS4/JLa/LwRLTCtxuSoZUT+2Su6kXW3QNacYQbId6NUKVbROpviybFSPQQL9lhB2MamEnFyB9Y+hrG1+xBg+L0QG2TZdTdlcsBdq9oHdt9Bu5/IM9+Nfh1AwrSqlboTA6Bgq568A7UfbaMrZjoQZhQphofvNw93+bN+5X7FYKBgLmRid+tSdV6c02A4R0cHwKobmoMt5+6WI9XNISFIywpf6RMd5/a91vE78FzVHIFmxud4woyJx76OMTCa4yhgN3iJO2VfRPFMv9sYTxFzU+1eWeYS52pwOoSJldZY6koib4P1O427rbeUrNZfu44hWjz5ZSuu/vKPpimoXbLkfxWSPetvxDWG5jQSaZCxA3ad+p6rlttDhK+YwwK1LHVe0drDtorc5vnQ1247g58vewDtU7L3DRwrG4dhCUDRKKOtYr2dXHtpt+33d1WZmfkAHdl7Q8ENF+CNgB+nOw29n5F7SeNo/ckbu4laLTCdqJLHjmhJbKzmrCEX7zULrhefuHmu0V/1nbP1pnb6FaT7sOxn4pvWkfrYhYtCeJ4Xv+kOXrroIs1eHWXN1/AfzaY94ms5vaAAABg2lDQ1BJQ0MgcHJvZmlsZQAAeJx9kT1Iw0AcxV/TSkUqDnYQUchQnSyIijhqFYpQIdQKrTqYXPoFTRqSFBdHwbXg4Mdi1cHFWVcHV0EQ/ABxcnRSdJES/5cUWsR4cNyPd/ced+8AoVFhmhUaBzTdNtPJhJjNrYrhV4QwjAgGIMrMMuYkKQXf8XWPAF/v4jzL/9yfo1fNWwwIiMSzzDBt4g3i6U3b4LxPHGUlWSU+Jx4z6YLEj1xXPH7jXHRZ4JlRM5OeJ44Si8UOVjqYlUyNeIo4pmo65QtZj1XOW5y1So217slfGMnrK8tcpzmEJBaxBAkiFNRQRgU24rTqpFhI037Cxz/o+iVyKeQqg5FjAVVokF0/+B/87tYqTE54SZEE0PXiOB8jQHgXaNYd5/vYcZonQPAZuNLb/moDmPkkvd7WYkdA3zZwcd3WlD3gcgcYeDJkU3alIE2hUADez+ibckD/LdCz5vXW2sfpA5ChrlI3wMEhMFqk7HWfd3d39vbvmVZ/P2aecqIM1FFZAAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH5AQdDBkQmV+argAABM5JREFUWMOtl9trHFUcxz9n9jYzm7Tb9JIWGtqUllLwVgRBQWl90S6lTaGmF6E2/4H+A4r+A0offdlWodL4kEZw9bG+iC9iKqLF0os0EBq02dtcdmdnfj7szGZ2M5vulv5g4JwzZ873+7ufUfMLi0RSa1TZNzVFrW511xBhzMxx79EyOwrbGSSzZ073zOcXFnlv5lTi3mvfzAPwwYVZ0tHiq6+/xu+/LlGtWYgEINL9oG657N41yfSRgxw9cHjDgfMLi8QVsR0X23E3gMXnkXQJ3L9zB99vI4EA0sVXqsPF93xW7y73ACVJBJwE1j8HUBIi3Sz/QNtrIzHN+yWdSdNue915IMKWXI4TJ050Adp+U+2bmkrV6tZeYAXwEJExMyf3Hi0rM5fvAvS4wPdBKRW6vZeEUiq0RIBCddddpymu0+rRbPvEzkPVmmWLBA1EdGAbYNctt7V712QwfeSgd/uXJQnPVVoEEAQBTxXpuEMELNtNNFW1WrsrQdBCRImQEeE/wBUh53v+7tW7y5n1+BZRIoJSioXvy3itdgclURSZTBrP87AdV57G1TT0d4GPgC+Bw8Ca7bifATsTgzBvjlH1qgNdICJM7tjB8soKw4jtuD+Gw3c229e1wF+P/uHPpT86rhBBRHActwAcAl4EjgIvAYcFJnlOoq5dv6EBU8AR4OUQ6AVgGjATwuC5YUdZ4A+z+1mBTUM/AKwqpZSIpPfu2VP7+/6DYEMMPE9N83lzq23ZWwxDd4GaQnmgUloqperSCpKC8HGCXz8G7NANU8CWUKPzsUDbyLPVyjYC39e0VMZx3Ccoha4b4lQqbUlnsBqNWCXpEMgKfA38DNSBcdPQr4zlMtTtFiqlulmQmJv9ks2idUZGZMjZmZMAfBUvxWHR0y5dmPV2FcbPG9ncFdPQS3nTuAJQLBZpBS1qjSqFwjipdGr9SWlsHTewm9ZmnngMKAaV9nBd+/bmdxSLRc6dnemm3+yZ06pcLvPGW2+yfWIn1ZpFEAQEvt95goCV1TXMXH4zAt4woaRF7RTAVylAUS6Xpdpsdjvk2VMnsSyHhuVEZTh+xgywBhwLfZIdKRfj7dWqPGFubq7T428ukslkaHttLNsZ9P3nwIfh+DhwS4EO9DA0zByBCE2n1fPxpQuznSCaX1js9nFp2pjbtqGhobQ0jUY9CbgALERah3IM+El1rNqTaqaph5W1uYGAFrfA5YvnyE9MoFBYtjMI/BXgQR/4pqVDZL3V9/cYrX+x7SnsXh/H5TLwW2iBQbVLNgn65CDsrSPOIJOXwmdQ4fRHrZilUqmXwNXrNzbbfxv4ArgFVBLeJ95oDEMHwHHcvvUcRqEwuBf0SSUEB9gfxsAgAkO1kcj/WvwKPaR8EhvPAUvRtdIMtR1FtBH37w8DEeChaehXw/xfAnzHcVOjEkhHrIe0Qlz7T8PuWLEd9+2w9KphgUUgQJ7JAgAPDT13NTrJyOYqIilrlEwQv/NPMTSByxfPIU37eCqtq2zWmPYDjbavaLYVdn2NuffPjqRJK2hRLBaHzoK+X7L1QE+nIFeYoFQqkTVMaTn2UOe1LWtwEJqGzqgRnS9M4Fb+3XBJGfSrFzW9dBw0icioJBzHzUXdMJM18APwWo6Kmy1O6X+V8UHDotBqogAAAABJRU5ErkJggg==\");\n", " }\n", " `;\n", " exports.default = css;\n", " },\n", " /* core/util/menus.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const dom_1 = require(68) /* ../dom */;\n", " //import menus_css from \"styles/menus.css\"\n", " const styles = tslib_1.__importStar(require(255) /* ../../styles/menus */);\n", " class ContextMenu {\n", " constructor(items, options = {}) {\n", " this.items = items;\n", " this.options = options;\n", " this.el = dom_1.div();\n", " this._open = false;\n", " this._item_click = (i) => {\n", " var _a;\n", " (_a = this.items[i]) === null || _a === void 0 ? void 0 : _a.handler();\n", " this.hide();\n", " };\n", " this._on_mousedown = (event) => {\n", " var _a, _b;\n", " const { target } = event;\n", " if (target instanceof Node && this.el.contains(target))\n", " return;\n", " if ((_b = (_a = this.options).prevent_hide) === null || _b === void 0 ? void 0 : _b.call(_a, event))\n", " return;\n", " this.hide();\n", " };\n", " this._on_keydown = (event) => {\n", " if (event.keyCode == dom_1.Keys.Esc)\n", " this.hide();\n", " };\n", " this._on_blur = () => {\n", " this.hide();\n", " };\n", " dom_1.undisplay(this.el);\n", " }\n", " get is_open() {\n", " return this._open;\n", " }\n", " get can_open() {\n", " return this.items.length != 0;\n", " }\n", " remove() {\n", " dom_1.remove(this.el);\n", " this._unlisten();\n", " }\n", " _listen() {\n", " document.addEventListener(\"mousedown\", this._on_mousedown);\n", " document.addEventListener(\"keydown\", this._on_keydown);\n", " window.addEventListener(\"blur\", this._on_blur);\n", " }\n", " _unlisten() {\n", " document.removeEventListener(\"mousedown\", this._on_mousedown);\n", " document.removeEventListener(\"keydown\", this._on_keydown);\n", " window.removeEventListener(\"blur\", this._on_blur);\n", " }\n", " _position(at) {\n", " const parent_el = this.el.parentElement;\n", " if (parent_el != null) {\n", " const parent = parent_el.getBoundingClientRect();\n", " this.el.style.left = at.left != null ? `${at.left - parent.left}px` : \"\";\n", " this.el.style.top = at.top != null ? `${at.top - parent.top}px` : \"\";\n", " this.el.style.right = at.right != null ? `${parent.right - at.right}px` : \"\";\n", " this.el.style.bottom = at.bottom != null ? `${parent.bottom - at.bottom}px` : \"\";\n", " }\n", " }\n", " /*\n", " styles(): string[] {\n", " return [...super.styles(), menus_css]\n", " }\n", " */\n", " render() {\n", " var _a;\n", " dom_1.empty(this.el, true);\n", " const orientation = (_a = this.options.orientation) !== null && _a !== void 0 ? _a : \"vertical\";\n", " dom_1.classes(this.el).add(\"bk-context-menu\", `bk-${orientation}`);\n", " dom_1.append(this.el, ...this.items.map((item, i) => {\n", " var _a;\n", " let el;\n", " if (item != null) {\n", " const icon = item.icon != null ? dom_1.div({ class: [\"bk-menu-icon\", item.icon] }) : null;\n", " el = dom_1.div({ class: ((_a = item.active) === null || _a === void 0 ? void 0 : _a.call(item)) ? \"bk-active\" : null, title: item.tooltip }, icon, item.label);\n", " }\n", " else {\n", " el = dom_1.div({ class: styles.bk_divider });\n", " }\n", " el.addEventListener(\"click\", () => this._item_click(i));\n", " return el;\n", " }));\n", " }\n", " show(at) {\n", " if (this.items.length == 0)\n", " return;\n", " if (!this._open) {\n", " this.render();\n", " this._position(at !== null && at !== void 0 ? at : { left: 0, top: 0 });\n", " dom_1.display(this.el);\n", " this._listen();\n", " this._open = true;\n", " }\n", " }\n", " hide() {\n", " if (this._open) {\n", " this._open = false;\n", " this._unlisten();\n", " dom_1.undisplay(this.el);\n", " }\n", " }\n", " toggle(at) {\n", " this._open ? this.hide() : this.show(at);\n", " }\n", " }\n", " exports.ContextMenu = ContextMenu;\n", " ContextMenu.__name__ = \"ContextMenu\";\n", " },\n", " /* models/tools/on_off_button.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const button_tool_1 = require(275) /* ./button_tool */;\n", " const mixins_1 = require(146) /* ../../styles/mixins */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " class OnOffButtonView extends button_tool_1.ButtonToolButtonView {\n", " render() {\n", " super.render();\n", " dom_1.classes(this.el).toggle(mixins_1.bk_active, this.model.active);\n", " }\n", " _clicked() {\n", " const { active } = this.model;\n", " this.model.active = !active;\n", " }\n", " }\n", " exports.OnOffButtonView = OnOffButtonView;\n", " OnOffButtonView.__name__ = \"OnOffButtonView\";\n", " },\n", " /* models/tools/toolbar_base.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const logging_1 = require(72) /* ../../core/logging */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const build_views_1 = require(99) /* ../../core/build_views */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const dom_view_1 = require(66) /* ../../core/dom_view */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const model_1 = require(71) /* ../../model */;\n", " const gesture_tool_1 = require(284) /* ./gestures/gesture_tool */;\n", " const action_tool_1 = require(285) /* ./actions/action_tool */;\n", " const help_tool_1 = require(286) /* ./actions/help_tool */;\n", " const inspect_tool_1 = require(274) /* ./inspectors/inspect_tool */;\n", " const toolbar_1 = require(278) /* ../../styles/toolbar */;\n", " const logo_1 = require(288) /* ../../styles/logo */;\n", " const mixins_1 = require(146) /* ../../styles/mixins */;\n", " const toolbar_css_1 = tslib_1.__importDefault(require(279) /* ../../styles/toolbar.css */);\n", " const logo_css_1 = tslib_1.__importDefault(require(289) /* ../../styles/logo.css */);\n", " class ToolbarViewModel extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ToolbarViewModel() {\n", " this.define({\n", " _visible: [p.Any, null],\n", " autohide: [p.Boolean, false],\n", " });\n", " }\n", " get visible() {\n", " return (!this.autohide) ? true : (this._visible == null) ? false : this._visible;\n", " }\n", " }\n", " exports.ToolbarViewModel = ToolbarViewModel;\n", " ToolbarViewModel.__name__ = \"ToolbarViewModel\";\n", " ToolbarViewModel.init_ToolbarViewModel();\n", " class ToolbarBaseView extends dom_view_1.DOMView {\n", " initialize() {\n", " super.initialize();\n", " this._tool_button_views = new Map();\n", " this._toolbar_view_model = new ToolbarViewModel({ autohide: this.model.autohide });\n", " }\n", " async lazy_initialize() {\n", " await this._build_tool_button_views();\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.tools.change, async () => {\n", " await this._build_tool_button_views();\n", " this.render();\n", " });\n", " this.connect(this.model.properties.autohide.change, () => {\n", " this._toolbar_view_model.autohide = this.model.autohide;\n", " this._on_visible_change();\n", " });\n", " this.connect(this._toolbar_view_model.properties._visible.change, () => this._on_visible_change());\n", " }\n", " styles() {\n", " return [...super.styles(), toolbar_css_1.default, logo_css_1.default];\n", " }\n", " remove() {\n", " build_views_1.remove_views(this._tool_button_views);\n", " super.remove();\n", " }\n", " async _build_tool_button_views() {\n", " const tools = (this.model._proxied_tools != null ? this.model._proxied_tools : this.model.tools); // XXX\n", " await build_views_1.build_views(this._tool_button_views, tools, { parent: this }, (tool) => tool.button_view); // XXX: no ButtonToolButton model\n", " }\n", " set_visibility(visible) {\n", " if (visible != this._toolbar_view_model._visible) {\n", " this._toolbar_view_model._visible = visible;\n", " }\n", " }\n", " _on_visible_change() {\n", " const visible = this._toolbar_view_model.visible;\n", " const hidden_class = toolbar_1.bk_toolbar_hidden;\n", " if (this.el.classList.contains(hidden_class) && visible) {\n", " this.el.classList.remove(hidden_class);\n", " }\n", " else if (!visible) {\n", " this.el.classList.add(hidden_class);\n", " }\n", " }\n", " render() {\n", " dom_1.empty(this.el);\n", " this.el.classList.add(toolbar_1.bk_toolbar);\n", " this.el.classList.add(mixins_1.bk_side(this.model.toolbar_location));\n", " this._toolbar_view_model.autohide = this.model.autohide;\n", " this._on_visible_change();\n", " if (this.model.logo != null) {\n", " const gray = this.model.logo === \"grey\" ? logo_1.bk_grey : null;\n", " const logo = dom_1.a({ href: \"https://bokeh.org/\", target: \"_blank\", class: [logo_1.bk_logo, logo_1.bk_logo_small, gray] });\n", " this.el.appendChild(logo);\n", " }\n", " for (const [, button_view] of this._tool_button_views) {\n", " button_view.render();\n", " }\n", " const bars = [];\n", " const el = (tool) => {\n", " return this._tool_button_views.get(tool).el;\n", " };\n", " const { gestures } = this.model;\n", " for (const et in gestures) {\n", " bars.push(gestures[et].tools.map(el));\n", " }\n", " bars.push(this.model.actions.map(el));\n", " bars.push(this.model.inspectors.filter((tool) => tool.toggleable).map(el));\n", " for (const bar of bars) {\n", " if (bar.length !== 0) {\n", " const el = dom_1.div({ class: toolbar_1.bk_button_bar }, bar);\n", " this.el.appendChild(el);\n", " }\n", " }\n", " }\n", " update_layout() { }\n", " update_position() { }\n", " after_layout() {\n", " this._has_finished = true;\n", " }\n", " }\n", " exports.ToolbarBaseView = ToolbarBaseView;\n", " ToolbarBaseView.__name__ = \"ToolbarBaseView\";\n", " function createGestureMap() {\n", " return {\n", " pan: { tools: [], active: null },\n", " scroll: { tools: [], active: null },\n", " pinch: { tools: [], active: null },\n", " tap: { tools: [], active: null },\n", " doubletap: { tools: [], active: null },\n", " press: { tools: [], active: null },\n", " pressup: { tools: [], active: null },\n", " rotate: { tools: [], active: null },\n", " move: { tools: [], active: null },\n", " multi: { tools: [], active: null },\n", " };\n", " }\n", " class ToolbarBase extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ToolbarBase() {\n", " this.prototype.default_view = ToolbarBaseView;\n", " this.define({\n", " tools: [p.Array, []],\n", " logo: [p.Logo, 'normal'],\n", " autohide: [p.Boolean, false],\n", " });\n", " this.internal({\n", " gestures: [p.Any, createGestureMap],\n", " actions: [p.Array, []],\n", " inspectors: [p.Array, []],\n", " help: [p.Array, []],\n", " toolbar_location: [p.Location, 'right'],\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " this._init_tools();\n", " }\n", " _init_tools() {\n", " // The only purpose of this function is to avoid unnecessary property churning.\n", " const tools_changed = function (old_tools, new_tools) {\n", " if (old_tools.length != new_tools.length) {\n", " return true;\n", " }\n", " const new_ids = new Set(new_tools.map(t => t.id));\n", " return array_1.some(old_tools, t => !new_ids.has(t.id));\n", " };\n", " const new_inspectors = this.tools.filter(t => t instanceof inspect_tool_1.InspectTool);\n", " if (tools_changed(this.inspectors, new_inspectors)) {\n", " this.inspectors = new_inspectors;\n", " }\n", " const new_help = this.tools.filter(t => t instanceof help_tool_1.HelpTool);\n", " if (tools_changed(this.help, new_help)) {\n", " this.help = new_help;\n", " }\n", " const new_actions = this.tools.filter(t => t instanceof action_tool_1.ActionTool);\n", " if (tools_changed(this.actions, new_actions)) {\n", " this.actions = new_actions;\n", " }\n", " const check_event_type = (et, tool) => {\n", " if (!(et in this.gestures)) {\n", " logging_1.logger.warn(`Toolbar: unknown event type '${et}' for tool: ${tool}`);\n", " }\n", " };\n", " const new_gestures = createGestureMap();\n", " for (const tool of this.tools) {\n", " if (tool instanceof gesture_tool_1.GestureTool && tool.event_type) {\n", " if (types_1.isString(tool.event_type)) {\n", " new_gestures[tool.event_type].tools.push(tool);\n", " check_event_type(tool.event_type, tool);\n", " }\n", " else {\n", " new_gestures.multi.tools.push(tool);\n", " for (const et of tool.event_type) {\n", " check_event_type(et, tool);\n", " }\n", " }\n", " }\n", " }\n", " for (const et of Object.keys(new_gestures)) {\n", " const gm = this.gestures[et];\n", " if (tools_changed(gm.tools, new_gestures[et].tools)) {\n", " gm.tools = new_gestures[et].tools;\n", " }\n", " if (gm.active && array_1.every(gm.tools, t => t.id != gm.active.id)) {\n", " gm.active = null;\n", " }\n", " }\n", " }\n", " get horizontal() {\n", " return this.toolbar_location === \"above\" || this.toolbar_location === \"below\";\n", " }\n", " get vertical() {\n", " return this.toolbar_location === \"left\" || this.toolbar_location === \"right\";\n", " }\n", " _active_change(tool) {\n", " const { event_type } = tool;\n", " if (event_type == null)\n", " return;\n", " const event_types = types_1.isString(event_type) ? [event_type] : event_type;\n", " for (const et of event_types) {\n", " if (tool.active) {\n", " const currently_active_tool = this.gestures[et].active;\n", " if (currently_active_tool != null && tool != currently_active_tool) {\n", " logging_1.logger.debug(`Toolbar: deactivating tool: ${currently_active_tool} for event type '${et}'`);\n", " currently_active_tool.active = false;\n", " }\n", " this.gestures[et].active = tool;\n", " logging_1.logger.debug(`Toolbar: activating tool: ${tool} for event type '${et}'`);\n", " }\n", " else\n", " this.gestures[et].active = null;\n", " }\n", " }\n", " }\n", " exports.ToolbarBase = ToolbarBase;\n", " ToolbarBase.__name__ = \"ToolbarBase\";\n", " ToolbarBase.init_ToolbarBase();\n", " },\n", " /* models/tools/gestures/gesture_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const button_tool_1 = require(275) /* ../button_tool */;\n", " const on_off_button_1 = require(282) /* ../on_off_button */;\n", " class GestureToolView extends button_tool_1.ButtonToolView {\n", " }\n", " exports.GestureToolView = GestureToolView;\n", " GestureToolView.__name__ = \"GestureToolView\";\n", " class GestureTool extends button_tool_1.ButtonTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.button_view = on_off_button_1.OnOffButtonView;\n", " }\n", " }\n", " exports.GestureTool = GestureTool;\n", " GestureTool.__name__ = \"GestureTool\";\n", " },\n", " /* models/tools/actions/action_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const button_tool_1 = require(275) /* ../button_tool */;\n", " const signaling_1 = require(14) /* ../../../core/signaling */;\n", " class ActionToolButtonView extends button_tool_1.ButtonToolButtonView {\n", " _clicked() {\n", " this.model.do.emit();\n", " }\n", " }\n", " exports.ActionToolButtonView = ActionToolButtonView;\n", " ActionToolButtonView.__name__ = \"ActionToolButtonView\";\n", " class ActionToolView extends button_tool_1.ButtonToolView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.do, () => this.doit());\n", " }\n", " }\n", " exports.ActionToolView = ActionToolView;\n", " ActionToolView.__name__ = \"ActionToolView\";\n", " class ActionTool extends button_tool_1.ButtonTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.button_view = ActionToolButtonView;\n", " this.do = new signaling_1.Signal0(this, \"do\");\n", " }\n", " }\n", " exports.ActionTool = ActionTool;\n", " ActionTool.__name__ = \"ActionTool\";\n", " },\n", " /* models/tools/actions/help_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const action_tool_1 = require(285) /* ./action_tool */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class HelpToolView extends action_tool_1.ActionToolView {\n", " doit() {\n", " window.open(this.model.redirect);\n", " }\n", " }\n", " exports.HelpToolView = HelpToolView;\n", " HelpToolView.__name__ = \"HelpToolView\";\n", " class HelpTool extends action_tool_1.ActionTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Help\";\n", " this.icon = icons_1.bk_tool_icon_help;\n", " }\n", " static init_HelpTool() {\n", " this.prototype.default_view = HelpToolView;\n", " this.define({\n", " help_tooltip: [p.String, 'Click the question mark to learn more about Bokeh plot tools.'],\n", " redirect: [p.String, 'https://docs.bokeh.org/en/latest/docs/user_guide/tools.html'],\n", " });\n", " this.register_alias(\"help\", () => new HelpTool());\n", " }\n", " get tooltip() {\n", " return this.help_tooltip;\n", " }\n", " }\n", " exports.HelpTool = HelpTool;\n", " HelpTool.__name__ = \"HelpTool\";\n", " HelpTool.init_HelpTool();\n", " },\n", " /* styles/icons.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.bk_tool_icon_box_select = \"bk-tool-icon-box-select\";\n", " exports.bk_tool_icon_box_zoom = \"bk-tool-icon-box-zoom\";\n", " exports.bk_tool_icon_zoom_in = \"bk-tool-icon-zoom-in\";\n", " exports.bk_tool_icon_zoom_out = \"bk-tool-icon-zoom-out\";\n", " exports.bk_tool_icon_help = \"bk-tool-icon-help\";\n", " exports.bk_tool_icon_hover = \"bk-tool-icon-hover\";\n", " exports.bk_tool_icon_crosshair = \"bk-tool-icon-crosshair\";\n", " exports.bk_tool_icon_lasso_select = \"bk-tool-icon-lasso-select\";\n", " exports.bk_tool_icon_pan = \"bk-tool-icon-pan\";\n", " exports.bk_tool_icon_xpan = \"bk-tool-icon-xpan\";\n", " exports.bk_tool_icon_ypan = \"bk-tool-icon-ypan\";\n", " exports.bk_tool_icon_range = \"bk-tool-icon-range\";\n", " exports.bk_tool_icon_polygon_select = \"bk-tool-icon-polygon-select\";\n", " exports.bk_tool_icon_redo = \"bk-tool-icon-redo\";\n", " exports.bk_tool_icon_reset = \"bk-tool-icon-reset\";\n", " exports.bk_tool_icon_save = \"bk-tool-icon-save\";\n", " exports.bk_tool_icon_tap_select = \"bk-tool-icon-tap-select\";\n", " exports.bk_tool_icon_undo = \"bk-tool-icon-undo\";\n", " exports.bk_tool_icon_wheel_pan = \"bk-tool-icon-wheel-pan\";\n", " exports.bk_tool_icon_wheel_zoom = \"bk-tool-icon-wheel-zoom\";\n", " exports.bk_tool_icon_box_edit = \"bk-tool-icon-box-edit\";\n", " exports.bk_tool_icon_freehand_draw = \"bk-tool-icon-freehand-draw\";\n", " exports.bk_tool_icon_poly_draw = \"bk-tool-icon-poly-draw\";\n", " exports.bk_tool_icon_point_draw = \"bk-tool-icon-point-draw\";\n", " exports.bk_tool_icon_poly_edit = \"bk-tool-icon-poly-edit\";\n", " exports.bk_tool_icon_line_edit = \"bk-tool-icon-line-edit\";\n", " },\n", " /* styles/logo.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.bk_logo = \"bk-logo\";\n", " exports.bk_logo_notebook = \"bk-logo-notebook\";\n", " exports.bk_logo_small = \"bk-logo-small\";\n", " exports.bk_grey = \"bk-grey\";\n", " },\n", " /* styles/logo.css.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const css = `\n", " .bk-root .bk-logo {\n", " margin: 5px;\n", " position: relative;\n", " display: block;\n", " background-repeat: no-repeat;\n", " }\n", " .bk-root .bk-logo.bk-grey {\n", " filter: url(\"data:image/svg+xml;utf8,#grayscale\");\n", " /* Firefox 10+, Firefox on Android */\n", " filter: gray;\n", " /* IE6-9 */\n", " -webkit-filter: grayscale(100%);\n", " /* Chrome 19+, Safari 6+, Safari 6+ iOS */\n", " }\n", " .bk-root .bk-logo-small {\n", " width: 20px;\n", " height: 20px;\n", " background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNui8sowAAAOkSURBVDiNjZRtaJVlGMd/1/08zzln5zjP1LWcU9N0NkN8m2CYjpgQYQXqSs0I84OLIC0hkEKoPtiH3gmKoiJDU7QpLgoLjLIQCpEsNJ1vqUOdO7ppbuec5+V+rj4ctwzd8IIbbi6u+8f1539dt3A78eXC7QizUF7gyV1fD1Yqg4JWz84yffhm0qkFqBogB9rM8tZdtwVsPUhWhGcFJngGeWrPzHm5oaMmkfEg1usvLFyc8jLRqDOMru7AyC8saQr7GG7f5fvDeH7Ej8CM66nIF+8yngt6HWaKh7k49Soy9nXurCi1o3qUbS3zWfrYeQDTB/Qj6kX6Ybhw4B+bOYoLKCC9H3Nu/leUTZ1JdRWkkn2ldcCamzrcf47KKXdAJllSlxAOkRgyHsGC/zRday5Qld9DyoM4/q/rUoy/CXh3jzOu3bHUVZeU+DEn8FInkPBFlu3+nW3Nw0mk6vCDiWg8CeJaxEwuHS3+z5RgY+YBR6V1Z1nxSOfoaPa4LASWxxdNp+VWTk7+4vzaou8v8PN+xo+KY2xsw6une2frhw05CTYOmQvsEhjhWjn0bmXPjpE1+kplmmkP3suftwTubK9Vq22qKmrBhpY4jvd5afdRA3wGjFAgcnTK2s4hY0/GPNIb0nErGMCRxWOOX64Z8RAC4oCXdklmEvcL8o0BfkNK4lUg9HTl+oPlQxdNo3Mg4Nv175e/1LDGzZen30MEjRUtmXSfiTVu1kK8W4txyV6BMKlbgk3lMwYCiusNy9fVfvvwMxv8Ynl6vxoByANLTWplvuj/nF9m2+PDtt1eiHPBr1oIfhCChQMBw6Aw0UulqTKZdfVvfG7VcfIqLG9bcldL/+pdWTLxLUy8Qq38heUIjh4XlzZxzQm19lLFlr8vdQ97rjZVOLf8nclzckbcD4wxXMidpX30sFd37Fv/GtwwhzhxGVAprjbg0gCAEeIgwCZyTV2Z1REEW8O4py0wsjeloKoMr6iCY6dP92H6Vw/oTyICIthibxjm/DfN9lVz8IqtqKYLUXfoKVMVQVVJOElGjrnnUt9T9wbgp8AyYKaGlqingHZU/uG2NTZSVqwHQTWkx9hxjkpWDaCg6Ckj5qebgBVbT3V3NNXMSiWSDdGV3hrtzla7J+duwPOToIg42ChPQOQjspnSlp1V+Gjdged7+8UN5CRAV7a5EdFNwCjEaBR27b3W890TE7g24NAP/mMDXRWrGoFPQI9ls/MWO2dWFAar/xcOIImbbpA3zgAAAABJRU5ErkJggg==);\n", " }\n", " .bk-root .bk-logo-notebook {\n", " display: inline-block;\n", " vertical-align: middle;\n", " margin-right: 5px;\n", " }\n", " `;\n", " exports.default = css;\n", " },\n", " /* models/plots/plot_canvas.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var __rest = (this && this.__rest) || function (s, e) {\n", " var t = {};\n", " for (var p in s)\n", " if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n", " t[p] = s[p];\n", " if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n", " for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n", " if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n", " t[p[i]] = s[p[i]];\n", " }\n", " return t;\n", " };\n", " const cartesian_frame_1 = require(184) /* ../canvas/cartesian_frame */;\n", " const canvas_1 = require(181) /* ../canvas/canvas */;\n", " const data_range1d_1 = require(186) /* ../ranges/data_range1d */;\n", " const glyph_renderer_1 = require(81) /* ../renderers/glyph_renderer */;\n", " const layout_dom_1 = require(245) /* ../layouts/layout_dom */;\n", " const title_1 = require(142) /* ../annotations/title */;\n", " const axis_1 = require(150) /* ../axes/axis */;\n", " const toolbar_panel_1 = require(143) /* ../annotations/toolbar_panel */;\n", " const bokeh_events_1 = require(291) /* ../../core/bokeh_events */;\n", " const signaling_1 = require(14) /* ../../core/signaling */;\n", " const build_views_1 = require(99) /* ../../core/build_views */;\n", " const ui_events_1 = require(292) /* ../../core/ui_events */;\n", " const visuals_1 = require(70) /* ../../core/visuals */;\n", " const logging_1 = require(72) /* ../../core/logging */;\n", " const throttle_1 = require(294) /* ../../core/util/throttle */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const object_1 = require(17) /* ../../core/util/object */;\n", " const layout_1 = require(188) /* ../../core/layout */;\n", " const alignments_1 = require(191) /* ../../core/layout/alignments */;\n", " const side_panel_1 = require(295) /* ../../core/layout/side_panel */;\n", " const grid_1 = require(192) /* ../../core/layout/grid */;\n", " const bbox_1 = require(88) /* ../../core/util/bbox */;\n", " class PlotLayout extends layout_1.Layoutable {\n", " constructor() {\n", " super(...arguments);\n", " this.min_border = { left: 0, top: 0, right: 0, bottom: 0 };\n", " }\n", " _measure(viewport) {\n", " viewport = new layout_1.Sizeable(viewport).bounded_to(this.sizing.size);\n", " const left_hint = this.left_panel.measure({ width: 0, height: viewport.height });\n", " const left = Math.max(left_hint.width, this.min_border.left);\n", " const right_hint = this.right_panel.measure({ width: 0, height: viewport.height });\n", " const right = Math.max(right_hint.width, this.min_border.right);\n", " const top_hint = this.top_panel.measure({ width: viewport.width, height: 0 });\n", " const top = Math.max(top_hint.height, this.min_border.top);\n", " const bottom_hint = this.bottom_panel.measure({ width: viewport.width, height: 0 });\n", " const bottom = Math.max(bottom_hint.height, this.min_border.bottom);\n", " const center_viewport = new layout_1.Sizeable(viewport).shrink_by({ left, right, top, bottom });\n", " const center = this.center_panel.measure(center_viewport);\n", " const width = left + center.width + right;\n", " const height = top + center.height + bottom;\n", " const align = (() => {\n", " const { width_policy, height_policy } = this.center_panel.sizing;\n", " return width_policy != \"fixed\" && height_policy != \"fixed\";\n", " })();\n", " return { width, height, inner: { left, right, top, bottom }, align };\n", " }\n", " _set_geometry(outer, inner) {\n", " super._set_geometry(outer, inner);\n", " this.center_panel.set_geometry(inner);\n", " const left_hint = this.left_panel.measure({ width: 0, height: outer.height });\n", " const right_hint = this.right_panel.measure({ width: 0, height: outer.height });\n", " const top_hint = this.top_panel.measure({ width: outer.width, height: 0 });\n", " const bottom_hint = this.bottom_panel.measure({ width: outer.width, height: 0 });\n", " const { left, top, right, bottom } = inner;\n", " this.top_panel.set_geometry(new bbox_1.BBox({ left, right, bottom: top, height: top_hint.height }));\n", " this.bottom_panel.set_geometry(new bbox_1.BBox({ left, right, top: bottom, height: bottom_hint.height }));\n", " this.left_panel.set_geometry(new bbox_1.BBox({ top, bottom, right: left, width: left_hint.width }));\n", " this.right_panel.set_geometry(new bbox_1.BBox({ top, bottom, left: right, width: right_hint.width }));\n", " }\n", " }\n", " exports.PlotLayout = PlotLayout;\n", " PlotLayout.__name__ = \"PlotLayout\";\n", " class PlotView extends layout_dom_1.LayoutDOMView {\n", " constructor() {\n", " super(...arguments);\n", " this._outer_bbox = new bbox_1.BBox();\n", " this._inner_bbox = new bbox_1.BBox();\n", " this._needs_paint = true;\n", " this._needs_layout = false;\n", " this._invalidated_painters = new Set();\n", " this._invalidate_all = true;\n", " }\n", " get is_paused() {\n", " return this._is_paused != null && this._is_paused !== 0;\n", " }\n", " get child_models() {\n", " return [];\n", " }\n", " pause() {\n", " if (this._is_paused == null)\n", " this._is_paused = 1;\n", " else\n", " this._is_paused += 1;\n", " }\n", " unpause(no_render = false) {\n", " if (this._is_paused == null)\n", " throw new Error(\"wasn't paused\");\n", " this._is_paused -= 1;\n", " if (this._is_paused == 0 && !no_render)\n", " this.request_paint();\n", " }\n", " // TODO: this needs to be removed\n", " request_render() {\n", " this.request_paint();\n", " }\n", " request_paint(to_invalidate) {\n", " if (to_invalidate != null) {\n", " this._invalidated_painters.add(to_invalidate);\n", " }\n", " else {\n", " this._invalidate_all = true;\n", " }\n", " if (!this.is_paused) {\n", " const promise = this.throttled_paint();\n", " this._ready = this._ready.then(() => promise);\n", " }\n", " }\n", " request_layout() {\n", " this._needs_layout = true;\n", " this.request_paint();\n", " }\n", " reset() {\n", " if (this.model.reset_policy == \"standard\") {\n", " this.clear_state();\n", " this.reset_range();\n", " this.reset_selection();\n", " }\n", " this.model.trigger_event(new bokeh_events_1.Reset());\n", " }\n", " remove() {\n", " this.ui_event_bus.destroy();\n", " build_views_1.remove_views(this.renderer_views);\n", " build_views_1.remove_views(this.tool_views);\n", " this.canvas_view.remove();\n", " super.remove();\n", " }\n", " render() {\n", " super.render();\n", " this.el.appendChild(this.canvas_view.el);\n", " this.canvas_view.render();\n", " }\n", " initialize() {\n", " this.pause();\n", " super.initialize();\n", " this.state_changed = new signaling_1.Signal0(this, \"state_changed\");\n", " this.lod_started = false;\n", " this.visuals = new visuals_1.Visuals(this.model); // XXX\n", " this._initial_state_info = {\n", " selection: new Map(),\n", " dimensions: { width: 0, height: 0 },\n", " };\n", " this.visibility_callbacks = [];\n", " this.state = { history: [], index: -1 };\n", " const { hidpi, output_backend } = this.model;\n", " this.canvas = new canvas_1.Canvas({ hidpi, output_backend });\n", " this.frame = new cartesian_frame_1.CartesianFrame(this.model.x_scale, this.model.y_scale, this.model.x_range, this.model.y_range, this.model.extra_x_ranges, this.model.extra_y_ranges);\n", " this.throttled_paint = throttle_1.throttle(() => this.repaint(), 1000 / 60);\n", " const { title_location, title } = this.model;\n", " if (title_location != null && title != null) {\n", " this._title = title instanceof title_1.Title ? title : new title_1.Title({ text: title });\n", " }\n", " const { toolbar_location, toolbar } = this.model;\n", " if (toolbar_location != null && toolbar != null) {\n", " this._toolbar = new toolbar_panel_1.ToolbarPanel({ toolbar });\n", " toolbar.toolbar_location = toolbar_location;\n", " }\n", " this.renderer_views = new Map();\n", " this.tool_views = new Map();\n", " }\n", " async lazy_initialize() {\n", " this.canvas_view = await build_views_1.build_view(this.canvas, { parent: this });\n", " this.ui_event_bus = new ui_events_1.UIEvents(this, this.model.toolbar, this.canvas_view.events_el);\n", " await this.build_renderer_views();\n", " await this.build_tool_views();\n", " this.update_dataranges();\n", " this.unpause(true);\n", " logging_1.logger.debug(\"PlotView initialized\");\n", " }\n", " _width_policy() {\n", " return this.model.frame_width == null ? super._width_policy() : \"min\";\n", " }\n", " _height_policy() {\n", " return this.model.frame_height == null ? super._height_policy() : \"min\";\n", " }\n", " _update_layout() {\n", " this.layout = new PlotLayout();\n", " this.layout.set_sizing(this.box_sizing());\n", " const { frame_width, frame_height } = this.model;\n", " this.layout.center_panel = this.frame;\n", " this.layout.center_panel.set_sizing(Object.assign(Object.assign({}, (frame_width != null ? { width_policy: \"fixed\", width: frame_width } : { width_policy: \"fit\" })), (frame_height != null ? { height_policy: \"fixed\", height: frame_height } : { height_policy: \"fit\" })));\n", " const above = array_1.copy(this.model.above);\n", " const below = array_1.copy(this.model.below);\n", " const left = array_1.copy(this.model.left);\n", " const right = array_1.copy(this.model.right);\n", " const get_side = (side) => {\n", " switch (side) {\n", " case \"above\": return above;\n", " case \"below\": return below;\n", " case \"left\": return left;\n", " case \"right\": return right;\n", " }\n", " };\n", " const { title_location, title } = this.model;\n", " if (title_location != null && title != null) {\n", " get_side(title_location).push(this._title);\n", " }\n", " const { toolbar_location, toolbar } = this.model;\n", " if (toolbar_location != null && toolbar != null) {\n", " const panels = get_side(toolbar_location);\n", " let push_toolbar = true;\n", " if (this.model.toolbar_sticky) {\n", " for (let i = 0; i < panels.length; i++) {\n", " const panel = panels[i];\n", " if (panel instanceof title_1.Title) {\n", " if (toolbar_location == \"above\" || toolbar_location == \"below\")\n", " panels[i] = [panel, this._toolbar];\n", " else\n", " panels[i] = [this._toolbar, panel];\n", " push_toolbar = false;\n", " break;\n", " }\n", " }\n", " }\n", " if (push_toolbar)\n", " panels.push(this._toolbar);\n", " }\n", " const set_layout = (side, model) => {\n", " const view = this.renderer_views.get(model);\n", " return view.layout = new side_panel_1.SidePanel(side, view);\n", " };\n", " const set_layouts = (side, panels) => {\n", " const horizontal = side == \"above\" || side == \"below\";\n", " const layouts = [];\n", " for (const panel of panels) {\n", " if (types_1.isArray(panel)) {\n", " const items = panel.map((subpanel) => {\n", " const item = set_layout(side, subpanel);\n", " if (subpanel instanceof toolbar_panel_1.ToolbarPanel) {\n", " const dim = horizontal ? \"width_policy\" : \"height_policy\";\n", " item.set_sizing(Object.assign(Object.assign({}, item.sizing), { [dim]: \"min\" }));\n", " }\n", " return item;\n", " });\n", " let layout;\n", " if (horizontal) {\n", " layout = new grid_1.Row(items);\n", " layout.set_sizing({ width_policy: \"max\", height_policy: \"min\" });\n", " }\n", " else {\n", " layout = new grid_1.Column(items);\n", " layout.set_sizing({ width_policy: \"min\", height_policy: \"max\" });\n", " }\n", " layout.absolute = true;\n", " layouts.push(layout);\n", " }\n", " else\n", " layouts.push(set_layout(side, panel));\n", " }\n", " return layouts;\n", " };\n", " const min_border = this.model.min_border != null ? this.model.min_border : 0;\n", " this.layout.min_border = {\n", " left: this.model.min_border_left != null ? this.model.min_border_left : min_border,\n", " top: this.model.min_border_top != null ? this.model.min_border_top : min_border,\n", " right: this.model.min_border_right != null ? this.model.min_border_right : min_border,\n", " bottom: this.model.min_border_bottom != null ? this.model.min_border_bottom : min_border,\n", " };\n", " const top_panel = new alignments_1.VStack();\n", " const bottom_panel = new alignments_1.VStack();\n", " const left_panel = new alignments_1.HStack();\n", " const right_panel = new alignments_1.HStack();\n", " top_panel.children = array_1.reversed(set_layouts(\"above\", above));\n", " bottom_panel.children = set_layouts(\"below\", below);\n", " left_panel.children = array_1.reversed(set_layouts(\"left\", left));\n", " right_panel.children = set_layouts(\"right\", right);\n", " top_panel.set_sizing({ width_policy: \"fit\", height_policy: \"min\" /*, min_height: this.layout.min_border.top*/ });\n", " bottom_panel.set_sizing({ width_policy: \"fit\", height_policy: \"min\" /*, min_height: this.layout.min_width.bottom*/ });\n", " left_panel.set_sizing({ width_policy: \"min\", height_policy: \"fit\" /*, min_width: this.layout.min_width.left*/ });\n", " right_panel.set_sizing({ width_policy: \"min\", height_policy: \"fit\" /*, min_width: this.layout.min_width.right*/ });\n", " this.layout.top_panel = top_panel;\n", " this.layout.bottom_panel = bottom_panel;\n", " this.layout.left_panel = left_panel;\n", " this.layout.right_panel = right_panel;\n", " }\n", " get axis_views() {\n", " const views = [];\n", " for (const [, renderer_view] of this.renderer_views) {\n", " if (renderer_view instanceof axis_1.AxisView)\n", " views.push(renderer_view);\n", " }\n", " return views;\n", " }\n", " set_cursor(cursor = \"default\") {\n", " this.canvas_view.el.style.cursor = cursor;\n", " }\n", " set_toolbar_visibility(visible) {\n", " for (const callback of this.visibility_callbacks)\n", " callback(visible);\n", " }\n", " update_dataranges() {\n", " // Update any DataRange1ds here\n", " const bounds = new Map();\n", " const log_bounds = new Map();\n", " let calculate_log_bounds = false;\n", " for (const r of object_1.values(this.frame.x_ranges).concat(object_1.values(this.frame.y_ranges))) {\n", " if (r instanceof data_range1d_1.DataRange1d) {\n", " if (r.scale_hint == \"log\")\n", " calculate_log_bounds = true;\n", " }\n", " }\n", " for (const [renderer, renderer_view] of this.renderer_views) {\n", " if (renderer_view instanceof glyph_renderer_1.GlyphRendererView) {\n", " const bds = renderer_view.glyph.bounds();\n", " if (bds != null)\n", " bounds.set(renderer, bds);\n", " if (calculate_log_bounds) {\n", " const log_bds = renderer_view.glyph.log_bounds();\n", " if (log_bds != null)\n", " log_bounds.set(renderer, log_bds);\n", " }\n", " }\n", " }\n", " let follow_enabled = false;\n", " let has_bounds = false;\n", " const { width, height } = this.frame.bbox;\n", " let r;\n", " if (this.model.match_aspect !== false && width != 0 && height != 0)\n", " r = (1 / this.model.aspect_scale) * (width / height);\n", " for (const xr of object_1.values(this.frame.x_ranges)) {\n", " if (xr instanceof data_range1d_1.DataRange1d) {\n", " const bounds_to_use = xr.scale_hint == \"log\" ? log_bounds : bounds;\n", " xr.update(bounds_to_use, 0, this.model, r);\n", " if (xr.follow) {\n", " follow_enabled = true;\n", " }\n", " }\n", " if (xr.bounds != null)\n", " has_bounds = true;\n", " }\n", " for (const yr of object_1.values(this.frame.y_ranges)) {\n", " if (yr instanceof data_range1d_1.DataRange1d) {\n", " const bounds_to_use = yr.scale_hint == \"log\" ? log_bounds : bounds;\n", " yr.update(bounds_to_use, 1, this.model, r);\n", " if (yr.follow) {\n", " follow_enabled = true;\n", " }\n", " }\n", " if (yr.bounds != null)\n", " has_bounds = true;\n", " }\n", " if (follow_enabled && has_bounds) {\n", " logging_1.logger.warn('Follow enabled so bounds are unset.');\n", " for (const xr of object_1.values(this.frame.x_ranges)) {\n", " xr.bounds = null;\n", " }\n", " for (const yr of object_1.values(this.frame.y_ranges)) {\n", " yr.bounds = null;\n", " }\n", " }\n", " this.range_update_timestamp = Date.now();\n", " }\n", " map_to_screen(x, y, x_name = \"default\", y_name = \"default\") {\n", " return this.frame.map_to_screen(x, y, x_name, y_name);\n", " }\n", " push_state(type, new_info) {\n", " const { history, index } = this.state;\n", " const prev_info = history[index] != null ? history[index].info : {};\n", " const info = Object.assign(Object.assign(Object.assign({}, this._initial_state_info), prev_info), new_info);\n", " this.state.history = this.state.history.slice(0, this.state.index + 1);\n", " this.state.history.push({ type, info });\n", " this.state.index = this.state.history.length - 1;\n", " this.state_changed.emit();\n", " }\n", " clear_state() {\n", " this.state = { history: [], index: -1 };\n", " this.state_changed.emit();\n", " }\n", " can_undo() {\n", " return this.state.index >= 0;\n", " }\n", " can_redo() {\n", " return this.state.index < this.state.history.length - 1;\n", " }\n", " undo() {\n", " if (this.can_undo()) {\n", " this.state.index -= 1;\n", " this._do_state_change(this.state.index);\n", " this.state_changed.emit();\n", " }\n", " }\n", " redo() {\n", " if (this.can_redo()) {\n", " this.state.index += 1;\n", " this._do_state_change(this.state.index);\n", " this.state_changed.emit();\n", " }\n", " }\n", " _do_state_change(index) {\n", " const info = this.state.history[index] != null ? this.state.history[index].info : this._initial_state_info;\n", " if (info.range != null)\n", " this.update_range(info.range);\n", " if (info.selection != null)\n", " this.update_selection(info.selection);\n", " }\n", " get_selection() {\n", " const selection = new Map();\n", " for (const renderer of this.model.renderers) {\n", " if (renderer instanceof glyph_renderer_1.GlyphRenderer) {\n", " const { selected } = renderer.data_source;\n", " selection.set(renderer, selected);\n", " }\n", " }\n", " return selection;\n", " }\n", " update_selection(selections) {\n", " for (const renderer of this.model.renderers) {\n", " if (!(renderer instanceof glyph_renderer_1.GlyphRenderer))\n", " continue;\n", " const ds = renderer.data_source;\n", " if (selections != null) {\n", " const selection = selections.get(renderer);\n", " if (selection != null) {\n", " ds.selected.update(selection, true);\n", " }\n", " }\n", " else\n", " ds.selection_manager.clear();\n", " }\n", " }\n", " reset_selection() {\n", " this.update_selection(null);\n", " }\n", " _update_ranges_together(range_info_iter) {\n", " // Get weight needed to scale the diff of the range to honor interval limits\n", " let weight = 1.0;\n", " for (const [rng, range_info] of range_info_iter) {\n", " weight = Math.min(weight, this._get_weight_to_constrain_interval(rng, range_info));\n", " }\n", " // Apply shared weight to all ranges\n", " if (weight < 1) {\n", " for (const [rng, range_info] of range_info_iter) {\n", " range_info.start = weight * range_info.start + (1 - weight) * rng.start;\n", " range_info.end = weight * range_info.end + (1 - weight) * rng.end;\n", " }\n", " }\n", " }\n", " _update_ranges_individually(range_info_iter, is_panning, is_scrolling, maintain_focus) {\n", " let hit_bound = false;\n", " for (const [rng, range_info] of range_info_iter) {\n", " // Limit range interval first. Note that for scroll events,\n", " // the interval has already been limited for all ranges simultaneously\n", " if (!is_scrolling) {\n", " const weight = this._get_weight_to_constrain_interval(rng, range_info);\n", " if (weight < 1) {\n", " range_info.start = weight * range_info.start + (1 - weight) * rng.start;\n", " range_info.end = weight * range_info.end + (1 - weight) * rng.end;\n", " }\n", " }\n", " // Prevent range from going outside limits\n", " // Also ensure that range keeps the same delta when panning/scrolling\n", " if (rng.bounds != null && rng.bounds != \"auto\") { // check `auto` for type-checking purpose\n", " const [min, max] = rng.bounds;\n", " const new_interval = Math.abs(range_info.end - range_info.start);\n", " if (rng.is_reversed) {\n", " if (min != null) {\n", " if (min >= range_info.end) {\n", " hit_bound = true;\n", " range_info.end = min;\n", " if (is_panning || is_scrolling) {\n", " range_info.start = min + new_interval;\n", " }\n", " }\n", " }\n", " if (max != null) {\n", " if (max <= range_info.start) {\n", " hit_bound = true;\n", " range_info.start = max;\n", " if (is_panning || is_scrolling) {\n", " range_info.end = max - new_interval;\n", " }\n", " }\n", " }\n", " }\n", " else {\n", " if (min != null) {\n", " if (min >= range_info.start) {\n", " hit_bound = true;\n", " range_info.start = min;\n", " if (is_panning || is_scrolling) {\n", " range_info.end = min + new_interval;\n", " }\n", " }\n", " }\n", " if (max != null) {\n", " if (max <= range_info.end) {\n", " hit_bound = true;\n", " range_info.end = max;\n", " if (is_panning || is_scrolling) {\n", " range_info.start = max - new_interval;\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " // Cancel the event when hitting a bound while scrolling. This ensures that\n", " // the scroll-zoom tool maintains its focus position. Setting `maintain_focus`\n", " // to false results in a more \"gliding\" behavior, allowing one to\n", " // zoom out more smoothly, at the cost of losing the focus position.\n", " if (is_scrolling && hit_bound && maintain_focus)\n", " return;\n", " for (const [rng, range_info] of range_info_iter) {\n", " rng.have_updated_interactively = true;\n", " if (rng.start != range_info.start || rng.end != range_info.end)\n", " rng.setv(range_info);\n", " }\n", " }\n", " _get_weight_to_constrain_interval(rng, range_info) {\n", " // Get the weight by which a range-update can be applied\n", " // to still honor the interval limits (including the implicit\n", " // max interval imposed by the bounds)\n", " const { min_interval } = rng;\n", " let { max_interval } = rng;\n", " // Express bounds as a max_interval. By doing this, the application of\n", " // bounds and interval limits can be applied independent from each-other.\n", " if (rng.bounds != null && rng.bounds != \"auto\") { // check `auto` for type-checking purpose\n", " const [min, max] = rng.bounds;\n", " if (min != null && max != null) {\n", " const max_interval2 = Math.abs(max - min);\n", " max_interval = max_interval != null ? Math.min(max_interval, max_interval2) : max_interval2;\n", " }\n", " }\n", " let weight = 1.0;\n", " if (min_interval != null || max_interval != null) {\n", " const old_interval = Math.abs(rng.end - rng.start);\n", " const new_interval = Math.abs(range_info.end - range_info.start);\n", " if (min_interval > 0 && new_interval < min_interval) {\n", " weight = (old_interval - min_interval) / (old_interval - new_interval);\n", " }\n", " if (max_interval > 0 && new_interval > max_interval) {\n", " weight = (max_interval - old_interval) / (new_interval - old_interval);\n", " }\n", " weight = Math.max(0.0, Math.min(1.0, weight));\n", " }\n", " return weight;\n", " }\n", " update_range(range_info, is_panning = false, is_scrolling = false, maintain_focus = true) {\n", " this.pause();\n", " const { x_ranges, y_ranges } = this.frame;\n", " if (range_info == null) {\n", " for (const name in x_ranges) {\n", " const rng = x_ranges[name];\n", " rng.reset();\n", " }\n", " for (const name in y_ranges) {\n", " const rng = y_ranges[name];\n", " rng.reset();\n", " }\n", " this.update_dataranges();\n", " }\n", " else {\n", " const range_info_iter = [];\n", " for (const name in x_ranges) {\n", " const rng = x_ranges[name];\n", " range_info_iter.push([rng, range_info.xrs[name]]);\n", " }\n", " for (const name in y_ranges) {\n", " const rng = y_ranges[name];\n", " range_info_iter.push([rng, range_info.yrs[name]]);\n", " }\n", " if (is_scrolling) {\n", " this._update_ranges_together(range_info_iter); // apply interval bounds while keeping aspect\n", " }\n", " this._update_ranges_individually(range_info_iter, is_panning, is_scrolling, maintain_focus);\n", " }\n", " this.unpause();\n", " }\n", " reset_range() {\n", " this.update_range(null);\n", " }\n", " _invalidate_layout() {\n", " const needs_layout = () => {\n", " for (const panel of this.model.side_panels) {\n", " const view = this.renderer_views.get(panel);\n", " if (view.layout.has_size_changed())\n", " return true;\n", " }\n", " return false;\n", " };\n", " if (needs_layout())\n", " this.root.compute_layout();\n", " }\n", " get_renderer_views() {\n", " return this.computed_renderers.map((r) => this.renderer_views.get(r));\n", " }\n", " async build_renderer_views() {\n", " this.computed_renderers = [];\n", " const { above, below, left, right, center, renderers } = this.model;\n", " this.computed_renderers.push(...above, ...below, ...left, ...right, ...center, ...renderers);\n", " if (this._title != null)\n", " this.computed_renderers.push(this._title);\n", " if (this._toolbar != null)\n", " this.computed_renderers.push(this._toolbar);\n", " for (const tool of this.model.toolbar.tools) {\n", " if (tool.overlay != null)\n", " this.computed_renderers.push(tool.overlay);\n", " this.computed_renderers.push(...tool.synthetic_renderers);\n", " }\n", " await build_views_1.build_views(this.renderer_views, this.computed_renderers, { parent: this });\n", " }\n", " async build_tool_views() {\n", " const tool_models = this.model.toolbar.tools;\n", " const new_tool_views = await build_views_1.build_views(this.tool_views, tool_models, { parent: this });\n", " new_tool_views.map((tool_view) => this.ui_event_bus.register_tool(tool_view));\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " const { x_ranges, y_ranges } = this.frame;\n", " for (const name in x_ranges) {\n", " const rng = x_ranges[name];\n", " this.connect(rng.change, () => { this._needs_layout = true; this.request_paint(); });\n", " }\n", " for (const name in y_ranges) {\n", " const rng = y_ranges[name];\n", " this.connect(rng.change, () => { this._needs_layout = true; this.request_paint(); });\n", " }\n", " const { plot_width, plot_height } = this.model.properties;\n", " this.on_change([plot_width, plot_height], () => this.invalidate_layout());\n", " const { above, below, left, right, center, renderers } = this.model.properties;\n", " this.on_change([above, below, left, right, center, renderers], async () => await this.build_renderer_views());\n", " this.connect(this.model.toolbar.properties.tools.change, async () => {\n", " await this.build_renderer_views();\n", " await this.build_tool_views();\n", " });\n", " this.connect(this.model.change, () => this.request_paint());\n", " this.connect(this.model.reset, () => this.reset());\n", " }\n", " set_initial_range() {\n", " // check for good values for ranges before setting initial range\n", " let good_vals = true;\n", " const { x_ranges, y_ranges } = this.frame;\n", " const xrs = {};\n", " const yrs = {};\n", " for (const name in x_ranges) {\n", " const { start, end } = x_ranges[name];\n", " if (start == null || end == null || isNaN(start + end)) {\n", " good_vals = false;\n", " break;\n", " }\n", " xrs[name] = { start, end };\n", " }\n", " if (good_vals) {\n", " for (const name in y_ranges) {\n", " const { start, end } = y_ranges[name];\n", " if (start == null || end == null || isNaN(start + end)) {\n", " good_vals = false;\n", " break;\n", " }\n", " yrs[name] = { start, end };\n", " }\n", " }\n", " if (good_vals) {\n", " this._initial_state_info.range = { xrs, yrs };\n", " logging_1.logger.debug(\"initial ranges set\");\n", " }\n", " else\n", " logging_1.logger.warn('could not set initial ranges');\n", " }\n", " has_finished() {\n", " if (!super.has_finished())\n", " return false;\n", " for (const [, renderer_view] of this.renderer_views) {\n", " if (!renderer_view.has_finished())\n", " return false;\n", " }\n", " return true;\n", " }\n", " after_layout() {\n", " super.after_layout();\n", " this._needs_layout = false;\n", " this.model.setv({\n", " inner_width: Math.round(this.frame._width.value),\n", " inner_height: Math.round(this.frame._height.value),\n", " outer_width: Math.round(this.layout._width.value),\n", " outer_height: Math.round(this.layout._height.value),\n", " }, { no_change: true });\n", " if (this.model.match_aspect !== false) {\n", " this.pause();\n", " this.update_dataranges();\n", " this.unpause(true);\n", " }\n", " if (!this._outer_bbox.equals(this.layout.bbox)) {\n", " const { width, height } = this.layout.bbox;\n", " this.canvas_view.resize(width, height);\n", " this._outer_bbox = this.layout.bbox;\n", " this._invalidate_all = true;\n", " this._needs_paint = true;\n", " }\n", " if (!this._inner_bbox.equals(this.frame.inner_bbox)) {\n", " this._inner_bbox = this.layout.inner_bbox;\n", " this._needs_paint = true;\n", " }\n", " if (this._needs_paint) {\n", " // XXX: can't be this.request_paint(), because it would trigger back-and-forth\n", " // layout recomputing feedback loop between plots. Plots are also much more\n", " // responsive this way, especially in interactive mode.\n", " this._needs_paint = false;\n", " this.paint();\n", " }\n", " }\n", " repaint() {\n", " if (this._needs_layout)\n", " this._invalidate_layout();\n", " this.paint();\n", " }\n", " paint() {\n", " if (this.is_paused)\n", " return;\n", " logging_1.logger.trace(`PlotView.paint() for ${this.model.id}`);\n", " const { document } = this.model;\n", " if (document != null) {\n", " const interactive_duration = document.interactive_duration();\n", " if (interactive_duration >= 0 && interactive_duration < this.model.lod_interval) {\n", " setTimeout(() => {\n", " if (document.interactive_duration() > this.model.lod_timeout) {\n", " document.interactive_stop(this.model);\n", " }\n", " this.request_paint();\n", " }, this.model.lod_timeout);\n", " }\n", " else\n", " document.interactive_stop(this.model);\n", " }\n", " for (const [, renderer_view] of this.renderer_views) {\n", " if (this.range_update_timestamp == null ||\n", " (renderer_view instanceof glyph_renderer_1.GlyphRendererView && renderer_view.set_data_timestamp > this.range_update_timestamp)) {\n", " this.update_dataranges();\n", " break;\n", " }\n", " }\n", " let do_primary = false;\n", " let do_overlays = false;\n", " if (this._invalidate_all) {\n", " do_primary = true;\n", " do_overlays = true;\n", " }\n", " else {\n", " for (const painter of this._invalidated_painters) {\n", " const { level } = painter.model;\n", " if (level != \"overlay\")\n", " do_primary = true;\n", " else\n", " do_overlays = true;\n", " if (do_primary && do_overlays)\n", " break;\n", " }\n", " }\n", " this._invalidated_painters.clear();\n", " this._invalidate_all = false;\n", " const frame_box = [\n", " this.frame._left.value,\n", " this.frame._top.value,\n", " this.frame._width.value,\n", " this.frame._height.value,\n", " ];\n", " const { primary, overlays } = this.canvas_view;\n", " if (do_primary) {\n", " primary.prepare();\n", " this.canvas_view.prepare_webgl(frame_box);\n", " this.canvas_view.clear_webgl();\n", " this._map_hook(primary.ctx, frame_box);\n", " this._paint_empty(primary.ctx, frame_box);\n", " this._paint_outline(primary.ctx, frame_box);\n", " this._paint_levels(primary.ctx, \"image\", frame_box, true);\n", " this._paint_levels(primary.ctx, \"underlay\", frame_box, true);\n", " this._paint_levels(primary.ctx, \"glyph\", frame_box, true);\n", " this._paint_levels(primary.ctx, \"guide\", frame_box, false);\n", " this._paint_levels(primary.ctx, \"annotation\", frame_box, false);\n", " primary.finish();\n", " }\n", " if (do_overlays) {\n", " overlays.prepare();\n", " this._paint_levels(overlays.ctx, \"overlay\", frame_box, false);\n", " overlays.finish();\n", " }\n", " if (this._initial_state_info.range == null)\n", " this.set_initial_range();\n", " }\n", " _paint_levels(ctx, level, clip_region, global_clip) {\n", " for (const renderer of this.computed_renderers) {\n", " if (renderer.level != level)\n", " continue;\n", " const renderer_view = this.renderer_views.get(renderer);\n", " ctx.save();\n", " if (global_clip || renderer_view.needs_clip) {\n", " ctx.beginPath();\n", " ctx.rect(...clip_region);\n", " ctx.clip();\n", " }\n", " renderer_view.render();\n", " ctx.restore();\n", " if (renderer_view.has_webgl) {\n", " this.canvas_view.blit_webgl(ctx);\n", " this.canvas_view.clear_webgl();\n", " }\n", " }\n", " }\n", " _map_hook(_ctx, _frame_box) { }\n", " _paint_empty(ctx, frame_box) {\n", " const [cx, cy, cw, ch] = [0, 0, this.layout._width.value, this.layout._height.value];\n", " const [fx, fy, fw, fh] = frame_box;\n", " if (this.visuals.border_fill.doit) {\n", " this.visuals.border_fill.set_value(ctx);\n", " ctx.fillRect(cx, cy, cw, ch);\n", " ctx.clearRect(fx, fy, fw, fh);\n", " }\n", " if (this.visuals.background_fill.doit) {\n", " this.visuals.background_fill.set_value(ctx);\n", " ctx.fillRect(fx, fy, fw, fh);\n", " }\n", " }\n", " _paint_outline(ctx, frame_box) {\n", " if (this.visuals.outline_line.doit) {\n", " ctx.save();\n", " this.visuals.outline_line.set_value(ctx);\n", " let [x0, y0, w, h] = frame_box;\n", " // XXX: shrink outline region by 1px to make right and bottom lines visible\n", " // if they are on the edge of the canvas.\n", " if (x0 + w == this.layout._width.value) {\n", " w -= 1;\n", " }\n", " if (y0 + h == this.layout._height.value) {\n", " h -= 1;\n", " }\n", " ctx.strokeRect(x0, y0, w, h);\n", " ctx.restore();\n", " }\n", " }\n", " save(name) {\n", " this.canvas_view.save(name);\n", " }\n", " serializable_state() {\n", " const _a = super.serializable_state(), { children } = _a, state = __rest(_a, [\"children\"]);\n", " const renderers = this.get_renderer_views()\n", " .map((view) => view.serializable_state())\n", " .filter((item) => \"bbox\" in item);\n", " return Object.assign(Object.assign({}, state), { children: [...children, ...renderers] }); // XXX\n", " }\n", " }\n", " exports.PlotView = PlotView;\n", " PlotView.__name__ = \"PlotView\";\n", " },\n", " /* core/bokeh_events.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n", " var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n", " if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\")\n", " r = Reflect.decorate(decorators, target, key, desc);\n", " else\n", " for (var i = decorators.length - 1; i >= 0; i--)\n", " if (d = decorators[i])\n", " r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n", " return c > 3 && r && Object.defineProperty(target, key, r), r;\n", " };\n", " function event(event_name) {\n", " return function (cls) {\n", " cls.prototype.event_name = event_name;\n", " };\n", " }\n", " class BokehEvent {\n", " constructor() {\n", " this.origin = null;\n", " }\n", " to_json() {\n", " const { event_name } = this;\n", " return { event_name, event_values: this._to_json() };\n", " }\n", " _to_json() {\n", " return { model: this.origin };\n", " }\n", " }\n", " exports.BokehEvent = BokehEvent;\n", " BokehEvent.__name__ = \"BokehEvent\";\n", " let ButtonClick = class ButtonClick extends BokehEvent {\n", " };\n", " exports.ButtonClick = ButtonClick;\n", " ButtonClick.__name__ = \"ButtonClick\";\n", " exports.ButtonClick = ButtonClick = __decorate([\n", " event(\"button_click\")\n", " ], ButtonClick);\n", " let MenuItemClick = class MenuItemClick extends BokehEvent {\n", " constructor(item) {\n", " super();\n", " this.item = item;\n", " }\n", " _to_json() {\n", " const { item } = this;\n", " return Object.assign(Object.assign({}, super._to_json()), { item });\n", " }\n", " };\n", " exports.MenuItemClick = MenuItemClick;\n", " MenuItemClick.__name__ = \"MenuItemClick\";\n", " exports.MenuItemClick = MenuItemClick = __decorate([\n", " event(\"menu_item_click\")\n", " ], MenuItemClick);\n", " // A UIEvent is an event originating on a canvas this includes.\n", " // DOM events such as keystrokes as well as hammer events and LOD events.\n", " class UIEvent extends BokehEvent {\n", " }\n", " exports.UIEvent = UIEvent;\n", " UIEvent.__name__ = \"UIEvent\";\n", " let LODStart = class LODStart extends UIEvent {\n", " };\n", " exports.LODStart = LODStart;\n", " LODStart.__name__ = \"LODStart\";\n", " exports.LODStart = LODStart = __decorate([\n", " event(\"lodstart\")\n", " ], LODStart);\n", " let LODEnd = class LODEnd extends UIEvent {\n", " };\n", " exports.LODEnd = LODEnd;\n", " LODEnd.__name__ = \"LODEnd\";\n", " exports.LODEnd = LODEnd = __decorate([\n", " event(\"lodend\")\n", " ], LODEnd);\n", " let SelectionGeometry = class SelectionGeometry extends UIEvent {\n", " constructor(geometry, final) {\n", " super();\n", " this.geometry = geometry;\n", " this.final = final;\n", " }\n", " _to_json() {\n", " const { geometry, final } = this;\n", " return Object.assign(Object.assign({}, super._to_json()), { geometry, final });\n", " }\n", " };\n", " exports.SelectionGeometry = SelectionGeometry;\n", " SelectionGeometry.__name__ = \"SelectionGeometry\";\n", " exports.SelectionGeometry = SelectionGeometry = __decorate([\n", " event(\"selectiongeometry\")\n", " ], SelectionGeometry);\n", " let Reset = class Reset extends UIEvent {\n", " };\n", " exports.Reset = Reset;\n", " Reset.__name__ = \"Reset\";\n", " exports.Reset = Reset = __decorate([\n", " event(\"reset\")\n", " ], Reset);\n", " class PointEvent extends UIEvent {\n", " constructor(sx, sy, x, y) {\n", " super();\n", " this.sx = sx;\n", " this.sy = sy;\n", " this.x = x;\n", " this.y = y;\n", " }\n", " _to_json() {\n", " const { sx, sy, x, y } = this;\n", " return Object.assign(Object.assign({}, super._to_json()), { sx, sy, x, y });\n", " }\n", " }\n", " exports.PointEvent = PointEvent;\n", " PointEvent.__name__ = \"PointEvent\";\n", " let Pan = class Pan extends PointEvent {\n", " /* TODO: direction: -1 | 1 */\n", " constructor(sx, sy, x, y, delta_x, delta_y) {\n", " super(sx, sy, x, y);\n", " this.sx = sx;\n", " this.sy = sy;\n", " this.x = x;\n", " this.y = y;\n", " this.delta_x = delta_x;\n", " this.delta_y = delta_y;\n", " }\n", " _to_json() {\n", " const { delta_x, delta_y /*, direction*/ } = this;\n", " return Object.assign(Object.assign({}, super._to_json()), { delta_x, delta_y /*, direction*/ });\n", " }\n", " };\n", " exports.Pan = Pan;\n", " Pan.__name__ = \"Pan\";\n", " exports.Pan = Pan = __decorate([\n", " event(\"pan\")\n", " ], Pan);\n", " let Pinch = class Pinch extends PointEvent {\n", " constructor(sx, sy, x, y, scale) {\n", " super(sx, sy, x, y);\n", " this.sx = sx;\n", " this.sy = sy;\n", " this.x = x;\n", " this.y = y;\n", " this.scale = scale;\n", " }\n", " _to_json() {\n", " const { scale } = this;\n", " return Object.assign(Object.assign({}, super._to_json()), { scale });\n", " }\n", " };\n", " exports.Pinch = Pinch;\n", " Pinch.__name__ = \"Pinch\";\n", " exports.Pinch = Pinch = __decorate([\n", " event(\"pinch\")\n", " ], Pinch);\n", " let Rotate = class Rotate extends PointEvent {\n", " constructor(sx, sy, x, y, rotation) {\n", " super(sx, sy, x, y);\n", " this.sx = sx;\n", " this.sy = sy;\n", " this.x = x;\n", " this.y = y;\n", " this.rotation = rotation;\n", " }\n", " _to_json() {\n", " const { rotation } = this;\n", " return Object.assign(Object.assign({}, super._to_json()), { rotation });\n", " }\n", " };\n", " exports.Rotate = Rotate;\n", " Rotate.__name__ = \"Rotate\";\n", " exports.Rotate = Rotate = __decorate([\n", " event(\"rotate\")\n", " ], Rotate);\n", " let MouseWheel = class MouseWheel extends PointEvent {\n", " constructor(sx, sy, x, y, delta) {\n", " super(sx, sy, x, y);\n", " this.sx = sx;\n", " this.sy = sy;\n", " this.x = x;\n", " this.y = y;\n", " this.delta = delta;\n", " }\n", " _to_json() {\n", " const { delta } = this;\n", " return Object.assign(Object.assign({}, super._to_json()), { delta });\n", " }\n", " };\n", " exports.MouseWheel = MouseWheel;\n", " MouseWheel.__name__ = \"MouseWheel\";\n", " exports.MouseWheel = MouseWheel = __decorate([\n", " event(\"wheel\")\n", " ], MouseWheel);\n", " let MouseMove = class MouseMove extends PointEvent {\n", " };\n", " exports.MouseMove = MouseMove;\n", " MouseMove.__name__ = \"MouseMove\";\n", " exports.MouseMove = MouseMove = __decorate([\n", " event(\"mousemove\")\n", " ], MouseMove);\n", " let MouseEnter = class MouseEnter extends PointEvent {\n", " };\n", " exports.MouseEnter = MouseEnter;\n", " MouseEnter.__name__ = \"MouseEnter\";\n", " exports.MouseEnter = MouseEnter = __decorate([\n", " event(\"mouseenter\")\n", " ], MouseEnter);\n", " let MouseLeave = class MouseLeave extends PointEvent {\n", " };\n", " exports.MouseLeave = MouseLeave;\n", " MouseLeave.__name__ = \"MouseLeave\";\n", " exports.MouseLeave = MouseLeave = __decorate([\n", " event(\"mouseleave\")\n", " ], MouseLeave);\n", " let Tap = class Tap extends PointEvent {\n", " };\n", " exports.Tap = Tap;\n", " Tap.__name__ = \"Tap\";\n", " exports.Tap = Tap = __decorate([\n", " event(\"tap\")\n", " ], Tap);\n", " let DoubleTap = class DoubleTap extends PointEvent {\n", " };\n", " exports.DoubleTap = DoubleTap;\n", " DoubleTap.__name__ = \"DoubleTap\";\n", " exports.DoubleTap = DoubleTap = __decorate([\n", " event(\"doubletap\")\n", " ], DoubleTap);\n", " let Press = class Press extends PointEvent {\n", " };\n", " exports.Press = Press;\n", " Press.__name__ = \"Press\";\n", " exports.Press = Press = __decorate([\n", " event(\"press\")\n", " ], Press);\n", " let PressUp = class PressUp extends PointEvent {\n", " };\n", " exports.PressUp = PressUp;\n", " PressUp.__name__ = \"PressUp\";\n", " exports.PressUp = PressUp = __decorate([\n", " event(\"pressup\")\n", " ], PressUp);\n", " let PanStart = class PanStart extends PointEvent {\n", " };\n", " exports.PanStart = PanStart;\n", " PanStart.__name__ = \"PanStart\";\n", " exports.PanStart = PanStart = __decorate([\n", " event(\"panstart\")\n", " ], PanStart);\n", " let PanEnd = class PanEnd extends PointEvent {\n", " };\n", " exports.PanEnd = PanEnd;\n", " PanEnd.__name__ = \"PanEnd\";\n", " exports.PanEnd = PanEnd = __decorate([\n", " event(\"panend\")\n", " ], PanEnd);\n", " let PinchStart = class PinchStart extends PointEvent {\n", " };\n", " exports.PinchStart = PinchStart;\n", " PinchStart.__name__ = \"PinchStart\";\n", " exports.PinchStart = PinchStart = __decorate([\n", " event(\"pinchstart\")\n", " ], PinchStart);\n", " let PinchEnd = class PinchEnd extends PointEvent {\n", " };\n", " exports.PinchEnd = PinchEnd;\n", " PinchEnd.__name__ = \"PinchEnd\";\n", " exports.PinchEnd = PinchEnd = __decorate([\n", " event(\"pinchend\")\n", " ], PinchEnd);\n", " let RotateStart = class RotateStart extends PointEvent {\n", " };\n", " exports.RotateStart = RotateStart;\n", " RotateStart.__name__ = \"RotateStart\";\n", " exports.RotateStart = RotateStart = __decorate([\n", " event(\"rotatestart\")\n", " ], RotateStart);\n", " let RotateEnd = class RotateEnd extends PointEvent {\n", " };\n", " exports.RotateEnd = RotateEnd;\n", " RotateEnd.__name__ = \"RotateEnd\";\n", " exports.RotateEnd = RotateEnd = __decorate([\n", " event(\"rotateend\")\n", " ], RotateEnd);\n", " },\n", " /* core/ui_events.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const hammerjs_1 = tslib_1.__importDefault(require(276) /* hammerjs */);\n", " const signaling_1 = require(14) /* ./signaling */;\n", " const logging_1 = require(72) /* ./logging */;\n", " const dom_1 = require(68) /* ./dom */;\n", " const wheel_1 = require(293) /* ./util/wheel */;\n", " const array_1 = require(9) /* ./util/array */;\n", " const types_1 = require(8) /* ./util/types */;\n", " const compat_1 = require(28) /* ./util/compat */;\n", " const events = tslib_1.__importStar(require(291) /* ./bokeh_events */);\n", " const menus_1 = require(281) /* ./util/menus */;\n", " function is_touch(event) {\n", " return typeof TouchEvent !== \"undefined\" && event instanceof TouchEvent;\n", " }\n", " class UIEvents {\n", " constructor(plot_view, toolbar, hit_area) {\n", " this.plot_view = plot_view;\n", " this.toolbar = toolbar;\n", " this.hit_area = hit_area;\n", " this.pan_start = new signaling_1.Signal(this, 'pan:start');\n", " this.pan = new signaling_1.Signal(this, 'pan');\n", " this.pan_end = new signaling_1.Signal(this, 'pan:end');\n", " this.pinch_start = new signaling_1.Signal(this, 'pinch:start');\n", " this.pinch = new signaling_1.Signal(this, 'pinch');\n", " this.pinch_end = new signaling_1.Signal(this, 'pinch:end');\n", " this.rotate_start = new signaling_1.Signal(this, 'rotate:start');\n", " this.rotate = new signaling_1.Signal(this, 'rotate');\n", " this.rotate_end = new signaling_1.Signal(this, 'rotate:end');\n", " this.tap = new signaling_1.Signal(this, 'tap');\n", " this.doubletap = new signaling_1.Signal(this, 'doubletap');\n", " this.press = new signaling_1.Signal(this, 'press');\n", " this.pressup = new signaling_1.Signal(this, 'pressup');\n", " this.move_enter = new signaling_1.Signal(this, 'move:enter');\n", " this.move = new signaling_1.Signal(this, 'move');\n", " this.move_exit = new signaling_1.Signal(this, 'move:exit');\n", " this.scroll = new signaling_1.Signal(this, 'scroll');\n", " this.keydown = new signaling_1.Signal(this, 'keydown');\n", " this.keyup = new signaling_1.Signal(this, 'keyup');\n", " this.hammer = new hammerjs_1.default(this.hit_area, {\n", " touchAction: 'auto',\n", " inputClass: hammerjs_1.default.TouchMouseInput,\n", " });\n", " this._configure_hammerjs();\n", " // Mouse & keyboard events not handled through hammerjs\n", " // We can 'add and forget' these event listeners because this.hit_area is a DOM element\n", " // that will be thrown away when the view is removed\n", " this.hit_area.addEventListener(\"mousemove\", (e) => this._mouse_move(e));\n", " this.hit_area.addEventListener(\"mouseenter\", (e) => this._mouse_enter(e));\n", " this.hit_area.addEventListener(\"mouseleave\", (e) => this._mouse_exit(e));\n", " this.hit_area.addEventListener(\"contextmenu\", (e) => this._context_menu(e));\n", " this.hit_area.addEventListener(\"wheel\", (e) => this._mouse_wheel(e));\n", " // But we MUST remove listeners registered on document or we'll leak memory: register\n", " // 'this' as the listener (it implements the event listener interface, i.e. handleEvent)\n", " // instead of an anonymous function so we can easily refer back to it for removing\n", " document.addEventListener(\"keydown\", this);\n", " document.addEventListener(\"keyup\", this);\n", " this.menu = new menus_1.ContextMenu([], {\n", " prevent_hide: (event) => event.button == 2 && event.target == this.hit_area,\n", " });\n", " this.hit_area.appendChild(this.menu.el);\n", " }\n", " destroy() {\n", " this.menu.remove();\n", " this.hammer.destroy();\n", " document.removeEventListener(\"keydown\", this);\n", " document.removeEventListener(\"keyup\", this);\n", " }\n", " handleEvent(e) {\n", " if (e.type == \"keydown\")\n", " this._key_down(e);\n", " else if (e.type == \"keyup\")\n", " this._key_up(e);\n", " }\n", " _configure_hammerjs() {\n", " // This is to be able to distinguish double taps from single taps\n", " this.hammer.get('doubletap').recognizeWith('tap');\n", " this.hammer.get('tap').requireFailure('doubletap');\n", " this.hammer.get('doubletap').dropRequireFailure('tap');\n", " this.hammer.on('doubletap', (e) => this._doubletap(e));\n", " this.hammer.on('tap', (e) => this._tap(e));\n", " this.hammer.on('press', (e) => this._press(e));\n", " this.hammer.on('pressup', (e) => this._pressup(e));\n", " this.hammer.get('pan').set({ direction: hammerjs_1.default.DIRECTION_ALL });\n", " this.hammer.on('panstart', (e) => this._pan_start(e));\n", " this.hammer.on('pan', (e) => this._pan(e));\n", " this.hammer.on('panend', (e) => this._pan_end(e));\n", " this.hammer.get('pinch').set({ enable: true });\n", " this.hammer.on('pinchstart', (e) => this._pinch_start(e));\n", " this.hammer.on('pinch', (e) => this._pinch(e));\n", " this.hammer.on('pinchend', (e) => this._pinch_end(e));\n", " this.hammer.get('rotate').set({ enable: true });\n", " this.hammer.on('rotatestart', (e) => this._rotate_start(e));\n", " this.hammer.on('rotate', (e) => this._rotate(e));\n", " this.hammer.on('rotateend', (e) => this._rotate_end(e));\n", " }\n", " register_tool(tool_view) {\n", " const et = tool_view.model.event_type;\n", " if (et != null) {\n", " if (types_1.isString(et))\n", " this._register_tool(tool_view, et);\n", " else {\n", " // Multi-tools should only registered shared events once\n", " et.forEach((e, index) => this._register_tool(tool_view, e, index < 1));\n", " }\n", " }\n", " }\n", " _register_tool(tool_view, et, shared = true) {\n", " const v = tool_view;\n", " const { id } = v.model;\n", " const conditionally = (fn) => (arg) => {\n", " if (arg.id == id)\n", " fn(arg.e);\n", " };\n", " const unconditionally = (fn) => (arg) => {\n", " fn(arg.e);\n", " };\n", " switch (et) {\n", " case \"pan\": {\n", " if (v._pan_start != null)\n", " v.connect(this.pan_start, conditionally(v._pan_start.bind(v)));\n", " if (v._pan != null)\n", " v.connect(this.pan, conditionally(v._pan.bind(v)));\n", " if (v._pan_end != null)\n", " v.connect(this.pan_end, conditionally(v._pan_end.bind(v)));\n", " break;\n", " }\n", " case \"pinch\": {\n", " if (v._pinch_start != null)\n", " v.connect(this.pinch_start, conditionally(v._pinch_start.bind(v)));\n", " if (v._pinch != null)\n", " v.connect(this.pinch, conditionally(v._pinch.bind(v)));\n", " if (v._pinch_end != null)\n", " v.connect(this.pinch_end, conditionally(v._pinch_end.bind(v)));\n", " break;\n", " }\n", " case \"rotate\": {\n", " if (v._rotate_start != null)\n", " v.connect(this.rotate_start, conditionally(v._rotate_start.bind(v)));\n", " if (v._rotate != null)\n", " v.connect(this.rotate, conditionally(v._rotate.bind(v)));\n", " if (v._rotate_end != null)\n", " v.connect(this.rotate_end, conditionally(v._rotate_end.bind(v)));\n", " break;\n", " }\n", " case \"move\": {\n", " if (v._move_enter != null)\n", " v.connect(this.move_enter, conditionally(v._move_enter.bind(v)));\n", " if (v._move != null)\n", " v.connect(this.move, conditionally(v._move.bind(v)));\n", " if (v._move_exit != null)\n", " v.connect(this.move_exit, conditionally(v._move_exit.bind(v)));\n", " break;\n", " }\n", " case \"tap\": {\n", " if (v._tap != null)\n", " v.connect(this.tap, conditionally(v._tap.bind(v)));\n", " break;\n", " }\n", " case \"press\": {\n", " if (v._press != null)\n", " v.connect(this.press, conditionally(v._press.bind(v)));\n", " if (v._pressup != null)\n", " v.connect(this.pressup, conditionally(v._pressup.bind(v)));\n", " break;\n", " }\n", " case \"scroll\": {\n", " if (v._scroll != null)\n", " v.connect(this.scroll, conditionally(v._scroll.bind(v)));\n", " break;\n", " }\n", " default:\n", " throw new Error(`unsupported event_type: ${et}`);\n", " }\n", " // Skip shared events if registering multi-tool\n", " if (!shared)\n", " return;\n", " if (v._doubletap != null)\n", " v.connect(this.doubletap, unconditionally(v._doubletap.bind(v)));\n", " if (v._keydown != null)\n", " v.connect(this.keydown, unconditionally(v._keydown.bind(v)));\n", " if (v._keyup != null)\n", " v.connect(this.keyup, unconditionally(v._keyup.bind(v)));\n", " // Dual touch hack part 1/2\n", " // This is a hack for laptops with touch screen who may be pinching or scrolling\n", " // in order to use the wheel zoom tool. If it's a touch screen the WheelZoomTool event\n", " // will be linked to pinch. But we also want to trigger in the case of a scroll.\n", " if (compat_1.is_mobile && v._scroll != null && et == 'pinch') {\n", " logging_1.logger.debug(\"Registering scroll on touch screen\");\n", " v.connect(this.scroll, conditionally(v._scroll.bind(v)));\n", " }\n", " }\n", " _hit_test_renderers(sx, sy) {\n", " const views = this.plot_view.get_renderer_views();\n", " for (const view of array_1.reversed(views)) {\n", " const { level } = view.model;\n", " if ((level == 'annotation' || level == 'overlay') && view.interactive_hit != null) {\n", " if (view.interactive_hit(sx, sy))\n", " return view;\n", " }\n", " }\n", " return null;\n", " }\n", " _hit_test_frame(sx, sy) {\n", " return this.plot_view.frame.bbox.contains(sx, sy);\n", " }\n", " _hit_test_canvas(sx, sy) {\n", " return this.plot_view.layout.bbox.contains(sx, sy);\n", " }\n", " _trigger(signal, e, srcEvent) {\n", " const gestures = this.toolbar.gestures;\n", " const event_type = signal.name;\n", " const base_type = event_type.split(\":\")[0];\n", " const view = this._hit_test_renderers(e.sx, e.sy);\n", " const on_canvas = this._hit_test_canvas(e.sx, e.sy);\n", " switch (base_type) {\n", " case \"move\": {\n", " const active_gesture = gestures[base_type].active;\n", " if (active_gesture != null)\n", " this.trigger(signal, e, active_gesture.id);\n", " const active_inspectors = this.toolbar.inspectors.filter(t => t.active);\n", " let cursor = \"default\";\n", " // the event happened on a renderer\n", " if (view != null) {\n", " cursor = view.cursor(e.sx, e.sy) || cursor;\n", " if (!array_1.is_empty(active_inspectors)) {\n", " // override event_type to cause inspectors to clear overlays\n", " signal = this.move_exit; // XXX\n", " }\n", " // the event happened on the plot frame but off a renderer\n", " }\n", " else if (this._hit_test_frame(e.sx, e.sy)) {\n", " if (!array_1.is_empty(active_inspectors)) {\n", " cursor = \"crosshair\";\n", " }\n", " }\n", " this.plot_view.set_cursor(cursor);\n", " this.plot_view.set_toolbar_visibility(on_canvas);\n", " active_inspectors.map((inspector) => this.trigger(signal, e, inspector.id));\n", " break;\n", " }\n", " case \"tap\": {\n", " const { target } = srcEvent;\n", " if (target != null && target != this.hit_area)\n", " return; // don't trigger bokeh events\n", " if (view != null && view.on_hit != null)\n", " view.on_hit(e.sx, e.sy);\n", " const active_gesture = gestures[base_type].active;\n", " if (active_gesture != null)\n", " this.trigger(signal, e, active_gesture.id);\n", " break;\n", " }\n", " case \"scroll\": {\n", " // Dual touch hack part 2/2\n", " // This is a hack for laptops with touch screen who may be pinching or scrolling\n", " // in order to use the wheel zoom tool. If it's a touch screen the WheelZoomTool event\n", " // will be linked to pinch. But we also want to trigger in the case of a scroll.\n", " const base = compat_1.is_mobile ? \"pinch\" : \"scroll\";\n", " const active_gesture = gestures[base].active;\n", " if (active_gesture != null) {\n", " srcEvent.preventDefault();\n", " srcEvent.stopPropagation();\n", " this.trigger(signal, e, active_gesture.id);\n", " }\n", " break;\n", " }\n", " case \"pan\": {\n", " const active_gesture = gestures[base_type].active;\n", " if (active_gesture != null) {\n", " srcEvent.preventDefault();\n", " this.trigger(signal, e, active_gesture.id);\n", " }\n", " break;\n", " }\n", " default: {\n", " const active_gesture = gestures[base_type].active;\n", " if (active_gesture != null)\n", " this.trigger(signal, e, active_gesture.id);\n", " }\n", " }\n", " this._trigger_bokeh_event(e);\n", " }\n", " trigger(signal, e, id = null) {\n", " signal.emit({ id, e });\n", " }\n", " _trigger_bokeh_event(e) {\n", " const ev = (() => {\n", " const xscale = this.plot_view.frame.xscales.default;\n", " const yscale = this.plot_view.frame.yscales.default;\n", " const { sx, sy } = e;\n", " const x = xscale.invert(sx);\n", " const y = yscale.invert(sy);\n", " switch (e.type) {\n", " case \"wheel\":\n", " return new events.MouseWheel(sx, sy, x, y, e.delta);\n", " case \"mousemove\":\n", " return new events.MouseMove(sx, sy, x, y);\n", " case \"mouseenter\":\n", " return new events.MouseEnter(sx, sy, x, y);\n", " case \"mouseleave\":\n", " return new events.MouseLeave(sx, sy, x, y);\n", " case \"tap\":\n", " return new events.Tap(sx, sy, x, y);\n", " case \"doubletap\":\n", " return new events.DoubleTap(sx, sy, x, y);\n", " case \"press\":\n", " return new events.Press(sx, sy, x, y);\n", " case \"pressup\":\n", " return new events.PressUp(sx, sy, x, y);\n", " case \"pan\":\n", " return new events.Pan(sx, sy, x, y, e.deltaX, e.deltaY);\n", " case \"panstart\":\n", " return new events.PanStart(sx, sy, x, y);\n", " case \"panend\":\n", " return new events.PanEnd(sx, sy, x, y);\n", " case \"pinch\":\n", " return new events.Pinch(sx, sy, x, y, e.scale);\n", " case \"pinchstart\":\n", " return new events.PinchStart(sx, sy, x, y);\n", " case \"pinchend\":\n", " return new events.PinchEnd(sx, sy, x, y);\n", " case \"rotate\":\n", " return new events.Rotate(sx, sy, x, y, e.rotation);\n", " case \"rotatestart\":\n", " return new events.RotateStart(sx, sy, x, y);\n", " case \"rotateend\":\n", " return new events.RotateEnd(sx, sy, x, y);\n", " default:\n", " return undefined;\n", " }\n", " })();\n", " if (ev != null)\n", " this.plot_view.model.trigger_event(ev);\n", " }\n", " _get_sxy(event) {\n", " const { pageX, pageY } = is_touch(event) ? (event.touches.length != 0 ? event.touches : event.changedTouches)[0] : event;\n", " const { left, top } = dom_1.offset(this.hit_area);\n", " return {\n", " sx: pageX - left,\n", " sy: pageY - top,\n", " };\n", " }\n", " _pan_event(e) {\n", " return Object.assign(Object.assign({ type: e.type }, this._get_sxy(e.srcEvent)), { deltaX: e.deltaX, deltaY: e.deltaY, shiftKey: e.srcEvent.shiftKey, ctrlKey: e.srcEvent.ctrlKey });\n", " }\n", " _pinch_event(e) {\n", " return Object.assign(Object.assign({ type: e.type }, this._get_sxy(e.srcEvent)), { scale: e.scale, shiftKey: e.srcEvent.shiftKey, ctrlKey: e.srcEvent.ctrlKey });\n", " }\n", " _rotate_event(e) {\n", " return Object.assign(Object.assign({ type: e.type }, this._get_sxy(e.srcEvent)), { rotation: e.rotation, shiftKey: e.srcEvent.shiftKey, ctrlKey: e.srcEvent.ctrlKey });\n", " }\n", " _tap_event(e) {\n", " return Object.assign(Object.assign({ type: e.type }, this._get_sxy(e.srcEvent)), { shiftKey: e.srcEvent.shiftKey, ctrlKey: e.srcEvent.ctrlKey });\n", " }\n", " _move_event(e) {\n", " return Object.assign(Object.assign({ type: e.type }, this._get_sxy(e)), { shiftKey: e.shiftKey, ctrlKey: e.ctrlKey });\n", " }\n", " _scroll_event(e) {\n", " return Object.assign(Object.assign({ type: e.type }, this._get_sxy(e)), { delta: wheel_1.getDeltaY(e), shiftKey: e.shiftKey, ctrlKey: e.ctrlKey });\n", " }\n", " _key_event(e) {\n", " return {\n", " type: e.type,\n", " keyCode: e.keyCode,\n", " };\n", " }\n", " _pan_start(e) {\n", " const ev = this._pan_event(e);\n", " // back out delta to get original center point\n", " ev.sx -= e.deltaX;\n", " ev.sy -= e.deltaY;\n", " this._trigger(this.pan_start, ev, e.srcEvent);\n", " }\n", " _pan(e) {\n", " this._trigger(this.pan, this._pan_event(e), e.srcEvent);\n", " }\n", " _pan_end(e) {\n", " this._trigger(this.pan_end, this._pan_event(e), e.srcEvent);\n", " }\n", " _pinch_start(e) {\n", " this._trigger(this.pinch_start, this._pinch_event(e), e.srcEvent);\n", " }\n", " _pinch(e) {\n", " this._trigger(this.pinch, this._pinch_event(e), e.srcEvent);\n", " }\n", " _pinch_end(e) {\n", " this._trigger(this.pinch_end, this._pinch_event(e), e.srcEvent);\n", " }\n", " _rotate_start(e) {\n", " this._trigger(this.rotate_start, this._rotate_event(e), e.srcEvent);\n", " }\n", " _rotate(e) {\n", " this._trigger(this.rotate, this._rotate_event(e), e.srcEvent);\n", " }\n", " _rotate_end(e) {\n", " this._trigger(this.rotate_end, this._rotate_event(e), e.srcEvent);\n", " }\n", " _tap(e) {\n", " this._trigger(this.tap, this._tap_event(e), e.srcEvent);\n", " }\n", " _doubletap(e) {\n", " // NOTE: doubletap event triggered unconditionally\n", " const ev = this._tap_event(e);\n", " this._trigger_bokeh_event(ev);\n", " this.trigger(this.doubletap, ev);\n", " }\n", " _press(e) {\n", " this._trigger(this.press, this._tap_event(e), e.srcEvent);\n", " }\n", " _pressup(e) {\n", " this._trigger(this.pressup, this._tap_event(e), e.srcEvent);\n", " }\n", " _mouse_enter(e) {\n", " this._trigger(this.move_enter, this._move_event(e), e);\n", " }\n", " _mouse_move(e) {\n", " this._trigger(this.move, this._move_event(e), e);\n", " }\n", " _mouse_exit(e) {\n", " this._trigger(this.move_exit, this._move_event(e), e);\n", " }\n", " _mouse_wheel(e) {\n", " this._trigger(this.scroll, this._scroll_event(e), e);\n", " }\n", " _context_menu(e) {\n", " if (!this.menu.is_open && this.menu.can_open) {\n", " e.preventDefault();\n", " }\n", " const { sx, sy } = this._get_sxy(e);\n", " this.menu.toggle({ left: sx, top: sy });\n", " }\n", " _key_down(e) {\n", " // NOTE: keyup event triggered unconditionally\n", " this.trigger(this.keydown, this._key_event(e));\n", " }\n", " _key_up(e) {\n", " // NOTE: keyup event triggered unconditionally\n", " this.trigger(this.keyup, this._key_event(e));\n", " }\n", " }\n", " exports.UIEvents = UIEvents;\n", " UIEvents.__name__ = \"UIEvents\";\n", " },\n", " /* core/util/wheel.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " /*!\n", " * jQuery Mousewheel 3.1.13\n", " *\n", " * Copyright jQuery Foundation and other contributors\n", " * Released under the MIT license\n", " * http://jquery.org/license\n", " */\n", " function fontSize(element) {\n", " const value = getComputedStyle(element).fontSize;\n", " if (value != null)\n", " return parseInt(value, 10);\n", " return null;\n", " }\n", " function lineHeight(element) {\n", " const parent = element.offsetParent || document.body;\n", " return fontSize(parent) || fontSize(element) || 16;\n", " }\n", " function pageHeight(element) {\n", " return element.clientHeight; // XXX: should be content height?\n", " }\n", " function getDeltaY(event) {\n", " let deltaY = -event.deltaY;\n", " if (event.target instanceof HTMLElement) {\n", " switch (event.deltaMode) {\n", " case event.DOM_DELTA_LINE:\n", " deltaY *= lineHeight(event.target);\n", " break;\n", " case event.DOM_DELTA_PAGE:\n", " deltaY *= pageHeight(event.target);\n", " break;\n", " }\n", " }\n", " return deltaY;\n", " }\n", " exports.getDeltaY = getDeltaY;\n", " },\n", " /* core/util/throttle.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " function _delay_animation(callback) {\n", " callback(Date.now()); // XXX: performance.now()\n", " return -1;\n", " }\n", " const delay_animation = (typeof window !== 'undefined' ? window.requestAnimationFrame : undefined) ||\n", " (typeof window !== 'undefined' ? window.webkitRequestAnimationFrame : undefined) ||\n", " (typeof window !== 'undefined' ? window.mozRequestAnimationFrame : undefined) ||\n", " (typeof window !== 'undefined' ? window.msRequestAnimationFrame : undefined) || _delay_animation;\n", " // Returns a function, that, when invoked, will only be triggered at\n", " // most once during a given window of time.\n", " //\n", " // In addition, if the browser supports requestAnimationFrame, the\n", " // throttled function will be run no more frequently than request\n", " // animation frame allows.\n", " //\n", " // @param func [function] the function to throttle\n", " // @param wait [number] time in milliseconds to use for window\n", " // @return [function] throttled function\n", " //\n", " function throttle(func, wait) {\n", " let timeout = null;\n", " let previous = 0;\n", " let pending = false;\n", " return function () {\n", " return new Promise((resolve, reject) => {\n", " const later = function () {\n", " previous = Date.now();\n", " timeout = null;\n", " pending = false;\n", " try {\n", " func();\n", " resolve();\n", " }\n", " catch (error) {\n", " reject(error);\n", " }\n", " };\n", " const now = Date.now();\n", " const remaining = wait - (now - previous);\n", " if (remaining <= 0 && !pending) {\n", " if (timeout != null) {\n", " clearTimeout(timeout);\n", " }\n", " pending = true;\n", " delay_animation(later);\n", " }\n", " else if (!timeout && !pending) {\n", " timeout = setTimeout(() => delay_animation(later), remaining);\n", " }\n", " else {\n", " resolve();\n", " }\n", " });\n", " };\n", " }\n", " exports.throttle = throttle;\n", " },\n", " /* core/layout/side_panel.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const types_1 = require(189) /* ./types */;\n", " const layoutable_1 = require(190) /* ./layoutable */;\n", " const types_2 = require(8) /* ../util/types */;\n", " // This table lays out the rules for configuring the baseline, alignment, etc. of\n", " // title text, based on it's location and orientation\n", " //\n", " // side orient baseline align angle normal-dist\n", " // ------------------------------------------------------------------------------\n", " // above parallel bottom center 0 height\n", " // normal middle left -90 width\n", " // horizontal bottom center 0 height\n", " // [angle > 0] middle left width * sin + height * cos\n", " // [angle < 0] middle right width * sin + height * cos\n", " //\n", " // below parallel top center 0 height\n", " // normal middle right 90 width\n", " // horizontal top center 0 height\n", " // [angle > 0] middle right width * sin + height * cos\n", " // [angle < 0] middle left width * sin + height * cos\n", " //\n", " // left parallel bottom center 90 height\n", " // normal middle right 0 width\n", " // horizontal middle right 0 width\n", " // [angle > 0] middle right width * cos + height * sin\n", " // [angle < 0] middle right width * cos + height + sin\n", " //\n", " // right parallel bottom center -90 height\n", " // normal middle left 0 width\n", " // horizontal middle left 0 width\n", " // [angle > 0] middle left width * cos + height * sin\n", " // [angle < 0] middle left width * cos + height + sin\n", " const pi2 = Math.PI / 2;\n", " const ALPHABETIC = 'alphabetic';\n", " const TOP = 'top';\n", " const BOTTOM = 'bottom';\n", " const MIDDLE = 'middle';\n", " const HANGING = 'hanging';\n", " const LEFT = 'left';\n", " const RIGHT = 'right';\n", " const CENTER = 'center';\n", " const _angle_lookup = {\n", " above: {\n", " parallel: 0,\n", " normal: -pi2,\n", " horizontal: 0,\n", " vertical: -pi2,\n", " },\n", " below: {\n", " parallel: 0,\n", " normal: pi2,\n", " horizontal: 0,\n", " vertical: pi2,\n", " },\n", " left: {\n", " parallel: -pi2,\n", " normal: 0,\n", " horizontal: 0,\n", " vertical: -pi2,\n", " },\n", " right: {\n", " parallel: pi2,\n", " normal: 0,\n", " horizontal: 0,\n", " vertical: pi2,\n", " },\n", " };\n", " const _baseline_lookup = {\n", " above: {\n", " justified: TOP,\n", " parallel: ALPHABETIC,\n", " normal: MIDDLE,\n", " horizontal: ALPHABETIC,\n", " vertical: MIDDLE,\n", " },\n", " below: {\n", " justified: BOTTOM,\n", " parallel: HANGING,\n", " normal: MIDDLE,\n", " horizontal: HANGING,\n", " vertical: MIDDLE,\n", " },\n", " left: {\n", " justified: TOP,\n", " parallel: ALPHABETIC,\n", " normal: MIDDLE,\n", " horizontal: MIDDLE,\n", " vertical: ALPHABETIC,\n", " },\n", " right: {\n", " justified: TOP,\n", " parallel: ALPHABETIC,\n", " normal: MIDDLE,\n", " horizontal: MIDDLE,\n", " vertical: ALPHABETIC,\n", " },\n", " };\n", " const _align_lookup = {\n", " above: {\n", " justified: CENTER,\n", " parallel: CENTER,\n", " normal: LEFT,\n", " horizontal: CENTER,\n", " vertical: LEFT,\n", " },\n", " below: {\n", " justified: CENTER,\n", " parallel: CENTER,\n", " normal: LEFT,\n", " horizontal: CENTER,\n", " vertical: LEFT,\n", " },\n", " left: {\n", " justified: CENTER,\n", " parallel: CENTER,\n", " normal: RIGHT,\n", " horizontal: RIGHT,\n", " vertical: CENTER,\n", " },\n", " right: {\n", " justified: CENTER,\n", " parallel: CENTER,\n", " normal: LEFT,\n", " horizontal: LEFT,\n", " vertical: CENTER,\n", " },\n", " };\n", " const _align_lookup_negative = {\n", " above: RIGHT,\n", " below: LEFT,\n", " left: RIGHT,\n", " right: LEFT,\n", " };\n", " const _align_lookup_positive = {\n", " above: LEFT,\n", " below: RIGHT,\n", " left: RIGHT,\n", " right: LEFT,\n", " };\n", " class SidePanel extends layoutable_1.ContentLayoutable {\n", " constructor(side, obj) {\n", " super();\n", " this.side = side;\n", " this.obj = obj;\n", " switch (this.side) {\n", " case \"above\":\n", " this._dim = 0;\n", " this._normals = [0, -1];\n", " break;\n", " case \"below\":\n", " this._dim = 0;\n", " this._normals = [0, 1];\n", " break;\n", " case \"left\":\n", " this._dim = 1;\n", " this._normals = [-1, 0];\n", " break;\n", " case \"right\":\n", " this._dim = 1;\n", " this._normals = [1, 0];\n", " break;\n", " }\n", " if (this.is_horizontal)\n", " this.set_sizing({ width_policy: \"max\", height_policy: \"fixed\" });\n", " else\n", " this.set_sizing({ width_policy: \"fixed\", height_policy: \"max\" });\n", " }\n", " _content_size() {\n", " return new types_1.Sizeable(this.get_oriented_size());\n", " }\n", " get_oriented_size() {\n", " const { width, height } = this.obj.get_size();\n", " if (!this.obj.rotate || this.is_horizontal)\n", " return { width, height };\n", " else\n", " return { width: height, height: width };\n", " }\n", " has_size_changed() {\n", " const { width, height } = this.get_oriented_size();\n", " if (this.is_horizontal)\n", " return this.bbox.height != height;\n", " else\n", " return this.bbox.width != width;\n", " }\n", " get dimension() {\n", " return this._dim;\n", " }\n", " get normals() {\n", " return this._normals;\n", " }\n", " get is_horizontal() {\n", " return this._dim == 0;\n", " }\n", " get is_vertical() {\n", " return this._dim == 1;\n", " }\n", " apply_label_text_heuristics(ctx, orient) {\n", " const side = this.side;\n", " let baseline;\n", " let align;\n", " if (types_2.isString(orient)) {\n", " baseline = _baseline_lookup[side][orient];\n", " align = _align_lookup[side][orient];\n", " }\n", " else {\n", " if (orient < 0) {\n", " baseline = 'middle';\n", " align = _align_lookup_negative[side];\n", " }\n", " else {\n", " baseline = 'middle';\n", " align = _align_lookup_positive[side];\n", " }\n", " }\n", " ctx.textBaseline = baseline;\n", " ctx.textAlign = align;\n", " }\n", " get_label_angle_heuristic(orient) {\n", " return _angle_lookup[this.side][orient];\n", " }\n", " }\n", " exports.SidePanel = SidePanel;\n", " SidePanel.__name__ = \"SidePanel\";\n", " },\n", " /* models/plots/gmap_plot_canvas.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const signaling_1 = require(14) /* ../../core/signaling */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const projections_1 = require(32) /* ../../core/util/projections */;\n", " const plot_canvas_1 = require(290) /* ./plot_canvas */;\n", " const gmaps_ready = new signaling_1.Signal0({}, \"gmaps_ready\");\n", " const load_google_api = function (api_key) {\n", " window._bokeh_gmaps_callback = () => gmaps_ready.emit();\n", " const script = document.createElement('script');\n", " script.type = 'text/javascript';\n", " script.src = `https://maps.googleapis.com/maps/api/js?v=3.36&key=${api_key}&callback=_bokeh_gmaps_callback`;\n", " document.body.appendChild(script);\n", " };\n", " class GMapPlotView extends plot_canvas_1.PlotView {\n", " initialize() {\n", " this.pause();\n", " super.initialize();\n", " this._tiles_loaded = false;\n", " this.zoom_count = 0;\n", " const { zoom, lat, lng } = this.model.map_options;\n", " this.initial_zoom = zoom;\n", " this.initial_lat = lat;\n", " this.initial_lng = lng;\n", " if (typeof google === \"undefined\" || google.maps == null) {\n", " if (typeof window._bokeh_gmaps_callback === \"undefined\") {\n", " const decoded_api_key = atob(this.model.api_key);\n", " load_google_api(decoded_api_key);\n", " }\n", " gmaps_ready.connect(() => this.request_render());\n", " }\n", " this.unpause();\n", " }\n", " remove() {\n", " dom_1.remove(this.map_el);\n", " super.remove();\n", " }\n", " update_range(range_info) {\n", " // RESET -------------------------\n", " if (range_info == null) {\n", " this.map.setCenter({ lat: this.initial_lat, lng: this.initial_lng });\n", " this.map.setOptions({ zoom: this.initial_zoom });\n", " super.update_range(null);\n", " // PAN ----------------------------\n", " }\n", " else if (range_info.sdx != null || range_info.sdy != null) {\n", " this.map.panBy(range_info.sdx || 0, range_info.sdy || 0);\n", " super.update_range(range_info);\n", " // ZOOM ---------------------------\n", " }\n", " else if (range_info.factor != null) {\n", " // The zoom count decreases the sensitivity of the zoom. (We could make this user configurable)\n", " if (this.zoom_count !== 10) {\n", " this.zoom_count += 1;\n", " return;\n", " }\n", " this.zoom_count = 0;\n", " this.pause();\n", " super.update_range(range_info);\n", " const zoom_change = range_info.factor < 0 ? -1 : 1;\n", " const old_map_zoom = this.map.getZoom();\n", " const new_map_zoom = old_map_zoom + zoom_change;\n", " // Zooming out too far causes problems\n", " if (new_map_zoom >= 2) {\n", " this.map.setZoom(new_map_zoom);\n", " // Check we haven't gone out of bounds, and if we have undo the zoom\n", " const [proj_xstart, proj_xend, ,] = this._get_projected_bounds();\n", " if (proj_xend - proj_xstart < 0) {\n", " this.map.setZoom(old_map_zoom);\n", " }\n", " }\n", " this.unpause();\n", " }\n", " // Finally re-center\n", " this._set_bokeh_ranges();\n", " }\n", " _build_map() {\n", " const { maps } = google;\n", " this.map_types = {\n", " satellite: maps.MapTypeId.SATELLITE,\n", " terrain: maps.MapTypeId.TERRAIN,\n", " roadmap: maps.MapTypeId.ROADMAP,\n", " hybrid: maps.MapTypeId.HYBRID,\n", " };\n", " const mo = this.model.map_options;\n", " const map_options = {\n", " center: new maps.LatLng(mo.lat, mo.lng),\n", " zoom: mo.zoom,\n", " disableDefaultUI: true,\n", " mapTypeId: this.map_types[mo.map_type],\n", " scaleControl: mo.scale_control,\n", " tilt: mo.tilt,\n", " };\n", " if (mo.styles != null)\n", " map_options.styles = JSON.parse(mo.styles);\n", " // create the map with above options in div\n", " this.map_el = dom_1.div({ style: { position: \"absolute\" } });\n", " this.canvas_view.add_underlay(this.map_el);\n", " this.map = new maps.Map(this.map_el, map_options);\n", " // update bokeh ranges whenever the map idles, which should be after most UI action\n", " maps.event.addListener(this.map, 'idle', () => this._set_bokeh_ranges());\n", " // also need an event when bounds change so that map resizes trigger renders too\n", " maps.event.addListener(this.map, 'bounds_changed', () => this._set_bokeh_ranges());\n", " maps.event.addListenerOnce(this.map, 'tilesloaded', () => this._render_finished());\n", " // wire up listeners so that changes to properties are reflected\n", " this.connect(this.model.properties.map_options.change, () => this._update_options());\n", " this.connect(this.model.map_options.properties.styles.change, () => this._update_styles());\n", " this.connect(this.model.map_options.properties.lat.change, () => this._update_center('lat'));\n", " this.connect(this.model.map_options.properties.lng.change, () => this._update_center('lng'));\n", " this.connect(this.model.map_options.properties.zoom.change, () => this._update_zoom());\n", " this.connect(this.model.map_options.properties.map_type.change, () => this._update_map_type());\n", " this.connect(this.model.map_options.properties.scale_control.change, () => this._update_scale_control());\n", " this.connect(this.model.map_options.properties.tilt.change, () => this._update_tilt());\n", " }\n", " _render_finished() {\n", " this._tiles_loaded = true;\n", " this.notify_finished();\n", " }\n", " has_finished() {\n", " return super.has_finished() && this._tiles_loaded === true;\n", " }\n", " _get_latlon_bounds() {\n", " const bounds = this.map.getBounds();\n", " const top_right = bounds.getNorthEast();\n", " const bottom_left = bounds.getSouthWest();\n", " const xstart = bottom_left.lng();\n", " const xend = top_right.lng();\n", " const ystart = bottom_left.lat();\n", " const yend = top_right.lat();\n", " return [xstart, xend, ystart, yend];\n", " }\n", " _get_projected_bounds() {\n", " const [xstart, xend, ystart, yend] = this._get_latlon_bounds();\n", " const [proj_xstart, proj_ystart] = projections_1.wgs84_mercator.forward([xstart, ystart]);\n", " const [proj_xend, proj_yend] = projections_1.wgs84_mercator.forward([xend, yend]);\n", " return [proj_xstart, proj_xend, proj_ystart, proj_yend];\n", " }\n", " _set_bokeh_ranges() {\n", " const [proj_xstart, proj_xend, proj_ystart, proj_yend] = this._get_projected_bounds();\n", " this.frame.x_range.setv({ start: proj_xstart, end: proj_xend });\n", " this.frame.y_range.setv({ start: proj_ystart, end: proj_yend });\n", " }\n", " _update_center(fld) {\n", " const c = this.map.getCenter().toJSON();\n", " c[fld] = this.model.map_options[fld];\n", " this.map.setCenter(c);\n", " this._set_bokeh_ranges();\n", " }\n", " _update_map_type() {\n", " this.map.setOptions({ mapTypeId: this.map_types[this.model.map_options.map_type] });\n", " }\n", " _update_scale_control() {\n", " this.map.setOptions({ scaleControl: this.model.map_options.scale_control });\n", " }\n", " _update_tilt() {\n", " this.map.setOptions({ tilt: this.model.map_options.tilt });\n", " }\n", " _update_options() {\n", " this._update_styles();\n", " this._update_center('lat');\n", " this._update_center('lng');\n", " this._update_zoom();\n", " this._update_map_type();\n", " }\n", " _update_styles() {\n", " this.map.setOptions({ styles: JSON.parse(this.model.map_options.styles) });\n", " }\n", " _update_zoom() {\n", " this.map.setOptions({ zoom: this.model.map_options.zoom });\n", " this._set_bokeh_ranges();\n", " }\n", " // this method is expected and called by PlotView.render\n", " _map_hook(_ctx, frame_box) {\n", " if (this.map == null && typeof google !== \"undefined\" && google.maps != null)\n", " this._build_map();\n", " if (this.map_el != null) {\n", " const [left, top, width, height] = frame_box;\n", " this.map_el.style.top = `${top}px`;\n", " this.map_el.style.left = `${left}px`;\n", " this.map_el.style.width = `${width}px`;\n", " this.map_el.style.height = `${height}px`;\n", " }\n", " }\n", " // this overrides the standard _paint_empty to make the inner canvas transparent\n", " _paint_empty(ctx, frame_box) {\n", " const ow = this.layout._width.value;\n", " const oh = this.layout._height.value;\n", " const [left, top, iw, ih] = frame_box;\n", " ctx.clearRect(0, 0, ow, oh);\n", " ctx.beginPath();\n", " ctx.moveTo(0, 0);\n", " ctx.lineTo(0, oh);\n", " ctx.lineTo(ow, oh);\n", " ctx.lineTo(ow, 0);\n", " ctx.lineTo(0, 0);\n", " ctx.moveTo(left, top);\n", " ctx.lineTo(left + iw, top);\n", " ctx.lineTo(left + iw, top + ih);\n", " ctx.lineTo(left, top + ih);\n", " ctx.lineTo(left, top);\n", " ctx.closePath();\n", " if (this.model.border_fill_color != null) {\n", " ctx.fillStyle = this.model.border_fill_color;\n", " ctx.fill();\n", " }\n", " }\n", " }\n", " exports.GMapPlotView = GMapPlotView;\n", " GMapPlotView.__name__ = \"GMapPlotView\";\n", " },\n", " /* models/ranges/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var data_range_1 = require(187) /* ./data_range */;\n", " exports.DataRange = data_range_1.DataRange;\n", " var data_range1d_1 = require(186) /* ./data_range1d */;\n", " exports.DataRange1d = data_range1d_1.DataRange1d;\n", " var factor_range_1 = require(90) /* ./factor_range */;\n", " exports.FactorRange = factor_range_1.FactorRange;\n", " var range_1 = require(91) /* ./range */;\n", " exports.Range = range_1.Range;\n", " var range1d_1 = require(131) /* ./range1d */;\n", " exports.Range1d = range1d_1.Range1d;\n", " },\n", " /* models/renderers/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var glyph_renderer_1 = require(81) /* ./glyph_renderer */;\n", " exports.GlyphRenderer = glyph_renderer_1.GlyphRenderer;\n", " var graph_renderer_1 = require(100) /* ./graph_renderer */;\n", " exports.GraphRenderer = graph_renderer_1.GraphRenderer;\n", " var guide_renderer_1 = require(151) /* ./guide_renderer */;\n", " exports.GuideRenderer = guide_renderer_1.GuideRenderer;\n", " var renderer_1 = require(65) /* ./renderer */;\n", " exports.Renderer = renderer_1.Renderer;\n", " },\n", " /* models/scales/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var categorical_scale_1 = require(185) /* ./categorical_scale */;\n", " exports.CategoricalScale = categorical_scale_1.CategoricalScale;\n", " var continuous_scale_1 = require(121) /* ./continuous_scale */;\n", " exports.ContinuousScale = continuous_scale_1.ContinuousScale;\n", " var linear_scale_1 = require(120) /* ./linear_scale */;\n", " exports.LinearScale = linear_scale_1.LinearScale;\n", " var log_scale_1 = require(130) /* ./log_scale */;\n", " exports.LogScale = log_scale_1.LogScale;\n", " var scale_1 = require(122) /* ./scale */;\n", " exports.Scale = scale_1.Scale;\n", " },\n", " /* models/selections/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " tslib_1.__exportStar(require(102) /* ./interaction_policy */, exports);\n", " var selection_1 = require(79) /* ./selection */;\n", " exports.Selection = selection_1.Selection;\n", " },\n", " /* models/sources/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var server_sent_data_source_1 = require(302) /* ./server_sent_data_source */;\n", " exports.ServerSentDataSource = server_sent_data_source_1.ServerSentDataSource;\n", " var ajax_data_source_1 = require(304) /* ./ajax_data_source */;\n", " exports.AjaxDataSource = ajax_data_source_1.AjaxDataSource;\n", " var column_data_source_1 = require(76) /* ./column_data_source */;\n", " exports.ColumnDataSource = column_data_source_1.ColumnDataSource;\n", " var columnar_data_source_1 = require(77) /* ./columnar_data_source */;\n", " exports.ColumnarDataSource = columnar_data_source_1.ColumnarDataSource;\n", " var cds_view_1 = require(98) /* ./cds_view */;\n", " exports.CDSView = cds_view_1.CDSView;\n", " var data_source_1 = require(78) /* ./data_source */;\n", " exports.DataSource = data_source_1.DataSource;\n", " var geojson_data_source_1 = require(305) /* ./geojson_data_source */;\n", " exports.GeoJSONDataSource = geojson_data_source_1.GeoJSONDataSource;\n", " var web_data_source_1 = require(303) /* ./web_data_source */;\n", " exports.WebDataSource = web_data_source_1.WebDataSource;\n", " },\n", " /* models/sources/server_sent_data_source.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const web_data_source_1 = require(303) /* ./web_data_source */;\n", " class ServerSentDataSource extends web_data_source_1.WebDataSource {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.initialized = false;\n", " }\n", " destroy() {\n", " super.destroy();\n", " }\n", " setup() {\n", " if (!this.initialized) {\n", " this.initialized = true;\n", " const source = new EventSource(this.data_url);\n", " source.onmessage = (event) => {\n", " this.load_data(JSON.parse(event.data), this.mode, this.max_size);\n", " };\n", " }\n", " }\n", " }\n", " exports.ServerSentDataSource = ServerSentDataSource;\n", " ServerSentDataSource.__name__ = \"ServerSentDataSource\";\n", " },\n", " /* models/sources/web_data_source.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const column_data_source_1 = require(76) /* ./column_data_source */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class WebDataSource extends column_data_source_1.ColumnDataSource {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " get_column(colname) {\n", " const column = this.data[colname];\n", " return column != null ? column : [];\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.setup();\n", " }\n", " load_data(raw_data, mode, max_size) {\n", " const { adapter } = this;\n", " let data;\n", " if (adapter != null)\n", " data = adapter.execute(this, { response: raw_data });\n", " else\n", " data = raw_data;\n", " switch (mode) {\n", " case \"replace\": {\n", " this.data = data;\n", " break;\n", " }\n", " case \"append\": {\n", " const original_data = this.data;\n", " for (const column of this.columns()) {\n", " // XXX: support typed arrays\n", " const old_col = Array.from(original_data[column]);\n", " const new_col = Array.from(data[column]);\n", " data[column] = old_col.concat(new_col).slice(-max_size);\n", " }\n", " this.data = data;\n", " break;\n", " }\n", " }\n", " }\n", " static init_WebDataSource() {\n", " this.define({\n", " mode: [p.UpdateMode, 'replace'],\n", " max_size: [p.Number],\n", " adapter: [p.Any, null],\n", " data_url: [p.String],\n", " });\n", " }\n", " }\n", " exports.WebDataSource = WebDataSource;\n", " WebDataSource.__name__ = \"WebDataSource\";\n", " WebDataSource.init_WebDataSource();\n", " },\n", " /* models/sources/ajax_data_source.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const web_data_source_1 = require(303) /* ./web_data_source */;\n", " const logging_1 = require(72) /* ../../core/logging */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class AjaxDataSource extends web_data_source_1.WebDataSource {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.initialized = false;\n", " }\n", " static init_AjaxDataSource() {\n", " this.define({\n", " polling_interval: [p.Number],\n", " content_type: [p.String, 'application/json'],\n", " http_headers: [p.Any, {}],\n", " method: [p.HTTPMethod, 'POST'],\n", " if_modified: [p.Boolean, false],\n", " });\n", " }\n", " destroy() {\n", " if (this.interval != null)\n", " clearInterval(this.interval);\n", " super.destroy();\n", " }\n", " setup() {\n", " if (!this.initialized) {\n", " this.initialized = true;\n", " this.get_data(this.mode);\n", " if (this.polling_interval) {\n", " const callback = () => this.get_data(this.mode, this.max_size, this.if_modified);\n", " this.interval = setInterval(callback, this.polling_interval);\n", " }\n", " }\n", " }\n", " get_data(mode, max_size = 0, _if_modified = false) {\n", " const xhr = this.prepare_request();\n", " // TODO: if_modified\n", " xhr.addEventListener(\"load\", () => this.do_load(xhr, mode, max_size));\n", " xhr.addEventListener(\"error\", () => this.do_error(xhr));\n", " xhr.send();\n", " }\n", " prepare_request() {\n", " const xhr = new XMLHttpRequest();\n", " xhr.open(this.method, this.data_url, true);\n", " xhr.withCredentials = false;\n", " xhr.setRequestHeader(\"Content-Type\", this.content_type);\n", " const http_headers = this.http_headers;\n", " for (const name in http_headers) {\n", " const value = http_headers[name];\n", " xhr.setRequestHeader(name, value);\n", " }\n", " return xhr;\n", " }\n", " do_load(xhr, mode, max_size) {\n", " if (xhr.status === 200) {\n", " const raw_data = JSON.parse(xhr.responseText);\n", " this.load_data(raw_data, mode, max_size);\n", " }\n", " }\n", " do_error(xhr) {\n", " logging_1.logger.error(`Failed to fetch JSON from ${this.data_url} with code ${xhr.status}`);\n", " }\n", " }\n", " exports.AjaxDataSource = AjaxDataSource;\n", " AjaxDataSource.__name__ = \"AjaxDataSource\";\n", " AjaxDataSource.init_AjaxDataSource();\n", " },\n", " /* models/sources/geojson_data_source.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const columnar_data_source_1 = require(77) /* ./columnar_data_source */;\n", " const logging_1 = require(72) /* ../../core/logging */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " function orNaN(v) {\n", " return v != null ? v : NaN;\n", " }\n", " class GeoJSONDataSource extends columnar_data_source_1.ColumnarDataSource {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_GeoJSONDataSource() {\n", " this.define({\n", " geojson: [p.Any],\n", " });\n", " this.internal({\n", " data: [p.Any, {}],\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " this._update_data();\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.properties.geojson.change, () => this._update_data());\n", " }\n", " _update_data() {\n", " this.data = this.geojson_to_column_data();\n", " }\n", " _get_new_list_array(length) {\n", " return array_1.range(0, length).map((_i) => []);\n", " }\n", " _get_new_nan_array(length) {\n", " return array_1.range(0, length).map((_i) => NaN);\n", " }\n", " _add_properties(item, data, i, item_count) {\n", " const properties = item.properties || {};\n", " for (const property in properties) {\n", " if (!data.hasOwnProperty(property))\n", " data[property] = this._get_new_nan_array(item_count);\n", " // orNaN necessary here to prevent null values from ending up in the column\n", " data[property][i] = orNaN(properties[property]);\n", " }\n", " }\n", " _add_geometry(geometry, data, i) {\n", " function flatten(acc, item) {\n", " return acc.concat([[NaN, NaN, NaN]]).concat(item);\n", " }\n", " switch (geometry.type) {\n", " case \"Point\": {\n", " const [x, y, z] = geometry.coordinates;\n", " data.x[i] = x;\n", " data.y[i] = y;\n", " data.z[i] = orNaN(z);\n", " break;\n", " }\n", " case \"LineString\": {\n", " const { coordinates } = geometry;\n", " for (let j = 0; j < coordinates.length; j++) {\n", " const [x, y, z] = coordinates[j];\n", " data.xs[i][j] = x;\n", " data.ys[i][j] = y;\n", " data.zs[i][j] = orNaN(z);\n", " }\n", " break;\n", " }\n", " case \"Polygon\": {\n", " if (geometry.coordinates.length > 1)\n", " logging_1.logger.warn('Bokeh does not support Polygons with holes in, only exterior ring used.');\n", " const exterior_ring = geometry.coordinates[0];\n", " for (let j = 0; j < exterior_ring.length; j++) {\n", " const [x, y, z] = exterior_ring[j];\n", " data.xs[i][j] = x;\n", " data.ys[i][j] = y;\n", " data.zs[i][j] = orNaN(z);\n", " }\n", " break;\n", " }\n", " case \"MultiPoint\": {\n", " logging_1.logger.warn('MultiPoint not supported in Bokeh');\n", " break;\n", " }\n", " case \"MultiLineString\": {\n", " const coordinates = geometry.coordinates.reduce(flatten);\n", " for (let j = 0; j < coordinates.length; j++) {\n", " const [x, y, z] = coordinates[j];\n", " data.xs[i][j] = x;\n", " data.ys[i][j] = y;\n", " data.zs[i][j] = orNaN(z);\n", " }\n", " break;\n", " }\n", " case \"MultiPolygon\": {\n", " const exterior_rings = [];\n", " for (const polygon of geometry.coordinates) {\n", " if (polygon.length > 1)\n", " logging_1.logger.warn('Bokeh does not support Polygons with holes in, only exterior ring used.');\n", " exterior_rings.push(polygon[0]);\n", " }\n", " const coordinates = exterior_rings.reduce(flatten);\n", " for (let j = 0; j < coordinates.length; j++) {\n", " const [x, y, z] = coordinates[j];\n", " data.xs[i][j] = x;\n", " data.ys[i][j] = y;\n", " data.zs[i][j] = orNaN(z);\n", " }\n", " break;\n", " }\n", " default:\n", " throw new Error(`Invalid GeoJSON geometry type: ${geometry.type}`);\n", " }\n", " }\n", " geojson_to_column_data() {\n", " const geojson = JSON.parse(this.geojson);\n", " let items;\n", " switch (geojson.type) {\n", " case \"GeometryCollection\": {\n", " if (geojson.geometries == null)\n", " throw new Error('No geometries found in GeometryCollection');\n", " if (geojson.geometries.length === 0)\n", " throw new Error('geojson.geometries must have one or more items');\n", " items = geojson.geometries;\n", " break;\n", " }\n", " case \"FeatureCollection\": {\n", " if (geojson.features == null)\n", " throw new Error('No features found in FeaturesCollection');\n", " if (geojson.features.length == 0)\n", " throw new Error('geojson.features must have one or more items');\n", " items = geojson.features;\n", " break;\n", " }\n", " default:\n", " throw new Error('Bokeh only supports type GeometryCollection and FeatureCollection at top level');\n", " }\n", " let item_count = 0;\n", " for (const item of items) {\n", " const geometry = item.type === 'Feature' ? item.geometry : item;\n", " if (geometry.type == 'GeometryCollection')\n", " item_count += geometry.geometries.length;\n", " else\n", " item_count += 1;\n", " }\n", " const data = {\n", " x: this._get_new_nan_array(item_count),\n", " y: this._get_new_nan_array(item_count),\n", " z: this._get_new_nan_array(item_count),\n", " xs: this._get_new_list_array(item_count),\n", " ys: this._get_new_list_array(item_count),\n", " zs: this._get_new_list_array(item_count),\n", " };\n", " let arr_index = 0;\n", " for (const item of items) {\n", " const geometry = item.type == 'Feature' ? item.geometry : item;\n", " if (geometry.type == \"GeometryCollection\") {\n", " for (const g of geometry.geometries) {\n", " this._add_geometry(g, data, arr_index);\n", " if (item.type === 'Feature')\n", " this._add_properties(item, data, arr_index, item_count);\n", " arr_index += 1;\n", " }\n", " }\n", " else {\n", " this._add_geometry(geometry, data, arr_index);\n", " if (item.type === 'Feature')\n", " this._add_properties(item, data, arr_index, item_count);\n", " arr_index += 1;\n", " }\n", " }\n", " return data;\n", " }\n", " }\n", " exports.GeoJSONDataSource = GeoJSONDataSource;\n", " GeoJSONDataSource.__name__ = \"GeoJSONDataSource\";\n", " GeoJSONDataSource.init_GeoJSONDataSource();\n", " },\n", " /* models/tickers/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var adaptive_ticker_1 = require(110) /* ./adaptive_ticker */;\n", " exports.AdaptiveTicker = adaptive_ticker_1.AdaptiveTicker;\n", " var basic_ticker_1 = require(109) /* ./basic_ticker */;\n", " exports.BasicTicker = basic_ticker_1.BasicTicker;\n", " var categorical_ticker_1 = require(153) /* ./categorical_ticker */;\n", " exports.CategoricalTicker = categorical_ticker_1.CategoricalTicker;\n", " var composite_ticker_1 = require(164) /* ./composite_ticker */;\n", " exports.CompositeTicker = composite_ticker_1.CompositeTicker;\n", " var continuous_ticker_1 = require(111) /* ./continuous_ticker */;\n", " exports.ContinuousTicker = continuous_ticker_1.ContinuousTicker;\n", " var datetime_ticker_1 = require(163) /* ./datetime_ticker */;\n", " exports.DatetimeTicker = datetime_ticker_1.DatetimeTicker;\n", " var days_ticker_1 = require(165) /* ./days_ticker */;\n", " exports.DaysTicker = days_ticker_1.DaysTicker;\n", " var fixed_ticker_1 = require(307) /* ./fixed_ticker */;\n", " exports.FixedTicker = fixed_ticker_1.FixedTicker;\n", " var log_ticker_1 = require(172) /* ./log_ticker */;\n", " exports.LogTicker = log_ticker_1.LogTicker;\n", " var mercator_ticker_1 = require(175) /* ./mercator_ticker */;\n", " exports.MercatorTicker = mercator_ticker_1.MercatorTicker;\n", " var months_ticker_1 = require(168) /* ./months_ticker */;\n", " exports.MonthsTicker = months_ticker_1.MonthsTicker;\n", " var single_interval_ticker_1 = require(166) /* ./single_interval_ticker */;\n", " exports.SingleIntervalTicker = single_interval_ticker_1.SingleIntervalTicker;\n", " var ticker_1 = require(112) /* ./ticker */;\n", " exports.Ticker = ticker_1.Ticker;\n", " var years_ticker_1 = require(169) /* ./years_ticker */;\n", " exports.YearsTicker = years_ticker_1.YearsTicker;\n", " },\n", " /* models/tickers/fixed_ticker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const continuous_ticker_1 = require(111) /* ./continuous_ticker */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class FixedTicker extends continuous_ticker_1.ContinuousTicker {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.min_interval = 0;\n", " this.max_interval = 0;\n", " }\n", " static init_FixedTicker() {\n", " this.define({\n", " ticks: [p.Array, []],\n", " minor_ticks: [p.Array, []],\n", " });\n", " }\n", " get_ticks_no_defaults(_data_low, _data_high, _cross_loc, _desired_n_ticks) {\n", " return {\n", " major: this.ticks,\n", " minor: this.minor_ticks,\n", " };\n", " }\n", " // XXX: whatever, because FixedTicker needs to fulfill the interface somehow\n", " get_interval(_data_low, _data_high, _desired_n_ticks) {\n", " return 0;\n", " }\n", " }\n", " exports.FixedTicker = FixedTicker;\n", " FixedTicker.__name__ = \"FixedTicker\";\n", " FixedTicker.init_FixedTicker();\n", " },\n", " /* models/tiles/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var bbox_tile_source_1 = require(309) /* ./bbox_tile_source */;\n", " exports.BBoxTileSource = bbox_tile_source_1.BBoxTileSource;\n", " var mercator_tile_source_1 = require(310) /* ./mercator_tile_source */;\n", " exports.MercatorTileSource = mercator_tile_source_1.MercatorTileSource;\n", " var quadkey_tile_source_1 = require(313) /* ./quadkey_tile_source */;\n", " exports.QUADKEYTileSource = quadkey_tile_source_1.QUADKEYTileSource;\n", " var tile_renderer_1 = require(314) /* ./tile_renderer */;\n", " exports.TileRenderer = tile_renderer_1.TileRenderer;\n", " var tile_source_1 = require(311) /* ./tile_source */;\n", " exports.TileSource = tile_source_1.TileSource;\n", " var tms_tile_source_1 = require(318) /* ./tms_tile_source */;\n", " exports.TMSTileSource = tms_tile_source_1.TMSTileSource;\n", " var wmts_tile_source_1 = require(315) /* ./wmts_tile_source */;\n", " exports.WMTSTileSource = wmts_tile_source_1.WMTSTileSource;\n", " },\n", " /* models/tiles/bbox_tile_source.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const mercator_tile_source_1 = require(310) /* ./mercator_tile_source */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class BBoxTileSource extends mercator_tile_source_1.MercatorTileSource {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_BBoxTileSource() {\n", " this.define({\n", " use_latlon: [p.Boolean, false],\n", " });\n", " }\n", " get_image_url(x, y, z) {\n", " const image_url = this.string_lookup_replace(this.url, this.extra_url_vars);\n", " let xmax, xmin, ymax, ymin;\n", " if (this.use_latlon)\n", " [xmin, ymin, xmax, ymax] = this.get_tile_geographic_bounds(x, y, z);\n", " else\n", " [xmin, ymin, xmax, ymax] = this.get_tile_meter_bounds(x, y, z);\n", " return image_url\n", " .replace(\"{XMIN}\", xmin.toString())\n", " .replace(\"{YMIN}\", ymin.toString())\n", " .replace(\"{XMAX}\", xmax.toString())\n", " .replace(\"{YMAX}\", ymax.toString());\n", " }\n", " }\n", " exports.BBoxTileSource = BBoxTileSource;\n", " BBoxTileSource.__name__ = \"BBoxTileSource\";\n", " BBoxTileSource.init_BBoxTileSource();\n", " },\n", " /* models/tiles/mercator_tile_source.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const tile_source_1 = require(311) /* ./tile_source */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const tile_utils_1 = require(312) /* ./tile_utils */;\n", " class MercatorTileSource extends tile_source_1.TileSource {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_MercatorTileSource() {\n", " this.define({\n", " snap_to_zoom: [p.Boolean, false],\n", " wrap_around: [p.Boolean, true],\n", " });\n", " this.override({\n", " x_origin_offset: 20037508.34,\n", " y_origin_offset: 20037508.34,\n", " initial_resolution: 156543.03392804097,\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " this._resolutions = array_1.range(this.min_zoom, this.max_zoom + 1).map((z) => this.get_resolution(z));\n", " }\n", " _computed_initial_resolution() {\n", " if (this.initial_resolution != null)\n", " return this.initial_resolution;\n", " else {\n", " // TODO testing 2015-11-17, if this codepath is used it seems\n", " // to use 100% cpu and wedge Chrome\n", " return (2 * Math.PI * 6378137) / this.tile_size;\n", " }\n", " }\n", " is_valid_tile(x, y, z) {\n", " if (!this.wrap_around) {\n", " if (x < 0 || x >= 2 ** z)\n", " return false;\n", " }\n", " if (y < 0 || y >= 2 ** z)\n", " return false;\n", " return true;\n", " }\n", " parent_by_tile_xyz(x, y, z) {\n", " const quadkey = this.tile_xyz_to_quadkey(x, y, z);\n", " const parent_quadkey = quadkey.substring(0, quadkey.length - 1);\n", " return this.quadkey_to_tile_xyz(parent_quadkey);\n", " }\n", " get_resolution(level) {\n", " return this._computed_initial_resolution() / 2 ** level;\n", " }\n", " get_resolution_by_extent(extent, height, width) {\n", " const x_rs = (extent[2] - extent[0]) / width;\n", " const y_rs = (extent[3] - extent[1]) / height;\n", " return [x_rs, y_rs];\n", " }\n", " get_level_by_extent(extent, height, width) {\n", " const x_rs = (extent[2] - extent[0]) / width;\n", " const y_rs = (extent[3] - extent[1]) / height;\n", " const resolution = Math.max(x_rs, y_rs);\n", " let i = 0;\n", " for (const r of this._resolutions) {\n", " if (resolution > r) {\n", " if (i == 0)\n", " return 0;\n", " if (i > 0)\n", " return i - 1;\n", " }\n", " i += 1;\n", " }\n", " // otherwise return the highest available resolution\n", " return (i - 1);\n", " }\n", " get_closest_level_by_extent(extent, height, width) {\n", " const x_rs = (extent[2] - extent[0]) / width;\n", " const y_rs = (extent[3] - extent[1]) / height;\n", " const resolution = Math.max(x_rs, y_rs);\n", " const closest = this._resolutions.reduce(function (previous, current) {\n", " if (Math.abs(current - resolution) < Math.abs(previous - resolution))\n", " return current;\n", " else\n", " return previous;\n", " });\n", " return this._resolutions.indexOf(closest);\n", " }\n", " snap_to_zoom_level(extent, height, width, level) {\n", " const [xmin, ymin, xmax, ymax] = extent;\n", " const desired_res = this._resolutions[level];\n", " let desired_x_delta = width * desired_res;\n", " let desired_y_delta = height * desired_res;\n", " if (!this.snap_to_zoom) {\n", " const xscale = (xmax - xmin) / desired_x_delta;\n", " const yscale = (ymax - ymin) / desired_y_delta;\n", " if (xscale > yscale) {\n", " desired_x_delta = (xmax - xmin);\n", " desired_y_delta = desired_y_delta * xscale;\n", " }\n", " else {\n", " desired_x_delta = desired_x_delta * yscale;\n", " desired_y_delta = (ymax - ymin);\n", " }\n", " }\n", " const x_adjust = (desired_x_delta - (xmax - xmin)) / 2;\n", " const y_adjust = (desired_y_delta - (ymax - ymin)) / 2;\n", " return [xmin - x_adjust, ymin - y_adjust, xmax + x_adjust, ymax + y_adjust];\n", " }\n", " tms_to_wmts(x, y, z) {\n", " // Note this works both ways\n", " return [x, 2 ** z - 1 - y, z];\n", " }\n", " wmts_to_tms(x, y, z) {\n", " // Note this works both ways\n", " return [x, 2 ** z - 1 - y, z];\n", " }\n", " pixels_to_meters(px, py, level) {\n", " const res = this.get_resolution(level);\n", " const mx = (px * res) - this.x_origin_offset;\n", " const my = (py * res) - this.y_origin_offset;\n", " return [mx, my];\n", " }\n", " meters_to_pixels(mx, my, level) {\n", " const res = this.get_resolution(level);\n", " const px = (mx + this.x_origin_offset) / res;\n", " const py = (my + this.y_origin_offset) / res;\n", " return [px, py];\n", " }\n", " pixels_to_tile(px, py) {\n", " let tx = Math.ceil(px / this.tile_size);\n", " tx = tx === 0 ? tx : tx - 1;\n", " const ty = Math.max(Math.ceil(py / this.tile_size) - 1, 0);\n", " return [tx, ty];\n", " }\n", " pixels_to_raster(px, py, level) {\n", " const mapSize = this.tile_size << level;\n", " return [px, mapSize - py];\n", " }\n", " meters_to_tile(mx, my, level) {\n", " const [px, py] = this.meters_to_pixels(mx, my, level);\n", " return this.pixels_to_tile(px, py);\n", " }\n", " get_tile_meter_bounds(tx, ty, level) {\n", " // expects tms styles coordinates (bottom-left origin)\n", " const [xmin, ymin] = this.pixels_to_meters(tx * this.tile_size, ty * this.tile_size, level);\n", " const [xmax, ymax] = this.pixels_to_meters((tx + 1) * this.tile_size, (ty + 1) * this.tile_size, level);\n", " return [xmin, ymin, xmax, ymax];\n", " }\n", " get_tile_geographic_bounds(tx, ty, level) {\n", " const bounds = this.get_tile_meter_bounds(tx, ty, level);\n", " const [minLon, minLat, maxLon, maxLat] = tile_utils_1.meters_extent_to_geographic(bounds);\n", " return [minLon, minLat, maxLon, maxLat];\n", " }\n", " get_tiles_by_extent(extent, level, tile_border = 1) {\n", " // unpack extent and convert to tile coordinates\n", " const [xmin, ymin, xmax, ymax] = extent;\n", " let [txmin, tymin] = this.meters_to_tile(xmin, ymin, level);\n", " let [txmax, tymax] = this.meters_to_tile(xmax, ymax, level);\n", " // add tiles which border\n", " txmin -= tile_border;\n", " tymin -= tile_border;\n", " txmax += tile_border;\n", " tymax += tile_border;\n", " const tiles = [];\n", " for (let ty = tymax; ty >= tymin; ty--) {\n", " for (let tx = txmin; tx <= txmax; tx++) {\n", " if (this.is_valid_tile(tx, ty, level))\n", " tiles.push([tx, ty, level, this.get_tile_meter_bounds(tx, ty, level)]);\n", " }\n", " }\n", " this.sort_tiles_from_center(tiles, [txmin, tymin, txmax, tymax]);\n", " return tiles;\n", " }\n", " quadkey_to_tile_xyz(quadKey) {\n", " /**\n", " * Computes tile x, y and z values based on quadKey.\n", " */\n", " let tileX = 0;\n", " let tileY = 0;\n", " const tileZ = quadKey.length;\n", " for (let i = tileZ; i > 0; i--) {\n", " const value = quadKey.charAt(tileZ - i);\n", " const mask = 1 << (i - 1);\n", " switch (value) {\n", " case '0':\n", " continue;\n", " case '1':\n", " tileX |= mask;\n", " break;\n", " case '2':\n", " tileY |= mask;\n", " break;\n", " case '3':\n", " tileX |= mask;\n", " tileY |= mask;\n", " break;\n", " default:\n", " throw new TypeError(`Invalid Quadkey: ${quadKey}`);\n", " }\n", " }\n", " return [tileX, tileY, tileZ];\n", " }\n", " tile_xyz_to_quadkey(x, y, z) {\n", " /*\n", " * Computes quadkey value based on tile x, y and z values.\n", " */\n", " let quadkey = \"\";\n", " for (let i = z; i > 0; i--) {\n", " const mask = 1 << (i - 1);\n", " let digit = 0;\n", " if ((x & mask) !== 0) {\n", " digit += 1;\n", " }\n", " if ((y & mask) !== 0) {\n", " digit += 2;\n", " }\n", " quadkey += digit.toString();\n", " }\n", " return quadkey;\n", " }\n", " children_by_tile_xyz(x, y, z) {\n", " const quadkey = this.tile_xyz_to_quadkey(x, y, z);\n", " const child_tile_xyz = [];\n", " for (let i = 0; i <= 3; i++) {\n", " const [x, y, z] = this.quadkey_to_tile_xyz(quadkey + i.toString());\n", " const b = this.get_tile_meter_bounds(x, y, z);\n", " child_tile_xyz.push([x, y, z, b]);\n", " }\n", " return child_tile_xyz;\n", " }\n", " get_closest_parent_by_tile_xyz(x, y, z) {\n", " const world_x = this.calculate_world_x_by_tile_xyz(x, y, z);\n", " [x, y, z] = this.normalize_xyz(x, y, z);\n", " let quadkey = this.tile_xyz_to_quadkey(x, y, z);\n", " while (quadkey.length > 0) {\n", " quadkey = quadkey.substring(0, quadkey.length - 1);\n", " [x, y, z] = this.quadkey_to_tile_xyz(quadkey);\n", " [x, y, z] = this.denormalize_xyz(x, y, z, world_x);\n", " if (this.tiles.has(this.tile_xyz_to_key(x, y, z)))\n", " return [x, y, z];\n", " }\n", " return [0, 0, 0];\n", " }\n", " normalize_xyz(x, y, z) {\n", " if (this.wrap_around) {\n", " const tile_count = 2 ** z;\n", " return [((x % tile_count) + tile_count) % tile_count, y, z];\n", " }\n", " else {\n", " return [x, y, z];\n", " }\n", " }\n", " denormalize_xyz(x, y, z, world_x) {\n", " return [x + (world_x * 2 ** z), y, z];\n", " }\n", " denormalize_meters(meters_x, meters_y, _level, world_x) {\n", " return [meters_x + (world_x * 2 * Math.PI * 6378137), meters_y];\n", " }\n", " calculate_world_x_by_tile_xyz(x, _y, z) {\n", " return Math.floor(x / 2 ** z);\n", " }\n", " }\n", " exports.MercatorTileSource = MercatorTileSource;\n", " MercatorTileSource.__name__ = \"MercatorTileSource\";\n", " MercatorTileSource.init_MercatorTileSource();\n", " },\n", " /* models/tiles/tile_source.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const model_1 = require(71) /* ../../model */;\n", " const object_1 = require(17) /* ../../core/util/object */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class TileSource extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_TileSource() {\n", " this.define({\n", " url: [p.String, ''],\n", " tile_size: [p.Number, 256],\n", " max_zoom: [p.Number, 30],\n", " min_zoom: [p.Number, 0],\n", " extra_url_vars: [p.Any, {}],\n", " attribution: [p.String, ''],\n", " x_origin_offset: [p.Number],\n", " y_origin_offset: [p.Number],\n", " initial_resolution: [p.Number],\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.tiles = new Map();\n", " this._normalize_case();\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.change, () => this._clear_cache());\n", " }\n", " string_lookup_replace(str, lookup) {\n", " let result_str = str;\n", " for (const [key, value] of object_1.entries(lookup)) {\n", " result_str = result_str.replace(`{${key}}`, value);\n", " }\n", " return result_str;\n", " }\n", " _normalize_case() {\n", " /*\n", " * Note: should probably be refactored into subclasses.\n", " */\n", " const url = this.url\n", " .replace('{x}', '{X}')\n", " .replace('{y}', '{Y}')\n", " .replace('{z}', '{Z}')\n", " .replace('{q}', '{Q}')\n", " .replace('{xmin}', '{XMIN}')\n", " .replace('{ymin}', '{YMIN}')\n", " .replace('{xmax}', '{XMAX}')\n", " .replace('{ymax}', '{YMAX}');\n", " this.url = url;\n", " }\n", " _clear_cache() {\n", " this.tiles = new Map();\n", " }\n", " tile_xyz_to_key(x, y, z) {\n", " return `${x}:${y}:${z}`;\n", " }\n", " key_to_tile_xyz(key) {\n", " const [x, y, z] = key.split(':').map((c) => parseInt(c));\n", " return [x, y, z];\n", " }\n", " sort_tiles_from_center(tiles, tile_extent) {\n", " const [txmin, tymin, txmax, tymax] = tile_extent;\n", " const center_x = ((txmax - txmin) / 2) + txmin;\n", " const center_y = ((tymax - tymin) / 2) + tymin;\n", " tiles.sort(function (a, b) {\n", " const a_distance = Math.sqrt((center_x - a[0]) ** 2 + (center_y - a[1]) ** 2);\n", " const b_distance = Math.sqrt((center_x - b[0]) ** 2 + (center_y - b[1]) ** 2);\n", " return a_distance - b_distance;\n", " });\n", " }\n", " get_image_url(x, y, z) {\n", " const image_url = this.string_lookup_replace(this.url, this.extra_url_vars);\n", " return image_url\n", " .replace(\"{X}\", x.toString())\n", " .replace('{Y}', y.toString())\n", " .replace(\"{Z}\", z.toString());\n", " }\n", " }\n", " exports.TileSource = TileSource;\n", " TileSource.__name__ = \"TileSource\";\n", " TileSource.init_TileSource();\n", " },\n", " /* models/tiles/tile_utils.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const projections_1 = require(32) /* ../../core/util/projections */;\n", " function geographic_to_meters(xLon, yLat) {\n", " return projections_1.wgs84_mercator.forward([xLon, yLat]);\n", " }\n", " exports.geographic_to_meters = geographic_to_meters;\n", " function meters_to_geographic(mx, my) {\n", " return projections_1.wgs84_mercator.inverse([mx, my]);\n", " }\n", " exports.meters_to_geographic = meters_to_geographic;\n", " function geographic_extent_to_meters(extent) {\n", " const [g_xmin, g_ymin, g_xmax, g_ymax] = extent;\n", " const [m_xmin, m_ymin] = geographic_to_meters(g_xmin, g_ymin);\n", " const [m_xmax, m_ymax] = geographic_to_meters(g_xmax, g_ymax);\n", " return [m_xmin, m_ymin, m_xmax, m_ymax];\n", " }\n", " exports.geographic_extent_to_meters = geographic_extent_to_meters;\n", " function meters_extent_to_geographic(extent) {\n", " const [m_xmin, m_ymin, m_xmax, m_ymax] = extent;\n", " const [g_xmin, g_ymin] = meters_to_geographic(m_xmin, m_ymin);\n", " const [g_xmax, g_ymax] = meters_to_geographic(m_xmax, m_ymax);\n", " return [g_xmin, g_ymin, g_xmax, g_ymax];\n", " }\n", " exports.meters_extent_to_geographic = meters_extent_to_geographic;\n", " },\n", " /* models/tiles/quadkey_tile_source.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const mercator_tile_source_1 = require(310) /* ./mercator_tile_source */;\n", " class QUADKEYTileSource extends mercator_tile_source_1.MercatorTileSource {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " get_image_url(x, y, z) {\n", " const image_url = this.string_lookup_replace(this.url, this.extra_url_vars);\n", " const [wx, wy, wz] = this.tms_to_wmts(x, y, z);\n", " const quadKey = this.tile_xyz_to_quadkey(wx, wy, wz);\n", " return image_url.replace(\"{Q}\", quadKey);\n", " }\n", " }\n", " exports.QUADKEYTileSource = QUADKEYTileSource;\n", " QUADKEYTileSource.__name__ = \"QUADKEYTileSource\";\n", " },\n", " /* models/tiles/tile_renderer.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const wmts_tile_source_1 = require(315) /* ./wmts_tile_source */;\n", " const data_renderer_1 = require(82) /* ../renderers/data_renderer */;\n", " const range1d_1 = require(131) /* ../ranges/range1d */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const image_1 = require(224) /* ../../core/util/image */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const selection_manager_1 = require(80) /* ../../core/selection_manager */;\n", " const column_data_source_1 = require(76) /* ../sources/column_data_source */;\n", " const tiles_1 = require(316) /* ../../styles/tiles */;\n", " const tiles_css_1 = tslib_1.__importDefault(require(317) /* ../../styles/tiles.css */);\n", " class TileRendererView extends data_renderer_1.DataRendererView {\n", " initialize() {\n", " this._tiles = [];\n", " super.initialize();\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.change, () => this.request_render());\n", " this.connect(this.model.tile_source.change, () => this.request_render());\n", " }\n", " styles() {\n", " return [...super.styles(), tiles_css_1.default];\n", " }\n", " get_extent() {\n", " return [this.x_range.start, this.y_range.start, this.x_range.end, this.y_range.end];\n", " }\n", " get map_plot() {\n", " return this.plot_model;\n", " }\n", " get map_canvas() {\n", " return this.layer.ctx;\n", " }\n", " get map_frame() {\n", " return this.plot_view.frame;\n", " }\n", " get x_range() {\n", " return this.map_plot.x_range;\n", " }\n", " get y_range() {\n", " return this.map_plot.y_range;\n", " }\n", " _set_data() {\n", " this.extent = this.get_extent();\n", " this._last_height = undefined;\n", " this._last_width = undefined;\n", " }\n", " _update_attribution() {\n", " if (this.attribution_el != null)\n", " dom_1.removeElement(this.attribution_el);\n", " const { attribution } = this.model.tile_source;\n", " if (types_1.isString(attribution) && attribution.length > 0) {\n", " const { layout, frame } = this.plot_view;\n", " const offset_right = layout._width.value - frame._right.value;\n", " const offset_bottom = layout._height.value - frame._bottom.value;\n", " const max_width = frame._width.value;\n", " this.attribution_el = dom_1.div({\n", " class: tiles_1.bk_tile_attribution,\n", " style: {\n", " position: \"absolute\",\n", " right: `${offset_right}px`,\n", " bottom: `${offset_bottom}px`,\n", " 'max-width': `${max_width - 4 /*padding*/}px`,\n", " padding: \"2px\",\n", " 'background-color': 'rgba(255,255,255,0.5)',\n", " 'font-size': '9px',\n", " 'line-height': '1.05',\n", " 'white-space': 'nowrap',\n", " overflow: 'hidden',\n", " 'text-overflow': 'ellipsis',\n", " },\n", " });\n", " this.plot_view.canvas_view.add_event(this.attribution_el);\n", " this.attribution_el.innerHTML = attribution;\n", " this.attribution_el.title = this.attribution_el.textContent.replace(/\\s*\\n\\s*/g, \" \");\n", " }\n", " }\n", " _map_data() {\n", " this.initial_extent = this.get_extent();\n", " const zoom_level = this.model.tile_source.get_level_by_extent(this.initial_extent, this.map_frame._height.value, this.map_frame._width.value);\n", " const new_extent = this.model.tile_source.snap_to_zoom_level(this.initial_extent, this.map_frame._height.value, this.map_frame._width.value, zoom_level);\n", " this.x_range.start = new_extent[0];\n", " this.y_range.start = new_extent[1];\n", " this.x_range.end = new_extent[2];\n", " this.y_range.end = new_extent[3];\n", " if (this.x_range instanceof range1d_1.Range1d) {\n", " this.x_range.reset_start = new_extent[0];\n", " this.x_range.reset_end = new_extent[2];\n", " }\n", " if (this.y_range instanceof range1d_1.Range1d) {\n", " this.y_range.reset_start = new_extent[1];\n", " this.y_range.reset_end = new_extent[3];\n", " }\n", " this._update_attribution();\n", " }\n", " _create_tile(x, y, z, bounds, cache_only = false) {\n", " const [nx, ny, nz] = this.model.tile_source.normalize_xyz(x, y, z);\n", " const tile = {\n", " img: undefined,\n", " tile_coords: [x, y, z],\n", " normalized_coords: [nx, ny, nz],\n", " quadkey: this.model.tile_source.tile_xyz_to_quadkey(x, y, z),\n", " cache_key: this.model.tile_source.tile_xyz_to_key(x, y, z),\n", " bounds,\n", " loaded: false,\n", " finished: false,\n", " x_coord: bounds[0],\n", " y_coord: bounds[3],\n", " };\n", " const src = this.model.tile_source.get_image_url(nx, ny, nz);\n", " new image_1.ImageLoader(src, {\n", " loaded: (img) => {\n", " Object.assign(tile, { img, loaded: true });\n", " if (cache_only) {\n", " tile.finished = true;\n", " this.notify_finished();\n", " }\n", " else\n", " this.request_render();\n", " },\n", " failed() {\n", " tile.finished = true;\n", " },\n", " });\n", " this.model.tile_source.tiles.set(tile.cache_key, tile);\n", " this._tiles.push(tile);\n", " }\n", " _enforce_aspect_ratio() {\n", " // brute force way of handling resize or sizing_mode event -------------------------------------------------------------\n", " if ((this._last_height !== this.map_frame._height.value) || (this._last_width !== this.map_frame._width.value)) {\n", " const extent = this.get_extent();\n", " const zoom_level = this.model.tile_source.get_level_by_extent(extent, this.map_frame._height.value, this.map_frame._width.value);\n", " const new_extent = this.model.tile_source.snap_to_zoom_level(extent, this.map_frame._height.value, this.map_frame._width.value, zoom_level);\n", " this.x_range.setv({ start: new_extent[0], end: new_extent[2] });\n", " this.y_range.setv({ start: new_extent[1], end: new_extent[3] });\n", " this.extent = new_extent;\n", " this._last_height = this.map_frame._height.value;\n", " this._last_width = this.map_frame._width.value;\n", " }\n", " }\n", " has_finished() {\n", " if (!super.has_finished()) {\n", " return false;\n", " }\n", " if (this._tiles.length === 0) {\n", " return false;\n", " }\n", " for (const tile of this._tiles) {\n", " if (!tile.finished) {\n", " return false;\n", " }\n", " }\n", " return true;\n", " }\n", " render() {\n", " if (this.map_initialized == null) {\n", " this._set_data();\n", " this._map_data();\n", " this.map_initialized = true;\n", " }\n", " this._enforce_aspect_ratio();\n", " this._update();\n", " if (this.prefetch_timer != null) {\n", " clearTimeout(this.prefetch_timer);\n", " }\n", " this.prefetch_timer = setTimeout(this._prefetch_tiles.bind(this), 500);\n", " if (this.has_finished()) {\n", " this.notify_finished();\n", " }\n", " }\n", " _draw_tile(tile_key) {\n", " const tile_data = this.model.tile_source.tiles.get(tile_key);\n", " if (tile_data != null && tile_data.loaded) {\n", " const [[sxmin], [symin]] = this.plot_view.map_to_screen([tile_data.bounds[0]], [tile_data.bounds[3]]);\n", " const [[sxmax], [symax]] = this.plot_view.map_to_screen([tile_data.bounds[2]], [tile_data.bounds[1]]);\n", " const sw = sxmax - sxmin;\n", " const sh = symax - symin;\n", " const sx = sxmin;\n", " const sy = symin;\n", " const old_smoothing = this.map_canvas.getImageSmoothingEnabled();\n", " this.map_canvas.setImageSmoothingEnabled(this.model.smoothing);\n", " this.map_canvas.drawImage(tile_data.img, sx, sy, sw, sh);\n", " this.map_canvas.setImageSmoothingEnabled(old_smoothing);\n", " tile_data.finished = true;\n", " }\n", " }\n", " _set_rect() {\n", " const outline_width = this.plot_model.properties.outline_line_width.value();\n", " const l = this.map_frame._left.value + (outline_width / 2);\n", " const t = this.map_frame._top.value + (outline_width / 2);\n", " const w = this.map_frame._width.value - outline_width;\n", " const h = this.map_frame._height.value - outline_width;\n", " this.map_canvas.rect(l, t, w, h);\n", " this.map_canvas.clip();\n", " }\n", " _render_tiles(tile_keys) {\n", " this.map_canvas.save();\n", " this._set_rect();\n", " this.map_canvas.globalAlpha = this.model.alpha;\n", " for (const tile_key of tile_keys) {\n", " this._draw_tile(tile_key);\n", " }\n", " this.map_canvas.restore();\n", " }\n", " _prefetch_tiles() {\n", " const { tile_source } = this.model;\n", " const extent = this.get_extent();\n", " const h = this.map_frame._height.value;\n", " const w = this.map_frame._width.value;\n", " const zoom_level = this.model.tile_source.get_level_by_extent(extent, h, w);\n", " const tiles = this.model.tile_source.get_tiles_by_extent(extent, zoom_level);\n", " for (let t = 0, end = Math.min(10, tiles.length); t < end; t++) {\n", " const [x, y, z] = tiles[t];\n", " const children = this.model.tile_source.children_by_tile_xyz(x, y, z);\n", " for (const c of children) {\n", " const [cx, cy, cz, cbounds] = c;\n", " if (tile_source.tiles.has(tile_source.tile_xyz_to_key(cx, cy, cz))) {\n", " continue;\n", " }\n", " else {\n", " this._create_tile(cx, cy, cz, cbounds, true);\n", " }\n", " }\n", " }\n", " }\n", " _fetch_tiles(tiles) {\n", " for (const tile of tiles) {\n", " const [x, y, z, bounds] = tile;\n", " this._create_tile(x, y, z, bounds);\n", " }\n", " }\n", " _update() {\n", " const { tile_source } = this.model;\n", " const { min_zoom } = tile_source;\n", " const { max_zoom } = tile_source;\n", " let extent = this.get_extent();\n", " const zooming_out = (this.extent[2] - this.extent[0]) < (extent[2] - extent[0]);\n", " const h = this.map_frame._height.value;\n", " const w = this.map_frame._width.value;\n", " let zoom_level = tile_source.get_level_by_extent(extent, h, w);\n", " let snap_back = false;\n", " if (zoom_level < min_zoom) {\n", " extent = this.extent;\n", " zoom_level = min_zoom;\n", " snap_back = true;\n", " }\n", " else if (zoom_level > max_zoom) {\n", " extent = this.extent;\n", " zoom_level = max_zoom;\n", " snap_back = true;\n", " }\n", " if (snap_back) {\n", " this.x_range.setv({ x_range: { start: extent[0], end: extent[2] } });\n", " this.y_range.setv({ start: extent[1], end: extent[3] });\n", " }\n", " this.extent = extent;\n", " const tiles = tile_source.get_tiles_by_extent(extent, zoom_level);\n", " const need_load = [];\n", " const cached = [];\n", " const parents = [];\n", " const children = [];\n", " for (const t of tiles) {\n", " const [x, y, z] = t;\n", " const key = tile_source.tile_xyz_to_key(x, y, z);\n", " const tile = tile_source.tiles.get(key);\n", " if (tile != null && tile.loaded) {\n", " cached.push(key);\n", " }\n", " else {\n", " if (this.model.render_parents) {\n", " const [px, py, pz] = tile_source.get_closest_parent_by_tile_xyz(x, y, z);\n", " const parent_key = tile_source.tile_xyz_to_key(px, py, pz);\n", " const parent_tile = tile_source.tiles.get(parent_key);\n", " if ((parent_tile != null) && parent_tile.loaded && !array_1.includes(parents, parent_key)) {\n", " parents.push(parent_key);\n", " }\n", " if (zooming_out) {\n", " const child_tiles = tile_source.children_by_tile_xyz(x, y, z);\n", " for (const [cx, cy, cz] of child_tiles) {\n", " const child_key = tile_source.tile_xyz_to_key(cx, cy, cz);\n", " if (tile_source.tiles.has(child_key))\n", " children.push(child_key);\n", " }\n", " }\n", " }\n", " }\n", " if (tile == null)\n", " need_load.push(t);\n", " }\n", " // draw stand-in parents ----------\n", " this._render_tiles(parents);\n", " this._render_tiles(children);\n", " // draw cached ----------\n", " this._render_tiles(cached);\n", " // fetch missing -------\n", " if (this.render_timer != null) {\n", " clearTimeout(this.render_timer);\n", " }\n", " this.render_timer = setTimeout((() => this._fetch_tiles(need_load)), 65);\n", " }\n", " }\n", " exports.TileRendererView = TileRendererView;\n", " TileRendererView.__name__ = \"TileRendererView\";\n", " class TileRenderer extends data_renderer_1.DataRenderer {\n", " constructor(attrs) {\n", " super(attrs);\n", " // XXX: tile renderer doesn't allow selection, but needs to fulfil the APIs\n", " this._selection_manager = new selection_manager_1.SelectionManager({\n", " source: new column_data_source_1.ColumnDataSource(),\n", " });\n", " }\n", " static init_TileRenderer() {\n", " this.prototype.default_view = TileRendererView;\n", " this.define({\n", " alpha: [p.Number, 1.0],\n", " smoothing: [p.Boolean, true],\n", " tile_source: [p.Instance, () => new wmts_tile_source_1.WMTSTileSource()],\n", " render_parents: [p.Boolean, true],\n", " });\n", " }\n", " get_selection_manager() {\n", " return this._selection_manager;\n", " }\n", " }\n", " exports.TileRenderer = TileRenderer;\n", " TileRenderer.__name__ = \"TileRenderer\";\n", " TileRenderer.init_TileRenderer();\n", " },\n", " /* models/tiles/wmts_tile_source.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const mercator_tile_source_1 = require(310) /* ./mercator_tile_source */;\n", " class WMTSTileSource extends mercator_tile_source_1.MercatorTileSource {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " get_image_url(x, y, z) {\n", " const image_url = this.string_lookup_replace(this.url, this.extra_url_vars);\n", " const [wx, wy, wz] = this.tms_to_wmts(x, y, z);\n", " return image_url\n", " .replace(\"{X}\", wx.toString())\n", " .replace(\"{Y}\", wy.toString())\n", " .replace(\"{Z}\", wz.toString());\n", " }\n", " }\n", " exports.WMTSTileSource = WMTSTileSource;\n", " WMTSTileSource.__name__ = \"WMTSTileSource\";\n", " },\n", " /* styles/tiles.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.bk_tile_attribution = \"bk-tile-attribution\";\n", " },\n", " /* styles/tiles.css.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const css = `\n", " .bk-root .bk-tile-attribution a {\n", " color: black;\n", " }\n", " `;\n", " exports.default = css;\n", " },\n", " /* models/tiles/tms_tile_source.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const mercator_tile_source_1 = require(310) /* ./mercator_tile_source */;\n", " class TMSTileSource extends mercator_tile_source_1.MercatorTileSource {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " get_image_url(x, y, z) {\n", " const image_url = this.string_lookup_replace(this.url, this.extra_url_vars);\n", " return image_url\n", " .replace(\"{X}\", x.toString())\n", " .replace('{Y}', y.toString())\n", " .replace(\"{Z}\", z.toString());\n", " }\n", " }\n", " exports.TMSTileSource = TMSTileSource;\n", " TMSTileSource.__name__ = \"TMSTileSource\";\n", " },\n", " /* models/textures/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var canvas_texture_1 = require(320) /* ./canvas_texture */;\n", " exports.CanvasTexture = canvas_texture_1.CanvasTexture;\n", " var image_url_texture_1 = require(322) /* ./image_url_texture */;\n", " exports.ImageURLTexture = image_url_texture_1.ImageURLTexture;\n", " var texture_1 = require(321) /* ./texture */;\n", " exports.Texture = texture_1.Texture;\n", " },\n", " /* models/textures/canvas_texture.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const texture_1 = require(321) /* ./texture */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const string_1 = require(24) /* ../../core/util/string */;\n", " class CanvasTexture extends texture_1.Texture {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_CanvasTexture() {\n", " this.define({\n", " code: [p.String],\n", " });\n", " }\n", " get func() {\n", " const code = string_1.use_strict(this.code);\n", " return new Function(\"ctx\", \"color\", \"scale\", \"weight\", code);\n", " }\n", " get_pattern(color, scale, weight) {\n", " return (ctx) => {\n", " const canvas = document.createElement('canvas');\n", " canvas.width = scale;\n", " canvas.height = scale;\n", " const pattern_ctx = canvas.getContext('2d');\n", " this.func.call(this, pattern_ctx, color, scale, weight);\n", " return ctx.createPattern(canvas, this.repetition);\n", " };\n", " }\n", " }\n", " exports.CanvasTexture = CanvasTexture;\n", " CanvasTexture.__name__ = \"CanvasTexture\";\n", " CanvasTexture.init_CanvasTexture();\n", " },\n", " /* models/textures/texture.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const model_1 = require(71) /* ../../model */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class Texture extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Texture() {\n", " this.define({\n", " repetition: [p.TextureRepetition, \"repeat\"],\n", " });\n", " }\n", " onload(defer_func) {\n", " defer_func();\n", " }\n", " }\n", " exports.Texture = Texture;\n", " Texture.__name__ = \"Texture\";\n", " Texture.init_Texture();\n", " },\n", " /* models/textures/image_url_texture.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const texture_1 = require(321) /* ./texture */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const image_1 = require(224) /* ../../core/util/image */;\n", " class ImageURLTexture extends texture_1.Texture {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ImageURLTexture() {\n", " this.define({\n", " url: [p.String],\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " this._loader = new image_1.ImageLoader(this.url);\n", " }\n", " get_pattern(_color, _scale, _weight) {\n", " return (ctx) => {\n", " if (!this._loader.finished) {\n", " return null;\n", " }\n", " return ctx.createPattern(this._loader.image, this.repetition);\n", " };\n", " }\n", " onload(defer_func) {\n", " this._loader.promise.then(() => defer_func());\n", " }\n", " }\n", " exports.ImageURLTexture = ImageURLTexture;\n", " ImageURLTexture.__name__ = \"ImageURLTexture\";\n", " ImageURLTexture.init_ImageURLTexture();\n", " },\n", " /* models/tools/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var action_tool_1 = require(285) /* ./actions/action_tool */;\n", " exports.ActionTool = action_tool_1.ActionTool;\n", " var custom_action_1 = require(324) /* ./actions/custom_action */;\n", " exports.CustomAction = custom_action_1.CustomAction;\n", " var help_tool_1 = require(286) /* ./actions/help_tool */;\n", " exports.HelpTool = help_tool_1.HelpTool;\n", " var redo_tool_1 = require(325) /* ./actions/redo_tool */;\n", " exports.RedoTool = redo_tool_1.RedoTool;\n", " var reset_tool_1 = require(326) /* ./actions/reset_tool */;\n", " exports.ResetTool = reset_tool_1.ResetTool;\n", " var save_tool_1 = require(327) /* ./actions/save_tool */;\n", " exports.SaveTool = save_tool_1.SaveTool;\n", " var undo_tool_1 = require(328) /* ./actions/undo_tool */;\n", " exports.UndoTool = undo_tool_1.UndoTool;\n", " var zoom_in_tool_1 = require(329) /* ./actions/zoom_in_tool */;\n", " exports.ZoomInTool = zoom_in_tool_1.ZoomInTool;\n", " var zoom_out_tool_1 = require(331) /* ./actions/zoom_out_tool */;\n", " exports.ZoomOutTool = zoom_out_tool_1.ZoomOutTool;\n", " var button_tool_1 = require(275) /* ./button_tool */;\n", " exports.ButtonTool = button_tool_1.ButtonTool;\n", " var edit_tool_1 = require(332) /* ./edit/edit_tool */;\n", " exports.EditTool = edit_tool_1.EditTool;\n", " var box_edit_tool_1 = require(333) /* ./edit/box_edit_tool */;\n", " exports.BoxEditTool = box_edit_tool_1.BoxEditTool;\n", " var freehand_draw_tool_1 = require(334) /* ./edit/freehand_draw_tool */;\n", " exports.FreehandDrawTool = freehand_draw_tool_1.FreehandDrawTool;\n", " var point_draw_tool_1 = require(335) /* ./edit/point_draw_tool */;\n", " exports.PointDrawTool = point_draw_tool_1.PointDrawTool;\n", " var poly_draw_tool_1 = require(336) /* ./edit/poly_draw_tool */;\n", " exports.PolyDrawTool = poly_draw_tool_1.PolyDrawTool;\n", " var poly_tool_1 = require(337) /* ./edit/poly_tool */;\n", " exports.PolyTool = poly_tool_1.PolyTool;\n", " var poly_edit_tool_1 = require(338) /* ./edit/poly_edit_tool */;\n", " exports.PolyEditTool = poly_edit_tool_1.PolyEditTool;\n", " var box_select_tool_1 = require(339) /* ./gestures/box_select_tool */;\n", " exports.BoxSelectTool = box_select_tool_1.BoxSelectTool;\n", " var box_zoom_tool_1 = require(342) /* ./gestures/box_zoom_tool */;\n", " exports.BoxZoomTool = box_zoom_tool_1.BoxZoomTool;\n", " var gesture_tool_1 = require(284) /* ./gestures/gesture_tool */;\n", " exports.GestureTool = gesture_tool_1.GestureTool;\n", " var lasso_select_tool_1 = require(343) /* ./gestures/lasso_select_tool */;\n", " exports.LassoSelectTool = lasso_select_tool_1.LassoSelectTool;\n", " var line_edit_tool_1 = require(344) /* ./edit/line_edit_tool */;\n", " exports.LineEditTool = line_edit_tool_1.LineEditTool;\n", " var pan_tool_1 = require(346) /* ./gestures/pan_tool */;\n", " exports.PanTool = pan_tool_1.PanTool;\n", " var poly_select_tool_1 = require(347) /* ./gestures/poly_select_tool */;\n", " exports.PolySelectTool = poly_select_tool_1.PolySelectTool;\n", " var range_tool_1 = require(348) /* ./gestures/range_tool */;\n", " exports.RangeTool = range_tool_1.RangeTool;\n", " var select_tool_1 = require(340) /* ./gestures/select_tool */;\n", " exports.SelectTool = select_tool_1.SelectTool;\n", " var tap_tool_1 = require(349) /* ./gestures/tap_tool */;\n", " exports.TapTool = tap_tool_1.TapTool;\n", " var wheel_pan_tool_1 = require(350) /* ./gestures/wheel_pan_tool */;\n", " exports.WheelPanTool = wheel_pan_tool_1.WheelPanTool;\n", " var wheel_zoom_tool_1 = require(351) /* ./gestures/wheel_zoom_tool */;\n", " exports.WheelZoomTool = wheel_zoom_tool_1.WheelZoomTool;\n", " var crosshair_tool_1 = require(352) /* ./inspectors/crosshair_tool */;\n", " exports.CrosshairTool = crosshair_tool_1.CrosshairTool;\n", " var customjs_hover_1 = require(353) /* ./inspectors/customjs_hover */;\n", " exports.CustomJSHover = customjs_hover_1.CustomJSHover;\n", " var hover_tool_1 = require(354) /* ./inspectors/hover_tool */;\n", " exports.HoverTool = hover_tool_1.HoverTool;\n", " var inspect_tool_1 = require(274) /* ./inspectors/inspect_tool */;\n", " exports.InspectTool = inspect_tool_1.InspectTool;\n", " var tool_1 = require(277) /* ./tool */;\n", " exports.Tool = tool_1.Tool;\n", " var tool_proxy_1 = require(355) /* ./tool_proxy */;\n", " exports.ToolProxy = tool_proxy_1.ToolProxy;\n", " var toolbar_1 = require(273) /* ./toolbar */;\n", " exports.Toolbar = toolbar_1.Toolbar;\n", " var toolbar_base_1 = require(283) /* ./toolbar_base */;\n", " exports.ToolbarBase = toolbar_base_1.ToolbarBase;\n", " var toolbar_box_1 = require(357) /* ./toolbar_box */;\n", " exports.ProxyToolbar = toolbar_box_1.ProxyToolbar;\n", " var toolbar_box_2 = require(357) /* ./toolbar_box */;\n", " exports.ToolbarBox = toolbar_box_2.ToolbarBox;\n", " },\n", " /* models/tools/actions/custom_action.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const action_tool_1 = require(285) /* ./action_tool */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const toolbar_1 = require(278) /* ../../../styles/toolbar */;\n", " class CustomActionButtonView extends action_tool_1.ActionToolButtonView {\n", " css_classes() {\n", " return super.css_classes().concat(toolbar_1.bk_toolbar_button_custom_action);\n", " }\n", " }\n", " exports.CustomActionButtonView = CustomActionButtonView;\n", " CustomActionButtonView.__name__ = \"CustomActionButtonView\";\n", " class CustomActionView extends action_tool_1.ActionToolView {\n", " doit() {\n", " if (this.model.callback != null)\n", " this.model.callback.execute(this.model);\n", " }\n", " }\n", " exports.CustomActionView = CustomActionView;\n", " CustomActionView.__name__ = \"CustomActionView\";\n", " class CustomAction extends action_tool_1.ActionTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Custom Action\";\n", " this.button_view = CustomActionButtonView;\n", " }\n", " static init_CustomAction() {\n", " this.prototype.default_view = CustomActionView;\n", " this.define({\n", " action_tooltip: [p.String, 'Perform a Custom Action'],\n", " callback: [p.Any],\n", " icon: [p.String],\n", " });\n", " }\n", " get tooltip() {\n", " return this.action_tooltip;\n", " }\n", " }\n", " exports.CustomAction = CustomAction;\n", " CustomAction.__name__ = \"CustomAction\";\n", " CustomAction.init_CustomAction();\n", " },\n", " /* models/tools/actions/redo_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const action_tool_1 = require(285) /* ./action_tool */;\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class RedoToolView extends action_tool_1.ActionToolView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.plot_view.state_changed, () => this.model.disabled = !this.plot_view.can_redo());\n", " }\n", " doit() {\n", " this.plot_view.redo();\n", " }\n", " }\n", " exports.RedoToolView = RedoToolView;\n", " RedoToolView.__name__ = \"RedoToolView\";\n", " class RedoTool extends action_tool_1.ActionTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Redo\";\n", " this.icon = icons_1.bk_tool_icon_redo;\n", " }\n", " static init_RedoTool() {\n", " this.prototype.default_view = RedoToolView;\n", " this.override({\n", " disabled: true,\n", " });\n", " this.register_alias(\"redo\", () => new RedoTool());\n", " }\n", " }\n", " exports.RedoTool = RedoTool;\n", " RedoTool.__name__ = \"RedoTool\";\n", " RedoTool.init_RedoTool();\n", " },\n", " /* models/tools/actions/reset_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const action_tool_1 = require(285) /* ./action_tool */;\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class ResetToolView extends action_tool_1.ActionToolView {\n", " doit() {\n", " this.plot_view.reset();\n", " }\n", " }\n", " exports.ResetToolView = ResetToolView;\n", " ResetToolView.__name__ = \"ResetToolView\";\n", " class ResetTool extends action_tool_1.ActionTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Reset\";\n", " this.icon = icons_1.bk_tool_icon_reset;\n", " }\n", " static init_ResetTool() {\n", " this.prototype.default_view = ResetToolView;\n", " this.register_alias(\"reset\", () => new ResetTool());\n", " }\n", " }\n", " exports.ResetTool = ResetTool;\n", " ResetTool.__name__ = \"ResetTool\";\n", " ResetTool.init_ResetTool();\n", " },\n", " /* models/tools/actions/save_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const action_tool_1 = require(285) /* ./action_tool */;\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class SaveToolView extends action_tool_1.ActionToolView {\n", " doit() {\n", " this.plot_view.save(\"bokeh_plot\");\n", " }\n", " }\n", " exports.SaveToolView = SaveToolView;\n", " SaveToolView.__name__ = \"SaveToolView\";\n", " class SaveTool extends action_tool_1.ActionTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Save\";\n", " this.icon = icons_1.bk_tool_icon_save;\n", " }\n", " static init_SaveTool() {\n", " this.prototype.default_view = SaveToolView;\n", " this.register_alias(\"save\", () => new SaveTool());\n", " }\n", " }\n", " exports.SaveTool = SaveTool;\n", " SaveTool.__name__ = \"SaveTool\";\n", " SaveTool.init_SaveTool();\n", " },\n", " /* models/tools/actions/undo_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const action_tool_1 = require(285) /* ./action_tool */;\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class UndoToolView extends action_tool_1.ActionToolView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.plot_view.state_changed, () => this.model.disabled = !this.plot_view.can_undo());\n", " }\n", " doit() {\n", " this.plot_view.undo();\n", " }\n", " }\n", " exports.UndoToolView = UndoToolView;\n", " UndoToolView.__name__ = \"UndoToolView\";\n", " class UndoTool extends action_tool_1.ActionTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Undo\";\n", " this.icon = icons_1.bk_tool_icon_undo;\n", " }\n", " static init_UndoTool() {\n", " this.prototype.default_view = UndoToolView;\n", " this.override({\n", " disabled: true,\n", " });\n", " this.register_alias(\"undo\", () => new UndoTool());\n", " }\n", " }\n", " exports.UndoTool = UndoTool;\n", " UndoTool.__name__ = \"UndoTool\";\n", " UndoTool.init_UndoTool();\n", " },\n", " /* models/tools/actions/zoom_in_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const action_tool_1 = require(285) /* ./action_tool */;\n", " const zoom_1 = require(330) /* ../../../core/util/zoom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class ZoomInToolView extends action_tool_1.ActionToolView {\n", " doit() {\n", " const frame = this.plot_view.frame;\n", " const dims = this.model.dimensions;\n", " // restrict to axis configured in tool's dimensions property\n", " const h_axis = dims == 'width' || dims == 'both';\n", " const v_axis = dims == 'height' || dims == 'both';\n", " const zoom_info = zoom_1.scale_range(frame, this.model.factor, h_axis, v_axis);\n", " this.plot_view.push_state('zoom_out', { range: zoom_info });\n", " this.plot_view.update_range(zoom_info, false, true);\n", " if (this.model.document)\n", " this.model.document.interactive_start(this.plot_model);\n", " }\n", " }\n", " exports.ZoomInToolView = ZoomInToolView;\n", " ZoomInToolView.__name__ = \"ZoomInToolView\";\n", " class ZoomInTool extends action_tool_1.ActionTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Zoom In\";\n", " this.icon = icons_1.bk_tool_icon_zoom_in;\n", " }\n", " static init_ZoomInTool() {\n", " this.prototype.default_view = ZoomInToolView;\n", " this.define({\n", " factor: [p.Percent, 0.1],\n", " dimensions: [p.Dimensions, \"both\"],\n", " });\n", " this.register_alias(\"zoom_in\", () => new ZoomInTool({ dimensions: 'both' }));\n", " this.register_alias(\"xzoom_in\", () => new ZoomInTool({ dimensions: 'width' }));\n", " this.register_alias(\"yzoom_in\", () => new ZoomInTool({ dimensions: 'height' }));\n", " }\n", " get tooltip() {\n", " return this._get_dim_tooltip(this.tool_name, this.dimensions);\n", " }\n", " }\n", " exports.ZoomInTool = ZoomInTool;\n", " ZoomInTool.__name__ = \"ZoomInTool\";\n", " ZoomInTool.init_ZoomInTool();\n", " },\n", " /* core/util/zoom.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const math_1 = require(10) /* ./math */;\n", " // Module for zoom-related functions\n", " function scale_highlow(range, factor, center) {\n", " const [low, high] = [range.start, range.end];\n", " const x = center != null ? center : (high + low) / 2.0;\n", " const x0 = low - (low - x) * factor;\n", " const x1 = high - (high - x) * factor;\n", " return [x0, x1];\n", " }\n", " exports.scale_highlow = scale_highlow;\n", " function get_info(scales, [sxy0, sxy1]) {\n", " const info = {};\n", " for (const name in scales) {\n", " const scale = scales[name];\n", " const [start, end] = scale.r_invert(sxy0, sxy1);\n", " info[name] = { start, end };\n", " }\n", " return info;\n", " }\n", " exports.get_info = get_info;\n", " function scale_range(frame, factor, h_axis = true, v_axis = true, center) {\n", " /*\n", " * Utility function for zoom tools to calculate/create the zoom_info object\n", " * of the form required by ``PlotView.update_range``\n", " *\n", " * Parameters:\n", " * frame : CartesianFrame\n", " * factor : Number\n", " * h_axis : Boolean, optional\n", " * whether to zoom the horizontal axis (default = true)\n", " * v_axis : Boolean, optional\n", " * whether to zoom the horizontal axis (default = true)\n", " * center : object, optional\n", " * of form {'x': Number, 'y', Number}\n", " *\n", " * Returns:\n", " * object:\n", " */\n", " // clamp the magnitude of factor, if it is > 1 bad things happen\n", " factor = math_1.clamp(factor, -0.9, 0.9);\n", " const hfactor = h_axis ? factor : 0;\n", " const [sx0, sx1] = scale_highlow(frame.bbox.h_range, hfactor, center != null ? center.x : undefined);\n", " const xrs = get_info(frame.xscales, [sx0, sx1]);\n", " const vfactor = v_axis ? factor : 0;\n", " const [sy0, sy1] = scale_highlow(frame.bbox.v_range, vfactor, center != null ? center.y : undefined);\n", " const yrs = get_info(frame.yscales, [sy0, sy1]);\n", " // OK this sucks we can't set factor independently in each direction. It is used\n", " // for GMap plots, and GMap plots always preserve aspect, so effective the value\n", " // of 'dimensions' is ignored.\n", " return { xrs, yrs, factor };\n", " }\n", " exports.scale_range = scale_range;\n", " },\n", " /* models/tools/actions/zoom_out_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const action_tool_1 = require(285) /* ./action_tool */;\n", " const zoom_1 = require(330) /* ../../../core/util/zoom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class ZoomOutToolView extends action_tool_1.ActionToolView {\n", " doit() {\n", " const frame = this.plot_view.frame;\n", " const dims = this.model.dimensions;\n", " // restrict to axis configured in tool's dimensions property\n", " const h_axis = dims == 'width' || dims == 'both';\n", " const v_axis = dims == 'height' || dims == 'both';\n", " // zooming out requires a negative factor to scale_range\n", " const zoom_info = zoom_1.scale_range(frame, -this.model.factor, h_axis, v_axis);\n", " this.plot_view.push_state('zoom_out', { range: zoom_info });\n", " this.plot_view.update_range(zoom_info, false, true);\n", " if (this.model.document)\n", " this.model.document.interactive_start(this.plot_model);\n", " }\n", " }\n", " exports.ZoomOutToolView = ZoomOutToolView;\n", " ZoomOutToolView.__name__ = \"ZoomOutToolView\";\n", " class ZoomOutTool extends action_tool_1.ActionTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Zoom Out\";\n", " this.icon = icons_1.bk_tool_icon_zoom_out;\n", " }\n", " static init_ZoomOutTool() {\n", " this.prototype.default_view = ZoomOutToolView;\n", " this.define({\n", " factor: [p.Percent, 0.1],\n", " dimensions: [p.Dimensions, \"both\"],\n", " });\n", " this.register_alias(\"zoom_out\", () => new ZoomOutTool({ dimensions: 'both' }));\n", " this.register_alias(\"xzoom_out\", () => new ZoomOutTool({ dimensions: 'width' }));\n", " this.register_alias(\"yzoom_out\", () => new ZoomOutTool({ dimensions: 'height' }));\n", " }\n", " get tooltip() {\n", " return this._get_dim_tooltip(this.tool_name, this.dimensions);\n", " }\n", " }\n", " exports.ZoomOutTool = ZoomOutTool;\n", " ZoomOutTool.__name__ = \"ZoomOutTool\";\n", " ZoomOutTool.init_ZoomOutTool();\n", " },\n", " /* models/tools/edit/edit_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const array_1 = require(9) /* ../../../core/util/array */;\n", " const types_1 = require(8) /* ../../../core/util/types */;\n", " const assert_1 = require(11) /* ../../../core/util/assert */;\n", " const gesture_tool_1 = require(284) /* ../gestures/gesture_tool */;\n", " class EditToolView extends gesture_tool_1.GestureToolView {\n", " constructor() {\n", " super(...arguments);\n", " this._mouse_in_frame = true;\n", " }\n", " _select_mode(ev) {\n", " const { shiftKey, ctrlKey } = ev;\n", " if (!shiftKey && !ctrlKey)\n", " return \"replace\";\n", " else if (shiftKey && !ctrlKey)\n", " return \"append\";\n", " else if (!shiftKey && ctrlKey)\n", " return \"intersect\";\n", " else if (shiftKey && ctrlKey)\n", " return \"subtract\";\n", " else\n", " assert_1.unreachable();\n", " }\n", " _move_enter(_e) {\n", " this._mouse_in_frame = true;\n", " }\n", " _move_exit(_e) {\n", " this._mouse_in_frame = false;\n", " }\n", " _map_drag(sx, sy, renderer) {\n", " // Maps screen to data coordinates\n", " const frame = this.plot_view.frame;\n", " if (!frame.bbox.contains(sx, sy)) {\n", " return null;\n", " }\n", " const x = frame.xscales[renderer.x_range_name].invert(sx);\n", " const y = frame.yscales[renderer.y_range_name].invert(sy);\n", " return [x, y];\n", " }\n", " _delete_selected(renderer) {\n", " // Deletes all selected rows in the ColumnDataSource\n", " const cds = renderer.data_source;\n", " const indices = cds.selected.indices;\n", " indices.sort();\n", " for (const column of cds.columns()) {\n", " const values = cds.get_array(column);\n", " for (let index = 0; index < indices.length; index++) {\n", " const ind = indices[index];\n", " values.splice(ind - index, 1);\n", " }\n", " }\n", " this._emit_cds_changes(cds);\n", " }\n", " _pop_glyphs(cds, num_objects) {\n", " // Pops rows in the CDS until only num_objects are left\n", " const columns = cds.columns();\n", " if (!num_objects || !columns.length)\n", " return;\n", " for (const column of columns) {\n", " let array = cds.get_array(column);\n", " const drop = array.length - num_objects + 1;\n", " if (drop < 1)\n", " continue;\n", " if (!types_1.isArray(array)) {\n", " array = Array.from(array);\n", " cds.data[column] = array;\n", " }\n", " array.splice(0, drop);\n", " }\n", " }\n", " _emit_cds_changes(cds, redraw = true, clear = true, emit = true) {\n", " if (clear)\n", " cds.selection_manager.clear();\n", " if (redraw)\n", " cds.change.emit();\n", " if (emit) {\n", " cds.data = cds.data;\n", " cds.properties.data.change.emit();\n", " }\n", " }\n", " _drag_points(ev, renderers, dim = \"both\") {\n", " if (this._basepoint == null)\n", " return;\n", " const [bx, by] = this._basepoint;\n", " for (const renderer of renderers) {\n", " const basepoint = this._map_drag(bx, by, renderer);\n", " const point = this._map_drag(ev.sx, ev.sy, renderer);\n", " if (point == null || basepoint == null) {\n", " continue;\n", " }\n", " const [x, y] = point;\n", " const [px, py] = basepoint;\n", " const [dx, dy] = [x - px, y - py];\n", " // Type once dataspecs are typed\n", " const glyph = renderer.glyph;\n", " const cds = renderer.data_source;\n", " const [xkey, ykey] = [glyph.x.field, glyph.y.field];\n", " for (const index of cds.selected.indices) {\n", " if (xkey && (dim == \"width\" || dim == \"both\")) {\n", " cds.data[xkey][index] += dx;\n", " }\n", " if (ykey && (dim == \"height\" || dim == \"both\")) {\n", " cds.data[ykey][index] += dy;\n", " }\n", " }\n", " cds.change.emit();\n", " }\n", " this._basepoint = [ev.sx, ev.sy];\n", " }\n", " _pad_empty_columns(cds, coord_columns) {\n", " // Pad ColumnDataSource non-coordinate columns with empty_value\n", " for (const column of cds.columns()) {\n", " if (!array_1.includes(coord_columns, column))\n", " cds.get_array(column).push(this.model.empty_value);\n", " }\n", " }\n", " _select_event(ev, mode, renderers) {\n", " // Process selection event on the supplied renderers and return selected renderers\n", " const frame = this.plot_view.frame;\n", " const { sx, sy } = ev;\n", " if (!frame.bbox.contains(sx, sy)) {\n", " return [];\n", " }\n", " const geometry = { type: 'point', sx, sy };\n", " const selected = [];\n", " for (const renderer of renderers) {\n", " const sm = renderer.get_selection_manager();\n", " const cds = renderer.data_source;\n", " const views = [this.plot_view.renderer_views.get(renderer)];\n", " const did_hit = sm.select(views, geometry, true, mode);\n", " if (did_hit) {\n", " selected.push(renderer);\n", " }\n", " cds.properties.selected.change.emit();\n", " }\n", " return selected;\n", " }\n", " }\n", " exports.EditToolView = EditToolView;\n", " EditToolView.__name__ = \"EditToolView\";\n", " class EditTool extends gesture_tool_1.GestureTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_EditTool() {\n", " this.define({\n", " custom_icon: [p.String],\n", " custom_tooltip: [p.String],\n", " empty_value: [p.Any],\n", " renderers: [p.Array, []],\n", " });\n", " }\n", " get tooltip() {\n", " return this.custom_tooltip || this.tool_name;\n", " }\n", " get computed_icon() {\n", " return this.custom_icon || this.icon;\n", " }\n", " }\n", " exports.EditTool = EditTool;\n", " EditTool.__name__ = \"EditTool\";\n", " EditTool.init_EditTool();\n", " },\n", " /* models/tools/edit/box_edit_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const dom_1 = require(68) /* ../../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const edit_tool_1 = require(332) /* ./edit_tool */;\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class BoxEditToolView extends edit_tool_1.EditToolView {\n", " _tap(ev) {\n", " if ((this._draw_basepoint != null) || (this._basepoint != null))\n", " return;\n", " this._select_event(ev, this._select_mode(ev), this.model.renderers);\n", " }\n", " _keyup(ev) {\n", " if (!this.model.active || !this._mouse_in_frame)\n", " return;\n", " for (const renderer of this.model.renderers) {\n", " if (ev.keyCode === dom_1.Keys.Backspace) {\n", " this._delete_selected(renderer);\n", " }\n", " else if (ev.keyCode == dom_1.Keys.Esc) {\n", " // Type properly once selection_manager is typed\n", " const cds = renderer.data_source;\n", " cds.selection_manager.clear();\n", " }\n", " }\n", " }\n", " _set_extent([sx0, sx1], [sy0, sy1], append, emit = false) {\n", " const renderer = this.model.renderers[0];\n", " const frame = this.plot_view.frame;\n", " // Type once dataspecs are typed\n", " const glyph = renderer.glyph;\n", " const cds = renderer.data_source;\n", " const xscale = frame.xscales[renderer.x_range_name];\n", " const yscale = frame.yscales[renderer.y_range_name];\n", " const [x0, x1] = xscale.r_invert(sx0, sx1);\n", " const [y0, y1] = yscale.r_invert(sy0, sy1);\n", " const [x, y] = [(x0 + x1) / 2, (y0 + y1) / 2];\n", " const [w, h] = [x1 - x0, y1 - y0];\n", " const [xkey, ykey] = [glyph.x.field, glyph.y.field];\n", " const [wkey, hkey] = [glyph.width.field, glyph.height.field];\n", " if (append) {\n", " this._pop_glyphs(cds, this.model.num_objects);\n", " if (xkey)\n", " cds.get_array(xkey).push(x);\n", " if (ykey)\n", " cds.get_array(ykey).push(y);\n", " if (wkey)\n", " cds.get_array(wkey).push(w);\n", " if (hkey)\n", " cds.get_array(hkey).push(h);\n", " this._pad_empty_columns(cds, [xkey, ykey, wkey, hkey]);\n", " }\n", " else {\n", " const index = cds.data[xkey].length - 1;\n", " if (xkey)\n", " cds.data[xkey][index] = x;\n", " if (ykey)\n", " cds.data[ykey][index] = y;\n", " if (wkey)\n", " cds.data[wkey][index] = w;\n", " if (hkey)\n", " cds.data[hkey][index] = h;\n", " }\n", " this._emit_cds_changes(cds, true, false, emit);\n", " }\n", " _update_box(ev, append = false, emit = false) {\n", " if (this._draw_basepoint == null)\n", " return;\n", " const curpoint = [ev.sx, ev.sy];\n", " const frame = this.plot_view.frame;\n", " const dims = this.model.dimensions;\n", " const limits = this.model._get_dim_limits(this._draw_basepoint, curpoint, frame, dims);\n", " if (limits != null) {\n", " const [sxlim, sylim] = limits;\n", " this._set_extent(sxlim, sylim, append, emit);\n", " }\n", " }\n", " _doubletap(ev) {\n", " if (!this.model.active)\n", " return;\n", " if (this._draw_basepoint != null) {\n", " this._update_box(ev, false, true);\n", " this._draw_basepoint = null;\n", " }\n", " else {\n", " this._draw_basepoint = [ev.sx, ev.sy];\n", " this._select_event(ev, \"append\", this.model.renderers);\n", " this._update_box(ev, true, false);\n", " }\n", " }\n", " _move(ev) {\n", " this._update_box(ev, false, false);\n", " }\n", " _pan_start(ev) {\n", " if (ev.shiftKey) {\n", " if (this._draw_basepoint != null)\n", " return;\n", " this._draw_basepoint = [ev.sx, ev.sy];\n", " this._update_box(ev, true, false);\n", " }\n", " else {\n", " if (this._basepoint != null)\n", " return;\n", " this._select_event(ev, \"append\", this.model.renderers);\n", " this._basepoint = [ev.sx, ev.sy];\n", " }\n", " }\n", " _pan(ev, append = false, emit = false) {\n", " if (ev.shiftKey) {\n", " if (this._draw_basepoint == null)\n", " return;\n", " this._update_box(ev, append, emit);\n", " }\n", " else {\n", " if (this._basepoint == null)\n", " return;\n", " this._drag_points(ev, this.model.renderers);\n", " }\n", " }\n", " _pan_end(ev) {\n", " this._pan(ev, false, true);\n", " if (ev.shiftKey) {\n", " this._draw_basepoint = null;\n", " }\n", " else {\n", " this._basepoint = null;\n", " for (const renderer of this.model.renderers)\n", " this._emit_cds_changes(renderer.data_source, false, true, true);\n", " }\n", " }\n", " }\n", " exports.BoxEditToolView = BoxEditToolView;\n", " BoxEditToolView.__name__ = \"BoxEditToolView\";\n", " class BoxEditTool extends edit_tool_1.EditTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Box Edit Tool\";\n", " this.icon = icons_1.bk_tool_icon_box_edit;\n", " this.event_type = [\"tap\", \"pan\", \"move\"];\n", " this.default_order = 1;\n", " }\n", " static init_BoxEditTool() {\n", " this.prototype.default_view = BoxEditToolView;\n", " this.define({\n", " dimensions: [p.Dimensions, \"both\"],\n", " num_objects: [p.Int, 0],\n", " });\n", " }\n", " }\n", " exports.BoxEditTool = BoxEditTool;\n", " BoxEditTool.__name__ = \"BoxEditTool\";\n", " BoxEditTool.init_BoxEditTool();\n", " },\n", " /* models/tools/edit/freehand_draw_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const dom_1 = require(68) /* ../../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const types_1 = require(8) /* ../../../core/util/types */;\n", " const edit_tool_1 = require(332) /* ./edit_tool */;\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class FreehandDrawToolView extends edit_tool_1.EditToolView {\n", " _draw(ev, mode, emit = false) {\n", " if (!this.model.active)\n", " return;\n", " const renderer = this.model.renderers[0];\n", " const point = this._map_drag(ev.sx, ev.sy, renderer);\n", " if (point == null)\n", " return;\n", " const [x, y] = point;\n", " const cds = renderer.data_source;\n", " const glyph = renderer.glyph;\n", " const [xkey, ykey] = [glyph.xs.field, glyph.ys.field];\n", " if (mode == 'new') {\n", " this._pop_glyphs(cds, this.model.num_objects);\n", " if (xkey)\n", " cds.get_array(xkey).push([x]);\n", " if (ykey)\n", " cds.get_array(ykey).push([y]);\n", " this._pad_empty_columns(cds, [xkey, ykey]);\n", " }\n", " else if (mode == 'add') {\n", " if (xkey) {\n", " const xidx = cds.data[xkey].length - 1;\n", " let xs = cds.get_array(xkey)[xidx];\n", " if (!types_1.isArray(xs)) {\n", " xs = Array.from(xs);\n", " cds.data[xkey][xidx] = xs;\n", " }\n", " xs.push(x);\n", " }\n", " if (ykey) {\n", " const yidx = cds.data[ykey].length - 1;\n", " let ys = cds.get_array(ykey)[yidx];\n", " if (!types_1.isArray(ys)) {\n", " ys = Array.from(ys);\n", " cds.data[ykey][yidx] = ys;\n", " }\n", " ys.push(y);\n", " }\n", " }\n", " this._emit_cds_changes(cds, true, true, emit);\n", " }\n", " _pan_start(ev) {\n", " this._draw(ev, 'new');\n", " }\n", " _pan(ev) {\n", " this._draw(ev, 'add');\n", " }\n", " _pan_end(ev) {\n", " this._draw(ev, 'add', true);\n", " }\n", " _tap(ev) {\n", " this._select_event(ev, this._select_mode(ev), this.model.renderers);\n", " }\n", " _keyup(ev) {\n", " if (!this.model.active || !this._mouse_in_frame)\n", " return;\n", " for (const renderer of this.model.renderers) {\n", " if (ev.keyCode === dom_1.Keys.Esc) {\n", " renderer.data_source.selection_manager.clear();\n", " }\n", " else if (ev.keyCode === dom_1.Keys.Backspace) {\n", " this._delete_selected(renderer);\n", " }\n", " }\n", " }\n", " }\n", " exports.FreehandDrawToolView = FreehandDrawToolView;\n", " FreehandDrawToolView.__name__ = \"FreehandDrawToolView\";\n", " class FreehandDrawTool extends edit_tool_1.EditTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Freehand Draw Tool\";\n", " this.icon = icons_1.bk_tool_icon_freehand_draw;\n", " this.event_type = [\"pan\", \"tap\"];\n", " this.default_order = 3;\n", " }\n", " static init_FreehandDrawTool() {\n", " this.prototype.default_view = FreehandDrawToolView;\n", " this.define({\n", " num_objects: [p.Int, 0],\n", " });\n", " }\n", " }\n", " exports.FreehandDrawTool = FreehandDrawTool;\n", " FreehandDrawTool.__name__ = \"FreehandDrawTool\";\n", " FreehandDrawTool.init_FreehandDrawTool();\n", " },\n", " /* models/tools/edit/point_draw_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const dom_1 = require(68) /* ../../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const edit_tool_1 = require(332) /* ./edit_tool */;\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class PointDrawToolView extends edit_tool_1.EditToolView {\n", " _tap(ev) {\n", " const renderers = this._select_event(ev, this._select_mode(ev), this.model.renderers);\n", " if (renderers.length || !this.model.add) {\n", " return;\n", " }\n", " const renderer = this.model.renderers[0];\n", " const point = this._map_drag(ev.sx, ev.sy, renderer);\n", " if (point == null)\n", " return;\n", " // Type once dataspecs are typed\n", " const glyph = renderer.glyph;\n", " const cds = renderer.data_source;\n", " const [xkey, ykey] = [glyph.x.field, glyph.y.field];\n", " const [x, y] = point;\n", " this._pop_glyphs(cds, this.model.num_objects);\n", " if (xkey)\n", " cds.get_array(xkey).push(x);\n", " if (ykey)\n", " cds.get_array(ykey).push(y);\n", " this._pad_empty_columns(cds, [xkey, ykey]);\n", " cds.change.emit();\n", " cds.data = cds.data;\n", " cds.properties.data.change.emit();\n", " }\n", " _keyup(ev) {\n", " if (!this.model.active || !this._mouse_in_frame)\n", " return;\n", " for (const renderer of this.model.renderers) {\n", " if (ev.keyCode === dom_1.Keys.Backspace) {\n", " this._delete_selected(renderer);\n", " }\n", " else if (ev.keyCode == dom_1.Keys.Esc) {\n", " renderer.data_source.selection_manager.clear();\n", " }\n", " }\n", " }\n", " _pan_start(ev) {\n", " if (!this.model.drag)\n", " return;\n", " this._select_event(ev, \"append\", this.model.renderers);\n", " this._basepoint = [ev.sx, ev.sy];\n", " }\n", " _pan(ev) {\n", " if (!this.model.drag || this._basepoint == null)\n", " return;\n", " this._drag_points(ev, this.model.renderers);\n", " }\n", " _pan_end(ev) {\n", " if (!this.model.drag)\n", " return;\n", " this._pan(ev);\n", " for (const renderer of this.model.renderers)\n", " this._emit_cds_changes(renderer.data_source, false, true, true);\n", " this._basepoint = null;\n", " }\n", " }\n", " exports.PointDrawToolView = PointDrawToolView;\n", " PointDrawToolView.__name__ = \"PointDrawToolView\";\n", " class PointDrawTool extends edit_tool_1.EditTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Point Draw Tool\";\n", " this.icon = icons_1.bk_tool_icon_point_draw;\n", " this.event_type = [\"tap\", \"pan\", \"move\"];\n", " this.default_order = 2;\n", " }\n", " static init_PointDrawTool() {\n", " this.prototype.default_view = PointDrawToolView;\n", " this.define({\n", " add: [p.Boolean, true],\n", " drag: [p.Boolean, true],\n", " num_objects: [p.Int, 0],\n", " });\n", " }\n", " }\n", " exports.PointDrawTool = PointDrawTool;\n", " PointDrawTool.__name__ = \"PointDrawTool\";\n", " PointDrawTool.init_PointDrawTool();\n", " },\n", " /* models/tools/edit/poly_draw_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const dom_1 = require(68) /* ../../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const types_1 = require(8) /* ../../../core/util/types */;\n", " const poly_tool_1 = require(337) /* ./poly_tool */;\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class PolyDrawToolView extends poly_tool_1.PolyToolView {\n", " constructor() {\n", " super(...arguments);\n", " this._drawing = false;\n", " this._initialized = false;\n", " }\n", " _tap(ev) {\n", " if (this._drawing)\n", " this._draw(ev, 'add', true);\n", " else\n", " this._select_event(ev, this._select_mode(ev), this.model.renderers);\n", " }\n", " _draw(ev, mode, emit = false) {\n", " const renderer = this.model.renderers[0];\n", " const point = this._map_drag(ev.sx, ev.sy, renderer);\n", " if (!this._initialized)\n", " this.activate(); // Ensure that activate has been called\n", " if (point == null)\n", " return;\n", " const [x, y] = this._snap_to_vertex(ev, ...point);\n", " const cds = renderer.data_source;\n", " const glyph = renderer.glyph;\n", " const [xkey, ykey] = [glyph.xs.field, glyph.ys.field];\n", " if (mode == 'new') {\n", " this._pop_glyphs(cds, this.model.num_objects);\n", " if (xkey)\n", " cds.get_array(xkey).push([x, x]);\n", " if (ykey)\n", " cds.get_array(ykey).push([y, y]);\n", " this._pad_empty_columns(cds, [xkey, ykey]);\n", " }\n", " else if (mode == 'edit') {\n", " if (xkey) {\n", " const xs = cds.data[xkey][cds.data[xkey].length - 1];\n", " xs[xs.length - 1] = x;\n", " }\n", " if (ykey) {\n", " const ys = cds.data[ykey][cds.data[ykey].length - 1];\n", " ys[ys.length - 1] = y;\n", " }\n", " }\n", " else if (mode == 'add') {\n", " if (xkey) {\n", " const xidx = cds.data[xkey].length - 1;\n", " let xs = cds.get_array(xkey)[xidx];\n", " const nx = xs[xs.length - 1];\n", " xs[xs.length - 1] = x;\n", " if (!types_1.isArray(xs)) {\n", " xs = Array.from(xs);\n", " cds.data[xkey][xidx] = xs;\n", " }\n", " xs.push(nx);\n", " }\n", " if (ykey) {\n", " const yidx = cds.data[ykey].length - 1;\n", " let ys = cds.get_array(ykey)[yidx];\n", " const ny = ys[ys.length - 1];\n", " ys[ys.length - 1] = y;\n", " if (!types_1.isArray(ys)) {\n", " ys = Array.from(ys);\n", " cds.data[ykey][yidx] = ys;\n", " }\n", " ys.push(ny);\n", " }\n", " }\n", " this._emit_cds_changes(cds, true, false, emit);\n", " }\n", " _show_vertices() {\n", " if (!this.model.active) {\n", " return;\n", " }\n", " const xs = [];\n", " const ys = [];\n", " for (let i = 0; i < this.model.renderers.length; i++) {\n", " const renderer = this.model.renderers[i];\n", " const cds = renderer.data_source;\n", " const glyph = renderer.glyph;\n", " const [xkey, ykey] = [glyph.xs.field, glyph.ys.field];\n", " if (xkey) {\n", " for (const array of cds.get_array(xkey))\n", " Array.prototype.push.apply(xs, array);\n", " }\n", " if (ykey) {\n", " for (const array of cds.get_array(ykey))\n", " Array.prototype.push.apply(ys, array);\n", " }\n", " if (this._drawing && (i == (this.model.renderers.length - 1))) {\n", " // Skip currently drawn vertex\n", " xs.splice(xs.length - 1, 1);\n", " ys.splice(ys.length - 1, 1);\n", " }\n", " }\n", " this._set_vertices(xs, ys);\n", " }\n", " _doubletap(ev) {\n", " if (!this.model.active)\n", " return;\n", " if (this._drawing) {\n", " this._drawing = false;\n", " this._draw(ev, 'edit', true);\n", " }\n", " else {\n", " this._drawing = true;\n", " this._draw(ev, 'new', true);\n", " }\n", " }\n", " _move(ev) {\n", " if (this._drawing) {\n", " this._draw(ev, 'edit');\n", " }\n", " }\n", " _remove() {\n", " const renderer = this.model.renderers[0];\n", " const cds = renderer.data_source;\n", " const glyph = renderer.glyph;\n", " const [xkey, ykey] = [glyph.xs.field, glyph.ys.field];\n", " if (xkey) {\n", " const xidx = cds.data[xkey].length - 1;\n", " const xs = cds.get_array(xkey)[xidx];\n", " xs.splice(xs.length - 1, 1);\n", " }\n", " if (ykey) {\n", " const yidx = cds.data[ykey].length - 1;\n", " const ys = cds.get_array(ykey)[yidx];\n", " ys.splice(ys.length - 1, 1);\n", " }\n", " this._emit_cds_changes(cds);\n", " }\n", " _keyup(ev) {\n", " if (!this.model.active || !this._mouse_in_frame)\n", " return;\n", " for (const renderer of this.model.renderers) {\n", " if (ev.keyCode === dom_1.Keys.Backspace) {\n", " this._delete_selected(renderer);\n", " }\n", " else if (ev.keyCode == dom_1.Keys.Esc) {\n", " if (this._drawing) {\n", " this._remove();\n", " this._drawing = false;\n", " }\n", " renderer.data_source.selection_manager.clear();\n", " }\n", " }\n", " }\n", " _pan_start(ev) {\n", " if (!this.model.drag)\n", " return;\n", " this._select_event(ev, \"append\", this.model.renderers);\n", " this._basepoint = [ev.sx, ev.sy];\n", " }\n", " _pan(ev) {\n", " if (this._basepoint == null || !this.model.drag)\n", " return;\n", " const [bx, by] = this._basepoint;\n", " // Process polygon/line dragging\n", " for (const renderer of this.model.renderers) {\n", " const basepoint = this._map_drag(bx, by, renderer);\n", " const point = this._map_drag(ev.sx, ev.sy, renderer);\n", " if (point == null || basepoint == null)\n", " continue;\n", " const cds = renderer.data_source;\n", " // Type once dataspecs are typed\n", " const glyph = renderer.glyph;\n", " const [xkey, ykey] = [glyph.xs.field, glyph.ys.field];\n", " if (!xkey && !ykey)\n", " continue;\n", " const [x, y] = point;\n", " const [px, py] = basepoint;\n", " const [dx, dy] = [x - px, y - py];\n", " for (const index of cds.selected.indices) {\n", " let length, xs, ys;\n", " if (xkey)\n", " xs = cds.data[xkey][index];\n", " if (ykey) {\n", " ys = cds.data[ykey][index];\n", " length = ys.length;\n", " }\n", " else {\n", " length = xs.length;\n", " }\n", " for (let i = 0; i < length; i++) {\n", " if (xs)\n", " xs[i] += dx;\n", " if (ys)\n", " ys[i] += dy;\n", " }\n", " }\n", " cds.change.emit();\n", " }\n", " this._basepoint = [ev.sx, ev.sy];\n", " }\n", " _pan_end(ev) {\n", " if (!this.model.drag)\n", " return;\n", " this._pan(ev);\n", " for (const renderer of this.model.renderers)\n", " this._emit_cds_changes(renderer.data_source);\n", " this._basepoint = null;\n", " }\n", " activate() {\n", " if (!this.model.vertex_renderer || !this.model.active)\n", " return;\n", " this._show_vertices();\n", " if (!this._initialized) {\n", " for (const renderer of this.model.renderers) {\n", " const cds = renderer.data_source;\n", " cds.connect(cds.properties.data.change, () => this._show_vertices());\n", " }\n", " }\n", " this._initialized = true;\n", " }\n", " deactivate() {\n", " if (this._drawing) {\n", " this._remove();\n", " this._drawing = false;\n", " }\n", " if (this.model.vertex_renderer)\n", " this._hide_vertices();\n", " }\n", " }\n", " exports.PolyDrawToolView = PolyDrawToolView;\n", " PolyDrawToolView.__name__ = \"PolyDrawToolView\";\n", " class PolyDrawTool extends poly_tool_1.PolyTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Polygon Draw Tool\";\n", " this.icon = icons_1.bk_tool_icon_poly_draw;\n", " this.event_type = [\"pan\", \"tap\", \"move\"];\n", " this.default_order = 3;\n", " }\n", " static init_PolyDrawTool() {\n", " this.prototype.default_view = PolyDrawToolView;\n", " this.define({\n", " drag: [p.Boolean, true],\n", " num_objects: [p.Int, 0],\n", " });\n", " }\n", " }\n", " exports.PolyDrawTool = PolyDrawTool;\n", " PolyDrawTool.__name__ = \"PolyDrawTool\";\n", " PolyDrawTool.init_PolyDrawTool();\n", " },\n", " /* models/tools/edit/poly_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const types_1 = require(8) /* ../../../core/util/types */;\n", " const edit_tool_1 = require(332) /* ./edit_tool */;\n", " class PolyToolView extends edit_tool_1.EditToolView {\n", " _set_vertices(xs, ys) {\n", " const point_glyph = this.model.vertex_renderer.glyph;\n", " const point_cds = this.model.vertex_renderer.data_source;\n", " const [pxkey, pykey] = [point_glyph.x.field, point_glyph.y.field];\n", " if (pxkey) {\n", " if (types_1.isArray(xs))\n", " point_cds.data[pxkey] = xs;\n", " else\n", " point_glyph.x = { value: xs };\n", " }\n", " if (pykey) {\n", " if (types_1.isArray(ys))\n", " point_cds.data[pykey] = ys;\n", " else\n", " point_glyph.y = { value: ys };\n", " }\n", " this._emit_cds_changes(point_cds, true, true, false);\n", " }\n", " _hide_vertices() {\n", " this._set_vertices([], []);\n", " }\n", " _snap_to_vertex(ev, x, y) {\n", " if (this.model.vertex_renderer) {\n", " // If an existing vertex is hit snap to it\n", " const vertex_selected = this._select_event(ev, \"replace\", [this.model.vertex_renderer]);\n", " const point_ds = this.model.vertex_renderer.data_source;\n", " // Type once dataspecs are typed\n", " const point_glyph = this.model.vertex_renderer.glyph;\n", " const [pxkey, pykey] = [point_glyph.x.field, point_glyph.y.field];\n", " if (vertex_selected.length) {\n", " const index = point_ds.selected.indices[0];\n", " if (pxkey)\n", " x = point_ds.data[pxkey][index];\n", " if (pykey)\n", " y = point_ds.data[pykey][index];\n", " point_ds.selection_manager.clear();\n", " }\n", " }\n", " return [x, y];\n", " }\n", " }\n", " exports.PolyToolView = PolyToolView;\n", " PolyToolView.__name__ = \"PolyToolView\";\n", " class PolyTool extends edit_tool_1.EditTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_PolyTool() {\n", " this.prototype.default_view = PolyToolView;\n", " this.define({\n", " vertex_renderer: [p.Instance],\n", " });\n", " }\n", " }\n", " exports.PolyTool = PolyTool;\n", " PolyTool.__name__ = \"PolyTool\";\n", " PolyTool.init_PolyTool();\n", " },\n", " /* models/tools/edit/poly_edit_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const dom_1 = require(68) /* ../../../core/dom */;\n", " const types_1 = require(8) /* ../../../core/util/types */;\n", " const poly_tool_1 = require(337) /* ./poly_tool */;\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class PolyEditToolView extends poly_tool_1.PolyToolView {\n", " constructor() {\n", " super(...arguments);\n", " this._drawing = false;\n", " }\n", " _doubletap(ev) {\n", " if (!this.model.active)\n", " return;\n", " const point = this._map_drag(ev.sx, ev.sy, this.model.vertex_renderer);\n", " if (point == null)\n", " return;\n", " const [x, y] = point;\n", " // Perform hit testing\n", " const vertex_selected = this._select_event(ev, \"replace\", [this.model.vertex_renderer]);\n", " const point_cds = this.model.vertex_renderer.data_source;\n", " // Type once dataspecs are typed\n", " const point_glyph = this.model.vertex_renderer.glyph;\n", " const [pxkey, pykey] = [point_glyph.x.field, point_glyph.y.field];\n", " if (vertex_selected.length && this._selected_renderer != null) {\n", " // Insert a new point after the selected vertex and enter draw mode\n", " const index = point_cds.selected.indices[0];\n", " if (this._drawing) {\n", " this._drawing = false;\n", " point_cds.selection_manager.clear();\n", " }\n", " else {\n", " point_cds.selected.indices = [index + 1];\n", " if (pxkey)\n", " point_cds.get_array(pxkey).splice(index + 1, 0, x);\n", " if (pykey)\n", " point_cds.get_array(pykey).splice(index + 1, 0, y);\n", " this._drawing = true;\n", " }\n", " point_cds.change.emit();\n", " this._emit_cds_changes(this._selected_renderer.data_source);\n", " }\n", " else {\n", " this._show_vertices(ev);\n", " }\n", " }\n", " _show_vertices(ev) {\n", " if (!this.model.active)\n", " return;\n", " const renderers = this._select_event(ev, \"replace\", this.model.renderers);\n", " if (!renderers.length) {\n", " this._set_vertices([], []);\n", " this._selected_renderer = null;\n", " this._drawing = false;\n", " return;\n", " }\n", " const renderer = renderers[0];\n", " const glyph = renderer.glyph;\n", " const cds = renderer.data_source;\n", " const index = cds.selected.indices[0];\n", " const [xkey, ykey] = [glyph.xs.field, glyph.ys.field];\n", " let xs;\n", " let ys;\n", " if (xkey) {\n", " xs = cds.data[xkey][index];\n", " if (!types_1.isArray(xs))\n", " cds.data[xkey][index] = xs = Array.from(xs);\n", " }\n", " else {\n", " xs = glyph.xs.value;\n", " }\n", " if (ykey) {\n", " ys = cds.data[ykey][index];\n", " if (!types_1.isArray(ys))\n", " cds.data[ykey][index] = ys = Array.from(ys);\n", " }\n", " else {\n", " ys = glyph.ys.value;\n", " }\n", " this._selected_renderer = renderer;\n", " this._set_vertices(xs, ys);\n", " }\n", " _move(ev) {\n", " if (this._drawing && this._selected_renderer != null) {\n", " const renderer = this.model.vertex_renderer;\n", " const cds = renderer.data_source;\n", " const glyph = renderer.glyph;\n", " const point = this._map_drag(ev.sx, ev.sy, renderer);\n", " if (point == null)\n", " return;\n", " let [x, y] = point;\n", " const indices = cds.selected.indices;\n", " [x, y] = this._snap_to_vertex(ev, x, y);\n", " cds.selected.indices = indices;\n", " const [xkey, ykey] = [glyph.x.field, glyph.y.field];\n", " const index = indices[0];\n", " if (xkey)\n", " cds.data[xkey][index] = x;\n", " if (ykey)\n", " cds.data[ykey][index] = y;\n", " cds.change.emit();\n", " this._selected_renderer.data_source.change.emit();\n", " }\n", " }\n", " _tap(ev) {\n", " const renderer = this.model.vertex_renderer;\n", " const point = this._map_drag(ev.sx, ev.sy, renderer);\n", " if (point == null)\n", " return;\n", " else if (this._drawing && this._selected_renderer) {\n", " let [x, y] = point;\n", " const cds = renderer.data_source;\n", " // Type once dataspecs are typed\n", " const glyph = renderer.glyph;\n", " const [xkey, ykey] = [glyph.x.field, glyph.y.field];\n", " const indices = cds.selected.indices;\n", " [x, y] = this._snap_to_vertex(ev, x, y);\n", " const index = indices[0];\n", " cds.selected.indices = [index + 1];\n", " if (xkey) {\n", " const xs = cds.get_array(xkey);\n", " const nx = xs[index];\n", " xs[index] = x;\n", " xs.splice(index + 1, 0, nx);\n", " }\n", " if (ykey) {\n", " const ys = cds.get_array(ykey);\n", " const ny = ys[index];\n", " ys[index] = y;\n", " ys.splice(index + 1, 0, ny);\n", " }\n", " cds.change.emit();\n", " this._emit_cds_changes(this._selected_renderer.data_source, true, false, true);\n", " return;\n", " }\n", " const mode = this._select_mode(ev);\n", " this._select_event(ev, mode, [renderer]);\n", " this._select_event(ev, mode, this.model.renderers);\n", " }\n", " _remove_vertex() {\n", " if (!this._drawing || !this._selected_renderer)\n", " return;\n", " const renderer = this.model.vertex_renderer;\n", " const cds = renderer.data_source;\n", " // Type once dataspecs are typed\n", " const glyph = renderer.glyph;\n", " const index = cds.selected.indices[0];\n", " const [xkey, ykey] = [glyph.x.field, glyph.y.field];\n", " if (xkey)\n", " cds.get_array(xkey).splice(index, 1);\n", " if (ykey)\n", " cds.get_array(ykey).splice(index, 1);\n", " cds.change.emit();\n", " this._emit_cds_changes(this._selected_renderer.data_source);\n", " }\n", " _pan_start(ev) {\n", " this._select_event(ev, \"append\", [this.model.vertex_renderer]);\n", " this._basepoint = [ev.sx, ev.sy];\n", " }\n", " _pan(ev) {\n", " if (this._basepoint == null)\n", " return;\n", " this._drag_points(ev, [this.model.vertex_renderer]);\n", " if (this._selected_renderer)\n", " this._selected_renderer.data_source.change.emit();\n", " }\n", " _pan_end(ev) {\n", " if (this._basepoint == null)\n", " return;\n", " this._drag_points(ev, [this.model.vertex_renderer]);\n", " this._emit_cds_changes(this.model.vertex_renderer.data_source, false, true, true);\n", " if (this._selected_renderer) {\n", " this._emit_cds_changes(this._selected_renderer.data_source);\n", " }\n", " this._basepoint = null;\n", " }\n", " _keyup(ev) {\n", " if (!this.model.active || !this._mouse_in_frame)\n", " return;\n", " let renderers;\n", " if (this._selected_renderer) {\n", " renderers = [this.model.vertex_renderer];\n", " }\n", " else {\n", " renderers = this.model.renderers;\n", " }\n", " for (const renderer of renderers) {\n", " if (ev.keyCode === dom_1.Keys.Backspace) {\n", " this._delete_selected(renderer);\n", " if (this._selected_renderer) {\n", " this._emit_cds_changes(this._selected_renderer.data_source);\n", " }\n", " }\n", " else if (ev.keyCode == dom_1.Keys.Esc) {\n", " if (this._drawing) {\n", " this._remove_vertex();\n", " this._drawing = false;\n", " }\n", " else if (this._selected_renderer) {\n", " this._hide_vertices();\n", " }\n", " renderer.data_source.selection_manager.clear();\n", " }\n", " }\n", " }\n", " deactivate() {\n", " if (!this._selected_renderer) {\n", " return;\n", " }\n", " else if (this._drawing) {\n", " this._remove_vertex();\n", " this._drawing = false;\n", " }\n", " this._hide_vertices();\n", " }\n", " }\n", " exports.PolyEditToolView = PolyEditToolView;\n", " PolyEditToolView.__name__ = \"PolyEditToolView\";\n", " class PolyEditTool extends poly_tool_1.PolyTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Poly Edit Tool\";\n", " this.icon = icons_1.bk_tool_icon_poly_edit;\n", " this.event_type = [\"tap\", \"pan\", \"move\"];\n", " this.default_order = 4;\n", " }\n", " static init_PolyEditTool() {\n", " this.prototype.default_view = PolyEditToolView;\n", " }\n", " }\n", " exports.PolyEditTool = PolyEditTool;\n", " PolyEditTool.__name__ = \"PolyEditTool\";\n", " PolyEditTool.init_PolyEditTool();\n", " },\n", " /* models/tools/gestures/box_select_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const select_tool_1 = require(340) /* ./select_tool */;\n", " const box_annotation_1 = require(107) /* ../../annotations/box_annotation */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class BoxSelectToolView extends select_tool_1.SelectToolView {\n", " _compute_limits(curpoint) {\n", " const frame = this.plot_view.frame;\n", " const dims = this.model.dimensions;\n", " let base_point = this._base_point;\n", " if (this.model.origin == \"center\") {\n", " const [cx, cy] = base_point;\n", " const [dx, dy] = curpoint;\n", " base_point = [cx - (dx - cx), cy - (dy - cy)];\n", " }\n", " return this.model._get_dim_limits(base_point, curpoint, frame, dims);\n", " }\n", " _pan_start(ev) {\n", " const { sx, sy } = ev;\n", " this._base_point = [sx, sy];\n", " }\n", " _pan(ev) {\n", " const { sx, sy } = ev;\n", " const curpoint = [sx, sy];\n", " const [sxlim, sylim] = this._compute_limits(curpoint);\n", " this.model.overlay.update({ left: sxlim[0], right: sxlim[1], top: sylim[0], bottom: sylim[1] });\n", " if (this.model.select_every_mousemove) {\n", " this._do_select(sxlim, sylim, false, this._select_mode(ev));\n", " }\n", " }\n", " _pan_end(ev) {\n", " const { sx, sy } = ev;\n", " const curpoint = [sx, sy];\n", " const [sxlim, sylim] = this._compute_limits(curpoint);\n", " this._do_select(sxlim, sylim, true, this._select_mode(ev));\n", " this.model.overlay.update({ left: null, right: null, top: null, bottom: null });\n", " this._base_point = null;\n", " this.plot_view.push_state('box_select', { selection: this.plot_view.get_selection() });\n", " }\n", " _do_select([sx0, sx1], [sy0, sy1], final, mode = \"replace\") {\n", " const geometry = { type: 'rect', sx0, sx1, sy0, sy1 };\n", " this._select(geometry, final, mode);\n", " }\n", " }\n", " exports.BoxSelectToolView = BoxSelectToolView;\n", " BoxSelectToolView.__name__ = \"BoxSelectToolView\";\n", " const DEFAULT_BOX_OVERLAY = () => {\n", " return new box_annotation_1.BoxAnnotation({\n", " level: \"overlay\",\n", " top_units: \"screen\",\n", " left_units: \"screen\",\n", " bottom_units: \"screen\",\n", " right_units: \"screen\",\n", " fill_color: \"lightgrey\",\n", " fill_alpha: 0.5,\n", " line_color: \"black\",\n", " line_alpha: 1.0,\n", " line_width: 2,\n", " line_dash: [4, 4],\n", " });\n", " };\n", " class BoxSelectTool extends select_tool_1.SelectTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Box Select\";\n", " this.icon = icons_1.bk_tool_icon_box_select;\n", " this.event_type = \"pan\";\n", " this.default_order = 30;\n", " }\n", " static init_BoxSelectTool() {\n", " this.prototype.default_view = BoxSelectToolView;\n", " this.define({\n", " dimensions: [p.Dimensions, \"both\"],\n", " select_every_mousemove: [p.Boolean, false],\n", " overlay: [p.Instance, DEFAULT_BOX_OVERLAY],\n", " origin: [p.BoxOrigin, \"corner\"],\n", " });\n", " this.register_alias(\"box_select\", () => new BoxSelectTool());\n", " this.register_alias(\"xbox_select\", () => new BoxSelectTool({ dimensions: 'width' }));\n", " this.register_alias(\"ybox_select\", () => new BoxSelectTool({ dimensions: 'height' }));\n", " }\n", " get tooltip() {\n", " return this._get_dim_tooltip(this.tool_name, this.dimensions);\n", " }\n", " }\n", " exports.BoxSelectTool = BoxSelectTool;\n", " BoxSelectTool.__name__ = \"BoxSelectTool\";\n", " BoxSelectTool.init_BoxSelectTool();\n", " },\n", " /* models/tools/gestures/select_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const gesture_tool_1 = require(284) /* ./gesture_tool */;\n", " const glyph_renderer_1 = require(81) /* ../../renderers/glyph_renderer */;\n", " const graph_renderer_1 = require(100) /* ../../renderers/graph_renderer */;\n", " const util_1 = require(341) /* ../util */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const dom_1 = require(68) /* ../../../core/dom */;\n", " const bokeh_events_1 = require(291) /* ../../../core/bokeh_events */;\n", " const signaling_1 = require(14) /* ../../../core/signaling */;\n", " const assert_1 = require(11) /* ../../../core/util/assert */;\n", " class SelectToolView extends gesture_tool_1.GestureToolView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.model.clear.connect(() => this._clear());\n", " }\n", " get computed_renderers() {\n", " const renderers = this.model.renderers;\n", " const all_renderers = this.plot_model.renderers;\n", " const names = this.model.names;\n", " return util_1.compute_renderers(renderers, all_renderers, names);\n", " }\n", " _computed_renderers_by_data_source() {\n", " var _a;\n", " const renderers_by_source = new Map();\n", " for (const r of this.computed_renderers) {\n", " let source;\n", " if (r instanceof glyph_renderer_1.GlyphRenderer)\n", " source = r.data_source;\n", " else if (r instanceof graph_renderer_1.GraphRenderer)\n", " source = r.node_renderer.data_source;\n", " else\n", " continue;\n", " const renderers = (_a = renderers_by_source.get(source)) !== null && _a !== void 0 ? _a : [];\n", " renderers_by_source.set(source, [...renderers, r]);\n", " }\n", " return renderers_by_source;\n", " }\n", " _select_mode(ev) {\n", " const { shiftKey, ctrlKey } = ev;\n", " if (!shiftKey && !ctrlKey)\n", " return this.model.mode;\n", " else if (shiftKey && !ctrlKey)\n", " return \"append\";\n", " else if (!shiftKey && ctrlKey)\n", " return \"intersect\";\n", " else if (shiftKey && ctrlKey)\n", " return \"subtract\";\n", " else\n", " assert_1.unreachable();\n", " }\n", " _keyup(ev) {\n", " if (ev.keyCode == dom_1.Keys.Esc) {\n", " this._clear();\n", " }\n", " }\n", " _clear() {\n", " for (const renderer of this.computed_renderers) {\n", " renderer.get_selection_manager().clear();\n", " }\n", " this.plot_view.request_render();\n", " }\n", " _select(geometry, final, mode) {\n", " const renderers_by_source = this._computed_renderers_by_data_source();\n", " for (const [, renderers] of renderers_by_source) {\n", " const sm = renderers[0].get_selection_manager();\n", " const r_views = [];\n", " for (const r of renderers) {\n", " const r_view = this.plot_view.renderer_views.get(r);\n", " if (r_view != null) {\n", " r_views.push(r_view);\n", " }\n", " }\n", " sm.select(r_views, geometry, final, mode);\n", " }\n", " // XXX: messed up class structure\n", " if (this.model.callback != null)\n", " this._emit_callback(geometry);\n", " this._emit_selection_event(geometry, final);\n", " }\n", " _emit_selection_event(geometry, final = true) {\n", " const { frame } = this.plot_view;\n", " const xm = frame.xscales.default;\n", " const ym = frame.yscales.default;\n", " let geometry_data;\n", " switch (geometry.type) {\n", " case \"point\": {\n", " const { sx, sy } = geometry;\n", " const x = xm.invert(sx);\n", " const y = ym.invert(sy);\n", " geometry_data = Object.assign(Object.assign({}, geometry), { x, y });\n", " break;\n", " }\n", " case \"span\": {\n", " const { sx, sy } = geometry;\n", " const x = xm.invert(sx);\n", " const y = ym.invert(sy);\n", " geometry_data = Object.assign(Object.assign({}, geometry), { x, y });\n", " break;\n", " }\n", " case \"rect\": {\n", " const { sx0, sx1, sy0, sy1 } = geometry;\n", " const [x0, x1] = xm.r_invert(sx0, sx1);\n", " const [y0, y1] = ym.r_invert(sy0, sy1);\n", " geometry_data = Object.assign(Object.assign({}, geometry), { x0, y0, x1, y1 });\n", " break;\n", " }\n", " case \"poly\": {\n", " const { sx, sy } = geometry;\n", " const x = xm.v_invert(sx);\n", " const y = ym.v_invert(sy);\n", " geometry_data = Object.assign(Object.assign({}, geometry), { x, y });\n", " break;\n", " }\n", " }\n", " this.plot_model.trigger_event(new bokeh_events_1.SelectionGeometry(geometry_data, final));\n", " }\n", " }\n", " exports.SelectToolView = SelectToolView;\n", " SelectToolView.__name__ = \"SelectToolView\";\n", " class SelectTool extends gesture_tool_1.GestureTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.clear = new signaling_1.Signal0(this, \"clear\");\n", " }\n", " static init_SelectTool() {\n", " this.define({\n", " renderers: [p.Any, 'auto'],\n", " names: [p.Array, []],\n", " mode: [p.Any, \"replace\"],\n", " });\n", " }\n", " get menu() {\n", " return [\n", " {\n", " icon: \"bk-tool-icon-replace-mode\",\n", " tooltip: \"Replace the current selection\",\n", " active: () => this.mode == \"replace\",\n", " handler: () => {\n", " this.mode = \"replace\";\n", " this.active = true;\n", " },\n", " }, {\n", " icon: \"bk-tool-icon-append-mode\",\n", " tooltip: \"Append to the current selection (Shift)\",\n", " active: () => this.mode == \"append\",\n", " handler: () => {\n", " this.mode = \"append\";\n", " this.active = true;\n", " },\n", " }, {\n", " icon: \"bk-tool-icon-intersect-mode\",\n", " tooltip: \"Intersect with the current selection (Ctrl)\",\n", " active: () => this.mode == \"intersect\",\n", " handler: () => {\n", " this.mode = \"intersect\";\n", " this.active = true;\n", " },\n", " }, {\n", " icon: \"bk-tool-icon-subtract-mode\",\n", " tooltip: \"Subtract from the current selection (Shift+Ctrl)\",\n", " active: () => this.mode == \"subtract\",\n", " handler: () => {\n", " this.mode = \"subtract\";\n", " this.active = true;\n", " },\n", " },\n", " null,\n", " {\n", " icon: \"bk-tool-icon-clear-selection\",\n", " tooltip: \"Clear the current selection (Esc)\",\n", " handler: () => {\n", " this.clear.emit();\n", " },\n", " },\n", " ];\n", " }\n", " }\n", " exports.SelectTool = SelectTool;\n", " SelectTool.__name__ = \"SelectTool\";\n", " SelectTool.init_SelectTool();\n", " },\n", " /* models/tools/util.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " function compute_renderers(renderers, all_renderers, names) {\n", " if (renderers == null)\n", " return [];\n", " let result = renderers == 'auto' ? all_renderers : renderers;\n", " if (names.length > 0)\n", " result = result.filter((r) => array_1.includes(names, r.name));\n", " return result;\n", " }\n", " exports.compute_renderers = compute_renderers;\n", " },\n", " /* models/tools/gestures/box_zoom_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const gesture_tool_1 = require(284) /* ./gesture_tool */;\n", " const box_annotation_1 = require(107) /* ../../annotations/box_annotation */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class BoxZoomToolView extends gesture_tool_1.GestureToolView {\n", " _match_aspect(base_point, curpoint, frame) {\n", " // aspect ratio of plot frame\n", " const a = frame.bbox.aspect;\n", " const hend = frame.bbox.h_range.end;\n", " const hstart = frame.bbox.h_range.start;\n", " const vend = frame.bbox.v_range.end;\n", " const vstart = frame.bbox.v_range.start;\n", " // current aspect of cursor-defined box\n", " let vw = Math.abs(base_point[0] - curpoint[0]);\n", " let vh = Math.abs(base_point[1] - curpoint[1]);\n", " const va = vh == 0 ? 0 : vw / vh;\n", " const [xmod] = va >= a ? [1, va / a] : [a / va, 1];\n", " // OK the code blocks below merit some explanation. They do:\n", " //\n", " // compute left/right, pin to frame if necessary\n", " // compute top/bottom (based on new left/right), pin to frame if necessary\n", " // recompute left/right (based on top/bottom), in case top/bottom were pinned\n", " // base_point[0] is left\n", " let left;\n", " let right;\n", " if (base_point[0] <= curpoint[0]) {\n", " left = base_point[0];\n", " right = base_point[0] + vw * xmod;\n", " if (right > hend)\n", " right = hend;\n", " // base_point[0] is right\n", " }\n", " else {\n", " right = base_point[0];\n", " left = base_point[0] - vw * xmod;\n", " if (left < hstart)\n", " left = hstart;\n", " }\n", " vw = Math.abs(right - left);\n", " // base_point[1] is bottom\n", " let top;\n", " let bottom;\n", " if (base_point[1] <= curpoint[1]) {\n", " bottom = base_point[1];\n", " top = base_point[1] + vw / a;\n", " if (top > vend)\n", " top = vend;\n", " // base_point[1] is top\n", " }\n", " else {\n", " top = base_point[1];\n", " bottom = base_point[1] - vw / a;\n", " if (bottom < vstart)\n", " bottom = vstart;\n", " }\n", " vh = Math.abs(top - bottom);\n", " // base_point[0] is left\n", " if (base_point[0] <= curpoint[0])\n", " right = base_point[0] + a * vh;\n", " // base_point[0] is right\n", " else\n", " left = base_point[0] - a * vh;\n", " return [[left, right], [bottom, top]];\n", " }\n", " _compute_limits(curpoint) {\n", " const frame = this.plot_view.frame;\n", " const dims = this.model.dimensions;\n", " let base_point = this._base_point;\n", " if (this.model.origin == \"center\") {\n", " const [cx, cy] = base_point;\n", " const [dx, dy] = curpoint;\n", " base_point = [cx - (dx - cx), cy - (dy - cy)];\n", " }\n", " let sx;\n", " let sy;\n", " if (this.model.match_aspect && dims == 'both')\n", " [sx, sy] = this._match_aspect(base_point, curpoint, frame);\n", " else\n", " [sx, sy] = this.model._get_dim_limits(base_point, curpoint, frame, dims);\n", " return [sx, sy];\n", " }\n", " _pan_start(ev) {\n", " this._base_point = [ev.sx, ev.sy];\n", " }\n", " _pan(ev) {\n", " const curpoint = [ev.sx, ev.sy];\n", " const [sx, sy] = this._compute_limits(curpoint);\n", " this.model.overlay.update({ left: sx[0], right: sx[1], top: sy[0], bottom: sy[1] });\n", " }\n", " _pan_end(ev) {\n", " const curpoint = [ev.sx, ev.sy];\n", " const [sx, sy] = this._compute_limits(curpoint);\n", " this._update(sx, sy);\n", " this.model.overlay.update({ left: null, right: null, top: null, bottom: null });\n", " this._base_point = null;\n", " }\n", " _update([sx0, sx1], [sy0, sy1]) {\n", " // If the viewing window is too small, no-op: it is likely that the user did\n", " // not intend to make this box zoom and instead was trying to cancel out of the\n", " // zoom, a la matplotlib's ToolZoom. Like matplotlib, set the threshold at 5 pixels.\n", " if (Math.abs(sx1 - sx0) <= 5 || Math.abs(sy1 - sy0) <= 5)\n", " return;\n", " const { xscales, yscales } = this.plot_view.frame;\n", " const xrs = {};\n", " for (const name in xscales) {\n", " const scale = xscales[name];\n", " const [start, end] = scale.r_invert(sx0, sx1);\n", " xrs[name] = { start, end };\n", " }\n", " const yrs = {};\n", " for (const name in yscales) {\n", " const scale = yscales[name];\n", " const [start, end] = scale.r_invert(sy0, sy1);\n", " yrs[name] = { start, end };\n", " }\n", " const zoom_info = { xrs, yrs };\n", " this.plot_view.push_state('box_zoom', { range: zoom_info });\n", " this.plot_view.update_range(zoom_info);\n", " }\n", " }\n", " exports.BoxZoomToolView = BoxZoomToolView;\n", " BoxZoomToolView.__name__ = \"BoxZoomToolView\";\n", " const DEFAULT_BOX_OVERLAY = () => {\n", " return new box_annotation_1.BoxAnnotation({\n", " level: \"overlay\",\n", " top_units: \"screen\",\n", " left_units: \"screen\",\n", " bottom_units: \"screen\",\n", " right_units: \"screen\",\n", " fill_color: \"lightgrey\",\n", " fill_alpha: 0.5,\n", " line_color: \"black\",\n", " line_alpha: 1.0,\n", " line_width: 2,\n", " line_dash: [4, 4],\n", " });\n", " };\n", " class BoxZoomTool extends gesture_tool_1.GestureTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Box Zoom\";\n", " this.icon = icons_1.bk_tool_icon_box_zoom;\n", " this.event_type = \"pan\";\n", " this.default_order = 20;\n", " }\n", " static init_BoxZoomTool() {\n", " this.prototype.default_view = BoxZoomToolView;\n", " this.define({\n", " dimensions: [p.Dimensions, \"both\"],\n", " overlay: [p.Instance, DEFAULT_BOX_OVERLAY],\n", " match_aspect: [p.Boolean, false],\n", " origin: [p.BoxOrigin, \"corner\"],\n", " });\n", " this.register_alias(\"box_zoom\", () => new BoxZoomTool({ dimensions: 'both' }));\n", " this.register_alias(\"xbox_zoom\", () => new BoxZoomTool({ dimensions: 'width' }));\n", " this.register_alias(\"ybox_zoom\", () => new BoxZoomTool({ dimensions: 'height' }));\n", " }\n", " get tooltip() {\n", " return this._get_dim_tooltip(this.tool_name, this.dimensions);\n", " }\n", " }\n", " exports.BoxZoomTool = BoxZoomTool;\n", " BoxZoomTool.__name__ = \"BoxZoomTool\";\n", " BoxZoomTool.init_BoxZoomTool();\n", " },\n", " /* models/tools/gestures/lasso_select_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const select_tool_1 = require(340) /* ./select_tool */;\n", " const poly_annotation_1 = require(139) /* ../../annotations/poly_annotation */;\n", " const dom_1 = require(68) /* ../../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class LassoSelectToolView extends select_tool_1.SelectToolView {\n", " initialize() {\n", " super.initialize();\n", " this.data = null;\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.active.change, () => this._active_change());\n", " }\n", " _active_change() {\n", " if (!this.model.active)\n", " this._clear_overlay();\n", " }\n", " _keyup(ev) {\n", " if (ev.keyCode == dom_1.Keys.Enter)\n", " this._clear_overlay();\n", " }\n", " _pan_start(ev) {\n", " const { sx, sy } = ev;\n", " this.data = { sx: [sx], sy: [sy] };\n", " }\n", " _pan(ev) {\n", " const { sx: _sx, sy: _sy } = ev;\n", " const [sx, sy] = this.plot_view.frame.bbox.clip(_sx, _sy);\n", " this.data.sx.push(sx);\n", " this.data.sy.push(sy);\n", " const overlay = this.model.overlay;\n", " overlay.update({ xs: this.data.sx, ys: this.data.sy });\n", " if (this.model.select_every_mousemove) {\n", " this._do_select(this.data.sx, this.data.sy, false, this._select_mode(ev));\n", " }\n", " }\n", " _pan_end(ev) {\n", " this._clear_overlay();\n", " this._do_select(this.data.sx, this.data.sy, true, this._select_mode(ev));\n", " this.plot_view.push_state('lasso_select', { selection: this.plot_view.get_selection() });\n", " }\n", " _clear_overlay() {\n", " this.model.overlay.update({ xs: [], ys: [] });\n", " }\n", " _do_select(sx, sy, final, mode) {\n", " const geometry = { type: 'poly', sx, sy };\n", " this._select(geometry, final, mode);\n", " }\n", " }\n", " exports.LassoSelectToolView = LassoSelectToolView;\n", " LassoSelectToolView.__name__ = \"LassoSelectToolView\";\n", " const DEFAULT_POLY_OVERLAY = () => {\n", " return new poly_annotation_1.PolyAnnotation({\n", " level: \"overlay\",\n", " xs_units: \"screen\",\n", " ys_units: \"screen\",\n", " fill_color: \"lightgrey\",\n", " fill_alpha: 0.5,\n", " line_color: \"black\",\n", " line_alpha: 1.0,\n", " line_width: 2,\n", " line_dash: [4, 4],\n", " });\n", " };\n", " class LassoSelectTool extends select_tool_1.SelectTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Lasso Select\";\n", " this.icon = icons_1.bk_tool_icon_lasso_select;\n", " this.event_type = \"pan\";\n", " this.default_order = 12;\n", " }\n", " static init_LassoSelectTool() {\n", " this.prototype.default_view = LassoSelectToolView;\n", " this.define({\n", " select_every_mousemove: [p.Boolean, true],\n", " overlay: [p.Instance, DEFAULT_POLY_OVERLAY],\n", " });\n", " this.register_alias(\"lasso_select\", () => new LassoSelectTool());\n", " }\n", " }\n", " exports.LassoSelectTool = LassoSelectTool;\n", " LassoSelectTool.__name__ = \"LassoSelectTool\";\n", " LassoSelectTool.init_LassoSelectTool();\n", " },\n", " /* models/tools/edit/line_edit_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const line_tool_1 = require(345) /* ./line_tool */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class LineEditToolView extends line_tool_1.LineToolView {\n", " constructor() {\n", " super(...arguments);\n", " this._drawing = false;\n", " }\n", " _doubletap(ev) {\n", " if (!this.model.active)\n", " return;\n", " const renderers = this.model.renderers;\n", " for (const renderer of renderers) {\n", " const line_selected = this._select_event(ev, \"replace\", [renderer]);\n", " if (line_selected.length == 1) {\n", " this._selected_renderer = renderer;\n", " }\n", " }\n", " this._show_intersections();\n", " this._update_line_cds();\n", " }\n", " _show_intersections() {\n", " if (!this.model.active)\n", " return;\n", " if (this._selected_renderer == null)\n", " return;\n", " const renderers = this.model.renderers;\n", " if (!renderers.length) {\n", " this._set_intersection([], []);\n", " this._selected_renderer = null;\n", " this._drawing = false;\n", " return;\n", " }\n", " const cds = this._selected_renderer.data_source;\n", " const glyph = this._selected_renderer.glyph;\n", " const [xkey, ykey] = [glyph.x.field, glyph.y.field];\n", " const x = cds.get_array(xkey);\n", " const y = cds.get_array(ykey);\n", " this._set_intersection(x, y);\n", " }\n", " _tap(ev) {\n", " const renderer = this.model.intersection_renderer;\n", " const point = this._map_drag(ev.sx, ev.sy, renderer);\n", " if (point == null)\n", " return;\n", " else if (this._drawing && this._selected_renderer) {\n", " const mode = this._select_mode(ev);\n", " const selected_points = this._select_event(ev, mode, [renderer]);\n", " if (selected_points.length == 0) {\n", " return;\n", " }\n", " }\n", " const mode = this._select_mode(ev);\n", " this._select_event(ev, mode, [renderer]);\n", " this._select_event(ev, mode, this.model.renderers);\n", " }\n", " _update_line_cds() {\n", " if (this._selected_renderer == null)\n", " return;\n", " const point_glyph = this.model.intersection_renderer.glyph;\n", " const point_cds = this.model.intersection_renderer.data_source;\n", " const [pxkey, pykey] = [point_glyph.x.field, point_glyph.y.field];\n", " if (pxkey && pykey) {\n", " const x = point_cds.data[pxkey];\n", " const y = point_cds.data[pykey];\n", " this._selected_renderer.data_source.data[pxkey] = x;\n", " this._selected_renderer.data_source.data[pykey] = y;\n", " }\n", " this._emit_cds_changes(this._selected_renderer.data_source, true, true, false);\n", " }\n", " _pan_start(ev) {\n", " this._select_event(ev, \"append\", [this.model.intersection_renderer]);\n", " this._basepoint = [ev.sx, ev.sy];\n", " }\n", " _pan(ev) {\n", " if (this._basepoint == null)\n", " return;\n", " this._drag_points(ev, [this.model.intersection_renderer], this.model.dimensions);\n", " if (this._selected_renderer)\n", " this._selected_renderer.data_source.change.emit();\n", " }\n", " _pan_end(ev) {\n", " if (this._basepoint == null)\n", " return;\n", " this._drag_points(ev, [this.model.intersection_renderer]);\n", " this._emit_cds_changes(this.model.intersection_renderer.data_source, false, true, true);\n", " if (this._selected_renderer) {\n", " this._emit_cds_changes(this._selected_renderer.data_source);\n", " }\n", " this._basepoint = null;\n", " }\n", " activate() {\n", " this._drawing = true;\n", " }\n", " deactivate() {\n", " if (!this._selected_renderer) {\n", " return;\n", " }\n", " else if (this._drawing) {\n", " this._drawing = false;\n", " }\n", " this._hide_intersections();\n", " }\n", " }\n", " exports.LineEditToolView = LineEditToolView;\n", " LineEditToolView.__name__ = \"LineEditToolView\";\n", " class LineEditTool extends line_tool_1.LineTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Line Edit Tool\";\n", " this.icon = icons_1.bk_tool_icon_line_edit;\n", " this.event_type = [\"tap\", \"pan\", \"move\"];\n", " this.default_order = 4;\n", " }\n", " static init_LineEditTool() {\n", " this.prototype.default_view = LineEditToolView;\n", " this.define({\n", " dimensions: [p.Dimensions, \"both\"],\n", " });\n", " }\n", " get tooltip() {\n", " return this._get_dim_tooltip(this.tool_name, this.dimensions);\n", " }\n", " }\n", " exports.LineEditTool = LineEditTool;\n", " LineEditTool.__name__ = \"LineEditTool\";\n", " LineEditTool.init_LineEditTool();\n", " },\n", " /* models/tools/edit/line_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const types_1 = require(8) /* ../../../core/util/types */;\n", " const edit_tool_1 = require(332) /* ./edit_tool */;\n", " class LineToolView extends edit_tool_1.EditToolView {\n", " _set_intersection(x, y) {\n", " const point_glyph = this.model.intersection_renderer.glyph;\n", " const point_cds = this.model.intersection_renderer.data_source;\n", " const [pxkey, pykey] = [point_glyph.x.field, point_glyph.y.field];\n", " if (pxkey) {\n", " if (types_1.isArray(x))\n", " point_cds.data[pxkey] = x;\n", " else\n", " point_glyph.x = { value: x };\n", " }\n", " if (pykey) {\n", " if (types_1.isArray(y))\n", " point_cds.data[pykey] = y;\n", " else\n", " point_glyph.y = { value: y };\n", " }\n", " this._emit_cds_changes(point_cds, true, true, false);\n", " }\n", " _hide_intersections() {\n", " this._set_intersection([], []);\n", " }\n", " }\n", " exports.LineToolView = LineToolView;\n", " LineToolView.__name__ = \"LineToolView\";\n", " class LineTool extends edit_tool_1.EditTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_LineTool() {\n", " this.prototype.default_view = LineToolView;\n", " this.define({\n", " intersection_renderer: [p.Instance],\n", " });\n", " }\n", " }\n", " exports.LineTool = LineTool;\n", " LineTool.__name__ = \"LineTool\";\n", " LineTool.init_LineTool();\n", " },\n", " /* models/tools/gestures/pan_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const gesture_tool_1 = require(284) /* ./gesture_tool */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class PanToolView extends gesture_tool_1.GestureToolView {\n", " _pan_start(ev) {\n", " this.last_dx = 0;\n", " this.last_dy = 0;\n", " const { sx, sy } = ev;\n", " const bbox = this.plot_view.frame.bbox;\n", " if (!bbox.contains(sx, sy)) {\n", " const hr = bbox.h_range;\n", " const vr = bbox.v_range;\n", " if (sx < hr.start || sx > hr.end)\n", " this.v_axis_only = true;\n", " if (sy < vr.start || sy > vr.end)\n", " this.h_axis_only = true;\n", " }\n", " if (this.model.document != null)\n", " this.model.document.interactive_start(this.plot_model);\n", " }\n", " _pan(ev) {\n", " this._update(ev.deltaX, ev.deltaY);\n", " if (this.model.document != null)\n", " this.model.document.interactive_start(this.plot_model);\n", " }\n", " _pan_end(_e) {\n", " this.h_axis_only = false;\n", " this.v_axis_only = false;\n", " if (this.pan_info != null)\n", " this.plot_view.push_state('pan', { range: this.pan_info });\n", " }\n", " _update(dx, dy) {\n", " const frame = this.plot_view.frame;\n", " const new_dx = dx - this.last_dx;\n", " const new_dy = dy - this.last_dy;\n", " const hr = frame.bbox.h_range;\n", " const sx_low = hr.start - new_dx;\n", " const sx_high = hr.end - new_dx;\n", " const vr = frame.bbox.v_range;\n", " const sy_low = vr.start - new_dy;\n", " const sy_high = vr.end - new_dy;\n", " const dims = this.model.dimensions;\n", " let sx0;\n", " let sx1;\n", " let sdx;\n", " if ((dims == 'width' || dims == 'both') && !this.v_axis_only) {\n", " sx0 = sx_low;\n", " sx1 = sx_high;\n", " sdx = -new_dx;\n", " }\n", " else {\n", " sx0 = hr.start;\n", " sx1 = hr.end;\n", " sdx = 0;\n", " }\n", " let sy0;\n", " let sy1;\n", " let sdy;\n", " if ((dims == 'height' || dims == 'both') && !this.h_axis_only) {\n", " sy0 = sy_low;\n", " sy1 = sy_high;\n", " sdy = -new_dy;\n", " }\n", " else {\n", " sy0 = vr.start;\n", " sy1 = vr.end;\n", " sdy = 0;\n", " }\n", " this.last_dx = dx;\n", " this.last_dy = dy;\n", " const { xscales, yscales } = frame;\n", " const xrs = {};\n", " for (const name in xscales) {\n", " const scale = xscales[name];\n", " const [start, end] = scale.r_invert(sx0, sx1);\n", " xrs[name] = { start, end };\n", " }\n", " const yrs = {};\n", " for (const name in yscales) {\n", " const scale = yscales[name];\n", " const [start, end] = scale.r_invert(sy0, sy1);\n", " yrs[name] = { start, end };\n", " }\n", " this.pan_info = { xrs, yrs, sdx, sdy };\n", " this.plot_view.update_range(this.pan_info, true);\n", " }\n", " }\n", " exports.PanToolView = PanToolView;\n", " PanToolView.__name__ = \"PanToolView\";\n", " class PanTool extends gesture_tool_1.GestureTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Pan\";\n", " this.event_type = \"pan\";\n", " this.default_order = 10;\n", " }\n", " static init_PanTool() {\n", " this.prototype.default_view = PanToolView;\n", " this.define({\n", " dimensions: [p.Dimensions, \"both\"],\n", " });\n", " this.register_alias(\"pan\", () => new PanTool({ dimensions: 'both' }));\n", " this.register_alias(\"xpan\", () => new PanTool({ dimensions: 'width' }));\n", " this.register_alias(\"ypan\", () => new PanTool({ dimensions: 'height' }));\n", " }\n", " get tooltip() {\n", " return this._get_dim_tooltip(\"Pan\", this.dimensions);\n", " }\n", " get icon() {\n", " switch (this.dimensions) {\n", " case \"both\": return icons_1.bk_tool_icon_pan;\n", " case \"width\": return icons_1.bk_tool_icon_xpan;\n", " case \"height\": return icons_1.bk_tool_icon_ypan;\n", " }\n", " }\n", " }\n", " exports.PanTool = PanTool;\n", " PanTool.__name__ = \"PanTool\";\n", " PanTool.init_PanTool();\n", " },\n", " /* models/tools/gestures/poly_select_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const select_tool_1 = require(340) /* ./select_tool */;\n", " const poly_annotation_1 = require(139) /* ../../annotations/poly_annotation */;\n", " const dom_1 = require(68) /* ../../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const array_1 = require(9) /* ../../../core/util/array */;\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class PolySelectToolView extends select_tool_1.SelectToolView {\n", " initialize() {\n", " super.initialize();\n", " this.data = { sx: [], sy: [] };\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.active.change, () => this._active_change());\n", " }\n", " _active_change() {\n", " if (!this.model.active)\n", " this._clear_data();\n", " }\n", " _keyup(ev) {\n", " if (ev.keyCode == dom_1.Keys.Enter)\n", " this._clear_data();\n", " }\n", " _doubletap(ev) {\n", " this._do_select(this.data.sx, this.data.sy, true, this._select_mode(ev));\n", " this.plot_view.push_state('poly_select', { selection: this.plot_view.get_selection() });\n", " this._clear_data();\n", " }\n", " _clear_data() {\n", " this.data = { sx: [], sy: [] };\n", " this.model.overlay.update({ xs: [], ys: [] });\n", " }\n", " _tap(ev) {\n", " const { sx, sy } = ev;\n", " const frame = this.plot_view.frame;\n", " if (!frame.bbox.contains(sx, sy))\n", " return;\n", " this.data.sx.push(sx);\n", " this.data.sy.push(sy);\n", " this.model.overlay.update({ xs: array_1.copy(this.data.sx), ys: array_1.copy(this.data.sy) });\n", " }\n", " _do_select(sx, sy, final, mode) {\n", " const geometry = { type: 'poly', sx, sy };\n", " this._select(geometry, final, mode);\n", " }\n", " }\n", " exports.PolySelectToolView = PolySelectToolView;\n", " PolySelectToolView.__name__ = \"PolySelectToolView\";\n", " const DEFAULT_POLY_OVERLAY = () => {\n", " return new poly_annotation_1.PolyAnnotation({\n", " level: \"overlay\",\n", " xs_units: \"screen\",\n", " ys_units: \"screen\",\n", " fill_color: \"lightgrey\",\n", " fill_alpha: 0.5,\n", " line_color: \"black\",\n", " line_alpha: 1.0,\n", " line_width: 2,\n", " line_dash: [4, 4],\n", " });\n", " };\n", " class PolySelectTool extends select_tool_1.SelectTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Poly Select\";\n", " this.icon = icons_1.bk_tool_icon_polygon_select;\n", " this.event_type = \"tap\";\n", " this.default_order = 11;\n", " }\n", " static init_PolySelectTool() {\n", " this.prototype.default_view = PolySelectToolView;\n", " this.define({\n", " overlay: [p.Instance, DEFAULT_POLY_OVERLAY],\n", " });\n", " this.register_alias(\"poly_select\", () => new PolySelectTool());\n", " }\n", " }\n", " exports.PolySelectTool = PolySelectTool;\n", " PolySelectTool.__name__ = \"PolySelectTool\";\n", " PolySelectTool.init_PolySelectTool();\n", " },\n", " /* models/tools/gestures/range_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const box_annotation_1 = require(107) /* ../../annotations/box_annotation */;\n", " const logging_1 = require(72) /* ../../../core/logging */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const gesture_tool_1 = require(284) /* ./gesture_tool */;\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " function flip_side(side) {\n", " switch (side) {\n", " case 1 /* Left */: return 2 /* Right */;\n", " case 2 /* Right */: return 1 /* Left */;\n", " case 4 /* Bottom */: return 5 /* Top */;\n", " case 5 /* Top */: return 4 /* Bottom */;\n", " default: return side;\n", " }\n", " }\n", " exports.flip_side = flip_side;\n", " // TODO (bev) This would be better directly with BoxAnnotation, but hard\n", " // to test on a view. Move when \"View Models\" are implemented\n", " function is_near(pos, value, scale, tolerance) {\n", " if (value == null)\n", " return false;\n", " const svalue = scale.compute(value);\n", " return Math.abs(pos - svalue) < tolerance;\n", " }\n", " exports.is_near = is_near;\n", " // TODO (bev) This would be better directly with BoxAnnotation, but hard\n", " // to test on a view. Move when \"View Models\" are implemented\n", " function is_inside(sx, sy, xscale, yscale, overlay) {\n", " let result = true;\n", " if (overlay.left != null && overlay.right != null) {\n", " const x = xscale.invert(sx);\n", " if (x < overlay.left || x > overlay.right)\n", " result = false;\n", " }\n", " if (overlay.bottom != null && overlay.top != null) {\n", " const y = yscale.invert(sy);\n", " if (y < overlay.bottom || y > overlay.top)\n", " result = false;\n", " }\n", " return result;\n", " }\n", " exports.is_inside = is_inside;\n", " function sides_inside(start, end, range) {\n", " let result = 0;\n", " if (start >= range.start && start <= range.end)\n", " result += 1;\n", " if (end >= range.start && end <= range.end)\n", " result += 1;\n", " return result;\n", " }\n", " exports.sides_inside = sides_inside;\n", " function compute_value(value, scale, sdelta, range) {\n", " const svalue = scale.compute(value);\n", " const new_value = scale.invert(svalue + sdelta);\n", " if (new_value >= range.start && new_value <= range.end)\n", " return new_value;\n", " return value;\n", " }\n", " exports.compute_value = compute_value;\n", " function update_range_end_side(end, range, side) {\n", " if (end > range.start) {\n", " range.end = end;\n", " return side;\n", " }\n", " else {\n", " range.end = range.start;\n", " range.start = end;\n", " return flip_side(side);\n", " }\n", " }\n", " exports.update_range_end_side = update_range_end_side;\n", " function update_range_start_side(start, range, side) {\n", " if (start < range.end) {\n", " range.start = start;\n", " return side;\n", " }\n", " else {\n", " range.start = range.end;\n", " range.end = start;\n", " return flip_side(side);\n", " }\n", " }\n", " exports.update_range_start_side = update_range_start_side;\n", " function update_range(range, scale, delta, plot_range) {\n", " const [sstart, send] = scale.r_compute(range.start, range.end);\n", " const [start, end] = scale.r_invert(sstart + delta, send + delta);\n", " const initial_sides_inside = sides_inside(range.start, range.end, plot_range);\n", " const final_sides_inside = sides_inside(start, end, plot_range);\n", " // Allow the update as long as the number of sides in-bounds does not decrease\n", " if (final_sides_inside >= initial_sides_inside) {\n", " range.start = start;\n", " range.end = end;\n", " }\n", " }\n", " exports.update_range = update_range;\n", " class RangeToolView extends gesture_tool_1.GestureToolView {\n", " initialize() {\n", " super.initialize();\n", " this.side = 0 /* None */;\n", " this.model.update_overlay_from_ranges();\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " if (this.model.x_range != null)\n", " this.connect(this.model.x_range.change, () => this.model.update_overlay_from_ranges());\n", " if (this.model.y_range != null)\n", " this.connect(this.model.y_range.change, () => this.model.update_overlay_from_ranges());\n", " }\n", " _pan_start(ev) {\n", " this.last_dx = 0;\n", " this.last_dy = 0;\n", " const xr = this.model.x_range;\n", " const yr = this.model.y_range;\n", " const frame = this.plot_view.frame;\n", " const xscale = frame.xscales.default;\n", " const yscale = frame.yscales.default;\n", " const overlay = this.model.overlay;\n", " const { left, right, top, bottom } = overlay;\n", " const tolerance = this.model.overlay.properties.line_width.value() + box_annotation_1.EDGE_TOLERANCE;\n", " if (xr != null && this.model.x_interaction) {\n", " if (is_near(ev.sx, left, xscale, tolerance))\n", " this.side = 1 /* Left */;\n", " else if (is_near(ev.sx, right, xscale, tolerance))\n", " this.side = 2 /* Right */;\n", " else if (is_inside(ev.sx, ev.sy, xscale, yscale, overlay)) {\n", " this.side = 3 /* LeftRight */;\n", " }\n", " }\n", " if (yr != null && this.model.y_interaction) {\n", " if (this.side == 0 /* None */ && is_near(ev.sy, bottom, yscale, tolerance))\n", " this.side = 4 /* Bottom */;\n", " if (this.side == 0 /* None */ && is_near(ev.sy, top, yscale, tolerance))\n", " this.side = 5 /* Top */;\n", " else if (is_inside(ev.sx, ev.sy, xscale, yscale, this.model.overlay)) {\n", " if (this.side == 3 /* LeftRight */)\n", " this.side = 7 /* LeftRightBottomTop */;\n", " else\n", " this.side = 6 /* BottomTop */;\n", " }\n", " }\n", " }\n", " _pan(ev) {\n", " const frame = this.plot_view.frame;\n", " const new_dx = ev.deltaX - this.last_dx;\n", " const new_dy = ev.deltaY - this.last_dy;\n", " const xr = this.model.x_range;\n", " const yr = this.model.y_range;\n", " const xscale = frame.xscales.default;\n", " const yscale = frame.yscales.default;\n", " if (xr != null) {\n", " if (this.side == 3 /* LeftRight */ || this.side == 7 /* LeftRightBottomTop */)\n", " update_range(xr, xscale, new_dx, frame.x_range);\n", " else if (this.side == 1 /* Left */) {\n", " const start = compute_value(xr.start, xscale, new_dx, frame.x_range);\n", " this.side = update_range_start_side(start, xr, this.side);\n", " }\n", " else if (this.side == 2 /* Right */) {\n", " const end = compute_value(xr.end, xscale, new_dx, frame.x_range);\n", " this.side = update_range_end_side(end, xr, this.side);\n", " }\n", " }\n", " if (yr != null) {\n", " if (this.side == 6 /* BottomTop */ || this.side == 7 /* LeftRightBottomTop */)\n", " update_range(yr, yscale, new_dy, frame.y_range);\n", " else if (this.side == 4 /* Bottom */) {\n", " const start = compute_value(yr.start, yscale, new_dy, frame.y_range);\n", " this.side = update_range_start_side(start, yr, this.side);\n", " }\n", " else if (this.side == 5 /* Top */) {\n", " const end = compute_value(yr.end, yscale, new_dy, frame.y_range);\n", " this.side = update_range_end_side(end, yr, this.side);\n", " }\n", " }\n", " this.last_dx = ev.deltaX;\n", " this.last_dy = ev.deltaY;\n", " }\n", " _pan_end(_ev) {\n", " this.side = 0 /* None */;\n", " }\n", " }\n", " exports.RangeToolView = RangeToolView;\n", " RangeToolView.__name__ = \"RangeToolView\";\n", " const DEFAULT_RANGE_OVERLAY = () => {\n", " return new box_annotation_1.BoxAnnotation({\n", " level: \"overlay\",\n", " fill_color: \"lightgrey\",\n", " fill_alpha: 0.5,\n", " line_color: \"black\",\n", " line_alpha: 1.0,\n", " line_width: 0.5,\n", " line_dash: [2, 2],\n", " });\n", " };\n", " class RangeTool extends gesture_tool_1.GestureTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Range Tool\";\n", " this.icon = icons_1.bk_tool_icon_range;\n", " this.event_type = \"pan\";\n", " this.default_order = 1;\n", " }\n", " static init_RangeTool() {\n", " this.prototype.default_view = RangeToolView;\n", " this.define({\n", " x_range: [p.Instance, null],\n", " x_interaction: [p.Boolean, true],\n", " y_range: [p.Instance, null],\n", " y_interaction: [p.Boolean, true],\n", " overlay: [p.Instance, DEFAULT_RANGE_OVERLAY],\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.overlay.in_cursor = \"grab\";\n", " this.overlay.ew_cursor = this.x_range != null && this.x_interaction ? \"ew-resize\" : null;\n", " this.overlay.ns_cursor = this.y_range != null && this.y_interaction ? \"ns-resize\" : null;\n", " }\n", " update_overlay_from_ranges() {\n", " if (this.x_range == null && this.y_range == null) {\n", " this.overlay.left = null;\n", " this.overlay.right = null;\n", " this.overlay.bottom = null;\n", " this.overlay.top = null;\n", " logging_1.logger.warn('RangeTool not configured with any Ranges.');\n", " }\n", " if (this.x_range == null) {\n", " this.overlay.left = null;\n", " this.overlay.right = null;\n", " }\n", " else {\n", " this.overlay.left = this.x_range.start;\n", " this.overlay.right = this.x_range.end;\n", " }\n", " if (this.y_range == null) {\n", " this.overlay.bottom = null;\n", " this.overlay.top = null;\n", " }\n", " else {\n", " this.overlay.bottom = this.y_range.start;\n", " this.overlay.top = this.y_range.end;\n", " }\n", " }\n", " }\n", " exports.RangeTool = RangeTool;\n", " RangeTool.__name__ = \"RangeTool\";\n", " RangeTool.init_RangeTool();\n", " },\n", " /* models/tools/gestures/tap_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const select_tool_1 = require(340) /* ./select_tool */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class TapToolView extends select_tool_1.SelectToolView {\n", " _tap(ev) {\n", " const { sx, sy } = ev;\n", " const geometry = { type: \"point\", sx, sy };\n", " this._select(geometry, true, this._select_mode(ev));\n", " }\n", " _select(geometry, final, mode) {\n", " const callback = this.model.callback;\n", " if (this.model.behavior == \"select\") {\n", " const renderers_by_source = this._computed_renderers_by_data_source();\n", " for (const [, renderers] of renderers_by_source) {\n", " const sm = renderers[0].get_selection_manager();\n", " const r_views = renderers.map((r) => this.plot_view.renderer_views.get(r));\n", " const did_hit = sm.select(r_views, geometry, final, mode);\n", " if (did_hit && callback != null) {\n", " const { frame } = this.plot_view;\n", " const xscale = frame.xscales[renderers[0].x_range_name];\n", " const yscale = frame.yscales[renderers[0].y_range_name];\n", " const x = xscale.invert(geometry.sx);\n", " const y = yscale.invert(geometry.sy);\n", " const data = { geometries: Object.assign(Object.assign({}, geometry), { x, y }), source: sm.source };\n", " callback.execute(this.model, data);\n", " }\n", " }\n", " this._emit_selection_event(geometry);\n", " this.plot_view.push_state('tap', { selection: this.plot_view.get_selection() });\n", " }\n", " else {\n", " for (const r of this.computed_renderers) {\n", " const sm = r.get_selection_manager();\n", " const did_hit = sm.inspect(this.plot_view.renderer_views.get(r), geometry);\n", " if (did_hit && callback != null) {\n", " const { frame } = this.plot_view;\n", " const xscale = frame.xscales[r.x_range_name];\n", " const yscale = frame.yscales[r.y_range_name];\n", " const x = xscale.invert(geometry.sx);\n", " const y = yscale.invert(geometry.sy);\n", " const data = { geometries: Object.assign(Object.assign({}, geometry), { x, y }), source: sm.source };\n", " callback.execute(this.model, data);\n", " }\n", " }\n", " }\n", " }\n", " }\n", " exports.TapToolView = TapToolView;\n", " TapToolView.__name__ = \"TapToolView\";\n", " class TapTool extends select_tool_1.SelectTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Tap\";\n", " this.icon = icons_1.bk_tool_icon_tap_select;\n", " this.event_type = \"tap\";\n", " this.default_order = 10;\n", " }\n", " static init_TapTool() {\n", " this.prototype.default_view = TapToolView;\n", " this.define({\n", " behavior: [p.TapBehavior, \"select\"],\n", " callback: [p.Any],\n", " });\n", " this.register_alias(\"click\", () => new TapTool({ behavior: \"inspect\" }));\n", " this.register_alias(\"tap\", () => new TapTool());\n", " }\n", " }\n", " exports.TapTool = TapTool;\n", " TapTool.__name__ = \"TapTool\";\n", " TapTool.init_TapTool();\n", " },\n", " /* models/tools/gestures/wheel_pan_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const gesture_tool_1 = require(284) /* ./gesture_tool */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class WheelPanToolView extends gesture_tool_1.GestureToolView {\n", " _scroll(ev) {\n", " let factor = this.model.speed * ev.delta;\n", " // clamp the magnitude of factor, if it is > 1 bad things happen\n", " if (factor > 0.9)\n", " factor = 0.9;\n", " else if (factor < -0.9)\n", " factor = -0.9;\n", " this._update_ranges(factor);\n", " }\n", " _update_ranges(factor) {\n", " const { frame } = this.plot_view;\n", " const hr = frame.bbox.h_range;\n", " const vr = frame.bbox.v_range;\n", " const [sx_low, sx_high] = [hr.start, hr.end];\n", " const [sy_low, sy_high] = [vr.start, vr.end];\n", " let sx0;\n", " let sx1;\n", " let sy0;\n", " let sy1;\n", " switch (this.model.dimension) {\n", " case \"height\": {\n", " const sy_range = Math.abs(sy_high - sy_low);\n", " sx0 = sx_low;\n", " sx1 = sx_high;\n", " sy0 = sy_low - sy_range * factor;\n", " sy1 = sy_high - sy_range * factor;\n", " break;\n", " }\n", " case \"width\": {\n", " const sx_range = Math.abs(sx_high - sx_low);\n", " sx0 = sx_low - sx_range * factor;\n", " sx1 = sx_high - sx_range * factor;\n", " sy0 = sy_low;\n", " sy1 = sy_high;\n", " break;\n", " }\n", " default:\n", " throw new Error(\"this shouldn't have happened\");\n", " }\n", " const { xscales, yscales } = frame;\n", " const xrs = {};\n", " for (const name in xscales) {\n", " const scale = xscales[name];\n", " const [start, end] = scale.r_invert(sx0, sx1);\n", " xrs[name] = { start, end };\n", " }\n", " const yrs = {};\n", " for (const name in yscales) {\n", " const scale = yscales[name];\n", " const [start, end] = scale.r_invert(sy0, sy1);\n", " yrs[name] = { start, end };\n", " }\n", " // OK this sucks we can't set factor independently in each direction. It is used\n", " // for GMap plots, and GMap plots always preserve aspect, so effective the value\n", " // of 'dimensions' is ignored.\n", " const pan_info = { xrs, yrs, factor };\n", " this.plot_view.push_state('wheel_pan', { range: pan_info });\n", " this.plot_view.update_range(pan_info, false, true);\n", " if (this.model.document != null)\n", " this.model.document.interactive_start(this.plot_model);\n", " }\n", " }\n", " exports.WheelPanToolView = WheelPanToolView;\n", " WheelPanToolView.__name__ = \"WheelPanToolView\";\n", " class WheelPanTool extends gesture_tool_1.GestureTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Wheel Pan\";\n", " this.icon = icons_1.bk_tool_icon_wheel_pan;\n", " this.event_type = \"scroll\";\n", " this.default_order = 12;\n", " }\n", " static init_WheelPanTool() {\n", " this.prototype.default_view = WheelPanToolView;\n", " this.define({\n", " dimension: [p.Dimension, \"width\"],\n", " });\n", " this.internal({\n", " speed: [p.Number, 1 / 1000],\n", " });\n", " this.register_alias(\"xwheel_pan\", () => new WheelPanTool({ dimension: \"width\" }));\n", " this.register_alias(\"ywheel_pan\", () => new WheelPanTool({ dimension: \"height\" }));\n", " }\n", " get tooltip() {\n", " return this._get_dim_tooltip(this.tool_name, this.dimension);\n", " }\n", " }\n", " exports.WheelPanTool = WheelPanTool;\n", " WheelPanTool.__name__ = \"WheelPanTool\";\n", " WheelPanTool.init_WheelPanTool();\n", " },\n", " /* models/tools/gestures/wheel_zoom_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const gesture_tool_1 = require(284) /* ./gesture_tool */;\n", " const zoom_1 = require(330) /* ../../../core/util/zoom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const compat_1 = require(28) /* ../../../core/util/compat */;\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class WheelZoomToolView extends gesture_tool_1.GestureToolView {\n", " _pinch(ev) {\n", " // TODO (bev) this can probably be done much better\n", " const { sx, sy, scale, ctrlKey, shiftKey } = ev;\n", " let delta;\n", " if (scale >= 1)\n", " delta = (scale - 1) * 20.0;\n", " else\n", " delta = -20.0 / scale;\n", " this._scroll({ type: \"wheel\", sx, sy, delta, ctrlKey, shiftKey });\n", " }\n", " _scroll(ev) {\n", " const { frame } = this.plot_view;\n", " const hr = frame.bbox.h_range;\n", " const vr = frame.bbox.v_range;\n", " const { sx, sy } = ev;\n", " const dims = this.model.dimensions;\n", " // restrict to axis configured in tool's dimensions property and if\n", " // zoom origin is inside of frame range/domain\n", " const h_axis = (dims == 'width' || dims == 'both') && hr.start < sx && sx < hr.end;\n", " const v_axis = (dims == 'height' || dims == 'both') && vr.start < sy && sy < vr.end;\n", " if ((!h_axis || !v_axis) && !this.model.zoom_on_axis) {\n", " return;\n", " }\n", " const factor = this.model.speed * ev.delta;\n", " const zoom_info = zoom_1.scale_range(frame, factor, h_axis, v_axis, { x: sx, y: sy });\n", " this.plot_view.push_state('wheel_zoom', { range: zoom_info });\n", " this.plot_view.update_range(zoom_info, false, true, this.model.maintain_focus);\n", " if (this.model.document != null)\n", " this.model.document.interactive_start(this.plot_model);\n", " }\n", " }\n", " exports.WheelZoomToolView = WheelZoomToolView;\n", " WheelZoomToolView.__name__ = \"WheelZoomToolView\";\n", " class WheelZoomTool extends gesture_tool_1.GestureTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Wheel Zoom\";\n", " this.icon = icons_1.bk_tool_icon_wheel_zoom;\n", " this.event_type = compat_1.is_mobile ? \"pinch\" : \"scroll\";\n", " this.default_order = 10;\n", " }\n", " static init_WheelZoomTool() {\n", " this.prototype.default_view = WheelZoomToolView;\n", " this.define({\n", " dimensions: [p.Dimensions, \"both\"],\n", " maintain_focus: [p.Boolean, true],\n", " zoom_on_axis: [p.Boolean, true],\n", " speed: [p.Number, 1 / 600],\n", " });\n", " this.register_alias(\"wheel_zoom\", () => new WheelZoomTool({ dimensions: 'both' }));\n", " this.register_alias(\"xwheel_zoom\", () => new WheelZoomTool({ dimensions: 'width' }));\n", " this.register_alias(\"ywheel_zoom\", () => new WheelZoomTool({ dimensions: 'height' }));\n", " }\n", " get tooltip() {\n", " return this._get_dim_tooltip(this.tool_name, this.dimensions);\n", " }\n", " }\n", " exports.WheelZoomTool = WheelZoomTool;\n", " WheelZoomTool.__name__ = \"WheelZoomTool\";\n", " WheelZoomTool.init_WheelZoomTool();\n", " },\n", " /* models/tools/inspectors/crosshair_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const inspect_tool_1 = require(274) /* ./inspect_tool */;\n", " const span_1 = require(141) /* ../../annotations/span */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const object_1 = require(17) /* ../../../core/util/object */;\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " class CrosshairToolView extends inspect_tool_1.InspectToolView {\n", " _move(ev) {\n", " if (!this.model.active)\n", " return;\n", " const { sx, sy } = ev;\n", " if (!this.plot_view.frame.bbox.contains(sx, sy))\n", " this._update_spans(null, null);\n", " else\n", " this._update_spans(sx, sy);\n", " }\n", " _move_exit(_e) {\n", " this._update_spans(null, null);\n", " }\n", " _update_spans(x, y) {\n", " const dims = this.model.dimensions;\n", " if (dims == \"width\" || dims == \"both\")\n", " this.model.spans.width.location = y;\n", " if (dims == \"height\" || dims == \"both\")\n", " this.model.spans.height.location = x;\n", " }\n", " }\n", " exports.CrosshairToolView = CrosshairToolView;\n", " CrosshairToolView.__name__ = \"CrosshairToolView\";\n", " class CrosshairTool extends inspect_tool_1.InspectTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Crosshair\";\n", " this.icon = icons_1.bk_tool_icon_crosshair;\n", " }\n", " static init_CrosshairTool() {\n", " this.prototype.default_view = CrosshairToolView;\n", " this.define({\n", " dimensions: [p.Dimensions, \"both\"],\n", " line_color: [p.Color, 'black'],\n", " line_width: [p.Number, 1],\n", " line_alpha: [p.Number, 1.0],\n", " });\n", " this.internal({\n", " spans: [p.Any],\n", " });\n", " this.register_alias(\"crosshair\", () => new CrosshairTool());\n", " }\n", " get tooltip() {\n", " return this._get_dim_tooltip(\"Crosshair\", this.dimensions);\n", " }\n", " get synthetic_renderers() {\n", " return object_1.values(this.spans);\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.spans = {\n", " width: new span_1.Span({\n", " for_hover: true,\n", " dimension: \"width\",\n", " location_units: \"screen\",\n", " level: \"overlay\",\n", " line_color: this.line_color,\n", " line_width: this.line_width,\n", " line_alpha: this.line_alpha,\n", " }),\n", " height: new span_1.Span({\n", " for_hover: true,\n", " dimension: \"height\",\n", " location_units: \"screen\",\n", " level: \"overlay\",\n", " line_color: this.line_color,\n", " line_width: this.line_width,\n", " line_alpha: this.line_alpha,\n", " }),\n", " };\n", " }\n", " }\n", " exports.CrosshairTool = CrosshairTool;\n", " CrosshairTool.__name__ = \"CrosshairTool\";\n", " CrosshairTool.init_CrosshairTool();\n", " },\n", " /* models/tools/inspectors/customjs_hover.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const model_1 = require(71) /* ../../../model */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const object_1 = require(17) /* ../../../core/util/object */;\n", " const string_1 = require(24) /* ../../../core/util/string */;\n", " class CustomJSHover extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_CustomJSHover() {\n", " this.define({\n", " args: [p.Any, {}],\n", " code: [p.String, \"\"],\n", " });\n", " }\n", " get values() {\n", " return object_1.values(this.args);\n", " }\n", " /*protected*/ _make_code(valname, formatname, varsname, fn) {\n", " // this relies on keys(args) and values(args) returning keys and values\n", " // in the same order\n", " return new Function(...object_1.keys(this.args), valname, formatname, varsname, string_1.use_strict(fn));\n", " }\n", " format(value, format, special_vars) {\n", " const formatter = this._make_code(\"value\", \"format\", \"special_vars\", this.code);\n", " return formatter(...this.values, value, format, special_vars);\n", " }\n", " }\n", " exports.CustomJSHover = CustomJSHover;\n", " CustomJSHover.__name__ = \"CustomJSHover\";\n", " CustomJSHover.init_CustomJSHover();\n", " },\n", " /* models/tools/inspectors/hover_tool.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const inspect_tool_1 = require(274) /* ./inspect_tool */;\n", " const tooltip_1 = require(144) /* ../../annotations/tooltip */;\n", " const glyph_renderer_1 = require(81) /* ../../renderers/glyph_renderer */;\n", " const graph_renderer_1 = require(100) /* ../../renderers/graph_renderer */;\n", " const util_1 = require(341) /* ../util */;\n", " const hittest = tslib_1.__importStar(require(93) /* ../../../core/hittest */);\n", " const templating_1 = require(160) /* ../../../core/util/templating */;\n", " const dom_1 = require(68) /* ../../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const color_1 = require(20) /* ../../../core/util/color */;\n", " const object_1 = require(17) /* ../../../core/util/object */;\n", " const types_1 = require(8) /* ../../../core/util/types */;\n", " const build_views_1 = require(99) /* ../../../core/build_views */;\n", " const icons_1 = require(287) /* ../../../styles/icons */;\n", " const tooltips_1 = require(145) /* ../../../styles/tooltips */;\n", " function _nearest_line_hit(i, geometry, sx, sy, dx, dy) {\n", " const d1 = { x: dx[i], y: dy[i] };\n", " const d2 = { x: dx[i + 1], y: dy[i + 1] };\n", " let dist1;\n", " let dist2;\n", " if (geometry.type == \"span\") {\n", " if (geometry.direction == \"h\") {\n", " dist1 = Math.abs(d1.x - sx);\n", " dist2 = Math.abs(d2.x - sx);\n", " }\n", " else {\n", " dist1 = Math.abs(d1.y - sy);\n", " dist2 = Math.abs(d2.y - sy);\n", " }\n", " }\n", " else {\n", " const s = { x: sx, y: sy };\n", " dist1 = hittest.dist_2_pts(d1, s);\n", " dist2 = hittest.dist_2_pts(d2, s);\n", " }\n", " if (dist1 < dist2)\n", " return [[d1.x, d1.y], i];\n", " else\n", " return [[d2.x, d2.y], i + 1];\n", " }\n", " exports._nearest_line_hit = _nearest_line_hit;\n", " function _line_hit(xs, ys, ind) {\n", " return [[xs[ind], ys[ind]], ind];\n", " }\n", " exports._line_hit = _line_hit;\n", " class HoverToolView extends inspect_tool_1.InspectToolView {\n", " initialize() {\n", " super.initialize();\n", " this._ttmodels = null;\n", " this._ttviews = new Map();\n", " }\n", " remove() {\n", " build_views_1.remove_views(this._ttviews);\n", " super.remove();\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " for (const r of this.computed_renderers) {\n", " if (r instanceof glyph_renderer_1.GlyphRenderer)\n", " this.connect(r.data_source.inspect, this._update);\n", " else if (r instanceof graph_renderer_1.GraphRenderer) {\n", " this.connect(r.node_renderer.data_source.inspect, this._update);\n", " this.connect(r.edge_renderer.data_source.inspect, this._update);\n", " }\n", " }\n", " // TODO: this.connect(this.plot_model.properties.renderers.change, () => this._computed_renderers = this._ttmodels = null)\n", " this.connect(this.model.properties.renderers.change, () => this._computed_renderers = this._ttmodels = null);\n", " this.connect(this.model.properties.names.change, () => this._computed_renderers = this._ttmodels = null);\n", " this.connect(this.model.properties.tooltips.change, () => this._ttmodels = null);\n", " }\n", " _compute_ttmodels() {\n", " const ttmodels = new Map();\n", " const tooltips = this.model.tooltips;\n", " if (tooltips != null) {\n", " for (const r of this.computed_renderers) {\n", " const tooltip = new tooltip_1.Tooltip({\n", " custom: types_1.isString(tooltips) || types_1.isFunction(tooltips),\n", " attachment: this.model.attachment,\n", " show_arrow: this.model.show_arrow,\n", " });\n", " if (r instanceof glyph_renderer_1.GlyphRenderer) {\n", " ttmodels.set(r, tooltip);\n", " }\n", " else if (r instanceof graph_renderer_1.GraphRenderer) {\n", " ttmodels.set(r.node_renderer, tooltip);\n", " ttmodels.set(r.edge_renderer, tooltip);\n", " }\n", " }\n", " }\n", " build_views_1.build_views(this._ttviews, [...ttmodels.values()], { parent: this.plot_view });\n", " return ttmodels;\n", " }\n", " get computed_renderers() {\n", " if (this._computed_renderers == null) {\n", " const renderers = this.model.renderers;\n", " const all_renderers = this.plot_model.renderers;\n", " const names = this.model.names;\n", " this._computed_renderers = util_1.compute_renderers(renderers, all_renderers, names);\n", " }\n", " return this._computed_renderers;\n", " }\n", " get ttmodels() {\n", " if (this._ttmodels == null)\n", " this._ttmodels = this._compute_ttmodels();\n", " return this._ttmodels;\n", " }\n", " _clear() {\n", " this._inspect(Infinity, Infinity);\n", " for (const [, tooltip] of this.ttmodels) {\n", " tooltip.clear();\n", " }\n", " }\n", " _move(ev) {\n", " if (!this.model.active)\n", " return;\n", " const { sx, sy } = ev;\n", " if (!this.plot_view.frame.bbox.contains(sx, sy))\n", " this._clear();\n", " else\n", " this._inspect(sx, sy);\n", " }\n", " _move_exit() {\n", " this._clear();\n", " }\n", " _inspect(sx, sy) {\n", " let geometry;\n", " if (this.model.mode == 'mouse')\n", " geometry = { type: 'point', sx, sy };\n", " else {\n", " const direction = this.model.mode == 'vline' ? 'h' : 'v';\n", " geometry = { type: 'span', direction, sx, sy };\n", " }\n", " for (const r of this.computed_renderers) {\n", " const sm = r.get_selection_manager();\n", " sm.inspect(this.plot_view.renderer_views.get(r), geometry);\n", " }\n", " if (this.model.callback != null)\n", " this._emit_callback(geometry);\n", " }\n", " _update([renderer_view, { geometry }]) {\n", " if (!this.model.active)\n", " return;\n", " if (!(renderer_view instanceof glyph_renderer_1.GlyphRendererView)) // || renderer_view instanceof GraphRendererView))\n", " return;\n", " const { model: renderer } = renderer_view;\n", " if (this.model.muted_policy == 'ignore' && renderer instanceof glyph_renderer_1.GlyphRenderer && renderer.muted)\n", " return;\n", " const tooltip = this.ttmodels.get(renderer);\n", " if (tooltip == null)\n", " return;\n", " tooltip.clear();\n", " const selection_manager = renderer.get_selection_manager();\n", " let indices = selection_manager.inspectors.get(renderer);\n", " if (renderer instanceof glyph_renderer_1.GlyphRenderer)\n", " indices = renderer.view.convert_selection_to_subset(indices);\n", " if (indices.is_empty())\n", " return;\n", " const ds = selection_manager.source;\n", " const { frame } = this.plot_view;\n", " const { sx, sy } = geometry;\n", " const xscale = frame.xscales[renderer.x_range_name];\n", " const yscale = frame.yscales[renderer.y_range_name];\n", " const x = xscale.invert(sx);\n", " const y = yscale.invert(sy);\n", " const glyph = renderer_view.glyph; // XXX\n", " for (const i of indices.line_indices) {\n", " let data_x = glyph._x[i + 1];\n", " let data_y = glyph._y[i + 1];\n", " let ii = i;\n", " let rx;\n", " let ry;\n", " switch (this.model.line_policy) {\n", " case \"interp\": { // and renderer.get_interpolation_hit?\n", " [data_x, data_y] = glyph.get_interpolation_hit(i, geometry);\n", " rx = xscale.compute(data_x);\n", " ry = yscale.compute(data_y);\n", " break;\n", " }\n", " case \"prev\": {\n", " [[rx, ry], ii] = _line_hit(glyph.sx, glyph.sy, i);\n", " break;\n", " }\n", " case \"next\": {\n", " [[rx, ry], ii] = _line_hit(glyph.sx, glyph.sy, i + 1);\n", " break;\n", " }\n", " case \"nearest\": {\n", " [[rx, ry], ii] = _nearest_line_hit(i, geometry, sx, sy, glyph.sx, glyph.sy);\n", " data_x = glyph._x[ii];\n", " data_y = glyph._y[ii];\n", " break;\n", " }\n", " default: {\n", " [rx, ry] = [sx, sy];\n", " }\n", " }\n", " const vars = {\n", " index: ii,\n", " x, y, sx, sy, data_x, data_y, rx, ry,\n", " indices: indices.line_indices,\n", " name: renderer_view.model.name,\n", " };\n", " tooltip.add(rx, ry, this._render_tooltips(ds, ii, vars));\n", " }\n", " for (const struct of indices.image_indices) {\n", " const vars = { index: struct.index, x, y, sx, sy };\n", " const rendered = this._render_tooltips(ds, struct, vars);\n", " tooltip.add(sx, sy, rendered);\n", " }\n", " for (const i of indices.indices) {\n", " // multiglyphs set additional indices, e.g. multiline_indices for different tooltips\n", " if (!object_1.isEmpty(indices.multiline_indices)) {\n", " for (const j of indices.multiline_indices[i.toString()]) { // TODO: indices.multiline_indices.get(i)\n", " let data_x = glyph._xs[i][j];\n", " let data_y = glyph._ys[i][j];\n", " let jj = j;\n", " let rx;\n", " let ry;\n", " switch (this.model.line_policy) {\n", " case \"interp\": { // and renderer.get_interpolation_hit?\n", " [data_x, data_y] = glyph.get_interpolation_hit(i, j, geometry);\n", " rx = xscale.compute(data_x);\n", " ry = yscale.compute(data_y);\n", " break;\n", " }\n", " case \"prev\": {\n", " [[rx, ry], jj] = _line_hit(glyph.sxs[i], glyph.sys[i], j);\n", " break;\n", " }\n", " case \"next\": {\n", " [[rx, ry], jj] = _line_hit(glyph.sxs[i], glyph.sys[i], j + 1);\n", " break;\n", " }\n", " case \"nearest\": {\n", " [[rx, ry], jj] = _nearest_line_hit(j, geometry, sx, sy, glyph.sxs[i], glyph.sys[i]);\n", " data_x = glyph._xs[i][jj];\n", " data_y = glyph._ys[i][jj];\n", " break;\n", " }\n", " default:\n", " throw new Error(\"should't have happened\");\n", " }\n", " let index;\n", " if (renderer instanceof glyph_renderer_1.GlyphRenderer)\n", " index = renderer.view.convert_indices_from_subset([i])[0];\n", " else\n", " index = i;\n", " const vars = {\n", " index, x, y, sx, sy, data_x, data_y,\n", " segment_index: jj,\n", " indices: indices.multiline_indices,\n", " name: renderer_view.model.name,\n", " };\n", " tooltip.add(rx, ry, this._render_tooltips(ds, index, vars));\n", " }\n", " }\n", " else {\n", " // handle non-multiglyphs\n", " const data_x = glyph._x != null ? glyph._x[i] : undefined;\n", " const data_y = glyph._y != null ? glyph._y[i] : undefined;\n", " let rx;\n", " let ry;\n", " if (this.model.point_policy == 'snap_to_data') { // and renderer.glyph.sx? and renderer.glyph.sy?\n", " // Pass in our screen position so we can determine which patch we're\n", " // over if there are discontinuous patches.\n", " let pt = glyph.get_anchor_point(this.model.anchor, i, [sx, sy]);\n", " if (pt == null)\n", " pt = glyph.get_anchor_point(\"center\", i, [sx, sy]);\n", " rx = pt.x;\n", " ry = pt.y;\n", " }\n", " else\n", " [rx, ry] = [sx, sy];\n", " let index;\n", " if (renderer instanceof glyph_renderer_1.GlyphRenderer)\n", " index = renderer.view.convert_indices_from_subset([i])[0];\n", " else\n", " index = i;\n", " const vars = {\n", " index, x, y, sx, sy, data_x, data_y,\n", " indices: indices.indices,\n", " name: renderer_view.model.name,\n", " };\n", " tooltip.add(rx, ry, this._render_tooltips(ds, index, vars));\n", " }\n", " }\n", " }\n", " _emit_callback(geometry) {\n", " for (const r of this.computed_renderers) {\n", " const index = r.data_source.inspected;\n", " const { frame } = this.plot_view;\n", " const xscale = frame.xscales[r.x_range_name];\n", " const yscale = frame.yscales[r.y_range_name];\n", " const x = xscale.invert(geometry.sx);\n", " const y = yscale.invert(geometry.sy);\n", " const g = Object.assign({ x, y }, geometry);\n", " this.model.callback.execute(this.model, { index, geometry: g, renderer: r });\n", " }\n", " }\n", " _render_tooltips(ds, i, vars) {\n", " const tooltips = this.model.tooltips;\n", " if (types_1.isString(tooltips)) {\n", " const el = dom_1.div();\n", " el.innerHTML = templating_1.replace_placeholders(tooltips, ds, i, this.model.formatters, vars);\n", " return el;\n", " }\n", " else if (types_1.isFunction(tooltips)) {\n", " return tooltips(ds, vars);\n", " }\n", " else {\n", " const rows = dom_1.div({ style: { display: \"table\", borderSpacing: \"2px\" } });\n", " for (const [label, value] of tooltips) {\n", " const row = dom_1.div({ style: { display: \"table-row\" } });\n", " rows.appendChild(row);\n", " let cell;\n", " cell = dom_1.div({ style: { display: \"table-cell\" }, class: tooltips_1.bk_tooltip_row_label }, label.length != 0 ? `${label}: ` : \"\");\n", " row.appendChild(cell);\n", " cell = dom_1.div({ style: { display: \"table-cell\" }, class: tooltips_1.bk_tooltip_row_value });\n", " row.appendChild(cell);\n", " if (value.indexOf(\"$color\") >= 0) {\n", " const [, opts = \"\", colname] = value.match(/\\$color(\\[.*\\])?:(\\w*)/); // XXX!\n", " const column = ds.get_column(colname); // XXX: change to columnar ds\n", " if (column == null) {\n", " const el = dom_1.span({}, `${colname} unknown`);\n", " cell.appendChild(el);\n", " continue;\n", " }\n", " const hex = opts.indexOf(\"hex\") >= 0;\n", " const swatch = opts.indexOf(\"swatch\") >= 0;\n", " let color = types_1.isNumber(i) ? column[i] : null;\n", " if (color == null) {\n", " const el = dom_1.span({}, \"(null)\");\n", " cell.appendChild(el);\n", " continue;\n", " }\n", " if (hex)\n", " color = color_1.color2hex(color);\n", " let el = dom_1.span({}, color);\n", " cell.appendChild(el);\n", " if (swatch) {\n", " el = dom_1.span({ class: tooltips_1.bk_tooltip_color_block, style: { backgroundColor: color } }, \" \");\n", " cell.appendChild(el);\n", " }\n", " }\n", " else {\n", " const el = dom_1.span();\n", " el.innerHTML = templating_1.replace_placeholders(value.replace(\"$~\", \"$data_\"), ds, i, this.model.formatters, vars);\n", " cell.appendChild(el);\n", " }\n", " }\n", " return rows;\n", " }\n", " }\n", " }\n", " exports.HoverToolView = HoverToolView;\n", " HoverToolView.__name__ = \"HoverToolView\";\n", " class HoverTool extends inspect_tool_1.InspectTool {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.tool_name = \"Hover\";\n", " this.icon = icons_1.bk_tool_icon_hover;\n", " }\n", " static init_HoverTool() {\n", " this.prototype.default_view = HoverToolView;\n", " this.define({\n", " tooltips: [p.Any, [\n", " [\"index\", \"$index\"],\n", " [\"data (x, y)\", \"($x, $y)\"],\n", " [\"screen (x, y)\", \"($sx, $sy)\"],\n", " ]],\n", " formatters: [p.Any, {}],\n", " renderers: [p.Any, 'auto'],\n", " names: [p.Array, []],\n", " mode: [p.HoverMode, 'mouse'],\n", " muted_policy: [p.MutedPolicy, 'show'],\n", " point_policy: [p.PointPolicy, 'snap_to_data'],\n", " line_policy: [p.LinePolicy, 'nearest'],\n", " show_arrow: [p.Boolean, true],\n", " anchor: [p.Anchor, 'center'],\n", " attachment: [p.TooltipAttachment, 'horizontal'],\n", " callback: [p.Any],\n", " });\n", " this.register_alias(\"hover\", () => new HoverTool());\n", " }\n", " }\n", " exports.HoverTool = HoverTool;\n", " HoverTool.__name__ = \"HoverTool\";\n", " HoverTool.init_HoverTool();\n", " },\n", " /* models/tools/tool_proxy.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const signaling_1 = require(14) /* ../../core/signaling */;\n", " const model_1 = require(71) /* ../../model */;\n", " const inspect_tool_1 = require(274) /* ./inspectors/inspect_tool */;\n", " const iterator_1 = require(356) /* ../../core/util/iterator */;\n", " class ToolProxy extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ToolProxy() {\n", " this.define({\n", " tools: [p.Array, []],\n", " active: [p.Boolean, false],\n", " disabled: [p.Boolean, false],\n", " });\n", " }\n", " // Operates all the tools given only one button\n", " get button_view() {\n", " return this.tools[0].button_view;\n", " }\n", " get event_type() {\n", " return this.tools[0].event_type;\n", " }\n", " get tooltip() {\n", " return this.tools[0].tooltip;\n", " }\n", " get tool_name() {\n", " return this.tools[0].tool_name;\n", " }\n", " get icon() {\n", " return this.tools[0].computed_icon;\n", " }\n", " get computed_icon() {\n", " return this.icon;\n", " }\n", " get toggleable() {\n", " const tool = this.tools[0];\n", " return tool instanceof inspect_tool_1.InspectTool && tool.toggleable;\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.do = new signaling_1.Signal0(this, \"do\");\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.do, () => this.doit());\n", " this.connect(this.properties.active.change, () => this.set_active());\n", " for (const tool of this.tools) {\n", " this.connect(tool.properties.active.change, () => {\n", " this.active = tool.active;\n", " });\n", " }\n", " }\n", " doit() {\n", " for (const tool of this.tools) {\n", " tool.do.emit();\n", " }\n", " }\n", " set_active() {\n", " for (const tool of this.tools) {\n", " tool.active = this.active;\n", " }\n", " }\n", " get menu() {\n", " const { menu } = this.tools[0];\n", " if (menu == null)\n", " return null;\n", " const items = [];\n", " for (const [item, i] of iterator_1.enumerate(menu)) {\n", " if (item == null)\n", " items.push(null);\n", " else {\n", " const handler = () => {\n", " var _a, _b;\n", " for (const tool of this.tools) {\n", " (_b = (_a = tool.menu) === null || _a === void 0 ? void 0 : _a[i]) === null || _b === void 0 ? void 0 : _b.handler();\n", " }\n", " };\n", " items.push(Object.assign(Object.assign({}, item), { handler }));\n", " }\n", " }\n", " return items;\n", " }\n", " }\n", " exports.ToolProxy = ToolProxy;\n", " ToolProxy.__name__ = \"ToolProxy\";\n", " ToolProxy.init_ToolProxy();\n", " },\n", " /* core/util/iterator.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const array_1 = require(9) /* ./array */;\n", " function* enumerate(seq) {\n", " let i = 0;\n", " for (const item of seq) {\n", " yield [item, i++];\n", " }\n", " }\n", " exports.enumerate = enumerate;\n", " // https://docs.python.org/3.8/library/itertools.html#itertools.combinations\n", " function* combinations(seq, r) {\n", " const n = seq.length;\n", " if (r > n)\n", " return;\n", " const indices = array_1.range(r);\n", " yield indices.map((i) => seq[i]);\n", " while (true) {\n", " let k;\n", " for (const i of array_1.reversed(array_1.range(r))) {\n", " if (indices[i] != i + n - r) {\n", " k = i;\n", " break;\n", " }\n", " }\n", " if (k == null)\n", " return;\n", " indices[k] += 1;\n", " for (const j of array_1.range(k + 1, r)) {\n", " indices[j] = indices[j - 1] + 1;\n", " }\n", " yield indices.map((i) => seq[i]);\n", " }\n", " }\n", " exports.combinations = combinations;\n", " function* subsets(seq) {\n", " for (const k of array_1.range(seq.length + 1)) {\n", " yield* combinations(seq, k);\n", " }\n", " }\n", " exports.subsets = subsets;\n", " },\n", " /* models/tools/toolbar_box.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const toolbar_base_1 = require(283) /* ./toolbar_base */;\n", " const tool_proxy_1 = require(355) /* ./tool_proxy */;\n", " const layout_dom_1 = require(245) /* ../layouts/layout_dom */;\n", " const layout_1 = require(188) /* ../../core/layout */;\n", " class ProxyToolbar extends toolbar_base_1.ToolbarBase {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ProxyToolbar() {\n", " this.define({\n", " toolbars: [p.Array, []],\n", " });\n", " }\n", " initialize() {\n", " super.initialize();\n", " this._merge_tools();\n", " }\n", " _merge_tools() {\n", " // Go through all the tools on the toolbar and replace them with\n", " // a proxy e.g. PanTool, BoxSelectTool, etc.\n", " this._proxied_tools = [];\n", " const inspectors = {};\n", " const actions = {};\n", " const gestures = {};\n", " const new_help_tools = [];\n", " const new_help_urls = [];\n", " for (const helptool of this.help) {\n", " if (!array_1.includes(new_help_urls, helptool.redirect)) {\n", " new_help_tools.push(helptool);\n", " new_help_urls.push(helptool.redirect);\n", " }\n", " }\n", " this._proxied_tools.push(...new_help_tools);\n", " this.help = new_help_tools;\n", " for (const event_type in this.gestures) {\n", " const gesture = this.gestures[event_type];\n", " if (!(event_type in gestures)) {\n", " gestures[event_type] = {};\n", " }\n", " for (const tool of gesture.tools) {\n", " if (!(tool.type in gestures[event_type])) {\n", " gestures[event_type][tool.type] = [];\n", " }\n", " gestures[event_type][tool.type].push(tool);\n", " }\n", " }\n", " for (const tool of this.inspectors) {\n", " if (!(tool.type in inspectors)) {\n", " inspectors[tool.type] = [];\n", " }\n", " inspectors[tool.type].push(tool);\n", " }\n", " for (const tool of this.actions) {\n", " if (!(tool.type in actions)) {\n", " actions[tool.type] = [];\n", " }\n", " actions[tool.type].push(tool);\n", " }\n", " // Add a proxy for each of the groups of tools.\n", " const make_proxy = (tools, active = false) => {\n", " const proxy = new tool_proxy_1.ToolProxy({ tools, active });\n", " this._proxied_tools.push(proxy);\n", " return proxy;\n", " };\n", " for (const event_type in gestures) {\n", " const gesture = this.gestures[event_type];\n", " gesture.tools = [];\n", " for (const tool_type in gestures[event_type]) {\n", " const tools = gestures[event_type][tool_type];\n", " if (tools.length > 0) {\n", " if (event_type == 'multi') {\n", " for (const tool of tools) {\n", " const proxy = make_proxy([tool]);\n", " gesture.tools.push(proxy);\n", " this.connect(proxy.properties.active.change, () => this._active_change(proxy));\n", " }\n", " }\n", " else {\n", " const proxy = make_proxy(tools);\n", " gesture.tools.push(proxy);\n", " this.connect(proxy.properties.active.change, () => this._active_change(proxy));\n", " }\n", " }\n", " }\n", " }\n", " this.actions = [];\n", " for (const tool_type in actions) {\n", " const tools = actions[tool_type];\n", " if (tool_type == 'CustomAction') {\n", " for (const tool of tools)\n", " this.actions.push(make_proxy([tool]));\n", " }\n", " else if (tools.length > 0) {\n", " this.actions.push(make_proxy(tools)); // XXX\n", " }\n", " }\n", " this.inspectors = [];\n", " for (const tool_type in inspectors) {\n", " const tools = inspectors[tool_type];\n", " if (tools.length > 0)\n", " this.inspectors.push(make_proxy(tools, true)); // XXX\n", " }\n", " for (const et in this.gestures) {\n", " const gesture = this.gestures[et];\n", " if (gesture.tools.length == 0)\n", " continue;\n", " gesture.tools = array_1.sort_by(gesture.tools, (tool) => tool.default_order);\n", " if (!(et == 'pinch' || et == 'scroll' || et == 'multi'))\n", " gesture.tools[0].active = true;\n", " }\n", " }\n", " }\n", " exports.ProxyToolbar = ProxyToolbar;\n", " ProxyToolbar.__name__ = \"ProxyToolbar\";\n", " ProxyToolbar.init_ProxyToolbar();\n", " class ToolbarBoxView extends layout_dom_1.LayoutDOMView {\n", " initialize() {\n", " this.model.toolbar.toolbar_location = this.model.toolbar_location;\n", " super.initialize();\n", " }\n", " get child_models() {\n", " return [this.model.toolbar]; // XXX\n", " }\n", " _update_layout() {\n", " this.layout = new layout_1.ContentBox(this.child_views[0].el);\n", " const { toolbar } = this.model;\n", " if (toolbar.horizontal) {\n", " this.layout.set_sizing({\n", " width_policy: \"fit\", min_width: 100, height_policy: \"fixed\",\n", " });\n", " }\n", " else {\n", " this.layout.set_sizing({\n", " width_policy: \"fixed\", height_policy: \"fit\", min_height: 100,\n", " });\n", " }\n", " }\n", " }\n", " exports.ToolbarBoxView = ToolbarBoxView;\n", " ToolbarBoxView.__name__ = \"ToolbarBoxView\";\n", " class ToolbarBox extends layout_dom_1.LayoutDOM {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ToolbarBox() {\n", " this.prototype.default_view = ToolbarBoxView;\n", " this.define({\n", " toolbar: [p.Instance],\n", " toolbar_location: [p.Location, \"right\"],\n", " });\n", " }\n", " }\n", " exports.ToolbarBox = ToolbarBox;\n", " ToolbarBox.__name__ = \"ToolbarBox\";\n", " ToolbarBox.init_ToolbarBox();\n", " },\n", " /* embed/standalone.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const document_1 = require(5) /* ../document */;\n", " const dom_view_1 = require(66) /* ../core/dom_view */;\n", " const build_views_1 = require(99) /* ../core/build_views */;\n", " const dom_1 = require(68) /* ../core/dom */;\n", " const dom_2 = require(359) /* ./dom */;\n", " // A map from the root model IDs to their views.\n", " exports.index = {};\n", " async function add_document_standalone(document, element, roots = [], use_for_title = false) {\n", " // this is a LOCAL index of views used only by this particular rendering\n", " // call, so we can remove the views we create.\n", " const views = new Map();\n", " async function render_model(model) {\n", " let root_el;\n", " const root_models = document.roots();\n", " const idx = root_models.indexOf(model);\n", " const root = roots[idx];\n", " if (root != null)\n", " root_el = root;\n", " else if (element.classList.contains(dom_2.BOKEH_ROOT))\n", " root_el = element;\n", " else {\n", " root_el = dom_1.div({ class: dom_2.BOKEH_ROOT });\n", " element.appendChild(root_el);\n", " }\n", " const view = await build_views_1.build_view(model, { parent: null });\n", " if (view instanceof dom_view_1.DOMView)\n", " view.renderTo(root_el);\n", " views.set(model, view);\n", " exports.index[model.id] = view;\n", " return view;\n", " }\n", " function unrender_model(model) {\n", " const view = views.get(model);\n", " if (view != null) {\n", " view.remove();\n", " views.delete(model);\n", " delete exports.index[model.id];\n", " }\n", " }\n", " for (const model of document.roots())\n", " await render_model(model);\n", " if (use_for_title)\n", " window.document.title = document.title();\n", " document.on_change((event) => {\n", " if (event instanceof document_1.RootAddedEvent)\n", " render_model(event.model);\n", " else if (event instanceof document_1.RootRemovedEvent)\n", " unrender_model(event.model);\n", " else if (use_for_title && event instanceof document_1.TitleChangedEvent)\n", " window.document.title = event.title;\n", " });\n", " return [...views.values()];\n", " }\n", " exports.add_document_standalone = add_document_standalone;\n", " },\n", " /* embed/dom.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const dom_1 = require(68) /* ../core/dom */;\n", " const root_1 = require(246) /* ../styles/root */;\n", " // Matches Bokeh CSS class selector. Setting all Bokeh parent element class names\n", " // with this var prevents user configurations where css styling is unset.\n", " exports.BOKEH_ROOT = root_1.bk_root;\n", " function _get_element(elementid) {\n", " let element = document.getElementById(elementid);\n", " if (element == null)\n", " throw new Error(`Error rendering Bokeh model: could not find #${elementid} HTML tag`);\n", " if (!document.body.contains(element))\n", " throw new Error(`Error rendering Bokeh model: element #${elementid} must be under `);\n", " // If autoload script, replace script tag with div for embedding.\n", " if (element.tagName == \"SCRIPT\") {\n", " const root_el = dom_1.div({ class: exports.BOKEH_ROOT });\n", " dom_1.replaceWith(element, root_el);\n", " element = root_el;\n", " }\n", " return element;\n", " }\n", " function _resolve_element(item) {\n", " const { elementid } = item;\n", " if (elementid != null)\n", " return _get_element(elementid);\n", " else\n", " return document.body;\n", " }\n", " exports._resolve_element = _resolve_element;\n", " function _resolve_root_elements(item) {\n", " const roots = [];\n", " if ((item.root_ids != null) && (item.roots != null)) {\n", " for (const root_id of item.root_ids)\n", " roots.push(_get_element(item.roots[root_id]));\n", " }\n", " return roots;\n", " }\n", " exports._resolve_root_elements = _resolve_root_elements;\n", " },\n", " /* embed/server.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const connection_1 = require(361) /* ../client/connection */;\n", " const logging_1 = require(72) /* ../core/logging */;\n", " const standalone_1 = require(358) /* ./standalone */;\n", " // @internal\n", " function _get_ws_url(app_path, absolute_url) {\n", " let protocol = 'ws:';\n", " if (window.location.protocol == 'https:')\n", " protocol = 'wss:';\n", " let loc;\n", " if (absolute_url != null) {\n", " loc = document.createElement('a');\n", " loc.href = absolute_url;\n", " }\n", " else\n", " loc = window.location;\n", " if (app_path != null) {\n", " if (app_path == \"/\")\n", " app_path = \"\";\n", " }\n", " else\n", " app_path = loc.pathname.replace(/\\/+$/, '');\n", " return protocol + '//' + loc.host + app_path + '/ws';\n", " }\n", " exports._get_ws_url = _get_ws_url;\n", " // map { websocket url to map { session id to promise of ClientSession } }\n", " const _sessions = {};\n", " function _get_session(websocket_url, token, args_string) {\n", " const session_id = connection_1.parse_token(token).session_id;\n", " if (!(websocket_url in _sessions))\n", " _sessions[websocket_url] = {};\n", " const subsessions = _sessions[websocket_url];\n", " if (!(session_id in subsessions))\n", " subsessions[session_id] = connection_1.pull_session(websocket_url, token, args_string);\n", " return subsessions[session_id];\n", " }\n", " // Fill element with the roots from token\n", " async function add_document_from_session(websocket_url, token, element, roots = [], use_for_title = false) {\n", " const args_string = window.location.search.substr(1);\n", " let session;\n", " try {\n", " session = await _get_session(websocket_url, token, args_string);\n", " }\n", " catch (error) {\n", " const session_id = connection_1.parse_token(token).session_id;\n", " logging_1.logger.error(`Failed to load Bokeh session ${session_id}: ${error}`);\n", " throw error;\n", " }\n", " return standalone_1.add_document_standalone(session.document, element, roots, use_for_title);\n", " }\n", " exports.add_document_from_session = add_document_from_session;\n", " },\n", " /* client/connection.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const logging_1 = require(72) /* ../core/logging */;\n", " const document_1 = require(5) /* ../document */;\n", " const message_1 = require(362) /* ../protocol/message */;\n", " const receiver_1 = require(363) /* ../protocol/receiver */;\n", " const session_1 = require(364) /* ./session */;\n", " exports.DEFAULT_SERVER_WEBSOCKET_URL = \"ws://localhost:5006/ws\";\n", " exports.DEFAULT_TOKEN = \"eyJzZXNzaW9uX2lkIjogImRlZmF1bHQifQ\";\n", " let _connection_count = 0;\n", " function parse_token(token) {\n", " let payload = token.split('.')[0];\n", " const mod = payload.length % 4;\n", " if (mod != 0)\n", " payload = payload + \"=\".repeat(4 - mod);\n", " return JSON.parse(atob(payload.replace(/_/g, '/').replace(/-/g, '+')));\n", " }\n", " exports.parse_token = parse_token;\n", " class ClientConnection {\n", " constructor(url = exports.DEFAULT_SERVER_WEBSOCKET_URL, token = exports.DEFAULT_TOKEN, args_string = null) {\n", " this.url = url;\n", " this.token = token;\n", " this.args_string = args_string;\n", " this._number = _connection_count++;\n", " this.socket = null;\n", " this.session = null;\n", " this.closed_permanently = false;\n", " this._current_handler = null;\n", " this._pending_replies = new Map();\n", " this._pending_messages = [];\n", " this._receiver = new receiver_1.Receiver();\n", " this.id = parse_token(token).session_id.split('.')[0];\n", " logging_1.logger.debug(`Creating websocket ${this._number} to '${this.url}' session '${this.id}'`);\n", " }\n", " async connect() {\n", " if (this.closed_permanently)\n", " throw new Error(\"Cannot connect() a closed ClientConnection\");\n", " if (this.socket != null)\n", " throw new Error(\"Already connected\");\n", " this._current_handler = null;\n", " this._pending_replies.clear();\n", " this._pending_messages = [];\n", " try {\n", " let versioned_url = `${this.url}`;\n", " if (this.args_string != null && this.args_string.length > 0)\n", " versioned_url += `?${this.args_string}`;\n", " this.socket = new WebSocket(versioned_url, [\"bokeh\", this.token]);\n", " return new Promise((resolve, reject) => {\n", " // \"arraybuffer\" gives us binary data we can look at;\n", " // if we just needed an opaque blob we could use \"blob\"\n", " this.socket.binaryType = \"arraybuffer\";\n", " this.socket.onopen = () => this._on_open(resolve, reject);\n", " this.socket.onmessage = (event) => this._on_message(event);\n", " this.socket.onclose = (event) => this._on_close(event, reject);\n", " this.socket.onerror = () => this._on_error(reject);\n", " });\n", " }\n", " catch (error) {\n", " logging_1.logger.error(`websocket creation failed to url: ${this.url}`);\n", " logging_1.logger.error(` - ${error}`);\n", " throw error;\n", " }\n", " }\n", " close() {\n", " if (!this.closed_permanently) {\n", " logging_1.logger.debug(`Permanently closing websocket connection ${this._number}`);\n", " this.closed_permanently = true;\n", " if (this.socket != null)\n", " this.socket.close(1000, `close method called on ClientConnection ${this._number}`);\n", " this.session._connection_closed();\n", " }\n", " }\n", " _schedule_reconnect(milliseconds) {\n", " const retry = () => {\n", " // TODO commented code below until we fix reconnection to repull\n", " // the document when required. Otherwise, we get a lot of\n", " // confusing errors that are causing trouble when debugging.\n", " /*\n", " if (this.closed_permanently) {\n", " */\n", " if (!this.closed_permanently)\n", " logging_1.logger.info(`Websocket connection ${this._number} disconnected, will not attempt to reconnect`);\n", " return;\n", " /*\n", " } else {\n", " logger.debug(`Attempting to reconnect websocket ${this._number}`)\n", " this.connect()\n", " }\n", " */\n", " };\n", " setTimeout(retry, milliseconds);\n", " }\n", " send(message) {\n", " if (this.socket == null)\n", " throw new Error(`not connected so cannot send ${message}`);\n", " message.send(this.socket);\n", " }\n", " async send_with_reply(message) {\n", " const reply = await new Promise((resolve, reject) => {\n", " this._pending_replies.set(message.msgid(), { resolve, reject });\n", " this.send(message);\n", " });\n", " if (reply.msgtype() === \"ERROR\")\n", " throw new Error(`Error reply ${reply.content.text}`);\n", " else\n", " return reply;\n", " }\n", " async _pull_doc_json() {\n", " const message = message_1.Message.create(\"PULL-DOC-REQ\", {});\n", " const reply = await this.send_with_reply(message);\n", " if (!(\"doc\" in reply.content))\n", " throw new Error(\"No 'doc' field in PULL-DOC-REPLY\");\n", " return reply.content.doc;\n", " }\n", " async _repull_session_doc(resolve, reject) {\n", " var _a;\n", " logging_1.logger.debug(this.session ? \"Repulling session\" : \"Pulling session for first time\");\n", " try {\n", " const doc_json = await this._pull_doc_json();\n", " if (this.session == null) {\n", " if (this.closed_permanently) {\n", " logging_1.logger.debug(\"Got new document after connection was already closed\");\n", " reject(new Error(\"The connection has been closed\"));\n", " }\n", " else {\n", " const document = document_1.Document.from_json(doc_json);\n", " // Constructing models changes some of their attributes, we deal with that\n", " // here. This happens when models set attributes during construction\n", " // or initialization.\n", " const patch = document_1.Document._compute_patch_since_json(doc_json, document);\n", " if (patch.events.length > 0) {\n", " logging_1.logger.debug(`Sending ${patch.events.length} changes from model construction back to server`);\n", " const patch_message = message_1.Message.create('PATCH-DOC', {}, patch);\n", " this.send(patch_message);\n", " }\n", " this.session = new session_1.ClientSession(this, document, this.id);\n", " for (const msg of this._pending_messages) {\n", " this.session.handle(msg);\n", " }\n", " this._pending_messages = [];\n", " logging_1.logger.debug(\"Created a new session from new pulled doc\");\n", " resolve(this.session);\n", " }\n", " }\n", " else {\n", " this.session.document.replace_with_json(doc_json);\n", " logging_1.logger.debug(\"Updated existing session with new pulled doc\");\n", " // Since the session already exists, we don't need to call `resolve` again.\n", " }\n", " }\n", " catch (error) {\n", " (_a = console.trace) === null || _a === void 0 ? void 0 : _a.call(console, error);\n", " logging_1.logger.error(`Failed to repull session ${error}`);\n", " reject(error);\n", " }\n", " }\n", " _on_open(resolve, reject) {\n", " logging_1.logger.info(`Websocket connection ${this._number} is now open`);\n", " this._current_handler = (message) => {\n", " this._awaiting_ack_handler(message, resolve, reject);\n", " };\n", " }\n", " _on_message(event) {\n", " if (this._current_handler == null)\n", " logging_1.logger.error(\"Got a message with no current handler set\");\n", " try {\n", " this._receiver.consume(event.data);\n", " }\n", " catch (e) {\n", " this._close_bad_protocol(e.toString());\n", " }\n", " const msg = this._receiver.message;\n", " if (msg != null) {\n", " const problem = msg.problem();\n", " if (problem != null)\n", " this._close_bad_protocol(problem);\n", " this._current_handler(msg);\n", " }\n", " }\n", " _on_close(event, reject) {\n", " logging_1.logger.info(`Lost websocket ${this._number} connection, ${event.code} (${event.reason})`);\n", " this.socket = null;\n", " this._pending_replies.forEach((pr) => pr.reject(\"Disconnected\"));\n", " this._pending_replies.clear();\n", " if (!this.closed_permanently)\n", " this._schedule_reconnect(2000);\n", " reject(new Error(`Lost websocket connection, ${event.code} (${event.reason})`));\n", " }\n", " _on_error(reject) {\n", " logging_1.logger.debug(`Websocket error on socket ${this._number}`);\n", " const msg = \"Could not open websocket\";\n", " logging_1.logger.error(`Failed to connect to Bokeh server: ${msg}`);\n", " reject(new Error(msg));\n", " }\n", " _close_bad_protocol(detail) {\n", " logging_1.logger.error(`Closing connection: ${detail}`);\n", " if (this.socket != null)\n", " this.socket.close(1002, detail); // 1002 = protocol error\n", " }\n", " _awaiting_ack_handler(message, resolve, reject) {\n", " if (message.msgtype() === \"ACK\") {\n", " this._current_handler = (message) => this._steady_state_handler(message);\n", " // Reload any sessions\n", " this._repull_session_doc(resolve, reject);\n", " }\n", " else\n", " this._close_bad_protocol(\"First message was not an ACK\");\n", " }\n", " _steady_state_handler(message) {\n", " const reqid = message.reqid();\n", " const pr = this._pending_replies.get(reqid);\n", " if (pr) {\n", " this._pending_replies.delete(reqid);\n", " pr.resolve(message);\n", " }\n", " else if (this.session) {\n", " this.session.handle(message);\n", " }\n", " else if (message.msgtype() != 'PATCH-DOC') {\n", " // This branch can be executed only before we get the document.\n", " // When we get the document, all of the patches will already be incorporated.\n", " // In general, it's not possible to apply patches received before the document,\n", " // since they may change some models that were removed before serving the document.\n", " this._pending_messages.push(message);\n", " }\n", " }\n", " }\n", " exports.ClientConnection = ClientConnection;\n", " ClientConnection.__name__ = \"ClientConnection\";\n", " function pull_session(url, token, args_string) {\n", " const connection = new ClientConnection(url, token, args_string);\n", " return connection.connect();\n", " }\n", " exports.pull_session = pull_session;\n", " },\n", " /* protocol/message.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const string_1 = require(24) /* ../core/util/string */;\n", " class Message {\n", " constructor(header, metadata, content) {\n", " this.header = header;\n", " this.metadata = metadata;\n", " this.content = content;\n", " this.buffers = new Map();\n", " }\n", " static assemble(header_json, metadata_json, content_json) {\n", " const header = JSON.parse(header_json);\n", " const metadata = JSON.parse(metadata_json);\n", " const content = JSON.parse(content_json);\n", " return new Message(header, metadata, content);\n", " }\n", " assemble_buffer(buf_header, buf_payload) {\n", " const nb = this.header.num_buffers != null ? this.header.num_buffers : 0;\n", " if (nb <= this.buffers.size)\n", " throw new Error(`too many buffers received, expecting ${nb}`);\n", " const { id } = JSON.parse(buf_header);\n", " this.buffers.set(id, buf_payload);\n", " }\n", " // not defined for BokehJS, only *receiving* buffers is supported\n", " // add_buffer: (buf_header, buf_payload) ->\n", " // write_buffers: (socket)\n", " static create(msgtype, metadata, content = {}) {\n", " const header = Message.create_header(msgtype);\n", " return new Message(header, metadata, content);\n", " }\n", " static create_header(msgtype) {\n", " return {\n", " msgid: string_1.uniqueId(),\n", " msgtype,\n", " };\n", " }\n", " complete() {\n", " if (this.header != null && this.metadata != null && this.content != null) {\n", " if (this.header.num_buffers != undefined)\n", " return this.buffers.size == this.header.num_buffers;\n", " else\n", " return true;\n", " }\n", " else\n", " return false;\n", " }\n", " send(socket) {\n", " const nb = this.header.num_buffers != null ? this.header.num_buffers : 0;\n", " if (nb > 0)\n", " throw new Error(\"BokehJS only supports receiving buffers, not sending\");\n", " const header_json = JSON.stringify(this.header);\n", " const metadata_json = JSON.stringify(this.metadata);\n", " const content_json = JSON.stringify(this.content);\n", " socket.send(header_json);\n", " socket.send(metadata_json);\n", " socket.send(content_json);\n", " }\n", " msgid() {\n", " return this.header.msgid;\n", " }\n", " msgtype() {\n", " return this.header.msgtype;\n", " }\n", " reqid() {\n", " return this.header.reqid;\n", " }\n", " // return the reason we should close on bad protocol, if there is one\n", " problem() {\n", " if (!('msgid' in this.header))\n", " return \"No msgid in header\";\n", " else if (!('msgtype' in this.header))\n", " return \"No msgtype in header\";\n", " else\n", " return null;\n", " }\n", " }\n", " exports.Message = Message;\n", " Message.__name__ = \"Message\";\n", " },\n", " /* protocol/receiver.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const message_1 = require(362) /* ./message */;\n", " const types_1 = require(8) /* ../core/util/types */;\n", " class Receiver {\n", " constructor() {\n", " this.message = null;\n", " this._partial = null;\n", " this._fragments = [];\n", " this._buf_header = null;\n", " this._current_consumer = this._HEADER;\n", " }\n", " consume(fragment) {\n", " this._current_consumer(fragment);\n", " }\n", " _HEADER(fragment) {\n", " this._assume_text(fragment);\n", " this.message = null;\n", " this._partial = null;\n", " this._fragments = [fragment];\n", " this._buf_header = null;\n", " this._current_consumer = this._METADATA;\n", " }\n", " _METADATA(fragment) {\n", " this._assume_text(fragment);\n", " this._fragments.push(fragment);\n", " this._current_consumer = this._CONTENT;\n", " }\n", " _CONTENT(fragment) {\n", " this._assume_text(fragment);\n", " this._fragments.push(fragment);\n", " const [header_json, metadata_json, content_json] = this._fragments.slice(0, 3);\n", " this._partial = message_1.Message.assemble(header_json, metadata_json, content_json);\n", " this._check_complete();\n", " }\n", " _BUFFER_HEADER(fragment) {\n", " this._assume_text(fragment);\n", " this._buf_header = fragment;\n", " this._current_consumer = this._BUFFER_PAYLOAD;\n", " }\n", " _BUFFER_PAYLOAD(fragment) {\n", " this._assume_binary(fragment);\n", " this._partial.assemble_buffer(this._buf_header, fragment);\n", " this._check_complete();\n", " }\n", " _assume_text(fragment) {\n", " if (!types_1.isString(fragment))\n", " throw new Error(\"Expected text fragment but received binary fragment\");\n", " }\n", " _assume_binary(fragment) {\n", " if (!(fragment instanceof ArrayBuffer))\n", " throw new Error(\"Expected binary fragment but received text fragment\");\n", " }\n", " _check_complete() {\n", " if (this._partial.complete()) {\n", " this.message = this._partial;\n", " this._current_consumer = this._HEADER;\n", " }\n", " else\n", " this._current_consumer = this._BUFFER_HEADER;\n", " }\n", " }\n", " exports.Receiver = Receiver;\n", " Receiver.__name__ = \"Receiver\";\n", " },\n", " /* client/session.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const document_1 = require(5) /* ../document */;\n", " const message_1 = require(362) /* ../protocol/message */;\n", " const logging_1 = require(72) /* ../core/logging */;\n", " class ClientSession {\n", " constructor(_connection, document, id) {\n", " this._connection = _connection;\n", " this.document = document;\n", " this.id = id;\n", " this._document_listener = (event) => {\n", " this._document_changed(event);\n", " };\n", " this.document.on_change(this._document_listener, true);\n", " }\n", " handle(message) {\n", " const msgtype = message.msgtype();\n", " if (msgtype === 'PATCH-DOC')\n", " this._handle_patch(message);\n", " else if (msgtype === 'OK')\n", " this._handle_ok(message);\n", " else if (msgtype === 'ERROR')\n", " this._handle_error(message);\n", " else\n", " logging_1.logger.debug(`Doing nothing with message ${message.msgtype()}`);\n", " }\n", " close() {\n", " this._connection.close();\n", " }\n", " /*protected*/ _connection_closed() {\n", " this.document.remove_on_change(this._document_listener);\n", " }\n", " // Sends a request to the server for info about the server, such as its Bokeh\n", " // version. Returns a promise, the value of the promise is a free-form dictionary\n", " // of server details.\n", " async request_server_info() {\n", " const message = message_1.Message.create('SERVER-INFO-REQ', {});\n", " const reply = await this._connection.send_with_reply(message);\n", " return reply.content;\n", " }\n", " // Sends some request to the server (no guarantee about which one) and returns\n", " // a promise which is completed when the server replies. The purpose of this\n", " // is that if you wait for the promise to be completed, you know the server\n", " // has processed the request. This is useful when writing tests because once\n", " // the server has processed this request it should also have processed any\n", " // events or requests you sent previously, which means you can check for the\n", " // results of that processing without a race condition. (This assumes the\n", " // server processes events in sequence, which it mostly has to semantically,\n", " // since reordering events might change the final state.)\n", " async force_roundtrip() {\n", " await this.request_server_info();\n", " }\n", " _document_changed(event) {\n", " // Filter out events that were initiated by the ClientSession itself\n", " if (event.setter_id === this.id) // XXX: not all document events define this\n", " return;\n", " const events = event instanceof document_1.DocumentEventBatch ? event.events : [event];\n", " const patch = this.document.create_json_patch(events);\n", " // TODO (havocp) the connection may be closed here, which will\n", " // cause this send to throw an error - need to deal with it more cleanly.\n", " const message = message_1.Message.create('PATCH-DOC', {}, patch);\n", " this._connection.send(message);\n", " }\n", " _handle_patch(message) {\n", " this.document.apply_json_patch(message.content, message.buffers, this.id);\n", " }\n", " _handle_ok(message) {\n", " logging_1.logger.trace(`Unhandled OK reply to ${message.reqid()}`);\n", " }\n", " _handle_error(message) {\n", " logging_1.logger.error(`Unhandled ERROR reply to ${message.reqid()}: ${message.content.text}`);\n", " }\n", " }\n", " exports.ClientSession = ClientSession;\n", " ClientSession.__name__ = \"ClientSession\";\n", " },\n", " /* embed/notebook.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " var __asyncValues = (this && this.__asyncValues) || function (o) {\n", " if (!Symbol.asyncIterator)\n", " throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n", " var m = o[Symbol.asyncIterator], i;\n", " return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n", " function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n", " function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }\n", " };\n", " const document_1 = require(5) /* ../document */;\n", " const receiver_1 = require(363) /* ../protocol/receiver */;\n", " const logging_1 = require(72) /* ../core/logging */;\n", " const dom_1 = require(68) /* ../core/dom */;\n", " const object_1 = require(17) /* ../core/util/object */;\n", " const standalone_1 = require(358) /* ./standalone */;\n", " const dom_2 = require(359) /* ./dom */;\n", " const root_css_1 = tslib_1.__importDefault(require(69) /* ../styles/root.css */);\n", " const logo_css_1 = tslib_1.__importDefault(require(289) /* ../styles/logo.css */);\n", " const notebook_css_1 = tslib_1.__importDefault(require(366) /* ../styles/notebook.css */);\n", " dom_1.stylesheet.append(root_css_1.default);\n", " dom_1.stylesheet.append(logo_css_1.default);\n", " dom_1.stylesheet.append(notebook_css_1.default);\n", " // This exists to allow the @bokeh/jupyter_bokeh extension to store the\n", " // notebook kernel so that _init_comms can register the comms target.\n", " // This has to be available at Bokeh.embed.kernels in JupyterLab.\n", " exports.kernels = {};\n", " function _handle_notebook_comms(receiver, comm_msg) {\n", " if (comm_msg.buffers.length > 0)\n", " receiver.consume(comm_msg.buffers[0].buffer);\n", " else\n", " receiver.consume(comm_msg.content.data);\n", " const msg = receiver.message;\n", " if (msg != null)\n", " this.apply_json_patch(msg.content, msg.buffers);\n", " }\n", " function _init_comms(target, doc) {\n", " if (typeof Jupyter !== 'undefined' && Jupyter.notebook.kernel != null) {\n", " logging_1.logger.info(`Registering Jupyter comms for target ${target}`);\n", " const comm_manager = Jupyter.notebook.kernel.comm_manager;\n", " try {\n", " comm_manager.register_target(target, (comm) => {\n", " logging_1.logger.info(`Registering Jupyter comms for target ${target}`);\n", " const r = new receiver_1.Receiver();\n", " comm.on_msg(_handle_notebook_comms.bind(doc, r));\n", " });\n", " }\n", " catch (e) {\n", " logging_1.logger.warn(`Jupyter comms failed to register. push_notebook() will not function. (exception reported: ${e})`);\n", " }\n", " }\n", " else if (doc.roots()[0].id in exports.kernels) {\n", " logging_1.logger.info(`Registering JupyterLab comms for target ${target}`);\n", " const kernel = exports.kernels[doc.roots()[0].id];\n", " try {\n", " kernel.registerCommTarget(target, (comm) => {\n", " logging_1.logger.info(`Registering JupyterLab comms for target ${target}`);\n", " const r = new receiver_1.Receiver();\n", " comm.onMsg = _handle_notebook_comms.bind(doc, r);\n", " });\n", " }\n", " catch (e) {\n", " logging_1.logger.warn(`Jupyter comms failed to register. push_notebook() will not function. (exception reported: ${e})`);\n", " }\n", " }\n", " else if (typeof google != 'undefined' && google.colab.kernel != null) {\n", " logging_1.logger.info(`Registering Google Colab comms for target ${target}`);\n", " const comm_manager = google.colab.kernel.comms;\n", " try {\n", " comm_manager.registerTarget(target, async (comm) => {\n", " var e_1, _a;\n", " var _b;\n", " logging_1.logger.info(`Registering Google Colab comms for target ${target}`);\n", " const r = new receiver_1.Receiver();\n", " try {\n", " for (var _c = __asyncValues(comm.messages), _d; _d = await _c.next(), !_d.done;) {\n", " const message = _d.value;\n", " const content = { data: message.data };\n", " const buffers = [];\n", " for (const buffer of (_b = message.buffers) !== null && _b !== void 0 ? _b : []) {\n", " buffers.push(new DataView(buffer));\n", " }\n", " const msg = { content, buffers };\n", " _handle_notebook_comms.bind(doc)(r, msg);\n", " }\n", " }\n", " catch (e_1_1) {\n", " e_1 = { error: e_1_1 };\n", " }\n", " finally {\n", " try {\n", " if (_d && !_d.done && (_a = _c.return))\n", " await _a.call(_c);\n", " }\n", " finally {\n", " if (e_1)\n", " throw e_1.error;\n", " }\n", " }\n", " });\n", " }\n", " catch (e) {\n", " logging_1.logger.warn(`Google Colab comms failed to register. push_notebook() will not function. (exception reported: ${e})`);\n", " }\n", " }\n", " else {\n", " console.warn(`Jupyter notebooks comms not available. push_notebook() will not function. If running JupyterLab ensure the latest @bokeh/jupyter_bokeh extension is installed. In an exported notebook this warning is expected.`);\n", " }\n", " }\n", " function embed_items_notebook(docs_json, render_items) {\n", " if (object_1.size(docs_json) != 1)\n", " throw new Error(\"embed_items_notebook expects exactly one document in docs_json\");\n", " const document = document_1.Document.from_json(object_1.values(docs_json)[0]);\n", " for (const item of render_items) {\n", " if (item.notebook_comms_target != null)\n", " _init_comms(item.notebook_comms_target, document);\n", " const element = dom_2._resolve_element(item);\n", " const roots = dom_2._resolve_root_elements(item);\n", " standalone_1.add_document_standalone(document, element, roots);\n", " }\n", " }\n", " exports.embed_items_notebook = embed_items_notebook;\n", " },\n", " /* styles/notebook.css.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const css = `\n", " /* notebook specific tweaks so no black outline and matching padding\n", " /* can't be wrapped inside bk-root. here are the offending jupyter lines:\n", " /* https://github.com/jupyter/notebook/blob/master/notebook/static/notebook/less/renderedhtml.less#L59-L76 */\n", " .rendered_html .bk-root .bk-tooltip table,\n", " .rendered_html .bk-root .bk-tooltip tr,\n", " .rendered_html .bk-root .bk-tooltip th,\n", " .rendered_html .bk-root .bk-tooltip td {\n", " border: none;\n", " padding: 1px;\n", " }\n", " `;\n", " exports.default = css;\n", " },\n", " /* protocol/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " tslib_1.__exportStar(require(362) /* ./message */, exports);\n", " tslib_1.__exportStar(require(363) /* ./receiver */, exports);\n", " },\n", " /* testing.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " // Just a dumb key/value record for collecting arbitrary info for tests\n", " exports.results = {};\n", " // Selenium has race conditions that make it difficult to read out the\n", " // results structure. This function deletes/creates a div that can act as\n", " // a semaphore. Tests should wait for the previous div to be stale, then\n", " // find the new div. At that point the results should be available\n", " function update_test_div() {\n", " const body = document.getElementsByTagName(\"body\")[0];\n", " const col = document.getElementsByClassName(\"bokeh-test-div\");\n", " if (col.length == 1) {\n", " body.removeChild(col[0]);\n", " delete col[0];\n", " }\n", " const box = document.createElement(\"div\");\n", " box.classList.add(\"bokeh-test-div\");\n", " box.style.display = \"none\";\n", " body.insertBefore(box, body.firstChild);\n", " }\n", " function init() {\n", " update_test_div();\n", " }\n", " exports.init = init;\n", " function record0(key, value) {\n", " exports.results[key] = value;\n", " }\n", " exports.record0 = record0;\n", " function record(key, value) {\n", " exports.results[key] = value;\n", " update_test_div();\n", " }\n", " exports.record = record;\n", " function count(key) {\n", " if (exports.results[key] == undefined)\n", " exports.results[key] = 0;\n", " exports.results[key] += 1;\n", " update_test_div();\n", " }\n", " exports.count = count;\n", " },\n", " /* safely.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " // Keep this code as terse and as close to vanila JS as possible. If we\n", " // arrived here, it means we should trust no one and need to act properly.\n", " function _burst_into_flames(error) {\n", " // Make box\n", " const box = document.createElement(\"div\");\n", " box.style.backgroundColor = \"#f2dede\";\n", " box.style.border = \"1px solid #a94442\";\n", " box.style.borderRadius = \"4px\";\n", " box.style.display = \"inline-block\";\n", " box.style.fontFamily = \"sans-serif\";\n", " box.style.marginTop = \"5px\";\n", " box.style.minWidth = \"200px\";\n", " box.style.padding = \"5px 5px 5px 10px\";\n", " box.classList.add(\"bokeh-error-box-into-flames\");\n", " // Make button\n", " const button = document.createElement(\"span\");\n", " button.style.backgroundColor = \"#a94442\";\n", " button.style.borderRadius = \"0px 4px 0px 0px\";\n", " button.style.color = \"white\";\n", " button.style.cursor = \"pointer\";\n", " button.style.cssFloat = \"right\";\n", " button.style.fontSize = \"0.8em\";\n", " button.style.margin = \"-6px -6px 0px 0px\";\n", " button.style.padding = \"2px 5px 4px 5px\";\n", " button.title = \"close\";\n", " button.setAttribute(\"aria-label\", \"close\");\n", " button.appendChild(document.createTextNode(\"x\"));\n", " button.addEventListener(\"click\", () => body.removeChild(box));\n", " // Make title\n", " const title = document.createElement(\"h3\");\n", " title.style.color = \"#a94442\";\n", " title.style.margin = \"8px 0px 0px 0px\";\n", " title.style.padding = \"0px\";\n", " title.appendChild(document.createTextNode(\"Bokeh Error\"));\n", " // Make message\n", " const message = document.createElement(\"pre\");\n", " message.style.whiteSpace = \"unset\";\n", " message.style.overflowX = \"auto\";\n", " const text = error instanceof Error ? error.message : error;\n", " message.appendChild(document.createTextNode(text));\n", " // Add pieces to box\n", " box.appendChild(button);\n", " box.appendChild(title);\n", " box.appendChild(message);\n", " // Put box in doc\n", " const body = document.getElementsByTagName(\"body\")[0];\n", " body.insertBefore(box, body.firstChild);\n", " }\n", " function safely(fn, silent = false) {\n", " try {\n", " return fn();\n", " }\n", " catch (error) {\n", " _burst_into_flames(error);\n", " if (!silent)\n", " throw error;\n", " else\n", " return;\n", " }\n", " }\n", " exports.safely = safely;\n", " },\n", " ], 0, {\"main\":0,\"tslib\":1,\"index\":2,\"version\":3,\"embed/index\":4,\"document/index\":5,\"document/document\":6,\"base\":7,\"core/util/types\":8,\"core/util/array\":9,\"core/util/math\":10,\"core/util/assert\":11,\"core/util/arrayable\":12,\"core/has_props\":13,\"core/signaling\":14,\"core/util/callback\":15,\"core/util/refs\":16,\"core/util/object\":17,\"core/properties\":18,\"core/enums\":19,\"core/util/color\":20,\"core/util/svg_colors\":21,\"core/settings\":22,\"core/property_mixins\":23,\"core/util/string\":24,\"core/util/eq\":25,\"core/util/ndarray\":26,\"core/util/serialization\":27,\"core/util/compat\":28,\"models/index\":29,\"models/annotations/index\":30,\"models/annotations/annotation\":31,\"core/util/projections\":32,\"models/renderers/renderer\":65,\"core/dom_view\":66,\"core/view\":67,\"core/dom\":68,\"styles/root.css\":69,\"core/visuals\":70,\"model\":71,\"core/logging\":72,\"styles/annotations.css\":73,\"models/annotations/arrow\":74,\"models/annotations/arrow_head\":75,\"models/sources/column_data_source\":76,\"models/sources/columnar_data_source\":77,\"models/sources/data_source\":78,\"models/selections/selection\":79,\"core/selection_manager\":80,\"models/renderers/glyph_renderer\":81,\"models/renderers/data_renderer\":82,\"models/glyphs/line\":83,\"models/glyphs/xy_glyph\":84,\"core/util/spatial\":85,\"core/util/bbox\":88,\"models/glyphs/glyph\":89,\"models/ranges/factor_range\":90,\"models/ranges/range\":91,\"models/glyphs/utils\":92,\"core/hittest\":93,\"models/glyphs/patch\":94,\"models/glyphs/harea\":95,\"models/glyphs/area\":96,\"models/glyphs/varea\":97,\"models/sources/cds_view\":98,\"core/build_views\":99,\"models/renderers/graph_renderer\":100,\"models/graphs/graph_hit_test_policy\":101,\"models/selections/interaction_policy\":102,\"core/util/typed_array\":103,\"core/util/set\":104,\"document/events\":105,\"models/annotations/band\":106,\"models/annotations/box_annotation\":107,\"models/annotations/color_bar\":108,\"models/tickers/basic_ticker\":109,\"models/tickers/adaptive_ticker\":110,\"models/tickers/continuous_ticker\":111,\"models/tickers/ticker\":112,\"models/formatters/basic_tick_formatter\":113,\"models/formatters/tick_formatter\":114,\"models/mappers/linear_color_mapper\":115,\"models/mappers/continuous_color_mapper\":116,\"models/mappers/color_mapper\":117,\"models/mappers/mapper\":118,\"models/transforms/transform\":119,\"models/scales/linear_scale\":120,\"models/scales/continuous_scale\":121,\"models/scales/scale\":122,\"models/transforms/index\":123,\"models/transforms/customjs_transform\":124,\"models/transforms/dodge\":125,\"models/transforms/interpolator\":126,\"models/transforms/jitter\":127,\"models/transforms/linear_interpolator\":128,\"models/transforms/step_interpolator\":129,\"models/scales/log_scale\":130,\"models/ranges/range1d\":131,\"core/util/text\":132,\"models/annotations/label\":133,\"models/annotations/text_annotation\":134,\"models/annotations/label_set\":135,\"models/annotations/legend\":136,\"models/annotations/legend_item\":137,\"core/vectorization\":138,\"models/annotations/poly_annotation\":139,\"models/annotations/slope\":140,\"models/annotations/span\":141,\"models/annotations/title\":142,\"models/annotations/toolbar_panel\":143,\"models/annotations/tooltip\":144,\"styles/tooltips\":145,\"styles/mixins\":146,\"styles/tooltips.css\":147,\"models/annotations/whisker\":148,\"models/axes/index\":149,\"models/axes/axis\":150,\"models/renderers/guide_renderer\":151,\"models/axes/categorical_axis\":152,\"models/tickers/categorical_ticker\":153,\"models/formatters/categorical_tick_formatter\":154,\"models/axes/continuous_axis\":155,\"models/axes/datetime_axis\":156,\"models/axes/linear_axis\":157,\"models/formatters/datetime_tick_formatter\":158,\"core/util/templating\":160,\"models/tickers/datetime_ticker\":163,\"models/tickers/composite_ticker\":164,\"models/tickers/days_ticker\":165,\"models/tickers/single_interval_ticker\":166,\"models/tickers/util\":167,\"models/tickers/months_ticker\":168,\"models/tickers/years_ticker\":169,\"models/axes/log_axis\":170,\"models/formatters/log_tick_formatter\":171,\"models/tickers/log_ticker\":172,\"models/axes/mercator_axis\":173,\"models/formatters/mercator_tick_formatter\":174,\"models/tickers/mercator_ticker\":175,\"models/callbacks/index\":176,\"models/callbacks/customjs\":177,\"models/callbacks/callback\":178,\"models/callbacks/open_url\":179,\"models/canvas/index\":180,\"models/canvas/canvas\":181,\"core/util/canvas\":182,\"core/util/svg\":183,\"models/canvas/cartesian_frame\":184,\"models/scales/categorical_scale\":185,\"models/ranges/data_range1d\":186,\"models/ranges/data_range\":187,\"core/layout/index\":188,\"core/layout/types\":189,\"core/layout/layoutable\":190,\"core/layout/alignments\":191,\"core/layout/grid\":192,\"core/layout/html\":193,\"models/expressions/index\":194,\"models/expressions/expression\":195,\"models/expressions/stack\":196,\"models/expressions/cumsum\":197,\"models/filters/index\":198,\"models/filters/boolean_filter\":199,\"models/filters/filter\":200,\"models/filters/customjs_filter\":201,\"models/filters/group_filter\":202,\"models/filters/index_filter\":203,\"models/formatters/index\":204,\"models/formatters/func_tick_formatter\":205,\"models/formatters/numeral_tick_formatter\":206,\"models/formatters/printf_tick_formatter\":207,\"models/glyphs/index\":208,\"models/glyphs/annular_wedge\":209,\"models/glyphs/annulus\":210,\"models/glyphs/arc\":211,\"models/glyphs/bezier\":212,\"models/glyphs/circle\":213,\"models/glyphs/center_rotatable\":214,\"models/glyphs/ellipse\":215,\"models/glyphs/ellipse_oval\":216,\"models/glyphs/hbar\":217,\"models/glyphs/box\":218,\"models/glyphs/hex_tile\":219,\"models/glyphs/image\":220,\"models/glyphs/image_base\":221,\"models/glyphs/image_rgba\":222,\"models/glyphs/image_url\":223,\"core/util/image\":224,\"models/glyphs/multi_line\":225,\"models/glyphs/multi_polygons\":226,\"models/glyphs/oval\":227,\"models/glyphs/patches\":228,\"models/glyphs/quad\":229,\"models/glyphs/quadratic\":230,\"models/glyphs/ray\":231,\"models/glyphs/rect\":232,\"models/glyphs/segment\":233,\"models/glyphs/step\":234,\"models/glyphs/text\":235,\"models/glyphs/vbar\":236,\"models/glyphs/wedge\":237,\"models/graphs/index\":238,\"models/graphs/layout_provider\":239,\"models/graphs/static_layout_provider\":240,\"models/grids/index\":241,\"models/grids/grid\":242,\"models/layouts/index\":243,\"models/layouts/box\":244,\"models/layouts/layout_dom\":245,\"styles/root\":246,\"models/layouts/column\":247,\"models/layouts/grid_box\":248,\"models/layouts/html_box\":249,\"models/layouts/row\":250,\"models/layouts/spacer\":251,\"models/layouts/tabs\":252,\"styles/tabs\":253,\"styles/buttons\":254,\"styles/menus\":255,\"styles/buttons.css\":256,\"styles/menus.css\":257,\"styles/tabs.css\":258,\"models/layouts/widget_box\":259,\"models/mappers/index\":260,\"models/mappers/categorical_color_mapper\":261,\"models/mappers/categorical_mapper\":262,\"models/mappers/categorical_marker_mapper\":263,\"models/mappers/categorical_pattern_mapper\":264,\"models/mappers/log_color_mapper\":265,\"models/markers/index\":266,\"models/markers/defs\":267,\"models/markers/marker\":268,\"models/markers/scatter\":269,\"models/plots/index\":270,\"models/plots/gmap_plot\":271,\"models/plots/plot\":272,\"models/tools/toolbar\":273,\"models/tools/inspectors/inspect_tool\":274,\"models/tools/button_tool\":275,\"models/tools/tool\":277,\"styles/toolbar\":278,\"styles/toolbar.css\":279,\"styles/icons.css\":280,\"core/util/menus\":281,\"models/tools/on_off_button\":282,\"models/tools/toolbar_base\":283,\"models/tools/gestures/gesture_tool\":284,\"models/tools/actions/action_tool\":285,\"models/tools/actions/help_tool\":286,\"styles/icons\":287,\"styles/logo\":288,\"styles/logo.css\":289,\"models/plots/plot_canvas\":290,\"core/bokeh_events\":291,\"core/ui_events\":292,\"core/util/wheel\":293,\"core/util/throttle\":294,\"core/layout/side_panel\":295,\"models/plots/gmap_plot_canvas\":296,\"models/ranges/index\":297,\"models/renderers/index\":298,\"models/scales/index\":299,\"models/selections/index\":300,\"models/sources/index\":301,\"models/sources/server_sent_data_source\":302,\"models/sources/web_data_source\":303,\"models/sources/ajax_data_source\":304,\"models/sources/geojson_data_source\":305,\"models/tickers/index\":306,\"models/tickers/fixed_ticker\":307,\"models/tiles/index\":308,\"models/tiles/bbox_tile_source\":309,\"models/tiles/mercator_tile_source\":310,\"models/tiles/tile_source\":311,\"models/tiles/tile_utils\":312,\"models/tiles/quadkey_tile_source\":313,\"models/tiles/tile_renderer\":314,\"models/tiles/wmts_tile_source\":315,\"styles/tiles\":316,\"styles/tiles.css\":317,\"models/tiles/tms_tile_source\":318,\"models/textures/index\":319,\"models/textures/canvas_texture\":320,\"models/textures/texture\":321,\"models/textures/image_url_texture\":322,\"models/tools/index\":323,\"models/tools/actions/custom_action\":324,\"models/tools/actions/redo_tool\":325,\"models/tools/actions/reset_tool\":326,\"models/tools/actions/save_tool\":327,\"models/tools/actions/undo_tool\":328,\"models/tools/actions/zoom_in_tool\":329,\"core/util/zoom\":330,\"models/tools/actions/zoom_out_tool\":331,\"models/tools/edit/edit_tool\":332,\"models/tools/edit/box_edit_tool\":333,\"models/tools/edit/freehand_draw_tool\":334,\"models/tools/edit/point_draw_tool\":335,\"models/tools/edit/poly_draw_tool\":336,\"models/tools/edit/poly_tool\":337,\"models/tools/edit/poly_edit_tool\":338,\"models/tools/gestures/box_select_tool\":339,\"models/tools/gestures/select_tool\":340,\"models/tools/util\":341,\"models/tools/gestures/box_zoom_tool\":342,\"models/tools/gestures/lasso_select_tool\":343,\"models/tools/edit/line_edit_tool\":344,\"models/tools/edit/line_tool\":345,\"models/tools/gestures/pan_tool\":346,\"models/tools/gestures/poly_select_tool\":347,\"models/tools/gestures/range_tool\":348,\"models/tools/gestures/tap_tool\":349,\"models/tools/gestures/wheel_pan_tool\":350,\"models/tools/gestures/wheel_zoom_tool\":351,\"models/tools/inspectors/crosshair_tool\":352,\"models/tools/inspectors/customjs_hover\":353,\"models/tools/inspectors/hover_tool\":354,\"models/tools/tool_proxy\":355,\"core/util/iterator\":356,\"models/tools/toolbar_box\":357,\"embed/standalone\":358,\"embed/dom\":359,\"embed/server\":360,\"client/connection\":361,\"protocol/message\":362,\"protocol/receiver\":363,\"client/session\":364,\"embed/notebook\":365,\"styles/notebook.css\":366,\"protocol/index\":367,\"testing\":368,\"safely\":369}, {});\n", " })\n", "\n", " //# sourceMappingURL=bokeh.js.map\n", "\n", " /* END bokeh.js */\n", " },\n", " \n", " function(Bokeh) {\n", " /* BEGIN bokeh-widgets.js */\n", " /*!\n", " * Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors\n", " * All rights reserved.\n", " * \n", " * Redistribution and use in source and binary forms, with or without modification,\n", " * are permitted provided that the following conditions are met:\n", " * \n", " * Redistributions of source code must retain the above copyright notice,\n", " * this list of conditions and the following disclaimer.\n", " * \n", " * Redistributions in binary form must reproduce the above copyright notice,\n", " * this list of conditions and the following disclaimer in the documentation\n", " * and/or other materials provided with the distribution.\n", " * \n", " * Neither the name of Anaconda nor the names of any contributors\n", " * may be used to endorse or promote products derived from this software\n", " * without specific prior written permission.\n", " * \n", " * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n", " * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n", " * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n", " * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n", " * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n", " * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n", " * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n", " * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n", " * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n", " * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n", " * THE POSSIBILITY OF SUCH DAMAGE.\n", " */\n", " (function(root, factory) {\n", " factory(root[\"Bokeh\"], \"2.1.1\");\n", " })(this, function(Bokeh, version) {\n", " var define;\n", " return (function(modules, entry, aliases, externals) {\n", " const bokeh = typeof Bokeh !== \"undefined\" && (version != null ? Bokeh[version] : Bokeh);\n", " if (bokeh != null) {\n", " return bokeh.register_plugin(modules, entry, aliases);\n", " } else {\n", " throw new Error(\"Cannot find Bokeh \" + version + \". You have to load it prior to loading plugins.\");\n", " }\n", " })\n", " ({\n", " 390: /* models/widgets/main.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const Widgets = tslib_1.__importStar(require(391) /* ./index */);\n", " exports.Widgets = Widgets;\n", " const base_1 = require(7) /* ../../base */;\n", " base_1.register_models(Widgets);\n", " },\n", " 391: /* models/widgets/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " var abstract_button_1 = require(392) /* ./abstract_button */;\n", " exports.AbstractButton = abstract_button_1.AbstractButton;\n", " var abstract_icon_1 = require(395) /* ./abstract_icon */;\n", " exports.AbstractIcon = abstract_icon_1.AbstractIcon;\n", " var autocomplete_input_1 = require(396) /* ./autocomplete_input */;\n", " exports.AutocompleteInput = autocomplete_input_1.AutocompleteInput;\n", " var button_1 = require(401) /* ./button */;\n", " exports.Button = button_1.Button;\n", " var checkbox_button_group_1 = require(402) /* ./checkbox_button_group */;\n", " exports.CheckboxButtonGroup = checkbox_button_group_1.CheckboxButtonGroup;\n", " var checkbox_group_1 = require(404) /* ./checkbox_group */;\n", " exports.CheckboxGroup = checkbox_group_1.CheckboxGroup;\n", " var color_picker_1 = require(406) /* ./color_picker */;\n", " exports.ColorPicker = color_picker_1.ColorPicker;\n", " var date_picker_1 = require(407) /* ./date_picker */;\n", " exports.DatePicker = date_picker_1.DatePicker;\n", " var date_range_slider_1 = require(410) /* ./date_range_slider */;\n", " exports.DateRangeSlider = date_range_slider_1.DateRangeSlider;\n", " var date_slider_1 = require(416) /* ./date_slider */;\n", " exports.DateSlider = date_slider_1.DateSlider;\n", " var div_1 = require(417) /* ./div */;\n", " exports.Div = div_1.Div;\n", " var dropdown_1 = require(421) /* ./dropdown */;\n", " exports.Dropdown = dropdown_1.Dropdown;\n", " var file_input_1 = require(422) /* ./file_input */;\n", " exports.FileInput = file_input_1.FileInput;\n", " var input_widget_1 = require(398) /* ./input_widget */;\n", " exports.InputWidget = input_widget_1.InputWidget;\n", " var markup_1 = require(418) /* ./markup */;\n", " exports.Markup = markup_1.Markup;\n", " var multiselect_1 = require(423) /* ./multiselect */;\n", " exports.MultiSelect = multiselect_1.MultiSelect;\n", " var paragraph_1 = require(424) /* ./paragraph */;\n", " exports.Paragraph = paragraph_1.Paragraph;\n", " var password_input_1 = require(425) /* ./password_input */;\n", " exports.PasswordInput = password_input_1.PasswordInput;\n", " var multichoice_1 = require(426) /* ./multichoice */;\n", " exports.MultiChoice = multichoice_1.MultiChoice;\n", " var pretext_1 = require(429) /* ./pretext */;\n", " exports.PreText = pretext_1.PreText;\n", " var radio_button_group_1 = require(430) /* ./radio_button_group */;\n", " exports.RadioButtonGroup = radio_button_group_1.RadioButtonGroup;\n", " var radio_group_1 = require(431) /* ./radio_group */;\n", " exports.RadioGroup = radio_group_1.RadioGroup;\n", " var range_slider_1 = require(432) /* ./range_slider */;\n", " exports.RangeSlider = range_slider_1.RangeSlider;\n", " var selectbox_1 = require(433) /* ./selectbox */;\n", " exports.Select = selectbox_1.Select;\n", " var slider_1 = require(434) /* ./slider */;\n", " exports.Slider = slider_1.Slider;\n", " var spinner_1 = require(435) /* ./spinner */;\n", " exports.Spinner = spinner_1.Spinner;\n", " var text_input_1 = require(397) /* ./text_input */;\n", " exports.TextInput = text_input_1.TextInput;\n", " var textarea_input_1 = require(436) /* ./textarea_input */;\n", " exports.TextAreaInput = textarea_input_1.TextAreaInput;\n", " var toggle_1 = require(437) /* ./toggle */;\n", " exports.Toggle = toggle_1.Toggle;\n", " var widget_1 = require(458) /* ./widget */;\n", " exports.Widget = widget_1.Widget;\n", " },\n", " 392: /* models/widgets/abstract_button.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const build_views_1 = require(99) /* ../../core/build_views */;\n", " const control_1 = require(393) /* ./control */;\n", " const buttons_1 = require(254) /* ../../styles/buttons */;\n", " const buttons_css_1 = tslib_1.__importDefault(require(256) /* ../../styles/buttons.css */);\n", " class AbstractButtonView extends control_1.ControlView {\n", " *controls() {\n", " yield this.button_el;\n", " }\n", " async lazy_initialize() {\n", " await super.lazy_initialize();\n", " const { icon } = this.model;\n", " if (icon != null) {\n", " this.icon_view = await build_views_1.build_view(icon, { parent: this });\n", " }\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.change, () => this.render());\n", " }\n", " remove() {\n", " if (this.icon_view != null)\n", " this.icon_view.remove();\n", " super.remove();\n", " }\n", " styles() {\n", " return [...super.styles(), buttons_css_1.default];\n", " }\n", " _render_button(...children) {\n", " return dom_1.button({\n", " type: \"button\",\n", " disabled: this.model.disabled,\n", " class: [buttons_1.bk_btn, buttons_1.bk_btn_type(this.model.button_type)],\n", " }, ...children);\n", " }\n", " render() {\n", " super.render();\n", " this.button_el = this._render_button(this.model.label);\n", " this.button_el.addEventListener(\"click\", () => this.click());\n", " if (this.icon_view != null) {\n", " dom_1.prepend(this.button_el, this.icon_view.el, dom_1.nbsp());\n", " this.icon_view.render();\n", " }\n", " this.group_el = dom_1.div({ class: buttons_1.bk_btn_group }, this.button_el);\n", " this.el.appendChild(this.group_el);\n", " }\n", " click() { }\n", " }\n", " exports.AbstractButtonView = AbstractButtonView;\n", " AbstractButtonView.__name__ = \"AbstractButtonView\";\n", " class AbstractButton extends control_1.Control {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_AbstractButton() {\n", " this.define({\n", " label: [p.String, \"Button\"],\n", " icon: [p.Instance],\n", " button_type: [p.ButtonType, \"default\"],\n", " });\n", " }\n", " }\n", " exports.AbstractButton = AbstractButton;\n", " AbstractButton.__name__ = \"AbstractButton\";\n", " AbstractButton.init_AbstractButton();\n", " },\n", " 393: /* models/widgets/control.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const widget_1 = require(458) /* ./widget */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " class ControlView extends widget_1.WidgetView {\n", " connect_signals() {\n", " super.connect_signals();\n", " const p = this.model.properties;\n", " this.on_change(p.disabled, () => {\n", " for (const el of this.controls()) {\n", " dom_1.toggle_attribute(el, \"disabled\", this.model.disabled);\n", " }\n", " });\n", " }\n", " }\n", " exports.ControlView = ControlView;\n", " ControlView.__name__ = \"ControlView\";\n", " class Control extends widget_1.Widget {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " }\n", " exports.Control = Control;\n", " Control.__name__ = \"Control\";\n", " },\n", " 458: /* models/widgets/widget.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const html_box_1 = require(249) /* ../layouts/html_box */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class WidgetView extends html_box_1.HTMLBoxView {\n", " _width_policy() {\n", " return this.model.orientation == \"horizontal\" ? super._width_policy() : \"fixed\";\n", " }\n", " _height_policy() {\n", " return this.model.orientation == \"horizontal\" ? \"fixed\" : super._height_policy();\n", " }\n", " box_sizing() {\n", " const sizing = super.box_sizing();\n", " if (this.model.orientation == \"horizontal\") {\n", " if (sizing.width == null)\n", " sizing.width = this.model.default_size;\n", " }\n", " else {\n", " if (sizing.height == null)\n", " sizing.height = this.model.default_size;\n", " }\n", " return sizing;\n", " }\n", " }\n", " exports.WidgetView = WidgetView;\n", " WidgetView.__name__ = \"WidgetView\";\n", " class Widget extends html_box_1.HTMLBox {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Widget() {\n", " this.define({\n", " orientation: [p.Orientation, \"horizontal\"],\n", " default_size: [p.Number, 300],\n", " });\n", " this.override({\n", " margin: [5, 5, 5, 5],\n", " });\n", " }\n", " }\n", " exports.Widget = Widget;\n", " Widget.__name__ = \"Widget\";\n", " Widget.init_Widget();\n", " },\n", " 395: /* models/widgets/abstract_icon.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const model_1 = require(71) /* ../../model */;\n", " const dom_view_1 = require(66) /* ../../core/dom_view */;\n", " class AbstractIconView extends dom_view_1.DOMView {\n", " }\n", " exports.AbstractIconView = AbstractIconView;\n", " AbstractIconView.__name__ = \"AbstractIconView\";\n", " class AbstractIcon extends model_1.Model {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " }\n", " exports.AbstractIcon = AbstractIcon;\n", " AbstractIcon.__name__ = \"AbstractIcon\";\n", " },\n", " 396: /* models/widgets/autocomplete_input.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const text_input_1 = require(397) /* ./text_input */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const math_1 = require(10) /* ../../core/util/math */;\n", " const mixins_1 = require(146) /* ../../styles/mixins */;\n", " const menus_1 = require(255) /* ../../styles/menus */;\n", " const menus_css_1 = tslib_1.__importDefault(require(257) /* ../../styles/menus.css */);\n", " class AutocompleteInputView extends text_input_1.TextInputView {\n", " constructor() {\n", " super(...arguments);\n", " this._open = false;\n", " this._last_value = \"\";\n", " this._hover_index = 0;\n", " }\n", " styles() {\n", " return [...super.styles(), menus_css_1.default];\n", " }\n", " render() {\n", " super.render();\n", " this.input_el.addEventListener(\"keydown\", (event) => this._keydown(event));\n", " this.input_el.addEventListener(\"keyup\", (event) => this._keyup(event));\n", " this.menu = dom_1.div({ class: [menus_1.bk_menu, mixins_1.bk_below] });\n", " this.menu.addEventListener(\"click\", (event) => this._menu_click(event));\n", " this.menu.addEventListener(\"mouseover\", (event) => this._menu_hover(event));\n", " this.el.appendChild(this.menu);\n", " dom_1.undisplay(this.menu);\n", " }\n", " change_input() {\n", " if (this._open && this.menu.children.length > 0) {\n", " this.model.value = this.menu.children[this._hover_index].textContent;\n", " this.input_el.focus();\n", " this._hide_menu();\n", " }\n", " }\n", " _update_completions(completions) {\n", " dom_1.empty(this.menu);\n", " for (const text of completions) {\n", " const item = dom_1.div({}, text);\n", " this.menu.appendChild(item);\n", " }\n", " if (completions.length > 0)\n", " this.menu.children[0].classList.add(mixins_1.bk_active);\n", " }\n", " _show_menu() {\n", " if (!this._open) {\n", " this._open = true;\n", " this._hover_index = 0;\n", " this._last_value = this.model.value;\n", " dom_1.display(this.menu);\n", " const listener = (event) => {\n", " const { target } = event;\n", " if (target instanceof HTMLElement && !this.el.contains(target)) {\n", " document.removeEventListener(\"click\", listener);\n", " this._hide_menu();\n", " }\n", " };\n", " document.addEventListener(\"click\", listener);\n", " }\n", " }\n", " _hide_menu() {\n", " if (this._open) {\n", " this._open = false;\n", " dom_1.undisplay(this.menu);\n", " }\n", " }\n", " _menu_click(event) {\n", " if (event.target != event.currentTarget && event.target instanceof Element) {\n", " this.model.value = event.target.textContent;\n", " this.input_el.focus();\n", " this._hide_menu();\n", " }\n", " }\n", " _menu_hover(event) {\n", " if (event.target != event.currentTarget && event.target instanceof Element) {\n", " let i = 0;\n", " for (i = 0; i < this.menu.children.length; i++) {\n", " if (this.menu.children[i].textContent == event.target.textContent)\n", " break;\n", " }\n", " this._bump_hover(i);\n", " }\n", " }\n", " _bump_hover(new_index) {\n", " const n_children = this.menu.children.length;\n", " if (this._open && n_children > 0) {\n", " this.menu.children[this._hover_index].classList.remove(mixins_1.bk_active);\n", " this._hover_index = math_1.clamp(new_index, 0, n_children - 1);\n", " this.menu.children[this._hover_index].classList.add(mixins_1.bk_active);\n", " }\n", " }\n", " _keydown(_event) { }\n", " _keyup(event) {\n", " switch (event.keyCode) {\n", " case dom_1.Keys.Enter: {\n", " this.change_input();\n", " break;\n", " }\n", " case dom_1.Keys.Esc: {\n", " this._hide_menu();\n", " break;\n", " }\n", " case dom_1.Keys.Up: {\n", " this._bump_hover(this._hover_index - 1);\n", " break;\n", " }\n", " case dom_1.Keys.Down: {\n", " this._bump_hover(this._hover_index + 1);\n", " break;\n", " }\n", " default: {\n", " const value = this.input_el.value;\n", " if (value.length < this.model.min_characters) {\n", " this._hide_menu();\n", " return;\n", " }\n", " const completions = [];\n", " const { case_sensitive } = this.model;\n", " let acnorm;\n", " if (case_sensitive) {\n", " acnorm = (t) => t;\n", " }\n", " else {\n", " acnorm = (t) => t.toLowerCase();\n", " }\n", " for (const text of this.model.completions) {\n", " if (acnorm(text).startsWith(acnorm(value))) {\n", " completions.push(text);\n", " }\n", " }\n", " this._update_completions(completions);\n", " if (completions.length == 0)\n", " this._hide_menu();\n", " else\n", " this._show_menu();\n", " }\n", " }\n", " }\n", " }\n", " exports.AutocompleteInputView = AutocompleteInputView;\n", " AutocompleteInputView.__name__ = \"AutocompleteInputView\";\n", " class AutocompleteInput extends text_input_1.TextInput {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_AutocompleteInput() {\n", " this.prototype.default_view = AutocompleteInputView;\n", " this.define({\n", " completions: [p.Array, []],\n", " min_characters: [p.Int, 2],\n", " case_sensitive: [p.Boolean, true],\n", " });\n", " }\n", " }\n", " exports.AutocompleteInput = AutocompleteInput;\n", " AutocompleteInput.__name__ = \"AutocompleteInput\";\n", " AutocompleteInput.init_AutocompleteInput();\n", " },\n", " 397: /* models/widgets/text_input.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const input_widget_1 = require(398) /* ./input_widget */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const inputs_1 = require(400) /* ../../styles/widgets/inputs */;\n", " class TextInputView extends input_widget_1.InputWidgetView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.name.change, () => this.input_el.name = this.model.name || \"\");\n", " this.connect(this.model.properties.value.change, () => this.input_el.value = this.model.value);\n", " this.connect(this.model.properties.value_input.change, () => this.input_el.value = this.model.value_input);\n", " this.connect(this.model.properties.disabled.change, () => this.input_el.disabled = this.model.disabled);\n", " this.connect(this.model.properties.placeholder.change, () => this.input_el.placeholder = this.model.placeholder);\n", " }\n", " render() {\n", " super.render();\n", " this.input_el = dom_1.input({\n", " type: \"text\",\n", " class: inputs_1.bk_input,\n", " name: this.model.name,\n", " value: this.model.value,\n", " disabled: this.model.disabled,\n", " placeholder: this.model.placeholder,\n", " });\n", " this.input_el.addEventListener(\"change\", () => this.change_input());\n", " this.input_el.addEventListener(\"input\", () => this.change_input_oninput());\n", " this.group_el.appendChild(this.input_el);\n", " }\n", " change_input() {\n", " this.model.value = this.input_el.value;\n", " super.change_input();\n", " }\n", " change_input_oninput() {\n", " this.model.value_input = this.input_el.value;\n", " super.change_input();\n", " }\n", " }\n", " exports.TextInputView = TextInputView;\n", " TextInputView.__name__ = \"TextInputView\";\n", " class TextInput extends input_widget_1.InputWidget {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_TextInput() {\n", " this.prototype.default_view = TextInputView;\n", " this.define({\n", " value: [p.String, \"\"],\n", " value_input: [p.String, \"\"],\n", " placeholder: [p.String, \"\"],\n", " });\n", " }\n", " }\n", " exports.TextInput = TextInput;\n", " TextInput.__name__ = \"TextInput\";\n", " TextInput.init_TextInput();\n", " },\n", " 398: /* models/widgets/input_widget.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const control_1 = require(393) /* ./control */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const inputs_css_1 = tslib_1.__importDefault(require(399) /* ../../styles/widgets/inputs.css */);\n", " const inputs_1 = require(400) /* ../../styles/widgets/inputs */;\n", " class InputWidgetView extends control_1.ControlView {\n", " *controls() {\n", " yield this.input_el;\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.title.change, () => {\n", " this.label_el.textContent = this.model.title;\n", " });\n", " }\n", " styles() {\n", " return [...super.styles(), inputs_css_1.default];\n", " }\n", " render() {\n", " super.render();\n", " const { title } = this.model;\n", " this.label_el = dom_1.label({ style: { display: title.length == 0 ? \"none\" : \"\" } }, title);\n", " this.group_el = dom_1.div({ class: inputs_1.bk_input_group }, this.label_el);\n", " this.el.appendChild(this.group_el);\n", " }\n", " change_input() { }\n", " }\n", " exports.InputWidgetView = InputWidgetView;\n", " InputWidgetView.__name__ = \"InputWidgetView\";\n", " class InputWidget extends control_1.Control {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_InputWidget() {\n", " this.define({\n", " title: [p.String, \"\"],\n", " });\n", " }\n", " }\n", " exports.InputWidget = InputWidget;\n", " InputWidget.__name__ = \"InputWidget\";\n", " InputWidget.init_InputWidget();\n", " },\n", " 399: /* styles/widgets/inputs.css.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const css = `\n", " .bk-root .bk-input {\n", " display: inline-block;\n", " width: 100%;\n", " flex-grow: 1;\n", " -webkit-flex-grow: 1;\n", " min-height: 31px;\n", " padding: 0 12px;\n", " background-color: #fff;\n", " border: 1px solid #ccc;\n", " border-radius: 4px;\n", " }\n", " .bk-root .bk-input:focus {\n", " border-color: #66afe9;\n", " outline: 0;\n", " box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);\n", " }\n", " .bk-root .bk-input::placeholder,\n", " .bk-root .bk-input:-ms-input-placeholder,\n", " .bk-root .bk-input::-moz-placeholder,\n", " .bk-root .bk-input::-webkit-input-placeholder {\n", " color: #999;\n", " opacity: 1;\n", " }\n", " .bk-root .bk-input[disabled] {\n", " cursor: not-allowed;\n", " background-color: #eee;\n", " opacity: 1;\n", " }\n", " .bk-root select:not([multiple]).bk-input,\n", " .bk-root select:not([size]).bk-input {\n", " height: auto;\n", " appearance: none;\n", " -webkit-appearance: none;\n", " background-image: url('data:image/svg+xml;utf8,');\n", " background-position: right 0.5em center;\n", " background-size: 8px 6px;\n", " background-repeat: no-repeat;\n", " }\n", " .bk-root select[multiple].bk-input,\n", " .bk-root select[size].bk-input,\n", " .bk-root textarea.bk-input {\n", " height: auto;\n", " }\n", " .bk-root .bk-input-group {\n", " width: 100%;\n", " height: 100%;\n", " display: inline-flex;\n", " display: -webkit-inline-flex;\n", " flex-wrap: nowrap;\n", " -webkit-flex-wrap: nowrap;\n", " align-items: start;\n", " -webkit-align-items: start;\n", " flex-direction: column;\n", " -webkit-flex-direction: column;\n", " white-space: nowrap;\n", " }\n", " .bk-root .bk-input-group.bk-inline {\n", " flex-direction: row;\n", " -webkit-flex-direction: row;\n", " }\n", " .bk-root .bk-input-group.bk-inline > *:not(:first-child) {\n", " margin-left: 5px;\n", " }\n", " .bk-root .bk-input-group input[type=\"checkbox\"] + span,\n", " .bk-root .bk-input-group input[type=\"radio\"] + span {\n", " position: relative;\n", " top: -2px;\n", " margin-left: 3px;\n", " }\n", " `;\n", " exports.default = css;\n", " },\n", " 400: /* styles/widgets/inputs.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.bk_input = \"bk-input\";\n", " exports.bk_input_group = \"bk-input-group\";\n", " },\n", " 401: /* models/widgets/button.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const abstract_button_1 = require(392) /* ./abstract_button */;\n", " const bokeh_events_1 = require(291) /* ../../core/bokeh_events */;\n", " class ButtonView extends abstract_button_1.AbstractButtonView {\n", " click() {\n", " this.model.clicks = this.model.clicks + 1;\n", " this.model.trigger_event(new bokeh_events_1.ButtonClick());\n", " super.click();\n", " }\n", " }\n", " exports.ButtonView = ButtonView;\n", " ButtonView.__name__ = \"ButtonView\";\n", " class Button extends abstract_button_1.AbstractButton {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Button() {\n", " this.prototype.default_view = ButtonView;\n", " this.override({\n", " label: \"Button\",\n", " });\n", " }\n", " }\n", " exports.Button = Button;\n", " Button.__name__ = \"Button\";\n", " Button.init_Button();\n", " },\n", " 402: /* models/widgets/checkbox_button_group.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const button_group_1 = require(403) /* ./button_group */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const mixins_1 = require(146) /* ../../styles/mixins */;\n", " class CheckboxButtonGroupView extends button_group_1.ButtonGroupView {\n", " get active() {\n", " return new Set(this.model.active);\n", " }\n", " change_active(i) {\n", " const { active } = this;\n", " active.has(i) ? active.delete(i) : active.add(i);\n", " this.model.active = [...active].sort();\n", " }\n", " _update_active() {\n", " const { active } = this;\n", " this._buttons.forEach((button, i) => {\n", " dom_1.classes(button).toggle(mixins_1.bk_active, active.has(i));\n", " });\n", " }\n", " }\n", " exports.CheckboxButtonGroupView = CheckboxButtonGroupView;\n", " CheckboxButtonGroupView.__name__ = \"CheckboxButtonGroupView\";\n", " class CheckboxButtonGroup extends button_group_1.ButtonGroup {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_CheckboxButtonGroup() {\n", " this.prototype.default_view = CheckboxButtonGroupView;\n", " this.define({\n", " active: [p.Array, []],\n", " });\n", " }\n", " }\n", " exports.CheckboxButtonGroup = CheckboxButtonGroup;\n", " CheckboxButtonGroup.__name__ = \"CheckboxButtonGroup\";\n", " CheckboxButtonGroup.init_CheckboxButtonGroup();\n", " },\n", " 403: /* models/widgets/button_group.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const control_1 = require(393) /* ./control */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const buttons_1 = require(254) /* ../../styles/buttons */;\n", " const buttons_css_1 = tslib_1.__importDefault(require(256) /* ../../styles/buttons.css */);\n", " class ButtonGroupView extends control_1.ControlView {\n", " *controls() {\n", " yield* this._buttons; // TODO: HTMLButtonElement[]\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " const p = this.model.properties;\n", " this.on_change(p.button_type, () => this.render());\n", " this.on_change(p.labels, () => this.render());\n", " this.on_change(p.active, () => this._update_active());\n", " }\n", " styles() {\n", " return [...super.styles(), buttons_css_1.default];\n", " }\n", " render() {\n", " super.render();\n", " this._buttons = this.model.labels.map((label, i) => {\n", " const button = dom_1.div({\n", " class: [buttons_1.bk_btn, buttons_1.bk_btn_type(this.model.button_type)],\n", " disabled: this.model.disabled,\n", " }, label);\n", " button.addEventListener(\"click\", () => this.change_active(i));\n", " return button;\n", " });\n", " this._update_active();\n", " const group = dom_1.div({ class: buttons_1.bk_btn_group }, this._buttons);\n", " this.el.appendChild(group);\n", " }\n", " }\n", " exports.ButtonGroupView = ButtonGroupView;\n", " ButtonGroupView.__name__ = \"ButtonGroupView\";\n", " class ButtonGroup extends control_1.Control {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ButtonGroup() {\n", " this.define({\n", " labels: [p.Array, []],\n", " button_type: [p.ButtonType, \"default\"],\n", " });\n", " }\n", " }\n", " exports.ButtonGroup = ButtonGroup;\n", " ButtonGroup.__name__ = \"ButtonGroup\";\n", " ButtonGroup.init_ButtonGroup();\n", " },\n", " 404: /* models/widgets/checkbox_group.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const input_group_1 = require(405) /* ./input_group */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const mixins_1 = require(146) /* ../../styles/mixins */;\n", " const inputs_1 = require(400) /* ../../styles/widgets/inputs */;\n", " class CheckboxGroupView extends input_group_1.InputGroupView {\n", " render() {\n", " super.render();\n", " const group = dom_1.div({ class: [inputs_1.bk_input_group, this.model.inline ? mixins_1.bk_inline : null] });\n", " this.el.appendChild(group);\n", " const { active, labels } = this.model;\n", " this._inputs = [];\n", " for (let i = 0; i < labels.length; i++) {\n", " const checkbox = dom_1.input({ type: `checkbox`, value: `${i}` });\n", " checkbox.addEventListener(\"change\", () => this.change_active(i));\n", " this._inputs.push(checkbox);\n", " if (this.model.disabled)\n", " checkbox.disabled = true;\n", " if (array_1.includes(active, i))\n", " checkbox.checked = true;\n", " const label_el = dom_1.label({}, checkbox, dom_1.span({}, labels[i]));\n", " group.appendChild(label_el);\n", " }\n", " }\n", " change_active(i) {\n", " const active = new Set(this.model.active);\n", " active.has(i) ? active.delete(i) : active.add(i);\n", " this.model.active = [...active].sort();\n", " }\n", " }\n", " exports.CheckboxGroupView = CheckboxGroupView;\n", " CheckboxGroupView.__name__ = \"CheckboxGroupView\";\n", " class CheckboxGroup extends input_group_1.InputGroup {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_CheckboxGroup() {\n", " this.prototype.default_view = CheckboxGroupView;\n", " this.define({\n", " active: [p.Array, []],\n", " labels: [p.Array, []],\n", " inline: [p.Boolean, false],\n", " });\n", " }\n", " }\n", " exports.CheckboxGroup = CheckboxGroup;\n", " CheckboxGroup.__name__ = \"CheckboxGroup\";\n", " CheckboxGroup.init_CheckboxGroup();\n", " },\n", " 405: /* models/widgets/input_group.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const control_1 = require(393) /* ./control */;\n", " const inputs_css_1 = tslib_1.__importDefault(require(399) /* ../../styles/widgets/inputs.css */);\n", " class InputGroupView extends control_1.ControlView {\n", " *controls() {\n", " yield* this._inputs;\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.change, () => this.render());\n", " }\n", " styles() {\n", " return [...super.styles(), inputs_css_1.default];\n", " }\n", " }\n", " exports.InputGroupView = InputGroupView;\n", " InputGroupView.__name__ = \"InputGroupView\";\n", " class InputGroup extends control_1.Control {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " }\n", " exports.InputGroup = InputGroup;\n", " InputGroup.__name__ = \"InputGroup\";\n", " },\n", " 406: /* models/widgets/color_picker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const input_widget_1 = require(398) /* ./input_widget */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const inputs_1 = require(400) /* ../../styles/widgets/inputs */;\n", " class ColorPickerView extends input_widget_1.InputWidgetView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.name.change, () => this.input_el.name = this.model.name || \"\");\n", " this.connect(this.model.properties.color.change, () => this.input_el.value = this.model.color);\n", " this.connect(this.model.properties.disabled.change, () => this.input_el.disabled = this.model.disabled);\n", " }\n", " render() {\n", " super.render();\n", " this.input_el = dom_1.input({\n", " type: \"color\",\n", " class: inputs_1.bk_input,\n", " name: this.model.name,\n", " value: this.model.color,\n", " disabled: this.model.disabled,\n", " });\n", " this.input_el.addEventListener(\"change\", () => this.change_input());\n", " this.group_el.appendChild(this.input_el);\n", " }\n", " change_input() {\n", " this.model.color = this.input_el.value;\n", " super.change_input();\n", " }\n", " }\n", " exports.ColorPickerView = ColorPickerView;\n", " ColorPickerView.__name__ = \"ColorPickerView\";\n", " class ColorPicker extends input_widget_1.InputWidget {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_ColorPicker() {\n", " this.prototype.default_view = ColorPickerView;\n", " this.define({\n", " color: [p.Color, \"#000000\"],\n", " });\n", " }\n", " }\n", " exports.ColorPicker = ColorPicker;\n", " ColorPicker.__name__ = \"ColorPicker\";\n", " ColorPicker.init_ColorPicker();\n", " },\n", " 407: /* models/widgets/date_picker.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const flatpickr_1 = tslib_1.__importDefault(require(408) /* flatpickr */);\n", " const input_widget_1 = require(398) /* ./input_widget */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const inputs_1 = require(400) /* ../../styles/widgets/inputs */;\n", " const flatpickr_css_1 = tslib_1.__importDefault(require(409) /* ../../styles/widgets/flatpickr.css */);\n", " function _convert_date_list(value) {\n", " const result = [];\n", " for (const item of value) {\n", " if (types_1.isString(item))\n", " result.push(item);\n", " else {\n", " const [from, to] = item;\n", " result.push({ from, to });\n", " }\n", " }\n", " return result;\n", " }\n", " class DatePickerView extends input_widget_1.InputWidgetView {\n", " connect_signals() {\n", " super.connect_signals();\n", " const { value, min_date, max_date, disabled_dates, enabled_dates, position, inline } = this.model.properties;\n", " this.connect(value.change, () => { var _a; return (_a = this._picker) === null || _a === void 0 ? void 0 : _a.setDate(value.value()); });\n", " this.connect(min_date.change, () => { var _a; return (_a = this._picker) === null || _a === void 0 ? void 0 : _a.set(\"minDate\", min_date.value()); });\n", " this.connect(max_date.change, () => { var _a; return (_a = this._picker) === null || _a === void 0 ? void 0 : _a.set(\"maxDate\", max_date.value()); });\n", " this.connect(disabled_dates.change, () => { var _a; return (_a = this._picker) === null || _a === void 0 ? void 0 : _a.set(\"disable\", disabled_dates.value()); });\n", " this.connect(enabled_dates.change, () => { var _a; return (_a = this._picker) === null || _a === void 0 ? void 0 : _a.set(\"enable\", enabled_dates.value()); });\n", " this.connect(position.change, () => { var _a; return (_a = this._picker) === null || _a === void 0 ? void 0 : _a.set(\"position\", position.value()); });\n", " this.connect(inline.change, () => { var _a; return (_a = this._picker) === null || _a === void 0 ? void 0 : _a.set(\"inline\", inline.value()); });\n", " }\n", " remove() {\n", " var _a;\n", " (_a = this._picker) === null || _a === void 0 ? void 0 : _a.destroy();\n", " super.remove();\n", " }\n", " styles() {\n", " return [...super.styles(), flatpickr_css_1.default];\n", " }\n", " render() {\n", " if (this._picker != null)\n", " return;\n", " super.render();\n", " this.input_el = dom_1.input({ type: \"text\", class: inputs_1.bk_input, disabled: this.model.disabled });\n", " this.group_el.appendChild(this.input_el);\n", " this._picker = flatpickr_1.default(this.input_el, {\n", " defaultDate: this.model.value,\n", " minDate: this.model.min_date,\n", " maxDate: this.model.max_date,\n", " inline: this.model.inline,\n", " position: this.model.position,\n", " disable: _convert_date_list(this.model.disabled_dates),\n", " enable: _convert_date_list(this.model.enabled_dates),\n", " onChange: (selected_dates, date_string, instance) => this._on_change(selected_dates, date_string, instance),\n", " });\n", " }\n", " _on_change(_selected_dates, date_string, _instance) {\n", " this.model.value = date_string;\n", " this.change_input();\n", " }\n", " }\n", " exports.DatePickerView = DatePickerView;\n", " DatePickerView.__name__ = \"DatePickerView\";\n", " class DatePicker extends input_widget_1.InputWidget {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_DatePicker() {\n", " this.prototype.default_view = DatePickerView;\n", " this.define({\n", " value: [p.Any],\n", " min_date: [p.Any],\n", " max_date: [p.Any],\n", " disabled_dates: [p.Any, []],\n", " enabled_dates: [p.Any, []],\n", " position: [p.CalendarPosition, \"auto\"],\n", " inline: [p.Boolean, false],\n", " });\n", " }\n", " }\n", " exports.DatePicker = DatePicker;\n", " DatePicker.__name__ = \"DatePicker\";\n", " DatePicker.init_DatePicker();\n", " },\n", " 408: /* flatpickr/dist/flatpickr.js */ function _(require, module, exports) {\n", " /* flatpickr v4.6.3, @license MIT */\n", " (function (global, factory) {\n", " typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n", " typeof define === 'function' && define.amd ? define(factory) :\n", " (global = global || self, global.flatpickr = factory());\n", " }(this, function () {\n", " 'use strict';\n", " /*! *****************************************************************************\n", " Copyright (c) Microsoft Corporation. All rights reserved.\n", " Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use\n", " this file except in compliance with the License. You may obtain a copy of the\n", " License at http://www.apache.org/licenses/LICENSE-2.0\n", " \n", " THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n", " KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\n", " WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\n", " MERCHANTABLITY OR NON-INFRINGEMENT.\n", " \n", " See the Apache Version 2.0 License for specific language governing permissions\n", " and limitations under the License.\n", " ***************************************************************************** */\n", " var __assign = function () {\n", " __assign = Object.assign || function __assign(t) {\n", " for (var s, i = 1, n = arguments.length; i < n; i++) {\n", " s = arguments[i];\n", " for (var p in s)\n", " if (Object.prototype.hasOwnProperty.call(s, p))\n", " t[p] = s[p];\n", " }\n", " return t;\n", " };\n", " return __assign.apply(this, arguments);\n", " };\n", " var HOOKS = [\n", " \"onChange\",\n", " \"onClose\",\n", " \"onDayCreate\",\n", " \"onDestroy\",\n", " \"onKeyDown\",\n", " \"onMonthChange\",\n", " \"onOpen\",\n", " \"onParseConfig\",\n", " \"onReady\",\n", " \"onValueUpdate\",\n", " \"onYearChange\",\n", " \"onPreCalendarPosition\",\n", " ];\n", " var defaults = {\n", " _disable: [],\n", " _enable: [],\n", " allowInput: false,\n", " altFormat: \"F j, Y\",\n", " altInput: false,\n", " altInputClass: \"form-control input\",\n", " animate: typeof window === \"object\" &&\n", " window.navigator.userAgent.indexOf(\"MSIE\") === -1,\n", " ariaDateFormat: \"F j, Y\",\n", " clickOpens: true,\n", " closeOnSelect: true,\n", " conjunction: \", \",\n", " dateFormat: \"Y-m-d\",\n", " defaultHour: 12,\n", " defaultMinute: 0,\n", " defaultSeconds: 0,\n", " disable: [],\n", " disableMobile: false,\n", " enable: [],\n", " enableSeconds: false,\n", " enableTime: false,\n", " errorHandler: function (err) {\n", " return typeof console !== \"undefined\" && console.warn(err);\n", " },\n", " getWeek: function (givenDate) {\n", " var date = new Date(givenDate.getTime());\n", " date.setHours(0, 0, 0, 0);\n", " // Thursday in current week decides the year.\n", " date.setDate(date.getDate() + 3 - ((date.getDay() + 6) % 7));\n", " // January 4 is always in week 1.\n", " var week1 = new Date(date.getFullYear(), 0, 4);\n", " // Adjust to Thursday in week 1 and count number of weeks from date to week1.\n", " return (1 +\n", " Math.round(((date.getTime() - week1.getTime()) / 86400000 -\n", " 3 +\n", " ((week1.getDay() + 6) % 7)) /\n", " 7));\n", " },\n", " hourIncrement: 1,\n", " ignoredFocusElements: [],\n", " inline: false,\n", " locale: \"default\",\n", " minuteIncrement: 5,\n", " mode: \"single\",\n", " monthSelectorType: \"dropdown\",\n", " nextArrow: \"\",\n", " noCalendar: false,\n", " now: new Date(),\n", " onChange: [],\n", " onClose: [],\n", " onDayCreate: [],\n", " onDestroy: [],\n", " onKeyDown: [],\n", " onMonthChange: [],\n", " onOpen: [],\n", " onParseConfig: [],\n", " onReady: [],\n", " onValueUpdate: [],\n", " onYearChange: [],\n", " onPreCalendarPosition: [],\n", " plugins: [],\n", " position: \"auto\",\n", " positionElement: undefined,\n", " prevArrow: \"\",\n", " shorthandCurrentMonth: false,\n", " showMonths: 1,\n", " static: false,\n", " time_24hr: false,\n", " weekNumbers: false,\n", " wrap: false\n", " };\n", " var english = {\n", " weekdays: {\n", " shorthand: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n", " longhand: [\n", " \"Sunday\",\n", " \"Monday\",\n", " \"Tuesday\",\n", " \"Wednesday\",\n", " \"Thursday\",\n", " \"Friday\",\n", " \"Saturday\",\n", " ]\n", " },\n", " months: {\n", " shorthand: [\n", " \"Jan\",\n", " \"Feb\",\n", " \"Mar\",\n", " \"Apr\",\n", " \"May\",\n", " \"Jun\",\n", " \"Jul\",\n", " \"Aug\",\n", " \"Sep\",\n", " \"Oct\",\n", " \"Nov\",\n", " \"Dec\",\n", " ],\n", " longhand: [\n", " \"January\",\n", " \"February\",\n", " \"March\",\n", " \"April\",\n", " \"May\",\n", " \"June\",\n", " \"July\",\n", " \"August\",\n", " \"September\",\n", " \"October\",\n", " \"November\",\n", " \"December\",\n", " ]\n", " },\n", " daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],\n", " firstDayOfWeek: 0,\n", " ordinal: function (nth) {\n", " var s = nth % 100;\n", " if (s > 3 && s < 21)\n", " return \"th\";\n", " switch (s % 10) {\n", " case 1:\n", " return \"st\";\n", " case 2:\n", " return \"nd\";\n", " case 3:\n", " return \"rd\";\n", " default:\n", " return \"th\";\n", " }\n", " },\n", " rangeSeparator: \" to \",\n", " weekAbbreviation: \"Wk\",\n", " scrollTitle: \"Scroll to increment\",\n", " toggleTitle: \"Click to toggle\",\n", " amPM: [\"AM\", \"PM\"],\n", " yearAriaLabel: \"Year\",\n", " hourAriaLabel: \"Hour\",\n", " minuteAriaLabel: \"Minute\",\n", " time_24hr: false\n", " };\n", " var pad = function (number) { return (\"0\" + number).slice(-2); };\n", " var int = function (bool) { return (bool === true ? 1 : 0); };\n", " /* istanbul ignore next */\n", " function debounce(func, wait, immediate) {\n", " if (immediate === void 0) {\n", " immediate = false;\n", " }\n", " var timeout;\n", " return function () {\n", " var context = this, args = arguments;\n", " timeout !== null && clearTimeout(timeout);\n", " timeout = window.setTimeout(function () {\n", " timeout = null;\n", " if (!immediate)\n", " func.apply(context, args);\n", " }, wait);\n", " if (immediate && !timeout)\n", " func.apply(context, args);\n", " };\n", " }\n", " var arrayify = function (obj) {\n", " return obj instanceof Array ? obj : [obj];\n", " };\n", " function toggleClass(elem, className, bool) {\n", " if (bool === true)\n", " return elem.classList.add(className);\n", " elem.classList.remove(className);\n", " }\n", " function createElement(tag, className, content) {\n", " var e = window.document.createElement(tag);\n", " className = className || \"\";\n", " content = content || \"\";\n", " e.className = className;\n", " if (content !== undefined)\n", " e.textContent = content;\n", " return e;\n", " }\n", " function clearNode(node) {\n", " while (node.firstChild)\n", " node.removeChild(node.firstChild);\n", " }\n", " function findParent(node, condition) {\n", " if (condition(node))\n", " return node;\n", " else if (node.parentNode)\n", " return findParent(node.parentNode, condition);\n", " return undefined; // nothing found\n", " }\n", " function createNumberInput(inputClassName, opts) {\n", " var wrapper = createElement(\"div\", \"numInputWrapper\"), numInput = createElement(\"input\", \"numInput \" + inputClassName), arrowUp = createElement(\"span\", \"arrowUp\"), arrowDown = createElement(\"span\", \"arrowDown\");\n", " if (navigator.userAgent.indexOf(\"MSIE 9.0\") === -1) {\n", " numInput.type = \"number\";\n", " }\n", " else {\n", " numInput.type = \"text\";\n", " numInput.pattern = \"\\\\d*\";\n", " }\n", " if (opts !== undefined)\n", " for (var key in opts)\n", " numInput.setAttribute(key, opts[key]);\n", " wrapper.appendChild(numInput);\n", " wrapper.appendChild(arrowUp);\n", " wrapper.appendChild(arrowDown);\n", " return wrapper;\n", " }\n", " function getEventTarget(event) {\n", " if (typeof event.composedPath === \"function\") {\n", " var path = event.composedPath();\n", " return path[0];\n", " }\n", " return event.target;\n", " }\n", " var doNothing = function () { return undefined; };\n", " var monthToStr = function (monthNumber, shorthand, locale) { return locale.months[shorthand ? \"shorthand\" : \"longhand\"][monthNumber]; };\n", " var revFormat = {\n", " D: doNothing,\n", " F: function (dateObj, monthName, locale) {\n", " dateObj.setMonth(locale.months.longhand.indexOf(monthName));\n", " },\n", " G: function (dateObj, hour) {\n", " dateObj.setHours(parseFloat(hour));\n", " },\n", " H: function (dateObj, hour) {\n", " dateObj.setHours(parseFloat(hour));\n", " },\n", " J: function (dateObj, day) {\n", " dateObj.setDate(parseFloat(day));\n", " },\n", " K: function (dateObj, amPM, locale) {\n", " dateObj.setHours((dateObj.getHours() % 12) +\n", " 12 * int(new RegExp(locale.amPM[1], \"i\").test(amPM)));\n", " },\n", " M: function (dateObj, shortMonth, locale) {\n", " dateObj.setMonth(locale.months.shorthand.indexOf(shortMonth));\n", " },\n", " S: function (dateObj, seconds) {\n", " dateObj.setSeconds(parseFloat(seconds));\n", " },\n", " U: function (_, unixSeconds) { return new Date(parseFloat(unixSeconds) * 1000); },\n", " W: function (dateObj, weekNum, locale) {\n", " var weekNumber = parseInt(weekNum);\n", " var date = new Date(dateObj.getFullYear(), 0, 2 + (weekNumber - 1) * 7, 0, 0, 0, 0);\n", " date.setDate(date.getDate() - date.getDay() + locale.firstDayOfWeek);\n", " return date;\n", " },\n", " Y: function (dateObj, year) {\n", " dateObj.setFullYear(parseFloat(year));\n", " },\n", " Z: function (_, ISODate) { return new Date(ISODate); },\n", " d: function (dateObj, day) {\n", " dateObj.setDate(parseFloat(day));\n", " },\n", " h: function (dateObj, hour) {\n", " dateObj.setHours(parseFloat(hour));\n", " },\n", " i: function (dateObj, minutes) {\n", " dateObj.setMinutes(parseFloat(minutes));\n", " },\n", " j: function (dateObj, day) {\n", " dateObj.setDate(parseFloat(day));\n", " },\n", " l: doNothing,\n", " m: function (dateObj, month) {\n", " dateObj.setMonth(parseFloat(month) - 1);\n", " },\n", " n: function (dateObj, month) {\n", " dateObj.setMonth(parseFloat(month) - 1);\n", " },\n", " s: function (dateObj, seconds) {\n", " dateObj.setSeconds(parseFloat(seconds));\n", " },\n", " u: function (_, unixMillSeconds) {\n", " return new Date(parseFloat(unixMillSeconds));\n", " },\n", " w: doNothing,\n", " y: function (dateObj, year) {\n", " dateObj.setFullYear(2000 + parseFloat(year));\n", " }\n", " };\n", " var tokenRegex = {\n", " D: \"(\\\\w+)\",\n", " F: \"(\\\\w+)\",\n", " G: \"(\\\\d\\\\d|\\\\d)\",\n", " H: \"(\\\\d\\\\d|\\\\d)\",\n", " J: \"(\\\\d\\\\d|\\\\d)\\\\w+\",\n", " K: \"\",\n", " M: \"(\\\\w+)\",\n", " S: \"(\\\\d\\\\d|\\\\d)\",\n", " U: \"(.+)\",\n", " W: \"(\\\\d\\\\d|\\\\d)\",\n", " Y: \"(\\\\d{4})\",\n", " Z: \"(.+)\",\n", " d: \"(\\\\d\\\\d|\\\\d)\",\n", " h: \"(\\\\d\\\\d|\\\\d)\",\n", " i: \"(\\\\d\\\\d|\\\\d)\",\n", " j: \"(\\\\d\\\\d|\\\\d)\",\n", " l: \"(\\\\w+)\",\n", " m: \"(\\\\d\\\\d|\\\\d)\",\n", " n: \"(\\\\d\\\\d|\\\\d)\",\n", " s: \"(\\\\d\\\\d|\\\\d)\",\n", " u: \"(.+)\",\n", " w: \"(\\\\d\\\\d|\\\\d)\",\n", " y: \"(\\\\d{2})\"\n", " };\n", " var formats = {\n", " // get the date in UTC\n", " Z: function (date) { return date.toISOString(); },\n", " // weekday name, short, e.g. Thu\n", " D: function (date, locale, options) {\n", " return locale.weekdays.shorthand[formats.w(date, locale, options)];\n", " },\n", " // full month name e.g. January\n", " F: function (date, locale, options) {\n", " return monthToStr(formats.n(date, locale, options) - 1, false, locale);\n", " },\n", " // padded hour 1-12\n", " G: function (date, locale, options) {\n", " return pad(formats.h(date, locale, options));\n", " },\n", " // hours with leading zero e.g. 03\n", " H: function (date) { return pad(date.getHours()); },\n", " // day (1-30) with ordinal suffix e.g. 1st, 2nd\n", " J: function (date, locale) {\n", " return locale.ordinal !== undefined\n", " ? date.getDate() + locale.ordinal(date.getDate())\n", " : date.getDate();\n", " },\n", " // AM/PM\n", " K: function (date, locale) { return locale.amPM[int(date.getHours() > 11)]; },\n", " // shorthand month e.g. Jan, Sep, Oct, etc\n", " M: function (date, locale) {\n", " return monthToStr(date.getMonth(), true, locale);\n", " },\n", " // seconds 00-59\n", " S: function (date) { return pad(date.getSeconds()); },\n", " // unix timestamp\n", " U: function (date) { return date.getTime() / 1000; },\n", " W: function (date, _, options) {\n", " return options.getWeek(date);\n", " },\n", " // full year e.g. 2016\n", " Y: function (date) { return date.getFullYear(); },\n", " // day in month, padded (01-30)\n", " d: function (date) { return pad(date.getDate()); },\n", " // hour from 1-12 (am/pm)\n", " h: function (date) { return (date.getHours() % 12 ? date.getHours() % 12 : 12); },\n", " // minutes, padded with leading zero e.g. 09\n", " i: function (date) { return pad(date.getMinutes()); },\n", " // day in month (1-30)\n", " j: function (date) { return date.getDate(); },\n", " // weekday name, full, e.g. Thursday\n", " l: function (date, locale) {\n", " return locale.weekdays.longhand[date.getDay()];\n", " },\n", " // padded month number (01-12)\n", " m: function (date) { return pad(date.getMonth() + 1); },\n", " // the month number (1-12)\n", " n: function (date) { return date.getMonth() + 1; },\n", " // seconds 0-59\n", " s: function (date) { return date.getSeconds(); },\n", " // Unix Milliseconds\n", " u: function (date) { return date.getTime(); },\n", " // number of the day of the week\n", " w: function (date) { return date.getDay(); },\n", " // last two digits of year e.g. 16 for 2016\n", " y: function (date) { return String(date.getFullYear()).substring(2); }\n", " };\n", " var createDateFormatter = function (_a) {\n", " var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c;\n", " return function (dateObj, frmt, overrideLocale) {\n", " var locale = overrideLocale || l10n;\n", " if (config.formatDate !== undefined) {\n", " return config.formatDate(dateObj, frmt, locale);\n", " }\n", " return frmt\n", " .split(\"\")\n", " .map(function (c, i, arr) {\n", " return formats[c] && arr[i - 1] !== \"\\\\\"\n", " ? formats[c](dateObj, locale, config)\n", " : c !== \"\\\\\"\n", " ? c\n", " : \"\";\n", " })\n", " .join(\"\");\n", " };\n", " };\n", " var createDateParser = function (_a) {\n", " var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c;\n", " return function (date, givenFormat, timeless, customLocale) {\n", " if (date !== 0 && !date)\n", " return undefined;\n", " var locale = customLocale || l10n;\n", " var parsedDate;\n", " var dateOrig = date;\n", " if (date instanceof Date)\n", " parsedDate = new Date(date.getTime());\n", " else if (typeof date !== \"string\" &&\n", " date.toFixed !== undefined // timestamp\n", " )\n", " // create a copy\n", " parsedDate = new Date(date);\n", " else if (typeof date === \"string\") {\n", " // date string\n", " var format = givenFormat || (config || defaults).dateFormat;\n", " var datestr = String(date).trim();\n", " if (datestr === \"today\") {\n", " parsedDate = new Date();\n", " timeless = true;\n", " }\n", " else if (/Z$/.test(datestr) ||\n", " /GMT$/.test(datestr) // datestrings w/ timezone\n", " )\n", " parsedDate = new Date(date);\n", " else if (config && config.parseDate)\n", " parsedDate = config.parseDate(date, format);\n", " else {\n", " parsedDate =\n", " !config || !config.noCalendar\n", " ? new Date(new Date().getFullYear(), 0, 1, 0, 0, 0, 0)\n", " : new Date(new Date().setHours(0, 0, 0, 0));\n", " var matched = void 0, ops = [];\n", " for (var i = 0, matchIndex = 0, regexStr = \"\"; i < format.length; i++) {\n", " var token_1 = format[i];\n", " var isBackSlash = token_1 === \"\\\\\";\n", " var escaped = format[i - 1] === \"\\\\\" || isBackSlash;\n", " if (tokenRegex[token_1] && !escaped) {\n", " regexStr += tokenRegex[token_1];\n", " var match = new RegExp(regexStr).exec(date);\n", " if (match && (matched = true)) {\n", " ops[token_1 !== \"Y\" ? \"push\" : \"unshift\"]({\n", " fn: revFormat[token_1],\n", " val: match[++matchIndex]\n", " });\n", " }\n", " }\n", " else if (!isBackSlash)\n", " regexStr += \".\"; // don't really care\n", " ops.forEach(function (_a) {\n", " var fn = _a.fn, val = _a.val;\n", " return (parsedDate = fn(parsedDate, val, locale) || parsedDate);\n", " });\n", " }\n", " parsedDate = matched ? parsedDate : undefined;\n", " }\n", " }\n", " /* istanbul ignore next */\n", " if (!(parsedDate instanceof Date && !isNaN(parsedDate.getTime()))) {\n", " config.errorHandler(new Error(\"Invalid date provided: \" + dateOrig));\n", " return undefined;\n", " }\n", " if (timeless === true)\n", " parsedDate.setHours(0, 0, 0, 0);\n", " return parsedDate;\n", " };\n", " };\n", " /**\n", " * Compute the difference in dates, measured in ms\n", " */\n", " function compareDates(date1, date2, timeless) {\n", " if (timeless === void 0) {\n", " timeless = true;\n", " }\n", " if (timeless !== false) {\n", " return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n", " new Date(date2.getTime()).setHours(0, 0, 0, 0));\n", " }\n", " return date1.getTime() - date2.getTime();\n", " }\n", " var isBetween = function (ts, ts1, ts2) {\n", " return ts > Math.min(ts1, ts2) && ts < Math.max(ts1, ts2);\n", " };\n", " var duration = {\n", " DAY: 86400000\n", " };\n", " if (typeof Object.assign !== \"function\") {\n", " Object.assign = function (target) {\n", " var args = [];\n", " for (var _i = 1; _i < arguments.length; _i++) {\n", " args[_i - 1] = arguments[_i];\n", " }\n", " if (!target) {\n", " throw TypeError(\"Cannot convert undefined or null to object\");\n", " }\n", " var _loop_1 = function (source) {\n", " if (source) {\n", " Object.keys(source).forEach(function (key) { return (target[key] = source[key]); });\n", " }\n", " };\n", " for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {\n", " var source = args_1[_a];\n", " _loop_1(source);\n", " }\n", " return target;\n", " };\n", " }\n", " var DEBOUNCED_CHANGE_MS = 300;\n", " function FlatpickrInstance(element, instanceConfig) {\n", " var self = {\n", " config: __assign({}, defaults, flatpickr.defaultConfig),\n", " l10n: english\n", " };\n", " self.parseDate = createDateParser({ config: self.config, l10n: self.l10n });\n", " self._handlers = [];\n", " self.pluginElements = [];\n", " self.loadedPlugins = [];\n", " self._bind = bind;\n", " self._setHoursFromDate = setHoursFromDate;\n", " self._positionCalendar = positionCalendar;\n", " self.changeMonth = changeMonth;\n", " self.changeYear = changeYear;\n", " self.clear = clear;\n", " self.close = close;\n", " self._createElement = createElement;\n", " self.destroy = destroy;\n", " self.isEnabled = isEnabled;\n", " self.jumpToDate = jumpToDate;\n", " self.open = open;\n", " self.redraw = redraw;\n", " self.set = set;\n", " self.setDate = setDate;\n", " self.toggle = toggle;\n", " function setupHelperFunctions() {\n", " self.utils = {\n", " getDaysInMonth: function (month, yr) {\n", " if (month === void 0) {\n", " month = self.currentMonth;\n", " }\n", " if (yr === void 0) {\n", " yr = self.currentYear;\n", " }\n", " if (month === 1 && ((yr % 4 === 0 && yr % 100 !== 0) || yr % 400 === 0))\n", " return 29;\n", " return self.l10n.daysInMonth[month];\n", " }\n", " };\n", " }\n", " function init() {\n", " self.element = self.input = element;\n", " self.isOpen = false;\n", " parseConfig();\n", " setupLocale();\n", " setupInputs();\n", " setupDates();\n", " setupHelperFunctions();\n", " if (!self.isMobile)\n", " build();\n", " bindEvents();\n", " if (self.selectedDates.length || self.config.noCalendar) {\n", " if (self.config.enableTime) {\n", " setHoursFromDate(self.config.noCalendar\n", " ? self.latestSelectedDateObj || self.config.minDate\n", " : undefined);\n", " }\n", " updateValue(false);\n", " }\n", " setCalendarWidth();\n", " self.showTimeInput =\n", " self.selectedDates.length > 0 || self.config.noCalendar;\n", " var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n", " /* TODO: investigate this further\n", " \n", " Currently, there is weird positioning behavior in safari causing pages\n", " to scroll up. https://github.com/chmln/flatpickr/issues/563\n", " \n", " However, most browsers are not Safari and positioning is expensive when used\n", " in scale. https://github.com/chmln/flatpickr/issues/1096\n", " */\n", " if (!self.isMobile && isSafari) {\n", " positionCalendar();\n", " }\n", " triggerEvent(\"onReady\");\n", " }\n", " function bindToInstance(fn) {\n", " return fn.bind(self);\n", " }\n", " function setCalendarWidth() {\n", " var config = self.config;\n", " if (config.weekNumbers === false && config.showMonths === 1)\n", " return;\n", " else if (config.noCalendar !== true) {\n", " window.requestAnimationFrame(function () {\n", " if (self.calendarContainer !== undefined) {\n", " self.calendarContainer.style.visibility = \"hidden\";\n", " self.calendarContainer.style.display = \"block\";\n", " }\n", " if (self.daysContainer !== undefined) {\n", " var daysWidth = (self.days.offsetWidth + 1) * config.showMonths;\n", " self.daysContainer.style.width = daysWidth + \"px\";\n", " self.calendarContainer.style.width =\n", " daysWidth +\n", " (self.weekWrapper !== undefined\n", " ? self.weekWrapper.offsetWidth\n", " : 0) +\n", " \"px\";\n", " self.calendarContainer.style.removeProperty(\"visibility\");\n", " self.calendarContainer.style.removeProperty(\"display\");\n", " }\n", " });\n", " }\n", " }\n", " /**\n", " * The handler for all events targeting the time inputs\n", " */\n", " function updateTime(e) {\n", " if (self.selectedDates.length === 0) {\n", " setDefaultTime();\n", " }\n", " if (e !== undefined && e.type !== \"blur\") {\n", " timeWrapper(e);\n", " }\n", " var prevValue = self._input.value;\n", " setHoursFromInputs();\n", " updateValue();\n", " if (self._input.value !== prevValue) {\n", " self._debouncedChange();\n", " }\n", " }\n", " function ampm2military(hour, amPM) {\n", " return (hour % 12) + 12 * int(amPM === self.l10n.amPM[1]);\n", " }\n", " function military2ampm(hour) {\n", " switch (hour % 24) {\n", " case 0:\n", " case 12:\n", " return 12;\n", " default:\n", " return hour % 12;\n", " }\n", " }\n", " /**\n", " * Syncs the selected date object time with user's time input\n", " */\n", " function setHoursFromInputs() {\n", " if (self.hourElement === undefined || self.minuteElement === undefined)\n", " return;\n", " var hours = (parseInt(self.hourElement.value.slice(-2), 10) || 0) % 24, minutes = (parseInt(self.minuteElement.value, 10) || 0) % 60, seconds = self.secondElement !== undefined\n", " ? (parseInt(self.secondElement.value, 10) || 0) % 60\n", " : 0;\n", " if (self.amPM !== undefined) {\n", " hours = ampm2military(hours, self.amPM.textContent);\n", " }\n", " var limitMinHours = self.config.minTime !== undefined ||\n", " (self.config.minDate &&\n", " self.minDateHasTime &&\n", " self.latestSelectedDateObj &&\n", " compareDates(self.latestSelectedDateObj, self.config.minDate, true) ===\n", " 0);\n", " var limitMaxHours = self.config.maxTime !== undefined ||\n", " (self.config.maxDate &&\n", " self.maxDateHasTime &&\n", " self.latestSelectedDateObj &&\n", " compareDates(self.latestSelectedDateObj, self.config.maxDate, true) ===\n", " 0);\n", " if (limitMaxHours) {\n", " var maxTime = self.config.maxTime !== undefined\n", " ? self.config.maxTime\n", " : self.config.maxDate;\n", " hours = Math.min(hours, maxTime.getHours());\n", " if (hours === maxTime.getHours())\n", " minutes = Math.min(minutes, maxTime.getMinutes());\n", " if (minutes === maxTime.getMinutes())\n", " seconds = Math.min(seconds, maxTime.getSeconds());\n", " }\n", " if (limitMinHours) {\n", " var minTime = self.config.minTime !== undefined\n", " ? self.config.minTime\n", " : self.config.minDate;\n", " hours = Math.max(hours, minTime.getHours());\n", " if (hours === minTime.getHours())\n", " minutes = Math.max(minutes, minTime.getMinutes());\n", " if (minutes === minTime.getMinutes())\n", " seconds = Math.max(seconds, minTime.getSeconds());\n", " }\n", " setHours(hours, minutes, seconds);\n", " }\n", " /**\n", " * Syncs time input values with a date\n", " */\n", " function setHoursFromDate(dateObj) {\n", " var date = dateObj || self.latestSelectedDateObj;\n", " if (date)\n", " setHours(date.getHours(), date.getMinutes(), date.getSeconds());\n", " }\n", " function setDefaultHours() {\n", " var hours = self.config.defaultHour;\n", " var minutes = self.config.defaultMinute;\n", " var seconds = self.config.defaultSeconds;\n", " if (self.config.minDate !== undefined) {\n", " var minHr = self.config.minDate.getHours();\n", " var minMinutes = self.config.minDate.getMinutes();\n", " hours = Math.max(hours, minHr);\n", " if (hours === minHr)\n", " minutes = Math.max(minMinutes, minutes);\n", " if (hours === minHr && minutes === minMinutes)\n", " seconds = self.config.minDate.getSeconds();\n", " }\n", " if (self.config.maxDate !== undefined) {\n", " var maxHr = self.config.maxDate.getHours();\n", " var maxMinutes = self.config.maxDate.getMinutes();\n", " hours = Math.min(hours, maxHr);\n", " if (hours === maxHr)\n", " minutes = Math.min(maxMinutes, minutes);\n", " if (hours === maxHr && minutes === maxMinutes)\n", " seconds = self.config.maxDate.getSeconds();\n", " }\n", " setHours(hours, minutes, seconds);\n", " }\n", " /**\n", " * Sets the hours, minutes, and optionally seconds\n", " * of the latest selected date object and the\n", " * corresponding time inputs\n", " * @param {Number} hours the hour. whether its military\n", " * or am-pm gets inferred from config\n", " * @param {Number} minutes the minutes\n", " * @param {Number} seconds the seconds (optional)\n", " */\n", " function setHours(hours, minutes, seconds) {\n", " if (self.latestSelectedDateObj !== undefined) {\n", " self.latestSelectedDateObj.setHours(hours % 24, minutes, seconds || 0, 0);\n", " }\n", " if (!self.hourElement || !self.minuteElement || self.isMobile)\n", " return;\n", " self.hourElement.value = pad(!self.config.time_24hr\n", " ? ((12 + hours) % 12) + 12 * int(hours % 12 === 0)\n", " : hours);\n", " self.minuteElement.value = pad(minutes);\n", " if (self.amPM !== undefined)\n", " self.amPM.textContent = self.l10n.amPM[int(hours >= 12)];\n", " if (self.secondElement !== undefined)\n", " self.secondElement.value = pad(seconds);\n", " }\n", " /**\n", " * Handles the year input and incrementing events\n", " * @param {Event} event the keyup or increment event\n", " */\n", " function onYearInput(event) {\n", " var year = parseInt(event.target.value) + (event.delta || 0);\n", " if (year / 1000 > 1 ||\n", " (event.key === \"Enter\" && !/[^\\d]/.test(year.toString()))) {\n", " changeYear(year);\n", " }\n", " }\n", " /**\n", " * Essentially addEventListener + tracking\n", " * @param {Element} element the element to addEventListener to\n", " * @param {String} event the event name\n", " * @param {Function} handler the event handler\n", " */\n", " function bind(element, event, handler, options) {\n", " if (event instanceof Array)\n", " return event.forEach(function (ev) { return bind(element, ev, handler, options); });\n", " if (element instanceof Array)\n", " return element.forEach(function (el) { return bind(el, event, handler, options); });\n", " element.addEventListener(event, handler, options);\n", " self._handlers.push({\n", " element: element,\n", " event: event,\n", " handler: handler,\n", " options: options\n", " });\n", " }\n", " /**\n", " * A mousedown handler which mimics click.\n", " * Minimizes latency, since we don't need to wait for mouseup in most cases.\n", " * Also, avoids handling right clicks.\n", " *\n", " * @param {Function} handler the event handler\n", " */\n", " function onClick(handler) {\n", " return function (evt) {\n", " evt.which === 1 && handler(evt);\n", " };\n", " }\n", " function triggerChange() {\n", " triggerEvent(\"onChange\");\n", " }\n", " /**\n", " * Adds all the necessary event listeners\n", " */\n", " function bindEvents() {\n", " if (self.config.wrap) {\n", " [\"open\", \"close\", \"toggle\", \"clear\"].forEach(function (evt) {\n", " Array.prototype.forEach.call(self.element.querySelectorAll(\"[data-\" + evt + \"]\"), function (el) {\n", " return bind(el, \"click\", self[evt]);\n", " });\n", " });\n", " }\n", " if (self.isMobile) {\n", " setupMobile();\n", " return;\n", " }\n", " var debouncedResize = debounce(onResize, 50);\n", " self._debouncedChange = debounce(triggerChange, DEBOUNCED_CHANGE_MS);\n", " if (self.daysContainer && !/iPhone|iPad|iPod/i.test(navigator.userAgent))\n", " bind(self.daysContainer, \"mouseover\", function (e) {\n", " if (self.config.mode === \"range\")\n", " onMouseOver(e.target);\n", " });\n", " bind(window.document.body, \"keydown\", onKeyDown);\n", " if (!self.config.inline && !self.config.static)\n", " bind(window, \"resize\", debouncedResize);\n", " if (window.ontouchstart !== undefined)\n", " bind(window.document, \"touchstart\", documentClick);\n", " else\n", " bind(window.document, \"mousedown\", onClick(documentClick));\n", " bind(window.document, \"focus\", documentClick, { capture: true });\n", " if (self.config.clickOpens === true) {\n", " bind(self._input, \"focus\", self.open);\n", " bind(self._input, \"mousedown\", onClick(self.open));\n", " }\n", " if (self.daysContainer !== undefined) {\n", " bind(self.monthNav, \"mousedown\", onClick(onMonthNavClick));\n", " bind(self.monthNav, [\"keyup\", \"increment\"], onYearInput);\n", " bind(self.daysContainer, \"mousedown\", onClick(selectDate));\n", " }\n", " if (self.timeContainer !== undefined &&\n", " self.minuteElement !== undefined &&\n", " self.hourElement !== undefined) {\n", " var selText = function (e) {\n", " return e.target.select();\n", " };\n", " bind(self.timeContainer, [\"increment\"], updateTime);\n", " bind(self.timeContainer, \"blur\", updateTime, { capture: true });\n", " bind(self.timeContainer, \"mousedown\", onClick(timeIncrement));\n", " bind([self.hourElement, self.minuteElement], [\"focus\", \"click\"], selText);\n", " if (self.secondElement !== undefined)\n", " bind(self.secondElement, \"focus\", function () { return self.secondElement && self.secondElement.select(); });\n", " if (self.amPM !== undefined) {\n", " bind(self.amPM, \"mousedown\", onClick(function (e) {\n", " updateTime(e);\n", " triggerChange();\n", " }));\n", " }\n", " }\n", " }\n", " /**\n", " * Set the calendar view to a particular date.\n", " * @param {Date} jumpDate the date to set the view to\n", " * @param {boolean} triggerChange if change events should be triggered\n", " */\n", " function jumpToDate(jumpDate, triggerChange) {\n", " var jumpTo = jumpDate !== undefined\n", " ? self.parseDate(jumpDate)\n", " : self.latestSelectedDateObj ||\n", " (self.config.minDate && self.config.minDate > self.now\n", " ? self.config.minDate\n", " : self.config.maxDate && self.config.maxDate < self.now\n", " ? self.config.maxDate\n", " : self.now);\n", " var oldYear = self.currentYear;\n", " var oldMonth = self.currentMonth;\n", " try {\n", " if (jumpTo !== undefined) {\n", " self.currentYear = jumpTo.getFullYear();\n", " self.currentMonth = jumpTo.getMonth();\n", " }\n", " }\n", " catch (e) {\n", " /* istanbul ignore next */\n", " e.message = \"Invalid date supplied: \" + jumpTo;\n", " self.config.errorHandler(e);\n", " }\n", " if (triggerChange && self.currentYear !== oldYear) {\n", " triggerEvent(\"onYearChange\");\n", " buildMonthSwitch();\n", " }\n", " if (triggerChange &&\n", " (self.currentYear !== oldYear || self.currentMonth !== oldMonth)) {\n", " triggerEvent(\"onMonthChange\");\n", " }\n", " self.redraw();\n", " }\n", " /**\n", " * The up/down arrow handler for time inputs\n", " * @param {Event} e the click event\n", " */\n", " function timeIncrement(e) {\n", " if (~e.target.className.indexOf(\"arrow\"))\n", " incrementNumInput(e, e.target.classList.contains(\"arrowUp\") ? 1 : -1);\n", " }\n", " /**\n", " * Increments/decrements the value of input associ-\n", " * ated with the up/down arrow by dispatching an\n", " * \"increment\" event on the input.\n", " *\n", " * @param {Event} e the click event\n", " * @param {Number} delta the diff (usually 1 or -1)\n", " * @param {Element} inputElem the input element\n", " */\n", " function incrementNumInput(e, delta, inputElem) {\n", " var target = e && e.target;\n", " var input = inputElem ||\n", " (target && target.parentNode && target.parentNode.firstChild);\n", " var event = createEvent(\"increment\");\n", " event.delta = delta;\n", " input && input.dispatchEvent(event);\n", " }\n", " function build() {\n", " var fragment = window.document.createDocumentFragment();\n", " self.calendarContainer = createElement(\"div\", \"flatpickr-calendar\");\n", " self.calendarContainer.tabIndex = -1;\n", " if (!self.config.noCalendar) {\n", " fragment.appendChild(buildMonthNav());\n", " self.innerContainer = createElement(\"div\", \"flatpickr-innerContainer\");\n", " if (self.config.weekNumbers) {\n", " var _a = buildWeeks(), weekWrapper = _a.weekWrapper, weekNumbers = _a.weekNumbers;\n", " self.innerContainer.appendChild(weekWrapper);\n", " self.weekNumbers = weekNumbers;\n", " self.weekWrapper = weekWrapper;\n", " }\n", " self.rContainer = createElement(\"div\", \"flatpickr-rContainer\");\n", " self.rContainer.appendChild(buildWeekdays());\n", " if (!self.daysContainer) {\n", " self.daysContainer = createElement(\"div\", \"flatpickr-days\");\n", " self.daysContainer.tabIndex = -1;\n", " }\n", " buildDays();\n", " self.rContainer.appendChild(self.daysContainer);\n", " self.innerContainer.appendChild(self.rContainer);\n", " fragment.appendChild(self.innerContainer);\n", " }\n", " if (self.config.enableTime) {\n", " fragment.appendChild(buildTime());\n", " }\n", " toggleClass(self.calendarContainer, \"rangeMode\", self.config.mode === \"range\");\n", " toggleClass(self.calendarContainer, \"animate\", self.config.animate === true);\n", " toggleClass(self.calendarContainer, \"multiMonth\", self.config.showMonths > 1);\n", " self.calendarContainer.appendChild(fragment);\n", " var customAppend = self.config.appendTo !== undefined &&\n", " self.config.appendTo.nodeType !== undefined;\n", " if (self.config.inline || self.config.static) {\n", " self.calendarContainer.classList.add(self.config.inline ? \"inline\" : \"static\");\n", " if (self.config.inline) {\n", " if (!customAppend && self.element.parentNode)\n", " self.element.parentNode.insertBefore(self.calendarContainer, self._input.nextSibling);\n", " else if (self.config.appendTo !== undefined)\n", " self.config.appendTo.appendChild(self.calendarContainer);\n", " }\n", " if (self.config.static) {\n", " var wrapper = createElement(\"div\", \"flatpickr-wrapper\");\n", " if (self.element.parentNode)\n", " self.element.parentNode.insertBefore(wrapper, self.element);\n", " wrapper.appendChild(self.element);\n", " if (self.altInput)\n", " wrapper.appendChild(self.altInput);\n", " wrapper.appendChild(self.calendarContainer);\n", " }\n", " }\n", " if (!self.config.static && !self.config.inline)\n", " (self.config.appendTo !== undefined\n", " ? self.config.appendTo\n", " : window.document.body).appendChild(self.calendarContainer);\n", " }\n", " function createDay(className, date, dayNumber, i) {\n", " var dateIsEnabled = isEnabled(date, true), dayElement = createElement(\"span\", \"flatpickr-day \" + className, date.getDate().toString());\n", " dayElement.dateObj = date;\n", " dayElement.$i = i;\n", " dayElement.setAttribute(\"aria-label\", self.formatDate(date, self.config.ariaDateFormat));\n", " if (className.indexOf(\"hidden\") === -1 &&\n", " compareDates(date, self.now) === 0) {\n", " self.todayDateElem = dayElement;\n", " dayElement.classList.add(\"today\");\n", " dayElement.setAttribute(\"aria-current\", \"date\");\n", " }\n", " if (dateIsEnabled) {\n", " dayElement.tabIndex = -1;\n", " if (isDateSelected(date)) {\n", " dayElement.classList.add(\"selected\");\n", " self.selectedDateElem = dayElement;\n", " if (self.config.mode === \"range\") {\n", " toggleClass(dayElement, \"startRange\", self.selectedDates[0] &&\n", " compareDates(date, self.selectedDates[0], true) === 0);\n", " toggleClass(dayElement, \"endRange\", self.selectedDates[1] &&\n", " compareDates(date, self.selectedDates[1], true) === 0);\n", " if (className === \"nextMonthDay\")\n", " dayElement.classList.add(\"inRange\");\n", " }\n", " }\n", " }\n", " else {\n", " dayElement.classList.add(\"flatpickr-disabled\");\n", " }\n", " if (self.config.mode === \"range\") {\n", " if (isDateInRange(date) && !isDateSelected(date))\n", " dayElement.classList.add(\"inRange\");\n", " }\n", " if (self.weekNumbers &&\n", " self.config.showMonths === 1 &&\n", " className !== \"prevMonthDay\" &&\n", " dayNumber % 7 === 1) {\n", " self.weekNumbers.insertAdjacentHTML(\"beforeend\", \"\" + self.config.getWeek(date) + \"\");\n", " }\n", " triggerEvent(\"onDayCreate\", dayElement);\n", " return dayElement;\n", " }\n", " function focusOnDayElem(targetNode) {\n", " targetNode.focus();\n", " if (self.config.mode === \"range\")\n", " onMouseOver(targetNode);\n", " }\n", " function getFirstAvailableDay(delta) {\n", " var startMonth = delta > 0 ? 0 : self.config.showMonths - 1;\n", " var endMonth = delta > 0 ? self.config.showMonths : -1;\n", " for (var m = startMonth; m != endMonth; m += delta) {\n", " var month = self.daysContainer.children[m];\n", " var startIndex = delta > 0 ? 0 : month.children.length - 1;\n", " var endIndex = delta > 0 ? month.children.length : -1;\n", " for (var i = startIndex; i != endIndex; i += delta) {\n", " var c = month.children[i];\n", " if (c.className.indexOf(\"hidden\") === -1 && isEnabled(c.dateObj))\n", " return c;\n", " }\n", " }\n", " return undefined;\n", " }\n", " function getNextAvailableDay(current, delta) {\n", " var givenMonth = current.className.indexOf(\"Month\") === -1\n", " ? current.dateObj.getMonth()\n", " : self.currentMonth;\n", " var endMonth = delta > 0 ? self.config.showMonths : -1;\n", " var loopDelta = delta > 0 ? 1 : -1;\n", " for (var m = givenMonth - self.currentMonth; m != endMonth; m += loopDelta) {\n", " var month = self.daysContainer.children[m];\n", " var startIndex = givenMonth - self.currentMonth === m\n", " ? current.$i + delta\n", " : delta < 0\n", " ? month.children.length - 1\n", " : 0;\n", " var numMonthDays = month.children.length;\n", " for (var i = startIndex; i >= 0 && i < numMonthDays && i != (delta > 0 ? numMonthDays : -1); i += loopDelta) {\n", " var c = month.children[i];\n", " if (c.className.indexOf(\"hidden\") === -1 &&\n", " isEnabled(c.dateObj) &&\n", " Math.abs(current.$i - i) >= Math.abs(delta))\n", " return focusOnDayElem(c);\n", " }\n", " }\n", " self.changeMonth(loopDelta);\n", " focusOnDay(getFirstAvailableDay(loopDelta), 0);\n", " return undefined;\n", " }\n", " function focusOnDay(current, offset) {\n", " var dayFocused = isInView(document.activeElement || document.body);\n", " var startElem = current !== undefined\n", " ? current\n", " : dayFocused\n", " ? document.activeElement\n", " : self.selectedDateElem !== undefined && isInView(self.selectedDateElem)\n", " ? self.selectedDateElem\n", " : self.todayDateElem !== undefined && isInView(self.todayDateElem)\n", " ? self.todayDateElem\n", " : getFirstAvailableDay(offset > 0 ? 1 : -1);\n", " if (startElem === undefined)\n", " return self._input.focus();\n", " if (!dayFocused)\n", " return focusOnDayElem(startElem);\n", " getNextAvailableDay(startElem, offset);\n", " }\n", " function buildMonthDays(year, month) {\n", " var firstOfMonth = (new Date(year, month, 1).getDay() - self.l10n.firstDayOfWeek + 7) % 7;\n", " var prevMonthDays = self.utils.getDaysInMonth((month - 1 + 12) % 12);\n", " var daysInMonth = self.utils.getDaysInMonth(month), days = window.document.createDocumentFragment(), isMultiMonth = self.config.showMonths > 1, prevMonthDayClass = isMultiMonth ? \"prevMonthDay hidden\" : \"prevMonthDay\", nextMonthDayClass = isMultiMonth ? \"nextMonthDay hidden\" : \"nextMonthDay\";\n", " var dayNumber = prevMonthDays + 1 - firstOfMonth, dayIndex = 0;\n", " // prepend days from the ending of previous month\n", " for (; dayNumber <= prevMonthDays; dayNumber++, dayIndex++) {\n", " days.appendChild(createDay(prevMonthDayClass, new Date(year, month - 1, dayNumber), dayNumber, dayIndex));\n", " }\n", " // Start at 1 since there is no 0th day\n", " for (dayNumber = 1; dayNumber <= daysInMonth; dayNumber++, dayIndex++) {\n", " days.appendChild(createDay(\"\", new Date(year, month, dayNumber), dayNumber, dayIndex));\n", " }\n", " // append days from the next month\n", " for (var dayNum = daysInMonth + 1; dayNum <= 42 - firstOfMonth &&\n", " (self.config.showMonths === 1 || dayIndex % 7 !== 0); dayNum++, dayIndex++) {\n", " days.appendChild(createDay(nextMonthDayClass, new Date(year, month + 1, dayNum % daysInMonth), dayNum, dayIndex));\n", " }\n", " //updateNavigationCurrentMonth();\n", " var dayContainer = createElement(\"div\", \"dayContainer\");\n", " dayContainer.appendChild(days);\n", " return dayContainer;\n", " }\n", " function buildDays() {\n", " if (self.daysContainer === undefined) {\n", " return;\n", " }\n", " clearNode(self.daysContainer);\n", " // TODO: week numbers for each month\n", " if (self.weekNumbers)\n", " clearNode(self.weekNumbers);\n", " var frag = document.createDocumentFragment();\n", " for (var i = 0; i < self.config.showMonths; i++) {\n", " var d = new Date(self.currentYear, self.currentMonth, 1);\n", " d.setMonth(self.currentMonth + i);\n", " frag.appendChild(buildMonthDays(d.getFullYear(), d.getMonth()));\n", " }\n", " self.daysContainer.appendChild(frag);\n", " self.days = self.daysContainer.firstChild;\n", " if (self.config.mode === \"range\" && self.selectedDates.length === 1) {\n", " onMouseOver();\n", " }\n", " }\n", " function buildMonthSwitch() {\n", " if (self.config.showMonths > 1 ||\n", " self.config.monthSelectorType !== \"dropdown\")\n", " return;\n", " var shouldBuildMonth = function (month) {\n", " if (self.config.minDate !== undefined &&\n", " self.currentYear === self.config.minDate.getFullYear() &&\n", " month < self.config.minDate.getMonth()) {\n", " return false;\n", " }\n", " return !(self.config.maxDate !== undefined &&\n", " self.currentYear === self.config.maxDate.getFullYear() &&\n", " month > self.config.maxDate.getMonth());\n", " };\n", " self.monthsDropdownContainer.tabIndex = -1;\n", " self.monthsDropdownContainer.innerHTML = \"\";\n", " for (var i = 0; i < 12; i++) {\n", " if (!shouldBuildMonth(i))\n", " continue;\n", " var month = createElement(\"option\", \"flatpickr-monthDropdown-month\");\n", " month.value = new Date(self.currentYear, i).getMonth().toString();\n", " month.textContent = monthToStr(i, self.config.shorthandCurrentMonth, self.l10n);\n", " month.tabIndex = -1;\n", " if (self.currentMonth === i) {\n", " month.selected = true;\n", " }\n", " self.monthsDropdownContainer.appendChild(month);\n", " }\n", " }\n", " function buildMonth() {\n", " var container = createElement(\"div\", \"flatpickr-month\");\n", " var monthNavFragment = window.document.createDocumentFragment();\n", " var monthElement;\n", " if (self.config.showMonths > 1 ||\n", " self.config.monthSelectorType === \"static\") {\n", " monthElement = createElement(\"span\", \"cur-month\");\n", " }\n", " else {\n", " self.monthsDropdownContainer = createElement(\"select\", \"flatpickr-monthDropdown-months\");\n", " bind(self.monthsDropdownContainer, \"change\", function (e) {\n", " var target = e.target;\n", " var selectedMonth = parseInt(target.value, 10);\n", " self.changeMonth(selectedMonth - self.currentMonth);\n", " triggerEvent(\"onMonthChange\");\n", " });\n", " buildMonthSwitch();\n", " monthElement = self.monthsDropdownContainer;\n", " }\n", " var yearInput = createNumberInput(\"cur-year\", { tabindex: \"-1\" });\n", " var yearElement = yearInput.getElementsByTagName(\"input\")[0];\n", " yearElement.setAttribute(\"aria-label\", self.l10n.yearAriaLabel);\n", " if (self.config.minDate) {\n", " yearElement.setAttribute(\"min\", self.config.minDate.getFullYear().toString());\n", " }\n", " if (self.config.maxDate) {\n", " yearElement.setAttribute(\"max\", self.config.maxDate.getFullYear().toString());\n", " yearElement.disabled =\n", " !!self.config.minDate &&\n", " self.config.minDate.getFullYear() === self.config.maxDate.getFullYear();\n", " }\n", " var currentMonth = createElement(\"div\", \"flatpickr-current-month\");\n", " currentMonth.appendChild(monthElement);\n", " currentMonth.appendChild(yearInput);\n", " monthNavFragment.appendChild(currentMonth);\n", " container.appendChild(monthNavFragment);\n", " return {\n", " container: container,\n", " yearElement: yearElement,\n", " monthElement: monthElement\n", " };\n", " }\n", " function buildMonths() {\n", " clearNode(self.monthNav);\n", " self.monthNav.appendChild(self.prevMonthNav);\n", " if (self.config.showMonths) {\n", " self.yearElements = [];\n", " self.monthElements = [];\n", " }\n", " for (var m = self.config.showMonths; m--;) {\n", " var month = buildMonth();\n", " self.yearElements.push(month.yearElement);\n", " self.monthElements.push(month.monthElement);\n", " self.monthNav.appendChild(month.container);\n", " }\n", " self.monthNav.appendChild(self.nextMonthNav);\n", " }\n", " function buildMonthNav() {\n", " self.monthNav = createElement(\"div\", \"flatpickr-months\");\n", " self.yearElements = [];\n", " self.monthElements = [];\n", " self.prevMonthNav = createElement(\"span\", \"flatpickr-prev-month\");\n", " self.prevMonthNav.innerHTML = self.config.prevArrow;\n", " self.nextMonthNav = createElement(\"span\", \"flatpickr-next-month\");\n", " self.nextMonthNav.innerHTML = self.config.nextArrow;\n", " buildMonths();\n", " Object.defineProperty(self, \"_hidePrevMonthArrow\", {\n", " get: function () { return self.__hidePrevMonthArrow; },\n", " set: function (bool) {\n", " if (self.__hidePrevMonthArrow !== bool) {\n", " toggleClass(self.prevMonthNav, \"flatpickr-disabled\", bool);\n", " self.__hidePrevMonthArrow = bool;\n", " }\n", " }\n", " });\n", " Object.defineProperty(self, \"_hideNextMonthArrow\", {\n", " get: function () { return self.__hideNextMonthArrow; },\n", " set: function (bool) {\n", " if (self.__hideNextMonthArrow !== bool) {\n", " toggleClass(self.nextMonthNav, \"flatpickr-disabled\", bool);\n", " self.__hideNextMonthArrow = bool;\n", " }\n", " }\n", " });\n", " self.currentYearElement = self.yearElements[0];\n", " updateNavigationCurrentMonth();\n", " return self.monthNav;\n", " }\n", " function buildTime() {\n", " self.calendarContainer.classList.add(\"hasTime\");\n", " if (self.config.noCalendar)\n", " self.calendarContainer.classList.add(\"noCalendar\");\n", " self.timeContainer = createElement(\"div\", \"flatpickr-time\");\n", " self.timeContainer.tabIndex = -1;\n", " var separator = createElement(\"span\", \"flatpickr-time-separator\", \":\");\n", " var hourInput = createNumberInput(\"flatpickr-hour\", {\n", " \"aria-label\": self.l10n.hourAriaLabel\n", " });\n", " self.hourElement = hourInput.getElementsByTagName(\"input\")[0];\n", " var minuteInput = createNumberInput(\"flatpickr-minute\", {\n", " \"aria-label\": self.l10n.minuteAriaLabel\n", " });\n", " self.minuteElement = minuteInput.getElementsByTagName(\"input\")[0];\n", " self.hourElement.tabIndex = self.minuteElement.tabIndex = -1;\n", " self.hourElement.value = pad(self.latestSelectedDateObj\n", " ? self.latestSelectedDateObj.getHours()\n", " : self.config.time_24hr\n", " ? self.config.defaultHour\n", " : military2ampm(self.config.defaultHour));\n", " self.minuteElement.value = pad(self.latestSelectedDateObj\n", " ? self.latestSelectedDateObj.getMinutes()\n", " : self.config.defaultMinute);\n", " self.hourElement.setAttribute(\"step\", self.config.hourIncrement.toString());\n", " self.minuteElement.setAttribute(\"step\", self.config.minuteIncrement.toString());\n", " self.hourElement.setAttribute(\"min\", self.config.time_24hr ? \"0\" : \"1\");\n", " self.hourElement.setAttribute(\"max\", self.config.time_24hr ? \"23\" : \"12\");\n", " self.minuteElement.setAttribute(\"min\", \"0\");\n", " self.minuteElement.setAttribute(\"max\", \"59\");\n", " self.timeContainer.appendChild(hourInput);\n", " self.timeContainer.appendChild(separator);\n", " self.timeContainer.appendChild(minuteInput);\n", " if (self.config.time_24hr)\n", " self.timeContainer.classList.add(\"time24hr\");\n", " if (self.config.enableSeconds) {\n", " self.timeContainer.classList.add(\"hasSeconds\");\n", " var secondInput = createNumberInput(\"flatpickr-second\");\n", " self.secondElement = secondInput.getElementsByTagName(\"input\")[0];\n", " self.secondElement.value = pad(self.latestSelectedDateObj\n", " ? self.latestSelectedDateObj.getSeconds()\n", " : self.config.defaultSeconds);\n", " self.secondElement.setAttribute(\"step\", self.minuteElement.getAttribute(\"step\"));\n", " self.secondElement.setAttribute(\"min\", \"0\");\n", " self.secondElement.setAttribute(\"max\", \"59\");\n", " self.timeContainer.appendChild(createElement(\"span\", \"flatpickr-time-separator\", \":\"));\n", " self.timeContainer.appendChild(secondInput);\n", " }\n", " if (!self.config.time_24hr) {\n", " // add self.amPM if appropriate\n", " self.amPM = createElement(\"span\", \"flatpickr-am-pm\", self.l10n.amPM[int((self.latestSelectedDateObj\n", " ? self.hourElement.value\n", " : self.config.defaultHour) > 11)]);\n", " self.amPM.title = self.l10n.toggleTitle;\n", " self.amPM.tabIndex = -1;\n", " self.timeContainer.appendChild(self.amPM);\n", " }\n", " return self.timeContainer;\n", " }\n", " function buildWeekdays() {\n", " if (!self.weekdayContainer)\n", " self.weekdayContainer = createElement(\"div\", \"flatpickr-weekdays\");\n", " else\n", " clearNode(self.weekdayContainer);\n", " for (var i = self.config.showMonths; i--;) {\n", " var container = createElement(\"div\", \"flatpickr-weekdaycontainer\");\n", " self.weekdayContainer.appendChild(container);\n", " }\n", " updateWeekdays();\n", " return self.weekdayContainer;\n", " }\n", " function updateWeekdays() {\n", " if (!self.weekdayContainer) {\n", " return;\n", " }\n", " var firstDayOfWeek = self.l10n.firstDayOfWeek;\n", " var weekdays = self.l10n.weekdays.shorthand.slice();\n", " if (firstDayOfWeek > 0 && firstDayOfWeek < weekdays.length) {\n", " weekdays = weekdays.splice(firstDayOfWeek, weekdays.length).concat(weekdays.splice(0, firstDayOfWeek));\n", " }\n", " for (var i = self.config.showMonths; i--;) {\n", " self.weekdayContainer.children[i].innerHTML = \"\\n \\n \" + weekdays.join(\"\") + \"\\n \\n \";\n", " }\n", " }\n", " /* istanbul ignore next */\n", " function buildWeeks() {\n", " self.calendarContainer.classList.add(\"hasWeeks\");\n", " var weekWrapper = createElement(\"div\", \"flatpickr-weekwrapper\");\n", " weekWrapper.appendChild(createElement(\"span\", \"flatpickr-weekday\", self.l10n.weekAbbreviation));\n", " var weekNumbers = createElement(\"div\", \"flatpickr-weeks\");\n", " weekWrapper.appendChild(weekNumbers);\n", " return {\n", " weekWrapper: weekWrapper,\n", " weekNumbers: weekNumbers\n", " };\n", " }\n", " function changeMonth(value, isOffset) {\n", " if (isOffset === void 0) {\n", " isOffset = true;\n", " }\n", " var delta = isOffset ? value : value - self.currentMonth;\n", " if ((delta < 0 && self._hidePrevMonthArrow === true) ||\n", " (delta > 0 && self._hideNextMonthArrow === true))\n", " return;\n", " self.currentMonth += delta;\n", " if (self.currentMonth < 0 || self.currentMonth > 11) {\n", " self.currentYear += self.currentMonth > 11 ? 1 : -1;\n", " self.currentMonth = (self.currentMonth + 12) % 12;\n", " triggerEvent(\"onYearChange\");\n", " buildMonthSwitch();\n", " }\n", " buildDays();\n", " triggerEvent(\"onMonthChange\");\n", " updateNavigationCurrentMonth();\n", " }\n", " function clear(triggerChangeEvent, toInitial) {\n", " if (triggerChangeEvent === void 0) {\n", " triggerChangeEvent = true;\n", " }\n", " if (toInitial === void 0) {\n", " toInitial = true;\n", " }\n", " self.input.value = \"\";\n", " if (self.altInput !== undefined)\n", " self.altInput.value = \"\";\n", " if (self.mobileInput !== undefined)\n", " self.mobileInput.value = \"\";\n", " self.selectedDates = [];\n", " self.latestSelectedDateObj = undefined;\n", " if (toInitial === true) {\n", " self.currentYear = self._initialDate.getFullYear();\n", " self.currentMonth = self._initialDate.getMonth();\n", " }\n", " self.showTimeInput = false;\n", " if (self.config.enableTime === true) {\n", " setDefaultHours();\n", " }\n", " self.redraw();\n", " if (triggerChangeEvent)\n", " // triggerChangeEvent is true (default) or an Event\n", " triggerEvent(\"onChange\");\n", " }\n", " function close() {\n", " self.isOpen = false;\n", " if (!self.isMobile) {\n", " if (self.calendarContainer !== undefined) {\n", " self.calendarContainer.classList.remove(\"open\");\n", " }\n", " if (self._input !== undefined) {\n", " self._input.classList.remove(\"active\");\n", " }\n", " }\n", " triggerEvent(\"onClose\");\n", " }\n", " function destroy() {\n", " if (self.config !== undefined)\n", " triggerEvent(\"onDestroy\");\n", " for (var i = self._handlers.length; i--;) {\n", " var h = self._handlers[i];\n", " h.element.removeEventListener(h.event, h.handler, h.options);\n", " }\n", " self._handlers = [];\n", " if (self.mobileInput) {\n", " if (self.mobileInput.parentNode)\n", " self.mobileInput.parentNode.removeChild(self.mobileInput);\n", " self.mobileInput = undefined;\n", " }\n", " else if (self.calendarContainer && self.calendarContainer.parentNode) {\n", " if (self.config.static && self.calendarContainer.parentNode) {\n", " var wrapper = self.calendarContainer.parentNode;\n", " wrapper.lastChild && wrapper.removeChild(wrapper.lastChild);\n", " if (wrapper.parentNode) {\n", " while (wrapper.firstChild)\n", " wrapper.parentNode.insertBefore(wrapper.firstChild, wrapper);\n", " wrapper.parentNode.removeChild(wrapper);\n", " }\n", " }\n", " else\n", " self.calendarContainer.parentNode.removeChild(self.calendarContainer);\n", " }\n", " if (self.altInput) {\n", " self.input.type = \"text\";\n", " if (self.altInput.parentNode)\n", " self.altInput.parentNode.removeChild(self.altInput);\n", " delete self.altInput;\n", " }\n", " if (self.input) {\n", " self.input.type = self.input._type;\n", " self.input.classList.remove(\"flatpickr-input\");\n", " self.input.removeAttribute(\"readonly\");\n", " self.input.value = \"\";\n", " }\n", " [\n", " \"_showTimeInput\",\n", " \"latestSelectedDateObj\",\n", " \"_hideNextMonthArrow\",\n", " \"_hidePrevMonthArrow\",\n", " \"__hideNextMonthArrow\",\n", " \"__hidePrevMonthArrow\",\n", " \"isMobile\",\n", " \"isOpen\",\n", " \"selectedDateElem\",\n", " \"minDateHasTime\",\n", " \"maxDateHasTime\",\n", " \"days\",\n", " \"daysContainer\",\n", " \"_input\",\n", " \"_positionElement\",\n", " \"innerContainer\",\n", " \"rContainer\",\n", " \"monthNav\",\n", " \"todayDateElem\",\n", " \"calendarContainer\",\n", " \"weekdayContainer\",\n", " \"prevMonthNav\",\n", " \"nextMonthNav\",\n", " \"monthsDropdownContainer\",\n", " \"currentMonthElement\",\n", " \"currentYearElement\",\n", " \"navigationCurrentMonth\",\n", " \"selectedDateElem\",\n", " \"config\",\n", " ].forEach(function (k) {\n", " try {\n", " delete self[k];\n", " }\n", " catch (_) { }\n", " });\n", " }\n", " function isCalendarElem(elem) {\n", " if (self.config.appendTo && self.config.appendTo.contains(elem))\n", " return true;\n", " return self.calendarContainer.contains(elem);\n", " }\n", " function documentClick(e) {\n", " if (self.isOpen && !self.config.inline) {\n", " var eventTarget_1 = getEventTarget(e);\n", " var isCalendarElement = isCalendarElem(eventTarget_1);\n", " var isInput = eventTarget_1 === self.input ||\n", " eventTarget_1 === self.altInput ||\n", " self.element.contains(eventTarget_1) ||\n", " // web components\n", " // e.path is not present in all browsers. circumventing typechecks\n", " (e.path &&\n", " e.path.indexOf &&\n", " (~e.path.indexOf(self.input) ||\n", " ~e.path.indexOf(self.altInput)));\n", " var lostFocus = e.type === \"blur\"\n", " ? isInput &&\n", " e.relatedTarget &&\n", " !isCalendarElem(e.relatedTarget)\n", " : !isInput &&\n", " !isCalendarElement &&\n", " !isCalendarElem(e.relatedTarget);\n", " var isIgnored = !self.config.ignoredFocusElements.some(function (elem) {\n", " return elem.contains(eventTarget_1);\n", " });\n", " if (lostFocus && isIgnored) {\n", " if (self.timeContainer !== undefined &&\n", " self.minuteElement !== undefined &&\n", " self.hourElement !== undefined) {\n", " updateTime();\n", " }\n", " self.close();\n", " if (self.config.mode === \"range\" && self.selectedDates.length === 1) {\n", " self.clear(false);\n", " self.redraw();\n", " }\n", " }\n", " }\n", " }\n", " function changeYear(newYear) {\n", " if (!newYear ||\n", " (self.config.minDate && newYear < self.config.minDate.getFullYear()) ||\n", " (self.config.maxDate && newYear > self.config.maxDate.getFullYear()))\n", " return;\n", " var newYearNum = newYear, isNewYear = self.currentYear !== newYearNum;\n", " self.currentYear = newYearNum || self.currentYear;\n", " if (self.config.maxDate &&\n", " self.currentYear === self.config.maxDate.getFullYear()) {\n", " self.currentMonth = Math.min(self.config.maxDate.getMonth(), self.currentMonth);\n", " }\n", " else if (self.config.minDate &&\n", " self.currentYear === self.config.minDate.getFullYear()) {\n", " self.currentMonth = Math.max(self.config.minDate.getMonth(), self.currentMonth);\n", " }\n", " if (isNewYear) {\n", " self.redraw();\n", " triggerEvent(\"onYearChange\");\n", " buildMonthSwitch();\n", " }\n", " }\n", " function isEnabled(date, timeless) {\n", " if (timeless === void 0) {\n", " timeless = true;\n", " }\n", " var dateToCheck = self.parseDate(date, undefined, timeless); // timeless\n", " if ((self.config.minDate &&\n", " dateToCheck &&\n", " compareDates(dateToCheck, self.config.minDate, timeless !== undefined ? timeless : !self.minDateHasTime) < 0) ||\n", " (self.config.maxDate &&\n", " dateToCheck &&\n", " compareDates(dateToCheck, self.config.maxDate, timeless !== undefined ? timeless : !self.maxDateHasTime) > 0))\n", " return false;\n", " if (self.config.enable.length === 0 && self.config.disable.length === 0)\n", " return true;\n", " if (dateToCheck === undefined)\n", " return false;\n", " var bool = self.config.enable.length > 0, array = bool ? self.config.enable : self.config.disable;\n", " for (var i = 0, d = void 0; i < array.length; i++) {\n", " d = array[i];\n", " if (typeof d === \"function\" &&\n", " d(dateToCheck) // disabled by function\n", " )\n", " return bool;\n", " else if (d instanceof Date &&\n", " dateToCheck !== undefined &&\n", " d.getTime() === dateToCheck.getTime())\n", " // disabled by date\n", " return bool;\n", " else if (typeof d === \"string\" && dateToCheck !== undefined) {\n", " // disabled by date string\n", " var parsed = self.parseDate(d, undefined, true);\n", " return parsed && parsed.getTime() === dateToCheck.getTime()\n", " ? bool\n", " : !bool;\n", " }\n", " else if (\n", " // disabled by range\n", " typeof d === \"object\" &&\n", " dateToCheck !== undefined &&\n", " d.from &&\n", " d.to &&\n", " dateToCheck.getTime() >= d.from.getTime() &&\n", " dateToCheck.getTime() <= d.to.getTime())\n", " return bool;\n", " }\n", " return !bool;\n", " }\n", " function isInView(elem) {\n", " if (self.daysContainer !== undefined)\n", " return (elem.className.indexOf(\"hidden\") === -1 &&\n", " self.daysContainer.contains(elem));\n", " return false;\n", " }\n", " function onKeyDown(e) {\n", " // e.key e.keyCode\n", " // \"Backspace\" 8\n", " // \"Tab\" 9\n", " // \"Enter\" 13\n", " // \"Escape\" (IE \"Esc\") 27\n", " // \"ArrowLeft\" (IE \"Left\") 37\n", " // \"ArrowUp\" (IE \"Up\") 38\n", " // \"ArrowRight\" (IE \"Right\") 39\n", " // \"ArrowDown\" (IE \"Down\") 40\n", " // \"Delete\" (IE \"Del\") 46\n", " var isInput = e.target === self._input;\n", " var allowInput = self.config.allowInput;\n", " var allowKeydown = self.isOpen && (!allowInput || !isInput);\n", " var allowInlineKeydown = self.config.inline && isInput && !allowInput;\n", " if (e.keyCode === 13 && isInput) {\n", " if (allowInput) {\n", " self.setDate(self._input.value, true, e.target === self.altInput\n", " ? self.config.altFormat\n", " : self.config.dateFormat);\n", " return e.target.blur();\n", " }\n", " else {\n", " self.open();\n", " }\n", " }\n", " else if (isCalendarElem(e.target) ||\n", " allowKeydown ||\n", " allowInlineKeydown) {\n", " var isTimeObj = !!self.timeContainer &&\n", " self.timeContainer.contains(e.target);\n", " switch (e.keyCode) {\n", " case 13:\n", " if (isTimeObj) {\n", " e.preventDefault();\n", " updateTime();\n", " focusAndClose();\n", " }\n", " else\n", " selectDate(e);\n", " break;\n", " case 27: // escape\n", " e.preventDefault();\n", " focusAndClose();\n", " break;\n", " case 8:\n", " case 46:\n", " if (isInput && !self.config.allowInput) {\n", " e.preventDefault();\n", " self.clear();\n", " }\n", " break;\n", " case 37:\n", " case 39:\n", " if (!isTimeObj && !isInput) {\n", " e.preventDefault();\n", " if (self.daysContainer !== undefined &&\n", " (allowInput === false ||\n", " (document.activeElement && isInView(document.activeElement)))) {\n", " var delta_1 = e.keyCode === 39 ? 1 : -1;\n", " if (!e.ctrlKey)\n", " focusOnDay(undefined, delta_1);\n", " else {\n", " e.stopPropagation();\n", " changeMonth(delta_1);\n", " focusOnDay(getFirstAvailableDay(1), 0);\n", " }\n", " }\n", " }\n", " else if (self.hourElement)\n", " self.hourElement.focus();\n", " break;\n", " case 38:\n", " case 40:\n", " e.preventDefault();\n", " var delta = e.keyCode === 40 ? 1 : -1;\n", " if ((self.daysContainer && e.target.$i !== undefined) ||\n", " e.target === self.input ||\n", " e.target === self.altInput) {\n", " if (e.ctrlKey) {\n", " e.stopPropagation();\n", " changeYear(self.currentYear - delta);\n", " focusOnDay(getFirstAvailableDay(1), 0);\n", " }\n", " else if (!isTimeObj)\n", " focusOnDay(undefined, delta * 7);\n", " }\n", " else if (e.target === self.currentYearElement) {\n", " changeYear(self.currentYear - delta);\n", " }\n", " else if (self.config.enableTime) {\n", " if (!isTimeObj && self.hourElement)\n", " self.hourElement.focus();\n", " updateTime(e);\n", " self._debouncedChange();\n", " }\n", " break;\n", " case 9:\n", " if (isTimeObj) {\n", " var elems = [\n", " self.hourElement,\n", " self.minuteElement,\n", " self.secondElement,\n", " self.amPM,\n", " ]\n", " .concat(self.pluginElements)\n", " .filter(function (x) { return x; });\n", " var i = elems.indexOf(e.target);\n", " if (i !== -1) {\n", " var target = elems[i + (e.shiftKey ? -1 : 1)];\n", " e.preventDefault();\n", " (target || self._input).focus();\n", " }\n", " }\n", " else if (!self.config.noCalendar &&\n", " self.daysContainer &&\n", " self.daysContainer.contains(e.target) &&\n", " e.shiftKey) {\n", " e.preventDefault();\n", " self._input.focus();\n", " }\n", " break;\n", " default:\n", " break;\n", " }\n", " }\n", " if (self.amPM !== undefined && e.target === self.amPM) {\n", " switch (e.key) {\n", " case self.l10n.amPM[0].charAt(0):\n", " case self.l10n.amPM[0].charAt(0).toLowerCase():\n", " self.amPM.textContent = self.l10n.amPM[0];\n", " setHoursFromInputs();\n", " updateValue();\n", " break;\n", " case self.l10n.amPM[1].charAt(0):\n", " case self.l10n.amPM[1].charAt(0).toLowerCase():\n", " self.amPM.textContent = self.l10n.amPM[1];\n", " setHoursFromInputs();\n", " updateValue();\n", " break;\n", " }\n", " }\n", " if (isInput || isCalendarElem(e.target)) {\n", " triggerEvent(\"onKeyDown\", e);\n", " }\n", " }\n", " function onMouseOver(elem) {\n", " if (self.selectedDates.length !== 1 ||\n", " (elem &&\n", " (!elem.classList.contains(\"flatpickr-day\") ||\n", " elem.classList.contains(\"flatpickr-disabled\"))))\n", " return;\n", " var hoverDate = elem\n", " ? elem.dateObj.getTime()\n", " : self.days.firstElementChild.dateObj.getTime(), initialDate = self.parseDate(self.selectedDates[0], undefined, true).getTime(), rangeStartDate = Math.min(hoverDate, self.selectedDates[0].getTime()), rangeEndDate = Math.max(hoverDate, self.selectedDates[0].getTime());\n", " var containsDisabled = false;\n", " var minRange = 0, maxRange = 0;\n", " for (var t = rangeStartDate; t < rangeEndDate; t += duration.DAY) {\n", " if (!isEnabled(new Date(t), true)) {\n", " containsDisabled =\n", " containsDisabled || (t > rangeStartDate && t < rangeEndDate);\n", " if (t < initialDate && (!minRange || t > minRange))\n", " minRange = t;\n", " else if (t > initialDate && (!maxRange || t < maxRange))\n", " maxRange = t;\n", " }\n", " }\n", " for (var m = 0; m < self.config.showMonths; m++) {\n", " var month = self.daysContainer.children[m];\n", " var _loop_1 = function (i, l) {\n", " var dayElem = month.children[i], date = dayElem.dateObj;\n", " var timestamp = date.getTime();\n", " var outOfRange = (minRange > 0 && timestamp < minRange) ||\n", " (maxRange > 0 && timestamp > maxRange);\n", " if (outOfRange) {\n", " dayElem.classList.add(\"notAllowed\");\n", " [\"inRange\", \"startRange\", \"endRange\"].forEach(function (c) {\n", " dayElem.classList.remove(c);\n", " });\n", " return \"continue\";\n", " }\n", " else if (containsDisabled && !outOfRange)\n", " return \"continue\";\n", " [\"startRange\", \"inRange\", \"endRange\", \"notAllowed\"].forEach(function (c) {\n", " dayElem.classList.remove(c);\n", " });\n", " if (elem !== undefined) {\n", " elem.classList.add(hoverDate <= self.selectedDates[0].getTime()\n", " ? \"startRange\"\n", " : \"endRange\");\n", " if (initialDate < hoverDate && timestamp === initialDate)\n", " dayElem.classList.add(\"startRange\");\n", " else if (initialDate > hoverDate && timestamp === initialDate)\n", " dayElem.classList.add(\"endRange\");\n", " if (timestamp >= minRange &&\n", " (maxRange === 0 || timestamp <= maxRange) &&\n", " isBetween(timestamp, initialDate, hoverDate))\n", " dayElem.classList.add(\"inRange\");\n", " }\n", " };\n", " for (var i = 0, l = month.children.length; i < l; i++) {\n", " _loop_1(i, l);\n", " }\n", " }\n", " }\n", " function onResize() {\n", " if (self.isOpen && !self.config.static && !self.config.inline)\n", " positionCalendar();\n", " }\n", " function setDefaultTime() {\n", " self.setDate(self.config.minDate !== undefined\n", " ? new Date(self.config.minDate.getTime())\n", " : new Date(), true);\n", " setDefaultHours();\n", " updateValue();\n", " }\n", " function open(e, positionElement) {\n", " if (positionElement === void 0) {\n", " positionElement = self._positionElement;\n", " }\n", " if (self.isMobile === true) {\n", " if (e) {\n", " e.preventDefault();\n", " e.target && e.target.blur();\n", " }\n", " if (self.mobileInput !== undefined) {\n", " self.mobileInput.focus();\n", " self.mobileInput.click();\n", " }\n", " triggerEvent(\"onOpen\");\n", " return;\n", " }\n", " if (self._input.disabled || self.config.inline)\n", " return;\n", " var wasOpen = self.isOpen;\n", " self.isOpen = true;\n", " if (!wasOpen) {\n", " self.calendarContainer.classList.add(\"open\");\n", " self._input.classList.add(\"active\");\n", " triggerEvent(\"onOpen\");\n", " positionCalendar(positionElement);\n", " }\n", " if (self.config.enableTime === true && self.config.noCalendar === true) {\n", " if (self.selectedDates.length === 0) {\n", " setDefaultTime();\n", " }\n", " if (self.config.allowInput === false &&\n", " (e === undefined ||\n", " !self.timeContainer.contains(e.relatedTarget))) {\n", " setTimeout(function () { return self.hourElement.select(); }, 50);\n", " }\n", " }\n", " }\n", " function minMaxDateSetter(type) {\n", " return function (date) {\n", " var dateObj = (self.config[\"_\" + type + \"Date\"] = self.parseDate(date, self.config.dateFormat));\n", " var inverseDateObj = self.config[\"_\" + (type === \"min\" ? \"max\" : \"min\") + \"Date\"];\n", " if (dateObj !== undefined) {\n", " self[type === \"min\" ? \"minDateHasTime\" : \"maxDateHasTime\"] =\n", " dateObj.getHours() > 0 ||\n", " dateObj.getMinutes() > 0 ||\n", " dateObj.getSeconds() > 0;\n", " }\n", " if (self.selectedDates) {\n", " self.selectedDates = self.selectedDates.filter(function (d) { return isEnabled(d); });\n", " if (!self.selectedDates.length && type === \"min\")\n", " setHoursFromDate(dateObj);\n", " updateValue();\n", " }\n", " if (self.daysContainer) {\n", " redraw();\n", " if (dateObj !== undefined)\n", " self.currentYearElement[type] = dateObj.getFullYear().toString();\n", " else\n", " self.currentYearElement.removeAttribute(type);\n", " self.currentYearElement.disabled =\n", " !!inverseDateObj &&\n", " dateObj !== undefined &&\n", " inverseDateObj.getFullYear() === dateObj.getFullYear();\n", " }\n", " };\n", " }\n", " function parseConfig() {\n", " var boolOpts = [\n", " \"wrap\",\n", " \"weekNumbers\",\n", " \"allowInput\",\n", " \"clickOpens\",\n", " \"time_24hr\",\n", " \"enableTime\",\n", " \"noCalendar\",\n", " \"altInput\",\n", " \"shorthandCurrentMonth\",\n", " \"inline\",\n", " \"static\",\n", " \"enableSeconds\",\n", " \"disableMobile\",\n", " ];\n", " var userConfig = __assign({}, instanceConfig, JSON.parse(JSON.stringify(element.dataset || {})));\n", " var formats = {};\n", " self.config.parseDate = userConfig.parseDate;\n", " self.config.formatDate = userConfig.formatDate;\n", " Object.defineProperty(self.config, \"enable\", {\n", " get: function () { return self.config._enable; },\n", " set: function (dates) {\n", " self.config._enable = parseDateRules(dates);\n", " }\n", " });\n", " Object.defineProperty(self.config, \"disable\", {\n", " get: function () { return self.config._disable; },\n", " set: function (dates) {\n", " self.config._disable = parseDateRules(dates);\n", " }\n", " });\n", " var timeMode = userConfig.mode === \"time\";\n", " if (!userConfig.dateFormat && (userConfig.enableTime || timeMode)) {\n", " var defaultDateFormat = flatpickr.defaultConfig.dateFormat || defaults.dateFormat;\n", " formats.dateFormat =\n", " userConfig.noCalendar || timeMode\n", " ? \"H:i\" + (userConfig.enableSeconds ? \":S\" : \"\")\n", " : defaultDateFormat + \" H:i\" + (userConfig.enableSeconds ? \":S\" : \"\");\n", " }\n", " if (userConfig.altInput &&\n", " (userConfig.enableTime || timeMode) &&\n", " !userConfig.altFormat) {\n", " var defaultAltFormat = flatpickr.defaultConfig.altFormat || defaults.altFormat;\n", " formats.altFormat =\n", " userConfig.noCalendar || timeMode\n", " ? \"h:i\" + (userConfig.enableSeconds ? \":S K\" : \" K\")\n", " : defaultAltFormat + (\" h:i\" + (userConfig.enableSeconds ? \":S\" : \"\") + \" K\");\n", " }\n", " if (!userConfig.altInputClass) {\n", " self.config.altInputClass =\n", " self.input.className + \" \" + self.config.altInputClass;\n", " }\n", " Object.defineProperty(self.config, \"minDate\", {\n", " get: function () { return self.config._minDate; },\n", " set: minMaxDateSetter(\"min\")\n", " });\n", " Object.defineProperty(self.config, \"maxDate\", {\n", " get: function () { return self.config._maxDate; },\n", " set: minMaxDateSetter(\"max\")\n", " });\n", " var minMaxTimeSetter = function (type) {\n", " return function (val) {\n", " self.config[type === \"min\" ? \"_minTime\" : \"_maxTime\"] = self.parseDate(val, \"H:i:S\");\n", " };\n", " };\n", " Object.defineProperty(self.config, \"minTime\", {\n", " get: function () { return self.config._minTime; },\n", " set: minMaxTimeSetter(\"min\")\n", " });\n", " Object.defineProperty(self.config, \"maxTime\", {\n", " get: function () { return self.config._maxTime; },\n", " set: minMaxTimeSetter(\"max\")\n", " });\n", " if (userConfig.mode === \"time\") {\n", " self.config.noCalendar = true;\n", " self.config.enableTime = true;\n", " }\n", " Object.assign(self.config, formats, userConfig);\n", " for (var i = 0; i < boolOpts.length; i++)\n", " self.config[boolOpts[i]] =\n", " self.config[boolOpts[i]] === true ||\n", " self.config[boolOpts[i]] === \"true\";\n", " HOOKS.filter(function (hook) { return self.config[hook] !== undefined; }).forEach(function (hook) {\n", " self.config[hook] = arrayify(self.config[hook] || []).map(bindToInstance);\n", " });\n", " self.isMobile =\n", " !self.config.disableMobile &&\n", " !self.config.inline &&\n", " self.config.mode === \"single\" &&\n", " !self.config.disable.length &&\n", " !self.config.enable.length &&\n", " !self.config.weekNumbers &&\n", " /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);\n", " for (var i = 0; i < self.config.plugins.length; i++) {\n", " var pluginConf = self.config.plugins[i](self) || {};\n", " for (var key in pluginConf) {\n", " if (HOOKS.indexOf(key) > -1) {\n", " self.config[key] = arrayify(pluginConf[key])\n", " .map(bindToInstance)\n", " .concat(self.config[key]);\n", " }\n", " else if (typeof userConfig[key] === \"undefined\")\n", " self.config[key] = pluginConf[key];\n", " }\n", " }\n", " triggerEvent(\"onParseConfig\");\n", " }\n", " function setupLocale() {\n", " if (typeof self.config.locale !== \"object\" &&\n", " typeof flatpickr.l10ns[self.config.locale] === \"undefined\")\n", " self.config.errorHandler(new Error(\"flatpickr: invalid locale \" + self.config.locale));\n", " self.l10n = __assign({}, flatpickr.l10ns[\"default\"], (typeof self.config.locale === \"object\"\n", " ? self.config.locale\n", " : self.config.locale !== \"default\"\n", " ? flatpickr.l10ns[self.config.locale]\n", " : undefined));\n", " tokenRegex.K = \"(\" + self.l10n.amPM[0] + \"|\" + self.l10n.amPM[1] + \"|\" + self.l10n.amPM[0].toLowerCase() + \"|\" + self.l10n.amPM[1].toLowerCase() + \")\";\n", " var userConfig = __assign({}, instanceConfig, JSON.parse(JSON.stringify(element.dataset || {})));\n", " if (userConfig.time_24hr === undefined &&\n", " flatpickr.defaultConfig.time_24hr === undefined) {\n", " self.config.time_24hr = self.l10n.time_24hr;\n", " }\n", " self.formatDate = createDateFormatter(self);\n", " self.parseDate = createDateParser({ config: self.config, l10n: self.l10n });\n", " }\n", " function positionCalendar(customPositionElement) {\n", " if (self.calendarContainer === undefined)\n", " return;\n", " triggerEvent(\"onPreCalendarPosition\");\n", " var positionElement = customPositionElement || self._positionElement;\n", " var calendarHeight = Array.prototype.reduce.call(self.calendarContainer.children, (function (acc, child) { return acc + child.offsetHeight; }), 0), calendarWidth = self.calendarContainer.offsetWidth, configPos = self.config.position.split(\" \"), configPosVertical = configPos[0], configPosHorizontal = configPos.length > 1 ? configPos[1] : null, inputBounds = positionElement.getBoundingClientRect(), distanceFromBottom = window.innerHeight - inputBounds.bottom, showOnTop = configPosVertical === \"above\" ||\n", " (configPosVertical !== \"below\" &&\n", " distanceFromBottom < calendarHeight &&\n", " inputBounds.top > calendarHeight);\n", " var top = window.pageYOffset +\n", " inputBounds.top +\n", " (!showOnTop ? positionElement.offsetHeight + 2 : -calendarHeight - 2);\n", " toggleClass(self.calendarContainer, \"arrowTop\", !showOnTop);\n", " toggleClass(self.calendarContainer, \"arrowBottom\", showOnTop);\n", " if (self.config.inline)\n", " return;\n", " var left = window.pageXOffset +\n", " inputBounds.left -\n", " (configPosHorizontal != null && configPosHorizontal === \"center\"\n", " ? (calendarWidth - inputBounds.width) / 2\n", " : 0);\n", " var right = window.document.body.offsetWidth - (window.pageXOffset + inputBounds.right);\n", " var rightMost = left + calendarWidth > window.document.body.offsetWidth;\n", " var centerMost = right + calendarWidth > window.document.body.offsetWidth;\n", " toggleClass(self.calendarContainer, \"rightMost\", rightMost);\n", " if (self.config.static)\n", " return;\n", " self.calendarContainer.style.top = top + \"px\";\n", " if (!rightMost) {\n", " self.calendarContainer.style.left = left + \"px\";\n", " self.calendarContainer.style.right = \"auto\";\n", " }\n", " else if (!centerMost) {\n", " self.calendarContainer.style.left = \"auto\";\n", " self.calendarContainer.style.right = right + \"px\";\n", " }\n", " else {\n", " var doc = document.styleSheets[0];\n", " // some testing environments don't have css support\n", " if (doc === undefined)\n", " return;\n", " var bodyWidth = window.document.body.offsetWidth;\n", " var centerLeft = Math.max(0, bodyWidth / 2 - calendarWidth / 2);\n", " var centerBefore = \".flatpickr-calendar.centerMost:before\";\n", " var centerAfter = \".flatpickr-calendar.centerMost:after\";\n", " var centerIndex = doc.cssRules.length;\n", " var centerStyle = \"{left:\" + inputBounds.left + \"px;right:auto;}\";\n", " toggleClass(self.calendarContainer, \"rightMost\", false);\n", " toggleClass(self.calendarContainer, \"centerMost\", true);\n", " doc.insertRule(centerBefore + \",\" + centerAfter + centerStyle, centerIndex);\n", " self.calendarContainer.style.left = centerLeft + \"px\";\n", " self.calendarContainer.style.right = \"auto\";\n", " }\n", " }\n", " function redraw() {\n", " if (self.config.noCalendar || self.isMobile)\n", " return;\n", " updateNavigationCurrentMonth();\n", " buildDays();\n", " }\n", " function focusAndClose() {\n", " self._input.focus();\n", " if (window.navigator.userAgent.indexOf(\"MSIE\") !== -1 ||\n", " navigator.msMaxTouchPoints !== undefined) {\n", " // hack - bugs in the way IE handles focus keeps the calendar open\n", " setTimeout(self.close, 0);\n", " }\n", " else {\n", " self.close();\n", " }\n", " }\n", " function selectDate(e) {\n", " e.preventDefault();\n", " e.stopPropagation();\n", " var isSelectable = function (day) {\n", " return day.classList &&\n", " day.classList.contains(\"flatpickr-day\") &&\n", " !day.classList.contains(\"flatpickr-disabled\") &&\n", " !day.classList.contains(\"notAllowed\");\n", " };\n", " var t = findParent(e.target, isSelectable);\n", " if (t === undefined)\n", " return;\n", " var target = t;\n", " var selectedDate = (self.latestSelectedDateObj = new Date(target.dateObj.getTime()));\n", " var shouldChangeMonth = (selectedDate.getMonth() < self.currentMonth ||\n", " selectedDate.getMonth() >\n", " self.currentMonth + self.config.showMonths - 1) &&\n", " self.config.mode !== \"range\";\n", " self.selectedDateElem = target;\n", " if (self.config.mode === \"single\")\n", " self.selectedDates = [selectedDate];\n", " else if (self.config.mode === \"multiple\") {\n", " var selectedIndex = isDateSelected(selectedDate);\n", " if (selectedIndex)\n", " self.selectedDates.splice(parseInt(selectedIndex), 1);\n", " else\n", " self.selectedDates.push(selectedDate);\n", " }\n", " else if (self.config.mode === \"range\") {\n", " if (self.selectedDates.length === 2) {\n", " self.clear(false, false);\n", " }\n", " self.latestSelectedDateObj = selectedDate;\n", " self.selectedDates.push(selectedDate);\n", " // unless selecting same date twice, sort ascendingly\n", " if (compareDates(selectedDate, self.selectedDates[0], true) !== 0)\n", " self.selectedDates.sort(function (a, b) { return a.getTime() - b.getTime(); });\n", " }\n", " setHoursFromInputs();\n", " if (shouldChangeMonth) {\n", " var isNewYear = self.currentYear !== selectedDate.getFullYear();\n", " self.currentYear = selectedDate.getFullYear();\n", " self.currentMonth = selectedDate.getMonth();\n", " if (isNewYear) {\n", " triggerEvent(\"onYearChange\");\n", " buildMonthSwitch();\n", " }\n", " triggerEvent(\"onMonthChange\");\n", " }\n", " updateNavigationCurrentMonth();\n", " buildDays();\n", " updateValue();\n", " if (self.config.enableTime)\n", " setTimeout(function () { return (self.showTimeInput = true); }, 50);\n", " // maintain focus\n", " if (!shouldChangeMonth &&\n", " self.config.mode !== \"range\" &&\n", " self.config.showMonths === 1)\n", " focusOnDayElem(target);\n", " else if (self.selectedDateElem !== undefined &&\n", " self.hourElement === undefined) {\n", " self.selectedDateElem && self.selectedDateElem.focus();\n", " }\n", " if (self.hourElement !== undefined)\n", " self.hourElement !== undefined && self.hourElement.focus();\n", " if (self.config.closeOnSelect) {\n", " var single = self.config.mode === \"single\" && !self.config.enableTime;\n", " var range = self.config.mode === \"range\" &&\n", " self.selectedDates.length === 2 &&\n", " !self.config.enableTime;\n", " if (single || range) {\n", " focusAndClose();\n", " }\n", " }\n", " triggerChange();\n", " }\n", " var CALLBACKS = {\n", " locale: [setupLocale, updateWeekdays],\n", " showMonths: [buildMonths, setCalendarWidth, buildWeekdays],\n", " minDate: [jumpToDate],\n", " maxDate: [jumpToDate]\n", " };\n", " function set(option, value) {\n", " if (option !== null && typeof option === \"object\") {\n", " Object.assign(self.config, option);\n", " for (var key in option) {\n", " if (CALLBACKS[key] !== undefined)\n", " CALLBACKS[key].forEach(function (x) { return x(); });\n", " }\n", " }\n", " else {\n", " self.config[option] = value;\n", " if (CALLBACKS[option] !== undefined)\n", " CALLBACKS[option].forEach(function (x) { return x(); });\n", " else if (HOOKS.indexOf(option) > -1)\n", " self.config[option] = arrayify(value);\n", " }\n", " self.redraw();\n", " updateValue(false);\n", " }\n", " function setSelectedDate(inputDate, format) {\n", " var dates = [];\n", " if (inputDate instanceof Array)\n", " dates = inputDate.map(function (d) { return self.parseDate(d, format); });\n", " else if (inputDate instanceof Date || typeof inputDate === \"number\")\n", " dates = [self.parseDate(inputDate, format)];\n", " else if (typeof inputDate === \"string\") {\n", " switch (self.config.mode) {\n", " case \"single\":\n", " case \"time\":\n", " dates = [self.parseDate(inputDate, format)];\n", " break;\n", " case \"multiple\":\n", " dates = inputDate\n", " .split(self.config.conjunction)\n", " .map(function (date) { return self.parseDate(date, format); });\n", " break;\n", " case \"range\":\n", " dates = inputDate\n", " .split(self.l10n.rangeSeparator)\n", " .map(function (date) { return self.parseDate(date, format); });\n", " break;\n", " default:\n", " break;\n", " }\n", " }\n", " else\n", " self.config.errorHandler(new Error(\"Invalid date supplied: \" + JSON.stringify(inputDate)));\n", " self.selectedDates = dates.filter(function (d) { return d instanceof Date && isEnabled(d, false); });\n", " if (self.config.mode === \"range\")\n", " self.selectedDates.sort(function (a, b) { return a.getTime() - b.getTime(); });\n", " }\n", " function setDate(date, triggerChange, format) {\n", " if (triggerChange === void 0) {\n", " triggerChange = false;\n", " }\n", " if (format === void 0) {\n", " format = self.config.dateFormat;\n", " }\n", " if ((date !== 0 && !date) || (date instanceof Array && date.length === 0))\n", " return self.clear(triggerChange);\n", " setSelectedDate(date, format);\n", " self.showTimeInput = self.selectedDates.length > 0;\n", " self.latestSelectedDateObj =\n", " self.selectedDates[self.selectedDates.length - 1];\n", " self.redraw();\n", " jumpToDate();\n", " setHoursFromDate();\n", " if (self.selectedDates.length === 0) {\n", " self.clear(false);\n", " }\n", " updateValue(triggerChange);\n", " if (triggerChange)\n", " triggerEvent(\"onChange\");\n", " }\n", " function parseDateRules(arr) {\n", " return arr\n", " .slice()\n", " .map(function (rule) {\n", " if (typeof rule === \"string\" ||\n", " typeof rule === \"number\" ||\n", " rule instanceof Date) {\n", " return self.parseDate(rule, undefined, true);\n", " }\n", " else if (rule &&\n", " typeof rule === \"object\" &&\n", " rule.from &&\n", " rule.to)\n", " return {\n", " from: self.parseDate(rule.from, undefined),\n", " to: self.parseDate(rule.to, undefined)\n", " };\n", " return rule;\n", " })\n", " .filter(function (x) { return x; }); // remove falsy values\n", " }\n", " function setupDates() {\n", " self.selectedDates = [];\n", " self.now = self.parseDate(self.config.now) || new Date();\n", " // Workaround IE11 setting placeholder as the input's value\n", " var preloadedDate = self.config.defaultDate ||\n", " ((self.input.nodeName === \"INPUT\" ||\n", " self.input.nodeName === \"TEXTAREA\") &&\n", " self.input.placeholder &&\n", " self.input.value === self.input.placeholder\n", " ? null\n", " : self.input.value);\n", " if (preloadedDate)\n", " setSelectedDate(preloadedDate, self.config.dateFormat);\n", " self._initialDate =\n", " self.selectedDates.length > 0\n", " ? self.selectedDates[0]\n", " : self.config.minDate &&\n", " self.config.minDate.getTime() > self.now.getTime()\n", " ? self.config.minDate\n", " : self.config.maxDate &&\n", " self.config.maxDate.getTime() < self.now.getTime()\n", " ? self.config.maxDate\n", " : self.now;\n", " self.currentYear = self._initialDate.getFullYear();\n", " self.currentMonth = self._initialDate.getMonth();\n", " if (self.selectedDates.length > 0)\n", " self.latestSelectedDateObj = self.selectedDates[0];\n", " if (self.config.minTime !== undefined)\n", " self.config.minTime = self.parseDate(self.config.minTime, \"H:i\");\n", " if (self.config.maxTime !== undefined)\n", " self.config.maxTime = self.parseDate(self.config.maxTime, \"H:i\");\n", " self.minDateHasTime =\n", " !!self.config.minDate &&\n", " (self.config.minDate.getHours() > 0 ||\n", " self.config.minDate.getMinutes() > 0 ||\n", " self.config.minDate.getSeconds() > 0);\n", " self.maxDateHasTime =\n", " !!self.config.maxDate &&\n", " (self.config.maxDate.getHours() > 0 ||\n", " self.config.maxDate.getMinutes() > 0 ||\n", " self.config.maxDate.getSeconds() > 0);\n", " Object.defineProperty(self, \"showTimeInput\", {\n", " get: function () { return self._showTimeInput; },\n", " set: function (bool) {\n", " self._showTimeInput = bool;\n", " if (self.calendarContainer)\n", " toggleClass(self.calendarContainer, \"showTimeInput\", bool);\n", " self.isOpen && positionCalendar();\n", " }\n", " });\n", " }\n", " function setupInputs() {\n", " self.input = self.config.wrap\n", " ? element.querySelector(\"[data-input]\")\n", " : element;\n", " /* istanbul ignore next */\n", " if (!self.input) {\n", " self.config.errorHandler(new Error(\"Invalid input element specified\"));\n", " return;\n", " }\n", " // hack: store previous type to restore it after destroy()\n", " self.input._type = self.input.type;\n", " self.input.type = \"text\";\n", " self.input.classList.add(\"flatpickr-input\");\n", " self._input = self.input;\n", " if (self.config.altInput) {\n", " // replicate self.element\n", " self.altInput = createElement(self.input.nodeName, self.config.altInputClass);\n", " self._input = self.altInput;\n", " self.altInput.placeholder = self.input.placeholder;\n", " self.altInput.disabled = self.input.disabled;\n", " self.altInput.required = self.input.required;\n", " self.altInput.tabIndex = self.input.tabIndex;\n", " self.altInput.type = \"text\";\n", " self.input.setAttribute(\"type\", \"hidden\");\n", " if (!self.config.static && self.input.parentNode)\n", " self.input.parentNode.insertBefore(self.altInput, self.input.nextSibling);\n", " }\n", " if (!self.config.allowInput)\n", " self._input.setAttribute(\"readonly\", \"readonly\");\n", " self._positionElement = self.config.positionElement || self._input;\n", " }\n", " function setupMobile() {\n", " var inputType = self.config.enableTime\n", " ? self.config.noCalendar\n", " ? \"time\"\n", " : \"datetime-local\"\n", " : \"date\";\n", " self.mobileInput = createElement(\"input\", self.input.className + \" flatpickr-mobile\");\n", " self.mobileInput.step = self.input.getAttribute(\"step\") || \"any\";\n", " self.mobileInput.tabIndex = 1;\n", " self.mobileInput.type = inputType;\n", " self.mobileInput.disabled = self.input.disabled;\n", " self.mobileInput.required = self.input.required;\n", " self.mobileInput.placeholder = self.input.placeholder;\n", " self.mobileFormatStr =\n", " inputType === \"datetime-local\"\n", " ? \"Y-m-d\\\\TH:i:S\"\n", " : inputType === \"date\"\n", " ? \"Y-m-d\"\n", " : \"H:i:S\";\n", " if (self.selectedDates.length > 0) {\n", " self.mobileInput.defaultValue = self.mobileInput.value = self.formatDate(self.selectedDates[0], self.mobileFormatStr);\n", " }\n", " if (self.config.minDate)\n", " self.mobileInput.min = self.formatDate(self.config.minDate, \"Y-m-d\");\n", " if (self.config.maxDate)\n", " self.mobileInput.max = self.formatDate(self.config.maxDate, \"Y-m-d\");\n", " self.input.type = \"hidden\";\n", " if (self.altInput !== undefined)\n", " self.altInput.type = \"hidden\";\n", " try {\n", " if (self.input.parentNode)\n", " self.input.parentNode.insertBefore(self.mobileInput, self.input.nextSibling);\n", " }\n", " catch (_a) { }\n", " bind(self.mobileInput, \"change\", function (e) {\n", " self.setDate(e.target.value, false, self.mobileFormatStr);\n", " triggerEvent(\"onChange\");\n", " triggerEvent(\"onClose\");\n", " });\n", " }\n", " function toggle(e) {\n", " if (self.isOpen === true)\n", " return self.close();\n", " self.open(e);\n", " }\n", " function triggerEvent(event, data) {\n", " // If the instance has been destroyed already, all hooks have been removed\n", " if (self.config === undefined)\n", " return;\n", " var hooks = self.config[event];\n", " if (hooks !== undefined && hooks.length > 0) {\n", " for (var i = 0; hooks[i] && i < hooks.length; i++)\n", " hooks[i](self.selectedDates, self.input.value, self, data);\n", " }\n", " if (event === \"onChange\") {\n", " self.input.dispatchEvent(createEvent(\"change\"));\n", " // many front-end frameworks bind to the input event\n", " self.input.dispatchEvent(createEvent(\"input\"));\n", " }\n", " }\n", " function createEvent(name) {\n", " var e = document.createEvent(\"Event\");\n", " e.initEvent(name, true, true);\n", " return e;\n", " }\n", " function isDateSelected(date) {\n", " for (var i = 0; i < self.selectedDates.length; i++) {\n", " if (compareDates(self.selectedDates[i], date) === 0)\n", " return \"\" + i;\n", " }\n", " return false;\n", " }\n", " function isDateInRange(date) {\n", " if (self.config.mode !== \"range\" || self.selectedDates.length < 2)\n", " return false;\n", " return (compareDates(date, self.selectedDates[0]) >= 0 &&\n", " compareDates(date, self.selectedDates[1]) <= 0);\n", " }\n", " function updateNavigationCurrentMonth() {\n", " if (self.config.noCalendar || self.isMobile || !self.monthNav)\n", " return;\n", " self.yearElements.forEach(function (yearElement, i) {\n", " var d = new Date(self.currentYear, self.currentMonth, 1);\n", " d.setMonth(self.currentMonth + i);\n", " if (self.config.showMonths > 1 ||\n", " self.config.monthSelectorType === \"static\") {\n", " self.monthElements[i].textContent =\n", " monthToStr(d.getMonth(), self.config.shorthandCurrentMonth, self.l10n) + \" \";\n", " }\n", " else {\n", " self.monthsDropdownContainer.value = d.getMonth().toString();\n", " }\n", " yearElement.value = d.getFullYear().toString();\n", " });\n", " self._hidePrevMonthArrow =\n", " self.config.minDate !== undefined &&\n", " (self.currentYear === self.config.minDate.getFullYear()\n", " ? self.currentMonth <= self.config.minDate.getMonth()\n", " : self.currentYear < self.config.minDate.getFullYear());\n", " self._hideNextMonthArrow =\n", " self.config.maxDate !== undefined &&\n", " (self.currentYear === self.config.maxDate.getFullYear()\n", " ? self.currentMonth + 1 > self.config.maxDate.getMonth()\n", " : self.currentYear > self.config.maxDate.getFullYear());\n", " }\n", " function getDateStr(format) {\n", " return self.selectedDates\n", " .map(function (dObj) { return self.formatDate(dObj, format); })\n", " .filter(function (d, i, arr) {\n", " return self.config.mode !== \"range\" ||\n", " self.config.enableTime ||\n", " arr.indexOf(d) === i;\n", " })\n", " .join(self.config.mode !== \"range\"\n", " ? self.config.conjunction\n", " : self.l10n.rangeSeparator);\n", " }\n", " /**\n", " * Updates the values of inputs associated with the calendar\n", " */\n", " function updateValue(triggerChange) {\n", " if (triggerChange === void 0) {\n", " triggerChange = true;\n", " }\n", " if (self.mobileInput !== undefined && self.mobileFormatStr) {\n", " self.mobileInput.value =\n", " self.latestSelectedDateObj !== undefined\n", " ? self.formatDate(self.latestSelectedDateObj, self.mobileFormatStr)\n", " : \"\";\n", " }\n", " self.input.value = getDateStr(self.config.dateFormat);\n", " if (self.altInput !== undefined) {\n", " self.altInput.value = getDateStr(self.config.altFormat);\n", " }\n", " if (triggerChange !== false)\n", " triggerEvent(\"onValueUpdate\");\n", " }\n", " function onMonthNavClick(e) {\n", " var isPrevMonth = self.prevMonthNav.contains(e.target);\n", " var isNextMonth = self.nextMonthNav.contains(e.target);\n", " if (isPrevMonth || isNextMonth) {\n", " changeMonth(isPrevMonth ? -1 : 1);\n", " }\n", " else if (self.yearElements.indexOf(e.target) >= 0) {\n", " e.target.select();\n", " }\n", " else if (e.target.classList.contains(\"arrowUp\")) {\n", " self.changeYear(self.currentYear + 1);\n", " }\n", " else if (e.target.classList.contains(\"arrowDown\")) {\n", " self.changeYear(self.currentYear - 1);\n", " }\n", " }\n", " function timeWrapper(e) {\n", " e.preventDefault();\n", " var isKeyDown = e.type === \"keydown\", input = e.target;\n", " if (self.amPM !== undefined && e.target === self.amPM) {\n", " self.amPM.textContent =\n", " self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])];\n", " }\n", " var min = parseFloat(input.getAttribute(\"min\")), max = parseFloat(input.getAttribute(\"max\")), step = parseFloat(input.getAttribute(\"step\")), curValue = parseInt(input.value, 10), delta = e.delta ||\n", " (isKeyDown ? (e.which === 38 ? 1 : -1) : 0);\n", " var newValue = curValue + step * delta;\n", " if (typeof input.value !== \"undefined\" && input.value.length === 2) {\n", " var isHourElem = input === self.hourElement, isMinuteElem = input === self.minuteElement;\n", " if (newValue < min) {\n", " newValue =\n", " max +\n", " newValue +\n", " int(!isHourElem) +\n", " (int(isHourElem) && int(!self.amPM));\n", " if (isMinuteElem)\n", " incrementNumInput(undefined, -1, self.hourElement);\n", " }\n", " else if (newValue > max) {\n", " newValue =\n", " input === self.hourElement ? newValue - max - int(!self.amPM) : min;\n", " if (isMinuteElem)\n", " incrementNumInput(undefined, 1, self.hourElement);\n", " }\n", " if (self.amPM &&\n", " isHourElem &&\n", " (step === 1\n", " ? newValue + curValue === 23\n", " : Math.abs(newValue - curValue) > step)) {\n", " self.amPM.textContent =\n", " self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])];\n", " }\n", " input.value = pad(newValue);\n", " }\n", " }\n", " init();\n", " return self;\n", " }\n", " /* istanbul ignore next */\n", " function _flatpickr(nodeList, config) {\n", " // static list\n", " var nodes = Array.prototype.slice\n", " .call(nodeList)\n", " .filter(function (x) { return x instanceof HTMLElement; });\n", " var instances = [];\n", " for (var i = 0; i < nodes.length; i++) {\n", " var node = nodes[i];\n", " try {\n", " if (node.getAttribute(\"data-fp-omit\") !== null)\n", " continue;\n", " if (node._flatpickr !== undefined) {\n", " node._flatpickr.destroy();\n", " node._flatpickr = undefined;\n", " }\n", " node._flatpickr = FlatpickrInstance(node, config || {});\n", " instances.push(node._flatpickr);\n", " }\n", " catch (e) {\n", " console.error(e);\n", " }\n", " }\n", " return instances.length === 1 ? instances[0] : instances;\n", " }\n", " /* istanbul ignore next */\n", " if (typeof HTMLElement !== \"undefined\" &&\n", " typeof HTMLCollection !== \"undefined\" &&\n", " typeof NodeList !== \"undefined\") {\n", " // browser env\n", " HTMLCollection.prototype.flatpickr = NodeList.prototype.flatpickr = function (config) {\n", " return _flatpickr(this, config);\n", " };\n", " HTMLElement.prototype.flatpickr = function (config) {\n", " return _flatpickr([this], config);\n", " };\n", " }\n", " /* istanbul ignore next */\n", " var flatpickr = function (selector, config) {\n", " if (typeof selector === \"string\") {\n", " return _flatpickr(window.document.querySelectorAll(selector), config);\n", " }\n", " else if (selector instanceof Node) {\n", " return _flatpickr([selector], config);\n", " }\n", " else {\n", " return _flatpickr(selector, config);\n", " }\n", " };\n", " /* istanbul ignore next */\n", " flatpickr.defaultConfig = {};\n", " flatpickr.l10ns = {\n", " en: __assign({}, english),\n", " \"default\": __assign({}, english)\n", " };\n", " flatpickr.localize = function (l10n) {\n", " flatpickr.l10ns[\"default\"] = __assign({}, flatpickr.l10ns[\"default\"], l10n);\n", " };\n", " flatpickr.setDefaults = function (config) {\n", " flatpickr.defaultConfig = __assign({}, flatpickr.defaultConfig, config);\n", " };\n", " flatpickr.parseDate = createDateParser({});\n", " flatpickr.formatDate = createDateFormatter({});\n", " flatpickr.compareDates = compareDates;\n", " /* istanbul ignore next */\n", " if (typeof jQuery !== \"undefined\" && typeof jQuery.fn !== \"undefined\") {\n", " jQuery.fn.flatpickr = function (config) {\n", " return _flatpickr(this, config);\n", " };\n", " }\n", " // eslint-disable-next-line @typescript-eslint/camelcase\n", " Date.prototype.fp_incr = function (days) {\n", " return new Date(this.getFullYear(), this.getMonth(), this.getDate() + (typeof days === \"string\" ? parseInt(days, 10) : days));\n", " };\n", " if (typeof window !== \"undefined\") {\n", " window.flatpickr = flatpickr;\n", " }\n", " return flatpickr;\n", " }));\n", " },\n", " 409: /* styles/widgets/flatpickr.css.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const css = `\n", " .flatpickr-calendar {\n", " background: transparent;\n", " opacity: 0;\n", " display: none;\n", " text-align: center;\n", " visibility: hidden;\n", " padding: 0;\n", " -webkit-animation: none;\n", " animation: none;\n", " direction: ltr;\n", " border: 0;\n", " font-size: 14px;\n", " line-height: 24px;\n", " border-radius: 5px;\n", " position: absolute;\n", " width: 307.875px;\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " -ms-touch-action: manipulation;\n", " touch-action: manipulation;\n", " background: #fff;\n", " -webkit-box-shadow: 1px 0 0 #e6e6e6, -1px 0 0 #e6e6e6, 0 1px 0 #e6e6e6, 0 -1px 0 #e6e6e6, 0 3px 13px rgba(0, 0, 0, 0.08);\n", " box-shadow: 1px 0 0 #e6e6e6, -1px 0 0 #e6e6e6, 0 1px 0 #e6e6e6, 0 -1px 0 #e6e6e6, 0 3px 13px rgba(0, 0, 0, 0.08);\n", " }\n", " .flatpickr-calendar.open,\n", " .flatpickr-calendar.inline {\n", " opacity: 1;\n", " max-height: 640px;\n", " visibility: visible;\n", " }\n", " .flatpickr-calendar.open {\n", " display: inline-block;\n", " z-index: 99999;\n", " }\n", " .flatpickr-calendar.animate.open {\n", " -webkit-animation: fpFadeInDown 300ms cubic-bezier(0.23, 1, 0.32, 1);\n", " animation: fpFadeInDown 300ms cubic-bezier(0.23, 1, 0.32, 1);\n", " }\n", " .flatpickr-calendar.inline {\n", " display: block;\n", " position: relative;\n", " top: 2px;\n", " }\n", " .flatpickr-calendar.static {\n", " position: absolute;\n", " top: calc(100% + 2px);\n", " }\n", " .flatpickr-calendar.static.open {\n", " z-index: 999;\n", " display: block;\n", " }\n", " .flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+1) .flatpickr-day.inRange:nth-child(7n+7) {\n", " -webkit-box-shadow: none !important;\n", " box-shadow: none !important;\n", " }\n", " .flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+2) .flatpickr-day.inRange:nth-child(7n+1) {\n", " -webkit-box-shadow: -2px 0 0 #e6e6e6, 5px 0 0 #e6e6e6;\n", " box-shadow: -2px 0 0 #e6e6e6, 5px 0 0 #e6e6e6;\n", " }\n", " .flatpickr-calendar .hasWeeks .dayContainer,\n", " .flatpickr-calendar .hasTime .dayContainer {\n", " border-bottom: 0;\n", " border-bottom-right-radius: 0;\n", " border-bottom-left-radius: 0;\n", " }\n", " .flatpickr-calendar .hasWeeks .dayContainer {\n", " border-left: 0;\n", " }\n", " .flatpickr-calendar.showTimeInput.hasTime .flatpickr-time {\n", " height: 40px;\n", " border-top: 1px solid #e6e6e6;\n", " }\n", " .flatpickr-calendar.noCalendar.hasTime .flatpickr-time {\n", " height: auto;\n", " }\n", " .flatpickr-calendar:before,\n", " .flatpickr-calendar:after {\n", " position: absolute;\n", " display: block;\n", " pointer-events: none;\n", " border: solid transparent;\n", " content: '';\n", " height: 0;\n", " width: 0;\n", " left: 22px;\n", " }\n", " .flatpickr-calendar.rightMost:before,\n", " .flatpickr-calendar.rightMost:after {\n", " left: auto;\n", " right: 22px;\n", " }\n", " .flatpickr-calendar:before {\n", " border-width: 5px;\n", " margin: 0 -5px;\n", " }\n", " .flatpickr-calendar:after {\n", " border-width: 4px;\n", " margin: 0 -4px;\n", " }\n", " .flatpickr-calendar.arrowTop:before,\n", " .flatpickr-calendar.arrowTop:after {\n", " bottom: 100%;\n", " }\n", " .flatpickr-calendar.arrowTop:before {\n", " border-bottom-color: #e6e6e6;\n", " }\n", " .flatpickr-calendar.arrowTop:after {\n", " border-bottom-color: #fff;\n", " }\n", " .flatpickr-calendar.arrowBottom:before,\n", " .flatpickr-calendar.arrowBottom:after {\n", " top: 100%;\n", " }\n", " .flatpickr-calendar.arrowBottom:before {\n", " border-top-color: #e6e6e6;\n", " }\n", " .flatpickr-calendar.arrowBottom:after {\n", " border-top-color: #fff;\n", " }\n", " .flatpickr-calendar:focus {\n", " outline: 0;\n", " }\n", " .flatpickr-wrapper {\n", " position: relative;\n", " display: inline-block;\n", " }\n", " .flatpickr-months {\n", " display: -webkit-box;\n", " display: -webkit-flex;\n", " display: -ms-flexbox;\n", " display: flex;\n", " }\n", " .flatpickr-months .flatpickr-month {\n", " background: transparent;\n", " color: rgba(0, 0, 0, 0.9);\n", " fill: rgba(0, 0, 0, 0.9);\n", " height: 34px;\n", " line-height: 1;\n", " text-align: center;\n", " position: relative;\n", " -webkit-user-select: none;\n", " -moz-user-select: none;\n", " -ms-user-select: none;\n", " user-select: none;\n", " overflow: hidden;\n", " -webkit-box-flex: 1;\n", " -webkit-flex: 1;\n", " -ms-flex: 1;\n", " flex: 1;\n", " }\n", " .flatpickr-months .flatpickr-prev-month,\n", " .flatpickr-months .flatpickr-next-month {\n", " text-decoration: none;\n", " cursor: pointer;\n", " position: absolute;\n", " top: 0;\n", " height: 34px;\n", " padding: 10px;\n", " z-index: 3;\n", " color: rgba(0, 0, 0, 0.9);\n", " fill: rgba(0, 0, 0, 0.9);\n", " }\n", " .flatpickr-months .flatpickr-prev-month.flatpickr-disabled,\n", " .flatpickr-months .flatpickr-next-month.flatpickr-disabled {\n", " display: none;\n", " }\n", " .flatpickr-months .flatpickr-prev-month i,\n", " .flatpickr-months .flatpickr-next-month i {\n", " position: relative;\n", " }\n", " .flatpickr-months .flatpickr-prev-month.flatpickr-prev-month,\n", " .flatpickr-months .flatpickr-next-month.flatpickr-prev-month {\n", " /*\n", " /*rtl:begin:ignore*/\n", " /*\n", " */\n", " left: 0;\n", " /*\n", " /*rtl:end:ignore*/\n", " /*\n", " */\n", " }\n", " /*\n", " /*rtl:begin:ignore*/\n", " /*\n", " /*rtl:end:ignore*/\n", " .flatpickr-months .flatpickr-prev-month.flatpickr-next-month,\n", " .flatpickr-months .flatpickr-next-month.flatpickr-next-month {\n", " /*\n", " /*rtl:begin:ignore*/\n", " /*\n", " */\n", " right: 0;\n", " /*\n", " /*rtl:end:ignore*/\n", " /*\n", " */\n", " }\n", " /*\n", " /*rtl:begin:ignore*/\n", " /*\n", " /*rtl:end:ignore*/\n", " .flatpickr-months .flatpickr-prev-month:hover,\n", " .flatpickr-months .flatpickr-next-month:hover {\n", " color: #959ea9;\n", " }\n", " .flatpickr-months .flatpickr-prev-month:hover svg,\n", " .flatpickr-months .flatpickr-next-month:hover svg {\n", " fill: #f64747;\n", " }\n", " .flatpickr-months .flatpickr-prev-month svg,\n", " .flatpickr-months .flatpickr-next-month svg {\n", " width: 14px;\n", " height: 14px;\n", " }\n", " .flatpickr-months .flatpickr-prev-month svg path,\n", " .flatpickr-months .flatpickr-next-month svg path {\n", " -webkit-transition: fill 0.1s;\n", " transition: fill 0.1s;\n", " fill: inherit;\n", " }\n", " .numInputWrapper {\n", " position: relative;\n", " height: auto;\n", " }\n", " .numInputWrapper input,\n", " .numInputWrapper span {\n", " display: inline-block;\n", " }\n", " .numInputWrapper input {\n", " width: 100%;\n", " }\n", " .numInputWrapper input::-ms-clear {\n", " display: none;\n", " }\n", " .numInputWrapper input::-webkit-outer-spin-button,\n", " .numInputWrapper input::-webkit-inner-spin-button {\n", " margin: 0;\n", " -webkit-appearance: none;\n", " }\n", " .numInputWrapper span {\n", " position: absolute;\n", " right: 0;\n", " width: 14px;\n", " padding: 0 4px 0 2px;\n", " height: 50%;\n", " line-height: 50%;\n", " opacity: 0;\n", " cursor: pointer;\n", " border: 1px solid rgba(57, 57, 57, 0.15);\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " }\n", " .numInputWrapper span:hover {\n", " background: rgba(0, 0, 0, 0.1);\n", " }\n", " .numInputWrapper span:active {\n", " background: rgba(0, 0, 0, 0.2);\n", " }\n", " .numInputWrapper span:after {\n", " display: block;\n", " content: \"\";\n", " position: absolute;\n", " }\n", " .numInputWrapper span.arrowUp {\n", " top: 0;\n", " border-bottom: 0;\n", " }\n", " .numInputWrapper span.arrowUp:after {\n", " border-left: 4px solid transparent;\n", " border-right: 4px solid transparent;\n", " border-bottom: 4px solid rgba(57, 57, 57, 0.6);\n", " top: 26%;\n", " }\n", " .numInputWrapper span.arrowDown {\n", " top: 50%;\n", " }\n", " .numInputWrapper span.arrowDown:after {\n", " border-left: 4px solid transparent;\n", " border-right: 4px solid transparent;\n", " border-top: 4px solid rgba(57, 57, 57, 0.6);\n", " top: 40%;\n", " }\n", " .numInputWrapper span svg {\n", " width: inherit;\n", " height: auto;\n", " }\n", " .numInputWrapper span svg path {\n", " fill: rgba(0, 0, 0, 0.5);\n", " }\n", " .numInputWrapper:hover {\n", " background: rgba(0, 0, 0, 0.05);\n", " }\n", " .numInputWrapper:hover span {\n", " opacity: 1;\n", " }\n", " .flatpickr-current-month {\n", " font-size: 135%;\n", " line-height: inherit;\n", " font-weight: 300;\n", " color: inherit;\n", " position: absolute;\n", " width: 75%;\n", " left: 12.5%;\n", " padding: 7.48px 0 0 0;\n", " line-height: 1;\n", " height: 34px;\n", " display: inline-block;\n", " text-align: center;\n", " -webkit-transform: translate3d(0px, 0px, 0px);\n", " transform: translate3d(0px, 0px, 0px);\n", " }\n", " .flatpickr-current-month span.cur-month {\n", " font-family: inherit;\n", " font-weight: 700;\n", " color: inherit;\n", " display: inline-block;\n", " margin-left: 0.5ch;\n", " padding: 0;\n", " }\n", " .flatpickr-current-month span.cur-month:hover {\n", " background: rgba(0, 0, 0, 0.05);\n", " }\n", " .flatpickr-current-month .numInputWrapper {\n", " width: 6ch;\n", " width: 7ch\\0;\n", " display: inline-block;\n", " }\n", " .flatpickr-current-month .numInputWrapper span.arrowUp:after {\n", " border-bottom-color: rgba(0, 0, 0, 0.9);\n", " }\n", " .flatpickr-current-month .numInputWrapper span.arrowDown:after {\n", " border-top-color: rgba(0, 0, 0, 0.9);\n", " }\n", " .flatpickr-current-month input.cur-year {\n", " background: transparent;\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " color: inherit;\n", " cursor: text;\n", " padding: 0 0 0 0.5ch;\n", " margin: 0;\n", " display: inline-block;\n", " font-size: inherit;\n", " font-family: inherit;\n", " font-weight: 300;\n", " line-height: inherit;\n", " height: auto;\n", " border: 0;\n", " border-radius: 0;\n", " vertical-align: initial;\n", " -webkit-appearance: textfield;\n", " -moz-appearance: textfield;\n", " appearance: textfield;\n", " }\n", " .flatpickr-current-month input.cur-year:focus {\n", " outline: 0;\n", " }\n", " .flatpickr-current-month input.cur-year[disabled],\n", " .flatpickr-current-month input.cur-year[disabled]:hover {\n", " font-size: 100%;\n", " color: rgba(0, 0, 0, 0.5);\n", " background: transparent;\n", " pointer-events: none;\n", " }\n", " .flatpickr-current-month .flatpickr-monthDropdown-months {\n", " appearance: menulist;\n", " background: transparent;\n", " border: none;\n", " border-radius: 0;\n", " box-sizing: border-box;\n", " color: inherit;\n", " cursor: pointer;\n", " font-size: inherit;\n", " font-family: inherit;\n", " font-weight: 300;\n", " height: auto;\n", " line-height: inherit;\n", " margin: -1px 0 0 0;\n", " outline: none;\n", " padding: 0 0 0 0.5ch;\n", " position: relative;\n", " vertical-align: initial;\n", " -webkit-box-sizing: border-box;\n", " -webkit-appearance: menulist;\n", " -moz-appearance: menulist;\n", " width: auto;\n", " }\n", " .flatpickr-current-month .flatpickr-monthDropdown-months:focus,\n", " .flatpickr-current-month .flatpickr-monthDropdown-months:active {\n", " outline: none;\n", " }\n", " .flatpickr-current-month .flatpickr-monthDropdown-months:hover {\n", " background: rgba(0, 0, 0, 0.05);\n", " }\n", " .flatpickr-current-month .flatpickr-monthDropdown-months .flatpickr-monthDropdown-month {\n", " background-color: transparent;\n", " outline: none;\n", " padding: 0;\n", " }\n", " .flatpickr-weekdays {\n", " background: transparent;\n", " text-align: center;\n", " overflow: hidden;\n", " width: 100%;\n", " display: -webkit-box;\n", " display: -webkit-flex;\n", " display: -ms-flexbox;\n", " display: flex;\n", " -webkit-box-align: center;\n", " -webkit-align-items: center;\n", " -ms-flex-align: center;\n", " align-items: center;\n", " height: 28px;\n", " }\n", " .flatpickr-weekdays .flatpickr-weekdaycontainer {\n", " display: -webkit-box;\n", " display: -webkit-flex;\n", " display: -ms-flexbox;\n", " display: flex;\n", " -webkit-box-flex: 1;\n", " -webkit-flex: 1;\n", " -ms-flex: 1;\n", " flex: 1;\n", " }\n", " span.flatpickr-weekday {\n", " cursor: default;\n", " font-size: 90%;\n", " background: transparent;\n", " color: rgba(0, 0, 0, 0.54);\n", " line-height: 1;\n", " margin: 0;\n", " text-align: center;\n", " display: block;\n", " -webkit-box-flex: 1;\n", " -webkit-flex: 1;\n", " -ms-flex: 1;\n", " flex: 1;\n", " font-weight: bolder;\n", " }\n", " .dayContainer,\n", " .flatpickr-weeks {\n", " padding: 1px 0 0 0;\n", " }\n", " .flatpickr-days {\n", " position: relative;\n", " overflow: hidden;\n", " display: -webkit-box;\n", " display: -webkit-flex;\n", " display: -ms-flexbox;\n", " display: flex;\n", " -webkit-box-align: start;\n", " -webkit-align-items: flex-start;\n", " -ms-flex-align: start;\n", " align-items: flex-start;\n", " width: 307.875px;\n", " }\n", " .flatpickr-days:focus {\n", " outline: 0;\n", " }\n", " .dayContainer {\n", " padding: 0;\n", " outline: 0;\n", " text-align: left;\n", " width: 307.875px;\n", " min-width: 307.875px;\n", " max-width: 307.875px;\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " display: inline-block;\n", " display: -ms-flexbox;\n", " display: -webkit-box;\n", " display: -webkit-flex;\n", " display: flex;\n", " -webkit-flex-wrap: wrap;\n", " flex-wrap: wrap;\n", " -ms-flex-wrap: wrap;\n", " -ms-flex-pack: justify;\n", " -webkit-justify-content: space-around;\n", " justify-content: space-around;\n", " -webkit-transform: translate3d(0px, 0px, 0px);\n", " transform: translate3d(0px, 0px, 0px);\n", " opacity: 1;\n", " }\n", " .dayContainer + .dayContainer {\n", " -webkit-box-shadow: -1px 0 0 #e6e6e6;\n", " box-shadow: -1px 0 0 #e6e6e6;\n", " }\n", " .flatpickr-day {\n", " background: none;\n", " border: 1px solid transparent;\n", " border-radius: 150px;\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " color: #393939;\n", " cursor: pointer;\n", " font-weight: 400;\n", " width: 14.2857143%;\n", " -webkit-flex-basis: 14.2857143%;\n", " -ms-flex-preferred-size: 14.2857143%;\n", " flex-basis: 14.2857143%;\n", " max-width: 39px;\n", " height: 39px;\n", " line-height: 39px;\n", " margin: 0;\n", " display: inline-block;\n", " position: relative;\n", " -webkit-box-pack: center;\n", " -webkit-justify-content: center;\n", " -ms-flex-pack: center;\n", " justify-content: center;\n", " text-align: center;\n", " }\n", " .flatpickr-day.inRange,\n", " .flatpickr-day.prevMonthDay.inRange,\n", " .flatpickr-day.nextMonthDay.inRange,\n", " .flatpickr-day.today.inRange,\n", " .flatpickr-day.prevMonthDay.today.inRange,\n", " .flatpickr-day.nextMonthDay.today.inRange,\n", " .flatpickr-day:hover,\n", " .flatpickr-day.prevMonthDay:hover,\n", " .flatpickr-day.nextMonthDay:hover,\n", " .flatpickr-day:focus,\n", " .flatpickr-day.prevMonthDay:focus,\n", " .flatpickr-day.nextMonthDay:focus {\n", " cursor: pointer;\n", " outline: 0;\n", " background: #e6e6e6;\n", " border-color: #e6e6e6;\n", " }\n", " .flatpickr-day.today {\n", " border-color: #959ea9;\n", " }\n", " .flatpickr-day.today:hover,\n", " .flatpickr-day.today:focus {\n", " border-color: #959ea9;\n", " background: #959ea9;\n", " color: #fff;\n", " }\n", " .flatpickr-day.selected,\n", " .flatpickr-day.startRange,\n", " .flatpickr-day.endRange,\n", " .flatpickr-day.selected.inRange,\n", " .flatpickr-day.startRange.inRange,\n", " .flatpickr-day.endRange.inRange,\n", " .flatpickr-day.selected:focus,\n", " .flatpickr-day.startRange:focus,\n", " .flatpickr-day.endRange:focus,\n", " .flatpickr-day.selected:hover,\n", " .flatpickr-day.startRange:hover,\n", " .flatpickr-day.endRange:hover,\n", " .flatpickr-day.selected.prevMonthDay,\n", " .flatpickr-day.startRange.prevMonthDay,\n", " .flatpickr-day.endRange.prevMonthDay,\n", " .flatpickr-day.selected.nextMonthDay,\n", " .flatpickr-day.startRange.nextMonthDay,\n", " .flatpickr-day.endRange.nextMonthDay {\n", " background: #569ff7;\n", " -webkit-box-shadow: none;\n", " box-shadow: none;\n", " color: #fff;\n", " border-color: #569ff7;\n", " }\n", " .flatpickr-day.selected.startRange,\n", " .flatpickr-day.startRange.startRange,\n", " .flatpickr-day.endRange.startRange {\n", " border-radius: 50px 0 0 50px;\n", " }\n", " .flatpickr-day.selected.endRange,\n", " .flatpickr-day.startRange.endRange,\n", " .flatpickr-day.endRange.endRange {\n", " border-radius: 0 50px 50px 0;\n", " }\n", " .flatpickr-day.selected.startRange + .endRange:not(:nth-child(7n+1)),\n", " .flatpickr-day.startRange.startRange + .endRange:not(:nth-child(7n+1)),\n", " .flatpickr-day.endRange.startRange + .endRange:not(:nth-child(7n+1)) {\n", " -webkit-box-shadow: -10px 0 0 #569ff7;\n", " box-shadow: -10px 0 0 #569ff7;\n", " }\n", " .flatpickr-day.selected.startRange.endRange,\n", " .flatpickr-day.startRange.startRange.endRange,\n", " .flatpickr-day.endRange.startRange.endRange {\n", " border-radius: 50px;\n", " }\n", " .flatpickr-day.inRange {\n", " border-radius: 0;\n", " -webkit-box-shadow: -5px 0 0 #e6e6e6, 5px 0 0 #e6e6e6;\n", " box-shadow: -5px 0 0 #e6e6e6, 5px 0 0 #e6e6e6;\n", " }\n", " .flatpickr-day.flatpickr-disabled,\n", " .flatpickr-day.flatpickr-disabled:hover,\n", " .flatpickr-day.prevMonthDay,\n", " .flatpickr-day.nextMonthDay,\n", " .flatpickr-day.notAllowed,\n", " .flatpickr-day.notAllowed.prevMonthDay,\n", " .flatpickr-day.notAllowed.nextMonthDay {\n", " color: rgba(57, 57, 57, 0.3);\n", " background: transparent;\n", " border-color: transparent;\n", " cursor: default;\n", " }\n", " .flatpickr-day.flatpickr-disabled,\n", " .flatpickr-day.flatpickr-disabled:hover {\n", " cursor: not-allowed;\n", " color: rgba(57, 57, 57, 0.1);\n", " }\n", " .flatpickr-day.week.selected {\n", " border-radius: 0;\n", " -webkit-box-shadow: -5px 0 0 #569ff7, 5px 0 0 #569ff7;\n", " box-shadow: -5px 0 0 #569ff7, 5px 0 0 #569ff7;\n", " }\n", " .flatpickr-day.hidden {\n", " visibility: hidden;\n", " }\n", " .rangeMode .flatpickr-day {\n", " margin-top: 1px;\n", " }\n", " .flatpickr-weekwrapper {\n", " float: left;\n", " }\n", " .flatpickr-weekwrapper .flatpickr-weeks {\n", " padding: 0 12px;\n", " -webkit-box-shadow: 1px 0 0 #e6e6e6;\n", " box-shadow: 1px 0 0 #e6e6e6;\n", " }\n", " .flatpickr-weekwrapper .flatpickr-weekday {\n", " float: none;\n", " width: 100%;\n", " line-height: 28px;\n", " }\n", " .flatpickr-weekwrapper span.flatpickr-day,\n", " .flatpickr-weekwrapper span.flatpickr-day:hover {\n", " display: block;\n", " width: 100%;\n", " max-width: none;\n", " color: rgba(57, 57, 57, 0.3);\n", " background: transparent;\n", " cursor: default;\n", " border: none;\n", " }\n", " .flatpickr-innerContainer {\n", " display: block;\n", " display: -webkit-box;\n", " display: -webkit-flex;\n", " display: -ms-flexbox;\n", " display: flex;\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " overflow: hidden;\n", " }\n", " .flatpickr-rContainer {\n", " display: inline-block;\n", " padding: 0;\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " }\n", " .flatpickr-time {\n", " text-align: center;\n", " outline: 0;\n", " display: block;\n", " height: 0;\n", " line-height: 40px;\n", " max-height: 40px;\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " overflow: hidden;\n", " display: -webkit-box;\n", " display: -webkit-flex;\n", " display: -ms-flexbox;\n", " display: flex;\n", " }\n", " .flatpickr-time:after {\n", " content: \"\";\n", " display: table;\n", " clear: both;\n", " }\n", " .flatpickr-time .numInputWrapper {\n", " -webkit-box-flex: 1;\n", " -webkit-flex: 1;\n", " -ms-flex: 1;\n", " flex: 1;\n", " width: 40%;\n", " height: 40px;\n", " float: left;\n", " }\n", " .flatpickr-time .numInputWrapper span.arrowUp:after {\n", " border-bottom-color: #393939;\n", " }\n", " .flatpickr-time .numInputWrapper span.arrowDown:after {\n", " border-top-color: #393939;\n", " }\n", " .flatpickr-time.hasSeconds .numInputWrapper {\n", " width: 26%;\n", " }\n", " .flatpickr-time.time24hr .numInputWrapper {\n", " width: 49%;\n", " }\n", " .flatpickr-time input {\n", " background: transparent;\n", " -webkit-box-shadow: none;\n", " box-shadow: none;\n", " border: 0;\n", " border-radius: 0;\n", " text-align: center;\n", " margin: 0;\n", " padding: 0;\n", " height: inherit;\n", " line-height: inherit;\n", " color: #393939;\n", " font-size: 14px;\n", " position: relative;\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " -webkit-appearance: textfield;\n", " -moz-appearance: textfield;\n", " appearance: textfield;\n", " }\n", " .flatpickr-time input.flatpickr-hour {\n", " font-weight: bold;\n", " }\n", " .flatpickr-time input.flatpickr-minute,\n", " .flatpickr-time input.flatpickr-second {\n", " font-weight: 400;\n", " }\n", " .flatpickr-time input:focus {\n", " outline: 0;\n", " border: 0;\n", " }\n", " .flatpickr-time .flatpickr-time-separator,\n", " .flatpickr-time .flatpickr-am-pm {\n", " height: inherit;\n", " float: left;\n", " line-height: inherit;\n", " color: #393939;\n", " font-weight: bold;\n", " width: 2%;\n", " -webkit-user-select: none;\n", " -moz-user-select: none;\n", " -ms-user-select: none;\n", " user-select: none;\n", " -webkit-align-self: center;\n", " -ms-flex-item-align: center;\n", " align-self: center;\n", " }\n", " .flatpickr-time .flatpickr-am-pm {\n", " outline: 0;\n", " width: 18%;\n", " cursor: pointer;\n", " text-align: center;\n", " font-weight: 400;\n", " }\n", " .flatpickr-time input:hover,\n", " .flatpickr-time .flatpickr-am-pm:hover,\n", " .flatpickr-time input:focus,\n", " .flatpickr-time .flatpickr-am-pm:focus {\n", " background: #eee;\n", " }\n", " .flatpickr-input[readonly] {\n", " cursor: pointer;\n", " }\n", " @-webkit-keyframes fpFadeInDown {\n", " from {\n", " opacity: 0;\n", " -webkit-transform: translate3d(0, -20px, 0);\n", " transform: translate3d(0, -20px, 0);\n", " }\n", " to {\n", " opacity: 1;\n", " -webkit-transform: translate3d(0, 0, 0);\n", " transform: translate3d(0, 0, 0);\n", " }\n", " }\n", " @keyframes fpFadeInDown {\n", " from {\n", " opacity: 0;\n", " -webkit-transform: translate3d(0, -20px, 0);\n", " transform: translate3d(0, -20px, 0);\n", " }\n", " to {\n", " opacity: 1;\n", " -webkit-transform: translate3d(0, 0, 0);\n", " transform: translate3d(0, 0, 0);\n", " }\n", " }\n", " .flatpickr-calendar {\n", " background: transparent;\n", " opacity: 0;\n", " display: none;\n", " text-align: center;\n", " visibility: hidden;\n", " padding: 0;\n", " -webkit-animation: none;\n", " animation: none;\n", " direction: ltr;\n", " border: 0;\n", " font-size: 14px;\n", " line-height: 24px;\n", " border-radius: 5px;\n", " position: absolute;\n", " width: 307.875px;\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " -ms-touch-action: manipulation;\n", " touch-action: manipulation;\n", " -webkit-box-shadow: 0 3px 13px rgba(0, 0, 0, 0.08);\n", " box-shadow: 0 3px 13px rgba(0, 0, 0, 0.08);\n", " }\n", " .flatpickr-calendar.open,\n", " .flatpickr-calendar.inline {\n", " opacity: 1;\n", " max-height: 640px;\n", " visibility: visible;\n", " }\n", " .flatpickr-calendar.open {\n", " display: inline-block;\n", " z-index: 99999;\n", " }\n", " .flatpickr-calendar.animate.open {\n", " -webkit-animation: fpFadeInDown 300ms cubic-bezier(0.23, 1, 0.32, 1);\n", " animation: fpFadeInDown 300ms cubic-bezier(0.23, 1, 0.32, 1);\n", " }\n", " .flatpickr-calendar.inline {\n", " display: block;\n", " position: relative;\n", " top: 2px;\n", " }\n", " .flatpickr-calendar.static {\n", " position: absolute;\n", " top: calc(100% + 2px);\n", " }\n", " .flatpickr-calendar.static.open {\n", " z-index: 999;\n", " display: block;\n", " }\n", " .flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+1) .flatpickr-day.inRange:nth-child(7n+7) {\n", " -webkit-box-shadow: none !important;\n", " box-shadow: none !important;\n", " }\n", " .flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+2) .flatpickr-day.inRange:nth-child(7n+1) {\n", " -webkit-box-shadow: -2px 0 0 #e6e6e6, 5px 0 0 #e6e6e6;\n", " box-shadow: -2px 0 0 #e6e6e6, 5px 0 0 #e6e6e6;\n", " }\n", " .flatpickr-calendar .hasWeeks .dayContainer,\n", " .flatpickr-calendar .hasTime .dayContainer {\n", " border-bottom: 0;\n", " border-bottom-right-radius: 0;\n", " border-bottom-left-radius: 0;\n", " }\n", " .flatpickr-calendar .hasWeeks .dayContainer {\n", " border-left: 0;\n", " }\n", " .flatpickr-calendar.showTimeInput.hasTime .flatpickr-time {\n", " height: 40px;\n", " border-top: 1px solid #eceef1;\n", " }\n", " .flatpickr-calendar.showTimeInput.hasTime .flatpickr-innerContainer {\n", " border-bottom: 0;\n", " }\n", " .flatpickr-calendar.showTimeInput.hasTime .flatpickr-time {\n", " border: 1px solid #eceef1;\n", " }\n", " .flatpickr-calendar.noCalendar.hasTime .flatpickr-time {\n", " height: auto;\n", " }\n", " .flatpickr-calendar:before,\n", " .flatpickr-calendar:after {\n", " position: absolute;\n", " display: block;\n", " pointer-events: none;\n", " border: solid transparent;\n", " content: '';\n", " height: 0;\n", " width: 0;\n", " left: 22px;\n", " }\n", " .flatpickr-calendar.rightMost:before,\n", " .flatpickr-calendar.rightMost:after {\n", " left: auto;\n", " right: 22px;\n", " }\n", " .flatpickr-calendar:before {\n", " border-width: 5px;\n", " margin: 0 -5px;\n", " }\n", " .flatpickr-calendar:after {\n", " border-width: 4px;\n", " margin: 0 -4px;\n", " }\n", " .flatpickr-calendar.arrowTop:before,\n", " .flatpickr-calendar.arrowTop:after {\n", " bottom: 100%;\n", " }\n", " .flatpickr-calendar.arrowTop:before {\n", " border-bottom-color: #eceef1;\n", " }\n", " .flatpickr-calendar.arrowTop:after {\n", " border-bottom-color: #eceef1;\n", " }\n", " .flatpickr-calendar.arrowBottom:before,\n", " .flatpickr-calendar.arrowBottom:after {\n", " top: 100%;\n", " }\n", " .flatpickr-calendar.arrowBottom:before {\n", " border-top-color: #eceef1;\n", " }\n", " .flatpickr-calendar.arrowBottom:after {\n", " border-top-color: #eceef1;\n", " }\n", " .flatpickr-calendar:focus {\n", " outline: 0;\n", " }\n", " .flatpickr-wrapper {\n", " position: relative;\n", " display: inline-block;\n", " }\n", " .flatpickr-months {\n", " display: -webkit-box;\n", " display: -webkit-flex;\n", " display: -ms-flexbox;\n", " display: flex;\n", " }\n", " .flatpickr-months .flatpickr-month {\n", " border-radius: 5px 5px 0 0;\n", " background: #eceef1;\n", " color: #5a6171;\n", " fill: #5a6171;\n", " height: 34px;\n", " line-height: 1;\n", " text-align: center;\n", " position: relative;\n", " -webkit-user-select: none;\n", " -moz-user-select: none;\n", " -ms-user-select: none;\n", " user-select: none;\n", " overflow: hidden;\n", " -webkit-box-flex: 1;\n", " -webkit-flex: 1;\n", " -ms-flex: 1;\n", " flex: 1;\n", " }\n", " .flatpickr-months .flatpickr-prev-month,\n", " .flatpickr-months .flatpickr-next-month {\n", " text-decoration: none;\n", " cursor: pointer;\n", " position: absolute;\n", " top: 0;\n", " height: 34px;\n", " padding: 10px;\n", " z-index: 3;\n", " color: #5a6171;\n", " fill: #5a6171;\n", " }\n", " .flatpickr-months .flatpickr-prev-month.flatpickr-disabled,\n", " .flatpickr-months .flatpickr-next-month.flatpickr-disabled {\n", " display: none;\n", " }\n", " .flatpickr-months .flatpickr-prev-month i,\n", " .flatpickr-months .flatpickr-next-month i {\n", " position: relative;\n", " }\n", " .flatpickr-months .flatpickr-prev-month.flatpickr-prev-month,\n", " .flatpickr-months .flatpickr-next-month.flatpickr-prev-month {\n", " /*\n", " /*rtl:begin:ignore*/\n", " /*\n", " */\n", " left: 0;\n", " /*\n", " /*rtl:end:ignore*/\n", " /*\n", " */\n", " }\n", " /*\n", " /*rtl:begin:ignore*/\n", " /*\n", " /*rtl:end:ignore*/\n", " .flatpickr-months .flatpickr-prev-month.flatpickr-next-month,\n", " .flatpickr-months .flatpickr-next-month.flatpickr-next-month {\n", " /*\n", " /*rtl:begin:ignore*/\n", " /*\n", " */\n", " right: 0;\n", " /*\n", " /*rtl:end:ignore*/\n", " /*\n", " */\n", " }\n", " /*\n", " /*rtl:begin:ignore*/\n", " /*\n", " /*rtl:end:ignore*/\n", " .flatpickr-months .flatpickr-prev-month:hover,\n", " .flatpickr-months .flatpickr-next-month:hover {\n", " color: #bbb;\n", " }\n", " .flatpickr-months .flatpickr-prev-month:hover svg,\n", " .flatpickr-months .flatpickr-next-month:hover svg {\n", " fill: #f64747;\n", " }\n", " .flatpickr-months .flatpickr-prev-month svg,\n", " .flatpickr-months .flatpickr-next-month svg {\n", " width: 14px;\n", " height: 14px;\n", " }\n", " .flatpickr-months .flatpickr-prev-month svg path,\n", " .flatpickr-months .flatpickr-next-month svg path {\n", " -webkit-transition: fill 0.1s;\n", " transition: fill 0.1s;\n", " fill: inherit;\n", " }\n", " .numInputWrapper {\n", " position: relative;\n", " height: auto;\n", " }\n", " .numInputWrapper input,\n", " .numInputWrapper span {\n", " display: inline-block;\n", " }\n", " .numInputWrapper input {\n", " width: 100%;\n", " }\n", " .numInputWrapper input::-ms-clear {\n", " display: none;\n", " }\n", " .numInputWrapper input::-webkit-outer-spin-button,\n", " .numInputWrapper input::-webkit-inner-spin-button {\n", " margin: 0;\n", " -webkit-appearance: none;\n", " }\n", " .numInputWrapper span {\n", " position: absolute;\n", " right: 0;\n", " width: 14px;\n", " padding: 0 4px 0 2px;\n", " height: 50%;\n", " line-height: 50%;\n", " opacity: 0;\n", " cursor: pointer;\n", " border: 1px solid rgba(72, 72, 72, 0.15);\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " }\n", " .numInputWrapper span:hover {\n", " background: rgba(0, 0, 0, 0.1);\n", " }\n", " .numInputWrapper span:active {\n", " background: rgba(0, 0, 0, 0.2);\n", " }\n", " .numInputWrapper span:after {\n", " display: block;\n", " content: \"\";\n", " position: absolute;\n", " }\n", " .numInputWrapper span.arrowUp {\n", " top: 0;\n", " border-bottom: 0;\n", " }\n", " .numInputWrapper span.arrowUp:after {\n", " border-left: 4px solid transparent;\n", " border-right: 4px solid transparent;\n", " border-bottom: 4px solid rgba(72, 72, 72, 0.6);\n", " top: 26%;\n", " }\n", " .numInputWrapper span.arrowDown {\n", " top: 50%;\n", " }\n", " .numInputWrapper span.arrowDown:after {\n", " border-left: 4px solid transparent;\n", " border-right: 4px solid transparent;\n", " border-top: 4px solid rgba(72, 72, 72, 0.6);\n", " top: 40%;\n", " }\n", " .numInputWrapper span svg {\n", " width: inherit;\n", " height: auto;\n", " }\n", " .numInputWrapper span svg path {\n", " fill: rgba(90, 97, 113, 0.5);\n", " }\n", " .numInputWrapper:hover {\n", " background: rgba(0, 0, 0, 0.05);\n", " }\n", " .numInputWrapper:hover span {\n", " opacity: 1;\n", " }\n", " .flatpickr-current-month {\n", " font-size: 135%;\n", " line-height: inherit;\n", " font-weight: 300;\n", " color: inherit;\n", " position: absolute;\n", " width: 75%;\n", " left: 12.5%;\n", " padding: 7.48px 0 0 0;\n", " line-height: 1;\n", " height: 34px;\n", " display: inline-block;\n", " text-align: center;\n", " -webkit-transform: translate3d(0px, 0px, 0px);\n", " transform: translate3d(0px, 0px, 0px);\n", " }\n", " .flatpickr-current-month span.cur-month {\n", " font-family: inherit;\n", " font-weight: 700;\n", " color: inherit;\n", " display: inline-block;\n", " margin-left: 0.5ch;\n", " padding: 0;\n", " }\n", " .flatpickr-current-month span.cur-month:hover {\n", " background: rgba(0, 0, 0, 0.05);\n", " }\n", " .flatpickr-current-month .numInputWrapper {\n", " width: 6ch;\n", " width: 7ch\\0;\n", " display: inline-block;\n", " }\n", " .flatpickr-current-month .numInputWrapper span.arrowUp:after {\n", " border-bottom-color: #5a6171;\n", " }\n", " .flatpickr-current-month .numInputWrapper span.arrowDown:after {\n", " border-top-color: #5a6171;\n", " }\n", " .flatpickr-current-month input.cur-year {\n", " background: transparent;\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " color: inherit;\n", " cursor: text;\n", " padding: 0 0 0 0.5ch;\n", " margin: 0;\n", " display: inline-block;\n", " font-size: inherit;\n", " font-family: inherit;\n", " font-weight: 300;\n", " line-height: inherit;\n", " height: auto;\n", " border: 0;\n", " border-radius: 0;\n", " vertical-align: initial;\n", " -webkit-appearance: textfield;\n", " -moz-appearance: textfield;\n", " appearance: textfield;\n", " }\n", " .flatpickr-current-month input.cur-year:focus {\n", " outline: 0;\n", " }\n", " .flatpickr-current-month input.cur-year[disabled],\n", " .flatpickr-current-month input.cur-year[disabled]:hover {\n", " font-size: 100%;\n", " color: rgba(90, 97, 113, 0.5);\n", " background: transparent;\n", " pointer-events: none;\n", " }\n", " .flatpickr-current-month .flatpickr-monthDropdown-months {\n", " appearance: menulist;\n", " background: #eceef1;\n", " border: none;\n", " border-radius: 0;\n", " box-sizing: border-box;\n", " color: inherit;\n", " cursor: pointer;\n", " font-size: inherit;\n", " font-family: inherit;\n", " font-weight: 300;\n", " height: auto;\n", " line-height: inherit;\n", " margin: -1px 0 0 0;\n", " outline: none;\n", " padding: 0 0 0 0.5ch;\n", " position: relative;\n", " vertical-align: initial;\n", " -webkit-box-sizing: border-box;\n", " -webkit-appearance: menulist;\n", " -moz-appearance: menulist;\n", " width: auto;\n", " }\n", " .flatpickr-current-month .flatpickr-monthDropdown-months:focus,\n", " .flatpickr-current-month .flatpickr-monthDropdown-months:active {\n", " outline: none;\n", " }\n", " .flatpickr-current-month .flatpickr-monthDropdown-months:hover {\n", " background: rgba(0, 0, 0, 0.05);\n", " }\n", " .flatpickr-current-month .flatpickr-monthDropdown-months .flatpickr-monthDropdown-month {\n", " background-color: #eceef1;\n", " outline: none;\n", " padding: 0;\n", " }\n", " .flatpickr-weekdays {\n", " background: #eceef1;\n", " text-align: center;\n", " overflow: hidden;\n", " width: 100%;\n", " display: -webkit-box;\n", " display: -webkit-flex;\n", " display: -ms-flexbox;\n", " display: flex;\n", " -webkit-box-align: center;\n", " -webkit-align-items: center;\n", " -ms-flex-align: center;\n", " align-items: center;\n", " height: 28px;\n", " }\n", " .flatpickr-weekdays .flatpickr-weekdaycontainer {\n", " display: -webkit-box;\n", " display: -webkit-flex;\n", " display: -ms-flexbox;\n", " display: flex;\n", " -webkit-box-flex: 1;\n", " -webkit-flex: 1;\n", " -ms-flex: 1;\n", " flex: 1;\n", " }\n", " span.flatpickr-weekday {\n", " cursor: default;\n", " font-size: 90%;\n", " background: #eceef1;\n", " color: #5a6171;\n", " line-height: 1;\n", " margin: 0;\n", " text-align: center;\n", " display: block;\n", " -webkit-box-flex: 1;\n", " -webkit-flex: 1;\n", " -ms-flex: 1;\n", " flex: 1;\n", " font-weight: bolder;\n", " }\n", " .dayContainer,\n", " .flatpickr-weeks {\n", " padding: 1px 0 0 0;\n", " }\n", " .flatpickr-days {\n", " position: relative;\n", " overflow: hidden;\n", " display: -webkit-box;\n", " display: -webkit-flex;\n", " display: -ms-flexbox;\n", " display: flex;\n", " -webkit-box-align: start;\n", " -webkit-align-items: flex-start;\n", " -ms-flex-align: start;\n", " align-items: flex-start;\n", " width: 307.875px;\n", " border-left: 1px solid #eceef1;\n", " border-right: 1px solid #eceef1;\n", " }\n", " .flatpickr-days:focus {\n", " outline: 0;\n", " }\n", " .dayContainer {\n", " padding: 0;\n", " outline: 0;\n", " text-align: left;\n", " width: 307.875px;\n", " min-width: 307.875px;\n", " max-width: 307.875px;\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " display: inline-block;\n", " display: -ms-flexbox;\n", " display: -webkit-box;\n", " display: -webkit-flex;\n", " display: flex;\n", " -webkit-flex-wrap: wrap;\n", " flex-wrap: wrap;\n", " -ms-flex-wrap: wrap;\n", " -ms-flex-pack: justify;\n", " -webkit-justify-content: space-around;\n", " justify-content: space-around;\n", " -webkit-transform: translate3d(0px, 0px, 0px);\n", " transform: translate3d(0px, 0px, 0px);\n", " opacity: 1;\n", " }\n", " .dayContainer + .dayContainer {\n", " -webkit-box-shadow: -1px 0 0 #eceef1;\n", " box-shadow: -1px 0 0 #eceef1;\n", " }\n", " .flatpickr-day {\n", " background: none;\n", " border: 1px solid transparent;\n", " border-radius: 150px;\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " color: #484848;\n", " cursor: pointer;\n", " font-weight: 400;\n", " width: 14.2857143%;\n", " -webkit-flex-basis: 14.2857143%;\n", " -ms-flex-preferred-size: 14.2857143%;\n", " flex-basis: 14.2857143%;\n", " max-width: 39px;\n", " height: 39px;\n", " line-height: 39px;\n", " margin: 0;\n", " display: inline-block;\n", " position: relative;\n", " -webkit-box-pack: center;\n", " -webkit-justify-content: center;\n", " -ms-flex-pack: center;\n", " justify-content: center;\n", " text-align: center;\n", " }\n", " .flatpickr-day.inRange,\n", " .flatpickr-day.prevMonthDay.inRange,\n", " .flatpickr-day.nextMonthDay.inRange,\n", " .flatpickr-day.today.inRange,\n", " .flatpickr-day.prevMonthDay.today.inRange,\n", " .flatpickr-day.nextMonthDay.today.inRange,\n", " .flatpickr-day:hover,\n", " .flatpickr-day.prevMonthDay:hover,\n", " .flatpickr-day.nextMonthDay:hover,\n", " .flatpickr-day:focus,\n", " .flatpickr-day.prevMonthDay:focus,\n", " .flatpickr-day.nextMonthDay:focus {\n", " cursor: pointer;\n", " outline: 0;\n", " background: #e2e2e2;\n", " border-color: #e2e2e2;\n", " }\n", " .flatpickr-day.today {\n", " border-color: #bbb;\n", " }\n", " .flatpickr-day.today:hover,\n", " .flatpickr-day.today:focus {\n", " border-color: #bbb;\n", " background: #bbb;\n", " color: #fff;\n", " }\n", " .flatpickr-day.selected,\n", " .flatpickr-day.startRange,\n", " .flatpickr-day.endRange,\n", " .flatpickr-day.selected.inRange,\n", " .flatpickr-day.startRange.inRange,\n", " .flatpickr-day.endRange.inRange,\n", " .flatpickr-day.selected:focus,\n", " .flatpickr-day.startRange:focus,\n", " .flatpickr-day.endRange:focus,\n", " .flatpickr-day.selected:hover,\n", " .flatpickr-day.startRange:hover,\n", " .flatpickr-day.endRange:hover,\n", " .flatpickr-day.selected.prevMonthDay,\n", " .flatpickr-day.startRange.prevMonthDay,\n", " .flatpickr-day.endRange.prevMonthDay,\n", " .flatpickr-day.selected.nextMonthDay,\n", " .flatpickr-day.startRange.nextMonthDay,\n", " .flatpickr-day.endRange.nextMonthDay {\n", " background: #ff5a5f;\n", " -webkit-box-shadow: none;\n", " box-shadow: none;\n", " color: #fff;\n", " border-color: #ff5a5f;\n", " }\n", " .flatpickr-day.selected.startRange,\n", " .flatpickr-day.startRange.startRange,\n", " .flatpickr-day.endRange.startRange {\n", " border-radius: 50px 0 0 50px;\n", " }\n", " .flatpickr-day.selected.endRange,\n", " .flatpickr-day.startRange.endRange,\n", " .flatpickr-day.endRange.endRange {\n", " border-radius: 0 50px 50px 0;\n", " }\n", " .flatpickr-day.selected.startRange + .endRange:not(:nth-child(7n+1)),\n", " .flatpickr-day.startRange.startRange + .endRange:not(:nth-child(7n+1)),\n", " .flatpickr-day.endRange.startRange + .endRange:not(:nth-child(7n+1)) {\n", " -webkit-box-shadow: -10px 0 0 #ff5a5f;\n", " box-shadow: -10px 0 0 #ff5a5f;\n", " }\n", " .flatpickr-day.selected.startRange.endRange,\n", " .flatpickr-day.startRange.startRange.endRange,\n", " .flatpickr-day.endRange.startRange.endRange {\n", " border-radius: 50px;\n", " }\n", " .flatpickr-day.inRange {\n", " border-radius: 0;\n", " -webkit-box-shadow: -5px 0 0 #e2e2e2, 5px 0 0 #e2e2e2;\n", " box-shadow: -5px 0 0 #e2e2e2, 5px 0 0 #e2e2e2;\n", " }\n", " .flatpickr-day.flatpickr-disabled,\n", " .flatpickr-day.flatpickr-disabled:hover,\n", " .flatpickr-day.prevMonthDay,\n", " .flatpickr-day.nextMonthDay,\n", " .flatpickr-day.notAllowed,\n", " .flatpickr-day.notAllowed.prevMonthDay,\n", " .flatpickr-day.notAllowed.nextMonthDay {\n", " color: rgba(72, 72, 72, 0.3);\n", " background: transparent;\n", " border-color: transparent;\n", " cursor: default;\n", " }\n", " .flatpickr-day.flatpickr-disabled,\n", " .flatpickr-day.flatpickr-disabled:hover {\n", " cursor: not-allowed;\n", " color: rgba(72, 72, 72, 0.1);\n", " }\n", " .flatpickr-day.week.selected {\n", " border-radius: 0;\n", " -webkit-box-shadow: -5px 0 0 #ff5a5f, 5px 0 0 #ff5a5f;\n", " box-shadow: -5px 0 0 #ff5a5f, 5px 0 0 #ff5a5f;\n", " }\n", " .flatpickr-day.hidden {\n", " visibility: hidden;\n", " }\n", " .rangeMode .flatpickr-day {\n", " margin-top: 1px;\n", " }\n", " .flatpickr-weekwrapper {\n", " float: left;\n", " }\n", " .flatpickr-weekwrapper .flatpickr-weeks {\n", " padding: 0 12px;\n", " border-left: 1px solid #eceef1;\n", " }\n", " .flatpickr-weekwrapper .flatpickr-weekday {\n", " float: none;\n", " width: 100%;\n", " line-height: 28px;\n", " }\n", " .flatpickr-weekwrapper span.flatpickr-day,\n", " .flatpickr-weekwrapper span.flatpickr-day:hover {\n", " display: block;\n", " width: 100%;\n", " max-width: none;\n", " color: rgba(72, 72, 72, 0.3);\n", " background: transparent;\n", " cursor: default;\n", " border: none;\n", " }\n", " .flatpickr-innerContainer {\n", " display: block;\n", " display: -webkit-box;\n", " display: -webkit-flex;\n", " display: -ms-flexbox;\n", " display: flex;\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " overflow: hidden;\n", " background: #fff;\n", " border-bottom: 1px solid #eceef1;\n", " }\n", " .flatpickr-rContainer {\n", " display: inline-block;\n", " padding: 0;\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " }\n", " .flatpickr-time {\n", " text-align: center;\n", " outline: 0;\n", " display: block;\n", " height: 0;\n", " line-height: 40px;\n", " max-height: 40px;\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " overflow: hidden;\n", " display: -webkit-box;\n", " display: -webkit-flex;\n", " display: -ms-flexbox;\n", " display: flex;\n", " background: #fff;\n", " border-radius: 0 0 5px 5px;\n", " }\n", " .flatpickr-time:after {\n", " content: \"\";\n", " display: table;\n", " clear: both;\n", " }\n", " .flatpickr-time .numInputWrapper {\n", " -webkit-box-flex: 1;\n", " -webkit-flex: 1;\n", " -ms-flex: 1;\n", " flex: 1;\n", " width: 40%;\n", " height: 40px;\n", " float: left;\n", " }\n", " .flatpickr-time .numInputWrapper span.arrowUp:after {\n", " border-bottom-color: #484848;\n", " }\n", " .flatpickr-time .numInputWrapper span.arrowDown:after {\n", " border-top-color: #484848;\n", " }\n", " .flatpickr-time.hasSeconds .numInputWrapper {\n", " width: 26%;\n", " }\n", " .flatpickr-time.time24hr .numInputWrapper {\n", " width: 49%;\n", " }\n", " .flatpickr-time input {\n", " background: transparent;\n", " -webkit-box-shadow: none;\n", " box-shadow: none;\n", " border: 0;\n", " border-radius: 0;\n", " text-align: center;\n", " margin: 0;\n", " padding: 0;\n", " height: inherit;\n", " line-height: inherit;\n", " color: #484848;\n", " font-size: 14px;\n", " position: relative;\n", " -webkit-box-sizing: border-box;\n", " box-sizing: border-box;\n", " -webkit-appearance: textfield;\n", " -moz-appearance: textfield;\n", " appearance: textfield;\n", " }\n", " .flatpickr-time input.flatpickr-hour {\n", " font-weight: bold;\n", " }\n", " .flatpickr-time input.flatpickr-minute,\n", " .flatpickr-time input.flatpickr-second {\n", " font-weight: 400;\n", " }\n", " .flatpickr-time input:focus {\n", " outline: 0;\n", " border: 0;\n", " }\n", " .flatpickr-time .flatpickr-time-separator,\n", " .flatpickr-time .flatpickr-am-pm {\n", " height: inherit;\n", " float: left;\n", " line-height: inherit;\n", " color: #484848;\n", " font-weight: bold;\n", " width: 2%;\n", " -webkit-user-select: none;\n", " -moz-user-select: none;\n", " -ms-user-select: none;\n", " user-select: none;\n", " -webkit-align-self: center;\n", " -ms-flex-item-align: center;\n", " align-self: center;\n", " }\n", " .flatpickr-time .flatpickr-am-pm {\n", " outline: 0;\n", " width: 18%;\n", " cursor: pointer;\n", " text-align: center;\n", " font-weight: 400;\n", " }\n", " .flatpickr-time input:hover,\n", " .flatpickr-time .flatpickr-am-pm:hover,\n", " .flatpickr-time input:focus,\n", " .flatpickr-time .flatpickr-am-pm:focus {\n", " background: #eaeaea;\n", " }\n", " .flatpickr-input[readonly] {\n", " cursor: pointer;\n", " }\n", " @-webkit-keyframes fpFadeInDown {\n", " from {\n", " opacity: 0;\n", " -webkit-transform: translate3d(0, -20px, 0);\n", " transform: translate3d(0, -20px, 0);\n", " }\n", " to {\n", " opacity: 1;\n", " -webkit-transform: translate3d(0, 0, 0);\n", " transform: translate3d(0, 0, 0);\n", " }\n", " }\n", " @keyframes fpFadeInDown {\n", " from {\n", " opacity: 0;\n", " -webkit-transform: translate3d(0, -20px, 0);\n", " transform: translate3d(0, -20px, 0);\n", " }\n", " to {\n", " opacity: 1;\n", " -webkit-transform: translate3d(0, 0, 0);\n", " transform: translate3d(0, 0, 0);\n", " }\n", " }\n", " span.flatpickr-day.selected {\n", " font-weight: bold;\n", " }\n", " `;\n", " exports.default = css;\n", " },\n", " 410: /* models/widgets/date_range_slider.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const timezone_1 = tslib_1.__importDefault(require(159) /* timezone */);\n", " const abstract_slider_1 = require(411) /* ./abstract_slider */;\n", " class DateRangeSliderView extends abstract_slider_1.AbstractRangeSliderView {\n", " }\n", " exports.DateRangeSliderView = DateRangeSliderView;\n", " DateRangeSliderView.__name__ = \"DateRangeSliderView\";\n", " class DateRangeSlider extends abstract_slider_1.AbstractSlider {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.behaviour = \"drag\";\n", " this.connected = [false, true, false];\n", " }\n", " static init_DateRangeSlider() {\n", " this.prototype.default_view = DateRangeSliderView;\n", " this.override({\n", " format: \"%d %b %Y\",\n", " });\n", " }\n", " _formatter(value, format) {\n", " return timezone_1.default(value, format);\n", " }\n", " }\n", " exports.DateRangeSlider = DateRangeSlider;\n", " DateRangeSlider.__name__ = \"DateRangeSlider\";\n", " DateRangeSlider.init_DateRangeSlider();\n", " },\n", " 411: /* models/widgets/abstract_slider.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const noUiSlider = tslib_1.__importStar(require(412) /* nouislider */);\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const array_1 = require(9) /* ../../core/util/array */;\n", " const control_1 = require(393) /* ./control */;\n", " const sliders_1 = require(413) /* ../../styles/widgets/sliders */;\n", " const inputs_1 = require(400) /* ../../styles/widgets/inputs */;\n", " const nouislider_css_1 = tslib_1.__importDefault(require(414) /* ../../styles/widgets/nouislider.css */);\n", " const sliders_css_1 = tslib_1.__importDefault(require(415) /* ../../styles/widgets/sliders.css */);\n", " class AbstractBaseSliderView extends control_1.ControlView {\n", " *controls() {\n", " yield this.slider_el;\n", " }\n", " get noUiSlider() {\n", " return this.slider_el.noUiSlider;\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " const { direction, orientation, tooltips } = this.model.properties;\n", " this.on_change([direction, orientation, tooltips], () => this.render());\n", " const { start, end, value, step, title } = this.model.properties;\n", " this.on_change([start, end, value, step], () => {\n", " const { start, end, value, step } = this._calc_to();\n", " this.noUiSlider.updateOptions({\n", " range: { min: start, max: end },\n", " start: value,\n", " step,\n", " });\n", " });\n", " const { bar_color } = this.model.properties;\n", " this.on_change(bar_color, () => {\n", " this._set_bar_color();\n", " });\n", " const { show_value } = this.model.properties;\n", " this.on_change([value, title, show_value], () => this._update_title());\n", " }\n", " styles() {\n", " return [...super.styles(), nouislider_css_1.default, sliders_css_1.default];\n", " }\n", " _update_title() {\n", " dom_1.empty(this.title_el);\n", " const hide_header = this.model.title == null || (this.model.title.length == 0 && !this.model.show_value);\n", " this.title_el.style.display = hide_header ? \"none\" : \"\";\n", " if (!hide_header) {\n", " if (this.model.title.length != 0)\n", " this.title_el.textContent = `${this.model.title}: `;\n", " if (this.model.show_value) {\n", " const { value } = this._calc_to();\n", " const pretty = value.map((v) => this.model.pretty(v)).join(\" .. \");\n", " this.title_el.appendChild(dom_1.span({ class: sliders_1.bk_slider_value }, pretty));\n", " }\n", " }\n", " }\n", " _set_bar_color() {\n", " if (!this.model.disabled) {\n", " const connect_el = this.slider_el.querySelector(\".noUi-connect\");\n", " connect_el.style.backgroundColor = this.model.bar_color;\n", " }\n", " }\n", " _keypress_handle(e, idx = 0) {\n", " const { start, value, end, step } = this._calc_to();\n", " const is_range = value.length == 2;\n", " let low = start;\n", " let high = end;\n", " if (is_range && idx == 0) {\n", " high = value[1];\n", " }\n", " else if (is_range && idx == 1) {\n", " low = value[0];\n", " }\n", " switch (e.which) {\n", " case 37: {\n", " value[idx] = Math.max(value[idx] - step, low);\n", " break;\n", " }\n", " case 39: {\n", " value[idx] = Math.min(value[idx] + step, high);\n", " break;\n", " }\n", " default:\n", " return;\n", " }\n", " if (is_range) {\n", " this.model.value = value;\n", " }\n", " else {\n", " this.model.value = value[0];\n", " }\n", " this.model.properties.value.change.emit();\n", " this.model.value_throttled = this.model.value;\n", " this.noUiSlider.set(value);\n", " }\n", " render() {\n", " super.render();\n", " const { start, end, value, step } = this._calc_to();\n", " let tooltips; // XXX\n", " if (this.model.tooltips) {\n", " const formatter = {\n", " to: (value) => this.model.pretty(value),\n", " };\n", " tooltips = array_1.repeat(formatter, value.length);\n", " }\n", " else\n", " tooltips = false;\n", " if (this.slider_el == null) {\n", " this.slider_el = dom_1.div();\n", " noUiSlider.create(this.slider_el, {\n", " range: { min: start, max: end },\n", " start: value,\n", " step,\n", " behaviour: this.model.behaviour,\n", " connect: this.model.connected,\n", " tooltips,\n", " orientation: this.model.orientation,\n", " direction: this.model.direction,\n", " });\n", " this.noUiSlider.on('slide', (_, __, values) => this._slide(values));\n", " this.noUiSlider.on('change', (_, __, values) => this._change(values));\n", " this._set_keypress_handles();\n", " const toggleTooltip = (i, show) => {\n", " if (!tooltips)\n", " return;\n", " const handle = this.slider_el.querySelectorAll(\".noUi-handle\")[i];\n", " const tooltip = handle.querySelector(\".noUi-tooltip\");\n", " tooltip.style.display = show ? 'block' : '';\n", " };\n", " this.noUiSlider.on('start', (_, i) => toggleTooltip(i, true));\n", " this.noUiSlider.on('end', (_, i) => toggleTooltip(i, false));\n", " }\n", " else {\n", " this.noUiSlider.updateOptions({\n", " range: { min: start, max: end },\n", " start: value,\n", " step,\n", " });\n", " }\n", " this._set_bar_color();\n", " if (this.model.disabled)\n", " this.slider_el.setAttribute('disabled', 'true');\n", " else\n", " this.slider_el.removeAttribute('disabled');\n", " this.title_el = dom_1.div({ class: sliders_1.bk_slider_title });\n", " this._update_title();\n", " this.group_el = dom_1.div({ class: inputs_1.bk_input_group }, this.title_el, this.slider_el);\n", " this.el.appendChild(this.group_el);\n", " }\n", " _slide(values) {\n", " this.model.value = this._calc_from(values);\n", " }\n", " _change(values) {\n", " this.model.value = this._calc_from(values);\n", " this.model.value_throttled = this.model.value;\n", " }\n", " }\n", " AbstractBaseSliderView.__name__ = \"AbstractBaseSliderView\";\n", " class AbstractSliderView extends AbstractBaseSliderView {\n", " _calc_to() {\n", " return {\n", " start: this.model.start,\n", " end: this.model.end,\n", " value: [this.model.value],\n", " step: this.model.step,\n", " };\n", " }\n", " _calc_from([value]) {\n", " if (Number.isInteger(this.model.start) && Number.isInteger(this.model.end) && Number.isInteger(this.model.step))\n", " return Math.round(value);\n", " else\n", " return value;\n", " }\n", " _set_keypress_handles() {\n", " // Add single cursor event\n", " const handle = this.slider_el.querySelector(\".noUi-handle\");\n", " handle.setAttribute('tabindex', '0');\n", " handle.addEventListener('keydown', (e) => this._keypress_handle(e));\n", " }\n", " }\n", " exports.AbstractSliderView = AbstractSliderView;\n", " AbstractSliderView.__name__ = \"AbstractSliderView\";\n", " class AbstractRangeSliderView extends AbstractBaseSliderView {\n", " _calc_to() {\n", " return {\n", " start: this.model.start,\n", " end: this.model.end,\n", " value: this.model.value,\n", " step: this.model.step,\n", " };\n", " }\n", " _calc_from(values) {\n", " return values;\n", " }\n", " _set_keypress_handles() {\n", " const handle_lower = this.slider_el.querySelector(\".noUi-handle-lower\");\n", " const handle_upper = this.slider_el.querySelector(\".noUi-handle-upper\");\n", " handle_lower.setAttribute('tabindex', '0');\n", " handle_lower.addEventListener('keydown', (e) => this._keypress_handle(e, 0));\n", " handle_upper.setAttribute('tabindex', '1');\n", " handle_upper.addEventListener('keydown', (e) => this._keypress_handle(e, 1));\n", " }\n", " }\n", " exports.AbstractRangeSliderView = AbstractRangeSliderView;\n", " AbstractRangeSliderView.__name__ = \"AbstractRangeSliderView\";\n", " class AbstractSlider extends control_1.Control {\n", " // TODO: __view_type__: AbstractSliderView\n", " constructor(attrs) {\n", " super(attrs);\n", " this.connected = false;\n", " }\n", " static init_AbstractSlider() {\n", " this.define({\n", " title: [p.String, \"\"],\n", " show_value: [p.Boolean, true],\n", " start: [p.Any],\n", " end: [p.Any],\n", " value: [p.Any],\n", " value_throttled: [p.Any],\n", " step: [p.Number, 1],\n", " format: [p.Any],\n", " direction: [p.Any, \"ltr\"],\n", " tooltips: [p.Boolean, true],\n", " bar_color: [p.Color, \"#e6e6e6\"],\n", " });\n", " }\n", " _formatter(value, _format) {\n", " return `${value}`;\n", " }\n", " pretty(value) {\n", " return this._formatter(value, this.format);\n", " }\n", " }\n", " exports.AbstractSlider = AbstractSlider;\n", " AbstractSlider.__name__ = \"AbstractSlider\";\n", " AbstractSlider.init_AbstractSlider();\n", " },\n", " 412: /* nouislider/distribute/nouislider.js */ function _(require, module, exports) {\n", " /*! nouislider - 14.5.0 - 5/11/2020 */\n", " (function (factory) {\n", " if (typeof define === \"function\" && define.amd) {\n", " // AMD. Register as an anonymous module.\n", " define([], factory);\n", " }\n", " else if (typeof exports === \"object\") {\n", " // Node/CommonJS\n", " module.exports = factory();\n", " }\n", " else {\n", " // Browser globals\n", " window.noUiSlider = factory();\n", " }\n", " })(function () {\n", " \"use strict\";\n", " var VERSION = \"14.5.0\";\n", " //region Helper Methods\n", " function isValidFormatter(entry) {\n", " return typeof entry === \"object\" && typeof entry.to === \"function\" && typeof entry.from === \"function\";\n", " }\n", " function removeElement(el) {\n", " el.parentElement.removeChild(el);\n", " }\n", " function isSet(value) {\n", " return value !== null && value !== undefined;\n", " }\n", " // Bindable version\n", " function preventDefault(e) {\n", " e.preventDefault();\n", " }\n", " // Removes duplicates from an array.\n", " function unique(array) {\n", " return array.filter(function (a) {\n", " return !this[a] ? (this[a] = true) : false;\n", " }, {});\n", " }\n", " // Round a value to the closest 'to'.\n", " function closest(value, to) {\n", " return Math.round(value / to) * to;\n", " }\n", " // Current position of an element relative to the document.\n", " function offset(elem, orientation) {\n", " var rect = elem.getBoundingClientRect();\n", " var doc = elem.ownerDocument;\n", " var docElem = doc.documentElement;\n", " var pageOffset = getPageOffset(doc);\n", " // getBoundingClientRect contains left scroll in Chrome on Android.\n", " // I haven't found a feature detection that proves this. Worst case\n", " // scenario on mis-match: the 'tap' feature on horizontal sliders breaks.\n", " if (/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)) {\n", " pageOffset.x = 0;\n", " }\n", " return orientation\n", " ? rect.top + pageOffset.y - docElem.clientTop\n", " : rect.left + pageOffset.x - docElem.clientLeft;\n", " }\n", " // Checks whether a value is numerical.\n", " function isNumeric(a) {\n", " return typeof a === \"number\" && !isNaN(a) && isFinite(a);\n", " }\n", " // Sets a class and removes it after [duration] ms.\n", " function addClassFor(element, className, duration) {\n", " if (duration > 0) {\n", " addClass(element, className);\n", " setTimeout(function () {\n", " removeClass(element, className);\n", " }, duration);\n", " }\n", " }\n", " // Limits a value to 0 - 100\n", " function limit(a) {\n", " return Math.max(Math.min(a, 100), 0);\n", " }\n", " // Wraps a variable as an array, if it isn't one yet.\n", " // Note that an input array is returned by reference!\n", " function asArray(a) {\n", " return Array.isArray(a) ? a : [a];\n", " }\n", " // Counts decimals\n", " function countDecimals(numStr) {\n", " numStr = String(numStr);\n", " var pieces = numStr.split(\".\");\n", " return pieces.length > 1 ? pieces[1].length : 0;\n", " }\n", " // http://youmightnotneedjquery.com/#add_class\n", " function addClass(el, className) {\n", " if (el.classList && !/\\s/.test(className)) {\n", " el.classList.add(className);\n", " }\n", " else {\n", " el.className += \" \" + className;\n", " }\n", " }\n", " // http://youmightnotneedjquery.com/#remove_class\n", " function removeClass(el, className) {\n", " if (el.classList && !/\\s/.test(className)) {\n", " el.classList.remove(className);\n", " }\n", " else {\n", " el.className = el.className.replace(new RegExp(\"(^|\\\\b)\" + className.split(\" \").join(\"|\") + \"(\\\\b|$)\", \"gi\"), \" \");\n", " }\n", " }\n", " // https://plainjs.com/javascript/attributes/adding-removing-and-testing-for-classes-9/\n", " function hasClass(el, className) {\n", " return el.classList\n", " ? el.classList.contains(className)\n", " : new RegExp(\"\\\\b\" + className + \"\\\\b\").test(el.className);\n", " }\n", " // https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollY#Notes\n", " function getPageOffset(doc) {\n", " var supportPageOffset = window.pageXOffset !== undefined;\n", " var isCSS1Compat = (doc.compatMode || \"\") === \"CSS1Compat\";\n", " var x = supportPageOffset\n", " ? window.pageXOffset\n", " : isCSS1Compat\n", " ? doc.documentElement.scrollLeft\n", " : doc.body.scrollLeft;\n", " var y = supportPageOffset\n", " ? window.pageYOffset\n", " : isCSS1Compat\n", " ? doc.documentElement.scrollTop\n", " : doc.body.scrollTop;\n", " return {\n", " x: x,\n", " y: y\n", " };\n", " }\n", " // we provide a function to compute constants instead\n", " // of accessing window.* as soon as the module needs it\n", " // so that we do not compute anything if not needed\n", " function getActions() {\n", " // Determine the events to bind. IE11 implements pointerEvents without\n", " // a prefix, which breaks compatibility with the IE10 implementation.\n", " return window.navigator.pointerEnabled\n", " ? {\n", " start: \"pointerdown\",\n", " move: \"pointermove\",\n", " end: \"pointerup\"\n", " }\n", " : window.navigator.msPointerEnabled\n", " ? {\n", " start: \"MSPointerDown\",\n", " move: \"MSPointerMove\",\n", " end: \"MSPointerUp\"\n", " }\n", " : {\n", " start: \"mousedown touchstart\",\n", " move: \"mousemove touchmove\",\n", " end: \"mouseup touchend\"\n", " };\n", " }\n", " // https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md\n", " // Issue #785\n", " function getSupportsPassive() {\n", " var supportsPassive = false;\n", " /* eslint-disable */\n", " try {\n", " var opts = Object.defineProperty({}, \"passive\", {\n", " get: function () {\n", " supportsPassive = true;\n", " }\n", " });\n", " window.addEventListener(\"test\", null, opts);\n", " }\n", " catch (e) { }\n", " /* eslint-enable */\n", " return supportsPassive;\n", " }\n", " function getSupportsTouchActionNone() {\n", " return window.CSS && CSS.supports && CSS.supports(\"touch-action\", \"none\");\n", " }\n", " //endregion\n", " //region Range Calculation\n", " // Determine the size of a sub-range in relation to a full range.\n", " function subRangeRatio(pa, pb) {\n", " return 100 / (pb - pa);\n", " }\n", " // (percentage) How many percent is this value of this range?\n", " function fromPercentage(range, value, startRange) {\n", " return (value * 100) / (range[startRange + 1] - range[startRange]);\n", " }\n", " // (percentage) Where is this value on this range?\n", " function toPercentage(range, value) {\n", " return fromPercentage(range, range[0] < 0 ? value + Math.abs(range[0]) : value - range[0], 0);\n", " }\n", " // (value) How much is this percentage on this range?\n", " function isPercentage(range, value) {\n", " return (value * (range[1] - range[0])) / 100 + range[0];\n", " }\n", " function getJ(value, arr) {\n", " var j = 1;\n", " while (value >= arr[j]) {\n", " j += 1;\n", " }\n", " return j;\n", " }\n", " // (percentage) Input a value, find where, on a scale of 0-100, it applies.\n", " function toStepping(xVal, xPct, value) {\n", " if (value >= xVal.slice(-1)[0]) {\n", " return 100;\n", " }\n", " var j = getJ(value, xVal);\n", " var va = xVal[j - 1];\n", " var vb = xVal[j];\n", " var pa = xPct[j - 1];\n", " var pb = xPct[j];\n", " return pa + toPercentage([va, vb], value) / subRangeRatio(pa, pb);\n", " }\n", " // (value) Input a percentage, find where it is on the specified range.\n", " function fromStepping(xVal, xPct, value) {\n", " // There is no range group that fits 100\n", " if (value >= 100) {\n", " return xVal.slice(-1)[0];\n", " }\n", " var j = getJ(value, xPct);\n", " var va = xVal[j - 1];\n", " var vb = xVal[j];\n", " var pa = xPct[j - 1];\n", " var pb = xPct[j];\n", " return isPercentage([va, vb], (value - pa) * subRangeRatio(pa, pb));\n", " }\n", " // (percentage) Get the step that applies at a certain value.\n", " function getStep(xPct, xSteps, snap, value) {\n", " if (value === 100) {\n", " return value;\n", " }\n", " var j = getJ(value, xPct);\n", " var a = xPct[j - 1];\n", " var b = xPct[j];\n", " // If 'snap' is set, steps are used as fixed points on the slider.\n", " if (snap) {\n", " // Find the closest position, a or b.\n", " if (value - a > (b - a) / 2) {\n", " return b;\n", " }\n", " return a;\n", " }\n", " if (!xSteps[j - 1]) {\n", " return value;\n", " }\n", " return xPct[j - 1] + closest(value - xPct[j - 1], xSteps[j - 1]);\n", " }\n", " function handleEntryPoint(index, value, that) {\n", " var percentage;\n", " // Wrap numerical input in an array.\n", " if (typeof value === \"number\") {\n", " value = [value];\n", " }\n", " // Reject any invalid input, by testing whether value is an array.\n", " if (!Array.isArray(value)) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'range' contains invalid value.\");\n", " }\n", " // Covert min/max syntax to 0 and 100.\n", " if (index === \"min\") {\n", " percentage = 0;\n", " }\n", " else if (index === \"max\") {\n", " percentage = 100;\n", " }\n", " else {\n", " percentage = parseFloat(index);\n", " }\n", " // Check for correct input.\n", " if (!isNumeric(percentage) || !isNumeric(value[0])) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'range' value isn't numeric.\");\n", " }\n", " // Store values.\n", " that.xPct.push(percentage);\n", " that.xVal.push(value[0]);\n", " // NaN will evaluate to false too, but to keep\n", " // logging clear, set step explicitly. Make sure\n", " // not to override the 'step' setting with false.\n", " if (!percentage) {\n", " if (!isNaN(value[1])) {\n", " that.xSteps[0] = value[1];\n", " }\n", " }\n", " else {\n", " that.xSteps.push(isNaN(value[1]) ? false : value[1]);\n", " }\n", " that.xHighestCompleteStep.push(0);\n", " }\n", " function handleStepPoint(i, n, that) {\n", " // Ignore 'false' stepping.\n", " if (!n) {\n", " return;\n", " }\n", " // Step over zero-length ranges (#948);\n", " if (that.xVal[i] === that.xVal[i + 1]) {\n", " that.xSteps[i] = that.xHighestCompleteStep[i] = that.xVal[i];\n", " return;\n", " }\n", " // Factor to range ratio\n", " that.xSteps[i] =\n", " fromPercentage([that.xVal[i], that.xVal[i + 1]], n, 0) / subRangeRatio(that.xPct[i], that.xPct[i + 1]);\n", " var totalSteps = (that.xVal[i + 1] - that.xVal[i]) / that.xNumSteps[i];\n", " var highestStep = Math.ceil(Number(totalSteps.toFixed(3)) - 1);\n", " var step = that.xVal[i] + that.xNumSteps[i] * highestStep;\n", " that.xHighestCompleteStep[i] = step;\n", " }\n", " //endregion\n", " //region Spectrum\n", " function Spectrum(entry, snap, singleStep) {\n", " this.xPct = [];\n", " this.xVal = [];\n", " this.xSteps = [singleStep || false];\n", " this.xNumSteps = [false];\n", " this.xHighestCompleteStep = [];\n", " this.snap = snap;\n", " var index;\n", " var ordered = []; // [0, 'min'], [1, '50%'], [2, 'max']\n", " // Map the object keys to an array.\n", " for (index in entry) {\n", " if (entry.hasOwnProperty(index)) {\n", " ordered.push([entry[index], index]);\n", " }\n", " }\n", " // Sort all entries by value (numeric sort).\n", " if (ordered.length && typeof ordered[0][0] === \"object\") {\n", " ordered.sort(function (a, b) {\n", " return a[0][0] - b[0][0];\n", " });\n", " }\n", " else {\n", " ordered.sort(function (a, b) {\n", " return a[0] - b[0];\n", " });\n", " }\n", " // Convert all entries to subranges.\n", " for (index = 0; index < ordered.length; index++) {\n", " handleEntryPoint(ordered[index][1], ordered[index][0], this);\n", " }\n", " // Store the actual step values.\n", " // xSteps is sorted in the same order as xPct and xVal.\n", " this.xNumSteps = this.xSteps.slice(0);\n", " // Convert all numeric steps to the percentage of the subrange they represent.\n", " for (index = 0; index < this.xNumSteps.length; index++) {\n", " handleStepPoint(index, this.xNumSteps[index], this);\n", " }\n", " }\n", " Spectrum.prototype.getDistance = function (value) {\n", " var index;\n", " var distances = [];\n", " for (index = 0; index < this.xNumSteps.length - 1; index++) {\n", " // last \"range\" can't contain step size as it is purely an endpoint.\n", " var step = this.xNumSteps[index];\n", " if (step && (value / step) % 1 !== 0) {\n", " throw new Error(\"noUiSlider (\" +\n", " VERSION +\n", " \"): 'limit', 'margin' and 'padding' of \" +\n", " this.xPct[index] +\n", " \"% range must be divisible by step.\");\n", " }\n", " // Calculate percentual distance in current range of limit, margin or padding\n", " distances[index] = fromPercentage(this.xVal, value, index);\n", " }\n", " return distances;\n", " };\n", " // Calculate the percentual distance over the whole scale of ranges.\n", " // direction: 0 = backwards / 1 = forwards\n", " Spectrum.prototype.getAbsoluteDistance = function (value, distances, direction) {\n", " var xPct_index = 0;\n", " // Calculate range where to start calculation\n", " if (value < this.xPct[this.xPct.length - 1]) {\n", " while (value > this.xPct[xPct_index + 1]) {\n", " xPct_index++;\n", " }\n", " }\n", " else if (value === this.xPct[this.xPct.length - 1]) {\n", " xPct_index = this.xPct.length - 2;\n", " }\n", " // If looking backwards and the value is exactly at a range separator then look one range further\n", " if (!direction && value === this.xPct[xPct_index + 1]) {\n", " xPct_index++;\n", " }\n", " var start_factor;\n", " var rest_factor = 1;\n", " var rest_rel_distance = distances[xPct_index];\n", " var range_pct = 0;\n", " var rel_range_distance = 0;\n", " var abs_distance_counter = 0;\n", " var range_counter = 0;\n", " // Calculate what part of the start range the value is\n", " if (direction) {\n", " start_factor = (value - this.xPct[xPct_index]) / (this.xPct[xPct_index + 1] - this.xPct[xPct_index]);\n", " }\n", " else {\n", " start_factor = (this.xPct[xPct_index + 1] - value) / (this.xPct[xPct_index + 1] - this.xPct[xPct_index]);\n", " }\n", " // Do until the complete distance across ranges is calculated\n", " while (rest_rel_distance > 0) {\n", " // Calculate the percentage of total range\n", " range_pct = this.xPct[xPct_index + 1 + range_counter] - this.xPct[xPct_index + range_counter];\n", " // Detect if the margin, padding or limit is larger then the current range and calculate\n", " if (distances[xPct_index + range_counter] * rest_factor + 100 - start_factor * 100 > 100) {\n", " // If larger then take the percentual distance of the whole range\n", " rel_range_distance = range_pct * start_factor;\n", " // Rest factor of relative percentual distance still to be calculated\n", " rest_factor = (rest_rel_distance - 100 * start_factor) / distances[xPct_index + range_counter];\n", " // Set start factor to 1 as for next range it does not apply.\n", " start_factor = 1;\n", " }\n", " else {\n", " // If smaller or equal then take the percentual distance of the calculate percentual part of that range\n", " rel_range_distance = ((distances[xPct_index + range_counter] * range_pct) / 100) * rest_factor;\n", " // No rest left as the rest fits in current range\n", " rest_factor = 0;\n", " }\n", " if (direction) {\n", " abs_distance_counter = abs_distance_counter - rel_range_distance;\n", " // Limit range to first range when distance becomes outside of minimum range\n", " if (this.xPct.length + range_counter >= 1) {\n", " range_counter--;\n", " }\n", " }\n", " else {\n", " abs_distance_counter = abs_distance_counter + rel_range_distance;\n", " // Limit range to last range when distance becomes outside of maximum range\n", " if (this.xPct.length - range_counter >= 1) {\n", " range_counter++;\n", " }\n", " }\n", " // Rest of relative percentual distance still to be calculated\n", " rest_rel_distance = distances[xPct_index + range_counter] * rest_factor;\n", " }\n", " return value + abs_distance_counter;\n", " };\n", " Spectrum.prototype.toStepping = function (value) {\n", " value = toStepping(this.xVal, this.xPct, value);\n", " return value;\n", " };\n", " Spectrum.prototype.fromStepping = function (value) {\n", " return fromStepping(this.xVal, this.xPct, value);\n", " };\n", " Spectrum.prototype.getStep = function (value) {\n", " value = getStep(this.xPct, this.xSteps, this.snap, value);\n", " return value;\n", " };\n", " Spectrum.prototype.getDefaultStep = function (value, isDown, size) {\n", " var j = getJ(value, this.xPct);\n", " // When at the top or stepping down, look at the previous sub-range\n", " if (value === 100 || (isDown && value === this.xPct[j - 1])) {\n", " j = Math.max(j - 1, 1);\n", " }\n", " return (this.xVal[j] - this.xVal[j - 1]) / size;\n", " };\n", " Spectrum.prototype.getNearbySteps = function (value) {\n", " var j = getJ(value, this.xPct);\n", " return {\n", " stepBefore: {\n", " startValue: this.xVal[j - 2],\n", " step: this.xNumSteps[j - 2],\n", " highestStep: this.xHighestCompleteStep[j - 2]\n", " },\n", " thisStep: {\n", " startValue: this.xVal[j - 1],\n", " step: this.xNumSteps[j - 1],\n", " highestStep: this.xHighestCompleteStep[j - 1]\n", " },\n", " stepAfter: {\n", " startValue: this.xVal[j],\n", " step: this.xNumSteps[j],\n", " highestStep: this.xHighestCompleteStep[j]\n", " }\n", " };\n", " };\n", " Spectrum.prototype.countStepDecimals = function () {\n", " var stepDecimals = this.xNumSteps.map(countDecimals);\n", " return Math.max.apply(null, stepDecimals);\n", " };\n", " // Outside testing\n", " Spectrum.prototype.convert = function (value) {\n", " return this.getStep(this.toStepping(value));\n", " };\n", " //endregion\n", " //region Options\n", " /*\tEvery input option is tested and parsed. This'll prevent\n", " endless validation in internal methods. These tests are\n", " structured with an item for every option available. An\n", " option can be marked as required by setting the 'r' flag.\n", " The testing function is provided with three arguments:\n", " - The provided value for the option;\n", " - A reference to the options object;\n", " - The name for the option;\n", " \n", " The testing function returns false when an error is detected,\n", " or true when everything is OK. It can also modify the option\n", " object, to make sure all values can be correctly looped elsewhere. */\n", " //region Defaults\n", " var defaultFormatter = {\n", " to: function (value) {\n", " return value !== undefined && value.toFixed(2);\n", " },\n", " from: Number\n", " };\n", " var cssClasses = {\n", " target: \"target\",\n", " base: \"base\",\n", " origin: \"origin\",\n", " handle: \"handle\",\n", " handleLower: \"handle-lower\",\n", " handleUpper: \"handle-upper\",\n", " touchArea: \"touch-area\",\n", " horizontal: \"horizontal\",\n", " vertical: \"vertical\",\n", " background: \"background\",\n", " connect: \"connect\",\n", " connects: \"connects\",\n", " ltr: \"ltr\",\n", " rtl: \"rtl\",\n", " textDirectionLtr: \"txt-dir-ltr\",\n", " textDirectionRtl: \"txt-dir-rtl\",\n", " draggable: \"draggable\",\n", " drag: \"state-drag\",\n", " tap: \"state-tap\",\n", " active: \"active\",\n", " tooltip: \"tooltip\",\n", " pips: \"pips\",\n", " pipsHorizontal: \"pips-horizontal\",\n", " pipsVertical: \"pips-vertical\",\n", " marker: \"marker\",\n", " markerHorizontal: \"marker-horizontal\",\n", " markerVertical: \"marker-vertical\",\n", " markerNormal: \"marker-normal\",\n", " markerLarge: \"marker-large\",\n", " markerSub: \"marker-sub\",\n", " value: \"value\",\n", " valueHorizontal: \"value-horizontal\",\n", " valueVertical: \"value-vertical\",\n", " valueNormal: \"value-normal\",\n", " valueLarge: \"value-large\",\n", " valueSub: \"value-sub\"\n", " };\n", " //endregion\n", " function validateFormat(entry) {\n", " // Any object with a to and from method is supported.\n", " if (isValidFormatter(entry)) {\n", " return true;\n", " }\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'format' requires 'to' and 'from' methods.\");\n", " }\n", " function testStep(parsed, entry) {\n", " if (!isNumeric(entry)) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'step' is not numeric.\");\n", " }\n", " // The step option can still be used to set stepping\n", " // for linear sliders. Overwritten if set in 'range'.\n", " parsed.singleStep = entry;\n", " }\n", " function testRange(parsed, entry) {\n", " // Filter incorrect input.\n", " if (typeof entry !== \"object\" || Array.isArray(entry)) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'range' is not an object.\");\n", " }\n", " // Catch missing start or end.\n", " if (entry.min === undefined || entry.max === undefined) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): Missing 'min' or 'max' in 'range'.\");\n", " }\n", " // Catch equal start or end.\n", " if (entry.min === entry.max) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'range' 'min' and 'max' cannot be equal.\");\n", " }\n", " parsed.spectrum = new Spectrum(entry, parsed.snap, parsed.singleStep);\n", " }\n", " function testStart(parsed, entry) {\n", " entry = asArray(entry);\n", " // Validate input. Values aren't tested, as the public .val method\n", " // will always provide a valid location.\n", " if (!Array.isArray(entry) || !entry.length) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'start' option is incorrect.\");\n", " }\n", " // Store the number of handles.\n", " parsed.handles = entry.length;\n", " // When the slider is initialized, the .val method will\n", " // be called with the start options.\n", " parsed.start = entry;\n", " }\n", " function testSnap(parsed, entry) {\n", " // Enforce 100% stepping within subranges.\n", " parsed.snap = entry;\n", " if (typeof entry !== \"boolean\") {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'snap' option must be a boolean.\");\n", " }\n", " }\n", " function testAnimate(parsed, entry) {\n", " // Enforce 100% stepping within subranges.\n", " parsed.animate = entry;\n", " if (typeof entry !== \"boolean\") {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'animate' option must be a boolean.\");\n", " }\n", " }\n", " function testAnimationDuration(parsed, entry) {\n", " parsed.animationDuration = entry;\n", " if (typeof entry !== \"number\") {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'animationDuration' option must be a number.\");\n", " }\n", " }\n", " function testConnect(parsed, entry) {\n", " var connect = [false];\n", " var i;\n", " // Map legacy options\n", " if (entry === \"lower\") {\n", " entry = [true, false];\n", " }\n", " else if (entry === \"upper\") {\n", " entry = [false, true];\n", " }\n", " // Handle boolean options\n", " if (entry === true || entry === false) {\n", " for (i = 1; i < parsed.handles; i++) {\n", " connect.push(entry);\n", " }\n", " connect.push(false);\n", " }\n", " // Reject invalid input\n", " else if (!Array.isArray(entry) || !entry.length || entry.length !== parsed.handles + 1) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'connect' option doesn't match handle count.\");\n", " }\n", " else {\n", " connect = entry;\n", " }\n", " parsed.connect = connect;\n", " }\n", " function testOrientation(parsed, entry) {\n", " // Set orientation to an a numerical value for easy\n", " // array selection.\n", " switch (entry) {\n", " case \"horizontal\":\n", " parsed.ort = 0;\n", " break;\n", " case \"vertical\":\n", " parsed.ort = 1;\n", " break;\n", " default:\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'orientation' option is invalid.\");\n", " }\n", " }\n", " function testMargin(parsed, entry) {\n", " if (!isNumeric(entry)) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'margin' option must be numeric.\");\n", " }\n", " // Issue #582\n", " if (entry === 0) {\n", " return;\n", " }\n", " parsed.margin = parsed.spectrum.getDistance(entry);\n", " }\n", " function testLimit(parsed, entry) {\n", " if (!isNumeric(entry)) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'limit' option must be numeric.\");\n", " }\n", " parsed.limit = parsed.spectrum.getDistance(entry);\n", " if (!parsed.limit || parsed.handles < 2) {\n", " throw new Error(\"noUiSlider (\" +\n", " VERSION +\n", " \"): 'limit' option is only supported on linear sliders with 2 or more handles.\");\n", " }\n", " }\n", " function testPadding(parsed, entry) {\n", " var index;\n", " if (!isNumeric(entry) && !Array.isArray(entry)) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'padding' option must be numeric or array of exactly 2 numbers.\");\n", " }\n", " if (Array.isArray(entry) && !(entry.length === 2 || isNumeric(entry[0]) || isNumeric(entry[1]))) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'padding' option must be numeric or array of exactly 2 numbers.\");\n", " }\n", " if (entry === 0) {\n", " return;\n", " }\n", " if (!Array.isArray(entry)) {\n", " entry = [entry, entry];\n", " }\n", " // 'getDistance' returns false for invalid values.\n", " parsed.padding = [parsed.spectrum.getDistance(entry[0]), parsed.spectrum.getDistance(entry[1])];\n", " for (index = 0; index < parsed.spectrum.xNumSteps.length - 1; index++) {\n", " // last \"range\" can't contain step size as it is purely an endpoint.\n", " if (parsed.padding[0][index] < 0 || parsed.padding[1][index] < 0) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'padding' option must be a positive number(s).\");\n", " }\n", " }\n", " var totalPadding = entry[0] + entry[1];\n", " var firstValue = parsed.spectrum.xVal[0];\n", " var lastValue = parsed.spectrum.xVal[parsed.spectrum.xVal.length - 1];\n", " if (totalPadding / (lastValue - firstValue) > 1) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'padding' option must not exceed 100% of the range.\");\n", " }\n", " }\n", " function testDirection(parsed, entry) {\n", " // Set direction as a numerical value for easy parsing.\n", " // Invert connection for RTL sliders, so that the proper\n", " // handles get the connect/background classes.\n", " switch (entry) {\n", " case \"ltr\":\n", " parsed.dir = 0;\n", " break;\n", " case \"rtl\":\n", " parsed.dir = 1;\n", " break;\n", " default:\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'direction' option was not recognized.\");\n", " }\n", " }\n", " function testBehaviour(parsed, entry) {\n", " // Make sure the input is a string.\n", " if (typeof entry !== \"string\") {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'behaviour' must be a string containing options.\");\n", " }\n", " // Check if the string contains any keywords.\n", " // None are required.\n", " var tap = entry.indexOf(\"tap\") >= 0;\n", " var drag = entry.indexOf(\"drag\") >= 0;\n", " var fixed = entry.indexOf(\"fixed\") >= 0;\n", " var snap = entry.indexOf(\"snap\") >= 0;\n", " var hover = entry.indexOf(\"hover\") >= 0;\n", " var unconstrained = entry.indexOf(\"unconstrained\") >= 0;\n", " if (fixed) {\n", " if (parsed.handles !== 2) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'fixed' behaviour must be used with 2 handles\");\n", " }\n", " // Use margin to enforce fixed state\n", " testMargin(parsed, parsed.start[1] - parsed.start[0]);\n", " }\n", " if (unconstrained && (parsed.margin || parsed.limit)) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'unconstrained' behaviour cannot be used with margin or limit\");\n", " }\n", " parsed.events = {\n", " tap: tap || snap,\n", " drag: drag,\n", " fixed: fixed,\n", " snap: snap,\n", " hover: hover,\n", " unconstrained: unconstrained\n", " };\n", " }\n", " function testTooltips(parsed, entry) {\n", " if (entry === false) {\n", " return;\n", " }\n", " if (entry === true) {\n", " parsed.tooltips = [];\n", " for (var i = 0; i < parsed.handles; i++) {\n", " parsed.tooltips.push(true);\n", " }\n", " }\n", " else {\n", " parsed.tooltips = asArray(entry);\n", " if (parsed.tooltips.length !== parsed.handles) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): must pass a formatter for all handles.\");\n", " }\n", " parsed.tooltips.forEach(function (formatter) {\n", " if (typeof formatter !== \"boolean\" &&\n", " (typeof formatter !== \"object\" || typeof formatter.to !== \"function\")) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'tooltips' must be passed a formatter or 'false'.\");\n", " }\n", " });\n", " }\n", " }\n", " function testAriaFormat(parsed, entry) {\n", " parsed.ariaFormat = entry;\n", " validateFormat(entry);\n", " }\n", " function testFormat(parsed, entry) {\n", " parsed.format = entry;\n", " validateFormat(entry);\n", " }\n", " function testKeyboardSupport(parsed, entry) {\n", " parsed.keyboardSupport = entry;\n", " if (typeof entry !== \"boolean\") {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'keyboardSupport' option must be a boolean.\");\n", " }\n", " }\n", " function testDocumentElement(parsed, entry) {\n", " // This is an advanced option. Passed values are used without validation.\n", " parsed.documentElement = entry;\n", " }\n", " function testCssPrefix(parsed, entry) {\n", " if (typeof entry !== \"string\" && entry !== false) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'cssPrefix' must be a string or `false`.\");\n", " }\n", " parsed.cssPrefix = entry;\n", " }\n", " function testCssClasses(parsed, entry) {\n", " if (typeof entry !== \"object\") {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'cssClasses' must be an object.\");\n", " }\n", " if (typeof parsed.cssPrefix === \"string\") {\n", " parsed.cssClasses = {};\n", " for (var key in entry) {\n", " if (!entry.hasOwnProperty(key)) {\n", " continue;\n", " }\n", " parsed.cssClasses[key] = parsed.cssPrefix + entry[key];\n", " }\n", " }\n", " else {\n", " parsed.cssClasses = entry;\n", " }\n", " }\n", " // Test all developer settings and parse to assumption-safe values.\n", " function testOptions(options) {\n", " // To prove a fix for #537, freeze options here.\n", " // If the object is modified, an error will be thrown.\n", " // Object.freeze(options);\n", " var parsed = {\n", " margin: 0,\n", " limit: 0,\n", " padding: 0,\n", " animate: true,\n", " animationDuration: 300,\n", " ariaFormat: defaultFormatter,\n", " format: defaultFormatter\n", " };\n", " // Tests are executed in the order they are presented here.\n", " var tests = {\n", " step: { r: false, t: testStep },\n", " start: { r: true, t: testStart },\n", " connect: { r: true, t: testConnect },\n", " direction: { r: true, t: testDirection },\n", " snap: { r: false, t: testSnap },\n", " animate: { r: false, t: testAnimate },\n", " animationDuration: { r: false, t: testAnimationDuration },\n", " range: { r: true, t: testRange },\n", " orientation: { r: false, t: testOrientation },\n", " margin: { r: false, t: testMargin },\n", " limit: { r: false, t: testLimit },\n", " padding: { r: false, t: testPadding },\n", " behaviour: { r: true, t: testBehaviour },\n", " ariaFormat: { r: false, t: testAriaFormat },\n", " format: { r: false, t: testFormat },\n", " tooltips: { r: false, t: testTooltips },\n", " keyboardSupport: { r: true, t: testKeyboardSupport },\n", " documentElement: { r: false, t: testDocumentElement },\n", " cssPrefix: { r: true, t: testCssPrefix },\n", " cssClasses: { r: true, t: testCssClasses }\n", " };\n", " var defaults = {\n", " connect: false,\n", " direction: \"ltr\",\n", " behaviour: \"tap\",\n", " orientation: \"horizontal\",\n", " keyboardSupport: true,\n", " cssPrefix: \"noUi-\",\n", " cssClasses: cssClasses\n", " };\n", " // AriaFormat defaults to regular format, if any.\n", " if (options.format && !options.ariaFormat) {\n", " options.ariaFormat = options.format;\n", " }\n", " // Run all options through a testing mechanism to ensure correct\n", " // input. It should be noted that options might get modified to\n", " // be handled properly. E.g. wrapping integers in arrays.\n", " Object.keys(tests).forEach(function (name) {\n", " // If the option isn't set, but it is required, throw an error.\n", " if (!isSet(options[name]) && defaults[name] === undefined) {\n", " if (tests[name].r) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): '\" + name + \"' is required.\");\n", " }\n", " return true;\n", " }\n", " tests[name].t(parsed, !isSet(options[name]) ? defaults[name] : options[name]);\n", " });\n", " // Forward pips options\n", " parsed.pips = options.pips;\n", " // All recent browsers accept unprefixed transform.\n", " // We need -ms- for IE9 and -webkit- for older Android;\n", " // Assume use of -webkit- if unprefixed and -ms- are not supported.\n", " // https://caniuse.com/#feat=transforms2d\n", " var d = document.createElement(\"div\");\n", " var msPrefix = d.style.msTransform !== undefined;\n", " var noPrefix = d.style.transform !== undefined;\n", " parsed.transformRule = noPrefix ? \"transform\" : msPrefix ? \"msTransform\" : \"webkitTransform\";\n", " // Pips don't move, so we can place them using left/top.\n", " var styles = [[\"left\", \"top\"], [\"right\", \"bottom\"]];\n", " parsed.style = styles[parsed.dir][parsed.ort];\n", " return parsed;\n", " }\n", " //endregion\n", " function scope(target, options, originalOptions) {\n", " var actions = getActions();\n", " var supportsTouchActionNone = getSupportsTouchActionNone();\n", " var supportsPassive = supportsTouchActionNone && getSupportsPassive();\n", " // All variables local to 'scope' are prefixed with 'scope_'\n", " // Slider DOM Nodes\n", " var scope_Target = target;\n", " var scope_Base;\n", " var scope_Handles;\n", " var scope_Connects;\n", " var scope_Pips;\n", " var scope_Tooltips;\n", " // Slider state values\n", " var scope_Spectrum = options.spectrum;\n", " var scope_Values = [];\n", " var scope_Locations = [];\n", " var scope_HandleNumbers = [];\n", " var scope_ActiveHandlesCount = 0;\n", " var scope_Events = {};\n", " // Exposed API\n", " var scope_Self;\n", " // Document Nodes\n", " var scope_Document = target.ownerDocument;\n", " var scope_DocumentElement = options.documentElement || scope_Document.documentElement;\n", " var scope_Body = scope_Document.body;\n", " // Pips constants\n", " var PIPS_NONE = -1;\n", " var PIPS_NO_VALUE = 0;\n", " var PIPS_LARGE_VALUE = 1;\n", " var PIPS_SMALL_VALUE = 2;\n", " // For horizontal sliders in standard ltr documents,\n", " // make .noUi-origin overflow to the left so the document doesn't scroll.\n", " var scope_DirOffset = scope_Document.dir === \"rtl\" || options.ort === 1 ? 0 : 100;\n", " // Creates a node, adds it to target, returns the new node.\n", " function addNodeTo(addTarget, className) {\n", " var div = scope_Document.createElement(\"div\");\n", " if (className) {\n", " addClass(div, className);\n", " }\n", " addTarget.appendChild(div);\n", " return div;\n", " }\n", " // Append a origin to the base\n", " function addOrigin(base, handleNumber) {\n", " var origin = addNodeTo(base, options.cssClasses.origin);\n", " var handle = addNodeTo(origin, options.cssClasses.handle);\n", " addNodeTo(handle, options.cssClasses.touchArea);\n", " handle.setAttribute(\"data-handle\", handleNumber);\n", " if (options.keyboardSupport) {\n", " // https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex\n", " // 0 = focusable and reachable\n", " handle.setAttribute(\"tabindex\", \"0\");\n", " handle.addEventListener(\"keydown\", function (event) {\n", " return eventKeydown(event, handleNumber);\n", " });\n", " }\n", " handle.setAttribute(\"role\", \"slider\");\n", " handle.setAttribute(\"aria-orientation\", options.ort ? \"vertical\" : \"horizontal\");\n", " if (handleNumber === 0) {\n", " addClass(handle, options.cssClasses.handleLower);\n", " }\n", " else if (handleNumber === options.handles - 1) {\n", " addClass(handle, options.cssClasses.handleUpper);\n", " }\n", " return origin;\n", " }\n", " // Insert nodes for connect elements\n", " function addConnect(base, add) {\n", " if (!add) {\n", " return false;\n", " }\n", " return addNodeTo(base, options.cssClasses.connect);\n", " }\n", " // Add handles to the slider base.\n", " function addElements(connectOptions, base) {\n", " var connectBase = addNodeTo(base, options.cssClasses.connects);\n", " scope_Handles = [];\n", " scope_Connects = [];\n", " scope_Connects.push(addConnect(connectBase, connectOptions[0]));\n", " // [::::O====O====O====]\n", " // connectOptions = [0, 1, 1, 1]\n", " for (var i = 0; i < options.handles; i++) {\n", " // Keep a list of all added handles.\n", " scope_Handles.push(addOrigin(base, i));\n", " scope_HandleNumbers[i] = i;\n", " scope_Connects.push(addConnect(connectBase, connectOptions[i + 1]));\n", " }\n", " }\n", " // Initialize a single slider.\n", " function addSlider(addTarget) {\n", " // Apply classes and data to the target.\n", " addClass(addTarget, options.cssClasses.target);\n", " if (options.dir === 0) {\n", " addClass(addTarget, options.cssClasses.ltr);\n", " }\n", " else {\n", " addClass(addTarget, options.cssClasses.rtl);\n", " }\n", " if (options.ort === 0) {\n", " addClass(addTarget, options.cssClasses.horizontal);\n", " }\n", " else {\n", " addClass(addTarget, options.cssClasses.vertical);\n", " }\n", " var textDirection = getComputedStyle(addTarget).direction;\n", " if (textDirection === \"rtl\") {\n", " addClass(addTarget, options.cssClasses.textDirectionRtl);\n", " }\n", " else {\n", " addClass(addTarget, options.cssClasses.textDirectionLtr);\n", " }\n", " return addNodeTo(addTarget, options.cssClasses.base);\n", " }\n", " function addTooltip(handle, handleNumber) {\n", " if (!options.tooltips[handleNumber]) {\n", " return false;\n", " }\n", " return addNodeTo(handle.firstChild, options.cssClasses.tooltip);\n", " }\n", " function isSliderDisabled() {\n", " return scope_Target.hasAttribute(\"disabled\");\n", " }\n", " // Disable the slider dragging if any handle is disabled\n", " function isHandleDisabled(handleNumber) {\n", " var handleOrigin = scope_Handles[handleNumber];\n", " return handleOrigin.hasAttribute(\"disabled\");\n", " }\n", " function removeTooltips() {\n", " if (scope_Tooltips) {\n", " removeEvent(\"update.tooltips\");\n", " scope_Tooltips.forEach(function (tooltip) {\n", " if (tooltip) {\n", " removeElement(tooltip);\n", " }\n", " });\n", " scope_Tooltips = null;\n", " }\n", " }\n", " // The tooltips option is a shorthand for using the 'update' event.\n", " function tooltips() {\n", " removeTooltips();\n", " // Tooltips are added with options.tooltips in original order.\n", " scope_Tooltips = scope_Handles.map(addTooltip);\n", " bindEvent(\"update.tooltips\", function (values, handleNumber, unencoded) {\n", " if (!scope_Tooltips[handleNumber]) {\n", " return;\n", " }\n", " var formattedValue = values[handleNumber];\n", " if (options.tooltips[handleNumber] !== true) {\n", " formattedValue = options.tooltips[handleNumber].to(unencoded[handleNumber]);\n", " }\n", " scope_Tooltips[handleNumber].innerHTML = formattedValue;\n", " });\n", " }\n", " function aria() {\n", " bindEvent(\"update\", function (values, handleNumber, unencoded, tap, positions) {\n", " // Update Aria Values for all handles, as a change in one changes min and max values for the next.\n", " scope_HandleNumbers.forEach(function (index) {\n", " var handle = scope_Handles[index];\n", " var min = checkHandlePosition(scope_Locations, index, 0, true, true, true);\n", " var max = checkHandlePosition(scope_Locations, index, 100, true, true, true);\n", " var now = positions[index];\n", " // Formatted value for display\n", " var text = options.ariaFormat.to(unencoded[index]);\n", " // Map to slider range values\n", " min = scope_Spectrum.fromStepping(min).toFixed(1);\n", " max = scope_Spectrum.fromStepping(max).toFixed(1);\n", " now = scope_Spectrum.fromStepping(now).toFixed(1);\n", " handle.children[0].setAttribute(\"aria-valuemin\", min);\n", " handle.children[0].setAttribute(\"aria-valuemax\", max);\n", " handle.children[0].setAttribute(\"aria-valuenow\", now);\n", " handle.children[0].setAttribute(\"aria-valuetext\", text);\n", " });\n", " });\n", " }\n", " function getGroup(mode, values, stepped) {\n", " // Use the range.\n", " if (mode === \"range\" || mode === \"steps\") {\n", " return scope_Spectrum.xVal;\n", " }\n", " if (mode === \"count\") {\n", " if (values < 2) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): 'values' (>= 2) required for mode 'count'.\");\n", " }\n", " // Divide 0 - 100 in 'count' parts.\n", " var interval = values - 1;\n", " var spread = 100 / interval;\n", " values = [];\n", " // List these parts and have them handled as 'positions'.\n", " while (interval--) {\n", " values[interval] = interval * spread;\n", " }\n", " values.push(100);\n", " mode = \"positions\";\n", " }\n", " if (mode === \"positions\") {\n", " // Map all percentages to on-range values.\n", " return values.map(function (value) {\n", " return scope_Spectrum.fromStepping(stepped ? scope_Spectrum.getStep(value) : value);\n", " });\n", " }\n", " if (mode === \"values\") {\n", " // If the value must be stepped, it needs to be converted to a percentage first.\n", " if (stepped) {\n", " return values.map(function (value) {\n", " // Convert to percentage, apply step, return to value.\n", " return scope_Spectrum.fromStepping(scope_Spectrum.getStep(scope_Spectrum.toStepping(value)));\n", " });\n", " }\n", " // Otherwise, we can simply use the values.\n", " return values;\n", " }\n", " }\n", " function generateSpread(density, mode, group) {\n", " function safeIncrement(value, increment) {\n", " // Avoid floating point variance by dropping the smallest decimal places.\n", " return (value + increment).toFixed(7) / 1;\n", " }\n", " var indexes = {};\n", " var firstInRange = scope_Spectrum.xVal[0];\n", " var lastInRange = scope_Spectrum.xVal[scope_Spectrum.xVal.length - 1];\n", " var ignoreFirst = false;\n", " var ignoreLast = false;\n", " var prevPct = 0;\n", " // Create a copy of the group, sort it and filter away all duplicates.\n", " group = unique(group.slice().sort(function (a, b) {\n", " return a - b;\n", " }));\n", " // Make sure the range starts with the first element.\n", " if (group[0] !== firstInRange) {\n", " group.unshift(firstInRange);\n", " ignoreFirst = true;\n", " }\n", " // Likewise for the last one.\n", " if (group[group.length - 1] !== lastInRange) {\n", " group.push(lastInRange);\n", " ignoreLast = true;\n", " }\n", " group.forEach(function (current, index) {\n", " // Get the current step and the lower + upper positions.\n", " var step;\n", " var i;\n", " var q;\n", " var low = current;\n", " var high = group[index + 1];\n", " var newPct;\n", " var pctDifference;\n", " var pctPos;\n", " var type;\n", " var steps;\n", " var realSteps;\n", " var stepSize;\n", " var isSteps = mode === \"steps\";\n", " // When using 'steps' mode, use the provided steps.\n", " // Otherwise, we'll step on to the next subrange.\n", " if (isSteps) {\n", " step = scope_Spectrum.xNumSteps[index];\n", " }\n", " // Default to a 'full' step.\n", " if (!step) {\n", " step = high - low;\n", " }\n", " // Low can be 0, so test for false. If high is undefined,\n", " // we are at the last subrange. Index 0 is already handled.\n", " if (low === false || high === undefined) {\n", " return;\n", " }\n", " // Make sure step isn't 0, which would cause an infinite loop (#654)\n", " step = Math.max(step, 0.0000001);\n", " // Find all steps in the subrange.\n", " for (i = low; i <= high; i = safeIncrement(i, step)) {\n", " // Get the percentage value for the current step,\n", " // calculate the size for the subrange.\n", " newPct = scope_Spectrum.toStepping(i);\n", " pctDifference = newPct - prevPct;\n", " steps = pctDifference / density;\n", " realSteps = Math.round(steps);\n", " // This ratio represents the amount of percentage-space a point indicates.\n", " // For a density 1 the points/percentage = 1. For density 2, that percentage needs to be re-divided.\n", " // Round the percentage offset to an even number, then divide by two\n", " // to spread the offset on both sides of the range.\n", " stepSize = pctDifference / realSteps;\n", " // Divide all points evenly, adding the correct number to this subrange.\n", " // Run up to <= so that 100% gets a point, event if ignoreLast is set.\n", " for (q = 1; q <= realSteps; q += 1) {\n", " // The ratio between the rounded value and the actual size might be ~1% off.\n", " // Correct the percentage offset by the number of points\n", " // per subrange. density = 1 will result in 100 points on the\n", " // full range, 2 for 50, 4 for 25, etc.\n", " pctPos = prevPct + q * stepSize;\n", " indexes[pctPos.toFixed(5)] = [scope_Spectrum.fromStepping(pctPos), 0];\n", " }\n", " // Determine the point type.\n", " type = group.indexOf(i) > -1 ? PIPS_LARGE_VALUE : isSteps ? PIPS_SMALL_VALUE : PIPS_NO_VALUE;\n", " // Enforce the 'ignoreFirst' option by overwriting the type for 0.\n", " if (!index && ignoreFirst && i !== high) {\n", " type = 0;\n", " }\n", " if (!(i === high && ignoreLast)) {\n", " // Mark the 'type' of this point. 0 = plain, 1 = real value, 2 = step value.\n", " indexes[newPct.toFixed(5)] = [i, type];\n", " }\n", " // Update the percentage count.\n", " prevPct = newPct;\n", " }\n", " });\n", " return indexes;\n", " }\n", " function addMarking(spread, filterFunc, formatter) {\n", " var element = scope_Document.createElement(\"div\");\n", " var valueSizeClasses = [];\n", " valueSizeClasses[PIPS_NO_VALUE] = options.cssClasses.valueNormal;\n", " valueSizeClasses[PIPS_LARGE_VALUE] = options.cssClasses.valueLarge;\n", " valueSizeClasses[PIPS_SMALL_VALUE] = options.cssClasses.valueSub;\n", " var markerSizeClasses = [];\n", " markerSizeClasses[PIPS_NO_VALUE] = options.cssClasses.markerNormal;\n", " markerSizeClasses[PIPS_LARGE_VALUE] = options.cssClasses.markerLarge;\n", " markerSizeClasses[PIPS_SMALL_VALUE] = options.cssClasses.markerSub;\n", " var valueOrientationClasses = [options.cssClasses.valueHorizontal, options.cssClasses.valueVertical];\n", " var markerOrientationClasses = [options.cssClasses.markerHorizontal, options.cssClasses.markerVertical];\n", " addClass(element, options.cssClasses.pips);\n", " addClass(element, options.ort === 0 ? options.cssClasses.pipsHorizontal : options.cssClasses.pipsVertical);\n", " function getClasses(type, source) {\n", " var a = source === options.cssClasses.value;\n", " var orientationClasses = a ? valueOrientationClasses : markerOrientationClasses;\n", " var sizeClasses = a ? valueSizeClasses : markerSizeClasses;\n", " return source + \" \" + orientationClasses[options.ort] + \" \" + sizeClasses[type];\n", " }\n", " function addSpread(offset, value, type) {\n", " // Apply the filter function, if it is set.\n", " type = filterFunc ? filterFunc(value, type) : type;\n", " if (type === PIPS_NONE) {\n", " return;\n", " }\n", " // Add a marker for every point\n", " var node = addNodeTo(element, false);\n", " node.className = getClasses(type, options.cssClasses.marker);\n", " node.style[options.style] = offset + \"%\";\n", " // Values are only appended for points marked '1' or '2'.\n", " if (type > PIPS_NO_VALUE) {\n", " node = addNodeTo(element, false);\n", " node.className = getClasses(type, options.cssClasses.value);\n", " node.setAttribute(\"data-value\", value);\n", " node.style[options.style] = offset + \"%\";\n", " node.innerHTML = formatter.to(value);\n", " }\n", " }\n", " // Append all points.\n", " Object.keys(spread).forEach(function (offset) {\n", " addSpread(offset, spread[offset][0], spread[offset][1]);\n", " });\n", " return element;\n", " }\n", " function removePips() {\n", " if (scope_Pips) {\n", " removeElement(scope_Pips);\n", " scope_Pips = null;\n", " }\n", " }\n", " function pips(grid) {\n", " // Fix #669\n", " removePips();\n", " var mode = grid.mode;\n", " var density = grid.density || 1;\n", " var filter = grid.filter || false;\n", " var values = grid.values || false;\n", " var stepped = grid.stepped || false;\n", " var group = getGroup(mode, values, stepped);\n", " var spread = generateSpread(density, mode, group);\n", " var format = grid.format || {\n", " to: Math.round\n", " };\n", " scope_Pips = scope_Target.appendChild(addMarking(spread, filter, format));\n", " return scope_Pips;\n", " }\n", " // Shorthand for base dimensions.\n", " function baseSize() {\n", " var rect = scope_Base.getBoundingClientRect();\n", " var alt = \"offset\" + [\"Width\", \"Height\"][options.ort];\n", " return options.ort === 0 ? rect.width || scope_Base[alt] : rect.height || scope_Base[alt];\n", " }\n", " // Handler for attaching events trough a proxy.\n", " function attachEvent(events, element, callback, data) {\n", " // This function can be used to 'filter' events to the slider.\n", " // element is a node, not a nodeList\n", " var method = function (e) {\n", " e = fixEvent(e, data.pageOffset, data.target || element);\n", " // fixEvent returns false if this event has a different target\n", " // when handling (multi-) touch events;\n", " if (!e) {\n", " return false;\n", " }\n", " // doNotReject is passed by all end events to make sure released touches\n", " // are not rejected, leaving the slider \"stuck\" to the cursor;\n", " if (isSliderDisabled() && !data.doNotReject) {\n", " return false;\n", " }\n", " // Stop if an active 'tap' transition is taking place.\n", " if (hasClass(scope_Target, options.cssClasses.tap) && !data.doNotReject) {\n", " return false;\n", " }\n", " // Ignore right or middle clicks on start #454\n", " if (events === actions.start && e.buttons !== undefined && e.buttons > 1) {\n", " return false;\n", " }\n", " // Ignore right or middle clicks on start #454\n", " if (data.hover && e.buttons) {\n", " return false;\n", " }\n", " // 'supportsPassive' is only true if a browser also supports touch-action: none in CSS.\n", " // iOS safari does not, so it doesn't get to benefit from passive scrolling. iOS does support\n", " // touch-action: manipulation, but that allows panning, which breaks\n", " // sliders after zooming/on non-responsive pages.\n", " // See: https://bugs.webkit.org/show_bug.cgi?id=133112\n", " if (!supportsPassive) {\n", " e.preventDefault();\n", " }\n", " e.calcPoint = e.points[options.ort];\n", " // Call the event handler with the event [ and additional data ].\n", " callback(e, data);\n", " };\n", " var methods = [];\n", " // Bind a closure on the target for every event type.\n", " events.split(\" \").forEach(function (eventName) {\n", " element.addEventListener(eventName, method, supportsPassive ? { passive: true } : false);\n", " methods.push([eventName, method]);\n", " });\n", " return methods;\n", " }\n", " // Provide a clean event with standardized offset values.\n", " function fixEvent(e, pageOffset, eventTarget) {\n", " // Filter the event to register the type, which can be\n", " // touch, mouse or pointer. Offset changes need to be\n", " // made on an event specific basis.\n", " var touch = e.type.indexOf(\"touch\") === 0;\n", " var mouse = e.type.indexOf(\"mouse\") === 0;\n", " var pointer = e.type.indexOf(\"pointer\") === 0;\n", " var x;\n", " var y;\n", " // IE10 implemented pointer events with a prefix;\n", " if (e.type.indexOf(\"MSPointer\") === 0) {\n", " pointer = true;\n", " }\n", " // The only thing one handle should be concerned about is the touches that originated on top of it.\n", " if (touch) {\n", " // Returns true if a touch originated on the target.\n", " var isTouchOnTarget = function (checkTouch) {\n", " return (checkTouch.target === eventTarget ||\n", " eventTarget.contains(checkTouch.target) ||\n", " (checkTouch.target.shadowRoot && checkTouch.target.shadowRoot.contains(eventTarget)));\n", " };\n", " // In the case of touchstart events, we need to make sure there is still no more than one\n", " // touch on the target so we look amongst all touches.\n", " if (e.type === \"touchstart\") {\n", " var targetTouches = Array.prototype.filter.call(e.touches, isTouchOnTarget);\n", " // Do not support more than one touch per handle.\n", " if (targetTouches.length > 1) {\n", " return false;\n", " }\n", " x = targetTouches[0].pageX;\n", " y = targetTouches[0].pageY;\n", " }\n", " else {\n", " // In the other cases, find on changedTouches is enough.\n", " var targetTouch = Array.prototype.find.call(e.changedTouches, isTouchOnTarget);\n", " // Cancel if the target touch has not moved.\n", " if (!targetTouch) {\n", " return false;\n", " }\n", " x = targetTouch.pageX;\n", " y = targetTouch.pageY;\n", " }\n", " }\n", " pageOffset = pageOffset || getPageOffset(scope_Document);\n", " if (mouse || pointer) {\n", " x = e.clientX + pageOffset.x;\n", " y = e.clientY + pageOffset.y;\n", " }\n", " e.pageOffset = pageOffset;\n", " e.points = [x, y];\n", " e.cursor = mouse || pointer; // Fix #435\n", " return e;\n", " }\n", " // Translate a coordinate in the document to a percentage on the slider\n", " function calcPointToPercentage(calcPoint) {\n", " var location = calcPoint - offset(scope_Base, options.ort);\n", " var proposal = (location * 100) / baseSize();\n", " // Clamp proposal between 0% and 100%\n", " // Out-of-bound coordinates may occur when .noUi-base pseudo-elements\n", " // are used (e.g. contained handles feature)\n", " proposal = limit(proposal);\n", " return options.dir ? 100 - proposal : proposal;\n", " }\n", " // Find handle closest to a certain percentage on the slider\n", " function getClosestHandle(clickedPosition) {\n", " var smallestDifference = 100;\n", " var handleNumber = false;\n", " scope_Handles.forEach(function (handle, index) {\n", " // Disabled handles are ignored\n", " if (isHandleDisabled(index)) {\n", " return;\n", " }\n", " var handlePosition = scope_Locations[index];\n", " var differenceWithThisHandle = Math.abs(handlePosition - clickedPosition);\n", " // Initial state\n", " var clickAtEdge = differenceWithThisHandle === 100 && smallestDifference === 100;\n", " // Difference with this handle is smaller than the previously checked handle\n", " var isCloser = differenceWithThisHandle < smallestDifference;\n", " var isCloserAfter = differenceWithThisHandle <= smallestDifference && clickedPosition > handlePosition;\n", " if (isCloser || isCloserAfter || clickAtEdge) {\n", " handleNumber = index;\n", " smallestDifference = differenceWithThisHandle;\n", " }\n", " });\n", " return handleNumber;\n", " }\n", " // Fire 'end' when a mouse or pen leaves the document.\n", " function documentLeave(event, data) {\n", " if (event.type === \"mouseout\" && event.target.nodeName === \"HTML\" && event.relatedTarget === null) {\n", " eventEnd(event, data);\n", " }\n", " }\n", " // Handle movement on document for handle and range drag.\n", " function eventMove(event, data) {\n", " // Fix #498\n", " // Check value of .buttons in 'start' to work around a bug in IE10 mobile (data.buttonsProperty).\n", " // https://connect.microsoft.com/IE/feedback/details/927005/mobile-ie10-windows-phone-buttons-property-of-pointermove-event-always-zero\n", " // IE9 has .buttons and .which zero on mousemove.\n", " // Firefox breaks the spec MDN defines.\n", " if (navigator.appVersion.indexOf(\"MSIE 9\") === -1 && event.buttons === 0 && data.buttonsProperty !== 0) {\n", " return eventEnd(event, data);\n", " }\n", " // Check if we are moving up or down\n", " var movement = (options.dir ? -1 : 1) * (event.calcPoint - data.startCalcPoint);\n", " // Convert the movement into a percentage of the slider width/height\n", " var proposal = (movement * 100) / data.baseSize;\n", " moveHandles(movement > 0, proposal, data.locations, data.handleNumbers);\n", " }\n", " // Unbind move events on document, call callbacks.\n", " function eventEnd(event, data) {\n", " // The handle is no longer active, so remove the class.\n", " if (data.handle) {\n", " removeClass(data.handle, options.cssClasses.active);\n", " scope_ActiveHandlesCount -= 1;\n", " }\n", " // Unbind the move and end events, which are added on 'start'.\n", " data.listeners.forEach(function (c) {\n", " scope_DocumentElement.removeEventListener(c[0], c[1]);\n", " });\n", " if (scope_ActiveHandlesCount === 0) {\n", " // Remove dragging class.\n", " removeClass(scope_Target, options.cssClasses.drag);\n", " setZindex();\n", " // Remove cursor styles and text-selection events bound to the body.\n", " if (event.cursor) {\n", " scope_Body.style.cursor = \"\";\n", " scope_Body.removeEventListener(\"selectstart\", preventDefault);\n", " }\n", " }\n", " data.handleNumbers.forEach(function (handleNumber) {\n", " fireEvent(\"change\", handleNumber);\n", " fireEvent(\"set\", handleNumber);\n", " fireEvent(\"end\", handleNumber);\n", " });\n", " }\n", " // Bind move events on document.\n", " function eventStart(event, data) {\n", " // Ignore event if any handle is disabled\n", " if (data.handleNumbers.some(isHandleDisabled)) {\n", " return false;\n", " }\n", " var handle;\n", " if (data.handleNumbers.length === 1) {\n", " var handleOrigin = scope_Handles[data.handleNumbers[0]];\n", " handle = handleOrigin.children[0];\n", " scope_ActiveHandlesCount += 1;\n", " // Mark the handle as 'active' so it can be styled.\n", " addClass(handle, options.cssClasses.active);\n", " }\n", " // A drag should never propagate up to the 'tap' event.\n", " event.stopPropagation();\n", " // Record the event listeners.\n", " var listeners = [];\n", " // Attach the move and end events.\n", " var moveEvent = attachEvent(actions.move, scope_DocumentElement, eventMove, {\n", " // The event target has changed so we need to propagate the original one so that we keep\n", " // relying on it to extract target touches.\n", " target: event.target,\n", " handle: handle,\n", " listeners: listeners,\n", " startCalcPoint: event.calcPoint,\n", " baseSize: baseSize(),\n", " pageOffset: event.pageOffset,\n", " handleNumbers: data.handleNumbers,\n", " buttonsProperty: event.buttons,\n", " locations: scope_Locations.slice()\n", " });\n", " var endEvent = attachEvent(actions.end, scope_DocumentElement, eventEnd, {\n", " target: event.target,\n", " handle: handle,\n", " listeners: listeners,\n", " doNotReject: true,\n", " handleNumbers: data.handleNumbers\n", " });\n", " var outEvent = attachEvent(\"mouseout\", scope_DocumentElement, documentLeave, {\n", " target: event.target,\n", " handle: handle,\n", " listeners: listeners,\n", " doNotReject: true,\n", " handleNumbers: data.handleNumbers\n", " });\n", " // We want to make sure we pushed the listeners in the listener list rather than creating\n", " // a new one as it has already been passed to the event handlers.\n", " listeners.push.apply(listeners, moveEvent.concat(endEvent, outEvent));\n", " // Text selection isn't an issue on touch devices,\n", " // so adding cursor styles can be skipped.\n", " if (event.cursor) {\n", " // Prevent the 'I' cursor and extend the range-drag cursor.\n", " scope_Body.style.cursor = getComputedStyle(event.target).cursor;\n", " // Mark the target with a dragging state.\n", " if (scope_Handles.length > 1) {\n", " addClass(scope_Target, options.cssClasses.drag);\n", " }\n", " // Prevent text selection when dragging the handles.\n", " // In noUiSlider <= 9.2.0, this was handled by calling preventDefault on mouse/touch start/move,\n", " // which is scroll blocking. The selectstart event is supported by FireFox starting from version 52,\n", " // meaning the only holdout is iOS Safari. This doesn't matter: text selection isn't triggered there.\n", " // The 'cursor' flag is false.\n", " // See: http://caniuse.com/#search=selectstart\n", " scope_Body.addEventListener(\"selectstart\", preventDefault, false);\n", " }\n", " data.handleNumbers.forEach(function (handleNumber) {\n", " fireEvent(\"start\", handleNumber);\n", " });\n", " }\n", " // Move closest handle to tapped location.\n", " function eventTap(event) {\n", " // The tap event shouldn't propagate up\n", " event.stopPropagation();\n", " var proposal = calcPointToPercentage(event.calcPoint);\n", " var handleNumber = getClosestHandle(proposal);\n", " // Tackle the case that all handles are 'disabled'.\n", " if (handleNumber === false) {\n", " return false;\n", " }\n", " // Flag the slider as it is now in a transitional state.\n", " // Transition takes a configurable amount of ms (default 300). Re-enable the slider after that.\n", " if (!options.events.snap) {\n", " addClassFor(scope_Target, options.cssClasses.tap, options.animationDuration);\n", " }\n", " setHandle(handleNumber, proposal, true, true);\n", " setZindex();\n", " fireEvent(\"slide\", handleNumber, true);\n", " fireEvent(\"update\", handleNumber, true);\n", " fireEvent(\"change\", handleNumber, true);\n", " fireEvent(\"set\", handleNumber, true);\n", " if (options.events.snap) {\n", " eventStart(event, { handleNumbers: [handleNumber] });\n", " }\n", " }\n", " // Fires a 'hover' event for a hovered mouse/pen position.\n", " function eventHover(event) {\n", " var proposal = calcPointToPercentage(event.calcPoint);\n", " var to = scope_Spectrum.getStep(proposal);\n", " var value = scope_Spectrum.fromStepping(to);\n", " Object.keys(scope_Events).forEach(function (targetEvent) {\n", " if (\"hover\" === targetEvent.split(\".\")[0]) {\n", " scope_Events[targetEvent].forEach(function (callback) {\n", " callback.call(scope_Self, value);\n", " });\n", " }\n", " });\n", " }\n", " // Handles keydown on focused handles\n", " // Don't move the document when pressing arrow keys on focused handles\n", " function eventKeydown(event, handleNumber) {\n", " if (isSliderDisabled() || isHandleDisabled(handleNumber)) {\n", " return false;\n", " }\n", " var horizontalKeys = [\"Left\", \"Right\"];\n", " var verticalKeys = [\"Down\", \"Up\"];\n", " var largeStepKeys = [\"PageDown\", \"PageUp\"];\n", " var edgeKeys = [\"Home\", \"End\"];\n", " if (options.dir && !options.ort) {\n", " // On an right-to-left slider, the left and right keys act inverted\n", " horizontalKeys.reverse();\n", " }\n", " else if (options.ort && !options.dir) {\n", " // On a top-to-bottom slider, the up and down keys act inverted\n", " verticalKeys.reverse();\n", " largeStepKeys.reverse();\n", " }\n", " // Strip \"Arrow\" for IE compatibility. https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key\n", " var key = event.key.replace(\"Arrow\", \"\");\n", " var isLargeDown = key === largeStepKeys[0];\n", " var isLargeUp = key === largeStepKeys[1];\n", " var isDown = key === verticalKeys[0] || key === horizontalKeys[0] || isLargeDown;\n", " var isUp = key === verticalKeys[1] || key === horizontalKeys[1] || isLargeUp;\n", " var isMin = key === edgeKeys[0];\n", " var isMax = key === edgeKeys[1];\n", " if (!isDown && !isUp && !isMin && !isMax) {\n", " return true;\n", " }\n", " event.preventDefault();\n", " var to;\n", " if (isUp || isDown) {\n", " var multiplier = 5;\n", " var direction = isDown ? 0 : 1;\n", " var steps = getNextStepsForHandle(handleNumber);\n", " var step = steps[direction];\n", " // At the edge of a slider, do nothing\n", " if (step === null) {\n", " return false;\n", " }\n", " // No step set, use the default of 10% of the sub-range\n", " if (step === false) {\n", " step = scope_Spectrum.getDefaultStep(scope_Locations[handleNumber], isDown, 10);\n", " }\n", " if (isLargeUp || isLargeDown) {\n", " step *= multiplier;\n", " }\n", " // Step over zero-length ranges (#948);\n", " step = Math.max(step, 0.0000001);\n", " // Decrement for down steps\n", " step = (isDown ? -1 : 1) * step;\n", " to = scope_Values[handleNumber] + step;\n", " }\n", " else if (isMax) {\n", " // End key\n", " to = options.spectrum.xVal[options.spectrum.xVal.length - 1];\n", " }\n", " else {\n", " // Home key\n", " to = options.spectrum.xVal[0];\n", " }\n", " setHandle(handleNumber, scope_Spectrum.toStepping(to), true, true);\n", " fireEvent(\"slide\", handleNumber);\n", " fireEvent(\"update\", handleNumber);\n", " fireEvent(\"change\", handleNumber);\n", " fireEvent(\"set\", handleNumber);\n", " return false;\n", " }\n", " // Attach events to several slider parts.\n", " function bindSliderEvents(behaviour) {\n", " // Attach the standard drag event to the handles.\n", " if (!behaviour.fixed) {\n", " scope_Handles.forEach(function (handle, index) {\n", " // These events are only bound to the visual handle\n", " // element, not the 'real' origin element.\n", " attachEvent(actions.start, handle.children[0], eventStart, {\n", " handleNumbers: [index]\n", " });\n", " });\n", " }\n", " // Attach the tap event to the slider base.\n", " if (behaviour.tap) {\n", " attachEvent(actions.start, scope_Base, eventTap, {});\n", " }\n", " // Fire hover events\n", " if (behaviour.hover) {\n", " attachEvent(actions.move, scope_Base, eventHover, {\n", " hover: true\n", " });\n", " }\n", " // Make the range draggable.\n", " if (behaviour.drag) {\n", " scope_Connects.forEach(function (connect, index) {\n", " if (connect === false || index === 0 || index === scope_Connects.length - 1) {\n", " return;\n", " }\n", " var handleBefore = scope_Handles[index - 1];\n", " var handleAfter = scope_Handles[index];\n", " var eventHolders = [connect];\n", " addClass(connect, options.cssClasses.draggable);\n", " // When the range is fixed, the entire range can\n", " // be dragged by the handles. The handle in the first\n", " // origin will propagate the start event upward,\n", " // but it needs to be bound manually on the other.\n", " if (behaviour.fixed) {\n", " eventHolders.push(handleBefore.children[0]);\n", " eventHolders.push(handleAfter.children[0]);\n", " }\n", " eventHolders.forEach(function (eventHolder) {\n", " attachEvent(actions.start, eventHolder, eventStart, {\n", " handles: [handleBefore, handleAfter],\n", " handleNumbers: [index - 1, index]\n", " });\n", " });\n", " });\n", " }\n", " }\n", " // Attach an event to this slider, possibly including a namespace\n", " function bindEvent(namespacedEvent, callback) {\n", " scope_Events[namespacedEvent] = scope_Events[namespacedEvent] || [];\n", " scope_Events[namespacedEvent].push(callback);\n", " // If the event bound is 'update,' fire it immediately for all handles.\n", " if (namespacedEvent.split(\".\")[0] === \"update\") {\n", " scope_Handles.forEach(function (a, index) {\n", " fireEvent(\"update\", index);\n", " });\n", " }\n", " }\n", " // Undo attachment of event\n", " function removeEvent(namespacedEvent) {\n", " var event = namespacedEvent && namespacedEvent.split(\".\")[0];\n", " var namespace = event && namespacedEvent.substring(event.length);\n", " Object.keys(scope_Events).forEach(function (bind) {\n", " var tEvent = bind.split(\".\")[0];\n", " var tNamespace = bind.substring(tEvent.length);\n", " if ((!event || event === tEvent) && (!namespace || namespace === tNamespace)) {\n", " delete scope_Events[bind];\n", " }\n", " });\n", " }\n", " // External event handling\n", " function fireEvent(eventName, handleNumber, tap) {\n", " Object.keys(scope_Events).forEach(function (targetEvent) {\n", " var eventType = targetEvent.split(\".\")[0];\n", " if (eventName === eventType) {\n", " scope_Events[targetEvent].forEach(function (callback) {\n", " callback.call(\n", " // Use the slider public API as the scope ('this')\n", " scope_Self, \n", " // Return values as array, so arg_1[arg_2] is always valid.\n", " scope_Values.map(options.format.to), \n", " // Handle index, 0 or 1\n", " handleNumber, \n", " // Un-formatted slider values\n", " scope_Values.slice(), \n", " // Event is fired by tap, true or false\n", " tap || false, \n", " // Left offset of the handle, in relation to the slider\n", " scope_Locations.slice(), \n", " // add the slider public API to an accessible parameter when this is unavailable\n", " scope_Self);\n", " });\n", " }\n", " });\n", " }\n", " // Split out the handle positioning logic so the Move event can use it, too\n", " function checkHandlePosition(reference, handleNumber, to, lookBackward, lookForward, getValue) {\n", " var distance;\n", " // For sliders with multiple handles, limit movement to the other handle.\n", " // Apply the margin option by adding it to the handle positions.\n", " if (scope_Handles.length > 1 && !options.events.unconstrained) {\n", " if (lookBackward && handleNumber > 0) {\n", " distance = scope_Spectrum.getAbsoluteDistance(reference[handleNumber - 1], options.margin, 0);\n", " to = Math.max(to, distance);\n", " }\n", " if (lookForward && handleNumber < scope_Handles.length - 1) {\n", " distance = scope_Spectrum.getAbsoluteDistance(reference[handleNumber + 1], options.margin, 1);\n", " to = Math.min(to, distance);\n", " }\n", " }\n", " // The limit option has the opposite effect, limiting handles to a\n", " // maximum distance from another. Limit must be > 0, as otherwise\n", " // handles would be unmovable.\n", " if (scope_Handles.length > 1 && options.limit) {\n", " if (lookBackward && handleNumber > 0) {\n", " distance = scope_Spectrum.getAbsoluteDistance(reference[handleNumber - 1], options.limit, 0);\n", " to = Math.min(to, distance);\n", " }\n", " if (lookForward && handleNumber < scope_Handles.length - 1) {\n", " distance = scope_Spectrum.getAbsoluteDistance(reference[handleNumber + 1], options.limit, 1);\n", " to = Math.max(to, distance);\n", " }\n", " }\n", " // The padding option keeps the handles a certain distance from the\n", " // edges of the slider. Padding must be > 0.\n", " if (options.padding) {\n", " if (handleNumber === 0) {\n", " distance = scope_Spectrum.getAbsoluteDistance(0, options.padding[0], 0);\n", " to = Math.max(to, distance);\n", " }\n", " if (handleNumber === scope_Handles.length - 1) {\n", " distance = scope_Spectrum.getAbsoluteDistance(100, options.padding[1], 1);\n", " to = Math.min(to, distance);\n", " }\n", " }\n", " to = scope_Spectrum.getStep(to);\n", " // Limit percentage to the 0 - 100 range\n", " to = limit(to);\n", " // Return false if handle can't move\n", " if (to === reference[handleNumber] && !getValue) {\n", " return false;\n", " }\n", " return to;\n", " }\n", " // Uses slider orientation to create CSS rules. a = base value;\n", " function inRuleOrder(v, a) {\n", " var o = options.ort;\n", " return (o ? a : v) + \", \" + (o ? v : a);\n", " }\n", " // Moves handle(s) by a percentage\n", " // (bool, % to move, [% where handle started, ...], [index in scope_Handles, ...])\n", " function moveHandles(upward, proposal, locations, handleNumbers) {\n", " var proposals = locations.slice();\n", " var b = [!upward, upward];\n", " var f = [upward, !upward];\n", " // Copy handleNumbers so we don't change the dataset\n", " handleNumbers = handleNumbers.slice();\n", " // Check to see which handle is 'leading'.\n", " // If that one can't move the second can't either.\n", " if (upward) {\n", " handleNumbers.reverse();\n", " }\n", " // Step 1: get the maximum percentage that any of the handles can move\n", " if (handleNumbers.length > 1) {\n", " handleNumbers.forEach(function (handleNumber, o) {\n", " var to = checkHandlePosition(proposals, handleNumber, proposals[handleNumber] + proposal, b[o], f[o], false);\n", " // Stop if one of the handles can't move.\n", " if (to === false) {\n", " proposal = 0;\n", " }\n", " else {\n", " proposal = to - proposals[handleNumber];\n", " proposals[handleNumber] = to;\n", " }\n", " });\n", " }\n", " // If using one handle, check backward AND forward\n", " else {\n", " b = f = [true];\n", " }\n", " var state = false;\n", " // Step 2: Try to set the handles with the found percentage\n", " handleNumbers.forEach(function (handleNumber, o) {\n", " state = setHandle(handleNumber, locations[handleNumber] + proposal, b[o], f[o]) || state;\n", " });\n", " // Step 3: If a handle moved, fire events\n", " if (state) {\n", " handleNumbers.forEach(function (handleNumber) {\n", " fireEvent(\"update\", handleNumber);\n", " fireEvent(\"slide\", handleNumber);\n", " });\n", " }\n", " }\n", " // Takes a base value and an offset. This offset is used for the connect bar size.\n", " // In the initial design for this feature, the origin element was 1% wide.\n", " // Unfortunately, a rounding bug in Chrome makes it impossible to implement this feature\n", " // in this manner: https://bugs.chromium.org/p/chromium/issues/detail?id=798223\n", " function transformDirection(a, b) {\n", " return options.dir ? 100 - a - b : a;\n", " }\n", " // Updates scope_Locations and scope_Values, updates visual state\n", " function updateHandlePosition(handleNumber, to) {\n", " // Update locations.\n", " scope_Locations[handleNumber] = to;\n", " // Convert the value to the slider stepping/range.\n", " scope_Values[handleNumber] = scope_Spectrum.fromStepping(to);\n", " var translation = 10 * (transformDirection(to, 0) - scope_DirOffset);\n", " var translateRule = \"translate(\" + inRuleOrder(translation + \"%\", \"0\") + \")\";\n", " scope_Handles[handleNumber].style[options.transformRule] = translateRule;\n", " updateConnect(handleNumber);\n", " updateConnect(handleNumber + 1);\n", " }\n", " // Handles before the slider middle are stacked later = higher,\n", " // Handles after the middle later is lower\n", " // [[7] [8] .......... | .......... [5] [4]\n", " function setZindex() {\n", " scope_HandleNumbers.forEach(function (handleNumber) {\n", " var dir = scope_Locations[handleNumber] > 50 ? -1 : 1;\n", " var zIndex = 3 + (scope_Handles.length + dir * handleNumber);\n", " scope_Handles[handleNumber].style.zIndex = zIndex;\n", " });\n", " }\n", " // Test suggested values and apply margin, step.\n", " function setHandle(handleNumber, to, lookBackward, lookForward) {\n", " to = checkHandlePosition(scope_Locations, handleNumber, to, lookBackward, lookForward, false);\n", " if (to === false) {\n", " return false;\n", " }\n", " updateHandlePosition(handleNumber, to);\n", " return true;\n", " }\n", " // Updates style attribute for connect nodes\n", " function updateConnect(index) {\n", " // Skip connects set to false\n", " if (!scope_Connects[index]) {\n", " return;\n", " }\n", " var l = 0;\n", " var h = 100;\n", " if (index !== 0) {\n", " l = scope_Locations[index - 1];\n", " }\n", " if (index !== scope_Connects.length - 1) {\n", " h = scope_Locations[index];\n", " }\n", " // We use two rules:\n", " // 'translate' to change the left/top offset;\n", " // 'scale' to change the width of the element;\n", " // As the element has a width of 100%, a translation of 100% is equal to 100% of the parent (.noUi-base)\n", " var connectWidth = h - l;\n", " var translateRule = \"translate(\" + inRuleOrder(transformDirection(l, connectWidth) + \"%\", \"0\") + \")\";\n", " var scaleRule = \"scale(\" + inRuleOrder(connectWidth / 100, \"1\") + \")\";\n", " scope_Connects[index].style[options.transformRule] = translateRule + \" \" + scaleRule;\n", " }\n", " // Parses value passed to .set method. Returns current value if not parse-able.\n", " function resolveToValue(to, handleNumber) {\n", " // Setting with null indicates an 'ignore'.\n", " // Inputting 'false' is invalid.\n", " if (to === null || to === false || to === undefined) {\n", " return scope_Locations[handleNumber];\n", " }\n", " // If a formatted number was passed, attempt to decode it.\n", " if (typeof to === \"number\") {\n", " to = String(to);\n", " }\n", " to = options.format.from(to);\n", " to = scope_Spectrum.toStepping(to);\n", " // If parsing the number failed, use the current value.\n", " if (to === false || isNaN(to)) {\n", " return scope_Locations[handleNumber];\n", " }\n", " return to;\n", " }\n", " // Set the slider value.\n", " function valueSet(input, fireSetEvent) {\n", " var values = asArray(input);\n", " var isInit = scope_Locations[0] === undefined;\n", " // Event fires by default\n", " fireSetEvent = fireSetEvent === undefined ? true : !!fireSetEvent;\n", " // Animation is optional.\n", " // Make sure the initial values were set before using animated placement.\n", " if (options.animate && !isInit) {\n", " addClassFor(scope_Target, options.cssClasses.tap, options.animationDuration);\n", " }\n", " // First pass, without lookAhead but with lookBackward. Values are set from left to right.\n", " scope_HandleNumbers.forEach(function (handleNumber) {\n", " setHandle(handleNumber, resolveToValue(values[handleNumber], handleNumber), true, false);\n", " });\n", " var i = scope_HandleNumbers.length === 1 ? 0 : 1;\n", " // Secondary passes. Now that all base values are set, apply constraints.\n", " // Iterate all handles to ensure constraints are applied for the entire slider (Issue #1009)\n", " for (; i < scope_HandleNumbers.length; ++i) {\n", " scope_HandleNumbers.forEach(function (handleNumber) {\n", " setHandle(handleNumber, scope_Locations[handleNumber], true, true);\n", " });\n", " }\n", " setZindex();\n", " scope_HandleNumbers.forEach(function (handleNumber) {\n", " fireEvent(\"update\", handleNumber);\n", " // Fire the event only for handles that received a new value, as per #579\n", " if (values[handleNumber] !== null && fireSetEvent) {\n", " fireEvent(\"set\", handleNumber);\n", " }\n", " });\n", " }\n", " // Reset slider to initial values\n", " function valueReset(fireSetEvent) {\n", " valueSet(options.start, fireSetEvent);\n", " }\n", " // Set value for a single handle\n", " function valueSetHandle(handleNumber, value, fireSetEvent) {\n", " // Ensure numeric input\n", " handleNumber = Number(handleNumber);\n", " if (!(handleNumber >= 0 && handleNumber < scope_HandleNumbers.length)) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): invalid handle number, got: \" + handleNumber);\n", " }\n", " // Look both backward and forward, since we don't want this handle to \"push\" other handles (#960);\n", " setHandle(handleNumber, resolveToValue(value, handleNumber), true, true);\n", " fireEvent(\"update\", handleNumber);\n", " if (fireSetEvent) {\n", " fireEvent(\"set\", handleNumber);\n", " }\n", " }\n", " // Get the slider value.\n", " function valueGet() {\n", " var values = scope_Values.map(options.format.to);\n", " // If only one handle is used, return a single value.\n", " if (values.length === 1) {\n", " return values[0];\n", " }\n", " return values;\n", " }\n", " // Removes classes from the root and empties it.\n", " function destroy() {\n", " for (var key in options.cssClasses) {\n", " if (!options.cssClasses.hasOwnProperty(key)) {\n", " continue;\n", " }\n", " removeClass(scope_Target, options.cssClasses[key]);\n", " }\n", " while (scope_Target.firstChild) {\n", " scope_Target.removeChild(scope_Target.firstChild);\n", " }\n", " delete scope_Target.noUiSlider;\n", " }\n", " function getNextStepsForHandle(handleNumber) {\n", " var location = scope_Locations[handleNumber];\n", " var nearbySteps = scope_Spectrum.getNearbySteps(location);\n", " var value = scope_Values[handleNumber];\n", " var increment = nearbySteps.thisStep.step;\n", " var decrement = null;\n", " // If snapped, directly use defined step value\n", " if (options.snap) {\n", " return [\n", " value - nearbySteps.stepBefore.startValue || null,\n", " nearbySteps.stepAfter.startValue - value || null\n", " ];\n", " }\n", " // If the next value in this step moves into the next step,\n", " // the increment is the start of the next step - the current value\n", " if (increment !== false) {\n", " if (value + increment > nearbySteps.stepAfter.startValue) {\n", " increment = nearbySteps.stepAfter.startValue - value;\n", " }\n", " }\n", " // If the value is beyond the starting point\n", " if (value > nearbySteps.thisStep.startValue) {\n", " decrement = nearbySteps.thisStep.step;\n", " }\n", " else if (nearbySteps.stepBefore.step === false) {\n", " decrement = false;\n", " }\n", " // If a handle is at the start of a step, it always steps back into the previous step first\n", " else {\n", " decrement = value - nearbySteps.stepBefore.highestStep;\n", " }\n", " // Now, if at the slider edges, there is no in/decrement\n", " if (location === 100) {\n", " increment = null;\n", " }\n", " else if (location === 0) {\n", " decrement = null;\n", " }\n", " // As per #391, the comparison for the decrement step can have some rounding issues.\n", " var stepDecimals = scope_Spectrum.countStepDecimals();\n", " // Round per #391\n", " if (increment !== null && increment !== false) {\n", " increment = Number(increment.toFixed(stepDecimals));\n", " }\n", " if (decrement !== null && decrement !== false) {\n", " decrement = Number(decrement.toFixed(stepDecimals));\n", " }\n", " return [decrement, increment];\n", " }\n", " // Get the current step size for the slider.\n", " function getNextSteps() {\n", " return scope_HandleNumbers.map(getNextStepsForHandle);\n", " }\n", " // Updateable: margin, limit, padding, step, range, animate, snap\n", " function updateOptions(optionsToUpdate, fireSetEvent) {\n", " // Spectrum is created using the range, snap, direction and step options.\n", " // 'snap' and 'step' can be updated.\n", " // If 'snap' and 'step' are not passed, they should remain unchanged.\n", " var v = valueGet();\n", " var updateAble = [\n", " \"margin\",\n", " \"limit\",\n", " \"padding\",\n", " \"range\",\n", " \"animate\",\n", " \"snap\",\n", " \"step\",\n", " \"format\",\n", " \"pips\",\n", " \"tooltips\"\n", " ];\n", " // Only change options that we're actually passed to update.\n", " updateAble.forEach(function (name) {\n", " // Check for undefined. null removes the value.\n", " if (optionsToUpdate[name] !== undefined) {\n", " originalOptions[name] = optionsToUpdate[name];\n", " }\n", " });\n", " var newOptions = testOptions(originalOptions);\n", " // Load new options into the slider state\n", " updateAble.forEach(function (name) {\n", " if (optionsToUpdate[name] !== undefined) {\n", " options[name] = newOptions[name];\n", " }\n", " });\n", " scope_Spectrum = newOptions.spectrum;\n", " // Limit, margin and padding depend on the spectrum but are stored outside of it. (#677)\n", " options.margin = newOptions.margin;\n", " options.limit = newOptions.limit;\n", " options.padding = newOptions.padding;\n", " // Update pips, removes existing.\n", " if (options.pips) {\n", " pips(options.pips);\n", " }\n", " else {\n", " removePips();\n", " }\n", " // Update tooltips, removes existing.\n", " if (options.tooltips) {\n", " tooltips();\n", " }\n", " else {\n", " removeTooltips();\n", " }\n", " // Invalidate the current positioning so valueSet forces an update.\n", " scope_Locations = [];\n", " valueSet(optionsToUpdate.start || v, fireSetEvent);\n", " }\n", " // Initialization steps\n", " function setupSlider() {\n", " // Create the base element, initialize HTML and set classes.\n", " // Add handles and connect elements.\n", " scope_Base = addSlider(scope_Target);\n", " addElements(options.connect, scope_Base);\n", " // Attach user events.\n", " bindSliderEvents(options.events);\n", " // Use the public value method to set the start values.\n", " valueSet(options.start);\n", " if (options.pips) {\n", " pips(options.pips);\n", " }\n", " if (options.tooltips) {\n", " tooltips();\n", " }\n", " aria();\n", " }\n", " setupSlider();\n", " // noinspection JSUnusedGlobalSymbols\n", " scope_Self = {\n", " destroy: destroy,\n", " steps: getNextSteps,\n", " on: bindEvent,\n", " off: removeEvent,\n", " get: valueGet,\n", " set: valueSet,\n", " setHandle: valueSetHandle,\n", " reset: valueReset,\n", " // Exposed for unit testing, don't use this in your application.\n", " __moveHandles: function (a, b, c) {\n", " moveHandles(a, b, scope_Locations, c);\n", " },\n", " options: originalOptions,\n", " updateOptions: updateOptions,\n", " target: scope_Target,\n", " removePips: removePips,\n", " removeTooltips: removeTooltips,\n", " getTooltips: function () {\n", " return scope_Tooltips;\n", " },\n", " getOrigins: function () {\n", " return scope_Handles;\n", " },\n", " pips: pips // Issue #594\n", " };\n", " return scope_Self;\n", " }\n", " // Run the standard initializer\n", " function initialize(target, originalOptions) {\n", " if (!target || !target.nodeName) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): create requires a single element, got: \" + target);\n", " }\n", " // Throw an error if the slider was already initialized.\n", " if (target.noUiSlider) {\n", " throw new Error(\"noUiSlider (\" + VERSION + \"): Slider was already initialized.\");\n", " }\n", " // Test the options and create the slider environment;\n", " var options = testOptions(originalOptions, target);\n", " var api = scope(target, options, originalOptions);\n", " target.noUiSlider = api;\n", " return api;\n", " }\n", " // Use an object instead of a function for future expandability;\n", " return {\n", " // Exposed for unit testing, don't use this in your application.\n", " __spectrum: Spectrum,\n", " version: VERSION,\n", " // A reference to the default classes, allows global changes.\n", " // Use the cssClasses option for changes to one slider.\n", " cssClasses: cssClasses,\n", " create: initialize\n", " };\n", " });\n", " },\n", " 413: /* styles/widgets/sliders.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.bk_slider_value = \"bk-slider-value\";\n", " exports.bk_slider_title = \"bk-slider-title\";\n", " },\n", " 414: /* styles/widgets/nouislider.css.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const css = `\n", " .bk-root {\n", " /*! nouislider - 14.5.0 - 5/11/2020 */\n", " /* Functional styling;\n", " * These styles are required for noUiSlider to function.\n", " * You don't need to change these rules to apply your design.\n", " */\n", " /* Wrapper for all connect elements.\n", " */\n", " /* Offset direction\n", " */\n", " /* Give origins 0 height/width so they don't interfere with clicking the\n", " * connect elements.\n", " */\n", " /* Slider size and handle placement;\n", " */\n", " /* Styling;\n", " * Giving the connect element a border radius causes issues with using transform: scale\n", " */\n", " /* Handles and cursors;\n", " */\n", " /* Handle stripes;\n", " */\n", " /* Disabled state;\n", " */\n", " /* Base;\n", " *\n", " */\n", " /* Values;\n", " *\n", " */\n", " /* Markings;\n", " *\n", " */\n", " /* Horizontal layout;\n", " *\n", " */\n", " /* Vertical layout;\n", " *\n", " */\n", " }\n", " .bk-root .noUi-target,\n", " .bk-root .noUi-target * {\n", " -webkit-touch-callout: none;\n", " -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n", " -webkit-user-select: none;\n", " -ms-touch-action: none;\n", " touch-action: none;\n", " -ms-user-select: none;\n", " -moz-user-select: none;\n", " user-select: none;\n", " -moz-box-sizing: border-box;\n", " box-sizing: border-box;\n", " }\n", " .bk-root .noUi-target {\n", " position: relative;\n", " }\n", " .bk-root .noUi-base,\n", " .bk-root .noUi-connects {\n", " width: 100%;\n", " height: 100%;\n", " position: relative;\n", " z-index: 1;\n", " }\n", " .bk-root .noUi-connects {\n", " overflow: hidden;\n", " z-index: 0;\n", " }\n", " .bk-root .noUi-connect,\n", " .bk-root .noUi-origin {\n", " will-change: transform;\n", " position: absolute;\n", " z-index: 1;\n", " top: 0;\n", " right: 0;\n", " -ms-transform-origin: 0 0;\n", " -webkit-transform-origin: 0 0;\n", " -webkit-transform-style: preserve-3d;\n", " transform-origin: 0 0;\n", " transform-style: flat;\n", " }\n", " .bk-root .noUi-connect {\n", " height: 100%;\n", " width: 100%;\n", " }\n", " .bk-root .noUi-origin {\n", " height: 10%;\n", " width: 10%;\n", " }\n", " .bk-root .noUi-txt-dir-rtl.noUi-horizontal .noUi-origin {\n", " left: 0;\n", " right: auto;\n", " }\n", " .bk-root .noUi-vertical .noUi-origin {\n", " width: 0;\n", " }\n", " .bk-root .noUi-horizontal .noUi-origin {\n", " height: 0;\n", " }\n", " .bk-root .noUi-handle {\n", " -webkit-backface-visibility: hidden;\n", " backface-visibility: hidden;\n", " position: absolute;\n", " }\n", " .bk-root .noUi-touch-area {\n", " height: 100%;\n", " width: 100%;\n", " }\n", " .bk-root .noUi-state-tap .noUi-connect,\n", " .bk-root .noUi-state-tap .noUi-origin {\n", " -webkit-transition: transform 0.3s;\n", " transition: transform 0.3s;\n", " }\n", " .bk-root .noUi-state-drag * {\n", " cursor: inherit !important;\n", " }\n", " .bk-root .noUi-horizontal {\n", " height: 18px;\n", " }\n", " .bk-root .noUi-horizontal .noUi-handle {\n", " width: 34px;\n", " height: 28px;\n", " right: -17px;\n", " top: -6px;\n", " }\n", " .bk-root .noUi-vertical {\n", " width: 18px;\n", " }\n", " .bk-root .noUi-vertical .noUi-handle {\n", " width: 28px;\n", " height: 34px;\n", " right: -6px;\n", " top: -17px;\n", " }\n", " .bk-root .noUi-txt-dir-rtl.noUi-horizontal .noUi-handle {\n", " left: -17px;\n", " right: auto;\n", " }\n", " .bk-root .noUi-target {\n", " background: #FAFAFA;\n", " border-radius: 4px;\n", " border: 1px solid #D3D3D3;\n", " box-shadow: inset 0 1px 1px #F0F0F0, 0 3px 6px -5px #BBB;\n", " }\n", " .bk-root .noUi-connects {\n", " border-radius: 3px;\n", " }\n", " .bk-root .noUi-connect {\n", " background: #3FB8AF;\n", " }\n", " .bk-root .noUi-draggable {\n", " cursor: ew-resize;\n", " }\n", " .bk-root .noUi-vertical .noUi-draggable {\n", " cursor: ns-resize;\n", " }\n", " .bk-root .noUi-handle {\n", " border: 1px solid #D9D9D9;\n", " border-radius: 3px;\n", " background: #FFF;\n", " cursor: default;\n", " box-shadow: inset 0 0 1px #FFF, inset 0 1px 7px #EBEBEB, 0 3px 6px -3px #BBB;\n", " }\n", " .bk-root .noUi-active {\n", " box-shadow: inset 0 0 1px #FFF, inset 0 1px 7px #DDD, 0 3px 6px -3px #BBB;\n", " }\n", " .bk-root .noUi-handle:before,\n", " .bk-root .noUi-handle:after {\n", " content: \"\";\n", " display: block;\n", " position: absolute;\n", " height: 14px;\n", " width: 1px;\n", " background: #E8E7E6;\n", " left: 14px;\n", " top: 6px;\n", " }\n", " .bk-root .noUi-handle:after {\n", " left: 17px;\n", " }\n", " .bk-root .noUi-vertical .noUi-handle:before,\n", " .bk-root .noUi-vertical .noUi-handle:after {\n", " width: 14px;\n", " height: 1px;\n", " left: 6px;\n", " top: 14px;\n", " }\n", " .bk-root .noUi-vertical .noUi-handle:after {\n", " top: 17px;\n", " }\n", " .bk-root [disabled] .noUi-connect {\n", " background: #B8B8B8;\n", " }\n", " .bk-root [disabled].noUi-target,\n", " .bk-root [disabled].noUi-handle,\n", " .bk-root [disabled] .noUi-handle {\n", " cursor: not-allowed;\n", " }\n", " .bk-root .noUi-pips,\n", " .bk-root .noUi-pips * {\n", " -moz-box-sizing: border-box;\n", " box-sizing: border-box;\n", " }\n", " .bk-root .noUi-pips {\n", " position: absolute;\n", " color: #999;\n", " }\n", " .bk-root .noUi-value {\n", " position: absolute;\n", " white-space: nowrap;\n", " text-align: center;\n", " }\n", " .bk-root .noUi-value-sub {\n", " color: #ccc;\n", " font-size: 10px;\n", " }\n", " .bk-root .noUi-marker {\n", " position: absolute;\n", " background: #CCC;\n", " }\n", " .bk-root .noUi-marker-sub {\n", " background: #AAA;\n", " }\n", " .bk-root .noUi-marker-large {\n", " background: #AAA;\n", " }\n", " .bk-root .noUi-pips-horizontal {\n", " padding: 10px 0;\n", " height: 80px;\n", " top: 100%;\n", " left: 0;\n", " width: 100%;\n", " }\n", " .bk-root .noUi-value-horizontal {\n", " -webkit-transform: translate(-50%, 50%);\n", " transform: translate(-50%, 50%);\n", " }\n", " .bk-root .noUi-rtl .noUi-value-horizontal {\n", " -webkit-transform: translate(50%, 50%);\n", " transform: translate(50%, 50%);\n", " }\n", " .bk-root .noUi-marker-horizontal.noUi-marker {\n", " margin-left: -1px;\n", " width: 2px;\n", " height: 5px;\n", " }\n", " .bk-root .noUi-marker-horizontal.noUi-marker-sub {\n", " height: 10px;\n", " }\n", " .bk-root .noUi-marker-horizontal.noUi-marker-large {\n", " height: 15px;\n", " }\n", " .bk-root .noUi-pips-vertical {\n", " padding: 0 10px;\n", " height: 100%;\n", " top: 0;\n", " left: 100%;\n", " }\n", " .bk-root .noUi-value-vertical {\n", " -webkit-transform: translate(0, -50%);\n", " transform: translate(0, -50%);\n", " padding-left: 25px;\n", " }\n", " .bk-root .noUi-rtl .noUi-value-vertical {\n", " -webkit-transform: translate(0, 50%);\n", " transform: translate(0, 50%);\n", " }\n", " .bk-root .noUi-marker-vertical.noUi-marker {\n", " width: 5px;\n", " height: 2px;\n", " margin-top: -1px;\n", " }\n", " .bk-root .noUi-marker-vertical.noUi-marker-sub {\n", " width: 10px;\n", " }\n", " .bk-root .noUi-marker-vertical.noUi-marker-large {\n", " width: 15px;\n", " }\n", " .bk-root .noUi-tooltip {\n", " display: block;\n", " position: absolute;\n", " border: 1px solid #D9D9D9;\n", " border-radius: 3px;\n", " background: #fff;\n", " color: #000;\n", " padding: 5px;\n", " text-align: center;\n", " white-space: nowrap;\n", " }\n", " .bk-root .noUi-horizontal .noUi-tooltip {\n", " -webkit-transform: translate(-50%, 0);\n", " transform: translate(-50%, 0);\n", " left: 50%;\n", " bottom: 120%;\n", " }\n", " .bk-root .noUi-vertical .noUi-tooltip {\n", " -webkit-transform: translate(0, -50%);\n", " transform: translate(0, -50%);\n", " top: 50%;\n", " right: 120%;\n", " }\n", " .bk-root .noUi-horizontal .noUi-origin > .noUi-tooltip {\n", " -webkit-transform: translate(50%, 0);\n", " transform: translate(50%, 0);\n", " left: auto;\n", " bottom: 10px;\n", " }\n", " .bk-root .noUi-vertical .noUi-origin > .noUi-tooltip {\n", " -webkit-transform: translate(0, -18px);\n", " transform: translate(0, -18px);\n", " top: auto;\n", " right: 28px;\n", " }\n", " .bk-root .noUi-handle {\n", " cursor: grab;\n", " cursor: -webkit-grab;\n", " }\n", " .bk-root .noUi-handle.noUi-active {\n", " cursor: grabbing;\n", " cursor: -webkit-grabbing;\n", " }\n", " .bk-root .noUi-handle:after,\n", " .bk-root .noUi-handle:before {\n", " display: none;\n", " }\n", " .bk-root .noUi-tooltip {\n", " display: none;\n", " white-space: nowrap;\n", " }\n", " .bk-root .noUi-handle:hover .noUi-tooltip {\n", " display: block;\n", " }\n", " .bk-root .noUi-horizontal {\n", " width: 100%;\n", " height: 10px;\n", " }\n", " .bk-root .noUi-vertical {\n", " width: 10px;\n", " height: 100%;\n", " }\n", " .bk-root .noUi-horizontal .noUi-handle {\n", " width: 14px;\n", " height: 18px;\n", " right: -7px;\n", " top: -5px;\n", " }\n", " .bk-root .noUi-vertical .noUi-handle {\n", " width: 18px;\n", " height: 14px;\n", " right: -5px;\n", " top: -7px;\n", " }\n", " .bk-root .noUi-target.noUi-horizontal {\n", " margin: 5px 0px;\n", " }\n", " .bk-root .noUi-target.noUi-vertical {\n", " margin: 0px 5px;\n", " }\n", " `;\n", " exports.default = css;\n", " },\n", " 415: /* styles/widgets/sliders.css.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const css = `\n", " .bk-root .bk-slider-title {\n", " white-space: nowrap;\n", " }\n", " .bk-root .bk-slider-value {\n", " font-weight: 600;\n", " }\n", " `;\n", " exports.default = css;\n", " },\n", " 416: /* models/widgets/date_slider.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const timezone_1 = tslib_1.__importDefault(require(159) /* timezone */);\n", " const abstract_slider_1 = require(411) /* ./abstract_slider */;\n", " class DateSliderView extends abstract_slider_1.AbstractSliderView {\n", " }\n", " exports.DateSliderView = DateSliderView;\n", " DateSliderView.__name__ = \"DateSliderView\";\n", " class DateSlider extends abstract_slider_1.AbstractSlider {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.behaviour = \"tap\";\n", " this.connected = [true, false];\n", " }\n", " static init_DateSlider() {\n", " this.prototype.default_view = DateSliderView;\n", " this.override({\n", " format: \"%d %b %Y\",\n", " });\n", " }\n", " _formatter(value, format) {\n", " return timezone_1.default(value, format);\n", " }\n", " }\n", " exports.DateSlider = DateSlider;\n", " DateSlider.__name__ = \"DateSlider\";\n", " DateSlider.init_DateSlider();\n", " },\n", " 417: /* models/widgets/div.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const markup_1 = require(418) /* ./markup */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " class DivView extends markup_1.MarkupView {\n", " render() {\n", " super.render();\n", " if (this.model.render_as_text)\n", " this.markup_el.textContent = this.model.text;\n", " else\n", " this.markup_el.innerHTML = this.model.text;\n", " }\n", " }\n", " exports.DivView = DivView;\n", " DivView.__name__ = \"DivView\";\n", " class Div extends markup_1.Markup {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Div() {\n", " this.prototype.default_view = DivView;\n", " this.define({\n", " render_as_text: [p.Boolean, false],\n", " });\n", " }\n", " }\n", " exports.Div = Div;\n", " Div.__name__ = \"Div\";\n", " Div.init_Div();\n", " },\n", " 418: /* models/widgets/markup.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const html_1 = require(193) /* ../../core/layout/html */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const widget_1 = require(458) /* ./widget */;\n", " const clearfix_1 = require(419) /* ../../styles/clearfix */;\n", " const clearfix_css_1 = tslib_1.__importDefault(require(420) /* ../../styles/clearfix.css */);\n", " class MarkupView extends widget_1.WidgetView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.change, () => {\n", " this.layout.invalidate_cache();\n", " this.render();\n", " this.root.compute_layout(); // XXX: invalidate_layout?\n", " });\n", " }\n", " styles() {\n", " return [...super.styles(), clearfix_css_1.default];\n", " }\n", " _update_layout() {\n", " this.layout = new html_1.CachedVariadicBox(this.el);\n", " this.layout.set_sizing(this.box_sizing());\n", " }\n", " render() {\n", " super.render();\n", " const style = Object.assign(Object.assign({}, this.model.style), { display: \"inline-block\" });\n", " this.markup_el = dom_1.div({ class: clearfix_1.bk_clearfix, style });\n", " this.el.appendChild(this.markup_el);\n", " }\n", " }\n", " exports.MarkupView = MarkupView;\n", " MarkupView.__name__ = \"MarkupView\";\n", " class Markup extends widget_1.Widget {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Markup() {\n", " this.define({\n", " text: [p.String, ''],\n", " style: [p.Any, {}],\n", " });\n", " }\n", " }\n", " exports.Markup = Markup;\n", " Markup.__name__ = \"Markup\";\n", " Markup.init_Markup();\n", " },\n", " 419: /* styles/clearfix.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " exports.bk_clearfix = \"bk-clearfix\";\n", " },\n", " 420: /* styles/clearfix.css.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const css = `\n", " .bk-root .bk-clearfix:before,\n", " .bk-root .bk-clearfix:after {\n", " content: \"\";\n", " display: table;\n", " }\n", " .bk-root .bk-clearfix:after {\n", " clear: both;\n", " }\n", " `;\n", " exports.default = css;\n", " },\n", " 421: /* models/widgets/dropdown.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const abstract_button_1 = require(392) /* ./abstract_button */;\n", " const bokeh_events_1 = require(291) /* ../../core/bokeh_events */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const mixins_1 = require(146) /* ../../styles/mixins */;\n", " const buttons_1 = require(254) /* ../../styles/buttons */;\n", " const menus_1 = require(255) /* ../../styles/menus */;\n", " const menus_css_1 = tslib_1.__importDefault(require(257) /* ../../styles/menus.css */);\n", " class DropdownView extends abstract_button_1.AbstractButtonView {\n", " constructor() {\n", " super(...arguments);\n", " this._open = false;\n", " }\n", " styles() {\n", " return [...super.styles(), menus_css_1.default];\n", " }\n", " render() {\n", " super.render();\n", " const caret = dom_1.div({ class: [menus_1.bk_caret, mixins_1.bk_down] });\n", " if (!this.model.is_split)\n", " this.button_el.appendChild(caret);\n", " else {\n", " const toggle = this._render_button(caret);\n", " toggle.classList.add(buttons_1.bk_dropdown_toggle);\n", " toggle.addEventListener(\"click\", () => this._toggle_menu());\n", " this.group_el.appendChild(toggle);\n", " }\n", " const items = this.model.menu.map((item, i) => {\n", " if (item == null)\n", " return dom_1.div({ class: menus_1.bk_divider });\n", " else {\n", " const label = types_1.isString(item) ? item : item[0];\n", " const el = dom_1.div({}, label);\n", " el.addEventListener(\"click\", () => this._item_click(i));\n", " return el;\n", " }\n", " });\n", " this.menu = dom_1.div({ class: [menus_1.bk_menu, mixins_1.bk_below] }, items);\n", " this.el.appendChild(this.menu);\n", " dom_1.undisplay(this.menu);\n", " }\n", " _show_menu() {\n", " if (!this._open) {\n", " this._open = true;\n", " dom_1.display(this.menu);\n", " const listener = (event) => {\n", " const { target } = event;\n", " if (target instanceof HTMLElement && !this.el.contains(target)) {\n", " document.removeEventListener(\"click\", listener);\n", " this._hide_menu();\n", " }\n", " };\n", " document.addEventListener(\"click\", listener);\n", " }\n", " }\n", " _hide_menu() {\n", " if (this._open) {\n", " this._open = false;\n", " dom_1.undisplay(this.menu);\n", " }\n", " }\n", " _toggle_menu() {\n", " if (this._open)\n", " this._hide_menu();\n", " else\n", " this._show_menu();\n", " }\n", " click() {\n", " if (!this.model.is_split)\n", " this._toggle_menu();\n", " else {\n", " this._hide_menu();\n", " this.model.trigger_event(new bokeh_events_1.ButtonClick());\n", " super.click();\n", " }\n", " }\n", " _item_click(i) {\n", " this._hide_menu();\n", " const item = this.model.menu[i];\n", " if (item != null) {\n", " const value_or_callback = types_1.isString(item) ? item : item[1];\n", " if (types_1.isString(value_or_callback)) {\n", " this.model.trigger_event(new bokeh_events_1.MenuItemClick(value_or_callback));\n", " }\n", " else {\n", " value_or_callback.execute(this.model, { index: i }); // TODO\n", " }\n", " }\n", " }\n", " }\n", " exports.DropdownView = DropdownView;\n", " DropdownView.__name__ = \"DropdownView\";\n", " class Dropdown extends abstract_button_1.AbstractButton {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Dropdown() {\n", " this.prototype.default_view = DropdownView;\n", " this.define({\n", " split: [p.Boolean, false],\n", " menu: [p.Array, []],\n", " });\n", " this.override({\n", " label: \"Dropdown\",\n", " });\n", " }\n", " get is_split() {\n", " return this.split;\n", " }\n", " }\n", " exports.Dropdown = Dropdown;\n", " Dropdown.__name__ = \"Dropdown\";\n", " Dropdown.init_Dropdown();\n", " },\n", " 422: /* models/widgets/file_input.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const widget_1 = require(458) /* ./widget */;\n", " class FileInputView extends widget_1.WidgetView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.change, () => this.render());\n", " this.connect(this.model.properties.width.change, () => this.render());\n", " }\n", " render() {\n", " if (this.dialogEl == null) {\n", " this.dialogEl = document.createElement('input');\n", " this.dialogEl.type = \"file\";\n", " this.dialogEl.multiple = this.model.multiple;\n", " this.dialogEl.onchange = () => {\n", " const { files } = this.dialogEl;\n", " if (files != null) {\n", " this.load_files(files);\n", " }\n", " };\n", " this.el.appendChild(this.dialogEl);\n", " }\n", " if (this.model.accept != null && this.model.accept != '')\n", " this.dialogEl.accept = this.model.accept;\n", " this.dialogEl.style.width = `{this.model.width}px`;\n", " this.dialogEl.disabled = this.model.disabled;\n", " }\n", " async load_files(files) {\n", " const value = [];\n", " const filename = [];\n", " const mime_type = [];\n", " let i;\n", " for (i = 0; i < files.length; i++) {\n", " filename.push(files[i].name);\n", " const data_url = await this.readfile(files[i]);\n", " const [, mime, , data] = data_url.split(/[:;,]/, 4);\n", " value.push(data);\n", " mime_type.push(mime);\n", " }\n", " if (this.model.multiple) {\n", " this.model.filename = filename;\n", " this.model.mime_type = mime_type;\n", " this.model.value = value;\n", " }\n", " else {\n", " this.model.filename = filename[0];\n", " this.model.mime_type = mime_type[0];\n", " this.model.value = value[0];\n", " }\n", " }\n", " readfile(file) {\n", " return new Promise((resolve, reject) => {\n", " const reader = new FileReader();\n", " reader.onload = () => {\n", " var _a;\n", " const { result } = reader;\n", " if (result != null) {\n", " resolve(result);\n", " }\n", " else {\n", " reject((_a = reader.error) !== null && _a !== void 0 ? _a : new Error(`unable to read '${file.name}'`));\n", " }\n", " };\n", " reader.readAsDataURL(file);\n", " });\n", " }\n", " }\n", " exports.FileInputView = FileInputView;\n", " FileInputView.__name__ = \"FileInputView\";\n", " class FileInput extends widget_1.Widget {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_FileInput() {\n", " this.prototype.default_view = FileInputView;\n", " this.define({\n", " value: [p.Any, ''],\n", " mime_type: [p.Any, ''],\n", " filename: [p.Any, ''],\n", " accept: [p.String, ''],\n", " multiple: [p.Boolean, false],\n", " });\n", " }\n", " }\n", " exports.FileInput = FileInput;\n", " FileInput.__name__ = \"FileInput\";\n", " FileInput.init_FileInput();\n", " },\n", " 423: /* models/widgets/multiselect.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const input_widget_1 = require(398) /* ./input_widget */;\n", " const inputs_1 = require(400) /* ../../styles/widgets/inputs */;\n", " class MultiSelectView extends input_widget_1.InputWidgetView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.value.change, () => this.render_selection());\n", " this.connect(this.model.properties.options.change, () => this.render());\n", " this.connect(this.model.properties.name.change, () => this.render());\n", " this.connect(this.model.properties.title.change, () => this.render());\n", " this.connect(this.model.properties.size.change, () => this.render());\n", " this.connect(this.model.properties.disabled.change, () => this.render());\n", " }\n", " render() {\n", " super.render();\n", " const options = this.model.options.map((opt) => {\n", " let value, _label;\n", " if (types_1.isString(opt))\n", " value = _label = opt;\n", " else\n", " [value, _label] = opt;\n", " return dom_1.option({ value }, _label);\n", " });\n", " this.select_el = dom_1.select({\n", " multiple: true,\n", " class: inputs_1.bk_input,\n", " name: this.model.name,\n", " disabled: this.model.disabled,\n", " }, options);\n", " this.select_el.addEventListener(\"change\", () => this.change_input());\n", " this.group_el.appendChild(this.select_el);\n", " this.render_selection();\n", " }\n", " render_selection() {\n", " const selected = new Set(this.model.value);\n", " for (const el of this.el.querySelectorAll('option'))\n", " el.selected = selected.has(el.value);\n", " // Note that some browser implementations might not reduce\n", " // the number of visible options for size <= 3.\n", " this.select_el.size = this.model.size;\n", " }\n", " change_input() {\n", " const is_focused = this.el.querySelector('select:focus') != null;\n", " const values = [];\n", " for (const el of this.el.querySelectorAll('option')) {\n", " if (el.selected)\n", " values.push(el.value);\n", " }\n", " this.model.value = values;\n", " super.change_input();\n", " // Restore focus back to the and one can seamlessly scroll\n", " // up/down.\n", " if (is_focused)\n", " this.select_el.focus();\n", " }\n", " }\n", " exports.MultiSelectView = MultiSelectView;\n", " MultiSelectView.__name__ = \"MultiSelectView\";\n", " class MultiSelect extends input_widget_1.InputWidget {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_MultiSelect() {\n", " this.prototype.default_view = MultiSelectView;\n", " this.define({\n", " value: [p.Array, []],\n", " options: [p.Array, []],\n", " size: [p.Number, 4],\n", " });\n", " }\n", " }\n", " exports.MultiSelect = MultiSelect;\n", " MultiSelect.__name__ = \"MultiSelect\";\n", " MultiSelect.init_MultiSelect();\n", " },\n", " 424: /* models/widgets/paragraph.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const markup_1 = require(418) /* ./markup */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " class ParagraphView extends markup_1.MarkupView {\n", " render() {\n", " super.render();\n", " // This overrides default user-agent styling and helps layout work\n", " const content = dom_1.p({ style: { margin: 0 } }, this.model.text);\n", " this.markup_el.appendChild(content);\n", " }\n", " }\n", " exports.ParagraphView = ParagraphView;\n", " ParagraphView.__name__ = \"ParagraphView\";\n", " class Paragraph extends markup_1.Markup {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Paragraph() {\n", " this.prototype.default_view = ParagraphView;\n", " }\n", " }\n", " exports.Paragraph = Paragraph;\n", " Paragraph.__name__ = \"Paragraph\";\n", " Paragraph.init_Paragraph();\n", " },\n", " 425: /* models/widgets/password_input.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const text_input_1 = require(397) /* ./text_input */;\n", " class PasswordInputView extends text_input_1.TextInputView {\n", " render() {\n", " super.render();\n", " this.input_el.type = \"password\";\n", " }\n", " }\n", " exports.PasswordInputView = PasswordInputView;\n", " PasswordInputView.__name__ = \"PasswordInputView\";\n", " class PasswordInput extends text_input_1.TextInput {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_PasswordInput() {\n", " this.prototype.default_view = PasswordInputView;\n", " }\n", " }\n", " exports.PasswordInput = PasswordInput;\n", " PasswordInput.__name__ = \"PasswordInput\";\n", " PasswordInput.init_PasswordInput();\n", " },\n", " 426: /* models/widgets/multichoice.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const choices_js_1 = tslib_1.__importDefault(require(427) /* choices.js */);\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const inputs_1 = require(400) /* ../../styles/widgets/inputs */;\n", " const choices_css_1 = tslib_1.__importDefault(require(428) /* ../../styles/widgets/choices.css */);\n", " const input_widget_1 = require(398) /* ./input_widget */;\n", " class MultiChoiceView extends input_widget_1.InputWidgetView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.value.change, () => this.render_selection());\n", " this.connect(this.model.properties.disabled.change, () => this.set_disabled());\n", " this.connect(this.model.properties.max_items.change, () => this.render());\n", " this.connect(this.model.properties.option_limit.change, () => this.render());\n", " this.connect(this.model.properties.delete_button.change, () => this.render());\n", " this.connect(this.model.properties.placeholder.change, () => this.render());\n", " this.connect(this.model.properties.options.change, () => this.render());\n", " this.connect(this.model.properties.name.change, () => this.render());\n", " this.connect(this.model.properties.title.change, () => this.render());\n", " }\n", " styles() {\n", " return [...super.styles(), choices_css_1.default];\n", " }\n", " render() {\n", " super.render();\n", " const options = this.model.options.map((opt) => {\n", " let value, _label;\n", " if (types_1.isString(opt))\n", " value = _label = opt;\n", " else\n", " [value, _label] = opt;\n", " return dom_1.option({ value }, _label);\n", " });\n", " this.select_el = dom_1.select({\n", " multiple: true,\n", " class: inputs_1.bk_input,\n", " name: this.model.name,\n", " disabled: this.model.disabled,\n", " }, options);\n", " this.group_el.appendChild(this.select_el);\n", " this.render_selection();\n", " let item = \"choices__item\";\n", " let button = \"choices__button\";\n", " if (this.model.solid) {\n", " item = item + \" solid\";\n", " button = button + \" solid\";\n", " }\n", " else {\n", " item = item + \" light\";\n", " button = button + \" light\";\n", " }\n", " const opts = {\n", " removeItemButton: this.model.delete_button,\n", " classNames: { item, button },\n", " };\n", " if (this.model.placeholder !== null)\n", " opts.placeholderValue = this.model.placeholder;\n", " if (this.model.max_items !== null)\n", " opts.maxItemCount = this.model.max_items;\n", " if (this.model.option_limit !== null)\n", " opts.renderChoiceLimit = this.model.option_limit;\n", " this.choice_el = new choices_js_1.default(this.select_el, opts);\n", " this.select_el.addEventListener(\"change\", () => this.change_input());\n", " }\n", " render_selection() {\n", " const selected = new Set(this.model.value);\n", " for (const el of Array.from(this.el.querySelectorAll('option')))\n", " el.selected = selected.has(el.value);\n", " }\n", " set_disabled() {\n", " if (this.model.disabled)\n", " this.choice_el.disable();\n", " else\n", " this.choice_el.enable();\n", " }\n", " change_input() {\n", " const is_focused = this.el.querySelector('select:focus') != null;\n", " const values = [];\n", " for (const el of Array.from(this.el.querySelectorAll('option'))) {\n", " if (el.selected)\n", " values.push(el.value);\n", " }\n", " this.model.value = values;\n", " super.change_input();\n", " // Restore focus back to the and one can seamlessly scroll\n", " // up/down.\n", " if (is_focused)\n", " this.select_el.focus();\n", " }\n", " }\n", " exports.MultiChoiceView = MultiChoiceView;\n", " MultiChoiceView.__name__ = \"MultiChoiceView\";\n", " class MultiChoice extends input_widget_1.InputWidget {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_MultiChoice() {\n", " this.prototype.default_view = MultiChoiceView;\n", " this.define({\n", " value: [p.Array, []],\n", " options: [p.Array, []],\n", " max_items: [p.Number, null],\n", " delete_button: [p.Boolean, true],\n", " placeholder: [p.String, null],\n", " option_limit: [p.Number, null],\n", " solid: [p.Boolean, true],\n", " });\n", " }\n", " }\n", " exports.MultiChoice = MultiChoice;\n", " MultiChoice.__name__ = \"MultiChoice\";\n", " MultiChoice.init_MultiChoice();\n", " },\n", " 427: /* choices.js/public/assets/scripts/choices.js */ function _(require, module, exports) {\n", " /*! choices.js v9.0.1 | © 2019 Josh Johnson | https://github.com/jshjohnson/Choices#readme */\n", " (function webpackUniversalModuleDefinition(root, factory) {\n", " if (typeof exports === 'object' && typeof module === 'object')\n", " module.exports = factory();\n", " else if (typeof define === 'function' && define.amd)\n", " define([], factory);\n", " else if (typeof exports === 'object')\n", " exports[\"Choices\"] = factory();\n", " else\n", " root[\"Choices\"] = factory();\n", " })(window, function () {\n", " return /******/ (function (modules) {\n", " /******/ // The module cache\n", " /******/ var installedModules = {};\n", " /******/\n", " /******/ // The require function\n", " /******/ function __webpack_require__(moduleId) {\n", " /******/\n", " /******/ // Check if module is in cache\n", " /******/ if (installedModules[moduleId]) {\n", " /******/ return installedModules[moduleId].exports;\n", " /******/ }\n", " /******/ // Create a new module (and put it into the cache)\n", " /******/ var module = installedModules[moduleId] = {\n", " /******/ i: moduleId,\n", " /******/ l: false,\n", " /******/ exports: {}\n", " /******/ \n", " };\n", " /******/\n", " /******/ // Execute the module function\n", " /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n", " /******/\n", " /******/ // Flag the module as loaded\n", " /******/ module.l = true;\n", " /******/\n", " /******/ // Return the exports of the module\n", " /******/ return module.exports;\n", " /******/ \n", " }\n", " /******/\n", " /******/\n", " /******/ // expose the modules object (__webpack_modules__)\n", " /******/ __webpack_require__.m = modules;\n", " /******/\n", " /******/ // expose the module cache\n", " /******/ __webpack_require__.c = installedModules;\n", " /******/\n", " /******/ // define getter function for harmony exports\n", " /******/ __webpack_require__.d = function (exports, name, getter) {\n", " /******/ if (!__webpack_require__.o(exports, name)) {\n", " /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });\n", " /******/ }\n", " /******/ \n", " };\n", " /******/\n", " /******/ // define __esModule on exports\n", " /******/ __webpack_require__.r = function (exports) {\n", " /******/ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n", " /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n", " /******/ }\n", " /******/ Object.defineProperty(exports, '__esModule', { value: true });\n", " /******/ \n", " };\n", " /******/\n", " /******/ // create a fake namespace object\n", " /******/ // mode & 1: value is a module id, require it\n", " /******/ // mode & 2: merge all properties of value into the ns\n", " /******/ // mode & 4: return value when already ns object\n", " /******/ // mode & 8|1: behave like require\n", " /******/ __webpack_require__.t = function (value, mode) {\n", " /******/ if (mode & 1)\n", " value = __webpack_require__(value);\n", " /******/ if (mode & 8)\n", " return value;\n", " /******/ if ((mode & 4) && typeof value === 'object' && value && value.__esModule)\n", " return value;\n", " /******/ var ns = Object.create(null);\n", " /******/ __webpack_require__.r(ns);\n", " /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });\n", " /******/ if (mode & 2 && typeof value != 'string')\n", " for (var key in value)\n", " __webpack_require__.d(ns, key, function (key) { return value[key]; }.bind(null, key));\n", " /******/ return ns;\n", " /******/ \n", " };\n", " /******/\n", " /******/ // getDefaultExport function for compatibility with non-harmony modules\n", " /******/ __webpack_require__.n = function (module) {\n", " /******/ var getter = module && module.__esModule ?\n", " /******/ function getDefault() { return module['default']; } :\n", " /******/ function getModuleExports() { return module; };\n", " /******/ __webpack_require__.d(getter, 'a', getter);\n", " /******/ return getter;\n", " /******/ \n", " };\n", " /******/\n", " /******/ // Object.prototype.hasOwnProperty.call\n", " /******/ __webpack_require__.o = function (object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n", " /******/\n", " /******/ // __webpack_public_path__\n", " /******/ __webpack_require__.p = \"/public/assets/scripts/\";\n", " /******/\n", " /******/\n", " /******/ // Load entry module and return exports\n", " /******/ return __webpack_require__(__webpack_require__.s = 4);\n", " /******/ \n", " })([\n", " /* 0 */\n", " /***/ (function (module, exports, __webpack_require__) {\n", " \"use strict\";\n", " var isMergeableObject = function isMergeableObject(value) {\n", " return isNonNullObject(value)\n", " && !isSpecial(value);\n", " };\n", " function isNonNullObject(value) {\n", " return !!value && typeof value === 'object';\n", " }\n", " function isSpecial(value) {\n", " var stringValue = Object.prototype.toString.call(value);\n", " return stringValue === '[object RegExp]'\n", " || stringValue === '[object Date]'\n", " || isReactElement(value);\n", " }\n", " // see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25\n", " var canUseSymbol = typeof Symbol === 'function' && Symbol.for;\n", " var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;\n", " function isReactElement(value) {\n", " return value.$$typeof === REACT_ELEMENT_TYPE;\n", " }\n", " function emptyTarget(val) {\n", " return Array.isArray(val) ? [] : {};\n", " }\n", " function cloneUnlessOtherwiseSpecified(value, options) {\n", " return (options.clone !== false && options.isMergeableObject(value))\n", " ? deepmerge(emptyTarget(value), value, options)\n", " : value;\n", " }\n", " function defaultArrayMerge(target, source, options) {\n", " return target.concat(source).map(function (element) {\n", " return cloneUnlessOtherwiseSpecified(element, options);\n", " });\n", " }\n", " function getMergeFunction(key, options) {\n", " if (!options.customMerge) {\n", " return deepmerge;\n", " }\n", " var customMerge = options.customMerge(key);\n", " return typeof customMerge === 'function' ? customMerge : deepmerge;\n", " }\n", " function getEnumerableOwnPropertySymbols(target) {\n", " return Object.getOwnPropertySymbols\n", " ? Object.getOwnPropertySymbols(target).filter(function (symbol) {\n", " return target.propertyIsEnumerable(symbol);\n", " })\n", " : [];\n", " }\n", " function getKeys(target) {\n", " return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));\n", " }\n", " // Protects from prototype poisoning and unexpected merging up the prototype chain.\n", " function propertyIsUnsafe(target, key) {\n", " try {\n", " return (key in target) // Properties are safe to merge if they don't exist in the target yet,\n", " && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,\n", " && Object.propertyIsEnumerable.call(target, key)); // and also unsafe if they're nonenumerable.\n", " }\n", " catch (unused) {\n", " // Counterintuitively, it's safe to merge any property on a target that causes the `in` operator to throw.\n", " // This happens when trying to copy an object in the source over a plain string in the target.\n", " return false;\n", " }\n", " }\n", " function mergeObject(target, source, options) {\n", " var destination = {};\n", " if (options.isMergeableObject(target)) {\n", " getKeys(target).forEach(function (key) {\n", " destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);\n", " });\n", " }\n", " getKeys(source).forEach(function (key) {\n", " if (propertyIsUnsafe(target, key)) {\n", " return;\n", " }\n", " if (!options.isMergeableObject(source[key]) || !target[key]) {\n", " destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);\n", " }\n", " else {\n", " destination[key] = getMergeFunction(key, options)(target[key], source[key], options);\n", " }\n", " });\n", " return destination;\n", " }\n", " function deepmerge(target, source, options) {\n", " options = options || {};\n", " options.arrayMerge = options.arrayMerge || defaultArrayMerge;\n", " options.isMergeableObject = options.isMergeableObject || isMergeableObject;\n", " // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()\n", " // implementations can use it. The caller may not replace it.\n", " options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;\n", " var sourceIsArray = Array.isArray(source);\n", " var targetIsArray = Array.isArray(target);\n", " var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;\n", " if (!sourceAndTargetTypesMatch) {\n", " return cloneUnlessOtherwiseSpecified(source, options);\n", " }\n", " else if (sourceIsArray) {\n", " return options.arrayMerge(target, source, options);\n", " }\n", " else {\n", " return mergeObject(target, source, options);\n", " }\n", " }\n", " deepmerge.all = function deepmergeAll(array, options) {\n", " if (!Array.isArray(array)) {\n", " throw new Error('first argument should be an array');\n", " }\n", " return array.reduce(function (prev, next) {\n", " return deepmerge(prev, next, options);\n", " }, {});\n", " };\n", " var deepmerge_1 = deepmerge;\n", " module.exports = deepmerge_1;\n", " /***/ \n", " }),\n", " /* 1 */\n", " /***/ (function (module, __webpack_exports__, __webpack_require__) {\n", " \"use strict\";\n", " /* WEBPACK VAR INJECTION */ (function (global, module) {\n", " var _ponyfill_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3);\n", " /* global window */\n", " var root;\n", " if (typeof self !== 'undefined') {\n", " root = self;\n", " }\n", " else if (typeof window !== 'undefined') {\n", " root = window;\n", " }\n", " else if (typeof global !== 'undefined') {\n", " root = global;\n", " }\n", " else if (true) {\n", " root = module;\n", " }\n", " else { }\n", " var result = Object(_ponyfill_js__WEBPACK_IMPORTED_MODULE_0__[ /* default */\"a\"])(root);\n", " /* harmony default export */ __webpack_exports__[\"a\"] = (result);\n", " /* WEBPACK VAR INJECTION */ \n", " }.call(this, __webpack_require__(5), __webpack_require__(6)(module)));\n", " /***/ \n", " }),\n", " /* 2 */\n", " /***/ (function (module, exports, __webpack_require__) {\n", " /*!\n", " * Fuse.js v3.4.5 - Lightweight fuzzy-search (http://fusejs.io)\n", " *\n", " * Copyright (c) 2012-2017 Kirollos Risk (http://kiro.me)\n", " * All Rights Reserved. Apache Software License 2.0\n", " *\n", " * http://www.apache.org/licenses/LICENSE-2.0\n", " */\n", " !function (e, t) { true ? module.exports = t() : undefined; }(this, function () { return function (e) { var t = {}; function n(r) { if (t[r])\n", " return t[r].exports; var o = t[r] = { i: r, l: !1, exports: {} }; return e[r].call(o.exports, o, o.exports, n), o.l = !0, o.exports; } return n.m = e, n.c = t, n.d = function (e, t, r) { n.o(e, t) || Object.defineProperty(e, t, { enumerable: !0, get: r }); }, n.r = function (e) { \"undefined\" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { value: \"Module\" }), Object.defineProperty(e, \"__esModule\", { value: !0 }); }, n.t = function (e, t) { if (1 & t && (e = n(e)), 8 & t)\n", " return e; if (4 & t && \"object\" == typeof e && e && e.__esModule)\n", " return e; var r = Object.create(null); if (n.r(r), Object.defineProperty(r, \"default\", { enumerable: !0, value: e }), 2 & t && \"string\" != typeof e)\n", " for (var o in e)\n", " n.d(r, o, function (t) { return e[t]; }.bind(null, o)); return r; }, n.n = function (e) { var t = e && e.__esModule ? function () { return e.default; } : function () { return e; }; return n.d(t, \"a\", t), t; }, n.o = function (e, t) { return Object.prototype.hasOwnProperty.call(e, t); }, n.p = \"\", n(n.s = 1); }([function (e, t) { e.exports = function (e) { return Array.isArray ? Array.isArray(e) : \"[object Array]\" === Object.prototype.toString.call(e); }; }, function (e, t, n) { function r(e) { return (r = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (e) { return typeof e; } : function (e) { return e && \"function\" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? \"symbol\" : typeof e; })(e); } function o(e, t) { for (var n = 0; n < t.length; n++) {\n", " var r = t[n];\n", " r.enumerable = r.enumerable || !1, r.configurable = !0, \"value\" in r && (r.writable = !0), Object.defineProperty(e, r.key, r);\n", " } } var i = n(2), a = n(8), s = n(0), c = function () { function e(t, n) { var r = n.location, o = void 0 === r ? 0 : r, i = n.distance, s = void 0 === i ? 100 : i, c = n.threshold, h = void 0 === c ? .6 : c, l = n.maxPatternLength, u = void 0 === l ? 32 : l, f = n.caseSensitive, d = void 0 !== f && f, v = n.tokenSeparator, p = void 0 === v ? / +/g : v, g = n.findAllMatches, y = void 0 !== g && g, m = n.minMatchCharLength, k = void 0 === m ? 1 : m, S = n.id, x = void 0 === S ? null : S, b = n.keys, M = void 0 === b ? [] : b, _ = n.shouldSort, L = void 0 === _ || _, w = n.getFn, A = void 0 === w ? a : w, C = n.sortFn, I = void 0 === C ? function (e, t) { return e.score - t.score; } : C, O = n.tokenize, j = void 0 !== O && O, P = n.matchAllTokens, F = void 0 !== P && P, T = n.includeMatches, z = void 0 !== T && T, E = n.includeScore, K = void 0 !== E && E, $ = n.verbose, J = void 0 !== $ && $; !function (e, t) { if (!(e instanceof t))\n", " throw new TypeError(\"Cannot call a class as a function\"); }(this, e), this.options = { location: o, distance: s, threshold: h, maxPatternLength: u, isCaseSensitive: d, tokenSeparator: p, findAllMatches: y, minMatchCharLength: k, id: x, keys: M, includeMatches: z, includeScore: K, shouldSort: L, getFn: A, sortFn: I, verbose: J, tokenize: j, matchAllTokens: F }, this.setCollection(t); } var t, n, c; return t = e, (n = [{ key: \"setCollection\", value: function (e) { return this.list = e, e; } }, { key: \"search\", value: function (e) { var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : { limit: !1 }; this._log('---------\\nSearch pattern: \"'.concat(e, '\"')); var n = this._prepareSearchers(e), r = n.tokenSearchers, o = n.fullSearcher, i = this._search(r, o), a = i.weights, s = i.results; return this._computeScore(a, s), this.options.shouldSort && this._sort(s), t.limit && \"number\" == typeof t.limit && (s = s.slice(0, t.limit)), this._format(s); } }, { key: \"_prepareSearchers\", value: function () { var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : \"\", t = []; if (this.options.tokenize)\n", " for (var n = e.split(this.options.tokenSeparator), r = 0, o = n.length; r < o; r += 1)\n", " t.push(new i(n[r], this.options)); return { tokenSearchers: t, fullSearcher: new i(e, this.options) }; } }, { key: \"_search\", value: function () { var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [], t = arguments.length > 1 ? arguments[1] : void 0, n = this.list, r = {}, o = []; if (\"string\" == typeof n[0]) {\n", " for (var i = 0, a = n.length; i < a; i += 1)\n", " this._analyze({ key: \"\", value: n[i], record: i, index: i }, { resultMap: r, results: o, tokenSearchers: e, fullSearcher: t });\n", " return { weights: null, results: o };\n", " } for (var s = {}, c = 0, h = n.length; c < h; c += 1)\n", " for (var l = n[c], u = 0, f = this.options.keys.length; u < f; u += 1) {\n", " var d = this.options.keys[u];\n", " if (\"string\" != typeof d) {\n", " if (s[d.name] = { weight: 1 - d.weight || 1 }, d.weight <= 0 || d.weight > 1)\n", " throw new Error(\"Key weight has to be > 0 and <= 1\");\n", " d = d.name;\n", " }\n", " else\n", " s[d] = { weight: 1 };\n", " this._analyze({ key: d, value: this.options.getFn(l, d), record: l, index: c }, { resultMap: r, results: o, tokenSearchers: e, fullSearcher: t });\n", " } return { weights: s, results: o }; } }, { key: \"_analyze\", value: function (e, t) { var n = e.key, r = e.arrayIndex, o = void 0 === r ? -1 : r, i = e.value, a = e.record, c = e.index, h = t.tokenSearchers, l = void 0 === h ? [] : h, u = t.fullSearcher, f = void 0 === u ? [] : u, d = t.resultMap, v = void 0 === d ? {} : d, p = t.results, g = void 0 === p ? [] : p; if (null != i) {\n", " var y = !1, m = -1, k = 0;\n", " if (\"string\" == typeof i) {\n", " this._log(\"\\nKey: \".concat(\"\" === n ? \"-\" : n));\n", " var S = f.search(i);\n", " if (this._log('Full text: \"'.concat(i, '\", score: ').concat(S.score)), this.options.tokenize) {\n", " for (var x = i.split(this.options.tokenSeparator), b = [], M = 0; M < l.length; M += 1) {\n", " var _ = l[M];\n", " this._log('\\nPattern: \"'.concat(_.pattern, '\"'));\n", " for (var L = !1, w = 0; w < x.length; w += 1) {\n", " var A = x[w], C = _.search(A), I = {};\n", " C.isMatch ? (I[A] = C.score, y = !0, L = !0, b.push(C.score)) : (I[A] = 1, this.options.matchAllTokens || b.push(1)), this._log('Token: \"'.concat(A, '\", score: ').concat(I[A]));\n", " }\n", " L && (k += 1);\n", " }\n", " m = b[0];\n", " for (var O = b.length, j = 1; j < O; j += 1)\n", " m += b[j];\n", " m /= O, this._log(\"Token score average:\", m);\n", " }\n", " var P = S.score;\n", " m > -1 && (P = (P + m) / 2), this._log(\"Score average:\", P);\n", " var F = !this.options.tokenize || !this.options.matchAllTokens || k >= l.length;\n", " if (this._log(\"\\nCheck Matches: \".concat(F)), (y || S.isMatch) && F) {\n", " var T = v[c];\n", " T ? T.output.push({ key: n, arrayIndex: o, value: i, score: P, matchedIndices: S.matchedIndices }) : (v[c] = { item: a, output: [{ key: n, arrayIndex: o, value: i, score: P, matchedIndices: S.matchedIndices }] }, g.push(v[c]));\n", " }\n", " }\n", " else if (s(i))\n", " for (var z = 0, E = i.length; z < E; z += 1)\n", " this._analyze({ key: n, arrayIndex: z, value: i[z], record: a, index: c }, { resultMap: v, results: g, tokenSearchers: l, fullSearcher: f });\n", " } } }, { key: \"_computeScore\", value: function (e, t) { this._log(\"\\n\\nComputing score:\\n\"); for (var n = 0, r = t.length; n < r; n += 1) {\n", " for (var o = t[n].output, i = o.length, a = 1, s = 1, c = 0; c < i; c += 1) {\n", " var h = e ? e[o[c].key].weight : 1, l = (1 === h ? o[c].score : o[c].score || .001) * h;\n", " 1 !== h ? s = Math.min(s, l) : (o[c].nScore = l, a *= l);\n", " }\n", " t[n].score = 1 === s ? a : s, this._log(t[n]);\n", " } } }, { key: \"_sort\", value: function (e) { this._log(\"\\n\\nSorting....\"), e.sort(this.options.sortFn); } }, { key: \"_format\", value: function (e) { var t = []; if (this.options.verbose) {\n", " var n = [];\n", " this._log(\"\\n\\nOutput:\\n\\n\", JSON.stringify(e, function (e, t) { if (\"object\" === r(t) && null !== t) {\n", " if (-1 !== n.indexOf(t))\n", " return;\n", " n.push(t);\n", " } return t; })), n = null;\n", " } var o = []; this.options.includeMatches && o.push(function (e, t) { var n = e.output; t.matches = []; for (var r = 0, o = n.length; r < o; r += 1) {\n", " var i = n[r];\n", " if (0 !== i.matchedIndices.length) {\n", " var a = { indices: i.matchedIndices, value: i.value };\n", " i.key && (a.key = i.key), i.hasOwnProperty(\"arrayIndex\") && i.arrayIndex > -1 && (a.arrayIndex = i.arrayIndex), t.matches.push(a);\n", " }\n", " } }), this.options.includeScore && o.push(function (e, t) { t.score = e.score; }); for (var i = 0, a = e.length; i < a; i += 1) {\n", " var s = e[i];\n", " if (this.options.id && (s.item = this.options.getFn(s.item, this.options.id)[0]), o.length) {\n", " for (var c = { item: s.item }, h = 0, l = o.length; h < l; h += 1)\n", " o[h](s, c);\n", " t.push(c);\n", " }\n", " else\n", " t.push(s.item);\n", " } return t; } }, { key: \"_log\", value: function () { var e; this.options.verbose && (e = console).log.apply(e, arguments); } }]) && o(t.prototype, n), c && o(t, c), e; }(); e.exports = c; }, function (e, t, n) { function r(e, t) { for (var n = 0; n < t.length; n++) {\n", " var r = t[n];\n", " r.enumerable = r.enumerable || !1, r.configurable = !0, \"value\" in r && (r.writable = !0), Object.defineProperty(e, r.key, r);\n", " } } var o = n(3), i = n(4), a = n(7), s = function () { function e(t, n) { var r = n.location, o = void 0 === r ? 0 : r, i = n.distance, s = void 0 === i ? 100 : i, c = n.threshold, h = void 0 === c ? .6 : c, l = n.maxPatternLength, u = void 0 === l ? 32 : l, f = n.isCaseSensitive, d = void 0 !== f && f, v = n.tokenSeparator, p = void 0 === v ? / +/g : v, g = n.findAllMatches, y = void 0 !== g && g, m = n.minMatchCharLength, k = void 0 === m ? 1 : m; !function (e, t) { if (!(e instanceof t))\n", " throw new TypeError(\"Cannot call a class as a function\"); }(this, e), this.options = { location: o, distance: s, threshold: h, maxPatternLength: u, isCaseSensitive: d, tokenSeparator: p, findAllMatches: y, minMatchCharLength: k }, this.pattern = this.options.isCaseSensitive ? t : t.toLowerCase(), this.pattern.length <= u && (this.patternAlphabet = a(this.pattern)); } var t, n, s; return t = e, (n = [{ key: \"search\", value: function (e) { if (this.options.isCaseSensitive || (e = e.toLowerCase()), this.pattern === e)\n", " return { isMatch: !0, score: 0, matchedIndices: [[0, e.length - 1]] }; var t = this.options, n = t.maxPatternLength, r = t.tokenSeparator; if (this.pattern.length > n)\n", " return o(e, this.pattern, r); var a = this.options, s = a.location, c = a.distance, h = a.threshold, l = a.findAllMatches, u = a.minMatchCharLength; return i(e, this.pattern, this.patternAlphabet, { location: s, distance: c, threshold: h, findAllMatches: l, minMatchCharLength: u }); } }]) && r(t.prototype, n), s && r(t, s), e; }(); e.exports = s; }, function (e, t) { var n = /[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g; e.exports = function (e, t) { var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : / +/g, o = new RegExp(t.replace(n, \"\\\\$&\").replace(r, \"|\")), i = e.match(o), a = !!i, s = []; if (a)\n", " for (var c = 0, h = i.length; c < h; c += 1) {\n", " var l = i[c];\n", " s.push([e.indexOf(l), l.length - 1]);\n", " } return { score: a ? .5 : 1, isMatch: a, matchedIndices: s }; }; }, function (e, t, n) { var r = n(5), o = n(6); e.exports = function (e, t, n, i) { for (var a = i.location, s = void 0 === a ? 0 : a, c = i.distance, h = void 0 === c ? 100 : c, l = i.threshold, u = void 0 === l ? .6 : l, f = i.findAllMatches, d = void 0 !== f && f, v = i.minMatchCharLength, p = void 0 === v ? 1 : v, g = s, y = e.length, m = u, k = e.indexOf(t, g), S = t.length, x = [], b = 0; b < y; b += 1)\n", " x[b] = 0; if (-1 !== k) {\n", " var M = r(t, { errors: 0, currentLocation: k, expectedLocation: g, distance: h });\n", " if (m = Math.min(M, m), -1 !== (k = e.lastIndexOf(t, g + S))) {\n", " var _ = r(t, { errors: 0, currentLocation: k, expectedLocation: g, distance: h });\n", " m = Math.min(_, m);\n", " }\n", " } k = -1; for (var L = [], w = 1, A = S + y, C = 1 << S - 1, I = 0; I < S; I += 1) {\n", " for (var O = 0, j = A; O < j;) {\n", " r(t, { errors: I, currentLocation: g + j, expectedLocation: g, distance: h }) <= m ? O = j : A = j, j = Math.floor((A - O) / 2 + O);\n", " }\n", " A = j;\n", " var P = Math.max(1, g - j + 1), F = d ? y : Math.min(g + j, y) + S, T = Array(F + 2);\n", " T[F + 1] = (1 << I) - 1;\n", " for (var z = F; z >= P; z -= 1) {\n", " var E = z - 1, K = n[e.charAt(E)];\n", " if (K && (x[E] = 1), T[z] = (T[z + 1] << 1 | 1) & K, 0 !== I && (T[z] |= (L[z + 1] | L[z]) << 1 | 1 | L[z + 1]), T[z] & C && (w = r(t, { errors: I, currentLocation: E, expectedLocation: g, distance: h })) <= m) {\n", " if (m = w, (k = E) <= g)\n", " break;\n", " P = Math.max(1, 2 * g - k);\n", " }\n", " }\n", " if (r(t, { errors: I + 1, currentLocation: g, expectedLocation: g, distance: h }) > m)\n", " break;\n", " L = T;\n", " } return { isMatch: k >= 0, score: 0 === w ? .001 : w, matchedIndices: o(x, p) }; }; }, function (e, t) { e.exports = function (e, t) { var n = t.errors, r = void 0 === n ? 0 : n, o = t.currentLocation, i = void 0 === o ? 0 : o, a = t.expectedLocation, s = void 0 === a ? 0 : a, c = t.distance, h = void 0 === c ? 100 : c, l = r / e.length, u = Math.abs(s - i); return h ? l + u / h : u ? 1 : l; }; }, function (e, t) { e.exports = function () { for (var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [], t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1, n = [], r = -1, o = -1, i = 0, a = e.length; i < a; i += 1) {\n", " var s = e[i];\n", " s && -1 === r ? r = i : s || -1 === r || ((o = i - 1) - r + 1 >= t && n.push([r, o]), r = -1);\n", " } return e[i - 1] && i - r >= t && n.push([r, i - 1]), n; }; }, function (e, t) { e.exports = function (e) { for (var t = {}, n = e.length, r = 0; r < n; r += 1)\n", " t[e.charAt(r)] = 0; for (var o = 0; o < n; o += 1)\n", " t[e.charAt(o)] |= 1 << n - o - 1; return t; }; }, function (e, t, n) { var r = n(0); e.exports = function (e, t) { return function e(t, n, o) { if (n) {\n", " var i = n.indexOf(\".\"), a = n, s = null;\n", " -1 !== i && (a = n.slice(0, i), s = n.slice(i + 1));\n", " var c = t[a];\n", " if (null != c)\n", " if (s || \"string\" != typeof c && \"number\" != typeof c)\n", " if (r(c))\n", " for (var h = 0, l = c.length; h < l; h += 1)\n", " e(c[h], s, o);\n", " else\n", " s && e(c, s, o);\n", " else\n", " o.push(c.toString());\n", " }\n", " else\n", " o.push(t); return o; }(e, t, []); }; }]); });\n", " /***/ \n", " }),\n", " /* 3 */\n", " /***/ (function (module, __webpack_exports__, __webpack_require__) {\n", " \"use strict\";\n", " /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function () { return symbolObservablePonyfill; });\n", " function symbolObservablePonyfill(root) {\n", " var result;\n", " var Symbol = root.Symbol;\n", " if (typeof Symbol === 'function') {\n", " if (Symbol.observable) {\n", " result = Symbol.observable;\n", " }\n", " else {\n", " result = Symbol('observable');\n", " Symbol.observable = result;\n", " }\n", " }\n", " else {\n", " result = '@@observable';\n", " }\n", " return result;\n", " }\n", " ;\n", " /***/ \n", " }),\n", " /* 4 */\n", " /***/ (function (module, exports, __webpack_require__) {\n", " module.exports = __webpack_require__(7);\n", " /***/ \n", " }),\n", " /* 5 */\n", " /***/ (function (module, exports) {\n", " var g;\n", " // This works in non-strict mode\n", " g = (function () {\n", " return this;\n", " })();\n", " try {\n", " // This works if eval is allowed (see CSP)\n", " g = g || new Function(\"return this\")();\n", " }\n", " catch (e) {\n", " // This works if the window reference is available\n", " if (typeof window === \"object\")\n", " g = window;\n", " }\n", " // g can still be undefined, but nothing to do about it...\n", " // We return undefined, instead of nothing here, so it's\n", " // easier to handle this case. if(!global) { ...}\n", " module.exports = g;\n", " /***/ \n", " }),\n", " /* 6 */\n", " /***/ (function (module, exports) {\n", " module.exports = function (originalModule) {\n", " if (!originalModule.webpackPolyfill) {\n", " var module = Object.create(originalModule);\n", " // module.parent = undefined by default\n", " if (!module.children)\n", " module.children = [];\n", " Object.defineProperty(module, \"loaded\", {\n", " enumerable: true,\n", " get: function () {\n", " return module.l;\n", " }\n", " });\n", " Object.defineProperty(module, \"id\", {\n", " enumerable: true,\n", " get: function () {\n", " return module.i;\n", " }\n", " });\n", " Object.defineProperty(module, \"exports\", {\n", " enumerable: true\n", " });\n", " module.webpackPolyfill = 1;\n", " }\n", " return module;\n", " };\n", " /***/ \n", " }),\n", " /* 7 */\n", " /***/ (function (module, __webpack_exports__, __webpack_require__) {\n", " \"use strict\";\n", " __webpack_require__.r(__webpack_exports__);\n", " // EXTERNAL MODULE: ./node_modules/fuse.js/dist/fuse.js\n", " var dist_fuse = __webpack_require__(2);\n", " var fuse_default = /*#__PURE__*/ __webpack_require__.n(dist_fuse);\n", " // EXTERNAL MODULE: ./node_modules/deepmerge/dist/cjs.js\n", " var cjs = __webpack_require__(0);\n", " var cjs_default = /*#__PURE__*/ __webpack_require__.n(cjs);\n", " // EXTERNAL MODULE: ./node_modules/symbol-observable/es/index.js\n", " var es = __webpack_require__(1);\n", " // CONCATENATED MODULE: ./node_modules/redux/es/redux.js\n", " /**\n", " * These are private action types reserved by Redux.\n", " * For any unknown actions, you must return the current state.\n", " * If the current state is undefined, you must return the initial state.\n", " * Do not reference these action types directly in your code.\n", " */\n", " var randomString = function randomString() {\n", " return Math.random().toString(36).substring(7).split('').join('.');\n", " };\n", " var ActionTypes = {\n", " INIT: \"@@redux/INIT\" + randomString(),\n", " REPLACE: \"@@redux/REPLACE\" + randomString(),\n", " PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {\n", " return \"@@redux/PROBE_UNKNOWN_ACTION\" + randomString();\n", " }\n", " };\n", " /**\n", " * @param {any} obj The object to inspect.\n", " * @returns {boolean} True if the argument appears to be a plain object.\n", " */\n", " function isPlainObject(obj) {\n", " if (typeof obj !== 'object' || obj === null)\n", " return false;\n", " var proto = obj;\n", " while (Object.getPrototypeOf(proto) !== null) {\n", " proto = Object.getPrototypeOf(proto);\n", " }\n", " return Object.getPrototypeOf(obj) === proto;\n", " }\n", " /**\n", " * Creates a Redux store that holds the state tree.\n", " * The only way to change the data in the store is to call `dispatch()` on it.\n", " *\n", " * There should only be a single store in your app. To specify how different\n", " * parts of the state tree respond to actions, you may combine several reducers\n", " * into a single reducer function by using `combineReducers`.\n", " *\n", " * @param {Function} reducer A function that returns the next state tree, given\n", " * the current state tree and the action to handle.\n", " *\n", " * @param {any} [preloadedState] The initial state. You may optionally specify it\n", " * to hydrate the state from the server in universal apps, or to restore a\n", " * previously serialized user session.\n", " * If you use `combineReducers` to produce the root reducer function, this must be\n", " * an object with the same shape as `combineReducers` keys.\n", " *\n", " * @param {Function} [enhancer] The store enhancer. You may optionally specify it\n", " * to enhance the store with third-party capabilities such as middleware,\n", " * time travel, persistence, etc. The only store enhancer that ships with Redux\n", " * is `applyMiddleware()`.\n", " *\n", " * @returns {Store} A Redux store that lets you read the state, dispatch actions\n", " * and subscribe to changes.\n", " */\n", " function createStore(reducer, preloadedState, enhancer) {\n", " var _ref2;\n", " if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') {\n", " throw new Error('It looks like you are passing several store enhancers to ' + 'createStore(). This is not supported. Instead, compose them ' + 'together to a single function.');\n", " }\n", " if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {\n", " enhancer = preloadedState;\n", " preloadedState = undefined;\n", " }\n", " if (typeof enhancer !== 'undefined') {\n", " if (typeof enhancer !== 'function') {\n", " throw new Error('Expected the enhancer to be a function.');\n", " }\n", " return enhancer(createStore)(reducer, preloadedState);\n", " }\n", " if (typeof reducer !== 'function') {\n", " throw new Error('Expected the reducer to be a function.');\n", " }\n", " var currentReducer = reducer;\n", " var currentState = preloadedState;\n", " var currentListeners = [];\n", " var nextListeners = currentListeners;\n", " var isDispatching = false;\n", " /**\n", " * This makes a shallow copy of currentListeners so we can use\n", " * nextListeners as a temporary list while dispatching.\n", " *\n", " * This prevents any bugs around consumers calling\n", " * subscribe/unsubscribe in the middle of a dispatch.\n", " */\n", " function ensureCanMutateNextListeners() {\n", " if (nextListeners === currentListeners) {\n", " nextListeners = currentListeners.slice();\n", " }\n", " }\n", " /**\n", " * Reads the state tree managed by the store.\n", " *\n", " * @returns {any} The current state tree of your application.\n", " */\n", " function getState() {\n", " if (isDispatching) {\n", " throw new Error('You may not call store.getState() while the reducer is executing. ' + 'The reducer has already received the state as an argument. ' + 'Pass it down from the top reducer instead of reading it from the store.');\n", " }\n", " return currentState;\n", " }\n", " /**\n", " * Adds a change listener. It will be called any time an action is dispatched,\n", " * and some part of the state tree may potentially have changed. You may then\n", " * call `getState()` to read the current state tree inside the callback.\n", " *\n", " * You may call `dispatch()` from a change listener, with the following\n", " * caveats:\n", " *\n", " * 1. The subscriptions are snapshotted just before every `dispatch()` call.\n", " * If you subscribe or unsubscribe while the listeners are being invoked, this\n", " * will not have any effect on the `dispatch()` that is currently in progress.\n", " * However, the next `dispatch()` call, whether nested or not, will use a more\n", " * recent snapshot of the subscription list.\n", " *\n", " * 2. The listener should not expect to see all state changes, as the state\n", " * might have been updated multiple times during a nested `dispatch()` before\n", " * the listener is called. It is, however, guaranteed that all subscribers\n", " * registered before the `dispatch()` started will be called with the latest\n", " * state by the time it exits.\n", " *\n", " * @param {Function} listener A callback to be invoked on every dispatch.\n", " * @returns {Function} A function to remove this change listener.\n", " */\n", " function subscribe(listener) {\n", " if (typeof listener !== 'function') {\n", " throw new Error('Expected the listener to be a function.');\n", " }\n", " if (isDispatching) {\n", " throw new Error('You may not call store.subscribe() while the reducer is executing. ' + 'If you would like to be notified after the store has been updated, subscribe from a ' + 'component and invoke store.getState() in the callback to access the latest state. ' + 'See https://redux.js.org/api-reference/store#subscribe(listener) for more details.');\n", " }\n", " var isSubscribed = true;\n", " ensureCanMutateNextListeners();\n", " nextListeners.push(listener);\n", " return function unsubscribe() {\n", " if (!isSubscribed) {\n", " return;\n", " }\n", " if (isDispatching) {\n", " throw new Error('You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api-reference/store#subscribe(listener) for more details.');\n", " }\n", " isSubscribed = false;\n", " ensureCanMutateNextListeners();\n", " var index = nextListeners.indexOf(listener);\n", " nextListeners.splice(index, 1);\n", " };\n", " }\n", " /**\n", " * Dispatches an action. It is the only way to trigger a state change.\n", " *\n", " * The `reducer` function, used to create the store, will be called with the\n", " * current state tree and the given `action`. Its return value will\n", " * be considered the **next** state of the tree, and the change listeners\n", " * will be notified.\n", " *\n", " * The base implementation only supports plain object actions. If you want to\n", " * dispatch a Promise, an Observable, a thunk, or something else, you need to\n", " * wrap your store creating function into the corresponding middleware. For\n", " * example, see the documentation for the `redux-thunk` package. Even the\n", " * middleware will eventually dispatch plain object actions using this method.\n", " *\n", " * @param {Object} action A plain object representing “what changed”. It is\n", " * a good idea to keep actions serializable so you can record and replay user\n", " * sessions, or use the time travelling `redux-devtools`. An action must have\n", " * a `type` property which may not be `undefined`. It is a good idea to use\n", " * string constants for action types.\n", " *\n", " * @returns {Object} For convenience, the same action object you dispatched.\n", " *\n", " * Note that, if you use a custom middleware, it may wrap `dispatch()` to\n", " * return something else (for example, a Promise you can await).\n", " */\n", " function dispatch(action) {\n", " if (!isPlainObject(action)) {\n", " throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.');\n", " }\n", " if (typeof action.type === 'undefined') {\n", " throw new Error('Actions may not have an undefined \"type\" property. ' + 'Have you misspelled a constant?');\n", " }\n", " if (isDispatching) {\n", " throw new Error('Reducers may not dispatch actions.');\n", " }\n", " try {\n", " isDispatching = true;\n", " currentState = currentReducer(currentState, action);\n", " }\n", " finally {\n", " isDispatching = false;\n", " }\n", " var listeners = currentListeners = nextListeners;\n", " for (var i = 0; i < listeners.length; i++) {\n", " var listener = listeners[i];\n", " listener();\n", " }\n", " return action;\n", " }\n", " /**\n", " * Replaces the reducer currently used by the store to calculate the state.\n", " *\n", " * You might need this if your app implements code splitting and you want to\n", " * load some of the reducers dynamically. You might also need this if you\n", " * implement a hot reloading mechanism for Redux.\n", " *\n", " * @param {Function} nextReducer The reducer for the store to use instead.\n", " * @returns {void}\n", " */\n", " function replaceReducer(nextReducer) {\n", " if (typeof nextReducer !== 'function') {\n", " throw new Error('Expected the nextReducer to be a function.');\n", " }\n", " currentReducer = nextReducer; // This action has a similiar effect to ActionTypes.INIT.\n", " // Any reducers that existed in both the new and old rootReducer\n", " // will receive the previous state. This effectively populates\n", " // the new state tree with any relevant data from the old one.\n", " dispatch({\n", " type: ActionTypes.REPLACE\n", " });\n", " }\n", " /**\n", " * Interoperability point for observable/reactive libraries.\n", " * @returns {observable} A minimal observable of state changes.\n", " * For more information, see the observable proposal:\n", " * https://github.com/tc39/proposal-observable\n", " */\n", " function observable() {\n", " var _ref;\n", " var outerSubscribe = subscribe;\n", " return _ref = {\n", " /**\n", " * The minimal observable subscription method.\n", " * @param {Object} observer Any object that can be used as an observer.\n", " * The observer object should have a `next` method.\n", " * @returns {subscription} An object with an `unsubscribe` method that can\n", " * be used to unsubscribe the observable from the store, and prevent further\n", " * emission of values from the observable.\n", " */\n", " subscribe: function subscribe(observer) {\n", " if (typeof observer !== 'object' || observer === null) {\n", " throw new TypeError('Expected the observer to be an object.');\n", " }\n", " function observeState() {\n", " if (observer.next) {\n", " observer.next(getState());\n", " }\n", " }\n", " observeState();\n", " var unsubscribe = outerSubscribe(observeState);\n", " return {\n", " unsubscribe: unsubscribe\n", " };\n", " }\n", " }, _ref[es[\"a\" /* default */]] = function () {\n", " return this;\n", " }, _ref;\n", " } // When a store is created, an \"INIT\" action is dispatched so that every\n", " // reducer returns their initial state. This effectively populates\n", " // the initial state tree.\n", " dispatch({\n", " type: ActionTypes.INIT\n", " });\n", " return _ref2 = {\n", " dispatch: dispatch,\n", " subscribe: subscribe,\n", " getState: getState,\n", " replaceReducer: replaceReducer\n", " }, _ref2[es[\"a\" /* default */]] = observable, _ref2;\n", " }\n", " /**\n", " * Prints a warning in the console if it exists.\n", " *\n", " * @param {String} message The warning message.\n", " * @returns {void}\n", " */\n", " function warning(message) {\n", " /* eslint-disable no-console */\n", " if (typeof console !== 'undefined' && typeof console.error === 'function') {\n", " console.error(message);\n", " }\n", " /* eslint-enable no-console */\n", " try {\n", " // This error was thrown as a convenience so that if you enable\n", " // \"break on all exceptions\" in your console,\n", " // it would pause the execution at this line.\n", " throw new Error(message);\n", " }\n", " catch (e) { } // eslint-disable-line no-empty\n", " }\n", " function getUndefinedStateErrorMessage(key, action) {\n", " var actionType = action && action.type;\n", " var actionDescription = actionType && \"action \\\"\" + String(actionType) + \"\\\"\" || 'an action';\n", " return \"Given \" + actionDescription + \", reducer \\\"\" + key + \"\\\" returned undefined. \" + \"To ignore an action, you must explicitly return the previous state. \" + \"If you want this reducer to hold no value, you can return null instead of undefined.\";\n", " }\n", " function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {\n", " var reducerKeys = Object.keys(reducers);\n", " var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';\n", " if (reducerKeys.length === 0) {\n", " return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';\n", " }\n", " if (!isPlainObject(inputState)) {\n", " return \"The \" + argumentName + \" has unexpected type of \\\"\" + {}.toString.call(inputState).match(/\\s([a-z|A-Z]+)/)[1] + \"\\\". Expected argument to be an object with the following \" + (\"keys: \\\"\" + reducerKeys.join('\", \"') + \"\\\"\");\n", " }\n", " var unexpectedKeys = Object.keys(inputState).filter(function (key) {\n", " return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];\n", " });\n", " unexpectedKeys.forEach(function (key) {\n", " unexpectedKeyCache[key] = true;\n", " });\n", " if (action && action.type === ActionTypes.REPLACE)\n", " return;\n", " if (unexpectedKeys.length > 0) {\n", " return \"Unexpected \" + (unexpectedKeys.length > 1 ? 'keys' : 'key') + \" \" + (\"\\\"\" + unexpectedKeys.join('\", \"') + \"\\\" found in \" + argumentName + \". \") + \"Expected to find one of the known reducer keys instead: \" + (\"\\\"\" + reducerKeys.join('\", \"') + \"\\\". Unexpected keys will be ignored.\");\n", " }\n", " }\n", " function assertReducerShape(reducers) {\n", " Object.keys(reducers).forEach(function (key) {\n", " var reducer = reducers[key];\n", " var initialState = reducer(undefined, {\n", " type: ActionTypes.INIT\n", " });\n", " if (typeof initialState === 'undefined') {\n", " throw new Error(\"Reducer \\\"\" + key + \"\\\" returned undefined during initialization. \" + \"If the state passed to the reducer is undefined, you must \" + \"explicitly return the initial state. The initial state may \" + \"not be undefined. If you don't want to set a value for this reducer, \" + \"you can use null instead of undefined.\");\n", " }\n", " if (typeof reducer(undefined, {\n", " type: ActionTypes.PROBE_UNKNOWN_ACTION()\n", " }) === 'undefined') {\n", " throw new Error(\"Reducer \\\"\" + key + \"\\\" returned undefined when probed with a random type. \" + (\"Don't try to handle \" + ActionTypes.INIT + \" or other actions in \\\"redux/*\\\" \") + \"namespace. They are considered private. Instead, you must return the \" + \"current state for any unknown actions, unless it is undefined, \" + \"in which case you must return the initial state, regardless of the \" + \"action type. The initial state may not be undefined, but can be null.\");\n", " }\n", " });\n", " }\n", " /**\n", " * Turns an object whose values are different reducer functions, into a single\n", " * reducer function. It will call every child reducer, and gather their results\n", " * into a single state object, whose keys correspond to the keys of the passed\n", " * reducer functions.\n", " *\n", " * @param {Object} reducers An object whose values correspond to different\n", " * reducer functions that need to be combined into one. One handy way to obtain\n", " * it is to use ES6 `import * as reducers` syntax. The reducers may never return\n", " * undefined for any action. Instead, they should return their initial state\n", " * if the state passed to them was undefined, and the current state for any\n", " * unrecognized action.\n", " *\n", " * @returns {Function} A reducer function that invokes every reducer inside the\n", " * passed object, and builds a state object with the same shape.\n", " */\n", " function combineReducers(reducers) {\n", " var reducerKeys = Object.keys(reducers);\n", " var finalReducers = {};\n", " for (var i = 0; i < reducerKeys.length; i++) {\n", " var key = reducerKeys[i];\n", " if (false) { }\n", " if (typeof reducers[key] === 'function') {\n", " finalReducers[key] = reducers[key];\n", " }\n", " }\n", " var finalReducerKeys = Object.keys(finalReducers); // This is used to make sure we don't warn about the same\n", " // keys multiple times.\n", " var unexpectedKeyCache;\n", " if (false) { }\n", " var shapeAssertionError;\n", " try {\n", " assertReducerShape(finalReducers);\n", " }\n", " catch (e) {\n", " shapeAssertionError = e;\n", " }\n", " return function combination(state, action) {\n", " if (state === void 0) {\n", " state = {};\n", " }\n", " if (shapeAssertionError) {\n", " throw shapeAssertionError;\n", " }\n", " if (false) {\n", " var warningMessage;\n", " }\n", " var hasChanged = false;\n", " var nextState = {};\n", " for (var _i = 0; _i < finalReducerKeys.length; _i++) {\n", " var _key = finalReducerKeys[_i];\n", " var reducer = finalReducers[_key];\n", " var previousStateForKey = state[_key];\n", " var nextStateForKey = reducer(previousStateForKey, action);\n", " if (typeof nextStateForKey === 'undefined') {\n", " var errorMessage = getUndefinedStateErrorMessage(_key, action);\n", " throw new Error(errorMessage);\n", " }\n", " nextState[_key] = nextStateForKey;\n", " hasChanged = hasChanged || nextStateForKey !== previousStateForKey;\n", " }\n", " return hasChanged ? nextState : state;\n", " };\n", " }\n", " function bindActionCreator(actionCreator, dispatch) {\n", " return function () {\n", " return dispatch(actionCreator.apply(this, arguments));\n", " };\n", " }\n", " /**\n", " * Turns an object whose values are action creators, into an object with the\n", " * same keys, but with every function wrapped into a `dispatch` call so they\n", " * may be invoked directly. This is just a convenience method, as you can call\n", " * `store.dispatch(MyActionCreators.doSomething())` yourself just fine.\n", " *\n", " * For convenience, you can also pass an action creator as the first argument,\n", " * and get a dispatch wrapped function in return.\n", " *\n", " * @param {Function|Object} actionCreators An object whose values are action\n", " * creator functions. One handy way to obtain it is to use ES6 `import * as`\n", " * syntax. You may also pass a single function.\n", " *\n", " * @param {Function} dispatch The `dispatch` function available on your Redux\n", " * store.\n", " *\n", " * @returns {Function|Object} The object mimicking the original object, but with\n", " * every action creator wrapped into the `dispatch` call. If you passed a\n", " * function as `actionCreators`, the return value will also be a single\n", " * function.\n", " */\n", " function bindActionCreators(actionCreators, dispatch) {\n", " if (typeof actionCreators === 'function') {\n", " return bindActionCreator(actionCreators, dispatch);\n", " }\n", " if (typeof actionCreators !== 'object' || actionCreators === null) {\n", " throw new Error(\"bindActionCreators expected an object or a function, instead received \" + (actionCreators === null ? 'null' : typeof actionCreators) + \". \" + \"Did you write \\\"import ActionCreators from\\\" instead of \\\"import * as ActionCreators from\\\"?\");\n", " }\n", " var boundActionCreators = {};\n", " for (var key in actionCreators) {\n", " var actionCreator = actionCreators[key];\n", " if (typeof actionCreator === 'function') {\n", " boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);\n", " }\n", " }\n", " return boundActionCreators;\n", " }\n", " function _defineProperty(obj, key, value) {\n", " if (key in obj) {\n", " Object.defineProperty(obj, key, {\n", " value: value,\n", " enumerable: true,\n", " configurable: true,\n", " writable: true\n", " });\n", " }\n", " else {\n", " obj[key] = value;\n", " }\n", " return obj;\n", " }\n", " function ownKeys(object, enumerableOnly) {\n", " var keys = Object.keys(object);\n", " if (Object.getOwnPropertySymbols) {\n", " keys.push.apply(keys, Object.getOwnPropertySymbols(object));\n", " }\n", " if (enumerableOnly)\n", " keys = keys.filter(function (sym) {\n", " return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n", " });\n", " return keys;\n", " }\n", " function _objectSpread2(target) {\n", " for (var i = 1; i < arguments.length; i++) {\n", " var source = arguments[i] != null ? arguments[i] : {};\n", " if (i % 2) {\n", " ownKeys(source, true).forEach(function (key) {\n", " _defineProperty(target, key, source[key]);\n", " });\n", " }\n", " else if (Object.getOwnPropertyDescriptors) {\n", " Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n", " }\n", " else {\n", " ownKeys(source).forEach(function (key) {\n", " Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n", " });\n", " }\n", " }\n", " return target;\n", " }\n", " /**\n", " * Composes single-argument functions from right to left. The rightmost\n", " * function can take multiple arguments as it provides the signature for\n", " * the resulting composite function.\n", " *\n", " * @param {...Function} funcs The functions to compose.\n", " * @returns {Function} A function obtained by composing the argument functions\n", " * from right to left. For example, compose(f, g, h) is identical to doing\n", " * (...args) => f(g(h(...args))).\n", " */\n", " function compose() {\n", " for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {\n", " funcs[_key] = arguments[_key];\n", " }\n", " if (funcs.length === 0) {\n", " return function (arg) {\n", " return arg;\n", " };\n", " }\n", " if (funcs.length === 1) {\n", " return funcs[0];\n", " }\n", " return funcs.reduce(function (a, b) {\n", " return function () {\n", " return a(b.apply(void 0, arguments));\n", " };\n", " });\n", " }\n", " /**\n", " * Creates a store enhancer that applies middleware to the dispatch method\n", " * of the Redux store. This is handy for a variety of tasks, such as expressing\n", " * asynchronous actions in a concise manner, or logging every action payload.\n", " *\n", " * See `redux-thunk` package as an example of the Redux middleware.\n", " *\n", " * Because middleware is potentially asynchronous, this should be the first\n", " * store enhancer in the composition chain.\n", " *\n", " * Note that each middleware will be given the `dispatch` and `getState` functions\n", " * as named arguments.\n", " *\n", " * @param {...Function} middlewares The middleware chain to be applied.\n", " * @returns {Function} A store enhancer applying the middleware.\n", " */\n", " function applyMiddleware() {\n", " for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {\n", " middlewares[_key] = arguments[_key];\n", " }\n", " return function (createStore) {\n", " return function () {\n", " var store = createStore.apply(void 0, arguments);\n", " var _dispatch = function dispatch() {\n", " throw new Error('Dispatching while constructing your middleware is not allowed. ' + 'Other middleware would not be applied to this dispatch.');\n", " };\n", " var middlewareAPI = {\n", " getState: store.getState,\n", " dispatch: function dispatch() {\n", " return _dispatch.apply(void 0, arguments);\n", " }\n", " };\n", " var chain = middlewares.map(function (middleware) {\n", " return middleware(middlewareAPI);\n", " });\n", " _dispatch = compose.apply(void 0, chain)(store.dispatch);\n", " return _objectSpread2({}, store, {\n", " dispatch: _dispatch\n", " });\n", " };\n", " };\n", " }\n", " /*\n", " * This is a dummy function to check if the function name has been altered by minification.\n", " * If the function has been minified and NODE_ENV !== 'production', warn the user.\n", " */\n", " function isCrushed() { }\n", " if (false) { }\n", " // CONCATENATED MODULE: ./src/scripts/reducers/items.js\n", " var defaultState = [];\n", " function items_items(state, action) {\n", " if (state === void 0) {\n", " state = defaultState;\n", " }\n", " switch (action.type) {\n", " case 'ADD_ITEM':\n", " {\n", " // Add object to items array\n", " var newState = [].concat(state, [{\n", " id: action.id,\n", " choiceId: action.choiceId,\n", " groupId: action.groupId,\n", " value: action.value,\n", " label: action.label,\n", " active: true,\n", " highlighted: false,\n", " customProperties: action.customProperties,\n", " placeholder: action.placeholder || false,\n", " keyCode: null\n", " }]);\n", " return newState.map(function (obj) {\n", " var item = obj;\n", " item.highlighted = false;\n", " return item;\n", " });\n", " }\n", " case 'REMOVE_ITEM':\n", " {\n", " // Set item to inactive\n", " return state.map(function (obj) {\n", " var item = obj;\n", " if (item.id === action.id) {\n", " item.active = false;\n", " }\n", " return item;\n", " });\n", " }\n", " case 'HIGHLIGHT_ITEM':\n", " {\n", " return state.map(function (obj) {\n", " var item = obj;\n", " if (item.id === action.id) {\n", " item.highlighted = action.highlighted;\n", " }\n", " return item;\n", " });\n", " }\n", " default:\n", " {\n", " return state;\n", " }\n", " }\n", " }\n", " // CONCATENATED MODULE: ./src/scripts/reducers/groups.js\n", " var groups_defaultState = [];\n", " function groups(state, action) {\n", " if (state === void 0) {\n", " state = groups_defaultState;\n", " }\n", " switch (action.type) {\n", " case 'ADD_GROUP':\n", " {\n", " return [].concat(state, [{\n", " id: action.id,\n", " value: action.value,\n", " active: action.active,\n", " disabled: action.disabled\n", " }]);\n", " }\n", " case 'CLEAR_CHOICES':\n", " {\n", " return [];\n", " }\n", " default:\n", " {\n", " return state;\n", " }\n", " }\n", " }\n", " // CONCATENATED MODULE: ./src/scripts/reducers/choices.js\n", " var choices_defaultState = [];\n", " function choices_choices(state, action) {\n", " if (state === void 0) {\n", " state = choices_defaultState;\n", " }\n", " switch (action.type) {\n", " case 'ADD_CHOICE':\n", " {\n", " /*\n", " A disabled choice appears in the choice dropdown but cannot be selected\n", " A selected choice has been added to the passed input's value (added as an item)\n", " An active choice appears within the choice dropdown\n", " */\n", " return [].concat(state, [{\n", " id: action.id,\n", " elementId: action.elementId,\n", " groupId: action.groupId,\n", " value: action.value,\n", " label: action.label || action.value,\n", " disabled: action.disabled || false,\n", " selected: false,\n", " active: true,\n", " score: 9999,\n", " customProperties: action.customProperties,\n", " placeholder: action.placeholder || false,\n", " keyCode: null\n", " }]);\n", " }\n", " case 'ADD_ITEM':\n", " {\n", " // If all choices need to be activated\n", " if (action.activateOptions) {\n", " return state.map(function (obj) {\n", " var choice = obj;\n", " choice.active = action.active;\n", " return choice;\n", " });\n", " } // When an item is added and it has an associated choice,\n", " // we want to disable it so it can't be chosen again\n", " if (action.choiceId > -1) {\n", " return state.map(function (obj) {\n", " var choice = obj;\n", " if (choice.id === parseInt(action.choiceId, 10)) {\n", " choice.selected = true;\n", " }\n", " return choice;\n", " });\n", " }\n", " return state;\n", " }\n", " case 'REMOVE_ITEM':\n", " {\n", " // When an item is removed and it has an associated choice,\n", " // we want to re-enable it so it can be chosen again\n", " if (action.choiceId > -1) {\n", " return state.map(function (obj) {\n", " var choice = obj;\n", " if (choice.id === parseInt(action.choiceId, 10)) {\n", " choice.selected = false;\n", " }\n", " return choice;\n", " });\n", " }\n", " return state;\n", " }\n", " case 'FILTER_CHOICES':\n", " {\n", " return state.map(function (obj) {\n", " var choice = obj; // Set active state based on whether choice is\n", " // within filtered results\n", " choice.active = action.results.some(function (_ref) {\n", " var item = _ref.item, score = _ref.score;\n", " if (item.id === choice.id) {\n", " choice.score = score;\n", " return true;\n", " }\n", " return false;\n", " });\n", " return choice;\n", " });\n", " }\n", " case 'ACTIVATE_CHOICES':\n", " {\n", " return state.map(function (obj) {\n", " var choice = obj;\n", " choice.active = action.active;\n", " return choice;\n", " });\n", " }\n", " case 'CLEAR_CHOICES':\n", " {\n", " return choices_defaultState;\n", " }\n", " default:\n", " {\n", " return state;\n", " }\n", " }\n", " }\n", " // CONCATENATED MODULE: ./src/scripts/reducers/general.js\n", " var general_defaultState = {\n", " loading: false\n", " };\n", " var general = function general(state, action) {\n", " if (state === void 0) {\n", " state = general_defaultState;\n", " }\n", " switch (action.type) {\n", " case 'SET_IS_LOADING':\n", " {\n", " return {\n", " loading: action.isLoading\n", " };\n", " }\n", " default:\n", " {\n", " return state;\n", " }\n", " }\n", " };\n", " /* harmony default export */ var reducers_general = (general);\n", " // CONCATENATED MODULE: ./src/scripts/lib/utils.js\n", " /**\n", " * @param {number} min\n", " * @param {number} max\n", " * @returns {number}\n", " */\n", " var getRandomNumber = function getRandomNumber(min, max) {\n", " return Math.floor(Math.random() * (max - min) + min);\n", " };\n", " /**\n", " * @param {number} length\n", " * @returns {string}\n", " */\n", " var generateChars = function generateChars(length) {\n", " return Array.from({\n", " length: length\n", " }, function () {\n", " return getRandomNumber(0, 36).toString(36);\n", " }).join('');\n", " };\n", " /**\n", " * @param {HTMLInputElement | HTMLSelectElement} element\n", " * @param {string} prefix\n", " * @returns {string}\n", " */\n", " var generateId = function generateId(element, prefix) {\n", " var id = element.id || element.name && element.name + \"-\" + generateChars(2) || generateChars(4);\n", " id = id.replace(/(:|\\.|\\[|\\]|,)/g, '');\n", " id = prefix + \"-\" + id;\n", " return id;\n", " };\n", " /**\n", " * @param {any} obj\n", " * @returns {string}\n", " */\n", " var getType = function getType(obj) {\n", " return Object.prototype.toString.call(obj).slice(8, -1);\n", " };\n", " /**\n", " * @param {string} type\n", " * @param {any} obj\n", " * @returns {boolean}\n", " */\n", " var isType = function isType(type, obj) {\n", " return obj !== undefined && obj !== null && getType(obj) === type;\n", " };\n", " /**\n", " * @param {HTMLElement} element\n", " * @param {HTMLElement} [wrapper={HTMLDivElement}]\n", " * @returns {HTMLElement}\n", " */\n", " var utils_wrap = function wrap(element, wrapper) {\n", " if (wrapper === void 0) {\n", " wrapper = document.createElement('div');\n", " }\n", " if (element.nextSibling) {\n", " element.parentNode.insertBefore(wrapper, element.nextSibling);\n", " }\n", " else {\n", " element.parentNode.appendChild(wrapper);\n", " }\n", " return wrapper.appendChild(element);\n", " };\n", " /**\n", " * @param {Element} startEl\n", " * @param {string} selector\n", " * @param {1 | -1} direction\n", " * @returns {Element | undefined}\n", " */\n", " var getAdjacentEl = function getAdjacentEl(startEl, selector, direction) {\n", " if (direction === void 0) {\n", " direction = 1;\n", " }\n", " if (!(startEl instanceof Element) || typeof selector !== 'string') {\n", " return undefined;\n", " }\n", " var prop = (direction > 0 ? 'next' : 'previous') + \"ElementSibling\";\n", " var sibling = startEl[prop];\n", " while (sibling) {\n", " if (sibling.matches(selector)) {\n", " return sibling;\n", " }\n", " sibling = sibling[prop];\n", " }\n", " return sibling;\n", " };\n", " /**\n", " * @param {Element} element\n", " * @param {Element} parent\n", " * @param {-1 | 1} direction\n", " * @returns {boolean}\n", " */\n", " var isScrolledIntoView = function isScrolledIntoView(element, parent, direction) {\n", " if (direction === void 0) {\n", " direction = 1;\n", " }\n", " if (!element) {\n", " return false;\n", " }\n", " var isVisible;\n", " if (direction > 0) {\n", " // In view from bottom\n", " isVisible = parent.scrollTop + parent.offsetHeight >= element.offsetTop + element.offsetHeight;\n", " }\n", " else {\n", " // In view from top\n", " isVisible = element.offsetTop >= parent.scrollTop;\n", " }\n", " return isVisible;\n", " };\n", " /**\n", " * @param {any} value\n", " * @returns {any}\n", " */\n", " var sanitise = function sanitise(value) {\n", " if (typeof value !== 'string') {\n", " return value;\n", " }\n", " return value.replace(/&/g, '&').replace(/>/g, '&rt;').replace(/ (str: string) => Element}\n", " */\n", " var strToEl = function () {\n", " var tmpEl = document.createElement('div');\n", " return function (str) {\n", " var cleanedInput = str.trim();\n", " tmpEl.innerHTML = cleanedInput;\n", " var firldChild = tmpEl.children[0];\n", " while (tmpEl.firstChild) {\n", " tmpEl.removeChild(tmpEl.firstChild);\n", " }\n", " return firldChild;\n", " };\n", " }();\n", " /**\n", " * @param {{ label?: string, value: string }} a\n", " * @param {{ label?: string, value: string }} b\n", " * @returns {number}\n", " */\n", " var sortByAlpha = function sortByAlpha(_ref, _ref2) {\n", " var value = _ref.value, _ref$label = _ref.label, label = _ref$label === void 0 ? value : _ref$label;\n", " var value2 = _ref2.value, _ref2$label = _ref2.label, label2 = _ref2$label === void 0 ? value2 : _ref2$label;\n", " return label.localeCompare(label2, [], {\n", " sensitivity: 'base',\n", " ignorePunctuation: true,\n", " numeric: true\n", " });\n", " };\n", " /**\n", " * @param {{ score: number }} a\n", " * @param {{ score: number }} b\n", " */\n", " var sortByScore = function sortByScore(a, b) {\n", " return a.score - b.score;\n", " };\n", " /**\n", " * @param {HTMLElement} element\n", " * @param {string} type\n", " * @param {object} customArgs\n", " */\n", " var dispatchEvent = function dispatchEvent(element, type, customArgs) {\n", " if (customArgs === void 0) {\n", " customArgs = null;\n", " }\n", " var event = new CustomEvent(type, {\n", " detail: customArgs,\n", " bubbles: true,\n", " cancelable: true\n", " });\n", " return element.dispatchEvent(event);\n", " };\n", " /**\n", " * @param {array} array\n", " * @param {any} value\n", " * @param {string} [key=\"value\"]\n", " * @returns {boolean}\n", " */\n", " var existsInArray = function existsInArray(array, value, key) {\n", " if (key === void 0) {\n", " key = 'value';\n", " }\n", " return array.some(function (item) {\n", " if (typeof value === 'string') {\n", " return item[key] === value.trim();\n", " }\n", " return item[key] === value;\n", " });\n", " };\n", " /**\n", " * @param {any} obj\n", " * @returns {any}\n", " */\n", " var cloneObject = function cloneObject(obj) {\n", " return JSON.parse(JSON.stringify(obj));\n", " };\n", " /**\n", " * Returns an array of keys present on the first but missing on the second object\n", " * @param {object} a\n", " * @param {object} b\n", " * @returns {string[]}\n", " */\n", " var diff = function diff(a, b) {\n", " var aKeys = Object.keys(a).sort();\n", " var bKeys = Object.keys(b).sort();\n", " return aKeys.filter(function (i) {\n", " return bKeys.indexOf(i) < 0;\n", " });\n", " };\n", " // CONCATENATED MODULE: ./src/scripts/reducers/index.js\n", " var appReducer = combineReducers({\n", " items: items_items,\n", " groups: groups,\n", " choices: choices_choices,\n", " general: reducers_general\n", " });\n", " var reducers_rootReducer = function rootReducer(passedState, action) {\n", " var state = passedState; // If we are clearing all items, groups and options we reassign\n", " // state and then pass that state to our proper reducer. This isn't\n", " // mutating our actual state\n", " // See: http://stackoverflow.com/a/35641992\n", " if (action.type === 'CLEAR_ALL') {\n", " state = undefined;\n", " }\n", " else if (action.type === 'RESET_TO') {\n", " return cloneObject(action.state);\n", " }\n", " return appReducer(state, action);\n", " };\n", " /* harmony default export */ var reducers = (reducers_rootReducer);\n", " // CONCATENATED MODULE: ./src/scripts/store/store.js\n", " function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) {\n", " var descriptor = props[i];\n", " descriptor.enumerable = descriptor.enumerable || false;\n", " descriptor.configurable = true;\n", " if (\"value\" in descriptor)\n", " descriptor.writable = true;\n", " Object.defineProperty(target, descriptor.key, descriptor);\n", " } }\n", " function _createClass(Constructor, protoProps, staticProps) { if (protoProps)\n", " _defineProperties(Constructor.prototype, protoProps); if (staticProps)\n", " _defineProperties(Constructor, staticProps); return Constructor; }\n", " /**\n", " * @typedef {import('../../../types/index').Choices.Choice} Choice\n", " * @typedef {import('../../../types/index').Choices.Group} Group\n", " * @typedef {import('../../../types/index').Choices.Item} Item\n", " */\n", " var store_Store = \n", " /*#__PURE__*/\n", " function () {\n", " function Store() {\n", " this._store = createStore(reducers, window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__());\n", " }\n", " /**\n", " * Subscribe store to function call (wrapped Redux method)\n", " * @param {Function} onChange Function to trigger when state changes\n", " * @return\n", " */\n", " var _proto = Store.prototype;\n", " _proto.subscribe = function subscribe(onChange) {\n", " this._store.subscribe(onChange);\n", " };\n", " _proto.dispatch = function dispatch(action) {\n", " this._store.dispatch(action);\n", " };\n", " /**\n", " * Get loading state from store\n", " * @returns {boolean} Loading State\n", " */\n", " _proto.isLoading = function isLoading() {\n", " return this.state.general.loading;\n", " };\n", " _proto.getChoiceById = function getChoiceById(id) {\n", " return this.activeChoices.find(function (choice) {\n", " return choice.id === parseInt(id, 10);\n", " });\n", " };\n", " _proto.getGroupById = function getGroupById(id) {\n", " return this.groups.find(function (group) {\n", " return group.id === id;\n", " });\n", " };\n", " _createClass(Store, [{\n", " key: \"state\",\n", " get: function get() {\n", " return this._store.getState();\n", " }\n", " /**\n", " * Get items from store\n", " * @returns {Item[]} Item objects\n", " */\n", " }, {\n", " key: \"items\",\n", " get: function get() {\n", " return this.state.items;\n", " }\n", " /**\n", " * Get active items from store\n", " * @returns {Item[]} Item objects\n", " */\n", " }, {\n", " key: \"activeItems\",\n", " get: function get() {\n", " return this.items.filter(function (item) {\n", " return item.active === true;\n", " });\n", " }\n", " /**\n", " * Get highlighted items from store\n", " * @returns {Item[]} Item objects\n", " */\n", " }, {\n", " key: \"highlightedActiveItems\",\n", " get: function get() {\n", " return this.items.filter(function (item) {\n", " return item.active && item.highlighted;\n", " });\n", " }\n", " /**\n", " * Get choices from store\n", " * @returns {Choice[]} Option objects\n", " */\n", " }, {\n", " key: \"choices\",\n", " get: function get() {\n", " return this.state.choices;\n", " }\n", " /**\n", " * Get active choices from store\n", " * @returns {Choice[]} Option objects\n", " */\n", " }, {\n", " key: \"activeChoices\",\n", " get: function get() {\n", " return this.choices.filter(function (choice) {\n", " return choice.active === true;\n", " });\n", " }\n", " /**\n", " * Get selectable choices from store\n", " * @returns {Choice[]} Option objects\n", " */\n", " }, {\n", " key: \"selectableChoices\",\n", " get: function get() {\n", " return this.choices.filter(function (choice) {\n", " return choice.disabled !== true;\n", " });\n", " }\n", " /**\n", " * Get choices that can be searched (excluding placeholders)\n", " * @returns {Choice[]} Option objects\n", " */\n", " }, {\n", " key: \"searchableChoices\",\n", " get: function get() {\n", " return this.selectableChoices.filter(function (choice) {\n", " return choice.placeholder !== true;\n", " });\n", " }\n", " /**\n", " * Get placeholder choice from store\n", " * @returns {Choice | undefined} Found placeholder\n", " */\n", " }, {\n", " key: \"placeholderChoice\",\n", " get: function get() {\n", " return [].concat(this.choices).reverse().find(function (choice) {\n", " return choice.placeholder === true;\n", " });\n", " }\n", " /**\n", " * Get groups from store\n", " * @returns {Group[]} Group objects\n", " */\n", " }, {\n", " key: \"groups\",\n", " get: function get() {\n", " return this.state.groups;\n", " }\n", " /**\n", " * Get active groups from store\n", " * @returns {Group[]} Group objects\n", " */\n", " }, {\n", " key: \"activeGroups\",\n", " get: function get() {\n", " var groups = this.groups, choices = this.choices;\n", " return groups.filter(function (group) {\n", " var isActive = group.active === true && group.disabled === false;\n", " var hasActiveOptions = choices.some(function (choice) {\n", " return choice.active === true && choice.disabled === false;\n", " });\n", " return isActive && hasActiveOptions;\n", " }, []);\n", " }\n", " }]);\n", " return Store;\n", " }();\n", " // CONCATENATED MODULE: ./src/scripts/components/dropdown.js\n", " function dropdown_defineProperties(target, props) { for (var i = 0; i < props.length; i++) {\n", " var descriptor = props[i];\n", " descriptor.enumerable = descriptor.enumerable || false;\n", " descriptor.configurable = true;\n", " if (\"value\" in descriptor)\n", " descriptor.writable = true;\n", " Object.defineProperty(target, descriptor.key, descriptor);\n", " } }\n", " function dropdown_createClass(Constructor, protoProps, staticProps) { if (protoProps)\n", " dropdown_defineProperties(Constructor.prototype, protoProps); if (staticProps)\n", " dropdown_defineProperties(Constructor, staticProps); return Constructor; }\n", " /**\n", " * @typedef {import('../../../types/index').Choices.passedElement} passedElement\n", " * @typedef {import('../../../types/index').Choices.ClassNames} ClassNames\n", " */\n", " var Dropdown = \n", " /*#__PURE__*/\n", " function () {\n", " /**\n", " * @param {{\n", " * element: HTMLElement,\n", " * type: passedElement['type'],\n", " * classNames: ClassNames,\n", " * }} args\n", " */\n", " function Dropdown(_ref) {\n", " var element = _ref.element, type = _ref.type, classNames = _ref.classNames;\n", " this.element = element;\n", " this.classNames = classNames;\n", " this.type = type;\n", " this.isActive = false;\n", " }\n", " /**\n", " * Bottom position of dropdown in viewport coordinates\n", " * @returns {number} Vertical position\n", " */\n", " var _proto = Dropdown.prototype;\n", " /**\n", " * Find element that matches passed selector\n", " * @param {string} selector\n", " * @returns {HTMLElement | null}\n", " */\n", " _proto.getChild = function getChild(selector) {\n", " return this.element.querySelector(selector);\n", " };\n", " _proto.show = function show() {\n", " this.element.classList.add(this.classNames.activeState);\n", " this.element.setAttribute('aria-expanded', 'true');\n", " this.isActive = true;\n", " return this;\n", " };\n", " _proto.hide = function hide() {\n", " this.element.classList.remove(this.classNames.activeState);\n", " this.element.setAttribute('aria-expanded', 'false');\n", " this.isActive = false;\n", " return this;\n", " };\n", " dropdown_createClass(Dropdown, [{\n", " key: \"distanceFromTopWindow\",\n", " get: function get() {\n", " return this.element.getBoundingClientRect().bottom;\n", " }\n", " }]);\n", " return Dropdown;\n", " }();\n", " // CONCATENATED MODULE: ./src/scripts/constants.js\n", " /**\n", " * @typedef {import('../../types/index').Choices.ClassNames} ClassNames\n", " * @typedef {import('../../types/index').Choices.Options} Options\n", " */\n", " /** @type {ClassNames} */\n", " var DEFAULT_CLASSNAMES = {\n", " containerOuter: 'choices',\n", " containerInner: 'choices__inner',\n", " input: 'choices__input',\n", " inputCloned: 'choices__input--cloned',\n", " list: 'choices__list',\n", " listItems: 'choices__list--multiple',\n", " listSingle: 'choices__list--single',\n", " listDropdown: 'choices__list--dropdown',\n", " item: 'choices__item',\n", " itemSelectable: 'choices__item--selectable',\n", " itemDisabled: 'choices__item--disabled',\n", " itemChoice: 'choices__item--choice',\n", " placeholder: 'choices__placeholder',\n", " group: 'choices__group',\n", " groupHeading: 'choices__heading',\n", " button: 'choices__button',\n", " activeState: 'is-active',\n", " focusState: 'is-focused',\n", " openState: 'is-open',\n", " disabledState: 'is-disabled',\n", " highlightedState: 'is-highlighted',\n", " selectedState: 'is-selected',\n", " flippedState: 'is-flipped',\n", " loadingState: 'is-loading',\n", " noResults: 'has-no-results',\n", " noChoices: 'has-no-choices'\n", " };\n", " /** @type {Options} */\n", " var DEFAULT_CONFIG = {\n", " items: [],\n", " choices: [],\n", " silent: false,\n", " renderChoiceLimit: -1,\n", " maxItemCount: -1,\n", " addItems: true,\n", " addItemFilter: null,\n", " removeItems: true,\n", " removeItemButton: false,\n", " editItems: false,\n", " duplicateItemsAllowed: true,\n", " delimiter: ',',\n", " paste: true,\n", " searchEnabled: true,\n", " searchChoices: true,\n", " searchFloor: 1,\n", " searchResultLimit: 4,\n", " searchFields: ['label', 'value'],\n", " position: 'auto',\n", " resetScrollPosition: true,\n", " shouldSort: true,\n", " shouldSortItems: false,\n", " sorter: sortByAlpha,\n", " placeholder: true,\n", " placeholderValue: null,\n", " searchPlaceholderValue: null,\n", " prependValue: null,\n", " appendValue: null,\n", " renderSelectedChoices: 'auto',\n", " loadingText: 'Loading...',\n", " noResultsText: 'No results found',\n", " noChoicesText: 'No choices to choose from',\n", " itemSelectText: 'Press to select',\n", " uniqueItemText: 'Only unique values can be added',\n", " customAddItemText: 'Only values matching specific conditions can be added',\n", " addItemText: function addItemText(value) {\n", " return \"Press Enter to add \\\"\" + sanitise(value) + \"\\\"\";\n", " },\n", " maxItemText: function maxItemText(maxItemCount) {\n", " return \"Only \" + maxItemCount + \" values can be added\";\n", " },\n", " valueComparer: function valueComparer(value1, value2) {\n", " return value1 === value2;\n", " },\n", " fuseOptions: {\n", " includeScore: true\n", " },\n", " callbackOnInit: null,\n", " callbackOnCreateTemplates: null,\n", " classNames: DEFAULT_CLASSNAMES\n", " };\n", " var EVENTS = {\n", " showDropdown: 'showDropdown',\n", " hideDropdown: 'hideDropdown',\n", " change: 'change',\n", " choice: 'choice',\n", " search: 'search',\n", " addItem: 'addItem',\n", " removeItem: 'removeItem',\n", " highlightItem: 'highlightItem',\n", " highlightChoice: 'highlightChoice'\n", " };\n", " var ACTION_TYPES = {\n", " ADD_CHOICE: 'ADD_CHOICE',\n", " FILTER_CHOICES: 'FILTER_CHOICES',\n", " ACTIVATE_CHOICES: 'ACTIVATE_CHOICES',\n", " CLEAR_CHOICES: 'CLEAR_CHOICES',\n", " ADD_GROUP: 'ADD_GROUP',\n", " ADD_ITEM: 'ADD_ITEM',\n", " REMOVE_ITEM: 'REMOVE_ITEM',\n", " HIGHLIGHT_ITEM: 'HIGHLIGHT_ITEM',\n", " CLEAR_ALL: 'CLEAR_ALL'\n", " };\n", " var KEY_CODES = {\n", " BACK_KEY: 46,\n", " DELETE_KEY: 8,\n", " ENTER_KEY: 13,\n", " A_KEY: 65,\n", " ESC_KEY: 27,\n", " UP_KEY: 38,\n", " DOWN_KEY: 40,\n", " PAGE_UP_KEY: 33,\n", " PAGE_DOWN_KEY: 34\n", " };\n", " var TEXT_TYPE = 'text';\n", " var SELECT_ONE_TYPE = 'select-one';\n", " var SELECT_MULTIPLE_TYPE = 'select-multiple';\n", " var SCROLLING_SPEED = 4;\n", " // CONCATENATED MODULE: ./src/scripts/components/container.js\n", " /**\n", " * @typedef {import('../../../types/index').Choices.passedElement} passedElement\n", " * @typedef {import('../../../types/index').Choices.ClassNames} ClassNames\n", " */\n", " var container_Container = \n", " /*#__PURE__*/\n", " function () {\n", " /**\n", " * @param {{\n", " * element: HTMLElement,\n", " * type: passedElement['type'],\n", " * classNames: ClassNames,\n", " * position\n", " * }} args\n", " */\n", " function Container(_ref) {\n", " var element = _ref.element, type = _ref.type, classNames = _ref.classNames, position = _ref.position;\n", " this.element = element;\n", " this.classNames = classNames;\n", " this.type = type;\n", " this.position = position;\n", " this.isOpen = false;\n", " this.isFlipped = false;\n", " this.isFocussed = false;\n", " this.isDisabled = false;\n", " this.isLoading = false;\n", " this._onFocus = this._onFocus.bind(this);\n", " this._onBlur = this._onBlur.bind(this);\n", " }\n", " var _proto = Container.prototype;\n", " _proto.addEventListeners = function addEventListeners() {\n", " this.element.addEventListener('focus', this._onFocus);\n", " this.element.addEventListener('blur', this._onBlur);\n", " };\n", " _proto.removeEventListeners = function removeEventListeners() {\n", " this.element.removeEventListener('focus', this._onFocus);\n", " this.element.removeEventListener('blur', this._onBlur);\n", " };\n", " _proto.shouldFlip = function shouldFlip(dropdownPos) {\n", " if (typeof dropdownPos !== 'number') {\n", " return false;\n", " } // If flip is enabled and the dropdown bottom position is\n", " // greater than the window height flip the dropdown.\n", " var shouldFlip = false;\n", " if (this.position === 'auto') {\n", " shouldFlip = !window.matchMedia(\"(min-height: \" + (dropdownPos + 1) + \"px)\").matches;\n", " }\n", " else if (this.position === 'top') {\n", " shouldFlip = true;\n", " }\n", " return shouldFlip;\n", " };\n", " _proto.setActiveDescendant = function setActiveDescendant(activeDescendantID) {\n", " this.element.setAttribute('aria-activedescendant', activeDescendantID);\n", " };\n", " _proto.removeActiveDescendant = function removeActiveDescendant() {\n", " this.element.removeAttribute('aria-activedescendant');\n", " };\n", " _proto.open = function open(dropdownPos) {\n", " this.element.classList.add(this.classNames.openState);\n", " this.element.setAttribute('aria-expanded', 'true');\n", " this.isOpen = true;\n", " if (this.shouldFlip(dropdownPos)) {\n", " this.element.classList.add(this.classNames.flippedState);\n", " this.isFlipped = true;\n", " }\n", " };\n", " _proto.close = function close() {\n", " this.element.classList.remove(this.classNames.openState);\n", " this.element.setAttribute('aria-expanded', 'false');\n", " this.removeActiveDescendant();\n", " this.isOpen = false; // A dropdown flips if it does not have space within the page\n", " if (this.isFlipped) {\n", " this.element.classList.remove(this.classNames.flippedState);\n", " this.isFlipped = false;\n", " }\n", " };\n", " _proto.focus = function focus() {\n", " if (!this.isFocussed) {\n", " this.element.focus();\n", " }\n", " };\n", " _proto.addFocusState = function addFocusState() {\n", " this.element.classList.add(this.classNames.focusState);\n", " };\n", " _proto.removeFocusState = function removeFocusState() {\n", " this.element.classList.remove(this.classNames.focusState);\n", " };\n", " _proto.enable = function enable() {\n", " this.element.classList.remove(this.classNames.disabledState);\n", " this.element.removeAttribute('aria-disabled');\n", " if (this.type === SELECT_ONE_TYPE) {\n", " this.element.setAttribute('tabindex', '0');\n", " }\n", " this.isDisabled = false;\n", " };\n", " _proto.disable = function disable() {\n", " this.element.classList.add(this.classNames.disabledState);\n", " this.element.setAttribute('aria-disabled', 'true');\n", " if (this.type === SELECT_ONE_TYPE) {\n", " this.element.setAttribute('tabindex', '-1');\n", " }\n", " this.isDisabled = true;\n", " };\n", " _proto.wrap = function wrap(element) {\n", " utils_wrap(element, this.element);\n", " };\n", " _proto.unwrap = function unwrap(element) {\n", " // Move passed element outside this element\n", " this.element.parentNode.insertBefore(element, this.element); // Remove this element\n", " this.element.parentNode.removeChild(this.element);\n", " };\n", " _proto.addLoadingState = function addLoadingState() {\n", " this.element.classList.add(this.classNames.loadingState);\n", " this.element.setAttribute('aria-busy', 'true');\n", " this.isLoading = true;\n", " };\n", " _proto.removeLoadingState = function removeLoadingState() {\n", " this.element.classList.remove(this.classNames.loadingState);\n", " this.element.removeAttribute('aria-busy');\n", " this.isLoading = false;\n", " };\n", " _proto._onFocus = function _onFocus() {\n", " this.isFocussed = true;\n", " };\n", " _proto._onBlur = function _onBlur() {\n", " this.isFocussed = false;\n", " };\n", " return Container;\n", " }();\n", " // CONCATENATED MODULE: ./src/scripts/components/input.js\n", " function input_defineProperties(target, props) { for (var i = 0; i < props.length; i++) {\n", " var descriptor = props[i];\n", " descriptor.enumerable = descriptor.enumerable || false;\n", " descriptor.configurable = true;\n", " if (\"value\" in descriptor)\n", " descriptor.writable = true;\n", " Object.defineProperty(target, descriptor.key, descriptor);\n", " } }\n", " function input_createClass(Constructor, protoProps, staticProps) { if (protoProps)\n", " input_defineProperties(Constructor.prototype, protoProps); if (staticProps)\n", " input_defineProperties(Constructor, staticProps); return Constructor; }\n", " /**\n", " * @typedef {import('../../../types/index').Choices.passedElement} passedElement\n", " * @typedef {import('../../../types/index').Choices.ClassNames} ClassNames\n", " */\n", " var input_Input = \n", " /*#__PURE__*/\n", " function () {\n", " /**\n", " * @param {{\n", " * element: HTMLInputElement,\n", " * type: passedElement['type'],\n", " * classNames: ClassNames,\n", " * preventPaste: boolean\n", " * }} args\n", " */\n", " function Input(_ref) {\n", " var element = _ref.element, type = _ref.type, classNames = _ref.classNames, preventPaste = _ref.preventPaste;\n", " this.element = element;\n", " this.type = type;\n", " this.classNames = classNames;\n", " this.preventPaste = preventPaste;\n", " this.isFocussed = this.element === document.activeElement;\n", " this.isDisabled = element.disabled;\n", " this._onPaste = this._onPaste.bind(this);\n", " this._onInput = this._onInput.bind(this);\n", " this._onFocus = this._onFocus.bind(this);\n", " this._onBlur = this._onBlur.bind(this);\n", " }\n", " /**\n", " * @param {string} placeholder\n", " */\n", " var _proto = Input.prototype;\n", " _proto.addEventListeners = function addEventListeners() {\n", " this.element.addEventListener('paste', this._onPaste);\n", " this.element.addEventListener('input', this._onInput, {\n", " passive: true\n", " });\n", " this.element.addEventListener('focus', this._onFocus, {\n", " passive: true\n", " });\n", " this.element.addEventListener('blur', this._onBlur, {\n", " passive: true\n", " });\n", " };\n", " _proto.removeEventListeners = function removeEventListeners() {\n", " this.element.removeEventListener('input', this._onInput, {\n", " passive: true\n", " });\n", " this.element.removeEventListener('paste', this._onPaste);\n", " this.element.removeEventListener('focus', this._onFocus, {\n", " passive: true\n", " });\n", " this.element.removeEventListener('blur', this._onBlur, {\n", " passive: true\n", " });\n", " };\n", " _proto.enable = function enable() {\n", " this.element.removeAttribute('disabled');\n", " this.isDisabled = false;\n", " };\n", " _proto.disable = function disable() {\n", " this.element.setAttribute('disabled', '');\n", " this.isDisabled = true;\n", " };\n", " _proto.focus = function focus() {\n", " if (!this.isFocussed) {\n", " this.element.focus();\n", " }\n", " };\n", " _proto.blur = function blur() {\n", " if (this.isFocussed) {\n", " this.element.blur();\n", " }\n", " };\n", " _proto.clear = function clear(setWidth) {\n", " if (setWidth === void 0) {\n", " setWidth = true;\n", " }\n", " if (this.element.value) {\n", " this.element.value = '';\n", " }\n", " if (setWidth) {\n", " this.setWidth();\n", " }\n", " return this;\n", " };\n", " _proto.setWidth = function setWidth() {\n", " // Resize input to contents or placeholder\n", " var _this$element = this.element, style = _this$element.style, value = _this$element.value, placeholder = _this$element.placeholder;\n", " style.minWidth = placeholder.length + 1 + \"ch\";\n", " style.width = value.length + 1 + \"ch\";\n", " };\n", " _proto.setActiveDescendant = function setActiveDescendant(activeDescendantID) {\n", " this.element.setAttribute('aria-activedescendant', activeDescendantID);\n", " };\n", " _proto.removeActiveDescendant = function removeActiveDescendant() {\n", " this.element.removeAttribute('aria-activedescendant');\n", " };\n", " _proto._onInput = function _onInput() {\n", " if (this.type !== SELECT_ONE_TYPE) {\n", " this.setWidth();\n", " }\n", " };\n", " _proto._onPaste = function _onPaste(event) {\n", " if (this.preventPaste) {\n", " event.preventDefault();\n", " }\n", " };\n", " _proto._onFocus = function _onFocus() {\n", " this.isFocussed = true;\n", " };\n", " _proto._onBlur = function _onBlur() {\n", " this.isFocussed = false;\n", " };\n", " input_createClass(Input, [{\n", " key: \"placeholder\",\n", " set: function set(placeholder) {\n", " this.element.placeholder = placeholder;\n", " }\n", " /**\n", " * @returns {string}\n", " */\n", " }, {\n", " key: \"value\",\n", " get: function get() {\n", " return sanitise(this.element.value);\n", " }\n", " /**\n", " * @param {string} value\n", " */\n", " ,\n", " set: function set(value) {\n", " this.element.value = value;\n", " }\n", " }]);\n", " return Input;\n", " }();\n", " // CONCATENATED MODULE: ./src/scripts/components/list.js\n", " /**\n", " * @typedef {import('../../../types/index').Choices.Choice} Choice\n", " */\n", " var list_List = \n", " /*#__PURE__*/\n", " function () {\n", " /**\n", " * @param {{ element: HTMLElement }} args\n", " */\n", " function List(_ref) {\n", " var element = _ref.element;\n", " this.element = element;\n", " this.scrollPos = this.element.scrollTop;\n", " this.height = this.element.offsetHeight;\n", " }\n", " var _proto = List.prototype;\n", " _proto.clear = function clear() {\n", " this.element.innerHTML = '';\n", " };\n", " _proto.append = function append(node) {\n", " this.element.appendChild(node);\n", " };\n", " _proto.getChild = function getChild(selector) {\n", " return this.element.querySelector(selector);\n", " };\n", " _proto.hasChildren = function hasChildren() {\n", " return this.element.hasChildNodes();\n", " };\n", " _proto.scrollToTop = function scrollToTop() {\n", " this.element.scrollTop = 0;\n", " };\n", " _proto.scrollToChildElement = function scrollToChildElement(element, direction) {\n", " var _this = this;\n", " if (!element) {\n", " return;\n", " }\n", " var listHeight = this.element.offsetHeight; // Scroll position of dropdown\n", " var listScrollPosition = this.element.scrollTop + listHeight;\n", " var elementHeight = element.offsetHeight; // Distance from bottom of element to top of parent\n", " var elementPos = element.offsetTop + elementHeight; // Difference between the element and scroll position\n", " var destination = direction > 0 ? this.element.scrollTop + elementPos - listScrollPosition : element.offsetTop;\n", " requestAnimationFrame(function () {\n", " _this._animateScroll(destination, direction);\n", " });\n", " };\n", " _proto._scrollDown = function _scrollDown(scrollPos, strength, destination) {\n", " var easing = (destination - scrollPos) / strength;\n", " var distance = easing > 1 ? easing : 1;\n", " this.element.scrollTop = scrollPos + distance;\n", " };\n", " _proto._scrollUp = function _scrollUp(scrollPos, strength, destination) {\n", " var easing = (scrollPos - destination) / strength;\n", " var distance = easing > 1 ? easing : 1;\n", " this.element.scrollTop = scrollPos - distance;\n", " };\n", " _proto._animateScroll = function _animateScroll(destination, direction) {\n", " var _this2 = this;\n", " var strength = SCROLLING_SPEED;\n", " var choiceListScrollTop = this.element.scrollTop;\n", " var continueAnimation = false;\n", " if (direction > 0) {\n", " this._scrollDown(choiceListScrollTop, strength, destination);\n", " if (choiceListScrollTop < destination) {\n", " continueAnimation = true;\n", " }\n", " }\n", " else {\n", " this._scrollUp(choiceListScrollTop, strength, destination);\n", " if (choiceListScrollTop > destination) {\n", " continueAnimation = true;\n", " }\n", " }\n", " if (continueAnimation) {\n", " requestAnimationFrame(function () {\n", " _this2._animateScroll(destination, direction);\n", " });\n", " }\n", " };\n", " return List;\n", " }();\n", " // CONCATENATED MODULE: ./src/scripts/components/wrapped-element.js\n", " function wrapped_element_defineProperties(target, props) { for (var i = 0; i < props.length; i++) {\n", " var descriptor = props[i];\n", " descriptor.enumerable = descriptor.enumerable || false;\n", " descriptor.configurable = true;\n", " if (\"value\" in descriptor)\n", " descriptor.writable = true;\n", " Object.defineProperty(target, descriptor.key, descriptor);\n", " } }\n", " function wrapped_element_createClass(Constructor, protoProps, staticProps) { if (protoProps)\n", " wrapped_element_defineProperties(Constructor.prototype, protoProps); if (staticProps)\n", " wrapped_element_defineProperties(Constructor, staticProps); return Constructor; }\n", " /**\n", " * @typedef {import('../../../types/index').Choices.passedElement} passedElement\n", " * @typedef {import('../../../types/index').Choices.ClassNames} ClassNames\n", " */\n", " var wrapped_element_WrappedElement = \n", " /*#__PURE__*/\n", " function () {\n", " /**\n", " * @param {{\n", " * element: HTMLInputElement | HTMLSelectElement,\n", " * classNames: ClassNames,\n", " * }} args\n", " */\n", " function WrappedElement(_ref) {\n", " var element = _ref.element, classNames = _ref.classNames;\n", " this.element = element;\n", " this.classNames = classNames;\n", " if (!(element instanceof HTMLInputElement) && !(element instanceof HTMLSelectElement)) {\n", " throw new TypeError('Invalid element passed');\n", " }\n", " this.isDisabled = false;\n", " }\n", " var _proto = WrappedElement.prototype;\n", " _proto.conceal = function conceal() {\n", " // Hide passed input\n", " this.element.classList.add(this.classNames.input);\n", " this.element.hidden = true; // Remove element from tab index\n", " this.element.tabIndex = -1; // Backup original styles if any\n", " var origStyle = this.element.getAttribute('style');\n", " if (origStyle) {\n", " this.element.setAttribute('data-choice-orig-style', origStyle);\n", " }\n", " this.element.setAttribute('data-choice', 'active');\n", " };\n", " _proto.reveal = function reveal() {\n", " // Reinstate passed element\n", " this.element.classList.remove(this.classNames.input);\n", " this.element.hidden = false;\n", " this.element.removeAttribute('tabindex'); // Recover original styles if any\n", " var origStyle = this.element.getAttribute('data-choice-orig-style');\n", " if (origStyle) {\n", " this.element.removeAttribute('data-choice-orig-style');\n", " this.element.setAttribute('style', origStyle);\n", " }\n", " else {\n", " this.element.removeAttribute('style');\n", " }\n", " this.element.removeAttribute('data-choice'); // Re-assign values - this is weird, I know\n", " // @todo Figure out why we need to do this\n", " this.element.value = this.element.value; // eslint-disable-line no-self-assign\n", " };\n", " _proto.enable = function enable() {\n", " this.element.removeAttribute('disabled');\n", " this.element.disabled = false;\n", " this.isDisabled = false;\n", " };\n", " _proto.disable = function disable() {\n", " this.element.setAttribute('disabled', '');\n", " this.element.disabled = true;\n", " this.isDisabled = true;\n", " };\n", " _proto.triggerEvent = function triggerEvent(eventType, data) {\n", " dispatchEvent(this.element, eventType, data);\n", " };\n", " wrapped_element_createClass(WrappedElement, [{\n", " key: \"isActive\",\n", " get: function get() {\n", " return this.element.dataset.choice === 'active';\n", " }\n", " }, {\n", " key: \"dir\",\n", " get: function get() {\n", " return this.element.dir;\n", " }\n", " }, {\n", " key: \"value\",\n", " get: function get() {\n", " return this.element.value;\n", " },\n", " set: function set(value) {\n", " // you must define setter here otherwise it will be readonly property\n", " this.element.value = value;\n", " }\n", " }]);\n", " return WrappedElement;\n", " }();\n", " // CONCATENATED MODULE: ./src/scripts/components/wrapped-input.js\n", " function wrapped_input_defineProperties(target, props) { for (var i = 0; i < props.length; i++) {\n", " var descriptor = props[i];\n", " descriptor.enumerable = descriptor.enumerable || false;\n", " descriptor.configurable = true;\n", " if (\"value\" in descriptor)\n", " descriptor.writable = true;\n", " Object.defineProperty(target, descriptor.key, descriptor);\n", " } }\n", " function wrapped_input_createClass(Constructor, protoProps, staticProps) { if (protoProps)\n", " wrapped_input_defineProperties(Constructor.prototype, protoProps); if (staticProps)\n", " wrapped_input_defineProperties(Constructor, staticProps); return Constructor; }\n", " function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n", " /**\n", " * @typedef {import('../../../types/index').Choices.ClassNames} ClassNames\n", " * @typedef {import('../../../types/index').Choices.Item} Item\n", " */\n", " var WrappedInput = \n", " /*#__PURE__*/\n", " function (_WrappedElement) {\n", " _inheritsLoose(WrappedInput, _WrappedElement);\n", " /**\n", " * @param {{\n", " * element: HTMLInputElement,\n", " * classNames: ClassNames,\n", " * delimiter: string\n", " * }} args\n", " */\n", " function WrappedInput(_ref) {\n", " var _this;\n", " var element = _ref.element, classNames = _ref.classNames, delimiter = _ref.delimiter;\n", " _this = _WrappedElement.call(this, {\n", " element: element,\n", " classNames: classNames\n", " }) || this;\n", " _this.delimiter = delimiter;\n", " return _this;\n", " }\n", " /**\n", " * @returns {string}\n", " */\n", " wrapped_input_createClass(WrappedInput, [{\n", " key: \"value\",\n", " get: function get() {\n", " return this.element.value;\n", " }\n", " /**\n", " * @param {Item[]} items\n", " */\n", " ,\n", " set: function set(items) {\n", " var itemValues = items.map(function (_ref2) {\n", " var value = _ref2.value;\n", " return value;\n", " });\n", " var joinedValues = itemValues.join(this.delimiter);\n", " this.element.setAttribute('value', joinedValues);\n", " this.element.value = joinedValues;\n", " }\n", " }]);\n", " return WrappedInput;\n", " }(wrapped_element_WrappedElement);\n", " // CONCATENATED MODULE: ./src/scripts/components/wrapped-select.js\n", " function wrapped_select_defineProperties(target, props) { for (var i = 0; i < props.length; i++) {\n", " var descriptor = props[i];\n", " descriptor.enumerable = descriptor.enumerable || false;\n", " descriptor.configurable = true;\n", " if (\"value\" in descriptor)\n", " descriptor.writable = true;\n", " Object.defineProperty(target, descriptor.key, descriptor);\n", " } }\n", " function wrapped_select_createClass(Constructor, protoProps, staticProps) { if (protoProps)\n", " wrapped_select_defineProperties(Constructor.prototype, protoProps); if (staticProps)\n", " wrapped_select_defineProperties(Constructor, staticProps); return Constructor; }\n", " function wrapped_select_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n", " /**\n", " * @typedef {import('../../../types/index').Choices.ClassNames} ClassNames\n", " * @typedef {import('../../../types/index').Choices.Item} Item\n", " * @typedef {import('../../../types/index').Choices.Choice} Choice\n", " */\n", " var WrappedSelect = \n", " /*#__PURE__*/\n", " function (_WrappedElement) {\n", " wrapped_select_inheritsLoose(WrappedSelect, _WrappedElement);\n", " /**\n", " * @param {{\n", " * element: HTMLSelectElement,\n", " * classNames: ClassNames,\n", " * delimiter: string\n", " * template: function\n", " * }} args\n", " */\n", " function WrappedSelect(_ref) {\n", " var _this;\n", " var element = _ref.element, classNames = _ref.classNames, template = _ref.template;\n", " _this = _WrappedElement.call(this, {\n", " element: element,\n", " classNames: classNames\n", " }) || this;\n", " _this.template = template;\n", " return _this;\n", " }\n", " var _proto = WrappedSelect.prototype;\n", " /**\n", " * @param {DocumentFragment} fragment\n", " */\n", " _proto.appendDocFragment = function appendDocFragment(fragment) {\n", " this.element.innerHTML = '';\n", " this.element.appendChild(fragment);\n", " };\n", " wrapped_select_createClass(WrappedSelect, [{\n", " key: \"placeholderOption\",\n", " get: function get() {\n", " return this.element.querySelector('option[value=\"\"]') || // Backward compatibility layer for the non-standard placeholder attribute supported in older versions.\n", " this.element.querySelector('option[placeholder]');\n", " }\n", " /**\n", " * @returns {Element[]}\n", " */\n", " }, {\n", " key: \"optionGroups\",\n", " get: function get() {\n", " return Array.from(this.element.getElementsByTagName('OPTGROUP'));\n", " }\n", " /**\n", " * @returns {Item[] | Choice[]}\n", " */\n", " }, {\n", " key: \"options\",\n", " get: function get() {\n", " return Array.from(this.element.options);\n", " }\n", " /**\n", " * @param {Item[] | Choice[]} options\n", " */\n", " ,\n", " set: function set(options) {\n", " var _this2 = this;\n", " var fragment = document.createDocumentFragment();\n", " var addOptionToFragment = function addOptionToFragment(data) {\n", " // Create a standard select option\n", " var option = _this2.template(data); // Append it to fragment\n", " fragment.appendChild(option);\n", " }; // Add each list item to list\n", " options.forEach(function (optionData) {\n", " return addOptionToFragment(optionData);\n", " });\n", " this.appendDocFragment(fragment);\n", " }\n", " }]);\n", " return WrappedSelect;\n", " }(wrapped_element_WrappedElement);\n", " // CONCATENATED MODULE: ./src/scripts/components/index.js\n", " // CONCATENATED MODULE: ./src/scripts/templates.js\n", " /**\n", " * Helpers to create HTML elements used by Choices\n", " * Can be overridden by providing `callbackOnCreateTemplates` option\n", " * @typedef {import('../../types/index').Choices.Templates} Templates\n", " * @typedef {import('../../types/index').Choices.ClassNames} ClassNames\n", " * @typedef {import('../../types/index').Choices.Options} Options\n", " * @typedef {import('../../types/index').Choices.Item} Item\n", " * @typedef {import('../../types/index').Choices.Choice} Choice\n", " * @typedef {import('../../types/index').Choices.Group} Group\n", " */\n", " var TEMPLATES = \n", " /** @type {Templates} */\n", " {\n", " /**\n", " * @param {Partial} classNames\n", " * @param {\"ltr\" | \"rtl\" | \"auto\"} dir\n", " * @param {boolean} isSelectElement\n", " * @param {boolean} isSelectOneElement\n", " * @param {boolean} searchEnabled\n", " * @param {\"select-one\" | \"select-multiple\" | \"text\"} passedElementType\n", " */\n", " containerOuter: function containerOuter(_ref, dir, isSelectElement, isSelectOneElement, searchEnabled, passedElementType) {\n", " var _containerOuter = _ref.containerOuter;\n", " var div = Object.assign(document.createElement('div'), {\n", " className: _containerOuter\n", " });\n", " div.dataset.type = passedElementType;\n", " if (dir) {\n", " div.dir = dir;\n", " }\n", " if (isSelectOneElement) {\n", " div.tabIndex = 0;\n", " }\n", " if (isSelectElement) {\n", " div.setAttribute('role', searchEnabled ? 'combobox' : 'listbox');\n", " if (searchEnabled) {\n", " div.setAttribute('aria-autocomplete', 'list');\n", " }\n", " }\n", " div.setAttribute('aria-haspopup', 'true');\n", " div.setAttribute('aria-expanded', 'false');\n", " return div;\n", " },\n", " /**\n", " * @param {Partial} classNames\n", " */\n", " containerInner: function containerInner(_ref2) {\n", " var _containerInner = _ref2.containerInner;\n", " return Object.assign(document.createElement('div'), {\n", " className: _containerInner\n", " });\n", " },\n", " /**\n", " * @param {Partial} classNames\n", " * @param {boolean} isSelectOneElement\n", " */\n", " itemList: function itemList(_ref3, isSelectOneElement) {\n", " var list = _ref3.list, listSingle = _ref3.listSingle, listItems = _ref3.listItems;\n", " return Object.assign(document.createElement('div'), {\n", " className: list + \" \" + (isSelectOneElement ? listSingle : listItems)\n", " });\n", " },\n", " /**\n", " * @param {Partial} classNames\n", " * @param {string} value\n", " */\n", " placeholder: function placeholder(_ref4, value) {\n", " var _placeholder = _ref4.placeholder;\n", " return Object.assign(document.createElement('div'), {\n", " className: _placeholder,\n", " innerHTML: value\n", " });\n", " },\n", " /**\n", " * @param {Partial} classNames\n", " * @param {Item} item\n", " * @param {boolean} removeItemButton\n", " */\n", " item: function item(_ref5, _ref6, removeItemButton) {\n", " var _item = _ref5.item, button = _ref5.button, highlightedState = _ref5.highlightedState, itemSelectable = _ref5.itemSelectable, placeholder = _ref5.placeholder;\n", " var id = _ref6.id, value = _ref6.value, label = _ref6.label, customProperties = _ref6.customProperties, active = _ref6.active, disabled = _ref6.disabled, highlighted = _ref6.highlighted, isPlaceholder = _ref6.placeholder;\n", " var div = Object.assign(document.createElement('div'), {\n", " className: _item,\n", " innerHTML: label\n", " });\n", " Object.assign(div.dataset, {\n", " item: '',\n", " id: id,\n", " value: value,\n", " customProperties: customProperties\n", " });\n", " if (active) {\n", " div.setAttribute('aria-selected', 'true');\n", " }\n", " if (disabled) {\n", " div.setAttribute('aria-disabled', 'true');\n", " }\n", " if (isPlaceholder) {\n", " div.classList.add(placeholder);\n", " }\n", " div.classList.add(highlighted ? highlightedState : itemSelectable);\n", " if (removeItemButton) {\n", " if (disabled) {\n", " div.classList.remove(itemSelectable);\n", " }\n", " div.dataset.deletable = '';\n", " /** @todo This MUST be localizable, not hardcoded! */\n", " var REMOVE_ITEM_TEXT = 'Remove item';\n", " var removeButton = Object.assign(document.createElement('button'), {\n", " type: 'button',\n", " className: button,\n", " innerHTML: REMOVE_ITEM_TEXT\n", " });\n", " removeButton.setAttribute('aria-label', REMOVE_ITEM_TEXT + \": '\" + value + \"'\");\n", " removeButton.dataset.button = '';\n", " div.appendChild(removeButton);\n", " }\n", " return div;\n", " },\n", " /**\n", " * @param {Partial} classNames\n", " * @param {boolean} isSelectOneElement\n", " */\n", " choiceList: function choiceList(_ref7, isSelectOneElement) {\n", " var list = _ref7.list;\n", " var div = Object.assign(document.createElement('div'), {\n", " className: list\n", " });\n", " if (!isSelectOneElement) {\n", " div.setAttribute('aria-multiselectable', 'true');\n", " }\n", " div.setAttribute('role', 'listbox');\n", " return div;\n", " },\n", " /**\n", " * @param {Partial} classNames\n", " * @param {Group} group\n", " */\n", " choiceGroup: function choiceGroup(_ref8, _ref9) {\n", " var group = _ref8.group, groupHeading = _ref8.groupHeading, itemDisabled = _ref8.itemDisabled;\n", " var id = _ref9.id, value = _ref9.value, disabled = _ref9.disabled;\n", " var div = Object.assign(document.createElement('div'), {\n", " className: group + \" \" + (disabled ? itemDisabled : '')\n", " });\n", " div.setAttribute('role', 'group');\n", " Object.assign(div.dataset, {\n", " group: '',\n", " id: id,\n", " value: value\n", " });\n", " if (disabled) {\n", " div.setAttribute('aria-disabled', 'true');\n", " }\n", " div.appendChild(Object.assign(document.createElement('div'), {\n", " className: groupHeading,\n", " innerHTML: value\n", " }));\n", " return div;\n", " },\n", " /**\n", " * @param {Partial} classNames\n", " * @param {Choice} choice\n", " * @param {Options['itemSelectText']} selectText\n", " */\n", " choice: function choice(_ref10, _ref11, selectText) {\n", " var item = _ref10.item, itemChoice = _ref10.itemChoice, itemSelectable = _ref10.itemSelectable, selectedState = _ref10.selectedState, itemDisabled = _ref10.itemDisabled, placeholder = _ref10.placeholder;\n", " var id = _ref11.id, value = _ref11.value, label = _ref11.label, groupId = _ref11.groupId, elementId = _ref11.elementId, isDisabled = _ref11.disabled, isSelected = _ref11.selected, isPlaceholder = _ref11.placeholder;\n", " var div = Object.assign(document.createElement('div'), {\n", " id: elementId,\n", " innerHTML: label,\n", " className: item + \" \" + itemChoice\n", " });\n", " if (isSelected) {\n", " div.classList.add(selectedState);\n", " }\n", " if (isPlaceholder) {\n", " div.classList.add(placeholder);\n", " }\n", " div.setAttribute('role', groupId > 0 ? 'treeitem' : 'option');\n", " Object.assign(div.dataset, {\n", " choice: '',\n", " id: id,\n", " value: value,\n", " selectText: selectText\n", " });\n", " if (isDisabled) {\n", " div.classList.add(itemDisabled);\n", " div.dataset.choiceDisabled = '';\n", " div.setAttribute('aria-disabled', 'true');\n", " }\n", " else {\n", " div.classList.add(itemSelectable);\n", " div.dataset.choiceSelectable = '';\n", " }\n", " return div;\n", " },\n", " /**\n", " * @param {Partial} classNames\n", " * @param {string} placeholderValue\n", " */\n", " input: function input(_ref12, placeholderValue) {\n", " var _input = _ref12.input, inputCloned = _ref12.inputCloned;\n", " var inp = Object.assign(document.createElement('input'), {\n", " type: 'text',\n", " className: _input + \" \" + inputCloned,\n", " autocomplete: 'off',\n", " autocapitalize: 'off',\n", " spellcheck: false\n", " });\n", " inp.setAttribute('role', 'textbox');\n", " inp.setAttribute('aria-autocomplete', 'list');\n", " inp.setAttribute('aria-label', placeholderValue);\n", " return inp;\n", " },\n", " /**\n", " * @param {Partial} classNames\n", " */\n", " dropdown: function dropdown(_ref13) {\n", " var list = _ref13.list, listDropdown = _ref13.listDropdown;\n", " var div = document.createElement('div');\n", " div.classList.add(list, listDropdown);\n", " div.setAttribute('aria-expanded', 'false');\n", " return div;\n", " },\n", " /**\n", " *\n", " * @param {Partial} classNames\n", " * @param {string} innerHTML\n", " * @param {\"no-choices\" | \"no-results\" | \"\"} type\n", " */\n", " notice: function notice(_ref14, innerHTML, type) {\n", " var item = _ref14.item, itemChoice = _ref14.itemChoice, noResults = _ref14.noResults, noChoices = _ref14.noChoices;\n", " if (type === void 0) {\n", " type = '';\n", " }\n", " var classes = [item, itemChoice];\n", " if (type === 'no-choices') {\n", " classes.push(noChoices);\n", " }\n", " else if (type === 'no-results') {\n", " classes.push(noResults);\n", " }\n", " return Object.assign(document.createElement('div'), {\n", " innerHTML: innerHTML,\n", " className: classes.join(' ')\n", " });\n", " },\n", " /**\n", " * @param {Item} option\n", " */\n", " option: function option(_ref15) {\n", " var label = _ref15.label, value = _ref15.value, customProperties = _ref15.customProperties, active = _ref15.active, disabled = _ref15.disabled;\n", " var opt = new Option(label, value, false, active);\n", " if (customProperties) {\n", " opt.dataset.customProperties = customProperties;\n", " }\n", " opt.disabled = disabled;\n", " return opt;\n", " }\n", " };\n", " /* harmony default export */ var templates = (TEMPLATES);\n", " // CONCATENATED MODULE: ./src/scripts/actions/choices.js\n", " /**\n", " * @typedef {import('redux').Action} Action\n", " * @typedef {import('../../../types/index').Choices.Choice} Choice\n", " */\n", " /**\n", " * @argument {Choice} choice\n", " * @returns {Action & Choice}\n", " */\n", " var choices_addChoice = function addChoice(_ref) {\n", " var value = _ref.value, label = _ref.label, id = _ref.id, groupId = _ref.groupId, disabled = _ref.disabled, elementId = _ref.elementId, customProperties = _ref.customProperties, placeholder = _ref.placeholder, keyCode = _ref.keyCode;\n", " return {\n", " type: ACTION_TYPES.ADD_CHOICE,\n", " value: value,\n", " label: label,\n", " id: id,\n", " groupId: groupId,\n", " disabled: disabled,\n", " elementId: elementId,\n", " customProperties: customProperties,\n", " placeholder: placeholder,\n", " keyCode: keyCode\n", " };\n", " };\n", " /**\n", " * @argument {Choice[]} results\n", " * @returns {Action & { results: Choice[] }}\n", " */\n", " var choices_filterChoices = function filterChoices(results) {\n", " return {\n", " type: ACTION_TYPES.FILTER_CHOICES,\n", " results: results\n", " };\n", " };\n", " /**\n", " * @argument {boolean} active\n", " * @returns {Action & { active: boolean }}\n", " */\n", " var choices_activateChoices = function activateChoices(active) {\n", " if (active === void 0) {\n", " active = true;\n", " }\n", " return {\n", " type: ACTION_TYPES.ACTIVATE_CHOICES,\n", " active: active\n", " };\n", " };\n", " /**\n", " * @returns {Action}\n", " */\n", " var choices_clearChoices = function clearChoices() {\n", " return {\n", " type: ACTION_TYPES.CLEAR_CHOICES\n", " };\n", " };\n", " // CONCATENATED MODULE: ./src/scripts/actions/items.js\n", " /**\n", " * @typedef {import('redux').Action} Action\n", " * @typedef {import('../../../types/index').Choices.Item} Item\n", " */\n", " /**\n", " * @param {Item} item\n", " * @returns {Action & Item}\n", " */\n", " var items_addItem = function addItem(_ref) {\n", " var value = _ref.value, label = _ref.label, id = _ref.id, choiceId = _ref.choiceId, groupId = _ref.groupId, customProperties = _ref.customProperties, placeholder = _ref.placeholder, keyCode = _ref.keyCode;\n", " return {\n", " type: ACTION_TYPES.ADD_ITEM,\n", " value: value,\n", " label: label,\n", " id: id,\n", " choiceId: choiceId,\n", " groupId: groupId,\n", " customProperties: customProperties,\n", " placeholder: placeholder,\n", " keyCode: keyCode\n", " };\n", " };\n", " /**\n", " * @param {string} id\n", " * @param {string} choiceId\n", " * @returns {Action & { id: string, choiceId: string }}\n", " */\n", " var items_removeItem = function removeItem(id, choiceId) {\n", " return {\n", " type: ACTION_TYPES.REMOVE_ITEM,\n", " id: id,\n", " choiceId: choiceId\n", " };\n", " };\n", " /**\n", " * @param {string} id\n", " * @param {boolean} highlighted\n", " * @returns {Action & { id: string, highlighted: boolean }}\n", " */\n", " var items_highlightItem = function highlightItem(id, highlighted) {\n", " return {\n", " type: ACTION_TYPES.HIGHLIGHT_ITEM,\n", " id: id,\n", " highlighted: highlighted\n", " };\n", " };\n", " // CONCATENATED MODULE: ./src/scripts/actions/groups.js\n", " /**\n", " * @typedef {import('redux').Action} Action\n", " * @typedef {import('../../../types/index').Choices.Group} Group\n", " */\n", " /**\n", " * @param {Group} group\n", " * @returns {Action & Group}\n", " */\n", " var groups_addGroup = function addGroup(_ref) {\n", " var value = _ref.value, id = _ref.id, active = _ref.active, disabled = _ref.disabled;\n", " return {\n", " type: ACTION_TYPES.ADD_GROUP,\n", " value: value,\n", " id: id,\n", " active: active,\n", " disabled: disabled\n", " };\n", " };\n", " // CONCATENATED MODULE: ./src/scripts/actions/misc.js\n", " /**\n", " * @typedef {import('redux').Action} Action\n", " */\n", " /**\n", " * @returns {Action}\n", " */\n", " var clearAll = function clearAll() {\n", " return {\n", " type: 'CLEAR_ALL'\n", " };\n", " };\n", " /**\n", " * @param {any} state\n", " * @returns {Action & { state: object }}\n", " */\n", " var resetTo = function resetTo(state) {\n", " return {\n", " type: 'RESET_TO',\n", " state: state\n", " };\n", " };\n", " /**\n", " * @param {boolean} isLoading\n", " * @returns {Action & { isLoading: boolean }}\n", " */\n", " var setIsLoading = function setIsLoading(isLoading) {\n", " return {\n", " type: 'SET_IS_LOADING',\n", " isLoading: isLoading\n", " };\n", " };\n", " // CONCATENATED MODULE: ./src/scripts/choices.js\n", " function choices_defineProperties(target, props) { for (var i = 0; i < props.length; i++) {\n", " var descriptor = props[i];\n", " descriptor.enumerable = descriptor.enumerable || false;\n", " descriptor.configurable = true;\n", " if (\"value\" in descriptor)\n", " descriptor.writable = true;\n", " Object.defineProperty(target, descriptor.key, descriptor);\n", " } }\n", " function choices_createClass(Constructor, protoProps, staticProps) { if (protoProps)\n", " choices_defineProperties(Constructor.prototype, protoProps); if (staticProps)\n", " choices_defineProperties(Constructor, staticProps); return Constructor; }\n", " /** @see {@link http://browserhacks.com/#hack-acea075d0ac6954f275a70023906050c} */\n", " var IS_IE11 = '-ms-scroll-limit' in document.documentElement.style && '-ms-ime-align' in document.documentElement.style;\n", " /**\n", " * @typedef {import('../../types/index').Choices.Choice} Choice\n", " * @typedef {import('../../types/index').Choices.Item} Item\n", " * @typedef {import('../../types/index').Choices.Group} Group\n", " * @typedef {import('../../types/index').Choices.Options} Options\n", " */\n", " /** @type {Partial} */\n", " var USER_DEFAULTS = {};\n", " /**\n", " * Choices\n", " * @author Josh Johnson\n", " */\n", " var choices_Choices = \n", " /*#__PURE__*/\n", " function () {\n", " choices_createClass(Choices, null, [{\n", " key: \"defaults\",\n", " get: function get() {\n", " return Object.preventExtensions({\n", " get options() {\n", " return USER_DEFAULTS;\n", " },\n", " get templates() {\n", " return TEMPLATES;\n", " }\n", " });\n", " }\n", " /**\n", " * @param {string | HTMLInputElement | HTMLSelectElement} element\n", " * @param {Partial} userConfig\n", " */\n", " }]);\n", " function Choices(element, userConfig) {\n", " var _this = this;\n", " if (element === void 0) {\n", " element = '[data-choice]';\n", " }\n", " if (userConfig === void 0) {\n", " userConfig = {};\n", " }\n", " /** @type {Partial} */\n", " this.config = cjs_default.a.all([DEFAULT_CONFIG, Choices.defaults.options, userConfig], // When merging array configs, replace with a copy of the userConfig array,\n", " // instead of concatenating with the default array\n", " {\n", " arrayMerge: function arrayMerge(_, sourceArray) {\n", " return [].concat(sourceArray);\n", " }\n", " });\n", " var invalidConfigOptions = diff(this.config, DEFAULT_CONFIG);\n", " if (invalidConfigOptions.length) {\n", " console.warn('Unknown config option(s) passed', invalidConfigOptions.join(', '));\n", " }\n", " var passedElement = typeof element === 'string' ? document.querySelector(element) : element;\n", " if (!(passedElement instanceof HTMLInputElement || passedElement instanceof HTMLSelectElement)) {\n", " throw TypeError('Expected one of the following types text|select-one|select-multiple');\n", " }\n", " this._isTextElement = passedElement.type === TEXT_TYPE;\n", " this._isSelectOneElement = passedElement.type === SELECT_ONE_TYPE;\n", " this._isSelectMultipleElement = passedElement.type === SELECT_MULTIPLE_TYPE;\n", " this._isSelectElement = this._isSelectOneElement || this._isSelectMultipleElement;\n", " this.config.searchEnabled = this._isSelectMultipleElement || this.config.searchEnabled;\n", " if (!['auto', 'always'].includes(this.config.renderSelectedChoices)) {\n", " this.config.renderSelectedChoices = 'auto';\n", " }\n", " if (userConfig.addItemFilter && typeof userConfig.addItemFilter !== 'function') {\n", " var re = userConfig.addItemFilter instanceof RegExp ? userConfig.addItemFilter : new RegExp(userConfig.addItemFilter);\n", " this.config.addItemFilter = re.test.bind(re);\n", " }\n", " if (this._isTextElement) {\n", " this.passedElement = new WrappedInput({\n", " element: passedElement,\n", " classNames: this.config.classNames,\n", " delimiter: this.config.delimiter\n", " });\n", " }\n", " else {\n", " this.passedElement = new WrappedSelect({\n", " element: passedElement,\n", " classNames: this.config.classNames,\n", " template: function template(data) {\n", " return _this._templates.option(data);\n", " }\n", " });\n", " }\n", " this.initialised = false;\n", " this._store = new store_Store();\n", " this._initialState = {};\n", " this._currentState = {};\n", " this._prevState = {};\n", " this._currentValue = '';\n", " this._canSearch = this.config.searchEnabled;\n", " this._isScrollingOnIe = false;\n", " this._highlightPosition = 0;\n", " this._wasTap = true;\n", " this._placeholderValue = this._generatePlaceholderValue();\n", " this._baseId = generateId(this.passedElement.element, 'choices-');\n", " /**\n", " * setting direction in cases where it's explicitly set on passedElement\n", " * or when calculated direction is different from the document\n", " * @type {HTMLElement['dir']}\n", " */\n", " this._direction = this.passedElement.dir;\n", " if (!this._direction) {\n", " var _window$getComputedSt = window.getComputedStyle(this.passedElement.element), elementDirection = _window$getComputedSt.direction;\n", " var _window$getComputedSt2 = window.getComputedStyle(document.documentElement), documentDirection = _window$getComputedSt2.direction;\n", " if (elementDirection !== documentDirection) {\n", " this._direction = elementDirection;\n", " }\n", " }\n", " this._idNames = {\n", " itemChoice: 'item-choice'\n", " }; // Assign preset groups from passed element\n", " this._presetGroups = this.passedElement.optionGroups; // Assign preset options from passed element\n", " this._presetOptions = this.passedElement.options; // Assign preset choices from passed object\n", " this._presetChoices = this.config.choices; // Assign preset items from passed object first\n", " this._presetItems = this.config.items; // Add any values passed from attribute\n", " if (this.passedElement.value) {\n", " this._presetItems = this._presetItems.concat(this.passedElement.value.split(this.config.delimiter));\n", " } // Create array of choices from option elements\n", " if (this.passedElement.options) {\n", " this.passedElement.options.forEach(function (o) {\n", " _this._presetChoices.push({\n", " value: o.value,\n", " label: o.innerHTML,\n", " selected: o.selected,\n", " disabled: o.disabled || o.parentNode.disabled,\n", " placeholder: o.value === '' || o.hasAttribute('placeholder'),\n", " customProperties: o.getAttribute('data-custom-properties')\n", " });\n", " });\n", " }\n", " this._render = this._render.bind(this);\n", " this._onFocus = this._onFocus.bind(this);\n", " this._onBlur = this._onBlur.bind(this);\n", " this._onKeyUp = this._onKeyUp.bind(this);\n", " this._onKeyDown = this._onKeyDown.bind(this);\n", " this._onClick = this._onClick.bind(this);\n", " this._onTouchMove = this._onTouchMove.bind(this);\n", " this._onTouchEnd = this._onTouchEnd.bind(this);\n", " this._onMouseDown = this._onMouseDown.bind(this);\n", " this._onMouseOver = this._onMouseOver.bind(this);\n", " this._onFormReset = this._onFormReset.bind(this);\n", " this._onAKey = this._onAKey.bind(this);\n", " this._onEnterKey = this._onEnterKey.bind(this);\n", " this._onEscapeKey = this._onEscapeKey.bind(this);\n", " this._onDirectionKey = this._onDirectionKey.bind(this);\n", " this._onDeleteKey = this._onDeleteKey.bind(this); // If element has already been initialised with Choices, fail silently\n", " if (this.passedElement.isActive) {\n", " if (!this.config.silent) {\n", " console.warn('Trying to initialise Choices on element already initialised');\n", " }\n", " this.initialised = true;\n", " return;\n", " } // Let's go\n", " this.init();\n", " }\n", " var _proto = Choices.prototype;\n", " _proto.init = function init() {\n", " if (this.initialised) {\n", " return;\n", " }\n", " this._createTemplates();\n", " this._createElements();\n", " this._createStructure(); // Set initial state (We need to clone the state because some reducers\n", " // modify the inner objects properties in the state) 🤢\n", " this._initialState = cloneObject(this._store.state);\n", " this._store.subscribe(this._render);\n", " this._render();\n", " this._addEventListeners();\n", " var shouldDisable = !this.config.addItems || this.passedElement.element.hasAttribute('disabled');\n", " if (shouldDisable) {\n", " this.disable();\n", " }\n", " this.initialised = true;\n", " var callbackOnInit = this.config.callbackOnInit; // Run callback if it is a function\n", " if (callbackOnInit && typeof callbackOnInit === 'function') {\n", " callbackOnInit.call(this);\n", " }\n", " };\n", " _proto.destroy = function destroy() {\n", " if (!this.initialised) {\n", " return;\n", " }\n", " this._removeEventListeners();\n", " this.passedElement.reveal();\n", " this.containerOuter.unwrap(this.passedElement.element);\n", " this.clearStore();\n", " if (this._isSelectElement) {\n", " this.passedElement.options = this._presetOptions;\n", " }\n", " this._templates = null;\n", " this.initialised = false;\n", " };\n", " _proto.enable = function enable() {\n", " if (this.passedElement.isDisabled) {\n", " this.passedElement.enable();\n", " }\n", " if (this.containerOuter.isDisabled) {\n", " this._addEventListeners();\n", " this.input.enable();\n", " this.containerOuter.enable();\n", " }\n", " return this;\n", " };\n", " _proto.disable = function disable() {\n", " if (!this.passedElement.isDisabled) {\n", " this.passedElement.disable();\n", " }\n", " if (!this.containerOuter.isDisabled) {\n", " this._removeEventListeners();\n", " this.input.disable();\n", " this.containerOuter.disable();\n", " }\n", " return this;\n", " };\n", " _proto.highlightItem = function highlightItem(item, runEvent) {\n", " if (runEvent === void 0) {\n", " runEvent = true;\n", " }\n", " if (!item) {\n", " return this;\n", " }\n", " var id = item.id, _item$groupId = item.groupId, groupId = _item$groupId === void 0 ? -1 : _item$groupId, _item$value = item.value, value = _item$value === void 0 ? '' : _item$value, _item$label = item.label, label = _item$label === void 0 ? '' : _item$label;\n", " var group = groupId >= 0 ? this._store.getGroupById(groupId) : null;\n", " this._store.dispatch(items_highlightItem(id, true));\n", " if (runEvent) {\n", " this.passedElement.triggerEvent(EVENTS.highlightItem, {\n", " id: id,\n", " value: value,\n", " label: label,\n", " groupValue: group && group.value ? group.value : null\n", " });\n", " }\n", " return this;\n", " };\n", " _proto.unhighlightItem = function unhighlightItem(item) {\n", " if (!item) {\n", " return this;\n", " }\n", " var id = item.id, _item$groupId2 = item.groupId, groupId = _item$groupId2 === void 0 ? -1 : _item$groupId2, _item$value2 = item.value, value = _item$value2 === void 0 ? '' : _item$value2, _item$label2 = item.label, label = _item$label2 === void 0 ? '' : _item$label2;\n", " var group = groupId >= 0 ? this._store.getGroupById(groupId) : null;\n", " this._store.dispatch(items_highlightItem(id, false));\n", " this.passedElement.triggerEvent(EVENTS.highlightItem, {\n", " id: id,\n", " value: value,\n", " label: label,\n", " groupValue: group && group.value ? group.value : null\n", " });\n", " return this;\n", " };\n", " _proto.highlightAll = function highlightAll() {\n", " var _this2 = this;\n", " this._store.items.forEach(function (item) {\n", " return _this2.highlightItem(item);\n", " });\n", " return this;\n", " };\n", " _proto.unhighlightAll = function unhighlightAll() {\n", " var _this3 = this;\n", " this._store.items.forEach(function (item) {\n", " return _this3.unhighlightItem(item);\n", " });\n", " return this;\n", " };\n", " _proto.removeActiveItemsByValue = function removeActiveItemsByValue(value) {\n", " var _this4 = this;\n", " this._store.activeItems.filter(function (item) {\n", " return item.value === value;\n", " }).forEach(function (item) {\n", " return _this4._removeItem(item);\n", " });\n", " return this;\n", " };\n", " _proto.removeActiveItems = function removeActiveItems(excludedId) {\n", " var _this5 = this;\n", " this._store.activeItems.filter(function (_ref) {\n", " var id = _ref.id;\n", " return id !== excludedId;\n", " }).forEach(function (item) {\n", " return _this5._removeItem(item);\n", " });\n", " return this;\n", " };\n", " _proto.removeHighlightedItems = function removeHighlightedItems(runEvent) {\n", " var _this6 = this;\n", " if (runEvent === void 0) {\n", " runEvent = false;\n", " }\n", " this._store.highlightedActiveItems.forEach(function (item) {\n", " _this6._removeItem(item); // If this action was performed by the user\n", " // trigger the event\n", " if (runEvent) {\n", " _this6._triggerChange(item.value);\n", " }\n", " });\n", " return this;\n", " };\n", " _proto.showDropdown = function showDropdown(preventInputFocus) {\n", " var _this7 = this;\n", " if (this.dropdown.isActive) {\n", " return this;\n", " }\n", " requestAnimationFrame(function () {\n", " _this7.dropdown.show();\n", " _this7.containerOuter.open(_this7.dropdown.distanceFromTopWindow);\n", " if (!preventInputFocus && _this7._canSearch) {\n", " _this7.input.focus();\n", " }\n", " _this7.passedElement.triggerEvent(EVENTS.showDropdown, {});\n", " });\n", " return this;\n", " };\n", " _proto.hideDropdown = function hideDropdown(preventInputBlur) {\n", " var _this8 = this;\n", " if (!this.dropdown.isActive) {\n", " return this;\n", " }\n", " requestAnimationFrame(function () {\n", " _this8.dropdown.hide();\n", " _this8.containerOuter.close();\n", " if (!preventInputBlur && _this8._canSearch) {\n", " _this8.input.removeActiveDescendant();\n", " _this8.input.blur();\n", " }\n", " _this8.passedElement.triggerEvent(EVENTS.hideDropdown, {});\n", " });\n", " return this;\n", " };\n", " _proto.getValue = function getValue(valueOnly) {\n", " if (valueOnly === void 0) {\n", " valueOnly = false;\n", " }\n", " var values = this._store.activeItems.reduce(function (selectedItems, item) {\n", " var itemValue = valueOnly ? item.value : item;\n", " selectedItems.push(itemValue);\n", " return selectedItems;\n", " }, []);\n", " return this._isSelectOneElement ? values[0] : values;\n", " };\n", " _proto.setValue = function setValue(items) {\n", " var _this9 = this;\n", " if (!this.initialised) {\n", " return this;\n", " }\n", " items.forEach(function (value) {\n", " return _this9._setChoiceOrItem(value);\n", " });\n", " return this;\n", " };\n", " _proto.setChoiceByValue = function setChoiceByValue(value) {\n", " var _this10 = this;\n", " if (!this.initialised || this._isTextElement) {\n", " return this;\n", " } // If only one value has been passed, convert to array\n", " var choiceValue = Array.isArray(value) ? value : [value]; // Loop through each value and\n", " choiceValue.forEach(function (val) {\n", " return _this10._findAndSelectChoiceByValue(val);\n", " });\n", " return this;\n", " };\n", " _proto.setChoices = function setChoices(choicesArrayOrFetcher, value, label, replaceChoices) {\n", " var _this11 = this;\n", " if (choicesArrayOrFetcher === void 0) {\n", " choicesArrayOrFetcher = [];\n", " }\n", " if (value === void 0) {\n", " value = 'value';\n", " }\n", " if (label === void 0) {\n", " label = 'label';\n", " }\n", " if (replaceChoices === void 0) {\n", " replaceChoices = false;\n", " }\n", " if (!this.initialised) {\n", " throw new ReferenceError(\"setChoices was called on a non-initialized instance of Choices\");\n", " }\n", " if (!this._isSelectElement) {\n", " throw new TypeError(\"setChoices can't be used with INPUT based Choices\");\n", " }\n", " if (typeof value !== 'string' || !value) {\n", " throw new TypeError(\"value parameter must be a name of 'value' field in passed objects\");\n", " } // Clear choices if needed\n", " if (replaceChoices) {\n", " this.clearChoices();\n", " }\n", " if (typeof choicesArrayOrFetcher === 'function') {\n", " // it's a choices fetcher function\n", " var fetcher = choicesArrayOrFetcher(this);\n", " if (typeof Promise === 'function' && fetcher instanceof Promise) {\n", " // that's a promise\n", " // eslint-disable-next-line compat/compat\n", " return new Promise(function (resolve) {\n", " return requestAnimationFrame(resolve);\n", " }).then(function () {\n", " return _this11._handleLoadingState(true);\n", " }).then(function () {\n", " return fetcher;\n", " }).then(function (data) {\n", " return _this11.setChoices(data, value, label, replaceChoices);\n", " }).catch(function (err) {\n", " if (!_this11.config.silent) {\n", " console.error(err);\n", " }\n", " }).then(function () {\n", " return _this11._handleLoadingState(false);\n", " }).then(function () {\n", " return _this11;\n", " });\n", " } // function returned something else than promise, let's check if it's an array of choices\n", " if (!Array.isArray(fetcher)) {\n", " throw new TypeError(\".setChoices first argument function must return either array of choices or Promise, got: \" + typeof fetcher);\n", " } // recursion with results, it's sync and choices were cleared already\n", " return this.setChoices(fetcher, value, label, false);\n", " }\n", " if (!Array.isArray(choicesArrayOrFetcher)) {\n", " throw new TypeError(\".setChoices must be called either with array of choices with a function resulting into Promise of array of choices\");\n", " }\n", " this.containerOuter.removeLoadingState();\n", " this._startLoading();\n", " choicesArrayOrFetcher.forEach(function (groupOrChoice) {\n", " if (groupOrChoice.choices) {\n", " _this11._addGroup({\n", " id: parseInt(groupOrChoice.id, 10) || null,\n", " group: groupOrChoice,\n", " valueKey: value,\n", " labelKey: label\n", " });\n", " }\n", " else {\n", " _this11._addChoice({\n", " value: groupOrChoice[value],\n", " label: groupOrChoice[label],\n", " isSelected: groupOrChoice.selected,\n", " isDisabled: groupOrChoice.disabled,\n", " customProperties: groupOrChoice.customProperties,\n", " placeholder: groupOrChoice.placeholder\n", " });\n", " }\n", " });\n", " this._stopLoading();\n", " return this;\n", " };\n", " _proto.clearChoices = function clearChoices() {\n", " this._store.dispatch(choices_clearChoices());\n", " return this;\n", " };\n", " _proto.clearStore = function clearStore() {\n", " this._store.dispatch(clearAll());\n", " return this;\n", " };\n", " _proto.clearInput = function clearInput() {\n", " var shouldSetInputWidth = !this._isSelectOneElement;\n", " this.input.clear(shouldSetInputWidth);\n", " if (!this._isTextElement && this._canSearch) {\n", " this._isSearching = false;\n", " this._store.dispatch(choices_activateChoices(true));\n", " }\n", " return this;\n", " };\n", " _proto._render = function _render() {\n", " if (this._store.isLoading()) {\n", " return;\n", " }\n", " this._currentState = this._store.state;\n", " var stateChanged = this._currentState.choices !== this._prevState.choices || this._currentState.groups !== this._prevState.groups || this._currentState.items !== this._prevState.items;\n", " var shouldRenderChoices = this._isSelectElement;\n", " var shouldRenderItems = this._currentState.items !== this._prevState.items;\n", " if (!stateChanged) {\n", " return;\n", " }\n", " if (shouldRenderChoices) {\n", " this._renderChoices();\n", " }\n", " if (shouldRenderItems) {\n", " this._renderItems();\n", " }\n", " this._prevState = this._currentState;\n", " };\n", " _proto._renderChoices = function _renderChoices() {\n", " var _this12 = this;\n", " var _this$_store = this._store, activeGroups = _this$_store.activeGroups, activeChoices = _this$_store.activeChoices;\n", " var choiceListFragment = document.createDocumentFragment();\n", " this.choiceList.clear();\n", " if (this.config.resetScrollPosition) {\n", " requestAnimationFrame(function () {\n", " return _this12.choiceList.scrollToTop();\n", " });\n", " } // If we have grouped options\n", " if (activeGroups.length >= 1 && !this._isSearching) {\n", " // If we have a placeholder choice along with groups\n", " var activePlaceholders = activeChoices.filter(function (activeChoice) {\n", " return activeChoice.placeholder === true && activeChoice.groupId === -1;\n", " });\n", " if (activePlaceholders.length >= 1) {\n", " choiceListFragment = this._createChoicesFragment(activePlaceholders, choiceListFragment);\n", " }\n", " choiceListFragment = this._createGroupsFragment(activeGroups, activeChoices, choiceListFragment);\n", " }\n", " else if (activeChoices.length >= 1) {\n", " choiceListFragment = this._createChoicesFragment(activeChoices, choiceListFragment);\n", " } // If we have choices to show\n", " if (choiceListFragment.childNodes && choiceListFragment.childNodes.length > 0) {\n", " var activeItems = this._store.activeItems;\n", " var canAddItem = this._canAddItem(activeItems, this.input.value); // ...and we can select them\n", " if (canAddItem.response) {\n", " // ...append them and highlight the first choice\n", " this.choiceList.append(choiceListFragment);\n", " this._highlightChoice();\n", " }\n", " else {\n", " // ...otherwise show a notice\n", " this.choiceList.append(this._getTemplate('notice', canAddItem.notice));\n", " }\n", " }\n", " else {\n", " // Otherwise show a notice\n", " var dropdownItem;\n", " var notice;\n", " if (this._isSearching) {\n", " notice = typeof this.config.noResultsText === 'function' ? this.config.noResultsText() : this.config.noResultsText;\n", " dropdownItem = this._getTemplate('notice', notice, 'no-results');\n", " }\n", " else {\n", " notice = typeof this.config.noChoicesText === 'function' ? this.config.noChoicesText() : this.config.noChoicesText;\n", " dropdownItem = this._getTemplate('notice', notice, 'no-choices');\n", " }\n", " this.choiceList.append(dropdownItem);\n", " }\n", " };\n", " _proto._renderItems = function _renderItems() {\n", " var activeItems = this._store.activeItems || [];\n", " this.itemList.clear(); // Create a fragment to store our list items\n", " // (so we don't have to update the DOM for each item)\n", " var itemListFragment = this._createItemsFragment(activeItems); // If we have items to add, append them\n", " if (itemListFragment.childNodes) {\n", " this.itemList.append(itemListFragment);\n", " }\n", " };\n", " _proto._createGroupsFragment = function _createGroupsFragment(groups, choices, fragment) {\n", " var _this13 = this;\n", " if (fragment === void 0) {\n", " fragment = document.createDocumentFragment();\n", " }\n", " var getGroupChoices = function getGroupChoices(group) {\n", " return choices.filter(function (choice) {\n", " if (_this13._isSelectOneElement) {\n", " return choice.groupId === group.id;\n", " }\n", " return choice.groupId === group.id && (_this13.config.renderSelectedChoices === 'always' || !choice.selected);\n", " });\n", " }; // If sorting is enabled, filter groups\n", " if (this.config.shouldSort) {\n", " groups.sort(this.config.sorter);\n", " }\n", " groups.forEach(function (group) {\n", " var groupChoices = getGroupChoices(group);\n", " if (groupChoices.length >= 1) {\n", " var dropdownGroup = _this13._getTemplate('choiceGroup', group);\n", " fragment.appendChild(dropdownGroup);\n", " _this13._createChoicesFragment(groupChoices, fragment, true);\n", " }\n", " });\n", " return fragment;\n", " };\n", " _proto._createChoicesFragment = function _createChoicesFragment(choices, fragment, withinGroup) {\n", " var _this14 = this;\n", " if (fragment === void 0) {\n", " fragment = document.createDocumentFragment();\n", " }\n", " if (withinGroup === void 0) {\n", " withinGroup = false;\n", " }\n", " // Create a fragment to store our list items (so we don't have to update the DOM for each item)\n", " var _this$config = this.config, renderSelectedChoices = _this$config.renderSelectedChoices, searchResultLimit = _this$config.searchResultLimit, renderChoiceLimit = _this$config.renderChoiceLimit;\n", " var filter = this._isSearching ? sortByScore : this.config.sorter;\n", " var appendChoice = function appendChoice(choice) {\n", " var shouldRender = renderSelectedChoices === 'auto' ? _this14._isSelectOneElement || !choice.selected : true;\n", " if (shouldRender) {\n", " var dropdownItem = _this14._getTemplate('choice', choice, _this14.config.itemSelectText);\n", " fragment.appendChild(dropdownItem);\n", " }\n", " };\n", " var rendererableChoices = choices;\n", " if (renderSelectedChoices === 'auto' && !this._isSelectOneElement) {\n", " rendererableChoices = choices.filter(function (choice) {\n", " return !choice.selected;\n", " });\n", " } // Split array into placeholders and \"normal\" choices\n", " var _rendererableChoices$ = rendererableChoices.reduce(function (acc, choice) {\n", " if (choice.placeholder) {\n", " acc.placeholderChoices.push(choice);\n", " }\n", " else {\n", " acc.normalChoices.push(choice);\n", " }\n", " return acc;\n", " }, {\n", " placeholderChoices: [],\n", " normalChoices: []\n", " }), placeholderChoices = _rendererableChoices$.placeholderChoices, normalChoices = _rendererableChoices$.normalChoices; // If sorting is enabled or the user is searching, filter choices\n", " if (this.config.shouldSort || this._isSearching) {\n", " normalChoices.sort(filter);\n", " }\n", " var choiceLimit = rendererableChoices.length; // Prepend placeholeder\n", " var sortedChoices = this._isSelectOneElement ? [].concat(placeholderChoices, normalChoices) : normalChoices;\n", " if (this._isSearching) {\n", " choiceLimit = searchResultLimit;\n", " }\n", " else if (renderChoiceLimit && renderChoiceLimit > 0 && !withinGroup) {\n", " choiceLimit = renderChoiceLimit;\n", " } // Add each choice to dropdown within range\n", " for (var i = 0; i < choiceLimit; i += 1) {\n", " if (sortedChoices[i]) {\n", " appendChoice(sortedChoices[i]);\n", " }\n", " }\n", " return fragment;\n", " };\n", " _proto._createItemsFragment = function _createItemsFragment(items, fragment) {\n", " var _this15 = this;\n", " if (fragment === void 0) {\n", " fragment = document.createDocumentFragment();\n", " }\n", " // Create fragment to add elements to\n", " var _this$config2 = this.config, shouldSortItems = _this$config2.shouldSortItems, sorter = _this$config2.sorter, removeItemButton = _this$config2.removeItemButton; // If sorting is enabled, filter items\n", " if (shouldSortItems && !this._isSelectOneElement) {\n", " items.sort(sorter);\n", " }\n", " if (this._isTextElement) {\n", " // Update the value of the hidden input\n", " this.passedElement.value = items;\n", " }\n", " else {\n", " // Update the options of the hidden input\n", " this.passedElement.options = items;\n", " }\n", " var addItemToFragment = function addItemToFragment(item) {\n", " // Create new list element\n", " var listItem = _this15._getTemplate('item', item, removeItemButton); // Append it to list\n", " fragment.appendChild(listItem);\n", " }; // Add each list item to list\n", " items.forEach(addItemToFragment);\n", " return fragment;\n", " };\n", " _proto._triggerChange = function _triggerChange(value) {\n", " if (value === undefined || value === null) {\n", " return;\n", " }\n", " this.passedElement.triggerEvent(EVENTS.change, {\n", " value: value\n", " });\n", " };\n", " _proto._selectPlaceholderChoice = function _selectPlaceholderChoice() {\n", " var placeholderChoice = this._store.placeholderChoice;\n", " if (placeholderChoice) {\n", " this._addItem({\n", " value: placeholderChoice.value,\n", " label: placeholderChoice.label,\n", " choiceId: placeholderChoice.id,\n", " groupId: placeholderChoice.groupId,\n", " placeholder: placeholderChoice.placeholder\n", " });\n", " this._triggerChange(placeholderChoice.value);\n", " }\n", " };\n", " _proto._handleButtonAction = function _handleButtonAction(activeItems, element) {\n", " if (!activeItems || !element || !this.config.removeItems || !this.config.removeItemButton) {\n", " return;\n", " }\n", " var itemId = element.parentNode.getAttribute('data-id');\n", " var itemToRemove = activeItems.find(function (item) {\n", " return item.id === parseInt(itemId, 10);\n", " }); // Remove item associated with button\n", " this._removeItem(itemToRemove);\n", " this._triggerChange(itemToRemove.value);\n", " if (this._isSelectOneElement) {\n", " this._selectPlaceholderChoice();\n", " }\n", " };\n", " _proto._handleItemAction = function _handleItemAction(activeItems, element, hasShiftKey) {\n", " var _this16 = this;\n", " if (hasShiftKey === void 0) {\n", " hasShiftKey = false;\n", " }\n", " if (!activeItems || !element || !this.config.removeItems || this._isSelectOneElement) {\n", " return;\n", " }\n", " var passedId = element.getAttribute('data-id'); // We only want to select one item with a click\n", " // so we deselect any items that aren't the target\n", " // unless shift is being pressed\n", " activeItems.forEach(function (item) {\n", " if (item.id === parseInt(passedId, 10) && !item.highlighted) {\n", " _this16.highlightItem(item);\n", " }\n", " else if (!hasShiftKey && item.highlighted) {\n", " _this16.unhighlightItem(item);\n", " }\n", " }); // Focus input as without focus, a user cannot do anything with a\n", " // highlighted item\n", " this.input.focus();\n", " };\n", " _proto._handleChoiceAction = function _handleChoiceAction(activeItems, element) {\n", " if (!activeItems || !element) {\n", " return;\n", " } // If we are clicking on an option\n", " var id = element.dataset.id;\n", " var choice = this._store.getChoiceById(id);\n", " if (!choice) {\n", " return;\n", " }\n", " var passedKeyCode = activeItems[0] && activeItems[0].keyCode ? activeItems[0].keyCode : null;\n", " var hasActiveDropdown = this.dropdown.isActive; // Update choice keyCode\n", " choice.keyCode = passedKeyCode;\n", " this.passedElement.triggerEvent(EVENTS.choice, {\n", " choice: choice\n", " });\n", " if (!choice.selected && !choice.disabled) {\n", " var canAddItem = this._canAddItem(activeItems, choice.value);\n", " if (canAddItem.response) {\n", " this._addItem({\n", " value: choice.value,\n", " label: choice.label,\n", " choiceId: choice.id,\n", " groupId: choice.groupId,\n", " customProperties: choice.customProperties,\n", " placeholder: choice.placeholder,\n", " keyCode: choice.keyCode\n", " });\n", " this._triggerChange(choice.value);\n", " }\n", " }\n", " this.clearInput(); // We want to close the dropdown if we are dealing with a single select box\n", " if (hasActiveDropdown && this._isSelectOneElement) {\n", " this.hideDropdown(true);\n", " this.containerOuter.focus();\n", " }\n", " };\n", " _proto._handleBackspace = function _handleBackspace(activeItems) {\n", " if (!this.config.removeItems || !activeItems) {\n", " return;\n", " }\n", " var lastItem = activeItems[activeItems.length - 1];\n", " var hasHighlightedItems = activeItems.some(function (item) {\n", " return item.highlighted;\n", " }); // If editing the last item is allowed and there are not other selected items,\n", " // we can edit the item value. Otherwise if we can remove items, remove all selected items\n", " if (this.config.editItems && !hasHighlightedItems && lastItem) {\n", " this.input.value = lastItem.value;\n", " this.input.setWidth();\n", " this._removeItem(lastItem);\n", " this._triggerChange(lastItem.value);\n", " }\n", " else {\n", " if (!hasHighlightedItems) {\n", " // Highlight last item if none already highlighted\n", " this.highlightItem(lastItem, false);\n", " }\n", " this.removeHighlightedItems(true);\n", " }\n", " };\n", " _proto._startLoading = function _startLoading() {\n", " this._store.dispatch(setIsLoading(true));\n", " };\n", " _proto._stopLoading = function _stopLoading() {\n", " this._store.dispatch(setIsLoading(false));\n", " };\n", " _proto._handleLoadingState = function _handleLoadingState(setLoading) {\n", " if (setLoading === void 0) {\n", " setLoading = true;\n", " }\n", " var placeholderItem = this.itemList.getChild(\".\" + this.config.classNames.placeholder);\n", " if (setLoading) {\n", " this.disable();\n", " this.containerOuter.addLoadingState();\n", " if (this._isSelectOneElement) {\n", " if (!placeholderItem) {\n", " placeholderItem = this._getTemplate('placeholder', this.config.loadingText);\n", " this.itemList.append(placeholderItem);\n", " }\n", " else {\n", " placeholderItem.innerHTML = this.config.loadingText;\n", " }\n", " }\n", " else {\n", " this.input.placeholder = this.config.loadingText;\n", " }\n", " }\n", " else {\n", " this.enable();\n", " this.containerOuter.removeLoadingState();\n", " if (this._isSelectOneElement) {\n", " placeholderItem.innerHTML = this._placeholderValue || '';\n", " }\n", " else {\n", " this.input.placeholder = this._placeholderValue || '';\n", " }\n", " }\n", " };\n", " _proto._handleSearch = function _handleSearch(value) {\n", " if (!value || !this.input.isFocussed) {\n", " return;\n", " }\n", " var choices = this._store.choices;\n", " var _this$config3 = this.config, searchFloor = _this$config3.searchFloor, searchChoices = _this$config3.searchChoices;\n", " var hasUnactiveChoices = choices.some(function (option) {\n", " return !option.active;\n", " }); // Check that we have a value to search and the input was an alphanumeric character\n", " if (value && value.length >= searchFloor) {\n", " var resultCount = searchChoices ? this._searchChoices(value) : 0; // Trigger search event\n", " this.passedElement.triggerEvent(EVENTS.search, {\n", " value: value,\n", " resultCount: resultCount\n", " });\n", " }\n", " else if (hasUnactiveChoices) {\n", " // Otherwise reset choices to active\n", " this._isSearching = false;\n", " this._store.dispatch(choices_activateChoices(true));\n", " }\n", " };\n", " _proto._canAddItem = function _canAddItem(activeItems, value) {\n", " var canAddItem = true;\n", " var notice = typeof this.config.addItemText === 'function' ? this.config.addItemText(value) : this.config.addItemText;\n", " if (!this._isSelectOneElement) {\n", " var isDuplicateValue = existsInArray(activeItems, value);\n", " if (this.config.maxItemCount > 0 && this.config.maxItemCount <= activeItems.length) {\n", " // If there is a max entry limit and we have reached that limit\n", " // don't update\n", " canAddItem = false;\n", " notice = typeof this.config.maxItemText === 'function' ? this.config.maxItemText(this.config.maxItemCount) : this.config.maxItemText;\n", " }\n", " if (!this.config.duplicateItemsAllowed && isDuplicateValue && canAddItem) {\n", " canAddItem = false;\n", " notice = typeof this.config.uniqueItemText === 'function' ? this.config.uniqueItemText(value) : this.config.uniqueItemText;\n", " }\n", " if (this._isTextElement && this.config.addItems && canAddItem && typeof this.config.addItemFilter === 'function' && !this.config.addItemFilter(value)) {\n", " canAddItem = false;\n", " notice = typeof this.config.customAddItemText === 'function' ? this.config.customAddItemText(value) : this.config.customAddItemText;\n", " }\n", " }\n", " return {\n", " response: canAddItem,\n", " notice: notice\n", " };\n", " };\n", " _proto._searchChoices = function _searchChoices(value) {\n", " var newValue = typeof value === 'string' ? value.trim() : value;\n", " var currentValue = typeof this._currentValue === 'string' ? this._currentValue.trim() : this._currentValue;\n", " if (newValue.length < 1 && newValue === currentValue + \" \") {\n", " return 0;\n", " } // If new value matches the desired length and is not the same as the current value with a space\n", " var haystack = this._store.searchableChoices;\n", " var needle = newValue;\n", " var keys = [].concat(this.config.searchFields);\n", " var options = Object.assign(this.config.fuseOptions, {\n", " keys: keys\n", " });\n", " var fuse = new fuse_default.a(haystack, options);\n", " var results = fuse.search(needle);\n", " this._currentValue = newValue;\n", " this._highlightPosition = 0;\n", " this._isSearching = true;\n", " this._store.dispatch(choices_filterChoices(results));\n", " return results.length;\n", " };\n", " _proto._addEventListeners = function _addEventListeners() {\n", " var _document = document, documentElement = _document.documentElement; // capture events - can cancel event processing or propagation\n", " documentElement.addEventListener('touchend', this._onTouchEnd, true);\n", " this.containerOuter.element.addEventListener('keydown', this._onKeyDown, true);\n", " this.containerOuter.element.addEventListener('mousedown', this._onMouseDown, true); // passive events - doesn't call `preventDefault` or `stopPropagation`\n", " documentElement.addEventListener('click', this._onClick, {\n", " passive: true\n", " });\n", " documentElement.addEventListener('touchmove', this._onTouchMove, {\n", " passive: true\n", " });\n", " this.dropdown.element.addEventListener('mouseover', this._onMouseOver, {\n", " passive: true\n", " });\n", " if (this._isSelectOneElement) {\n", " this.containerOuter.element.addEventListener('focus', this._onFocus, {\n", " passive: true\n", " });\n", " this.containerOuter.element.addEventListener('blur', this._onBlur, {\n", " passive: true\n", " });\n", " }\n", " this.input.element.addEventListener('keyup', this._onKeyUp, {\n", " passive: true\n", " });\n", " this.input.element.addEventListener('focus', this._onFocus, {\n", " passive: true\n", " });\n", " this.input.element.addEventListener('blur', this._onBlur, {\n", " passive: true\n", " });\n", " if (this.input.element.form) {\n", " this.input.element.form.addEventListener('reset', this._onFormReset, {\n", " passive: true\n", " });\n", " }\n", " this.input.addEventListeners();\n", " };\n", " _proto._removeEventListeners = function _removeEventListeners() {\n", " var _document2 = document, documentElement = _document2.documentElement;\n", " documentElement.removeEventListener('touchend', this._onTouchEnd, true);\n", " this.containerOuter.element.removeEventListener('keydown', this._onKeyDown, true);\n", " this.containerOuter.element.removeEventListener('mousedown', this._onMouseDown, true);\n", " documentElement.removeEventListener('click', this._onClick);\n", " documentElement.removeEventListener('touchmove', this._onTouchMove);\n", " this.dropdown.element.removeEventListener('mouseover', this._onMouseOver);\n", " if (this._isSelectOneElement) {\n", " this.containerOuter.element.removeEventListener('focus', this._onFocus);\n", " this.containerOuter.element.removeEventListener('blur', this._onBlur);\n", " }\n", " this.input.element.removeEventListener('keyup', this._onKeyUp);\n", " this.input.element.removeEventListener('focus', this._onFocus);\n", " this.input.element.removeEventListener('blur', this._onBlur);\n", " if (this.input.element.form) {\n", " this.input.element.form.removeEventListener('reset', this._onFormReset);\n", " }\n", " this.input.removeEventListeners();\n", " };\n", " _proto._onKeyDown = function _onKeyDown(event) {\n", " var _keyDownActions;\n", " var target = event.target, keyCode = event.keyCode, ctrlKey = event.ctrlKey, metaKey = event.metaKey;\n", " var activeItems = this._store.activeItems;\n", " var hasFocusedInput = this.input.isFocussed;\n", " var hasActiveDropdown = this.dropdown.isActive;\n", " var hasItems = this.itemList.hasChildren();\n", " var keyString = String.fromCharCode(keyCode);\n", " var BACK_KEY = KEY_CODES.BACK_KEY, DELETE_KEY = KEY_CODES.DELETE_KEY, ENTER_KEY = KEY_CODES.ENTER_KEY, A_KEY = KEY_CODES.A_KEY, ESC_KEY = KEY_CODES.ESC_KEY, UP_KEY = KEY_CODES.UP_KEY, DOWN_KEY = KEY_CODES.DOWN_KEY, PAGE_UP_KEY = KEY_CODES.PAGE_UP_KEY, PAGE_DOWN_KEY = KEY_CODES.PAGE_DOWN_KEY;\n", " var hasCtrlDownKeyPressed = ctrlKey || metaKey; // If a user is typing and the dropdown is not active\n", " if (!this._isTextElement && /[a-zA-Z0-9-_ ]/.test(keyString)) {\n", " this.showDropdown();\n", " } // Map keys to key actions\n", " var keyDownActions = (_keyDownActions = {}, _keyDownActions[A_KEY] = this._onAKey, _keyDownActions[ENTER_KEY] = this._onEnterKey, _keyDownActions[ESC_KEY] = this._onEscapeKey, _keyDownActions[UP_KEY] = this._onDirectionKey, _keyDownActions[PAGE_UP_KEY] = this._onDirectionKey, _keyDownActions[DOWN_KEY] = this._onDirectionKey, _keyDownActions[PAGE_DOWN_KEY] = this._onDirectionKey, _keyDownActions[DELETE_KEY] = this._onDeleteKey, _keyDownActions[BACK_KEY] = this._onDeleteKey, _keyDownActions); // If keycode has a function, run it\n", " if (keyDownActions[keyCode]) {\n", " keyDownActions[keyCode]({\n", " event: event,\n", " target: target,\n", " keyCode: keyCode,\n", " metaKey: metaKey,\n", " activeItems: activeItems,\n", " hasFocusedInput: hasFocusedInput,\n", " hasActiveDropdown: hasActiveDropdown,\n", " hasItems: hasItems,\n", " hasCtrlDownKeyPressed: hasCtrlDownKeyPressed\n", " });\n", " }\n", " };\n", " _proto._onKeyUp = function _onKeyUp(_ref2) {\n", " var target = _ref2.target, keyCode = _ref2.keyCode;\n", " var value = this.input.value;\n", " var activeItems = this._store.activeItems;\n", " var canAddItem = this._canAddItem(activeItems, value);\n", " var backKey = KEY_CODES.BACK_KEY, deleteKey = KEY_CODES.DELETE_KEY; // We are typing into a text input and have a value, we want to show a dropdown\n", " // notice. Otherwise hide the dropdown\n", " if (this._isTextElement) {\n", " var canShowDropdownNotice = canAddItem.notice && value;\n", " if (canShowDropdownNotice) {\n", " var dropdownItem = this._getTemplate('notice', canAddItem.notice);\n", " this.dropdown.element.innerHTML = dropdownItem.outerHTML;\n", " this.showDropdown(true);\n", " }\n", " else {\n", " this.hideDropdown(true);\n", " }\n", " }\n", " else {\n", " var userHasRemovedValue = (keyCode === backKey || keyCode === deleteKey) && !target.value;\n", " var canReactivateChoices = !this._isTextElement && this._isSearching;\n", " var canSearch = this._canSearch && canAddItem.response;\n", " if (userHasRemovedValue && canReactivateChoices) {\n", " this._isSearching = false;\n", " this._store.dispatch(choices_activateChoices(true));\n", " }\n", " else if (canSearch) {\n", " this._handleSearch(this.input.value);\n", " }\n", " }\n", " this._canSearch = this.config.searchEnabled;\n", " };\n", " _proto._onAKey = function _onAKey(_ref3) {\n", " var hasItems = _ref3.hasItems, hasCtrlDownKeyPressed = _ref3.hasCtrlDownKeyPressed;\n", " // If CTRL + A or CMD + A have been pressed and there are items to select\n", " if (hasCtrlDownKeyPressed && hasItems) {\n", " this._canSearch = false;\n", " var shouldHightlightAll = this.config.removeItems && !this.input.value && this.input.element === document.activeElement;\n", " if (shouldHightlightAll) {\n", " this.highlightAll();\n", " }\n", " }\n", " };\n", " _proto._onEnterKey = function _onEnterKey(_ref4) {\n", " var event = _ref4.event, target = _ref4.target, activeItems = _ref4.activeItems, hasActiveDropdown = _ref4.hasActiveDropdown;\n", " var enterKey = KEY_CODES.ENTER_KEY;\n", " var targetWasButton = target.hasAttribute('data-button');\n", " if (this._isTextElement && target.value) {\n", " var value = this.input.value;\n", " var canAddItem = this._canAddItem(activeItems, value);\n", " if (canAddItem.response) {\n", " this.hideDropdown(true);\n", " this._addItem({\n", " value: value\n", " });\n", " this._triggerChange(value);\n", " this.clearInput();\n", " }\n", " }\n", " if (targetWasButton) {\n", " this._handleButtonAction(activeItems, target);\n", " event.preventDefault();\n", " }\n", " if (hasActiveDropdown) {\n", " var highlightedChoice = this.dropdown.getChild(\".\" + this.config.classNames.highlightedState);\n", " if (highlightedChoice) {\n", " // add enter keyCode value\n", " if (activeItems[0]) {\n", " activeItems[0].keyCode = enterKey; // eslint-disable-line no-param-reassign\n", " }\n", " this._handleChoiceAction(activeItems, highlightedChoice);\n", " }\n", " event.preventDefault();\n", " }\n", " else if (this._isSelectOneElement) {\n", " this.showDropdown();\n", " event.preventDefault();\n", " }\n", " };\n", " _proto._onEscapeKey = function _onEscapeKey(_ref5) {\n", " var hasActiveDropdown = _ref5.hasActiveDropdown;\n", " if (hasActiveDropdown) {\n", " this.hideDropdown(true);\n", " this.containerOuter.focus();\n", " }\n", " };\n", " _proto._onDirectionKey = function _onDirectionKey(_ref6) {\n", " var event = _ref6.event, hasActiveDropdown = _ref6.hasActiveDropdown, keyCode = _ref6.keyCode, metaKey = _ref6.metaKey;\n", " var downKey = KEY_CODES.DOWN_KEY, pageUpKey = KEY_CODES.PAGE_UP_KEY, pageDownKey = KEY_CODES.PAGE_DOWN_KEY; // If up or down key is pressed, traverse through options\n", " if (hasActiveDropdown || this._isSelectOneElement) {\n", " this.showDropdown();\n", " this._canSearch = false;\n", " var directionInt = keyCode === downKey || keyCode === pageDownKey ? 1 : -1;\n", " var skipKey = metaKey || keyCode === pageDownKey || keyCode === pageUpKey;\n", " var selectableChoiceIdentifier = '[data-choice-selectable]';\n", " var nextEl;\n", " if (skipKey) {\n", " if (directionInt > 0) {\n", " nextEl = this.dropdown.element.querySelector(selectableChoiceIdentifier + \":last-of-type\");\n", " }\n", " else {\n", " nextEl = this.dropdown.element.querySelector(selectableChoiceIdentifier);\n", " }\n", " }\n", " else {\n", " var currentEl = this.dropdown.element.querySelector(\".\" + this.config.classNames.highlightedState);\n", " if (currentEl) {\n", " nextEl = getAdjacentEl(currentEl, selectableChoiceIdentifier, directionInt);\n", " }\n", " else {\n", " nextEl = this.dropdown.element.querySelector(selectableChoiceIdentifier);\n", " }\n", " }\n", " if (nextEl) {\n", " // We prevent default to stop the cursor moving\n", " // when pressing the arrow\n", " if (!isScrolledIntoView(nextEl, this.choiceList.element, directionInt)) {\n", " this.choiceList.scrollToChildElement(nextEl, directionInt);\n", " }\n", " this._highlightChoice(nextEl);\n", " } // Prevent default to maintain cursor position whilst\n", " // traversing dropdown options\n", " event.preventDefault();\n", " }\n", " };\n", " _proto._onDeleteKey = function _onDeleteKey(_ref7) {\n", " var event = _ref7.event, target = _ref7.target, hasFocusedInput = _ref7.hasFocusedInput, activeItems = _ref7.activeItems;\n", " // If backspace or delete key is pressed and the input has no value\n", " if (hasFocusedInput && !target.value && !this._isSelectOneElement) {\n", " this._handleBackspace(activeItems);\n", " event.preventDefault();\n", " }\n", " };\n", " _proto._onTouchMove = function _onTouchMove() {\n", " if (this._wasTap) {\n", " this._wasTap = false;\n", " }\n", " };\n", " _proto._onTouchEnd = function _onTouchEnd(event) {\n", " var _ref8 = event || event.touches[0], target = _ref8.target;\n", " var touchWasWithinContainer = this._wasTap && this.containerOuter.element.contains(target);\n", " if (touchWasWithinContainer) {\n", " var containerWasExactTarget = target === this.containerOuter.element || target === this.containerInner.element;\n", " if (containerWasExactTarget) {\n", " if (this._isTextElement) {\n", " this.input.focus();\n", " }\n", " else if (this._isSelectMultipleElement) {\n", " this.showDropdown();\n", " }\n", " } // Prevents focus event firing\n", " event.stopPropagation();\n", " }\n", " this._wasTap = true;\n", " };\n", " _proto._onMouseDown = function _onMouseDown(event) {\n", " var target = event.target;\n", " if (!(target instanceof HTMLElement)) {\n", " return;\n", " } // If we have our mouse down on the scrollbar and are on IE11...\n", " if (IS_IE11 && this.choiceList.element.contains(target)) {\n", " // check if click was on a scrollbar area\n", " var firstChoice = \n", " /** @type {HTMLElement} */\n", " this.choiceList.element.firstElementChild;\n", " var isOnScrollbar = this._direction === 'ltr' ? event.offsetX >= firstChoice.offsetWidth : event.offsetX < firstChoice.offsetLeft;\n", " this._isScrollingOnIe = isOnScrollbar;\n", " }\n", " if (target === this.input.element) {\n", " return;\n", " }\n", " var item = target.closest('[data-button],[data-item],[data-choice]');\n", " if (item instanceof HTMLElement) {\n", " var hasShiftKey = event.shiftKey;\n", " var activeItems = this._store.activeItems;\n", " var dataset = item.dataset;\n", " if ('button' in dataset) {\n", " this._handleButtonAction(activeItems, item);\n", " }\n", " else if ('item' in dataset) {\n", " this._handleItemAction(activeItems, item, hasShiftKey);\n", " }\n", " else if ('choice' in dataset) {\n", " this._handleChoiceAction(activeItems, item);\n", " }\n", " }\n", " event.preventDefault();\n", " };\n", " _proto._onMouseOver = function _onMouseOver(_ref9) {\n", " var target = _ref9.target;\n", " if (target instanceof HTMLElement && 'choice' in target.dataset) {\n", " this._highlightChoice(target);\n", " }\n", " };\n", " _proto._onClick = function _onClick(_ref10) {\n", " var target = _ref10.target;\n", " var clickWasWithinContainer = this.containerOuter.element.contains(target);\n", " if (clickWasWithinContainer) {\n", " if (!this.dropdown.isActive && !this.containerOuter.isDisabled) {\n", " if (this._isTextElement) {\n", " if (document.activeElement !== this.input.element) {\n", " this.input.focus();\n", " }\n", " }\n", " else {\n", " this.showDropdown();\n", " this.containerOuter.focus();\n", " }\n", " }\n", " else if (this._isSelectOneElement && target !== this.input.element && !this.dropdown.element.contains(target)) {\n", " this.hideDropdown();\n", " }\n", " }\n", " else {\n", " var hasHighlightedItems = this._store.highlightedActiveItems.length > 0;\n", " if (hasHighlightedItems) {\n", " this.unhighlightAll();\n", " }\n", " this.containerOuter.removeFocusState();\n", " this.hideDropdown(true);\n", " }\n", " };\n", " _proto._onFocus = function _onFocus(_ref11) {\n", " var _this17 = this, _focusActions;\n", " var target = _ref11.target;\n", " var focusWasWithinContainer = this.containerOuter.element.contains(target);\n", " if (!focusWasWithinContainer) {\n", " return;\n", " }\n", " var focusActions = (_focusActions = {}, _focusActions[TEXT_TYPE] = function () {\n", " if (target === _this17.input.element) {\n", " _this17.containerOuter.addFocusState();\n", " }\n", " }, _focusActions[SELECT_ONE_TYPE] = function () {\n", " _this17.containerOuter.addFocusState();\n", " if (target === _this17.input.element) {\n", " _this17.showDropdown(true);\n", " }\n", " }, _focusActions[SELECT_MULTIPLE_TYPE] = function () {\n", " if (target === _this17.input.element) {\n", " _this17.showDropdown(true); // If element is a select box, the focused element is the container and the dropdown\n", " // isn't already open, focus and show dropdown\n", " _this17.containerOuter.addFocusState();\n", " }\n", " }, _focusActions);\n", " focusActions[this.passedElement.element.type]();\n", " };\n", " _proto._onBlur = function _onBlur(_ref12) {\n", " var _this18 = this;\n", " var target = _ref12.target;\n", " var blurWasWithinContainer = this.containerOuter.element.contains(target);\n", " if (blurWasWithinContainer && !this._isScrollingOnIe) {\n", " var _blurActions;\n", " var activeItems = this._store.activeItems;\n", " var hasHighlightedItems = activeItems.some(function (item) {\n", " return item.highlighted;\n", " });\n", " var blurActions = (_blurActions = {}, _blurActions[TEXT_TYPE] = function () {\n", " if (target === _this18.input.element) {\n", " _this18.containerOuter.removeFocusState();\n", " if (hasHighlightedItems) {\n", " _this18.unhighlightAll();\n", " }\n", " _this18.hideDropdown(true);\n", " }\n", " }, _blurActions[SELECT_ONE_TYPE] = function () {\n", " _this18.containerOuter.removeFocusState();\n", " if (target === _this18.input.element || target === _this18.containerOuter.element && !_this18._canSearch) {\n", " _this18.hideDropdown(true);\n", " }\n", " }, _blurActions[SELECT_MULTIPLE_TYPE] = function () {\n", " if (target === _this18.input.element) {\n", " _this18.containerOuter.removeFocusState();\n", " _this18.hideDropdown(true);\n", " if (hasHighlightedItems) {\n", " _this18.unhighlightAll();\n", " }\n", " }\n", " }, _blurActions);\n", " blurActions[this.passedElement.element.type]();\n", " }\n", " else {\n", " // On IE11, clicking the scollbar blurs our input and thus\n", " // closes the dropdown. To stop this, we refocus our input\n", " // if we know we are on IE *and* are scrolling.\n", " this._isScrollingOnIe = false;\n", " this.input.element.focus();\n", " }\n", " };\n", " _proto._onFormReset = function _onFormReset() {\n", " this._store.dispatch(resetTo(this._initialState));\n", " };\n", " _proto._highlightChoice = function _highlightChoice(el) {\n", " var _this19 = this;\n", " if (el === void 0) {\n", " el = null;\n", " }\n", " var choices = Array.from(this.dropdown.element.querySelectorAll('[data-choice-selectable]'));\n", " if (!choices.length) {\n", " return;\n", " }\n", " var passedEl = el;\n", " var highlightedChoices = Array.from(this.dropdown.element.querySelectorAll(\".\" + this.config.classNames.highlightedState)); // Remove any highlighted choices\n", " highlightedChoices.forEach(function (choice) {\n", " choice.classList.remove(_this19.config.classNames.highlightedState);\n", " choice.setAttribute('aria-selected', 'false');\n", " });\n", " if (passedEl) {\n", " this._highlightPosition = choices.indexOf(passedEl);\n", " }\n", " else {\n", " // Highlight choice based on last known highlight location\n", " if (choices.length > this._highlightPosition) {\n", " // If we have an option to highlight\n", " passedEl = choices[this._highlightPosition];\n", " }\n", " else {\n", " // Otherwise highlight the option before\n", " passedEl = choices[choices.length - 1];\n", " }\n", " if (!passedEl) {\n", " passedEl = choices[0];\n", " }\n", " }\n", " passedEl.classList.add(this.config.classNames.highlightedState);\n", " passedEl.setAttribute('aria-selected', 'true');\n", " this.passedElement.triggerEvent(EVENTS.highlightChoice, {\n", " el: passedEl\n", " });\n", " if (this.dropdown.isActive) {\n", " // IE11 ignores aria-label and blocks virtual keyboard\n", " // if aria-activedescendant is set without a dropdown\n", " this.input.setActiveDescendant(passedEl.id);\n", " this.containerOuter.setActiveDescendant(passedEl.id);\n", " }\n", " };\n", " _proto._addItem = function _addItem(_ref13) {\n", " var value = _ref13.value, _ref13$label = _ref13.label, label = _ref13$label === void 0 ? null : _ref13$label, _ref13$choiceId = _ref13.choiceId, choiceId = _ref13$choiceId === void 0 ? -1 : _ref13$choiceId, _ref13$groupId = _ref13.groupId, groupId = _ref13$groupId === void 0 ? -1 : _ref13$groupId, _ref13$customProperti = _ref13.customProperties, customProperties = _ref13$customProperti === void 0 ? null : _ref13$customProperti, _ref13$placeholder = _ref13.placeholder, placeholder = _ref13$placeholder === void 0 ? false : _ref13$placeholder, _ref13$keyCode = _ref13.keyCode, keyCode = _ref13$keyCode === void 0 ? null : _ref13$keyCode;\n", " var passedValue = typeof value === 'string' ? value.trim() : value;\n", " var passedKeyCode = keyCode;\n", " var passedCustomProperties = customProperties;\n", " var items = this._store.items;\n", " var passedLabel = label || passedValue;\n", " var passedOptionId = choiceId || -1;\n", " var group = groupId >= 0 ? this._store.getGroupById(groupId) : null;\n", " var id = items ? items.length + 1 : 1; // If a prepended value has been passed, prepend it\n", " if (this.config.prependValue) {\n", " passedValue = this.config.prependValue + passedValue.toString();\n", " } // If an appended value has been passed, append it\n", " if (this.config.appendValue) {\n", " passedValue += this.config.appendValue.toString();\n", " }\n", " this._store.dispatch(items_addItem({\n", " value: passedValue,\n", " label: passedLabel,\n", " id: id,\n", " choiceId: passedOptionId,\n", " groupId: groupId,\n", " customProperties: customProperties,\n", " placeholder: placeholder,\n", " keyCode: passedKeyCode\n", " }));\n", " if (this._isSelectOneElement) {\n", " this.removeActiveItems(id);\n", " } // Trigger change event\n", " this.passedElement.triggerEvent(EVENTS.addItem, {\n", " id: id,\n", " value: passedValue,\n", " label: passedLabel,\n", " customProperties: passedCustomProperties,\n", " groupValue: group && group.value ? group.value : undefined,\n", " keyCode: passedKeyCode\n", " });\n", " return this;\n", " };\n", " _proto._removeItem = function _removeItem(item) {\n", " if (!item || !isType('Object', item)) {\n", " return this;\n", " }\n", " var id = item.id, value = item.value, label = item.label, choiceId = item.choiceId, groupId = item.groupId;\n", " var group = groupId >= 0 ? this._store.getGroupById(groupId) : null;\n", " this._store.dispatch(items_removeItem(id, choiceId));\n", " if (group && group.value) {\n", " this.passedElement.triggerEvent(EVENTS.removeItem, {\n", " id: id,\n", " value: value,\n", " label: label,\n", " groupValue: group.value\n", " });\n", " }\n", " else {\n", " this.passedElement.triggerEvent(EVENTS.removeItem, {\n", " id: id,\n", " value: value,\n", " label: label\n", " });\n", " }\n", " return this;\n", " };\n", " _proto._addChoice = function _addChoice(_ref14) {\n", " var value = _ref14.value, _ref14$label = _ref14.label, label = _ref14$label === void 0 ? null : _ref14$label, _ref14$isSelected = _ref14.isSelected, isSelected = _ref14$isSelected === void 0 ? false : _ref14$isSelected, _ref14$isDisabled = _ref14.isDisabled, isDisabled = _ref14$isDisabled === void 0 ? false : _ref14$isDisabled, _ref14$groupId = _ref14.groupId, groupId = _ref14$groupId === void 0 ? -1 : _ref14$groupId, _ref14$customProperti = _ref14.customProperties, customProperties = _ref14$customProperti === void 0 ? null : _ref14$customProperti, _ref14$placeholder = _ref14.placeholder, placeholder = _ref14$placeholder === void 0 ? false : _ref14$placeholder, _ref14$keyCode = _ref14.keyCode, keyCode = _ref14$keyCode === void 0 ? null : _ref14$keyCode;\n", " if (typeof value === 'undefined' || value === null) {\n", " return;\n", " } // Generate unique id\n", " var choices = this._store.choices;\n", " var choiceLabel = label || value;\n", " var choiceId = choices ? choices.length + 1 : 1;\n", " var choiceElementId = this._baseId + \"-\" + this._idNames.itemChoice + \"-\" + choiceId;\n", " this._store.dispatch(choices_addChoice({\n", " id: choiceId,\n", " groupId: groupId,\n", " elementId: choiceElementId,\n", " value: value,\n", " label: choiceLabel,\n", " disabled: isDisabled,\n", " customProperties: customProperties,\n", " placeholder: placeholder,\n", " keyCode: keyCode\n", " }));\n", " if (isSelected) {\n", " this._addItem({\n", " value: value,\n", " label: choiceLabel,\n", " choiceId: choiceId,\n", " customProperties: customProperties,\n", " placeholder: placeholder,\n", " keyCode: keyCode\n", " });\n", " }\n", " };\n", " _proto._addGroup = function _addGroup(_ref15) {\n", " var _this20 = this;\n", " var group = _ref15.group, id = _ref15.id, _ref15$valueKey = _ref15.valueKey, valueKey = _ref15$valueKey === void 0 ? 'value' : _ref15$valueKey, _ref15$labelKey = _ref15.labelKey, labelKey = _ref15$labelKey === void 0 ? 'label' : _ref15$labelKey;\n", " var groupChoices = isType('Object', group) ? group.choices : Array.from(group.getElementsByTagName('OPTION'));\n", " var groupId = id || Math.floor(new Date().valueOf() * Math.random());\n", " var isDisabled = group.disabled ? group.disabled : false;\n", " if (groupChoices) {\n", " this._store.dispatch(groups_addGroup({\n", " value: group.label,\n", " id: groupId,\n", " active: true,\n", " disabled: isDisabled\n", " }));\n", " var addGroupChoices = function addGroupChoices(choice) {\n", " var isOptDisabled = choice.disabled || choice.parentNode && choice.parentNode.disabled;\n", " _this20._addChoice({\n", " value: choice[valueKey],\n", " label: isType('Object', choice) ? choice[labelKey] : choice.innerHTML,\n", " isSelected: choice.selected,\n", " isDisabled: isOptDisabled,\n", " groupId: groupId,\n", " customProperties: choice.customProperties,\n", " placeholder: choice.placeholder\n", " });\n", " };\n", " groupChoices.forEach(addGroupChoices);\n", " }\n", " else {\n", " this._store.dispatch(groups_addGroup({\n", " value: group.label,\n", " id: group.id,\n", " active: false,\n", " disabled: group.disabled\n", " }));\n", " }\n", " };\n", " _proto._getTemplate = function _getTemplate(template) {\n", " var _this$_templates$temp;\n", " if (!template) {\n", " return null;\n", " }\n", " var classNames = this.config.classNames;\n", " for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n", " args[_key - 1] = arguments[_key];\n", " }\n", " return (_this$_templates$temp = this._templates[template]).call.apply(_this$_templates$temp, [this, classNames].concat(args));\n", " };\n", " _proto._createTemplates = function _createTemplates() {\n", " var callbackOnCreateTemplates = this.config.callbackOnCreateTemplates;\n", " var userTemplates = {};\n", " if (callbackOnCreateTemplates && typeof callbackOnCreateTemplates === 'function') {\n", " userTemplates = callbackOnCreateTemplates.call(this, strToEl);\n", " }\n", " this._templates = cjs_default()(TEMPLATES, userTemplates);\n", " };\n", " _proto._createElements = function _createElements() {\n", " this.containerOuter = new container_Container({\n", " element: this._getTemplate('containerOuter', this._direction, this._isSelectElement, this._isSelectOneElement, this.config.searchEnabled, this.passedElement.element.type),\n", " classNames: this.config.classNames,\n", " type: this.passedElement.element.type,\n", " position: this.config.position\n", " });\n", " this.containerInner = new container_Container({\n", " element: this._getTemplate('containerInner'),\n", " classNames: this.config.classNames,\n", " type: this.passedElement.element.type,\n", " position: this.config.position\n", " });\n", " this.input = new input_Input({\n", " element: this._getTemplate('input', this._placeholderValue),\n", " classNames: this.config.classNames,\n", " type: this.passedElement.element.type,\n", " preventPaste: !this.config.paste\n", " });\n", " this.choiceList = new list_List({\n", " element: this._getTemplate('choiceList', this._isSelectOneElement)\n", " });\n", " this.itemList = new list_List({\n", " element: this._getTemplate('itemList', this._isSelectOneElement)\n", " });\n", " this.dropdown = new Dropdown({\n", " element: this._getTemplate('dropdown'),\n", " classNames: this.config.classNames,\n", " type: this.passedElement.element.type\n", " });\n", " };\n", " _proto._createStructure = function _createStructure() {\n", " // Hide original element\n", " this.passedElement.conceal(); // Wrap input in container preserving DOM ordering\n", " this.containerInner.wrap(this.passedElement.element); // Wrapper inner container with outer container\n", " this.containerOuter.wrap(this.containerInner.element);\n", " if (this._isSelectOneElement) {\n", " this.input.placeholder = this.config.searchPlaceholderValue || '';\n", " }\n", " else if (this._placeholderValue) {\n", " this.input.placeholder = this._placeholderValue;\n", " this.input.setWidth();\n", " }\n", " this.containerOuter.element.appendChild(this.containerInner.element);\n", " this.containerOuter.element.appendChild(this.dropdown.element);\n", " this.containerInner.element.appendChild(this.itemList.element);\n", " if (!this._isTextElement) {\n", " this.dropdown.element.appendChild(this.choiceList.element);\n", " }\n", " if (!this._isSelectOneElement) {\n", " this.containerInner.element.appendChild(this.input.element);\n", " }\n", " else if (this.config.searchEnabled) {\n", " this.dropdown.element.insertBefore(this.input.element, this.dropdown.element.firstChild);\n", " }\n", " if (this._isSelectElement) {\n", " this._highlightPosition = 0;\n", " this._isSearching = false;\n", " this._startLoading();\n", " if (this._presetGroups.length) {\n", " this._addPredefinedGroups(this._presetGroups);\n", " }\n", " else {\n", " this._addPredefinedChoices(this._presetChoices);\n", " }\n", " this._stopLoading();\n", " }\n", " if (this._isTextElement) {\n", " this._addPredefinedItems(this._presetItems);\n", " }\n", " };\n", " _proto._addPredefinedGroups = function _addPredefinedGroups(groups) {\n", " var _this21 = this;\n", " // If we have a placeholder option\n", " var placeholderChoice = this.passedElement.placeholderOption;\n", " if (placeholderChoice && placeholderChoice.parentNode.tagName === 'SELECT') {\n", " this._addChoice({\n", " value: placeholderChoice.value,\n", " label: placeholderChoice.innerHTML,\n", " isSelected: placeholderChoice.selected,\n", " isDisabled: placeholderChoice.disabled,\n", " placeholder: true\n", " });\n", " }\n", " groups.forEach(function (group) {\n", " return _this21._addGroup({\n", " group: group,\n", " id: group.id || null\n", " });\n", " });\n", " };\n", " _proto._addPredefinedChoices = function _addPredefinedChoices(choices) {\n", " var _this22 = this;\n", " // If sorting is enabled or the user is searching, filter choices\n", " if (this.config.shouldSort) {\n", " choices.sort(this.config.sorter);\n", " }\n", " var hasSelectedChoice = choices.some(function (choice) {\n", " return choice.selected;\n", " });\n", " var firstEnabledChoiceIndex = choices.findIndex(function (choice) {\n", " return choice.disabled === undefined || !choice.disabled;\n", " });\n", " choices.forEach(function (choice, index) {\n", " var value = choice.value, label = choice.label, customProperties = choice.customProperties, placeholder = choice.placeholder;\n", " if (_this22._isSelectElement) {\n", " // If the choice is actually a group\n", " if (choice.choices) {\n", " _this22._addGroup({\n", " group: choice,\n", " id: choice.id || null\n", " });\n", " }\n", " else {\n", " /**\n", " * If there is a selected choice already or the choice is not the first in\n", " * the array, add each choice normally.\n", " *\n", " * Otherwise we pre-select the first enabled choice in the array (\"select-one\" only)\n", " */\n", " var shouldPreselect = _this22._isSelectOneElement && !hasSelectedChoice && index === firstEnabledChoiceIndex;\n", " var isSelected = shouldPreselect ? true : choice.selected;\n", " var isDisabled = choice.disabled;\n", " _this22._addChoice({\n", " value: value,\n", " label: label,\n", " isSelected: isSelected,\n", " isDisabled: isDisabled,\n", " customProperties: customProperties,\n", " placeholder: placeholder\n", " });\n", " }\n", " }\n", " else {\n", " _this22._addChoice({\n", " value: value,\n", " label: label,\n", " isSelected: choice.selected,\n", " isDisabled: choice.disabled,\n", " customProperties: customProperties,\n", " placeholder: placeholder\n", " });\n", " }\n", " });\n", " };\n", " _proto._addPredefinedItems = function _addPredefinedItems(items) {\n", " var _this23 = this;\n", " items.forEach(function (item) {\n", " if (typeof item === 'object' && item.value) {\n", " _this23._addItem({\n", " value: item.value,\n", " label: item.label,\n", " choiceId: item.id,\n", " customProperties: item.customProperties,\n", " placeholder: item.placeholder\n", " });\n", " }\n", " if (typeof item === 'string') {\n", " _this23._addItem({\n", " value: item\n", " });\n", " }\n", " });\n", " };\n", " _proto._setChoiceOrItem = function _setChoiceOrItem(item) {\n", " var _this24 = this;\n", " var itemType = getType(item).toLowerCase();\n", " var handleType = {\n", " object: function object() {\n", " if (!item.value) {\n", " return;\n", " } // If we are dealing with a select input, we need to create an option first\n", " // that is then selected. For text inputs we can just add items normally.\n", " if (!_this24._isTextElement) {\n", " _this24._addChoice({\n", " value: item.value,\n", " label: item.label,\n", " isSelected: true,\n", " isDisabled: false,\n", " customProperties: item.customProperties,\n", " placeholder: item.placeholder\n", " });\n", " }\n", " else {\n", " _this24._addItem({\n", " value: item.value,\n", " label: item.label,\n", " choiceId: item.id,\n", " customProperties: item.customProperties,\n", " placeholder: item.placeholder\n", " });\n", " }\n", " },\n", " string: function string() {\n", " if (!_this24._isTextElement) {\n", " _this24._addChoice({\n", " value: item,\n", " label: item,\n", " isSelected: true,\n", " isDisabled: false\n", " });\n", " }\n", " else {\n", " _this24._addItem({\n", " value: item\n", " });\n", " }\n", " }\n", " };\n", " handleType[itemType]();\n", " };\n", " _proto._findAndSelectChoiceByValue = function _findAndSelectChoiceByValue(val) {\n", " var _this25 = this;\n", " var choices = this._store.choices; // Check 'value' property exists and the choice isn't already selected\n", " var foundChoice = choices.find(function (choice) {\n", " return _this25.config.valueComparer(choice.value, val);\n", " });\n", " if (foundChoice && !foundChoice.selected) {\n", " this._addItem({\n", " value: foundChoice.value,\n", " label: foundChoice.label,\n", " choiceId: foundChoice.id,\n", " groupId: foundChoice.groupId,\n", " customProperties: foundChoice.customProperties,\n", " placeholder: foundChoice.placeholder,\n", " keyCode: foundChoice.keyCode\n", " });\n", " }\n", " };\n", " _proto._generatePlaceholderValue = function _generatePlaceholderValue() {\n", " if (this._isSelectElement) {\n", " var placeholderOption = this.passedElement.placeholderOption;\n", " return placeholderOption ? placeholderOption.text : false;\n", " }\n", " var _this$config4 = this.config, placeholder = _this$config4.placeholder, placeholderValue = _this$config4.placeholderValue;\n", " var dataset = this.passedElement.element.dataset;\n", " if (placeholder) {\n", " if (placeholderValue) {\n", " return placeholderValue;\n", " }\n", " if (dataset.placeholder) {\n", " return dataset.placeholder;\n", " }\n", " }\n", " return false;\n", " };\n", " return Choices;\n", " }();\n", " /* harmony default export */ var scripts_choices = __webpack_exports__[\"default\"] = (choices_Choices);\n", " /***/ \n", " })\n", " /******/ \n", " ])[\"default\"];\n", " });\n", " },\n", " 428: /* styles/widgets/choices.css.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const css = `\n", " .bk-root {\n", " /*===============================\n", " = Choices =\n", " ===============================*/\n", " /*===== End of Choices ======*/\n", " }\n", " .bk-root .choices {\n", " position: relative;\n", " margin-bottom: 24px;\n", " font-size: 16px;\n", " }\n", " .bk-root .choices:focus {\n", " outline: none;\n", " }\n", " .bk-root .choices:last-child {\n", " margin-bottom: 0;\n", " }\n", " .bk-root .choices.is-disabled .choices__inner,\n", " .bk-root .choices.is-disabled .choices__input {\n", " background-color: #eaeaea;\n", " cursor: not-allowed;\n", " -webkit-user-select: none;\n", " -ms-user-select: none;\n", " user-select: none;\n", " }\n", " .bk-root .choices.is-disabled .choices__item {\n", " cursor: not-allowed;\n", " }\n", " .bk-root .choices [hidden] {\n", " display: none !important;\n", " }\n", " .bk-root .choices[data-type*='select-one'] {\n", " cursor: pointer;\n", " }\n", " .bk-root .choices[data-type*='select-one'] .choices__inner {\n", " padding-bottom: 7.5px;\n", " }\n", " .bk-root .choices[data-type*='select-one'] .choices__input {\n", " display: block;\n", " width: 100%;\n", " padding: 10px;\n", " border-bottom: 1px solid #dddddd;\n", " background-color: #ffffff;\n", " margin: 0;\n", " }\n", " .bk-root .choices[data-type*='select-one'] .choices__button {\n", " background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjMDAwIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg==);\n", " padding: 0;\n", " background-size: 8px;\n", " position: absolute;\n", " top: 50%;\n", " right: 0;\n", " margin-top: -10px;\n", " margin-right: 25px;\n", " height: 20px;\n", " width: 20px;\n", " border-radius: 10em;\n", " opacity: 0.5;\n", " }\n", " .bk-root .choices[data-type*='select-one'] .choices__button:hover,\n", " .bk-root .choices[data-type*='select-one'] .choices__button:focus {\n", " opacity: 1;\n", " }\n", " .bk-root .choices[data-type*='select-one'] .choices__button:focus {\n", " box-shadow: 0px 0px 0px 2px #00bcd4;\n", " }\n", " .bk-root .choices[data-type*='select-one'] .choices__item[data-value=''] .choices__button {\n", " display: none;\n", " }\n", " .bk-root .choices[data-type*='select-one']:after {\n", " content: '';\n", " height: 0;\n", " width: 0;\n", " border-style: solid;\n", " border-color: #333333 transparent transparent transparent;\n", " border-width: 5px;\n", " position: absolute;\n", " right: 11.5px;\n", " top: 50%;\n", " margin-top: -2.5px;\n", " pointer-events: none;\n", " }\n", " .bk-root .choices[data-type*='select-one'].is-open:after {\n", " border-color: transparent transparent #333333 transparent;\n", " margin-top: -7.5px;\n", " }\n", " .bk-root .choices[data-type*='select-one'][dir='rtl']:after {\n", " left: 11.5px;\n", " right: auto;\n", " }\n", " .bk-root .choices[data-type*='select-one'][dir='rtl'] .choices__button {\n", " right: auto;\n", " left: 0;\n", " margin-left: 25px;\n", " margin-right: 0;\n", " }\n", " .bk-root .choices[data-type*='select-multiple'] .choices__inner,\n", " .bk-root .choices[data-type*='text'] .choices__inner {\n", " cursor: text;\n", " }\n", " .bk-root .choices[data-type*='select-multiple'] .choices__button,\n", " .bk-root .choices[data-type*='text'] .choices__button {\n", " position: relative;\n", " display: inline-block;\n", " margin-top: 0;\n", " margin-right: -4px;\n", " margin-bottom: 0;\n", " margin-left: 8px;\n", " padding-left: 16px;\n", " border-left: 1px solid #008fa1;\n", " background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjRkZGIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg==);\n", " background-size: 8px;\n", " width: 8px;\n", " line-height: 1;\n", " opacity: 0.75;\n", " border-radius: 0;\n", " }\n", " .bk-root .choices[data-type*='select-multiple'] .choices__button:hover,\n", " .bk-root .choices[data-type*='select-multiple'] .choices__button:focus,\n", " .bk-root .choices[data-type*='text'] .choices__button:hover,\n", " .bk-root .choices[data-type*='text'] .choices__button:focus {\n", " opacity: 1;\n", " }\n", " .bk-root .choices__inner {\n", " display: inline-block;\n", " vertical-align: top;\n", " width: 100%;\n", " background-color: #f9f9f9;\n", " padding: 7.5px 7.5px 3.75px;\n", " border: 1px solid #dddddd;\n", " border-radius: 2.5px;\n", " font-size: 14px;\n", " min-height: 44px;\n", " overflow: hidden;\n", " }\n", " .bk-root .is-focused .choices__inner,\n", " .bk-root .is-open .choices__inner {\n", " border-color: #b7b7b7;\n", " }\n", " .bk-root .is-open .choices__inner {\n", " border-radius: 2.5px 2.5px 0 0;\n", " }\n", " .bk-root .is-flipped.is-open .choices__inner {\n", " border-radius: 0 0 2.5px 2.5px;\n", " }\n", " .bk-root .choices__list {\n", " margin: 0;\n", " padding-left: 0;\n", " list-style: none;\n", " }\n", " .bk-root .choices__list--single {\n", " display: inline-block;\n", " padding: 4px 16px 4px 4px;\n", " width: 100%;\n", " }\n", " .bk-root [dir='rtl'] .choices__list--single {\n", " padding-right: 4px;\n", " padding-left: 16px;\n", " }\n", " .bk-root .choices__list--single .choices__item {\n", " width: 100%;\n", " }\n", " .bk-root .choices__list--multiple {\n", " display: inline;\n", " }\n", " .bk-root .choices__list--multiple .choices__item {\n", " display: inline-block;\n", " vertical-align: middle;\n", " border-radius: 20px;\n", " padding: 4px 10px;\n", " font-size: 12px;\n", " font-weight: 500;\n", " margin-right: 3.75px;\n", " margin-bottom: 3.75px;\n", " background-color: #00bcd4;\n", " border: 1px solid #00a5bb;\n", " color: #ffffff;\n", " word-break: break-all;\n", " box-sizing: border-box;\n", " }\n", " .bk-root .choices__list--multiple .choices__item[data-deletable] {\n", " padding-right: 5px;\n", " }\n", " .bk-root [dir='rtl'] .choices__list--multiple .choices__item {\n", " margin-right: 0;\n", " margin-left: 3.75px;\n", " }\n", " .bk-root .choices__list--multiple .choices__item.is-highlighted {\n", " background-color: #00a5bb;\n", " border: 1px solid #008fa1;\n", " }\n", " .bk-root .is-disabled .choices__list--multiple .choices__item {\n", " background-color: #aaaaaa;\n", " border: 1px solid #919191;\n", " }\n", " .bk-root .choices__list--dropdown {\n", " visibility: hidden;\n", " z-index: 1;\n", " position: absolute;\n", " width: 100%;\n", " background-color: #ffffff;\n", " border: 1px solid #dddddd;\n", " top: 100%;\n", " margin-top: -1px;\n", " border-bottom-left-radius: 2.5px;\n", " border-bottom-right-radius: 2.5px;\n", " overflow: hidden;\n", " word-break: break-all;\n", " will-change: visibility;\n", " }\n", " .bk-root .choices__list--dropdown.is-active {\n", " visibility: visible;\n", " }\n", " .bk-root .is-open .choices__list--dropdown {\n", " border-color: #b7b7b7;\n", " }\n", " .bk-root .is-flipped .choices__list--dropdown {\n", " top: auto;\n", " bottom: 100%;\n", " margin-top: 0;\n", " margin-bottom: -1px;\n", " border-radius: 0.25rem 0.25rem 0 0;\n", " }\n", " .bk-root .choices__list--dropdown .choices__list {\n", " position: relative;\n", " max-height: 300px;\n", " overflow: auto;\n", " -webkit-overflow-scrolling: touch;\n", " will-change: scroll-position;\n", " }\n", " .bk-root .choices__list--dropdown .choices__item {\n", " position: relative;\n", " padding: 10px;\n", " font-size: 14px;\n", " }\n", " .bk-root [dir='rtl'] .choices__list--dropdown .choices__item {\n", " text-align: right;\n", " }\n", " @media (min-width: 640px) {\n", " .bk-root .choices__list--dropdown .choices__item--selectable {\n", " padding-right: 100px;\n", " }\n", " .bk-root .choices__list--dropdown .choices__item--selectable:after {\n", " content: attr(data-select-text);\n", " font-size: 12px;\n", " opacity: 0;\n", " position: absolute;\n", " right: 10px;\n", " top: 50%;\n", " transform: translateY(-50%);\n", " }\n", " .bk-root [dir='rtl'] .choices__list--dropdown .choices__item--selectable {\n", " text-align: right;\n", " padding-left: 100px;\n", " padding-right: 10px;\n", " }\n", " .bk-root [dir='rtl'] .choices__list--dropdown .choices__item--selectable:after {\n", " right: auto;\n", " left: 10px;\n", " }\n", " }\n", " .bk-root .choices__list--dropdown .choices__item--selectable.is-highlighted {\n", " background-color: #f2f2f2;\n", " }\n", " .bk-root .choices__list--dropdown .choices__item--selectable.is-highlighted:after {\n", " opacity: 0.5;\n", " }\n", " .bk-root .choices__item {\n", " cursor: default;\n", " }\n", " .bk-root .choices__item--selectable {\n", " cursor: pointer;\n", " }\n", " .bk-root .choices__item--disabled {\n", " cursor: not-allowed;\n", " -webkit-user-select: none;\n", " -ms-user-select: none;\n", " user-select: none;\n", " opacity: 0.5;\n", " }\n", " .bk-root .choices__heading {\n", " font-weight: 600;\n", " font-size: 12px;\n", " padding: 10px;\n", " border-bottom: 1px solid #f7f7f7;\n", " color: gray;\n", " }\n", " .bk-root .choices__button {\n", " text-indent: -9999px;\n", " -webkit-appearance: none;\n", " -moz-appearance: none;\n", " appearance: none;\n", " border: 0;\n", " background-color: transparent;\n", " background-repeat: no-repeat;\n", " background-position: center;\n", " cursor: pointer;\n", " }\n", " .bk-root .choices__button:focus {\n", " outline: none;\n", " }\n", " .bk-root .choices__input {\n", " display: inline-block;\n", " vertical-align: baseline;\n", " background-color: #f9f9f9;\n", " font-size: 14px;\n", " margin-bottom: 5px;\n", " border: 0;\n", " border-radius: 0;\n", " max-width: 100%;\n", " padding: 4px 0 4px 2px;\n", " }\n", " .bk-root .choices__input:focus {\n", " outline: 0;\n", " }\n", " .bk-root [dir='rtl'] .choices__input {\n", " padding-right: 2px;\n", " padding-left: 0;\n", " }\n", " .bk-root .choices__placeholder {\n", " opacity: 0.5;\n", " }\n", " .bk-root .choices {\n", " width: 100%;\n", " }\n", " .bk-root .choices__inner .choices__item.light {\n", " background-color: rgba(0, 126, 255, 0.08);\n", " border-radius: 5px;\n", " border: 1px solid rgba(0, 126, 255, 0.24);\n", " color: #007eff;\n", " }\n", " .bk-root .choices__inner .choices__item.solid {\n", " background-color: #1f77b4;\n", " border: none;\n", " border-radius: 5px;\n", " color: white;\n", " }\n", " .bk-root .choices__inner .choices__item.solid .is-highlighted {\n", " background-color: #1f77b4;\n", " border: none;\n", " }\n", " .bk-root .choices__input {\n", " background-color: transparent;\n", " }\n", " .bk-root .choices__inner {\n", " background: transparent;\n", " border: 1px solid darkgray;\n", " border-radius: 5px;\n", " min-height: unset;\n", " }\n", " .bk-root .choices__list {\n", " white-space: initial;\n", " }\n", " .bk-root .choices[data-type*=select-multiple] .choices__button.light {\n", " background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjMDA3ZWZmIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg==);\n", " }\n", " .bk-root .choices[data-type*=select-multiple] .choices__button.solid {\n", " background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjZmZmZmZmIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg==);\n", " border-left: 1px solid white;\n", " opacity: 1;\n", " }\n", " `;\n", " exports.default = css;\n", " },\n", " 429: /* models/widgets/pretext.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const markup_1 = require(418) /* ./markup */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " class PreTextView extends markup_1.MarkupView {\n", " render() {\n", " super.render();\n", " const content = dom_1.pre({ style: { overflow: \"auto\" } }, this.model.text);\n", " this.markup_el.appendChild(content);\n", " }\n", " }\n", " exports.PreTextView = PreTextView;\n", " PreTextView.__name__ = \"PreTextView\";\n", " class PreText extends markup_1.Markup {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_PreText() {\n", " this.prototype.default_view = PreTextView;\n", " }\n", " }\n", " exports.PreText = PreText;\n", " PreText.__name__ = \"PreText\";\n", " PreText.init_PreText();\n", " },\n", " 430: /* models/widgets/radio_button_group.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const button_group_1 = require(403) /* ./button_group */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const mixins_1 = require(146) /* ../../styles/mixins */;\n", " class RadioButtonGroupView extends button_group_1.ButtonGroupView {\n", " change_active(i) {\n", " if (this.model.active !== i) {\n", " this.model.active = i;\n", " }\n", " }\n", " _update_active() {\n", " const { active } = this.model;\n", " this._buttons.forEach((button, i) => {\n", " dom_1.classes(button).toggle(mixins_1.bk_active, active === i);\n", " });\n", " }\n", " }\n", " exports.RadioButtonGroupView = RadioButtonGroupView;\n", " RadioButtonGroupView.__name__ = \"RadioButtonGroupView\";\n", " class RadioButtonGroup extends button_group_1.ButtonGroup {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_RadioButtonGroup() {\n", " this.prototype.default_view = RadioButtonGroupView;\n", " this.define({\n", " active: [p.Any, null],\n", " });\n", " }\n", " }\n", " exports.RadioButtonGroup = RadioButtonGroup;\n", " RadioButtonGroup.__name__ = \"RadioButtonGroup\";\n", " RadioButtonGroup.init_RadioButtonGroup();\n", " },\n", " 431: /* models/widgets/radio_group.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const string_1 = require(24) /* ../../core/util/string */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const input_group_1 = require(405) /* ./input_group */;\n", " const mixins_1 = require(146) /* ../../styles/mixins */;\n", " const inputs_1 = require(400) /* ../../styles/widgets/inputs */;\n", " class RadioGroupView extends input_group_1.InputGroupView {\n", " render() {\n", " super.render();\n", " const group = dom_1.div({ class: [inputs_1.bk_input_group, this.model.inline ? mixins_1.bk_inline : null] });\n", " this.el.appendChild(group);\n", " const name = string_1.uniqueId();\n", " const { active, labels } = this.model;\n", " this._inputs = [];\n", " for (let i = 0; i < labels.length; i++) {\n", " const radio = dom_1.input({ type: `radio`, name, value: `${i}` });\n", " radio.addEventListener(\"change\", () => this.change_active(i));\n", " this._inputs.push(radio);\n", " if (this.model.disabled)\n", " radio.disabled = true;\n", " if (i == active)\n", " radio.checked = true;\n", " const label_el = dom_1.label({}, radio, dom_1.span({}, labels[i]));\n", " group.appendChild(label_el);\n", " }\n", " }\n", " change_active(i) {\n", " this.model.active = i;\n", " }\n", " }\n", " exports.RadioGroupView = RadioGroupView;\n", " RadioGroupView.__name__ = \"RadioGroupView\";\n", " class RadioGroup extends input_group_1.InputGroup {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_RadioGroup() {\n", " this.prototype.default_view = RadioGroupView;\n", " this.define({\n", " active: [p.Number],\n", " labels: [p.Array, []],\n", " inline: [p.Boolean, false],\n", " });\n", " }\n", " }\n", " exports.RadioGroup = RadioGroup;\n", " RadioGroup.__name__ = \"RadioGroup\";\n", " RadioGroup.init_RadioGroup();\n", " },\n", " 432: /* models/widgets/range_slider.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const numbro = tslib_1.__importStar(require(161) /* @bokeh/numbro */);\n", " const abstract_slider_1 = require(411) /* ./abstract_slider */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " class RangeSliderView extends abstract_slider_1.AbstractRangeSliderView {\n", " }\n", " exports.RangeSliderView = RangeSliderView;\n", " RangeSliderView.__name__ = \"RangeSliderView\";\n", " class RangeSlider extends abstract_slider_1.AbstractSlider {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.behaviour = \"drag\";\n", " this.connected = [false, true, false];\n", " }\n", " static init_RangeSlider() {\n", " this.prototype.default_view = RangeSliderView;\n", " this.override({\n", " format: \"0[.]00\",\n", " });\n", " }\n", " _formatter(value, format) {\n", " if (types_1.isString(format)) {\n", " return numbro.format(value, format);\n", " }\n", " else {\n", " return format.doFormat([value], { loc: 0 })[0];\n", " }\n", " }\n", " }\n", " exports.RangeSlider = RangeSlider;\n", " RangeSlider.__name__ = \"RangeSlider\";\n", " RangeSlider.init_RangeSlider();\n", " },\n", " 433: /* models/widgets/selectbox.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " const object_1 = require(17) /* ../../core/util/object */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const input_widget_1 = require(398) /* ./input_widget */;\n", " const inputs_1 = require(400) /* ../../styles/widgets/inputs */;\n", " class SelectView extends input_widget_1.InputWidgetView {\n", " connect_signals() {\n", " super.connect_signals();\n", " const { value, options } = this.model.properties;\n", " this.on_change(value, () => {\n", " this._update_value();\n", " });\n", " this.on_change(options, () => {\n", " dom_1.empty(this.input_el);\n", " dom_1.append(this.input_el, ...this.options_el());\n", " });\n", " }\n", " options_el() {\n", " function build_options(values) {\n", " return values.map((el) => {\n", " let value, label;\n", " if (types_1.isString(el))\n", " value = label = el;\n", " else\n", " [value, label] = el;\n", " return dom_1.option({ value }, label);\n", " });\n", " }\n", " const { options } = this.model;\n", " if (types_1.isArray(options))\n", " return build_options(options);\n", " else\n", " return object_1.entries(options).map(([label, values]) => dom_1.optgroup({ label }, build_options(values)));\n", " }\n", " render() {\n", " super.render();\n", " this.input_el = dom_1.select({\n", " class: inputs_1.bk_input,\n", " name: this.model.name,\n", " disabled: this.model.disabled,\n", " }, this.options_el());\n", " this._update_value();\n", " this.input_el.addEventListener(\"change\", () => this.change_input());\n", " this.group_el.appendChild(this.input_el);\n", " }\n", " change_input() {\n", " const value = this.input_el.value;\n", " this.model.value = value;\n", " super.change_input();\n", " }\n", " _update_value() {\n", " const { value } = this.model;\n", " if (value != null && value.length != 0) {\n", " this.input_el.value = this.model.value;\n", " }\n", " }\n", " }\n", " exports.SelectView = SelectView;\n", " SelectView.__name__ = \"SelectView\";\n", " class Select extends input_widget_1.InputWidget {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Select() {\n", " this.prototype.default_view = SelectView;\n", " this.define({\n", " value: [p.String, ''],\n", " options: [p.Any, []],\n", " });\n", " }\n", " }\n", " exports.Select = Select;\n", " Select.__name__ = \"Select\";\n", " Select.init_Select();\n", " },\n", " 434: /* models/widgets/slider.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const numbro = tslib_1.__importStar(require(161) /* @bokeh/numbro */);\n", " const abstract_slider_1 = require(411) /* ./abstract_slider */;\n", " const types_1 = require(8) /* ../../core/util/types */;\n", " class SliderView extends abstract_slider_1.AbstractSliderView {\n", " }\n", " exports.SliderView = SliderView;\n", " SliderView.__name__ = \"SliderView\";\n", " class Slider extends abstract_slider_1.AbstractSlider {\n", " constructor(attrs) {\n", " super(attrs);\n", " this.behaviour = \"tap\";\n", " this.connected = [true, false];\n", " }\n", " static init_Slider() {\n", " this.prototype.default_view = SliderView;\n", " this.override({\n", " format: \"0[.]00\",\n", " });\n", " }\n", " _formatter(value, format) {\n", " if (types_1.isString(format)) {\n", " return numbro.format(value, format);\n", " }\n", " else {\n", " return format.doFormat([value], { loc: 0 })[0];\n", " }\n", " }\n", " }\n", " exports.Slider = Slider;\n", " Slider.__name__ = \"Slider\";\n", " Slider.init_Slider();\n", " },\n", " 435: /* models/widgets/spinner.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const input_widget_1 = require(398) /* ./input_widget */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const inputs_1 = require(400) /* ../../styles/widgets/inputs */;\n", " const { floor, max, min } = Math;\n", " function _get_sig_dig(num) {\n", " if (floor(num) !== num)\n", " return num.toFixed(16).replace(/0+$/, '').split(\".\")[1].length;\n", " return 0;\n", " }\n", " class SpinnerView extends input_widget_1.InputWidgetView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.low.change, () => {\n", " const { low } = this.model;\n", " if (low != null)\n", " this.input_el.min = low.toFixed(16);\n", " });\n", " this.connect(this.model.properties.high.change, () => {\n", " const { high } = this.model;\n", " if (high != null)\n", " this.input_el.max = high.toFixed(16);\n", " });\n", " this.connect(this.model.properties.step.change, () => {\n", " const { step } = this.model;\n", " this.input_el.step = step.toFixed(16);\n", " });\n", " this.connect(this.model.properties.value.change, () => {\n", " const { value, step } = this.model;\n", " this.input_el.value = value.toFixed(_get_sig_dig(step)).replace(/(\\.[0-9]*[1-9])0+$|\\.0*$/, '$1'); //trim last 0\n", " });\n", " this.connect(this.model.properties.disabled.change, () => {\n", " this.input_el.disabled = this.model.disabled;\n", " });\n", " }\n", " render() {\n", " super.render();\n", " this.input_el = dom_1.input({\n", " type: \"number\",\n", " class: inputs_1.bk_input,\n", " name: this.model.name,\n", " min: this.model.low,\n", " max: this.model.high,\n", " value: this.model.value,\n", " step: this.model.step,\n", " disabled: this.model.disabled,\n", " });\n", " this.input_el.addEventListener(\"change\", () => this.change_input());\n", " //this.input_el.addEventListener(\"input\", () => this.change_input())\n", " this.group_el.appendChild(this.input_el);\n", " }\n", " change_input() {\n", " if (this.input_el.value) { //if input is empty skip update\n", " const { step } = this.model;\n", " let new_value = Number(this.input_el.value);\n", " if (this.model.low != null)\n", " new_value = max(new_value, this.model.low);\n", " if (this.model.high != null)\n", " new_value = min(new_value, this.model.high);\n", " this.model.value = Number(new_value.toFixed(_get_sig_dig(step)));\n", " super.change_input();\n", " }\n", " }\n", " }\n", " exports.SpinnerView = SpinnerView;\n", " SpinnerView.__name__ = \"SpinnerView\";\n", " class Spinner extends input_widget_1.InputWidget {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Spinner() {\n", " this.prototype.default_view = SpinnerView;\n", " this.define({\n", " value: [p.Number, 0],\n", " low: [p.Number, null],\n", " high: [p.Number, null],\n", " step: [p.Number, 1],\n", " });\n", " }\n", " }\n", " exports.Spinner = Spinner;\n", " Spinner.__name__ = \"Spinner\";\n", " Spinner.init_Spinner();\n", " },\n", " 436: /* models/widgets/textarea_input.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const input_widget_1 = require(398) /* ./input_widget */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const inputs_1 = require(400) /* ../../styles/widgets/inputs */;\n", " class TextAreaInputView extends input_widget_1.InputWidgetView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.name.change, () => this.input_el.name = this.model.name || \"\");\n", " this.connect(this.model.properties.value.change, () => this.input_el.value = this.model.value);\n", " this.connect(this.model.properties.disabled.change, () => this.input_el.disabled = this.model.disabled);\n", " this.connect(this.model.properties.placeholder.change, () => this.input_el.placeholder = this.model.placeholder);\n", " this.connect(this.model.properties.rows.change, () => this.input_el.rows = this.model.rows);\n", " this.connect(this.model.properties.cols.change, () => this.input_el.cols = this.model.cols);\n", " this.connect(this.model.properties.max_length.change, () => this.input_el.maxLength = this.model.max_length);\n", " }\n", " render() {\n", " super.render();\n", " this.input_el = dom_1.textarea({\n", " class: inputs_1.bk_input,\n", " name: this.model.name,\n", " disabled: this.model.disabled,\n", " placeholder: this.model.placeholder,\n", " cols: this.model.cols,\n", " rows: this.model.rows,\n", " maxLength: this.model.max_length,\n", " });\n", " this.input_el.textContent = this.model.value;\n", " this.input_el.addEventListener(\"change\", () => this.change_input());\n", " this.group_el.appendChild(this.input_el);\n", " }\n", " change_input() {\n", " this.model.value = this.input_el.value;\n", " super.change_input();\n", " }\n", " }\n", " exports.TextAreaInputView = TextAreaInputView;\n", " TextAreaInputView.__name__ = \"TextAreaInputView\";\n", " class TextAreaInput extends input_widget_1.InputWidget {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_TextAreaInput() {\n", " this.prototype.default_view = TextAreaInputView;\n", " this.define({\n", " value: [p.String, \"\"],\n", " value_input: [p.String, \"\"],\n", " placeholder: [p.String, \"\"],\n", " cols: [p.Number, 20],\n", " rows: [p.Number, 2],\n", " max_length: [p.Number, 500],\n", " });\n", " }\n", " }\n", " exports.TextAreaInput = TextAreaInput;\n", " TextAreaInput.__name__ = \"TextAreaInput\";\n", " TextAreaInput.init_TextAreaInput();\n", " },\n", " 437: /* models/widgets/toggle.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const abstract_button_1 = require(392) /* ./abstract_button */;\n", " const dom_1 = require(68) /* ../../core/dom */;\n", " const p = tslib_1.__importStar(require(18) /* ../../core/properties */);\n", " const mixins_1 = require(146) /* ../../styles/mixins */;\n", " class ToggleView extends abstract_button_1.AbstractButtonView {\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.properties.active.change, () => this._update_active());\n", " }\n", " render() {\n", " super.render();\n", " this._update_active();\n", " }\n", " click() {\n", " this.model.active = !this.model.active;\n", " super.click();\n", " }\n", " _update_active() {\n", " dom_1.classes(this.button_el).toggle(mixins_1.bk_active, this.model.active);\n", " }\n", " }\n", " exports.ToggleView = ToggleView;\n", " ToggleView.__name__ = \"ToggleView\";\n", " class Toggle extends abstract_button_1.AbstractButton {\n", " constructor(attrs) {\n", " super(attrs);\n", " }\n", " static init_Toggle() {\n", " this.prototype.default_view = ToggleView;\n", " this.define({\n", " active: [p.Boolean, false],\n", " });\n", " this.override({\n", " label: \"Toggle\",\n", " });\n", " }\n", " }\n", " exports.Toggle = Toggle;\n", " Toggle.__name__ = \"Toggle\";\n", " Toggle.init_Toggle();\n", " },\n", " }, 390, {\"models/widgets/main\":390,\"models/widgets/index\":391,\"models/widgets/abstract_button\":392,\"models/widgets/control\":393,\"models/widgets/widget\":458,\"models/widgets/abstract_icon\":395,\"models/widgets/autocomplete_input\":396,\"models/widgets/text_input\":397,\"models/widgets/input_widget\":398,\"styles/widgets/inputs.css\":399,\"styles/widgets/inputs\":400,\"models/widgets/button\":401,\"models/widgets/checkbox_button_group\":402,\"models/widgets/button_group\":403,\"models/widgets/checkbox_group\":404,\"models/widgets/input_group\":405,\"models/widgets/color_picker\":406,\"models/widgets/date_picker\":407,\"styles/widgets/flatpickr.css\":409,\"models/widgets/date_range_slider\":410,\"models/widgets/abstract_slider\":411,\"styles/widgets/sliders\":413,\"styles/widgets/nouislider.css\":414,\"styles/widgets/sliders.css\":415,\"models/widgets/date_slider\":416,\"models/widgets/div\":417,\"models/widgets/markup\":418,\"styles/clearfix\":419,\"styles/clearfix.css\":420,\"models/widgets/dropdown\":421,\"models/widgets/file_input\":422,\"models/widgets/multiselect\":423,\"models/widgets/paragraph\":424,\"models/widgets/password_input\":425,\"models/widgets/multichoice\":426,\"styles/widgets/choices.css\":428,\"models/widgets/pretext\":429,\"models/widgets/radio_button_group\":430,\"models/widgets/radio_group\":431,\"models/widgets/range_slider\":432,\"models/widgets/selectbox\":433,\"models/widgets/slider\":434,\"models/widgets/spinner\":435,\"models/widgets/textarea_input\":436,\"models/widgets/toggle\":437}, {});\n", " })\n", "\n", " //# sourceMappingURL=bokeh-widgets.js.map\n", "\n", " /* END bokeh-widgets.js */\n", " },\n", " \n", " function(Bokeh) {\n", " /* BEGIN bokeh-tables.js */\n", " /*!\n", " * Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors\n", " * All rights reserved.\n", " * \n", " * Redistribution and use in source and binary forms, with or without modification,\n", " * are permitted provided that the following conditions are met:\n", " * \n", " * Redistributions of source code must retain the above copyright notice,\n", " * this list of conditions and the following disclaimer.\n", " * \n", " * Redistributions in binary form must reproduce the above copyright notice,\n", " * this list of conditions and the following disclaimer in the documentation\n", " * and/or other materials provided with the distribution.\n", " * \n", " * Neither the name of Anaconda nor the names of any contributors\n", " * may be used to endorse or promote products derived from this software\n", " * without specific prior written permission.\n", " * \n", " * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n", " * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n", " * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n", " * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n", " * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n", " * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n", " * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n", " * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n", " * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n", " * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n", " * THE POSSIBILITY OF SUCH DAMAGE.\n", " */\n", " (function(root, factory) {\n", " factory(root[\"Bokeh\"], \"2.1.1\");\n", " })(this, function(Bokeh, version) {\n", " var define;\n", " return (function(modules, entry, aliases, externals) {\n", " const bokeh = typeof Bokeh !== \"undefined\" && (version != null ? Bokeh[version] : Bokeh);\n", " if (bokeh != null) {\n", " return bokeh.register_plugin(modules, entry, aliases);\n", " } else {\n", " throw new Error(\"Cannot find Bokeh \" + version + \". You have to load it prior to loading plugins.\");\n", " }\n", " })\n", " ({\n", " 438: /* models/widgets/tables/main.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const Tables = tslib_1.__importStar(require(439) /* ./index */);\n", " exports.Tables = Tables;\n", " const base_1 = require(7) /* ../../../base */;\n", " base_1.register_models(Tables);\n", " },\n", " 439: /* models/widgets/tables/index.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " tslib_1.__exportStar(require(440) /* ./cell_editors */, exports);\n", " tslib_1.__exportStar(require(462) /* ./cell_formatters */, exports);\n", " var data_table_1 = require(441) /* ./data_table */;\n", " exports.DataTable = data_table_1.DataTable;\n", " var table_column_1 = require(465) /* ./table_column */;\n", " exports.TableColumn = table_column_1.TableColumn;\n", " var table_widget_1 = require(457) /* ./table_widget */;\n", " exports.TableWidget = table_widget_1.TableWidget;\n", " var row_aggregators_1 = require(466) /* ./row_aggregators */;\n", " exports.AvgAggregator = row_aggregators_1.AvgAggregator;\n", " exports.MinAggregator = row_aggregators_1.MinAggregator;\n", " exports.MaxAggregator = row_aggregators_1.MaxAggregator;\n", " exports.SumAggregator = row_aggregators_1.SumAggregator;\n", " var data_cube_1 = require(467) /* ./data_cube */;\n", " exports.GroupingInfo = data_cube_1.GroupingInfo;\n", " exports.DataCube = data_cube_1.DataCube;\n", " },\n", " 440: /* models/widgets/tables/cell_editors.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const dom_1 = require(68) /* ../../../core/dom */;\n", " const dom_view_1 = require(66) /* ../../../core/dom_view */;\n", " const model_1 = require(71) /* ../../../model */;\n", " const data_table_1 = require(441) /* ./data_table */;\n", " const tables_1 = require(459) /* ../../../styles/widgets/tables */;\n", " class CellEditorView extends dom_view_1.DOMView {\n", " constructor(options) {\n", " const { model, parent } = options.column;\n", " super(Object.assign({ model, parent }, options));\n", " this.args = options;\n", " this.initialize(); // XXX: no build_views()\n", " this.render(); // XXX: this isn't governed by layout\n", " }\n", " get emptyValue() {\n", " return null;\n", " }\n", " initialize() {\n", " super.initialize();\n", " this.inputEl = this._createInput();\n", " this.defaultValue = null;\n", " }\n", " async lazy_initialize() {\n", " throw new Error(\"unsupported\");\n", " }\n", " css_classes() {\n", " return super.css_classes().concat(tables_1.bk_cell_editor);\n", " }\n", " render() {\n", " super.render();\n", " this.args.container.append(this.el);\n", " this.el.appendChild(this.inputEl);\n", " this.renderEditor();\n", " this.disableNavigation();\n", " }\n", " renderEditor() { }\n", " disableNavigation() {\n", " this.inputEl.addEventListener(\"keydown\", (event) => {\n", " switch (event.keyCode) {\n", " case dom_1.Keys.Left:\n", " case dom_1.Keys.Right:\n", " case dom_1.Keys.Up:\n", " case dom_1.Keys.Down:\n", " case dom_1.Keys.PageUp:\n", " case dom_1.Keys.PageDown:\n", " event.stopImmediatePropagation();\n", " }\n", " });\n", " }\n", " destroy() {\n", " this.remove();\n", " }\n", " focus() {\n", " this.inputEl.focus();\n", " }\n", " show() { }\n", " hide() { }\n", " position() { }\n", " getValue() {\n", " return this.inputEl.value;\n", " }\n", " setValue(val) {\n", " this.inputEl.value = val;\n", " }\n", " serializeValue() {\n", " return this.getValue();\n", " }\n", " isValueChanged() {\n", " return !(this.getValue() == \"\" && this.defaultValue == null) && this.getValue() !== this.defaultValue;\n", " }\n", " applyValue(item, state) {\n", " const grid_data = this.args.grid.getData();\n", " const offset = grid_data.index.indexOf(item[data_table_1.DTINDEX_NAME]);\n", " grid_data.setField(offset, this.args.column.field, state);\n", " }\n", " loadValue(item) {\n", " const value = item[this.args.column.field];\n", " this.defaultValue = value != null ? value : this.emptyValue;\n", " this.setValue(this.defaultValue);\n", " }\n", " validateValue(value) {\n", " if (this.args.column.validator) {\n", " const result = this.args.column.validator(value);\n", " if (!result.valid) {\n", " return result;\n", " }\n", " }\n", " return { valid: true, msg: null };\n", " }\n", " validate() {\n", " return this.validateValue(this.getValue());\n", " }\n", " }\n", " exports.CellEditorView = CellEditorView;\n", " CellEditorView.__name__ = \"CellEditorView\";\n", " class CellEditor extends model_1.Model {\n", " }\n", " exports.CellEditor = CellEditor;\n", " CellEditor.__name__ = \"CellEditor\";\n", " class StringEditorView extends CellEditorView {\n", " get emptyValue() {\n", " return \"\";\n", " }\n", " _createInput() {\n", " return dom_1.input({ type: \"text\" });\n", " }\n", " renderEditor() {\n", " //completions = @model.completions\n", " //if completions.length != 0\n", " // @inputEl.classList.add(\"bk-cell-editor-completion\")\n", " // $(@inputEl).autocomplete({source: completions})\n", " // $(@inputEl).autocomplete(\"widget\")\n", " this.inputEl.focus();\n", " this.inputEl.select();\n", " }\n", " loadValue(item) {\n", " super.loadValue(item);\n", " this.inputEl.defaultValue = this.defaultValue;\n", " this.inputEl.select();\n", " }\n", " }\n", " exports.StringEditorView = StringEditorView;\n", " StringEditorView.__name__ = \"StringEditorView\";\n", " class StringEditor extends CellEditor {\n", " static init_StringEditor() {\n", " this.prototype.default_view = StringEditorView;\n", " this.define({\n", " completions: [p.Array, []],\n", " });\n", " }\n", " }\n", " exports.StringEditor = StringEditor;\n", " StringEditor.__name__ = \"StringEditor\";\n", " StringEditor.init_StringEditor();\n", " class TextEditorView extends CellEditorView {\n", " _createInput() {\n", " return dom_1.textarea();\n", " }\n", " }\n", " exports.TextEditorView = TextEditorView;\n", " TextEditorView.__name__ = \"TextEditorView\";\n", " class TextEditor extends CellEditor {\n", " static init_TextEditor() {\n", " this.prototype.default_view = TextEditorView;\n", " }\n", " }\n", " exports.TextEditor = TextEditor;\n", " TextEditor.__name__ = \"TextEditor\";\n", " TextEditor.init_TextEditor();\n", " class SelectEditorView extends CellEditorView {\n", " _createInput() {\n", " return dom_1.select();\n", " }\n", " renderEditor() {\n", " for (const opt of this.model.options) {\n", " this.inputEl.appendChild(dom_1.option({ value: opt }, opt));\n", " }\n", " this.focus();\n", " }\n", " }\n", " exports.SelectEditorView = SelectEditorView;\n", " SelectEditorView.__name__ = \"SelectEditorView\";\n", " class SelectEditor extends CellEditor {\n", " static init_SelectEditor() {\n", " this.prototype.default_view = SelectEditorView;\n", " this.define({\n", " options: [p.Array, []],\n", " });\n", " }\n", " }\n", " exports.SelectEditor = SelectEditor;\n", " SelectEditor.__name__ = \"SelectEditor\";\n", " SelectEditor.init_SelectEditor();\n", " class PercentEditorView extends CellEditorView {\n", " _createInput() {\n", " return dom_1.input({ type: \"text\" });\n", " }\n", " }\n", " exports.PercentEditorView = PercentEditorView;\n", " PercentEditorView.__name__ = \"PercentEditorView\";\n", " class PercentEditor extends CellEditor {\n", " static init_PercentEditor() {\n", " this.prototype.default_view = PercentEditorView;\n", " }\n", " }\n", " exports.PercentEditor = PercentEditor;\n", " PercentEditor.__name__ = \"PercentEditor\";\n", " PercentEditor.init_PercentEditor();\n", " class CheckboxEditorView extends CellEditorView {\n", " _createInput() {\n", " return dom_1.input({ type: \"checkbox\", value: \"true\" });\n", " }\n", " renderEditor() {\n", " this.focus();\n", " }\n", " loadValue(item) {\n", " this.defaultValue = !!item[this.args.column.field];\n", " this.inputEl.checked = this.defaultValue;\n", " }\n", " serializeValue() {\n", " return this.inputEl.checked;\n", " }\n", " }\n", " exports.CheckboxEditorView = CheckboxEditorView;\n", " CheckboxEditorView.__name__ = \"CheckboxEditorView\";\n", " class CheckboxEditor extends CellEditor {\n", " static init_CheckboxEditor() {\n", " this.prototype.default_view = CheckboxEditorView;\n", " }\n", " }\n", " exports.CheckboxEditor = CheckboxEditor;\n", " CheckboxEditor.__name__ = \"CheckboxEditor\";\n", " CheckboxEditor.init_CheckboxEditor();\n", " class IntEditorView extends CellEditorView {\n", " _createInput() {\n", " return dom_1.input({ type: \"text\" });\n", " }\n", " renderEditor() {\n", " //$(@inputEl).spinner({step: @model.step})\n", " this.inputEl.focus();\n", " this.inputEl.select();\n", " }\n", " remove() {\n", " //$(@inputEl).spinner(\"destroy\")\n", " super.remove();\n", " }\n", " serializeValue() {\n", " return parseInt(this.getValue(), 10) || 0;\n", " }\n", " loadValue(item) {\n", " super.loadValue(item);\n", " this.inputEl.defaultValue = this.defaultValue;\n", " this.inputEl.select();\n", " }\n", " validateValue(value) {\n", " if (isNaN(value))\n", " return { valid: false, msg: \"Please enter a valid integer\" };\n", " else\n", " return super.validateValue(value);\n", " }\n", " }\n", " exports.IntEditorView = IntEditorView;\n", " IntEditorView.__name__ = \"IntEditorView\";\n", " class IntEditor extends CellEditor {\n", " static init_IntEditor() {\n", " this.prototype.default_view = IntEditorView;\n", " this.define({\n", " step: [p.Number, 1],\n", " });\n", " }\n", " }\n", " exports.IntEditor = IntEditor;\n", " IntEditor.__name__ = \"IntEditor\";\n", " IntEditor.init_IntEditor();\n", " class NumberEditorView extends CellEditorView {\n", " _createInput() {\n", " return dom_1.input({ type: \"text\" });\n", " }\n", " renderEditor() {\n", " //$(@inputEl).spinner({step: @model.step})\n", " this.inputEl.focus();\n", " this.inputEl.select();\n", " }\n", " remove() {\n", " //$(@inputEl).spinner(\"destroy\")\n", " super.remove();\n", " }\n", " serializeValue() {\n", " return parseFloat(this.getValue()) || 0.0;\n", " }\n", " loadValue(item) {\n", " super.loadValue(item);\n", " this.inputEl.defaultValue = this.defaultValue;\n", " this.inputEl.select();\n", " }\n", " validateValue(value) {\n", " if (isNaN(value))\n", " return { valid: false, msg: \"Please enter a valid number\" };\n", " else\n", " return super.validateValue(value);\n", " }\n", " }\n", " exports.NumberEditorView = NumberEditorView;\n", " NumberEditorView.__name__ = \"NumberEditorView\";\n", " class NumberEditor extends CellEditor {\n", " static init_NumberEditor() {\n", " this.prototype.default_view = NumberEditorView;\n", " this.define({\n", " step: [p.Number, 0.01],\n", " });\n", " }\n", " }\n", " exports.NumberEditor = NumberEditor;\n", " NumberEditor.__name__ = \"NumberEditor\";\n", " NumberEditor.init_NumberEditor();\n", " class TimeEditorView extends CellEditorView {\n", " _createInput() {\n", " return dom_1.input({ type: \"text\" });\n", " }\n", " }\n", " exports.TimeEditorView = TimeEditorView;\n", " TimeEditorView.__name__ = \"TimeEditorView\";\n", " class TimeEditor extends CellEditor {\n", " static init_TimeEditor() {\n", " this.prototype.default_view = TimeEditorView;\n", " }\n", " }\n", " exports.TimeEditor = TimeEditor;\n", " TimeEditor.__name__ = \"TimeEditor\";\n", " TimeEditor.init_TimeEditor();\n", " class DateEditorView extends CellEditorView {\n", " _createInput() {\n", " return dom_1.input({ type: \"text\" });\n", " }\n", " get emptyValue() {\n", " return new Date();\n", " }\n", " renderEditor() {\n", " //this.calendarOpen = false\n", " //@$datepicker = $(@inputEl).datepicker({\n", " // showOn: \"button\"\n", " // buttonImageOnly: true\n", " // beforeShow: () => @calendarOpen = true\n", " // onClose: () => @calendarOpen = false\n", " //})\n", " //@$datepicker.siblings(\".ui-datepicker-trigger\").css(\"vertical-align\": \"middle\")\n", " //@$datepicker.width(@$datepicker.width() - (14 + 2*4 + 4)) # img width + margins + edge distance\n", " this.inputEl.focus();\n", " this.inputEl.select();\n", " }\n", " destroy() {\n", " //$.datepicker.dpDiv.stop(true, true)\n", " //@$datepicker.datepicker(\"hide\")\n", " //@$datepicker.datepicker(\"destroy\")\n", " super.destroy();\n", " }\n", " show() {\n", " //if @calendarOpen\n", " // $.datepicker.dpDiv.stop(true, true).show()\n", " super.show();\n", " }\n", " hide() {\n", " //if @calendarOpen\n", " // $.datepicker.dpDiv.stop(true, true).hide()\n", " super.hide();\n", " }\n", " position( /*_position*/) {\n", " //if @calendarOpen\n", " // $.datepicker.dpDiv.css(top: position.top + 30, left: position.left)\n", " return super.position();\n", " }\n", " getValue() {\n", " //return @$datepicker.datepicker(\"getDate\").getTime()\n", " }\n", " setValue(_val) {\n", " //@$datepicker.datepicker(\"setDate\", new Date(val))\n", " }\n", " }\n", " exports.DateEditorView = DateEditorView;\n", " DateEditorView.__name__ = \"DateEditorView\";\n", " class DateEditor extends CellEditor {\n", " static init_DateEditor() {\n", " this.prototype.default_view = DateEditorView;\n", " }\n", " }\n", " exports.DateEditor = DateEditor;\n", " DateEditor.__name__ = \"DateEditor\";\n", " DateEditor.init_DateEditor();\n", " },\n", " 441: /* models/widgets/tables/data_table.js */ function _(require, module, exports) {\n", " Object.defineProperty(exports, \"__esModule\", { value: true });\n", " const tslib_1 = require(1) /* tslib */;\n", " const slick_rowselectionmodel_1 = require(442) /* @bokeh/slickgrid/plugins/slick.rowselectionmodel */;\n", " const slick_checkboxselectcolumn_1 = require(446) /* @bokeh/slickgrid/plugins/slick.checkboxselectcolumn */;\n", " const slick_cellexternalcopymanager_1 = require(447) /* @bokeh/slickgrid/plugins/slick.cellexternalcopymanager */;\n", " const slickgrid_1 = require(448) /* @bokeh/slickgrid */;\n", " const p = tslib_1.__importStar(require(18) /* ../../../core/properties */);\n", " const string_1 = require(24) /* ../../../core/util/string */;\n", " const types_1 = require(8) /* ../../../core/util/types */;\n", " const array_1 = require(9) /* ../../../core/util/array */;\n", " const object_1 = require(17) /* ../../../core/util/object */;\n", " const logging_1 = require(72) /* ../../../core/logging */;\n", " const layout_1 = require(188) /* ../../../core/layout */;\n", " const table_widget_1 = require(457) /* ./table_widget */;\n", " const widget_1 = require(458) /* ../widget */;\n", " const tables_1 = require(459) /* ../../../styles/widgets/tables */;\n", " const slickgrid_css_1 = tslib_1.__importDefault(require(460) /* ../../../styles/widgets/slickgrid.css */);\n", " const tables_css_1 = tslib_1.__importDefault(require(461) /* ../../../styles/widgets/tables.css */);\n", " exports.DTINDEX_NAME = \"__bkdt_internal_index__\";\n", " class TableDataProvider {\n", " constructor(source, view) {\n", " this.init(source, view);\n", " }\n", " init(source, view) {\n", " if (exports.DTINDEX_NAME in source.data)\n", " throw new Error(`special name ${exports.DTINDEX_NAME} cannot be used as a data table column`);\n", " this.source = source;\n", " this.view = view;\n", " this.index = this.view.indices;\n", " }\n", " getLength() {\n", " return this.index.length;\n", " }\n", " getItem(offset) {\n", " const item = {};\n", " for (const field of object_1.keys(this.source.data)) {\n", " item[field] = this.source.data[field][this.index[offset]];\n", " }\n", " item[exports.DTINDEX_NAME] = this.index[offset];\n", " return item;\n", " }\n", " getField(offset, field) {\n", " // offset is the\n", " if (field == exports.DTINDEX_NAME) {\n", " return this.index[offset];\n", " }\n", " return this.source.data[field][this.index[offset]];\n", " }\n", " setField(offset, field, value) {\n", " // field assumed never to be internal index name (ctor would throw)\n", " const index = this.index[offset];\n", " this.source.patch({ [field]: [[index, value]] });\n", " }\n", " getItemMetadata(_index) {\n", " return null;\n", " }\n", " getRecords() {\n", " return array_1.range(0, this.getLength()).map((i) => this.getItem(i));\n", " }\n", " sort(columns) {\n", " let cols = columns.map((column) => [column.sortCol.field, column.sortAsc ? 1 : -1]);\n", " if (cols.length == 0) {\n", " cols = [[exports.DTINDEX_NAME, 1]];\n", " }\n", " const records = this.getRecords();\n", " const old_index = this.index.slice();\n", " this.index.sort(function (i1, i2) {\n", " for (const [field, sign] of cols) {\n", " const value1 = records[old_index.indexOf(i1)][field];\n", " const value2 = records[old_index.indexOf(i2)][field];\n", " const result = value1 == value2 ? 0 : value1 > value2 ? sign : -sign;\n", " if (result != 0)\n", " return result;\n", " }\n", " return 0;\n", " });\n", " }\n", " }\n", " exports.TableDataProvider = TableDataProvider;\n", " TableDataProvider.__name__ = \"TableDataProvider\";\n", " class DataTableView extends widget_1.WidgetView {\n", " constructor() {\n", " super(...arguments);\n", " this._in_selection_update = false;\n", " this._warned_not_reorderable = false;\n", " }\n", " connect_signals() {\n", " super.connect_signals();\n", " this.connect(this.model.change, () => this.render());\n", " this.connect(this.model.source.streaming, () => this.updateGrid());\n", " this.connect(this.model.source.patching, () => this.updateGrid());\n", " this.connect(this.model.source.change, () => this.updateGrid());\n", " this.connect(this.model.source.properties.data.change, () => this.updateGrid());\n", " this.connect(this.model.source.selected.change, () => this.updateSelection());\n", " this.connect(this.model.source.selected.properties.indices.change, () => this.updateSelection());\n", " }\n", " remove() {\n", " var _a;\n", " (_a = this.grid) === null || _a === void 0 ? void 0 : _a.destroy();\n", " super.remove();\n", " }\n", " styles() {\n", " return [...super.styles(), slickgrid_css_1.default, tables_css_1.default];\n", " }\n", " _update_layout() {\n", " this.layout = new layout_1.LayoutItem();\n", " this.layout.set_sizing(this.box_sizing());\n", " }\n", " update_position() {\n", " super.update_position();\n", " this.grid.resizeCanvas();\n", " }\n", " updateGrid() {\n", " // TODO (bev) This is to ensure that CDSView indices are properly computed\n", " // before passing to the DataProvider. This will result in extra calls to\n", " // compute_indices. This \"over execution\" will be addressed in a more\n", " // general look at events\n", " this.model.view.compute_indices();\n", " this.data.init(this.model.source, this.model.view);\n", " // This is obnoxious but there is no better way to programmatically force\n", " // a re-sort on the existing sorted columns until/if we start using DataView\n", " if (this.model.sortable) {\n", " const columns = this.grid.getColumns();\n", " const sorters = this.grid.getSortColumns().map((x) => ({\n", " sortCol: {\n", " field: columns[this.grid.getColumnIndex(x.columnId)].field,\n", " },\n", " sortAsc: x.sortAsc,\n", " }));\n", " this.data.sort(sorters);\n", " }\n", " this.grid.invalidate();\n", " this.grid.render();\n", " }\n", " updateSelection() {\n", " if (this._in_selection_update)\n", " return;\n", " const { selected } = this.model.source;\n", " const permuted_indices = selected.indices.map((x) => this.data.index.indexOf(x)).sort();\n", " this._in_selection_update = true;\n", " this.grid.setSelectedRows(permuted_indices);\n", " this._in_selection_update = false;\n", " // If the selection is not in the current slickgrid viewport, scroll the\n", " // datatable to start at the row before the first selected row, so that\n", " // the selection is immediately brought into view. We don't scroll when\n", " // the selection is already in the viewport so that selecting from the\n", " // datatable itself does not re-scroll.\n", " const cur_grid_range = this.grid.getViewport();\n", " const scroll_index = this.model.get_scroll_index(cur_grid_range, permuted_indices);\n", " if (scroll_index != null)\n", " this.grid.scrollRowToTop(scroll_index);\n", " }\n", " newIndexColumn() {\n", " return {\n", " id: string_1.uniqueId(),\n", " name: this.model.index_header,\n", " field: exports.DTINDEX_NAME,\n", " width: this.model.index_width,\n", " behavior: \"select\",\n", " cannotTriggerInsert: true,\n", " resizable: false,\n", " selectable: false,\n", " sortable: true,\n", " cssClass: tables_1.bk_cell_index,\n", " headerCssClass: tables_1.bk_header_index,\n", " };\n", " }\n", " css_classes() {\n", " return super.css_classes().concat(tables_1.bk_data_table);\n", " }\n", " render() {\n", " let checkboxSelector;\n", " let columns = this.model.columns.map((column) => {\n", " return Object.assign(Object.assign({}, column.toColumn()), { parent: this });\n", " });\n", " if (this.model.selectable == \"checkbox\") {\n", " checkboxSelector = new slick_checkboxselectcolumn_1.CheckboxSelectColumn({ cssClass: tables_1.bk_cell_select });\n", " columns.unshift(checkboxSelector.getColumnDefinition());\n", " }\n", " if (this.model.index_position != null) {\n", " const index_position = this.model.index_position;\n", " const index = this.newIndexColumn();\n", " // This is to be able to provide negative index behaviour that\n", " // matches what python users will expect\n", " if (index_position == -1)\n", " columns.push(index);\n", " else if (index_position < -1)\n", " columns.splice(index_position + 1, 0, index);\n", " else\n", " columns.splice(index_position, 0, index);\n", " }\n", " let { reorderable } = this.model;\n", " if (reorderable && !(typeof $ !== \"undefined\" && $.fn != null && $.fn.sortable != null)) {\n", " if (!this._warned_not_reorderable) {\n", " logging_1.logger.warn(\"jquery-ui is required to enable DataTable.reorderable\");\n", " this._warned_not_reorderable = true;\n", " }\n", " reorderable = false;\n", " }\n", " const options = {\n", " enableCellNavigation: this.model.selectable !== false,\n", " enableColumnReorder: reorderable,\n", " forceFitColumns: this.model.fit_columns,\n", " multiColumnSort: this.model.sortable,\n", " editable: this.model.editable,\n", " autoEdit: false,\n", " rowHeight: this.model.row_height,\n", " };\n", " this.data = new TableDataProvider(this.model.source, this.model.view);\n", " this.grid = new slickgrid_1.Grid(this.el, this.data, columns, options);\n", " this.grid.onSort.subscribe((_event, args) => {\n", " if (!this.model.sortable)\n", " return;\n", " columns = args.sortCols;\n", " this.data.sort(columns);\n", " this.grid.invalidate();\n", " this.updateSelection();\n", " this.grid.render();\n", " if (!this.model.header_row) {\n", " this._hide_header();\n", " }\n", " this.model.update_sort_columns(columns);\n", " });\n", " if (this.model.selectable !== false) {\n", " this.grid.setSelectionModel(new slick_rowselectionmodel_1.RowSelectionModel({ selectActiveRow: checkboxSelector == null }));\n", " if (checkboxSelector != null)\n", " this.grid.registerPlugin(checkboxSelector);\n", " const pluginOptions = {\n", " dataItemColumnValueExtractor(val, col) {\n", " // As defined in this file, Item can contain any type values\n", " let value = val[col.field];\n", " if (types_1.isString(value)) {\n", " value = value.replace(/\\n/g, \"\\\\n\");\n", " }\n", " return value;\n", " },\n", " includeHeaderWhenCopying: false,\n", " };\n", " this.grid.registerPlugin(new slick_cellexternalcopymanager_1.CellExternalCopyManager(pluginOptions));\n", " this.grid.onSelectedRowsChanged.subscribe((_event, args) => {\n", " if (this._in_selection_update) {\n", " return;\n", " }\n", " this.model.source.selected.indices = args.rows.map((i) => this.data.index[i]);\n", " });\n", " this.updateSelection();\n", " if (!this.model.header_row) {\n", " this._hide_header();\n", " }\n", " }\n", " }\n", " _hide_header() {\n", " for (const el of Array.from(this.el.querySelectorAll('.slick-header-columns'))) {\n", " el.style.height = \"0px\";\n", " }\n", " this.grid.resizeCanvas();\n", " }\n", " }\n", " exports.DataTableView = DataTableView;\n", " DataTableView.__name__ = \"DataTableView\";\n", " class DataTable extends table_widget_1.TableWidget {\n", " constructor(attrs) {\n", " super(attrs);\n", " this._sort_columns = [];\n", " }\n", " get sort_columns() { return this._sort_columns; }\n", " static init_DataTable() {\n", " this.prototype.default_view = DataTableView;\n", " this.define({\n", " columns: [p.Array, []],\n", " fit_columns: [p.Boolean, true],\n", " sortable: [p.Boolean, true],\n", " reorderable: [p.Boolean, true],\n", " editable: [p.Boolean, false],\n", " selectable: [p.Any, true],\n", " index_position: [p.Int, 0],\n", " index_header: [p.String, \"#\"],\n", " index_width: [p.Int, 40],\n", " scroll_to_selection: [p.Boolean, true],\n", " header_row: [p.Boolean, true],\n", " row_height: [p.Int, 25],\n", " });\n", " this.override({\n", " width: 600,\n", " height: 400,\n", " });\n", " }\n", " update_sort_columns(sortCols) {\n", " this._sort_columns = sortCols.map((x) => ({ field: x.sortCol.field, sortAsc: x.sortAsc }));\n", " return null;\n", " }\n", " get_scroll_index(grid_range, selected_indices) {\n", " if (!this.scroll_to_selection || (selected_indices.length == 0))\n", " return null;\n", " if (!array_1.some(selected_indices, i => grid_range.top <= i && i <= grid_range.bottom)) {\n", " return Math.max(0, Math.min(...selected_indices) - 1);\n", " }\n", " return null;\n", " }\n", " }\n", " exports.DataTable = DataTable;\n", " DataTable.__name__ = \"DataTable\";\n", " DataTable.init_DataTable();\n", " },\n", " 442: /* @bokeh/slickgrid/plugins/slick.rowselectionmodel.js */ function _(require, module, exports) {\n", " var $ = require(443) /* ../slick.jquery */;\n", " var Slick = require(445) /* ../slick.core */;\n", " function RowSelectionModel(options) {\n", " var _grid;\n", " var _ranges = [];\n", " var _self = this;\n", " var _handler = new Slick.EventHandler();\n", " var _inHandler;\n", " var _options;\n", " var _defaults = {\n", " selectActiveRow: true\n", " };\n", " function init(grid) {\n", " _options = $.extend(true, {}, _defaults, options);\n", " _grid = grid;\n", " _handler.subscribe(_grid.onActiveCellChanged, wrapHandler(handleActiveCellChange));\n", " _handler.subscribe(_grid.onKeyDown, wrapHandler(handleKeyDown));\n", " _handler.subscribe(_grid.onClick, wrapHandler(handleClick));\n", " }\n", " function destroy() {\n", " _handler.unsubscribeAll();\n", " }\n", " function wrapHandler(handler) {\n", " return function () {\n", " if (!_inHandler) {\n", " _inHandler = true;\n", " handler.apply(this, arguments);\n", " _inHandler = false;\n", " }\n", " };\n", " }\n", " function rangesToRows(ranges) {\n", " var rows = [];\n", " for (var i = 0; i < ranges.length; i++) {\n", " for (var j = ranges[i].fromRow; j <= ranges[i].toRow; j++) {\n", " rows.push(j);\n", " }\n", " }\n", " return rows;\n", " }\n", " function rowsToRanges(rows) {\n", " var ranges = [];\n", " var lastCell = _grid.getColumns().length - 1;\n", " for (var i = 0; i < rows.length; i++) {\n", " ranges.push(new Slick.Range(rows[i], 0, rows[i], lastCell));\n", " }\n", " return ranges;\n", " }\n", " function getRowsRange(from, to) {\n", " var i, rows = [];\n", " for (i = from; i <= to; i++) {\n", " rows.push(i);\n", " }\n", " for (i = to; i < from; i++) {\n", " rows.push(i);\n", " }\n", " return rows;\n", " }\n", " function getSelectedRows() {\n", " return rangesToRows(_ranges);\n", " }\n", " function setSelectedRows(rows) {\n", " setSelectedRanges(rowsToRanges(rows));\n", " }\n", " function setSelectedRanges(ranges) {\n", " // simple check for: empty selection didn't change, prevent firing onSelectedRangesChanged\n", " if ((!_ranges || _ranges.length === 0) && (!ranges || ranges.length === 0)) {\n", " return;\n", " }\n", " _ranges = ranges;\n", " _self.onSelectedRangesChanged.notify(_ranges);\n", " }\n", " function getSelectedRanges() {\n", " return _ranges;\n", " }\n", " function handleActiveCellChange(e, data) {\n", " if (_options.selectActiveRow && data.row != null) {\n", " setSelectedRanges([new Slick.Range(data.row, 0, data.row, _grid.getColumns().length - 1)]);\n", " }\n", " }\n", " function handleKeyDown(e) {\n", " var activeRow = _grid.getActiveCell();\n", " if (_grid.getOptions().multiSelect && activeRow\n", " && e.shiftKey && !e.ctrlKey && !e.altKey && !e.metaKey\n", " && (e.which == Slick.keyCode.UP || e.which == Slick.keyCode.DOWN)) {\n", " var selectedRows = getSelectedRows();\n", " selectedRows.sort(function (x, y) {\n", " return x - y;\n", " });\n", " if (!selectedRows.length) {\n", " selectedRows = [activeRow.row];\n", " }\n", " var top = selectedRows[0];\n", " var bottom = selectedRows[selectedRows.length - 1];\n", " var active;\n", " if (e.which == Slick.keyCode.DOWN) {\n", " active = activeRow.row < bottom || top == bottom ? ++bottom : ++top;\n", " }\n", " else {\n", " active = activeRow.row < bottom ? --bottom : --top;\n", " }\n", " if (active >= 0 && active < _grid.getDataLength()) {\n", " _grid.scrollRowIntoView(active);\n", " var tempRanges = rowsToRanges(getRowsRange(top, bottom));\n", " setSelectedRanges(tempRanges);\n", " }\n", " e.preventDefault();\n", " e.stopPropagation();\n", " }\n", " }\n", " function handleClick(e) {\n", " var cell = _grid.getCellFromEvent(e);\n", " if (!cell || !_grid.canCellBeActive(cell.row, cell.cell)) {\n", " return false;\n", " }\n", " if (!_grid.getOptions().multiSelect || (!e.ctrlKey && !e.shiftKey && !e.metaKey)) {\n", " return false;\n", " }\n", " var selection = rangesToRows(_ranges);\n", " var idx = $.inArray(cell.row, selection);\n", " if (idx === -1 && (e.ctrlKey || e.metaKey)) {\n", " selection.push(cell.row);\n", " _grid.setActiveCell(cell.row, cell.cell);\n", " }\n", " else if (idx !== -1 && (e.ctrlKey || e.metaKey)) {\n", " selection = $.grep(selection, function (o, i) {\n", " return (o !== cell.row);\n", " });\n", " _grid.setActiveCell(cell.row, cell.cell);\n", " }\n", " else if (selection.length && e.shiftKey) {\n", " var last = selection.pop();\n", " var from = Math.min(cell.row, last);\n", " var to = Math.max(cell.row, last);\n", " selection = [];\n", " for (var i = from; i <= to; i++) {\n", " if (i !== last) {\n", " selection.push(i);\n", " }\n", " }\n", " selection.push(last);\n", " _grid.setActiveCell(cell.row, cell.cell);\n", " }\n", " var tempRanges = rowsToRanges(selection);\n", " setSelectedRanges(tempRanges);\n", " e.stopImmediatePropagation();\n", " return true;\n", " }\n", " $.extend(this, {\n", " \"getSelectedRows\": getSelectedRows,\n", " \"setSelectedRows\": setSelectedRows,\n", " \"getSelectedRanges\": getSelectedRanges,\n", " \"setSelectedRanges\": setSelectedRanges,\n", " \"init\": init,\n", " \"destroy\": destroy,\n", " \"onSelectedRangesChanged\": new Slick.Event()\n", " });\n", " }\n", " module.exports = {\n", " \"RowSelectionModel\": RowSelectionModel\n", " };\n", " },\n", " 443: /* @bokeh/slickgrid/slick.jquery.js */ function _(require, module, exports) {\n", " module.exports = (typeof $ !== \"undefined\") ? $ : require(444) /* jquery */;\n", " },\n", " 444: /* jquery/dist/jquery.js */ function _(require, module, exports) {\n", " /*!\n", " * jQuery JavaScript Library v3.5.0\n", " * https://jquery.com/\n", " *\n", " * Includes Sizzle.js\n", " * https://sizzlejs.com/\n", " *\n", " * Copyright JS Foundation and other contributors\n", " * Released under the MIT license\n", " * https://jquery.org/license\n", " *\n", " * Date: 2020-04-10T15:07Z\n", " */\n", " (function (global, factory) {\n", " \"use strict\";\n", " if (typeof module === \"object\" && typeof module.exports === \"object\") {\n", " // For CommonJS and CommonJS-like environments where a proper `window`\n", " // is present, execute the factory and get jQuery.\n", " // For environments that do not have a `window` with a `document`\n", " // (such as Node.js), expose a factory as module.exports.\n", " // This accentuates the need for the creation of a real `window`.\n", " // e.g. var jQuery = require(\"jquery\")(window);\n", " // See ticket #14549 for more info.\n", " module.exports = global.document ?\n", " factory(global, true) :\n", " function (w) {\n", " if (!w.document) {\n", " throw new Error(\"jQuery requires a window with a document\");\n", " }\n", " return factory(w);\n", " };\n", " }\n", " else {\n", " factory(global);\n", " }\n", " // Pass this if window is not defined yet\n", " })(typeof window !== \"undefined\" ? window : this, function (window, noGlobal) {\n", " // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1\n", " // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode\n", " // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common\n", " // enough that all such attempts are guarded in a try block.\n", " \"use strict\";\n", " var arr = [];\n", " var getProto = Object.getPrototypeOf;\n", " var slice = arr.slice;\n", " var flat = arr.flat ? function (array) {\n", " return arr.flat.call(array);\n", " } : function (array) {\n", " return arr.concat.apply([], array);\n", " };\n", " var push = arr.push;\n", " var indexOf = arr.indexOf;\n", " var class2type = {};\n", " var toString = class2type.toString;\n", " var hasOwn = class2type.hasOwnProperty;\n", " var fnToString = hasOwn.toString;\n", " var ObjectFunctionString = fnToString.call(Object);\n", " var support = {};\n", " var isFunction = function isFunction(obj) {\n", " // Support: Chrome <=57, Firefox <=52\n", " // In some browsers, typeof returns \"function\" for HTML elements\n", " // (i.e., `typeof document.createElement( \"object\" ) === \"function\"`).\n", " // We don't want to classify *any* DOM node as a function.\n", " return typeof obj === \"function\" && typeof obj.nodeType !== \"number\";\n", " };\n", " var isWindow = function isWindow(obj) {\n", " return obj != null && obj === obj.window;\n", " };\n", " var document = window.document;\n", " var preservedScriptAttributes = {\n", " type: true,\n", " src: true,\n", " nonce: true,\n", " noModule: true\n", " };\n", " function DOMEval(code, node, doc) {\n", " doc = doc || document;\n", " var i, val, script = doc.createElement(\"script\");\n", " script.text = code;\n", " if (node) {\n", " for (i in preservedScriptAttributes) {\n", " // Support: Firefox 64+, Edge 18+\n", " // Some browsers don't support the \"nonce\" property on scripts.\n", " // On the other hand, just using `getAttribute` is not enough as\n", " // the `nonce` attribute is reset to an empty string whenever it\n", " // becomes browsing-context connected.\n", " // See https://github.com/whatwg/html/issues/2369\n", " // See https://html.spec.whatwg.org/#nonce-attributes\n", " // The `node.getAttribute` check was added for the sake of\n", " // `jQuery.globalEval` so that it can fake a nonce-containing node\n", " // via an object.\n", " val = node[i] || node.getAttribute && node.getAttribute(i);\n", " if (val) {\n", " script.setAttribute(i, val);\n", " }\n", " }\n", " }\n", " doc.head.appendChild(script).parentNode.removeChild(script);\n", " }\n", " function toType(obj) {\n", " if (obj == null) {\n", " return obj + \"\";\n", " }\n", " // Support: Android <=2.3 only (functionish RegExp)\n", " return typeof obj === \"object\" || typeof obj === \"function\" ?\n", " class2type[toString.call(obj)] || \"object\" :\n", " typeof obj;\n", " }\n", " /* global Symbol */\n", " // Defining this global in .eslintrc.json would create a danger of using the global\n", " // unguarded in another place, it seems safer to define global only for this module\n", " var version = \"3.5.0\", \n", " // Define a local copy of jQuery\n", " jQuery = function (selector, context) {\n", " // The jQuery object is actually just the init constructor 'enhanced'\n", " // Need init if jQuery is called (just allow error to be thrown if not included)\n", " return new jQuery.fn.init(selector, context);\n", " };\n", " jQuery.fn = jQuery.prototype = {\n", " // The current version of jQuery being used\n", " jquery: version,\n", " constructor: jQuery,\n", " // The default length of a jQuery object is 0\n", " length: 0,\n", " toArray: function () {\n", " return slice.call(this);\n", " },\n", " // Get the Nth element in the matched element set OR\n", " // Get the whole matched element set as a clean array\n", " get: function (num) {\n", " // Return all the elements in a clean array\n", " if (num == null) {\n", " return slice.call(this);\n", " }\n", " // Return just the one element from the set\n", " return num < 0 ? this[num + this.length] : this[num];\n", " },\n", " // Take an array of elements and push it onto the stack\n", " // (returning the new matched element set)\n", " pushStack: function (elems) {\n", " // Build a new jQuery matched element set\n", " var ret = jQuery.merge(this.constructor(), elems);\n", " // Add the old object onto the stack (as a reference)\n", " ret.prevObject = this;\n", " // Return the newly-formed element set\n", " return ret;\n", " },\n", " // Execute a callback for every element in the matched set.\n", " each: function (callback) {\n", " return jQuery.each(this, callback);\n", " },\n", " map: function (callback) {\n", " return this.pushStack(jQuery.map(this, function (elem, i) {\n", " return callback.call(elem, i, elem);\n", " }));\n", " },\n", " slice: function () {\n", " return this.pushStack(slice.apply(this, arguments));\n", " },\n", " first: function () {\n", " return this.eq(0);\n", " },\n", " last: function () {\n", " return this.eq(-1);\n", " },\n", " even: function () {\n", " return this.pushStack(jQuery.grep(this, function (_elem, i) {\n", " return (i + 1) % 2;\n", " }));\n", " },\n", " odd: function () {\n", " return this.pushStack(jQuery.grep(this, function (_elem, i) {\n", " return i % 2;\n", " }));\n", " },\n", " eq: function (i) {\n", " var len = this.length, j = +i + (i < 0 ? len : 0);\n", " return this.pushStack(j >= 0 && j < len ? [this[j]] : []);\n", " },\n", " end: function () {\n", " return this.prevObject || this.constructor();\n", " },\n", " // For internal use only.\n", " // Behaves like an Array's method, not like a jQuery method.\n", " push: push,\n", " sort: arr.sort,\n", " splice: arr.splice\n", " };\n", " jQuery.extend = jQuery.fn.extend = function () {\n", " var options, name, src, copy, copyIsArray, clone, target = arguments[0] || {}, i = 1, length = arguments.length, deep = false;\n", " // Handle a deep copy situation\n", " if (typeof target === \"boolean\") {\n", " deep = target;\n", " // Skip the boolean and the target\n", " target = arguments[i] || {};\n", " i++;\n", " }\n", " // Handle case when target is a string or something (possible in deep copy)\n", " if (typeof target !== \"object\" && !isFunction(target)) {\n", " target = {};\n", " }\n", " // Extend jQuery itself if only one argument is passed\n", " if (i === length) {\n", " target = this;\n", " i--;\n", " }\n", " for (; i < length; i++) {\n", " // Only deal with non-null/undefined values\n", " if ((options = arguments[i]) != null) {\n", " // Extend the base object\n", " for (name in options) {\n", " copy = options[name];\n", " // Prevent Object.prototype pollution\n", " // Prevent never-ending loop\n", " if (name === \"__proto__\" || target === copy) {\n", " continue;\n", " }\n", " // Recurse if we're merging plain objects or arrays\n", " if (deep && copy && (jQuery.isPlainObject(copy) ||\n", " (copyIsArray = Array.isArray(copy)))) {\n", " src = target[name];\n", " // Ensure proper type for the source value\n", " if (copyIsArray && !Array.isArray(src)) {\n", " clone = [];\n", " }\n", " else if (!copyIsArray && !jQuery.isPlainObject(src)) {\n", " clone = {};\n", " }\n", " else {\n", " clone = src;\n", " }\n", " copyIsArray = false;\n", " // Never move original objects, clone them\n", " target[name] = jQuery.extend(deep, clone, copy);\n", " // Don't bring in undefined values\n", " }\n", " else if (copy !== undefined) {\n", " target[name] = copy;\n", " }\n", " }\n", " }\n", " }\n", " // Return the modified object\n", " return target;\n", " };\n", " jQuery.extend({\n", " // Unique for each copy of jQuery on the page\n", " expando: \"jQuery\" + (version + Math.random()).replace(/\\D/g, \"\"),\n", " // Assume jQuery is ready without the ready module\n", " isReady: true,\n", " error: function (msg) {\n", " throw new Error(msg);\n", " },\n", " noop: function () { },\n", " isPlainObject: function (obj) {\n", " var proto, Ctor;\n", " // Detect obvious negatives\n", " // Use toString instead of jQuery.type to catch host objects\n", " if (!obj || toString.call(obj) !== \"[object Object]\") {\n", " return false;\n", " }\n", " proto = getProto(obj);\n", " // Objects with no prototype (e.g., `Object.create( null )`) are plain\n", " if (!proto) {\n", " return true;\n", " }\n", " // Objects with prototype are plain iff they were constructed by a global Object function\n", " Ctor = hasOwn.call(proto, \"constructor\") && proto.constructor;\n", " return typeof Ctor === \"function\" && fnToString.call(Ctor) === ObjectFunctionString;\n", " },\n", " isEmptyObject: function (obj) {\n", " var name;\n", " for (name in obj) {\n", " return false;\n", " }\n", " return true;\n", " },\n", " // Evaluates a script in a provided context; falls back to the global one\n", " // if not specified.\n", " globalEval: function (code, options, doc) {\n", " DOMEval(code, { nonce: options && options.nonce }, doc);\n", " },\n", " each: function (obj, callback) {\n", " var length, i = 0;\n", " if (isArrayLike(obj)) {\n", " length = obj.length;\n", " for (; i < length; i++) {\n", " if (callback.call(obj[i], i, obj[i]) === false) {\n", " break;\n", " }\n", " }\n", " }\n", " else {\n", " for (i in obj) {\n", " if (callback.call(obj[i], i, obj[i]) === false) {\n", " break;\n", " }\n", " }\n", " }\n", " return obj;\n", " },\n", " // results is for internal usage only\n", " makeArray: function (arr, results) {\n", " var ret = results || [];\n", " if (arr != null) {\n", " if (isArrayLike(Object(arr))) {\n", " jQuery.merge(ret, typeof arr === \"string\" ?\n", " [arr] : arr);\n", " }\n", " else {\n", " push.call(ret, arr);\n", " }\n", " }\n", " return ret;\n", " },\n", " inArray: function (elem, arr, i) {\n", " return arr == null ? -1 : indexOf.call(arr, elem, i);\n", " },\n", " // Support: Android <=4.0 only, PhantomJS 1 only\n", " // push.apply(_, arraylike) throws on ancient WebKit\n", " merge: function (first, second) {\n", " var len = +second.length, j = 0, i = first.length;\n", " for (; j < len; j++) {\n", " first[i++] = second[j];\n", " }\n", " first.length = i;\n", " return first;\n", " },\n", " grep: function (elems, callback, invert) {\n", " var callbackInverse, matches = [], i = 0, length = elems.length, callbackExpect = !invert;\n", " // Go through the array, only saving the items\n", " // that pass the validator function\n", " for (; i < length; i++) {\n", " callbackInverse = !callback(elems[i], i);\n", " if (callbackInverse !== callbackExpect) {\n", " matches.push(elems[i]);\n", " }\n", " }\n", " return matches;\n", " },\n", " // arg is for internal usage only\n", " map: function (elems, callback, arg) {\n", " var length, value, i = 0, ret = [];\n", " // Go through the array, translating each of the items to their new values\n", " if (isArrayLike(elems)) {\n", " length = elems.length;\n", " for (; i < length; i++) {\n", " value = callback(elems[i], i, arg);\n", " if (value != null) {\n", " ret.push(value);\n", " }\n", " }\n", " // Go through every key on the object,\n", " }\n", " else {\n", " for (i in elems) {\n", " value = callback(elems[i], i, arg);\n", " if (value != null) {\n", " ret.push(value);\n", " }\n", " }\n", " }\n", " // Flatten any nested arrays\n", " return flat(ret);\n", " },\n", " // A global GUID counter for objects\n", " guid: 1,\n", " // jQuery.support is not used in Core but other projects attach their\n", " // properties to it so it needs to exist.\n", " support: support\n", " });\n", " if (typeof Symbol === \"function\") {\n", " jQuery.fn[Symbol.iterator] = arr[Symbol.iterator];\n", " }\n", " // Populate the class2type map\n", " jQuery.each(\"Boolean Number String Function Array Date RegExp Object Error Symbol\".split(\" \"), function (_i, name) {\n", " class2type[\"[object \" + name + \"]\"] = name.toLowerCase();\n", " });\n", " function isArrayLike(obj) {\n", " // Support: real iOS 8.2 only (not reproducible in simulator)\n", " // `in` check used to prevent JIT error (gh-2145)\n", " // hasOwn isn't used here due to false negatives\n", " // regarding Nodelist length in IE\n", " var length = !!obj && \"length\" in obj && obj.length, type = toType(obj);\n", " if (isFunction(obj) || isWindow(obj)) {\n", " return false;\n", " }\n", " return type === \"array\" || length === 0 ||\n", " typeof length === \"number\" && length > 0 && (length - 1) in obj;\n", " }\n", " var Sizzle = \n", " /*!\n", " * Sizzle CSS Selector Engine v2.3.5\n", " * https://sizzlejs.com/\n", " *\n", " * Copyright JS Foundation and other contributors\n", " * Released under the MIT license\n", " * https://js.foundation/\n", " *\n", " * Date: 2020-03-14\n", " */\n", " (function (window) {\n", " var i, support, Expr, getText, isXML, tokenize, compile, select, outermostContext, sortInput, hasDuplicate, \n", " // Local document vars\n", " setDocument, document, docElem, documentIsHTML, rbuggyQSA, rbuggyMatches, matches, contains, \n", " // Instance-specific data\n", " expando = \"sizzle\" + 1 * new Date(), preferredDoc = window.document, dirruns = 0, done = 0, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), nonnativeSelectorCache = createCache(), sortOrder = function (a, b) {\n", " if (a === b) {\n", " hasDuplicate = true;\n", " }\n", " return 0;\n", " }, \n", " // Instance methods\n", " hasOwn = ({}).hasOwnProperty, arr = [], pop = arr.pop, pushNative = arr.push, push = arr.push, slice = arr.slice, \n", " // Use a stripped-down indexOf as it's faster than native\n", " // https://jsperf.com/thor-indexof-vs-for/5\n", " indexOf = function (list, elem) {\n", " var i = 0, len = list.length;\n", " for (; i < len; i++) {\n", " if (list[i] === elem) {\n", " return i;\n", " }\n", " }\n", " return -1;\n", " }, booleans = \"checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|\" +\n", " \"ismap|loop|multiple|open|readonly|required|scoped\", \n", " // Regular expressions\n", " // http://www.w3.org/TR/css3-selectors/#whitespace\n", " whitespace = \"[\\\\x20\\\\t\\\\r\\\\n\\\\f]\", \n", " // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram\n", " identifier = \"(?:\\\\\\\\[\\\\da-fA-F]{1,6}\" + whitespace +\n", " \"?|\\\\\\\\[^\\\\r\\\\n\\\\f]|[\\\\w-]|[^\\0-\\\\x7f])+\", \n", " // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors\n", " attributes = \"\\\\[\" + whitespace + \"*(\" + identifier + \")(?:\" + whitespace +\n", " // Operator (capture 2)\n", " \"*([*^$|!~]?=)\" + whitespace +\n", " // \"Attribute values must be CSS identifiers [capture 5]\n", " // or strings [capture 3 or capture 4]\"\n", " \"*(?:'((?:\\\\\\\\.|[^\\\\\\\\'])*)'|\\\"((?:\\\\\\\\.|[^\\\\\\\\\\\"])*)\\\"|(\" + identifier + \"))|)\" +\n", " whitespace + \"*\\\\]\", pseudos = \":(\" + identifier + \")(?:\\\\((\" +\n", " // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:\n", " // 1. quoted (capture 3; capture 4 or capture 5)\n", " \"('((?:\\\\\\\\.|[^\\\\\\\\'])*)'|\\\"((?:\\\\\\\\.|[^\\\\\\\\\\\"])*)\\\")|\" +\n", " // 2. simple (capture 6)\n", " \"((?:\\\\\\\\.|[^\\\\\\\\()[\\\\]]|\" + attributes + \")*)|\" +\n", " // 3. anything else (capture 2)\n", " \".*\" +\n", " \")\\\\)|)\", \n", " // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter\n", " rwhitespace = new RegExp(whitespace + \"+\", \"g\"), rtrim = new RegExp(\"^\" + whitespace + \"+|((?:^|[^\\\\\\\\])(?:\\\\\\\\.)*)\" +\n", " whitespace + \"+$\", \"g\"), rcomma = new RegExp(\"^\" + whitespace + \"*,\" + whitespace + \"*\"), rcombinators = new RegExp(\"^\" + whitespace + \"*([>+~]|\" + whitespace + \")\" + whitespace +\n", " \"*\"), rdescend = new RegExp(whitespace + \"|>\"), rpseudo = new RegExp(pseudos), ridentifier = new RegExp(\"^\" + identifier + \"$\"), matchExpr = {\n", " \"ID\": new RegExp(\"^#(\" + identifier + \")\"),\n", " \"CLASS\": new RegExp(\"^\\\\.(\" + identifier + \")\"),\n", " \"TAG\": new RegExp(\"^(\" + identifier + \"|[*])\"),\n", " \"ATTR\": new RegExp(\"^\" + attributes),\n", " \"PSEUDO\": new RegExp(\"^\" + pseudos),\n", " \"CHILD\": new RegExp(\"^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\\\(\" +\n", " whitespace + \"*(even|odd|(([+-]|)(\\\\d*)n|)\" + whitespace + \"*(?:([+-]|)\" +\n", " whitespace + \"*(\\\\d+)|))\" + whitespace + \"*\\\\)|)\", \"i\"),\n", " \"bool\": new RegExp(\"^(?:\" + booleans + \")$\", \"i\"),\n", " // For use in libraries implementing .is()\n", " // We use this for POS matching in `select`\n", " \"needsContext\": new RegExp(\"^\" + whitespace +\n", " \"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\\\(\" + whitespace +\n", " \"*((?:-\\\\d)?\\\\d*)\" + whitespace + \"*\\\\)|)(?=[^-]|$)\", \"i\")\n", " }, rhtml = /HTML$/i, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\\d$/i, rnative = /^[^{]+\\{\\s*\\[native \\w/, \n", " // Easily-parseable/retrievable ID or TAG or CLASS selectors\n", " rquickExpr = /^(?:#([\\w-]+)|(\\w+)|\\.([\\w-]+))$/, rsibling = /[+~]/, \n", " // CSS escapes\n", " // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters\n", " runescape = new RegExp(\"\\\\\\\\[\\\\da-fA-F]{1,6}\" + whitespace + \"?|\\\\\\\\([^\\\\r\\\\n\\\\f])\", \"g\"), funescape = function (escape, nonHex) {\n", " var high = \"0x\" + escape.slice(1) - 0x10000;\n", " return nonHex ?\n", " // Strip the backslash prefix from a non-hex escape sequence\n", " nonHex :\n", " // Replace a hexadecimal escape sequence with the encoded Unicode code point\n", " // Support: IE <=11+\n", " // For values outside the Basic Multilingual Plane (BMP), manually construct a\n", " // surrogate pair\n", " high < 0 ?\n", " String.fromCharCode(high + 0x10000) :\n", " String.fromCharCode(high >> 10 | 0xD800, high & 0x3FF | 0xDC00);\n", " }, \n", " // CSS string/identifier serialization\n", " // https://drafts.csswg.org/cssom/#common-serializing-idioms\n", " rcssescape = /([\\0-\\x1f\\x7f]|^-?\\d)|^-$|[^\\0-\\x1f\\x7f-\\uFFFF\\w-]/g, fcssescape = function (ch, asCodePoint) {\n", " if (asCodePoint) {\n", " // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER\n", " if (ch === \"\\0\") {\n", " return \"\\uFFFD\";\n", " }\n", " // Control characters and (dependent upon position) numbers get escaped as code points\n", " return ch.slice(0, -1) + \"\\\\\" +\n", " ch.charCodeAt(ch.length - 1).toString(16) + \" \";\n", " }\n", " // Other potentially-special ASCII characters get backslash-escaped\n", " return \"\\\\\" + ch;\n", " }, \n", " // Used for iframes\n", " // See setDocument()\n", " // Removing the function wrapper causes a \"Permission Denied\"\n", " // error in IE\n", " unloadHandler = function () {\n", " setDocument();\n", " }, inDisabledFieldset = addCombinator(function (elem) {\n", " return elem.disabled === true && elem.nodeName.toLowerCase() === \"fieldset\";\n", " }, { dir: \"parentNode\", next: \"legend\" });\n", " // Optimize for push.apply( _, NodeList )\n", " try {\n", " push.apply((arr = slice.call(preferredDoc.childNodes)), preferredDoc.childNodes);\n", " // Support: Android<4.0\n", " // Detect silently failing push.apply\n", " // eslint-disable-next-line no-unused-expressions\n", " arr[preferredDoc.childNodes.length].nodeType;\n", " }\n", " catch (e) {\n", " push = { apply: arr.length ?\n", " // Leverage slice if possible\n", " function (target, els) {\n", " pushNative.apply(target, slice.call(els));\n", " } :\n", " // Support: IE<9\n", " // Otherwise append directly\n", " function (target, els) {\n", " var j = target.length, i = 0;\n", " // Can't trust NodeList.length\n", " while ((target[j++] = els[i++])) { }\n", " target.length = j - 1;\n", " }\n", " };\n", " }\n", " function Sizzle(selector, context, results, seed) {\n", " var m, i, elem, nid, match, groups, newSelector, newContext = context && context.ownerDocument, \n", " // nodeType defaults to 9, since context defaults to document\n", " nodeType = context ? context.nodeType : 9;\n", " results = results || [];\n", " // Return early from calls with invalid selector or context\n", " if (typeof selector !== \"string\" || !selector ||\n", " nodeType !== 1 && nodeType !== 9 && nodeType !== 11) {\n", " return results;\n", " }\n", " // Try to shortcut find operations (as opposed to filters) in HTML documents\n", " if (!seed) {\n", " setDocument(context);\n", " context = context || document;\n", " if (documentIsHTML) {\n", " // If the selector is sufficiently simple, try using a \"get*By*\" DOM method\n", " // (excepting DocumentFragment context, where the methods don't exist)\n", " if (nodeType !== 11 && (match = rquickExpr.exec(selector))) {\n", " // ID selector\n", " if ((m = match[1])) {\n", " // Document context\n", " if (nodeType === 9) {\n", " if ((elem = context.getElementById(m))) {\n", " // Support: IE, Opera, Webkit\n", " // TODO: identify versions\n", " // getElementById can match elements by name instead of ID\n", " if (elem.id === m) {\n", " results.push(elem);\n", " return results;\n", " }\n", " }\n", " else {\n", " return results;\n", " }\n", " // Element context\n", " }\n", " else {\n", " // Support: IE, Opera, Webkit\n", " // TODO: identify versions\n", " // getElementById can match elements by name instead of ID\n", " if (newContext && (elem = newContext.getElementById(m)) &&\n", " contains(context, elem) &&\n", " elem.id === m) {\n", " results.push(elem);\n", " return results;\n", " }\n", " }\n", " // Type selector\n", " }\n", " else if (match[2]) {\n", " push.apply(results, context.getElementsByTagName(selector));\n", " return results;\n", " // Class selector\n", " }\n", " else if ((m = match[3]) && support.getElementsByClassName &&\n", " context.getElementsByClassName) {\n", " push.apply(results, context.getElementsByClassName(m));\n", " return results;\n", " }\n", " }\n", " // Take advantage of querySelectorAll\n", " if (support.qsa &&\n", " !nonnativeSelectorCache[selector + \" \"] &&\n", " (!rbuggyQSA || !rbuggyQSA.test(selector)) &&\n", " // Support: IE 8 only\n", " // Exclude object elements\n", " (nodeType !== 1 || context.nodeName.toLowerCase() !== \"object\")) {\n", " newSelector = selector;\n", " newContext = context;\n", " // qSA considers elements outside a scoping root when evaluating child or\n", " // descendant combinators, which is not what we want.\n", " // In such cases, we work around the behavior by prefixing every selector in the\n", " // list with an ID selector referencing the scope context.\n", " // The technique has to be used as well when a leading combinator is used\n", " // as such selectors are not recognized by querySelectorAll.\n", " // Thanks to Andrew Dupont for this technique.\n", " if (nodeType === 1 &&\n", " (rdescend.test(selector) || rcombinators.test(selector))) {\n", " // Expand context for sibling selectors\n", " newContext = rsibling.test(selector) && testContext(context.parentNode) ||\n", " context;\n", " // We can use :scope instead of the ID hack if the browser\n", " // supports it & if we're not changing the context.\n", " if (newContext !== context || !support.scope) {\n", " // Capture the context ID, setting it first if necessary\n", " if ((nid = context.getAttribute(\"id\"))) {\n", " nid = nid.replace(rcssescape, fcssescape);\n", " }\n", " else {\n", " context.setAttribute(\"id\", (nid = expando));\n", " }\n", " }\n", " // Prefix every selector in the list\n", " groups = tokenize(selector);\n", " i = groups.length;\n", " while (i--) {\n", " groups[i] = (nid ? \"#\" + nid : \":scope\") + \" \" +\n", " toSelector(groups[i]);\n", " }\n", " newSelector = groups.join(\",\");\n", " }\n", " try {\n", " push.apply(results, newContext.querySelectorAll(newSelector));\n", " return results;\n", " }\n", " catch (qsaError) {\n", " nonnativeSelectorCache(selector, true);\n", " }\n", " finally {\n", " if (nid === expando) {\n", " context.removeAttribute(\"id\");\n", " }\n", " }\n", " }\n", " }\n", " }\n", " // All others\n", " return select(selector.replace(rtrim, \"$1\"), context, results, seed);\n", " }\n", " /**\n", " * Create key-value caches of limited size\n", " * @returns {function(string, object)} Returns the Object data after storing it on itself with\n", " *\tproperty name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)\n", " *\tdeleting the oldest entry\n", " */\n", " function createCache() {\n", " var keys = [];\n", " function cache(key, value) {\n", " // Use (key + \" \") to avoid collision with native prototype properties (see Issue #157)\n", " if (keys.push(key + \" \") > Expr.cacheLength) {\n", " // Only keep the most recent entries\n", " delete cache[keys.shift()];\n", " }\n", " return (cache[key + \" \"] = value);\n", " }\n", " return cache;\n", " }\n", " /**\n", " * Mark a function for special use by Sizzle\n", " * @param {Function} fn The function to mark\n", " */\n", " function markFunction(fn) {\n", " fn[expando] = true;\n", " return fn;\n", " }\n", " /**\n", " * Support testing using an element\n", " * @param {Function} fn Passed the created element and returns a boolean result\n", " */\n", " function assert(fn) {\n", " var el = document.createElement(\"fieldset\");\n", " try {\n", " return !!fn(el);\n", " }\n", " catch (e) {\n", " return false;\n", " }\n", " finally {\n", " // Remove from its parent by default\n", " if (el.parentNode) {\n", " el.parentNode.removeChild(el);\n", " }\n", " // release memory in IE\n", " el = null;\n", " }\n", " }\n", " /**\n", " * Adds the same handler for all of the specified attrs\n", " * @param {String} attrs Pipe-separated list of attributes\n", " * @param {Function} handler The method that will be applied\n", " */\n", " function addHandle(attrs, handler) {\n", " var arr = attrs.split(\"|\"), i = arr.length;\n", " while (i--) {\n", " Expr.attrHandle[arr[i]] = handler;\n", " }\n", " }\n", " /**\n", " * Checks document order of two siblings\n", " * @param {Element} a\n", " * @param {Element} b\n", " * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b\n", " */\n", " function siblingCheck(a, b) {\n", " var cur = b && a, diff = cur && a.nodeType === 1 && b.nodeType === 1 &&\n", " a.sourceIndex - b.sourceIndex;\n", " // Use IE sourceIndex if available on both nodes\n", " if (diff) {\n", " return diff;\n", " }\n", " // Check if b follows a\n", " if (cur) {\n", " while ((cur = cur.nextSibling)) {\n", " if (cur === b) {\n", " return -1;\n", " }\n", " }\n", " }\n", " return a ? 1 : -1;\n", " }\n", " /**\n", " * Returns a function to use in pseudos for input types\n", " * @param {String} type\n", " */\n", " function createInputPseudo(type) {\n", " return function (elem) {\n", " var name = elem.nodeName.toLowerCase();\n", " return name === \"input\" && elem.type === type;\n", " };\n", " }\n", " /**\n", " * Returns a function to use in pseudos for buttons\n", " * @param {String} type\n", " */\n", " function createButtonPseudo(type) {\n", " return function (elem) {\n", " var name = elem.nodeName.toLowerCase();\n", " return (name === \"input\" || name === \"button\") && elem.type === type;\n", " };\n", " }\n", " /**\n", " * Returns a function to use in pseudos for :enabled/:disabled\n", " * @param {Boolean} disabled true for :disabled; false for :enabled\n", " */\n", " function createDisabledPseudo(disabled) {\n", " // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable\n", " return function (elem) {\n", " // Only certain elements can match :enabled or :disabled\n", " // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled\n", " // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled\n", " if (\"form\" in elem) {\n", " // Check for inherited disabledness on relevant non-disabled elements:\n", " // * listed form-associated elements in a disabled fieldset\n", " // https://html.spec.whatwg.org/multipage/forms.html#category-listed\n", " // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled\n", " // * option elements in a disabled optgroup\n", " // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled\n", " // All such elements have a \"form\" property.\n", " if (elem.parentNode && elem.disabled === false) {\n", " // Option elements defer to a parent optgroup if present\n", " if (\"label\" in elem) {\n", " if (\"label\" in elem.parentNode) {\n", " return elem.parentNode.disabled === disabled;\n", " }\n", " else {\n", " return elem.disabled === disabled;\n", " }\n", " }\n", " // Support: IE 6 - 11\n", " // Use the isDisabled shortcut property to check for disabled fieldset ancestors\n", " return elem.isDisabled === disabled ||\n", " // Where there is no isDisabled, check manually\n", " /* jshint -W018 */\n", " elem.isDisabled !== !disabled &&\n", " inDisabledFieldset(elem) === disabled;\n", " }\n", " return elem.disabled === disabled;\n", " // Try to winnow out elements that can't be disabled before trusting the disabled property.\n", " // Some victims get caught in our net (label, legend, menu, track), but it shouldn't\n", " // even exist on them, let alone have a boolean value.\n", " }\n", " else if (\"label\" in elem) {\n", " return elem.disabled === disabled;\n", " }\n", " // Remaining elements are neither :enabled nor :disabled\n", " return false;\n", " };\n", " }\n", " /**\n", " * Returns a function to use in pseudos for positionals\n", " * @param {Function} fn\n", " */\n", " function createPositionalPseudo(fn) {\n", " return markFunction(function (argument) {\n", " argument = +argument;\n", " return markFunction(function (seed, matches) {\n", " var j, matchIndexes = fn([], seed.length, argument), i = matchIndexes.length;\n", " // Match elements found at the specified indexes\n", " while (i--) {\n", " if (seed[(j = matchIndexes[i])]) {\n", " seed[j] = !(matches[j] = seed[j]);\n", " }\n", " }\n", " });\n", " });\n", " }\n", " /**\n", " * Checks a node for validity as a Sizzle context\n", " * @param {Element|Object=} context\n", " * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value\n", " */\n", " function testContext(context) {\n", " return context && typeof context.getElementsByTagName !== \"undefined\" && context;\n", " }\n", " // Expose support vars for convenience\n", " support = Sizzle.support = {};\n", " /**\n", " * Detects XML nodes\n", " * @param {Element|Object} elem An element or a document\n", " * @returns {Boolean} True iff elem is a non-HTML XML node\n", " */\n", " isXML = Sizzle.isXML = function (elem) {\n", " var namespace = elem.namespaceURI, docElem = (elem.ownerDocument || elem).documentElement;\n", " // Support: IE <=8\n", " // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes\n", " // https://bugs.jquery.com/ticket/4833\n", " return !rhtml.test(namespace || docElem && docElem.nodeName || \"HTML\");\n", " };\n", " /**\n", " * Sets document-related variables once based on the current document\n", " * @param {Element|Object} [doc] An element or document object to use to set the document\n", " * @returns {Object} Returns the current document\n", " */\n", " setDocument = Sizzle.setDocument = function (node) {\n", " var hasCompare, subWindow, doc = node ? node.ownerDocument || node : preferredDoc;\n", " // Return early if doc is invalid or already selected\n", " // Support: IE 11+, Edge 17 - 18+\n", " // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n", " // two documents; shallow comparisons work.\n", " // eslint-disable-next-line eqeqeq\n", " if (doc == document || doc.nodeType !== 9 || !doc.documentElement) {\n", " return document;\n", " }\n", " // Update global variables\n", " document = doc;\n", " docElem = document.documentElement;\n", " documentIsHTML = !isXML(document);\n", " // Support: IE 9 - 11+, Edge 12 - 18+\n", " // Accessing iframe documents after unload throws \"permission denied\" errors (jQuery #13936)\n", " // Support: IE 11+, Edge 17 - 18+\n", " // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n", " // two documents; shallow comparisons work.\n", " // eslint-disable-next-line eqeqeq\n", " if (preferredDoc != document &&\n", " (subWindow = document.defaultView) && subWindow.top !== subWindow) {\n", " // Support: IE 11, Edge\n", " if (subWindow.addEventListener) {\n", " subWindow.addEventListener(\"unload\", unloadHandler, false);\n", " // Support: IE 9 - 10 only\n", " }\n", " else if (subWindow.attachEvent) {\n", " subWindow.attachEvent(\"onunload\", unloadHandler);\n", " }\n", " }\n", " // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only,\n", " // Safari 4 - 5 only, Opera <=11.6 - 12.x only\n", " // IE/Edge & older browsers don't support the :scope pseudo-class.\n", " // Support: Safari 6.0 only\n", " // Safari 6.0 supports :scope but it's an alias of :root there.\n", " support.scope = assert(function (el) {\n", " docElem.appendChild(el).appendChild(document.createElement(\"div\"));\n", " return typeof el.querySelectorAll !== \"undefined\" &&\n", " !el.querySelectorAll(\":scope fieldset div\").length;\n", " });\n", " /* Attributes\n", " ---------------------------------------------------------------------- */\n", " // Support: IE<8\n", " // Verify that getAttribute really returns attributes and not properties\n", " // (excepting IE8 booleans)\n", " support.attributes = assert(function (el) {\n", " el.className = \"i\";\n", " return !el.getAttribute(\"className\");\n", " });\n", " /* getElement(s)By*\n", " ---------------------------------------------------------------------- */\n", " // Check if getElementsByTagName(\"*\") returns only elements\n", " support.getElementsByTagName = assert(function (el) {\n", " el.appendChild(document.createComment(\"\"));\n", " return !el.getElementsByTagName(\"*\").length;\n", " });\n", " // Support: IE<9\n", " support.getElementsByClassName = rnative.test(document.getElementsByClassName);\n", " // Support: IE<10\n", " // Check if getElementById returns elements by name\n", " // The broken getElementById methods don't pick up programmatically-set names,\n", " // so use a roundabout getElementsByName test\n", " support.getById = assert(function (el) {\n", " docElem.appendChild(el).id = expando;\n", " return !document.getElementsByName || !document.getElementsByName(expando).length;\n", " });\n", " // ID filter and find\n", " if (support.getById) {\n", " Expr.filter[\"ID\"] = function (id) {\n", " var attrId = id.replace(runescape, funescape);\n", " return function (elem) {\n", " return elem.getAttribute(\"id\") === attrId;\n", " };\n", " };\n", " Expr.find[\"ID\"] = function (id, context) {\n", " if (typeof context.getElementById !== \"undefined\" && documentIsHTML) {\n", " var elem = context.getElementById(id);\n", " return elem ? [elem] : [];\n", " }\n", " };\n", " }\n", " else {\n", " Expr.filter[\"ID\"] = function (id) {\n", " var attrId = id.replace(runescape, funescape);\n", " return function (elem) {\n", " var node = typeof elem.getAttributeNode !== \"undefined\" &&\n", " elem.getAttributeNode(\"id\");\n", " return node && node.value === attrId;\n", " };\n", " };\n", " // Support: IE 6 - 7 only\n", " // getElementById is not reliable as a find shortcut\n", " Expr.find[\"ID\"] = function (id, context) {\n", " if (typeof context.getElementById !== \"undefined\" && documentIsHTML) {\n", " var node, i, elems, elem = context.getElementById(id);\n", " if (elem) {\n", " // Verify the id attribute\n", " node = elem.getAttributeNode(\"id\");\n", " if (node && node.value === id) {\n", " return [elem];\n", " }\n", " // Fall back on getElementsByName\n", " elems = context.getElementsByName(id);\n", " i = 0;\n", " while ((elem = elems[i++])) {\n", " node = elem.getAttributeNode(\"id\");\n", " if (node && node.value === id) {\n", " return [elem];\n", " }\n", " }\n", " }\n", " return [];\n", " }\n", " };\n", " }\n", " // Tag\n", " Expr.find[\"TAG\"] = support.getElementsByTagName ?\n", " function (tag, context) {\n", " if (typeof context.getElementsByTagName !== \"undefined\") {\n", " return context.getElementsByTagName(tag);\n", " // DocumentFragment nodes don't have gEBTN\n", " }\n", " else if (support.qsa) {\n", " return context.querySelectorAll(tag);\n", " }\n", " } :\n", " function (tag, context) {\n", " var elem, tmp = [], i = 0, \n", " // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too\n", " results = context.getElementsByTagName(tag);\n", " // Filter out possible comments\n", " if (tag === \"*\") {\n", " while ((elem = results[i++])) {\n", " if (elem.nodeType === 1) {\n", " tmp.push(elem);\n", " }\n", " }\n", " return tmp;\n", " }\n", " return results;\n", " };\n", " // Class\n", " Expr.find[\"CLASS\"] = support.getElementsByClassName && function (className, context) {\n", " if (typeof context.getElementsByClassName !== \"undefined\" && documentIsHTML) {\n", " return context.getElementsByClassName(className);\n", " }\n", " };\n", " /* QSA/matchesSelector\n", " ---------------------------------------------------------------------- */\n", " // QSA and matchesSelector support\n", " // matchesSelector(:active) reports false when true (IE9/Opera 11.5)\n", " rbuggyMatches = [];\n", " // qSa(:focus) reports false when true (Chrome 21)\n", " // We allow this because of a bug in IE8/9 that throws an error\n", " // whenever `document.activeElement` is accessed on an iframe\n", " // So, we allow :focus to pass through QSA all the time to avoid the IE error\n", " // See https://bugs.jquery.com/ticket/13378\n", " rbuggyQSA = [];\n", " if ((support.qsa = rnative.test(document.querySelectorAll))) {\n", " // Build QSA regex\n", " // Regex strategy adopted from Diego Perini\n", " assert(function (el) {\n", " var input;\n", " // Select is set to empty string on purpose\n", " // This is to test IE's treatment of not explicitly\n", " // setting a boolean content attribute,\n", " // since its presence should be enough\n", " // https://bugs.jquery.com/ticket/12359\n", " docElem.appendChild(el).innerHTML = \"\" +\n", " \"\";\n", " // Support: IE8, Opera 11-12.16\n", " // Nothing should be selected when empty strings follow ^= or $= or *=\n", " // The test attribute must be unknown in Opera but \"safe\" for WinRT\n", " // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section\n", " if (el.querySelectorAll(\"[msallowcapture^='']\").length) {\n", " rbuggyQSA.push(\"[*^$]=\" + whitespace + \"*(?:''|\\\"\\\")\");\n", " }\n", " // Support: IE8\n", " // Boolean attributes and \"value\" are not treated correctly\n", " if (!el.querySelectorAll(\"[selected]\").length) {\n", " rbuggyQSA.push(\"\\\\[\" + whitespace + \"*(?:value|\" + booleans + \")\");\n", " }\n", " // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+\n", " if (!el.querySelectorAll(\"[id~=\" + expando + \"-]\").length) {\n", " rbuggyQSA.push(\"~=\");\n", " }\n", " // Support: IE 11+, Edge 15 - 18+\n", " // IE 11/Edge don't find elements on a `[name='']` query in some cases.\n", " // Adding a temporary attribute to the document before the selection works\n", " // around the issue.\n", " // Interestingly, IE 10 & older don't seem to have the issue.\n", " input = document.createElement(\"input\");\n", " input.setAttribute(\"name\", \"\");\n", " el.appendChild(input);\n", " if (!el.querySelectorAll(\"[name='']\").length) {\n", " rbuggyQSA.push(\"\\\\[\" + whitespace + \"*name\" + whitespace + \"*=\" +\n", " whitespace + \"*(?:''|\\\"\\\")\");\n", " }\n", " // Webkit/Opera - :checked should return selected option elements\n", " // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked\n", " // IE8 throws error here and will not see later tests\n", " if (!el.querySelectorAll(\":checked\").length) {\n", " rbuggyQSA.push(\":checked\");\n", " }\n", " // Support: Safari 8+, iOS 8+\n", " // https://bugs.webkit.org/show_bug.cgi?id=136851\n", " // In-page `selector#id sibling-combinator selector` fails\n", " if (!el.querySelectorAll(\"a#\" + expando + \"+*\").length) {\n", " rbuggyQSA.push(\".#.+[+~]\");\n", " }\n", " // Support: Firefox <=3.6 - 5 only\n", " // Old Firefox doesn't throw on a badly-escaped identifier.\n", " el.querySelectorAll(\"\\\\\\f\");\n", " rbuggyQSA.push(\"[\\\\r\\\\n\\\\f]\");\n", " });\n", " assert(function (el) {\n", " el.innerHTML = \"\" +\n", " \"\";\n", " // Support: Windows 8 Native Apps\n", " // The type and name attributes are restricted during .innerHTML assignment\n", " var input = document.createElement(\"input\");\n", " input.setAttribute(\"type\", \"hidden\");\n", " el.appendChild(input).setAttribute(\"name\", \"D\");\n", " // Support: IE8\n", " // Enforce case-sensitivity of name attribute\n", " if (el.querySelectorAll(\"[name=d]\").length) {\n", " rbuggyQSA.push(\"name\" + whitespace + \"*[*^$|!~]?=\");\n", " }\n", " // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)\n", " // IE8 throws error here and will not see later tests\n", " if (el.querySelectorAll(\":enabled\").length !== 2) {\n", " rbuggyQSA.push(\":enabled\", \":disabled\");\n", " }\n", " // Support: IE9-11+\n", " // IE's :disabled selector does not pick up the children of disabled fieldsets\n", " docElem.appendChild(el).disabled = true;\n", " if (el.querySelectorAll(\":disabled\").length !== 2) {\n", " rbuggyQSA.push(\":enabled\", \":disabled\");\n", " }\n", " // Support: Opera 10 - 11 only\n", " // Opera 10-11 does not throw on post-comma invalid pseudos\n", " el.querySelectorAll(\"*,:x\");\n", " rbuggyQSA.push(\",.*:\");\n", " });\n", " }\n", " if ((support.matchesSelector = rnative.test((matches = docElem.matches ||\n", " docElem.webkitMatchesSelector ||\n", " docElem.mozMatchesSelector ||\n", " docElem.oMatchesSelector ||\n", " docElem.msMatchesSelector)))) {\n", " assert(function (el) {\n", " // Check to see if it's possible to do matchesSelector\n", " // on a disconnected node (IE 9)\n", " support.disconnectedMatch = matches.call(el, \"*\");\n", " // This should fail with an exception\n", " // Gecko does not error, returns false instead\n", " matches.call(el, \"[s!='']:x\");\n", " rbuggyMatches.push(\"!=\", pseudos);\n", " });\n", " }\n", " rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join(\"|\"));\n", " rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join(\"|\"));\n", " /* Contains\n", " ---------------------------------------------------------------------- */\n", " hasCompare = rnative.test(docElem.compareDocumentPosition);\n", " // Element contains another\n", " // Purposefully self-exclusive\n", " // As in, an element does not contain itself\n", " contains = hasCompare || rnative.test(docElem.contains) ?\n", " function (a, b) {\n", " var adown = a.nodeType === 9 ? a.documentElement : a, bup = b && b.parentNode;\n", " return a === bup || !!(bup && bup.nodeType === 1 && (adown.contains ?\n", " adown.contains(bup) :\n", " a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16));\n", " } :\n", " function (a, b) {\n", " if (b) {\n", " while ((b = b.parentNode)) {\n", " if (b === a) {\n", " return true;\n", " }\n", " }\n", " }\n", " return false;\n", " };\n", " /* Sorting\n", " ---------------------------------------------------------------------- */\n", " // Document order sorting\n", " sortOrder = hasCompare ?\n", " function (a, b) {\n", " // Flag for duplicate removal\n", " if (a === b) {\n", " hasDuplicate = true;\n", " return 0;\n", " }\n", " // Sort on method existence if only one input has compareDocumentPosition\n", " var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;\n", " if (compare) {\n", " return compare;\n", " }\n", " // Calculate position if both inputs belong to the same document\n", " // Support: IE 11+, Edge 17 - 18+\n", " // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n", " // two documents; shallow comparisons work.\n", " // eslint-disable-next-line eqeqeq\n", " compare = (a.ownerDocument || a) == (b.ownerDocument || b) ?\n", " a.compareDocumentPosition(b) :\n", " // Otherwise we know they are disconnected\n", " 1;\n", " // Disconnected nodes\n", " if (compare & 1 ||\n", " (!support.sortDetached && b.compareDocumentPosition(a) === compare)) {\n", " // Choose the first element that is related to our preferred document\n", " // Support: IE 11+, Edge 17 - 18+\n", " // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n", " // two documents; shallow comparisons work.\n", " // eslint-disable-next-line eqeqeq\n", " if (a == document || a.ownerDocument == preferredDoc &&\n", " contains(preferredDoc, a)) {\n", " return -1;\n", " }\n", " // Support: IE 11+, Edge 17 - 18+\n", " // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n", " // two documents; shallow comparisons work.\n", " // eslint-disable-next-line eqeqeq\n", " if (b == document || b.ownerDocument == preferredDoc &&\n", " contains(preferredDoc, b)) {\n", " return 1;\n", " }\n", " // Maintain original order\n", " return sortInput ?\n", " (indexOf(sortInput, a) - indexOf(sortInput, b)) :\n", " 0;\n", " }\n", " return compare & 4 ? -1 : 1;\n", " } :\n", " function (a, b) {\n", " // Exit early if the nodes are identical\n", " if (a === b) {\n", " hasDuplicate = true;\n", " return 0;\n", " }\n", " var cur, i = 0, aup = a.parentNode, bup = b.parentNode, ap = [a], bp = [b];\n", " // Parentless nodes are either documents or disconnected\n", " if (!aup || !bup) {\n", " // Support: IE 11+, Edge 17 - 18+\n", " // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n", " // two documents; shallow comparisons work.\n", " /* eslint-disable eqeqeq */\n", " return a == document ? -1 :\n", " b == document ? 1 :\n", " /* eslint-enable eqeqeq */\n", " aup ? -1 :\n", " bup ? 1 :\n", " sortInput ?\n", " (indexOf(sortInput, a) - indexOf(sortInput, b)) :\n", " 0;\n", " // If the nodes are siblings, we can do a quick check\n", " }\n", " else if (aup === bup) {\n", " return siblingCheck(a, b);\n", " }\n", " // Otherwise we need full lists of their ancestors for comparison\n", " cur = a;\n", " while ((cur = cur.parentNode)) {\n", " ap.unshift(cur);\n", " }\n", " cur = b;\n", " while ((cur = cur.parentNode)) {\n", " bp.unshift(cur);\n", " }\n", " // Walk down the tree looking for a discrepancy\n", " while (ap[i] === bp[i]) {\n", " i++;\n", " }\n", " return i ?\n", " // Do a sibling check if the nodes have a common ancestor\n", " siblingCheck(ap[i], bp[i]) :\n", " // Otherwise nodes in our document sort first\n", " // Support: IE 11+, Edge 17 - 18+\n", " // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n", " // two documents; shallow comparisons work.\n", " /* eslint-disable eqeqeq */\n", " ap[i] == preferredDoc ? -1 :\n", " bp[i] == preferredDoc ? 1 :\n", " /* eslint-enable eqeqeq */\n", " 0;\n", " };\n", " return document;\n", " };\n", " Sizzle.matches = function (expr, elements) {\n", " return Sizzle(expr, null, null, elements);\n", " };\n", " Sizzle.matchesSelector = function (elem, expr) {\n", " setDocument(elem);\n", " if (support.matchesSelector && documentIsHTML &&\n", " !nonnativeSelectorCache[expr + \" \"] &&\n", " (!rbuggyMatches || !rbuggyMatches.test(expr)) &&\n", " (!rbuggyQSA || !rbuggyQSA.test(expr))) {\n", " try {\n", " var ret = matches.call(elem, expr);\n", " // IE 9's matchesSelector returns false on disconnected nodes\n", " if (ret || support.disconnectedMatch ||\n", " // As well, disconnected nodes are said to be in a document\n", " // fragment in IE 9\n", " elem.document && elem.document.nodeType !== 11) {\n", " return ret;\n", " }\n", " }\n", " catch (e) {\n", " nonnativeSelectorCache(expr, true);\n", " }\n", " }\n", " return Sizzle(expr, document, null, [elem]).length > 0;\n", " };\n", " Sizzle.contains = function (context, elem) {\n", " // Set document vars if needed\n", " // Support: IE 11+, Edge 17 - 18+\n", " // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n", " // two documents; shallow comparisons work.\n", " // eslint-disable-next-line eqeqeq\n", " if ((context.ownerDocument || context) != document) {\n", " setDocument(context);\n", " }\n", " return contains(context, elem);\n", " };\n", " Sizzle.attr = function (elem, name) {\n", " // Set document vars if needed\n", " // Support: IE 11+, Edge 17 - 18+\n", " // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n", " // two documents; shallow comparisons work.\n", " // eslint-disable-next-line eqeqeq\n", " if ((elem.ownerDocument || elem) != document) {\n", " setDocument(elem);\n", " }\n", " var fn = Expr.attrHandle[name.toLowerCase()], \n", " // Don't get fooled by Object.prototype properties (jQuery #13807)\n", " val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ?\n", " fn(elem, name, !documentIsHTML) :\n", " undefined;\n", " return val !== undefined ?\n", " val :\n", " support.attributes || !documentIsHTML ?\n", " elem.getAttribute(name) :\n", " (val = elem.getAttributeNode(name)) && val.specified ?\n", " val.value :\n", " null;\n", " };\n", " Sizzle.escape = function (sel) {\n", " return (sel + \"\").replace(rcssescape, fcssescape);\n", " };\n", " Sizzle.error = function (msg) {\n", " throw new Error(\"Syntax error, unrecognized expression: \" + msg);\n", " };\n", " /**\n", " * Document sorting and removing duplicates\n", " * @param {ArrayLike} results\n", " */\n", " Sizzle.uniqueSort = function (results) {\n", " var elem, duplicates = [], j = 0, i = 0;\n", " // Unless we *know* we can detect duplicates, assume their presence\n", " hasDuplicate = !support.detectDuplicates;\n", " sortInput = !support.sortStable && results.slice(0);\n", " results.sort(sortOrder);\n", " if (hasDuplicate) {\n", " while ((elem = results[i++])) {\n", " if (elem === results[i]) {\n", " j = duplicates.push(i);\n", " }\n", " }\n", " while (j--) {\n", " results.splice(duplicates[j], 1);\n", " }\n", " }\n", " // Clear input after sorting to release objects\n", " // See https://github.com/jquery/sizzle/pull/225\n", " sortInput = null;\n", " return results;\n", " };\n", " /**\n", " * Utility function for retrieving the text value of an array of DOM nodes\n", " * @param {Array|Element} elem\n", " */\n", " getText = Sizzle.getText = function (elem) {\n", " var node, ret = \"\", i = 0, nodeType = elem.nodeType;\n", " if (!nodeType) {\n", " // If no nodeType, this is expected to be an array\n", " while ((node = elem[i++])) {\n", " // Do not traverse comment nodes\n", " ret += getText(node);\n", " }\n", " }\n", " else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {\n", " // Use textContent for elements\n", " // innerText usage removed for consistency of new lines (jQuery #11153)\n", " if (typeof elem.textContent === \"string\") {\n", " return elem.textContent;\n", " }\n", " else {\n", " // Traverse its children\n", " for (elem = elem.firstChild; elem; elem = elem.nextSibling) {\n", " ret += getText(elem);\n", " }\n", " }\n", " }\n", " else if (nodeType === 3 || nodeType === 4) {\n", " return elem.nodeValue;\n", " }\n", " // Do not include comment or processing instruction nodes\n", " return ret;\n", " };\n", " Expr = Sizzle.selectors = {\n", " // Can be adjusted by the user\n", " cacheLength: 50,\n", " createPseudo: markFunction,\n", " match: matchExpr,\n", " attrHandle: {},\n", " find: {},\n", " relative: {\n", " \">\": { dir: \"parentNode\", first: true },\n", " \" \": { dir: \"parentNode\" },\n", " \"+\": { dir: \"previousSibling\", first: true },\n", " \"~\": { dir: \"previousSibling\" }\n", " },\n", " preFilter: {\n", " \"ATTR\": function (match) {\n", " match[1] = match[1].replace(runescape, funescape);\n", " // Move the given value to match[3] whether quoted or unquoted\n", " match[3] = (match[3] || match[4] ||\n", " match[5] || \"\").replace(runescape, funescape);\n", " if (match[2] === \"~=\") {\n", " match[3] = \" \" + match[3] + \" \";\n", " }\n", " return match.slice(0, 4);\n", " },\n", " \"CHILD\": function (match) {\n", " /* matches from matchExpr[\"CHILD\"]\n", " 1 type (only|nth|...)\n", " 2 what (child|of-type)\n", " 3 argument (even|odd|\\d*|\\d*n([+-]\\d+)?|...)\n", " 4 xn-component of xn+y argument ([+-]?\\d*n|)\n", " 5 sign of xn-component\n", " 6 x of xn-component\n", " 7 sign of y-component\n", " 8 y of y-component\n", " */\n", " match[1] = match[1].toLowerCase();\n", " if (match[1].slice(0, 3) === \"nth\") {\n", " // nth-* requires argument\n", " if (!match[3]) {\n", " Sizzle.error(match[0]);\n", " }\n", " // numeric x and y parameters for Expr.filter.CHILD\n", " // remember that false/true cast respectively to 0/1\n", " match[4] = +(match[4] ?\n", " match[5] + (match[6] || 1) :\n", " 2 * (match[3] === \"even\" || match[3] === \"odd\"));\n", " match[5] = +((match[7] + match[8]) || match[3] === \"odd\");\n", " // other types prohibit arguments\n", " }\n", " else if (match[3]) {\n", " Sizzle.error(match[0]);\n", " }\n", " return match;\n", " },\n", " \"PSEUDO\": function (match) {\n", " var excess, unquoted = !match[6] && match[2];\n", " if (matchExpr[\"CHILD\"].test(match[0])) {\n", " return null;\n", " }\n", " // Accept quoted arguments as-is\n", " if (match[3]) {\n", " match[2] = match[4] || match[5] || \"\";\n", " // Strip excess characters from unquoted arguments\n", " }\n", " else if (unquoted && rpseudo.test(unquoted) &&\n", " // Get excess from tokenize (recursively)\n", " (excess = tokenize(unquoted, true)) &&\n", " // advance to the next closing parenthesis\n", " (excess = unquoted.indexOf(\")\", unquoted.length - excess) - unquoted.length)) {\n", " // excess is a negative index\n", " match[0] = match[0].slice(0, excess);\n", " match[2] = unquoted.slice(0, excess);\n", " }\n", " // Return only captures needed by the pseudo filter method (type and argument)\n", " return match.slice(0, 3);\n", " }\n", " },\n", " filter: {\n", " \"TAG\": function (nodeNameSelector) {\n", " var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();\n", " return nodeNameSelector === \"*\" ?\n", " function () {\n", " return true;\n", " } :\n", " function (elem) {\n", " return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;\n", " };\n", " },\n", " \"CLASS\": function (className) {\n", " var pattern = classCache[className + \" \"];\n", " return pattern ||\n", " (pattern = new RegExp(\"(^|\" + whitespace +\n", " \")\" + className + \"(\" + whitespace + \"|$)\")) && classCache(className, function (elem) {\n", " return pattern.test(typeof elem.className === \"string\" && elem.className ||\n", " typeof elem.getAttribute !== \"undefined\" &&\n", " elem.getAttribute(\"class\") ||\n", " \"\");\n", " });\n", " },\n", " \"ATTR\": function (name, operator, check) {\n", " return function (elem) {\n", " var result = Sizzle.attr(elem, name);\n", " if (result == null) {\n", " return operator === \"!=\";\n", " }\n", " if (!operator) {\n", " return true;\n", " }\n", " result += \"\";\n", " /* eslint-disable max-len */\n", " return operator === \"=\" ? result === check :\n", " operator === \"!=\" ? result !== check :\n", " operator === \"^=\" ? check && result.indexOf(check) === 0 :\n", " operator === \"*=\" ? check && result.indexOf(check) > -1 :\n", " operator === \"$=\" ? check && result.slice(-check.length) === check :\n", " operator === \"~=\" ? (\" \" + result.replace(rwhitespace, \" \") + \" \").indexOf(check) > -1 :\n", " operator === \"|=\" ? result === check || result.slice(0, check.length + 1) === check + \"-\" :\n", " false;\n", " /* eslint-enable max-len */\n", " };\n", " },\n", " \"CHILD\": function (type, what, _argument, first, last) {\n", " var simple = type.slice(0, 3) !== \"nth\", forward = type.slice(-4) !== \"last\", ofType = what === \"of-type\";\n", " return first === 1 && last === 0 ?\n", " // Shortcut for :nth-*(n)\n", " function (elem) {\n", " return !!elem.parentNode;\n", " } :\n", " function (elem, _context, xml) {\n", " var cache, uniqueCache, outerCache, node, nodeIndex, start, dir = simple !== forward ? \"nextSibling\" : \"previousSibling\", parent = elem.parentNode, name = ofType && elem.nodeName.toLowerCase(), useCache = !xml && !ofType, diff = false;\n", " if (parent) {\n", " // :(first|last|only)-(child|of-type)\n", " if (simple) {\n", " while (dir) {\n", " node = elem;\n", " while ((node = node[dir])) {\n", " if (ofType ?\n", " node.nodeName.toLowerCase() === name :\n", " node.nodeType === 1) {\n", " return false;\n", " }\n", " }\n", " // Reverse direction for :only-* (if we haven't yet done so)\n", " start = dir = type === \"only\" && !start && \"nextSibling\";\n", " }\n", " return true;\n", " }\n", " start = [forward ? parent.firstChild : parent.lastChild];\n", " // non-xml :nth-child(...) stores cache data on `parent`\n", " if (forward && useCache) {\n", " // Seek `elem` from a previously-cached index\n", " // ...in a gzip-friendly way\n", " node = parent;\n", " outerCache = node[expando] || (node[expando] = {});\n", " // Support: IE <9 only\n", " // Defend against cloned attroperties (jQuery gh-1709)\n", " uniqueCache = outerCache[node.uniqueID] ||\n", " (outerCache[node.uniqueID] = {});\n", " cache = uniqueCache[type] || [];\n", " nodeIndex = cache[0] === dirruns && cache[1];\n", " diff = nodeIndex && cache[2];\n", " node = nodeIndex && parent.childNodes[nodeIndex];\n", " while ((node = ++nodeIndex && node && node[dir] ||\n", " // Fallback to seeking `elem` from the start\n", " (diff = nodeIndex = 0) || start.pop())) {\n", " // When found, cache indexes on `parent` and break\n", " if (node.nodeType === 1 && ++diff && node === elem) {\n", " uniqueCache[type] = [dirruns, nodeIndex, diff];\n", " break;\n", " }\n", " }\n", " }\n", " else {\n", " // Use previously-cached element index if available\n", " if (useCache) {\n", " // ...in a gzip-friendly way\n", " node = elem;\n", " outerCache = node[expando] || (node[expando] = {});\n", " // Support: IE <9 only\n", " // Defend against cloned attroperties (jQuery gh-1709)\n", " uniqueCache = outerCache[node.uniqueID] ||\n", " (outerCache[node.uniqueID] = {});\n", " cache = uniqueCache[type] || [];\n", " nodeIndex = cache[0] === dirruns && cache[1];\n", " diff = nodeIndex;\n", " }\n", " // xml :nth-child(...)\n", " // or :nth-last-child(...) or :nth(-last)?-of-type(...)\n", " if (diff === false) {\n", " // Use the same loop as above to seek `elem` from the start\n", " while ((node = ++nodeIndex && node && node[dir] ||\n", " (diff = nodeIndex = 0) || start.pop())) {\n", " if ((ofType ?\n", " node.nodeName.toLowerCase() === name :\n", " node.nodeType === 1) &&\n", " ++diff) {\n", " // Cache the index of each encountered element\n", " if (useCache) {\n", " outerCache = node[expando] ||\n", " (node[expando] = {});\n", " // Support: IE <9 only\n", " // Defend against cloned attroperties (jQuery gh-1709)\n", " uniqueCache = outerCache[node.uniqueID] ||\n", " (outerCache[node.uniqueID] = {});\n", " uniqueCache[type] = [dirruns, diff];\n", " }\n", " if (node === elem) {\n", " break;\n", " }\n", " }\n", " }\n", " }\n", " }\n", " // Incorporate the offset, then check against cycle size\n", " diff -= last;\n", " return diff === first || (diff % first === 0 && diff / first >= 0);\n", " }\n", " };\n", " },\n", " \"PSEUDO\": function (pseudo, argument) {\n", " // pseudo-class names are case-insensitive\n", " // http://www.w3.org/TR/selectors/#pseudo-classes\n", " // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters\n", " // Remember that setFilters inherits from pseudos\n", " var args, fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] ||\n", " Sizzle.error(\"unsupported pseudo: \" + pseudo);\n", " // The user may use createPseudo to indicate that\n", " // arguments are needed to create the filter function\n", " // just as Sizzle does\n", " if (fn[expando]) {\n", " return fn(argument);\n", " }\n", " // But maintain support for old signatures\n", " if (fn.length > 1) {\n", " args = [pseudo, pseudo, \"\", argument];\n", " return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ?\n", " markFunction(function (seed, matches) {\n", " var idx, matched = fn(seed, argument), i = matched.length;\n", " while (i--) {\n", " idx = indexOf(seed, matched[i]);\n", " seed[idx] = !(matches[idx] = matched[i]);\n", " }\n", " }) :\n", " function (elem) {\n", " return fn(elem, 0, args);\n", " };\n", " }\n", " return fn;\n", " }\n", " },\n", " pseudos: {\n", " // Potentially complex pseudos\n", " \"not\": markFunction(function (selector) {\n", " // Trim the selector passed to compile\n", " // to avoid treating leading and trailing\n", " // spaces as combinators\n", " var input = [], results = [], matcher = compile(selector.replace(rtrim, \"$1\"));\n", " return matcher[expando] ?\n", " markFunction(function (seed, matches, _context, xml) {\n", " var elem, unmatched = matcher(seed, null, xml, []), i = seed.length;\n", " // Match elements unmatched by `matcher`\n", " while (i--) {\n", " if ((elem = unmatched[i])) {\n", " seed[i] = !(matches[i] = elem);\n", " }\n", " }\n", " }) :\n", " function (elem, _context, xml) {\n", " input[0] = elem;\n", " matcher(input, null, xml, results);\n", " // Don't keep the element (issue #299)\n", " input[0] = null;\n", " return !results.pop();\n", " };\n", " }),\n", " \"has\": markFunction(function (selector) {\n", " return function (elem) {\n", " return Sizzle(selector, elem).length > 0;\n", " };\n", " }),\n", " \"contains\": markFunction(function (text) {\n", " text = text.replace(runescape, funescape);\n", " return function (elem) {\n", " return (elem.textContent || getText(elem)).indexOf(text) > -1;\n", " };\n", " }),\n", " // \"Whether an element is represented by a :lang() selector\n", " // is based solely on the element's language value\n", " // being equal to the identifier C,\n", " // or beginning with the identifier C immediately followed by \"-\".\n", " // The matching of C against the element's language value is performed case-insensitively.\n", " // The identifier C does not have to be a valid language name.\"\n", " // http://www.w3.org/TR/selectors/#lang-pseudo\n", " \"lang\": markFunction(function (lang) {\n", " // lang value must be a valid identifier\n", " if (!ridentifier.test(lang || \"\")) {\n", " Sizzle.error(\"unsupported lang: \" + lang);\n", " }\n", " lang = lang.replace(runescape, funescape).toLowerCase();\n", " return function (elem) {\n", " var elemLang;\n", " do {\n", " if ((elemLang = documentIsHTML ?\n", " elem.lang :\n", " elem.getAttribute(\"xml:lang\") || elem.getAttribute(\"lang\"))) {\n", " elemLang = elemLang.toLowerCase();\n", " return elemLang === lang || elemLang.indexOf(lang + \"-\") === 0;\n", " }\n", " } while ((elem = elem.parentNode) && elem.nodeType === 1);\n", " return false;\n", " };\n", " }),\n", " // Miscellaneous\n", " \"target\": function (elem) {\n", " var hash = window.location && window.location.hash;\n", " return hash && hash.slice(1) === elem.id;\n", " },\n", " \"root\": function (elem) {\n", " return elem === docElem;\n", " },\n", " \"focus\": function (elem) {\n", " return elem === document.activeElement &&\n", " (!document.hasFocus || document.hasFocus()) &&\n", " !!(elem.type || elem.href || ~elem.tabIndex);\n", " },\n", " // Boolean properties\n", " \"enabled\": createDisabledPseudo(false),\n", " \"disabled\": createDisabledPseudo(true),\n", " \"checked\": function (elem) {\n", " // In CSS3, :checked should return both checked and selected elements\n", " // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked\n", " var nodeName = elem.nodeName.toLowerCase();\n", " return (nodeName === \"input\" && !!elem.checked) ||\n", " (nodeName === \"option\" && !!elem.selected);\n", " },\n", " \"selected\": function (elem) {\n", " // Accessing this property makes selected-by-default\n", " // options in Safari work properly\n", " if (elem.parentNode) {\n", " // eslint-disable-next-line no-unused-expressions\n", " elem.parentNode.selectedIndex;\n", " }\n", " return elem.selected === true;\n", " },\n", " // Contents\n", " \"empty\": function (elem) {\n", " // http://www.w3.org/TR/selectors/#empty-pseudo\n", " // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),\n", " // but not by others (comment: 8; processing instruction: 7; etc.)\n", " // nodeType < 6 works because attributes (2) do not appear as children\n", " for (elem = elem.firstChild; elem; elem = elem.nextSibling) {\n", " if (elem.nodeType < 6) {\n", " return false;\n", " }\n", " }\n", " return true;\n", " },\n", " \"parent\": function (elem) {\n", " return !Expr.pseudos[\"empty\"](elem);\n", " },\n", " // Element/input types\n", " \"header\": function (elem) {\n", " return rheader.test(elem.nodeName);\n", " },\n", " \"input\": function (elem) {\n", " return rinputs.test(elem.nodeName);\n", " },\n", " \"button\": function (elem) {\n", " var name = elem.nodeName.toLowerCase();\n", " return name === \"input\" && elem.type === \"button\" || name === \"button\";\n", " },\n", " \"text\": function (elem) {\n", " var attr;\n", " return elem.nodeName.toLowerCase() === \"input\" &&\n", " elem.type === \"text\" &&\n", " // Support: IE<8\n", " // New HTML5 attribute values (e.g., \"search\") appear with elem.type === \"text\"\n", " ((attr = elem.getAttribute(\"type\")) == null ||\n", " attr.toLowerCase() === \"text\");\n", " },\n", " // Position-in-collection\n", " \"first\": createPositionalPseudo(function () {\n", " return [0];\n", " }),\n", " \"last\": createPositionalPseudo(function (_matchIndexes, length) {\n", " return [length - 1];\n", " }),\n", " \"eq\": createPositionalPseudo(function (_matchIndexes, length, argument) {\n", " return [argument < 0 ? argument + length : argument];\n", " }),\n", " \"even\": createPositionalPseudo(function (matchIndexes, length) {\n", " var i = 0;\n", " for (; i < length; i += 2) {\n", " matchIndexes.push(i);\n", " }\n", " return matchIndexes;\n", " }),\n", " \"odd\": createPositionalPseudo(function (matchIndexes, length) {\n", " var i = 1;\n", " for (; i < length; i += 2) {\n", " matchIndexes.push(i);\n", " }\n", " return matchIndexes;\n", " }),\n", " \"lt\": createPositionalPseudo(function (matchIndexes, length, argument) {\n", " var i = argument < 0 ?\n", " argument + length :\n", " argument > length ?\n", " length :\n", " argument;\n", " for (; --i >= 0;) {\n", " matchIndexes.push(i);\n", " }\n", " return matchIndexes;\n", " }),\n", " \"gt\": createPositionalPseudo(function (matchIndexes, length, argument) {\n", " var i = argument < 0 ? argument + length : argument;\n", " for (; ++i < length;) {\n", " matchIndexes.push(i);\n", " }\n", " return matchIndexes;\n", " })\n", " }\n", " };\n", " Expr.pseudos[\"nth\"] = Expr.pseudos[\"eq\"];\n", " // Add button/input type pseudos\n", " for (i in { radio: true, checkbox: true, file: true, password: true, image: true }) {\n", " Expr.pseudos[i] = createInputPseudo(i);\n", " }\n", " for (i in { submit: true, reset: true }) {\n", " Expr.pseudos[i] = createButtonPseudo(i);\n", " }\n", " // Easy API for creating new setFilters\n", " function setFilters() { }\n", " setFilters.prototype = Expr.filters = Expr.pseudos;\n", " Expr.setFilters = new setFilters();\n", " tokenize = Sizzle.tokenize = function (selector, parseOnly) {\n", " var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[selector + \" \"];\n", " if (cached) {\n", " return parseOnly ? 0 : cached.slice(0);\n", " }\n", " soFar = selector;\n", " groups = [];\n", " preFilters = Expr.preFilter;\n", " while (soFar) {\n", " // Comma and first run\n", " if (!matched || (match = rcomma.exec(soFar))) {\n", " if (match) {\n", " // Don't consume trailing commas as valid\n", " soFar = soFar.slice(match[0].length) || soFar;\n", " }\n", " groups.push((tokens = []));\n", " }\n", " matched = false;\n", " // Combinators\n", " if ((match = rcombinators.exec(soFar))) {\n", " matched = match.shift();\n", " tokens.push({\n", " value: matched,\n", " // Cast descendant combinators to space\n", " type: match[0].replace(rtrim, \" \")\n", " });\n", " soFar = soFar.slice(matched.length);\n", " }\n", " // Filters\n", " for (type in Expr.filter) {\n", " if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] ||\n", " (match = preFilters[type](match)))) {\n", " matched = match.shift();\n", " tokens.push({\n", " value: matched,\n", " type: type,\n", " matches: match\n", " });\n", " soFar = soFar.slice(matched.length);\n", " }\n", " }\n", " if (!matched) {\n", " break;\n", " }\n", " }\n", " // Return the length of the invalid excess\n", " // if we're just parsing\n", " // Otherwise, throw an error or return tokens\n", " return parseOnly ?\n", " soFar.length :\n", " soFar ?\n", " Sizzle.error(selector) :\n", " // Cache the tokens\n", " tokenCache(selector, groups).slice(0);\n", " };\n", " function toSelector(tokens) {\n", " var i = 0, len = tokens.length, selector = \"\";\n", " for (; i < len; i++) {\n", " selector += tokens[i].value;\n", " }\n", " return selector;\n", " }\n", " function addCombinator(matcher, combinator, base) {\n", " var dir = combinator.dir, skip = combinator.next, key = skip || dir, checkNonElements = base && key === \"parentNode\", doneName = done++;\n", " return combinator.first ?\n", " // Check against closest ancestor/preceding element\n", " function (elem, context, xml) {\n", " while ((elem = elem[dir])) {\n", " if (elem.nodeType === 1 || checkNonElements) {\n", " return matcher(elem, context, xml);\n", " }\n", " }\n", " return false;\n", " } :\n", " // Check against all ancestor/preceding elements\n", " function (elem, context, xml) {\n", " var oldCache, uniqueCache, outerCache, newCache = [dirruns, doneName];\n", " // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching\n", " if (xml) {\n", " while ((elem = elem[dir])) {\n", " if (elem.nodeType === 1 || checkNonElements) {\n", " if (matcher(elem, context, xml)) {\n", " return true;\n", " }\n", " }\n", " }\n", " }\n", " else {\n", " while ((elem = elem[dir])) {\n", " if (elem.nodeType === 1 || checkNonElements) {\n", " outerCache = elem[expando] || (elem[expando] = {});\n", " // Support: IE <9 only\n", " // Defend against cloned attroperties (jQuery gh-1709)\n", " uniqueCache = outerCache[elem.uniqueID] ||\n", " (outerCache[elem.uniqueID] = {});\n", " if (skip && skip === elem.nodeName.toLowerCase()) {\n", " elem = elem[dir] || elem;\n", " }\n", " else if ((oldCache = uniqueCache[key]) &&\n", " oldCache[0] === dirruns && oldCache[1] === doneName) {\n", " // Assign to newCache so results back-propagate to previous elements\n", " return (newCache[2] = oldCache[2]);\n", " }\n", " else {\n", " // Reuse newcache so results back-propagate to previous elements\n", " uniqueCache[key] = newCache;\n", " // A match means we're done; a fail means we have to keep checking\n", " if ((newCache[2] = matcher(elem, context, xml))) {\n", " return true;\n", " }\n", " }\n", " }\n", " }\n", " }\n", " return false;\n", " };\n", " }\n", " function elementMatcher(matchers) {\n", " return matchers.length > 1 ?\n", " function (elem, context, xml) {\n", " var i = matchers.length;\n", " while (i--) {\n", " if (!matchers[i](elem, context, xml)) {\n", " return false;\n", " }\n", " }\n", " return true;\n", " } :\n", " matchers[0];\n", " }\n", " function multipleContexts(selector, contexts, results) {\n", " var i = 0, len = contexts.length;\n", " for (; i < len; i++) {\n", " Sizzle(selector, contexts[i], results);\n", " }\n", " return results;\n", " }\n", " function condense(unmatched, map, filter, context, xml) {\n", " var elem, newUnmatched = [], i = 0, len = unmatched.length, mapped = map != null;\n", " for (; i < len; i++) {\n", " if ((elem = unmatched[i])) {\n", " if (!filter || filter(elem, context, xml)) {\n", " newUnmatched.push(elem);\n", " if (mapped) {\n", " map.push(i);\n", " }\n", " }\n", " }\n", " }\n", " return newUnmatched;\n", " }\n", " function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {\n", " if (postFilter && !postFilter[expando]) {\n", " postFilter = setMatcher(postFilter);\n", " }\n", " if (postFinder && !postFinder[expando]) {\n", " postFinder = setMatcher(postFinder, postSelector);\n", " }\n", " return markFunction(function (seed, results, context, xml) {\n", " var temp, i, elem, preMap = [], postMap = [], preexisting = results.length, \n", " // Get initial elements from seed or context\n", " elems = seed || multipleContexts(selector || \"*\", context.nodeType ? [context] : context, []), \n", " // Prefilter to get matcher input, preserving a map for seed-results synchronization\n", " matcherIn = preFilter && (seed || !selector) ?\n", " condense(elems, preMap, preFilter, context, xml) :\n", " elems, matcherOut = matcher ?\n", " // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,\n", " postFinder || (seed ? preFilter : preexisting || postFilter) ?\n", " // ...intermediate processing is necessary\n", " [] :\n", " // ...otherwise use results directly\n", " results :\n", " matcherIn;\n", " // Find primary matches\n", " if (matcher) {\n", " matcher(matcherIn, matcherOut, context, xml);\n", " }\n", " // Apply postFilter\n", " if (postFilter) {\n", " temp = condense(matcherOut, postMap);\n", " postFilter(temp, [], context, xml);\n", " // Un-match failing elements by moving them back to matcherIn\n", " i = temp.length;\n", " while (i--) {\n", " if ((elem = temp[i])) {\n", " matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem);\n", " }\n", " }\n", " }\n", " if (seed) {\n", " if (postFinder || preFilter) {\n", " if (postFinder) {\n", " // Get the final matcherOut by condensing this intermediate into postFinder contexts\n", " temp = [];\n", " i = matcherOut.length;\n", " while (i--) {\n", " if ((elem = matcherOut[i])) {\n", " // Restore matcherIn since elem is not yet a final match\n", " temp.push((matcherIn[i] = elem));\n", " }\n", " }\n", " postFinder(null, (matcherOut = []), temp, xml);\n", " }\n", " // Move matched elements from seed to results to keep them synchronized\n", " i = matcherOut.length;\n", " while (i--) {\n", " if ((elem = matcherOut[i]) &&\n", " (temp = postFinder ? indexOf(seed, elem) : preMap[i]) > -1) {\n", " seed[temp] = !(results[temp] = elem);\n", " }\n", " }\n", " }\n", " // Add elements to results, through postFinder if defined\n", " }\n", " else {\n", " matcherOut = condense(matcherOut === results ?\n", " matcherOut.splice(preexisting, matcherOut.length) :\n", " matcherOut);\n", " if (postFinder) {\n", " postFinder(null, results, matcherOut, xml);\n", " }\n", " else {\n", " push.apply(results, matcherOut);\n", " }\n", " }\n", " });\n", " }\n", " function matcherFromTokens(tokens) {\n", " var checkContext, matcher, j, len = tokens.length, leadingRelative = Expr.relative[tokens[0].type], implicitRelative = leadingRelative || Expr.relative[\" \"], i = leadingRelative ? 1 : 0, \n", " // The foundational matcher ensures that elements are reachable from top-level context(s)\n", " matchContext = addCombinator(function (elem) {\n", " return elem === checkContext;\n", " }, implicitRelative, true), matchAnyContext = addCombinator(function (elem) {\n", " return indexOf(checkContext, elem) > -1;\n", " }, implicitRelative, true), matchers = [function (elem, context, xml) {\n", " var ret = (!leadingRelative && (xml || context !== outermostContext)) || ((checkContext = context).nodeType ?\n", " matchContext(elem, context, xml) :\n", " matchAnyContext(elem, context, xml));\n", " // Avoid hanging onto element (issue #299)\n", " checkContext = null;\n", " return ret;\n", " }];\n", " for (; i < len; i++) {\n", " if ((matcher = Expr.relative[tokens[i].type])) {\n", " matchers = [addCombinator(elementMatcher(matchers), matcher)];\n", " }\n", " else {\n", " matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches);\n", " // Return special upon seeing a positional matcher\n", " if (matcher[expando]) {\n", " // Find the next relative operator (if any) for proper handling\n", " j = ++i;\n", " for (; j < len; j++) {\n", " if (Expr.relative[tokens[j].type]) {\n", " break;\n", " }\n", " }\n", " return setMatcher(i > 1 && elementMatcher(matchers), i > 1 && toSelector(\n", " // If the preceding token was a descendant combinator, insert an implicit any-element `*`\n", " tokens\n", " .slice(0, i - 1)\n", " .concat({ value: tokens[i - 2].type === \" \" ? \"*\" : \"\" })).replace(rtrim, \"$1\"), matcher, i < j && matcherFromTokens(tokens.slice(i, j)), j < len && matcherFromTokens((tokens = tokens.slice(j))), j < len && toSelector(tokens));\n", " }\n", " matchers.push(matcher);\n", " }\n", " }\n", " return elementMatcher(matchers);\n", " }\n", " function matcherFromGroupMatchers(elementMatchers, setMatchers) {\n", " var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function (seed, context, xml, results, outermost) {\n", " var elem, j, matcher, matchedCount = 0, i = \"0\", unmatched = seed && [], setMatched = [], contextBackup = outermostContext, \n", " // We must always have either seed elements or outermost context\n", " elems = seed || byElement && Expr.find[\"TAG\"](\"*\", outermost), \n", " // Use integer dirruns iff this is the outermost matcher\n", " dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), len = elems.length;\n", " if (outermost) {\n", " // Support: IE 11+, Edge 17 - 18+\n", " // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n", " // two documents; shallow comparisons work.\n", " // eslint-disable-next-line eqeqeq\n", " outermostContext = context == document || context || outermost;\n", " }\n", " // Add elements passing elementMatchers directly to results\n", " // Support: IE<9, Safari\n", " // Tolerate NodeList properties (IE: \"length\"; Safari: ) matching elements by id\n", " for (; i !== len && (elem = elems[i]) != null; i++) {\n", " if (byElement && elem) {\n", " j = 0;\n", " // Support: IE 11+, Edge 17 - 18+\n", " // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n", " // two documents; shallow comparisons work.\n", " // eslint-disable-next-line eqeqeq\n", " if (!context && elem.ownerDocument != document) {\n", " setDocument(elem);\n", " xml = !documentIsHTML;\n", " }\n", " while ((matcher = elementMatchers[j++])) {\n", " if (matcher(elem, context || document, xml)) {\n", " results.push(elem);\n", " break;\n", " }\n", " }\n", " if (outermost) {\n", " dirruns = dirrunsUnique;\n", " }\n", " }\n", " // Track unmatched elements for set filters\n", " if (bySet) {\n", " // They will have gone through all possible matchers\n", " if ((elem = !matcher && elem)) {\n", " matchedCount--;\n", " }\n", " // Lengthen the array for every element, matched or not\n", " if (seed) {\n", " unmatched.push(elem);\n", " }\n", " }\n", " }\n", " // `i` is now the count of elements visited above, and adding it to `matchedCount`\n", " // makes the latter nonnegative.\n", " matchedCount += i;\n", " // Apply set filters to unmatched elements\n", " // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`\n", " // equals `i`), unless we didn't visit _any_ elements in the above loop because we have\n", " // no element matchers and no seed.\n", " // Incrementing an initially-string \"0\" `i` allows `i` to remain a string only in that\n", " // case, which will result in a \"00\" `matchedCount` that differs from `i` but is also\n", " // numerically zero.\n", " if (bySet && i !== matchedCount) {\n", " j = 0;\n", " while ((matcher = setMatchers[j++])) {\n", " matcher(unmatched, setMatched, context, xml);\n", " }\n", " if (seed) {\n", " // Reintegrate element matches to eliminate the need for sorting\n", " if (matchedCount > 0) {\n", " while (i--) {\n", " if (!(unmatched[i] || setMatched[i])) {\n", " setMatched[i] = pop.call(results);\n", " }\n", " }\n", " }\n", " // Discard index placeholder values to get only actual matches\n", " setMatched = condense(setMatched);\n", " }\n", " // Add matches to results\n", " push.apply(results, setMatched);\n", " // Seedless set matches succeeding multiple successful matchers stipulate sorting\n", " if (outermost && !seed && setMatched.length > 0 &&\n", " (matchedCount + setMatchers.length) > 1) {\n", " Sizzle.uniqueSort(results);\n", " }\n", " }\n", " // Override manipulation of globals by nested matchers\n", " if (outermost) {\n", " dirruns = dirrunsUnique;\n", " outermostContext = contextBackup;\n", " }\n", " return unmatched;\n", " };\n", " return bySet ?\n", " markFunction(superMatcher) :\n", " superMatcher;\n", " }\n", " compile = Sizzle.compile = function (selector, match /* Internal Use Only */) {\n", " var i, setMatchers = [], elementMatchers = [], cached = compilerCache[selector + \" \"];\n", " if (!cached) {\n", " // Generate a function of recursive functions that can be used to check each element\n", " if (!match) {\n", " match = tokenize(selector);\n", " }\n", " i = match.length;\n", " while (i--) {\n", " cached = matcherFromTokens(match[i]);\n", " if (cached[expando]) {\n", " setMatchers.push(cached);\n", " }\n", " else {\n", " elementMatchers.push(cached);\n", " }\n", " }\n", " // Cache the compiled function\n", " cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers));\n", " // Save selector and tokenization\n", " cached.selector = selector;\n", " }\n", " return cached;\n", " };\n", " /**\n", " * A low-level selection function that works with Sizzle's compiled\n", " * selector functions\n", " * @param {String|Function} selector A selector or a pre-compiled\n", " * selector function built with Sizzle.compile\n", " * @param {Element} context\n", " * @param {Array} [results]\n", " * @param {Array} [seed] A set of elements to match against\n", " */\n", " select = Sizzle.select = function (selector, context, results, seed) {\n", " var i, tokens, token, type, find, compiled = typeof selector === \"function\" && selector, match = !seed && tokenize((selector = compiled.selector || selector));\n", " results = results || [];\n", " // Try to minimize operations if there is only one selector in the list and no seed\n", " // (the latter of which guarantees us context)\n", " if (match.length === 1) {\n", " // Reduce context if the leading compound selector is an ID\n", " tokens = match[0] = match[0].slice(0);\n", " if (tokens.length > 2 && (token = tokens[0]).type === \"ID\" &&\n", " context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {\n", " context = (Expr.find[\"ID\"](token.matches[0]\n", " .replace(runescape, funescape), context) || [])[0];\n", " if (!context) {\n", " return results;\n", " // Precompiled matchers will still verify ancestry, so step up a level\n", " }\n", " else if (compiled) {\n", " context = context.parentNode;\n", " }\n", " selector = selector.slice(tokens.shift().value.length);\n", " }\n", " // Fetch a seed set for right-to-left matching\n", " i = matchExpr[\"needsContext\"].test(selector) ? 0 : tokens.length;\n", " while (i--) {\n", " token = tokens[i];\n", " // Abort if we hit a combinator\n", " if (Expr.relative[(type = token.type)]) {\n", " break;\n", " }\n", " if ((find = Expr.find[type])) {\n", " // Search, expanding context for leading sibling combinators\n", " if ((seed = find(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testContext(context.parentNode) ||\n", " context))) {\n", " // If seed is empty or no tokens remain, we can return early\n", " tokens.splice(i, 1);\n", " selector = seed.length && toSelector(tokens);\n", " if (!selector) {\n", " push.apply(results, seed);\n", " return results;\n", " }\n", " break;\n", " }\n", " }\n", " }\n", " }\n", " // Compile and execute a filtering function if one is not provided\n", " // Provide `match` to avoid retokenization if we modified the selector above\n", " (compiled || compile(selector, match))(seed, context, !documentIsHTML, results, !context || rsibling.test(selector) && testContext(context.parentNode) || context);\n", " return results;\n", " };\n", " // One-time assignments\n", " // Sort stability\n", " support.sortStable = expando.split(\"\").sort(sortOrder).join(\"\") === expando;\n", " // Support: Chrome 14-35+\n", " // Always assume duplicates if they aren't passed to the comparison function\n", " support.detectDuplicates = !!hasDuplicate;\n", " // Initialize against the default document\n", " setDocument();\n", " // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)\n", " // Detached nodes confoundingly follow *each other*\n", " support.sortDetached = assert(function (el) {\n", " // Should return 1, but returns 4 (following)\n", " return el.compareDocumentPosition(document.createElement(\"fieldset\")) & 1;\n", " });\n", " // Support: IE<8\n", " // Prevent attribute/property \"interpolation\"\n", " // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx\n", " if (!assert(function (el) {\n", " el.innerHTML = \"\";\n", " return el.firstChild.getAttribute(\"href\") === \"#\";\n", " })) {\n", " addHandle(\"type|href|height|width\", function (elem, name, isXML) {\n", " if (!isXML) {\n", " return elem.getAttribute(name, name.toLowerCase() === \"type\" ? 1 : 2);\n", " }\n", " });\n", " }\n", " // Support: IE<9\n", " // Use defaultValue in place of getAttribute(\"value\")\n", " if (!support.attributes || !assert(function (el) {\n", " el.innerHTML = \"\";\n", " el.firstChild.setAttribute(\"value\", \"\");\n", " return el.firstChild.getAttribute(\"value\") === \"\";\n", " })) {\n", " addHandle(\"value\", function (elem, _name, isXML) {\n", " if (!isXML && elem.nodeName.toLowerCase() === \"input\") {\n", " return elem.defaultValue;\n", " }\n", " });\n", " }\n", " // Support: IE<9\n", " // Use getAttributeNode to fetch booleans when getAttribute lies\n", " if (!assert(function (el) {\n", " return el.getAttribute(\"disabled\") == null;\n", " })) {\n", " addHandle(booleans, function (elem, name, isXML) {\n", " var val;\n", " if (!isXML) {\n", " return elem[name] === true ? name.toLowerCase() :\n", " (val = elem.getAttributeNode(name)) && val.specified ?\n", " val.value :\n", " null;\n", " }\n", " });\n", " }\n", " return Sizzle;\n", " })(window);\n", " jQuery.find = Sizzle;\n", " jQuery.expr = Sizzle.selectors;\n", " // Deprecated\n", " jQuery.expr[\":\"] = jQuery.expr.pseudos;\n", " jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;\n", " jQuery.text = Sizzle.getText;\n", " jQuery.isXMLDoc = Sizzle.isXML;\n", " jQuery.contains = Sizzle.contains;\n", " jQuery.escapeSelector = Sizzle.escape;\n", " var dir = function (elem, dir, until) {\n", " var matched = [], truncate = until !== undefined;\n", " while ((elem = elem[dir]) && elem.nodeType !== 9) {\n", " if (elem.nodeType === 1) {\n", " if (truncate && jQuery(elem).is(until)) {\n", " break;\n", " }\n", " matched.push(elem);\n", " }\n", " }\n", " return matched;\n", " };\n", " var siblings = function (n, elem) {\n", " var matched = [];\n", " for (; n; n = n.nextSibling) {\n", " if (n.nodeType === 1 && n !== elem) {\n", " matched.push(n);\n", " }\n", " }\n", " return matched;\n", " };\n", " var rneedsContext = jQuery.expr.match.needsContext;\n", " function nodeName(elem, name) {\n", " return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();\n", " }\n", " ;\n", " var rsingleTag = (/^<([a-z][^\\/\\0>:\\x20\\t\\r\\n\\f]*)[\\x20\\t\\r\\n\\f]*\\/?>(?:<\\/\\1>|)$/i);\n", " // Implement the identical functionality for filter and not\n", " function winnow(elements, qualifier, not) {\n", " if (isFunction(qualifier)) {\n", " return jQuery.grep(elements, function (elem, i) {\n", " return !!qualifier.call(elem, i, elem) !== not;\n", " });\n", " }\n", " // Single element\n", " if (qualifier.nodeType) {\n", " return jQuery.grep(elements, function (elem) {\n", " return (elem === qualifier) !== not;\n", " });\n", " }\n", " // Arraylike of elements (jQuery, arguments, Array)\n", " if (typeof qualifier !== \"string\") {\n", " return jQuery.grep(elements, function (elem) {\n", " return (indexOf.call(qualifier, elem) > -1) !== not;\n", " });\n", " }\n", " // Filtered directly for both simple and complex selectors\n", " return jQuery.filter(qualifier, elements, not);\n", " }\n", " jQuery.filter = function (expr, elems, not) {\n", " var elem = elems[0];\n", " if (not) {\n", " expr = \":not(\" + expr + \")\";\n", " }\n", " if (elems.length === 1 && elem.nodeType === 1) {\n", " return jQuery.find.matchesSelector(elem, expr) ? [elem] : [];\n", " }\n", " return jQuery.find.matches(expr, jQuery.grep(elems, function (elem) {\n", " return elem.nodeType === 1;\n", " }));\n", " };\n", " jQuery.fn.extend({\n", " find: function (selector) {\n", " var i, ret, len = this.length, self = this;\n", " if (typeof selector !== \"string\") {\n", " return this.pushStack(jQuery(selector).filter(function () {\n", " for (i = 0; i < len; i++) {\n", " if (jQuery.contains(self[i], this)) {\n", " return true;\n", " }\n", " }\n", " }));\n", " }\n", " ret = this.pushStack([]);\n", " for (i = 0; i < len; i++) {\n", " jQuery.find(selector, self[i], ret);\n", " }\n", " return len > 1 ? jQuery.uniqueSort(ret) : ret;\n", " },\n", " filter: function (selector) {\n", " return this.pushStack(winnow(this, selector || [], false));\n", " },\n", " not: function (selector) {\n", " return this.pushStack(winnow(this, selector || [], true));\n", " },\n", " is: function (selector) {\n", " return !!winnow(this, \n", " // If this is a positional/relative selector, check membership in the returned set\n", " // so $(\"p:first\").is(\"p:last\") won't return true for a doc with two \"p\".\n", " typeof selector === \"string\" && rneedsContext.test(selector) ?\n", " jQuery(selector) :\n", " selector || [], false).length;\n", " }\n", " });\n", " // Initialize a jQuery object\n", " // A central reference to the root jQuery(document)\n", " var rootjQuery, \n", " // A simple way to check for HTML strings\n", " // Prioritize #id over to avoid XSS via location.hash (#9521)\n", " // Strict HTML recognition (#11290: must start with <)\n", " // Shortcut simple #id case for speed\n", " rquickExpr = /^(?:\\s*(<[\\w\\W]+>)[^>]*|#([\\w-]+))$/, init = jQuery.fn.init = function (selector, context, root) {\n", " var match, elem;\n", " // HANDLE: $(\"\"), $(null), $(undefined), $(false)\n", " if (!selector) {\n", " return this;\n", " }\n", " // Method init() accepts an alternate rootjQuery\n", " // so migrate can support jQuery.sub (gh-2101)\n", " root = root || rootjQuery;\n", " // Handle HTML strings\n", " if (typeof selector === \"string\") {\n", " if (selector[0] === \"<\" &&\n", " selector[selector.length - 1] === \">\" &&\n", " selector.length >= 3) {\n", " // Assume that strings that start and end with <> are HTML and skip the regex check\n", " match = [null, selector, null];\n", " }\n", " else {\n", " match = rquickExpr.exec(selector);\n", " }\n", " // Match html or make sure no context is specified for #id\n", " if (match && (match[1] || !context)) {\n", " // HANDLE: $(html) -> $(array)\n", " if (match[1]) {\n", " context = context instanceof jQuery ? context[0] : context;\n", " // Option to run scripts is true for back-compat\n", " // Intentionally let the error be thrown if parseHTML is not present\n", " jQuery.merge(this, jQuery.parseHTML(match[1], context && context.nodeType ? context.ownerDocument || context : document, true));\n", " // HANDLE: $(html, props)\n", " if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {\n", " for (match in context) {\n", " // Properties of context are called as methods if possible\n", " if (isFunction(this[match])) {\n", " this[match](context[match]);\n", " // ...and otherwise set as attributes\n", " }\n", " else {\n", " this.attr(match, context[match]);\n", " }\n", " }\n", " }\n", " return this;\n", " // HANDLE: $(#id)\n", " }\n", " else {\n", " elem = document.getElementById(match[2]);\n", " if (elem) {\n", " // Inject the element directly into the jQuery object\n", " this[0] = elem;\n", " this.length = 1;\n", " }\n", " return this;\n", " }\n", " // HANDLE: $(expr, $(...))\n", " }\n", " else if (!context || context.jquery) {\n", " return (context || root).find(selector);\n", " // HANDLE: $(expr, context)\n", " // (which is just equivalent to: $(context).find(expr)\n", " }\n", " else {\n", " return this.constructor(context).find(selector);\n", " }\n", " // HANDLE: $(DOMElement)\n", " }\n", " else if (selector.nodeType) {\n", " this[0] = selector;\n", " this.length = 1;\n", " return this;\n", " // HANDLE: $(function)\n", " // Shortcut for document ready\n", " }\n", " else if (isFunction(selector)) {\n", " return root.ready !== undefined ?\n", " root.ready(selector) :\n", " // Execute immediately if ready is not present\n", " selector(jQuery);\n", " }\n", " return jQuery.makeArray(selector, this);\n", " };\n", " // Give the init function the jQuery prototype for later instantiation\n", " init.prototype = jQuery.fn;\n", " // Initialize central reference\n", " rootjQuery = jQuery(document);\n", " var rparentsprev = /^(?:parents|prev(?:Until|All))/, \n", " // Methods guaranteed to produce a unique set when starting from a unique set\n", " guaranteedUnique = {\n", " children: true,\n", " contents: true,\n", " next: true,\n", " prev: true\n", " };\n", " jQuery.fn.extend({\n", " has: function (target) {\n", " var targets = jQuery(target, this), l = targets.length;\n", " return this.filter(function () {\n", " var i = 0;\n", " for (; i < l; i++) {\n", " if (jQuery.contains(this, targets[i])) {\n", " return true;\n", " }\n", " }\n", " });\n", " },\n", " closest: function (selectors, context) {\n", " var cur, i = 0, l = this.length, matched = [], targets = typeof selectors !== \"string\" && jQuery(selectors);\n", " // Positional selectors never match, since there's no _selection_ context\n", " if (!rneedsContext.test(selectors)) {\n", " for (; i < l; i++) {\n", " for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) {\n", " // Always skip document fragments\n", " if (cur.nodeType < 11 && (targets ?\n", " targets.index(cur) > -1 :\n", " // Don't pass non-elements to Sizzle\n", " cur.nodeType === 1 &&\n", " jQuery.find.matchesSelector(cur, selectors))) {\n", " matched.push(cur);\n", " break;\n", " }\n", " }\n", " }\n", " }\n", " return this.pushStack(matched.length > 1 ? jQuery.uniqueSort(matched) : matched);\n", " },\n", " // Determine the position of an element within the set\n", " index: function (elem) {\n", " // No argument, return index in parent\n", " if (!elem) {\n", " return (this[0] && this[0].parentNode) ? this.first().prevAll().length : -1;\n", " }\n", " // Index in selector\n", " if (typeof elem === \"string\") {\n", " return indexOf.call(jQuery(elem), this[0]);\n", " }\n", " // Locate the position of the desired element\n", " return indexOf.call(this, \n", " // If it receives a jQuery object, the first element is used\n", " elem.jquery ? elem[0] : elem);\n", " },\n", " add: function (selector, context) {\n", " return this.pushStack(jQuery.uniqueSort(jQuery.merge(this.get(), jQuery(selector, context))));\n", " },\n", " addBack: function (selector) {\n", " return this.add(selector == null ?\n", " this.prevObject : this.prevObject.filter(selector));\n", " }\n", " });\n", " function sibling(cur, dir) {\n", " while ((cur = cur[dir]) && cur.nodeType !== 1) { }\n", " return cur;\n", " }\n", " jQuery.each({\n", " parent: function (elem) {\n", " var parent = elem.parentNode;\n", " return parent && parent.nodeType !== 11 ? parent : null;\n", " },\n", " parents: function (elem) {\n", " return dir(elem, \"parentNode\");\n", " },\n", " parentsUntil: function (elem, _i, until) {\n", " return dir(elem, \"parentNode\", until);\n", " },\n", " next: function (elem) {\n", " return sibling(elem, \"nextSibling\");\n", " },\n", " prev: function (elem) {\n", " return sibling(elem, \"previousSibling\");\n", " },\n", " nextAll: function (elem) {\n", " return dir(elem, \"nextSibling\");\n", " },\n", " prevAll: function (elem) {\n", " return dir(elem, \"previousSibling\");\n", " },\n", " nextUntil: function (elem, _i, until) {\n", " return dir(elem, \"nextSibling\", until);\n", " },\n", " prevUntil: function (elem, _i, until) {\n", " return dir(elem, \"previousSibling\", until);\n", " },\n", " siblings: function (elem) {\n", " return siblings((elem.parentNode || {}).firstChild, elem);\n", " },\n", " children: function (elem) {\n", " return siblings(elem.firstChild);\n", " },\n", " contents: function (elem) {\n", " if (elem.contentDocument != null &&\n", " // Support: IE 11+\n", " // elements with no `data` attribute has an object\n", " // `contentDocument` with a `null` prototype.\n", " getProto(elem.contentDocument)) {\n", " return elem.contentDocument;\n", " }\n", " // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only\n", " // Treat the template element as a regular one in browsers that\n", " // don't support it.\n", " if (nodeName(elem, \"template\")) {\n", " elem = elem.content || elem;\n", " }\n", " return jQuery.merge([], elem.childNodes);\n", " }\n", " }, function (name, fn) {\n", " jQuery.fn[name] = function (until, selector) {\n", " var matched = jQuery.map(this, fn, until);\n", " if (name.slice(-5) !== \"Until\") {\n", " selector = until;\n", " }\n", " if (selector && typeof selector === \"string\") {\n", " matched = jQuery.filter(selector, matched);\n", " }\n", " if (this.length > 1) {\n", " // Remove duplicates\n", " if (!guaranteedUnique[name]) {\n", " jQuery.uniqueSort(matched);\n", " }\n", " // Reverse order for parents* and prev-derivatives\n", " if (rparentsprev.test(name)) {\n", " matched.reverse();\n", " }\n", " }\n", " return this.pushStack(matched);\n", " };\n", " });\n", " var rnothtmlwhite = (/[^\\x20\\t\\r\\n\\f]+/g);\n", " // Convert String-formatted options into Object-formatted ones\n", " function createOptions(options) {\n", " var object = {};\n", " jQuery.each(options.match(rnothtmlwhite) || [], function (_, flag) {\n", " object[flag] = true;\n", " });\n", " return object;\n", " }\n", " /*\n", " * Create a callback list using the following parameters:\n", " *\n", " *\toptions: an optional list of space-separated options that will change how\n", " *\t\t\tthe callback list behaves or a more traditional option object\n", " *\n", " * By default a callback list will act like an event callback list and can be\n", " * \"fired\" multiple times.\n", " *\n", " * Possible options:\n", " *\n", " *\tonce:\t\t\twill ensure the callback list can only be fired once (like a Deferred)\n", " *\n", " *\tmemory:\t\t\twill keep track of previous values and will call any callback added\n", " *\t\t\t\t\tafter the list has been fired right away with the latest \"memorized\"\n", " *\t\t\t\t\tvalues (like a Deferred)\n", " *\n", " *\tunique:\t\t\twill ensure a callback can only be added once (no duplicate in the list)\n", " *\n", " *\tstopOnFalse:\tinterrupt callings when a callback returns false\n", " *\n", " */\n", " jQuery.Callbacks = function (options) {\n", " // Convert options from String-formatted to Object-formatted if needed\n", " // (we check in cache first)\n", " options = typeof options === \"string\" ?\n", " createOptions(options) :\n", " jQuery.extend({}, options);\n", " var // Flag to know if list is currently firing\n", " firing, \n", " // Last fire value for non-forgettable lists\n", " memory, \n", " // Flag to know if list was already fired\n", " fired, \n", " // Flag to prevent firing\n", " locked, \n", " // Actual callback list\n", " list = [], \n", " // Queue of execution data for repeatable lists\n", " queue = [], \n", " // Index of currently firing callback (modified by add/remove as needed)\n", " firingIndex = -1, \n", " // Fire callbacks\n", " fire = function () {\n", " // Enforce single-firing\n", " locked = locked || options.once;\n", " // Execute callbacks for all pending executions,\n", " // respecting firingIndex overrides and runtime changes\n", " fired = firing = true;\n", " for (; queue.length; firingIndex = -1) {\n", " memory = queue.shift();\n", " while (++firingIndex < list.length) {\n", " // Run callback and check for early termination\n", " if (list[firingIndex].apply(memory[0], memory[1]) === false &&\n", " options.stopOnFalse) {\n", " // Jump to end and forget the data so .add doesn't re-fire\n", " firingIndex = list.length;\n", " memory = false;\n", " }\n", " }\n", " }\n", " // Forget the data if we're done with it\n", " if (!options.memory) {\n", " memory = false;\n", " }\n", " firing = false;\n", " // Clean up if we're done firing for good\n", " if (locked) {\n", " // Keep an empty list if we have data for future add calls\n", " if (memory) {\n", " list = [];\n", " // Otherwise, this object is spent\n", " }\n", " else {\n", " list = \"\";\n", " }\n", " }\n", " }, \n", " // Actual Callbacks object\n", " self = {\n", " // Add a callback or a collection of callbacks to the list\n", " add: function () {\n", " if (list) {\n", " // If we have memory from a past run, we should fire after adding\n", " if (memory && !firing) {\n", " firingIndex = list.length - 1;\n", " queue.push(memory);\n", " }\n", " (function add(args) {\n", " jQuery.each(args, function (_, arg) {\n", " if (isFunction(arg)) {\n", " if (!options.unique || !self.has(arg)) {\n", " list.push(arg);\n", " }\n", " }\n", " else if (arg && arg.length && toType(arg) !== \"string\") {\n", " // Inspect recursively\n", " add(arg);\n", " }\n", " });\n", " })(arguments);\n", " if (memory && !firing) {\n", " fire();\n", " }\n", " }\n", " return this;\n", " },\n", " // Remove a callback from the list\n", " remove: function () {\n", " jQuery.each(arguments, function (_, arg) {\n", " var index;\n", " while ((index = jQuery.inArray(arg, list, index)) > -1) {\n", " list.splice(index, 1);\n", " // Handle firing indexes\n", " if (index <= firingIndex) {\n", " firingIndex--;\n", " }\n", " }\n", " });\n", " return this;\n", " },\n", " // Check if a given callback is in the list.\n", " // If no argument is given, return whether or not list has callbacks attached.\n", " has: function (fn) {\n", " return fn ?\n", " jQuery.inArray(fn, list) > -1 :\n", " list.length > 0;\n", " },\n", " // Remove all callbacks from the list\n", " empty: function () {\n", " if (list) {\n", " list = [];\n", " }\n", " return this;\n", " },\n", " // Disable .fire and .add\n", " // Abort any current/pending executions\n", " // Clear all callbacks and values\n", " disable: function () {\n", " locked = queue = [];\n", " list = memory = \"\";\n", " return this;\n", " },\n", " disabled: function () {\n", " return !list;\n", " },\n", " // Disable .fire\n", " // Also disable .add unless we have memory (since it would have no effect)\n", " // Abort any pending executions\n", " lock: function () {\n", " locked = queue = [];\n", " if (!memory && !firing) {\n", " list = memory = \"\";\n", " }\n", " return this;\n", " },\n", " locked: function () {\n", " return !!locked;\n", " },\n", " // Call all callbacks with the given context and arguments\n", " fireWith: function (context, args) {\n", " if (!locked) {\n", " args = args || [];\n", " args = [context, args.slice ? args.slice() : args];\n", " queue.push(args);\n", " if (!firing) {\n", " fire();\n", " }\n", " }\n", " return this;\n", " },\n", " // Call all the callbacks with the given arguments\n", " fire: function () {\n", " self.fireWith(this, arguments);\n", " return this;\n", " },\n", " // To know if the callbacks have already been called at least once\n", " fired: function () {\n", " return !!fired;\n", " }\n", " };\n", " return self;\n", " };\n", " function Identity(v) {\n", " return v;\n", " }\n", " function Thrower(ex) {\n", " throw ex;\n", " }\n", " function adoptValue(value, resolve, reject, noValue) {\n", " var method;\n", " try {\n", " // Check for promise aspect first to privilege synchronous behavior\n", " if (value && isFunction((method = value.promise))) {\n", " method.call(value).done(resolve).fail(reject);\n", " // Other thenables\n", " }\n", " else if (value && isFunction((method = value.then))) {\n", " method.call(value, resolve, reject);\n", " // Other non-thenables\n", " }\n", " else {\n", " // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:\n", " // * false: [ value ].slice( 0 ) => resolve( value )\n", " // * true: [ value ].slice( 1 ) => resolve()\n", " resolve.apply(undefined, [value].slice(noValue));\n", " }\n", " // For Promises/A+, convert exceptions into rejections\n", " // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in\n", " // Deferred#then to conditionally suppress rejection.\n", " }\n", " catch (value) {\n", " // Support: Android 4.0 only\n", " // Strict mode functions invoked without .call/.apply get global-object context\n", " reject.apply(undefined, [value]);\n", " }\n", " }\n", " jQuery.extend({\n", " Deferred: function (func) {\n", " var tuples = [\n", " // action, add listener, callbacks,\n", " // ... .then handlers, argument index, [final state]\n", " [\"notify\", \"progress\", jQuery.Callbacks(\"memory\"),\n", " jQuery.Callbacks(\"memory\"), 2],\n", " [\"resolve\", \"done\", jQuery.Callbacks(\"once memory\"),\n", " jQuery.Callbacks(\"once memory\"), 0, \"resolved\"],\n", " [\"reject\", \"fail\", jQuery.Callbacks(\"once memory\"),\n", " jQuery.Callbacks(\"once memory\"), 1, \"rejected\"]\n", " ], state = \"pending\", promise = {\n", " state: function () {\n", " return state;\n", " },\n", " always: function () {\n", " deferred.done(arguments).fail(arguments);\n", " return this;\n", " },\n", " \"catch\": function (fn) {\n", " return promise.then(null, fn);\n", " },\n", " // Keep pipe for back-compat\n", " pipe: function ( /* fnDone, fnFail, fnProgress */) {\n", " var fns = arguments;\n", " return jQuery.Deferred(function (newDefer) {\n", " jQuery.each(tuples, function (_i, tuple) {\n", " // Map tuples (progress, done, fail) to arguments (done, fail, progress)\n", " var fn = isFunction(fns[tuple[4]]) && fns[tuple[4]];\n", " // deferred.progress(function() { bind to newDefer or newDefer.notify })\n", " // deferred.done(function() { bind to newDefer or newDefer.resolve })\n", " // deferred.fail(function() { bind to newDefer or newDefer.reject })\n", " deferred[tuple[1]](function () {\n", " var returned = fn && fn.apply(this, arguments);\n", " if (returned && isFunction(returned.promise)) {\n", " returned.promise()\n", " .progress(newDefer.notify)\n", " .done(newDefer.resolve)\n", " .fail(newDefer.reject);\n", " }\n", " else {\n", " newDefer[tuple[0] + \"With\"](this, fn ? [returned] : arguments);\n", " }\n", " });\n", " });\n", " fns = null;\n", " }).promise();\n", " },\n", " then: function (onFulfilled, onRejected, onProgress) {\n", " var maxDepth = 0;\n", " function resolve(depth, deferred, handler, special) {\n", " return function () {\n", " var that = this, args = arguments, mightThrow = function () {\n", " var returned, then;\n", " // Support: Promises/A+ section 2.3.3.3.3\n", " // https://promisesaplus.com/#point-59\n", " // Ignore double-resolution attempts\n", " if (depth < maxDepth) {\n", " return;\n", " }\n", " returned = handler.apply(that, args);\n", " // Support: Promises/A+ section 2.3.1\n", " // https://promisesaplus.com/#point-48\n", " if (returned === deferred.promise()) {\n", " throw new TypeError(\"Thenable self-resolution\");\n", " }\n", " // Support: Promises/A+ sections 2.3.3.1, 3.5\n", " // https://promisesaplus.com/#point-54\n", " // https://promisesaplus.com/#point-75\n", " // Retrieve `then` only once\n", " then = returned &&\n", " // Support: Promises/A+ section 2.3.4\n", " // https://promisesaplus.com/#point-64\n", " // Only check objects and functions for thenability\n", " (typeof returned === \"object\" ||\n", " typeof returned === \"function\") &&\n", " returned.then;\n", " // Handle a returned thenable\n", " if (isFunction(then)) {\n", " // Special processors (notify) just wait for resolution\n", " if (special) {\n", " then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special));\n", " // Normal processors (resolve) also hook into progress\n", " }\n", " else {\n", " // ...and disregard older resolution values\n", " maxDepth++;\n", " then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special), resolve(maxDepth, deferred, Identity, deferred.notifyWith));\n", " }\n", " // Handle all other returned values\n", " }\n", " else {\n", " // Only substitute handlers pass on context\n", " // and multiple values (non-spec behavior)\n", " if (handler !== Identity) {\n", " that = undefined;\n", " args = [returned];\n", " }\n", " // Process the value(s)\n", " // Default process is resolve\n", " (special || deferred.resolveWith)(that, args);\n", " }\n", " }, \n", " // Only normal processors (resolve) catch and reject exceptions\n", " process = special ?\n", " mightThrow :\n", " function () {\n", " try {\n", " mightThrow();\n", " }\n", " catch (e) {\n", " if (jQuery.Deferred.exceptionHook) {\n", " jQuery.Deferred.exceptionHook(e, process.stackTrace);\n", " }\n", " // Support: Promises/A+ section 2.3.3.3.4.1\n", " // https://promisesaplus.com/#point-61\n", " // Ignore post-resolution exceptions\n", " if (depth + 1 >= maxDepth) {\n", " // Only substitute handlers pass on context\n", " // and multiple values (non-spec behavior)\n", " if (handler !== Thrower) {\n", " that = undefined;\n", " args = [e];\n", " }\n", " deferred.rejectWith(that, args);\n", " }\n", " }\n", " };\n", " // Support: Promises/A+ section 2.3.3.3.1\n", " // https://promisesaplus.com/#point-57\n", " // Re-resolve promises immediately to dodge false rejection from\n", " // subsequent errors\n", " if (depth) {\n", " process();\n", " }\n", " else {\n", " // Call an optional hook to record the stack, in case of exception\n", " // since it's otherwise lost when execution goes async\n", " if (jQuery.Deferred.getStackHook) {\n", " process.stackTrace = jQuery.Deferred.getStackHook();\n", " }\n", " window.setTimeout(process);\n", " }\n", " };\n", " }\n", " return jQuery.Deferred(function (newDefer) {\n", " // progress_handlers.add( ... )\n", " tuples[0][3].add(resolve(0, newDefer, isFunction(onProgress) ?\n", " onProgress :\n", " Identity, newDefer.notifyWith));\n", " // fulfilled_handlers.add( ... )\n", " tuples[1][3].add(resolve(0, newDefer, isFunction(onFulfilled) ?\n", " onFulfilled :\n", " Identity));\n", " // rejected_handlers.add( ... )\n", " tuples[2][3].add(resolve(0, newDefer, isFunction(onRejected) ?\n", " onRejected :\n", " Thrower));\n", " }).promise();\n", " },\n", " // Get a promise for this deferred\n", " // If obj is provided, the promise aspect is added to the object\n", " promise: function (obj) {\n", " return obj != null ? jQuery.extend(obj, promise) : promise;\n", " }\n", " }, deferred = {};\n", " // Add list-specific methods\n", " jQuery.each(tuples, function (i, tuple) {\n", " var list = tuple[2], stateString = tuple[5];\n", " // promise.progress = list.add\n", " // promise.done = list.add\n", " // promise.fail = list.add\n", " promise[tuple[1]] = list.add;\n", " // Handle state\n", " if (stateString) {\n", " list.add(function () {\n", " // state = \"resolved\" (i.e., fulfilled)\n", " // state = \"rejected\"\n", " state = stateString;\n", " }, \n", " // rejected_callbacks.disable\n", " // fulfilled_callbacks.disable\n", " tuples[3 - i][2].disable, \n", " // rejected_handlers.disable\n", " // fulfilled_handlers.disable\n", " tuples[3 - i][3].disable, \n", " // progress_callbacks.lock\n", " tuples[0][2].lock, \n", " // progress_handlers.lock\n", " tuples[0][3].lock);\n", " }\n", " // progress_handlers.fire\n", " // fulfilled_handlers.fire\n", " // rejected_handlers.fire\n", " list.add(tuple[3].fire);\n", " // deferred.notify = function() { deferred.notifyWith(...) }\n", " // deferred.resolve = function() { deferred.resolveWith(...) }\n", " // deferred.reject = function() { deferred.rejectWith(...) }\n", " deferred[tuple[0]] = function () {\n", " deferred[tuple[0] + \"With\"](this === deferred ? undefined : this, arguments);\n", " return this;\n", " };\n", " // deferred.notifyWith = list.fireWith\n", " // deferred.resolveWith = list.fireWith\n", " // deferred.rejectWith = list.fireWith\n", " deferred[tuple[0] + \"With\"] = list.fireWith;\n", " });\n", " // Make the deferred a promise\n", " promise.promise(deferred);\n", " // Call given func if any\n", " if (func) {\n", " func.call(deferred, deferred);\n", " }\n", " // All done!\n", " return deferred;\n", " },\n", " // Deferred helper\n", " when: function (singleValue) {\n", " var \n", " // count of uncompleted subordinates\n", " remaining = arguments.length, \n", " // count of unprocessed arguments\n", " i = remaining, \n", " // subordinate fulfillment data\n", " resolveContexts = Array(i), resolveValues = slice.call(arguments), \n", " // the master Deferred\n", " master = jQuery.Deferred(), \n", " // subordinate callback factory\n", " updateFunc = function (i) {\n", " return function (value) {\n", " resolveContexts[i] = this;\n", " resolveValues[i] = arguments.length > 1 ? slice.call(arguments) : value;\n", " if (!(--remaining)) {\n", " master.resolveWith(resolveContexts, resolveValues);\n", " }\n", " };\n", " };\n", " // Single- and empty arguments are adopted like Promise.resolve\n", " if (remaining <= 1) {\n", " adoptValue(singleValue, master.done(updateFunc(i)).resolve, master.reject, !remaining);\n", " // Use .then() to unwrap secondary thenables (cf. gh-3000)\n", " if (master.state() === \"pending\" ||\n", " isFunction(resolveValues[i] && resolveValues[i].then)) {\n", " return master.then();\n", " }\n", " }\n", " // Multiple arguments are aggregated like Promise.all array elements\n", " while (i--) {\n", " adoptValue(resolveValues[i], updateFunc(i), master.reject);\n", " }\n", " return master.promise();\n", " }\n", " });\n", " // These usually indicate a programmer mistake during development,\n", " // warn about them ASAP rather than swallowing them by default.\n", " var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;\n", " jQuery.Deferred.exceptionHook = function (error, stack) {\n", " // Support: IE 8 - 9 only\n", " // Console exists when dev tools are open, which can happen at any time\n", " if (window.console && window.console.warn && error && rerrorNames.test(error.name)) {\n", " window.console.warn(\"jQuery.Deferred exception: \" + error.message, error.stack, stack);\n", " }\n", " };\n", " jQuery.readyException = function (error) {\n", " window.setTimeout(function () {\n", " throw error;\n", " });\n", " };\n", " // The deferred used on DOM ready\n", " var readyList = jQuery.Deferred();\n", " jQuery.fn.ready = function (fn) {\n", " readyList\n", " .then(fn)\n", " // Wrap jQuery.readyException in a function so that the lookup\n", " // happens at the time of error handling instead of callback\n", " // registration.\n", " .catch(function (error) {\n", " jQuery.readyException(error);\n", " });\n", " return this;\n", " };\n", " jQuery.extend({\n", " // Is the DOM ready to be used? Set to true once it occurs.\n", " isReady: false,\n", " // A counter to track how many items to wait for before\n", " // the ready event fires. See #6781\n", " readyWait: 1,\n", " // Handle when the DOM is ready\n", " ready: function (wait) {\n", " // Abort if there are pending holds or we're already ready\n", " if (wait === true ? --jQuery.readyWait : jQuery.isReady) {\n", " return;\n", " }\n", " // Remember that the DOM is ready\n", " jQuery.isReady = true;\n", " // If a normal DOM Ready event fired, decrement, and wait if need be\n", " if (wait !== true && --jQuery.readyWait > 0) {\n", " return;\n", " }\n", " // If there are functions bound, to execute\n", " readyList.resolveWith(document, [jQuery]);\n", " }\n", " });\n", " jQuery.ready.then = readyList.then;\n", " // The ready event handler and self cleanup method\n", " function completed() {\n", " document.removeEventListener(\"DOMContentLoaded\", completed);\n", " window.removeEventListener(\"load\", completed);\n", " jQuery.ready();\n", " }\n", " // Catch cases where $(document).ready() is called\n", " // after the browser event has already occurred.\n", " // Support: IE <=9 - 10 only\n", " // Older IE sometimes signals \"interactive\" too soon\n", " if (document.readyState === \"complete\" ||\n", " (document.readyState !== \"loading\" && !document.documentElement.doScroll)) {\n", " // Handle it asynchronously to allow scripts the opportunity to delay ready\n", " window.setTimeout(jQuery.ready);\n", " }\n", " else {\n", " // Use the handy event callback\n", " document.addEventListener(\"DOMContentLoaded\", completed);\n", " // A fallback to window.onload, that will always work\n", " window.addEventListener(\"load\", completed);\n", " }\n", " // Multifunctional method to get and set values of a collection\n", " // The value/s can optionally be executed if it's a function\n", " var access = function (elems, fn, key, value, chainable, emptyGet, raw) {\n", " var i = 0, len = elems.length, bulk = key == null;\n", " // Sets many values\n", " if (toType(key) === \"object\") {\n", " chainable = true;\n", " for (i in key) {\n", " access(elems, fn, i, key[i], true, emptyGet, raw);\n", " }\n", " // Sets one value\n", " }\n", " else if (value !== undefined) {\n", " chainable = true;\n", " if (!isFunction(value)) {\n", " raw = true;\n", " }\n", " if (bulk) {\n", " // Bulk operations run against the entire set\n", " if (raw) {\n", " fn.call(elems, value);\n", " fn = null;\n", " // ...except when executing function values\n", " }\n", " else {\n", " bulk = fn;\n", " fn = function (elem, _key, value) {\n", " return bulk.call(jQuery(elem), value);\n", " };\n", " }\n", " }\n", " if (fn) {\n", " for (; i < len; i++) {\n", " fn(elems[i], key, raw ?\n", " value :\n", " value.call(elems[i], i, fn(elems[i], key)));\n", " }\n", " }\n", " }\n", " if (chainable) {\n", " return elems;\n", " }\n", " // Gets\n", " if (bulk) {\n", " return fn.call(elems);\n", " }\n", " return len ? fn(elems[0], key) : emptyGet;\n", " };\n", " // Matches dashed string for camelizing\n", " var rmsPrefix = /^-ms-/, rdashAlpha = /-([a-z])/g;\n", " // Used by camelCase as callback to replace()\n", " function fcamelCase(_all, letter) {\n", " return letter.toUpperCase();\n", " }\n", " // Convert dashed to camelCase; used by the css and data modules\n", " // Support: IE <=9 - 11, Edge 12 - 15\n", " // Microsoft forgot to hump their vendor prefix (#9572)\n", " function camelCase(string) {\n", " return string.replace(rmsPrefix, \"ms-\").replace(rdashAlpha, fcamelCase);\n", " }\n", " var acceptData = function (owner) {\n", " // Accepts only:\n", " // - Node\n", " // - Node.ELEMENT_NODE\n", " // - Node.DOCUMENT_NODE\n", " // - Object\n", " // - Any\n", " return owner.nodeType === 1 || owner.nodeType === 9 || !(+owner.nodeType);\n", " };\n", " function Data() {\n", " this.expando = jQuery.expando + Data.uid++;\n", " }\n", " Data.uid = 1;\n", " Data.prototype = {\n", " cache: function (owner) {\n", " // Check if the owner object already has a cache\n", " var value = owner[this.expando];\n", " // If not, create one\n", " if (!value) {\n", " value = Object.create(null);\n", " // We can accept data for non-element nodes in modern browsers,\n", " // but we should not, see #8335.\n", " // Always return an empty object.\n", " if (acceptData(owner)) {\n", " // If it is a node unlikely to be stringify-ed or looped over\n", " // use plain assignment\n", " if (owner.nodeType) {\n", " owner[this.expando] = value;\n", " // Otherwise secure it in a non-enumerable property\n", " // configurable must be true to allow the property to be\n", " // deleted when data is removed\n", " }\n", " else {\n", " Object.defineProperty(owner, this.expando, {\n", " value: value,\n", " configurable: true\n", " });\n", " }\n", " }\n", " }\n", " return value;\n", " },\n", " set: function (owner, data, value) {\n", " var prop, cache = this.cache(owner);\n", " // Handle: [ owner, key, value ] args\n", " // Always use camelCase key (gh-2257)\n", " if (typeof data === \"string\") {\n", " cache[camelCase(data)] = value;\n", " // Handle: [ owner, { properties } ] args\n", " }\n", " else {\n", " // Copy the properties one-by-one to the cache object\n", " for (prop in data) {\n", " cache[camelCase(prop)] = data[prop];\n", " }\n", " }\n", " return cache;\n", " },\n", " get: function (owner, key) {\n", " return key === undefined ?\n", " this.cache(owner) :\n", " // Always use camelCase key (gh-2257)\n", " owner[this.expando] && owner[this.expando][camelCase(key)];\n", " },\n", " access: function (owner, key, value) {\n", " // In cases where either:\n", " //\n", " // 1. No key was specified\n", " // 2. A string key was specified, but no value provided\n", " //\n", " // Take the \"read\" path and allow the get method to determine\n", " // which value to return, respectively either:\n", " //\n", " // 1. The entire cache object\n", " // 2. The data stored at the key\n", " //\n", " if (key === undefined ||\n", " ((key && typeof key === \"string\") && value === undefined)) {\n", " return this.get(owner, key);\n", " }\n", " // When the key is not a string, or both a key and value\n", " // are specified, set or extend (existing objects) with either:\n", " //\n", " // 1. An object of properties\n", " // 2. A key and value\n", " //\n", " this.set(owner, key, value);\n", " // Since the \"set\" path can have two possible entry points\n", " // return the expected data based on which path was taken[*]\n", " return value !== undefined ? value : key;\n", " },\n", " remove: function (owner, key) {\n", " var i, cache = owner[this.expando];\n", " if (cache === undefined) {\n", " return;\n", " }\n", " if (key !== undefined) {\n", " // Support array or space separated string of keys\n", " if (Array.isArray(key)) {\n", " // If key is an array of keys...\n", " // We always set camelCase keys, so remove that.\n", " key = key.map(camelCase);\n", " }\n", " else {\n", " key = camelCase(key);\n", " // If a key with the spaces exists, use it.\n", " // Otherwise, create an array by matching non-whitespace\n", " key = key in cache ?\n", " [key] :\n", " (key.match(rnothtmlwhite) || []);\n", " }\n", " i = key.length;\n", " while (i--) {\n", " delete cache[key[i]];\n", " }\n", " }\n", " // Remove the expando if there's no more data\n", " if (key === undefined || jQuery.isEmptyObject(cache)) {\n", " // Support: Chrome <=35 - 45\n", " // Webkit & Blink performance suffers when deleting properties\n", " // from DOM nodes, so set to undefined instead\n", " // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)\n", " if (owner.nodeType) {\n", " owner[this.expando] = undefined;\n", " }\n", " else {\n", " delete owner[this.expando];\n", " }\n", " }\n", " },\n", " hasData: function (owner) {\n", " var cache = owner[this.expando];\n", " return cache !== undefined && !jQuery.isEmptyObject(cache);\n", " }\n", " };\n", " var dataPriv = new Data();\n", " var dataUser = new Data();\n", " //\tImplementation Summary\n", " //\n", " //\t1. Enforce API surface and semantic compatibility with 1.9.x branch\n", " //\t2. Improve the module's maintainability by reducing the storage\n", " //\t\tpaths to a single mechanism.\n", " //\t3. Use the same single mechanism to support \"private\" and \"user\" data.\n", " //\t4. _Never_ expose \"private\" data to user code (TODO: Drop _data, _removeData)\n", " //\t5. Avoid exposing implementation details on user objects (eg. expando properties)\n", " //\t6. Provide a clear path for implementation upgrade to WeakMap in 2014\n", " var rbrace = /^(?:\\{[\\w\\W]*\\}|\\[[\\w\\W]*\\])$/, rmultiDash = /[A-Z]/g;\n", " function getData(data) {\n", " if (data === \"true\") {\n", " return true;\n", " }\n", " if (data === \"false\") {\n", " return false;\n", " }\n", " if (data === \"null\") {\n", " return null;\n", " }\n", " // Only convert to a number if it doesn't change the string\n", " if (data === +data + \"\") {\n", " return +data;\n", " }\n", " if (rbrace.test(data)) {\n", " return JSON.parse(data);\n", " }\n", " return data;\n", " }\n", " function dataAttr(elem, key, data) {\n", " var name;\n", " // If nothing was found internally, try to fetch any\n", " // data from the HTML5 data-* attribute\n", " if (data === undefined && elem.nodeType === 1) {\n", " name = \"data-\" + key.replace(rmultiDash, \"-$&\").toLowerCase();\n", " data = elem.getAttribute(name);\n", " if (typeof data === \"string\") {\n", " try {\n", " data = getData(data);\n", " }\n", " catch (e) { }\n", " // Make sure we set the data so it isn't changed later\n", " dataUser.set(elem, key, data);\n", " }\n", " else {\n", " data = undefined;\n", " }\n", " }\n", " return data;\n", " }\n", " jQuery.extend({\n", " hasData: function (elem) {\n", " return dataUser.hasData(elem) || dataPriv.hasData(elem);\n", " },\n", " data: function (elem, name, data) {\n", " return dataUser.access(elem, name, data);\n", " },\n", " removeData: function (elem, name) {\n", " dataUser.remove(elem, name);\n", " },\n", " // TODO: Now that all calls to _data and _removeData have been replaced\n", " // with direct calls to dataPriv methods, these can be deprecated.\n", " _data: function (elem, name, data) {\n", " return dataPriv.access(elem, name, data);\n", " },\n", " _removeData: function (elem, name) {\n", " dataPriv.remove(elem, name);\n", " }\n", " });\n", " jQuery.fn.extend({\n", " data: function (key, value) {\n", " var i, name, data, elem = this[0], attrs = elem && elem.attributes;\n", " // Gets all values\n", " if (key === undefined) {\n", " if (this.length) {\n", " data = dataUser.get(elem);\n", " if (elem.nodeType === 1 && !dataPriv.get(elem, \"hasDataAttrs\")) {\n", " i = attrs.length;\n", " while (i--) {\n", " // Support: IE 11 only\n", " // The attrs elements can be null (#14894)\n", " if (attrs[i]) {\n", " name = attrs[i].name;\n", " if (name.indexOf(\"data-\") === 0) {\n", " name = camelCase(name.slice(5));\n", " dataAttr(elem, name, data[name]);\n", " }\n", " }\n", " }\n", " dataPriv.set(elem, \"hasDataAttrs\", true);\n", " }\n", " }\n", " return data;\n", " }\n", " // Sets multiple values\n", " if (typeof key === \"object\") {\n", " return this.each(function () {\n", " dataUser.set(this, key);\n", " });\n", " }\n", " return access(this, function (value) {\n", " var data;\n", " // The calling jQuery object (element matches) is not empty\n", " // (and therefore has an element appears at this[ 0 ]) and the\n", " // `value` parameter was not undefined. An empty jQuery object\n", " // will result in `undefined` for elem = this[ 0 ] which will\n", " // throw an exception if an attempt to read a data cache is made.\n", " if (elem && value === undefined) {\n", " // Attempt to get data from the cache\n", " // The key will always be camelCased in Data\n", " data = dataUser.get(elem, key);\n", " if (data !== undefined) {\n", " return data;\n", " }\n", " // Attempt to \"discover\" the data in\n", " // HTML5 custom data-* attrs\n", " data = dataAttr(elem, key);\n", " if (data !== undefined) {\n", " return data;\n", " }\n", " // We tried really hard, but the data doesn't exist.\n", " return;\n", " }\n", " // Set the data...\n", " this.each(function () {\n", " // We always store the camelCased key\n", " dataUser.set(this, key, value);\n", " });\n", " }, null, value, arguments.length > 1, null, true);\n", " },\n", " removeData: function (key) {\n", " return this.each(function () {\n", " dataUser.remove(this, key);\n", " });\n", " }\n", " });\n", " jQuery.extend({\n", " queue: function (elem, type, data) {\n", " var queue;\n", " if (elem) {\n", " type = (type || \"fx\") + \"queue\";\n", " queue = dataPriv.get(elem, type);\n", " // Speed up dequeue by getting out quickly if this is just a lookup\n", " if (data) {\n", " if (!queue || Array.isArray(data)) {\n", " queue = dataPriv.access(elem, type, jQuery.makeArray(data));\n", " }\n", " else {\n", " queue.push(data);\n", " }\n", " }\n", " return queue || [];\n", " }\n", " },\n", " dequeue: function (elem, type) {\n", " type = type || \"fx\";\n", " var queue = jQuery.queue(elem, type), startLength = queue.length, fn = queue.shift(), hooks = jQuery._queueHooks(elem, type), next = function () {\n", " jQuery.dequeue(elem, type);\n", " };\n", " // If the fx queue is dequeued, always remove the progress sentinel\n", " if (fn === \"inprogress\") {\n", " fn = queue.shift();\n", " startLength--;\n", " }\n", " if (fn) {\n", " // Add a progress sentinel to prevent the fx queue from being\n", " // automatically dequeued\n", " if (type === \"fx\") {\n", " queue.unshift(\"inprogress\");\n", " }\n", " // Clear up the last queue stop function\n", " delete hooks.stop;\n", " fn.call(elem, next, hooks);\n", " }\n", " if (!startLength && hooks) {\n", " hooks.empty.fire();\n", " }\n", " },\n", " // Not public - generate a queueHooks object, or return the current one\n", " _queueHooks: function (elem, type) {\n", " var key = type + \"queueHooks\";\n", " return dataPriv.get(elem, key) || dataPriv.access(elem, key, {\n", " empty: jQuery.Callbacks(\"once memory\").add(function () {\n", " dataPriv.remove(elem, [type + \"queue\", key]);\n", " })\n", " });\n", " }\n", " });\n", " jQuery.fn.extend({\n", " queue: function (type, data) {\n", " var setter = 2;\n", " if (typeof type !== \"string\") {\n", " data = type;\n", " type = \"fx\";\n", " setter--;\n", " }\n", " if (arguments.length < setter) {\n", " return jQuery.queue(this[0], type);\n", " }\n", " return data === undefined ?\n", " this :\n", " this.each(function () {\n", " var queue = jQuery.queue(this, type, data);\n", " // Ensure a hooks for this queue\n", " jQuery._queueHooks(this, type);\n", " if (type === \"fx\" && queue[0] !== \"inprogress\") {\n", " jQuery.dequeue(this, type);\n", " }\n", " });\n", " },\n", " dequeue: function (type) {\n", " return this.each(function () {\n", " jQuery.dequeue(this, type);\n", " });\n", " },\n", " clearQueue: function (type) {\n", " return this.queue(type || \"fx\", []);\n", " },\n", " // Get a promise resolved when queues of a certain type\n", " // are emptied (fx is the type by default)\n", " promise: function (type, obj) {\n", " var tmp, count = 1, defer = jQuery.Deferred(), elements = this, i = this.length, resolve = function () {\n", " if (!(--count)) {\n", " defer.resolveWith(elements, [elements]);\n", " }\n", " };\n", " if (typeof type !== \"string\") {\n", " obj = type;\n", " type = undefined;\n", " }\n", " type = type || \"fx\";\n", " while (i--) {\n", " tmp = dataPriv.get(elements[i], type + \"queueHooks\");\n", " if (tmp && tmp.empty) {\n", " count++;\n", " tmp.empty.add(resolve);\n", " }\n", " }\n", " resolve();\n", " return defer.promise(obj);\n", " }\n", " });\n", " var pnum = (/[+-]?(?:\\d*\\.|)\\d+(?:[eE][+-]?\\d+|)/).source;\n", " var rcssNum = new RegExp(\"^(?:([+-])=|)(\" + pnum + \")([a-z%]*)$\", \"i\");\n", " var cssExpand = [\"Top\", \"Right\", \"Bottom\", \"Left\"];\n", " var documentElement = document.documentElement;\n", " var isAttached = function (elem) {\n", " return jQuery.contains(elem.ownerDocument, elem);\n", " }, composed = { composed: true };\n", " // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only\n", " // Check attachment across shadow DOM boundaries when possible (gh-3504)\n", " // Support: iOS 10.0-10.2 only\n", " // Early iOS 10 versions support `attachShadow` but not `getRootNode`,\n", " // leading to errors. We need to check for `getRootNode`.\n", " if (documentElement.getRootNode) {\n", " isAttached = function (elem) {\n", " return jQuery.contains(elem.ownerDocument, elem) ||\n", " elem.getRootNode(composed) === elem.ownerDocument;\n", " };\n", " }\n", " var isHiddenWithinTree = function (elem, el) {\n", " // isHiddenWithinTree might be called from jQuery#filter function;\n", " // in that case, element will be second argument\n", " elem = el || elem;\n", " // Inline style trumps all\n", " return elem.style.display === \"none\" ||\n", " elem.style.display === \"\" &&\n", " // Otherwise, check computed style\n", " // Support: Firefox <=43 - 45\n", " // Disconnected elements can have computed display: none, so first confirm that elem is\n", " // in the document.\n", " isAttached(elem) &&\n", " jQuery.css(elem, \"display\") === \"none\";\n", " };\n", " function adjustCSS(elem, prop, valueParts, tween) {\n", " var adjusted, scale, maxIterations = 20, currentValue = tween ?\n", " function () {\n", " return tween.cur();\n", " } :\n", " function () {\n", " return jQuery.css(elem, prop, \"\");\n", " }, initial = currentValue(), unit = valueParts && valueParts[3] || (jQuery.cssNumber[prop] ? \"\" : \"px\"), \n", " // Starting value computation is required for potential unit mismatches\n", " initialInUnit = elem.nodeType &&\n", " (jQuery.cssNumber[prop] || unit !== \"px\" && +initial) &&\n", " rcssNum.exec(jQuery.css(elem, prop));\n", " if (initialInUnit && initialInUnit[3] !== unit) {\n", " // Support: Firefox <=54\n", " // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)\n", " initial = initial / 2;\n", " // Trust units reported by jQuery.css\n", " unit = unit || initialInUnit[3];\n", " // Iteratively approximate from a nonzero starting point\n", " initialInUnit = +initial || 1;\n", " while (maxIterations--) {\n", " // Evaluate and update our best guess (doubling guesses that zero out).\n", " // Finish if the scale equals or crosses 1 (making the old*new product non-positive).\n", " jQuery.style(elem, prop, initialInUnit + unit);\n", " if ((1 - scale) * (1 - (scale = currentValue() / initial || 0.5)) <= 0) {\n", " maxIterations = 0;\n", " }\n", " initialInUnit = initialInUnit / scale;\n", " }\n", " initialInUnit = initialInUnit * 2;\n", " jQuery.style(elem, prop, initialInUnit + unit);\n", " // Make sure we update the tween properties later on\n", " valueParts = valueParts || [];\n", " }\n", " if (valueParts) {\n", " initialInUnit = +initialInUnit || +initial || 0;\n", " // Apply relative offset (+=/-=) if specified\n", " adjusted = valueParts[1] ?\n", " initialInUnit + (valueParts[1] + 1) * valueParts[2] :\n", " +valueParts[2];\n", " if (tween) {\n", " tween.unit = unit;\n", " tween.start = initialInUnit;\n", " tween.end = adjusted;\n", " }\n", " }\n", " return adjusted;\n", " }\n", " var defaultDisplayMap = {};\n", " function getDefaultDisplay(elem) {\n", " var temp, doc = elem.ownerDocument, nodeName = elem.nodeName, display = defaultDisplayMap[nodeName];\n", " if (display) {\n", " return display;\n", " }\n", " temp = doc.body.appendChild(doc.createElement(nodeName));\n", " display = jQuery.css(temp, \"display\");\n", " temp.parentNode.removeChild(temp);\n", " if (display === \"none\") {\n", " display = \"block\";\n", " }\n", " defaultDisplayMap[nodeName] = display;\n", " return display;\n", " }\n", " function showHide(elements, show) {\n", " var display, elem, values = [], index = 0, length = elements.length;\n", " // Determine new display value for elements that need to change\n", " for (; index < length; index++) {\n", " elem = elements[index];\n", " if (!elem.style) {\n", " continue;\n", " }\n", " display = elem.style.display;\n", " if (show) {\n", " // Since we force visibility upon cascade-hidden elements, an immediate (and slow)\n", " // check is required in this first loop unless we have a nonempty display value (either\n", " // inline or about-to-be-restored)\n", " if (display === \"none\") {\n", " values[index] = dataPriv.get(elem, \"display\") || null;\n", " if (!values[index]) {\n", " elem.style.display = \"\";\n", " }\n", " }\n", " if (elem.style.display === \"\" && isHiddenWithinTree(elem)) {\n", " values[index] = getDefaultDisplay(elem);\n", " }\n", " }\n", " else {\n", " if (display !== \"none\") {\n", " values[index] = \"none\";\n", " // Remember what we're overwriting\n", " dataPriv.set(elem, \"display\", display);\n", " }\n", " }\n", " }\n", " // Set the display of the elements in a second loop to avoid constant reflow\n", " for (index = 0; index < length; index++) {\n", " if (values[index] != null) {\n", " elements[index].style.display = values[index];\n", " }\n", " }\n", " return elements;\n", " }\n", " jQuery.fn.extend({\n", " show: function () {\n", " return showHide(this, true);\n", " },\n", " hide: function () {\n", " return showHide(this);\n", " },\n", " toggle: function (state) {\n", " if (typeof state === \"boolean\") {\n", " return state ? this.show() : this.hide();\n", " }\n", " return this.each(function () {\n", " if (isHiddenWithinTree(this)) {\n", " jQuery(this).show();\n", " }\n", " else {\n", " jQuery(this).hide();\n", " }\n", " });\n", " }\n", " });\n", " var rcheckableType = (/^(?:checkbox|radio)$/i);\n", " var rtagName = (/<([a-z][^\\/\\0>\\x20\\t\\r\\n\\f]*)/i);\n", " var rscriptType = (/^$|^module$|\\/(?:java|ecma)script/i);\n", " (function () {\n", " var fragment = document.createDocumentFragment(), div = fragment.appendChild(document.createElement(\"div\")), input = document.createElement(\"input\");\n", " // Support: Android 4.0 - 4.3 only\n", " // Check state lost if the name is set (#11217)\n", " // Support: Windows Web Apps (WWA)\n", " // `name` and `type` must use .setAttribute for WWA (#14901)\n", " input.setAttribute(\"type\", \"radio\");\n", " input.setAttribute(\"checked\", \"checked\");\n", " input.setAttribute(\"name\", \"t\");\n", " div.appendChild(input);\n", " // Support: Android <=4.1 only\n", " // Older WebKit doesn't clone checked state correctly in fragments\n", " support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;\n", " // Support: IE <=11 only\n", " // Make sure textarea (and checkbox) defaultValue is properly cloned\n", " div.innerHTML = \"\";\n", " support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;\n", " // Support: IE <=9 only\n", " // IE <=9 replaces \";\n", " support.option = !!div.lastChild;\n", " })();\n", " // We have to close these tags to support XHTML (#13200)\n", " var wrapMap = {\n", " // XHTML parsers do not magically insert elements in the\n", " // same way that tag soup parsers do. So we cannot shorten\n", " // this by omitting or other required elements.\n", " thead: [1, \"\", \"
\"],\n", " col: [2, \"\", \"
\"],\n", " tr: [2, \"\", \"
\"],\n", " td: [3, \"\", \"
\"],\n", " _default: [0, \"\", \"\"]\n", " };\n", " wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;\n", " wrapMap.th = wrapMap.td;\n", " // Support: IE <=9 only\n", " if (!support.option) {\n", " wrapMap.optgroup = wrapMap.option = [1, \"\"];\n", " }\n", " function getAll(context, tag) {\n", " // Support: IE <=9 - 11 only\n", " // Use typeof to avoid zero-argument method invocation on host objects (#15151)\n", " var ret;\n", " if (typeof context.getElementsByTagName !== \"undefined\") {\n", " ret = context.getElementsByTagName(tag || \"*\");\n", " }\n", " else if (typeof context.querySelectorAll !== \"undefined\") {\n", " ret = context.querySelectorAll(tag || \"*\");\n", " }\n", " else {\n", " ret = [];\n", " }\n", " if (tag === undefined || tag && nodeName(context, tag)) {\n", " return jQuery.merge([context], ret);\n", " }\n", " return ret;\n", " }\n", " // Mark scripts as having already been evaluated\n", " function setGlobalEval(elems, refElements) {\n", " var i = 0, l = elems.length;\n", " for (; i < l; i++) {\n", " dataPriv.set(elems[i], \"globalEval\", !refElements || dataPriv.get(refElements[i], \"globalEval\"));\n", " }\n", " }\n", " var rhtml = /<|&#?\\w+;/;\n", " function buildFragment(elems, context, scripts, selection, ignored) {\n", " var elem, tmp, tag, wrap, attached, j, fragment = context.createDocumentFragment(), nodes = [], i = 0, l = elems.length;\n", " for (; i < l; i++) {\n", " elem = elems[i];\n", " if (elem || elem === 0) {\n", " // Add nodes directly\n", " if (toType(elem) === \"object\") {\n", " // Support: Android <=4.0 only, PhantomJS 1 only\n", " // push.apply(_, arraylike) throws on ancient WebKit\n", " jQuery.merge(nodes, elem.nodeType ? [elem] : elem);\n", " // Convert non-html into a text node\n", " }\n", " else if (!rhtml.test(elem)) {\n", " nodes.push(context.createTextNode(elem));\n", " // Convert html into DOM nodes\n", " }\n", " else {\n", " tmp = tmp || fragment.appendChild(context.createElement(\"div\"));\n", " // Deserialize a standard representation\n", " tag = (rtagName.exec(elem) || [\"\", \"\"])[1].toLowerCase();\n", " wrap = wrapMap[tag] || wrapMap._default;\n", " tmp.innerHTML = wrap[1] + jQuery.htmlPrefilter(elem) + wrap[2];\n", " // Descend through wrappers to the right content\n", " j = wrap[0];\n", " while (j--) {\n", " tmp = tmp.lastChild;\n", " }\n", " // Support: Android <=4.0 only, PhantomJS 1 only\n", " // push.apply(_, arraylike) throws on ancient WebKit\n", " jQuery.merge(nodes, tmp.childNodes);\n", " // Remember the top-level container\n", " tmp = fragment.firstChild;\n", " // Ensure the created nodes are orphaned (#12392)\n", " tmp.textContent = \"\";\n", " }\n", " }\n", " }\n", " // Remove wrapper from fragment\n", " fragment.textContent = \"\";\n", " i = 0;\n", " while ((elem = nodes[i++])) {\n", " // Skip elements already in the context collection (trac-4087)\n", " if (selection && jQuery.inArray(elem, selection) > -1) {\n", " if (ignored) {\n", " ignored.push(elem);\n", " }\n", " continue;\n", " }\n", " attached = isAttached(elem);\n", " // Append to fragment\n", " tmp = getAll(fragment.appendChild(elem), \"script\");\n", " // Preserve script evaluation history\n", " if (attached) {\n", " setGlobalEval(tmp);\n", " }\n", " // Capture executables\n", " if (scripts) {\n", " j = 0;\n", " while ((elem = tmp[j++])) {\n", " if (rscriptType.test(elem.type || \"\")) {\n", " scripts.push(elem);\n", " }\n", " }\n", " }\n", " }\n", " return fragment;\n", " }\n", " var rkeyEvent = /^key/, rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, rtypenamespace = /^([^.]*)(?:\\.(.+)|)/;\n", " function returnTrue() {\n", " return true;\n", " }\n", " function returnFalse() {\n", " return false;\n", " }\n", " // Support: IE <=9 - 11+\n", " // focus() and blur() are asynchronous, except when they are no-op.\n", " // So expect focus to be synchronous when the element is already active,\n", " // and blur to be synchronous when the element is not already active.\n", " // (focus and blur are always synchronous in other supported browsers,\n", " // this just defines when we can count on it).\n", " function expectSync(elem, type) {\n", " return (elem === safeActiveElement()) === (type === \"focus\");\n", " }\n", " // Support: IE <=9 only\n", " // Accessing document.activeElement can throw unexpectedly\n", " // https://bugs.jquery.com/ticket/13393\n", " function safeActiveElement() {\n", " try {\n", " return document.activeElement;\n", " }\n", " catch (err) { }\n", " }\n", " function on(elem, types, selector, data, fn, one) {\n", " var origFn, type;\n", " // Types can be a map of types/handlers\n", " if (typeof types === \"object\") {\n", " // ( types-Object, selector, data )\n", " if (typeof selector !== \"string\") {\n", " // ( types-Object, data )\n", " data = data || selector;\n", " selector = undefined;\n", " }\n", " for (type in types) {\n", " on(elem, type, selector, data, types[type], one);\n", " }\n", " return elem;\n", " }\n", " if (data == null && fn == null) {\n", " // ( types, fn )\n", " fn = selector;\n", " data = selector = undefined;\n", " }\n", " else if (fn == null) {\n", " if (typeof selector === \"string\") {\n", " // ( types, selector, fn )\n", " fn = data;\n", " data = undefined;\n", " }\n", " else {\n", " // ( types, data, fn )\n", " fn = data;\n", " data = selector;\n", " selector = undefined;\n", " }\n", " }\n", " if (fn === false) {\n", " fn = returnFalse;\n", " }\n", " else if (!fn) {\n", " return elem;\n", " }\n", " if (one === 1) {\n", " origFn = fn;\n", " fn = function (event) {\n", " // Can use an empty set, since event contains the info\n", " jQuery().off(event);\n", " return origFn.apply(this, arguments);\n", " };\n", " // Use same guid so caller can remove using origFn\n", " fn.guid = origFn.guid || (origFn.guid = jQuery.guid++);\n", " }\n", " return elem.each(function () {\n", " jQuery.event.add(this, types, fn, data, selector);\n", " });\n", " }\n", " /*\n", " * Helper functions for managing events -- not part of the public interface.\n", " * Props to Dean Edwards' addEvent library for many of the ideas.\n", " */\n", " jQuery.event = {\n", " global: {},\n", " add: function (elem, types, handler, data, selector) {\n", " var handleObjIn, eventHandle, tmp, events, t, handleObj, special, handlers, type, namespaces, origType, elemData = dataPriv.get(elem);\n", " // Only attach events to objects that accept data\n", " if (!acceptData(elem)) {\n", " return;\n", " }\n", " // Caller can pass in an object of custom data in lieu of the handler\n", " if (handler.handler) {\n", " handleObjIn = handler;\n", " handler = handleObjIn.handler;\n", " selector = handleObjIn.selector;\n", " }\n", " // Ensure that invalid selectors throw exceptions at attach time\n", " // Evaluate against documentElement in case elem is a non-element node (e.g., document)\n", " if (selector) {\n", " jQuery.find.matchesSelector(documentElement, selector);\n", " }\n", " // Make sure that the handler has a unique ID, used to find/remove it later\n", " if (!handler.guid) {\n", " handler.guid = jQuery.guid++;\n", " }\n", " // Init the element's event structure and main handler, if this is the first\n", " if (!(events = elemData.events)) {\n", " events = elemData.events = Object.create(null);\n", " }\n", " if (!(eventHandle = elemData.handle)) {\n", " eventHandle = elemData.handle = function (e) {\n", " // Discard the second event of a jQuery.event.trigger() and\n", " // when an event is called after a page has unloaded\n", " return typeof jQuery !== \"undefined\" && jQuery.event.triggered !== e.type ?\n", " jQuery.event.dispatch.apply(elem, arguments) : undefined;\n", " };\n", " }\n", " // Handle multiple events separated by a space\n", " types = (types || \"\").match(rnothtmlwhite) || [\"\"];\n", " t = types.length;\n", " while (t--) {\n", " tmp = rtypenamespace.exec(types[t]) || [];\n", " type = origType = tmp[1];\n", " namespaces = (tmp[2] || \"\").split(\".\").sort();\n", " // There *must* be a type, no attaching namespace-only handlers\n", " if (!type) {\n", " continue;\n", " }\n", " // If event changes its type, use the special event handlers for the changed type\n", " special = jQuery.event.special[type] || {};\n", " // If selector defined, determine special event api type, otherwise given type\n", " type = (selector ? special.delegateType : special.bindType) || type;\n", " // Update special based on newly reset type\n", " special = jQuery.event.special[type] || {};\n", " // handleObj is passed to all event handlers\n", " handleObj = jQuery.extend({\n", " type: type,\n", " origType: origType,\n", " data: data,\n", " handler: handler,\n", " guid: handler.guid,\n", " selector: selector,\n", " needsContext: selector && jQuery.expr.match.needsContext.test(selector),\n", " namespace: namespaces.join(\".\")\n", " }, handleObjIn);\n", " // Init the event handler queue if we're the first\n", " if (!(handlers = events[type])) {\n", " handlers = events[type] = [];\n", " handlers.delegateCount = 0;\n", " // Only use addEventListener if the special events handler returns false\n", " if (!special.setup ||\n", " special.setup.call(elem, data, namespaces, eventHandle) === false) {\n", " if (elem.addEventListener) {\n", " elem.addEventListener(type, eventHandle);\n", " }\n", " }\n", " }\n", " if (special.add) {\n", " special.add.call(elem, handleObj);\n", " if (!handleObj.handler.guid) {\n", " handleObj.handler.guid = handler.guid;\n", " }\n", " }\n", " // Add to the element's handler list, delegates in front\n", " if (selector) {\n", " handlers.splice(handlers.delegateCount++, 0, handleObj);\n", " }\n", " else {\n", " handlers.push(handleObj);\n", " }\n", " // Keep track of which events have ever been used, for event optimization\n", " jQuery.event.global[type] = true;\n", " }\n", " },\n", " // Detach an event or set of events from an element\n", " remove: function (elem, types, handler, selector, mappedTypes) {\n", " var j, origCount, tmp, events, t, handleObj, special, handlers, type, namespaces, origType, elemData = dataPriv.hasData(elem) && dataPriv.get(elem);\n", " if (!elemData || !(events = elemData.events)) {\n", " return;\n", " }\n", " // Once for each type.namespace in types; type may be omitted\n", " types = (types || \"\").match(rnothtmlwhite) || [\"\"];\n", " t = types.length;\n", " while (t--) {\n", " tmp = rtypenamespace.exec(types[t]) || [];\n", " type = origType = tmp[1];\n", " namespaces = (tmp[2] || \"\").split(\".\").sort();\n", " // Unbind all events (on this namespace, if provided) for the element\n", " if (!type) {\n", " for (type in events) {\n", " jQuery.event.remove(elem, type + types[t], handler, selector, true);\n", " }\n", " continue;\n", " }\n", " special = jQuery.event.special[type] || {};\n", " type = (selector ? special.delegateType : special.bindType) || type;\n", " handlers = events[type] || [];\n", " tmp = tmp[2] &&\n", " new RegExp(\"(^|\\\\.)\" + namespaces.join(\"\\\\.(?:.*\\\\.|)\") + \"(\\\\.|$)\");\n", " // Remove matching events\n", " origCount = j = handlers.length;\n", " while (j--) {\n", " handleObj = handlers[j];\n", " if ((mappedTypes || origType === handleObj.origType) &&\n", " (!handler || handler.guid === handleObj.guid) &&\n", " (!tmp || tmp.test(handleObj.namespace)) &&\n", " (!selector || selector === handleObj.selector ||\n", " selector === \"**\" && handleObj.selector)) {\n", " handlers.splice(j, 1);\n", " if (handleObj.selector) {\n", " handlers.delegateCount--;\n", " }\n", " if (special.remove) {\n", " special.remove.call(elem, handleObj);\n", " }\n", " }\n", " }\n", " // Remove generic event handler if we removed something and no more handlers exist\n", " // (avoids potential for endless recursion during removal of special event handlers)\n", " if (origCount && !handlers.length) {\n", " if (!special.teardown ||\n", " special.teardown.call(elem, namespaces, elemData.handle) === false) {\n", " jQuery.removeEvent(elem, type, elemData.handle);\n", " }\n", " delete events[type];\n", " }\n", " }\n", " // Remove data and the expando if it's no longer used\n", " if (jQuery.isEmptyObject(events)) {\n", " dataPriv.remove(elem, \"handle events\");\n", " }\n", " },\n", " dispatch: function (nativeEvent) {\n", " var i, j, ret, matched, handleObj, handlerQueue, args = new Array(arguments.length), \n", " // Make a writable jQuery.Event from the native event object\n", " event = jQuery.event.fix(nativeEvent), handlers = (dataPriv.get(this, \"events\") || Object.create(null))[event.type] || [], special = jQuery.event.special[event.type] || {};\n", " // Use the fix-ed jQuery.Event rather than the (read-only) native event\n", " args[0] = event;\n", " for (i = 1; i < arguments.length; i++) {\n", " args[i] = arguments[i];\n", " }\n", " event.delegateTarget = this;\n", " // Call the preDispatch hook for the mapped type, and let it bail if desired\n", " if (special.preDispatch && special.preDispatch.call(this, event) === false) {\n", " return;\n", " }\n", " // Determine handlers\n", " handlerQueue = jQuery.event.handlers.call(this, event, handlers);\n", " // Run delegates first; they may want to stop propagation beneath us\n", " i = 0;\n", " while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) {\n", " event.currentTarget = matched.elem;\n", " j = 0;\n", " while ((handleObj = matched.handlers[j++]) &&\n", " !event.isImmediatePropagationStopped()) {\n", " // If the event is namespaced, then each handler is only invoked if it is\n", " // specially universal or its namespaces are a superset of the event's.\n", " if (!event.rnamespace || handleObj.namespace === false ||\n", " event.rnamespace.test(handleObj.namespace)) {\n", " event.handleObj = handleObj;\n", " event.data = handleObj.data;\n", " ret = ((jQuery.event.special[handleObj.origType] || {}).handle ||\n", " handleObj.handler).apply(matched.elem, args);\n", " if (ret !== undefined) {\n", " if ((event.result = ret) === false) {\n", " event.preventDefault();\n", " event.stopPropagation();\n", " }\n", " }\n", " }\n", " }\n", " }\n", " // Call the postDispatch hook for the mapped type\n", " if (special.postDispatch) {\n", " special.postDispatch.call(this, event);\n", " }\n", " return event.result;\n", " },\n", " handlers: function (event, handlers) {\n", " var i, handleObj, sel, matchedHandlers, matchedSelectors, handlerQueue = [], delegateCount = handlers.delegateCount, cur = event.target;\n", " // Find delegate handlers\n", " if (delegateCount &&\n", " // Support: IE <=9\n", " // Black-hole SVG instance trees (trac-13180)\n", " cur.nodeType &&\n", " // Support: Firefox <=42\n", " // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)\n", " // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click\n", " // Support: IE 11 only\n", " // ...but not arrow key \"clicks\" of radio inputs, which can have `button` -1 (gh-2343)\n", " !(event.type === \"click\" && event.button >= 1)) {\n", " for (; cur !== this; cur = cur.parentNode || this) {\n", " // Don't check non-elements (#13208)\n", " // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)\n", " if (cur.nodeType === 1 && !(event.type === \"click\" && cur.disabled === true)) {\n", " matchedHandlers = [];\n", " matchedSelectors = {};\n", " for (i = 0; i < delegateCount; i++) {\n", " handleObj = handlers[i];\n", " // Don't conflict with Object.prototype properties (#13203)\n", " sel = handleObj.selector + \" \";\n", " if (matchedSelectors[sel] === undefined) {\n", " matchedSelectors[sel] = handleObj.needsContext ?\n", " jQuery(sel, this).index(cur) > -1 :\n", " jQuery.find(sel, this, null, [cur]).length;\n", " }\n", " if (matchedSelectors[sel]) {\n", " matchedHandlers.push(handleObj);\n", " }\n", " }\n", " if (matchedHandlers.length) {\n", " handlerQueue.push({ elem: cur, handlers: matchedHandlers });\n", " }\n", " }\n", " }\n", " }\n", " // Add the remaining (directly-bound) handlers\n", " cur = this;\n", " if (delegateCount < handlers.length) {\n", " handlerQueue.push({ elem: cur, handlers: handlers.slice(delegateCount) });\n", " }\n", " return handlerQueue;\n", " },\n", " addProp: function (name, hook) {\n", " Object.defineProperty(jQuery.Event.prototype, name, {\n", " enumerable: true,\n", " configurable: true,\n", " get: isFunction(hook) ?\n", " function () {\n", " if (this.originalEvent) {\n", " return hook(this.originalEvent);\n", " }\n", " } :\n", " function () {\n", " if (this.originalEvent) {\n", " return this.originalEvent[name];\n", " }\n", " },\n", " set: function (value) {\n", " Object.defineProperty(this, name, {\n", " enumerable: true,\n", " configurable: true,\n", " writable: true,\n", " value: value\n", " });\n", " }\n", " });\n", " },\n", " fix: function (originalEvent) {\n", " return originalEvent[jQuery.expando] ?\n", " originalEvent :\n", " new jQuery.Event(originalEvent);\n", " },\n", " special: {\n", " load: {\n", " // Prevent triggered image.load events from bubbling to window.load\n", " noBubble: true\n", " },\n", " click: {\n", " // Utilize native event to ensure correct state for checkable inputs\n", " setup: function (data) {\n", " // For mutual compressibility with _default, replace `this` access with a local var.\n", " // `|| data` is dead code meant only to preserve the variable through minification.\n", " var el = this || data;\n", " // Claim the first handler\n", " if (rcheckableType.test(el.type) &&\n", " el.click && nodeName(el, \"input\")) {\n", " // dataPriv.set( el, \"click\", ... )\n", " leverageNative(el, \"click\", returnTrue);\n", " }\n", " // Return false to allow normal processing in the caller\n", " return false;\n", " },\n", " trigger: function (data) {\n", " // For mutual compressibility with _default, replace `this` access with a local var.\n", " // `|| data` is dead code meant only to preserve the variable through minification.\n", " var el = this || data;\n", " // Force setup before triggering a click\n", " if (rcheckableType.test(el.type) &&\n", " el.click && nodeName(el, \"input\")) {\n", " leverageNative(el, \"click\");\n", " }\n", " // Return non-false to allow normal event-path propagation\n", " return true;\n", " },\n", " // For cross-browser consistency, suppress native .click() on links\n", " // Also prevent it if we're currently inside a leveraged native-event stack\n", " _default: function (event) {\n", " var target = event.target;\n", " return rcheckableType.test(target.type) &&\n", " target.click && nodeName(target, \"input\") &&\n", " dataPriv.get(target, \"click\") ||\n", " nodeName(target, \"a\");\n", " }\n", " },\n", " beforeunload: {\n", " postDispatch: function (event) {\n", " // Support: Firefox 20+\n", " // Firefox doesn't alert if the returnValue field is not set.\n", " if (event.result !== undefined && event.originalEvent) {\n", " event.originalEvent.returnValue = event.result;\n", " }\n", " }\n", " }\n", " }\n", " };\n", " // Ensure the presence of an event listener that handles manually-triggered\n", " // synthetic events by interrupting progress until reinvoked in response to\n", " // *native* events that it fires directly, ensuring that state changes have\n", " // already occurred before other listeners are invoked.\n", " function leverageNative(el, type, expectSync) {\n", " // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add\n", " if (!expectSync) {\n", " if (dataPriv.get(el, type) === undefined) {\n", " jQuery.event.add(el, type, returnTrue);\n", " }\n", " return;\n", " }\n", " // Register the controller as a special universal handler for all event namespaces\n", " dataPriv.set(el, type, false);\n", " jQuery.event.add(el, type, {\n", " namespace: false,\n", " handler: function (event) {\n", " var notAsync, result, saved = dataPriv.get(this, type);\n", " if ((event.isTrigger & 1) && this[type]) {\n", " // Interrupt processing of the outer synthetic .trigger()ed event\n", " // Saved data should be false in such cases, but might be a leftover capture object\n", " // from an async native handler (gh-4350)\n", " if (!saved.length) {\n", " // Store arguments for use when handling the inner native event\n", " // There will always be at least one argument (an event object), so this array\n", " // will not be confused with a leftover capture object.\n", " saved = slice.call(arguments);\n", " dataPriv.set(this, type, saved);\n", " // Trigger the native event and capture its result\n", " // Support: IE <=9 - 11+\n", " // focus() and blur() are asynchronous\n", " notAsync = expectSync(this, type);\n", " this[type]();\n", " result = dataPriv.get(this, type);\n", " if (saved !== result || notAsync) {\n", " dataPriv.set(this, type, false);\n", " }\n", " else {\n", " result = {};\n", " }\n", " if (saved !== result) {\n", " // Cancel the outer synthetic event\n", " event.stopImmediatePropagation();\n", " event.preventDefault();\n", " return result.value;\n", " }\n", " // If this is an inner synthetic event for an event with a bubbling surrogate\n", " // (focus or blur), assume that the surrogate already propagated from triggering the\n", " // native event and prevent that from happening again here.\n", " // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the\n", " // bubbling surrogate propagates *after* the non-bubbling base), but that seems\n", " // less bad than duplication.\n", " }\n", " else if ((jQuery.event.special[type] || {}).delegateType) {\n", " event.stopPropagation();\n", " }\n", " // If this is a native event triggered above, everything is now in order\n", " // Fire an inner synthetic event with the original arguments\n", " }\n", " else if (saved.length) {\n", " // ...and capture the result\n", " dataPriv.set(this, type, {\n", " value: jQuery.event.trigger(\n", " // Support: IE <=9 - 11+\n", " // Extend with the prototype to reset the above stopImmediatePropagation()\n", " jQuery.extend(saved[0], jQuery.Event.prototype), saved.slice(1), this)\n", " });\n", " // Abort handling of the native event\n", " event.stopImmediatePropagation();\n", " }\n", " }\n", " });\n", " }\n", " jQuery.removeEvent = function (elem, type, handle) {\n", " // This \"if\" is needed for plain objects\n", " if (elem.removeEventListener) {\n", " elem.removeEventListener(type, handle);\n", " }\n", " };\n", " jQuery.Event = function (src, props) {\n", " // Allow instantiation without the 'new' keyword\n", " if (!(this instanceof jQuery.Event)) {\n", " return new jQuery.Event(src, props);\n", " }\n", " // Event object\n", " if (src && src.type) {\n", " this.originalEvent = src;\n", " this.type = src.type;\n", " // Events bubbling up the document may have been marked as prevented\n", " // by a handler lower down the tree; reflect the correct value.\n", " this.isDefaultPrevented = src.defaultPrevented ||\n", " src.defaultPrevented === undefined &&\n", " // Support: Android <=2.3 only\n", " src.returnValue === false ?\n", " returnTrue :\n", " returnFalse;\n", " // Create target properties\n", " // Support: Safari <=6 - 7 only\n", " // Target should not be a text node (#504, #13143)\n", " this.target = (src.target && src.target.nodeType === 3) ?\n", " src.target.parentNode :\n", " src.target;\n", " this.currentTarget = src.currentTarget;\n", " this.relatedTarget = src.relatedTarget;\n", " // Event type\n", " }\n", " else {\n", " this.type = src;\n", " }\n", " // Put explicitly provided properties onto the event object\n", " if (props) {\n", " jQuery.extend(this, props);\n", " }\n", " // Create a timestamp if incoming event doesn't have one\n", " this.timeStamp = src && src.timeStamp || Date.now();\n", " // Mark it as fixed\n", " this[jQuery.expando] = true;\n", " };\n", " // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding\n", " // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html\n", " jQuery.Event.prototype = {\n", " constructor: jQuery.Event,\n", " isDefaultPrevented: returnFalse,\n", " isPropagationStopped: returnFalse,\n", " isImmediatePropagationStopped: returnFalse,\n", " isSimulated: false,\n", " preventDefault: function () {\n", " var e = this.originalEvent;\n", " this.isDefaultPrevented = returnTrue;\n", " if (e && !this.isSimulated) {\n", " e.preventDefault();\n", " }\n", " },\n", " stopPropagation: function () {\n", " var e = this.originalEvent;\n", " this.isPropagationStopped = returnTrue;\n", " if (e && !this.isSimulated) {\n", " e.stopPropagation();\n", " }\n", " },\n", " stopImmediatePropagation: function () {\n", " var e = this.originalEvent;\n", " this.isImmediatePropagationStopped = returnTrue;\n", " if (e && !this.isSimulated) {\n", " e.stopImmediatePropagation();\n", " }\n", " this.stopPropagation();\n", " }\n", " };\n", " // Includes all common event props including KeyEvent and MouseEvent specific props\n", " jQuery.each({\n", " altKey: true,\n", " bubbles: true,\n", " cancelable: true,\n", " changedTouches: true,\n", " ctrlKey: true,\n", " detail: true,\n", " eventPhase: true,\n", " metaKey: true,\n", " pageX: true,\n", " pageY: true,\n", " shiftKey: true,\n", " view: true,\n", " \"char\": true,\n", " code: true,\n", " charCode: true,\n", " key: true,\n", " keyCode: true,\n", " button: true,\n", " buttons: true,\n", " clientX: true,\n", " clientY: true,\n", " offsetX: true,\n", " offsetY: true,\n", " pointerId: true,\n", " pointerType: true,\n", " screenX: true,\n", " screenY: true,\n", " targetTouches: true,\n", " toElement: true,\n", " touches: true,\n", " which: function (event) {\n", " var button = event.button;\n", " // Add which for key events\n", " if (event.which == null && rkeyEvent.test(event.type)) {\n", " return event.charCode != null ? event.charCode : event.keyCode;\n", " }\n", " // Add which for click: 1 === left; 2 === middle; 3 === right\n", " if (!event.which && button !== undefined && rmouseEvent.test(event.type)) {\n", " if (button & 1) {\n", " return 1;\n", " }\n", " if (button & 2) {\n", " return 3;\n", " }\n", " if (button & 4) {\n", " return 2;\n", " }\n", " return 0;\n", " }\n", " return event.which;\n", " }\n", " }, jQuery.event.addProp);\n", " jQuery.each({ focus: \"focusin\", blur: \"focusout\" }, function (type, delegateType) {\n", " jQuery.event.special[type] = {\n", " // Utilize native event if possible so blur/focus sequence is correct\n", " setup: function () {\n", " // Claim the first handler\n", " // dataPriv.set( this, \"focus\", ... )\n", " // dataPriv.set( this, \"blur\", ... )\n", " leverageNative(this, type, expectSync);\n", " // Return false to allow normal processing in the caller\n", " return false;\n", " },\n", " trigger: function () {\n", " // Force setup before trigger\n", " leverageNative(this, type);\n", " // Return non-false to allow normal event-path propagation\n", " return true;\n", " },\n", " delegateType: delegateType\n", " };\n", " });\n", " // Create mouseenter/leave events using mouseover/out and event-time checks\n", " // so that event delegation works in jQuery.\n", " // Do the same for pointerenter/pointerleave and pointerover/pointerout\n", " //\n", " // Support: Safari 7 only\n", " // Safari sends mouseenter too often; see:\n", " // https://bugs.chromium.org/p/chromium/issues/detail?id=470258\n", " // for the description of the bug (it existed in older Chrome versions as well).\n", " jQuery.each({\n", " mouseenter: \"mouseover\",\n", " mouseleave: \"mouseout\",\n", " pointerenter: \"pointerover\",\n", " pointerleave: \"pointerout\"\n", " }, function (orig, fix) {\n", " jQuery.event.special[orig] = {\n", " delegateType: fix,\n", " bindType: fix,\n", " handle: function (event) {\n", " var ret, target = this, related = event.relatedTarget, handleObj = event.handleObj;\n", " // For mouseenter/leave call the handler if related is outside the target.\n", " // NB: No relatedTarget if the mouse left/entered the browser window\n", " if (!related || (related !== target && !jQuery.contains(target, related))) {\n", " event.type = handleObj.origType;\n", " ret = handleObj.handler.apply(this, arguments);\n", " event.type = fix;\n", " }\n", " return ret;\n", " }\n", " };\n", " });\n", " jQuery.fn.extend({\n", " on: function (types, selector, data, fn) {\n", " return on(this, types, selector, data, fn);\n", " },\n", " one: function (types, selector, data, fn) {\n", " return on(this, types, selector, data, fn, 1);\n", " },\n", " off: function (types, selector, fn) {\n", " var handleObj, type;\n", " if (types && types.preventDefault && types.handleObj) {\n", " // ( event ) dispatched jQuery.Event\n", " handleObj = types.handleObj;\n", " jQuery(types.delegateTarget).off(handleObj.namespace ?\n", " handleObj.origType + \".\" + handleObj.namespace :\n", " handleObj.origType, handleObj.selector, handleObj.handler);\n", " return this;\n", " }\n", " if (typeof types === \"object\") {\n", " // ( types-object [, selector] )\n", " for (type in types) {\n", " this.off(type, selector, types[type]);\n", " }\n", " return this;\n", " }\n", " if (selector === false || typeof selector === \"function\") {\n", " // ( types [, fn] )\n", " fn = selector;\n", " selector = undefined;\n", " }\n", " if (fn === false) {\n", " fn = returnFalse;\n", " }\n", " return this.each(function () {\n", " jQuery.event.remove(this, types, fn, selector);\n", " });\n", " }\n", " });\n", " var \n", " // Support: IE <=10 - 11, Edge 12 - 13 only\n", " // In IE/Edge using regex groups here causes severe slowdowns.\n", " // See https://connect.microsoft.com/IE/feedback/details/1736512/\n", " rnoInnerhtml = /\\s*$/g;\n", " // Prefer a tbody over its parent table for containing new rows\n", " function manipulationTarget(elem, content) {\n", " if (nodeName(elem, \"table\") &&\n", " nodeName(content.nodeType !== 11 ? content : content.firstChild, \"tr\")) {\n", " return jQuery(elem).children(\"tbody\")[0] || elem;\n", " }\n", " return elem;\n", " }\n", " // Replace/restore the type attribute of script elements for safe DOM manipulation\n", " function disableScript(elem) {\n", " elem.type = (elem.getAttribute(\"type\") !== null) + \"/\" + elem.type;\n", " return elem;\n", " }\n", " function restoreScript(elem) {\n", " if ((elem.type || \"\").slice(0, 5) === \"true/\") {\n", " elem.type = elem.type.slice(5);\n", " }\n", " else {\n", " elem.removeAttribute(\"type\");\n", " }\n", " return elem;\n", " }\n", " function cloneCopyEvent(src, dest) {\n", " var i, l, type, pdataOld, udataOld, udataCur, events;\n", " if (dest.nodeType !== 1) {\n", " return;\n", " }\n", " // 1. Copy private data: events, handlers, etc.\n", " if (dataPriv.hasData(src)) {\n", " pdataOld = dataPriv.get(src);\n", " events = pdataOld.events;\n", " if (events) {\n", " dataPriv.remove(dest, \"handle events\");\n", " for (type in events) {\n", " for (i = 0, l = events[type].length; i < l; i++) {\n", " jQuery.event.add(dest, type, events[type][i]);\n", " }\n", " }\n", " }\n", " }\n", " // 2. Copy user data\n", " if (dataUser.hasData(src)) {\n", " udataOld = dataUser.access(src);\n", " udataCur = jQuery.extend({}, udataOld);\n", " dataUser.set(dest, udataCur);\n", " }\n", " }\n", " // Fix IE bugs, see support tests\n", " function fixInput(src, dest) {\n", " var nodeName = dest.nodeName.toLowerCase();\n", " // Fails to persist the checked state of a cloned checkbox or radio button.\n", " if (nodeName === \"input\" && rcheckableType.test(src.type)) {\n", " dest.checked = src.checked;\n", " // Fails to return the selected option to the default selected state when cloning options\n", " }\n", " else if (nodeName === \"input\" || nodeName === \"textarea\") {\n", " dest.defaultValue = src.defaultValue;\n", " }\n", " }\n", " function domManip(collection, args, callback, ignored) {\n", " // Flatten any nested arrays\n", " args = flat(args);\n", " var fragment, first, scripts, hasScripts, node, doc, i = 0, l = collection.length, iNoClone = l - 1, value = args[0], valueIsFunction = isFunction(value);\n", " // We can't cloneNode fragments that contain checked, in WebKit\n", " if (valueIsFunction ||\n", " (l > 1 && typeof value === \"string\" &&\n", " !support.checkClone && rchecked.test(value))) {\n", " return collection.each(function (index) {\n", " var self = collection.eq(index);\n", " if (valueIsFunction) {\n", " args[0] = value.call(this, index, self.html());\n", " }\n", " domManip(self, args, callback, ignored);\n", " });\n", " }\n", " if (l) {\n", " fragment = buildFragment(args, collection[0].ownerDocument, false, collection, ignored);\n", " first = fragment.firstChild;\n", " if (fragment.childNodes.length === 1) {\n", " fragment = first;\n", " }\n", " // Require either new content or an interest in ignored elements to invoke the callback\n", " if (first || ignored) {\n", " scripts = jQuery.map(getAll(fragment, \"script\"), disableScript);\n", " hasScripts = scripts.length;\n", " // Use the original fragment for the last item\n", " // instead of the first because it can end up\n", " // being emptied incorrectly in certain situations (#8070).\n", " for (; i < l; i++) {\n", " node = fragment;\n", " if (i !== iNoClone) {\n", " node = jQuery.clone(node, true, true);\n", " // Keep references to cloned scripts for later restoration\n", " if (hasScripts) {\n", " // Support: Android <=4.0 only, PhantomJS 1 only\n", " // push.apply(_, arraylike) throws on ancient WebKit\n", " jQuery.merge(scripts, getAll(node, \"script\"));\n", " }\n", " }\n", " callback.call(collection[i], node, i);\n", " }\n", " if (hasScripts) {\n", " doc = scripts[scripts.length - 1].ownerDocument;\n", " // Reenable scripts\n", " jQuery.map(scripts, restoreScript);\n", " // Evaluate executable scripts on first document insertion\n", " for (i = 0; i < hasScripts; i++) {\n", " node = scripts[i];\n", " if (rscriptType.test(node.type || \"\") &&\n", " !dataPriv.access(node, \"globalEval\") &&\n", " jQuery.contains(doc, node)) {\n", " if (node.src && (node.type || \"\").toLowerCase() !== \"module\") {\n", " // Optional AJAX dependency, but won't run scripts if not present\n", " if (jQuery._evalUrl && !node.noModule) {\n", " jQuery._evalUrl(node.src, {\n", " nonce: node.nonce || node.getAttribute(\"nonce\")\n", " }, doc);\n", " }\n", " }\n", " else {\n", " DOMEval(node.textContent.replace(rcleanScript, \"\"), node, doc);\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " return collection;\n", " }\n", " function remove(elem, selector, keepData) {\n", " var node, nodes = selector ? jQuery.filter(selector, elem) : elem, i = 0;\n", " for (; (node = nodes[i]) != null; i++) {\n", " if (!keepData && node.nodeType === 1) {\n", " jQuery.cleanData(getAll(node));\n", " }\n", " if (node.parentNode) {\n", " if (keepData && isAttached(node)) {\n", " setGlobalEval(getAll(node, \"script\"));\n", " }\n", " node.parentNode.removeChild(node);\n", " }\n", " }\n", " return elem;\n", " }\n", " jQuery.extend({\n", " htmlPrefilter: function (html) {\n", " return html;\n", " },\n", " clone: function (elem, dataAndEvents, deepDataAndEvents) {\n", " var i, l, srcElements, destElements, clone = elem.cloneNode(true), inPage = isAttached(elem);\n", " // Fix IE cloning issues\n", " if (!support.noCloneChecked && (elem.nodeType === 1 || elem.nodeType === 11) &&\n", " !jQuery.isXMLDoc(elem)) {\n", " // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2\n", " destElements = getAll(clone);\n", " srcElements = getAll(elem);\n", " for (i = 0, l = srcElements.length; i < l; i++) {\n", " fixInput(srcElements[i], destElements[i]);\n", " }\n", " }\n", " // Copy the events from the original to the clone\n", " if (dataAndEvents) {\n", " if (deepDataAndEvents) {\n", " srcElements = srcElements || getAll(elem);\n", " destElements = destElements || getAll(clone);\n", " for (i = 0, l = srcElements.length; i < l; i++) {\n", " cloneCopyEvent(srcElements[i], destElements[i]);\n", " }\n", " }\n", " else {\n", " cloneCopyEvent(elem, clone);\n", " }\n", " }\n", " // Preserve script evaluation history\n", " destElements = getAll(clone, \"script\");\n", " if (destElements.length > 0) {\n", " setGlobalEval(destElements, !inPage && getAll(elem, \"script\"));\n", " }\n", " // Return the cloned set\n", " return clone;\n", " },\n", " cleanData: function (elems) {\n", " var data, elem, type, special = jQuery.event.special, i = 0;\n", " for (; (elem = elems[i]) !== undefined; i++) {\n", " if (acceptData(elem)) {\n", " if ((data = elem[dataPriv.expando])) {\n", " if (data.events) {\n", " for (type in data.events) {\n", " if (special[type]) {\n", " jQuery.event.remove(elem, type);\n", " // This is a shortcut to avoid jQuery.event.remove's overhead\n", " }\n", " else {\n", " jQuery.removeEvent(elem, type, data.handle);\n", " }\n", " }\n", " }\n", " // Support: Chrome <=35 - 45+\n", " // Assign undefined instead of using delete, see Data#remove\n", " elem[dataPriv.expando] = undefined;\n", " }\n", " if (elem[dataUser.expando]) {\n", " // Support: Chrome <=35 - 45+\n", " // Assign undefined instead of using delete, see Data#remove\n", " elem[dataUser.expando] = undefined;\n", " }\n", " }\n", " }\n", " }\n", " });\n", " jQuery.fn.extend({\n", " detach: function (selector) {\n", " return remove(this, selector, true);\n", " },\n", " remove: function (selector) {\n", " return remove(this, selector);\n", " },\n", " text: function (value) {\n", " return access(this, function (value) {\n", " return value === undefined ?\n", " jQuery.text(this) :\n", " this.empty().each(function () {\n", " if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {\n", " this.textContent = value;\n", " }\n", " });\n", " }, null, value, arguments.length);\n", " },\n", " append: function () {\n", " return domManip(this, arguments, function (elem) {\n", " if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {\n", " var target = manipulationTarget(this, elem);\n", " target.appendChild(elem);\n", " }\n", " });\n", " },\n", " prepend: function () {\n", " return domManip(this, arguments, function (elem) {\n", " if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {\n", " var target = manipulationTarget(this, elem);\n", " target.insertBefore(elem, target.firstChild);\n", " }\n", " });\n", " },\n", " before: function () {\n", " return domManip(this, arguments, function (elem) {\n", " if (this.parentNode) {\n", " this.parentNode.insertBefore(elem, this);\n", " }\n", " });\n", " },\n", " after: function () {\n", " return domManip(this, arguments, function (elem) {\n", " if (this.parentNode) {\n", " this.parentNode.insertBefore(elem, this.nextSibling);\n", " }\n", " });\n", " },\n", " empty: function () {\n", " var elem, i = 0;\n", " for (; (elem = this[i]) != null; i++) {\n", " if (elem.nodeType === 1) {\n", " // Prevent memory leaks\n", " jQuery.cleanData(getAll(elem, false));\n", " // Remove any remaining nodes\n", " elem.textContent = \"\";\n", " }\n", " }\n", " return this;\n", " },\n", " clone: function (dataAndEvents, deepDataAndEvents) {\n", " dataAndEvents = dataAndEvents == null ? false : dataAndEvents;\n", " deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;\n", " return this.map(function () {\n", " return jQuery.clone(this, dataAndEvents, deepDataAndEvents);\n", " });\n", " },\n", " html: function (value) {\n", " return access(this, function (value) {\n", " var elem = this[0] || {}, i = 0, l = this.length;\n", " if (value === undefined && elem.nodeType === 1) {\n", " return elem.innerHTML;\n", " }\n", " // See if we can take a shortcut and just use innerHTML\n", " if (typeof value === \"string\" && !rnoInnerhtml.test(value) &&\n", " !wrapMap[(rtagName.exec(value) || [\"\", \"\"])[1].toLowerCase()]) {\n", " value = jQuery.htmlPrefilter(value);\n", " try {\n", " for (; i < l; i++) {\n", " elem = this[i] || {};\n", " // Remove element nodes and prevent memory leaks\n", " if (elem.nodeType === 1) {\n", " jQuery.cleanData(getAll(elem, false));\n", " elem.innerHTML = value;\n", " }\n", " }\n", " elem = 0;\n", " // If using innerHTML throws an exception, use the fallback method\n", " }\n", " catch (e) { }\n", " }\n", " if (elem) {\n", " this.empty().append(value);\n", " }\n", " }, null, value, arguments.length);\n", " },\n", " replaceWith: function () {\n", " var ignored = [];\n", " // Make the changes, replacing each non-ignored context element with the new content\n", " return domManip(this, arguments, function (elem) {\n", " var parent = this.parentNode;\n", " if (jQuery.inArray(this, ignored) < 0) {\n", " jQuery.cleanData(getAll(this));\n", " if (parent) {\n", " parent.replaceChild(elem, this);\n", " }\n", " }\n", " // Force callback invocation\n", " }, ignored);\n", " }\n", " });\n", " jQuery.each({\n", " appendTo: \"append\",\n", " prependTo: \"prepend\",\n", " insertBefore: \"before\",\n", " insertAfter: \"after\",\n", " replaceAll: \"replaceWith\"\n", " }, function (name, original) {\n", " jQuery.fn[name] = function (selector) {\n", " var elems, ret = [], insert = jQuery(selector), last = insert.length - 1, i = 0;\n", " for (; i <= last; i++) {\n", " elems = i === last ? this : this.clone(true);\n", " jQuery(insert[i])[original](elems);\n", " // Support: Android <=4.0 only, PhantomJS 1 only\n", " // .get() because push.apply(_, arraylike) throws on ancient WebKit\n", " push.apply(ret, elems.get());\n", " }\n", " return this.pushStack(ret);\n", " };\n", " });\n", " var rnumnonpx = new RegExp(\"^(\" + pnum + \")(?!px)[a-z%]+$\", \"i\");\n", " var getStyles = function (elem) {\n", " // Support: IE <=11 only, Firefox <=30 (#15098, #14150)\n", " // IE throws on elements created in popups\n", " // FF meanwhile throws on frame elements through \"defaultView.getComputedStyle\"\n", " var view = elem.ownerDocument.defaultView;\n", " if (!view || !view.opener) {\n", " view = window;\n", " }\n", " return view.getComputedStyle(elem);\n", " };\n", " var swap = function (elem, options, callback) {\n", " var ret, name, old = {};\n", " // Remember the old values, and insert the new ones\n", " for (name in options) {\n", " old[name] = elem.style[name];\n", " elem.style[name] = options[name];\n", " }\n", " ret = callback.call(elem);\n", " // Revert the old values\n", " for (name in options) {\n", " elem.style[name] = old[name];\n", " }\n", " return ret;\n", " };\n", " var rboxStyle = new RegExp(cssExpand.join(\"|\"), \"i\");\n", " (function () {\n", " // Executing both pixelPosition & boxSizingReliable tests require only one layout\n", " // so they're executed at the same time to save the second computation.\n", " function computeStyleTests() {\n", " // This is a singleton, we need to execute it only once\n", " if (!div) {\n", " return;\n", " }\n", " container.style.cssText = \"position:absolute;left:-11111px;width:60px;\" +\n", " \"margin-top:1px;padding:0;border:0\";\n", " div.style.cssText =\n", " \"position:relative;display:block;box-sizing:border-box;overflow:scroll;\" +\n", " \"margin:auto;border:1px;padding:1px;\" +\n", " \"width:60%;top:1%\";\n", " documentElement.appendChild(container).appendChild(div);\n", " var divStyle = window.getComputedStyle(div);\n", " pixelPositionVal = divStyle.top !== \"1%\";\n", " // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44\n", " reliableMarginLeftVal = roundPixelMeasures(divStyle.marginLeft) === 12;\n", " // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3\n", " // Some styles come back with percentage values, even though they shouldn't\n", " div.style.right = \"60%\";\n", " pixelBoxStylesVal = roundPixelMeasures(divStyle.right) === 36;\n", " // Support: IE 9 - 11 only\n", " // Detect misreporting of content dimensions for box-sizing:border-box elements\n", " boxSizingReliableVal = roundPixelMeasures(divStyle.width) === 36;\n", " // Support: IE 9 only\n", " // Detect overflow:scroll screwiness (gh-3699)\n", " // Support: Chrome <=64\n", " // Don't get tricked when zoom affects offsetWidth (gh-4029)\n", " div.style.position = \"absolute\";\n", " scrollboxSizeVal = roundPixelMeasures(div.offsetWidth / 3) === 12;\n", " documentElement.removeChild(container);\n", " // Nullify the div so it wouldn't be stored in the memory and\n", " // it will also be a sign that checks already performed\n", " div = null;\n", " }\n", " function roundPixelMeasures(measure) {\n", " return Math.round(parseFloat(measure));\n", " }\n", " var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, reliableTrDimensionsVal, reliableMarginLeftVal, container = document.createElement(\"div\"), div = document.createElement(\"div\");\n", " // Finish early in limited (non-browser) environments\n", " if (!div.style) {\n", " return;\n", " }\n", " // Support: IE <=9 - 11 only\n", " // Style of cloned element affects source element cloned (#8908)\n", " div.style.backgroundClip = \"content-box\";\n", " div.cloneNode(true).style.backgroundClip = \"\";\n", " support.clearCloneStyle = div.style.backgroundClip === \"content-box\";\n", " jQuery.extend(support, {\n", " boxSizingReliable: function () {\n", " computeStyleTests();\n", " return boxSizingReliableVal;\n", " },\n", " pixelBoxStyles: function () {\n", " computeStyleTests();\n", " return pixelBoxStylesVal;\n", " },\n", " pixelPosition: function () {\n", " computeStyleTests();\n", " return pixelPositionVal;\n", " },\n", " reliableMarginLeft: function () {\n", " computeStyleTests();\n", " return reliableMarginLeftVal;\n", " },\n", " scrollboxSize: function () {\n", " computeStyleTests();\n", " return scrollboxSizeVal;\n", " },\n", " // Support: IE 9 - 11+, Edge 15 - 18+\n", " // IE/Edge misreport `getComputedStyle` of table rows with width/height\n", " // set in CSS while `offset*` properties report correct values.\n", " // Behavior in IE 9 is more subtle than in newer versions & it passes\n", " // some versions of this test; make sure not to make it pass there!\n", " reliableTrDimensions: function () {\n", " var table, tr, trChild, trStyle;\n", " if (reliableTrDimensionsVal == null) {\n", " table = document.createElement(\"table\");\n", " tr = document.createElement(\"tr\");\n", " trChild = document.createElement(\"div\");\n", " table.style.cssText = \"position:absolute;left:-11111px\";\n", " tr.style.height = \"1px\";\n", " trChild.style.height = \"9px\";\n", " documentElement\n", " .appendChild(table)\n", " .appendChild(tr)\n", " .appendChild(trChild);\n", " trStyle = window.getComputedStyle(tr);\n", " reliableTrDimensionsVal = parseInt(trStyle.height) > 3;\n", " documentElement.removeChild(table);\n", " }\n", " return reliableTrDimensionsVal;\n", " }\n", " });\n", " })();\n", " function curCSS(elem, name, computed) {\n", " var width, minWidth, maxWidth, ret, \n", " // Support: Firefox 51+\n", " // Retrieving style before computed somehow\n", " // fixes an issue with getting wrong values\n", " // on detached elements\n", " style = elem.style;\n", " computed = computed || getStyles(elem);\n", " // getPropertyValue is needed for:\n", " // .css('filter') (IE 9 only, #12537)\n", " // .css('--customProperty) (#3144)\n", " if (computed) {\n", " ret = computed.getPropertyValue(name) || computed[name];\n", " if (ret === \"\" && !isAttached(elem)) {\n", " ret = jQuery.style(elem, name);\n", " }\n", " // A tribute to the \"awesome hack by Dean Edwards\"\n", " // Android Browser returns percentage for some values,\n", " // but width seems to be reliably pixels.\n", " // This is against the CSSOM draft spec:\n", " // https://drafts.csswg.org/cssom/#resolved-values\n", " if (!support.pixelBoxStyles() && rnumnonpx.test(ret) && rboxStyle.test(name)) {\n", " // Remember the original values\n", " width = style.width;\n", " minWidth = style.minWidth;\n", " maxWidth = style.maxWidth;\n", " // Put in the new values to get a computed value out\n", " style.minWidth = style.maxWidth = style.width = ret;\n", " ret = computed.width;\n", " // Revert the changed values\n", " style.width = width;\n", " style.minWidth = minWidth;\n", " style.maxWidth = maxWidth;\n", " }\n", " }\n", " return ret !== undefined ?\n", " // Support: IE <=9 - 11 only\n", " // IE returns zIndex value as an integer.\n", " ret + \"\" :\n", " ret;\n", " }\n", " function addGetHookIf(conditionFn, hookFn) {\n", " // Define the hook, we'll check on the first run if it's really needed.\n", " return {\n", " get: function () {\n", " if (conditionFn()) {\n", " // Hook not needed (or it's not possible to use it due\n", " // to missing dependency), remove it.\n", " delete this.get;\n", " return;\n", " }\n", " // Hook needed; redefine it so that the support test is not executed again.\n", " return (this.get = hookFn).apply(this, arguments);\n", " }\n", " };\n", " }\n", " var cssPrefixes = [\"Webkit\", \"Moz\", \"ms\"], emptyStyle = document.createElement(\"div\").style, vendorProps = {};\n", " // Return a vendor-prefixed property or undefined\n", " function vendorPropName(name) {\n", " // Check for vendor prefixed names\n", " var capName = name[0].toUpperCase() + name.slice(1), i = cssPrefixes.length;\n", " while (i--) {\n", " name = cssPrefixes[i] + capName;\n", " if (name in emptyStyle) {\n", " return name;\n", " }\n", " }\n", " }\n", " // Return a potentially-mapped jQuery.cssProps or vendor prefixed property\n", " function finalPropName(name) {\n", " var final = jQuery.cssProps[name] || vendorProps[name];\n", " if (final) {\n", " return final;\n", " }\n", " if (name in emptyStyle) {\n", " return name;\n", " }\n", " return vendorProps[name] = vendorPropName(name) || name;\n", " }\n", " var \n", " // Swappable if display is none or starts with table\n", " // except \"table\", \"table-cell\", or \"table-caption\"\n", " // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display\n", " rdisplayswap = /^(none|table(?!-c[ea]).+)/, rcustomProp = /^--/, cssShow = { position: \"absolute\", visibility: \"hidden\", display: \"block\" }, cssNormalTransform = {\n", " letterSpacing: \"0\",\n", " fontWeight: \"400\"\n", " };\n", " function setPositiveNumber(_elem, value, subtract) {\n", " // Any relative (+/-) values have already been\n", " // normalized at this point\n", " var matches = rcssNum.exec(value);\n", " return matches ?\n", " // Guard against undefined \"subtract\", e.g., when used as in cssHooks\n", " Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || \"px\") :\n", " value;\n", " }\n", " function boxModelAdjustment(elem, dimension, box, isBorderBox, styles, computedVal) {\n", " var i = dimension === \"width\" ? 1 : 0, extra = 0, delta = 0;\n", " // Adjustment may not be necessary\n", " if (box === (isBorderBox ? \"border\" : \"content\")) {\n", " return 0;\n", " }\n", " for (; i < 4; i += 2) {\n", " // Both box models exclude margin\n", " if (box === \"margin\") {\n", " delta += jQuery.css(elem, box + cssExpand[i], true, styles);\n", " }\n", " // If we get here with a content-box, we're seeking \"padding\" or \"border\" or \"margin\"\n", " if (!isBorderBox) {\n", " // Add padding\n", " delta += jQuery.css(elem, \"padding\" + cssExpand[i], true, styles);\n", " // For \"border\" or \"margin\", add border\n", " if (box !== \"padding\") {\n", " delta += jQuery.css(elem, \"border\" + cssExpand[i] + \"Width\", true, styles);\n", " // But still keep track of it otherwise\n", " }\n", " else {\n", " extra += jQuery.css(elem, \"border\" + cssExpand[i] + \"Width\", true, styles);\n", " }\n", " // If we get here with a border-box (content + padding + border), we're seeking \"content\" or\n", " // \"padding\" or \"margin\"\n", " }\n", " else {\n", " // For \"content\", subtract padding\n", " if (box === \"content\") {\n", " delta -= jQuery.css(elem, \"padding\" + cssExpand[i], true, styles);\n", " }\n", " // For \"content\" or \"padding\", subtract border\n", " if (box !== \"margin\") {\n", " delta -= jQuery.css(elem, \"border\" + cssExpand[i] + \"Width\", true, styles);\n", " }\n", " }\n", " }\n", " // Account for positive content-box scroll gutter when requested by providing computedVal\n", " if (!isBorderBox && computedVal >= 0) {\n", " // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border\n", " // Assuming integer scroll gutter, subtract the rest and round down\n", " delta += Math.max(0, Math.ceil(elem[\"offset\" + dimension[0].toUpperCase() + dimension.slice(1)] -\n", " computedVal -\n", " delta -\n", " extra -\n", " 0.5\n", " // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter\n", " // Use an explicit zero to avoid NaN (gh-3964)\n", " )) || 0;\n", " }\n", " return delta;\n", " }\n", " function getWidthOrHeight(elem, dimension, extra) {\n", " // Start with computed style\n", " var styles = getStyles(elem), \n", " // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).\n", " // Fake content-box until we know it's needed to know the true value.\n", " boxSizingNeeded = !support.boxSizingReliable() || extra, isBorderBox = boxSizingNeeded &&\n", " jQuery.css(elem, \"boxSizing\", false, styles) === \"border-box\", valueIsBorderBox = isBorderBox, val = curCSS(elem, dimension, styles), offsetProp = \"offset\" + dimension[0].toUpperCase() + dimension.slice(1);\n", " // Support: Firefox <=54\n", " // Return a confounding non-pixel value or feign ignorance, as appropriate.\n", " if (rnumnonpx.test(val)) {\n", " if (!extra) {\n", " return val;\n", " }\n", " val = \"auto\";\n", " }\n", " // Support: IE 9 - 11 only\n", " // Use offsetWidth/offsetHeight for when box sizing is unreliable.\n", " // In those cases, the computed value can be trusted to be border-box.\n", " if ((!support.boxSizingReliable() && isBorderBox ||\n", " // Support: IE 10 - 11+, Edge 15 - 18+\n", " // IE/Edge misreport `getComputedStyle` of table rows with width/height\n", " // set in CSS while `offset*` properties report correct values.\n", " // Interestingly, in some cases IE 9 doesn't suffer from this issue.\n", " !support.reliableTrDimensions() && nodeName(elem, \"tr\") ||\n", " // Fall back to offsetWidth/offsetHeight when value is \"auto\"\n", " // This happens for inline elements with no explicit setting (gh-3571)\n", " val === \"auto\" ||\n", " // Support: Android <=4.1 - 4.3 only\n", " // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)\n", " !parseFloat(val) && jQuery.css(elem, \"display\", false, styles) === \"inline\") &&\n", " // Make sure the element is visible & connected\n", " elem.getClientRects().length) {\n", " isBorderBox = jQuery.css(elem, \"boxSizing\", false, styles) === \"border-box\";\n", " // Where available, offsetWidth/offsetHeight approximate border box dimensions.\n", " // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the\n", " // retrieved value as a content box dimension.\n", " valueIsBorderBox = offsetProp in elem;\n", " if (valueIsBorderBox) {\n", " val = elem[offsetProp];\n", " }\n", " }\n", " // Normalize \"\" and auto\n", " val = parseFloat(val) || 0;\n", " // Adjust for the element's box model\n", " return (val +\n", " boxModelAdjustment(elem, dimension, extra || (isBorderBox ? \"border\" : \"content\"), valueIsBorderBox, styles, \n", " // Provide the current computed size to request scroll gutter calculation (gh-3589)\n", " val)) + \"px\";\n", " }\n", " jQuery.extend({\n", " // Add in style property hooks for overriding the default\n", " // behavior of getting and setting a style property\n", " cssHooks: {\n", " opacity: {\n", " get: function (elem, computed) {\n", " if (computed) {\n", " // We should always get a number back from opacity\n", " var ret = curCSS(elem, \"opacity\");\n", " return ret === \"\" ? \"1\" : ret;\n", " }\n", " }\n", " }\n", " },\n", " // Don't automatically add \"px\" to these possibly-unitless properties\n", " cssNumber: {\n", " \"animationIterationCount\": true,\n", " \"columnCount\": true,\n", " \"fillOpacity\": true,\n", " \"flexGrow\": true,\n", " \"flexShrink\": true,\n", " \"fontWeight\": true,\n", " \"gridArea\": true,\n", " \"gridColumn\": true,\n", " \"gridColumnEnd\": true,\n", " \"gridColumnStart\": true,\n", " \"gridRow\": true,\n", " \"gridRowEnd\": true,\n", " \"gridRowStart\": true,\n", " \"lineHeight\": true,\n", " \"opacity\": true,\n", " \"order\": true,\n", " \"orphans\": true,\n", " \"widows\": true,\n", " \"zIndex\": true,\n", " \"zoom\": true\n", " },\n", " // Add in properties whose names you wish to fix before\n", " // setting or getting the value\n", " cssProps: {},\n", " // Get and set the style property on a DOM Node\n", " style: function (elem, name, value, extra) {\n", " // Don't set styles on text and comment nodes\n", " if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {\n", " return;\n", " }\n", " // Make sure that we're working with the right name\n", " var ret, type, hooks, origName = camelCase(name), isCustomProp = rcustomProp.test(name), style = elem.style;\n", " // Make sure that we're working with the right name. We don't\n", " // want to query the value if it is a CSS custom property\n", " // since they are user-defined.\n", " if (!isCustomProp) {\n", " name = finalPropName(origName);\n", " }\n", " // Gets hook for the prefixed version, then unprefixed version\n", " hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];\n", " // Check if we're setting a value\n", " if (value !== undefined) {\n", " type = typeof value;\n", " // Convert \"+=\" or \"-=\" to relative numbers (#7345)\n", " if (type === \"string\" && (ret = rcssNum.exec(value)) && ret[1]) {\n", " value = adjustCSS(elem, name, ret);\n", " // Fixes bug #9237\n", " type = \"number\";\n", " }\n", " // Make sure that null and NaN values aren't set (#7116)\n", " if (value == null || value !== value) {\n", " return;\n", " }\n", " // If a number was passed in, add the unit (except for certain CSS properties)\n", " // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append\n", " // \"px\" to a few hardcoded values.\n", " if (type === \"number\" && !isCustomProp) {\n", " value += ret && ret[3] || (jQuery.cssNumber[origName] ? \"\" : \"px\");\n", " }\n", " // background-* props affect original clone's values\n", " if (!support.clearCloneStyle && value === \"\" && name.indexOf(\"background\") === 0) {\n", " style[name] = \"inherit\";\n", " }\n", " // If a hook was provided, use that value, otherwise just set the specified value\n", " if (!hooks || !(\"set\" in hooks) ||\n", " (value = hooks.set(elem, value, extra)) !== undefined) {\n", " if (isCustomProp) {\n", " style.setProperty(name, value);\n", " }\n", " else {\n", " style[name] = value;\n", " }\n", " }\n", " }\n", " else {\n", " // If a hook was provided get the non-computed value from there\n", " if (hooks && \"get\" in hooks &&\n", " (ret = hooks.get(elem, false, extra)) !== undefined) {\n", " return ret;\n", " }\n", " // Otherwise just get the value from the style object\n", " return style[name];\n", " }\n", " },\n", " css: function (elem, name, extra, styles) {\n", " var val, num, hooks, origName = camelCase(name), isCustomProp = rcustomProp.test(name);\n", " // Make sure that we're working with the right name. We don't\n", " // want to modify the value if it is a CSS custom property\n", " // since they are user-defined.\n", " if (!isCustomProp) {\n", " name = finalPropName(origName);\n", " }\n", " // Try prefixed name followed by the unprefixed name\n", " hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];\n", " // If a hook was provided get the computed value from there\n", " if (hooks && \"get\" in hooks) {\n", " val = hooks.get(elem, true, extra);\n", " }\n", " // Otherwise, if a way to get the computed value exists, use that\n", " if (val === undefined) {\n", " val = curCSS(elem, name, styles);\n", " }\n", " // Convert \"normal\" to computed value\n", " if (val === \"normal\" && name in cssNormalTransform) {\n", " val = cssNormalTransform[name];\n", " }\n", " // Make numeric if forced or a qualifier was provided and val looks numeric\n", " if (extra === \"\" || extra) {\n", " num = parseFloat(val);\n", " return extra === true || isFinite(num) ? num || 0 : val;\n", " }\n", " return val;\n", " }\n", " });\n", " jQuery.each([\"height\", \"width\"], function (_i, dimension) {\n", " jQuery.cssHooks[dimension] = {\n", " get: function (elem, computed, extra) {\n", " if (computed) {\n", " // Certain elements can have dimension info if we invisibly show them\n", " // but it must have a current display style that would benefit\n", " return rdisplayswap.test(jQuery.css(elem, \"display\")) &&\n", " // Support: Safari 8+\n", " // Table columns in Safari have non-zero offsetWidth & zero\n", " // getBoundingClientRect().width unless display is changed.\n", " // Support: IE <=11 only\n", " // Running getBoundingClientRect on a disconnected node\n", " // in IE throws an error.\n", " (!elem.getClientRects().length || !elem.getBoundingClientRect().width) ?\n", " swap(elem, cssShow, function () {\n", " return getWidthOrHeight(elem, dimension, extra);\n", " }) :\n", " getWidthOrHeight(elem, dimension, extra);\n", " }\n", " },\n", " set: function (elem, value, extra) {\n", " var matches, styles = getStyles(elem), \n", " // Only read styles.position if the test has a chance to fail\n", " // to avoid forcing a reflow.\n", " scrollboxSizeBuggy = !support.scrollboxSize() &&\n", " styles.position === \"absolute\", \n", " // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)\n", " boxSizingNeeded = scrollboxSizeBuggy || extra, isBorderBox = boxSizingNeeded &&\n", " jQuery.css(elem, \"boxSizing\", false, styles) === \"border-box\", subtract = extra ?\n", " boxModelAdjustment(elem, dimension, extra, isBorderBox, styles) :\n", " 0;\n", " // Account for unreliable border-box dimensions by comparing offset* to computed and\n", " // faking a content-box to get border and padding (gh-3699)\n", " if (isBorderBox && scrollboxSizeBuggy) {\n", " subtract -= Math.ceil(elem[\"offset\" + dimension[0].toUpperCase() + dimension.slice(1)] -\n", " parseFloat(styles[dimension]) -\n", " boxModelAdjustment(elem, dimension, \"border\", false, styles) -\n", " 0.5);\n", " }\n", " // Convert to pixels if value adjustment is needed\n", " if (subtract && (matches = rcssNum.exec(value)) &&\n", " (matches[3] || \"px\") !== \"px\") {\n", " elem.style[dimension] = value;\n", " value = jQuery.css(elem, dimension);\n", " }\n", " return setPositiveNumber(elem, value, subtract);\n", " }\n", " };\n", " });\n", " jQuery.cssHooks.marginLeft = addGetHookIf(support.reliableMarginLeft, function (elem, computed) {\n", " if (computed) {\n", " return (parseFloat(curCSS(elem, \"marginLeft\")) ||\n", " elem.getBoundingClientRect().left -\n", " swap(elem, { marginLeft: 0 }, function () {\n", " return elem.getBoundingClientRect().left;\n", " })) + \"px\";\n", " }\n", " });\n", " // These hooks are used by animate to expand properties\n", " jQuery.each({\n", " margin: \"\",\n", " padding: \"\",\n", " border: \"Width\"\n", " }, function (prefix, suffix) {\n", " jQuery.cssHooks[prefix + suffix] = {\n", " expand: function (value) {\n", " var i = 0, expanded = {}, \n", " // Assumes a single number if not a string\n", " parts = typeof value === \"string\" ? value.split(\" \") : [value];\n", " for (; i < 4; i++) {\n", " expanded[prefix + cssExpand[i] + suffix] =\n", " parts[i] || parts[i - 2] || parts[0];\n", " }\n", " return expanded;\n", " }\n", " };\n", " if (prefix !== \"margin\") {\n", " jQuery.cssHooks[prefix + suffix].set = setPositiveNumber;\n", " }\n", " });\n", " jQuery.fn.extend({\n", " css: function (name, value) {\n", " return access(this, function (elem, name, value) {\n", " var styles, len, map = {}, i = 0;\n", " if (Array.isArray(name)) {\n", " styles = getStyles(elem);\n", " len = name.length;\n", " for (; i < len; i++) {\n", " map[name[i]] = jQuery.css(elem, name[i], false, styles);\n", " }\n", " return map;\n", " }\n", " return value !== undefined ?\n", " jQuery.style(elem, name, value) :\n", " jQuery.css(elem, name);\n", " }, name, value, arguments.length > 1);\n", " }\n", " });\n", " function Tween(elem, options, prop, end, easing) {\n", " return new Tween.prototype.init(elem, options, prop, end, easing);\n", " }\n", " jQuery.Tween = Tween;\n", " Tween.prototype = {\n", " constructor: Tween,\n", " init: function (elem, options, prop, end, easing, unit) {\n", " this.elem = elem;\n", " this.prop = prop;\n", " this.easing = easing || jQuery.easing._default;\n", " this.options = options;\n", " this.start = this.now = this.cur();\n", " this.end = end;\n", " this.unit = unit || (jQuery.cssNumber[prop] ? \"\" : \"px\");\n", " },\n", " cur: function () {\n", " var hooks = Tween.propHooks[this.prop];\n", " return hooks && hooks.get ?\n", " hooks.get(this) :\n", " Tween.propHooks._default.get(this);\n", " },\n", " run: function (percent) {\n", " var eased, hooks = Tween.propHooks[this.prop];\n", " if (this.options.duration) {\n", " this.pos = eased = jQuery.easing[this.easing](percent, this.options.duration * percent, 0, 1, this.options.duration);\n", " }\n", " else {\n", " this.pos = eased = percent;\n", " }\n", " this.now = (this.end - this.start) * eased + this.start;\n", " if (this.options.step) {\n", " this.options.step.call(this.elem, this.now, this);\n", " }\n", " if (hooks && hooks.set) {\n", " hooks.set(this);\n", " }\n", " else {\n", " Tween.propHooks._default.set(this);\n", " }\n", " return this;\n", " }\n", " };\n", " Tween.prototype.init.prototype = Tween.prototype;\n", " Tween.propHooks = {\n", " _default: {\n", " get: function (tween) {\n", " var result;\n", " // Use a property on the element directly when it is not a DOM element,\n", " // or when there is no matching style property that exists.\n", " if (tween.elem.nodeType !== 1 ||\n", " tween.elem[tween.prop] != null && tween.elem.style[tween.prop] == null) {\n", " return tween.elem[tween.prop];\n", " }\n", " // Passing an empty string as a 3rd parameter to .css will automatically\n", " // attempt a parseFloat and fallback to a string if the parse fails.\n", " // Simple values such as \"10px\" are parsed to Float;\n", " // complex values such as \"rotate(1rad)\" are returned as-is.\n", " result = jQuery.css(tween.elem, tween.prop, \"\");\n", " // Empty strings, null, undefined and \"auto\" are converted to 0.\n", " return !result || result === \"auto\" ? 0 : result;\n", " },\n", " set: function (tween) {\n", " // Use step hook for back compat.\n", " // Use cssHook if its there.\n", " // Use .style if available and use plain properties where available.\n", " if (jQuery.fx.step[tween.prop]) {\n", " jQuery.fx.step[tween.prop](tween);\n", " }\n", " else if (tween.elem.nodeType === 1 && (jQuery.cssHooks[tween.prop] ||\n", " tween.elem.style[finalPropName(tween.prop)] != null)) {\n", " jQuery.style(tween.elem, tween.prop, tween.now + tween.unit);\n", " }\n", " else {\n", " tween.elem[tween.prop] = tween.now;\n", " }\n", " }\n", " }\n", " };\n", " // Support: IE <=9 only\n", " // Panic based approach to setting things on disconnected nodes\n", " Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {\n", " set: function (tween) {\n", " if (tween.elem.nodeType && tween.elem.parentNode) {\n", " tween.elem[tween.prop] = tween.now;\n", " }\n", " }\n", " };\n", " jQuery.easing = {\n", " linear: function (p) {\n", " return p;\n", " },\n", " swing: function (p) {\n", " return 0.5 - Math.cos(p * Math.PI) / 2;\n", " },\n", " _default: \"swing\"\n", " };\n", " jQuery.fx = Tween.prototype.init;\n", " // Back compat <1.8 extension point\n", " jQuery.fx.step = {};\n", " var fxNow, inProgress, rfxtypes = /^(?:toggle|show|hide)$/, rrun = /queueHooks$/;\n", " function schedule() {\n", " if (inProgress) {\n", " if (document.hidden === false && window.requestAnimationFrame) {\n", " window.requestAnimationFrame(schedule);\n", " }\n", " else {\n", " window.setTimeout(schedule, jQuery.fx.interval);\n", " }\n", " jQuery.fx.tick();\n", " }\n", " }\n", " // Animations created synchronously will run synchronously\n", " function createFxNow() {\n", " window.setTimeout(function () {\n", " fxNow = undefined;\n", " });\n", " return (fxNow = Date.now());\n", " }\n", " // Generate parameters to create a standard animation\n", " function genFx(type, includeWidth) {\n", " var which, i = 0, attrs = { height: type };\n", " // If we include width, step value is 1 to do all cssExpand values,\n", " // otherwise step value is 2 to skip over Left and Right\n", " includeWidth = includeWidth ? 1 : 0;\n", " for (; i < 4; i += 2 - includeWidth) {\n", " which = cssExpand[i];\n", " attrs[\"margin\" + which] = attrs[\"padding\" + which] = type;\n", " }\n", " if (includeWidth) {\n", " attrs.opacity = attrs.width = type;\n", " }\n", " return attrs;\n", " }\n", " function createTween(value, prop, animation) {\n", " var tween, collection = (Animation.tweeners[prop] || []).concat(Animation.tweeners[\"*\"]), index = 0, length = collection.length;\n", " for (; index < length; index++) {\n", " if ((tween = collection[index].call(animation, prop, value))) {\n", " // We're done with this property\n", " return tween;\n", " }\n", " }\n", " }\n", " function defaultPrefilter(elem, props, opts) {\n", " var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, isBox = \"width\" in props || \"height\" in props, anim = this, orig = {}, style = elem.style, hidden = elem.nodeType && isHiddenWithinTree(elem), dataShow = dataPriv.get(elem, \"fxshow\");\n", " // Queue-skipping animations hijack the fx hooks\n", " if (!opts.queue) {\n", " hooks = jQuery._queueHooks(elem, \"fx\");\n", " if (hooks.unqueued == null) {\n", " hooks.unqueued = 0;\n", " oldfire = hooks.empty.fire;\n", " hooks.empty.fire = function () {\n", " if (!hooks.unqueued) {\n", " oldfire();\n", " }\n", " };\n", " }\n", " hooks.unqueued++;\n", " anim.always(function () {\n", " // Ensure the complete handler is called before this completes\n", " anim.always(function () {\n", " hooks.unqueued--;\n", " if (!jQuery.queue(elem, \"fx\").length) {\n", " hooks.empty.fire();\n", " }\n", " });\n", " });\n", " }\n", " // Detect show/hide animations\n", " for (prop in props) {\n", " value = props[prop];\n", " if (rfxtypes.test(value)) {\n", " delete props[prop];\n", " toggle = toggle || value === \"toggle\";\n", " if (value === (hidden ? \"hide\" : \"show\")) {\n", " // Pretend to be hidden if this is a \"show\" and\n", " // there is still data from a stopped show/hide\n", " if (value === \"show\" && dataShow && dataShow[prop] !== undefined) {\n", " hidden = true;\n", " // Ignore all other no-op show/hide data\n", " }\n", " else {\n", " continue;\n", " }\n", " }\n", " orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop);\n", " }\n", " }\n", " // Bail out if this is a no-op like .hide().hide()\n", " propTween = !jQuery.isEmptyObject(props);\n", " if (!propTween && jQuery.isEmptyObject(orig)) {\n", " return;\n", " }\n", " // Restrict \"overflow\" and \"display\" styles during box animations\n", " if (isBox && elem.nodeType === 1) {\n", " // Support: IE <=9 - 11, Edge 12 - 15\n", " // Record all 3 overflow attributes because IE does not infer the shorthand\n", " // from identically-valued overflowX and overflowY and Edge just mirrors\n", " // the overflowX value there.\n", " opts.overflow = [style.overflow, style.overflowX, style.overflowY];\n", " // Identify a display type, preferring old show/hide data over the CSS cascade\n", " restoreDisplay = dataShow && dataShow.display;\n", " if (restoreDisplay == null) {\n", " restoreDisplay = dataPriv.get(elem, \"display\");\n", " }\n", " display = jQuery.css(elem, \"display\");\n", " if (display === \"none\") {\n", " if (restoreDisplay) {\n", " display = restoreDisplay;\n", " }\n", " else {\n", " // Get nonempty value(s) by temporarily forcing visibility\n", " showHide([elem], true);\n", " restoreDisplay = elem.style.display || restoreDisplay;\n", " display = jQuery.css(elem, \"display\");\n", " showHide([elem]);\n", " }\n", " }\n", " // Animate inline elements as inline-block\n", " if (display === \"inline\" || display === \"inline-block\" && restoreDisplay != null) {\n", " if (jQuery.css(elem, \"float\") === \"none\") {\n", " // Restore the original display value at the end of pure show/hide animations\n", " if (!propTween) {\n", " anim.done(function () {\n", " style.display = restoreDisplay;\n", " });\n", " if (restoreDisplay == null) {\n", " display = style.display;\n", " restoreDisplay = display === \"none\" ? \"\" : display;\n", " }\n", " }\n", " style.display = \"inline-block\";\n", " }\n", " }\n", " }\n", " if (opts.overflow) {\n", " style.overflow = \"hidden\";\n", " anim.always(function () {\n", " style.overflow = opts.overflow[0];\n", " style.overflowX = opts.overflow[1];\n", " style.overflowY = opts.overflow[2];\n", " });\n", " }\n", " // Implement show/hide animations\n", " propTween = false;\n", " for (prop in orig) {\n", " // General show/hide setup for this element animation\n", " if (!propTween) {\n", " if (dataShow) {\n", " if (\"hidden\" in dataShow) {\n", " hidden = dataShow.hidden;\n", " }\n", " }\n", " else {\n", " dataShow = dataPriv.access(elem, \"fxshow\", { display: restoreDisplay });\n", " }\n", " // Store hidden/visible for toggle so `.stop().toggle()` \"reverses\"\n", " if (toggle) {\n", " dataShow.hidden = !hidden;\n", " }\n", " // Show elements before animating them\n", " if (hidden) {\n", " showHide([elem], true);\n", " }\n", " /* eslint-disable no-loop-func */\n", " anim.done(function () {\n", " /* eslint-enable no-loop-func */\n", " // The final step of a \"hide\" animation is actually hiding the element\n", " if (!hidden) {\n", " showHide([elem]);\n", " }\n", " dataPriv.remove(elem, \"fxshow\");\n", " for (prop in orig) {\n", " jQuery.style(elem, prop, orig[prop]);\n", " }\n", " });\n", " }\n", " // Per-property setup\n", " propTween = createTween(hidden ? dataShow[prop] : 0, prop, anim);\n", " if (!(prop in dataShow)) {\n", " dataShow[prop] = propTween.start;\n", " if (hidden) {\n", " propTween.end = propTween.start;\n", " propTween.start = 0;\n", " }\n", " }\n", " }\n", " }\n", " function propFilter(props, specialEasing) {\n", " var index, name, easing, value, hooks;\n", " // camelCase, specialEasing and expand cssHook pass\n", " for (index in props) {\n", " name = camelCase(index);\n", " easing = specialEasing[name];\n", " value = props[index];\n", " if (Array.isArray(value)) {\n", " easing = value[1];\n", " value = props[index] = value[0];\n", " }\n", " if (index !== name) {\n", " props[name] = value;\n", " delete props[index];\n", " }\n", " hooks = jQuery.cssHooks[name];\n", " if (hooks && \"expand\" in hooks) {\n", " value = hooks.expand(value);\n", " delete props[name];\n", " // Not quite $.extend, this won't overwrite existing keys.\n", " // Reusing 'index' because we have the correct \"name\"\n", " for (index in value) {\n", " if (!(index in props)) {\n", " props[index] = value[index];\n", " specialEasing[index] = easing;\n", " }\n", " }\n", " }\n", " else {\n", " specialEasing[name] = easing;\n", " }\n", " }\n", " }\n", " function Animation(elem, properties, options) {\n", " var result, stopped, index = 0, length = Animation.prefilters.length, deferred = jQuery.Deferred().always(function () {\n", " // Don't match elem in the :animated selector\n", " delete tick.elem;\n", " }), tick = function () {\n", " if (stopped) {\n", " return false;\n", " }\n", " var currentTime = fxNow || createFxNow(), remaining = Math.max(0, animation.startTime + animation.duration - currentTime), \n", " // Support: Android 2.3 only\n", " // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)\n", " temp = remaining / animation.duration || 0, percent = 1 - temp, index = 0, length = animation.tweens.length;\n", " for (; index < length; index++) {\n", " animation.tweens[index].run(percent);\n", " }\n", " deferred.notifyWith(elem, [animation, percent, remaining]);\n", " // If there's more to do, yield\n", " if (percent < 1 && length) {\n", " return remaining;\n", " }\n", " // If this was an empty animation, synthesize a final progress notification\n", " if (!length) {\n", " deferred.notifyWith(elem, [animation, 1, 0]);\n", " }\n", " // Resolve the animation and report its conclusion\n", " deferred.resolveWith(elem, [animation]);\n", " return false;\n", " }, animation = deferred.promise({\n", " elem: elem,\n", " props: jQuery.extend({}, properties),\n", " opts: jQuery.extend(true, {\n", " specialEasing: {},\n", " easing: jQuery.easing._default\n", " }, options),\n", " originalProperties: properties,\n", " originalOptions: options,\n", " startTime: fxNow || createFxNow(),\n", " duration: options.duration,\n", " tweens: [],\n", " createTween: function (prop, end) {\n", " var tween = jQuery.Tween(elem, animation.opts, prop, end, animation.opts.specialEasing[prop] || animation.opts.easing);\n", " animation.tweens.push(tween);\n", " return tween;\n", " },\n", " stop: function (gotoEnd) {\n", " var index = 0, \n", " // If we are going to the end, we want to run all the tweens\n", " // otherwise we skip this part\n", " length = gotoEnd ? animation.tweens.length : 0;\n", " if (stopped) {\n", " return this;\n", " }\n", " stopped = true;\n", " for (; index < length; index++) {\n", " animation.tweens[index].run(1);\n", " }\n", " // Resolve when we played the last frame; otherwise, reject\n", " if (gotoEnd) {\n", " deferred.notifyWith(elem, [animation, 1, 0]);\n", " deferred.resolveWith(elem, [animation, gotoEnd]);\n", " }\n", " else {\n", " deferred.rejectWith(elem, [animation, gotoEnd]);\n", " }\n", " return this;\n", " }\n", " }), props = animation.props;\n", " propFilter(props, animation.opts.specialEasing);\n", " for (; index < length; index++) {\n", " result = Animation.prefilters[index].call(animation, elem, props, animation.opts);\n", " if (result) {\n", " if (isFunction(result.stop)) {\n", " jQuery._queueHooks(animation.elem, animation.opts.queue).stop =\n", " result.stop.bind(result);\n", " }\n", " return result;\n", " }\n", " }\n", " jQuery.map(props, createTween, animation);\n", " if (isFunction(animation.opts.start)) {\n", " animation.opts.start.call(elem, animation);\n", " }\n", " // Attach callbacks from options\n", " animation\n", " .progress(animation.opts.progress)\n", " .done(animation.opts.done, animation.opts.complete)\n", " .fail(animation.opts.fail)\n", " .always(animation.opts.always);\n", " jQuery.fx.timer(jQuery.extend(tick, {\n", " elem: elem,\n", " anim: animation,\n", " queue: animation.opts.queue\n", " }));\n", " return animation;\n", " }\n", " jQuery.Animation = jQuery.extend(Animation, {\n", " tweeners: {\n", " \"*\": [function (prop, value) {\n", " var tween = this.createTween(prop, value);\n", " adjustCSS(tween.elem, prop, rcssNum.exec(value), tween);\n", " return tween;\n", " }]\n", " },\n", " tweener: function (props, callback) {\n", " if (isFunction(props)) {\n", " callback = props;\n", " props = [\"*\"];\n", " }\n", " else {\n", " props = props.match(rnothtmlwhite);\n", " }\n", " var prop, index = 0, length = props.length;\n", " for (; index < length; index++) {\n", " prop = props[index];\n", " Animation.tweeners[prop] = Animation.tweeners[prop] || [];\n", " Animation.tweeners[prop].unshift(callback);\n", " }\n", " },\n", " prefilters: [defaultPrefilter],\n", " prefilter: function (callback, prepend) {\n", " if (prepend) {\n", " Animation.prefilters.unshift(callback);\n", " }\n", " else {\n", " Animation.prefilters.push(callback);\n", " }\n", " }\n", " });\n", " jQuery.speed = function (speed, easing, fn) {\n", " var opt = speed && typeof speed === \"object\" ? jQuery.extend({}, speed) : {\n", " complete: fn || !fn && easing ||\n", " isFunction(speed) && speed,\n", " duration: speed,\n", " easing: fn && easing || easing && !isFunction(easing) && easing\n", " };\n", " // Go to the end state if fx are off\n", " if (jQuery.fx.off) {\n", " opt.duration = 0;\n", " }\n", " else {\n", " if (typeof opt.duration !== \"number\") {\n", " if (opt.duration in jQuery.fx.speeds) {\n", " opt.duration = jQuery.fx.speeds[opt.duration];\n", " }\n", " else {\n", " opt.duration = jQuery.fx.speeds._default;\n", " }\n", " }\n", " }\n", " // Normalize opt.queue - true/undefined/null -> \"fx\"\n", " if (opt.queue == null || opt.queue === true) {\n", " opt.queue = \"fx\";\n", " }\n", " // Queueing\n", " opt.old = opt.complete;\n", " opt.complete = function () {\n", " if (isFunction(opt.old)) {\n", " opt.old.call(this);\n", " }\n", " if (opt.queue) {\n", " jQuery.dequeue(this, opt.queue);\n", " }\n", " };\n", " return opt;\n", " };\n", " jQuery.fn.extend({\n", " fadeTo: function (speed, to, easing, callback) {\n", " // Show any hidden elements after setting opacity to 0\n", " return this.filter(isHiddenWithinTree).css(\"opacity\", 0).show()\n", " // Animate to the value specified\n", " .end().animate({ opacity: to }, speed, easing, callback);\n", " },\n", " animate: function (prop, speed, easing, callback) {\n", " var empty = jQuery.isEmptyObject(prop), optall = jQuery.speed(speed, easing, callback), doAnimation = function () {\n", " // Operate on a copy of prop so per-property easing won't be lost\n", " var anim = Animation(this, jQuery.extend({}, prop), optall);\n", " // Empty animations, or finishing resolves immediately\n", " if (empty || dataPriv.get(this, \"finish\")) {\n", " anim.stop(true);\n", " }\n", " };\n", " doAnimation.finish = doAnimation;\n", " return empty || optall.queue === false ?\n", " this.each(doAnimation) :\n", " this.queue(optall.queue, doAnimation);\n", " },\n", " stop: function (type, clearQueue, gotoEnd) {\n", " var stopQueue = function (hooks) {\n", " var stop = hooks.stop;\n", " delete hooks.stop;\n", " stop(gotoEnd);\n", " };\n", " if (typeof type !== \"string\") {\n", " gotoEnd = clearQueue;\n", " clearQueue = type;\n", " type = undefined;\n", " }\n", " if (clearQueue) {\n", " this.queue(type || \"fx\", []);\n", " }\n", " return this.each(function () {\n", " var dequeue = true, index = type != null && type + \"queueHooks\", timers = jQuery.timers, data = dataPriv.get(this);\n", " if (index) {\n", " if (data[index] && data[index].stop) {\n", " stopQueue(data[index]);\n", " }\n", " }\n", " else {\n", " for (index in data) {\n", " if (data[index] && data[index].stop && rrun.test(index)) {\n", " stopQueue(data[index]);\n", " }\n", " }\n", " }\n", " for (index = timers.length; index--;) {\n", " if (timers[index].elem === this &&\n", " (type == null || timers[index].queue === type)) {\n", " timers[index].anim.stop(gotoEnd);\n", " dequeue = false;\n", " timers.splice(index, 1);\n", " }\n", " }\n", " // Start the next in the queue if the last step wasn't forced.\n", " // Timers currently will call their complete callbacks, which\n", " // will dequeue but only if they were gotoEnd.\n", " if (dequeue || !gotoEnd) {\n", " jQuery.dequeue(this, type);\n", " }\n", " });\n", " },\n", " finish: function (type) {\n", " if (type !== false) {\n", " type = type || \"fx\";\n", " }\n", " return this.each(function () {\n", " var index, data = dataPriv.get(this), queue = data[type + \"queue\"], hooks = data[type + \"queueHooks\"], timers = jQuery.timers, length = queue ? queue.length : 0;\n", " // Enable finishing flag on private data\n", " data.finish = true;\n", " // Empty the queue first\n", " jQuery.queue(this, type, []);\n", " if (hooks && hooks.stop) {\n", " hooks.stop.call(this, true);\n", " }\n", " // Look for any active animations, and finish them\n", " for (index = timers.length; index--;) {\n", " if (timers[index].elem === this && timers[index].queue === type) {\n", " timers[index].anim.stop(true);\n", " timers.splice(index, 1);\n", " }\n", " }\n", " // Look for any animations in the old queue and finish them\n", " for (index = 0; index < length; index++) {\n", " if (queue[index] && queue[index].finish) {\n", " queue[index].finish.call(this);\n", " }\n", " }\n", " // Turn off finishing flag\n", " delete data.finish;\n", " });\n", " }\n", " });\n", " jQuery.each([\"toggle\", \"show\", \"hide\"], function (_i, name) {\n", " var cssFn = jQuery.fn[name];\n", " jQuery.fn[name] = function (speed, easing, callback) {\n", " return speed == null || typeof speed === \"boolean\" ?\n", " cssFn.apply(this, arguments) :\n", " this.animate(genFx(name, true), speed, easing, callback);\n", " };\n", " });\n", " // Generate shortcuts for custom animations\n", " jQuery.each({\n", " slideDown: genFx(\"show\"),\n", " slideUp: genFx(\"hide\"),\n", " slideToggle: genFx(\"toggle\"),\n", " fadeIn: { opacity: \"show\" },\n", " fadeOut: { opacity: \"hide\" },\n", " fadeToggle: { opacity: \"toggle\" }\n", " }, function (name, props) {\n", " jQuery.fn[name] = function (speed, easing, callback) {\n", " return this.animate(props, speed, easing, callback);\n", " };\n", " });\n", " jQuery.timers = [];\n", " jQuery.fx.tick = function () {\n", " var timer, i = 0, timers = jQuery.timers;\n", " fxNow = Date.now();\n", " for (; i < timers.length; i++) {\n", " timer = timers[i];\n", " // Run the timer and safely remove it when done (allowing for external removal)\n", " if (!timer() && timers[i] === timer) {\n", " timers.splice(i--, 1);\n", " }\n", " }\n", " if (!timers.length) {\n", " jQuery.fx.stop();\n", " }\n", " fxNow = undefined;\n", " };\n", " jQuery.fx.timer = function (timer) {\n", " jQuery.timers.push(timer);\n", " jQuery.fx.start();\n", " };\n", " jQuery.fx.interval = 13;\n", " jQuery.fx.start = function () {\n", " if (inProgress) {\n", " return;\n", " }\n", " inProgress = true;\n", " schedule();\n", " };\n", " jQuery.fx.stop = function () {\n", " inProgress = null;\n", " };\n", " jQuery.fx.speeds = {\n", " slow: 600,\n", " fast: 200,\n", " // Default speed\n", " _default: 400\n", " };\n", " // Based off of the plugin by Clint Helfers, with permission.\n", " // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/\n", " jQuery.fn.delay = function (time, type) {\n", " time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;\n", " type = type || \"fx\";\n", " return this.queue(type, function (next, hooks) {\n", " var timeout = window.setTimeout(next, time);\n", " hooks.stop = function () {\n", " window.clearTimeout(timeout);\n", " };\n", " });\n", " };\n", " (function () {\n", " var input = document.createElement(\"input\"), select = document.createElement(\"select\"), opt = select.appendChild(document.createElement(\"option\"));\n", " input.type = \"checkbox\";\n", " // Support: Android <=4.3 only\n", " // Default value for a checkbox should be \"on\"\n", " support.checkOn = input.value !== \"\";\n", " // Support: IE <=11 only\n", " // Must access selectedIndex to make default options select\n", " support.optSelected = opt.selected;\n", " // Support: IE <=11 only\n", " // An input loses its value after becoming a radio\n", " input = document.createElement(\"input\");\n", " input.value = \"t\";\n", " input.type = \"radio\";\n", " support.radioValue = input.value === \"t\";\n", " })();\n", " var boolHook, attrHandle = jQuery.expr.attrHandle;\n", " jQuery.fn.extend({\n", " attr: function (name, value) {\n", " return access(this, jQuery.attr, name, value, arguments.length > 1);\n", " },\n", " removeAttr: function (name) {\n", " return this.each(function () {\n", " jQuery.removeAttr(this, name);\n", " });\n", " }\n", " });\n", " jQuery.extend({\n", " attr: function (elem, name, value) {\n", " var ret, hooks, nType = elem.nodeType;\n", " // Don't get/set attributes on text, comment and attribute nodes\n", " if (nType === 3 || nType === 8 || nType === 2) {\n", " return;\n", " }\n", " // Fallback to prop when attributes are not supported\n", " if (typeof elem.getAttribute === \"undefined\") {\n", " return jQuery.prop(elem, name, value);\n", " }\n", " // Attribute hooks are determined by the lowercase version\n", " // Grab necessary hook if one is defined\n", " if (nType !== 1 || !jQuery.isXMLDoc(elem)) {\n", " hooks = jQuery.attrHooks[name.toLowerCase()] ||\n", " (jQuery.expr.match.bool.test(name) ? boolHook : undefined);\n", " }\n", " if (value !== undefined) {\n", " if (value === null) {\n", " jQuery.removeAttr(elem, name);\n", " return;\n", " }\n", " if (hooks && \"set\" in hooks &&\n", " (ret = hooks.set(elem, value, name)) !== undefined) {\n", " return ret;\n", " }\n", " elem.setAttribute(name, value + \"\");\n", " return value;\n", " }\n", " if (hooks && \"get\" in hooks && (ret = hooks.get(elem, name)) !== null) {\n", " return ret;\n", " }\n", " ret = jQuery.find.attr(elem, name);\n", " // Non-existent attributes return null, we normalize to undefined\n", " return ret == null ? undefined : ret;\n", " },\n", " attrHooks: {\n", " type: {\n", " set: function (elem, value) {\n", " if (!support.radioValue && value === \"radio\" &&\n", " nodeName(elem, \"input\")) {\n", " var val = elem.value;\n", " elem.setAttribute(\"type\", value);\n", " if (val) {\n", " elem.value = val;\n", " }\n", " return value;\n", " }\n", " }\n", " }\n", " },\n", " removeAttr: function (elem, value) {\n", " var name, i = 0, \n", " // Attribute names can contain non-HTML whitespace characters\n", " // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2\n", " attrNames = value && value.match(rnothtmlwhite);\n", " if (attrNames && elem.nodeType === 1) {\n", " while ((name = attrNames[i++])) {\n", " elem.removeAttribute(name);\n", " }\n", " }\n", " }\n", " });\n", " // Hooks for boolean attributes\n", " boolHook = {\n", " set: function (elem, value, name) {\n", " if (value === false) {\n", " // Remove boolean attributes when set to false\n", " jQuery.removeAttr(elem, name);\n", " }\n", " else {\n", " elem.setAttribute(name, name);\n", " }\n", " return name;\n", " }\n", " };\n", " jQuery.each(jQuery.expr.match.bool.source.match(/\\w+/g), function (_i, name) {\n", " var getter = attrHandle[name] || jQuery.find.attr;\n", " attrHandle[name] = function (elem, name, isXML) {\n", " var ret, handle, lowercaseName = name.toLowerCase();\n", " if (!isXML) {\n", " // Avoid an infinite loop by temporarily removing this function from the getter\n", " handle = attrHandle[lowercaseName];\n", " attrHandle[lowercaseName] = ret;\n", " ret = getter(elem, name, isXML) != null ?\n", " lowercaseName :\n", " null;\n", " attrHandle[lowercaseName] = handle;\n", " }\n", " return ret;\n", " };\n", " });\n", " var rfocusable = /^(?:input|select|textarea|button)$/i, rclickable = /^(?:a|area)$/i;\n", " jQuery.fn.extend({\n", " prop: function (name, value) {\n", " return access(this, jQuery.prop, name, value, arguments.length > 1);\n", " },\n", " removeProp: function (name) {\n", " return this.each(function () {\n", " delete this[jQuery.propFix[name] || name];\n", " });\n", " }\n", " });\n", " jQuery.extend({\n", " prop: function (elem, name, value) {\n", " var ret, hooks, nType = elem.nodeType;\n", " // Don't get/set properties on text, comment and attribute nodes\n", " if (nType === 3 || nType === 8 || nType === 2) {\n", " return;\n", " }\n", " if (nType !== 1 || !jQuery.isXMLDoc(elem)) {\n", " // Fix name and attach hooks\n", " name = jQuery.propFix[name] || name;\n", " hooks = jQuery.propHooks[name];\n", " }\n", " if (value !== undefined) {\n", " if (hooks && \"set\" in hooks &&\n", " (ret = hooks.set(elem, value, name)) !== undefined) {\n", " return ret;\n", " }\n", " return (elem[name] = value);\n", " }\n", " if (hooks && \"get\" in hooks && (ret = hooks.get(elem, name)) !== null) {\n", " return ret;\n", " }\n", " return elem[name];\n", " },\n", " propHooks: {\n", " tabIndex: {\n", " get: function (elem) {\n", " // Support: IE <=9 - 11 only\n", " // elem.tabIndex doesn't always return the\n", " // correct value when it hasn't been explicitly set\n", " // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/\n", " // Use proper attribute retrieval(#12072)\n", " var tabindex = jQuery.find.attr(elem, \"tabindex\");\n", " if (tabindex) {\n", " return parseInt(tabindex, 10);\n", " }\n", " if (rfocusable.test(elem.nodeName) ||\n", " rclickable.test(elem.nodeName) &&\n", " elem.href) {\n", " return 0;\n", " }\n", " return -1;\n", " }\n", " }\n", " },\n", " propFix: {\n", " \"for\": \"htmlFor\",\n", " \"class\": \"className\"\n", " }\n", " });\n", " // Support: IE <=11 only\n", " // Accessing the selectedIndex property\n", " // forces the browser to respect setting selected\n", " // on the option\n", " // The getter ensures a default option is selected\n", " // when in an optgroup\n", " // eslint rule \"no-unused-expressions\" is disabled for this code\n", " // since it considers such accessions noop\n", " if (!support.optSelected) {\n", " jQuery.propHooks.selected = {\n", " get: function (elem) {\n", " /* eslint no-unused-expressions: \"off\" */\n", " var parent = elem.parentNode;\n", " if (parent && parent.parentNode) {\n", " parent.parentNode.selectedIndex;\n", " }\n", " return null;\n", " },\n", " set: function (elem) {\n", " /* eslint no-unused-expressions: \"off\" */\n", " var parent = elem.parentNode;\n", " if (parent) {\n", " parent.selectedIndex;\n", " if (parent.parentNode) {\n", " parent.parentNode.selectedIndex;\n", " }\n", " }\n", " }\n", " };\n", " }\n", " jQuery.each([\n", " \"tabIndex\",\n", " \"readOnly\",\n", " \"maxLength\",\n", " \"cellSpacing\",\n", " \"cellPadding\",\n", " \"rowSpan\",\n", " \"colSpan\",\n", " \"useMap\",\n", " \"frameBorder\",\n", " \"contentEditable\"\n", " ], function () {\n", " jQuery.propFix[this.toLowerCase()] = this;\n", " });\n", " // Strip and collapse whitespace according to HTML spec\n", " // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace\n", " function stripAndCollapse(value) {\n", " var tokens = value.match(rnothtmlwhite) || [];\n", " return tokens.join(\" \");\n", " }\n", " function getClass(elem) {\n", " return elem.getAttribute && elem.getAttribute(\"class\") || \"\";\n", " }\n", " function classesToArray(value) {\n", " if (Array.isArray(value)) {\n", " return value;\n", " }\n", " if (typeof value === \"string\") {\n", " return value.match(rnothtmlwhite) || [];\n", " }\n", " return [];\n", " }\n", " jQuery.fn.extend({\n", " addClass: function (value) {\n", " var classes, elem, cur, curValue, clazz, j, finalValue, i = 0;\n", " if (isFunction(value)) {\n", " return this.each(function (j) {\n", " jQuery(this).addClass(value.call(this, j, getClass(this)));\n", " });\n", " }\n", " classes = classesToArray(value);\n", " if (classes.length) {\n", " while ((elem = this[i++])) {\n", " curValue = getClass(elem);\n", " cur = elem.nodeType === 1 && (\" \" + stripAndCollapse(curValue) + \" \");\n", " if (cur) {\n", " j = 0;\n", " while ((clazz = classes[j++])) {\n", " if (cur.indexOf(\" \" + clazz + \" \") < 0) {\n", " cur += clazz + \" \";\n", " }\n", " }\n", " // Only assign if different to avoid unneeded rendering.\n", " finalValue = stripAndCollapse(cur);\n", " if (curValue !== finalValue) {\n", " elem.setAttribute(\"class\", finalValue);\n", " }\n", " }\n", " }\n", " }\n", " return this;\n", " },\n", " removeClass: function (value) {\n", " var classes, elem, cur, curValue, clazz, j, finalValue, i = 0;\n", " if (isFunction(value)) {\n", " return this.each(function (j) {\n", " jQuery(this).removeClass(value.call(this, j, getClass(this)));\n", " });\n", " }\n", " if (!arguments.length) {\n", " return this.attr(\"class\", \"\");\n", " }\n", " classes = classesToArray(value);\n", " if (classes.length) {\n", " while ((elem = this[i++])) {\n", " curValue = getClass(elem);\n", " // This expression is here for better compressibility (see addClass)\n", " cur = elem.nodeType === 1 && (\" \" + stripAndCollapse(curValue) + \" \");\n", " if (cur) {\n", " j = 0;\n", " while ((clazz = classes[j++])) {\n", " // Remove *all* instances\n", " while (cur.indexOf(\" \" + clazz + \" \") > -1) {\n", " cur = cur.replace(\" \" + clazz + \" \", \" \");\n", " }\n", " }\n", " // Only assign if different to avoid unneeded rendering.\n", " finalValue = stripAndCollapse(cur);\n", " if (curValue !== finalValue) {\n", " elem.setAttribute(\"class\", finalValue);\n", " }\n", " }\n", " }\n", " }\n", " return this;\n", " },\n", " toggleClass: function (value, stateVal) {\n", " var type = typeof value, isValidValue = type === \"string\" || Array.isArray(value);\n", " if (typeof stateVal === \"boolean\" && isValidValue) {\n", " return stateVal ? this.addClass(value) : this.removeClass(value);\n", " }\n", " if (isFunction(value)) {\n", " return this.each(function (i) {\n", " jQuery(this).toggleClass(value.call(this, i, getClass(this), stateVal), stateVal);\n", " });\n", " }\n", " return this.each(function () {\n", " var className, i, self, classNames;\n", " if (isValidValue) {\n", " // Toggle individual class names\n", " i = 0;\n", " self = jQuery(this);\n", " classNames = classesToArray(value);\n", " while ((className = classNames[i++])) {\n", " // Check each className given, space separated list\n", " if (self.hasClass(className)) {\n", " self.removeClass(className);\n", " }\n", " else {\n", " self.addClass(className);\n", " }\n", " }\n", " // Toggle whole class name\n", " }\n", " else if (value === undefined || type === \"boolean\") {\n", " className = getClass(this);\n", " if (className) {\n", " // Store className if set\n", " dataPriv.set(this, \"__className__\", className);\n", " }\n", " // If the element has a class name or if we're passed `false`,\n", " // then remove the whole classname (if there was one, the above saved it).\n", " // Otherwise bring back whatever was previously saved (if anything),\n", " // falling back to the empty string if nothing was stored.\n", " if (this.setAttribute) {\n", " this.setAttribute(\"class\", className || value === false ?\n", " \"\" :\n", " dataPriv.get(this, \"__className__\") || \"\");\n", " }\n", " }\n", " });\n", " },\n", " hasClass: function (selector) {\n", " var className, elem, i = 0;\n", " className = \" \" + selector + \" \";\n", " while ((elem = this[i++])) {\n", " if (elem.nodeType === 1 &&\n", " (\" \" + stripAndCollapse(getClass(elem)) + \" \").indexOf(className) > -1) {\n", " return true;\n", " }\n", " }\n", " return false;\n", " }\n", " });\n", " var rreturn = /\\r/g;\n", " jQuery.fn.extend({\n", " val: function (value) {\n", " var hooks, ret, valueIsFunction, elem = this[0];\n", " if (!arguments.length) {\n", " if (elem) {\n", " hooks = jQuery.valHooks[elem.type] ||\n", " jQuery.valHooks[elem.nodeName.toLowerCase()];\n", " if (hooks &&\n", " \"get\" in hooks &&\n", " (ret = hooks.get(elem, \"value\")) !== undefined) {\n", " return ret;\n", " }\n", " ret = elem.value;\n", " // Handle most common string cases\n", " if (typeof ret === \"string\") {\n", " return ret.replace(rreturn, \"\");\n", " }\n", " // Handle cases where value is null/undef or number\n", " return ret == null ? \"\" : ret;\n", " }\n", " return;\n", " }\n", " valueIsFunction = isFunction(value);\n", " return this.each(function (i) {\n", " var val;\n", " if (this.nodeType !== 1) {\n", " return;\n", " }\n", " if (valueIsFunction) {\n", " val = value.call(this, i, jQuery(this).val());\n", " }\n", " else {\n", " val = value;\n", " }\n", " // Treat null/undefined as \"\"; convert numbers to string\n", " if (val == null) {\n", " val = \"\";\n", " }\n", " else if (typeof val === \"number\") {\n", " val += \"\";\n", " }\n", " else if (Array.isArray(val)) {\n", " val = jQuery.map(val, function (value) {\n", " return value == null ? \"\" : value + \"\";\n", " });\n", " }\n", " hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()];\n", " // If set returns undefined, fall back to normal setting\n", " if (!hooks || !(\"set\" in hooks) || hooks.set(this, val, \"value\") === undefined) {\n", " this.value = val;\n", " }\n", " });\n", " }\n", " });\n", " jQuery.extend({\n", " valHooks: {\n", " option: {\n", " get: function (elem) {\n", " var val = jQuery.find.attr(elem, \"value\");\n", " return val != null ?\n", " val :\n", " // Support: IE <=10 - 11 only\n", " // option.text throws exceptions (#14686, #14858)\n", " // Strip and collapse whitespace\n", " // https://html.spec.whatwg.org/#strip-and-collapse-whitespace\n", " stripAndCollapse(jQuery.text(elem));\n", " }\n", " },\n", " select: {\n", " get: function (elem) {\n", " var value, option, i, options = elem.options, index = elem.selectedIndex, one = elem.type === \"select-one\", values = one ? null : [], max = one ? index + 1 : options.length;\n", " if (index < 0) {\n", " i = max;\n", " }\n", " else {\n", " i = one ? index : 0;\n", " }\n", " // Loop through all the selected options\n", " for (; i < max; i++) {\n", " option = options[i];\n", " // Support: IE <=9 only\n", " // IE8-9 doesn't update selected after form reset (#2551)\n", " if ((option.selected || i === index) &&\n", " // Don't return options that are disabled or in a disabled optgroup\n", " !option.disabled &&\n", " (!option.parentNode.disabled ||\n", " !nodeName(option.parentNode, \"optgroup\"))) {\n", " // Get the specific value for the option\n", " value = jQuery(option).val();\n", " // We don't need an array for one selects\n", " if (one) {\n", " return value;\n", " }\n", " // Multi-Selects return an array\n", " values.push(value);\n", " }\n", " }\n", " return values;\n", " },\n", " set: function (elem, value) {\n", " var optionSet, option, options = elem.options, values = jQuery.makeArray(value), i = options.length;\n", " while (i--) {\n", " option = options[i];\n", " /* eslint-disable no-cond-assign */\n", " if (option.selected =\n", " jQuery.inArray(jQuery.valHooks.option.get(option), values) > -1) {\n", " optionSet = true;\n", " }\n", " /* eslint-enable no-cond-assign */\n", " }\n", " // Force browsers to behave consistently when non-matching value is set\n", " if (!optionSet) {\n", " elem.selectedIndex = -1;\n", " }\n", " return values;\n", " }\n", " }\n", " }\n", " });\n", " // Radios and checkboxes getter/setter\n", " jQuery.each([\"radio\", \"checkbox\"], function () {\n", " jQuery.valHooks[this] = {\n", " set: function (elem, value) {\n", " if (Array.isArray(value)) {\n", " return (elem.checked = jQuery.inArray(jQuery(elem).val(), value) > -1);\n", " }\n", " }\n", " };\n", " if (!support.checkOn) {\n", " jQuery.valHooks[this].get = function (elem) {\n", " return elem.getAttribute(\"value\") === null ? \"on\" : elem.value;\n", " };\n", " }\n", " });\n", " // Return jQuery for attributes-only inclusion\n", " support.focusin = \"onfocusin\" in window;\n", " var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, stopPropagationCallback = function (e) {\n", " e.stopPropagation();\n", " };\n", " jQuery.extend(jQuery.event, {\n", " trigger: function (event, data, elem, onlyHandlers) {\n", " var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, eventPath = [elem || document], type = hasOwn.call(event, \"type\") ? event.type : event, namespaces = hasOwn.call(event, \"namespace\") ? event.namespace.split(\".\") : [];\n", " cur = lastElement = tmp = elem = elem || document;\n", " // Don't do events on text and comment nodes\n", " if (elem.nodeType === 3 || elem.nodeType === 8) {\n", " return;\n", " }\n", " // focus/blur morphs to focusin/out; ensure we're not firing them right now\n", " if (rfocusMorph.test(type + jQuery.event.triggered)) {\n", " return;\n", " }\n", " if (type.indexOf(\".\") > -1) {\n", " // Namespaced trigger; create a regexp to match event type in handle()\n", " namespaces = type.split(\".\");\n", " type = namespaces.shift();\n", " namespaces.sort();\n", " }\n", " ontype = type.indexOf(\":\") < 0 && \"on\" + type;\n", " // Caller can pass in a jQuery.Event object, Object, or just an event type string\n", " event = event[jQuery.expando] ?\n", " event :\n", " new jQuery.Event(type, typeof event === \"object\" && event);\n", " // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)\n", " event.isTrigger = onlyHandlers ? 2 : 3;\n", " event.namespace = namespaces.join(\".\");\n", " event.rnamespace = event.namespace ?\n", " new RegExp(\"(^|\\\\.)\" + namespaces.join(\"\\\\.(?:.*\\\\.|)\") + \"(\\\\.|$)\") :\n", " null;\n", " // Clean up the event in case it is being reused\n", " event.result = undefined;\n", " if (!event.target) {\n", " event.target = elem;\n", " }\n", " // Clone any incoming data and prepend the event, creating the handler arg list\n", " data = data == null ?\n", " [event] :\n", " jQuery.makeArray(data, [event]);\n", " // Allow special events to draw outside the lines\n", " special = jQuery.event.special[type] || {};\n", " if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) {\n", " return;\n", " }\n", " // Determine event propagation path in advance, per W3C events spec (#9951)\n", " // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)\n", " if (!onlyHandlers && !special.noBubble && !isWindow(elem)) {\n", " bubbleType = special.delegateType || type;\n", " if (!rfocusMorph.test(bubbleType + type)) {\n", " cur = cur.parentNode;\n", " }\n", " for (; cur; cur = cur.parentNode) {\n", " eventPath.push(cur);\n", " tmp = cur;\n", " }\n", " // Only add window if we got to document (e.g., not plain obj or detached DOM)\n", " if (tmp === (elem.ownerDocument || document)) {\n", " eventPath.push(tmp.defaultView || tmp.parentWindow || window);\n", " }\n", " }\n", " // Fire handlers on the event path\n", " i = 0;\n", " while ((cur = eventPath[i++]) && !event.isPropagationStopped()) {\n", " lastElement = cur;\n", " event.type = i > 1 ?\n", " bubbleType :\n", " special.bindType || type;\n", " // jQuery handler\n", " handle = (dataPriv.get(cur, \"events\") || Object.create(null))[event.type] &&\n", " dataPriv.get(cur, \"handle\");\n", " if (handle) {\n", " handle.apply(cur, data);\n", " }\n", " // Native handler\n", " handle = ontype && cur[ontype];\n", " if (handle && handle.apply && acceptData(cur)) {\n", " event.result = handle.apply(cur, data);\n", " if (event.result === false) {\n", " event.preventDefault();\n", " }\n", " }\n", " }\n", " event.type = type;\n", " // If nobody prevented the default action, do it now\n", " if (!onlyHandlers && !event.isDefaultPrevented()) {\n", " if ((!special._default ||\n", " special._default.apply(eventPath.pop(), data) === false) &&\n", " acceptData(elem)) {\n", " // Call a native DOM method on the target with the same name as the event.\n", " // Don't do default actions on window, that's where global variables be (#6170)\n", " if (ontype && isFunction(elem[type]) && !isWindow(elem)) {\n", " // Don't re-trigger an onFOO event when we call its FOO() method\n", " tmp = elem[ontype];\n", " if (tmp) {\n", " elem[ontype] = null;\n", " }\n", " // Prevent re-triggering of the same event, since we already bubbled it above\n", " jQuery.event.triggered = type;\n", " if (event.isPropagationStopped()) {\n", " lastElement.addEventListener(type, stopPropagationCallback);\n", " }\n", " elem[type]();\n", " if (event.isPropagationStopped()) {\n", " lastElement.removeEventListener(type, stopPropagationCallback);\n", " }\n", " jQuery.event.triggered = undefined;\n", " if (tmp) {\n", " elem[ontype] = tmp;\n", " }\n", " }\n", " }\n", " }\n", " return event.result;\n", " },\n", " // Piggyback on a donor event to simulate a different one\n", " // Used only for `focus(in | out)` events\n", " simulate: function (type, elem, event) {\n", " var e = jQuery.extend(new jQuery.Event(), event, {\n", " type: type,\n", " isSimulated: true\n", " });\n", " jQuery.event.trigger(e, null, elem);\n", " }\n", " });\n", " jQuery.fn.extend({\n", " trigger: function (type, data) {\n", " return this.each(function () {\n", " jQuery.event.trigger(type, data, this);\n", " });\n", " },\n", " triggerHandler: function (type, data) {\n", " var elem = this[0];\n", " if (elem) {\n", " return jQuery.event.trigger(type, data, elem, true);\n", " }\n", " }\n", " });\n", " // Support: Firefox <=44\n", " // Firefox doesn't have focus(in | out) events\n", " // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787\n", " //\n", " // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1\n", " // focus(in | out) events fire after focus & blur events,\n", " // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order\n", " // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857\n", " if (!support.focusin) {\n", " jQuery.each({ focus: \"focusin\", blur: \"focusout\" }, function (orig, fix) {\n", " // Attach a single capturing handler on the document while someone wants focusin/focusout\n", " var handler = function (event) {\n", " jQuery.event.simulate(fix, event.target, jQuery.event.fix(event));\n", " };\n", " jQuery.event.special[fix] = {\n", " setup: function () {\n", " // Handle: regular nodes (via `this.ownerDocument`), window\n", " // (via `this.document`) & document (via `this`).\n", " var doc = this.ownerDocument || this.document || this, attaches = dataPriv.access(doc, fix);\n", " if (!attaches) {\n", " doc.addEventListener(orig, handler, true);\n", " }\n", " dataPriv.access(doc, fix, (attaches || 0) + 1);\n", " },\n", " teardown: function () {\n", " var doc = this.ownerDocument || this.document || this, attaches = dataPriv.access(doc, fix) - 1;\n", " if (!attaches) {\n", " doc.removeEventListener(orig, handler, true);\n", " dataPriv.remove(doc, fix);\n", " }\n", " else {\n", " dataPriv.access(doc, fix, attaches);\n", " }\n", " }\n", " };\n", " });\n", " }\n", " var location = window.location;\n", " var nonce = { guid: Date.now() };\n", " var rquery = (/\\?/);\n", " // Cross-browser xml parsing\n", " jQuery.parseXML = function (data) {\n", " var xml;\n", " if (!data || typeof data !== \"string\") {\n", " return null;\n", " }\n", " // Support: IE 9 - 11 only\n", " // IE throws on parseFromString with invalid input.\n", " try {\n", " xml = (new window.DOMParser()).parseFromString(data, \"text/xml\");\n", " }\n", " catch (e) {\n", " xml = undefined;\n", " }\n", " if (!xml || xml.getElementsByTagName(\"parsererror\").length) {\n", " jQuery.error(\"Invalid XML: \" + data);\n", " }\n", " return xml;\n", " };\n", " var rbracket = /\\[\\]$/, rCRLF = /\\r?\\n/g, rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, rsubmittable = /^(?:input|select|textarea|keygen)/i;\n", " function buildParams(prefix, obj, traditional, add) {\n", " var name;\n", " if (Array.isArray(obj)) {\n", " // Serialize array item.\n", " jQuery.each(obj, function (i, v) {\n", " if (traditional || rbracket.test(prefix)) {\n", " // Treat each array item as a scalar.\n", " add(prefix, v);\n", " }\n", " else {\n", " // Item is non-scalar (array or object), encode its numeric index.\n", " buildParams(prefix + \"[\" + (typeof v === \"object\" && v != null ? i : \"\") + \"]\", v, traditional, add);\n", " }\n", " });\n", " }\n", " else if (!traditional && toType(obj) === \"object\") {\n", " // Serialize object item.\n", " for (name in obj) {\n", " buildParams(prefix + \"[\" + name + \"]\", obj[name], traditional, add);\n", " }\n", " }\n", " else {\n", " // Serialize scalar item.\n", " add(prefix, obj);\n", " }\n", " }\n", " // Serialize an array of form elements or a set of\n", " // key/values into a query string\n", " jQuery.param = function (a, traditional) {\n", " var prefix, s = [], add = function (key, valueOrFunction) {\n", " // If value is a function, invoke it and use its return value\n", " var value = isFunction(valueOrFunction) ?\n", " valueOrFunction() :\n", " valueOrFunction;\n", " s[s.length] = encodeURIComponent(key) + \"=\" +\n", " encodeURIComponent(value == null ? \"\" : value);\n", " };\n", " if (a == null) {\n", " return \"\";\n", " }\n", " // If an array was passed in, assume that it is an array of form elements.\n", " if (Array.isArray(a) || (a.jquery && !jQuery.isPlainObject(a))) {\n", " // Serialize the form elements\n", " jQuery.each(a, function () {\n", " add(this.name, this.value);\n", " });\n", " }\n", " else {\n", " // If traditional, encode the \"old\" way (the way 1.3.2 or older\n", " // did it), otherwise encode params recursively.\n", " for (prefix in a) {\n", " buildParams(prefix, a[prefix], traditional, add);\n", " }\n", " }\n", " // Return the resulting serialization\n", " return s.join(\"&\");\n", " };\n", " jQuery.fn.extend({\n", " serialize: function () {\n", " return jQuery.param(this.serializeArray());\n", " },\n", " serializeArray: function () {\n", " return this.map(function () {\n", " // Can add propHook for \"elements\" to filter or add form elements\n", " var elements = jQuery.prop(this, \"elements\");\n", " return elements ? jQuery.makeArray(elements) : this;\n", " })\n", " .filter(function () {\n", " var type = this.type;\n", " // Use .is( \":disabled\" ) so that fieldset[disabled] works\n", " return this.name && !jQuery(this).is(\":disabled\") &&\n", " rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) &&\n", " (this.checked || !rcheckableType.test(type));\n", " })\n", " .map(function (_i, elem) {\n", " var val = jQuery(this).val();\n", " if (val == null) {\n", " return null;\n", " }\n", " if (Array.isArray(val)) {\n", " return jQuery.map(val, function (val) {\n", " return { name: elem.name, value: val.replace(rCRLF, \"\\r\\n\") };\n", " });\n", " }\n", " return { name: elem.name, value: val.replace(rCRLF, \"\\r\\n\") };\n", " }).get();\n", " }\n", " });\n", " var r20 = /%20/g, rhash = /#.*$/, rantiCache = /([?&])_=[^&]*/, rheaders = /^(.*?):[ \\t]*([^\\r\\n]*)$/mg, \n", " // #7653, #8125, #8152: local protocol detection\n", " rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, rnoContent = /^(?:GET|HEAD)$/, rprotocol = /^\\/\\//, \n", " /* Prefilters\n", " * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)\n", " * 2) These are called:\n", " * - BEFORE asking for a transport\n", " * - AFTER param serialization (s.data is a string if s.processData is true)\n", " * 3) key is the dataType\n", " * 4) the catchall symbol \"*\" can be used\n", " * 5) execution will start with transport dataType and THEN continue down to \"*\" if needed\n", " */\n", " prefilters = {}, \n", " /* Transports bindings\n", " * 1) key is the dataType\n", " * 2) the catchall symbol \"*\" can be used\n", " * 3) selection will start with transport dataType and THEN go to \"*\" if needed\n", " */\n", " transports = {}, \n", " // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression\n", " allTypes = \"*/\".concat(\"*\"), \n", " // Anchor tag for parsing the document origin\n", " originAnchor = document.createElement(\"a\");\n", " originAnchor.href = location.href;\n", " // Base \"constructor\" for jQuery.ajaxPrefilter and jQuery.ajaxTransport\n", " function addToPrefiltersOrTransports(structure) {\n", " // dataTypeExpression is optional and defaults to \"*\"\n", " return function (dataTypeExpression, func) {\n", " if (typeof dataTypeExpression !== \"string\") {\n", " func = dataTypeExpression;\n", " dataTypeExpression = \"*\";\n", " }\n", " var dataType, i = 0, dataTypes = dataTypeExpression.toLowerCase().match(rnothtmlwhite) || [];\n", " if (isFunction(func)) {\n", " // For each dataType in the dataTypeExpression\n", " while ((dataType = dataTypes[i++])) {\n", " // Prepend if requested\n", " if (dataType[0] === \"+\") {\n", " dataType = dataType.slice(1) || \"*\";\n", " (structure[dataType] = structure[dataType] || []).unshift(func);\n", " // Otherwise append\n", " }\n", " else {\n", " (structure[dataType] = structure[dataType] || []).push(func);\n", " }\n", " }\n", " }\n", " };\n", " }\n", " // Base inspection function for prefilters and transports\n", " function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) {\n", " var inspected = {}, seekingTransport = (structure === transports);\n", " function inspect(dataType) {\n", " var selected;\n", " inspected[dataType] = true;\n", " jQuery.each(structure[dataType] || [], function (_, prefilterOrFactory) {\n", " var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR);\n", " if (typeof dataTypeOrTransport === \"string\" &&\n", " !seekingTransport && !inspected[dataTypeOrTransport]) {\n", " options.dataTypes.unshift(dataTypeOrTransport);\n", " inspect(dataTypeOrTransport);\n", " return false;\n", " }\n", " else if (seekingTransport) {\n", " return !(selected = dataTypeOrTransport);\n", " }\n", " });\n", " return selected;\n", " }\n", " return inspect(options.dataTypes[0]) || !inspected[\"*\"] && inspect(\"*\");\n", " }\n", " // A special extend for ajax options\n", " // that takes \"flat\" options (not to be deep extended)\n", " // Fixes #9887\n", " function ajaxExtend(target, src) {\n", " var key, deep, flatOptions = jQuery.ajaxSettings.flatOptions || {};\n", " for (key in src) {\n", " if (src[key] !== undefined) {\n", " (flatOptions[key] ? target : (deep || (deep = {})))[key] = src[key];\n", " }\n", " }\n", " if (deep) {\n", " jQuery.extend(true, target, deep);\n", " }\n", " return target;\n", " }\n", " /* Handles responses to an ajax request:\n", " * - finds the right dataType (mediates between content-type and expected dataType)\n", " * - returns the corresponding response\n", " */\n", " function ajaxHandleResponses(s, jqXHR, responses) {\n", " var ct, type, finalDataType, firstDataType, contents = s.contents, dataTypes = s.dataTypes;\n", " // Remove auto dataType and get content-type in the process\n", " while (dataTypes[0] === \"*\") {\n", " dataTypes.shift();\n", " if (ct === undefined) {\n", " ct = s.mimeType || jqXHR.getResponseHeader(\"Content-Type\");\n", " }\n", " }\n", " // Check if we're dealing with a known content-type\n", " if (ct) {\n", " for (type in contents) {\n", " if (contents[type] && contents[type].test(ct)) {\n", " dataTypes.unshift(type);\n", " break;\n", " }\n", " }\n", " }\n", " // Check to see if we have a response for the expected dataType\n", " if (dataTypes[0] in responses) {\n", " finalDataType = dataTypes[0];\n", " }\n", " else {\n", " // Try convertible dataTypes\n", " for (type in responses) {\n", " if (!dataTypes[0] || s.converters[type + \" \" + dataTypes[0]]) {\n", " finalDataType = type;\n", " break;\n", " }\n", " if (!firstDataType) {\n", " firstDataType = type;\n", " }\n", " }\n", " // Or just use first one\n", " finalDataType = finalDataType || firstDataType;\n", " }\n", " // If we found a dataType\n", " // We add the dataType to the list if needed\n", " // and return the corresponding response\n", " if (finalDataType) {\n", " if (finalDataType !== dataTypes[0]) {\n", " dataTypes.unshift(finalDataType);\n", " }\n", " return responses[finalDataType];\n", " }\n", " }\n", " /* Chain conversions given the request and the original response\n", " * Also sets the responseXXX fields on the jqXHR instance\n", " */\n", " function ajaxConvert(s, response, jqXHR, isSuccess) {\n", " var conv2, current, conv, tmp, prev, converters = {}, \n", " // Work with a copy of dataTypes in case we need to modify it for conversion\n", " dataTypes = s.dataTypes.slice();\n", " // Create converters map with lowercased keys\n", " if (dataTypes[1]) {\n", " for (conv in s.converters) {\n", " converters[conv.toLowerCase()] = s.converters[conv];\n", " }\n", " }\n", " current = dataTypes.shift();\n", " // Convert to each sequential dataType\n", " while (current) {\n", " if (s.responseFields[current]) {\n", " jqXHR[s.responseFields[current]] = response;\n", " }\n", " // Apply the dataFilter if provided\n", " if (!prev && isSuccess && s.dataFilter) {\n", " response = s.dataFilter(response, s.dataType);\n", " }\n", " prev = current;\n", " current = dataTypes.shift();\n", " if (current) {\n", " // There's only work to do if current dataType is non-auto\n", " if (current === \"*\") {\n", " current = prev;\n", " // Convert response if prev dataType is non-auto and differs from current\n", " }\n", " else if (prev !== \"*\" && prev !== current) {\n", " // Seek a direct converter\n", " conv = converters[prev + \" \" + current] || converters[\"* \" + current];\n", " // If none found, seek a pair\n", " if (!conv) {\n", " for (conv2 in converters) {\n", " // If conv2 outputs current\n", " tmp = conv2.split(\" \");\n", " if (tmp[1] === current) {\n", " // If prev can be converted to accepted input\n", " conv = converters[prev + \" \" + tmp[0]] ||\n", " converters[\"* \" + tmp[0]];\n", " if (conv) {\n", " // Condense equivalence converters\n", " if (conv === true) {\n", " conv = converters[conv2];\n", " // Otherwise, insert the intermediate dataType\n", " }\n", " else if (converters[conv2] !== true) {\n", " current = tmp[0];\n", " dataTypes.unshift(tmp[1]);\n", " }\n", " break;\n", " }\n", " }\n", " }\n", " }\n", " // Apply converter (if not an equivalence)\n", " if (conv !== true) {\n", " // Unless errors are allowed to bubble, catch and return them\n", " if (conv && s.throws) {\n", " response = conv(response);\n", " }\n", " else {\n", " try {\n", " response = conv(response);\n", " }\n", " catch (e) {\n", " return {\n", " state: \"parsererror\",\n", " error: conv ? e : \"No conversion from \" + prev + \" to \" + current\n", " };\n", " }\n", " }\n", " }\n", " }\n", " }\n", " }\n", " return { state: \"success\", data: response };\n", " }\n", " jQuery.extend({\n", " // Counter for holding the number of active queries\n", " active: 0,\n", " // Last-Modified header cache for next request\n", " lastModified: {},\n", " etag: {},\n", " ajaxSettings: {\n", " url: location.href,\n", " type: \"GET\",\n", " isLocal: rlocalProtocol.test(location.protocol),\n", " global: true,\n", " processData: true,\n", " async: true,\n", " contentType: \"application/x-www-form-urlencoded; charset=UTF-8\",\n", " /*\n", " timeout: 0,\n", " data: null,\n", " dataType: null,\n", " username: null,\n", " password: null,\n", " cache: null,\n", " throws: false,\n", " traditional: false,\n", " headers: {},\n", " */\n", " accepts: {\n", " \"*\": allTypes,\n", " text: \"text/plain\",\n", " html: \"text/html\",\n", " xml: \"application/xml, text/xml\",\n", " json: \"application/json, text/javascript\"\n", " },\n", " contents: {\n", " xml: /\\bxml\\b/,\n", " html: /\\bhtml/,\n", " json: /\\bjson\\b/\n", " },\n", " responseFields: {\n", " xml: \"responseXML\",\n", " text: \"responseText\",\n", " json: \"responseJSON\"\n", " },\n", " // Data converters\n", " // Keys separate source (or catchall \"*\") and destination types with a single space\n", " converters: {\n", " // Convert anything to text\n", " \"* text\": String,\n", " // Text to html (true = no transformation)\n", " \"text html\": true,\n", " // Evaluate text as a json expression\n", " \"text json\": JSON.parse,\n", " // Parse text as xml\n", " \"text xml\": jQuery.parseXML\n", " },\n", " // For options that shouldn't be deep extended:\n", " // you can add your own custom options here if\n", " // and when you create one that shouldn't be\n", " // deep extended (see ajaxExtend)\n", " flatOptions: {\n", " url: true,\n", " context: true\n", " }\n", " },\n", " // Creates a full fledged settings object into target\n", " // with both ajaxSettings and settings fields.\n", " // If target is omitted, writes into ajaxSettings.\n", " ajaxSetup: function (target, settings) {\n", " return settings ?\n", " // Building a settings object\n", " ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) :\n", " // Extending ajaxSettings\n", " ajaxExtend(jQuery.ajaxSettings, target);\n", " },\n", " ajaxPrefilter: addToPrefiltersOrTransports(prefilters),\n", " ajaxTransport: addToPrefiltersOrTransports(transports),\n", " // Main method\n", " ajax: function (url, options) {\n", " // If url is an object, simulate pre-1.5 signature\n", " if (typeof url === \"object\") {\n", " options = url;\n", " url = undefined;\n", " }\n", " // Force options to be an object\n", " options = options || {};\n", " var transport, \n", " // URL without anti-cache param\n", " cacheURL, \n", " // Response headers\n", " responseHeadersString, responseHeaders, \n", " // timeout handle\n", " timeoutTimer, \n", " // Url cleanup var\n", " urlAnchor, \n", " // Request state (becomes false upon send and true upon completion)\n", " completed, \n", " // To know if global events are to be dispatched\n", " fireGlobals, \n", " // Loop variable\n", " i, \n", " // uncached part of the url\n", " uncached, \n", " // Create the final options object\n", " s = jQuery.ajaxSetup({}, options), \n", " // Callbacks context\n", " callbackContext = s.context || s, \n", " // Context for global events is callbackContext if it is a DOM node or jQuery collection\n", " globalEventContext = s.context &&\n", " (callbackContext.nodeType || callbackContext.jquery) ?\n", " jQuery(callbackContext) :\n", " jQuery.event, \n", " // Deferreds\n", " deferred = jQuery.Deferred(), completeDeferred = jQuery.Callbacks(\"once memory\"), \n", " // Status-dependent callbacks\n", " statusCode = s.statusCode || {}, \n", " // Headers (they are sent all at once)\n", " requestHeaders = {}, requestHeadersNames = {}, \n", " // Default abort message\n", " strAbort = \"canceled\", \n", " // Fake xhr\n", " jqXHR = {\n", " readyState: 0,\n", " // Builds headers hashtable if needed\n", " getResponseHeader: function (key) {\n", " var match;\n", " if (completed) {\n", " if (!responseHeaders) {\n", " responseHeaders = {};\n", " while ((match = rheaders.exec(responseHeadersString))) {\n", " responseHeaders[match[1].toLowerCase() + \" \"] =\n", " (responseHeaders[match[1].toLowerCase() + \" \"] || [])\n", " .concat(match[2]);\n", " }\n", " }\n", " match = responseHeaders[key.toLowerCase() + \" \"];\n", " }\n", " return match == null ? null : match.join(\", \");\n", " },\n", " // Raw string\n", " getAllResponseHeaders: function () {\n", " return completed ? responseHeadersString : null;\n", " },\n", " // Caches the header\n", " setRequestHeader: function (name, value) {\n", " if (completed == null) {\n", " name = requestHeadersNames[name.toLowerCase()] =\n", " requestHeadersNames[name.toLowerCase()] || name;\n", " requestHeaders[name] = value;\n", " }\n", " return this;\n", " },\n", " // Overrides response content-type header\n", " overrideMimeType: function (type) {\n", " if (completed == null) {\n", " s.mimeType = type;\n", " }\n", " return this;\n", " },\n", " // Status-dependent callbacks\n", " statusCode: function (map) {\n", " var code;\n", " if (map) {\n", " if (completed) {\n", " // Execute the appropriate callbacks\n", " jqXHR.always(map[jqXHR.status]);\n", " }\n", " else {\n", " // Lazy-add the new callbacks in a way that preserves old ones\n", " for (code in map) {\n", " statusCode[code] = [statusCode[code], map[code]];\n", " }\n", " }\n", " }\n", " return this;\n", " },\n", " // Cancel the request\n", " abort: function (statusText) {\n", " var finalText = statusText || strAbort;\n", " if (transport) {\n", " transport.abort(finalText);\n", " }\n", " done(0, finalText);\n", " return this;\n", " }\n", " };\n", " // Attach deferreds\n", " deferred.promise(jqXHR);\n", " // Add protocol if not provided (prefilters might expect it)\n", " // Handle falsy url in the settings object (#10093: consistency with old signature)\n", " // We also use the url parameter if available\n", " s.url = ((url || s.url || location.href) + \"\")\n", " .replace(rprotocol, location.protocol + \"//\");\n", " // Alias method option to type as per ticket #12004\n", " s.type = options.method || options.type || s.method || s.type;\n", " // Extract dataTypes list\n", " s.dataTypes = (s.dataType || \"*\").toLowerCase().match(rnothtmlwhite) || [\"\"];\n", " // A cross-domain request is in order when the origin doesn't match the current origin.\n", " if (s.crossDomain == null) {\n", " urlAnchor = document.createElement(\"a\");\n", " // Support: IE <=8 - 11, Edge 12 - 15\n", " // IE throws exception on accessing the href property if url is malformed,\n", " // e.g. http://example.com:80x/\n", " try {\n", " urlAnchor.href = s.url;\n", " // Support: IE <=8 - 11 only\n", " // Anchor's host property isn't correctly set when s.url is relative\n", " urlAnchor.href = urlAnchor.href;\n", " s.crossDomain = originAnchor.protocol + \"//\" + originAnchor.host !==\n", " urlAnchor.protocol + \"//\" + urlAnchor.host;\n", " }\n", " catch (e) {\n", " // If there is an error parsing the URL, assume it is crossDomain,\n", " // it can be rejected by the transport if it is invalid\n", " s.crossDomain = true;\n", " }\n", " }\n", " // Convert data if not already a string\n", " if (s.data && s.processData && typeof s.data !== \"string\") {\n", " s.data = jQuery.param(s.data, s.traditional);\n", " }\n", " // Apply prefilters\n", " inspectPrefiltersOrTransports(prefilters, s, options, jqXHR);\n", " // If request was aborted inside a prefilter, stop there\n", " if (completed) {\n", " return jqXHR;\n", " }\n", " // We can fire global events as of now if asked to\n", " // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)\n", " fireGlobals = jQuery.event && s.global;\n", " // Watch for a new set of requests\n", " if (fireGlobals && jQuery.active++ === 0) {\n", " jQuery.event.trigger(\"ajaxStart\");\n", " }\n", " // Uppercase the type\n", " s.type = s.type.toUpperCase();\n", " // Determine if request has content\n", " s.hasContent = !rnoContent.test(s.type);\n", " // Save the URL in case we're toying with the If-Modified-Since\n", " // and/or If-None-Match header later on\n", " // Remove hash to simplify url manipulation\n", " cacheURL = s.url.replace(rhash, \"\");\n", " // More options handling for requests with no content\n", " if (!s.hasContent) {\n", " // Remember the hash so we can put it back\n", " uncached = s.url.slice(cacheURL.length);\n", " // If data is available and should be processed, append data to url\n", " if (s.data && (s.processData || typeof s.data === \"string\")) {\n", " cacheURL += (rquery.test(cacheURL) ? \"&\" : \"?\") + s.data;\n", " // #9682: remove data so that it's not used in an eventual retry\n", " delete s.data;\n", " }\n", " // Add or update anti-cache param if needed\n", " if (s.cache === false) {\n", " cacheURL = cacheURL.replace(rantiCache, \"$1\");\n", " uncached = (rquery.test(cacheURL) ? \"&\" : \"?\") + \"_=\" + (nonce.guid++) +\n", " uncached;\n", " }\n", " // Put hash and anti-cache on the URL that will be requested (gh-1732)\n", " s.url = cacheURL + uncached;\n", " // Change '%20' to '+' if this is encoded form body content (gh-2658)\n", " }\n", " else if (s.data && s.processData &&\n", " (s.contentType || \"\").indexOf(\"application/x-www-form-urlencoded\") === 0) {\n", " s.data = s.data.replace(r20, \"+\");\n", " }\n", " // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.\n", " if (s.ifModified) {\n", " if (jQuery.lastModified[cacheURL]) {\n", " jqXHR.setRequestHeader(\"If-Modified-Since\", jQuery.lastModified[cacheURL]);\n", " }\n", " if (jQuery.etag[cacheURL]) {\n", " jqXHR.setRequestHeader(\"If-None-Match\", jQuery.etag[cacheURL]);\n", " }\n", " }\n", " // Set the correct header, if data is being sent\n", " if (s.data && s.hasContent && s.contentType !== false || options.contentType) {\n", " jqXHR.setRequestHeader(\"Content-Type\", s.contentType);\n", " }\n", " // Set the Accepts header for the server, depending on the dataType\n", " jqXHR.setRequestHeader(\"Accept\", s.dataTypes[0] && s.accepts[s.dataTypes[0]] ?\n", " s.accepts[s.dataTypes[0]] +\n", " (s.dataTypes[0] !== \"*\" ? \", \" + allTypes + \"; q=0.01\" : \"\") :\n", " s.accepts[\"*\"]);\n", " // Check for headers option\n", " for (i in s.headers) {\n", " jqXHR.setRequestHeader(i, s.headers[i]);\n", " }\n", " // Allow custom headers/mimetypes and early abort\n", " if (s.beforeSend &&\n", " (s.beforeSend.call(callbackContext, jqXHR, s) === false || completed)) {\n", " // Abort if not done already and return\n", " return jqXHR.abort();\n", " }\n", " // Aborting is no longer a cancellation\n", " strAbort = \"abort\";\n", " // Install callbacks on deferreds\n", " completeDeferred.add(s.complete);\n", " jqXHR.done(s.success);\n", " jqXHR.fail(s.error);\n", " // Get transport\n", " transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR);\n", " // If no transport, we auto-abort\n", " if (!transport) {\n", " done(-1, \"No Transport\");\n", " }\n", " else {\n", " jqXHR.readyState = 1;\n", " // Send global event\n", " if (fireGlobals) {\n", " globalEventContext.trigger(\"ajaxSend\", [jqXHR, s]);\n", " }\n", " // If request was aborted inside ajaxSend, stop there\n", " if (completed) {\n", " return jqXHR;\n", " }\n", " // Timeout\n", " if (s.async && s.timeout > 0) {\n", " timeoutTimer = window.setTimeout(function () {\n", " jqXHR.abort(\"timeout\");\n", " }, s.timeout);\n", " }\n", " try {\n", " completed = false;\n", " transport.send(requestHeaders, done);\n", " }\n", " catch (e) {\n", " // Rethrow post-completion exceptions\n", " if (completed) {\n", " throw e;\n", " }\n", " // Propagate others as results\n", " done(-1, e);\n", " }\n", " }\n", " // Callback for when everything is done\n", " function done(status, nativeStatusText, responses, headers) {\n", " var isSuccess, success, error, response, modified, statusText = nativeStatusText;\n", " // Ignore repeat invocations\n", " if (completed) {\n", " return;\n", " }\n", " completed = true;\n", " // Clear timeout if it exists\n", " if (timeoutTimer) {\n", " window.clearTimeout(timeoutTimer);\n", " }\n", " // Dereference transport for early garbage collection\n", " // (no matter how long the jqXHR object will be used)\n", " transport = undefined;\n", " // Cache response headers\n", " responseHeadersString = headers || \"\";\n", " // Set readyState\n", " jqXHR.readyState = status > 0 ? 4 : 0;\n", " // Determine if successful\n", " isSuccess = status >= 200 && status < 300 || status === 304;\n", " // Get response data\n", " if (responses) {\n", " response = ajaxHandleResponses(s, jqXHR, responses);\n", " }\n", " // Use a noop converter for missing script\n", " if (!isSuccess && jQuery.inArray(\"script\", s.dataTypes) > -1) {\n", " s.converters[\"text script\"] = function () { };\n", " }\n", " // Convert no matter what (that way responseXXX fields are always set)\n", " response = ajaxConvert(s, response, jqXHR, isSuccess);\n", " // If successful, handle type chaining\n", " if (isSuccess) {\n", " // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.\n", " if (s.ifModified) {\n", " modified = jqXHR.getResponseHeader(\"Last-Modified\");\n", " if (modified) {\n", " jQuery.lastModified[cacheURL] = modified;\n", " }\n", " modified = jqXHR.getResponseHeader(\"etag\");\n", " if (modified) {\n", " jQuery.etag[cacheURL] = modified;\n", " }\n", " }\n", " // if no content\n", " if (status === 204 || s.type === \"HEAD\") {\n", " statusText = \"nocontent\";\n", " // if not modified\n", " }\n", " else if (status === 304) {\n", " statusText = \"notmodified\";\n", " // If we have data, let's convert it\n", " }\n", " else {\n", " statusText = response.state;\n", " success = response.data;\n", " error = response.error;\n", " isSuccess = !error;\n", " }\n", " }\n", " else {\n", " // Extract error from statusText and normalize for non-aborts\n", " error = statusText;\n", " if (status || !statusText) {\n", " statusText = \"error\";\n", " if (status < 0) {\n", " status = 0;\n", " }\n", " }\n", " }\n", " // Set data for the fake xhr object\n", " jqXHR.status = status;\n", " jqXHR.statusText = (nativeStatusText || statusText) + \"\";\n", " // Success/Error\n", " if (isSuccess) {\n", " deferred.resolveWith(callbackContext, [success, statusText, jqXHR]);\n", " }\n", " else {\n", " deferred.rejectWith(callbackContext, [jqXHR, statusText, error]);\n", " }\n", " // Status-dependent callbacks\n", " jqXHR.statusCode(statusCode);\n", " statusCode = undefined;\n", " if (fireGlobals) {\n", " globalEventContext.trigger(isSuccess ? \"ajaxSuccess\" : \"ajaxError\", [jqXHR, s, isSuccess ? success : error]);\n", " }\n", " // Complete\n", " completeDeferred.fireWith(callbackContext, [jqXHR, statusText]);\n", " if (fireGlobals) {\n", " globalEventContext.trigger(\"ajaxComplete\", [jqXHR, s]);\n", " // Handle the global AJAX counter\n", " if (!(--jQuery.active)) {\n", " jQuery.event.trigger(\"ajaxStop\");\n", " }\n", " }\n", " }\n", " return jqXHR;\n", " },\n", " getJSON: function (url, data, callback) {\n", " return jQuery.get(url, data, callback, \"json\");\n", " },\n", " getScript: function (url, callback) {\n", " return jQuery.get(url, undefined, callback, \"script\");\n", " }\n", " });\n", " jQuery.each([\"get\", \"post\"], function (_i, method) {\n", " jQuery[method] = function (url, data, callback, type) {\n", " // Shift arguments if data argument was omitted\n", " if (isFunction(data)) {\n", " type = type || callback;\n", " callback = data;\n", " data = undefined;\n", " }\n", " // The url can be an options object (which then must have .url)\n", " return jQuery.ajax(jQuery.extend({\n", " url: url,\n", " type: method,\n", " dataType: type,\n", " data: data,\n", " success: callback\n", " }, jQuery.isPlainObject(url) && url));\n", " };\n", " });\n", " jQuery.ajaxPrefilter(function (s) {\n", " var i;\n", " for (i in s.headers) {\n", " if (i.toLowerCase() === \"content-type\") {\n", " s.contentType = s.headers[i] || \"\";\n", " }\n", " }\n", " });\n", " jQuery._evalUrl = function (url, options, doc) {\n", " return jQuery.ajax({\n", " url: url,\n", " // Make this explicit, since user can override this through ajaxSetup (#11264)\n", " type: \"GET\",\n", " dataType: \"script\",\n", " cache: true,\n", " async: false,\n", " global: false,\n", " // Only evaluate the response if it is successful (gh-4126)\n", " // dataFilter is not invoked for failure responses, so using it instead\n", " // of the default converter is kludgy but it works.\n", " converters: {\n", " \"text script\": function () { }\n", " },\n", " dataFilter: function (response) {\n", " jQuery.globalEval(response, options, doc);\n", " }\n", " });\n", " };\n", " jQuery.fn.extend({\n", " wrapAll: function (html) {\n", " var wrap;\n", " if (this[0]) {\n", " if (isFunction(html)) {\n", " html = html.call(this[0]);\n", " }\n", " // The elements to wrap the target around\n", " wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);\n", " if (this[0].parentNode) {\n", " wrap.insertBefore(this[0]);\n", " }\n", " wrap.map(function () {\n", " var elem = this;\n", " while (elem.firstElementChild) {\n", " elem = elem.firstElementChild;\n", " }\n", " return elem;\n", " }).append(this);\n", " }\n", " return this;\n", " },\n", " wrapInner: function (html) {\n", " if (isFunction(html)) {\n", " return this.each(function (i) {\n", " jQuery(this).wrapInner(html.call(this, i));\n", " });\n", " }\n", " return this.each(function () {\n", " var self = jQuery(this), contents = self.contents();\n", " if (contents.length) {\n", " contents.wrapAll(html);\n", " }\n", " else {\n", " self.append(html);\n", " }\n", " });\n", " },\n", " wrap: function (html) {\n", " var htmlIsFunction = isFunction(html);\n", " return this.each(function (i) {\n", " jQuery(this).wrapAll(htmlIsFunction ? html.call(this, i) : html);\n", " });\n", " },\n", " unwrap: function (selector) {\n", " this.parent(selector).not(\"body\").each(function () {\n", " jQuery(this).replaceWith(this.childNodes);\n", " });\n", " return this;\n", " }\n", " });\n", " jQuery.expr.pseudos.hidden = function (elem) {\n", " return !jQuery.expr.pseudos.visible(elem);\n", " };\n", " jQuery.expr.pseudos.visible = function (elem) {\n", " return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);\n", " };\n", " jQuery.ajaxSettings.xhr = function () {\n", " try {\n", " return new window.XMLHttpRequest();\n", " }\n", " catch (e) { }\n", " };\n", " var xhrSuccessStatus = {\n", " // File protocol always yields status code 0, assume 200\n", " 0: 200,\n", " // Support: IE <=9 only\n", " // #1450: sometimes IE returns 1223 when it should be 204\n", " 1223: 204\n", " }, xhrSupported = jQuery.ajaxSettings.xhr();\n", " support.cors = !!xhrSupported && (\"withCredentials\" in xhrSupported);\n", " support.ajax = xhrSupported = !!xhrSupported;\n", " jQuery.ajaxTransport(function (options) {\n", " var callback, errorCallback;\n", " // Cross domain only allowed if supported through XMLHttpRequest\n", " if (support.cors || xhrSupported && !options.crossDomain) {\n", " return {\n", " send: function (headers, complete) {\n", " var i, xhr = options.xhr();\n", " xhr.open(options.type, options.url, options.async, options.username, options.password);\n", " // Apply custom fields if provided\n", " if (options.xhrFields) {\n", " for (i in options.xhrFields) {\n", " xhr[i] = options.xhrFields[i];\n", " }\n", " }\n", " // Override mime type if needed\n", " if (options.mimeType && xhr.overrideMimeType) {\n", " xhr.overrideMimeType(options.mimeType);\n", " }\n", " // X-Requested-With header\n", " // For cross-domain requests, seeing as conditions for a preflight are\n", " // akin to a jigsaw puzzle, we simply never set it to be sure.\n", " // (it can always be set on a per-request basis or even using ajaxSetup)\n", " // For same-domain requests, won't change header if already provided.\n", " if (!options.crossDomain && !headers[\"X-Requested-With\"]) {\n", " headers[\"X-Requested-With\"] = \"XMLHttpRequest\";\n", " }\n", " // Set headers\n", " for (i in headers) {\n", " xhr.setRequestHeader(i, headers[i]);\n", " }\n", " // Callback\n", " callback = function (type) {\n", " return function () {\n", " if (callback) {\n", " callback = errorCallback = xhr.onload =\n", " xhr.onerror = xhr.onabort = xhr.ontimeout =\n", " xhr.onreadystatechange = null;\n", " if (type === \"abort\") {\n", " xhr.abort();\n", " }\n", " else if (type === \"error\") {\n", " // Support: IE <=9 only\n", " // On a manual native abort, IE9 throws\n", " // errors on any property access that is not readyState\n", " if (typeof xhr.status !== \"number\") {\n", " complete(0, \"error\");\n", " }\n", " else {\n", " complete(\n", " // File: protocol always yields status 0; see #8605, #14207\n", " xhr.status, xhr.statusText);\n", " }\n", " }\n", " else {\n", " complete(xhrSuccessStatus[xhr.status] || xhr.status, xhr.statusText, \n", " // Support: IE <=9 only\n", " // IE9 has no XHR2 but throws on binary (trac-11426)\n", " // For XHR2 non-text, let the caller handle it (gh-2498)\n", " (xhr.responseType || \"text\") !== \"text\" ||\n", " typeof xhr.responseText !== \"string\" ?\n", " { binary: xhr.response } :\n", " { text: xhr.responseText }, xhr.getAllResponseHeaders());\n", " }\n", " }\n", " };\n", " };\n", " // Listen to events\n", " xhr.onload = callback();\n", " errorCallback = xhr.onerror = xhr.ontimeout = callback(\"error\");\n", " // Support: IE 9 only\n", " // Use onreadystatechange to replace onabort\n", " // to handle uncaught aborts\n", " if (xhr.onabort !== undefined) {\n", " xhr.onabort = errorCallback;\n", " }\n", " else {\n", " xhr.onreadystatechange = function () {\n", " // Check readyState before timeout as it changes\n", " if (xhr.readyState === 4) {\n", " // Allow onerror to be called first,\n", " // but that will not handle a native abort\n", " // Also, save errorCallback to a variable\n", " // as xhr.onerror cannot be accessed\n", " window.setTimeout(function () {\n", " if (callback) {\n", " errorCallback();\n", " }\n", " });\n", " }\n", " };\n", " }\n", " // Create the abort callback\n", " callback = callback(\"abort\");\n", " try {\n", " // Do send the request (this may raise an exception)\n", " xhr.send(options.hasContent && options.data || null);\n", " }\n", " catch (e) {\n", " // #14683: Only rethrow if this hasn't been notified as an error yet\n", " if (callback) {\n", " throw e;\n", " }\n", " }\n", " },\n", " abort: function () {\n", " if (callback) {\n", " callback();\n", " }\n", " }\n", " };\n", " }\n", " });\n", " // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)\n", " jQuery.ajaxPrefilter(function (s) {\n", " if (s.crossDomain) {\n", " s.contents.script = false;\n", " }\n", " });\n", " // Install script dataType\n", " jQuery.ajaxSetup({\n", " accepts: {\n", " script: \"text/javascript, application/javascript, \" +\n", " \"application/ecmascript, application/x-ecmascript\"\n", " },\n", " contents: {\n", " script: /\\b(?:java|ecma)script\\b/\n", " },\n", " converters: {\n", " \"text script\": function (text) {\n", " jQuery.globalEval(text);\n", " return text;\n", " }\n", " }\n", " });\n", " // Handle cache's special case and crossDomain\n", " jQuery.ajaxPrefilter(\"script\", function (s) {\n", " if (s.cache === undefined) {\n", " s.cache = false;\n", " }\n", " if (s.crossDomain) {\n", " s.type = \"GET\";\n", " }\n", " });\n", " // Bind script tag hack transport\n", " jQuery.ajaxTransport(\"script\", function (s) {\n", " // This transport only deals with cross domain or forced-by-attrs requests\n", " if (s.crossDomain || s.scriptAttrs) {\n", " var script, callback;\n", " return {\n", " send: function (_, complete) {\n", " script = jQuery(\"" ], "text/plain": [ "Column(height=800, sizing_mode='stretch_width')\n", " [0] Markdown(str)\n", " [1] Row(background='rgb(42, 44, 47)')\n", " [0] PNG(str, height=50, margin=(10, 25, 10, 10))\n", " [1] HSpacer()\n", " [2] Row(background='rgb(42, 44, 47)', sizing_mode='stretch_both')\n", " [0] PerspectiveViewer(column_data_source=ColumnDataSource(id='1008'..., column_data_source_load_function='load', column_data_source_orient='records', data= Symbol ..., html='\n", "\n", "\n", "\n", "\n", "\n", "
\n", "\n", "" ], "text/plain": [ "Button(button_type='success', name='CUSTOM REPORT')" ] }, "execution_count": 5, "metadata": { "application/vnd.holoviews_exec.v0+json": { "id": "1047" } }, "output_type": "execute_result" } ], "source": [ "button = pn.widgets.Button(name=\"CUSTOM REPORT\", button_type=\"success\")\n", "@param.depends(button.param.clicks, watch=True)\n", "def set_custom_report(*events):\n", " perspective_viewer.columns=[\"name\", \"sector\", \"price\"]\n", " \n", "button" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If you're primary usage is Notebook then you should checkout the **Perspective IPyWidget**.\n", "\n", "There are no known issues on the server though.\n", "\n", "## Roadmap\n", "\n", "- Fix issues above\n", "- Convert from WebComponent extension to Bokeh extension.\n", "- Support other Dataframe types than Pandas.\n", "- Support update of data for streaming use case.\n", "- Include in Panel package\n", "\n", "## Resources\n", "\n", "- [Perspective Github](https://github.com/finos/perspective)\n", "- [Perspective IPyWidget Docs](https://perspective-python.readthedocs.io/en/latest/quickstart.html)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.6" } }, "nbformat": 4, "nbformat_minor": 4 }