From 248005e8e05529ee5aa558a2126c3f80019be759 Mon Sep 17 00:00:00 2001 From: Sam Potts Date: Mon, 30 Jul 2018 23:29:02 +1000 Subject: [PATCH] Fix merge --- demo/dist/demo.css | 1 + demo/dist/demo.js | 4416 ++++++++++ demo/dist/demo.js.map | 1 + demo/dist/demo.min.js | 2 + demo/dist/demo.min.js.map | 1 + demo/dist/error.css | 1 + dist/plyr.css | 1 + dist/plyr.js | 8409 ++++++++++++++++++ dist/plyr.js.map | 1 + dist/plyr.min.js | 2 + dist/plyr.min.js.map | 1 + dist/plyr.polyfilled.js | 13803 ++++++++++++++++++++++++++++++ dist/plyr.polyfilled.js.map | 1 + dist/plyr.polyfilled.min.js | 2 + dist/plyr.polyfilled.min.js.map | 1 + dist/plyr.svg | 1 + src/js/plyr.js | 3 +- 17 files changed, 26645 insertions(+), 2 deletions(-) create mode 100644 demo/dist/demo.css create mode 100644 demo/dist/demo.js create mode 100644 demo/dist/demo.js.map create mode 100644 demo/dist/demo.min.js create mode 100644 demo/dist/demo.min.js.map create mode 100644 demo/dist/error.css create mode 100644 dist/plyr.css create mode 100644 dist/plyr.js create mode 100644 dist/plyr.js.map create mode 100644 dist/plyr.min.js create mode 100644 dist/plyr.min.js.map create mode 100644 dist/plyr.polyfilled.js create mode 100644 dist/plyr.polyfilled.js.map create mode 100644 dist/plyr.polyfilled.min.js create mode 100644 dist/plyr.polyfilled.min.js.map create mode 100644 dist/plyr.svg diff --git a/demo/dist/demo.css b/demo/dist/demo.css new file mode 100644 index 00000000..299959bc --- /dev/null +++ b/demo/dist/demo.css @@ -0,0 +1 @@ +@font-face{font-display:swap;font-family:Gordita;font-style:normal;font-weight:300;src:url(https://cdn.plyr.io/static/fonts/gordita-light.woff2) format("woff2"),url(https://cdn.plyr.io/static/fonts/gordita-light.woff) format("woff")}@font-face{font-display:swap;font-family:Gordita;font-style:normal;font-weight:400;src:url(https://cdn.plyr.io/static/fonts/gordita-regular.woff2) format("woff2"),url(https://cdn.plyr.io/static/fonts/gordita-regular.woff) format("woff")}@font-face{font-display:swap;font-family:Gordita;font-style:normal;font-weight:500;src:url(https://cdn.plyr.io/static/fonts/gordita-medium.woff2) format("woff2"),url(https://cdn.plyr.io/static/fonts/gordita-medium.woff) format("woff")}@font-face{font-display:swap;font-family:Gordita;font-style:normal;font-weight:600;src:url(https://cdn.plyr.io/static/fonts/gordita-bold.woff2) format("woff2"),url(https://cdn.plyr.io/static/fonts/gordita-bold.woff) format("woff")}@font-face{font-display:swap;font-family:Gordita;font-style:normal;font-weight:900;src:url(https://cdn.plyr.io/static/fonts/gordita-black.woff2) format("woff2"),url(https://cdn.plyr.io/static/fonts/gordita-black.woff) format("woff")}@keyframes fadein{0%{opacity:0}100%{opacity:1}}/*! normalize.css v7.0.0 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,footer,header,nav,section{display:block}h1{font-size:2em;margin:.67em 0}figcaption,figure,main{display:block}figure{margin:1em 40px}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a,button.faux-link{background-color:transparent;-webkit-text-decoration-skip:objects}abbr[title]{border-bottom:none;text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}b,strong{font-weight:inherit}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}dfn{font-style:italic}mark{background-color:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}audio,video{display:inline-block}audio:not([controls]){display:none;height:0}img{border-style:none}svg:not(:root){overflow:hidden}button,input,optgroup,select,textarea{font-family:sans-serif;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=reset],[type=submit],button,html [type=button]{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{display:inline-block;vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details,menu{display:block}summary{display:list-item}canvas{display:inline-block}template{display:none}[hidden]{display:none}*,::after,::before{box-sizing:border-box}body,html{display:flex;width:100%}html{background:linear-gradient(to left top,#4dc1ff,#0074b3);background-attachment:fixed;height:100%}body{align-items:center;display:flex;flex-direction:column;min-height:100%}.grid{flex:1;overflow:auto}main{margin:auto;padding-bottom:1px;text-align:center}aside{align-items:center;background:#fff;color:#55646b;display:flex;flex-shrink:0;justify-content:center;padding:15px;position:relative;text-align:center;text-shadow:none;width:100%}aside .icon{fill:#4baaf4;margin-right:10px}aside p{margin:0}aside a,aside button.faux-link{color:#4baaf4}aside a.tab-focus,aside button.tab-focus.faux-link{box-shadow:0 0 0 3px rgba(75,170,244,.35);outline:0}.grid{margin:0 auto;padding:20px}@media only screen and (min-width:768px){.grid{align-items:center;display:flex;max-width:1260px;width:100%}.grid>*{flex:1}}html{font-size:100%}body{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-size:15px;font-size:.9375rem;color:#fff;font-family:Gordita,Avenir,"Helvetica Neue",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-weight:500;line-height:1.75;text-shadow:0 1px 1px rgba(0,0,0,.15)}button,input,select,textarea{font:inherit}p,small{margin:0 0 20px}small{font-size:13px;font-size:.8125rem;display:block}h1{font-size:64px;font-size:4rem;font-weight:600;letter-spacing:-.025em;line-height:1.2;margin:0 0 20px}.button,.button__count{align-items:center;background:#fff;border:0;border-radius:4px;box-shadow:0 1px 1px rgba(0,0,0,.1);color:#55646b;display:inline-flex;padding:15px;position:relative;text-shadow:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:middle}.button{font-weight:600;padding-left:20px;padding-right:20px;transition:all .2s ease}.button:focus,.button:hover{color:#343f4a}.button:focus::after,.button:hover::after{display:none}.button:hover{box-shadow:0 2px 2px rgba(0,0,0,.1);transform:translateY(-1px)}.button:focus{outline:0}.button.tab-focus{box-shadow:0 0 0 3px rgba(255,255,255,.35);outline:0}.button:active{transform:translateY(1px)}.button--with-count{display:inline-flex}.button--with-count .button .icon{flex-shrink:0}.button__count{animation:fadein .2s ease;margin-left:10px}.button__count::before{border:5px solid transparent;border-left-width:0;border-right-color:#fff;content:'';height:0;position:absolute;right:100%;top:50%;transform:translateY(-50%);width:0}header{padding-bottom:20px;text-align:center}header .call-to-action{margin-top:30px}@media only screen and (min-width:768px){header{margin-right:60px;max-width:360px;padding-bottom:40px;text-align:left}}.icon{fill:currentColor;height:16px;vertical-align:-3px;width:16px}a svg,button svg,button.faux-link svg,label svg{pointer-events:none}.btn .icon,a .icon,button.faux-link .icon{margin-right:6px}button.faux-link{background:0 0;border:0;border-radius:0;cursor:pointer;font:inherit;line-height:1.75;margin:0;padding:0;position:relative;text-align:inherit;text-shadow:inherit;-moz-user-select:text;vertical-align:baseline;width:auto}a,button.faux-link{border-bottom:1px dotted currentColor;color:#fff;font-weight:600;position:relative;text-decoration:none;transition:all .2s ease}a::after,button.faux-link::after{background:currentColor;content:'';height:1px;left:50%;position:absolute;top:100%;transform:translateX(-50%);transition:width .2s ease;width:0}a:focus,a:hover,button.faux-link:focus,button.faux-link:hover{border-bottom-color:transparent;outline:0}a:focus::after,a:hover::after,button.faux-link:focus::after,button.faux-link:hover::after{width:100%}a.tab-focus,button.tab-focus.faux-link{box-shadow:0 0 0 3px rgba(255,255,255,.35);outline:0}a.no-border::after,button.no-border.faux-link::after{display:none}li,ul{list-style:none;margin:0;padding:0}audio,img,video{max-width:100%;vertical-align:middle}nav{display:flex;justify-content:center;margin-bottom:20px}video{max-width:100%;vertical-align:middle}.plyr{border-radius:4px;box-shadow:0 2px 5px rgba(0,0,0,.2);margin:20px auto}.plyr.plyr--audio{max-width:480px}.plyr__video-wrapper::after{border:1px solid rgba(0,0,0,.15);border-radius:inherit;bottom:0;content:'';left:0;pointer-events:none;position:absolute;right:0;top:0;z-index:3}.plyr__cite{display:none;margin-top:20px}.plyr__cite .icon{margin-right:4px}.plyr--audio~ul .plyr__cite--audio,.plyr--video:not(.plyr--youtube):not(.plyr--vimeo)~ul .plyr__cite--video,.plyr--vimeo~ul .plyr__cite--vimeo,.plyr--youtube~ul .plyr__cite--youtube{display:block}@keyframes plyr-progress{to{background-position:25px 0}}@keyframes plyr-popup{0%{opacity:.5;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes plyr-fade-in{from{opacity:0}to{opacity:1}}.plyr{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;direction:ltr;font-family:inherit;font-variant-numeric:tabular-nums;font-weight:500;line-height:1.7;max-width:100%;min-width:200px;position:relative;text-shadow:none;transition:box-shadow .3s ease}.plyr audio,.plyr video{border-radius:inherit;height:auto;vertical-align:middle;width:100%}.plyr button{font:inherit;line-height:inherit;width:auto}.plyr:focus{outline:0}.plyr--full-ui{box-sizing:border-box}.plyr--full-ui *,.plyr--full-ui ::after,.plyr--full-ui ::before{box-sizing:inherit}.plyr--full-ui a,.plyr--full-ui button,.plyr--full-ui button.faux-link,.plyr--full-ui input,.plyr--full-ui label{touch-action:manipulation}.plyr__badge{background:#4f5b5f;border-radius:2px;color:#fff;font-size:9px;line-height:1;padding:3px 4px}.plyr--full-ui ::-webkit-media-text-track-container{display:none}.plyr__captions{animation:plyr-fade-in .3s ease;bottom:0;color:#fff;display:none;font-size:12px;left:0;padding:10px;position:absolute;text-align:center;transform:translateY(-40px);transition:transform .4s ease-in-out;width:100%}.plyr__captions .plyr__caption{background:rgba(0,0,0,.8);border-radius:2px;-webkit-box-decoration-break:clone;box-decoration-break:clone;line-height:185%;padding:.2em .5em;white-space:pre-wrap}.plyr__captions .plyr__caption div{display:inline}.plyr__captions span:empty{display:none}@media (min-width:480px){.plyr__captions{font-size:13px;padding:20px}}@media (min-width:768px){.plyr__captions{font-size:18px}}.plyr--captions-active .plyr__captions{display:block}.plyr--hide-controls .plyr__captions{transform:translateY(-15px)}.plyr__control{background:0 0;border:0;border-radius:3px;color:inherit;cursor:pointer;flex-shrink:0;overflow:visible;padding:7px;position:relative;transition:all .3s ease}.plyr__control svg{display:block;fill:currentColor;height:18px;pointer-events:none;width:18px}.plyr__control:focus{outline:0}.plyr__control.plyr__tab-focus{box-shadow:0 0 0 5px rgba(26,175,255,.5);outline:0}.plyr__control.plyr__control--pressed .icon--not-pressed,.plyr__control.plyr__control--pressed .label--not-pressed,.plyr__control:not(.plyr__control--pressed) .icon--pressed,.plyr__control:not(.plyr__control--pressed) .label--pressed{display:none}.plyr--audio .plyr__control.plyr__tab-focus,.plyr--audio .plyr__control:hover,.plyr--audio .plyr__control[aria-expanded=true]{background:#1aafff;color:#fff}.plyr__control--overlaid{background:rgba(26,175,255,.8);border:0;border-radius:100%;box-shadow:0 1px 1px rgba(0,0,0,.15);color:#fff;display:none;left:50%;padding:15px;position:absolute;top:50%;transform:translate(-50%,-50%);z-index:2}.plyr__control--overlaid svg{height:20px;left:2px;position:relative;width:20px}.plyr__control--overlaid:focus,.plyr__control--overlaid:hover{background:#1aafff}.plyr--playing .plyr__control--overlaid{opacity:0;visibility:hidden}.plyr--full-ui.plyr--video .plyr__control--overlaid{display:block}.plyr--full-ui ::-webkit-media-controls{display:none}.plyr__controls{align-items:center;display:flex;justify-content:flex-end;text-align:center}.plyr__controls .plyr__menu,.plyr__controls .plyr__progress,.plyr__controls .plyr__time,.plyr__controls>.plyr__control{margin-left:5px}.plyr__controls .plyr__menu:first-child,.plyr__controls .plyr__menu:first-child+[data-plyr=pause],.plyr__controls .plyr__progress:first-child,.plyr__controls .plyr__progress:first-child+[data-plyr=pause],.plyr__controls .plyr__time:first-child,.plyr__controls .plyr__time:first-child+[data-plyr=pause],.plyr__controls>.plyr__control:first-child,.plyr__controls>.plyr__control:first-child+[data-plyr=pause]{margin-left:0;margin-right:auto}.plyr__controls .plyr__volume{margin-left:5px}@media (min-width:480px){.plyr__controls .plyr__menu,.plyr__controls .plyr__progress,.plyr__controls .plyr__time,.plyr__controls>.plyr__control{margin-left:10px}.plyr__controls .plyr__menu+.plyr__control,.plyr__controls>.plyr__control+.plyr__control,.plyr__controls>.plyr__control+.plyr__menu{margin-left:5px}}.plyr--video .plyr__controls{background:linear-gradient(transparent,rgba(0,0,0,.7));border-bottom-left-radius:inherit;border-bottom-right-radius:inherit;bottom:0;color:#fff;left:0;padding:35px 10px 10px;position:absolute;right:0;transition:opacity .4s ease-in-out,transform .4s ease-in-out;z-index:2}.plyr--video .plyr__controls .plyr__control svg{-webkit-filter:drop-shadow(0 1px 1px rgba(0, 0, 0, .15));filter:drop-shadow(0 1px 1px rgba(0, 0, 0, .15))}.plyr--video .plyr__controls .plyr__control.plyr__tab-focus,.plyr--video .plyr__controls .plyr__control:hover,.plyr--video .plyr__controls .plyr__control[aria-expanded=true]{background:#1aafff;color:#fff}.plyr--audio .plyr__controls{background:#fff;border-radius:inherit;color:#4f5b5f;padding:10px}.plyr--video.plyr--hide-controls .plyr__controls{opacity:0;pointer-events:none;transform:translateY(100%)}.plyr [data-plyr=airplay],.plyr [data-plyr=captions],.plyr [data-plyr=fullscreen],.plyr [data-plyr=pip]{display:none}.plyr--airplay-supported [data-plyr=airplay],.plyr--captions-enabled [data-plyr=captions],.plyr--fullscreen-enabled [data-plyr=fullscreen],.plyr--pip-supported [data-plyr=pip]{display:inline-block}.plyr__controls:empty{display:none}.plyr__controls:empty~.plyr__captions{transform:translateY(0)}.plyr__video-embed{height:0;padding-bottom:56.25%;position:relative}.plyr__video-embed iframe{border:0;height:100%;left:0;position:absolute;top:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:100%}.plyr--full-ui .plyr__video-embed>.plyr__video-embed__container{padding-bottom:240%;position:relative;transform:translateY(-38.28125%)}.plyr__menu{display:flex;position:relative}.plyr__menu .plyr__control svg{transition:transform .3s ease}.plyr__menu .plyr__control[aria-expanded=true] svg{transform:rotate(90deg)}.plyr__menu .plyr__control[aria-expanded=true] .plyr__tooltip{display:none}.plyr__menu__container{animation:plyr-popup .2s ease;background:rgba(255,255,255,.9);border-radius:4px;bottom:100%;box-shadow:0 1px 2px rgba(0,0,0,.15);color:#4f5b5f;font-size:13px;margin-bottom:10px;position:absolute;right:-3px;text-align:left;white-space:nowrap;z-index:3}.plyr__menu__container>div{overflow:hidden;transition:height .35s cubic-bezier(.4,0,.2,1),width .35s cubic-bezier(.4,0,.2,1)}.plyr__menu__container::after{border:4px solid transparent;border-top-color:rgba(255,255,255,.9);content:'';height:0;position:absolute;right:15px;top:100%;width:0}.plyr__menu__container [role=menu]{padding:7px}.plyr__menu__container [role=menuitem],.plyr__menu__container [role=menuitemradio]{margin-top:2px}.plyr__menu__container [role=menuitem]:first-child,.plyr__menu__container [role=menuitemradio]:first-child{margin-top:0}.plyr__menu__container .plyr__control{align-items:center;color:#4f5b5f;display:flex;font-size:13px;padding:4px 11px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:100%}.plyr__menu__container .plyr__control>span{align-items:inherit;display:flex;width:100%}.plyr__menu__container .plyr__control::after{border:4px solid transparent;content:'';position:absolute;top:50%;transform:translateY(-50%)}.plyr__menu__container .plyr__control--forward{padding-right:28px}.plyr__menu__container .plyr__control--forward::after{border-left-color:rgba(79,91,95,.8);right:5px}.plyr__menu__container .plyr__control--forward.plyr__tab-focus::after,.plyr__menu__container .plyr__control--forward:hover::after{border-left-color:currentColor}.plyr__menu__container .plyr__control--back{font-weight:500;margin:7px;margin-bottom:3px;padding-left:28px;position:relative;width:calc(100% - 14px)}.plyr__menu__container .plyr__control--back::after{border-right-color:rgba(79,91,95,.8);left:7px}.plyr__menu__container .plyr__control--back::before{background:#b7c5cd;box-shadow:0 1px 0 #fff;content:'';height:1px;left:0;margin-top:4px;overflow:hidden;position:absolute;right:0;top:100%}.plyr__menu__container .plyr__control--back.plyr__tab-focus::after,.plyr__menu__container .plyr__control--back:hover::after{border-right-color:currentColor}.plyr__menu__container .plyr__control[role=menuitemradio]{padding-left:7px}.plyr__menu__container .plyr__control[role=menuitemradio]::after,.plyr__menu__container .plyr__control[role=menuitemradio]::before{border-radius:100%}.plyr__menu__container .plyr__control[role=menuitemradio]::before{background:rgba(0,0,0,.1);content:'';display:block;flex-shrink:0;height:16px;margin-right:10px;transition:all .3s ease;width:16px}.plyr__menu__container .plyr__control[role=menuitemradio]::after{background:#fff;border:0;height:6px;left:12px;opacity:0;top:50%;transform:translateY(-50%) scale(0);transition:transform .3s ease,opacity .3s ease;width:6px}.plyr__menu__container .plyr__control[role=menuitemradio][aria-checked=true]::before{background:#1aafff}.plyr__menu__container .plyr__control[role=menuitemradio][aria-checked=true]::after{opacity:1;transform:translateY(-50%) scale(1)}.plyr__menu__container .plyr__control[role=menuitemradio].plyr__tab-focus::before,.plyr__menu__container .plyr__control[role=menuitemradio]:hover::before{background:rgba(0,0,0,.1)}.plyr__menu__container .plyr__menu__value{align-items:center;display:flex;margin-left:auto;margin-right:-5px;overflow:hidden;padding-left:25px;pointer-events:none}.plyr--full-ui input[type=range]{-webkit-appearance:none;background:0 0;border:0;border-radius:28px;color:#1aafff;display:block;height:20px;margin:0;padding:0;transition:box-shadow .3s ease;width:100%}.plyr--full-ui input[type=range]::-webkit-slider-runnable-track{background:0 0;border:0;border-radius:3px;height:6px;-webkit-user-select:none;user-select:none;background-image:linear-gradient(to right,currentColor var(--value,0),transparent var(--value,0))}.plyr--full-ui input[type=range]::-webkit-slider-thumb{background:#fff;border:0;border-radius:100%;box-shadow:0 1px 1px rgba(0,0,0,.15),0 0 0 1px rgba(47,52,61,.2);height:14px;position:relative;transition:all .2s ease;width:14px;-webkit-appearance:none;margin-top:-4px}.plyr--full-ui input[type=range]::-moz-range-track{background:0 0;border:0;border-radius:3px;height:6px;-moz-user-select:none;user-select:none}.plyr--full-ui input[type=range]::-moz-range-thumb{background:#fff;border:0;border-radius:100%;box-shadow:0 1px 1px rgba(0,0,0,.15),0 0 0 1px rgba(47,52,61,.2);height:14px;position:relative;transition:all .2s ease;width:14px}.plyr--full-ui input[type=range]::-moz-range-progress{background:currentColor;border-radius:3px;height:6px}.plyr--full-ui input[type=range]::-ms-track{background:0 0;border:0;border-radius:3px;height:6px;-ms-user-select:none;user-select:none;color:transparent}.plyr--full-ui input[type=range]::-ms-fill-upper{background:0 0;border:0;border-radius:3px;height:6px;-ms-user-select:none;user-select:none}.plyr--full-ui input[type=range]::-ms-fill-lower{background:0 0;border:0;border-radius:3px;height:6px;-ms-user-select:none;user-select:none;background:currentColor}.plyr--full-ui input[type=range]::-ms-thumb{background:#fff;border:0;border-radius:100%;box-shadow:0 1px 1px rgba(0,0,0,.15),0 0 0 1px rgba(47,52,61,.2);height:14px;position:relative;transition:all .2s ease;width:14px;margin-top:0}.plyr--full-ui input[type=range]::-ms-tooltip{display:none}.plyr--full-ui input[type=range]:focus{outline:0}.plyr--full-ui input[type=range]::-moz-focus-outer{border:0}.plyr--full-ui input[type=range].plyr__tab-focus::-webkit-slider-runnable-track{box-shadow:0 0 0 5px rgba(26,175,255,.5);outline:0}.plyr--full-ui input[type=range].plyr__tab-focus::-moz-range-track{box-shadow:0 0 0 5px rgba(26,175,255,.5);outline:0}.plyr--full-ui input[type=range].plyr__tab-focus::-ms-track{box-shadow:0 0 0 5px rgba(26,175,255,.5);outline:0}.plyr--full-ui.plyr--video input[type=range]::-webkit-slider-runnable-track{background-color:rgba(255,255,255,.25)}.plyr--full-ui.plyr--video input[type=range]::-moz-range-track{background-color:rgba(255,255,255,.25)}.plyr--full-ui.plyr--video input[type=range]::-ms-track{background-color:rgba(255,255,255,.25)}.plyr--full-ui.plyr--video input[type=range]:active::-webkit-slider-thumb{box-shadow:0 1px 1px rgba(0,0,0,.15),0 0 0 1px rgba(47,52,61,.2),0 0 0 3px rgba(255,255,255,.5)}.plyr--full-ui.plyr--video input[type=range]:active::-moz-range-thumb{box-shadow:0 1px 1px rgba(0,0,0,.15),0 0 0 1px rgba(47,52,61,.2),0 0 0 3px rgba(255,255,255,.5)}.plyr--full-ui.plyr--video input[type=range]:active::-ms-thumb{box-shadow:0 1px 1px rgba(0,0,0,.15),0 0 0 1px rgba(47,52,61,.2),0 0 0 3px rgba(255,255,255,.5)}.plyr--full-ui.plyr--audio input[type=range]::-webkit-slider-runnable-track{background-color:rgba(183,197,205,.66)}.plyr--full-ui.plyr--audio input[type=range]::-moz-range-track{background-color:rgba(183,197,205,.66)}.plyr--full-ui.plyr--audio input[type=range]::-ms-track{background-color:rgba(183,197,205,.66)}.plyr--full-ui.plyr--audio input[type=range]:active::-webkit-slider-thumb{box-shadow:0 1px 1px rgba(0,0,0,.15),0 0 0 1px rgba(47,52,61,.2),0 0 0 3px rgba(0,0,0,.1)}.plyr--full-ui.plyr--audio input[type=range]:active::-moz-range-thumb{box-shadow:0 1px 1px rgba(0,0,0,.15),0 0 0 1px rgba(47,52,61,.2),0 0 0 3px rgba(0,0,0,.1)}.plyr--full-ui.plyr--audio input[type=range]:active::-ms-thumb{box-shadow:0 1px 1px rgba(0,0,0,.15),0 0 0 1px rgba(47,52,61,.2),0 0 0 3px rgba(0,0,0,.1)}.plyr__poster{background-color:#000;background-position:50% 50%;background-repeat:no-repeat;background-size:contain;display:none;height:100%;left:0;pointer-events:none;position:absolute;top:0;width:100%;z-index:1}.plyr--stopped.plyr__poster-enabled .plyr__poster{display:block}.plyr__time{font-size:11px}.plyr__time+.plyr__time::before{content:'\2044';margin-right:10px}@media (max-width:767px){.plyr__time+.plyr__time{display:none}}.plyr--video .plyr__time{text-shadow:0 1px 1px rgba(0,0,0,.15)}.plyr__tooltip{background:rgba(255,255,255,.9);border-radius:3px;bottom:100%;box-shadow:0 1px 2px rgba(0,0,0,.15);color:#4f5b5f;font-size:12px;font-weight:500;line-height:1.3;margin-bottom:10px;opacity:0;padding:5px 7.5px;pointer-events:none;position:absolute;transform:translate(-50%,10px) scale(.8);transform-origin:50% 100%;transition:transform .2s .1s ease,opacity .2s .1s ease;white-space:nowrap;z-index:2}.plyr__tooltip::before{border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid rgba(255,255,255,.9);bottom:-4px;content:'';height:0;left:50%;position:absolute;transform:translateX(-50%);width:0;z-index:2}.plyr .plyr__control.plyr__tab-focus .plyr__tooltip,.plyr .plyr__control:hover .plyr__tooltip,.plyr__tooltip--visible{opacity:1;transform:translate(-50%,0) scale(1)}.plyr .plyr__control:hover .plyr__tooltip{z-index:3}.plyr__controls>.plyr__control:first-child .plyr__tooltip,.plyr__controls>.plyr__control:first-child+.plyr__control .plyr__tooltip{left:0;transform:translate(0,10px) scale(.8);transform-origin:0 100%}.plyr__controls>.plyr__control:first-child .plyr__tooltip::before,.plyr__controls>.plyr__control:first-child+.plyr__control .plyr__tooltip::before{left:16px}.plyr__controls>.plyr__control:last-child .plyr__tooltip{right:0;transform:translate(0,10px) scale(.8);transform-origin:100% 100%}.plyr__controls>.plyr__control:last-child .plyr__tooltip::before{left:auto;right:16px;transform:translateX(50%)}.plyr__controls>.plyr__control:first-child .plyr__tooltip--visible,.plyr__controls>.plyr__control:first-child+.plyr__control .plyr__tooltip--visible,.plyr__controls>.plyr__control:first-child+.plyr__control.plyr__tab-focus .plyr__tooltip,.plyr__controls>.plyr__control:first-child+.plyr__control:hover .plyr__tooltip,.plyr__controls>.plyr__control:first-child.plyr__tab-focus .plyr__tooltip,.plyr__controls>.plyr__control:first-child:hover .plyr__tooltip,.plyr__controls>.plyr__control:last-child .plyr__tooltip--visible,.plyr__controls>.plyr__control:last-child.plyr__tab-focus .plyr__tooltip,.plyr__controls>.plyr__control:last-child:hover .plyr__tooltip{transform:translate(0,0) scale(1)}.plyr--video{overflow:hidden}.plyr--video.plyr--menu-open{overflow:visible}.plyr__video-wrapper{background:#000;border-radius:inherit;overflow:hidden;position:relative;z-index:0}.plyr__progress{flex:1;left:7px;margin-right:14px;position:relative}.plyr__progress input[type=range],.plyr__progress__buffer{margin-left:-7px;margin-right:-7px;width:calc(100% + 14px)}.plyr__progress input[type=range]{position:relative;z-index:2}.plyr__progress .plyr__tooltip{font-size:11px;left:0}.plyr__progress__buffer{-webkit-appearance:none;background:0 0;border:0;border-radius:100px;height:6px;left:0;margin-top:-3px;padding:0;position:absolute;top:50%}.plyr__progress__buffer::-webkit-progress-bar{background:0 0;transition:width .2s ease}.plyr__progress__buffer::-webkit-progress-value{background:currentColor;border-radius:100px;min-width:6px}.plyr__progress__buffer::-moz-progress-bar{background:currentColor;border-radius:100px;min-width:6px;transition:width .2s ease}.plyr__progress__buffer::-ms-fill{border-radius:100px;transition:width .2s ease}.plyr--video .plyr__progress__buffer{box-shadow:0 1px 1px rgba(0,0,0,.15);color:rgba(255,255,255,.25)}.plyr--audio .plyr__progress__buffer{color:rgba(183,197,205,.66)}.plyr--loading .plyr__progress__buffer{animation:plyr-progress 1s linear infinite;background-image:linear-gradient(-45deg,rgba(47,52,61,.6) 25%,transparent 25%,transparent 50%,rgba(47,52,61,.6) 50%,rgba(47,52,61,.6) 75%,transparent 75%,transparent);background-repeat:repeat-x;background-size:25px 25px;color:transparent}.plyr--video.plyr--loading .plyr__progress__buffer{background-color:rgba(255,255,255,.25)}.plyr--audio.plyr--loading .plyr__progress__buffer{background-color:rgba(183,197,205,.66)}.plyr__volume{flex:1;position:relative}.plyr__volume input[type=range]{position:relative;z-index:2}@media (min-width:480px){.plyr__volume{max-width:50px}}@media (min-width:768px){.plyr__volume{max-width:80px}}.plyr--is-ios .plyr__volume{display:none!important}.plyr--is-ios.plyr--vimeo [data-plyr=mute]{display:none!important}.plyr:-webkit-full-screen{background:#000;border-radius:0!important;height:100%;margin:0;width:100%}.plyr:-moz-full-screen{background:#000;border-radius:0!important;height:100%;margin:0;width:100%}.plyr:-ms-fullscreen{background:#000;border-radius:0!important;height:100%;margin:0;width:100%}.plyr:fullscreen{background:#000;border-radius:0!important;height:100%;margin:0;width:100%}.plyr:-webkit-full-screen video{height:100%}.plyr:-moz-full-screen video{height:100%}.plyr:-ms-fullscreen video{height:100%}.plyr:fullscreen video{height:100%}.plyr:-webkit-full-screen .plyr__video-wrapper{height:100%;width:100%}.plyr:-moz-full-screen .plyr__video-wrapper{height:100%;width:100%}.plyr:-ms-fullscreen .plyr__video-wrapper{height:100%;width:100%}.plyr:fullscreen .plyr__video-wrapper{height:100%;width:100%}.plyr:-webkit-full-screen .plyr__video-embed{overflow:visible}.plyr:-moz-full-screen .plyr__video-embed{overflow:visible}.plyr:-ms-fullscreen .plyr__video-embed{overflow:visible}.plyr:fullscreen .plyr__video-embed{overflow:visible}.plyr:-webkit-full-screen.plyr--vimeo .plyr__video-wrapper{height:0;top:50%;transform:translateY(-50%)}.plyr:-moz-full-screen.plyr--vimeo .plyr__video-wrapper{height:0;top:50%;transform:translateY(-50%)}.plyr:-ms-fullscreen.plyr--vimeo .plyr__video-wrapper{height:0;top:50%;transform:translateY(-50%)}.plyr:fullscreen.plyr--vimeo .plyr__video-wrapper{height:0;top:50%;transform:translateY(-50%)}.plyr:-webkit-full-screen .plyr__control .icon--exit-fullscreen{display:block}.plyr:-moz-full-screen .plyr__control .icon--exit-fullscreen{display:block}.plyr:-ms-fullscreen .plyr__control .icon--exit-fullscreen{display:block}.plyr:fullscreen .plyr__control .icon--exit-fullscreen{display:block}.plyr:-webkit-full-screen .plyr__control .icon--exit-fullscreen+svg{display:none}.plyr:-moz-full-screen .plyr__control .icon--exit-fullscreen+svg{display:none}.plyr:-ms-fullscreen .plyr__control .icon--exit-fullscreen+svg{display:none}.plyr:fullscreen .plyr__control .icon--exit-fullscreen+svg{display:none}.plyr:-webkit-full-screen.plyr--hide-controls{cursor:none}.plyr:-moz-full-screen.plyr--hide-controls{cursor:none}.plyr:-ms-fullscreen.plyr--hide-controls{cursor:none}.plyr:fullscreen.plyr--hide-controls{cursor:none}@media (min-width:1024px){.plyr:-webkit-full-screen .plyr__captions{font-size:21px}.plyr:-moz-full-screen .plyr__captions{font-size:21px}.plyr:-ms-fullscreen .plyr__captions{font-size:21px}.plyr:fullscreen .plyr__captions{font-size:21px}}.plyr:-webkit-full-screen{background:#000;border-radius:0!important;height:100%;margin:0;width:100%}.plyr:-webkit-full-screen video{height:100%}.plyr:-webkit-full-screen .plyr__video-wrapper{height:100%;width:100%}.plyr:-webkit-full-screen .plyr__video-embed{overflow:visible}.plyr:-webkit-full-screen.plyr--vimeo .plyr__video-wrapper{height:0;top:50%;transform:translateY(-50%)}.plyr:-webkit-full-screen .plyr__control .icon--exit-fullscreen{display:block}.plyr:-webkit-full-screen .plyr__control .icon--exit-fullscreen+svg{display:none}.plyr:-webkit-full-screen.plyr--hide-controls{cursor:none}@media (min-width:1024px){.plyr:-webkit-full-screen .plyr__captions{font-size:21px}}.plyr:-moz-full-screen{background:#000;border-radius:0!important;height:100%;margin:0;width:100%}.plyr:-moz-full-screen video{height:100%}.plyr:-moz-full-screen .plyr__video-wrapper{height:100%;width:100%}.plyr:-moz-full-screen .plyr__video-embed{overflow:visible}.plyr:-moz-full-screen.plyr--vimeo .plyr__video-wrapper{height:0;top:50%;transform:translateY(-50%)}.plyr:-moz-full-screen .plyr__control .icon--exit-fullscreen{display:block}.plyr:-moz-full-screen .plyr__control .icon--exit-fullscreen+svg{display:none}.plyr:-moz-full-screen.plyr--hide-controls{cursor:none}@media (min-width:1024px){.plyr:-moz-full-screen .plyr__captions{font-size:21px}}.plyr:-ms-fullscreen{background:#000;border-radius:0!important;height:100%;margin:0;width:100%}.plyr:-ms-fullscreen video{height:100%}.plyr:-ms-fullscreen .plyr__video-wrapper{height:100%;width:100%}.plyr:-ms-fullscreen .plyr__video-embed{overflow:visible}.plyr:-ms-fullscreen.plyr--vimeo .plyr__video-wrapper{height:0;top:50%;transform:translateY(-50%)}.plyr:-ms-fullscreen .plyr__control .icon--exit-fullscreen{display:block}.plyr:-ms-fullscreen .plyr__control .icon--exit-fullscreen+svg{display:none}.plyr:-ms-fullscreen.plyr--hide-controls{cursor:none}@media (min-width:1024px){.plyr:-ms-fullscreen .plyr__captions{font-size:21px}}.plyr--fullscreen-fallback{background:#000;border-radius:0!important;height:100%;margin:0;width:100%;bottom:0;left:0;position:fixed;right:0;top:0;z-index:10000000}.plyr--fullscreen-fallback video{height:100%}.plyr--fullscreen-fallback .plyr__video-wrapper{height:100%;width:100%}.plyr--fullscreen-fallback .plyr__video-embed{overflow:visible}.plyr--fullscreen-fallback.plyr--vimeo .plyr__video-wrapper{height:0;top:50%;transform:translateY(-50%)}.plyr--fullscreen-fallback .plyr__control .icon--exit-fullscreen{display:block}.plyr--fullscreen-fallback .plyr__control .icon--exit-fullscreen+svg{display:none}.plyr--fullscreen-fallback.plyr--hide-controls{cursor:none}@media (min-width:1024px){.plyr--fullscreen-fallback .plyr__captions{font-size:21px}}.plyr__ads{border-radius:inherit;bottom:0;cursor:pointer;left:0;overflow:hidden;position:absolute;right:0;top:0;z-index:-1}.plyr__ads>div,.plyr__ads>div iframe{height:100%;position:absolute;width:100%}.plyr__ads::after{background:rgba(47,52,61,.8);border-radius:2px;bottom:10px;color:#fff;content:attr(data-badge-text);font-size:11px;padding:2px 6px;pointer-events:none;position:absolute;right:10px;z-index:3}.plyr__ads::after:empty{display:none}.plyr__cues{background:currentColor;display:block;height:6px;left:0;margin:-3px 0 0;opacity:.8;position:absolute;top:50%;width:3px;z-index:3}.plyr--no-transition{transition:none!important}.plyr__sr-only{clip:rect(1px,1px,1px,1px);overflow:hidden;border:0!important;height:1px!important;padding:0!important;position:absolute!important;width:1px!important}.plyr [hidden]{display:none!important}.no-border{border:0}[hidden]{display:none}.sr-only{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;opacity:.001;overflow:hidden;padding:0;position:absolute;width:1px} \ No newline at end of file diff --git a/demo/dist/demo.js b/demo/dist/demo.js new file mode 100644 index 00000000..21f0425e --- /dev/null +++ b/demo/dist/demo.js @@ -0,0 +1,4416 @@ +typeof navigator === "object" && (function () { + 'use strict'; + + var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + + function createCommonjsModule(fn, module) { + return module = { exports: {} }, fn(module, module.exports), module.exports; + } + + var stringify_1 = createCommonjsModule(function (module, exports) { + /* + json-stringify-safe + Like JSON.stringify, but doesn't throw on circular references. + + Originally forked from https://github.com/isaacs/json-stringify-safe + version 5.0.1 on 3/8/2017 and modified to handle Errors serialization + and IE8 compatibility. Tests for this are in test/vendor. + + ISC license: https://github.com/isaacs/json-stringify-safe/blob/master/LICENSE + */ + + exports = module.exports = stringify; + exports.getSerialize = serializer; + + function indexOf(haystack, needle) { + for (var i = 0; i < haystack.length; ++i) { + if (haystack[i] === needle) return i; + } + return -1; + } + + function stringify(obj, replacer, spaces, cycleReplacer) { + return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces); + } + + // https://github.com/ftlabs/js-abbreviate/blob/fa709e5f139e7770a71827b1893f22418097fbda/index.js#L95-L106 + function stringifyError(value) { + var err = { + // These properties are implemented as magical getters and don't show up in for in + stack: value.stack, + message: value.message, + name: value.name + }; + + for (var i in value) { + if (Object.prototype.hasOwnProperty.call(value, i)) { + err[i] = value[i]; + } + } + + return err; + } + + function serializer(replacer, cycleReplacer) { + var stack = []; + var keys = []; + + if (cycleReplacer == null) { + cycleReplacer = function(key, value) { + if (stack[0] === value) { + return '[Circular ~]'; + } + return '[Circular ~.' + keys.slice(0, indexOf(stack, value)).join('.') + ']'; + }; + } + + return function(key, value) { + if (stack.length > 0) { + var thisPos = indexOf(stack, this); + ~thisPos ? stack.splice(thisPos + 1) : stack.push(this); + ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key); + + if (~indexOf(stack, value)) { + value = cycleReplacer.call(this, key, value); + } + } else { + stack.push(value); + } + + return replacer == null + ? value instanceof Error ? stringifyError(value) : value + : replacer.call(this, key, value); + }; + } + }); + var stringify_2 = stringify_1.getSerialize; + + var _window = + typeof window !== 'undefined' + ? window + : typeof commonjsGlobal !== 'undefined' + ? commonjsGlobal + : typeof self !== 'undefined' + ? self + : {}; + + function isObject(what) { + return typeof what === 'object' && what !== null; + } + + // Yanked from https://git.io/vS8DV re-used under CC0 + // with some tiny modifications + function isError(value) { + switch (Object.prototype.toString.call(value)) { + case '[object Error]': + return true; + case '[object Exception]': + return true; + case '[object DOMException]': + return true; + default: + return value instanceof Error; + } + } + + function isErrorEvent(value) { + return Object.prototype.toString.call(value) === '[object ErrorEvent]'; + } + + function isDOMError(value) { + return Object.prototype.toString.call(value) === '[object DOMError]'; + } + + function isDOMException(value) { + return Object.prototype.toString.call(value) === '[object DOMException]'; + } + + function isUndefined(what) { + return what === void 0; + } + + function isFunction(what) { + return typeof what === 'function'; + } + + function isPlainObject(what) { + return Object.prototype.toString.call(what) === '[object Object]'; + } + + function isString(what) { + return Object.prototype.toString.call(what) === '[object String]'; + } + + function isArray(what) { + return Object.prototype.toString.call(what) === '[object Array]'; + } + + function isEmptyObject(what) { + if (!isPlainObject(what)) return false; + + for (var _ in what) { + if (what.hasOwnProperty(_)) { + return false; + } + } + return true; + } + + function supportsErrorEvent() { + try { + new ErrorEvent(''); // eslint-disable-line no-new + return true; + } catch (e) { + return false; + } + } + + function supportsDOMError() { + try { + new DOMError(''); // eslint-disable-line no-new + return true; + } catch (e) { + return false; + } + } + + function supportsDOMException() { + try { + new DOMException(''); // eslint-disable-line no-new + return true; + } catch (e) { + return false; + } + } + + function supportsFetch() { + if (!('fetch' in _window)) return false; + + try { + new Headers(); // eslint-disable-line no-new + new Request(''); // eslint-disable-line no-new + new Response(); // eslint-disable-line no-new + return true; + } catch (e) { + return false; + } + } + + // Despite all stars in the sky saying that Edge supports old draft syntax, aka 'never', 'always', 'origin' and 'default + // https://caniuse.com/#feat=referrer-policy + // It doesn't. And it throw exception instead of ignoring this parameter... + // REF: https://github.com/getsentry/raven-js/issues/1233 + function supportsReferrerPolicy() { + if (!supportsFetch()) return false; + + try { + // eslint-disable-next-line no-new + new Request('pickleRick', { + referrerPolicy: 'origin' + }); + return true; + } catch (e) { + return false; + } + } + + function supportsPromiseRejectionEvent() { + return typeof PromiseRejectionEvent === 'function'; + } + + function wrappedCallback(callback) { + function dataCallback(data, original) { + var normalizedData = callback(data) || data; + if (original) { + return original(normalizedData) || normalizedData; + } + return normalizedData; + } + + return dataCallback; + } + + function each(obj, callback) { + var i, j; + + if (isUndefined(obj.length)) { + for (i in obj) { + if (hasKey(obj, i)) { + callback.call(null, i, obj[i]); + } + } + } else { + j = obj.length; + if (j) { + for (i = 0; i < j; i++) { + callback.call(null, i, obj[i]); + } + } + } + } + + function objectMerge(obj1, obj2) { + if (!obj2) { + return obj1; + } + each(obj2, function(key, value) { + obj1[key] = value; + }); + return obj1; + } + + /** + * This function is only used for react-native. + * react-native freezes object that have already been sent over the + * js bridge. We need this function in order to check if the object is frozen. + * So it's ok that objectFrozen returns false if Object.isFrozen is not + * supported because it's not relevant for other "platforms". See related issue: + * https://github.com/getsentry/react-native-sentry/issues/57 + */ + function objectFrozen(obj) { + if (!Object.isFrozen) { + return false; + } + return Object.isFrozen(obj); + } + + function truncate(str, max) { + if (typeof max !== 'number') { + throw new Error('2nd argument to `truncate` function should be a number'); + } + if (typeof str !== 'string' || max === 0) { + return str; + } + return str.length <= max ? str : str.substr(0, max) + '\u2026'; + } + + /** + * hasKey, a better form of hasOwnProperty + * Example: hasKey(MainHostObject, property) === true/false + * + * @param {Object} host object to check property + * @param {string} key to check + */ + function hasKey(object, key) { + return Object.prototype.hasOwnProperty.call(object, key); + } + + function joinRegExp(patterns) { + // Combine an array of regular expressions and strings into one large regexp + // Be mad. + var sources = [], + i = 0, + len = patterns.length, + pattern; + + for (; i < len; i++) { + pattern = patterns[i]; + if (isString(pattern)) { + // If it's a string, we need to escape it + // Taken from: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions + sources.push(pattern.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, '\\$1')); + } else if (pattern && pattern.source) { + // If it's a regexp already, we want to extract the source + sources.push(pattern.source); + } + // Intentionally skip other cases + } + return new RegExp(sources.join('|'), 'i'); + } + + function urlencode(o) { + var pairs = []; + each(o, function(key, value) { + pairs.push(encodeURIComponent(key) + '=' + encodeURIComponent(value)); + }); + return pairs.join('&'); + } + + // borrowed from https://tools.ietf.org/html/rfc3986#appendix-B + // intentionally using regex and not href parsing trick because React Native and other + // environments where DOM might not be available + function parseUrl(url) { + if (typeof url !== 'string') return {}; + var match = url.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/); + + // coerce to undefined values to empty string so we don't get 'undefined' + var query = match[6] || ''; + var fragment = match[8] || ''; + return { + protocol: match[2], + host: match[4], + path: match[5], + relative: match[5] + query + fragment // everything minus origin + }; + } + function uuid4() { + var crypto = _window.crypto || _window.msCrypto; + + if (!isUndefined(crypto) && crypto.getRandomValues) { + // Use window.crypto API if available + // eslint-disable-next-line no-undef + var arr = new Uint16Array(8); + crypto.getRandomValues(arr); + + // set 4 in byte 7 + arr[3] = (arr[3] & 0xfff) | 0x4000; + // set 2 most significant bits of byte 9 to '10' + arr[4] = (arr[4] & 0x3fff) | 0x8000; + + var pad = function(num) { + var v = num.toString(16); + while (v.length < 4) { + v = '0' + v; + } + return v; + }; + + return ( + pad(arr[0]) + + pad(arr[1]) + + pad(arr[2]) + + pad(arr[3]) + + pad(arr[4]) + + pad(arr[5]) + + pad(arr[6]) + + pad(arr[7]) + ); + } else { + // http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#2117523 + return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) { + var r = (Math.random() * 16) | 0, + v = c === 'x' ? r : (r & 0x3) | 0x8; + return v.toString(16); + }); + } + } + + /** + * Given a child DOM element, returns a query-selector statement describing that + * and its ancestors + * e.g. [HTMLElement] => body > div > input#foo.btn[name=baz] + * @param elem + * @returns {string} + */ + function htmlTreeAsString(elem) { + /* eslint no-extra-parens:0*/ + var MAX_TRAVERSE_HEIGHT = 5, + MAX_OUTPUT_LEN = 80, + out = [], + height = 0, + len = 0, + separator = ' > ', + sepLength = separator.length, + nextStr; + + while (elem && height++ < MAX_TRAVERSE_HEIGHT) { + nextStr = htmlElementAsString(elem); + // bail out if + // - nextStr is the 'html' element + // - the length of the string that would be created exceeds MAX_OUTPUT_LEN + // (ignore this limit if we are on the first iteration) + if ( + nextStr === 'html' || + (height > 1 && len + out.length * sepLength + nextStr.length >= MAX_OUTPUT_LEN) + ) { + break; + } + + out.push(nextStr); + + len += nextStr.length; + elem = elem.parentNode; + } + + return out.reverse().join(separator); + } + + /** + * Returns a simple, query-selector representation of a DOM element + * e.g. [HTMLElement] => input#foo.btn[name=baz] + * @param HTMLElement + * @returns {string} + */ + function htmlElementAsString(elem) { + var out = [], + className, + classes, + key, + attr, + i; + + if (!elem || !elem.tagName) { + return ''; + } + + out.push(elem.tagName.toLowerCase()); + if (elem.id) { + out.push('#' + elem.id); + } + + className = elem.className; + if (className && isString(className)) { + classes = className.split(/\s+/); + for (i = 0; i < classes.length; i++) { + out.push('.' + classes[i]); + } + } + var attrWhitelist = ['type', 'name', 'title', 'alt']; + for (i = 0; i < attrWhitelist.length; i++) { + key = attrWhitelist[i]; + attr = elem.getAttribute(key); + if (attr) { + out.push('[' + key + '="' + attr + '"]'); + } + } + return out.join(''); + } + + /** + * Returns true if either a OR b is truthy, but not both + */ + function isOnlyOneTruthy(a, b) { + return !!(!!a ^ !!b); + } + + /** + * Returns true if both parameters are undefined + */ + function isBothUndefined(a, b) { + return isUndefined(a) && isUndefined(b); + } + + /** + * Returns true if the two input exception interfaces have the same content + */ + function isSameException(ex1, ex2) { + if (isOnlyOneTruthy(ex1, ex2)) return false; + + ex1 = ex1.values[0]; + ex2 = ex2.values[0]; + + if (ex1.type !== ex2.type || ex1.value !== ex2.value) return false; + + // in case both stacktraces are undefined, we can't decide so default to false + if (isBothUndefined(ex1.stacktrace, ex2.stacktrace)) return false; + + return isSameStacktrace(ex1.stacktrace, ex2.stacktrace); + } + + /** + * Returns true if the two input stack trace interfaces have the same content + */ + function isSameStacktrace(stack1, stack2) { + if (isOnlyOneTruthy(stack1, stack2)) return false; + + var frames1 = stack1.frames; + var frames2 = stack2.frames; + + // Exit early if stacktrace is malformed + if (frames1 === undefined || frames2 === undefined) return false; + + // Exit early if frame count differs + if (frames1.length !== frames2.length) return false; + + // Iterate through every frame; bail out if anything differs + var a, b; + for (var i = 0; i < frames1.length; i++) { + a = frames1[i]; + b = frames2[i]; + if ( + a.filename !== b.filename || + a.lineno !== b.lineno || + a.colno !== b.colno || + a['function'] !== b['function'] + ) + return false; + } + return true; + } + + /** + * Polyfill a method + * @param obj object e.g. `document` + * @param name method name present on object e.g. `addEventListener` + * @param replacement replacement function + * @param track {optional} record instrumentation to an array + */ + function fill(obj, name, replacement, track) { + if (obj == null) return; + var orig = obj[name]; + obj[name] = replacement(orig); + obj[name].__raven__ = true; + obj[name].__orig__ = orig; + if (track) { + track.push([obj, name, orig]); + } + } + + /** + * Join values in array + * @param input array of values to be joined together + * @param delimiter string to be placed in-between values + * @returns {string} + */ + function safeJoin(input, delimiter) { + if (!isArray(input)) return ''; + + var output = []; + + for (var i = 0; i < input.length; i++) { + try { + output.push(String(input[i])); + } catch (e) { + output.push('[value cannot be serialized]'); + } + } + + return output.join(delimiter); + } + + // Default Node.js REPL depth + var MAX_SERIALIZE_EXCEPTION_DEPTH = 3; + // 50kB, as 100kB is max payload size, so half sounds reasonable + var MAX_SERIALIZE_EXCEPTION_SIZE = 50 * 1024; + var MAX_SERIALIZE_KEYS_LENGTH = 40; + + function utf8Length(value) { + return ~-encodeURI(value).split(/%..|./).length; + } + + function jsonSize(value) { + return utf8Length(JSON.stringify(value)); + } + + function serializeValue(value) { + if (typeof value === 'string') { + var maxLength = 40; + return truncate(value, maxLength); + } else if ( + typeof value === 'number' || + typeof value === 'boolean' || + typeof value === 'undefined' + ) { + return value; + } + + var type = Object.prototype.toString.call(value); + + // Node.js REPL notation + if (type === '[object Object]') return '[Object]'; + if (type === '[object Array]') return '[Array]'; + if (type === '[object Function]') + return value.name ? '[Function: ' + value.name + ']' : '[Function]'; + + return value; + } + + function serializeObject(value, depth) { + if (depth === 0) return serializeValue(value); + + if (isPlainObject(value)) { + return Object.keys(value).reduce(function(acc, key) { + acc[key] = serializeObject(value[key], depth - 1); + return acc; + }, {}); + } else if (Array.isArray(value)) { + return value.map(function(val) { + return serializeObject(val, depth - 1); + }); + } + + return serializeValue(value); + } + + function serializeException(ex, depth, maxSize) { + if (!isPlainObject(ex)) return ex; + + depth = typeof depth !== 'number' ? MAX_SERIALIZE_EXCEPTION_DEPTH : depth; + maxSize = typeof depth !== 'number' ? MAX_SERIALIZE_EXCEPTION_SIZE : maxSize; + + var serialized = serializeObject(ex, depth); + + if (jsonSize(stringify_1(serialized)) > maxSize) { + return serializeException(ex, depth - 1); + } + + return serialized; + } + + function serializeKeysForMessage(keys, maxLength) { + if (typeof keys === 'number' || typeof keys === 'string') return keys.toString(); + if (!Array.isArray(keys)) return ''; + + keys = keys.filter(function(key) { + return typeof key === 'string'; + }); + if (keys.length === 0) return '[object has no keys]'; + + maxLength = typeof maxLength !== 'number' ? MAX_SERIALIZE_KEYS_LENGTH : maxLength; + if (keys[0].length >= maxLength) return keys[0]; + + for (var usedKeys = keys.length; usedKeys > 0; usedKeys--) { + var serialized = keys.slice(0, usedKeys).join(', '); + if (serialized.length > maxLength) continue; + if (usedKeys === keys.length) return serialized; + return serialized + '\u2026'; + } + + return ''; + } + + function sanitize(input, sanitizeKeys) { + if (!isArray(sanitizeKeys) || (isArray(sanitizeKeys) && sanitizeKeys.length === 0)) + return input; + + var sanitizeRegExp = joinRegExp(sanitizeKeys); + var sanitizeMask = '********'; + var safeInput; + + try { + safeInput = JSON.parse(stringify_1(input)); + } catch (o_O) { + return input; + } + + function sanitizeWorker(workerInput) { + if (isArray(workerInput)) { + return workerInput.map(function(val) { + return sanitizeWorker(val); + }); + } + + if (isPlainObject(workerInput)) { + return Object.keys(workerInput).reduce(function(acc, k) { + if (sanitizeRegExp.test(k)) { + acc[k] = sanitizeMask; + } else { + acc[k] = sanitizeWorker(workerInput[k]); + } + return acc; + }, {}); + } + + return workerInput; + } + + return sanitizeWorker(safeInput); + } + + var utils = { + isObject: isObject, + isError: isError, + isErrorEvent: isErrorEvent, + isDOMError: isDOMError, + isDOMException: isDOMException, + isUndefined: isUndefined, + isFunction: isFunction, + isPlainObject: isPlainObject, + isString: isString, + isArray: isArray, + isEmptyObject: isEmptyObject, + supportsErrorEvent: supportsErrorEvent, + supportsDOMError: supportsDOMError, + supportsDOMException: supportsDOMException, + supportsFetch: supportsFetch, + supportsReferrerPolicy: supportsReferrerPolicy, + supportsPromiseRejectionEvent: supportsPromiseRejectionEvent, + wrappedCallback: wrappedCallback, + each: each, + objectMerge: objectMerge, + truncate: truncate, + objectFrozen: objectFrozen, + hasKey: hasKey, + joinRegExp: joinRegExp, + urlencode: urlencode, + uuid4: uuid4, + htmlTreeAsString: htmlTreeAsString, + htmlElementAsString: htmlElementAsString, + isSameException: isSameException, + isSameStacktrace: isSameStacktrace, + parseUrl: parseUrl, + fill: fill, + safeJoin: safeJoin, + serializeException: serializeException, + serializeKeysForMessage: serializeKeysForMessage, + sanitize: sanitize + }; + + /* + TraceKit - Cross brower stack traces + + This was originally forked from github.com/occ/TraceKit, but has since been + largely re-written and is now maintained as part of raven-js. Tests for + this are in test/vendor. + + MIT license + */ + + var TraceKit = { + collectWindowErrors: true, + debug: false + }; + + // This is to be defensive in environments where window does not exist (see https://github.com/getsentry/raven-js/pull/785) + var _window$1 = + typeof window !== 'undefined' + ? window + : typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : typeof self !== 'undefined' ? self : {}; + + // global reference to slice + var _slice = [].slice; + var UNKNOWN_FUNCTION = '?'; + + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Error_types + var ERROR_TYPES_RE = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/; + + function getLocationHref() { + if (typeof document === 'undefined' || document.location == null) return ''; + return document.location.href; + } + + function getLocationOrigin() { + if (typeof document === 'undefined' || document.location == null) return ''; + + // Oh dear IE10... + if (!document.location.origin) { + return ( + document.location.protocol + + '//' + + document.location.hostname + + (document.location.port ? ':' + document.location.port : '') + ); + } + + return document.location.origin; + } + + /** + * TraceKit.report: cross-browser processing of unhandled exceptions + * + * Syntax: + * TraceKit.report.subscribe(function(stackInfo) { ... }) + * TraceKit.report.unsubscribe(function(stackInfo) { ... }) + * TraceKit.report(exception) + * try { ...code... } catch(ex) { TraceKit.report(ex); } + * + * Supports: + * - Firefox: full stack trace with line numbers, plus column number + * on top frame; column number is not guaranteed + * - Opera: full stack trace with line and column numbers + * - Chrome: full stack trace with line and column numbers + * - Safari: line and column number for the top frame only; some frames + * may be missing, and column number is not guaranteed + * - IE: line and column number for the top frame only; some frames + * may be missing, and column number is not guaranteed + * + * In theory, TraceKit should work on all of the following versions: + * - IE5.5+ (only 8.0 tested) + * - Firefox 0.9+ (only 3.5+ tested) + * - Opera 7+ (only 10.50 tested; versions 9 and earlier may require + * Exceptions Have Stacktrace to be enabled in opera:config) + * - Safari 3+ (only 4+ tested) + * - Chrome 1+ (only 5+ tested) + * - Konqueror 3.5+ (untested) + * + * Requires TraceKit.computeStackTrace. + * + * Tries to catch all unhandled exceptions and report them to the + * subscribed handlers. Please note that TraceKit.report will rethrow the + * exception. This is REQUIRED in order to get a useful stack trace in IE. + * If the exception does not reach the top of the browser, you will only + * get a stack trace from the point where TraceKit.report was called. + * + * Handlers receive a stackInfo object as described in the + * TraceKit.computeStackTrace docs. + */ + TraceKit.report = (function reportModuleWrapper() { + var handlers = [], + lastArgs = null, + lastException = null, + lastExceptionStack = null; + + /** + * Add a crash handler. + * @param {Function} handler + */ + function subscribe(handler) { + installGlobalHandler(); + handlers.push(handler); + } + + /** + * Remove a crash handler. + * @param {Function} handler + */ + function unsubscribe(handler) { + for (var i = handlers.length - 1; i >= 0; --i) { + if (handlers[i] === handler) { + handlers.splice(i, 1); + } + } + } + + /** + * Remove all crash handlers. + */ + function unsubscribeAll() { + uninstallGlobalHandler(); + handlers = []; + } + + /** + * Dispatch stack information to all handlers. + * @param {Object.} stack + */ + function notifyHandlers(stack, isWindowError) { + var exception = null; + if (isWindowError && !TraceKit.collectWindowErrors) { + return; + } + for (var i in handlers) { + if (handlers.hasOwnProperty(i)) { + try { + handlers[i].apply(null, [stack].concat(_slice.call(arguments, 2))); + } catch (inner) { + exception = inner; + } + } + } + + if (exception) { + throw exception; + } + } + + var _oldOnerrorHandler, _onErrorHandlerInstalled; + + /** + * Ensures all global unhandled exceptions are recorded. + * Supported by Gecko and IE. + * @param {string} msg Error message. + * @param {string} url URL of script that generated the exception. + * @param {(number|string)} lineNo The line number at which the error + * occurred. + * @param {?(number|string)} colNo The column number at which the error + * occurred. + * @param {?Error} ex The actual Error object. + */ + function traceKitWindowOnError(msg, url, lineNo, colNo, ex) { + var stack = null; + // If 'ex' is ErrorEvent, get real Error from inside + var exception = utils.isErrorEvent(ex) ? ex.error : ex; + // If 'msg' is ErrorEvent, get real message from inside + var message = utils.isErrorEvent(msg) ? msg.message : msg; + + if (lastExceptionStack) { + TraceKit.computeStackTrace.augmentStackTraceWithInitialElement( + lastExceptionStack, + url, + lineNo, + message + ); + processLastException(); + } else if (exception && utils.isError(exception)) { + // non-string `exception` arg; attempt to extract stack trace + + // New chrome and blink send along a real error object + // Let's just report that like a normal error. + // See: https://mikewest.org/2013/08/debugging-runtime-errors-with-window-onerror + stack = TraceKit.computeStackTrace(exception); + notifyHandlers(stack, true); + } else { + var location = { + url: url, + line: lineNo, + column: colNo + }; + + var name = undefined; + var groups; + + if ({}.toString.call(message) === '[object String]') { + var groups = message.match(ERROR_TYPES_RE); + if (groups) { + name = groups[1]; + message = groups[2]; + } + } + + location.func = UNKNOWN_FUNCTION; + + stack = { + name: name, + message: message, + url: getLocationHref(), + stack: [location] + }; + notifyHandlers(stack, true); + } + + if (_oldOnerrorHandler) { + return _oldOnerrorHandler.apply(this, arguments); + } + + return false; + } + + function installGlobalHandler() { + if (_onErrorHandlerInstalled) { + return; + } + _oldOnerrorHandler = _window$1.onerror; + _window$1.onerror = traceKitWindowOnError; + _onErrorHandlerInstalled = true; + } + + function uninstallGlobalHandler() { + if (!_onErrorHandlerInstalled) { + return; + } + _window$1.onerror = _oldOnerrorHandler; + _onErrorHandlerInstalled = false; + _oldOnerrorHandler = undefined; + } + + function processLastException() { + var _lastExceptionStack = lastExceptionStack, + _lastArgs = lastArgs; + lastArgs = null; + lastExceptionStack = null; + lastException = null; + notifyHandlers.apply(null, [_lastExceptionStack, false].concat(_lastArgs)); + } + + /** + * Reports an unhandled Error to TraceKit. + * @param {Error} ex + * @param {?boolean} rethrow If false, do not re-throw the exception. + * Only used for window.onerror to not cause an infinite loop of + * rethrowing. + */ + function report(ex, rethrow) { + var args = _slice.call(arguments, 1); + if (lastExceptionStack) { + if (lastException === ex) { + return; // already caught by an inner catch block, ignore + } else { + processLastException(); + } + } + + var stack = TraceKit.computeStackTrace(ex); + lastExceptionStack = stack; + lastException = ex; + lastArgs = args; + + // If the stack trace is incomplete, wait for 2 seconds for + // slow slow IE to see if onerror occurs or not before reporting + // this exception; otherwise, we will end up with an incomplete + // stack trace + setTimeout(function() { + if (lastException === ex) { + processLastException(); + } + }, stack.incomplete ? 2000 : 0); + + if (rethrow !== false) { + throw ex; // re-throw to propagate to the top level (and cause window.onerror) + } + } + + report.subscribe = subscribe; + report.unsubscribe = unsubscribe; + report.uninstall = unsubscribeAll; + return report; + })(); + + /** + * TraceKit.computeStackTrace: cross-browser stack traces in JavaScript + * + * Syntax: + * s = TraceKit.computeStackTrace(exception) // consider using TraceKit.report instead (see below) + * Returns: + * s.name - exception name + * s.message - exception message + * s.stack[i].url - JavaScript or HTML file URL + * s.stack[i].func - function name, or empty for anonymous functions (if guessing did not work) + * s.stack[i].args - arguments passed to the function, if known + * s.stack[i].line - line number, if known + * s.stack[i].column - column number, if known + * + * Supports: + * - Firefox: full stack trace with line numbers and unreliable column + * number on top frame + * - Opera 10: full stack trace with line and column numbers + * - Opera 9-: full stack trace with line numbers + * - Chrome: full stack trace with line and column numbers + * - Safari: line and column number for the topmost stacktrace element + * only + * - IE: no line numbers whatsoever + * + * Tries to guess names of anonymous functions by looking for assignments + * in the source code. In IE and Safari, we have to guess source file names + * by searching for function bodies inside all page scripts. This will not + * work for scripts that are loaded cross-domain. + * Here be dragons: some function names may be guessed incorrectly, and + * duplicate functions may be mismatched. + * + * TraceKit.computeStackTrace should only be used for tracing purposes. + * Logging of unhandled exceptions should be done with TraceKit.report, + * which builds on top of TraceKit.computeStackTrace and provides better + * IE support by utilizing the window.onerror event to retrieve information + * about the top of the stack. + * + * Note: In IE and Safari, no stack trace is recorded on the Error object, + * so computeStackTrace instead walks its *own* chain of callers. + * This means that: + * * in Safari, some methods may be missing from the stack trace; + * * in IE, the topmost function in the stack trace will always be the + * caller of computeStackTrace. + * + * This is okay for tracing (because you are likely to be calling + * computeStackTrace from the function you want to be the topmost element + * of the stack trace anyway), but not okay for logging unhandled + * exceptions (because your catch block will likely be far away from the + * inner function that actually caused the exception). + * + */ + TraceKit.computeStackTrace = (function computeStackTraceWrapper() { + // Contents of Exception in various browsers. + // + // SAFARI: + // ex.message = Can't find variable: qq + // ex.line = 59 + // ex.sourceId = 580238192 + // ex.sourceURL = http://... + // ex.expressionBeginOffset = 96 + // ex.expressionCaretOffset = 98 + // ex.expressionEndOffset = 98 + // ex.name = ReferenceError + // + // FIREFOX: + // ex.message = qq is not defined + // ex.fileName = http://... + // ex.lineNumber = 59 + // ex.columnNumber = 69 + // ex.stack = ...stack trace... (see the example below) + // ex.name = ReferenceError + // + // CHROME: + // ex.message = qq is not defined + // ex.name = ReferenceError + // ex.type = not_defined + // ex.arguments = ['aa'] + // ex.stack = ...stack trace... + // + // INTERNET EXPLORER: + // ex.message = ... + // ex.name = ReferenceError + // + // OPERA: + // ex.message = ...message... (see the example below) + // ex.name = ReferenceError + // ex.opera#sourceloc = 11 (pretty much useless, duplicates the info in ex.message) + // ex.stacktrace = n/a; see 'opera:config#UserPrefs|Exceptions Have Stacktrace' + + /** + * Computes stack trace information from the stack property. + * Chrome and Gecko use this property. + * @param {Error} ex + * @return {?Object.} Stack trace information. + */ + function computeStackTraceFromStackProp(ex) { + if (typeof ex.stack === 'undefined' || !ex.stack) return; + + var chrome = /^\s*at (?:(.*?) ?\()?((?:file|https?|blob|chrome-extension|native|eval|webpack||[a-z]:|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i; + var winjs = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx(?:-web)|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i; + // NOTE: blob urls are now supposed to always have an origin, therefore it's format + // which is `blob:http://url/path/with-some-uuid`, is matched by `blob.*?:\/` as well + var gecko = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|moz-extension).*?:\/.*?|\[native code\]|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i; + // Used to additionally parse URL/line/column from eval frames + var geckoEval = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i; + var chromeEval = /\((\S*)(?::(\d+))(?::(\d+))\)/; + var lines = ex.stack.split('\n'); + var stack = []; + var submatch; + var parts; + var element; + var reference = /^(.*) is undefined$/.exec(ex.message); + + for (var i = 0, j = lines.length; i < j; ++i) { + if ((parts = chrome.exec(lines[i]))) { + var isNative = parts[2] && parts[2].indexOf('native') === 0; // start of line + var isEval = parts[2] && parts[2].indexOf('eval') === 0; // start of line + if (isEval && (submatch = chromeEval.exec(parts[2]))) { + // throw out eval line/column and use top-most line/column number + parts[2] = submatch[1]; // url + parts[3] = submatch[2]; // line + parts[4] = submatch[3]; // column + } + element = { + url: !isNative ? parts[2] : null, + func: parts[1] || UNKNOWN_FUNCTION, + args: isNative ? [parts[2]] : [], + line: parts[3] ? +parts[3] : null, + column: parts[4] ? +parts[4] : null + }; + } else if ((parts = winjs.exec(lines[i]))) { + element = { + url: parts[2], + func: parts[1] || UNKNOWN_FUNCTION, + args: [], + line: +parts[3], + column: parts[4] ? +parts[4] : null + }; + } else if ((parts = gecko.exec(lines[i]))) { + var isEval = parts[3] && parts[3].indexOf(' > eval') > -1; + if (isEval && (submatch = geckoEval.exec(parts[3]))) { + // throw out eval line/column and use top-most line number + parts[3] = submatch[1]; + parts[4] = submatch[2]; + parts[5] = null; // no column when eval + } else if (i === 0 && !parts[5] && typeof ex.columnNumber !== 'undefined') { + // FireFox uses this awesome columnNumber property for its top frame + // Also note, Firefox's column number is 0-based and everything else expects 1-based, + // so adding 1 + // NOTE: this hack doesn't work if top-most frame is eval + stack[0].column = ex.columnNumber + 1; + } + element = { + url: parts[3], + func: parts[1] || UNKNOWN_FUNCTION, + args: parts[2] ? parts[2].split(',') : [], + line: parts[4] ? +parts[4] : null, + column: parts[5] ? +parts[5] : null + }; + } else { + continue; + } + + if (!element.func && element.line) { + element.func = UNKNOWN_FUNCTION; + } + + if (element.url && element.url.substr(0, 5) === 'blob:') { + // Special case for handling JavaScript loaded into a blob. + // We use a synchronous AJAX request here as a blob is already in + // memory - it's not making a network request. This will generate a warning + // in the browser console, but there has already been an error so that's not + // that much of an issue. + var xhr = new XMLHttpRequest(); + xhr.open('GET', element.url, false); + xhr.send(null); + + // If we failed to download the source, skip this patch + if (xhr.status === 200) { + var source = xhr.responseText || ''; + + // We trim the source down to the last 300 characters as sourceMappingURL is always at the end of the file. + // Why 300? To be in line with: https://github.com/getsentry/sentry/blob/4af29e8f2350e20c28a6933354e4f42437b4ba42/src/sentry/lang/javascript/processor.py#L164-L175 + source = source.slice(-300); + + // Now we dig out the source map URL + var sourceMaps = source.match(/\/\/# sourceMappingURL=(.*)$/); + + // If we don't find a source map comment or we find more than one, continue on to the next element. + if (sourceMaps) { + var sourceMapAddress = sourceMaps[1]; + + // Now we check to see if it's a relative URL. + // If it is, convert it to an absolute one. + if (sourceMapAddress.charAt(0) === '~') { + sourceMapAddress = getLocationOrigin() + sourceMapAddress.slice(1); + } + + // Now we strip the '.map' off of the end of the URL and update the + // element so that Sentry can match the map to the blob. + element.url = sourceMapAddress.slice(0, -4); + } + } + } + + stack.push(element); + } + + if (!stack.length) { + return null; + } + + return { + name: ex.name, + message: ex.message, + url: getLocationHref(), + stack: stack + }; + } + + /** + * Adds information about the first frame to incomplete stack traces. + * Safari and IE require this to get complete data on the first frame. + * @param {Object.} stackInfo Stack trace information from + * one of the compute* methods. + * @param {string} url The URL of the script that caused an error. + * @param {(number|string)} lineNo The line number of the script that + * caused an error. + * @param {string=} message The error generated by the browser, which + * hopefully contains the name of the object that caused the error. + * @return {boolean} Whether or not the stack information was + * augmented. + */ + function augmentStackTraceWithInitialElement(stackInfo, url, lineNo, message) { + var initial = { + url: url, + line: lineNo + }; + + if (initial.url && initial.line) { + stackInfo.incomplete = false; + + if (!initial.func) { + initial.func = UNKNOWN_FUNCTION; + } + + if (stackInfo.stack.length > 0) { + if (stackInfo.stack[0].url === initial.url) { + if (stackInfo.stack[0].line === initial.line) { + return false; // already in stack trace + } else if ( + !stackInfo.stack[0].line && + stackInfo.stack[0].func === initial.func + ) { + stackInfo.stack[0].line = initial.line; + return false; + } + } + } + + stackInfo.stack.unshift(initial); + stackInfo.partial = true; + return true; + } else { + stackInfo.incomplete = true; + } + + return false; + } + + /** + * Computes stack trace information by walking the arguments.caller + * chain at the time the exception occurred. This will cause earlier + * frames to be missed but is the only way to get any stack trace in + * Safari and IE. The top frame is restored by + * {@link augmentStackTraceWithInitialElement}. + * @param {Error} ex + * @return {?Object.} Stack trace information. + */ + function computeStackTraceByWalkingCallerChain(ex, depth) { + var functionName = /function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i, + stack = [], + funcs = {}, + recursion = false, + parts, + item; + + for ( + var curr = computeStackTraceByWalkingCallerChain.caller; + curr && !recursion; + curr = curr.caller + ) { + if (curr === computeStackTrace || curr === TraceKit.report) { + // console.log('skipping internal function'); + continue; + } + + item = { + url: null, + func: UNKNOWN_FUNCTION, + line: null, + column: null + }; + + if (curr.name) { + item.func = curr.name; + } else if ((parts = functionName.exec(curr.toString()))) { + item.func = parts[1]; + } + + if (typeof item.func === 'undefined') { + try { + item.func = parts.input.substring(0, parts.input.indexOf('{')); + } catch (e) {} + } + + if (funcs['' + curr]) { + recursion = true; + } else { + funcs['' + curr] = true; + } + + stack.push(item); + } + + if (depth) { + // console.log('depth is ' + depth); + // console.log('stack is ' + stack.length); + stack.splice(0, depth); + } + + var result = { + name: ex.name, + message: ex.message, + url: getLocationHref(), + stack: stack + }; + augmentStackTraceWithInitialElement( + result, + ex.sourceURL || ex.fileName, + ex.line || ex.lineNumber, + ex.message || ex.description + ); + return result; + } + + /** + * Computes a stack trace for an exception. + * @param {Error} ex + * @param {(string|number)=} depth + */ + function computeStackTrace(ex, depth) { + var stack = null; + depth = depth == null ? 0 : +depth; + + try { + stack = computeStackTraceFromStackProp(ex); + if (stack) { + return stack; + } + } catch (e) { + if (TraceKit.debug) { + throw e; + } + } + + try { + stack = computeStackTraceByWalkingCallerChain(ex, depth + 1); + if (stack) { + return stack; + } + } catch (e) { + if (TraceKit.debug) { + throw e; + } + } + return { + name: ex.name, + message: ex.message, + url: getLocationHref() + }; + } + + computeStackTrace.augmentStackTraceWithInitialElement = augmentStackTraceWithInitialElement; + computeStackTrace.computeStackTraceFromStackProp = computeStackTraceFromStackProp; + + return computeStackTrace; + })(); + + var tracekit = TraceKit; + + /* + * JavaScript MD5 + * https://github.com/blueimp/JavaScript-MD5 + * + * Copyright 2011, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + * + * Based on + * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message + * Digest Algorithm, as defined in RFC 1321. + * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009 + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * Distributed under the BSD License + * See http://pajhome.org.uk/crypt/md5 for more info. + */ + + /* + * Add integers, wrapping at 2^32. This uses 16-bit operations internally + * to work around bugs in some JS interpreters. + */ + function safeAdd(x, y) { + var lsw = (x & 0xffff) + (y & 0xffff); + var msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return (msw << 16) | (lsw & 0xffff); + } + + /* + * Bitwise rotate a 32-bit number to the left. + */ + function bitRotateLeft(num, cnt) { + return (num << cnt) | (num >>> (32 - cnt)); + } + + /* + * These functions implement the four basic operations the algorithm uses. + */ + function md5cmn(q, a, b, x, s, t) { + return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b); + } + function md5ff(a, b, c, d, x, s, t) { + return md5cmn((b & c) | (~b & d), a, b, x, s, t); + } + function md5gg(a, b, c, d, x, s, t) { + return md5cmn((b & d) | (c & ~d), a, b, x, s, t); + } + function md5hh(a, b, c, d, x, s, t) { + return md5cmn(b ^ c ^ d, a, b, x, s, t); + } + function md5ii(a, b, c, d, x, s, t) { + return md5cmn(c ^ (b | ~d), a, b, x, s, t); + } + + /* + * Calculate the MD5 of an array of little-endian words, and a bit length. + */ + function binlMD5(x, len) { + /* append padding */ + x[len >> 5] |= 0x80 << (len % 32); + x[(((len + 64) >>> 9) << 4) + 14] = len; + + var i; + var olda; + var oldb; + var oldc; + var oldd; + var a = 1732584193; + var b = -271733879; + var c = -1732584194; + var d = 271733878; + + for (i = 0; i < x.length; i += 16) { + olda = a; + oldb = b; + oldc = c; + oldd = d; + + a = md5ff(a, b, c, d, x[i], 7, -680876936); + d = md5ff(d, a, b, c, x[i + 1], 12, -389564586); + c = md5ff(c, d, a, b, x[i + 2], 17, 606105819); + b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330); + a = md5ff(a, b, c, d, x[i + 4], 7, -176418897); + d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426); + c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341); + b = md5ff(b, c, d, a, x[i + 7], 22, -45705983); + a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416); + d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417); + c = md5ff(c, d, a, b, x[i + 10], 17, -42063); + b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162); + a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682); + d = md5ff(d, a, b, c, x[i + 13], 12, -40341101); + c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290); + b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329); + + a = md5gg(a, b, c, d, x[i + 1], 5, -165796510); + d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632); + c = md5gg(c, d, a, b, x[i + 11], 14, 643717713); + b = md5gg(b, c, d, a, x[i], 20, -373897302); + a = md5gg(a, b, c, d, x[i + 5], 5, -701558691); + d = md5gg(d, a, b, c, x[i + 10], 9, 38016083); + c = md5gg(c, d, a, b, x[i + 15], 14, -660478335); + b = md5gg(b, c, d, a, x[i + 4], 20, -405537848); + a = md5gg(a, b, c, d, x[i + 9], 5, 568446438); + d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690); + c = md5gg(c, d, a, b, x[i + 3], 14, -187363961); + b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501); + a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467); + d = md5gg(d, a, b, c, x[i + 2], 9, -51403784); + c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473); + b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734); + + a = md5hh(a, b, c, d, x[i + 5], 4, -378558); + d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463); + c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562); + b = md5hh(b, c, d, a, x[i + 14], 23, -35309556); + a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060); + d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353); + c = md5hh(c, d, a, b, x[i + 7], 16, -155497632); + b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640); + a = md5hh(a, b, c, d, x[i + 13], 4, 681279174); + d = md5hh(d, a, b, c, x[i], 11, -358537222); + c = md5hh(c, d, a, b, x[i + 3], 16, -722521979); + b = md5hh(b, c, d, a, x[i + 6], 23, 76029189); + a = md5hh(a, b, c, d, x[i + 9], 4, -640364487); + d = md5hh(d, a, b, c, x[i + 12], 11, -421815835); + c = md5hh(c, d, a, b, x[i + 15], 16, 530742520); + b = md5hh(b, c, d, a, x[i + 2], 23, -995338651); + + a = md5ii(a, b, c, d, x[i], 6, -198630844); + d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415); + c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905); + b = md5ii(b, c, d, a, x[i + 5], 21, -57434055); + a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571); + d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606); + c = md5ii(c, d, a, b, x[i + 10], 15, -1051523); + b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799); + a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359); + d = md5ii(d, a, b, c, x[i + 15], 10, -30611744); + c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380); + b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649); + a = md5ii(a, b, c, d, x[i + 4], 6, -145523070); + d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379); + c = md5ii(c, d, a, b, x[i + 2], 15, 718787259); + b = md5ii(b, c, d, a, x[i + 9], 21, -343485551); + + a = safeAdd(a, olda); + b = safeAdd(b, oldb); + c = safeAdd(c, oldc); + d = safeAdd(d, oldd); + } + return [a, b, c, d]; + } + + /* + * Convert an array of little-endian words to a string + */ + function binl2rstr(input) { + var i; + var output = ''; + var length32 = input.length * 32; + for (i = 0; i < length32; i += 8) { + output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xff); + } + return output; + } + + /* + * Convert a raw string to an array of little-endian words + * Characters >255 have their high-byte silently ignored. + */ + function rstr2binl(input) { + var i; + var output = []; + output[(input.length >> 2) - 1] = undefined; + for (i = 0; i < output.length; i += 1) { + output[i] = 0; + } + var length8 = input.length * 8; + for (i = 0; i < length8; i += 8) { + output[i >> 5] |= (input.charCodeAt(i / 8) & 0xff) << (i % 32); + } + return output; + } + + /* + * Calculate the MD5 of a raw string + */ + function rstrMD5(s) { + return binl2rstr(binlMD5(rstr2binl(s), s.length * 8)); + } + + /* + * Calculate the HMAC-MD5, of a key and some data (raw strings) + */ + function rstrHMACMD5(key, data) { + var i; + var bkey = rstr2binl(key); + var ipad = []; + var opad = []; + var hash; + ipad[15] = opad[15] = undefined; + if (bkey.length > 16) { + bkey = binlMD5(bkey, key.length * 8); + } + for (i = 0; i < 16; i += 1) { + ipad[i] = bkey[i] ^ 0x36363636; + opad[i] = bkey[i] ^ 0x5c5c5c5c; + } + hash = binlMD5(ipad.concat(rstr2binl(data)), 512 + data.length * 8); + return binl2rstr(binlMD5(opad.concat(hash), 512 + 128)); + } + + /* + * Convert a raw string to a hex string + */ + function rstr2hex(input) { + var hexTab = '0123456789abcdef'; + var output = ''; + var x; + var i; + for (i = 0; i < input.length; i += 1) { + x = input.charCodeAt(i); + output += hexTab.charAt((x >>> 4) & 0x0f) + hexTab.charAt(x & 0x0f); + } + return output; + } + + /* + * Encode a string as utf-8 + */ + function str2rstrUTF8(input) { + return unescape(encodeURIComponent(input)); + } + + /* + * Take string arguments and return either raw or hex encoded strings + */ + function rawMD5(s) { + return rstrMD5(str2rstrUTF8(s)); + } + function hexMD5(s) { + return rstr2hex(rawMD5(s)); + } + function rawHMACMD5(k, d) { + return rstrHMACMD5(str2rstrUTF8(k), str2rstrUTF8(d)); + } + function hexHMACMD5(k, d) { + return rstr2hex(rawHMACMD5(k, d)); + } + + function md5(string, key, raw) { + if (!key) { + if (!raw) { + return hexMD5(string); + } + return rawMD5(string); + } + if (!raw) { + return hexHMACMD5(key, string); + } + return rawHMACMD5(key, string); + } + + var md5_1 = md5; + + function RavenConfigError(message) { + this.name = 'RavenConfigError'; + this.message = message; + } + RavenConfigError.prototype = new Error(); + RavenConfigError.prototype.constructor = RavenConfigError; + + var configError = RavenConfigError; + + var wrapMethod = function(console, level, callback) { + var originalConsoleLevel = console[level]; + var originalConsole = console; + + if (!(level in console)) { + return; + } + + var sentryLevel = level === 'warn' ? 'warning' : level; + + console[level] = function() { + var args = [].slice.call(arguments); + + var msg = utils.safeJoin(args, ' '); + var data = {level: sentryLevel, logger: 'console', extra: {arguments: args}}; + + if (level === 'assert') { + if (args[0] === false) { + // Default browsers message + msg = + 'Assertion failed: ' + (utils.safeJoin(args.slice(1), ' ') || 'console.assert'); + data.extra.arguments = args.slice(1); + callback && callback(msg, data); + } + } else { + callback && callback(msg, data); + } + + // this fails for some browsers. :( + if (originalConsoleLevel) { + // IE9 doesn't allow calling apply on console functions directly + // See: https://stackoverflow.com/questions/5472938/does-ie9-support-console-log-and-is-it-a-real-function#answer-5473193 + Function.prototype.apply.call(originalConsoleLevel, originalConsole, args); + } + }; + }; + + var console$1 = { + wrapMethod: wrapMethod + }; + + /*global XDomainRequest:false */ + + + + + + + + var isErrorEvent$1 = utils.isErrorEvent; + var isDOMError$1 = utils.isDOMError; + var isDOMException$1 = utils.isDOMException; + var isError$1 = utils.isError; + var isObject$1 = utils.isObject; + var isPlainObject$1 = utils.isPlainObject; + var isUndefined$1 = utils.isUndefined; + var isFunction$1 = utils.isFunction; + var isString$1 = utils.isString; + var isArray$1 = utils.isArray; + var isEmptyObject$1 = utils.isEmptyObject; + var each$1 = utils.each; + var objectMerge$1 = utils.objectMerge; + var truncate$1 = utils.truncate; + var objectFrozen$1 = utils.objectFrozen; + var hasKey$1 = utils.hasKey; + var joinRegExp$1 = utils.joinRegExp; + var urlencode$1 = utils.urlencode; + var uuid4$1 = utils.uuid4; + var htmlTreeAsString$1 = utils.htmlTreeAsString; + var isSameException$1 = utils.isSameException; + var isSameStacktrace$1 = utils.isSameStacktrace; + var parseUrl$1 = utils.parseUrl; + var fill$1 = utils.fill; + var supportsFetch$1 = utils.supportsFetch; + var supportsReferrerPolicy$1 = utils.supportsReferrerPolicy; + var serializeKeysForMessage$1 = utils.serializeKeysForMessage; + var serializeException$1 = utils.serializeException; + var sanitize$1 = utils.sanitize; + + var wrapConsoleMethod = console$1.wrapMethod; + + var dsnKeys = 'source protocol user pass host port path'.split(' '), + dsnPattern = /^(?:(\w+):)?\/\/(?:(\w+)(:\w+)?@)?([\w\.-]+)(?::(\d+))?(\/.*)/; + + function now() { + return +new Date(); + } + + // This is to be defensive in environments where window does not exist (see https://github.com/getsentry/raven-js/pull/785) + var _window$2 = + typeof window !== 'undefined' + ? window + : typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : typeof self !== 'undefined' ? self : {}; + var _document = _window$2.document; + var _navigator = _window$2.navigator; + + function keepOriginalCallback(original, callback) { + return isFunction$1(callback) + ? function(data) { + return callback(data, original); + } + : callback; + } + + // First, check for JSON support + // If there is no JSON, we no-op the core features of Raven + // since JSON is required to encode the payload + function Raven() { + this._hasJSON = !!(typeof JSON === 'object' && JSON.stringify); + // Raven can run in contexts where there's no document (react-native) + this._hasDocument = !isUndefined$1(_document); + this._hasNavigator = !isUndefined$1(_navigator); + this._lastCapturedException = null; + this._lastData = null; + this._lastEventId = null; + this._globalServer = null; + this._globalKey = null; + this._globalProject = null; + this._globalContext = {}; + this._globalOptions = { + // SENTRY_RELEASE can be injected by https://github.com/getsentry/sentry-webpack-plugin + release: _window$2.SENTRY_RELEASE && _window$2.SENTRY_RELEASE.id, + logger: 'javascript', + ignoreErrors: [], + ignoreUrls: [], + whitelistUrls: [], + includePaths: [], + headers: null, + collectWindowErrors: true, + captureUnhandledRejections: true, + maxMessageLength: 0, + // By default, truncates URL values to 250 chars + maxUrlLength: 250, + stackTraceLimit: 50, + autoBreadcrumbs: true, + instrument: true, + sampleRate: 1, + sanitizeKeys: [] + }; + this._fetchDefaults = { + method: 'POST', + keepalive: true, + // Despite all stars in the sky saying that Edge supports old draft syntax, aka 'never', 'always', 'origin' and 'default + // https://caniuse.com/#feat=referrer-policy + // It doesn't. And it throw exception instead of ignoring this parameter... + // REF: https://github.com/getsentry/raven-js/issues/1233 + referrerPolicy: supportsReferrerPolicy$1() ? 'origin' : '' + }; + this._ignoreOnError = 0; + this._isRavenInstalled = false; + this._originalErrorStackTraceLimit = Error.stackTraceLimit; + // capture references to window.console *and* all its methods first + // before the console plugin has a chance to monkey patch + this._originalConsole = _window$2.console || {}; + this._originalConsoleMethods = {}; + this._plugins = []; + this._startTime = now(); + this._wrappedBuiltIns = []; + this._breadcrumbs = []; + this._lastCapturedEvent = null; + this._keypressTimeout; + this._location = _window$2.location; + this._lastHref = this._location && this._location.href; + this._resetBackoff(); + + // eslint-disable-next-line guard-for-in + for (var method in this._originalConsole) { + this._originalConsoleMethods[method] = this._originalConsole[method]; + } + } + + /* + * The core Raven singleton + * + * @this {Raven} + */ + + Raven.prototype = { + // Hardcode version string so that raven source can be loaded directly via + // webpack (using a build step causes webpack #1617). Grunt verifies that + // this value matches package.json during build. + // See: https://github.com/getsentry/raven-js/issues/465 + VERSION: '3.26.4', + + debug: false, + + TraceKit: tracekit, // alias to TraceKit + + /* + * Configure Raven with a DSN and extra options + * + * @param {string} dsn The public Sentry DSN + * @param {object} options Set of global options [optional] + * @return {Raven} + */ + config: function(dsn, options) { + var self = this; + + if (self._globalServer) { + this._logDebug('error', 'Error: Raven has already been configured'); + return self; + } + if (!dsn) return self; + + var globalOptions = self._globalOptions; + + // merge in options + if (options) { + each$1(options, function(key, value) { + // tags and extra are special and need to be put into context + if (key === 'tags' || key === 'extra' || key === 'user') { + self._globalContext[key] = value; + } else { + globalOptions[key] = value; + } + }); + } + + self.setDSN(dsn); + + // "Script error." is hard coded into browsers for errors that it can't read. + // this is the result of a script being pulled in from an external domain and CORS. + globalOptions.ignoreErrors.push(/^Script error\.?$/); + globalOptions.ignoreErrors.push(/^Javascript error: Script error\.? on line 0$/); + + // join regexp rules into one big rule + globalOptions.ignoreErrors = joinRegExp$1(globalOptions.ignoreErrors); + globalOptions.ignoreUrls = globalOptions.ignoreUrls.length + ? joinRegExp$1(globalOptions.ignoreUrls) + : false; + globalOptions.whitelistUrls = globalOptions.whitelistUrls.length + ? joinRegExp$1(globalOptions.whitelistUrls) + : false; + globalOptions.includePaths = joinRegExp$1(globalOptions.includePaths); + globalOptions.maxBreadcrumbs = Math.max( + 0, + Math.min(globalOptions.maxBreadcrumbs || 100, 100) + ); // default and hard limit is 100 + + var autoBreadcrumbDefaults = { + xhr: true, + console: true, + dom: true, + location: true, + sentry: true + }; + + var autoBreadcrumbs = globalOptions.autoBreadcrumbs; + if ({}.toString.call(autoBreadcrumbs) === '[object Object]') { + autoBreadcrumbs = objectMerge$1(autoBreadcrumbDefaults, autoBreadcrumbs); + } else if (autoBreadcrumbs !== false) { + autoBreadcrumbs = autoBreadcrumbDefaults; + } + globalOptions.autoBreadcrumbs = autoBreadcrumbs; + + var instrumentDefaults = { + tryCatch: true + }; + + var instrument = globalOptions.instrument; + if ({}.toString.call(instrument) === '[object Object]') { + instrument = objectMerge$1(instrumentDefaults, instrument); + } else if (instrument !== false) { + instrument = instrumentDefaults; + } + globalOptions.instrument = instrument; + + tracekit.collectWindowErrors = !!globalOptions.collectWindowErrors; + + // return for chaining + return self; + }, + + /* + * Installs a global window.onerror error handler + * to capture and report uncaught exceptions. + * At this point, install() is required to be called due + * to the way TraceKit is set up. + * + * @return {Raven} + */ + install: function() { + var self = this; + if (self.isSetup() && !self._isRavenInstalled) { + tracekit.report.subscribe(function() { + self._handleOnErrorStackInfo.apply(self, arguments); + }); + + if (self._globalOptions.captureUnhandledRejections) { + self._attachPromiseRejectionHandler(); + } + + self._patchFunctionToString(); + + if (self._globalOptions.instrument && self._globalOptions.instrument.tryCatch) { + self._instrumentTryCatch(); + } + + if (self._globalOptions.autoBreadcrumbs) self._instrumentBreadcrumbs(); + + // Install all of the plugins + self._drainPlugins(); + + self._isRavenInstalled = true; + } + + Error.stackTraceLimit = self._globalOptions.stackTraceLimit; + return this; + }, + + /* + * Set the DSN (can be called multiple time unlike config) + * + * @param {string} dsn The public Sentry DSN + */ + setDSN: function(dsn) { + var self = this, + uri = self._parseDSN(dsn), + lastSlash = uri.path.lastIndexOf('/'), + path = uri.path.substr(1, lastSlash); + + self._dsn = dsn; + self._globalKey = uri.user; + self._globalSecret = uri.pass && uri.pass.substr(1); + self._globalProject = uri.path.substr(lastSlash + 1); + + self._globalServer = self._getGlobalServer(uri); + + self._globalEndpoint = + self._globalServer + '/' + path + 'api/' + self._globalProject + '/store/'; + + // Reset backoff state since we may be pointing at a + // new project/server + this._resetBackoff(); + }, + + /* + * Wrap code within a context so Raven can capture errors + * reliably across domains that is executed immediately. + * + * @param {object} options A specific set of options for this context [optional] + * @param {function} func The callback to be immediately executed within the context + * @param {array} args An array of arguments to be called with the callback [optional] + */ + context: function(options, func, args) { + if (isFunction$1(options)) { + args = func || []; + func = options; + options = {}; + } + + return this.wrap(options, func).apply(this, args); + }, + + /* + * Wrap code within a context and returns back a new function to be executed + * + * @param {object} options A specific set of options for this context [optional] + * @param {function} func The function to be wrapped in a new context + * @param {function} _before A function to call before the try/catch wrapper [optional, private] + * @return {function} The newly wrapped functions with a context + */ + wrap: function(options, func, _before) { + var self = this; + // 1 argument has been passed, and it's not a function + // so just return it + if (isUndefined$1(func) && !isFunction$1(options)) { + return options; + } + + // options is optional + if (isFunction$1(options)) { + func = options; + options = undefined; + } + + // At this point, we've passed along 2 arguments, and the second one + // is not a function either, so we'll just return the second argument. + if (!isFunction$1(func)) { + return func; + } + + // We don't wanna wrap it twice! + try { + if (func.__raven__) { + return func; + } + + // If this has already been wrapped in the past, return that + if (func.__raven_wrapper__) { + return func.__raven_wrapper__; + } + } catch (e) { + // Just accessing custom props in some Selenium environments + // can cause a "Permission denied" exception (see raven-js#495). + // Bail on wrapping and return the function as-is (defers to window.onerror). + return func; + } + + function wrapped() { + var args = [], + i = arguments.length, + deep = !options || (options && options.deep !== false); + + if (_before && isFunction$1(_before)) { + _before.apply(this, arguments); + } + + // Recursively wrap all of a function's arguments that are + // functions themselves. + while (i--) args[i] = deep ? self.wrap(options, arguments[i]) : arguments[i]; + + try { + // Attempt to invoke user-land function + // NOTE: If you are a Sentry user, and you are seeing this stack frame, it + // means Raven caught an error invoking your application code. This is + // expected behavior and NOT indicative of a bug with Raven.js. + return func.apply(this, args); + } catch (e) { + self._ignoreNextOnError(); + self.captureException(e, options); + throw e; + } + } + + // copy over properties of the old function + for (var property in func) { + if (hasKey$1(func, property)) { + wrapped[property] = func[property]; + } + } + wrapped.prototype = func.prototype; + + func.__raven_wrapper__ = wrapped; + // Signal that this function has been wrapped/filled already + // for both debugging and to prevent it to being wrapped/filled twice + wrapped.__raven__ = true; + wrapped.__orig__ = func; + + return wrapped; + }, + + /** + * Uninstalls the global error handler. + * + * @return {Raven} + */ + uninstall: function() { + tracekit.report.uninstall(); + + this._detachPromiseRejectionHandler(); + this._unpatchFunctionToString(); + this._restoreBuiltIns(); + this._restoreConsole(); + + Error.stackTraceLimit = this._originalErrorStackTraceLimit; + this._isRavenInstalled = false; + + return this; + }, + + /** + * Callback used for `unhandledrejection` event + * + * @param {PromiseRejectionEvent} event An object containing + * promise: the Promise that was rejected + * reason: the value with which the Promise was rejected + * @return void + */ + _promiseRejectionHandler: function(event) { + this._logDebug('debug', 'Raven caught unhandled promise rejection:', event); + this.captureException(event.reason, { + mechanism: { + type: 'onunhandledrejection', + handled: false + } + }); + }, + + /** + * Installs the global promise rejection handler. + * + * @return {raven} + */ + _attachPromiseRejectionHandler: function() { + this._promiseRejectionHandler = this._promiseRejectionHandler.bind(this); + _window$2.addEventListener && + _window$2.addEventListener('unhandledrejection', this._promiseRejectionHandler); + return this; + }, + + /** + * Uninstalls the global promise rejection handler. + * + * @return {raven} + */ + _detachPromiseRejectionHandler: function() { + _window$2.removeEventListener && + _window$2.removeEventListener('unhandledrejection', this._promiseRejectionHandler); + return this; + }, + + /** + * Manually capture an exception and send it over to Sentry + * + * @param {error} ex An exception to be logged + * @param {object} options A specific set of options for this error [optional] + * @return {Raven} + */ + captureException: function(ex, options) { + options = objectMerge$1({trimHeadFrames: 0}, options ? options : {}); + + if (isErrorEvent$1(ex) && ex.error) { + // If it is an ErrorEvent with `error` property, extract it to get actual Error + ex = ex.error; + } else if (isDOMError$1(ex) || isDOMException$1(ex)) { + // If it is a DOMError or DOMException (which are legacy APIs, but still supported in some browsers) + // then we just extract the name and message, as they don't provide anything else + // https://developer.mozilla.org/en-US/docs/Web/API/DOMError + // https://developer.mozilla.org/en-US/docs/Web/API/DOMException + var name = ex.name || (isDOMError$1(ex) ? 'DOMError' : 'DOMException'); + var message = ex.message ? name + ': ' + ex.message : name; + + return this.captureMessage( + message, + objectMerge$1(options, { + // neither DOMError or DOMException provide stack trace and we most likely wont get it this way as well + // but it's barely any overhead so we may at least try + stacktrace: true, + trimHeadFrames: options.trimHeadFrames + 1 + }) + ); + } else if (isError$1(ex)) { + // we have a real Error object + ex = ex; + } else if (isPlainObject$1(ex)) { + // If it is plain Object, serialize it manually and extract options + // This will allow us to group events based on top-level keys + // which is much better than creating new group when any key/value change + options = this._getCaptureExceptionOptionsFromPlainObject(options, ex); + ex = new Error(options.message); + } else { + // If none of previous checks were valid, then it means that + // it's not a DOMError/DOMException + // it's not a plain Object + // it's not a valid ErrorEvent (one with an error property) + // it's not an Error + // So bail out and capture it as a simple message: + return this.captureMessage( + ex, + objectMerge$1(options, { + stacktrace: true, // if we fall back to captureMessage, default to attempting a new trace + trimHeadFrames: options.trimHeadFrames + 1 + }) + ); + } + + // Store the raw exception object for potential debugging and introspection + this._lastCapturedException = ex; + + // TraceKit.report will re-raise any exception passed to it, + // which means you have to wrap it in try/catch. Instead, we + // can wrap it here and only re-raise if TraceKit.report + // raises an exception different from the one we asked to + // report on. + try { + var stack = tracekit.computeStackTrace(ex); + this._handleStackInfo(stack, options); + } catch (ex1) { + if (ex !== ex1) { + throw ex1; + } + } + + return this; + }, + + _getCaptureExceptionOptionsFromPlainObject: function(currentOptions, ex) { + var exKeys = Object.keys(ex).sort(); + var options = objectMerge$1(currentOptions, { + message: + 'Non-Error exception captured with keys: ' + serializeKeysForMessage$1(exKeys), + fingerprint: [md5_1(exKeys)], + extra: currentOptions.extra || {} + }); + options.extra.__serialized__ = serializeException$1(ex); + + return options; + }, + + /* + * Manually send a message to Sentry + * + * @param {string} msg A plain message to be captured in Sentry + * @param {object} options A specific set of options for this message [optional] + * @return {Raven} + */ + captureMessage: function(msg, options) { + // config() automagically converts ignoreErrors from a list to a RegExp so we need to test for an + // early call; we'll error on the side of logging anything called before configuration since it's + // probably something you should see: + if ( + !!this._globalOptions.ignoreErrors.test && + this._globalOptions.ignoreErrors.test(msg) + ) { + return; + } + + options = options || {}; + msg = msg + ''; // Make sure it's actually a string + + var data = objectMerge$1( + { + message: msg + }, + options + ); + + var ex; + // Generate a "synthetic" stack trace from this point. + // NOTE: If you are a Sentry user, and you are seeing this stack frame, it is NOT indicative + // of a bug with Raven.js. Sentry generates synthetic traces either by configuration, + // or if it catches a thrown object without a "stack" property. + try { + throw new Error(msg); + } catch (ex1) { + ex = ex1; + } + + // null exception name so `Error` isn't prefixed to msg + ex.name = null; + var stack = tracekit.computeStackTrace(ex); + + // stack[0] is `throw new Error(msg)` call itself, we are interested in the frame that was just before that, stack[1] + var initialCall = isArray$1(stack.stack) && stack.stack[1]; + + // if stack[1] is `Raven.captureException`, it means that someone passed a string to it and we redirected that call + // to be handled by `captureMessage`, thus `initialCall` is the 3rd one, not 2nd + // initialCall => captureException(string) => captureMessage(string) + if (initialCall && initialCall.func === 'Raven.captureException') { + initialCall = stack.stack[2]; + } + + var fileurl = (initialCall && initialCall.url) || ''; + + if ( + !!this._globalOptions.ignoreUrls.test && + this._globalOptions.ignoreUrls.test(fileurl) + ) { + return; + } + + if ( + !!this._globalOptions.whitelistUrls.test && + !this._globalOptions.whitelistUrls.test(fileurl) + ) { + return; + } + + // Always attempt to get stacktrace if message is empty. + // It's the only way to provide any helpful information to the user. + if (this._globalOptions.stacktrace || options.stacktrace || data.message === '') { + // fingerprint on msg, not stack trace (legacy behavior, could be revisited) + data.fingerprint = data.fingerprint == null ? msg : data.fingerprint; + + options = objectMerge$1( + { + trimHeadFrames: 0 + }, + options + ); + // Since we know this is a synthetic trace, the top frame (this function call) + // MUST be from Raven.js, so mark it for trimming + // We add to the trim counter so that callers can choose to trim extra frames, such + // as utility functions. + options.trimHeadFrames += 1; + + var frames = this._prepareFrames(stack, options); + data.stacktrace = { + // Sentry expects frames oldest to newest + frames: frames.reverse() + }; + } + + // Make sure that fingerprint is always wrapped in an array + if (data.fingerprint) { + data.fingerprint = isArray$1(data.fingerprint) + ? data.fingerprint + : [data.fingerprint]; + } + + // Fire away! + this._send(data); + + return this; + }, + + captureBreadcrumb: function(obj) { + var crumb = objectMerge$1( + { + timestamp: now() / 1000 + }, + obj + ); + + if (isFunction$1(this._globalOptions.breadcrumbCallback)) { + var result = this._globalOptions.breadcrumbCallback(crumb); + + if (isObject$1(result) && !isEmptyObject$1(result)) { + crumb = result; + } else if (result === false) { + return this; + } + } + + this._breadcrumbs.push(crumb); + if (this._breadcrumbs.length > this._globalOptions.maxBreadcrumbs) { + this._breadcrumbs.shift(); + } + return this; + }, + + addPlugin: function(plugin /*arg1, arg2, ... argN*/) { + var pluginArgs = [].slice.call(arguments, 1); + + this._plugins.push([plugin, pluginArgs]); + if (this._isRavenInstalled) { + this._drainPlugins(); + } + + return this; + }, + + /* + * Set/clear a user to be sent along with the payload. + * + * @param {object} user An object representing user data [optional] + * @return {Raven} + */ + setUserContext: function(user) { + // Intentionally do not merge here since that's an unexpected behavior. + this._globalContext.user = user; + + return this; + }, + + /* + * Merge extra attributes to be sent along with the payload. + * + * @param {object} extra An object representing extra data [optional] + * @return {Raven} + */ + setExtraContext: function(extra) { + this._mergeContext('extra', extra); + + return this; + }, + + /* + * Merge tags to be sent along with the payload. + * + * @param {object} tags An object representing tags [optional] + * @return {Raven} + */ + setTagsContext: function(tags) { + this._mergeContext('tags', tags); + + return this; + }, + + /* + * Clear all of the context. + * + * @return {Raven} + */ + clearContext: function() { + this._globalContext = {}; + + return this; + }, + + /* + * Get a copy of the current context. This cannot be mutated. + * + * @return {object} copy of context + */ + getContext: function() { + // lol javascript + return JSON.parse(stringify_1(this._globalContext)); + }, + + /* + * Set environment of application + * + * @param {string} environment Typically something like 'production'. + * @return {Raven} + */ + setEnvironment: function(environment) { + this._globalOptions.environment = environment; + + return this; + }, + + /* + * Set release version of application + * + * @param {string} release Typically something like a git SHA to identify version + * @return {Raven} + */ + setRelease: function(release) { + this._globalOptions.release = release; + + return this; + }, + + /* + * Set the dataCallback option + * + * @param {function} callback The callback to run which allows the + * data blob to be mutated before sending + * @return {Raven} + */ + setDataCallback: function(callback) { + var original = this._globalOptions.dataCallback; + this._globalOptions.dataCallback = keepOriginalCallback(original, callback); + return this; + }, + + /* + * Set the breadcrumbCallback option + * + * @param {function} callback The callback to run which allows filtering + * or mutating breadcrumbs + * @return {Raven} + */ + setBreadcrumbCallback: function(callback) { + var original = this._globalOptions.breadcrumbCallback; + this._globalOptions.breadcrumbCallback = keepOriginalCallback(original, callback); + return this; + }, + + /* + * Set the shouldSendCallback option + * + * @param {function} callback The callback to run which allows + * introspecting the blob before sending + * @return {Raven} + */ + setShouldSendCallback: function(callback) { + var original = this._globalOptions.shouldSendCallback; + this._globalOptions.shouldSendCallback = keepOriginalCallback(original, callback); + return this; + }, + + /** + * Override the default HTTP transport mechanism that transmits data + * to the Sentry server. + * + * @param {function} transport Function invoked instead of the default + * `makeRequest` handler. + * + * @return {Raven} + */ + setTransport: function(transport) { + this._globalOptions.transport = transport; + + return this; + }, + + /* + * Get the latest raw exception that was captured by Raven. + * + * @return {error} + */ + lastException: function() { + return this._lastCapturedException; + }, + + /* + * Get the last event id + * + * @return {string} + */ + lastEventId: function() { + return this._lastEventId; + }, + + /* + * Determine if Raven is setup and ready to go. + * + * @return {boolean} + */ + isSetup: function() { + if (!this._hasJSON) return false; // needs JSON support + if (!this._globalServer) { + if (!this.ravenNotConfiguredError) { + this.ravenNotConfiguredError = true; + this._logDebug('error', 'Error: Raven has not been configured.'); + } + return false; + } + return true; + }, + + afterLoad: function() { + // TODO: remove window dependence? + + // Attempt to initialize Raven on load + var RavenConfig = _window$2.RavenConfig; + if (RavenConfig) { + this.config(RavenConfig.dsn, RavenConfig.config).install(); + } + }, + + showReportDialog: function(options) { + if ( + !_document // doesn't work without a document (React native) + ) + return; + + options = Object.assign( + { + eventId: this.lastEventId(), + dsn: this._dsn, + user: this._globalContext.user || {} + }, + options + ); + + if (!options.eventId) { + throw new configError('Missing eventId'); + } + + if (!options.dsn) { + throw new configError('Missing DSN'); + } + + var encode = encodeURIComponent; + var encodedOptions = []; + + for (var key in options) { + if (key === 'user') { + var user = options.user; + if (user.name) encodedOptions.push('name=' + encode(user.name)); + if (user.email) encodedOptions.push('email=' + encode(user.email)); + } else { + encodedOptions.push(encode(key) + '=' + encode(options[key])); + } + } + var globalServer = this._getGlobalServer(this._parseDSN(options.dsn)); + + var script = _document.createElement('script'); + script.async = true; + script.src = globalServer + '/api/embed/error-page/?' + encodedOptions.join('&'); + (_document.head || _document.body).appendChild(script); + }, + + /**** Private functions ****/ + _ignoreNextOnError: function() { + var self = this; + this._ignoreOnError += 1; + setTimeout(function() { + // onerror should trigger before setTimeout + self._ignoreOnError -= 1; + }); + }, + + _triggerEvent: function(eventType, options) { + // NOTE: `event` is a native browser thing, so let's avoid conflicting wiht it + var evt, key; + + if (!this._hasDocument) return; + + options = options || {}; + + eventType = 'raven' + eventType.substr(0, 1).toUpperCase() + eventType.substr(1); + + if (_document.createEvent) { + evt = _document.createEvent('HTMLEvents'); + evt.initEvent(eventType, true, true); + } else { + evt = _document.createEventObject(); + evt.eventType = eventType; + } + + for (key in options) + if (hasKey$1(options, key)) { + evt[key] = options[key]; + } + + if (_document.createEvent) { + // IE9 if standards + _document.dispatchEvent(evt); + } else { + // IE8 regardless of Quirks or Standards + // IE9 if quirks + try { + _document.fireEvent('on' + evt.eventType.toLowerCase(), evt); + } catch (e) { + // Do nothing + } + } + }, + + /** + * Wraps addEventListener to capture UI breadcrumbs + * @param evtName the event name (e.g. "click") + * @returns {Function} + * @private + */ + _breadcrumbEventHandler: function(evtName) { + var self = this; + return function(evt) { + // reset keypress timeout; e.g. triggering a 'click' after + // a 'keypress' will reset the keypress debounce so that a new + // set of keypresses can be recorded + self._keypressTimeout = null; + + // It's possible this handler might trigger multiple times for the same + // event (e.g. event propagation through node ancestors). Ignore if we've + // already captured the event. + if (self._lastCapturedEvent === evt) return; + + self._lastCapturedEvent = evt; + + // try/catch both: + // - accessing evt.target (see getsentry/raven-js#838, #768) + // - `htmlTreeAsString` because it's complex, and just accessing the DOM incorrectly + // can throw an exception in some circumstances. + var target; + try { + target = htmlTreeAsString$1(evt.target); + } catch (e) { + target = ''; + } + + self.captureBreadcrumb({ + category: 'ui.' + evtName, // e.g. ui.click, ui.input + message: target + }); + }; + }, + + /** + * Wraps addEventListener to capture keypress UI events + * @returns {Function} + * @private + */ + _keypressEventHandler: function() { + var self = this, + debounceDuration = 1000; // milliseconds + + // TODO: if somehow user switches keypress target before + // debounce timeout is triggered, we will only capture + // a single breadcrumb from the FIRST target (acceptable?) + return function(evt) { + var target; + try { + target = evt.target; + } catch (e) { + // just accessing event properties can throw an exception in some rare circumstances + // see: https://github.com/getsentry/raven-js/issues/838 + return; + } + var tagName = target && target.tagName; + + // only consider keypress events on actual input elements + // this will disregard keypresses targeting body (e.g. tabbing + // through elements, hotkeys, etc) + if ( + !tagName || + (tagName !== 'INPUT' && tagName !== 'TEXTAREA' && !target.isContentEditable) + ) + return; + + // record first keypress in a series, but ignore subsequent + // keypresses until debounce clears + var timeout = self._keypressTimeout; + if (!timeout) { + self._breadcrumbEventHandler('input')(evt); + } + clearTimeout(timeout); + self._keypressTimeout = setTimeout(function() { + self._keypressTimeout = null; + }, debounceDuration); + }; + }, + + /** + * Captures a breadcrumb of type "navigation", normalizing input URLs + * @param to the originating URL + * @param from the target URL + * @private + */ + _captureUrlChange: function(from, to) { + var parsedLoc = parseUrl$1(this._location.href); + var parsedTo = parseUrl$1(to); + var parsedFrom = parseUrl$1(from); + + // because onpopstate only tells you the "new" (to) value of location.href, and + // not the previous (from) value, we need to track the value of the current URL + // state ourselves + this._lastHref = to; + + // Use only the path component of the URL if the URL matches the current + // document (almost all the time when using pushState) + if (parsedLoc.protocol === parsedTo.protocol && parsedLoc.host === parsedTo.host) + to = parsedTo.relative; + if (parsedLoc.protocol === parsedFrom.protocol && parsedLoc.host === parsedFrom.host) + from = parsedFrom.relative; + + this.captureBreadcrumb({ + category: 'navigation', + data: { + to: to, + from: from + } + }); + }, + + _patchFunctionToString: function() { + var self = this; + self._originalFunctionToString = Function.prototype.toString; + // eslint-disable-next-line no-extend-native + Function.prototype.toString = function() { + if (typeof this === 'function' && this.__raven__) { + return self._originalFunctionToString.apply(this.__orig__, arguments); + } + return self._originalFunctionToString.apply(this, arguments); + }; + }, + + _unpatchFunctionToString: function() { + if (this._originalFunctionToString) { + // eslint-disable-next-line no-extend-native + Function.prototype.toString = this._originalFunctionToString; + } + }, + + /** + * Wrap timer functions and event targets to catch errors and provide + * better metadata. + */ + _instrumentTryCatch: function() { + var self = this; + + var wrappedBuiltIns = self._wrappedBuiltIns; + + function wrapTimeFn(orig) { + return function(fn, t) { + // preserve arity + // Make a copy of the arguments to prevent deoptimization + // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments + var args = new Array(arguments.length); + for (var i = 0; i < args.length; ++i) { + args[i] = arguments[i]; + } + var originalCallback = args[0]; + if (isFunction$1(originalCallback)) { + args[0] = self.wrap( + { + mechanism: { + type: 'instrument', + data: {function: orig.name || ''} + } + }, + originalCallback + ); + } + + // IE < 9 doesn't support .call/.apply on setInterval/setTimeout, but it + // also supports only two arguments and doesn't care what this is, so we + // can just call the original function directly. + if (orig.apply) { + return orig.apply(this, args); + } else { + return orig(args[0], args[1]); + } + }; + } + + var autoBreadcrumbs = this._globalOptions.autoBreadcrumbs; + + function wrapEventTarget(global) { + var proto = _window$2[global] && _window$2[global].prototype; + if (proto && proto.hasOwnProperty && proto.hasOwnProperty('addEventListener')) { + fill$1( + proto, + 'addEventListener', + function(orig) { + return function(evtName, fn, capture, secure) { + // preserve arity + try { + if (fn && fn.handleEvent) { + fn.handleEvent = self.wrap( + { + mechanism: { + type: 'instrument', + data: { + target: global, + function: 'handleEvent', + handler: (fn && fn.name) || '' + } + } + }, + fn.handleEvent + ); + } + } catch (err) { + // can sometimes get 'Permission denied to access property "handle Event' + } + + // More breadcrumb DOM capture ... done here and not in `_instrumentBreadcrumbs` + // so that we don't have more than one wrapper function + var before, clickHandler, keypressHandler; + + if ( + autoBreadcrumbs && + autoBreadcrumbs.dom && + (global === 'EventTarget' || global === 'Node') + ) { + // NOTE: generating multiple handlers per addEventListener invocation, should + // revisit and verify we can just use one (almost certainly) + clickHandler = self._breadcrumbEventHandler('click'); + keypressHandler = self._keypressEventHandler(); + before = function(evt) { + // need to intercept every DOM event in `before` argument, in case that + // same wrapped method is re-used for different events (e.g. mousemove THEN click) + // see #724 + if (!evt) return; + + var eventType; + try { + eventType = evt.type; + } catch (e) { + // just accessing event properties can throw an exception in some rare circumstances + // see: https://github.com/getsentry/raven-js/issues/838 + return; + } + if (eventType === 'click') return clickHandler(evt); + else if (eventType === 'keypress') return keypressHandler(evt); + }; + } + return orig.call( + this, + evtName, + self.wrap( + { + mechanism: { + type: 'instrument', + data: { + target: global, + function: 'addEventListener', + handler: (fn && fn.name) || '' + } + } + }, + fn, + before + ), + capture, + secure + ); + }; + }, + wrappedBuiltIns + ); + fill$1( + proto, + 'removeEventListener', + function(orig) { + return function(evt, fn, capture, secure) { + try { + fn = fn && (fn.__raven_wrapper__ ? fn.__raven_wrapper__ : fn); + } catch (e) { + // ignore, accessing __raven_wrapper__ will throw in some Selenium environments + } + return orig.call(this, evt, fn, capture, secure); + }; + }, + wrappedBuiltIns + ); + } + } + + fill$1(_window$2, 'setTimeout', wrapTimeFn, wrappedBuiltIns); + fill$1(_window$2, 'setInterval', wrapTimeFn, wrappedBuiltIns); + if (_window$2.requestAnimationFrame) { + fill$1( + _window$2, + 'requestAnimationFrame', + function(orig) { + return function(cb) { + return orig( + self.wrap( + { + mechanism: { + type: 'instrument', + data: { + function: 'requestAnimationFrame', + handler: (orig && orig.name) || '' + } + } + }, + cb + ) + ); + }; + }, + wrappedBuiltIns + ); + } + + // event targets borrowed from bugsnag-js: + // https://github.com/bugsnag/bugsnag-js/blob/master/src/bugsnag.js#L666 + var eventTargets = [ + 'EventTarget', + 'Window', + 'Node', + 'ApplicationCache', + 'AudioTrackList', + 'ChannelMergerNode', + 'CryptoOperation', + 'EventSource', + 'FileReader', + 'HTMLUnknownElement', + 'IDBDatabase', + 'IDBRequest', + 'IDBTransaction', + 'KeyOperation', + 'MediaController', + 'MessagePort', + 'ModalWindow', + 'Notification', + 'SVGElementInstance', + 'Screen', + 'TextTrack', + 'TextTrackCue', + 'TextTrackList', + 'WebSocket', + 'WebSocketWorker', + 'Worker', + 'XMLHttpRequest', + 'XMLHttpRequestEventTarget', + 'XMLHttpRequestUpload' + ]; + for (var i = 0; i < eventTargets.length; i++) { + wrapEventTarget(eventTargets[i]); + } + }, + + /** + * Instrument browser built-ins w/ breadcrumb capturing + * - XMLHttpRequests + * - DOM interactions (click/typing) + * - window.location changes + * - console + * + * Can be disabled or individually configured via the `autoBreadcrumbs` config option + */ + _instrumentBreadcrumbs: function() { + var self = this; + var autoBreadcrumbs = this._globalOptions.autoBreadcrumbs; + + var wrappedBuiltIns = self._wrappedBuiltIns; + + function wrapProp(prop, xhr) { + if (prop in xhr && isFunction$1(xhr[prop])) { + fill$1(xhr, prop, function(orig) { + return self.wrap( + { + mechanism: { + type: 'instrument', + data: {function: prop, handler: (orig && orig.name) || ''} + } + }, + orig + ); + }); // intentionally don't track filled methods on XHR instances + } + } + + if (autoBreadcrumbs.xhr && 'XMLHttpRequest' in _window$2) { + var xhrproto = _window$2.XMLHttpRequest && _window$2.XMLHttpRequest.prototype; + fill$1( + xhrproto, + 'open', + function(origOpen) { + return function(method, url) { + // preserve arity + + // if Sentry key appears in URL, don't capture + if (isString$1(url) && url.indexOf(self._globalKey) === -1) { + this.__raven_xhr = { + method: method, + url: url, + status_code: null + }; + } + + return origOpen.apply(this, arguments); + }; + }, + wrappedBuiltIns + ); + + fill$1( + xhrproto, + 'send', + function(origSend) { + return function() { + // preserve arity + var xhr = this; + + function onreadystatechangeHandler() { + if (xhr.__raven_xhr && xhr.readyState === 4) { + try { + // touching statusCode in some platforms throws + // an exception + xhr.__raven_xhr.status_code = xhr.status; + } catch (e) { + /* do nothing */ + } + + self.captureBreadcrumb({ + type: 'http', + category: 'xhr', + data: xhr.__raven_xhr + }); + } + } + + var props = ['onload', 'onerror', 'onprogress']; + for (var j = 0; j < props.length; j++) { + wrapProp(props[j], xhr); + } + + if ('onreadystatechange' in xhr && isFunction$1(xhr.onreadystatechange)) { + fill$1( + xhr, + 'onreadystatechange', + function(orig) { + return self.wrap( + { + mechanism: { + type: 'instrument', + data: { + function: 'onreadystatechange', + handler: (orig && orig.name) || '' + } + } + }, + orig, + onreadystatechangeHandler + ); + } /* intentionally don't track this instrumentation */ + ); + } else { + // if onreadystatechange wasn't actually set by the page on this xhr, we + // are free to set our own and capture the breadcrumb + xhr.onreadystatechange = onreadystatechangeHandler; + } + + return origSend.apply(this, arguments); + }; + }, + wrappedBuiltIns + ); + } + + if (autoBreadcrumbs.xhr && supportsFetch$1()) { + fill$1( + _window$2, + 'fetch', + function(origFetch) { + return function() { + // preserve arity + // Make a copy of the arguments to prevent deoptimization + // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments + var args = new Array(arguments.length); + for (var i = 0; i < args.length; ++i) { + args[i] = arguments[i]; + } + + var fetchInput = args[0]; + var method = 'GET'; + var url; + + if (typeof fetchInput === 'string') { + url = fetchInput; + } else if ('Request' in _window$2 && fetchInput instanceof _window$2.Request) { + url = fetchInput.url; + if (fetchInput.method) { + method = fetchInput.method; + } + } else { + url = '' + fetchInput; + } + + // if Sentry key appears in URL, don't capture, as it's our own request + if (url.indexOf(self._globalKey) !== -1) { + return origFetch.apply(this, args); + } + + if (args[1] && args[1].method) { + method = args[1].method; + } + + var fetchData = { + method: method, + url: url, + status_code: null + }; + + return origFetch + .apply(this, args) + .then(function(response) { + fetchData.status_code = response.status; + + self.captureBreadcrumb({ + type: 'http', + category: 'fetch', + data: fetchData + }); + + return response; + }) + ['catch'](function(err) { + // if there is an error performing the request + self.captureBreadcrumb({ + type: 'http', + category: 'fetch', + data: fetchData, + level: 'error' + }); + + throw err; + }); + }; + }, + wrappedBuiltIns + ); + } + + // Capture breadcrumbs from any click that is unhandled / bubbled up all the way + // to the document. Do this before we instrument addEventListener. + if (autoBreadcrumbs.dom && this._hasDocument) { + if (_document.addEventListener) { + _document.addEventListener('click', self._breadcrumbEventHandler('click'), false); + _document.addEventListener('keypress', self._keypressEventHandler(), false); + } else if (_document.attachEvent) { + // IE8 Compatibility + _document.attachEvent('onclick', self._breadcrumbEventHandler('click')); + _document.attachEvent('onkeypress', self._keypressEventHandler()); + } + } + + // record navigation (URL) changes + // NOTE: in Chrome App environment, touching history.pushState, *even inside + // a try/catch block*, will cause Chrome to output an error to console.error + // borrowed from: https://github.com/angular/angular.js/pull/13945/files + var chrome = _window$2.chrome; + var isChromePackagedApp = chrome && chrome.app && chrome.app.runtime; + var hasPushAndReplaceState = + !isChromePackagedApp && + _window$2.history && + _window$2.history.pushState && + _window$2.history.replaceState; + if (autoBreadcrumbs.location && hasPushAndReplaceState) { + // TODO: remove onpopstate handler on uninstall() + var oldOnPopState = _window$2.onpopstate; + _window$2.onpopstate = function() { + var currentHref = self._location.href; + self._captureUrlChange(self._lastHref, currentHref); + + if (oldOnPopState) { + return oldOnPopState.apply(this, arguments); + } + }; + + var historyReplacementFunction = function(origHistFunction) { + // note history.pushState.length is 0; intentionally not declaring + // params to preserve 0 arity + return function(/* state, title, url */) { + var url = arguments.length > 2 ? arguments[2] : undefined; + + // url argument is optional + if (url) { + // coerce to string (this is what pushState does) + self._captureUrlChange(self._lastHref, url + ''); + } + + return origHistFunction.apply(this, arguments); + }; + }; + + fill$1(_window$2.history, 'pushState', historyReplacementFunction, wrappedBuiltIns); + fill$1(_window$2.history, 'replaceState', historyReplacementFunction, wrappedBuiltIns); + } + + if (autoBreadcrumbs.console && 'console' in _window$2 && console.log) { + // console + var consoleMethodCallback = function(msg, data) { + self.captureBreadcrumb({ + message: msg, + level: data.level, + category: 'console' + }); + }; + + each$1(['debug', 'info', 'warn', 'error', 'log'], function(_, level) { + wrapConsoleMethod(console, level, consoleMethodCallback); + }); + } + }, + + _restoreBuiltIns: function() { + // restore any wrapped builtins + var builtin; + while (this._wrappedBuiltIns.length) { + builtin = this._wrappedBuiltIns.shift(); + + var obj = builtin[0], + name = builtin[1], + orig = builtin[2]; + + obj[name] = orig; + } + }, + + _restoreConsole: function() { + // eslint-disable-next-line guard-for-in + for (var method in this._originalConsoleMethods) { + this._originalConsole[method] = this._originalConsoleMethods[method]; + } + }, + + _drainPlugins: function() { + var self = this; + + // FIX ME TODO + each$1(this._plugins, function(_, plugin) { + var installer = plugin[0]; + var args = plugin[1]; + installer.apply(self, [self].concat(args)); + }); + }, + + _parseDSN: function(str) { + var m = dsnPattern.exec(str), + dsn = {}, + i = 7; + + try { + while (i--) dsn[dsnKeys[i]] = m[i] || ''; + } catch (e) { + throw new configError('Invalid DSN: ' + str); + } + + if (dsn.pass && !this._globalOptions.allowSecretKey) { + throw new configError( + 'Do not specify your secret key in the DSN. See: http://bit.ly/raven-secret-key' + ); + } + + return dsn; + }, + + _getGlobalServer: function(uri) { + // assemble the endpoint from the uri pieces + var globalServer = '//' + uri.host + (uri.port ? ':' + uri.port : ''); + + if (uri.protocol) { + globalServer = uri.protocol + ':' + globalServer; + } + return globalServer; + }, + + _handleOnErrorStackInfo: function(stackInfo, options) { + options = options || {}; + options.mechanism = options.mechanism || { + type: 'onerror', + handled: false + }; + + // if we are intentionally ignoring errors via onerror, bail out + if (!this._ignoreOnError) { + this._handleStackInfo(stackInfo, options); + } + }, + + _handleStackInfo: function(stackInfo, options) { + var frames = this._prepareFrames(stackInfo, options); + + this._triggerEvent('handle', { + stackInfo: stackInfo, + options: options + }); + + this._processException( + stackInfo.name, + stackInfo.message, + stackInfo.url, + stackInfo.lineno, + frames, + options + ); + }, + + _prepareFrames: function(stackInfo, options) { + var self = this; + var frames = []; + if (stackInfo.stack && stackInfo.stack.length) { + each$1(stackInfo.stack, function(i, stack) { + var frame = self._normalizeFrame(stack, stackInfo.url); + if (frame) { + frames.push(frame); + } + }); + + // e.g. frames captured via captureMessage throw + if (options && options.trimHeadFrames) { + for (var j = 0; j < options.trimHeadFrames && j < frames.length; j++) { + frames[j].in_app = false; + } + } + } + frames = frames.slice(0, this._globalOptions.stackTraceLimit); + return frames; + }, + + _normalizeFrame: function(frame, stackInfoUrl) { + // normalize the frames data + var normalized = { + filename: frame.url, + lineno: frame.line, + colno: frame.column, + function: frame.func || '?' + }; + + // Case when we don't have any information about the error + // E.g. throwing a string or raw object, instead of an `Error` in Firefox + // Generating synthetic error doesn't add any value here + // + // We should probably somehow let a user know that they should fix their code + if (!frame.url) { + normalized.filename = stackInfoUrl; // fallback to whole stacks url from onerror handler + } + + normalized.in_app = !// determine if an exception came from outside of our app + // first we check the global includePaths list. + ( + (!!this._globalOptions.includePaths.test && + !this._globalOptions.includePaths.test(normalized.filename)) || + // Now we check for fun, if the function name is Raven or TraceKit + /(Raven|TraceKit)\./.test(normalized['function']) || + // finally, we do a last ditch effort and check for raven.min.js + /raven\.(min\.)?js$/.test(normalized.filename) + ); + + return normalized; + }, + + _processException: function(type, message, fileurl, lineno, frames, options) { + var prefixedMessage = (type ? type + ': ' : '') + (message || ''); + if ( + !!this._globalOptions.ignoreErrors.test && + (this._globalOptions.ignoreErrors.test(message) || + this._globalOptions.ignoreErrors.test(prefixedMessage)) + ) { + return; + } + + var stacktrace; + + if (frames && frames.length) { + fileurl = frames[0].filename || fileurl; + // Sentry expects frames oldest to newest + // and JS sends them as newest to oldest + frames.reverse(); + stacktrace = {frames: frames}; + } else if (fileurl) { + stacktrace = { + frames: [ + { + filename: fileurl, + lineno: lineno, + in_app: true + } + ] + }; + } + + if ( + !!this._globalOptions.ignoreUrls.test && + this._globalOptions.ignoreUrls.test(fileurl) + ) { + return; + } + + if ( + !!this._globalOptions.whitelistUrls.test && + !this._globalOptions.whitelistUrls.test(fileurl) + ) { + return; + } + + var data = objectMerge$1( + { + // sentry.interfaces.Exception + exception: { + values: [ + { + type: type, + value: message, + stacktrace: stacktrace + } + ] + }, + transaction: fileurl + }, + options + ); + + var ex = data.exception.values[0]; + if (ex.type == null && ex.value === '') { + ex.value = 'Unrecoverable error caught'; + } + + // Move mechanism from options to exception interface + // We do this, as requiring user to pass `{exception:{mechanism:{ ... }}}` would be + // too much + if (!data.exception.mechanism && data.mechanism) { + data.exception.mechanism = data.mechanism; + delete data.mechanism; + } + + data.exception.mechanism = objectMerge$1( + { + type: 'generic', + handled: true + }, + data.exception.mechanism || {} + ); + + // Fire away! + this._send(data); + }, + + _trimPacket: function(data) { + // For now, we only want to truncate the two different messages + // but this could/should be expanded to just trim everything + var max = this._globalOptions.maxMessageLength; + if (data.message) { + data.message = truncate$1(data.message, max); + } + if (data.exception) { + var exception = data.exception.values[0]; + exception.value = truncate$1(exception.value, max); + } + + var request = data.request; + if (request) { + if (request.url) { + request.url = truncate$1(request.url, this._globalOptions.maxUrlLength); + } + if (request.Referer) { + request.Referer = truncate$1(request.Referer, this._globalOptions.maxUrlLength); + } + } + + if (data.breadcrumbs && data.breadcrumbs.values) + this._trimBreadcrumbs(data.breadcrumbs); + + return data; + }, + + /** + * Truncate breadcrumb values (right now just URLs) + */ + _trimBreadcrumbs: function(breadcrumbs) { + // known breadcrumb properties with urls + // TODO: also consider arbitrary prop values that start with (https?)?:// + var urlProps = ['to', 'from', 'url'], + urlProp, + crumb, + data; + + for (var i = 0; i < breadcrumbs.values.length; ++i) { + crumb = breadcrumbs.values[i]; + if ( + !crumb.hasOwnProperty('data') || + !isObject$1(crumb.data) || + objectFrozen$1(crumb.data) + ) + continue; + + data = objectMerge$1({}, crumb.data); + for (var j = 0; j < urlProps.length; ++j) { + urlProp = urlProps[j]; + if (data.hasOwnProperty(urlProp) && data[urlProp]) { + data[urlProp] = truncate$1(data[urlProp], this._globalOptions.maxUrlLength); + } + } + breadcrumbs.values[i].data = data; + } + }, + + _getHttpData: function() { + if (!this._hasNavigator && !this._hasDocument) return; + var httpData = {}; + + if (this._hasNavigator && _navigator.userAgent) { + httpData.headers = { + 'User-Agent': _navigator.userAgent + }; + } + + // Check in `window` instead of `document`, as we may be in ServiceWorker environment + if (_window$2.location && _window$2.location.href) { + httpData.url = _window$2.location.href; + } + + if (this._hasDocument && _document.referrer) { + if (!httpData.headers) httpData.headers = {}; + httpData.headers.Referer = _document.referrer; + } + + return httpData; + }, + + _resetBackoff: function() { + this._backoffDuration = 0; + this._backoffStart = null; + }, + + _shouldBackoff: function() { + return this._backoffDuration && now() - this._backoffStart < this._backoffDuration; + }, + + /** + * Returns true if the in-process data payload matches the signature + * of the previously-sent data + * + * NOTE: This has to be done at this level because TraceKit can generate + * data from window.onerror WITHOUT an exception object (IE8, IE9, + * other old browsers). This can take the form of an "exception" + * data object with a single frame (derived from the onerror args). + */ + _isRepeatData: function(current) { + var last = this._lastData; + + if ( + !last || + current.message !== last.message || // defined for captureMessage + current.transaction !== last.transaction // defined for captureException/onerror + ) + return false; + + // Stacktrace interface (i.e. from captureMessage) + if (current.stacktrace || last.stacktrace) { + return isSameStacktrace$1(current.stacktrace, last.stacktrace); + } else if (current.exception || last.exception) { + // Exception interface (i.e. from captureException/onerror) + return isSameException$1(current.exception, last.exception); + } + + return true; + }, + + _setBackoffState: function(request) { + // If we are already in a backoff state, don't change anything + if (this._shouldBackoff()) { + return; + } + + var status = request.status; + + // 400 - project_id doesn't exist or some other fatal + // 401 - invalid/revoked dsn + // 429 - too many requests + if (!(status === 400 || status === 401 || status === 429)) return; + + var retry; + try { + // If Retry-After is not in Access-Control-Expose-Headers, most + // browsers will throw an exception trying to access it + if (supportsFetch$1()) { + retry = request.headers.get('Retry-After'); + } else { + retry = request.getResponseHeader('Retry-After'); + } + + // Retry-After is returned in seconds + retry = parseInt(retry, 10) * 1000; + } catch (e) { + /* eslint no-empty:0 */ + } + + this._backoffDuration = retry + ? // If Sentry server returned a Retry-After value, use it + retry + : // Otherwise, double the last backoff duration (starts at 1 sec) + this._backoffDuration * 2 || 1000; + + this._backoffStart = now(); + }, + + _send: function(data) { + var globalOptions = this._globalOptions; + + var baseData = { + project: this._globalProject, + logger: globalOptions.logger, + platform: 'javascript' + }, + httpData = this._getHttpData(); + + if (httpData) { + baseData.request = httpData; + } + + // HACK: delete `trimHeadFrames` to prevent from appearing in outbound payload + if (data.trimHeadFrames) delete data.trimHeadFrames; + + data = objectMerge$1(baseData, data); + + // Merge in the tags and extra separately since objectMerge doesn't handle a deep merge + data.tags = objectMerge$1(objectMerge$1({}, this._globalContext.tags), data.tags); + data.extra = objectMerge$1(objectMerge$1({}, this._globalContext.extra), data.extra); + + // Send along our own collected metadata with extra + data.extra['session:duration'] = now() - this._startTime; + + if (this._breadcrumbs && this._breadcrumbs.length > 0) { + // intentionally make shallow copy so that additions + // to breadcrumbs aren't accidentally sent in this request + data.breadcrumbs = { + values: [].slice.call(this._breadcrumbs, 0) + }; + } + + if (this._globalContext.user) { + // sentry.interfaces.User + data.user = this._globalContext.user; + } + + // Include the environment if it's defined in globalOptions + if (globalOptions.environment) data.environment = globalOptions.environment; + + // Include the release if it's defined in globalOptions + if (globalOptions.release) data.release = globalOptions.release; + + // Include server_name if it's defined in globalOptions + if (globalOptions.serverName) data.server_name = globalOptions.serverName; + + data = this._sanitizeData(data); + + // Cleanup empty properties before sending them to the server + Object.keys(data).forEach(function(key) { + if (data[key] == null || data[key] === '' || isEmptyObject$1(data[key])) { + delete data[key]; + } + }); + + if (isFunction$1(globalOptions.dataCallback)) { + data = globalOptions.dataCallback(data) || data; + } + + // Why?????????? + if (!data || isEmptyObject$1(data)) { + return; + } + + // Check if the request should be filtered or not + if ( + isFunction$1(globalOptions.shouldSendCallback) && + !globalOptions.shouldSendCallback(data) + ) { + return; + } + + // Backoff state: Sentry server previously responded w/ an error (e.g. 429 - too many requests), + // so drop requests until "cool-off" period has elapsed. + if (this._shouldBackoff()) { + this._logDebug('warn', 'Raven dropped error due to backoff: ', data); + return; + } + + if (typeof globalOptions.sampleRate === 'number') { + if (Math.random() < globalOptions.sampleRate) { + this._sendProcessedPayload(data); + } + } else { + this._sendProcessedPayload(data); + } + }, + + _sanitizeData: function(data) { + return sanitize$1(data, this._globalOptions.sanitizeKeys); + }, + + _getUuid: function() { + return uuid4$1(); + }, + + _sendProcessedPayload: function(data, callback) { + var self = this; + var globalOptions = this._globalOptions; + + if (!this.isSetup()) return; + + // Try and clean up the packet before sending by truncating long values + data = this._trimPacket(data); + + // ideally duplicate error testing should occur *before* dataCallback/shouldSendCallback, + // but this would require copying an un-truncated copy of the data packet, which can be + // arbitrarily deep (extra_data) -- could be worthwhile? will revisit + if (!this._globalOptions.allowDuplicates && this._isRepeatData(data)) { + this._logDebug('warn', 'Raven dropped repeat event: ', data); + return; + } + + // Send along an event_id if not explicitly passed. + // This event_id can be used to reference the error within Sentry itself. + // Set lastEventId after we know the error should actually be sent + this._lastEventId = data.event_id || (data.event_id = this._getUuid()); + + // Store outbound payload after trim + this._lastData = data; + + this._logDebug('debug', 'Raven about to send:', data); + + var auth = { + sentry_version: '7', + sentry_client: 'raven-js/' + this.VERSION, + sentry_key: this._globalKey + }; + + if (this._globalSecret) { + auth.sentry_secret = this._globalSecret; + } + + var exception = data.exception && data.exception.values[0]; + + // only capture 'sentry' breadcrumb is autoBreadcrumbs is truthy + if ( + this._globalOptions.autoBreadcrumbs && + this._globalOptions.autoBreadcrumbs.sentry + ) { + this.captureBreadcrumb({ + category: 'sentry', + message: exception + ? (exception.type ? exception.type + ': ' : '') + exception.value + : data.message, + event_id: data.event_id, + level: data.level || 'error' // presume error unless specified + }); + } + + var url = this._globalEndpoint; + (globalOptions.transport || this._makeRequest).call(this, { + url: url, + auth: auth, + data: data, + options: globalOptions, + onSuccess: function success() { + self._resetBackoff(); + + self._triggerEvent('success', { + data: data, + src: url + }); + callback && callback(); + }, + onError: function failure(error) { + self._logDebug('error', 'Raven transport failed to send: ', error); + + if (error.request) { + self._setBackoffState(error.request); + } + + self._triggerEvent('failure', { + data: data, + src: url + }); + error = error || new Error('Raven send failed (no additional details provided)'); + callback && callback(error); + } + }); + }, + + _makeRequest: function(opts) { + // Auth is intentionally sent as part of query string (NOT as custom HTTP header) to avoid preflight CORS requests + var url = opts.url + '?' + urlencode$1(opts.auth); + + var evaluatedHeaders = null; + var evaluatedFetchParameters = {}; + + if (opts.options.headers) { + evaluatedHeaders = this._evaluateHash(opts.options.headers); + } + + if (opts.options.fetchParameters) { + evaluatedFetchParameters = this._evaluateHash(opts.options.fetchParameters); + } + + if (supportsFetch$1()) { + evaluatedFetchParameters.body = stringify_1(opts.data); + + var defaultFetchOptions = objectMerge$1({}, this._fetchDefaults); + var fetchOptions = objectMerge$1(defaultFetchOptions, evaluatedFetchParameters); + + if (evaluatedHeaders) { + fetchOptions.headers = evaluatedHeaders; + } + + return _window$2 + .fetch(url, fetchOptions) + .then(function(response) { + if (response.ok) { + opts.onSuccess && opts.onSuccess(); + } else { + var error = new Error('Sentry error code: ' + response.status); + // It's called request only to keep compatibility with XHR interface + // and not add more redundant checks in setBackoffState method + error.request = response; + opts.onError && opts.onError(error); + } + }) + ['catch'](function() { + opts.onError && + opts.onError(new Error('Sentry error code: network unavailable')); + }); + } + + var request = _window$2.XMLHttpRequest && new _window$2.XMLHttpRequest(); + if (!request) return; + + // if browser doesn't support CORS (e.g. IE7), we are out of luck + var hasCORS = 'withCredentials' in request || typeof XDomainRequest !== 'undefined'; + + if (!hasCORS) return; + + if ('withCredentials' in request) { + request.onreadystatechange = function() { + if (request.readyState !== 4) { + return; + } else if (request.status === 200) { + opts.onSuccess && opts.onSuccess(); + } else if (opts.onError) { + var err = new Error('Sentry error code: ' + request.status); + err.request = request; + opts.onError(err); + } + }; + } else { + request = new XDomainRequest(); + // xdomainrequest cannot go http -> https (or vice versa), + // so always use protocol relative + url = url.replace(/^https?:/, ''); + + // onreadystatechange not supported by XDomainRequest + if (opts.onSuccess) { + request.onload = opts.onSuccess; + } + if (opts.onError) { + request.onerror = function() { + var err = new Error('Sentry error code: XDomainRequest'); + err.request = request; + opts.onError(err); + }; + } + } + + request.open('POST', url); + + if (evaluatedHeaders) { + each$1(evaluatedHeaders, function(key, value) { + request.setRequestHeader(key, value); + }); + } + + request.send(stringify_1(opts.data)); + }, + + _evaluateHash: function(hash) { + var evaluated = {}; + + for (var key in hash) { + if (hash.hasOwnProperty(key)) { + var value = hash[key]; + evaluated[key] = typeof value === 'function' ? value() : value; + } + } + + return evaluated; + }, + + _logDebug: function(level) { + // We allow `Raven.debug` and `Raven.config(DSN, { debug: true })` to not make backward incompatible API change + if ( + this._originalConsoleMethods[level] && + (this.debug || this._globalOptions.debug) + ) { + // In IE<10 console methods do not have their own 'apply' method + Function.prototype.apply.call( + this._originalConsoleMethods[level], + this._originalConsole, + [].slice.call(arguments, 1) + ); + } + }, + + _mergeContext: function(key, context) { + if (isUndefined$1(context)) { + delete this._globalContext[key]; + } else { + this._globalContext[key] = objectMerge$1(this._globalContext[key] || {}, context); + } + } + }; + + // Deprecations + Raven.prototype.setUser = Raven.prototype.setUserContext; + Raven.prototype.setReleaseContext = Raven.prototype.setRelease; + + var raven = Raven; + + /** + * Enforces a single instance of the Raven client, and the + * main entry point for Raven. If you are a consumer of the + * Raven library, you SHOULD load this file (vs raven.js). + **/ + + + + // This is to be defensive in environments where window does not exist (see https://github.com/getsentry/raven-js/pull/785) + var _window$3 = + typeof window !== 'undefined' + ? window + : typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : typeof self !== 'undefined' ? self : {}; + var _Raven = _window$3.Raven; + + var Raven$1 = new raven(); + + /* + * Allow multiple versions of Raven to be installed. + * Strip Raven from the global context and returns the instance. + * + * @return {Raven} + */ + Raven$1.noConflict = function() { + _window$3.Raven = _Raven; + return Raven$1; + }; + + Raven$1.afterLoad(); + + var singleton = Raven$1; + + /** + * DISCLAIMER: + * + * Expose `Client` constructor for cases where user want to track multiple "sub-applications" in one larger app. + * It's not meant to be used by a wide audience, so pleaaase make sure that you know what you're doing before using it. + * Accidentally calling `install` multiple times, may result in an unexpected behavior that's very hard to debug. + * + * It's called `Client' to be in-line with Raven Node implementation. + * + * HOWTO: + * + * import Raven from 'raven-js'; + * + * const someAppReporter = new Raven.Client(); + * const someOtherAppReporter = new Raven.Client(); + * + * someAppReporter.config('__DSN__', { + * ...config goes here + * }); + * + * someOtherAppReporter.config('__OTHER_DSN__', { + * ...config goes here + * }); + * + * someAppReporter.captureMessage(...); + * someAppReporter.captureException(...); + * someAppReporter.captureBreadcrumb(...); + * + * someOtherAppReporter.captureMessage(...); + * someOtherAppReporter.captureException(...); + * someOtherAppReporter.captureBreadcrumb(...); + * + * It should "just work". + */ + var Client = raven; + singleton.Client = Client; + + // ========================================================================== + + (function () { + var isLive = window.location.host === 'plyr.io'; + + // Raven / Sentry + // For demo site (https://plyr.io) only + if (isLive) { + singleton.config('https://d4ad9866ad834437a4754e23937071e4@sentry.io/305555').install(); + } + + document.addEventListener('DOMContentLoaded', function () { + singleton.context(function () { + var selector = '#player'; + var container = document.getElementById('container'); + + if (window.shr) { + window.shr.setup({ + count: { + classname: 'button__count' + } + }); + } + + // Setup tab focus + var tabClassName = 'tab-focus'; + + // Remove class on blur + document.addEventListener('focusout', function (event) { + if (container.contains(event.target)) { + return; + } + event.target.classList.remove(tabClassName); + }); + + // Add classname to tabbed elements + document.addEventListener('keydown', function (event) { + if (event.keyCode !== 9) { + return; + } + + // Delay the adding of classname until the focus has changed + // This event fires before the focusin event + setTimeout(function () { + var focused = document.activeElement; + + if (!focused || container.contains(focused)) { + return; + } + + focused.classList.add(tabClassName); + }, 10); + }); + + // Setup the player + var player = new Plyr(selector, { + debug: true, + title: 'View From A Blue Moon', + iconUrl: '../dist/plyr.svg', + keyboard: { + global: true + }, + tooltips: { + controls: false, + seek: false + }, + // clickToPlay: false, + /* controls: [ + 'play-large', + 'restart', + 'rewind', + 'play', + 'fast-forward', + 'progress', + 'current-time', + 'duration', + 'mute', + 'volume', + 'captions', + 'settings', + 'pip', + 'airplay', + 'fullscreen', + ], */ + /* i18n: { + restart: '重新開始', + rewind: '快退{seektime}秒', + play: '播放', + pause: '暫停', + fastForward: '快進{seektime}秒', + seek: '尋求', + played: '發揮', + buffered: '緩衝的', + currentTime: '當前時間戳', + duration: '長短', + volume: '音量', + mute: '靜音', + unmute: '取消靜音', + enableCaptions: '開啟字幕', + disableCaptions: '關閉字幕', + enterFullscreen: '進入全螢幕', + exitFullscreen: '退出全螢幕', + frameTitle: '球員為{title}', + captions: '字幕', + settings: '設定', + speed: '速度', + normal: '正常', + quality: '質量', + loop: '循環', + start: 'Start', + end: 'End', + all: 'All', + reset: '重啟', + disabled: '殘', + enabled: '啟用', + advertisement: '廣告', + }, */ + captions: { + active: true + }, + keys: { + google: 'AIzaSyDrNwtN3nLH_8rjCmu5Wq3ZCm4MNAVdc0c' + }, + ads: { + // enabled: true, + publisherId: '918848828995742' + } + }); + + // Expose for tinkering in the console + window.player = player; + + // Setup type toggle + var buttons = document.querySelectorAll('[data-source]'); + var types = { + video: 'video', + audio: 'audio', + youtube: 'youtube', + vimeo: 'vimeo' + }; + var currentType = window.location.hash.replace('#', ''); + var historySupport = window.history && window.history.pushState; + + // Toggle class on an element + function toggleClass(element, className, state) { + if (element) { + element.classList[state ? 'add' : 'remove'](className); + } + } + + // Set a new source + function newSource(type, init) { + // Bail if new type isn't known, it's the current type, or current type is empty (video is default) and new type is video + if (!(type in types) || !init && type === currentType || !currentType.length && type === types.video) { + return; + } + + switch (type) { + case types.video: + player.source = { + type: 'video', + title: 'View From A Blue Moon', + sources: [{ + src: 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-576p.mp4', + type: 'video/mp4', + size: 576 + }, { + src: 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-720p.mp4', + type: 'video/mp4', + size: 720 + }, { + src: 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-1080p.mp4', + type: 'video/mp4', + size: 1080 + }, { + src: 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-1440p.mp4', + type: 'video/mp4', + size: 1440 + }], + poster: 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.jpg', + tracks: [{ + kind: 'captions', + label: 'English', + srclang: 'en', + src: 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.en.vtt', + default: true + }, { + kind: 'captions', + label: 'French', + srclang: 'fr', + src: 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.fr.vtt' + }] + }; + + break; + + case types.audio: + player.source = { + type: 'audio', + title: 'Kishi Bashi – “It All Began With A Burst”', + sources: [{ + src: 'https://cdn.plyr.io/static/demo/Kishi_Bashi_-_It_All_Began_With_a_Burst.mp3', + type: 'audio/mp3' + }, { + src: 'https://cdn.plyr.io/static/demo/Kishi_Bashi_-_It_All_Began_With_a_Burst.ogg', + type: 'audio/ogg' + }] + }; + + break; + + case types.youtube: + player.source = { + type: 'video', + sources: [{ + src: 'https://youtube.com/watch?v=bTqVqk7FSmY', + provider: 'youtube' + }] + }; + + break; + + case types.vimeo: + player.source = { + type: 'video', + sources: [{ + src: 'https://vimeo.com/76979871', + provider: 'vimeo' + }] + }; + + break; + + default: + break; + } + + // Set the current type for next time + currentType = type; + + // Remove active classes + Array.from(buttons).forEach(function (button) { + return toggleClass(button.parentElement, 'active', false); + }); + + // Set active on parent + toggleClass(document.querySelector('[data-source="' + type + '"]'), 'active', true); + + // Show cite + Array.from(document.querySelectorAll('.plyr__cite')).forEach(function (cite) { + cite.setAttribute('hidden', ''); + }); + document.querySelector('.plyr__cite--' + type).removeAttribute('hidden'); + } + + // Bind to each button + Array.from(buttons).forEach(function (button) { + button.addEventListener('click', function () { + var type = button.getAttribute('data-source'); + + newSource(type); + + if (historySupport) { + window.history.pushState({ type: type }, '', '#' + type); + } + }); + }); + + // List for backwards/forwards + window.addEventListener('popstate', function (event) { + if (event.state && 'type' in event.state) { + newSource(event.state.type); + } + }); + + // On load + if (historySupport) { + var video = !currentType.length; + + // If there's no current type set, assume video + if (video) { + currentType = types.video; + } + + // Replace current history state + if (currentType in types) { + window.history.replaceState({ + type: currentType + }, '', video ? '' : '#' + currentType); + } + + // If it's not video, load the source + if (currentType !== types.video) { + newSource(currentType, true); + } + } + }); + }); + + // Google analytics + // For demo site (https://plyr.io) only + /* eslint-disable */ + if (isLive) { + (function (i, s, o, g, r, a, m) { + i.GoogleAnalyticsObject = r; + i[r] = i[r] || function () { + (i[r].q = i[r].q || []).push(arguments); + }; + i[r].l = 1 * new Date(); + a = s.createElement(o); + m = s.getElementsByTagName(o)[0]; + a.async = 1; + a.src = g; + m.parentNode.insertBefore(a, m); + })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga'); + window.ga('create', 'UA-40881672-11', 'auto'); + window.ga('send', 'pageview'); + } + /* eslint-enable */ + })(); + +}()); + +//# sourceMappingURL=demo.js.map diff --git a/demo/dist/demo.js.map b/demo/dist/demo.js.map new file mode 100644 index 00000000..ab899963 --- /dev/null +++ b/demo/dist/demo.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["node_modules/raven-js/vendor/json-stringify-safe/stringify.js","node_modules/raven-js/src/utils.js","node_modules/raven-js/vendor/TraceKit/tracekit.js","node_modules/raven-js/vendor/md5/md5.js","node_modules/raven-js/src/configError.js","node_modules/raven-js/src/console.js","node_modules/raven-js/src/raven.js","node_modules/raven-js/src/singleton.js","demo/src/js/demo.js"],"names":["global","stringify","_window","isErrorEvent","isDOMError","isDOMException","isError","isObject","isPlainObject","isUndefined","isFunction","isString","isArray","isEmptyObject","each","objectMerge","truncate","objectFrozen","hasKey","joinRegExp","urlencode","uuid4","htmlTreeAsString","isSameException","isSameStacktrace","parseUrl","fill","supportsFetch","supportsReferrerPolicy","serializeKeysForMessage","serializeException","sanitize","require$$0","TraceKit","md5","RavenConfigError","Raven","RavenConstructor","isLive","window","location","host","config","install","document","addEventListener","context","selector","container","getElementById","shr","setup","count","classname","tabClassName","contains","event","target","classList","remove","keyCode","setTimeout","focused","activeElement","add","player","Plyr","debug","title","iconUrl","keyboard","tooltips","controls","seek","captions","active","keys","google","ads","publisherId","buttons","querySelectorAll","types","video","audio","youtube","vimeo","currentType","hash","replace","historySupport","history","pushState","toggleClass","element","className","state","newSource","type","init","length","source","sources","src","size","poster","tracks","kind","label","srclang","default","provider","Array","from","forEach","button","parentElement","querySelector","cite","setAttribute","removeAttribute","getAttribute","replaceState","i","s","o","g","r","a","m","GoogleAnalyticsObject","q","push","arguments","l","Date","createElement","getElementsByTagName","async","parentNode","insertBefore","ga"],"mappings":";;;;;;;;;;CAAA;;;;;;;;;;;CAWA,OAAO,GAAG,cAAc,GAAG,SAAS,CAAC;CACrC,oBAAoB,GAAG,UAAU,CAAC;;CAElC,SAAS,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE;GACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;KACxC,IAAI,QAAQ,CAAC,CAAC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AAxB,EAA2BC,CAA3B,EAA8B;CAC3BN,cAAEO,qBAAF,GAA0BH,CAA1B;CACAJ,cAAEI,CAAF,IACIJ,EAAEI,CAAF,KACA,YAAW;CACP,iBAACJ,EAAEI,CAAF,EAAKI,CAAL,GAASR,EAAEI,CAAF,EAAKI,CAAL,IAAU,EAApB,EAAwBC,IAAxB,CAA6BC,SAA7B;CACH,aAJL;CAKAV,cAAEI,CAAF,EAAKO,CAAL,GAAS,IAAI,IAAIC,IAAJ,EAAb;CACAP,gBAAIJ,EAAEY,aAAF,CAAgBX,CAAhB,CAAJ;CACAI,gBAAIL,EAAEa,oBAAF,CAAuBZ,CAAvB,EAA0B,CAA1B,CAAJ;CACAG,cAAEU,KAAF,GAAU,CAAV;CACAV,cAAEzB,GAAF,GAAQuB,CAAR;CACAG,cAAEU,UAAF,CAAaC,YAAb,CAA0BZ,CAA1B,EAA6BC,CAA7B;CACH,SAbD,EAcI1F,MAdJ,EAeIK,QAfJ,EAgBI,QAhBJ,EAiBI,+CAjBJ,EAkBI,IAlBJ;CAoBAL,eAAOsG,EAAP,CAAU,QAAV,EAAoB,gBAApB,EAAsC,MAAtC;CACAtG,eAAOsG,EAAP,CAAU,MAAV,EAAkB,UAAlB;CACH;CACD;CACH,CAjXD","file":"demo.js","sourcesContent":["/*\n json-stringify-safe\n Like JSON.stringify, but doesn't throw on circular references.\n\n Originally forked from https://github.com/isaacs/json-stringify-safe\n version 5.0.1 on 3/8/2017 and modified to handle Errors serialization\n and IE8 compatibility. Tests for this are in test/vendor.\n\n ISC license: https://github.com/isaacs/json-stringify-safe/blob/master/LICENSE\n*/\n\nexports = module.exports = stringify;\nexports.getSerialize = serializer;\n\nfunction indexOf(haystack, needle) {\n for (var i = 0; i < haystack.length; ++i) {\n if (haystack[i] === needle) return i;\n }\n return -1;\n}\n\nfunction stringify(obj, replacer, spaces, cycleReplacer) {\n return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces);\n}\n\n// https://github.com/ftlabs/js-abbreviate/blob/fa709e5f139e7770a71827b1893f22418097fbda/index.js#L95-L106\nfunction stringifyError(value) {\n var err = {\n // These properties are implemented as magical getters and don't show up in for in\n stack: value.stack,\n message: value.message,\n name: value.name\n };\n\n for (var i in value) {\n if (Object.prototype.hasOwnProperty.call(value, i)) {\n err[i] = value[i];\n }\n }\n\n return err;\n}\n\nfunction serializer(replacer, cycleReplacer) {\n var stack = [];\n var keys = [];\n\n if (cycleReplacer == null) {\n cycleReplacer = function(key, value) {\n if (stack[0] === value) {\n return '[Circular ~]';\n }\n return '[Circular ~.' + keys.slice(0, indexOf(stack, value)).join('.') + ']';\n };\n }\n\n return function(key, value) {\n if (stack.length > 0) {\n var thisPos = indexOf(stack, this);\n ~thisPos ? stack.splice(thisPos + 1) : stack.push(this);\n ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key);\n\n if (~indexOf(stack, value)) {\n value = cycleReplacer.call(this, key, value);\n }\n } else {\n stack.push(value);\n }\n\n return replacer == null\n ? value instanceof Error ? stringifyError(value) : value\n : replacer.call(this, key, value);\n };\n}\n","var stringify = require('../vendor/json-stringify-safe/stringify');\n\nvar _window =\n typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : typeof self !== 'undefined'\n ? self\n : {};\n\nfunction isObject(what) {\n return typeof what === 'object' && what !== null;\n}\n\n// Yanked from https://git.io/vS8DV re-used under CC0\n// with some tiny modifications\nfunction isError(value) {\n switch (Object.prototype.toString.call(value)) {\n case '[object Error]':\n return true;\n case '[object Exception]':\n return true;\n case '[object DOMException]':\n return true;\n default:\n return value instanceof Error;\n }\n}\n\nfunction isErrorEvent(value) {\n return Object.prototype.toString.call(value) === '[object ErrorEvent]';\n}\n\nfunction isDOMError(value) {\n return Object.prototype.toString.call(value) === '[object DOMError]';\n}\n\nfunction isDOMException(value) {\n return Object.prototype.toString.call(value) === '[object DOMException]';\n}\n\nfunction isUndefined(what) {\n return what === void 0;\n}\n\nfunction isFunction(what) {\n return typeof what === 'function';\n}\n\nfunction isPlainObject(what) {\n return Object.prototype.toString.call(what) === '[object Object]';\n}\n\nfunction isString(what) {\n return Object.prototype.toString.call(what) === '[object String]';\n}\n\nfunction isArray(what) {\n return Object.prototype.toString.call(what) === '[object Array]';\n}\n\nfunction isEmptyObject(what) {\n if (!isPlainObject(what)) return false;\n\n for (var _ in what) {\n if (what.hasOwnProperty(_)) {\n return false;\n }\n }\n return true;\n}\n\nfunction supportsErrorEvent() {\n try {\n new ErrorEvent(''); // eslint-disable-line no-new\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction supportsDOMError() {\n try {\n new DOMError(''); // eslint-disable-line no-new\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction supportsDOMException() {\n try {\n new DOMException(''); // eslint-disable-line no-new\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction supportsFetch() {\n if (!('fetch' in _window)) return false;\n\n try {\n new Headers(); // eslint-disable-line no-new\n new Request(''); // eslint-disable-line no-new\n new Response(); // eslint-disable-line no-new\n return true;\n } catch (e) {\n return false;\n }\n}\n\n// Despite all stars in the sky saying that Edge supports old draft syntax, aka 'never', 'always', 'origin' and 'default\n// https://caniuse.com/#feat=referrer-policy\n// It doesn't. And it throw exception instead of ignoring this parameter...\n// REF: https://github.com/getsentry/raven-js/issues/1233\nfunction supportsReferrerPolicy() {\n if (!supportsFetch()) return false;\n\n try {\n // eslint-disable-next-line no-new\n new Request('pickleRick', {\n referrerPolicy: 'origin'\n });\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction supportsPromiseRejectionEvent() {\n return typeof PromiseRejectionEvent === 'function';\n}\n\nfunction wrappedCallback(callback) {\n function dataCallback(data, original) {\n var normalizedData = callback(data) || data;\n if (original) {\n return original(normalizedData) || normalizedData;\n }\n return normalizedData;\n }\n\n return dataCallback;\n}\n\nfunction each(obj, callback) {\n var i, j;\n\n if (isUndefined(obj.length)) {\n for (i in obj) {\n if (hasKey(obj, i)) {\n callback.call(null, i, obj[i]);\n }\n }\n } else {\n j = obj.length;\n if (j) {\n for (i = 0; i < j; i++) {\n callback.call(null, i, obj[i]);\n }\n }\n }\n}\n\nfunction objectMerge(obj1, obj2) {\n if (!obj2) {\n return obj1;\n }\n each(obj2, function(key, value) {\n obj1[key] = value;\n });\n return obj1;\n}\n\n/**\n * This function is only used for react-native.\n * react-native freezes object that have already been sent over the\n * js bridge. We need this function in order to check if the object is frozen.\n * So it's ok that objectFrozen returns false if Object.isFrozen is not\n * supported because it's not relevant for other \"platforms\". See related issue:\n * https://github.com/getsentry/react-native-sentry/issues/57\n */\nfunction objectFrozen(obj) {\n if (!Object.isFrozen) {\n return false;\n }\n return Object.isFrozen(obj);\n}\n\nfunction truncate(str, max) {\n if (typeof max !== 'number') {\n throw new Error('2nd argument to `truncate` function should be a number');\n }\n if (typeof str !== 'string' || max === 0) {\n return str;\n }\n return str.length <= max ? str : str.substr(0, max) + '\\u2026';\n}\n\n/**\n * hasKey, a better form of hasOwnProperty\n * Example: hasKey(MainHostObject, property) === true/false\n *\n * @param {Object} host object to check property\n * @param {string} key to check\n */\nfunction hasKey(object, key) {\n return Object.prototype.hasOwnProperty.call(object, key);\n}\n\nfunction joinRegExp(patterns) {\n // Combine an array of regular expressions and strings into one large regexp\n // Be mad.\n var sources = [],\n i = 0,\n len = patterns.length,\n pattern;\n\n for (; i < len; i++) {\n pattern = patterns[i];\n if (isString(pattern)) {\n // If it's a string, we need to escape it\n // Taken from: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions\n sources.push(pattern.replace(/([.*+?^=!:${}()|\\[\\]\\/\\\\])/g, '\\\\$1'));\n } else if (pattern && pattern.source) {\n // If it's a regexp already, we want to extract the source\n sources.push(pattern.source);\n }\n // Intentionally skip other cases\n }\n return new RegExp(sources.join('|'), 'i');\n}\n\nfunction urlencode(o) {\n var pairs = [];\n each(o, function(key, value) {\n pairs.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));\n });\n return pairs.join('&');\n}\n\n// borrowed from https://tools.ietf.org/html/rfc3986#appendix-B\n// intentionally using regex and not href parsing trick because React Native and other\n// environments where DOM might not be available\nfunction parseUrl(url) {\n if (typeof url !== 'string') return {};\n var match = url.match(/^(([^:\\/?#]+):)?(\\/\\/([^\\/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$/);\n\n // coerce to undefined values to empty string so we don't get 'undefined'\n var query = match[6] || '';\n var fragment = match[8] || '';\n return {\n protocol: match[2],\n host: match[4],\n path: match[5],\n relative: match[5] + query + fragment // everything minus origin\n };\n}\nfunction uuid4() {\n var crypto = _window.crypto || _window.msCrypto;\n\n if (!isUndefined(crypto) && crypto.getRandomValues) {\n // Use window.crypto API if available\n // eslint-disable-next-line no-undef\n var arr = new Uint16Array(8);\n crypto.getRandomValues(arr);\n\n // set 4 in byte 7\n arr[3] = (arr[3] & 0xfff) | 0x4000;\n // set 2 most significant bits of byte 9 to '10'\n arr[4] = (arr[4] & 0x3fff) | 0x8000;\n\n var pad = function(num) {\n var v = num.toString(16);\n while (v.length < 4) {\n v = '0' + v;\n }\n return v;\n };\n\n return (\n pad(arr[0]) +\n pad(arr[1]) +\n pad(arr[2]) +\n pad(arr[3]) +\n pad(arr[4]) +\n pad(arr[5]) +\n pad(arr[6]) +\n pad(arr[7])\n );\n } else {\n // http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#2117523\n return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n var r = (Math.random() * 16) | 0,\n v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n }\n}\n\n/**\n * Given a child DOM element, returns a query-selector statement describing that\n * and its ancestors\n * e.g. [HTMLElement] => body > div > input#foo.btn[name=baz]\n * @param elem\n * @returns {string}\n */\nfunction htmlTreeAsString(elem) {\n /* eslint no-extra-parens:0*/\n var MAX_TRAVERSE_HEIGHT = 5,\n MAX_OUTPUT_LEN = 80,\n out = [],\n height = 0,\n len = 0,\n separator = ' > ',\n sepLength = separator.length,\n nextStr;\n\n while (elem && height++ < MAX_TRAVERSE_HEIGHT) {\n nextStr = htmlElementAsString(elem);\n // bail out if\n // - nextStr is the 'html' element\n // - the length of the string that would be created exceeds MAX_OUTPUT_LEN\n // (ignore this limit if we are on the first iteration)\n if (\n nextStr === 'html' ||\n (height > 1 && len + out.length * sepLength + nextStr.length >= MAX_OUTPUT_LEN)\n ) {\n break;\n }\n\n out.push(nextStr);\n\n len += nextStr.length;\n elem = elem.parentNode;\n }\n\n return out.reverse().join(separator);\n}\n\n/**\n * Returns a simple, query-selector representation of a DOM element\n * e.g. [HTMLElement] => input#foo.btn[name=baz]\n * @param HTMLElement\n * @returns {string}\n */\nfunction htmlElementAsString(elem) {\n var out = [],\n className,\n classes,\n key,\n attr,\n i;\n\n if (!elem || !elem.tagName) {\n return '';\n }\n\n out.push(elem.tagName.toLowerCase());\n if (elem.id) {\n out.push('#' + elem.id);\n }\n\n className = elem.className;\n if (className && isString(className)) {\n classes = className.split(/\\s+/);\n for (i = 0; i < classes.length; i++) {\n out.push('.' + classes[i]);\n }\n }\n var attrWhitelist = ['type', 'name', 'title', 'alt'];\n for (i = 0; i < attrWhitelist.length; i++) {\n key = attrWhitelist[i];\n attr = elem.getAttribute(key);\n if (attr) {\n out.push('[' + key + '=\"' + attr + '\"]');\n }\n }\n return out.join('');\n}\n\n/**\n * Returns true if either a OR b is truthy, but not both\n */\nfunction isOnlyOneTruthy(a, b) {\n return !!(!!a ^ !!b);\n}\n\n/**\n * Returns true if both parameters are undefined\n */\nfunction isBothUndefined(a, b) {\n return isUndefined(a) && isUndefined(b);\n}\n\n/**\n * Returns true if the two input exception interfaces have the same content\n */\nfunction isSameException(ex1, ex2) {\n if (isOnlyOneTruthy(ex1, ex2)) return false;\n\n ex1 = ex1.values[0];\n ex2 = ex2.values[0];\n\n if (ex1.type !== ex2.type || ex1.value !== ex2.value) return false;\n\n // in case both stacktraces are undefined, we can't decide so default to false\n if (isBothUndefined(ex1.stacktrace, ex2.stacktrace)) return false;\n\n return isSameStacktrace(ex1.stacktrace, ex2.stacktrace);\n}\n\n/**\n * Returns true if the two input stack trace interfaces have the same content\n */\nfunction isSameStacktrace(stack1, stack2) {\n if (isOnlyOneTruthy(stack1, stack2)) return false;\n\n var frames1 = stack1.frames;\n var frames2 = stack2.frames;\n\n // Exit early if stacktrace is malformed\n if (frames1 === undefined || frames2 === undefined) return false;\n\n // Exit early if frame count differs\n if (frames1.length !== frames2.length) return false;\n\n // Iterate through every frame; bail out if anything differs\n var a, b;\n for (var i = 0; i < frames1.length; i++) {\n a = frames1[i];\n b = frames2[i];\n if (\n a.filename !== b.filename ||\n a.lineno !== b.lineno ||\n a.colno !== b.colno ||\n a['function'] !== b['function']\n )\n return false;\n }\n return true;\n}\n\n/**\n * Polyfill a method\n * @param obj object e.g. `document`\n * @param name method name present on object e.g. `addEventListener`\n * @param replacement replacement function\n * @param track {optional} record instrumentation to an array\n */\nfunction fill(obj, name, replacement, track) {\n if (obj == null) return;\n var orig = obj[name];\n obj[name] = replacement(orig);\n obj[name].__raven__ = true;\n obj[name].__orig__ = orig;\n if (track) {\n track.push([obj, name, orig]);\n }\n}\n\n/**\n * Join values in array\n * @param input array of values to be joined together\n * @param delimiter string to be placed in-between values\n * @returns {string}\n */\nfunction safeJoin(input, delimiter) {\n if (!isArray(input)) return '';\n\n var output = [];\n\n for (var i = 0; i < input.length; i++) {\n try {\n output.push(String(input[i]));\n } catch (e) {\n output.push('[value cannot be serialized]');\n }\n }\n\n return output.join(delimiter);\n}\n\n// Default Node.js REPL depth\nvar MAX_SERIALIZE_EXCEPTION_DEPTH = 3;\n// 50kB, as 100kB is max payload size, so half sounds reasonable\nvar MAX_SERIALIZE_EXCEPTION_SIZE = 50 * 1024;\nvar MAX_SERIALIZE_KEYS_LENGTH = 40;\n\nfunction utf8Length(value) {\n return ~-encodeURI(value).split(/%..|./).length;\n}\n\nfunction jsonSize(value) {\n return utf8Length(JSON.stringify(value));\n}\n\nfunction serializeValue(value) {\n if (typeof value === 'string') {\n var maxLength = 40;\n return truncate(value, maxLength);\n } else if (\n typeof value === 'number' ||\n typeof value === 'boolean' ||\n typeof value === 'undefined'\n ) {\n return value;\n }\n\n var type = Object.prototype.toString.call(value);\n\n // Node.js REPL notation\n if (type === '[object Object]') return '[Object]';\n if (type === '[object Array]') return '[Array]';\n if (type === '[object Function]')\n return value.name ? '[Function: ' + value.name + ']' : '[Function]';\n\n return value;\n}\n\nfunction serializeObject(value, depth) {\n if (depth === 0) return serializeValue(value);\n\n if (isPlainObject(value)) {\n return Object.keys(value).reduce(function(acc, key) {\n acc[key] = serializeObject(value[key], depth - 1);\n return acc;\n }, {});\n } else if (Array.isArray(value)) {\n return value.map(function(val) {\n return serializeObject(val, depth - 1);\n });\n }\n\n return serializeValue(value);\n}\n\nfunction serializeException(ex, depth, maxSize) {\n if (!isPlainObject(ex)) return ex;\n\n depth = typeof depth !== 'number' ? MAX_SERIALIZE_EXCEPTION_DEPTH : depth;\n maxSize = typeof depth !== 'number' ? MAX_SERIALIZE_EXCEPTION_SIZE : maxSize;\n\n var serialized = serializeObject(ex, depth);\n\n if (jsonSize(stringify(serialized)) > maxSize) {\n return serializeException(ex, depth - 1);\n }\n\n return serialized;\n}\n\nfunction serializeKeysForMessage(keys, maxLength) {\n if (typeof keys === 'number' || typeof keys === 'string') return keys.toString();\n if (!Array.isArray(keys)) return '';\n\n keys = keys.filter(function(key) {\n return typeof key === 'string';\n });\n if (keys.length === 0) return '[object has no keys]';\n\n maxLength = typeof maxLength !== 'number' ? MAX_SERIALIZE_KEYS_LENGTH : maxLength;\n if (keys[0].length >= maxLength) return keys[0];\n\n for (var usedKeys = keys.length; usedKeys > 0; usedKeys--) {\n var serialized = keys.slice(0, usedKeys).join(', ');\n if (serialized.length > maxLength) continue;\n if (usedKeys === keys.length) return serialized;\n return serialized + '\\u2026';\n }\n\n return '';\n}\n\nfunction sanitize(input, sanitizeKeys) {\n if (!isArray(sanitizeKeys) || (isArray(sanitizeKeys) && sanitizeKeys.length === 0))\n return input;\n\n var sanitizeRegExp = joinRegExp(sanitizeKeys);\n var sanitizeMask = '********';\n var safeInput;\n\n try {\n safeInput = JSON.parse(stringify(input));\n } catch (o_O) {\n return input;\n }\n\n function sanitizeWorker(workerInput) {\n if (isArray(workerInput)) {\n return workerInput.map(function(val) {\n return sanitizeWorker(val);\n });\n }\n\n if (isPlainObject(workerInput)) {\n return Object.keys(workerInput).reduce(function(acc, k) {\n if (sanitizeRegExp.test(k)) {\n acc[k] = sanitizeMask;\n } else {\n acc[k] = sanitizeWorker(workerInput[k]);\n }\n return acc;\n }, {});\n }\n\n return workerInput;\n }\n\n return sanitizeWorker(safeInput);\n}\n\nmodule.exports = {\n isObject: isObject,\n isError: isError,\n isErrorEvent: isErrorEvent,\n isDOMError: isDOMError,\n isDOMException: isDOMException,\n isUndefined: isUndefined,\n isFunction: isFunction,\n isPlainObject: isPlainObject,\n isString: isString,\n isArray: isArray,\n isEmptyObject: isEmptyObject,\n supportsErrorEvent: supportsErrorEvent,\n supportsDOMError: supportsDOMError,\n supportsDOMException: supportsDOMException,\n supportsFetch: supportsFetch,\n supportsReferrerPolicy: supportsReferrerPolicy,\n supportsPromiseRejectionEvent: supportsPromiseRejectionEvent,\n wrappedCallback: wrappedCallback,\n each: each,\n objectMerge: objectMerge,\n truncate: truncate,\n objectFrozen: objectFrozen,\n hasKey: hasKey,\n joinRegExp: joinRegExp,\n urlencode: urlencode,\n uuid4: uuid4,\n htmlTreeAsString: htmlTreeAsString,\n htmlElementAsString: htmlElementAsString,\n isSameException: isSameException,\n isSameStacktrace: isSameStacktrace,\n parseUrl: parseUrl,\n fill: fill,\n safeJoin: safeJoin,\n serializeException: serializeException,\n serializeKeysForMessage: serializeKeysForMessage,\n sanitize: sanitize\n};\n","var utils = require('../../src/utils');\n\n/*\n TraceKit - Cross brower stack traces\n\n This was originally forked from github.com/occ/TraceKit, but has since been\n largely re-written and is now maintained as part of raven-js. Tests for\n this are in test/vendor.\n\n MIT license\n*/\n\nvar TraceKit = {\n collectWindowErrors: true,\n debug: false\n};\n\n// This is to be defensive in environments where window does not exist (see https://github.com/getsentry/raven-js/pull/785)\nvar _window =\n typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\n\n// global reference to slice\nvar _slice = [].slice;\nvar UNKNOWN_FUNCTION = '?';\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Error_types\nvar ERROR_TYPES_RE = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;\n\nfunction getLocationHref() {\n if (typeof document === 'undefined' || document.location == null) return '';\n return document.location.href;\n}\n\nfunction getLocationOrigin() {\n if (typeof document === 'undefined' || document.location == null) return '';\n\n // Oh dear IE10...\n if (!document.location.origin) {\n return (\n document.location.protocol +\n '//' +\n document.location.hostname +\n (document.location.port ? ':' + document.location.port : '')\n );\n }\n\n return document.location.origin;\n}\n\n/**\n * TraceKit.report: cross-browser processing of unhandled exceptions\n *\n * Syntax:\n * TraceKit.report.subscribe(function(stackInfo) { ... })\n * TraceKit.report.unsubscribe(function(stackInfo) { ... })\n * TraceKit.report(exception)\n * try { ...code... } catch(ex) { TraceKit.report(ex); }\n *\n * Supports:\n * - Firefox: full stack trace with line numbers, plus column number\n * on top frame; column number is not guaranteed\n * - Opera: full stack trace with line and column numbers\n * - Chrome: full stack trace with line and column numbers\n * - Safari: line and column number for the top frame only; some frames\n * may be missing, and column number is not guaranteed\n * - IE: line and column number for the top frame only; some frames\n * may be missing, and column number is not guaranteed\n *\n * In theory, TraceKit should work on all of the following versions:\n * - IE5.5+ (only 8.0 tested)\n * - Firefox 0.9+ (only 3.5+ tested)\n * - Opera 7+ (only 10.50 tested; versions 9 and earlier may require\n * Exceptions Have Stacktrace to be enabled in opera:config)\n * - Safari 3+ (only 4+ tested)\n * - Chrome 1+ (only 5+ tested)\n * - Konqueror 3.5+ (untested)\n *\n * Requires TraceKit.computeStackTrace.\n *\n * Tries to catch all unhandled exceptions and report them to the\n * subscribed handlers. Please note that TraceKit.report will rethrow the\n * exception. This is REQUIRED in order to get a useful stack trace in IE.\n * If the exception does not reach the top of the browser, you will only\n * get a stack trace from the point where TraceKit.report was called.\n *\n * Handlers receive a stackInfo object as described in the\n * TraceKit.computeStackTrace docs.\n */\nTraceKit.report = (function reportModuleWrapper() {\n var handlers = [],\n lastArgs = null,\n lastException = null,\n lastExceptionStack = null;\n\n /**\n * Add a crash handler.\n * @param {Function} handler\n */\n function subscribe(handler) {\n installGlobalHandler();\n handlers.push(handler);\n }\n\n /**\n * Remove a crash handler.\n * @param {Function} handler\n */\n function unsubscribe(handler) {\n for (var i = handlers.length - 1; i >= 0; --i) {\n if (handlers[i] === handler) {\n handlers.splice(i, 1);\n }\n }\n }\n\n /**\n * Remove all crash handlers.\n */\n function unsubscribeAll() {\n uninstallGlobalHandler();\n handlers = [];\n }\n\n /**\n * Dispatch stack information to all handlers.\n * @param {Object.} stack\n */\n function notifyHandlers(stack, isWindowError) {\n var exception = null;\n if (isWindowError && !TraceKit.collectWindowErrors) {\n return;\n }\n for (var i in handlers) {\n if (handlers.hasOwnProperty(i)) {\n try {\n handlers[i].apply(null, [stack].concat(_slice.call(arguments, 2)));\n } catch (inner) {\n exception = inner;\n }\n }\n }\n\n if (exception) {\n throw exception;\n }\n }\n\n var _oldOnerrorHandler, _onErrorHandlerInstalled;\n\n /**\n * Ensures all global unhandled exceptions are recorded.\n * Supported by Gecko and IE.\n * @param {string} msg Error message.\n * @param {string} url URL of script that generated the exception.\n * @param {(number|string)} lineNo The line number at which the error\n * occurred.\n * @param {?(number|string)} colNo The column number at which the error\n * occurred.\n * @param {?Error} ex The actual Error object.\n */\n function traceKitWindowOnError(msg, url, lineNo, colNo, ex) {\n var stack = null;\n // If 'ex' is ErrorEvent, get real Error from inside\n var exception = utils.isErrorEvent(ex) ? ex.error : ex;\n // If 'msg' is ErrorEvent, get real message from inside\n var message = utils.isErrorEvent(msg) ? msg.message : msg;\n\n if (lastExceptionStack) {\n TraceKit.computeStackTrace.augmentStackTraceWithInitialElement(\n lastExceptionStack,\n url,\n lineNo,\n message\n );\n processLastException();\n } else if (exception && utils.isError(exception)) {\n // non-string `exception` arg; attempt to extract stack trace\n\n // New chrome and blink send along a real error object\n // Let's just report that like a normal error.\n // See: https://mikewest.org/2013/08/debugging-runtime-errors-with-window-onerror\n stack = TraceKit.computeStackTrace(exception);\n notifyHandlers(stack, true);\n } else {\n var location = {\n url: url,\n line: lineNo,\n column: colNo\n };\n\n var name = undefined;\n var groups;\n\n if ({}.toString.call(message) === '[object String]') {\n var groups = message.match(ERROR_TYPES_RE);\n if (groups) {\n name = groups[1];\n message = groups[2];\n }\n }\n\n location.func = UNKNOWN_FUNCTION;\n\n stack = {\n name: name,\n message: message,\n url: getLocationHref(),\n stack: [location]\n };\n notifyHandlers(stack, true);\n }\n\n if (_oldOnerrorHandler) {\n return _oldOnerrorHandler.apply(this, arguments);\n }\n\n return false;\n }\n\n function installGlobalHandler() {\n if (_onErrorHandlerInstalled) {\n return;\n }\n _oldOnerrorHandler = _window.onerror;\n _window.onerror = traceKitWindowOnError;\n _onErrorHandlerInstalled = true;\n }\n\n function uninstallGlobalHandler() {\n if (!_onErrorHandlerInstalled) {\n return;\n }\n _window.onerror = _oldOnerrorHandler;\n _onErrorHandlerInstalled = false;\n _oldOnerrorHandler = undefined;\n }\n\n function processLastException() {\n var _lastExceptionStack = lastExceptionStack,\n _lastArgs = lastArgs;\n lastArgs = null;\n lastExceptionStack = null;\n lastException = null;\n notifyHandlers.apply(null, [_lastExceptionStack, false].concat(_lastArgs));\n }\n\n /**\n * Reports an unhandled Error to TraceKit.\n * @param {Error} ex\n * @param {?boolean} rethrow If false, do not re-throw the exception.\n * Only used for window.onerror to not cause an infinite loop of\n * rethrowing.\n */\n function report(ex, rethrow) {\n var args = _slice.call(arguments, 1);\n if (lastExceptionStack) {\n if (lastException === ex) {\n return; // already caught by an inner catch block, ignore\n } else {\n processLastException();\n }\n }\n\n var stack = TraceKit.computeStackTrace(ex);\n lastExceptionStack = stack;\n lastException = ex;\n lastArgs = args;\n\n // If the stack trace is incomplete, wait for 2 seconds for\n // slow slow IE to see if onerror occurs or not before reporting\n // this exception; otherwise, we will end up with an incomplete\n // stack trace\n setTimeout(function() {\n if (lastException === ex) {\n processLastException();\n }\n }, stack.incomplete ? 2000 : 0);\n\n if (rethrow !== false) {\n throw ex; // re-throw to propagate to the top level (and cause window.onerror)\n }\n }\n\n report.subscribe = subscribe;\n report.unsubscribe = unsubscribe;\n report.uninstall = unsubscribeAll;\n return report;\n})();\n\n/**\n * TraceKit.computeStackTrace: cross-browser stack traces in JavaScript\n *\n * Syntax:\n * s = TraceKit.computeStackTrace(exception) // consider using TraceKit.report instead (see below)\n * Returns:\n * s.name - exception name\n * s.message - exception message\n * s.stack[i].url - JavaScript or HTML file URL\n * s.stack[i].func - function name, or empty for anonymous functions (if guessing did not work)\n * s.stack[i].args - arguments passed to the function, if known\n * s.stack[i].line - line number, if known\n * s.stack[i].column - column number, if known\n *\n * Supports:\n * - Firefox: full stack trace with line numbers and unreliable column\n * number on top frame\n * - Opera 10: full stack trace with line and column numbers\n * - Opera 9-: full stack trace with line numbers\n * - Chrome: full stack trace with line and column numbers\n * - Safari: line and column number for the topmost stacktrace element\n * only\n * - IE: no line numbers whatsoever\n *\n * Tries to guess names of anonymous functions by looking for assignments\n * in the source code. In IE and Safari, we have to guess source file names\n * by searching for function bodies inside all page scripts. This will not\n * work for scripts that are loaded cross-domain.\n * Here be dragons: some function names may be guessed incorrectly, and\n * duplicate functions may be mismatched.\n *\n * TraceKit.computeStackTrace should only be used for tracing purposes.\n * Logging of unhandled exceptions should be done with TraceKit.report,\n * which builds on top of TraceKit.computeStackTrace and provides better\n * IE support by utilizing the window.onerror event to retrieve information\n * about the top of the stack.\n *\n * Note: In IE and Safari, no stack trace is recorded on the Error object,\n * so computeStackTrace instead walks its *own* chain of callers.\n * This means that:\n * * in Safari, some methods may be missing from the stack trace;\n * * in IE, the topmost function in the stack trace will always be the\n * caller of computeStackTrace.\n *\n * This is okay for tracing (because you are likely to be calling\n * computeStackTrace from the function you want to be the topmost element\n * of the stack trace anyway), but not okay for logging unhandled\n * exceptions (because your catch block will likely be far away from the\n * inner function that actually caused the exception).\n *\n */\nTraceKit.computeStackTrace = (function computeStackTraceWrapper() {\n // Contents of Exception in various browsers.\n //\n // SAFARI:\n // ex.message = Can't find variable: qq\n // ex.line = 59\n // ex.sourceId = 580238192\n // ex.sourceURL = http://...\n // ex.expressionBeginOffset = 96\n // ex.expressionCaretOffset = 98\n // ex.expressionEndOffset = 98\n // ex.name = ReferenceError\n //\n // FIREFOX:\n // ex.message = qq is not defined\n // ex.fileName = http://...\n // ex.lineNumber = 59\n // ex.columnNumber = 69\n // ex.stack = ...stack trace... (see the example below)\n // ex.name = ReferenceError\n //\n // CHROME:\n // ex.message = qq is not defined\n // ex.name = ReferenceError\n // ex.type = not_defined\n // ex.arguments = ['aa']\n // ex.stack = ...stack trace...\n //\n // INTERNET EXPLORER:\n // ex.message = ...\n // ex.name = ReferenceError\n //\n // OPERA:\n // ex.message = ...message... (see the example below)\n // ex.name = ReferenceError\n // ex.opera#sourceloc = 11 (pretty much useless, duplicates the info in ex.message)\n // ex.stacktrace = n/a; see 'opera:config#UserPrefs|Exceptions Have Stacktrace'\n\n /**\n * Computes stack trace information from the stack property.\n * Chrome and Gecko use this property.\n * @param {Error} ex\n * @return {?Object.} Stack trace information.\n */\n function computeStackTraceFromStackProp(ex) {\n if (typeof ex.stack === 'undefined' || !ex.stack) return;\n\n var chrome = /^\\s*at (?:(.*?) ?\\()?((?:file|https?|blob|chrome-extension|native|eval|webpack||[a-z]:|\\/).*?)(?::(\\d+))?(?::(\\d+))?\\)?\\s*$/i;\n var winjs = /^\\s*at (?:((?:\\[object object\\])?.+) )?\\(?((?:file|ms-appx(?:-web)|https?|webpack|blob):.*?):(\\d+)(?::(\\d+))?\\)?\\s*$/i;\n // NOTE: blob urls are now supposed to always have an origin, therefore it's format\n // which is `blob:http://url/path/with-some-uuid`, is matched by `blob.*?:\\/` as well\n var gecko = /^\\s*(.*?)(?:\\((.*?)\\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|moz-extension).*?:\\/.*?|\\[native code\\]|[^@]*bundle)(?::(\\d+))?(?::(\\d+))?\\s*$/i;\n // Used to additionally parse URL/line/column from eval frames\n var geckoEval = /(\\S+) line (\\d+)(?: > eval line \\d+)* > eval/i;\n var chromeEval = /\\((\\S*)(?::(\\d+))(?::(\\d+))\\)/;\n var lines = ex.stack.split('\\n');\n var stack = [];\n var submatch;\n var parts;\n var element;\n var reference = /^(.*) is undefined$/.exec(ex.message);\n\n for (var i = 0, j = lines.length; i < j; ++i) {\n if ((parts = chrome.exec(lines[i]))) {\n var isNative = parts[2] && parts[2].indexOf('native') === 0; // start of line\n var isEval = parts[2] && parts[2].indexOf('eval') === 0; // start of line\n if (isEval && (submatch = chromeEval.exec(parts[2]))) {\n // throw out eval line/column and use top-most line/column number\n parts[2] = submatch[1]; // url\n parts[3] = submatch[2]; // line\n parts[4] = submatch[3]; // column\n }\n element = {\n url: !isNative ? parts[2] : null,\n func: parts[1] || UNKNOWN_FUNCTION,\n args: isNative ? [parts[2]] : [],\n line: parts[3] ? +parts[3] : null,\n column: parts[4] ? +parts[4] : null\n };\n } else if ((parts = winjs.exec(lines[i]))) {\n element = {\n url: parts[2],\n func: parts[1] || UNKNOWN_FUNCTION,\n args: [],\n line: +parts[3],\n column: parts[4] ? +parts[4] : null\n };\n } else if ((parts = gecko.exec(lines[i]))) {\n var isEval = parts[3] && parts[3].indexOf(' > eval') > -1;\n if (isEval && (submatch = geckoEval.exec(parts[3]))) {\n // throw out eval line/column and use top-most line number\n parts[3] = submatch[1];\n parts[4] = submatch[2];\n parts[5] = null; // no column when eval\n } else if (i === 0 && !parts[5] && typeof ex.columnNumber !== 'undefined') {\n // FireFox uses this awesome columnNumber property for its top frame\n // Also note, Firefox's column number is 0-based and everything else expects 1-based,\n // so adding 1\n // NOTE: this hack doesn't work if top-most frame is eval\n stack[0].column = ex.columnNumber + 1;\n }\n element = {\n url: parts[3],\n func: parts[1] || UNKNOWN_FUNCTION,\n args: parts[2] ? parts[2].split(',') : [],\n line: parts[4] ? +parts[4] : null,\n column: parts[5] ? +parts[5] : null\n };\n } else {\n continue;\n }\n\n if (!element.func && element.line) {\n element.func = UNKNOWN_FUNCTION;\n }\n\n if (element.url && element.url.substr(0, 5) === 'blob:') {\n // Special case for handling JavaScript loaded into a blob.\n // We use a synchronous AJAX request here as a blob is already in\n // memory - it's not making a network request. This will generate a warning\n // in the browser console, but there has already been an error so that's not\n // that much of an issue.\n var xhr = new XMLHttpRequest();\n xhr.open('GET', element.url, false);\n xhr.send(null);\n\n // If we failed to download the source, skip this patch\n if (xhr.status === 200) {\n var source = xhr.responseText || '';\n\n // We trim the source down to the last 300 characters as sourceMappingURL is always at the end of the file.\n // Why 300? To be in line with: https://github.com/getsentry/sentry/blob/4af29e8f2350e20c28a6933354e4f42437b4ba42/src/sentry/lang/javascript/processor.py#L164-L175\n source = source.slice(-300);\n\n // Now we dig out the source map URL\n var sourceMaps = source.match(/\\/\\/# sourceMappingURL=(.*)$/);\n\n // If we don't find a source map comment or we find more than one, continue on to the next element.\n if (sourceMaps) {\n var sourceMapAddress = sourceMaps[1];\n\n // Now we check to see if it's a relative URL.\n // If it is, convert it to an absolute one.\n if (sourceMapAddress.charAt(0) === '~') {\n sourceMapAddress = getLocationOrigin() + sourceMapAddress.slice(1);\n }\n\n // Now we strip the '.map' off of the end of the URL and update the\n // element so that Sentry can match the map to the blob.\n element.url = sourceMapAddress.slice(0, -4);\n }\n }\n }\n\n stack.push(element);\n }\n\n if (!stack.length) {\n return null;\n }\n\n return {\n name: ex.name,\n message: ex.message,\n url: getLocationHref(),\n stack: stack\n };\n }\n\n /**\n * Adds information about the first frame to incomplete stack traces.\n * Safari and IE require this to get complete data on the first frame.\n * @param {Object.} stackInfo Stack trace information from\n * one of the compute* methods.\n * @param {string} url The URL of the script that caused an error.\n * @param {(number|string)} lineNo The line number of the script that\n * caused an error.\n * @param {string=} message The error generated by the browser, which\n * hopefully contains the name of the object that caused the error.\n * @return {boolean} Whether or not the stack information was\n * augmented.\n */\n function augmentStackTraceWithInitialElement(stackInfo, url, lineNo, message) {\n var initial = {\n url: url,\n line: lineNo\n };\n\n if (initial.url && initial.line) {\n stackInfo.incomplete = false;\n\n if (!initial.func) {\n initial.func = UNKNOWN_FUNCTION;\n }\n\n if (stackInfo.stack.length > 0) {\n if (stackInfo.stack[0].url === initial.url) {\n if (stackInfo.stack[0].line === initial.line) {\n return false; // already in stack trace\n } else if (\n !stackInfo.stack[0].line &&\n stackInfo.stack[0].func === initial.func\n ) {\n stackInfo.stack[0].line = initial.line;\n return false;\n }\n }\n }\n\n stackInfo.stack.unshift(initial);\n stackInfo.partial = true;\n return true;\n } else {\n stackInfo.incomplete = true;\n }\n\n return false;\n }\n\n /**\n * Computes stack trace information by walking the arguments.caller\n * chain at the time the exception occurred. This will cause earlier\n * frames to be missed but is the only way to get any stack trace in\n * Safari and IE. The top frame is restored by\n * {@link augmentStackTraceWithInitialElement}.\n * @param {Error} ex\n * @return {?Object.} Stack trace information.\n */\n function computeStackTraceByWalkingCallerChain(ex, depth) {\n var functionName = /function\\s+([_$a-zA-Z\\xA0-\\uFFFF][_$a-zA-Z0-9\\xA0-\\uFFFF]*)?\\s*\\(/i,\n stack = [],\n funcs = {},\n recursion = false,\n parts,\n item,\n source;\n\n for (\n var curr = computeStackTraceByWalkingCallerChain.caller;\n curr && !recursion;\n curr = curr.caller\n ) {\n if (curr === computeStackTrace || curr === TraceKit.report) {\n // console.log('skipping internal function');\n continue;\n }\n\n item = {\n url: null,\n func: UNKNOWN_FUNCTION,\n line: null,\n column: null\n };\n\n if (curr.name) {\n item.func = curr.name;\n } else if ((parts = functionName.exec(curr.toString()))) {\n item.func = parts[1];\n }\n\n if (typeof item.func === 'undefined') {\n try {\n item.func = parts.input.substring(0, parts.input.indexOf('{'));\n } catch (e) {}\n }\n\n if (funcs['' + curr]) {\n recursion = true;\n } else {\n funcs['' + curr] = true;\n }\n\n stack.push(item);\n }\n\n if (depth) {\n // console.log('depth is ' + depth);\n // console.log('stack is ' + stack.length);\n stack.splice(0, depth);\n }\n\n var result = {\n name: ex.name,\n message: ex.message,\n url: getLocationHref(),\n stack: stack\n };\n augmentStackTraceWithInitialElement(\n result,\n ex.sourceURL || ex.fileName,\n ex.line || ex.lineNumber,\n ex.message || ex.description\n );\n return result;\n }\n\n /**\n * Computes a stack trace for an exception.\n * @param {Error} ex\n * @param {(string|number)=} depth\n */\n function computeStackTrace(ex, depth) {\n var stack = null;\n depth = depth == null ? 0 : +depth;\n\n try {\n stack = computeStackTraceFromStackProp(ex);\n if (stack) {\n return stack;\n }\n } catch (e) {\n if (TraceKit.debug) {\n throw e;\n }\n }\n\n try {\n stack = computeStackTraceByWalkingCallerChain(ex, depth + 1);\n if (stack) {\n return stack;\n }\n } catch (e) {\n if (TraceKit.debug) {\n throw e;\n }\n }\n return {\n name: ex.name,\n message: ex.message,\n url: getLocationHref()\n };\n }\n\n computeStackTrace.augmentStackTraceWithInitialElement = augmentStackTraceWithInitialElement;\n computeStackTrace.computeStackTraceFromStackProp = computeStackTraceFromStackProp;\n\n return computeStackTrace;\n})();\n\nmodule.exports = TraceKit;\n","/*\n * JavaScript MD5\n * https://github.com/blueimp/JavaScript-MD5\n *\n * Copyright 2011, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n *\n * Based on\n * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message\n * Digest Algorithm, as defined in RFC 1321.\n * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n * Distributed under the BSD License\n * See http://pajhome.org.uk/crypt/md5 for more info.\n */\n\n/*\n* Add integers, wrapping at 2^32. This uses 16-bit operations internally\n* to work around bugs in some JS interpreters.\n*/\nfunction safeAdd(x, y) {\n var lsw = (x & 0xffff) + (y & 0xffff);\n var msw = (x >> 16) + (y >> 16) + (lsw >> 16);\n return (msw << 16) | (lsw & 0xffff);\n}\n\n/*\n* Bitwise rotate a 32-bit number to the left.\n*/\nfunction bitRotateLeft(num, cnt) {\n return (num << cnt) | (num >>> (32 - cnt));\n}\n\n/*\n* These functions implement the four basic operations the algorithm uses.\n*/\nfunction md5cmn(q, a, b, x, s, t) {\n return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);\n}\nfunction md5ff(a, b, c, d, x, s, t) {\n return md5cmn((b & c) | (~b & d), a, b, x, s, t);\n}\nfunction md5gg(a, b, c, d, x, s, t) {\n return md5cmn((b & d) | (c & ~d), a, b, x, s, t);\n}\nfunction md5hh(a, b, c, d, x, s, t) {\n return md5cmn(b ^ c ^ d, a, b, x, s, t);\n}\nfunction md5ii(a, b, c, d, x, s, t) {\n return md5cmn(c ^ (b | ~d), a, b, x, s, t);\n}\n\n/*\n* Calculate the MD5 of an array of little-endian words, and a bit length.\n*/\nfunction binlMD5(x, len) {\n /* append padding */\n x[len >> 5] |= 0x80 << (len % 32);\n x[(((len + 64) >>> 9) << 4) + 14] = len;\n\n var i;\n var olda;\n var oldb;\n var oldc;\n var oldd;\n var a = 1732584193;\n var b = -271733879;\n var c = -1732584194;\n var d = 271733878;\n\n for (i = 0; i < x.length; i += 16) {\n olda = a;\n oldb = b;\n oldc = c;\n oldd = d;\n\n a = md5ff(a, b, c, d, x[i], 7, -680876936);\n d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);\n c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);\n b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);\n a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);\n d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);\n c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);\n b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);\n a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);\n d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);\n c = md5ff(c, d, a, b, x[i + 10], 17, -42063);\n b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);\n a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);\n d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);\n c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);\n b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);\n\n a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);\n d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);\n c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);\n b = md5gg(b, c, d, a, x[i], 20, -373897302);\n a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);\n d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);\n c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);\n b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);\n a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);\n d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);\n c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);\n b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);\n a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);\n d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);\n c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);\n b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);\n\n a = md5hh(a, b, c, d, x[i + 5], 4, -378558);\n d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);\n c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);\n b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);\n a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);\n d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);\n c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);\n b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);\n a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);\n d = md5hh(d, a, b, c, x[i], 11, -358537222);\n c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);\n b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);\n a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);\n d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);\n c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);\n b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);\n\n a = md5ii(a, b, c, d, x[i], 6, -198630844);\n d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);\n c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);\n b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);\n a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);\n d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);\n c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);\n b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);\n a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);\n d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);\n c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);\n b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);\n a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);\n d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);\n c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);\n b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);\n\n a = safeAdd(a, olda);\n b = safeAdd(b, oldb);\n c = safeAdd(c, oldc);\n d = safeAdd(d, oldd);\n }\n return [a, b, c, d];\n}\n\n/*\n* Convert an array of little-endian words to a string\n*/\nfunction binl2rstr(input) {\n var i;\n var output = '';\n var length32 = input.length * 32;\n for (i = 0; i < length32; i += 8) {\n output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xff);\n }\n return output;\n}\n\n/*\n* Convert a raw string to an array of little-endian words\n* Characters >255 have their high-byte silently ignored.\n*/\nfunction rstr2binl(input) {\n var i;\n var output = [];\n output[(input.length >> 2) - 1] = undefined;\n for (i = 0; i < output.length; i += 1) {\n output[i] = 0;\n }\n var length8 = input.length * 8;\n for (i = 0; i < length8; i += 8) {\n output[i >> 5] |= (input.charCodeAt(i / 8) & 0xff) << (i % 32);\n }\n return output;\n}\n\n/*\n* Calculate the MD5 of a raw string\n*/\nfunction rstrMD5(s) {\n return binl2rstr(binlMD5(rstr2binl(s), s.length * 8));\n}\n\n/*\n* Calculate the HMAC-MD5, of a key and some data (raw strings)\n*/\nfunction rstrHMACMD5(key, data) {\n var i;\n var bkey = rstr2binl(key);\n var ipad = [];\n var opad = [];\n var hash;\n ipad[15] = opad[15] = undefined;\n if (bkey.length > 16) {\n bkey = binlMD5(bkey, key.length * 8);\n }\n for (i = 0; i < 16; i += 1) {\n ipad[i] = bkey[i] ^ 0x36363636;\n opad[i] = bkey[i] ^ 0x5c5c5c5c;\n }\n hash = binlMD5(ipad.concat(rstr2binl(data)), 512 + data.length * 8);\n return binl2rstr(binlMD5(opad.concat(hash), 512 + 128));\n}\n\n/*\n* Convert a raw string to a hex string\n*/\nfunction rstr2hex(input) {\n var hexTab = '0123456789abcdef';\n var output = '';\n var x;\n var i;\n for (i = 0; i < input.length; i += 1) {\n x = input.charCodeAt(i);\n output += hexTab.charAt((x >>> 4) & 0x0f) + hexTab.charAt(x & 0x0f);\n }\n return output;\n}\n\n/*\n* Encode a string as utf-8\n*/\nfunction str2rstrUTF8(input) {\n return unescape(encodeURIComponent(input));\n}\n\n/*\n* Take string arguments and return either raw or hex encoded strings\n*/\nfunction rawMD5(s) {\n return rstrMD5(str2rstrUTF8(s));\n}\nfunction hexMD5(s) {\n return rstr2hex(rawMD5(s));\n}\nfunction rawHMACMD5(k, d) {\n return rstrHMACMD5(str2rstrUTF8(k), str2rstrUTF8(d));\n}\nfunction hexHMACMD5(k, d) {\n return rstr2hex(rawHMACMD5(k, d));\n}\n\nfunction md5(string, key, raw) {\n if (!key) {\n if (!raw) {\n return hexMD5(string);\n }\n return rawMD5(string);\n }\n if (!raw) {\n return hexHMACMD5(key, string);\n }\n return rawHMACMD5(key, string);\n}\n\nmodule.exports = md5;\n","function RavenConfigError(message) {\n this.name = 'RavenConfigError';\n this.message = message;\n}\nRavenConfigError.prototype = new Error();\nRavenConfigError.prototype.constructor = RavenConfigError;\n\nmodule.exports = RavenConfigError;\n","var utils = require('./utils');\n\nvar wrapMethod = function(console, level, callback) {\n var originalConsoleLevel = console[level];\n var originalConsole = console;\n\n if (!(level in console)) {\n return;\n }\n\n var sentryLevel = level === 'warn' ? 'warning' : level;\n\n console[level] = function() {\n var args = [].slice.call(arguments);\n\n var msg = utils.safeJoin(args, ' ');\n var data = {level: sentryLevel, logger: 'console', extra: {arguments: args}};\n\n if (level === 'assert') {\n if (args[0] === false) {\n // Default browsers message\n msg =\n 'Assertion failed: ' + (utils.safeJoin(args.slice(1), ' ') || 'console.assert');\n data.extra.arguments = args.slice(1);\n callback && callback(msg, data);\n }\n } else {\n callback && callback(msg, data);\n }\n\n // this fails for some browsers. :(\n if (originalConsoleLevel) {\n // IE9 doesn't allow calling apply on console functions directly\n // See: https://stackoverflow.com/questions/5472938/does-ie9-support-console-log-and-is-it-a-real-function#answer-5473193\n Function.prototype.apply.call(originalConsoleLevel, originalConsole, args);\n }\n };\n};\n\nmodule.exports = {\n wrapMethod: wrapMethod\n};\n","/*global XDomainRequest:false */\n\nvar TraceKit = require('../vendor/TraceKit/tracekit');\nvar stringify = require('../vendor/json-stringify-safe/stringify');\nvar md5 = require('../vendor/md5/md5');\nvar RavenConfigError = require('./configError');\n\nvar utils = require('./utils');\nvar isErrorEvent = utils.isErrorEvent;\nvar isDOMError = utils.isDOMError;\nvar isDOMException = utils.isDOMException;\nvar isError = utils.isError;\nvar isObject = utils.isObject;\nvar isPlainObject = utils.isPlainObject;\nvar isUndefined = utils.isUndefined;\nvar isFunction = utils.isFunction;\nvar isString = utils.isString;\nvar isArray = utils.isArray;\nvar isEmptyObject = utils.isEmptyObject;\nvar each = utils.each;\nvar objectMerge = utils.objectMerge;\nvar truncate = utils.truncate;\nvar objectFrozen = utils.objectFrozen;\nvar hasKey = utils.hasKey;\nvar joinRegExp = utils.joinRegExp;\nvar urlencode = utils.urlencode;\nvar uuid4 = utils.uuid4;\nvar htmlTreeAsString = utils.htmlTreeAsString;\nvar isSameException = utils.isSameException;\nvar isSameStacktrace = utils.isSameStacktrace;\nvar parseUrl = utils.parseUrl;\nvar fill = utils.fill;\nvar supportsFetch = utils.supportsFetch;\nvar supportsReferrerPolicy = utils.supportsReferrerPolicy;\nvar serializeKeysForMessage = utils.serializeKeysForMessage;\nvar serializeException = utils.serializeException;\nvar sanitize = utils.sanitize;\n\nvar wrapConsoleMethod = require('./console').wrapMethod;\n\nvar dsnKeys = 'source protocol user pass host port path'.split(' '),\n dsnPattern = /^(?:(\\w+):)?\\/\\/(?:(\\w+)(:\\w+)?@)?([\\w\\.-]+)(?::(\\d+))?(\\/.*)/;\n\nfunction now() {\n return +new Date();\n}\n\n// This is to be defensive in environments where window does not exist (see https://github.com/getsentry/raven-js/pull/785)\nvar _window =\n typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\nvar _document = _window.document;\nvar _navigator = _window.navigator;\n\nfunction keepOriginalCallback(original, callback) {\n return isFunction(callback)\n ? function(data) {\n return callback(data, original);\n }\n : callback;\n}\n\n// First, check for JSON support\n// If there is no JSON, we no-op the core features of Raven\n// since JSON is required to encode the payload\nfunction Raven() {\n this._hasJSON = !!(typeof JSON === 'object' && JSON.stringify);\n // Raven can run in contexts where there's no document (react-native)\n this._hasDocument = !isUndefined(_document);\n this._hasNavigator = !isUndefined(_navigator);\n this._lastCapturedException = null;\n this._lastData = null;\n this._lastEventId = null;\n this._globalServer = null;\n this._globalKey = null;\n this._globalProject = null;\n this._globalContext = {};\n this._globalOptions = {\n // SENTRY_RELEASE can be injected by https://github.com/getsentry/sentry-webpack-plugin\n release: _window.SENTRY_RELEASE && _window.SENTRY_RELEASE.id,\n logger: 'javascript',\n ignoreErrors: [],\n ignoreUrls: [],\n whitelistUrls: [],\n includePaths: [],\n headers: null,\n collectWindowErrors: true,\n captureUnhandledRejections: true,\n maxMessageLength: 0,\n // By default, truncates URL values to 250 chars\n maxUrlLength: 250,\n stackTraceLimit: 50,\n autoBreadcrumbs: true,\n instrument: true,\n sampleRate: 1,\n sanitizeKeys: []\n };\n this._fetchDefaults = {\n method: 'POST',\n keepalive: true,\n // Despite all stars in the sky saying that Edge supports old draft syntax, aka 'never', 'always', 'origin' and 'default\n // https://caniuse.com/#feat=referrer-policy\n // It doesn't. And it throw exception instead of ignoring this parameter...\n // REF: https://github.com/getsentry/raven-js/issues/1233\n referrerPolicy: supportsReferrerPolicy() ? 'origin' : ''\n };\n this._ignoreOnError = 0;\n this._isRavenInstalled = false;\n this._originalErrorStackTraceLimit = Error.stackTraceLimit;\n // capture references to window.console *and* all its methods first\n // before the console plugin has a chance to monkey patch\n this._originalConsole = _window.console || {};\n this._originalConsoleMethods = {};\n this._plugins = [];\n this._startTime = now();\n this._wrappedBuiltIns = [];\n this._breadcrumbs = [];\n this._lastCapturedEvent = null;\n this._keypressTimeout;\n this._location = _window.location;\n this._lastHref = this._location && this._location.href;\n this._resetBackoff();\n\n // eslint-disable-next-line guard-for-in\n for (var method in this._originalConsole) {\n this._originalConsoleMethods[method] = this._originalConsole[method];\n }\n}\n\n/*\n * The core Raven singleton\n *\n * @this {Raven}\n */\n\nRaven.prototype = {\n // Hardcode version string so that raven source can be loaded directly via\n // webpack (using a build step causes webpack #1617). Grunt verifies that\n // this value matches package.json during build.\n // See: https://github.com/getsentry/raven-js/issues/465\n VERSION: '3.26.4',\n\n debug: false,\n\n TraceKit: TraceKit, // alias to TraceKit\n\n /*\n * Configure Raven with a DSN and extra options\n *\n * @param {string} dsn The public Sentry DSN\n * @param {object} options Set of global options [optional]\n * @return {Raven}\n */\n config: function(dsn, options) {\n var self = this;\n\n if (self._globalServer) {\n this._logDebug('error', 'Error: Raven has already been configured');\n return self;\n }\n if (!dsn) return self;\n\n var globalOptions = self._globalOptions;\n\n // merge in options\n if (options) {\n each(options, function(key, value) {\n // tags and extra are special and need to be put into context\n if (key === 'tags' || key === 'extra' || key === 'user') {\n self._globalContext[key] = value;\n } else {\n globalOptions[key] = value;\n }\n });\n }\n\n self.setDSN(dsn);\n\n // \"Script error.\" is hard coded into browsers for errors that it can't read.\n // this is the result of a script being pulled in from an external domain and CORS.\n globalOptions.ignoreErrors.push(/^Script error\\.?$/);\n globalOptions.ignoreErrors.push(/^Javascript error: Script error\\.? on line 0$/);\n\n // join regexp rules into one big rule\n globalOptions.ignoreErrors = joinRegExp(globalOptions.ignoreErrors);\n globalOptions.ignoreUrls = globalOptions.ignoreUrls.length\n ? joinRegExp(globalOptions.ignoreUrls)\n : false;\n globalOptions.whitelistUrls = globalOptions.whitelistUrls.length\n ? joinRegExp(globalOptions.whitelistUrls)\n : false;\n globalOptions.includePaths = joinRegExp(globalOptions.includePaths);\n globalOptions.maxBreadcrumbs = Math.max(\n 0,\n Math.min(globalOptions.maxBreadcrumbs || 100, 100)\n ); // default and hard limit is 100\n\n var autoBreadcrumbDefaults = {\n xhr: true,\n console: true,\n dom: true,\n location: true,\n sentry: true\n };\n\n var autoBreadcrumbs = globalOptions.autoBreadcrumbs;\n if ({}.toString.call(autoBreadcrumbs) === '[object Object]') {\n autoBreadcrumbs = objectMerge(autoBreadcrumbDefaults, autoBreadcrumbs);\n } else if (autoBreadcrumbs !== false) {\n autoBreadcrumbs = autoBreadcrumbDefaults;\n }\n globalOptions.autoBreadcrumbs = autoBreadcrumbs;\n\n var instrumentDefaults = {\n tryCatch: true\n };\n\n var instrument = globalOptions.instrument;\n if ({}.toString.call(instrument) === '[object Object]') {\n instrument = objectMerge(instrumentDefaults, instrument);\n } else if (instrument !== false) {\n instrument = instrumentDefaults;\n }\n globalOptions.instrument = instrument;\n\n TraceKit.collectWindowErrors = !!globalOptions.collectWindowErrors;\n\n // return for chaining\n return self;\n },\n\n /*\n * Installs a global window.onerror error handler\n * to capture and report uncaught exceptions.\n * At this point, install() is required to be called due\n * to the way TraceKit is set up.\n *\n * @return {Raven}\n */\n install: function() {\n var self = this;\n if (self.isSetup() && !self._isRavenInstalled) {\n TraceKit.report.subscribe(function() {\n self._handleOnErrorStackInfo.apply(self, arguments);\n });\n\n if (self._globalOptions.captureUnhandledRejections) {\n self._attachPromiseRejectionHandler();\n }\n\n self._patchFunctionToString();\n\n if (self._globalOptions.instrument && self._globalOptions.instrument.tryCatch) {\n self._instrumentTryCatch();\n }\n\n if (self._globalOptions.autoBreadcrumbs) self._instrumentBreadcrumbs();\n\n // Install all of the plugins\n self._drainPlugins();\n\n self._isRavenInstalled = true;\n }\n\n Error.stackTraceLimit = self._globalOptions.stackTraceLimit;\n return this;\n },\n\n /*\n * Set the DSN (can be called multiple time unlike config)\n *\n * @param {string} dsn The public Sentry DSN\n */\n setDSN: function(dsn) {\n var self = this,\n uri = self._parseDSN(dsn),\n lastSlash = uri.path.lastIndexOf('/'),\n path = uri.path.substr(1, lastSlash);\n\n self._dsn = dsn;\n self._globalKey = uri.user;\n self._globalSecret = uri.pass && uri.pass.substr(1);\n self._globalProject = uri.path.substr(lastSlash + 1);\n\n self._globalServer = self._getGlobalServer(uri);\n\n self._globalEndpoint =\n self._globalServer + '/' + path + 'api/' + self._globalProject + '/store/';\n\n // Reset backoff state since we may be pointing at a\n // new project/server\n this._resetBackoff();\n },\n\n /*\n * Wrap code within a context so Raven can capture errors\n * reliably across domains that is executed immediately.\n *\n * @param {object} options A specific set of options for this context [optional]\n * @param {function} func The callback to be immediately executed within the context\n * @param {array} args An array of arguments to be called with the callback [optional]\n */\n context: function(options, func, args) {\n if (isFunction(options)) {\n args = func || [];\n func = options;\n options = {};\n }\n\n return this.wrap(options, func).apply(this, args);\n },\n\n /*\n * Wrap code within a context and returns back a new function to be executed\n *\n * @param {object} options A specific set of options for this context [optional]\n * @param {function} func The function to be wrapped in a new context\n * @param {function} _before A function to call before the try/catch wrapper [optional, private]\n * @return {function} The newly wrapped functions with a context\n */\n wrap: function(options, func, _before) {\n var self = this;\n // 1 argument has been passed, and it's not a function\n // so just return it\n if (isUndefined(func) && !isFunction(options)) {\n return options;\n }\n\n // options is optional\n if (isFunction(options)) {\n func = options;\n options = undefined;\n }\n\n // At this point, we've passed along 2 arguments, and the second one\n // is not a function either, so we'll just return the second argument.\n if (!isFunction(func)) {\n return func;\n }\n\n // We don't wanna wrap it twice!\n try {\n if (func.__raven__) {\n return func;\n }\n\n // If this has already been wrapped in the past, return that\n if (func.__raven_wrapper__) {\n return func.__raven_wrapper__;\n }\n } catch (e) {\n // Just accessing custom props in some Selenium environments\n // can cause a \"Permission denied\" exception (see raven-js#495).\n // Bail on wrapping and return the function as-is (defers to window.onerror).\n return func;\n }\n\n function wrapped() {\n var args = [],\n i = arguments.length,\n deep = !options || (options && options.deep !== false);\n\n if (_before && isFunction(_before)) {\n _before.apply(this, arguments);\n }\n\n // Recursively wrap all of a function's arguments that are\n // functions themselves.\n while (i--) args[i] = deep ? self.wrap(options, arguments[i]) : arguments[i];\n\n try {\n // Attempt to invoke user-land function\n // NOTE: If you are a Sentry user, and you are seeing this stack frame, it\n // means Raven caught an error invoking your application code. This is\n // expected behavior and NOT indicative of a bug with Raven.js.\n return func.apply(this, args);\n } catch (e) {\n self._ignoreNextOnError();\n self.captureException(e, options);\n throw e;\n }\n }\n\n // copy over properties of the old function\n for (var property in func) {\n if (hasKey(func, property)) {\n wrapped[property] = func[property];\n }\n }\n wrapped.prototype = func.prototype;\n\n func.__raven_wrapper__ = wrapped;\n // Signal that this function has been wrapped/filled already\n // for both debugging and to prevent it to being wrapped/filled twice\n wrapped.__raven__ = true;\n wrapped.__orig__ = func;\n\n return wrapped;\n },\n\n /**\n * Uninstalls the global error handler.\n *\n * @return {Raven}\n */\n uninstall: function() {\n TraceKit.report.uninstall();\n\n this._detachPromiseRejectionHandler();\n this._unpatchFunctionToString();\n this._restoreBuiltIns();\n this._restoreConsole();\n\n Error.stackTraceLimit = this._originalErrorStackTraceLimit;\n this._isRavenInstalled = false;\n\n return this;\n },\n\n /**\n * Callback used for `unhandledrejection` event\n *\n * @param {PromiseRejectionEvent} event An object containing\n * promise: the Promise that was rejected\n * reason: the value with which the Promise was rejected\n * @return void\n */\n _promiseRejectionHandler: function(event) {\n this._logDebug('debug', 'Raven caught unhandled promise rejection:', event);\n this.captureException(event.reason, {\n mechanism: {\n type: 'onunhandledrejection',\n handled: false\n }\n });\n },\n\n /**\n * Installs the global promise rejection handler.\n *\n * @return {raven}\n */\n _attachPromiseRejectionHandler: function() {\n this._promiseRejectionHandler = this._promiseRejectionHandler.bind(this);\n _window.addEventListener &&\n _window.addEventListener('unhandledrejection', this._promiseRejectionHandler);\n return this;\n },\n\n /**\n * Uninstalls the global promise rejection handler.\n *\n * @return {raven}\n */\n _detachPromiseRejectionHandler: function() {\n _window.removeEventListener &&\n _window.removeEventListener('unhandledrejection', this._promiseRejectionHandler);\n return this;\n },\n\n /**\n * Manually capture an exception and send it over to Sentry\n *\n * @param {error} ex An exception to be logged\n * @param {object} options A specific set of options for this error [optional]\n * @return {Raven}\n */\n captureException: function(ex, options) {\n options = objectMerge({trimHeadFrames: 0}, options ? options : {});\n\n if (isErrorEvent(ex) && ex.error) {\n // If it is an ErrorEvent with `error` property, extract it to get actual Error\n ex = ex.error;\n } else if (isDOMError(ex) || isDOMException(ex)) {\n // If it is a DOMError or DOMException (which are legacy APIs, but still supported in some browsers)\n // then we just extract the name and message, as they don't provide anything else\n // https://developer.mozilla.org/en-US/docs/Web/API/DOMError\n // https://developer.mozilla.org/en-US/docs/Web/API/DOMException\n var name = ex.name || (isDOMError(ex) ? 'DOMError' : 'DOMException');\n var message = ex.message ? name + ': ' + ex.message : name;\n\n return this.captureMessage(\n message,\n objectMerge(options, {\n // neither DOMError or DOMException provide stack trace and we most likely wont get it this way as well\n // but it's barely any overhead so we may at least try\n stacktrace: true,\n trimHeadFrames: options.trimHeadFrames + 1\n })\n );\n } else if (isError(ex)) {\n // we have a real Error object\n ex = ex;\n } else if (isPlainObject(ex)) {\n // If it is plain Object, serialize it manually and extract options\n // This will allow us to group events based on top-level keys\n // which is much better than creating new group when any key/value change\n options = this._getCaptureExceptionOptionsFromPlainObject(options, ex);\n ex = new Error(options.message);\n } else {\n // If none of previous checks were valid, then it means that\n // it's not a DOMError/DOMException\n // it's not a plain Object\n // it's not a valid ErrorEvent (one with an error property)\n // it's not an Error\n // So bail out and capture it as a simple message:\n return this.captureMessage(\n ex,\n objectMerge(options, {\n stacktrace: true, // if we fall back to captureMessage, default to attempting a new trace\n trimHeadFrames: options.trimHeadFrames + 1\n })\n );\n }\n\n // Store the raw exception object for potential debugging and introspection\n this._lastCapturedException = ex;\n\n // TraceKit.report will re-raise any exception passed to it,\n // which means you have to wrap it in try/catch. Instead, we\n // can wrap it here and only re-raise if TraceKit.report\n // raises an exception different from the one we asked to\n // report on.\n try {\n var stack = TraceKit.computeStackTrace(ex);\n this._handleStackInfo(stack, options);\n } catch (ex1) {\n if (ex !== ex1) {\n throw ex1;\n }\n }\n\n return this;\n },\n\n _getCaptureExceptionOptionsFromPlainObject: function(currentOptions, ex) {\n var exKeys = Object.keys(ex).sort();\n var options = objectMerge(currentOptions, {\n message:\n 'Non-Error exception captured with keys: ' + serializeKeysForMessage(exKeys),\n fingerprint: [md5(exKeys)],\n extra: currentOptions.extra || {}\n });\n options.extra.__serialized__ = serializeException(ex);\n\n return options;\n },\n\n /*\n * Manually send a message to Sentry\n *\n * @param {string} msg A plain message to be captured in Sentry\n * @param {object} options A specific set of options for this message [optional]\n * @return {Raven}\n */\n captureMessage: function(msg, options) {\n // config() automagically converts ignoreErrors from a list to a RegExp so we need to test for an\n // early call; we'll error on the side of logging anything called before configuration since it's\n // probably something you should see:\n if (\n !!this._globalOptions.ignoreErrors.test &&\n this._globalOptions.ignoreErrors.test(msg)\n ) {\n return;\n }\n\n options = options || {};\n msg = msg + ''; // Make sure it's actually a string\n\n var data = objectMerge(\n {\n message: msg\n },\n options\n );\n\n var ex;\n // Generate a \"synthetic\" stack trace from this point.\n // NOTE: If you are a Sentry user, and you are seeing this stack frame, it is NOT indicative\n // of a bug with Raven.js. Sentry generates synthetic traces either by configuration,\n // or if it catches a thrown object without a \"stack\" property.\n try {\n throw new Error(msg);\n } catch (ex1) {\n ex = ex1;\n }\n\n // null exception name so `Error` isn't prefixed to msg\n ex.name = null;\n var stack = TraceKit.computeStackTrace(ex);\n\n // stack[0] is `throw new Error(msg)` call itself, we are interested in the frame that was just before that, stack[1]\n var initialCall = isArray(stack.stack) && stack.stack[1];\n\n // if stack[1] is `Raven.captureException`, it means that someone passed a string to it and we redirected that call\n // to be handled by `captureMessage`, thus `initialCall` is the 3rd one, not 2nd\n // initialCall => captureException(string) => captureMessage(string)\n if (initialCall && initialCall.func === 'Raven.captureException') {\n initialCall = stack.stack[2];\n }\n\n var fileurl = (initialCall && initialCall.url) || '';\n\n if (\n !!this._globalOptions.ignoreUrls.test &&\n this._globalOptions.ignoreUrls.test(fileurl)\n ) {\n return;\n }\n\n if (\n !!this._globalOptions.whitelistUrls.test &&\n !this._globalOptions.whitelistUrls.test(fileurl)\n ) {\n return;\n }\n\n // Always attempt to get stacktrace if message is empty.\n // It's the only way to provide any helpful information to the user.\n if (this._globalOptions.stacktrace || options.stacktrace || data.message === '') {\n // fingerprint on msg, not stack trace (legacy behavior, could be revisited)\n data.fingerprint = data.fingerprint == null ? msg : data.fingerprint;\n\n options = objectMerge(\n {\n trimHeadFrames: 0\n },\n options\n );\n // Since we know this is a synthetic trace, the top frame (this function call)\n // MUST be from Raven.js, so mark it for trimming\n // We add to the trim counter so that callers can choose to trim extra frames, such\n // as utility functions.\n options.trimHeadFrames += 1;\n\n var frames = this._prepareFrames(stack, options);\n data.stacktrace = {\n // Sentry expects frames oldest to newest\n frames: frames.reverse()\n };\n }\n\n // Make sure that fingerprint is always wrapped in an array\n if (data.fingerprint) {\n data.fingerprint = isArray(data.fingerprint)\n ? data.fingerprint\n : [data.fingerprint];\n }\n\n // Fire away!\n this._send(data);\n\n return this;\n },\n\n captureBreadcrumb: function(obj) {\n var crumb = objectMerge(\n {\n timestamp: now() / 1000\n },\n obj\n );\n\n if (isFunction(this._globalOptions.breadcrumbCallback)) {\n var result = this._globalOptions.breadcrumbCallback(crumb);\n\n if (isObject(result) && !isEmptyObject(result)) {\n crumb = result;\n } else if (result === false) {\n return this;\n }\n }\n\n this._breadcrumbs.push(crumb);\n if (this._breadcrumbs.length > this._globalOptions.maxBreadcrumbs) {\n this._breadcrumbs.shift();\n }\n return this;\n },\n\n addPlugin: function(plugin /*arg1, arg2, ... argN*/) {\n var pluginArgs = [].slice.call(arguments, 1);\n\n this._plugins.push([plugin, pluginArgs]);\n if (this._isRavenInstalled) {\n this._drainPlugins();\n }\n\n return this;\n },\n\n /*\n * Set/clear a user to be sent along with the payload.\n *\n * @param {object} user An object representing user data [optional]\n * @return {Raven}\n */\n setUserContext: function(user) {\n // Intentionally do not merge here since that's an unexpected behavior.\n this._globalContext.user = user;\n\n return this;\n },\n\n /*\n * Merge extra attributes to be sent along with the payload.\n *\n * @param {object} extra An object representing extra data [optional]\n * @return {Raven}\n */\n setExtraContext: function(extra) {\n this._mergeContext('extra', extra);\n\n return this;\n },\n\n /*\n * Merge tags to be sent along with the payload.\n *\n * @param {object} tags An object representing tags [optional]\n * @return {Raven}\n */\n setTagsContext: function(tags) {\n this._mergeContext('tags', tags);\n\n return this;\n },\n\n /*\n * Clear all of the context.\n *\n * @return {Raven}\n */\n clearContext: function() {\n this._globalContext = {};\n\n return this;\n },\n\n /*\n * Get a copy of the current context. This cannot be mutated.\n *\n * @return {object} copy of context\n */\n getContext: function() {\n // lol javascript\n return JSON.parse(stringify(this._globalContext));\n },\n\n /*\n * Set environment of application\n *\n * @param {string} environment Typically something like 'production'.\n * @return {Raven}\n */\n setEnvironment: function(environment) {\n this._globalOptions.environment = environment;\n\n return this;\n },\n\n /*\n * Set release version of application\n *\n * @param {string} release Typically something like a git SHA to identify version\n * @return {Raven}\n */\n setRelease: function(release) {\n this._globalOptions.release = release;\n\n return this;\n },\n\n /*\n * Set the dataCallback option\n *\n * @param {function} callback The callback to run which allows the\n * data blob to be mutated before sending\n * @return {Raven}\n */\n setDataCallback: function(callback) {\n var original = this._globalOptions.dataCallback;\n this._globalOptions.dataCallback = keepOriginalCallback(original, callback);\n return this;\n },\n\n /*\n * Set the breadcrumbCallback option\n *\n * @param {function} callback The callback to run which allows filtering\n * or mutating breadcrumbs\n * @return {Raven}\n */\n setBreadcrumbCallback: function(callback) {\n var original = this._globalOptions.breadcrumbCallback;\n this._globalOptions.breadcrumbCallback = keepOriginalCallback(original, callback);\n return this;\n },\n\n /*\n * Set the shouldSendCallback option\n *\n * @param {function} callback The callback to run which allows\n * introspecting the blob before sending\n * @return {Raven}\n */\n setShouldSendCallback: function(callback) {\n var original = this._globalOptions.shouldSendCallback;\n this._globalOptions.shouldSendCallback = keepOriginalCallback(original, callback);\n return this;\n },\n\n /**\n * Override the default HTTP transport mechanism that transmits data\n * to the Sentry server.\n *\n * @param {function} transport Function invoked instead of the default\n * `makeRequest` handler.\n *\n * @return {Raven}\n */\n setTransport: function(transport) {\n this._globalOptions.transport = transport;\n\n return this;\n },\n\n /*\n * Get the latest raw exception that was captured by Raven.\n *\n * @return {error}\n */\n lastException: function() {\n return this._lastCapturedException;\n },\n\n /*\n * Get the last event id\n *\n * @return {string}\n */\n lastEventId: function() {\n return this._lastEventId;\n },\n\n /*\n * Determine if Raven is setup and ready to go.\n *\n * @return {boolean}\n */\n isSetup: function() {\n if (!this._hasJSON) return false; // needs JSON support\n if (!this._globalServer) {\n if (!this.ravenNotConfiguredError) {\n this.ravenNotConfiguredError = true;\n this._logDebug('error', 'Error: Raven has not been configured.');\n }\n return false;\n }\n return true;\n },\n\n afterLoad: function() {\n // TODO: remove window dependence?\n\n // Attempt to initialize Raven on load\n var RavenConfig = _window.RavenConfig;\n if (RavenConfig) {\n this.config(RavenConfig.dsn, RavenConfig.config).install();\n }\n },\n\n showReportDialog: function(options) {\n if (\n !_document // doesn't work without a document (React native)\n )\n return;\n\n options = Object.assign(\n {\n eventId: this.lastEventId(),\n dsn: this._dsn,\n user: this._globalContext.user || {}\n },\n options\n );\n\n if (!options.eventId) {\n throw new RavenConfigError('Missing eventId');\n }\n\n if (!options.dsn) {\n throw new RavenConfigError('Missing DSN');\n }\n\n var encode = encodeURIComponent;\n var encodedOptions = [];\n\n for (var key in options) {\n if (key === 'user') {\n var user = options.user;\n if (user.name) encodedOptions.push('name=' + encode(user.name));\n if (user.email) encodedOptions.push('email=' + encode(user.email));\n } else {\n encodedOptions.push(encode(key) + '=' + encode(options[key]));\n }\n }\n var globalServer = this._getGlobalServer(this._parseDSN(options.dsn));\n\n var script = _document.createElement('script');\n script.async = true;\n script.src = globalServer + '/api/embed/error-page/?' + encodedOptions.join('&');\n (_document.head || _document.body).appendChild(script);\n },\n\n /**** Private functions ****/\n _ignoreNextOnError: function() {\n var self = this;\n this._ignoreOnError += 1;\n setTimeout(function() {\n // onerror should trigger before setTimeout\n self._ignoreOnError -= 1;\n });\n },\n\n _triggerEvent: function(eventType, options) {\n // NOTE: `event` is a native browser thing, so let's avoid conflicting wiht it\n var evt, key;\n\n if (!this._hasDocument) return;\n\n options = options || {};\n\n eventType = 'raven' + eventType.substr(0, 1).toUpperCase() + eventType.substr(1);\n\n if (_document.createEvent) {\n evt = _document.createEvent('HTMLEvents');\n evt.initEvent(eventType, true, true);\n } else {\n evt = _document.createEventObject();\n evt.eventType = eventType;\n }\n\n for (key in options)\n if (hasKey(options, key)) {\n evt[key] = options[key];\n }\n\n if (_document.createEvent) {\n // IE9 if standards\n _document.dispatchEvent(evt);\n } else {\n // IE8 regardless of Quirks or Standards\n // IE9 if quirks\n try {\n _document.fireEvent('on' + evt.eventType.toLowerCase(), evt);\n } catch (e) {\n // Do nothing\n }\n }\n },\n\n /**\n * Wraps addEventListener to capture UI breadcrumbs\n * @param evtName the event name (e.g. \"click\")\n * @returns {Function}\n * @private\n */\n _breadcrumbEventHandler: function(evtName) {\n var self = this;\n return function(evt) {\n // reset keypress timeout; e.g. triggering a 'click' after\n // a 'keypress' will reset the keypress debounce so that a new\n // set of keypresses can be recorded\n self._keypressTimeout = null;\n\n // It's possible this handler might trigger multiple times for the same\n // event (e.g. event propagation through node ancestors). Ignore if we've\n // already captured the event.\n if (self._lastCapturedEvent === evt) return;\n\n self._lastCapturedEvent = evt;\n\n // try/catch both:\n // - accessing evt.target (see getsentry/raven-js#838, #768)\n // - `htmlTreeAsString` because it's complex, and just accessing the DOM incorrectly\n // can throw an exception in some circumstances.\n var target;\n try {\n target = htmlTreeAsString(evt.target);\n } catch (e) {\n target = '';\n }\n\n self.captureBreadcrumb({\n category: 'ui.' + evtName, // e.g. ui.click, ui.input\n message: target\n });\n };\n },\n\n /**\n * Wraps addEventListener to capture keypress UI events\n * @returns {Function}\n * @private\n */\n _keypressEventHandler: function() {\n var self = this,\n debounceDuration = 1000; // milliseconds\n\n // TODO: if somehow user switches keypress target before\n // debounce timeout is triggered, we will only capture\n // a single breadcrumb from the FIRST target (acceptable?)\n return function(evt) {\n var target;\n try {\n target = evt.target;\n } catch (e) {\n // just accessing event properties can throw an exception in some rare circumstances\n // see: https://github.com/getsentry/raven-js/issues/838\n return;\n }\n var tagName = target && target.tagName;\n\n // only consider keypress events on actual input elements\n // this will disregard keypresses targeting body (e.g. tabbing\n // through elements, hotkeys, etc)\n if (\n !tagName ||\n (tagName !== 'INPUT' && tagName !== 'TEXTAREA' && !target.isContentEditable)\n )\n return;\n\n // record first keypress in a series, but ignore subsequent\n // keypresses until debounce clears\n var timeout = self._keypressTimeout;\n if (!timeout) {\n self._breadcrumbEventHandler('input')(evt);\n }\n clearTimeout(timeout);\n self._keypressTimeout = setTimeout(function() {\n self._keypressTimeout = null;\n }, debounceDuration);\n };\n },\n\n /**\n * Captures a breadcrumb of type \"navigation\", normalizing input URLs\n * @param to the originating URL\n * @param from the target URL\n * @private\n */\n _captureUrlChange: function(from, to) {\n var parsedLoc = parseUrl(this._location.href);\n var parsedTo = parseUrl(to);\n var parsedFrom = parseUrl(from);\n\n // because onpopstate only tells you the \"new\" (to) value of location.href, and\n // not the previous (from) value, we need to track the value of the current URL\n // state ourselves\n this._lastHref = to;\n\n // Use only the path component of the URL if the URL matches the current\n // document (almost all the time when using pushState)\n if (parsedLoc.protocol === parsedTo.protocol && parsedLoc.host === parsedTo.host)\n to = parsedTo.relative;\n if (parsedLoc.protocol === parsedFrom.protocol && parsedLoc.host === parsedFrom.host)\n from = parsedFrom.relative;\n\n this.captureBreadcrumb({\n category: 'navigation',\n data: {\n to: to,\n from: from\n }\n });\n },\n\n _patchFunctionToString: function() {\n var self = this;\n self._originalFunctionToString = Function.prototype.toString;\n // eslint-disable-next-line no-extend-native\n Function.prototype.toString = function() {\n if (typeof this === 'function' && this.__raven__) {\n return self._originalFunctionToString.apply(this.__orig__, arguments);\n }\n return self._originalFunctionToString.apply(this, arguments);\n };\n },\n\n _unpatchFunctionToString: function() {\n if (this._originalFunctionToString) {\n // eslint-disable-next-line no-extend-native\n Function.prototype.toString = this._originalFunctionToString;\n }\n },\n\n /**\n * Wrap timer functions and event targets to catch errors and provide\n * better metadata.\n */\n _instrumentTryCatch: function() {\n var self = this;\n\n var wrappedBuiltIns = self._wrappedBuiltIns;\n\n function wrapTimeFn(orig) {\n return function(fn, t) {\n // preserve arity\n // Make a copy of the arguments to prevent deoptimization\n // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n var args = new Array(arguments.length);\n for (var i = 0; i < args.length; ++i) {\n args[i] = arguments[i];\n }\n var originalCallback = args[0];\n if (isFunction(originalCallback)) {\n args[0] = self.wrap(\n {\n mechanism: {\n type: 'instrument',\n data: {function: orig.name || ''}\n }\n },\n originalCallback\n );\n }\n\n // IE < 9 doesn't support .call/.apply on setInterval/setTimeout, but it\n // also supports only two arguments and doesn't care what this is, so we\n // can just call the original function directly.\n if (orig.apply) {\n return orig.apply(this, args);\n } else {\n return orig(args[0], args[1]);\n }\n };\n }\n\n var autoBreadcrumbs = this._globalOptions.autoBreadcrumbs;\n\n function wrapEventTarget(global) {\n var proto = _window[global] && _window[global].prototype;\n if (proto && proto.hasOwnProperty && proto.hasOwnProperty('addEventListener')) {\n fill(\n proto,\n 'addEventListener',\n function(orig) {\n return function(evtName, fn, capture, secure) {\n // preserve arity\n try {\n if (fn && fn.handleEvent) {\n fn.handleEvent = self.wrap(\n {\n mechanism: {\n type: 'instrument',\n data: {\n target: global,\n function: 'handleEvent',\n handler: (fn && fn.name) || ''\n }\n }\n },\n fn.handleEvent\n );\n }\n } catch (err) {\n // can sometimes get 'Permission denied to access property \"handle Event'\n }\n\n // More breadcrumb DOM capture ... done here and not in `_instrumentBreadcrumbs`\n // so that we don't have more than one wrapper function\n var before, clickHandler, keypressHandler;\n\n if (\n autoBreadcrumbs &&\n autoBreadcrumbs.dom &&\n (global === 'EventTarget' || global === 'Node')\n ) {\n // NOTE: generating multiple handlers per addEventListener invocation, should\n // revisit and verify we can just use one (almost certainly)\n clickHandler = self._breadcrumbEventHandler('click');\n keypressHandler = self._keypressEventHandler();\n before = function(evt) {\n // need to intercept every DOM event in `before` argument, in case that\n // same wrapped method is re-used for different events (e.g. mousemove THEN click)\n // see #724\n if (!evt) return;\n\n var eventType;\n try {\n eventType = evt.type;\n } catch (e) {\n // just accessing event properties can throw an exception in some rare circumstances\n // see: https://github.com/getsentry/raven-js/issues/838\n return;\n }\n if (eventType === 'click') return clickHandler(evt);\n else if (eventType === 'keypress') return keypressHandler(evt);\n };\n }\n return orig.call(\n this,\n evtName,\n self.wrap(\n {\n mechanism: {\n type: 'instrument',\n data: {\n target: global,\n function: 'addEventListener',\n handler: (fn && fn.name) || ''\n }\n }\n },\n fn,\n before\n ),\n capture,\n secure\n );\n };\n },\n wrappedBuiltIns\n );\n fill(\n proto,\n 'removeEventListener',\n function(orig) {\n return function(evt, fn, capture, secure) {\n try {\n fn = fn && (fn.__raven_wrapper__ ? fn.__raven_wrapper__ : fn);\n } catch (e) {\n // ignore, accessing __raven_wrapper__ will throw in some Selenium environments\n }\n return orig.call(this, evt, fn, capture, secure);\n };\n },\n wrappedBuiltIns\n );\n }\n }\n\n fill(_window, 'setTimeout', wrapTimeFn, wrappedBuiltIns);\n fill(_window, 'setInterval', wrapTimeFn, wrappedBuiltIns);\n if (_window.requestAnimationFrame) {\n fill(\n _window,\n 'requestAnimationFrame',\n function(orig) {\n return function(cb) {\n return orig(\n self.wrap(\n {\n mechanism: {\n type: 'instrument',\n data: {\n function: 'requestAnimationFrame',\n handler: (orig && orig.name) || ''\n }\n }\n },\n cb\n )\n );\n };\n },\n wrappedBuiltIns\n );\n }\n\n // event targets borrowed from bugsnag-js:\n // https://github.com/bugsnag/bugsnag-js/blob/master/src/bugsnag.js#L666\n var eventTargets = [\n 'EventTarget',\n 'Window',\n 'Node',\n 'ApplicationCache',\n 'AudioTrackList',\n 'ChannelMergerNode',\n 'CryptoOperation',\n 'EventSource',\n 'FileReader',\n 'HTMLUnknownElement',\n 'IDBDatabase',\n 'IDBRequest',\n 'IDBTransaction',\n 'KeyOperation',\n 'MediaController',\n 'MessagePort',\n 'ModalWindow',\n 'Notification',\n 'SVGElementInstance',\n 'Screen',\n 'TextTrack',\n 'TextTrackCue',\n 'TextTrackList',\n 'WebSocket',\n 'WebSocketWorker',\n 'Worker',\n 'XMLHttpRequest',\n 'XMLHttpRequestEventTarget',\n 'XMLHttpRequestUpload'\n ];\n for (var i = 0; i < eventTargets.length; i++) {\n wrapEventTarget(eventTargets[i]);\n }\n },\n\n /**\n * Instrument browser built-ins w/ breadcrumb capturing\n * - XMLHttpRequests\n * - DOM interactions (click/typing)\n * - window.location changes\n * - console\n *\n * Can be disabled or individually configured via the `autoBreadcrumbs` config option\n */\n _instrumentBreadcrumbs: function() {\n var self = this;\n var autoBreadcrumbs = this._globalOptions.autoBreadcrumbs;\n\n var wrappedBuiltIns = self._wrappedBuiltIns;\n\n function wrapProp(prop, xhr) {\n if (prop in xhr && isFunction(xhr[prop])) {\n fill(xhr, prop, function(orig) {\n return self.wrap(\n {\n mechanism: {\n type: 'instrument',\n data: {function: prop, handler: (orig && orig.name) || ''}\n }\n },\n orig\n );\n }); // intentionally don't track filled methods on XHR instances\n }\n }\n\n if (autoBreadcrumbs.xhr && 'XMLHttpRequest' in _window) {\n var xhrproto = _window.XMLHttpRequest && _window.XMLHttpRequest.prototype;\n fill(\n xhrproto,\n 'open',\n function(origOpen) {\n return function(method, url) {\n // preserve arity\n\n // if Sentry key appears in URL, don't capture\n if (isString(url) && url.indexOf(self._globalKey) === -1) {\n this.__raven_xhr = {\n method: method,\n url: url,\n status_code: null\n };\n }\n\n return origOpen.apply(this, arguments);\n };\n },\n wrappedBuiltIns\n );\n\n fill(\n xhrproto,\n 'send',\n function(origSend) {\n return function() {\n // preserve arity\n var xhr = this;\n\n function onreadystatechangeHandler() {\n if (xhr.__raven_xhr && xhr.readyState === 4) {\n try {\n // touching statusCode in some platforms throws\n // an exception\n xhr.__raven_xhr.status_code = xhr.status;\n } catch (e) {\n /* do nothing */\n }\n\n self.captureBreadcrumb({\n type: 'http',\n category: 'xhr',\n data: xhr.__raven_xhr\n });\n }\n }\n\n var props = ['onload', 'onerror', 'onprogress'];\n for (var j = 0; j < props.length; j++) {\n wrapProp(props[j], xhr);\n }\n\n if ('onreadystatechange' in xhr && isFunction(xhr.onreadystatechange)) {\n fill(\n xhr,\n 'onreadystatechange',\n function(orig) {\n return self.wrap(\n {\n mechanism: {\n type: 'instrument',\n data: {\n function: 'onreadystatechange',\n handler: (orig && orig.name) || ''\n }\n }\n },\n orig,\n onreadystatechangeHandler\n );\n } /* intentionally don't track this instrumentation */\n );\n } else {\n // if onreadystatechange wasn't actually set by the page on this xhr, we\n // are free to set our own and capture the breadcrumb\n xhr.onreadystatechange = onreadystatechangeHandler;\n }\n\n return origSend.apply(this, arguments);\n };\n },\n wrappedBuiltIns\n );\n }\n\n if (autoBreadcrumbs.xhr && supportsFetch()) {\n fill(\n _window,\n 'fetch',\n function(origFetch) {\n return function() {\n // preserve arity\n // Make a copy of the arguments to prevent deoptimization\n // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n var args = new Array(arguments.length);\n for (var i = 0; i < args.length; ++i) {\n args[i] = arguments[i];\n }\n\n var fetchInput = args[0];\n var method = 'GET';\n var url;\n\n if (typeof fetchInput === 'string') {\n url = fetchInput;\n } else if ('Request' in _window && fetchInput instanceof _window.Request) {\n url = fetchInput.url;\n if (fetchInput.method) {\n method = fetchInput.method;\n }\n } else {\n url = '' + fetchInput;\n }\n\n // if Sentry key appears in URL, don't capture, as it's our own request\n if (url.indexOf(self._globalKey) !== -1) {\n return origFetch.apply(this, args);\n }\n\n if (args[1] && args[1].method) {\n method = args[1].method;\n }\n\n var fetchData = {\n method: method,\n url: url,\n status_code: null\n };\n\n return origFetch\n .apply(this, args)\n .then(function(response) {\n fetchData.status_code = response.status;\n\n self.captureBreadcrumb({\n type: 'http',\n category: 'fetch',\n data: fetchData\n });\n\n return response;\n })\n ['catch'](function(err) {\n // if there is an error performing the request\n self.captureBreadcrumb({\n type: 'http',\n category: 'fetch',\n data: fetchData,\n level: 'error'\n });\n\n throw err;\n });\n };\n },\n wrappedBuiltIns\n );\n }\n\n // Capture breadcrumbs from any click that is unhandled / bubbled up all the way\n // to the document. Do this before we instrument addEventListener.\n if (autoBreadcrumbs.dom && this._hasDocument) {\n if (_document.addEventListener) {\n _document.addEventListener('click', self._breadcrumbEventHandler('click'), false);\n _document.addEventListener('keypress', self._keypressEventHandler(), false);\n } else if (_document.attachEvent) {\n // IE8 Compatibility\n _document.attachEvent('onclick', self._breadcrumbEventHandler('click'));\n _document.attachEvent('onkeypress', self._keypressEventHandler());\n }\n }\n\n // record navigation (URL) changes\n // NOTE: in Chrome App environment, touching history.pushState, *even inside\n // a try/catch block*, will cause Chrome to output an error to console.error\n // borrowed from: https://github.com/angular/angular.js/pull/13945/files\n var chrome = _window.chrome;\n var isChromePackagedApp = chrome && chrome.app && chrome.app.runtime;\n var hasPushAndReplaceState =\n !isChromePackagedApp &&\n _window.history &&\n _window.history.pushState &&\n _window.history.replaceState;\n if (autoBreadcrumbs.location && hasPushAndReplaceState) {\n // TODO: remove onpopstate handler on uninstall()\n var oldOnPopState = _window.onpopstate;\n _window.onpopstate = function() {\n var currentHref = self._location.href;\n self._captureUrlChange(self._lastHref, currentHref);\n\n if (oldOnPopState) {\n return oldOnPopState.apply(this, arguments);\n }\n };\n\n var historyReplacementFunction = function(origHistFunction) {\n // note history.pushState.length is 0; intentionally not declaring\n // params to preserve 0 arity\n return function(/* state, title, url */) {\n var url = arguments.length > 2 ? arguments[2] : undefined;\n\n // url argument is optional\n if (url) {\n // coerce to string (this is what pushState does)\n self._captureUrlChange(self._lastHref, url + '');\n }\n\n return origHistFunction.apply(this, arguments);\n };\n };\n\n fill(_window.history, 'pushState', historyReplacementFunction, wrappedBuiltIns);\n fill(_window.history, 'replaceState', historyReplacementFunction, wrappedBuiltIns);\n }\n\n if (autoBreadcrumbs.console && 'console' in _window && console.log) {\n // console\n var consoleMethodCallback = function(msg, data) {\n self.captureBreadcrumb({\n message: msg,\n level: data.level,\n category: 'console'\n });\n };\n\n each(['debug', 'info', 'warn', 'error', 'log'], function(_, level) {\n wrapConsoleMethod(console, level, consoleMethodCallback);\n });\n }\n },\n\n _restoreBuiltIns: function() {\n // restore any wrapped builtins\n var builtin;\n while (this._wrappedBuiltIns.length) {\n builtin = this._wrappedBuiltIns.shift();\n\n var obj = builtin[0],\n name = builtin[1],\n orig = builtin[2];\n\n obj[name] = orig;\n }\n },\n\n _restoreConsole: function() {\n // eslint-disable-next-line guard-for-in\n for (var method in this._originalConsoleMethods) {\n this._originalConsole[method] = this._originalConsoleMethods[method];\n }\n },\n\n _drainPlugins: function() {\n var self = this;\n\n // FIX ME TODO\n each(this._plugins, function(_, plugin) {\n var installer = plugin[0];\n var args = plugin[1];\n installer.apply(self, [self].concat(args));\n });\n },\n\n _parseDSN: function(str) {\n var m = dsnPattern.exec(str),\n dsn = {},\n i = 7;\n\n try {\n while (i--) dsn[dsnKeys[i]] = m[i] || '';\n } catch (e) {\n throw new RavenConfigError('Invalid DSN: ' + str);\n }\n\n if (dsn.pass && !this._globalOptions.allowSecretKey) {\n throw new RavenConfigError(\n 'Do not specify your secret key in the DSN. See: http://bit.ly/raven-secret-key'\n );\n }\n\n return dsn;\n },\n\n _getGlobalServer: function(uri) {\n // assemble the endpoint from the uri pieces\n var globalServer = '//' + uri.host + (uri.port ? ':' + uri.port : '');\n\n if (uri.protocol) {\n globalServer = uri.protocol + ':' + globalServer;\n }\n return globalServer;\n },\n\n _handleOnErrorStackInfo: function(stackInfo, options) {\n options = options || {};\n options.mechanism = options.mechanism || {\n type: 'onerror',\n handled: false\n };\n\n // if we are intentionally ignoring errors via onerror, bail out\n if (!this._ignoreOnError) {\n this._handleStackInfo(stackInfo, options);\n }\n },\n\n _handleStackInfo: function(stackInfo, options) {\n var frames = this._prepareFrames(stackInfo, options);\n\n this._triggerEvent('handle', {\n stackInfo: stackInfo,\n options: options\n });\n\n this._processException(\n stackInfo.name,\n stackInfo.message,\n stackInfo.url,\n stackInfo.lineno,\n frames,\n options\n );\n },\n\n _prepareFrames: function(stackInfo, options) {\n var self = this;\n var frames = [];\n if (stackInfo.stack && stackInfo.stack.length) {\n each(stackInfo.stack, function(i, stack) {\n var frame = self._normalizeFrame(stack, stackInfo.url);\n if (frame) {\n frames.push(frame);\n }\n });\n\n // e.g. frames captured via captureMessage throw\n if (options && options.trimHeadFrames) {\n for (var j = 0; j < options.trimHeadFrames && j < frames.length; j++) {\n frames[j].in_app = false;\n }\n }\n }\n frames = frames.slice(0, this._globalOptions.stackTraceLimit);\n return frames;\n },\n\n _normalizeFrame: function(frame, stackInfoUrl) {\n // normalize the frames data\n var normalized = {\n filename: frame.url,\n lineno: frame.line,\n colno: frame.column,\n function: frame.func || '?'\n };\n\n // Case when we don't have any information about the error\n // E.g. throwing a string or raw object, instead of an `Error` in Firefox\n // Generating synthetic error doesn't add any value here\n //\n // We should probably somehow let a user know that they should fix their code\n if (!frame.url) {\n normalized.filename = stackInfoUrl; // fallback to whole stacks url from onerror handler\n }\n\n normalized.in_app = !// determine if an exception came from outside of our app\n // first we check the global includePaths list.\n (\n (!!this._globalOptions.includePaths.test &&\n !this._globalOptions.includePaths.test(normalized.filename)) ||\n // Now we check for fun, if the function name is Raven or TraceKit\n /(Raven|TraceKit)\\./.test(normalized['function']) ||\n // finally, we do a last ditch effort and check for raven.min.js\n /raven\\.(min\\.)?js$/.test(normalized.filename)\n );\n\n return normalized;\n },\n\n _processException: function(type, message, fileurl, lineno, frames, options) {\n var prefixedMessage = (type ? type + ': ' : '') + (message || '');\n if (\n !!this._globalOptions.ignoreErrors.test &&\n (this._globalOptions.ignoreErrors.test(message) ||\n this._globalOptions.ignoreErrors.test(prefixedMessage))\n ) {\n return;\n }\n\n var stacktrace;\n\n if (frames && frames.length) {\n fileurl = frames[0].filename || fileurl;\n // Sentry expects frames oldest to newest\n // and JS sends them as newest to oldest\n frames.reverse();\n stacktrace = {frames: frames};\n } else if (fileurl) {\n stacktrace = {\n frames: [\n {\n filename: fileurl,\n lineno: lineno,\n in_app: true\n }\n ]\n };\n }\n\n if (\n !!this._globalOptions.ignoreUrls.test &&\n this._globalOptions.ignoreUrls.test(fileurl)\n ) {\n return;\n }\n\n if (\n !!this._globalOptions.whitelistUrls.test &&\n !this._globalOptions.whitelistUrls.test(fileurl)\n ) {\n return;\n }\n\n var data = objectMerge(\n {\n // sentry.interfaces.Exception\n exception: {\n values: [\n {\n type: type,\n value: message,\n stacktrace: stacktrace\n }\n ]\n },\n transaction: fileurl\n },\n options\n );\n\n var ex = data.exception.values[0];\n if (ex.type == null && ex.value === '') {\n ex.value = 'Unrecoverable error caught';\n }\n\n // Move mechanism from options to exception interface\n // We do this, as requiring user to pass `{exception:{mechanism:{ ... }}}` would be\n // too much\n if (!data.exception.mechanism && data.mechanism) {\n data.exception.mechanism = data.mechanism;\n delete data.mechanism;\n }\n\n data.exception.mechanism = objectMerge(\n {\n type: 'generic',\n handled: true\n },\n data.exception.mechanism || {}\n );\n\n // Fire away!\n this._send(data);\n },\n\n _trimPacket: function(data) {\n // For now, we only want to truncate the two different messages\n // but this could/should be expanded to just trim everything\n var max = this._globalOptions.maxMessageLength;\n if (data.message) {\n data.message = truncate(data.message, max);\n }\n if (data.exception) {\n var exception = data.exception.values[0];\n exception.value = truncate(exception.value, max);\n }\n\n var request = data.request;\n if (request) {\n if (request.url) {\n request.url = truncate(request.url, this._globalOptions.maxUrlLength);\n }\n if (request.Referer) {\n request.Referer = truncate(request.Referer, this._globalOptions.maxUrlLength);\n }\n }\n\n if (data.breadcrumbs && data.breadcrumbs.values)\n this._trimBreadcrumbs(data.breadcrumbs);\n\n return data;\n },\n\n /**\n * Truncate breadcrumb values (right now just URLs)\n */\n _trimBreadcrumbs: function(breadcrumbs) {\n // known breadcrumb properties with urls\n // TODO: also consider arbitrary prop values that start with (https?)?://\n var urlProps = ['to', 'from', 'url'],\n urlProp,\n crumb,\n data;\n\n for (var i = 0; i < breadcrumbs.values.length; ++i) {\n crumb = breadcrumbs.values[i];\n if (\n !crumb.hasOwnProperty('data') ||\n !isObject(crumb.data) ||\n objectFrozen(crumb.data)\n )\n continue;\n\n data = objectMerge({}, crumb.data);\n for (var j = 0; j < urlProps.length; ++j) {\n urlProp = urlProps[j];\n if (data.hasOwnProperty(urlProp) && data[urlProp]) {\n data[urlProp] = truncate(data[urlProp], this._globalOptions.maxUrlLength);\n }\n }\n breadcrumbs.values[i].data = data;\n }\n },\n\n _getHttpData: function() {\n if (!this._hasNavigator && !this._hasDocument) return;\n var httpData = {};\n\n if (this._hasNavigator && _navigator.userAgent) {\n httpData.headers = {\n 'User-Agent': _navigator.userAgent\n };\n }\n\n // Check in `window` instead of `document`, as we may be in ServiceWorker environment\n if (_window.location && _window.location.href) {\n httpData.url = _window.location.href;\n }\n\n if (this._hasDocument && _document.referrer) {\n if (!httpData.headers) httpData.headers = {};\n httpData.headers.Referer = _document.referrer;\n }\n\n return httpData;\n },\n\n _resetBackoff: function() {\n this._backoffDuration = 0;\n this._backoffStart = null;\n },\n\n _shouldBackoff: function() {\n return this._backoffDuration && now() - this._backoffStart < this._backoffDuration;\n },\n\n /**\n * Returns true if the in-process data payload matches the signature\n * of the previously-sent data\n *\n * NOTE: This has to be done at this level because TraceKit can generate\n * data from window.onerror WITHOUT an exception object (IE8, IE9,\n * other old browsers). This can take the form of an \"exception\"\n * data object with a single frame (derived from the onerror args).\n */\n _isRepeatData: function(current) {\n var last = this._lastData;\n\n if (\n !last ||\n current.message !== last.message || // defined for captureMessage\n current.transaction !== last.transaction // defined for captureException/onerror\n )\n return false;\n\n // Stacktrace interface (i.e. from captureMessage)\n if (current.stacktrace || last.stacktrace) {\n return isSameStacktrace(current.stacktrace, last.stacktrace);\n } else if (current.exception || last.exception) {\n // Exception interface (i.e. from captureException/onerror)\n return isSameException(current.exception, last.exception);\n }\n\n return true;\n },\n\n _setBackoffState: function(request) {\n // If we are already in a backoff state, don't change anything\n if (this._shouldBackoff()) {\n return;\n }\n\n var status = request.status;\n\n // 400 - project_id doesn't exist or some other fatal\n // 401 - invalid/revoked dsn\n // 429 - too many requests\n if (!(status === 400 || status === 401 || status === 429)) return;\n\n var retry;\n try {\n // If Retry-After is not in Access-Control-Expose-Headers, most\n // browsers will throw an exception trying to access it\n if (supportsFetch()) {\n retry = request.headers.get('Retry-After');\n } else {\n retry = request.getResponseHeader('Retry-After');\n }\n\n // Retry-After is returned in seconds\n retry = parseInt(retry, 10) * 1000;\n } catch (e) {\n /* eslint no-empty:0 */\n }\n\n this._backoffDuration = retry\n ? // If Sentry server returned a Retry-After value, use it\n retry\n : // Otherwise, double the last backoff duration (starts at 1 sec)\n this._backoffDuration * 2 || 1000;\n\n this._backoffStart = now();\n },\n\n _send: function(data) {\n var globalOptions = this._globalOptions;\n\n var baseData = {\n project: this._globalProject,\n logger: globalOptions.logger,\n platform: 'javascript'\n },\n httpData = this._getHttpData();\n\n if (httpData) {\n baseData.request = httpData;\n }\n\n // HACK: delete `trimHeadFrames` to prevent from appearing in outbound payload\n if (data.trimHeadFrames) delete data.trimHeadFrames;\n\n data = objectMerge(baseData, data);\n\n // Merge in the tags and extra separately since objectMerge doesn't handle a deep merge\n data.tags = objectMerge(objectMerge({}, this._globalContext.tags), data.tags);\n data.extra = objectMerge(objectMerge({}, this._globalContext.extra), data.extra);\n\n // Send along our own collected metadata with extra\n data.extra['session:duration'] = now() - this._startTime;\n\n if (this._breadcrumbs && this._breadcrumbs.length > 0) {\n // intentionally make shallow copy so that additions\n // to breadcrumbs aren't accidentally sent in this request\n data.breadcrumbs = {\n values: [].slice.call(this._breadcrumbs, 0)\n };\n }\n\n if (this._globalContext.user) {\n // sentry.interfaces.User\n data.user = this._globalContext.user;\n }\n\n // Include the environment if it's defined in globalOptions\n if (globalOptions.environment) data.environment = globalOptions.environment;\n\n // Include the release if it's defined in globalOptions\n if (globalOptions.release) data.release = globalOptions.release;\n\n // Include server_name if it's defined in globalOptions\n if (globalOptions.serverName) data.server_name = globalOptions.serverName;\n\n data = this._sanitizeData(data);\n\n // Cleanup empty properties before sending them to the server\n Object.keys(data).forEach(function(key) {\n if (data[key] == null || data[key] === '' || isEmptyObject(data[key])) {\n delete data[key];\n }\n });\n\n if (isFunction(globalOptions.dataCallback)) {\n data = globalOptions.dataCallback(data) || data;\n }\n\n // Why??????????\n if (!data || isEmptyObject(data)) {\n return;\n }\n\n // Check if the request should be filtered or not\n if (\n isFunction(globalOptions.shouldSendCallback) &&\n !globalOptions.shouldSendCallback(data)\n ) {\n return;\n }\n\n // Backoff state: Sentry server previously responded w/ an error (e.g. 429 - too many requests),\n // so drop requests until \"cool-off\" period has elapsed.\n if (this._shouldBackoff()) {\n this._logDebug('warn', 'Raven dropped error due to backoff: ', data);\n return;\n }\n\n if (typeof globalOptions.sampleRate === 'number') {\n if (Math.random() < globalOptions.sampleRate) {\n this._sendProcessedPayload(data);\n }\n } else {\n this._sendProcessedPayload(data);\n }\n },\n\n _sanitizeData: function(data) {\n return sanitize(data, this._globalOptions.sanitizeKeys);\n },\n\n _getUuid: function() {\n return uuid4();\n },\n\n _sendProcessedPayload: function(data, callback) {\n var self = this;\n var globalOptions = this._globalOptions;\n\n if (!this.isSetup()) return;\n\n // Try and clean up the packet before sending by truncating long values\n data = this._trimPacket(data);\n\n // ideally duplicate error testing should occur *before* dataCallback/shouldSendCallback,\n // but this would require copying an un-truncated copy of the data packet, which can be\n // arbitrarily deep (extra_data) -- could be worthwhile? will revisit\n if (!this._globalOptions.allowDuplicates && this._isRepeatData(data)) {\n this._logDebug('warn', 'Raven dropped repeat event: ', data);\n return;\n }\n\n // Send along an event_id if not explicitly passed.\n // This event_id can be used to reference the error within Sentry itself.\n // Set lastEventId after we know the error should actually be sent\n this._lastEventId = data.event_id || (data.event_id = this._getUuid());\n\n // Store outbound payload after trim\n this._lastData = data;\n\n this._logDebug('debug', 'Raven about to send:', data);\n\n var auth = {\n sentry_version: '7',\n sentry_client: 'raven-js/' + this.VERSION,\n sentry_key: this._globalKey\n };\n\n if (this._globalSecret) {\n auth.sentry_secret = this._globalSecret;\n }\n\n var exception = data.exception && data.exception.values[0];\n\n // only capture 'sentry' breadcrumb is autoBreadcrumbs is truthy\n if (\n this._globalOptions.autoBreadcrumbs &&\n this._globalOptions.autoBreadcrumbs.sentry\n ) {\n this.captureBreadcrumb({\n category: 'sentry',\n message: exception\n ? (exception.type ? exception.type + ': ' : '') + exception.value\n : data.message,\n event_id: data.event_id,\n level: data.level || 'error' // presume error unless specified\n });\n }\n\n var url = this._globalEndpoint;\n (globalOptions.transport || this._makeRequest).call(this, {\n url: url,\n auth: auth,\n data: data,\n options: globalOptions,\n onSuccess: function success() {\n self._resetBackoff();\n\n self._triggerEvent('success', {\n data: data,\n src: url\n });\n callback && callback();\n },\n onError: function failure(error) {\n self._logDebug('error', 'Raven transport failed to send: ', error);\n\n if (error.request) {\n self._setBackoffState(error.request);\n }\n\n self._triggerEvent('failure', {\n data: data,\n src: url\n });\n error = error || new Error('Raven send failed (no additional details provided)');\n callback && callback(error);\n }\n });\n },\n\n _makeRequest: function(opts) {\n // Auth is intentionally sent as part of query string (NOT as custom HTTP header) to avoid preflight CORS requests\n var url = opts.url + '?' + urlencode(opts.auth);\n\n var evaluatedHeaders = null;\n var evaluatedFetchParameters = {};\n\n if (opts.options.headers) {\n evaluatedHeaders = this._evaluateHash(opts.options.headers);\n }\n\n if (opts.options.fetchParameters) {\n evaluatedFetchParameters = this._evaluateHash(opts.options.fetchParameters);\n }\n\n if (supportsFetch()) {\n evaluatedFetchParameters.body = stringify(opts.data);\n\n var defaultFetchOptions = objectMerge({}, this._fetchDefaults);\n var fetchOptions = objectMerge(defaultFetchOptions, evaluatedFetchParameters);\n\n if (evaluatedHeaders) {\n fetchOptions.headers = evaluatedHeaders;\n }\n\n return _window\n .fetch(url, fetchOptions)\n .then(function(response) {\n if (response.ok) {\n opts.onSuccess && opts.onSuccess();\n } else {\n var error = new Error('Sentry error code: ' + response.status);\n // It's called request only to keep compatibility with XHR interface\n // and not add more redundant checks in setBackoffState method\n error.request = response;\n opts.onError && opts.onError(error);\n }\n })\n ['catch'](function() {\n opts.onError &&\n opts.onError(new Error('Sentry error code: network unavailable'));\n });\n }\n\n var request = _window.XMLHttpRequest && new _window.XMLHttpRequest();\n if (!request) return;\n\n // if browser doesn't support CORS (e.g. IE7), we are out of luck\n var hasCORS = 'withCredentials' in request || typeof XDomainRequest !== 'undefined';\n\n if (!hasCORS) return;\n\n if ('withCredentials' in request) {\n request.onreadystatechange = function() {\n if (request.readyState !== 4) {\n return;\n } else if (request.status === 200) {\n opts.onSuccess && opts.onSuccess();\n } else if (opts.onError) {\n var err = new Error('Sentry error code: ' + request.status);\n err.request = request;\n opts.onError(err);\n }\n };\n } else {\n request = new XDomainRequest();\n // xdomainrequest cannot go http -> https (or vice versa),\n // so always use protocol relative\n url = url.replace(/^https?:/, '');\n\n // onreadystatechange not supported by XDomainRequest\n if (opts.onSuccess) {\n request.onload = opts.onSuccess;\n }\n if (opts.onError) {\n request.onerror = function() {\n var err = new Error('Sentry error code: XDomainRequest');\n err.request = request;\n opts.onError(err);\n };\n }\n }\n\n request.open('POST', url);\n\n if (evaluatedHeaders) {\n each(evaluatedHeaders, function(key, value) {\n request.setRequestHeader(key, value);\n });\n }\n\n request.send(stringify(opts.data));\n },\n\n _evaluateHash: function(hash) {\n var evaluated = {};\n\n for (var key in hash) {\n if (hash.hasOwnProperty(key)) {\n var value = hash[key];\n evaluated[key] = typeof value === 'function' ? value() : value;\n }\n }\n\n return evaluated;\n },\n\n _logDebug: function(level) {\n // We allow `Raven.debug` and `Raven.config(DSN, { debug: true })` to not make backward incompatible API change\n if (\n this._originalConsoleMethods[level] &&\n (this.debug || this._globalOptions.debug)\n ) {\n // In IE<10 console methods do not have their own 'apply' method\n Function.prototype.apply.call(\n this._originalConsoleMethods[level],\n this._originalConsole,\n [].slice.call(arguments, 1)\n );\n }\n },\n\n _mergeContext: function(key, context) {\n if (isUndefined(context)) {\n delete this._globalContext[key];\n } else {\n this._globalContext[key] = objectMerge(this._globalContext[key] || {}, context);\n }\n }\n};\n\n// Deprecations\nRaven.prototype.setUser = Raven.prototype.setUserContext;\nRaven.prototype.setReleaseContext = Raven.prototype.setRelease;\n\nmodule.exports = Raven;\n","/**\n * Enforces a single instance of the Raven client, and the\n * main entry point for Raven. If you are a consumer of the\n * Raven library, you SHOULD load this file (vs raven.js).\n **/\n\nvar RavenConstructor = require('./raven');\n\n// This is to be defensive in environments where window does not exist (see https://github.com/getsentry/raven-js/pull/785)\nvar _window =\n typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\nvar _Raven = _window.Raven;\n\nvar Raven = new RavenConstructor();\n\n/*\n * Allow multiple versions of Raven to be installed.\n * Strip Raven from the global context and returns the instance.\n *\n * @return {Raven}\n */\nRaven.noConflict = function() {\n _window.Raven = _Raven;\n return Raven;\n};\n\nRaven.afterLoad();\n\nmodule.exports = Raven;\n\n/**\n * DISCLAIMER:\n *\n * Expose `Client` constructor for cases where user want to track multiple \"sub-applications\" in one larger app.\n * It's not meant to be used by a wide audience, so pleaaase make sure that you know what you're doing before using it.\n * Accidentally calling `install` multiple times, may result in an unexpected behavior that's very hard to debug.\n *\n * It's called `Client' to be in-line with Raven Node implementation.\n *\n * HOWTO:\n *\n * import Raven from 'raven-js';\n *\n * const someAppReporter = new Raven.Client();\n * const someOtherAppReporter = new Raven.Client();\n *\n * someAppReporter.config('__DSN__', {\n * ...config goes here\n * });\n *\n * someOtherAppReporter.config('__OTHER_DSN__', {\n * ...config goes here\n * });\n *\n * someAppReporter.captureMessage(...);\n * someAppReporter.captureException(...);\n * someAppReporter.captureBreadcrumb(...);\n *\n * someOtherAppReporter.captureMessage(...);\n * someOtherAppReporter.captureException(...);\n * someOtherAppReporter.captureBreadcrumb(...);\n *\n * It should \"just work\".\n */\nmodule.exports.Client = RavenConstructor;\n","// ==========================================================================\n// Plyr.io demo\n// This code is purely for the https://plyr.io website\n// Please see readme.md in the root or github.com/sampotts/plyr\n// ==========================================================================\n\nimport Raven from 'raven-js';\n\n(() => {\n const isLive = window.location.host === 'plyr.io';\n\n // Raven / Sentry\n // For demo site (https://plyr.io) only\n if (isLive) {\n Raven.config(\n 'https://d4ad9866ad834437a4754e23937071e4@sentry.io/305555',\n ).install();\n }\n\n document.addEventListener('DOMContentLoaded', () => {\n Raven.context(() => {\n const selector = '#player';\n const container = document.getElementById('container');\n\n if (window.shr) {\n window.shr.setup({\n count: {\n classname: 'button__count',\n },\n });\n }\n\n // Setup tab focus\n const tabClassName = 'tab-focus';\n\n // Remove class on blur\n document.addEventListener('focusout', event => {\n if (container.contains(event.target)) {\n return;\n }\n event.target.classList.remove(tabClassName);\n });\n\n // Add classname to tabbed elements\n document.addEventListener('keydown', event => {\n if (event.keyCode !== 9) {\n return;\n }\n\n // Delay the adding of classname until the focus has changed\n // This event fires before the focusin event\n setTimeout(() => {\n const focused = document.activeElement;\n\n if (!focused || container.contains(focused)) {\n return;\n }\n\n focused.classList.add(tabClassName);\n }, 10);\n });\n\n // Setup the player\n const player = new Plyr(selector, {\n debug: true,\n title: 'View From A Blue Moon',\n iconUrl: '../dist/plyr.svg',\n keyboard: {\n global: true,\n },\n tooltips: {\n controls: false,\n seek: false,\n },\n // clickToPlay: false,\n /* controls: [\n 'play-large',\n 'restart',\n 'rewind',\n 'play',\n 'fast-forward',\n 'progress',\n 'current-time',\n 'duration',\n 'mute',\n 'volume',\n 'captions',\n 'settings',\n 'pip',\n 'airplay',\n 'fullscreen',\n ], */\n /* i18n: {\n restart: '重新開始',\n rewind: '快退{seektime}秒',\n play: '播放',\n pause: '暫停',\n fastForward: '快進{seektime}秒',\n seek: '尋求',\n played: '發揮',\n buffered: '緩衝的',\n currentTime: '當前時間戳',\n duration: '長短',\n volume: '音量',\n mute: '靜音',\n unmute: '取消靜音',\n enableCaptions: '開啟字幕',\n disableCaptions: '關閉字幕',\n enterFullscreen: '進入全螢幕',\n exitFullscreen: '退出全螢幕',\n frameTitle: '球員為{title}',\n captions: '字幕',\n settings: '設定',\n speed: '速度',\n normal: '正常',\n quality: '質量',\n loop: '循環',\n start: 'Start',\n end: 'End',\n all: 'All',\n reset: '重啟',\n disabled: '殘',\n enabled: '啟用',\n advertisement: '廣告',\n }, */\n captions: {\n active: true,\n },\n keys: {\n google: 'AIzaSyDrNwtN3nLH_8rjCmu5Wq3ZCm4MNAVdc0c',\n },\n ads: {\n // enabled: true,\n publisherId: '918848828995742',\n },\n });\n\n // Expose for tinkering in the console\n window.player = player;\n\n // Setup type toggle\n const buttons = document.querySelectorAll('[data-source]');\n const types = {\n video: 'video',\n audio: 'audio',\n youtube: 'youtube',\n vimeo: 'vimeo',\n };\n let currentType = window.location.hash.replace('#', '');\n const historySupport = window.history && window.history.pushState;\n\n // Toggle class on an element\n function toggleClass(element, className, state) {\n if (element) {\n element.classList[state ? 'add' : 'remove'](className);\n }\n }\n\n // Set a new source\n function newSource(type, init) {\n // Bail if new type isn't known, it's the current type, or current type is empty (video is default) and new type is video\n if (\n !(type in types) ||\n (!init && type === currentType) ||\n (!currentType.length && type === types.video)\n ) {\n return;\n }\n\n switch (type) {\n case types.video:\n player.source = {\n type: 'video',\n title: 'View From A Blue Moon',\n sources: [\n {\n src:\n 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-576p.mp4',\n type: 'video/mp4',\n size: 576,\n },\n {\n src:\n 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-720p.mp4',\n type: 'video/mp4',\n size: 720,\n },\n {\n src:\n 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-1080p.mp4',\n type: 'video/mp4',\n size: 1080,\n },\n {\n src:\n 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-1440p.mp4',\n type: 'video/mp4',\n size: 1440,\n },\n ],\n poster:\n 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.jpg',\n tracks: [\n {\n kind: 'captions',\n label: 'English',\n srclang: 'en',\n src:\n 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.en.vtt',\n default: true,\n },\n {\n kind: 'captions',\n label: 'French',\n srclang: 'fr',\n src:\n 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.fr.vtt',\n },\n ],\n };\n\n break;\n\n case types.audio:\n player.source = {\n type: 'audio',\n title:\n 'Kishi Bashi – “It All Began With A Burst”',\n sources: [\n {\n src:\n 'https://cdn.plyr.io/static/demo/Kishi_Bashi_-_It_All_Began_With_a_Burst.mp3',\n type: 'audio/mp3',\n },\n {\n src:\n 'https://cdn.plyr.io/static/demo/Kishi_Bashi_-_It_All_Began_With_a_Burst.ogg',\n type: 'audio/ogg',\n },\n ],\n };\n\n break;\n\n case types.youtube:\n player.source = {\n type: 'video',\n sources: [\n {\n src:\n 'https://youtube.com/watch?v=bTqVqk7FSmY',\n provider: 'youtube',\n },\n ],\n };\n\n break;\n\n case types.vimeo:\n player.source = {\n type: 'video',\n sources: [\n {\n src: 'https://vimeo.com/76979871',\n provider: 'vimeo',\n },\n ],\n };\n\n break;\n\n default:\n break;\n }\n\n // Set the current type for next time\n currentType = type;\n\n // Remove active classes\n Array.from(buttons).forEach(button =>\n toggleClass(button.parentElement, 'active', false),\n );\n\n // Set active on parent\n toggleClass(\n document.querySelector(`[data-source=\"${type}\"]`),\n 'active',\n true,\n );\n\n // Show cite\n Array.from(document.querySelectorAll('.plyr__cite')).forEach(\n cite => {\n cite.setAttribute('hidden', '');\n },\n );\n document\n .querySelector(`.plyr__cite--${type}`)\n .removeAttribute('hidden');\n }\n\n // Bind to each button\n Array.from(buttons).forEach(button => {\n button.addEventListener('click', () => {\n const type = button.getAttribute('data-source');\n\n newSource(type);\n\n if (historySupport) {\n window.history.pushState({ type }, '', `#${type}`);\n }\n });\n });\n\n // List for backwards/forwards\n window.addEventListener('popstate', event => {\n if (event.state && 'type' in event.state) {\n newSource(event.state.type);\n }\n });\n\n // On load\n if (historySupport) {\n const video = !currentType.length;\n\n // If there's no current type set, assume video\n if (video) {\n currentType = types.video;\n }\n\n // Replace current history state\n if (currentType in types) {\n window.history.replaceState(\n {\n type: currentType,\n },\n '',\n video ? '' : `#${currentType}`,\n );\n }\n\n // If it's not video, load the source\n if (currentType !== types.video) {\n newSource(currentType, true);\n }\n }\n });\n });\n\n // Google analytics\n // For demo site (https://plyr.io) only\n /* eslint-disable */\n if (isLive) {\n (function(i, s, o, g, r, a, m) {\n i.GoogleAnalyticsObject = r;\n i[r] =\n i[r] ||\n function() {\n (i[r].q = i[r].q || []).push(arguments);\n };\n i[r].l = 1 * new Date();\n a = s.createElement(o);\n m = s.getElementsByTagName(o)[0];\n a.async = 1;\n a.src = g;\n m.parentNode.insertBefore(a, m);\n })(\n window,\n document,\n 'script',\n 'https://www.google-analytics.com/analytics.js',\n 'ga',\n );\n window.ga('create', 'UA-40881672-11', 'auto');\n window.ga('send', 'pageview');\n }\n /* eslint-enable */\n})();\n"]} \ No newline at end of file diff --git a/demo/dist/demo.min.js b/demo/dist/demo.min.js new file mode 100644 index 00000000..c4be1617 --- /dev/null +++ b/demo/dist/demo.min.js @@ -0,0 +1,2 @@ +"object"==typeof navigator&&function(){"use strict";var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var t,r=(function(e,t){function r(e,t){for(var r=0;r0){var s=r(n,this);~s?n.splice(s+1):n.push(this),~s?o.splice(s,1/0,i):o.push(i),~r(n,a)&&(a=t.call(this,i,a))}else n.push(a);return null==e?a instanceof Error?function(e){var t={stack:e.stack,message:e.message,name:e.name};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}(a):a:e.call(this,i,a)}}(e.exports=function(e,t,r,o){return JSON.stringify(e,n(t,o),r)}).getSerialize=n}(t={exports:{}},t.exports),t.exports),n=(r.getSerialize,"undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{});function o(e){return void 0===e}function i(e){return"[object Object]"===Object.prototype.toString.call(e)}function a(e){return"[object String]"===Object.prototype.toString.call(e)}function s(e){return"[object Array]"===Object.prototype.toString.call(e)}function c(){if(!("fetch"in n))return!1;try{return new Headers,new Request(""),new Response,!0}catch(e){return!1}}function l(e,t){var r,n;if(o(e.length))for(r in e)h(e,r)&&t.call(null,r,e[r]);else if(n=e.length)for(r=0;r ".length;e&&n++<5&&!("html"===(t=f(e))||n>1&&o+r.length*i+t.length>=80);)r.push(t),o+=t.length,e=e.parentNode;return r.reverse().join(" > ")},htmlElementAsString:f,isSameException:function(e,t){return!d(e,t)&&(e=e.values[0],t=t.values[0],e.type===t.type&&e.value===t.value&&(r=e.stacktrace,n=t.stacktrace,(!o(r)||!o(n))&&g(e.stacktrace,t.stacktrace)));var r,n},isSameStacktrace:g,parseUrl:function(e){if("string"!=typeof e)return{};var t=e.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/),r=t[6]||"",n=t[8]||"";return{protocol:t[2],host:t[4],path:t[5],relative:t[5]+r+n}},fill:function(e,t,r,n){if(null!=e){var o=e[t];e[t]=r(o),e[t].__raven__=!0,e[t].__orig__=o,n&&n.push([e,t,o])}},safeJoin:function(e,t){if(!s(e))return"";for(var r=[],n=0;no?e(t,n-1):a},serializeKeysForMessage:function(e,t){if("number"==typeof e||"string"==typeof e)return e.toString();if(!Array.isArray(e))return"";if(0===(e=e.filter(function(e){return"string"==typeof e})).length)return"[object has no keys]";if(t="number"!=typeof t?v:t,e[0].length>=t)return e[0];for(var r=e.length;r>0;r--){var n=e.slice(0,r).join(", ");if(!(n.length>t))return r===e.length?n:n+"…"}return""},sanitize:function(e,t){if(!s(t)||s(t)&&0===t.length)return e;var n,o=p(t),a="********";try{n=JSON.parse(r(e))}catch(t){return e}return function e(t){return s(t)?t.map(function(t){return e(t)}):i(t)?Object.keys(t).reduce(function(r,n){return o.test(n)?r[n]=a:r[n]=e(t[n]),r},{}):t}(n)}},w={collectWindowErrors:!0,debug:!1},x="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},k=[].slice,S="?",O=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;function C(){return"undefined"==typeof document||null==document.location?"":document.location.href}w.report=function(){var e,t,r=[],n=null,o=null,i=null;function a(e,t){var n=null;if(!t||w.collectWindowErrors){for(var o in r)if(r.hasOwnProperty(o))try{r[o].apply(null,[e].concat(k.call(arguments,2)))}catch(e){n=e}if(n)throw n}}function s(t,r,n,o,s){var l=E.isErrorEvent(s)?s.error:s,u=E.isErrorEvent(t)?t.message:t;if(i)w.computeStackTrace.augmentStackTraceWithInitialElement(i,r,n,u),c();else if(l&&E.isError(l))a(w.computeStackTrace(l),!0);else{var h,p={url:r,line:n,column:o},f=void 0;if("[object String]"==={}.toString.call(u))(h=u.match(O))&&(f=h[1],u=h[2]);p.func=S,a({name:f,message:u,url:C(),stack:[p]},!0)}return!!e&&e.apply(this,arguments)}function c(){var e=i,t=n;n=null,i=null,o=null,a.apply(null,[e,!1].concat(t))}function l(e,t){var r=k.call(arguments,1);if(i){if(o===e)return;c()}var a=w.computeStackTrace(e);if(i=a,o=e,n=r,setTimeout(function(){o===e&&c()},a.incomplete?2e3:0),!1!==t)throw e}return l.subscribe=function(n){t||(e=x.onerror,x.onerror=s,t=!0),r.push(n)},l.unsubscribe=function(e){for(var t=r.length-1;t>=0;--t)r[t]===e&&r.splice(t,1)},l.uninstall=function(){t&&(x.onerror=e,t=!1,e=void 0),r=[]},l}(),w.computeStackTrace=function(){function e(e){if(void 0!==e.stack&&e.stack){for(var t,r,n,o=/^\s*at (?:(.*?) ?\()?((?:file|https?|blob|chrome-extension|native|eval|webpack||[a-z]:|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,i=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx(?:-web)|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,a=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|moz-extension).*?:\/.*?|\[native code\]|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,s=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,c=/\((\S*)(?::(\d+))(?::(\d+))\)/,l=e.stack.split("\n"),u=[],h=(/^(.*) is undefined$/.exec(e.message),0),p=l.length;h eval")>-1&&(t=s.exec(r[3]))?(r[3]=t[1],r[4]=t[2],r[5]=null):0!==h||r[5]||void 0===e.columnNumber||(u[0].column=e.columnNumber+1),n={url:r[3],func:r[1]||S,args:r[2]?r[2].split(","):[],line:r[4]?+r[4]:null,column:r[5]?+r[5]:null}}if(!n.func&&n.line&&(n.func=S),n.url&&"blob:"===n.url.substr(0,5)){var d=new XMLHttpRequest;if(d.open("GET",n.url,!1),d.send(null),200===d.status){var g=d.responseText||"",m=(g=g.slice(-300)).match(/\/\/# sourceMappingURL=(.*)$/);if(m){var _=m[1];"~"===_.charAt(0)&&(_=("undefined"==typeof document||null==document.location?"":document.location.origin?document.location.origin:document.location.protocol+"//"+document.location.hostname+(document.location.port?":"+document.location.port:""))+_.slice(1)),n.url=_.slice(0,-4)}}}u.push(n)}return u.length?{name:e.name,message:e.message,url:C(),stack:u}:null}}function t(e,t,r,n){var o={url:t,line:r};if(o.url&&o.line){if(e.incomplete=!1,o.func||(o.func=S),e.stack.length>0&&e.stack[0].url===o.url){if(e.stack[0].line===o.line)return!1;if(!e.stack[0].line&&e.stack[0].func===o.func)return e.stack[0].line=o.line,!1}return e.stack.unshift(o),e.partial=!0,!0}return e.incomplete=!0,!1}function r(e,o){for(var i,a,s=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,c=[],l={},u=!1,h=r.caller;h&&!u;h=h.caller)if(h!==n&&h!==w.report){if(a={url:null,func:S,line:null,column:null},h.name?a.func=h.name:(i=s.exec(h.toString()))&&(a.func=i[1]),void 0===a.func)try{a.func=i.input.substring(0,i.input.indexOf("{"))}catch(e){}l[""+h]?u=!0:l[""+h]=!0,c.push(a)}o&&c.splice(0,o);var p={name:e.name,message:e.message,url:C(),stack:c};return t(p,e.sourceURL||e.fileName,e.line||e.lineNumber,e.message||e.description),p}function n(t,n){var o=null;n=null==n?0:+n;try{if(o=e(t))return o}catch(e){if(w.debug)throw e}try{if(o=r(t,n+1))return o}catch(e){if(w.debug)throw e}return{name:t.name,message:t.message,url:C()}}return n.augmentStackTraceWithInitialElement=t,n.computeStackTraceFromStackProp=e,n}();var j=w;function R(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function T(e,t,r,n,o,i){return R((a=R(R(t,e),R(n,i)))<<(s=o)|a>>>32-s,r);var a,s}function F(e,t,r,n,o,i,a){return T(t&r|~t&n,e,t,o,i,a)}function D(e,t,r,n,o,i,a){return T(t&n|r&~n,e,t,o,i,a)}function A(e,t,r,n,o,i,a){return T(t^r^n,e,t,o,i,a)}function B(e,t,r,n,o,i,a){return T(r^(t|~n),e,t,o,i,a)}function M(e,t){var r,n,o,i,a;e[t>>5]|=128<>>9<<4)]=t;var s=1732584193,c=-271733879,l=-1732584194,u=271733878;for(r=0;r>5]>>>t%32&255);return r}function L(e){var t,r=[];for(r[(e.length>>2)-1]=void 0,t=0;t>5]|=(255&e.charCodeAt(t/8))<>>4&15)+"0123456789abcdef".charAt(15&t);return n}function P(e){return unescape(encodeURIComponent(e))}function U(e){return function(e){return H(M(L(e),8*e.length))}(P(e))}function N(e,t){return function(e,t){var r,n,o=L(e),i=[],a=[];for(i[15]=a[15]=void 0,o.length>16&&(o=M(o,8*e.length)),r=0;r<16;r+=1)i[r]=909522486^o[r],a[r]=1549556828^o[r];return n=M(i.concat(L(t)),512+8*t.length),H(M(a.concat(n),640))}(P(e),P(t))}var q=function(e,t,r){return t?r?N(t,e):I(N(t,e)):r?U(e):I(U(e))};function z(e){this.name="RavenConfigError",this.message=e}z.prototype=new Error,z.prototype.constructor=z;var K=z,W=function(e,t,r){var n=e[t],o=e;if(t in e){var i="warn"===t?"warning":t;e[t]=function(){var e=[].slice.call(arguments),a=E.safeJoin(e," "),s={level:i,logger:"console",extra:{arguments:e}};"assert"===t?!1===e[0]&&(a="Assertion failed: "+(E.safeJoin(e.slice(1)," ")||"console.assert"),s.extra.arguments=e.slice(1),r&&r(a,s)):r&&r(a,s),n&&Function.prototype.apply.call(n,o,e)}}},V=E.isErrorEvent,$=E.isDOMError,X=E.isDOMException,J=E.isError,G=E.isObject,Y=E.isPlainObject,Z=E.isUndefined,Q=E.isFunction,ee=E.isString,te=E.isArray,re=E.isEmptyObject,ne=E.each,oe=E.objectMerge,ie=E.truncate,ae=E.objectFrozen,se=E.hasKey,ce=E.joinRegExp,le=E.urlencode,ue=E.uuid4,he=E.htmlTreeAsString,pe=E.isSameException,fe=E.isSameStacktrace,de=E.parseUrl,ge=E.fill,me=E.supportsFetch,_e=E.supportsReferrerPolicy,ve=E.serializeKeysForMessage,be=E.serializeException,ye=E.sanitize,Ee=W,we="source protocol user pass host port path".split(" "),xe=/^(?:(\w+):)?\/\/(?:(\w+)(:\w+)?@)?([\w\.-]+)(?::(\d+))?(\/.*)/;function ke(){return+new Date}var Se="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},Oe=Se.document,Ce=Se.navigator;function je(e,t){return Q(t)?function(r){return t(r,e)}:t}function Re(){for(var e in this._hasJSON=!("object"!=typeof JSON||!JSON.stringify),this._hasDocument=!Z(Oe),this._hasNavigator=!Z(Ce),this._lastCapturedException=null,this._lastData=null,this._lastEventId=null,this._globalServer=null,this._globalKey=null,this._globalProject=null,this._globalContext={},this._globalOptions={release:Se.SENTRY_RELEASE&&Se.SENTRY_RELEASE.id,logger:"javascript",ignoreErrors:[],ignoreUrls:[],whitelistUrls:[],includePaths:[],headers:null,collectWindowErrors:!0,captureUnhandledRejections:!0,maxMessageLength:0,maxUrlLength:250,stackTraceLimit:50,autoBreadcrumbs:!0,instrument:!0,sampleRate:1,sanitizeKeys:[]},this._fetchDefaults={method:"POST",keepalive:!0,referrerPolicy:_e()?"origin":""},this._ignoreOnError=0,this._isRavenInstalled=!1,this._originalErrorStackTraceLimit=Error.stackTraceLimit,this._originalConsole=Se.console||{},this._originalConsoleMethods={},this._plugins=[],this._startTime=ke(),this._wrappedBuiltIns=[],this._breadcrumbs=[],this._lastCapturedEvent=null,this._keypressTimeout,this._location=Se.location,this._lastHref=this._location&&this._location.href,this._resetBackoff(),this._originalConsole)this._originalConsoleMethods[e]=this._originalConsole[e]}Re.prototype={VERSION:"3.26.4",debug:!1,TraceKit:j,config:function(e,t){var r=this;if(r._globalServer)return this._logDebug("error","Error: Raven has already been configured"),r;if(!e)return r;var n=r._globalOptions;t&&ne(t,function(e,t){"tags"===e||"extra"===e||"user"===e?r._globalContext[e]=t:n[e]=t}),r.setDSN(e),n.ignoreErrors.push(/^Script error\.?$/),n.ignoreErrors.push(/^Javascript error: Script error\.? on line 0$/),n.ignoreErrors=ce(n.ignoreErrors),n.ignoreUrls=!!n.ignoreUrls.length&&ce(n.ignoreUrls),n.whitelistUrls=!!n.whitelistUrls.length&&ce(n.whitelistUrls),n.includePaths=ce(n.includePaths),n.maxBreadcrumbs=Math.max(0,Math.min(n.maxBreadcrumbs||100,100));var o={xhr:!0,console:!0,dom:!0,location:!0,sentry:!0},i=n.autoBreadcrumbs;"[object Object]"==={}.toString.call(i)?i=oe(o,i):!1!==i&&(i=o),n.autoBreadcrumbs=i;var a={tryCatch:!0},s=n.instrument;return"[object Object]"==={}.toString.call(s)?s=oe(a,s):!1!==s&&(s=a),n.instrument=s,j.collectWindowErrors=!!n.collectWindowErrors,r},install:function(){var e=this;return e.isSetup()&&!e._isRavenInstalled&&(j.report.subscribe(function(){e._handleOnErrorStackInfo.apply(e,arguments)}),e._globalOptions.captureUnhandledRejections&&e._attachPromiseRejectionHandler(),e._patchFunctionToString(),e._globalOptions.instrument&&e._globalOptions.instrument.tryCatch&&e._instrumentTryCatch(),e._globalOptions.autoBreadcrumbs&&e._instrumentBreadcrumbs(),e._drainPlugins(),e._isRavenInstalled=!0),Error.stackTraceLimit=e._globalOptions.stackTraceLimit,this},setDSN:function(e){var t=this._parseDSN(e),r=t.path.lastIndexOf("/"),n=t.path.substr(1,r);this._dsn=e,this._globalKey=t.user,this._globalSecret=t.pass&&t.pass.substr(1),this._globalProject=t.path.substr(r+1),this._globalServer=this._getGlobalServer(t),this._globalEndpoint=this._globalServer+"/"+n+"api/"+this._globalProject+"/store/",this._resetBackoff()},context:function(e,t,r){return Q(e)&&(r=t||[],t=e,e={}),this.wrap(e,t).apply(this,r)},wrap:function(e,t,r){var n=this;if(Z(t)&&!Q(e))return e;if(Q(e)&&(t=e,e=void 0),!Q(t))return t;try{if(t.__raven__)return t;if(t.__raven_wrapper__)return t.__raven_wrapper__}catch(e){return t}function o(){var o=[],i=arguments.length,a=!e||e&&!1!==e.deep;for(r&&Q(r)&&r.apply(this,arguments);i--;)o[i]=a?n.wrap(e,arguments[i]):arguments[i];try{return t.apply(this,o)}catch(t){throw n._ignoreNextOnError(),n.captureException(t,e),t}}for(var i in t)se(t,i)&&(o[i]=t[i]);return o.prototype=t.prototype,t.__raven_wrapper__=o,o.__raven__=!0,o.__orig__=t,o},uninstall:function(){return j.report.uninstall(),this._detachPromiseRejectionHandler(),this._unpatchFunctionToString(),this._restoreBuiltIns(),this._restoreConsole(),Error.stackTraceLimit=this._originalErrorStackTraceLimit,this._isRavenInstalled=!1,this},_promiseRejectionHandler:function(e){this._logDebug("debug","Raven caught unhandled promise rejection:",e),this.captureException(e.reason,{mechanism:{type:"onunhandledrejection",handled:!1}})},_attachPromiseRejectionHandler:function(){return this._promiseRejectionHandler=this._promiseRejectionHandler.bind(this),Se.addEventListener&&Se.addEventListener("unhandledrejection",this._promiseRejectionHandler),this},_detachPromiseRejectionHandler:function(){return Se.removeEventListener&&Se.removeEventListener("unhandledrejection",this._promiseRejectionHandler),this},captureException:function(e,t){if(t=oe({trimHeadFrames:0},t||{}),V(e)&&e.error)e=e.error;else{if($(e)||X(e)){var r=e.name||($(e)?"DOMError":"DOMException"),n=e.message?r+": "+e.message:r;return this.captureMessage(n,oe(t,{stacktrace:!0,trimHeadFrames:t.trimHeadFrames+1}))}if(J(e))e=e;else{if(!Y(e))return this.captureMessage(e,oe(t,{stacktrace:!0,trimHeadFrames:t.trimHeadFrames+1}));t=this._getCaptureExceptionOptionsFromPlainObject(t,e),e=new Error(t.message)}}this._lastCapturedException=e;try{var o=j.computeStackTrace(e);this._handleStackInfo(o,t)}catch(t){if(e!==t)throw t}return this},_getCaptureExceptionOptionsFromPlainObject:function(e,t){var r=Object.keys(t).sort(),n=oe(e,{message:"Non-Error exception captured with keys: "+ve(r),fingerprint:[q(r)],extra:e.extra||{}});return n.extra.__serialized__=be(t),n},captureMessage:function(e,t){if(!this._globalOptions.ignoreErrors.test||!this._globalOptions.ignoreErrors.test(e)){var r,n=oe({message:e+=""},t=t||{});try{throw new Error(e)}catch(e){r=e}r.name=null;var o=j.computeStackTrace(r),i=te(o.stack)&&o.stack[1];i&&"Raven.captureException"===i.func&&(i=o.stack[2]);var a=i&&i.url||"";if((!this._globalOptions.ignoreUrls.test||!this._globalOptions.ignoreUrls.test(a))&&(!this._globalOptions.whitelistUrls.test||this._globalOptions.whitelistUrls.test(a))){if(this._globalOptions.stacktrace||t.stacktrace||""===n.message){n.fingerprint=null==n.fingerprint?e:n.fingerprint,(t=oe({trimHeadFrames:0},t)).trimHeadFrames+=1;var s=this._prepareFrames(o,t);n.stacktrace={frames:s.reverse()}}return n.fingerprint&&(n.fingerprint=te(n.fingerprint)?n.fingerprint:[n.fingerprint]),this._send(n),this}}},captureBreadcrumb:function(e){var t=oe({timestamp:ke()/1e3},e);if(Q(this._globalOptions.breadcrumbCallback)){var r=this._globalOptions.breadcrumbCallback(t);if(G(r)&&!re(r))t=r;else if(!1===r)return this}return this._breadcrumbs.push(t),this._breadcrumbs.length>this._globalOptions.maxBreadcrumbs&&this._breadcrumbs.shift(),this},addPlugin:function(e){var t=[].slice.call(arguments,1);return this._plugins.push([e,t]),this._isRavenInstalled&&this._drainPlugins(),this},setUserContext:function(e){return this._globalContext.user=e,this},setExtraContext:function(e){return this._mergeContext("extra",e),this},setTagsContext:function(e){return this._mergeContext("tags",e),this},clearContext:function(){return this._globalContext={},this},getContext:function(){return JSON.parse(r(this._globalContext))},setEnvironment:function(e){return this._globalOptions.environment=e,this},setRelease:function(e){return this._globalOptions.release=e,this},setDataCallback:function(e){var t=this._globalOptions.dataCallback;return this._globalOptions.dataCallback=je(t,e),this},setBreadcrumbCallback:function(e){var t=this._globalOptions.breadcrumbCallback;return this._globalOptions.breadcrumbCallback=je(t,e),this},setShouldSendCallback:function(e){var t=this._globalOptions.shouldSendCallback;return this._globalOptions.shouldSendCallback=je(t,e),this},setTransport:function(e){return this._globalOptions.transport=e,this},lastException:function(){return this._lastCapturedException},lastEventId:function(){return this._lastEventId},isSetup:function(){return!!this._hasJSON&&(!!this._globalServer||(this.ravenNotConfiguredError||(this.ravenNotConfiguredError=!0,this._logDebug("error","Error: Raven has not been configured.")),!1))},afterLoad:function(){var e=Se.RavenConfig;e&&this.config(e.dsn,e.config).install()},showReportDialog:function(e){if(Oe){if(!(e=Object.assign({eventId:this.lastEventId(),dsn:this._dsn,user:this._globalContext.user||{}},e)).eventId)throw new K("Missing eventId");if(!e.dsn)throw new K("Missing DSN");var t=encodeURIComponent,r=[];for(var n in e)if("user"===n){var o=e.user;o.name&&r.push("name="+t(o.name)),o.email&&r.push("email="+t(o.email))}else r.push(t(n)+"="+t(e[n]));var i=this._getGlobalServer(this._parseDSN(e.dsn)),a=Oe.createElement("script");a.async=!0,a.src=i+"/api/embed/error-page/?"+r.join("&"),(Oe.head||Oe.body).appendChild(a)}},_ignoreNextOnError:function(){var e=this;this._ignoreOnError+=1,setTimeout(function(){e._ignoreOnError-=1})},_triggerEvent:function(e,t){var r,n;if(this._hasDocument){for(n in t=t||{},e="raven"+e.substr(0,1).toUpperCase()+e.substr(1),Oe.createEvent?(r=Oe.createEvent("HTMLEvents")).initEvent(e,!0,!0):(r=Oe.createEventObject()).eventType=e,t)se(t,n)&&(r[n]=t[n]);if(Oe.createEvent)Oe.dispatchEvent(r);else try{Oe.fireEvent("on"+r.eventType.toLowerCase(),r)}catch(e){}}},_breadcrumbEventHandler:function(e){var t=this;return function(r){if(t._keypressTimeout=null,t._lastCapturedEvent!==r){var n;t._lastCapturedEvent=r;try{n=he(r.target)}catch(e){n=""}t.captureBreadcrumb({category:"ui."+e,message:n})}}},_keypressEventHandler:function(){var e=this;return function(t){var r;try{r=t.target}catch(e){return}var n=r&&r.tagName;if(n&&("INPUT"===n||"TEXTAREA"===n||r.isContentEditable)){var o=e._keypressTimeout;o||e._breadcrumbEventHandler("input")(t),clearTimeout(o),e._keypressTimeout=setTimeout(function(){e._keypressTimeout=null},1e3)}}},_captureUrlChange:function(e,t){var r=de(this._location.href),n=de(t),o=de(e);this._lastHref=t,r.protocol===n.protocol&&r.host===n.host&&(t=n.relative),r.protocol===o.protocol&&r.host===o.host&&(e=o.relative),this.captureBreadcrumb({category:"navigation",data:{to:t,from:e}})},_patchFunctionToString:function(){var e=this;e._originalFunctionToString=Function.prototype.toString,Function.prototype.toString=function(){return"function"==typeof this&&this.__raven__?e._originalFunctionToString.apply(this.__orig__,arguments):e._originalFunctionToString.apply(this,arguments)}},_unpatchFunctionToString:function(){this._originalFunctionToString&&(Function.prototype.toString=this._originalFunctionToString)},_instrumentTryCatch:function(){var e=this,t=e._wrappedBuiltIns;function r(t){return function(r,n){for(var o=new Array(arguments.length),i=0;i"}}},a)),t.apply?t.apply(this,o):t(o[0],o[1])}}var n=this._globalOptions.autoBreadcrumbs;function o(r){var o=Se[r]&&Se[r].prototype;o&&o.hasOwnProperty&&o.hasOwnProperty("addEventListener")&&(ge(o,"addEventListener",function(t){return function(o,i,a,s){try{i&&i.handleEvent&&(i.handleEvent=e.wrap({mechanism:{type:"instrument",data:{target:r,function:"handleEvent",handler:i&&i.name||""}}},i.handleEvent))}catch(e){}var c,l,u;return n&&n.dom&&("EventTarget"===r||"Node"===r)&&(l=e._breadcrumbEventHandler("click"),u=e._keypressEventHandler(),c=function(e){if(e){var t;try{t=e.type}catch(e){return}return"click"===t?l(e):"keypress"===t?u(e):void 0}}),t.call(this,o,e.wrap({mechanism:{type:"instrument",data:{target:r,function:"addEventListener",handler:i&&i.name||""}}},i,c),a,s)}},t),ge(o,"removeEventListener",function(e){return function(t,r,n,o){try{r=r&&(r.__raven_wrapper__?r.__raven_wrapper__:r)}catch(e){}return e.call(this,t,r,n,o)}},t))}ge(Se,"setTimeout",r,t),ge(Se,"setInterval",r,t),Se.requestAnimationFrame&&ge(Se,"requestAnimationFrame",function(t){return function(r){return t(e.wrap({mechanism:{type:"instrument",data:{function:"requestAnimationFrame",handler:t&&t.name||""}}},r))}},t);for(var i=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],a=0;a"}}},r)})}if(t.xhr&&"XMLHttpRequest"in Se){var o=Se.XMLHttpRequest&&Se.XMLHttpRequest.prototype;ge(o,"open",function(t){return function(r,n){return ee(n)&&-1===n.indexOf(e._globalKey)&&(this.__raven_xhr={method:r,url:n,status_code:null}),t.apply(this,arguments)}},r),ge(o,"send",function(t){return function(){var r=this;function o(){if(r.__raven_xhr&&4===r.readyState){try{r.__raven_xhr.status_code=r.status}catch(e){}e.captureBreadcrumb({type:"http",category:"xhr",data:r.__raven_xhr})}}for(var i=["onload","onerror","onprogress"],a=0;a"}}},t,o)}):r.onreadystatechange=o,t.apply(this,arguments)}},r)}t.xhr&&me()&&ge(Se,"fetch",function(t){return function(){for(var r=new Array(arguments.length),n=0;n2?arguments[2]:void 0;return r&&e._captureUrlChange(e._lastHref,r+""),t.apply(this,arguments)}};ge(Se.history,"pushState",c,r),ge(Se.history,"replaceState",c,r)}if(t.console&&"console"in Se&&console.log){var l=function(t,r){e.captureBreadcrumb({message:t,level:r.level,category:"console"})};ne(["debug","info","warn","error","log"],function(e,t){Ee(console,t,l)})}},_restoreBuiltIns:function(){for(var e;this._wrappedBuiltIns.length;){var t=(e=this._wrappedBuiltIns.shift())[0],r=e[1],n=e[2];t[r]=n}},_restoreConsole:function(){for(var e in this._originalConsoleMethods)this._originalConsole[e]=this._originalConsoleMethods[e]},_drainPlugins:function(){var e=this;ne(this._plugins,function(t,r){var n=r[0],o=r[1];n.apply(e,[e].concat(o))})},_parseDSN:function(e){var t=xe.exec(e),r={},n=7;try{for(;n--;)r[we[n]]=t[n]||""}catch(t){throw new K("Invalid DSN: "+e)}if(r.pass&&!this._globalOptions.allowSecretKey)throw new K("Do not specify your secret key in the DSN. See: http://bit.ly/raven-secret-key");return r},_getGlobalServer:function(e){var t="//"+e.host+(e.port?":"+e.port:"");return e.protocol&&(t=e.protocol+":"+t),t},_handleOnErrorStackInfo:function(e,t){(t=t||{}).mechanism=t.mechanism||{type:"onerror",handled:!1},this._ignoreOnError||this._handleStackInfo(e,t)},_handleStackInfo:function(e,t){var r=this._prepareFrames(e,t);this._triggerEvent("handle",{stackInfo:e,options:t}),this._processException(e.name,e.message,e.url,e.lineno,r,t)},_prepareFrames:function(e,t){var r=this,n=[];if(e.stack&&e.stack.length&&(ne(e.stack,function(t,o){var i=r._normalizeFrame(o,e.url);i&&n.push(i)}),t&&t.trimHeadFrames))for(var o=0;o0&&(e.breadcrumbs={values:[].slice.call(this._breadcrumbs,0)}),this._globalContext.user&&(e.user=this._globalContext.user),t.environment&&(e.environment=t.environment),t.release&&(e.release=t.release),t.serverName&&(e.server_name=t.serverName),e=this._sanitizeData(e),Object.keys(e).forEach(function(t){(null==e[t]||""===e[t]||re(e[t]))&&delete e[t]}),Q(t.dataCallback)&&(e=t.dataCallback(e)||e),e&&!re(e)&&(Q(t.shouldSendCallback)&&!t.shouldSendCallback(e)||(this._shouldBackoff()?this._logDebug("warn","Raven dropped error due to backoff: ",e):"number"==typeof t.sampleRate?Math.random() 0) {\n var thisPos = indexOf(stack, this);\n ~thisPos ? stack.splice(thisPos + 1) : stack.push(this);\n ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key);\n\n if (~indexOf(stack, value)) {\n value = cycleReplacer.call(this, key, value);\n }\n } else {\n stack.push(value);\n }\n\n return replacer == null\n ? value instanceof Error ? stringifyError(value) : value\n : replacer.call(this, key, value);\n };\n}\n","var stringify = require('../vendor/json-stringify-safe/stringify');\n\nvar _window =\n typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : typeof self !== 'undefined'\n ? self\n : {};\n\nfunction isObject(what) {\n return typeof what === 'object' && what !== null;\n}\n\n// Yanked from https://git.io/vS8DV re-used under CC0\n// with some tiny modifications\nfunction isError(value) {\n switch (Object.prototype.toString.call(value)) {\n case '[object Error]':\n return true;\n case '[object Exception]':\n return true;\n case '[object DOMException]':\n return true;\n default:\n return value instanceof Error;\n }\n}\n\nfunction isErrorEvent(value) {\n return Object.prototype.toString.call(value) === '[object ErrorEvent]';\n}\n\nfunction isDOMError(value) {\n return Object.prototype.toString.call(value) === '[object DOMError]';\n}\n\nfunction isDOMException(value) {\n return Object.prototype.toString.call(value) === '[object DOMException]';\n}\n\nfunction isUndefined(what) {\n return what === void 0;\n}\n\nfunction isFunction(what) {\n return typeof what === 'function';\n}\n\nfunction isPlainObject(what) {\n return Object.prototype.toString.call(what) === '[object Object]';\n}\n\nfunction isString(what) {\n return Object.prototype.toString.call(what) === '[object String]';\n}\n\nfunction isArray(what) {\n return Object.prototype.toString.call(what) === '[object Array]';\n}\n\nfunction isEmptyObject(what) {\n if (!isPlainObject(what)) return false;\n\n for (var _ in what) {\n if (what.hasOwnProperty(_)) {\n return false;\n }\n }\n return true;\n}\n\nfunction supportsErrorEvent() {\n try {\n new ErrorEvent(''); // eslint-disable-line no-new\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction supportsDOMError() {\n try {\n new DOMError(''); // eslint-disable-line no-new\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction supportsDOMException() {\n try {\n new DOMException(''); // eslint-disable-line no-new\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction supportsFetch() {\n if (!('fetch' in _window)) return false;\n\n try {\n new Headers(); // eslint-disable-line no-new\n new Request(''); // eslint-disable-line no-new\n new Response(); // eslint-disable-line no-new\n return true;\n } catch (e) {\n return false;\n }\n}\n\n// Despite all stars in the sky saying that Edge supports old draft syntax, aka 'never', 'always', 'origin' and 'default\n// https://caniuse.com/#feat=referrer-policy\n// It doesn't. And it throw exception instead of ignoring this parameter...\n// REF: https://github.com/getsentry/raven-js/issues/1233\nfunction supportsReferrerPolicy() {\n if (!supportsFetch()) return false;\n\n try {\n // eslint-disable-next-line no-new\n new Request('pickleRick', {\n referrerPolicy: 'origin'\n });\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction supportsPromiseRejectionEvent() {\n return typeof PromiseRejectionEvent === 'function';\n}\n\nfunction wrappedCallback(callback) {\n function dataCallback(data, original) {\n var normalizedData = callback(data) || data;\n if (original) {\n return original(normalizedData) || normalizedData;\n }\n return normalizedData;\n }\n\n return dataCallback;\n}\n\nfunction each(obj, callback) {\n var i, j;\n\n if (isUndefined(obj.length)) {\n for (i in obj) {\n if (hasKey(obj, i)) {\n callback.call(null, i, obj[i]);\n }\n }\n } else {\n j = obj.length;\n if (j) {\n for (i = 0; i < j; i++) {\n callback.call(null, i, obj[i]);\n }\n }\n }\n}\n\nfunction objectMerge(obj1, obj2) {\n if (!obj2) {\n return obj1;\n }\n each(obj2, function(key, value) {\n obj1[key] = value;\n });\n return obj1;\n}\n\n/**\n * This function is only used for react-native.\n * react-native freezes object that have already been sent over the\n * js bridge. We need this function in order to check if the object is frozen.\n * So it's ok that objectFrozen returns false if Object.isFrozen is not\n * supported because it's not relevant for other \"platforms\". See related issue:\n * https://github.com/getsentry/react-native-sentry/issues/57\n */\nfunction objectFrozen(obj) {\n if (!Object.isFrozen) {\n return false;\n }\n return Object.isFrozen(obj);\n}\n\nfunction truncate(str, max) {\n if (typeof max !== 'number') {\n throw new Error('2nd argument to `truncate` function should be a number');\n }\n if (typeof str !== 'string' || max === 0) {\n return str;\n }\n return str.length <= max ? str : str.substr(0, max) + '\\u2026';\n}\n\n/**\n * hasKey, a better form of hasOwnProperty\n * Example: hasKey(MainHostObject, property) === true/false\n *\n * @param {Object} host object to check property\n * @param {string} key to check\n */\nfunction hasKey(object, key) {\n return Object.prototype.hasOwnProperty.call(object, key);\n}\n\nfunction joinRegExp(patterns) {\n // Combine an array of regular expressions and strings into one large regexp\n // Be mad.\n var sources = [],\n i = 0,\n len = patterns.length,\n pattern;\n\n for (; i < len; i++) {\n pattern = patterns[i];\n if (isString(pattern)) {\n // If it's a string, we need to escape it\n // Taken from: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions\n sources.push(pattern.replace(/([.*+?^=!:${}()|\\[\\]\\/\\\\])/g, '\\\\$1'));\n } else if (pattern && pattern.source) {\n // If it's a regexp already, we want to extract the source\n sources.push(pattern.source);\n }\n // Intentionally skip other cases\n }\n return new RegExp(sources.join('|'), 'i');\n}\n\nfunction urlencode(o) {\n var pairs = [];\n each(o, function(key, value) {\n pairs.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));\n });\n return pairs.join('&');\n}\n\n// borrowed from https://tools.ietf.org/html/rfc3986#appendix-B\n// intentionally using regex and not href parsing trick because React Native and other\n// environments where DOM might not be available\nfunction parseUrl(url) {\n if (typeof url !== 'string') return {};\n var match = url.match(/^(([^:\\/?#]+):)?(\\/\\/([^\\/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$/);\n\n // coerce to undefined values to empty string so we don't get 'undefined'\n var query = match[6] || '';\n var fragment = match[8] || '';\n return {\n protocol: match[2],\n host: match[4],\n path: match[5],\n relative: match[5] + query + fragment // everything minus origin\n };\n}\nfunction uuid4() {\n var crypto = _window.crypto || _window.msCrypto;\n\n if (!isUndefined(crypto) && crypto.getRandomValues) {\n // Use window.crypto API if available\n // eslint-disable-next-line no-undef\n var arr = new Uint16Array(8);\n crypto.getRandomValues(arr);\n\n // set 4 in byte 7\n arr[3] = (arr[3] & 0xfff) | 0x4000;\n // set 2 most significant bits of byte 9 to '10'\n arr[4] = (arr[4] & 0x3fff) | 0x8000;\n\n var pad = function(num) {\n var v = num.toString(16);\n while (v.length < 4) {\n v = '0' + v;\n }\n return v;\n };\n\n return (\n pad(arr[0]) +\n pad(arr[1]) +\n pad(arr[2]) +\n pad(arr[3]) +\n pad(arr[4]) +\n pad(arr[5]) +\n pad(arr[6]) +\n pad(arr[7])\n );\n } else {\n // http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#2117523\n return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n var r = (Math.random() * 16) | 0,\n v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n }\n}\n\n/**\n * Given a child DOM element, returns a query-selector statement describing that\n * and its ancestors\n * e.g. [HTMLElement] => body > div > input#foo.btn[name=baz]\n * @param elem\n * @returns {string}\n */\nfunction htmlTreeAsString(elem) {\n /* eslint no-extra-parens:0*/\n var MAX_TRAVERSE_HEIGHT = 5,\n MAX_OUTPUT_LEN = 80,\n out = [],\n height = 0,\n len = 0,\n separator = ' > ',\n sepLength = separator.length,\n nextStr;\n\n while (elem && height++ < MAX_TRAVERSE_HEIGHT) {\n nextStr = htmlElementAsString(elem);\n // bail out if\n // - nextStr is the 'html' element\n // - the length of the string that would be created exceeds MAX_OUTPUT_LEN\n // (ignore this limit if we are on the first iteration)\n if (\n nextStr === 'html' ||\n (height > 1 && len + out.length * sepLength + nextStr.length >= MAX_OUTPUT_LEN)\n ) {\n break;\n }\n\n out.push(nextStr);\n\n len += nextStr.length;\n elem = elem.parentNode;\n }\n\n return out.reverse().join(separator);\n}\n\n/**\n * Returns a simple, query-selector representation of a DOM element\n * e.g. [HTMLElement] => input#foo.btn[name=baz]\n * @param HTMLElement\n * @returns {string}\n */\nfunction htmlElementAsString(elem) {\n var out = [],\n className,\n classes,\n key,\n attr,\n i;\n\n if (!elem || !elem.tagName) {\n return '';\n }\n\n out.push(elem.tagName.toLowerCase());\n if (elem.id) {\n out.push('#' + elem.id);\n }\n\n className = elem.className;\n if (className && isString(className)) {\n classes = className.split(/\\s+/);\n for (i = 0; i < classes.length; i++) {\n out.push('.' + classes[i]);\n }\n }\n var attrWhitelist = ['type', 'name', 'title', 'alt'];\n for (i = 0; i < attrWhitelist.length; i++) {\n key = attrWhitelist[i];\n attr = elem.getAttribute(key);\n if (attr) {\n out.push('[' + key + '=\"' + attr + '\"]');\n }\n }\n return out.join('');\n}\n\n/**\n * Returns true if either a OR b is truthy, but not both\n */\nfunction isOnlyOneTruthy(a, b) {\n return !!(!!a ^ !!b);\n}\n\n/**\n * Returns true if both parameters are undefined\n */\nfunction isBothUndefined(a, b) {\n return isUndefined(a) && isUndefined(b);\n}\n\n/**\n * Returns true if the two input exception interfaces have the same content\n */\nfunction isSameException(ex1, ex2) {\n if (isOnlyOneTruthy(ex1, ex2)) return false;\n\n ex1 = ex1.values[0];\n ex2 = ex2.values[0];\n\n if (ex1.type !== ex2.type || ex1.value !== ex2.value) return false;\n\n // in case both stacktraces are undefined, we can't decide so default to false\n if (isBothUndefined(ex1.stacktrace, ex2.stacktrace)) return false;\n\n return isSameStacktrace(ex1.stacktrace, ex2.stacktrace);\n}\n\n/**\n * Returns true if the two input stack trace interfaces have the same content\n */\nfunction isSameStacktrace(stack1, stack2) {\n if (isOnlyOneTruthy(stack1, stack2)) return false;\n\n var frames1 = stack1.frames;\n var frames2 = stack2.frames;\n\n // Exit early if stacktrace is malformed\n if (frames1 === undefined || frames2 === undefined) return false;\n\n // Exit early if frame count differs\n if (frames1.length !== frames2.length) return false;\n\n // Iterate through every frame; bail out if anything differs\n var a, b;\n for (var i = 0; i < frames1.length; i++) {\n a = frames1[i];\n b = frames2[i];\n if (\n a.filename !== b.filename ||\n a.lineno !== b.lineno ||\n a.colno !== b.colno ||\n a['function'] !== b['function']\n )\n return false;\n }\n return true;\n}\n\n/**\n * Polyfill a method\n * @param obj object e.g. `document`\n * @param name method name present on object e.g. `addEventListener`\n * @param replacement replacement function\n * @param track {optional} record instrumentation to an array\n */\nfunction fill(obj, name, replacement, track) {\n if (obj == null) return;\n var orig = obj[name];\n obj[name] = replacement(orig);\n obj[name].__raven__ = true;\n obj[name].__orig__ = orig;\n if (track) {\n track.push([obj, name, orig]);\n }\n}\n\n/**\n * Join values in array\n * @param input array of values to be joined together\n * @param delimiter string to be placed in-between values\n * @returns {string}\n */\nfunction safeJoin(input, delimiter) {\n if (!isArray(input)) return '';\n\n var output = [];\n\n for (var i = 0; i < input.length; i++) {\n try {\n output.push(String(input[i]));\n } catch (e) {\n output.push('[value cannot be serialized]');\n }\n }\n\n return output.join(delimiter);\n}\n\n// Default Node.js REPL depth\nvar MAX_SERIALIZE_EXCEPTION_DEPTH = 3;\n// 50kB, as 100kB is max payload size, so half sounds reasonable\nvar MAX_SERIALIZE_EXCEPTION_SIZE = 50 * 1024;\nvar MAX_SERIALIZE_KEYS_LENGTH = 40;\n\nfunction utf8Length(value) {\n return ~-encodeURI(value).split(/%..|./).length;\n}\n\nfunction jsonSize(value) {\n return utf8Length(JSON.stringify(value));\n}\n\nfunction serializeValue(value) {\n if (typeof value === 'string') {\n var maxLength = 40;\n return truncate(value, maxLength);\n } else if (\n typeof value === 'number' ||\n typeof value === 'boolean' ||\n typeof value === 'undefined'\n ) {\n return value;\n }\n\n var type = Object.prototype.toString.call(value);\n\n // Node.js REPL notation\n if (type === '[object Object]') return '[Object]';\n if (type === '[object Array]') return '[Array]';\n if (type === '[object Function]')\n return value.name ? '[Function: ' + value.name + ']' : '[Function]';\n\n return value;\n}\n\nfunction serializeObject(value, depth) {\n if (depth === 0) return serializeValue(value);\n\n if (isPlainObject(value)) {\n return Object.keys(value).reduce(function(acc, key) {\n acc[key] = serializeObject(value[key], depth - 1);\n return acc;\n }, {});\n } else if (Array.isArray(value)) {\n return value.map(function(val) {\n return serializeObject(val, depth - 1);\n });\n }\n\n return serializeValue(value);\n}\n\nfunction serializeException(ex, depth, maxSize) {\n if (!isPlainObject(ex)) return ex;\n\n depth = typeof depth !== 'number' ? MAX_SERIALIZE_EXCEPTION_DEPTH : depth;\n maxSize = typeof depth !== 'number' ? MAX_SERIALIZE_EXCEPTION_SIZE : maxSize;\n\n var serialized = serializeObject(ex, depth);\n\n if (jsonSize(stringify(serialized)) > maxSize) {\n return serializeException(ex, depth - 1);\n }\n\n return serialized;\n}\n\nfunction serializeKeysForMessage(keys, maxLength) {\n if (typeof keys === 'number' || typeof keys === 'string') return keys.toString();\n if (!Array.isArray(keys)) return '';\n\n keys = keys.filter(function(key) {\n return typeof key === 'string';\n });\n if (keys.length === 0) return '[object has no keys]';\n\n maxLength = typeof maxLength !== 'number' ? MAX_SERIALIZE_KEYS_LENGTH : maxLength;\n if (keys[0].length >= maxLength) return keys[0];\n\n for (var usedKeys = keys.length; usedKeys > 0; usedKeys--) {\n var serialized = keys.slice(0, usedKeys).join(', ');\n if (serialized.length > maxLength) continue;\n if (usedKeys === keys.length) return serialized;\n return serialized + '\\u2026';\n }\n\n return '';\n}\n\nfunction sanitize(input, sanitizeKeys) {\n if (!isArray(sanitizeKeys) || (isArray(sanitizeKeys) && sanitizeKeys.length === 0))\n return input;\n\n var sanitizeRegExp = joinRegExp(sanitizeKeys);\n var sanitizeMask = '********';\n var safeInput;\n\n try {\n safeInput = JSON.parse(stringify(input));\n } catch (o_O) {\n return input;\n }\n\n function sanitizeWorker(workerInput) {\n if (isArray(workerInput)) {\n return workerInput.map(function(val) {\n return sanitizeWorker(val);\n });\n }\n\n if (isPlainObject(workerInput)) {\n return Object.keys(workerInput).reduce(function(acc, k) {\n if (sanitizeRegExp.test(k)) {\n acc[k] = sanitizeMask;\n } else {\n acc[k] = sanitizeWorker(workerInput[k]);\n }\n return acc;\n }, {});\n }\n\n return workerInput;\n }\n\n return sanitizeWorker(safeInput);\n}\n\nmodule.exports = {\n isObject: isObject,\n isError: isError,\n isErrorEvent: isErrorEvent,\n isDOMError: isDOMError,\n isDOMException: isDOMException,\n isUndefined: isUndefined,\n isFunction: isFunction,\n isPlainObject: isPlainObject,\n isString: isString,\n isArray: isArray,\n isEmptyObject: isEmptyObject,\n supportsErrorEvent: supportsErrorEvent,\n supportsDOMError: supportsDOMError,\n supportsDOMException: supportsDOMException,\n supportsFetch: supportsFetch,\n supportsReferrerPolicy: supportsReferrerPolicy,\n supportsPromiseRejectionEvent: supportsPromiseRejectionEvent,\n wrappedCallback: wrappedCallback,\n each: each,\n objectMerge: objectMerge,\n truncate: truncate,\n objectFrozen: objectFrozen,\n hasKey: hasKey,\n joinRegExp: joinRegExp,\n urlencode: urlencode,\n uuid4: uuid4,\n htmlTreeAsString: htmlTreeAsString,\n htmlElementAsString: htmlElementAsString,\n isSameException: isSameException,\n isSameStacktrace: isSameStacktrace,\n parseUrl: parseUrl,\n fill: fill,\n safeJoin: safeJoin,\n serializeException: serializeException,\n serializeKeysForMessage: serializeKeysForMessage,\n sanitize: sanitize\n};\n","var utils = require('../../src/utils');\n\n/*\n TraceKit - Cross brower stack traces\n\n This was originally forked from github.com/occ/TraceKit, but has since been\n largely re-written and is now maintained as part of raven-js. Tests for\n this are in test/vendor.\n\n MIT license\n*/\n\nvar TraceKit = {\n collectWindowErrors: true,\n debug: false\n};\n\n// This is to be defensive in environments where window does not exist (see https://github.com/getsentry/raven-js/pull/785)\nvar _window =\n typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\n\n// global reference to slice\nvar _slice = [].slice;\nvar UNKNOWN_FUNCTION = '?';\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Error_types\nvar ERROR_TYPES_RE = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;\n\nfunction getLocationHref() {\n if (typeof document === 'undefined' || document.location == null) return '';\n return document.location.href;\n}\n\nfunction getLocationOrigin() {\n if (typeof document === 'undefined' || document.location == null) return '';\n\n // Oh dear IE10...\n if (!document.location.origin) {\n return (\n document.location.protocol +\n '//' +\n document.location.hostname +\n (document.location.port ? ':' + document.location.port : '')\n );\n }\n\n return document.location.origin;\n}\n\n/**\n * TraceKit.report: cross-browser processing of unhandled exceptions\n *\n * Syntax:\n * TraceKit.report.subscribe(function(stackInfo) { ... })\n * TraceKit.report.unsubscribe(function(stackInfo) { ... })\n * TraceKit.report(exception)\n * try { ...code... } catch(ex) { TraceKit.report(ex); }\n *\n * Supports:\n * - Firefox: full stack trace with line numbers, plus column number\n * on top frame; column number is not guaranteed\n * - Opera: full stack trace with line and column numbers\n * - Chrome: full stack trace with line and column numbers\n * - Safari: line and column number for the top frame only; some frames\n * may be missing, and column number is not guaranteed\n * - IE: line and column number for the top frame only; some frames\n * may be missing, and column number is not guaranteed\n *\n * In theory, TraceKit should work on all of the following versions:\n * - IE5.5+ (only 8.0 tested)\n * - Firefox 0.9+ (only 3.5+ tested)\n * - Opera 7+ (only 10.50 tested; versions 9 and earlier may require\n * Exceptions Have Stacktrace to be enabled in opera:config)\n * - Safari 3+ (only 4+ tested)\n * - Chrome 1+ (only 5+ tested)\n * - Konqueror 3.5+ (untested)\n *\n * Requires TraceKit.computeStackTrace.\n *\n * Tries to catch all unhandled exceptions and report them to the\n * subscribed handlers. Please note that TraceKit.report will rethrow the\n * exception. This is REQUIRED in order to get a useful stack trace in IE.\n * If the exception does not reach the top of the browser, you will only\n * get a stack trace from the point where TraceKit.report was called.\n *\n * Handlers receive a stackInfo object as described in the\n * TraceKit.computeStackTrace docs.\n */\nTraceKit.report = (function reportModuleWrapper() {\n var handlers = [],\n lastArgs = null,\n lastException = null,\n lastExceptionStack = null;\n\n /**\n * Add a crash handler.\n * @param {Function} handler\n */\n function subscribe(handler) {\n installGlobalHandler();\n handlers.push(handler);\n }\n\n /**\n * Remove a crash handler.\n * @param {Function} handler\n */\n function unsubscribe(handler) {\n for (var i = handlers.length - 1; i >= 0; --i) {\n if (handlers[i] === handler) {\n handlers.splice(i, 1);\n }\n }\n }\n\n /**\n * Remove all crash handlers.\n */\n function unsubscribeAll() {\n uninstallGlobalHandler();\n handlers = [];\n }\n\n /**\n * Dispatch stack information to all handlers.\n * @param {Object.} stack\n */\n function notifyHandlers(stack, isWindowError) {\n var exception = null;\n if (isWindowError && !TraceKit.collectWindowErrors) {\n return;\n }\n for (var i in handlers) {\n if (handlers.hasOwnProperty(i)) {\n try {\n handlers[i].apply(null, [stack].concat(_slice.call(arguments, 2)));\n } catch (inner) {\n exception = inner;\n }\n }\n }\n\n if (exception) {\n throw exception;\n }\n }\n\n var _oldOnerrorHandler, _onErrorHandlerInstalled;\n\n /**\n * Ensures all global unhandled exceptions are recorded.\n * Supported by Gecko and IE.\n * @param {string} msg Error message.\n * @param {string} url URL of script that generated the exception.\n * @param {(number|string)} lineNo The line number at which the error\n * occurred.\n * @param {?(number|string)} colNo The column number at which the error\n * occurred.\n * @param {?Error} ex The actual Error object.\n */\n function traceKitWindowOnError(msg, url, lineNo, colNo, ex) {\n var stack = null;\n // If 'ex' is ErrorEvent, get real Error from inside\n var exception = utils.isErrorEvent(ex) ? ex.error : ex;\n // If 'msg' is ErrorEvent, get real message from inside\n var message = utils.isErrorEvent(msg) ? msg.message : msg;\n\n if (lastExceptionStack) {\n TraceKit.computeStackTrace.augmentStackTraceWithInitialElement(\n lastExceptionStack,\n url,\n lineNo,\n message\n );\n processLastException();\n } else if (exception && utils.isError(exception)) {\n // non-string `exception` arg; attempt to extract stack trace\n\n // New chrome and blink send along a real error object\n // Let's just report that like a normal error.\n // See: https://mikewest.org/2013/08/debugging-runtime-errors-with-window-onerror\n stack = TraceKit.computeStackTrace(exception);\n notifyHandlers(stack, true);\n } else {\n var location = {\n url: url,\n line: lineNo,\n column: colNo\n };\n\n var name = undefined;\n var groups;\n\n if ({}.toString.call(message) === '[object String]') {\n var groups = message.match(ERROR_TYPES_RE);\n if (groups) {\n name = groups[1];\n message = groups[2];\n }\n }\n\n location.func = UNKNOWN_FUNCTION;\n\n stack = {\n name: name,\n message: message,\n url: getLocationHref(),\n stack: [location]\n };\n notifyHandlers(stack, true);\n }\n\n if (_oldOnerrorHandler) {\n return _oldOnerrorHandler.apply(this, arguments);\n }\n\n return false;\n }\n\n function installGlobalHandler() {\n if (_onErrorHandlerInstalled) {\n return;\n }\n _oldOnerrorHandler = _window.onerror;\n _window.onerror = traceKitWindowOnError;\n _onErrorHandlerInstalled = true;\n }\n\n function uninstallGlobalHandler() {\n if (!_onErrorHandlerInstalled) {\n return;\n }\n _window.onerror = _oldOnerrorHandler;\n _onErrorHandlerInstalled = false;\n _oldOnerrorHandler = undefined;\n }\n\n function processLastException() {\n var _lastExceptionStack = lastExceptionStack,\n _lastArgs = lastArgs;\n lastArgs = null;\n lastExceptionStack = null;\n lastException = null;\n notifyHandlers.apply(null, [_lastExceptionStack, false].concat(_lastArgs));\n }\n\n /**\n * Reports an unhandled Error to TraceKit.\n * @param {Error} ex\n * @param {?boolean} rethrow If false, do not re-throw the exception.\n * Only used for window.onerror to not cause an infinite loop of\n * rethrowing.\n */\n function report(ex, rethrow) {\n var args = _slice.call(arguments, 1);\n if (lastExceptionStack) {\n if (lastException === ex) {\n return; // already caught by an inner catch block, ignore\n } else {\n processLastException();\n }\n }\n\n var stack = TraceKit.computeStackTrace(ex);\n lastExceptionStack = stack;\n lastException = ex;\n lastArgs = args;\n\n // If the stack trace is incomplete, wait for 2 seconds for\n // slow slow IE to see if onerror occurs or not before reporting\n // this exception; otherwise, we will end up with an incomplete\n // stack trace\n setTimeout(function() {\n if (lastException === ex) {\n processLastException();\n }\n }, stack.incomplete ? 2000 : 0);\n\n if (rethrow !== false) {\n throw ex; // re-throw to propagate to the top level (and cause window.onerror)\n }\n }\n\n report.subscribe = subscribe;\n report.unsubscribe = unsubscribe;\n report.uninstall = unsubscribeAll;\n return report;\n})();\n\n/**\n * TraceKit.computeStackTrace: cross-browser stack traces in JavaScript\n *\n * Syntax:\n * s = TraceKit.computeStackTrace(exception) // consider using TraceKit.report instead (see below)\n * Returns:\n * s.name - exception name\n * s.message - exception message\n * s.stack[i].url - JavaScript or HTML file URL\n * s.stack[i].func - function name, or empty for anonymous functions (if guessing did not work)\n * s.stack[i].args - arguments passed to the function, if known\n * s.stack[i].line - line number, if known\n * s.stack[i].column - column number, if known\n *\n * Supports:\n * - Firefox: full stack trace with line numbers and unreliable column\n * number on top frame\n * - Opera 10: full stack trace with line and column numbers\n * - Opera 9-: full stack trace with line numbers\n * - Chrome: full stack trace with line and column numbers\n * - Safari: line and column number for the topmost stacktrace element\n * only\n * - IE: no line numbers whatsoever\n *\n * Tries to guess names of anonymous functions by looking for assignments\n * in the source code. In IE and Safari, we have to guess source file names\n * by searching for function bodies inside all page scripts. This will not\n * work for scripts that are loaded cross-domain.\n * Here be dragons: some function names may be guessed incorrectly, and\n * duplicate functions may be mismatched.\n *\n * TraceKit.computeStackTrace should only be used for tracing purposes.\n * Logging of unhandled exceptions should be done with TraceKit.report,\n * which builds on top of TraceKit.computeStackTrace and provides better\n * IE support by utilizing the window.onerror event to retrieve information\n * about the top of the stack.\n *\n * Note: In IE and Safari, no stack trace is recorded on the Error object,\n * so computeStackTrace instead walks its *own* chain of callers.\n * This means that:\n * * in Safari, some methods may be missing from the stack trace;\n * * in IE, the topmost function in the stack trace will always be the\n * caller of computeStackTrace.\n *\n * This is okay for tracing (because you are likely to be calling\n * computeStackTrace from the function you want to be the topmost element\n * of the stack trace anyway), but not okay for logging unhandled\n * exceptions (because your catch block will likely be far away from the\n * inner function that actually caused the exception).\n *\n */\nTraceKit.computeStackTrace = (function computeStackTraceWrapper() {\n // Contents of Exception in various browsers.\n //\n // SAFARI:\n // ex.message = Can't find variable: qq\n // ex.line = 59\n // ex.sourceId = 580238192\n // ex.sourceURL = http://...\n // ex.expressionBeginOffset = 96\n // ex.expressionCaretOffset = 98\n // ex.expressionEndOffset = 98\n // ex.name = ReferenceError\n //\n // FIREFOX:\n // ex.message = qq is not defined\n // ex.fileName = http://...\n // ex.lineNumber = 59\n // ex.columnNumber = 69\n // ex.stack = ...stack trace... (see the example below)\n // ex.name = ReferenceError\n //\n // CHROME:\n // ex.message = qq is not defined\n // ex.name = ReferenceError\n // ex.type = not_defined\n // ex.arguments = ['aa']\n // ex.stack = ...stack trace...\n //\n // INTERNET EXPLORER:\n // ex.message = ...\n // ex.name = ReferenceError\n //\n // OPERA:\n // ex.message = ...message... (see the example below)\n // ex.name = ReferenceError\n // ex.opera#sourceloc = 11 (pretty much useless, duplicates the info in ex.message)\n // ex.stacktrace = n/a; see 'opera:config#UserPrefs|Exceptions Have Stacktrace'\n\n /**\n * Computes stack trace information from the stack property.\n * Chrome and Gecko use this property.\n * @param {Error} ex\n * @return {?Object.} Stack trace information.\n */\n function computeStackTraceFromStackProp(ex) {\n if (typeof ex.stack === 'undefined' || !ex.stack) return;\n\n var chrome = /^\\s*at (?:(.*?) ?\\()?((?:file|https?|blob|chrome-extension|native|eval|webpack||[a-z]:|\\/).*?)(?::(\\d+))?(?::(\\d+))?\\)?\\s*$/i;\n var winjs = /^\\s*at (?:((?:\\[object object\\])?.+) )?\\(?((?:file|ms-appx(?:-web)|https?|webpack|blob):.*?):(\\d+)(?::(\\d+))?\\)?\\s*$/i;\n // NOTE: blob urls are now supposed to always have an origin, therefore it's format\n // which is `blob:http://url/path/with-some-uuid`, is matched by `blob.*?:\\/` as well\n var gecko = /^\\s*(.*?)(?:\\((.*?)\\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|moz-extension).*?:\\/.*?|\\[native code\\]|[^@]*bundle)(?::(\\d+))?(?::(\\d+))?\\s*$/i;\n // Used to additionally parse URL/line/column from eval frames\n var geckoEval = /(\\S+) line (\\d+)(?: > eval line \\d+)* > eval/i;\n var chromeEval = /\\((\\S*)(?::(\\d+))(?::(\\d+))\\)/;\n var lines = ex.stack.split('\\n');\n var stack = [];\n var submatch;\n var parts;\n var element;\n var reference = /^(.*) is undefined$/.exec(ex.message);\n\n for (var i = 0, j = lines.length; i < j; ++i) {\n if ((parts = chrome.exec(lines[i]))) {\n var isNative = parts[2] && parts[2].indexOf('native') === 0; // start of line\n var isEval = parts[2] && parts[2].indexOf('eval') === 0; // start of line\n if (isEval && (submatch = chromeEval.exec(parts[2]))) {\n // throw out eval line/column and use top-most line/column number\n parts[2] = submatch[1]; // url\n parts[3] = submatch[2]; // line\n parts[4] = submatch[3]; // column\n }\n element = {\n url: !isNative ? parts[2] : null,\n func: parts[1] || UNKNOWN_FUNCTION,\n args: isNative ? [parts[2]] : [],\n line: parts[3] ? +parts[3] : null,\n column: parts[4] ? +parts[4] : null\n };\n } else if ((parts = winjs.exec(lines[i]))) {\n element = {\n url: parts[2],\n func: parts[1] || UNKNOWN_FUNCTION,\n args: [],\n line: +parts[3],\n column: parts[4] ? +parts[4] : null\n };\n } else if ((parts = gecko.exec(lines[i]))) {\n var isEval = parts[3] && parts[3].indexOf(' > eval') > -1;\n if (isEval && (submatch = geckoEval.exec(parts[3]))) {\n // throw out eval line/column and use top-most line number\n parts[3] = submatch[1];\n parts[4] = submatch[2];\n parts[5] = null; // no column when eval\n } else if (i === 0 && !parts[5] && typeof ex.columnNumber !== 'undefined') {\n // FireFox uses this awesome columnNumber property for its top frame\n // Also note, Firefox's column number is 0-based and everything else expects 1-based,\n // so adding 1\n // NOTE: this hack doesn't work if top-most frame is eval\n stack[0].column = ex.columnNumber + 1;\n }\n element = {\n url: parts[3],\n func: parts[1] || UNKNOWN_FUNCTION,\n args: parts[2] ? parts[2].split(',') : [],\n line: parts[4] ? +parts[4] : null,\n column: parts[5] ? +parts[5] : null\n };\n } else {\n continue;\n }\n\n if (!element.func && element.line) {\n element.func = UNKNOWN_FUNCTION;\n }\n\n if (element.url && element.url.substr(0, 5) === 'blob:') {\n // Special case for handling JavaScript loaded into a blob.\n // We use a synchronous AJAX request here as a blob is already in\n // memory - it's not making a network request. This will generate a warning\n // in the browser console, but there has already been an error so that's not\n // that much of an issue.\n var xhr = new XMLHttpRequest();\n xhr.open('GET', element.url, false);\n xhr.send(null);\n\n // If we failed to download the source, skip this patch\n if (xhr.status === 200) {\n var source = xhr.responseText || '';\n\n // We trim the source down to the last 300 characters as sourceMappingURL is always at the end of the file.\n // Why 300? To be in line with: https://github.com/getsentry/sentry/blob/4af29e8f2350e20c28a6933354e4f42437b4ba42/src/sentry/lang/javascript/processor.py#L164-L175\n source = source.slice(-300);\n\n // Now we dig out the source map URL\n var sourceMaps = source.match(/\\/\\/# sourceMappingURL=(.*)$/);\n\n // If we don't find a source map comment or we find more than one, continue on to the next element.\n if (sourceMaps) {\n var sourceMapAddress = sourceMaps[1];\n\n // Now we check to see if it's a relative URL.\n // If it is, convert it to an absolute one.\n if (sourceMapAddress.charAt(0) === '~') {\n sourceMapAddress = getLocationOrigin() + sourceMapAddress.slice(1);\n }\n\n // Now we strip the '.map' off of the end of the URL and update the\n // element so that Sentry can match the map to the blob.\n element.url = sourceMapAddress.slice(0, -4);\n }\n }\n }\n\n stack.push(element);\n }\n\n if (!stack.length) {\n return null;\n }\n\n return {\n name: ex.name,\n message: ex.message,\n url: getLocationHref(),\n stack: stack\n };\n }\n\n /**\n * Adds information about the first frame to incomplete stack traces.\n * Safari and IE require this to get complete data on the first frame.\n * @param {Object.} stackInfo Stack trace information from\n * one of the compute* methods.\n * @param {string} url The URL of the script that caused an error.\n * @param {(number|string)} lineNo The line number of the script that\n * caused an error.\n * @param {string=} message The error generated by the browser, which\n * hopefully contains the name of the object that caused the error.\n * @return {boolean} Whether or not the stack information was\n * augmented.\n */\n function augmentStackTraceWithInitialElement(stackInfo, url, lineNo, message) {\n var initial = {\n url: url,\n line: lineNo\n };\n\n if (initial.url && initial.line) {\n stackInfo.incomplete = false;\n\n if (!initial.func) {\n initial.func = UNKNOWN_FUNCTION;\n }\n\n if (stackInfo.stack.length > 0) {\n if (stackInfo.stack[0].url === initial.url) {\n if (stackInfo.stack[0].line === initial.line) {\n return false; // already in stack trace\n } else if (\n !stackInfo.stack[0].line &&\n stackInfo.stack[0].func === initial.func\n ) {\n stackInfo.stack[0].line = initial.line;\n return false;\n }\n }\n }\n\n stackInfo.stack.unshift(initial);\n stackInfo.partial = true;\n return true;\n } else {\n stackInfo.incomplete = true;\n }\n\n return false;\n }\n\n /**\n * Computes stack trace information by walking the arguments.caller\n * chain at the time the exception occurred. This will cause earlier\n * frames to be missed but is the only way to get any stack trace in\n * Safari and IE. The top frame is restored by\n * {@link augmentStackTraceWithInitialElement}.\n * @param {Error} ex\n * @return {?Object.} Stack trace information.\n */\n function computeStackTraceByWalkingCallerChain(ex, depth) {\n var functionName = /function\\s+([_$a-zA-Z\\xA0-\\uFFFF][_$a-zA-Z0-9\\xA0-\\uFFFF]*)?\\s*\\(/i,\n stack = [],\n funcs = {},\n recursion = false,\n parts,\n item,\n source;\n\n for (\n var curr = computeStackTraceByWalkingCallerChain.caller;\n curr && !recursion;\n curr = curr.caller\n ) {\n if (curr === computeStackTrace || curr === TraceKit.report) {\n // console.log('skipping internal function');\n continue;\n }\n\n item = {\n url: null,\n func: UNKNOWN_FUNCTION,\n line: null,\n column: null\n };\n\n if (curr.name) {\n item.func = curr.name;\n } else if ((parts = functionName.exec(curr.toString()))) {\n item.func = parts[1];\n }\n\n if (typeof item.func === 'undefined') {\n try {\n item.func = parts.input.substring(0, parts.input.indexOf('{'));\n } catch (e) {}\n }\n\n if (funcs['' + curr]) {\n recursion = true;\n } else {\n funcs['' + curr] = true;\n }\n\n stack.push(item);\n }\n\n if (depth) {\n // console.log('depth is ' + depth);\n // console.log('stack is ' + stack.length);\n stack.splice(0, depth);\n }\n\n var result = {\n name: ex.name,\n message: ex.message,\n url: getLocationHref(),\n stack: stack\n };\n augmentStackTraceWithInitialElement(\n result,\n ex.sourceURL || ex.fileName,\n ex.line || ex.lineNumber,\n ex.message || ex.description\n );\n return result;\n }\n\n /**\n * Computes a stack trace for an exception.\n * @param {Error} ex\n * @param {(string|number)=} depth\n */\n function computeStackTrace(ex, depth) {\n var stack = null;\n depth = depth == null ? 0 : +depth;\n\n try {\n stack = computeStackTraceFromStackProp(ex);\n if (stack) {\n return stack;\n }\n } catch (e) {\n if (TraceKit.debug) {\n throw e;\n }\n }\n\n try {\n stack = computeStackTraceByWalkingCallerChain(ex, depth + 1);\n if (stack) {\n return stack;\n }\n } catch (e) {\n if (TraceKit.debug) {\n throw e;\n }\n }\n return {\n name: ex.name,\n message: ex.message,\n url: getLocationHref()\n };\n }\n\n computeStackTrace.augmentStackTraceWithInitialElement = augmentStackTraceWithInitialElement;\n computeStackTrace.computeStackTraceFromStackProp = computeStackTraceFromStackProp;\n\n return computeStackTrace;\n})();\n\nmodule.exports = TraceKit;\n","/*\n * JavaScript MD5\n * https://github.com/blueimp/JavaScript-MD5\n *\n * Copyright 2011, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n *\n * Based on\n * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message\n * Digest Algorithm, as defined in RFC 1321.\n * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n * Distributed under the BSD License\n * See http://pajhome.org.uk/crypt/md5 for more info.\n */\n\n/*\n* Add integers, wrapping at 2^32. This uses 16-bit operations internally\n* to work around bugs in some JS interpreters.\n*/\nfunction safeAdd(x, y) {\n var lsw = (x & 0xffff) + (y & 0xffff);\n var msw = (x >> 16) + (y >> 16) + (lsw >> 16);\n return (msw << 16) | (lsw & 0xffff);\n}\n\n/*\n* Bitwise rotate a 32-bit number to the left.\n*/\nfunction bitRotateLeft(num, cnt) {\n return (num << cnt) | (num >>> (32 - cnt));\n}\n\n/*\n* These functions implement the four basic operations the algorithm uses.\n*/\nfunction md5cmn(q, a, b, x, s, t) {\n return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);\n}\nfunction md5ff(a, b, c, d, x, s, t) {\n return md5cmn((b & c) | (~b & d), a, b, x, s, t);\n}\nfunction md5gg(a, b, c, d, x, s, t) {\n return md5cmn((b & d) | (c & ~d), a, b, x, s, t);\n}\nfunction md5hh(a, b, c, d, x, s, t) {\n return md5cmn(b ^ c ^ d, a, b, x, s, t);\n}\nfunction md5ii(a, b, c, d, x, s, t) {\n return md5cmn(c ^ (b | ~d), a, b, x, s, t);\n}\n\n/*\n* Calculate the MD5 of an array of little-endian words, and a bit length.\n*/\nfunction binlMD5(x, len) {\n /* append padding */\n x[len >> 5] |= 0x80 << (len % 32);\n x[(((len + 64) >>> 9) << 4) + 14] = len;\n\n var i;\n var olda;\n var oldb;\n var oldc;\n var oldd;\n var a = 1732584193;\n var b = -271733879;\n var c = -1732584194;\n var d = 271733878;\n\n for (i = 0; i < x.length; i += 16) {\n olda = a;\n oldb = b;\n oldc = c;\n oldd = d;\n\n a = md5ff(a, b, c, d, x[i], 7, -680876936);\n d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);\n c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);\n b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);\n a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);\n d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);\n c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);\n b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);\n a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);\n d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);\n c = md5ff(c, d, a, b, x[i + 10], 17, -42063);\n b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);\n a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);\n d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);\n c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);\n b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);\n\n a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);\n d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);\n c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);\n b = md5gg(b, c, d, a, x[i], 20, -373897302);\n a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);\n d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);\n c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);\n b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);\n a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);\n d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);\n c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);\n b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);\n a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);\n d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);\n c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);\n b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);\n\n a = md5hh(a, b, c, d, x[i + 5], 4, -378558);\n d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);\n c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);\n b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);\n a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);\n d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);\n c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);\n b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);\n a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);\n d = md5hh(d, a, b, c, x[i], 11, -358537222);\n c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);\n b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);\n a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);\n d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);\n c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);\n b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);\n\n a = md5ii(a, b, c, d, x[i], 6, -198630844);\n d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);\n c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);\n b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);\n a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);\n d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);\n c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);\n b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);\n a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);\n d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);\n c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);\n b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);\n a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);\n d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);\n c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);\n b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);\n\n a = safeAdd(a, olda);\n b = safeAdd(b, oldb);\n c = safeAdd(c, oldc);\n d = safeAdd(d, oldd);\n }\n return [a, b, c, d];\n}\n\n/*\n* Convert an array of little-endian words to a string\n*/\nfunction binl2rstr(input) {\n var i;\n var output = '';\n var length32 = input.length * 32;\n for (i = 0; i < length32; i += 8) {\n output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xff);\n }\n return output;\n}\n\n/*\n* Convert a raw string to an array of little-endian words\n* Characters >255 have their high-byte silently ignored.\n*/\nfunction rstr2binl(input) {\n var i;\n var output = [];\n output[(input.length >> 2) - 1] = undefined;\n for (i = 0; i < output.length; i += 1) {\n output[i] = 0;\n }\n var length8 = input.length * 8;\n for (i = 0; i < length8; i += 8) {\n output[i >> 5] |= (input.charCodeAt(i / 8) & 0xff) << (i % 32);\n }\n return output;\n}\n\n/*\n* Calculate the MD5 of a raw string\n*/\nfunction rstrMD5(s) {\n return binl2rstr(binlMD5(rstr2binl(s), s.length * 8));\n}\n\n/*\n* Calculate the HMAC-MD5, of a key and some data (raw strings)\n*/\nfunction rstrHMACMD5(key, data) {\n var i;\n var bkey = rstr2binl(key);\n var ipad = [];\n var opad = [];\n var hash;\n ipad[15] = opad[15] = undefined;\n if (bkey.length > 16) {\n bkey = binlMD5(bkey, key.length * 8);\n }\n for (i = 0; i < 16; i += 1) {\n ipad[i] = bkey[i] ^ 0x36363636;\n opad[i] = bkey[i] ^ 0x5c5c5c5c;\n }\n hash = binlMD5(ipad.concat(rstr2binl(data)), 512 + data.length * 8);\n return binl2rstr(binlMD5(opad.concat(hash), 512 + 128));\n}\n\n/*\n* Convert a raw string to a hex string\n*/\nfunction rstr2hex(input) {\n var hexTab = '0123456789abcdef';\n var output = '';\n var x;\n var i;\n for (i = 0; i < input.length; i += 1) {\n x = input.charCodeAt(i);\n output += hexTab.charAt((x >>> 4) & 0x0f) + hexTab.charAt(x & 0x0f);\n }\n return output;\n}\n\n/*\n* Encode a string as utf-8\n*/\nfunction str2rstrUTF8(input) {\n return unescape(encodeURIComponent(input));\n}\n\n/*\n* Take string arguments and return either raw or hex encoded strings\n*/\nfunction rawMD5(s) {\n return rstrMD5(str2rstrUTF8(s));\n}\nfunction hexMD5(s) {\n return rstr2hex(rawMD5(s));\n}\nfunction rawHMACMD5(k, d) {\n return rstrHMACMD5(str2rstrUTF8(k), str2rstrUTF8(d));\n}\nfunction hexHMACMD5(k, d) {\n return rstr2hex(rawHMACMD5(k, d));\n}\n\nfunction md5(string, key, raw) {\n if (!key) {\n if (!raw) {\n return hexMD5(string);\n }\n return rawMD5(string);\n }\n if (!raw) {\n return hexHMACMD5(key, string);\n }\n return rawHMACMD5(key, string);\n}\n\nmodule.exports = md5;\n","function RavenConfigError(message) {\n this.name = 'RavenConfigError';\n this.message = message;\n}\nRavenConfigError.prototype = new Error();\nRavenConfigError.prototype.constructor = RavenConfigError;\n\nmodule.exports = RavenConfigError;\n","var utils = require('./utils');\n\nvar wrapMethod = function(console, level, callback) {\n var originalConsoleLevel = console[level];\n var originalConsole = console;\n\n if (!(level in console)) {\n return;\n }\n\n var sentryLevel = level === 'warn' ? 'warning' : level;\n\n console[level] = function() {\n var args = [].slice.call(arguments);\n\n var msg = utils.safeJoin(args, ' ');\n var data = {level: sentryLevel, logger: 'console', extra: {arguments: args}};\n\n if (level === 'assert') {\n if (args[0] === false) {\n // Default browsers message\n msg =\n 'Assertion failed: ' + (utils.safeJoin(args.slice(1), ' ') || 'console.assert');\n data.extra.arguments = args.slice(1);\n callback && callback(msg, data);\n }\n } else {\n callback && callback(msg, data);\n }\n\n // this fails for some browsers. :(\n if (originalConsoleLevel) {\n // IE9 doesn't allow calling apply on console functions directly\n // See: https://stackoverflow.com/questions/5472938/does-ie9-support-console-log-and-is-it-a-real-function#answer-5473193\n Function.prototype.apply.call(originalConsoleLevel, originalConsole, args);\n }\n };\n};\n\nmodule.exports = {\n wrapMethod: wrapMethod\n};\n","/*global XDomainRequest:false */\n\nvar TraceKit = require('../vendor/TraceKit/tracekit');\nvar stringify = require('../vendor/json-stringify-safe/stringify');\nvar md5 = require('../vendor/md5/md5');\nvar RavenConfigError = require('./configError');\n\nvar utils = require('./utils');\nvar isErrorEvent = utils.isErrorEvent;\nvar isDOMError = utils.isDOMError;\nvar isDOMException = utils.isDOMException;\nvar isError = utils.isError;\nvar isObject = utils.isObject;\nvar isPlainObject = utils.isPlainObject;\nvar isUndefined = utils.isUndefined;\nvar isFunction = utils.isFunction;\nvar isString = utils.isString;\nvar isArray = utils.isArray;\nvar isEmptyObject = utils.isEmptyObject;\nvar each = utils.each;\nvar objectMerge = utils.objectMerge;\nvar truncate = utils.truncate;\nvar objectFrozen = utils.objectFrozen;\nvar hasKey = utils.hasKey;\nvar joinRegExp = utils.joinRegExp;\nvar urlencode = utils.urlencode;\nvar uuid4 = utils.uuid4;\nvar htmlTreeAsString = utils.htmlTreeAsString;\nvar isSameException = utils.isSameException;\nvar isSameStacktrace = utils.isSameStacktrace;\nvar parseUrl = utils.parseUrl;\nvar fill = utils.fill;\nvar supportsFetch = utils.supportsFetch;\nvar supportsReferrerPolicy = utils.supportsReferrerPolicy;\nvar serializeKeysForMessage = utils.serializeKeysForMessage;\nvar serializeException = utils.serializeException;\nvar sanitize = utils.sanitize;\n\nvar wrapConsoleMethod = require('./console').wrapMethod;\n\nvar dsnKeys = 'source protocol user pass host port path'.split(' '),\n dsnPattern = /^(?:(\\w+):)?\\/\\/(?:(\\w+)(:\\w+)?@)?([\\w\\.-]+)(?::(\\d+))?(\\/.*)/;\n\nfunction now() {\n return +new Date();\n}\n\n// This is to be defensive in environments where window does not exist (see https://github.com/getsentry/raven-js/pull/785)\nvar _window =\n typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\nvar _document = _window.document;\nvar _navigator = _window.navigator;\n\nfunction keepOriginalCallback(original, callback) {\n return isFunction(callback)\n ? function(data) {\n return callback(data, original);\n }\n : callback;\n}\n\n// First, check for JSON support\n// If there is no JSON, we no-op the core features of Raven\n// since JSON is required to encode the payload\nfunction Raven() {\n this._hasJSON = !!(typeof JSON === 'object' && JSON.stringify);\n // Raven can run in contexts where there's no document (react-native)\n this._hasDocument = !isUndefined(_document);\n this._hasNavigator = !isUndefined(_navigator);\n this._lastCapturedException = null;\n this._lastData = null;\n this._lastEventId = null;\n this._globalServer = null;\n this._globalKey = null;\n this._globalProject = null;\n this._globalContext = {};\n this._globalOptions = {\n // SENTRY_RELEASE can be injected by https://github.com/getsentry/sentry-webpack-plugin\n release: _window.SENTRY_RELEASE && _window.SENTRY_RELEASE.id,\n logger: 'javascript',\n ignoreErrors: [],\n ignoreUrls: [],\n whitelistUrls: [],\n includePaths: [],\n headers: null,\n collectWindowErrors: true,\n captureUnhandledRejections: true,\n maxMessageLength: 0,\n // By default, truncates URL values to 250 chars\n maxUrlLength: 250,\n stackTraceLimit: 50,\n autoBreadcrumbs: true,\n instrument: true,\n sampleRate: 1,\n sanitizeKeys: []\n };\n this._fetchDefaults = {\n method: 'POST',\n keepalive: true,\n // Despite all stars in the sky saying that Edge supports old draft syntax, aka 'never', 'always', 'origin' and 'default\n // https://caniuse.com/#feat=referrer-policy\n // It doesn't. And it throw exception instead of ignoring this parameter...\n // REF: https://github.com/getsentry/raven-js/issues/1233\n referrerPolicy: supportsReferrerPolicy() ? 'origin' : ''\n };\n this._ignoreOnError = 0;\n this._isRavenInstalled = false;\n this._originalErrorStackTraceLimit = Error.stackTraceLimit;\n // capture references to window.console *and* all its methods first\n // before the console plugin has a chance to monkey patch\n this._originalConsole = _window.console || {};\n this._originalConsoleMethods = {};\n this._plugins = [];\n this._startTime = now();\n this._wrappedBuiltIns = [];\n this._breadcrumbs = [];\n this._lastCapturedEvent = null;\n this._keypressTimeout;\n this._location = _window.location;\n this._lastHref = this._location && this._location.href;\n this._resetBackoff();\n\n // eslint-disable-next-line guard-for-in\n for (var method in this._originalConsole) {\n this._originalConsoleMethods[method] = this._originalConsole[method];\n }\n}\n\n/*\n * The core Raven singleton\n *\n * @this {Raven}\n */\n\nRaven.prototype = {\n // Hardcode version string so that raven source can be loaded directly via\n // webpack (using a build step causes webpack #1617). Grunt verifies that\n // this value matches package.json during build.\n // See: https://github.com/getsentry/raven-js/issues/465\n VERSION: '3.26.4',\n\n debug: false,\n\n TraceKit: TraceKit, // alias to TraceKit\n\n /*\n * Configure Raven with a DSN and extra options\n *\n * @param {string} dsn The public Sentry DSN\n * @param {object} options Set of global options [optional]\n * @return {Raven}\n */\n config: function(dsn, options) {\n var self = this;\n\n if (self._globalServer) {\n this._logDebug('error', 'Error: Raven has already been configured');\n return self;\n }\n if (!dsn) return self;\n\n var globalOptions = self._globalOptions;\n\n // merge in options\n if (options) {\n each(options, function(key, value) {\n // tags and extra are special and need to be put into context\n if (key === 'tags' || key === 'extra' || key === 'user') {\n self._globalContext[key] = value;\n } else {\n globalOptions[key] = value;\n }\n });\n }\n\n self.setDSN(dsn);\n\n // \"Script error.\" is hard coded into browsers for errors that it can't read.\n // this is the result of a script being pulled in from an external domain and CORS.\n globalOptions.ignoreErrors.push(/^Script error\\.?$/);\n globalOptions.ignoreErrors.push(/^Javascript error: Script error\\.? on line 0$/);\n\n // join regexp rules into one big rule\n globalOptions.ignoreErrors = joinRegExp(globalOptions.ignoreErrors);\n globalOptions.ignoreUrls = globalOptions.ignoreUrls.length\n ? joinRegExp(globalOptions.ignoreUrls)\n : false;\n globalOptions.whitelistUrls = globalOptions.whitelistUrls.length\n ? joinRegExp(globalOptions.whitelistUrls)\n : false;\n globalOptions.includePaths = joinRegExp(globalOptions.includePaths);\n globalOptions.maxBreadcrumbs = Math.max(\n 0,\n Math.min(globalOptions.maxBreadcrumbs || 100, 100)\n ); // default and hard limit is 100\n\n var autoBreadcrumbDefaults = {\n xhr: true,\n console: true,\n dom: true,\n location: true,\n sentry: true\n };\n\n var autoBreadcrumbs = globalOptions.autoBreadcrumbs;\n if ({}.toString.call(autoBreadcrumbs) === '[object Object]') {\n autoBreadcrumbs = objectMerge(autoBreadcrumbDefaults, autoBreadcrumbs);\n } else if (autoBreadcrumbs !== false) {\n autoBreadcrumbs = autoBreadcrumbDefaults;\n }\n globalOptions.autoBreadcrumbs = autoBreadcrumbs;\n\n var instrumentDefaults = {\n tryCatch: true\n };\n\n var instrument = globalOptions.instrument;\n if ({}.toString.call(instrument) === '[object Object]') {\n instrument = objectMerge(instrumentDefaults, instrument);\n } else if (instrument !== false) {\n instrument = instrumentDefaults;\n }\n globalOptions.instrument = instrument;\n\n TraceKit.collectWindowErrors = !!globalOptions.collectWindowErrors;\n\n // return for chaining\n return self;\n },\n\n /*\n * Installs a global window.onerror error handler\n * to capture and report uncaught exceptions.\n * At this point, install() is required to be called due\n * to the way TraceKit is set up.\n *\n * @return {Raven}\n */\n install: function() {\n var self = this;\n if (self.isSetup() && !self._isRavenInstalled) {\n TraceKit.report.subscribe(function() {\n self._handleOnErrorStackInfo.apply(self, arguments);\n });\n\n if (self._globalOptions.captureUnhandledRejections) {\n self._attachPromiseRejectionHandler();\n }\n\n self._patchFunctionToString();\n\n if (self._globalOptions.instrument && self._globalOptions.instrument.tryCatch) {\n self._instrumentTryCatch();\n }\n\n if (self._globalOptions.autoBreadcrumbs) self._instrumentBreadcrumbs();\n\n // Install all of the plugins\n self._drainPlugins();\n\n self._isRavenInstalled = true;\n }\n\n Error.stackTraceLimit = self._globalOptions.stackTraceLimit;\n return this;\n },\n\n /*\n * Set the DSN (can be called multiple time unlike config)\n *\n * @param {string} dsn The public Sentry DSN\n */\n setDSN: function(dsn) {\n var self = this,\n uri = self._parseDSN(dsn),\n lastSlash = uri.path.lastIndexOf('/'),\n path = uri.path.substr(1, lastSlash);\n\n self._dsn = dsn;\n self._globalKey = uri.user;\n self._globalSecret = uri.pass && uri.pass.substr(1);\n self._globalProject = uri.path.substr(lastSlash + 1);\n\n self._globalServer = self._getGlobalServer(uri);\n\n self._globalEndpoint =\n self._globalServer + '/' + path + 'api/' + self._globalProject + '/store/';\n\n // Reset backoff state since we may be pointing at a\n // new project/server\n this._resetBackoff();\n },\n\n /*\n * Wrap code within a context so Raven can capture errors\n * reliably across domains that is executed immediately.\n *\n * @param {object} options A specific set of options for this context [optional]\n * @param {function} func The callback to be immediately executed within the context\n * @param {array} args An array of arguments to be called with the callback [optional]\n */\n context: function(options, func, args) {\n if (isFunction(options)) {\n args = func || [];\n func = options;\n options = {};\n }\n\n return this.wrap(options, func).apply(this, args);\n },\n\n /*\n * Wrap code within a context and returns back a new function to be executed\n *\n * @param {object} options A specific set of options for this context [optional]\n * @param {function} func The function to be wrapped in a new context\n * @param {function} _before A function to call before the try/catch wrapper [optional, private]\n * @return {function} The newly wrapped functions with a context\n */\n wrap: function(options, func, _before) {\n var self = this;\n // 1 argument has been passed, and it's not a function\n // so just return it\n if (isUndefined(func) && !isFunction(options)) {\n return options;\n }\n\n // options is optional\n if (isFunction(options)) {\n func = options;\n options = undefined;\n }\n\n // At this point, we've passed along 2 arguments, and the second one\n // is not a function either, so we'll just return the second argument.\n if (!isFunction(func)) {\n return func;\n }\n\n // We don't wanna wrap it twice!\n try {\n if (func.__raven__) {\n return func;\n }\n\n // If this has already been wrapped in the past, return that\n if (func.__raven_wrapper__) {\n return func.__raven_wrapper__;\n }\n } catch (e) {\n // Just accessing custom props in some Selenium environments\n // can cause a \"Permission denied\" exception (see raven-js#495).\n // Bail on wrapping and return the function as-is (defers to window.onerror).\n return func;\n }\n\n function wrapped() {\n var args = [],\n i = arguments.length,\n deep = !options || (options && options.deep !== false);\n\n if (_before && isFunction(_before)) {\n _before.apply(this, arguments);\n }\n\n // Recursively wrap all of a function's arguments that are\n // functions themselves.\n while (i--) args[i] = deep ? self.wrap(options, arguments[i]) : arguments[i];\n\n try {\n // Attempt to invoke user-land function\n // NOTE: If you are a Sentry user, and you are seeing this stack frame, it\n // means Raven caught an error invoking your application code. This is\n // expected behavior and NOT indicative of a bug with Raven.js.\n return func.apply(this, args);\n } catch (e) {\n self._ignoreNextOnError();\n self.captureException(e, options);\n throw e;\n }\n }\n\n // copy over properties of the old function\n for (var property in func) {\n if (hasKey(func, property)) {\n wrapped[property] = func[property];\n }\n }\n wrapped.prototype = func.prototype;\n\n func.__raven_wrapper__ = wrapped;\n // Signal that this function has been wrapped/filled already\n // for both debugging and to prevent it to being wrapped/filled twice\n wrapped.__raven__ = true;\n wrapped.__orig__ = func;\n\n return wrapped;\n },\n\n /**\n * Uninstalls the global error handler.\n *\n * @return {Raven}\n */\n uninstall: function() {\n TraceKit.report.uninstall();\n\n this._detachPromiseRejectionHandler();\n this._unpatchFunctionToString();\n this._restoreBuiltIns();\n this._restoreConsole();\n\n Error.stackTraceLimit = this._originalErrorStackTraceLimit;\n this._isRavenInstalled = false;\n\n return this;\n },\n\n /**\n * Callback used for `unhandledrejection` event\n *\n * @param {PromiseRejectionEvent} event An object containing\n * promise: the Promise that was rejected\n * reason: the value with which the Promise was rejected\n * @return void\n */\n _promiseRejectionHandler: function(event) {\n this._logDebug('debug', 'Raven caught unhandled promise rejection:', event);\n this.captureException(event.reason, {\n mechanism: {\n type: 'onunhandledrejection',\n handled: false\n }\n });\n },\n\n /**\n * Installs the global promise rejection handler.\n *\n * @return {raven}\n */\n _attachPromiseRejectionHandler: function() {\n this._promiseRejectionHandler = this._promiseRejectionHandler.bind(this);\n _window.addEventListener &&\n _window.addEventListener('unhandledrejection', this._promiseRejectionHandler);\n return this;\n },\n\n /**\n * Uninstalls the global promise rejection handler.\n *\n * @return {raven}\n */\n _detachPromiseRejectionHandler: function() {\n _window.removeEventListener &&\n _window.removeEventListener('unhandledrejection', this._promiseRejectionHandler);\n return this;\n },\n\n /**\n * Manually capture an exception and send it over to Sentry\n *\n * @param {error} ex An exception to be logged\n * @param {object} options A specific set of options for this error [optional]\n * @return {Raven}\n */\n captureException: function(ex, options) {\n options = objectMerge({trimHeadFrames: 0}, options ? options : {});\n\n if (isErrorEvent(ex) && ex.error) {\n // If it is an ErrorEvent with `error` property, extract it to get actual Error\n ex = ex.error;\n } else if (isDOMError(ex) || isDOMException(ex)) {\n // If it is a DOMError or DOMException (which are legacy APIs, but still supported in some browsers)\n // then we just extract the name and message, as they don't provide anything else\n // https://developer.mozilla.org/en-US/docs/Web/API/DOMError\n // https://developer.mozilla.org/en-US/docs/Web/API/DOMException\n var name = ex.name || (isDOMError(ex) ? 'DOMError' : 'DOMException');\n var message = ex.message ? name + ': ' + ex.message : name;\n\n return this.captureMessage(\n message,\n objectMerge(options, {\n // neither DOMError or DOMException provide stack trace and we most likely wont get it this way as well\n // but it's barely any overhead so we may at least try\n stacktrace: true,\n trimHeadFrames: options.trimHeadFrames + 1\n })\n );\n } else if (isError(ex)) {\n // we have a real Error object\n ex = ex;\n } else if (isPlainObject(ex)) {\n // If it is plain Object, serialize it manually and extract options\n // This will allow us to group events based on top-level keys\n // which is much better than creating new group when any key/value change\n options = this._getCaptureExceptionOptionsFromPlainObject(options, ex);\n ex = new Error(options.message);\n } else {\n // If none of previous checks were valid, then it means that\n // it's not a DOMError/DOMException\n // it's not a plain Object\n // it's not a valid ErrorEvent (one with an error property)\n // it's not an Error\n // So bail out and capture it as a simple message:\n return this.captureMessage(\n ex,\n objectMerge(options, {\n stacktrace: true, // if we fall back to captureMessage, default to attempting a new trace\n trimHeadFrames: options.trimHeadFrames + 1\n })\n );\n }\n\n // Store the raw exception object for potential debugging and introspection\n this._lastCapturedException = ex;\n\n // TraceKit.report will re-raise any exception passed to it,\n // which means you have to wrap it in try/catch. Instead, we\n // can wrap it here and only re-raise if TraceKit.report\n // raises an exception different from the one we asked to\n // report on.\n try {\n var stack = TraceKit.computeStackTrace(ex);\n this._handleStackInfo(stack, options);\n } catch (ex1) {\n if (ex !== ex1) {\n throw ex1;\n }\n }\n\n return this;\n },\n\n _getCaptureExceptionOptionsFromPlainObject: function(currentOptions, ex) {\n var exKeys = Object.keys(ex).sort();\n var options = objectMerge(currentOptions, {\n message:\n 'Non-Error exception captured with keys: ' + serializeKeysForMessage(exKeys),\n fingerprint: [md5(exKeys)],\n extra: currentOptions.extra || {}\n });\n options.extra.__serialized__ = serializeException(ex);\n\n return options;\n },\n\n /*\n * Manually send a message to Sentry\n *\n * @param {string} msg A plain message to be captured in Sentry\n * @param {object} options A specific set of options for this message [optional]\n * @return {Raven}\n */\n captureMessage: function(msg, options) {\n // config() automagically converts ignoreErrors from a list to a RegExp so we need to test for an\n // early call; we'll error on the side of logging anything called before configuration since it's\n // probably something you should see:\n if (\n !!this._globalOptions.ignoreErrors.test &&\n this._globalOptions.ignoreErrors.test(msg)\n ) {\n return;\n }\n\n options = options || {};\n msg = msg + ''; // Make sure it's actually a string\n\n var data = objectMerge(\n {\n message: msg\n },\n options\n );\n\n var ex;\n // Generate a \"synthetic\" stack trace from this point.\n // NOTE: If you are a Sentry user, and you are seeing this stack frame, it is NOT indicative\n // of a bug with Raven.js. Sentry generates synthetic traces either by configuration,\n // or if it catches a thrown object without a \"stack\" property.\n try {\n throw new Error(msg);\n } catch (ex1) {\n ex = ex1;\n }\n\n // null exception name so `Error` isn't prefixed to msg\n ex.name = null;\n var stack = TraceKit.computeStackTrace(ex);\n\n // stack[0] is `throw new Error(msg)` call itself, we are interested in the frame that was just before that, stack[1]\n var initialCall = isArray(stack.stack) && stack.stack[1];\n\n // if stack[1] is `Raven.captureException`, it means that someone passed a string to it and we redirected that call\n // to be handled by `captureMessage`, thus `initialCall` is the 3rd one, not 2nd\n // initialCall => captureException(string) => captureMessage(string)\n if (initialCall && initialCall.func === 'Raven.captureException') {\n initialCall = stack.stack[2];\n }\n\n var fileurl = (initialCall && initialCall.url) || '';\n\n if (\n !!this._globalOptions.ignoreUrls.test &&\n this._globalOptions.ignoreUrls.test(fileurl)\n ) {\n return;\n }\n\n if (\n !!this._globalOptions.whitelistUrls.test &&\n !this._globalOptions.whitelistUrls.test(fileurl)\n ) {\n return;\n }\n\n // Always attempt to get stacktrace if message is empty.\n // It's the only way to provide any helpful information to the user.\n if (this._globalOptions.stacktrace || options.stacktrace || data.message === '') {\n // fingerprint on msg, not stack trace (legacy behavior, could be revisited)\n data.fingerprint = data.fingerprint == null ? msg : data.fingerprint;\n\n options = objectMerge(\n {\n trimHeadFrames: 0\n },\n options\n );\n // Since we know this is a synthetic trace, the top frame (this function call)\n // MUST be from Raven.js, so mark it for trimming\n // We add to the trim counter so that callers can choose to trim extra frames, such\n // as utility functions.\n options.trimHeadFrames += 1;\n\n var frames = this._prepareFrames(stack, options);\n data.stacktrace = {\n // Sentry expects frames oldest to newest\n frames: frames.reverse()\n };\n }\n\n // Make sure that fingerprint is always wrapped in an array\n if (data.fingerprint) {\n data.fingerprint = isArray(data.fingerprint)\n ? data.fingerprint\n : [data.fingerprint];\n }\n\n // Fire away!\n this._send(data);\n\n return this;\n },\n\n captureBreadcrumb: function(obj) {\n var crumb = objectMerge(\n {\n timestamp: now() / 1000\n },\n obj\n );\n\n if (isFunction(this._globalOptions.breadcrumbCallback)) {\n var result = this._globalOptions.breadcrumbCallback(crumb);\n\n if (isObject(result) && !isEmptyObject(result)) {\n crumb = result;\n } else if (result === false) {\n return this;\n }\n }\n\n this._breadcrumbs.push(crumb);\n if (this._breadcrumbs.length > this._globalOptions.maxBreadcrumbs) {\n this._breadcrumbs.shift();\n }\n return this;\n },\n\n addPlugin: function(plugin /*arg1, arg2, ... argN*/) {\n var pluginArgs = [].slice.call(arguments, 1);\n\n this._plugins.push([plugin, pluginArgs]);\n if (this._isRavenInstalled) {\n this._drainPlugins();\n }\n\n return this;\n },\n\n /*\n * Set/clear a user to be sent along with the payload.\n *\n * @param {object} user An object representing user data [optional]\n * @return {Raven}\n */\n setUserContext: function(user) {\n // Intentionally do not merge here since that's an unexpected behavior.\n this._globalContext.user = user;\n\n return this;\n },\n\n /*\n * Merge extra attributes to be sent along with the payload.\n *\n * @param {object} extra An object representing extra data [optional]\n * @return {Raven}\n */\n setExtraContext: function(extra) {\n this._mergeContext('extra', extra);\n\n return this;\n },\n\n /*\n * Merge tags to be sent along with the payload.\n *\n * @param {object} tags An object representing tags [optional]\n * @return {Raven}\n */\n setTagsContext: function(tags) {\n this._mergeContext('tags', tags);\n\n return this;\n },\n\n /*\n * Clear all of the context.\n *\n * @return {Raven}\n */\n clearContext: function() {\n this._globalContext = {};\n\n return this;\n },\n\n /*\n * Get a copy of the current context. This cannot be mutated.\n *\n * @return {object} copy of context\n */\n getContext: function() {\n // lol javascript\n return JSON.parse(stringify(this._globalContext));\n },\n\n /*\n * Set environment of application\n *\n * @param {string} environment Typically something like 'production'.\n * @return {Raven}\n */\n setEnvironment: function(environment) {\n this._globalOptions.environment = environment;\n\n return this;\n },\n\n /*\n * Set release version of application\n *\n * @param {string} release Typically something like a git SHA to identify version\n * @return {Raven}\n */\n setRelease: function(release) {\n this._globalOptions.release = release;\n\n return this;\n },\n\n /*\n * Set the dataCallback option\n *\n * @param {function} callback The callback to run which allows the\n * data blob to be mutated before sending\n * @return {Raven}\n */\n setDataCallback: function(callback) {\n var original = this._globalOptions.dataCallback;\n this._globalOptions.dataCallback = keepOriginalCallback(original, callback);\n return this;\n },\n\n /*\n * Set the breadcrumbCallback option\n *\n * @param {function} callback The callback to run which allows filtering\n * or mutating breadcrumbs\n * @return {Raven}\n */\n setBreadcrumbCallback: function(callback) {\n var original = this._globalOptions.breadcrumbCallback;\n this._globalOptions.breadcrumbCallback = keepOriginalCallback(original, callback);\n return this;\n },\n\n /*\n * Set the shouldSendCallback option\n *\n * @param {function} callback The callback to run which allows\n * introspecting the blob before sending\n * @return {Raven}\n */\n setShouldSendCallback: function(callback) {\n var original = this._globalOptions.shouldSendCallback;\n this._globalOptions.shouldSendCallback = keepOriginalCallback(original, callback);\n return this;\n },\n\n /**\n * Override the default HTTP transport mechanism that transmits data\n * to the Sentry server.\n *\n * @param {function} transport Function invoked instead of the default\n * `makeRequest` handler.\n *\n * @return {Raven}\n */\n setTransport: function(transport) {\n this._globalOptions.transport = transport;\n\n return this;\n },\n\n /*\n * Get the latest raw exception that was captured by Raven.\n *\n * @return {error}\n */\n lastException: function() {\n return this._lastCapturedException;\n },\n\n /*\n * Get the last event id\n *\n * @return {string}\n */\n lastEventId: function() {\n return this._lastEventId;\n },\n\n /*\n * Determine if Raven is setup and ready to go.\n *\n * @return {boolean}\n */\n isSetup: function() {\n if (!this._hasJSON) return false; // needs JSON support\n if (!this._globalServer) {\n if (!this.ravenNotConfiguredError) {\n this.ravenNotConfiguredError = true;\n this._logDebug('error', 'Error: Raven has not been configured.');\n }\n return false;\n }\n return true;\n },\n\n afterLoad: function() {\n // TODO: remove window dependence?\n\n // Attempt to initialize Raven on load\n var RavenConfig = _window.RavenConfig;\n if (RavenConfig) {\n this.config(RavenConfig.dsn, RavenConfig.config).install();\n }\n },\n\n showReportDialog: function(options) {\n if (\n !_document // doesn't work without a document (React native)\n )\n return;\n\n options = Object.assign(\n {\n eventId: this.lastEventId(),\n dsn: this._dsn,\n user: this._globalContext.user || {}\n },\n options\n );\n\n if (!options.eventId) {\n throw new RavenConfigError('Missing eventId');\n }\n\n if (!options.dsn) {\n throw new RavenConfigError('Missing DSN');\n }\n\n var encode = encodeURIComponent;\n var encodedOptions = [];\n\n for (var key in options) {\n if (key === 'user') {\n var user = options.user;\n if (user.name) encodedOptions.push('name=' + encode(user.name));\n if (user.email) encodedOptions.push('email=' + encode(user.email));\n } else {\n encodedOptions.push(encode(key) + '=' + encode(options[key]));\n }\n }\n var globalServer = this._getGlobalServer(this._parseDSN(options.dsn));\n\n var script = _document.createElement('script');\n script.async = true;\n script.src = globalServer + '/api/embed/error-page/?' + encodedOptions.join('&');\n (_document.head || _document.body).appendChild(script);\n },\n\n /**** Private functions ****/\n _ignoreNextOnError: function() {\n var self = this;\n this._ignoreOnError += 1;\n setTimeout(function() {\n // onerror should trigger before setTimeout\n self._ignoreOnError -= 1;\n });\n },\n\n _triggerEvent: function(eventType, options) {\n // NOTE: `event` is a native browser thing, so let's avoid conflicting wiht it\n var evt, key;\n\n if (!this._hasDocument) return;\n\n options = options || {};\n\n eventType = 'raven' + eventType.substr(0, 1).toUpperCase() + eventType.substr(1);\n\n if (_document.createEvent) {\n evt = _document.createEvent('HTMLEvents');\n evt.initEvent(eventType, true, true);\n } else {\n evt = _document.createEventObject();\n evt.eventType = eventType;\n }\n\n for (key in options)\n if (hasKey(options, key)) {\n evt[key] = options[key];\n }\n\n if (_document.createEvent) {\n // IE9 if standards\n _document.dispatchEvent(evt);\n } else {\n // IE8 regardless of Quirks or Standards\n // IE9 if quirks\n try {\n _document.fireEvent('on' + evt.eventType.toLowerCase(), evt);\n } catch (e) {\n // Do nothing\n }\n }\n },\n\n /**\n * Wraps addEventListener to capture UI breadcrumbs\n * @param evtName the event name (e.g. \"click\")\n * @returns {Function}\n * @private\n */\n _breadcrumbEventHandler: function(evtName) {\n var self = this;\n return function(evt) {\n // reset keypress timeout; e.g. triggering a 'click' after\n // a 'keypress' will reset the keypress debounce so that a new\n // set of keypresses can be recorded\n self._keypressTimeout = null;\n\n // It's possible this handler might trigger multiple times for the same\n // event (e.g. event propagation through node ancestors). Ignore if we've\n // already captured the event.\n if (self._lastCapturedEvent === evt) return;\n\n self._lastCapturedEvent = evt;\n\n // try/catch both:\n // - accessing evt.target (see getsentry/raven-js#838, #768)\n // - `htmlTreeAsString` because it's complex, and just accessing the DOM incorrectly\n // can throw an exception in some circumstances.\n var target;\n try {\n target = htmlTreeAsString(evt.target);\n } catch (e) {\n target = '';\n }\n\n self.captureBreadcrumb({\n category: 'ui.' + evtName, // e.g. ui.click, ui.input\n message: target\n });\n };\n },\n\n /**\n * Wraps addEventListener to capture keypress UI events\n * @returns {Function}\n * @private\n */\n _keypressEventHandler: function() {\n var self = this,\n debounceDuration = 1000; // milliseconds\n\n // TODO: if somehow user switches keypress target before\n // debounce timeout is triggered, we will only capture\n // a single breadcrumb from the FIRST target (acceptable?)\n return function(evt) {\n var target;\n try {\n target = evt.target;\n } catch (e) {\n // just accessing event properties can throw an exception in some rare circumstances\n // see: https://github.com/getsentry/raven-js/issues/838\n return;\n }\n var tagName = target && target.tagName;\n\n // only consider keypress events on actual input elements\n // this will disregard keypresses targeting body (e.g. tabbing\n // through elements, hotkeys, etc)\n if (\n !tagName ||\n (tagName !== 'INPUT' && tagName !== 'TEXTAREA' && !target.isContentEditable)\n )\n return;\n\n // record first keypress in a series, but ignore subsequent\n // keypresses until debounce clears\n var timeout = self._keypressTimeout;\n if (!timeout) {\n self._breadcrumbEventHandler('input')(evt);\n }\n clearTimeout(timeout);\n self._keypressTimeout = setTimeout(function() {\n self._keypressTimeout = null;\n }, debounceDuration);\n };\n },\n\n /**\n * Captures a breadcrumb of type \"navigation\", normalizing input URLs\n * @param to the originating URL\n * @param from the target URL\n * @private\n */\n _captureUrlChange: function(from, to) {\n var parsedLoc = parseUrl(this._location.href);\n var parsedTo = parseUrl(to);\n var parsedFrom = parseUrl(from);\n\n // because onpopstate only tells you the \"new\" (to) value of location.href, and\n // not the previous (from) value, we need to track the value of the current URL\n // state ourselves\n this._lastHref = to;\n\n // Use only the path component of the URL if the URL matches the current\n // document (almost all the time when using pushState)\n if (parsedLoc.protocol === parsedTo.protocol && parsedLoc.host === parsedTo.host)\n to = parsedTo.relative;\n if (parsedLoc.protocol === parsedFrom.protocol && parsedLoc.host === parsedFrom.host)\n from = parsedFrom.relative;\n\n this.captureBreadcrumb({\n category: 'navigation',\n data: {\n to: to,\n from: from\n }\n });\n },\n\n _patchFunctionToString: function() {\n var self = this;\n self._originalFunctionToString = Function.prototype.toString;\n // eslint-disable-next-line no-extend-native\n Function.prototype.toString = function() {\n if (typeof this === 'function' && this.__raven__) {\n return self._originalFunctionToString.apply(this.__orig__, arguments);\n }\n return self._originalFunctionToString.apply(this, arguments);\n };\n },\n\n _unpatchFunctionToString: function() {\n if (this._originalFunctionToString) {\n // eslint-disable-next-line no-extend-native\n Function.prototype.toString = this._originalFunctionToString;\n }\n },\n\n /**\n * Wrap timer functions and event targets to catch errors and provide\n * better metadata.\n */\n _instrumentTryCatch: function() {\n var self = this;\n\n var wrappedBuiltIns = self._wrappedBuiltIns;\n\n function wrapTimeFn(orig) {\n return function(fn, t) {\n // preserve arity\n // Make a copy of the arguments to prevent deoptimization\n // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n var args = new Array(arguments.length);\n for (var i = 0; i < args.length; ++i) {\n args[i] = arguments[i];\n }\n var originalCallback = args[0];\n if (isFunction(originalCallback)) {\n args[0] = self.wrap(\n {\n mechanism: {\n type: 'instrument',\n data: {function: orig.name || ''}\n }\n },\n originalCallback\n );\n }\n\n // IE < 9 doesn't support .call/.apply on setInterval/setTimeout, but it\n // also supports only two arguments and doesn't care what this is, so we\n // can just call the original function directly.\n if (orig.apply) {\n return orig.apply(this, args);\n } else {\n return orig(args[0], args[1]);\n }\n };\n }\n\n var autoBreadcrumbs = this._globalOptions.autoBreadcrumbs;\n\n function wrapEventTarget(global) {\n var proto = _window[global] && _window[global].prototype;\n if (proto && proto.hasOwnProperty && proto.hasOwnProperty('addEventListener')) {\n fill(\n proto,\n 'addEventListener',\n function(orig) {\n return function(evtName, fn, capture, secure) {\n // preserve arity\n try {\n if (fn && fn.handleEvent) {\n fn.handleEvent = self.wrap(\n {\n mechanism: {\n type: 'instrument',\n data: {\n target: global,\n function: 'handleEvent',\n handler: (fn && fn.name) || ''\n }\n }\n },\n fn.handleEvent\n );\n }\n } catch (err) {\n // can sometimes get 'Permission denied to access property \"handle Event'\n }\n\n // More breadcrumb DOM capture ... done here and not in `_instrumentBreadcrumbs`\n // so that we don't have more than one wrapper function\n var before, clickHandler, keypressHandler;\n\n if (\n autoBreadcrumbs &&\n autoBreadcrumbs.dom &&\n (global === 'EventTarget' || global === 'Node')\n ) {\n // NOTE: generating multiple handlers per addEventListener invocation, should\n // revisit and verify we can just use one (almost certainly)\n clickHandler = self._breadcrumbEventHandler('click');\n keypressHandler = self._keypressEventHandler();\n before = function(evt) {\n // need to intercept every DOM event in `before` argument, in case that\n // same wrapped method is re-used for different events (e.g. mousemove THEN click)\n // see #724\n if (!evt) return;\n\n var eventType;\n try {\n eventType = evt.type;\n } catch (e) {\n // just accessing event properties can throw an exception in some rare circumstances\n // see: https://github.com/getsentry/raven-js/issues/838\n return;\n }\n if (eventType === 'click') return clickHandler(evt);\n else if (eventType === 'keypress') return keypressHandler(evt);\n };\n }\n return orig.call(\n this,\n evtName,\n self.wrap(\n {\n mechanism: {\n type: 'instrument',\n data: {\n target: global,\n function: 'addEventListener',\n handler: (fn && fn.name) || ''\n }\n }\n },\n fn,\n before\n ),\n capture,\n secure\n );\n };\n },\n wrappedBuiltIns\n );\n fill(\n proto,\n 'removeEventListener',\n function(orig) {\n return function(evt, fn, capture, secure) {\n try {\n fn = fn && (fn.__raven_wrapper__ ? fn.__raven_wrapper__ : fn);\n } catch (e) {\n // ignore, accessing __raven_wrapper__ will throw in some Selenium environments\n }\n return orig.call(this, evt, fn, capture, secure);\n };\n },\n wrappedBuiltIns\n );\n }\n }\n\n fill(_window, 'setTimeout', wrapTimeFn, wrappedBuiltIns);\n fill(_window, 'setInterval', wrapTimeFn, wrappedBuiltIns);\n if (_window.requestAnimationFrame) {\n fill(\n _window,\n 'requestAnimationFrame',\n function(orig) {\n return function(cb) {\n return orig(\n self.wrap(\n {\n mechanism: {\n type: 'instrument',\n data: {\n function: 'requestAnimationFrame',\n handler: (orig && orig.name) || ''\n }\n }\n },\n cb\n )\n );\n };\n },\n wrappedBuiltIns\n );\n }\n\n // event targets borrowed from bugsnag-js:\n // https://github.com/bugsnag/bugsnag-js/blob/master/src/bugsnag.js#L666\n var eventTargets = [\n 'EventTarget',\n 'Window',\n 'Node',\n 'ApplicationCache',\n 'AudioTrackList',\n 'ChannelMergerNode',\n 'CryptoOperation',\n 'EventSource',\n 'FileReader',\n 'HTMLUnknownElement',\n 'IDBDatabase',\n 'IDBRequest',\n 'IDBTransaction',\n 'KeyOperation',\n 'MediaController',\n 'MessagePort',\n 'ModalWindow',\n 'Notification',\n 'SVGElementInstance',\n 'Screen',\n 'TextTrack',\n 'TextTrackCue',\n 'TextTrackList',\n 'WebSocket',\n 'WebSocketWorker',\n 'Worker',\n 'XMLHttpRequest',\n 'XMLHttpRequestEventTarget',\n 'XMLHttpRequestUpload'\n ];\n for (var i = 0; i < eventTargets.length; i++) {\n wrapEventTarget(eventTargets[i]);\n }\n },\n\n /**\n * Instrument browser built-ins w/ breadcrumb capturing\n * - XMLHttpRequests\n * - DOM interactions (click/typing)\n * - window.location changes\n * - console\n *\n * Can be disabled or individually configured via the `autoBreadcrumbs` config option\n */\n _instrumentBreadcrumbs: function() {\n var self = this;\n var autoBreadcrumbs = this._globalOptions.autoBreadcrumbs;\n\n var wrappedBuiltIns = self._wrappedBuiltIns;\n\n function wrapProp(prop, xhr) {\n if (prop in xhr && isFunction(xhr[prop])) {\n fill(xhr, prop, function(orig) {\n return self.wrap(\n {\n mechanism: {\n type: 'instrument',\n data: {function: prop, handler: (orig && orig.name) || ''}\n }\n },\n orig\n );\n }); // intentionally don't track filled methods on XHR instances\n }\n }\n\n if (autoBreadcrumbs.xhr && 'XMLHttpRequest' in _window) {\n var xhrproto = _window.XMLHttpRequest && _window.XMLHttpRequest.prototype;\n fill(\n xhrproto,\n 'open',\n function(origOpen) {\n return function(method, url) {\n // preserve arity\n\n // if Sentry key appears in URL, don't capture\n if (isString(url) && url.indexOf(self._globalKey) === -1) {\n this.__raven_xhr = {\n method: method,\n url: url,\n status_code: null\n };\n }\n\n return origOpen.apply(this, arguments);\n };\n },\n wrappedBuiltIns\n );\n\n fill(\n xhrproto,\n 'send',\n function(origSend) {\n return function() {\n // preserve arity\n var xhr = this;\n\n function onreadystatechangeHandler() {\n if (xhr.__raven_xhr && xhr.readyState === 4) {\n try {\n // touching statusCode in some platforms throws\n // an exception\n xhr.__raven_xhr.status_code = xhr.status;\n } catch (e) {\n /* do nothing */\n }\n\n self.captureBreadcrumb({\n type: 'http',\n category: 'xhr',\n data: xhr.__raven_xhr\n });\n }\n }\n\n var props = ['onload', 'onerror', 'onprogress'];\n for (var j = 0; j < props.length; j++) {\n wrapProp(props[j], xhr);\n }\n\n if ('onreadystatechange' in xhr && isFunction(xhr.onreadystatechange)) {\n fill(\n xhr,\n 'onreadystatechange',\n function(orig) {\n return self.wrap(\n {\n mechanism: {\n type: 'instrument',\n data: {\n function: 'onreadystatechange',\n handler: (orig && orig.name) || ''\n }\n }\n },\n orig,\n onreadystatechangeHandler\n );\n } /* intentionally don't track this instrumentation */\n );\n } else {\n // if onreadystatechange wasn't actually set by the page on this xhr, we\n // are free to set our own and capture the breadcrumb\n xhr.onreadystatechange = onreadystatechangeHandler;\n }\n\n return origSend.apply(this, arguments);\n };\n },\n wrappedBuiltIns\n );\n }\n\n if (autoBreadcrumbs.xhr && supportsFetch()) {\n fill(\n _window,\n 'fetch',\n function(origFetch) {\n return function() {\n // preserve arity\n // Make a copy of the arguments to prevent deoptimization\n // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n var args = new Array(arguments.length);\n for (var i = 0; i < args.length; ++i) {\n args[i] = arguments[i];\n }\n\n var fetchInput = args[0];\n var method = 'GET';\n var url;\n\n if (typeof fetchInput === 'string') {\n url = fetchInput;\n } else if ('Request' in _window && fetchInput instanceof _window.Request) {\n url = fetchInput.url;\n if (fetchInput.method) {\n method = fetchInput.method;\n }\n } else {\n url = '' + fetchInput;\n }\n\n // if Sentry key appears in URL, don't capture, as it's our own request\n if (url.indexOf(self._globalKey) !== -1) {\n return origFetch.apply(this, args);\n }\n\n if (args[1] && args[1].method) {\n method = args[1].method;\n }\n\n var fetchData = {\n method: method,\n url: url,\n status_code: null\n };\n\n return origFetch\n .apply(this, args)\n .then(function(response) {\n fetchData.status_code = response.status;\n\n self.captureBreadcrumb({\n type: 'http',\n category: 'fetch',\n data: fetchData\n });\n\n return response;\n })\n ['catch'](function(err) {\n // if there is an error performing the request\n self.captureBreadcrumb({\n type: 'http',\n category: 'fetch',\n data: fetchData,\n level: 'error'\n });\n\n throw err;\n });\n };\n },\n wrappedBuiltIns\n );\n }\n\n // Capture breadcrumbs from any click that is unhandled / bubbled up all the way\n // to the document. Do this before we instrument addEventListener.\n if (autoBreadcrumbs.dom && this._hasDocument) {\n if (_document.addEventListener) {\n _document.addEventListener('click', self._breadcrumbEventHandler('click'), false);\n _document.addEventListener('keypress', self._keypressEventHandler(), false);\n } else if (_document.attachEvent) {\n // IE8 Compatibility\n _document.attachEvent('onclick', self._breadcrumbEventHandler('click'));\n _document.attachEvent('onkeypress', self._keypressEventHandler());\n }\n }\n\n // record navigation (URL) changes\n // NOTE: in Chrome App environment, touching history.pushState, *even inside\n // a try/catch block*, will cause Chrome to output an error to console.error\n // borrowed from: https://github.com/angular/angular.js/pull/13945/files\n var chrome = _window.chrome;\n var isChromePackagedApp = chrome && chrome.app && chrome.app.runtime;\n var hasPushAndReplaceState =\n !isChromePackagedApp &&\n _window.history &&\n _window.history.pushState &&\n _window.history.replaceState;\n if (autoBreadcrumbs.location && hasPushAndReplaceState) {\n // TODO: remove onpopstate handler on uninstall()\n var oldOnPopState = _window.onpopstate;\n _window.onpopstate = function() {\n var currentHref = self._location.href;\n self._captureUrlChange(self._lastHref, currentHref);\n\n if (oldOnPopState) {\n return oldOnPopState.apply(this, arguments);\n }\n };\n\n var historyReplacementFunction = function(origHistFunction) {\n // note history.pushState.length is 0; intentionally not declaring\n // params to preserve 0 arity\n return function(/* state, title, url */) {\n var url = arguments.length > 2 ? arguments[2] : undefined;\n\n // url argument is optional\n if (url) {\n // coerce to string (this is what pushState does)\n self._captureUrlChange(self._lastHref, url + '');\n }\n\n return origHistFunction.apply(this, arguments);\n };\n };\n\n fill(_window.history, 'pushState', historyReplacementFunction, wrappedBuiltIns);\n fill(_window.history, 'replaceState', historyReplacementFunction, wrappedBuiltIns);\n }\n\n if (autoBreadcrumbs.console && 'console' in _window && console.log) {\n // console\n var consoleMethodCallback = function(msg, data) {\n self.captureBreadcrumb({\n message: msg,\n level: data.level,\n category: 'console'\n });\n };\n\n each(['debug', 'info', 'warn', 'error', 'log'], function(_, level) {\n wrapConsoleMethod(console, level, consoleMethodCallback);\n });\n }\n },\n\n _restoreBuiltIns: function() {\n // restore any wrapped builtins\n var builtin;\n while (this._wrappedBuiltIns.length) {\n builtin = this._wrappedBuiltIns.shift();\n\n var obj = builtin[0],\n name = builtin[1],\n orig = builtin[2];\n\n obj[name] = orig;\n }\n },\n\n _restoreConsole: function() {\n // eslint-disable-next-line guard-for-in\n for (var method in this._originalConsoleMethods) {\n this._originalConsole[method] = this._originalConsoleMethods[method];\n }\n },\n\n _drainPlugins: function() {\n var self = this;\n\n // FIX ME TODO\n each(this._plugins, function(_, plugin) {\n var installer = plugin[0];\n var args = plugin[1];\n installer.apply(self, [self].concat(args));\n });\n },\n\n _parseDSN: function(str) {\n var m = dsnPattern.exec(str),\n dsn = {},\n i = 7;\n\n try {\n while (i--) dsn[dsnKeys[i]] = m[i] || '';\n } catch (e) {\n throw new RavenConfigError('Invalid DSN: ' + str);\n }\n\n if (dsn.pass && !this._globalOptions.allowSecretKey) {\n throw new RavenConfigError(\n 'Do not specify your secret key in the DSN. See: http://bit.ly/raven-secret-key'\n );\n }\n\n return dsn;\n },\n\n _getGlobalServer: function(uri) {\n // assemble the endpoint from the uri pieces\n var globalServer = '//' + uri.host + (uri.port ? ':' + uri.port : '');\n\n if (uri.protocol) {\n globalServer = uri.protocol + ':' + globalServer;\n }\n return globalServer;\n },\n\n _handleOnErrorStackInfo: function(stackInfo, options) {\n options = options || {};\n options.mechanism = options.mechanism || {\n type: 'onerror',\n handled: false\n };\n\n // if we are intentionally ignoring errors via onerror, bail out\n if (!this._ignoreOnError) {\n this._handleStackInfo(stackInfo, options);\n }\n },\n\n _handleStackInfo: function(stackInfo, options) {\n var frames = this._prepareFrames(stackInfo, options);\n\n this._triggerEvent('handle', {\n stackInfo: stackInfo,\n options: options\n });\n\n this._processException(\n stackInfo.name,\n stackInfo.message,\n stackInfo.url,\n stackInfo.lineno,\n frames,\n options\n );\n },\n\n _prepareFrames: function(stackInfo, options) {\n var self = this;\n var frames = [];\n if (stackInfo.stack && stackInfo.stack.length) {\n each(stackInfo.stack, function(i, stack) {\n var frame = self._normalizeFrame(stack, stackInfo.url);\n if (frame) {\n frames.push(frame);\n }\n });\n\n // e.g. frames captured via captureMessage throw\n if (options && options.trimHeadFrames) {\n for (var j = 0; j < options.trimHeadFrames && j < frames.length; j++) {\n frames[j].in_app = false;\n }\n }\n }\n frames = frames.slice(0, this._globalOptions.stackTraceLimit);\n return frames;\n },\n\n _normalizeFrame: function(frame, stackInfoUrl) {\n // normalize the frames data\n var normalized = {\n filename: frame.url,\n lineno: frame.line,\n colno: frame.column,\n function: frame.func || '?'\n };\n\n // Case when we don't have any information about the error\n // E.g. throwing a string or raw object, instead of an `Error` in Firefox\n // Generating synthetic error doesn't add any value here\n //\n // We should probably somehow let a user know that they should fix their code\n if (!frame.url) {\n normalized.filename = stackInfoUrl; // fallback to whole stacks url from onerror handler\n }\n\n normalized.in_app = !// determine if an exception came from outside of our app\n // first we check the global includePaths list.\n (\n (!!this._globalOptions.includePaths.test &&\n !this._globalOptions.includePaths.test(normalized.filename)) ||\n // Now we check for fun, if the function name is Raven or TraceKit\n /(Raven|TraceKit)\\./.test(normalized['function']) ||\n // finally, we do a last ditch effort and check for raven.min.js\n /raven\\.(min\\.)?js$/.test(normalized.filename)\n );\n\n return normalized;\n },\n\n _processException: function(type, message, fileurl, lineno, frames, options) {\n var prefixedMessage = (type ? type + ': ' : '') + (message || '');\n if (\n !!this._globalOptions.ignoreErrors.test &&\n (this._globalOptions.ignoreErrors.test(message) ||\n this._globalOptions.ignoreErrors.test(prefixedMessage))\n ) {\n return;\n }\n\n var stacktrace;\n\n if (frames && frames.length) {\n fileurl = frames[0].filename || fileurl;\n // Sentry expects frames oldest to newest\n // and JS sends them as newest to oldest\n frames.reverse();\n stacktrace = {frames: frames};\n } else if (fileurl) {\n stacktrace = {\n frames: [\n {\n filename: fileurl,\n lineno: lineno,\n in_app: true\n }\n ]\n };\n }\n\n if (\n !!this._globalOptions.ignoreUrls.test &&\n this._globalOptions.ignoreUrls.test(fileurl)\n ) {\n return;\n }\n\n if (\n !!this._globalOptions.whitelistUrls.test &&\n !this._globalOptions.whitelistUrls.test(fileurl)\n ) {\n return;\n }\n\n var data = objectMerge(\n {\n // sentry.interfaces.Exception\n exception: {\n values: [\n {\n type: type,\n value: message,\n stacktrace: stacktrace\n }\n ]\n },\n transaction: fileurl\n },\n options\n );\n\n var ex = data.exception.values[0];\n if (ex.type == null && ex.value === '') {\n ex.value = 'Unrecoverable error caught';\n }\n\n // Move mechanism from options to exception interface\n // We do this, as requiring user to pass `{exception:{mechanism:{ ... }}}` would be\n // too much\n if (!data.exception.mechanism && data.mechanism) {\n data.exception.mechanism = data.mechanism;\n delete data.mechanism;\n }\n\n data.exception.mechanism = objectMerge(\n {\n type: 'generic',\n handled: true\n },\n data.exception.mechanism || {}\n );\n\n // Fire away!\n this._send(data);\n },\n\n _trimPacket: function(data) {\n // For now, we only want to truncate the two different messages\n // but this could/should be expanded to just trim everything\n var max = this._globalOptions.maxMessageLength;\n if (data.message) {\n data.message = truncate(data.message, max);\n }\n if (data.exception) {\n var exception = data.exception.values[0];\n exception.value = truncate(exception.value, max);\n }\n\n var request = data.request;\n if (request) {\n if (request.url) {\n request.url = truncate(request.url, this._globalOptions.maxUrlLength);\n }\n if (request.Referer) {\n request.Referer = truncate(request.Referer, this._globalOptions.maxUrlLength);\n }\n }\n\n if (data.breadcrumbs && data.breadcrumbs.values)\n this._trimBreadcrumbs(data.breadcrumbs);\n\n return data;\n },\n\n /**\n * Truncate breadcrumb values (right now just URLs)\n */\n _trimBreadcrumbs: function(breadcrumbs) {\n // known breadcrumb properties with urls\n // TODO: also consider arbitrary prop values that start with (https?)?://\n var urlProps = ['to', 'from', 'url'],\n urlProp,\n crumb,\n data;\n\n for (var i = 0; i < breadcrumbs.values.length; ++i) {\n crumb = breadcrumbs.values[i];\n if (\n !crumb.hasOwnProperty('data') ||\n !isObject(crumb.data) ||\n objectFrozen(crumb.data)\n )\n continue;\n\n data = objectMerge({}, crumb.data);\n for (var j = 0; j < urlProps.length; ++j) {\n urlProp = urlProps[j];\n if (data.hasOwnProperty(urlProp) && data[urlProp]) {\n data[urlProp] = truncate(data[urlProp], this._globalOptions.maxUrlLength);\n }\n }\n breadcrumbs.values[i].data = data;\n }\n },\n\n _getHttpData: function() {\n if (!this._hasNavigator && !this._hasDocument) return;\n var httpData = {};\n\n if (this._hasNavigator && _navigator.userAgent) {\n httpData.headers = {\n 'User-Agent': _navigator.userAgent\n };\n }\n\n // Check in `window` instead of `document`, as we may be in ServiceWorker environment\n if (_window.location && _window.location.href) {\n httpData.url = _window.location.href;\n }\n\n if (this._hasDocument && _document.referrer) {\n if (!httpData.headers) httpData.headers = {};\n httpData.headers.Referer = _document.referrer;\n }\n\n return httpData;\n },\n\n _resetBackoff: function() {\n this._backoffDuration = 0;\n this._backoffStart = null;\n },\n\n _shouldBackoff: function() {\n return this._backoffDuration && now() - this._backoffStart < this._backoffDuration;\n },\n\n /**\n * Returns true if the in-process data payload matches the signature\n * of the previously-sent data\n *\n * NOTE: This has to be done at this level because TraceKit can generate\n * data from window.onerror WITHOUT an exception object (IE8, IE9,\n * other old browsers). This can take the form of an \"exception\"\n * data object with a single frame (derived from the onerror args).\n */\n _isRepeatData: function(current) {\n var last = this._lastData;\n\n if (\n !last ||\n current.message !== last.message || // defined for captureMessage\n current.transaction !== last.transaction // defined for captureException/onerror\n )\n return false;\n\n // Stacktrace interface (i.e. from captureMessage)\n if (current.stacktrace || last.stacktrace) {\n return isSameStacktrace(current.stacktrace, last.stacktrace);\n } else if (current.exception || last.exception) {\n // Exception interface (i.e. from captureException/onerror)\n return isSameException(current.exception, last.exception);\n }\n\n return true;\n },\n\n _setBackoffState: function(request) {\n // If we are already in a backoff state, don't change anything\n if (this._shouldBackoff()) {\n return;\n }\n\n var status = request.status;\n\n // 400 - project_id doesn't exist or some other fatal\n // 401 - invalid/revoked dsn\n // 429 - too many requests\n if (!(status === 400 || status === 401 || status === 429)) return;\n\n var retry;\n try {\n // If Retry-After is not in Access-Control-Expose-Headers, most\n // browsers will throw an exception trying to access it\n if (supportsFetch()) {\n retry = request.headers.get('Retry-After');\n } else {\n retry = request.getResponseHeader('Retry-After');\n }\n\n // Retry-After is returned in seconds\n retry = parseInt(retry, 10) * 1000;\n } catch (e) {\n /* eslint no-empty:0 */\n }\n\n this._backoffDuration = retry\n ? // If Sentry server returned a Retry-After value, use it\n retry\n : // Otherwise, double the last backoff duration (starts at 1 sec)\n this._backoffDuration * 2 || 1000;\n\n this._backoffStart = now();\n },\n\n _send: function(data) {\n var globalOptions = this._globalOptions;\n\n var baseData = {\n project: this._globalProject,\n logger: globalOptions.logger,\n platform: 'javascript'\n },\n httpData = this._getHttpData();\n\n if (httpData) {\n baseData.request = httpData;\n }\n\n // HACK: delete `trimHeadFrames` to prevent from appearing in outbound payload\n if (data.trimHeadFrames) delete data.trimHeadFrames;\n\n data = objectMerge(baseData, data);\n\n // Merge in the tags and extra separately since objectMerge doesn't handle a deep merge\n data.tags = objectMerge(objectMerge({}, this._globalContext.tags), data.tags);\n data.extra = objectMerge(objectMerge({}, this._globalContext.extra), data.extra);\n\n // Send along our own collected metadata with extra\n data.extra['session:duration'] = now() - this._startTime;\n\n if (this._breadcrumbs && this._breadcrumbs.length > 0) {\n // intentionally make shallow copy so that additions\n // to breadcrumbs aren't accidentally sent in this request\n data.breadcrumbs = {\n values: [].slice.call(this._breadcrumbs, 0)\n };\n }\n\n if (this._globalContext.user) {\n // sentry.interfaces.User\n data.user = this._globalContext.user;\n }\n\n // Include the environment if it's defined in globalOptions\n if (globalOptions.environment) data.environment = globalOptions.environment;\n\n // Include the release if it's defined in globalOptions\n if (globalOptions.release) data.release = globalOptions.release;\n\n // Include server_name if it's defined in globalOptions\n if (globalOptions.serverName) data.server_name = globalOptions.serverName;\n\n data = this._sanitizeData(data);\n\n // Cleanup empty properties before sending them to the server\n Object.keys(data).forEach(function(key) {\n if (data[key] == null || data[key] === '' || isEmptyObject(data[key])) {\n delete data[key];\n }\n });\n\n if (isFunction(globalOptions.dataCallback)) {\n data = globalOptions.dataCallback(data) || data;\n }\n\n // Why??????????\n if (!data || isEmptyObject(data)) {\n return;\n }\n\n // Check if the request should be filtered or not\n if (\n isFunction(globalOptions.shouldSendCallback) &&\n !globalOptions.shouldSendCallback(data)\n ) {\n return;\n }\n\n // Backoff state: Sentry server previously responded w/ an error (e.g. 429 - too many requests),\n // so drop requests until \"cool-off\" period has elapsed.\n if (this._shouldBackoff()) {\n this._logDebug('warn', 'Raven dropped error due to backoff: ', data);\n return;\n }\n\n if (typeof globalOptions.sampleRate === 'number') {\n if (Math.random() < globalOptions.sampleRate) {\n this._sendProcessedPayload(data);\n }\n } else {\n this._sendProcessedPayload(data);\n }\n },\n\n _sanitizeData: function(data) {\n return sanitize(data, this._globalOptions.sanitizeKeys);\n },\n\n _getUuid: function() {\n return uuid4();\n },\n\n _sendProcessedPayload: function(data, callback) {\n var self = this;\n var globalOptions = this._globalOptions;\n\n if (!this.isSetup()) return;\n\n // Try and clean up the packet before sending by truncating long values\n data = this._trimPacket(data);\n\n // ideally duplicate error testing should occur *before* dataCallback/shouldSendCallback,\n // but this would require copying an un-truncated copy of the data packet, which can be\n // arbitrarily deep (extra_data) -- could be worthwhile? will revisit\n if (!this._globalOptions.allowDuplicates && this._isRepeatData(data)) {\n this._logDebug('warn', 'Raven dropped repeat event: ', data);\n return;\n }\n\n // Send along an event_id if not explicitly passed.\n // This event_id can be used to reference the error within Sentry itself.\n // Set lastEventId after we know the error should actually be sent\n this._lastEventId = data.event_id || (data.event_id = this._getUuid());\n\n // Store outbound payload after trim\n this._lastData = data;\n\n this._logDebug('debug', 'Raven about to send:', data);\n\n var auth = {\n sentry_version: '7',\n sentry_client: 'raven-js/' + this.VERSION,\n sentry_key: this._globalKey\n };\n\n if (this._globalSecret) {\n auth.sentry_secret = this._globalSecret;\n }\n\n var exception = data.exception && data.exception.values[0];\n\n // only capture 'sentry' breadcrumb is autoBreadcrumbs is truthy\n if (\n this._globalOptions.autoBreadcrumbs &&\n this._globalOptions.autoBreadcrumbs.sentry\n ) {\n this.captureBreadcrumb({\n category: 'sentry',\n message: exception\n ? (exception.type ? exception.type + ': ' : '') + exception.value\n : data.message,\n event_id: data.event_id,\n level: data.level || 'error' // presume error unless specified\n });\n }\n\n var url = this._globalEndpoint;\n (globalOptions.transport || this._makeRequest).call(this, {\n url: url,\n auth: auth,\n data: data,\n options: globalOptions,\n onSuccess: function success() {\n self._resetBackoff();\n\n self._triggerEvent('success', {\n data: data,\n src: url\n });\n callback && callback();\n },\n onError: function failure(error) {\n self._logDebug('error', 'Raven transport failed to send: ', error);\n\n if (error.request) {\n self._setBackoffState(error.request);\n }\n\n self._triggerEvent('failure', {\n data: data,\n src: url\n });\n error = error || new Error('Raven send failed (no additional details provided)');\n callback && callback(error);\n }\n });\n },\n\n _makeRequest: function(opts) {\n // Auth is intentionally sent as part of query string (NOT as custom HTTP header) to avoid preflight CORS requests\n var url = opts.url + '?' + urlencode(opts.auth);\n\n var evaluatedHeaders = null;\n var evaluatedFetchParameters = {};\n\n if (opts.options.headers) {\n evaluatedHeaders = this._evaluateHash(opts.options.headers);\n }\n\n if (opts.options.fetchParameters) {\n evaluatedFetchParameters = this._evaluateHash(opts.options.fetchParameters);\n }\n\n if (supportsFetch()) {\n evaluatedFetchParameters.body = stringify(opts.data);\n\n var defaultFetchOptions = objectMerge({}, this._fetchDefaults);\n var fetchOptions = objectMerge(defaultFetchOptions, evaluatedFetchParameters);\n\n if (evaluatedHeaders) {\n fetchOptions.headers = evaluatedHeaders;\n }\n\n return _window\n .fetch(url, fetchOptions)\n .then(function(response) {\n if (response.ok) {\n opts.onSuccess && opts.onSuccess();\n } else {\n var error = new Error('Sentry error code: ' + response.status);\n // It's called request only to keep compatibility with XHR interface\n // and not add more redundant checks in setBackoffState method\n error.request = response;\n opts.onError && opts.onError(error);\n }\n })\n ['catch'](function() {\n opts.onError &&\n opts.onError(new Error('Sentry error code: network unavailable'));\n });\n }\n\n var request = _window.XMLHttpRequest && new _window.XMLHttpRequest();\n if (!request) return;\n\n // if browser doesn't support CORS (e.g. IE7), we are out of luck\n var hasCORS = 'withCredentials' in request || typeof XDomainRequest !== 'undefined';\n\n if (!hasCORS) return;\n\n if ('withCredentials' in request) {\n request.onreadystatechange = function() {\n if (request.readyState !== 4) {\n return;\n } else if (request.status === 200) {\n opts.onSuccess && opts.onSuccess();\n } else if (opts.onError) {\n var err = new Error('Sentry error code: ' + request.status);\n err.request = request;\n opts.onError(err);\n }\n };\n } else {\n request = new XDomainRequest();\n // xdomainrequest cannot go http -> https (or vice versa),\n // so always use protocol relative\n url = url.replace(/^https?:/, '');\n\n // onreadystatechange not supported by XDomainRequest\n if (opts.onSuccess) {\n request.onload = opts.onSuccess;\n }\n if (opts.onError) {\n request.onerror = function() {\n var err = new Error('Sentry error code: XDomainRequest');\n err.request = request;\n opts.onError(err);\n };\n }\n }\n\n request.open('POST', url);\n\n if (evaluatedHeaders) {\n each(evaluatedHeaders, function(key, value) {\n request.setRequestHeader(key, value);\n });\n }\n\n request.send(stringify(opts.data));\n },\n\n _evaluateHash: function(hash) {\n var evaluated = {};\n\n for (var key in hash) {\n if (hash.hasOwnProperty(key)) {\n var value = hash[key];\n evaluated[key] = typeof value === 'function' ? value() : value;\n }\n }\n\n return evaluated;\n },\n\n _logDebug: function(level) {\n // We allow `Raven.debug` and `Raven.config(DSN, { debug: true })` to not make backward incompatible API change\n if (\n this._originalConsoleMethods[level] &&\n (this.debug || this._globalOptions.debug)\n ) {\n // In IE<10 console methods do not have their own 'apply' method\n Function.prototype.apply.call(\n this._originalConsoleMethods[level],\n this._originalConsole,\n [].slice.call(arguments, 1)\n );\n }\n },\n\n _mergeContext: function(key, context) {\n if (isUndefined(context)) {\n delete this._globalContext[key];\n } else {\n this._globalContext[key] = objectMerge(this._globalContext[key] || {}, context);\n }\n }\n};\n\n// Deprecations\nRaven.prototype.setUser = Raven.prototype.setUserContext;\nRaven.prototype.setReleaseContext = Raven.prototype.setRelease;\n\nmodule.exports = Raven;\n","/**\n * Enforces a single instance of the Raven client, and the\n * main entry point for Raven. If you are a consumer of the\n * Raven library, you SHOULD load this file (vs raven.js).\n **/\n\nvar RavenConstructor = require('./raven');\n\n// This is to be defensive in environments where window does not exist (see https://github.com/getsentry/raven-js/pull/785)\nvar _window =\n typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\nvar _Raven = _window.Raven;\n\nvar Raven = new RavenConstructor();\n\n/*\n * Allow multiple versions of Raven to be installed.\n * Strip Raven from the global context and returns the instance.\n *\n * @return {Raven}\n */\nRaven.noConflict = function() {\n _window.Raven = _Raven;\n return Raven;\n};\n\nRaven.afterLoad();\n\nmodule.exports = Raven;\n\n/**\n * DISCLAIMER:\n *\n * Expose `Client` constructor for cases where user want to track multiple \"sub-applications\" in one larger app.\n * It's not meant to be used by a wide audience, so pleaaase make sure that you know what you're doing before using it.\n * Accidentally calling `install` multiple times, may result in an unexpected behavior that's very hard to debug.\n *\n * It's called `Client' to be in-line with Raven Node implementation.\n *\n * HOWTO:\n *\n * import Raven from 'raven-js';\n *\n * const someAppReporter = new Raven.Client();\n * const someOtherAppReporter = new Raven.Client();\n *\n * someAppReporter.config('__DSN__', {\n * ...config goes here\n * });\n *\n * someOtherAppReporter.config('__OTHER_DSN__', {\n * ...config goes here\n * });\n *\n * someAppReporter.captureMessage(...);\n * someAppReporter.captureException(...);\n * someAppReporter.captureBreadcrumb(...);\n *\n * someOtherAppReporter.captureMessage(...);\n * someOtherAppReporter.captureException(...);\n * someOtherAppReporter.captureBreadcrumb(...);\n *\n * It should \"just work\".\n */\nmodule.exports.Client = RavenConstructor;\n","// ==========================================================================\n// Plyr.io demo\n// This code is purely for the https://plyr.io website\n// Please see readme.md in the root or github.com/sampotts/plyr\n// ==========================================================================\n\nimport Raven from 'raven-js';\n\n(() => {\n const isLive = window.location.host === 'plyr.io';\n\n // Raven / Sentry\n // For demo site (https://plyr.io) only\n if (isLive) {\n Raven.config(\n 'https://d4ad9866ad834437a4754e23937071e4@sentry.io/305555',\n ).install();\n }\n\n document.addEventListener('DOMContentLoaded', () => {\n Raven.context(() => {\n const selector = '#player';\n const container = document.getElementById('container');\n\n if (window.shr) {\n window.shr.setup({\n count: {\n classname: 'button__count',\n },\n });\n }\n\n // Setup tab focus\n const tabClassName = 'tab-focus';\n\n // Remove class on blur\n document.addEventListener('focusout', event => {\n if (container.contains(event.target)) {\n return;\n }\n event.target.classList.remove(tabClassName);\n });\n\n // Add classname to tabbed elements\n document.addEventListener('keydown', event => {\n if (event.keyCode !== 9) {\n return;\n }\n\n // Delay the adding of classname until the focus has changed\n // This event fires before the focusin event\n setTimeout(() => {\n const focused = document.activeElement;\n\n if (!focused || container.contains(focused)) {\n return;\n }\n\n focused.classList.add(tabClassName);\n }, 10);\n });\n\n // Setup the player\n const player = new Plyr(selector, {\n debug: true,\n title: 'View From A Blue Moon',\n iconUrl: '../dist/plyr.svg',\n keyboard: {\n global: true,\n },\n tooltips: {\n controls: false,\n seek: false,\n },\n // clickToPlay: false,\n /* controls: [\n 'play-large',\n 'restart',\n 'rewind',\n 'play',\n 'fast-forward',\n 'progress',\n 'current-time',\n 'duration',\n 'mute',\n 'volume',\n 'captions',\n 'settings',\n 'pip',\n 'airplay',\n 'fullscreen',\n ], */\n /* i18n: {\n restart: '重新開始',\n rewind: '快退{seektime}秒',\n play: '播放',\n pause: '暫停',\n fastForward: '快進{seektime}秒',\n seek: '尋求',\n played: '發揮',\n buffered: '緩衝的',\n currentTime: '當前時間戳',\n duration: '長短',\n volume: '音量',\n mute: '靜音',\n unmute: '取消靜音',\n enableCaptions: '開啟字幕',\n disableCaptions: '關閉字幕',\n enterFullscreen: '進入全螢幕',\n exitFullscreen: '退出全螢幕',\n frameTitle: '球員為{title}',\n captions: '字幕',\n settings: '設定',\n speed: '速度',\n normal: '正常',\n quality: '質量',\n loop: '循環',\n start: 'Start',\n end: 'End',\n all: 'All',\n reset: '重啟',\n disabled: '殘',\n enabled: '啟用',\n advertisement: '廣告',\n }, */\n captions: {\n active: true,\n },\n keys: {\n google: 'AIzaSyDrNwtN3nLH_8rjCmu5Wq3ZCm4MNAVdc0c',\n },\n ads: {\n // enabled: true,\n publisherId: '918848828995742',\n },\n });\n\n // Expose for tinkering in the console\n window.player = player;\n\n // Setup type toggle\n const buttons = document.querySelectorAll('[data-source]');\n const types = {\n video: 'video',\n audio: 'audio',\n youtube: 'youtube',\n vimeo: 'vimeo',\n };\n let currentType = window.location.hash.replace('#', '');\n const historySupport = window.history && window.history.pushState;\n\n // Toggle class on an element\n function toggleClass(element, className, state) {\n if (element) {\n element.classList[state ? 'add' : 'remove'](className);\n }\n }\n\n // Set a new source\n function newSource(type, init) {\n // Bail if new type isn't known, it's the current type, or current type is empty (video is default) and new type is video\n if (\n !(type in types) ||\n (!init && type === currentType) ||\n (!currentType.length && type === types.video)\n ) {\n return;\n }\n\n switch (type) {\n case types.video:\n player.source = {\n type: 'video',\n title: 'View From A Blue Moon',\n sources: [\n {\n src:\n 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-576p.mp4',\n type: 'video/mp4',\n size: 576,\n },\n {\n src:\n 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-720p.mp4',\n type: 'video/mp4',\n size: 720,\n },\n {\n src:\n 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-1080p.mp4',\n type: 'video/mp4',\n size: 1080,\n },\n {\n src:\n 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-1440p.mp4',\n type: 'video/mp4',\n size: 1440,\n },\n ],\n poster:\n 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.jpg',\n tracks: [\n {\n kind: 'captions',\n label: 'English',\n srclang: 'en',\n src:\n 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.en.vtt',\n default: true,\n },\n {\n kind: 'captions',\n label: 'French',\n srclang: 'fr',\n src:\n 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.fr.vtt',\n },\n ],\n };\n\n break;\n\n case types.audio:\n player.source = {\n type: 'audio',\n title:\n 'Kishi Bashi – “It All Began With A Burst”',\n sources: [\n {\n src:\n 'https://cdn.plyr.io/static/demo/Kishi_Bashi_-_It_All_Began_With_a_Burst.mp3',\n type: 'audio/mp3',\n },\n {\n src:\n 'https://cdn.plyr.io/static/demo/Kishi_Bashi_-_It_All_Began_With_a_Burst.ogg',\n type: 'audio/ogg',\n },\n ],\n };\n\n break;\n\n case types.youtube:\n player.source = {\n type: 'video',\n sources: [\n {\n src:\n 'https://youtube.com/watch?v=bTqVqk7FSmY',\n provider: 'youtube',\n },\n ],\n };\n\n break;\n\n case types.vimeo:\n player.source = {\n type: 'video',\n sources: [\n {\n src: 'https://vimeo.com/76979871',\n provider: 'vimeo',\n },\n ],\n };\n\n break;\n\n default:\n break;\n }\n\n // Set the current type for next time\n currentType = type;\n\n // Remove active classes\n Array.from(buttons).forEach(button =>\n toggleClass(button.parentElement, 'active', false),\n );\n\n // Set active on parent\n toggleClass(\n document.querySelector(`[data-source=\"${type}\"]`),\n 'active',\n true,\n );\n\n // Show cite\n Array.from(document.querySelectorAll('.plyr__cite')).forEach(\n cite => {\n cite.setAttribute('hidden', '');\n },\n );\n document\n .querySelector(`.plyr__cite--${type}`)\n .removeAttribute('hidden');\n }\n\n // Bind to each button\n Array.from(buttons).forEach(button => {\n button.addEventListener('click', () => {\n const type = button.getAttribute('data-source');\n\n newSource(type);\n\n if (historySupport) {\n window.history.pushState({ type }, '', `#${type}`);\n }\n });\n });\n\n // List for backwards/forwards\n window.addEventListener('popstate', event => {\n if (event.state && 'type' in event.state) {\n newSource(event.state.type);\n }\n });\n\n // On load\n if (historySupport) {\n const video = !currentType.length;\n\n // If there's no current type set, assume video\n if (video) {\n currentType = types.video;\n }\n\n // Replace current history state\n if (currentType in types) {\n window.history.replaceState(\n {\n type: currentType,\n },\n '',\n video ? '' : `#${currentType}`,\n );\n }\n\n // If it's not video, load the source\n if (currentType !== types.video) {\n newSource(currentType, true);\n }\n }\n });\n });\n\n // Google analytics\n // For demo site (https://plyr.io) only\n /* eslint-disable */\n if (isLive) {\n (function(i, s, o, g, r, a, m) {\n i.GoogleAnalyticsObject = r;\n i[r] =\n i[r] ||\n function() {\n (i[r].q = i[r].q || []).push(arguments);\n };\n i[r].l = 1 * new Date();\n a = s.createElement(o);\n m = s.getElementsByTagName(o)[0];\n a.async = 1;\n a.src = g;\n m.parentNode.insertBefore(a, m);\n })(\n window,\n document,\n 'script',\n 'https://www.google-analytics.com/analytics.js',\n 'ga',\n );\n window.ga('create', 'UA-40881672-11', 'auto');\n window.ga('send', 'pageview');\n }\n /* eslint-enable */\n})();\n"]} \ No newline at end of file diff --git a/demo/dist/error.css b/demo/dist/error.css new file mode 100644 index 00000000..4898e3e7 --- /dev/null +++ b/demo/dist/error.css @@ -0,0 +1 @@ +@font-face{font-display:swap;font-family:Gordita;font-style:normal;font-weight:300;src:url(https://cdn.plyr.io/static/fonts/gordita-light.woff2) format("woff2"),url(https://cdn.plyr.io/static/fonts/gordita-light.woff) format("woff")}@font-face{font-display:swap;font-family:Gordita;font-style:normal;font-weight:400;src:url(https://cdn.plyr.io/static/fonts/gordita-regular.woff2) format("woff2"),url(https://cdn.plyr.io/static/fonts/gordita-regular.woff) format("woff")}@font-face{font-display:swap;font-family:Gordita;font-style:normal;font-weight:500;src:url(https://cdn.plyr.io/static/fonts/gordita-medium.woff2) format("woff2"),url(https://cdn.plyr.io/static/fonts/gordita-medium.woff) format("woff")}@font-face{font-display:swap;font-family:Gordita;font-style:normal;font-weight:600;src:url(https://cdn.plyr.io/static/fonts/gordita-bold.woff2) format("woff2"),url(https://cdn.plyr.io/static/fonts/gordita-bold.woff) format("woff")}@font-face{font-display:swap;font-family:Gordita;font-style:normal;font-weight:900;src:url(https://cdn.plyr.io/static/fonts/gordita-black.woff2) format("woff2"),url(https://cdn.plyr.io/static/fonts/gordita-black.woff) format("woff")}/*! normalize.css v7.0.0 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,footer,header,nav,section{display:block}h1{font-size:2em;margin:.67em 0}figcaption,figure,main{display:block}figure{margin:1em 40px}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a,button.faux-link{background-color:transparent;-webkit-text-decoration-skip:objects}abbr[title]{border-bottom:none;text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}b,strong{font-weight:inherit}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}dfn{font-style:italic}mark{background-color:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}audio,video{display:inline-block}audio:not([controls]){display:none;height:0}img{border-style:none}svg:not(:root){overflow:hidden}button,input,optgroup,select,textarea{font-family:sans-serif;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=reset],[type=submit],button,html [type=button]{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{display:inline-block;vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details,menu{display:block}summary{display:list-item}canvas{display:inline-block}template{display:none}[hidden]{display:none}*,::after,::before{box-sizing:border-box}.error body,html.error{height:100%}html.error{background:linear-gradient(to left top,#4dc1ff,#0074b3);background-attachment:fixed}.error body{align-items:center;display:flex;width:100%}.error main{padding:20px;text-align:center;width:100%}.error main p{font-size:18px;font-size:1.125rem}html{font-size:100%}body{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-size:15px;font-size:.9375rem;color:#fff;font-family:Gordita,Avenir,"Helvetica Neue",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-weight:500;line-height:1.75;text-shadow:0 1px 1px rgba(0,0,0,.15)}button,input,select,textarea{font:inherit}p,small{margin:0 0 20px}small{font-size:13px;font-size:.8125rem;display:block}h1{font-size:64px;font-size:4rem;font-weight:600;letter-spacing:-.025em;line-height:1.2;margin:0 0 20px}.button,.button__count{align-items:center;background:#fff;border:0;border-radius:4px;box-shadow:0 1px 1px rgba(0,0,0,.1);color:#55646b;display:inline-flex;padding:15px;position:relative;text-shadow:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:middle}.button{font-weight:600;padding-left:20px;padding-right:20px;transition:all .2s ease}.button:focus,.button:hover{color:#343f4a}.button:focus::after,.button:hover::after{display:none}.button:hover{box-shadow:0 2px 2px rgba(0,0,0,.1);transform:translateY(-1px)}.button:focus{outline:0}.button.tab-focus{box-shadow:0 0 0 3px rgba(255,255,255,.35);outline:0}.button:active{transform:translateY(1px)}.button--with-count{display:inline-flex}.button--with-count .button .icon{flex-shrink:0}.button__count{animation:fadein .2s ease;margin-left:10px}.button__count::before{border:5px solid transparent;border-left-width:0;border-right-color:#fff;content:'';height:0;position:absolute;right:100%;top:50%;transform:translateY(-50%);width:0}button.faux-link{background:0 0;border:0;border-radius:0;cursor:pointer;font:inherit;line-height:1.75;margin:0;padding:0;position:relative;text-align:inherit;text-shadow:inherit;-moz-user-select:text;vertical-align:baseline;width:auto}a,button.faux-link{border-bottom:1px dotted currentColor;color:#fff;font-weight:600;position:relative;text-decoration:none;transition:all .2s ease}a::after,button.faux-link::after{background:currentColor;content:'';height:1px;left:50%;position:absolute;top:100%;transform:translateX(-50%);transition:width .2s ease;width:0}a:focus,a:hover,button.faux-link:focus,button.faux-link:hover{border-bottom-color:transparent;outline:0}a:focus::after,a:hover::after,button.faux-link:focus::after,button.faux-link:hover::after{width:100%}a.tab-focus,button.tab-focus.faux-link{box-shadow:0 0 0 3px rgba(255,255,255,.35);outline:0}a.no-border::after,button.no-border.faux-link::after{display:none} \ No newline at end of file diff --git a/dist/plyr.css b/dist/plyr.css new file mode 100644 index 00000000..07593a0f --- /dev/null +++ b/dist/plyr.css @@ -0,0 +1 @@ +@keyframes plyr-progress{to{background-position:25px 0}}@keyframes plyr-popup{0%{opacity:.5;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes plyr-fade-in{from{opacity:0}to{opacity:1}}.plyr{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;direction:ltr;font-family:Avenir,"Avenir Next","Helvetica Neue","Segoe UI",Helvetica,Arial,sans-serif;font-variant-numeric:tabular-nums;font-weight:500;line-height:1.7;max-width:100%;min-width:200px;position:relative;text-shadow:none;transition:box-shadow .3s ease}.plyr audio,.plyr video{border-radius:inherit;height:auto;vertical-align:middle;width:100%}.plyr button{font:inherit;line-height:inherit;width:auto}.plyr:focus{outline:0}.plyr--full-ui{box-sizing:border-box}.plyr--full-ui *,.plyr--full-ui ::after,.plyr--full-ui ::before{box-sizing:inherit}.plyr--full-ui a,.plyr--full-ui button,.plyr--full-ui input,.plyr--full-ui label{touch-action:manipulation}.plyr__badge{background:#4f5b5f;border-radius:2px;color:#fff;font-size:9px;line-height:1;padding:3px 4px}.plyr--full-ui ::-webkit-media-text-track-container{display:none}.plyr__captions{animation:plyr-fade-in .3s ease;bottom:0;color:#fff;display:none;font-size:14px;left:0;padding:10px;position:absolute;text-align:center;transform:translateY(-40px);transition:transform .4s ease-in-out;width:100%}.plyr__captions .plyr__caption{background:rgba(0,0,0,.8);border-radius:2px;-webkit-box-decoration-break:clone;box-decoration-break:clone;line-height:185%;padding:.2em .5em;white-space:pre-wrap}.plyr__captions .plyr__caption div{display:inline}.plyr__captions span:empty{display:none}@media (min-width:480px){.plyr__captions{font-size:16px;padding:20px}}@media (min-width:768px){.plyr__captions{font-size:18px}}.plyr--captions-active .plyr__captions{display:block}.plyr--hide-controls .plyr__captions{transform:translateY(-15px)}.plyr__control{background:0 0;border:0;border-radius:3px;color:inherit;cursor:pointer;flex-shrink:0;overflow:visible;padding:7px;position:relative;transition:all .3s ease}.plyr__control svg{display:block;fill:currentColor;height:18px;pointer-events:none;width:18px}.plyr__control:focus{outline:0}.plyr__control.plyr__tab-focus{box-shadow:0 0 0 5px rgba(26,175,255,.5);outline:0}.plyr__control.plyr__control--pressed .icon--not-pressed,.plyr__control.plyr__control--pressed .label--not-pressed,.plyr__control:not(.plyr__control--pressed) .icon--pressed,.plyr__control:not(.plyr__control--pressed) .label--pressed{display:none}.plyr--audio .plyr__control.plyr__tab-focus,.plyr--audio .plyr__control:hover,.plyr--audio .plyr__control[aria-expanded=true]{background:#1aafff;color:#fff}.plyr__control--overlaid{background:rgba(26,175,255,.8);border:0;border-radius:100%;box-shadow:0 1px 1px rgba(0,0,0,.15);color:#fff;display:none;left:50%;padding:15px;position:absolute;top:50%;transform:translate(-50%,-50%);z-index:2}.plyr__control--overlaid svg{height:20px;left:2px;position:relative;width:20px}.plyr__control--overlaid:focus,.plyr__control--overlaid:hover{background:#1aafff}.plyr--playing .plyr__control--overlaid{opacity:0;visibility:hidden}.plyr--full-ui.plyr--video .plyr__control--overlaid{display:block}.plyr--full-ui ::-webkit-media-controls{display:none}.plyr__controls{align-items:center;display:flex;justify-content:flex-end;text-align:center}.plyr__controls .plyr__menu,.plyr__controls .plyr__progress,.plyr__controls .plyr__time,.plyr__controls>.plyr__control{margin-left:5px}.plyr__controls .plyr__menu:first-child,.plyr__controls .plyr__menu:first-child+[data-plyr=pause],.plyr__controls .plyr__progress:first-child,.plyr__controls .plyr__progress:first-child+[data-plyr=pause],.plyr__controls .plyr__time:first-child,.plyr__controls .plyr__time:first-child+[data-plyr=pause],.plyr__controls>.plyr__control:first-child,.plyr__controls>.plyr__control:first-child+[data-plyr=pause]{margin-left:0;margin-right:auto}.plyr__controls .plyr__volume{margin-left:5px}@media (min-width:480px){.plyr__controls .plyr__menu,.plyr__controls .plyr__progress,.plyr__controls .plyr__time,.plyr__controls>.plyr__control{margin-left:10px}.plyr__controls .plyr__menu+.plyr__control,.plyr__controls>.plyr__control+.plyr__control,.plyr__controls>.plyr__control+.plyr__menu{margin-left:5px}}.plyr--video .plyr__controls{background:linear-gradient(transparent,rgba(0,0,0,.7));border-bottom-left-radius:inherit;border-bottom-right-radius:inherit;bottom:0;color:#fff;left:0;padding:35px 10px 10px;position:absolute;right:0;transition:opacity .4s ease-in-out,transform .4s ease-in-out;z-index:2}.plyr--video .plyr__controls .plyr__control svg{-webkit-filter:drop-shadow(0 1px 1px rgba(0, 0, 0, .15));filter:drop-shadow(0 1px 1px rgba(0, 0, 0, .15))}.plyr--video .plyr__controls .plyr__control.plyr__tab-focus,.plyr--video .plyr__controls .plyr__control:hover,.plyr--video .plyr__controls .plyr__control[aria-expanded=true]{background:#1aafff;color:#fff}.plyr--audio .plyr__controls{background:#fff;border-radius:inherit;color:#4f5b5f;padding:10px}.plyr--video.plyr--hide-controls .plyr__controls{opacity:0;pointer-events:none;transform:translateY(100%)}.plyr [data-plyr=airplay],.plyr [data-plyr=captions],.plyr [data-plyr=fullscreen],.plyr [data-plyr=pip]{display:none}.plyr--airplay-supported [data-plyr=airplay],.plyr--captions-enabled [data-plyr=captions],.plyr--fullscreen-enabled [data-plyr=fullscreen],.plyr--pip-supported [data-plyr=pip]{display:inline-block}.plyr__controls:empty{display:none}.plyr__controls:empty~.plyr__captions{transform:translateY(0)}.plyr__video-embed{height:0;padding-bottom:56.25%;position:relative}.plyr__video-embed iframe{border:0;height:100%;left:0;position:absolute;top:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:100%}.plyr--full-ui .plyr__video-embed>.plyr__video-embed__container{padding-bottom:240%;position:relative;transform:translateY(-38.28125%)}.plyr__menu{display:flex;position:relative}.plyr__menu .plyr__control svg{transition:transform .3s ease}.plyr__menu .plyr__control[aria-expanded=true] svg{transform:rotate(90deg)}.plyr__menu .plyr__control[aria-expanded=true] .plyr__tooltip{display:none}.plyr__menu__container{animation:plyr-popup .2s ease;background:rgba(255,255,255,.9);border-radius:4px;bottom:100%;box-shadow:0 1px 2px rgba(0,0,0,.15);color:#4f5b5f;font-size:16px;margin-bottom:10px;position:absolute;right:-3px;text-align:left;white-space:nowrap;z-index:3}.plyr__menu__container>div{overflow:hidden;transition:height .35s cubic-bezier(.4,0,.2,1),width .35s cubic-bezier(.4,0,.2,1)}.plyr__menu__container::after{border:4px solid transparent;border-top-color:rgba(255,255,255,.9);content:'';height:0;position:absolute;right:15px;top:100%;width:0}.plyr__menu__container [role=menu]{padding:7px}.plyr__menu__container [role=menuitem],.plyr__menu__container [role=menuitemradio]{margin-top:2px}.plyr__menu__container [role=menuitem]:first-child,.plyr__menu__container [role=menuitemradio]:first-child{margin-top:0}.plyr__menu__container .plyr__control{align-items:center;color:#4f5b5f;display:flex;font-size:14px;padding:4px 11px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:100%}.plyr__menu__container .plyr__control>span{align-items:inherit;display:flex;width:100%}.plyr__menu__container .plyr__control::after{border:4px solid transparent;content:'';position:absolute;top:50%;transform:translateY(-50%)}.plyr__menu__container .plyr__control--forward{padding-right:28px}.plyr__menu__container .plyr__control--forward::after{border-left-color:rgba(79,91,95,.8);right:5px}.plyr__menu__container .plyr__control--forward.plyr__tab-focus::after,.plyr__menu__container .plyr__control--forward:hover::after{border-left-color:currentColor}.plyr__menu__container .plyr__control--back{font-weight:500;margin:7px;margin-bottom:3px;padding-left:28px;position:relative;width:calc(100% - 14px)}.plyr__menu__container .plyr__control--back::after{border-right-color:rgba(79,91,95,.8);left:7px}.plyr__menu__container .plyr__control--back::before{background:#b7c5cd;box-shadow:0 1px 0 #fff;content:'';height:1px;left:0;margin-top:4px;overflow:hidden;position:absolute;right:0;top:100%}.plyr__menu__container .plyr__control--back.plyr__tab-focus::after,.plyr__menu__container .plyr__control--back:hover::after{border-right-color:currentColor}.plyr__menu__container .plyr__control[role=menuitemradio]{padding-left:7px}.plyr__menu__container .plyr__control[role=menuitemradio]::after,.plyr__menu__container .plyr__control[role=menuitemradio]::before{border-radius:100%}.plyr__menu__container .plyr__control[role=menuitemradio]::before{background:rgba(0,0,0,.1);content:'';display:block;flex-shrink:0;height:16px;margin-right:10px;transition:all .3s ease;width:16px}.plyr__menu__container .plyr__control[role=menuitemradio]::after{background:#fff;border:0;height:6px;left:12px;opacity:0;top:50%;transform:translateY(-50%) scale(0);transition:transform .3s ease,opacity .3s ease;width:6px}.plyr__menu__container .plyr__control[role=menuitemradio][aria-checked=true]::before{background:#1aafff}.plyr__menu__container .plyr__control[role=menuitemradio][aria-checked=true]::after{opacity:1;transform:translateY(-50%) scale(1)}.plyr__menu__container .plyr__control[role=menuitemradio].plyr__tab-focus::before,.plyr__menu__container .plyr__control[role=menuitemradio]:hover::before{background:rgba(0,0,0,.1)}.plyr__menu__container .plyr__menu__value{align-items:center;display:flex;margin-left:auto;margin-right:-5px;overflow:hidden;padding-left:25px;pointer-events:none}.plyr--full-ui input[type=range]{-webkit-appearance:none;background:0 0;border:0;border-radius:28px;color:#1aafff;display:block;height:20px;margin:0;padding:0;transition:box-shadow .3s ease;width:100%}.plyr--full-ui input[type=range]::-webkit-slider-runnable-track{background:0 0;border:0;border-radius:3px;height:6px;-webkit-user-select:none;user-select:none;background-image:linear-gradient(to right,currentColor var(--value,0),transparent var(--value,0))}.plyr--full-ui input[type=range]::-webkit-slider-thumb{background:#fff;border:0;border-radius:100%;box-shadow:0 1px 1px rgba(0,0,0,.15),0 0 0 1px rgba(47,52,61,.2);height:14px;position:relative;transition:all .2s ease;width:14px;-webkit-appearance:none;margin-top:-4px}.plyr--full-ui input[type=range]::-moz-range-track{background:0 0;border:0;border-radius:3px;height:6px;-moz-user-select:none;user-select:none}.plyr--full-ui input[type=range]::-moz-range-thumb{background:#fff;border:0;border-radius:100%;box-shadow:0 1px 1px rgba(0,0,0,.15),0 0 0 1px rgba(47,52,61,.2);height:14px;position:relative;transition:all .2s ease;width:14px}.plyr--full-ui input[type=range]::-moz-range-progress{background:currentColor;border-radius:3px;height:6px}.plyr--full-ui input[type=range]::-ms-track{background:0 0;border:0;border-radius:3px;height:6px;-ms-user-select:none;user-select:none;color:transparent}.plyr--full-ui input[type=range]::-ms-fill-upper{background:0 0;border:0;border-radius:3px;height:6px;-ms-user-select:none;user-select:none}.plyr--full-ui input[type=range]::-ms-fill-lower{background:0 0;border:0;border-radius:3px;height:6px;-ms-user-select:none;user-select:none;background:currentColor}.plyr--full-ui input[type=range]::-ms-thumb{background:#fff;border:0;border-radius:100%;box-shadow:0 1px 1px rgba(0,0,0,.15),0 0 0 1px rgba(47,52,61,.2);height:14px;position:relative;transition:all .2s ease;width:14px;margin-top:0}.plyr--full-ui input[type=range]::-ms-tooltip{display:none}.plyr--full-ui input[type=range]:focus{outline:0}.plyr--full-ui input[type=range]::-moz-focus-outer{border:0}.plyr--full-ui input[type=range].plyr__tab-focus::-webkit-slider-runnable-track{box-shadow:0 0 0 5px rgba(26,175,255,.5);outline:0}.plyr--full-ui input[type=range].plyr__tab-focus::-moz-range-track{box-shadow:0 0 0 5px rgba(26,175,255,.5);outline:0}.plyr--full-ui input[type=range].plyr__tab-focus::-ms-track{box-shadow:0 0 0 5px rgba(26,175,255,.5);outline:0}.plyr--full-ui.plyr--video input[type=range]::-webkit-slider-runnable-track{background-color:rgba(255,255,255,.25)}.plyr--full-ui.plyr--video input[type=range]::-moz-range-track{background-color:rgba(255,255,255,.25)}.plyr--full-ui.plyr--video input[type=range]::-ms-track{background-color:rgba(255,255,255,.25)}.plyr--full-ui.plyr--video input[type=range]:active::-webkit-slider-thumb{box-shadow:0 1px 1px rgba(0,0,0,.15),0 0 0 1px rgba(47,52,61,.2),0 0 0 3px rgba(255,255,255,.5)}.plyr--full-ui.plyr--video input[type=range]:active::-moz-range-thumb{box-shadow:0 1px 1px rgba(0,0,0,.15),0 0 0 1px rgba(47,52,61,.2),0 0 0 3px rgba(255,255,255,.5)}.plyr--full-ui.plyr--video input[type=range]:active::-ms-thumb{box-shadow:0 1px 1px rgba(0,0,0,.15),0 0 0 1px rgba(47,52,61,.2),0 0 0 3px rgba(255,255,255,.5)}.plyr--full-ui.plyr--audio input[type=range]::-webkit-slider-runnable-track{background-color:rgba(183,197,205,.66)}.plyr--full-ui.plyr--audio input[type=range]::-moz-range-track{background-color:rgba(183,197,205,.66)}.plyr--full-ui.plyr--audio input[type=range]::-ms-track{background-color:rgba(183,197,205,.66)}.plyr--full-ui.plyr--audio input[type=range]:active::-webkit-slider-thumb{box-shadow:0 1px 1px rgba(0,0,0,.15),0 0 0 1px rgba(47,52,61,.2),0 0 0 3px rgba(0,0,0,.1)}.plyr--full-ui.plyr--audio input[type=range]:active::-moz-range-thumb{box-shadow:0 1px 1px rgba(0,0,0,.15),0 0 0 1px rgba(47,52,61,.2),0 0 0 3px rgba(0,0,0,.1)}.plyr--full-ui.plyr--audio input[type=range]:active::-ms-thumb{box-shadow:0 1px 1px rgba(0,0,0,.15),0 0 0 1px rgba(47,52,61,.2),0 0 0 3px rgba(0,0,0,.1)}.plyr__poster{background-color:#000;background-position:50% 50%;background-repeat:no-repeat;background-size:contain;display:none;height:100%;left:0;pointer-events:none;position:absolute;top:0;width:100%;z-index:1}.plyr--stopped.plyr__poster-enabled .plyr__poster{display:block}.plyr__time{font-size:14px}.plyr__time+.plyr__time::before{content:'\2044';margin-right:10px}@media (max-width:767px){.plyr__time+.plyr__time{display:none}}.plyr--video .plyr__time{text-shadow:0 1px 1px rgba(0,0,0,.15)}.plyr__tooltip{background:rgba(255,255,255,.9);border-radius:3px;bottom:100%;box-shadow:0 1px 2px rgba(0,0,0,.15);color:#4f5b5f;font-size:14px;font-weight:500;line-height:1.3;margin-bottom:10px;opacity:0;padding:5px 7.5px;pointer-events:none;position:absolute;transform:translate(-50%,10px) scale(.8);transform-origin:50% 100%;transition:transform .2s .1s ease,opacity .2s .1s ease;white-space:nowrap;z-index:2}.plyr__tooltip::before{border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid rgba(255,255,255,.9);bottom:-4px;content:'';height:0;left:50%;position:absolute;transform:translateX(-50%);width:0;z-index:2}.plyr .plyr__control.plyr__tab-focus .plyr__tooltip,.plyr .plyr__control:hover .plyr__tooltip,.plyr__tooltip--visible{opacity:1;transform:translate(-50%,0) scale(1)}.plyr .plyr__control:hover .plyr__tooltip{z-index:3}.plyr__controls>.plyr__control:first-child .plyr__tooltip,.plyr__controls>.plyr__control:first-child+.plyr__control .plyr__tooltip{left:0;transform:translate(0,10px) scale(.8);transform-origin:0 100%}.plyr__controls>.plyr__control:first-child .plyr__tooltip::before,.plyr__controls>.plyr__control:first-child+.plyr__control .plyr__tooltip::before{left:16px}.plyr__controls>.plyr__control:last-child .plyr__tooltip{right:0;transform:translate(0,10px) scale(.8);transform-origin:100% 100%}.plyr__controls>.plyr__control:last-child .plyr__tooltip::before{left:auto;right:16px;transform:translateX(50%)}.plyr__controls>.plyr__control:first-child .plyr__tooltip--visible,.plyr__controls>.plyr__control:first-child+.plyr__control .plyr__tooltip--visible,.plyr__controls>.plyr__control:first-child+.plyr__control.plyr__tab-focus .plyr__tooltip,.plyr__controls>.plyr__control:first-child+.plyr__control:hover .plyr__tooltip,.plyr__controls>.plyr__control:first-child.plyr__tab-focus .plyr__tooltip,.plyr__controls>.plyr__control:first-child:hover .plyr__tooltip,.plyr__controls>.plyr__control:last-child .plyr__tooltip--visible,.plyr__controls>.plyr__control:last-child.plyr__tab-focus .plyr__tooltip,.plyr__controls>.plyr__control:last-child:hover .plyr__tooltip{transform:translate(0,0) scale(1)}.plyr--video{overflow:hidden}.plyr--video.plyr--menu-open{overflow:visible}.plyr__video-wrapper{background:#000;border-radius:inherit;overflow:hidden;position:relative;z-index:0}.plyr__progress{flex:1;left:7px;margin-right:14px;position:relative}.plyr__progress input[type=range],.plyr__progress__buffer{margin-left:-7px;margin-right:-7px;width:calc(100% + 14px)}.plyr__progress input[type=range]{position:relative;z-index:2}.plyr__progress .plyr__tooltip{font-size:14px;left:0}.plyr__progress__buffer{-webkit-appearance:none;background:0 0;border:0;border-radius:100px;height:6px;left:0;margin-top:-3px;padding:0;position:absolute;top:50%}.plyr__progress__buffer::-webkit-progress-bar{background:0 0;transition:width .2s ease}.plyr__progress__buffer::-webkit-progress-value{background:currentColor;border-radius:100px;min-width:6px}.plyr__progress__buffer::-moz-progress-bar{background:currentColor;border-radius:100px;min-width:6px;transition:width .2s ease}.plyr__progress__buffer::-ms-fill{border-radius:100px;transition:width .2s ease}.plyr--video .plyr__progress__buffer{box-shadow:0 1px 1px rgba(0,0,0,.15);color:rgba(255,255,255,.25)}.plyr--audio .plyr__progress__buffer{color:rgba(183,197,205,.66)}.plyr--loading .plyr__progress__buffer{animation:plyr-progress 1s linear infinite;background-image:linear-gradient(-45deg,rgba(47,52,61,.6) 25%,transparent 25%,transparent 50%,rgba(47,52,61,.6) 50%,rgba(47,52,61,.6) 75%,transparent 75%,transparent);background-repeat:repeat-x;background-size:25px 25px;color:transparent}.plyr--video.plyr--loading .plyr__progress__buffer{background-color:rgba(255,255,255,.25)}.plyr--audio.plyr--loading .plyr__progress__buffer{background-color:rgba(183,197,205,.66)}.plyr__volume{flex:1;position:relative}.plyr__volume input[type=range]{position:relative;z-index:2}@media (min-width:480px){.plyr__volume{max-width:50px}}@media (min-width:768px){.plyr__volume{max-width:80px}}.plyr--is-ios .plyr__volume{display:none!important}.plyr--is-ios.plyr--vimeo [data-plyr=mute]{display:none!important}.plyr:-webkit-full-screen{background:#000;border-radius:0!important;height:100%;margin:0;width:100%}.plyr:-moz-full-screen{background:#000;border-radius:0!important;height:100%;margin:0;width:100%}.plyr:-ms-fullscreen{background:#000;border-radius:0!important;height:100%;margin:0;width:100%}.plyr:fullscreen{background:#000;border-radius:0!important;height:100%;margin:0;width:100%}.plyr:-webkit-full-screen video{height:100%}.plyr:-moz-full-screen video{height:100%}.plyr:-ms-fullscreen video{height:100%}.plyr:fullscreen video{height:100%}.plyr:-webkit-full-screen .plyr__video-wrapper{height:100%;width:100%}.plyr:-moz-full-screen .plyr__video-wrapper{height:100%;width:100%}.plyr:-ms-fullscreen .plyr__video-wrapper{height:100%;width:100%}.plyr:fullscreen .plyr__video-wrapper{height:100%;width:100%}.plyr:-webkit-full-screen .plyr__video-embed{overflow:visible}.plyr:-moz-full-screen .plyr__video-embed{overflow:visible}.plyr:-ms-fullscreen .plyr__video-embed{overflow:visible}.plyr:fullscreen .plyr__video-embed{overflow:visible}.plyr:-webkit-full-screen.plyr--vimeo .plyr__video-wrapper{height:0;top:50%;transform:translateY(-50%)}.plyr:-moz-full-screen.plyr--vimeo .plyr__video-wrapper{height:0;top:50%;transform:translateY(-50%)}.plyr:-ms-fullscreen.plyr--vimeo .plyr__video-wrapper{height:0;top:50%;transform:translateY(-50%)}.plyr:fullscreen.plyr--vimeo .plyr__video-wrapper{height:0;top:50%;transform:translateY(-50%)}.plyr:-webkit-full-screen .plyr__control .icon--exit-fullscreen{display:block}.plyr:-moz-full-screen .plyr__control .icon--exit-fullscreen{display:block}.plyr:-ms-fullscreen .plyr__control .icon--exit-fullscreen{display:block}.plyr:fullscreen .plyr__control .icon--exit-fullscreen{display:block}.plyr:-webkit-full-screen .plyr__control .icon--exit-fullscreen+svg{display:none}.plyr:-moz-full-screen .plyr__control .icon--exit-fullscreen+svg{display:none}.plyr:-ms-fullscreen .plyr__control .icon--exit-fullscreen+svg{display:none}.plyr:fullscreen .plyr__control .icon--exit-fullscreen+svg{display:none}.plyr:-webkit-full-screen.plyr--hide-controls{cursor:none}.plyr:-moz-full-screen.plyr--hide-controls{cursor:none}.plyr:-ms-fullscreen.plyr--hide-controls{cursor:none}.plyr:fullscreen.plyr--hide-controls{cursor:none}@media (min-width:1024px){.plyr:-webkit-full-screen .plyr__captions{font-size:21px}.plyr:-moz-full-screen .plyr__captions{font-size:21px}.plyr:-ms-fullscreen .plyr__captions{font-size:21px}.plyr:fullscreen .plyr__captions{font-size:21px}}.plyr:-webkit-full-screen{background:#000;border-radius:0!important;height:100%;margin:0;width:100%}.plyr:-webkit-full-screen video{height:100%}.plyr:-webkit-full-screen .plyr__video-wrapper{height:100%;width:100%}.plyr:-webkit-full-screen .plyr__video-embed{overflow:visible}.plyr:-webkit-full-screen.plyr--vimeo .plyr__video-wrapper{height:0;top:50%;transform:translateY(-50%)}.plyr:-webkit-full-screen .plyr__control .icon--exit-fullscreen{display:block}.plyr:-webkit-full-screen .plyr__control .icon--exit-fullscreen+svg{display:none}.plyr:-webkit-full-screen.plyr--hide-controls{cursor:none}@media (min-width:1024px){.plyr:-webkit-full-screen .plyr__captions{font-size:21px}}.plyr:-moz-full-screen{background:#000;border-radius:0!important;height:100%;margin:0;width:100%}.plyr:-moz-full-screen video{height:100%}.plyr:-moz-full-screen .plyr__video-wrapper{height:100%;width:100%}.plyr:-moz-full-screen .plyr__video-embed{overflow:visible}.plyr:-moz-full-screen.plyr--vimeo .plyr__video-wrapper{height:0;top:50%;transform:translateY(-50%)}.plyr:-moz-full-screen .plyr__control .icon--exit-fullscreen{display:block}.plyr:-moz-full-screen .plyr__control .icon--exit-fullscreen+svg{display:none}.plyr:-moz-full-screen.plyr--hide-controls{cursor:none}@media (min-width:1024px){.plyr:-moz-full-screen .plyr__captions{font-size:21px}}.plyr:-ms-fullscreen{background:#000;border-radius:0!important;height:100%;margin:0;width:100%}.plyr:-ms-fullscreen video{height:100%}.plyr:-ms-fullscreen .plyr__video-wrapper{height:100%;width:100%}.plyr:-ms-fullscreen .plyr__video-embed{overflow:visible}.plyr:-ms-fullscreen.plyr--vimeo .plyr__video-wrapper{height:0;top:50%;transform:translateY(-50%)}.plyr:-ms-fullscreen .plyr__control .icon--exit-fullscreen{display:block}.plyr:-ms-fullscreen .plyr__control .icon--exit-fullscreen+svg{display:none}.plyr:-ms-fullscreen.plyr--hide-controls{cursor:none}@media (min-width:1024px){.plyr:-ms-fullscreen .plyr__captions{font-size:21px}}.plyr--fullscreen-fallback{background:#000;border-radius:0!important;height:100%;margin:0;width:100%;bottom:0;left:0;position:fixed;right:0;top:0;z-index:10000000}.plyr--fullscreen-fallback video{height:100%}.plyr--fullscreen-fallback .plyr__video-wrapper{height:100%;width:100%}.plyr--fullscreen-fallback .plyr__video-embed{overflow:visible}.plyr--fullscreen-fallback.plyr--vimeo .plyr__video-wrapper{height:0;top:50%;transform:translateY(-50%)}.plyr--fullscreen-fallback .plyr__control .icon--exit-fullscreen{display:block}.plyr--fullscreen-fallback .plyr__control .icon--exit-fullscreen+svg{display:none}.plyr--fullscreen-fallback.plyr--hide-controls{cursor:none}@media (min-width:1024px){.plyr--fullscreen-fallback .plyr__captions{font-size:21px}}.plyr__ads{border-radius:inherit;bottom:0;cursor:pointer;left:0;overflow:hidden;position:absolute;right:0;top:0;z-index:-1}.plyr__ads>div,.plyr__ads>div iframe{height:100%;position:absolute;width:100%}.plyr__ads::after{background:rgba(47,52,61,.8);border-radius:2px;bottom:10px;color:#fff;content:attr(data-badge-text);font-size:11px;padding:2px 6px;pointer-events:none;position:absolute;right:10px;z-index:3}.plyr__ads::after:empty{display:none}.plyr__cues{background:currentColor;display:block;height:6px;left:0;margin:-3px 0 0;opacity:.8;position:absolute;top:50%;width:3px;z-index:3}.plyr--no-transition{transition:none!important}.plyr__sr-only{clip:rect(1px,1px,1px,1px);overflow:hidden;border:0!important;height:1px!important;padding:0!important;position:absolute!important;width:1px!important}.plyr [hidden]{display:none!important} \ No newline at end of file diff --git a/dist/plyr.js b/dist/plyr.js new file mode 100644 index 00000000..bf61dad3 --- /dev/null +++ b/dist/plyr.js @@ -0,0 +1,8409 @@ +typeof navigator === "object" && (function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define('Plyr', factory) : + (global.Plyr = factory()); +}(this, (function () { 'use strict'; + + // ========================================================================== + // Type checking utils + // ========================================================================== + + var getConstructor = function getConstructor(input) { + return input !== null && typeof input !== 'undefined' ? input.constructor : null; + }; + var instanceOf = function instanceOf(input, constructor) { + return Boolean(input && constructor && input instanceof constructor); + }; + var isNullOrUndefined = function isNullOrUndefined(input) { + return input === null || typeof input === 'undefined'; + }; + var isObject = function isObject(input) { + return getConstructor(input) === Object; + }; + var isNumber = function isNumber(input) { + return getConstructor(input) === Number && !Number.isNaN(input); + }; + var isString = function isString(input) { + return getConstructor(input) === String; + }; + var isBoolean = function isBoolean(input) { + return getConstructor(input) === Boolean; + }; + var isFunction = function isFunction(input) { + return getConstructor(input) === Function; + }; + var isArray = function isArray(input) { + return Array.isArray(input); + }; + var isWeakMap = function isWeakMap(input) { + return instanceOf(input, WeakMap); + }; + var isNodeList = function isNodeList(input) { + return instanceOf(input, NodeList); + }; + var isElement = function isElement(input) { + return instanceOf(input, Element); + }; + var isTextNode = function isTextNode(input) { + return getConstructor(input) === Text; + }; + var isEvent = function isEvent(input) { + return instanceOf(input, Event); + }; + var isCue = function isCue(input) { + return instanceOf(input, window.TextTrackCue) || instanceOf(input, window.VTTCue); + }; + var isTrack = function isTrack(input) { + return instanceOf(input, TextTrack) || !isNullOrUndefined(input) && isString(input.kind); + }; + + var isEmpty = function isEmpty(input) { + return isNullOrUndefined(input) || (isString(input) || isArray(input) || isNodeList(input)) && !input.length || isObject(input) && !Object.keys(input).length; + }; + + var isUrl = function isUrl(input) { + // Accept a URL object + if (instanceOf(input, window.URL)) { + return true; + } + + // Add the protocol if required + var string = input; + if (!input.startsWith('http://') || !input.startsWith('https://')) { + string = 'http://' + input; + } + + try { + return !isEmpty(new URL(string).hostname); + } catch (e) { + return false; + } + }; + + var is = { + nullOrUndefined: isNullOrUndefined, + object: isObject, + number: isNumber, + string: isString, + boolean: isBoolean, + function: isFunction, + array: isArray, + weakMap: isWeakMap, + nodeList: isNodeList, + element: isElement, + textNode: isTextNode, + event: isEvent, + cue: isCue, + track: isTrack, + url: isUrl, + empty: isEmpty + }; + + // ========================================================================== + + // Check for passive event listener support + // https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md + // https://www.youtube.com/watch?v=NPM6172J22g + var supportsPassiveListeners = function () { + // Test via a getter in the options object to see if the passive property is accessed + var supported = false; + try { + var options = Object.defineProperty({}, 'passive', { + get: function get() { + supported = true; + return null; + } + }); + window.addEventListener('test', null, options); + window.removeEventListener('test', null, options); + } catch (e) { + // Do nothing + } + + return supported; + }(); + + // Toggle event listener + function toggleListener(element, event, callback) { + var toggle = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; + + var _this = this; + + var passive = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true; + var capture = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false; + + // Bail if no element, event, or callback + if (!element || !('addEventListener' in element) || is.empty(event) || !is.function(callback)) { + return; + } + + // Allow multiple events + var events = event.split(' '); + + // Build options + // Default to just the capture boolean for browsers with no passive listener support + var options = capture; + + // If passive events listeners are supported + if (supportsPassiveListeners) { + options = { + // Whether the listener can be passive (i.e. default never prevented) + passive: passive, + // Whether the listener is a capturing listener or not + capture: capture + }; + } + + // If a single node is passed, bind the event listener + events.forEach(function (type) { + if (_this && _this.eventListeners && toggle) { + // Cache event listener + _this.eventListeners.push({ element: element, type: type, callback: callback, options: options }); + } + + element[toggle ? 'addEventListener' : 'removeEventListener'](type, callback, options); + }); + } + + // Bind event handler + function on(element) { + var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + var callback = arguments[2]; + var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; + var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; + + toggleListener.call(this, element, events, callback, true, passive, capture); + } + + // Unbind event handler + function off(element) { + var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + var callback = arguments[2]; + var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; + var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; + + toggleListener.call(this, element, events, callback, false, passive, capture); + } + + // Bind once-only event handler + function once(element) { + var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + var callback = arguments[2]; + var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; + var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; + + function onceCallback() { + off(element, events, onceCallback, passive, capture); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + callback.apply(this, args); + } + + toggleListener.call(this, element, events, onceCallback, true, passive, capture); + } + + // Trigger event + function triggerEvent(element) { + var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + var bubbles = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var detail = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; + + // Bail if no element + if (!is.element(element) || is.empty(type)) { + return; + } + + // Create and dispatch the event + var event = new CustomEvent(type, { + bubbles: bubbles, + detail: Object.assign({}, detail, { + plyr: this + }) + }); + + // Dispatch the event + element.dispatchEvent(event); + } + + // Unbind all cached event listeners + function unbindListeners() { + if (this && this.eventListeners) { + this.eventListeners.forEach(function (item) { + var element = item.element, + type = item.type, + callback = item.callback, + options = item.options; + + element.removeEventListener(type, callback, options); + }); + + this.eventListeners = []; + } + } + + // Run method when / if player is ready + function ready() { + var _this2 = this; + + return new Promise(function (resolve) { + return _this2.ready ? setTimeout(resolve, 0) : on.call(_this2, _this2.elements.container, 'ready', resolve); + }).then(function () {}); + } + + var classCallCheck = function (instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + }; + + var createClass = function () { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + + return function (Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; + }(); + + var defineProperty = function (obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + + return obj; + }; + + var slicedToArray = function () { + function sliceIterator(arr, i) { + var _arr = []; + var _n = true; + var _d = false; + var _e = undefined; + + try { + for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { + _arr.push(_s.value); + + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally { + try { + if (!_n && _i["return"]) _i["return"](); + } finally { + if (_d) throw _e; + } + } + + return _arr; + } + + return function (arr, i) { + if (Array.isArray(arr)) { + return arr; + } else if (Symbol.iterator in Object(arr)) { + return sliceIterator(arr, i); + } else { + throw new TypeError("Invalid attempt to destructure non-iterable instance"); + } + }; + }(); + + var toConsumableArray = function (arr) { + if (Array.isArray(arr)) { + for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; + + return arr2; + } else { + return Array.from(arr); + } + }; + + // ========================================================================== + + // Wrap an element + function wrap(elements, wrapper) { + // Convert `elements` to an array, if necessary. + var targets = elements.length ? elements : [elements]; + + // Loops backwards to prevent having to clone the wrapper on the + // first element (see `child` below). + Array.from(targets).reverse().forEach(function (element, index) { + var child = index > 0 ? wrapper.cloneNode(true) : wrapper; + + // Cache the current parent and sibling. + var parent = element.parentNode; + var sibling = element.nextSibling; + + // Wrap the element (is automatically removed from its current + // parent). + child.appendChild(element); + + // If the element had a sibling, insert the wrapper before + // the sibling to maintain the HTML structure; otherwise, just + // append it to the parent. + if (sibling) { + parent.insertBefore(child, sibling); + } else { + parent.appendChild(child); + } + }); + } + + // Set attributes + function setAttributes(element, attributes) { + if (!is.element(element) || is.empty(attributes)) { + return; + } + + // Assume null and undefined attributes should be left out, + // Setting them would otherwise convert them to "null" and "undefined" + Object.entries(attributes).filter(function (_ref) { + var _ref2 = slicedToArray(_ref, 2), + value = _ref2[1]; + + return !is.nullOrUndefined(value); + }).forEach(function (_ref3) { + var _ref4 = slicedToArray(_ref3, 2), + key = _ref4[0], + value = _ref4[1]; + + return element.setAttribute(key, value); + }); + } + + // Create a DocumentFragment + function createElement(type, attributes, text) { + // Create a new + var element = document.createElement(type); + + // Set all passed attributes + if (is.object(attributes)) { + setAttributes(element, attributes); + } + + // Add text node + if (is.string(text)) { + element.innerText = text; + } + + // Return built element + return element; + } + + // Inaert an element after another + function insertAfter(element, target) { + if (!is.element(element) || !is.element(target)) { + return; + } + + target.parentNode.insertBefore(element, target.nextSibling); + } + + // Insert a DocumentFragment + function insertElement(type, parent, attributes, text) { + if (!is.element(parent)) { + return; + } + + parent.appendChild(createElement(type, attributes, text)); + } + + // Remove element(s) + function removeElement(element) { + if (is.nodeList(element) || is.array(element)) { + Array.from(element).forEach(removeElement); + return; + } + + if (!is.element(element) || !is.element(element.parentNode)) { + return; + } + + element.parentNode.removeChild(element); + } + + // Remove all child elements + function emptyElement(element) { + if (!is.element(element)) { + return; + } + + var length = element.childNodes.length; + + + while (length > 0) { + element.removeChild(element.lastChild); + length -= 1; + } + } + + // Replace element + function replaceElement(newChild, oldChild) { + if (!is.element(oldChild) || !is.element(oldChild.parentNode) || !is.element(newChild)) { + return null; + } + + oldChild.parentNode.replaceChild(newChild, oldChild); + + return newChild; + } + + // Get an attribute object from a string selector + function getAttributesFromSelector(sel, existingAttributes) { + // For example: + // '.test' to { class: 'test' } + // '#test' to { id: 'test' } + // '[data-test="test"]' to { 'data-test': 'test' } + + if (!is.string(sel) || is.empty(sel)) { + return {}; + } + + var attributes = {}; + var existing = existingAttributes; + + sel.split(',').forEach(function (s) { + // Remove whitespace + var selector = s.trim(); + var className = selector.replace('.', ''); + var stripped = selector.replace(/[[\]]/g, ''); + + // Get the parts and value + var parts = stripped.split('='); + var key = parts[0]; + var value = parts.length > 1 ? parts[1].replace(/["']/g, '') : ''; + + // Get the first character + var start = selector.charAt(0); + + switch (start) { + case '.': + // Add to existing classname + if (is.object(existing) && is.string(existing.class)) { + existing.class += ' ' + className; + } + + attributes.class = className; + break; + + case '#': + // ID selector + attributes.id = selector.replace('#', ''); + break; + + case '[': + // Attribute selector + attributes[key] = value; + + break; + + default: + break; + } + }); + + return attributes; + } + + // Toggle hidden + function toggleHidden(element, hidden) { + if (!is.element(element)) { + return; + } + + var hide = hidden; + + if (!is.boolean(hide)) { + hide = !element.hasAttribute('hidden'); + } + + if (hide) { + element.setAttribute('hidden', ''); + } else { + element.removeAttribute('hidden'); + } + } + + // Mirror Element.classList.toggle, with IE compatibility for "force" argument + function toggleClass(element, className, force) { + if (is.nodeList(element)) { + return Array.from(element).map(function (e) { + return toggleClass(e, className, force); + }); + } + + if (is.element(element)) { + var method = 'toggle'; + if (typeof force !== 'undefined') { + method = force ? 'add' : 'remove'; + } + + element.classList[method](className); + return element.classList.contains(className); + } + + return false; + } + + // Has class name + function hasClass(element, className) { + return is.element(element) && element.classList.contains(className); + } + + // Element matches selector + function matches(element, selector) { + var prototype = { Element: Element }; + + function match() { + return Array.from(document.querySelectorAll(selector)).includes(this); + } + + var matches = prototype.matches || prototype.webkitMatchesSelector || prototype.mozMatchesSelector || prototype.msMatchesSelector || match; + + return matches.call(element, selector); + } + + // Find all elements + function getElements(selector) { + return this.elements.container.querySelectorAll(selector); + } + + // Find a single element + function getElement(selector) { + return this.elements.container.querySelector(selector); + } + + // Trap focus inside container + function trapFocus() { + var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + var toggle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + + if (!is.element(element)) { + return; + } + + var focusable = getElements.call(this, 'button:not(:disabled), input:not(:disabled), [tabindex]'); + var first = focusable[0]; + var last = focusable[focusable.length - 1]; + + var trap = function trap(event) { + // Bail if not tab key or not fullscreen + if (event.key !== 'Tab' || event.keyCode !== 9) { + return; + } + + // Get the current focused element + var focused = document.activeElement; + + if (focused === last && !event.shiftKey) { + // Move focus to first element that can be tabbed if Shift isn't used + first.focus(); + event.preventDefault(); + } else if (focused === first && event.shiftKey) { + // Move focus to last element that can be tabbed if Shift is used + last.focus(); + event.preventDefault(); + } + }; + + toggleListener.call(this, this.elements.container, 'keydown', trap, toggle, false); + } + + // Set focus and tab focus class + function setFocus() { + var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + var tabFocus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + + if (!is.element(element)) { + return; + } + + // Set regular focus + element.focus(); + + // If we want to mimic keyboard focus via tab + if (tabFocus) { + toggleClass(element, this.config.classNames.tabFocus); + } + } + + // ========================================================================== + + var transitionEndEvent = function () { + var element = document.createElement('span'); + + var events = { + WebkitTransition: 'webkitTransitionEnd', + MozTransition: 'transitionend', + OTransition: 'oTransitionEnd otransitionend', + transition: 'transitionend' + }; + + var type = Object.keys(events).find(function (event) { + return element.style[event] !== undefined; + }); + + return is.string(type) ? events[type] : false; + }(); + + // Force repaint of element + function repaint(element) { + setTimeout(function () { + try { + toggleHidden(element, true); + element.offsetHeight; // eslint-disable-line + toggleHidden(element, false); + } catch (e) { + // Do nothing + } + }, 0); + } + + // ========================================================================== + // Browser sniffing + // Unfortunately, due to mixed support, UA sniffing is required + // ========================================================================== + + var browser = { + isIE: /* @cc_on!@ */!!document.documentMode, + isWebkit: 'WebkitAppearance' in document.documentElement.style && !/Edge/.test(navigator.userAgent), + isIPhone: /(iPhone|iPod)/gi.test(navigator.platform), + isIos: /(iPad|iPhone|iPod)/gi.test(navigator.platform) + }; + + // ========================================================================== + + // Default codecs for checking mimetype support + var defaultCodecs = { + 'audio/ogg': 'vorbis', + 'audio/wav': '1', + 'video/webm': 'vp8, vorbis', + 'video/mp4': 'avc1.42E01E, mp4a.40.2', + 'video/ogg': 'theora' + }; + + // Check for feature support + var support = { + // Basic support + audio: 'canPlayType' in document.createElement('audio'), + video: 'canPlayType' in document.createElement('video'), + + // Check for support + // Basic functionality vs full UI + check: function check(type, provider, playsinline) { + var canPlayInline = browser.isIPhone && playsinline && support.playsinline; + var api = support[type] || provider !== 'html5'; + var ui = api && support.rangeInput && (type !== 'video' || !browser.isIPhone || canPlayInline); + + return { + api: api, + ui: ui + }; + }, + + + // Picture-in-picture support + // Safari only currently + pip: function () { + return !browser.isIPhone && is.function(createElement('video').webkitSetPresentationMode); + }(), + + // Airplay support + // Safari only currently + airplay: is.function(window.WebKitPlaybackTargetAvailabilityEvent), + + // Inline playback support + // https://webkit.org/blog/6784/new-video-policies-for-ios/ + playsinline: 'playsInline' in document.createElement('video'), + + // Check for mime type support against a player instance + // Credits: http://diveintohtml5.info/everything.html + // Related: http://www.leanbackplayer.com/test/h5mt.html + mime: function mime(inputType) { + var _inputType$split = inputType.split('/'), + _inputType$split2 = slicedToArray(_inputType$split, 1), + mediaType = _inputType$split2[0]; + + if (!this.isHTML5 || mediaType !== this.type) { + return false; + } + + var type = void 0; + if (inputType && inputType.includes('codecs=')) { + // Use input directly + type = inputType; + } else if (inputType === 'audio/mpeg') { + // Skip codec + type = 'audio/mpeg;'; + } else if (inputType in defaultCodecs) { + // Use codec + type = inputType + '; codecs="' + defaultCodecs[inputType] + '"'; + } + + try { + return Boolean(type && this.media.canPlayType(type).replace(/no/, '')); + } catch (err) { + return false; + } + }, + + + // Check for textTracks support + textTracks: 'textTracks' in document.createElement('video'), + + // Sliders + rangeInput: function () { + var range = document.createElement('input'); + range.type = 'range'; + return range.type === 'range'; + }(), + + // Touch + // NOTE: Remember a device can be mouse + touch enabled so we check on first touch event + touch: 'ontouchstart' in document.documentElement, + + // Detect transitions support + transitions: transitionEndEvent !== false, + + // Reduced motion iOS & MacOS setting + // https://webkit.org/blog/7551/responsive-design-for-motion/ + reducedMotion: 'matchMedia' in window && window.matchMedia('(prefers-reduced-motion)').matches + }; + + // ========================================================================== + + var html5 = { + getSources: function getSources() { + var _this = this; + + if (!this.isHTML5) { + return []; + } + + var sources = Array.from(this.media.querySelectorAll('source')); + + // Filter out unsupported sources + return sources.filter(function (source) { + return support.mime.call(_this, source.getAttribute('type')); + }); + }, + + + // Get quality levels + getQualityOptions: function getQualityOptions() { + // Get sizes from elements + return html5.getSources.call(this).map(function (source) { + return Number(source.getAttribute('size')); + }).filter(Boolean); + }, + extend: function extend() { + if (!this.isHTML5) { + return; + } + + var player = this; + + // Quality + Object.defineProperty(player.media, 'quality', { + get: function get() { + // Get sources + var sources = html5.getSources.call(player); + var source = sources.find(function (source) { + return source.getAttribute('src') === player.source; + }); + + // Return size, if match is found + return source && Number(source.getAttribute('size')); + }, + set: function set(input) { + // Get sources + var sources = html5.getSources.call(player); + + // Get first match for requested size + var source = sources.find(function (source) { + return Number(source.getAttribute('size')) === input; + }); + + // No matching source found + if (!source) { + return; + } + + // Get current state + var _player$media = player.media, + currentTime = _player$media.currentTime, + paused = _player$media.paused, + preload = _player$media.preload, + readyState = _player$media.readyState; + + // Set new source + + player.media.src = source.getAttribute('src'); + + // Prevent loading if preload="none" and the current source isn't loaded (#1044) + if (preload !== 'none' || readyState) { + // Restore time + player.once('loadedmetadata', function () { + player.currentTime = currentTime; + + // Resume playing + if (!paused) { + player.play(); + } + }); + + // Load new source + player.media.load(); + } + + // Trigger change event + triggerEvent.call(player, player.media, 'qualitychange', false, { + quality: input + }); + } + }); + }, + + + // Cancel current network requests + // See https://github.com/sampotts/plyr/issues/174 + cancelRequests: function cancelRequests() { + if (!this.isHTML5) { + return; + } + + // Remove child sources + removeElement(html5.getSources.call(this)); + + // Set blank video src attribute + // This is to prevent a MEDIA_ERR_SRC_NOT_SUPPORTED error + // Info: http://stackoverflow.com/questions/32231579/how-to-properly-dispose-of-an-html5-video-and-close-socket-or-connection + this.media.setAttribute('src', this.config.blankVideo); + + // Load the new empty source + // This will cancel existing requests + // See https://github.com/sampotts/plyr/issues/174 + this.media.load(); + + // Debugging + this.debug.log('Cancelled network requests'); + } + }; + + // ========================================================================== + + // Clone nested objects + function cloneDeep(object) { + return JSON.parse(JSON.stringify(object)); + } + + // Get a nested value in an object + function getDeep(object, path) { + return path.split('.').reduce(function (obj, key) { + return obj && obj[key]; + }, object); + } + + // Deep extend destination object with N more objects + function extend() { + var target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + for (var _len = arguments.length, sources = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + sources[_key - 1] = arguments[_key]; + } + + if (!sources.length) { + return target; + } + + var source = sources.shift(); + + if (!is.object(source)) { + return target; + } + + Object.keys(source).forEach(function (key) { + if (is.object(source[key])) { + if (!Object.keys(target).includes(key)) { + Object.assign(target, defineProperty({}, key, {})); + } + + extend(target[key], source[key]); + } else { + Object.assign(target, defineProperty({}, key, source[key])); + } + }); + + return extend.apply(undefined, [target].concat(sources)); + } + + // ========================================================================== + + // Generate a random ID + function generateId(prefix) { + return prefix + '-' + Math.floor(Math.random() * 10000); + } + + // Format string + function format(input) { + for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + if (is.empty(input)) { + return input; + } + + return input.toString().replace(/{(\d+)}/g, function (match, i) { + return args[i].toString(); + }); + } + + // Get percentage + function getPercentage(current, max) { + if (current === 0 || max === 0 || Number.isNaN(current) || Number.isNaN(max)) { + return 0; + } + + return (current / max * 100).toFixed(2); + } + + // Replace all occurances of a string in a string + function replaceAll() { + var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; + var find = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + var replace = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; + + return input.replace(new RegExp(find.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g, '\\$1'), 'g'), replace.toString()); + } + + // Convert to title case + function toTitleCase() { + var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; + + return input.toString().replace(/\w\S*/g, function (text) { + return text.charAt(0).toUpperCase() + text.substr(1).toLowerCase(); + }); + } + + // Convert string to pascalCase + function toPascalCase() { + var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; + + var string = input.toString(); + + // Convert kebab case + string = replaceAll(string, '-', ' '); + + // Convert snake case + string = replaceAll(string, '_', ' '); + + // Convert to title case + string = toTitleCase(string); + + // Convert to pascal case + return replaceAll(string, ' ', ''); + } + + // Convert string to pascalCase + function toCamelCase() { + var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; + + var string = input.toString(); + + // Convert to pascal case + string = toPascalCase(string); + + // Convert first character to lowercase + return string.charAt(0).toLowerCase() + string.slice(1); + } + + // Remove HTML from a string + function stripHTML(source) { + var fragment = document.createDocumentFragment(); + var element = document.createElement('div'); + fragment.appendChild(element); + element.innerHTML = source; + return fragment.firstChild.innerText; + } + + // Like outerHTML, but also works for DocumentFragment + function getHTML(element) { + var wrapper = document.createElement('div'); + wrapper.appendChild(element); + return wrapper.innerHTML; + } + + // ========================================================================== + + var i18n = { + get: function get$$1() { + var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; + var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + if (is.empty(key) || is.empty(config)) { + return ''; + } + + var string = getDeep(config.i18n, key); + + if (is.empty(string)) { + return ''; + } + + var replace = { + '{seektime}': config.seekTime, + '{title}': config.title + }; + + Object.entries(replace).forEach(function (_ref) { + var _ref2 = slicedToArray(_ref, 2), + key = _ref2[0], + value = _ref2[1]; + + string = replaceAll(string, key, value); + }); + + return string; + } + }; + + // ========================================================================== + + // Remove duplicates in an array + function dedupe(array) { + if (!is.array(array)) { + return array; + } + + return array.filter(function (item, index) { + return array.indexOf(item) === index; + }); + } + + // Get the closest value in an array + function closest(array, value) { + if (!is.array(array) || !array.length) { + return null; + } + + return array.reduce(function (prev, curr) { + return Math.abs(curr - value) < Math.abs(prev - value) ? curr : prev; + }); + } + + // ========================================================================== + + var Storage = function () { + function Storage(player) { + classCallCheck(this, Storage); + + this.enabled = player.config.storage.enabled; + this.key = player.config.storage.key; + } + + // Check for actual support (see if we can use it) + + + createClass(Storage, [{ + key: 'get', + value: function get$$1(key) { + if (!Storage.supported || !this.enabled) { + return null; + } + + var store = window.localStorage.getItem(this.key); + + if (is.empty(store)) { + return null; + } + + var json = JSON.parse(store); + + return is.string(key) && key.length ? json[key] : json; + } + }, { + key: 'set', + value: function set$$1(object) { + // Bail if we don't have localStorage support or it's disabled + if (!Storage.supported || !this.enabled) { + return; + } + + // Can only store objectst + if (!is.object(object)) { + return; + } + + // Get current storage + var storage = this.get(); + + // Default to empty object + if (is.empty(storage)) { + storage = {}; + } + + // Update the working copy of the values + extend(storage, object); + + // Update storage + window.localStorage.setItem(this.key, JSON.stringify(storage)); + } + }], [{ + key: 'supported', + get: function get$$1() { + try { + if (!('localStorage' in window)) { + return false; + } + + var test = '___test'; + + // Try to use it (it might be disabled, e.g. user is in private mode) + // see: https://github.com/sampotts/plyr/issues/131 + window.localStorage.setItem(test, test); + window.localStorage.removeItem(test); + + return true; + } catch (e) { + return false; + } + } + }]); + return Storage; + }(); + + // ========================================================================== + // Fetch wrapper + // Using XHR to avoid issues with older browsers + // ========================================================================== + + function fetch(url) { + var responseType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'text'; + + return new Promise(function (resolve, reject) { + try { + var request = new XMLHttpRequest(); + + // Check for CORS support + if (!('withCredentials' in request)) { + return; + } + + request.addEventListener('load', function () { + if (responseType === 'text') { + try { + resolve(JSON.parse(request.responseText)); + } catch (e) { + resolve(request.responseText); + } + } else { + resolve(request.response); + } + }); + + request.addEventListener('error', function () { + throw new Error(request.status); + }); + + request.open('GET', url, true); + + // Set the required response type + request.responseType = responseType; + + request.send(); + } catch (e) { + reject(e); + } + }); + } + + // ========================================================================== + + // Load an external SVG sprite + function loadSprite(url, id) { + if (!is.string(url)) { + return; + } + + var prefix = 'cache'; + var hasId = is.string(id); + var isCached = false; + + var exists = function exists() { + return document.getElementById(id) !== null; + }; + + var update = function update(container, data) { + container.innerHTML = data; + + // Check again incase of race condition + if (hasId && exists()) { + return; + } + + // Inject the SVG to the body + document.body.insertAdjacentElement('afterbegin', container); + }; + + // Only load once if ID set + if (!hasId || !exists()) { + var useStorage = Storage.supported; + + // Create container + var container = document.createElement('div'); + container.setAttribute('hidden', ''); + + if (hasId) { + container.setAttribute('id', id); + } + + // Check in cache + if (useStorage) { + var cached = window.localStorage.getItem(prefix + '-' + id); + isCached = cached !== null; + + if (isCached) { + var data = JSON.parse(cached); + update(container, data.content); + } + } + + // Get the sprite + fetch(url).then(function (result) { + if (is.empty(result)) { + return; + } + + if (useStorage) { + window.localStorage.setItem(prefix + '-' + id, JSON.stringify({ + content: result + })); + } + + update(container, result); + }).catch(function () {}); + } + } + + // ========================================================================== + + // Time helpers + var getHours = function getHours(value) { + return parseInt(value / 60 / 60 % 60, 10); + }; + var getMinutes = function getMinutes(value) { + return parseInt(value / 60 % 60, 10); + }; + var getSeconds = function getSeconds(value) { + return parseInt(value % 60, 10); + }; + + // Format time to UI friendly string + function formatTime() { + var time = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; + var displayHours = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + var inverted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + + // Bail if the value isn't a number + if (!is.number(time)) { + return formatTime(null, displayHours, inverted); + } + + // Format time component to add leading zero + var format = function format(value) { + return ('0' + value).slice(-2); + }; + + // Breakdown to hours, mins, secs + var hours = getHours(time); + var mins = getMinutes(time); + var secs = getSeconds(time); + + // Do we need to display hours? + if (displayHours || hours > 0) { + hours = hours + ':'; + } else { + hours = ''; + } + + // Render + return '' + (inverted && time > 0 ? '-' : '') + hours + format(mins) + ':' + format(secs); + } + + // ========================================================================== + + // TODO: Don't export a massive object - break down and create class + var controls = { + // Get icon URL + getIconUrl: function getIconUrl() { + var url = new URL(this.config.iconUrl, window.location); + var cors = url.host !== window.location.host || browser.isIE && !window.svg4everybody; + + return { + url: this.config.iconUrl, + cors: cors + }; + }, + + + // Find the UI controls + findElements: function findElements() { + try { + this.elements.controls = getElement.call(this, this.config.selectors.controls.wrapper); + + // Buttons + this.elements.buttons = { + play: getElements.call(this, this.config.selectors.buttons.play), + pause: getElement.call(this, this.config.selectors.buttons.pause), + restart: getElement.call(this, this.config.selectors.buttons.restart), + rewind: getElement.call(this, this.config.selectors.buttons.rewind), + fastForward: getElement.call(this, this.config.selectors.buttons.fastForward), + mute: getElement.call(this, this.config.selectors.buttons.mute), + pip: getElement.call(this, this.config.selectors.buttons.pip), + airplay: getElement.call(this, this.config.selectors.buttons.airplay), + settings: getElement.call(this, this.config.selectors.buttons.settings), + captions: getElement.call(this, this.config.selectors.buttons.captions), + fullscreen: getElement.call(this, this.config.selectors.buttons.fullscreen) + }; + + // Progress + this.elements.progress = getElement.call(this, this.config.selectors.progress); + + // Inputs + this.elements.inputs = { + seek: getElement.call(this, this.config.selectors.inputs.seek), + volume: getElement.call(this, this.config.selectors.inputs.volume) + }; + + // Display + this.elements.display = { + buffer: getElement.call(this, this.config.selectors.display.buffer), + currentTime: getElement.call(this, this.config.selectors.display.currentTime), + duration: getElement.call(this, this.config.selectors.display.duration) + }; + + // Seek tooltip + if (is.element(this.elements.progress)) { + this.elements.display.seekTooltip = this.elements.progress.querySelector('.' + this.config.classNames.tooltip); + } + + return true; + } catch (error) { + // Log it + this.debug.warn('It looks like there is a problem with your custom controls HTML', error); + + // Restore native video controls + this.toggleNativeControls(true); + + return false; + } + }, + + + // Create icon + createIcon: function createIcon(type, attributes) { + var namespace = 'http://www.w3.org/2000/svg'; + var iconUrl = controls.getIconUrl.call(this); + var iconPath = (!iconUrl.cors ? iconUrl.url : '') + '#' + this.config.iconPrefix; + + // Create + var icon = document.createElementNS(namespace, 'svg'); + setAttributes(icon, extend(attributes, { + role: 'presentation', + focusable: 'false' + })); + + // Create the to reference sprite + var use = document.createElementNS(namespace, 'use'); + var path = iconPath + '-' + type; + + // Set `href` attributes + // https://github.com/sampotts/plyr/issues/460 + // https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/xlink:href + if ('href' in use) { + use.setAttributeNS('http://www.w3.org/1999/xlink', 'href', path); + } else { + use.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', path); + } + + // Add to + icon.appendChild(use); + + return icon; + }, + + + // Create hidden text label + createLabel: function createLabel(type) { + var attr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + // Skip i18n for abbreviations and brand names + var universals = { + pip: 'PIP', + airplay: 'AirPlay' + }; + var text = universals[type] || i18n.get(type, this.config); + + var attributes = Object.assign({}, attr, { + class: [attr.class, this.config.classNames.hidden].filter(Boolean).join(' ') + }); + return createElement('span', attributes, text); + }, + + + // Create a badge + createBadge: function createBadge(text) { + if (is.empty(text)) { + return null; + } + + var badge = createElement('span', { + class: this.config.classNames.menu.value + }); + + badge.appendChild(createElement('span', { + class: this.config.classNames.menu.badge + }, text)); + + return badge; + }, + + + // Create a
to hide the standard controls and UI + setAspectRatio: function setAspectRatio(input) { + var _split = (is.string(input) ? input : this.config.ratio).split(':'), + _split2 = slicedToArray(_split, 2), + x = _split2[0], + y = _split2[1]; + + var padding = 100 / x * y; + this.elements.wrapper.style.paddingBottom = padding + '%'; + + if (this.supported.ui) { + var height = 240; + var offset = (height - padding) / (height / 50); + + this.media.style.transform = 'translateY(-' + offset + '%)'; + } + }, + + + // API Ready + ready: function ready$$1() { + var _this2 = this; + + var player = this; + + // Get Vimeo params for the iframe + var options = { + loop: player.config.loop.active, + autoplay: player.autoplay, + // muted: player.muted, + byline: false, + portrait: false, + title: false, + speed: true, + transparent: 0, + gesture: 'media', + playsinline: !this.config.fullscreen.iosNative + }; + var params = buildUrlParams(options); + + // Get the source URL or ID + var source = player.media.getAttribute('src'); + + // Get from
if needed + if (is.empty(source)) { + source = player.media.getAttribute(player.config.attributes.embed.id); + } + + var id = parseId(source); + + // Build an iframe + var iframe = createElement('iframe'); + var src = format(player.config.urls.vimeo.iframe, id, params); + iframe.setAttribute('src', src); + iframe.setAttribute('allowfullscreen', ''); + iframe.setAttribute('allowtransparency', ''); + iframe.setAttribute('allow', 'autoplay'); + + // Get poster, if already set + var poster = player.poster; + + // Inject the package + + var wrapper = createElement('div', { poster: poster, class: player.config.classNames.embedContainer }); + wrapper.appendChild(iframe); + player.media = replaceElement(wrapper, player.media); + + // Get poster image + fetch(format(player.config.urls.vimeo.api, id), 'json').then(function (response) { + if (is.empty(response)) { + return; + } + + // Get the URL for thumbnail + var url = new URL(response[0].thumbnail_large); + + // Get original image + url.pathname = url.pathname.split('_')[0] + '.jpg'; + + // Set and show poster + ui.setPoster.call(player, url.href).catch(function () {}); + }); + + // Setup instance + // https://github.com/vimeo/player.js + player.embed = new window.Vimeo.Player(iframe, { + autopause: player.config.autopause, + muted: player.muted + }); + + player.media.paused = true; + player.media.currentTime = 0; + + // Disable native text track rendering + if (player.supported.ui) { + player.embed.disableTextTrack(); + } + + // Create a faux HTML5 API using the Vimeo API + player.media.play = function () { + assurePlaybackState.call(player, true); + return player.embed.play(); + }; + + player.media.pause = function () { + assurePlaybackState.call(player, false); + return player.embed.pause(); + }; + + player.media.stop = function () { + player.pause(); + player.currentTime = 0; + }; + + // Seeking + var currentTime = player.media.currentTime; + + Object.defineProperty(player.media, 'currentTime', { + get: function get$$1() { + return currentTime; + }, + set: function set$$1(time) { + // Vimeo will automatically play on seek if the video hasn't been played before + + // Get current paused state and volume etc + var embed = player.embed, + media = player.media, + paused = player.paused, + volume = player.volume; + + var restorePause = paused && !embed.hasPlayed; + + // Set seeking state and trigger event + media.seeking = true; + triggerEvent.call(player, media, 'seeking'); + + // If paused, mute until seek is complete + Promise.resolve(restorePause && embed.setVolume(0)) + // Seek + .then(function () { + return embed.setCurrentTime(time); + }) + // Restore paused + .then(function () { + return restorePause && embed.pause(); + }) + // Restore volume + .then(function () { + return restorePause && embed.setVolume(volume); + }).catch(function () { + // Do nothing + }); + } + }); + + // Playback speed + var speed = player.config.speed.selected; + Object.defineProperty(player.media, 'playbackRate', { + get: function get$$1() { + return speed; + }, + set: function set$$1(input) { + player.embed.setPlaybackRate(input).then(function () { + speed = input; + triggerEvent.call(player, player.media, 'ratechange'); + }).catch(function (error) { + // Hide menu item (and menu if empty) + if (error.name === 'Error') { + controls.setSpeedMenu.call(player, []); + } + }); + } + }); + + // Volume + var volume = player.config.volume; + + Object.defineProperty(player.media, 'volume', { + get: function get$$1() { + return volume; + }, + set: function set$$1(input) { + player.embed.setVolume(input).then(function () { + volume = input; + triggerEvent.call(player, player.media, 'volumechange'); + }); + } + }); + + // Muted + var muted = player.config.muted; + + Object.defineProperty(player.media, 'muted', { + get: function get$$1() { + return muted; + }, + set: function set$$1(input) { + var toggle = is.boolean(input) ? input : false; + + player.embed.setVolume(toggle ? 0 : player.config.volume).then(function () { + muted = toggle; + triggerEvent.call(player, player.media, 'volumechange'); + }); + } + }); + + // Loop + var loop = player.config.loop; + + Object.defineProperty(player.media, 'loop', { + get: function get$$1() { + return loop; + }, + set: function set$$1(input) { + var toggle = is.boolean(input) ? input : player.config.loop.active; + + player.embed.setLoop(toggle).then(function () { + loop = toggle; + }); + } + }); + + // Source + var currentSrc = void 0; + player.embed.getVideoUrl().then(function (value) { + currentSrc = value; + }).catch(function (error) { + _this2.debug.warn(error); + }); + + Object.defineProperty(player.media, 'currentSrc', { + get: function get$$1() { + return currentSrc; + } + }); + + // Ended + Object.defineProperty(player.media, 'ended', { + get: function get$$1() { + return player.currentTime === player.duration; + } + }); + + // Set aspect ratio based on video size + Promise.all([player.embed.getVideoWidth(), player.embed.getVideoHeight()]).then(function (dimensions) { + var ratio = getAspectRatio(dimensions[0], dimensions[1]); + vimeo.setAspectRatio.call(_this2, ratio); + }); + + // Set autopause + player.embed.setAutopause(player.config.autopause).then(function (state) { + player.config.autopause = state; + }); + + // Get title + player.embed.getVideoTitle().then(function (title) { + player.config.title = title; + ui.setTitle.call(_this2); + }); + + // Get current time + player.embed.getCurrentTime().then(function (value) { + currentTime = value; + triggerEvent.call(player, player.media, 'timeupdate'); + }); + + // Get duration + player.embed.getDuration().then(function (value) { + player.media.duration = value; + triggerEvent.call(player, player.media, 'durationchange'); + }); + + // Get captions + player.embed.getTextTracks().then(function (tracks) { + player.media.textTracks = tracks; + captions.setup.call(player); + }); + + player.embed.on('cuechange', function (_ref) { + var _ref$cues = _ref.cues, + cues = _ref$cues === undefined ? [] : _ref$cues; + + var strippedCues = cues.map(function (cue) { + return stripHTML(cue.text); + }); + captions.updateCues.call(player, strippedCues); + }); + + player.embed.on('loaded', function () { + // Assure state and events are updated on autoplay + player.embed.getPaused().then(function (paused) { + assurePlaybackState.call(player, !paused); + if (!paused) { + triggerEvent.call(player, player.media, 'playing'); + } + }); + + if (is.element(player.embed.element) && player.supported.ui) { + var frame = player.embed.element; + + // Fix keyboard focus issues + // https://github.com/sampotts/plyr/issues/317 + frame.setAttribute('tabindex', -1); + } + }); + + player.embed.on('play', function () { + assurePlaybackState.call(player, true); + triggerEvent.call(player, player.media, 'playing'); + }); + + player.embed.on('pause', function () { + assurePlaybackState.call(player, false); + }); + + player.embed.on('timeupdate', function (data) { + player.media.seeking = false; + currentTime = data.seconds; + triggerEvent.call(player, player.media, 'timeupdate'); + }); + + player.embed.on('progress', function (data) { + player.media.buffered = data.percent; + triggerEvent.call(player, player.media, 'progress'); + + // Check all loaded + if (parseInt(data.percent, 10) === 1) { + triggerEvent.call(player, player.media, 'canplaythrough'); + } + + // Get duration as if we do it before load, it gives an incorrect value + // https://github.com/sampotts/plyr/issues/891 + player.embed.getDuration().then(function (value) { + if (value !== player.media.duration) { + player.media.duration = value; + triggerEvent.call(player, player.media, 'durationchange'); + } + }); + }); + + player.embed.on('seeked', function () { + player.media.seeking = false; + triggerEvent.call(player, player.media, 'seeked'); + }); + + player.embed.on('ended', function () { + player.media.paused = true; + triggerEvent.call(player, player.media, 'ended'); + }); + + player.embed.on('error', function (detail) { + player.media.error = detail; + triggerEvent.call(player, player.media, 'error'); + }); + + // Rebuild UI + setTimeout(function () { + return ui.build.call(player); + }, 0); + } + }; + + // ========================================================================== + + // Parse YouTube ID from URL + function parseId$1(url) { + if (is.empty(url)) { + return null; + } + + var regex = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/; + return url.match(regex) ? RegExp.$2 : url; + } + + // Standardise YouTube quality unit + function mapQualityUnit(input) { + var qualities = { + hd2160: 2160, + hd1440: 1440, + hd1080: 1080, + hd720: 720, + large: 480, + medium: 360, + small: 240, + tiny: 144 + }; + + var entry = Object.entries(qualities).find(function (entry) { + return entry.includes(input); + }); + + if (entry) { + // Get the match corresponding to the input + return entry.find(function (value) { + return value !== input; + }); + } + + return 'default'; + } + + function mapQualityUnits(levels) { + if (is.empty(levels)) { + return levels; + } + + return dedupe(levels.map(function (level) { + return mapQualityUnit(level); + })); + } + + // Set playback state and trigger change (only on actual change) + function assurePlaybackState$1(play) { + if (play && !this.embed.hasPlayed) { + this.embed.hasPlayed = true; + } + if (this.media.paused === play) { + this.media.paused = !play; + triggerEvent.call(this, this.media, play ? 'play' : 'pause'); + } + } + + var youtube = { + setup: function setup() { + var _this = this; + + // Add embed class for responsive + toggleClass(this.elements.wrapper, this.config.classNames.embed, true); + + // Set aspect ratio + youtube.setAspectRatio.call(this); + + // Setup API + if (is.object(window.YT) && is.function(window.YT.Player)) { + youtube.ready.call(this); + } else { + // Load the API + loadScript(this.config.urls.youtube.sdk).catch(function (error) { + _this.debug.warn('YouTube API failed to load', error); + }); + + // Setup callback for the API + // YouTube has it's own system of course... + window.onYouTubeReadyCallbacks = window.onYouTubeReadyCallbacks || []; + + // Add to queue + window.onYouTubeReadyCallbacks.push(function () { + youtube.ready.call(_this); + }); + + // Set callback to process queue + window.onYouTubeIframeAPIReady = function () { + window.onYouTubeReadyCallbacks.forEach(function (callback) { + callback(); + }); + }; + } + }, + + + // Get the media title + getTitle: function getTitle(videoId) { + var _this2 = this; + + // Try via undocumented API method first + // This method disappears now and then though... + // https://github.com/sampotts/plyr/issues/709 + if (is.function(this.embed.getVideoData)) { + var _embed$getVideoData = this.embed.getVideoData(), + title = _embed$getVideoData.title; + + if (is.empty(title)) { + this.config.title = title; + ui.setTitle.call(this); + return; + } + } + + // Or via Google API + var key = this.config.keys.google; + if (is.string(key) && !is.empty(key)) { + var url = format(this.config.urls.youtube.api, videoId, key); + + fetch(url).then(function (result) { + if (is.object(result)) { + _this2.config.title = result.items[0].snippet.title; + ui.setTitle.call(_this2); + } + }).catch(function () {}); + } + }, + + + // Set aspect ratio + setAspectRatio: function setAspectRatio() { + var ratio = this.config.ratio.split(':'); + this.elements.wrapper.style.paddingBottom = 100 / ratio[0] * ratio[1] + '%'; + }, + + + // API ready + ready: function ready$$1() { + var player = this; + + // Ignore already setup (race condition) + var currentId = player.media.getAttribute('id'); + if (!is.empty(currentId) && currentId.startsWith('youtube-')) { + return; + } + + // Get the source URL or ID + var source = player.media.getAttribute('src'); + + // Get from
if needed + if (is.empty(source)) { + source = player.media.getAttribute(this.config.attributes.embed.id); + } + + // Replace the