diff -Nru pat-0.12.1/.appveyor.yml pat-0.13.1/.appveyor.yml --- pat-0.12.1/.appveyor.yml 2021-12-11 15:09:39.000000000 +0000 +++ pat-0.13.1/.appveyor.yml 2022-10-22 20:39:54.000000000 +0000 @@ -6,7 +6,7 @@ environment: global: GOPATH: C:\gopath - GOVERSION: "1.16.5" + GOVERSION: "1.19" MSYS_PATH: C:\MinGW\msys\1.0 install: - set PATH=C:\go\bin;%MSYS_PATH%\bin;C:\MinGW\bin;%PATH% @@ -16,7 +16,3 @@ build_script: - go version - '%MSYS_PATH%\bin\bash -lc "cd /c/gopath/src/github.com/la5nta/pat && ./make.bash"' - -artifacts: - - path: pat.exe - name: Pat diff -Nru pat-0.12.1/cfg/config.go pat-0.13.1/cfg/config.go --- pat-0.12.1/cfg/config.go 2021-12-11 15:09:39.000000000 +0000 +++ pat-0.13.1/cfg/config.go 2022-10-22 20:39:54.000000000 +0000 @@ -73,13 +73,13 @@ // Connect aliases // - // Example: {"LA1B-10": "ax25:///LD5GU/LA1B-10", "LA1B": "winmor://LA3F?freq=5350"} + // Example: {"LA1B-10": "ax25:///LD5GU/LA1B-10", "LA1B": "ardop://LA3F?freq=5350"} // Any occurrence of the substring "{mycall}" will be replaced with user's callsign. ConnectAliases map[string]string `json:"connect_aliases"` // Methods to listen for incoming P2P connections by default. // - // Example: ["ax25", "winmor", "telnet", "ardop"] + // Example: ["ax25", "telnet", "ardop"] Listen []string `json:"listen"` // Hamlib rigs available (with reference name) for ptt and frequency control. @@ -87,10 +87,11 @@ AX25 AX25Config `json:"ax25"` // See AX25Config. SerialTNC SerialTNCConfig `json:"serial-tnc"` // See SerialTNCConfig. - Winmor WinmorConfig `json:"winmor"` // See WinmorConfig. Ardop ArdopConfig `json:"ardop"` // See ArdopConfig. Pactor PactorConfig `json:"pactor"` // See PactorConfig. Telnet TelnetConfig `json:"telnet"` // See TelnetConfig. + VaraHF VaraConfig `json:"varahf"` // See VaraConfig. + VaraFM VaraConfig `json:"varafm"` // See VaraConfig. // See GPSdConfig. GPSd GPSdConfig `json:"gpsd"` @@ -105,10 +106,10 @@ // # Connect to telnet once every hour // "@hourly": "connect telnet" // - // # Change winmor listen frequency based on hour of day - // "00 10 * * *": "freq winmor:7350.000", # 40m from 10:00 - // "00 18 * * *": "freq winmor:5347.000", # 60m from 18:00 - // "00 22 * * *": "freq winmor:3602.000" # 80m from 22:00 + // # Change ardop listen frequency based on hour of day + // "00 10 * * *": "freq ardop:7350.000", # 40m from 10:00 + // "00 18 * * *": "freq ardop:5347.000", # 60m from 18:00 + // "00 22 * * *": "freq ardop:3602.000" # 80m from 22:00 Schedule map[string]string `json:"schedule"` // By default, Pat posts your callsign and running version to the Winlink CMS Web Services @@ -139,30 +140,11 @@ VFO string `json:"VFO"` } -type WinmorConfig struct { - // Network address of the Winmor TNC (e.g. localhost:8500). - Addr string `json:"addr"` - - // Bandwidth to use when getting an inbound connection (500/1600). - InboundBandwidth int `json:"inbound_bandwidth"` - - // TX audio drive level - // - // Set to 0 to use WINMOR defaults - DriveLevel int `json:"drive_level"` - - // (optional) Reference name to the Hamlib rig to control frequency and ptt. - Rig string `json:"rig"` - - // Set to true if hamlib should control PTT (SignaLink=false, most rigexpert=true). - PTTControl bool `json:"ptt_ctrl"` -} - type ArdopConfig struct { // Network address of the Ardop TNC (e.g. localhost:8515). Addr string `json:"addr"` - // ARQ bandwidth (200/500/1000/2000 MAX/FORCED). + // Default/listen ARQ bandwidth (200/500/1000/2000 MAX/FORCED). ARQBandwidth ardop.Bandwidth `json:"arq_bandwidth"` // (optional) Reference name to the Hamlib rig to control frequency and ptt. @@ -178,6 +160,26 @@ CWID bool `json:"cwid_enabled"` } +type VaraConfig struct { + // Network host of the VARA modem (defaults to localhost). + Host string `json:"host"` + + // Network port of the VARA modem command channel (defaults to 8300). + CmdPort int `json:"cmdPort"` + + // Network port of the VARA modem data channel (defaults to 8301). + DataPort int `json:"dataPort"` + + // Default/listen bandwidth (HF: 500/2300/2750 Hz). + Bandwidth int `json:"bandwidth"` + + // (optional) Reference name to the Hamlib rig to control frequency and ptt. + Rig string `json:"rig"` + + // Set to true if hamlib should control PTT (SignaLink=false, most rigexpert=true). + PTTControl bool `json:"ptt_ctrl"` +} + type PactorConfig struct { // Path/port to TNC device (e.g. /dev/ttyUSB0 or COM1). Path string `json:"path"` @@ -241,16 +243,20 @@ } type GPSdConfig struct { - // enable GPSd support in web interface - // WARNING: If you enable GPSd http endpoint (enable_http) you might - // expose your current position to anyone who has access to Pat!!! + // Enable GPSd proxy for HTTP (web GUI) + // + // Caution: Your GPS position will be accessible to any network device able to access Pat's HTTP interface. EnableHTTP bool `json:"enable_http"` - // Use server time instead of timestamp provided by GPSd (e.g for older GPS - // device with week roll-over issue) + // Allow Winlink forms to use GPSd for aquiring your position. + // + // Caution: Your current GPS position will be automatically injected, without your explicit consent, into forms requesting such information. + AllowForms bool `json:"allow_forms"` + + // Use server time instead of timestamp provided by GPSd (e.g for older GPS device with week roll-over issue). UseServerTime bool `json:"use_server_time"` - // Address and port of GPSd server (e.g. localhost:2947) + // Address and port of GPSd server (e.g. localhost:2947). Addr string `json:"addr"` } @@ -277,10 +283,6 @@ HBaud: 1200, Type: "Kenwood", }, - Winmor: WinmorConfig{ - Addr: "localhost:8500", - InboundBandwidth: 1600, - }, Ardop: ArdopConfig{ Addr: "localhost:8515", ARQBandwidth: ardop.Bandwidth500Max, @@ -294,8 +296,20 @@ ListenAddr: ":8774", Password: "", }, + VaraHF: VaraConfig{ + Host: "localhost", + CmdPort: 8300, + DataPort: 8301, + Bandwidth: 2300, + }, + VaraFM: VaraConfig{ + Host: "localhost", + CmdPort: 8300, + DataPort: 8301, + }, GPSd: GPSdConfig{ EnableHTTP: false, // Default to false to help protect privacy of unknowing users (see github.com//issues/146) + AllowForms: false, // Default to false to help protect location privacy of unknowing users UseServerTime: false, Addr: "localhost:2947", // Default listen address for GPSd }, diff -Nru pat-0.12.1/cfg/example_config.json pat-0.13.1/cfg/example_config.json --- pat-0.12.1/cfg/example_config.json 2021-12-11 15:09:39.000000000 +0000 +++ pat-0.13.1/cfg/example_config.json 2022-10-22 20:39:54.000000000 +0000 @@ -4,7 +4,7 @@ "auxiliary_addresses": ["LE1OF"], "locator": "JP20qe", "connect_aliases": { - "LA1B@60m": "winmor:///LA1B?freq=5310.00", + "LA1B@60m": "ardop:///LA1B?freq=5310.00", "LA1B-10": "ax25:///LA1B-10" }, "hamlib_rigs": { @@ -27,12 +27,6 @@ "serial_baud": 9600, "type": "Kenwood" }, - "winmor": { - "addr": "la5nta.local.mesh:8500", - "inbound_bandwidth": 500, - "rig": "ft897", - "ptt_ctrl": false - }, "ardop": { "addr": "localhost:8515", "arq_bandwidth": {"Forced":false, "Max":500}, @@ -45,6 +39,21 @@ "listen_addr": ":8774", "password": "" }, + "varafm": { + "host": "localhost", + "cmdPort": 8302, + "dataPort": 8303, + "rig": "ft897", + "ptt_ctrl": true + }, + "varahf": { + "host": "localhost", + "cmdPort": 8300, + "dataPort": 8301, + "bandwidth": 2300, + "rig": "ft897", + "ptt_ctrl": true + }, "schedule": { "*/30 * * * *": "connect offgrid" }, diff -Nru pat-0.12.1/cli_composer.go pat-0.13.1/cli_composer.go --- pat-0.12.1/cli_composer.go 2021-12-11 15:09:39.000000000 +0000 +++ pat-0.13.1/cli_composer.go 2022-10-22 20:39:54.000000000 +0000 @@ -8,6 +8,7 @@ import ( "bufio" "bytes" + "context" "fmt" "io" "io/ioutil" @@ -102,11 +103,14 @@ return msg } -func composeMessage(args []string) { +func composeMessage(ctx context.Context, args []string) { set := pflag.NewFlagSet("compose", pflag.ExitOnError) + // From default is --mycall but it can be overriden with -r + from := set.StringP("from", "r", fOptions.MyCall, "") subject := set.StringP("subject", "s", "", "") attachments := set.StringArrayP("attachment", "a", nil, "") ccs := set.StringArrayP("cc", "c", nil, "") + p2pOnly := set.BoolP("p2p-only", "", false, "") set.Parse(args) // Remaining args are recipients @@ -122,14 +126,13 @@ // Check if any args are set. If so, go non-interactive // Otherwise, interactive if (len(*subject) + len(*attachments) + len(*ccs) + len(recipients)) > 0 { - noninteractiveComposeMessage(*subject, *attachments, *ccs, recipients) + noninteractiveComposeMessage(*from, *subject, *attachments, *ccs, recipients, *p2pOnly) } else { interactiveComposeMessage(nil) } } -func noninteractiveComposeMessage(subject string, attachments []string, - ccs []string, recipients []string) { +func noninteractiveComposeMessage(from string, subject string, attachments []string, ccs []string, recipients []string, p2pOnly bool) { // We have to verify the args here. Follow the same pattern as main() // We'll allow a missing recipient if CC is present (or vice versa) if len(recipients)+len(ccs) <= 0 { @@ -143,7 +146,7 @@ } msg := fbb.NewMessage(fbb.Private, fOptions.MyCall) - msg.SetFrom(fOptions.MyCall) + msg.SetFrom(from) for _, to := range recipients { msg.AddTo(to) } @@ -171,11 +174,14 @@ } msg.SetBody(string(body)) + if p2pOnly { + msg.Header.Set("X-P2POnly", "true") + } postMessage(msg) } -// This is currently an alias for interactiveComposeMessage but keeping as a seperate +// This is currently an alias for interactiveComposeMessage but keeping as a separate // call path for the future func composeReplyMessage(replyMsg *fbb.Message) { interactiveComposeMessage(replyMsg) @@ -293,7 +299,7 @@ return strings.TrimSpace(str) } -func composeFormReport(args []string) { +func composeFormReport(ctx context.Context, args []string) { var tmplPathArg string set := pflag.NewFlagSet("form", pflag.ExitOnError) diff -Nru pat-0.12.1/config.go pat-0.13.1/config.go --- pat-0.12.1/config.go 2021-12-11 15:09:39.000000000 +0000 +++ pat-0.13.1/config.go 2022-10-22 20:39:54.000000000 +0000 @@ -44,6 +44,14 @@ config.Pactor = cfg.DefaultConfig.Pactor } + // Ensure VARA FM and VARA HF has default values + if config.VaraHF == (cfg.VaraConfig{}) { + config.VaraHF = cfg.DefaultConfig.VaraHF + } + if config.VaraFM == (cfg.VaraConfig{}) { + config.VaraFM = cfg.DefaultConfig.VaraFM + } + // TODO: Remove after some release cycles (2019-09-29) if config.GPSdAddrLegacy != "" { config.GPSd.Addr = config.GPSdAddrLegacy diff -Nru pat-0.12.1/connect.go pat-0.13.1/connect.go --- pat-0.12.1/connect.go 2021-12-11 15:09:39.000000000 +0000 +++ pat-0.13.1/connect.go 2022-10-22 20:39:54.000000000 +0000 @@ -5,7 +5,11 @@ package main import ( + "context" + "errors" "fmt" + "github.com/la5nta/pat/cfg" + "github.com/la5nta/pat/internal/debug" "log" "strconv" "strings" @@ -14,7 +18,7 @@ "github.com/harenber/ptc-go/v2/pactor" "github.com/la5nta/wl2k-go/transport" "github.com/la5nta/wl2k-go/transport/ardop" - "github.com/la5nta/wl2k-go/transport/winmor" + "github.com/n8jja/Pat-Vara/vara" // Register other dialers _ "github.com/la5nta/wl2k-go/transport/ax25" @@ -22,10 +26,14 @@ ) var ( - dialing *transport.URL // The connect URL currently being dialed (if any) - wmTNC *winmor.TNC // Pointer to the WINMOR TNC used by Listen and Connect - adTNC *ardop.TNC // Pointer to the ARDOP TNC used by Listen and Connect - pModem *pactor.Modem + dialing *transport.URL // The connect URL currently being dialed (if any) + adTNC *ardop.TNC // Pointer to the ARDOP TNC used by Listen and Connect + pModem *pactor.Modem + varaHFModem *vara.Modem + varaFMModem *vara.Modem + + // Context cancellation function for aborting while dialing. + dialCancelFunc func() = func() {} ) func hasSSID(str string) bool { return strings.Contains(str, "-") } @@ -46,6 +54,10 @@ return Connect(aliased) } + // Hack around bug in frontend which may occur if the status updates too quickly. + defer func() { time.Sleep(time.Second); websocketHub.UpdateStatus() }() + + debug.Printf("connectStr: %s", connectStr) url, err := transport.ParseURL(connectStr) if err != nil { log.Println(err) @@ -59,11 +71,6 @@ log.Println(err) return } - case MethodWinmor: - if err := initWinmorTNC(); err != nil { - log.Println(err) - return - } case MethodPactor: ptCmdInit := "" if val, ok := url.Params["init"]; ok { @@ -73,6 +80,16 @@ log.Println(err) return } + case MethodVaraHF: + if err := initVaraModem(varaHFModem, MethodVaraHF, config.VaraHF); err != nil { + log.Println(err) + return + } + case MethodVaraFM: + if err := initVaraModem(varaFMModem, MethodVaraFM, config.VaraFM); err != nil { + log.Println(err) + return + } } // Set default userinfo (mycall) @@ -136,29 +153,30 @@ switch url.Scheme { case MethodArdop: waitBusy(adTNC) - case MethodWinmor: - waitBusy(wmTNC) } - // Catch interrupts (signals) while dialing, so users can abort ardop/winmor connects. - doneHandleInterrupt := handleInterrupt() + ctx, cancel := context.WithCancel(context.Background()) + dialCancelFunc = func() { dialing = nil; cancel() } + defer dialCancelFunc() // Signal web gui that we are dialing a connection dialing = url websocketHub.UpdateStatus() log.Printf("Connecting to %s (%s)...", url.Target, url.Scheme) - conn, err := transport.DialURL(url) + conn, err := transport.DialURLContext(ctx, url) // Signal web gui that we are no longer dialing dialing = nil websocketHub.UpdateStatus() - close(doneHandleInterrupt) - eventLog.LogConn("connect "+connectStr, currFreq, conn, err) - if err != nil { + switch { + case errors.Is(err, context.Canceled): + log.Printf("Connect cancelled") + return + case err != nil: log.Printf("Unable to establish connection to remote: %s", err) return } @@ -212,48 +230,6 @@ } } -func initWinmorTNC() error { - if wmTNC != nil && wmTNC.Ping() == nil { - return nil - } - - if wmTNC != nil { - wmTNC.Close() - } - - var err error - wmTNC, err = winmor.Open(config.Winmor.Addr, fOptions.MyCall, config.Locator) - if err != nil { - return fmt.Errorf("WINMOR TNC initialization failed: %w", err) - } - - if config.Winmor.DriveLevel != 0 { - if err := wmTNC.SetDriveLevel(config.Winmor.DriveLevel); err != nil { - log.Println("Failed to set WINMOR drive level:", err) - } - } - - if v, err := wmTNC.Version(); err != nil { - return fmt.Errorf("WINMOR TNC initialization failed: %s", err) - } else { - log.Printf("WINMOR TNC v%s initialized", v) - } - - transport.RegisterDialer(MethodWinmor, wmTNC) - - if !config.Winmor.PTTControl { - return nil - } - - rig, ok := rigs[config.Winmor.Rig] - if !ok { - return fmt.Errorf("unable to set PTT rig '%s': not defined or not loaded", config.Winmor.Rig) - } - wmTNC.SetPTT(rig) - - return nil -} - func initArdopTNC() error { if adTNC != nil && adTNC.Ping() == nil { return nil @@ -314,3 +290,32 @@ return nil } + +func initVaraModem(vModem *vara.Modem, scheme string, conf cfg.VaraConfig) error { + if vModem != nil { + _ = vModem.Close() + } + vConf := vara.ModemConfig{ + Host: conf.Host, + CmdPort: conf.CmdPort, + DataPort: conf.DataPort, + } + var err error + vModem, err = vara.NewModem(scheme, fOptions.MyCall, vConf) + if err != nil { + return fmt.Errorf("vara initialization failed: %w", err) + } + + transport.RegisterDialer(scheme, vModem) + + if !conf.PTTControl { + return nil + } + + rig, ok := rigs[conf.Rig] + if !ok { + return fmt.Errorf("unable to set PTT rig '%s': not defined or not loaded", conf.Rig) + } + vModem.SetPTT(rig) + return nil +} diff -Nru pat-0.12.1/CONTRIBUTING.md pat-0.13.1/CONTRIBUTING.md --- pat-0.12.1/CONTRIBUTING.md 2021-12-11 15:09:39.000000000 +0000 +++ pat-0.13.1/CONTRIBUTING.md 2022-10-22 20:39:54.000000000 +0000 @@ -30,7 +30,7 @@ - Run `go fmt` - Consider squashing your commits into a single commit. `git rebase -i`. It's okay to force update your pull request. - **Write a good commit message.** This [blog article](http://chris.beams.io/posts/git-commit/) is a good resource for learning how to write good commit messages, the most important part being that each commit message should have a title/subject in imperative mood starting with a capital letter and no trailing period: *"Return error on wrong use of the Paginator"*, **NOT** *"returning some error."* Also, if your commit references one or more GitHub issues, always end your commit message body with *See #1234* or *Fixes #1234*. Replace *1234* with the GitHub issue ID. The last example will close the issue when the commit is merged into *master*. - - Make sure `go test ./...` passes, and `go build` completes. Our [Travis CI loop](https://travis-ci.org/la5nta/pat) (Linux and OS X) will catch most things that are missing. + - Make sure `go test ./...` passes, and `go build` completes. Our [Travis CI loop](https://app.travis-ci.com/github/la5nta/pat) (Linux and OS X) will catch most things that are missing. ## The release process diff -Nru pat-0.12.1/debian/changelog pat-0.13.1/debian/changelog --- pat-0.12.1/debian/changelog 2022-06-12 02:30:38.000000000 +0000 +++ pat-0.13.1/debian/changelog 2022-10-22 22:16:34.000000000 +0000 @@ -1,3 +1,26 @@ +pat (0.13.1-1) unstable; urgency=medium + + * New upstream release + + -- Federico Grau Sat, 22 Oct 2022 18:16:34 -0400 + +pat (0.13.0-2) unstable; urgency=medium + + * Team upload. + * Upload to unstable. + + -- tony mancill Sat, 15 Oct 2022 15:00:10 -0700 + +pat (0.13.0-1) experimental; urgency=medium + + * Team upload. + * New upstream version 0.13.0 + * Refresh patches for new upstream version + * Freshen years in debian/copyright + * Bump Standards-Version to 4.6.1 + + -- tony mancill Thu, 01 Sep 2022 21:04:51 -0700 + pat (0.12.1-3) unstable; urgency=medium * Team upload. diff -Nru pat-0.12.1/debian/control pat-0.13.1/debian/control --- pat-0.12.1/debian/control 2022-06-12 02:30:38.000000000 +0000 +++ pat-0.13.1/debian/control 2022-10-22 22:16:34.000000000 +0000 @@ -15,6 +15,7 @@ golang-github-gorhill-cronexpr-dev, golang-github-gorilla-mux-dev, golang-github-howeyc-gopass-dev, + golang-github-imdario-mergo-dev, golang-github-jteeuwen-go-bindata-dev, golang-github-la5nta-wl2k-go-dev (>= 0.8.0), golang-github-microcosm-cc-bluemonday-dev, @@ -25,7 +26,7 @@ golang-github-gorilla-websocket-dev, golang-github-tarm-serial-dev, libax25-dev -Standards-Version: 4.6.0 +Standards-Version: 4.6.1 Vcs-Browser: https://salsa.debian.org/debian-hamradio-team/pat Vcs-Git: https://salsa.debian.org/debian-hamradio-team/pat.git Homepage: https://getpat.io diff -Nru pat-0.12.1/debian/copyright pat-0.13.1/debian/copyright --- pat-0.12.1/debian/copyright 2022-06-12 02:30:38.000000000 +0000 +++ pat-0.13.1/debian/copyright 2022-10-22 22:16:34.000000000 +0000 @@ -4,43 +4,19 @@ Source: https://github.com/la5nta/pat Files: * -Copyright: 2014-2021 Martin Hebnes Pedersen (LA5NTA) +Copyright: 2014-2022 Martin Hebnes Pedersen (LA5NTA) License: Expat Files: debian/* Copyright: 2021-2022 Taowa 2021-2022 Federico Grau + 2022 tony mancill License: Expat Comment: Debian packaging is licensed under the same terms as upstream -Files: debian/missing-sources/web/res/bootstrap-tokenfield.css - debian/missing-sources/web/res/js/bootstrap-tokenfield.js - web/res/js/bootstrap-tokenfield.min.js - web/res/bootstrap-tokenfield.min.css -Copyright: 2013 Sliptree (Illimar Tambek) - 2015 Open-Xchange -License: Expat - -Files: web/res/bootstrap-3.2.0-dist/* -Copyright: 2011-2020 Twitter, Inc. - 2011-2020 The Bootstrap Authors -License: Expat - -Files: web/res/js/jquery.min.js - debian/missing-sources/web/res/js/jquery.js -Copyright: 2005-2021 OpenJS Foundation -License: Expat - -Files: web/res/js/URI.min.js - debian/missing-sources/web/res/js/URI.js -Copyright: 2015 Rodney Rehm -License: Expat or GPL-3 - -Files: web/res/bootstrap-select.min.css - web/res/js/bootstrap-select.min.js - debian/missing-sources/web/res/bootstrap-select.css - debian/missing-sources/web/res/js/bootstrap-select.js -Copyright: 2013-2015 bootstrap-select, Authors of +Files: debian/patches/vendor-n8jja-pat-vara.patch +Copyright: Copyright (c) 2021 Jeremy Bush N8JJA +Comment: Vendored Golang module https://github.com/n8jja/Pat-Vara License: Expat License: Expat @@ -65,20 +41,3 @@ 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. - -License: GPL-3 - This package is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, Version 3. - . - This package 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 General Public License for more details. - . - You should have received a copy of the GNU General Public License - along with this package; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - . - On Debian systems, the complete text of the GNU General - Public License can be found in `/usr/share/common-licenses/GPL-3'. diff -Nru pat-0.12.1/debian/missing-sources/web/res/bootstrap-select.css pat-0.13.1/debian/missing-sources/web/res/bootstrap-select.css --- pat-0.12.1/debian/missing-sources/web/res/bootstrap-select.css 2022-06-12 02:30:38.000000000 +0000 +++ pat-0.13.1/debian/missing-sources/web/res/bootstrap-select.css 1970-01-01 00:00:00.000000000 +0000 @@ -1,272 +0,0 @@ -/*! - * Bootstrap-select v1.7.5 (http://silviomoreto.github.io/bootstrap-select) - * - * Copyright 2013-2015 bootstrap-select - * Licensed under MIT (https://github.com/silviomoreto/bootstrap-select/blob/master/LICENSE) - */ - -.bootstrap-select { - width: 220px \0; - /*IE9 and below*/ -} -.bootstrap-select > .dropdown-toggle { - width: 100%; - padding-right: 25px; -} -.has-error .bootstrap-select .dropdown-toggle, -.error .bootstrap-select .dropdown-toggle { - border-color: #b94a48; -} -.bootstrap-select.fit-width { - width: auto !important; -} -.bootstrap-select:not([class*="col-"]):not([class*="form-control"]):not(.input-group-btn) { - width: 220px; -} -.bootstrap-select .dropdown-toggle:focus { - outline: thin dotted #333333 !important; - outline: 5px auto -webkit-focus-ring-color !important; - outline-offset: -2px; -} -.bootstrap-select.form-control { - margin-bottom: 0; - padding: 0; - border: none; -} -.bootstrap-select.form-control:not([class*="col-"]) { - width: 100%; -} -.bootstrap-select.form-control.input-group-btn { - z-index: auto; -} -.bootstrap-select.btn-group:not(.input-group-btn), -.bootstrap-select.btn-group[class*="col-"] { - float: none; - display: inline-block; - margin-left: 0; -} -.bootstrap-select.btn-group.dropdown-menu-right, -.bootstrap-select.btn-group[class*="col-"].dropdown-menu-right, -.row .bootstrap-select.btn-group[class*="col-"].dropdown-menu-right { - float: right; -} -.form-inline .bootstrap-select.btn-group, -.form-horizontal .bootstrap-select.btn-group, -.form-group .bootstrap-select.btn-group { - margin-bottom: 0; -} -.form-group-lg .bootstrap-select.btn-group.form-control, -.form-group-sm .bootstrap-select.btn-group.form-control { - padding: 0; -} -.form-inline .bootstrap-select.btn-group .form-control { - width: 100%; -} -.bootstrap-select.btn-group.disabled, -.bootstrap-select.btn-group > .disabled { - cursor: not-allowed; -} -.bootstrap-select.btn-group.disabled:focus, -.bootstrap-select.btn-group > .disabled:focus { - outline: none !important; -} -.bootstrap-select.btn-group.bs-container { - position: absolute; -} -.bootstrap-select.btn-group.bs-container .dropdown-menu { - z-index: 1060; -} -.bootstrap-select.btn-group .dropdown-toggle .filter-option { - display: inline-block; - overflow: hidden; - width: 100%; - text-align: left; -} -.bootstrap-select.btn-group .dropdown-toggle .caret { - position: absolute; - top: 50%; - right: 12px; - margin-top: -2px; - vertical-align: middle; -} -.bootstrap-select.btn-group[class*="col-"] .dropdown-toggle { - width: 100%; -} -.bootstrap-select.btn-group .dropdown-menu { - min-width: 100%; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} -.bootstrap-select.btn-group .dropdown-menu.inner { - position: static; - float: none; - border: 0; - padding: 0; - margin: 0; - border-radius: 0; - -webkit-box-shadow: none; - box-shadow: none; -} -.bootstrap-select.btn-group .dropdown-menu li { - position: relative; -} -.bootstrap-select.btn-group .dropdown-menu li.active small { - color: #fff; -} -.bootstrap-select.btn-group .dropdown-menu li.disabled a { - cursor: not-allowed; -} -.bootstrap-select.btn-group .dropdown-menu li a { - cursor: pointer; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} -.bootstrap-select.btn-group .dropdown-menu li a.opt { - position: relative; - padding-left: 2.25em; -} -.bootstrap-select.btn-group .dropdown-menu li a span.check-mark { - display: none; -} -.bootstrap-select.btn-group .dropdown-menu li a span.text { - display: inline-block; -} -.bootstrap-select.btn-group .dropdown-menu li small { - padding-left: 0.5em; -} -.bootstrap-select.btn-group .dropdown-menu .notify { - position: absolute; - bottom: 5px; - width: 96%; - margin: 0 2%; - min-height: 26px; - padding: 3px 5px; - background: #f5f5f5; - border: 1px solid #e3e3e3; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); - pointer-events: none; - opacity: 0.9; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} -.bootstrap-select.btn-group .no-results { - padding: 3px; - background: #f5f5f5; - margin: 0 5px; - white-space: nowrap; -} -.bootstrap-select.btn-group.fit-width .dropdown-toggle .filter-option { - position: static; -} -.bootstrap-select.btn-group.fit-width .dropdown-toggle .caret { - position: static; - top: auto; - margin-top: -1px; -} -.bootstrap-select.btn-group.show-tick .dropdown-menu li.selected a span.check-mark { - position: absolute; - display: inline-block; - right: 15px; - margin-top: 5px; -} -.bootstrap-select.btn-group.show-tick .dropdown-menu li a span.text { - margin-right: 34px; -} -.bootstrap-select.show-menu-arrow.open > .dropdown-toggle { - z-index: 1061; -} -.bootstrap-select.show-menu-arrow .dropdown-toggle:before { - content: ''; - border-left: 7px solid transparent; - border-right: 7px solid transparent; - border-bottom: 7px solid rgba(204, 204, 204, 0.2); - position: absolute; - bottom: -4px; - left: 9px; - display: none; -} -.bootstrap-select.show-menu-arrow .dropdown-toggle:after { - content: ''; - border-left: 6px solid transparent; - border-right: 6px solid transparent; - border-bottom: 6px solid white; - position: absolute; - bottom: -4px; - left: 10px; - display: none; -} -.bootstrap-select.show-menu-arrow.dropup .dropdown-toggle:before { - bottom: auto; - top: -3px; - border-top: 7px solid rgba(204, 204, 204, 0.2); - border-bottom: 0; -} -.bootstrap-select.show-menu-arrow.dropup .dropdown-toggle:after { - bottom: auto; - top: -3px; - border-top: 6px solid white; - border-bottom: 0; -} -.bootstrap-select.show-menu-arrow.pull-right .dropdown-toggle:before { - right: 12px; - left: auto; -} -.bootstrap-select.show-menu-arrow.pull-right .dropdown-toggle:after { - right: 13px; - left: auto; -} -.bootstrap-select.show-menu-arrow.open > .dropdown-toggle:before, -.bootstrap-select.show-menu-arrow.open > .dropdown-toggle:after { - display: block; -} -.bs-searchbox, -.bs-actionsbox, -.bs-donebutton { - padding: 4px 8px; -} -.bs-actionsbox { - width: 100%; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} -.bs-actionsbox .btn-group button { - width: 50%; -} -.bs-donebutton { - float: left; - width: 100%; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} -.bs-donebutton .btn-group button { - width: 100%; -} -.bs-searchbox + .bs-actionsbox { - padding: 0 8px 4px; -} -.bs-searchbox .form-control { - margin-bottom: 0; - width: 100%; - float: none; -} -select.bs-select-hidden, -select.selectpicker { - display: none !important; -} -select.mobile-device { - position: absolute !important; - top: 0; - left: 0; - display: block !important; - width: 100%; - height: 100% !important; - opacity: 0; -} -/*# sourceMappingURL=bootstrap-select.css.map */ \ No newline at end of file diff -Nru pat-0.12.1/debian/missing-sources/web/res/bootstrap-tokenfield.css pat-0.13.1/debian/missing-sources/web/res/bootstrap-tokenfield.css --- pat-0.12.1/debian/missing-sources/web/res/bootstrap-tokenfield.css 2022-06-12 02:30:38.000000000 +0000 +++ pat-0.13.1/debian/missing-sources/web/res/bootstrap-tokenfield.css 1970-01-01 00:00:00.000000000 +0000 @@ -1,210 +0,0 @@ -/*! - * bootstrap-tokenfield - * https://github.com/sliptree/bootstrap-tokenfield - * Copyright 2013-2014 Sliptree and other contributors; Licensed MIT - */ -@-webkit-keyframes blink { - 0% { - border-color: #ededed; - } - 100% { - border-color: #b94a48; - } -} -@-moz-keyframes blink { - 0% { - border-color: #ededed; - } - 100% { - border-color: #b94a48; - } -} -@keyframes blink { - 0% { - border-color: #ededed; - } - 100% { - border-color: #b94a48; - } -} -.tokenfield { - height: auto; - min-height: 34px; - padding-bottom: 0px; -} -.tokenfield.focus { - border-color: #66afe9; - outline: 0; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, 0.6); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, 0.6); -} -.tokenfield .token { - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - border-radius: 3px; - display: inline-block; - border: 1px solid #d9d9d9; - background-color: #ededed; - white-space: nowrap; - margin: -1px 5px 5px 0; - height: 22px; - vertical-align: top; - cursor: default; -} -.tokenfield .token:hover { - border-color: #b9b9b9; -} -.tokenfield .token.active { - border-color: #52a8ec; - border-color: rgba(82, 168, 236, 0.8); -} -.tokenfield .token.duplicate { - border-color: #ebccd1; - -webkit-animation-name: blink; - animation-name: blink; - -webkit-animation-duration: 0.1s; - animation-duration: 0.1s; - -webkit-animation-direction: normal; - animation-direction: normal; - -webkit-animation-timing-function: ease; - animation-timing-function: ease; - -webkit-animation-iteration-count: infinite; - animation-iteration-count: infinite; -} -.tokenfield .token.invalid { - background: none; - border: 1px solid transparent; - -webkit-border-radius: 0; - -moz-border-radius: 0; - border-radius: 0; - border-bottom: 1px dotted #d9534f; -} -.tokenfield .token.invalid.active { - background: #ededed; - border: 1px solid #ededed; - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - border-radius: 3px; -} -.tokenfield .token .token-label { - display: inline-block; - overflow: hidden; - text-overflow: ellipsis; - padding-left: 4px; - vertical-align: top; -} -.tokenfield .token .close { - font-family: Arial; - display: inline-block; - line-height: 100%; - font-size: 1.1em; - line-height: 1.49em; - margin-left: 5px; - float: none; - height: 100%; - vertical-align: top; - padding-right: 4px; -} -.tokenfield .token-input { - background: none; - width: 60px; - min-width: 60px; - border: 0; - height: 20px; - padding: 0; - margin-bottom: 6px; - -webkit-box-shadow: none; - box-shadow: none; -} -.tokenfield .token-input:focus { - border-color: transparent; - outline: 0; - /* IE6-9 */ - -webkit-box-shadow: none; - box-shadow: none; -} -.tokenfield.disabled { - cursor: not-allowed; - background-color: #eeeeee; -} -.tokenfield.disabled .token-input { - cursor: not-allowed; -} -.tokenfield.disabled .token:hover { - cursor: not-allowed; - border-color: #d9d9d9; -} -.tokenfield.disabled .token:hover .close { - cursor: not-allowed; - opacity: 0.2; - filter: alpha(opacity=20); -} -.has-warning .tokenfield.focus { - border-color: #66512c; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #c0a16b; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #c0a16b; -} -.has-error .tokenfield.focus { - border-color: #843534; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ce8483; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ce8483; -} -.has-success .tokenfield.focus { - border-color: #2b542c; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #67b168; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #67b168; -} -.tokenfield.input-sm, -.input-group-sm .tokenfield { - min-height: 30px; - padding-bottom: 0px; -} -.input-group-sm .token, -.tokenfield.input-sm .token { - height: 20px; - margin-bottom: 4px; -} -.input-group-sm .token-input, -.tokenfield.input-sm .token-input { - height: 18px; - margin-bottom: 5px; -} -.tokenfield.input-lg, -.input-group-lg .tokenfield { - height: auto; - min-height: 45px; - padding-bottom: 4px; -} -.input-group-lg .token, -.tokenfield.input-lg .token { - height: 25px; -} -.input-group-lg .token .close, -.tokenfield.input-lg .token .close { - line-height: 1.3em; -} -.input-group-lg .token-label, -.tokenfield.input-lg .token-label { - line-height: 23px; -} -.input-group-lg .token-input, -.tokenfield.input-lg .token-input { - height: 23px; - line-height: 23px; - margin-bottom: 6px; - vertical-align: top; -} -.tokenfield.rtl { - direction: rtl; - text-align: right; -} -.tokenfield.rtl .token { - margin: -1px 0 5px 5px; -} -.tokenfield.rtl .token .token-label { - padding-left: 0px; - padding-right: 4px; -} diff -Nru pat-0.12.1/debian/missing-sources/web/res/js/bootstrap-select.js pat-0.13.1/debian/missing-sources/web/res/js/bootstrap-select.js --- pat-0.12.1/debian/missing-sources/web/res/js/bootstrap-select.js 2022-06-12 02:30:38.000000000 +0000 +++ pat-0.13.1/debian/missing-sources/web/res/js/bootstrap-select.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,1660 +0,0 @@ -/*! - * Bootstrap-select v1.7.5 (http://silviomoreto.github.io/bootstrap-select) - * - * Copyright 2013-2015 bootstrap-select - * Licensed under MIT (https://github.com/silviomoreto/bootstrap-select/blob/master/LICENSE) - */ - -(function (root, factory) { - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module unless amdModuleId is set - define(["jquery"], function (a0) { - return (factory(a0)); - }); - } else if (typeof exports === 'object') { - // Node. Does not work with strict CommonJS, but - // only CommonJS-like environments that support module.exports, - // like Node. - module.exports = factory(require("jquery")); - } else { - factory(jQuery); - } -}(this, function (jQuery) { - -(function ($) { - 'use strict'; - - // - if (!String.prototype.includes) { - (function () { - 'use strict'; // needed to support `apply`/`call` with `undefined`/`null` - var toString = {}.toString; - var defineProperty = (function () { - // IE 8 only supports `Object.defineProperty` on DOM elements - try { - var object = {}; - var $defineProperty = Object.defineProperty; - var result = $defineProperty(object, object, object) && $defineProperty; - } catch (error) { - } - return result; - }()); - var indexOf = ''.indexOf; - var includes = function (search) { - if (this == null) { - throw new TypeError(); - } - var string = String(this); - if (search && toString.call(search) == '[object RegExp]') { - throw new TypeError(); - } - var stringLength = string.length; - var searchString = String(search); - var searchLength = searchString.length; - var position = arguments.length > 1 ? arguments[1] : undefined; - // `ToInteger` - var pos = position ? Number(position) : 0; - if (pos != pos) { // better `isNaN` - pos = 0; - } - var start = Math.min(Math.max(pos, 0), stringLength); - // Avoid the `indexOf` call if no match is possible - if (searchLength + start > stringLength) { - return false; - } - return indexOf.call(string, searchString, pos) != -1; - }; - if (defineProperty) { - defineProperty(String.prototype, 'includes', { - 'value': includes, - 'configurable': true, - 'writable': true - }); - } else { - String.prototype.includes = includes; - } - }()); - } - - if (!String.prototype.startsWith) { - (function () { - 'use strict'; // needed to support `apply`/`call` with `undefined`/`null` - var defineProperty = (function () { - // IE 8 only supports `Object.defineProperty` on DOM elements - try { - var object = {}; - var $defineProperty = Object.defineProperty; - var result = $defineProperty(object, object, object) && $defineProperty; - } catch (error) { - } - return result; - }()); - var toString = {}.toString; - var startsWith = function (search) { - if (this == null) { - throw new TypeError(); - } - var string = String(this); - if (search && toString.call(search) == '[object RegExp]') { - throw new TypeError(); - } - var stringLength = string.length; - var searchString = String(search); - var searchLength = searchString.length; - var position = arguments.length > 1 ? arguments[1] : undefined; - // `ToInteger` - var pos = position ? Number(position) : 0; - if (pos != pos) { // better `isNaN` - pos = 0; - } - var start = Math.min(Math.max(pos, 0), stringLength); - // Avoid the `indexOf` call if no match is possible - if (searchLength + start > stringLength) { - return false; - } - var index = -1; - while (++index < searchLength) { - if (string.charCodeAt(start + index) != searchString.charCodeAt(index)) { - return false; - } - } - return true; - }; - if (defineProperty) { - defineProperty(String.prototype, 'startsWith', { - 'value': startsWith, - 'configurable': true, - 'writable': true - }); - } else { - String.prototype.startsWith = startsWith; - } - }()); - } - - if (!Object.keys) { - Object.keys = function ( - o, // object - k, // key - r // result array - ){ - // initialize object and result - r=[]; - // iterate over object keys - for (k in o) - // fill result array with non-prototypical keys - r.hasOwnProperty.call(o, k) && r.push(k); - // return result - return r; - }; - } - - $.fn.triggerNative = function (eventName) { - var el = this[0], - event; - - if (el.dispatchEvent) { - if (typeof Event === 'function') { - // For modern browsers - event = new Event(eventName, { - bubbles: true - }); - } else { - // For IE since it doesn't support Event constructor - event = document.createEvent('Event'); - event.initEvent(eventName, true, false); - } - - el.dispatchEvent(event); - } else { - if (el.fireEvent) { - event = document.createEventObject(); - event.eventType = eventName; - el.fireEvent('on' + eventName, event); - } - - this.trigger(eventName); - } - }; - // - - // Case insensitive contains search - $.expr[':'].icontains = function (obj, index, meta) { - var $obj = $(obj); - var haystack = ($obj.data('tokens') || $obj.text()).toUpperCase(); - return haystack.includes(meta[3].toUpperCase()); - }; - - // Case insensitive begins search - $.expr[':'].ibegins = function (obj, index, meta) { - var $obj = $(obj); - var haystack = ($obj.data('tokens') || $obj.text()).toUpperCase(); - return haystack.startsWith(meta[3].toUpperCase()); - }; - - // Case and accent insensitive contains search - $.expr[':'].aicontains = function (obj, index, meta) { - var $obj = $(obj); - var haystack = ($obj.data('tokens') || $obj.data('normalizedText') || $obj.text()).toUpperCase(); - return haystack.includes(meta[3].toUpperCase()); - }; - - // Case and accent insensitive begins search - $.expr[':'].aibegins = function (obj, index, meta) { - var $obj = $(obj); - var haystack = ($obj.data('tokens') || $obj.data('normalizedText') || $obj.text()).toUpperCase(); - return haystack.startsWith(meta[3].toUpperCase()); - }; - - /** - * Remove all diatrics from the given text. - * @access private - * @param {String} text - * @returns {String} - */ - function normalizeToBase(text) { - var rExps = [ - {re: /[\xC0-\xC6]/g, ch: "A"}, - {re: /[\xE0-\xE6]/g, ch: "a"}, - {re: /[\xC8-\xCB]/g, ch: "E"}, - {re: /[\xE8-\xEB]/g, ch: "e"}, - {re: /[\xCC-\xCF]/g, ch: "I"}, - {re: /[\xEC-\xEF]/g, ch: "i"}, - {re: /[\xD2-\xD6]/g, ch: "O"}, - {re: /[\xF2-\xF6]/g, ch: "o"}, - {re: /[\xD9-\xDC]/g, ch: "U"}, - {re: /[\xF9-\xFC]/g, ch: "u"}, - {re: /[\xC7-\xE7]/g, ch: "c"}, - {re: /[\xD1]/g, ch: "N"}, - {re: /[\xF1]/g, ch: "n"} - ]; - $.each(rExps, function () { - text = text.replace(this.re, this.ch); - }); - return text; - } - - - function htmlEscape(html) { - var escapeMap = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''', - '`': '`' - }; - var source = '(?:' + Object.keys(escapeMap).join('|') + ')', - testRegexp = new RegExp(source), - replaceRegexp = new RegExp(source, 'g'), - string = html == null ? '' : '' + html; - return testRegexp.test(string) ? string.replace(replaceRegexp, function (match) { - return escapeMap[match]; - }) : string; - } - - var Selectpicker = function (element, options, e) { - if (e) { - e.stopPropagation(); - e.preventDefault(); - } - - this.$element = $(element); - this.$newElement = null; - this.$button = null; - this.$menu = null; - this.$lis = null; - this.options = options; - - // If we have no title yet, try to pull it from the html title attribute (jQuery doesnt' pick it up as it's not a - // data-attribute) - if (this.options.title === null) { - this.options.title = this.$element.attr('title'); - } - - //Expose public methods - this.val = Selectpicker.prototype.val; - this.render = Selectpicker.prototype.render; - this.refresh = Selectpicker.prototype.refresh; - this.setStyle = Selectpicker.prototype.setStyle; - this.selectAll = Selectpicker.prototype.selectAll; - this.deselectAll = Selectpicker.prototype.deselectAll; - this.destroy = Selectpicker.prototype.remove; - this.remove = Selectpicker.prototype.remove; - this.show = Selectpicker.prototype.show; - this.hide = Selectpicker.prototype.hide; - - this.init(); - }; - - Selectpicker.VERSION = '1.7.5'; - - // part of this is duplicated in i18n/defaults-en_US.js. Make sure to update both. - Selectpicker.DEFAULTS = { - noneSelectedText: 'Nothing selected', - noneResultsText: 'No results matched {0}', - countSelectedText: function (numSelected, numTotal) { - return (numSelected == 1) ? "{0} item selected" : "{0} items selected"; - }, - maxOptionsText: function (numAll, numGroup) { - return [ - (numAll == 1) ? 'Limit reached ({n} item max)' : 'Limit reached ({n} items max)', - (numGroup == 1) ? 'Group limit reached ({n} item max)' : 'Group limit reached ({n} items max)' - ]; - }, - selectAllText: 'Select All', - deselectAllText: 'Deselect All', - doneButton: false, - doneButtonText: 'Close', - multipleSeparator: ', ', - styleBase: 'btn', - style: 'btn-default', - size: 'auto', - title: null, - selectedTextFormat: 'values', - width: false, - container: false, - hideDisabled: false, - showSubtext: false, - showIcon: true, - showContent: true, - dropupAuto: true, - header: false, - liveSearch: false, - liveSearchPlaceholder: null, - liveSearchNormalize: false, - liveSearchStyle: 'contains', - actionsBox: false, - iconBase: 'glyphicon', - tickIcon: 'glyphicon-ok', - template: { - caret: '' - }, - maxOptions: false, - mobile: false, - selectOnTab: false, - dropdownAlignRight: false - }; - - Selectpicker.prototype = { - - constructor: Selectpicker, - - init: function () { - var that = this, - id = this.$element.attr('id'); - - this.$element.addClass('bs-select-hidden'); - // store originalIndex (key) and newIndex (value) in this.liObj for fast accessibility - // allows us to do this.$lis.eq(that.liObj[index]) instead of this.$lis.filter('[data-original-index="' + index + '"]') - this.liObj = {}; - this.multiple = this.$element.prop('multiple'); - this.autofocus = this.$element.prop('autofocus'); - this.$newElement = this.createView(); - this.$element.after(this.$newElement); - this.$button = this.$newElement.children('button'); - this.$menu = this.$newElement.children('.dropdown-menu'); - this.$menuInner = this.$menu.children('.inner'); - this.$searchbox = this.$menu.find('input'); - - if (this.options.dropdownAlignRight) - this.$menu.addClass('dropdown-menu-right'); - - if (typeof id !== 'undefined') { - this.$button.attr('data-id', id); - $('label[for="' + id + '"]').click(function (e) { - e.preventDefault(); - that.$button.focus(); - }); - } - - this.checkDisabled(); - this.clickListener(); - if (this.options.liveSearch) this.liveSearchListener(); - this.render(); - this.setStyle(); - this.setWidth(); - if (this.options.container) this.selectPosition(); - this.$menu.data('this', this); - this.$newElement.data('this', this); - if (this.options.mobile) this.mobile(); - - this.$newElement.on({ - 'hide.bs.dropdown': function (e) { - that.$element.trigger('hide.bs.select', e); - }, - 'hidden.bs.dropdown': function (e) { - that.$element.trigger('hidden.bs.select', e); - }, - 'show.bs.dropdown': function (e) { - that.$element.trigger('show.bs.select', e); - }, - 'shown.bs.dropdown': function (e) { - that.$element.trigger('shown.bs.select', e); - } - }); - - setTimeout(function () { - that.$element.trigger('loaded.bs.select'); - }); - }, - - createDropdown: function () { - // Options - // If we are multiple, then add the show-tick class by default - var multiple = this.multiple ? ' show-tick' : '', - inputGroup = this.$element.parent().hasClass('input-group') ? ' input-group-btn' : '', - autofocus = this.autofocus ? ' autofocus' : ''; - // Elements - var header = this.options.header ? '
' + this.options.header + '
' : ''; - var searchbox = this.options.liveSearch ? - '' - : ''; - var actionsbox = this.multiple && this.options.actionsBox ? - '
' + - '
' + - '' + - '' + - '
' + - '
' - : ''; - var donebutton = this.multiple && this.options.doneButton ? - '
' + - '
' + - '' + - '
' + - '
' - : ''; - var drop = - '
' + - '' + - '' + - '
'; - - return $(drop); - }, - - createView: function () { - var $drop = this.createDropdown(), - li = this.createLi(); - - $drop.find('ul')[0].innerHTML = li; - return $drop; - }, - - reloadLi: function () { - //Remove all children. - this.destroyLi(); - //Re build - var li = this.createLi(); - this.$menuInner[0].innerHTML = li; - }, - - destroyLi: function () { - this.$menu.find('li').remove(); - }, - - createLi: function () { - var that = this, - _li = [], - optID = 0, - titleOption = document.createElement('option'), - liIndex = -1; // increment liIndex whenever a new
  • element is created to ensure liObj is correct - - // Helper functions - /** - * @param content - * @param [index] - * @param [classes] - * @param [optgroup] - * @returns {string} - */ - var generateLI = function (content, index, classes, optgroup) { - return '' + content + '
  • '; - }; - - /** - * @param text - * @param [classes] - * @param [inline] - * @param [tokens] - * @returns {string} - */ - var generateA = function (text, classes, inline, tokens) { - return '' + text + - '' + - ''; - }; - - if (this.options.title && !this.multiple) { - // this option doesn't create a new
  • element, but does add a new option, so liIndex is decreased - // since liObj is recalculated on every refresh, liIndex needs to be decreased even if the titleOption is already appended - liIndex--; - - if (!this.$element.find('.bs-title-option').length) { - // Use native JS to prepend option (faster) - var element = this.$element[0]; - titleOption.className = 'bs-title-option'; - titleOption.appendChild(document.createTextNode(this.options.title)); - titleOption.value = ''; - element.insertBefore(titleOption, element.firstChild); - // Check if selected attribute is already set on an option. If not, select the titleOption option. - if ($(element.options[element.selectedIndex]).attr('selected') === undefined) titleOption.selected = true; - } - } - - this.$element.find('option').each(function (index) { - var $this = $(this); - - liIndex++; - - if ($this.hasClass('bs-title-option')) return; - - // Get the class and text for the option - var optionClass = this.className || '', - inline = this.style.cssText, - text = $this.data('content') ? $this.data('content') : $this.html(), - tokens = $this.data('tokens') ? $this.data('tokens') : null, - subtext = typeof $this.data('subtext') !== 'undefined' ? '' + $this.data('subtext') + '' : '', - icon = typeof $this.data('icon') !== 'undefined' ? ' ' : '', - isDisabled = this.disabled || (this.parentNode.tagName === 'OPTGROUP' && this.parentNode.disabled); - - if (icon !== '' && isDisabled) { - icon = '' + icon + ''; - } - - if (that.options.hideDisabled && isDisabled) { - liIndex--; - return; - } - - if (!$this.data('content')) { - // Prepend any icon and append any subtext to the main text. - text = icon + '' + text + subtext + ''; - } - - if (this.parentNode.tagName === 'OPTGROUP' && $this.data('divider') !== true) { - var optGroupClass = ' ' + this.parentNode.className || ''; - - if ($this.index() === 0) { // Is it the first option of the optgroup? - optID += 1; - - // Get the opt group label - var label = this.parentNode.label, - labelSubtext = typeof $this.parent().data('subtext') !== 'undefined' ? '' + $this.parent().data('subtext') + '' : '', - labelIcon = $this.parent().data('icon') ? ' ' : ''; - - label = labelIcon + '' + label + labelSubtext + ''; - - if (index !== 0 && _li.length > 0) { // Is it NOT the first option of the select && are there elements in the dropdown? - liIndex++; - _li.push(generateLI('', null, 'divider', optID + 'div')); - } - liIndex++; - _li.push(generateLI(label, null, 'dropdown-header' + optGroupClass, optID)); - } - _li.push(generateLI(generateA(text, 'opt ' + optionClass + optGroupClass, inline, tokens), index, '', optID)); - } else if ($this.data('divider') === true) { - _li.push(generateLI('', index, 'divider')); - } else if ($this.data('hidden') === true) { - _li.push(generateLI(generateA(text, optionClass, inline, tokens), index, 'hidden is-hidden')); - } else { - if (this.previousElementSibling && this.previousElementSibling.tagName === 'OPTGROUP') { - liIndex++; - _li.push(generateLI('', null, 'divider', optID + 'div')); - } - _li.push(generateLI(generateA(text, optionClass, inline, tokens), index)); - } - - that.liObj[index] = liIndex; - }); - - //If we are not multiple, we don't have a selected item, and we don't have a title, select the first element so something is set in the button - if (!this.multiple && this.$element.find('option:selected').length === 0 && !this.options.title) { - this.$element.find('option').eq(0).prop('selected', true).attr('selected', 'selected'); - } - - return _li.join(''); - }, - - findLis: function () { - if (this.$lis == null) this.$lis = this.$menu.find('li'); - return this.$lis; - }, - - /** - * @param [updateLi] defaults to true - */ - render: function (updateLi) { - var that = this, - notDisabled; - - //Update the LI to match the SELECT - if (updateLi !== false) { - this.$element.find('option').each(function (index) { - var $lis = that.findLis().eq(that.liObj[index]); - - that.setDisabled(index, this.disabled || this.parentNode.tagName === 'OPTGROUP' && this.parentNode.disabled, $lis); - that.setSelected(index, this.selected, $lis); - }); - } - - this.tabIndex(); - - var selectedItems = this.$element.find('option').map(function () { - if (this.selected) { - if (that.options.hideDisabled && (this.disabled || this.parentNode.tagName === 'OPTGROUP' && this.parentNode.disabled)) return; - - var $this = $(this), - icon = $this.data('icon') && that.options.showIcon ? ' ' : '', - subtext; - - if (that.options.showSubtext && $this.data('subtext') && !that.multiple) { - subtext = ' ' + $this.data('subtext') + ''; - } else { - subtext = ''; - } - if (typeof $this.attr('title') !== 'undefined') { - return $this.attr('title'); - } else if ($this.data('content') && that.options.showContent) { - return $this.data('content'); - } else { - return icon + $this.html() + subtext; - } - } - }).toArray(); - - //Fixes issue in IE10 occurring when no default option is selected and at least one option is disabled - //Convert all the values into a comma delimited string - var title = !this.multiple ? selectedItems[0] : selectedItems.join(this.options.multipleSeparator); - - //If this is multi select, and the selectText type is count, the show 1 of 2 selected etc.. - if (this.multiple && this.options.selectedTextFormat.indexOf('count') > -1) { - var max = this.options.selectedTextFormat.split('>'); - if ((max.length > 1 && selectedItems.length > max[1]) || (max.length == 1 && selectedItems.length >= 2)) { - notDisabled = this.options.hideDisabled ? ', [disabled]' : ''; - var totalCount = this.$element.find('option').not('[data-divider="true"], [data-hidden="true"]' + notDisabled).length, - tr8nText = (typeof this.options.countSelectedText === 'function') ? this.options.countSelectedText(selectedItems.length, totalCount) : this.options.countSelectedText; - title = tr8nText.replace('{0}', selectedItems.length.toString()).replace('{1}', totalCount.toString()); - } - } - - if (this.options.title == undefined) { - this.options.title = this.$element.attr('title'); - } - - if (this.options.selectedTextFormat == 'static') { - title = this.options.title; - } - - //If we dont have a title, then use the default, or if nothing is set at all, use the not selected text - if (!title) { - title = typeof this.options.title !== 'undefined' ? this.options.title : this.options.noneSelectedText; - } - - //strip all html-tags and trim the result - this.$button.attr('title', $.trim(title.replace(/<[^>]*>?/g, ''))); - this.$button.children('.filter-option').html(title); - - this.$element.trigger('rendered.bs.select'); - }, - - /** - * @param [style] - * @param [status] - */ - setStyle: function (style, status) { - if (this.$element.attr('class')) { - this.$newElement.addClass(this.$element.attr('class').replace(/selectpicker|mobile-device|bs-select-hidden|validate\[.*\]/gi, '')); - } - - var buttonClass = style ? style : this.options.style; - - if (status == 'add') { - this.$button.addClass(buttonClass); - } else if (status == 'remove') { - this.$button.removeClass(buttonClass); - } else { - this.$button.removeClass(this.options.style); - this.$button.addClass(buttonClass); - } - }, - - liHeight: function (refresh) { - if (!refresh && (this.options.size === false || this.sizeInfo)) return; - - var newElement = document.createElement('div'), - menu = document.createElement('div'), - menuInner = document.createElement('ul'), - divider = document.createElement('li'), - li = document.createElement('li'), - a = document.createElement('a'), - text = document.createElement('span'), - header = this.options.header ? this.$menu.find('.popover-title')[0].cloneNode(true) : null, - search = this.options.liveSearch ? document.createElement('div') : null, - actions = this.options.actionsBox && this.multiple ? this.$menu.find('.bs-actionsbox')[0].cloneNode(true) : null, - doneButton = this.options.doneButton && this.multiple ? this.$menu.find('.bs-donebutton')[0].cloneNode(true) : null; - - text.className = 'text'; - newElement.className = this.$menu[0].parentNode.className + ' open'; - menu.className = 'dropdown-menu open'; - menuInner.className = 'dropdown-menu inner'; - divider.className = 'divider'; - - text.appendChild(document.createTextNode('Inner text')); - a.appendChild(text); - li.appendChild(a); - menuInner.appendChild(li); - menuInner.appendChild(divider); - if (header) menu.appendChild(header); - if (search) { - // create a span instead of input as creating an input element is slower - var input = document.createElement('span'); - search.className = 'bs-searchbox'; - input.className = 'form-control'; - search.appendChild(input); - menu.appendChild(search); - } - if (actions) menu.appendChild(actions); - menu.appendChild(menuInner); - if (doneButton) menu.appendChild(doneButton); - newElement.appendChild(menu); - - document.body.appendChild(newElement); - - var liHeight = a.offsetHeight, - headerHeight = header ? header.offsetHeight : 0, - searchHeight = search ? search.offsetHeight : 0, - actionsHeight = actions ? actions.offsetHeight : 0, - doneButtonHeight = doneButton ? doneButton.offsetHeight : 0, - dividerHeight = $(divider).outerHeight(true), - // fall back to jQuery if getComputedStyle is not supported - menuStyle = typeof getComputedStyle === 'function' ? getComputedStyle(menu) : false, - $menu = menuStyle ? null : $(menu), - menuPadding = parseInt(menuStyle ? menuStyle.paddingTop : $menu.css('paddingTop')) + - parseInt(menuStyle ? menuStyle.paddingBottom : $menu.css('paddingBottom')) + - parseInt(menuStyle ? menuStyle.borderTopWidth : $menu.css('borderTopWidth')) + - parseInt(menuStyle ? menuStyle.borderBottomWidth : $menu.css('borderBottomWidth')), - menuExtras = menuPadding + - parseInt(menuStyle ? menuStyle.marginTop : $menu.css('marginTop')) + - parseInt(menuStyle ? menuStyle.marginBottom : $menu.css('marginBottom')) + 2; - - document.body.removeChild(newElement); - - this.sizeInfo = { - liHeight: liHeight, - headerHeight: headerHeight, - searchHeight: searchHeight, - actionsHeight: actionsHeight, - doneButtonHeight: doneButtonHeight, - dividerHeight: dividerHeight, - menuPadding: menuPadding, - menuExtras: menuExtras - }; - }, - - setSize: function () { - this.findLis(); - this.liHeight(); - - if (this.options.header) this.$menu.css('padding-top', 0); - if (this.options.size === false) return; - - var that = this, - $menu = this.$menu, - $menuInner = this.$menuInner, - $window = $(window), - selectHeight = this.$newElement[0].offsetHeight, - liHeight = this.sizeInfo['liHeight'], - headerHeight = this.sizeInfo['headerHeight'], - searchHeight = this.sizeInfo['searchHeight'], - actionsHeight = this.sizeInfo['actionsHeight'], - doneButtonHeight = this.sizeInfo['doneButtonHeight'], - divHeight = this.sizeInfo['dividerHeight'], - menuPadding = this.sizeInfo['menuPadding'], - menuExtras = this.sizeInfo['menuExtras'], - notDisabled = this.options.hideDisabled ? '.disabled' : '', - menuHeight, - getHeight, - selectOffsetTop, - selectOffsetBot, - posVert = function () { - selectOffsetTop = that.$newElement.offset().top - $window.scrollTop(); - selectOffsetBot = $window.height() - selectOffsetTop - selectHeight; - }; - - posVert(); - - if (this.options.size === 'auto') { - var getSize = function () { - var minHeight, - hasClass = function (className, include) { - return function (element) { - if (include) { - return (element.classList ? element.classList.contains(className) : $(element).hasClass(className)); - } else { - return !(element.classList ? element.classList.contains(className) : $(element).hasClass(className)); - } - }; - }, - lis = that.$menuInner[0].getElementsByTagName('li'), - lisVisible = Array.prototype.filter ? Array.prototype.filter.call(lis, hasClass('hidden', false)) : that.$lis.not('.hidden'), - optGroup = Array.prototype.filter ? Array.prototype.filter.call(lisVisible, hasClass('dropdown-header', true)) : lisVisible.filter('.dropdown-header'); - - posVert(); - menuHeight = selectOffsetBot - menuExtras; - - if (that.options.container) { - if (!$menu.data('height')) $menu.data('height', $menu.height()); - getHeight = $menu.data('height'); - } else { - getHeight = $menu.height(); - } - - if (that.options.dropupAuto) { - that.$newElement.toggleClass('dropup', selectOffsetTop > selectOffsetBot && (menuHeight - menuExtras) < getHeight); - } - if (that.$newElement.hasClass('dropup')) { - menuHeight = selectOffsetTop - menuExtras; - } - - if ((lisVisible.length + optGroup.length) > 3) { - minHeight = liHeight * 3 + menuExtras - 2; - } else { - minHeight = 0; - } - - $menu.css({ - 'max-height': menuHeight + 'px', - 'overflow': 'hidden', - 'min-height': minHeight + headerHeight + searchHeight + actionsHeight + doneButtonHeight + 'px' - }); - $menuInner.css({ - 'max-height': menuHeight - headerHeight - searchHeight - actionsHeight - doneButtonHeight - menuPadding + 'px', - 'overflow-y': 'auto', - 'min-height': Math.max(minHeight - menuPadding, 0) + 'px' - }); - }; - getSize(); - this.$searchbox.off('input.getSize propertychange.getSize').on('input.getSize propertychange.getSize', getSize); - $window.off('resize.getSize scroll.getSize').on('resize.getSize scroll.getSize', getSize); - } else if (this.options.size && this.options.size != 'auto' && this.$lis.not(notDisabled).length > this.options.size) { - var optIndex = this.$lis.not('.divider').not(notDisabled).children().slice(0, this.options.size).last().parent().index(), - divLength = this.$lis.slice(0, optIndex + 1).filter('.divider').length; - menuHeight = liHeight * this.options.size + divLength * divHeight + menuPadding; - - if (that.options.container) { - if (!$menu.data('height')) $menu.data('height', $menu.height()); - getHeight = $menu.data('height'); - } else { - getHeight = $menu.height(); - } - - if (that.options.dropupAuto) { - //noinspection JSUnusedAssignment - this.$newElement.toggleClass('dropup', selectOffsetTop > selectOffsetBot && (menuHeight - menuExtras) < getHeight); - } - $menu.css({ - 'max-height': menuHeight + headerHeight + searchHeight + actionsHeight + doneButtonHeight + 'px', - 'overflow': 'hidden', - 'min-height': '' - }); - $menuInner.css({ - 'max-height': menuHeight - menuPadding + 'px', - 'overflow-y': 'auto', - 'min-height': '' - }); - } - }, - - setWidth: function () { - if (this.options.width === 'auto') { - this.$menu.css('min-width', '0'); - - // Get correct width if element is hidden - var $selectClone = this.$menu.parent().clone().appendTo('body'), - $selectClone2 = this.options.container ? this.$newElement.clone().appendTo('body') : $selectClone, - ulWidth = $selectClone.children('.dropdown-menu').outerWidth(), - btnWidth = $selectClone2.css('width', 'auto').children('button').outerWidth(); - - $selectClone.remove(); - $selectClone2.remove(); - - // Set width to whatever's larger, button title or longest option - this.$newElement.css('width', Math.max(ulWidth, btnWidth) + 'px'); - } else if (this.options.width === 'fit') { - // Remove inline min-width so width can be changed from 'auto' - this.$menu.css('min-width', ''); - this.$newElement.css('width', '').addClass('fit-width'); - } else if (this.options.width) { - // Remove inline min-width so width can be changed from 'auto' - this.$menu.css('min-width', ''); - this.$newElement.css('width', this.options.width); - } else { - // Remove inline min-width/width so width can be changed - this.$menu.css('min-width', ''); - this.$newElement.css('width', ''); - } - // Remove fit-width class if width is changed programmatically - if (this.$newElement.hasClass('fit-width') && this.options.width !== 'fit') { - this.$newElement.removeClass('fit-width'); - } - }, - - selectPosition: function () { - var that = this, - $drop = $('
    '), - pos, - actualHeight, - getPlacement = function ($element) { - $drop.addClass($element.attr('class').replace(/form-control|fit-width/gi, '')).toggleClass('dropup', $element.hasClass('dropup')); - pos = $element.offset(); - actualHeight = $element.hasClass('dropup') ? 0 : $element[0].offsetHeight; - $drop.css({ - 'top': pos.top + actualHeight, - 'left': pos.left, - 'width': $element[0].offsetWidth - }); - }; - - this.$newElement.on('click', function () { - if (that.isDisabled()) { - return; - } - getPlacement($(this)); - $drop.appendTo(that.options.container); - $drop.toggleClass('open', !$(this).hasClass('open')); - $drop.append(that.$menu); - }); - - $(window).on('resize scroll', function () { - getPlacement(that.$newElement); - }); - - this.$element.on('hide.bs.select', function () { - that.$menu.data('height', that.$menu.height()); - $drop.detach(); - }); - }, - - setSelected: function (index, selected, $lis) { - if (!$lis) { - $lis = this.findLis().eq(this.liObj[index]); - } - - $lis.toggleClass('selected', selected); - }, - - setDisabled: function (index, disabled, $lis) { - if (!$lis) { - $lis = this.findLis().eq(this.liObj[index]); - } - - if (disabled) { - $lis.addClass('disabled').children('a').attr('href', '#').attr('tabindex', -1); - } else { - $lis.removeClass('disabled').children('a').removeAttr('href').attr('tabindex', 0); - } - }, - - isDisabled: function () { - return this.$element[0].disabled; - }, - - checkDisabled: function () { - var that = this; - - if (this.isDisabled()) { - this.$newElement.addClass('disabled'); - this.$button.addClass('disabled').attr('tabindex', -1); - } else { - if (this.$button.hasClass('disabled')) { - this.$newElement.removeClass('disabled'); - this.$button.removeClass('disabled'); - } - - if (this.$button.attr('tabindex') == -1 && !this.$element.data('tabindex')) { - this.$button.removeAttr('tabindex'); - } - } - - this.$button.click(function () { - return !that.isDisabled(); - }); - }, - - tabIndex: function () { - if (this.$element.is('[tabindex]')) { - this.$element.data('tabindex', this.$element.attr('tabindex')); - this.$button.attr('tabindex', this.$element.data('tabindex')); - } - }, - - clickListener: function () { - var that = this, - $document = $(document); - - this.$newElement.on('touchstart.dropdown', '.dropdown-menu', function (e) { - e.stopPropagation(); - }); - - $document.data('spaceSelect', false); - - this.$button.on('keyup', function (e) { - if (/(32)/.test(e.keyCode.toString(10)) && $document.data('spaceSelect')) { - e.preventDefault(); - $document.data('spaceSelect', false); - } - }); - - this.$newElement.on('click', function () { - that.setSize(); - that.$element.on('shown.bs.select', function () { - if (!that.options.liveSearch && !that.multiple) { - that.$menuInner.find('.selected a').focus(); - } else if (!that.multiple) { - var selectedIndex = that.liObj[that.$element[0].selectedIndex]; - - if (typeof selectedIndex !== 'number' || that.options.size === false) return; - - // scroll to selected option - var offset = that.$lis.eq(selectedIndex)[0].offsetTop - that.$menuInner[0].offsetTop; - offset = offset - that.$menuInner[0].offsetHeight/2 + that.sizeInfo.liHeight/2; - that.$menuInner[0].scrollTop = offset; - } - }); - }); - - this.$menuInner.on('click', 'li a', function (e) { - var $this = $(this), - clickedIndex = $this.parent().data('originalIndex'), - prevValue = that.$element.val(), - prevIndex = that.$element.prop('selectedIndex'); - - // Don't close on multi choice menu - if (that.multiple) { - e.stopPropagation(); - } - - e.preventDefault(); - - //Don't run if we have been disabled - if (!that.isDisabled() && !$this.parent().hasClass('disabled')) { - var $options = that.$element.find('option'), - $option = $options.eq(clickedIndex), - state = $option.prop('selected'), - $optgroup = $option.parent('optgroup'), - maxOptions = that.options.maxOptions, - maxOptionsGrp = $optgroup.data('maxOptions') || false; - - if (!that.multiple) { // Deselect all others if not multi select box - $options.prop('selected', false); - $option.prop('selected', true); - that.$menuInner.find('.selected').removeClass('selected'); - that.setSelected(clickedIndex, true); - } else { // Toggle the one we have chosen if we are multi select. - $option.prop('selected', !state); - that.setSelected(clickedIndex, !state); - $this.blur(); - - if (maxOptions !== false || maxOptionsGrp !== false) { - var maxReached = maxOptions < $options.filter(':selected').length, - maxReachedGrp = maxOptionsGrp < $optgroup.find('option:selected').length; - - if ((maxOptions && maxReached) || (maxOptionsGrp && maxReachedGrp)) { - if (maxOptions && maxOptions == 1) { - $options.prop('selected', false); - $option.prop('selected', true); - that.$menuInner.find('.selected').removeClass('selected'); - that.setSelected(clickedIndex, true); - } else if (maxOptionsGrp && maxOptionsGrp == 1) { - $optgroup.find('option:selected').prop('selected', false); - $option.prop('selected', true); - var optgroupID = $this.parent().data('optgroup'); - that.$menuInner.find('[data-optgroup="' + optgroupID + '"]').removeClass('selected'); - that.setSelected(clickedIndex, true); - } else { - var maxOptionsArr = (typeof that.options.maxOptionsText === 'function') ? - that.options.maxOptionsText(maxOptions, maxOptionsGrp) : that.options.maxOptionsText, - maxTxt = maxOptionsArr[0].replace('{n}', maxOptions), - maxTxtGrp = maxOptionsArr[1].replace('{n}', maxOptionsGrp), - $notify = $('
    '); - // If {var} is set in array, replace it - /** @deprecated */ - if (maxOptionsArr[2]) { - maxTxt = maxTxt.replace('{var}', maxOptionsArr[2][maxOptions > 1 ? 0 : 1]); - maxTxtGrp = maxTxtGrp.replace('{var}', maxOptionsArr[2][maxOptionsGrp > 1 ? 0 : 1]); - } - - $option.prop('selected', false); - - that.$menu.append($notify); - - if (maxOptions && maxReached) { - $notify.append($('
    ' + maxTxt + '
    ')); - that.$element.trigger('maxReached.bs.select'); - } - - if (maxOptionsGrp && maxReachedGrp) { - $notify.append($('
    ' + maxTxtGrp + '
    ')); - that.$element.trigger('maxReachedGrp.bs.select'); - } - - setTimeout(function () { - that.setSelected(clickedIndex, false); - }, 10); - - $notify.delay(750).fadeOut(300, function () { - $(this).remove(); - }); - } - } - } - } - - if (!that.multiple) { - that.$button.focus(); - } else if (that.options.liveSearch) { - that.$searchbox.focus(); - } - - // Trigger select 'change' - if ((prevValue != that.$element.val() && that.multiple) || (prevIndex != that.$element.prop('selectedIndex') && !that.multiple)) { - that.$element.triggerNative('change'); - // $option.prop('selected') is current option state (selected/unselected). state is previous option state. - that.$element.trigger('changed.bs.select', [clickedIndex, $option.prop('selected'), state]); - } - } - }); - - this.$menu.on('click', 'li.disabled a, .popover-title, .popover-title :not(.close)', function (e) { - if (e.currentTarget == this) { - e.preventDefault(); - e.stopPropagation(); - if (that.options.liveSearch && !$(e.target).hasClass('close')) { - that.$searchbox.focus(); - } else { - that.$button.focus(); - } - } - }); - - this.$menuInner.on('click', '.divider, .dropdown-header', function (e) { - e.preventDefault(); - e.stopPropagation(); - if (that.options.liveSearch) { - that.$searchbox.focus(); - } else { - that.$button.focus(); - } - }); - - this.$menu.on('click', '.popover-title .close', function () { - that.$button.click(); - }); - - this.$searchbox.on('click', function (e) { - e.stopPropagation(); - }); - - this.$menu.on('click', '.actions-btn', function (e) { - if (that.options.liveSearch) { - that.$searchbox.focus(); - } else { - that.$button.focus(); - } - - e.preventDefault(); - e.stopPropagation(); - - if ($(this).hasClass('bs-select-all')) { - that.selectAll(); - } else { - that.deselectAll(); - } - that.$element.triggerNative('change'); - }); - - this.$element.change(function () { - that.render(false); - }); - }, - - liveSearchListener: function () { - var that = this, - $no_results = $('
  • '); - - this.$newElement.on('click.dropdown.data-api touchstart.dropdown.data-api', function () { - that.$menuInner.find('.active').removeClass('active'); - if (!!that.$searchbox.val()) { - that.$searchbox.val(''); - that.$lis.not('.is-hidden').removeClass('hidden'); - if (!!$no_results.parent().length) $no_results.remove(); - } - if (!that.multiple) that.$menuInner.find('.selected').addClass('active'); - setTimeout(function () { - that.$searchbox.focus(); - }, 10); - }); - - this.$searchbox.on('click.dropdown.data-api focus.dropdown.data-api touchend.dropdown.data-api', function (e) { - e.stopPropagation(); - }); - - this.$searchbox.on('input propertychange', function () { - if (that.$searchbox.val()) { - var $searchBase = that.$lis.not('.is-hidden').removeClass('hidden').children('a'); - if (that.options.liveSearchNormalize) { - $searchBase = $searchBase.not(':a' + that._searchStyle() + '("' + normalizeToBase(that.$searchbox.val()) + '")'); - } else { - $searchBase = $searchBase.not(':' + that._searchStyle() + '("' + that.$searchbox.val() + '")'); - } - $searchBase.parent().addClass('hidden'); - - that.$lis.filter('.dropdown-header').each(function () { - var $this = $(this), - optgroup = $this.data('optgroup'); - - if (that.$lis.filter('[data-optgroup=' + optgroup + ']').not($this).not('.hidden').length === 0) { - $this.addClass('hidden'); - that.$lis.filter('[data-optgroup=' + optgroup + 'div]').addClass('hidden'); - } - }); - - var $lisVisible = that.$lis.not('.hidden'); - - // hide divider if first or last visible, or if followed by another divider - $lisVisible.each(function (index) { - var $this = $(this); - - if ($this.hasClass('divider') && ( - $this.index() === $lisVisible.first().index() || - $this.index() === $lisVisible.last().index() || - $lisVisible.eq(index + 1).hasClass('divider'))) { - $this.addClass('hidden'); - } - }); - - if (!that.$lis.not('.hidden, .no-results').length) { - if (!!$no_results.parent().length) { - $no_results.remove(); - } - $no_results.html(that.options.noneResultsText.replace('{0}', '"' + htmlEscape(that.$searchbox.val()) + '"')).show(); - that.$menuInner.append($no_results); - } else if (!!$no_results.parent().length) { - $no_results.remove(); - } - } else { - that.$lis.not('.is-hidden').removeClass('hidden'); - if (!!$no_results.parent().length) { - $no_results.remove(); - } - } - - that.$lis.filter('.active').removeClass('active'); - if (that.$searchbox.val()) that.$lis.not('.hidden, .divider, .dropdown-header').eq(0).addClass('active').children('a').focus(); - $(this).focus(); - }); - }, - - _searchStyle: function () { - var styles = { - begins: 'ibegins', - startsWith: 'ibegins' - }; - - return styles[this.options.liveSearchStyle] || 'icontains'; - }, - - val: function (value) { - if (typeof value !== 'undefined') { - this.$element.val(value); - this.render(); - - return this.$element; - } else { - return this.$element.val(); - } - }, - - changeAll: function (status) { - if (typeof status === 'undefined') status = true; - - this.findLis(); - - var $options = this.$element.find('option'), - $lisVisible = this.$lis.not('.divider, .dropdown-header, .disabled, .hidden').toggleClass('selected', status), - lisVisLen = $lisVisible.length, - selectedOptions = []; - - for (var i = 0; i < lisVisLen; i++) { - var origIndex = $lisVisible[i].getAttribute('data-original-index'); - selectedOptions[selectedOptions.length] = $options.eq(origIndex)[0]; - } - - $(selectedOptions).prop('selected', status); - - this.render(false); - }, - - selectAll: function () { - return this.changeAll(true); - }, - - deselectAll: function () { - return this.changeAll(false); - }, - - keydown: function (e) { - var $this = $(this), - $parent = $this.is('input') ? $this.parent().parent() : $this.parent(), - $items, - that = $parent.data('this'), - index, - next, - first, - last, - prev, - nextPrev, - prevIndex, - isActive, - selector = ':not(.disabled, .hidden, .dropdown-header, .divider)', - keyCodeMap = { - 32: ' ', - 48: '0', - 49: '1', - 50: '2', - 51: '3', - 52: '4', - 53: '5', - 54: '6', - 55: '7', - 56: '8', - 57: '9', - 59: ';', - 65: 'a', - 66: 'b', - 67: 'c', - 68: 'd', - 69: 'e', - 70: 'f', - 71: 'g', - 72: 'h', - 73: 'i', - 74: 'j', - 75: 'k', - 76: 'l', - 77: 'm', - 78: 'n', - 79: 'o', - 80: 'p', - 81: 'q', - 82: 'r', - 83: 's', - 84: 't', - 85: 'u', - 86: 'v', - 87: 'w', - 88: 'x', - 89: 'y', - 90: 'z', - 96: '0', - 97: '1', - 98: '2', - 99: '3', - 100: '4', - 101: '5', - 102: '6', - 103: '7', - 104: '8', - 105: '9' - }; - - if (that.options.liveSearch) $parent = $this.parent().parent(); - - if (that.options.container) $parent = that.$menu; - - $items = $('[role=menu] li', $parent); - - isActive = that.$menu.parent().hasClass('open'); - - if (!isActive && (e.keyCode >= 48 && e.keyCode <= 57 || e.keyCode >= 96 && e.keyCode <= 105 || e.keyCode >= 65 && e.keyCode <= 90)) { - if (!that.options.container) { - that.setSize(); - that.$menu.parent().addClass('open'); - isActive = true; - } else { - that.$newElement.trigger('click'); - } - that.$searchbox.focus(); - } - - if (that.options.liveSearch) { - if (/(^9$|27)/.test(e.keyCode.toString(10)) && isActive && that.$menu.find('.active').length === 0) { - e.preventDefault(); - that.$menu.parent().removeClass('open'); - if (that.options.container) that.$newElement.removeClass('open'); - that.$button.focus(); - } - // $items contains li elements when liveSearch is enabled - $items = $('[role=menu] li' + selector, $parent); - if (!$this.val() && !/(38|40)/.test(e.keyCode.toString(10))) { - if ($items.filter('.active').length === 0) { - $items = that.$menuInner.find('li'); - if (that.options.liveSearchNormalize) { - $items = $items.filter(':a' + that._searchStyle() + '(' + normalizeToBase(keyCodeMap[e.keyCode]) + ')'); - } else { - $items = $items.filter(':' + that._searchStyle() + '(' + keyCodeMap[e.keyCode] + ')'); - } - } - } - } - - if (!$items.length) return; - - if (/(38|40)/.test(e.keyCode.toString(10))) { - index = $items.index($items.find('a').filter(':focus').parent()); - first = $items.filter(selector).first().index(); - last = $items.filter(selector).last().index(); - next = $items.eq(index).nextAll(selector).eq(0).index(); - prev = $items.eq(index).prevAll(selector).eq(0).index(); - nextPrev = $items.eq(next).prevAll(selector).eq(0).index(); - - if (that.options.liveSearch) { - $items.each(function (i) { - if (!$(this).hasClass('disabled')) { - $(this).data('index', i); - } - }); - index = $items.index($items.filter('.active')); - first = $items.first().data('index'); - last = $items.last().data('index'); - next = $items.eq(index).nextAll().eq(0).data('index'); - prev = $items.eq(index).prevAll().eq(0).data('index'); - nextPrev = $items.eq(next).prevAll().eq(0).data('index'); - } - - prevIndex = $this.data('prevIndex'); - - if (e.keyCode == 38) { - if (that.options.liveSearch) index--; - if (index != nextPrev && index > prev) index = prev; - if (index < first) index = first; - if (index == prevIndex) index = last; - } else if (e.keyCode == 40) { - if (that.options.liveSearch) index++; - if (index == -1) index = 0; - if (index != nextPrev && index < next) index = next; - if (index > last) index = last; - if (index == prevIndex) index = first; - } - - $this.data('prevIndex', index); - - if (!that.options.liveSearch) { - $items.eq(index).children('a').focus(); - } else { - e.preventDefault(); - if (!$this.hasClass('dropdown-toggle')) { - $items.removeClass('active').eq(index).addClass('active').children('a').focus(); - $this.focus(); - } - } - - } else if (!$this.is('input')) { - var keyIndex = [], - count, - prevKey; - - $items.each(function () { - if (!$(this).hasClass('disabled')) { - if ($.trim($(this).children('a').text().toLowerCase()).substring(0, 1) == keyCodeMap[e.keyCode]) { - keyIndex.push($(this).index()); - } - } - }); - - count = $(document).data('keycount'); - count++; - $(document).data('keycount', count); - - prevKey = $.trim($(':focus').text().toLowerCase()).substring(0, 1); - - if (prevKey != keyCodeMap[e.keyCode]) { - count = 1; - $(document).data('keycount', count); - } else if (count >= keyIndex.length) { - $(document).data('keycount', 0); - if (count > keyIndex.length) count = 1; - } - - $items.eq(keyIndex[count - 1]).children('a').focus(); - } - - // Select focused option if "Enter", "Spacebar" or "Tab" (when selectOnTab is true) are pressed inside the menu. - if ((/(13|32)/.test(e.keyCode.toString(10)) || (/(^9$)/.test(e.keyCode.toString(10)) && that.options.selectOnTab)) && isActive) { - if (!/(32)/.test(e.keyCode.toString(10))) e.preventDefault(); - if (!that.options.liveSearch) { - var elem = $(':focus'); - elem.click(); - // Bring back focus for multiselects - elem.focus(); - // Prevent screen from scrolling if the user hit the spacebar - e.preventDefault(); - // Fixes spacebar selection of dropdown items in FF & IE - $(document).data('spaceSelect', true); - } else if (!/(32)/.test(e.keyCode.toString(10))) { - that.$menuInner.find('.active a').click(); - $this.focus(); - } - $(document).data('keycount', 0); - } - - if ((/(^9$|27)/.test(e.keyCode.toString(10)) && isActive && (that.multiple || that.options.liveSearch)) || (/(27)/.test(e.keyCode.toString(10)) && !isActive)) { - that.$menu.parent().removeClass('open'); - if (that.options.container) that.$newElement.removeClass('open'); - that.$button.focus(); - } - }, - - mobile: function () { - this.$element.addClass('mobile-device').appendTo(this.$newElement); - if (this.options.container) this.$menu.hide(); - }, - - refresh: function () { - this.$lis = null; - this.liObj = {}; - this.reloadLi(); - this.render(); - this.checkDisabled(); - this.liHeight(true); - this.setStyle(); - this.setWidth(); - if (this.$lis) this.$searchbox.trigger('propertychange'); - - this.$element.trigger('refreshed.bs.select'); - }, - - hide: function () { - this.$newElement.hide(); - }, - - show: function () { - this.$newElement.show(); - }, - - remove: function () { - this.$newElement.remove(); - this.$element.remove(); - } - }; - - // SELECTPICKER PLUGIN DEFINITION - // ============================== - function Plugin(option, event) { - // get the args of the outer function.. - var args = arguments; - // The arguments of the function are explicitly re-defined from the argument list, because the shift causes them - // to get lost/corrupted in android 2.3 and IE9 #715 #775 - var _option = option, - _event = event; - [].shift.apply(args); - - var value; - var chain = this.each(function () { - var $this = $(this); - if ($this.is('select')) { - var data = $this.data('selectpicker'), - options = typeof _option == 'object' && _option; - - if (!data) { - var config = $.extend({}, Selectpicker.DEFAULTS, $.fn.selectpicker.defaults || {}, $this.data(), options); - config.template = $.extend({}, Selectpicker.DEFAULTS.template, ($.fn.selectpicker.defaults ? $.fn.selectpicker.defaults.template : {}), $this.data().template, options.template); - $this.data('selectpicker', (data = new Selectpicker(this, config, _event))); - } else if (options) { - for (var i in options) { - if (options.hasOwnProperty(i)) { - data.options[i] = options[i]; - } - } - } - - if (typeof _option == 'string') { - if (data[_option] instanceof Function) { - value = data[_option].apply(data, args); - } else { - value = data.options[_option]; - } - } - } - }); - - if (typeof value !== 'undefined') { - //noinspection JSUnusedAssignment - return value; - } else { - return chain; - } - } - - var old = $.fn.selectpicker; - $.fn.selectpicker = Plugin; - $.fn.selectpicker.Constructor = Selectpicker; - - // SELECTPICKER NO CONFLICT - // ======================== - $.fn.selectpicker.noConflict = function () { - $.fn.selectpicker = old; - return this; - }; - - $(document) - .data('keycount', 0) - .on('keydown', '.bootstrap-select [data-toggle=dropdown], .bootstrap-select [role="menu"], .bs-searchbox input', Selectpicker.prototype.keydown) - .on('focusin.modal', '.bootstrap-select [data-toggle=dropdown], .bootstrap-select [role="menu"], .bs-searchbox input', function (e) { - e.stopPropagation(); - }); - - // SELECTPICKER DATA-API - // ===================== - $(window).on('load.bs.select.data-api', function () { - $('.selectpicker').each(function () { - var $selectpicker = $(this); - Plugin.call($selectpicker, $selectpicker.data()); - }) - }); -})(jQuery); - - -})); diff -Nru pat-0.12.1/debian/missing-sources/web/res/js/bootstrap-tokenfield.js pat-0.13.1/debian/missing-sources/web/res/js/bootstrap-tokenfield.js --- pat-0.12.1/debian/missing-sources/web/res/js/bootstrap-tokenfield.js 2022-06-12 02:30:38.000000000 +0000 +++ pat-0.13.1/debian/missing-sources/web/res/js/bootstrap-tokenfield.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,1009 +0,0 @@ -/*! - * bootstrap-tokenfield - * https://github.com/sliptree/bootstrap-tokenfield - * Copyright 2013-2014 Sliptree and other contributors; Licensed MIT - */ - -(function (factory) { - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define(['jquery'], factory); - } else if (typeof exports === 'object') { - // For CommonJS and CommonJS-like environments where a window with jQuery - // is present, execute the factory with the jQuery instance from the window object - // For environments that do not inherently posses a window with a document - // (such as Node.js), expose a Tokenfield-making factory as module.exports - // This accentuates the need for the creation of a real window or passing in a jQuery instance - // e.g. require("bootstrap-tokenfield")(window); or require("bootstrap-tokenfield")($); - module.exports = global.window && global.window.$ ? - factory(global.window.$) : - function (input) { - if (!input.$ && !input.fn) { - throw new Error('Tokenfield requires a window object with jQuery or a jQuery instance'); - } - return factory(input.$ || input); - }; - } else { - // Browser globals - factory(jQuery, window); - } -}(function ($, window) { - - 'use strict'; - - /* TOKENFIELD PUBLIC CLASS DEFINITION */ - - var Tokenfield = function (element, options) { - var _self = this; - - this.$element = $(element); - this.textDirection = this.$element.css('direction'); - - // Extend options - this.options = $.extend(true, {}, $.fn.tokenfield.defaults, { tokens: this.$element.val() }, this.$element.data(), options); - - // Setup delimiters and trigger keys - this._delimiters = (typeof this.options.delimiter === 'string') ? [this.options.delimiter] : this.options.delimiter; - this._triggerKeys = $.map(this._delimiters, function (delimiter) { - return delimiter.charCodeAt(0); - }); - this._firstDelimiter = this._delimiters[0]; - - // Check for whitespace, dash and special characters - var whitespace = $.inArray(' ', this._delimiters), - dash = $.inArray('-', this._delimiters); - - if (whitespace >= 0) { - this._delimiters[whitespace] = '\\s'; - } - - if (dash >= 0) { - delete this._delimiters[dash]; - this._delimiters.unshift('-'); - } - - var specialCharacters = ['\\', '$', '[', '{', '^', '.', '|', '?', '*', '+', '(', ')']; - $.each(this._delimiters, function (index, character) { - var pos = $.inArray(character, specialCharacters); - if (pos >= 0) _self._delimiters[index] = '\\' + character; - }); - - // Store original input width - var elStyleWidth = element.style.width, - elWidth = this.$element.width(); - - // Move original input out of the way - var hidingPosition = $('body').css('direction') === 'rtl' ? 'right' : 'left', - originalStyles = { position: this.$element.css('position') }; - - originalStyles[hidingPosition] = this.$element.css(hidingPosition); - - this.$element - .data('original-styles', originalStyles) - .data('original-tabindex', this.$element.prop('tabindex')) - .css('position', 'absolute') - .css(hidingPosition, '-10000px') - .prop('tabindex', -1); - - // Create a wrapper - this.$wrapper = $('
    '); - - if (this.$element.hasClass('input-lg')) this.$wrapper.addClass('input-lg'); - if (this.$element.hasClass('input-sm')) this.$wrapper.addClass('input-sm'); - if (this.textDirection === 'rtl') this.$wrapper.addClass('rtl'); - - // Create a new input - var id = this.$element.prop('id') || new Date().getTime() + '' + Math.floor((1 + Math.random()) * 100); - this.$input = $('') - .appendTo(this.$wrapper) - .prop('placeholder', this.$element.prop('placeholder')) - .prop('id', id + '-tokenfield') - .prop('tabindex', this.$element.data('original-tabindex')); - - // Re-route original input label to new input - var $label = $('label[for="' + this.$element.prop('id') + '"]'); - if ($label.length) { - $label.prop('for', this.$input.prop('id')); - } - - // Set up a copy helper to handle copy & paste - this.$copyHelper = $('').css('position', 'absolute').css(hidingPosition, '-10000px').prop('tabindex', -1).prependTo(this.$wrapper); - - // Set wrapper width - if (elStyleWidth) { - this.$wrapper.css('width', elStyleWidth); - } else if (this.$element.parents('.form-inline').length) { - // If input is inside inline-form with no width set, set fixed width - this.$wrapper.width(elWidth); - } - - // Set tokenfield disabled, if original or fieldset input is disabled - if (this.$element.prop('disabled') || this.$element.parents('fieldset[disabled]').length) { - this.disable(); - } - - // Set tokenfield readonly, if original input is readonly - if (this.$element.prop('readonly')) { - this.readonly(); - } - - // Set up mirror for input auto-sizing - this.$mirror = $(''); - this.$input.css('min-width', this.options.minWidth + 'px'); - - // Insert tokenfield to HTML - this.$wrapper.insertBefore(this.$element); - this.$element.prependTo(this.$wrapper); - - // Append mirror to tokenfield wrapper - this.$mirror.appendTo(this.$wrapper); - - // Calculate inner input width - this.update(); - - // Create initial tokens, if any - this.setTokens(this.options.tokens, false, ! this.$element.val() && this.options.tokens); - - // Start listening to events - this.listen(); - - // Initialize autocomplete, if necessary - if (!$.isEmptyObject(this.options.autocomplete)) { - var side = this.textDirection === 'rtl' ? 'right' : 'left', - autocompleteOptions = $.extend({ - minLength: this.options.showAutocompleteOnFocus ? 0 : null, - position: { my: side + ' top', at: side + ' bottom', of: this.$wrapper } - }, this.options.autocomplete); - - this.$input.autocomplete(autocompleteOptions); - } - - // Initialize typeahead, if necessary - if (!$.isEmptyObject(this.options.typeahead)) { - - var typeaheadOptions = this.options.typeahead, - defaults = { - minLength: this.options.showAutocompleteOnFocus ? 0 : null - }, - args = $.isArray(typeaheadOptions) ? typeaheadOptions : [typeaheadOptions, typeaheadOptions]; - - args[0] = $.extend({}, defaults, args[0]); - - this.$input.typeahead.apply(this.$input, args); - this.typeahead = true; - } - }; - - Tokenfield.prototype = { - - constructor: Tokenfield, - - createToken: function (attrs, triggerChange) { - var _self = this; - - if (typeof attrs === 'string') { - attrs = { value: attrs, label: attrs }; - } else { - // Copy objects to prevent contamination of data sources. - attrs = $.extend({}, attrs); - } - - if (typeof triggerChange === 'undefined') { - triggerChange = true; - } - - // Normalize label and value - attrs.value = $.trim(attrs.value.toString()); - attrs.label = attrs.label && attrs.label.length ? $.trim(attrs.label) : attrs.value; - - // Bail out if has no value or label, or label is too short - if (!attrs.value.length || !attrs.label.length || attrs.label.length < this.options.minLength) return; - - // Bail out if maximum number of tokens is reached - if (this.options.limit && this.getTokens().length >= this.options.limit) return; - - // Allow changing token data before creating it - var createEvent = $.Event('tokenfield:createtoken', { attrs: attrs }); - this.$element.trigger(createEvent); - - // Bail out if there if attributes are empty or event was defaultPrevented - if (!createEvent.attrs || createEvent.isDefaultPrevented()) return; - - var $token = $('
    ') - .append('') - .append('×') - .data('attrs', attrs); - - // Insert token into HTML - if (this.$input.hasClass('tt-input')) { - // If the input has typeahead enabled, insert token before it's parent - this.$input.parent().before($token); - } else { - this.$input.before($token); - } - - // Temporarily set input width to minimum - this.$input.css('width', this.options.minWidth + 'px'); - - var $tokenLabel = $token.find('.token-label'), - $closeButton = $token.find('.close'); - - // Todo: Determine maximum possible token label width - // Previous method does not work in FF - // Refactor this! - if (!this.maxTokenWidth) { - this.maxTokenWidth = this.$wrapper.width() - $closeButton.width() - 10; - } - - $tokenLabel.css('max-width', this.maxTokenWidth); - - if (this.options.html) { - $tokenLabel.html(attrs.label); - } else { - $tokenLabel.text(attrs.label); - } - - // Listen to events on token - $token - .on('mousedown', function (e) { - if (_self._disabled || _self._readonly) return false; - _self.preventDeactivation = true; - }) - .on('click', function (e) { - if (_self._disabled || _self._readonly) return false; - _self.preventDeactivation = false; - - if (e.ctrlKey || e.metaKey) { - e.preventDefault(); - return _self.toggle($token); - } - - _self.activate($token, e.shiftKey, e.shiftKey); - }) - .on('dblclick', function (e) { - if (_self._disabled || _self._readonly || !_self.options.allowEditing) return false; - _self.edit($token); - }); - - $closeButton - .on('click', $.proxy(this.remove, this)); - - // Trigger createdtoken event on the original field - // indicating that the token is now in the DOM - this.$element.trigger($.Event('tokenfield:createdtoken', { - attrs: attrs, - relatedTarget: $token.get(0) - })); - - // Trigger change event on the original field - if (triggerChange) { - this.$element.val(this.getTokensList()).trigger($.Event('change', { initiator: 'tokenfield' })); - } - - // Update tokenfield dimensions - setTimeout(function () { - _self.update(); - }, 0); - - // Return original element - return this.$element.get(0); - }, - - setTokens: function (tokens, add, triggerChange) { - if (!add) this.$wrapper.find('.token').remove(); - - if (!tokens) return; - - if (typeof triggerChange === 'undefined') { - triggerChange = true; - } - - if (typeof tokens === 'string') { - if (this._delimiters.length) { - // Split based on delimiters - tokens = tokens.split(new RegExp('[' + this._delimiters.join('') + ']')); - } else { - tokens = [tokens]; - } - } - - var _self = this; - $.each(tokens, function (i, attrs) { - _self.createToken(attrs, triggerChange); - }); - - return this.$element.get(0); - }, - - getTokenData: function ($token) { - var data = $token.map(function () { - var $token = $(this); - return $token.data('attrs'); - }).get(); - - if (data.length === 1) { - data = data[0]; - } - - return data; - }, - - getTokens: function (active) { - var self = this, - tokens = [], - activeClass = active ? '.active' : ''; // get active tokens only - - this.$wrapper.find('.token' + activeClass).each(function () { - tokens.push(self.getTokenData($(this))); - }); - return tokens; - }, - - getTokensList: function (delimiter, beautify, active) { - delimiter = delimiter || this._firstDelimiter; - beautify = (typeof beautify !== 'undefined' && beautify !== null) ? beautify : this.options.beautify; - - var separator = delimiter + (beautify && delimiter !== ' ' ? ' ' : ''); - return $.map(this.getTokens(active), function (token) { - return token.value; - }).join(separator); - }, - - getInput: function () { - return this.$input.val(); - }, - - setInput: function (val) { - if (this.$input.hasClass('tt-input')) { - // Typeahead acts weird when simply setting input value to empty, - // so we set the query to empty instead - this.$input.typeahead('val', val); - } else { - this.$input.val(val); - } - }, - - listen: function () { - var _self = this; - this.$element - .on('change.tokenfield', $.proxy(this.change, this)); - - this.$wrapper - .on('mousedown', $.proxy(this.focusInput, this)); - - this.$input - .on('focus', $.proxy(this.focus, this)) - .on('blur', $.proxy(this.blur, this)) - .on('paste', $.proxy(this.paste, this)) - .on('keydown', $.proxy(this.keydown, this)) - .on('keypress', $.proxy(this.keypress, this)) - .on('keyup', $.proxy(this.keyup, this)); - - this.$copyHelper - .on('focus', $.proxy(this.focus, this)) - .on('blur', $.proxy(this.blur, this)) - .on('keydown', $.proxy(this.keydown, this)) - .on('keyup', $.proxy(this.keyup, this)); - - // Secondary listeners for input width calculation - this.$input - .on('keypress', $.proxy(this.update, this)) - .on('keyup', $.proxy(this.update, this)); - - this.$input - .on('autocompletecreate', function () { - // Set minimum autocomplete menu width - var $_menuElement = $(this).data('ui-autocomplete').menu.element, - minWidth = _self.$wrapper.outerWidth() - - parseInt($_menuElement.css('border-left-width'), 10) - - parseInt($_menuElement.css('border-right-width'), 10); - - $_menuElement.css('min-width', minWidth + 'px'); - }) - .on('autocompleteselect', function (e, ui) { - if (_self.createToken(ui.item)) { - _self.$input.val(''); - if (_self.$input.data('edit')) { - _self.unedit(true); - } - } - return false; - }) - .on('typeahead:selected typeahead:autocompleted', function (e, datum, dataset) { - // Create token - if (_self.createToken(datum)) { - _self.$input.typeahead('val', ''); - if (_self.$input.data('edit')) { - _self.unedit(true); - } - } - }); - - // Listen to window resize - $(window).on('resize', $.proxy(this.update, this)); - }, - - keydown: function (e) { - - if (!this.focused) return; - - var _self = this; - - switch (e.keyCode) { - case 8: // backspace - if (!this.$input.is(document.activeElement)) break; - this.lastInputValue = this.$input.val(); - break; - - case 37: // left arrow - leftRight(this.textDirection === 'rtl' ? 'next' : 'prev'); - break; - - case 38: // up arrow - upDown('prev'); - break; - - case 39: // right arrow - leftRight(this.textDirection === 'rtl' ? 'prev' : 'next'); - break; - - case 40: // down arrow - upDown('next'); - break; - - case 65: // a (to handle ctrl + a) - if (this.$input.val().length > 0 || !(e.ctrlKey || e.metaKey)) break; - this.activateAll(); - e.preventDefault(); - break; - - case 9: // tab - case 13: // enter - - // We will handle creating tokens from autocomplete in autocomplete events - if (this.$input.data('ui-autocomplete') && this.$input.data('ui-autocomplete').menu.element.find('li:has(a.ui-state-focus), li.ui-state-focus').length) break; - - // We will handle creating tokens from typeahead in typeahead events - if (this.$input.hasClass('tt-input') && this.$wrapper.find('.tt-cursor').length) break; - if (this.$input.hasClass('tt-input') && this.$wrapper.find('.tt-hint').val() && this.$wrapper.find('.tt-hint').val().length) break; - - // Create token - if (this.$input.is(document.activeElement) && this.$input.val().length || this.$input.data('edit')) { - return this.createTokensFromInput(e, this.$input.data('edit')); - } else if (this.$input.is(document.activeElement) && (e.keyCode === 13)) { - e.preventDefault(); - this.$element.trigger('tokenfield:next'); - } - - // Edit token - if (e.keyCode === 13) { - if (!this.$copyHelper.is(document.activeElement) || this.$wrapper.find('.token.active').length !== 1) break; - if (!_self.options.allowEditing) break; - this.edit(this.$wrapper.find('.token.active')); - } - - // no default - } - - function leftRight(direction) { - if (_self.$input.is(document.activeElement)) { - if (_self.$input.val().length > 0) return; - - direction += 'All'; - var $token = _self.$input.hasClass('tt-input') ? _self.$input.parent()[direction]('.token:first') : _self.$input[direction]('.token:first'); - if (!$token.length) return; - - _self.preventInputFocus = true; - _self.preventDeactivation = true; - - _self.activate($token); - e.preventDefault(); - - } else { - _self[direction](e.shiftKey); - e.preventDefault(); - } - } - - function upDown(direction) { - if (!e.shiftKey) return; - - if (_self.$input.is(document.activeElement)) { - if (_self.$input.val().length > 0) return; - - var $token = _self.$input.hasClass('tt-input') ? _self.$input.parent()[direction + 'All']('.token:first') : _self.$input[direction + 'All']('.token:first'); - if (!$token.length) return; - - _self.activate($token); - } - - var opposite = direction === 'prev' ? 'next' : 'prev', - position = direction === 'prev' ? 'first' : 'last'; - - _self.$firstActiveToken[opposite + 'All']('.token').each(function () { - _self.deactivate($(this)); - }); - - _self.activate(_self.$wrapper.find('.token:' + position), true, true); - e.preventDefault(); - } - - this.lastKeyDown = e.keyCode; - }, - - keypress: function (e) { - - // Comma - if ($.inArray(e.which, this._triggerKeys) !== -1 && this.$input.is(document.activeElement)) { - var val = this.$input.val(), - quoting = /^"[^"]*$/.test(val); - if (quoting) return; - if (val) this.createTokensFromInput(e); - return false; - } - }, - - keyup: function (e) { - this.preventInputFocus = false; - - if (!this.focused) return; - - switch (e.keyCode) { - case 8: // backspace - if (this.$input.is(document.activeElement)) { - if (this.$input.val().length || this.lastInputValue.length && this.lastKeyDown === 8) break; - - this.preventDeactivation = true; - var $prevToken = this.$input.hasClass('tt-input') ? this.$input.parent().prevAll('.token:first') : this.$input.prevAll('.token:first'); - - if (!$prevToken.length) break; - - this.activate($prevToken); - } else { - this.remove(e); - } - break; - - case 46: // delete - this.remove(e, 'next'); - break; - - // no default - } - this.lastKeyUp = e.keyCode; - }, - - focus: function (e) { - this.focused = true; - this.$wrapper.addClass('focus'); - - if (this.$input.is(document.activeElement)) { - this.$wrapper.find('.active').removeClass('active'); - this.$firstActiveToken = null; - - if (this.options.showAutocompleteOnFocus) { - this.search(); - } - } - }, - - blur: function (e) { - this.focused = false; - this.$wrapper.removeClass('focus'); - - if (!this.preventDeactivation && !this.$element.is(document.activeElement)) { - this.$wrapper.find('.active').removeClass('active'); - this.$firstActiveToken = null; - } - - if (!this.preventCreateTokens && (this.$input.data('edit') && !this.$input.is(document.activeElement) || this.options.createTokensOnBlur)) { - this.createTokensFromInput(e); - } - - this.preventDeactivation = false; - this.preventCreateTokens = false; - }, - - paste: function (e) { - var _self = this; - - // Add tokens to existing ones - if (_self.options.allowPasting) { - setTimeout(function () { - _self.createTokensFromInput(e); - }, 1); - } - }, - - change: function (e) { - if (e.initiator === 'tokenfield') return; // Prevent loops - this.setTokens(this.$element.val()); - }, - - createTokensFromInput: function (e, focus) { - if (this.$input.val().length < this.options.minLength) return; // No input, simply return - - var tokensBefore = this.getTokensList(); - this.setTokens(this.$input.val(), true); - - if (tokensBefore === this.getTokensList() && this.$input.val().length) return false; // No tokens were added, do nothing (prevent form submit) - - this.setInput(''); - - if (this.$input.data('edit')) this.unedit(focus); - - return false; // Prevent form being submitted - }, - - next: function (add) { - if (add) { - var $firstActiveToken = this.$wrapper.find('.active:first'), - deactivate = $firstActiveToken && this.$firstActiveToken ? $firstActiveToken.index() < this.$firstActiveToken.index() : false; - - if (deactivate) return this.deactivate($firstActiveToken); - } - - var $lastActiveToken = this.$wrapper.find('.active:last'), - $nextToken = $lastActiveToken.nextAll('.token:first'); - - if (!$nextToken.length) { - this.$input.focus(); - return; - } - - this.activate($nextToken, add); - }, - - prev: function (add) { - - if (add) { - var $lastActiveToken = this.$wrapper.find('.active:last'), - deactivate = $lastActiveToken && this.$firstActiveToken ? $lastActiveToken.index() > this.$firstActiveToken.index() : false; - - if (deactivate) return this.deactivate($lastActiveToken); - } - - var $firstActiveToken = this.$wrapper.find('.active:first'), - $prevToken = $firstActiveToken.prevAll('.token:first'); - - if (!$prevToken.length) { - $prevToken = this.$wrapper.find('.token:first'); - } - - if (!$prevToken.length && !add) { - this.$input.focus(); - return; - } - - this.activate($prevToken, add); - }, - - activate: function ($token, add, multi, remember) { - - if (!$token) return; - - if (typeof remember === 'undefined') remember = true; - - if (multi) add = true; - - this.$copyHelper.focus(); - - if (!add) { - this.$wrapper.find('.active').removeClass('active'); - if (remember) { - this.$firstActiveToken = $token; - } else { - delete this.$firstActiveToken; - } - } - - if (multi && this.$firstActiveToken) { - // Determine first active token and the current tokens indicies - // Account for the 1 hidden textarea by subtracting 1 from both - var i = this.$firstActiveToken.index() - 2, - a = $token.index() - 2, - _self = this; - - this.$wrapper.find('.token').slice(Math.min(i, a) + 1, Math.max(i, a)).each(function () { - _self.activate($(this), true); - }); - } - - $token.addClass('active'); - this.$copyHelper.val(this.getTokensList(null, null, true)).select(); - }, - - activateAll: function () { - var _self = this; - - this.$wrapper.find('.token').each(function (i) { - _self.activate($(this), i !== 0, false, false); - }); - }, - - deactivate: function ($token) { - if (!$token) return; - - $token.removeClass('active'); - this.$copyHelper.val(this.getTokensList(null, null, true)).select(); - }, - - toggle: function ($token) { - if (!$token) return; - - $token.toggleClass('active'); - this.$copyHelper.val(this.getTokensList(null, null, true)).select(); - }, - - edit: function ($token) { - if (!$token) return; - - var attrs = $token.data('attrs'); - - // Allow changing input value before editing - var options = { attrs: attrs, relatedTarget: $token.get(0) }; - var editEvent = $.Event('tokenfield:edittoken', options); - this.$element.trigger(editEvent); - - // Edit event can be cancelled if default is prevented - if (editEvent.isDefaultPrevented()) return; - - $token.find('.token-label').text(attrs.value); - - var tokenWidth = $token.outerWidth(), - $_input = this.$input.hasClass('tt-input') ? this.$input.parent() : this.$input; - - $token.replaceWith($_input); - - this.preventCreateTokens = true; - - this.$input.val(attrs.value) - .select() - .data('edit', true) - .width(tokenWidth); - - this.update(); - - // Indicate that token is now being edited, and is replaced with an input field in the DOM - this.$element.trigger($.Event('tokenfield:editedtoken', options)); - }, - - unedit: function (focus) { - var $_input = this.$input.hasClass('tt-input') ? this.$input.parent() : this.$input; - $_input.appendTo(this.$wrapper); - - this.$input.data('edit', false); - this.$mirror.text(''); - - this.update(); - - // Because moving the input element around in DOM - // will cause it to lose focus, we provide an option - // to re-focus the input after appending it to the wrapper - if (focus) { - var _self = this; - setTimeout(function () { - _self.$input.focus(); - }, 1); - } - }, - - remove: function (e, direction) { - if (this.$input.is(document.activeElement) || this._disabled || this._readonly) return; - var firstToken, - $token = (e.type === 'click') ? $(e.target).closest('.token') : this.$wrapper.find('.token.active'); - - if (e.type !== 'click') { - if (!direction) direction = 'prev'; - this[direction](); - - // Was it the first token? - if (direction === 'prev') firstToken = $token.first().prevAll('.token:first').length === 0; - } - - // Prepare events and their options - var options = { attrs: this.getTokenData($token), relatedTarget: $token.get(0) }, - removeEvent = $.Event('tokenfield:removetoken', options); - - this.$element.trigger(removeEvent); - - // Remove event can be intercepted and cancelled - if (removeEvent.isDefaultPrevented()) return; - - var removedEvent = $.Event('tokenfield:removedtoken', options), - changeEvent = $.Event('change', { initiator: 'tokenfield' }); - - // Remove token from DOM - $token.remove(); - - // Trigger events - this.$element.val(this.getTokensList()).trigger(removedEvent).trigger(changeEvent); - - // Focus, when necessary: - // When there are no more tokens, or if this was the first token - // and it was removed with backspace or it was clicked on - if (!this.$wrapper.find('.token').length || e.type === 'click' || firstToken) this.$input.focus(); - - // Adjust input width - this.$input.css('width', this.options.minWidth + 'px'); - this.update(); - - // Cancel original event handlers - e.preventDefault(); - e.stopPropagation(); - }, - - /** - * Update tokenfield dimensions - */ - update: function (e) { - var value = this.$input.val(), - inputPaddingLeft = parseInt(this.$input.css('padding-left'), 10), - inputPaddingRight = parseInt(this.$input.css('padding-right'), 10), - inputPadding = inputPaddingLeft + inputPaddingRight; - - if (this.$input.data('edit')) { - - if (!value) { - value = this.$input.prop('placeholder'); - } - if (value === this.$mirror.text()) return; - - this.$mirror.text(value); - - var mirrorWidth = this.$mirror.width() + 10; - if (mirrorWidth > this.$wrapper.width()) { - return this.$input.width(this.$wrapper.width()); - } - - this.$input.width(mirrorWidth); - } else { - // temporary reset width to minimal value to get proper results - this.$input.width(this.options.minWidth); - - var w = (this.textDirection === 'rtl') - ? this.$input.offset().left + this.$input.outerWidth() - this.$wrapper.offset().left - parseInt(this.$wrapper.css('padding-left'), 10) - inputPadding - 1 - : this.$wrapper.offset().left + this.$wrapper.width() + parseInt(this.$wrapper.css('padding-left'), 10) - this.$input.offset().left - inputPadding; - // - // some usecases pre-render widget before attaching to DOM, - // dimensions returned by jquery will be NaN -> we default to 100% - // so placeholder won't be cut off. - if (isNaN(w)) { - this.$input.width('100%'); - } else { - this.$input.width(w); - } - } - }, - focusInput: function (e) { - if ($(e.target).closest('.token').length || $(e.target).closest('.token-input').length || $(e.target).closest('.tt-dropdown-menu').length) return; - // Focus only after the current call stack has cleared, - // otherwise has no effect. - // Reason: mousedown is too early - input will lose focus - // after mousedown. However, since the input may be moved - // in DOM, there may be no click or mouseup event triggered. - var _self = this; - setTimeout(function () { - _self.$input.focus(); - }, 0); - }, - search: function () { - if (this.$input.data('ui-autocomplete')) { - this.$input.autocomplete('search'); - } - }, - disable: function () { - this.setProperty('disabled', true); - }, - enable: function () { - this.setProperty('disabled', false); - }, - - readonly: function () { - this.setProperty('readonly', true); - }, - - writeable: function () { - this.setProperty('readonly', false); - }, - - setProperty: function (property, value) { - this['_' + property] = value; - this.$input.prop(property, value); - this.$element.prop(property, value); - this.$wrapper[ value ? 'addClass' : 'removeClass' ](property); - }, - - destroy: function () { - // Set field value - this.$element.val(this.getTokensList()); - // Restore styles and properties - this.$element.css(this.$element.data('original-styles')); - this.$element.prop('tabindex', this.$element.data('original-tabindex')); - - // Re-route tokenfield label to original input - var $label = $('label[for="' + this.$input.prop('id') + '"]'); - - if ($label.length) $label.prop('for', this.$element.prop('id')); - - // Move original element outside of tokenfield wrapper - this.$element.insertBefore(this.$wrapper); - - // Remove tokenfield-related events - this.$element.off('.tokenfield'); - - // Remove tokenfield-related data - this.$element.removeData('original-styles') - .removeData('original-tabindex') - .removeData('bs.tokenfield'); - - // Remove tokenfield from DOM - this.$wrapper.remove(); - this.$mirror.remove(); - - var $_element = this.$element; - - return $_element; - } - - }; - - - /* TOKENFIELD PLUGIN DEFINITION - * ======================== */ - - var old = $.fn.tokenfield; - - $.fn.tokenfield = function (option, param) { - var value, - args = []; - - Array.prototype.push.apply(args, arguments); - - var elements = this.each(function () { - var $this = $(this), - data = $this.data('bs.tokenfield'), - options = typeof option === 'object' && option; - - if (typeof option === 'string' && data && data[option]) { - args.shift(); - value = data[option].apply(data, args); - } else if (!data && typeof option !== 'string' && !param) { - $this.data('bs.tokenfield', (data = new Tokenfield(this, options))); - $this.trigger('tokenfield:initialize'); - } - }); - - return typeof value !== 'undefined' ? value : elements; - }; - - $.fn.tokenfield.defaults = { - minWidth: 60, - minLength: 0, - html: true, - allowEditing: true, - allowPasting: true, - limit: 0, - autocomplete: {}, - typeahead: {}, - showAutocompleteOnFocus: false, - createTokensOnBlur: false, - delimiter: ',', - beautify: true, - inputType: 'text' - }; - - $.fn.tokenfield.Constructor = Tokenfield; - - - /* TOKENFIELD NO CONFLICT - * ================== */ - - $.fn.tokenfield.noConflict = function () { - $.fn.tokenfield = old; - return this; - }; - - return Tokenfield; - -})); diff -Nru pat-0.12.1/debian/missing-sources/web/res/js/jquery.js pat-0.13.1/debian/missing-sources/web/res/js/jquery.js --- pat-0.12.1/debian/missing-sources/web/res/js/jquery.js 2022-06-12 02:30:38.000000000 +0000 +++ pat-0.13.1/debian/missing-sources/web/res/js/jquery.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,10881 +0,0 @@ -/*! - * jQuery JavaScript Library v3.6.0 - * https://jquery.com/ - * - * Includes Sizzle.js - * https://sizzlejs.com/ - * - * Copyright OpenJS Foundation and other contributors - * Released under the MIT license - * https://jquery.org/license - * - * Date: 2021-03-02T17:08Z - */ -( function( global, factory ) { - - "use strict"; - - if ( typeof module === "object" && typeof module.exports === "object" ) { - - // For CommonJS and CommonJS-like environments where a proper `window` - // is present, execute the factory and get jQuery. - // For environments that do not have a `window` with a `document` - // (such as Node.js), expose a factory as module.exports. - // This accentuates the need for the creation of a real `window`. - // e.g. var jQuery = require("jquery")(window); - // See ticket #14549 for more info. - module.exports = global.document ? - factory( global, true ) : - function( w ) { - if ( !w.document ) { - throw new Error( "jQuery requires a window with a document" ); - } - return factory( w ); - }; - } else { - factory( global ); - } - -// Pass this if window is not defined yet -} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { - -// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 -// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode -// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common -// enough that all such attempts are guarded in a try block. -"use strict"; - -var arr = []; - -var getProto = Object.getPrototypeOf; - -var slice = arr.slice; - -var flat = arr.flat ? function( array ) { - return arr.flat.call( array ); -} : function( array ) { - return arr.concat.apply( [], array ); -}; - - -var push = arr.push; - -var indexOf = arr.indexOf; - -var class2type = {}; - -var toString = class2type.toString; - -var hasOwn = class2type.hasOwnProperty; - -var fnToString = hasOwn.toString; - -var ObjectFunctionString = fnToString.call( Object ); - -var support = {}; - -var isFunction = function isFunction( obj ) { - - // Support: Chrome <=57, Firefox <=52 - // In some browsers, typeof returns "function" for HTML elements - // (i.e., `typeof document.createElement( "object" ) === "function"`). - // We don't want to classify *any* DOM node as a function. - // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5 - // Plus for old WebKit, typeof returns "function" for HTML collections - // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756) - return typeof obj === "function" && typeof obj.nodeType !== "number" && - typeof obj.item !== "function"; - }; - - -var isWindow = function isWindow( obj ) { - return obj != null && obj === obj.window; - }; - - -var document = window.document; - - - - var preservedScriptAttributes = { - type: true, - src: true, - nonce: true, - noModule: true - }; - - function DOMEval( code, node, doc ) { - doc = doc || document; - - var i, val, - script = doc.createElement( "script" ); - - script.text = code; - if ( node ) { - for ( i in preservedScriptAttributes ) { - - // Support: Firefox 64+, Edge 18+ - // Some browsers don't support the "nonce" property on scripts. - // On the other hand, just using `getAttribute` is not enough as - // the `nonce` attribute is reset to an empty string whenever it - // becomes browsing-context connected. - // See https://github.com/whatwg/html/issues/2369 - // See https://html.spec.whatwg.org/#nonce-attributes - // The `node.getAttribute` check was added for the sake of - // `jQuery.globalEval` so that it can fake a nonce-containing node - // via an object. - val = node[ i ] || node.getAttribute && node.getAttribute( i ); - if ( val ) { - script.setAttribute( i, val ); - } - } - } - doc.head.appendChild( script ).parentNode.removeChild( script ); - } - - -function toType( obj ) { - if ( obj == null ) { - return obj + ""; - } - - // Support: Android <=2.3 only (functionish RegExp) - return typeof obj === "object" || typeof obj === "function" ? - class2type[ toString.call( obj ) ] || "object" : - typeof obj; -} -/* global Symbol */ -// Defining this global in .eslintrc.json would create a danger of using the global -// unguarded in another place, it seems safer to define global only for this module - - - -var - version = "3.6.0", - - // Define a local copy of jQuery - jQuery = function( selector, context ) { - - // The jQuery object is actually just the init constructor 'enhanced' - // Need init if jQuery is called (just allow error to be thrown if not included) - return new jQuery.fn.init( selector, context ); - }; - -jQuery.fn = jQuery.prototype = { - - // The current version of jQuery being used - jquery: version, - - constructor: jQuery, - - // The default length of a jQuery object is 0 - length: 0, - - toArray: function() { - return slice.call( this ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - - // Return all the elements in a clean array - if ( num == null ) { - return slice.call( this ); - } - - // Return just the one element from the set - return num < 0 ? this[ num + this.length ] : this[ num ]; - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems ) { - - // Build a new jQuery matched element set - var ret = jQuery.merge( this.constructor(), elems ); - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - each: function( callback ) { - return jQuery.each( this, callback ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map( this, function( elem, i ) { - return callback.call( elem, i, elem ); - } ) ); - }, - - slice: function() { - return this.pushStack( slice.apply( this, arguments ) ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - even: function() { - return this.pushStack( jQuery.grep( this, function( _elem, i ) { - return ( i + 1 ) % 2; - } ) ); - }, - - odd: function() { - return this.pushStack( jQuery.grep( this, function( _elem, i ) { - return i % 2; - } ) ); - }, - - eq: function( i ) { - var len = this.length, - j = +i + ( i < 0 ? len : 0 ); - return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); - }, - - end: function() { - return this.prevObject || this.constructor(); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: push, - sort: arr.sort, - splice: arr.splice -}; - -jQuery.extend = jQuery.fn.extend = function() { - var options, name, src, copy, copyIsArray, clone, - target = arguments[ 0 ] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - - // Skip the boolean and the target - target = arguments[ i ] || {}; - i++; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !isFunction( target ) ) { - target = {}; - } - - // Extend jQuery itself if only one argument is passed - if ( i === length ) { - target = this; - i--; - } - - for ( ; i < length; i++ ) { - - // Only deal with non-null/undefined values - if ( ( options = arguments[ i ] ) != null ) { - - // Extend the base object - for ( name in options ) { - copy = options[ name ]; - - // Prevent Object.prototype pollution - // Prevent never-ending loop - if ( name === "__proto__" || target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject( copy ) || - ( copyIsArray = Array.isArray( copy ) ) ) ) { - src = target[ name ]; - - // Ensure proper type for the source value - if ( copyIsArray && !Array.isArray( src ) ) { - clone = []; - } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) { - clone = {}; - } else { - clone = src; - } - copyIsArray = false; - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend( { - - // Unique for each copy of jQuery on the page - expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), - - // Assume jQuery is ready without the ready module - isReady: true, - - error: function( msg ) { - throw new Error( msg ); - }, - - noop: function() {}, - - isPlainObject: function( obj ) { - var proto, Ctor; - - // Detect obvious negatives - // Use toString instead of jQuery.type to catch host objects - if ( !obj || toString.call( obj ) !== "[object Object]" ) { - return false; - } - - proto = getProto( obj ); - - // Objects with no prototype (e.g., `Object.create( null )`) are plain - if ( !proto ) { - return true; - } - - // Objects with prototype are plain iff they were constructed by a global Object function - Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; - return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; - }, - - isEmptyObject: function( obj ) { - var name; - - for ( name in obj ) { - return false; - } - return true; - }, - - // Evaluates a script in a provided context; falls back to the global one - // if not specified. - globalEval: function( code, options, doc ) { - DOMEval( code, { nonce: options && options.nonce }, doc ); - }, - - each: function( obj, callback ) { - var length, i = 0; - - if ( isArrayLike( obj ) ) { - length = obj.length; - for ( ; i < length; i++ ) { - if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { - break; - } - } - } else { - for ( i in obj ) { - if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { - break; - } - } - } - - return obj; - }, - - // results is for internal usage only - makeArray: function( arr, results ) { - var ret = results || []; - - if ( arr != null ) { - if ( isArrayLike( Object( arr ) ) ) { - jQuery.merge( ret, - typeof arr === "string" ? - [ arr ] : arr - ); - } else { - push.call( ret, arr ); - } - } - - return ret; - }, - - inArray: function( elem, arr, i ) { - return arr == null ? -1 : indexOf.call( arr, elem, i ); - }, - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - merge: function( first, second ) { - var len = +second.length, - j = 0, - i = first.length; - - for ( ; j < len; j++ ) { - first[ i++ ] = second[ j ]; - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, invert ) { - var callbackInverse, - matches = [], - i = 0, - length = elems.length, - callbackExpect = !invert; - - // Go through the array, only saving the items - // that pass the validator function - for ( ; i < length; i++ ) { - callbackInverse = !callback( elems[ i ], i ); - if ( callbackInverse !== callbackExpect ) { - matches.push( elems[ i ] ); - } - } - - return matches; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var length, value, - i = 0, - ret = []; - - // Go through the array, translating each of the items to their new values - if ( isArrayLike( elems ) ) { - length = elems.length; - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret.push( value ); - } - } - - // Go through every key on the object, - } else { - for ( i in elems ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret.push( value ); - } - } - } - - // Flatten any nested arrays - return flat( ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // jQuery.support is not used in Core but other projects attach their - // properties to it so it needs to exist. - support: support -} ); - -if ( typeof Symbol === "function" ) { - jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; -} - -// Populate the class2type map -jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), - function( _i, name ) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); - } ); - -function isArrayLike( obj ) { - - // Support: real iOS 8.2 only (not reproducible in simulator) - // `in` check used to prevent JIT error (gh-2145) - // hasOwn isn't used here due to false negatives - // regarding Nodelist length in IE - var length = !!obj && "length" in obj && obj.length, - type = toType( obj ); - - if ( isFunction( obj ) || isWindow( obj ) ) { - return false; - } - - return type === "array" || length === 0 || - typeof length === "number" && length > 0 && ( length - 1 ) in obj; -} -var Sizzle = -/*! - * Sizzle CSS Selector Engine v2.3.6 - * https://sizzlejs.com/ - * - * Copyright JS Foundation and other contributors - * Released under the MIT license - * https://js.foundation/ - * - * Date: 2021-02-16 - */ -( function( window ) { -var i, - support, - Expr, - getText, - isXML, - tokenize, - compile, - select, - outermostContext, - sortInput, - hasDuplicate, - - // Local document vars - setDocument, - document, - docElem, - documentIsHTML, - rbuggyQSA, - rbuggyMatches, - matches, - contains, - - // Instance-specific data - expando = "sizzle" + 1 * new Date(), - preferredDoc = window.document, - dirruns = 0, - done = 0, - classCache = createCache(), - tokenCache = createCache(), - compilerCache = createCache(), - nonnativeSelectorCache = createCache(), - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - } - return 0; - }, - - // Instance methods - hasOwn = ( {} ).hasOwnProperty, - arr = [], - pop = arr.pop, - pushNative = arr.push, - push = arr.push, - slice = arr.slice, - - // Use a stripped-down indexOf as it's faster than native - // https://jsperf.com/thor-indexof-vs-for/5 - indexOf = function( list, elem ) { - var i = 0, - len = list.length; - for ( ; i < len; i++ ) { - if ( list[ i ] === elem ) { - return i; - } - } - return -1; - }, - - booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" + - "ismap|loop|multiple|open|readonly|required|scoped", - - // Regular expressions - - // http://www.w3.org/TR/css3-selectors/#whitespace - whitespace = "[\\x20\\t\\r\\n\\f]", - - // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram - identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + - "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", - - // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors - attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + - - // Operator (capture 2) - "*([*^$|!~]?=)" + whitespace + - - // "Attribute values must be CSS identifiers [capture 5] - // or strings [capture 3 or capture 4]" - "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + - whitespace + "*\\]", - - pseudos = ":(" + identifier + ")(?:\\((" + - - // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: - // 1. quoted (capture 3; capture 4 or capture 5) - "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + - - // 2. simple (capture 6) - "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + - - // 3. anything else (capture 2) - ".*" + - ")\\)|)", - - // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter - rwhitespace = new RegExp( whitespace + "+", "g" ), - rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + - whitespace + "+$", "g" ), - - rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), - rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + - "*" ), - rdescend = new RegExp( whitespace + "|>" ), - - rpseudo = new RegExp( pseudos ), - ridentifier = new RegExp( "^" + identifier + "$" ), - - matchExpr = { - "ID": new RegExp( "^#(" + identifier + ")" ), - "CLASS": new RegExp( "^\\.(" + identifier + ")" ), - "TAG": new RegExp( "^(" + identifier + "|[*])" ), - "ATTR": new RegExp( "^" + attributes ), - "PSEUDO": new RegExp( "^" + pseudos ), - "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + - whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + - whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), - "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), - - // For use in libraries implementing .is() - // We use this for POS matching in `select` - "needsContext": new RegExp( "^" + whitespace + - "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + - "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) - }, - - rhtml = /HTML$/i, - rinputs = /^(?:input|select|textarea|button)$/i, - rheader = /^h\d$/i, - - rnative = /^[^{]+\{\s*\[native \w/, - - // Easily-parseable/retrievable ID or TAG or CLASS selectors - rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, - - rsibling = /[+~]/, - - // CSS escapes - // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters - runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g" ), - funescape = function( escape, nonHex ) { - var high = "0x" + escape.slice( 1 ) - 0x10000; - - return nonHex ? - - // Strip the backslash prefix from a non-hex escape sequence - nonHex : - - // Replace a hexadecimal escape sequence with the encoded Unicode code point - // Support: IE <=11+ - // For values outside the Basic Multilingual Plane (BMP), manually construct a - // surrogate pair - high < 0 ? - String.fromCharCode( high + 0x10000 ) : - String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); - }, - - // CSS string/identifier serialization - // https://drafts.csswg.org/cssom/#common-serializing-idioms - rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, - fcssescape = function( ch, asCodePoint ) { - if ( asCodePoint ) { - - // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER - if ( ch === "\0" ) { - return "\uFFFD"; - } - - // Control characters and (dependent upon position) numbers get escaped as code points - return ch.slice( 0, -1 ) + "\\" + - ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; - } - - // Other potentially-special ASCII characters get backslash-escaped - return "\\" + ch; - }, - - // Used for iframes - // See setDocument() - // Removing the function wrapper causes a "Permission Denied" - // error in IE - unloadHandler = function() { - setDocument(); - }, - - inDisabledFieldset = addCombinator( - function( elem ) { - return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset"; - }, - { dir: "parentNode", next: "legend" } - ); - -// Optimize for push.apply( _, NodeList ) -try { - push.apply( - ( arr = slice.call( preferredDoc.childNodes ) ), - preferredDoc.childNodes - ); - - // Support: Android<4.0 - // Detect silently failing push.apply - // eslint-disable-next-line no-unused-expressions - arr[ preferredDoc.childNodes.length ].nodeType; -} catch ( e ) { - push = { apply: arr.length ? - - // Leverage slice if possible - function( target, els ) { - pushNative.apply( target, slice.call( els ) ); - } : - - // Support: IE<9 - // Otherwise append directly - function( target, els ) { - var j = target.length, - i = 0; - - // Can't trust NodeList.length - while ( ( target[ j++ ] = els[ i++ ] ) ) {} - target.length = j - 1; - } - }; -} - -function Sizzle( selector, context, results, seed ) { - var m, i, elem, nid, match, groups, newSelector, - newContext = context && context.ownerDocument, - - // nodeType defaults to 9, since context defaults to document - nodeType = context ? context.nodeType : 9; - - results = results || []; - - // Return early from calls with invalid selector or context - if ( typeof selector !== "string" || !selector || - nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { - - return results; - } - - // Try to shortcut find operations (as opposed to filters) in HTML documents - if ( !seed ) { - setDocument( context ); - context = context || document; - - if ( documentIsHTML ) { - - // If the selector is sufficiently simple, try using a "get*By*" DOM method - // (excepting DocumentFragment context, where the methods don't exist) - if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) { - - // ID selector - if ( ( m = match[ 1 ] ) ) { - - // Document context - if ( nodeType === 9 ) { - if ( ( elem = context.getElementById( m ) ) ) { - - // Support: IE, Opera, Webkit - // TODO: identify versions - // getElementById can match elements by name instead of ID - if ( elem.id === m ) { - results.push( elem ); - return results; - } - } else { - return results; - } - - // Element context - } else { - - // Support: IE, Opera, Webkit - // TODO: identify versions - // getElementById can match elements by name instead of ID - if ( newContext && ( elem = newContext.getElementById( m ) ) && - contains( context, elem ) && - elem.id === m ) { - - results.push( elem ); - return results; - } - } - - // Type selector - } else if ( match[ 2 ] ) { - push.apply( results, context.getElementsByTagName( selector ) ); - return results; - - // Class selector - } else if ( ( m = match[ 3 ] ) && support.getElementsByClassName && - context.getElementsByClassName ) { - - push.apply( results, context.getElementsByClassName( m ) ); - return results; - } - } - - // Take advantage of querySelectorAll - if ( support.qsa && - !nonnativeSelectorCache[ selector + " " ] && - ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) && - - // Support: IE 8 only - // Exclude object elements - ( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) { - - newSelector = selector; - newContext = context; - - // qSA considers elements outside a scoping root when evaluating child or - // descendant combinators, which is not what we want. - // In such cases, we work around the behavior by prefixing every selector in the - // list with an ID selector referencing the scope context. - // The technique has to be used as well when a leading combinator is used - // as such selectors are not recognized by querySelectorAll. - // Thanks to Andrew Dupont for this technique. - if ( nodeType === 1 && - ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) { - - // Expand context for sibling selectors - newContext = rsibling.test( selector ) && testContext( context.parentNode ) || - context; - - // We can use :scope instead of the ID hack if the browser - // supports it & if we're not changing the context. - if ( newContext !== context || !support.scope ) { - - // Capture the context ID, setting it first if necessary - if ( ( nid = context.getAttribute( "id" ) ) ) { - nid = nid.replace( rcssescape, fcssescape ); - } else { - context.setAttribute( "id", ( nid = expando ) ); - } - } - - // Prefix every selector in the list - groups = tokenize( selector ); - i = groups.length; - while ( i-- ) { - groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " + - toSelector( groups[ i ] ); - } - newSelector = groups.join( "," ); - } - - try { - push.apply( results, - newContext.querySelectorAll( newSelector ) - ); - return results; - } catch ( qsaError ) { - nonnativeSelectorCache( selector, true ); - } finally { - if ( nid === expando ) { - context.removeAttribute( "id" ); - } - } - } - } - } - - // All others - return select( selector.replace( rtrim, "$1" ), context, results, seed ); -} - -/** - * Create key-value caches of limited size - * @returns {function(string, object)} Returns the Object data after storing it on itself with - * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) - * deleting the oldest entry - */ -function createCache() { - var keys = []; - - function cache( key, value ) { - - // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) - if ( keys.push( key + " " ) > Expr.cacheLength ) { - - // Only keep the most recent entries - delete cache[ keys.shift() ]; - } - return ( cache[ key + " " ] = value ); - } - return cache; -} - -/** - * Mark a function for special use by Sizzle - * @param {Function} fn The function to mark - */ -function markFunction( fn ) { - fn[ expando ] = true; - return fn; -} - -/** - * Support testing using an element - * @param {Function} fn Passed the created element and returns a boolean result - */ -function assert( fn ) { - var el = document.createElement( "fieldset" ); - - try { - return !!fn( el ); - } catch ( e ) { - return false; - } finally { - - // Remove from its parent by default - if ( el.parentNode ) { - el.parentNode.removeChild( el ); - } - - // release memory in IE - el = null; - } -} - -/** - * Adds the same handler for all of the specified attrs - * @param {String} attrs Pipe-separated list of attributes - * @param {Function} handler The method that will be applied - */ -function addHandle( attrs, handler ) { - var arr = attrs.split( "|" ), - i = arr.length; - - while ( i-- ) { - Expr.attrHandle[ arr[ i ] ] = handler; - } -} - -/** - * Checks document order of two siblings - * @param {Element} a - * @param {Element} b - * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b - */ -function siblingCheck( a, b ) { - var cur = b && a, - diff = cur && a.nodeType === 1 && b.nodeType === 1 && - a.sourceIndex - b.sourceIndex; - - // Use IE sourceIndex if available on both nodes - if ( diff ) { - return diff; - } - - // Check if b follows a - if ( cur ) { - while ( ( cur = cur.nextSibling ) ) { - if ( cur === b ) { - return -1; - } - } - } - - return a ? 1 : -1; -} - -/** - * Returns a function to use in pseudos for input types - * @param {String} type - */ -function createInputPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for buttons - * @param {String} type - */ -function createButtonPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return ( name === "input" || name === "button" ) && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for :enabled/:disabled - * @param {Boolean} disabled true for :disabled; false for :enabled - */ -function createDisabledPseudo( disabled ) { - - // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable - return function( elem ) { - - // Only certain elements can match :enabled or :disabled - // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled - // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled - if ( "form" in elem ) { - - // Check for inherited disabledness on relevant non-disabled elements: - // * listed form-associated elements in a disabled fieldset - // https://html.spec.whatwg.org/multipage/forms.html#category-listed - // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled - // * option elements in a disabled optgroup - // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled - // All such elements have a "form" property. - if ( elem.parentNode && elem.disabled === false ) { - - // Option elements defer to a parent optgroup if present - if ( "label" in elem ) { - if ( "label" in elem.parentNode ) { - return elem.parentNode.disabled === disabled; - } else { - return elem.disabled === disabled; - } - } - - // Support: IE 6 - 11 - // Use the isDisabled shortcut property to check for disabled fieldset ancestors - return elem.isDisabled === disabled || - - // Where there is no isDisabled, check manually - /* jshint -W018 */ - elem.isDisabled !== !disabled && - inDisabledFieldset( elem ) === disabled; - } - - return elem.disabled === disabled; - - // Try to winnow out elements that can't be disabled before trusting the disabled property. - // Some victims get caught in our net (label, legend, menu, track), but it shouldn't - // even exist on them, let alone have a boolean value. - } else if ( "label" in elem ) { - return elem.disabled === disabled; - } - - // Remaining elements are neither :enabled nor :disabled - return false; - }; -} - -/** - * Returns a function to use in pseudos for positionals - * @param {Function} fn - */ -function createPositionalPseudo( fn ) { - return markFunction( function( argument ) { - argument = +argument; - return markFunction( function( seed, matches ) { - var j, - matchIndexes = fn( [], seed.length, argument ), - i = matchIndexes.length; - - // Match elements found at the specified indexes - while ( i-- ) { - if ( seed[ ( j = matchIndexes[ i ] ) ] ) { - seed[ j ] = !( matches[ j ] = seed[ j ] ); - } - } - } ); - } ); -} - -/** - * Checks a node for validity as a Sizzle context - * @param {Element|Object=} context - * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value - */ -function testContext( context ) { - return context && typeof context.getElementsByTagName !== "undefined" && context; -} - -// Expose support vars for convenience -support = Sizzle.support = {}; - -/** - * Detects XML nodes - * @param {Element|Object} elem An element or a document - * @returns {Boolean} True iff elem is a non-HTML XML node - */ -isXML = Sizzle.isXML = function( elem ) { - var namespace = elem && elem.namespaceURI, - docElem = elem && ( elem.ownerDocument || elem ).documentElement; - - // Support: IE <=8 - // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes - // https://bugs.jquery.com/ticket/4833 - return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" ); -}; - -/** - * Sets document-related variables once based on the current document - * @param {Element|Object} [doc] An element or document object to use to set the document - * @returns {Object} Returns the current document - */ -setDocument = Sizzle.setDocument = function( node ) { - var hasCompare, subWindow, - doc = node ? node.ownerDocument || node : preferredDoc; - - // Return early if doc is invalid or already selected - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) { - return document; - } - - // Update global variables - document = doc; - docElem = document.documentElement; - documentIsHTML = !isXML( document ); - - // Support: IE 9 - 11+, Edge 12 - 18+ - // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( preferredDoc != document && - ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { - - // Support: IE 11, Edge - if ( subWindow.addEventListener ) { - subWindow.addEventListener( "unload", unloadHandler, false ); - - // Support: IE 9 - 10 only - } else if ( subWindow.attachEvent ) { - subWindow.attachEvent( "onunload", unloadHandler ); - } - } - - // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only, - // Safari 4 - 5 only, Opera <=11.6 - 12.x only - // IE/Edge & older browsers don't support the :scope pseudo-class. - // Support: Safari 6.0 only - // Safari 6.0 supports :scope but it's an alias of :root there. - support.scope = assert( function( el ) { - docElem.appendChild( el ).appendChild( document.createElement( "div" ) ); - return typeof el.querySelectorAll !== "undefined" && - !el.querySelectorAll( ":scope fieldset div" ).length; - } ); - - /* Attributes - ---------------------------------------------------------------------- */ - - // Support: IE<8 - // Verify that getAttribute really returns attributes and not properties - // (excepting IE8 booleans) - support.attributes = assert( function( el ) { - el.className = "i"; - return !el.getAttribute( "className" ); - } ); - - /* getElement(s)By* - ---------------------------------------------------------------------- */ - - // Check if getElementsByTagName("*") returns only elements - support.getElementsByTagName = assert( function( el ) { - el.appendChild( document.createComment( "" ) ); - return !el.getElementsByTagName( "*" ).length; - } ); - - // Support: IE<9 - support.getElementsByClassName = rnative.test( document.getElementsByClassName ); - - // Support: IE<10 - // Check if getElementById returns elements by name - // The broken getElementById methods don't pick up programmatically-set names, - // so use a roundabout getElementsByName test - support.getById = assert( function( el ) { - docElem.appendChild( el ).id = expando; - return !document.getElementsByName || !document.getElementsByName( expando ).length; - } ); - - // ID filter and find - if ( support.getById ) { - Expr.filter[ "ID" ] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - return elem.getAttribute( "id" ) === attrId; - }; - }; - Expr.find[ "ID" ] = function( id, context ) { - if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { - var elem = context.getElementById( id ); - return elem ? [ elem ] : []; - } - }; - } else { - Expr.filter[ "ID" ] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - var node = typeof elem.getAttributeNode !== "undefined" && - elem.getAttributeNode( "id" ); - return node && node.value === attrId; - }; - }; - - // Support: IE 6 - 7 only - // getElementById is not reliable as a find shortcut - Expr.find[ "ID" ] = function( id, context ) { - if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { - var node, i, elems, - elem = context.getElementById( id ); - - if ( elem ) { - - // Verify the id attribute - node = elem.getAttributeNode( "id" ); - if ( node && node.value === id ) { - return [ elem ]; - } - - // Fall back on getElementsByName - elems = context.getElementsByName( id ); - i = 0; - while ( ( elem = elems[ i++ ] ) ) { - node = elem.getAttributeNode( "id" ); - if ( node && node.value === id ) { - return [ elem ]; - } - } - } - - return []; - } - }; - } - - // Tag - Expr.find[ "TAG" ] = support.getElementsByTagName ? - function( tag, context ) { - if ( typeof context.getElementsByTagName !== "undefined" ) { - return context.getElementsByTagName( tag ); - - // DocumentFragment nodes don't have gEBTN - } else if ( support.qsa ) { - return context.querySelectorAll( tag ); - } - } : - - function( tag, context ) { - var elem, - tmp = [], - i = 0, - - // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too - results = context.getElementsByTagName( tag ); - - // Filter out possible comments - if ( tag === "*" ) { - while ( ( elem = results[ i++ ] ) ) { - if ( elem.nodeType === 1 ) { - tmp.push( elem ); - } - } - - return tmp; - } - return results; - }; - - // Class - Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) { - if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { - return context.getElementsByClassName( className ); - } - }; - - /* QSA/matchesSelector - ---------------------------------------------------------------------- */ - - // QSA and matchesSelector support - - // matchesSelector(:active) reports false when true (IE9/Opera 11.5) - rbuggyMatches = []; - - // qSa(:focus) reports false when true (Chrome 21) - // We allow this because of a bug in IE8/9 that throws an error - // whenever `document.activeElement` is accessed on an iframe - // So, we allow :focus to pass through QSA all the time to avoid the IE error - // See https://bugs.jquery.com/ticket/13378 - rbuggyQSA = []; - - if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) { - - // Build QSA regex - // Regex strategy adopted from Diego Perini - assert( function( el ) { - - var input; - - // Select is set to empty string on purpose - // This is to test IE's treatment of not explicitly - // setting a boolean content attribute, - // since its presence should be enough - // https://bugs.jquery.com/ticket/12359 - docElem.appendChild( el ).innerHTML = "" + - ""; - - // Support: IE8, Opera 11-12.16 - // Nothing should be selected when empty strings follow ^= or $= or *= - // The test attribute must be unknown in Opera but "safe" for WinRT - // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section - if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) { - rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); - } - - // Support: IE8 - // Boolean attributes and "value" are not treated correctly - if ( !el.querySelectorAll( "[selected]" ).length ) { - rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); - } - - // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ - if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { - rbuggyQSA.push( "~=" ); - } - - // Support: IE 11+, Edge 15 - 18+ - // IE 11/Edge don't find elements on a `[name='']` query in some cases. - // Adding a temporary attribute to the document before the selection works - // around the issue. - // Interestingly, IE 10 & older don't seem to have the issue. - input = document.createElement( "input" ); - input.setAttribute( "name", "" ); - el.appendChild( input ); - if ( !el.querySelectorAll( "[name='']" ).length ) { - rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + - whitespace + "*(?:''|\"\")" ); - } - - // Webkit/Opera - :checked should return selected option elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - // IE8 throws error here and will not see later tests - if ( !el.querySelectorAll( ":checked" ).length ) { - rbuggyQSA.push( ":checked" ); - } - - // Support: Safari 8+, iOS 8+ - // https://bugs.webkit.org/show_bug.cgi?id=136851 - // In-page `selector#id sibling-combinator selector` fails - if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { - rbuggyQSA.push( ".#.+[+~]" ); - } - - // Support: Firefox <=3.6 - 5 only - // Old Firefox doesn't throw on a badly-escaped identifier. - el.querySelectorAll( "\\\f" ); - rbuggyQSA.push( "[\\r\\n\\f]" ); - } ); - - assert( function( el ) { - el.innerHTML = "" + - ""; - - // Support: Windows 8 Native Apps - // The type and name attributes are restricted during .innerHTML assignment - var input = document.createElement( "input" ); - input.setAttribute( "type", "hidden" ); - el.appendChild( input ).setAttribute( "name", "D" ); - - // Support: IE8 - // Enforce case-sensitivity of name attribute - if ( el.querySelectorAll( "[name=d]" ).length ) { - rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); - } - - // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) - // IE8 throws error here and will not see later tests - if ( el.querySelectorAll( ":enabled" ).length !== 2 ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } - - // Support: IE9-11+ - // IE's :disabled selector does not pick up the children of disabled fieldsets - docElem.appendChild( el ).disabled = true; - if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } - - // Support: Opera 10 - 11 only - // Opera 10-11 does not throw on post-comma invalid pseudos - el.querySelectorAll( "*,:x" ); - rbuggyQSA.push( ",.*:" ); - } ); - } - - if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches || - docElem.webkitMatchesSelector || - docElem.mozMatchesSelector || - docElem.oMatchesSelector || - docElem.msMatchesSelector ) ) ) ) { - - assert( function( el ) { - - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9) - support.disconnectedMatch = matches.call( el, "*" ); - - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( el, "[s!='']:x" ); - rbuggyMatches.push( "!=", pseudos ); - } ); - } - - rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); - rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) ); - - /* Contains - ---------------------------------------------------------------------- */ - hasCompare = rnative.test( docElem.compareDocumentPosition ); - - // Element contains another - // Purposefully self-exclusive - // As in, an element does not contain itself - contains = hasCompare || rnative.test( docElem.contains ) ? - function( a, b ) { - var adown = a.nodeType === 9 ? a.documentElement : a, - bup = b && b.parentNode; - return a === bup || !!( bup && bup.nodeType === 1 && ( - adown.contains ? - adown.contains( bup ) : - a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 - ) ); - } : - function( a, b ) { - if ( b ) { - while ( ( b = b.parentNode ) ) { - if ( b === a ) { - return true; - } - } - } - return false; - }; - - /* Sorting - ---------------------------------------------------------------------- */ - - // Document order sorting - sortOrder = hasCompare ? - function( a, b ) { - - // Flag for duplicate removal - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - // Sort on method existence if only one input has compareDocumentPosition - var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; - if ( compare ) { - return compare; - } - - // Calculate position if both inputs belong to the same document - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ? - a.compareDocumentPosition( b ) : - - // Otherwise we know they are disconnected - 1; - - // Disconnected nodes - if ( compare & 1 || - ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) { - - // Choose the first element that is related to our preferred document - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( a == document || a.ownerDocument == preferredDoc && - contains( preferredDoc, a ) ) { - return -1; - } - - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( b == document || b.ownerDocument == preferredDoc && - contains( preferredDoc, b ) ) { - return 1; - } - - // Maintain original order - return sortInput ? - ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : - 0; - } - - return compare & 4 ? -1 : 1; - } : - function( a, b ) { - - // Exit early if the nodes are identical - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - var cur, - i = 0, - aup = a.parentNode, - bup = b.parentNode, - ap = [ a ], - bp = [ b ]; - - // Parentless nodes are either documents or disconnected - if ( !aup || !bup ) { - - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - /* eslint-disable eqeqeq */ - return a == document ? -1 : - b == document ? 1 : - /* eslint-enable eqeqeq */ - aup ? -1 : - bup ? 1 : - sortInput ? - ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : - 0; - - // If the nodes are siblings, we can do a quick check - } else if ( aup === bup ) { - return siblingCheck( a, b ); - } - - // Otherwise we need full lists of their ancestors for comparison - cur = a; - while ( ( cur = cur.parentNode ) ) { - ap.unshift( cur ); - } - cur = b; - while ( ( cur = cur.parentNode ) ) { - bp.unshift( cur ); - } - - // Walk down the tree looking for a discrepancy - while ( ap[ i ] === bp[ i ] ) { - i++; - } - - return i ? - - // Do a sibling check if the nodes have a common ancestor - siblingCheck( ap[ i ], bp[ i ] ) : - - // Otherwise nodes in our document sort first - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - /* eslint-disable eqeqeq */ - ap[ i ] == preferredDoc ? -1 : - bp[ i ] == preferredDoc ? 1 : - /* eslint-enable eqeqeq */ - 0; - }; - - return document; -}; - -Sizzle.matches = function( expr, elements ) { - return Sizzle( expr, null, null, elements ); -}; - -Sizzle.matchesSelector = function( elem, expr ) { - setDocument( elem ); - - if ( support.matchesSelector && documentIsHTML && - !nonnativeSelectorCache[ expr + " " ] && - ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && - ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { - - try { - var ret = matches.call( elem, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || support.disconnectedMatch || - - // As well, disconnected nodes are said to be in a document - // fragment in IE 9 - elem.document && elem.document.nodeType !== 11 ) { - return ret; - } - } catch ( e ) { - nonnativeSelectorCache( expr, true ); - } - } - - return Sizzle( expr, document, null, [ elem ] ).length > 0; -}; - -Sizzle.contains = function( context, elem ) { - - // Set document vars if needed - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( ( context.ownerDocument || context ) != document ) { - setDocument( context ); - } - return contains( context, elem ); -}; - -Sizzle.attr = function( elem, name ) { - - // Set document vars if needed - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( ( elem.ownerDocument || elem ) != document ) { - setDocument( elem ); - } - - var fn = Expr.attrHandle[ name.toLowerCase() ], - - // Don't get fooled by Object.prototype properties (jQuery #13807) - val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? - fn( elem, name, !documentIsHTML ) : - undefined; - - return val !== undefined ? - val : - support.attributes || !documentIsHTML ? - elem.getAttribute( name ) : - ( val = elem.getAttributeNode( name ) ) && val.specified ? - val.value : - null; -}; - -Sizzle.escape = function( sel ) { - return ( sel + "" ).replace( rcssescape, fcssescape ); -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -/** - * Document sorting and removing duplicates - * @param {ArrayLike} results - */ -Sizzle.uniqueSort = function( results ) { - var elem, - duplicates = [], - j = 0, - i = 0; - - // Unless we *know* we can detect duplicates, assume their presence - hasDuplicate = !support.detectDuplicates; - sortInput = !support.sortStable && results.slice( 0 ); - results.sort( sortOrder ); - - if ( hasDuplicate ) { - while ( ( elem = results[ i++ ] ) ) { - if ( elem === results[ i ] ) { - j = duplicates.push( i ); - } - } - while ( j-- ) { - results.splice( duplicates[ j ], 1 ); - } - } - - // Clear input after sorting to release objects - // See https://github.com/jquery/sizzle/pull/225 - sortInput = null; - - return results; -}; - -/** - * Utility function for retrieving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -getText = Sizzle.getText = function( elem ) { - var node, - ret = "", - i = 0, - nodeType = elem.nodeType; - - if ( !nodeType ) { - - // If no nodeType, this is expected to be an array - while ( ( node = elem[ i++ ] ) ) { - - // Do not traverse comment nodes - ret += getText( node ); - } - } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { - - // Use textContent for elements - // innerText usage removed for consistency of new lines (jQuery #11153) - if ( typeof elem.textContent === "string" ) { - return elem.textContent; - } else { - - // Traverse its children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - - // Do not include comment or processing instruction nodes - - return ret; -}; - -Expr = Sizzle.selectors = { - - // Can be adjusted by the user - cacheLength: 50, - - createPseudo: markFunction, - - match: matchExpr, - - attrHandle: {}, - - find: {}, - - relative: { - ">": { dir: "parentNode", first: true }, - " ": { dir: "parentNode" }, - "+": { dir: "previousSibling", first: true }, - "~": { dir: "previousSibling" } - }, - - preFilter: { - "ATTR": function( match ) { - match[ 1 ] = match[ 1 ].replace( runescape, funescape ); - - // Move the given value to match[3] whether quoted or unquoted - match[ 3 ] = ( match[ 3 ] || match[ 4 ] || - match[ 5 ] || "" ).replace( runescape, funescape ); - - if ( match[ 2 ] === "~=" ) { - match[ 3 ] = " " + match[ 3 ] + " "; - } - - return match.slice( 0, 4 ); - }, - - "CHILD": function( match ) { - - /* matches from matchExpr["CHILD"] - 1 type (only|nth|...) - 2 what (child|of-type) - 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) - 4 xn-component of xn+y argument ([+-]?\d*n|) - 5 sign of xn-component - 6 x of xn-component - 7 sign of y-component - 8 y of y-component - */ - match[ 1 ] = match[ 1 ].toLowerCase(); - - if ( match[ 1 ].slice( 0, 3 ) === "nth" ) { - - // nth-* requires argument - if ( !match[ 3 ] ) { - Sizzle.error( match[ 0 ] ); - } - - // numeric x and y parameters for Expr.filter.CHILD - // remember that false/true cast respectively to 0/1 - match[ 4 ] = +( match[ 4 ] ? - match[ 5 ] + ( match[ 6 ] || 1 ) : - 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) ); - match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" ); - - // other types prohibit arguments - } else if ( match[ 3 ] ) { - Sizzle.error( match[ 0 ] ); - } - - return match; - }, - - "PSEUDO": function( match ) { - var excess, - unquoted = !match[ 6 ] && match[ 2 ]; - - if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) { - return null; - } - - // Accept quoted arguments as-is - if ( match[ 3 ] ) { - match[ 2 ] = match[ 4 ] || match[ 5 ] || ""; - - // Strip excess characters from unquoted arguments - } else if ( unquoted && rpseudo.test( unquoted ) && - - // Get excess from tokenize (recursively) - ( excess = tokenize( unquoted, true ) ) && - - // advance to the next closing parenthesis - ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) { - - // excess is a negative index - match[ 0 ] = match[ 0 ].slice( 0, excess ); - match[ 2 ] = unquoted.slice( 0, excess ); - } - - // Return only captures needed by the pseudo filter method (type and argument) - return match.slice( 0, 3 ); - } - }, - - filter: { - - "TAG": function( nodeNameSelector ) { - var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); - return nodeNameSelector === "*" ? - function() { - return true; - } : - function( elem ) { - return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; - }; - }, - - "CLASS": function( className ) { - var pattern = classCache[ className + " " ]; - - return pattern || - ( pattern = new RegExp( "(^|" + whitespace + - ")" + className + "(" + whitespace + "|$)" ) ) && classCache( - className, function( elem ) { - return pattern.test( - typeof elem.className === "string" && elem.className || - typeof elem.getAttribute !== "undefined" && - elem.getAttribute( "class" ) || - "" - ); - } ); - }, - - "ATTR": function( name, operator, check ) { - return function( elem ) { - var result = Sizzle.attr( elem, name ); - - if ( result == null ) { - return operator === "!="; - } - if ( !operator ) { - return true; - } - - result += ""; - - /* eslint-disable max-len */ - - return operator === "=" ? result === check : - operator === "!=" ? result !== check : - operator === "^=" ? check && result.indexOf( check ) === 0 : - operator === "*=" ? check && result.indexOf( check ) > -1 : - operator === "$=" ? check && result.slice( -check.length ) === check : - operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : - operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : - false; - /* eslint-enable max-len */ - - }; - }, - - "CHILD": function( type, what, _argument, first, last ) { - var simple = type.slice( 0, 3 ) !== "nth", - forward = type.slice( -4 ) !== "last", - ofType = what === "of-type"; - - return first === 1 && last === 0 ? - - // Shortcut for :nth-*(n) - function( elem ) { - return !!elem.parentNode; - } : - - function( elem, _context, xml ) { - var cache, uniqueCache, outerCache, node, nodeIndex, start, - dir = simple !== forward ? "nextSibling" : "previousSibling", - parent = elem.parentNode, - name = ofType && elem.nodeName.toLowerCase(), - useCache = !xml && !ofType, - diff = false; - - if ( parent ) { - - // :(first|last|only)-(child|of-type) - if ( simple ) { - while ( dir ) { - node = elem; - while ( ( node = node[ dir ] ) ) { - if ( ofType ? - node.nodeName.toLowerCase() === name : - node.nodeType === 1 ) { - - return false; - } - } - - // Reverse direction for :only-* (if we haven't yet done so) - start = dir = type === "only" && !start && "nextSibling"; - } - return true; - } - - start = [ forward ? parent.firstChild : parent.lastChild ]; - - // non-xml :nth-child(...) stores cache data on `parent` - if ( forward && useCache ) { - - // Seek `elem` from a previously-cached index - - // ...in a gzip-friendly way - node = parent; - outerCache = node[ expando ] || ( node[ expando ] = {} ); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ node.uniqueID ] || - ( outerCache[ node.uniqueID ] = {} ); - - cache = uniqueCache[ type ] || []; - nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; - diff = nodeIndex && cache[ 2 ]; - node = nodeIndex && parent.childNodes[ nodeIndex ]; - - while ( ( node = ++nodeIndex && node && node[ dir ] || - - // Fallback to seeking `elem` from the start - ( diff = nodeIndex = 0 ) || start.pop() ) ) { - - // When found, cache indexes on `parent` and break - if ( node.nodeType === 1 && ++diff && node === elem ) { - uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; - break; - } - } - - } else { - - // Use previously-cached element index if available - if ( useCache ) { - - // ...in a gzip-friendly way - node = elem; - outerCache = node[ expando ] || ( node[ expando ] = {} ); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ node.uniqueID ] || - ( outerCache[ node.uniqueID ] = {} ); - - cache = uniqueCache[ type ] || []; - nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; - diff = nodeIndex; - } - - // xml :nth-child(...) - // or :nth-last-child(...) or :nth(-last)?-of-type(...) - if ( diff === false ) { - - // Use the same loop as above to seek `elem` from the start - while ( ( node = ++nodeIndex && node && node[ dir ] || - ( diff = nodeIndex = 0 ) || start.pop() ) ) { - - if ( ( ofType ? - node.nodeName.toLowerCase() === name : - node.nodeType === 1 ) && - ++diff ) { - - // Cache the index of each encountered element - if ( useCache ) { - outerCache = node[ expando ] || - ( node[ expando ] = {} ); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ node.uniqueID ] || - ( outerCache[ node.uniqueID ] = {} ); - - uniqueCache[ type ] = [ dirruns, diff ]; - } - - if ( node === elem ) { - break; - } - } - } - } - } - - // Incorporate the offset, then check against cycle size - diff -= last; - return diff === first || ( diff % first === 0 && diff / first >= 0 ); - } - }; - }, - - "PSEUDO": function( pseudo, argument ) { - - // pseudo-class names are case-insensitive - // http://www.w3.org/TR/selectors/#pseudo-classes - // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters - // Remember that setFilters inherits from pseudos - var args, - fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || - Sizzle.error( "unsupported pseudo: " + pseudo ); - - // The user may use createPseudo to indicate that - // arguments are needed to create the filter function - // just as Sizzle does - if ( fn[ expando ] ) { - return fn( argument ); - } - - // But maintain support for old signatures - if ( fn.length > 1 ) { - args = [ pseudo, pseudo, "", argument ]; - return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? - markFunction( function( seed, matches ) { - var idx, - matched = fn( seed, argument ), - i = matched.length; - while ( i-- ) { - idx = indexOf( seed, matched[ i ] ); - seed[ idx ] = !( matches[ idx ] = matched[ i ] ); - } - } ) : - function( elem ) { - return fn( elem, 0, args ); - }; - } - - return fn; - } - }, - - pseudos: { - - // Potentially complex pseudos - "not": markFunction( function( selector ) { - - // Trim the selector passed to compile - // to avoid treating leading and trailing - // spaces as combinators - var input = [], - results = [], - matcher = compile( selector.replace( rtrim, "$1" ) ); - - return matcher[ expando ] ? - markFunction( function( seed, matches, _context, xml ) { - var elem, - unmatched = matcher( seed, null, xml, [] ), - i = seed.length; - - // Match elements unmatched by `matcher` - while ( i-- ) { - if ( ( elem = unmatched[ i ] ) ) { - seed[ i ] = !( matches[ i ] = elem ); - } - } - } ) : - function( elem, _context, xml ) { - input[ 0 ] = elem; - matcher( input, null, xml, results ); - - // Don't keep the element (issue #299) - input[ 0 ] = null; - return !results.pop(); - }; - } ), - - "has": markFunction( function( selector ) { - return function( elem ) { - return Sizzle( selector, elem ).length > 0; - }; - } ), - - "contains": markFunction( function( text ) { - text = text.replace( runescape, funescape ); - return function( elem ) { - return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1; - }; - } ), - - // "Whether an element is represented by a :lang() selector - // is based solely on the element's language value - // being equal to the identifier C, - // or beginning with the identifier C immediately followed by "-". - // The matching of C against the element's language value is performed case-insensitively. - // The identifier C does not have to be a valid language name." - // http://www.w3.org/TR/selectors/#lang-pseudo - "lang": markFunction( function( lang ) { - - // lang value must be a valid identifier - if ( !ridentifier.test( lang || "" ) ) { - Sizzle.error( "unsupported lang: " + lang ); - } - lang = lang.replace( runescape, funescape ).toLowerCase(); - return function( elem ) { - var elemLang; - do { - if ( ( elemLang = documentIsHTML ? - elem.lang : - elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) { - - elemLang = elemLang.toLowerCase(); - return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; - } - } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 ); - return false; - }; - } ), - - // Miscellaneous - "target": function( elem ) { - var hash = window.location && window.location.hash; - return hash && hash.slice( 1 ) === elem.id; - }, - - "root": function( elem ) { - return elem === docElem; - }, - - "focus": function( elem ) { - return elem === document.activeElement && - ( !document.hasFocus || document.hasFocus() ) && - !!( elem.type || elem.href || ~elem.tabIndex ); - }, - - // Boolean properties - "enabled": createDisabledPseudo( false ), - "disabled": createDisabledPseudo( true ), - - "checked": function( elem ) { - - // In CSS3, :checked should return both checked and selected elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - var nodeName = elem.nodeName.toLowerCase(); - return ( nodeName === "input" && !!elem.checked ) || - ( nodeName === "option" && !!elem.selected ); - }, - - "selected": function( elem ) { - - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - // eslint-disable-next-line no-unused-expressions - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - // Contents - "empty": function( elem ) { - - // http://www.w3.org/TR/selectors/#empty-pseudo - // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), - // but not by others (comment: 8; processing instruction: 7; etc.) - // nodeType < 6 works because attributes (2) do not appear as children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - if ( elem.nodeType < 6 ) { - return false; - } - } - return true; - }, - - "parent": function( elem ) { - return !Expr.pseudos[ "empty" ]( elem ); - }, - - // Element/input types - "header": function( elem ) { - return rheader.test( elem.nodeName ); - }, - - "input": function( elem ) { - return rinputs.test( elem.nodeName ); - }, - - "button": function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === "button" || name === "button"; - }, - - "text": function( elem ) { - var attr; - return elem.nodeName.toLowerCase() === "input" && - elem.type === "text" && - - // Support: IE<8 - // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" - ( ( attr = elem.getAttribute( "type" ) ) == null || - attr.toLowerCase() === "text" ); - }, - - // Position-in-collection - "first": createPositionalPseudo( function() { - return [ 0 ]; - } ), - - "last": createPositionalPseudo( function( _matchIndexes, length ) { - return [ length - 1 ]; - } ), - - "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) { - return [ argument < 0 ? argument + length : argument ]; - } ), - - "even": createPositionalPseudo( function( matchIndexes, length ) { - var i = 0; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - } ), - - "odd": createPositionalPseudo( function( matchIndexes, length ) { - var i = 1; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - } ), - - "lt": createPositionalPseudo( function( matchIndexes, length, argument ) { - var i = argument < 0 ? - argument + length : - argument > length ? - length : - argument; - for ( ; --i >= 0; ) { - matchIndexes.push( i ); - } - return matchIndexes; - } ), - - "gt": createPositionalPseudo( function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; ++i < length; ) { - matchIndexes.push( i ); - } - return matchIndexes; - } ) - } -}; - -Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ]; - -// Add button/input type pseudos -for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { - Expr.pseudos[ i ] = createInputPseudo( i ); -} -for ( i in { submit: true, reset: true } ) { - Expr.pseudos[ i ] = createButtonPseudo( i ); -} - -// Easy API for creating new setFilters -function setFilters() {} -setFilters.prototype = Expr.filters = Expr.pseudos; -Expr.setFilters = new setFilters(); - -tokenize = Sizzle.tokenize = function( selector, parseOnly ) { - var matched, match, tokens, type, - soFar, groups, preFilters, - cached = tokenCache[ selector + " " ]; - - if ( cached ) { - return parseOnly ? 0 : cached.slice( 0 ); - } - - soFar = selector; - groups = []; - preFilters = Expr.preFilter; - - while ( soFar ) { - - // Comma and first run - if ( !matched || ( match = rcomma.exec( soFar ) ) ) { - if ( match ) { - - // Don't consume trailing commas as valid - soFar = soFar.slice( match[ 0 ].length ) || soFar; - } - groups.push( ( tokens = [] ) ); - } - - matched = false; - - // Combinators - if ( ( match = rcombinators.exec( soFar ) ) ) { - matched = match.shift(); - tokens.push( { - value: matched, - - // Cast descendant combinators to space - type: match[ 0 ].replace( rtrim, " " ) - } ); - soFar = soFar.slice( matched.length ); - } - - // Filters - for ( type in Expr.filter ) { - if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] || - ( match = preFilters[ type ]( match ) ) ) ) { - matched = match.shift(); - tokens.push( { - value: matched, - type: type, - matches: match - } ); - soFar = soFar.slice( matched.length ); - } - } - - if ( !matched ) { - break; - } - } - - // Return the length of the invalid excess - // if we're just parsing - // Otherwise, throw an error or return tokens - return parseOnly ? - soFar.length : - soFar ? - Sizzle.error( selector ) : - - // Cache the tokens - tokenCache( selector, groups ).slice( 0 ); -}; - -function toSelector( tokens ) { - var i = 0, - len = tokens.length, - selector = ""; - for ( ; i < len; i++ ) { - selector += tokens[ i ].value; - } - return selector; -} - -function addCombinator( matcher, combinator, base ) { - var dir = combinator.dir, - skip = combinator.next, - key = skip || dir, - checkNonElements = base && key === "parentNode", - doneName = done++; - - return combinator.first ? - - // Check against closest ancestor/preceding element - function( elem, context, xml ) { - while ( ( elem = elem[ dir ] ) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - return matcher( elem, context, xml ); - } - } - return false; - } : - - // Check against all ancestor/preceding elements - function( elem, context, xml ) { - var oldCache, uniqueCache, outerCache, - newCache = [ dirruns, doneName ]; - - // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching - if ( xml ) { - while ( ( elem = elem[ dir ] ) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - if ( matcher( elem, context, xml ) ) { - return true; - } - } - } - } else { - while ( ( elem = elem[ dir ] ) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - outerCache = elem[ expando ] || ( elem[ expando ] = {} ); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ elem.uniqueID ] || - ( outerCache[ elem.uniqueID ] = {} ); - - if ( skip && skip === elem.nodeName.toLowerCase() ) { - elem = elem[ dir ] || elem; - } else if ( ( oldCache = uniqueCache[ key ] ) && - oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { - - // Assign to newCache so results back-propagate to previous elements - return ( newCache[ 2 ] = oldCache[ 2 ] ); - } else { - - // Reuse newcache so results back-propagate to previous elements - uniqueCache[ key ] = newCache; - - // A match means we're done; a fail means we have to keep checking - if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) { - return true; - } - } - } - } - } - return false; - }; -} - -function elementMatcher( matchers ) { - return matchers.length > 1 ? - function( elem, context, xml ) { - var i = matchers.length; - while ( i-- ) { - if ( !matchers[ i ]( elem, context, xml ) ) { - return false; - } - } - return true; - } : - matchers[ 0 ]; -} - -function multipleContexts( selector, contexts, results ) { - var i = 0, - len = contexts.length; - for ( ; i < len; i++ ) { - Sizzle( selector, contexts[ i ], results ); - } - return results; -} - -function condense( unmatched, map, filter, context, xml ) { - var elem, - newUnmatched = [], - i = 0, - len = unmatched.length, - mapped = map != null; - - for ( ; i < len; i++ ) { - if ( ( elem = unmatched[ i ] ) ) { - if ( !filter || filter( elem, context, xml ) ) { - newUnmatched.push( elem ); - if ( mapped ) { - map.push( i ); - } - } - } - } - - return newUnmatched; -} - -function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { - if ( postFilter && !postFilter[ expando ] ) { - postFilter = setMatcher( postFilter ); - } - if ( postFinder && !postFinder[ expando ] ) { - postFinder = setMatcher( postFinder, postSelector ); - } - return markFunction( function( seed, results, context, xml ) { - var temp, i, elem, - preMap = [], - postMap = [], - preexisting = results.length, - - // Get initial elements from seed or context - elems = seed || multipleContexts( - selector || "*", - context.nodeType ? [ context ] : context, - [] - ), - - // Prefilter to get matcher input, preserving a map for seed-results synchronization - matcherIn = preFilter && ( seed || !selector ) ? - condense( elems, preMap, preFilter, context, xml ) : - elems, - - matcherOut = matcher ? - - // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, - postFinder || ( seed ? preFilter : preexisting || postFilter ) ? - - // ...intermediate processing is necessary - [] : - - // ...otherwise use results directly - results : - matcherIn; - - // Find primary matches - if ( matcher ) { - matcher( matcherIn, matcherOut, context, xml ); - } - - // Apply postFilter - if ( postFilter ) { - temp = condense( matcherOut, postMap ); - postFilter( temp, [], context, xml ); - - // Un-match failing elements by moving them back to matcherIn - i = temp.length; - while ( i-- ) { - if ( ( elem = temp[ i ] ) ) { - matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem ); - } - } - } - - if ( seed ) { - if ( postFinder || preFilter ) { - if ( postFinder ) { - - // Get the final matcherOut by condensing this intermediate into postFinder contexts - temp = []; - i = matcherOut.length; - while ( i-- ) { - if ( ( elem = matcherOut[ i ] ) ) { - - // Restore matcherIn since elem is not yet a final match - temp.push( ( matcherIn[ i ] = elem ) ); - } - } - postFinder( null, ( matcherOut = [] ), temp, xml ); - } - - // Move matched elements from seed to results to keep them synchronized - i = matcherOut.length; - while ( i-- ) { - if ( ( elem = matcherOut[ i ] ) && - ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) { - - seed[ temp ] = !( results[ temp ] = elem ); - } - } - } - - // Add elements to results, through postFinder if defined - } else { - matcherOut = condense( - matcherOut === results ? - matcherOut.splice( preexisting, matcherOut.length ) : - matcherOut - ); - if ( postFinder ) { - postFinder( null, results, matcherOut, xml ); - } else { - push.apply( results, matcherOut ); - } - } - } ); -} - -function matcherFromTokens( tokens ) { - var checkContext, matcher, j, - len = tokens.length, - leadingRelative = Expr.relative[ tokens[ 0 ].type ], - implicitRelative = leadingRelative || Expr.relative[ " " ], - i = leadingRelative ? 1 : 0, - - // The foundational matcher ensures that elements are reachable from top-level context(s) - matchContext = addCombinator( function( elem ) { - return elem === checkContext; - }, implicitRelative, true ), - matchAnyContext = addCombinator( function( elem ) { - return indexOf( checkContext, elem ) > -1; - }, implicitRelative, true ), - matchers = [ function( elem, context, xml ) { - var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( - ( checkContext = context ).nodeType ? - matchContext( elem, context, xml ) : - matchAnyContext( elem, context, xml ) ); - - // Avoid hanging onto element (issue #299) - checkContext = null; - return ret; - } ]; - - for ( ; i < len; i++ ) { - if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) { - matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; - } else { - matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches ); - - // Return special upon seeing a positional matcher - if ( matcher[ expando ] ) { - - // Find the next relative operator (if any) for proper handling - j = ++i; - for ( ; j < len; j++ ) { - if ( Expr.relative[ tokens[ j ].type ] ) { - break; - } - } - return setMatcher( - i > 1 && elementMatcher( matchers ), - i > 1 && toSelector( - - // If the preceding token was a descendant combinator, insert an implicit any-element `*` - tokens - .slice( 0, i - 1 ) - .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) - ).replace( rtrim, "$1" ), - matcher, - i < j && matcherFromTokens( tokens.slice( i, j ) ), - j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ), - j < len && toSelector( tokens ) - ); - } - matchers.push( matcher ); - } - } - - return elementMatcher( matchers ); -} - -function matcherFromGroupMatchers( elementMatchers, setMatchers ) { - var bySet = setMatchers.length > 0, - byElement = elementMatchers.length > 0, - superMatcher = function( seed, context, xml, results, outermost ) { - var elem, j, matcher, - matchedCount = 0, - i = "0", - unmatched = seed && [], - setMatched = [], - contextBackup = outermostContext, - - // We must always have either seed elements or outermost context - elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ), - - // Use integer dirruns iff this is the outermost matcher - dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), - len = elems.length; - - if ( outermost ) { - - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - outermostContext = context == document || context || outermost; - } - - // Add elements passing elementMatchers directly to results - // Support: IE<9, Safari - // Tolerate NodeList properties (IE: "length"; Safari: ) matching elements by id - for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { - if ( byElement && elem ) { - j = 0; - - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( !context && elem.ownerDocument != document ) { - setDocument( elem ); - xml = !documentIsHTML; - } - while ( ( matcher = elementMatchers[ j++ ] ) ) { - if ( matcher( elem, context || document, xml ) ) { - results.push( elem ); - break; - } - } - if ( outermost ) { - dirruns = dirrunsUnique; - } - } - - // Track unmatched elements for set filters - if ( bySet ) { - - // They will have gone through all possible matchers - if ( ( elem = !matcher && elem ) ) { - matchedCount--; - } - - // Lengthen the array for every element, matched or not - if ( seed ) { - unmatched.push( elem ); - } - } - } - - // `i` is now the count of elements visited above, and adding it to `matchedCount` - // makes the latter nonnegative. - matchedCount += i; - - // Apply set filters to unmatched elements - // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` - // equals `i`), unless we didn't visit _any_ elements in the above loop because we have - // no element matchers and no seed. - // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that - // case, which will result in a "00" `matchedCount` that differs from `i` but is also - // numerically zero. - if ( bySet && i !== matchedCount ) { - j = 0; - while ( ( matcher = setMatchers[ j++ ] ) ) { - matcher( unmatched, setMatched, context, xml ); - } - - if ( seed ) { - - // Reintegrate element matches to eliminate the need for sorting - if ( matchedCount > 0 ) { - while ( i-- ) { - if ( !( unmatched[ i ] || setMatched[ i ] ) ) { - setMatched[ i ] = pop.call( results ); - } - } - } - - // Discard index placeholder values to get only actual matches - setMatched = condense( setMatched ); - } - - // Add matches to results - push.apply( results, setMatched ); - - // Seedless set matches succeeding multiple successful matchers stipulate sorting - if ( outermost && !seed && setMatched.length > 0 && - ( matchedCount + setMatchers.length ) > 1 ) { - - Sizzle.uniqueSort( results ); - } - } - - // Override manipulation of globals by nested matchers - if ( outermost ) { - dirruns = dirrunsUnique; - outermostContext = contextBackup; - } - - return unmatched; - }; - - return bySet ? - markFunction( superMatcher ) : - superMatcher; -} - -compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { - var i, - setMatchers = [], - elementMatchers = [], - cached = compilerCache[ selector + " " ]; - - if ( !cached ) { - - // Generate a function of recursive functions that can be used to check each element - if ( !match ) { - match = tokenize( selector ); - } - i = match.length; - while ( i-- ) { - cached = matcherFromTokens( match[ i ] ); - if ( cached[ expando ] ) { - setMatchers.push( cached ); - } else { - elementMatchers.push( cached ); - } - } - - // Cache the compiled function - cached = compilerCache( - selector, - matcherFromGroupMatchers( elementMatchers, setMatchers ) - ); - - // Save selector and tokenization - cached.selector = selector; - } - return cached; -}; - -/** - * A low-level selection function that works with Sizzle's compiled - * selector functions - * @param {String|Function} selector A selector or a pre-compiled - * selector function built with Sizzle.compile - * @param {Element} context - * @param {Array} [results] - * @param {Array} [seed] A set of elements to match against - */ -select = Sizzle.select = function( selector, context, results, seed ) { - var i, tokens, token, type, find, - compiled = typeof selector === "function" && selector, - match = !seed && tokenize( ( selector = compiled.selector || selector ) ); - - results = results || []; - - // Try to minimize operations if there is only one selector in the list and no seed - // (the latter of which guarantees us context) - if ( match.length === 1 ) { - - // Reduce context if the leading compound selector is an ID - tokens = match[ 0 ] = match[ 0 ].slice( 0 ); - if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" && - context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { - - context = ( Expr.find[ "ID" ]( token.matches[ 0 ] - .replace( runescape, funescape ), context ) || [] )[ 0 ]; - if ( !context ) { - return results; - - // Precompiled matchers will still verify ancestry, so step up a level - } else if ( compiled ) { - context = context.parentNode; - } - - selector = selector.slice( tokens.shift().value.length ); - } - - // Fetch a seed set for right-to-left matching - i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length; - while ( i-- ) { - token = tokens[ i ]; - - // Abort if we hit a combinator - if ( Expr.relative[ ( type = token.type ) ] ) { - break; - } - if ( ( find = Expr.find[ type ] ) ) { - - // Search, expanding context for leading sibling combinators - if ( ( seed = find( - token.matches[ 0 ].replace( runescape, funescape ), - rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) || - context - ) ) ) { - - // If seed is empty or no tokens remain, we can return early - tokens.splice( i, 1 ); - selector = seed.length && toSelector( tokens ); - if ( !selector ) { - push.apply( results, seed ); - return results; - } - - break; - } - } - } - } - - // Compile and execute a filtering function if one is not provided - // Provide `match` to avoid retokenization if we modified the selector above - ( compiled || compile( selector, match ) )( - seed, - context, - !documentIsHTML, - results, - !context || rsibling.test( selector ) && testContext( context.parentNode ) || context - ); - return results; -}; - -// One-time assignments - -// Sort stability -support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando; - -// Support: Chrome 14-35+ -// Always assume duplicates if they aren't passed to the comparison function -support.detectDuplicates = !!hasDuplicate; - -// Initialize against the default document -setDocument(); - -// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) -// Detached nodes confoundingly follow *each other* -support.sortDetached = assert( function( el ) { - - // Should return 1, but returns 4 (following) - return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1; -} ); - -// Support: IE<8 -// Prevent attribute/property "interpolation" -// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx -if ( !assert( function( el ) { - el.innerHTML = ""; - return el.firstChild.getAttribute( "href" ) === "#"; -} ) ) { - addHandle( "type|href|height|width", function( elem, name, isXML ) { - if ( !isXML ) { - return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); - } - } ); -} - -// Support: IE<9 -// Use defaultValue in place of getAttribute("value") -if ( !support.attributes || !assert( function( el ) { - el.innerHTML = ""; - el.firstChild.setAttribute( "value", "" ); - return el.firstChild.getAttribute( "value" ) === ""; -} ) ) { - addHandle( "value", function( elem, _name, isXML ) { - if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { - return elem.defaultValue; - } - } ); -} - -// Support: IE<9 -// Use getAttributeNode to fetch booleans when getAttribute lies -if ( !assert( function( el ) { - return el.getAttribute( "disabled" ) == null; -} ) ) { - addHandle( booleans, function( elem, name, isXML ) { - var val; - if ( !isXML ) { - return elem[ name ] === true ? name.toLowerCase() : - ( val = elem.getAttributeNode( name ) ) && val.specified ? - val.value : - null; - } - } ); -} - -return Sizzle; - -} )( window ); - - - -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; - -// Deprecated -jQuery.expr[ ":" ] = jQuery.expr.pseudos; -jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; -jQuery.escapeSelector = Sizzle.escape; - - - - -var dir = function( elem, dir, until ) { - var matched = [], - truncate = until !== undefined; - - while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { - if ( elem.nodeType === 1 ) { - if ( truncate && jQuery( elem ).is( until ) ) { - break; - } - matched.push( elem ); - } - } - return matched; -}; - - -var siblings = function( n, elem ) { - var matched = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - matched.push( n ); - } - } - - return matched; -}; - - -var rneedsContext = jQuery.expr.match.needsContext; - - - -function nodeName( elem, name ) { - - return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); - -} -var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); - - - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, not ) { - if ( isFunction( qualifier ) ) { - return jQuery.grep( elements, function( elem, i ) { - return !!qualifier.call( elem, i, elem ) !== not; - } ); - } - - // Single element - if ( qualifier.nodeType ) { - return jQuery.grep( elements, function( elem ) { - return ( elem === qualifier ) !== not; - } ); - } - - // Arraylike of elements (jQuery, arguments, Array) - if ( typeof qualifier !== "string" ) { - return jQuery.grep( elements, function( elem ) { - return ( indexOf.call( qualifier, elem ) > -1 ) !== not; - } ); - } - - // Filtered directly for both simple and complex selectors - return jQuery.filter( qualifier, elements, not ); -} - -jQuery.filter = function( expr, elems, not ) { - var elem = elems[ 0 ]; - - if ( not ) { - expr = ":not(" + expr + ")"; - } - - if ( elems.length === 1 && elem.nodeType === 1 ) { - return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; - } - - return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { - return elem.nodeType === 1; - } ) ); -}; - -jQuery.fn.extend( { - find: function( selector ) { - var i, ret, - len = this.length, - self = this; - - if ( typeof selector !== "string" ) { - return this.pushStack( jQuery( selector ).filter( function() { - for ( i = 0; i < len; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - } ) ); - } - - ret = this.pushStack( [] ); - - for ( i = 0; i < len; i++ ) { - jQuery.find( selector, self[ i ], ret ); - } - - return len > 1 ? jQuery.uniqueSort( ret ) : ret; - }, - filter: function( selector ) { - return this.pushStack( winnow( this, selector || [], false ) ); - }, - not: function( selector ) { - return this.pushStack( winnow( this, selector || [], true ) ); - }, - is: function( selector ) { - return !!winnow( - this, - - // If this is a positional/relative selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - typeof selector === "string" && rneedsContext.test( selector ) ? - jQuery( selector ) : - selector || [], - false - ).length; - } -} ); - - -// Initialize a jQuery object - - -// A central reference to the root jQuery(document) -var rootjQuery, - - // A simple way to check for HTML strings - // Prioritize #id over to avoid XSS via location.hash (#9521) - // Strict HTML recognition (#11290: must start with <) - // Shortcut simple #id case for speed - rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, - - init = jQuery.fn.init = function( selector, context, root ) { - var match, elem; - - // HANDLE: $(""), $(null), $(undefined), $(false) - if ( !selector ) { - return this; - } - - // Method init() accepts an alternate rootjQuery - // so migrate can support jQuery.sub (gh-2101) - root = root || rootjQuery; - - // Handle HTML strings - if ( typeof selector === "string" ) { - if ( selector[ 0 ] === "<" && - selector[ selector.length - 1 ] === ">" && - selector.length >= 3 ) { - - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = rquickExpr.exec( selector ); - } - - // Match html or make sure no context is specified for #id - if ( match && ( match[ 1 ] || !context ) ) { - - // HANDLE: $(html) -> $(array) - if ( match[ 1 ] ) { - context = context instanceof jQuery ? context[ 0 ] : context; - - // Option to run scripts is true for back-compat - // Intentionally let the error be thrown if parseHTML is not present - jQuery.merge( this, jQuery.parseHTML( - match[ 1 ], - context && context.nodeType ? context.ownerDocument || context : document, - true - ) ); - - // HANDLE: $(html, props) - if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { - for ( match in context ) { - - // Properties of context are called as methods if possible - if ( isFunction( this[ match ] ) ) { - this[ match ]( context[ match ] ); - - // ...and otherwise set as attributes - } else { - this.attr( match, context[ match ] ); - } - } - } - - return this; - - // HANDLE: $(#id) - } else { - elem = document.getElementById( match[ 2 ] ); - - if ( elem ) { - - // Inject the element directly into the jQuery object - this[ 0 ] = elem; - this.length = 1; - } - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || root ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(DOMElement) - } else if ( selector.nodeType ) { - this[ 0 ] = selector; - this.length = 1; - return this; - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( isFunction( selector ) ) { - return root.ready !== undefined ? - root.ready( selector ) : - - // Execute immediately if ready is not present - selector( jQuery ); - } - - return jQuery.makeArray( selector, this ); - }; - -// Give the init function the jQuery prototype for later instantiation -init.prototype = jQuery.fn; - -// Initialize central reference -rootjQuery = jQuery( document ); - - -var rparentsprev = /^(?:parents|prev(?:Until|All))/, - - // Methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend( { - has: function( target ) { - var targets = jQuery( target, this ), - l = targets.length; - - return this.filter( function() { - var i = 0; - for ( ; i < l; i++ ) { - if ( jQuery.contains( this, targets[ i ] ) ) { - return true; - } - } - } ); - }, - - closest: function( selectors, context ) { - var cur, - i = 0, - l = this.length, - matched = [], - targets = typeof selectors !== "string" && jQuery( selectors ); - - // Positional selectors never match, since there's no _selection_ context - if ( !rneedsContext.test( selectors ) ) { - for ( ; i < l; i++ ) { - for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { - - // Always skip document fragments - if ( cur.nodeType < 11 && ( targets ? - targets.index( cur ) > -1 : - - // Don't pass non-elements to Sizzle - cur.nodeType === 1 && - jQuery.find.matchesSelector( cur, selectors ) ) ) { - - matched.push( cur ); - break; - } - } - } - } - - return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); - }, - - // Determine the position of an element within the set - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; - } - - // Index in selector - if ( typeof elem === "string" ) { - return indexOf.call( jQuery( elem ), this[ 0 ] ); - } - - // Locate the position of the desired element - return indexOf.call( this, - - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[ 0 ] : elem - ); - }, - - add: function( selector, context ) { - return this.pushStack( - jQuery.uniqueSort( - jQuery.merge( this.get(), jQuery( selector, context ) ) - ) - ); - }, - - addBack: function( selector ) { - return this.add( selector == null ? - this.prevObject : this.prevObject.filter( selector ) - ); - } -} ); - -function sibling( cur, dir ) { - while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} - return cur; -} - -jQuery.each( { - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, _i, until ) { - return dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return sibling( elem, "nextSibling" ); - }, - prev: function( elem ) { - return sibling( elem, "previousSibling" ); - }, - nextAll: function( elem ) { - return dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, _i, until ) { - return dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, _i, until ) { - return dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return siblings( ( elem.parentNode || {} ).firstChild, elem ); - }, - children: function( elem ) { - return siblings( elem.firstChild ); - }, - contents: function( elem ) { - if ( elem.contentDocument != null && - - // Support: IE 11+ - // elements with no `data` attribute has an object - // `contentDocument` with a `null` prototype. - getProto( elem.contentDocument ) ) { - - return elem.contentDocument; - } - - // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only - // Treat the template element as a regular one in browsers that - // don't support it. - if ( nodeName( elem, "template" ) ) { - elem = elem.content || elem; - } - - return jQuery.merge( [], elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var matched = jQuery.map( this, fn, until ); - - if ( name.slice( -5 ) !== "Until" ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - matched = jQuery.filter( selector, matched ); - } - - if ( this.length > 1 ) { - - // Remove duplicates - if ( !guaranteedUnique[ name ] ) { - jQuery.uniqueSort( matched ); - } - - // Reverse order for parents* and prev-derivatives - if ( rparentsprev.test( name ) ) { - matched.reverse(); - } - } - - return this.pushStack( matched ); - }; -} ); -var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); - - - -// Convert String-formatted options into Object-formatted ones -function createOptions( options ) { - var object = {}; - jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { - object[ flag ] = true; - } ); - return object; -} - -/* - * Create a callback list using the following parameters: - * - * options: an optional list of space-separated options that will change how - * the callback list behaves or a more traditional option object - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible options: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * - */ -jQuery.Callbacks = function( options ) { - - // Convert options from String-formatted to Object-formatted if needed - // (we check in cache first) - options = typeof options === "string" ? - createOptions( options ) : - jQuery.extend( {}, options ); - - var // Flag to know if list is currently firing - firing, - - // Last fire value for non-forgettable lists - memory, - - // Flag to know if list was already fired - fired, - - // Flag to prevent firing - locked, - - // Actual callback list - list = [], - - // Queue of execution data for repeatable lists - queue = [], - - // Index of currently firing callback (modified by add/remove as needed) - firingIndex = -1, - - // Fire callbacks - fire = function() { - - // Enforce single-firing - locked = locked || options.once; - - // Execute callbacks for all pending executions, - // respecting firingIndex overrides and runtime changes - fired = firing = true; - for ( ; queue.length; firingIndex = -1 ) { - memory = queue.shift(); - while ( ++firingIndex < list.length ) { - - // Run callback and check for early termination - if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && - options.stopOnFalse ) { - - // Jump to end and forget the data so .add doesn't re-fire - firingIndex = list.length; - memory = false; - } - } - } - - // Forget the data if we're done with it - if ( !options.memory ) { - memory = false; - } - - firing = false; - - // Clean up if we're done firing for good - if ( locked ) { - - // Keep an empty list if we have data for future add calls - if ( memory ) { - list = []; - - // Otherwise, this object is spent - } else { - list = ""; - } - } - }, - - // Actual Callbacks object - self = { - - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - - // If we have memory from a past run, we should fire after adding - if ( memory && !firing ) { - firingIndex = list.length - 1; - queue.push( memory ); - } - - ( function add( args ) { - jQuery.each( args, function( _, arg ) { - if ( isFunction( arg ) ) { - if ( !options.unique || !self.has( arg ) ) { - list.push( arg ); - } - } else if ( arg && arg.length && toType( arg ) !== "string" ) { - - // Inspect recursively - add( arg ); - } - } ); - } )( arguments ); - - if ( memory && !firing ) { - fire(); - } - } - return this; - }, - - // Remove a callback from the list - remove: function() { - jQuery.each( arguments, function( _, arg ) { - var index; - while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { - list.splice( index, 1 ); - - // Handle firing indexes - if ( index <= firingIndex ) { - firingIndex--; - } - } - } ); - return this; - }, - - // Check if a given callback is in the list. - // If no argument is given, return whether or not list has callbacks attached. - has: function( fn ) { - return fn ? - jQuery.inArray( fn, list ) > -1 : - list.length > 0; - }, - - // Remove all callbacks from the list - empty: function() { - if ( list ) { - list = []; - } - return this; - }, - - // Disable .fire and .add - // Abort any current/pending executions - // Clear all callbacks and values - disable: function() { - locked = queue = []; - list = memory = ""; - return this; - }, - disabled: function() { - return !list; - }, - - // Disable .fire - // Also disable .add unless we have memory (since it would have no effect) - // Abort any pending executions - lock: function() { - locked = queue = []; - if ( !memory && !firing ) { - list = memory = ""; - } - return this; - }, - locked: function() { - return !!locked; - }, - - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - if ( !locked ) { - args = args || []; - args = [ context, args.slice ? args.slice() : args ]; - queue.push( args ); - if ( !firing ) { - fire(); - } - } - return this; - }, - - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - - // To know if the callbacks have already been called at least once - fired: function() { - return !!fired; - } - }; - - return self; -}; - - -function Identity( v ) { - return v; -} -function Thrower( ex ) { - throw ex; -} - -function adoptValue( value, resolve, reject, noValue ) { - var method; - - try { - - // Check for promise aspect first to privilege synchronous behavior - if ( value && isFunction( ( method = value.promise ) ) ) { - method.call( value ).done( resolve ).fail( reject ); - - // Other thenables - } else if ( value && isFunction( ( method = value.then ) ) ) { - method.call( value, resolve, reject ); - - // Other non-thenables - } else { - - // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: - // * false: [ value ].slice( 0 ) => resolve( value ) - // * true: [ value ].slice( 1 ) => resolve() - resolve.apply( undefined, [ value ].slice( noValue ) ); - } - - // For Promises/A+, convert exceptions into rejections - // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in - // Deferred#then to conditionally suppress rejection. - } catch ( value ) { - - // Support: Android 4.0 only - // Strict mode functions invoked without .call/.apply get global-object context - reject.apply( undefined, [ value ] ); - } -} - -jQuery.extend( { - - Deferred: function( func ) { - var tuples = [ - - // action, add listener, callbacks, - // ... .then handlers, argument index, [final state] - [ "notify", "progress", jQuery.Callbacks( "memory" ), - jQuery.Callbacks( "memory" ), 2 ], - [ "resolve", "done", jQuery.Callbacks( "once memory" ), - jQuery.Callbacks( "once memory" ), 0, "resolved" ], - [ "reject", "fail", jQuery.Callbacks( "once memory" ), - jQuery.Callbacks( "once memory" ), 1, "rejected" ] - ], - state = "pending", - promise = { - state: function() { - return state; - }, - always: function() { - deferred.done( arguments ).fail( arguments ); - return this; - }, - "catch": function( fn ) { - return promise.then( null, fn ); - }, - - // Keep pipe for back-compat - pipe: function( /* fnDone, fnFail, fnProgress */ ) { - var fns = arguments; - - return jQuery.Deferred( function( newDefer ) { - jQuery.each( tuples, function( _i, tuple ) { - - // Map tuples (progress, done, fail) to arguments (done, fail, progress) - var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; - - // deferred.progress(function() { bind to newDefer or newDefer.notify }) - // deferred.done(function() { bind to newDefer or newDefer.resolve }) - // deferred.fail(function() { bind to newDefer or newDefer.reject }) - deferred[ tuple[ 1 ] ]( function() { - var returned = fn && fn.apply( this, arguments ); - if ( returned && isFunction( returned.promise ) ) { - returned.promise() - .progress( newDefer.notify ) - .done( newDefer.resolve ) - .fail( newDefer.reject ); - } else { - newDefer[ tuple[ 0 ] + "With" ]( - this, - fn ? [ returned ] : arguments - ); - } - } ); - } ); - fns = null; - } ).promise(); - }, - then: function( onFulfilled, onRejected, onProgress ) { - var maxDepth = 0; - function resolve( depth, deferred, handler, special ) { - return function() { - var that = this, - args = arguments, - mightThrow = function() { - var returned, then; - - // Support: Promises/A+ section 2.3.3.3.3 - // https://promisesaplus.com/#point-59 - // Ignore double-resolution attempts - if ( depth < maxDepth ) { - return; - } - - returned = handler.apply( that, args ); - - // Support: Promises/A+ section 2.3.1 - // https://promisesaplus.com/#point-48 - if ( returned === deferred.promise() ) { - throw new TypeError( "Thenable self-resolution" ); - } - - // Support: Promises/A+ sections 2.3.3.1, 3.5 - // https://promisesaplus.com/#point-54 - // https://promisesaplus.com/#point-75 - // Retrieve `then` only once - then = returned && - - // Support: Promises/A+ section 2.3.4 - // https://promisesaplus.com/#point-64 - // Only check objects and functions for thenability - ( typeof returned === "object" || - typeof returned === "function" ) && - returned.then; - - // Handle a returned thenable - if ( isFunction( then ) ) { - - // Special processors (notify) just wait for resolution - if ( special ) { - then.call( - returned, - resolve( maxDepth, deferred, Identity, special ), - resolve( maxDepth, deferred, Thrower, special ) - ); - - // Normal processors (resolve) also hook into progress - } else { - - // ...and disregard older resolution values - maxDepth++; - - then.call( - returned, - resolve( maxDepth, deferred, Identity, special ), - resolve( maxDepth, deferred, Thrower, special ), - resolve( maxDepth, deferred, Identity, - deferred.notifyWith ) - ); - } - - // Handle all other returned values - } else { - - // Only substitute handlers pass on context - // and multiple values (non-spec behavior) - if ( handler !== Identity ) { - that = undefined; - args = [ returned ]; - } - - // Process the value(s) - // Default process is resolve - ( special || deferred.resolveWith )( that, args ); - } - }, - - // Only normal processors (resolve) catch and reject exceptions - process = special ? - mightThrow : - function() { - try { - mightThrow(); - } catch ( e ) { - - if ( jQuery.Deferred.exceptionHook ) { - jQuery.Deferred.exceptionHook( e, - process.stackTrace ); - } - - // Support: Promises/A+ section 2.3.3.3.4.1 - // https://promisesaplus.com/#point-61 - // Ignore post-resolution exceptions - if ( depth + 1 >= maxDepth ) { - - // Only substitute handlers pass on context - // and multiple values (non-spec behavior) - if ( handler !== Thrower ) { - that = undefined; - args = [ e ]; - } - - deferred.rejectWith( that, args ); - } - } - }; - - // Support: Promises/A+ section 2.3.3.3.1 - // https://promisesaplus.com/#point-57 - // Re-resolve promises immediately to dodge false rejection from - // subsequent errors - if ( depth ) { - process(); - } else { - - // Call an optional hook to record the stack, in case of exception - // since it's otherwise lost when execution goes async - if ( jQuery.Deferred.getStackHook ) { - process.stackTrace = jQuery.Deferred.getStackHook(); - } - window.setTimeout( process ); - } - }; - } - - return jQuery.Deferred( function( newDefer ) { - - // progress_handlers.add( ... ) - tuples[ 0 ][ 3 ].add( - resolve( - 0, - newDefer, - isFunction( onProgress ) ? - onProgress : - Identity, - newDefer.notifyWith - ) - ); - - // fulfilled_handlers.add( ... ) - tuples[ 1 ][ 3 ].add( - resolve( - 0, - newDefer, - isFunction( onFulfilled ) ? - onFulfilled : - Identity - ) - ); - - // rejected_handlers.add( ... ) - tuples[ 2 ][ 3 ].add( - resolve( - 0, - newDefer, - isFunction( onRejected ) ? - onRejected : - Thrower - ) - ); - } ).promise(); - }, - - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - return obj != null ? jQuery.extend( obj, promise ) : promise; - } - }, - deferred = {}; - - // Add list-specific methods - jQuery.each( tuples, function( i, tuple ) { - var list = tuple[ 2 ], - stateString = tuple[ 5 ]; - - // promise.progress = list.add - // promise.done = list.add - // promise.fail = list.add - promise[ tuple[ 1 ] ] = list.add; - - // Handle state - if ( stateString ) { - list.add( - function() { - - // state = "resolved" (i.e., fulfilled) - // state = "rejected" - state = stateString; - }, - - // rejected_callbacks.disable - // fulfilled_callbacks.disable - tuples[ 3 - i ][ 2 ].disable, - - // rejected_handlers.disable - // fulfilled_handlers.disable - tuples[ 3 - i ][ 3 ].disable, - - // progress_callbacks.lock - tuples[ 0 ][ 2 ].lock, - - // progress_handlers.lock - tuples[ 0 ][ 3 ].lock - ); - } - - // progress_handlers.fire - // fulfilled_handlers.fire - // rejected_handlers.fire - list.add( tuple[ 3 ].fire ); - - // deferred.notify = function() { deferred.notifyWith(...) } - // deferred.resolve = function() { deferred.resolveWith(...) } - // deferred.reject = function() { deferred.rejectWith(...) } - deferred[ tuple[ 0 ] ] = function() { - deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); - return this; - }; - - // deferred.notifyWith = list.fireWith - // deferred.resolveWith = list.fireWith - // deferred.rejectWith = list.fireWith - deferred[ tuple[ 0 ] + "With" ] = list.fireWith; - } ); - - // Make the deferred a promise - promise.promise( deferred ); - - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - - // All done! - return deferred; - }, - - // Deferred helper - when: function( singleValue ) { - var - - // count of uncompleted subordinates - remaining = arguments.length, - - // count of unprocessed arguments - i = remaining, - - // subordinate fulfillment data - resolveContexts = Array( i ), - resolveValues = slice.call( arguments ), - - // the primary Deferred - primary = jQuery.Deferred(), - - // subordinate callback factory - updateFunc = function( i ) { - return function( value ) { - resolveContexts[ i ] = this; - resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; - if ( !( --remaining ) ) { - primary.resolveWith( resolveContexts, resolveValues ); - } - }; - }; - - // Single- and empty arguments are adopted like Promise.resolve - if ( remaining <= 1 ) { - adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject, - !remaining ); - - // Use .then() to unwrap secondary thenables (cf. gh-3000) - if ( primary.state() === "pending" || - isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { - - return primary.then(); - } - } - - // Multiple arguments are aggregated like Promise.all array elements - while ( i-- ) { - adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject ); - } - - return primary.promise(); - } -} ); - - -// These usually indicate a programmer mistake during development, -// warn about them ASAP rather than swallowing them by default. -var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; - -jQuery.Deferred.exceptionHook = function( error, stack ) { - - // Support: IE 8 - 9 only - // Console exists when dev tools are open, which can happen at any time - if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { - window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); - } -}; - - - - -jQuery.readyException = function( error ) { - window.setTimeout( function() { - throw error; - } ); -}; - - - - -// The deferred used on DOM ready -var readyList = jQuery.Deferred(); - -jQuery.fn.ready = function( fn ) { - - readyList - .then( fn ) - - // Wrap jQuery.readyException in a function so that the lookup - // happens at the time of error handling instead of callback - // registration. - .catch( function( error ) { - jQuery.readyException( error ); - } ); - - return this; -}; - -jQuery.extend( { - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Handle when the DOM is ready - ready: function( wait ) { - - // Abort if there are pending holds or we're already ready - if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { - return; - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.resolveWith( document, [ jQuery ] ); - } -} ); - -jQuery.ready.then = readyList.then; - -// The ready event handler and self cleanup method -function completed() { - document.removeEventListener( "DOMContentLoaded", completed ); - window.removeEventListener( "load", completed ); - jQuery.ready(); -} - -// Catch cases where $(document).ready() is called -// after the browser event has already occurred. -// Support: IE <=9 - 10 only -// Older IE sometimes signals "interactive" too soon -if ( document.readyState === "complete" || - ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { - - // Handle it asynchronously to allow scripts the opportunity to delay ready - window.setTimeout( jQuery.ready ); - -} else { - - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", completed ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", completed ); -} - - - - -// Multifunctional method to get and set values of a collection -// The value/s can optionally be executed if it's a function -var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { - var i = 0, - len = elems.length, - bulk = key == null; - - // Sets many values - if ( toType( key ) === "object" ) { - chainable = true; - for ( i in key ) { - access( elems, fn, i, key[ i ], true, emptyGet, raw ); - } - - // Sets one value - } else if ( value !== undefined ) { - chainable = true; - - if ( !isFunction( value ) ) { - raw = true; - } - - if ( bulk ) { - - // Bulk operations run against the entire set - if ( raw ) { - fn.call( elems, value ); - fn = null; - - // ...except when executing function values - } else { - bulk = fn; - fn = function( elem, _key, value ) { - return bulk.call( jQuery( elem ), value ); - }; - } - } - - if ( fn ) { - for ( ; i < len; i++ ) { - fn( - elems[ i ], key, raw ? - value : - value.call( elems[ i ], i, fn( elems[ i ], key ) ) - ); - } - } - } - - if ( chainable ) { - return elems; - } - - // Gets - if ( bulk ) { - return fn.call( elems ); - } - - return len ? fn( elems[ 0 ], key ) : emptyGet; -}; - - -// Matches dashed string for camelizing -var rmsPrefix = /^-ms-/, - rdashAlpha = /-([a-z])/g; - -// Used by camelCase as callback to replace() -function fcamelCase( _all, letter ) { - return letter.toUpperCase(); -} - -// Convert dashed to camelCase; used by the css and data modules -// Support: IE <=9 - 11, Edge 12 - 15 -// Microsoft forgot to hump their vendor prefix (#9572) -function camelCase( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); -} -var acceptData = function( owner ) { - - // Accepts only: - // - Node - // - Node.ELEMENT_NODE - // - Node.DOCUMENT_NODE - // - Object - // - Any - return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); -}; - - - - -function Data() { - this.expando = jQuery.expando + Data.uid++; -} - -Data.uid = 1; - -Data.prototype = { - - cache: function( owner ) { - - // Check if the owner object already has a cache - var value = owner[ this.expando ]; - - // If not, create one - if ( !value ) { - value = {}; - - // We can accept data for non-element nodes in modern browsers, - // but we should not, see #8335. - // Always return an empty object. - if ( acceptData( owner ) ) { - - // If it is a node unlikely to be stringify-ed or looped over - // use plain assignment - if ( owner.nodeType ) { - owner[ this.expando ] = value; - - // Otherwise secure it in a non-enumerable property - // configurable must be true to allow the property to be - // deleted when data is removed - } else { - Object.defineProperty( owner, this.expando, { - value: value, - configurable: true - } ); - } - } - } - - return value; - }, - set: function( owner, data, value ) { - var prop, - cache = this.cache( owner ); - - // Handle: [ owner, key, value ] args - // Always use camelCase key (gh-2257) - if ( typeof data === "string" ) { - cache[ camelCase( data ) ] = value; - - // Handle: [ owner, { properties } ] args - } else { - - // Copy the properties one-by-one to the cache object - for ( prop in data ) { - cache[ camelCase( prop ) ] = data[ prop ]; - } - } - return cache; - }, - get: function( owner, key ) { - return key === undefined ? - this.cache( owner ) : - - // Always use camelCase key (gh-2257) - owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; - }, - access: function( owner, key, value ) { - - // In cases where either: - // - // 1. No key was specified - // 2. A string key was specified, but no value provided - // - // Take the "read" path and allow the get method to determine - // which value to return, respectively either: - // - // 1. The entire cache object - // 2. The data stored at the key - // - if ( key === undefined || - ( ( key && typeof key === "string" ) && value === undefined ) ) { - - return this.get( owner, key ); - } - - // When the key is not a string, or both a key and value - // are specified, set or extend (existing objects) with either: - // - // 1. An object of properties - // 2. A key and value - // - this.set( owner, key, value ); - - // Since the "set" path can have two possible entry points - // return the expected data based on which path was taken[*] - return value !== undefined ? value : key; - }, - remove: function( owner, key ) { - var i, - cache = owner[ this.expando ]; - - if ( cache === undefined ) { - return; - } - - if ( key !== undefined ) { - - // Support array or space separated string of keys - if ( Array.isArray( key ) ) { - - // If key is an array of keys... - // We always set camelCase keys, so remove that. - key = key.map( camelCase ); - } else { - key = camelCase( key ); - - // If a key with the spaces exists, use it. - // Otherwise, create an array by matching non-whitespace - key = key in cache ? - [ key ] : - ( key.match( rnothtmlwhite ) || [] ); - } - - i = key.length; - - while ( i-- ) { - delete cache[ key[ i ] ]; - } - } - - // Remove the expando if there's no more data - if ( key === undefined || jQuery.isEmptyObject( cache ) ) { - - // Support: Chrome <=35 - 45 - // Webkit & Blink performance suffers when deleting properties - // from DOM nodes, so set to undefined instead - // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) - if ( owner.nodeType ) { - owner[ this.expando ] = undefined; - } else { - delete owner[ this.expando ]; - } - } - }, - hasData: function( owner ) { - var cache = owner[ this.expando ]; - return cache !== undefined && !jQuery.isEmptyObject( cache ); - } -}; -var dataPriv = new Data(); - -var dataUser = new Data(); - - - -// Implementation Summary -// -// 1. Enforce API surface and semantic compatibility with 1.9.x branch -// 2. Improve the module's maintainability by reducing the storage -// paths to a single mechanism. -// 3. Use the same single mechanism to support "private" and "user" data. -// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) -// 5. Avoid exposing implementation details on user objects (eg. expando properties) -// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 - -var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, - rmultiDash = /[A-Z]/g; - -function getData( data ) { - if ( data === "true" ) { - return true; - } - - if ( data === "false" ) { - return false; - } - - if ( data === "null" ) { - return null; - } - - // Only convert to a number if it doesn't change the string - if ( data === +data + "" ) { - return +data; - } - - if ( rbrace.test( data ) ) { - return JSON.parse( data ); - } - - return data; -} - -function dataAttr( elem, key, data ) { - var name; - - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = getData( data ); - } catch ( e ) {} - - // Make sure we set the data so it isn't changed later - dataUser.set( elem, key, data ); - } else { - data = undefined; - } - } - return data; -} - -jQuery.extend( { - hasData: function( elem ) { - return dataUser.hasData( elem ) || dataPriv.hasData( elem ); - }, - - data: function( elem, name, data ) { - return dataUser.access( elem, name, data ); - }, - - removeData: function( elem, name ) { - dataUser.remove( elem, name ); - }, - - // TODO: Now that all calls to _data and _removeData have been replaced - // with direct calls to dataPriv methods, these can be deprecated. - _data: function( elem, name, data ) { - return dataPriv.access( elem, name, data ); - }, - - _removeData: function( elem, name ) { - dataPriv.remove( elem, name ); - } -} ); - -jQuery.fn.extend( { - data: function( key, value ) { - var i, name, data, - elem = this[ 0 ], - attrs = elem && elem.attributes; - - // Gets all values - if ( key === undefined ) { - if ( this.length ) { - data = dataUser.get( elem ); - - if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { - i = attrs.length; - while ( i-- ) { - - // Support: IE 11 only - // The attrs elements can be null (#14894) - if ( attrs[ i ] ) { - name = attrs[ i ].name; - if ( name.indexOf( "data-" ) === 0 ) { - name = camelCase( name.slice( 5 ) ); - dataAttr( elem, name, data[ name ] ); - } - } - } - dataPriv.set( elem, "hasDataAttrs", true ); - } - } - - return data; - } - - // Sets multiple values - if ( typeof key === "object" ) { - return this.each( function() { - dataUser.set( this, key ); - } ); - } - - return access( this, function( value ) { - var data; - - // The calling jQuery object (element matches) is not empty - // (and therefore has an element appears at this[ 0 ]) and the - // `value` parameter was not undefined. An empty jQuery object - // will result in `undefined` for elem = this[ 0 ] which will - // throw an exception if an attempt to read a data cache is made. - if ( elem && value === undefined ) { - - // Attempt to get data from the cache - // The key will always be camelCased in Data - data = dataUser.get( elem, key ); - if ( data !== undefined ) { - return data; - } - - // Attempt to "discover" the data in - // HTML5 custom data-* attrs - data = dataAttr( elem, key ); - if ( data !== undefined ) { - return data; - } - - // We tried really hard, but the data doesn't exist. - return; - } - - // Set the data... - this.each( function() { - - // We always store the camelCased key - dataUser.set( this, key, value ); - } ); - }, null, value, arguments.length > 1, null, true ); - }, - - removeData: function( key ) { - return this.each( function() { - dataUser.remove( this, key ); - } ); - } -} ); - - -jQuery.extend( { - queue: function( elem, type, data ) { - var queue; - - if ( elem ) { - type = ( type || "fx" ) + "queue"; - queue = dataPriv.get( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !queue || Array.isArray( data ) ) { - queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); - } else { - queue.push( data ); - } - } - return queue || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - startLength = queue.length, - fn = queue.shift(), - hooks = jQuery._queueHooks( elem, type ), - next = function() { - jQuery.dequeue( elem, type ); - }; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - startLength--; - } - - if ( fn ) { - - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } - - // Clear up the last queue stop function - delete hooks.stop; - fn.call( elem, next, hooks ); - } - - if ( !startLength && hooks ) { - hooks.empty.fire(); - } - }, - - // Not public - generate a queueHooks object, or return the current one - _queueHooks: function( elem, type ) { - var key = type + "queueHooks"; - return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { - empty: jQuery.Callbacks( "once memory" ).add( function() { - dataPriv.remove( elem, [ type + "queue", key ] ); - } ) - } ); - } -} ); - -jQuery.fn.extend( { - queue: function( type, data ) { - var setter = 2; - - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - setter--; - } - - if ( arguments.length < setter ) { - return jQuery.queue( this[ 0 ], type ); - } - - return data === undefined ? - this : - this.each( function() { - var queue = jQuery.queue( this, type, data ); - - // Ensure a hooks for this queue - jQuery._queueHooks( this, type ); - - if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - } ); - }, - dequeue: function( type ) { - return this.each( function() { - jQuery.dequeue( this, type ); - } ); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, obj ) { - var tmp, - count = 1, - defer = jQuery.Deferred(), - elements = this, - i = this.length, - resolve = function() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - }; - - if ( typeof type !== "string" ) { - obj = type; - type = undefined; - } - type = type || "fx"; - - while ( i-- ) { - tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); - if ( tmp && tmp.empty ) { - count++; - tmp.empty.add( resolve ); - } - } - resolve(); - return defer.promise( obj ); - } -} ); -var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; - -var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); - - -var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; - -var documentElement = document.documentElement; - - - - var isAttached = function( elem ) { - return jQuery.contains( elem.ownerDocument, elem ); - }, - composed = { composed: true }; - - // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only - // Check attachment across shadow DOM boundaries when possible (gh-3504) - // Support: iOS 10.0-10.2 only - // Early iOS 10 versions support `attachShadow` but not `getRootNode`, - // leading to errors. We need to check for `getRootNode`. - if ( documentElement.getRootNode ) { - isAttached = function( elem ) { - return jQuery.contains( elem.ownerDocument, elem ) || - elem.getRootNode( composed ) === elem.ownerDocument; - }; - } -var isHiddenWithinTree = function( elem, el ) { - - // isHiddenWithinTree might be called from jQuery#filter function; - // in that case, element will be second argument - elem = el || elem; - - // Inline style trumps all - return elem.style.display === "none" || - elem.style.display === "" && - - // Otherwise, check computed style - // Support: Firefox <=43 - 45 - // Disconnected elements can have computed display: none, so first confirm that elem is - // in the document. - isAttached( elem ) && - - jQuery.css( elem, "display" ) === "none"; - }; - - - -function adjustCSS( elem, prop, valueParts, tween ) { - var adjusted, scale, - maxIterations = 20, - currentValue = tween ? - function() { - return tween.cur(); - } : - function() { - return jQuery.css( elem, prop, "" ); - }, - initial = currentValue(), - unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), - - // Starting value computation is required for potential unit mismatches - initialInUnit = elem.nodeType && - ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && - rcssNum.exec( jQuery.css( elem, prop ) ); - - if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { - - // Support: Firefox <=54 - // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) - initial = initial / 2; - - // Trust units reported by jQuery.css - unit = unit || initialInUnit[ 3 ]; - - // Iteratively approximate from a nonzero starting point - initialInUnit = +initial || 1; - - while ( maxIterations-- ) { - - // Evaluate and update our best guess (doubling guesses that zero out). - // Finish if the scale equals or crosses 1 (making the old*new product non-positive). - jQuery.style( elem, prop, initialInUnit + unit ); - if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { - maxIterations = 0; - } - initialInUnit = initialInUnit / scale; - - } - - initialInUnit = initialInUnit * 2; - jQuery.style( elem, prop, initialInUnit + unit ); - - // Make sure we update the tween properties later on - valueParts = valueParts || []; - } - - if ( valueParts ) { - initialInUnit = +initialInUnit || +initial || 0; - - // Apply relative offset (+=/-=) if specified - adjusted = valueParts[ 1 ] ? - initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : - +valueParts[ 2 ]; - if ( tween ) { - tween.unit = unit; - tween.start = initialInUnit; - tween.end = adjusted; - } - } - return adjusted; -} - - -var defaultDisplayMap = {}; - -function getDefaultDisplay( elem ) { - var temp, - doc = elem.ownerDocument, - nodeName = elem.nodeName, - display = defaultDisplayMap[ nodeName ]; - - if ( display ) { - return display; - } - - temp = doc.body.appendChild( doc.createElement( nodeName ) ); - display = jQuery.css( temp, "display" ); - - temp.parentNode.removeChild( temp ); - - if ( display === "none" ) { - display = "block"; - } - defaultDisplayMap[ nodeName ] = display; - - return display; -} - -function showHide( elements, show ) { - var display, elem, - values = [], - index = 0, - length = elements.length; - - // Determine new display value for elements that need to change - for ( ; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - - display = elem.style.display; - if ( show ) { - - // Since we force visibility upon cascade-hidden elements, an immediate (and slow) - // check is required in this first loop unless we have a nonempty display value (either - // inline or about-to-be-restored) - if ( display === "none" ) { - values[ index ] = dataPriv.get( elem, "display" ) || null; - if ( !values[ index ] ) { - elem.style.display = ""; - } - } - if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { - values[ index ] = getDefaultDisplay( elem ); - } - } else { - if ( display !== "none" ) { - values[ index ] = "none"; - - // Remember what we're overwriting - dataPriv.set( elem, "display", display ); - } - } - } - - // Set the display of the elements in a second loop to avoid constant reflow - for ( index = 0; index < length; index++ ) { - if ( values[ index ] != null ) { - elements[ index ].style.display = values[ index ]; - } - } - - return elements; -} - -jQuery.fn.extend( { - show: function() { - return showHide( this, true ); - }, - hide: function() { - return showHide( this ); - }, - toggle: function( state ) { - if ( typeof state === "boolean" ) { - return state ? this.show() : this.hide(); - } - - return this.each( function() { - if ( isHiddenWithinTree( this ) ) { - jQuery( this ).show(); - } else { - jQuery( this ).hide(); - } - } ); - } -} ); -var rcheckableType = ( /^(?:checkbox|radio)$/i ); - -var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i ); - -var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); - - - -( function() { - var fragment = document.createDocumentFragment(), - div = fragment.appendChild( document.createElement( "div" ) ), - input = document.createElement( "input" ); - - // Support: Android 4.0 - 4.3 only - // Check state lost if the name is set (#11217) - // Support: Windows Web Apps (WWA) - // `name` and `type` must use .setAttribute for WWA (#14901) - input.setAttribute( "type", "radio" ); - input.setAttribute( "checked", "checked" ); - input.setAttribute( "name", "t" ); - - div.appendChild( input ); - - // Support: Android <=4.1 only - // Older WebKit doesn't clone checked state correctly in fragments - support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Support: IE <=11 only - // Make sure textarea (and checkbox) defaultValue is properly cloned - div.innerHTML = ""; - support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; - - // Support: IE <=9 only - // IE <=9 replaces "; - support.option = !!div.lastChild; -} )(); - - -// We have to close these tags to support XHTML (#13200) -var wrapMap = { - - // XHTML parsers do not magically insert elements in the - // same way that tag soup parsers do. So we cannot shorten - // this by omitting or other required elements. - thead: [ 1, "", "
    " ], - col: [ 2, "", "
    " ], - tr: [ 2, "", "
    " ], - td: [ 3, "", "
    " ], - - _default: [ 0, "", "" ] -}; - -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -// Support: IE <=9 only -if ( !support.option ) { - wrapMap.optgroup = wrapMap.option = [ 1, "" ]; -} - - -function getAll( context, tag ) { - - // Support: IE <=9 - 11 only - // Use typeof to avoid zero-argument method invocation on host objects (#15151) - var ret; - - if ( typeof context.getElementsByTagName !== "undefined" ) { - ret = context.getElementsByTagName( tag || "*" ); - - } else if ( typeof context.querySelectorAll !== "undefined" ) { - ret = context.querySelectorAll( tag || "*" ); - - } else { - ret = []; - } - - if ( tag === undefined || tag && nodeName( context, tag ) ) { - return jQuery.merge( [ context ], ret ); - } - - return ret; -} - - -// Mark scripts as having already been evaluated -function setGlobalEval( elems, refElements ) { - var i = 0, - l = elems.length; - - for ( ; i < l; i++ ) { - dataPriv.set( - elems[ i ], - "globalEval", - !refElements || dataPriv.get( refElements[ i ], "globalEval" ) - ); - } -} - - -var rhtml = /<|&#?\w+;/; - -function buildFragment( elems, context, scripts, selection, ignored ) { - var elem, tmp, tag, wrap, attached, j, - fragment = context.createDocumentFragment(), - nodes = [], - i = 0, - l = elems.length; - - for ( ; i < l; i++ ) { - elem = elems[ i ]; - - if ( elem || elem === 0 ) { - - // Add nodes directly - if ( toType( elem ) === "object" ) { - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); - - // Convert non-html into a text node - } else if ( !rhtml.test( elem ) ) { - nodes.push( context.createTextNode( elem ) ); - - // Convert html into DOM nodes - } else { - tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); - - // Deserialize a standard representation - tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); - wrap = wrapMap[ tag ] || wrapMap._default; - tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; - - // Descend through wrappers to the right content - j = wrap[ 0 ]; - while ( j-- ) { - tmp = tmp.lastChild; - } - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - jQuery.merge( nodes, tmp.childNodes ); - - // Remember the top-level container - tmp = fragment.firstChild; - - // Ensure the created nodes are orphaned (#12392) - tmp.textContent = ""; - } - } - } - - // Remove wrapper from fragment - fragment.textContent = ""; - - i = 0; - while ( ( elem = nodes[ i++ ] ) ) { - - // Skip elements already in the context collection (trac-4087) - if ( selection && jQuery.inArray( elem, selection ) > -1 ) { - if ( ignored ) { - ignored.push( elem ); - } - continue; - } - - attached = isAttached( elem ); - - // Append to fragment - tmp = getAll( fragment.appendChild( elem ), "script" ); - - // Preserve script evaluation history - if ( attached ) { - setGlobalEval( tmp ); - } - - // Capture executables - if ( scripts ) { - j = 0; - while ( ( elem = tmp[ j++ ] ) ) { - if ( rscriptType.test( elem.type || "" ) ) { - scripts.push( elem ); - } - } - } - } - - return fragment; -} - - -var rtypenamespace = /^([^.]*)(?:\.(.+)|)/; - -function returnTrue() { - return true; -} - -function returnFalse() { - return false; -} - -// Support: IE <=9 - 11+ -// focus() and blur() are asynchronous, except when they are no-op. -// So expect focus to be synchronous when the element is already active, -// and blur to be synchronous when the element is not already active. -// (focus and blur are always synchronous in other supported browsers, -// this just defines when we can count on it). -function expectSync( elem, type ) { - return ( elem === safeActiveElement() ) === ( type === "focus" ); -} - -// Support: IE <=9 only -// Accessing document.activeElement can throw unexpectedly -// https://bugs.jquery.com/ticket/13393 -function safeActiveElement() { - try { - return document.activeElement; - } catch ( err ) { } -} - -function on( elem, types, selector, data, fn, one ) { - var origFn, type; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { - - // ( types-Object, data ) - data = data || selector; - selector = undefined; - } - for ( type in types ) { - on( elem, type, selector, data, types[ type ], one ); - } - return elem; - } - - if ( data == null && fn == null ) { - - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return elem; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return elem.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - } ); -} - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - global: {}, - - add: function( elem, types, handler, data, selector ) { - - var handleObjIn, eventHandle, tmp, - events, t, handleObj, - special, handlers, type, namespaces, origType, - elemData = dataPriv.get( elem ); - - // Only attach events to objects that accept data - if ( !acceptData( elem ) ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - selector = handleObjIn.selector; - } - - // Ensure that invalid selectors throw exceptions at attach time - // Evaluate against documentElement in case elem is a non-element node (e.g., document) - if ( selector ) { - jQuery.find.matchesSelector( documentElement, selector ); - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - if ( !( events = elemData.events ) ) { - events = elemData.events = Object.create( null ); - } - if ( !( eventHandle = elemData.handle ) ) { - eventHandle = elemData.handle = function( e ) { - - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? - jQuery.event.dispatch.apply( elem, arguments ) : undefined; - }; - } - - // Handle multiple events separated by a space - types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[ t ] ) || []; - type = origType = tmp[ 1 ]; - namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); - - // There *must* be a type, no attaching namespace-only handlers - if ( !type ) { - continue; - } - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend( { - type: type, - origType: origType, - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - needsContext: selector && jQuery.expr.match.needsContext.test( selector ), - namespace: namespaces.join( "." ) - }, handleObjIn ); - - // Init the event handler queue if we're the first - if ( !( handlers = events[ type ] ) ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener if the special events handler returns false - if ( !special.setup || - special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - }, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - - var j, origCount, tmp, - events, t, handleObj, - special, handlers, type, namespaces, origType, - elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); - - if ( !elemData || !( events = elemData.events ) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[ t ] ) || []; - type = origType = tmp[ 1 ]; - namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector ? special.delegateType : special.bindType ) || type; - handlers = events[ type ] || []; - tmp = tmp[ 2 ] && - new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); - - // Remove matching events - origCount = j = handlers.length; - while ( j-- ) { - handleObj = handlers[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !tmp || tmp.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || - selector === "**" && handleObj.selector ) ) { - handlers.splice( j, 1 ); - - if ( handleObj.selector ) { - handlers.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( origCount && !handlers.length ) { - if ( !special.teardown || - special.teardown.call( elem, namespaces, elemData.handle ) === false ) { - - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove data and the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - dataPriv.remove( elem, "handle events" ); - } - }, - - dispatch: function( nativeEvent ) { - - var i, j, ret, matched, handleObj, handlerQueue, - args = new Array( arguments.length ), - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( nativeEvent ), - - handlers = ( - dataPriv.get( this, "events" ) || Object.create( null ) - )[ event.type ] || [], - special = jQuery.event.special[ event.type ] || {}; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[ 0 ] = event; - - for ( i = 1; i < arguments.length; i++ ) { - args[ i ] = arguments[ i ]; - } - - event.delegateTarget = this; - - // Call the preDispatch hook for the mapped type, and let it bail if desired - if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { - return; - } - - // Determine handlers - handlerQueue = jQuery.event.handlers.call( this, event, handlers ); - - // Run delegates first; they may want to stop propagation beneath us - i = 0; - while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { - event.currentTarget = matched.elem; - - j = 0; - while ( ( handleObj = matched.handlers[ j++ ] ) && - !event.isImmediatePropagationStopped() ) { - - // If the event is namespaced, then each handler is only invoked if it is - // specially universal or its namespaces are a superset of the event's. - if ( !event.rnamespace || handleObj.namespace === false || - event.rnamespace.test( handleObj.namespace ) ) { - - event.handleObj = handleObj; - event.data = handleObj.data; - - ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || - handleObj.handler ).apply( matched.elem, args ); - - if ( ret !== undefined ) { - if ( ( event.result = ret ) === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - // Call the postDispatch hook for the mapped type - if ( special.postDispatch ) { - special.postDispatch.call( this, event ); - } - - return event.result; - }, - - handlers: function( event, handlers ) { - var i, handleObj, sel, matchedHandlers, matchedSelectors, - handlerQueue = [], - delegateCount = handlers.delegateCount, - cur = event.target; - - // Find delegate handlers - if ( delegateCount && - - // Support: IE <=9 - // Black-hole SVG instance trees (trac-13180) - cur.nodeType && - - // Support: Firefox <=42 - // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) - // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click - // Support: IE 11 only - // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) - !( event.type === "click" && event.button >= 1 ) ) { - - for ( ; cur !== this; cur = cur.parentNode || this ) { - - // Don't check non-elements (#13208) - // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) - if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { - matchedHandlers = []; - matchedSelectors = {}; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - - // Don't conflict with Object.prototype properties (#13203) - sel = handleObj.selector + " "; - - if ( matchedSelectors[ sel ] === undefined ) { - matchedSelectors[ sel ] = handleObj.needsContext ? - jQuery( sel, this ).index( cur ) > -1 : - jQuery.find( sel, this, null, [ cur ] ).length; - } - if ( matchedSelectors[ sel ] ) { - matchedHandlers.push( handleObj ); - } - } - if ( matchedHandlers.length ) { - handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); - } - } - } - } - - // Add the remaining (directly-bound) handlers - cur = this; - if ( delegateCount < handlers.length ) { - handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); - } - - return handlerQueue; - }, - - addProp: function( name, hook ) { - Object.defineProperty( jQuery.Event.prototype, name, { - enumerable: true, - configurable: true, - - get: isFunction( hook ) ? - function() { - if ( this.originalEvent ) { - return hook( this.originalEvent ); - } - } : - function() { - if ( this.originalEvent ) { - return this.originalEvent[ name ]; - } - }, - - set: function( value ) { - Object.defineProperty( this, name, { - enumerable: true, - configurable: true, - writable: true, - value: value - } ); - } - } ); - }, - - fix: function( originalEvent ) { - return originalEvent[ jQuery.expando ] ? - originalEvent : - new jQuery.Event( originalEvent ); - }, - - special: { - load: { - - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - click: { - - // Utilize native event to ensure correct state for checkable inputs - setup: function( data ) { - - // For mutual compressibility with _default, replace `this` access with a local var. - // `|| data` is dead code meant only to preserve the variable through minification. - var el = this || data; - - // Claim the first handler - if ( rcheckableType.test( el.type ) && - el.click && nodeName( el, "input" ) ) { - - // dataPriv.set( el, "click", ... ) - leverageNative( el, "click", returnTrue ); - } - - // Return false to allow normal processing in the caller - return false; - }, - trigger: function( data ) { - - // For mutual compressibility with _default, replace `this` access with a local var. - // `|| data` is dead code meant only to preserve the variable through minification. - var el = this || data; - - // Force setup before triggering a click - if ( rcheckableType.test( el.type ) && - el.click && nodeName( el, "input" ) ) { - - leverageNative( el, "click" ); - } - - // Return non-false to allow normal event-path propagation - return true; - }, - - // For cross-browser consistency, suppress native .click() on links - // Also prevent it if we're currently inside a leveraged native-event stack - _default: function( event ) { - var target = event.target; - return rcheckableType.test( target.type ) && - target.click && nodeName( target, "input" ) && - dataPriv.get( target, "click" ) || - nodeName( target, "a" ); - } - }, - - beforeunload: { - postDispatch: function( event ) { - - // Support: Firefox 20+ - // Firefox doesn't alert if the returnValue field is not set. - if ( event.result !== undefined && event.originalEvent ) { - event.originalEvent.returnValue = event.result; - } - } - } - } -}; - -// Ensure the presence of an event listener that handles manually-triggered -// synthetic events by interrupting progress until reinvoked in response to -// *native* events that it fires directly, ensuring that state changes have -// already occurred before other listeners are invoked. -function leverageNative( el, type, expectSync ) { - - // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add - if ( !expectSync ) { - if ( dataPriv.get( el, type ) === undefined ) { - jQuery.event.add( el, type, returnTrue ); - } - return; - } - - // Register the controller as a special universal handler for all event namespaces - dataPriv.set( el, type, false ); - jQuery.event.add( el, type, { - namespace: false, - handler: function( event ) { - var notAsync, result, - saved = dataPriv.get( this, type ); - - if ( ( event.isTrigger & 1 ) && this[ type ] ) { - - // Interrupt processing of the outer synthetic .trigger()ed event - // Saved data should be false in such cases, but might be a leftover capture object - // from an async native handler (gh-4350) - if ( !saved.length ) { - - // Store arguments for use when handling the inner native event - // There will always be at least one argument (an event object), so this array - // will not be confused with a leftover capture object. - saved = slice.call( arguments ); - dataPriv.set( this, type, saved ); - - // Trigger the native event and capture its result - // Support: IE <=9 - 11+ - // focus() and blur() are asynchronous - notAsync = expectSync( this, type ); - this[ type ](); - result = dataPriv.get( this, type ); - if ( saved !== result || notAsync ) { - dataPriv.set( this, type, false ); - } else { - result = {}; - } - if ( saved !== result ) { - - // Cancel the outer synthetic event - event.stopImmediatePropagation(); - event.preventDefault(); - - // Support: Chrome 86+ - // In Chrome, if an element having a focusout handler is blurred by - // clicking outside of it, it invokes the handler synchronously. If - // that handler calls `.remove()` on the element, the data is cleared, - // leaving `result` undefined. We need to guard against this. - return result && result.value; - } - - // If this is an inner synthetic event for an event with a bubbling surrogate - // (focus or blur), assume that the surrogate already propagated from triggering the - // native event and prevent that from happening again here. - // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the - // bubbling surrogate propagates *after* the non-bubbling base), but that seems - // less bad than duplication. - } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { - event.stopPropagation(); - } - - // If this is a native event triggered above, everything is now in order - // Fire an inner synthetic event with the original arguments - } else if ( saved.length ) { - - // ...and capture the result - dataPriv.set( this, type, { - value: jQuery.event.trigger( - - // Support: IE <=9 - 11+ - // Extend with the prototype to reset the above stopImmediatePropagation() - jQuery.extend( saved[ 0 ], jQuery.Event.prototype ), - saved.slice( 1 ), - this - ) - } ); - - // Abort handling of the native event - event.stopImmediatePropagation(); - } - } - } ); -} - -jQuery.removeEvent = function( elem, type, handle ) { - - // This "if" is needed for plain objects - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle ); - } -}; - -jQuery.Event = function( src, props ) { - - // Allow instantiation without the 'new' keyword - if ( !( this instanceof jQuery.Event ) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = src.defaultPrevented || - src.defaultPrevented === undefined && - - // Support: Android <=2.3 only - src.returnValue === false ? - returnTrue : - returnFalse; - - // Create target properties - // Support: Safari <=6 - 7 only - // Target should not be a text node (#504, #13143) - this.target = ( src.target && src.target.nodeType === 3 ) ? - src.target.parentNode : - src.target; - - this.currentTarget = src.currentTarget; - this.relatedTarget = src.relatedTarget; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || Date.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - constructor: jQuery.Event, - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse, - isSimulated: false, - - preventDefault: function() { - var e = this.originalEvent; - - this.isDefaultPrevented = returnTrue; - - if ( e && !this.isSimulated ) { - e.preventDefault(); - } - }, - stopPropagation: function() { - var e = this.originalEvent; - - this.isPropagationStopped = returnTrue; - - if ( e && !this.isSimulated ) { - e.stopPropagation(); - } - }, - stopImmediatePropagation: function() { - var e = this.originalEvent; - - this.isImmediatePropagationStopped = returnTrue; - - if ( e && !this.isSimulated ) { - e.stopImmediatePropagation(); - } - - this.stopPropagation(); - } -}; - -// Includes all common event props including KeyEvent and MouseEvent specific props -jQuery.each( { - altKey: true, - bubbles: true, - cancelable: true, - changedTouches: true, - ctrlKey: true, - detail: true, - eventPhase: true, - metaKey: true, - pageX: true, - pageY: true, - shiftKey: true, - view: true, - "char": true, - code: true, - charCode: true, - key: true, - keyCode: true, - button: true, - buttons: true, - clientX: true, - clientY: true, - offsetX: true, - offsetY: true, - pointerId: true, - pointerType: true, - screenX: true, - screenY: true, - targetTouches: true, - toElement: true, - touches: true, - which: true -}, jQuery.event.addProp ); - -jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { - jQuery.event.special[ type ] = { - - // Utilize native event if possible so blur/focus sequence is correct - setup: function() { - - // Claim the first handler - // dataPriv.set( this, "focus", ... ) - // dataPriv.set( this, "blur", ... ) - leverageNative( this, type, expectSync ); - - // Return false to allow normal processing in the caller - return false; - }, - trigger: function() { - - // Force setup before trigger - leverageNative( this, type ); - - // Return non-false to allow normal event-path propagation - return true; - }, - - // Suppress native focus or blur as it's already being fired - // in leverageNative. - _default: function() { - return true; - }, - - delegateType: delegateType - }; -} ); - -// Create mouseenter/leave events using mouseover/out and event-time checks -// so that event delegation works in jQuery. -// Do the same for pointerenter/pointerleave and pointerover/pointerout -// -// Support: Safari 7 only -// Safari sends mouseenter too often; see: -// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 -// for the description of the bug (it existed in older Chrome versions as well). -jQuery.each( { - mouseenter: "mouseover", - mouseleave: "mouseout", - pointerenter: "pointerover", - pointerleave: "pointerout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var ret, - target = this, - related = event.relatedTarget, - handleObj = event.handleObj; - - // For mouseenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -} ); - -jQuery.fn.extend( { - - on: function( types, selector, data, fn ) { - return on( this, types, selector, data, fn ); - }, - one: function( types, selector, data, fn ) { - return on( this, types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - var handleObj, type; - if ( types && types.preventDefault && types.handleObj ) { - - // ( event ) dispatched jQuery.Event - handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace ? - handleObj.origType + "." + handleObj.namespace : - handleObj.origType, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - - // ( types-object [, selector] ) - for ( type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each( function() { - jQuery.event.remove( this, types, fn, selector ); - } ); - } -} ); - - -var - - // Support: IE <=10 - 11, Edge 12 - 13 only - // In IE/Edge using regex groups here causes severe slowdowns. - // See https://connect.microsoft.com/IE/feedback/details/1736512/ - rnoInnerhtml = /\s*$/g; - -// Prefer a tbody over its parent table for containing new rows -function manipulationTarget( elem, content ) { - if ( nodeName( elem, "table" ) && - nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { - - return jQuery( elem ).children( "tbody" )[ 0 ] || elem; - } - - return elem; -} - -// Replace/restore the type attribute of script elements for safe DOM manipulation -function disableScript( elem ) { - elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; - return elem; -} -function restoreScript( elem ) { - if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { - elem.type = elem.type.slice( 5 ); - } else { - elem.removeAttribute( "type" ); - } - - return elem; -} - -function cloneCopyEvent( src, dest ) { - var i, l, type, pdataOld, udataOld, udataCur, events; - - if ( dest.nodeType !== 1 ) { - return; - } - - // 1. Copy private data: events, handlers, etc. - if ( dataPriv.hasData( src ) ) { - pdataOld = dataPriv.get( src ); - events = pdataOld.events; - - if ( events ) { - dataPriv.remove( dest, "handle events" ); - - for ( type in events ) { - for ( i = 0, l = events[ type ].length; i < l; i++ ) { - jQuery.event.add( dest, type, events[ type ][ i ] ); - } - } - } - } - - // 2. Copy user data - if ( dataUser.hasData( src ) ) { - udataOld = dataUser.access( src ); - udataCur = jQuery.extend( {}, udataOld ); - - dataUser.set( dest, udataCur ); - } -} - -// Fix IE bugs, see support tests -function fixInput( src, dest ) { - var nodeName = dest.nodeName.toLowerCase(); - - // Fails to persist the checked state of a cloned checkbox or radio button. - if ( nodeName === "input" && rcheckableType.test( src.type ) ) { - dest.checked = src.checked; - - // Fails to return the selected option to the default selected state when cloning options - } else if ( nodeName === "input" || nodeName === "textarea" ) { - dest.defaultValue = src.defaultValue; - } -} - -function domManip( collection, args, callback, ignored ) { - - // Flatten any nested arrays - args = flat( args ); - - var fragment, first, scripts, hasScripts, node, doc, - i = 0, - l = collection.length, - iNoClone = l - 1, - value = args[ 0 ], - valueIsFunction = isFunction( value ); - - // We can't cloneNode fragments that contain checked, in WebKit - if ( valueIsFunction || - ( l > 1 && typeof value === "string" && - !support.checkClone && rchecked.test( value ) ) ) { - return collection.each( function( index ) { - var self = collection.eq( index ); - if ( valueIsFunction ) { - args[ 0 ] = value.call( this, index, self.html() ); - } - domManip( self, args, callback, ignored ); - } ); - } - - if ( l ) { - fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); - first = fragment.firstChild; - - if ( fragment.childNodes.length === 1 ) { - fragment = first; - } - - // Require either new content or an interest in ignored elements to invoke the callback - if ( first || ignored ) { - scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); - hasScripts = scripts.length; - - // Use the original fragment for the last item - // instead of the first because it can end up - // being emptied incorrectly in certain situations (#8070). - for ( ; i < l; i++ ) { - node = fragment; - - if ( i !== iNoClone ) { - node = jQuery.clone( node, true, true ); - - // Keep references to cloned scripts for later restoration - if ( hasScripts ) { - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - jQuery.merge( scripts, getAll( node, "script" ) ); - } - } - - callback.call( collection[ i ], node, i ); - } - - if ( hasScripts ) { - doc = scripts[ scripts.length - 1 ].ownerDocument; - - // Reenable scripts - jQuery.map( scripts, restoreScript ); - - // Evaluate executable scripts on first document insertion - for ( i = 0; i < hasScripts; i++ ) { - node = scripts[ i ]; - if ( rscriptType.test( node.type || "" ) && - !dataPriv.access( node, "globalEval" ) && - jQuery.contains( doc, node ) ) { - - if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { - - // Optional AJAX dependency, but won't run scripts if not present - if ( jQuery._evalUrl && !node.noModule ) { - jQuery._evalUrl( node.src, { - nonce: node.nonce || node.getAttribute( "nonce" ) - }, doc ); - } - } else { - DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); - } - } - } - } - } - } - - return collection; -} - -function remove( elem, selector, keepData ) { - var node, - nodes = selector ? jQuery.filter( selector, elem ) : elem, - i = 0; - - for ( ; ( node = nodes[ i ] ) != null; i++ ) { - if ( !keepData && node.nodeType === 1 ) { - jQuery.cleanData( getAll( node ) ); - } - - if ( node.parentNode ) { - if ( keepData && isAttached( node ) ) { - setGlobalEval( getAll( node, "script" ) ); - } - node.parentNode.removeChild( node ); - } - } - - return elem; -} - -jQuery.extend( { - htmlPrefilter: function( html ) { - return html; - }, - - clone: function( elem, dataAndEvents, deepDataAndEvents ) { - var i, l, srcElements, destElements, - clone = elem.cloneNode( true ), - inPage = isAttached( elem ); - - // Fix IE cloning issues - if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && - !jQuery.isXMLDoc( elem ) ) { - - // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 - destElements = getAll( clone ); - srcElements = getAll( elem ); - - for ( i = 0, l = srcElements.length; i < l; i++ ) { - fixInput( srcElements[ i ], destElements[ i ] ); - } - } - - // Copy the events from the original to the clone - if ( dataAndEvents ) { - if ( deepDataAndEvents ) { - srcElements = srcElements || getAll( elem ); - destElements = destElements || getAll( clone ); - - for ( i = 0, l = srcElements.length; i < l; i++ ) { - cloneCopyEvent( srcElements[ i ], destElements[ i ] ); - } - } else { - cloneCopyEvent( elem, clone ); - } - } - - // Preserve script evaluation history - destElements = getAll( clone, "script" ); - if ( destElements.length > 0 ) { - setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); - } - - // Return the cloned set - return clone; - }, - - cleanData: function( elems ) { - var data, elem, type, - special = jQuery.event.special, - i = 0; - - for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { - if ( acceptData( elem ) ) { - if ( ( data = elem[ dataPriv.expando ] ) ) { - if ( data.events ) { - for ( type in data.events ) { - if ( special[ type ] ) { - jQuery.event.remove( elem, type ); - - // This is a shortcut to avoid jQuery.event.remove's overhead - } else { - jQuery.removeEvent( elem, type, data.handle ); - } - } - } - - // Support: Chrome <=35 - 45+ - // Assign undefined instead of using delete, see Data#remove - elem[ dataPriv.expando ] = undefined; - } - if ( elem[ dataUser.expando ] ) { - - // Support: Chrome <=35 - 45+ - // Assign undefined instead of using delete, see Data#remove - elem[ dataUser.expando ] = undefined; - } - } - } - } -} ); - -jQuery.fn.extend( { - detach: function( selector ) { - return remove( this, selector, true ); - }, - - remove: function( selector ) { - return remove( this, selector ); - }, - - text: function( value ) { - return access( this, function( value ) { - return value === undefined ? - jQuery.text( this ) : - this.empty().each( function() { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - this.textContent = value; - } - } ); - }, null, value, arguments.length ); - }, - - append: function() { - return domManip( this, arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.appendChild( elem ); - } - } ); - }, - - prepend: function() { - return domManip( this, arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.insertBefore( elem, target.firstChild ); - } - } ); - }, - - before: function() { - return domManip( this, arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this ); - } - } ); - }, - - after: function() { - return domManip( this, arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this.nextSibling ); - } - } ); - }, - - empty: function() { - var elem, - i = 0; - - for ( ; ( elem = this[ i ] ) != null; i++ ) { - if ( elem.nodeType === 1 ) { - - // Prevent memory leaks - jQuery.cleanData( getAll( elem, false ) ); - - // Remove any remaining nodes - elem.textContent = ""; - } - } - - return this; - }, - - clone: function( dataAndEvents, deepDataAndEvents ) { - dataAndEvents = dataAndEvents == null ? false : dataAndEvents; - deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; - - return this.map( function() { - return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); - } ); - }, - - html: function( value ) { - return access( this, function( value ) { - var elem = this[ 0 ] || {}, - i = 0, - l = this.length; - - if ( value === undefined && elem.nodeType === 1 ) { - return elem.innerHTML; - } - - // See if we can take a shortcut and just use innerHTML - if ( typeof value === "string" && !rnoInnerhtml.test( value ) && - !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { - - value = jQuery.htmlPrefilter( value ); - - try { - for ( ; i < l; i++ ) { - elem = this[ i ] || {}; - - // Remove element nodes and prevent memory leaks - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - elem.innerHTML = value; - } - } - - elem = 0; - - // If using innerHTML throws an exception, use the fallback method - } catch ( e ) {} - } - - if ( elem ) { - this.empty().append( value ); - } - }, null, value, arguments.length ); - }, - - replaceWith: function() { - var ignored = []; - - // Make the changes, replacing each non-ignored context element with the new content - return domManip( this, arguments, function( elem ) { - var parent = this.parentNode; - - if ( jQuery.inArray( this, ignored ) < 0 ) { - jQuery.cleanData( getAll( this ) ); - if ( parent ) { - parent.replaceChild( elem, this ); - } - } - - // Force callback invocation - }, ignored ); - } -} ); - -jQuery.each( { - appendTo: "append", - prependTo: "prepend", - insertBefore: "before", - insertAfter: "after", - replaceAll: "replaceWith" -}, function( name, original ) { - jQuery.fn[ name ] = function( selector ) { - var elems, - ret = [], - insert = jQuery( selector ), - last = insert.length - 1, - i = 0; - - for ( ; i <= last; i++ ) { - elems = i === last ? this : this.clone( true ); - jQuery( insert[ i ] )[ original ]( elems ); - - // Support: Android <=4.0 only, PhantomJS 1 only - // .get() because push.apply(_, arraylike) throws on ancient WebKit - push.apply( ret, elems.get() ); - } - - return this.pushStack( ret ); - }; -} ); -var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); - -var getStyles = function( elem ) { - - // Support: IE <=11 only, Firefox <=30 (#15098, #14150) - // IE throws on elements created in popups - // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" - var view = elem.ownerDocument.defaultView; - - if ( !view || !view.opener ) { - view = window; - } - - return view.getComputedStyle( elem ); - }; - -var swap = function( elem, options, callback ) { - var ret, name, - old = {}; - - // Remember the old values, and insert the new ones - for ( name in options ) { - old[ name ] = elem.style[ name ]; - elem.style[ name ] = options[ name ]; - } - - ret = callback.call( elem ); - - // Revert the old values - for ( name in options ) { - elem.style[ name ] = old[ name ]; - } - - return ret; -}; - - -var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); - - - -( function() { - - // Executing both pixelPosition & boxSizingReliable tests require only one layout - // so they're executed at the same time to save the second computation. - function computeStyleTests() { - - // This is a singleton, we need to execute it only once - if ( !div ) { - return; - } - - container.style.cssText = "position:absolute;left:-11111px;width:60px;" + - "margin-top:1px;padding:0;border:0"; - div.style.cssText = - "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + - "margin:auto;border:1px;padding:1px;" + - "width:60%;top:1%"; - documentElement.appendChild( container ).appendChild( div ); - - var divStyle = window.getComputedStyle( div ); - pixelPositionVal = divStyle.top !== "1%"; - - // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 - reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; - - // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 - // Some styles come back with percentage values, even though they shouldn't - div.style.right = "60%"; - pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; - - // Support: IE 9 - 11 only - // Detect misreporting of content dimensions for box-sizing:border-box elements - boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; - - // Support: IE 9 only - // Detect overflow:scroll screwiness (gh-3699) - // Support: Chrome <=64 - // Don't get tricked when zoom affects offsetWidth (gh-4029) - div.style.position = "absolute"; - scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12; - - documentElement.removeChild( container ); - - // Nullify the div so it wouldn't be stored in the memory and - // it will also be a sign that checks already performed - div = null; - } - - function roundPixelMeasures( measure ) { - return Math.round( parseFloat( measure ) ); - } - - var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, - reliableTrDimensionsVal, reliableMarginLeftVal, - container = document.createElement( "div" ), - div = document.createElement( "div" ); - - // Finish early in limited (non-browser) environments - if ( !div.style ) { - return; - } - - // Support: IE <=9 - 11 only - // Style of cloned element affects source element cloned (#8908) - div.style.backgroundClip = "content-box"; - div.cloneNode( true ).style.backgroundClip = ""; - support.clearCloneStyle = div.style.backgroundClip === "content-box"; - - jQuery.extend( support, { - boxSizingReliable: function() { - computeStyleTests(); - return boxSizingReliableVal; - }, - pixelBoxStyles: function() { - computeStyleTests(); - return pixelBoxStylesVal; - }, - pixelPosition: function() { - computeStyleTests(); - return pixelPositionVal; - }, - reliableMarginLeft: function() { - computeStyleTests(); - return reliableMarginLeftVal; - }, - scrollboxSize: function() { - computeStyleTests(); - return scrollboxSizeVal; - }, - - // Support: IE 9 - 11+, Edge 15 - 18+ - // IE/Edge misreport `getComputedStyle` of table rows with width/height - // set in CSS while `offset*` properties report correct values. - // Behavior in IE 9 is more subtle than in newer versions & it passes - // some versions of this test; make sure not to make it pass there! - // - // Support: Firefox 70+ - // Only Firefox includes border widths - // in computed dimensions. (gh-4529) - reliableTrDimensions: function() { - var table, tr, trChild, trStyle; - if ( reliableTrDimensionsVal == null ) { - table = document.createElement( "table" ); - tr = document.createElement( "tr" ); - trChild = document.createElement( "div" ); - - table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; - tr.style.cssText = "border:1px solid"; - - // Support: Chrome 86+ - // Height set through cssText does not get applied. - // Computed height then comes back as 0. - tr.style.height = "1px"; - trChild.style.height = "9px"; - - // Support: Android 8 Chrome 86+ - // In our bodyBackground.html iframe, - // display for all div elements is set to "inline", - // which causes a problem only in Android 8 Chrome 86. - // Ensuring the div is display: block - // gets around this issue. - trChild.style.display = "block"; - - documentElement - .appendChild( table ) - .appendChild( tr ) - .appendChild( trChild ); - - trStyle = window.getComputedStyle( tr ); - reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) + - parseInt( trStyle.borderTopWidth, 10 ) + - parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight; - - documentElement.removeChild( table ); - } - return reliableTrDimensionsVal; - } - } ); -} )(); - - -function curCSS( elem, name, computed ) { - var width, minWidth, maxWidth, ret, - - // Support: Firefox 51+ - // Retrieving style before computed somehow - // fixes an issue with getting wrong values - // on detached elements - style = elem.style; - - computed = computed || getStyles( elem ); - - // getPropertyValue is needed for: - // .css('filter') (IE 9 only, #12537) - // .css('--customProperty) (#3144) - if ( computed ) { - ret = computed.getPropertyValue( name ) || computed[ name ]; - - if ( ret === "" && !isAttached( elem ) ) { - ret = jQuery.style( elem, name ); - } - - // A tribute to the "awesome hack by Dean Edwards" - // Android Browser returns percentage for some values, - // but width seems to be reliably pixels. - // This is against the CSSOM draft spec: - // https://drafts.csswg.org/cssom/#resolved-values - if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { - - // Remember the original values - width = style.width; - minWidth = style.minWidth; - maxWidth = style.maxWidth; - - // Put in the new values to get a computed value out - style.minWidth = style.maxWidth = style.width = ret; - ret = computed.width; - - // Revert the changed values - style.width = width; - style.minWidth = minWidth; - style.maxWidth = maxWidth; - } - } - - return ret !== undefined ? - - // Support: IE <=9 - 11 only - // IE returns zIndex value as an integer. - ret + "" : - ret; -} - - -function addGetHookIf( conditionFn, hookFn ) { - - // Define the hook, we'll check on the first run if it's really needed. - return { - get: function() { - if ( conditionFn() ) { - - // Hook not needed (or it's not possible to use it due - // to missing dependency), remove it. - delete this.get; - return; - } - - // Hook needed; redefine it so that the support test is not executed again. - return ( this.get = hookFn ).apply( this, arguments ); - } - }; -} - - -var cssPrefixes = [ "Webkit", "Moz", "ms" ], - emptyStyle = document.createElement( "div" ).style, - vendorProps = {}; - -// Return a vendor-prefixed property or undefined -function vendorPropName( name ) { - - // Check for vendor prefixed names - var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), - i = cssPrefixes.length; - - while ( i-- ) { - name = cssPrefixes[ i ] + capName; - if ( name in emptyStyle ) { - return name; - } - } -} - -// Return a potentially-mapped jQuery.cssProps or vendor prefixed property -function finalPropName( name ) { - var final = jQuery.cssProps[ name ] || vendorProps[ name ]; - - if ( final ) { - return final; - } - if ( name in emptyStyle ) { - return name; - } - return vendorProps[ name ] = vendorPropName( name ) || name; -} - - -var - - // Swappable if display is none or starts with table - // except "table", "table-cell", or "table-caption" - // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display - rdisplayswap = /^(none|table(?!-c[ea]).+)/, - rcustomProp = /^--/, - cssShow = { position: "absolute", visibility: "hidden", display: "block" }, - cssNormalTransform = { - letterSpacing: "0", - fontWeight: "400" - }; - -function setPositiveNumber( _elem, value, subtract ) { - - // Any relative (+/-) values have already been - // normalized at this point - var matches = rcssNum.exec( value ); - return matches ? - - // Guard against undefined "subtract", e.g., when used as in cssHooks - Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : - value; -} - -function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { - var i = dimension === "width" ? 1 : 0, - extra = 0, - delta = 0; - - // Adjustment may not be necessary - if ( box === ( isBorderBox ? "border" : "content" ) ) { - return 0; - } - - for ( ; i < 4; i += 2 ) { - - // Both box models exclude margin - if ( box === "margin" ) { - delta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); - } - - // If we get here with a content-box, we're seeking "padding" or "border" or "margin" - if ( !isBorderBox ) { - - // Add padding - delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - - // For "border" or "margin", add border - if ( box !== "padding" ) { - delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - - // But still keep track of it otherwise - } else { - extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - - // If we get here with a border-box (content + padding + border), we're seeking "content" or - // "padding" or "margin" - } else { - - // For "content", subtract padding - if ( box === "content" ) { - delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - } - - // For "content" or "padding", subtract border - if ( box !== "margin" ) { - delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - } - } - - // Account for positive content-box scroll gutter when requested by providing computedVal - if ( !isBorderBox && computedVal >= 0 ) { - - // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border - // Assuming integer scroll gutter, subtract the rest and round down - delta += Math.max( 0, Math.ceil( - elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - - computedVal - - delta - - extra - - 0.5 - - // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter - // Use an explicit zero to avoid NaN (gh-3964) - ) ) || 0; - } - - return delta; -} - -function getWidthOrHeight( elem, dimension, extra ) { - - // Start with computed style - var styles = getStyles( elem ), - - // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322). - // Fake content-box until we know it's needed to know the true value. - boxSizingNeeded = !support.boxSizingReliable() || extra, - isBorderBox = boxSizingNeeded && - jQuery.css( elem, "boxSizing", false, styles ) === "border-box", - valueIsBorderBox = isBorderBox, - - val = curCSS( elem, dimension, styles ), - offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ); - - // Support: Firefox <=54 - // Return a confounding non-pixel value or feign ignorance, as appropriate. - if ( rnumnonpx.test( val ) ) { - if ( !extra ) { - return val; - } - val = "auto"; - } - - - // Support: IE 9 - 11 only - // Use offsetWidth/offsetHeight for when box sizing is unreliable. - // In those cases, the computed value can be trusted to be border-box. - if ( ( !support.boxSizingReliable() && isBorderBox || - - // Support: IE 10 - 11+, Edge 15 - 18+ - // IE/Edge misreport `getComputedStyle` of table rows with width/height - // set in CSS while `offset*` properties report correct values. - // Interestingly, in some cases IE 9 doesn't suffer from this issue. - !support.reliableTrDimensions() && nodeName( elem, "tr" ) || - - // Fall back to offsetWidth/offsetHeight when value is "auto" - // This happens for inline elements with no explicit setting (gh-3571) - val === "auto" || - - // Support: Android <=4.1 - 4.3 only - // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) - !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) && - - // Make sure the element is visible & connected - elem.getClientRects().length ) { - - isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; - - // Where available, offsetWidth/offsetHeight approximate border box dimensions. - // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the - // retrieved value as a content box dimension. - valueIsBorderBox = offsetProp in elem; - if ( valueIsBorderBox ) { - val = elem[ offsetProp ]; - } - } - - // Normalize "" and auto - val = parseFloat( val ) || 0; - - // Adjust for the element's box model - return ( val + - boxModelAdjustment( - elem, - dimension, - extra || ( isBorderBox ? "border" : "content" ), - valueIsBorderBox, - styles, - - // Provide the current computed size to request scroll gutter calculation (gh-3589) - val - ) - ) + "px"; -} - -jQuery.extend( { - - // Add in style property hooks for overriding the default - // behavior of getting and setting a style property - cssHooks: { - opacity: { - get: function( elem, computed ) { - if ( computed ) { - - // We should always get a number back from opacity - var ret = curCSS( elem, "opacity" ); - return ret === "" ? "1" : ret; - } - } - } - }, - - // Don't automatically add "px" to these possibly-unitless properties - cssNumber: { - "animationIterationCount": true, - "columnCount": true, - "fillOpacity": true, - "flexGrow": true, - "flexShrink": true, - "fontWeight": true, - "gridArea": true, - "gridColumn": true, - "gridColumnEnd": true, - "gridColumnStart": true, - "gridRow": true, - "gridRowEnd": true, - "gridRowStart": true, - "lineHeight": true, - "opacity": true, - "order": true, - "orphans": true, - "widows": true, - "zIndex": true, - "zoom": true - }, - - // Add in properties whose names you wish to fix before - // setting or getting the value - cssProps: {}, - - // Get and set the style property on a DOM Node - style: function( elem, name, value, extra ) { - - // Don't set styles on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { - return; - } - - // Make sure that we're working with the right name - var ret, type, hooks, - origName = camelCase( name ), - isCustomProp = rcustomProp.test( name ), - style = elem.style; - - // Make sure that we're working with the right name. We don't - // want to query the value if it is a CSS custom property - // since they are user-defined. - if ( !isCustomProp ) { - name = finalPropName( origName ); - } - - // Gets hook for the prefixed version, then unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // Check if we're setting a value - if ( value !== undefined ) { - type = typeof value; - - // Convert "+=" or "-=" to relative numbers (#7345) - if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { - value = adjustCSS( elem, name, ret ); - - // Fixes bug #9237 - type = "number"; - } - - // Make sure that null and NaN values aren't set (#7116) - if ( value == null || value !== value ) { - return; - } - - // If a number was passed in, add the unit (except for certain CSS properties) - // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append - // "px" to a few hardcoded values. - if ( type === "number" && !isCustomProp ) { - value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); - } - - // background-* props affect original clone's values - if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { - style[ name ] = "inherit"; - } - - // If a hook was provided, use that value, otherwise just set the specified value - if ( !hooks || !( "set" in hooks ) || - ( value = hooks.set( elem, value, extra ) ) !== undefined ) { - - if ( isCustomProp ) { - style.setProperty( name, value ); - } else { - style[ name ] = value; - } - } - - } else { - - // If a hook was provided get the non-computed value from there - if ( hooks && "get" in hooks && - ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { - - return ret; - } - - // Otherwise just get the value from the style object - return style[ name ]; - } - }, - - css: function( elem, name, extra, styles ) { - var val, num, hooks, - origName = camelCase( name ), - isCustomProp = rcustomProp.test( name ); - - // Make sure that we're working with the right name. We don't - // want to modify the value if it is a CSS custom property - // since they are user-defined. - if ( !isCustomProp ) { - name = finalPropName( origName ); - } - - // Try prefixed name followed by the unprefixed name - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // If a hook was provided get the computed value from there - if ( hooks && "get" in hooks ) { - val = hooks.get( elem, true, extra ); - } - - // Otherwise, if a way to get the computed value exists, use that - if ( val === undefined ) { - val = curCSS( elem, name, styles ); - } - - // Convert "normal" to computed value - if ( val === "normal" && name in cssNormalTransform ) { - val = cssNormalTransform[ name ]; - } - - // Make numeric if forced or a qualifier was provided and val looks numeric - if ( extra === "" || extra ) { - num = parseFloat( val ); - return extra === true || isFinite( num ) ? num || 0 : val; - } - - return val; - } -} ); - -jQuery.each( [ "height", "width" ], function( _i, dimension ) { - jQuery.cssHooks[ dimension ] = { - get: function( elem, computed, extra ) { - if ( computed ) { - - // Certain elements can have dimension info if we invisibly show them - // but it must have a current display style that would benefit - return rdisplayswap.test( jQuery.css( elem, "display" ) ) && - - // Support: Safari 8+ - // Table columns in Safari have non-zero offsetWidth & zero - // getBoundingClientRect().width unless display is changed. - // Support: IE <=11 only - // Running getBoundingClientRect on a disconnected node - // in IE throws an error. - ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? - swap( elem, cssShow, function() { - return getWidthOrHeight( elem, dimension, extra ); - } ) : - getWidthOrHeight( elem, dimension, extra ); - } - }, - - set: function( elem, value, extra ) { - var matches, - styles = getStyles( elem ), - - // Only read styles.position if the test has a chance to fail - // to avoid forcing a reflow. - scrollboxSizeBuggy = !support.scrollboxSize() && - styles.position === "absolute", - - // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) - boxSizingNeeded = scrollboxSizeBuggy || extra, - isBorderBox = boxSizingNeeded && - jQuery.css( elem, "boxSizing", false, styles ) === "border-box", - subtract = extra ? - boxModelAdjustment( - elem, - dimension, - extra, - isBorderBox, - styles - ) : - 0; - - // Account for unreliable border-box dimensions by comparing offset* to computed and - // faking a content-box to get border and padding (gh-3699) - if ( isBorderBox && scrollboxSizeBuggy ) { - subtract -= Math.ceil( - elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - - parseFloat( styles[ dimension ] ) - - boxModelAdjustment( elem, dimension, "border", false, styles ) - - 0.5 - ); - } - - // Convert to pixels if value adjustment is needed - if ( subtract && ( matches = rcssNum.exec( value ) ) && - ( matches[ 3 ] || "px" ) !== "px" ) { - - elem.style[ dimension ] = value; - value = jQuery.css( elem, dimension ); - } - - return setPositiveNumber( elem, value, subtract ); - } - }; -} ); - -jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, - function( elem, computed ) { - if ( computed ) { - return ( parseFloat( curCSS( elem, "marginLeft" ) ) || - elem.getBoundingClientRect().left - - swap( elem, { marginLeft: 0 }, function() { - return elem.getBoundingClientRect().left; - } ) - ) + "px"; - } - } -); - -// These hooks are used by animate to expand properties -jQuery.each( { - margin: "", - padding: "", - border: "Width" -}, function( prefix, suffix ) { - jQuery.cssHooks[ prefix + suffix ] = { - expand: function( value ) { - var i = 0, - expanded = {}, - - // Assumes a single number if not a string - parts = typeof value === "string" ? value.split( " " ) : [ value ]; - - for ( ; i < 4; i++ ) { - expanded[ prefix + cssExpand[ i ] + suffix ] = - parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; - } - - return expanded; - } - }; - - if ( prefix !== "margin" ) { - jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; - } -} ); - -jQuery.fn.extend( { - css: function( name, value ) { - return access( this, function( elem, name, value ) { - var styles, len, - map = {}, - i = 0; - - if ( Array.isArray( name ) ) { - styles = getStyles( elem ); - len = name.length; - - for ( ; i < len; i++ ) { - map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); - } - - return map; - } - - return value !== undefined ? - jQuery.style( elem, name, value ) : - jQuery.css( elem, name ); - }, name, value, arguments.length > 1 ); - } -} ); - - -function Tween( elem, options, prop, end, easing ) { - return new Tween.prototype.init( elem, options, prop, end, easing ); -} -jQuery.Tween = Tween; - -Tween.prototype = { - constructor: Tween, - init: function( elem, options, prop, end, easing, unit ) { - this.elem = elem; - this.prop = prop; - this.easing = easing || jQuery.easing._default; - this.options = options; - this.start = this.now = this.cur(); - this.end = end; - this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); - }, - cur: function() { - var hooks = Tween.propHooks[ this.prop ]; - - return hooks && hooks.get ? - hooks.get( this ) : - Tween.propHooks._default.get( this ); - }, - run: function( percent ) { - var eased, - hooks = Tween.propHooks[ this.prop ]; - - if ( this.options.duration ) { - this.pos = eased = jQuery.easing[ this.easing ]( - percent, this.options.duration * percent, 0, 1, this.options.duration - ); - } else { - this.pos = eased = percent; - } - this.now = ( this.end - this.start ) * eased + this.start; - - if ( this.options.step ) { - this.options.step.call( this.elem, this.now, this ); - } - - if ( hooks && hooks.set ) { - hooks.set( this ); - } else { - Tween.propHooks._default.set( this ); - } - return this; - } -}; - -Tween.prototype.init.prototype = Tween.prototype; - -Tween.propHooks = { - _default: { - get: function( tween ) { - var result; - - // Use a property on the element directly when it is not a DOM element, - // or when there is no matching style property that exists. - if ( tween.elem.nodeType !== 1 || - tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { - return tween.elem[ tween.prop ]; - } - - // Passing an empty string as a 3rd parameter to .css will automatically - // attempt a parseFloat and fallback to a string if the parse fails. - // Simple values such as "10px" are parsed to Float; - // complex values such as "rotate(1rad)" are returned as-is. - result = jQuery.css( tween.elem, tween.prop, "" ); - - // Empty strings, null, undefined and "auto" are converted to 0. - return !result || result === "auto" ? 0 : result; - }, - set: function( tween ) { - - // Use step hook for back compat. - // Use cssHook if its there. - // Use .style if available and use plain properties where available. - if ( jQuery.fx.step[ tween.prop ] ) { - jQuery.fx.step[ tween.prop ]( tween ); - } else if ( tween.elem.nodeType === 1 && ( - jQuery.cssHooks[ tween.prop ] || - tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) { - jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); - } else { - tween.elem[ tween.prop ] = tween.now; - } - } - } -}; - -// Support: IE <=9 only -// Panic based approach to setting things on disconnected nodes -Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { - set: function( tween ) { - if ( tween.elem.nodeType && tween.elem.parentNode ) { - tween.elem[ tween.prop ] = tween.now; - } - } -}; - -jQuery.easing = { - linear: function( p ) { - return p; - }, - swing: function( p ) { - return 0.5 - Math.cos( p * Math.PI ) / 2; - }, - _default: "swing" -}; - -jQuery.fx = Tween.prototype.init; - -// Back compat <1.8 extension point -jQuery.fx.step = {}; - - - - -var - fxNow, inProgress, - rfxtypes = /^(?:toggle|show|hide)$/, - rrun = /queueHooks$/; - -function schedule() { - if ( inProgress ) { - if ( document.hidden === false && window.requestAnimationFrame ) { - window.requestAnimationFrame( schedule ); - } else { - window.setTimeout( schedule, jQuery.fx.interval ); - } - - jQuery.fx.tick(); - } -} - -// Animations created synchronously will run synchronously -function createFxNow() { - window.setTimeout( function() { - fxNow = undefined; - } ); - return ( fxNow = Date.now() ); -} - -// Generate parameters to create a standard animation -function genFx( type, includeWidth ) { - var which, - i = 0, - attrs = { height: type }; - - // If we include width, step value is 1 to do all cssExpand values, - // otherwise step value is 2 to skip over Left and Right - includeWidth = includeWidth ? 1 : 0; - for ( ; i < 4; i += 2 - includeWidth ) { - which = cssExpand[ i ]; - attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; - } - - if ( includeWidth ) { - attrs.opacity = attrs.width = type; - } - - return attrs; -} - -function createTween( value, prop, animation ) { - var tween, - collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), - index = 0, - length = collection.length; - for ( ; index < length; index++ ) { - if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { - - // We're done with this property - return tween; - } - } -} - -function defaultPrefilter( elem, props, opts ) { - var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, - isBox = "width" in props || "height" in props, - anim = this, - orig = {}, - style = elem.style, - hidden = elem.nodeType && isHiddenWithinTree( elem ), - dataShow = dataPriv.get( elem, "fxshow" ); - - // Queue-skipping animations hijack the fx hooks - if ( !opts.queue ) { - hooks = jQuery._queueHooks( elem, "fx" ); - if ( hooks.unqueued == null ) { - hooks.unqueued = 0; - oldfire = hooks.empty.fire; - hooks.empty.fire = function() { - if ( !hooks.unqueued ) { - oldfire(); - } - }; - } - hooks.unqueued++; - - anim.always( function() { - - // Ensure the complete handler is called before this completes - anim.always( function() { - hooks.unqueued--; - if ( !jQuery.queue( elem, "fx" ).length ) { - hooks.empty.fire(); - } - } ); - } ); - } - - // Detect show/hide animations - for ( prop in props ) { - value = props[ prop ]; - if ( rfxtypes.test( value ) ) { - delete props[ prop ]; - toggle = toggle || value === "toggle"; - if ( value === ( hidden ? "hide" : "show" ) ) { - - // Pretend to be hidden if this is a "show" and - // there is still data from a stopped show/hide - if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { - hidden = true; - - // Ignore all other no-op show/hide data - } else { - continue; - } - } - orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); - } - } - - // Bail out if this is a no-op like .hide().hide() - propTween = !jQuery.isEmptyObject( props ); - if ( !propTween && jQuery.isEmptyObject( orig ) ) { - return; - } - - // Restrict "overflow" and "display" styles during box animations - if ( isBox && elem.nodeType === 1 ) { - - // Support: IE <=9 - 11, Edge 12 - 15 - // Record all 3 overflow attributes because IE does not infer the shorthand - // from identically-valued overflowX and overflowY and Edge just mirrors - // the overflowX value there. - opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; - - // Identify a display type, preferring old show/hide data over the CSS cascade - restoreDisplay = dataShow && dataShow.display; - if ( restoreDisplay == null ) { - restoreDisplay = dataPriv.get( elem, "display" ); - } - display = jQuery.css( elem, "display" ); - if ( display === "none" ) { - if ( restoreDisplay ) { - display = restoreDisplay; - } else { - - // Get nonempty value(s) by temporarily forcing visibility - showHide( [ elem ], true ); - restoreDisplay = elem.style.display || restoreDisplay; - display = jQuery.css( elem, "display" ); - showHide( [ elem ] ); - } - } - - // Animate inline elements as inline-block - if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { - if ( jQuery.css( elem, "float" ) === "none" ) { - - // Restore the original display value at the end of pure show/hide animations - if ( !propTween ) { - anim.done( function() { - style.display = restoreDisplay; - } ); - if ( restoreDisplay == null ) { - display = style.display; - restoreDisplay = display === "none" ? "" : display; - } - } - style.display = "inline-block"; - } - } - } - - if ( opts.overflow ) { - style.overflow = "hidden"; - anim.always( function() { - style.overflow = opts.overflow[ 0 ]; - style.overflowX = opts.overflow[ 1 ]; - style.overflowY = opts.overflow[ 2 ]; - } ); - } - - // Implement show/hide animations - propTween = false; - for ( prop in orig ) { - - // General show/hide setup for this element animation - if ( !propTween ) { - if ( dataShow ) { - if ( "hidden" in dataShow ) { - hidden = dataShow.hidden; - } - } else { - dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); - } - - // Store hidden/visible for toggle so `.stop().toggle()` "reverses" - if ( toggle ) { - dataShow.hidden = !hidden; - } - - // Show elements before animating them - if ( hidden ) { - showHide( [ elem ], true ); - } - - /* eslint-disable no-loop-func */ - - anim.done( function() { - - /* eslint-enable no-loop-func */ - - // The final step of a "hide" animation is actually hiding the element - if ( !hidden ) { - showHide( [ elem ] ); - } - dataPriv.remove( elem, "fxshow" ); - for ( prop in orig ) { - jQuery.style( elem, prop, orig[ prop ] ); - } - } ); - } - - // Per-property setup - propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); - if ( !( prop in dataShow ) ) { - dataShow[ prop ] = propTween.start; - if ( hidden ) { - propTween.end = propTween.start; - propTween.start = 0; - } - } - } -} - -function propFilter( props, specialEasing ) { - var index, name, easing, value, hooks; - - // camelCase, specialEasing and expand cssHook pass - for ( index in props ) { - name = camelCase( index ); - easing = specialEasing[ name ]; - value = props[ index ]; - if ( Array.isArray( value ) ) { - easing = value[ 1 ]; - value = props[ index ] = value[ 0 ]; - } - - if ( index !== name ) { - props[ name ] = value; - delete props[ index ]; - } - - hooks = jQuery.cssHooks[ name ]; - if ( hooks && "expand" in hooks ) { - value = hooks.expand( value ); - delete props[ name ]; - - // Not quite $.extend, this won't overwrite existing keys. - // Reusing 'index' because we have the correct "name" - for ( index in value ) { - if ( !( index in props ) ) { - props[ index ] = value[ index ]; - specialEasing[ index ] = easing; - } - } - } else { - specialEasing[ name ] = easing; - } - } -} - -function Animation( elem, properties, options ) { - var result, - stopped, - index = 0, - length = Animation.prefilters.length, - deferred = jQuery.Deferred().always( function() { - - // Don't match elem in the :animated selector - delete tick.elem; - } ), - tick = function() { - if ( stopped ) { - return false; - } - var currentTime = fxNow || createFxNow(), - remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), - - // Support: Android 2.3 only - // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) - temp = remaining / animation.duration || 0, - percent = 1 - temp, - index = 0, - length = animation.tweens.length; - - for ( ; index < length; index++ ) { - animation.tweens[ index ].run( percent ); - } - - deferred.notifyWith( elem, [ animation, percent, remaining ] ); - - // If there's more to do, yield - if ( percent < 1 && length ) { - return remaining; - } - - // If this was an empty animation, synthesize a final progress notification - if ( !length ) { - deferred.notifyWith( elem, [ animation, 1, 0 ] ); - } - - // Resolve the animation and report its conclusion - deferred.resolveWith( elem, [ animation ] ); - return false; - }, - animation = deferred.promise( { - elem: elem, - props: jQuery.extend( {}, properties ), - opts: jQuery.extend( true, { - specialEasing: {}, - easing: jQuery.easing._default - }, options ), - originalProperties: properties, - originalOptions: options, - startTime: fxNow || createFxNow(), - duration: options.duration, - tweens: [], - createTween: function( prop, end ) { - var tween = jQuery.Tween( elem, animation.opts, prop, end, - animation.opts.specialEasing[ prop ] || animation.opts.easing ); - animation.tweens.push( tween ); - return tween; - }, - stop: function( gotoEnd ) { - var index = 0, - - // If we are going to the end, we want to run all the tweens - // otherwise we skip this part - length = gotoEnd ? animation.tweens.length : 0; - if ( stopped ) { - return this; - } - stopped = true; - for ( ; index < length; index++ ) { - animation.tweens[ index ].run( 1 ); - } - - // Resolve when we played the last frame; otherwise, reject - if ( gotoEnd ) { - deferred.notifyWith( elem, [ animation, 1, 0 ] ); - deferred.resolveWith( elem, [ animation, gotoEnd ] ); - } else { - deferred.rejectWith( elem, [ animation, gotoEnd ] ); - } - return this; - } - } ), - props = animation.props; - - propFilter( props, animation.opts.specialEasing ); - - for ( ; index < length; index++ ) { - result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); - if ( result ) { - if ( isFunction( result.stop ) ) { - jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = - result.stop.bind( result ); - } - return result; - } - } - - jQuery.map( props, createTween, animation ); - - if ( isFunction( animation.opts.start ) ) { - animation.opts.start.call( elem, animation ); - } - - // Attach callbacks from options - animation - .progress( animation.opts.progress ) - .done( animation.opts.done, animation.opts.complete ) - .fail( animation.opts.fail ) - .always( animation.opts.always ); - - jQuery.fx.timer( - jQuery.extend( tick, { - elem: elem, - anim: animation, - queue: animation.opts.queue - } ) - ); - - return animation; -} - -jQuery.Animation = jQuery.extend( Animation, { - - tweeners: { - "*": [ function( prop, value ) { - var tween = this.createTween( prop, value ); - adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); - return tween; - } ] - }, - - tweener: function( props, callback ) { - if ( isFunction( props ) ) { - callback = props; - props = [ "*" ]; - } else { - props = props.match( rnothtmlwhite ); - } - - var prop, - index = 0, - length = props.length; - - for ( ; index < length; index++ ) { - prop = props[ index ]; - Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; - Animation.tweeners[ prop ].unshift( callback ); - } - }, - - prefilters: [ defaultPrefilter ], - - prefilter: function( callback, prepend ) { - if ( prepend ) { - Animation.prefilters.unshift( callback ); - } else { - Animation.prefilters.push( callback ); - } - } -} ); - -jQuery.speed = function( speed, easing, fn ) { - var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { - complete: fn || !fn && easing || - isFunction( speed ) && speed, - duration: speed, - easing: fn && easing || easing && !isFunction( easing ) && easing - }; - - // Go to the end state if fx are off - if ( jQuery.fx.off ) { - opt.duration = 0; - - } else { - if ( typeof opt.duration !== "number" ) { - if ( opt.duration in jQuery.fx.speeds ) { - opt.duration = jQuery.fx.speeds[ opt.duration ]; - - } else { - opt.duration = jQuery.fx.speeds._default; - } - } - } - - // Normalize opt.queue - true/undefined/null -> "fx" - if ( opt.queue == null || opt.queue === true ) { - opt.queue = "fx"; - } - - // Queueing - opt.old = opt.complete; - - opt.complete = function() { - if ( isFunction( opt.old ) ) { - opt.old.call( this ); - } - - if ( opt.queue ) { - jQuery.dequeue( this, opt.queue ); - } - }; - - return opt; -}; - -jQuery.fn.extend( { - fadeTo: function( speed, to, easing, callback ) { - - // Show any hidden elements after setting opacity to 0 - return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() - - // Animate to the value specified - .end().animate( { opacity: to }, speed, easing, callback ); - }, - animate: function( prop, speed, easing, callback ) { - var empty = jQuery.isEmptyObject( prop ), - optall = jQuery.speed( speed, easing, callback ), - doAnimation = function() { - - // Operate on a copy of prop so per-property easing won't be lost - var anim = Animation( this, jQuery.extend( {}, prop ), optall ); - - // Empty animations, or finishing resolves immediately - if ( empty || dataPriv.get( this, "finish" ) ) { - anim.stop( true ); - } - }; - - doAnimation.finish = doAnimation; - - return empty || optall.queue === false ? - this.each( doAnimation ) : - this.queue( optall.queue, doAnimation ); - }, - stop: function( type, clearQueue, gotoEnd ) { - var stopQueue = function( hooks ) { - var stop = hooks.stop; - delete hooks.stop; - stop( gotoEnd ); - }; - - if ( typeof type !== "string" ) { - gotoEnd = clearQueue; - clearQueue = type; - type = undefined; - } - if ( clearQueue ) { - this.queue( type || "fx", [] ); - } - - return this.each( function() { - var dequeue = true, - index = type != null && type + "queueHooks", - timers = jQuery.timers, - data = dataPriv.get( this ); - - if ( index ) { - if ( data[ index ] && data[ index ].stop ) { - stopQueue( data[ index ] ); - } - } else { - for ( index in data ) { - if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { - stopQueue( data[ index ] ); - } - } - } - - for ( index = timers.length; index--; ) { - if ( timers[ index ].elem === this && - ( type == null || timers[ index ].queue === type ) ) { - - timers[ index ].anim.stop( gotoEnd ); - dequeue = false; - timers.splice( index, 1 ); - } - } - - // Start the next in the queue if the last step wasn't forced. - // Timers currently will call their complete callbacks, which - // will dequeue but only if they were gotoEnd. - if ( dequeue || !gotoEnd ) { - jQuery.dequeue( this, type ); - } - } ); - }, - finish: function( type ) { - if ( type !== false ) { - type = type || "fx"; - } - return this.each( function() { - var index, - data = dataPriv.get( this ), - queue = data[ type + "queue" ], - hooks = data[ type + "queueHooks" ], - timers = jQuery.timers, - length = queue ? queue.length : 0; - - // Enable finishing flag on private data - data.finish = true; - - // Empty the queue first - jQuery.queue( this, type, [] ); - - if ( hooks && hooks.stop ) { - hooks.stop.call( this, true ); - } - - // Look for any active animations, and finish them - for ( index = timers.length; index--; ) { - if ( timers[ index ].elem === this && timers[ index ].queue === type ) { - timers[ index ].anim.stop( true ); - timers.splice( index, 1 ); - } - } - - // Look for any animations in the old queue and finish them - for ( index = 0; index < length; index++ ) { - if ( queue[ index ] && queue[ index ].finish ) { - queue[ index ].finish.call( this ); - } - } - - // Turn off finishing flag - delete data.finish; - } ); - } -} ); - -jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) { - var cssFn = jQuery.fn[ name ]; - jQuery.fn[ name ] = function( speed, easing, callback ) { - return speed == null || typeof speed === "boolean" ? - cssFn.apply( this, arguments ) : - this.animate( genFx( name, true ), speed, easing, callback ); - }; -} ); - -// Generate shortcuts for custom animations -jQuery.each( { - slideDown: genFx( "show" ), - slideUp: genFx( "hide" ), - slideToggle: genFx( "toggle" ), - fadeIn: { opacity: "show" }, - fadeOut: { opacity: "hide" }, - fadeToggle: { opacity: "toggle" } -}, function( name, props ) { - jQuery.fn[ name ] = function( speed, easing, callback ) { - return this.animate( props, speed, easing, callback ); - }; -} ); - -jQuery.timers = []; -jQuery.fx.tick = function() { - var timer, - i = 0, - timers = jQuery.timers; - - fxNow = Date.now(); - - for ( ; i < timers.length; i++ ) { - timer = timers[ i ]; - - // Run the timer and safely remove it when done (allowing for external removal) - if ( !timer() && timers[ i ] === timer ) { - timers.splice( i--, 1 ); - } - } - - if ( !timers.length ) { - jQuery.fx.stop(); - } - fxNow = undefined; -}; - -jQuery.fx.timer = function( timer ) { - jQuery.timers.push( timer ); - jQuery.fx.start(); -}; - -jQuery.fx.interval = 13; -jQuery.fx.start = function() { - if ( inProgress ) { - return; - } - - inProgress = true; - schedule(); -}; - -jQuery.fx.stop = function() { - inProgress = null; -}; - -jQuery.fx.speeds = { - slow: 600, - fast: 200, - - // Default speed - _default: 400 -}; - - -// Based off of the plugin by Clint Helfers, with permission. -// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ -jQuery.fn.delay = function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; - - return this.queue( type, function( next, hooks ) { - var timeout = window.setTimeout( next, time ); - hooks.stop = function() { - window.clearTimeout( timeout ); - }; - } ); -}; - - -( function() { - var input = document.createElement( "input" ), - select = document.createElement( "select" ), - opt = select.appendChild( document.createElement( "option" ) ); - - input.type = "checkbox"; - - // Support: Android <=4.3 only - // Default value for a checkbox should be "on" - support.checkOn = input.value !== ""; - - // Support: IE <=11 only - // Must access selectedIndex to make default options select - support.optSelected = opt.selected; - - // Support: IE <=11 only - // An input loses its value after becoming a radio - input = document.createElement( "input" ); - input.value = "t"; - input.type = "radio"; - support.radioValue = input.value === "t"; -} )(); - - -var boolHook, - attrHandle = jQuery.expr.attrHandle; - -jQuery.fn.extend( { - attr: function( name, value ) { - return access( this, jQuery.attr, name, value, arguments.length > 1 ); - }, - - removeAttr: function( name ) { - return this.each( function() { - jQuery.removeAttr( this, name ); - } ); - } -} ); - -jQuery.extend( { - attr: function( elem, name, value ) { - var ret, hooks, - nType = elem.nodeType; - - // Don't get/set attributes on text, comment and attribute nodes - if ( nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === "undefined" ) { - return jQuery.prop( elem, name, value ); - } - - // Attribute hooks are determined by the lowercase version - // Grab necessary hook if one is defined - if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { - hooks = jQuery.attrHooks[ name.toLowerCase() ] || - ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); - } - - if ( value !== undefined ) { - if ( value === null ) { - jQuery.removeAttr( elem, name ); - return; - } - - if ( hooks && "set" in hooks && - ( ret = hooks.set( elem, value, name ) ) !== undefined ) { - return ret; - } - - elem.setAttribute( name, value + "" ); - return value; - } - - if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { - return ret; - } - - ret = jQuery.find.attr( elem, name ); - - // Non-existent attributes return null, we normalize to undefined - return ret == null ? undefined : ret; - }, - - attrHooks: { - type: { - set: function( elem, value ) { - if ( !support.radioValue && value === "radio" && - nodeName( elem, "input" ) ) { - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - } - }, - - removeAttr: function( elem, value ) { - var name, - i = 0, - - // Attribute names can contain non-HTML whitespace characters - // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 - attrNames = value && value.match( rnothtmlwhite ); - - if ( attrNames && elem.nodeType === 1 ) { - while ( ( name = attrNames[ i++ ] ) ) { - elem.removeAttribute( name ); - } - } - } -} ); - -// Hooks for boolean attributes -boolHook = { - set: function( elem, value, name ) { - if ( value === false ) { - - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else { - elem.setAttribute( name, name ); - } - return name; - } -}; - -jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) { - var getter = attrHandle[ name ] || jQuery.find.attr; - - attrHandle[ name ] = function( elem, name, isXML ) { - var ret, handle, - lowercaseName = name.toLowerCase(); - - if ( !isXML ) { - - // Avoid an infinite loop by temporarily removing this function from the getter - handle = attrHandle[ lowercaseName ]; - attrHandle[ lowercaseName ] = ret; - ret = getter( elem, name, isXML ) != null ? - lowercaseName : - null; - attrHandle[ lowercaseName ] = handle; - } - return ret; - }; -} ); - - - - -var rfocusable = /^(?:input|select|textarea|button)$/i, - rclickable = /^(?:a|area)$/i; - -jQuery.fn.extend( { - prop: function( name, value ) { - return access( this, jQuery.prop, name, value, arguments.length > 1 ); - }, - - removeProp: function( name ) { - return this.each( function() { - delete this[ jQuery.propFix[ name ] || name ]; - } ); - } -} ); - -jQuery.extend( { - prop: function( elem, name, value ) { - var ret, hooks, - nType = elem.nodeType; - - // Don't get/set properties on text, comment and attribute nodes - if ( nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { - - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - if ( hooks && "set" in hooks && - ( ret = hooks.set( elem, value, name ) ) !== undefined ) { - return ret; - } - - return ( elem[ name ] = value ); - } - - if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { - return ret; - } - - return elem[ name ]; - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - - // Support: IE <=9 - 11 only - // elem.tabIndex doesn't always return the - // correct value when it hasn't been explicitly set - // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - // Use proper attribute retrieval(#12072) - var tabindex = jQuery.find.attr( elem, "tabindex" ); - - if ( tabindex ) { - return parseInt( tabindex, 10 ); - } - - if ( - rfocusable.test( elem.nodeName ) || - rclickable.test( elem.nodeName ) && - elem.href - ) { - return 0; - } - - return -1; - } - } - }, - - propFix: { - "for": "htmlFor", - "class": "className" - } -} ); - -// Support: IE <=11 only -// Accessing the selectedIndex property -// forces the browser to respect setting selected -// on the option -// The getter ensures a default option is selected -// when in an optgroup -// eslint rule "no-unused-expressions" is disabled for this code -// since it considers such accessions noop -if ( !support.optSelected ) { - jQuery.propHooks.selected = { - get: function( elem ) { - - /* eslint no-unused-expressions: "off" */ - - var parent = elem.parentNode; - if ( parent && parent.parentNode ) { - parent.parentNode.selectedIndex; - } - return null; - }, - set: function( elem ) { - - /* eslint no-unused-expressions: "off" */ - - var parent = elem.parentNode; - if ( parent ) { - parent.selectedIndex; - - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - } - }; -} - -jQuery.each( [ - "tabIndex", - "readOnly", - "maxLength", - "cellSpacing", - "cellPadding", - "rowSpan", - "colSpan", - "useMap", - "frameBorder", - "contentEditable" -], function() { - jQuery.propFix[ this.toLowerCase() ] = this; -} ); - - - - - // Strip and collapse whitespace according to HTML spec - // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace - function stripAndCollapse( value ) { - var tokens = value.match( rnothtmlwhite ) || []; - return tokens.join( " " ); - } - - -function getClass( elem ) { - return elem.getAttribute && elem.getAttribute( "class" ) || ""; -} - -function classesToArray( value ) { - if ( Array.isArray( value ) ) { - return value; - } - if ( typeof value === "string" ) { - return value.match( rnothtmlwhite ) || []; - } - return []; -} - -jQuery.fn.extend( { - addClass: function( value ) { - var classes, elem, cur, curValue, clazz, j, finalValue, - i = 0; - - if ( isFunction( value ) ) { - return this.each( function( j ) { - jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); - } ); - } - - classes = classesToArray( value ); - - if ( classes.length ) { - while ( ( elem = this[ i++ ] ) ) { - curValue = getClass( elem ); - cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); - - if ( cur ) { - j = 0; - while ( ( clazz = classes[ j++ ] ) ) { - if ( cur.indexOf( " " + clazz + " " ) < 0 ) { - cur += clazz + " "; - } - } - - // Only assign if different to avoid unneeded rendering. - finalValue = stripAndCollapse( cur ); - if ( curValue !== finalValue ) { - elem.setAttribute( "class", finalValue ); - } - } - } - } - - return this; - }, - - removeClass: function( value ) { - var classes, elem, cur, curValue, clazz, j, finalValue, - i = 0; - - if ( isFunction( value ) ) { - return this.each( function( j ) { - jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); - } ); - } - - if ( !arguments.length ) { - return this.attr( "class", "" ); - } - - classes = classesToArray( value ); - - if ( classes.length ) { - while ( ( elem = this[ i++ ] ) ) { - curValue = getClass( elem ); - - // This expression is here for better compressibility (see addClass) - cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); - - if ( cur ) { - j = 0; - while ( ( clazz = classes[ j++ ] ) ) { - - // Remove *all* instances - while ( cur.indexOf( " " + clazz + " " ) > -1 ) { - cur = cur.replace( " " + clazz + " ", " " ); - } - } - - // Only assign if different to avoid unneeded rendering. - finalValue = stripAndCollapse( cur ); - if ( curValue !== finalValue ) { - elem.setAttribute( "class", finalValue ); - } - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value, - isValidValue = type === "string" || Array.isArray( value ); - - if ( typeof stateVal === "boolean" && isValidValue ) { - return stateVal ? this.addClass( value ) : this.removeClass( value ); - } - - if ( isFunction( value ) ) { - return this.each( function( i ) { - jQuery( this ).toggleClass( - value.call( this, i, getClass( this ), stateVal ), - stateVal - ); - } ); - } - - return this.each( function() { - var className, i, self, classNames; - - if ( isValidValue ) { - - // Toggle individual class names - i = 0; - self = jQuery( this ); - classNames = classesToArray( value ); - - while ( ( className = classNames[ i++ ] ) ) { - - // Check each className given, space separated list - if ( self.hasClass( className ) ) { - self.removeClass( className ); - } else { - self.addClass( className ); - } - } - - // Toggle whole class name - } else if ( value === undefined || type === "boolean" ) { - className = getClass( this ); - if ( className ) { - - // Store className if set - dataPriv.set( this, "__className__", className ); - } - - // If the element has a class name or if we're passed `false`, - // then remove the whole classname (if there was one, the above saved it). - // Otherwise bring back whatever was previously saved (if anything), - // falling back to the empty string if nothing was stored. - if ( this.setAttribute ) { - this.setAttribute( "class", - className || value === false ? - "" : - dataPriv.get( this, "__className__" ) || "" - ); - } - } - } ); - }, - - hasClass: function( selector ) { - var className, elem, - i = 0; - - className = " " + selector + " "; - while ( ( elem = this[ i++ ] ) ) { - if ( elem.nodeType === 1 && - ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { - return true; - } - } - - return false; - } -} ); - - - - -var rreturn = /\r/g; - -jQuery.fn.extend( { - val: function( value ) { - var hooks, ret, valueIsFunction, - elem = this[ 0 ]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.type ] || - jQuery.valHooks[ elem.nodeName.toLowerCase() ]; - - if ( hooks && - "get" in hooks && - ( ret = hooks.get( elem, "value" ) ) !== undefined - ) { - return ret; - } - - ret = elem.value; - - // Handle most common string cases - if ( typeof ret === "string" ) { - return ret.replace( rreturn, "" ); - } - - // Handle cases where value is null/undef or number - return ret == null ? "" : ret; - } - - return; - } - - valueIsFunction = isFunction( value ); - - return this.each( function( i ) { - var val; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( valueIsFunction ) { - val = value.call( this, i, jQuery( this ).val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - - } else if ( typeof val === "number" ) { - val += ""; - - } else if ( Array.isArray( val ) ) { - val = jQuery.map( val, function( value ) { - return value == null ? "" : value + ""; - } ); - } - - hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - } ); - } -} ); - -jQuery.extend( { - valHooks: { - option: { - get: function( elem ) { - - var val = jQuery.find.attr( elem, "value" ); - return val != null ? - val : - - // Support: IE <=10 - 11 only - // option.text throws exceptions (#14686, #14858) - // Strip and collapse whitespace - // https://html.spec.whatwg.org/#strip-and-collapse-whitespace - stripAndCollapse( jQuery.text( elem ) ); - } - }, - select: { - get: function( elem ) { - var value, option, i, - options = elem.options, - index = elem.selectedIndex, - one = elem.type === "select-one", - values = one ? null : [], - max = one ? index + 1 : options.length; - - if ( index < 0 ) { - i = max; - - } else { - i = one ? index : 0; - } - - // Loop through all the selected options - for ( ; i < max; i++ ) { - option = options[ i ]; - - // Support: IE <=9 only - // IE8-9 doesn't update selected after form reset (#2551) - if ( ( option.selected || i === index ) && - - // Don't return options that are disabled or in a disabled optgroup - !option.disabled && - ( !option.parentNode.disabled || - !nodeName( option.parentNode, "optgroup" ) ) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - return values; - }, - - set: function( elem, value ) { - var optionSet, option, - options = elem.options, - values = jQuery.makeArray( value ), - i = options.length; - - while ( i-- ) { - option = options[ i ]; - - /* eslint-disable no-cond-assign */ - - if ( option.selected = - jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 - ) { - optionSet = true; - } - - /* eslint-enable no-cond-assign */ - } - - // Force browsers to behave consistently when non-matching value is set - if ( !optionSet ) { - elem.selectedIndex = -1; - } - return values; - } - } - } -} ); - -// Radios and checkboxes getter/setter -jQuery.each( [ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - set: function( elem, value ) { - if ( Array.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); - } - } - }; - if ( !support.checkOn ) { - jQuery.valHooks[ this ].get = function( elem ) { - return elem.getAttribute( "value" ) === null ? "on" : elem.value; - }; - } -} ); - - - - -// Return jQuery for attributes-only inclusion - - -support.focusin = "onfocusin" in window; - - -var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - stopPropagationCallback = function( e ) { - e.stopPropagation(); - }; - -jQuery.extend( jQuery.event, { - - trigger: function( event, data, elem, onlyHandlers ) { - - var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, - eventPath = [ elem || document ], - type = hasOwn.call( event, "type" ) ? event.type : event, - namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; - - cur = lastElement = tmp = elem = elem || document; - - // Don't do events on text and comment nodes - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf( "." ) > -1 ) { - - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split( "." ); - type = namespaces.shift(); - namespaces.sort(); - } - ontype = type.indexOf( ":" ) < 0 && "on" + type; - - // Caller can pass in a jQuery.Event object, Object, or just an event type string - event = event[ jQuery.expando ] ? - event : - new jQuery.Event( type, typeof event === "object" && event ); - - // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) - event.isTrigger = onlyHandlers ? 2 : 3; - event.namespace = namespaces.join( "." ); - event.rnamespace = event.namespace ? - new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : - null; - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data == null ? - [ event ] : - jQuery.makeArray( data, [ event ] ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - if ( !rfocusMorph.test( bubbleType + type ) ) { - cur = cur.parentNode; - } - for ( ; cur; cur = cur.parentNode ) { - eventPath.push( cur ); - tmp = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( tmp === ( elem.ownerDocument || document ) ) { - eventPath.push( tmp.defaultView || tmp.parentWindow || window ); - } - } - - // Fire handlers on the event path - i = 0; - while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { - lastElement = cur; - event.type = i > 1 ? - bubbleType : - special.bindType || type; - - // jQuery handler - handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] && - dataPriv.get( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - - // Native handler - handle = ontype && cur[ ontype ]; - if ( handle && handle.apply && acceptData( cur ) ) { - event.result = handle.apply( cur, data ); - if ( event.result === false ) { - event.preventDefault(); - } - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( ( !special._default || - special._default.apply( eventPath.pop(), data ) === false ) && - acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name as the event. - // Don't do default actions on window, that's where global variables be (#6170) - if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - tmp = elem[ ontype ]; - - if ( tmp ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - - if ( event.isPropagationStopped() ) { - lastElement.addEventListener( type, stopPropagationCallback ); - } - - elem[ type ](); - - if ( event.isPropagationStopped() ) { - lastElement.removeEventListener( type, stopPropagationCallback ); - } - - jQuery.event.triggered = undefined; - - if ( tmp ) { - elem[ ontype ] = tmp; - } - } - } - } - - return event.result; - }, - - // Piggyback on a donor event to simulate a different one - // Used only for `focus(in | out)` events - simulate: function( type, elem, event ) { - var e = jQuery.extend( - new jQuery.Event(), - event, - { - type: type, - isSimulated: true - } - ); - - jQuery.event.trigger( e, null, elem ); - } - -} ); - -jQuery.fn.extend( { - - trigger: function( type, data ) { - return this.each( function() { - jQuery.event.trigger( type, data, this ); - } ); - }, - triggerHandler: function( type, data ) { - var elem = this[ 0 ]; - if ( elem ) { - return jQuery.event.trigger( type, data, elem, true ); - } - } -} ); - - -// Support: Firefox <=44 -// Firefox doesn't have focus(in | out) events -// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 -// -// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 -// focus(in | out) events fire after focus & blur events, -// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order -// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 -if ( !support.focusin ) { - jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler on the document while someone wants focusin/focusout - var handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - - // Handle: regular nodes (via `this.ownerDocument`), window - // (via `this.document`) & document (via `this`). - var doc = this.ownerDocument || this.document || this, - attaches = dataPriv.access( doc, fix ); - - if ( !attaches ) { - doc.addEventListener( orig, handler, true ); - } - dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); - }, - teardown: function() { - var doc = this.ownerDocument || this.document || this, - attaches = dataPriv.access( doc, fix ) - 1; - - if ( !attaches ) { - doc.removeEventListener( orig, handler, true ); - dataPriv.remove( doc, fix ); - - } else { - dataPriv.access( doc, fix, attaches ); - } - } - }; - } ); -} -var location = window.location; - -var nonce = { guid: Date.now() }; - -var rquery = ( /\?/ ); - - - -// Cross-browser xml parsing -jQuery.parseXML = function( data ) { - var xml, parserErrorElem; - if ( !data || typeof data !== "string" ) { - return null; - } - - // Support: IE 9 - 11 only - // IE throws on parseFromString with invalid input. - try { - xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); - } catch ( e ) {} - - parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ]; - if ( !xml || parserErrorElem ) { - jQuery.error( "Invalid XML: " + ( - parserErrorElem ? - jQuery.map( parserErrorElem.childNodes, function( el ) { - return el.textContent; - } ).join( "\n" ) : - data - ) ); - } - return xml; -}; - - -var - rbracket = /\[\]$/, - rCRLF = /\r?\n/g, - rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, - rsubmittable = /^(?:input|select|textarea|keygen)/i; - -function buildParams( prefix, obj, traditional, add ) { - var name; - - if ( Array.isArray( obj ) ) { - - // Serialize array item. - jQuery.each( obj, function( i, v ) { - if ( traditional || rbracket.test( prefix ) ) { - - // Treat each array item as a scalar. - add( prefix, v ); - - } else { - - // Item is non-scalar (array or object), encode its numeric index. - buildParams( - prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", - v, - traditional, - add - ); - } - } ); - - } else if ( !traditional && toType( obj ) === "object" ) { - - // Serialize object item. - for ( name in obj ) { - buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); - } - - } else { - - // Serialize scalar item. - add( prefix, obj ); - } -} - -// Serialize an array of form elements or a set of -// key/values into a query string -jQuery.param = function( a, traditional ) { - var prefix, - s = [], - add = function( key, valueOrFunction ) { - - // If value is a function, invoke it and use its return value - var value = isFunction( valueOrFunction ) ? - valueOrFunction() : - valueOrFunction; - - s[ s.length ] = encodeURIComponent( key ) + "=" + - encodeURIComponent( value == null ? "" : value ); - }; - - if ( a == null ) { - return ""; - } - - // If an array was passed in, assume that it is an array of form elements. - if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { - - // Serialize the form elements - jQuery.each( a, function() { - add( this.name, this.value ); - } ); - - } else { - - // If traditional, encode the "old" way (the way 1.3.2 or older - // did it), otherwise encode params recursively. - for ( prefix in a ) { - buildParams( prefix, a[ prefix ], traditional, add ); - } - } - - // Return the resulting serialization - return s.join( "&" ); -}; - -jQuery.fn.extend( { - serialize: function() { - return jQuery.param( this.serializeArray() ); - }, - serializeArray: function() { - return this.map( function() { - - // Can add propHook for "elements" to filter or add form elements - var elements = jQuery.prop( this, "elements" ); - return elements ? jQuery.makeArray( elements ) : this; - } ).filter( function() { - var type = this.type; - - // Use .is( ":disabled" ) so that fieldset[disabled] works - return this.name && !jQuery( this ).is( ":disabled" ) && - rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && - ( this.checked || !rcheckableType.test( type ) ); - } ).map( function( _i, elem ) { - var val = jQuery( this ).val(); - - if ( val == null ) { - return null; - } - - if ( Array.isArray( val ) ) { - return jQuery.map( val, function( val ) { - return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; - } ); - } - - return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; - } ).get(); - } -} ); - - -var - r20 = /%20/g, - rhash = /#.*$/, - rantiCache = /([?&])_=[^&]*/, - rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, - - // #7653, #8125, #8152: local protocol detection - rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, - rnoContent = /^(?:GET|HEAD)$/, - rprotocol = /^\/\//, - - /* Prefilters - * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) - * 2) These are called: - * - BEFORE asking for a transport - * - AFTER param serialization (s.data is a string if s.processData is true) - * 3) key is the dataType - * 4) the catchall symbol "*" can be used - * 5) execution will start with transport dataType and THEN continue down to "*" if needed - */ - prefilters = {}, - - /* Transports bindings - * 1) key is the dataType - * 2) the catchall symbol "*" can be used - * 3) selection will start with transport dataType and THEN go to "*" if needed - */ - transports = {}, - - // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression - allTypes = "*/".concat( "*" ), - - // Anchor tag for parsing the document origin - originAnchor = document.createElement( "a" ); - -originAnchor.href = location.href; - -// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport -function addToPrefiltersOrTransports( structure ) { - - // dataTypeExpression is optional and defaults to "*" - return function( dataTypeExpression, func ) { - - if ( typeof dataTypeExpression !== "string" ) { - func = dataTypeExpression; - dataTypeExpression = "*"; - } - - var dataType, - i = 0, - dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; - - if ( isFunction( func ) ) { - - // For each dataType in the dataTypeExpression - while ( ( dataType = dataTypes[ i++ ] ) ) { - - // Prepend if requested - if ( dataType[ 0 ] === "+" ) { - dataType = dataType.slice( 1 ) || "*"; - ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); - - // Otherwise append - } else { - ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); - } - } - } - }; -} - -// Base inspection function for prefilters and transports -function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { - - var inspected = {}, - seekingTransport = ( structure === transports ); - - function inspect( dataType ) { - var selected; - inspected[ dataType ] = true; - jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { - var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); - if ( typeof dataTypeOrTransport === "string" && - !seekingTransport && !inspected[ dataTypeOrTransport ] ) { - - options.dataTypes.unshift( dataTypeOrTransport ); - inspect( dataTypeOrTransport ); - return false; - } else if ( seekingTransport ) { - return !( selected = dataTypeOrTransport ); - } - } ); - return selected; - } - - return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); -} - -// A special extend for ajax options -// that takes "flat" options (not to be deep extended) -// Fixes #9887 -function ajaxExtend( target, src ) { - var key, deep, - flatOptions = jQuery.ajaxSettings.flatOptions || {}; - - for ( key in src ) { - if ( src[ key ] !== undefined ) { - ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; - } - } - if ( deep ) { - jQuery.extend( true, target, deep ); - } - - return target; -} - -/* Handles responses to an ajax request: - * - finds the right dataType (mediates between content-type and expected dataType) - * - returns the corresponding response - */ -function ajaxHandleResponses( s, jqXHR, responses ) { - - var ct, type, finalDataType, firstDataType, - contents = s.contents, - dataTypes = s.dataTypes; - - // Remove auto dataType and get content-type in the process - while ( dataTypes[ 0 ] === "*" ) { - dataTypes.shift(); - if ( ct === undefined ) { - ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); - } - } - - // Check if we're dealing with a known content-type - if ( ct ) { - for ( type in contents ) { - if ( contents[ type ] && contents[ type ].test( ct ) ) { - dataTypes.unshift( type ); - break; - } - } - } - - // Check to see if we have a response for the expected dataType - if ( dataTypes[ 0 ] in responses ) { - finalDataType = dataTypes[ 0 ]; - } else { - - // Try convertible dataTypes - for ( type in responses ) { - if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { - finalDataType = type; - break; - } - if ( !firstDataType ) { - firstDataType = type; - } - } - - // Or just use first one - finalDataType = finalDataType || firstDataType; - } - - // If we found a dataType - // We add the dataType to the list if needed - // and return the corresponding response - if ( finalDataType ) { - if ( finalDataType !== dataTypes[ 0 ] ) { - dataTypes.unshift( finalDataType ); - } - return responses[ finalDataType ]; - } -} - -/* Chain conversions given the request and the original response - * Also sets the responseXXX fields on the jqXHR instance - */ -function ajaxConvert( s, response, jqXHR, isSuccess ) { - var conv2, current, conv, tmp, prev, - converters = {}, - - // Work with a copy of dataTypes in case we need to modify it for conversion - dataTypes = s.dataTypes.slice(); - - // Create converters map with lowercased keys - if ( dataTypes[ 1 ] ) { - for ( conv in s.converters ) { - converters[ conv.toLowerCase() ] = s.converters[ conv ]; - } - } - - current = dataTypes.shift(); - - // Convert to each sequential dataType - while ( current ) { - - if ( s.responseFields[ current ] ) { - jqXHR[ s.responseFields[ current ] ] = response; - } - - // Apply the dataFilter if provided - if ( !prev && isSuccess && s.dataFilter ) { - response = s.dataFilter( response, s.dataType ); - } - - prev = current; - current = dataTypes.shift(); - - if ( current ) { - - // There's only work to do if current dataType is non-auto - if ( current === "*" ) { - - current = prev; - - // Convert response if prev dataType is non-auto and differs from current - } else if ( prev !== "*" && prev !== current ) { - - // Seek a direct converter - conv = converters[ prev + " " + current ] || converters[ "* " + current ]; - - // If none found, seek a pair - if ( !conv ) { - for ( conv2 in converters ) { - - // If conv2 outputs current - tmp = conv2.split( " " ); - if ( tmp[ 1 ] === current ) { - - // If prev can be converted to accepted input - conv = converters[ prev + " " + tmp[ 0 ] ] || - converters[ "* " + tmp[ 0 ] ]; - if ( conv ) { - - // Condense equivalence converters - if ( conv === true ) { - conv = converters[ conv2 ]; - - // Otherwise, insert the intermediate dataType - } else if ( converters[ conv2 ] !== true ) { - current = tmp[ 0 ]; - dataTypes.unshift( tmp[ 1 ] ); - } - break; - } - } - } - } - - // Apply converter (if not an equivalence) - if ( conv !== true ) { - - // Unless errors are allowed to bubble, catch and return them - if ( conv && s.throws ) { - response = conv( response ); - } else { - try { - response = conv( response ); - } catch ( e ) { - return { - state: "parsererror", - error: conv ? e : "No conversion from " + prev + " to " + current - }; - } - } - } - } - } - } - - return { state: "success", data: response }; -} - -jQuery.extend( { - - // Counter for holding the number of active queries - active: 0, - - // Last-Modified header cache for next request - lastModified: {}, - etag: {}, - - ajaxSettings: { - url: location.href, - type: "GET", - isLocal: rlocalProtocol.test( location.protocol ), - global: true, - processData: true, - async: true, - contentType: "application/x-www-form-urlencoded; charset=UTF-8", - - /* - timeout: 0, - data: null, - dataType: null, - username: null, - password: null, - cache: null, - throws: false, - traditional: false, - headers: {}, - */ - - accepts: { - "*": allTypes, - text: "text/plain", - html: "text/html", - xml: "application/xml, text/xml", - json: "application/json, text/javascript" - }, - - contents: { - xml: /\bxml\b/, - html: /\bhtml/, - json: /\bjson\b/ - }, - - responseFields: { - xml: "responseXML", - text: "responseText", - json: "responseJSON" - }, - - // Data converters - // Keys separate source (or catchall "*") and destination types with a single space - converters: { - - // Convert anything to text - "* text": String, - - // Text to html (true = no transformation) - "text html": true, - - // Evaluate text as a json expression - "text json": JSON.parse, - - // Parse text as xml - "text xml": jQuery.parseXML - }, - - // For options that shouldn't be deep extended: - // you can add your own custom options here if - // and when you create one that shouldn't be - // deep extended (see ajaxExtend) - flatOptions: { - url: true, - context: true - } - }, - - // Creates a full fledged settings object into target - // with both ajaxSettings and settings fields. - // If target is omitted, writes into ajaxSettings. - ajaxSetup: function( target, settings ) { - return settings ? - - // Building a settings object - ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : - - // Extending ajaxSettings - ajaxExtend( jQuery.ajaxSettings, target ); - }, - - ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), - ajaxTransport: addToPrefiltersOrTransports( transports ), - - // Main method - ajax: function( url, options ) { - - // If url is an object, simulate pre-1.5 signature - if ( typeof url === "object" ) { - options = url; - url = undefined; - } - - // Force options to be an object - options = options || {}; - - var transport, - - // URL without anti-cache param - cacheURL, - - // Response headers - responseHeadersString, - responseHeaders, - - // timeout handle - timeoutTimer, - - // Url cleanup var - urlAnchor, - - // Request state (becomes false upon send and true upon completion) - completed, - - // To know if global events are to be dispatched - fireGlobals, - - // Loop variable - i, - - // uncached part of the url - uncached, - - // Create the final options object - s = jQuery.ajaxSetup( {}, options ), - - // Callbacks context - callbackContext = s.context || s, - - // Context for global events is callbackContext if it is a DOM node or jQuery collection - globalEventContext = s.context && - ( callbackContext.nodeType || callbackContext.jquery ) ? - jQuery( callbackContext ) : - jQuery.event, - - // Deferreds - deferred = jQuery.Deferred(), - completeDeferred = jQuery.Callbacks( "once memory" ), - - // Status-dependent callbacks - statusCode = s.statusCode || {}, - - // Headers (they are sent all at once) - requestHeaders = {}, - requestHeadersNames = {}, - - // Default abort message - strAbort = "canceled", - - // Fake xhr - jqXHR = { - readyState: 0, - - // Builds headers hashtable if needed - getResponseHeader: function( key ) { - var match; - if ( completed ) { - if ( !responseHeaders ) { - responseHeaders = {}; - while ( ( match = rheaders.exec( responseHeadersString ) ) ) { - responseHeaders[ match[ 1 ].toLowerCase() + " " ] = - ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] ) - .concat( match[ 2 ] ); - } - } - match = responseHeaders[ key.toLowerCase() + " " ]; - } - return match == null ? null : match.join( ", " ); - }, - - // Raw string - getAllResponseHeaders: function() { - return completed ? responseHeadersString : null; - }, - - // Caches the header - setRequestHeader: function( name, value ) { - if ( completed == null ) { - name = requestHeadersNames[ name.toLowerCase() ] = - requestHeadersNames[ name.toLowerCase() ] || name; - requestHeaders[ name ] = value; - } - return this; - }, - - // Overrides response content-type header - overrideMimeType: function( type ) { - if ( completed == null ) { - s.mimeType = type; - } - return this; - }, - - // Status-dependent callbacks - statusCode: function( map ) { - var code; - if ( map ) { - if ( completed ) { - - // Execute the appropriate callbacks - jqXHR.always( map[ jqXHR.status ] ); - } else { - - // Lazy-add the new callbacks in a way that preserves old ones - for ( code in map ) { - statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; - } - } - } - return this; - }, - - // Cancel the request - abort: function( statusText ) { - var finalText = statusText || strAbort; - if ( transport ) { - transport.abort( finalText ); - } - done( 0, finalText ); - return this; - } - }; - - // Attach deferreds - deferred.promise( jqXHR ); - - // Add protocol if not provided (prefilters might expect it) - // Handle falsy url in the settings object (#10093: consistency with old signature) - // We also use the url parameter if available - s.url = ( ( url || s.url || location.href ) + "" ) - .replace( rprotocol, location.protocol + "//" ); - - // Alias method option to type as per ticket #12004 - s.type = options.method || options.type || s.method || s.type; - - // Extract dataTypes list - s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; - - // A cross-domain request is in order when the origin doesn't match the current origin. - if ( s.crossDomain == null ) { - urlAnchor = document.createElement( "a" ); - - // Support: IE <=8 - 11, Edge 12 - 15 - // IE throws exception on accessing the href property if url is malformed, - // e.g. http://example.com:80x/ - try { - urlAnchor.href = s.url; - - // Support: IE <=8 - 11 only - // Anchor's host property isn't correctly set when s.url is relative - urlAnchor.href = urlAnchor.href; - s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== - urlAnchor.protocol + "//" + urlAnchor.host; - } catch ( e ) { - - // If there is an error parsing the URL, assume it is crossDomain, - // it can be rejected by the transport if it is invalid - s.crossDomain = true; - } - } - - // Convert data if not already a string - if ( s.data && s.processData && typeof s.data !== "string" ) { - s.data = jQuery.param( s.data, s.traditional ); - } - - // Apply prefilters - inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); - - // If request was aborted inside a prefilter, stop there - if ( completed ) { - return jqXHR; - } - - // We can fire global events as of now if asked to - // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) - fireGlobals = jQuery.event && s.global; - - // Watch for a new set of requests - if ( fireGlobals && jQuery.active++ === 0 ) { - jQuery.event.trigger( "ajaxStart" ); - } - - // Uppercase the type - s.type = s.type.toUpperCase(); - - // Determine if request has content - s.hasContent = !rnoContent.test( s.type ); - - // Save the URL in case we're toying with the If-Modified-Since - // and/or If-None-Match header later on - // Remove hash to simplify url manipulation - cacheURL = s.url.replace( rhash, "" ); - - // More options handling for requests with no content - if ( !s.hasContent ) { - - // Remember the hash so we can put it back - uncached = s.url.slice( cacheURL.length ); - - // If data is available and should be processed, append data to url - if ( s.data && ( s.processData || typeof s.data === "string" ) ) { - cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; - - // #9682: remove data so that it's not used in an eventual retry - delete s.data; - } - - // Add or update anti-cache param if needed - if ( s.cache === false ) { - cacheURL = cacheURL.replace( rantiCache, "$1" ); - uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) + - uncached; - } - - // Put hash and anti-cache on the URL that will be requested (gh-1732) - s.url = cacheURL + uncached; - - // Change '%20' to '+' if this is encoded form body content (gh-2658) - } else if ( s.data && s.processData && - ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { - s.data = s.data.replace( r20, "+" ); - } - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - if ( jQuery.lastModified[ cacheURL ] ) { - jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); - } - if ( jQuery.etag[ cacheURL ] ) { - jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); - } - } - - // Set the correct header, if data is being sent - if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { - jqXHR.setRequestHeader( "Content-Type", s.contentType ); - } - - // Set the Accepts header for the server, depending on the dataType - jqXHR.setRequestHeader( - "Accept", - s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? - s.accepts[ s.dataTypes[ 0 ] ] + - ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : - s.accepts[ "*" ] - ); - - // Check for headers option - for ( i in s.headers ) { - jqXHR.setRequestHeader( i, s.headers[ i ] ); - } - - // Allow custom headers/mimetypes and early abort - if ( s.beforeSend && - ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { - - // Abort if not done already and return - return jqXHR.abort(); - } - - // Aborting is no longer a cancellation - strAbort = "abort"; - - // Install callbacks on deferreds - completeDeferred.add( s.complete ); - jqXHR.done( s.success ); - jqXHR.fail( s.error ); - - // Get transport - transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); - - // If no transport, we auto-abort - if ( !transport ) { - done( -1, "No Transport" ); - } else { - jqXHR.readyState = 1; - - // Send global event - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); - } - - // If request was aborted inside ajaxSend, stop there - if ( completed ) { - return jqXHR; - } - - // Timeout - if ( s.async && s.timeout > 0 ) { - timeoutTimer = window.setTimeout( function() { - jqXHR.abort( "timeout" ); - }, s.timeout ); - } - - try { - completed = false; - transport.send( requestHeaders, done ); - } catch ( e ) { - - // Rethrow post-completion exceptions - if ( completed ) { - throw e; - } - - // Propagate others as results - done( -1, e ); - } - } - - // Callback for when everything is done - function done( status, nativeStatusText, responses, headers ) { - var isSuccess, success, error, response, modified, - statusText = nativeStatusText; - - // Ignore repeat invocations - if ( completed ) { - return; - } - - completed = true; - - // Clear timeout if it exists - if ( timeoutTimer ) { - window.clearTimeout( timeoutTimer ); - } - - // Dereference transport for early garbage collection - // (no matter how long the jqXHR object will be used) - transport = undefined; - - // Cache response headers - responseHeadersString = headers || ""; - - // Set readyState - jqXHR.readyState = status > 0 ? 4 : 0; - - // Determine if successful - isSuccess = status >= 200 && status < 300 || status === 304; - - // Get response data - if ( responses ) { - response = ajaxHandleResponses( s, jqXHR, responses ); - } - - // Use a noop converter for missing script but not if jsonp - if ( !isSuccess && - jQuery.inArray( "script", s.dataTypes ) > -1 && - jQuery.inArray( "json", s.dataTypes ) < 0 ) { - s.converters[ "text script" ] = function() {}; - } - - // Convert no matter what (that way responseXXX fields are always set) - response = ajaxConvert( s, response, jqXHR, isSuccess ); - - // If successful, handle type chaining - if ( isSuccess ) { - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - modified = jqXHR.getResponseHeader( "Last-Modified" ); - if ( modified ) { - jQuery.lastModified[ cacheURL ] = modified; - } - modified = jqXHR.getResponseHeader( "etag" ); - if ( modified ) { - jQuery.etag[ cacheURL ] = modified; - } - } - - // if no content - if ( status === 204 || s.type === "HEAD" ) { - statusText = "nocontent"; - - // if not modified - } else if ( status === 304 ) { - statusText = "notmodified"; - - // If we have data, let's convert it - } else { - statusText = response.state; - success = response.data; - error = response.error; - isSuccess = !error; - } - } else { - - // Extract error from statusText and normalize for non-aborts - error = statusText; - if ( status || !statusText ) { - statusText = "error"; - if ( status < 0 ) { - status = 0; - } - } - } - - // Set data for the fake xhr object - jqXHR.status = status; - jqXHR.statusText = ( nativeStatusText || statusText ) + ""; - - // Success/Error - if ( isSuccess ) { - deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); - } else { - deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); - } - - // Status-dependent callbacks - jqXHR.statusCode( statusCode ); - statusCode = undefined; - - if ( fireGlobals ) { - globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", - [ jqXHR, s, isSuccess ? success : error ] ); - } - - // Complete - completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); - - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); - - // Handle the global AJAX counter - if ( !( --jQuery.active ) ) { - jQuery.event.trigger( "ajaxStop" ); - } - } - } - - return jqXHR; - }, - - getJSON: function( url, data, callback ) { - return jQuery.get( url, data, callback, "json" ); - }, - - getScript: function( url, callback ) { - return jQuery.get( url, undefined, callback, "script" ); - } -} ); - -jQuery.each( [ "get", "post" ], function( _i, method ) { - jQuery[ method ] = function( url, data, callback, type ) { - - // Shift arguments if data argument was omitted - if ( isFunction( data ) ) { - type = type || callback; - callback = data; - data = undefined; - } - - // The url can be an options object (which then must have .url) - return jQuery.ajax( jQuery.extend( { - url: url, - type: method, - dataType: type, - data: data, - success: callback - }, jQuery.isPlainObject( url ) && url ) ); - }; -} ); - -jQuery.ajaxPrefilter( function( s ) { - var i; - for ( i in s.headers ) { - if ( i.toLowerCase() === "content-type" ) { - s.contentType = s.headers[ i ] || ""; - } - } -} ); - - -jQuery._evalUrl = function( url, options, doc ) { - return jQuery.ajax( { - url: url, - - // Make this explicit, since user can override this through ajaxSetup (#11264) - type: "GET", - dataType: "script", - cache: true, - async: false, - global: false, - - // Only evaluate the response if it is successful (gh-4126) - // dataFilter is not invoked for failure responses, so using it instead - // of the default converter is kludgy but it works. - converters: { - "text script": function() {} - }, - dataFilter: function( response ) { - jQuery.globalEval( response, options, doc ); - } - } ); -}; - - -jQuery.fn.extend( { - wrapAll: function( html ) { - var wrap; - - if ( this[ 0 ] ) { - if ( isFunction( html ) ) { - html = html.call( this[ 0 ] ); - } - - // The elements to wrap the target around - wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); - - if ( this[ 0 ].parentNode ) { - wrap.insertBefore( this[ 0 ] ); - } - - wrap.map( function() { - var elem = this; - - while ( elem.firstElementChild ) { - elem = elem.firstElementChild; - } - - return elem; - } ).append( this ); - } - - return this; - }, - - wrapInner: function( html ) { - if ( isFunction( html ) ) { - return this.each( function( i ) { - jQuery( this ).wrapInner( html.call( this, i ) ); - } ); - } - - return this.each( function() { - var self = jQuery( this ), - contents = self.contents(); - - if ( contents.length ) { - contents.wrapAll( html ); - - } else { - self.append( html ); - } - } ); - }, - - wrap: function( html ) { - var htmlIsFunction = isFunction( html ); - - return this.each( function( i ) { - jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); - } ); - }, - - unwrap: function( selector ) { - this.parent( selector ).not( "body" ).each( function() { - jQuery( this ).replaceWith( this.childNodes ); - } ); - return this; - } -} ); - - -jQuery.expr.pseudos.hidden = function( elem ) { - return !jQuery.expr.pseudos.visible( elem ); -}; -jQuery.expr.pseudos.visible = function( elem ) { - return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); -}; - - - - -jQuery.ajaxSettings.xhr = function() { - try { - return new window.XMLHttpRequest(); - } catch ( e ) {} -}; - -var xhrSuccessStatus = { - - // File protocol always yields status code 0, assume 200 - 0: 200, - - // Support: IE <=9 only - // #1450: sometimes IE returns 1223 when it should be 204 - 1223: 204 - }, - xhrSupported = jQuery.ajaxSettings.xhr(); - -support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); -support.ajax = xhrSupported = !!xhrSupported; - -jQuery.ajaxTransport( function( options ) { - var callback, errorCallback; - - // Cross domain only allowed if supported through XMLHttpRequest - if ( support.cors || xhrSupported && !options.crossDomain ) { - return { - send: function( headers, complete ) { - var i, - xhr = options.xhr(); - - xhr.open( - options.type, - options.url, - options.async, - options.username, - options.password - ); - - // Apply custom fields if provided - if ( options.xhrFields ) { - for ( i in options.xhrFields ) { - xhr[ i ] = options.xhrFields[ i ]; - } - } - - // Override mime type if needed - if ( options.mimeType && xhr.overrideMimeType ) { - xhr.overrideMimeType( options.mimeType ); - } - - // X-Requested-With header - // For cross-domain requests, seeing as conditions for a preflight are - // akin to a jigsaw puzzle, we simply never set it to be sure. - // (it can always be set on a per-request basis or even using ajaxSetup) - // For same-domain requests, won't change header if already provided. - if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { - headers[ "X-Requested-With" ] = "XMLHttpRequest"; - } - - // Set headers - for ( i in headers ) { - xhr.setRequestHeader( i, headers[ i ] ); - } - - // Callback - callback = function( type ) { - return function() { - if ( callback ) { - callback = errorCallback = xhr.onload = - xhr.onerror = xhr.onabort = xhr.ontimeout = - xhr.onreadystatechange = null; - - if ( type === "abort" ) { - xhr.abort(); - } else if ( type === "error" ) { - - // Support: IE <=9 only - // On a manual native abort, IE9 throws - // errors on any property access that is not readyState - if ( typeof xhr.status !== "number" ) { - complete( 0, "error" ); - } else { - complete( - - // File: protocol always yields status 0; see #8605, #14207 - xhr.status, - xhr.statusText - ); - } - } else { - complete( - xhrSuccessStatus[ xhr.status ] || xhr.status, - xhr.statusText, - - // Support: IE <=9 only - // IE9 has no XHR2 but throws on binary (trac-11426) - // For XHR2 non-text, let the caller handle it (gh-2498) - ( xhr.responseType || "text" ) !== "text" || - typeof xhr.responseText !== "string" ? - { binary: xhr.response } : - { text: xhr.responseText }, - xhr.getAllResponseHeaders() - ); - } - } - }; - }; - - // Listen to events - xhr.onload = callback(); - errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); - - // Support: IE 9 only - // Use onreadystatechange to replace onabort - // to handle uncaught aborts - if ( xhr.onabort !== undefined ) { - xhr.onabort = errorCallback; - } else { - xhr.onreadystatechange = function() { - - // Check readyState before timeout as it changes - if ( xhr.readyState === 4 ) { - - // Allow onerror to be called first, - // but that will not handle a native abort - // Also, save errorCallback to a variable - // as xhr.onerror cannot be accessed - window.setTimeout( function() { - if ( callback ) { - errorCallback(); - } - } ); - } - }; - } - - // Create the abort callback - callback = callback( "abort" ); - - try { - - // Do send the request (this may raise an exception) - xhr.send( options.hasContent && options.data || null ); - } catch ( e ) { - - // #14683: Only rethrow if this hasn't been notified as an error yet - if ( callback ) { - throw e; - } - } - }, - - abort: function() { - if ( callback ) { - callback(); - } - } - }; - } -} ); - - - - -// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) -jQuery.ajaxPrefilter( function( s ) { - if ( s.crossDomain ) { - s.contents.script = false; - } -} ); - -// Install script dataType -jQuery.ajaxSetup( { - accepts: { - script: "text/javascript, application/javascript, " + - "application/ecmascript, application/x-ecmascript" - }, - contents: { - script: /\b(?:java|ecma)script\b/ - }, - converters: { - "text script": function( text ) { - jQuery.globalEval( text ); - return text; - } - } -} ); - -// Handle cache's special case and crossDomain -jQuery.ajaxPrefilter( "script", function( s ) { - if ( s.cache === undefined ) { - s.cache = false; - } - if ( s.crossDomain ) { - s.type = "GET"; - } -} ); - -// Bind script tag hack transport -jQuery.ajaxTransport( "script", function( s ) { - - // This transport only deals with cross domain or forced-by-attrs requests - if ( s.crossDomain || s.scriptAttrs ) { - var script, callback; - return { - send: function( _, complete ) { - script = jQuery( " + + diff -Nru pat-0.12.1/web/dist/js/app.js pat-0.13.1/web/dist/js/app.js --- pat-0.12.1/web/dist/js/app.js 1970-01-01 00:00:00.000000000 +0000 +++ pat-0.13.1/web/dist/js/app.js 2022-10-22 20:39:54.000000000 +0000 @@ -0,0 +1,3 @@ +/*! For license information please see app.js.LICENSE.txt */ +!function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="../",n(n.s=5)}([function(t,e,n){var i;!function(e,n){"use strict";"object"==typeof t.exports?t.exports=e.document?n(e,!0):function(t){if(!t.document)throw new Error("jQuery requires a window with a document");return n(t)}:n(e)}("undefined"!=typeof window?window:this,(function(n,o){"use strict";var r=[],s=Object.getPrototypeOf,a=r.slice,l=r.flat?function(t){return r.flat.call(t)}:function(t){return r.concat.apply([],t)},c=r.push,u=r.indexOf,p={},d=p.toString,h=p.hasOwnProperty,f=h.toString,m=f.call(Object),g={},v=function(t){return"function"==typeof t&&"number"!=typeof t.nodeType&&"function"!=typeof t.item},y=function(t){return null!=t&&t===t.window},b=n.document,x={type:!0,src:!0,nonce:!0,noModule:!0};function w(t,e,n){var i,o,r=(n=n||b).createElement("script");if(r.text=t,e)for(i in x)(o=e[i]||e.getAttribute&&e.getAttribute(i))&&r.setAttribute(i,o);n.head.appendChild(r).parentNode.removeChild(r)}function k(t){return null==t?t+"":"object"==typeof t||"function"==typeof t?p[d.call(t)]||"object":typeof t}var $="3.6.0",C=function(t,e){return new C.fn.init(t,e)};function T(t){var e=!!t&&"length"in t&&t.length,n=k(t);return!v(t)&&!y(t)&&("array"===n||0===e||"number"==typeof e&&e>0&&e-1 in t)}C.fn=C.prototype={jquery:$,constructor:C,length:0,toArray:function(){return a.call(this)},get:function(t){return null==t?a.call(this):t<0?this[t+this.length]:this[t]},pushStack:function(t){var e=C.merge(this.constructor(),t);return e.prevObject=this,e},each:function(t){return C.each(this,t)},map:function(t){return this.pushStack(C.map(this,(function(e,n){return t.call(e,n,e)})))},slice:function(){return this.pushStack(a.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(C.grep(this,(function(t,e){return(e+1)%2})))},odd:function(){return this.pushStack(C.grep(this,(function(t,e){return e%2})))},eq:function(t){var e=this.length,n=+t+(t<0?e:0);return this.pushStack(n>=0&&n+~]|[\\x20\\t\\r\\n\\f])[\\x20\\t\\r\\n\\f]*"),B=new RegExp(L+"|>"),Q=new RegExp(F),V=new RegExp("^"+z+"$"),G={ID:new RegExp("^#("+z+")"),CLASS:new RegExp("^\\.("+z+")"),TAG:new RegExp("^("+z+"|[*])"),ATTR:new RegExp("^"+R),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\([\\x20\\t\\r\\n\\f]*(even|odd|(([+-]|)(\\d*)n|)[\\x20\\t\\r\\n\\f]*(?:([+-]|)[\\x20\\t\\r\\n\\f]*(\\d+)|))[\\x20\\t\\r\\n\\f]*\\)|)","i"),bool:new RegExp("^(?:"+q+")$","i"),needsContext:new RegExp("^[\\x20\\t\\r\\n\\f]*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\([\\x20\\t\\r\\n\\f]*((?:-\\d)?\\d*)[\\x20\\t\\r\\n\\f]*\\)|)(?=[^-]|$)","i")},X=/HTML$/i,J=/^(?:input|select|textarea|button)$/i,K=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,tt=/[+~]/,et=new RegExp("\\\\[\\da-fA-F]{1,6}[\\x20\\t\\r\\n\\f]?|\\\\([^\\r\\n\\f])","g"),nt=function(t,e){var n="0x"+t.slice(1)-65536;return e||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},it=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ot=function(t,e){return e?"\0"===t?"�":t.slice(0,-1)+"\\"+t.charCodeAt(t.length-1).toString(16)+" ":"\\"+t},rt=function(){d()},st=xt((function(t){return!0===t.disabled&&"fieldset"===t.nodeName.toLowerCase()}),{dir:"parentNode",next:"legend"});try{N.apply(D=P.call(w.childNodes),w.childNodes),D[w.childNodes.length].nodeType}catch(t){N={apply:D.length?function(t,e){j.apply(t,P.call(e))}:function(t,e){for(var n=t.length,i=0;t[n++]=e[i++];);t.length=n-1}}}function at(t,e,i,o){var r,a,c,u,p,f,v,y=e&&e.ownerDocument,w=e?e.nodeType:9;if(i=i||[],"string"!=typeof t||!t||1!==w&&9!==w&&11!==w)return i;if(!o&&(d(e),e=e||h,m)){if(11!==w&&(p=Z.exec(t)))if(r=p[1]){if(9===w){if(!(c=e.getElementById(r)))return i;if(c.id===r)return i.push(c),i}else if(y&&(c=y.getElementById(r))&&b(e,c)&&c.id===r)return i.push(c),i}else{if(p[2])return N.apply(i,e.getElementsByTagName(t)),i;if((r=p[3])&&n.getElementsByClassName&&e.getElementsByClassName)return N.apply(i,e.getElementsByClassName(r)),i}if(n.qsa&&!_[t+" "]&&(!g||!g.test(t))&&(1!==w||"object"!==e.nodeName.toLowerCase())){if(v=t,y=e,1===w&&(B.test(t)||W.test(t))){for((y=tt.test(t)&&vt(e.parentNode)||e)===e&&n.scope||((u=e.getAttribute("id"))?u=u.replace(it,ot):e.setAttribute("id",u=x)),a=(f=s(t)).length;a--;)f[a]=(u?"#"+u:":scope")+" "+bt(f[a]);v=f.join(",")}try{return N.apply(i,y.querySelectorAll(v)),i}catch(e){_(t,!0)}finally{u===x&&e.removeAttribute("id")}}}return l(t.replace(M,"$1"),e,i,o)}function lt(){var t=[];return function e(n,o){return t.push(n+" ")>i.cacheLength&&delete e[t.shift()],e[n+" "]=o}}function ct(t){return t[x]=!0,t}function ut(t){var e=h.createElement("fieldset");try{return!!t(e)}catch(t){return!1}finally{e.parentNode&&e.parentNode.removeChild(e),e=null}}function pt(t,e){for(var n=t.split("|"),o=n.length;o--;)i.attrHandle[n[o]]=e}function dt(t,e){var n=e&&t,i=n&&1===t.nodeType&&1===e.nodeType&&t.sourceIndex-e.sourceIndex;if(i)return i;if(n)for(;n=n.nextSibling;)if(n===e)return-1;return t?1:-1}function ht(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function ft(t){return function(e){var n=e.nodeName.toLowerCase();return("input"===n||"button"===n)&&e.type===t}}function mt(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&st(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function gt(t){return ct((function(e){return e=+e,ct((function(n,i){for(var o,r=t([],n.length,e),s=r.length;s--;)n[o=r[s]]&&(n[o]=!(i[o]=n[o]))}))}))}function vt(t){return t&&void 0!==t.getElementsByTagName&&t}for(e in n=at.support={},r=at.isXML=function(t){var e=t&&t.namespaceURI,n=t&&(t.ownerDocument||t).documentElement;return!X.test(e||n&&n.nodeName||"HTML")},d=at.setDocument=function(t){var e,o,s=t?t.ownerDocument||t:w;return s!=h&&9===s.nodeType&&s.documentElement?(f=(h=s).documentElement,m=!r(h),w!=h&&(o=h.defaultView)&&o.top!==o&&(o.addEventListener?o.addEventListener("unload",rt,!1):o.attachEvent&&o.attachEvent("onunload",rt)),n.scope=ut((function(t){return f.appendChild(t).appendChild(h.createElement("div")),void 0!==t.querySelectorAll&&!t.querySelectorAll(":scope fieldset div").length})),n.attributes=ut((function(t){return t.className="i",!t.getAttribute("className")})),n.getElementsByTagName=ut((function(t){return t.appendChild(h.createComment("")),!t.getElementsByTagName("*").length})),n.getElementsByClassName=Y.test(h.getElementsByClassName),n.getById=ut((function(t){return f.appendChild(t).id=x,!h.getElementsByName||!h.getElementsByName(x).length})),n.getById?(i.filter.ID=function(t){var e=t.replace(et,nt);return function(t){return t.getAttribute("id")===e}},i.find.ID=function(t,e){if(void 0!==e.getElementById&&m){var n=e.getElementById(t);return n?[n]:[]}}):(i.filter.ID=function(t){var e=t.replace(et,nt);return function(t){var n=void 0!==t.getAttributeNode&&t.getAttributeNode("id");return n&&n.value===e}},i.find.ID=function(t,e){if(void 0!==e.getElementById&&m){var n,i,o,r=e.getElementById(t);if(r){if((n=r.getAttributeNode("id"))&&n.value===t)return[r];for(o=e.getElementsByName(t),i=0;r=o[i++];)if((n=r.getAttributeNode("id"))&&n.value===t)return[r]}return[]}}),i.find.TAG=n.getElementsByTagName?function(t,e){return void 0!==e.getElementsByTagName?e.getElementsByTagName(t):n.qsa?e.querySelectorAll(t):void 0}:function(t,e){var n,i=[],o=0,r=e.getElementsByTagName(t);if("*"===t){for(;n=r[o++];)1===n.nodeType&&i.push(n);return i}return r},i.find.CLASS=n.getElementsByClassName&&function(t,e){if(void 0!==e.getElementsByClassName&&m)return e.getElementsByClassName(t)},v=[],g=[],(n.qsa=Y.test(h.querySelectorAll))&&(ut((function(t){var e;f.appendChild(t).innerHTML="",t.querySelectorAll("[msallowcapture^='']").length&&g.push("[*^$]=[\\x20\\t\\r\\n\\f]*(?:''|\"\")"),t.querySelectorAll("[selected]").length||g.push("\\[[\\x20\\t\\r\\n\\f]*(?:value|"+q+")"),t.querySelectorAll("[id~="+x+"-]").length||g.push("~="),(e=h.createElement("input")).setAttribute("name",""),t.appendChild(e),t.querySelectorAll("[name='']").length||g.push("\\[[\\x20\\t\\r\\n\\f]*name[\\x20\\t\\r\\n\\f]*=[\\x20\\t\\r\\n\\f]*(?:''|\"\")"),t.querySelectorAll(":checked").length||g.push(":checked"),t.querySelectorAll("a#"+x+"+*").length||g.push(".#.+[+~]"),t.querySelectorAll("\\\f"),g.push("[\\r\\n\\f]")})),ut((function(t){t.innerHTML="";var e=h.createElement("input");e.setAttribute("type","hidden"),t.appendChild(e).setAttribute("name","D"),t.querySelectorAll("[name=d]").length&&g.push("name[\\x20\\t\\r\\n\\f]*[*^$|!~]?="),2!==t.querySelectorAll(":enabled").length&&g.push(":enabled",":disabled"),f.appendChild(t).disabled=!0,2!==t.querySelectorAll(":disabled").length&&g.push(":enabled",":disabled"),t.querySelectorAll("*,:x"),g.push(",.*:")}))),(n.matchesSelector=Y.test(y=f.matches||f.webkitMatchesSelector||f.mozMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&ut((function(t){n.disconnectedMatch=y.call(t,"*"),y.call(t,"[s!='']:x"),v.push("!=",F)})),g=g.length&&new RegExp(g.join("|")),v=v.length&&new RegExp(v.join("|")),e=Y.test(f.compareDocumentPosition),b=e||Y.test(f.contains)?function(t,e){var n=9===t.nodeType?t.documentElement:t,i=e&&e.parentNode;return t===i||!(!i||1!==i.nodeType||!(n.contains?n.contains(i):t.compareDocumentPosition&&16&t.compareDocumentPosition(i)))}:function(t,e){if(e)for(;e=e.parentNode;)if(e===t)return!0;return!1},E=e?function(t,e){if(t===e)return p=!0,0;var i=!t.compareDocumentPosition-!e.compareDocumentPosition;return i||(1&(i=(t.ownerDocument||t)==(e.ownerDocument||e)?t.compareDocumentPosition(e):1)||!n.sortDetached&&e.compareDocumentPosition(t)===i?t==h||t.ownerDocument==w&&b(w,t)?-1:e==h||e.ownerDocument==w&&b(w,e)?1:u?O(u,t)-O(u,e):0:4&i?-1:1)}:function(t,e){if(t===e)return p=!0,0;var n,i=0,o=t.parentNode,r=e.parentNode,s=[t],a=[e];if(!o||!r)return t==h?-1:e==h?1:o?-1:r?1:u?O(u,t)-O(u,e):0;if(o===r)return dt(t,e);for(n=t;n=n.parentNode;)s.unshift(n);for(n=e;n=n.parentNode;)a.unshift(n);for(;s[i]===a[i];)i++;return i?dt(s[i],a[i]):s[i]==w?-1:a[i]==w?1:0},h):h},at.matches=function(t,e){return at(t,null,null,e)},at.matchesSelector=function(t,e){if(d(t),n.matchesSelector&&m&&!_[e+" "]&&(!v||!v.test(e))&&(!g||!g.test(e)))try{var i=y.call(t,e);if(i||n.disconnectedMatch||t.document&&11!==t.document.nodeType)return i}catch(t){_(e,!0)}return at(e,h,null,[t]).length>0},at.contains=function(t,e){return(t.ownerDocument||t)!=h&&d(t),b(t,e)},at.attr=function(t,e){(t.ownerDocument||t)!=h&&d(t);var o=i.attrHandle[e.toLowerCase()],r=o&&A.call(i.attrHandle,e.toLowerCase())?o(t,e,!m):void 0;return void 0!==r?r:n.attributes||!m?t.getAttribute(e):(r=t.getAttributeNode(e))&&r.specified?r.value:null},at.escape=function(t){return(t+"").replace(it,ot)},at.error=function(t){throw new Error("Syntax error, unrecognized expression: "+t)},at.uniqueSort=function(t){var e,i=[],o=0,r=0;if(p=!n.detectDuplicates,u=!n.sortStable&&t.slice(0),t.sort(E),p){for(;e=t[r++];)e===t[r]&&(o=i.push(r));for(;o--;)t.splice(i[o],1)}return u=null,t},o=at.getText=function(t){var e,n="",i=0,r=t.nodeType;if(r){if(1===r||9===r||11===r){if("string"==typeof t.textContent)return t.textContent;for(t=t.firstChild;t;t=t.nextSibling)n+=o(t)}else if(3===r||4===r)return t.nodeValue}else for(;e=t[i++];)n+=o(e);return n},i=at.selectors={cacheLength:50,createPseudo:ct,match:G,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(t){return t[1]=t[1].replace(et,nt),t[3]=(t[3]||t[4]||t[5]||"").replace(et,nt),"~="===t[2]&&(t[3]=" "+t[3]+" "),t.slice(0,4)},CHILD:function(t){return t[1]=t[1].toLowerCase(),"nth"===t[1].slice(0,3)?(t[3]||at.error(t[0]),t[4]=+(t[4]?t[5]+(t[6]||1):2*("even"===t[3]||"odd"===t[3])),t[5]=+(t[7]+t[8]||"odd"===t[3])):t[3]&&at.error(t[0]),t},PSEUDO:function(t){var e,n=!t[6]&&t[2];return G.CHILD.test(t[0])?null:(t[3]?t[2]=t[4]||t[5]||"":n&&Q.test(n)&&(e=s(n,!0))&&(e=n.indexOf(")",n.length-e)-n.length)&&(t[0]=t[0].slice(0,e),t[2]=n.slice(0,e)),t.slice(0,3))}},filter:{TAG:function(t){var e=t.replace(et,nt).toLowerCase();return"*"===t?function(){return!0}:function(t){return t.nodeName&&t.nodeName.toLowerCase()===e}},CLASS:function(t){var e=C[t+" "];return e||(e=new RegExp("(^|[\\x20\\t\\r\\n\\f])"+t+"("+L+"|$)"))&&C(t,(function(t){return e.test("string"==typeof t.className&&t.className||void 0!==t.getAttribute&&t.getAttribute("class")||"")}))},ATTR:function(t,e,n){return function(i){var o=at.attr(i,t);return null==o?"!="===e:!e||(o+="","="===e?o===n:"!="===e?o!==n:"^="===e?n&&0===o.indexOf(n):"*="===e?n&&o.indexOf(n)>-1:"$="===e?n&&o.slice(-n.length)===n:"~="===e?(" "+o.replace(H," ")+" ").indexOf(n)>-1:"|="===e&&(o===n||o.slice(0,n.length+1)===n+"-"))}},CHILD:function(t,e,n,i,o){var r="nth"!==t.slice(0,3),s="last"!==t.slice(-4),a="of-type"===e;return 1===i&&0===o?function(t){return!!t.parentNode}:function(e,n,l){var c,u,p,d,h,f,m=r!==s?"nextSibling":"previousSibling",g=e.parentNode,v=a&&e.nodeName.toLowerCase(),y=!l&&!a,b=!1;if(g){if(r){for(;m;){for(d=e;d=d[m];)if(a?d.nodeName.toLowerCase()===v:1===d.nodeType)return!1;f=m="only"===t&&!f&&"nextSibling"}return!0}if(f=[s?g.firstChild:g.lastChild],s&&y){for(b=(h=(c=(u=(p=(d=g)[x]||(d[x]={}))[d.uniqueID]||(p[d.uniqueID]={}))[t]||[])[0]===k&&c[1])&&c[2],d=h&&g.childNodes[h];d=++h&&d&&d[m]||(b=h=0)||f.pop();)if(1===d.nodeType&&++b&&d===e){u[t]=[k,h,b];break}}else if(y&&(b=h=(c=(u=(p=(d=e)[x]||(d[x]={}))[d.uniqueID]||(p[d.uniqueID]={}))[t]||[])[0]===k&&c[1]),!1===b)for(;(d=++h&&d&&d[m]||(b=h=0)||f.pop())&&((a?d.nodeName.toLowerCase()!==v:1!==d.nodeType)||!++b||(y&&((u=(p=d[x]||(d[x]={}))[d.uniqueID]||(p[d.uniqueID]={}))[t]=[k,b]),d!==e)););return(b-=o)===i||b%i==0&&b/i>=0}}},PSEUDO:function(t,e){var n,o=i.pseudos[t]||i.setFilters[t.toLowerCase()]||at.error("unsupported pseudo: "+t);return o[x]?o(e):o.length>1?(n=[t,t,"",e],i.setFilters.hasOwnProperty(t.toLowerCase())?ct((function(t,n){for(var i,r=o(t,e),s=r.length;s--;)t[i=O(t,r[s])]=!(n[i]=r[s])})):function(t){return o(t,0,n)}):o}},pseudos:{not:ct((function(t){var e=[],n=[],i=a(t.replace(M,"$1"));return i[x]?ct((function(t,e,n,o){for(var r,s=i(t,null,o,[]),a=t.length;a--;)(r=s[a])&&(t[a]=!(e[a]=r))})):function(t,o,r){return e[0]=t,i(e,null,r,n),e[0]=null,!n.pop()}})),has:ct((function(t){return function(e){return at(t,e).length>0}})),contains:ct((function(t){return t=t.replace(et,nt),function(e){return(e.textContent||o(e)).indexOf(t)>-1}})),lang:ct((function(t){return V.test(t||"")||at.error("unsupported lang: "+t),t=t.replace(et,nt).toLowerCase(),function(e){var n;do{if(n=m?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return(n=n.toLowerCase())===t||0===n.indexOf(t+"-")}while((e=e.parentNode)&&1===e.nodeType);return!1}})),target:function(e){var n=t.location&&t.location.hash;return n&&n.slice(1)===e.id},root:function(t){return t===f},focus:function(t){return t===h.activeElement&&(!h.hasFocus||h.hasFocus())&&!!(t.type||t.href||~t.tabIndex)},enabled:mt(!1),disabled:mt(!0),checked:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&!!t.checked||"option"===e&&!!t.selected},selected:function(t){return t.parentNode&&t.parentNode.selectedIndex,!0===t.selected},empty:function(t){for(t=t.firstChild;t;t=t.nextSibling)if(t.nodeType<6)return!1;return!0},parent:function(t){return!i.pseudos.empty(t)},header:function(t){return K.test(t.nodeName)},input:function(t){return J.test(t.nodeName)},button:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&"button"===t.type||"button"===e},text:function(t){var e;return"input"===t.nodeName.toLowerCase()&&"text"===t.type&&(null==(e=t.getAttribute("type"))||"text"===e.toLowerCase())},first:gt((function(){return[0]})),last:gt((function(t,e){return[e-1]})),eq:gt((function(t,e,n){return[n<0?n+e:n]})),even:gt((function(t,e){for(var n=0;ne?e:n;--i>=0;)t.push(i);return t})),gt:gt((function(t,e,n){for(var i=n<0?n+e:n;++i1?function(e,n,i){for(var o=t.length;o--;)if(!t[o](e,n,i))return!1;return!0}:t[0]}function kt(t,e,n,i,o){for(var r,s=[],a=0,l=t.length,c=null!=e;a-1&&(r[c]=!(s[c]=p))}}else v=kt(v===s?v.splice(f,v.length):v),o?o(null,s,v,l):N.apply(s,v)}))}function Ct(t){for(var e,n,o,r=t.length,s=i.relative[t[0].type],a=s||i.relative[" "],l=s?1:0,u=xt((function(t){return t===e}),a,!0),p=xt((function(t){return O(e,t)>-1}),a,!0),d=[function(t,n,i){var o=!s&&(i||n!==c)||((e=n).nodeType?u(t,n,i):p(t,n,i));return e=null,o}];l1&&wt(d),l>1&&bt(t.slice(0,l-1).concat({value:" "===t[l-2].type?"*":""})).replace(M,"$1"),n,l0,o=t.length>0,r=function(r,s,a,l,u){var p,f,g,v=0,y="0",b=r&&[],x=[],w=c,$=r||o&&i.find.TAG("*",u),C=k+=null==w?1:Math.random()||.1,T=$.length;for(u&&(c=s==h||s||u);y!==T&&null!=(p=$[y]);y++){if(o&&p){for(f=0,s||p.ownerDocument==h||(d(p),a=!m);g=t[f++];)if(g(p,s||h,a)){l.push(p);break}u&&(k=C)}n&&((p=!g&&p)&&v--,r&&b.push(p))}if(v+=y,n&&y!==v){for(f=0;g=e[f++];)g(b,x,s,a);if(r){if(v>0)for(;y--;)b[y]||x[y]||(x[y]=I.call(l));x=kt(x)}N.apply(l,x),u&&!r&&x.length>0&&v+e.length>1&&at.uniqueSort(l)}return u&&(k=C,c=w),b};return n?ct(r):r}(r,o)),a.selector=t}return a},l=at.select=function(t,e,n,o){var r,l,c,u,p,d="function"==typeof t&&t,h=!o&&s(t=d.selector||t);if(n=n||[],1===h.length){if((l=h[0]=h[0].slice(0)).length>2&&"ID"===(c=l[0]).type&&9===e.nodeType&&m&&i.relative[l[1].type]){if(!(e=(i.find.ID(c.matches[0].replace(et,nt),e)||[])[0]))return n;d&&(e=e.parentNode),t=t.slice(l.shift().value.length)}for(r=G.needsContext.test(t)?0:l.length;r--&&(c=l[r],!i.relative[u=c.type]);)if((p=i.find[u])&&(o=p(c.matches[0].replace(et,nt),tt.test(l[0].type)&&vt(e.parentNode)||e))){if(l.splice(r,1),!(t=o.length&&bt(l)))return N.apply(n,o),n;break}}return(d||a(t,h))(o,e,!m,n,!e||tt.test(t)&&vt(e.parentNode)||e),n},n.sortStable=x.split("").sort(E).join("")===x,n.detectDuplicates=!!p,d(),n.sortDetached=ut((function(t){return 1&t.compareDocumentPosition(h.createElement("fieldset"))})),ut((function(t){return t.innerHTML="","#"===t.firstChild.getAttribute("href")}))||pt("type|href|height|width",(function(t,e,n){if(!n)return t.getAttribute(e,"type"===e.toLowerCase()?1:2)})),n.attributes&&ut((function(t){return t.innerHTML="",t.firstChild.setAttribute("value",""),""===t.firstChild.getAttribute("value")}))||pt("value",(function(t,e,n){if(!n&&"input"===t.nodeName.toLowerCase())return t.defaultValue})),ut((function(t){return null==t.getAttribute("disabled")}))||pt(q,(function(t,e,n){var i;if(!n)return!0===t[e]?e.toLowerCase():(i=t.getAttributeNode(e))&&i.specified?i.value:null})),at}(n);C.find=S,C.expr=S.selectors,C.expr[":"]=C.expr.pseudos,C.uniqueSort=C.unique=S.uniqueSort,C.text=S.getText,C.isXMLDoc=S.isXML,C.contains=S.contains,C.escapeSelector=S.escape;var _=function(t,e,n){for(var i=[],o=void 0!==n;(t=t[e])&&9!==t.nodeType;)if(1===t.nodeType){if(o&&C(t).is(n))break;i.push(t)}return i},E=function(t,e){for(var n=[];t;t=t.nextSibling)1===t.nodeType&&t!==e&&n.push(t);return n},A=C.expr.match.needsContext;function D(t,e){return t.nodeName&&t.nodeName.toLowerCase()===e.toLowerCase()}var I=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(t,e,n){return v(e)?C.grep(t,(function(t,i){return!!e.call(t,i,t)!==n})):e.nodeType?C.grep(t,(function(t){return t===e!==n})):"string"!=typeof e?C.grep(t,(function(t){return u.call(e,t)>-1!==n})):C.filter(e,t,n)}C.filter=function(t,e,n){var i=e[0];return n&&(t=":not("+t+")"),1===e.length&&1===i.nodeType?C.find.matchesSelector(i,t)?[i]:[]:C.find.matches(t,C.grep(e,(function(t){return 1===t.nodeType})))},C.fn.extend({find:function(t){var e,n,i=this.length,o=this;if("string"!=typeof t)return this.pushStack(C(t).filter((function(){for(e=0;e1?C.uniqueSort(n):n},filter:function(t){return this.pushStack(j(this,t||[],!1))},not:function(t){return this.pushStack(j(this,t||[],!0))},is:function(t){return!!j(this,"string"==typeof t&&A.test(t)?C(t):t||[],!1).length}});var N,P=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(C.fn.init=function(t,e,n){var i,o;if(!t)return this;if(n=n||N,"string"==typeof t){if(!(i="<"===t[0]&&">"===t[t.length-1]&&t.length>=3?[null,t,null]:P.exec(t))||!i[1]&&e)return!e||e.jquery?(e||n).find(t):this.constructor(e).find(t);if(i[1]){if(e=e instanceof C?e[0]:e,C.merge(this,C.parseHTML(i[1],e&&e.nodeType?e.ownerDocument||e:b,!0)),I.test(i[1])&&C.isPlainObject(e))for(i in e)v(this[i])?this[i](e[i]):this.attr(i,e[i]);return this}return(o=b.getElementById(i[2]))&&(this[0]=o,this.length=1),this}return t.nodeType?(this[0]=t,this.length=1,this):v(t)?void 0!==n.ready?n.ready(t):t(C):C.makeArray(t,this)}).prototype=C.fn,N=C(b);var O=/^(?:parents|prev(?:Until|All))/,q={children:!0,contents:!0,next:!0,prev:!0};function L(t,e){for(;(t=t[e])&&1!==t.nodeType;);return t}C.fn.extend({has:function(t){var e=C(t,this),n=e.length;return this.filter((function(){for(var t=0;t-1:1===n.nodeType&&C.find.matchesSelector(n,t))){r.push(n);break}return this.pushStack(r.length>1?C.uniqueSort(r):r)},index:function(t){return t?"string"==typeof t?u.call(C(t),this[0]):u.call(this,t.jquery?t[0]:t):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(t,e){return this.pushStack(C.uniqueSort(C.merge(this.get(),C(t,e))))},addBack:function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}}),C.each({parent:function(t){var e=t.parentNode;return e&&11!==e.nodeType?e:null},parents:function(t){return _(t,"parentNode")},parentsUntil:function(t,e,n){return _(t,"parentNode",n)},next:function(t){return L(t,"nextSibling")},prev:function(t){return L(t,"previousSibling")},nextAll:function(t){return _(t,"nextSibling")},prevAll:function(t){return _(t,"previousSibling")},nextUntil:function(t,e,n){return _(t,"nextSibling",n)},prevUntil:function(t,e,n){return _(t,"previousSibling",n)},siblings:function(t){return E((t.parentNode||{}).firstChild,t)},children:function(t){return E(t.firstChild)},contents:function(t){return null!=t.contentDocument&&s(t.contentDocument)?t.contentDocument:(D(t,"template")&&(t=t.content||t),C.merge([],t.childNodes))}},(function(t,e){C.fn[t]=function(n,i){var o=C.map(this,e,n);return"Until"!==t.slice(-5)&&(i=n),i&&"string"==typeof i&&(o=C.filter(i,o)),this.length>1&&(q[t]||C.uniqueSort(o),O.test(t)&&o.reverse()),this.pushStack(o)}}));var z=/[^\x20\t\r\n\f]+/g;function R(t){return t}function F(t){throw t}function H(t,e,n,i){var o;try{t&&v(o=t.promise)?o.call(t).done(e).fail(n):t&&v(o=t.then)?o.call(t,e,n):e.apply(void 0,[t].slice(i))}catch(t){n.apply(void 0,[t])}}C.Callbacks=function(t){t="string"==typeof t?function(t){var e={};return C.each(t.match(z)||[],(function(t,n){e[n]=!0})),e}(t):C.extend({},t);var e,n,i,o,r=[],s=[],a=-1,l=function(){for(o=o||t.once,i=e=!0;s.length;a=-1)for(n=s.shift();++a-1;)r.splice(n,1),n<=a&&a--})),this},has:function(t){return t?C.inArray(t,r)>-1:r.length>0},empty:function(){return r&&(r=[]),this},disable:function(){return o=s=[],r=n="",this},disabled:function(){return!r},lock:function(){return o=s=[],n||e||(r=n=""),this},locked:function(){return!!o},fireWith:function(t,n){return o||(n=[t,(n=n||[]).slice?n.slice():n],s.push(n),e||l()),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!i}};return c},C.extend({Deferred:function(t){var e=[["notify","progress",C.Callbacks("memory"),C.Callbacks("memory"),2],["resolve","done",C.Callbacks("once memory"),C.Callbacks("once memory"),0,"resolved"],["reject","fail",C.Callbacks("once memory"),C.Callbacks("once memory"),1,"rejected"]],i="pending",o={state:function(){return i},always:function(){return r.done(arguments).fail(arguments),this},catch:function(t){return o.then(null,t)},pipe:function(){var t=arguments;return C.Deferred((function(n){C.each(e,(function(e,i){var o=v(t[i[4]])&&t[i[4]];r[i[1]]((function(){var t=o&&o.apply(this,arguments);t&&v(t.promise)?t.promise().progress(n.notify).done(n.resolve).fail(n.reject):n[i[0]+"With"](this,o?[t]:arguments)}))})),t=null})).promise()},then:function(t,i,o){var r=0;function s(t,e,i,o){return function(){var a=this,l=arguments,c=function(){var n,c;if(!(t=r&&(i!==F&&(a=void 0,l=[n]),e.rejectWith(a,l))}};t?u():(C.Deferred.getStackHook&&(u.stackTrace=C.Deferred.getStackHook()),n.setTimeout(u))}}return C.Deferred((function(n){e[0][3].add(s(0,n,v(o)?o:R,n.notifyWith)),e[1][3].add(s(0,n,v(t)?t:R)),e[2][3].add(s(0,n,v(i)?i:F))})).promise()},promise:function(t){return null!=t?C.extend(t,o):o}},r={};return C.each(e,(function(t,n){var s=n[2],a=n[5];o[n[1]]=s.add,a&&s.add((function(){i=a}),e[3-t][2].disable,e[3-t][3].disable,e[0][2].lock,e[0][3].lock),s.add(n[3].fire),r[n[0]]=function(){return r[n[0]+"With"](this===r?void 0:this,arguments),this},r[n[0]+"With"]=s.fireWith})),o.promise(r),t&&t.call(r,r),r},when:function(t){var e=arguments.length,n=e,i=Array(n),o=a.call(arguments),r=C.Deferred(),s=function(t){return function(n){i[t]=this,o[t]=arguments.length>1?a.call(arguments):n,--e||r.resolveWith(i,o)}};if(e<=1&&(H(t,r.done(s(n)).resolve,r.reject,!e),"pending"===r.state()||v(o[n]&&o[n].then)))return r.then();for(;n--;)H(o[n],s(n),r.reject);return r.promise()}});var M=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;C.Deferred.exceptionHook=function(t,e){n.console&&n.console.warn&&t&&M.test(t.name)&&n.console.warn("jQuery.Deferred exception: "+t.message,t.stack,e)},C.readyException=function(t){n.setTimeout((function(){throw t}))};var U=C.Deferred();function W(){b.removeEventListener("DOMContentLoaded",W),n.removeEventListener("load",W),C.ready()}C.fn.ready=function(t){return U.then(t).catch((function(t){C.readyException(t)})),this},C.extend({isReady:!1,readyWait:1,ready:function(t){(!0===t?--C.readyWait:C.isReady)||(C.isReady=!0,!0!==t&&--C.readyWait>0||U.resolveWith(b,[C]))}}),C.ready.then=U.then,"complete"===b.readyState||"loading"!==b.readyState&&!b.documentElement.doScroll?n.setTimeout(C.ready):(b.addEventListener("DOMContentLoaded",W),n.addEventListener("load",W));var B=function(t,e,n,i,o,r,s){var a=0,l=t.length,c=null==n;if("object"===k(n))for(a in o=!0,n)B(t,e,a,n[a],!0,r,s);else if(void 0!==i&&(o=!0,v(i)||(s=!0),c&&(s?(e.call(t,i),e=null):(c=e,e=function(t,e,n){return c.call(C(t),n)})),e))for(;a1,null,!0)},removeData:function(t){return this.each((function(){Z.remove(this,t)}))}}),C.extend({queue:function(t,e,n){var i;if(t)return e=(e||"fx")+"queue",i=Y.get(t,e),n&&(!i||Array.isArray(n)?i=Y.access(t,e,C.makeArray(n)):i.push(n)),i||[]},dequeue:function(t,e){e=e||"fx";var n=C.queue(t,e),i=n.length,o=n.shift(),r=C._queueHooks(t,e);"inprogress"===o&&(o=n.shift(),i--),o&&("fx"===e&&n.unshift("inprogress"),delete r.stop,o.call(t,(function(){C.dequeue(t,e)}),r)),!i&&r&&r.empty.fire()},_queueHooks:function(t,e){var n=e+"queueHooks";return Y.get(t,n)||Y.access(t,n,{empty:C.Callbacks("once memory").add((function(){Y.remove(t,[e+"queue",n])}))})}}),C.fn.extend({queue:function(t,e){var n=2;return"string"!=typeof t&&(e=t,t="fx",n--),arguments.length\x20\t\r\n\f]*)/i,yt=/^$|^module$|\/(?:java|ecma)script/i;ft=b.createDocumentFragment().appendChild(b.createElement("div")),(mt=b.createElement("input")).setAttribute("type","radio"),mt.setAttribute("checked","checked"),mt.setAttribute("name","t"),ft.appendChild(mt),g.checkClone=ft.cloneNode(!0).cloneNode(!0).lastChild.checked,ft.innerHTML="",g.noCloneChecked=!!ft.cloneNode(!0).lastChild.defaultValue,ft.innerHTML="",g.option=!!ft.lastChild;var bt={thead:[1,"","
    "],col:[2,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],_default:[0,"",""]};function xt(t,e){var n;return n=void 0!==t.getElementsByTagName?t.getElementsByTagName(e||"*"):void 0!==t.querySelectorAll?t.querySelectorAll(e||"*"):[],void 0===e||e&&D(t,e)?C.merge([t],n):n}function wt(t,e){for(var n=0,i=t.length;n",""]);var kt=/<|&#?\w+;/;function $t(t,e,n,i,o){for(var r,s,a,l,c,u,p=e.createDocumentFragment(),d=[],h=0,f=t.length;h-1)o&&o.push(r);else if(c=at(r),s=xt(p.appendChild(r),"script"),c&&wt(s),n)for(u=0;r=s[u++];)yt.test(r.type||"")&&n.push(r);return p}var Ct=/^([^.]*)(?:\.(.+)|)/;function Tt(){return!0}function St(){return!1}function _t(t,e){return t===function(){try{return b.activeElement}catch(t){}}()==("focus"===e)}function Et(t,e,n,i,o,r){var s,a;if("object"==typeof e){for(a in"string"!=typeof n&&(i=i||n,n=void 0),e)Et(t,a,n,i,e[a],r);return t}if(null==i&&null==o?(o=n,i=n=void 0):null==o&&("string"==typeof n?(o=i,i=void 0):(o=i,i=n,n=void 0)),!1===o)o=St;else if(!o)return t;return 1===r&&(s=o,o=function(t){return C().off(t),s.apply(this,arguments)},o.guid=s.guid||(s.guid=C.guid++)),t.each((function(){C.event.add(this,e,o,i,n)}))}function At(t,e,n){n?(Y.set(t,e,!1),C.event.add(t,e,{namespace:!1,handler:function(t){var i,o,r=Y.get(this,e);if(1&t.isTrigger&&this[e]){if(r.length)(C.event.special[e]||{}).delegateType&&t.stopPropagation();else if(r=a.call(arguments),Y.set(this,e,r),i=n(this,e),this[e](),r!==(o=Y.get(this,e))||i?Y.set(this,e,!1):o={},r!==o)return t.stopImmediatePropagation(),t.preventDefault(),o&&o.value}else r.length&&(Y.set(this,e,{value:C.event.trigger(C.extend(r[0],C.Event.prototype),r.slice(1),this)}),t.stopImmediatePropagation())}})):void 0===Y.get(t,e)&&C.event.add(t,e,Tt)}C.event={global:{},add:function(t,e,n,i,o){var r,s,a,l,c,u,p,d,h,f,m,g=Y.get(t);if(J(t))for(n.handler&&(n=(r=n).handler,o=r.selector),o&&C.find.matchesSelector(st,o),n.guid||(n.guid=C.guid++),(l=g.events)||(l=g.events=Object.create(null)),(s=g.handle)||(s=g.handle=function(e){return void 0!==C&&C.event.triggered!==e.type?C.event.dispatch.apply(t,arguments):void 0}),c=(e=(e||"").match(z)||[""]).length;c--;)h=m=(a=Ct.exec(e[c])||[])[1],f=(a[2]||"").split(".").sort(),h&&(p=C.event.special[h]||{},h=(o?p.delegateType:p.bindType)||h,p=C.event.special[h]||{},u=C.extend({type:h,origType:m,data:i,handler:n,guid:n.guid,selector:o,needsContext:o&&C.expr.match.needsContext.test(o),namespace:f.join(".")},r),(d=l[h])||((d=l[h]=[]).delegateCount=0,p.setup&&!1!==p.setup.call(t,i,f,s)||t.addEventListener&&t.addEventListener(h,s)),p.add&&(p.add.call(t,u),u.handler.guid||(u.handler.guid=n.guid)),o?d.splice(d.delegateCount++,0,u):d.push(u),C.event.global[h]=!0)},remove:function(t,e,n,i,o){var r,s,a,l,c,u,p,d,h,f,m,g=Y.hasData(t)&&Y.get(t);if(g&&(l=g.events)){for(c=(e=(e||"").match(z)||[""]).length;c--;)if(h=m=(a=Ct.exec(e[c])||[])[1],f=(a[2]||"").split(".").sort(),h){for(p=C.event.special[h]||{},d=l[h=(i?p.delegateType:p.bindType)||h]||[],a=a[2]&&new RegExp("(^|\\.)"+f.join("\\.(?:.*\\.|)")+"(\\.|$)"),s=r=d.length;r--;)u=d[r],!o&&m!==u.origType||n&&n.guid!==u.guid||a&&!a.test(u.namespace)||i&&i!==u.selector&&("**"!==i||!u.selector)||(d.splice(r,1),u.selector&&d.delegateCount--,p.remove&&p.remove.call(t,u));s&&!d.length&&(p.teardown&&!1!==p.teardown.call(t,f,g.handle)||C.removeEvent(t,h,g.handle),delete l[h])}else for(h in l)C.event.remove(t,h+e[c],n,i,!0);C.isEmptyObject(l)&&Y.remove(t,"handle events")}},dispatch:function(t){var e,n,i,o,r,s,a=new Array(arguments.length),l=C.event.fix(t),c=(Y.get(this,"events")||Object.create(null))[l.type]||[],u=C.event.special[l.type]||{};for(a[0]=l,e=1;e=1))for(;c!==this;c=c.parentNode||this)if(1===c.nodeType&&("click"!==t.type||!0!==c.disabled)){for(r=[],s={},n=0;n-1:C.find(o,this,null,[c]).length),s[o]&&r.push(i);r.length&&a.push({elem:c,handlers:r})}return c=this,l\s*$/g;function Nt(t,e){return D(t,"table")&&D(11!==e.nodeType?e:e.firstChild,"tr")&&C(t).children("tbody")[0]||t}function Pt(t){return t.type=(null!==t.getAttribute("type"))+"/"+t.type,t}function Ot(t){return"true/"===(t.type||"").slice(0,5)?t.type=t.type.slice(5):t.removeAttribute("type"),t}function qt(t,e){var n,i,o,r,s,a;if(1===e.nodeType){if(Y.hasData(t)&&(a=Y.get(t).events))for(o in Y.remove(e,"handle events"),a)for(n=0,i=a[o].length;n1&&"string"==typeof f&&!g.checkClone&&It.test(f))return t.each((function(o){var r=t.eq(o);m&&(e[0]=f.call(this,o,r.html())),zt(r,e,n,i)}));if(d&&(r=(o=$t(e,t[0].ownerDocument,!1,t,i)).firstChild,1===o.childNodes.length&&(o=r),r||i)){for(a=(s=C.map(xt(o,"script"),Pt)).length;p0&&wt(s,!l&&xt(t,"script")),a},cleanData:function(t){for(var e,n,i,o=C.event.special,r=0;void 0!==(n=t[r]);r++)if(J(n)){if(e=n[Y.expando]){if(e.events)for(i in e.events)o[i]?C.event.remove(n,i):C.removeEvent(n,i,e.handle);n[Y.expando]=void 0}n[Z.expando]&&(n[Z.expando]=void 0)}}}),C.fn.extend({detach:function(t){return Rt(this,t,!0)},remove:function(t){return Rt(this,t)},text:function(t){return B(this,(function(t){return void 0===t?C.text(this):this.empty().each((function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=t)}))}),null,t,arguments.length)},append:function(){return zt(this,arguments,(function(t){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Nt(this,t).appendChild(t)}))},prepend:function(){return zt(this,arguments,(function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var e=Nt(this,t);e.insertBefore(t,e.firstChild)}}))},before:function(){return zt(this,arguments,(function(t){this.parentNode&&this.parentNode.insertBefore(t,this)}))},after:function(){return zt(this,arguments,(function(t){this.parentNode&&this.parentNode.insertBefore(t,this.nextSibling)}))},empty:function(){for(var t,e=0;null!=(t=this[e]);e++)1===t.nodeType&&(C.cleanData(xt(t,!1)),t.textContent="");return this},clone:function(t,e){return t=null!=t&&t,e=null==e?t:e,this.map((function(){return C.clone(this,t,e)}))},html:function(t){return B(this,(function(t){var e=this[0]||{},n=0,i=this.length;if(void 0===t&&1===e.nodeType)return e.innerHTML;if("string"==typeof t&&!Dt.test(t)&&!bt[(vt.exec(t)||["",""])[1].toLowerCase()]){t=C.htmlPrefilter(t);try{for(;n=0&&(l+=Math.max(0,Math.ceil(t["offset"+e[0].toUpperCase()+e.slice(1)]-r-l-a-.5))||0),l}function ne(t,e,n){var i=Ht(t),o=(!g.boxSizingReliable()||n)&&"border-box"===C.css(t,"boxSizing",!1,i),r=o,s=Wt(t,e,i),a="offset"+e[0].toUpperCase()+e.slice(1);if(Ft.test(s)){if(!n)return s;s="auto"}return(!g.boxSizingReliable()&&o||!g.reliableTrDimensions()&&D(t,"tr")||"auto"===s||!parseFloat(s)&&"inline"===C.css(t,"display",!1,i))&&t.getClientRects().length&&(o="border-box"===C.css(t,"boxSizing",!1,i),(r=a in t)&&(s=t[a])),(s=parseFloat(s)||0)+ee(t,e,n||(o?"border":"content"),r,i,s)+"px"}function ie(t,e,n,i,o){return new ie.prototype.init(t,e,n,i,o)}C.extend({cssHooks:{opacity:{get:function(t,e){if(e){var n=Wt(t,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(t,e,n,i){if(t&&3!==t.nodeType&&8!==t.nodeType&&t.style){var o,r,s,a=X(e),l=Kt.test(e),c=t.style;if(l||(e=Xt(a)),s=C.cssHooks[e]||C.cssHooks[a],void 0===n)return s&&"get"in s&&void 0!==(o=s.get(t,!1,i))?o:c[e];"string"===(r=typeof n)&&(o=ot.exec(n))&&o[1]&&(n=ut(t,e,o),r="number"),null!=n&&n==n&&("number"!==r||l||(n+=o&&o[3]||(C.cssNumber[a]?"":"px")),g.clearCloneStyle||""!==n||0!==e.indexOf("background")||(c[e]="inherit"),s&&"set"in s&&void 0===(n=s.set(t,n,i))||(l?c.setProperty(e,n):c[e]=n))}},css:function(t,e,n,i){var o,r,s,a=X(e);return Kt.test(e)||(e=Xt(a)),(s=C.cssHooks[e]||C.cssHooks[a])&&"get"in s&&(o=s.get(t,!0,n)),void 0===o&&(o=Wt(t,e,i)),"normal"===o&&e in Zt&&(o=Zt[e]),""===n||n?(r=parseFloat(o),!0===n||isFinite(r)?r||0:o):o}}),C.each(["height","width"],(function(t,e){C.cssHooks[e]={get:function(t,n,i){if(n)return!Jt.test(C.css(t,"display"))||t.getClientRects().length&&t.getBoundingClientRect().width?ne(t,e,i):Mt(t,Yt,(function(){return ne(t,e,i)}))},set:function(t,n,i){var o,r=Ht(t),s=!g.scrollboxSize()&&"absolute"===r.position,a=(s||i)&&"border-box"===C.css(t,"boxSizing",!1,r),l=i?ee(t,e,i,a,r):0;return a&&s&&(l-=Math.ceil(t["offset"+e[0].toUpperCase()+e.slice(1)]-parseFloat(r[e])-ee(t,e,"border",!1,r)-.5)),l&&(o=ot.exec(n))&&"px"!==(o[3]||"px")&&(t.style[e]=n,n=C.css(t,e)),te(0,n,l)}}})),C.cssHooks.marginLeft=Bt(g.reliableMarginLeft,(function(t,e){if(e)return(parseFloat(Wt(t,"marginLeft"))||t.getBoundingClientRect().left-Mt(t,{marginLeft:0},(function(){return t.getBoundingClientRect().left})))+"px"})),C.each({margin:"",padding:"",border:"Width"},(function(t,e){C.cssHooks[t+e]={expand:function(n){for(var i=0,o={},r="string"==typeof n?n.split(" "):[n];i<4;i++)o[t+rt[i]+e]=r[i]||r[i-2]||r[0];return o}},"margin"!==t&&(C.cssHooks[t+e].set=te)})),C.fn.extend({css:function(t,e){return B(this,(function(t,e,n){var i,o,r={},s=0;if(Array.isArray(e)){for(i=Ht(t),o=e.length;s1)}}),C.Tween=ie,ie.prototype={constructor:ie,init:function(t,e,n,i,o,r){this.elem=t,this.prop=n,this.easing=o||C.easing._default,this.options=e,this.start=this.now=this.cur(),this.end=i,this.unit=r||(C.cssNumber[n]?"":"px")},cur:function(){var t=ie.propHooks[this.prop];return t&&t.get?t.get(this):ie.propHooks._default.get(this)},run:function(t){var e,n=ie.propHooks[this.prop];return this.options.duration?this.pos=e=C.easing[this.easing](t,this.options.duration*t,0,1,this.options.duration):this.pos=e=t,this.now=(this.end-this.start)*e+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):ie.propHooks._default.set(this),this}},ie.prototype.init.prototype=ie.prototype,ie.propHooks={_default:{get:function(t){var e;return 1!==t.elem.nodeType||null!=t.elem[t.prop]&&null==t.elem.style[t.prop]?t.elem[t.prop]:(e=C.css(t.elem,t.prop,""))&&"auto"!==e?e:0},set:function(t){C.fx.step[t.prop]?C.fx.step[t.prop](t):1!==t.elem.nodeType||!C.cssHooks[t.prop]&&null==t.elem.style[Xt(t.prop)]?t.elem[t.prop]=t.now:C.style(t.elem,t.prop,t.now+t.unit)}}},ie.propHooks.scrollTop=ie.propHooks.scrollLeft={set:function(t){t.elem.nodeType&&t.elem.parentNode&&(t.elem[t.prop]=t.now)}},C.easing={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2},_default:"swing"},C.fx=ie.prototype.init,C.fx.step={};var oe,re,se=/^(?:toggle|show|hide)$/,ae=/queueHooks$/;function le(){re&&(!1===b.hidden&&n.requestAnimationFrame?n.requestAnimationFrame(le):n.setTimeout(le,C.fx.interval),C.fx.tick())}function ce(){return n.setTimeout((function(){oe=void 0})),oe=Date.now()}function ue(t,e){var n,i=0,o={height:t};for(e=e?1:0;i<4;i+=2-e)o["margin"+(n=rt[i])]=o["padding"+n]=t;return e&&(o.opacity=o.width=t),o}function pe(t,e,n){for(var i,o=(de.tweeners[e]||[]).concat(de.tweeners["*"]),r=0,s=o.length;r1)},removeAttr:function(t){return this.each((function(){C.removeAttr(this,t)}))}}),C.extend({attr:function(t,e,n){var i,o,r=t.nodeType;if(3!==r&&8!==r&&2!==r)return void 0===t.getAttribute?C.prop(t,e,n):(1===r&&C.isXMLDoc(t)||(o=C.attrHooks[e.toLowerCase()]||(C.expr.match.bool.test(e)?he:void 0)),void 0!==n?null===n?void C.removeAttr(t,e):o&&"set"in o&&void 0!==(i=o.set(t,n,e))?i:(t.setAttribute(e,n+""),n):o&&"get"in o&&null!==(i=o.get(t,e))?i:null==(i=C.find.attr(t,e))?void 0:i)},attrHooks:{type:{set:function(t,e){if(!g.radioValue&&"radio"===e&&D(t,"input")){var n=t.value;return t.setAttribute("type",e),n&&(t.value=n),e}}}},removeAttr:function(t,e){var n,i=0,o=e&&e.match(z);if(o&&1===t.nodeType)for(;n=o[i++];)t.removeAttribute(n)}}),he={set:function(t,e,n){return!1===e?C.removeAttr(t,n):t.setAttribute(n,n),n}},C.each(C.expr.match.bool.source.match(/\w+/g),(function(t,e){var n=fe[e]||C.find.attr;fe[e]=function(t,e,i){var o,r,s=e.toLowerCase();return i||(r=fe[s],fe[s]=o,o=null!=n(t,e,i)?s:null,fe[s]=r),o}}));var me=/^(?:input|select|textarea|button)$/i,ge=/^(?:a|area)$/i;function ve(t){return(t.match(z)||[]).join(" ")}function ye(t){return t.getAttribute&&t.getAttribute("class")||""}function be(t){return Array.isArray(t)?t:"string"==typeof t&&t.match(z)||[]}C.fn.extend({prop:function(t,e){return B(this,C.prop,t,e,arguments.length>1)},removeProp:function(t){return this.each((function(){delete this[C.propFix[t]||t]}))}}),C.extend({prop:function(t,e,n){var i,o,r=t.nodeType;if(3!==r&&8!==r&&2!==r)return 1===r&&C.isXMLDoc(t)||(e=C.propFix[e]||e,o=C.propHooks[e]),void 0!==n?o&&"set"in o&&void 0!==(i=o.set(t,n,e))?i:t[e]=n:o&&"get"in o&&null!==(i=o.get(t,e))?i:t[e]},propHooks:{tabIndex:{get:function(t){var e=C.find.attr(t,"tabindex");return e?parseInt(e,10):me.test(t.nodeName)||ge.test(t.nodeName)&&t.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),g.optSelected||(C.propHooks.selected={get:function(t){var e=t.parentNode;return e&&e.parentNode&&e.parentNode.selectedIndex,null},set:function(t){var e=t.parentNode;e&&(e.selectedIndex,e.parentNode&&e.parentNode.selectedIndex)}}),C.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],(function(){C.propFix[this.toLowerCase()]=this})),C.fn.extend({addClass:function(t){var e,n,i,o,r,s,a,l=0;if(v(t))return this.each((function(e){C(this).addClass(t.call(this,e,ye(this)))}));if((e=be(t)).length)for(;n=this[l++];)if(o=ye(n),i=1===n.nodeType&&" "+ve(o)+" "){for(s=0;r=e[s++];)i.indexOf(" "+r+" ")<0&&(i+=r+" ");o!==(a=ve(i))&&n.setAttribute("class",a)}return this},removeClass:function(t){var e,n,i,o,r,s,a,l=0;if(v(t))return this.each((function(e){C(this).removeClass(t.call(this,e,ye(this)))}));if(!arguments.length)return this.attr("class","");if((e=be(t)).length)for(;n=this[l++];)if(o=ye(n),i=1===n.nodeType&&" "+ve(o)+" "){for(s=0;r=e[s++];)for(;i.indexOf(" "+r+" ")>-1;)i=i.replace(" "+r+" "," ");o!==(a=ve(i))&&n.setAttribute("class",a)}return this},toggleClass:function(t,e){var n=typeof t,i="string"===n||Array.isArray(t);return"boolean"==typeof e&&i?e?this.addClass(t):this.removeClass(t):v(t)?this.each((function(n){C(this).toggleClass(t.call(this,n,ye(this),e),e)})):this.each((function(){var e,o,r,s;if(i)for(o=0,r=C(this),s=be(t);e=s[o++];)r.hasClass(e)?r.removeClass(e):r.addClass(e);else void 0!==t&&"boolean"!==n||((e=ye(this))&&Y.set(this,"__className__",e),this.setAttribute&&this.setAttribute("class",e||!1===t?"":Y.get(this,"__className__")||""))}))},hasClass:function(t){var e,n,i=0;for(e=" "+t+" ";n=this[i++];)if(1===n.nodeType&&(" "+ve(ye(n))+" ").indexOf(e)>-1)return!0;return!1}});var xe=/\r/g;C.fn.extend({val:function(t){var e,n,i,o=this[0];return arguments.length?(i=v(t),this.each((function(n){var o;1===this.nodeType&&(null==(o=i?t.call(this,n,C(this).val()):t)?o="":"number"==typeof o?o+="":Array.isArray(o)&&(o=C.map(o,(function(t){return null==t?"":t+""}))),(e=C.valHooks[this.type]||C.valHooks[this.nodeName.toLowerCase()])&&"set"in e&&void 0!==e.set(this,o,"value")||(this.value=o))}))):o?(e=C.valHooks[o.type]||C.valHooks[o.nodeName.toLowerCase()])&&"get"in e&&void 0!==(n=e.get(o,"value"))?n:"string"==typeof(n=o.value)?n.replace(xe,""):null==n?"":n:void 0}}),C.extend({valHooks:{option:{get:function(t){var e=C.find.attr(t,"value");return null!=e?e:ve(C.text(t))}},select:{get:function(t){var e,n,i,o=t.options,r=t.selectedIndex,s="select-one"===t.type,a=s?null:[],l=s?r+1:o.length;for(i=r<0?l:s?r:0;i-1)&&(n=!0);return n||(t.selectedIndex=-1),r}}}}),C.each(["radio","checkbox"],(function(){C.valHooks[this]={set:function(t,e){if(Array.isArray(e))return t.checked=C.inArray(C(t).val(),e)>-1}},g.checkOn||(C.valHooks[this].get=function(t){return null===t.getAttribute("value")?"on":t.value})})),g.focusin="onfocusin"in n;var we=/^(?:focusinfocus|focusoutblur)$/,ke=function(t){t.stopPropagation()};C.extend(C.event,{trigger:function(t,e,i,o){var r,s,a,l,c,u,p,d,f=[i||b],m=h.call(t,"type")?t.type:t,g=h.call(t,"namespace")?t.namespace.split("."):[];if(s=d=a=i=i||b,3!==i.nodeType&&8!==i.nodeType&&!we.test(m+C.event.triggered)&&(m.indexOf(".")>-1&&(g=m.split("."),m=g.shift(),g.sort()),c=m.indexOf(":")<0&&"on"+m,(t=t[C.expando]?t:new C.Event(m,"object"==typeof t&&t)).isTrigger=o?2:3,t.namespace=g.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+g.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=i),e=null==e?[t]:C.makeArray(e,[t]),p=C.event.special[m]||{},o||!p.trigger||!1!==p.trigger.apply(i,e))){if(!o&&!p.noBubble&&!y(i)){for(l=p.delegateType||m,we.test(l+m)||(s=s.parentNode);s;s=s.parentNode)f.push(s),a=s;a===(i.ownerDocument||b)&&f.push(a.defaultView||a.parentWindow||n)}for(r=0;(s=f[r++])&&!t.isPropagationStopped();)d=s,t.type=r>1?l:p.bindType||m,(u=(Y.get(s,"events")||Object.create(null))[t.type]&&Y.get(s,"handle"))&&u.apply(s,e),(u=c&&s[c])&&u.apply&&J(s)&&(t.result=u.apply(s,e),!1===t.result&&t.preventDefault());return t.type=m,o||t.isDefaultPrevented()||p._default&&!1!==p._default.apply(f.pop(),e)||!J(i)||c&&v(i[m])&&!y(i)&&((a=i[c])&&(i[c]=null),C.event.triggered=m,t.isPropagationStopped()&&d.addEventListener(m,ke),i[m](),t.isPropagationStopped()&&d.removeEventListener(m,ke),C.event.triggered=void 0,a&&(i[c]=a)),t.result}},simulate:function(t,e,n){var i=C.extend(new C.Event,n,{type:t,isSimulated:!0});C.event.trigger(i,null,e)}}),C.fn.extend({trigger:function(t,e){return this.each((function(){C.event.trigger(t,e,this)}))},triggerHandler:function(t,e){var n=this[0];if(n)return C.event.trigger(t,e,n,!0)}}),g.focusin||C.each({focus:"focusin",blur:"focusout"},(function(t,e){var n=function(t){C.event.simulate(e,t.target,C.event.fix(t))};C.event.special[e]={setup:function(){var i=this.ownerDocument||this.document||this,o=Y.access(i,e);o||i.addEventListener(t,n,!0),Y.access(i,e,(o||0)+1)},teardown:function(){var i=this.ownerDocument||this.document||this,o=Y.access(i,e)-1;o?Y.access(i,e,o):(i.removeEventListener(t,n,!0),Y.remove(i,e))}}}));var $e=n.location,Ce={guid:Date.now()},Te=/\?/;C.parseXML=function(t){var e,i;if(!t||"string"!=typeof t)return null;try{e=(new n.DOMParser).parseFromString(t,"text/xml")}catch(t){}return i=e&&e.getElementsByTagName("parsererror")[0],e&&!i||C.error("Invalid XML: "+(i?C.map(i.childNodes,(function(t){return t.textContent})).join("\n"):t)),e};var Se=/\[\]$/,_e=/\r?\n/g,Ee=/^(?:submit|button|image|reset|file)$/i,Ae=/^(?:input|select|textarea|keygen)/i;function De(t,e,n,i){var o;if(Array.isArray(e))C.each(e,(function(e,o){n||Se.test(t)?i(t,o):De(t+"["+("object"==typeof o&&null!=o?e:"")+"]",o,n,i)}));else if(n||"object"!==k(e))i(t,e);else for(o in e)De(t+"["+o+"]",e[o],n,i)}C.param=function(t,e){var n,i=[],o=function(t,e){var n=v(e)?e():e;i[i.length]=encodeURIComponent(t)+"="+encodeURIComponent(null==n?"":n)};if(null==t)return"";if(Array.isArray(t)||t.jquery&&!C.isPlainObject(t))C.each(t,(function(){o(this.name,this.value)}));else for(n in t)De(n,t[n],e,o);return i.join("&")},C.fn.extend({serialize:function(){return C.param(this.serializeArray())},serializeArray:function(){return this.map((function(){var t=C.prop(this,"elements");return t?C.makeArray(t):this})).filter((function(){var t=this.type;return this.name&&!C(this).is(":disabled")&&Ae.test(this.nodeName)&&!Ee.test(t)&&(this.checked||!gt.test(t))})).map((function(t,e){var n=C(this).val();return null==n?null:Array.isArray(n)?C.map(n,(function(t){return{name:e.name,value:t.replace(_e,"\r\n")}})):{name:e.name,value:n.replace(_e,"\r\n")}})).get()}});var Ie=/%20/g,je=/#.*$/,Ne=/([?&])_=[^&]*/,Pe=/^(.*?):[ \t]*([^\r\n]*)$/gm,Oe=/^(?:GET|HEAD)$/,qe=/^\/\//,Le={},ze={},Re="*/".concat("*"),Fe=b.createElement("a");function He(t){return function(e,n){"string"!=typeof e&&(n=e,e="*");var i,o=0,r=e.toLowerCase().match(z)||[];if(v(n))for(;i=r[o++];)"+"===i[0]?(i=i.slice(1)||"*",(t[i]=t[i]||[]).unshift(n)):(t[i]=t[i]||[]).push(n)}}function Me(t,e,n,i){var o={},r=t===ze;function s(a){var l;return o[a]=!0,C.each(t[a]||[],(function(t,a){var c=a(e,n,i);return"string"!=typeof c||r||o[c]?r?!(l=c):void 0:(e.dataTypes.unshift(c),s(c),!1)})),l}return s(e.dataTypes[0])||!o["*"]&&s("*")}function Ue(t,e){var n,i,o=C.ajaxSettings.flatOptions||{};for(n in e)void 0!==e[n]&&((o[n]?t:i||(i={}))[n]=e[n]);return i&&C.extend(!0,t,i),t}Fe.href=$e.href,C.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:$e.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test($e.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Re,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":C.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(t,e){return e?Ue(Ue(t,C.ajaxSettings),e):Ue(C.ajaxSettings,t)},ajaxPrefilter:He(Le),ajaxTransport:He(ze),ajax:function(t,e){"object"==typeof t&&(e=t,t=void 0),e=e||{};var i,o,r,s,a,l,c,u,p,d,h=C.ajaxSetup({},e),f=h.context||h,m=h.context&&(f.nodeType||f.jquery)?C(f):C.event,g=C.Deferred(),v=C.Callbacks("once memory"),y=h.statusCode||{},x={},w={},k="canceled",$={readyState:0,getResponseHeader:function(t){var e;if(c){if(!s)for(s={};e=Pe.exec(r);)s[e[1].toLowerCase()+" "]=(s[e[1].toLowerCase()+" "]||[]).concat(e[2]);e=s[t.toLowerCase()+" "]}return null==e?null:e.join(", ")},getAllResponseHeaders:function(){return c?r:null},setRequestHeader:function(t,e){return null==c&&(t=w[t.toLowerCase()]=w[t.toLowerCase()]||t,x[t]=e),this},overrideMimeType:function(t){return null==c&&(h.mimeType=t),this},statusCode:function(t){var e;if(t)if(c)$.always(t[$.status]);else for(e in t)y[e]=[y[e],t[e]];return this},abort:function(t){var e=t||k;return i&&i.abort(e),T(0,e),this}};if(g.promise($),h.url=((t||h.url||$e.href)+"").replace(qe,$e.protocol+"//"),h.type=e.method||e.type||h.method||h.type,h.dataTypes=(h.dataType||"*").toLowerCase().match(z)||[""],null==h.crossDomain){l=b.createElement("a");try{l.href=h.url,l.href=l.href,h.crossDomain=Fe.protocol+"//"+Fe.host!=l.protocol+"//"+l.host}catch(t){h.crossDomain=!0}}if(h.data&&h.processData&&"string"!=typeof h.data&&(h.data=C.param(h.data,h.traditional)),Me(Le,h,e,$),c)return $;for(p in(u=C.event&&h.global)&&0==C.active++&&C.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!Oe.test(h.type),o=h.url.replace(je,""),h.hasContent?h.data&&h.processData&&0===(h.contentType||"").indexOf("application/x-www-form-urlencoded")&&(h.data=h.data.replace(Ie,"+")):(d=h.url.slice(o.length),h.data&&(h.processData||"string"==typeof h.data)&&(o+=(Te.test(o)?"&":"?")+h.data,delete h.data),!1===h.cache&&(o=o.replace(Ne,"$1"),d=(Te.test(o)?"&":"?")+"_="+Ce.guid+++d),h.url=o+d),h.ifModified&&(C.lastModified[o]&&$.setRequestHeader("If-Modified-Since",C.lastModified[o]),C.etag[o]&&$.setRequestHeader("If-None-Match",C.etag[o])),(h.data&&h.hasContent&&!1!==h.contentType||e.contentType)&&$.setRequestHeader("Content-Type",h.contentType),$.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+Re+"; q=0.01":""):h.accepts["*"]),h.headers)$.setRequestHeader(p,h.headers[p]);if(h.beforeSend&&(!1===h.beforeSend.call(f,$,h)||c))return $.abort();if(k="abort",v.add(h.complete),$.done(h.success),$.fail(h.error),i=Me(ze,h,e,$)){if($.readyState=1,u&&m.trigger("ajaxSend",[$,h]),c)return $;h.async&&h.timeout>0&&(a=n.setTimeout((function(){$.abort("timeout")}),h.timeout));try{c=!1,i.send(x,T)}catch(t){if(c)throw t;T(-1,t)}}else T(-1,"No Transport");function T(t,e,s,l){var p,d,b,x,w,k=e;c||(c=!0,a&&n.clearTimeout(a),i=void 0,r=l||"",$.readyState=t>0?4:0,p=t>=200&&t<300||304===t,s&&(x=function(t,e,n){for(var i,o,r,s,a=t.contents,l=t.dataTypes;"*"===l[0];)l.shift(),void 0===i&&(i=t.mimeType||e.getResponseHeader("Content-Type"));if(i)for(o in a)if(a[o]&&a[o].test(i)){l.unshift(o);break}if(l[0]in n)r=l[0];else{for(o in n){if(!l[0]||t.converters[o+" "+l[0]]){r=o;break}s||(s=o)}r=r||s}if(r)return r!==l[0]&&l.unshift(r),n[r]}(h,$,s)),!p&&C.inArray("script",h.dataTypes)>-1&&C.inArray("json",h.dataTypes)<0&&(h.converters["text script"]=function(){}),x=function(t,e,n,i){var o,r,s,a,l,c={},u=t.dataTypes.slice();if(u[1])for(s in t.converters)c[s.toLowerCase()]=t.converters[s];for(r=u.shift();r;)if(t.responseFields[r]&&(n[t.responseFields[r]]=e),!l&&i&&t.dataFilter&&(e=t.dataFilter(e,t.dataType)),l=r,r=u.shift())if("*"===r)r=l;else if("*"!==l&&l!==r){if(!(s=c[l+" "+r]||c["* "+r]))for(o in c)if((a=o.split(" "))[1]===r&&(s=c[l+" "+a[0]]||c["* "+a[0]])){!0===s?s=c[o]:!0!==c[o]&&(r=a[0],u.unshift(a[1]));break}if(!0!==s)if(s&&t.throws)e=s(e);else try{e=s(e)}catch(t){return{state:"parsererror",error:s?t:"No conversion from "+l+" to "+r}}}return{state:"success",data:e}}(h,x,$,p),p?(h.ifModified&&((w=$.getResponseHeader("Last-Modified"))&&(C.lastModified[o]=w),(w=$.getResponseHeader("etag"))&&(C.etag[o]=w)),204===t||"HEAD"===h.type?k="nocontent":304===t?k="notmodified":(k=x.state,d=x.data,p=!(b=x.error))):(b=k,!t&&k||(k="error",t<0&&(t=0))),$.status=t,$.statusText=(e||k)+"",p?g.resolveWith(f,[d,k,$]):g.rejectWith(f,[$,k,b]),$.statusCode(y),y=void 0,u&&m.trigger(p?"ajaxSuccess":"ajaxError",[$,h,p?d:b]),v.fireWith(f,[$,k]),u&&(m.trigger("ajaxComplete",[$,h]),--C.active||C.event.trigger("ajaxStop")))}return $},getJSON:function(t,e,n){return C.get(t,e,n,"json")},getScript:function(t,e){return C.get(t,void 0,e,"script")}}),C.each(["get","post"],(function(t,e){C[e]=function(t,n,i,o){return v(n)&&(o=o||i,i=n,n=void 0),C.ajax(C.extend({url:t,type:e,dataType:o,data:n,success:i},C.isPlainObject(t)&&t))}})),C.ajaxPrefilter((function(t){var e;for(e in t.headers)"content-type"===e.toLowerCase()&&(t.contentType=t.headers[e]||"")})),C._evalUrl=function(t,e,n){return C.ajax({url:t,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(t){C.globalEval(t,e,n)}})},C.fn.extend({wrapAll:function(t){var e;return this[0]&&(v(t)&&(t=t.call(this[0])),e=C(t,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&e.insertBefore(this[0]),e.map((function(){for(var t=this;t.firstElementChild;)t=t.firstElementChild;return t})).append(this)),this},wrapInner:function(t){return v(t)?this.each((function(e){C(this).wrapInner(t.call(this,e))})):this.each((function(){var e=C(this),n=e.contents();n.length?n.wrapAll(t):e.append(t)}))},wrap:function(t){var e=v(t);return this.each((function(n){C(this).wrapAll(e?t.call(this,n):t)}))},unwrap:function(t){return this.parent(t).not("body").each((function(){C(this).replaceWith(this.childNodes)})),this}}),C.expr.pseudos.hidden=function(t){return!C.expr.pseudos.visible(t)},C.expr.pseudos.visible=function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)},C.ajaxSettings.xhr=function(){try{return new n.XMLHttpRequest}catch(t){}};var We={0:200,1223:204},Be=C.ajaxSettings.xhr();g.cors=!!Be&&"withCredentials"in Be,g.ajax=Be=!!Be,C.ajaxTransport((function(t){var e,i;if(g.cors||Be&&!t.crossDomain)return{send:function(o,r){var s,a=t.xhr();if(a.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(s in t.xhrFields)a[s]=t.xhrFields[s];for(s in t.mimeType&&a.overrideMimeType&&a.overrideMimeType(t.mimeType),t.crossDomain||o["X-Requested-With"]||(o["X-Requested-With"]="XMLHttpRequest"),o)a.setRequestHeader(s,o[s]);e=function(t){return function(){e&&(e=i=a.onload=a.onerror=a.onabort=a.ontimeout=a.onreadystatechange=null,"abort"===t?a.abort():"error"===t?"number"!=typeof a.status?r(0,"error"):r(a.status,a.statusText):r(We[a.status]||a.status,a.statusText,"text"!==(a.responseType||"text")||"string"!=typeof a.responseText?{binary:a.response}:{text:a.responseText},a.getAllResponseHeaders()))}},a.onload=e(),i=a.onerror=a.ontimeout=e("error"),void 0!==a.onabort?a.onabort=i:a.onreadystatechange=function(){4===a.readyState&&n.setTimeout((function(){e&&i()}))},e=e("abort");try{a.send(t.hasContent&&t.data||null)}catch(t){if(e)throw t}},abort:function(){e&&e()}}})),C.ajaxPrefilter((function(t){t.crossDomain&&(t.contents.script=!1)})),C.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(t){return C.globalEval(t),t}}}),C.ajaxPrefilter("script",(function(t){void 0===t.cache&&(t.cache=!1),t.crossDomain&&(t.type="GET")})),C.ajaxTransport("script",(function(t){var e,n;if(t.crossDomain||t.scriptAttrs)return{send:function(i,o){e=C(" - - - - - - - - - diff -Nru pat-0.12.1/web/src/index.html pat-0.13.1/web/src/index.html --- pat-0.12.1/web/src/index.html 1970-01-01 00:00:00.000000000 +0000 +++ pat-0.13.1/web/src/index.html 2022-10-22 20:39:54.000000000 +0000 @@ -0,0 +1,697 @@ + + + + + + + + + + {{.AppName}} - Mailbox + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    + + + + + + + + +
    + + + + + + + diff -Nru pat-0.12.1/web/src/js/app.js pat-0.13.1/web/src/js/app.js --- pat-0.12.1/web/src/js/app.js 1970-01-01 00:00:00.000000000 +0000 +++ pat-0.13.1/web/src/js/app.js 2022-10-22 20:39:54.000000000 +0000 @@ -0,0 +1,1474 @@ +import 'jquery'; +import 'bootstrap/dist/js/bootstrap'; +import 'bootstrap-select'; +import 'bootstrap-tokenfield'; +import URI from 'urijs'; + +let wsURL = ''; +let posId = 0; +let connectAliases; +let mycall = ''; +let formsCatalog; + +const uploadFiles = new Array(); +let statusPopoverDiv; +const statusPos = $('#pos_status'); + +$(document).ready(function () { + wsURL = (location.protocol == 'https:' ? 'wss://' : 'ws://') + location.host + '/ws'; + + $(function () { + initStatusPopover(); + + // Setup actions + $('#connect_btn').click(connect); + $('#connectForm input').keypress(function (e) { + if (e.which == 13) { + connect(); + return false; + } + }); + $('#connectForm input').keyup(function (e) { + onConnectInputChange(); + }); + $('#pos_btn').click(postPosition); + + // Setup composer + initComposeModal(); + + // Setup folder navigation + $('#inbox_tab').click(function (evt) { + displayFolder('in'); + }); + $('#outbox_tab').click(function (evt) { + displayFolder('out'); + }); + $('#sent_tab').click(function (evt) { + displayFolder('sent'); + }); + $('#archive_tab').click(function (evt) { + displayFolder('archive'); + }); + $('.navbar li').click(function (e) { + $('.navbar li.active').removeClass('active'); + const $this = $(this); + if (!$this.hasClass('active')) { + $this.addClass('active'); + } + e.preventDefault(); + }); + + $('.nav :not(.dropdown) a').on('click', function () { + if ($('.navbar-toggle').css('display') != 'none') { + $('.navbar-toggle').trigger('click'); + } + }); + + $('#posModal').on('shown.bs.modal', function (e) { + $.ajax({ + url: '/api/current_gps_position', + dataType: 'json', + beforeSend: function () { + statusPos.html('Checking if GPS device is available'); + }, + success: function (gpsData) { + statusPos.html('GPS position received'); + + statusPos.html('Waiting for position form GPS device...'); + updatePositionGPS(gpsData); + }, + error: function (jqXHR, textStatus, errorThrown) { + statusPos.html('GPS device not available!'); + + if (navigator.geolocation) { + statusPos.html('Waiting for position (geolocation)...'); + const options = { enableHighAccuracy: true, maximumAge: 0 }; + posId = navigator.geolocation.watchPosition( + updatePositionGeolocation, + handleGeolocationError, + options + ); + } else { + statusPos.html('Geolocation is not supported by this browser.'); + } + }, + }); + }); + + $('#posModal').on('hidden.bs.modal', function (e) { + if (navigator.geolocation) { + navigator.geolocation.clearWatch(posId); + } + }); + + $('#updateFormsButton').click(updateForms); + + initConnectModal(); + + initConsole(); + displayFolder('in'); + + initNotifications(); + initForms(); + }); +}); + +function initNotifications() { + if (!isNotificationsSupported()) { + statusPopoverDiv + .find('#notifications_error') + .find('.panel-body') + .html('Not supported by this browser.'); + return; + } + Notification.requestPermission(function (permission) { + if (permission === 'granted') { + showGUIStatus(statusPopoverDiv.find('#notifications_error'), false); + } else if (isInsecureOrigin()) { + // There is no way of knowing for sure if the permission was denied by the user + // or prohibited because of insecure origin (Chrome). This is just a lucky guess. + appendInsecureOriginWarning(statusPopoverDiv.find('#notifications_error')); + } + }); +} + +function isNotificationsSupported() { + if (!window.Notification || !Notification.requestPermission) return false; + + if (Notification.permission === 'granted') return true; + + // Chrome on Android support notifications only in the context of a Service worker. + // This is a hack to detect this case, so we can avoid asking for a pointless permission. + try { + new Notification(''); + } catch (e) { + if (e.name == 'TypeError') return false; + } + return true; +} + +let cancelCloseTimer = false; + +function updateProgress(p) { + cancelCloseTimer = !p.done; + + if (p.receiving || p.sending) { + const percent = Math.ceil((p.bytes_transferred * 100) / p.bytes_total); + const op = p.receiving ? 'Receiving' : 'Sending'; + let text = op + ' ' + p.mid + ' (' + p.bytes_total + ' bytes)'; + if (p.subject) { + text += ' - ' + htmlEscape(p.subject); + } + $('#navbar_progress .progress-text').text(text); + $('#navbar_progress .progress-bar') + .css('width', percent + '%') + .text(percent + '%'); + } + + if ($('#navbar_progress').is(':visible') && p.done) { + window.setTimeout(function () { + if (!cancelCloseTimer) { + $('#navbar_progress').fadeOut(500); + } + }, 3000); + } else if ((p.receiving || p.sending) && !p.done) { + $('#navbar_progress').show(); + } +} + +function initStatusPopover() { + statusPopoverDiv = $('#status_popover_content'); + showGUIStatus($('#websocket_error'), true); + showGUIStatus($('#notifications_error'), true); + $('#gui_status_light').popover({ + placement: 'bottom', + content: statusPopoverDiv, + html: true, + }); + + // Hack to force popover to grab it's content div + $('#gui_status_light').popover('show'); + $('#gui_status_light').popover('hide'); + statusPopoverDiv.show(); + + // Bind click on navbar-brand + $('#gui_status_light').unbind(); + $('.navbar-brand').click(function (e) { + $('#gui_status_light').popover('toggle'); + }); +} + +function onFormLaunching(target) { + $('#selectForm').modal('hide'); + startPollingFormData(); + window.open(target); +} + +function startPollingFormData() { + setCookie('forminstance', Math.floor(Math.random() * 1000000000), 1); + pollFormData(); +} + +function forgetFormData() { + window.clearTimeout(pollTimer); + deleteCookie('forminstance'); +} + +let pollTimer; + +function pollFormData() { + $.get( + 'api/form', + {}, + function (data) { + console.log(data); + if (!$('#composer').hasClass('hidden') && (!data.target_form || !data.target_form.name)) { + pollTimer = window.setTimeout(pollFormData, 1000); + } else { + console.log('done polling'); + if (!$('#composer').hasClass('hidden') && data.target_form && data.target_form.name) { + writeFormDataToComposer(data); + } + } + }, + 'json' + ); +} + +function writeFormDataToComposer(data) { + if (data.target_form) { + $('#msg_body').val(data.msg_body); + if (data.msg_subject) { + // in case of composing a form-based reply we keep the 'Re: ...' subject line + $('#msg_subject').val(data.msg_subject); + } + } +} + +function initComposeModal() { + $('#compose_btn').click(function (evt) { + $('#composer').modal('toggle'); + }); + const tokenfieldConfig = { + delimiter: [',', ';', ' '], // Must be in sync with SplitFunc (utils.go) + inputType: 'email', + createTokensOnBlur: true, + }; + $('#msg_to').tokenfield(tokenfieldConfig); + $('#msg_cc').tokenfield(tokenfieldConfig); + $('#composer').on('change', '.btn-file :file', previewAttachmentFiles); + $('#composer').on('hidden.bs.modal', forgetFormData); + + $('#composer_error').hide(); + + $('#compose_cancel').click(function (evt) { + closeComposer(true); + }); + + $('#composer_form').submit(function (e) { + const form = $('#composer_form'); + const d = new Date().toJSON(); + $('#msg_form_date').remove(); + form.append(''); + + // Set some defaults that makes the message pass validation (as Winlink Express does) + if ($('#msg_body').val().length == 0) { + $('#msg_body').val(''); + } + if ($('#msg_subject').val().length == 0) { + $('#msg_subject').val(''); + } + + $.ajax({ + url: '/api/mailbox/out', + method: 'POST', + data: new FormData(form[0]), + processData: false, + contentType: false, + success: function (result) { + $('#composer').modal('hide'); + closeComposer(true); + alert(result); + }, + error: function (error) { + $('#composer_error').html(error.responseText); + $('#composer_error').show(); + }, + }); + e.preventDefault(); + }); +} + +function initForms() { + $.getJSON('/api/formcatalog') + .done(function (data) { + initFormSelect(data); + }) + .fail(function (data) { + initFormSelect(null); + }); +} + +function initFormSelect(data) { + formsCatalog = data; + if ( + data && + data.path && + ((data.folders && data.folders.length > 0) || (data.forms && data.forms.length > 0)) + ) { + $('#formsVersion').html( + '(ver ' + + data.version + + ')' + ); + $('#updateFormsVersion').html(data.version); + $('#formsRootFolderName').text(data.path); + appendFormFolder('formFolderRoot', data); + } else { + $('#formsRootFolderName').text('missing form templates'); + $(`#formFolderRoot`).append(` +
    Form templates not downloaded
    + Use Action → Update Form Templates to download now + `); + } +} + +function updateForms() { + $('#updateFormsResponse').text(''); + $('#updateFormsError').text(''); + $.ajax({ + method: 'POST', + url: '/api/formsUpdate', + success: (msg) => { + $('#updateFormsError').text(''); + let response = JSON.parse(msg); + switch (response.action) { + case 'none': + $('#updateFormsResponse').text('You already have the latest forms version'); + break; + case 'update': + $('#updateFormsResponse').text('Updated forms to ' + response.newestVersion); + break; + } + }, + error: (err) => { + $('#updateFormsResponse').text(''); + $('#updateFormsError').text(err.responseText); + }, + }); +} + +function setCookie(cname, cvalue, exdays) { + const d = new Date(); + d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000); + const expires = 'expires=' + d.toUTCString(); + document.cookie = cname + '=' + cvalue + ';' + expires + ';path=/'; +} + +function deleteCookie(cname) { + document.cookie = cname + '=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;'; +} + +function appendFormFolder(rootId, data) { + if (data.folders && data.folders.length > 0 && data.form_count > 0) { + const rootAcc = `${rootId}Acc`; + $(`#${rootId}`).append(` +
    +
    + `); + data.folders.forEach(function (folder) { + if (folder.form_count > 0) { + const folderNameId = rootId + folder.name.replace(/\s/g, '_').replace(/&/g, 'and'); + const cardBodyId = folderNameId + 'Body'; + const card = ` +
    +
    + +
    +
    +
    +
    +
    +
    + `; + $(`#${rootAcc}`).append(card); + appendFormFolder(`${cardBodyId}`, folder); + if (folder.forms && folder.forms.length > 0) { + const cardBodyFormsId = `${cardBodyId}Forms`; + $(`#${cardBodyId}`).append(`
    `); + folder.forms.forEach((form) => { + const newDiv = $( + `
    ${form.name}
    ` + ); + const pathEncoded = encodeURIComponent(form.initial_uri); + newDiv.on('click', () => onFormLaunching(`/api/forms?formPath=${pathEncoded}`)); + $(`#${cardBodyFormsId}`).append(newDiv); + }); + } + } + }); + } +} + +function initConnectModal() { + $('#freqInput').on('focusin focusout', (e) => { + // Disable the connect button while the user is editing the frequency value. + // We do this because we really don't want the user to hit the connect + // button until they know that the QSY command succeeded or failed. + window.setTimeout(() => { + $('#connect_btn').prop('disabled', e.type == 'focusin'); + }, 300); + }); + $('#freqInput').change(() => { + onConnectInputChange(); + onConnectFreqChange(); + }); + $('#bandwidthInput').change(onConnectBandwidthChange); + $('#radioOnlyInput').change(onConnectInputChange); + $('#addrInput').change(onConnectInputChange); + $('#targetInput').change(onConnectInputChange); + $('#updateRmslistButton').click((e) => { + $(e.target).prop('disabled', true); + updateRmslist(true); + }); + + $('#modeSearchSelect').change(updateRmslist); + $('#bandSearchSelect').change(updateRmslist); + + $('#transportSelect').change(function (e) { + $('#bandwidthInput').val('').change(); + refreshExtraInputGroups(); + onConnectInputChange(); + onConnectFreqChange(); + switch ($(e.target).val()) { + case 'ardop': + case 'pactor': + case 'varafm': + case 'varahf': + $('#modeSearchSelect').val($(e.target).val()); + break; + case 'serial-tnc': + case 'ax25': + $('#modeSearchSelect').val('packet'); + break; + default: + return; + } + $('#modeSearchSelect').selectpicker('refresh'); + updateRmslist(); + }); + refreshExtraInputGroups(); + + updateConnectAliases(); + updateRmslist(); +} + +function updateRmslist(forceDownload) { + let tbody = $('#rmslist tbody'); + let params = { + mode: $('#modeSearchSelect').val(), + band: $('#bandSearchSelect').val(), + 'force-download': forceDownload === true, + }; + $.ajax({ + method: 'GET', + url: '/api/rmslist', + dataType: 'json', + data: params, + success: function (data) { + tbody.empty(); + data.forEach((rms) => { + let tr = $('') + .append($('').text(rms.callsign)) + .append($('').text(rms.distance.toFixed(0) + ' km')) + .append($('').text(rms.modes)) + .append($('').text(rms.dial.desc)); + tr.click((e) => { + tbody.find('.active').removeClass('active'); + tr.addClass('active'); + setConnectValues(rms.url); + }); + tbody.append(tr); + }); + }, + }); +} + +function updateConnectAliases() { + $.getJSON('/api/connect_aliases', function (data) { + connectAliases = data; + + const select = $('#aliasSelect'); + Object.keys(data).forEach(function (key) { + select.append(''); + }); + + select.change(function () { + $('#aliasSelect option:selected').each(function () { + const alias = $(this).text(); + const url = connectAliases[$(this).text()]; + setConnectValues(url); + select.val(''); + select.selectpicker('refresh'); + }); + }); + select.selectpicker('refresh'); + }); +} + +function setConnectValues(url) { + url = URI(url.toString()); + + $('#transportSelect').val(url.protocol()); + $('#transportSelect').selectpicker('refresh'); + + $('#targetInput').val(url.path().substr(1)); + + const query = url.search(true); + + if (url.hasQuery('freq')) { + $('#freqInput').val(query['freq']); + } else { + $('#freqInput').val(''); + } + + if (url.hasQuery('bw')) { + $('#bandwidthInput').val(query['bw']).change(); + $('#bandwidthInput').attr('x-value', query['bw']); // Since the option might not be available yet. + } else { + $('#bandwidthInput').val('').change(); + $('#bandwidthInput').removeAttr('x-value'); + } + + if (url.hasQuery('radio_only')) { + $('#radioOnlyInput')[0].checked = query['radio_only']; + } else { + $('#radioOnlyInput')[0].checked = false; + } + + let usri = ''; + if (url.username()) { + usri += url.username(); + } + if (url.password()) { + usri += ':' + url.password(); + } + if (usri != '') { + usri += '@'; + } + $('#addrInput').val(usri + url.host()); + + refreshExtraInputGroups(); + onConnectInputChange(); + onConnectFreqChange(); +} + +function getConnectURL() { + let url = + $('#transportSelect').val() + '://' + $('#addrInput').val() + '/' + $('#targetInput').val(); + + let params = ''; + + if ($('#freqInput').val() && $('#freqInput').parent().hasClass('has-success')) { + params += '&freq=' + $('#freqInput').val(); + } + if ($('#bandwidthInput').val()) { + params += '&bw=' + $('#bandwidthInput').val(); + } + if ($('#radioOnlyInput').is(':checked')) { + params += '&radio_only=true'; + } + + if (params) { + url += params.replace('&', '?'); + } + + return url; +} + +function onConnectFreqChange() { + $('#qsyWarning').empty().attr('hidden', true); + + const freqInput = $('#freqInput'); + freqInput.css('text-decoration', 'none currentcolor solid'); + + const inputGroup = freqInput.parent(); + ['has-error', 'has-success', 'has-warning'].forEach((v) => { + inputGroup.removeClass(v); + }); + inputGroup.tooltip('destroy'); + + const data = { + transport: $('#transportSelect').val(), + freq: new Number(freqInput.val()), + }; + if (data.freq == 0) { + return; + } + + console.log('QSY: ' + JSON.stringify(data)); + $.ajax({ + method: 'POST', + url: '/api/qsy', + data: JSON.stringify(data), + contentType: 'application/json', + success: () => { + inputGroup.addClass('has-success'); + }, + error: (xhr) => { + freqInput.css('text-decoration', 'line-through'); + if (xhr.status == 503) { + // The feature is unavailable + inputGroup + .attr('data-toggle', 'tooltip') + .attr( + 'title', + 'Rigcontrol is not configured for the selected transport. Set radio frequency manually.' + ) + .tooltip('fixTitle'); + } else { + // An unexpected error occured + [inputGroup, $('#qsyWarning')].forEach((e) => { + e.attr('data-toggle', 'tooltip') + .attr( + 'title', + 'Could not set radio frequency. See log output for more details and/or set the frequency manually.' + ) + .tooltip('fixTitle'); + }); + inputGroup.addClass('has-error'); + $('#qsyWarning') + .html(' QSY failure') + .attr('hidden', false); + } + }, + complete: () => { + onConnectInputChange(); + }, // This removes freq= from URL in case of failure + }); +} + +function onConnectBandwidthChange() { + const input = $(this); + console.log("connect bandwidth change " + input.val()); + input.attr('x-value', input.val()); + if (input.val() === '') { + input.removeAttr('x-value'); + } + onConnectInputChange(); +} + +function onConnectInputChange() { + $('#connectURLPreview').empty().append(getConnectURL()); +} + +function refreshExtraInputGroups() { + const transport = $('#transportSelect').val(); + populateBandwidths(transport); + switch (transport) { + case 'telnet': + $('#freqInputDiv').hide(); + $('#freqInput').val(''); + $('#addrInputDiv').show(); + break; + case 'ardop': + case 'varahf': + $('#addrInputDiv').hide(); + $('#addrInput').val(''); + $('#freqInputDiv').show(); + break; + default: + $('#addrInputDiv').hide(); + $('#addrInput').val(''); + $('#freqInputDiv').show(); + } + + if (transport == 'ax25' || transport == 'serial-tnc') { + $('#radioOnlyInput')[0].checked = false; + $('#radioOnlyInputDiv').hide(); + } else { + $('#radioOnlyInputDiv').show(); + } +} + +function populateBandwidths(transport) { + const select = $('#bandwidthInput'); + const div = $('#bandwidthInputDiv'); + var selected = select.attr('x-value'); + select.empty(); + select.prop('disabled', true); + $.ajax({ + method: 'GET', + url: `/api/bandwidths?mode=${transport}`, + dataType: 'json', + success: function (data) { + if (data.bandwidths.length === 0) { + return; + } + if (selected === undefined) { + selected = data.default; + } + data.bandwidths.forEach((bw) => { + const option = $(``); + option.prop('selected', bw === selected); + select.append(option); + }); + select.val(selected).change(); + }, + complete: function (xhr) { + select.attr('x-for-transport', transport); + div.toggle(select.find('option').length > 0); + select.prop('disabled', false); + select.selectpicker('refresh'); + }, + }); +} + +function handleGeolocationError(error) { + if (error.message.search('insecure origin') > 0 || isInsecureOrigin()) { + appendInsecureOriginWarning(statusPopoverDiv.find('#geolocation_error')); + } + showGUIStatus(statusPopoverDiv.find('#geolocation_error'), true); + statusPos.html('Geolocation unavailable.'); +} + +function updatePositionGeolocation(pos) { + const d = new Date(pos.timestamp); + statusPos.html('Last position update ' + dateFormat(d) + '...'); + $('#pos_lat').val(pos.coords.latitude); + $('#pos_long').val(pos.coords.longitude); + $('#pos_ts').val(pos.timestamp); +} + +function updatePositionGPS(pos) { + const d = new Date(pos.Time); + statusPos.html('Last position update ' + dateFormat(d) + '...'); + $('#pos_lat').val(pos.Lat); + $('#pos_long').val(pos.Lon); + $('#pos_ts').val(d.getTime()); +} + +function postPosition() { + const pos = { + lat: parseFloat($('#pos_lat').val()), + lon: parseFloat($('#pos_long').val()), + comment: $('#pos_comment').val(), + date: new Date(parseInt($('#pos_ts').val())), + }; + + $.ajax('/api/posreport', { + data: JSON.stringify(pos), + contentType: 'application/json', + type: 'POST', + success: function (resp) { + $('#posModal').modal('toggle'); + alert(resp); + }, + error: function (xhr, st, resp) { + alert(resp + ': ' + xhr.responseText); + }, + }); +} + +function previewAttachmentFiles() { + const files = $(this).get(0).files; + let attachments = $('#composer_attachments'); + for (let i = 0; i < files.length; i++) { + let file = files.item(i); + + uploadFiles[uploadFiles.length] = file; + + if (isImageSuffix(file.name)) { + const reader = new FileReader(); + reader.onload = function (e) { + attachments.append( + '' + ); + }; + reader.readAsDataURL(file); + } else { + attachments.append( + '' + ); + } + } +} + +function notify(data) { + const options = { + body: data.body, + icon: '/res/images/pat_logo.png', + }; + const n = new Notification(data.title, options); +} + +function alert(msg) { + const div = $('#navbar_status'); + div.empty(); + div.append('' + msg + '

    '); + div.show(); + window.setTimeout(function () { + div.fadeOut(500); + }, 5000); +} + +function updateStatus(data) { + const st = $('#status_text'); + st.empty().off('click').attr('data-toggle', 'tooltip').attr('data-placement', 'bottom').tooltip(); + + const onDisconnect = function () { + st.tooltip('hide'); + disconnect(false, () => { + // This will be reset by the next updateStatus when the session is aborted + st.empty().append('Disconnecting... '); + // Issue dirty disconnect on second click + st.off('click').click(() => { + st.off('click'); + disconnect(true); + st.tooltip('hide'); + }); + st.attr('title', 'Click to force disconnect').tooltip('fixTitle').tooltip('show'); + }); + }; + + if (data.dialing) { + st.append('Dialing... '); + st.click(onDisconnect); + st.attr('title', 'Click to abort').tooltip('fixTitle').tooltip('show'); + } else if (data.connected) { + st.append('Connected ' + data.remote_addr); + st.click(onDisconnect); + st.attr('title', 'Click to disconnect').tooltip('fixTitle').tooltip('hide'); + } else { + if (data.active_listeners.length > 0) { + st.append('Listening ' + data.active_listeners + ''); + } else { + st.append('Ready'); + } + st.attr('title', 'Click to connect').tooltip('fixTitle').tooltip('hide'); + st.click(() => { + $('#connectModal').modal('toggle'); + }); + } + + const n = data.http_clients.length; + statusPopoverDiv + .find('#webserver_info') + .find('.panel-body') + .html(n + (n == 1 ? ' client ' : ' clients ') + 'connected.'); +} + +function closeComposer(clear) { + if (clear) { + $('#composer_error').val('').hide(); + $('#msg_body').val(''); + $('#msg_subject').val(''); + $('#msg_to').tokenfield('setTokens', ''); + $('#msg_cc').tokenfield('setTokens', ''); + $('#composer_form')[0].reset(); + + // Attachment previews + $('#composer_attachments').empty(); + + // Attachment input field + let attachments = $('#msg_attachments_input'); + attachments.replaceWith((attachments = attachments.clone(true))); + } + $('#composer').modal('hide'); +} + +function connect(evt) { + const url = encodeURIComponent(getConnectURL()); + + $('#connectModal').modal('hide'); + + $.getJSON('/api/connect?url=' + url, function (data) { + if (data.NumReceived == 0) { + window.setTimeout(function () { + alert('No new messages.'); + }, 1000); + } + }).error(function () { + alert('Connect failed. See console for detailed information.'); + }); +} + +function disconnect(dirty, successHandler) { + if (successHandler === undefined) { + successHandler = () => {}; + } + $.post( + '/api/disconnect?dirty=' + dirty, + {}, + function (response) { + successHandler(); + }, + 'json' + ); +} + +function updateGUIStatus() { + let color = 'success'; + statusPopoverDiv + .find('.panel-info') + .not('.hidden') + .not('.ignore-status') + .each(function (i) { + color = 'info'; + }); + statusPopoverDiv + .find('.panel-warning') + .not('.hidden') + .not('.ignore-status') + .each(function (i) { + color = 'warning'; + }); + statusPopoverDiv + .find('.panel-danger') + .not('.hidden') + .not('.ignore-status') + .each(function (i) { + color = 'danger'; + }); + $('#gui_status_light') + .removeClass(function (index, className) { + return (className.match(/(^|\s)btn-\S+/g) || []).join(' '); + }) + .addClass('btn-' + color); + if (color == 'success') { + statusPopoverDiv.find('#no_error').show(); + } else { + statusPopoverDiv.find('#no_error').hide(); + } +} + +function isInsecureOrigin() { + if (hasOwnProperty.call(window, 'isSecureContext')) { + return !window.isSecureContext; + } + if (window.location.protocol == 'https:') { + return false; + } + if (window.location.protocol == 'file:') { + return false; + } + if (location.hostname === 'localhost' || location.hostname.startsWith('127.0')) { + return false; + } + return true; +} + +function appendInsecureOriginWarning(e) { + e.removeClass('panel-info').addClass('panel-warning'); + e.find('.panel-body').append( + '

    Ensure the secure origin criteria for Powerful Features are met.

    ' + ); + updateGUIStatus(); +} + +function showGUIStatus(e, show) { + show ? e.removeClass('hidden') : e.addClass('hidden'); + updateGUIStatus(); +} + +let ws; + +function initConsole() { + if ('WebSocket' in window) { + ws = new WebSocket(wsURL); + ws.onopen = function (evt) { + console.log('Websocket opened'); + showGUIStatus(statusPopoverDiv.find('#websocket_error'), false); + showGUIStatus(statusPopoverDiv.find('#webserver_info'), true); + $('#console').empty(); + }; + ws.onmessage = function (evt) { + const msg = JSON.parse(evt.data); + if (msg.MyCall) { + mycall = msg.MyCall; + } + if (msg.Notification) { + notify(msg.Notification); + } + if (msg.LogLine) { + updateConsole(msg.LogLine + '\n'); + } + if (msg.UpdateMailbox) { + displayFolder(currentFolder); + } + if (msg.Status) { + updateStatus(msg.Status); + } + if (msg.Progress) { + updateProgress(msg.Progress); + } + if (msg.Prompt) { + processPromptQuery(msg.Prompt); + } + if (msg.PromptAbort) { + $('#promptModal').modal('hide'); + } + if (msg.Ping) { + ws.send(JSON.stringify({ Pong: true })); + } + }; + ws.onclose = function (evt) { + console.log('Websocket closed'); + showGUIStatus(statusPopoverDiv.find('#websocket_error'), true); + showGUIStatus(statusPopoverDiv.find('#webserver_info'), false); + $('#status_text').empty(); + window.setTimeout(function () { + initConsole(); + }, 1000); + }; + } else { + // The browser doesn't support WebSocket + let wsError = true; + alert('Websocket not supported by your browser, please upgrade your browser.'); + } +} + +function processPromptQuery(p) { + console.log(p); + + if (p.kind != 'password') { + console.log('Ignoring unsupported prompt of kind: ' + p.kind); + return; + } + + $('#promptID').val(p.id); + $('#promptResponseValue').val(''); + $('#promptMessage').text(p.message); + $('#promptOkButton').click(postPromptResponse); + $('#promptModal').modal('show'); +} + +function postPromptResponse() { + const id = $('#promptID').val(); + const value = $('#promptResponseValue').val(); + $('#promptModal').modal('hide'); + ws.send( + JSON.stringify({ + prompt_response: { + id: id, + value: value, + }, + }) + ); +} + +function updateConsole(msg) { + const pre = $('#console'); + pre.append('' + msg + ''); + pre.scrollTop(pre.prop('scrollHeight')); +} + +const getCellValue = (tr, idx) => tr.children[idx].innerText || tr.children[idx].textContent; + +const comparer = (idx, asc) => (a, b) => + ((v1, v2) => + v1 !== '' && v2 !== '' && !isNaN(v1) && !isNaN(v2) ? v1 - v2 : v1.toString().localeCompare(v2))( + getCellValue(asc ? a : b, idx), + getCellValue(asc ? b : a, idx) + ); + +let currentFolder; + +function displayFolder(dir) { + currentFolder = dir; + + const is_from = dir == 'in' || dir == 'archive'; + + const table = $('#folder table'); + table.empty(); + table.append( + 'Subject' + + '' + + (is_from ? 'From' : 'To') + + '' + + (is_from ? '' : 'P2P') + + 'DateMessage ID' + ); + + const tbody = $('#folder table tbody'); + + $.getJSON('/api/mailbox/' + dir, function (data) { + for (let i = 0; i < data.length; i++) { + const msg = data[i]; + + //TODO: Cleanup (Sorry about this...) + let html = + ''; + if (msg.Files.length > 0) { + html += ''; + } + html += '' + htmlEscape(msg.Subject) + ''; + if (!is_from && !msg.To) { + html += ''; + } else if (is_from) { + html += msg.From.Addr; + } else if (msg.To.length == 1) { + html += msg.To[0].Addr; + } else if (msg.To.length > 1) { + html += msg.To[0].Addr + '...'; + } + html += ''; + html += is_from + ? '' + : '' + (msg.P2POnly ? '' : '') + ''; + html += '' + msg.Date + '' + msg.MID + ''; + + const elem = $(html); + tbody.append(elem); + elem.click(function (evt) { + displayMessage($(this)); + }); + } + }); + // Adapted from https://stackoverflow.com/a/49041392 + document.querySelectorAll('th').forEach((th) => + th.addEventListener('click', () => { + const table = th.closest('table'); + const tbody = table.querySelector('tbody'); + Array.from(tbody.querySelectorAll('tr')) + .sort(comparer(Array.from(th.parentNode.children).indexOf(th), (this.asc = !this.asc))) + .forEach((tr) => tbody.appendChild(tr)); + const previousTh = table.querySelector('th.sorted'); + if (previousTh != null) { + previousTh.classList.remove('sorted'); + } + th.classList.add('sorted'); + }) + ); +} + +function displayMessage(elem) { + const mid = elem.attr('ID'); + const msg_url = buildMessagePath(currentFolder, mid); + + $.getJSON(msg_url, function (data) { + elem.attr('class', 'info'); + + const view = $('#message_view'); + view.find('#subject').text(data.Subject); + view.find('#headers').empty(); + view.find('#headers').append('Date: ' + data.Date + '
    '); + view.find('#headers').append('From: ' + data.From.Addr + '
    '); + view.find('#headers').append('To: '); + for (let i = 0; data.To && i < data.To.length; i++) { + view + .find('#headers') + .append('' + data.To[i].Addr + '' + (data.To.length - 1 > i ? ', ' : '')); + } + if (data.P2POnly) { + view.find('#headers').append(' (P2P only)'); + } + + if (data.Cc) { + view.find('#headers').append('
    Cc: '); + for (let i = 0; i < data.Cc.length; i++) { + view + .find('#headers') + .append('' + data.Cc[i].Addr + '' + (data.Cc.length - 1 > i ? ', ' : '')); + } + } + + view.find('#body').html(data.BodyHTML); + + const attachments = view.find('#attachments'); + attachments.empty(); + if (!data.Files) { + attachments.hide(); + } else { + attachments.show(); + } + for (let i = 0; data.Files && i < data.Files.length; i++) { + const file = data.Files[i]; + const formName = formXmlToFormName(file.Name); + let renderToHtml = 'false'; + if (formName) { + renderToHtml = 'true'; + } + const attachUrl = msg_url + '/' + file.Name + '?rendertohtml=' + renderToHtml; + + if (isImageSuffix(file.Name)) { + attachments.append( + '' + ); + } else if (formName) { + attachments.append( + '' + ); + } else { + attachments.append( + '' + ); + } + } + $('#reply_btn').off('click'); + $('#reply_btn').click(function (evt) { + $('#message_view').modal('hide'); + + $('#msg_to').tokenfield('setTokens', [data.From.Addr]); + $('#msg_cc').tokenfield('setTokens', replyCarbonCopyList(data)); + if (data.Subject.lastIndexOf('Re:', 0) != 0) { + $('#msg_subject').val('Re: ' + data.Subject); + } else { + $('#msg_subject').val(data.Subject); + } + $('#msg_body').val('\n\n' + quoteMsg(data)); + + $('#composer').modal('show'); + $('#msg_body').focus(); + $('#msg_body')[0].setSelectionRange(0, 0); + + //opens browser window for a form-based reply, + // or does nothing if this is not a form-based message + showReplyForm(msg_url, data); + }); + $('#forward_btn').off('click'); + $('#forward_btn').click(function (evt) { + $('#message_view').modal('hide'); + + $('#msg_to').tokenfield('setTokens', ''); + $('#msg_subject').val('Fw: ' + data.Subject); + $('#msg_body').val(quoteMsg(data)); + $('#msg_body')[0].setSelectionRange(0, 0); + $('#composer').modal('show'); + $('#msg_to-tokenfield').focus(); + }); + $('#delete_btn').off('click'); + $('#delete_btn').click(function (evt) { + deleteMessage(currentFolder, mid); + }); + $('#archive_btn').off('click'); + $('#archive_btn').click(function (evt) { + archiveMessage(currentFolder, mid); + }); + + // Archive button should be hidden for already archived messages + if (currentFolder == 'archive') { + $('#archive_btn').parent().hide(); + } else { + $('#archive_btn').parent().show(); + } + + view.show(); + $('#message_view').modal('show'); + let mbox = currentFolder; + if (!data.Read) { + window.setTimeout(function () { + setRead(mbox, data.MID); + }, 2000); + } + elem.attr('class', 'active'); + }); +} + +function formXmlToFormName(fileName) { + let match = fileName.match(/^RMS_Express_Form_([\w \.]+)-\d+\.xml$/i); + if (match) { + return match[1]; + } + + match = fileName.match(/^RMS_Express_Form_([\w \.]+)\.xml$/i); + if (match) { + return match[1]; + } + + return null; +} + +function showReplyForm(orgMsgUrl, msg) { + for (let i = 0; msg.Files && i < msg.Files.length; i++) { + const file = msg.Files[i]; + const formName = formXmlToFormName(file.Name); + if (!formName) { + continue; + } + // retrieve form XML attachment and determine if it specifies a form-based reply + const attachUrl = orgMsgUrl + '/' + file.Name; + $.get( + attachUrl + '?rendertohtml=false&composereply=false', + {}, + function (data) { + let parser = new DOMParser(); + let xmlDoc = parser.parseFromString(data, 'text/xml'); + if (xmlDoc) { + let replyTmpl = xmlDoc.evaluate( + '/RMS_Express_Form/form_parameters/reply_template', + xmlDoc, + null, + XPathResult.STRING_TYPE, + null + ); + if (replyTmpl && replyTmpl.stringValue) { + window.setTimeout(startPollingFormData, 500); + open(attachUrl + '?rendertohtml=true&composereply=true'); + } + } + }, + 'text' + ); + return; + } +} + +function replyCarbonCopyList(msg) { + let addrs = msg.To; + if (msg.Cc != null && msg.Cc.length > 0) { + addrs = addrs.concat(msg.Cc); + } + const seen = {}; + seen[mycall] = true; + seen[msg.From.Addr] = true; + const strings = []; + for (let i = 0; i < addrs.length; i++) { + if (seen[addrs[i].Addr]) { + continue; + } + seen[addrs[i].Addr] = true; + strings.push(addrs[i].Addr); + } + return strings; +} + +function quoteMsg(data) { + let output = '--- ' + data.Date + ' ' + data.From.Addr + ' wrote: ---\n'; + + const lines = data.Body.split('\n'); + for (let i = 0; i < lines.length; i++) { + output += '>' + lines[i] + '\n'; + } + return output; +} + +function htmlEscape(str) { + return $('
    ').text(str).html(); +} + +function archiveMessage(box, mid) { + $.ajax('/api/mailbox/archive', { + headers: { + 'X-Pat-SourcePath': buildMessagePath(box, mid), + }, + contentType: 'application/json', + type: 'POST', + success: function (resp) { + $('#message_view').modal('hide'); + alert('Message archived'); + }, + error: function (xhr, st, resp) { + alert(resp + ': ' + xhr.responseText); + }, + }); +} + +function deleteMessage(box, mid) { + $('#confirm_delete').on('click', '.btn-ok', function (e) { + $('#message_view').modal('hide'); + const $modalDiv = $(e.delegateTarget); + $.ajax(buildMessagePath(box, mid), { + type: 'DELETE', + success: function (resp) { + $modalDiv.modal('hide'); + alert('Message deleted'); + }, + error: function (xhr, st, resp) { + $modalDiv.modal('hide'); + alert(resp + ': ' + xhr.responseText); + }, + }); + }); + $('#confirm_delete').modal('show'); +} + +function setRead(box, mid) { + const data = { read: true }; + + $.ajax(buildMessagePath(box, mid) + '/read', { + data: JSON.stringify(data), + contentType: 'application/json', + type: 'POST', + success: function (resp) {}, + error: function (xhr, st, resp) { + alert(resp + ': ' + xhr.responseText); + }, + }); +} + +function isImageSuffix(name) { + return name.toLowerCase().match(/\.(jpg|jpeg|png|gif)$/); +} + +function dateFormat(previous) { + const current = new Date(); + + const msPerMinute = 60 * 1000; + const msPerHour = msPerMinute * 60; + const msPerDay = msPerHour * 24; + const msPerMonth = msPerDay * 30; + const msPerYear = msPerDay * 365; + + const elapsed = current - previous; + + if (elapsed < msPerDay) { + return ( + (previous.getHours() < 10 ? '0' : '') + + previous.getHours() + + ':' + + (previous.getMinutes() < 10 ? '0' : '') + + previous.getMinutes() + ); + } else if (elapsed < msPerMonth) { + return 'approximately ' + Math.round(elapsed / msPerDay) + ' days ago'; + } else if (elapsed < msPerYear) { + return 'approximately ' + Math.round(elapsed / msPerMonth) + ' months ago'; + } else { + return 'approximately ' + Math.round(elapsed / msPerYear) + ' years ago'; + } +} + +function buildMessagePath(folder, mid) { + return '/api/mailbox/' + encodeURIComponent(folder) + '/' + encodeURIComponent(mid); +} diff -Nru pat-0.12.1/web/src/scss/app.scss pat-0.13.1/web/src/scss/app.scss --- pat-0.12.1/web/src/scss/app.scss 1970-01-01 00:00:00.000000000 +0000 +++ pat-0.13.1/web/src/scss/app.scss 2022-10-22 20:39:54.000000000 +0000 @@ -0,0 +1,331 @@ +@import '~bootstrap/dist/css/bootstrap.min.css'; +@import '~bootstrap-select/dist/css/bootstrap-select.min.css'; +@import '~bootstrap-tokenfield/dist/css/bootstrap-tokenfield.min.css'; + +html { + position: relative; + min-height: 100%; +} + +body { + /* Margin bottom by footer height */ + margin-bottom: 130px; +} + +body > .container { + padding: 75px 15px 0; +} + +.btn:focus { + outline: none !important; +} + +.navbar-link { + text-decoration: none !important; +} + +.status-text { + font-weight: bold; + font-size: 11px !important; + margin: 0px 0px 0; +} + +@media screen and (min-width: 1024px) { + .modal.modal-narrow .modal-dialog { + width: 30%; + } + + .modal-narrow .modal-body { + overflow-y: auto; + } +} + +.progress-text { + padding-top: 3px; + font-size: 11px !important; + color: #555555; + white-space: nowrap; + overflow: hidden; + display: block; + text-overflow: ellipsis; +} + +.navbar > .container { + margin-bottom: -10px; +} + +.alert-small { + width: 300px; +} + +.strong { + font-weight: bold; +} + +/* + * GUI Status Popover + */ +.popover-content { + padding: 9px 12px; + padding-bottom: 3px; +} + +.panel-sm { + margin-bottom: 6px; +} + +.panel-sm > .panel-heading { + font-weight: bold; + font-size: 14px; + padding: 5px 10px; +} + +.panel-sm > .panel-body { + font-size: 12px; + line-height: 1.4; + padding: 10px; +} + +.status-light { + width: 10px; + height: 10px; + text-align: center; + padding: 1px 0; + border-radius: 15px; + margin-bottom: 3px; + margin-right: -3px; +} + +/* + * Mailbox folder + */ +#folder { + max-height: 345px; + overflow-y: auto; +} + +#folder > table { + font-size: 80%; +} + +.sorted { + color: maroon; +} + +/* + * Message viewer + */ +#message_view { + display: none; + font-size: 80%; +} + +#composer { + display: none; + font-size: 80%; +} + +.modal-header .btn-group { + margin-right: 5px; + margin-top: -5px; +} + +/* Work-around for issue with tokenfield and input-group-sm on bootstrap 3.1 or newer */ +.input-group-sm .tokenfield { + height: auto; +} + +.modal-header .btn-group button { + color: #fff; +} + +.modal-header .btn-group button:hover { + color: #fff; +} + +.primary.modal-header { + background-color: #337ab7; + color: #fff; +} + +.primay.modal-body { + padding: 0px 0; + margin-left: 5px; +} + +.primary.modal-footer { + background-color: #333; +} + +#composer_attachments { + margin-top: 10px; +} + +#body { + border: none; + white-space: pre-wrap; + min-height: 50px; + margin: 3px; +} + +#msg_body { + min-height: 150px; + white-space: pre-wrap; +} + +.panel-title { + font-size: 115%; + font-weight: bolder; +} + +@media screen and (min-width: 1024px) { + #body { + min-height: 400px; + max-height: 600px; + overflow-y: auto !important; + white-space: pre-wrap; + } + #msg_body { + min-height: 400px; + max-height: 600px; + overflow-y: auto !important; + white-space: pre-wrap; + } + #message_view { + font-size: 80%; + } + #folder { + max-height: 700px; + overflow-y: auto; + } +} + +.panel-fluid { + margin: 0px 0; + padding: 0px 0; +} + +.panel-heading p { + margin: 0px 0; +} + +#connectURLPreview { + font-size: 80%; +} + +/* + * Log console + */ +.footer { + position: absolute; + bottom: 15px; + width: 100%; + height: 120px; +} + +#console { + height: 120px; + overflow-y: auto; + background-color: #272822; + color: #ffffff; + line-height: 0.5em; + padding: 3px; +} + +#console .terminal { + font-size: 0.6em; +} + +.msgbody p { +} + +.msgbody blockquote { + font-size: 1em; + color: #777777; + margin-top: 0px; + padding-left: 5px; + margin-bottom: 10px; +} + +.msgbody blockquote p { + margin-top: 0px; + margin-bottom: 0px; +} + +.msgbody blockquote ul { + margin-top: 0px; + margin-bottom: -20px; + margin-left: 0px; + padding-left: 15px; +} + +@media screen and (min-width: 1024px) { + .footer { + position: absolute; + bottom: 15px; + width: 100%; + height: 130px; + } + #console { + height: 120px; + overflow-y: auto; + background-color: #272822; + color: #ffffff; + line-height: 1em; + padding: 3px; + } + #console .terminal { + font-size: 0.9em; + } +} + +/* Attachment add */ +.btn-file { + position: relative; + overflow: hidden; +} + +.btn-file input[type='file'] { + position: absolute; + top: 0; + right: 0; + min-width: 100%; + min-height: 100%; + font-size: 100px; + text-align: right; + filter: alpha(opacity=0); + opacity: 0; + outline: none; + background: white; + cursor: inherit; + display: block; +} + +.compose-options { + margin-top: 10px; + margin-bottom: -10px; +} + +#composer_error { + font-size: 12px; + margin: 5px 0px; + padding: 5px 5px; +} + +input[type='checkbox'], +input[type='radio'] { + vertical-align: -2px; + margin: 0; + padding: 0; +} + +.table-fixed { + overflow-y: auto; + height: 400px; +} + +.table-fixed thead th { + position: sticky; + top: 0; + background: #eee; +} diff -Nru pat-0.12.1/web/src/static/LICENSES.md pat-0.13.1/web/src/static/LICENSES.md --- pat-0.12.1/web/src/static/LICENSES.md 1970-01-01 00:00:00.000000000 +0000 +++ pat-0.13.1/web/src/static/LICENSES.md 2022-10-22 20:39:54.000000000 +0000 @@ -0,0 +1,144 @@ +The following licenses covers all third party software used by the web GUI + +============================================================================== + +Name: Bootstrap +Version: v3.2.0 +Repository: github.com/twbs/bootstrap + +The MIT License (MIT) + +Copyright (c) 2011-2016 Twitter, Inc. + +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. + +============================================================================== + +Name: JQuery +Version: v1.11.1 +Repository: github.com/jquery/jquery + +Copyright 2014 jQuery Foundation and other contributors +http://jquery.com/ + +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. + +============================================================================== + +Name: URI.js +Version: v1.16.1 (?) +Repository: github.com/medialize/URI.js + +The MIT License (MIT) + +Copyright (c) 2011 Rodney Rehm + +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. + +============================================================================== + +Name: Bootstrap-select +Version: v1.7.5 +Repository: github.com/silviomoreto/bootstrap-select + +The MIT License (MIT) + +Copyright (c) 2013-2015 bootstrap-select + +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. + +============================================================================== + +Name: Boostrap-tokenfield (Open-Xchange-Frontend fork) +Version: v0.12.1 (db79219699545ddea9b82ce31716045d064a5d5c) +Repository: github.com/Open-Xchange-Frontend/bootstrap-tokenfield + +#### Sliptree + +- by Illimar Tambek for [Sliptree](http://sliptree.com) +- Copyright (c) 2013 by Sliptree + +Available for use under the [MIT License](http://en.wikipedia.org/wiki/MIT_License) + +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. Binary files /tmp/tmp_1kz1e1r/W2SOuoj67F/pat-0.12.1/web/src/static/pat_logo.png and /tmp/tmp_1kz1e1r/a98zKQw83J/pat-0.13.1/web/src/static/pat_logo.png differ diff -Nru pat-0.12.1/web/webpack.config.js pat-0.13.1/web/webpack.config.js --- pat-0.12.1/web/webpack.config.js 1970-01-01 00:00:00.000000000 +0000 +++ pat-0.13.1/web/webpack.config.js 2022-10-22 20:39:54.000000000 +0000 @@ -0,0 +1,167 @@ +/* + * Created by Artyom Manchenkov + * artyom@manchenkoff.me + * manchenkoff.me © 2019 + */ + +// import plugins +const path = require('path'); +const webpack = require('webpack'); +const { CleanWebpackPlugin } = require('clean-webpack-plugin'); +const MiniCssExtractPlugin = require('mini-css-extract-plugin'); +const TerserPlugin = require('terser-webpack-plugin'); +const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin'); +const CopyPlugin = require('copy-webpack-plugin'); +const ImageminPlugin = require('imagemin-webpack-plugin').default; + +/** + * Base webpack configuration + * + * @param env -> env parameters + * @param argv -> CLI arguments, 'argv.mode' is the current webpack mode (development | production) + * @returns object + */ +module.exports = (env, argv) => { + let isProduction = argv.mode === 'production'; + + let config = { + // absolute path to the base directory + context: path.resolve(__dirname, 'src'), + + // development server with hot-reload + devServer: { + publicPath: '/dist/', + watchContentBase: true, + compress: true, + }, + + // entry files to compile (relative to the base dir) + entry: ['./js/app.js', './scss/app.scss'], + + // enable development source maps + // * will be overwritten by 'source-maps' in production mode + devtool: 'inline-source-map', + + // path to store compiled JS bundle + output: { + // bundle relative name + filename: 'js/app.js', + // base build directory + path: path.resolve(__dirname, 'dist'), + // path to build relative asset links + publicPath: '../', + }, + + // plugins configurations + plugins: [ + // save compiled SCSS into separated CSS file + new MiniCssExtractPlugin({ + filename: 'css/style.css', + }), + + // copy static assets directory + new CopyPlugin([ + { from: 'static', to: 'static' }, + { from: 'index.html', to: 'index.html' }, + ]), + + // image optimization + new ImageminPlugin({ + // disable for dev builds + disable: !isProduction, + test: /\.(jpe?g|png|gif)$/i, + pngquant: { quality: '70-85' }, + optipng: { optimizationLevel: 9 }, + }), + + // provide jQuery and Popper.js dependencies + new webpack.ProvidePlugin({ + $: 'jquery', + jQuery: 'jquery', + jquery: 'jquery', + 'window.jQuery': 'jquery', + Popper: ['popper.js', 'default'], + }), + ], + + // production mode optimization + optimization: { + minimizer: [ + // CSS optimizer + new OptimizeCSSAssetsPlugin(), + // JS optimizer by default + new TerserPlugin(), + ], + }, + + // custom loaders configuration + module: { + rules: [ + // styles loader + { + test: /\.(sa|sc|c)ss$/, + use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'], + }, + + // images loader + { + test: /\.(png|jpe?g|gif)$/, + loaders: [ + { + loader: 'file-loader', + options: { + name: 'img/[name].[ext]', + }, + }, + { + loader: 'image-webpack-loader', + options: { + disable: !isProduction, + mozjpeg: { + progressive: true, + quality: 65, + }, + pngquant: { + quality: '65-90', + speed: 4, + }, + optipng: { enabled: false }, + gifsicle: { interlaced: false }, + webp: { quality: 75 }, + }, + }, + ], + }, + + // fonts loader + { + test: /\.(woff|woff2|eot|ttf|otf)$/, + use: [ + { + loader: 'file-loader', + options: { + name: 'fonts/[name].[ext]', + }, + }, + ], + }, + + // svg inline 'data:image' loader + { + test: /\.svg$/, + loader: 'svg-url-loader', + }, + ], + }, + }; + + // PRODUCTION ONLY configuration + if (isProduction) { + config.plugins.push( + // clean 'dist' directory + new CleanWebpackPlugin() + ); + } + + return config; +};