diff --git a/cmd/config.go b/cmd/config.go index 3aa6237450c..2e7b094e9ae 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -31,6 +31,7 @@ func configFlagSet() *pflag.FlagSet { flags.StringArrayP("out", "o", []string{}, "`uri` for an external metrics database") flags.BoolP("linger", "l", false, "keep the API server alive past test end") flags.Bool("no-usage-report", false, "don't send anonymous stats to the developers") + flags.Bool("no-web-dashboard", false, "disable web dashboard") return flags } @@ -38,9 +39,10 @@ func configFlagSet() *pflag.FlagSet { type Config struct { lib.Options - Out []string `json:"out" envconfig:"K6_OUT"` - Linger null.Bool `json:"linger" envconfig:"K6_LINGER"` - NoUsageReport null.Bool `json:"noUsageReport" envconfig:"K6_NO_USAGE_REPORT"` + Out []string `json:"out" envconfig:"K6_OUT"` + Linger null.Bool `json:"linger" envconfig:"K6_LINGER"` + NoUsageReport null.Bool `json:"noUsageReport" envconfig:"K6_NO_USAGE_REPORT"` + NoWebDashboard null.Bool `json:"noWebDashboard" envconfig:"K6_NO_WEB_DASHBOARD"` // TODO: deprecate Collectors map[string]json.RawMessage `json:"collectors"` @@ -67,6 +69,9 @@ func (c Config) Apply(cfg Config) Config { if cfg.NoUsageReport.Valid { c.NoUsageReport = cfg.NoUsageReport } + if cfg.NoWebDashboard.Valid { + c.NoWebDashboard = cfg.NoWebDashboard + } if len(cfg.Collectors) > 0 { c.Collectors = cfg.Collectors } @@ -94,10 +99,11 @@ func getConfig(flags *pflag.FlagSet) (Config, error) { return Config{}, err } return Config{ - Options: opts, - Out: out, - Linger: getNullBool(flags, "linger"), - NoUsageReport: getNullBool(flags, "no-usage-report"), + Options: opts, + Out: out, + Linger: getNullBool(flags, "linger"), + NoUsageReport: getNullBool(flags, "no-usage-report"), + NoWebDashboard: getNullBool(flags, "no-web-dashboard"), }, nil } diff --git a/cmd/outputs.go b/cmd/outputs.go index 1f3d04bee13..d434f3fb382 100644 --- a/cmd/outputs.go +++ b/cmd/outputs.go @@ -16,9 +16,12 @@ import ( "go.k6.io/k6/output/json" "go.k6.io/k6/output/statsd" + "github.com/grafana/xk6-dashboard/dashboard" "github.com/grafana/xk6-output-prometheus-remote/pkg/remotewrite" ) +const webDashboardName = "web-dashboard" + // TODO: move this to an output sub-module after we get rid of the old collectors? func getAllOutputConstructors() (map[string]output.Constructor, error) { // Start with the built-in outputs @@ -45,6 +48,7 @@ func getAllOutputConstructors() (map[string]output.Constructor, error) { "experimental-prometheus-rw": func(params output.Params) (output.Output, error) { return remotewrite.New(params) }, + webDashboardName: dashboard.New, } exts := ext.Get(ext.OutputExtension) @@ -92,9 +96,15 @@ func createOutputs( RuntimeOptions: test.preInitState.RuntimeOptions, ExecutionPlan: executionPlan, } - result := make([]output.Output, 0, len(test.derivedConfig.Out)) - for _, outputFullArg := range test.derivedConfig.Out { + outputs := test.derivedConfig.Out + if !test.derivedConfig.NoWebDashboard.Bool { + outputs = append(test.derivedConfig.Out, webDashboardName) + } + + result := make([]output.Output, 0, len(outputs)) + + for _, outputFullArg := range outputs { outputType, outputArg := parseOutputArgument(outputFullArg) outputConstructor, ok := outputConstructors[outputType] if !ok { diff --git a/cmd/ui.go b/cmd/ui.go index d857233999e..8ad869cb186 100644 --- a/cmd/ui.go +++ b/cmd/ui.go @@ -103,8 +103,8 @@ func printExecutionDescription( valueColor := getColor(noColor, color.FgCyan) buf := &strings.Builder{} - fmt.Fprintf(buf, " execution: %s\n", valueColor.Sprint(execution)) - fmt.Fprintf(buf, " script: %s\n", valueColor.Sprint(filename)) + fmt.Fprintf(buf, " execution: %s\n", valueColor.Sprint(execution)) + fmt.Fprintf(buf, " script: %s\n", valueColor.Sprint(filename)) var outputDescriptions []string switch { @@ -114,18 +114,23 @@ func printExecutionDescription( for _, out := range outputs { desc := out.Description() if desc == engine.IngesterDescription { - if len(outputs) != 1 { - continue - } - desc = "-" + continue + } + if ok, v := checkWebDashboardDescription(desc); ok { + fmt.Fprintf(buf, "web dashboard: %s\n", valueColor.Sprint(v)) + + continue } outputDescriptions = append(outputDescriptions, desc) } + if len(outputDescriptions) == 0 { + outputDescriptions = append(outputDescriptions, "-") + } } - fmt.Fprintf(buf, " output: %s\n", valueColor.Sprint(strings.Join(outputDescriptions, ", "))) + fmt.Fprintf(buf, " output: %s\n", valueColor.Sprint(strings.Join(outputDescriptions, ", "))) if gs.Flags.ProfilingEnabled && gs.Flags.Address != "" { - fmt.Fprintf(buf, " profiling: %s\n", valueColor.Sprintf("http://%s/debug/pprof/", gs.Flags.Address)) + fmt.Fprintf(buf, " profiling: %s\n", valueColor.Sprintf("http://%s/debug/pprof/", gs.Flags.Address)) } fmt.Fprintf(buf, "\n") @@ -138,13 +143,13 @@ func printExecutionDescription( scenarioDesc = fmt.Sprintf("%d scenarios", len(executorConfigs)) } - fmt.Fprintf(buf, " scenarios: %s\n", valueColor.Sprintf( + fmt.Fprintf(buf, " scenarios: %s\n", valueColor.Sprintf( "(%.2f%%) %s, %d max VUs, %s max duration (incl. graceful stop):", conf.ExecutionSegment.FloatLength()*100, scenarioDesc, lib.GetMaxPossibleVUs(execPlan), maxDuration.Round(100*time.Millisecond)), ) for _, ec := range executorConfigs { - fmt.Fprintf(buf, " * %s: %s\n", + fmt.Fprintf(buf, " * %s: %s\n", ec.GetName(), ec.GetDescription(et)) } fmt.Fprintf(buf, "\n") @@ -380,3 +385,13 @@ func yamlPrint(w io.Writer, v interface{}) error { } return nil } + +// checkWebDashboardDescription returns true if desc contains web dashboard description. +// The returned string contains info string (URL). +func checkWebDashboardDescription(desc string) (bool, string) { + const webDashboardDescPrefix = webDashboardName + " " + if strings.HasPrefix(desc, webDashboardDescPrefix) { + return true, strings.TrimPrefix(desc, webDashboardDescPrefix) + } + return false, "" +} diff --git a/go.mod b/go.mod index b2c3fa08dd8..adda4ddff9c 100644 --- a/go.mod +++ b/go.mod @@ -14,6 +14,7 @@ require ( github.com/golang/protobuf v1.5.3 github.com/gorilla/websocket v1.5.1 github.com/grafana/xk6-browser v1.2.1 + github.com/grafana/xk6-dashboard v0.6.1 github.com/grafana/xk6-output-prometheus-remote v0.3.1 github.com/grafana/xk6-redis v0.2.0 github.com/grafana/xk6-timers v0.1.2 @@ -74,15 +75,18 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/google/pprof v0.0.0-20230728192033-2ba5b33183c6 // indirect github.com/google/uuid v1.3.0 // indirect + github.com/gorilla/schema v1.2.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect + github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_golang v1.16.0 // indirect github.com/prometheus/client_model v0.4.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.10.1 // indirect + github.com/r3labs/sse/v2 v2.10.0 // indirect github.com/redis/go-redis/v9 v9.0.5 // indirect github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/pretty v1.2.1 // indirect @@ -93,4 +97,5 @@ require ( golang.org/x/text v0.14.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230731193218-e0aa005b6bdf // indirect + gopkg.in/cenkalti/backoff.v1 v1.1.0 // indirect ) diff --git a/go.sum b/go.sum index dd12ab59333..b252fe1ff6b 100644 --- a/go.sum +++ b/go.sum @@ -91,10 +91,14 @@ github.com/google/pprof v0.0.0-20230728192033-2ba5b33183c6 h1:ZgoomqkdjGbQ3+qQXC github.com/google/pprof v0.0.0-20230728192033-2ba5b33183c6/go.mod h1:Jh3hGz2jkYak8qXPD19ryItVnUgpgeqzdkY/D0EaeuA= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/schema v1.2.0 h1:YufUaxZYCKGFuAq3c96BOhjgd5nmXiOY9NGzF247Tsc= +github.com/gorilla/schema v1.2.0/go.mod h1:kgLaKoK1FELgZqMAVxx/5cbj0kT+57qxUrAlIO2eleU= github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= github.com/grafana/xk6-browser v1.2.1 h1:O2fuHHvmmhXvWTPXzD+jsnt1XkVgVjx0+Lj1hsGIWMM= github.com/grafana/xk6-browser v1.2.1/go.mod h1:D3k9/MQHnNKfyzU3fh32pHlrh3GY2LAlkY4wYt/Vn4Y= +github.com/grafana/xk6-dashboard v0.6.1 h1:qUHFId+7/K72VoDqTh5g5I/1SKYtHkav/B++lbpYl/c= +github.com/grafana/xk6-dashboard v0.6.1/go.mod h1:9NoiyT5qcEhJWbIxY6LIkHtUUCbQcjl2cM7evUQ0Apc= github.com/grafana/xk6-output-prometheus-remote v0.3.1 h1:X23rQzlJD8dXWB31DkxR4uPnuRFo8L0Y0H22fSG9xl0= github.com/grafana/xk6-output-prometheus-remote v0.3.1/go.mod h1:0JLAm4ONsNUlNoxJXAwOCfA6GtDwTPs557OplAvE+3o= github.com/grafana/xk6-redis v0.2.0 h1:iXmAKVlAxafZ/h8ptuXTFhGu63IFsyDI8QjUgWm66BU= @@ -154,6 +158,8 @@ github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/gomega v1.20.2 h1:8uQq0zMgLEfa0vRrrBgaJF2gyW9Da9BmfGV+OyUzfkY= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= +github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -166,6 +172,8 @@ github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= +github.com/r3labs/sse/v2 v2.10.0 h1:hFEkLLFY4LDifoHdiCN/LlGBAdVJYsANaLqNYa1l/v0= +github.com/r3labs/sse/v2 v2.10.0/go.mod h1:Igau6Whc+F17QUgML1fYe1VPZzTV6EMCnYktEmkNJ7I= github.com/redis/go-redis/v9 v9.0.5 h1:CuQcn5HIEeK7BgElubPP8CGtE0KakrnbBSTLjathl5o= github.com/redis/go-redis/v9 v9.0.5/go.mod h1:WqMKv5vnQbRuZstUwxQI195wHy+t4PuXDOjzMvcuQHk= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= @@ -244,6 +252,7 @@ golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191116160921-f9c825593386/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= @@ -270,6 +279,7 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -331,6 +341,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/cenkalti/backoff.v1 v1.1.0 h1:Arh75ttbsvlpVA7WtVpH4u9h6Zl46xuptxqLxPiSo4Y= +gopkg.in/cenkalti/backoff.v1 v1.1.0/go.mod h1:J6Vskwqd+OMVJl8C33mmtxTBs2gyzfv7UDAkHu8BrjI= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= diff --git a/vendor/github.com/gorilla/schema/LICENSE b/vendor/github.com/gorilla/schema/LICENSE new file mode 100644 index 00000000000..0e5fb872800 --- /dev/null +++ b/vendor/github.com/gorilla/schema/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2012 Rodrigo Moraes. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/gorilla/schema/README.md b/vendor/github.com/gorilla/schema/README.md new file mode 100644 index 00000000000..aefdd669967 --- /dev/null +++ b/vendor/github.com/gorilla/schema/README.md @@ -0,0 +1,90 @@ +schema +====== +[![GoDoc](https://godoc.org/github.com/gorilla/schema?status.svg)](https://godoc.org/github.com/gorilla/schema) [![Build Status](https://travis-ci.org/gorilla/schema.png?branch=master)](https://travis-ci.org/gorilla/schema) +[![Sourcegraph](https://sourcegraph.com/github.com/gorilla/schema/-/badge.svg)](https://sourcegraph.com/github.com/gorilla/schema?badge) + + +Package gorilla/schema converts structs to and from form values. + +## Example + +Here's a quick example: we parse POST form values and then decode them into a struct: + +```go +// Set a Decoder instance as a package global, because it caches +// meta-data about structs, and an instance can be shared safely. +var decoder = schema.NewDecoder() + +type Person struct { + Name string + Phone string +} + +func MyHandler(w http.ResponseWriter, r *http.Request) { + err := r.ParseForm() + if err != nil { + // Handle error + } + + var person Person + + // r.PostForm is a map of our POST form values + err = decoder.Decode(&person, r.PostForm) + if err != nil { + // Handle error + } + + // Do something with person.Name or person.Phone +} +``` + +Conversely, contents of a struct can be encoded into form values. Here's a variant of the previous example using the Encoder: + +```go +var encoder = schema.NewEncoder() + +func MyHttpRequest() { + person := Person{"Jane Doe", "555-5555"} + form := url.Values{} + + err := encoder.Encode(person, form) + + if err != nil { + // Handle error + } + + // Use form values, for example, with an http client + client := new(http.Client) + res, err := client.PostForm("http://my-api.test", form) +} + +``` + +To define custom names for fields, use a struct tag "schema". To not populate certain fields, use a dash for the name and it will be ignored: + +```go +type Person struct { + Name string `schema:"name,required"` // custom name, must be supplied + Phone string `schema:"phone"` // custom name + Admin bool `schema:"-"` // this field is never set +} +``` + +The supported field types in the struct are: + +* bool +* float variants (float32, float64) +* int variants (int, int8, int16, int32, int64) +* string +* uint variants (uint, uint8, uint16, uint32, uint64) +* struct +* a pointer to one of the above types +* a slice or a pointer to a slice of one of the above types + +Unsupported types are simply ignored, however custom types can be registered to be converted. + +More examples are available on the Gorilla website: https://www.gorillatoolkit.org/pkg/schema + +## License + +BSD licensed. See the LICENSE file for details. diff --git a/vendor/github.com/gorilla/schema/cache.go b/vendor/github.com/gorilla/schema/cache.go new file mode 100644 index 00000000000..0746c1202cb --- /dev/null +++ b/vendor/github.com/gorilla/schema/cache.go @@ -0,0 +1,305 @@ +// Copyright 2012 The Gorilla Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package schema + +import ( + "errors" + "reflect" + "strconv" + "strings" + "sync" +) + +var invalidPath = errors.New("schema: invalid path") + +// newCache returns a new cache. +func newCache() *cache { + c := cache{ + m: make(map[reflect.Type]*structInfo), + regconv: make(map[reflect.Type]Converter), + tag: "schema", + } + return &c +} + +// cache caches meta-data about a struct. +type cache struct { + l sync.RWMutex + m map[reflect.Type]*structInfo + regconv map[reflect.Type]Converter + tag string +} + +// registerConverter registers a converter function for a custom type. +func (c *cache) registerConverter(value interface{}, converterFunc Converter) { + c.regconv[reflect.TypeOf(value)] = converterFunc +} + +// parsePath parses a path in dotted notation verifying that it is a valid +// path to a struct field. +// +// It returns "path parts" which contain indices to fields to be used by +// reflect.Value.FieldByString(). Multiple parts are required for slices of +// structs. +func (c *cache) parsePath(p string, t reflect.Type) ([]pathPart, error) { + var struc *structInfo + var field *fieldInfo + var index64 int64 + var err error + parts := make([]pathPart, 0) + path := make([]string, 0) + keys := strings.Split(p, ".") + for i := 0; i < len(keys); i++ { + if t.Kind() != reflect.Struct { + return nil, invalidPath + } + if struc = c.get(t); struc == nil { + return nil, invalidPath + } + if field = struc.get(keys[i]); field == nil { + return nil, invalidPath + } + // Valid field. Append index. + path = append(path, field.name) + if field.isSliceOfStructs && (!field.unmarshalerInfo.IsValid || (field.unmarshalerInfo.IsValid && field.unmarshalerInfo.IsSliceElement)) { + // Parse a special case: slices of structs. + // i+1 must be the slice index. + // + // Now that struct can implements TextUnmarshaler interface, + // we don't need to force the struct's fields to appear in the path. + // So checking i+2 is not necessary anymore. + i++ + if i+1 > len(keys) { + return nil, invalidPath + } + if index64, err = strconv.ParseInt(keys[i], 10, 0); err != nil { + return nil, invalidPath + } + parts = append(parts, pathPart{ + path: path, + field: field, + index: int(index64), + }) + path = make([]string, 0) + + // Get the next struct type, dropping ptrs. + if field.typ.Kind() == reflect.Ptr { + t = field.typ.Elem() + } else { + t = field.typ + } + if t.Kind() == reflect.Slice { + t = t.Elem() + if t.Kind() == reflect.Ptr { + t = t.Elem() + } + } + } else if field.typ.Kind() == reflect.Ptr { + t = field.typ.Elem() + } else { + t = field.typ + } + } + // Add the remaining. + parts = append(parts, pathPart{ + path: path, + field: field, + index: -1, + }) + return parts, nil +} + +// get returns a cached structInfo, creating it if necessary. +func (c *cache) get(t reflect.Type) *structInfo { + c.l.RLock() + info := c.m[t] + c.l.RUnlock() + if info == nil { + info = c.create(t, "") + c.l.Lock() + c.m[t] = info + c.l.Unlock() + } + return info +} + +// create creates a structInfo with meta-data about a struct. +func (c *cache) create(t reflect.Type, parentAlias string) *structInfo { + info := &structInfo{} + var anonymousInfos []*structInfo + for i := 0; i < t.NumField(); i++ { + if f := c.createField(t.Field(i), parentAlias); f != nil { + info.fields = append(info.fields, f) + if ft := indirectType(f.typ); ft.Kind() == reflect.Struct && f.isAnonymous { + anonymousInfos = append(anonymousInfos, c.create(ft, f.canonicalAlias)) + } + } + } + for i, a := range anonymousInfos { + others := []*structInfo{info} + others = append(others, anonymousInfos[:i]...) + others = append(others, anonymousInfos[i+1:]...) + for _, f := range a.fields { + if !containsAlias(others, f.alias) { + info.fields = append(info.fields, f) + } + } + } + return info +} + +// createField creates a fieldInfo for the given field. +func (c *cache) createField(field reflect.StructField, parentAlias string) *fieldInfo { + alias, options := fieldAlias(field, c.tag) + if alias == "-" { + // Ignore this field. + return nil + } + canonicalAlias := alias + if parentAlias != "" { + canonicalAlias = parentAlias + "." + alias + } + // Check if the type is supported and don't cache it if not. + // First let's get the basic type. + isSlice, isStruct := false, false + ft := field.Type + m := isTextUnmarshaler(reflect.Zero(ft)) + if ft.Kind() == reflect.Ptr { + ft = ft.Elem() + } + if isSlice = ft.Kind() == reflect.Slice; isSlice { + ft = ft.Elem() + if ft.Kind() == reflect.Ptr { + ft = ft.Elem() + } + } + if ft.Kind() == reflect.Array { + ft = ft.Elem() + if ft.Kind() == reflect.Ptr { + ft = ft.Elem() + } + } + if isStruct = ft.Kind() == reflect.Struct; !isStruct { + if c.converter(ft) == nil && builtinConverters[ft.Kind()] == nil { + // Type is not supported. + return nil + } + } + + return &fieldInfo{ + typ: field.Type, + name: field.Name, + alias: alias, + canonicalAlias: canonicalAlias, + unmarshalerInfo: m, + isSliceOfStructs: isSlice && isStruct, + isAnonymous: field.Anonymous, + isRequired: options.Contains("required"), + } +} + +// converter returns the converter for a type. +func (c *cache) converter(t reflect.Type) Converter { + return c.regconv[t] +} + +// ---------------------------------------------------------------------------- + +type structInfo struct { + fields []*fieldInfo +} + +func (i *structInfo) get(alias string) *fieldInfo { + for _, field := range i.fields { + if strings.EqualFold(field.alias, alias) { + return field + } + } + return nil +} + +func containsAlias(infos []*structInfo, alias string) bool { + for _, info := range infos { + if info.get(alias) != nil { + return true + } + } + return false +} + +type fieldInfo struct { + typ reflect.Type + // name is the field name in the struct. + name string + alias string + // canonicalAlias is almost the same as the alias, but is prefixed with + // an embedded struct field alias in dotted notation if this field is + // promoted from the struct. + // For instance, if the alias is "N" and this field is an embedded field + // in a struct "X", canonicalAlias will be "X.N". + canonicalAlias string + // unmarshalerInfo contains information regarding the + // encoding.TextUnmarshaler implementation of the field type. + unmarshalerInfo unmarshaler + // isSliceOfStructs indicates if the field type is a slice of structs. + isSliceOfStructs bool + // isAnonymous indicates whether the field is embedded in the struct. + isAnonymous bool + isRequired bool +} + +func (f *fieldInfo) paths(prefix string) []string { + if f.alias == f.canonicalAlias { + return []string{prefix + f.alias} + } + return []string{prefix + f.alias, prefix + f.canonicalAlias} +} + +type pathPart struct { + field *fieldInfo + path []string // path to the field: walks structs using field names. + index int // struct index in slices of structs. +} + +// ---------------------------------------------------------------------------- + +func indirectType(typ reflect.Type) reflect.Type { + if typ.Kind() == reflect.Ptr { + return typ.Elem() + } + return typ +} + +// fieldAlias parses a field tag to get a field alias. +func fieldAlias(field reflect.StructField, tagName string) (alias string, options tagOptions) { + if tag := field.Tag.Get(tagName); tag != "" { + alias, options = parseTag(tag) + } + if alias == "" { + alias = field.Name + } + return alias, options +} + +// tagOptions is the string following a comma in a struct field's tag, or +// the empty string. It does not include the leading comma. +type tagOptions []string + +// parseTag splits a struct field's url tag into its name and comma-separated +// options. +func parseTag(tag string) (string, tagOptions) { + s := strings.Split(tag, ",") + return s[0], s[1:] +} + +// Contains checks whether the tagOptions contains the specified option. +func (o tagOptions) Contains(option string) bool { + for _, s := range o { + if s == option { + return true + } + } + return false +} diff --git a/vendor/github.com/gorilla/schema/converter.go b/vendor/github.com/gorilla/schema/converter.go new file mode 100644 index 00000000000..4f2116a15ea --- /dev/null +++ b/vendor/github.com/gorilla/schema/converter.go @@ -0,0 +1,145 @@ +// Copyright 2012 The Gorilla Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package schema + +import ( + "reflect" + "strconv" +) + +type Converter func(string) reflect.Value + +var ( + invalidValue = reflect.Value{} + boolType = reflect.Bool + float32Type = reflect.Float32 + float64Type = reflect.Float64 + intType = reflect.Int + int8Type = reflect.Int8 + int16Type = reflect.Int16 + int32Type = reflect.Int32 + int64Type = reflect.Int64 + stringType = reflect.String + uintType = reflect.Uint + uint8Type = reflect.Uint8 + uint16Type = reflect.Uint16 + uint32Type = reflect.Uint32 + uint64Type = reflect.Uint64 +) + +// Default converters for basic types. +var builtinConverters = map[reflect.Kind]Converter{ + boolType: convertBool, + float32Type: convertFloat32, + float64Type: convertFloat64, + intType: convertInt, + int8Type: convertInt8, + int16Type: convertInt16, + int32Type: convertInt32, + int64Type: convertInt64, + stringType: convertString, + uintType: convertUint, + uint8Type: convertUint8, + uint16Type: convertUint16, + uint32Type: convertUint32, + uint64Type: convertUint64, +} + +func convertBool(value string) reflect.Value { + if value == "on" { + return reflect.ValueOf(true) + } else if v, err := strconv.ParseBool(value); err == nil { + return reflect.ValueOf(v) + } + return invalidValue +} + +func convertFloat32(value string) reflect.Value { + if v, err := strconv.ParseFloat(value, 32); err == nil { + return reflect.ValueOf(float32(v)) + } + return invalidValue +} + +func convertFloat64(value string) reflect.Value { + if v, err := strconv.ParseFloat(value, 64); err == nil { + return reflect.ValueOf(v) + } + return invalidValue +} + +func convertInt(value string) reflect.Value { + if v, err := strconv.ParseInt(value, 10, 0); err == nil { + return reflect.ValueOf(int(v)) + } + return invalidValue +} + +func convertInt8(value string) reflect.Value { + if v, err := strconv.ParseInt(value, 10, 8); err == nil { + return reflect.ValueOf(int8(v)) + } + return invalidValue +} + +func convertInt16(value string) reflect.Value { + if v, err := strconv.ParseInt(value, 10, 16); err == nil { + return reflect.ValueOf(int16(v)) + } + return invalidValue +} + +func convertInt32(value string) reflect.Value { + if v, err := strconv.ParseInt(value, 10, 32); err == nil { + return reflect.ValueOf(int32(v)) + } + return invalidValue +} + +func convertInt64(value string) reflect.Value { + if v, err := strconv.ParseInt(value, 10, 64); err == nil { + return reflect.ValueOf(v) + } + return invalidValue +} + +func convertString(value string) reflect.Value { + return reflect.ValueOf(value) +} + +func convertUint(value string) reflect.Value { + if v, err := strconv.ParseUint(value, 10, 0); err == nil { + return reflect.ValueOf(uint(v)) + } + return invalidValue +} + +func convertUint8(value string) reflect.Value { + if v, err := strconv.ParseUint(value, 10, 8); err == nil { + return reflect.ValueOf(uint8(v)) + } + return invalidValue +} + +func convertUint16(value string) reflect.Value { + if v, err := strconv.ParseUint(value, 10, 16); err == nil { + return reflect.ValueOf(uint16(v)) + } + return invalidValue +} + +func convertUint32(value string) reflect.Value { + if v, err := strconv.ParseUint(value, 10, 32); err == nil { + return reflect.ValueOf(uint32(v)) + } + return invalidValue +} + +func convertUint64(value string) reflect.Value { + if v, err := strconv.ParseUint(value, 10, 64); err == nil { + return reflect.ValueOf(v) + } + return invalidValue +} diff --git a/vendor/github.com/gorilla/schema/decoder.go b/vendor/github.com/gorilla/schema/decoder.go new file mode 100644 index 00000000000..025e438b561 --- /dev/null +++ b/vendor/github.com/gorilla/schema/decoder.go @@ -0,0 +1,521 @@ +// Copyright 2012 The Gorilla Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package schema + +import ( + "encoding" + "errors" + "fmt" + "reflect" + "strings" +) + +// NewDecoder returns a new Decoder. +func NewDecoder() *Decoder { + return &Decoder{cache: newCache()} +} + +// Decoder decodes values from a map[string][]string to a struct. +type Decoder struct { + cache *cache + zeroEmpty bool + ignoreUnknownKeys bool +} + +// SetAliasTag changes the tag used to locate custom field aliases. +// The default tag is "schema". +func (d *Decoder) SetAliasTag(tag string) { + d.cache.tag = tag +} + +// ZeroEmpty controls the behaviour when the decoder encounters empty values +// in a map. +// If z is true and a key in the map has the empty string as a value +// then the corresponding struct field is set to the zero value. +// If z is false then empty strings are ignored. +// +// The default value is false, that is empty values do not change +// the value of the struct field. +func (d *Decoder) ZeroEmpty(z bool) { + d.zeroEmpty = z +} + +// IgnoreUnknownKeys controls the behaviour when the decoder encounters unknown +// keys in the map. +// If i is true and an unknown field is encountered, it is ignored. This is +// similar to how unknown keys are handled by encoding/json. +// If i is false then Decode will return an error. Note that any valid keys +// will still be decoded in to the target struct. +// +// To preserve backwards compatibility, the default value is false. +func (d *Decoder) IgnoreUnknownKeys(i bool) { + d.ignoreUnknownKeys = i +} + +// RegisterConverter registers a converter function for a custom type. +func (d *Decoder) RegisterConverter(value interface{}, converterFunc Converter) { + d.cache.registerConverter(value, converterFunc) +} + +// Decode decodes a map[string][]string to a struct. +// +// The first parameter must be a pointer to a struct. +// +// The second parameter is a map, typically url.Values from an HTTP request. +// Keys are "paths" in dotted notation to the struct fields and nested structs. +// +// See the package documentation for a full explanation of the mechanics. +func (d *Decoder) Decode(dst interface{}, src map[string][]string) error { + v := reflect.ValueOf(dst) + if v.Kind() != reflect.Ptr || v.Elem().Kind() != reflect.Struct { + return errors.New("schema: interface must be a pointer to struct") + } + v = v.Elem() + t := v.Type() + errors := MultiError{} + for path, values := range src { + if parts, err := d.cache.parsePath(path, t); err == nil { + if err = d.decode(v, path, parts, values); err != nil { + errors[path] = err + } + } else if !d.ignoreUnknownKeys { + errors[path] = UnknownKeyError{Key: path} + } + } + errors.merge(d.checkRequired(t, src)) + if len(errors) > 0 { + return errors + } + return nil +} + +// checkRequired checks whether required fields are empty +// +// check type t recursively if t has struct fields. +// +// src is the source map for decoding, we use it here to see if those required fields are included in src +func (d *Decoder) checkRequired(t reflect.Type, src map[string][]string) MultiError { + m, errs := d.findRequiredFields(t, "", "") + for key, fields := range m { + if isEmptyFields(fields, src) { + errs[key] = EmptyFieldError{Key: key} + } + } + return errs +} + +// findRequiredFields recursively searches the struct type t for required fields. +// +// canonicalPrefix and searchPrefix are used to resolve full paths in dotted notation +// for nested struct fields. canonicalPrefix is a complete path which never omits +// any embedded struct fields. searchPrefix is a user-friendly path which may omit +// some embedded struct fields to point promoted fields. +func (d *Decoder) findRequiredFields(t reflect.Type, canonicalPrefix, searchPrefix string) (map[string][]fieldWithPrefix, MultiError) { + struc := d.cache.get(t) + if struc == nil { + // unexpect, cache.get never return nil + return nil, MultiError{canonicalPrefix + "*": errors.New("cache fail")} + } + + m := map[string][]fieldWithPrefix{} + errs := MultiError{} + for _, f := range struc.fields { + if f.typ.Kind() == reflect.Struct { + fcprefix := canonicalPrefix + f.canonicalAlias + "." + for _, fspath := range f.paths(searchPrefix) { + fm, ferrs := d.findRequiredFields(f.typ, fcprefix, fspath+".") + for key, fields := range fm { + m[key] = append(m[key], fields...) + } + errs.merge(ferrs) + } + } + if f.isRequired { + key := canonicalPrefix + f.canonicalAlias + m[key] = append(m[key], fieldWithPrefix{ + fieldInfo: f, + prefix: searchPrefix, + }) + } + } + return m, errs +} + +type fieldWithPrefix struct { + *fieldInfo + prefix string +} + +// isEmptyFields returns true if all of specified fields are empty. +func isEmptyFields(fields []fieldWithPrefix, src map[string][]string) bool { + for _, f := range fields { + for _, path := range f.paths(f.prefix) { + v, ok := src[path] + if ok && !isEmpty(f.typ, v) { + return false + } + for key := range src { + if !isEmpty(f.typ, src[key]) && strings.HasPrefix(key, path) { + return false + } + } + } + } + return true +} + +// isEmpty returns true if value is empty for specific type +func isEmpty(t reflect.Type, value []string) bool { + if len(value) == 0 { + return true + } + switch t.Kind() { + case boolType, float32Type, float64Type, intType, int8Type, int32Type, int64Type, stringType, uint8Type, uint16Type, uint32Type, uint64Type: + return len(value[0]) == 0 + } + return false +} + +// decode fills a struct field using a parsed path. +func (d *Decoder) decode(v reflect.Value, path string, parts []pathPart, values []string) error { + // Get the field walking the struct fields by index. + for _, name := range parts[0].path { + if v.Type().Kind() == reflect.Ptr { + if v.IsNil() { + v.Set(reflect.New(v.Type().Elem())) + } + v = v.Elem() + } + + // alloc embedded structs + if v.Type().Kind() == reflect.Struct { + for i := 0; i < v.NumField(); i++ { + field := v.Field(i) + if field.Type().Kind() == reflect.Ptr && field.IsNil() && v.Type().Field(i).Anonymous == true { + field.Set(reflect.New(field.Type().Elem())) + } + } + } + + v = v.FieldByName(name) + } + // Don't even bother for unexported fields. + if !v.CanSet() { + return nil + } + + // Dereference if needed. + t := v.Type() + if t.Kind() == reflect.Ptr { + t = t.Elem() + if v.IsNil() { + v.Set(reflect.New(t)) + } + v = v.Elem() + } + + // Slice of structs. Let's go recursive. + if len(parts) > 1 { + idx := parts[0].index + if v.IsNil() || v.Len() < idx+1 { + value := reflect.MakeSlice(t, idx+1, idx+1) + if v.Len() < idx+1 { + // Resize it. + reflect.Copy(value, v) + } + v.Set(value) + } + return d.decode(v.Index(idx), path, parts[1:], values) + } + + // Get the converter early in case there is one for a slice type. + conv := d.cache.converter(t) + m := isTextUnmarshaler(v) + if conv == nil && t.Kind() == reflect.Slice && m.IsSliceElement { + var items []reflect.Value + elemT := t.Elem() + isPtrElem := elemT.Kind() == reflect.Ptr + if isPtrElem { + elemT = elemT.Elem() + } + + // Try to get a converter for the element type. + conv := d.cache.converter(elemT) + if conv == nil { + conv = builtinConverters[elemT.Kind()] + if conv == nil { + // As we are not dealing with slice of structs here, we don't need to check if the type + // implements TextUnmarshaler interface + return fmt.Errorf("schema: converter not found for %v", elemT) + } + } + + for key, value := range values { + if value == "" { + if d.zeroEmpty { + items = append(items, reflect.Zero(elemT)) + } + } else if m.IsValid { + u := reflect.New(elemT) + if m.IsSliceElementPtr { + u = reflect.New(reflect.PtrTo(elemT).Elem()) + } + if err := u.Interface().(encoding.TextUnmarshaler).UnmarshalText([]byte(value)); err != nil { + return ConversionError{ + Key: path, + Type: t, + Index: key, + Err: err, + } + } + if m.IsSliceElementPtr { + items = append(items, u.Elem().Addr()) + } else if u.Kind() == reflect.Ptr { + items = append(items, u.Elem()) + } else { + items = append(items, u) + } + } else if item := conv(value); item.IsValid() { + if isPtrElem { + ptr := reflect.New(elemT) + ptr.Elem().Set(item) + item = ptr + } + if item.Type() != elemT && !isPtrElem { + item = item.Convert(elemT) + } + items = append(items, item) + } else { + if strings.Contains(value, ",") { + values := strings.Split(value, ",") + for _, value := range values { + if value == "" { + if d.zeroEmpty { + items = append(items, reflect.Zero(elemT)) + } + } else if item := conv(value); item.IsValid() { + if isPtrElem { + ptr := reflect.New(elemT) + ptr.Elem().Set(item) + item = ptr + } + if item.Type() != elemT && !isPtrElem { + item = item.Convert(elemT) + } + items = append(items, item) + } else { + return ConversionError{ + Key: path, + Type: elemT, + Index: key, + } + } + } + } else { + return ConversionError{ + Key: path, + Type: elemT, + Index: key, + } + } + } + } + value := reflect.Append(reflect.MakeSlice(t, 0, 0), items...) + v.Set(value) + } else { + val := "" + // Use the last value provided if any values were provided + if len(values) > 0 { + val = values[len(values)-1] + } + + if conv != nil { + if value := conv(val); value.IsValid() { + v.Set(value.Convert(t)) + } else { + return ConversionError{ + Key: path, + Type: t, + Index: -1, + } + } + } else if m.IsValid { + if m.IsPtr { + u := reflect.New(v.Type()) + if err := u.Interface().(encoding.TextUnmarshaler).UnmarshalText([]byte(val)); err != nil { + return ConversionError{ + Key: path, + Type: t, + Index: -1, + Err: err, + } + } + v.Set(reflect.Indirect(u)) + } else { + // If the value implements the encoding.TextUnmarshaler interface + // apply UnmarshalText as the converter + if err := m.Unmarshaler.UnmarshalText([]byte(val)); err != nil { + return ConversionError{ + Key: path, + Type: t, + Index: -1, + Err: err, + } + } + } + } else if val == "" { + if d.zeroEmpty { + v.Set(reflect.Zero(t)) + } + } else if conv := builtinConverters[t.Kind()]; conv != nil { + if value := conv(val); value.IsValid() { + v.Set(value.Convert(t)) + } else { + return ConversionError{ + Key: path, + Type: t, + Index: -1, + } + } + } else { + return fmt.Errorf("schema: converter not found for %v", t) + } + } + return nil +} + +func isTextUnmarshaler(v reflect.Value) unmarshaler { + // Create a new unmarshaller instance + m := unmarshaler{} + if m.Unmarshaler, m.IsValid = v.Interface().(encoding.TextUnmarshaler); m.IsValid { + return m + } + // As the UnmarshalText function should be applied to the pointer of the + // type, we check that type to see if it implements the necessary + // method. + if m.Unmarshaler, m.IsValid = reflect.New(v.Type()).Interface().(encoding.TextUnmarshaler); m.IsValid { + m.IsPtr = true + return m + } + + // if v is []T or *[]T create new T + t := v.Type() + if t.Kind() == reflect.Ptr { + t = t.Elem() + } + if t.Kind() == reflect.Slice { + // Check if the slice implements encoding.TextUnmarshaller + if m.Unmarshaler, m.IsValid = v.Interface().(encoding.TextUnmarshaler); m.IsValid { + return m + } + // If t is a pointer slice, check if its elements implement + // encoding.TextUnmarshaler + m.IsSliceElement = true + if t = t.Elem(); t.Kind() == reflect.Ptr { + t = reflect.PtrTo(t.Elem()) + v = reflect.Zero(t) + m.IsSliceElementPtr = true + m.Unmarshaler, m.IsValid = v.Interface().(encoding.TextUnmarshaler) + return m + } + } + + v = reflect.New(t) + m.Unmarshaler, m.IsValid = v.Interface().(encoding.TextUnmarshaler) + return m +} + +// TextUnmarshaler helpers ---------------------------------------------------- +// unmarshaller contains information about a TextUnmarshaler type +type unmarshaler struct { + Unmarshaler encoding.TextUnmarshaler + // IsValid indicates whether the resolved type indicated by the other + // flags implements the encoding.TextUnmarshaler interface. + IsValid bool + // IsPtr indicates that the resolved type is the pointer of the original + // type. + IsPtr bool + // IsSliceElement indicates that the resolved type is a slice element of + // the original type. + IsSliceElement bool + // IsSliceElementPtr indicates that the resolved type is a pointer to a + // slice element of the original type. + IsSliceElementPtr bool +} + +// Errors --------------------------------------------------------------------- + +// ConversionError stores information about a failed conversion. +type ConversionError struct { + Key string // key from the source map. + Type reflect.Type // expected type of elem + Index int // index for multi-value fields; -1 for single-value fields. + Err error // low-level error (when it exists) +} + +func (e ConversionError) Error() string { + var output string + + if e.Index < 0 { + output = fmt.Sprintf("schema: error converting value for %q", e.Key) + } else { + output = fmt.Sprintf("schema: error converting value for index %d of %q", + e.Index, e.Key) + } + + if e.Err != nil { + output = fmt.Sprintf("%s. Details: %s", output, e.Err) + } + + return output +} + +// UnknownKeyError stores information about an unknown key in the source map. +type UnknownKeyError struct { + Key string // key from the source map. +} + +func (e UnknownKeyError) Error() string { + return fmt.Sprintf("schema: invalid path %q", e.Key) +} + +// EmptyFieldError stores information about an empty required field. +type EmptyFieldError struct { + Key string // required key in the source map. +} + +func (e EmptyFieldError) Error() string { + return fmt.Sprintf("%v is empty", e.Key) +} + +// MultiError stores multiple decoding errors. +// +// Borrowed from the App Engine SDK. +type MultiError map[string]error + +func (e MultiError) Error() string { + s := "" + for _, err := range e { + s = err.Error() + break + } + switch len(e) { + case 0: + return "(0 errors)" + case 1: + return s + case 2: + return s + " (and 1 other error)" + } + return fmt.Sprintf("%s (and %d other errors)", s, len(e)-1) +} + +func (e MultiError) merge(errors MultiError) { + for key, err := range errors { + if e[key] == nil { + e[key] = err + } + } +} diff --git a/vendor/github.com/gorilla/schema/doc.go b/vendor/github.com/gorilla/schema/doc.go new file mode 100644 index 00000000000..aae9f33f9d7 --- /dev/null +++ b/vendor/github.com/gorilla/schema/doc.go @@ -0,0 +1,148 @@ +// Copyright 2012 The Gorilla Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +/* +Package gorilla/schema fills a struct with form values. + +The basic usage is really simple. Given this struct: + + type Person struct { + Name string + Phone string + } + +...we can fill it passing a map to the Decode() function: + + values := map[string][]string{ + "Name": {"John"}, + "Phone": {"999-999-999"}, + } + person := new(Person) + decoder := schema.NewDecoder() + decoder.Decode(person, values) + +This is just a simple example and it doesn't make a lot of sense to create +the map manually. Typically it will come from a http.Request object and +will be of type url.Values, http.Request.Form, or http.Request.MultipartForm: + + func MyHandler(w http.ResponseWriter, r *http.Request) { + err := r.ParseForm() + + if err != nil { + // Handle error + } + + decoder := schema.NewDecoder() + // r.PostForm is a map of our POST form values + err := decoder.Decode(person, r.PostForm) + + if err != nil { + // Handle error + } + + // Do something with person.Name or person.Phone + } + +Note: it is a good idea to set a Decoder instance as a package global, +because it caches meta-data about structs, and an instance can be shared safely: + + var decoder = schema.NewDecoder() + +To define custom names for fields, use a struct tag "schema". To not populate +certain fields, use a dash for the name and it will be ignored: + + type Person struct { + Name string `schema:"name"` // custom name + Phone string `schema:"phone"` // custom name + Admin bool `schema:"-"` // this field is never set + } + +The supported field types in the destination struct are: + + * bool + * float variants (float32, float64) + * int variants (int, int8, int16, int32, int64) + * string + * uint variants (uint, uint8, uint16, uint32, uint64) + * struct + * a pointer to one of the above types + * a slice or a pointer to a slice of one of the above types + +Non-supported types are simply ignored, however custom types can be registered +to be converted. + +To fill nested structs, keys must use a dotted notation as the "path" for the +field. So for example, to fill the struct Person below: + + type Phone struct { + Label string + Number string + } + + type Person struct { + Name string + Phone Phone + } + +...the source map must have the keys "Name", "Phone.Label" and "Phone.Number". +This means that an HTML form to fill a Person struct must look like this: + +
+ + + +
+ +Single values are filled using the first value for a key from the source map. +Slices are filled using all values for a key from the source map. So to fill +a Person with multiple Phone values, like: + + type Person struct { + Name string + Phones []Phone + } + +...an HTML form that accepts three Phone values would look like this: + +
+ + + + + + + +
+ +Notice that only for slices of structs the slice index is required. +This is needed for disambiguation: if the nested struct also had a slice +field, we could not translate multiple values to it if we did not use an +index for the parent struct. + +There's also the possibility to create a custom type that implements the +TextUnmarshaler interface, and in this case there's no need to register +a converter, like: + + type Person struct { + Emails []Email + } + + type Email struct { + *mail.Address + } + + func (e *Email) UnmarshalText(text []byte) (err error) { + e.Address, err = mail.ParseAddress(string(text)) + return + } + +...an HTML form that accepts three Email values would look like this: + +
+ + + +
+*/ +package schema diff --git a/vendor/github.com/gorilla/schema/encoder.go b/vendor/github.com/gorilla/schema/encoder.go new file mode 100644 index 00000000000..f0ed6312100 --- /dev/null +++ b/vendor/github.com/gorilla/schema/encoder.go @@ -0,0 +1,202 @@ +package schema + +import ( + "errors" + "fmt" + "reflect" + "strconv" +) + +type encoderFunc func(reflect.Value) string + +// Encoder encodes values from a struct into url.Values. +type Encoder struct { + cache *cache + regenc map[reflect.Type]encoderFunc +} + +// NewEncoder returns a new Encoder with defaults. +func NewEncoder() *Encoder { + return &Encoder{cache: newCache(), regenc: make(map[reflect.Type]encoderFunc)} +} + +// Encode encodes a struct into map[string][]string. +// +// Intended for use with url.Values. +func (e *Encoder) Encode(src interface{}, dst map[string][]string) error { + v := reflect.ValueOf(src) + + return e.encode(v, dst) +} + +// RegisterEncoder registers a converter for encoding a custom type. +func (e *Encoder) RegisterEncoder(value interface{}, encoder func(reflect.Value) string) { + e.regenc[reflect.TypeOf(value)] = encoder +} + +// SetAliasTag changes the tag used to locate custom field aliases. +// The default tag is "schema". +func (e *Encoder) SetAliasTag(tag string) { + e.cache.tag = tag +} + +// isValidStructPointer test if input value is a valid struct pointer. +func isValidStructPointer(v reflect.Value) bool { + return v.Type().Kind() == reflect.Ptr && v.Elem().IsValid() && v.Elem().Type().Kind() == reflect.Struct +} + +func isZero(v reflect.Value) bool { + switch v.Kind() { + case reflect.Func: + case reflect.Map, reflect.Slice: + return v.IsNil() || v.Len() == 0 + case reflect.Array: + z := true + for i := 0; i < v.Len(); i++ { + z = z && isZero(v.Index(i)) + } + return z + case reflect.Struct: + type zero interface { + IsZero() bool + } + if v.Type().Implements(reflect.TypeOf((*zero)(nil)).Elem()) { + iz := v.MethodByName("IsZero").Call([]reflect.Value{})[0] + return iz.Interface().(bool) + } + z := true + for i := 0; i < v.NumField(); i++ { + z = z && isZero(v.Field(i)) + } + return z + } + // Compare other types directly: + z := reflect.Zero(v.Type()) + return v.Interface() == z.Interface() +} + +func (e *Encoder) encode(v reflect.Value, dst map[string][]string) error { + if v.Kind() == reflect.Ptr { + v = v.Elem() + } + if v.Kind() != reflect.Struct { + return errors.New("schema: interface must be a struct") + } + t := v.Type() + + errors := MultiError{} + + for i := 0; i < v.NumField(); i++ { + name, opts := fieldAlias(t.Field(i), e.cache.tag) + if name == "-" { + continue + } + + // Encode struct pointer types if the field is a valid pointer and a struct. + if isValidStructPointer(v.Field(i)) { + e.encode(v.Field(i).Elem(), dst) + continue + } + + encFunc := typeEncoder(v.Field(i).Type(), e.regenc) + + // Encode non-slice types and custom implementations immediately. + if encFunc != nil { + value := encFunc(v.Field(i)) + if opts.Contains("omitempty") && isZero(v.Field(i)) { + continue + } + + dst[name] = append(dst[name], value) + continue + } + + if v.Field(i).Type().Kind() == reflect.Struct { + e.encode(v.Field(i), dst) + continue + } + + if v.Field(i).Type().Kind() == reflect.Slice { + encFunc = typeEncoder(v.Field(i).Type().Elem(), e.regenc) + } + + if encFunc == nil { + errors[v.Field(i).Type().String()] = fmt.Errorf("schema: encoder not found for %v", v.Field(i)) + continue + } + + // Encode a slice. + if v.Field(i).Len() == 0 && opts.Contains("omitempty") { + continue + } + + dst[name] = []string{} + for j := 0; j < v.Field(i).Len(); j++ { + dst[name] = append(dst[name], encFunc(v.Field(i).Index(j))) + } + } + + if len(errors) > 0 { + return errors + } + return nil +} + +func typeEncoder(t reflect.Type, reg map[reflect.Type]encoderFunc) encoderFunc { + if f, ok := reg[t]; ok { + return f + } + + switch t.Kind() { + case reflect.Bool: + return encodeBool + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return encodeInt + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + return encodeUint + case reflect.Float32: + return encodeFloat32 + case reflect.Float64: + return encodeFloat64 + case reflect.Ptr: + f := typeEncoder(t.Elem(), reg) + return func(v reflect.Value) string { + if v.IsNil() { + return "null" + } + return f(v.Elem()) + } + case reflect.String: + return encodeString + default: + return nil + } +} + +func encodeBool(v reflect.Value) string { + return strconv.FormatBool(v.Bool()) +} + +func encodeInt(v reflect.Value) string { + return strconv.FormatInt(int64(v.Int()), 10) +} + +func encodeUint(v reflect.Value) string { + return strconv.FormatUint(uint64(v.Uint()), 10) +} + +func encodeFloat(v reflect.Value, bits int) string { + return strconv.FormatFloat(v.Float(), 'f', 6, bits) +} + +func encodeFloat32(v reflect.Value) string { + return encodeFloat(v, 32) +} + +func encodeFloat64(v reflect.Value) string { + return encodeFloat(v, 64) +} + +func encodeString(v reflect.Value) string { + return v.String() +} diff --git a/vendor/github.com/grafana/xk6-dashboard/LICENSE b/vendor/github.com/grafana/xk6-dashboard/LICENSE new file mode 100644 index 00000000000..be3f7b28e56 --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/LICENSE @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/aggregate.go b/vendor/github.com/grafana/xk6-dashboard/dashboard/aggregate.go new file mode 100644 index 00000000000..abdaee7072e --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/aggregate.go @@ -0,0 +1,280 @@ +// SPDX-FileCopyrightText: 2023 Raintank, Inc. dba Grafana Labs +// +// SPDX-License-Identifier: AGPL-3.0-only + +package dashboard + +import ( + "bufio" + "compress/gzip" + "encoding/json" + "errors" + "fmt" + "io" + "strings" + "sync" + "time" + + "github.com/sirupsen/logrus" + "github.com/spf13/afero" + "github.com/tidwall/gjson" + "go.k6.io/k6/metrics" + "go.k6.io/k6/output" +) + +const gzSuffix = ".gz" + +type aggregator struct { + registry *registry + buffer *output.SampleBuffer + + input io.ReadCloser + writer io.WriteCloser + encoder *json.Encoder + + logger logrus.FieldLogger + + options *options + + cumulative *meter + + timestamp time.Time + + once sync.Once + + seenMetrics map[string]struct{} +} + +func closer(what io.Closer, logger logrus.FieldLogger) { + if closeErr := what.Close(); closeErr != nil { + logger.Error(closeErr) + } +} + +func aggregate(input, output string, opts *options, proc *process) error { + agg := new(aggregator) + + agg.registry = newRegistry() + agg.options = opts + agg.logger = proc.logger + agg.seenMetrics = make(map[string]struct{}) + + var inputFile, outputFile afero.File + var err error + + if inputFile, err = proc.fs.Open(input); err != nil { + return err + } + + agg.input = inputFile + + defer closer(inputFile, proc.logger) + + if strings.HasSuffix(input, gzSuffix) { + if agg.input, err = gzip.NewReader(inputFile); err != nil { + return err + } + + defer closer(agg.input, proc.logger) + } + + if outputFile, err = proc.fs.Create(output); err != nil { + return err + } + + agg.writer = outputFile + + defer closer(outputFile, proc.logger) + + if strings.HasSuffix(output, gzSuffix) { + agg.writer = gzip.NewWriter(outputFile) + + defer closer(agg.writer, proc.logger) + } + + agg.encoder = json.NewEncoder(agg.writer) + + return agg.run() +} + +func (agg *aggregator) run() error { + param := new(paramData) + + param.Period = time.Duration(agg.options.Period.Milliseconds()) + + agg.fireEvent(paramEvent, param) + + scanner := bufio.NewScanner(agg.input) + + scanner.Split(bufio.ScanLines) + + for scanner.Scan() { + if err := agg.processLine(scanner.Bytes()); err != nil { + return err + } + } + + now := agg.timestamp + + agg.updateAndSend(nil, newMeter(agg.options.Period, now, agg.options.Tags), stopEvent, now) + + return nil +} + +func (agg *aggregator) addMetricSamples(samples []metrics.SampleContainer) { + firstTime := samples[0].GetSamples()[0].Time + + agg.once.Do(func() { + agg.cumulative = newMeter(0, firstTime, agg.options.Tags) + agg.timestamp = firstTime + agg.buffer = new(output.SampleBuffer) + + agg.updateAndSend( + nil, + newMeter(agg.options.Period, firstTime, agg.options.Tags), + startEvent, + firstTime, + ) + }) + + if firstTime.Sub(agg.timestamp) > agg.options.Period { + agg.flush() + agg.timestamp = firstTime + } + + agg.buffer.AddMetricSamples(samples) +} + +func (agg *aggregator) flush() { + flushed := agg.buffer.GetBufferedSamples() + if len(flushed) == 0 { + return + } + + samples := flushed[len(flushed)-1].GetSamples() + now := samples[len(samples)-1].Time + + agg.updateAndSend( + flushed, + newMeter(agg.options.Period, now, agg.options.Tags), + snapshotEvent, + now, + ) + agg.updateAndSend(flushed, agg.cumulative, cumulativeEvent, now) +} + +func (agg *aggregator) updateAndSend( + containers []metrics.SampleContainer, + met *meter, + event string, + now time.Time, +) { + data, err := met.update(containers, now) + if err != nil { + agg.logger.WithError(err).Warn("Error while processing samples") + + return + } + + newbies := met.newbies(agg.seenMetrics) + if len(newbies) != 0 { + agg.fireEvent(metricEvent, newbies) + } + + agg.fireEvent(event, data) +} + +func (agg *aggregator) fireEvent(event string, data interface{}) { + if err := agg.encoder.Encode(recorderEnvelope{Name: event, Data: data}); err != nil { + agg.logger.Warn(err) + } +} + +func (agg *aggregator) processLine(data []byte) error { + typ := gjson.GetBytes(data, "type").String() + + if typ == typeMetric { + return agg.processMetric(data) + } + + if typ == typePoint { + return agg.processPoint(data) + } + + return nil +} + +func (agg *aggregator) processMetric(data []byte) error { + var metricType metrics.MetricType + + err := metricType.UnmarshalText([]byte(gjson.GetBytes(data, "data.type").String())) + if err != nil { + return err + } + + var valueType metrics.ValueType + + err = valueType.UnmarshalText([]byte(gjson.GetBytes(data, "data.contains").String())) + if err != nil { + return err + } + + name := gjson.GetBytes(data, "data.name").String() + + _, err = agg.registry.getOrNew(name, metricType, valueType) + + return err +} + +func (agg *aggregator) processPoint(data []byte) error { + timestamp := gjson.GetBytes(data, "data.time").Time() + name := gjson.GetBytes(data, "metric").String() + + metric := agg.registry.Get(name) + if metric == nil { + return fmt.Errorf("%w: %s", errUnknownMetric, name) + } + + tags := agg.tagSetFrom(gjson.GetBytes(data, "data.tags")) + + sample := metrics.Sample{ //nolint:exhaustruct + Time: timestamp, + Value: gjson.GetBytes(data, "data.value").Float(), + TimeSeries: metrics.TimeSeries{ //nolint:exhaustruct + Metric: metric, + Tags: tags, + }, + } + + container := metrics.ConnectedSamples{ //nolint:exhaustruct + Samples: []metrics.Sample{sample}, + Time: sample.Time, + Tags: tags, + } + + agg.addMetricSamples([]metrics.SampleContainer{container}) + + return nil +} + +func (agg *aggregator) tagSetFrom(res gjson.Result) *metrics.TagSet { + asMap := res.Map() + if len(asMap) == 0 { + return nil + } + + set := agg.registry.Registry.RootTagSet() + + for key, value := range asMap { + set = set.With(key, value.String()) + } + + return set +} + +var errUnknownMetric = errors.New("unknown metric") + +const ( + typeMetric = "Metric" + typePoint = "Point" +) diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/assets.go b/vendor/github.com/grafana/xk6-dashboard/dashboard/assets.go new file mode 100644 index 00000000000..34d087e1cf2 --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/assets.go @@ -0,0 +1,63 @@ +// SPDX-FileCopyrightText: 2023 Raintank, Inc. dba Grafana Labs +// +// SPDX-License-Identifier: AGPL-3.0-only + +package dashboard + +import ( + "embed" + "encoding/json" + "io/fs" + + "github.com/sirupsen/logrus" +) + +type assets struct { + config json.RawMessage + ui fs.FS + report fs.FS +} + +//go:embed assets/packages/ui/dist assets/packages/report/dist assets/packages/config/dist +var assetsFS embed.FS + +const assetsPackages = "assets/packages/" + +func newAssets() *assets { + return newAssetsFrom(assetsFS) +} + +func newCustomizedAssets(proc *process) *assets { + assets := newAssetsFrom(assetsFS) + + custom, err := customize(assets.config, proc) + if err != nil { + logrus.Fatal(err) + } + + assets.config = custom + + return assets +} + +func newAssetsFrom(efs embed.FS) *assets { + config, err := efs.ReadFile(assetsPackages + "config/dist/config.json") + if err != nil { + panic(err) + } + + return &assets{ + ui: assetDir(assetsPackages+"ui/dist", efs), + report: assetDir(assetsPackages+"report/dist", efs), + config: config, + } +} + +func assetDir(dirname string, parent fs.FS) fs.FS { + subfs, err := fs.Sub(parent, dirname) + if err != nil { + panic(err) + } + + return subfs +} diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/config/dist/config.json.license b/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/config/dist/config.json.license new file mode 100644 index 00000000000..f5b51f2bcd1 --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/config/dist/config.json.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2023 Raintank, Inc. dba Grafana Labs + +SPDX-License-Identifier: AGPL-3.0-only diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/report/dist/index.html b/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/report/dist/index.html new file mode 100644 index 00000000000..40b731dc29e --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/report/dist/index.html @@ -0,0 +1,54 @@ + + + + + + + + + + k6 report + + + + + +
+ + + + + diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/assets/dark_mode-530eef3b.svg b/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/assets/dark_mode-530eef3b.svg new file mode 100644 index 00000000000..6b724cba318 --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/assets/dark_mode-530eef3b.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/assets/dark_mode-530eef3b.svg.license b/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/assets/dark_mode-530eef3b.svg.license new file mode 100644 index 00000000000..f5b51f2bcd1 --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/assets/dark_mode-530eef3b.svg.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2023 Raintank, Inc. dba Grafana Labs + +SPDX-License-Identifier: AGPL-3.0-only diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/assets/expand_less-2d2317d9.svg b/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/assets/expand_less-2d2317d9.svg new file mode 100644 index 00000000000..ab9e0dfc44b --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/assets/expand_less-2d2317d9.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/assets/expand_less-2d2317d9.svg.license b/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/assets/expand_less-2d2317d9.svg.license new file mode 100644 index 00000000000..f5b51f2bcd1 --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/assets/expand_less-2d2317d9.svg.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2023 Raintank, Inc. dba Grafana Labs + +SPDX-License-Identifier: AGPL-3.0-only diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/assets/expand_more-c6b4db32.svg b/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/assets/expand_more-c6b4db32.svg new file mode 100644 index 00000000000..685a700d676 --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/assets/expand_more-c6b4db32.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/assets/expand_more-c6b4db32.svg.license b/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/assets/expand_more-c6b4db32.svg.license new file mode 100644 index 00000000000..f5b51f2bcd1 --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/assets/expand_more-c6b4db32.svg.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2023 Raintank, Inc. dba Grafana Labs + +SPDX-License-Identifier: AGPL-3.0-only diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/assets/index-6b9b59c9.js b/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/assets/index-6b9b59c9.js new file mode 100644 index 00000000000..027fa45612b --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/assets/index-6b9b59c9.js @@ -0,0 +1,161 @@ +// SPDX-FileCopyrightText: 2023 Raintank, Inc. dba Grafana Labs +// +// SPDX-License-Identifier: AGPL-3.0-only + +var mw=Object.defineProperty;var gw=(e,t,n)=>t in e?mw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Se=(e,t,n)=>(gw(e,typeof t!="symbol"?t+"":t,n),n);function yw(e,t){for(var n=0;nr[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();var vw=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function bs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function xw(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}),n}var Dg={exports:{}},vu={},Bg={exports:{}},Te={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Es=Symbol.for("react.element"),ww=Symbol.for("react.portal"),Sw=Symbol.for("react.fragment"),_w=Symbol.for("react.strict_mode"),kw=Symbol.for("react.profiler"),bw=Symbol.for("react.provider"),Ew=Symbol.for("react.context"),Cw=Symbol.for("react.forward_ref"),Tw=Symbol.for("react.suspense"),Pw=Symbol.for("react.memo"),Rw=Symbol.for("react.lazy"),Gh=Symbol.iterator;function Mw(e){return e===null||typeof e!="object"?null:(e=Gh&&e[Gh]||e["@@iterator"],typeof e=="function"?e:null)}var Fg={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},jg=Object.assign,Wg={};function nl(e,t,n){this.props=e,this.context=t,this.refs=Wg,this.updater=n||Fg}nl.prototype.isReactComponent={};nl.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};nl.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Hg(){}Hg.prototype=nl.prototype;function Wd(e,t,n){this.props=e,this.context=t,this.refs=Wg,this.updater=n||Fg}var Hd=Wd.prototype=new Hg;Hd.constructor=Wd;jg(Hd,nl.prototype);Hd.isPureReactComponent=!0;var Yh=Array.isArray,Ug=Object.prototype.hasOwnProperty,Ud={current:null},Vg={key:!0,ref:!0,__self:!0,__source:!0};function Kg(e,t,n){var r,o={},i=null,l=null;if(t!=null)for(r in t.ref!==void 0&&(l=t.ref),t.key!==void 0&&(i=""+t.key),t)Ug.call(t,r)&&!Vg.hasOwnProperty(r)&&(o[r]=t[r]);var s=arguments.length-2;if(s===1)o.children=n;else if(1>>1,Z=H[oe];if(0>>1;oeo(ye,G))aeo(Ce,ye)?(H[oe]=Ce,H[ae]=G,oe=ae):(H[oe]=ye,H[te]=G,oe=te);else if(aeo(Ce,G))H[oe]=Ce,H[ae]=G,oe=ae;else break e}}return ne}function o(H,ne){var G=H.sortIndex-ne.sortIndex;return G!==0?G:H.id-ne.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var l=Date,s=l.now();e.unstable_now=function(){return l.now()-s}}var u=[],a=[],c=1,p=null,f=3,h=!1,x=!1,v=!1,C=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,m=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function S(H){for(var ne=n(a);ne!==null;){if(ne.callback===null)r(a);else if(ne.startTime<=H)r(a),ne.sortIndex=ne.expirationTime,t(u,ne);else break;ne=n(a)}}function E(H){if(v=!1,S(H),!x)if(n(u)!==null)x=!0,me(P);else{var ne=n(a);ne!==null&&se(E,ne.startTime-H)}}function P(H,ne){x=!1,v&&(v=!1,w(z),z=-1),h=!0;var G=f;try{for(S(ne),p=n(u);p!==null&&(!(p.expirationTime>ne)||H&&!D());){var oe=p.callback;if(typeof oe=="function"){p.callback=null,f=p.priorityLevel;var Z=oe(p.expirationTime<=ne);ne=e.unstable_now(),typeof Z=="function"?p.callback=Z:p===n(u)&&r(u),S(ne)}else r(u);p=n(u)}if(p!==null)var xe=!0;else{var te=n(a);te!==null&&se(E,te.startTime-ne),xe=!1}return xe}finally{p=null,f=G,h=!1}}var N=!1,R=null,z=-1,j=5,O=-1;function D(){return!(e.unstable_now()-OH||125oe?(H.sortIndex=G,t(a,H),n(u)===null&&H===n(a)&&(v?(w(z),z=-1):v=!0,se(E,G-oe))):(H.sortIndex=Z,t(u,H),x||h||(x=!0,me(P))),H},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(H){var ne=f;return function(){var G=f;f=ne;try{return H.apply(this,arguments)}finally{f=G}}}})(Qg);qg.exports=Qg;var jw=qg.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Xg=L,An=jw;function K(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Of=Object.prototype.hasOwnProperty,Ww=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Qh={},Xh={};function Hw(e){return Of.call(Xh,e)?!0:Of.call(Qh,e)?!1:Ww.test(e)?Xh[e]=!0:(Qh[e]=!0,!1)}function Uw(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Vw(e,t,n,r){if(t===null||typeof t>"u"||Uw(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function yn(e,t,n,r,o,i,l){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=l}var nn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){nn[e]=new yn(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];nn[t]=new yn(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){nn[e]=new yn(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){nn[e]=new yn(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){nn[e]=new yn(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){nn[e]=new yn(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){nn[e]=new yn(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){nn[e]=new yn(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){nn[e]=new yn(e,5,!1,e.toLowerCase(),null,!1,!1)});var Kd=/[\-:]([a-z])/g;function Gd(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Kd,Gd);nn[t]=new yn(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Kd,Gd);nn[t]=new yn(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Kd,Gd);nn[t]=new yn(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){nn[e]=new yn(e,1,!1,e.toLowerCase(),null,!1,!1)});nn.xlinkHref=new yn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){nn[e]=new yn(e,1,!1,e.toLowerCase(),null,!0,!0)});function Yd(e,t,n,r){var o=nn.hasOwnProperty(t)?nn[t]:null;(o!==null?o.type!==0:r||!(2s||o[l]!==i[s]){var u=` +`+o[l].replace(" at new "," at ");return e.displayName&&u.includes("")&&(u=u.replace("",e.displayName)),u}while(1<=l&&0<=s);break}}}finally{Qc=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ll(e):""}function Kw(e){switch(e.tag){case 5:return Ll(e.type);case 16:return Ll("Lazy");case 13:return Ll("Suspense");case 19:return Ll("SuspenseList");case 0:case 2:case 15:return e=Xc(e.type,!1),e;case 11:return e=Xc(e.type.render,!1),e;case 1:return e=Xc(e.type,!0),e;default:return""}}function If(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case vi:return"Fragment";case yi:return"Portal";case zf:return"Profiler";case qd:return"StrictMode";case Lf:return"Suspense";case Af:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ey:return(e.displayName||"Context")+".Consumer";case Jg:return(e._context.displayName||"Context")+".Provider";case Qd:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Xd:return t=e.displayName||null,t!==null?t:If(e.type)||"Memo";case Yr:t=e._payload,e=e._init;try{return If(e(t))}catch{}}return null}function Gw(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return If(t);case 8:return t===qd?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function uo(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ny(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Yw(e){var t=ny(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(l){r=""+l,i.call(this,l)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(l){r=""+l},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ys(e){e._valueTracker||(e._valueTracker=Yw(e))}function ry(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=ny(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Ia(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Df(e,t){var n=t.checked;return pt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Jh(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=uo(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function oy(e,t){t=t.checked,t!=null&&Yd(e,"checked",t,!1)}function Bf(e,t){oy(e,t);var n=uo(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Ff(e,t.type,n):t.hasOwnProperty("defaultValue")&&Ff(e,t.type,uo(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function e0(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Ff(e,t,n){(t!=="number"||Ia(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Al=Array.isArray;function Mi(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o"+t.valueOf().toString()+"",t=qs.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ns(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Hl={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},qw=["Webkit","ms","Moz","O"];Object.keys(Hl).forEach(function(e){qw.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Hl[t]=Hl[e]})});function ay(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Hl.hasOwnProperty(e)&&Hl[e]?(""+t).trim():t+"px"}function uy(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=ay(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var Qw=pt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Hf(e,t){if(t){if(Qw[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(K(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(K(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(K(61))}if(t.style!=null&&typeof t.style!="object")throw Error(K(62))}}function Uf(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Vf=null;function Zd(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Kf=null,$i=null,Ni=null;function r0(e){if(e=Ps(e)){if(typeof Kf!="function")throw Error(K(280));var t=e.stateNode;t&&(t=ku(t),Kf(e.stateNode,e.type,t))}}function cy(e){$i?Ni?Ni.push(e):Ni=[e]:$i=e}function fy(){if($i){var e=$i,t=Ni;if(Ni=$i=null,r0(e),t)for(e=0;e>>=0,e===0?32:31-(sS(e)/aS|0)|0}var Qs=64,Xs=4194304;function Il(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ja(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,i=e.pingedLanes,l=n&268435455;if(l!==0){var s=l&~o;s!==0?r=Il(s):(i&=l,i!==0&&(r=Il(i)))}else l=n&~o,l!==0?r=Il(l):i!==0&&(r=Il(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,i=t&-t,o>=i||o===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Cs(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-sr(t),e[t]=n}function dS(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Vl),d0=String.fromCharCode(32),p0=!1;function $y(e,t){switch(e){case"keyup":return FS.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ny(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var xi=!1;function WS(e,t){switch(e){case"compositionend":return Ny(t);case"keypress":return t.which!==32?null:(p0=!0,d0);case"textInput":return e=t.data,e===d0&&p0?null:e;default:return null}}function HS(e,t){if(xi)return e==="compositionend"||!lp&&$y(e,t)?(e=Ry(),_a=rp=Jr=null,xi=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=y0(n)}}function Ay(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ay(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Iy(){for(var e=window,t=Ia();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ia(e.document)}return t}function sp(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function ZS(e){var t=Iy(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Ay(n.ownerDocument.documentElement,n)){if(r!==null&&sp(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,i=Math.min(r.start,o);r=r.end===void 0?i:Math.min(r.end,o),!e.extend&&i>r&&(o=r,r=i,i=o),o=v0(n,i);var l=v0(n,r);o&&l&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==l.node||e.focusOffset!==l.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(l.node,l.offset)):(t.setEnd(l.node,l.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,wi=null,Zf=null,Gl=null,Jf=!1;function x0(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Jf||wi==null||wi!==Ia(r)||(r=wi,"selectionStart"in r&&sp(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Gl&&as(Gl,r)||(Gl=r,r=Ua(Zf,"onSelect"),0ki||(e.current=id[ki],id[ki]=null,ki--)}function Xe(e,t){ki++,id[ki]=e.current,e.current=t}var co={},un=po(co),_n=po(!1),Wo=co;function ji(e,t){var n=e.type.contextTypes;if(!n)return co;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in n)o[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function kn(e){return e=e.childContextTypes,e!=null}function Ka(){ot(_n),ot(un)}function C0(e,t,n){if(un.current!==co)throw Error(K(168));Xe(un,t),Xe(_n,n)}function Ky(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(K(108,Gw(e)||"Unknown",o));return pt({},n,r)}function Ga(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||co,Wo=un.current,Xe(un,e),Xe(_n,_n.current),!0}function T0(e,t,n){var r=e.stateNode;if(!r)throw Error(K(169));n?(e=Ky(e,t,Wo),r.__reactInternalMemoizedMergedChildContext=e,ot(_n),ot(un),Xe(un,e)):ot(_n),Xe(_n,n)}var Pr=null,bu=!1,df=!1;function Gy(e){Pr===null?Pr=[e]:Pr.push(e)}function c_(e){bu=!0,Gy(e)}function ho(){if(!df&&Pr!==null){df=!0;var e=0,t=Ke;try{var n=Pr;for(Ke=1;e>=l,o-=l,Rr=1<<32-sr(t)+o|n<z?(j=R,R=null):j=R.sibling;var O=f(w,R,S[z],E);if(O===null){R===null&&(R=j);break}e&&R&&O.alternate===null&&t(w,R),m=i(O,m,z),N===null?P=O:N.sibling=O,N=O,R=j}if(z===S.length)return n(w,R),st&&wo(w,z),P;if(R===null){for(;zz?(j=R,R=null):j=R.sibling;var D=f(w,R,O.value,E);if(D===null){R===null&&(R=j);break}e&&R&&D.alternate===null&&t(w,R),m=i(D,m,z),N===null?P=D:N.sibling=D,N=D,R=j}if(O.done)return n(w,R),st&&wo(w,z),P;if(R===null){for(;!O.done;z++,O=S.next())O=p(w,O.value,E),O!==null&&(m=i(O,m,z),N===null?P=O:N.sibling=O,N=O);return st&&wo(w,z),P}for(R=r(w,R);!O.done;z++,O=S.next())O=h(R,w,z,O.value,E),O!==null&&(e&&O.alternate!==null&&R.delete(O.key===null?z:O.key),m=i(O,m,z),N===null?P=O:N.sibling=O,N=O);return e&&R.forEach(function(U){return t(w,U)}),st&&wo(w,z),P}function C(w,m,S,E){if(typeof S=="object"&&S!==null&&S.type===vi&&S.key===null&&(S=S.props.children),typeof S=="object"&&S!==null){switch(S.$$typeof){case Gs:e:{for(var P=S.key,N=m;N!==null;){if(N.key===P){if(P=S.type,P===vi){if(N.tag===7){n(w,N.sibling),m=o(N,S.props.children),m.return=w,w=m;break e}}else if(N.elementType===P||typeof P=="object"&&P!==null&&P.$$typeof===Yr&&z0(P)===N.type){n(w,N.sibling),m=o(N,S.props),m.ref=Tl(w,N,S),m.return=w,w=m;break e}n(w,N);break}else t(w,N);N=N.sibling}S.type===vi?(m=Bo(S.props.children,w.mode,E,S.key),m.return=w,w=m):(E=Ma(S.type,S.key,S.props,null,w.mode,E),E.ref=Tl(w,m,S),E.return=w,w=E)}return l(w);case yi:e:{for(N=S.key;m!==null;){if(m.key===N)if(m.tag===4&&m.stateNode.containerInfo===S.containerInfo&&m.stateNode.implementation===S.implementation){n(w,m.sibling),m=o(m,S.children||[]),m.return=w,w=m;break e}else{n(w,m);break}else t(w,m);m=m.sibling}m=wf(S,w.mode,E),m.return=w,w=m}return l(w);case Yr:return N=S._init,C(w,m,N(S._payload),E)}if(Al(S))return x(w,m,S,E);if(_l(S))return v(w,m,S,E);oa(w,S)}return typeof S=="string"&&S!==""||typeof S=="number"?(S=""+S,m!==null&&m.tag===6?(n(w,m.sibling),m=o(m,S),m.return=w,w=m):(n(w,m),m=xf(S,w.mode,E),m.return=w,w=m),l(w)):n(w,m)}return C}var Hi=tv(!0),nv=tv(!1),Rs={},Sr=po(Rs),ds=po(Rs),ps=po(Rs);function Lo(e){if(e===Rs)throw Error(K(174));return e}function gp(e,t){switch(Xe(ps,t),Xe(ds,e),Xe(Sr,Rs),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Wf(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Wf(t,e)}ot(Sr),Xe(Sr,t)}function Ui(){ot(Sr),ot(ds),ot(ps)}function rv(e){Lo(ps.current);var t=Lo(Sr.current),n=Wf(t,e.type);t!==n&&(Xe(ds,e),Xe(Sr,n))}function yp(e){ds.current===e&&(ot(Sr),ot(ds))}var ft=po(0);function Ja(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var pf=[];function vp(){for(var e=0;en?n:4,e(!0);var r=hf.transition;hf.transition={};try{e(!1),t()}finally{Ke=n,hf.transition=r}}function xv(){return qn().memoizedState}function h_(e,t,n){var r=so(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},wv(e))Sv(t,n);else if(n=Xy(e,t,n,r),n!==null){var o=mn();ar(n,e,r,o),_v(n,t,r)}}function m_(e,t,n){var r=so(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(wv(e))Sv(t,o);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var l=t.lastRenderedState,s=i(l,n);if(o.hasEagerState=!0,o.eagerState=s,ur(s,l)){var u=t.interleaved;u===null?(o.next=o,hp(t)):(o.next=u.next,u.next=o),t.interleaved=o;return}}catch{}finally{}n=Xy(e,t,o,r),n!==null&&(o=mn(),ar(n,e,r,o),_v(n,t,r))}}function wv(e){var t=e.alternate;return e===dt||t!==null&&t===dt}function Sv(e,t){Yl=eu=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function _v(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ep(e,n)}}var tu={readContext:Yn,useCallback:on,useContext:on,useEffect:on,useImperativeHandle:on,useInsertionEffect:on,useLayoutEffect:on,useMemo:on,useReducer:on,useRef:on,useState:on,useDebugValue:on,useDeferredValue:on,useTransition:on,useMutableSource:on,useSyncExternalStore:on,useId:on,unstable_isNewReconciler:!1},g_={readContext:Yn,useCallback:function(e,t){return mr().memoizedState=[e,t===void 0?null:t],e},useContext:Yn,useEffect:A0,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Ca(4194308,4,hv.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ca(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ca(4,2,e,t)},useMemo:function(e,t){var n=mr();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=mr();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=h_.bind(null,dt,e),[r.memoizedState,e]},useRef:function(e){var t=mr();return e={current:e},t.memoizedState=e},useState:L0,useDebugValue:kp,useDeferredValue:function(e){return mr().memoizedState=e},useTransition:function(){var e=L0(!1),t=e[0];return e=p_.bind(null,e[1]),mr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=dt,o=mr();if(st){if(n===void 0)throw Error(K(407));n=n()}else{if(n=t(),Kt===null)throw Error(K(349));Uo&30||lv(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,A0(av.bind(null,r,i,e),[e]),r.flags|=2048,gs(9,sv.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=mr(),t=Kt.identifierPrefix;if(st){var n=Mr,r=Rr;n=(r&~(1<<32-sr(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=hs++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=l.createElement(n,{is:r.is}):(e=l.createElement(n),n==="select"&&(l=e,r.multiple?l.multiple=!0:r.size&&(l.size=r.size))):e=l.createElementNS(e,n),e[vr]=t,e[fs]=r,$v(e,t,!1,!1),t.stateNode=e;e:{switch(l=Uf(n,r),n){case"dialog":rt("cancel",e),rt("close",e),o=r;break;case"iframe":case"object":case"embed":rt("load",e),o=r;break;case"video":case"audio":for(o=0;oKi&&(t.flags|=128,r=!0,Pl(i,!1),t.lanes=4194304)}else{if(!r)if(e=Ja(l),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Pl(i,!0),i.tail===null&&i.tailMode==="hidden"&&!l.alternate&&!st)return ln(t),null}else 2*_t()-i.renderingStartTime>Ki&&n!==1073741824&&(t.flags|=128,r=!0,Pl(i,!1),t.lanes=4194304);i.isBackwards?(l.sibling=t.child,t.child=l):(n=i.last,n!==null?n.sibling=l:t.child=l,i.last=l)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=_t(),t.sibling=null,n=ft.current,Xe(ft,r?n&1|2:n&1),t):(ln(t),null);case 22:case 23:return Rp(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Rn&1073741824&&(ln(t),t.subtreeFlags&6&&(t.flags|=8192)):ln(t),null;case 24:return null;case 25:return null}throw Error(K(156,t.tag))}function b_(e,t){switch(up(t),t.tag){case 1:return kn(t.type)&&Ka(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ui(),ot(_n),ot(un),vp(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return yp(t),null;case 13:if(ot(ft),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(K(340));Wi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ot(ft),null;case 4:return Ui(),null;case 10:return pp(t.type._context),null;case 22:case 23:return Rp(),null;case 24:return null;default:return null}}var la=!1,an=!1,E_=typeof WeakSet=="function"?WeakSet:Set,ue=null;function Ti(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){xt(e,t,r)}else n.current=null}function yd(e,t,n){try{n()}catch(r){xt(e,t,r)}}var V0=!1;function C_(e,t){if(ed=Wa,e=Iy(),sp(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var l=0,s=-1,u=-1,a=0,c=0,p=e,f=null;t:for(;;){for(var h;p!==n||o!==0&&p.nodeType!==3||(s=l+o),p!==i||r!==0&&p.nodeType!==3||(u=l+r),p.nodeType===3&&(l+=p.nodeValue.length),(h=p.firstChild)!==null;)f=p,p=h;for(;;){if(p===e)break t;if(f===n&&++a===o&&(s=l),f===i&&++c===r&&(u=l),(h=p.nextSibling)!==null)break;p=f,f=p.parentNode}p=h}n=s===-1||u===-1?null:{start:s,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(td={focusedElem:e,selectionRange:n},Wa=!1,ue=t;ue!==null;)if(t=ue,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ue=e;else for(;ue!==null;){t=ue;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var v=x.memoizedProps,C=x.memoizedState,w=t.stateNode,m=w.getSnapshotBeforeUpdate(t.elementType===t.type?v:or(t.type,v),C);w.__reactInternalSnapshotBeforeUpdate=m}break;case 3:var S=t.stateNode.containerInfo;S.nodeType===1?S.textContent="":S.nodeType===9&&S.documentElement&&S.removeChild(S.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(K(163))}}catch(E){xt(t,t.return,E)}if(e=t.sibling,e!==null){e.return=t.return,ue=e;break}ue=t.return}return x=V0,V0=!1,x}function ql(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var i=o.destroy;o.destroy=void 0,i!==void 0&&yd(t,n,i)}o=o.next}while(o!==r)}}function Tu(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function vd(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function zv(e){var t=e.alternate;t!==null&&(e.alternate=null,zv(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[vr],delete t[fs],delete t[od],delete t[a_],delete t[u_])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Lv(e){return e.tag===5||e.tag===3||e.tag===4}function K0(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Lv(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function xd(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Va));else if(r!==4&&(e=e.child,e!==null))for(xd(e,t,n),e=e.sibling;e!==null;)xd(e,t,n),e=e.sibling}function wd(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(wd(e,t,n),e=e.sibling;e!==null;)wd(e,t,n),e=e.sibling}var Jt=null,ir=!1;function Kr(e,t,n){for(n=n.child;n!==null;)Av(e,t,n),n=n.sibling}function Av(e,t,n){if(wr&&typeof wr.onCommitFiberUnmount=="function")try{wr.onCommitFiberUnmount(xu,n)}catch{}switch(n.tag){case 5:an||Ti(n,t);case 6:var r=Jt,o=ir;Jt=null,Kr(e,t,n),Jt=r,ir=o,Jt!==null&&(ir?(e=Jt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Jt.removeChild(n.stateNode));break;case 18:Jt!==null&&(ir?(e=Jt,n=n.stateNode,e.nodeType===8?ff(e.parentNode,n):e.nodeType===1&&ff(e,n),ls(e)):ff(Jt,n.stateNode));break;case 4:r=Jt,o=ir,Jt=n.stateNode.containerInfo,ir=!0,Kr(e,t,n),Jt=r,ir=o;break;case 0:case 11:case 14:case 15:if(!an&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var i=o,l=i.destroy;i=i.tag,l!==void 0&&(i&2||i&4)&&yd(n,t,l),o=o.next}while(o!==r)}Kr(e,t,n);break;case 1:if(!an&&(Ti(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(s){xt(n,t,s)}Kr(e,t,n);break;case 21:Kr(e,t,n);break;case 22:n.mode&1?(an=(r=an)||n.memoizedState!==null,Kr(e,t,n),an=r):Kr(e,t,n);break;default:Kr(e,t,n)}}function G0(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new E_),t.forEach(function(r){var o=L_.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function nr(e,t){var n=t.deletions;if(n!==null)for(var r=0;ro&&(o=l),r&=~i}if(r=o,r=_t()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*P_(r/1960))-r,10e?16:e,eo===null)var r=!1;else{if(e=eo,eo=null,ou=0,ze&6)throw Error(K(331));var o=ze;for(ze|=4,ue=e.current;ue!==null;){var i=ue,l=i.child;if(ue.flags&16){var s=i.deletions;if(s!==null){for(var u=0;u_t()-Tp?Do(e,0):Cp|=n),bn(e,t)}function Uv(e,t){t===0&&(e.mode&1?(t=Xs,Xs<<=1,!(Xs&130023424)&&(Xs=4194304)):t=1);var n=mn();e=Ir(e,t),e!==null&&(Cs(e,t,n),bn(e,n))}function z_(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Uv(e,n)}function L_(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(K(314))}r!==null&&r.delete(t),Uv(e,n)}var Vv;Vv=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||_n.current)Sn=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Sn=!1,__(e,t,n);Sn=!!(e.flags&131072)}else Sn=!1,st&&t.flags&1048576&&Yy(t,qa,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Ta(e,t),e=t.pendingProps;var o=ji(t,un.current);zi(t,n),o=wp(null,t,r,e,o,n);var i=Sp();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,kn(r)?(i=!0,Ga(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,mp(t),o.updater=Eu,t.stateNode=o,o._reactInternals=t,cd(t,r,e,n),t=pd(null,t,r,!0,i,n)):(t.tag=0,st&&i&&ap(t),hn(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Ta(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=I_(r),e=or(r,e),o){case 0:t=dd(null,t,r,e,n);break e;case 1:t=W0(null,t,r,e,n);break e;case 11:t=F0(null,t,r,e,n);break e;case 14:t=j0(null,t,r,or(r.type,e),n);break e}throw Error(K(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:or(r,o),dd(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:or(r,o),W0(e,t,r,o,n);case 3:e:{if(Pv(t),e===null)throw Error(K(387));r=t.pendingProps,i=t.memoizedState,o=i.element,Zy(e,t),Za(t,r,null,n);var l=t.memoizedState;if(r=l.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:l.cache,pendingSuspenseBoundaries:l.pendingSuspenseBoundaries,transitions:l.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){o=Vi(Error(K(423)),t),t=H0(e,t,r,n,o);break e}else if(r!==o){o=Vi(Error(K(424)),t),t=H0(e,t,r,n,o);break e}else for(Nn=oo(t.stateNode.containerInfo.firstChild),On=t,st=!0,lr=null,n=nv(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Wi(),r===o){t=Dr(e,t,n);break e}hn(e,t,r,n)}t=t.child}return t;case 5:return rv(t),e===null&&sd(t),r=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,l=o.children,nd(r,o)?l=null:i!==null&&nd(r,i)&&(t.flags|=32),Tv(e,t),hn(e,t,l,n),t.child;case 6:return e===null&&sd(t),null;case 13:return Rv(e,t,n);case 4:return gp(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Hi(t,null,r,n):hn(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:or(r,o),F0(e,t,r,o,n);case 7:return hn(e,t,t.pendingProps,n),t.child;case 8:return hn(e,t,t.pendingProps.children,n),t.child;case 12:return hn(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,i=t.memoizedProps,l=o.value,Xe(Qa,r._currentValue),r._currentValue=l,i!==null)if(ur(i.value,l)){if(i.children===o.children&&!_n.current){t=Dr(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var s=i.dependencies;if(s!==null){l=i.child;for(var u=s.firstContext;u!==null;){if(u.context===r){if(i.tag===1){u=$r(-1,n&-n),u.tag=2;var a=i.updateQueue;if(a!==null){a=a.shared;var c=a.pending;c===null?u.next=u:(u.next=c.next,c.next=u),a.pending=u}}i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),ad(i.return,n,t),s.lanes|=n;break}u=u.next}}else if(i.tag===10)l=i.type===t.type?null:i.child;else if(i.tag===18){if(l=i.return,l===null)throw Error(K(341));l.lanes|=n,s=l.alternate,s!==null&&(s.lanes|=n),ad(l,n,t),l=i.sibling}else l=i.child;if(l!==null)l.return=i;else for(l=i;l!==null;){if(l===t){l=null;break}if(i=l.sibling,i!==null){i.return=l.return,l=i;break}l=l.return}i=l}hn(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,zi(t,n),o=Yn(o),r=r(o),t.flags|=1,hn(e,t,r,n),t.child;case 14:return r=t.type,o=or(r,t.pendingProps),o=or(r.type,o),j0(e,t,r,o,n);case 15:return Ev(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:or(r,o),Ta(e,t),t.tag=1,kn(r)?(e=!0,Ga(t)):e=!1,zi(t,n),ev(t,r,o),cd(t,r,o,n),pd(null,t,r,!0,e,n);case 19:return Mv(e,t,n);case 22:return Cv(e,t,n)}throw Error(K(156,t.tag))};function Kv(e,t){return vy(e,t)}function A_(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Vn(e,t,n,r){return new A_(e,t,n,r)}function $p(e){return e=e.prototype,!(!e||!e.isReactComponent)}function I_(e){if(typeof e=="function")return $p(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Qd)return 11;if(e===Xd)return 14}return 2}function ao(e,t){var n=e.alternate;return n===null?(n=Vn(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Ma(e,t,n,r,o,i){var l=2;if(r=e,typeof e=="function")$p(e)&&(l=1);else if(typeof e=="string")l=5;else e:switch(e){case vi:return Bo(n.children,o,i,t);case qd:l=8,o|=8;break;case zf:return e=Vn(12,n,t,o|2),e.elementType=zf,e.lanes=i,e;case Lf:return e=Vn(13,n,t,o),e.elementType=Lf,e.lanes=i,e;case Af:return e=Vn(19,n,t,o),e.elementType=Af,e.lanes=i,e;case ty:return Ru(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Jg:l=10;break e;case ey:l=9;break e;case Qd:l=11;break e;case Xd:l=14;break e;case Yr:l=16,r=null;break e}throw Error(K(130,e==null?e:typeof e,""))}return t=Vn(l,n,t,o),t.elementType=e,t.type=r,t.lanes=i,t}function Bo(e,t,n,r){return e=Vn(7,e,r,t),e.lanes=n,e}function Ru(e,t,n,r){return e=Vn(22,e,r,t),e.elementType=ty,e.lanes=n,e.stateNode={isHidden:!1},e}function xf(e,t,n){return e=Vn(6,e,null,t),e.lanes=n,e}function wf(e,t,n){return t=Vn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function D_(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Jc(0),this.expirationTimes=Jc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Jc(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function Np(e,t,n,r,o,i,l,s,u){return e=new D_(e,t,n,s,u),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Vn(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},mp(i),e}function B_(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Qv)}catch(e){console.error(e)}}Qv(),Yg.exports=In;var Xv=Yg.exports;const ua=bs(Xv);var tm=Xv;Nf.createRoot=tm.createRoot,Nf.hydrateRoot=tm.hydrateRoot;const U_={black:"#000",white:"#fff"},vs=U_,V_={50:"#ffebee",100:"#ffcdd2",200:"#ef9a9a",300:"#e57373",400:"#ef5350",500:"#f44336",600:"#e53935",700:"#d32f2f",800:"#c62828",900:"#b71c1c",A100:"#ff8a80",A200:"#ff5252",A400:"#ff1744",A700:"#d50000"},_o=V_,K_={50:"#fce4ec",100:"#f8bbd0",200:"#f48fb1",300:"#f06292",400:"#ec407a",500:"#e91e63",600:"#d81b60",700:"#c2185b",800:"#ad1457",900:"#880e4f",A100:"#ff80ab",A200:"#ff4081",A400:"#f50057",A700:"#c51162"},G_=K_,Y_={50:"#f3e5f5",100:"#e1bee7",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",600:"#8e24aa",700:"#7b1fa2",800:"#6a1b9a",900:"#4a148c",A100:"#ea80fc",A200:"#e040fb",A400:"#d500f9",A700:"#aa00ff"},ko=Y_,q_={50:"#ede7f6",100:"#d1c4e9",200:"#b39ddb",300:"#9575cd",400:"#7e57c2",500:"#673ab7",600:"#5e35b1",700:"#512da8",800:"#4527a0",900:"#311b92",A100:"#b388ff",A200:"#7c4dff",A400:"#651fff",A700:"#6200ea"},Q_=q_,X_={50:"#e8eaf6",100:"#c5cae9",200:"#9fa8da",300:"#7986cb",400:"#5c6bc0",500:"#3f51b5",600:"#3949ab",700:"#303f9f",800:"#283593",900:"#1a237e",A100:"#8c9eff",A200:"#536dfe",A400:"#3d5afe",A700:"#304ffe"},Z_=X_,J_={50:"#e3f2fd",100:"#bbdefb",200:"#90caf9",300:"#64b5f6",400:"#42a5f5",500:"#2196f3",600:"#1e88e5",700:"#1976d2",800:"#1565c0",900:"#0d47a1",A100:"#82b1ff",A200:"#448aff",A400:"#2979ff",A700:"#2962ff"},bo=J_,ek={50:"#e1f5fe",100:"#b3e5fc",200:"#81d4fa",300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",600:"#039be5",700:"#0288d1",800:"#0277bd",900:"#01579b",A100:"#80d8ff",A200:"#40c4ff",A400:"#00b0ff",A700:"#0091ea"},Eo=ek,tk={50:"#e0f7fa",100:"#b2ebf2",200:"#80deea",300:"#4dd0e1",400:"#26c6da",500:"#00bcd4",600:"#00acc1",700:"#0097a7",800:"#00838f",900:"#006064",A100:"#84ffff",A200:"#18ffff",A400:"#00e5ff",A700:"#00b8d4"},nk=tk,rk={50:"#e0f2f1",100:"#b2dfdb",200:"#80cbc4",300:"#4db6ac",400:"#26a69a",500:"#009688",600:"#00897b",700:"#00796b",800:"#00695c",900:"#004d40",A100:"#a7ffeb",A200:"#64ffda",A400:"#1de9b6",A700:"#00bfa5"},ok=rk,ik={50:"#e8f5e9",100:"#c8e6c9",200:"#a5d6a7",300:"#81c784",400:"#66bb6a",500:"#4caf50",600:"#43a047",700:"#388e3c",800:"#2e7d32",900:"#1b5e20",A100:"#b9f6ca",A200:"#69f0ae",A400:"#00e676",A700:"#00c853"},Co=ik,lk={50:"#f1f8e9",100:"#dcedc8",200:"#c5e1a5",300:"#aed581",400:"#9ccc65",500:"#8bc34a",600:"#7cb342",700:"#689f38",800:"#558b2f",900:"#33691e",A100:"#ccff90",A200:"#b2ff59",A400:"#76ff03",A700:"#64dd17"},sk=lk,ak={50:"#f9fbe7",100:"#f0f4c3",200:"#e6ee9c",300:"#dce775",400:"#d4e157",500:"#cddc39",600:"#c0ca33",700:"#afb42b",800:"#9e9d24",900:"#827717",A100:"#f4ff81",A200:"#eeff41",A400:"#c6ff00",A700:"#aeea00"},uk=ak,ck={50:"#fffde7",100:"#fff9c4",200:"#fff59d",300:"#fff176",400:"#ffee58",500:"#ffeb3b",600:"#fdd835",700:"#fbc02d",800:"#f9a825",900:"#f57f17",A100:"#ffff8d",A200:"#ffff00",A400:"#ffea00",A700:"#ffd600"},fk=ck,dk={50:"#fff8e1",100:"#ffecb3",200:"#ffe082",300:"#ffd54f",400:"#ffca28",500:"#ffc107",600:"#ffb300",700:"#ffa000",800:"#ff8f00",900:"#ff6f00",A100:"#ffe57f",A200:"#ffd740",A400:"#ffc400",A700:"#ffab00"},pk=dk,hk={50:"#fff3e0",100:"#ffe0b2",200:"#ffcc80",300:"#ffb74d",400:"#ffa726",500:"#ff9800",600:"#fb8c00",700:"#f57c00",800:"#ef6c00",900:"#e65100",A100:"#ffd180",A200:"#ffab40",A400:"#ff9100",A700:"#ff6d00"},hi=hk,mk={50:"#fbe9e7",100:"#ffccbc",200:"#ffab91",300:"#ff8a65",400:"#ff7043",500:"#ff5722",600:"#f4511e",700:"#e64a19",800:"#d84315",900:"#bf360c",A100:"#ff9e80",A200:"#ff6e40",A400:"#ff3d00",A700:"#dd2c00"},gk=mk,yk={50:"#efebe9",100:"#d7ccc8",200:"#bcaaa4",300:"#a1887f",400:"#8d6e63",500:"#795548",600:"#6d4c41",700:"#5d4037",800:"#4e342e",900:"#3e2723",A100:"#d7ccc8",A200:"#bcaaa4",A400:"#8d6e63",A700:"#5d4037"},vk=yk,xk={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"},Zv=xk,wk={50:"#eceff1",100:"#cfd8dc",200:"#b0bec5",300:"#90a4ae",400:"#78909c",500:"#607d8b",600:"#546e7a",700:"#455a64",800:"#37474f",900:"#263238",A100:"#cfd8dc",A200:"#b0bec5",A400:"#78909c",A700:"#455a64"},Sk=wk;function A(){return A=Object.assign?Object.assign.bind():function(e){for(var t=1;t{t[n]=Jv(e[n])}),t}function Nr(e,t,n={clone:!0}){const r=n.clone?A({},e):e;return $o(e)&&$o(t)&&Object.keys(t).forEach(o=>{o!=="__proto__"&&($o(t[o])&&o in e&&$o(e[o])?r[o]=Nr(e[o],t[o],n):n.clone?r[o]=$o(t[o])?Jv(t[o]):t[o]:r[o]=t[o])}),r}var e1={exports:{}},_k="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",kk=_k,bk=kk;function t1(){}function n1(){}n1.resetWarningCache=t1;var Ek=function(){function e(r,o,i,l,s,u){if(u!==bk){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:n1,resetWarningCache:t1};return n.PropTypes=n,n};e1.exports=Ek();var _r=e1.exports;function Gi(e){let t="https://mui.com/production-error/?code="+e;for(let n=1;n{e.apply(this,o)};clearTimeout(n),n=setTimeout(i,t)}return r.clear=()=>{clearTimeout(n)},r}function i1(e){return e&&e.ownerDocument||document}function l1(e){return i1(e).defaultView||window}function Pk(e,t){typeof e=="function"?e(t):e&&(e.current=t)}const Rk=typeof window<"u"?L.useLayoutEffect:L.useEffect,Dp=Rk;function Ao(e){const t=L.useRef(e);return Dp(()=>{t.current=e}),L.useCallback((...n)=>(0,t.current)(...n),[])}function su(...e){return L.useMemo(()=>e.every(t=>t==null)?null:t=>{e.forEach(n=>{Pk(n,t)})},e)}let Uu=!0,Ed=!1,nm;const Mk={text:!0,search:!0,url:!0,tel:!0,email:!0,password:!0,number:!0,date:!0,month:!0,week:!0,time:!0,datetime:!0,"datetime-local":!0};function $k(e){const{type:t,tagName:n}=e;return!!(n==="INPUT"&&Mk[t]&&!e.readOnly||n==="TEXTAREA"&&!e.readOnly||e.isContentEditable)}function Nk(e){e.metaKey||e.altKey||e.ctrlKey||(Uu=!0)}function Sf(){Uu=!1}function Ok(){this.visibilityState==="hidden"&&Ed&&(Uu=!0)}function zk(e){e.addEventListener("keydown",Nk,!0),e.addEventListener("mousedown",Sf,!0),e.addEventListener("pointerdown",Sf,!0),e.addEventListener("touchstart",Sf,!0),e.addEventListener("visibilitychange",Ok,!0)}function Lk(e){const{target:t}=e;try{return t.matches(":focus-visible")}catch{}return Uu||$k(t)}function Ak(){const e=L.useCallback(o=>{o!=null&&zk(o.ownerDocument)},[]),t=L.useRef(!1);function n(){return t.current?(Ed=!0,window.clearTimeout(nm),nm=window.setTimeout(()=>{Ed=!1},100),t.current=!1,!0):!1}function r(o){return Lk(o)?(t.current=!0,!0):!1}return{isFocusVisibleRef:t,onFocus:r,onBlur:n,ref:e}}let ui;function s1(){if(ui)return ui;const e=document.createElement("div"),t=document.createElement("div");return t.style.width="10px",t.style.height="1px",e.appendChild(t),e.dir="rtl",e.style.fontSize="14px",e.style.width="4px",e.style.height="1px",e.style.position="absolute",e.style.top="-1000px",e.style.overflow="scroll",document.body.appendChild(e),ui="reverse",e.scrollLeft>0?ui="default":(e.scrollLeft=1,e.scrollLeft===0&&(ui="negative")),document.body.removeChild(e),ui}function Ik(e,t){const n=e.scrollLeft;if(t!=="rtl")return n;switch(s1()){case"negative":return e.scrollWidth-e.clientWidth+n;case"reverse":return e.scrollWidth-e.clientWidth-n;default:return n}}function Bp(e,t){const n=A({},t);return Object.keys(e).forEach(r=>{if(r.toString().match(/^(components|slots)$/))n[r]=A({},e[r],n[r]);else if(r.toString().match(/^(componentsProps|slotProps)$/)){const o=e[r]||{},i=t[r];n[r]={},!i||!Object.keys(i)?n[r]=o:!o||!Object.keys(o)?n[r]=i:(n[r]=A({},i),Object.keys(o).forEach(l=>{n[r][l]=Bp(o[l],i[l])}))}else n[r]===void 0&&(n[r]=e[r])}),n}function zt(e,t,n=void 0){const r={};return Object.keys(e).forEach(o=>{r[o]=e[o].reduce((i,l)=>{if(l){const s=t(l);s!==""&&i.push(s),n&&n[l]&&i.push(n[l])}return i},[]).join(" ")}),r}const rm=e=>e,Dk=()=>{let e=rm;return{configure(t){e=t},generate(t){return e(t)},reset(){e=rm}}},Bk=Dk(),a1=Bk,Fk={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function Mt(e,t,n="Mui"){const r=Fk[t];return r?`${n}-${r}`:`${a1.generate(e)}-${t}`}function $t(e,t,n="Mui"){const r={};return t.forEach(o=>{r[o]=Mt(e,o,n)}),r}const Go="$$material";function $e(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i=0)&&(n[o]=e[o]);return n}function u1(e){var t=Object.create(null);return function(n){return t[n]===void 0&&(t[n]=e(n)),t[n]}}var jk=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,Wk=u1(function(e){return jk.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91});function Hk(e){if(e.sheet)return e.sheet;for(var t=0;t0?en(il,--En):0,Yi--,Pt===10&&(Yi=1,Ku--),Pt}function zn(){return Pt=En2||ws(Pt)>3?"":" "}function nb(e,t){for(;--t&&zn()&&!(Pt<48||Pt>102||Pt>57&&Pt<65||Pt>70&&Pt<97););return Ms(e,$a()+(t<6&&kr()==32&&zn()==32))}function Td(e){for(;zn();)switch(Pt){case e:return En;case 34:case 39:e!==34&&e!==39&&Td(Pt);break;case 40:e===41&&Td(e);break;case 92:zn();break}return En}function rb(e,t){for(;zn()&&e+Pt!==47+10;)if(e+Pt===42+42&&kr()===47)break;return"/*"+Ms(t,En-1)+"*"+Vu(e===47?e:zn())}function ob(e){for(;!ws(kr());)zn();return Ms(e,En)}function ib(e){return m1(Oa("",null,null,null,[""],e=h1(e),0,[0],e))}function Oa(e,t,n,r,o,i,l,s,u){for(var a=0,c=0,p=l,f=0,h=0,x=0,v=1,C=1,w=1,m=0,S="",E=o,P=i,N=r,R=S;C;)switch(x=m,m=zn()){case 40:if(x!=108&&en(R,p-1)==58){Cd(R+=Be(Na(m),"&","&\f"),"&\f")!=-1&&(w=-1);break}case 34:case 39:case 91:R+=Na(m);break;case 9:case 10:case 13:case 32:R+=tb(x);break;case 92:R+=nb($a()-1,7);continue;case 47:switch(kr()){case 42:case 47:ca(lb(rb(zn(),$a()),t,n),u);break;default:R+="/"}break;case 123*v:s[a++]=gr(R)*w;case 125*v:case 59:case 0:switch(m){case 0:case 125:C=0;case 59+c:w==-1&&(R=Be(R,/\f/g,"")),h>0&&gr(R)-p&&ca(h>32?im(R+";",r,n,p-1):im(Be(R," ","")+";",r,n,p-2),u);break;case 59:R+=";";default:if(ca(N=om(R,t,n,a,c,o,s,S,E=[],P=[],p),i),m===123)if(c===0)Oa(R,t,N,N,E,i,p,s,P);else switch(f===99&&en(R,3)===110?100:f){case 100:case 108:case 109:case 115:Oa(e,N,N,r&&ca(om(e,N,N,0,0,o,s,S,o,E=[],p),P),o,P,p,s,r?E:P);break;default:Oa(R,N,N,N,[""],P,0,s,P)}}a=c=h=0,v=w=1,S=R="",p=l;break;case 58:p=1+gr(R),h=x;default:if(v<1){if(m==123)--v;else if(m==125&&v++==0&&eb()==125)continue}switch(R+=Vu(m),m*v){case 38:w=c>0?1:(R+="\f",-1);break;case 44:s[a++]=(gr(R)-1)*w,w=1;break;case 64:kr()===45&&(R+=Na(zn())),f=kr(),c=p=gr(S=R+=ob($a())),m++;break;case 45:x===45&&gr(R)==2&&(v=0)}}return i}function om(e,t,n,r,o,i,l,s,u,a,c){for(var p=o-1,f=o===0?i:[""],h=Wp(f),x=0,v=0,C=0;x0?f[w]+" "+m:Be(m,/&\f/g,f[w])))&&(u[C++]=S);return Gu(e,t,n,o===0?Fp:s,u,a,c)}function lb(e,t,n){return Gu(e,t,n,c1,Vu(Jk()),xs(e,2,-2),0)}function im(e,t,n,r){return Gu(e,t,n,jp,xs(e,0,r),xs(e,r+1,-1),r)}function Ai(e,t){for(var n="",r=Wp(e),o=0;o6)switch(en(e,t+1)){case 109:if(en(e,t+4)!==45)break;case 102:return Be(e,/(.+:)(.+)-([^]+)/,"$1"+De+"$2-$3$1"+au+(en(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~Cd(e,"stretch")?g1(Be(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(en(e,t+1)!==115)break;case 6444:switch(en(e,gr(e)-3-(~Cd(e,"!important")&&10))){case 107:return Be(e,":",":"+De)+e;case 101:return Be(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+De+(en(e,14)===45?"inline-":"")+"box$3$1"+De+"$2$3$1"+sn+"$2box$3")+e}break;case 5936:switch(en(e,t+11)){case 114:return De+e+sn+Be(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return De+e+sn+Be(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return De+e+sn+Be(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return De+e+sn+e+e}return e}var mb=function(t,n,r,o){if(t.length>-1&&!t.return)switch(t.type){case jp:t.return=g1(t.value,t.length);break;case f1:return Ai([Ml(t,{value:Be(t.value,"@","@"+De)})],o);case Fp:if(t.length)return Zk(t.props,function(i){switch(Xk(i,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Ai([Ml(t,{props:[Be(i,/:(read-\w+)/,":"+au+"$1")]})],o);case"::placeholder":return Ai([Ml(t,{props:[Be(i,/:(plac\w+)/,":"+De+"input-$1")]}),Ml(t,{props:[Be(i,/:(plac\w+)/,":"+au+"$1")]}),Ml(t,{props:[Be(i,/:(plac\w+)/,sn+"input-$1")]})],o)}return""})}},gb=[mb],yb=function(t){var n=t.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(v){var C=v.getAttribute("data-emotion");C.indexOf(" ")!==-1&&(document.head.appendChild(v),v.setAttribute("data-s",""))})}var o=t.stylisPlugins||gb,i={},l,s=[];l=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(v){for(var C=v.getAttribute("data-emotion").split(" "),w=1;w=4;++r,o-=4)n=e.charCodeAt(r)&255|(e.charCodeAt(++r)&255)<<8|(e.charCodeAt(++r)&255)<<16|(e.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,t=(n&65535)*1540483477+((n>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(o){case 3:t^=(e.charCodeAt(r+2)&255)<<16;case 2:t^=(e.charCodeAt(r+1)&255)<<8;case 1:t^=e.charCodeAt(r)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var Rb={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Mb=/[A-Z]|^ms/g,$b=/_EMO_([^_]+?)_([^]*?)_EMO_/g,k1=function(t){return t.charCodeAt(1)===45},sm=function(t){return t!=null&&typeof t!="boolean"},_f=u1(function(e){return k1(e)?e:e.replace(Mb,"-$&").toLowerCase()}),am=function(t,n){switch(t){case"animation":case"animationName":if(typeof n=="string")return n.replace($b,function(r,o,i){return yr={name:o,styles:i,next:yr},o})}return Rb[t]!==1&&!k1(t)&&typeof n=="number"&&n!==0?n+"px":n};function Ss(e,t,n){if(n==null)return"";if(n.__emotion_styles!==void 0)return n;switch(typeof n){case"boolean":return"";case"object":{if(n.anim===1)return yr={name:n.name,styles:n.styles,next:yr},n.name;if(n.styles!==void 0){var r=n.next;if(r!==void 0)for(;r!==void 0;)yr={name:r.name,styles:r.styles,next:yr},r=r.next;var o=n.styles+";";return o}return Nb(e,t,n)}case"function":{if(e!==void 0){var i=yr,l=n(e);return yr=i,Ss(e,t,l)}break}}if(t==null)return n;var s=t[n];return s!==void 0?s:n}function Nb(e,t,n){var r="";if(Array.isArray(n))for(var o=0;o96?Ib:Db},dm=function(t,n,r){var o;if(n){var i=n.shouldForwardProp;o=t.__emotion_forwardProp&&i?function(l){return t.__emotion_forwardProp(l)&&i(l)}:i}return typeof o!="function"&&r&&(o=t.__emotion_forwardProp),o},Bb=function(t){var n=t.cache,r=t.serialized,o=t.isStringTag;return S1(n,r,o),zb(function(){return _1(n,r,o)}),null},Fb=function e(t,n){var r=t.__emotion_real===t,o=r&&t.__emotion_base||t,i,l;n!==void 0&&(i=n.label,l=n.target);var s=dm(t,n,r),u=s||fm(o),a=!u("as");return function(){var c=arguments,p=r&&t.__emotion_styles!==void 0?t.__emotion_styles.slice(0):[];if(i!==void 0&&p.push("label:"+i+";"),c[0]==null||c[0].raw===void 0)p.push.apply(p,c);else{p.push(c[0][0]);for(var f=c.length,h=1;ht(Wb(o)?n:o):t;return F.jsx(Lb,{styles:r})}/** + * @mui/styled-engine v5.14.6 + * + * @license MIT + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */function T1(e,t){return Pd(e,t)}const Ub=(e,t)=>{Array.isArray(e.__emotion_styles)&&(e.__emotion_styles=t(e.__emotion_styles))},Vb=["values","unit","step"],Kb=e=>{const t=Object.keys(e).map(n=>({key:n,val:e[n]}))||[];return t.sort((n,r)=>n.val-r.val),t.reduce((n,r)=>A({},n,{[r.key]:r.val}),{})};function Gb(e){const{values:t={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:n="px",step:r=5}=e,o=$e(e,Vb),i=Kb(t),l=Object.keys(i);function s(f){return`@media (min-width:${typeof t[f]=="number"?t[f]:f}${n})`}function u(f){return`@media (max-width:${(typeof t[f]=="number"?t[f]:f)-r/100}${n})`}function a(f,h){const x=l.indexOf(h);return`@media (min-width:${typeof t[f]=="number"?t[f]:f}${n}) and (max-width:${(x!==-1&&typeof t[l[x]]=="number"?t[l[x]]:h)-r/100}${n})`}function c(f){return l.indexOf(f)+1`@media (min-width:${Yp[e]}px)`};function Qn(e,t,n){const r=e.theme||{};if(Array.isArray(t)){const i=r.breakpoints||pm;return t.reduce((l,s,u)=>(l[i.up(i.keys[u])]=n(t[u]),l),{})}if(typeof t=="object"){const i=r.breakpoints||pm;return Object.keys(t).reduce((l,s)=>{if(Object.keys(i.values||Yp).indexOf(s)!==-1){const u=i.up(s);l[u]=n(t[s],s)}else{const u=s;l[u]=t[u]}return l},{})}return n(t)}function Qb(e={}){var t;return((t=e.keys)==null?void 0:t.reduce((r,o)=>{const i=e.up(o);return r[i]={},r},{}))||{}}function Xb(e,t){return e.reduce((n,r)=>{const o=n[r];return(!o||Object.keys(o).length===0)&&delete n[r],n},t)}function Zb(e,t){if(typeof e!="object")return{};const n={},r=Object.keys(t);return Array.isArray(e)?r.forEach((o,i)=>{i{e[o]!=null&&(n[o]=!0)}),n}function ic({values:e,breakpoints:t,base:n}){const r=n||Zb(e,t),o=Object.keys(r);if(o.length===0)return e;let i;return o.reduce((l,s,u)=>(Array.isArray(e)?(l[s]=e[u]!=null?e[u]:e[i],i=u):typeof e=="object"?(l[s]=e[s]!=null?e[s]:e[i],i=s):l[s]=e,l),{})}function lc(e,t,n=!0){if(!t||typeof t!="string")return null;if(e&&e.vars&&n){const r=`vars.${t}`.split(".").reduce((o,i)=>o&&o[i]?o[i]:null,e);if(r!=null)return r}return t.split(".").reduce((r,o)=>r&&r[o]!=null?r[o]:null,e)}function uu(e,t,n,r=n){let o;return typeof e=="function"?o=e(n):Array.isArray(e)?o=e[n]||r:o=lc(e,n)||r,t&&(o=t(o,r,e)),o}function He(e){const{prop:t,cssProperty:n=e.prop,themeKey:r,transform:o}=e,i=l=>{if(l[t]==null)return null;const s=l[t],u=l.theme,a=lc(u,r)||{};return Qn(l,s,p=>{let f=uu(a,o,p);return p===f&&typeof p=="string"&&(f=uu(a,o,`${t}${p==="default"?"":be(p)}`,p)),n===!1?f:{[n]:f}})};return i.propTypes={},i.filterProps=[t],i}function Jb(e){const t={};return n=>(t[n]===void 0&&(t[n]=e(n)),t[n])}const e2={m:"margin",p:"padding"},t2={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},hm={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},n2=Jb(e=>{if(e.length>2)if(hm[e])e=hm[e];else return[e];const[t,n]=e.split(""),r=e2[t],o=t2[n]||"";return Array.isArray(o)?o.map(i=>r+i):[r+o]}),qp=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],Qp=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"];[...qp,...Qp];function $s(e,t,n,r){var o;const i=(o=lc(e,t,!1))!=null?o:n;return typeof i=="number"?l=>typeof l=="string"?l:i*l:Array.isArray(i)?l=>typeof l=="string"?l:i[l]:typeof i=="function"?i:()=>{}}function P1(e){return $s(e,"spacing",8)}function Ns(e,t){if(typeof t=="string"||t==null)return t;const n=Math.abs(t),r=e(n);return t>=0?r:typeof r=="number"?-r:`-${r}`}function r2(e,t){return n=>e.reduce((r,o)=>(r[o]=Ns(t,n),r),{})}function o2(e,t,n,r){if(t.indexOf(n)===-1)return null;const o=n2(n),i=r2(o,r),l=e[n];return Qn(e,l,i)}function R1(e,t){const n=P1(e.theme);return Object.keys(e).map(r=>o2(e,t,r,n)).reduce(Zl,{})}function yt(e){return R1(e,qp)}yt.propTypes={};yt.filterProps=qp;function vt(e){return R1(e,Qp)}vt.propTypes={};vt.filterProps=Qp;function i2(e=8){if(e.mui)return e;const t=P1({spacing:e}),n=(...r)=>(r.length===0?[1]:r).map(i=>{const l=t(i);return typeof l=="number"?`${l}px`:l}).join(" ");return n.mui=!0,n}function sc(...e){const t=e.reduce((r,o)=>(o.filterProps.forEach(i=>{r[i]=o}),r),{}),n=r=>Object.keys(r).reduce((o,i)=>t[i]?Zl(o,t[i](r)):o,{});return n.propTypes={},n.filterProps=e.reduce((r,o)=>r.concat(o.filterProps),[]),n}function xr(e){return typeof e!="number"?e:`${e}px solid`}const l2=He({prop:"border",themeKey:"borders",transform:xr}),s2=He({prop:"borderTop",themeKey:"borders",transform:xr}),a2=He({prop:"borderRight",themeKey:"borders",transform:xr}),u2=He({prop:"borderBottom",themeKey:"borders",transform:xr}),c2=He({prop:"borderLeft",themeKey:"borders",transform:xr}),f2=He({prop:"borderColor",themeKey:"palette"}),d2=He({prop:"borderTopColor",themeKey:"palette"}),p2=He({prop:"borderRightColor",themeKey:"palette"}),h2=He({prop:"borderBottomColor",themeKey:"palette"}),m2=He({prop:"borderLeftColor",themeKey:"palette"}),ac=e=>{if(e.borderRadius!==void 0&&e.borderRadius!==null){const t=$s(e.theme,"shape.borderRadius",4),n=r=>({borderRadius:Ns(t,r)});return Qn(e,e.borderRadius,n)}return null};ac.propTypes={};ac.filterProps=["borderRadius"];sc(l2,s2,a2,u2,c2,f2,d2,p2,h2,m2,ac);const uc=e=>{if(e.gap!==void 0&&e.gap!==null){const t=$s(e.theme,"spacing",8),n=r=>({gap:Ns(t,r)});return Qn(e,e.gap,n)}return null};uc.propTypes={};uc.filterProps=["gap"];const cc=e=>{if(e.columnGap!==void 0&&e.columnGap!==null){const t=$s(e.theme,"spacing",8),n=r=>({columnGap:Ns(t,r)});return Qn(e,e.columnGap,n)}return null};cc.propTypes={};cc.filterProps=["columnGap"];const fc=e=>{if(e.rowGap!==void 0&&e.rowGap!==null){const t=$s(e.theme,"spacing",8),n=r=>({rowGap:Ns(t,r)});return Qn(e,e.rowGap,n)}return null};fc.propTypes={};fc.filterProps=["rowGap"];const g2=He({prop:"gridColumn"}),y2=He({prop:"gridRow"}),v2=He({prop:"gridAutoFlow"}),x2=He({prop:"gridAutoColumns"}),w2=He({prop:"gridAutoRows"}),S2=He({prop:"gridTemplateColumns"}),_2=He({prop:"gridTemplateRows"}),k2=He({prop:"gridTemplateAreas"}),b2=He({prop:"gridArea"});sc(uc,cc,fc,g2,y2,v2,x2,w2,S2,_2,k2,b2);function Ii(e,t){return t==="grey"?t:e}const E2=He({prop:"color",themeKey:"palette",transform:Ii}),C2=He({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:Ii}),T2=He({prop:"backgroundColor",themeKey:"palette",transform:Ii});sc(E2,C2,T2);function Mn(e){return e<=1&&e!==0?`${e*100}%`:e}const P2=He({prop:"width",transform:Mn}),Xp=e=>{if(e.maxWidth!==void 0&&e.maxWidth!==null){const t=n=>{var r;return{maxWidth:((r=e.theme)==null||(r=r.breakpoints)==null||(r=r.values)==null?void 0:r[n])||Yp[n]||Mn(n)}};return Qn(e,e.maxWidth,t)}return null};Xp.filterProps=["maxWidth"];const R2=He({prop:"minWidth",transform:Mn}),M2=He({prop:"height",transform:Mn}),$2=He({prop:"maxHeight",transform:Mn}),N2=He({prop:"minHeight",transform:Mn});He({prop:"size",cssProperty:"width",transform:Mn});He({prop:"size",cssProperty:"height",transform:Mn});const O2=He({prop:"boxSizing"});sc(P2,Xp,R2,M2,$2,N2,O2);const z2={border:{themeKey:"borders",transform:xr},borderTop:{themeKey:"borders",transform:xr},borderRight:{themeKey:"borders",transform:xr},borderBottom:{themeKey:"borders",transform:xr},borderLeft:{themeKey:"borders",transform:xr},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:ac},color:{themeKey:"palette",transform:Ii},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:Ii},backgroundColor:{themeKey:"palette",transform:Ii},p:{style:vt},pt:{style:vt},pr:{style:vt},pb:{style:vt},pl:{style:vt},px:{style:vt},py:{style:vt},padding:{style:vt},paddingTop:{style:vt},paddingRight:{style:vt},paddingBottom:{style:vt},paddingLeft:{style:vt},paddingX:{style:vt},paddingY:{style:vt},paddingInline:{style:vt},paddingInlineStart:{style:vt},paddingInlineEnd:{style:vt},paddingBlock:{style:vt},paddingBlockStart:{style:vt},paddingBlockEnd:{style:vt},m:{style:yt},mt:{style:yt},mr:{style:yt},mb:{style:yt},ml:{style:yt},mx:{style:yt},my:{style:yt},margin:{style:yt},marginTop:{style:yt},marginRight:{style:yt},marginBottom:{style:yt},marginLeft:{style:yt},marginX:{style:yt},marginY:{style:yt},marginInline:{style:yt},marginInlineStart:{style:yt},marginInlineEnd:{style:yt},marginBlock:{style:yt},marginBlockStart:{style:yt},marginBlockEnd:{style:yt},displayPrint:{cssProperty:!1,transform:e=>({"@media print":{display:e}})},display:{},overflow:{},textOverflow:{},visibility:{},whiteSpace:{},flexBasis:{},flexDirection:{},flexWrap:{},justifyContent:{},alignItems:{},alignContent:{},order:{},flex:{},flexGrow:{},flexShrink:{},alignSelf:{},justifyItems:{},justifySelf:{},gap:{style:uc},rowGap:{style:fc},columnGap:{style:cc},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:Mn},maxWidth:{style:Xp},minWidth:{transform:Mn},height:{transform:Mn},maxHeight:{transform:Mn},minHeight:{transform:Mn},boxSizing:{},fontFamily:{themeKey:"typography"},fontSize:{themeKey:"typography"},fontStyle:{themeKey:"typography"},fontWeight:{themeKey:"typography"},letterSpacing:{},textTransform:{},lineHeight:{},textAlign:{},typography:{cssProperty:!1,themeKey:"typography"}},dc=z2;function L2(...e){const t=e.reduce((r,o)=>r.concat(Object.keys(o)),[]),n=new Set(t);return e.every(r=>n.size===Object.keys(r).length)}function A2(e,t){return typeof e=="function"?e(t):e}function I2(){function e(n,r,o,i){const l={[n]:r,theme:o},s=i[n];if(!s)return{[n]:r};const{cssProperty:u=n,themeKey:a,transform:c,style:p}=s;if(r==null)return null;if(a==="typography"&&r==="inherit")return{[n]:r};const f=lc(o,a)||{};return p?p(l):Qn(l,r,x=>{let v=uu(f,c,x);return x===v&&typeof x=="string"&&(v=uu(f,c,`${n}${x==="default"?"":be(x)}`,x)),u===!1?v:{[u]:v}})}function t(n){var r;const{sx:o,theme:i={}}=n||{};if(!o)return null;const l=(r=i.unstable_sxConfig)!=null?r:dc;function s(u){let a=u;if(typeof u=="function")a=u(i);else if(typeof u!="object")return u;if(!a)return null;const c=Qb(i.breakpoints),p=Object.keys(c);let f=c;return Object.keys(a).forEach(h=>{const x=A2(a[h],i);if(x!=null)if(typeof x=="object")if(l[h])f=Zl(f,e(h,x,i,l));else{const v=Qn({theme:i},x,C=>({[h]:C}));L2(v,x)?f[h]=t({sx:x,theme:i}):f=Zl(f,v)}else f=Zl(f,e(h,x,i,l))}),Xb(p,f)}return Array.isArray(o)?o.map(s):s(o)}return t}const M1=I2();M1.filterProps=["sx"];const pc=M1,D2=["breakpoints","palette","spacing","shape"];function Zp(e={},...t){const{breakpoints:n={},palette:r={},spacing:o,shape:i={}}=e,l=$e(e,D2),s=Gb(n),u=i2(o);let a=Nr({breakpoints:s,direction:"ltr",components:{},palette:A({mode:"light"},r),spacing:u,shape:A({},qb,i)},l);return a=t.reduce((c,p)=>Nr(c,p),a),a.unstable_sxConfig=A({},dc,l==null?void 0:l.unstable_sxConfig),a.unstable_sx=function(p){return pc({sx:p,theme:this})},a}function B2(e){return Object.keys(e).length===0}function Jp(e=null){const t=L.useContext(oc);return!t||B2(t)?e:t}const F2=Zp();function hc(e=F2){return Jp(e)}function j2({styles:e,themeId:t,defaultTheme:n={}}){const r=hc(n),o=typeof e=="function"?e(t&&r[t]||r):e;return F.jsx(Hb,{styles:o})}const W2=["sx"],H2=e=>{var t,n;const r={systemProps:{},otherProps:{}},o=(t=e==null||(n=e.theme)==null?void 0:n.unstable_sxConfig)!=null?t:dc;return Object.keys(e).forEach(i=>{o[i]?r.systemProps[i]=e[i]:r.otherProps[i]=e[i]}),r};function eh(e){const{sx:t}=e,n=$e(e,W2),{systemProps:r,otherProps:o}=H2(n);let i;return Array.isArray(t)?i=[r,...t]:typeof t=="function"?i=(...l)=>{const s=t(...l);return $o(s)?A({},r,s):r}:i=A({},r,t),A({},o,{sx:i})}function $1(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;ts!=="theme"&&s!=="sx"&&s!=="as"})(pc);return L.forwardRef(function(u,a){const c=hc(n),p=eh(u),{className:f,component:h="div"}=p,x=$e(p,U2);return F.jsx(i,A({as:h,ref:a,className:Ee(f,o?o(r):r),theme:t&&c[t]||c},x))})}const K2=["variant"];function mm(e){return e.length===0}function N1(e){const{variant:t}=e,n=$e(e,K2);let r=t||"";return Object.keys(n).sort().forEach(o=>{o==="color"?r+=mm(r)?e[o]:be(e[o]):r+=`${mm(r)?o:be(o)}${be(e[o].toString())}`}),r}const G2=["name","slot","skipVariantsResolver","skipSx","overridesResolver"];function Y2(e){return Object.keys(e).length===0}function q2(e){return typeof e=="string"&&e.charCodeAt(0)>96}const Q2=(e,t)=>t.components&&t.components[e]&&t.components[e].styleOverrides?t.components[e].styleOverrides:null,X2=(e,t)=>{let n=[];t&&t.components&&t.components[e]&&t.components[e].variants&&(n=t.components[e].variants);const r={};return n.forEach(o=>{const i=N1(o.props);r[i]=o.style}),r},Z2=(e,t,n,r)=>{var o;const{ownerState:i={}}=e,l=[],s=n==null||(o=n.components)==null||(o=o[r])==null?void 0:o.variants;return s&&s.forEach(u=>{let a=!0;Object.keys(u.props).forEach(c=>{i[c]!==u.props[c]&&e[c]!==u.props[c]&&(a=!1)}),a&&l.push(t[N1(u.props)])}),l};function za(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}const J2=Zp(),eE=e=>e&&e.charAt(0).toLowerCase()+e.slice(1);function $l({defaultTheme:e,theme:t,themeId:n}){return Y2(t)?e:t[n]||t}function tE(e){return e?(t,n)=>n[e]:null}function nE(e={}){const{themeId:t,defaultTheme:n=J2,rootShouldForwardProp:r=za,slotShouldForwardProp:o=za}=e,i=l=>pc(A({},l,{theme:$l(A({},l,{defaultTheme:n,themeId:t}))}));return i.__mui_systemSx=!0,(l,s={})=>{Ub(l,E=>E.filter(P=>!(P!=null&&P.__mui_systemSx)));const{name:u,slot:a,skipVariantsResolver:c,skipSx:p,overridesResolver:f=tE(eE(a))}=s,h=$e(s,G2),x=c!==void 0?c:a&&a!=="Root"&&a!=="root"||!1,v=p||!1;let C,w=za;a==="Root"||a==="root"?w=r:a?w=o:q2(l)&&(w=void 0);const m=T1(l,A({shouldForwardProp:w,label:C},h)),S=(E,...P)=>{const N=P?P.map(O=>typeof O=="function"&&O.__emotion_real!==O?D=>O(A({},D,{theme:$l(A({},D,{defaultTheme:n,themeId:t}))})):O):[];let R=E;u&&f&&N.push(O=>{const D=$l(A({},O,{defaultTheme:n,themeId:t})),U=Q2(u,D);if(U){const V={};return Object.entries(U).forEach(([ee,le])=>{V[ee]=typeof le=="function"?le(A({},O,{theme:D})):le}),f(O,V)}return null}),u&&!x&&N.push(O=>{const D=$l(A({},O,{defaultTheme:n,themeId:t}));return Z2(O,X2(u,D),D,u)}),v||N.push(i);const z=N.length-P.length;if(Array.isArray(E)&&z>0){const O=new Array(z).fill("");R=[...E,...O],R.raw=[...E.raw,...O]}else typeof E=="function"&&E.__emotion_real!==E&&(R=O=>E(A({},O,{theme:$l(A({},O,{defaultTheme:n,themeId:t}))})));const j=m(R,...N);return l.muiName&&(j.muiName=l.muiName),j};return m.withConfig&&(S.withConfig=m.withConfig),S}}function O1(e){const{theme:t,name:n,props:r}=e;return!t||!t.components||!t.components[n]||!t.components[n].defaultProps?r:Bp(t.components[n].defaultProps,r)}function rE({props:e,name:t,defaultTheme:n,themeId:r}){let o=hc(n);return r&&(o=o[r]||o),O1({theme:o,name:t,props:e})}function th(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function oE(e){e=e.slice(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let n=e.match(t);return n&&n[0].length===1&&(n=n.map(r=>r+r)),n?`rgb${n.length===4?"a":""}(${n.map((r,o)=>o<3?parseInt(r,16):Math.round(parseInt(r,16)/255*1e3)/1e3).join(", ")})`:""}function Yo(e){if(e.type)return e;if(e.charAt(0)==="#")return Yo(oE(e));const t=e.indexOf("("),n=e.substring(0,t);if(["rgb","rgba","hsl","hsla","color"].indexOf(n)===-1)throw new Error(Gi(9,e));let r=e.substring(t+1,e.length-1),o;if(n==="color"){if(r=r.split(" "),o=r.shift(),r.length===4&&r[3].charAt(0)==="/"&&(r[3]=r[3].slice(1)),["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(o)===-1)throw new Error(Gi(10,o))}else r=r.split(",");return r=r.map(i=>parseFloat(i)),{type:n,values:r,colorSpace:o}}function mc(e){const{type:t,colorSpace:n}=e;let{values:r}=e;return t.indexOf("rgb")!==-1?r=r.map((o,i)=>i<3?parseInt(o,10):o):t.indexOf("hsl")!==-1&&(r[1]=`${r[1]}%`,r[2]=`${r[2]}%`),t.indexOf("color")!==-1?r=`${n} ${r.join(" ")}`:r=`${r.join(", ")}`,`${t}(${r})`}function iE(e){e=Yo(e);const{values:t}=e,n=t[0],r=t[1]/100,o=t[2]/100,i=r*Math.min(o,1-o),l=(a,c=(a+n/30)%12)=>o-i*Math.max(Math.min(c-3,9-c,1),-1);let s="rgb";const u=[Math.round(l(0)*255),Math.round(l(8)*255),Math.round(l(4)*255)];return e.type==="hsla"&&(s+="a",u.push(t[3])),mc({type:s,values:u})}function gm(e){e=Yo(e);let t=e.type==="hsl"||e.type==="hsla"?Yo(iE(e)).values:e.values;return t=t.map(n=>(e.type!=="color"&&(n/=255),n<=.03928?n/12.92:((n+.055)/1.055)**2.4)),Number((.2126*t[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}function lE(e,t){const n=gm(e),r=gm(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Kn(e,t){return e=Yo(e),t=th(t),(e.type==="rgb"||e.type==="hsl")&&(e.type+="a"),e.type==="color"?e.values[3]=`/${t}`:e.values[3]=t,mc(e)}function z1(e,t){if(e=Yo(e),t=th(t),e.type.indexOf("hsl")!==-1)e.values[2]*=1-t;else if(e.type.indexOf("rgb")!==-1||e.type.indexOf("color")!==-1)for(let n=0;n<3;n+=1)e.values[n]*=1-t;return mc(e)}function L1(e,t){if(e=Yo(e),t=th(t),e.type.indexOf("hsl")!==-1)e.values[2]+=(100-e.values[2])*t;else if(e.type.indexOf("rgb")!==-1)for(let n=0;n<3;n+=1)e.values[n]+=(255-e.values[n])*t;else if(e.type.indexOf("color")!==-1)for(let n=0;n<3;n+=1)e.values[n]+=(1-e.values[n])*t;return mc(e)}const sE=L.createContext(null),A1=sE;function I1(){return L.useContext(A1)}const aE=typeof Symbol=="function"&&Symbol.for,uE=aE?Symbol.for("mui.nested"):"__THEME_NESTED__";function cE(e,t){return typeof t=="function"?t(e):A({},e,t)}function fE(e){const{children:t,theme:n}=e,r=I1(),o=L.useMemo(()=>{const i=r===null?n:cE(r,n);return i!=null&&(i[uE]=r!==null),i},[n,r]);return F.jsx(A1.Provider,{value:o,children:t})}const ym={};function vm(e,t,n,r=!1){return L.useMemo(()=>{const o=e&&t[e]||t;if(typeof n=="function"){const i=n(o),l=e?A({},t,{[e]:i}):i;return r?()=>l:l}return e?A({},t,{[e]:n}):A({},t,n)},[e,t,n,r])}function dE(e){const{children:t,theme:n,themeId:r}=e,o=Jp(ym),i=I1()||ym,l=vm(r,o,n),s=vm(r,i,n,!0);return F.jsx(fE,{theme:s,children:F.jsx(oc.Provider,{value:l,children:t})})}function pE(e,t){return A({toolbar:{minHeight:56,[e.up("xs")]:{"@media (orientation: landscape)":{minHeight:48}},[e.up("sm")]:{minHeight:64}}},t)}const hE=["mode","contrastThreshold","tonalOffset"],xm={text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{paper:vs.white,default:vs.white},action:{active:"rgba(0, 0, 0, 0.54)",hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08,disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,activatedOpacity:.12}},kf={text:{primary:vs.white,secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)",icon:"rgba(255, 255, 255, 0.5)"},divider:"rgba(255, 255, 255, 0.12)",background:{paper:"#121212",default:"#121212"},action:{active:vs.white,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16,disabled:"rgba(255, 255, 255, 0.3)",disabledBackground:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,activatedOpacity:.24}};function wm(e,t,n,r){const o=r.light||r,i=r.dark||r*1.5;e[t]||(e.hasOwnProperty(n)?e[t]=e[n]:t==="light"?e.light=L1(e.main,o):t==="dark"&&(e.dark=z1(e.main,i)))}function mE(e="light"){return e==="dark"?{main:bo[200],light:bo[50],dark:bo[400]}:{main:bo[700],light:bo[400],dark:bo[800]}}function gE(e="light"){return e==="dark"?{main:ko[200],light:ko[50],dark:ko[400]}:{main:ko[500],light:ko[300],dark:ko[700]}}function yE(e="light"){return e==="dark"?{main:_o[500],light:_o[300],dark:_o[700]}:{main:_o[700],light:_o[400],dark:_o[800]}}function vE(e="light"){return e==="dark"?{main:Eo[400],light:Eo[300],dark:Eo[700]}:{main:Eo[700],light:Eo[500],dark:Eo[900]}}function xE(e="light"){return e==="dark"?{main:Co[400],light:Co[300],dark:Co[700]}:{main:Co[800],light:Co[500],dark:Co[900]}}function wE(e="light"){return e==="dark"?{main:hi[400],light:hi[300],dark:hi[700]}:{main:"#ed6c02",light:hi[500],dark:hi[900]}}function SE(e){const{mode:t="light",contrastThreshold:n=3,tonalOffset:r=.2}=e,o=$e(e,hE),i=e.primary||mE(t),l=e.secondary||gE(t),s=e.error||yE(t),u=e.info||vE(t),a=e.success||xE(t),c=e.warning||wE(t);function p(v){return lE(v,kf.text.primary)>=n?kf.text.primary:xm.text.primary}const f=({color:v,name:C,mainShade:w=500,lightShade:m=300,darkShade:S=700})=>{if(v=A({},v),!v.main&&v[w]&&(v.main=v[w]),!v.hasOwnProperty("main"))throw new Error(Gi(11,C?` (${C})`:"",w));if(typeof v.main!="string")throw new Error(Gi(12,C?` (${C})`:"",JSON.stringify(v.main)));return wm(v,"light",m,r),wm(v,"dark",S,r),v.contrastText||(v.contrastText=p(v.main)),v},h={dark:kf,light:xm};return Nr(A({common:A({},vs),mode:t,primary:f({color:i,name:"primary"}),secondary:f({color:l,name:"secondary",mainShade:"A400",lightShade:"A200",darkShade:"A700"}),error:f({color:s,name:"error"}),warning:f({color:c,name:"warning"}),info:f({color:u,name:"info"}),success:f({color:a,name:"success"}),grey:Zv,contrastThreshold:n,getContrastText:p,augmentColor:f,tonalOffset:r},h[t]),o)}const _E=["fontFamily","fontSize","fontWeightLight","fontWeightRegular","fontWeightMedium","fontWeightBold","htmlFontSize","allVariants","pxToRem"];function kE(e){return Math.round(e*1e5)/1e5}const Sm={textTransform:"uppercase"},_m='"Roboto", "Helvetica", "Arial", sans-serif';function bE(e,t){const n=typeof t=="function"?t(e):t,{fontFamily:r=_m,fontSize:o=14,fontWeightLight:i=300,fontWeightRegular:l=400,fontWeightMedium:s=500,fontWeightBold:u=700,htmlFontSize:a=16,allVariants:c,pxToRem:p}=n,f=$e(n,_E),h=o/14,x=p||(w=>`${w/a*h}rem`),v=(w,m,S,E,P)=>A({fontFamily:r,fontWeight:w,fontSize:x(m),lineHeight:S},r===_m?{letterSpacing:`${kE(E/m)}em`}:{},P,c),C={h1:v(i,96,1.167,-1.5),h2:v(i,60,1.2,-.5),h3:v(l,48,1.167,0),h4:v(l,34,1.235,.25),h5:v(l,24,1.334,0),h6:v(s,20,1.6,.15),subtitle1:v(l,16,1.75,.15),subtitle2:v(s,14,1.57,.1),body1:v(l,16,1.5,.15),body2:v(l,14,1.43,.15),button:v(s,14,1.75,.4,Sm),caption:v(l,12,1.66,.4),overline:v(l,12,2.66,1,Sm),inherit:{fontFamily:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}};return Nr(A({htmlFontSize:a,pxToRem:x,fontFamily:r,fontSize:o,fontWeightLight:i,fontWeightRegular:l,fontWeightMedium:s,fontWeightBold:u},C),f,{clone:!1})}const EE=.2,CE=.14,TE=.12;function it(...e){return[`${e[0]}px ${e[1]}px ${e[2]}px ${e[3]}px rgba(0,0,0,${EE})`,`${e[4]}px ${e[5]}px ${e[6]}px ${e[7]}px rgba(0,0,0,${CE})`,`${e[8]}px ${e[9]}px ${e[10]}px ${e[11]}px rgba(0,0,0,${TE})`].join(",")}const PE=["none",it(0,2,1,-1,0,1,1,0,0,1,3,0),it(0,3,1,-2,0,2,2,0,0,1,5,0),it(0,3,3,-2,0,3,4,0,0,1,8,0),it(0,2,4,-1,0,4,5,0,0,1,10,0),it(0,3,5,-1,0,5,8,0,0,1,14,0),it(0,3,5,-1,0,6,10,0,0,1,18,0),it(0,4,5,-2,0,7,10,1,0,2,16,1),it(0,5,5,-3,0,8,10,1,0,3,14,2),it(0,5,6,-3,0,9,12,1,0,3,16,2),it(0,6,6,-3,0,10,14,1,0,4,18,3),it(0,6,7,-4,0,11,15,1,0,4,20,3),it(0,7,8,-4,0,12,17,2,0,5,22,4),it(0,7,8,-4,0,13,19,2,0,5,24,4),it(0,7,9,-4,0,14,21,2,0,5,26,4),it(0,8,9,-5,0,15,22,2,0,6,28,5),it(0,8,10,-5,0,16,24,2,0,6,30,5),it(0,8,11,-5,0,17,26,2,0,6,32,5),it(0,9,11,-5,0,18,28,2,0,7,34,6),it(0,9,12,-6,0,19,29,2,0,7,36,6),it(0,10,13,-6,0,20,31,3,0,8,38,7),it(0,10,13,-6,0,21,33,3,0,8,40,7),it(0,10,14,-6,0,22,35,3,0,8,42,7),it(0,11,14,-7,0,23,36,3,0,9,44,8),it(0,11,15,-7,0,24,38,3,0,9,46,8)],RE=PE,ME=["duration","easing","delay"],$E={easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.4, 0, 1, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},D1={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function km(e){return`${Math.round(e)}ms`}function NE(e){if(!e)return 0;const t=e/36;return Math.round((4+15*t**.25+t/5)*10)}function OE(e){const t=A({},$E,e.easing),n=A({},D1,e.duration);return A({getAutoHeightDuration:NE,create:(o=["all"],i={})=>{const{duration:l=n.standard,easing:s=t.easeInOut,delay:u=0}=i;return $e(i,ME),(Array.isArray(o)?o:[o]).map(a=>`${a} ${typeof l=="string"?l:km(l)} ${s} ${typeof u=="string"?u:km(u)}`).join(",")}},e,{easing:t,duration:n})}const zE={mobileStepper:1e3,fab:1050,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500},LE=zE,AE=["breakpoints","mixins","spacing","palette","transitions","typography","shape"];function cu(e={},...t){const{mixins:n={},palette:r={},transitions:o={},typography:i={}}=e,l=$e(e,AE);if(e.vars)throw new Error(Gi(18));const s=SE(r),u=Zp(e);let a=Nr(u,{mixins:pE(u.breakpoints,n),palette:s,shadows:RE.slice(),typography:bE(s,i),transitions:OE(o),zIndex:A({},LE)});return a=Nr(a,l),a=t.reduce((c,p)=>Nr(c,p),a),a.unstable_sxConfig=A({},dc,l==null?void 0:l.unstable_sxConfig),a.unstable_sx=function(p){return pc({sx:p,theme:this})},a}const IE=cu(),gc=IE;function mo(){const e=hc(gc);return e[Go]||e}function kt({props:e,name:t}){return rE({props:e,name:t,defaultTheme:gc,themeId:Go})}const B1=e=>za(e)&&e!=="classes",DE=nE({themeId:Go,defaultTheme:gc,rootShouldForwardProp:B1}),Ye=DE,BE=["theme"];function FE(e){let{theme:t}=e,n=$e(e,BE);const r=t[Go];return F.jsx(dE,A({},n,{themeId:r?Go:void 0,theme:r||t}))}const jE=e=>{let t;return e<1?t=5.11916*e**2:t=4.5*Math.log(e+1)+2,(t/100).toFixed(2)},bm=jE;function WE(e){return Mt("MuiSvgIcon",e)}$t("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const HE=["children","className","color","component","fontSize","htmlColor","inheritViewBox","titleAccess","viewBox"],UE=e=>{const{color:t,fontSize:n,classes:r}=e,o={root:["root",t!=="inherit"&&`color${be(t)}`,`fontSize${be(n)}`]};return zt(o,WE,r)},VE=Ye("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.color!=="inherit"&&t[`color${be(n.color)}`],t[`fontSize${be(n.fontSize)}`]]}})(({theme:e,ownerState:t})=>{var n,r,o,i,l,s,u,a,c,p,f,h,x;return{userSelect:"none",width:"1em",height:"1em",display:"inline-block",fill:t.hasSvgAsChild?void 0:"currentColor",flexShrink:0,transition:(n=e.transitions)==null||(r=n.create)==null?void 0:r.call(n,"fill",{duration:(o=e.transitions)==null||(o=o.duration)==null?void 0:o.shorter}),fontSize:{inherit:"inherit",small:((i=e.typography)==null||(l=i.pxToRem)==null?void 0:l.call(i,20))||"1.25rem",medium:((s=e.typography)==null||(u=s.pxToRem)==null?void 0:u.call(s,24))||"1.5rem",large:((a=e.typography)==null||(c=a.pxToRem)==null?void 0:c.call(a,35))||"2.1875rem"}[t.fontSize],color:(p=(f=(e.vars||e).palette)==null||(f=f[t.color])==null?void 0:f.main)!=null?p:{action:(h=(e.vars||e).palette)==null||(h=h.action)==null?void 0:h.active,disabled:(x=(e.vars||e).palette)==null||(x=x.action)==null?void 0:x.disabled,inherit:void 0}[t.color]}}),F1=L.forwardRef(function(t,n){const r=kt({props:t,name:"MuiSvgIcon"}),{children:o,className:i,color:l="inherit",component:s="svg",fontSize:u="medium",htmlColor:a,inheritViewBox:c=!1,titleAccess:p,viewBox:f="0 0 24 24"}=r,h=$e(r,HE),x=L.isValidElement(o)&&o.type==="svg",v=A({},r,{color:l,component:s,fontSize:u,instanceFontSize:t.fontSize,inheritViewBox:c,viewBox:f,hasSvgAsChild:x}),C={};c||(C.viewBox=f);const w=UE(v);return F.jsxs(VE,A({as:s,className:Ee(w.root,i),focusable:"false",color:a,"aria-hidden":p?void 0:!0,role:p?"img":void 0,ref:n},C,h,x&&o.props,{ownerState:v,children:[x?o.props.children:o,p?F.jsx("title",{children:p}):null]}))});F1.muiName="SvgIcon";const Em=F1;function j1(e,t){function n(r,o){return F.jsx(Em,A({"data-testid":`${t}Icon`,ref:o},r,{children:e}))}return n.muiName=Em.muiName,L.memo(L.forwardRef(n))}function Rd(e,t){return Rd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},Rd(e,t)}function W1(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Rd(e,t)}const Cm={disabled:!1},fu=Vt.createContext(null);var KE=function(t){return t.scrollTop},Bl="unmounted",To="exited",Po="entering",mi="entered",Md="exiting",Fr=function(e){W1(t,e);function t(r,o){var i;i=e.call(this,r,o)||this;var l=o,s=l&&!l.isMounting?r.enter:r.appear,u;return i.appearStatus=null,r.in?s?(u=To,i.appearStatus=Po):u=mi:r.unmountOnExit||r.mountOnEnter?u=Bl:u=To,i.state={status:u},i.nextCallback=null,i}t.getDerivedStateFromProps=function(o,i){var l=o.in;return l&&i.status===Bl?{status:To}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(o){var i=null;if(o!==this.props){var l=this.state.status;this.props.in?l!==Po&&l!==mi&&(i=Po):(l===Po||l===mi)&&(i=Md)}this.updateStatus(!1,i)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var o=this.props.timeout,i,l,s;return i=l=s=o,o!=null&&typeof o!="number"&&(i=o.exit,l=o.enter,s=o.appear!==void 0?o.appear:l),{exit:i,enter:l,appear:s}},n.updateStatus=function(o,i){if(o===void 0&&(o=!1),i!==null)if(this.cancelNextCallback(),i===Po){if(this.props.unmountOnExit||this.props.mountOnEnter){var l=this.props.nodeRef?this.props.nodeRef.current:ua.findDOMNode(this);l&&KE(l)}this.performEnter(o)}else this.performExit();else this.props.unmountOnExit&&this.state.status===To&&this.setState({status:Bl})},n.performEnter=function(o){var i=this,l=this.props.enter,s=this.context?this.context.isMounting:o,u=this.props.nodeRef?[s]:[ua.findDOMNode(this),s],a=u[0],c=u[1],p=this.getTimeouts(),f=s?p.appear:p.enter;if(!o&&!l||Cm.disabled){this.safeSetState({status:mi},function(){i.props.onEntered(a)});return}this.props.onEnter(a,c),this.safeSetState({status:Po},function(){i.props.onEntering(a,c),i.onTransitionEnd(f,function(){i.safeSetState({status:mi},function(){i.props.onEntered(a,c)})})})},n.performExit=function(){var o=this,i=this.props.exit,l=this.getTimeouts(),s=this.props.nodeRef?void 0:ua.findDOMNode(this);if(!i||Cm.disabled){this.safeSetState({status:To},function(){o.props.onExited(s)});return}this.props.onExit(s),this.safeSetState({status:Md},function(){o.props.onExiting(s),o.onTransitionEnd(l.exit,function(){o.safeSetState({status:To},function(){o.props.onExited(s)})})})},n.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(o,i){i=this.setNextCallback(i),this.setState(o,i)},n.setNextCallback=function(o){var i=this,l=!0;return this.nextCallback=function(s){l&&(l=!1,i.nextCallback=null,o(s))},this.nextCallback.cancel=function(){l=!1},this.nextCallback},n.onTransitionEnd=function(o,i){this.setNextCallback(i);var l=this.props.nodeRef?this.props.nodeRef.current:ua.findDOMNode(this),s=o==null&&!this.props.addEndListener;if(!l||s){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var u=this.props.nodeRef?[this.nextCallback]:[l,this.nextCallback],a=u[0],c=u[1];this.props.addEndListener(a,c)}o!=null&&setTimeout(this.nextCallback,o)},n.render=function(){var o=this.state.status;if(o===Bl)return null;var i=this.props,l=i.children;i.in,i.mountOnEnter,i.unmountOnExit,i.appear,i.enter,i.exit,i.timeout,i.addEndListener,i.onEnter,i.onEntering,i.onEntered,i.onExit,i.onExiting,i.onExited,i.nodeRef;var s=$e(i,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return Vt.createElement(fu.Provider,{value:null},typeof l=="function"?l(o,s):Vt.cloneElement(Vt.Children.only(l),s))},t}(Vt.Component);Fr.contextType=fu;Fr.propTypes={};function ci(){}Fr.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:ci,onEntering:ci,onEntered:ci,onExit:ci,onExiting:ci,onExited:ci};Fr.UNMOUNTED=Bl;Fr.EXITED=To;Fr.ENTERING=Po;Fr.ENTERED=mi;Fr.EXITING=Md;const GE=Fr;function YE(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function nh(e,t){var n=function(i){return t&&L.isValidElement(i)?t(i):i},r=Object.create(null);return e&&L.Children.map(e,function(o){return o}).forEach(function(o){r[o.key]=n(o)}),r}function qE(e,t){e=e||{},t=t||{};function n(c){return c in t?t[c]:e[c]}var r=Object.create(null),o=[];for(var i in e)i in t?o.length&&(r[i]=o,o=[]):o.push(i);var l,s={};for(var u in t){if(r[u])for(l=0;l{const{orientation:t,classes:n}=e,r={root:["root",`${t}`],entered:["entered"],hidden:["hidden"],wrapper:["wrapper",`${t}`],wrapperInner:["wrapperInner",`${t}`]};return zt(r,tC,n)},oC=Ye("div",{name:"MuiCollapse",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.orientation],n.state==="entered"&&t.entered,n.state==="exited"&&!n.in&&n.collapsedSize==="0px"&&t.hidden]}})(({theme:e,ownerState:t})=>A({height:0,overflow:"hidden",transition:e.transitions.create("height")},t.orientation==="horizontal"&&{height:"auto",width:0,transition:e.transitions.create("width")},t.state==="entered"&&A({height:"auto",overflow:"visible"},t.orientation==="horizontal"&&{width:"auto"}),t.state==="exited"&&!t.in&&t.collapsedSize==="0px"&&{visibility:"hidden"})),iC=Ye("div",{name:"MuiCollapse",slot:"Wrapper",overridesResolver:(e,t)=>t.wrapper})(({ownerState:e})=>A({display:"flex",width:"100%"},e.orientation==="horizontal"&&{width:"auto",height:"100%"})),lC=Ye("div",{name:"MuiCollapse",slot:"WrapperInner",overridesResolver:(e,t)=>t.wrapperInner})(({ownerState:e})=>A({width:"100%"},e.orientation==="horizontal"&&{width:"auto",height:"100%"})),H1=L.forwardRef(function(t,n){const r=kt({props:t,name:"MuiCollapse"}),{addEndListener:o,children:i,className:l,collapsedSize:s="0px",component:u,easing:a,in:c,onEnter:p,onEntered:f,onEntering:h,onExit:x,onExited:v,onExiting:C,orientation:w="vertical",style:m,timeout:S=D1.standard,TransitionComponent:E=GE}=r,P=$e(r,nC),N=A({},r,{orientation:w,collapsedSize:s}),R=rC(N),z=mo(),j=L.useRef(),O=L.useRef(null),D=L.useRef(),U=typeof s=="number"?`${s}px`:s,V=w==="horizontal",ee=V?"width":"height";L.useEffect(()=>()=>{clearTimeout(j.current)},[]);const le=L.useRef(null),me=su(n,le),se=ae=>Ce=>{if(ae){const Ae=le.current;Ce===void 0?ae(Ae):ae(Ae,Ce)}},H=()=>O.current?O.current[V?"clientWidth":"clientHeight"]:0,ne=se((ae,Ce)=>{O.current&&V&&(O.current.style.position="absolute"),ae.style[ee]=U,p&&p(ae,Ce)}),G=se((ae,Ce)=>{const Ae=H();O.current&&V&&(O.current.style.position="");const{duration:Ne,easing:Ze}=Tm({style:m,timeout:S,easing:a},{mode:"enter"});if(S==="auto"){const ht=z.transitions.getAutoHeightDuration(Ae);ae.style.transitionDuration=`${ht}ms`,D.current=ht}else ae.style.transitionDuration=typeof Ne=="string"?Ne:`${Ne}ms`;ae.style[ee]=`${Ae}px`,ae.style.transitionTimingFunction=Ze,h&&h(ae,Ce)}),oe=se((ae,Ce)=>{ae.style[ee]="auto",f&&f(ae,Ce)}),Z=se(ae=>{ae.style[ee]=`${H()}px`,x&&x(ae)}),xe=se(v),te=se(ae=>{const Ce=H(),{duration:Ae,easing:Ne}=Tm({style:m,timeout:S,easing:a},{mode:"exit"});if(S==="auto"){const Ze=z.transitions.getAutoHeightDuration(Ce);ae.style.transitionDuration=`${Ze}ms`,D.current=Ze}else ae.style.transitionDuration=typeof Ae=="string"?Ae:`${Ae}ms`;ae.style[ee]=U,ae.style.transitionTimingFunction=Ne,C&&C(ae)}),ye=ae=>{S==="auto"&&(j.current=setTimeout(ae,D.current||0)),o&&o(le.current,ae)};return F.jsx(E,A({in:c,onEnter:ne,onEntered:oe,onEntering:G,onExit:Z,onExited:xe,onExiting:te,addEndListener:ye,nodeRef:le,timeout:S==="auto"?null:S},P,{children:(ae,Ce)=>F.jsx(oC,A({as:u,className:Ee(R.root,l,{entered:R.entered,exited:!c&&U==="0px"&&R.hidden}[ae]),style:A({[V?"minWidth":"minHeight"]:U},m),ownerState:A({},N,{state:ae}),ref:me},Ce,{children:F.jsx(iC,{ownerState:A({},N,{state:ae}),className:R.wrapper,ref:O,children:F.jsx(lC,{ownerState:A({},N,{state:ae}),className:R.wrapperInner,children:i})})}))}))});H1.muiSupportAuto=!0;const sC=H1;function aC(e){return Mt("MuiPaper",e)}$t("MuiPaper",["root","rounded","outlined","elevation","elevation0","elevation1","elevation2","elevation3","elevation4","elevation5","elevation6","elevation7","elevation8","elevation9","elevation10","elevation11","elevation12","elevation13","elevation14","elevation15","elevation16","elevation17","elevation18","elevation19","elevation20","elevation21","elevation22","elevation23","elevation24"]);const uC=["className","component","elevation","square","variant"],cC=e=>{const{square:t,elevation:n,variant:r,classes:o}=e,i={root:["root",r,!t&&"rounded",r==="elevation"&&`elevation${n}`]};return zt(i,aC,o)},fC=Ye("div",{name:"MuiPaper",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.variant],!n.square&&t.rounded,n.variant==="elevation"&&t[`elevation${n.elevation}`]]}})(({theme:e,ownerState:t})=>{var n;return A({backgroundColor:(e.vars||e).palette.background.paper,color:(e.vars||e).palette.text.primary,transition:e.transitions.create("box-shadow")},!t.square&&{borderRadius:e.shape.borderRadius},t.variant==="outlined"&&{border:`1px solid ${(e.vars||e).palette.divider}`},t.variant==="elevation"&&A({boxShadow:(e.vars||e).shadows[t.elevation]},!e.vars&&e.palette.mode==="dark"&&{backgroundImage:`linear-gradient(${Kn("#fff",bm(t.elevation))}, ${Kn("#fff",bm(t.elevation))})`},e.vars&&{backgroundImage:(n=e.vars.overlays)==null?void 0:n[t.elevation]}))}),dC=L.forwardRef(function(t,n){const r=kt({props:t,name:"MuiPaper"}),{className:o,component:i="div",elevation:l=1,square:s=!1,variant:u="elevation"}=r,a=$e(r,uC),c=A({},r,{component:i,elevation:l,square:s,variant:u}),p=cC(c);return F.jsx(fC,A({as:i,ownerState:c,className:Ee(p.root,o),ref:n},a))}),pC=dC;function hC(e){const{className:t,classes:n,pulsate:r=!1,rippleX:o,rippleY:i,rippleSize:l,in:s,onExited:u,timeout:a}=e,[c,p]=L.useState(!1),f=Ee(t,n.ripple,n.rippleVisible,r&&n.ripplePulsate),h={width:l,height:l,top:-(l/2)+i,left:-(l/2)+o},x=Ee(n.child,c&&n.childLeaving,r&&n.childPulsate);return!s&&!c&&p(!0),L.useEffect(()=>{if(!s&&u!=null){const v=setTimeout(u,a);return()=>{clearTimeout(v)}}},[u,s,a]),F.jsx("span",{className:f,style:h,children:F.jsx("span",{className:x})})}const mC=$t("MuiTouchRipple",["root","ripple","rippleVisible","ripplePulsate","child","childLeaving","childPulsate"]),Wn=mC,gC=["center","classes","className"];let yc=e=>e,Pm,Rm,Mm,$m;const $d=550,yC=80,vC=Gp(Pm||(Pm=yc` + 0% { + transform: scale(0); + opacity: 0.1; + } + + 100% { + transform: scale(1); + opacity: 0.3; + } +`)),xC=Gp(Rm||(Rm=yc` + 0% { + opacity: 1; + } + + 100% { + opacity: 0; + } +`)),wC=Gp(Mm||(Mm=yc` + 0% { + transform: scale(1); + } + + 50% { + transform: scale(0.92); + } + + 100% { + transform: scale(1); + } +`)),SC=Ye("span",{name:"MuiTouchRipple",slot:"Root"})({overflow:"hidden",pointerEvents:"none",position:"absolute",zIndex:0,top:0,right:0,bottom:0,left:0,borderRadius:"inherit"}),_C=Ye(hC,{name:"MuiTouchRipple",slot:"Ripple"})($m||($m=yc` + opacity: 0; + position: absolute; + + &.${0} { + opacity: 0.3; + transform: scale(1); + animation-name: ${0}; + animation-duration: ${0}ms; + animation-timing-function: ${0}; + } + + &.${0} { + animation-duration: ${0}ms; + } + + & .${0} { + opacity: 1; + display: block; + width: 100%; + height: 100%; + border-radius: 50%; + background-color: currentColor; + } + + & .${0} { + opacity: 0; + animation-name: ${0}; + animation-duration: ${0}ms; + animation-timing-function: ${0}; + } + + & .${0} { + position: absolute; + /* @noflip */ + left: 0px; + top: 0; + animation-name: ${0}; + animation-duration: 2500ms; + animation-timing-function: ${0}; + animation-iteration-count: infinite; + animation-delay: 200ms; + } +`),Wn.rippleVisible,vC,$d,({theme:e})=>e.transitions.easing.easeInOut,Wn.ripplePulsate,({theme:e})=>e.transitions.duration.shorter,Wn.child,Wn.childLeaving,xC,$d,({theme:e})=>e.transitions.easing.easeInOut,Wn.childPulsate,wC,({theme:e})=>e.transitions.easing.easeInOut),kC=L.forwardRef(function(t,n){const r=kt({props:t,name:"MuiTouchRipple"}),{center:o=!1,classes:i={},className:l}=r,s=$e(r,gC),[u,a]=L.useState([]),c=L.useRef(0),p=L.useRef(null);L.useEffect(()=>{p.current&&(p.current(),p.current=null)},[u]);const f=L.useRef(!1),h=L.useRef(0),x=L.useRef(null),v=L.useRef(null);L.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]);const C=L.useCallback(E=>{const{pulsate:P,rippleX:N,rippleY:R,rippleSize:z,cb:j}=E;a(O=>[...O,F.jsx(_C,{classes:{ripple:Ee(i.ripple,Wn.ripple),rippleVisible:Ee(i.rippleVisible,Wn.rippleVisible),ripplePulsate:Ee(i.ripplePulsate,Wn.ripplePulsate),child:Ee(i.child,Wn.child),childLeaving:Ee(i.childLeaving,Wn.childLeaving),childPulsate:Ee(i.childPulsate,Wn.childPulsate)},timeout:$d,pulsate:P,rippleX:N,rippleY:R,rippleSize:z},c.current)]),c.current+=1,p.current=j},[i]),w=L.useCallback((E={},P={},N=()=>{})=>{const{pulsate:R=!1,center:z=o||P.pulsate,fakeElement:j=!1}=P;if((E==null?void 0:E.type)==="mousedown"&&f.current){f.current=!1;return}(E==null?void 0:E.type)==="touchstart"&&(f.current=!0);const O=j?null:v.current,D=O?O.getBoundingClientRect():{width:0,height:0,left:0,top:0};let U,V,ee;if(z||E===void 0||E.clientX===0&&E.clientY===0||!E.clientX&&!E.touches)U=Math.round(D.width/2),V=Math.round(D.height/2);else{const{clientX:le,clientY:me}=E.touches&&E.touches.length>0?E.touches[0]:E;U=Math.round(le-D.left),V=Math.round(me-D.top)}if(z)ee=Math.sqrt((2*D.width**2+D.height**2)/3),ee%2===0&&(ee+=1);else{const le=Math.max(Math.abs((O?O.clientWidth:0)-U),U)*2+2,me=Math.max(Math.abs((O?O.clientHeight:0)-V),V)*2+2;ee=Math.sqrt(le**2+me**2)}E!=null&&E.touches?x.current===null&&(x.current=()=>{C({pulsate:R,rippleX:U,rippleY:V,rippleSize:ee,cb:N})},h.current=setTimeout(()=>{x.current&&(x.current(),x.current=null)},yC)):C({pulsate:R,rippleX:U,rippleY:V,rippleSize:ee,cb:N})},[o,C]),m=L.useCallback(()=>{w({},{pulsate:!0})},[w]),S=L.useCallback((E,P)=>{if(clearTimeout(h.current),(E==null?void 0:E.type)==="touchend"&&x.current){x.current(),x.current=null,h.current=setTimeout(()=>{S(E,P)});return}x.current=null,a(N=>N.length>0?N.slice(1):N),p.current=P},[]);return L.useImperativeHandle(n,()=>({pulsate:m,start:w,stop:S}),[m,w,S]),F.jsx(SC,A({className:Ee(Wn.root,i.root,l),ref:v},s,{children:F.jsx(eC,{component:null,exit:!0,children:u})}))}),bC=kC;function EC(e){return Mt("MuiButtonBase",e)}const CC=$t("MuiButtonBase",["root","disabled","focusVisible"]),TC=CC,PC=["action","centerRipple","children","className","component","disabled","disableRipple","disableTouchRipple","focusRipple","focusVisibleClassName","LinkComponent","onBlur","onClick","onContextMenu","onDragLeave","onFocus","onFocusVisible","onKeyDown","onKeyUp","onMouseDown","onMouseLeave","onMouseUp","onTouchEnd","onTouchMove","onTouchStart","tabIndex","TouchRippleProps","touchRippleRef","type"],RC=e=>{const{disabled:t,focusVisible:n,focusVisibleClassName:r,classes:o}=e,l=zt({root:["root",t&&"disabled",n&&"focusVisible"]},EC,o);return n&&r&&(l.root+=` ${r}`),l},MC=Ye("button",{name:"MuiButtonBase",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"inline-flex",alignItems:"center",justifyContent:"center",position:"relative",boxSizing:"border-box",WebkitTapHighlightColor:"transparent",backgroundColor:"transparent",outline:0,border:0,margin:0,borderRadius:0,padding:0,cursor:"pointer",userSelect:"none",verticalAlign:"middle",MozAppearance:"none",WebkitAppearance:"none",textDecoration:"none",color:"inherit","&::-moz-focus-inner":{borderStyle:"none"},[`&.${TC.disabled}`]:{pointerEvents:"none",cursor:"default"},"@media print":{colorAdjust:"exact"}}),$C=L.forwardRef(function(t,n){const r=kt({props:t,name:"MuiButtonBase"}),{action:o,centerRipple:i=!1,children:l,className:s,component:u="button",disabled:a=!1,disableRipple:c=!1,disableTouchRipple:p=!1,focusRipple:f=!1,LinkComponent:h="a",onBlur:x,onClick:v,onContextMenu:C,onDragLeave:w,onFocus:m,onFocusVisible:S,onKeyDown:E,onKeyUp:P,onMouseDown:N,onMouseLeave:R,onMouseUp:z,onTouchEnd:j,onTouchMove:O,onTouchStart:D,tabIndex:U=0,TouchRippleProps:V,touchRippleRef:ee,type:le}=r,me=$e(r,PC),se=L.useRef(null),H=L.useRef(null),ne=su(H,ee),{isFocusVisibleRef:G,onFocus:oe,onBlur:Z,ref:xe}=Ak(),[te,ye]=L.useState(!1);a&&te&&ye(!1),L.useImperativeHandle(o,()=>({focusVisible:()=>{ye(!0),se.current.focus()}}),[]);const[ae,Ce]=L.useState(!1);L.useEffect(()=>{Ce(!0)},[]);const Ae=ae&&!c&&!a;L.useEffect(()=>{te&&f&&!c&&ae&&H.current.pulsate()},[c,f,te,ae]);function Ne(M,B,Q=p){return Ao(de=>(B&&B(de),!Q&&H.current&&H.current[M](de),!0))}const Ze=Ne("start",N),ht=Ne("stop",C),cn=Ne("stop",w),cr=Ne("stop",z),fn=Ne("stop",M=>{te&&M.preventDefault(),R&&R(M)}),Zn=Ne("start",D),Cn=Ne("stop",j),wt=Ne("stop",O),Je=Ne("stop",M=>{Z(M),G.current===!1&&ye(!1),x&&x(M)},!1),he=Ao(M=>{se.current||(se.current=M.currentTarget),oe(M),G.current===!0&&(ye(!0),S&&S(M)),m&&m(M)}),mt=()=>{const M=se.current;return u&&u!=="button"&&!(M.tagName==="A"&&M.href)},At=L.useRef(!1),_e=Ao(M=>{f&&!At.current&&te&&H.current&&M.key===" "&&(At.current=!0,H.current.stop(M,()=>{H.current.start(M)})),M.target===M.currentTarget&&mt()&&M.key===" "&&M.preventDefault(),E&&E(M),M.target===M.currentTarget&&mt()&&M.key==="Enter"&&!a&&(M.preventDefault(),v&&v(M))}),ce=Ao(M=>{f&&M.key===" "&&H.current&&te&&!M.defaultPrevented&&(At.current=!1,H.current.stop(M,()=>{H.current.pulsate(M)})),P&&P(M),v&&M.target===M.currentTarget&&mt()&&M.key===" "&&!M.defaultPrevented&&v(M)});let Oe=u;Oe==="button"&&(me.href||me.to)&&(Oe=h);const Ue={};Oe==="button"?(Ue.type=le===void 0?"button":le,Ue.disabled=a):(!me.href&&!me.to&&(Ue.role="button"),a&&(Ue["aria-disabled"]=a));const g=su(n,xe,se),k=A({},r,{centerRipple:i,component:u,disabled:a,disableRipple:c,disableTouchRipple:p,focusRipple:f,tabIndex:U,focusVisible:te}),T=RC(k);return F.jsxs(MC,A({as:Oe,className:Ee(T.root,s),ownerState:k,onBlur:Je,onClick:v,onContextMenu:ht,onFocus:he,onKeyDown:_e,onKeyUp:ce,onMouseDown:Ze,onMouseLeave:fn,onMouseUp:cr,onDragLeave:cn,onTouchEnd:Cn,onTouchMove:wt,onTouchStart:Zn,ref:g,tabIndex:a?-1:U,type:le},Ue,me,{children:[l,Ae?F.jsx(bC,A({ref:ne,center:i},V)):null]}))}),vc=$C;function NC(e){return Mt("MuiIconButton",e)}const OC=$t("MuiIconButton",["root","disabled","colorInherit","colorPrimary","colorSecondary","colorError","colorInfo","colorSuccess","colorWarning","edgeStart","edgeEnd","sizeSmall","sizeMedium","sizeLarge"]),zC=OC,LC=["edge","children","className","color","disabled","disableFocusRipple","size"],AC=e=>{const{classes:t,disabled:n,color:r,edge:o,size:i}=e,l={root:["root",n&&"disabled",r!=="default"&&`color${be(r)}`,o&&`edge${be(o)}`,`size${be(i)}`]};return zt(l,NC,t)},IC=Ye(vc,{name:"MuiIconButton",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.color!=="default"&&t[`color${be(n.color)}`],n.edge&&t[`edge${be(n.edge)}`],t[`size${be(n.size)}`]]}})(({theme:e,ownerState:t})=>A({textAlign:"center",flex:"0 0 auto",fontSize:e.typography.pxToRem(24),padding:8,borderRadius:"50%",overflow:"visible",color:(e.vars||e).palette.action.active,transition:e.transitions.create("background-color",{duration:e.transitions.duration.shortest})},!t.disableRipple&&{"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:Kn(e.palette.action.active,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}}},t.edge==="start"&&{marginLeft:t.size==="small"?-3:-12},t.edge==="end"&&{marginRight:t.size==="small"?-3:-12}),({theme:e,ownerState:t})=>{var n;const r=(n=(e.vars||e).palette)==null?void 0:n[t.color];return A({},t.color==="inherit"&&{color:"inherit"},t.color!=="inherit"&&t.color!=="default"&&A({color:r==null?void 0:r.main},!t.disableRipple&&{"&:hover":A({},r&&{backgroundColor:e.vars?`rgba(${r.mainChannel} / ${e.vars.palette.action.hoverOpacity})`:Kn(r.main,e.palette.action.hoverOpacity)},{"@media (hover: none)":{backgroundColor:"transparent"}})}),t.size==="small"&&{padding:5,fontSize:e.typography.pxToRem(18)},t.size==="large"&&{padding:12,fontSize:e.typography.pxToRem(28)},{[`&.${zC.disabled}`]:{backgroundColor:"transparent",color:(e.vars||e).palette.action.disabled}})}),DC=L.forwardRef(function(t,n){const r=kt({props:t,name:"MuiIconButton"}),{edge:o=!1,children:i,className:l,color:s="default",disabled:u=!1,disableFocusRipple:a=!1,size:c="medium"}=r,p=$e(r,LC),f=A({},r,{edge:o,color:s,disabled:u,disableFocusRipple:a,size:c}),h=AC(f);return F.jsx(IC,A({className:Ee(h.root,l),centerRipple:!0,focusRipple:!a,disabled:u,ref:n,ownerState:f},p,{children:i}))}),BC=DC;function FC(e){return Mt("MuiTypography",e)}$t("MuiTypography",["root","h1","h2","h3","h4","h5","h6","subtitle1","subtitle2","body1","body2","inherit","button","caption","overline","alignLeft","alignRight","alignCenter","alignJustify","noWrap","gutterBottom","paragraph"]);const jC=["align","className","component","gutterBottom","noWrap","paragraph","variant","variantMapping"],WC=e=>{const{align:t,gutterBottom:n,noWrap:r,paragraph:o,variant:i,classes:l}=e,s={root:["root",i,e.align!=="inherit"&&`align${be(t)}`,n&&"gutterBottom",r&&"noWrap",o&&"paragraph"]};return zt(s,FC,l)},HC=Ye("span",{name:"MuiTypography",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.variant&&t[n.variant],n.align!=="inherit"&&t[`align${be(n.align)}`],n.noWrap&&t.noWrap,n.gutterBottom&&t.gutterBottom,n.paragraph&&t.paragraph]}})(({theme:e,ownerState:t})=>A({margin:0},t.variant==="inherit"&&{font:"inherit"},t.variant!=="inherit"&&e.typography[t.variant],t.align!=="inherit"&&{textAlign:t.align},t.noWrap&&{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},t.gutterBottom&&{marginBottom:"0.35em"},t.paragraph&&{marginBottom:16})),Nm={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",subtitle1:"h6",subtitle2:"h6",body1:"p",body2:"p",inherit:"p"},UC={primary:"primary.main",textPrimary:"text.primary",secondary:"secondary.main",textSecondary:"text.secondary",error:"error.main"},VC=e=>UC[e]||e,KC=L.forwardRef(function(t,n){const r=kt({props:t,name:"MuiTypography"}),o=VC(r.color),i=eh(A({},r,{color:o})),{align:l="inherit",className:s,component:u,gutterBottom:a=!1,noWrap:c=!1,paragraph:p=!1,variant:f="body1",variantMapping:h=Nm}=i,x=$e(i,jC),v=A({},i,{align:l,color:o,className:s,component:u,gutterBottom:a,noWrap:c,paragraph:p,variant:f,variantMapping:h}),C=u||(p?"p":h[f]||Nm[f])||"span",w=WC(v);return F.jsx(HC,A({as:C,ref:n,ownerState:v,className:Ee(w.root,s)},x))}),Ri=KC;function GC(e){return Mt("MuiAppBar",e)}$t("MuiAppBar",["root","positionFixed","positionAbsolute","positionSticky","positionStatic","positionRelative","colorDefault","colorPrimary","colorSecondary","colorInherit","colorTransparent"]);const YC=["className","color","enableColorOnDark","position"],qC=e=>{const{color:t,position:n,classes:r}=e,o={root:["root",`color${be(t)}`,`position${be(n)}`]};return zt(o,GC,r)},fa=(e,t)=>e?`${e==null?void 0:e.replace(")","")}, ${t})`:t,QC=Ye(pC,{name:"MuiAppBar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`position${be(n.position)}`],t[`color${be(n.color)}`]]}})(({theme:e,ownerState:t})=>{const n=e.palette.mode==="light"?e.palette.grey[100]:e.palette.grey[900];return A({display:"flex",flexDirection:"column",width:"100%",boxSizing:"border-box",flexShrink:0},t.position==="fixed"&&{position:"fixed",zIndex:(e.vars||e).zIndex.appBar,top:0,left:"auto",right:0,"@media print":{position:"absolute"}},t.position==="absolute"&&{position:"absolute",zIndex:(e.vars||e).zIndex.appBar,top:0,left:"auto",right:0},t.position==="sticky"&&{position:"sticky",zIndex:(e.vars||e).zIndex.appBar,top:0,left:"auto",right:0},t.position==="static"&&{position:"static"},t.position==="relative"&&{position:"relative"},!e.vars&&A({},t.color==="default"&&{backgroundColor:n,color:e.palette.getContrastText(n)},t.color&&t.color!=="default"&&t.color!=="inherit"&&t.color!=="transparent"&&{backgroundColor:e.palette[t.color].main,color:e.palette[t.color].contrastText},t.color==="inherit"&&{color:"inherit"},e.palette.mode==="dark"&&!t.enableColorOnDark&&{backgroundColor:null,color:null},t.color==="transparent"&&A({backgroundColor:"transparent",color:"inherit"},e.palette.mode==="dark"&&{backgroundImage:"none"})),e.vars&&A({},t.color==="default"&&{"--AppBar-background":t.enableColorOnDark?e.vars.palette.AppBar.defaultBg:fa(e.vars.palette.AppBar.darkBg,e.vars.palette.AppBar.defaultBg),"--AppBar-color":t.enableColorOnDark?e.vars.palette.text.primary:fa(e.vars.palette.AppBar.darkColor,e.vars.palette.text.primary)},t.color&&!t.color.match(/^(default|inherit|transparent)$/)&&{"--AppBar-background":t.enableColorOnDark?e.vars.palette[t.color].main:fa(e.vars.palette.AppBar.darkBg,e.vars.palette[t.color].main),"--AppBar-color":t.enableColorOnDark?e.vars.palette[t.color].contrastText:fa(e.vars.palette.AppBar.darkColor,e.vars.palette[t.color].contrastText)},{backgroundColor:"var(--AppBar-background)",color:t.color==="inherit"?"inherit":"var(--AppBar-color)"},t.color==="transparent"&&{backgroundImage:"none",backgroundColor:"transparent",color:"inherit"}))}),XC=L.forwardRef(function(t,n){const r=kt({props:t,name:"MuiAppBar"}),{className:o,color:i="primary",enableColorOnDark:l=!1,position:s="fixed"}=r,u=$e(r,YC),a=A({},r,{color:i,position:s,enableColorOnDark:l}),c=qC(a);return F.jsx(QC,A({square:!0,component:"header",ownerState:a,elevation:4,className:Ee(c.root,o,s==="fixed"&&"mui-fixed"),ref:n},u))}),ZC=XC;function JC(e){return typeof e=="string"}function eT(e,t,n){return e===void 0||JC(e)?t:A({},t,{ownerState:A({},t.ownerState,n)})}function tT(e,t=[]){if(e===void 0)return{};const n={};return Object.keys(e).filter(r=>r.match(/^on[A-Z]/)&&typeof e[r]=="function"&&!t.includes(r)).forEach(r=>{n[r]=e[r]}),n}function nT(e,t,n){return typeof e=="function"?e(t,n):e}function Om(e){if(e===void 0)return{};const t={};return Object.keys(e).filter(n=>!(n.match(/^on[A-Z]/)&&typeof e[n]=="function")).forEach(n=>{t[n]=e[n]}),t}function rT(e){const{getSlotProps:t,additionalProps:n,externalSlotProps:r,externalForwardedProps:o,className:i}=e;if(!t){const h=Ee(o==null?void 0:o.className,r==null?void 0:r.className,i,n==null?void 0:n.className),x=A({},n==null?void 0:n.style,o==null?void 0:o.style,r==null?void 0:r.style),v=A({},n,o,r);return h.length>0&&(v.className=h),Object.keys(x).length>0&&(v.style=x),{props:v,internalRef:void 0}}const l=tT(A({},o,r)),s=Om(r),u=Om(o),a=t(l),c=Ee(a==null?void 0:a.className,n==null?void 0:n.className,i,o==null?void 0:o.className,r==null?void 0:r.className),p=A({},a==null?void 0:a.style,n==null?void 0:n.style,o==null?void 0:o.style,r==null?void 0:r.style),f=A({},a,n,u,s);return c.length>0&&(f.className=c),Object.keys(p).length>0&&(f.style=p),{props:f,internalRef:a.ref}}const oT=["elementType","externalSlotProps","ownerState","skipResolvingSlotProps"];function du(e){var t;const{elementType:n,externalSlotProps:r,ownerState:o,skipResolvingSlotProps:i=!1}=e,l=$e(e,oT),s=i?{}:nT(r,o),{props:u,internalRef:a}=rT(A({},l,{externalSlotProps:s})),c=su(a,s==null?void 0:s.ref,(t=e.additionalProps)==null?void 0:t.ref);return eT(n,A({},u,{ref:c}),o)}function iT(e){return F.jsx(j2,A({},e,{defaultTheme:gc,themeId:Go}))}const lT=cu(),sT=V2({themeId:Go,defaultTheme:lT,defaultClassName:"MuiBox-root",generateClassName:a1.generate}),pu=sT;function aT(e){return Mt("MuiButton",e)}const uT=$t("MuiButton",["root","text","textInherit","textPrimary","textSecondary","textSuccess","textError","textInfo","textWarning","outlined","outlinedInherit","outlinedPrimary","outlinedSecondary","outlinedSuccess","outlinedError","outlinedInfo","outlinedWarning","contained","containedInherit","containedPrimary","containedSecondary","containedSuccess","containedError","containedInfo","containedWarning","disableElevation","focusVisible","disabled","colorInherit","textSizeSmall","textSizeMedium","textSizeLarge","outlinedSizeSmall","outlinedSizeMedium","outlinedSizeLarge","containedSizeSmall","containedSizeMedium","containedSizeLarge","sizeMedium","sizeSmall","sizeLarge","fullWidth","startIcon","endIcon","iconSizeSmall","iconSizeMedium","iconSizeLarge"]),da=uT,cT=L.createContext({}),fT=cT,dT=["children","color","component","className","disabled","disableElevation","disableFocusRipple","endIcon","focusVisibleClassName","fullWidth","size","startIcon","type","variant"],pT=e=>{const{color:t,disableElevation:n,fullWidth:r,size:o,variant:i,classes:l}=e,s={root:["root",i,`${i}${be(t)}`,`size${be(o)}`,`${i}Size${be(o)}`,t==="inherit"&&"colorInherit",n&&"disableElevation",r&&"fullWidth"],label:["label"],startIcon:["startIcon",`iconSize${be(o)}`],endIcon:["endIcon",`iconSize${be(o)}`]},u=zt(s,aT,l);return A({},l,u)},U1=e=>A({},e.size==="small"&&{"& > *:nth-of-type(1)":{fontSize:18}},e.size==="medium"&&{"& > *:nth-of-type(1)":{fontSize:20}},e.size==="large"&&{"& > *:nth-of-type(1)":{fontSize:22}}),hT=Ye(vc,{shouldForwardProp:e=>B1(e)||e==="classes",name:"MuiButton",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.variant],t[`${n.variant}${be(n.color)}`],t[`size${be(n.size)}`],t[`${n.variant}Size${be(n.size)}`],n.color==="inherit"&&t.colorInherit,n.disableElevation&&t.disableElevation,n.fullWidth&&t.fullWidth]}})(({theme:e,ownerState:t})=>{var n,r;const o=e.palette.mode==="light"?e.palette.grey[300]:e.palette.grey[800],i=e.palette.mode==="light"?e.palette.grey.A100:e.palette.grey[700];return A({},e.typography.button,{minWidth:64,padding:"6px 16px",borderRadius:(e.vars||e).shape.borderRadius,transition:e.transitions.create(["background-color","box-shadow","border-color","color"],{duration:e.transitions.duration.short}),"&:hover":A({textDecoration:"none",backgroundColor:e.vars?`rgba(${e.vars.palette.text.primaryChannel} / ${e.vars.palette.action.hoverOpacity})`:Kn(e.palette.text.primary,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},t.variant==="text"&&t.color!=="inherit"&&{backgroundColor:e.vars?`rgba(${e.vars.palette[t.color].mainChannel} / ${e.vars.palette.action.hoverOpacity})`:Kn(e.palette[t.color].main,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},t.variant==="outlined"&&t.color!=="inherit"&&{border:`1px solid ${(e.vars||e).palette[t.color].main}`,backgroundColor:e.vars?`rgba(${e.vars.palette[t.color].mainChannel} / ${e.vars.palette.action.hoverOpacity})`:Kn(e.palette[t.color].main,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},t.variant==="contained"&&{backgroundColor:e.vars?e.vars.palette.Button.inheritContainedHoverBg:i,boxShadow:(e.vars||e).shadows[4],"@media (hover: none)":{boxShadow:(e.vars||e).shadows[2],backgroundColor:(e.vars||e).palette.grey[300]}},t.variant==="contained"&&t.color!=="inherit"&&{backgroundColor:(e.vars||e).palette[t.color].dark,"@media (hover: none)":{backgroundColor:(e.vars||e).palette[t.color].main}}),"&:active":A({},t.variant==="contained"&&{boxShadow:(e.vars||e).shadows[8]}),[`&.${da.focusVisible}`]:A({},t.variant==="contained"&&{boxShadow:(e.vars||e).shadows[6]}),[`&.${da.disabled}`]:A({color:(e.vars||e).palette.action.disabled},t.variant==="outlined"&&{border:`1px solid ${(e.vars||e).palette.action.disabledBackground}`},t.variant==="contained"&&{color:(e.vars||e).palette.action.disabled,boxShadow:(e.vars||e).shadows[0],backgroundColor:(e.vars||e).palette.action.disabledBackground})},t.variant==="text"&&{padding:"6px 8px"},t.variant==="text"&&t.color!=="inherit"&&{color:(e.vars||e).palette[t.color].main},t.variant==="outlined"&&{padding:"5px 15px",border:"1px solid currentColor"},t.variant==="outlined"&&t.color!=="inherit"&&{color:(e.vars||e).palette[t.color].main,border:e.vars?`1px solid rgba(${e.vars.palette[t.color].mainChannel} / 0.5)`:`1px solid ${Kn(e.palette[t.color].main,.5)}`},t.variant==="contained"&&{color:e.vars?e.vars.palette.text.primary:(n=(r=e.palette).getContrastText)==null?void 0:n.call(r,e.palette.grey[300]),backgroundColor:e.vars?e.vars.palette.Button.inheritContainedBg:o,boxShadow:(e.vars||e).shadows[2]},t.variant==="contained"&&t.color!=="inherit"&&{color:(e.vars||e).palette[t.color].contrastText,backgroundColor:(e.vars||e).palette[t.color].main},t.color==="inherit"&&{color:"inherit",borderColor:"currentColor"},t.size==="small"&&t.variant==="text"&&{padding:"4px 5px",fontSize:e.typography.pxToRem(13)},t.size==="large"&&t.variant==="text"&&{padding:"8px 11px",fontSize:e.typography.pxToRem(15)},t.size==="small"&&t.variant==="outlined"&&{padding:"3px 9px",fontSize:e.typography.pxToRem(13)},t.size==="large"&&t.variant==="outlined"&&{padding:"7px 21px",fontSize:e.typography.pxToRem(15)},t.size==="small"&&t.variant==="contained"&&{padding:"4px 10px",fontSize:e.typography.pxToRem(13)},t.size==="large"&&t.variant==="contained"&&{padding:"8px 22px",fontSize:e.typography.pxToRem(15)},t.fullWidth&&{width:"100%"})},({ownerState:e})=>e.disableElevation&&{boxShadow:"none","&:hover":{boxShadow:"none"},[`&.${da.focusVisible}`]:{boxShadow:"none"},"&:active":{boxShadow:"none"},[`&.${da.disabled}`]:{boxShadow:"none"}}),mT=Ye("span",{name:"MuiButton",slot:"StartIcon",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.startIcon,t[`iconSize${be(n.size)}`]]}})(({ownerState:e})=>A({display:"inherit",marginRight:8,marginLeft:-4},e.size==="small"&&{marginLeft:-2},U1(e))),gT=Ye("span",{name:"MuiButton",slot:"EndIcon",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.endIcon,t[`iconSize${be(n.size)}`]]}})(({ownerState:e})=>A({display:"inherit",marginRight:-4,marginLeft:8},e.size==="small"&&{marginRight:-2},U1(e))),yT=L.forwardRef(function(t,n){const r=L.useContext(fT),o=Bp(r,t),i=kt({props:o,name:"MuiButton"}),{children:l,color:s="primary",component:u="button",className:a,disabled:c=!1,disableElevation:p=!1,disableFocusRipple:f=!1,endIcon:h,focusVisibleClassName:x,fullWidth:v=!1,size:C="medium",startIcon:w,type:m,variant:S="text"}=i,E=$e(i,dT),P=A({},i,{color:s,component:u,disabled:c,disableElevation:p,disableFocusRipple:f,fullWidth:v,size:C,type:m,variant:S}),N=pT(P),R=w&&F.jsx(mT,{className:N.startIcon,ownerState:P,children:w}),z=h&&F.jsx(gT,{className:N.endIcon,ownerState:P,children:h});return F.jsxs(hT,A({ownerState:P,className:Ee(r.className,N.root,a),component:u,disabled:c,focusRipple:!f,focusVisibleClassName:Ee(N.focusVisible,x),ref:n,type:m},E,{classes:N,children:[R,l,z]}))}),vT=yT,xT=(e,t)=>A({WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale",boxSizing:"border-box",WebkitTextSizeAdjust:"100%"},t&&!e.vars&&{colorScheme:e.palette.mode}),wT=e=>A({color:(e.vars||e).palette.text.primary},e.typography.body1,{backgroundColor:(e.vars||e).palette.background.default,"@media print":{backgroundColor:(e.vars||e).palette.common.white}}),ST=(e,t=!1)=>{var n;const r={};t&&e.colorSchemes&&Object.entries(e.colorSchemes).forEach(([l,s])=>{var u;r[e.getColorSchemeSelector(l).replace(/\s*&/,"")]={colorScheme:(u=s.palette)==null?void 0:u.mode}});let o=A({html:xT(e,t),"*, *::before, *::after":{boxSizing:"inherit"},"strong, b":{fontWeight:e.typography.fontWeightBold},body:A({margin:0},wT(e),{"&::backdrop":{backgroundColor:(e.vars||e).palette.background.default}})},r);const i=(n=e.components)==null||(n=n.MuiCssBaseline)==null?void 0:n.styleOverrides;return i&&(o=[o,i]),o};function _T(e){const t=kt({props:e,name:"MuiCssBaseline"}),{children:n,enableColorScheme:r=!1}=t;return F.jsxs(L.Fragment,{children:[F.jsx(iT,{styles:o=>ST(o,r)}),n]})}const kT=L.createContext(),zm=kT;function bT(e){return Mt("MuiGrid",e)}const ET=[0,1,2,3,4,5,6,7,8,9,10],CT=["column-reverse","column","row-reverse","row"],TT=["nowrap","wrap-reverse","wrap"],Nl=["auto",!0,1,2,3,4,5,6,7,8,9,10,11,12],_s=$t("MuiGrid",["root","container","item","zeroMinWidth",...ET.map(e=>`spacing-xs-${e}`),...CT.map(e=>`direction-xs-${e}`),...TT.map(e=>`wrap-xs-${e}`),...Nl.map(e=>`grid-xs-${e}`),...Nl.map(e=>`grid-sm-${e}`),...Nl.map(e=>`grid-md-${e}`),...Nl.map(e=>`grid-lg-${e}`),...Nl.map(e=>`grid-xl-${e}`)]),PT=["className","columns","columnSpacing","component","container","direction","item","rowSpacing","spacing","wrap","zeroMinWidth"];function Di(e){const t=parseFloat(e);return`${t}${String(e).replace(String(t),"")||"px"}`}function RT({theme:e,ownerState:t}){let n;return e.breakpoints.keys.reduce((r,o)=>{let i={};if(t[o]&&(n=t[o]),!n)return r;if(n===!0)i={flexBasis:0,flexGrow:1,maxWidth:"100%"};else if(n==="auto")i={flexBasis:"auto",flexGrow:0,flexShrink:0,maxWidth:"none",width:"auto"};else{const l=ic({values:t.columns,breakpoints:e.breakpoints.values}),s=typeof l=="object"?l[o]:l;if(s==null)return r;const u=`${Math.round(n/s*1e8)/1e6}%`;let a={};if(t.container&&t.item&&t.columnSpacing!==0){const c=e.spacing(t.columnSpacing);if(c!=="0px"){const p=`calc(${u} + ${Di(c)})`;a={flexBasis:p,maxWidth:p}}}i=A({flexBasis:u,flexGrow:0,maxWidth:u},a)}return e.breakpoints.values[o]===0?Object.assign(r,i):r[e.breakpoints.up(o)]=i,r},{})}function MT({theme:e,ownerState:t}){const n=ic({values:t.direction,breakpoints:e.breakpoints.values});return Qn({theme:e},n,r=>{const o={flexDirection:r};return r.indexOf("column")===0&&(o[`& > .${_s.item}`]={maxWidth:"none"}),o})}function V1({breakpoints:e,values:t}){let n="";Object.keys(t).forEach(o=>{n===""&&t[o]!==0&&(n=o)});const r=Object.keys(e).sort((o,i)=>e[o]-e[i]);return r.slice(0,r.indexOf(n))}function $T({theme:e,ownerState:t}){const{container:n,rowSpacing:r}=t;let o={};if(n&&r!==0){const i=ic({values:r,breakpoints:e.breakpoints.values});let l;typeof i=="object"&&(l=V1({breakpoints:e.breakpoints.values,values:i})),o=Qn({theme:e},i,(s,u)=>{var a;const c=e.spacing(s);return c!=="0px"?{marginTop:`-${Di(c)}`,[`& > .${_s.item}`]:{paddingTop:Di(c)}}:(a=l)!=null&&a.includes(u)?{}:{marginTop:0,[`& > .${_s.item}`]:{paddingTop:0}}})}return o}function NT({theme:e,ownerState:t}){const{container:n,columnSpacing:r}=t;let o={};if(n&&r!==0){const i=ic({values:r,breakpoints:e.breakpoints.values});let l;typeof i=="object"&&(l=V1({breakpoints:e.breakpoints.values,values:i})),o=Qn({theme:e},i,(s,u)=>{var a;const c=e.spacing(s);return c!=="0px"?{width:`calc(100% + ${Di(c)})`,marginLeft:`-${Di(c)}`,[`& > .${_s.item}`]:{paddingLeft:Di(c)}}:(a=l)!=null&&a.includes(u)?{}:{width:"100%",marginLeft:0,[`& > .${_s.item}`]:{paddingLeft:0}}})}return o}function OT(e,t,n={}){if(!e||e<=0)return[];if(typeof e=="string"&&!Number.isNaN(Number(e))||typeof e=="number")return[n[`spacing-xs-${String(e)}`]];const r=[];return t.forEach(o=>{const i=e[o];Number(i)>0&&r.push(n[`spacing-${o}-${String(i)}`])}),r}const zT=Ye("div",{name:"MuiGrid",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e,{container:r,direction:o,item:i,spacing:l,wrap:s,zeroMinWidth:u,breakpoints:a}=n;let c=[];r&&(c=OT(l,a,t));const p=[];return a.forEach(f=>{const h=n[f];h&&p.push(t[`grid-${f}-${String(h)}`])}),[t.root,r&&t.container,i&&t.item,u&&t.zeroMinWidth,...c,o!=="row"&&t[`direction-xs-${String(o)}`],s!=="wrap"&&t[`wrap-xs-${String(s)}`],...p]}})(({ownerState:e})=>A({boxSizing:"border-box"},e.container&&{display:"flex",flexWrap:"wrap",width:"100%"},e.item&&{margin:0},e.zeroMinWidth&&{minWidth:0},e.wrap!=="wrap"&&{flexWrap:e.wrap}),MT,$T,NT,RT);function LT(e,t){if(!e||e<=0)return[];if(typeof e=="string"&&!Number.isNaN(Number(e))||typeof e=="number")return[`spacing-xs-${String(e)}`];const n=[];return t.forEach(r=>{const o=e[r];if(Number(o)>0){const i=`spacing-${r}-${String(o)}`;n.push(i)}}),n}const AT=e=>{const{classes:t,container:n,direction:r,item:o,spacing:i,wrap:l,zeroMinWidth:s,breakpoints:u}=e;let a=[];n&&(a=LT(i,u));const c=[];u.forEach(f=>{const h=e[f];h&&c.push(`grid-${f}-${String(h)}`)});const p={root:["root",n&&"container",o&&"item",s&&"zeroMinWidth",...a,r!=="row"&&`direction-xs-${String(r)}`,l!=="wrap"&&`wrap-xs-${String(l)}`,...c]};return zt(p,bT,t)},IT=L.forwardRef(function(t,n){const r=kt({props:t,name:"MuiGrid"}),{breakpoints:o}=mo(),i=eh(r),{className:l,columns:s,columnSpacing:u,component:a="div",container:c=!1,direction:p="row",item:f=!1,rowSpacing:h,spacing:x=0,wrap:v="wrap",zeroMinWidth:C=!1}=i,w=$e(i,PT),m=h||x,S=u||x,E=L.useContext(zm),P=c?s||12:E,N={},R=A({},w);o.keys.forEach(O=>{w[O]!=null&&(N[O]=w[O],delete R[O])});const z=A({},i,{columns:P,container:c,direction:p,item:f,rowSpacing:m,columnSpacing:S,wrap:v,zeroMinWidth:C,spacing:x},N,{breakpoints:o.keys}),j=AT(z);return F.jsx(zm.Provider,{value:P,children:F.jsx(zT,A({ownerState:z,className:Ee(j.root,l),as:a,ref:n},R))})}),xc=IT;function DT(e,t,n,r,o){const[i,l]=L.useState(()=>o&&n?n(e).matches:r?r(e).matches:t);return Dp(()=>{let s=!0;if(!n)return;const u=n(e),a=()=>{s&&l(u.matches)};return a(),u.addListener(a),()=>{s=!1,u.removeListener(a)}},[e,n]),i}const K1=$f["useSyncExternalStore"];function BT(e,t,n,r,o){const i=L.useCallback(()=>t,[t]),l=L.useMemo(()=>{if(o&&n)return()=>n(e).matches;if(r!==null){const{matches:c}=r(e);return()=>c}return i},[i,e,r,o,n]),[s,u]=L.useMemo(()=>{if(n===null)return[i,()=>()=>{}];const c=n(e);return[()=>c.matches,p=>(c.addListener(p),()=>{c.removeListener(p)})]},[i,n,e]);return K1(u,s,l)}function FT(e,t={}){const n=Jp(),r=typeof window<"u"&&typeof window.matchMedia<"u",{defaultMatches:o=!1,matchMedia:i=r?window.matchMedia:null,ssrMatchMedia:l=null,noSsr:s=!1}=O1({name:"MuiUseMediaQuery",props:t,theme:n});let u=typeof e=="function"?e(n):e;return u=u.replace(/^@media( ?)/m,""),(K1!==void 0?BT:DT)(u,o,i,l,s)}function jT(e){return Mt("MuiTab",e)}const WT=$t("MuiTab",["root","labelIcon","textColorInherit","textColorPrimary","textColorSecondary","selected","disabled","fullWidth","wrapped","iconWrapper"]),xo=WT,HT=["className","disabled","disableFocusRipple","fullWidth","icon","iconPosition","indicator","label","onChange","onClick","onFocus","selected","selectionFollowsFocus","textColor","value","wrapped"],UT=e=>{const{classes:t,textColor:n,fullWidth:r,wrapped:o,icon:i,label:l,selected:s,disabled:u}=e,a={root:["root",i&&l&&"labelIcon",`textColor${be(n)}`,r&&"fullWidth",o&&"wrapped",s&&"selected",u&&"disabled"],iconWrapper:["iconWrapper"]};return zt(a,jT,t)},VT=Ye(vc,{name:"MuiTab",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.label&&n.icon&&t.labelIcon,t[`textColor${be(n.textColor)}`],n.fullWidth&&t.fullWidth,n.wrapped&&t.wrapped]}})(({theme:e,ownerState:t})=>A({},e.typography.button,{maxWidth:360,minWidth:90,position:"relative",minHeight:48,flexShrink:0,padding:"12px 16px",overflow:"hidden",whiteSpace:"normal",textAlign:"center"},t.label&&{flexDirection:t.iconPosition==="top"||t.iconPosition==="bottom"?"column":"row"},{lineHeight:1.25},t.icon&&t.label&&{minHeight:72,paddingTop:9,paddingBottom:9,[`& > .${xo.iconWrapper}`]:A({},t.iconPosition==="top"&&{marginBottom:6},t.iconPosition==="bottom"&&{marginTop:6},t.iconPosition==="start"&&{marginRight:e.spacing(1)},t.iconPosition==="end"&&{marginLeft:e.spacing(1)})},t.textColor==="inherit"&&{color:"inherit",opacity:.6,[`&.${xo.selected}`]:{opacity:1},[`&.${xo.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity}},t.textColor==="primary"&&{color:(e.vars||e).palette.text.secondary,[`&.${xo.selected}`]:{color:(e.vars||e).palette.primary.main},[`&.${xo.disabled}`]:{color:(e.vars||e).palette.text.disabled}},t.textColor==="secondary"&&{color:(e.vars||e).palette.text.secondary,[`&.${xo.selected}`]:{color:(e.vars||e).palette.secondary.main},[`&.${xo.disabled}`]:{color:(e.vars||e).palette.text.disabled}},t.fullWidth&&{flexShrink:1,flexGrow:1,flexBasis:0,maxWidth:"none"},t.wrapped&&{fontSize:e.typography.pxToRem(12)})),KT=L.forwardRef(function(t,n){const r=kt({props:t,name:"MuiTab"}),{className:o,disabled:i=!1,disableFocusRipple:l=!1,fullWidth:s,icon:u,iconPosition:a="top",indicator:c,label:p,onChange:f,onClick:h,onFocus:x,selected:v,selectionFollowsFocus:C,textColor:w="inherit",value:m,wrapped:S=!1}=r,E=$e(r,HT),P=A({},r,{disabled:i,disableFocusRipple:l,selected:v,icon:!!u,iconPosition:a,label:!!p,fullWidth:s,textColor:w,wrapped:S}),N=UT(P),R=u&&p&&L.isValidElement(u)?L.cloneElement(u,{className:Ee(N.iconWrapper,u.props.className)}):u,z=O=>{!v&&f&&f(O,m),h&&h(O)},j=O=>{C&&!v&&f&&f(O,m),x&&x(O)};return F.jsxs(VT,A({focusRipple:!l,className:Ee(N.root,o),ref:n,role:"tab","aria-selected":v,disabled:i,onClick:z,onFocus:j,ownerState:P,tabIndex:v?0:-1},E,{children:[a==="top"||a==="start"?F.jsxs(L.Fragment,{children:[R,p]}):F.jsxs(L.Fragment,{children:[p,R]}),c]}))}),GT=KT,YT=L.createContext(),G1=YT;function qT(e){return Mt("MuiTable",e)}$t("MuiTable",["root","stickyHeader"]);const QT=["className","component","padding","size","stickyHeader"],XT=e=>{const{classes:t,stickyHeader:n}=e;return zt({root:["root",n&&"stickyHeader"]},qT,t)},ZT=Ye("table",{name:"MuiTable",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.stickyHeader&&t.stickyHeader]}})(({theme:e,ownerState:t})=>A({display:"table",width:"100%",borderCollapse:"collapse",borderSpacing:0,"& caption":A({},e.typography.body2,{padding:e.spacing(2),color:(e.vars||e).palette.text.secondary,textAlign:"left",captionSide:"bottom"})},t.stickyHeader&&{borderCollapse:"separate"})),Lm="table",JT=L.forwardRef(function(t,n){const r=kt({props:t,name:"MuiTable"}),{className:o,component:i=Lm,padding:l="normal",size:s="medium",stickyHeader:u=!1}=r,a=$e(r,QT),c=A({},r,{component:i,padding:l,size:s,stickyHeader:u}),p=XT(c),f=L.useMemo(()=>({padding:l,size:s,stickyHeader:u}),[l,s,u]);return F.jsx(G1.Provider,{value:f,children:F.jsx(ZT,A({as:i,role:i===Lm?null:"table",ref:n,className:Ee(p.root,o),ownerState:c},a))})}),e3=JT,t3=L.createContext(),wc=t3;function n3(e){return Mt("MuiTableBody",e)}$t("MuiTableBody",["root"]);const r3=["className","component"],o3=e=>{const{classes:t}=e;return zt({root:["root"]},n3,t)},i3=Ye("tbody",{name:"MuiTableBody",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"table-row-group"}),l3={variant:"body"},Am="tbody",s3=L.forwardRef(function(t,n){const r=kt({props:t,name:"MuiTableBody"}),{className:o,component:i=Am}=r,l=$e(r,r3),s=A({},r,{component:i}),u=o3(s);return F.jsx(wc.Provider,{value:l3,children:F.jsx(i3,A({className:Ee(u.root,o),as:i,ref:n,role:i===Am?null:"rowgroup",ownerState:s},l))})}),a3=s3;function u3(e){return Mt("MuiTableCell",e)}const c3=$t("MuiTableCell",["root","head","body","footer","sizeSmall","sizeMedium","paddingCheckbox","paddingNone","alignLeft","alignCenter","alignRight","alignJustify","stickyHeader"]),f3=c3,d3=["align","className","component","padding","scope","size","sortDirection","variant"],p3=e=>{const{classes:t,variant:n,align:r,padding:o,size:i,stickyHeader:l}=e,s={root:["root",n,l&&"stickyHeader",r!=="inherit"&&`align${be(r)}`,o!=="normal"&&`padding${be(o)}`,`size${be(i)}`]};return zt(s,u3,t)},h3=Ye("td",{name:"MuiTableCell",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.variant],t[`size${be(n.size)}`],n.padding!=="normal"&&t[`padding${be(n.padding)}`],n.align!=="inherit"&&t[`align${be(n.align)}`],n.stickyHeader&&t.stickyHeader]}})(({theme:e,ownerState:t})=>A({},e.typography.body2,{display:"table-cell",verticalAlign:"inherit",borderBottom:e.vars?`1px solid ${e.vars.palette.TableCell.border}`:`1px solid + ${e.palette.mode==="light"?L1(Kn(e.palette.divider,1),.88):z1(Kn(e.palette.divider,1),.68)}`,textAlign:"left",padding:16},t.variant==="head"&&{color:(e.vars||e).palette.text.primary,lineHeight:e.typography.pxToRem(24),fontWeight:e.typography.fontWeightMedium},t.variant==="body"&&{color:(e.vars||e).palette.text.primary},t.variant==="footer"&&{color:(e.vars||e).palette.text.secondary,lineHeight:e.typography.pxToRem(21),fontSize:e.typography.pxToRem(12)},t.size==="small"&&{padding:"6px 16px",[`&.${f3.paddingCheckbox}`]:{width:24,padding:"0 12px 0 16px","& > *":{padding:0}}},t.padding==="checkbox"&&{width:48,padding:"0 0 0 4px"},t.padding==="none"&&{padding:0},t.align==="left"&&{textAlign:"left"},t.align==="center"&&{textAlign:"center"},t.align==="right"&&{textAlign:"right",flexDirection:"row-reverse"},t.align==="justify"&&{textAlign:"justify"},t.stickyHeader&&{position:"sticky",top:0,zIndex:2,backgroundColor:(e.vars||e).palette.background.default})),m3=L.forwardRef(function(t,n){const r=kt({props:t,name:"MuiTableCell"}),{align:o="inherit",className:i,component:l,padding:s,scope:u,size:a,sortDirection:c,variant:p}=r,f=$e(r,d3),h=L.useContext(G1),x=L.useContext(wc),v=x&&x.variant==="head";let C;l?C=l:C=v?"th":"td";let w=u;C==="td"?w=void 0:!w&&v&&(w="col");const m=p||x&&x.variant,S=A({},r,{align:o,component:C,padding:s||(h&&h.padding?h.padding:"normal"),size:a||(h&&h.size?h.size:"medium"),sortDirection:c,stickyHeader:m==="head"&&h&&h.stickyHeader,variant:m}),E=p3(S);let P=null;return c&&(P=c==="asc"?"ascending":"descending"),F.jsx(h3,A({as:C,ref:n,className:Ee(E.root,i),"aria-sort":P,scope:w,ownerState:S},f))}),Im=m3;function g3(e){return Mt("MuiTableContainer",e)}$t("MuiTableContainer",["root"]);const y3=["className","component"],v3=e=>{const{classes:t}=e;return zt({root:["root"]},g3,t)},x3=Ye("div",{name:"MuiTableContainer",slot:"Root",overridesResolver:(e,t)=>t.root})({width:"100%",overflowX:"auto"}),w3=L.forwardRef(function(t,n){const r=kt({props:t,name:"MuiTableContainer"}),{className:o,component:i="div"}=r,l=$e(r,y3),s=A({},r,{component:i}),u=v3(s);return F.jsx(x3,A({ref:n,as:i,className:Ee(u.root,o),ownerState:s},l))}),S3=w3;function _3(e){return Mt("MuiTableHead",e)}$t("MuiTableHead",["root"]);const k3=["className","component"],b3=e=>{const{classes:t}=e;return zt({root:["root"]},_3,t)},E3=Ye("thead",{name:"MuiTableHead",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"table-header-group"}),C3={variant:"head"},Dm="thead",T3=L.forwardRef(function(t,n){const r=kt({props:t,name:"MuiTableHead"}),{className:o,component:i=Dm}=r,l=$e(r,k3),s=A({},r,{component:i}),u=b3(s);return F.jsx(wc.Provider,{value:C3,children:F.jsx(E3,A({as:i,className:Ee(u.root,o),ref:n,role:i===Dm?null:"rowgroup",ownerState:s},l))})}),P3=T3;function R3(e){return Mt("MuiToolbar",e)}$t("MuiToolbar",["root","gutters","regular","dense"]);const M3=["className","component","disableGutters","variant"],$3=e=>{const{classes:t,disableGutters:n,variant:r}=e;return zt({root:["root",!n&&"gutters",r]},R3,t)},N3=Ye("div",{name:"MuiToolbar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,!n.disableGutters&&t.gutters,t[n.variant]]}})(({theme:e,ownerState:t})=>A({position:"relative",display:"flex",alignItems:"center"},!t.disableGutters&&{paddingLeft:e.spacing(2),paddingRight:e.spacing(2),[e.breakpoints.up("sm")]:{paddingLeft:e.spacing(3),paddingRight:e.spacing(3)}},t.variant==="dense"&&{minHeight:48}),({theme:e,ownerState:t})=>t.variant==="regular"&&e.mixins.toolbar),O3=L.forwardRef(function(t,n){const r=kt({props:t,name:"MuiToolbar"}),{className:o,component:i="div",disableGutters:l=!1,variant:s="regular"}=r,u=$e(r,M3),a=A({},r,{component:i,disableGutters:l,variant:s}),c=$3(a);return F.jsx(N3,A({as:i,className:Ee(c.root,o),ref:n,ownerState:a},u))}),z3=O3,L3=j1(F.jsx("path",{d:"M15.41 16.09l-4.58-4.59 4.58-4.59L14 5.5l-6 6 6 6z"}),"KeyboardArrowLeft"),A3=j1(F.jsx("path",{d:"M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z"}),"KeyboardArrowRight");function I3(e){return Mt("MuiTableRow",e)}const D3=$t("MuiTableRow",["root","selected","hover","head","footer"]),Bm=D3,B3=["className","component","hover","selected"],F3=e=>{const{classes:t,selected:n,hover:r,head:o,footer:i}=e;return zt({root:["root",n&&"selected",r&&"hover",o&&"head",i&&"footer"]},I3,t)},j3=Ye("tr",{name:"MuiTableRow",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.head&&t.head,n.footer&&t.footer]}})(({theme:e})=>({color:"inherit",display:"table-row",verticalAlign:"middle",outline:0,[`&.${Bm.hover}:hover`]:{backgroundColor:(e.vars||e).palette.action.hover},[`&.${Bm.selected}`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:Kn(e.palette.primary.main,e.palette.action.selectedOpacity),"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))`:Kn(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.hoverOpacity)}}})),Fm="tr",W3=L.forwardRef(function(t,n){const r=kt({props:t,name:"MuiTableRow"}),{className:o,component:i=Fm,hover:l=!1,selected:s=!1}=r,u=$e(r,B3),a=L.useContext(wc),c=A({},r,{component:i,hover:l,selected:s,head:a&&a.variant==="head",footer:a&&a.variant==="footer"}),p=F3(c);return F.jsx(j3,A({as:i,ref:n,className:Ee(p.root,o),role:i===Fm?null:"row",ownerState:c},u))}),jm=W3;function H3(e){return(1+Math.sin(Math.PI*e-Math.PI/2))/2}function U3(e,t,n,r={},o=()=>{}){const{ease:i=H3,duration:l=300}=r;let s=null;const u=t[e];let a=!1;const c=()=>{a=!0},p=f=>{if(a){o(new Error("Animation cancelled"));return}s===null&&(s=f);const h=Math.min(1,(f-s)/l);if(t[e]=i(h)*(n-u)+u,h>=1){requestAnimationFrame(()=>{o(null)});return}requestAnimationFrame(p)};return u===n?(o(new Error("Element already at target position")),c):(requestAnimationFrame(p),c)}const V3=["onChange"],K3={width:99,height:99,position:"absolute",top:-9999,overflow:"scroll"};function G3(e){const{onChange:t}=e,n=$e(e,V3),r=L.useRef(),o=L.useRef(null),i=()=>{r.current=o.current.offsetHeight-o.current.clientHeight};return Dp(()=>{const l=o1(()=>{const u=r.current;i(),u!==r.current&&t(r.current)}),s=l1(o.current);return s.addEventListener("resize",l),()=>{l.clear(),s.removeEventListener("resize",l)}},[t]),L.useEffect(()=>{i(),t(r.current)},[t]),F.jsx("div",A({style:K3,ref:o},n))}function Y3(e){return Mt("MuiTabScrollButton",e)}const q3=$t("MuiTabScrollButton",["root","vertical","horizontal","disabled"]),Q3=q3,X3=["className","slots","slotProps","direction","orientation","disabled"],Z3=e=>{const{classes:t,orientation:n,disabled:r}=e;return zt({root:["root",n,r&&"disabled"]},Y3,t)},J3=Ye(vc,{name:"MuiTabScrollButton",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.orientation&&t[n.orientation]]}})(({ownerState:e})=>A({width:40,flexShrink:0,opacity:.8,[`&.${Q3.disabled}`]:{opacity:0}},e.orientation==="vertical"&&{width:"100%",height:40,"& svg":{transform:`rotate(${e.isRtl?-90:90}deg)`}})),e4=L.forwardRef(function(t,n){var r,o;const i=kt({props:t,name:"MuiTabScrollButton"}),{className:l,slots:s={},slotProps:u={},direction:a}=i,c=$e(i,X3),f=mo().direction==="rtl",h=A({isRtl:f},i),x=Z3(h),v=(r=s.StartScrollButtonIcon)!=null?r:L3,C=(o=s.EndScrollButtonIcon)!=null?o:A3,w=du({elementType:v,externalSlotProps:u.startScrollButtonIcon,additionalProps:{fontSize:"small"},ownerState:h}),m=du({elementType:C,externalSlotProps:u.endScrollButtonIcon,additionalProps:{fontSize:"small"},ownerState:h});return F.jsx(J3,A({component:"div",className:Ee(x.root,l),ref:n,role:null,ownerState:h,tabIndex:null},c,{children:a==="left"?F.jsx(v,A({},w)):F.jsx(C,A({},m))}))}),t4=e4;function n4(e){return Mt("MuiTabs",e)}const r4=$t("MuiTabs",["root","vertical","flexContainer","flexContainerVertical","centered","scroller","fixed","scrollableX","scrollableY","hideScrollbar","scrollButtons","scrollButtonsHideMobile","indicator"]),bf=r4,o4=["aria-label","aria-labelledby","action","centered","children","className","component","allowScrollButtonsMobile","indicatorColor","onChange","orientation","ScrollButtonComponent","scrollButtons","selectionFollowsFocus","slots","slotProps","TabIndicatorProps","TabScrollButtonProps","textColor","value","variant","visibleScrollbar"],Wm=(e,t)=>e===t?e.firstChild:t&&t.nextElementSibling?t.nextElementSibling:e.firstChild,Hm=(e,t)=>e===t?e.lastChild:t&&t.previousElementSibling?t.previousElementSibling:e.lastChild,pa=(e,t,n)=>{let r=!1,o=n(e,t);for(;o;){if(o===e.firstChild){if(r)return;r=!0}const i=o.disabled||o.getAttribute("aria-disabled")==="true";if(!o.hasAttribute("tabindex")||i)o=n(e,o);else{o.focus();return}}},i4=e=>{const{vertical:t,fixed:n,hideScrollbar:r,scrollableX:o,scrollableY:i,centered:l,scrollButtonsHideMobile:s,classes:u}=e;return zt({root:["root",t&&"vertical"],scroller:["scroller",n&&"fixed",r&&"hideScrollbar",o&&"scrollableX",i&&"scrollableY"],flexContainer:["flexContainer",t&&"flexContainerVertical",l&&"centered"],indicator:["indicator"],scrollButtons:["scrollButtons",s&&"scrollButtonsHideMobile"],scrollableX:[o&&"scrollableX"],hideScrollbar:[r&&"hideScrollbar"]},n4,u)},l4=Ye("div",{name:"MuiTabs",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[{[`& .${bf.scrollButtons}`]:t.scrollButtons},{[`& .${bf.scrollButtons}`]:n.scrollButtonsHideMobile&&t.scrollButtonsHideMobile},t.root,n.vertical&&t.vertical]}})(({ownerState:e,theme:t})=>A({overflow:"hidden",minHeight:48,WebkitOverflowScrolling:"touch",display:"flex"},e.vertical&&{flexDirection:"column"},e.scrollButtonsHideMobile&&{[`& .${bf.scrollButtons}`]:{[t.breakpoints.down("sm")]:{display:"none"}}})),s4=Ye("div",{name:"MuiTabs",slot:"Scroller",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.scroller,n.fixed&&t.fixed,n.hideScrollbar&&t.hideScrollbar,n.scrollableX&&t.scrollableX,n.scrollableY&&t.scrollableY]}})(({ownerState:e})=>A({position:"relative",display:"inline-block",flex:"1 1 auto",whiteSpace:"nowrap"},e.fixed&&{overflowX:"hidden",width:"100%"},e.hideScrollbar&&{scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}},e.scrollableX&&{overflowX:"auto",overflowY:"hidden"},e.scrollableY&&{overflowY:"auto",overflowX:"hidden"})),a4=Ye("div",{name:"MuiTabs",slot:"FlexContainer",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.flexContainer,n.vertical&&t.flexContainerVertical,n.centered&&t.centered]}})(({ownerState:e})=>A({display:"flex"},e.vertical&&{flexDirection:"column"},e.centered&&{justifyContent:"center"})),u4=Ye("span",{name:"MuiTabs",slot:"Indicator",overridesResolver:(e,t)=>t.indicator})(({ownerState:e,theme:t})=>A({position:"absolute",height:2,bottom:0,width:"100%",transition:t.transitions.create()},e.indicatorColor==="primary"&&{backgroundColor:(t.vars||t).palette.primary.main},e.indicatorColor==="secondary"&&{backgroundColor:(t.vars||t).palette.secondary.main},e.vertical&&{height:"100%",width:2,right:0})),c4=Ye(G3,{name:"MuiTabs",slot:"ScrollbarSize"})({overflowX:"auto",overflowY:"hidden",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}}),Um={},f4=L.forwardRef(function(t,n){const r=kt({props:t,name:"MuiTabs"}),o=mo(),i=o.direction==="rtl",{"aria-label":l,"aria-labelledby":s,action:u,centered:a=!1,children:c,className:p,component:f="div",allowScrollButtonsMobile:h=!1,indicatorColor:x="primary",onChange:v,orientation:C="horizontal",ScrollButtonComponent:w=t4,scrollButtons:m="auto",selectionFollowsFocus:S,slots:E={},slotProps:P={},TabIndicatorProps:N={},TabScrollButtonProps:R={},textColor:z="primary",value:j,variant:O="standard",visibleScrollbar:D=!1}=r,U=$e(r,o4),V=O==="scrollable",ee=C==="vertical",le=ee?"scrollTop":"scrollLeft",me=ee?"top":"left",se=ee?"bottom":"right",H=ee?"clientHeight":"clientWidth",ne=ee?"height":"width",G=A({},r,{component:f,allowScrollButtonsMobile:h,indicatorColor:x,orientation:C,vertical:ee,scrollButtons:m,textColor:z,variant:O,visibleScrollbar:D,fixed:!V,hideScrollbar:V&&!D,scrollableX:V&&!ee,scrollableY:V&&ee,centered:a&&!V,scrollButtonsHideMobile:!h}),oe=i4(G),Z=du({elementType:E.StartScrollButtonIcon,externalSlotProps:P.startScrollButtonIcon,ownerState:G}),xe=du({elementType:E.EndScrollButtonIcon,externalSlotProps:P.endScrollButtonIcon,ownerState:G}),[te,ye]=L.useState(!1),[ae,Ce]=L.useState(Um),[Ae,Ne]=L.useState(!1),[Ze,ht]=L.useState(!1),[cn,cr]=L.useState(!1),[fn,Zn]=L.useState({overflow:"hidden",scrollbarWidth:0}),Cn=new Map,wt=L.useRef(null),Je=L.useRef(null),he=()=>{const J=wt.current;let ie;if(J){const we=J.getBoundingClientRect();ie={clientWidth:J.clientWidth,scrollLeft:J.scrollLeft,scrollTop:J.scrollTop,scrollLeftNormalized:Ik(J,o.direction),scrollWidth:J.scrollWidth,top:we.top,bottom:we.bottom,left:we.left,right:we.right}}let X;if(J&&j!==!1){const we=Je.current.children;if(we.length>0){const bt=we[Cn.get(j)];X=bt?bt.getBoundingClientRect():null}}return{tabsMeta:ie,tabMeta:X}},mt=Ao(()=>{const{tabsMeta:J,tabMeta:ie}=he();let X=0,we;if(ee)we="top",ie&&J&&(X=ie.top-J.top+J.scrollTop);else if(we=i?"right":"left",ie&&J){const vn=i?J.scrollLeftNormalized+J.clientWidth-J.scrollWidth:J.scrollLeft;X=(i?-1:1)*(ie[we]-J[we]+vn)}const bt={[we]:X,[ne]:ie?ie[ne]:0};if(isNaN(ae[we])||isNaN(ae[ne]))Ce(bt);else{const vn=Math.abs(ae[we]-bt[we]),br=Math.abs(ae[ne]-bt[ne]);(vn>=1||br>=1)&&Ce(bt)}}),At=(J,{animation:ie=!0}={})=>{ie?U3(le,wt.current,J,{duration:o.transitions.duration.standard}):wt.current[le]=J},_e=J=>{let ie=wt.current[le];ee?ie+=J:(ie+=J*(i?-1:1),ie*=i&&s1()==="reverse"?-1:1),At(ie)},ce=()=>{const J=wt.current[H];let ie=0;const X=Array.from(Je.current.children);for(let we=0;weJ){we===0&&(ie=J);break}ie+=bt[H]}return ie},Oe=()=>{_e(-1*ce())},Ue=()=>{_e(ce())},g=L.useCallback(J=>{Zn({overflow:null,scrollbarWidth:J})},[]),k=()=>{const J={};J.scrollbarSizeListener=V?F.jsx(c4,{onChange:g,className:Ee(oe.scrollableX,oe.hideScrollbar)}):null;const X=V&&(m==="auto"&&(Ae||Ze)||m===!0);return J.scrollButtonStart=X?F.jsx(w,A({slots:{StartScrollButtonIcon:E.StartScrollButtonIcon},slotProps:{startScrollButtonIcon:Z},orientation:C,direction:i?"right":"left",onClick:Oe,disabled:!Ae},R,{className:Ee(oe.scrollButtons,R.className)})):null,J.scrollButtonEnd=X?F.jsx(w,A({slots:{EndScrollButtonIcon:E.EndScrollButtonIcon},slotProps:{endScrollButtonIcon:xe},orientation:C,direction:i?"left":"right",onClick:Ue,disabled:!Ze},R,{className:Ee(oe.scrollButtons,R.className)})):null,J},T=Ao(J=>{const{tabsMeta:ie,tabMeta:X}=he();if(!(!X||!ie)){if(X[me]ie[se]){const we=ie[le]+(X[se]-ie[se]);At(we,{animation:J})}}}),M=Ao(()=>{V&&m!==!1&&cr(!cn)});L.useEffect(()=>{const J=o1(()=>{wt.current&&mt()}),ie=l1(wt.current);ie.addEventListener("resize",J);let X;return typeof ResizeObserver<"u"&&(X=new ResizeObserver(J),Array.from(Je.current.children).forEach(we=>{X.observe(we)})),()=>{J.clear(),ie.removeEventListener("resize",J),X&&X.disconnect()}},[mt]),L.useEffect(()=>{const J=Array.from(Je.current.children),ie=J.length;if(typeof IntersectionObserver<"u"&&ie>0&&V&&m!==!1){const X=J[0],we=J[ie-1],bt={root:wt.current,threshold:.99},vn=ut=>{Ne(!ut[0].isIntersecting)},br=new IntersectionObserver(vn,bt);br.observe(X);const Jo=ut=>{ht(!ut[0].isIntersecting)},ge=new IntersectionObserver(Jo,bt);return ge.observe(we),()=>{br.disconnect(),ge.disconnect()}}},[V,m,cn,c==null?void 0:c.length]),L.useEffect(()=>{ye(!0)},[]),L.useEffect(()=>{mt()}),L.useEffect(()=>{T(Um!==ae)},[T,ae]),L.useImperativeHandle(u,()=>({updateIndicator:mt,updateScrollButtons:M}),[mt,M]);const B=F.jsx(u4,A({},N,{className:Ee(oe.indicator,N.className),ownerState:G,style:A({},ae,N.style)}));let Q=0;const de=L.Children.map(c,J=>{if(!L.isValidElement(J))return null;const ie=J.props.value===void 0?Q:J.props.value;Cn.set(ie,Q);const X=ie===j;return Q+=1,L.cloneElement(J,A({fullWidth:O==="fullWidth",indicator:X&&!te&&B,selected:X,selectionFollowsFocus:S,onChange:v,textColor:z,value:ie},Q===1&&j===!1&&!J.props.tabIndex?{tabIndex:0}:{}))}),ve=J=>{const ie=Je.current,X=i1(ie).activeElement;if(X.getAttribute("role")!=="tab")return;let bt=C==="horizontal"?"ArrowLeft":"ArrowUp",vn=C==="horizontal"?"ArrowRight":"ArrowDown";switch(C==="horizontal"&&i&&(bt="ArrowRight",vn="ArrowLeft"),J.key){case bt:J.preventDefault(),pa(ie,X,Hm);break;case vn:J.preventDefault(),pa(ie,X,Wm);break;case"Home":J.preventDefault(),pa(ie,null,Wm);break;case"End":J.preventDefault(),pa(ie,null,Hm);break}},at=k();return F.jsxs(l4,A({className:Ee(oe.root,p),ownerState:G,ref:n,as:f},U,{children:[at.scrollButtonStart,at.scrollbarSizeListener,F.jsxs(s4,{className:oe.scroller,ownerState:G,style:{overflow:fn.overflow,[ee?`margin${i?"Left":"Right"}`:"marginBottom"]:D?void 0:-fn.scrollbarWidth},ref:wt,children:[F.jsx(a4,{"aria-label":l,"aria-labelledby":s,"aria-orientation":C==="vertical"?"vertical":null,className:oe.flexContainer,ownerState:G,onKeyDown:ve,ref:Je,role:"tablist",children:de}),te&&B]}),at.scrollButtonEnd]}))}),d4=f4;const p4=e=>L.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",enableBackground:"new 0 0 24 24",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"currentColor",...e},L.createElement("rect",{fill:"none",height:24,width:24}),L.createElement("path",{d:"M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36c-0.98,1.37-2.58,2.26-4.4,2.26 c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"})),h4=e=>L.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",enableBackground:"new 0 0 24 24",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"currentColor",...e},L.createElement("rect",{fill:"none",height:24,width:24}),L.createElement("path",{d:"M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0 c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2 c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1 C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06 c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41 l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41 c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36 c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"}));const Y1=Vt.createContext({toggleColorMode:()=>{}}),fi={red:_o,pink:G_,purple:ko,deepPurple:Q_,indigo:Z_,blue:bo,lightBlue:Eo,cyan:nk,teal:ok,green:Co,lightGreen:sk,lime:uk,yellow:fk,amber:pk,orange:hi,deepOrange:gk,brown:vk,grey:Zv,blueGrey:Sk},Vm=["grey","teal","blue","purple","indigo","orange","pink","green","cyan","amber","lime","brown","lightGreen","red","deepPurple","lightBlue","yellow","deepOrange","blueGrey"];function q1({children:e}){const t=FT("(prefers-color-scheme: dark)"),[n,r]=Vt.useState(t?"dark":"light"),o=Vt.useMemo(()=>({toggleColorMode:()=>{r(l=>l==="light"?"dark":"light")}}),[]),i=Vt.useMemo(()=>{let l=[];for(var s=0;swindow.open("../report","k6-report"),children:"Report"}),F.jsx(BC,{sx:{ml:1},onClick:n.toggleColorMode,color:"inherit",children:t.palette.mode==="dark"?F.jsx(h4,{}):F.jsx(p4,{})})]})})})}const g4=e=>L.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"currentColor",...e},L.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),L.createElement("path",{d:"M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"})),y4=e=>L.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"currentColor",...e},L.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),L.createElement("path",{d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"}));var Q1={exports:{}};/*! @preserve + * numeral.js + * version : 2.0.6 + * author : Adam Draper + * license : MIT + * http://adamwdraper.github.com/Numeral-js/ + */(function(e){(function(t,n){e.exports?e.exports=n():t.numeral=n()})(vw,function(){var t,n,r="2.0.6",o={},i={},l={currentLocale:"en",zeroFormat:null,nullFormat:null,defaultFormat:"0,0",scalePercentBy100:!0},s={currentLocale:l.currentLocale,zeroFormat:l.zeroFormat,nullFormat:l.nullFormat,defaultFormat:l.defaultFormat,scalePercentBy100:l.scalePercentBy100};function u(a,c){this._input=a,this._value=c}return t=function(a){var c,p,f,h;if(t.isNumeral(a))c=a.value();else if(a===0||typeof a>"u")c=0;else if(a===null||n.isNaN(a))c=null;else if(typeof a=="string")if(s.zeroFormat&&a===s.zeroFormat)c=0;else if(s.nullFormat&&a===s.nullFormat||!a.replace(/[^0-9]+/g,"").length)c=null;else{for(p in o)if(h=typeof o[p].regexps.unformat=="function"?o[p].regexps.unformat():o[p].regexps.unformat,h&&a.match(h)){f=o[p].unformat;break}f=f||t._.stringToNumber,c=f(a)}else c=Number(a)||null;return new u(a,c)},t.version=r,t.isNumeral=function(a){return a instanceof u},t._=n={numberToFormat:function(a,c,p){var f=i[t.options.currentLocale],h=!1,x=!1,v=0,C="",w=1e12,m=1e9,S=1e6,E=1e3,P="",N=!1,R,z,j,O,D,U,V;if(a=a||0,z=Math.abs(a),t._.includes(c,"(")?(h=!0,c=c.replace(/[\(|\)]/g,"")):(t._.includes(c,"+")||t._.includes(c,"-"))&&(D=t._.includes(c,"+")?c.indexOf("+"):a<0?c.indexOf("-"):-1,c=c.replace(/[\+|\-]/g,"")),t._.includes(c,"a")&&(R=c.match(/a(k|m|b|t)?/),R=R?R[1]:!1,t._.includes(c," a")&&(C=" "),c=c.replace(new RegExp(C+"a[kmbt]?"),""),z>=w&&!R||R==="t"?(C+=f.abbreviations.trillion,a=a/w):z=m&&!R||R==="b"?(C+=f.abbreviations.billion,a=a/m):z=S&&!R||R==="m"?(C+=f.abbreviations.million,a=a/S):(z=E&&!R||R==="k")&&(C+=f.abbreviations.thousand,a=a/E)),t._.includes(c,"[.]")&&(x=!0,c=c.replace("[.]",".")),j=a.toString().split(".")[0],O=c.split(".")[1],U=c.indexOf(","),v=(c.split(".")[0].split(",")[0].match(/0/g)||[]).length,O?(t._.includes(O,"[")?(O=O.replace("]",""),O=O.split("["),P=t._.toFixed(a,O[0].length+O[1].length,p,O[1].length)):P=t._.toFixed(a,O.length,p),j=P.split(".")[0],t._.includes(P,".")?P=f.delimiters.decimal+P.split(".")[1]:P="",x&&Number(P.slice(1))===0&&(P="")):j=t._.toFixed(a,0,p),C&&!R&&Number(j)>=1e3&&C!==f.abbreviations.trillion)switch(j=String(Number(j)/1e3),C){case f.abbreviations.thousand:C=f.abbreviations.million;break;case f.abbreviations.million:C=f.abbreviations.billion;break;case f.abbreviations.billion:C=f.abbreviations.trillion;break}if(t._.includes(j,"-")&&(j=j.slice(1),N=!0),j.length0;ee--)j="0"+j;return U>-1&&(j=j.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+f.delimiters.thousands)),c.indexOf(".")===0&&(j=""),V=j+P+(C||""),h?V=(h&&N?"(":"")+V+(h&&N?")":""):D>=0?V=D===0?(N?"-":"+")+V:V+(N?"-":"+"):N&&(V="-"+V),V},stringToNumber:function(a){var c=i[s.currentLocale],p=a,f={thousand:3,million:6,billion:9,trillion:12},h,x,v;if(s.zeroFormat&&a===s.zeroFormat)x=0;else if(s.nullFormat&&a===s.nullFormat||!a.replace(/[^0-9]+/g,"").length)x=null;else{x=1,c.delimiters.decimal!=="."&&(a=a.replace(/\./g,"").replace(c.delimiters.decimal,"."));for(h in f)if(v=new RegExp("[^a-zA-Z]"+c.abbreviations[h]+"(?:\\)|(\\"+c.currency.symbol+")?(?:\\))?)?$"),p.match(v)){x*=Math.pow(10,f[h]);break}x*=(a.split("-").length+Math.min(a.split("(").length-1,a.split(")").length-1))%2?1:-1,a=a.replace(/[^0-9\.]+/g,""),x*=Number(a)}return x},isNaN:function(a){return typeof a=="number"&&isNaN(a)},includes:function(a,c){return a.indexOf(c)!==-1},insert:function(a,c,p){return a.slice(0,p)+c+a.slice(p)},reduce:function(a,c){if(this===null)throw new TypeError("Array.prototype.reduce called on null or undefined");if(typeof c!="function")throw new TypeError(c+" is not a function");var p=Object(a),f=p.length>>>0,h=0,x;if(arguments.length===3)x=arguments[2];else{for(;h=f)throw new TypeError("Reduce of empty array with no initial value");x=p[h++]}for(;hf?c:f},1)},toFixed:function(a,c,p,f){var h=a.toString().split("."),x=c-(f||0),v,C,w,m;return h.length===2?v=Math.min(Math.max(h[1].length,x),c):v=x,w=Math.pow(10,v),m=(p(a+"e+"+v)/w).toFixed(v),f>c-v&&(C=new RegExp("\\.?0{1,"+(f-(c-v))+"}$"),m=m.replace(C,"")),m}},t.options=s,t.formats=o,t.locales=i,t.locale=function(a){return a&&(s.currentLocale=a.toLowerCase()),s.currentLocale},t.localeData=function(a){if(!a)return i[s.currentLocale];if(a=a.toLowerCase(),!i[a])throw new Error("Unknown locale : "+a);return i[a]},t.reset=function(){for(var a in l)s[a]=l[a]},t.zeroFormat=function(a){s.zeroFormat=typeof a=="string"?a:null},t.nullFormat=function(a){s.nullFormat=typeof a=="string"?a:null},t.defaultFormat=function(a){s.defaultFormat=typeof a=="string"?a:"0.0"},t.register=function(a,c,p){if(c=c.toLowerCase(),this[a+"s"][c])throw new TypeError(c+" "+a+" already registered.");return this[a+"s"][c]=p,p},t.validate=function(a,c){var p,f,h,x,v,C,w,m;if(typeof a!="string"&&(a+="",console.warn&&console.warn("Numeral.js: Value is not string. It has been co-erced to: ",a)),a=a.trim(),a.match(/^\d+$/))return!0;if(a==="")return!1;try{w=t.localeData(c)}catch{w=t.localeData(t.locale())}return h=w.currency.symbol,v=w.abbreviations,p=w.delimiters.decimal,w.delimiters.thousands==="."?f="\\.":f=w.delimiters.thousands,m=a.match(/^[^\d]+/),m!==null&&(a=a.substr(1),m[0]!==h)||(m=a.match(/[^\d]+$/),m!==null&&(a=a.slice(0,-1),m[0]!==v.thousand&&m[0]!==v.million&&m[0]!==v.billion&&m[0]!==v.trillion))?!1:(C=new RegExp(f+"{2}"),a.match(/[^\d.,]/g)?!1:(x=a.split(p),x.length>2?!1:x.length<2?!!x[0].match(/^\d+.*\d$/)&&!x[0].match(C):x[0].length===1?!!x[0].match(/^\d+$/)&&!x[0].match(C)&&!!x[1].match(/^\d+$/):!!x[0].match(/^\d+.*\d$/)&&!x[0].match(C)&&!!x[1].match(/^\d+$/)))},t.fn=u.prototype={clone:function(){return t(this)},format:function(a,c){var p=this._value,f=a||s.defaultFormat,h,x,v;if(c=c||Math.round,p===0&&s.zeroFormat!==null)x=s.zeroFormat;else if(p===null&&s.nullFormat!==null)x=s.nullFormat;else{for(h in o)if(f.match(o[h].regexps.format)){v=o[h].format;break}v=v||t._.numberToFormat,x=v(p,f,c)}return x},value:function(){return this._value},input:function(){return this._input},set:function(a){return this._value=Number(a),this},add:function(a){var c=n.correctionFactor.call(null,this._value,a);function p(f,h,x,v){return f+Math.round(c*h)}return this._value=n.reduce([this._value,a],p,0)/c,this},subtract:function(a){var c=n.correctionFactor.call(null,this._value,a);function p(f,h,x,v){return f-Math.round(c*h)}return this._value=n.reduce([a],p,Math.round(this._value*c))/c,this},multiply:function(a){function c(p,f,h,x){var v=n.correctionFactor(p,f);return Math.round(p*v)*Math.round(f*v)/Math.round(v*v)}return this._value=n.reduce([this._value,a],c,1),this},divide:function(a){function c(p,f,h,x){var v=n.correctionFactor(p,f);return Math.round(p*v)/Math.round(f*v)}return this._value=n.reduce([this._value,a],c),this},difference:function(a){return Math.abs(t(this._value).subtract(a).value())}},t.register("locale","en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(a){var c=a%10;return~~(a%100/10)===1?"th":c===1?"st":c===2?"nd":c===3?"rd":"th"},currency:{symbol:"$"}}),function(){t.register("format","bps",{regexps:{format:/(BPS)/,unformat:/(BPS)/},format:function(a,c,p){var f=t._.includes(c," BPS")?" ":"",h;return a=a*1e4,c=c.replace(/\s?BPS/,""),h=t._.numberToFormat(a,c,p),t._.includes(h,")")?(h=h.split(""),h.splice(-1,0,f+"BPS"),h=h.join("")):h=h+f+"BPS",h},unformat:function(a){return+(t._.stringToNumber(a)*1e-4).toFixed(15)}})}(),function(){var a={base:1e3,suffixes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]},c={base:1024,suffixes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},p=a.suffixes.concat(c.suffixes.filter(function(h){return a.suffixes.indexOf(h)<0})),f=p.join("|");f="("+f.replace("B","B(?!PS)")+")",t.register("format","bytes",{regexps:{format:/([0\s]i?b)/,unformat:new RegExp(f)},format:function(h,x,v){var C,w=t._.includes(x,"ib")?c:a,m=t._.includes(x," b")||t._.includes(x," ib")?" ":"",S,E,P;for(x=x.replace(/\s?i?b/,""),S=0;S<=w.suffixes.length;S++)if(E=Math.pow(w.base,S),P=Math.pow(w.base,S+1),h===null||h===0||h>=E&&h0&&(h=h/E);break}return C=t._.numberToFormat(h,x,v),C+m},unformat:function(h){var x=t._.stringToNumber(h),v,C;if(x){for(v=a.suffixes.length-1;v>=0;v--){if(t._.includes(h,a.suffixes[v])){C=Math.pow(a.base,v);break}if(t._.includes(h,c.suffixes[v])){C=Math.pow(c.base,v);break}}x*=C||1}return x}})}(),function(){t.register("format","currency",{regexps:{format:/(\$)/},format:function(a,c,p){var f=t.locales[t.options.currentLocale],h={before:c.match(/^([\+|\-|\(|\s|\$]*)/)[0],after:c.match(/([\+|\-|\)|\s|\$]*)$/)[0]},x,v,C;for(c=c.replace(/\s?\$\s?/,""),x=t._.numberToFormat(a,c,p),a>=0?(h.before=h.before.replace(/[\-\(]/,""),h.after=h.after.replace(/[\-\)]/,"")):a<0&&!t._.includes(h.before,"-")&&!t._.includes(h.before,"(")&&(h.before="-"+h.before),C=0;C=0;C--)switch(v=h.after[C],v){case"$":x=C===h.after.length-1?x+f.currency.symbol:t._.insert(x,f.currency.symbol,-(h.after.length-(1+C)));break;case" ":x=C===h.after.length-1?x+" ":t._.insert(x," ",-(h.after.length-(1+C)+f.currency.symbol.length-1));break}return x}})}(),function(){t.register("format","exponential",{regexps:{format:/(e\+|e-)/,unformat:/(e\+|e-)/},format:function(a,c,p){var f,h=typeof a=="number"&&!t._.isNaN(a)?a.toExponential():"0e+0",x=h.split("e");return c=c.replace(/e[\+|\-]{1}0/,""),f=t._.numberToFormat(Number(x[0]),c,p),f+"e"+x[1]},unformat:function(a){var c=t._.includes(a,"e+")?a.split("e+"):a.split("e-"),p=Number(c[0]),f=Number(c[1]);f=t._.includes(a,"e-")?f*=-1:f;function h(x,v,C,w){var m=t._.correctionFactor(x,v),S=x*m*(v*m)/(m*m);return S}return t._.reduce([p,Math.pow(10,f)],h,1)}})}(),function(){t.register("format","ordinal",{regexps:{format:/(o)/},format:function(a,c,p){var f=t.locales[t.options.currentLocale],h,x=t._.includes(c," o")?" ":"";return c=c.replace(/\s?o/,""),x+=f.ordinal(a),h=t._.numberToFormat(a,c,p),h+x}})}(),function(){t.register("format","percentage",{regexps:{format:/(%)/,unformat:/(%)/},format:function(a,c,p){var f=t._.includes(c," %")?" ":"",h;return t.options.scalePercentBy100&&(a=a*100),c=c.replace(/\s?\%/,""),h=t._.numberToFormat(a,c,p),t._.includes(h,")")?(h=h.split(""),h.splice(-1,0,f+"%"),h=h.join("")):h=h+f+"%",h},unformat:function(a){var c=t._.stringToNumber(a);return t.options.scalePercentBy100?c*.01:c}})}(),function(){t.register("format","time",{regexps:{format:/(:)/,unformat:/(:)/},format:function(a,c,p){var f=Math.floor(a/60/60),h=Math.floor((a-f*60*60)/60),x=Math.round(a-f*60*60-h*60);return f+":"+(h<10?"0"+h:h)+":"+(x<10?"0"+x:x)},unformat:function(a){var c=a.split(":"),p=0;return c.length===3?(p=p+Number(c[0])*60*60,p=p+Number(c[1])*60,p=p+Number(c[2])):c.length===2&&(p=p+Number(c[0])*60,p=p+Number(c[1])),Number(p)}})}(),t})})(Q1);var v4=Q1.exports;const Km=bs(v4),x4=["B","kB","MB","GB","TB","PB","EB","ZB","YB"],w4=["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],S4=["b","kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],_4=["b","kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],Gm=(e,t,n)=>{let r=e;return typeof t=="string"||Array.isArray(t)?r=e.toLocaleString(t,n):(t===!0||n!==void 0)&&(r=e.toLocaleString(void 0,n)),r};function k4(e,t){if(!Number.isFinite(e))throw new TypeError(`Expected a finite number, got ${typeof e}: ${e}`);t={bits:!1,binary:!1,space:!0,...t};const n=t.bits?t.binary?_4:S4:t.binary?w4:x4,r=t.space?" ":"";if(t.signed&&e===0)return` 0${r}${n[0]}`;const o=e<0,i=o?"-":t.signed?"+":"";o&&(e=-e);let l;if(t.minimumFractionDigits!==void 0&&(l={minimumFractionDigits:t.minimumFractionDigits}),t.maximumFractionDigits!==void 0&&(l={maximumFractionDigits:t.maximumFractionDigits,...l}),e<1){const c=Gm(e,t.locale,l);return i+c+r+n[0]}const s=Math.min(Math.floor(t.binary?Math.log(e)/Math.log(1024):Math.log10(e)/3),n.length-1);e/=(t.binary?1024:1e3)**s,l||(e=e.toPrecision(3));const u=Gm(Number(e),t.locale,l),a=n[s];return i+u+r+a}function b4(e){if(typeof e!="number")throw new TypeError("Expected a number");const t=e>0?Math.floor:Math.ceil;return{days:t(e/864e5),hours:t(e/36e5)%24,minutes:t(e/6e4)%60,seconds:t(e/1e3)%60,milliseconds:t(e)%1e3,microseconds:t(e*1e3)%1e3,nanoseconds:t(e*1e6)%1e3}}const E4=(e,t)=>t===1?e:`${e}s`,C4=1e-7;function T4(e,t={}){if(!Number.isFinite(e))throw new TypeError("Expected a finite number");t.colonNotation&&(t.compact=!1,t.formatSubMilliseconds=!1,t.separateMilliseconds=!1,t.verbose=!1),t.compact&&(t.secondsDecimalDigits=0,t.millisecondsDecimalDigits=0);const n=[],r=(l,s)=>{const u=Math.floor(l*10**s+C4);return(Math.round(u)/10**s).toFixed(s)},o=(l,s,u,a)=>{if((n.length===0||!t.colonNotation)&&l===0&&!(t.colonNotation&&u==="m"))return;a=(a||l||"0").toString();let c,p;if(t.colonNotation){c=n.length>0?":":"",p="";const f=a.includes(".")?a.split(".")[0].length:a.length,h=n.length>0?2:1;a="0".repeat(Math.max(0,h-f))+a}else c="",p=t.verbose?" "+E4(s,l):u;n.push(c+a+p)},i=b4(e);if(o(Math.trunc(i.days/365),"year","y"),o(i.days%365,"day","d"),o(i.hours,"hour","h"),o(i.minutes,"minute","m"),t.separateMilliseconds||t.formatSubMilliseconds||!t.colonNotation&&e<1e3)if(o(i.seconds,"second","s"),t.formatSubMilliseconds)o(i.milliseconds,"millisecond","ms"),o(i.microseconds,"microsecond","µs"),o(i.nanoseconds,"nanosecond","ns");else{const l=i.milliseconds+i.microseconds/1e3+i.nanoseconds/1e6,s=typeof t.millisecondsDecimalDigits=="number"?t.millisecondsDecimalDigits:0,u=l>=1?Math.round(l):Math.ceil(l),a=s?l.toFixed(s):u;o(Number.parseFloat(a),"millisecond","ms",a)}else{const l=e/1e3%60,s=typeof t.secondsDecimalDigits=="number"?t.secondsDecimalDigits:1,u=r(l,s),a=t.keepDecimalsOnWholeSeconds?u:u.replace(/\.0+$/,"");o(Number.parseFloat(a),"second","s",a)}if(n.length===0)return"0"+(t.verbose?" milliseconds":"ms");if(t.compact)return n[0];if(typeof t.unitCount=="number"){const l=t.colonNotation?"":" ";return n.slice(0,Math.max(t.unitCount,1)).join(l)}return t.colonNotation?n.join(""):n.join(" ")}const P4=!0,Lt="u-",R4="uplot",M4=Lt+"hz",$4=Lt+"vt",N4=Lt+"title",O4=Lt+"wrap",z4=Lt+"under",L4=Lt+"over",A4=Lt+"axis",No=Lt+"off",I4=Lt+"select",D4=Lt+"cursor-x",B4=Lt+"cursor-y",F4=Lt+"cursor-pt",j4=Lt+"legend",W4=Lt+"live",H4=Lt+"inline",U4=Lt+"series",V4=Lt+"marker",Ym=Lt+"label",K4=Lt+"value",Fl="width",jl="height",Ol="top",qm="bottom",di="left",Ef="right",oh="#000",Qm=oh+"0",Xm="mousemove",Zm="mousedown",Cf="mouseup",Jm="mouseenter",eg="mouseleave",tg="dblclick",G4="resize",Y4="scroll",ng="change",hu="dppxchange",ih="--",ll=typeof window<"u",Nd=ll?document:null,Bi=ll?window:null,q4=ll?navigator:null;let Fe,ha;function Od(){let e=devicePixelRatio;Fe!=e&&(Fe=e,ha&&Ld(ng,ha,Od),ha=matchMedia(`(min-resolution: ${Fe-.001}dppx) and (max-resolution: ${Fe+.001}dppx)`),Fo(ng,ha,Od),Bi.dispatchEvent(new CustomEvent(hu)))}function Pn(e,t){if(t!=null){let n=e.classList;!n.contains(t)&&n.add(t)}}function zd(e,t){let n=e.classList;n.contains(t)&&n.remove(t)}function lt(e,t,n){e.style[t]=n+"px"}function rr(e,t,n,r){let o=Nd.createElement(e);return t!=null&&Pn(o,t),n!=null&&n.insertBefore(o,r),o}function jn(e,t){return rr("div",e,t)}const rg=new WeakMap;function pi(e,t,n,r,o){let i="translate("+t+"px,"+n+"px)",l=rg.get(e);i!=l&&(e.style.transform=i,rg.set(e,i),t<0||n<0||t>r||n>o?Pn(e,No):zd(e,No))}const og=new WeakMap;function Q4(e,t,n){let r=t+n,o=og.get(e);r!=o&&(og.set(e,r),e.style.background=t,e.style.borderColor=n)}const ig=new WeakMap;function X4(e,t,n,r){let o=t+""+n,i=ig.get(e);o!=i&&(ig.set(e,o),e.style.height=n+"px",e.style.width=t+"px",e.style.marginLeft=r?-t/2+"px":0,e.style.marginTop=r?-n/2+"px":0)}const lh={passive:!0},X1={...lh,capture:!0};function Fo(e,t,n,r){t.addEventListener(e,n,r?X1:lh)}function Ld(e,t,n,r){t.removeEventListener(e,n,r?X1:lh)}ll&&Od();function Gr(e,t,n,r){let o;n=n||0,r=r||t.length-1;let i=r<=2147483647;for(;r-n>1;)o=i?n+r>>1:Ln((n+r)/2),t[o]=t&&o<=n;o+=r)if(e[o]!=null)return o;return-1}function Z4(e,t,n,r){let o=Me,i=-Me;if(r==1)o=e[t],i=e[n];else if(r==-1)o=e[n],i=e[t];else for(let l=t;l<=n;l++){let s=e[l];s!=null&&(si&&(i=s))}return[o,i]}function J4(e,t,n){let r=Me,o=-Me;for(let i=t;i<=n;i++){let l=e[i];l!=null&&l>0&&(lo&&(o=l))}return[r==Me?1:r,o==-Me?10:o]}function Sc(e,t,n,r){let o=ag(e),i=ag(t),l=n==10?Or:Z1;e==t&&(o==-1?(e*=n,t/=n):(e/=n,t*=n));let s=o==1?Ln:Qi,u=i==1?Qi:Ln,a=s(l(Ht(e))),c=u(l(Ht(t))),p=Xi(n,a),f=Xi(n,c);return n==10&&(a<0&&(p=qe(p,-a)),c<0&&(f=qe(f,-c))),r||n==2?(e=p*o,t=f*i):(e=ex(e,p),t=Ji(t,f)),[e,t]}function sh(e,t,n,r){let o=Sc(e,t,n,r);return e==0&&(o[0]=0),t==0&&(o[1]=0),o}const ah=.1,lg={mode:3,pad:ah},Jl={pad:0,soft:null,mode:0},eP={min:Jl,max:Jl};function mu(e,t,n,r){return _c(n)?sg(e,t,n):(Jl.pad=n,Jl.soft=r?0:null,Jl.mode=r?3:0,sg(e,t,eP))}function je(e,t){return e??t}function tP(e,t,n){for(t=je(t,0),n=je(n,e.length-1);t<=n;){if(e[t]!=null)return!0;t++}return!1}function sg(e,t,n){let r=n.min,o=n.max,i=je(r.pad,0),l=je(o.pad,0),s=je(r.hard,-Me),u=je(o.hard,Me),a=je(r.soft,Me),c=je(o.soft,-Me),p=je(r.mode,0),f=je(o.mode,0),h=t-e,x=Or(h),v=Ut(Ht(e),Ht(t)),C=Or(v),w=Ht(C-x);(h<1e-9||w>10)&&(h=0,(e==0||t==0)&&(h=1e-9,p==2&&a!=Me&&(i=0),f==2&&c!=-Me&&(l=0)));let m=h||v||1e3,S=Or(m),E=Xi(10,Ln(S)),P=m*(h==0?e==0?.1:1:i),N=qe(ex(e-P,E/10),9),R=e>=a&&(p==1||p==3&&N<=a||p==2&&N>=a)?a:Me,z=Ut(s,N=R?R:$n(R,N)),j=m*(h==0?t==0?.1:1:l),O=qe(Ji(t+j,E/10),9),D=t<=c&&(f==1||f==3&&O>=c||f==2&&O<=c)?c:-Me,U=$n(u,O>D&&t<=D?D:Ut(D,O));return z==U&&z==0&&(U=100),[z,U]}const nP=new Intl.NumberFormat(ll?q4.language:"en-US"),uh=e=>nP.format(e),Fn=Math,La=Fn.PI,Ht=Fn.abs,Ln=Fn.floor,Zt=Fn.round,Qi=Fn.ceil,$n=Fn.min,Ut=Fn.max,Xi=Fn.pow,ag=Fn.sign,Or=Fn.log10,Z1=Fn.log2,rP=(e,t=1)=>Fn.sinh(e)*t,Tf=(e,t=1)=>Fn.asinh(e/t),Me=1/0;function ug(e){return(Or((e^e>>31)-(e>>31))|0)+1}function cg(e,t,n){return $n(Ut(e,t),n)}function Re(e){return typeof e=="function"?e:()=>e}const oP=()=>{},iP=e=>e,J1=(e,t)=>t,lP=e=>null,fg=e=>!0,dg=(e,t)=>e==t,Zi=e=>qe(e,14);function Ro(e,t){return Zi(qe(Zi(e/t))*t)}function Ji(e,t){return Zi(Qi(Zi(e/t))*t)}function ex(e,t){return Zi(Ln(Zi(e/t))*t)}function qe(e,t=0){if(sP(e))return e;let n=10**t,r=e*n*(1+Number.EPSILON);return Zt(r)/n}const el=new Map;function tx(e){return((""+e).split(".")[1]||"").length}function ks(e,t,n,r){let o=[],i=r.map(tx);for(let l=t;l=0&&l>=0?0:s)+(l>=i[a]?0:i[a]),f=qe(c,p);o.push(f),el.set(f,p)}}return o}const es={},nx=[],tl=[null,null],Qr=Array.isArray,sP=Number.isInteger,aP=e=>e===void 0;function pg(e){return typeof e=="string"}function _c(e){let t=!1;if(e!=null){let n=e.constructor;t=n==null||n==Object}return t}function hg(e){return e!=null&&typeof e=="object"}const uP=Object.getPrototypeOf(Uint8Array);function jo(e,t=_c){let n;if(Qr(e)){let r=e.find(o=>o!=null);if(Qr(r)||t(r)){n=Array(e.length);for(let o=0;oi){for(o=l-1;o>=0&&e[o]==null;)e[o--]=null;for(o=l+1;ol-s)],o=r[0].length,i=new Map;for(let l=0;l"u"?e=>Promise.resolve().then(e):queueMicrotask;function gP(e){let t=e[0],n=t.length,r=Array(n);for(let i=0;it[i]-t[l]);let o=[];for(let i=0;i=r&&e[o]==null;)o--;if(o<=r)return!0;const i=Ut(1,Ln((o-r+1)/t));for(let l=e[r],s=r+i;s<=o;s+=i){const u=e[s];if(u!=null){if(u<=l)return!1;l=u}}return!0}const rx=["January","February","March","April","May","June","July","August","September","October","November","December"],ox=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function ix(e){return e.slice(0,3)}const xP=ox.map(ix),wP=rx.map(ix),SP={MMMM:rx,MMM:wP,WWWW:ox,WWW:xP};function zl(e){return(e<10?"0":"")+e}function _P(e){return(e<10?"00":e<100?"0":"")+e}const kP={YYYY:e=>e.getFullYear(),YY:e=>(e.getFullYear()+"").slice(2),MMMM:(e,t)=>t.MMMM[e.getMonth()],MMM:(e,t)=>t.MMM[e.getMonth()],MM:e=>zl(e.getMonth()+1),M:e=>e.getMonth()+1,DD:e=>zl(e.getDate()),D:e=>e.getDate(),WWWW:(e,t)=>t.WWWW[e.getDay()],WWW:(e,t)=>t.WWW[e.getDay()],HH:e=>zl(e.getHours()),H:e=>e.getHours(),h:e=>{let t=e.getHours();return t==0?12:t>12?t-12:t},AA:e=>e.getHours()>=12?"PM":"AM",aa:e=>e.getHours()>=12?"pm":"am",a:e=>e.getHours()>=12?"p":"a",mm:e=>zl(e.getMinutes()),m:e=>e.getMinutes(),ss:e=>zl(e.getSeconds()),s:e=>e.getSeconds(),fff:e=>_P(e.getMilliseconds())};function ch(e,t){t=t||SP;let n=[],r=/\{([a-z]+)\}|[^{]+/gi,o;for(;o=r.exec(e);)n.push(o[0][0]=="{"?kP[o[1]]:o[0]);return i=>{let l="";for(let s=0;se%1==0,gu=[1,2,2.5,5],CP=ks(10,-16,0,gu),sx=ks(10,0,16,gu),TP=sx.filter(lx),PP=CP.concat(sx),fh=` +`,ax="{YYYY}",mg=fh+ax,ux="{M}/{D}",Wl=fh+ux,ma=Wl+"/{YY}",cx="{aa}",RP="{h}:{mm}",gi=RP+cx,gg=fh+gi,yg=":{ss}",We=null;function fx(e){let t=e*1e3,n=t*60,r=n*60,o=r*24,i=o*30,l=o*365,u=(e==1?ks(10,0,3,gu).filter(lx):ks(10,-3,0,gu)).concat([t,t*5,t*10,t*15,t*30,n,n*5,n*10,n*15,n*30,r,r*2,r*3,r*4,r*6,r*8,r*12,o,o*2,o*3,o*4,o*5,o*6,o*7,o*8,o*9,o*10,o*15,i,i*2,i*3,i*4,i*6,l,l*2,l*5,l*10,l*25,l*50,l*100]);const a=[[l,ax,We,We,We,We,We,We,1],[o*28,"{MMM}",mg,We,We,We,We,We,1],[o,ux,mg,We,We,We,We,We,1],[r,"{h}"+cx,ma,We,Wl,We,We,We,1],[n,gi,ma,We,Wl,We,We,We,1],[t,yg,ma+" "+gi,We,Wl+" "+gi,We,gg,We,1],[e,yg+".{fff}",ma+" "+gi,We,Wl+" "+gi,We,gg,We,1]];function c(p){return(f,h,x,v,C,w)=>{let m=[],S=C>=l,E=C>=i&&C=o?o:C,O=Ln(x)-Ln(N),D=z+O+Ji(N-z,j);m.push(D);let U=p(D),V=U.getHours()+U.getMinutes()/n+U.getSeconds()/r,ee=C/r,le=f.axes[h]._space,me=w/le;for(;D=qe(D+C,e==1?0:3),!(D>v);)if(ee>1){let se=Ln(qe(V+ee,6))%24,G=p(D).getHours()-se;G>1&&(G=-1),D-=G*r,V=(V+ee)%24;let oe=m[m.length-1];qe((D-oe)/C,3)*me>=.7&&m.push(D)}else m.push(D)}return m}}return[u,a,c]}const[MP,$P,NP]=fx(1),[OP,zP,LP]=fx(.001);ks(2,-53,53,[1]);function vg(e,t){return e.map(n=>n.map((r,o)=>o==0||o==8||r==null?r:t(o==1||n[8]==0?r:n[1]+r)))}function xg(e,t){return(n,r,o,i,l)=>{let s=t.find(x=>l>=x[0])||t[t.length-1],u,a,c,p,f,h;return r.map(x=>{let v=e(x),C=v.getFullYear(),w=v.getMonth(),m=v.getDate(),S=v.getHours(),E=v.getMinutes(),P=v.getSeconds(),N=C!=u&&s[2]||w!=a&&s[3]||m!=c&&s[4]||S!=p&&s[5]||E!=f&&s[6]||P!=h&&s[7]||s[1];return u=C,a=w,c=m,p=S,f=E,h=P,N(v)})}}function AP(e,t){let n=ch(t);return(r,o,i,l,s)=>o.map(u=>n(e(u)))}function Pf(e,t,n){return new Date(e,t,n)}function wg(e,t){return t(e)}const IP="{YYYY}-{MM}-{DD} {h}:{mm}{aa}";function Sg(e,t){return(n,r,o,i)=>i==null?ih:t(e(r))}function DP(e,t){let n=e.series[t];return n.width?n.stroke(e,t):n.points.width?n.points.stroke(e,t):null}function BP(e,t){return e.series[t].fill(e,t)}const FP={show:!0,live:!0,isolate:!1,mount:oP,markers:{show:!0,width:2,stroke:DP,fill:BP,dash:"solid"},idx:null,idxs:null,values:[]};function jP(e,t){let n=e.cursor.points,r=jn(),o=n.size(e,t);lt(r,Fl,o),lt(r,jl,o);let i=o/-2;lt(r,"marginLeft",i),lt(r,"marginTop",i);let l=n.width(e,t,o);return l&<(r,"borderWidth",l),r}function WP(e,t){let n=e.series[t].points;return n._fill||n._stroke}function HP(e,t){let n=e.series[t].points;return n._stroke||n._fill}function UP(e,t){return e.series[t].points.size}function VP(e,t,n){return n}const Rf=[0,0];function KP(e,t,n){return Rf[0]=t,Rf[1]=n,Rf}function ga(e,t,n,r=!0){return o=>{o.button==0&&(!r||o.target==t)&&n(o)}}function Mf(e,t,n,r=!0){return o=>{(!r||o.target==t)&&n(o)}}const GP={show:!0,x:!0,y:!0,lock:!1,move:KP,points:{show:jP,size:UP,width:0,stroke:HP,fill:WP},bind:{mousedown:ga,mouseup:ga,click:ga,dblclick:ga,mousemove:Mf,mouseleave:Mf,mouseenter:Mf},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,click:(e,t)=>{t.stopPropagation(),t.stopImmediatePropagation()},_x:!1,_y:!1},focus:{prox:-1,bias:0},left:-10,top:-10,idx:null,dataIdx:VP,idxs:null,event:null},dx={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},dh=Tt({},dx,{filter:J1}),px=Tt({},dh,{size:10}),hx=Tt({},dx,{show:!1}),ph='12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',mx="bold "+ph,gx=1.5,_g={show:!0,scale:"x",stroke:oh,space:50,gap:5,size:50,labelGap:0,labelSize:30,labelFont:mx,side:2,grid:dh,ticks:px,border:hx,font:ph,lineGap:gx,rotate:0},YP="Value",qP="Time",kg={show:!0,scale:"x",auto:!1,sorted:1,min:Me,max:-Me,idxs:[]};function QP(e,t,n,r,o){return t.map(i=>i==null?"":uh(i))}function XP(e,t,n,r,o,i,l){let s=[],u=el.get(o)||0;n=l?n:qe(Ji(n,o),u);for(let a=n;a<=r;a=qe(a+o,u))s.push(Object.is(a,-0)?0:a);return s}function Ad(e,t,n,r,o,i,l){const s=[],u=e.scales[e.axes[t].scale].log,a=u==10?Or:Z1,c=Ln(a(n));o=Xi(u,c),u==10&&c<0&&(o=qe(o,-c));let p=n;do s.push(p),p=p+o,u==10&&(p=qe(p,el.get(o))),p>=o*u&&(o=p);while(p<=r);return s}function ZP(e,t,n,r,o,i,l){let u=e.scales[e.axes[t].scale].asinh,a=r>u?Ad(e,t,Ut(u,n),r,o):[u],c=r>=0&&n<=0?[0]:[];return(n<-u?Ad(e,t,Ut(u,-r),-n,o):[u]).reverse().map(f=>-f).concat(c,a)}const yx=/./,JP=/[12357]/,e5=/[125]/,bg=/1/,Id=(e,t,n,r)=>e.map((o,i)=>t==4&&o==0||i%r==0&&n.test(o.toExponential()[o<0?1:0])?o:null);function t5(e,t,n,r,o){let i=e.axes[n],l=i.scale,s=e.scales[l],u=e.valToPos,a=i._space,c=u(10,l),p=u(9,l)-c>=a?yx:u(7,l)-c>=a?JP:u(5,l)-c>=a?e5:bg;if(p==bg){let f=Ht(u(1,l)-c);if(fo,Tg={show:!0,auto:!0,sorted:0,gaps:vx,alpha:1,facets:[Tt({},Cg,{scale:"x"}),Tt({},Cg,{scale:"y"})]},Pg={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:vx,alpha:1,points:{show:i5,filter:null},values:null,min:Me,max:-Me,idxs:[],path:null,clip:null};function l5(e,t,n,r,o){return n/10}const xx={time:P4,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},s5=Tt({},xx,{time:!1,ori:1}),Rg={};function wx(e,t){let n=Rg[e];return n||(n={key:e,plots:[],sub(r){n.plots.push(r)},unsub(r){n.plots=n.plots.filter(o=>o!=r)},pub(r,o,i,l,s,u,a){for(let c=0;c{let w=l.pxRound;const m=a.dir*(a.ori==0?1:-1),S=a.ori==0?sl:al;let E,P;m==1?(E=n,P=r):(E=r,P=n);let N=w(p(s[E],a,v,h)),R=w(f(u[E],c,C,x)),z=w(p(s[P],a,v,h)),j=w(f(i==1?c.max:c.min,c,C,x)),O=new Path2D(o);return S(O,z,j),S(O,N,j),S(O,N,R),O})}function bc(e,t,n,r,o,i){let l=null;if(e.length>0){l=new Path2D;const s=t==0?Tc:mh;let u=n;for(let p=0;pf[0]){let h=f[0]-u;h>0&&s(l,u,r,h,r+i),u=f[1]}}let a=n+o-u,c=10;a>0&&s(l,u,r-c/2,a,r+i+c)}return l}function u5(e,t,n){let r=e[e.length-1];r&&r[0]==t?r[1]=n:e.push([t,n])}function hh(e,t,n,r,o,i,l){let s=[],u=e.length;for(let a=o==1?n:r;a>=n&&a<=r;a+=o)if(t[a]===null){let p=a,f=a;if(o==1)for(;++a<=r&&t[a]===null;)f=a;else for(;--a>=n&&t[a]===null;)f=a;let h=i(e[p]),x=f==p?h:i(e[f]),v=p-o;h=l<=0&&v>=0&&v=0&&w>=0&&w=h&&s.push([h,x])}return s}function Mg(e){return e==0?iP:e==1?Zt:t=>Ro(t,e)}function Sx(e){let t=e==0?Ec:Cc,n=e==0?(o,i,l,s,u,a)=>{o.arcTo(i,l,s,u,a)}:(o,i,l,s,u,a)=>{o.arcTo(l,i,u,s,a)},r=e==0?(o,i,l,s,u)=>{o.rect(i,l,s,u)}:(o,i,l,s,u)=>{o.rect(l,i,u,s)};return(o,i,l,s,u,a=0,c=0)=>{a==0&&c==0?r(o,i,l,s,u):(a=$n(a,s/2,u/2),c=$n(c,s/2,u/2),t(o,i+a,l),n(o,i+s,l,i+s,l+u,a),n(o,i+s,l+u,i,l+u,c),n(o,i,l+u,i,l,c),n(o,i,l,i+s,l,a),o.closePath())}}const Ec=(e,t,n)=>{e.moveTo(t,n)},Cc=(e,t,n)=>{e.moveTo(n,t)},sl=(e,t,n)=>{e.lineTo(t,n)},al=(e,t,n)=>{e.lineTo(n,t)},Tc=Sx(0),mh=Sx(1),_x=(e,t,n,r,o,i)=>{e.arc(t,n,r,o,i)},kx=(e,t,n,r,o,i)=>{e.arc(n,t,r,o,i)},bx=(e,t,n,r,o,i,l)=>{e.bezierCurveTo(t,n,r,o,i,l)},Ex=(e,t,n,r,o,i,l)=>{e.bezierCurveTo(n,t,o,r,l,i)};function Cx(e){return(t,n,r,o,i)=>Zo(t,n,(l,s,u,a,c,p,f,h,x,v,C)=>{let{pxRound:w,points:m}=l,S,E;a.ori==0?(S=Ec,E=_x):(S=Cc,E=kx);const P=qe(m.width*Fe,3);let N=(m.size-m.width)/2*Fe,R=qe(N*2,3),z=new Path2D,j=new Path2D,{left:O,top:D,width:U,height:V}=t.bbox;Tc(j,O-R,D-R,U+R*2,V+R*2);const ee=le=>{if(u[le]!=null){let me=w(p(s[le],a,v,h)),se=w(f(u[le],c,C,x));S(z,me+N,se),E(z,me,se,N,0,La*2)}};if(i)i.forEach(ee);else for(let le=r;le<=o;le++)ee(le);return{stroke:P>0?z:null,fill:z,clip:j,flags:qo|yu}})}function Tx(e){return(t,n,r,o,i,l)=>{r!=o&&(i!=r&&l!=r&&e(t,n,r),i!=o&&l!=o&&e(t,n,o),e(t,n,l))}}const c5=Tx(sl),f5=Tx(al);function Px(e){const t=je(e==null?void 0:e.alignGaps,0);return(n,r,o,i)=>Zo(n,r,(l,s,u,a,c,p,f,h,x,v,C)=>{let w=l.pxRound,m=Z=>w(p(Z,a,v,h)),S=Z=>w(f(Z,c,C,x)),E,P;a.ori==0?(E=sl,P=c5):(E=al,P=f5);const N=a.dir*(a.ori==0?1:-1),R={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:qo},z=R.stroke;let j=Me,O=-Me,D,U,V,ee=m(s[N==1?o:i]),le=qi(u,o,i,1*N),me=qi(u,o,i,-1*N),se=m(s[le]),H=m(s[me]),ne=!1;for(let Z=N==1?o:i;Z>=o&&Z<=i;Z+=N){let xe=m(s[Z]),te=u[Z];xe==ee?te!=null?(U=S(te),j==Me&&(E(z,xe,U),D=U),j=$n(U,j),O=Ut(U,O)):te===null&&(ne=!0):(j!=Me&&(P(z,ee,j,O,D,U),V=ee),te!=null?(U=S(te),E(z,xe,U),j=O=D=U):(j=Me,O=-Me,te===null&&(ne=!0)),ee=xe)}j!=Me&&j!=O&&V!=ee&&P(z,ee,j,O,D,U);let[G,oe]=kc(n,r);if(l.fill!=null||G!=0){let Z=R.fill=new Path2D(z),xe=l.fillTo(n,r,l.min,l.max,G),te=S(xe);E(Z,H,te),E(Z,se,te)}if(!l.spanGaps){let Z=[];ne&&Z.push(...hh(s,u,o,i,N,m,t)),R.gaps=Z=l.gaps(n,r,o,i,Z),R.clip=bc(Z,a.ori,h,x,v,C)}return oe!=0&&(R.band=oe==2?[zr(n,r,o,i,z,-1),zr(n,r,o,i,z,1)]:zr(n,r,o,i,z,oe)),R})}function d5(e){const t=je(e.align,1),n=je(e.ascDesc,!1),r=je(e.alignGaps,0),o=je(e.extend,!1);return(i,l,s,u)=>Zo(i,l,(a,c,p,f,h,x,v,C,w,m,S)=>{let E=a.pxRound,{left:P,width:N}=i.bbox,R=G=>E(x(G,f,m,C)),z=G=>E(v(G,h,S,w)),j=f.ori==0?sl:al;const O={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:qo},D=O.stroke,U=f.dir*(f.ori==0?1:-1);s=qi(p,s,u,1),u=qi(p,s,u,-1);let V=z(p[U==1?s:u]),ee=R(c[U==1?s:u]),le=ee,me=ee;o&&t==-1&&(me=P,j(D,me,V)),j(D,ee,V);for(let G=U==1?s:u;G>=s&&G<=u;G+=U){let oe=p[G];if(oe==null)continue;let Z=R(c[G]),xe=z(oe);t==1?j(D,Z,V):j(D,le,xe),j(D,Z,xe),V=xe,le=Z}let se=le;o&&t==1&&(se=P+N,j(D,se,V));let[H,ne]=kc(i,l);if(a.fill!=null||H!=0){let G=O.fill=new Path2D(D),oe=a.fillTo(i,l,a.min,a.max,H),Z=z(oe);j(G,se,Z),j(G,me,Z)}if(!a.spanGaps){let G=[];G.push(...hh(c,p,s,u,U,R,r));let oe=a.width*Fe/2,Z=n||t==1?oe:-oe,xe=n||t==-1?-oe:oe;G.forEach(te=>{te[0]+=Z,te[1]+=xe}),O.gaps=G=a.gaps(i,l,s,u,G),O.clip=bc(G,f.ori,C,w,m,S)}return ne!=0&&(O.band=ne==2?[zr(i,l,s,u,D,-1),zr(i,l,s,u,D,1)]:zr(i,l,s,u,D,ne)),O})}function p5(e){e=e||es;const t=je(e.size,[.6,Me,1]),n=e.align||0,r=(e.gap||0)*Fe;let o=e.radius;o=o==null?[0,0]:typeof o=="number"?[o,0]:o;const i=Re(o),l=1-t[0],s=je(t[1],Me)*Fe,u=je(t[2],1)*Fe,a=je(e.disp,es),c=je(e.each,h=>{}),{fill:p,stroke:f}=a;return(h,x,v,C)=>Zo(h,x,(w,m,S,E,P,N,R,z,j,O,D)=>{let U=w.pxRound,V,ee;E.ori==0?[V,ee]=i(h,x):[ee,V]=i(h,x);const le=E.dir*(E.ori==0?1:-1),me=P.dir*(P.ori==1?1:-1);let se=E.ori==0?Tc:mh,H=E.ori==0?c:(ce,Oe,Ue,g,k,T,M)=>{c(ce,Oe,Ue,k,g,M,T)},[ne,G]=kc(h,x),oe=P.distr==3?ne==1?P.max:P.min:0,Z=R(oe,P,D,j),xe,te,ye=U(w.width*Fe),ae=!1,Ce=null,Ae=null,Ne=null,Ze=null;p!=null&&(ye==0||f!=null)&&(ae=!0,Ce=p.values(h,x,v,C),Ae=new Map,new Set(Ce).forEach(ce=>{ce!=null&&Ae.set(ce,new Path2D)}),ye>0&&(Ne=f.values(h,x,v,C),Ze=new Map,new Set(Ne).forEach(ce=>{ce!=null&&Ze.set(ce,new Path2D)})));let{x0:ht,size:cn}=a,cr=!0;if(ht!=null&&cn!=null){m=ht.values(h,x,v,C),ht.unit==2&&(m=m.map(Oe=>h.posToVal(z+Oe*O,E.key,!0)));let ce=cn.values(h,x,v,C);cn.unit==2?te=ce[0]*O:te=N(ce[0],E,O,z)-N(0,E,O,z),te=U(te-ye),xe=le==1?-ye/2:te+ye/2}else{let ce=O;if(m.length>1){let Ue=null;for(let g=0,k=1/0;gce&&(cr=!1)}const fn={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:qo|yu};let Zn;G!=0&&(fn.band=new Path2D,Zn=U(R(G==1?P.max:P.min,P,D,j)));const Cn=ae?null:new Path2D,wt=fn.band;let{y0:Je,y1:he}=a,mt=null;Je!=null&&he!=null&&(S=he.values(h,x,v,C),mt=Je.values(h,x,v,C));let At=V*te,_e=ee*te;for(let ce=le==1?v:C;ce>=v&&ce<=C;ce+=le){let Oe=S[ce];if(Oe===void 0)continue;let Ue=E.distr!=2||a!=null?m[ce]:ce,g=N(Ue,E,O,z),k=R(je(Oe,oe),P,D,j);mt!=null&&Oe!=null&&(Z=R(mt[ce],P,D,j));let T=U(g-xe),M=U(Ut(k,Z)),B=U($n(k,Z)),Q=M-B;if(Oe!=null){let de=Oe<0?_e:At,ve=Oe<0?At:_e;ae?(ye>0&&Ne[ce]!=null&&se(Ze.get(Ne[ce]),T,B+Ln(ye/2),te,Ut(0,Q-ye),de,ve),Ce[ce]!=null&&se(Ae.get(Ce[ce]),T,B+Ln(ye/2),te,Ut(0,Q-ye),de,ve)):se(Cn,T,B+Ln(ye/2),te,Ut(0,Q-ye),de,ve),H(h,x,ce,T-ye/2,B,te+ye,Q)}G!=0&&(Oe!=null||cr)&&(me*G==1?(M=B,B=Zn):(B=M,M=Zn),Q=M-B,se(wt,T-ye/2,B,te+ye,Ut(0,Q),0,0))}return ye>0&&(fn.stroke=ae?Ze:Cn),fn.fill=ae?Ae:Cn,fn})}function h5(e,t){const n=je(t==null?void 0:t.alignGaps,0);return(r,o,i,l)=>Zo(r,o,(s,u,a,c,p,f,h,x,v,C,w)=>{let m=s.pxRound,S=se=>m(f(se,c,C,x)),E=se=>m(h(se,p,w,v)),P,N,R;c.ori==0?(P=Ec,R=sl,N=bx):(P=Cc,R=al,N=Ex);const z=c.dir*(c.ori==0?1:-1);i=qi(a,i,l,1),l=qi(a,i,l,-1);let j=S(u[z==1?i:l]),O=j,D=[],U=[];for(let se=z==1?i:l;se>=i&&se<=l;se+=z)if(a[se]!=null){let ne=u[se],G=S(ne);D.push(O=G),U.push(E(a[se]))}const V={stroke:e(D,U,P,R,N,m),fill:null,clip:null,band:null,gaps:null,flags:qo},ee=V.stroke;let[le,me]=kc(r,o);if(s.fill!=null||le!=0){let se=V.fill=new Path2D(ee),H=s.fillTo(r,o,s.min,s.max,le),ne=E(H);R(se,O,ne),R(se,j,ne)}if(!s.spanGaps){let se=[];se.push(...hh(u,a,i,l,z,S,n)),V.gaps=se=s.gaps(r,o,i,l,se),V.clip=bc(se,c.ori,x,v,C,w)}return me!=0&&(V.band=me==2?[zr(r,o,i,l,ee,-1),zr(r,o,i,l,ee,1)]:zr(r,o,i,l,ee,me)),V})}function m5(e){return h5(g5,e)}function g5(e,t,n,r,o,i){const l=e.length;if(l<2)return null;const s=new Path2D;if(n(s,e[0],t[0]),l==2)r(s,e[1],t[1]);else{let u=Array(l),a=Array(l-1),c=Array(l-1),p=Array(l-1);for(let f=0;f0!=a[f]>0?u[f]=0:(u[f]=3*(p[f-1]+p[f])/((2*p[f]+p[f-1])/a[f-1]+(p[f]+2*p[f-1])/a[f]),isFinite(u[f])||(u[f]=0));u[l-1]=a[l-2];for(let f=0;f{Gt.pxRatio=Fe}));const y5=Px(),v5=Cx();function Ng(e,t,n,r){return(r?[e[0],e[1]].concat(e.slice(2)):[e[0]].concat(e.slice(1))).map((i,l)=>Bd(i,l,t,n))}function x5(e,t){return e.map((n,r)=>r==0?null:Tt({},t,n))}function Bd(e,t,n,r){return Tt({},t==0?n:r,e)}function Rx(e,t,n){return t==null?tl:[t,n]}const w5=Rx;function S5(e,t,n){return t==null?tl:mu(t,n,ah,!0)}function Mx(e,t,n,r){return t==null?tl:Sc(t,n,e.scales[r].log,!1)}const _5=Mx;function $x(e,t,n,r){return t==null?tl:sh(t,n,e.scales[r].log,!1)}const k5=$x;function b5(e,t,n,r,o){let i=Ut(ug(e),ug(t)),l=t-e,s=Gr(o/r*l,n);do{let u=n[s],a=r*u/l;if(a>=o&&i+(u<5?el.get(u):0)<=17)return[u,a]}while(++s(t=Zt((n=+o)*Fe))+"px"),[e,t,n]}function E5(e){e.show&&[e.font,e.labelFont].forEach(t=>{let n=qe(t[2]*Fe,1);t[0]=t[0].replace(/[0-9.]+px/,n+"px"),t[1]=n})}function Gt(e,t,n){const r={mode:je(e.mode,1)},o=r.mode;function i(d,y){return((y.distr==3?Or(d>0?d:y.clamp(r,d,y.min,y.max,y.key)):y.distr==4?Tf(d,y.asinh):d)-y._min)/(y._max-y._min)}function l(d,y,_,b){let $=i(d,y);return b+_*(y.dir==-1?1-$:$)}function s(d,y,_,b){let $=i(d,y);return b+_*(y.dir==-1?$:1-$)}function u(d,y,_,b){return y.ori==0?l(d,y,_,b):s(d,y,_,b)}r.valToPosH=l,r.valToPosV=s;let a=!1;r.status=0;const c=r.root=jn(R4);if(e.id!=null&&(c.id=e.id),Pn(c,e.class),e.title){let d=jn(N4,c);d.textContent=e.title}const p=rr("canvas"),f=r.ctx=p.getContext("2d"),h=jn(O4,c);Fo("click",h,d=>{d.target===v&&(et!=ti||tt!=ni)&&Qt.click(r,d)},!0);const x=r.under=jn(z4,h);h.appendChild(p);const v=r.over=jn(L4,h);e=jo(e);const C=+je(e.pxAlign,1),w=Mg(C);(e.plugins||[]).forEach(d=>{d.opts&&(e=d.opts(r,e)||e)});const m=e.ms||.001,S=r.series=o==1?Ng(e.series||[],kg,Pg,!1):x5(e.series||[null],Tg),E=r.axes=Ng(e.axes||[],_g,Eg,!0),P=r.scales={},N=r.bands=e.bands||[];N.forEach(d=>{d.fill=Re(d.fill||null),d.dir=je(d.dir,-1)});const R=o==2?S[1].facets[0].scale:S[0].scale,z={axes:ew,series:qx},j=(e.drawOrder||["axes","series"]).map(d=>z[d]);function O(d){let y=P[d];if(y==null){let _=(e.scales||es)[d]||es;if(_.from!=null)O(_.from),P[d]=Tt({},P[_.from],_,{key:d});else{y=P[d]=Tt({},d==R?xx:s5,_),y.key=d;let b=y.time,$=y.range,I=Qr($);if((d!=R||o==2&&!b)&&(I&&($[0]==null||$[1]==null)&&($={min:$[0]==null?lg:{mode:1,hard:$[0],soft:$[0]},max:$[1]==null?lg:{mode:1,hard:$[1],soft:$[1]}},I=!1),!I&&_c($))){let W=$;$=(q,re,pe)=>re==null?tl:mu(re,pe,W)}y.range=Re($||(b?w5:d==R?y.distr==3?_5:y.distr==4?k5:Rx:y.distr==3?Mx:y.distr==4?$x:S5)),y.auto=Re(I?!1:y.auto),y.clamp=Re(y.clamp||l5),y._min=y._max=null}}}O("x"),O("y"),o==1&&S.forEach(d=>{O(d.scale)}),E.forEach(d=>{O(d.scale)});for(let d in e.scales)O(d);const D=P[R],U=D.distr;let V,ee;D.ori==0?(Pn(c,M4),V=l,ee=s):(Pn(c,$4),V=s,ee=l);const le={};for(let d in P){let y=P[d];(y.min!=null||y.max!=null)&&(le[d]={min:y.min,max:y.max},y.min=y.max=null)}const me=e.tzDate||(d=>new Date(Zt(d/m))),se=e.fmtDate||ch,H=m==1?NP(me):LP(me),ne=xg(me,vg(m==1?$P:zP,se)),G=Sg(me,wg(IP,se)),oe=[],Z=r.legend=Tt({},FP,e.legend),xe=Z.show,te=Z.markers;Z.idxs=oe,te.width=Re(te.width),te.dash=Re(te.dash),te.stroke=Re(te.stroke),te.fill=Re(te.fill);let ye,ae,Ce,Ae=[],Ne=[],Ze,ht=!1,cn={};if(Z.live){const d=S[1]?S[1].values:null;ht=d!=null,Ze=ht?d(r,1,0):{_:0};for(let y in Ze)cn[y]=ih}if(xe)if(ye=rr("table",j4,c),Ce=rr("tbody",null,ye),Z.mount(r,ye),ht){ae=rr("thead",null,ye,Ce);let d=rr("tr",null,ae);rr("th",null,d);for(var cr in Ze)rr("th",Ym,d).textContent=cr}else Pn(ye,H4),Z.live&&Pn(ye,W4);const fn={show:!0},Zn={show:!1};function Cn(d,y){if(y==0&&(ht||!Z.live||o==2))return tl;let _=[],b=rr("tr",U4,Ce,Ce.childNodes[y]);Pn(b,d.class),d.show||Pn(b,No);let $=rr("th",null,b);if(te.show){let q=jn(V4,$);if(y>0){let re=te.width(r,y);re&&(q.style.border=re+"px "+te.dash(r,y)+" "+te.stroke(r,y)),q.style.background=te.fill(r,y)}}let I=jn(Ym,$);I.textContent=d.label,y>0&&(te.show||(I.style.color=d.width>0?te.stroke(r,y):te.fill(r,y)),Je("click",$,q=>{if(ge._lock)return;ut(q);let re=S.indexOf(d);if((q.ctrlKey||q.metaKey)!=Z.isolate){let pe=S.some((Y,fe)=>fe>0&&fe!=re&&Y.show);S.forEach((Y,fe)=>{fe>0&&dr(fe,pe?fe==re?fn:Zn:fn,!0,Et.setSeries)})}else dr(re,{show:!d.show},!0,Et.setSeries)},!1),jr&&Je(Jm,$,q=>{ge._lock||(ut(q),dr(S.indexOf(d),ii,!0,Et.setSeries))},!1));for(var W in Ze){let q=rr("td",K4,b);q.textContent="--",_.push(q)}return[b,_]}const wt=new Map;function Je(d,y,_,b=!0){const $=wt.get(y)||{},I=ge.bind[d](r,y,_,b);I&&(Fo(d,y,$[d]=I),wt.set(y,$))}function he(d,y,_){const b=wt.get(y)||{};for(let $ in b)(d==null||$==d)&&(Ld($,y,b[$]),delete b[$]);d==null&&wt.delete(y)}let mt=0,At=0,_e=0,ce=0,Oe=0,Ue=0,g=0,k=0,T=0,M=0;r.bbox={};let B=!1,Q=!1,de=!1,ve=!1,at=!1,J=!1;function ie(d,y,_){(_||d!=r.width||y!=r.height)&&X(d,y),pl(!1),de=!0,Q=!0,ge.left>=0&&(ve=J=!0),yo()}function X(d,y){r.width=mt=_e=d,r.height=At=ce=y,Oe=Ue=0,br(),Jo();let _=r.bbox;g=_.left=Ro(Oe*Fe,.5),k=_.top=Ro(Ue*Fe,.5),T=_.width=Ro(_e*Fe,.5),M=_.height=Ro(ce*Fe,.5)}const we=3;function bt(){let d=!1,y=0;for(;!d;){y++;let _=Zx(y),b=Jx(y);d=y==we||_&&b,d||(X(r.width,r.height),Q=!0)}}function vn({width:d,height:y}){ie(d,y)}r.setSize=vn;function br(){let d=!1,y=!1,_=!1,b=!1;E.forEach(($,I)=>{if($.show&&$._show){let{side:W,_size:q}=$,re=W%2,pe=$.label!=null?$.labelSize:0,Y=q+pe;Y>0&&(re?(_e-=Y,W==3?(Oe+=Y,b=!0):_=!0):(ce-=Y,W==0?(Ue+=Y,d=!0):y=!0))}}),fr[0]=d,fr[1]=_,fr[2]=y,fr[3]=b,_e-=Wr[1]+Wr[3],Oe+=Wr[3],ce-=Wr[2]+Wr[0],Ue+=Wr[0]}function Jo(){let d=Oe+_e,y=Ue+ce,_=Oe,b=Ue;function $(I,W){switch(I){case 1:return d+=W,d-W;case 2:return y+=W,y-W;case 3:return _-=W,_+W;case 0:return b-=W,b+W}}E.forEach((I,W)=>{if(I.show&&I._show){let q=I.side;I._pos=$(q,I._size),I.label!=null&&(I._lpos=$(q,I.labelSize))}})}const ge=r.cursor=Tt({},GP,{drag:{y:o==2}},e.cursor),ut=d=>{ge.event=d};ge.idxs=oe,ge._lock=!1;let Tn=ge.points;Tn.show=Re(Tn.show),Tn.size=Re(Tn.size),Tn.stroke=Re(Tn.stroke),Tn.width=Re(Tn.width),Tn.fill=Re(Tn.fill);const Er=r.focus=Tt({},e.focus||{alpha:.3},ge.focus),jr=Er.prox>=0;let It=[null];function ul(d,y){if(y>0){let _=ge.points.show(r,y);if(_)return Pn(_,F4),Pn(_,d.class),pi(_,-10,-10,_e,ce),v.insertBefore(_,It[y]),_}}function go(d,y){if(o==1||y>0){let _=o==1&&P[d.scale].time,b=d.value;d.value=_?pg(b)?Sg(me,wg(b,se)):b||G:b||r5,d.label=d.label||(_?qP:YP)}if(y>0){d.width=d.width==null?1:d.width,d.paths=d.paths||y5||lP,d.fillTo=Re(d.fillTo||a5),d.pxAlign=+je(d.pxAlign,C),d.pxRound=Mg(d.pxAlign),d.stroke=Re(d.stroke||null),d.fill=Re(d.fill||null),d._stroke=d._fill=d._paths=d._focus=null;let _=o5(Ut(1,d.width),1),b=d.points=Tt({},{size:_,width:Ut(1,_*.2),stroke:d.stroke,space:_*2,paths:v5,_stroke:null,_fill:null},d.points);b.show=Re(b.show),b.filter=Re(b.filter),b.fill=Re(b.fill),b.stroke=Re(b.stroke),b.paths=Re(b.paths),b.pxAlign=d.pxAlign}if(xe){let _=Cn(d,y);Ae.splice(y,0,_[0]),Ne.splice(y,0,_[1]),Z.values.push(null)}if(ge.show){oe.splice(y,0,null);let _=ul(d,y);_&&It.splice(y,0,_)}Xt("addSeries",y)}function cl(d,y){y=y??S.length,d=o==1?Bd(d,y,kg,Pg):Bd(d,y,null,Tg),S.splice(y,0,d),go(S[y],y)}r.addSeries=cl;function zs(d){if(S.splice(d,1),xe){Z.values.splice(d,1),Ne.splice(d,1);let y=Ae.splice(d,1)[0];he(null,y.firstChild),y.remove()}ge.show&&(oe.splice(d,1),It.length>1&&It.splice(d,1)[0].remove()),Xt("delSeries",d)}r.delSeries=zs;const fr=[!1,!1,!1,!1];function Kx(d,y){if(d._show=d.show,d.show){let _=d.side%2,b=P[d.scale];b==null&&(d.scale=_?S[1].scale:R,b=P[d.scale]);let $=b.time;d.size=Re(d.size),d.space=Re(d.space),d.rotate=Re(d.rotate),Qr(d.incrs)&&d.incrs.forEach(W=>{!el.has(W)&&el.set(W,tx(W))}),d.incrs=Re(d.incrs||(b.distr==2?TP:$?m==1?MP:OP:PP)),d.splits=Re(d.splits||($&&b.distr==1?H:b.distr==3?Ad:b.distr==4?ZP:XP)),d.stroke=Re(d.stroke),d.grid.stroke=Re(d.grid.stroke),d.ticks.stroke=Re(d.ticks.stroke),d.border.stroke=Re(d.border.stroke);let I=d.values;d.values=Qr(I)&&!Qr(I[0])?Re(I):$?Qr(I)?xg(me,vg(I,se)):pg(I)?AP(me,I):I||ne:I||QP,d.filter=Re(d.filter||(b.distr>=3&&b.log==10?t5:b.distr==3&&b.log==2?n5:J1)),d.font=Og(d.font),d.labelFont=Og(d.labelFont),d._size=d.size(r,null,y,0),d._space=d._rotate=d._incrs=d._found=d._splits=d._values=null,d._size>0&&(fr[y]=!0,d._el=jn(A4,h))}}function fl(d,y,_,b){let[$,I,W,q]=_,re=y%2,pe=0;return re==0&&(q||I)&&(pe=y==0&&!$||y==2&&!W?Zt(_g.size/3):0),re==1&&($||W)&&(pe=y==1&&!I||y==3&&!q?Zt(Eg.size/2):0),pe}const vh=r.padding=(e.padding||[fl,fl,fl,fl]).map(d=>Re(je(d,fl))),Wr=r._padding=vh.map((d,y)=>d(r,y,fr,0));let qt,Dt=null,Bt=null;const Ls=o==1?S[0].idxs:null;let Jn=null,As=!1;function xh(d,y){if(t=d==null?[]:jo(d,hg),o==2){qt=0;for(let _=1;_=0,J=!0,yo()}}r.setData=xh;function Rc(){As=!0;let d,y;o==1&&(qt>0?(Dt=Ls[0]=0,Bt=Ls[1]=qt-1,d=t[0][Dt],y=t[0][Bt],U==2?(d=Dt,y=Bt):d==y&&(U==3?[d,y]=Sc(d,d,D.log,!1):U==4?[d,y]=sh(d,d,D.log,!1):D.time?y=d+Zt(86400/m):[d,y]=mu(d,y,ah,!0))):(Dt=Ls[0]=d=null,Bt=Ls[1]=y=null)),ri(R,d,y)}let Is,ei,Mc,$c,Nc,Oc,zc,Lc,Ac,dl;function wh(d,y,_,b,$,I){d??(d=Qm),_??(_=nx),b??(b="butt"),$??($=Qm),I??(I="round"),d!=Is&&(f.strokeStyle=Is=d),$!=ei&&(f.fillStyle=ei=$),y!=Mc&&(f.lineWidth=Mc=y),I!=Nc&&(f.lineJoin=Nc=I),b!=Oc&&(f.lineCap=Oc=b),_!=$c&&f.setLineDash($c=_)}function Sh(d,y,_,b){y!=ei&&(f.fillStyle=ei=y),d!=zc&&(f.font=zc=d),_!=Lc&&(f.textAlign=Lc=_),b!=Ac&&(f.textBaseline=Ac=b)}function Ic(d,y,_,b,$=0){if(b.length>0&&d.auto(r,As)&&(y==null||y.min==null)){let I=je(Dt,0),W=je(Bt,b.length-1),q=_.min==null?d.distr==3?J4(b,I,W):Z4(b,I,W,$):[_.min,_.max];d.min=$n(d.min,_.min=q[0]),d.max=Ut(d.max,_.max=q[1])}}function Gx(){let d=jo(P,hg);for(let b in d){let $=d[b],I=le[b];if(I!=null&&I.min!=null)Tt($,I),b==R&&pl(!0);else if(b!=R||o==2)if(qt==0&&$.from==null){let W=$.range(r,null,null,b);$.min=W[0],$.max=W[1]}else $.min=Me,$.max=-Me}if(qt>0){S.forEach((b,$)=>{if(o==1){let I=b.scale,W=d[I],q=le[I];if($==0){let re=W.range(r,W.min,W.max,I);W.min=re[0],W.max=re[1],Dt=Gr(W.min,t[0]),Bt=Gr(W.max,t[0]),Bt-Dt>1&&(t[0][Dt]W.max&&Bt--),b.min=Jn[Dt],b.max=Jn[Bt]}else b.show&&b.auto&&Ic(W,q,b,t[$],b.sorted);b.idxs[0]=Dt,b.idxs[1]=Bt}else if($>0&&b.show&&b.auto){let[I,W]=b.facets,q=I.scale,re=W.scale,[pe,Y]=t[$];Ic(d[q],le[q],I,pe,I.sorted),Ic(d[re],le[re],W,Y,W.sorted),b.min=W.min,b.max=W.max}});for(let b in d){let $=d[b],I=le[b];if($.from==null&&(I==null||I.min==null)){let W=$.range(r,$.min==Me?null:$.min,$.max==-Me?null:$.max,b);$.min=W[0],$.max=W[1]}}}for(let b in d){let $=d[b];if($.from!=null){let I=d[$.from];if(I.min==null)$.min=$.max=null;else{let W=$.range(r,I.min,I.max,b);$.min=W[0],$.max=W[1]}}}let y={},_=!1;for(let b in d){let $=d[b],I=P[b];if(I.min!=$.min||I.max!=$.max){I.min=$.min,I.max=$.max;let W=I.distr;I._min=W==3?Or(I.min):W==4?Tf(I.min,I.asinh):I.min,I._max=W==3?Or(I.max):W==4?Tf(I.max,I.asinh):I.max,y[b]=_=!0}}if(_){S.forEach((b,$)=>{o==2?$>0&&y.y&&(b._paths=null):y[b.scale]&&(b._paths=null)});for(let b in y)de=!0,Xt("setScale",b);ge.show&&ge.left>=0&&(ve=J=!0)}for(let b in le)le[b]=null}function Yx(d){let y=cg(Dt-1,0,qt-1),_=cg(Bt+1,0,qt-1);for(;d[y]==null&&y>0;)y--;for(;d[_]==null&&_0&&(S.forEach((d,y)=>{if(y>0&&d.show&&d._paths==null){let _=o==2?[0,t[y][0].length-1]:Yx(t[y]);d._paths=d.paths(r,y,_[0],_[1])}}),S.forEach((d,y)=>{if(y>0&&d.show){dl!=d.alpha&&(f.globalAlpha=dl=d.alpha),_h(y,!1),d._paths&&kh(y,!1);{_h(y,!0);let _=d._paths?d._paths.gaps:null,b=d.points.show(r,y,Dt,Bt,_),$=d.points.filter(r,y,b,_);(b||$)&&(d.points._paths=d.points.paths(r,y,Dt,Bt,$),kh(y,!0))}dl!=1&&(f.globalAlpha=dl=1),Xt("drawSeries",y)}}))}function _h(d,y){let _=y?S[d].points:S[d];_._stroke=_.stroke(r,d),_._fill=_.fill(r,d)}function kh(d,y){let _=y?S[d].points:S[d],b=_._stroke,$=_._fill,{stroke:I,fill:W,clip:q,flags:re}=_._paths,pe=null,Y=qe(_.width*Fe,3),fe=Y%2/2;y&&$==null&&($=Y>0?"#fff":b);let ke=_.pxAlign==1&&fe>0;if(ke&&f.translate(fe,fe),!y){let gt=g-Y/2,Pe=k-Y/2,Ie=T+Y,Le=M+Y;pe=new Path2D,pe.rect(gt,Pe,Ie,Le)}y?Dc(b,Y,_.dash,_.cap,$,I,W,re,q):Qx(d,b,Y,_.dash,_.cap,$,I,W,re,pe,q),ke&&f.translate(-fe,-fe)}function Qx(d,y,_,b,$,I,W,q,re,pe,Y){let fe=!1;N.forEach((ke,gt)=>{if(ke.series[0]==d){let Pe=S[ke.series[1]],Ie=t[ke.series[1]],Le=(Pe._paths||es).band;Qr(Le)&&(Le=ke.dir==1?Le[0]:Le[1]);let Ve,ct=null;Pe.show&&Le&&tP(Ie,Dt,Bt)?(ct=ke.fill(r,gt)||I,Ve=Pe._paths.clip):Le=null,Dc(y,_,b,$,ct,W,q,re,pe,Y,Ve,Le),fe=!0}}),fe||Dc(y,_,b,$,I,W,q,re,pe,Y)}const bh=qo|yu;function Dc(d,y,_,b,$,I,W,q,re,pe,Y,fe){wh(d,y,_,b,$),(re||pe||fe)&&(f.save(),re&&f.clip(re),pe&&f.clip(pe)),fe?(q&bh)==bh?(f.clip(fe),Y&&f.clip(Y),Bs($,W),Ds(d,I,y)):q&yu?(Bs($,W),f.clip(fe),Ds(d,I,y)):q&qo&&(f.save(),f.clip(fe),Y&&f.clip(Y),Bs($,W),f.restore(),Ds(d,I,y)):(Bs($,W),Ds(d,I,y)),(re||pe||fe)&&f.restore()}function Ds(d,y,_){_>0&&(y instanceof Map?y.forEach((b,$)=>{f.strokeStyle=Is=$,f.stroke(b)}):y!=null&&d&&f.stroke(y))}function Bs(d,y){y instanceof Map?y.forEach((_,b)=>{f.fillStyle=ei=b,f.fill(_)}):y!=null&&d&&f.fill(y)}function Xx(d,y,_,b){let $=E[d],I;if(b<=0)I=[0,0];else{let W=$._space=$.space(r,d,y,_,b),q=$._incrs=$.incrs(r,d,y,_,b,W);I=b5(y,_,q,b,W)}return $._found=I}function Bc(d,y,_,b,$,I,W,q,re,pe){let Y=W%2/2;C==1&&f.translate(Y,Y),wh(q,W,re,pe,q),f.beginPath();let fe,ke,gt,Pe,Ie=$+(b==0||b==3?-I:I);_==0?(ke=$,Pe=Ie):(fe=$,gt=Ie);for(let Le=0;Le{if(!_.show)return;let $=P[_.scale];if($.min==null){_._show&&(y=!1,_._show=!1,pl(!1));return}else _._show||(y=!1,_._show=!0,pl(!1));let I=_.side,W=I%2,{min:q,max:re}=$,[pe,Y]=Xx(b,q,re,W==0?_e:ce);if(Y==0)return;let fe=$.distr==2,ke=_._splits=_.splits(r,b,q,re,pe,Y,fe),gt=$.distr==2?ke.map(Ve=>Jn[Ve]):ke,Pe=$.distr==2?Jn[ke[1]]-Jn[ke[0]]:pe,Ie=_._values=_.values(r,_.filter(r,gt,b,Y,Pe),b,Y,Pe);_._rotate=I==2?_.rotate(r,Ie,b,Y):0;let Le=_._size;_._size=Qi(_.size(r,Ie,b,d)),Le!=null&&_._size!=Le&&(y=!1)}),y}function Jx(d){let y=!0;return vh.forEach((_,b)=>{let $=_(r,b,fr,d);$!=Wr[b]&&(y=!1),Wr[b]=$}),y}function ew(){for(let d=0;dJn[tr]):Pe,Le=Y.distr==2?Jn[Pe[1]]-Jn[Pe[0]]:re,Ve=y.ticks,ct=y.border,xn=Ve.show?Zt(Ve.size*Fe):0,nt=y._rotate*-La/180,Ct=w(y._pos*Fe),rn=(xn+gt)*q,St=Ct+rn;I=b==0?St:0,$=b==1?St:0;let pn=y.font[0],er=y.align==1?di:y.align==2?Ef:nt>0?di:nt<0?Ef:b==0?"center":_==3?Ef:di,Vr=nt||b==1?"middle":_==2?Ol:qm;Sh(pn,W,er,Vr);let Hh=y.font[1]*y.lineGap,Vs=Pe.map(tr=>w(u(tr,Y,fe,ke))),Uh=y._values;for(let tr=0;tr{_>0&&(y._paths=null,d&&(o==1?(y.min=null,y.max=null):y.facets.forEach(b=>{b.min=null,b.max=null})))})}let Fc=!1;function yo(){Fc||(mP(tw),Fc=!0)}function tw(){B&&(Gx(),B=!1),de&&(bt(),de=!1),Q&&(lt(x,di,Oe),lt(x,Ol,Ue),lt(x,Fl,_e),lt(x,jl,ce),lt(v,di,Oe),lt(v,Ol,Ue),lt(v,Fl,_e),lt(v,jl,ce),lt(h,Fl,mt),lt(h,jl,At),p.width=Zt(mt*Fe),p.height=Zt(At*Fe),E.forEach(({_el:d,_show:y,_size:_,_pos:b,side:$})=>{if(d!=null)if(y){let I=$===3||$===0?_:0,W=$%2==1;lt(d,W?"left":"top",b-I),lt(d,W?"width":"height",_),lt(d,W?"top":"left",W?Ue:Oe),lt(d,W?"height":"width",W?ce:_e),zd(d,No)}else Pn(d,No)}),Is=ei=Mc=Nc=Oc=zc=Lc=Ac=$c=null,dl=1,xl(!0),Xt("setSize"),Q=!1),mt>0&&At>0&&(f.clearRect(0,0,p.width,p.height),Xt("drawClear"),j.forEach(d=>d()),Xt("draw")),dn.show&&at&&(Ws(dn),at=!1),ge.show&&ve&&(vo(null,!0,!1),ve=!1),Z.show&&Z.live&&J&&(Uc(),J=!1),a||(a=!0,r.status=1,Xt("ready")),As=!1,Fc=!1}r.redraw=(d,y)=>{de=y||!1,d!==!1?ri(R,D.min,D.max):yo()};function jc(d,y){let _=P[d];if(_.from==null){if(qt==0){let b=_.range(r,y.min,y.max,d);y.min=b[0],y.max=b[1]}if(y.min>y.max){let b=y.min;y.min=y.max,y.max=b}if(qt>1&&y.min!=null&&y.max!=null&&y.max-y.min<1e-16)return;d==R&&_.distr==2&&qt>0&&(y.min=Gr(y.min,t[0]),y.max=Gr(y.max,t[0]),y.min==y.max&&y.max++),le[d]=y,B=!0,yo()}}r.setScale=jc;let Wc,Hc,Fs,js,Eh,Ch,ti,ni,Th,Ph,et,tt,Hr=!1;const Qt=ge.drag;let Ft=Qt.x,jt=Qt.y;ge.show&&(ge.x&&(Wc=jn(D4,v)),ge.y&&(Hc=jn(B4,v)),D.ori==0?(Fs=Wc,js=Hc):(Fs=Hc,js=Wc),et=ge.left,tt=ge.top);const dn=r.select=Tt({show:!0,over:!0,left:0,width:0,top:0,height:0},e.select),hl=dn.show?jn(I4,dn.over?v:x):null;function Ws(d,y){if(dn.show){for(let _ in d)dn[_]=d[_],_ in Nh&<(hl,_,d[_]);y!==!1&&Xt("setSelect")}}r.setSelect=Ws;function nw(d,y){let _=S[d],b=xe?Ae[d]:null;_.show?b&&zd(b,No):(b&&Pn(b,No),It.length>1&&pi(It[d],-10,-10,_e,ce))}function ri(d,y,_){jc(d,{min:y,max:_})}function dr(d,y,_,b){y.focus!=null&&sw(d),y.show!=null&&S.forEach(($,I)=>{I>0&&(d==I||d==null)&&($.show=y.show,nw(I,y.show),ri(o==2?$.facets[1].scale:$.scale,null,null),yo())}),_!==!1&&Xt("setSeries",d,y),b&&wl("setSeries",r,d,y)}r.setSeries=dr;function rw(d,y){Tt(N[d],y)}function ow(d,y){d.fill=Re(d.fill||null),d.dir=je(d.dir,-1),y=y??N.length,N.splice(y,0,d)}function iw(d){d==null?N.length=0:N.splice(d,1)}r.addBand=ow,r.setBand=rw,r.delBand=iw;function lw(d,y){S[d].alpha=y,ge.show&&It[d]&&(It[d].style.opacity=y),xe&&Ae[d]&&(Ae[d].style.opacity=y)}let oi,ml,gl;const ii={focus:!0};function sw(d){if(d!=gl){let y=d==null,_=Er.alpha!=1;S.forEach((b,$)=>{let I=y||$==0||$==d;b._focus=y?null:I,_&&lw($,I?1:Er.alpha)}),gl=d,_&&yo()}}xe&&jr&&Je(eg,ye,d=>{ge._lock||(ut(d),gl!=null&&dr(null,ii,!0,Et.setSeries))});function pr(d,y,_){let b=P[y];_&&(d=d/Fe-(b.ori==1?Ue:Oe));let $=_e;b.ori==1&&($=ce,d=$-d),b.dir==-1&&(d=$-d);let I=b._min,W=b._max,q=d/$,re=I+(W-I)*q,pe=b.distr;return pe==3?Xi(10,re):pe==4?rP(re,b.asinh):re}function aw(d,y){let _=pr(d,R,y);return Gr(_,t[0],Dt,Bt)}r.valToIdx=d=>Gr(d,t[0]),r.posToIdx=aw,r.posToVal=pr,r.valToPos=(d,y,_)=>P[y].ori==0?l(d,P[y],_?T:_e,_?g:0):s(d,P[y],_?M:ce,_?k:0);function uw(d){d(r),yo()}r.batch=uw,r.setCursor=(d,y,_)=>{et=d.left,tt=d.top,vo(null,y,_)};function Rh(d,y){lt(hl,di,dn.left=d),lt(hl,Fl,dn.width=y)}function Mh(d,y){lt(hl,Ol,dn.top=d),lt(hl,jl,dn.height=y)}let yl=D.ori==0?Rh:Mh,vl=D.ori==1?Rh:Mh;function cw(){if(xe&&Z.live)for(let d=o==2?1:0;d{oe[b]=_}):aP(d.idx)||oe.fill(d.idx),Z.idx=oe[0]);for(let _=0;_0||o==1&&!ht)&&fw(_,oe[_]);xe&&Z.live&&cw(),J=!1,y!==!1&&Xt("setLegend")}r.setLegend=Uc;function fw(d,y){let _=S[d],b=d==0&&U==2?Jn:t[d],$;ht?$=_.values(r,d,y)??cn:($=_.value(r,y==null?null:b[y],d,y),$=$==null?cn:{_:$}),Z.values[d]=$}function vo(d,y,_){Th=et,Ph=tt,[et,tt]=ge.move(r,et,tt),ge.show&&(Fs&&pi(Fs,Zt(et),0,_e,ce),js&&pi(js,0,Zt(tt),_e,ce));let b,$=Dt>Bt;oi=Me;let I=D.ori==0?_e:ce,W=D.ori==1?_e:ce;if(et<0||qt==0||$){b=null;for(let q=0;q0&&It.length>1&&pi(It[q],-10,-10,_e,ce);jr&&dr(null,ii,!0,d==null&&Et.setSeries),Z.live&&(oe.fill(b),J=!0)}else{let q,re,pe;o==1&&(q=D.ori==0?et:tt,re=pr(q,R),b=Gr(re,t[0],Dt,Bt),pe=V(t[0][b],D,I,0));for(let Y=o==2?1:0;Y0&&fe.show){let Ve=Ie==null?-10:Ji(ee(Ie,o==1?P[fe.scale]:P[fe.facets[1].scale],W,0),1);if(jr&&Ve>=0&&o==1){let nt=Ht(Ve-tt);if(nt=0?1:-1,er=St>=0?1:-1;er==pn&&(er==1?Ct==1?Ie>=St:Ie<=St:Ct==1?Ie<=St:Ie>=St)&&(oi=nt,ml=Y)}else oi=nt,ml=Y}}let ct,xn;if(D.ori==0?(ct=Le,xn=Ve):(ct=Ve,xn=Le),J&&It.length>1){Q4(It[Y],ge.points.fill(r,Y),ge.points.stroke(r,Y));let nt,Ct,rn,St,pn=!0,er=ge.points.bbox;if(er!=null){pn=!1;let Vr=er(r,Y);rn=Vr.left,St=Vr.top,nt=Vr.width,Ct=Vr.height}else rn=ct,St=xn,nt=Ct=ge.points.size(r,Y);X4(It[Y],nt,Ct,pn),pi(It[Y],rn,St,_e,ce)}}}}if(ge.idx=b,ge.left=et,ge.top=tt,J&&(Z.idx=b,Uc()),dn.show&&Hr)if(d!=null){let[q,re]=Et.scales,[pe,Y]=Et.match,[fe,ke]=d.cursor.sync.scales,gt=d.cursor.drag;if(Ft=gt._x,jt=gt._y,Ft||jt){let{left:Pe,top:Ie,width:Le,height:Ve}=d.select,ct=d.scales[q].ori,xn=d.posToVal,nt,Ct,rn,St,pn,er=q!=null&&pe(q,fe),Vr=re!=null&&Y(re,ke);er&&Ft?(ct==0?(nt=Pe,Ct=Le):(nt=Ie,Ct=Ve),rn=P[q],St=V(xn(nt,fe),rn,I,0),pn=V(xn(nt+Ct,fe),rn,I,0),yl($n(St,pn),Ht(pn-St))):yl(0,I),Vr&&jt?(ct==1?(nt=Pe,Ct=Le):(nt=Ie,Ct=Ve),rn=P[re],St=ee(xn(nt,ke),rn,W,0),pn=ee(xn(nt+Ct,ke),rn,W,0),vl($n(St,pn),Ht(pn-St))):vl(0,W)}else Hs()}else{let q=Ht(Th-Eh),re=Ht(Ph-Ch);if(D.ori==1){let ke=q;q=re,re=ke}Ft=Qt.x&&q>=Qt.dist,jt=Qt.y&&re>=Qt.dist;let pe=Qt.uni;pe!=null?Ft&&jt&&(Ft=q>=pe,jt=re>=pe,!Ft&&!jt&&(re>q?jt=!0:Ft=!0)):Qt.x&&Qt.y&&(Ft||jt)&&(Ft=jt=!0);let Y,fe;Ft&&(D.ori==0?(Y=ti,fe=et):(Y=ni,fe=tt),yl($n(Y,fe),Ht(fe-Y)),jt||vl(0,W)),jt&&(D.ori==1?(Y=ti,fe=et):(Y=ni,fe=tt),vl($n(Y,fe),Ht(fe-Y)),Ft||yl(0,I)),!Ft&&!jt&&(yl(0,0),vl(0,0))}if(Qt._x=Ft,Qt._y=jt,d==null){if(_){if(Wh!=null){let[q,re]=Et.scales;Et.values[0]=q!=null?pr(D.ori==0?et:tt,q):null,Et.values[1]=re!=null?pr(D.ori==1?et:tt,re):null}wl(Xm,r,et,tt,_e,ce,b)}if(jr){let q=_&&Et.setSeries,re=Er.prox;gl==null?oi<=re&&dr(ml,ii,!0,q):oi>re?dr(null,ii,!0,q):ml!=gl&&dr(ml,ii,!0,q)}}y!==!1&&Xt("setCursor")}let Ur=null;Object.defineProperty(r,"rect",{get(){return Ur==null&&xl(!1),Ur}});function xl(d=!1){d?Ur=null:(Ur=v.getBoundingClientRect(),Xt("syncRect",Ur))}function $h(d,y,_,b,$,I,W){ge._lock||Hr&&d!=null&&d.movementX==0&&d.movementY==0||(Vc(d,y,_,b,$,I,W,!1,d!=null),d!=null?vo(null,!0,!0):vo(y,!0,!1))}function Vc(d,y,_,b,$,I,W,q,re){if(Ur==null&&xl(!1),ut(d),d!=null)_=d.clientX-Ur.left,b=d.clientY-Ur.top;else{if(_<0||b<0){et=-10,tt=-10;return}let[pe,Y]=Et.scales,fe=y.cursor.sync,[ke,gt]=fe.values,[Pe,Ie]=fe.scales,[Le,Ve]=Et.match,ct=y.axes[0].side%2==1,xn=D.ori==0?_e:ce,nt=D.ori==1?_e:ce,Ct=ct?I:$,rn=ct?$:I,St=ct?b:_,pn=ct?_:b;if(Pe!=null?_=Le(pe,Pe)?u(ke,P[pe],xn,0):-10:_=xn*(St/Ct),Ie!=null?b=Ve(Y,Ie)?u(gt,P[Y],nt,0):-10:b=nt*(pn/rn),D.ori==1){let er=_;_=b,b=er}}re&&((_<=1||_>=_e-1)&&(_=Ro(_,_e)),(b<=1||b>=ce-1)&&(b=Ro(b,ce))),q?(Eh=_,Ch=b,[ti,ni]=ge.move(r,_,b)):(et=_,tt=b)}const Nh={width:0,height:0,left:0,top:0};function Hs(){Ws(Nh,!1)}let Oh,zh,Lh,Ah;function Ih(d,y,_,b,$,I,W){Hr=!0,Ft=jt=Qt._x=Qt._y=!1,Vc(d,y,_,b,$,I,W,!0,!1),d!=null&&(Je(Cf,Nd,Dh,!1),wl(Zm,r,ti,ni,_e,ce,null));let{left:q,top:re,width:pe,height:Y}=dn;Oh=q,zh=re,Lh=pe,Ah=Y,Hs()}function Dh(d,y,_,b,$,I,W){Hr=Qt._x=Qt._y=!1,Vc(d,y,_,b,$,I,W,!1,!0);let{left:q,top:re,width:pe,height:Y}=dn,fe=pe>0||Y>0,ke=Oh!=q||zh!=re||Lh!=pe||Ah!=Y;if(fe&&ke&&Ws(dn),Qt.setScale&&fe&&ke){let gt=q,Pe=pe,Ie=re,Le=Y;if(D.ori==1&&(gt=re,Pe=Y,Ie=q,Le=pe),Ft&&ri(R,pr(gt,R),pr(gt+Pe,R)),jt)for(let Ve in P){let ct=P[Ve];Ve!=R&&ct.from==null&&ct.min!=Me&&ri(Ve,pr(Ie+Le,Ve),pr(Ie,Ve))}Hs()}else ge.lock&&(ge._lock=!ge._lock,ge._lock||vo(null,!0,!1));d!=null&&(he(Cf,Nd),wl(Cf,r,et,tt,_e,ce,null))}function dw(d,y,_,b,$,I,W){if(ge._lock)return;ut(d);let q=Hr;if(Hr){let re=!0,pe=!0,Y=10,fe,ke;D.ori==0?(fe=Ft,ke=jt):(fe=jt,ke=Ft),fe&&ke&&(re=et<=Y||et>=_e-Y,pe=tt<=Y||tt>=ce-Y),fe&&re&&(et=et{let $=Et.match[2];_=$(r,y,_),_!=-1&&dr(_,b,!0,!1)},ge.show&&(Je(Zm,v,Ih),Je(Xm,v,$h),Je(Jm,v,d=>{ut(d),xl(!1)}),Je(eg,v,dw),Je(tg,v,Bh),Dd.add(r),r.syncRect=xl);const Us=r.hooks=e.hooks||{};function Xt(d,y,_){d in Us&&Us[d].forEach(b=>{b.call(null,r,y,_)})}(e.plugins||[]).forEach(d=>{for(let y in d.hooks)Us[y]=(Us[y]||[]).concat(d.hooks[y])});const jh=(d,y,_)=>_,Et=Tt({key:null,setSeries:!1,filters:{pub:fg,sub:fg},scales:[R,S[1]?S[1].scale:null],match:[dg,dg,jh],values:[null,null]},ge.sync);Et.match.length==2&&Et.match.push(jh),ge.sync=Et;const Wh=Et.key,Kc=wx(Wh);function wl(d,y,_,b,$,I,W){Et.filters.pub(d,y,_,b,$,I,W)&&Kc.pub(d,y,_,b,$,I,W)}Kc.sub(r);function pw(d,y,_,b,$,I,W){Et.filters.sub(d,y,_,b,$,I,W)&&li[d](null,y,_,b,$,I,W)}r.pub=pw;function hw(){Kc.unsub(r),Dd.delete(r),wt.clear(),Ld(hu,Bi,Fh),c.remove(),ye==null||ye.remove(),Xt("destroy")}r.destroy=hw;function Gc(){Xt("init",e,t),xh(t||e.data,!1),le[R]?jc(R,le[R]):Rc(),at=dn.show,ve=J=!0,ie(e.width,e.height)}return S.forEach(go),E.forEach(Kx),n?n instanceof HTMLElement?(n.appendChild(c),Gc()):n(r,Gc):Gc(),r}Gt.assign=Tt;Gt.fmtNum=uh;Gt.rangeNum=mu;Gt.rangeLog=Sc;Gt.rangeAsinh=sh;Gt.orient=Zo;Gt.pxRatio=Fe;Gt.join=hP;Gt.fmtDate=ch,Gt.tzDate=EP;Gt.sync=wx;{Gt.addGap=u5,Gt.clipGaps=bc;let e=Gt.paths={points:Cx};e.linear=Px,e.stepped=d5,e.bars=p5,e.spline=m5}const C5=Object.freeze(Object.defineProperty({__proto__:null,default:Gt},Symbol.toStringTag,{value:"Module"}));var Nx={};(function(e){(function(t){function n(g){return g!==null?Object.prototype.toString.call(g)==="[object Array]":!1}function r(g){return g!==null?Object.prototype.toString.call(g)==="[object Object]":!1}function o(g,k){if(g===k)return!0;var T=Object.prototype.toString.call(g);if(T!==Object.prototype.toString.call(k))return!1;if(n(g)===!0){if(g.length!==k.length)return!1;for(var M=0;M",9:"Array"},S="EOF",E="UnquotedIdentifier",P="QuotedIdentifier",N="Rbracket",R="Rparen",z="Comma",j="Colon",O="Rbrace",D="Number",U="Current",V="Expref",ee="Pipe",le="Or",me="And",se="EQ",H="GT",ne="LT",G="GTE",oe="LTE",Z="NE",xe="Flatten",te="Star",ye="Filter",ae="Dot",Ce="Not",Ae="Lbrace",Ne="Lbracket",Ze="Lparen",ht="Literal",cn={".":ae,"*":te,",":z,":":j,"{":Ae,"}":O,"]":N,"(":Ze,")":R,"@":U},cr={"<":!0,">":!0,"=":!0,"!":!0},fn={" ":!0," ":!0,"\n":!0};function Zn(g){return g>="a"&&g<="z"||g>="A"&&g<="Z"||g==="_"}function Cn(g){return g>="0"&&g<="9"||g==="-"}function wt(g){return g>="a"&&g<="z"||g>="A"&&g<="Z"||g>="0"&&g<="9"||g==="_"}function Je(){}Je.prototype={tokenize:function(g){var k=[];this._current=0;for(var T,M,B;this._current")return g[this._current]==="="?(this._current++,{type:G,value:">=",start:k}):{type:H,value:">",start:k};if(T==="="&&g[this._current]==="=")return this._current++,{type:se,value:"==",start:k}},_consumeLiteral:function(g){this._current++;for(var k=this._current,T=g.length,M;g[this._current]!=="`"&&this._current=0)return!0;if(T.indexOf(g)>=0)return!0;if(M.indexOf(g[0])>=0)try{return JSON.parse(g),!0}catch{return!1}else return!1}};var he={};he[S]=0,he[E]=0,he[P]=0,he[N]=0,he[R]=0,he[z]=0,he[O]=0,he[D]=0,he[U]=0,he[V]=0,he[ee]=1,he[le]=2,he[me]=3,he[se]=5,he[H]=5,he[ne]=5,he[G]=5,he[oe]=5,he[Z]=5,he[xe]=9,he[te]=20,he[ye]=21,he[ae]=40,he[Ce]=45,he[Ae]=50,he[Ne]=55,he[Ze]=60;function mt(){}mt.prototype={parse:function(g){this._loadTokens(g),this.index=0;var k=this.expression(0);if(this._lookahead(0)!==S){var T=this._lookaheadToken(0),M=new Error("Unexpected token type: "+T.type+", value: "+T.value);throw M.name="ParserError",M}return k},_loadTokens:function(g){var k=new Je,T=k.tokenize(g);T.push({type:S,value:"",start:g.length}),this.tokens=T},expression:function(g){var k=this._lookaheadToken(0);this._advance();for(var T=this.nud(k),M=this._lookahead(0);g=0)return this.expression(g);if(k===Ne)return this._match(Ne),this._parseMultiselectList();if(k===Ae)return this._match(Ae),this._parseMultiselectHash()},_parseProjectionRHS:function(g){var k;if(he[this._lookahead(0)]<10)k={type:"Identity"};else if(this._lookahead(0)===Ne)k=this.expression(g);else if(this._lookahead(0)===ye)k=this.expression(g);else if(this._lookahead(0)===ae)this._match(ae),k=this._parseDotRHS(g);else{var T=this._lookaheadToken(0),M=new Error("Sytanx error, unexpected token: "+T.value+"("+T.type+")");throw M.name="ParserError",M}return k},_parseMultiselectList:function(){for(var g=[];this._lookahead(0)!==N;){var k=this.expression(0);if(g.push(k),this._lookahead(0)===z&&(this._match(z),this._lookahead(0)===N))throw new Error("Unexpected token Rbracket")}return this._match(N),{type:"MultiSelectList",children:g}},_parseMultiselectHash:function(){for(var g=[],k=[E,P],T,M,B,Q;;){if(T=this._lookaheadToken(0),k.indexOf(T.type)<0)throw new Error("Expecting an identifier token, got: "+T.type);if(M=T.value,this._advance(),this._match(j),B=this.expression(0),Q={type:"KeyValuePair",name:M,value:B},g.push(Q),this._lookahead(0)===z)this._match(z);else if(this._lookahead(0)===O){this._match(O);break}}return{type:"MultiSelectHash",children:g}}};function At(g){this.runtime=g}At.prototype={search:function(g,k){return this.visit(g,k)},visit:function(g,k){var T,M,B,Q,de,ve,at,J,ie,X;switch(g.type){case"Field":return k!==null&&r(k)?(ve=k[g.name],ve===void 0?null:ve):null;case"Subexpression":for(B=this.visit(g.children[0],k),X=1;X0)for(X=br;XJo;X+=ge)B.push(k[X]);return B;case"Projection":var ut=this.visit(g.children[0],k);if(!n(ut))return null;for(ie=[],X=0;Xde;break;case G:B=Q>=de;break;case ne:B=Q=g&&(k=T<0?g-1:g),k}};function _e(g){this._interpreter=g,this.functionTable={abs:{_func:this._functionAbs,_signature:[{types:[u]}]},avg:{_func:this._functionAvg,_signature:[{types:[C]}]},ceil:{_func:this._functionCeil,_signature:[{types:[u]}]},contains:{_func:this._functionContains,_signature:[{types:[c,p]},{types:[a]}]},ends_with:{_func:this._functionEndsWith,_signature:[{types:[c]},{types:[c]}]},floor:{_func:this._functionFloor,_signature:[{types:[u]}]},length:{_func:this._functionLength,_signature:[{types:[c,p,f]}]},map:{_func:this._functionMap,_signature:[{types:[x]},{types:[p]}]},max:{_func:this._functionMax,_signature:[{types:[C,w]}]},merge:{_func:this._functionMerge,_signature:[{types:[f],variadic:!0}]},max_by:{_func:this._functionMaxBy,_signature:[{types:[p]},{types:[x]}]},sum:{_func:this._functionSum,_signature:[{types:[C]}]},starts_with:{_func:this._functionStartsWith,_signature:[{types:[c]},{types:[c]}]},min:{_func:this._functionMin,_signature:[{types:[C,w]}]},min_by:{_func:this._functionMinBy,_signature:[{types:[p]},{types:[x]}]},type:{_func:this._functionType,_signature:[{types:[a]}]},keys:{_func:this._functionKeys,_signature:[{types:[f]}]},values:{_func:this._functionValues,_signature:[{types:[f]}]},sort:{_func:this._functionSort,_signature:[{types:[w,C]}]},sort_by:{_func:this._functionSortBy,_signature:[{types:[p]},{types:[x]}]},join:{_func:this._functionJoin,_signature:[{types:[c]},{types:[w]}]},reverse:{_func:this._functionReverse,_signature:[{types:[c,p]}]},to_array:{_func:this._functionToArray,_signature:[{types:[a]}]},to_string:{_func:this._functionToString,_signature:[{types:[a]}]},to_number:{_func:this._functionToNumber,_signature:[{types:[a]}]},not_null:{_func:this._functionNotNull,_signature:[{types:[a],variadic:!0}]}}}_e.prototype={callFunction:function(g,k){var T=this.functionTable[g];if(T===void 0)throw new Error("Unknown function: "+g+"()");return this._validateArgs(g,k,T._signature),T._func.call(this,k)},_validateArgs:function(g,k,T){var M;if(T[T.length-1].variadic){if(k.length=0;B--)M+=T[B];return M}else{var Q=g[0].slice(0);return Q.reverse(),Q}},_functionAbs:function(g){return Math.abs(g[0])},_functionCeil:function(g){return Math.ceil(g[0])},_functionAvg:function(g){for(var k=0,T=g[0],M=0;M=0},_functionFloor:function(g){return Math.floor(g[0])},_functionLength:function(g){return r(g[0])?Object.keys(g[0]).length:g[0].length},_functionMap:function(g){for(var k=[],T=this._interpreter,M=g[0],B=g[1],Q=0;Q0){var k=this._getTypeName(g[0][0]);if(k===u)return Math.max.apply(Math,g[0]);for(var T=g[0],M=T[0],B=1;B0){var k=this._getTypeName(g[0][0]);if(k===u)return Math.min.apply(Math,g[0]);for(var T=g[0],M=T[0],B=1;Bwe?1:XB&&(B=de,Q=T[ve]);return Q},_functionMinBy:function(g){for(var k=g[1],T=g[0],M=this.createKeyFunction(k,[u,c]),B=1/0,Q,de,ve=0;ve(e.bytes="bytes",e.bps="bps",e.counter="counter",e.rps="rps",e.duration="duration",e.timestamp="timestamp",e.unknown="",e))(Mo||{}),Ox=class{constructor(e){Se(this,"name");Se(this,"aggregate");Se(this,"tags");Se(this,"group");Se(this,"scenario");const[t,n]=e.split(".",2);this.aggregate=n,this.name=t;let r="";const o=t.indexOf("{");if(o&&o>0){r=t.substring(o),r=r.substring(1,r.length-1);const i=r.indexOf(":"),l=r.substring(0,i),s=r.substring(i+1);this.tags={[l]:s},l=="group"&&(this.group=s.substring(2)),this.name=t.substring(0,o)}}},zg="time",gh=class{constructor({values:e={}}={}){Se(this,"values");this.values=e}onEvent(e){for(const t in e)this.values[t]={...e[t],name:t}}find(e){const t=new Ox(e);return this.values[t.name]}unit(e,t){const n=this.find(e);if(!n||!t&&e!=zg)return"";switch(n.type){case"counter":switch(n.contains){case"data":return t=="count"?"bytes":"bps";default:return t=="count"?"counter":"rps"}case"rate":switch(n.contains){case"data":return"bps";default:return"rps"}case"gauge":switch(n.contains){case"time":return n.name==zg?"timestamp":"duration";case"data":return"bytes";default:return"counter"}case"trend":switch(n.contains){case"time":return"duration";case"data":return"bps";default:return"rps"}default:return""}}},ya="time",va=class{constructor({length:e=0,capacity:t=1e4,values:n=new Array,aggregate:r="value",metric:o=void 0,unit:i="",name:l="",tags:s={},group:u=void 0}={}){Se(this,"capacity");Se(this,"aggregate");Se(this,"metric");Se(this,"unit");Se(this,"empty");Se(this,"name");Se(this,"tags");Se(this,"group");Se(this,"values");this.values=e==0?n:new Array(e),this.capacity=t,this.aggregate=r,this.metric=o,this.unit=i,this.empty=this.values.length==0,this.name=l,this.tags=s,this.group=u,Object.defineProperty(this,r,{value:!0,configurable:!0,enumerable:!0,writable:!0})}hasTags(){return this.tags!=null&&Object.keys(this.tags).length!=0}formatTags(){if(!this.hasTags())return"";let e="{";for(const t in this.tags)e+=`${t}:${this.tags[t]}`;return e+="}",e}get legend(){let e=this.aggregate;return this.metric&&this.metric.type!="trend"&&this.name.length!=0&&(e=this.name+this.formatTags()),e}grow(e){this.values[e-1]=void 0}push(...e){let t=!1;if(e.forEach(n=>{this.values.push(n),this.empty=!1,this.values.length==this.capacity&&(this.values.shift(),t=!0)}),t){this.empty=!0;for(let n=0;n{t.unit&&!e.includes(t.unit)&&e.push(t.unit)}),e}},P5=class{constructor({capacity:e=1e4,metrics:t=new gh}={}){Se(this,"capacity");Se(this,"metrics");Se(this,"values");Se(this,"vectors");Se(this,"lookup");this.capacity=e,this.metrics=t,this.lookup={},this.vectors={},this.values={}}get length(){return this.values[ya]?this.values[ya].values.length:0}_push(e,t,n=void 0){const r=n?e+"."+n:e;let o=this.vectors[r];if(o)o.values.length0){r=e.substring(o),r=r.substring(1,r.length-1);const i=r.indexOf(":"),l=r.substring(0,i),s=r.substring(i+1);n.tags={[l]:s},l=="group"&&(n.group=s.substring(2)),e=e.substring(0,o)}return n.name=e,n.metric=this.metrics.find(e),n.unit=this.metrics.unit(e,t),new va(n)}onEvent(e){for(const t in e){if(t==ya){this._push(t,Math.floor(e[t].value/1e3));continue}for(const n in e[t]){const r=n;this._push(t,e[t][r],r)}}}annotate(e){this.metrics=e;for(const t in this.values){this.values[t].metric=e.find(t);const n=new Ox(t);this.values[t].unit=e.unit(n.name,n.aggregate)}}select(e){const t=new T5(this.values[ya]);if(t.length==0)return t;for(const n of e){const r=this.queryAll(n);r.length>0&&t.push(...r)}return t}query(e){const t=Fd.search(this.lookup,e);if(Array.isArray(t)){const r=t.at(0);return r instanceof va?r:void 0}return t instanceof va?t:void 0}queryAll(e){const t=Fd.search(this.lookup,e);if(!Array.isArray(t)||t.length==0)return new Array;const n=t;return n.at(0)instanceof va?n:new Array}},Lg=class{constructor({values:e,metric:t,name:n}={}){Se(this,"values");Se(this,"metric");Se(this,"name");Se(this,"tags");Se(this,"group");this.values=e,this.metric=t,this.name=n,t&&t.type&&Object.defineProperty(this,t.type,{value:!0,configurable:!0,enumerable:!0,writable:!0});let r="";const o=n.indexOf("{");if(o&&o>0){r=n.substring(o),r=r.substring(1,r.length-1);const i=r.indexOf(":"),l=r.substring(0,i),s=r.substring(i+1);this.tags={[l]:s},l=="group"&&(this.group=s.substring(2)),n=n.substring(0,o)}}},R5="time",M5=class extends Array{constructor(t){super();Se(this,"aggregates");this.aggregates=new Array;for(let n=0;no))}}get empty(){return this.length==0}},$5=class{constructor({values:t={},metrics:n=new gh,time:r=0}={}){Se(this,"values");Se(this,"lookup");Se(this,"metrics");Se(this,"time");this.values=t,this.lookup=new Array,this.metrics=n,this.time=r}onEvent(t){const n={};let r=0;for(const i in t){if(i==R5){r=Math.floor(t[i].value/1e3);continue}const l=this.newSummaryRow(i,t[i]);n[i]=l}this.values=n,this.time=r;const o=Array();for(const i in this.values)o.push(this.values[i]);this.lookup=o}newSummaryRow(t,n){const r={};return r.name=t,r.metric=this.metrics.find(t),r.values=n,new Lg(r)}annotate(t){this.metrics=t;for(const n in this.values)this.values[n].metric=t.find(n)}select(t){const n=new Array;for(const r of t){const o=this.queryAll(r);o.length>0&&n.push(...o)}return new M5(n)}queryAll(t){const n=Fd.search(this.lookup,t);if(!Array.isArray(n)||n.length==0)return new Array;const r=n;return r.at(0)instanceof Lg?r:new Array}},N5=class{constructor(e={}){Object.assign(this,e)}},zx=(e=>(e.config="config",e.param="param",e.start="start",e.stop="stop",e.metric="metric",e.snapshot="snapshot",e.cumulative="cumulative",e))(zx||{}),jd=class{constructor({config:e={},param:t={},start:n=void 0,stop:r=void 0,metrics:o=new gh,samples:i=new P5,summary:l=new $5}={}){Se(this,"config");Se(this,"param");Se(this,"start");Se(this,"stop");Se(this,"metrics");Se(this,"samples");Se(this,"summary");this.config=e,this.param=t,this.start=n,this.stop=r,this.metrics=o,this.samples=i,this.summary=l}handleEvent(e){const t=e.type,n=JSON.parse(e.data);this.onEvent(t,n)}onEvent(e,t){for(const n in t)for(const r in t[n])if(r.indexOf("(")>=0){const o=r.replaceAll("(","").replaceAll(")","");t[n][o]=t[n][r],delete t[n][r]}switch(e){case"config":this.onConfig(t);break;case"param":this.onParam(t);break;case"start":this.onStart(t);break;case"stop":this.onStop(t);break;case"metric":this.onMetric(t);break;case"snapshot":this.onSnapshot(t);break;case"cumulative":this.onCumulative(t);break}}onConfig(e){Object.assign(this.config,e)}onParam(e){Object.assign(this.param,e)}onStart(e){e.time&&e.time.value&&(this.start=new Date(e.time.value))}onStop(e){e.time&&e.time.value&&(this.stop=new Date(e.time.value))}onMetric(e){this.metrics.onEvent(e),this.samples.annotate(this.metrics),this.summary.annotate(this.metrics)}onSnapshot(e){this.samples.onEvent(e),this.samples.annotate(this.metrics)}onCumulative(e){this.summary.onEvent(e),this.summary.annotate(this.metrics)}};function O5(e,t){let[n,r]=T4(e,{formatSubMilliseconds:!0,compact:t}).split(" ").slice(0,2);return n.match(/[0-9]+s/)&&!t?(n=n.replace("s","."),r?r=r.substring(0,1):r="0",n+r+"s"):(r&&(n+=" "+r),n)}function Ag(e){return k4(e)}var z5=Gt.fmtDate("{YYYY}-{MM}-{DD} {HH}:{mm}:{ss}");function Pc(e,t,n=!1){switch(e){case Mo.duration:return O5(t,n);case Mo.bytes:return Ag(t);case Mo.bps:return Ag(t)+"/s";case Mo.counter:return Km(t).format("0.[0]a");case Mo.rps:return Km(t).format("0.[00]a")+"/s";case Mo.timestamp:return z5(new Date(t*1e3));default:return isNaN(t)||t==null?"0":t.toFixed(2)}}var L5=[[3600*24*365,"{YYYY}",null,null,null,null,null,null,1],[3600*24*28,"{MMM}",` +{YYYY}`,null,null,null,null,null,1],[3600*24,"{MM}-{DD}",` +{YYYY}`,null,null,null,null,null,1],[3600,"{HH}",` +{YYYY}-{MM}-{DD}`,null,` +{MM}-{DD}`,null,null,null,1],[60,"{HH}:{mm}",` +{YYYY}-{MM}-{DD}`,null,` +{MM}-{DD}`,null,null,null,1],[1,":{ss}",` +{YYYY}-{MM}-{DD} {HH}:{mm}`,null,` +{MM}-{DD} {HH}:{mm}`,null,` +{HH}:{mm}`,null,1],[.001,":{ss}.{fff}",` +{YYYY}-{MM}-{DD} {HH}:{mm}`,null,` +{MM}-{DD} {HH}:{mm}`,null,` +{HH}:{mm}`,null,1]];function A5(e){return function(t,n,r,o){return o==null?"--":n==null?"":Pc(e,n)}}var Lx=class{constructor(e,t,n){Se(this,"samples");Se(this,"series");const r=t.series.map(o=>o.query);this.samples=e.samples.select(r),this.samples.empty||(this.series=this.buildSeries(t.series,n))}get empty(){return this.samples.empty}get data(){const e=new Array;for(let t=0;t0&&(i=e[r].legend),n.push({stroke:t[o].stroke,fill:t[o].fill,value:A5(this.samples[r].unit),points:{show:!1},label:i,scale:this.samples[r].unit})}return n}};function I5(e){let t;function n(i){t=document.createElement("div");const l={display:"none",position:"absolute",padding:"0.2rem",border:"1px solid #7b65fa",zIndex:"10",pointerEvents:"none",margin:"0.5rem",fontSize:"smaller"};Object.assign(t.style,l),i.over.appendChild(t),i.over.onmouseleave=()=>{t.style.display="none"},i.over.onmouseenter=()=>{t.style.display="block"}}function r(i){o(i)}function o(i){const l=i.over.getBoundingClientRect();t.style.background=e;const s=D5(i);if(!s){t.style.display="none";return}t.innerHTML=s;const{left:u,top:a}=i.cursor,c=u??0,p=a??0;t.innerHTML=s,ci.over.focus()}}}function D5(e){const{idx:t}=e.cursor;if(t==null)return"";let n;e.legend.values?n=e.legend.values[0]._:n="";let r=``;for(let o=1;o`}return r+="
${n}
${B5(i,l)}${s}${u}
",r}function B5(e,t){return``}var Aa=(e=>(e.chart="chart",e.stat="stat",e.summary="summary",e))(Aa||{}),F5=class{constructor(e,t){Se(this,"view");Se(this,"metrics");this.metrics=t.metrics;const n=e.series.map(r=>r.query);this.view=t.summary.select(n)}get empty(){return this.view.empty}get cols(){return this.view.aggregates.length}get header(){return new Array("metric",...this.view.aggregates.map(e=>e))}get body(){const e=new Array;for(let t=0;tthis.format(this.view[t],r))),e.push(n)}return e}format(e,t){var n;const r=this.metrics.unit(((n=e.metric)==null?void 0:n.name)??"",t);return Pc(r,e.values[t],!0)}};function j5(e,t){for(let n=0;nr.query)).empty}function U5(e,t){return t.summary.select(e.series.map(r=>r.query)).empty}var Ax={exports:{}};const V5=xw(C5);(function(e,t){(function(r,o){e.exports=o(L,V5)})(self,(n,r)=>(()=>{var o={"./common/index.ts":(u,a,c)=>{c.r(a),c.d(a,{dataMatch:()=>h,optionsUpdateState:()=>f});var p=function(x,v){var C={};for(var w in x)Object.prototype.hasOwnProperty.call(x,w)&&v.indexOf(w)<0&&(C[w]=x[w]);if(x!=null&&typeof Object.getOwnPropertySymbols=="function")for(var m=0,w=Object.getOwnPropertySymbols(x);m{u.exports=n},uplot:u=>{u.exports=r}},i={};function l(u){var a=i[u];if(a!==void 0)return a.exports;var c=i[u]={exports:{}};return o[u](c,c.exports,l),c.exports}l.n=u=>{var a=u&&u.__esModule?()=>u.default:()=>u;return l.d(a,{a}),a},l.d=(u,a)=>{for(var c in a)l.o(a,c)&&!l.o(u,c)&&Object.defineProperty(u,c,{enumerable:!0,get:a[c]})},l.o=(u,a)=>Object.prototype.hasOwnProperty.call(u,a),l.r=u=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(u,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(u,"__esModule",{value:!0})};var s={};return(()=>{/*!*******************************!*\ + !*** ./react/uplot-react.tsx ***! + \*******************************/l.r(s),l.d(s,{default:()=>h});var u=l("react"),a=l.n(u),c=l("uplot"),p=l.n(c),f=l("./common/index.ts");function h(x){var v=x.options,C=x.data,w=x.target,m=x.onDelete,S=m===void 0?function(){}:m,E=x.onCreate,P=E===void 0?function(){}:E,N=x.resetScales,R=N===void 0?!0:N,z=(0,u.useRef)(null),j=(0,u.useRef)(null);function O(V){V&&(S(V),V.destroy(),z.current=null)}function D(){var V=new(p())(v,C,w||j.current);z.current=V,P(V)}(0,u.useEffect)(function(){return D(),function(){O(z.current)}},[]);var U=(0,u.useRef)({options:v,data:C,target:w}).current;return(0,u.useEffect)(function(){if(U.options!==v){var V=(0,f.optionsUpdateState)(U.options,v);!z.current||V==="create"?(O(z.current),D()):V==="update"&&z.current.setSize({width:v.width,height:v.height})}return U.data!==C&&(z.current?(0,f.dataMatch)(U.data,C)||(R?z.current.setData(C,!0):(z.current.setData(C,!1),z.current.redraw())):D()),U.target!==w&&(O(z.current),D()),function(){U.options=v,U.data=C,U.target=w}},[v,C,w,R]),w?null:a().createElement("div",{ref:j})}})(),s=s.default,s})())})(Ax);var K5=Ax.exports;const Ix=bs(K5);const G5="k6 dashboard",Y5=[{sections:[{panels:[{series:[{query:"iterations[?!tags && rate]"}],title:"Iteration Rate",kind:"stat",id:"tab-0.section-0.panel-0",summary:""},{series:[{query:"vus[?!tags && value]"}],title:"VUs",kind:"stat",id:"tab-0.section-0.panel-1",summary:""},{series:[{query:"http_reqs[?!tags && rate]"}],title:"HTTP Request Rate",kind:"stat",id:"tab-0.section-0.panel-2",summary:""},{series:[{query:"http_req_duration[?!tags && avg]"}],title:"HTTP Request Duration",kind:"stat",id:"tab-0.section-0.panel-3",summary:""},{series:[{query:"data_received[?!tags && rate]"}],title:"Received Rate",kind:"stat",id:"tab-0.section-0.panel-4",summary:""},{series:[{query:"data_sent[?!tags && rate]"}],title:"Sent Rate",kind:"stat",id:"tab-0.section-0.panel-5",summary:""}],id:"tab-0.section-0"},{panels:[{series:[{query:"vus[?!tags && value]"},{query:"http_reqs[?!tags && rate ]"}],title:"VUs",id:"tab-0.section-1.panel-0",summary:"",kind:"chart"},{series:[{query:"data_received[?!tags && rate]"},{query:"data_sent[?!tags && rate]"}],title:"Transfer Rate",id:"tab-0.section-1.panel-1",summary:"",kind:"chart"},{series:[{query:"http_req_duration[?!tags && (avg || p90 || p95 || p99)]"}],title:"HTTP Request Duration",id:"tab-0.section-1.panel-2",summary:"",kind:"chart"},{series:[{query:"iteration_duration[?!tags && (avg || p90 || p95 || p99)]"}],title:"Iteration Duration",id:"tab-0.section-1.panel-3",summary:"",kind:"chart"}],id:"tab-0.section-1"}],title:"Overview",summary:"This chapter provides an overview of the most important metrics of the test run. Graphs plot the value of metrics over time.",id:"tab-0"},{sections:[{panels:[{series:[{query:"http_req_duration[?!tags && (avg || p90 || p95 || p99)]"}],title:"Request Duration",id:"tab-1.section-0.panel-0",summary:"",kind:"chart"},{series:[{query:"http_req_failed[?!tags && rate ]"}],title:"Request Failed Rate",id:"tab-1.section-0.panel-1",summary:"",kind:"chart"},{series:[{query:"http_reqs[?!tags && rate]"}],title:"Request Rate",id:"tab-1.section-0.panel-2",summary:"",kind:"chart"},{series:[{query:"http_req_waiting[?!tags && (avg || p90 || p95 || p99)]"}],title:"Request Waiting",id:"tab-1.section-0.panel-3",summary:"",kind:"chart"},{series:[{query:"http_req_tls_handshaking[?!tags && (avg || p90 || p95 || p99)]"}],title:"TLS handshaking",id:"tab-1.section-0.panel-4",summary:"",kind:"chart"},{series:[{query:"http_req_sending[?!tags && (avg || p90 || p95 || p99)]"}],title:"Request Sending",id:"tab-1.section-0.panel-5",summary:"",kind:"chart"},{series:[{query:"http_req_connecting[?!tags && (avg || p90 || p95 || p99)]"}],title:"Request Connecting",id:"tab-1.section-0.panel-6",summary:"",kind:"chart"},{series:[{query:"http_req_receiving[?!tags && (avg || p90 || p95 || p99)]"}],title:"Request Receiving",id:"tab-1.section-0.panel-7",summary:"",kind:"chart"},{series:[{query:"http_req_blocked[?!tags && (avg || p90 || p95 || p99)]"}],title:"Request Blocked",id:"tab-1.section-0.panel-8",summary:"",kind:"chart"}],title:"HTTP",summary:"These metrics are generated only when the test makes HTTP requests.",id:"tab-1.section-0"},{panels:[{series:[{query:"browser_http_req_duration[?!tags && (avg || p90 || p95 || p99)]"}],title:"Request Duration",id:"tab-1.section-1.panel-0",summary:"",kind:"chart"},{series:[{query:"browser_http_req_failed[?!tags && rate ]"}],title:"Request Failed Rate",id:"tab-1.section-1.panel-1",summary:"",kind:"chart"},{series:[{query:"browser_web_vital_lcp[?!tags && (avg || p90 || p95 || p99)]"}],title:"Largest Contentful Paint",id:"tab-1.section-1.panel-2",summary:"",kind:"chart"},{series:[{query:"browser_web_vital_fid[?!tags && (avg || p90 || p95 || p99)]"}],title:"First Input Delay",id:"tab-1.section-1.panel-3",summary:"",kind:"chart"},{series:[{query:"browser_web_vital_cls[?!tags && (avg || p90 || p95 || p99)]"}],title:"Cumulative Layout Shift",id:"tab-1.section-1.panel-4",summary:"",kind:"chart"},{series:[{query:"browser_web_vital_ttfb[?!tags && (avg || p90 || p95 || p99)]"}],title:"Time to First Byte",id:"tab-1.section-1.panel-5",summary:"",kind:"chart"},{series:[{query:"browser_web_vital_fcp[?!tags && (avg || p90 || p95 || p99)]"}],title:"First Contentful Paint",id:"tab-1.section-1.panel-6",summary:"",kind:"chart"},{series:[{query:"browser_web_vital_inp[?!tags && (avg || p90 || p95 || p99)]"}],title:"Interaction to Next Paint",id:"tab-1.section-1.panel-7",summary:"",kind:"chart"}],title:"Browser",summary:"The k6 browser module emits its own metrics based on the Core Web Vitals and Other Web Vitals.",id:"tab-1.section-1"},{panels:[{series:[{query:"ws_connecting[?!tags && (avg || p90 || p95 || p99)]"}],title:"Connect Duration",id:"tab-1.section-2.panel-0",summary:"",kind:"chart"},{series:[{query:"ws_session_duration[?!tags && (avg || p90 || p95 || p99)]"}],title:"Session Duration",id:"tab-1.section-2.panel-1",summary:"",kind:"chart"},{series:[{query:"ws_ping[?!tags && (avg || p90 || p95 || p99)]"}],title:"Ping Duration",id:"tab-1.section-2.panel-2",summary:"",kind:"chart"},{series:[{query:"ws_msgs_sent[?!tags && rate]"},{query:"ws_msgs_received[?!tags && rate]"}],title:"Transfer Rate",id:"tab-1.section-2.panel-3",summary:"",kind:"chart"},{series:[{query:"ws_sessions[?!tags && rate]"}],title:"Sessions Rate",id:"tab-1.section-2.panel-4",summary:"",kind:"chart"}],title:"WebSocket",summary:"k6 emits the following metrics when interacting with a WebSocket service through the experimental or legacy websockets API.",id:"tab-1.section-2"},{panels:[{series:[{query:"grpc_req_duration[?!tags && (avg || p90 || p95 || p99)]"}],title:"Request Duration",id:"tab-1.section-3.panel-0",summary:"",kind:"chart"},{series:[{query:"grpc_streams_msgs_sent[?!tags && rate]"},{query:"grpc_streams_msgs_received[?!tags && rate]"}],title:"Transfer Rate",id:"tab-1.section-3.panel-1",summary:"",kind:"chart"},{series:[{query:"grpc_streams[?!tags && rate]"}],title:"Streams Rate",id:"tab-1.section-3.panel-2",summary:"",kind:"chart"}],title:"gRPC",summary:"k6 emits the following metrics when it interacts with a service through the gRPC API.",id:"tab-1.section-3"}],title:"Timings",summary:"This chapter provides an overview of test run HTTP timing metrics. Graphs plot the value of metrics over time.",id:"tab-1"},{sections:[{panels:[{series:[{query:"[?!tags && trend]"}],title:"Trends",kind:"summary",id:"tab-2.section-0.panel-0",summary:""}],title:"",id:"tab-2.section-0"},{panels:[{series:[{query:"[?!tags && counter]"}],title:"Counters",kind:"summary",id:"tab-2.section-1.panel-0",summary:""},{series:[{query:"[?!tags && rate]"}],title:"Rates",kind:"summary",id:"tab-2.section-1.panel-1",summary:""},{series:[{query:"[?!tags && gauge]"}],title:"Gauges",kind:"summary",id:"tab-2.section-1.panel-2",summary:""}],title:"",id:"tab-2.section-1"}],title:"Summary",summary:"This chapter provides a summary of the test run metrics. The tables contains the aggregated values of the metrics for the entire test run.",id:"tab-2"}],Dx={title:G5,tabs:Y5},yh=Vt.createContext(()=>new jd({config:Dx}));yh.displayName="Digest";function q5({endpoint:e="/events",children:t}){const[n,r]=L.useState(null),[o,i]=L.useState(new jd({config:new N5(Dx)}));return L.useEffect(()=>{if(n==null){const l=new EventSource(e),s=u=>{o.handleEvent(u),i(new jd(o))};for(const u in zx)l.addEventListener(u,s);r(l)}},[]),F.jsx(yh.Provider,{value:()=>o,children:t})}function Os(){const e=Vt.useContext(yh);if(e===void 0)throw new Error("useDigest must be used within a DigestProvider");return e()}const Q5=Gt.sync("chart");function Bx({panel:e}){const[t,n]=L.useState(0),r=L.useRef(null),o=Os(),i=mo();L.useLayoutEffect(()=>{let p=()=>n(r.current.offsetWidth);return p(),window.addEventListener("resize",p),()=>window.removeEventListener("resize",p)});const l=new Lx(o,e,i.palette.color);if(l.empty)return F.jsx("div",{ref:r});let s={width:t,height:250,title:e.title,cursor:{sync:{key:Q5.key}},legend:{live:!1},series:l.series,axes:[{}],plugins:[I5(i.palette.background.paper)]},u=i.palette.mode=="dark"?"#202020":"#f0f0f0";s.axes=l.samples.units.map(p=>({stroke:i.palette.text.primary,grid:{stroke:u},ticks:{stroke:u},values:(f,h)=>h.map(x=>Pc(p,x)),size:70,scale:p})),delete s.axes[0].size,s.axes[0].values=L5,s.axes.length>2&&(s.axes[2].side=1);let a=i.palette.mode=="dark"?"#60606080":"#d0d0d080";function c(p){p.root.querySelector(".u-select").style.background=a}return F.jsx(xc,{ref:r,className:"chart panel",item:!0,md:12,lg:6,children:F.jsx(Ix,{options:s,data:l.data,onCreate:c})})}Bx.propTypes={panel:_r.PropTypes.any.isRequired};function Fx({panel:e}){const[t,n]=L.useState(0),r=L.useRef(null),o=Os(),i=mo();L.useLayoutEffect(()=>{let p=()=>n(r.current.offsetWidth);return p(),window.addEventListener("resize",p),()=>window.removeEventListener("resize",p)});const l=e.series[0].query,s=new Lx(o,e,i.palette.color);if(s.empty)return F.jsx("div",{ref:r});const u=o.samples.query(l);var a=0;u&&Array.isArray(u.values)&&u.values.length!=0&&(a=Pc(u.unit,Number(u.values.slice(-1)),!0));let c={width:t,height:32,title:a,series:s.series,axes:[{show:!1},{show:!1}],legend:{show:!1},cursor:{show:!1}};return F.jsxs(xc,{item:!0,className:"panel stat",xs:6,sm:4,md:2,children:[F.jsx(Ri,{sx:{fontSize:"0.8rem"},color:"text.secondary",gutterBottom:!0,align:"center",children:e.title}),F.jsx("div",{ref:r,children:F.jsx(Ix,{options:c,data:s.data})})]})}Fx.propTypes={panel:_r.PropTypes.any.isRequired};function jx({panel:e}){const t=Os(),n=mo(),r=new F5(e,t);if(r.empty)return F.jsx("div",{});const o=r.view.aggregates.length,i=o>6?12:o>1?6:3,l=o>6||o>1?12:6,s=n.palette.mode=="dark"?"#202020c0":"#f6f6f6c0";return F.jsx(xc,{className:"panel",item:!0,xs:12,md:l,lg:i,children:F.jsx(S3,{className:"summary",sx:{background:s},children:F.jsxs(e3,{children:[F.jsx("caption",{children:e.title}),F.jsx(P3,{children:F.jsx(jm,{children:r.header.map((u,a)=>F.jsx(Im,{align:a==0?"left":"right",children:u},e.id+"header"+u))})}),F.jsx(a3,{children:r.body.map((u,a)=>F.jsx(jm,{hover:!0,sx:{"&:last-child td, &:last-child th":{border:0}},children:u.map((c,p)=>F.jsx(Im,{align:p==0?"left":"right",children:c},e.id+"_value_"+a+"_"+p))},e.id+"row"+a))})]})},e.id)})}jx.propTypes={panel:_r.PropTypes.any.isRequired};function Wx({panel:e}){if(e.kind==Aa.chart)return F.jsx(Bx,{panel:e});if(e.kind==Aa.stat)return F.jsx(Fx,{panel:e});if(e.kind==Aa.summary)return F.jsx(jx,{panel:e})}Wx.propTypes={panel:_r.PropTypes.any.isRequired};function Ig({section:e}){return F.jsx(xc,{container:!0,spacing:1,columns:12,children:e.panels.map(t=>F.jsx(Wx,{panel:t},t.id))})}function Hx({section:e}){const[t,n]=Vt.useState(!0),r=Os();return j5(e,r)?F.jsx(F.Fragment,{}):e.title?F.jsxs(pu,{className:"section",sx:{border:"1px dotted #80808080",marginBottom:"1rem"},children:[F.jsxs(Ri,{variant:"h6",onClick:()=>n(!t),sx:{"&:hover":{cursor:"pointer",opacity:.5}},children:[t?F.jsx(g4,{}):F.jsx(y4,{}),e.title]}),F.jsxs(sC,{in:t,children:[t?F.jsx(Ri,{children:e.summary}):F.jsx(F.Fragment,{}),F.jsx(Ig,{section:e})]})]}):F.jsxs(pu,{className:"section",sx:{border:"1px dotted #80808040",marginBottom:"1rem"},children:[F.jsx(Ri,{variant:"h6",children:e.title}),F.jsx(Ri,{children:e.summary}),F.jsx(Ig,{section:e})]})}Hx.propTypes={section:_r.PropTypes.any.isRequired};function Ux({tab:e}){return F.jsx(F.Fragment,{children:e.sections.map(t=>F.jsx(Hx,{section:t},t.id))})}Ux.propTypes={tab:_r.PropTypes.any.isRequired};function X5(e){return{id:`tab-${e}`,"aria-controls":`tabpanel-${e}`}}function Vx({children:e,active:t,idx:n,...r}){return F.jsx("div",{role:"tabpanel",hidden:t!==n,id:`tabpanel-${n}`,"aria-labelledby":`tab-${n}`,...r,children:F.jsx(pu,{p:3,sx:{padding:"0.5rem"},children:e})})}Vx.propTypes={children:_r.PropTypes.node,idx:_r.PropTypes.any.isRequired,active:_r.PropTypes.any.isRequired};function Z5(){const e=Os().config,[t,n]=Vt.useState(0);return F.jsxs(F.Fragment,{children:[F.jsx(m4,{config:e}),F.jsx(pu,{sx:{borderBottom:1,borderColor:"divider"},children:F.jsx(d4,{value:t,onChange:(r,o)=>n(o),children:e.tabs.map((r,o)=>F.jsx(GT,{label:r.title,...X5(o)},r.id))})}),e.tabs.map((r,o)=>F.jsx(Vx,{active:t,idx:o,children:F.jsx(Ux,{tab:r})},r.id))]})}const J5=new URLSearchParams(window.location.search).get("endpoint")||"http://localhost:5665/";Nf.createRoot(document.getElementById("root")).render(F.jsx(F.Fragment,{children:F.jsx(q1,{children:F.jsx(q5,{endpoint:J5+"events",children:F.jsx(Z5,{})})})})); diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/assets/index-89709133.css b/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/assets/index-89709133.css new file mode 100644 index 00000000000..164820c550b --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/assets/index-89709133.css @@ -0,0 +1,7 @@ +/* + * SPDX-FileCopyrightText: 2023 Raintank, Inc. dba Grafana Labs + * + * SPDX-License-Identifier: AGPL-3.0-only + */ + +.MuiToolbar-root{min-height:unset!important}@media print{.Header{display:none!important}}body{margin:0}.uplot,.uplot *,.uplot *:before,.uplot *:after{box-sizing:border-box}.uplot{font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";line-height:1.5;width:min-content}.u-title{text-align:center;font-size:18px;font-weight:700}.u-wrap{position:relative;-webkit-user-select:none;user-select:none}.u-over,.u-under{position:absolute}.u-under{overflow:hidden}.uplot canvas{display:block;position:relative;width:100%;height:100%}.u-axis{position:absolute}.u-legend{font-size:14px;margin:auto;text-align:center}.u-inline{display:block}.u-inline *{display:inline-block}.u-inline tr{margin-right:16px}.u-legend th{font-weight:600}.u-legend th>*{vertical-align:middle;display:inline-block}.u-legend .u-marker{width:1em;height:1em;margin-right:4px;background-clip:padding-box!important}.u-inline.u-live th:after{content:":";vertical-align:middle}.u-inline:not(.u-live) .u-value{display:none}.u-series>*{padding:4px}.u-series th{cursor:pointer}.u-legend .u-off>*{opacity:.3}.u-select{background:rgba(0,0,0,.07);position:absolute;pointer-events:none}.u-cursor-x,.u-cursor-y{position:absolute;left:0;top:0;pointer-events:none;will-change:transform}.u-hz .u-cursor-x,.u-vt .u-cursor-y{height:100%;border-right:1px dashed #607D8B}.u-hz .u-cursor-y,.u-vt .u-cursor-x{width:100%;border-bottom:1px dashed #607D8B}.u-cursor-pt{position:absolute;top:0;left:0;border-radius:50%;border:0 solid;pointer-events:none;will-change:transform;background-clip:padding-box!important}.u-axis.u-off,.u-select.u-off,.u-cursor-x.u-off,.u-cursor-y.u-off,.u-cursor-pt.u-off{display:none}.panel.chart{margin-top:.5rem;margin-bottom:.5rem}.u-title,.u-label{font-weight:300!important}.uplot{break-inside:avoid}@media screen{.u-title{font-weight:400!important}}.stat .u-title{font-size:1.5rem;font-weight:500!important;white-space:nowrap}.stat{padding:5px;padding-bottom:5px!important}.summary{margin-top:.5rem}thead tr th{font-weight:700!important}tbody tr :first-child{font-weight:500!important}.MuiTable-root th,.MuiTable-root td{padding:8px}table.MuiTable-root caption{display:table-caption;text-align:center;caption-side:top;font-weight:700;padding:8px}@media print{table.MuiTable-root caption{background-color:unset;border-bottom:1px solid lightgrey!important}} diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/assets/light_mode-5b543e8c.svg b/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/assets/light_mode-5b543e8c.svg new file mode 100644 index 00000000000..c4121596dec --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/assets/light_mode-5b543e8c.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/assets/light_mode-5b543e8c.svg.license b/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/assets/light_mode-5b543e8c.svg.license new file mode 100644 index 00000000000..f5b51f2bcd1 --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/assets/light_mode-5b543e8c.svg.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2023 Raintank, Inc. dba Grafana Labs + +SPDX-License-Identifier: AGPL-3.0-only diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/index.html b/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/index.html new file mode 100644 index 00000000000..ece43bf7195 --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/index.html @@ -0,0 +1,22 @@ + + + + + + + + + k6 dashboard + + + + + +
+ + + diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/xk6-dashboard.svg b/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/xk6-dashboard.svg new file mode 100644 index 00000000000..26e56d2d1c1 --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/xk6-dashboard.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/xk6-dashboard.svg.license b/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/xk6-dashboard.svg.license new file mode 100644 index 00000000000..f5b51f2bcd1 --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/assets/packages/ui/dist/xk6-dashboard.svg.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2023 Raintank, Inc. dba Grafana Labs + +SPDX-License-Identifier: AGPL-3.0-only diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/command.go b/vendor/github.com/grafana/xk6-dashboard/dashboard/command.go new file mode 100644 index 00000000000..564f1fe73b0 --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/command.go @@ -0,0 +1,175 @@ +// SPDX-FileCopyrightText: 2023 Iván Szkiba +// SPDX-FileCopyrightText: 2023 Raintank, Inc. dba Grafana Labs +// +// SPDX-License-Identifier: AGPL-3.0-only +// SPDX-License-Identifier: MIT + +package dashboard + +import ( + "os" + "os/signal" + "syscall" + + "github.com/pkg/browser" + "github.com/spf13/cobra" + "go.k6.io/k6/cmd/state" + "go.k6.io/k6/lib/consts" +) + +const ( + flagHost = "host" + flagPort = "port" + flagPeriod = "period" + flagOpen = "open" + flagReport = "report" + flagTags = "tags" +) + +// NewCommand build dashboard command. +func NewCommand(gs *state.GlobalState) *cobra.Command { + proc := new(process).fromGlobalState(gs) + assets := newCustomizedAssets(proc) + + rootCmd := &cobra.Command{ //nolint:exhaustruct + Use: "k6", + Short: "a next-generation load generator", + Long: "\n" + consts.Banner(), + } + + dashboardCmd := &cobra.Command{ //nolint:exhaustruct + Use: "dashboard", + Short: "xk6-dashboard commands", + } + + rootCmd.AddCommand(dashboardCmd) + + dashboardCmd.AddCommand(newReplayCommand(assets, proc)) + dashboardCmd.AddCommand(newAggregateCommand(proc)) + dashboardCmd.AddCommand(newReportCommand(assets, proc)) + + return rootCmd +} + +func newReplayCommand(assets *assets, proc *process) *cobra.Command { + opts := new(options) + + cmd := &cobra.Command{ //nolint:exhaustruct + Use: "replay file", + Short: "load the recorded dashboard events and replay it for the UI", + Long: `The replay command load the recorded dashboard events (NDJSON format) and replay it for the dashboard UI. +The compressed file will be automatically decompressed if the file extension is .gz`, + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + err := replay(args[0], opts, assets, proc) + if err != nil { + return err + } + + if opts.Port < 0 { + return nil + } + + done := make(chan os.Signal, 1) + + signal.Notify(done, syscall.SIGINT, syscall.SIGTERM) + + <-done + + return nil + }, + } + + cmd.Flags().SortFlags = false + + flags := cmd.PersistentFlags() + + flags.StringVar( + &opts.Host, + flagHost, + defaultHost, + "Hostname or IP address for HTTP endpoint (default: '', empty, listen on all interfaces)", + ) + flags.IntVar( + &opts.Port, + flagPort, + defaultPort, + "TCP port for HTTP endpoint (0=random, -1=no HTTP), example: 8080", + ) + flags.BoolVar(&opts.Open, flagOpen, defaultOpen, "Open browser window automatically") + flags.StringVar( + &opts.Report, + flagReport, + defaultReport, + "Report file location (default: '', no report)", + ) + + return cmd +} + +func newAggregateCommand(proc *process) *cobra.Command { + opts := new(options) + cmd := &cobra.Command{ //nolint:exhaustruct + Use: "aggregate input-file output-file", + Short: "convert saved json output to recorded dashboard events", + Long: `The aggregate command converts the file saved by json output to dashboard format events file. +The files will be automatically compressed/decompressed if the file extension is .gz`, + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + return aggregate(args[0], args[1], opts, proc) + }, + } + + cmd.Flags().SortFlags = false + + flags := cmd.PersistentFlags() + + flags.DurationVar( + &opts.Period, + flagPeriod, + defaultPeriod, + "Event emitting frequency, example: `1m`", + ) + flags.StringSliceVar( + &opts.Tags, + flagTags, + defaultTags(), + "Precomputed metric tags, can be specified more than once", + ) + + return cmd +} + +func newReportCommand(assets *assets, proc *process) *cobra.Command { + opts := new(options) + + cmd := &cobra.Command{ //nolint:exhaustruct + Use: "report events-file report-file", + Short: "create report from a recorded event file", + Long: `The report command loads recorded dashboard events (NDJSON format) and creates a report. +The compressed events file will be automatically decompressed if the file extension is .gz`, + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + opts.Port = -1 + opts.Report = args[1] + + if err := replay(args[0], opts, assets, proc); err != nil { + return err + } + + if opts.Open { + _ = browser.OpenFile(args[1]) + } + + return nil + }, + } + + cmd.Flags().SortFlags = false + + flags := cmd.PersistentFlags() + + flags.BoolVar(&opts.Open, flagOpen, defaultOpen, "Open browser window with generated report") + + return cmd +} diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/customize.go b/vendor/github.com/grafana/xk6-dashboard/dashboard/customize.go new file mode 100644 index 00000000000..dd4d60b1b47 --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/customize.go @@ -0,0 +1,301 @@ +// SPDX-FileCopyrightText: 2023 Raintank, Inc. dba Grafana Labs +// +// SPDX-License-Identifier: AGPL-3.0-only + +package dashboard + +import ( + "encoding/json" + "errors" + "fmt" + "io" + "path/filepath" + "reflect" + "strings" + + "github.com/dop251/goja" + "github.com/sirupsen/logrus" + "go.k6.io/k6/js/compiler" + "go.k6.io/k6/lib" + "go.k6.io/k6/lib/fsext" +) + +const ( + defaultConfig = ".dashboard.js" + defaultAltConfig = ".dashboard.json" +) + +func findDefaultConfig(fs fsext.Fs) string { + if exists(fs, defaultConfig) { + return defaultConfig + } + + if exists(fs, defaultAltConfig) { + return defaultAltConfig + } + + return "" +} + +// customize allows using custom dashboard configuration. +func customize(uiConfig json.RawMessage, proc *process) (json.RawMessage, error) { + filename, ok := proc.env["XK6_DASHBOARD_CONFIG"] + if !ok || len(filename) == 0 { + if filename = findDefaultConfig(proc.fs); len(filename) == 0 { + return uiConfig, nil + } + } + + if filepath.Ext(filename) == ".json" { + return loadConfigJSON(filename, proc) + } + + return loadConfigJS(filename, uiConfig, proc) +} + +func loadConfigJSON(filename string, proc *process) (json.RawMessage, error) { + file, err := proc.fs.Open(filename) + if err != nil { + return nil, err + } + + bin, err := io.ReadAll(file) + if err != nil { + return nil, err + } + + conf := map[string]interface{}{} + + if err := json.Unmarshal(bin, &conf); err != nil { + return nil, err + } + + return json.Marshal(conf) +} + +func exists(fs fsext.Fs, filename string) bool { + if _, err := fs.Stat(filename); err != nil { + return false + } + + return true +} + +type configLoader struct { + runtime *goja.Runtime + compiler *compiler.Compiler + defaultConfig *goja.Object + proc *process +} + +func newConfigLoader(defaultConfig json.RawMessage, proc *process) (*configLoader, error) { + comp := compiler.New(proc.logger) + + comp.Options.CompatibilityMode = lib.CompatibilityModeExtended + comp.Options.Strict = true + + con := newConfigConsole(proc.logger) + + runtime := goja.New() + + runtime.SetFieldNameMapper(goja.UncapFieldNameMapper()) + + if err := runtime.Set("console", con); err != nil { + return nil, err + } + + def, err := toObject(runtime, defaultConfig) + if err != nil { + return nil, err + } + + loader := &configLoader{ + runtime: runtime, + compiler: comp, + defaultConfig: def, + proc: proc, + } + + return loader, nil +} + +func (loader *configLoader) load(filename string) (json.RawMessage, error) { + file, err := loader.proc.fs.Open(filename) + if err != nil { + return nil, err + } + + src, err := io.ReadAll(file) + if err != nil { + return nil, err + } + + val, err := loader.eval(src, filename) + if err != nil { + return nil, err + } + + obj := val.ToObject(loader.runtime) + + return obj.MarshalJSON() +} + +func isObject(val goja.Value) bool { + return val != nil && val.ExportType() != nil && val.ExportType().Kind() == reflect.Map +} + +func (loader *configLoader) eval(src []byte, filename string) (*goja.Object, error) { + prog, _, err := loader.compiler.Compile(string(src), filename, false) + if err != nil { + return nil, err + } + + exports := loader.runtime.NewObject() + module := loader.runtime.NewObject() + + if err = module.Set("exports", exports); err != nil { + return nil, err + } + + val, err := loader.runtime.RunProgram(prog) + if err != nil { + return nil, err + } + + call, isCallable := goja.AssertFunction(val) + if !isCallable { + return nil, fmt.Errorf("%w, file: %s", errNotFunction, filename) + } + + _, err = call(exports, module, exports) + if err != nil { + return nil, err + } + + def := exports.Get("default") + if def == nil { + return nil, fmt.Errorf("%w, file: %s", errNoExport, filename) + } + + if call, isCallable = goja.AssertFunction(def); isCallable { + def, err = call(exports, loader.defaultConfig) + if err != nil { + return nil, err + } + + if !isObject(def) { + return nil, errConfigNotObject + } + } + + return def.ToObject(loader.runtime), nil +} + +// toObject use JavaScript JSON.parse to create native goja object +// there could be a better solution.... (but Object.UnmarshallJSON is missing). +func toObject(runtime *goja.Runtime, bin json.RawMessage) (*goja.Object, error) { + val := runtime.Get("JSON").ToObject(runtime).Get("parse") + + call, _ := goja.AssertFunction(val) + + val, err := call(runtime.GlobalObject(), runtime.ToValue(string(bin))) + if err != nil { + return nil, err + } + + return val.ToObject(runtime), nil +} + +func loadConfigJS( + filename string, + config json.RawMessage, + proc *process, +) (json.RawMessage, error) { + loader, err := newConfigLoader(config, proc) + if err != nil { + return nil, err + } + + return loader.load(filename) +} + +// configConsole represents a JS configConsole implemented as a logrus.Logger. +type configConsole struct { + logger logrus.FieldLogger +} + +// Creates a console with the standard logrus logger. +func newConfigConsole(logger logrus.FieldLogger) *configConsole { + return &configConsole{logger.WithField("source", "console").WithField("extension", "dashboard")} +} + +func (c configConsole) log(level logrus.Level, args ...goja.Value) { + var strs strings.Builder + + for i := 0; i < len(args); i++ { + if i > 0 { + strs.WriteString(" ") + } + + strs.WriteString(c.valueString(args[i])) + } + + msg := strs.String() + + switch level { + case logrus.DebugLevel: + c.logger.Debug(msg) + + case logrus.InfoLevel: + c.logger.Info(msg) + + case logrus.WarnLevel: + c.logger.Warn(msg) + + case logrus.ErrorLevel: + c.logger.Error(msg) + + default: + c.logger.Info(msg) + } +} + +func (c configConsole) Log(args ...goja.Value) { + c.Info(args...) +} + +func (c configConsole) Debug(args ...goja.Value) { + c.log(logrus.DebugLevel, args...) +} + +func (c configConsole) Info(args ...goja.Value) { + c.log(logrus.InfoLevel, args...) +} + +func (c configConsole) Warn(args ...goja.Value) { + c.log(logrus.WarnLevel, args...) +} + +func (c configConsole) Error(args ...goja.Value) { + c.log(logrus.ErrorLevel, args...) +} + +func (c configConsole) valueString(value goja.Value) string { + mv, ok := value.(json.Marshaler) + if !ok { + return value.String() + } + + bin, err := json.Marshal(mv) + if err != nil { + return value.String() + } + + return string(bin) +} + +var ( + errNotFunction = errors.New("not a function") + errNoExport = errors.New("missing default export") + errConfigNotObject = errors.New("returned configuration is not an object") +) diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/event.go b/vendor/github.com/grafana/xk6-dashboard/dashboard/event.go new file mode 100644 index 00000000000..0eecf47a396 --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/event.go @@ -0,0 +1,47 @@ +// SPDX-FileCopyrightText: 2023 Iván Szkiba +// SPDX-FileCopyrightText: 2023 Raintank, Inc. dba Grafana Labs +// +// SPDX-License-Identifier: AGPL-3.0-only +// SPDX-License-Identifier: MIT + +package dashboard + +type eventListener interface { + onEvent(event string, data interface{}) + onStart() error + onStop() error +} + +type eventSource struct { + listeners []eventListener +} + +func (src *eventSource) addEventListener(listener eventListener) { + src.listeners = append(src.listeners, listener) +} + +func (src *eventSource) fireEvent(event string, data interface{}) { + for _, e := range src.listeners { + e.onEvent(event, data) + } +} + +func (src *eventSource) fireStart() error { + for _, e := range src.listeners { + if err := e.onStart(); err != nil { + return err + } + } + + return nil +} + +func (src *eventSource) fireStop() error { + for _, e := range src.listeners { + if err := e.onStop(); err != nil { + return err + } + } + + return nil +} diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/extension.go b/vendor/github.com/grafana/xk6-dashboard/dashboard/extension.go new file mode 100644 index 00000000000..e2793b4bd9d --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/extension.go @@ -0,0 +1,255 @@ +// SPDX-FileCopyrightText: 2021 - 2023 Iván Szkiba +// SPDX-FileCopyrightText: 2023 Raintank, Inc. dba Grafana Labs +// +// SPDX-License-Identifier: AGPL-3.0-only +// SPDX-License-Identifier: MIT + +// Package dashboard contains dashboard extension code. +package dashboard + +import ( + "fmt" + "sync/atomic" + "time" + + "github.com/pkg/browser" + "go.k6.io/k6/lib" + "go.k6.io/k6/metrics" + "go.k6.io/k6/output" +) + +// extension holds the runtime state of the dashboard extension. +type extension struct { + *eventSource + + assets *assets + proc *process + options *options + + buffer *output.SampleBuffer + + flusher *output.PeriodicFlusher + noFlush atomic.Bool + + server *webServer + + cumulative *meter + + seenMetrics map[string]struct{} + + period time.Duration + + name string + + param *paramData +} + +var _ output.Output = (*extension)(nil) + +// New creates new dashboard extension instance. +func New(params output.Params) (output.Output, error) { + assets := newCustomizedAssets(new(process).fromParams(params)) + + return newWithAssets(params, assets) +} + +func newWithAssets(params output.Params, assets *assets) (*extension, error) { + opts, err := getopts(params.ConfigArgument) + if err != nil { + return nil, err + } + + offset, _ := lib.GetEndOffset(params.ExecutionPlan) + period := opts.period(offset) + + ext := &extension{ + assets: assets, + proc: &process{logger: params.Logger, fs: params.FS}, + options: opts, + name: params.OutputType, + buffer: nil, + server: nil, + flusher: nil, + cumulative: nil, + seenMetrics: nil, + param: newParamData(¶ms).withPeriod(period).withEndOffest(offset), + period: period, + eventSource: new(eventSource), + } + + return ext, nil +} + +// Description returns a human-readable description of the output. +func (ext *extension) Description() string { + if ext.options.Port < 0 { + return ext.name + } + + return fmt.Sprintf("%s (%s) %s", ext.name, ext.options.addr(), ext.options.url()) +} + +// SetThresholds saves thresholds provided by k6 runtime. +func (ext *extension) SetThresholds(thresholds map[string]metrics.Thresholds) { + ext.param.withThresholds(thresholds) +} + +// Start starts metrics aggregation and event streaming. +func (ext *extension) Start() error { + if len(ext.options.Record) != 0 { + ext.addEventListener(newRecorder(ext.options.Record, ext.proc)) + } + + brf := newReporter(ext.options.Report, ext.assets, ext.proc) + + ext.addEventListener(brf) + + if ext.options.Port >= 0 { + ext.server = newWebServer(ext.assets.ui, brf, ext.proc.logger) + ext.addEventListener(ext.server) + + addr, err := ext.server.listenAndServe(ext.options.addr()) + if err != nil { + return err + } + + if ext.options.Port == 0 { + ext.options.Port = addr.Port + } + + if ext.options.Open { + _ = browser.OpenURL(ext.options.url()) + } + } + + ext.cumulative = newMeter(0, time.Now(), ext.options.Tags) + ext.seenMetrics = make(map[string]struct{}) + + if err := ext.fireStart(); err != nil { + return err + } + + ext.buffer = new(output.SampleBuffer) + + now := time.Now() + + ext.fireEvent(configEvent, ext.assets.config) + ext.fireEvent(paramEvent, ext.param) + + ext.updateAndSend(nil, newMeter(ext.period, now, ext.cumulative.tags), startEvent, now) + + flusher, err := output.NewPeriodicFlusher(ext.period, ext.flush) + if err != nil { + return err + } + + ext.flusher = flusher + + return nil +} + +// Stop flushes any remaining metrics and stops the extension. +func (ext *extension) Stop() error { + ext.noFlush.Store(true) + + ext.flusher.Stop() + + now := time.Now() + + ext.updateAndSend(nil, newMeter(ext.period, now, ext.options.Tags), stopEvent, now) + + return ext.fireStop() +} + +// AddMetricSamples adds the given metric samples to the internal buffer. +func (ext *extension) AddMetricSamples(samples []metrics.SampleContainer) { + ext.buffer.AddMetricSamples(samples) +} + +func (ext *extension) flush() { + samples := ext.buffer.GetBufferedSamples() + now := time.Now() + + if !ext.noFlush.Load() { // skip the last fraction period for sanpshot (called when flusher stops) + ext.updateAndSend(samples, newMeter(ext.period, now, ext.options.Tags), snapshotEvent, now) + } + + ext.updateAndSend(samples, ext.cumulative, cumulativeEvent, now) +} + +func (ext *extension) updateAndSend( + containers []metrics.SampleContainer, + met *meter, + event string, + now time.Time, +) { + data, err := met.update(containers, now) + if err != nil { + ext.proc.logger.WithError(err).Warn("Error while processing samples") + + return + } + + newbies := met.newbies(ext.seenMetrics) + if len(newbies) != 0 { + ext.fireEvent(metricEvent, newbies) + } + + ext.fireEvent(event, data) +} + +type paramData struct { + Thresholds map[string][]string `json:"thresholds,omitempty"` + Scenarios []string `json:"scenarios,omitempty"` + EndOffset time.Duration `json:"endOffset,omitempty"` + Period time.Duration `json:"period,omitempty"` + Tags []string `json:"tags,omitempty"` +} + +func newParamData(params *output.Params) *paramData { + param := new(paramData) + + for name := range params.ScriptOptions.Scenarios { + param.Scenarios = append(param.Scenarios, name) + } + + return param +} + +func (param *paramData) withTags(tags []string) *paramData { + param.Tags = tags + + return param +} + +func (param *paramData) withThresholds(thresholds map[string]metrics.Thresholds) *paramData { + if len(thresholds) == 0 { + return param + } + + param.Thresholds = make(map[string][]string, len(thresholds)) + + for name, value := range thresholds { + tre := make([]string, 0, len(value.Thresholds)) + + for _, threshold := range value.Thresholds { + tre = append(tre, threshold.Source) + } + + param.Thresholds[name] = tre + } + + return param +} + +func (param *paramData) withPeriod(period time.Duration) *paramData { + param.Period = time.Duration(period.Milliseconds()) + + return param +} + +func (param *paramData) withEndOffest(offset time.Duration) *paramData { + param.EndOffset = time.Duration(offset.Milliseconds()) + + return param +} diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/meter.go b/vendor/github.com/grafana/xk6-dashboard/dashboard/meter.go new file mode 100644 index 00000000000..94ecd754975 --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/meter.go @@ -0,0 +1,198 @@ +// SPDX-FileCopyrightText: 2023 Iván Szkiba +// SPDX-FileCopyrightText: 2023 Raintank, Inc. dba Grafana Labs +// +// SPDX-License-Identifier: AGPL-3.0-only +// SPDX-License-Identifier: MIT + +package dashboard + +import ( + "math" + "time" + + "go.k6.io/k6/metrics" +) + +type meter struct { + registry *registry + + clock *metrics.GaugeSink + period time.Duration + start time.Time + tags []string +} + +func newMeter(period time.Duration, now time.Time, tags []string) *meter { + registry := newRegistry() + metric := registry.mustGetOrNew("time", metrics.Gauge, metrics.Time) + clock, _ := metric.Sink.(*metrics.GaugeSink) + + start := now + clock.Value = float64(start.UnixMilli()) + + return &meter{ + registry: registry, + start: start, + clock: clock, + period: period, + tags: tags, + } +} + +func (m *meter) update(containers []metrics.SampleContainer, now time.Time) (map[string]sampleData, error) { + dur := m.period + if dur == 0 { + dur = now.Sub(m.start) + } + + m.clock.Value = float64(now.UnixMilli()) + + for _, container := range containers { + for _, sample := range container.GetSamples() { + if err := m.add(sample); err != nil { + return nil, err + } + } + } + + return m.format(dur), nil +} + +func (m *meter) add(sample metrics.Sample) error { + metric, err := m.registry.getOrNew(sample.Metric.Name, sample.Metric.Type, sample.Metric.Contains) + if err != nil { + return err + } + + metric.Sink.Add(sample) + + if sample.Tags == nil { + return nil + } + + for _, tag := range m.tags { + val, ok := sample.Tags.Get(tag) + if !ok || len(val) == 0 { + continue + } + + sub, err := metric.AddSubmetric(tag + ":" + val) + if err != nil { + return err + } + + sub.Metric.Sink.Add(sample) + } + + return nil +} + +func (m *meter) format(dur time.Duration) map[string]sampleData { + fmt := func(met *metrics.Metric) map[string]float64 { + sample := met.Sink.Format(dur) + + if sink, ok := met.Sink.(*metrics.TrendSink); ok { + sample[pc99Name] = sink.P(pc99) + } + + for name, value := range sample { + sample[name] = significant(value) + } + + return sample + } + + out := make(map[string]sampleData, len(m.registry.names)) + + for _, name := range m.registry.names { + metric := m.registry.Get(name) + if metric == nil { + continue + } + + out[name] = fmt(metric) + + for _, sub := range metric.Submetrics { + out[sub.Name] = fmt(sub.Metric) + } + } + + return out +} + +func significant(num float64) float64 { + const ( + ten1 = float64(10) + ten2 = ten1 * 10 + ten3 = ten2 * 10 + ten4 = ten3 * 10 + ten5 = ten4 * 10 + ) + + if num == float64(int(num)) { + return num + } + + if num > ten4 { + return math.Trunc(num) + } + + if num > ten3 { + return math.Trunc(num*ten1) / ten1 + } + + if num > ten2 { + return math.Trunc(num*ten2) / ten2 + } + + if num > ten1 { + return math.Trunc(num*ten3) / ten3 + } + + if num > 1 { + return math.Trunc(num*ten4) / ten4 + } + + return math.Trunc(num*ten5) / ten5 +} + +func (m *meter) newbies(seen map[string]struct{}) map[string]metricData { + names := m.registry.newbies(seen) + if len(names) == 0 { + return nil + } + + newbies := make(map[string]metricData, len(names)) + + for _, name := range names { + metric := m.registry.Get(name) + if metric == nil { + continue + } + + newbies[name] = *newMetricData(metric) + } + + return newbies +} + +type metricData struct { + Type metrics.MetricType `json:"type"` + Contains metrics.ValueType `json:"contains,omitempty"` + Tainted bool `json:"tainted,omitempty"` +} + +func newMetricData(origin *metrics.Metric) *metricData { + return &metricData{ + Type: origin.Type, + Contains: origin.Contains, + Tainted: origin.Tainted.Bool, + } +} + +type sampleData map[string]float64 + +const ( + pc99 = 0.99 + pc99Name = "p(99)" +) diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/options.go b/vendor/github.com/grafana/xk6-dashboard/dashboard/options.go new file mode 100644 index 00000000000..6795e0b516c --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/options.go @@ -0,0 +1,136 @@ +// SPDX-FileCopyrightText: 2023 Iván Szkiba +// SPDX-FileCopyrightText: 2023 Raintank, Inc. dba Grafana Labs +// +// SPDX-License-Identifier: AGPL-3.0-only +// SPDX-License-Identifier: MIT + +package dashboard + +import ( + "errors" + "math" + "net" + "net/url" + "reflect" + "strconv" + "strings" + "time" + + "github.com/gorilla/schema" +) + +const ( + defaultHost = "" + defaultPort = 5665 + defaultPeriod = time.Second * 10 + defaultOpen = false + defaultReport = "" + defaultRecord = "" +) + +func defaultTags() []string { return []string{"group"} } + +type options struct { + Port int + Host string + Period time.Duration + Open bool + Report string + Record string + Tags []string `schema:"tag"` + TagsS string `schema:"tags"` +} + +func getopts(query string) (opts *options, err error) { //nolint:nonamedreturns + opts = &options{ + Port: defaultPort, + Host: defaultHost, + Period: defaultPeriod, + Open: defaultOpen, + Report: defaultReport, + Record: defaultRecord, + Tags: defaultTags(), + TagsS: "", + } + + if query == "" { + return opts, nil + } + + value, err := url.ParseQuery(query) + if err != nil { + return nil, err + } + + decoder := schema.NewDecoder() + + decoder.IgnoreUnknownKeys(true) + + decoder.RegisterConverter(time.Second, func(s string) reflect.Value { + v, eerr := time.ParseDuration(s) + if eerr != nil { + return reflect.ValueOf(err) + } + + return reflect.ValueOf(v) + }) + + defer func() { + if r := recover(); r != nil { + err = errInvalidDuration + } + }() + + if e := decoder.Decode(opts, value); e != nil { + err = e + } + + if value.Has("open") && len(value.Get("open")) == 0 { + opts.Open = true + } + + if len(opts.TagsS) != 0 { + opts.Tags = append(opts.Tags, strings.Split(opts.TagsS, ",")...) + } + + return opts, err +} + +func (opts *options) addr() string { + if opts.Port < 0 { + return "" + } + + return net.JoinHostPort(opts.Host, strconv.Itoa(opts.Port)) +} + +func (opts *options) url() string { + if opts.Port < 0 { + return "" + } + + host := opts.Host + if host == "" { + host = "127.0.0.1" + } + + return "http://" + net.JoinHostPort(host, strconv.Itoa(opts.Port)) +} + +// period adjusts period, limit points per test run to 'points'. +func (opts *options) period(duration time.Duration) time.Duration { + if duration == 0 { + return opts.Period + } + + optimal := float64(duration) / float64(points) + + return time.Duration(math.Ceil(optimal/float64(opts.Period))) * opts.Period +} + +/* +approx. 1MB max report size, 8 hours test run with 10sec event period. +*/ +const points = 2880 + +var errInvalidDuration = errors.New("invalid duration") diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/process.go b/vendor/github.com/grafana/xk6-dashboard/dashboard/process.go new file mode 100644 index 00000000000..11ebdb2ac60 --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/process.go @@ -0,0 +1,34 @@ +// SPDX-FileCopyrightText: 2023 Raintank, Inc. dba Grafana Labs +// +// SPDX-License-Identifier: AGPL-3.0-only + +package dashboard + +import ( + "github.com/sirupsen/logrus" + "go.k6.io/k6/cmd/state" + "go.k6.io/k6/lib/fsext" + "go.k6.io/k6/output" +) + +type process struct { + logger logrus.FieldLogger + fs fsext.Fs + env map[string]string +} + +func (proc *process) fromParams(params output.Params) *process { + proc.fs = params.FS + proc.logger = params.Logger + proc.env = params.Environment + + return proc +} + +func (proc *process) fromGlobalState(gs *state.GlobalState) *process { + proc.fs = gs.FS + proc.logger = gs.Logger + proc.env = gs.Env + + return proc +} diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/record.go b/vendor/github.com/grafana/xk6-dashboard/dashboard/record.go new file mode 100644 index 00000000000..84219a76b50 --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/record.go @@ -0,0 +1,73 @@ +// SPDX-FileCopyrightText: 2023 Raintank, Inc. dba Grafana Labs +// +// SPDX-License-Identifier: AGPL-3.0-only + +package dashboard + +import ( + "compress/gzip" + "encoding/json" + "io" + "strings" + "sync" +) + +type recorder struct { + output string + proc *process + mu sync.RWMutex + encoder *json.Encoder + writer io.WriteCloser +} + +var _ eventListener = (*recorder)(nil) + +func newRecorder(output string, proc *process) *recorder { + rec := &recorder{ + output: output, + proc: proc, + } + + return rec +} + +func (rec *recorder) onStart() error { + file, err := rec.proc.fs.Create(rec.output) + if err != nil { + return err + } + + rec.writer = file + + if strings.HasSuffix(rec.output, ".gz") { + rec.writer = gzip.NewWriter(file) + } + + rec.encoder = json.NewEncoder(rec.writer) + + return nil +} + +func (rec *recorder) onStop() error { + return rec.writer.Close() +} + +func (rec *recorder) onEvent(name string, data interface{}) { + rec.mu.Lock() + defer rec.mu.Unlock() + + if name == configEvent { + return + } + + event := &recorderEnvelope{Name: name, Data: data} + + if err := rec.encoder.Encode(event); err != nil { + rec.proc.logger.Warn(err) + } +} + +type recorderEnvelope struct { + Name string `json:"event"` + Data interface{} `json:"data"` +} diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/registry.go b/vendor/github.com/grafana/xk6-dashboard/dashboard/registry.go new file mode 100644 index 00000000000..cd8081e734b --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/registry.go @@ -0,0 +1,73 @@ +// SPDX-FileCopyrightText: 2023 Iván Szkiba +// SPDX-FileCopyrightText: 2023 Raintank, Inc. dba Grafana Labs +// +// SPDX-License-Identifier: AGPL-3.0-only +// SPDX-License-Identifier: MIT + +package dashboard + +import ( + "go.k6.io/k6/metrics" +) + +// registry is what can create metrics and make them iterable. +type registry struct { + *metrics.Registry + names []string +} + +// newRegistry returns a new registry. +func newRegistry() *registry { + return ®istry{ + Registry: metrics.NewRegistry(), + names: make([]string, 0), + } +} + +// getOrNew returns existing metric or create new metric registered to this registry. +func (reg *registry) getOrNew( + name string, + typ metrics.MetricType, + valTyp ...metrics.ValueType, +) (*metrics.Metric, error) { + if metric := reg.Registry.Get(name); metric != nil { + return metric, nil + } + + metric, err := reg.Registry.NewMetric(name, typ, valTyp...) + if err != nil { + return nil, err + } + + reg.names = append(reg.names, name) + + return metric, nil +} + +// mustGetOrNew is like getOrNew, but will panic if there is an error. +func (reg *registry) mustGetOrNew( + name string, + typ metrics.MetricType, + valTyp ...metrics.ValueType, +) *metrics.Metric { + metric, err := reg.getOrNew(name, typ, valTyp...) + if err != nil { + panic(err) + } + + return metric +} + +// newbies return newly registered names since last seen. +func (reg *registry) newbies(seen map[string]struct{}) []string { + var names []string + + for _, name := range reg.names { + if _, ok := seen[name]; !ok { + names = append(names, name) + seen[name] = struct{}{} + } + } + + return names +} diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/replay.go b/vendor/github.com/grafana/xk6-dashboard/dashboard/replay.go new file mode 100644 index 00000000000..d1a181e6998 --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/replay.go @@ -0,0 +1,112 @@ +// SPDX-FileCopyrightText: 2023 Iván Szkiba +// SPDX-FileCopyrightText: 2023 Raintank, Inc. dba Grafana Labs +// +// SPDX-License-Identifier: AGPL-3.0-only +// SPDX-License-Identifier: MIT + +package dashboard + +import ( + "compress/gzip" + "encoding/json" + "io" + "strings" + + "github.com/pkg/browser" + "github.com/spf13/afero" +) + +type replayer struct { + *eventSource + + reader io.ReadCloser + + options *options + + assets *assets + proc *process +} + +func replay(input string, opts *options, assets *assets, proc *process) error { + rep := &replayer{ + options: opts, + assets: assets, + proc: proc, + eventSource: new(eventSource), + } + + var inputFile afero.File + var err error + + if inputFile, err = proc.fs.Open(input); err != nil { + return err + } + + rep.reader = inputFile + + if strings.HasSuffix(input, gzSuffix) { + if rep.reader, err = gzip.NewReader(inputFile); err != nil { + return err + } + + defer closer(rep.reader, proc.logger) + } + + defer closer(inputFile, proc.logger) + + return rep.run() +} + +func (rep *replayer) run() error { + rptr := newReporter(rep.options.Report, rep.assets, rep.proc) + + rep.addEventListener(rptr) + + if rep.options.Port >= 0 { + server := newWebServer(rep.assets.ui, rptr, rep.proc.logger) + + rep.addEventListener(server) + + addr, err := server.listenAndServe(rep.options.addr()) + if err != nil { + return err + } + + if rep.options.Port == 0 { + rep.options.Port = addr.Port + } + + if rep.options.Open { + _ = browser.OpenURL(rep.options.url()) + } + } + + if err := rep.fireStart(); err != nil { + return err + } + + rep.fireEvent(configEvent, rep.assets.config) + + decoder := json.NewDecoder(rep.reader) + + for decoder.More() { + var input replayerEnvelope + + if err := decoder.Decode(&input); err != nil { + return err + } + + if input.Name == configEvent { + continue + } + + rep.fireEvent(input.Name, input.Data) + } + + return rep.fireStop() +} + +type replayerEnvelope struct { + Name string `json:"event"` + Data map[string]interface{} `json:"data"` +} diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/report.go b/vendor/github.com/grafana/xk6-dashboard/dashboard/report.go new file mode 100644 index 00000000000..bc78a74fff9 --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/report.go @@ -0,0 +1,224 @@ +// SPDX-FileCopyrightText: 2023 Iván Szkiba +// SPDX-FileCopyrightText: 2023 Raintank, Inc. dba Grafana Labs +// +// SPDX-License-Identifier: AGPL-3.0-only +// SPDX-License-Identifier: MIT + +package dashboard + +import ( + "bytes" + "compress/gzip" + "encoding/base64" + "encoding/json" + "io" + "net/http" + "path/filepath" + "sync" +) + +type reporter struct { + assets *assets + proc *process + + data *reportData + output string + mu sync.RWMutex +} + +var ( + _ eventListener = (*reporter)(nil) + _ http.Handler = (*reporter)(nil) +) + +func newReporter(output string, assets *assets, proc *process) *reporter { + rep := &reporter{ //nolint:exhaustruct + data: newReportData(assets.config), + assets: assets, + proc: proc, + output: output, + } + + return rep +} + +func (rep *reporter) onStart() error { + return nil +} + +func (rep *reporter) onStop() error { + if len(rep.output) == 0 { + return nil + } + + file, err := rep.proc.fs.Create(rep.output) + if err != nil { + return err + } + + compress := filepath.Ext(rep.output) == ".gz" + + var out io.WriteCloser = file + + if compress { + out = gzip.NewWriter(file) + } + + if err := rep.exportHTML(out); err != nil { + return err + } + + if compress { + if err := out.Close(); err != nil { + return err + } + } + + return file.Close() +} + +func (rep *reporter) onEvent(name string, data interface{}) { + rep.mu.Lock() + defer rep.mu.Unlock() + + if name == configEvent { + return + } + + envelope := &recorderEnvelope{Name: name, Data: data} + + if name == cumulativeEvent { + rep.data.cumulative = envelope + + return + } + + if err := rep.data.encoder.Encode(envelope); err != nil { + if eerr := rep.data.encoder.Encode(nil); eerr != nil { + rep.proc.logger.Error(err) + } + + rep.proc.logger.Error(err) + } +} + +func (rep *reporter) ServeHTTP(res http.ResponseWriter, _ *http.Request) { + res.Header().Set("Content-Type", "text/html; charset=utf-8") + + if err := rep.exportHTML(res); err != nil { + http.Error(res, err.Error(), http.StatusInternalServerError) + } +} + +func (rep *reporter) exportJSON(out io.Writer) error { + rep.mu.RLock() + defer rep.mu.RUnlock() + + return rep.data.exportJSON(out) +} + +func (rep *reporter) exportBase64(out io.Writer) error { + outB64 := base64.NewEncoder(base64.StdEncoding, out) + outGZ := gzip.NewWriter(outB64) + + if err := rep.exportJSON(outGZ); err != nil { + return err + } + + if err := outGZ.Close(); err != nil { + return err + } + + return outB64.Close() +} + +func (rep *reporter) exportHTML(out io.Writer) error { + file, err := rep.assets.report.Open("index.html") + if err != nil { + return err + } + + html, err := io.ReadAll(file) + if err != nil { + return err + } + + html, err = rep.inject(out, html, []byte(dataTag), rep.exportBase64) + if err != nil { + return err + } + + if _, err := out.Write(html); err != nil { + return err + } + + return nil +} + +func (rep *reporter) inject( + out io.Writer, + html []byte, + tag []byte, + dataFunc func(io.Writer) error, +) ([]byte, error) { + idx := bytes.Index(html, tag) + + if idx < 0 { + panic("invalid brief HTML, no tag: " + string(tag)) + } + + idx += len(tag) + + if _, err := out.Write(html[:idx]); err != nil { + return nil, err + } + + if err := dataFunc(out); err != nil { + return nil, err + } + + return html[idx:], nil +} + +type reportData struct { + config *recorderEnvelope + buff bytes.Buffer + encoder *json.Encoder + cumulative *recorderEnvelope +} + +func newReportData(config json.RawMessage) *reportData { + data := new(reportData) + + if config != nil { + data.config = &recorderEnvelope{Name: configEvent, Data: config} + } + + data.encoder = json.NewEncoder(&data.buff) + + return data +} + +func (data *reportData) exportJSON(out io.Writer) error { + encoder := json.NewEncoder(out) + + if data.config != nil { + if err := encoder.Encode(data.config); err != nil { + return err + } + } + + if data.buff.Len() != 0 { + if _, err := out.Write(data.buff.Bytes()); err != nil { + return err + } + } + + if data.cumulative != nil { + return encoder.Encode(data.cumulative) + } + + return nil +} + +const dataTag = ` + + + + \ No newline at end of file diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/assets/packages/ui/dist/index.html b/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/assets/packages/ui/dist/index.html new file mode 100644 index 00000000000..d4b99f917b1 --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/assets/packages/ui/dist/index.html @@ -0,0 +1,19 @@ + + + + + + + + + + +
+ + + + \ No newline at end of file diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/customize/config-bad.json.license b/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/customize/config-bad.json.license new file mode 100644 index 00000000000..f5b51f2bcd1 --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/customize/config-bad.json.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2023 Raintank, Inc. dba Grafana Labs + +SPDX-License-Identifier: AGPL-3.0-only diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/customize/config-custom.js b/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/customize/config-custom.js new file mode 100644 index 00000000000..a5f21124214 --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/customize/config-custom.js @@ -0,0 +1,51 @@ +// SPDX-FileCopyrightText: 2023 Raintank, Inc. dba Grafana Labs +// +// SPDX-License-Identifier: AGPL-3.0-only + +export default function (config) { + function getById(id) { + return this.filter( + (/** @type {{ id: string; }} */ element) => element.id == id + ).at(0); + } + + Array.prototype["getById"] = getById; + + function durationPanel(suffix) { + return { + id: `http_req_duration_${suffix}`, + title: `HTTP Request Duration ${suffix}`, + metric: `http_req_duration_trend_${suffix}`, + format: "duration", + }; + } + + const overview = config.tabs.getById("overview_snapshot"); + + const customPanels = [ + overview.panels.getById("vus"), + overview.panels.getById("http_reqs"), + durationPanel("avg"), + durationPanel("p(90)"), + durationPanel("p(95)"), + durationPanel("p(99)"), + ]; + + const durationChart = Object.assign( + {}, + overview.charts.getById("http_req_duration") + ); + + const customTab = { + id: "custom", + title: "Custom", + event: overview.event, + panels: customPanels, + charts: [overview.charts.getById("http_reqs"), durationChart], + description: "Example of customizing the display of metrics.", + }; + + config.tabs.push(customTab); + + return config; +} diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/customize/config.json.license b/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/customize/config.json.license new file mode 100644 index 00000000000..f5b51f2bcd1 --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/customize/config.json.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2023 Raintank, Inc. dba Grafana Labs + +SPDX-License-Identifier: AGPL-3.0-only diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/customize/config/config.json.license b/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/customize/config/config.json.license new file mode 100644 index 00000000000..f5b51f2bcd1 --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/customize/config/config.json.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2023 Raintank, Inc. dba Grafana Labs + +SPDX-License-Identifier: AGPL-3.0-only diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/result.json.gz b/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/result.json.gz new file mode 100644 index 00000000000..3c72ccfb03f Binary files /dev/null and b/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/result.json.gz differ diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/result.json.gz.license b/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/result.json.gz.license new file mode 100644 index 00000000000..f5b51f2bcd1 --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/result.json.gz.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2023 Raintank, Inc. dba Grafana Labs + +SPDX-License-Identifier: AGPL-3.0-only diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/result.json.license b/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/result.json.license new file mode 100644 index 00000000000..f5b51f2bcd1 --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/result.json.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2023 Raintank, Inc. dba Grafana Labs + +SPDX-License-Identifier: AGPL-3.0-only diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/result.ndjson b/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/result.ndjson new file mode 100644 index 00000000000..830a326c904 --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/result.ndjson @@ -0,0 +1,25 @@ +{"event":"param","data":{"scenarios":["contacts"],"endOffset":50000,"period":2000}} +{"event":"metric","data":{"time":{"type":"gauge","contains":"time"}}} +{"event":"start","data":{"time":{"value":1694199790301}}} +{"event":"metric","data":{"data_received":{"type":"counter","contains":"data"},"data_sent":{"type":"counter","contains":"data"},"http_req_blocked":{"type":"trend","contains":"time"},"http_req_connecting":{"type":"trend","contains":"time"},"http_req_duration":{"type":"trend","contains":"time"},"http_req_failed":{"type":"rate"},"http_req_receiving":{"type":"trend","contains":"time"},"http_req_sending":{"type":"trend","contains":"time"},"http_req_tls_handshaking":{"type":"trend","contains":"time"},"http_req_waiting":{"type":"trend","contains":"time"},"http_reqs":{"type":"counter"},"iteration_duration":{"type":"trend","contains":"time"},"iterations":{"type":"counter"},"vus":{"type":"gauge"},"vus_max":{"type":"gauge"}}} +{"event":"snapshot","data":{"data_received":{"count":153170,"rate":76585},"data_sent":{"count":3104,"rate":1552},"http_req_blocked":{"avg":29.227,"max":257.55,"med":0.00787,"min":0.00363,"p(90)":125.13,"p(95)":220.24,"p(99)":256.15},"http_req_connecting":{"avg":18.841,"max":123.35,"med":0,"min":0,"p(90)":121.61,"p(95)":123.25,"p(99)":123.33},"http_req_duration":{"avg":122.61,"max":127.34,"med":121.97,"min":120.68,"p(90)":125.07,"p(95)":125.75,"p(99)":126.96},"http_req_failed":{"rate":0},"http_req_receiving":{"avg":0.13948,"max":0.22651,"med":0.14456,"min":0.05937,"p(90)":0.18392,"p(95)":0.20333,"p(99)":0.22162},"http_req_sending":{"avg":0.05278,"max":0.2279,"med":0.04223,"min":0.01573,"p(90)":0.06247,"p(95)":0.13923,"p(99)":0.21213},"http_req_tls_handshaking":{"avg":10.234,"max":134.34,"med":0,"min":0,"p(90)":0,"p(95)":98.805,"p(99)":133.69},"http_req_waiting":{"avg":122.42,"max":127.18,"med":121.79,"min":120.52,"p(90)":124.88,"p(95)":125.59,"p(99)":126.81},"http_reqs":{"count":26,"rate":13},"iteration_duration":{"avg":308.92,"max":629.98,"med":245.65,"min":243.3,"p(90)":584.92,"p(95)":625.68,"p(99)":629.12},"iterations":{"count":12,"rate":6},"time":{"value":1694199792303},"vus":{"value":2},"vus_max":{"value":2}}} +{"event":"cumulative","data":{"data_received":{"count":153170,"rate":76505},"data_sent":{"count":3104,"rate":1550.3},"http_req_blocked":{"avg":29.227,"max":257.55,"med":0.00787,"min":0.00363,"p(90)":125.13,"p(95)":220.24,"p(99)":256.15},"http_req_connecting":{"avg":18.841,"max":123.35,"med":0,"min":0,"p(90)":121.61,"p(95)":123.25,"p(99)":123.33},"http_req_duration":{"avg":122.61,"max":127.34,"med":121.97,"min":120.68,"p(90)":125.07,"p(95)":125.75,"p(99)":126.96},"http_req_failed":{"rate":0},"http_req_receiving":{"avg":0.13948,"max":0.22651,"med":0.14456,"min":0.05937,"p(90)":0.18392,"p(95)":0.20333,"p(99)":0.22162},"http_req_sending":{"avg":0.05278,"max":0.2279,"med":0.04223,"min":0.01573,"p(90)":0.06247,"p(95)":0.13923,"p(99)":0.21213},"http_req_tls_handshaking":{"avg":10.234,"max":134.34,"med":0,"min":0,"p(90)":0,"p(95)":98.805,"p(99)":133.69},"http_req_waiting":{"avg":122.42,"max":127.18,"med":121.79,"min":120.52,"p(90)":124.88,"p(95)":125.59,"p(99)":126.81},"http_reqs":{"count":26,"rate":12.986},"iteration_duration":{"avg":308.92,"max":629.98,"med":245.65,"min":243.3,"p(90)":584.92,"p(95)":625.68,"p(99)":629.12},"iterations":{"count":12,"rate":5.9937},"time":{"value":1694199792303},"vus":{"value":2},"vus_max":{"value":2}}} +{"event":"snapshot","data":{"data_received":{"count":189468,"rate":94734},"data_sent":{"count":3232,"rate":1616},"http_req_blocked":{"avg":0.00767,"max":0.02788,"med":0.00733,"min":0.0022,"p(90)":0.01121,"p(95)":0.01619,"p(99)":0.02464},"http_req_connecting":{"avg":0,"max":0,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":0},"http_req_duration":{"avg":122.44,"max":126.43,"med":121.72,"min":120.87,"p(90)":124.82,"p(95)":125.2,"p(99)":126.08},"http_req_failed":{"rate":0},"http_req_receiving":{"avg":0.12385,"max":0.345,"med":0.12793,"min":0.04362,"p(90)":0.17615,"p(95)":0.2122,"p(99)":0.30785},"http_req_sending":{"avg":0.03526,"max":0.07822,"med":0.03757,"min":0.01048,"p(90)":0.0505,"p(95)":0.06108,"p(99)":0.07342},"http_req_tls_handshaking":{"avg":0,"max":0,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":0},"http_req_waiting":{"avg":122.28,"max":126.22,"med":121.56,"min":120.65,"p(90)":124.66,"p(95)":125.04,"p(99)":125.88},"http_reqs":{"count":32,"rate":16},"iteration_duration":{"avg":245.21,"max":247.84,"med":245.32,"min":242.69,"p(90)":247.35,"p(95)":247.73,"p(99)":247.82},"iterations":{"count":16,"rate":8},"time":{"value":1694199794303},"vus":{"value":2},"vus_max":{"value":2}}} +{"event":"cumulative","data":{"data_received":{"count":342638,"rate":85622},"data_sent":{"count":6336,"rate":1583.3},"http_req_blocked":{"avg":13.106,"max":257.55,"med":0.00751,"min":0.0022,"p(90)":0.01585,"p(95)":125.09,"p(99)":254.35},"http_req_connecting":{"avg":8.446,"max":123.35,"med":0,"min":0,"p(90)":0,"p(95)":120.54,"p(99)":123.31},"http_req_duration":{"avg":122.51,"max":127.34,"med":121.85,"min":120.68,"p(90)":124.92,"p(95)":125.58,"p(99)":126.82},"http_req_failed":{"rate":0},"http_req_receiving":{"avg":0.13086,"max":0.345,"med":0.13818,"min":0.04362,"p(90)":0.18253,"p(95)":0.20967,"p(99)":0.27746},"http_req_sending":{"avg":0.04311,"max":0.2279,"med":0.03956,"min":0.01048,"p(90)":0.06108,"p(95)":0.06506,"p(99)":0.19194},"http_req_tls_handshaking":{"avg":4.5877,"max":134.34,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":132.86},"http_req_waiting":{"avg":122.34,"max":127.18,"med":121.71,"min":120.52,"p(90)":124.77,"p(95)":125.4,"p(99)":126.63},"http_reqs":{"count":58,"rate":14.493},"iteration_duration":{"avg":272.51,"max":629.98,"med":245.35,"min":242.69,"p(90)":248.5,"p(95)":491.78,"p(99)":627.87},"iterations":{"count":28,"rate":6.997},"time":{"value":1694199794303},"vus":{"value":2},"vus_max":{"value":2}}} +{"event":"snapshot","data":{"data_received":{"count":201269,"rate":100634},"data_sent":{"count":3434,"rate":1717},"http_req_blocked":{"avg":0.0036,"max":0.0104,"med":0.00296,"min":0.00186,"p(90)":0.00618,"p(95)":0.00683,"p(99)":0.00945},"http_req_connecting":{"avg":0,"max":0,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":0},"http_req_duration":{"avg":122.3,"max":126.51,"med":121.55,"min":120.53,"p(90)":124.78,"p(95)":125.07,"p(99)":126.13},"http_req_failed":{"rate":0},"http_req_receiving":{"avg":0.0663,"max":0.16011,"med":0.05084,"min":0.03411,"p(90)":0.11921,"p(95)":0.13035,"p(99)":0.1512},"http_req_sending":{"avg":0.01758,"max":0.0411,"med":0.01396,"min":0.01026,"p(90)":0.02853,"p(95)":0.03995,"p(99)":0.04091},"http_req_tls_handshaking":{"avg":0,"max":0,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":0},"http_req_waiting":{"avg":122.21,"max":126.43,"med":121.45,"min":120.49,"p(90)":124.72,"p(95)":125,"p(99)":126.06},"http_reqs":{"count":33,"rate":16.5},"iteration_duration":{"avg":244.7,"max":247.43,"med":244.85,"min":242.18,"p(90)":246.26,"p(95)":246.57,"p(99)":247.26},"iterations":{"count":17,"rate":8.5},"time":{"value":1694199796303},"vus":{"value":2},"vus_max":{"value":2}}} +{"event":"cumulative","data":{"data_received":{"count":543907,"rate":90622},"data_sent":{"count":9770,"rate":1627.8},"http_req_blocked":{"avg":8.3547,"max":257.55,"med":0.00599,"min":0.00186,"p(90)":0.01094,"p(95)":0.02265,"p(99)":252.49},"http_req_connecting":{"avg":5.3831,"max":123.35,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":123.29},"http_req_duration":{"avg":122.43,"max":127.34,"med":121.71,"min":120.53,"p(90)":124.84,"p(95)":125.43,"p(99)":126.59},"http_req_failed":{"rate":0},"http_req_receiving":{"avg":0.10745,"max":0.345,"med":0.10199,"min":0.03411,"p(90)":0.16574,"p(95)":0.19706,"p(99)":0.23836},"http_req_sending":{"avg":0.03386,"max":0.2279,"med":0.03114,"min":0.01026,"p(90)":0.05379,"p(95)":0.06247,"p(99)":0.17112},"http_req_tls_handshaking":{"avg":2.924,"max":134.34,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":132},"http_req_waiting":{"avg":122.29,"max":127.18,"med":121.56,"min":120.49,"p(90)":124.73,"p(95)":125.31,"p(99)":126.5},"http_reqs":{"count":91,"rate":15.161},"iteration_duration":{"avg":262.01,"max":629.98,"med":245.12,"min":242.18,"p(90)":247.78,"p(95)":249.31,"p(99)":626.54},"iterations":{"count":45,"rate":7.4976},"time":{"value":1694199796303},"vus":{"value":2},"vus_max":{"value":2}}} +{"event":"snapshot","data":{"data_received":{"count":189512,"rate":94756},"data_sent":{"count":3232,"rate":1616},"http_req_blocked":{"avg":0.00629,"max":0.01046,"med":0.00633,"min":0.00201,"p(90)":0.00945,"p(95)":0.00985,"p(99)":0.01029},"http_req_connecting":{"avg":0,"max":0,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":0},"http_req_duration":{"avg":122.36,"max":126.29,"med":121.73,"min":120.78,"p(90)":124.68,"p(95)":125.05,"p(99)":125.96},"http_req_failed":{"rate":0},"http_req_receiving":{"avg":0.12104,"max":0.1929,"med":0.12939,"min":0.03917,"p(90)":0.18094,"p(95)":0.19196,"p(99)":0.1928},"http_req_sending":{"avg":0.03961,"max":0.21806,"med":0.03439,"min":0.01178,"p(90)":0.05093,"p(95)":0.05841,"p(99)":0.17029},"http_req_tls_handshaking":{"avg":0,"max":0,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":0},"http_req_waiting":{"avg":122.2,"max":126.09,"med":121.54,"min":120.6,"p(90)":124.58,"p(95)":124.88,"p(99)":125.77},"http_reqs":{"count":32,"rate":16},"iteration_duration":{"avg":244.94,"max":248.33,"med":245.23,"min":242.48,"p(90)":246.39,"p(95)":246.9,"p(99)":248.04},"iterations":{"count":16,"rate":8},"time":{"value":1694199798303},"vus":{"value":2},"vus_max":{"value":2}}} +{"event":"cumulative","data":{"data_received":{"count":733419,"rate":91658},"data_sent":{"count":13002,"rate":1624.9},"http_req_blocked":{"avg":6.1828,"max":257.55,"med":0.00616,"min":0.00186,"p(90)":0.0101,"p(95)":0.01479,"p(99)":224.05},"http_req_connecting":{"avg":3.9826,"max":123.35,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":123.25},"http_req_duration":{"avg":122.42,"max":127.34,"med":121.71,"min":120.53,"p(90)":124.83,"p(95)":125.32,"p(99)":126.49},"http_req_failed":{"rate":0},"http_req_receiving":{"avg":0.11099,"max":0.345,"med":0.11401,"min":0.03411,"p(90)":0.17496,"p(95)":0.19257,"p(99)":0.22622},"http_req_sending":{"avg":0.03535,"max":0.2279,"med":0.03352,"min":0.01026,"p(90)":0.05324,"p(95)":0.0625,"p(99)":0.20634},"http_req_tls_handshaking":{"avg":2.1633,"max":134.34,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":102.75},"http_req_waiting":{"avg":122.27,"max":127.18,"med":121.56,"min":120.49,"p(90)":124.72,"p(95)":125.25,"p(99)":126.38},"http_reqs":{"count":123,"rate":15.371},"iteration_duration":{"avg":257.53,"max":629.98,"med":245.12,"min":242.18,"p(90)":247.7,"p(95)":248.33,"p(99)":625.29},"iterations":{"count":61,"rate":7.6234},"time":{"value":1694199798303},"vus":{"value":2},"vus_max":{"value":2}}} +{"event":"snapshot","data":{"data_received":{"count":189490,"rate":94745},"data_sent":{"count":3232,"rate":1616},"http_req_blocked":{"avg":0.00738,"max":0.01961,"med":0.00721,"min":0.00211,"p(90)":0.0104,"p(95)":0.0126,"p(99)":0.01797},"http_req_connecting":{"avg":0,"max":0,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":0},"http_req_duration":{"avg":122.68,"max":128.84,"med":121.98,"min":120.98,"p(90)":125,"p(95)":125.47,"p(99)":127.86},"http_req_failed":{"rate":0},"http_req_receiving":{"avg":0.12157,"max":0.19103,"med":0.12322,"min":0.04171,"p(90)":0.17096,"p(95)":0.17806,"p(99)":0.18855},"http_req_sending":{"avg":0.03566,"max":0.06118,"med":0.03449,"min":0.01066,"p(90)":0.0533,"p(95)":0.05519,"p(99)":0.05978},"http_req_tls_handshaking":{"avg":0,"max":0,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":0},"http_req_waiting":{"avg":122.52,"max":128.65,"med":121.83,"min":120.82,"p(90)":124.8,"p(95)":125.29,"p(99)":127.68},"http_reqs":{"count":32,"rate":16},"iteration_duration":{"avg":245.62,"max":250.66,"med":245.5,"min":243.43,"p(90)":247.64,"p(95)":248.75,"p(99)":250.28},"iterations":{"count":16,"rate":8},"time":{"value":1694199800302},"vus":{"value":2},"vus_max":{"value":2}}} +{"event":"cumulative","data":{"data_received":{"count":922909,"rate":92278},"data_sent":{"count":16234,"rate":1623.1},"http_req_blocked":{"avg":4.9078,"max":257.55,"med":0.00632,"min":0.00186,"p(90)":0.0103,"p(95)":0.01458,"p(99)":183.48},"http_req_connecting":{"avg":3.1604,"max":123.35,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":123.21},"http_req_duration":{"avg":122.47,"max":128.84,"med":121.75,"min":120.53,"p(90)":124.87,"p(95)":125.38,"p(99)":126.89},"http_req_failed":{"rate":0},"http_req_receiving":{"avg":0.11317,"max":0.345,"med":0.11669,"min":0.03411,"p(90)":0.17384,"p(95)":0.19178,"p(99)":0.22579},"http_req_sending":{"avg":0.03542,"max":0.2279,"med":0.03352,"min":0.01026,"p(90)":0.05375,"p(95)":0.06155,"p(99)":0.1893},"http_req_tls_handshaking":{"avg":1.7167,"max":134.34,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":60.6},"http_req_waiting":{"avg":122.32,"max":128.65,"med":121.6,"min":120.49,"p(90)":124.73,"p(95)":125.29,"p(99)":126.77},"http_reqs":{"count":155,"rate":15.497},"iteration_duration":{"avg":255.06,"max":629.98,"med":245.49,"min":242.18,"p(90)":247.75,"p(95)":248.59,"p(99)":624.04},"iterations":{"count":77,"rate":7.6989},"time":{"value":1694199800302},"vus":{"value":2},"vus_max":{"value":2}}} +{"event":"snapshot","data":{"data_received":{"count":201329,"rate":100664},"data_sent":{"count":3434,"rate":1717},"http_req_blocked":{"avg":0.00735,"max":0.01417,"med":0.00714,"min":0.00286,"p(90)":0.01086,"p(95)":0.0124,"p(99)":0.01378},"http_req_connecting":{"avg":0,"max":0,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":0},"http_req_duration":{"avg":122.37,"max":125.41,"med":121.88,"min":120.33,"p(90)":124.82,"p(95)":125.02,"p(99)":125.29},"http_req_failed":{"rate":0},"http_req_receiving":{"avg":0.128,"max":0.32049,"med":0.1223,"min":0.04237,"p(90)":0.20769,"p(95)":0.22619,"p(99)":0.29115},"http_req_sending":{"avg":0.03399,"max":0.05866,"med":0.03267,"min":0.01312,"p(90)":0.05141,"p(95)":0.05421,"p(99)":0.05755},"http_req_tls_handshaking":{"avg":0,"max":0,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":0},"http_req_waiting":{"avg":122.21,"max":125.32,"med":121.8,"min":120.19,"p(90)":124.67,"p(95)":124.88,"p(99)":125.19},"http_reqs":{"count":34,"rate":17},"iteration_duration":{"avg":244.99,"max":246.96,"med":244.57,"min":242.69,"p(90)":246.56,"p(95)":246.69,"p(99)":246.91},"iterations":{"count":17,"rate":8.5},"time":{"value":1694199802303},"vus":{"value":2},"vus_max":{"value":2}}} +{"event":"cumulative","data":{"data_received":{"count":1124238,"rate":93675},"data_sent":{"count":19668,"rate":1638.8},"http_req_blocked":{"avg":4.0263,"max":257.55,"med":0.00649,"min":0.00186,"p(90)":0.01052,"p(95)":0.0137,"p(99)":140.39},"http_req_connecting":{"avg":2.5919,"max":123.35,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":123.15},"http_req_duration":{"avg":122.45,"max":128.84,"med":121.78,"min":120.33,"p(90)":124.85,"p(95)":125.31,"p(99)":126.61},"http_req_failed":{"rate":0},"http_req_receiving":{"avg":0.11584,"max":0.345,"med":0.11815,"min":0.03411,"p(90)":0.17855,"p(95)":0.19277,"p(99)":0.24224},"http_req_sending":{"avg":0.03516,"max":0.2279,"med":0.03341,"min":0.01026,"p(90)":0.05363,"p(95)":0.06019,"p(99)":0.1712},"http_req_tls_handshaking":{"avg":1.4078,"max":134.34,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":15.808},"http_req_waiting":{"avg":122.3,"max":128.65,"med":121.63,"min":120.19,"p(90)":124.72,"p(95)":125.21,"p(99)":126.52},"http_reqs":{"count":189,"rate":15.748},"iteration_duration":{"avg":253.24,"max":629.98,"med":245.09,"min":242.18,"p(90)":247.36,"p(95)":248.19,"p(99)":622.72},"iterations":{"count":94,"rate":7.8324},"time":{"value":1694199802303},"vus":{"value":2},"vus_max":{"value":2}}} +{"event":"snapshot","data":{"data_received":{"count":189490,"rate":94745},"data_sent":{"count":3232,"rate":1616},"http_req_blocked":{"avg":0.00652,"max":0.01306,"med":0.00682,"min":0.00225,"p(90)":0.00844,"p(95)":0.00958,"p(99)":0.01217},"http_req_connecting":{"avg":0,"max":0,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":0},"http_req_duration":{"avg":122.54,"max":126.05,"med":122.06,"min":119.79,"p(90)":125.04,"p(95)":125.53,"p(99)":125.96},"http_req_failed":{"rate":0},"http_req_receiving":{"avg":0.12992,"max":0.21452,"med":0.1316,"min":0.03934,"p(90)":0.17584,"p(95)":0.18588,"p(99)":0.20742},"http_req_sending":{"avg":0.03389,"max":0.06916,"med":0.03445,"min":0.01075,"p(90)":0.04542,"p(95)":0.05525,"p(99)":0.06828},"http_req_tls_handshaking":{"avg":0,"max":0,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":0},"http_req_waiting":{"avg":122.38,"max":125.91,"med":121.88,"min":119.67,"p(90)":124.82,"p(95)":125.34,"p(99)":125.81},"http_reqs":{"count":32,"rate":16},"iteration_duration":{"avg":245.25,"max":247.86,"med":244.47,"min":243.38,"p(90)":247.72,"p(95)":247.83,"p(99)":247.85},"iterations":{"count":16,"rate":8},"time":{"value":1694199804302},"vus":{"value":2},"vus_max":{"value":2}}} +{"event":"cumulative","data":{"data_received":{"count":1313728,"rate":93832},"data_sent":{"count":22900,"rate":1635.6},"http_req_blocked":{"avg":3.4442,"max":257.55,"med":0.00661,"min":0.00186,"p(90)":0.0104,"p(95)":0.013,"p(99)":125.16},"http_req_connecting":{"avg":2.2166,"max":123.35,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":122.52},"http_req_duration":{"avg":122.46,"max":128.84,"med":121.87,"min":119.79,"p(90)":124.9,"p(95)":125.34,"p(99)":126.49},"http_req_failed":{"rate":0},"http_req_receiving":{"avg":0.11788,"max":0.345,"med":0.12058,"min":0.03411,"p(90)":0.17825,"p(95)":0.19257,"p(99)":0.23055},"http_req_sending":{"avg":0.03498,"max":0.2279,"med":0.03352,"min":0.01026,"p(90)":0.05156,"p(95)":0.06051,"p(99)":0.14749},"http_req_tls_handshaking":{"avg":1.204,"max":134.34,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":0},"http_req_waiting":{"avg":122.31,"max":128.65,"med":121.72,"min":119.67,"p(90)":124.73,"p(95)":125.27,"p(99)":126.38},"http_reqs":{"count":221,"rate":15.784},"iteration_duration":{"avg":252.07,"max":629.98,"med":245.01,"min":242.18,"p(90)":247.63,"p(95)":248.07,"p(99)":588.73},"iterations":{"count":110,"rate":7.8567},"time":{"value":1694199804302},"vus":{"value":2},"vus_max":{"value":2}}} +{"event":"snapshot","data":{"data_received":{"count":189474,"rate":94737},"data_sent":{"count":3232,"rate":1616},"http_req_blocked":{"avg":0.00683,"max":0.01946,"med":0.0068,"min":0.00198,"p(90)":0.00916,"p(95)":0.01025,"p(99)":0.0169},"http_req_connecting":{"avg":0,"max":0,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":0},"http_req_duration":{"avg":122.44,"max":125.21,"med":121.8,"min":120.68,"p(90)":124.82,"p(95)":125.01,"p(99)":125.2},"http_req_failed":{"rate":0},"http_req_receiving":{"avg":0.13194,"max":0.32641,"med":0.14208,"min":0.03752,"p(90)":0.19413,"p(95)":0.20855,"p(99)":0.2923},"http_req_sending":{"avg":0.03431,"max":0.06064,"med":0.03172,"min":0.01165,"p(90)":0.05534,"p(95)":0.05786,"p(99)":0.06015},"http_req_tls_handshaking":{"avg":0,"max":0,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":0},"http_req_waiting":{"avg":122.27,"max":125.01,"med":121.62,"min":120.59,"p(90)":124.6,"p(95)":124.84,"p(99)":125},"http_reqs":{"count":32,"rate":16},"iteration_duration":{"avg":245.19,"max":246.88,"med":245.27,"min":242.59,"p(90)":246.84,"p(95)":246.87,"p(99)":246.88},"iterations":{"count":16,"rate":8},"time":{"value":1694199806303},"vus":{"value":2},"vus_max":{"value":2}}} +{"event":"cumulative","data":{"data_received":{"count":1503202,"rate":93938},"data_sent":{"count":26132,"rate":1633},"http_req_blocked":{"avg":3.0094,"max":257.55,"med":0.00661,"min":0.00186,"p(90)":0.01018,"p(95)":0.01244,"p(99)":125.13},"http_req_connecting":{"avg":1.9362,"max":123.35,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":121.55},"http_req_duration":{"avg":122.46,"max":128.84,"med":121.85,"min":119.79,"p(90)":124.85,"p(95)":125.31,"p(99)":126.47},"http_req_failed":{"rate":0},"http_req_receiving":{"avg":0.11966,"max":0.345,"med":0.1221,"min":0.03411,"p(90)":0.17945,"p(95)":0.19844,"p(99)":0.27425},"http_req_sending":{"avg":0.03489,"max":0.2279,"med":0.03341,"min":0.01026,"p(90)":0.05321,"p(95)":0.06003,"p(99)":0.11978},"http_req_tls_handshaking":{"avg":1.0517,"max":134.34,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":0},"http_req_waiting":{"avg":122.31,"max":128.65,"med":121.71,"min":119.67,"p(90)":124.72,"p(95)":125.13,"p(99)":126.32},"http_reqs":{"count":253,"rate":15.81},"iteration_duration":{"avg":251.2,"max":629.98,"med":245.09,"min":242.18,"p(90)":247.42,"p(95)":247.98,"p(99)":529.29},"iterations":{"count":126,"rate":7.874},"time":{"value":1694199806303},"vus":{"value":2},"vus_max":{"value":2}}} +{"event":"snapshot","data":{"data_received":{"count":201351,"rate":100675},"data_sent":{"count":3434,"rate":1717},"http_req_blocked":{"avg":0.00731,"max":0.02792,"med":0.00662,"min":0.00224,"p(90)":0.00915,"p(95)":0.01073,"p(99)":0.02316},"http_req_connecting":{"avg":0,"max":0,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":0},"http_req_duration":{"avg":122.3,"max":125.01,"med":121.76,"min":120.59,"p(90)":124.78,"p(95)":124.89,"p(99)":124.97},"http_req_failed":{"rate":0},"http_req_receiving":{"avg":0.12021,"max":0.22733,"med":0.12592,"min":0.0355,"p(90)":0.16663,"p(95)":0.17651,"p(99)":0.21307},"http_req_sending":{"avg":0.0361,"max":0.05447,"med":0.03701,"min":0.01436,"p(90)":0.05066,"p(95)":0.05266,"p(99)":0.05414},"http_req_tls_handshaking":{"avg":0,"max":0,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":0},"http_req_waiting":{"avg":122.15,"max":124.82,"med":121.58,"min":120.49,"p(90)":124.65,"p(95)":124.71,"p(99)":124.79},"http_reqs":{"count":34,"rate":17},"iteration_duration":{"avg":244.94,"max":247.12,"med":245.37,"min":243.03,"p(90)":246.23,"p(95)":246.47,"p(99)":246.99},"iterations":{"count":17,"rate":8.5},"time":{"value":1694199808303},"vus":{"value":2},"vus_max":{"value":2}}} +{"event":"cumulative","data":{"data_received":{"count":1704553,"rate":94689},"data_sent":{"count":29566,"rate":1642.4},"http_req_blocked":{"avg":2.6538,"max":257.55,"med":0.00661,"min":0.00186,"p(90)":0.01008,"p(95)":0.01272,"p(99)":125.09},"http_req_connecting":{"avg":1.7068,"max":123.35,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":120.51},"http_req_duration":{"avg":122.44,"max":128.84,"med":121.85,"min":119.79,"p(90)":124.85,"p(95)":125.27,"p(99)":126.44},"http_req_failed":{"rate":0},"http_req_receiving":{"avg":0.11972,"max":0.345,"med":0.12249,"min":0.03411,"p(90)":0.17729,"p(95)":0.19532,"p(99)":0.24401},"http_req_sending":{"avg":0.03504,"max":0.2279,"med":0.0337,"min":0.01026,"p(90)":0.05183,"p(95)":0.05894,"p(99)":0.09034},"http_req_tls_handshaking":{"avg":0.92713,"max":134.34,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":0},"http_req_waiting":{"avg":122.29,"max":128.65,"med":121.71,"min":119.67,"p(90)":124.7,"p(95)":125.1,"p(99)":126.25},"http_reqs":{"count":287,"rate":15.943},"iteration_duration":{"avg":250.46,"max":629.98,"med":245.12,"min":242.18,"p(90)":247.16,"p(95)":247.86,"p(99)":466.14},"iterations":{"count":143,"rate":7.9438},"time":{"value":1694199808303},"vus":{"value":2},"vus_max":{"value":2}}} +{"event":"snapshot","data":{"data_received":{"count":189446,"rate":94723},"data_sent":{"count":3232,"rate":1616},"http_req_blocked":{"avg":0.00589,"max":0.01442,"med":0.00539,"min":0.0018,"p(90)":0.00917,"p(95)":0.01003,"p(99)":0.01325},"http_req_connecting":{"avg":0,"max":0,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":0},"http_req_duration":{"avg":122.63,"max":129.25,"med":121.87,"min":120.69,"p(90)":124.87,"p(95)":125.17,"p(99)":128.08},"http_req_failed":{"rate":0},"http_req_receiving":{"avg":0.11632,"max":0.20788,"med":0.10903,"min":0.03458,"p(90)":0.1814,"p(95)":0.18855,"p(99)":0.20278},"http_req_sending":{"avg":0.03044,"max":0.08596,"med":0.02774,"min":0.00886,"p(90)":0.04885,"p(95)":0.05392,"p(99)":0.0775},"http_req_tls_handshaking":{"avg":0,"max":0,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":0},"http_req_waiting":{"avg":122.48,"max":129.15,"med":121.68,"min":120.56,"p(90)":124.73,"p(95)":125.05,"p(99)":127.97},"http_reqs":{"count":32,"rate":16},"iteration_duration":{"avg":245.44,"max":252.12,"med":245.61,"min":243.6,"p(90)":246.41,"p(95)":247.91,"p(99)":251.28},"iterations":{"count":16,"rate":8},"time":{"value":1694199810302},"vus":{"value":2},"vus_max":{"value":2}}} +{"event":"cumulative","data":{"data_received":{"count":1893999,"rate":94694},"data_sent":{"count":32798,"rate":1639.8},"http_req_blocked":{"avg":2.3882,"max":257.55,"med":0.00644,"min":0.0018,"p(90)":0.00995,"p(95)":0.01216,"p(99)":102.57},"http_req_connecting":{"avg":1.5356,"max":123.35,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":98.468},"http_req_duration":{"avg":122.46,"max":129.25,"med":121.85,"min":119.79,"p(90)":124.86,"p(95)":125.29,"p(99)":126.49},"http_req_failed":{"rate":0},"http_req_receiving":{"avg":0.11938,"max":0.345,"med":0.12104,"min":0.03411,"p(90)":0.17855,"p(95)":0.19325,"p(99)":0.2308},"http_req_sending":{"avg":0.03457,"max":0.2279,"med":0.03332,"min":0.00886,"p(90)":0.05115,"p(95)":0.0587,"p(99)":0.08457},"http_req_tls_handshaking":{"avg":0.83413,"max":134.34,"med":0,"min":0,"p(90)":0,"p(95)":0,"p(99)":0},"http_req_waiting":{"avg":122.31,"max":129.15,"med":121.7,"min":119.67,"p(90)":124.71,"p(95)":125.11,"p(99)":126.39},"http_reqs":{"count":319,"rate":15.949},"iteration_duration":{"avg":249.95,"max":629.98,"med":245.23,"min":242.18,"p(90)":247.13,"p(95)":247.87,"p(99)":407.54},"iterations":{"count":159,"rate":7.9495},"time":{"value":1694199810302},"vus":{"value":2},"vus_max":{"value":2}}} +{"event":"stop","data":{"time":{"value":1694199810451}}} diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/result.ndjson.gz b/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/result.ndjson.gz new file mode 100644 index 00000000000..c1c25a00190 Binary files /dev/null and b/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/result.ndjson.gz differ diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/result.ndjson.gz.license b/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/result.ndjson.gz.license new file mode 100644 index 00000000000..f5b51f2bcd1 --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/result.ndjson.gz.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2023 Raintank, Inc. dba Grafana Labs + +SPDX-License-Identifier: AGPL-3.0-only diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/result.ndjson.license b/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/result.ndjson.license new file mode 100644 index 00000000000..f5b51f2bcd1 --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/testdata/result.ndjson.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2023 Raintank, Inc. dba Grafana Labs + +SPDX-License-Identifier: AGPL-3.0-only diff --git a/vendor/github.com/grafana/xk6-dashboard/dashboard/web.go b/vendor/github.com/grafana/xk6-dashboard/dashboard/web.go new file mode 100644 index 00000000000..1552059b2f4 --- /dev/null +++ b/vendor/github.com/grafana/xk6-dashboard/dashboard/web.go @@ -0,0 +1,83 @@ +// SPDX-FileCopyrightText: 2023 Iván Szkiba +// SPDX-FileCopyrightText: 2023 Raintank, Inc. dba Grafana Labs +// +// SPDX-License-Identifier: AGPL-3.0-only +// SPDX-License-Identifier: MIT + +package dashboard + +import ( + "io/fs" + "net" + "net/http" + "path" + "time" + + "github.com/sirupsen/logrus" +) + +const ( + pathEvents = "/events" + pathUI = "/ui/" + pathReport = "/report" + + eventChannel = "events" + snapshotEvent = "snapshot" + cumulativeEvent = "cumulative" + startEvent = "start" + stopEvent = "stop" + configEvent = "config" + metricEvent = "metric" + paramEvent = "param" +) + +type webServer struct { + *eventEmitter + *http.ServeMux +} + +func newWebServer(uiFS fs.FS, reportHandler http.Handler, logger logrus.FieldLogger) *webServer { //nolint:ireturn + srv := &webServer{ + eventEmitter: newEventEmitter(eventChannel, logger), + ServeMux: http.NewServeMux(), + } + + srv.Handle(pathEvents, srv.eventEmitter) + srv.Handle(pathUI, http.StripPrefix(pathUI, http.FileServer(http.FS(uiFS)))) + srv.Handle(pathReport, reportHandler) + + srv.HandleFunc("/", rootHandler(pathUI)) + + return srv +} + +func (srv *webServer) listenAndServe(addr string) (*net.TCPAddr, error) { + listener, err := net.Listen("tcp", addr) + if err != nil { + return nil, err + } + + go func() { + server := &http.Server{Handler: srv.ServeMux, ReadHeaderTimeout: time.Second} //nolint:exhaustruct + + if err := server.Serve(listener); err != nil { + srv.logger.Error(err) + } + }() + + a, _ := listener.Addr().(*net.TCPAddr) + + return a, nil +} + +func rootHandler(uiPath string) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { //nolint:varnamelen + if r.URL.Path == "/" { + http.Redirect(w, r, path.Join(uiPath, r.URL.Path)+"?endpoint=/", http.StatusTemporaryRedirect) + + return + } + + http.NotFound(w, r) + } +} diff --git a/vendor/github.com/pkg/browser/LICENSE b/vendor/github.com/pkg/browser/LICENSE new file mode 100644 index 00000000000..65f78fb6291 --- /dev/null +++ b/vendor/github.com/pkg/browser/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2014, Dave Cheney +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/pkg/browser/README.md b/vendor/github.com/pkg/browser/README.md new file mode 100644 index 00000000000..72b1976e303 --- /dev/null +++ b/vendor/github.com/pkg/browser/README.md @@ -0,0 +1,55 @@ + +# browser + import "github.com/pkg/browser" + +Package browser provides helpers to open files, readers, and urls in a browser window. + +The choice of which browser is started is entirely client dependant. + + + + + +## Variables +``` go +var Stderr io.Writer = os.Stderr +``` +Stderr is the io.Writer to which executed commands write standard error. + +``` go +var Stdout io.Writer = os.Stdout +``` +Stdout is the io.Writer to which executed commands write standard output. + + +## func OpenFile +``` go +func OpenFile(path string) error +``` +OpenFile opens new browser window for the file path. + + +## func OpenReader +``` go +func OpenReader(r io.Reader) error +``` +OpenReader consumes the contents of r and presents the +results in a new browser window. + + +## func OpenURL +``` go +func OpenURL(url string) error +``` +OpenURL opens a new browser window pointing to url. + + + + + + + + + +- - - +Generated by [godoc2md](http://godoc.org/github.com/davecheney/godoc2md) diff --git a/vendor/github.com/pkg/browser/browser.go b/vendor/github.com/pkg/browser/browser.go new file mode 100644 index 00000000000..d7969d74d80 --- /dev/null +++ b/vendor/github.com/pkg/browser/browser.go @@ -0,0 +1,57 @@ +// Package browser provides helpers to open files, readers, and urls in a browser window. +// +// The choice of which browser is started is entirely client dependant. +package browser + +import ( + "fmt" + "io" + "io/ioutil" + "os" + "os/exec" + "path/filepath" +) + +// Stdout is the io.Writer to which executed commands write standard output. +var Stdout io.Writer = os.Stdout + +// Stderr is the io.Writer to which executed commands write standard error. +var Stderr io.Writer = os.Stderr + +// OpenFile opens new browser window for the file path. +func OpenFile(path string) error { + path, err := filepath.Abs(path) + if err != nil { + return err + } + return OpenURL("file://" + path) +} + +// OpenReader consumes the contents of r and presents the +// results in a new browser window. +func OpenReader(r io.Reader) error { + f, err := ioutil.TempFile("", "browser.*.html") + if err != nil { + return fmt.Errorf("browser: could not create temporary file: %v", err) + } + if _, err := io.Copy(f, r); err != nil { + f.Close() + return fmt.Errorf("browser: caching temporary file failed: %v", err) + } + if err := f.Close(); err != nil { + return fmt.Errorf("browser: caching temporary file failed: %v", err) + } + return OpenFile(f.Name()) +} + +// OpenURL opens a new browser window pointing to url. +func OpenURL(url string) error { + return openBrowser(url) +} + +func runCmd(prog string, args ...string) error { + cmd := exec.Command(prog, args...) + cmd.Stdout = Stdout + cmd.Stderr = Stderr + return cmd.Run() +} diff --git a/vendor/github.com/pkg/browser/browser_darwin.go b/vendor/github.com/pkg/browser/browser_darwin.go new file mode 100644 index 00000000000..8507cf7c2b4 --- /dev/null +++ b/vendor/github.com/pkg/browser/browser_darwin.go @@ -0,0 +1,5 @@ +package browser + +func openBrowser(url string) error { + return runCmd("open", url) +} diff --git a/vendor/github.com/pkg/browser/browser_freebsd.go b/vendor/github.com/pkg/browser/browser_freebsd.go new file mode 100644 index 00000000000..4fc7ff0761b --- /dev/null +++ b/vendor/github.com/pkg/browser/browser_freebsd.go @@ -0,0 +1,14 @@ +package browser + +import ( + "errors" + "os/exec" +) + +func openBrowser(url string) error { + err := runCmd("xdg-open", url) + if e, ok := err.(*exec.Error); ok && e.Err == exec.ErrNotFound { + return errors.New("xdg-open: command not found - install xdg-utils from ports(8)") + } + return err +} diff --git a/vendor/github.com/pkg/browser/browser_linux.go b/vendor/github.com/pkg/browser/browser_linux.go new file mode 100644 index 00000000000..d26cdddf9c1 --- /dev/null +++ b/vendor/github.com/pkg/browser/browser_linux.go @@ -0,0 +1,21 @@ +package browser + +import ( + "os/exec" + "strings" +) + +func openBrowser(url string) error { + providers := []string{"xdg-open", "x-www-browser", "www-browser"} + + // There are multiple possible providers to open a browser on linux + // One of them is xdg-open, another is x-www-browser, then there's www-browser, etc. + // Look for one that exists and run it + for _, provider := range providers { + if _, err := exec.LookPath(provider); err == nil { + return runCmd(provider, url) + } + } + + return &exec.Error{Name: strings.Join(providers, ","), Err: exec.ErrNotFound} +} diff --git a/vendor/github.com/pkg/browser/browser_netbsd.go b/vendor/github.com/pkg/browser/browser_netbsd.go new file mode 100644 index 00000000000..65a5e5a2934 --- /dev/null +++ b/vendor/github.com/pkg/browser/browser_netbsd.go @@ -0,0 +1,14 @@ +package browser + +import ( + "errors" + "os/exec" +) + +func openBrowser(url string) error { + err := runCmd("xdg-open", url) + if e, ok := err.(*exec.Error); ok && e.Err == exec.ErrNotFound { + return errors.New("xdg-open: command not found - install xdg-utils from pkgsrc(7)") + } + return err +} diff --git a/vendor/github.com/pkg/browser/browser_openbsd.go b/vendor/github.com/pkg/browser/browser_openbsd.go new file mode 100644 index 00000000000..4fc7ff0761b --- /dev/null +++ b/vendor/github.com/pkg/browser/browser_openbsd.go @@ -0,0 +1,14 @@ +package browser + +import ( + "errors" + "os/exec" +) + +func openBrowser(url string) error { + err := runCmd("xdg-open", url) + if e, ok := err.(*exec.Error); ok && e.Err == exec.ErrNotFound { + return errors.New("xdg-open: command not found - install xdg-utils from ports(8)") + } + return err +} diff --git a/vendor/github.com/pkg/browser/browser_unsupported.go b/vendor/github.com/pkg/browser/browser_unsupported.go new file mode 100644 index 00000000000..7c5c17d34d2 --- /dev/null +++ b/vendor/github.com/pkg/browser/browser_unsupported.go @@ -0,0 +1,12 @@ +// +build !linux,!windows,!darwin,!openbsd,!freebsd,!netbsd + +package browser + +import ( + "fmt" + "runtime" +) + +func openBrowser(url string) error { + return fmt.Errorf("openBrowser: unsupported operating system: %v", runtime.GOOS) +} diff --git a/vendor/github.com/pkg/browser/browser_windows.go b/vendor/github.com/pkg/browser/browser_windows.go new file mode 100644 index 00000000000..63e192959a5 --- /dev/null +++ b/vendor/github.com/pkg/browser/browser_windows.go @@ -0,0 +1,7 @@ +package browser + +import "golang.org/x/sys/windows" + +func openBrowser(url string) error { + return windows.ShellExecute(0, nil, windows.StringToUTF16Ptr(url), nil, nil, windows.SW_SHOWNORMAL) +} diff --git a/vendor/github.com/r3labs/sse/v2/.gitignore b/vendor/github.com/r3labs/sse/v2/.gitignore new file mode 100644 index 00000000000..d48c759d6c9 --- /dev/null +++ b/vendor/github.com/r3labs/sse/v2/.gitignore @@ -0,0 +1,2 @@ +.idea +.vscode \ No newline at end of file diff --git a/vendor/github.com/r3labs/sse/v2/CONTRIBUTING.md b/vendor/github.com/r3labs/sse/v2/CONTRIBUTING.md new file mode 100644 index 00000000000..b9c7859d3ce --- /dev/null +++ b/vendor/github.com/r3labs/sse/v2/CONTRIBUTING.md @@ -0,0 +1,80 @@ +# Contributing guidelines + +Looking to contribute something to this project? Here's how you can help: + +Please take a moment to review this document in order to make the contribution process easy and effective for everyone involved. + +Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project. In return, they should reciprocate that respect in addressing your issue or assessing patches and features. + +We also have a [code of conduct](https://ernest.io/conduct). + +## Using the issue tracker + +The issue tracker is the preferred channel for [bug reports](#bug-reports), [features requests](#feature-requests) and [submitting pull requests](#pull-requests), but please respect the following restrictions: + +* Please **do not** use the issue tracker for personal support requests. + +* Please **do not** derail issues. Keep the discussion on topic and + respect the opinions of others. + + +## Bug reports + +A bug is a _demonstrable problem_ that is caused by the code in the repository. +Good bug reports are extremely helpful - thank you! + +Guidelines for bug reports: + +1. **Use the GitHub issue search** — check if the issue has already been + reported. + +2. **Check if the issue has been fixed** — try to reproduce it using the + latest `master` or `develop` branch in the repository. + +3. **Isolate the problem** — create a reduced test case and a live example. + +A good bug report shouldn't leave others needing to chase you up for more +information. Please try to be as detailed as possible in your report. What is +your environment? What steps will reproduce the issue? Which environment experience the problem? What would you expect to be the outcome? All these +details will help people to fix any potential bugs. + +Example: + +> Short and descriptive example bug report title +> +> A summary of the issue and the environment in which it occurs. If +> suitable, include the steps required to reproduce the bug. +> +> 1. This is the first step +> 2. This is the second step +> 3. Further steps, etc. +> +> `` - a link to the reduced test case +> +> Any other information you want to share that is relevant to the issue being +> reported. This might include the lines of code that you have identified as +> causing the bug, and potential solutions (and your opinions on their +> merits). + + +## Feature requests + +Feature requests are welcome. But take a moment to find out whether your idea +fits with the scope and aims of the project. It's up to *you* to make a strong +case to convince the project's developers of the merits of this feature. Please +provide as much detail and context as possible. + + +## Pull requests + +Good pull requests - patches, improvements, new features - are a fantastic +help. They should remain focused in scope and avoid containing unrelated +commits. + +[**Please ask first**](https://ernest.io/community) before embarking on any significant pull request (e.g. +implementing features, refactoring code, porting to a different language), +otherwise you risk spending a lot of time working on something that the +project's developers might not want to merge into the project. + +Please adhere to the coding conventions used throughout a project (indentation, +accurate comments, etc.) and any other requirements (such as test coverage). diff --git a/vendor/github.com/r3labs/sse/v2/LICENSE b/vendor/github.com/r3labs/sse/v2/LICENSE new file mode 100644 index 00000000000..a612ad9813b --- /dev/null +++ b/vendor/github.com/r3labs/sse/v2/LICENSE @@ -0,0 +1,373 @@ +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. diff --git a/vendor/github.com/r3labs/sse/v2/README.md b/vendor/github.com/r3labs/sse/v2/README.md new file mode 100644 index 00000000000..c2201be698c --- /dev/null +++ b/vendor/github.com/r3labs/sse/v2/README.md @@ -0,0 +1,191 @@ +# SSE - Server Sent Events Client/Server Library for Go + +## Synopsis + +SSE is a client/server implementation for Server Sent Events for Golang. + +## Build status + +* Master: [![CircleCI Master](https://circleci.com/gh/r3labs/sse.svg?style=svg)](https://circleci.com/gh/r3labs/sse) + +## Quick start + +To install: +``` +go get github.com/r3labs/sse/v2 +``` + +To Test: + +```sh +$ make deps +$ make test +``` + +#### Example Server + +There are two parts of the server. It is comprised of the message scheduler and a http handler function. +The messaging system is started when running: + +```go +func main() { + server := sse.New() +} +``` + +To add a stream to this handler: + +```go +func main() { + server := sse.New() + server.CreateStream("messages") +} +``` + +This creates a new stream inside of the scheduler. Seeing as there are no consumers, publishing a message to this channel will do nothing. +Clients can connect to this stream once the http handler is started by specifying _stream_ as a url parameter, like so: + +``` +http://server/events?stream=messages +``` + + +In order to start the http server: + +```go +func main() { + server := sse.New() + + // Create a new Mux and set the handler + mux := http.NewServeMux() + mux.HandleFunc("/events", server.ServeHTTP) + + http.ListenAndServe(":8080", mux) +} +``` + +To publish messages to a stream: + +```go +func main() { + server := sse.New() + + // Publish a payload to the stream + server.Publish("messages", &sse.Event{ + Data: []byte("ping"), + }) +} +``` + +Please note there must be a stream with the name you specify and there must be subscribers to that stream + +A way to detect disconnected clients: + +```go +func main() { + server := sse.New() + + mux := http.NewServeMux() + mux.HandleFunc("/events", func(w http.ResponseWriter, r *http.Request) { + go func() { + // Received Browser Disconnection + <-r.Context().Done() + println("The client is disconnected here") + return + }() + + server.ServeHTTP(w, r) + }) + + http.ListenAndServe(":8080", mux) +} +``` + +#### Example Client + +The client exposes a way to connect to an SSE server. The client can also handle multiple events under the same url. + +To create a new client: + +```go +func main() { + client := sse.NewClient("http://server/events") +} +``` + +To subscribe to an event stream, please use the Subscribe function. This accepts the name of the stream and a handler function: + +```go +func main() { + client := sse.NewClient("http://server/events") + + client.Subscribe("messages", func(msg *sse.Event) { + // Got some data! + fmt.Println(msg.Data) + }) +} +``` + +Please note that this function will block the current thread. You can run this function in a go routine. + +If you wish to have events sent to a channel, you can use SubscribeChan: + +```go +func main() { + events := make(chan *sse.Event) + + client := sse.NewClient("http://server/events") + client.SubscribeChan("messages", events) +} +``` + +#### HTTP client parameters + +To add additional parameters to the http client, such as disabling ssl verification for self signed certs, you can override the http client or update its options: + +```go +func main() { + client := sse.NewClient("http://server/events") + client.Connection.Transport = &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + } +} +``` + +#### URL query parameters + +To set custom query parameters on the client or disable the stream parameter altogether: + +```go +func main() { + client := sse.NewClient("http://server/events?search=example") + + client.SubscribeRaw(func(msg *sse.Event) { + // Got some data! + fmt.Println(msg.Data) + }) +} +``` + + +## Contributing + +Please read through our +[contributing guidelines](CONTRIBUTING.md). +Included are directions for opening issues, coding standards, and notes on +development. + +Moreover, if your pull request contains patches or features, you must include +relevant unit tests. + +## Versioning + +For transparency into our release cycle and in striving to maintain backward +compatibility, this project is maintained under [the Semantic Versioning guidelines](http://semver.org/). + +## Copyright and License + +Code and documentation copyright since 2015 r3labs.io authors. + +Code released under +[the Mozilla Public License Version 2.0](LICENSE). diff --git a/vendor/github.com/r3labs/sse/v2/client.go b/vendor/github.com/r3labs/sse/v2/client.go new file mode 100644 index 00000000000..61772b624d0 --- /dev/null +++ b/vendor/github.com/r3labs/sse/v2/client.go @@ -0,0 +1,390 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package sse + +import ( + "bytes" + "context" + "encoding/base64" + "errors" + "fmt" + "io" + "net/http" + "sync" + "sync/atomic" + "time" + + "gopkg.in/cenkalti/backoff.v1" +) + +var ( + headerID = []byte("id:") + headerData = []byte("data:") + headerEvent = []byte("event:") + headerRetry = []byte("retry:") +) + +func ClientMaxBufferSize(s int) func(c *Client) { + return func(c *Client) { + c.maxBufferSize = s + } +} + +// ConnCallback defines a function to be called on a particular connection event +type ConnCallback func(c *Client) + +// ResponseValidator validates a response +type ResponseValidator func(c *Client, resp *http.Response) error + +// Client handles an incoming server stream +type Client struct { + Retry time.Time + ReconnectStrategy backoff.BackOff + disconnectcb ConnCallback + connectedcb ConnCallback + subscribed map[chan *Event]chan struct{} + Headers map[string]string + ReconnectNotify backoff.Notify + ResponseValidator ResponseValidator + Connection *http.Client + URL string + LastEventID atomic.Value // []byte + maxBufferSize int + mu sync.Mutex + EncodingBase64 bool + Connected bool +} + +// NewClient creates a new client +func NewClient(url string, opts ...func(c *Client)) *Client { + c := &Client{ + URL: url, + Connection: &http.Client{}, + Headers: make(map[string]string), + subscribed: make(map[chan *Event]chan struct{}), + maxBufferSize: 1 << 16, + } + + for _, opt := range opts { + opt(c) + } + + return c +} + +// Subscribe to a data stream +func (c *Client) Subscribe(stream string, handler func(msg *Event)) error { + return c.SubscribeWithContext(context.Background(), stream, handler) +} + +// SubscribeWithContext to a data stream with context +func (c *Client) SubscribeWithContext(ctx context.Context, stream string, handler func(msg *Event)) error { + operation := func() error { + resp, err := c.request(ctx, stream) + if err != nil { + return err + } + if validator := c.ResponseValidator; validator != nil { + err = validator(c, resp) + if err != nil { + return err + } + } else if resp.StatusCode != 200 { + resp.Body.Close() + return fmt.Errorf("could not connect to stream: %s", http.StatusText(resp.StatusCode)) + } + defer resp.Body.Close() + + reader := NewEventStreamReader(resp.Body, c.maxBufferSize) + eventChan, errorChan := c.startReadLoop(reader) + + for { + select { + case err = <-errorChan: + return err + case msg := <-eventChan: + handler(msg) + } + } + } + + // Apply user specified reconnection strategy or default to standard NewExponentialBackOff() reconnection method + var err error + if c.ReconnectStrategy != nil { + err = backoff.RetryNotify(operation, c.ReconnectStrategy, c.ReconnectNotify) + } else { + err = backoff.RetryNotify(operation, backoff.NewExponentialBackOff(), c.ReconnectNotify) + } + return err +} + +// SubscribeChan sends all events to the provided channel +func (c *Client) SubscribeChan(stream string, ch chan *Event) error { + return c.SubscribeChanWithContext(context.Background(), stream, ch) +} + +// SubscribeChanWithContext sends all events to the provided channel with context +func (c *Client) SubscribeChanWithContext(ctx context.Context, stream string, ch chan *Event) error { + var connected bool + errch := make(chan error) + c.mu.Lock() + c.subscribed[ch] = make(chan struct{}) + c.mu.Unlock() + + operation := func() error { + resp, err := c.request(ctx, stream) + if err != nil { + return err + } + if validator := c.ResponseValidator; validator != nil { + err = validator(c, resp) + if err != nil { + return err + } + } else if resp.StatusCode != 200 { + resp.Body.Close() + return fmt.Errorf("could not connect to stream: %s", http.StatusText(resp.StatusCode)) + } + defer resp.Body.Close() + + if !connected { + // Notify connect + errch <- nil + connected = true + } + + reader := NewEventStreamReader(resp.Body, c.maxBufferSize) + eventChan, errorChan := c.startReadLoop(reader) + + for { + var msg *Event + // Wait for message to arrive or exit + select { + case <-c.subscribed[ch]: + return nil + case err = <-errorChan: + return err + case msg = <-eventChan: + } + + // Wait for message to be sent or exit + if msg != nil { + select { + case <-c.subscribed[ch]: + return nil + case ch <- msg: + // message sent + } + } + } + } + + go func() { + defer c.cleanup(ch) + // Apply user specified reconnection strategy or default to standard NewExponentialBackOff() reconnection method + var err error + if c.ReconnectStrategy != nil { + err = backoff.RetryNotify(operation, c.ReconnectStrategy, c.ReconnectNotify) + } else { + err = backoff.RetryNotify(operation, backoff.NewExponentialBackOff(), c.ReconnectNotify) + } + + // channel closed once connected + if err != nil && !connected { + errch <- err + } + }() + err := <-errch + close(errch) + return err +} + +func (c *Client) startReadLoop(reader *EventStreamReader) (chan *Event, chan error) { + outCh := make(chan *Event) + erChan := make(chan error) + go c.readLoop(reader, outCh, erChan) + return outCh, erChan +} + +func (c *Client) readLoop(reader *EventStreamReader, outCh chan *Event, erChan chan error) { + for { + // Read each new line and process the type of event + event, err := reader.ReadEvent() + if err != nil { + if err == io.EOF { + erChan <- nil + return + } + // run user specified disconnect function + if c.disconnectcb != nil { + c.Connected = false + c.disconnectcb(c) + } + erChan <- err + return + } + + if !c.Connected && c.connectedcb != nil { + c.Connected = true + c.connectedcb(c) + } + + // If we get an error, ignore it. + var msg *Event + if msg, err = c.processEvent(event); err == nil { + if len(msg.ID) > 0 { + c.LastEventID.Store(msg.ID) + } else { + msg.ID, _ = c.LastEventID.Load().([]byte) + } + + // Send downstream if the event has something useful + if msg.hasContent() { + outCh <- msg + } + } + } +} + +// SubscribeRaw to an sse endpoint +func (c *Client) SubscribeRaw(handler func(msg *Event)) error { + return c.Subscribe("", handler) +} + +// SubscribeRawWithContext to an sse endpoint with context +func (c *Client) SubscribeRawWithContext(ctx context.Context, handler func(msg *Event)) error { + return c.SubscribeWithContext(ctx, "", handler) +} + +// SubscribeChanRaw sends all events to the provided channel +func (c *Client) SubscribeChanRaw(ch chan *Event) error { + return c.SubscribeChan("", ch) +} + +// SubscribeChanRawWithContext sends all events to the provided channel with context +func (c *Client) SubscribeChanRawWithContext(ctx context.Context, ch chan *Event) error { + return c.SubscribeChanWithContext(ctx, "", ch) +} + +// Unsubscribe unsubscribes a channel +func (c *Client) Unsubscribe(ch chan *Event) { + c.mu.Lock() + defer c.mu.Unlock() + + if c.subscribed[ch] != nil { + c.subscribed[ch] <- struct{}{} + } +} + +// OnDisconnect specifies the function to run when the connection disconnects +func (c *Client) OnDisconnect(fn ConnCallback) { + c.disconnectcb = fn +} + +// OnConnect specifies the function to run when the connection is successful +func (c *Client) OnConnect(fn ConnCallback) { + c.connectedcb = fn +} + +func (c *Client) request(ctx context.Context, stream string) (*http.Response, error) { + req, err := http.NewRequest("GET", c.URL, nil) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + + // Setup request, specify stream to connect to + if stream != "" { + query := req.URL.Query() + query.Add("stream", stream) + req.URL.RawQuery = query.Encode() + } + + req.Header.Set("Cache-Control", "no-cache") + req.Header.Set("Accept", "text/event-stream") + req.Header.Set("Connection", "keep-alive") + + lastID, exists := c.LastEventID.Load().([]byte) + if exists && lastID != nil { + req.Header.Set("Last-Event-ID", string(lastID)) + } + + // Add user specified headers + for k, v := range c.Headers { + req.Header.Set(k, v) + } + + return c.Connection.Do(req) +} + +func (c *Client) processEvent(msg []byte) (event *Event, err error) { + var e Event + + if len(msg) < 1 { + return nil, errors.New("event message was empty") + } + + // Normalize the crlf to lf to make it easier to split the lines. + // Split the line by "\n" or "\r", per the spec. + for _, line := range bytes.FieldsFunc(msg, func(r rune) bool { return r == '\n' || r == '\r' }) { + switch { + case bytes.HasPrefix(line, headerID): + e.ID = append([]byte(nil), trimHeader(len(headerID), line)...) + case bytes.HasPrefix(line, headerData): + // The spec allows for multiple data fields per event, concatenated them with "\n". + e.Data = append(e.Data[:], append(trimHeader(len(headerData), line), byte('\n'))...) + // The spec says that a line that simply contains the string "data" should be treated as a data field with an empty body. + case bytes.Equal(line, bytes.TrimSuffix(headerData, []byte(":"))): + e.Data = append(e.Data, byte('\n')) + case bytes.HasPrefix(line, headerEvent): + e.Event = append([]byte(nil), trimHeader(len(headerEvent), line)...) + case bytes.HasPrefix(line, headerRetry): + e.Retry = append([]byte(nil), trimHeader(len(headerRetry), line)...) + default: + // Ignore any garbage that doesn't match what we're looking for. + } + } + + // Trim the last "\n" per the spec. + e.Data = bytes.TrimSuffix(e.Data, []byte("\n")) + + if c.EncodingBase64 { + buf := make([]byte, base64.StdEncoding.DecodedLen(len(e.Data))) + + n, err := base64.StdEncoding.Decode(buf, e.Data) + if err != nil { + err = fmt.Errorf("failed to decode event message: %s", err) + } + e.Data = buf[:n] + } + return &e, err +} + +func (c *Client) cleanup(ch chan *Event) { + c.mu.Lock() + defer c.mu.Unlock() + + if c.subscribed[ch] != nil { + close(c.subscribed[ch]) + delete(c.subscribed, ch) + } +} + +func trimHeader(size int, data []byte) []byte { + if data == nil || len(data) < size { + return data + } + + data = data[size:] + // Remove optional leading whitespace + if len(data) > 0 && data[0] == 32 { + data = data[1:] + } + // Remove trailing new line + if len(data) > 0 && data[len(data)-1] == 10 { + data = data[:len(data)-1] + } + return data +} diff --git a/vendor/github.com/r3labs/sse/v2/event.go b/vendor/github.com/r3labs/sse/v2/event.go new file mode 100644 index 00000000000..12580387867 --- /dev/null +++ b/vendor/github.com/r3labs/sse/v2/event.go @@ -0,0 +1,114 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package sse + +import ( + "bufio" + "bytes" + "context" + "io" + "time" +) + +// Event holds all of the event source fields +type Event struct { + timestamp time.Time + ID []byte + Data []byte + Event []byte + Retry []byte + Comment []byte +} + +func (e *Event) hasContent() bool { + return len(e.ID) > 0 || len(e.Data) > 0 || len(e.Event) > 0 || len(e.Retry) > 0 +} + +// EventStreamReader scans an io.Reader looking for EventStream messages. +type EventStreamReader struct { + scanner *bufio.Scanner +} + +// NewEventStreamReader creates an instance of EventStreamReader. +func NewEventStreamReader(eventStream io.Reader, maxBufferSize int) *EventStreamReader { + scanner := bufio.NewScanner(eventStream) + initBufferSize := minPosInt(4096, maxBufferSize) + scanner.Buffer(make([]byte, initBufferSize), maxBufferSize) + + split := func(data []byte, atEOF bool) (int, []byte, error) { + if atEOF && len(data) == 0 { + return 0, nil, nil + } + + // We have a full event payload to parse. + if i, nlen := containsDoubleNewline(data); i >= 0 { + return i + nlen, data[0:i], nil + } + // If we're at EOF, we have all of the data. + if atEOF { + return len(data), data, nil + } + // Request more data. + return 0, nil, nil + } + // Set the split function for the scanning operation. + scanner.Split(split) + + return &EventStreamReader{ + scanner: scanner, + } +} + +// Returns a tuple containing the index of a double newline, and the number of bytes +// represented by that sequence. If no double newline is present, the first value +// will be negative. +func containsDoubleNewline(data []byte) (int, int) { + // Search for each potentially valid sequence of newline characters + crcr := bytes.Index(data, []byte("\r\r")) + lflf := bytes.Index(data, []byte("\n\n")) + crlflf := bytes.Index(data, []byte("\r\n\n")) + lfcrlf := bytes.Index(data, []byte("\n\r\n")) + crlfcrlf := bytes.Index(data, []byte("\r\n\r\n")) + // Find the earliest position of a double newline combination + minPos := minPosInt(crcr, minPosInt(lflf, minPosInt(crlflf, minPosInt(lfcrlf, crlfcrlf)))) + // Detemine the length of the sequence + nlen := 2 + if minPos == crlfcrlf { + nlen = 4 + } else if minPos == crlflf || minPos == lfcrlf { + nlen = 3 + } + return minPos, nlen +} + +// Returns the minimum non-negative value out of the two values. If both +// are negative, a negative value is returned. +func minPosInt(a, b int) int { + if a < 0 { + return b + } + if b < 0 { + return a + } + if a > b { + return b + } + return a +} + +// ReadEvent scans the EventStream for events. +func (e *EventStreamReader) ReadEvent() ([]byte, error) { + if e.scanner.Scan() { + event := e.scanner.Bytes() + return event, nil + } + if err := e.scanner.Err(); err != nil { + if err == context.Canceled { + return nil, io.EOF + } + return nil, err + } + return nil, io.EOF +} diff --git a/vendor/github.com/r3labs/sse/v2/event_log.go b/vendor/github.com/r3labs/sse/v2/event_log.go new file mode 100644 index 00000000000..aa17dad0584 --- /dev/null +++ b/vendor/github.com/r3labs/sse/v2/event_log.go @@ -0,0 +1,43 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package sse + +import ( + "strconv" + "time" +) + +// EventLog holds all of previous events +type EventLog []*Event + +// Add event to eventlog +func (e *EventLog) Add(ev *Event) { + if !ev.hasContent() { + return + } + + ev.ID = []byte(e.currentindex()) + ev.timestamp = time.Now() + *e = append(*e, ev) +} + +// Clear events from eventlog +func (e *EventLog) Clear() { + *e = nil +} + +// Replay events to a subscriber +func (e *EventLog) Replay(s *Subscriber) { + for i := 0; i < len(*e); i++ { + id, _ := strconv.Atoi(string((*e)[i].ID)) + if id >= s.eventid { + s.connection <- (*e)[i] + } + } +} + +func (e *EventLog) currentindex() string { + return strconv.Itoa(len(*e)) +} diff --git a/vendor/github.com/r3labs/sse/v2/http.go b/vendor/github.com/r3labs/sse/v2/http.go new file mode 100644 index 00000000000..c7a2b434a9b --- /dev/null +++ b/vendor/github.com/r3labs/sse/v2/http.go @@ -0,0 +1,120 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package sse + +import ( + "bytes" + "fmt" + "net/http" + "strconv" + "time" +) + +// ServeHTTP serves new connections with events for a given stream ... +func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { + flusher, err := w.(http.Flusher) + if !err { + http.Error(w, "Streaming unsupported!", http.StatusInternalServerError) + return + } + + w.Header().Set("Content-Type", "text/event-stream") + w.Header().Set("Cache-Control", "no-cache") + w.Header().Set("Connection", "keep-alive") + + for k, v := range s.Headers { + w.Header().Set(k, v) + } + + // Get the StreamID from the URL + streamID := r.URL.Query().Get("stream") + if streamID == "" { + http.Error(w, "Please specify a stream!", http.StatusInternalServerError) + return + } + + stream := s.getStream(streamID) + + if stream == nil { + if !s.AutoStream { + http.Error(w, "Stream not found!", http.StatusInternalServerError) + return + } + + stream = s.CreateStream(streamID) + } + + eventid := 0 + if id := r.Header.Get("Last-Event-ID"); id != "" { + var err error + eventid, err = strconv.Atoi(id) + if err != nil { + http.Error(w, "Last-Event-ID must be a number!", http.StatusBadRequest) + return + } + } + + // Create the stream subscriber + sub := stream.addSubscriber(eventid, r.URL) + + go func() { + <-r.Context().Done() + + sub.close() + + if s.AutoStream && !s.AutoReplay && stream.getSubscriberCount() == 0 { + s.RemoveStream(streamID) + } + }() + + w.WriteHeader(http.StatusOK) + flusher.Flush() + + // Push events to client + for ev := range sub.connection { + // If the data buffer is an empty string abort. + if len(ev.Data) == 0 && len(ev.Comment) == 0 { + break + } + + // if the event has expired, dont send it + if s.EventTTL != 0 && time.Now().After(ev.timestamp.Add(s.EventTTL)) { + continue + } + + if len(ev.Data) > 0 { + fmt.Fprintf(w, "id: %s\n", ev.ID) + + if s.SplitData { + sd := bytes.Split(ev.Data, []byte("\n")) + for i := range sd { + fmt.Fprintf(w, "data: %s\n", sd[i]) + } + } else { + if bytes.HasPrefix(ev.Data, []byte(":")) { + fmt.Fprintf(w, "%s\n", ev.Data) + } else { + fmt.Fprintf(w, "data: %s\n", ev.Data) + } + } + + if len(ev.Event) > 0 { + fmt.Fprintf(w, "event: %s\n", ev.Event) + } + + if len(ev.Retry) > 0 { + fmt.Fprintf(w, "retry: %s\n", ev.Retry) + } + } + + if len(ev.Comment) > 0 { + fmt.Fprintf(w, ": %s\n", ev.Comment) + } + + fmt.Fprint(w, "\n") + + flusher.Flush() + } +} diff --git a/vendor/github.com/r3labs/sse/v2/server.go b/vendor/github.com/r3labs/sse/v2/server.go new file mode 100644 index 00000000000..d1b27af3257 --- /dev/null +++ b/vendor/github.com/r3labs/sse/v2/server.go @@ -0,0 +1,156 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package sse + +import ( + "encoding/base64" + "sync" + "time" +) + +// DefaultBufferSize size of the queue that holds the streams messages. +const DefaultBufferSize = 1024 + +// Server Is our main struct +type Server struct { + // Extra headers adding to the HTTP response to each client + Headers map[string]string + // Sets a ttl that prevents old events from being transmitted + EventTTL time.Duration + // Specifies the size of the message buffer for each stream + BufferSize int + // Encodes all data as base64 + EncodeBase64 bool + // Splits an events data into multiple data: entries + SplitData bool + // Enables creation of a stream when a client connects + AutoStream bool + // Enables automatic replay for each new subscriber that connects + AutoReplay bool + + // Specifies the function to run when client subscribe or un-subscribe + OnSubscribe func(streamID string, sub *Subscriber) + OnUnsubscribe func(streamID string, sub *Subscriber) + + streams map[string]*Stream + muStreams sync.RWMutex +} + +// New will create a server and setup defaults +func New() *Server { + return &Server{ + BufferSize: DefaultBufferSize, + AutoStream: false, + AutoReplay: true, + streams: make(map[string]*Stream), + Headers: map[string]string{}, + } +} + +// NewWithCallback will create a server and setup defaults with callback function +func NewWithCallback(onSubscribe, onUnsubscribe func(streamID string, sub *Subscriber)) *Server { + return &Server{ + BufferSize: DefaultBufferSize, + AutoStream: false, + AutoReplay: true, + streams: make(map[string]*Stream), + Headers: map[string]string{}, + OnSubscribe: onSubscribe, + OnUnsubscribe: onUnsubscribe, + } +} + +// Close shuts down the server, closes all of the streams and connections +func (s *Server) Close() { + s.muStreams.Lock() + defer s.muStreams.Unlock() + + for id := range s.streams { + s.streams[id].close() + delete(s.streams, id) + } +} + +// CreateStream will create a new stream and register it +func (s *Server) CreateStream(id string) *Stream { + s.muStreams.Lock() + defer s.muStreams.Unlock() + + if s.streams[id] != nil { + return s.streams[id] + } + + str := newStream(id, s.BufferSize, s.AutoReplay, s.AutoStream, s.OnSubscribe, s.OnUnsubscribe) + str.run() + + s.streams[id] = str + + return str +} + +// RemoveStream will remove a stream +func (s *Server) RemoveStream(id string) { + s.muStreams.Lock() + defer s.muStreams.Unlock() + + if s.streams[id] != nil { + s.streams[id].close() + delete(s.streams, id) + } +} + +// StreamExists checks whether a stream by a given id exists +func (s *Server) StreamExists(id string) bool { + return s.getStream(id) != nil +} + +// Publish sends a mesage to every client in a streamID. +// If the stream's buffer is full, it blocks until the message is sent out to +// all subscribers (but not necessarily arrived the clients), or when the +// stream is closed. +func (s *Server) Publish(id string, event *Event) { + stream := s.getStream(id) + if stream == nil { + return + } + + select { + case <-stream.quit: + case stream.event <- s.process(event): + } +} + +// TryPublish is the same as Publish except that when the operation would cause +// the call to be blocked, it simply drops the message and returns false. +// Together with a small BufferSize, it can be useful when publishing the +// latest message ASAP is more important than reliable delivery. +func (s *Server) TryPublish(id string, event *Event) bool { + stream := s.getStream(id) + if stream == nil { + return false + } + + select { + case stream.event <- s.process(event): + return true + default: + return false + } +} + +func (s *Server) getStream(id string) *Stream { + s.muStreams.RLock() + defer s.muStreams.RUnlock() + return s.streams[id] +} + +func (s *Server) process(event *Event) *Event { + if s.EncodeBase64 { + output := make([]byte, base64.StdEncoding.EncodedLen(len(event.Data))) + base64.StdEncoding.Encode(output, event.Data) + event.Data = output + } + return event +} diff --git a/vendor/github.com/r3labs/sse/v2/stream.go b/vendor/github.com/r3labs/sse/v2/stream.go new file mode 100644 index 00000000000..bfbcb9b5238 --- /dev/null +++ b/vendor/github.com/r3labs/sse/v2/stream.go @@ -0,0 +1,153 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package sse + +import ( + "net/url" + "sync" + "sync/atomic" +) + +// Stream ... +type Stream struct { + ID string + event chan *Event + quit chan struct{} + quitOnce sync.Once + register chan *Subscriber + deregister chan *Subscriber + subscribers []*Subscriber + Eventlog EventLog + subscriberCount int32 + // Enables replaying of eventlog to newly added subscribers + AutoReplay bool + isAutoStream bool + + // Specifies the function to run when client subscribe or un-subscribe + OnSubscribe func(streamID string, sub *Subscriber) + OnUnsubscribe func(streamID string, sub *Subscriber) +} + +// newStream returns a new stream +func newStream(id string, buffSize int, replay, isAutoStream bool, onSubscribe, onUnsubscribe func(string, *Subscriber)) *Stream { + return &Stream{ + ID: id, + AutoReplay: replay, + subscribers: make([]*Subscriber, 0), + isAutoStream: isAutoStream, + register: make(chan *Subscriber), + deregister: make(chan *Subscriber), + event: make(chan *Event, buffSize), + quit: make(chan struct{}), + Eventlog: make(EventLog, 0), + OnSubscribe: onSubscribe, + OnUnsubscribe: onUnsubscribe, + } +} + +func (str *Stream) run() { + go func(str *Stream) { + for { + select { + // Add new subscriber + case subscriber := <-str.register: + str.subscribers = append(str.subscribers, subscriber) + if str.AutoReplay { + str.Eventlog.Replay(subscriber) + } + + // Remove closed subscriber + case subscriber := <-str.deregister: + i := str.getSubIndex(subscriber) + if i != -1 { + str.removeSubscriber(i) + } + + if str.OnUnsubscribe != nil { + go str.OnUnsubscribe(str.ID, subscriber) + } + + // Publish event to subscribers + case event := <-str.event: + if str.AutoReplay { + str.Eventlog.Add(event) + } + for i := range str.subscribers { + str.subscribers[i].connection <- event + } + + // Shutdown if the server closes + case <-str.quit: + // remove connections + str.removeAllSubscribers() + return + } + } + }(str) +} + +func (str *Stream) close() { + str.quitOnce.Do(func() { + close(str.quit) + }) +} + +func (str *Stream) getSubIndex(sub *Subscriber) int { + for i := range str.subscribers { + if str.subscribers[i] == sub { + return i + } + } + return -1 +} + +// addSubscriber will create a new subscriber on a stream +func (str *Stream) addSubscriber(eventid int, url *url.URL) *Subscriber { + atomic.AddInt32(&str.subscriberCount, 1) + sub := &Subscriber{ + eventid: eventid, + quit: str.deregister, + connection: make(chan *Event, 64), + URL: url, + } + + if str.isAutoStream { + sub.removed = make(chan struct{}, 1) + } + + str.register <- sub + + if str.OnSubscribe != nil { + go str.OnSubscribe(str.ID, sub) + } + + return sub +} + +func (str *Stream) removeSubscriber(i int) { + atomic.AddInt32(&str.subscriberCount, -1) + close(str.subscribers[i].connection) + if str.subscribers[i].removed != nil { + str.subscribers[i].removed <- struct{}{} + close(str.subscribers[i].removed) + } + str.subscribers = append(str.subscribers[:i], str.subscribers[i+1:]...) +} + +func (str *Stream) removeAllSubscribers() { + for i := 0; i < len(str.subscribers); i++ { + close(str.subscribers[i].connection) + if str.subscribers[i].removed != nil { + str.subscribers[i].removed <- struct{}{} + close(str.subscribers[i].removed) + } + } + atomic.StoreInt32(&str.subscriberCount, 0) + str.subscribers = str.subscribers[:0] +} + +func (str *Stream) getSubscriberCount() int { + return int(atomic.LoadInt32(&str.subscriberCount)) +} diff --git a/vendor/github.com/r3labs/sse/v2/subscriber.go b/vendor/github.com/r3labs/sse/v2/subscriber.go new file mode 100644 index 00000000000..4b54c204f30 --- /dev/null +++ b/vendor/github.com/r3labs/sse/v2/subscriber.go @@ -0,0 +1,24 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package sse + +import "net/url" + +// Subscriber ... +type Subscriber struct { + quit chan *Subscriber + connection chan *Event + removed chan struct{} + eventid int + URL *url.URL +} + +// Close will let the stream know that the clients connection has terminated +func (s *Subscriber) close() { + s.quit <- s + if s.removed != nil { + <-s.removed + } +} diff --git a/vendor/golang.org/x/net/context/context.go b/vendor/golang.org/x/net/context/context.go new file mode 100644 index 00000000000..cf66309c4a8 --- /dev/null +++ b/vendor/golang.org/x/net/context/context.go @@ -0,0 +1,56 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package context defines the Context type, which carries deadlines, +// cancelation signals, and other request-scoped values across API boundaries +// and between processes. +// As of Go 1.7 this package is available in the standard library under the +// name context. https://golang.org/pkg/context. +// +// Incoming requests to a server should create a Context, and outgoing calls to +// servers should accept a Context. The chain of function calls between must +// propagate the Context, optionally replacing it with a modified copy created +// using WithDeadline, WithTimeout, WithCancel, or WithValue. +// +// Programs that use Contexts should follow these rules to keep interfaces +// consistent across packages and enable static analysis tools to check context +// propagation: +// +// Do not store Contexts inside a struct type; instead, pass a Context +// explicitly to each function that needs it. The Context should be the first +// parameter, typically named ctx: +// +// func DoSomething(ctx context.Context, arg Arg) error { +// // ... use ctx ... +// } +// +// Do not pass a nil Context, even if a function permits it. Pass context.TODO +// if you are unsure about which Context to use. +// +// Use context Values only for request-scoped data that transits processes and +// APIs, not for passing optional parameters to functions. +// +// The same Context may be passed to functions running in different goroutines; +// Contexts are safe for simultaneous use by multiple goroutines. +// +// See http://blog.golang.org/context for example code for a server that uses +// Contexts. +package context // import "golang.org/x/net/context" + +// Background returns a non-nil, empty Context. It is never canceled, has no +// values, and has no deadline. It is typically used by the main function, +// initialization, and tests, and as the top-level Context for incoming +// requests. +func Background() Context { + return background +} + +// TODO returns a non-nil, empty Context. Code should use context.TODO when +// it's unclear which Context to use or it is not yet available (because the +// surrounding function has not yet been extended to accept a Context +// parameter). TODO is recognized by static analysis tools that determine +// whether Contexts are propagated correctly in a program. +func TODO() Context { + return todo +} diff --git a/vendor/golang.org/x/net/context/go17.go b/vendor/golang.org/x/net/context/go17.go new file mode 100644 index 00000000000..0c1b8679376 --- /dev/null +++ b/vendor/golang.org/x/net/context/go17.go @@ -0,0 +1,72 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build go1.7 + +package context + +import ( + "context" // standard library's context, as of Go 1.7 + "time" +) + +var ( + todo = context.TODO() + background = context.Background() +) + +// Canceled is the error returned by Context.Err when the context is canceled. +var Canceled = context.Canceled + +// DeadlineExceeded is the error returned by Context.Err when the context's +// deadline passes. +var DeadlineExceeded = context.DeadlineExceeded + +// WithCancel returns a copy of parent with a new Done channel. The returned +// context's Done channel is closed when the returned cancel function is called +// or when the parent context's Done channel is closed, whichever happens first. +// +// Canceling this context releases resources associated with it, so code should +// call cancel as soon as the operations running in this Context complete. +func WithCancel(parent Context) (ctx Context, cancel CancelFunc) { + ctx, f := context.WithCancel(parent) + return ctx, f +} + +// WithDeadline returns a copy of the parent context with the deadline adjusted +// to be no later than d. If the parent's deadline is already earlier than d, +// WithDeadline(parent, d) is semantically equivalent to parent. The returned +// context's Done channel is closed when the deadline expires, when the returned +// cancel function is called, or when the parent context's Done channel is +// closed, whichever happens first. +// +// Canceling this context releases resources associated with it, so code should +// call cancel as soon as the operations running in this Context complete. +func WithDeadline(parent Context, deadline time.Time) (Context, CancelFunc) { + ctx, f := context.WithDeadline(parent, deadline) + return ctx, f +} + +// WithTimeout returns WithDeadline(parent, time.Now().Add(timeout)). +// +// Canceling this context releases resources associated with it, so code should +// call cancel as soon as the operations running in this Context complete: +// +// func slowOperationWithTimeout(ctx context.Context) (Result, error) { +// ctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond) +// defer cancel() // releases resources if slowOperation completes before timeout elapses +// return slowOperation(ctx) +// } +func WithTimeout(parent Context, timeout time.Duration) (Context, CancelFunc) { + return WithDeadline(parent, time.Now().Add(timeout)) +} + +// WithValue returns a copy of parent in which the value associated with key is +// val. +// +// Use context Values only for request-scoped data that transits processes and +// APIs, not for passing optional parameters to functions. +func WithValue(parent Context, key interface{}, val interface{}) Context { + return context.WithValue(parent, key, val) +} diff --git a/vendor/golang.org/x/net/context/go19.go b/vendor/golang.org/x/net/context/go19.go new file mode 100644 index 00000000000..e31e35a9045 --- /dev/null +++ b/vendor/golang.org/x/net/context/go19.go @@ -0,0 +1,20 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build go1.9 + +package context + +import "context" // standard library's context, as of Go 1.7 + +// A Context carries a deadline, a cancelation signal, and other values across +// API boundaries. +// +// Context's methods may be called by multiple goroutines simultaneously. +type Context = context.Context + +// A CancelFunc tells an operation to abandon its work. +// A CancelFunc does not wait for the work to stop. +// After the first call, subsequent calls to a CancelFunc do nothing. +type CancelFunc = context.CancelFunc diff --git a/vendor/golang.org/x/net/context/pre_go17.go b/vendor/golang.org/x/net/context/pre_go17.go new file mode 100644 index 00000000000..065ff3dfa52 --- /dev/null +++ b/vendor/golang.org/x/net/context/pre_go17.go @@ -0,0 +1,300 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !go1.7 + +package context + +import ( + "errors" + "fmt" + "sync" + "time" +) + +// An emptyCtx is never canceled, has no values, and has no deadline. It is not +// struct{}, since vars of this type must have distinct addresses. +type emptyCtx int + +func (*emptyCtx) Deadline() (deadline time.Time, ok bool) { + return +} + +func (*emptyCtx) Done() <-chan struct{} { + return nil +} + +func (*emptyCtx) Err() error { + return nil +} + +func (*emptyCtx) Value(key interface{}) interface{} { + return nil +} + +func (e *emptyCtx) String() string { + switch e { + case background: + return "context.Background" + case todo: + return "context.TODO" + } + return "unknown empty Context" +} + +var ( + background = new(emptyCtx) + todo = new(emptyCtx) +) + +// Canceled is the error returned by Context.Err when the context is canceled. +var Canceled = errors.New("context canceled") + +// DeadlineExceeded is the error returned by Context.Err when the context's +// deadline passes. +var DeadlineExceeded = errors.New("context deadline exceeded") + +// WithCancel returns a copy of parent with a new Done channel. The returned +// context's Done channel is closed when the returned cancel function is called +// or when the parent context's Done channel is closed, whichever happens first. +// +// Canceling this context releases resources associated with it, so code should +// call cancel as soon as the operations running in this Context complete. +func WithCancel(parent Context) (ctx Context, cancel CancelFunc) { + c := newCancelCtx(parent) + propagateCancel(parent, c) + return c, func() { c.cancel(true, Canceled) } +} + +// newCancelCtx returns an initialized cancelCtx. +func newCancelCtx(parent Context) *cancelCtx { + return &cancelCtx{ + Context: parent, + done: make(chan struct{}), + } +} + +// propagateCancel arranges for child to be canceled when parent is. +func propagateCancel(parent Context, child canceler) { + if parent.Done() == nil { + return // parent is never canceled + } + if p, ok := parentCancelCtx(parent); ok { + p.mu.Lock() + if p.err != nil { + // parent has already been canceled + child.cancel(false, p.err) + } else { + if p.children == nil { + p.children = make(map[canceler]bool) + } + p.children[child] = true + } + p.mu.Unlock() + } else { + go func() { + select { + case <-parent.Done(): + child.cancel(false, parent.Err()) + case <-child.Done(): + } + }() + } +} + +// parentCancelCtx follows a chain of parent references until it finds a +// *cancelCtx. This function understands how each of the concrete types in this +// package represents its parent. +func parentCancelCtx(parent Context) (*cancelCtx, bool) { + for { + switch c := parent.(type) { + case *cancelCtx: + return c, true + case *timerCtx: + return c.cancelCtx, true + case *valueCtx: + parent = c.Context + default: + return nil, false + } + } +} + +// removeChild removes a context from its parent. +func removeChild(parent Context, child canceler) { + p, ok := parentCancelCtx(parent) + if !ok { + return + } + p.mu.Lock() + if p.children != nil { + delete(p.children, child) + } + p.mu.Unlock() +} + +// A canceler is a context type that can be canceled directly. The +// implementations are *cancelCtx and *timerCtx. +type canceler interface { + cancel(removeFromParent bool, err error) + Done() <-chan struct{} +} + +// A cancelCtx can be canceled. When canceled, it also cancels any children +// that implement canceler. +type cancelCtx struct { + Context + + done chan struct{} // closed by the first cancel call. + + mu sync.Mutex + children map[canceler]bool // set to nil by the first cancel call + err error // set to non-nil by the first cancel call +} + +func (c *cancelCtx) Done() <-chan struct{} { + return c.done +} + +func (c *cancelCtx) Err() error { + c.mu.Lock() + defer c.mu.Unlock() + return c.err +} + +func (c *cancelCtx) String() string { + return fmt.Sprintf("%v.WithCancel", c.Context) +} + +// cancel closes c.done, cancels each of c's children, and, if +// removeFromParent is true, removes c from its parent's children. +func (c *cancelCtx) cancel(removeFromParent bool, err error) { + if err == nil { + panic("context: internal error: missing cancel error") + } + c.mu.Lock() + if c.err != nil { + c.mu.Unlock() + return // already canceled + } + c.err = err + close(c.done) + for child := range c.children { + // NOTE: acquiring the child's lock while holding parent's lock. + child.cancel(false, err) + } + c.children = nil + c.mu.Unlock() + + if removeFromParent { + removeChild(c.Context, c) + } +} + +// WithDeadline returns a copy of the parent context with the deadline adjusted +// to be no later than d. If the parent's deadline is already earlier than d, +// WithDeadline(parent, d) is semantically equivalent to parent. The returned +// context's Done channel is closed when the deadline expires, when the returned +// cancel function is called, or when the parent context's Done channel is +// closed, whichever happens first. +// +// Canceling this context releases resources associated with it, so code should +// call cancel as soon as the operations running in this Context complete. +func WithDeadline(parent Context, deadline time.Time) (Context, CancelFunc) { + if cur, ok := parent.Deadline(); ok && cur.Before(deadline) { + // The current deadline is already sooner than the new one. + return WithCancel(parent) + } + c := &timerCtx{ + cancelCtx: newCancelCtx(parent), + deadline: deadline, + } + propagateCancel(parent, c) + d := deadline.Sub(time.Now()) + if d <= 0 { + c.cancel(true, DeadlineExceeded) // deadline has already passed + return c, func() { c.cancel(true, Canceled) } + } + c.mu.Lock() + defer c.mu.Unlock() + if c.err == nil { + c.timer = time.AfterFunc(d, func() { + c.cancel(true, DeadlineExceeded) + }) + } + return c, func() { c.cancel(true, Canceled) } +} + +// A timerCtx carries a timer and a deadline. It embeds a cancelCtx to +// implement Done and Err. It implements cancel by stopping its timer then +// delegating to cancelCtx.cancel. +type timerCtx struct { + *cancelCtx + timer *time.Timer // Under cancelCtx.mu. + + deadline time.Time +} + +func (c *timerCtx) Deadline() (deadline time.Time, ok bool) { + return c.deadline, true +} + +func (c *timerCtx) String() string { + return fmt.Sprintf("%v.WithDeadline(%s [%s])", c.cancelCtx.Context, c.deadline, c.deadline.Sub(time.Now())) +} + +func (c *timerCtx) cancel(removeFromParent bool, err error) { + c.cancelCtx.cancel(false, err) + if removeFromParent { + // Remove this timerCtx from its parent cancelCtx's children. + removeChild(c.cancelCtx.Context, c) + } + c.mu.Lock() + if c.timer != nil { + c.timer.Stop() + c.timer = nil + } + c.mu.Unlock() +} + +// WithTimeout returns WithDeadline(parent, time.Now().Add(timeout)). +// +// Canceling this context releases resources associated with it, so code should +// call cancel as soon as the operations running in this Context complete: +// +// func slowOperationWithTimeout(ctx context.Context) (Result, error) { +// ctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond) +// defer cancel() // releases resources if slowOperation completes before timeout elapses +// return slowOperation(ctx) +// } +func WithTimeout(parent Context, timeout time.Duration) (Context, CancelFunc) { + return WithDeadline(parent, time.Now().Add(timeout)) +} + +// WithValue returns a copy of parent in which the value associated with key is +// val. +// +// Use context Values only for request-scoped data that transits processes and +// APIs, not for passing optional parameters to functions. +func WithValue(parent Context, key interface{}, val interface{}) Context { + return &valueCtx{parent, key, val} +} + +// A valueCtx carries a key-value pair. It implements Value for that key and +// delegates all other calls to the embedded Context. +type valueCtx struct { + Context + key, val interface{} +} + +func (c *valueCtx) String() string { + return fmt.Sprintf("%v.WithValue(%#v, %#v)", c.Context, c.key, c.val) +} + +func (c *valueCtx) Value(key interface{}) interface{} { + if c.key == key { + return c.val + } + return c.Context.Value(key) +} diff --git a/vendor/golang.org/x/net/context/pre_go19.go b/vendor/golang.org/x/net/context/pre_go19.go new file mode 100644 index 00000000000..ec5a6380335 --- /dev/null +++ b/vendor/golang.org/x/net/context/pre_go19.go @@ -0,0 +1,109 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !go1.9 + +package context + +import "time" + +// A Context carries a deadline, a cancelation signal, and other values across +// API boundaries. +// +// Context's methods may be called by multiple goroutines simultaneously. +type Context interface { + // Deadline returns the time when work done on behalf of this context + // should be canceled. Deadline returns ok==false when no deadline is + // set. Successive calls to Deadline return the same results. + Deadline() (deadline time.Time, ok bool) + + // Done returns a channel that's closed when work done on behalf of this + // context should be canceled. Done may return nil if this context can + // never be canceled. Successive calls to Done return the same value. + // + // WithCancel arranges for Done to be closed when cancel is called; + // WithDeadline arranges for Done to be closed when the deadline + // expires; WithTimeout arranges for Done to be closed when the timeout + // elapses. + // + // Done is provided for use in select statements: + // + // // Stream generates values with DoSomething and sends them to out + // // until DoSomething returns an error or ctx.Done is closed. + // func Stream(ctx context.Context, out chan<- Value) error { + // for { + // v, err := DoSomething(ctx) + // if err != nil { + // return err + // } + // select { + // case <-ctx.Done(): + // return ctx.Err() + // case out <- v: + // } + // } + // } + // + // See http://blog.golang.org/pipelines for more examples of how to use + // a Done channel for cancelation. + Done() <-chan struct{} + + // Err returns a non-nil error value after Done is closed. Err returns + // Canceled if the context was canceled or DeadlineExceeded if the + // context's deadline passed. No other values for Err are defined. + // After Done is closed, successive calls to Err return the same value. + Err() error + + // Value returns the value associated with this context for key, or nil + // if no value is associated with key. Successive calls to Value with + // the same key returns the same result. + // + // Use context values only for request-scoped data that transits + // processes and API boundaries, not for passing optional parameters to + // functions. + // + // A key identifies a specific value in a Context. Functions that wish + // to store values in Context typically allocate a key in a global + // variable then use that key as the argument to context.WithValue and + // Context.Value. A key can be any type that supports equality; + // packages should define keys as an unexported type to avoid + // collisions. + // + // Packages that define a Context key should provide type-safe accessors + // for the values stores using that key: + // + // // Package user defines a User type that's stored in Contexts. + // package user + // + // import "golang.org/x/net/context" + // + // // User is the type of value stored in the Contexts. + // type User struct {...} + // + // // key is an unexported type for keys defined in this package. + // // This prevents collisions with keys defined in other packages. + // type key int + // + // // userKey is the key for user.User values in Contexts. It is + // // unexported; clients use user.NewContext and user.FromContext + // // instead of using this key directly. + // var userKey key = 0 + // + // // NewContext returns a new Context that carries value u. + // func NewContext(ctx context.Context, u *User) context.Context { + // return context.WithValue(ctx, userKey, u) + // } + // + // // FromContext returns the User value stored in ctx, if any. + // func FromContext(ctx context.Context) (*User, bool) { + // u, ok := ctx.Value(userKey).(*User) + // return u, ok + // } + Value(key interface{}) interface{} +} + +// A CancelFunc tells an operation to abandon its work. +// A CancelFunc does not wait for the work to stop. +// After the first call, subsequent calls to a CancelFunc do nothing. +type CancelFunc func() diff --git a/vendor/gopkg.in/cenkalti/backoff.v1/.gitignore b/vendor/gopkg.in/cenkalti/backoff.v1/.gitignore new file mode 100644 index 00000000000..00268614f04 --- /dev/null +++ b/vendor/gopkg.in/cenkalti/backoff.v1/.gitignore @@ -0,0 +1,22 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe diff --git a/vendor/gopkg.in/cenkalti/backoff.v1/LICENSE b/vendor/gopkg.in/cenkalti/backoff.v1/LICENSE new file mode 100644 index 00000000000..89b81799655 --- /dev/null +++ b/vendor/gopkg.in/cenkalti/backoff.v1/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2014 Cenk Altı + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/gopkg.in/cenkalti/backoff.v1/README.md b/vendor/gopkg.in/cenkalti/backoff.v1/README.md new file mode 100644 index 00000000000..13b347fb951 --- /dev/null +++ b/vendor/gopkg.in/cenkalti/backoff.v1/README.md @@ -0,0 +1,30 @@ +# Exponential Backoff [![GoDoc][godoc image]][godoc] [![Build Status][travis image]][travis] [![Coverage Status][coveralls image]][coveralls] + +This is a Go port of the exponential backoff algorithm from [Google's HTTP Client Library for Java][google-http-java-client]. + +[Exponential backoff][exponential backoff wiki] +is an algorithm that uses feedback to multiplicatively decrease the rate of some process, +in order to gradually find an acceptable rate. +The retries exponentially increase and stop increasing when a certain threshold is met. + +## Usage + +See https://godoc.org/github.com/cenkalti/backoff#pkg-examples + +## Contributing + +* I would like to keep this library as small as possible. +* Please don't send a PR without opening an issue and discussing it first. +* If proposed change is not a common use case, I will probably not accept it. + +[godoc]: https://godoc.org/github.com/cenkalti/backoff +[godoc image]: https://godoc.org/github.com/cenkalti/backoff?status.png +[travis]: https://travis-ci.org/cenkalti/backoff +[travis image]: https://travis-ci.org/cenkalti/backoff.png?branch=master +[coveralls]: https://coveralls.io/github/cenkalti/backoff?branch=master +[coveralls image]: https://coveralls.io/repos/github/cenkalti/backoff/badge.svg?branch=master + +[google-http-java-client]: https://github.com/google/google-http-java-client +[exponential backoff wiki]: http://en.wikipedia.org/wiki/Exponential_backoff + +[advanced example]: https://godoc.org/github.com/cenkalti/backoff#example_ diff --git a/vendor/gopkg.in/cenkalti/backoff.v1/backoff.go b/vendor/gopkg.in/cenkalti/backoff.v1/backoff.go new file mode 100644 index 00000000000..2102c5f2de9 --- /dev/null +++ b/vendor/gopkg.in/cenkalti/backoff.v1/backoff.go @@ -0,0 +1,66 @@ +// Package backoff implements backoff algorithms for retrying operations. +// +// Use Retry function for retrying operations that may fail. +// If Retry does not meet your needs, +// copy/paste the function into your project and modify as you wish. +// +// There is also Ticker type similar to time.Ticker. +// You can use it if you need to work with channels. +// +// See Examples section below for usage examples. +package backoff + +import "time" + +// BackOff is a backoff policy for retrying an operation. +type BackOff interface { + // NextBackOff returns the duration to wait before retrying the operation, + // or backoff.Stop to indicate that no more retries should be made. + // + // Example usage: + // + // duration := backoff.NextBackOff(); + // if (duration == backoff.Stop) { + // // Do not retry operation. + // } else { + // // Sleep for duration and retry operation. + // } + // + NextBackOff() time.Duration + + // Reset to initial state. + Reset() +} + +// Stop indicates that no more retries should be made for use in NextBackOff(). +const Stop time.Duration = -1 + +// ZeroBackOff is a fixed backoff policy whose backoff time is always zero, +// meaning that the operation is retried immediately without waiting, indefinitely. +type ZeroBackOff struct{} + +func (b *ZeroBackOff) Reset() {} + +func (b *ZeroBackOff) NextBackOff() time.Duration { return 0 } + +// StopBackOff is a fixed backoff policy that always returns backoff.Stop for +// NextBackOff(), meaning that the operation should never be retried. +type StopBackOff struct{} + +func (b *StopBackOff) Reset() {} + +func (b *StopBackOff) NextBackOff() time.Duration { return Stop } + +// ConstantBackOff is a backoff policy that always returns the same backoff delay. +// This is in contrast to an exponential backoff policy, +// which returns a delay that grows longer as you call NextBackOff() over and over again. +type ConstantBackOff struct { + Interval time.Duration +} + +func (b *ConstantBackOff) Reset() {} +func (b *ConstantBackOff) NextBackOff() time.Duration { return b.Interval } + +func NewConstantBackOff(d time.Duration) *ConstantBackOff { + return &ConstantBackOff{Interval: d} +} diff --git a/vendor/gopkg.in/cenkalti/backoff.v1/context.go b/vendor/gopkg.in/cenkalti/backoff.v1/context.go new file mode 100644 index 00000000000..5d157092544 --- /dev/null +++ b/vendor/gopkg.in/cenkalti/backoff.v1/context.go @@ -0,0 +1,60 @@ +package backoff + +import ( + "time" + + "golang.org/x/net/context" +) + +// BackOffContext is a backoff policy that stops retrying after the context +// is canceled. +type BackOffContext interface { + BackOff + Context() context.Context +} + +type backOffContext struct { + BackOff + ctx context.Context +} + +// WithContext returns a BackOffContext with context ctx +// +// ctx must not be nil +func WithContext(b BackOff, ctx context.Context) BackOffContext { + if ctx == nil { + panic("nil context") + } + + if b, ok := b.(*backOffContext); ok { + return &backOffContext{ + BackOff: b.BackOff, + ctx: ctx, + } + } + + return &backOffContext{ + BackOff: b, + ctx: ctx, + } +} + +func ensureContext(b BackOff) BackOffContext { + if cb, ok := b.(BackOffContext); ok { + return cb + } + return WithContext(b, context.Background()) +} + +func (b *backOffContext) Context() context.Context { + return b.ctx +} + +func (b *backOffContext) NextBackOff() time.Duration { + select { + case <-b.Context().Done(): + return Stop + default: + return b.BackOff.NextBackOff() + } +} diff --git a/vendor/gopkg.in/cenkalti/backoff.v1/exponential.go b/vendor/gopkg.in/cenkalti/backoff.v1/exponential.go new file mode 100644 index 00000000000..9a6addf0750 --- /dev/null +++ b/vendor/gopkg.in/cenkalti/backoff.v1/exponential.go @@ -0,0 +1,156 @@ +package backoff + +import ( + "math/rand" + "time" +) + +/* +ExponentialBackOff is a backoff implementation that increases the backoff +period for each retry attempt using a randomization function that grows exponentially. + +NextBackOff() is calculated using the following formula: + + randomized interval = + RetryInterval * (random value in range [1 - RandomizationFactor, 1 + RandomizationFactor]) + +In other words NextBackOff() will range between the randomization factor +percentage below and above the retry interval. + +For example, given the following parameters: + + RetryInterval = 2 + RandomizationFactor = 0.5 + Multiplier = 2 + +the actual backoff period used in the next retry attempt will range between 1 and 3 seconds, +multiplied by the exponential, that is, between 2 and 6 seconds. + +Note: MaxInterval caps the RetryInterval and not the randomized interval. + +If the time elapsed since an ExponentialBackOff instance is created goes past the +MaxElapsedTime, then the method NextBackOff() starts returning backoff.Stop. + +The elapsed time can be reset by calling Reset(). + +Example: Given the following default arguments, for 10 tries the sequence will be, +and assuming we go over the MaxElapsedTime on the 10th try: + + Request # RetryInterval (seconds) Randomized Interval (seconds) + + 1 0.5 [0.25, 0.75] + 2 0.75 [0.375, 1.125] + 3 1.125 [0.562, 1.687] + 4 1.687 [0.8435, 2.53] + 5 2.53 [1.265, 3.795] + 6 3.795 [1.897, 5.692] + 7 5.692 [2.846, 8.538] + 8 8.538 [4.269, 12.807] + 9 12.807 [6.403, 19.210] + 10 19.210 backoff.Stop + +Note: Implementation is not thread-safe. +*/ +type ExponentialBackOff struct { + InitialInterval time.Duration + RandomizationFactor float64 + Multiplier float64 + MaxInterval time.Duration + // After MaxElapsedTime the ExponentialBackOff stops. + // It never stops if MaxElapsedTime == 0. + MaxElapsedTime time.Duration + Clock Clock + + currentInterval time.Duration + startTime time.Time + random *rand.Rand +} + +// Clock is an interface that returns current time for BackOff. +type Clock interface { + Now() time.Time +} + +// Default values for ExponentialBackOff. +const ( + DefaultInitialInterval = 500 * time.Millisecond + DefaultRandomizationFactor = 0.5 + DefaultMultiplier = 1.5 + DefaultMaxInterval = 60 * time.Second + DefaultMaxElapsedTime = 15 * time.Minute +) + +// NewExponentialBackOff creates an instance of ExponentialBackOff using default values. +func NewExponentialBackOff() *ExponentialBackOff { + b := &ExponentialBackOff{ + InitialInterval: DefaultInitialInterval, + RandomizationFactor: DefaultRandomizationFactor, + Multiplier: DefaultMultiplier, + MaxInterval: DefaultMaxInterval, + MaxElapsedTime: DefaultMaxElapsedTime, + Clock: SystemClock, + random: rand.New(rand.NewSource(time.Now().UnixNano())), + } + b.Reset() + return b +} + +type systemClock struct{} + +func (t systemClock) Now() time.Time { + return time.Now() +} + +// SystemClock implements Clock interface that uses time.Now(). +var SystemClock = systemClock{} + +// Reset the interval back to the initial retry interval and restarts the timer. +func (b *ExponentialBackOff) Reset() { + b.currentInterval = b.InitialInterval + b.startTime = b.Clock.Now() +} + +// NextBackOff calculates the next backoff interval using the formula: +// Randomized interval = RetryInterval +/- (RandomizationFactor * RetryInterval) +func (b *ExponentialBackOff) NextBackOff() time.Duration { + // Make sure we have not gone over the maximum elapsed time. + if b.MaxElapsedTime != 0 && b.GetElapsedTime() > b.MaxElapsedTime { + return Stop + } + defer b.incrementCurrentInterval() + if b.random == nil { + b.random = rand.New(rand.NewSource(time.Now().UnixNano())) + } + return getRandomValueFromInterval(b.RandomizationFactor, b.random.Float64(), b.currentInterval) +} + +// GetElapsedTime returns the elapsed time since an ExponentialBackOff instance +// is created and is reset when Reset() is called. +// +// The elapsed time is computed using time.Now().UnixNano(). +func (b *ExponentialBackOff) GetElapsedTime() time.Duration { + return b.Clock.Now().Sub(b.startTime) +} + +// Increments the current interval by multiplying it with the multiplier. +func (b *ExponentialBackOff) incrementCurrentInterval() { + // Check for overflow, if overflow is detected set the current interval to the max interval. + if float64(b.currentInterval) >= float64(b.MaxInterval)/b.Multiplier { + b.currentInterval = b.MaxInterval + } else { + b.currentInterval = time.Duration(float64(b.currentInterval) * b.Multiplier) + } +} + +// Returns a random value from the following interval: +// [randomizationFactor * currentInterval, randomizationFactor * currentInterval]. +func getRandomValueFromInterval(randomizationFactor, random float64, currentInterval time.Duration) time.Duration { + var delta = randomizationFactor * float64(currentInterval) + var minInterval = float64(currentInterval) - delta + var maxInterval = float64(currentInterval) + delta + + // Get a random value from the range [minInterval, maxInterval]. + // The formula used below has a +1 because if the minInterval is 1 and the maxInterval is 3 then + // we want a 33% chance for selecting either 1, 2 or 3. + return time.Duration(minInterval + (random * (maxInterval - minInterval + 1))) +} diff --git a/vendor/gopkg.in/cenkalti/backoff.v1/retry.go b/vendor/gopkg.in/cenkalti/backoff.v1/retry.go new file mode 100644 index 00000000000..5dbd825b5c8 --- /dev/null +++ b/vendor/gopkg.in/cenkalti/backoff.v1/retry.go @@ -0,0 +1,78 @@ +package backoff + +import "time" + +// An Operation is executing by Retry() or RetryNotify(). +// The operation will be retried using a backoff policy if it returns an error. +type Operation func() error + +// Notify is a notify-on-error function. It receives an operation error and +// backoff delay if the operation failed (with an error). +// +// NOTE that if the backoff policy stated to stop retrying, +// the notify function isn't called. +type Notify func(error, time.Duration) + +// Retry the operation o until it does not return error or BackOff stops. +// o is guaranteed to be run at least once. +// It is the caller's responsibility to reset b after Retry returns. +// +// If o returns a *PermanentError, the operation is not retried, and the +// wrapped error is returned. +// +// Retry sleeps the goroutine for the duration returned by BackOff after a +// failed operation returns. +func Retry(o Operation, b BackOff) error { return RetryNotify(o, b, nil) } + +// RetryNotify calls notify function with the error and wait duration +// for each failed attempt before sleep. +func RetryNotify(operation Operation, b BackOff, notify Notify) error { + var err error + var next time.Duration + + cb := ensureContext(b) + + b.Reset() + for { + if err = operation(); err == nil { + return nil + } + + if permanent, ok := err.(*PermanentError); ok { + return permanent.Err + } + + if next = b.NextBackOff(); next == Stop { + return err + } + + if notify != nil { + notify(err, next) + } + + t := time.NewTimer(next) + + select { + case <-cb.Context().Done(): + t.Stop() + return err + case <-t.C: + } + } +} + +// PermanentError signals that the operation should not be retried. +type PermanentError struct { + Err error +} + +func (e *PermanentError) Error() string { + return e.Err.Error() +} + +// Permanent wraps the given err in a *PermanentError. +func Permanent(err error) *PermanentError { + return &PermanentError{ + Err: err, + } +} diff --git a/vendor/gopkg.in/cenkalti/backoff.v1/ticker.go b/vendor/gopkg.in/cenkalti/backoff.v1/ticker.go new file mode 100644 index 00000000000..49a99718d74 --- /dev/null +++ b/vendor/gopkg.in/cenkalti/backoff.v1/ticker.go @@ -0,0 +1,81 @@ +package backoff + +import ( + "runtime" + "sync" + "time" +) + +// Ticker holds a channel that delivers `ticks' of a clock at times reported by a BackOff. +// +// Ticks will continue to arrive when the previous operation is still running, +// so operations that take a while to fail could run in quick succession. +type Ticker struct { + C <-chan time.Time + c chan time.Time + b BackOffContext + stop chan struct{} + stopOnce sync.Once +} + +// NewTicker returns a new Ticker containing a channel that will send the time at times +// specified by the BackOff argument. Ticker is guaranteed to tick at least once. +// The channel is closed when Stop method is called or BackOff stops. +func NewTicker(b BackOff) *Ticker { + c := make(chan time.Time) + t := &Ticker{ + C: c, + c: c, + b: ensureContext(b), + stop: make(chan struct{}), + } + go t.run() + runtime.SetFinalizer(t, (*Ticker).Stop) + return t +} + +// Stop turns off a ticker. After Stop, no more ticks will be sent. +func (t *Ticker) Stop() { + t.stopOnce.Do(func() { close(t.stop) }) +} + +func (t *Ticker) run() { + c := t.c + defer close(c) + t.b.Reset() + + // Ticker is guaranteed to tick at least once. + afterC := t.send(time.Now()) + + for { + if afterC == nil { + return + } + + select { + case tick := <-afterC: + afterC = t.send(tick) + case <-t.stop: + t.c = nil // Prevent future ticks from being sent to the channel. + return + case <-t.b.Context().Done(): + return + } + } +} + +func (t *Ticker) send(tick time.Time) <-chan time.Time { + select { + case t.c <- tick: + case <-t.stop: + return nil + } + + next := t.b.NextBackOff() + if next == Stop { + t.Stop() + return nil + } + + return time.After(next) +} diff --git a/vendor/gopkg.in/cenkalti/backoff.v1/tries.go b/vendor/gopkg.in/cenkalti/backoff.v1/tries.go new file mode 100644 index 00000000000..d2da7308b6a --- /dev/null +++ b/vendor/gopkg.in/cenkalti/backoff.v1/tries.go @@ -0,0 +1,35 @@ +package backoff + +import "time" + +/* +WithMaxTries creates a wrapper around another BackOff, which will +return Stop if NextBackOff() has been called too many times since +the last time Reset() was called + +Note: Implementation is not thread-safe. +*/ +func WithMaxTries(b BackOff, max uint64) BackOff { + return &backOffTries{delegate: b, maxTries: max} +} + +type backOffTries struct { + delegate BackOff + maxTries uint64 + numTries uint64 +} + +func (b *backOffTries) NextBackOff() time.Duration { + if b.maxTries > 0 { + if b.maxTries <= b.numTries { + return Stop + } + b.numTries++ + } + return b.delegate.NextBackOff() +} + +func (b *backOffTries) Reset() { + b.numTries = 0 + b.delegate.Reset() +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 9ffe138ba7c..5c670e74eaf 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -146,6 +146,9 @@ github.com/google/pprof/profile # github.com/google/uuid v1.3.0 ## explicit github.com/google/uuid +# github.com/gorilla/schema v1.2.0 +## explicit +github.com/gorilla/schema # github.com/gorilla/websocket v1.5.1 ## explicit; go 1.20 github.com/gorilla/websocket @@ -161,6 +164,9 @@ github.com/grafana/xk6-browser/k6ext github.com/grafana/xk6-browser/keyboardlayout github.com/grafana/xk6-browser/log github.com/grafana/xk6-browser/storage +# github.com/grafana/xk6-dashboard v0.6.1 +## explicit; go 1.19 +github.com/grafana/xk6-dashboard/dashboard # github.com/grafana/xk6-output-prometheus-remote v0.3.1 ## explicit; go 1.18 github.com/grafana/xk6-output-prometheus-remote/pkg/remote @@ -254,6 +260,9 @@ github.com/mstoykov/k6-taskqueue-lib/taskqueue # github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d ## explicit github.com/nu7hatch/gouuid +# github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 +## explicit; go 1.14 +github.com/pkg/browser # github.com/pmezard/go-difflib v1.0.0 ## explicit github.com/pmezard/go-difflib/difflib @@ -274,6 +283,9 @@ github.com/prometheus/common/model github.com/prometheus/procfs github.com/prometheus/procfs/internal/fs github.com/prometheus/procfs/internal/util +# github.com/r3labs/sse/v2 v2.10.0 +## explicit; go 1.13 +github.com/r3labs/sse/v2 # github.com/redis/go-redis/v9 v9.0.5 ## explicit; go 1.18 github.com/redis/go-redis/v9 @@ -380,6 +392,7 @@ golang.org/x/crypto/ripemd160 golang.org/x/crypto/x509roots/fallback # golang.org/x/net v0.19.0 ## explicit; go 1.18 +golang.org/x/net/context golang.org/x/net/html golang.org/x/net/html/atom golang.org/x/net/http/httpguts @@ -527,6 +540,9 @@ google.golang.org/protobuf/types/known/timestamppb google.golang.org/protobuf/types/known/typepb google.golang.org/protobuf/types/known/wrapperspb google.golang.org/protobuf/types/pluginpb +# gopkg.in/cenkalti/backoff.v1 v1.1.0 +## explicit +gopkg.in/cenkalti/backoff.v1 # gopkg.in/guregu/null.v3 v3.3.0 ## explicit gopkg.in/guregu/null.v3