PageSourceSearch

https://iancoleman.io/multisig/

html iancoleman.io collected 2026-09-24 09:28:03 UTC 617,057 bytes, 13,825 lines download raw bytes

1<!DOCTYPE html>
2<html>
3    <head lang="en">
4        <meta charset="utf-8" />
5        <title>Multisig</title>
6        <style>/*!
7 * Bootstrap v3.2.0 (http://getbootstrap.com)
8 * Copyright 2011-2014 Twitter, Inc.
9 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
10 *//*! normalize.css v3.0.1 | MIT License | git.io/normalize */html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background:0 0}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{margin:.67em 0;font-size:2em}mark{color:#000;background:#ff0}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{height:0;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{margin:0;font:inherit;color:inherit}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0}input{line-height:normal}input[type=checkbox],input[type=radio]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{padding:.35em .625em .75em;margin:0 2px;border:1px solid silver}legend{padding:0;border:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-spacing:0;border-collapse:collapse}td,th{padding:0}@media print{*{color:#000!important;text-shadow:none!important;background:transparent!important;-webkit-box-shadow:none!important;box-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100%!important}p,h2,h3{orphans:3;widows:3}h2,h3{page-break-after:avoid}select{background:#fff!important}.navbar{display:none}.table td,.table th{background-color:#fff!important}.btn>.caret,.dropup>.btn>.caret{border-top-color:#000!important}.label{border:1px solid #000}.table{border-collapse:collapse!important}.table-bordered th,.table-bordered td{border:1px solid #ddd!important}}@font-face{font-family:'Glyphicons Halflings';src:url(../fonts/glyphicons-halflings-regular.eot);src:url(../fonts/glyphicons-halflings-regular.eot?#iefix) format('embedded-opentype'),url(../fonts/glyphicons-halflings-regular.woff) format('woff'),url(../fonts/glyphicons-halflings-regular.ttf) format('truetype'),url(../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular) format('svg')}.glyphicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons Halflings';font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.glyphicon-asterisk:before{content:"\2a"}.glyphicon-plus:before{content:"\2b"}.glyphicon-euro:before{content:"\20ac"}.glyphicon-minus:before{content:"\2212"}.glyphicon-cloud:before{content:"\2601"}.glyphicon-envelope:before{content:"\2709"}.glyphicon-pencil:before{content:"\270f"}.glyphicon-glass:before{content:"\e001"}.glyphicon-music:before{content:"\e002"}.glyphicon-search:before{content:"\e003"}.glyphicon-heart:before{content:"\e005"}.glyphicon-star:before{content:"\e006"}.glyphicon-star-empty:before{content:"\e007"}.glyphicon-user:before{content:"\e008"}.glyphicon-film:before{content:"\e009"}.glyphicon-th-large:before{content:"\e010"}.glyphicon-th:before{content:"\e011"}.glyphicon-th-list:before{content:"\e012"}.glyphicon-ok:before{content:"\e013"}.glyphicon-remove:before{content:"\e014"}.glyphicon-zoom-in:before{content:"\e015"}.glyphicon-zoom-out:before{content:"\e016"}.glyphicon-off:before{content:"\e017"}.glyphicon-signal:before{content:"\e018"}.glyphicon-cog:before{content:"\e019"}.glyphicon-trash:before{content:"\e020"}.glyphicon-home:before{content:"\e021"}.glyphicon-file:before{content:"\e022"}.glyphicon-time:before{content:"\e023"}.glyphicon-road:before{content:"\e024"}.glyphicon-download-alt:before{content:"\e025"}.glyphicon-download:before{content:"\e026"}.glyphicon-upload:before{content:"\e027"}.glyphicon-inbox:before{content:"\e028"}.glyphicon-play-circle:before{content:"\e029"}.glyphicon-repeat:before{content:"\e030"}.glyphicon-refresh:before{content:"\e031"}.glyphicon-list-alt:before{content:"\e032"}.glyphicon-lock:before{content:"\e033"}.glyphicon-flag:before{content:"\e034"}.glyphicon-headphones:before{content:"\e035"}.glyphicon-volume-off:before{content:"\e036"}.glyphicon-volume-down:before{content:"\e037"}.glyphicon-volume-up:before{content:"\e038"}.glyphicon-qrcode:before{content:"\e039"}.glyphicon-barcode:before{content:"\e040"}.glyphicon-tag:before{content:"\e041"}.glyphicon-tags:before{content:"\e042"}.glyphicon-book:before{content:"\e043"}.glyphicon-bookmark:before{content:"\e044"}.glyphicon-print:before{content:"\e045"}.glyphicon-camera:before{content:"\e046"}.glyphicon-font:before{content:"\e047"}.glyphicon-bold:before{content:"\e048"}.glyphicon-italic:before{content:"\e049"}.glyphicon-text-height:before{content:"\e050"}.glyphicon-text-width:before{content:"\e051"}.glyphicon-align-left:before{content:"\e052"}.glyphicon-align-center:before{content:"\e053"}.glyphicon-align-right:before{content:"\e054"}.glyphicon-align-justify:before{content:"\e055"}.glyphicon-list:before{content:"\e056"}.glyphicon-indent-left:before{content:"\e057"}.glyphicon-indent-right:before{content:"\e058"}.glyphicon-facetime-video:before{content:"\e059"}.glyphicon-picture:before{content:"\e060"}.glyphicon-map-marker:before{content:"\e062"}.glyphicon-adjust:before{content:"\e063"}.glyphicon-tint:before{content:"\e064"}.glyphicon-edit:before{content:"\e065"}.glyphicon-share:before{content:"\e066"}.glyphicon-check:before{content:"\e067"}.glyphicon-move:before{content:"\e068"}.glyphicon-step-backward:before{content:"\e069"}.glyphicon-fast-backward:before{content:"\e070"}.glyphicon-backward:before{content:"\e071"}.glyphicon-play:before{content:"\e072"}.glyphicon-pause:before{content:"\e073"}.glyphicon-stop:before{content:"\e074"}.glyphicon-forward:before{content:"\e075"}.glyphicon-fast-forward:before{content:"\e076"}.glyphicon-step-forward:before{content:"\e077"}.glyphicon-eject:before{content:"\e078"}.glyphicon-chevron-left:before{content:"\e079"}.glyphicon-chevron-right:before{content:"\e080"}.glyphicon-plus-sign:before{content:"\e081"}.glyphicon-minus-sign:before{content:"\e082"}.glyphicon-remove-sign:before{content:"\e083"}.glyphicon-ok-sign:before{content:"\e084"}.glyphicon-question-sign:before{content:"\e085"}.glyphicon-info-sign:before{content:"\e086"}.glyphicon-screenshot:before{content:"\e087"}.glyphicon-remove-circle:before{content:"\e088"}.glyphicon-ok-circle:before{content:"\e089"}.glyphicon-ban-circle:before{content:"\e090"}.glyphicon-arrow-left:before{content:"\e091"}.glyphicon-arrow-right:before{content:"\e092"}.glyphicon-arrow-up:before{content:"\e093"}.glyphicon-arrow-down:before{content:"\e094"}.glyphicon-share-alt:before{content:"\e095"}.glyphicon-resize-full:before{content:"\e096"}.glyphicon-resize-small:before{content:"\e097"}.glyphicon-exclamation-sign:before{content:"\e101"}.glyphicon-gift:before{content:"\e102"}.glyphicon-leaf:before{content:"\e103"}.glyphicon-fire:before{content:"\e104"}.glyphicon-eye-open:before{content:"\e105"}
10.glyphicon-eye-close:before{content:"\e106"}.glyphicon-warning-sign:before{content:"\e107"}.glyphicon-plane:before{content:"\e108"}.glyphicon-calendar:before{content:"\e109"}.glyphicon-random:before{content:"\e110"}.glyphicon-comment:before{content:"\e111"}.glyphicon-magnet:before{content:"\e112"}.glyphicon-chevron-up:before{content:"\e113"}.glyphicon-chevron-down:before{content:"\e114"}.glyphicon-retweet:before{content:"\e115"}.glyphicon-shopping-cart:before{content:"\e116"}.glyphicon-folder-close:before{content:"\e117"}.glyphicon-folder-open:before{content:"\e118"}.glyphicon-resize-vertical:before{content:"\e119"}.glyphicon-resize-horizontal:before{content:"\e120"}.glyphicon-hdd:before{content:"\e121"}.glyphicon-bullhorn:before{content:"\e122"}.glyphicon-bell:before{content:"\e123"}.glyphicon-certificate:before{content:"\e124"}.glyphicon-thumbs-up:before{content:"\e125"}.glyphicon-thumbs-down:before{content:"\e126"}.glyphicon-hand-right:before{content:"\e127"}.glyphicon-hand-left:before{content:"\e128"}.glyphicon-hand-up:before{content:"\e129"}.glyphicon-hand-down:before{content:"\e130"}.glyphicon-circle-arrow-right:before{content:"\e131"}.glyphicon-circle-arrow-left:before{content:"\e132"}.glyphicon-circle-arrow-up:before{content:"\e133"}.glyphicon-circle-arrow-down:before{content:"\e134"}.glyphicon-globe:before{content:"\e135"}.glyphicon-wrench:before{content:"\e136"}.glyphicon-tasks:before{content:"\e137"}.glyphicon-filter:before{content:"\e138"}.glyphicon-briefcase:before{content:"\e139"}.glyphicon-fullscreen:before{content:"\e140"}.glyphicon-dashboard:before{content:"\e141"}.glyphicon-paperclip:before{content:"\e142"}.glyphicon-heart-empty:before{content:"\e143"}.glyphicon-link:before{content:"\e144"}.glyphicon-phone:before{content:"\e145"}.glyphicon-pushpin:before{content:"\e146"}.glyphicon-usd:before{content:"\e148"}.glyphicon-gbp:before{content:"\e149"}.glyphicon-sort:before{content:"\e150"}.glyphicon-sort-by-alphabet:before{content:"\e151"}.glyphicon-sort-by-alphabet-alt:before{content:"\e152"}.glyphicon-sort-by-order:before{content:"\e153"}.glyphicon-sort-by-order-alt:before{content:"\e154"}.glyphicon-sort-by-attributes:before{content:"\e155"}.glyphicon-sort-by-attributes-alt:before{content:"\e156"}.glyphicon-unchecked:before{content:"\e157"}.glyphicon-expand:before{content:"\e158"}.glyphicon-collapse-down:before{content:"\e159"}.glyphicon-collapse-up:before{content:"\e160"}.glyphicon-log-in:before{content:"\e161"}.glyphicon-flash:before{content:"\e162"}.glyphicon-log-out:before{content:"\e163"}.glyphicon-new-window:before{content:"\e164"}.glyphicon-record:before{content:"\e165"}.glyphicon-save:before{content:"\e166"}.glyphicon-open:before{content:"\e167"}.glyphicon-saved:before{content:"\e168"}.glyphicon-import:before{content:"\e169"}.glyphicon-export:before{content:"\e170"}.glyphicon-send:before{content:"\e171"}.glyphicon-floppy-disk:before{content:"\e172"}.glyphicon-floppy-saved:before{content:"\e173"}.glyphicon-floppy-remove:before{content:"\e174"}.glyphicon-floppy-save:before{content:"\e175"}.glyphicon-floppy-open:before{content:"\e176"}.glyphicon-credit-card:before{content:"\e177"}.glyphicon-transfer:before{content:"\e178"}.glyphicon-cutlery:before{content:"\e179"}.glyphicon-header:before{content:"\e180"}.glyphicon-compressed:before{content:"\e181"}.glyphicon-earphone:before{content:"\e182"}.glyphicon-phone-alt:before{content:"\e183"}.glyphicon-tower:before{content:"\e184"}.glyphicon-stats:before{content:"\e185"}.glyphicon-sd-video:before{content:"\e186"}.glyphicon-hd-video:before{content:"\e187"}.glyphicon-subtitles:before{content:"\e188"}.glyphicon-sound-stereo:before{content:"\e189"}.glyphicon-sound-dolby:before{content:"\e190"}.glyphicon-sound-5-1:before{content:"\e191"}.glyphicon-sound-6-1:before{content:"\e192"}.glyphicon-sound-7-1:before{content:"\e193"}.glyphicon-copyright-mark:before{content:"\e194"}.glyphicon-registration-mark:before{content:"\e195"}.glyphicon-cloud-download:before{content:"\e197"}.glyphicon-cloud-upload:before{content:"\e198"}.glyphicon-tree-conifer:before{content:"\e199"}.glyphicon-tree-deciduous:before{content:"\e200"}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}:before,:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html{font-size:10px;-webkit-tap-highlight-color:rgba(0,0,0,0)}body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.42857143;color:#333;background-color:#fff}input,button,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit}a{color:#428bca;text-decoration:none}a:hover,a:focus{color:#2a6496;text-decoration:underline}a:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}figure{margin:0}img{vertical-align:middle}.img-responsive,.thumbnail>img,.thumbnail a>img,.carousel-inner>.item>img,.carousel-inner>.item>a>img{display:block;width:100% \9;max-width:100%;height:auto}.img-rounded{border-radius:6px}.img-thumbnail{display:inline-block;width:100% \9;max-width:100%;height:auto;padding:4px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.img-circle{border-radius:50%}hr{margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}h1,h2,h3,h4,h5,h6,.h1,.h2,.h3,.h4,.h5,.h6{font-family:inherit;font-weight:500;line-height:1.1;color:inherit}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small,.h1 small,.h2 small,.h3 small,.h4 small,.h5 small,.h6 small,h1 .small,h2 .small,h3 .small,h4 .small,h5 .small,h6 .small,.h1 .small,.h2 .small,.h3 .small,.h4 .small,.h5 .small,.h6 .small{font-weight:400;line-height:1;
10color:#777}h1,.h1,h2,.h2,h3,.h3{margin-top:20px;margin-bottom:10px}h1 small,.h1 small,h2 small,.h2 small,h3 small,.h3 small,h1 .small,.h1 .small,h2 .small,.h2 .small,h3 .small,.h3 .small{font-size:65%}h4,.h4,h5,.h5,h6,.h6{margin-top:10px;margin-bottom:10px}h4 small,.h4 small,h5 small,.h5 small,h6 small,.h6 small,h4 .small,.h4 .small,h5 .small,.h5 .small,h6 .small,.h6 .small{font-size:75%}h1,.h1{font-size:36px}h2,.h2{font-size:30px}h3,.h3{font-size:24px}h4,.h4{font-size:18px}h5,.h5{font-size:14px}h6,.h6{font-size:12px}p{margin:0 0 10px}.lead{margin-bottom:20px;font-size:16px;font-weight:300;line-height:1.4}@media (min-width:768px){.lead{font-size:21px}}small,.small{font-size:85%}cite{font-style:normal}mark,.mark{padding:.2em;background-color:#fcf8e3}.text-left{text-align:left}.text-right{text-align:right}.text-center{text-align:center}.text-justify{text-align:justify}.text-nowrap{white-space:nowrap}.text-lowercase{text-transform:lowercase}.text-uppercase{text-transform:uppercase}.text-capitalize{text-transform:capitalize}.text-muted{color:#777}.text-primary{color:#428bca}a.text-primary:hover{color:#3071a9}.text-success{color:#3c763d}a.text-success:hover{color:#2b542c}.text-info{color:#31708f}a.text-info:hover{color:#245269}.text-warning{color:#8a6d3b}a.text-warning:hover{color:#66512c}.text-danger{color:#a94442}a.text-danger:hover{color:#843534}.bg-primary{color:#fff;background-color:#428bca}a.bg-primary:hover{background-color:#3071a9}.bg-success{background-color:#dff0d8}a.bg-success:hover{background-color:#c1e2b3}.bg-info{background-color:#d9edf7}a.bg-info:hover{background-color:#afd9ee}.bg-warning{background-color:#fcf8e3}a.bg-warning:hover{background-color:#f7ecb5}.bg-danger{background-color:#f2dede}a.bg-danger:hover{background-color:#e4b9b9}.page-header{padding-bottom:9px;margin:40px 0 20px;border-bottom:1px solid #eee}ul,ol{margin-top:0;margin-bottom:10px}ul ul,ol ul,ul ol,ol ol{margin-bottom:0}.list-unstyled{padding-left:0;list-style:none}.list-inline{padding-left:0;margin-left:-5px;list-style:none}.list-inline>li{display:inline-block;padding-right:5px;padding-left:5px}dl{margin-top:0;margin-bottom:20px}dt,dd{line-height:1.42857143}dt{font-weight:700}dd{margin-left:0}@media (min-width:768px){.dl-horizontal dt{float:left;width:160px;overflow:hidden;clear:left;text-align:right;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}}abbr[title],abbr[data-original-title]{cursor:help;border-bottom:1px dotted #777}.initialism{font-size:90%;text-transform:uppercase}blockquote{padding:10px 20px;margin:0 0 20px;font-size:17.5px;border-left:5px solid #eee}blockquote p:last-child,blockquote ul:last-child,blockquote ol:last-child{margin-bottom:0}blockquote footer,blockquote small,blockquote .small{display:block;font-size:80%;line-height:1.42857143;color:#777}blockquote footer:before,blockquote small:before,blockquote .small:before{content:'\2014 \00A0'}.blockquote-reverse,blockquote.pull-right{padding-right:15px;padding-left:0;text-align:right;border-right:5px solid #eee;border-left:0}.blockquote-reverse footer:before,blockquote.pull-right footer:before,.blockquote-reverse small:before,blockquote.pull-right small:before,.blockquote-reverse .small:before,blockquote.pull-right .small:before{content:''}.blockquote-reverse footer:after,blockquote.pull-right footer:after,.blockquote-reverse small:after,blockquote.pull-right small:after,.blockquote-reverse .small:after,blockquote.pull-right .small:after{content:'\00A0 \2014'}blockquote:before,blockquote:after{content:""}address{margin-bottom:20px;font-style:normal;line-height:1.42857143}code,kbd,pre,samp{font-family:Menlo,Monaco,Consolas,"Courier New",monospace}code{padding:2px 4px;font-size:90%;color:#c7254e;background-color:#f9f2f4;border-radius:4px}kbd{padding:2px 4px;font-size:90%;color:#fff;background-color:#333;border-radius:3px;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.25);box-shadow:inset 0 -1px 0 rgba(0,0,0,.25)}kbd kbd{padding:0;font-size:100%;-webkit-box-shadow:none;box-shadow:none}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:1.42857143;color:#333;word-break:break-all;word-wrap:break-word;background-color:#f5f5f5;border:1px solid #ccc;border-radius:4px}pre code{padding:0;font-size:inherit;color:inherit;white-space:pre-wrap;background-color:transparent;border-radius:0}.pre-scrollable{max-height:340px;overflow-y:scroll}.container{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}@media (min-width:768px){.container{width:750px}}@media (min-width:992px){.container{width:970px}}@media (min-width:1200px){.container{width:1170px}}
10.container-fluid{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}.row{margin-right:-15px;margin-left:-15px}.col-xs-1,.col-sm-1,.col-md-1,.col-lg-1,.col-xs-2,.col-sm-2,.col-md-2,.col-lg-2,.col-xs-3,.col-sm-3,.col-md-3,.col-lg-3,.col-xs-4,.col-sm-4,.col-md-4,.col-lg-4,.col-xs-5,.col-sm-5,.col-md-5,.col-lg-5,.col-xs-6,.col-sm-6,.col-md-6,.col-lg-6,.col-xs-7,.col-sm-7,.col-md-7,.col-lg-7,.col-xs-8,.col-sm-8,.col-md-8,.col-lg-8,.col-xs-9,.col-sm-9,.col-md-9,.col-lg-9,.col-xs-10,.col-sm-10,.col-md-10,.col-lg-10,.col-xs-11,.col-sm-11,.col-md-11,.col-lg-11,.col-xs-12,.col-sm-12,.col-md-12,.col-lg-12{position:relative;min-height:1px;padding-right:15px;padding-left:15px}.col-xs-1,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9,.col-xs-10,.col-xs-11,.col-xs-12{float:left}.col-xs-12{width:100%}.col-xs-11{width:91.66666667%}.col-xs-10{width:83.33333333%}.col-xs-9{width:75%}.col-xs-8{width:66.66666667%}.col-xs-7{width:58.33333333%}.col-xs-6{width:50%}.col-xs-5{width:41.66666667%}.col-xs-4{width:33.33333333%}.col-xs-3{width:25%}.col-xs-2{width:16.66666667%}.col-xs-1{width:8.33333333%}.col-xs-pull-12{right:100%}.col-xs-pull-11{right:91.66666667%}.col-xs-pull-10{right:83.33333333%}.col-xs-pull-9{right:75%}.col-xs-pull-8{right:66.66666667%}.col-xs-pull-7{right:58.33333333%}.col-xs-pull-6{right:50%}.col-xs-pull-5{right:41.66666667%}.col-xs-pull-4{right:33.33333333%}.col-xs-pull-3{right:25%}.col-xs-pull-2{right:16.66666667%}.col-xs-pull-1{right:8.33333333%}.col-xs-pull-0{right:auto}.col-xs-push-12{left:100%}.col-xs-push-11{left:91.66666667%}.col-xs-push-10{left:83.33333333%}.col-xs-push-9{left:75%}.col-xs-push-8{left:66.66666667%}.col-xs-push-7{left:58.33333333%}.col-xs-push-6{left:50%}.col-xs-push-5{left:41.66666667%}.col-xs-push-4{left:33.33333333%}.col-xs-push-3{left:25%}.col-xs-push-2{left:16.66666667%}.col-xs-push-1{left:8.33333333%}.col-xs-push-0{left:auto}.col-xs-offset-12{margin-left:100%}.col-xs-offset-11{margin-left:91.66666667%}.col-xs-offset-10{margin-left:83.33333333%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-8{margin-left:66.66666667%}.col-xs-offset-7{margin-left:58.33333333%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-5{margin-left:41.66666667%}.col-xs-offset-4{margin-left:33.33333333%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-2{margin-left:16.66666667%}.col-xs-offset-1{margin-left:8.33333333%}.col-xs-offset-0{margin-left:0}@media (min-width:768px){.col-sm-1,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-sm-10,.col-sm-11,.col-sm-12{float:left}.col-sm-12{width:100%}.col-sm-11{width:91.66666667%}.col-sm-10{width:83.33333333%}.col-sm-9{width:75%}.col-sm-8{width:66.66666667%}.col-sm-7{width:58.33333333%}.col-sm-6{width:50%}.col-sm-5{width:41.66666667%}.col-sm-4{width:33.33333333%}.col-sm-3{width:25%}.col-sm-2{width:16.66666667%}.col-sm-1{width:8.33333333%}.col-sm-pull-12{right:100%}.col-sm-pull-11{right:91.66666667%}.col-sm-pull-10{right:83.33333333%}.col-sm-pull-9{right:75%}.col-sm-pull-8{right:66.66666667%}.col-sm-pull-7{right:58.33333333%}.col-sm-pull-6{right:50%}.col-sm-pull-5{right:41.66666667%}.col-sm-pull-4{right:33.33333333%}.col-sm-pull-3{right:25%}.col-sm-pull-2{right:16.66666667%}.col-sm-pull-1{right:8.33333333%}.col-sm-pull-0{right:auto}.col-sm-push-12{left:100%}.col-sm-push-11{left:91.66666667%}.col-sm-push-10{left:83.33333333%}.col-sm-push-9{left:75%}.col-sm-push-8{left:66.66666667%}.col-sm-push-7{left:58.33333333%}.col-sm-push-6{left:50%}.col-sm-push-5{left:41.66666667%}.col-sm-push-4{left:33.33333333%}.col-sm-push-3{left:25%}.col-sm-push-2{left:16.66666667%}.col-sm-push-1{left:8.33333333%}.col-sm-push-0{left:auto}.col-sm-offset-12{margin-left:100%}.col-sm-offset-11{margin-left:91.66666667%}.col-sm-offset-10{margin-left:83.33333333%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-8{margin-left:66.66666667%}.col-sm-offset-7{margin-left:58.33333333%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-5{margin-left:41.66666667%}.col-sm-offset-4{margin-left:33.33333333%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-2{margin-left:16.66666667%}.col-sm-offset-1{margin-left:8.33333333%}.col-sm-offset-0{margin-left:0}}
10@media (min-width:992px){.col-md-1,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-md-10,.col-md-11,.col-md-12{float:left}.col-md-12{width:100%}.col-md-11{width:91.66666667%}.col-md-10{width:83.33333333%}.col-md-9{width:75%}.col-md-8{width:66.66666667%}.col-md-7{width:58.33333333%}.col-md-6{width:50%}.col-md-5{width:41.66666667%}.col-md-4{width:33.33333333%}.col-md-3{width:25%}.col-md-2{width:16.66666667%}.col-md-1{width:8.33333333%}.col-md-pull-12{right:100%}.col-md-pull-11{right:91.66666667%}.col-md-pull-10{right:83.33333333%}.col-md-pull-9{right:75%}.col-md-pull-8{right:66.66666667%}.col-md-pull-7{right:58.33333333%}.col-md-pull-6{right:50%}.col-md-pull-5{right:41.66666667%}.col-md-pull-4{right:33.33333333%}.col-md-pull-3{right:25%}.col-md-pull-2{right:16.66666667%}.col-md-pull-1{right:8.33333333%}.col-md-pull-0{right:auto}.col-md-push-12{left:100%}.col-md-push-11{left:91.66666667%}.col-md-push-10{left:83.33333333%}.col-md-push-9{left:75%}.col-md-push-8{left:66.66666667%}.col-md-push-7{left:58.33333333%}.col-md-push-6{left:50%}.col-md-push-5{left:41.66666667%}.col-md-push-4{left:33.33333333%}.col-md-push-3{left:25%}.col-md-push-2{left:16.66666667%}.col-md-push-1{left:8.33333333%}.col-md-push-0{left:auto}.col-md-offset-12{margin-left:100%}.col-md-offset-11{margin-left:91.66666667%}.col-md-offset-10{margin-left:83.33333333%}.col-md-offset-9{margin-left:75%}.col-md-offset-8{margin-left:66.66666667%}.col-md-offset-7{margin-left:58.33333333%}.col-md-offset-6{margin-left:50%}.col-md-offset-5{margin-left:41.66666667%}.col-md-offset-4{margin-left:33.33333333%}.col-md-offset-3{margin-left:25%}.col-md-offset-2{margin-left:16.66666667%}.col-md-offset-1{margin-left:8.33333333%}.col-md-offset-0{margin-left:0}}@media (min-width:1200px){.col-lg-1,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-lg-10,.col-lg-11,.col-lg-12{float:left}.col-lg-12{width:100%}.col-lg-11{width:91.66666667%}.col-lg-10{width:83.33333333%}.col-lg-9{width:75%}.col-lg-8{width:66.66666667%}.col-lg-7{width:58.33333333%}.col-lg-6{width:50%}.col-lg-5{width:41.66666667%}.col-lg-4{width:33.33333333%}.col-lg-3{width:25%}.col-lg-2{width:16.66666667%}.col-lg-1{width:8.33333333%}.col-lg-pull-12{right:100%}.col-lg-pull-11{right:91.66666667%}.col-lg-pull-10{right:83.33333333%}.col-lg-pull-9{right:75%}.col-lg-pull-8{right:66.66666667%}.col-lg-pull-7{right:58.33333333%}.col-lg-pull-6{right:50%}.col-lg-pull-5{right:41.66666667%}.col-lg-pull-4{right:33.33333333%}.col-lg-pull-3{right:25%}.col-lg-pull-2{right:16.66666667%}.col-lg-pull-1{right:8.33333333%}.col-lg-pull-0{right:auto}.col-lg-push-12{left:100%}.col-lg-push-11{left:91.66666667%}.col-lg-push-10{left:83.33333333%}.col-lg-push-9{left:75%}.col-lg-push-8{left:66.66666667%}.col-lg-push-7{left:58.33333333%}.col-lg-push-6{left:50%}.col-lg-push-5{left:41.66666667%}.col-lg-push-4{left:33.33333333%}.col-lg-push-3{left:25%}.col-lg-push-2{left:16.66666667%}.col-lg-push-1{left:8.33333333%}.col-lg-push-0{left:auto}.col-lg-offset-12{margin-left:100%}.col-lg-offset-11{margin-left:91.66666667%}.col-lg-offset-10{margin-left:83.33333333%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-8{margin-left:66.66666667%}.col-lg-offset-7{margin-left:58.33333333%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-5{margin-left:41.66666667%}.col-lg-offset-4{margin-left:33.33333333%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-2{margin-left:16.66666667%}.col-lg-offset-1{margin-left:8.33333333%}.col-lg-offset-0{margin-left:0}}table{background-color:transparent}th{text-align:left}.table{width:100%;max-width:100%;margin-bottom:20px}.table>thead>tr>th,.table>tbody>tr>th,.table>tfoot>tr>th,.table>thead>tr>td,.table>tbody>tr>td,.table>tfoot>tr>td{padding:8px;line-height:1.42857143;vertical-align:top;border-top:1px solid #ddd}.table>thead>tr>th{vertical-align:bottom;border-bottom:2px solid #ddd}.table>caption+thead>tr:first-child>th,.table>colgroup+thead>tr:first-child>th,.table>thead:first-child>tr:first-child>th,.table>caption+thead>tr:first-child>td,.table>colgroup+thead>tr:first-child>td,.table>thead:first-child>tr:first-child>td{border-top:0}.table>tbody+tbody{border-top:2px solid #ddd}.table .table{background-color:#fff}.table-condensed>thead>tr>th,.table-condensed>tbody>tr>th,.table-condensed>tfoot>tr>th,.table-condensed>thead>tr>td,.table-condensed>tbody>tr>td,.table-condensed>tfoot>tr>td{padding:5px}.table-bordered{border:1px solid #ddd}.table-bordered>thead>tr>th,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>tbody>tr>td,.table-bordered>tfoot>tr>td{border:1px solid #ddd}.table-bordered>thead>tr>th,.table-bordered>thead>tr>td{border-bottom-width:2px}.table-striped>tbody>tr:nth-child(odd)>td,.table-striped>tbody>tr:nth-child(odd)>th{background-color:#f9f9f9}.table-hover>tbody>tr:hover>td,.table-hover>tbody>tr:hover>th{background-color:#f5f5f5}table col[class*=col-]{position:static;display:table-column;float:none}table td[class*=col-],table th[class*=col-]{position:static;display:table-cell;float:none}.table>thead>tr>td.active,.table>tbody>tr>td.active,.table>tfoot>tr>td.active,.table>thead>tr>th.active,.table>tbody>tr>th.active,.table>tfoot>tr>th.active,.table>thead>tr.active>td,.table>tbody>tr.active>td,.table>tfoot>tr.active>td,.table>thead>tr.active>th,.table>tbody>tr.active>th,.table>tfoot>tr.active>th{background-color:#f5f5f5}.table-hover>tbody>tr>td.active:hover,.table-hover>tbody>tr>th.active:hover,.table-hover>tbody>tr.active:hover>td,.table-hover>tbody>tr:hover>.active,.table-hover>tbody>tr.active:hover>th{background-color:#e8e8e8}.table>thead>tr>td.success,.table>tbody>tr>td.success,.table>tfoot>tr>td.success,.table>thead>tr>th.success,.table>tbody>tr>th.success,.table>tfoot>tr>th.success,.table>thead>tr.success>td,.table>tbody>tr.success>td,.table>tfoot>tr.success>td,.table>thead>tr.success>th,.table>tbody>tr.success>th,.table>tfoot>tr.success>th{background-color:#dff0d8}.table-hover>tbody>tr>td.success:hover,.table-hover>tbody>tr>th.success:hover,.table-hover>tbody>tr.success:hover>td,.table-hover>tbody>tr:hover>.success,.table-hover>tbody>tr.success:hover>th{background-color:#d0e9c6}.table>thead>tr>td.info,.table>tbody>tr>td.info,.table>tfoot>tr>td.info,.table>thead>tr>th.info,.table>tbody>tr>th.info,.table>tfoot>tr>th.info,.table>thead>tr.info>td,.table>tbody>tr.info>td,.table>tfoot>tr.info>td,.table>thead>tr.info>th,.table>tbody>tr.info>th,.table>tfoot>tr.info>th{background-color:#d9edf7}.table-hover>tbody>tr>td.info:hover,.table-hover>tbody>tr>th.info:hover,.table-hover>tbody>tr.info:hover>td,.table-hover>tbody>tr:hover>.info,.table-hover>tbody>tr.info:hover>th{background-color:#c4e3f3}.table>thead>tr>td.warning,.table>tbody>tr>td.warning,.table>tfoot>tr>td.warning,.table>thead>tr>th.warning,.table>tbody>tr>th.warning,.table>tfoot>tr>th.warning,.table>thead>tr.warning>td,.table>tbody>tr.warning>td,.table>tfoot>tr.warning>td,.table>thead>tr.warning>th,.table>tbody>tr.warning>th,.table>tfoot>tr.warning>th{background-color:#fcf8e3}.table-hover>tbody>tr>td.warning:hover,.table-hover>tbody>tr>th.warning:hover,.table-hover>tbody>tr.warning:hover>td,.table-hover>tbody>tr:hover>.warning,.table-hover>tbody>tr.warning:hover>th{background-color:#faf2cc}.table>thead>tr>td.danger,.table>tbody>tr>td.danger,.table>tfoot>tr>td.danger,.table>thead>tr>th.danger,.table>tbody>tr>th.danger,.table>tfoot>tr>th.danger,.table>thead>tr.danger>td,.table>tbody>tr.danger>td,.table>tfoot>tr.danger>td,.table>thead>tr.danger>th,.table>tbody>tr.danger>th,.table>tfoot>tr.danger>th{background-color:#f2dede}.table-hover>tbody>tr>td.danger:hover,.table-hover>tbody>tr>th.danger:hover,.table-hover>tbody>tr.danger:hover>td,.table-hover>tbody>tr:hover>.danger,.table-hover>tbody>tr.danger:hover>th{background-color:#ebcccc}@media screen and (max-width:767px){.table-responsive{width:100%;margin-bottom:15px;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar;border:1px solid #ddd}.table-responsive>.table{margin-bottom:0}.table-responsive>.table>thead>tr>th,.table-responsive>.table>tbody>tr>th,.table-responsive>.table>tfoot>tr>th,.table-responsive>.table>thead>tr>td,.table-responsive>.table>tbody>tr>td,.table-responsive>.table>tfoot>tr>td{white-space:nowrap}.table-responsive>.table-bordered{border:0}.table-responsive>.table-bordered>thead>tr>th:first-child,.table-responsive>.table-bordered>tbody>tr>th:first-child,.table-responsive>.table-bordered>tfoot>tr>th:first-child,.table-responsive>.table-bordered>thead>tr>td:first-child,.table-responsive>.table-bordered>tbody>tr>td:first-child,.table-responsive>.table-bordered>tfoot>tr>td:first-child{border-left:0}.table-responsive>.table-bordered>thead>tr>th:last-child,.table-responsive>.table-bordered>tbody>tr>th:last-child,.table-responsive>.table-bordered>tfoot>tr>th:last-child,.table-responsive>.table-bordered>thead>tr>td:last-child,.table-responsive>.table-bordered>tbody>tr>td:last-child,.table-responsive>.table-bordered>tfoot>tr>td:last-child{border-right:0}.table-responsive>.table-bordered>tbody>tr:last-child>th,.table-responsive>.table-bordered>tfoot>tr:last-child>th,.table-responsive>.table-bordered>tbody>tr:last-child>td,.table-responsive>.table-bordered>tfoot>tr:last-child>td{border-bottom:0}}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:inherit;color:#333;border:0;border-bottom:1px solid #e5e5e5}label{display:inline-block;max-width:100%;margin-bottom:5px;font-weight:700}input[type=search]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type=radio],input[type=checkbox]{margin:4px 0 0;margin-top:1px \9;line-height:normal}input[type=file]{display:block}input[type=range]{display:block;width:100%}select[multiple],select[size]{height:auto}input[type=file]:focus,input[type=radio]:focus,input[type=checkbox]:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}output{display:block;padding-top:7px;font-size:14px;line-height:1.42857143;color:#555}.form-control{display:block;width:100%;height:34px;padding:6px 12px;font-size:14px;line-height:1.42857143;color:#555;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-webkit-transition:border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;-o-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}
10.form-control::-moz-placeholder{color:#777;opacity:1}.form-control:-ms-input-placeholder{color:#777}.form-control::-webkit-input-placeholder{color:#777}.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{cursor:not-allowed;background-color:#eee;opacity:1}textarea.form-control{height:auto}input[type=search]{-webkit-appearance:none}input[type=date],input[type=time],input[type=datetime-local],input[type=month]{line-height:34px;line-height:1.42857143 \0}input[type=date].input-sm,input[type=time].input-sm,input[type=datetime-local].input-sm,input[type=month].input-sm{line-height:30px}input[type=date].input-lg,input[type=time].input-lg,input[type=datetime-local].input-lg,input[type=month].input-lg{line-height:46px}.form-group{margin-bottom:15px}.radio,.checkbox{position:relative;display:block;min-height:20px;margin-top:10px;margin-bottom:10px}.radio label,.checkbox label{padding-left:20px;margin-bottom:0;font-weight:400;cursor:pointer}.radio input[type=radio],.radio-inline input[type=radio],.checkbox input[type=checkbox],.checkbox-inline input[type=checkbox]{position:absolute;margin-top:4px \9;margin-left:-20px}.radio+.radio,.checkbox+.checkbox{margin-top:-5px}.radio-inline,.checkbox-inline{display:inline-block;padding-left:20px;margin-bottom:0;font-weight:400;vertical-align:middle;cursor:pointer}.radio-inline+.radio-inline,.checkbox-inline+.checkbox-inline{margin-top:0;margin-left:10px}input[type=radio][disabled],input[type=checkbox][disabled],input[type=radio].disabled,input[type=checkbox].disabled,fieldset[disabled] input[type=radio],fieldset[disabled] input[type=checkbox]{cursor:not-allowed}.radio-inline.disabled,.checkbox-inline.disabled,fieldset[disabled] .radio-inline,fieldset[disabled] .checkbox-inline{cursor:not-allowed}.radio.disabled label,.checkbox.disabled label,fieldset[disabled] .radio label,fieldset[disabled] .checkbox label{cursor:not-allowed}.form-control-static{padding-top:7px;padding-bottom:7px;margin-bottom:0}.form-control-static.input-lg,.form-control-static.input-sm{padding-right:0;padding-left:0}.input-sm,.form-horizontal .form-group-sm .form-control{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-sm{height:30px;line-height:30px}textarea.input-sm,select[multiple].input-sm{height:auto}.input-lg,.form-horizontal .form-group-lg .form-control{height:46px;padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}select.input-lg{height:46px;line-height:46px}textarea.input-lg,select[multiple].input-lg{height:auto}.has-feedback{position:relative}.has-feedback .form-control{padding-right:42.5px}.form-control-feedback{position:absolute;top:25px;right:0;z-index:2;display:block;width:34px;height:34px;line-height:34px;text-align:center}.input-lg+.form-control-feedback{width:46px;height:46px;line-height:46px}.input-sm+.form-control-feedback{width:30px;height:30px;line-height:30px}.has-success .help-block,.has-success .control-label,.has-success .radio,.has-success .checkbox,.has-success .radio-inline,.has-success .checkbox-inline{color:#3c763d}.has-success .form-control{border-color:#3c763d;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-success .form-control:focus{border-color:#2b542c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168}.has-success .input-group-addon{color:#3c763d;background-color:#dff0d8;border-color:#3c763d}.has-success .form-control-feedback{color:#3c763d}.has-warning .help-block,.has-warning .control-label,.has-warning .radio,.has-warning .checkbox,.has-warning .radio-inline,.has-warning .checkbox-inline{color:#8a6d3b}.has-warning .form-control{border-color:#8a6d3b;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-warning .form-control:focus{border-color:#66512c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b}.has-warning .input-group-addon{color:#8a6d3b;background-color:#fcf8e3;border-color:#8a6d3b}.has-warning .form-control-feedback{color:#8a6d3b}.has-error .help-block,.has-error .control-label,.has-error .radio,.has-error .checkbox,.has-error .radio-inline,.has-error .checkbox-inline{color:#a94442}.has-error .form-control{border-color:#a94442;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-error .form-control:focus{border-color:#843534;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483}.has-error .input-group-addon{color:#a94442;background-color:#f2dede;border-color:#a94442}.has-error .form-control-feedback{color:#a94442}.has-feedback label.sr-only~.form-control-feedback{top:0}.help-block{display:block;margin-top:5px;margin-bottom:10px;color:#737373}
10@media (min-width:768px){.form-inline .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.form-inline .form-control{display:inline-block;width:auto;vertical-align:middle}.form-inline .input-group{display:inline-table;vertical-align:middle}.form-inline .input-group .input-group-addon,.form-inline .input-group .input-group-btn,.form-inline .input-group .form-control{width:auto}.form-inline .input-group>.form-control{width:100%}.form-inline .control-label{margin-bottom:0;vertical-align:middle}.form-inline .radio,.form-inline .checkbox{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.form-inline .radio label,.form-inline .checkbox label{padding-left:0}.form-inline .radio input[type=radio],.form-inline .checkbox input[type=checkbox]{position:relative;margin-left:0}.form-inline .has-feedback .form-control-feedback{top:0}}.form-horizontal .radio,.form-horizontal .checkbox,.form-horizontal .radio-inline,.form-horizontal .checkbox-inline{padding-top:7px;margin-top:0;margin-bottom:0}.form-horizontal .radio,.form-horizontal .checkbox{min-height:27px}.form-horizontal .form-group{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.form-horizontal .control-label{padding-top:7px;margin-bottom:0;text-align:right}}.form-horizontal .has-feedback .form-control-feedback{top:0;right:15px}@media (min-width:768px){.form-horizontal .form-group-lg .control-label{padding-top:14.3px}}@media (min-width:768px){.form-horizontal .form-group-sm .control-label{padding-top:6px}}.btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-image:none;border:1px solid transparent;border-radius:4px}.btn:focus,.btn:active:focus,.btn.active:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn:hover,.btn:focus{color:#333;text-decoration:none}.btn:active,.btn.active{background-image:none;outline:0;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn.disabled,.btn[disabled],fieldset[disabled] .btn{pointer-events:none;cursor:not-allowed;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none;opacity:.65}.btn-default{color:#333;background-color:#fff;border-color:#ccc}.btn-default:hover,.btn-default:focus,.btn-default:active,.btn-default.active,.open>.dropdown-toggle.btn-default{color:#333;background-color:#e6e6e6;border-color:#adadad}.btn-default:active,.btn-default.active,.open>.dropdown-toggle.btn-default{background-image:none}.btn-default.disabled,.btn-default[disabled],fieldset[disabled] .btn-default,.btn-default.disabled:hover,.btn-default[disabled]:hover,fieldset[disabled] .btn-default:hover,.btn-default.disabled:focus,.btn-default[disabled]:focus,fieldset[disabled] .btn-default:focus,.btn-default.disabled:active,.btn-default[disabled]:active,fieldset[disabled] .btn-default:active,.btn-default.disabled.active,.btn-default[disabled].active,fieldset[disabled] .btn-default.active{background-color:#fff;border-color:#ccc}.btn-default .badge{color:#fff;background-color:#333}.btn-primary{color:#fff;background-color:#428bca;border-color:#357ebd}.btn-primary:hover,.btn-primary:focus,.btn-primary:active,.btn-primary.active,.open>.dropdown-toggle.btn-primary{color:#fff;background-color:#3071a9;border-color:#285e8e}.btn-primary:active,.btn-primary.active,.open>.dropdown-toggle.btn-primary{background-image:none}.btn-primary.disabled,.btn-primary[disabled],fieldset[disabled] .btn-primary,.btn-primary.disabled:hover,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary:hover,.btn-primary.disabled:focus,.btn-primary[disabled]:focus,fieldset[disabled] .btn-primary:focus,.btn-primary.disabled:active,.btn-primary[disabled]:active,fieldset[disabled] .btn-primary:active,.btn-primary.disabled.active,.btn-primary[disabled].active,fieldset[disabled] .btn-primary.active{background-color:#428bca;border-color:#357ebd}.btn-primary .badge{color:#428bca;background-color:#fff}.btn-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.btn-success:hover,.btn-success:focus,.btn-success:active,.btn-success.active,.open>.dropdown-toggle.btn-success{color:#fff;background-color:#449d44;border-color:#398439}.btn-success:active,.btn-success.active,.open>.dropdown-toggle.btn-success{background-image:none}.btn-success.disabled,.btn-success[disabled],fieldset[disabled] .btn-success,.btn-success.disabled:hover,.btn-success[disabled]:hover,fieldset[disabled] .btn-success:hover,.btn-success.disabled:focus,.btn-success[disabled]:focus,fieldset[disabled] .btn-success:focus,.btn-success.disabled:active,.btn-success[disabled]:active,fieldset[disabled] .btn-success:active,.btn-success.disabled.active,.btn-success[disabled].active,fieldset[disabled] .btn-success.active{background-color:#5cb85c;border-color:#4cae4c}.btn-success .badge{color:#5cb85c;background-color:#fff}.btn-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}
10.btn-info:hover,.btn-info:focus,.btn-info:active,.btn-info.active,.open>.dropdown-toggle.btn-info{color:#fff;background-color:#31b0d5;border-color:#269abc}.btn-info:active,.btn-info.active,.open>.dropdown-toggle.btn-info{background-image:none}.btn-info.disabled,.btn-info[disabled],fieldset[disabled] .btn-info,.btn-info.disabled:hover,.btn-info[disabled]:hover,fieldset[disabled] .btn-info:hover,.btn-info.disabled:focus,.btn-info[disabled]:focus,fieldset[disabled] .btn-info:focus,.btn-info.disabled:active,.btn-info[disabled]:active,fieldset[disabled] .btn-info:active,.btn-info.disabled.active,.btn-info[disabled].active,fieldset[disabled] .btn-info.active{background-color:#5bc0de;border-color:#46b8da}.btn-info .badge{color:#5bc0de;background-color:#fff}.btn-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.btn-warning:hover,.btn-warning:focus,.btn-warning:active,.btn-warning.active,.open>.dropdown-toggle.btn-warning{color:#fff;background-color:#ec971f;border-color:#d58512}.btn-warning:active,.btn-warning.active,.open>.dropdown-toggle.btn-warning{background-image:none}.btn-warning.disabled,.btn-warning[disabled],fieldset[disabled] .btn-warning,.btn-warning.disabled:hover,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning:hover,.btn-warning.disabled:focus,.btn-warning[disabled]:focus,fieldset[disabled] .btn-warning:focus,.btn-warning.disabled:active,.btn-warning[disabled]:active,fieldset[disabled] .btn-warning:active,.btn-warning.disabled.active,.btn-warning[disabled].active,fieldset[disabled] .btn-warning.active{background-color:#f0ad4e;border-color:#eea236}.btn-warning .badge{color:#f0ad4e;background-color:#fff}.btn-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.btn-danger:hover,.btn-danger:focus,.btn-danger:active,.btn-danger.active,.open>.dropdown-toggle.btn-danger{color:#fff;background-color:#c9302c;border-color:#ac2925}.btn-danger:active,.btn-danger.active,.open>.dropdown-toggle.btn-danger{background-image:none}.btn-danger.disabled,.btn-danger[disabled],fieldset[disabled] .btn-danger,.btn-danger.disabled:hover,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger:hover,.btn-danger.disabled:focus,.btn-danger[disabled]:focus,fieldset[disabled] .btn-danger:focus,.btn-danger.disabled:active,.btn-danger[disabled]:active,fieldset[disabled] .btn-danger:active,.btn-danger.disabled.active,.btn-danger[disabled].active,fieldset[disabled] .btn-danger.active{background-color:#d9534f;border-color:#d43f3a}.btn-danger .badge{color:#d9534f;background-color:#fff}.btn-link{font-weight:400;color:#428bca;cursor:pointer;border-radius:0}.btn-link,.btn-link:active,.btn-link[disabled],fieldset[disabled] .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.btn-link,.btn-link:hover,.btn-link:focus,.btn-link:active{border-color:transparent}.btn-link:hover,.btn-link:focus{color:#2a6496;text-decoration:underline;background-color:transparent}.btn-link[disabled]:hover,fieldset[disabled] .btn-link:hover,.btn-link[disabled]:focus,fieldset[disabled] .btn-link:focus{color:#777;text-decoration:none}.btn-lg,.btn-group-lg>.btn{padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}.btn-sm,.btn-group-sm>.btn{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.btn-xs,.btn-group-xs>.btn{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.btn-block{display:block;width:100%}.btn-block+.btn-block{margin-top:5px}input[type=submit].btn-block,input[type=reset].btn-block,input[type=button].btn-block{width:100%}.fade{opacity:0;-webkit-transition:opacity .15s linear;-o-transition:opacity .15s linear;transition:opacity .15s linear}.fade.in{opacity:1}.collapse{display:none}.collapse.in{display:block}tr.collapse.in{display:table-row}tbody.collapse.in{display:table-row-group}.collapsing{position:relative;height:0;overflow:hidden;-webkit-transition:height .35s ease;-o-transition:height .35s ease;transition:height .35s ease}.caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px solid;border-right:4px solid transparent;border-left:4px solid transparent}.dropdown{position:relative}.dropdown-toggle:focus{outline:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;font-size:14px;text-align:left;list-style:none;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.15);border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175)}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.42857143;color:#333;white-space:nowrap}.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus{color:#262626;text-decoration:none;background-color:#f5f5f5}.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus{color:#fff;text-decoration:none;background-color:#428bca;outline:0}.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>
10a:focus{color:#777}.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{text-decoration:none;cursor:not-allowed;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.open>.dropdown-menu{display:block}.open>a{outline:0}.dropdown-menu-right{right:0;left:auto}.dropdown-menu-left{right:auto;left:0}.dropdown-header{display:block;padding:3px 20px;font-size:12px;line-height:1.42857143;color:#777;white-space:nowrap}.dropdown-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:990}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{content:"";border-top:0;border-bottom:4px solid}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:1px}@media (min-width:768px){.navbar-right .dropdown-menu{right:0;left:auto}.navbar-right .dropdown-menu-left{right:auto;left:0}}.btn-group,.btn-group-vertical{position:relative;display:inline-block;vertical-align:middle}.btn-group>.btn,.btn-group-vertical>.btn{position:relative;float:left}.btn-group>.btn:hover,.btn-group-vertical>.btn:hover,.btn-group>.btn:focus,.btn-group-vertical>.btn:focus,.btn-group>.btn:active,.btn-group-vertical>.btn:active,.btn-group>.btn.active,.btn-group-vertical>.btn.active{z-index:2}.btn-group>.btn:focus,.btn-group-vertical>.btn:focus{outline:0}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group{margin-left:-1px}.btn-toolbar{margin-left:-5px}.btn-toolbar .btn-group,.btn-toolbar .input-group{float:left}.btn-toolbar>.btn,.btn-toolbar>.btn-group,.btn-toolbar>.input-group{margin-left:5px}.btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.btn-group>.btn:first-child{margin-left:0}.btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn:last-child:not(:first-child),.btn-group>.dropdown-toggle:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.btn-group>.btn-group{float:left}.btn-group>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group>.btn-group:first-child>.btn:last-child,.btn-group>.btn-group:first-child>.dropdown-toggle{border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn-group:last-child>.btn:first-child{border-top-left-radius:0;border-bottom-left-radius:0}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group>.btn+.dropdown-toggle{padding-right:8px;padding-left:8px}.btn-group>.btn-lg+.dropdown-toggle{padding-right:12px;padding-left:12px}.btn-group.open .dropdown-toggle{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-group.open .dropdown-toggle.btn-link{-webkit-box-shadow:none;box-shadow:none}.btn .caret{margin-left:0}.btn-lg .caret{border-width:5px 5px 0;border-bottom-width:0}.dropup .btn-lg .caret{border-width:0 5px 5px}.btn-group-vertical>.btn,.btn-group-vertical>.btn-group,.btn-group-vertical>.btn-group>.btn{display:block;float:none;width:100%;max-width:100%}.btn-group-vertical>.btn-group>.btn{float:none}.btn-group-vertical>.btn+.btn,.btn-group-vertical>.btn+.btn-group,.btn-group-vertical>.btn-group+.btn,.btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:not(:first-child):not(:last-child){border-radius:0}.btn-group-vertical>.btn:first-child:not(:last-child){border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn:last-child:not(:first-child){border-top-left-radius:0;border-top-right-radius:0;border-bottom-left-radius:4px}.btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group-vertical>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group-vertical>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-left-radius:0;border-top-right-radius:0}.btn-group-justified{display:table;width:100%;table-layout:fixed;border-collapse:separate}.btn-group-justified>.btn,.btn-group-justified>
10.btn-group{display:table-cell;float:none;width:1%}.btn-group-justified>.btn-group .btn{width:100%}.btn-group-justified>.btn-group .dropdown-menu{left:auto}[data-toggle=buttons]>.btn>input[type=radio],[data-toggle=buttons]>.btn>input[type=checkbox]{position:absolute;z-index:-1;filter:alpha(opacity=0);opacity:0}.input-group{position:relative;display:table;border-collapse:separate}.input-group[class*=col-]{float:none;padding-right:0;padding-left:0}.input-group .form-control{position:relative;z-index:2;float:left;width:100%;margin-bottom:0}.input-group-lg>.form-control,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.btn{height:46px;padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}select.input-group-lg>.form-control,select.input-group-lg>.input-group-addon,select.input-group-lg>.input-group-btn>.btn{height:46px;line-height:46px}textarea.input-group-lg>.form-control,textarea.input-group-lg>.input-group-addon,textarea.input-group-lg>.input-group-btn>.btn,select[multiple].input-group-lg>.form-control,select[multiple].input-group-lg>.input-group-addon,select[multiple].input-group-lg>.input-group-btn>.btn{height:auto}.input-group-sm>.form-control,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.btn{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-group-sm>.form-control,select.input-group-sm>.input-group-addon,select.input-group-sm>.input-group-btn>.btn{height:30px;line-height:30px}textarea.input-group-sm>.form-control,textarea.input-group-sm>.input-group-addon,textarea.input-group-sm>.input-group-btn>.btn,select[multiple].input-group-sm>.form-control,select[multiple].input-group-sm>.input-group-addon,select[multiple].input-group-sm>.input-group-btn>.btn{height:auto}.input-group-addon,.input-group-btn,.input-group .form-control{display:table-cell}
10.input-group-addon:not(:first-child):not(:last-child),.input-group-btn:not(:first-child):not(:last-child),.input-group .form-control:not(:first-child):not(:last-child){border-radius:0}.input-group-addon,.input-group-btn{width:1%;white-space:nowrap;vertical-align:middle}.input-group-addon{padding:6px 12px;font-size:14px;font-weight:400;line-height:1;color:#555;text-align:center;background-color:#eee;border:1px solid #ccc;border-radius:4px}.input-group-addon.input-sm{padding:5px 10px;font-size:12px;border-radius:3px}.input-group-addon.input-lg{padding:10px 16px;font-size:18px;border-radius:6px}.input-group-addon input[type=radio],.input-group-addon input[type=checkbox]{margin-top:0}.input-group .form-control:first-child,.input-group-addon:first-child,.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group>.btn,.input-group-btn:first-child>.dropdown-toggle,.input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle),.input-group-btn:last-child>.btn-group:not(:last-child)>.btn{border-top-right-radius:0;border-bottom-right-radius:0}.input-group-addon:first-child{border-right:0}.input-group .form-control:last-child,.input-group-addon:last-child,.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group>.btn,.input-group-btn:last-child>.dropdown-toggle,.input-group-btn:first-child>.btn:not(:first-child),.input-group-btn:first-child>.btn-group:not(:first-child)>.btn{border-top-left-radius:0;border-bottom-left-radius:0}.input-group-addon:last-child{border-left:0}.input-group-btn{position:relative;font-size:0;white-space:nowrap}.input-group-btn>.btn{position:relative}.input-group-btn>.btn+.btn{margin-left:-1px}.input-group-btn>.btn:hover,.input-group-btn>.btn:focus,.input-group-btn>.btn:active{z-index:2}.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group{margin-right:-1px}.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group{margin-left:-1px}.nav{padding-left:0;margin-bottom:0;list-style:none}.nav>li{position:relative;display:block}.nav>li>a{position:relative;display:block;padding:10px 15px}.nav>li>a:hover,.nav>li>a:focus{text-decoration:none;background-color:#eee}.nav>li.disabled>a{color:#777}.nav>li.disabled>a:hover,.nav>li.disabled>a:focus{color:#777;text-decoration:none;cursor:not-allowed;background-color:transparent}.nav .open>a,.nav .open>a:hover,.nav .open>a:focus{background-color:#eee;border-color:#428bca}.nav .nav-divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.nav>li>a>img{max-width:none}.nav-tabs{border-bottom:1px solid #ddd}.nav-tabs>li{float:left;margin-bottom:-1px}.nav-tabs>li>a{margin-right:2px;line-height:1.42857143;border:1px solid transparent;border-radius:4px 4px 0 0}.nav-tabs>li>a:hover{border-color:#eee #eee #ddd}.nav-tabs>li.active>a,.nav-tabs>li.active>a:hover,.nav-tabs>li.active>a:focus{color:#555;cursor:default;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent}.nav-tabs.nav-justified{width:100%;border-bottom:0}.nav-tabs.nav-justified>li{float:none}.nav-tabs.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-tabs.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-tabs.nav-justified>li{display:table-cell;width:1%}.nav-tabs.nav-justified>li>a{margin-bottom:0}}.nav-tabs.nav-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a:focus{border:1px solid #ddd}@media (min-width:768px){.nav-tabs.nav-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a:focus{border-bottom-color:#fff}}.nav-pills>li{float:left}.nav-pills>li>a{border-radius:4px}.nav-pills>li+li{margin-left:2px}.nav-pills>li.active>a,.nav-pills>li.active>a:hover,.nav-pills>li.active>a:focus{color:#fff;background-color:#428bca}.nav-stacked>li{float:none}.nav-stacked>li+li{margin-top:2px;margin-left:0}.nav-justified{width:100%}.nav-justified>li{float:none}.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-justified>li{display:table-cell;width:1%}.nav-justified>li>a{margin-bottom:0}}.nav-tabs-justified{border-bottom:0}.nav-tabs-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:hover,.nav-tabs-justified>.active>a:focus{border:1px solid #ddd}@media (min-width:768px){.nav-tabs-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:hover,.nav-tabs-justified>.active>a:focus{border-bottom-color:#fff}}.tab-content>.tab-pane{display:none}.tab-content>.active{display:block}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-left-radius:0;border-top-right-radius:0}.navbar{position:relative;min-height:50px;margin-bottom:20px;border:1px solid transparent}@media (min-width:768px){.navbar{border-radius:4px}}@media (min-width:768px){.navbar-header{float:left}}.navbar-collapse{padding-right:15px;padding-left:15px;overflow-x:visible;-webkit-overflow-scrolling:touch;border-top:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1)}.navbar-collapse.in{overflow-y:auto}@media (min-width:768px){.navbar-collapse{width:auto;border-top:0;-webkit-box-shadow:none;box-shadow:none}.navbar-collapse.collapse{display:block!important;height:auto!important;padding-bottom:0;overflow:visible!important}.navbar-collapse.in{overflow-y:visible}.navbar-fixed-top .navbar-collapse,.navbar-static-top .navbar-collapse,.navbar-fixed-bottom .navbar-collapse{padding-right:0;padding-left:0}}.navbar-fixed-top .navbar-collapse,.navbar-fixed-bottom .navbar-collapse{max-height:340px}
10@media (max-width:480px) and (orientation:landscape){.navbar-fixed-top .navbar-collapse,.navbar-fixed-bottom .navbar-collapse{max-height:200px}}.container>.navbar-header,.container-fluid>.navbar-header,.container>.navbar-collapse,.container-fluid>.navbar-collapse{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.container>.navbar-header,.container-fluid>.navbar-header,.container>.navbar-collapse,.container-fluid>.navbar-collapse{margin-right:0;margin-left:0}}.navbar-static-top{z-index:1000;border-width:0 0 1px}@media (min-width:768px){.navbar-static-top{border-radius:0}}.navbar-fixed-top,.navbar-fixed-bottom{position:fixed;right:0;left:0;z-index:1030;-webkit-transform:translate3d(0,0,0);-o-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}@media (min-width:768px){.navbar-fixed-top,.navbar-fixed-bottom{border-radius:0}}.navbar-fixed-top{top:0;border-width:0 0 1px}.navbar-fixed-bottom{bottom:0;margin-bottom:0;border-width:1px 0 0}.navbar-brand{float:left;height:50px;padding:15px 15px;font-size:18px;line-height:20px}.navbar-brand:hover,.navbar-brand:focus{text-decoration:none}@media (min-width:768px){.navbar>.container .navbar-brand,.navbar>.container-fluid .navbar-brand{margin-left:-15px}}.navbar-toggle{position:relative;float:right;padding:9px 10px;margin-top:8px;margin-right:15px;margin-bottom:8px;background-color:transparent;background-image:none;border:1px solid transparent;border-radius:4px}.navbar-toggle:focus{outline:0}.navbar-toggle .icon-bar{display:block;width:22px;height:2px;border-radius:1px}.navbar-toggle .icon-bar+.icon-bar{margin-top:4px}@media (min-width:768px){.navbar-toggle{display:none}}.navbar-nav{margin:7.5px -15px}.navbar-nav>li>a{padding-top:10px;padding-bottom:10px;line-height:20px}@media (max-width:767px){.navbar-nav .open .dropdown-menu{position:static;float:none;width:auto;margin-top:0;background-color:transparent;border:0;-webkit-box-shadow:none;box-shadow:none}.navbar-nav .open .dropdown-menu>li>a,.navbar-nav .open .dropdown-menu .dropdown-header{padding:5px 15px 5px 25px}.navbar-nav .open .dropdown-menu>li>a{line-height:20px}.navbar-nav .open .dropdown-menu>li>a:hover,.navbar-nav .open .dropdown-menu>li>a:focus{background-image:none}}@media (min-width:768px){.navbar-nav{float:left;margin:0}.navbar-nav>li{float:left}.navbar-nav>li>a{padding-top:15px;padding-bottom:15px}.navbar-nav.navbar-right:last-child{margin-right:-15px}}@media (min-width:768px){.navbar-left{float:left!important}.navbar-right{float:right!important}}.navbar-form{padding:10px 15px;margin-top:8px;margin-right:-15px;margin-bottom:8px;margin-left:-15px;border-top:1px solid transparent;border-bottom:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1)}
10@media (min-width:768px){.navbar-form .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.navbar-form .form-control{display:inline-block;width:auto;vertical-align:middle}.navbar-form .input-group{display:inline-table;vertical-align:middle}.navbar-form .input-group .input-group-addon,.navbar-form .input-group .input-group-btn,.navbar-form .input-group .form-control{width:auto}.navbar-form .input-group>.form-control{width:100%}.navbar-form .control-label{margin-bottom:0;vertical-align:middle}.navbar-form .radio,.navbar-form .checkbox{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.navbar-form .radio label,.navbar-form .checkbox label{padding-left:0}.navbar-form .radio input[type=radio],.navbar-form .checkbox input[type=checkbox]{position:relative;margin-left:0}.navbar-form .has-feedback .form-control-feedback{top:0}}@media (max-width:767px){.navbar-form .form-group{margin-bottom:5px}}@media (min-width:768px){.navbar-form{width:auto;padding-top:0;padding-bottom:0;margin-right:0;margin-left:0;border:0;-webkit-box-shadow:none;box-shadow:none}.navbar-form.navbar-right:last-child{margin-right:-15px}}.navbar-nav>li>.dropdown-menu{margin-top:0;border-top-left-radius:0;border-top-right-radius:0}.navbar-fixed-bottom .navbar-nav>li>.dropdown-menu{border-bottom-right-radius:0;border-bottom-left-radius:0}.navbar-btn{margin-top:8px;margin-bottom:8px}.navbar-btn.btn-sm{margin-top:10px;margin-bottom:10px}.navbar-btn.btn-xs{margin-top:14px;margin-bottom:14px}.navbar-text{margin-top:15px;margin-bottom:15px}@media (min-width:768px){.navbar-text{float:left;margin-right:15px;margin-left:15px}.navbar-text.navbar-right:last-child{margin-right:0}}.navbar-default{background-color:#f8f8f8;border-color:#e7e7e7}.navbar-default .navbar-brand{color:#777}.navbar-default .navbar-brand:hover,.navbar-default .navbar-brand:focus{color:#5e5e5e;background-color:transparent}.navbar-default .navbar-text{color:#777}.navbar-default .navbar-nav>li>a{color:#777}.navbar-default .navbar-nav>li>a:hover,.navbar-default .navbar-nav>li>a:focus{color:#333;background-color:transparent}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:hover,.navbar-default .navbar-nav>.active>a:focus{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav>.disabled>a,.navbar-default .navbar-nav>.disabled>a:hover,.navbar-default .navbar-nav>.disabled>a:focus{color:#ccc;background-color:transparent}.navbar-default .navbar-toggle{border-color:#ddd}.navbar-default .navbar-toggle:hover,.navbar-default .navbar-toggle:focus{background-color:#ddd}.navbar-default .navbar-toggle .icon-bar{background-color:#888}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#e7e7e7}.navbar-default .navbar-nav>.open>a,.navbar-default .navbar-nav>.open>a:hover,.navbar-default .navbar-nav>.open>a:focus{color:#555;background-color:#e7e7e7}@media (max-width:767px){.navbar-default .navbar-nav .open .dropdown-menu>li>a{color:#777}.navbar-default .navbar-nav .open .dropdown-menu>li>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>li>a:focus{color:#333;background-color:transparent}.navbar-default .navbar-nav .open .dropdown-menu>.active>a,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:focus{color:#ccc;background-color:transparent}}.navbar-default .navbar-link{color:#777}.navbar-default .navbar-link:hover{color:#333}.navbar-default .btn-link{color:#777}.navbar-default .btn-link:hover,.navbar-default .btn-link:focus{color:#333}.navbar-default .btn-link[disabled]:hover,fieldset[disabled] .navbar-default .btn-link:hover,.navbar-default .btn-link[disabled]:focus,fieldset[disabled] .navbar-default .btn-link:focus{color:#ccc}.navbar-inverse{background-color:#222;border-color:#080808}
10.navbar-inverse .navbar-brand{color:#777}.navbar-inverse .navbar-brand:hover,.navbar-inverse .navbar-brand:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-text{color:#777}.navbar-inverse .navbar-nav>li>a{color:#777}.navbar-inverse .navbar-nav>li>a:hover,.navbar-inverse .navbar-nav>li>a:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.active>a:hover,.navbar-inverse .navbar-nav>.active>a:focus{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav>.disabled>a,.navbar-inverse .navbar-nav>.disabled>a:hover,.navbar-inverse .navbar-nav>.disabled>a:focus{color:#444;background-color:transparent}.navbar-inverse .navbar-toggle{border-color:#333}.navbar-inverse .navbar-toggle:hover,.navbar-inverse .navbar-toggle:focus{background-color:#333}.navbar-inverse .navbar-toggle .icon-bar{background-color:#fff}.navbar-inverse .navbar-collapse,.navbar-inverse .navbar-form{border-color:#101010}.navbar-inverse .navbar-nav>.open>a,.navbar-inverse .navbar-nav>.open>a:hover,.navbar-inverse .navbar-nav>.open>a:focus{color:#fff;background-color:#080808}@media (max-width:767px){.navbar-inverse .navbar-nav .open .dropdown-menu>.dropdown-header{border-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu .divider{background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a{color:#777}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:focus{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:focus{color:#444;background-color:transparent}}.navbar-inverse .navbar-link{color:#777}.navbar-inverse .navbar-link:hover{color:#fff}.navbar-inverse .btn-link{color:#777}.navbar-inverse .btn-link:hover,.navbar-inverse .btn-link:focus{color:#fff}.navbar-inverse .btn-link[disabled]:hover,fieldset[disabled] .navbar-inverse .btn-link:hover,.navbar-inverse .btn-link[disabled]:focus,fieldset[disabled] .navbar-inverse .btn-link:focus{color:#444}.breadcrumb{padding:8px 15px;margin-bottom:20px;list-style:none;background-color:#f5f5f5;border-radius:4px}.breadcrumb>li{display:inline-block}.breadcrumb>li+li:before{padding:0 5px;color:#ccc;content:"/\00a0"}.breadcrumb>.active{color:#777}.pagination{display:inline-block;padding-left:0;margin:20px 0;border-radius:4px}.pagination>li{display:inline}.pagination>li>a,.pagination>li>span{position:relative;float:left;padding:6px 12px;margin-left:-1px;line-height:1.42857143;color:#428bca;text-decoration:none;background-color:#fff;border:1px solid #ddd}.pagination>li:first-child>a,.pagination>li:first-child>span{margin-left:0;border-top-left-radius:4px;border-bottom-left-radius:4px}.pagination>li:last-child>a,.pagination>li:last-child>span{border-top-right-radius:4px;border-bottom-right-radius:4px}.pagination>li>a:hover,.pagination>li>span:hover,.pagination>li>a:focus,.pagination>li>span:focus{color:#2a6496;background-color:#eee;border-color:#ddd}.pagination>.active>a,.pagination>.active>span,.pagination>.active>a:hover,.pagination>.active>span:hover,.pagination>.active>a:focus,.pagination>.active>span:focus{z-index:2;color:#fff;cursor:default;background-color:#428bca;border-color:#428bca}.pagination>.disabled>span,.pagination>.disabled>span:hover,.pagination>.disabled>span:focus,.pagination>.disabled>a,.pagination>.disabled>a:hover,.pagination>.disabled>a:focus{color:#777;cursor:not-allowed;background-color:#fff;border-color:#ddd}.pagination-lg>li>a,.pagination-lg>li>span{padding:10px 16px;font-size:18px}.pagination-lg>li:first-child>a,.pagination-lg>li:first-child>span{border-top-left-radius:6px;border-bottom-left-radius:6px}.pagination-lg>li:last-child>a,.pagination-lg>li:last-child>span{border-top-right-radius:6px;border-bottom-right-radius:6px}.pagination-sm>li>a,.pagination-sm>li>span{padding:5px 10px;font-size:12px}.pagination-sm>li:first-child>a,.pagination-sm>li:first-child>span{border-top-left-radius:3px;border-bottom-left-radius:3px}.pagination-sm>li:last-child>a,.pagination-sm>li:last-child>span{border-top-right-radius:3px;border-bottom-right-radius:3px}.pager{padding-left:0;margin:20px 0;text-align:center;list-style:none}.pager li{display:inline}.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;border-radius:15px}.pager li>a:hover,.pager li>a:focus{text-decoration:none;background-color:#eee}.pager .next>a,.pager .next>span{float:right}.pager .previous>a,.pager .previous>span{float:left}.pager .disabled>a,.pager .disabled>a:hover,.pager .disabled>a:focus,.pager .disabled>
10span{color:#777;cursor:not-allowed;background-color:#fff}.label{display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em}a.label:hover,a.label:focus{color:#fff;text-decoration:none;cursor:pointer}.label:empty{display:none}.btn .label{position:relative;top:-1px}.label-default{background-color:#777}.label-default[href]:hover,.label-default[href]:focus{background-color:#5e5e5e}.label-primary{background-color:#428bca}.label-primary[href]:hover,.label-primary[href]:focus{background-color:#3071a9}.label-success{background-color:#5cb85c}.label-success[href]:hover,.label-success[href]:focus{background-color:#449d44}.label-info{background-color:#5bc0de}.label-info[href]:hover,.label-info[href]:focus{background-color:#31b0d5}.label-warning{background-color:#f0ad4e}.label-warning[href]:hover,.label-warning[href]:focus{background-color:#ec971f}.label-danger{background-color:#d9534f}.label-danger[href]:hover,.label-danger[href]:focus{background-color:#c9302c}.badge{display:inline-block;min-width:10px;padding:3px 7px;font-size:12px;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;background-color:#777;border-radius:10px}.badge:empty{display:none}.btn .badge{position:relative;top:-1px}.btn-xs .badge{top:0;padding:1px 5px}a.badge:hover,a.badge:focus{color:#fff;text-decoration:none;cursor:pointer}a.list-group-item.active>.badge,.nav-pills>.active>a>.badge{color:#428bca;background-color:#fff}.nav-pills>li>a>.badge{margin-left:3px}.jumbotron{padding:30px;margin-bottom:30px;color:inherit;background-color:#eee}.jumbotron h1,.jumbotron .h1{color:inherit}.jumbotron p{margin-bottom:15px;font-size:21px;font-weight:200}.jumbotron>hr{border-top-color:#d5d5d5}.container .jumbotron{border-radius:6px}.jumbotron .container{max-width:100%}@media screen and (min-width:768px){.jumbotron{padding-top:48px;padding-bottom:48px}.container .jumbotron{padding-right:60px;padding-left:60px}.jumbotron h1,.jumbotron .h1{font-size:63px}}.thumbnail{display:block;padding:4px;margin-bottom:20px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.thumbnail>img,.thumbnail a>img{margin-right:auto;margin-left:auto}a.thumbnail:hover,a.thumbnail:focus,a.thumbnail.active{border-color:#428bca}.thumbnail .caption{padding:9px;color:#333}.alert{padding:15px;margin-bottom:20px;border:1px solid transparent;border-radius:4px}.alert h4{margin-top:0;color:inherit}.alert .alert-link{font-weight:700}.alert>p,.alert>ul{margin-bottom:0}.alert>p+p{margin-top:5px}.alert-dismissable,.alert-dismissible{padding-right:35px}.alert-dismissable .close,.alert-dismissible .close{position:relative;top:-2px;right:-21px;color:inherit}.alert-success{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.alert-success hr{border-top-color:#c9e2b3}.alert-success .alert-link{color:#2b542c}.alert-info{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.alert-info hr{border-top-color:#a6e1ec}.alert-info .alert-link{color:#245269}.alert-warning{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.alert-warning hr{border-top-color:#f7e1b5}.alert-warning .alert-link{color:#66512c}.alert-danger{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.alert-danger hr{border-top-color:#e4b9c0}.alert-danger .alert-link{color:#843534}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-o-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}.progress{height:20px;margin-bottom:20px;overflow:hidden;background-color:#f5f5f5;border-radius:4px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);box-shadow:inset 0 1px 2px rgba(0,0,0,.1)}.progress-bar{float:left;width:0;height:100%;font-size:12px;line-height:20px;color:#fff;text-align:center;background-color:#428bca;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);-webkit-transition:width .6s ease;-o-transition:width .6s ease;transition:width .6s ease}.progress-striped .progress-bar,.progress-bar-striped{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);-webkit-background-size:40px 40px;background-size:40px 40px}.progress.active .progress-bar,.progress-bar.active{-webkit-animation:progress-bar-stripes 2s linear infinite;-o-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.progress-bar[aria-valuenow="1"],.progress-bar[aria-valuenow="2"]{min-width:30px}.progress-bar[aria-valuenow="0"]{min-width:30px;
10color:#777;background-color:transparent;background-image:none;-webkit-box-shadow:none;box-shadow:none}.progress-bar-success{background-color:#5cb85c}.progress-striped .progress-bar-success{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-info{background-color:#5bc0de}.progress-striped .progress-bar-info{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-warning{background-color:#f0ad4e}.progress-striped .progress-bar-warning{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-danger{background-color:#d9534f}.progress-striped .progress-bar-danger{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.media,.media-body{overflow:hidden;zoom:1}.media,.media .media{margin-top:15px}.media:first-child{margin-top:0}.media-object{display:block}.media-heading{margin:0 0 5px}.media>.pull-left{margin-right:10px}.media>.pull-right{margin-left:10px}.media-list{padding-left:0;list-style:none}.list-group{padding-left:0;margin-bottom:20px}.list-group-item{position:relative;display:block;padding:10px 15px;margin-bottom:-1px;background-color:#fff;border:1px solid #ddd}.list-group-item:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.list-group-item:last-child{margin-bottom:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}.list-group-item>.badge{float:right}.list-group-item>.badge+.badge{margin-right:5px}a.list-group-item{color:#555}a.list-group-item .list-group-item-heading{color:#333}a.list-group-item:hover,a.list-group-item:focus{color:#555;text-decoration:none;background-color:#f5f5f5}.list-group-item.disabled,.list-group-item.disabled:hover,.list-group-item.disabled:focus{color:#777;background-color:#eee}.list-group-item.disabled .list-group-item-heading,.list-group-item.disabled:hover .list-group-item-heading,.list-group-item.disabled:focus .list-group-item-heading{color:inherit}.list-group-item.disabled .list-group-item-text,.list-group-item.disabled:hover .list-group-item-text,.list-group-item.disabled:focus .list-group-item-text{color:#777}.list-group-item.active,.list-group-item.active:hover,.list-group-item.active:focus{z-index:2;color:#fff;background-color:#428bca;border-color:#428bca}.list-group-item.active .list-group-item-heading,.list-group-item.active:hover .list-group-item-heading,.list-group-item.active:focus .list-group-item-heading,.list-group-item.active .list-group-item-heading>small,.list-group-item.active:hover .list-group-item-heading>small,.list-group-item.active:focus .list-group-item-heading>small,.list-group-item.active .list-group-item-heading>.small,.list-group-item.active:hover .list-group-item-heading>.small,.list-group-item.active:focus .list-group-item-heading>.small{color:inherit}.list-group-item.active .list-group-item-text,.list-group-item.active:hover .list-group-item-text,.list-group-item.active:focus .list-group-item-text{color:#e1edf7}.list-group-item-success{color:#3c763d;background-color:#dff0d8}a.list-group-item-success{color:#3c763d}a.list-group-item-success .list-group-item-heading{color:inherit}a.list-group-item-success:hover,a.list-group-item-success:focus{color:#3c763d;background-color:#d0e9c6}a.list-group-item-success.active,a.list-group-item-success.active:hover,a.list-group-item-success.active:focus{color:#fff;background-color:#3c763d;border-color:#3c763d}.list-group-item-info{color:#31708f;background-color:#d9edf7}a.list-group-item-info{color:#31708f}a.list-group-item-info .list-group-item-heading{color:inherit}a.list-group-item-info:hover,a.list-group-item-info:focus{color:#31708f;background-color:#c4e3f3}a.list-group-item-info.active,a.list-group-item-info.active:hover,a.list-group-item-info.active:focus{color:#fff;background-color:#31708f;border-color:#31708f}.list-group-item-warning{color:#8a6d3b;background-color:#fcf8e3}a.list-group-item-warning{color:#8a6d3b}a.list-group-item-warning .list-group-item-heading{color:inherit}a.list-group-item-warning:hover,a.list-group-item-warning:focus{color:#8a6d3b;background-color:#faf2cc}a.list-group-item-warning.active,a.list-group-item-warning.active:hover,a.list-group-item-warning.active:focus{color:#fff;background-color:#8a6d3b;border-color:#8a6d3b}.list-group-item-danger{color:#a94442;background-color:#f2dede}a.list-group-item-danger{color:#a94442}a.list-group-item-danger .list-group-item-heading{color:inherit}a.list-group-item-danger:hover,a.list-group-item-danger:focus{color:#a94442;background-color:#ebcccc}a.list-group-item-danger.active,a.list-group-item-danger.active:hover,a.list-group-item-danger.active:focus{color:#fff;background-color:#a94442;border-color:#a94442}.list-group-item-heading{margin-top:0;margin-bottom:5px}.list-group-item-text{margin-bottom:0;line-height:1.3}.panel{margin-bottom:20px;background-color:#fff;border:1px solid transparent;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05)}.panel-body{padding:15px}.panel-heading{padding:10px 15px;border-bottom:1px solid transparent;border-top-left-radius:3px;border-top-right-radius:3px}.panel-heading>.dropdown .dropdown-toggle{color:inherit}.panel-title{margin-top:0;margin-bottom:0;font-size:16px;color:inherit}.panel-title>a{color:inherit}.panel-footer{padding:10px 15px;background-color:#f5f5f5;border-top:1px solid #ddd;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.list-group{margin-bottom:0}.panel>.list-group .list-group-item{border-width:1px 0;border-radius:0}.panel>.list-group:first-child .list-group-item:first-child{border-top:0;border-top-left-radius:3px;border-top-right-radius:3px}.panel>.list-group:last-child .list-group-item:last-child{border-bottom:0;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel-heading+.list-group .list-group-item:first-child{border-top-width:0}.list-group+.panel-footer{border-top-width:0}.panel>.table,.panel>.table-responsive>.table,.panel>.panel-collapse>.table{margin-bottom:0}.panel>.table:first-child,.panel>.table-responsive:first-child>.table:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:first-child{border-top-left-radius:3px}.panel>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:last-child{border-top-right-radius:3px}.panel>.table:last-child,.panel>.table-responsive:last-child>.table:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:first-child{border-bottom-left-radius:3px}.panel>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:last-child{border-bottom-right-radius:3px}.panel>.panel-body+.table,.panel>.panel-body+.table-responsive{border-top:1px solid #ddd}.panel>.table>tbody:first-child>tr:first-child th,.panel>.table>tbody:first-child>tr:first-child td{border-top:0}.panel>.table-bordered,.panel>.table-responsive>.table-bordered{border:0}.panel>.table-bordered>thead>tr>th:first-child,.panel>.table-responsive>.table-bordered>thead>tr>th:first-child,.panel>.table-bordered>tbody>tr>th:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:first-child,.panel>.table-bordered>tfoot>tr>th:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:first-child,.panel>.table-bordered>thead>tr>td:first-child,.panel>.table-responsive>.table-bordered>thead>tr>td:first-child,.panel>.table-bordered>tbody>tr>td:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:first-child,.panel>.table-bordered>tfoot>tr>td:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:first-child{border-left:0}.panel>.table-bordered>thead>tr>th:last-child,.panel>.table-responsive>.table-bordered>thead>tr>th:last-child,.panel>.table-bordered>tbody>tr>th:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:last-child,.panel>.table-bordered>tfoot>tr>th:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:last-child,.panel>.table-bordered>thead>tr>td:last-child,.panel>.table-responsive>.table-bordered>thead>tr>td:last-child,.panel>.table-bordered>tbody>tr>td:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:last-child,.panel>.table-bordered>tfoot>tr>td:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:last-child{border-right:0}.panel>.table-bordered>thead>tr:first-child>td,.panel>.table-responsive>.table-bordered>thead>tr:first-child>td,.panel>.table-bordered>tbody>tr:first-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>td,.panel>.table-bordered>thead>tr:first-child>th,.panel>.table-responsive>.table-bordered>thead>tr:first-child>th,.panel>.table-bordered>tbody>tr:first-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>th{border-bottom:0}.panel>.table-bordered>tbody>tr:last-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>td,.panel>.table-bordered>tfoot>tr:last-child>td,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>td,.panel>.table-bordered>tbody>tr:last-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>th,.panel>.table-bordered>tfoot>tr:last-child>th,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}.panel>.table-responsive{margin-bottom:0;border:0}.panel-group{margin-bottom:20px}.panel-group .panel{margin-bottom:0;border-radius:4px}.panel-group .panel+.panel{margin-top:5px}.panel-group .panel-heading{border-bottom:0}.panel-group .panel-heading+.panel-collapse>.panel-body{border-top:1px solid #ddd}.panel-group .panel-footer{border-top:0}.panel-group .panel-footer+.panel-collapse .panel-body{border-bottom:1px solid #ddd}.panel-default{border-color:#ddd}.panel-default>.panel-heading{color:#333;background-color:#f5f5f5;border-color:#ddd}.panel-default>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ddd}.panel-default>.panel-heading .badge{color:#f5f5f5;background-color:#333}.panel-default>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ddd}.panel-primary{border-color:#428bca}.panel-primary>.panel-heading{color:#fff;background-color:#428bca;border-color:#428bca}.panel-primary>.panel-heading+.panel-collapse>.panel-body{border-top-color:#428bca}.panel-primary>.panel-heading .badge{color:#428bca;background-color:#fff}.panel-primary>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#428bca}.panel-success{border-color:#d6e9c6}.panel-success>.panel-heading{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.panel-success>.panel-heading+.panel-collapse>.panel-body{border-top-color:#d6e9c6}.panel-success>.panel-heading .badge{color:#dff0d8;background-color:#3c763d}.panel-success>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#d6e9c6}.panel-info{border-color:#bce8f1}.panel-info>.panel-heading{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.panel-info>.panel-heading+.panel-collapse>.panel-body{border-top-color:#bce8f1}.panel-info>.panel-heading .badge{color:#d9edf7;background-color:#31708f}.panel-info>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#bce8f1}.panel-warning{border-color:#faebcc}.panel-warning>.panel-heading{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.panel-warning>.panel-heading+.panel-collapse>.panel-body{border-top-color:#faebcc}.panel-warning>.panel-heading .badge{color:#fcf8e3;background-color:#8a6d3b}.panel-warning>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#faebcc}.panel-danger{border-color:#ebccd1}.panel-danger>.panel-heading{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.panel-danger>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ebccd1}.panel-danger>.panel-heading .badge{color:#f2dede;background-color:#a94442}.panel-danger>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ebccd1}.embed-responsive{position:relative;display:block;height:0;padding:0;overflow:hidden}.embed-responsive .embed-responsive-item,.embed-responsive iframe,.e
10mbed-responsive embed,.embed-responsive object{position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;border:0}.embed-responsive.embed-responsive-16by9{padding-bottom:56.25%}.embed-responsive.embed-responsive-4by3{padding-bottom:75%}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.05);box-shadow:inset 0 1px 1px rgba(0,0,0,.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,.15)}.well-lg{padding:24px;border-radius:6px}.well-sm{padding:9px;border-radius:3px}.close{float:right;font-size:21px;font-weight:700;line-height:1;color:#000;text-shadow:0 1px 0 #fff;filter:alpha(opacity=20);opacity:.2}.close:hover,.close:focus{color:#000;text-decoration:none;cursor:pointer;filter:alpha(opacity=50);opacity:.5}button.close{-webkit-appearance:none;padding:0;cursor:pointer;background:0 0;border:0}.modal-open{overflow:hidden}.modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1050;display:none;overflow:hidden;-webkit-overflow-scrolling:touch;outline:0}.modal.fade .modal-dialog{-webkit-transition:-webkit-transform .3s ease-out;-o-transition:-o-transform .3s ease-out;transition:transform .3s ease-out;-webkit-transform:translate3d(0,-25%,0);-o-transform:translate3d(0,-25%,0);transform:translate3d(0,-25%,0)}.modal.in .modal-dialog{-webkit-transform:translate3d(0,0,0);-o-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.modal-open .modal{overflow-x:hidden;overflow-y:auto}.modal-dialog{position:relative;width:auto;margin:10px}.modal-content{position:relative;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #999;border:1px solid rgba(0,0,0,.2);border-radius:6px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5)}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000}.modal-backdrop.fade{filter:alpha(opacity=0);opacity:0}.modal-backdrop.in{filter:alpha(opacity=50);opacity:.5}.modal-header{min-height:16.43px;padding:15px;border-bottom:1px solid #e5e5e5}.modal-header .close{margin-top:-2px}.modal-title{margin:0;line-height:1.42857143}.modal-body{position:relative;padding:15px}.modal-footer{padding:15px;text-align:right;border-top:1px solid #e5e5e5}.modal-footer .btn+.btn{margin-bottom:0;margin-left:5px}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.modal-footer .btn-block+.btn-block{margin-left:0}.modal-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}@media (min-width:768px){.modal-dialog{width:600px;margin:30px auto}.modal-content{-webkit-box-shadow:0 5px 15px rgba(0,0,0,.5);box-shadow:0 5px 15px rgba(0,0,0,.5)}.modal-sm{width:300px}}@media (min-width:992px){.modal-lg{width:900px}}.tooltip{position:absolute;z-index:1070;display:block;font-size:12px;line-height:1.4;visibility:visible;filter:alpha(opacity=0);opacity:0}.tooltip.in{filter:alpha(opacity=90);opacity:.9}.tooltip.top{padding:5px 0;margin-top:-3px}.tooltip.right{padding:0 5px;margin-left:3px}.tooltip.bottom{padding:5px 0;margin-top:3px}.tooltip.left{padding:0 5px;margin-left:-3px}.tooltip-inner{max-width:200px;padding:3px 8px;color:#fff;text-align:center;text-decoration:none;background-color:#000;border-radius:4px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-left .tooltip-arrow{bottom:0;left:5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-right .tooltip-arrow{right:5px;bottom:0;border-width:5px 5px 0;border-top-color:#000}.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-width:5px 5px 5px 0;border-right-color:#000}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-width:5px 0 5px 5px;border-left-color:#000}.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-left .tooltip-arrow{top:0;left:5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-right .tooltip-arrow{top:0;right:5px;border-width:0 5px 5px;border-bottom-color:#000}.popover{position:absolute;top:0;left:0;z-index:1060;display:none;max-width:276px;padding:1px;text-align:left;white-space:normal;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.2);border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2)}.popover.top{margin-top:-10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-left:-10px}.popover-title{padding:8px 14px;margin:0;font-size:14px;font-weight:400;line-height:18px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0}.popover-content{padding:9px 14px}.popover>.arrow,.popover>.arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.popover>.arrow{border-width:11px}.popover>.arrow:after{content:"";border-width:10px}.popover.top>.arrow{bottom:-11px;left:50%;margin-left:-11px;border-top-color:#999;border-top-color:rgba(0,0,0,.25);border-bottom-width:0}.popover.top>.arrow:after{bottom:1px;margin-left:-10px;content:" ";border-top-color:#fff;border-bottom-width:0}.popover.right>.arrow{top:50%;left:-11px;margin-top:-11px;border-right-color:#999;border-right-color:rgba(0,0,0,.25);border-left-width:0}.popover.right>.arrow:after{bottom:-10px;left:1px;content:" ";border-right-color:#fff;border-left-width:0}.popover.bottom>.arrow{top:-11px;left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#999;border-bottom-color:rgba(0,0,0,.25)}.popover.bottom>.arrow:after{top:1px;margin-left:-10px;content:" ";border-top-width:0;border-bottom-color:#fff}.popover.left>.arrow{top:50%;right:-11px;margin-top:-11px;border-right-width:0;border-left-color:#999;border-left-color:rgba(0,0,0,.25)}.popover.left>.arrow:after{right:1px;bottom:-10px;content:" ";border-right-width:0;border-left-color:#fff}.carousel{position:relative}.carousel-inner{position:relative;width:100%;overflow:hidden}.carousel-inner>.item{position:relative;display:none;-webkit-transition:.6s ease-in-out left;-o-transition:.6s ease-in-out left;transition:.6s ease-in-out left}.carousel-inner>.item>img,.carousel-inner>.item>a>img{line-height:1}.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block}
10.carousel-inner>.active{left:0}.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%}.carousel-inner>.next{left:100%}.carousel-inner>.prev{left:-100%}.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0}.carousel-inner>.active.left{left:-100%}.carousel-inner>.active.right{left:100%}.carousel-control{position:absolute;top:0;bottom:0;left:0;width:15%;font-size:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6);filter:alpha(opacity=50);opacity:.5}.carousel-control.left{background-image:-webkit-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.5)),to(rgba(0,0,0,.0001)));background-image:linear-gradient(to right,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1);background-repeat:repeat-x}.carousel-control.right{right:0;left:auto;background-image:-webkit-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.0001)),to(rgba(0,0,0,.5)));background-image:linear-gradient(to right,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1);background-repeat:repeat-x}.carousel-control:hover,.carousel-control:focus{color:#fff;text-decoration:none;filter:alpha(opacity=90);outline:0;opacity:.9}.carousel-control .icon-prev,.carousel-control .icon-next,.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right{position:absolute;top:50%;z-index:5;display:inline-block}.carousel-control .icon-prev,.carousel-control .glyphicon-chevron-left{left:50%;margin-left:-10px}.carousel-control .icon-next,.carousel-control .glyphicon-chevron-right{right:50%;margin-right:-10px}.carousel-control .icon-prev,.carousel-control .icon-next{width:20px;height:20px;margin-top:-10px;font-family:serif}.carousel-control .icon-prev:before{content:'\2039'}.carousel-control .icon-next:before{content:'\203a'}.carousel-indicators{position:absolute;bottom:10px;left:50%;z-index:15;width:60%;padding-left:0;margin-left:-30%;text-align:center;list-style:none}.carousel-indicators li{display:inline-block;width:10px;height:10px;margin:1px;text-indent:-999px;cursor:pointer;background-color:#000 \9;background-color:rgba(0,0,0,0);border:1px solid #fff;border-radius:10px}.carousel-indicators .active{width:12px;height:12px;margin:0;background-color:#fff}.carousel-caption{position:absolute;right:15%;bottom:20px;left:15%;z-index:10;padding-top:20px;padding-bottom:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6)}.carousel-caption .btn{text-shadow:none}@media screen and (min-width:768px){.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-prev,.carousel-control .icon-next{width:30px;height:30px;margin-top:-15px;font-size:30px}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{margin-left:-15px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{margin-right:-15px}.carousel-caption{right:20%;left:20%;padding-bottom:30px}.carousel-indicators{bottom:20px}}.clearfix:before,.clearfix:after,.dl-horizontal dd:before,.dl-horizontal dd:after,.container:before,.container:after,.container-fluid:before,.container-fluid:after,.row:before,.row:after,.form-horizontal .form-group:before,.form-horizontal .form-group:after,.btn-toolbar:before,.btn-toolbar:after,.btn-group-vertical>.btn-group:before,.btn-group-vertical>.btn-group:after,.nav:before,.nav:after,.navbar:before,.navbar:after,.navbar-header:before,.navbar-header:after,.navbar-collapse:before,.navbar-collapse:after,.pager:before,.pager:after,.panel-body:before,.panel-body:after,.modal-footer:before,.modal-footer:after{display:table;content:" "}.clearfix:after,.dl-horizontal dd:after,.container:after,.container-fluid:after,.row:after,.form-horizontal .form-group:after,.btn-toolbar:after,.btn-group-vertical>.btn-group:after,.nav:after,.navbar:after,.navbar-header:after,.navbar-collapse:after,.pager:after,.panel-body:after,.modal-footer:after{clear:both}.center-block{display:block;margin-right:auto;margin-left:auto}.pull-right{float:right!important}.pull-left{float:left!important}.hide{display:none!important}.show{display:block!important}.invisible{visibility:hidden}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.hidden{display:none!important;visibility:hidden!important}.affix{position:fixed;
10-webkit-transform:translate3d(0,0,0);-o-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}@-ms-viewport{width:device-width}.visible-xs,.visible-sm,.visible-md,.visible-lg{display:none!important}.visible-xs-block,.visible-xs-inline,.visible-xs-inline-block,.visible-sm-block,.visible-sm-inline,.visible-sm-inline-block,.visible-md-block,.visible-md-inline,.visible-md-inline-block,.visible-lg-block,.visible-lg-inline,.visible-lg-inline-block{display:none!important}@media (max-width:767px){.visible-xs{display:block!important}table.visible-xs{display:table}tr.visible-xs{display:table-row!important}th.visible-xs,td.visible-xs{display:table-cell!important}}@media (max-width:767px){.visible-xs-block{display:block!important}}@media (max-width:767px){.visible-xs-inline{display:inline!important}}@media (max-width:767px){.visible-xs-inline-block{display:inline-block!important}}@media (min-width:768px) and (max-width:991px){.visible-sm{display:block!important}table.visible-sm{display:table}tr.visible-sm{display:table-row!important}th.visible-sm,td.visible-sm{display:table-cell!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-block{display:block!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline{display:inline!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline-block{display:inline-block!important}}@media (min-width:992px) and (max-width:1199px){.visible-md{display:block!important}table.visible-md{display:table}tr.visible-md{display:table-row!important}th.visible-md,td.visible-md{display:table-cell!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-block{display:block!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline{display:inline!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline-block{display:inline-block!important}}@media (min-width:1200px){.visible-lg{display:block!important}table.visible-lg{display:table}tr.visible-lg{display:table-row!important}th.visible-lg,td.visible-lg{display:table-cell!important}}@media (min-width:1200px){.visible-lg-block{display:block!important}}@media (min-width:1200px){.visible-lg-inline{display:inline!important}}@media (min-width:1200px){.visible-lg-inline-block{display:inline-block!important}}@media (max-width:767px){.hidden-xs{display:none!important}}@media (min-width:768px) and (max-width:991px){.hidden-sm{display:none!important}}@media (min-width:992px) and (max-width:1199px){.hidden-md{display:none!important}}@media (min-width:1200px){.hidden-lg{display:none!important}}.visible-print{display:none!important}@media print{.visible-print{display:block!important}table.visible-print{display:table}tr.visible-print{display:table-row!important}th.visible-print,td.visible-print{display:table-cell!important}}.visible-print-block{display:none!important}@media print{.visible-print-block{display:block!important}}.visible-print-inline{display:none!important}@media print{.visible-print-inline{display:inline!important}}.visible-print-inline-block{display:none!important}@media print{.visible-print-inline-block{display:inline-block!important}}@media print{.hidden-print{display:none!important}}</style>
11        <meta content="Create multisig addresses and transactions" name="description"/>
12        <meta content="width=device-width, initial-scale=1.0" name="viewport" />
13        <meta content="Ian Coleman" name="author" />
14        <link type="image/x-icon" rel="icon" href="data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQEAYAAABPYyMiAAAABmJLR0T///////8JWPfcAAAACXBIWXMAAABIAAAASABGyWs+AAAAF0lEQVRIx2NgGAWjYBSMglEwCkbBSAcACBAAAeaR9cIAAAAASUVORK5CYII=" />
15
16        <style>
17            body {
18                padding-bottom: 32px;
19            }
20            .form-control[readonly] {
21                cursor: text;
22            }
23            .feedback-container {
24                position: fixed;
25                top: 0;
26                width: 100%;
27                text-align: center;
28                z-index: 4;
29            }
30            .feedback {
31                display: table;
32                padding: 0.5em 1em;
33                background-color: orange;
34                margin: 0 auto;
35                font-size: 2em;
36                color: #444;
37                border: 2px solid #555;
38                border-top: 0;
39                border-bottom-left-radius: 20px 20px;
40                border-bottom-right-radius: 20px 20px;
41            }
42            .no-border {
43                border: 0;
44                box-shadow: inset 0 1px 1px rgba(0,0,0,.0);
45                -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.0);
46            }
47            .monospace {
48                font-family: monospace;
49            }
50            .strikethrough {
51                text-decoration: line-through;
52            }
53            .qr-container {
54                position: fixed;
55                top: 0;
56                right: 0;
57                text-align: center;
58                background-color: #FFF;
59                border: 1px solid #CCC;
60            }
61            .qr-image {
62                margin: 5px;
63            }
64            .qr-hint,
65            .qr-warning {
66                padding: 2px;
67                max-width: 150px;
68            }
69            .signatories-count {
70                /* override mobile width from bootstrap */
71                width: auto!important;
72                display: inline-block;
73            }
74            .part-list td:nth-of-type(1) {
75                font-weight: bold;
76            }
77        </style>
78    </head>
79    <body>
80        <div class="container">
81
82            <h1 class="text-center">Multisig Tool</h1>
83            <h3 class="text-center">Create multisig addresses and transactions</h3>
84            <hr>
85            <div class="row">
86                <div class="col-md-12">
87                    <h2>Parts</h2>
88                    <form class="form-horizontal" role="form">
89                        <div class="form-group">
90                            <div class="col-sm-2"></div>
91                            <div class="col-sm-10">
92                                <p data-translate>Enter bitcoin public keys (hex) or private keys (WIF). Support for xpub and xprv keys coming soon.</p>
93                                <p data-translate>Separate each part with spaces, newlines, commas or semicolons.</p>
94                            </div>
95                        </div>
96                        <div class="form-group">
97                            <label for="phrase" class="col-sm-2 control-label" data-translate>Parts</label>
98                            <div class="col-sm-10">
99                                <textarea id="parts" class="parts form-control" rows=8></textarea>
100                            </div>
101                        </div>
102                        <div class="form-group">
103                            <label for="network" class="col-sm-2 control-label" data-translate>Coin</label>
104                            <div class="col-sm-10">
105                                <select id="network" class="network form-control">
106                                    <!-- populated by javascript -->
107                                </select>
108                            </div>
109                        </div>
110                        <div class="form-group">
111                            <label for="part-list" class="col-sm-2 control-label" data-translate>Part List</label>
112                            <div class="col-sm-10">
113                                <table id="part-list" class="part-list table table-striped">
114                                    <!-- populated by javascript -->
115                                    <tr>
116                                        <td>A</td>
117                                        <td data-translate>will be taken from the parts above</td>
118                                    </tr>
119                                    <tr>
120                                        <td>B</td>
121                                        <td></td>
122                                    </tr>
123                                    <tr>
124                                        <td>...</td>
125                                        <td></td>
126                                    </tr>
127                                </table>
128                            </div>
129                        </div>
130                    </form>
131                </div>
132            </div>
133
134            <hr>
135
136            <div class="row">
137                <div class="col-md-12">
138                    <h2>Discover (Optional)</h2>
139                    <p data-transltae>
140                    If you're unsure of the correct order for the parts, you
141                    can test each combination here.
142                    </p>
143                    <p data-translate>
144                    Any combinations that have received a transaction
145                    previously will be listed in green (even if the balance is
146                    zero).
147                    </p>
148                    <p data-translate>
149                    Any combinations that have NOT received a transaction
150                    previously will be listed in red with a strikethrough.
151                    </p>
152                    <p data-translate>
153                    This feature uses a blockchain explorer to perform the
154                    discovery, which may pose a privacy issue for some users.
155                    </p>
156                    <button class="discover btn btn-default" data-translate>Discover</button>
157                    <button class="cancel-discover btn btn-default hidden" data-translate>Cancel</button>
158                    <div class="discovered">
159                        <!-- populated by javascript -->
160                    </div>
161                    <div class="discover-in-progress hidden">
162                        <p>
163                            Completed
164                            <span class="remaining"></span>
165                            of
166                            <span class="total"></span>
167                        </p>
168                    </div>
169                </div>
170            </div>
171
172            <hr>
173
174            <div class="row">
175                <div class="col-md-12">
176                    <h2>Details</h2>
177                    <form class="details form-horizontal">
178                        <div class="form-group">
179                            <label for="signatories-count" class="col-sm-2 control-label" data-translate>Signatories (M)</label>
180                            <div class="col-sm-10">
181                                <select id="signatories-count" class="signatories-count form-control">
182                                    <!-- populated by javascript -->
183                                    <option>M</option>
184                                </select>
185                                <span>of</span>
186                                <span class="participants-count">N</span>
187                            </div>
188                        </div>
189                        <div class="form-group">
190                            <label for="part-order" class="col-sm-2 control-label" data-translate>Ordering Of Parts</label>
191                            <div class="col-sm-10">
192                                <select id="part-order" class="part-order form-control">
193                                    <!-- populated by javascript -->
194                                </select>
195                            </div>
196                        </div>
197                        <div class="form-group">
198                            <label for="address" class="col-sm-2 control-label" data-translate>Address</label>
199                            <div class="col-sm-10">
200                                <input class="address form-control" id="address" readonly="readonly" data-show-qr>
201                            </div>
202                        </div>
203                        <div class="form-group">
204                            <label for="pubkey-script" class="col-sm-2 control-label" data-translate>Public Key Script</label>
205                            <div class="col-sm-10">
206                                <input class="pubkey-script form-control" id="pubkey-script" readonly="readonly" data-show-qr>
207                            </div>
208                        </div>
209                        <div class="form-group">
210                            <label for="redeem-script" class="col-sm-2 control-label" data-translate>Redeem Script</label>
211                            <div class="col-sm-10">
212                                <textarea class="redeem-script form-control" id="redeem-script" readonly="readonly" rows=5 data-show-qr></textarea>
213                            </div>
214                        </div>
215                        <div class="form-group">
216                            <div class="col-sm-2"></div>
217                            <div class="col-sm-10">
218                                <hr>
219                                <p data-translate>
220                                BIP45 forces lexicographical ordering
221                                </p>
222                            </div>
223                        <div class="form-group">
224                            <label for="bip45-order" class="col-sm-2 control-label" data-translate>BIP45 Order</label>
225                            <div class="col-sm-10">
226                                <input class="bip45-order form-control" id="bip45-order" readonly="readonly">
227                            </div>
228                        </div>
229                        <div class="form-group">
230                            <label for="bip45-address" class="col-sm-2 control-label" data-translate>BIP45 Address</label>
231                            <div class="col-sm-10">
232                                <input class="bip45-address form-control" id="bip45-address" readonly="readonly" data-show-qr>
233                            </div>
234                        </div>
235                    </form>
236                </div>
237            </div>
238
239            <hr>
240
241            <div class="row">
242                <div class="col-md-12">
243                    <h1 data-translate>Transaction Builder</h1>
244                    <p data-translate>Coming soon</h1>
245                </div>
246            </div>
247
248            <hr>
249
250            <div class="row">
251                <div class="col-md-12">
252                    <h2 data-translate>More info</h2>
253                    <h3 data-translate>License</h3>
254                    <p>
255                    <span data-translate-html>Please refer to <a href="https://github.com/iancoleman/multisig/blob/master/LICENSE" target="_blank">the software license</a> for more detail.
256                    </span>
257                    </p>
258                    <p data-translate>The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.</p>
259                    <h3 data-translate>Alternatives</h3>
260                    <ul>
261                        <li>
262                            <a href="https://coinb.in/#newMultiSig" target="_blank">
263                                coinb.in
264                            </a>
265                            <span>multisig address</span>
266                        </li>
267                        <li>
268                            <a href="https://coinbase.github.io/multisig-tool/" target="_blank">
269                                coinbase
270                            </a>
271                            <span>multisig tool</span>
272                        </li>
273                        <li>
274                            <a href="https://bitcore.io/playground/#/multisig" target="_blank">
275                                bitcore
276                            </a>
277                            <span>playground multisig address</span>
278                        </li>
279                        <li>
280                            <a href="https://bitpay.github.io/copay-recovery/" target="_blank">
281                                copay
282                            </a>
283                            <span>recovery tool</span>
284                        </li>
285                    </ul>
286                </div>
287            </div>
288
289            <hr>
290
291            <div class="row">
292                <div class="col-md-12">
293
294                    <h2 data-translate>Offline Usage</h2>
295
296                    <p data-translate>
297                    You can use this tool without having to be online.
298                    </p>
299                    <p data-translate>
300                    In your browser, select file save-as, and save this page
301                    as a file.
302                    </p>
303                    <p data-translate>
304                    Double-click that file to open it in a browser
305                    on any offline computer.
306                    </p>
307                    <p>
308                    <span data-translate>Alternatively, download the file from the repository</span>
309                    -
310                    <a href="https://github.com/iancoleman/multisig">https://github.com/iancoleman/multisig</a>
311                    </p>
312
313                </div>
314            </div>
315
316            <hr>
317
318            <div class="row">
319                <div class="col-md-12">
320
321                    <h2 data-translate>This project is 100% open-source code</h2>
322
323                    <p>
324                        <span data-translate>Get the source code from the repository</span>
325                        -
326                        <a href="https://github.com/iancoleman/multisig" target="_blank">
327                            https://github.com/iancoleman/multisig
328                        </a>
329                    </p>
330
331                    <h3 data-translate>Libraries</h3>
332
333                    <p>
334                        <span>BitcoinJS - </span>
335                        <a href="https://github.com/bitcoinjs/bitcoinjs-lib" target="_blank">
336                            https://github.com/bitcoinjs/bitcoinjs-lib
337                        </a>
338                    </p>
339
340                    <p>
341                        <span>jQuery - </span>
342                        <a href="https://jquery.com/" target="_blank">
343                            https://jquery.com/
344                        </a>
345                    </p>
346
347                    <p>
348                        <span>Twitter Bootstrap - </span>
349                        <a href="http://getbootstrap.com/" target="_blank">
350                            http://getbootstrap.com/
351                        </a>
352                    </p>
353
354                </div>
355            </div>
356
357        </div>
358
359        <div class="qr-container hidden">
360            <div class="qr-hint bg-primary hidden" data-translate>Click field to hide QR</div>
361            <div class="qr-hint bg-primary" data-translate>Click field to show QR</div>
362            <div class="qr-hider hidden">
363                <div class="qr-image"></div>
364                <div class="qr-warning bg-primary" data-translate>Caution: Scanner may keep history</div>
365            </div>
366        </div>
367
368        <div class="feedback-container">
369            <div class="feedback">Loading...</div>
370        </div>
371
372        
vendor: 4,221 bytes, lines 372-373
372<script>/*! jQuery v2.1.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
373!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.1",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:k}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t
vendor: 12,883 bytes, line 373
373=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="<div class='a'></div><div class='a i'></div>",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="<select msallowclip=''><option selected=''></option></select>",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)}
vendor: 17,043 bytes, lines 373-374
373,input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=lb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=mb(b);function pb(){}pb.prototype=d.filters=d.pseudos,d.setFilters=new pb,g=fb.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?fb.error(a):z(a,i).slice(0)};function qb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return g.call(b,a)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:l,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=l.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=l,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(n(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler("ready"),n(l).off("ready"))))}});function I(){l.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),"complete"===l.readyState?setTimeout(n.ready):(l.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+Math.random()}K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,n.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(n.isEmptyObject(f))n.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!n.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b)
374},_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=n.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:n.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=L.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}
vendor: 12,513 bytes, line 374
374});var Q=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,R=["Top","Right","Bottom","Left"],S=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)},T=/^(?:checkbox|radio)$/i;!function(){var a=l.createDocumentFragment(),b=a.appendChild(l.createElement("div")),c=l.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,m,o,p=[d||l],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||l,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+n.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},e||!o.trigger||o.trigger.apply(d,c)!==!1)){if(!e&&!o.noBubble&&!n.isWindow(d)){for(i=o.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||l)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:o.bindType||q,m=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),m&&m.apply(g,c),m=k&&g[k],m&&m.apply&&n.acceptData(g)&&(b.result=m.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!n.acceptData(d)||k&&n.isFunction(d[q])&&!n.isWindow(d)&&(h=d[k],h&&(d[k]=null),n.event.triggered=q,d[q](),n.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>=0:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button;return null==a.pageX&&null!=b.clientX&&(c=a.target.ownerDocument||l,d=c.documentElement,e=c.body,a.pageX=b.clientX+(d&&d.scrollLeft||e&&e.scrollLeft||0)-(d&&d.clientLeft||e&&e.clientLeft||0),a.pageY=b.clientY+(d&&d.scrollTop||e&&e.scrollTop||0)-(d&&d.clientTop||e&&e.clientTop||0)),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},fix:function(a){if(a[n.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=W.test(e)?this.mouseHooks:V.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new n.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=l),3===a.target.nodeType&&(a.target=a.target.parentNode),g.filter?g.filter(a,f):a},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==_()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===_()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&n.nodeName(this,"input")?(this.click(),!1):void 0},_default:function(a){return n.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=n.extend(new n.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?n.event.trigger(e,null,b):n.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},n.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)},n.Event=function(a,b){return this instanceof n.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?Z:$):this.type=a,b&&n.extend(this,b),this.timeStamp=a&&a.timeStamp||n.now(),void(this[n.expando]=!0)):new n.Event(a,b)},n.Event.prototype={isDefaultPrevented:$,isPropagationStopped:$,isImmediatePropagationStopped:$,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=Z,a&&a.preventDefault&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=Z,a&&a.stopPropagation&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=Z,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){n.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!n.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.focusinBubbles||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a),!0)};n.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=L.access(d,b);e||d.addEventListener(a,c,!0),L.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=L.access(d,b)-1;e?L.access(d,b,e):(d.removeEventListener(a,c,!0),L.remove(d,b))}}}),n.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(g in a)this.on(g,b,c,a[g],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=$;else if(!d)return this;return 1===e&&(f=d,d=function(a){return n().off(a),f.apply(this,arguments)},d.guid=f.guid||(f.guid=n.guid++)),this.each(function(){n.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,n(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=$),this.each(function(){n.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){n.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?n.event.trigger(a,b,c,!0):void 0}});var ab=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bb=/<([\w:]+)/,cb=/<|&#?\w+;/,db=/<(?:script|style|link)/i,eb=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/^$|\/(?:java|ecma)script/i,gb=/^true\/(.*)/,hb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ib={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ib.optgroup=ib.option,ib.tbody=ib.tfoot=ib.colgroup=ib.caption=ib.thead,ib.th=ib.td;function jb(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function kb(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function lb(a){var b=gb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function mb(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function nb(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function ob(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function pb(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=ob(h),f=ob(a),d=0,e=f.length;e>d;d++)pb(f[d],g[d]);if(b)if(c)for(f=f||ob(a),g=g||ob(h),d=0,e=f.length;e>d;d++)nb(f[d],g[d]);else nb(a,h);return g=ob(h,"script"),g.length>0&&mb(g,!i&&ob(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(cb.test(e)){f=f||k.appendChild(b.createElement("div")),g=(bb.exec(e)||["",""])[1].toLowerCase(),h=ib[g]||ib._default,f.innerHTML=h[1]+e.replace(ab,"<$1></$2>")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=ob(k.appendChild(e),"script"),i&&mb(f),c)){j=0;while(e=f[j++])fb.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}
vendor: 37,593 bytes, lines 374-375
374delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(ob(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&mb(ob(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(ob(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!db.test(a)&&!ib[(bb.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(ab,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(ob(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(ob(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,m=this,o=l-1,p=a[0],q=n.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&eb.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=n.map(ob(c,"script"),kb),g=f.length;l>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(f,ob(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,n.map(f,lb),j=0;g>j;j++)h=f[j],fb.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(hb,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),n(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qb,rb={};function sb(b,c){var d,e=n(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:n.css(e[0],"display");return e.detach(),f}function tb(a){var b=l,c=rb[a];return c||(c=sb(a,b),"none"!==c&&c||(qb=(qb||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=qb[0].contentDocument,b.write(),b.close(),c=sb(a,b),qb.detach()),rb[a]=c),c}var ub=/^margin/,vb=new RegExp("^("+Q+")(?!px)[a-z%]+$","i"),wb=function(a){return a.ownerDocument.defaultView.getComputedStyle(a,null)};function xb(a,b,c){var d,e,f,g,h=a.style;return c=c||wb(a),c&&(g=c.getPropertyValue(b)||c[b]),c&&(""!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),vb.test(g)&&ub.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function yb(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d=l.documentElement,e=l.createElement("div"),f=l.createElement("div");if(f.style){f.style.backgroundClip="content-box",f.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===f.style.backgroundClip,e.style.cssText="border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;position:absolute",e.appendChild(f);function g(){f.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",f.innerHTML="",d.appendChild(e);var g=a.getComputedStyle(f,null);b="1%"!==g.top,c="4px"===g.width,d.removeChild(e)}a.getComputedStyle&&n.extend(k,{pixelPosition:function(){return g(),b},boxSizingReliable:function(){return null==c&&g(),c},reliableMarginRight:function(){var b,c=f.appendChild(l.createElement("div"));return c.style.cssText=f.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",c.style.marginRight=c.style.width="0",f.style.width="1px",d.appendChild(e),b=!parseFloat(a.getComputedStyle(c,null).marginRight),d.removeChild(e),b}})}}(),n.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var zb=/^(none|table(?!-c[ea]).+)/,Ab=new RegExp("^("+Q+")(.*)$","i"),Bb=new RegExp("^([+-])=("+Q+")","i"),Cb={position:"absolute",visibility:"hidden",display:"block"},Db={letterSpacing:"0",fontWeight:"400"},Eb=["Webkit","O","Moz","ms"];function Fb(a,b){if(b in a)return b;var c=b[0].toUpperCase()+b.slice(1),d=b,e=Eb.length;while(e--)if(b=Eb[e]+c,b in a)return b;return d}function Gb(a,b,c){var d=Ab.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Hb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=n.css(a,c+R[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+R[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+R[f]+"Width",!0,e))):(g+=n.css(a,"padding"+R[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+R[f]+"Width",!0,e)));return g}function Ib(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=wb(a),g="border-box"===n.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=xb(a,b,f),(0>e||null==e)&&(e=a.style[b]),vb.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Hb(a,b,c||(g?"border":"content"),d,f)+"px"}function Jb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=L.get(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&S(d)&&(f[g]=L.access(d,"olddisplay",tb(d.nodeName)))):(e=S(d),"none"===c&&e||L.set(d,"olddisplay",e?c:n.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=xb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=n.camelCase(b),i=a.style;return b=n.cssProps[h]||(n.cssProps[h]=Fb(i,h)),g=n.cssHooks[b]||n.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=Bb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(n.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||n.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=Fb(a.style,h)),g=n.cssHooks[b]||n.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=xb(a,b,d)),"normal"===e&&b in Db&&(e=Db[b]),""===c||c?(f=parseFloat(e),c===!0||n.isNumeric(f)?f||0:e):e}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?zb.test(n.css(a,"display"))&&0===a.offsetWidth?n.swap(a,Cb,function(){return Ib(a,b,d)}):Ib(a,b,d):void 0},set:function(a,c,d){var e=d&&wb(a);return Gb(a,c,d?Hb(a,b,d,"border-box"===n.css(a,"boxSizing",!1,e),e):0)}}}),n.cssHooks.marginRight=yb(k.reliableMarginRight,function(a,b){return b?n.swap(a,{display:"inline-block"},xb,[a,"marginRight"]):void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+R[d]+b]=f[d]||f[d-2]||f[0];return e}},ub.test(a)||(n.cssHooks[a+b].set=Gb)}),n.fn.extend({css:function(a,b){return J(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=wb(a),e=b.length;e>g;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.css(a,b)},a,b,arguments.length>1)},show:function(){return Jb(this,!0)},hide:function(){return Jb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){S(this)?n(this).show():n(this).hide()})}});function Kb(a,b,c,d,e){return new Kb.prototype.init(a,b,c,d,e)}n.Tween=Kb,Kb.prototype={constructor:Kb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=Kb.propHooks[this.prop];return a&&a.get?a.get(this):Kb.propHooks._default.get(this)},run:function(a){var b,c=Kb.propHooks[this.prop];return this.pos=b=this.options.duration?n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Kb.propHooks._default.set(this),this}},Kb.prototype.init.prototype=Kb.prototype,Kb.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[n.cssProps[a.prop]]||n.cssHooks[a.prop])?n.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Kb.propHooks.scrollTop=Kb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},n.fx=Kb.prototype.init,n.fx.step={};var Lb,Mb,Nb=/^(?:toggle|show|hide)$/,Ob=new RegExp("^(?:([+-])=|)("+Q+")([a-z%]*)$","i"),Pb=/queueHooks$/,Qb=[Vb],Rb={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=Ob.exec(b),f=e&&e[3]||(n.cssNumber[a]?"":"px"),g=(n.cssNumber[a]||"px"!==f&&+d)&&Ob.exec(n.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,n.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function Sb(){return setTimeout(function(){Lb=void 0}),Lb=n.now()}function Tb(a,b){var c,d=0,e={height:a};for(b=b?1:0;4>d;d+=2-b)c=R[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function Ub(a,b,c){for(var d,e=(Rb[b]||[]).concat(Rb["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function Vb(a,b,c){var d,e,f,g,h,i,j,k,l=this,m={},o=a.style,p=a.nodeType&&S(a),q=L.get(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,l.always(function(){l.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=n.css(a,"display"),k="none"===j?L.get(a,"olddisplay")||tb(a.nodeName):j,"inline"===k&&"none"===n.css(a,"float")&&(o.display="inline-block")),c.overflow&&(o.overflow="hidden",l.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],Nb.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}m[d]=q&&q[d]||n.style(a,d)}else j=void 0;if(n.isEmptyObject(m))"inline"===("none"===j?tb(a.nodeName):j)&&(o.display=j);else{q?"hidden"in q&&(p=q.hidden):q=L.access(a,"fxshow",{}),f&&(q.hidden=!p),p?n(a).show():l.done(function(){n(a).hide()}),l.done(function(){var b;L.remove(a,"fxshow");for(b in m)n.style(a,b,m[b])});for(d in m)g=Ub(p?q[d]:0,d,l),d in q||(q[d]=g.start,p&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function Wb(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function Xb(a,b,c){var d,e,f=0,g=Qb.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=Lb||Sb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:Lb||Sb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(Wb(k,j.opts.specialEasing);g>f;f++)if(d=Qb[f].call(j,a,k,j.opts))return d;return n.map(k,Ub,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}n.Animation=n.extend(Xb,{tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],Rb[c]=Rb[c]||[],Rb[c].unshift(b)},prefilter:function(a,b){b?Qb.unshift(a):Qb.push(a)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.fn.extend({fadeTo:function(a,b,c,d){return this.filter(S).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=Xb(this,n.extend({},a),f);(e||L.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=n.timers,g=L.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&Pb.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&n.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=L.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=n.timers,g=d?d.length:0;for(c.finish=!0,n.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(Tb(b,!0),a,d,e)}}),n.each({slideDown:Tb("show"),slideUp:Tb("hide"),slideToggle:Tb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=0,c=n.timers;for(Lb=n.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||n.fx.stop(),Lb=void 0},n.fx.timer=function(a){n.timers.push(a),a()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){Mb||(Mb=setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){clearInterval(Mb),Mb=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(a,b){return a=n.fx?n.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a=l.createElement("input"),b=l.createElement("select"),c=b.appendChild(l.createElement("option"));a.type="checkbox",k.checkOn=""!==a.value,k.optSelected=c.selected,b.disabled=!0,k.optDisabled=!c.disabled,a=l.createElement("input"),a.value="t",a.type="radio",k.radioValue="t"===a.value}();var Yb,Zb,$b=n.expr.attrHandle;n.fn.extend({attr:function(a,b){return J(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===U?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),d=n.attrHooks[b]||(n.expr.match.bool.test(b)?Zb:Yb)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=n.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void n.removeAttr(a,b))
375},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),Zb={set:function(a,b,c){return b===!1?n.removeAttr(a,c):a.setAttribute(c,c),c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=$b[b]||n.find.attr;$b[b]=function(a,b,d){var e,f;return d||(f=$b[b],$b[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,$b[b]=f),e}});var _b=/^(?:input|select|textarea|button)$/i;n.fn.extend({prop:function(a,b){return J(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[n.propFix[a]||a]})}}),n.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!n.isXMLDoc(a),f&&(b=n.propFix[b]||b,e=n.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){return a.hasAttribute("tabindex")||_b.test(a.nodeName)||a.href?a.tabIndex:-1}}}}),k.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this});var ac=/[\t\r\n\f]/g;n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h="string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ac," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=n.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0===arguments.length||"string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ac," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?n.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(n.isFunction(a)?function(c){n(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=n(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===U||"boolean"===c)&&(this.className&&L.set(this,"__className__",this.className),this.className=this.className||a===!1?"":L.get(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(ac," ").indexOf(b)>=0)return!0;return!1}});var bc=/\r/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(bc,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.trim(n.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=n.inArray(d.value,f)>=0)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>=0:void 0}},k.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})}),n.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var cc=n.now(),dc=/\?/;n.parseJSON=function(a){return JSON.parse(a+"")},n.parseXML=function(a){var b,c;if(!a||"string"!=typeof a)return null;try{c=new DOMParser,b=c.parseFromString(a,"text/xml")}catch(d){b=void 0}return(!b||b.getElementsByTagName("parsererror").length)&&n.error("Invalid XML: "+a),b};var ec,fc,gc=/#.*$/,hc=/([?&])_=[^&]*/,ic=/^(.*?):[ \t]*([^\r\n]*)$/gm,jc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,kc=/^(?:GET|HEAD)$/,lc=/^\/\//,mc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,nc={},oc={},pc="*/".concat("*");try{fc=location.href}catch(qc){fc=l.createElement("a"),fc.href="",fc=fc.href}ec=mc.exec(fc.toLowerCase())||[];function rc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(n.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function sc(a,b,c,d){var e={},f=a===oc;function g(h){var i;return e[h]=!0,n.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function tc(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&n.extend(!0,a,d),a}function uc(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function vc(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:fc,type:"GET",isLocal:jc.test(ec[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":pc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?tc(tc(a,n.ajaxSettings),b):tc(n.ajaxSettings,a)},ajaxPrefilter:rc(nc),ajaxTransport:rc(oc),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=n.ajaxSetup({},b),l=k.context||k,m=k.context&&(l.nodeType||l.jquery)?n(l):n.event,o=n.Deferred(),p=n.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!f){f={};while(b=ic.exec(e))f[b[1].toLowerCase()]=b[2]}b=f[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?e:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return c&&c.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||fc)+"").replace(gc,"").replace(lc,ec[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=n.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(h=mc.exec(k.url.toLowerCase()),k.crossDomain=!(!h||h[1]===ec[1]&&h[2]===ec[2]&&(h[3]||("http:"===h[1]?"80":"443"))===(ec[3]||("http:"===ec[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=n.param(k.data,k.traditional)),sc(nc,k,b,v),2===t)return v;i=k.global,i&&0===n.active++&&n.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!kc.test(k.type),d=k.url,k.hasContent||(k.data&&(d=k.url+=(dc.test(d)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=hc.test(d)?d.replace(hc,"$1_="+cc++):d+(dc.test(d)?"&":"?")+"_="+cc++)),k.ifModified&&(n.lastModified[d]&&v.setRequestHeader("If-Modified-Since",n.lastModified[d]),n.etag[d]&&v.setRequestHeader("If-None-Match",n.etag[d])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+pc+"; q=0.01":""):k.accepts["*"]);for(j in k.headers)v.setRequestHeader(j,k.headers[j]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(j in{success:1,error:1,complete:1})v[j](k[j]);if(c=sc(oc,k,b,v)){v.readyState=1,i&&m.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,c.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,f,h){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),c=void 0,e=h||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,f&&(u=uc(k,v,f)),u=vc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(n.lastModified[d]=w),w=v.getResponseHeader("etag"),w&&(n.etag[d]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,i&&m.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),i&&(m.trigger("ajaxComplete",[v,k]),--n.active||n.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(a){var b;return n.isFunction(a)?this.each(function(b){n(this).wrapAll(a.call(this,b))}):(this[0]&&(b=n(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this)},wrapInner:function(a){return this.each(n.isFunction(a)?function(b){n(this).wrapInner(a.call(this,b))}:function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}}),n.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0},n.expr.filters.visible=function(a){return!n.expr.filters.hidden(a)};var wc=/%20/g,xc=/\[\]$/,yc=/\r?\n/g,zc=/^(?:submit|button|image|reset|file)$/i,Ac=/^(?:input|select|textarea|keygen)/i;function Bc(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||xc.test(a)?d(a,e):Bc(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)Bc(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)Bc(c,a[c],b,e);return d.join("&").replace(wc,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&Ac.test(this.nodeName)&&!zc.test(a)&&(this.checked||!T.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(yc,"\r\n")}}):{name:b.name,value:c.replace(yc,"\r\n")}}).get()}}),n.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(a){}};var Cc=0,Dc={},Ec={0:200,1223:204},Fc=n.ajaxSettings.xhr();a.ActiveXObject&&n(a).on("unload",function(){for(var a in Dc)Dc[a]()}),k.cors=!!Fc&&"withCredentials"in Fc,k.ajax=Fc=!!Fc,n.ajaxTransport(function(a){var b;return k.cors||Fc&&!a.crossDomain?{send:function(c,d){var e,f=a.xhr(),g=++Cc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)f.setRequestHeader(e,c[e]);b=function(a){return function(){b&&(delete Dc[g],b=f.onload=f.onerror=null,"abort"===a?f.abort():"error"===a?d(f.status,f.statusText):d(Ec[f.status]||f.status,f.statusText,"string"==typeof f.responseText?{text:f.responseText}:void 0,f.getAllResponseHeaders()))}},f.onload=b(),f.onerror=b("error"),b=Dc[g]=b("abort");try{f.send(a.hasContent&&a.data||null)}catch(h){if(b)throw h}},abort:function(){b&&b()}}:void 0}),n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(d,e){b=n("<script>").prop({async:!0,charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&e("error"===a.type?404:200,a.type)}),l.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Gc=[],Hc=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Gc.pop()||n.expando+"_"+cc++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Hc.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Hc.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Hc,"$1"+e):b.jsonp!==!1&&(b.url+=(dc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Gc.push(e)),g&&n.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||l;var d=v.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=n.buildFragment([a],b,e),e&&e.length&&n(e).remove(),n.merge([],d.childNodes))};var Ic=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&Ic)return Ic.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=n.trim(a.slice(h)),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&n.ajax({url:a,type:e,dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,f||[a.responseText,b,a])}),this},n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};var Jc=a.document.documentElement;function Kc(a){return n.isWindow(a)?a:9===a.nodeType&&a.defaultView}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d=this[0],e={top:0,left:0},f=d&&d.ownerDocument;if(f)return b=f.documentElement,n.contains(b,d)?(typeof d.getBoundingClientRect!==U&&(e=d.getBoundingClientRect()),c=Kc(f),{top:e.top+c.pageYOffset-b.clientTop,left:e.left+c.pageXOffset-b.clientLeft}):e},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===n.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(d=a.offset()),d.top+=n.css(a[0],"borderTopWidth",!0),d.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-d.top-n.css(c,"marginTop",!0),left:b.left-d.left-n.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||Jc;while(a&&!n.nodeName(a,"html")&&"static"===n.css(a,"position"))a=a.offsetParent;return a||Jc})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(b,c){var d="pageYOffset"===c;n.fn[b]=function(e){return J(this,function(b,e,f){var g=Kc(b);return void 0===f?g?g[c]:b[e]:void(g?g.scrollTo(d?a.pageXOffset:f,d?f:a.pageYOffset):b[e]=f)},b,e,arguments.length,null)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=yb(k.pixelPosition,function(a,c){return c?(c=xb(a,b),vb.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return J(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var Lc=a.jQuery,Mc=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=Mc),b&&a.jQuery===n&&(a.jQuery=Lc),n},typeof b===U&&(a.jQuery=a.$=n),n});
376</script>
376
377        
vendor: 4,660 bytes, lines 377-382
377<script>/*!
378 * Bootstrap v3.2.0 (http://getbootstrap.com)
379 * Copyright 2011-2014 Twitter, Inc.
380 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
381 */
382if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.2.0",d.prototype.close=function(b){function c(){f.detach().trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one("bsTransitionEnd",c).emulateTransitionEnd(150):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.2.0",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),d[e](null==f[b]?this.options[b]:f[b]),setTimeout(a.proxy(function(){"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?a=!1:b.find(".active").removeClass("active")),a&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}a&&this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target);d.hasClass("btn")||(d=d.closest(".btn")),b.call(d,"toggle"),c.preventDefault()})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b).on("keydown.bs.carousel",a.proxy(this.keydown,this)),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.2.0",c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},c.prototype.keydown=function(a){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.to=function(b){var c=this,d=this.getItemIndex(this.$active=this.$element.find(".
382item.active"));return b>this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){return this.sliding?void 0:this.slide("next")},c.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},c.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}if(e.hasClass("active"))return this.sliding=!1;var j=e[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:g});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,f&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(e)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:g});return a.support.transition&&this.$element.hasClass("slide")?(e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one("bsTransitionEnd",function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(1e3*d.css("transition-duration").slice(0,-1))):(d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger(m)),f&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b);!e&&f.toggle&&"show"==b&&(b=!b),e||d.data("bs.collapse",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};c.VERSION="3.2.0",c.DEFAULTS={toggle:!0},c.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},c.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var c=a.Event("show.bs.collapse");if(this.$element.trigger(c),!c.isDefaultPrevented()){var d=this.$parent&&this.$parent.find("> .panel > .in");if(d&&d.length){var e=d.data("bs.collapse");if(e&&e.transitioning)return;b.call(d,"hide"),e||d.data("bs.collapse",null)}var f=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[f](0),this.transitioning=1;var g=function(){this.$element.removeClass("collapsing").addClass("collapse in")[f](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return g.call(this);var h=a.camelCase(["scroll",f].join("-"));this.$element.one("bsTransitionEnd",a.proxy(g,this)).emulateTransitionEnd(350)[f](this.$element[0][h])}}},c.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(d,this)).emulateTransitionEnd(350):d.call(this)}}},c.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var d=a.fn.collapse;a.fn.collapse=b,a.fn.collapse.Constructor=c,a.fn.collapse.noConflict=function(){return a.fn.collapse=d,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(c){var d,e=a(this),f=e.attr("data-target")||c.preventDefault()||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),g=a(f),h=g.data("bs.collapse"),i=h?"toggle":e.data(),j=e.attr("data-parent"),k=j&&a(j);h&&h.transitioning||(k&&k.find('[data-toggle="collapse"][data-parent="'+j+'"]').not(e).addClass("collapsed"),e[g.hasClass("in")?"addClass":"removeClass"]("collapsed")),b.call(g,i)})}(jQuery),+function(a){"use strict";function b(b){b&&3===b.which||(a(e).remove(),a(f).each(function(){var d=c(a(this)),e={relatedTarget:this};d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown",e)),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown",e))}))}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.2.0",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){"ontouchstart"in document.documentElement&&!f.closest(".
382navbar-nav").length&&a('<div class="dropdown-backdrop"/>').insertAfter(a(this)).on("click",b);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus"),f.toggleClass("open").trigger("shown.bs.dropdown",h)}return!1}},g.prototype.keydown=function(b){if(/(38|40|27)/.test(b.keyCode)){var d=a(this);if(b.preventDefault(),b.stopPropagation(),!d.is(".disabled, :disabled")){var e=c(d),g=e.hasClass("open");if(!g||g&&27==b.keyCode)return 27==b.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.divider):visible a",i=e.find('[role="menu"]'+h+', [role="listbox"]'+h);if(i.length){var j=i.index(i.filter(":focus"));38==b.keyCode&&j>0&&j--,40==b.keyCode&&j<i.length-1&&j++,~j||(j=0),i.eq(j).trigger("focus")}}}};var h=a.fn.dropdown;a.fn.dropdown=d,a.fn.dropdown.Constructor=g,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=h,this},a(document).on("click.bs.dropdown.data-api",b).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",f,g.prototype.toggle).on("keydown.bs.dropdown.data-api",f+', [role="menu"], [role="listbox"]',g.prototype.keydown)}(jQuery),+function(a){"use strict";function b(b,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},c.DEFAULTS,e.data(),"object"==typeof b&&b);f||e.data("bs.modal",f=new c(this,g)),"string"==typeof b?f[b](d):g.show&&f.show(d)})}var c=function(b,c){this.options=c,this.$body=a(document.body),this.$element=a(b),this.$backdrop=this.isShown=null,this.scrollbarWidth=0,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};c.VERSION="3.2.0",c.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},c.prototype.toggle=function(a){return this.isShown?this.hide():this.show(a)},c.prototype.show=function(b){var c=this,d=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(d),this.isShown||d.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.$body.addClass("modal-open"),this.setScrollbar(),this.escape(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.backdrop(function(){var d=a.support.transition&&c.$element.hasClass("fade");c.$element.parent().length||c.$element.appendTo(c.$body),c.$element.show().scrollTop(0),d&&c.$element[0].offsetWidth,c.$element.addClass("in").attr("aria-hidden",!1),c.enforceFocus();var e=a.Event("shown.bs.modal",{relatedTarget:b});d?c.$element.find(".modal-dialog").one("bsTransitionEnd",function(){c.$element.trigger("focus").trigger(e)}).emulateTransitionEnd(300):c.$element.trigger("focus").trigger(e)}))},c.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.$body.removeClass("modal-open"),this.resetScrollbar(),this.escape(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",a.proxy(this.hideModal,this)).emulateTransitionEnd(300):this.hideModal())},c.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.trigger("focus")},this))},c.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keyup.dismiss.bs.modal")},c.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.$element.trigger("hidden.bs.modal")})},c.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},c.prototype.backdrop=function(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var e=a.support.transition&&d;if(this.$backdrop=a('<div class="modal-backdrop '+d+'" />').appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),e&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;e?this.$backdrop.one("bsTransitionEnd",b).emulateTransitionEnd(150):b()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var f=function(){c.removeBackdrop(),b&&b()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",f).emulateTransitionEnd(150):f()}else b&&b()},c.prototype.checkScrollbar=function(){document.body.clientWidth>=window.innerWidth||(this.scrollbarWidth=this.scrollbarWidth||this.measureScrollbar())},c.prototype.setScrollbar=function(){var a=parseInt(this.$body.css("padding-right")||0,10);this.scrollbarWidth&&this.$body.css("padding-right",a+this.scrollbarWidth)},c.prototype.resetScrollbar=function(){this.$body.css("padding-right","")},c.prototype.measureScrollbar=function(){var a=document.createElement("div");a.className="modal-scrollbar-measure",this.$body.append(a);var b=a.offsetWidth-a.clientWidth;return this.$body[0].removeChild(a),b};var d=a.fn.modal;a.fn.modal=b,a.fn.modal.Constructor=c,a.fn.modal.noConflict=function(){return a.fn.modal=d,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(c){var d=a(this),e=d.attr("href"),f=a(d.attr("data-target")||e&&e.replace(/.*(?=#[^\s]+$)/,"")),g=f.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(e)&&e},f.data(),d.data());d.is("a")&&c.preventDefault(),f.one("show.bs.modal",function(a){a.isDefaultPrevented()||f.one("hidden.bs.modal",function(){d.is(":visible")&&d.trigger("focus")})}),b.call(f,g,this)})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof b&&b;(e||"destroy"!=b)&&(e||d.data("bs.tooltip",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",a,b)};c.VERSION="3.2.0",c.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(this.options.viewport.selector||this.options.viewport);for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show()},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var c=a.contains(document.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!c)return;var d=this,e=this.tip(),f=this.getUID(this.type);this.setContent(),e.attr("id",f),this.$element.attr("aria-describedby",f),this.options.animation&&e.addClass("fade");var g="function"==typeof this.options.placement?this.options.placement.call(this,e[0],this.$element[0]):this.options.placement,h=/\s?auto?\s?/i,i=h.test(g);i&&(g=g.replace(h,"")||"top"),e.detach().css({top:0,left:0,display:"block"}).addClass(g).data("bs."+this.type,this),this.options.container?e.appendTo(this.options.container):e.insertAfter(this.$element);var j=this.getPosition(),k=e[0].offsetWidth,l=e[0].offsetHeight;if(i){var m=g,n=this.$element.parent(),o=this.getPosition(n);g="bottom"==g&&j.top+j.height+l-o.scroll>o.height?"top":"top"==g&&j.top-o.scroll-l<0?"bottom":"right"==g&&j.right+k>o.width?"left":"left"==g&&j.left-k<o.left?"right":g,e.removeClass(m).addClass(g)}var p=this.getCalculatedOffset(g,j,k,l);this.applyPlacement(p,g);var q=function(){d.$element.trigger("shown.bs."+d.type),d.hoverState=null};a.support.transition&&this.$tip.hasClass("fade")?e.one("bsTransitionEnd",q).emulateTransitionEnd(150):q()}},c.prototype.applyPlacement=function(b,c){var d=this.tip(),e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css("margin-top"),10),h=
382parseInt(d.css("margin-left"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),b.top=b.top+g,b.left=b.left+h,a.offset.setOffset(d[0],a.extend({using:function(a){d.css({top:Math.round(a.top),left:Math.round(a.left)})}},b),0),d.addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;"top"==c&&j!=f&&(b.top=b.top+f-j);var k=this.getViewportAdjustedDelta(c,b,i,j);k.left?b.left+=k.left:b.top+=k.top;var l=k.left?2*k.left-e+i:2*k.top-f+j,m=k.left?"left":"top",n=k.left?"offsetWidth":"offsetHeight";d.offset(b),this.replaceArrow(l,d[0][n],m)},c.prototype.replaceArrow=function(a,b,c){this.arrow().css(c,a?50*(1-a/b)+"%":"")},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},c.prototype.hide=function(){function b(){"in"!=c.hoverState&&d.detach(),c.$element.trigger("hidden.bs."+c.type)}var c=this,d=this.tip(),e=a.Event("hide.bs."+this.type);return this.$element.removeAttr("aria-describedby"),this.$element.trigger(e),e.isDefaultPrevented()?void 0:(d.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?d.one("bsTransitionEnd",b).emulateTransitionEnd(150):b(),this.hoverState=null,this)},c.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},c.prototype.hasContent=function(){return this.getTitle()},c.prototype.getPosition=function(b){b=b||this.$element;var c=b[0],d="BODY"==c.tagName;return a.extend({},"function"==typeof c.getBoundingClientRect?c.getBoundingClientRect():null,{scroll:d?document.documentElement.scrollTop||document.body.scrollTop:b.scrollTop(),width:d?a(window).width():b.outerWidth(),height:d?a(window).height():b.outerHeight()},d?{top:0,left:0}:b.offset())},c.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},c.prototype.getViewportAdjustedDelta=function(a,b,c,d){var e={top:0,left:0};if(!this.$viewport)return e;var f=this.options.viewport&&this.options.viewport.padding||0,g=this.getPosition(this.$viewport);if(/right|left/.test(a)){var h=b.top-f-g.scroll,i=b.top+f-g.scroll+d;h<g.top?e.top=g.top-h:i>g.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;j<g.left?e.left=g.left-j:k>g.width&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){return this.$tip=this.$tip||a(this.options.template)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.validate=function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){clearTimeout(this.timeout),this.hide().$element.off("."+this.type).removeData("bs."+this.type)};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;(e||"destroy"!=b)&&(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.2.0",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").empty()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},c.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){var e=a.proxy(this.process,this);this.$body=a("body"),this.$scrollElement=a(a(c).is("body")?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",e),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.2.0",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b="offset",c=0;a.isWindow(this.$scrollElement[0])||(b="position",c=this.$scrollElement.scrollTop()),this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight();var d=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[b]().top+c,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){d.offsets.push(this[0]),d.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b<=e[0])return g!=(a=f[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parentsUntil(this.options.target,".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")};var d=a.fn.scrollspy;a.fn.scrollspy=c,a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=d,this},a(window).on("load.bs.scrollspy.data-api",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);c.call(b,b.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new c(this)),"string"==typeof b&&e[b]()})}var c=function(b){this.element=a(b)};c.VERSION="3.2.0",c.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.closest("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},c.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one("bsTransitionEnd",e).emulateTransitionEnd(150):e(),f.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(c){c.preventDefault(),b.call(a(this),"show")})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;
382e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=this.unpin=this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.2.0",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=a(document).height(),d=this.$target.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top(this.$element)),"function"==typeof h&&(h=f.bottom(this.$element));var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=b-h?"bottom":null!=g&&g>=d?"top":!1;if(this.affixed!==i){null!=this.unpin&&this.$element.css("top","");var j="affix"+(i?"-"+i:""),k=a.Event(j+".bs.affix");this.$element.trigger(k),k.isDefaultPrevented()||(this.affixed=i,this.unpin="bottom"==i?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(j).trigger(a.Event(j.replace("affix","affixed"))),"bottom"==i&&this.$element.offset({top:b-this.$element.height()-h}))}}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},d.offsetBottom&&(d.offset.bottom=d.offsetBottom),d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery);</script>
382
383        
383<script>
vendor: 13,956 bytes, lines 383-410
383(function(r){r.fn.qrcode=function(h){var s;function u(a){this.mode=s;this.data=a}function o(a,c){this.typeNumber=a;this.errorCorrectLevel=c;this.modules=null;this.moduleCount=0;this.dataCache=null;this.dataList=[]}function q(a,c){if(void 0==a.length)throw Error(a.length+"/"+c);for(var d=0;d<a.length&&0==a[d];)d++;this.num=Array(a.length-d+c);for(var b=0;b<a.length-d;b++)this.num[b]=a[b+d]}function p(a,c){this.totalCount=a;this.dataCount=c}function t(){this.buffer=[];this.length=0}u.prototype={getLength:function(){return this.data.length},
384write:function(a){for(var c=0;c<this.data.length;c++)a.put(this.data.charCodeAt(c),8)}};o.prototype={addData:function(a){this.dataList.push(new u(a));this.dataCache=null},isDark:function(a,c){if(0>a||this.moduleCount<=a||0>c||this.moduleCount<=c)throw Error(a+","+c);return this.modules[a][c]},getModuleCount:function(){return this.moduleCount},make:function(){if(1>this.typeNumber){for(var a=1,a=1;40>a;a++){for(var c=p.getRSBlocks(a,this.errorCorrectLevel),d=new t,b=0,e=0;e<c.length;e++)b+=c[e].dataCount;
385for(e=0;e<this.dataList.length;e++)c=this.dataList[e],d.put(c.mode,4),d.put(c.getLength(),j.getLengthInBits(c.mode,a)),c.write(d);if(d.getLengthInBits()<=8*b)break}this.typeNumber=a}this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(a,c){this.moduleCount=4*this.typeNumber+17;this.modules=Array(this.moduleCount);for(var d=0;d<this.moduleCount;d++){this.modules[d]=Array(this.moduleCount);for(var b=0;b<this.moduleCount;b++)this.modules[d][b]=null}this.setupPositionProbePattern(0,0);this.setupPositionProbePattern(this.moduleCount-
3867,0);this.setupPositionProbePattern(0,this.moduleCount-7);this.setupPositionAdjustPattern();this.setupTimingPattern();this.setupTypeInfo(a,c);7<=this.typeNumber&&this.setupTypeNumber(a);null==this.dataCache&&(this.dataCache=o.createData(this.typeNumber,this.errorCorrectLevel,this.dataList));this.mapData(this.dataCache,c)},setupPositionProbePattern:function(a,c){for(var d=-1;7>=d;d++)if(!(-1>=a+d||this.moduleCount<=a+d))for(var b=-1;7>=b;b++)-1>=c+b||this.moduleCount<=c+b||(this.modules[a+d][c+b]=
3870<=d&&6>=d&&(0==b||6==b)||0<=b&&6>=b&&(0==d||6==d)||2<=d&&4>=d&&2<=b&&4>=b?!0:!1)},getBestMaskPattern:function(){for(var a=0,c=0,d=0;8>d;d++){this.makeImpl(!0,d);var b=j.getLostPoint(this);if(0==d||a>b)a=b,c=d}return c},createMovieClip:function(a,c,d){a=a.createEmptyMovieClip(c,d);this.make();for(c=0;c<this.modules.length;c++)for(var d=1*c,b=0;b<this.modules[c].length;b++){var e=1*b;this.modules[c][b]&&(a.beginFill(0,100),a.moveTo(e,d),a.lineTo(e+1,d),a.lineTo(e+1,d+1),a.lineTo(e,d+1),a.endFill())}return a},
388setupTimingPattern:function(){for(var a=8;a<this.moduleCount-8;a++)null==this.modules[a][6]&&(this.modules[a][6]=0==a%2);for(a=8;a<this.moduleCount-8;a++)null==this.modules[6][a]&&(this.modules[6][a]=0==a%2)},setupPositionAdjustPattern:function(){for(var a=j.getPatternPosition(this.typeNumber),c=0;c<a.length;c++)for(var d=0;d<a.length;d++){var b=a[c],e=a[d];if(null==this.modules[b][e])for(var f=-2;2>=f;f++)for(var i=-2;2>=i;i++)this.modules[b+f][e+i]=-2==f||2==f||-2==i||2==i||0==f&&0==i?!0:!1}},setupTypeNumber:function(a){for(var c=
389j.getBCHTypeNumber(this.typeNumber),d=0;18>d;d++){var b=!a&&1==(c>>d&1);this.modules[Math.floor(d/3)][d%3+this.moduleCount-8-3]=b}for(d=0;18>d;d++)b=!a&&1==(c>>d&1),this.modules[d%3+this.moduleCount-8-3][Math.floor(d/3)]=b},setupTypeInfo:function(a,c){for(var d=j.getBCHTypeInfo(this.errorCorrectLevel<<3|c),b=0;15>b;b++){var e=!a&&1==(d>>b&1);6>b?this.modules[b][8]=e:8>b?this.modules[b+1][8]=e:this.modules[this.moduleCount-15+b][8]=e}for(b=0;15>b;b++)e=!a&&1==(d>>b&1),8>b?this.modules[8][this.moduleCount-
390b-1]=e:9>b?this.modules[8][15-b-1+1]=e:this.modules[8][15-b-1]=e;this.modules[this.moduleCount-8][8]=!a},mapData:function(a,c){for(var d=-1,b=this.moduleCount-1,e=7,f=0,i=this.moduleCount-1;0<i;i-=2)for(6==i&&i--;;){for(var g=0;2>g;g++)if(null==this.modules[b][i-g]){var n=!1;f<a.length&&(n=1==(a[f]>>>e&1));j.getMask(c,b,i-g)&&(n=!n);this.modules[b][i-g]=n;e--; -1==e&&(f++,e=7)}b+=d;if(0>b||this.moduleCount<=b){b-=d;d=-d;break}}}};o.PAD0=236;o.PAD1=17;o.createData=function(a,c,d){for(var c=p.getRSBlocks(a,
391c),b=new t,e=0;e<d.length;e++){var f=d[e];b.put(f.mode,4);b.put(f.getLength(),j.getLengthInBits(f.mode,a));f.write(b)}for(e=a=0;e<c.length;e++)a+=c[e].dataCount;if(b.getLengthInBits()>8*a)throw Error("code length overflow. ("+b.getLengthInBits()+">"+8*a+")");for(b.getLengthInBits()+4<=8*a&&b.put(0,4);0!=b.getLengthInBits()%8;)b.putBit(!1);for(;!(b.getLengthInBits()>=8*a);){b.put(o.PAD0,8);if(b.getLengthInBits()>=8*a)break;b.put(o.PAD1,8)}return o.createBytes(b,c)};o.createBytes=function(a,c){for(var d=
3920,b=0,e=0,f=Array(c.length),i=Array(c.length),g=0;g<c.length;g++){var n=c[g].dataCount,h=c[g].totalCount-n,b=Math.max(b,n),e=Math.max(e,h);f[g]=Array(n);for(var k=0;k<f[g].length;k++)f[g][k]=255&a.buffer[k+d];d+=n;k=j.getErrorCorrectPolynomial(h);n=(new q(f[g],k.getLength()-1)).mod(k);i[g]=Array(k.getLength()-1);for(k=0;k<i[g].length;k++)h=k+n.getLength()-i[g].length,i[g][k]=0<=h?n.get(h):0}for(k=g=0;k<c.length;k++)g+=c[k].totalCount;d=Array(g);for(k=n=0;k<b;k++)for(g=0;g<c.length;g++)k<f[g].length&&
393(d[n++]=f[g][k]);for(k=0;k<e;k++)for(g=0;g<c.length;g++)k<i[g].length&&(d[n++]=i[g][k]);return d};s=4;for(var j={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,
39478,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(a){for(var c=a<<10;0<=j.getBCHDigit(c)-j.getBCHDigit(j.G15);)c^=j.G15<<j.getBCHDigit(c)-j.getBCHDigit(j.G15);return(a<<10|c)^j.G15_MASK},getBCHTypeNumber:function(a){for(var c=a<<12;0<=j.getBCHDigit(c)-
395j.getBCHDigit(j.G18);)c^=j.G18<<j.getBCHDigit(c)-j.getBCHDigit(j.G18);return a<<12|c},getBCHDigit:function(a){for(var c=0;0!=a;)c++,a>>>=1;return c},getPatternPosition:function(a){return j.PATTERN_POSITION_TABLE[a-1]},getMask:function(a,c,d){switch(a){case 0:return 0==(c+d)%2;case 1:return 0==c%2;case 2:return 0==d%3;case 3:return 0==(c+d)%3;case 4:return 0==(Math.floor(c/2)+Math.floor(d/3))%2;case 5:return 0==c*d%2+c*d%3;case 6:return 0==(c*d%2+c*d%3)%2;case 7:return 0==(c*d%3+(c+d)%2)%2;default:throw Error("bad maskPattern:"+
396a);}},getErrorCorrectPolynomial:function(a){for(var c=new q([1],0),d=0;d<a;d++)c=c.multiply(new q([1,l.gexp(d)],0));return c},getLengthInBits:function(a,c){if(1<=c&&10>c)switch(a){case 1:return 10;case 2:return 9;case s:return 8;case 8:return 8;default:throw Error("mode:"+a);}else if(27>c)switch(a){case 1:return 12;case 2:return 11;case s:return 16;case 8:return 10;default:throw Error("mode:"+a);}else if(41>c)switch(a){case 1:return 14;case 2:return 13;case s:return 16;case 8:return 12;default:throw Error("mode:"+
397a);}else throw Error("type:"+c);},getLostPoint:function(a){for(var c=a.getModuleCount(),d=0,b=0;b<c;b++)for(var e=0;e<c;e++){for(var f=0,i=a.isDark(b,e),g=-1;1>=g;g++)if(!(0>b+g||c<=b+g))for(var h=-1;1>=h;h++)0>e+h||c<=e+h||0==g&&0==h||i==a.isDark(b+g,e+h)&&f++;5<f&&(d+=3+f-5)}for(b=0;b<c-1;b++)for(e=0;e<c-1;e++)if(f=0,a.isDark(b,e)&&f++,a.isDark(b+1,e)&&f++,a.isDark(b,e+1)&&f++,a.isDark(b+1,e+1)&&f++,0==f||4==f)d+=3;for(b=0;b<c;b++)for(e=0;e<c-6;e++)a.isDark(b,e)&&!a.isDark(b,e+1)&&a.isDark(b,e+
3982)&&a.isDark(b,e+3)&&a.isDark(b,e+4)&&!a.isDark(b,e+5)&&a.isDark(b,e+6)&&(d+=40);for(e=0;e<c;e++)for(b=0;b<c-6;b++)a.isDark(b,e)&&!a.isDark(b+1,e)&&a.isDark(b+2,e)&&a.isDark(b+3,e)&&a.isDark(b+4,e)&&!a.isDark(b+5,e)&&a.isDark(b+6,e)&&(d+=40);for(e=f=0;e<c;e++)for(b=0;b<c;b++)a.isDark(b,e)&&f++;a=Math.abs(100*f/c/c-50)/5;return d+10*a}},l={glog:function(a){if(1>a)throw Error("glog("+a+")");return l.LOG_TABLE[a]},gexp:function(a){for(;0>a;)a+=255;for(;256<=a;)a-=255;return l.EXP_TABLE[a]},EXP_TABLE:Array(256),
399LOG_TABLE:Array(256)},m=0;8>m;m++)l.EXP_TABLE[m]=1<<m;for(m=8;256>m;m++)l.EXP_TABLE[m]=l.EXP_TABLE[m-4]^l.EXP_TABLE[m-5]^l.EXP_TABLE[m-6]^l.EXP_TABLE[m-8];for(m=0;255>m;m++)l.LOG_TABLE[l.EXP_TABLE[m]]=m;q.prototype={get:function(a){return this.num[a]},getLength:function(){return this.num.length},multiply:function(a){for(var c=Array(this.getLength()+a.getLength()-1),d=0;d<this.getLength();d++)for(var b=0;b<a.getLength();b++)c[d+b]^=l.gexp(l.glog(this.get(d))+l.glog(a.get(b)));return new q(c,0)},mod:function(a){if(0>
400this.getLength()-a.getLength())return this;for(var c=l.glog(this.get(0))-l.glog(a.get(0)),d=Array(this.getLength()),b=0;b<this.getLength();b++)d[b]=this.get(b);for(b=0;b<a.getLength();b++)d[b]^=l.gexp(l.glog(a.get(b))+c);return(new q(d,0)).mod(a)}};p.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],
401[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,
402116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,
40343,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,
4043,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,
40555,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,
40645,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];p.getRSBlocks=function(a,c){var d=p.getRsBlockTable(a,c);if(void 0==d)throw Error("bad rs block @ typeNumber:"+a+"/errorCorrectLevel:"+c);for(var b=d.length/3,e=[],f=0;f<b;f++)for(var h=d[3*f+0],g=d[3*f+1],j=d[3*f+2],l=0;l<h;l++)e.push(new p(g,j));return e};p.getRsBlockTable=function(a,c){switch(c){case 1:return p.RS_BLOCK_TABLE[4*(a-1)+0];case 0:return p.RS_BLOCK_TABLE[4*(a-1)+1];case 3:return p.RS_BLOCK_TABLE[4*
407(a-1)+2];case 2:return p.RS_BLOCK_TABLE[4*(a-1)+3]}};t.prototype={get:function(a){return 1==(this.buffer[Math.floor(a/8)]>>>7-a%8&1)},put:function(a,c){for(var d=0;d<c;d++)this.putBit(1==(a>>>c-d-1&1))},getLengthInBits:function(){return this.length},putBit:function(a){var c=Math.floor(this.length/8);this.buffer.length<=c&&this.buffer.push(0);a&&(this.buffer[c]|=128>>>this.length%8);this.length++}};"string"===typeof h&&(h={text:h});h=r.extend({},{render:"canvas",width:256,height:256,typeNumber:-1,
408correctLevel:2,background:"#ffffff",foreground:"#000000"},h);return this.each(function(){var a;if("canvas"==h.render){a=new o(h.typeNumber,h.correctLevel);a.addData(h.text);a.make();var c=document.createElement("canvas");c.width=h.width;c.height=h.height;for(var d=c.getContext("2d"),b=h.width/a.getModuleCount(),e=h.height/a.getModuleCount(),f=0;f<a.getModuleCount();f++)for(var i=0;i<a.getModuleCount();i++){d.fillStyle=a.isDark(f,i)?h.foreground:h.background;var g=Math.ceil((i+1)*b)-Math.floor(i*b),
409j=Math.ceil((f+1)*b)-Math.floor(f*b);d.fillRect(Math.round(i*b),Math.round(f*e),g,j)}}else{a=new o(h.typeNumber,h.correctLevel);a.addData(h.text);a.make();c=r("<table></table>").css("width",h.width+"px").css("height",h.height+"px").css("border","0px").css("border-collapse","collapse").css("background-color",h.background);d=h.width/a.getModuleCount();b=h.height/a.getModuleCount();for(e=0;e<a.getModuleCount();e++){f=r("<tr></tr>").css("height",b+"px").appendTo(c);for(i=0;i<a.getModuleCount();i++)r("<td></td>").css("width",
410d+"px").css("background-color",a.isDark(e,i)?h.foreground:h.background).appendTo(f)}}a=c;
410$(a).appendTo(this)})}})($);
411</script>
411
412        
412<script>(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.bitcoin = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
413// (public) Constructor
414function BigInteger(a, b, c) {
415  if (!(this instanceof BigInteger))
416    return new BigInteger(a, b, c)
417
418  if (a != null) {
419    if ("number" == typeof a) this.fromNumber(a, b, c)
420    else if (b == null && "string" != typeof a) this.fromString(a, 256)
421    else this.fromString(a, b)
422  }
423}
424
425var proto = BigInteger.prototype
426
427// duck-typed isBigInteger
428proto.__bigi = require('../package.json').version
429BigInteger.isBigInteger = function (obj, check_ver) {
430  return obj && obj.__bigi && (!check_ver || obj.__bigi === proto.__bigi)
431}
432
433// Bits per digit
434var dbits
435
436// am: Compute w_j += (x*this_i), propagate carries,
437// c is initial carry, returns final carry.
438// c < 3*dvalue, x < 2*dvalue, this_i < dvalue
439// We need to select the fastest one that works in this environment.
440
441// am1: use a single mult and divide to get the high bits,
442// max digit bits should be 26 because
443// max internal value = 2*dvalue^2-2*dvalue (< 2^53)
444function am1(i, x, w, j, c, n) {
445  while (--n >= 0) {
446    var v = x * this[i++] + w[j] + c
447    c = Math.floor(v / 0x4000000)
448    w[j++] = v & 0x3ffffff
449  }
450  return c
451}
452// am2 avoids a big mult-and-extract completely.
453// Max digit bits should be <= 30 because we do bitwise ops
454// on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)
455function am2(i, x, w, j, c, n) {
456  var xl = x & 0x7fff,
457    xh = x >> 15
458  while (--n >= 0) {
459    var l = this[i] & 0x7fff
460    var h = this[i++] >> 15
461    var m = xh * l + h * xl
462    l = xl * l + ((m & 0x7fff) << 15) + w[j] + (c & 0x3fffffff)
463    c = (l >>> 30) + (m >>> 15) + xh * h + (c >>> 30)
464    w[j++] = l & 0x3fffffff
465  }
466  return c
467}
468// Alternately, set max digit bits to 28 since some
469// browsers slow down when dealing with 32-bit numbers.
470function am3(i, x, w, j, c, n) {
471  var xl = x & 0x3fff,
472    xh = x >> 14
473  while (--n >= 0) {
474    var l = this[i] & 0x3fff
475    var h = this[i++] >> 14
476    var m = xh * l + h * xl
477    l = xl * l + ((m & 0x3fff) << 14) + w[j] + c
478    c = (l >> 28) + (m >> 14) + xh * h
479    w[j++] = l & 0xfffffff
480  }
481  return c
482}
483
484// wtf?
485BigInteger.prototype.am = am1
486dbits = 26
487
488BigInteger.prototype.DB = dbits
489BigInteger.prototype.DM = ((1 << dbits) - 1)
490var DV = BigInteger.prototype.DV = (1 << dbits)
491
492var BI_FP = 52
493BigInteger.prototype.FV = Math.pow(2, BI_FP)
494BigInteger.prototype.F1 = BI_FP - dbits
495BigInteger.prototype.F2 = 2 * dbits - BI_FP
496
497// Digit conversions
498var BI_RM = "0123456789abcdefghijklmnopqrstuvwxyz"
499var BI_RC = new Array()
500var rr, vv
501rr = "0".charCodeAt(0)
502for (vv = 0; vv <= 9; ++vv) BI_RC[rr++] = vv
503rr = "a".charCodeAt(0)
504for (vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv
505rr = "A".charCodeAt(0)
506for (vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv
507
508function int2char(n) {
509  return BI_RM.charAt(n)
510}
511
512function intAt(s, i) {
513  var c = BI_RC[s.charCodeAt(i)]
514  return (c == null) ? -1 : c
515}
516
517// (protected) copy this to r
518function bnpCopyTo(r) {
519  for (var i = this.t - 1; i >= 0; --i) r[i] = this[i]
520  r.t = this.t
521  r.s = this.s
522}
523
524// (protected) set from integer value x, -DV <= x < DV
525function bnpFromInt(x) {
526  this.t = 1
527  this.s = (x < 0) ? -1 : 0
528  if (x > 0) this[0] = x
529  else if (x < -1) this[0] = x + DV
530  else this.t = 0
531}
532
533// return bigint initialized to value
534function nbv(i) {
535  var r = new BigInteger()
536  r.fromInt(i)
537  return r
538}
539
540// (protected) set from string and radix
541function bnpFromString(s, b) {
542  var self = this
543
544  var k
545  if (b == 16) k = 4
546  else if (b == 8) k = 3
547  else if (b == 256) k = 8; // byte array
548  else if (b == 2) k = 1
549  else if (b == 32) k = 5
550  else if (b == 4) k = 2
551  else {
552    self.fromRadix(s, b)
553    return
554  }
555  self.t = 0
556  self.s = 0
557  var i = s.length,
558    mi = false,
559    sh = 0
560  while (--i >= 0) {
561    var x = (k == 8) ? s[i] & 0xff : intAt(s, i)
562    if (x < 0) {
563      if (s.charAt(i) == "-") mi = true
564      continue
565    }
566    mi = false
567    if (sh == 0)
568      self[self.t++] = x
569    else if (sh + k > self.DB) {
570      self[self.t - 1] |= (x & ((1 << (self.DB - sh)) - 1)) << sh
571      self[self.t++] = (x >> (self.DB - sh))
572    } else
573      self[self.t - 1] |= x << sh
574    sh += k
575    if (sh >= self.DB) sh -= self.DB
576  }
577  if (k == 8 && (s[0] & 0x80) != 0) {
578    self.s = -1
579    if (sh > 0) self[self.t - 1] |= ((1 << (self.DB - sh)) - 1) << sh
580  }
581  self.clamp()
582  if (mi) BigInteger.ZERO.subTo(self, self)
583}
584
585// (protected) clamp off excess high words
586function bnpClamp() {
587  var c = this.s & this.DM
588  while (this.t > 0 && this[this.t - 1] == c)--this.t
589}
590
591// (public) return string representation in given radix
592function bnToString(b) {
593  var self = this
594  if (self.s < 0) return "-" + self.negate()
595    .toString(b)
596  var k
597  if (b == 16) k = 4
598  else if (b == 8) k = 3
599  else if (b == 2) k = 1
600  else if (b == 32) k = 5
601  else if (b == 4) k = 2
602  else return self.toRadix(b)
603  var km = (1 << k) - 1,
604    d, m = false,
605    r = "",
606    i = self.t
607  var p = self.DB - (i * self.DB) % k
608  if (i-- > 0) {
609    if (p < self.DB && (d = self[i] >> p) > 0) {
610      m = true
611      r = int2char(d)
612    }
613    while (i >= 0) {
614      if (p < k) {
615        d = (self[i] & ((1 << p) - 1)) << (k - p)
616        d |= self[--i] >> (p += self.DB - k)
617      } else {
618        d = (self[i] >> (p -= k)) & km
619        if (p <= 0) {
620          p += self.DB
621          --i
622        }
623      }
624      if (d > 0) m = true
625      if (m) r += int2char(d)
626    }
627  }
628  return m ? r : "0"
629}
630
631// (public) -this
632function bnNegate() {
633  var r = new BigInteger()
634  BigInteger.ZERO.subTo(this, r)
635  return r
636}
637
638// (public) |this|
639function bnAbs() {
640  return (this.s < 0) ? this.negate() : this
641}
642
643// (public) return + if this > a, - if this < a, 0 if equal
644function bnCompareTo(a) {
645  var r = this.s - a.s
646  if (r != 0) return r
647  var i = this.t
648  r = i - a.t
649  if (r != 0) return (this.s < 0) ? -r : r
650  while (--i >= 0)
651    if ((r = this[i] - a[i]) != 0) return r
652  return 0
653}
654
655// returns bit length of the integer x
656function nbits(x) {
657  var r = 1,
658    t
659  if ((t = x >>> 16) != 0) {
660    x = t
661    r += 16
662  }
663  if ((t = x >> 8) != 0) {
664    x = t
665    r += 8
666  }
667  if ((t = x >> 4) != 0) {
668    x = t
669    r += 4
670  }
671  if ((t = x >> 2) != 0) {
672    x = t
673    r += 2
674  }
675  if ((t = x >> 1) != 0) {
676    x = t
677    r += 1
678  }
679  return r
680}
681
682// (public) return the number of bits in "this"
683function bnBitLength() {
684  if (this.t <= 0) return 0
685  return this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ (this.s & this.DM))
686}
687
688// (public) return the number of bytes in "this"
689function bnByteLength() {
690  return this.bitLength() >> 3
691}
692
693// (protected) r = this << n*DB
694function bnpDLShiftTo(n, r) {
695  var i
696  for (i = this.t - 1; i >= 0; --i) r[i + n] = this[i]
697  for (i = n - 1; i >= 0; --i) r[i] = 0
698  r.t = this.t + n
699  r.s = this.s
700}
701
702// (protected) r = this >> n*DB
703function bnpDRShiftTo(n, r) {
704  for (var i = n; i < this.t; ++i) r[i - n] = this[i]
705  r.t = Math.max(this.t - n, 0)
706  r.s = this.s
707}
708
709// (protected) r = this << n
710function bnpLShiftTo(n, r) {
711  var self = this
712  var bs = n % self.DB
713  var cbs = self.DB - bs
714  var bm = (1 << cbs) - 1
715  var ds = Math.floor(n / self.DB),
716    c = (self.s << bs) & self.DM,
717    i
718  for (i = self.t - 1; i >= 0; --i) {
719    r[i + ds + 1] = (self[i] >> cbs) | c
720    c = (self[i] & bm) << bs
721  }
722  for (i = ds - 1; i >= 0; --i) r[i] = 0
723  r[ds] = c
724  r.t = self.t + ds + 1
725  r.s = self.s
726  r.clamp()
727}
728
729// (protected) r = this >> n
730function bnpRShiftTo(n, r) {
731  var self = this
732  r.s = self.s
733  var ds = Math.floor(n / self.DB)
734  if (ds >= self.t) {
735    r.t = 0
736    return
737  }
738  var bs = n % self.DB
739  var cbs = self.DB - bs
740  var bm = (1 << bs) - 1
741  r[0] = self[ds] >> bs
742  for (var i = ds + 1; i < self.t; ++i) {
743    r[i - ds - 1] |= (self[i] & bm) << cbs
744    r[i - ds] = self[i] >> bs
745  }
746  if (bs > 0) r[self.t - ds - 1] |= (self.s & bm) << cbs
747  r.t = self.t - ds
748  r.clamp()
749}
750
751// (protected) r = this - a
752function bnpSubTo(a, r) {
753  var self = this
754  var i = 0,
755    c = 0,
756    m = Math.min(a.t, self.t)
757  while (i < m) {
758    c += self[i] - a[i]
759    r[i++] = c & self.DM
760    c >>= self.DB
761  }
762  if (a.t < self.t) {
763    c -= a.s
764    while (i < self.t) {
765      c += self[i]
766      r[i++] = c & self.DM
767      c >>= self.DB
768    }
769    c += self.s
770  } else {
771    c += self.s
772    while (i < a.t) {
773      c -= a[i]
774      r[i++] = c & self.DM
775      c >>= self.DB
776    }
777    c -= a.s
778  }
779  r.s = (c < 0) ? -1 : 0
780  if (c < -1) r[i++] = self.DV + c
781  else if (c > 0) r[i++] = c
782  r.t = i
783  r.clamp()
784}
785
786// (protected) r = this * a, r != this,a (HAC 14.12)
787// "this" should be the larger one if appropriate.
788function bnpMultiplyTo(a, r) {
789  var x = this.abs(),
790    y = a.abs()
791  var i = x.t
792  r.t = i + y.t
793  while (--i >= 0) r[i] = 0
794  for (i = 0; i < y.t; ++i) r[i + x.t] = x.am(0, y[i], r, i, 0, x.t)
795  r.s = 0
796  r.clamp()
797  if (this.s != a.s) BigInteger.ZERO.subTo(r, r)
798}
799
800// (protected) r = this^2, r != this (HAC 14.16)
801function bnpSquareTo(r) {
802  var x = this.abs()
803  var i = r.t = 2 * x.t
804  while (--i >= 0) r[i] = 0
805  for (i = 0; i < x.t - 1; ++i) {
806    var c = x.am(i, x[i], r, 2 * i, 0, 1)
807    if ((r[i + x.t] += x.am(i + 1, 2 * x[i], r, 2 * i + 1, c, x.t - i - 1)) >= x.DV) {
808      r[i + x.t] -= x.DV
809      r[i + x.t + 1] = 1
810    }
811  }
812  if (r.t > 0) r[r.t - 1] += x.am(i, x[i], r, 2 * i, 0, 1)
813  r.s = 0
814  r.clamp()
815}
816
817// (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)
818// r != q, this != m.  q or r may be null.
819function bnpDivRemTo(m, q, r) {
820  var self = this
821  var pm = m.abs()
822  if (pm.t <= 0) return
823  var pt = self.abs()
824  if (pt.t < pm.t) {
825    if (q != null) q.fromInt(0)
826    if (r != null) self.copyTo(r)
827    return
828  }
829  if (r == null) r = new BigInteger()
830  var y = new BigInteger(),
831    ts = self.s,
832    ms = m.s
833  var nsh = self.DB - nbits(pm[pm.t - 1]); // normalize modulus
834  if (nsh > 0) {
835    pm.lShiftTo(nsh, y)
836    pt.lShiftTo(nsh, r)
837  } else {
838    pm.copyTo(y)
839    pt.copyTo(r)
840  }
841  var ys = y.t
842  var y0 = y[ys - 1]
843  if (y0 == 0) return
844  var yt = y0 * (1 << self.F1) + ((ys > 1) ? y[ys - 2] >> self.F2 : 0)
845  var d1 = self.FV / yt,
846    d2 = (1 << self.F1) / yt,
847    e = 1 << self.F2
848  var i = r.t,
849    j = i - ys,
850    t = (q == null) ? new BigInteger() : q
851  y.dlShiftTo(j, t)
852  if (r.compareTo(t) >= 0) {
853    r[r.t++] = 1
854    r.subTo(t, r)
855  }
856  BigInteger.ONE.dlShiftTo(ys, t)
857  t.subTo(y, y); // "negative" y so we can replace sub with am later
858  while (y.t < ys) y[y.t++] = 0
859  while (--j >= 0) {
860    // Estimate quotient digit
861    var qd = (r[--i] == y0) ? self.DM : Math.floor(r[i] * d1 + (r[i - 1] + e) * d2)
862    if ((r[i] += y.am(0, qd, r, j, 0, ys)) < qd) { // Try it out
863      y.dlShiftTo(j, t)
864      r.subTo(t, r)
865      while (r[i] < --qd) r.subTo(t, r)
866    }
867  }
868  if (q != null) {
869    r.drShiftTo(ys, q)
870    if (ts != ms) BigInteger.ZERO.subTo(q, q)
871  }
872  r.t = ys
873  r.clamp()
874  if (nsh > 0) r.rShiftTo(nsh, r); // Denormalize remainder
875  if (ts < 0) BigInteger.ZERO.subTo(r, r)
876}
877
878// (public) this mod a
879function bnMod(a) {
880  var r = new BigInteger()
881  this.abs()
882    .divRemTo(a, null, r)
883  if (this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r, r)
884  return r
885}
886
887// Modular reduction using "classic" algorithm
888function Classic(m) {
889  this.m = m
890}
891
892function cConvert(x) {
893  if (x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m)
894  else return x
895}
896
897function cRevert(x) {
898  return x
899}
900
901function cReduce(x) {
902  x.divRemTo(this.m, null, x)
903}
904
905function cMulTo(x, y, r) {
906  x.multiplyTo(y, r)
907  this.reduce(r)
908}
909
910function cSqrTo(x, r) {
911  x.squareTo(r)
912  this.reduce(r)
913}
914
915Classic.prototype.convert = cConvert
916Classic.prototype.revert = cRevert
917Classic.prototype.reduce = cReduce
918Classic.prototype.mulTo = cMulTo
919Classic.prototype.sqrTo = cSqrTo
920
921// (protected) return "-1/this % 2^DB"; useful for Mont. reduction
922// justification:
923//         xy == 1 (mod m)
924//         xy =  1+km
925//   xy(2-xy) = (1+km)(1-km)
926// x[y(2-xy)] = 1-k^2m^2
927// x[y(2-xy)] == 1 (mod m^2)
928// if y is 1/x mod m, then y(2-xy) is 1/x mod m^2
929// should reduce x and y(2-xy) by m^2 at each step to keep size bounded.
930// JS multiply "overflows" differently from C/C++, so care is needed here.
931function bnpInvDigit() {
932  if (this.t < 1) return 0
933  var x = this[0]
934  if ((x & 1) == 0) return 0
935  var y = x & 3; // y == 1/x mod 2^2
936  y = (y * (2 - (x & 0xf) * y)) & 0xf; // y == 1/x mod 2^4
937  y = (y * (2 - (x & 0xff) * y)) & 0xff; // y == 1/x mod 2^8
938  y = (y * (2 - (((x & 0xffff) * y) & 0xffff))) & 0xffff; // y == 1/x mod 2^16
939  // last step - calculate inverse mod DV directly
940  // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints
941  y = (y * (2 - x * y % this.DV)) % this.DV; // y == 1/x mod 2^dbits
942  // we really want the negative inverse, and -DV < y < DV
943  return (y > 0) ? this.DV - y : -y
944}
945
946// Montgomery reduction
947function Montgomery(m) {
948  this.m = m
949  this.mp = m.invDigit()
950  this.mpl = this.mp & 0x7fff
951  this.mph = this.mp >> 15
952  this.um = (1 << (m.DB - 15)) - 1
953  this.mt2 = 2 * m.t
954}
955
956// xR mod m
957function montConvert(x) {
958  var r = new BigInteger()
959  x.abs()
960    .dlShiftTo(this.m.t, r)
961  r.divRemTo(this.m, null, r)
962  if (x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r, r)
963  return r
964}
965
966// x/R mod m
967function montRevert(x) {
968  var r = new BigInteger()
969  x.copyTo(r)
970  this.reduce(r)
971  return r
972}
973
974// x = x/R mod m (HAC 14.32)
975function montReduce(x) {
976  while (x.t <= this.mt2) // pad x so am has enough room later
977    x[x.t++] = 0
978  for (var i = 0; i < this.m.t; ++i) {
979    // faster way of calculating u0 = x[i]*mp mod DV
980    var j = x[i] & 0x7fff
981    var u0 = (j * this.mpl + (((j * this.mph + (x[i] >> 15) * this.mpl) & this.um) << 15)) & x.DM
982    // use am to combine the multiply-shift-add into one call
983    j = i + this.m.t
984    x[j] += this.m.am(0, u0, x, i, 0, this.m.t)
985    // propagate carry
986    while (x[j] >= x.DV) {
987      x[j] -= x.DV
988      x[++j]++
989    }
990  }
991  x.clamp()
992  x.drShiftTo(this.m.t, x)
993  if (x.compareTo(this.m) >= 0) x.subTo(this.m, x)
994}
995
996// r = "x^2/R mod m"; x != r
997function montSqrTo(x, r) {
998  x.squareTo(r)
999  this.reduce(r)
1000}
1001
1002// r = "xy/R mod m"; x,y != r
1003function montMulTo(x, y, r) {
1004  x.multiplyTo(y, r)
1005  this.reduce(r)
1006}
1007
1008Montgomery.prototype.convert = montConvert
1009Montgomery.prototype.revert = montRevert
1010Montgomery.prototype.reduce = montReduce
1011Montgomery.prototype.mulTo = montMulTo
1012Montgomery.prototype.sqrTo = montSqrTo
1013
1014// (protected) true iff this is even
1015function bnpIsEven() {
1016  return ((this.t > 0) ? (this[0] & 1) : this.s) == 0
1017}
1018
1019// (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79)
1020function bnpExp(e, z) {
1021  if (e > 0xffffffff || e < 1) return BigInteger.ONE
1022  var r = new BigInteger(),
1023    r2 = new BigInteger(),
1024    g = z.convert(this),
1025    i = nbits(e) - 1
1026  g.copyTo(r)
1027  while (--i >= 0) {
1028    z.sqrTo(r, r2)
1029    if ((e & (1 << i)) > 0) z.mulTo(r2, g, r)
1030    else {
1031      var t = r
1032      r = r2
1033      r2 = t
1034    }
1035  }
1036  return z.revert(r)
1037}
1038
1039// (public) this^e % m, 0 <= e < 2^32
1040function bnModPowInt(e, m) {
1041  var z
1042  if (e < 256 || m.isEven()) z = new Classic(m)
1043  else z = new Montgomery(m)
1044  return this.exp(e, z)
1045}
1046
1047// protected
1048proto.copyTo = bnpCopyTo
1049proto.fromInt = bnpFromInt
1050proto.fromString = bnpFromString
1051proto.clamp = bnpClamp
1052proto.dlShiftTo = bnpDLShiftTo
1053proto.drShiftTo = bnpDRShiftTo
1054proto.lShiftTo = bnpLShiftTo
1055proto.rShiftTo = bnpRShiftTo
1056proto.subTo = bnpSubTo
1057proto.multiplyTo = bnpMultiplyTo
1058proto.squareTo = bnpSquareTo
1059proto.divRemTo = bnpDivRemTo
1060proto.invDigit = bnpInvDigit
1061proto.isEven = bnpIsEven
1062proto.exp = bnpExp
1063
1064// public
1065proto.toString = bnToString
1066proto.negate = bnNegate
1067proto.abs = bnAbs
1068proto.compareTo = bnCompareTo
1069proto.bitLength = bnBitLength
1070proto.byteLength = bnByteLength
1071proto.mod = bnMod
1072proto.modPowInt = bnModPowInt
1073
1074// (public)
1075function bnClone() {
1076  var r = new BigInteger()
1077  this.copyTo(r)
1078  return r
1079}
1080
1081// (public) return value as integer
1082function bnIntValue() {
1083  if (this.s < 0) {
1084    if (this.t == 1) return this[0] - this.DV
1085    else if (this.t == 0) return -1
1086  } else if (this.t == 1) return this[0]
1087  else if (this.t == 0) return 0
1088  // assumes 16 < DB < 32
1089  return ((this[1] & ((1 << (32 - this.DB)) - 1)) << this.DB) | this[0]
1090}
1091
1092// (public) return value as byte
1093function bnByteValue() {
1094  return (this.t == 0) ? this.s : (this[0] << 24) >> 24
1095}
1096
1097// (public) return value as short (assumes DB>=16)
1098function bnShortValue() {
1099  return (this.t == 0) ? this.s : (this[0] << 16) >> 16
1100}
1101
1102// (protected) return x s.t. r^x < DV
1103function bnpChunkSize(r) {
1104  return Math.floor(Math.LN2 * this.DB / Math.log(r))
1105}
1106
1107// (public) 0 if this == 0, 1 if this > 0
1108function bnSigNum() {
1109  if (this.s < 0) return -1
1110  else if (this.t <= 0 || (this.t == 1 && this[0] <= 0)) return 0
1111  else return 1
1112}
1113
1114// (protected) convert to radix string
1115function bnpToRadix(b) {
1116  if (b == null) b = 10
1117  if (this.signum() == 0 || b < 2 || b > 36) return "0"
1118  var cs = this.chunkSize(b)
1119  var a = Math.pow(b, cs)
1120  var d = nbv(a),
1121    y = new BigInteger(),
1122    z = new BigInteger(),
1123    r = ""
1124  this.divRemTo(d, y, z)
1125  while (y.signum() > 0) {
1126    r = (a + z.intValue())
1127      .toString(b)
1128      .substr(1) + r
1129    y.divRemTo(d, y, z)
1130  }
1131  return z.intValue()
1132    .toString(b) + r
1133}
1134
1135// (protected) convert from radix string
1136function bnpFromRadix(s, b) {
1137  var self = this
1138  self.fromInt(0)
1139  if (b == null) b = 10
1140  var cs = self.chunkSize(b)
1141  var d = Math.pow(b, cs),
1142    mi = false,
1143    j = 0,
1144    w = 0
1145  for (var i = 0; i < s.length; ++i) {
1146    var x = intAt(s, i)
1147    if (x < 0) {
1148      if (s.charAt(i) == "-" && self.signum() == 0) mi = true
1149      continue
1150    }
1151    w = b * w + x
1152    if (++j >= cs) {
1153      self.dMultiply(d)
1154      self.dAddOffset(w, 0)
1155      j = 0
1156      w = 0
1157    }
1158  }
1159  if (j > 0) {
1160    self.dMultiply(Math.pow(b, j))
1161    self.dAddOffset(w, 0)
1162  }
1163  if (mi) BigInteger.ZERO.subTo(self, self)
1164}
1165
1166// (protected) alternate constructor
1167function bnpFromNumber(a, b, c) {
1168  var self = this
1169  if ("number" == typeof b) {
1170    // new BigInteger(int,int,RNG)
1171    if (a < 2) self.fromInt(1)
1172    else {
1173      self.fromNumber(a, c)
1174      if (!self.testBit(a - 1)) // force MSB set
1175        self.bitwiseTo(BigInteger.ONE.shiftLeft(a - 1), op_or, self)
1176      if (self.isEven()) self.dAddOffset(1, 0); // force odd
1177      while (!self.isProbablePrime(b)) {
1178        self.dAddOffset(2, 0)
1179        if (self.bitLength() > a) self.subTo(BigInteger.ONE.shiftLeft(a - 1), self)
1180      }
1181    }
1182  } else {
1183    // new BigInteger(int,RNG)
1184    var x = new Array(),
1185      t = a & 7
1186    x.length = (a >> 3) + 1
1187    b.nextBytes(x)
1188    if (t > 0) x[0] &= ((1 << t) - 1)
1189    else x[0] = 0
1190    self.fromString(x, 256)
1191  }
1192}
1193
1194// (public) convert to bigendian byte array
1195function bnToByteArray() {
1196  var self = this
1197  var i = self.t,
1198    r = new Array()
1199  r[0] = self.s
1200  var p = self.DB - (i * self.DB) % 8,
1201    d, k = 0
1202  if (i-- > 0) {
1203    if (p < self.DB && (d = self[i] >> p) != (self.s & self.DM) >> p)
1204      r[k++] = d | (self.s << (self.DB - p))
1205    while (i >= 0) {
1206      if (p < 8) {
1207        d = (self[i] & ((1 << p) - 1)) << (8 - p)
1208        d |= self[--i] >> (p += self.DB - 8)
1209      } else {
1210        d = (self[i] >> (p -= 8)) & 0xff
1211        if (p <= 0) {
1212          p += self.DB
1213          --i
1214        }
1215      }
1216      if ((d & 0x80) != 0) d |= -256
1217      if (k === 0 && (self.s & 0x80) != (d & 0x80))++k
1218      if (k > 0 || d != self.s) r[k++] = d
1219    }
1220  }
1221  return r
1222}
1223
1224function bnEquals(a) {
1225  return (this.compareTo(a) == 0)
1226}
1227
1228function bnMin(a) {
1229  return (this.compareTo(a) < 0) ? this : a
1230}
1231
1232function bnMax(a) {
1233  return (this.compareTo(a) > 0) ? this : a
1234}
1235
1236// (protected) r = this op a (bitwise)
1237function bnpBitwiseTo(a, op, r) {
1238  var self = this
1239  var i, f, m = Math.min(a.t, self.t)
1240  for (i = 0; i < m; ++i) r[i] = op(self[i], a[i])
1241  if (a.t < self.t) {
1242    f = a.s & self.DM
1243    for (i = m; i < self.t; ++i) r[i] = op(self[i], f)
1244    r.t = self.t
1245  } else {
1246    f = self.s & self.DM
1247    for (i = m; i < a.t; ++i) r[i] = op(f, a[i])
1248    r.t = a.t
1249  }
1250  r.s = op(self.s, a.s)
1251  r.clamp()
1252}
1253
1254// (public) this & a
1255function op_and(x, y) {
1256  return x & y
1257}
1258
1259function bnAnd(a) {
1260  var r = new BigInteger()
1261  this.bitwiseTo(a, op_and, r)
1262  return r
1263}
1264
1265// (public) this | a
1266function op_or(x, y) {
1267  return x | y
1268}
1269
1270function bnOr(a) {
1271  var r = new BigInteger()
1272  this.bitwiseTo(a, op_or, r)
1273  return r
1274}
1275
1276// (public) this ^ a
1277function op_xor(x, y) {
1278  return x ^ y
1279}
1280
1281function bnXor(a) {
1282  var r = new BigInteger()
1283  this.bitwiseTo(a, op_xor, r)
1284  return r
1285}
1286
1287// (public) this & ~a
1288function op_andnot(x, y) {
1289  return x & ~y
1290}
1291
1292function bnAndNot(a) {
1293  var r = new BigInteger()
1294  this.bitwiseTo(a, op_andnot, r)
1295  return r
1296}
1297
1298// (public) ~this
1299function bnNot() {
1300  var r = new BigInteger()
1301  for (var i = 0; i < this.t; ++i) r[i] = this.DM & ~this[i]
1302  r.t = this.t
1303  r.s = ~this.s
1304  return r
1305}
1306
1307// (public) this << n
1308function bnShiftLeft(n) {
1309  var r = new BigInteger()
1310  if (n < 0) this.rShiftTo(-n, r)
1311  else this.lShiftTo(n, r)
1312  return r
1313}
1314
1315// (public) this >> n
1316function bnShiftRight(n) {
1317  var r = new BigInteger()
1318  if (n < 0) this.lShiftTo(-n, r)
1319  else this.rShiftTo(n, r)
1320  return r
1321}
1322
1323// return index of lowest 1-bit in x, x < 2^31
1324function lbit(x) {
1325  if (x == 0) return -1
1326  var r = 0
1327  if ((x & 0xffff) == 0) {
1328    x >>= 16
1329    r += 16
1330  }
1331  if ((x & 0xff) == 0) {
1332    x >>= 8
1333    r += 8
1334  }
1335  if ((x & 0xf) == 0) {
1336    x >>= 4
1337    r += 4
1338  }
1339  if ((x & 3) == 0) {
1340    x >>= 2
1341    r += 2
1342  }
1343  if ((x & 1) == 0)++r
1344  return r
1345}
1346
1347// (public) returns index of lowest 1-bit (or -1 if none)
1348function bnGetLowestSetBit() {
1349  for (var i = 0; i < this.t; ++i)
1350    if (this[i] != 0) return i * this.DB + lbit(this[i])
1351  if (this.s < 0) return this.t * this.DB
1352  return -1
1353}
1354
1355// return number of 1 bits in x
1356function cbit(x) {
1357  var r = 0
1358  while (x != 0) {
1359    x &= x - 1
1360    ++r
1361  }
1362  return r
1363}
1364
1365// (public) return number of set bits
1366function bnBitCount() {
1367  var r = 0,
1368    x = this.s & this.DM
1369  for (var i = 0; i < this.t; ++i) r += cbit(this[i] ^ x)
1370  return r
1371}
1372
1373// (public) true iff nth bit is set
1374function bnTestBit(n) {
1375  var j = Math.floor(n / this.DB)
1376  if (j >= this.t) return (this.s != 0)
1377  return ((this[j] & (1 << (n % this.DB))) != 0)
1378}
1379
1380// (protected) this op (1<<n)
1381function bnpChangeBit(n, op) {
1382  var r = BigInteger.ONE.shiftLeft(n)
1383  this.bitwiseTo(r, op, r)
1384  return r
1385}
1386
1387// (public) this | (1<<n)
1388function bnSetBit(n) {
1389  return this.changeBit(n, op_or)
1390}
1391
1392// (public) this & ~(1<<n)
1393function bnClearBit(n) {
1394  return this.changeBit(n, op_andnot)
1395}
1396
1397// (public) this ^ (1<<n)
1398function bnFlipBit(n) {
1399  return this.changeBit(n, op_xor)
1400}
1401
1402// (protected) r = this + a
1403function bnpAddTo(a, r) {
1404  var self = this
1405
1406  var i = 0,
1407    c = 0,
1408    m = Math.min(a.t, self.t)
1409  while (i < m) {
1410    c += self[i] + a[i]
1411    r[i++] = c & self.DM
1412    c >>= self.DB
1413  }
1414  if (a.t < self.t) {
1415    c += a.s
1416    while (i < self.t) {
1417      c += self[i]
1418      r[i++] = c & self.DM
1419      c >>= self.DB
1420    }
1421    c += self.s
1422  } else {
1423    c += self.s
1424    while (i < a.t) {
1425      c += a[i]
1426      r[i++] = c & self.DM
1427      c >>= self.DB
1428    }
1429    c += a.s
1430  }
1431  r.s = (c < 0) ? -1 : 0
1432  if (c > 0) r[i++] = c
1433  else if (c < -1) r[i++] = self.DV + c
1434  r.t = i
1435  r.clamp()
1436}
1437
1438// (public) this + a
1439function bnAdd(a) {
1440  var r = new BigInteger()
1441  this.addTo(a, r)
1442  return r
1443}
1444
1445// (public) this - a
1446function bnSubtract(a) {
1447  var r = new BigInteger()
1448  this.subTo(a, r)
1449  return r
1450}
1451
1452// (public) this * a
1453function bnMultiply(a) {
1454  var r = new BigInteger()
1455  this.multiplyTo(a, r)
1456  return r
1457}
1458
1459// (public) this^2
1460function bnSquare() {
1461  var r = new BigInteger()
1462  this.squareTo(r)
1463  return r
1464}
1465
1466// (public) this / a
1467function bnDivide(a) {
1468  var r = new BigInteger()
1469  this.divRemTo(a, r, null)
1470  return r
1471}
1472
1473// (public) this % a
1474function bnRemainder(a) {
1475  var r = new BigInteger()
1476  this.divRemTo(a, null, r)
1477  return r
1478}
1479
1480// (public) [this/a,this%a]
1481function bnDivideAndRemainder(a) {
1482  var q = new BigInteger(),
1483    r = new BigInteger()
1484  this.divRemTo(a, q, r)
1485  return new Array(q, r)
1486}
1487
1488// (protected) this *= n, this >= 0, 1 < n < DV
1489function bnpDMultiply(n) {
1490  this[this.t] = this.am(0, n - 1, this, 0, 0, this.t)
1491  ++this.t
1492  this.clamp()
1493}
1494
1495// (protected) this += n << w words, this >= 0
1496function bnpDAddOffset(n, w) {
1497  if (n == 0) return
1498  while (this.t <= w) this[this.t++] = 0
1499  this[w] += n
1500  while (this[w] >= this.DV) {
1501    this[w] -= this.DV
1502    if (++w >= this.t) this[this.t++] = 0
1503    ++this[w]
1504  }
1505}
1506
1507// A "null" reducer
1508function NullExp() {}
1509
1510function nNop(x) {
1511  return x
1512}
1513
1514function nMulTo(x, y, r) {
1515  x.multiplyTo(y, r)
1516}
1517
1518function nSqrTo(x, r) {
1519  x.squareTo(r)
1520}
1521
1522NullExp.prototype.convert = nNop
1523NullExp.prototype.revert = nNop
1524NullExp.prototype.mulTo = nMulTo
1525NullExp.prototype.sqrTo = nSqrTo
1526
1527// (public) this^e
1528function bnPow(e) {
1529  return this.exp(e, new NullExp())
1530}
1531
1532// (protected) r = lower n words of "this * a", a.t <= n
1533// "this" should be the larger one if appropriate.
1534function bnpMultiplyLowerTo(a, n, r) {
1535  var i = Math.min(this.t + a.t, n)
1536  r.s = 0; // assumes a,this >= 0
1537  r.t = i
1538  while (i > 0) r[--i] = 0
1539  var j
1540  for (j = r.t - this.t; i < j; ++i) r[i + this.t] = this.am(0, a[i], r, i, 0, this.t)
1541  for (j = Math.min(a.t, n); i < j; ++i) this.am(0, a[i], r, i, 0, n - i)
1542  r.clamp()
1543}
1544
1545// (protected) r = "this * a" without lower n words, n > 0
1546// "this" should be the larger one if appropriate.
1547function bnpMultiplyUpperTo(a, n, r) {
1548  --n
1549  var i = r.t = this.t + a.t - n
1550  r.s = 0; // assumes a,this >= 0
1551  while (--i >= 0) r[i] = 0
1552  for (i = Math.max(n - this.t, 0); i < a.t; ++i)
1553    r[this.t + i - n] = this.am(n - i, a[i], r, 0, 0, this.t + i - n)
1554  r.clamp()
1555  r.drShiftTo(1, r)
1556}
1557
1558// Barrett modular reduction
1559function Barrett(m) {
1560  // setup Barrett
1561  this.r2 = new BigInteger()
1562  this.q3 = new BigInteger()
1563  BigInteger.ONE.dlShiftTo(2 * m.t, this.r2)
1564  this.mu = this.r2.divide(m)
1565  this.m = m
1566}
1567
1568function barrettConvert(x) {
1569  if (x.s < 0 || x.t > 2 * this.m.t) return x.mod(this.m)
1570  else if (x.compareTo(this.m) < 0) return x
1571  else {
1572    var r = new BigInteger()
1573    x.copyTo(r)
1574    this.reduce(r)
1575    return r
1576  }
1577}
1578
1579function barrettRevert(x) {
1580  return x
1581}
1582
1583// x = x mod m (HAC 14.42)
1584function barrettReduce(x) {
1585  var self = this
1586  x.drShiftTo(self.m.t - 1, self.r2)
1587  if (x.t > self.m.t + 1) {
1588    x.t = self.m.t + 1
1589    x.clamp()
1590  }
1591  self.mu.multiplyUpperTo(self.r2, self.m.t + 1, self.q3)
1592  self.m.multiplyLowerTo(self.q3, self.m.t + 1, self.r2)
1593  while (x.compareTo(self.r2) < 0) x.dAddOffset(1, self.m.t + 1)
1594  x.subTo(self.r2, x)
1595  while (x.compareTo(self.m) >= 0) x.subTo(self.m, x)
1596}
1597
1598// r = x^2 mod m; x != r
1599function barrettSqrTo(x, r) {
1600  x.squareTo(r)
1601  this.reduce(r)
1602}
1603
1604// r = x*y mod m; x,y != r
1605function barrettMulTo(x, y, r) {
1606  x.multiplyTo(y, r)
1607  this.reduce(r)
1608}
1609
1610Barrett.prototype.convert = barrettConvert
1611Barrett.prototype.revert = barrettRevert
1612Barrett.prototype.reduce = barrettReduce
1613Barrett.prototype.mulTo = barrettMulTo
1614Barrett.prototype.sqrTo = barrettSqrTo
1615
1616// (public) this^e % m (HAC 14.85)
1617function bnModPow(e, m) {
1618  var i = e.bitLength(),
1619    k, r = nbv(1),
1620    z
1621  if (i <= 0) return r
1622  else if (i < 18) k = 1
1623  else if (i < 48) k = 3
1624  else if (i < 144) k = 4
1625  else if (i < 768) k = 5
1626  else k = 6
1627  if (i < 8)
1628    z = new Classic(m)
1629  else if (m.isEven())
1630    z = new Barrett(m)
1631  else
1632    z = new Montgomery(m)
1633
1634  // precomputation
1635  var g = new Array(),
1636    n = 3,
1637    k1 = k - 1,
1638    km = (1 << k) - 1
1639  g[1] = z.convert(this)
1640  if (k > 1) {
1641    var g2 = new BigInteger()
1642    z.sqrTo(g[1], g2)
1643    while (n <= km) {
1644      g[n] = new BigInteger()
1645      z.mulTo(g2, g[n - 2], g[n])
1646      n += 2
1647    }
1648  }
1649
1650  var j = e.t - 1,
1651    w, is1 = true,
1652    r2 = new BigInteger(),
1653    t
1654  i = nbits(e[j]) - 1
1655  while (j >= 0) {
1656    if (i >= k1) w = (e[j] >> (i - k1)) & km
1657    else {
1658      w = (e[j] & ((1 << (i + 1)) - 1)) << (k1 - i)
1659      if (j > 0) w |= e[j - 1] >> (this.DB + i - k1)
1660    }
1661
1662    n = k
1663    while ((w & 1) == 0) {
1664      w >>= 1
1665      --n
1666    }
1667    if ((i -= n) < 0) {
1668      i += this.DB
1669      --j
1670    }
1671    if (is1) { // ret == 1, don't bother squaring or multiplying it
1672      g[w].copyTo(r)
1673      is1 = false
1674    } else {
1675      while (n > 1) {
1676        z.sqrTo(r, r2)
1677        z.sqrTo(r2, r)
1678        n -= 2
1679      }
1680      if (n > 0) z.sqrTo(r, r2)
1681      else {
1682        t = r
1683        r = r2
1684        r2 = t
1685      }
1686      z.mulTo(r2, g[w], r)
1687    }
1688
1689    while (j >= 0 && (e[j] & (1 << i)) == 0) {
1690      z.sqrTo(r, r2)
1691      t = r
1692      r = r2
1693      r2 = t
1694      if (--i < 0) {
1695        i = this.DB - 1
1696        --j
1697      }
1698    }
1699  }
1700  return z.revert(r)
1701}
1702
1703// (public) gcd(this,a) (HAC 14.54)
1704function bnGCD(a) {
1705  var x = (this.s < 0) ? this.negate() : this.clone()
1706  var y = (a.s < 0) ? a.negate() : a.clone()
1707  if (x.compareTo(y) < 0) {
1708    var t = x
1709    x = y
1710    y = t
1711  }
1712  var i = x.getLowestSetBit(),
1713    g = y.getLowestSetBit()
1714  if (g < 0) return x
1715  if (i < g) g = i
1716  if (g > 0) {
1717    x.rShiftTo(g, x)
1718    y.rShiftTo(g, y)
1719  }
1720  while (x.signum() > 0) {
1721    if ((i = x.getLowestSetBit()) > 0) x.rShiftTo(i, x)
1722    if ((i = y.getLowestSetBit()) > 0) y.rShiftTo(i, y)
1723    if (x.compareTo(y) >= 0) {
1724      x.subTo(y, x)
1725      x.rShiftTo(1, x)
1726    } else {
1727      y.subTo(x, y)
1728      y.rShiftTo(1, y)
1729    }
1730  }
1731  if (g > 0) y.lShiftTo(g, y)
1732  return y
1733}
1734
1735// (protected) this % n, n < 2^26
1736function bnpModInt(n) {
1737  if (n <= 0) return 0
1738  var d = this.DV % n,
1739    r = (this.s < 0) ? n - 1 : 0
1740  if (this.t > 0)
1741    if (d == 0) r = this[0] % n
1742    else
1743      for (var i = this.t - 1; i >= 0; --i) r = (d * r + this[i]) % n
1744  return r
1745}
1746
1747// (public) 1/this % m (HAC 14.61)
1748function bnModInverse(m) {
1749  var ac = m.isEven()
1750  if ((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO
1751  var u = m.clone(),
1752    v = this.clone()
1753  var a = nbv(1),
1754    b = nbv(0),
1755    c = nbv(0),
1756    d = nbv(1)
1757  while (u.signum() != 0) {
1758    while (u.isEven()) {
1759      u.rShiftTo(1, u)
1760      if (ac) {
1761        if (!a.isEven() || !b.isEven()) {
1762          a.addTo(this, a)
1763          b.subTo(m, b)
1764        }
1765        a.rShiftTo(1, a)
1766      } else if (!b.isEven()) b.subTo(m, b)
1767      b.rShiftTo(1, b)
1768    }
1769    while (v.isEven()) {
1770      v.rShiftTo(1, v)
1771      if (ac) {
1772        if (!c.isEven() || !d.isEven()) {
1773          c.addTo(this, c)
1774          d.subTo(m, d)
1775        }
1776        c.rShiftTo(1, c)
1777      } else if (!d.isEven()) d.subTo(m, d)
1778      d.rShiftTo(1, d)
1779    }
1780    if (u.compareTo(v) >= 0) {
1781      u.subTo(v, u)
1782      if (ac) a.subTo(c, a)
1783      b.subTo(d, b)
1784    } else {
1785      v.subTo(u, v)
1786      if (ac) c.subTo(a, c)
1787      d.subTo(b, d)
1788    }
1789  }
1790  if (v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO
1791  if (d.compareTo(m) >= 0) return d.subtract(m)
1792  if (d.signum() < 0) d.addTo(m, d)
1793  else return d
1794  if (d.signum() < 0) return d.add(m)
1795  else return d
1796}
1797
1798var lowprimes = [
1799  2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71,
1800  73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151,
1801  157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233,
1802  239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317,
1803  331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419,
1804  421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503,
1805  509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607,
1806  613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701,
1807  709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811,
1808  821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911,
1809  919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997
1810]
1811
1812var lplim = (1 << 26) / lowprimes[lowprimes.length - 1]
1813
1814// (public) test primality with certainty >= 1-.5^t
1815function bnIsProbablePrime(t) {
1816  var i, x = this.abs()
1817  if (x.t == 1 && x[0] <= lowprimes[lowprimes.length - 1]) {
1818    for (i = 0; i < lowprimes.length; ++i)
1819      if (x[0] == lowprimes[i]) return true
1820    return false
1821  }
1822  if (x.isEven()) return false
1823  i = 1
1824  while (i < lowprimes.length) {
1825    var m = lowprimes[i],
1826      j = i + 1
1827    while (j < lowprimes.length && m < lplim) m *= lowprimes[j++]
1828    m = x.modInt(m)
1829    while (i < j) if (m % lowprimes[i++] == 0) return false
1830  }
1831  return x.millerRabin(t)
1832}
1833
1834// (protected) true if probably prime (HAC 4.24, Miller-Rabin)
1835function bnpMillerRabin(t) {
1836  var n1 = this.subtract(BigInteger.ONE)
1837  var k = n1.getLowestSetBit()
1838  if (k <= 0) return false
1839  var r = n1.shiftRight(k)
1840  t = (t + 1) >> 1
1841  if (t > lowprimes.length) t = lowprimes.length
1842  var a = new BigInteger(null)
1843  var j, bases = []
1844  for (var i = 0; i < t; ++i) {
1845    for (;;) {
1846      j = lowprimes[Math.floor(Math.random() * lowprimes.length)]
1847      if (bases.indexOf(j) == -1) break
1848    }
1849    bases.push(j)
1850    a.fromInt(j)
1851    var y = a.modPow(r, this)
1852    if (y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) {
1853      var j = 1
1854      while (j++ < k && y.compareTo(n1) != 0) {
1855        y = y.modPowInt(2, this)
1856        if (y.compareTo(BigInteger.ONE) == 0) return false
1857      }
1858      if (y.compareTo(n1) != 0) return false
1859    }
1860  }
1861  return true
1862}
1863
1864// protected
1865proto.chunkSize = bnpChunkSize
1866proto.toRadix = bnpToRadix
1867proto.fromRadix = bnpFromRadix
1868proto.fromNumber = bnpFromNumber
1869proto.bitwiseTo = bnpBitwiseTo
1870proto.changeBit = bnpChangeBit
1871proto.addTo = bnpAddTo
1872proto.dMultiply = bnpDMultiply
1873proto.dAddOffset = bnpDAddOffset
1874proto.multiplyLowerTo = bnpMultiplyLowerTo
1875proto.multiplyUpperTo = bnpMultiplyUpperTo
1876proto.modInt = bnpModInt
1877proto.millerRabin = bnpMillerRabin
1878
1879// public
1880proto.clone = bnClone
1881proto.intValue = bnIntValue
1882proto.byteValue = bnByteValue
1883proto.shortValue = bnShortValue
1884proto.signum = bnSigNum
1885proto.toByteArray = bnToByteArray
1886proto.equals = bnEquals
1887proto.min = bnMin
1888proto.max = bnMax
1889proto.and = bnAnd
1890proto.or = bnOr
1891proto.xor = bnXor
1892proto.andNot = bnAndNot
1893proto.not = bnNot
1894proto.shiftLeft = bnShiftLeft
1895proto.shiftRight = bnShiftRight
1896proto.getLowestSetBit = bnGetLowestSetBit
1897proto.bitCount = bnBitCount
1898proto.testBit = bnTestBit
1899proto.setBit = bnSetBit
1900proto.clearBit = bnClearBit
1901proto.flipBit = bnFlipBit
1902proto.add = bnAdd
1903proto.subtract = bnSubtract
1904proto.multiply = bnMultiply
1905proto.divide = bnDivide
1906proto.remainder = bnRemainder
1907proto.divideAndRemainder = bnDivideAndRemainder
1908proto.modPow = bnModPow
1909proto.modInverse = bnModInverse
1910proto.pow = bnPow
1911proto.gcd = bnGCD
1912proto.isProbablePrime = bnIsProbablePrime
1913
1914// JSBN-specific extension
1915proto.square = bnSquare
1916
1917// constants
1918BigInteger.ZERO = nbv(0)
1919BigInteger.ONE = nbv(1)
1920BigInteger.valueOf = nbv
1921
1922module.exports = BigInteger
1923
1924},{"../package.json":4}],2:[function(require,module,exports){
1925(function (Buffer){
1926// FIXME: Kind of a weird way to throw exceptions, consider removing
1927var assert = require('assert')
1928var BigInteger = require('./bigi')
1929
1930/**
1931 * Turns a byte array into a big integer.
1932 *
1933 * This function will interpret a byte array as a big integer in big
1934 * endian notation.
1935 */
1936BigInteger.fromByteArrayUnsigned = function(byteArray) {
1937  // BigInteger expects a DER integer conformant byte array
1938  if (byteArray[0] & 0x80) {
1939    return new BigInteger([0].concat(byteArray))
1940  }
1941
1942  return new BigInteger(byteArray)
1943}
1944
1945/**
1946 * Returns a byte array representation of the big integer.
1947 *
1948 * This returns the absolute of the contained value in big endian
1949 * form. A value of zero results in an empty array.
1950 */
1951BigInteger.prototype.toByteArrayUnsigned = function() {
1952  var byteArray = this.toByteArray()
1953  return byteArray[0] === 0 ? byteArray.slice(1) : byteArray
1954}
1955
1956BigInteger.fromDERInteger = function(byteArray) {
1957  return new BigInteger(byteArray)
1958}
1959
1960/*
1961 * Converts BigInteger to a DER integer representation.
1962 *
1963 * The format for this value uses the most significant bit as a sign
1964 * bit.  If the most significant bit is already set and the integer is
1965 * positive, a 0x00 is prepended.
1966 *
1967 * Examples:
1968 *
1969 *      0 =>     0x00
1970 *      1 =>     0x01
1971 *     -1 =>     0xff
1972 *    127 =>     0x7f
1973 *   -127 =>     0x81
1974 *    128 =>   0x0080
1975 *   -128 =>     0x80
1976 *    255 =>   0x00ff
1977 *   -255 =>   0xff01
1978 *  16300 =>   0x3fac
1979 * -16300 =>   0xc054
1980 *  62300 => 0x00f35c
1981 * -62300 => 0xff0ca4
1982*/
1983BigInteger.prototype.toDERInteger = BigInteger.prototype.toByteArray
1984
1985BigInteger.fromBuffer = function(buffer) {
1986  // BigInteger expects a DER integer conformant byte array
1987  if (buffer[0] & 0x80) {
1988    var byteArray = Array.prototype.slice.call(buffer)
1989
1990    return new BigInteger([0].concat(byteArray))
1991  }
1992
1993  return new BigInteger(buffer)
1994}
1995
1996BigInteger.fromHex = function(hex) {
1997  if (hex === '') return BigInteger.ZERO
1998
1999  assert.equal(hex, hex.match(/^[A-Fa-f0-9]+/), 'Invalid hex string')
2000  assert.equal(hex.length % 2, 0, 'Incomplete hex')
2001  return new BigInteger(hex, 16)
2002}
2003
2004BigInteger.prototype.toBuffer = function(size) {
2005  var byteArray = this.toByteArrayUnsigned()
2006  var zeros = []
2007
2008  var padding = size - byteArray.length
2009  while (zeros.length < padding) zeros.push(0)
2010
2011  return new Buffer(zeros.concat(byteArray))
2012}
2013
2014BigInteger.prototype.toHex = function(size) {
2015  return this.toBuffer(size).toString('hex')
2016}
2017
2018}).call(this,require("buffer").Buffer)
2019},{"./bigi":1,"assert":5,"buffer":7}],3:[function(require,module,exports){
2020var BigInteger = require('./bigi')
2021
2022//addons
2023require('./convert')
2024
2025module.exports = BigInteger
2026},{"./bigi":1,"./convert":2}],4:[function(require,module,exports){
2027module.exports={
2028  "name": "bigi",
2029  "version": "1.4.0",
2030  "description": "Big integers.",
2031  "keywords": [
2032    "cryptography",
2033    "math",
2034    "bitcoin",
2035    "arbitrary",
2036    "precision",
2037    "arithmetic",
2038    "big",
2039    "integer",
2040    "int",
2041    "number",
2042    "biginteger",
2043    "bigint",
2044    "bignumber",
2045    "decimal",
2046    "float"
2047  ],
2048  "devDependencies": {
2049    "mocha": "^1.20.1",
2050    "jshint": "^2.5.1",
2051    "coveralls": "^2.10.0",
2052    "istanbul": "^0.2.11"
2053  },
2054  "repository": {
2055    "url": "https://github.com/cryptocoinjs/bigi",
2056    "type": "git"
2057  },
2058  "main": "./lib/index.js",
2059  "scripts": {
2060    "test": "_mocha -- test/*.js",
2061    "jshint": "jshint --config jshint.json lib/*.js ; true",
2062    "unit": "mocha",
2063    "coverage": "istanbul cover ./node_modules/.bin/_mocha -- --reporter list test/*.js",
2064    "coveralls": "npm run-script coverage && node ./node_modules/.bin/coveralls < coverage/lcov.info"
2065  },
2066  "dependencies": {},
2067  "testling": {
2068    "files": "test/*.js",
2069    "harness": "mocha",
2070    "browsers": [
2071      "ie/9..latest",
2072      "firefox/latest",
2073      "chrome/latest",
2074      "safari/6.0..latest",
2075      "iphone/6.0..latest",
2076      "android-browser/4.2..latest"
2077    ]
2078  },
2079  "bugs": {
2080    "url": "https://github.com/cryptocoinjs/bigi/issues"
2081  },
2082  "homepage": "https://github.com/cryptocoinjs/bigi",
2083  "_id": "[email protected]",
2084  "dist": {
2085    "shasum": "90ac1aeac0a531216463bdb58f42c1e05c8407ac",
2086    "tarball": "http://registry.npmjs.org/bigi/-/bigi-1.4.0.tgz"
2087  },
2088  "_from": "bigi@^1.4.0",
2089  "_npmVersion": "1.4.3",
2090  "_npmUser": {
2091    "name": "jp",
2092    "email": "[email protected]"
2093  },
2094  "maintainers": [
2095    {
2096      "name": "jp",
2097      "email": "[email protected]"
2098    },
2099    {
2100      "name": "midnightlightning",
2101      "email": "[email protected]"
2102    },
2103    {
2104      "name": "sidazhang",
2105      "email": "[email protected]"
2106    },
2107    {
2108      "name": "nadav",
2109      "email": "[email protected]"
2110    }
2111  ],
2112  "directories": {},
2113  "_shasum": "90ac1aeac0a531216463bdb58f42c1e05c8407ac",
2114  "_resolved": "https://registry.npmjs.org/bigi/-/bigi-1.4.0.tgz"
2115}
2116
2117},{}],5:[function(require,module,exports){
2118// http://wiki.commonjs.org/wiki/Unit_Testing/1.0
2119//
2120// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
2121//
2122// Originally from narwhal.js (http://narwhaljs.org)
2123// Copyright (c) 2009 Thomas Robinson <280north.com>
2124//
2125// Permission is hereby granted, free of charge, to any person obtaining a copy
2126// of this software and associated documentation files (the 'Software'), to
2127// deal in the Software without restriction, including without limitation the
2128// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
2129// sell copies of the Software, and to permit persons to whom the Software is
2130// furnished to do so, subject to the following conditions:
2131//
2132// The above copyright notice and this permission notice shall be included in
2133// all copies or substantial portions of the Software.
2134//
2135// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2136// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2137// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2138// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
2139// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
2140// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2141
2142// when used in node, this will actually load the util module we depend on
2143// versus loading the builtin util module as happens otherwise
2144// this is a bug in node module loading as far as I am concerned
2145var util = require('util/');
2146
2147var pSlice = Array.prototype.slice;
2148var hasOwn = Object.prototype.hasOwnProperty;
2149
2150// 1. The assert module provides functions that throw
2151// AssertionError's when particular conditions are not met. The
2152// assert module must conform to the following interface.
2153
2154var assert = module.exports = ok;
2155
2156// 2. The AssertionError is defined in assert.
2157// new assert.AssertionError({ message: message,
2158//                             actual: actual,
2159//                             expected: expected })
2160
2161assert.AssertionError = function AssertionError(options) {
2162  this.name = 'AssertionError';
2163  this.actual = options.actual;
2164  this.expected = options.expected;
2165  this.operator = options.operator;
2166  if (options.message) {
2167    this.message = options.message;
2168    this.generatedMessage = false;
2169  } else {
2170    this.message = getMessage(this);
2171    this.generatedMessage = true;
2172  }
2173  var stackStartFunction = options.stackStartFunction || fail;
2174
2175  if (Error.captureStackTrace) {
2176    Error.captureStackTrace(this, stackStartFunction);
2177  }
2178  else {
2179    // non v8 browsers so we can have a stacktrace
2180    var err = new Error();
2181    if (err.stack) {
2182      var out = err.stack;
2183
2184      // try to strip useless frames
2185      var fn_name = stackStartFunction.name;
2186      var idx = out.indexOf('\n' + fn_name);
2187      if (idx >= 0) {
2188        // once we have located the function frame
2189        // we need to strip out everything before it (and its line)
2190        var next_line = out.indexOf('\n', idx + 1);
2191        out = out.substring(next_line + 1);
2192      }
2193
2194      this.stack = out;
2195    }
2196  }
2197};
2198
2199// assert.AssertionError instanceof Error
2200util.inherits(assert.AssertionError, Error);
2201
2202function replacer(key, value) {
2203  if (util.isUndefined(value)) {
2204    return '' + value;
2205  }
2206  if (util.isNumber(value) && !isFinite(value)) {
2207    return value.toString();
2208  }
2209  if (util.isFunction(value) || util.isRegExp(value)) {
2210    return value.toString();
2211  }
2212  return value;
2213}
2214
2215function truncate(s, n) {
2216  if (util.isString(s)) {
2217    return s.length < n ? s : s.slice(0, n);
2218  } else {
2219    return s;
2220  }
2221}
2222
2223function getMessage(self) {
2224  return truncate(JSON.stringify(self.actual, replacer), 128) + ' ' +
2225         self.operator + ' ' +
2226         truncate(JSON.stringify(self.expected, replacer), 128);
2227}
2228
2229// At present only the three keys mentioned above are used and
2230// understood by the spec. Implementations or sub modules can pass
2231// other keys to the AssertionError's constructor - they will be
2232// ignored.
2233
2234// 3. All of the following functions must throw an AssertionError
2235// when a corresponding condition is not met, with a message that
2236// may be undefined if not provided.  All assertion methods provide
2237// both the actual and expected values to the assertion error for
2238// display purposes.
2239
2240function fail(actual, expected, message, operator, stackStartFunction) {
2241  throw new assert.AssertionError({
2242    message: message,
2243    actual: actual,
2244    expected: expected,
2245    operator: operator,
2246    stackStartFunction: stackStartFunction
2247  });
2248}
2249
2250// EXTENSION! allows for well behaved errors defined elsewhere.
2251assert.fail = fail;
2252
2253// 4. Pure assertion tests whether a value is truthy, as determined
2254// by !!guard.
2255// assert.ok(guard, message_opt);
2256// This statement is equivalent to assert.equal(true, !!guard,
2257// message_opt);. To test strictly for the value true, use
2258// assert.strictEqual(true, guard, message_opt);.
2259
2260function ok(value, message) {
2261  if (!value) fail(value, true, message, '==', assert.ok);
2262}
2263assert.ok = ok;
2264
2265// 5. The equality assertion tests shallow, coercive equality with
2266// ==.
2267// assert.equal(actual, expected, message_opt);
2268
2269assert.equal = function equal(actual, expected, message) {
2270  if (actual != expected) fail(actual, expected, message, '==', assert.equal);
2271};
2272
2273// 6. The non-equality assertion tests for whether two objects are not equal
2274// with != assert.notEqual(actual, expected, message_opt);
2275
2276assert.notEqual = function notEqual(actual, expected, message) {
2277  if (actual == expected) {
2278    fail(actual, expected, message, '!=', assert.notEqual);
2279  }
2280};
2281
2282// 7. The equivalence assertion tests a deep equality relation.
2283// assert.deepEqual(actual, expected, message_opt);
2284
2285assert.deepEqual = function deepEqual(actual, expected, message) {
2286  if (!_deepEqual(actual, expected)) {
2287    fail(actual, expected, message, 'deepEqual', assert.deepEqual);
2288  }
2289};
2290
2291function _deepEqual(actual, expected) {
2292  // 7.1. All identical values are equivalent, as determined by ===.
2293  if (actual === expected) {
2294    return true;
2295
2296  } else if (util.isBuffer(actual) && util.isBuffer(expected)) {
2297    if (actual.length != expected.length) return false;
2298
2299    for (var i = 0; i < actual.length; i++) {
2300      if (actual[i] !== expected[i]) return false;
2301    }
2302
2303    return true;
2304
2305  // 7.2. If the expected value is a Date object, the actual value is
2306  // equivalent if it is also a Date object that refers to the same time.
2307  } else if (util.isDate(actual) && util.isDate(expected)) {
2308    return actual.getTime() === expected.getTime();
2309
2310  // 7.3 If the expected value is a RegExp object, the actual value is
2311  // equivalent if it is also a RegExp object with the same source and
2312  // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).
2313  } else if (util.isRegExp(actual) && util.isRegExp(expected)) {
2314    return actual.source === expected.source &&
2315           actual.global === expected.global &&
2316           actual.multiline === expected.multiline &&
2317           actual.lastIndex === expected.lastIndex &&
2318           actual.ignoreCase === expected.ignoreCase;
2319
2320  // 7.4. Other pairs that do not both pass typeof value == 'object',
2321  // equivalence is determined by ==.
2322  } else if (!util.isObject(actual) && !util.isObject(expected)) {
2323    return actual == expected;
2324
2325  // 7.5 For all other Object pairs, including Array objects, equivalence is
2326  // determined by having the same number of owned properties (as verified
2327  // with Object.prototype.hasOwnProperty.call), the same set of keys
2328  // (although not necessarily the same order), equivalent values for every
2329  // corresponding key, and an identical 'prototype' property. Note: this
2330  // accounts for both named and indexed properties on Arrays.
2331  } else {
2332    return objEquiv(actual, expected);
2333  }
2334}
2335
2336function isArguments(object) {
2337  return Object.prototype.toString.call(object) == '[object Arguments]';
2338}
2339
2340function objEquiv(a, b) {
2341  if (util.isNullOrUndefined(a) || util.isNullOrUndefined(b))
2342    return false;
2343  // an identical 'prototype' property.
2344  if (a.prototype !== b.prototype) return false;
2345  // if one is a primitive, the other must be same
2346  if (util.isPrimitive(a) || util.isPrimitive(b)) {
2347    return a === b;
2348  }
2349  var aIsArgs = isArguments(a),
2350      bIsArgs = isArguments(b);
2351  if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))
2352    return false;
2353  if (aIsArgs) {
2354    a = pSlice.call(a);
2355    b = pSlice.call(b);
2356    return _deepEqual(a, b);
2357  }
2358  var ka = objectKeys(a),
2359      kb = objectKeys(b),
2360      key, i;
2361  // having the same number of owned properties (keys incorporates
2362  // hasOwnProperty)
2363  if (ka.length != kb.length)
2364    return false;
2365  //the same set of keys (although not necessarily the same order),
2366  ka.sort();
2367  kb.sort();
2368  //~~~cheap key test
2369  for (i = ka.length - 1; i >= 0; i--) {
2370    if (ka[i] != kb[i])
2371      return false;
2372  }
2373  //equivalent values for every corresponding key, and
2374  //~~~possibly expensive deep test
2375  for (i = ka.length - 1; i >= 0; i--) {
2376    key = ka[i];
2377    if (!_deepEqual(a[key], b[key])) return false;
2378  }
2379  return true;
2380}
2381
2382// 8. The non-equivalence assertion tests for any deep inequality.
2383// assert.notDeepEqual(actual, expected, message_opt);
2384
2385assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
2386  if (_deepEqual(actual, expected)) {
2387    fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual);
2388  }
2389};
2390
2391// 9. The strict equality assertion tests strict equality, as determined by ===.
2392// assert.strictEqual(actual, expected, message_opt);
2393
2394assert.strictEqual = function strictEqual(actual, expected, message) {
2395  if (actual !== expected) {
2396    fail(actual, expected, message, '===', assert.strictEqual);
2397  }
2398};
2399
2400// 10. The strict non-equality assertion tests for strict inequality, as
2401// determined by !==.  assert.notStrictEqual(actual, expected, message_opt);
2402
2403assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
2404  if (actual === expected) {
2405    fail(actual, expected, message, '!==', assert.notStrictEqual);
2406  }
2407};
2408
2409function expectedException(actual, expected) {
2410  if (!actual || !expected) {
2411    return false;
2412  }
2413
2414  if (Object.prototype.toString.call(expected) == '[object RegExp]') {
2415    return expected.test(actual);
2416  } else if (actual instanceof expected) {
2417    return true;
2418  } else if (expected.call({}, actual) === true) {
2419    return true;
2420  }
2421
2422  return false;
2423}
2424
2425function _throws(shouldThrow, block, expected, message) {
2426  var actual;
2427
2428  if (util.isString(expected)) {
2429    message = expected;
2430    expected = null;
2431  }
2432
2433  try {
2434    block();
2435  } catch (e) {
2436    actual = e;
2437  }
2438
2439  message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +
2440            (message ? ' ' + message : '.');
2441
2442  if (shouldThrow && !actual) {
2443    fail(actual, expected, 'Missing expected exception' + message);
2444  }
2445
2446  if (!shouldThrow && expectedException(actual, expected)) {
2447    fail(actual, expected, 'Got unwanted exception' + message);
2448  }
2449
2450  if ((shouldThrow && actual && expected &&
2451      !expectedException(actual, expected)) || (!shouldThrow && actual)) {
2452    throw actual;
2453  }
2454}
2455
2456// 11. Expected to throw an error:
2457// assert.throws(block, Error_opt, message_opt);
2458
2459assert.throws = function(block, /*optional*/error, /*optional*/message) {
2460  _throws.apply(this, [true].concat(pSlice.call(arguments)));
2461};
2462
2463// EXTENSION! This is annoying to write outside this module.
2464assert.doesNotThrow = function(block, /*optional*/message) {
2465  _throws.apply(this, [false].concat(pSlice.call(arguments)));
2466};
2467
2468assert.ifError = function(err) { if (err) {throw err;}};
2469
2470var objectKeys = Object.keys || function (obj) {
2471  var keys = [];
2472  for (var key in obj) {
2473    if (hasOwn.call(obj, key)) keys.push(key);
2474  }
2475  return keys;
2476};
2477
2478},{"util/":29}],6:[function(require,module,exports){
2479
2480},{}],7:[function(require,module,exports){
2481/*!
2482 * The buffer module from node.js, for the browser.
2483 *
2484 * @author   Feross Aboukhadijeh <[email protected]> <http://feross.org>
2485 * @license  MIT
2486 */
2487
2488var base64 = require('base64-js')
2489var ieee754 = require('ieee754')
2490var isArray = require('is-array')
2491
2492exports.Buffer = Buffer
2493exports.SlowBuffer = SlowBuffer
2494exports.INSPECT_MAX_BYTES = 50
2495Buffer.poolSize = 8192 // not used by this implementation
2496
2497var rootParent = {}
2498
2499/**
2500 * If `Buffer.TYPED_ARRAY_SUPPORT`:
2501 *   === true    Use Uint8Array implementation (fastest)
2502 *   === false   Use Object implementation (most compatible, even IE6)
2503 *
2504 * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
2505 * Opera 11.6+, iOS 4.2+.
2506 *
2507 * Due to various browser bugs, sometimes the Object implementation will be used even
2508 * when the browser supports typed arrays.
2509 *
2510 * Note:
2511 *
2512 *   - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
2513 *     See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
2514 *
2515 *   - Safari 5-7 lacks support for changing the `Object.prototype.constructor` property
2516 *     on objects.
2517 *
2518 *   - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
2519 *
2520 *   - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
2521 *     incorrect length in some situations.
2522
2523 * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
2524 * get the Object implementation, which is slower but behaves correctly.
2525 */
2526Buffer.TYPED_ARRAY_SUPPORT = (function () {
2527  function Bar () {}
2528  try {
2529    var arr = new Uint8Array(1)
2530    arr.foo = function () { return 42 }
2531    arr.constructor = Bar
2532    return arr.foo() === 42 && // typed array instances can be augmented
2533        arr.constructor === Bar && // constructor can be set
2534        typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
2535        arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
2536  } catch (e) {
2537    return false
2538  }
2539})()
2540
2541function kMaxLength () {
2542  return Buffer.TYPED_ARRAY_SUPPORT
2543    ? 0x7fffffff
2544    : 0x3fffffff
2545}
2546
2547/**
2548 * Class: Buffer
2549 * =============
2550 *
2551 * The Buffer constructor returns instances of `Uint8Array` that are augmented
2552 * with function properties for all the node `Buffer` API functions. We use
2553 * `Uint8Array` so that square bracket notation works as expected -- it returns
2554 * a single octet.
2555 *
2556 * By augmenting the instances, we can avoid modifying the `Uint8Array`
2557 * prototype.
2558 */
2559function Buffer (arg) {
2560  if (!(this instanceof Buffer)) {
2561    // Avoid going through an ArgumentsAdaptorTrampoline in the common case.
2562    if (arguments.length > 1) return new Buffer(arg, arguments[1])
2563    return new Buffer(arg)
2564  }
2565
2566  this.length = 0
2567  this.parent = undefined
2568
2569  // Common case.
2570  if (typeof arg === 'number') {
2571    return fromNumber(this, arg)
2572  }
2573
2574  // Slightly less common case.
2575  if (typeof arg === 'string') {
2576    return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')
2577  }
2578
2579  // Unusual.
2580  return fromObject(this, arg)
2581}
2582
2583function fromNumber (that, length) {
2584  that = allocate(that, length < 0 ? 0 : checked(length) | 0)
2585  if (!Buffer.TYPED_ARRAY_SUPPORT) {
2586    for (var i = 0; i < length; i++) {
2587      that[i] = 0
2588    }
2589  }
2590  return that
2591}
2592
2593function fromString (that, string, encoding) {
2594  if (typeof encoding !== 'string' || encoding === '') encoding = 'utf8'
2595
2596  // Assumption: byteLength() return value is always < kMaxLength.
2597  var length = byteLength(string, encoding) | 0
2598  that = allocate(that, length)
2599
2600  that.write(string, encoding)
2601  return that
2602}
2603
2604function fromObject (that, object) {
2605  if (Buffer.isBuffer(object)) return fromBuffer(that, object)
2606
2607  if (isArray(object)) return fromArray(that, object)
2608
2609  if (object == null) {
2610    throw new TypeError('must start with number, buffer, array or string')
2611  }
2612
2613  if (typeof ArrayBuffer !== 'undefined') {
2614    if (object.buffer instanceof ArrayBuffer) {
2615      return fromTypedArray(that, object)
2616    }
2617    if (object instanceof ArrayBuffer) {
2618      return fromArrayBuffer(that, object)
2619    }
2620  }
2621
2622  if (object.length) return fromArrayLike(that, object)
2623
2624  return fromJsonObject(that, object)
2625}
2626
2627function fromBuffer (that, buffer) {
2628  var length = checked(buffer.length) | 0
2629  that = allocate(that, length)
2630  buffer.copy(that, 0, 0, length)
2631  return that
2632}
2633
2634function fromArray (that, array) {
2635  var length = checked(array.length) | 0
2636  that = allocate(that, length)
2637  for (var i = 0; i < length; i += 1) {
2638    that[i] = array[i] & 255
2639  }
2640  return that
2641}
2642
2643// Duplicate of fromArray() to keep fromArray() monomorphic.
2644function fromTypedArray (that, array) {
2645  var length = checked(array.length) | 0
2646  that = allocate(that, length)
2647  // Truncating the elements is probably not what people expect from typed
2648  // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior
2649  // of the old Buffer constructor.
2650  for (var i = 0; i < length; i += 1) {
2651    that[i] = array[i] & 255
2652  }
2653  return that
2654}
2655
2656function fromArrayBuffer (that, array) {
2657  if (Buffer.TYPED_ARRAY_SUPPORT) {
2658    // Return an augmented `Uint8Array` instance, for best performance
2659    array.byteLength
2660    that = Buffer._augment(new Uint8Array(array))
2661  } else {
2662    // Fallback: Return an object instance of the Buffer class
2663    that = fromTypedArray(that, new Uint8Array(array))
2664  }
2665  return that
2666}
2667
2668function fromArrayLike (that, array) {
2669  var length = checked(array.length) | 0
2670  that = allocate(that, length)
2671  for (var i = 0; i < length; i += 1) {
2672    that[i] = array[i] & 255
2673  }
2674  return that
2675}
2676
2677// Deserialize { type: 'Buffer', data: [1,2,3,...] } into a Buffer object.
2678// Returns a zero-length buffer for inputs that don't conform to the spec.
2679function fromJsonObject (that, object) {
2680  var array
2681  var length = 0
2682
2683  if (object.type === 'Buffer' && isArray(object.data)) {
2684    array = object.data
2685    length = checked(array.length) | 0
2686  }
2687  that = allocate(that, length)
2688
2689  for (var i = 0; i < length; i += 1) {
2690    that[i] = array[i] & 255
2691  }
2692  return that
2693}
2694
2695function allocate (that, length) {
2696  if (Buffer.TYPED_ARRAY_SUPPORT) {
2697    // Return an augmented `Uint8Array` instance, for best performance
2698    that = Buffer._augment(new Uint8Array(length))
2699  } else {
2700    // Fallback: Return an object instance of the Buffer class
2701    that.length = length
2702    that._isBuffer = true
2703  }
2704
2705  var fromPool = length !== 0 && length <= Buffer.poolSize >>> 1
2706  if (fromPool) that.parent = rootParent
2707
2708  return that
2709}
2710
2711function checked (length) {
2712  // Note: cannot use `length < kMaxLength` here because that fails when
2713  // length is NaN (which is otherwise coerced to zero.)
2714  if (length >= kMaxLength()) {
2715    throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
2716                         'size: 0x' + kMaxLength().toString(16) + ' bytes')
2717  }
2718  return length | 0
2719}
2720
2721function SlowBuffer (subject, encoding) {
2722  if (!(this instanceof SlowBuffer)) return new SlowBuffer(subject, encoding)
2723
2724  var buf = new Buffer(subject, encoding)
2725  delete buf.parent
2726  return buf
2727}
2728
2729Buffer.isBuffer = function isBuffer (b) {
2730  return !!(b != null && b._isBuffer)
2731}
2732
2733Buffer.compare = function compare (a, b) {
2734  if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
2735    throw new TypeError('Arguments must be Buffers')
2736  }
2737
2738  if (a === b) return 0
2739
2740  var x = a.length
2741  var y = b.length
2742
2743  var i = 0
2744  var len = Math.min(x, y)
2745  while (i < len) {
2746    if (a[i] !== b[i]) break
2747
2748    ++i
2749  }
2750
2751  if (i !== len) {
2752    x = a[i]
2753    y = b[i]
2754  }
2755
2756  if (x < y) return -1
2757  if (y < x) return 1
2758  return 0
2759}
2760
2761Buffer.isEncoding = function isEncoding (encoding) {
2762  switch (String(encoding).toLowerCase()) {
2763    case 'hex':
2764    case 'utf8':
2765    case 'utf-8':
2766    case 'ascii':
2767    case 'binary':
2768    case 'base64':
2769    case 'raw':
2770    case 'ucs2':
2771    case 'ucs-2':
2772    case 'utf16le':
2773    case 'utf-16le':
2774      return true
2775    default:
2776      return false
2777  }
2778}
2779
2780Buffer.concat = function concat (list, length) {
2781  if (!isArray(list)) throw new TypeError('list argument must be an Array of Buffers.')
2782
2783  if (list.length === 0) {
2784    return new Buffer(0)
2785  }
2786
2787  var i
2788  if (length === undefined) {
2789    length = 0
2790    for (i = 0; i < list.length; i++) {
2791      length += list[i].length
2792    }
2793  }
2794
2795  var buf = new Buffer(length)
2796  var pos = 0
2797  for (i = 0; i < list.length; i++) {
2798    var item = list[i]
2799    item.copy(buf, pos)
2800    pos += item.length
2801  }
2802  return buf
2803}
2804
2805function byteLength (string, encoding) {
2806  if (typeof string !== 'string') string = '' + string
2807
2808  var len = string.length
2809  if (len === 0) return 0
2810
2811  // Use a for loop to avoid recursion
2812  var loweredCase = false
2813  for (;;) {
2814    switch (encoding) {
2815      case 'ascii':
2816      case 'binary':
2817      // Deprecated
2818      case 'raw':
2819      case 'raws':
2820        return len
2821      case 'utf8':
2822      case 'utf-8':
2823        return utf8ToBytes(string).length
2824      case 'ucs2':
2825      case 'ucs-2':
2826      case 'utf16le':
2827      case 'utf-16le':
2828        return len * 2
2829      case 'hex':
2830        return len >>> 1
2831      case 'base64':
2832        return base64ToBytes(string).length
2833      default:
2834        if (loweredCase) return utf8ToBytes(string).length // assume utf8
2835        encoding = ('' + encoding).toLowerCase()
2836        loweredCase = true
2837    }
2838  }
2839}
2840Buffer.byteLength = byteLength
2841
2842// pre-set for values that may exist in the future
2843Buffer.prototype.length = undefined
2844Buffer.prototype.parent = undefined
2845
2846function slowToString (encoding, start, end) {
2847  var loweredCase = false
2848
2849  start = start | 0
2850  end = end === undefined || end === Infinity ? this.length : end | 0
2851
2852  if (!encoding) encoding = 'utf8'
2853  if (start < 0) start = 0
2854  if (end > this.length) end = this.length
2855  if (end <= start) return ''
2856
2857  while (true) {
2858    switch (encoding) {
2859      case 'hex':
2860        return hexSlice(this, start, end)
2861
2862      case 'utf8':
2863      case 'utf-8':
2864        return utf8Slice(this, start, end)
2865
2866      case 'ascii':
2867        return asciiSlice(this, start, end)
2868
2869      case 'binary':
2870        return binarySlice(this, start, end)
2871
2872      case 'base64':
2873        return base64Slice(this, start, end)
2874
2875      case 'ucs2':
2876      case 'ucs-2':
2877      case 'utf16le':
2878      case 'utf-16le':
2879        return utf16leSlice(this, start, end)
2880
2881      default:
2882        if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
2883        encoding = (encoding + '').toLowerCase()
2884        loweredCase = true
2885    }
2886  }
2887}
2888
2889Buffer.prototype.toString = function toString () {
2890  var length = this.length | 0
2891  if (length === 0) return ''
2892  if (arguments.length === 0) return utf8Slice(this, 0, length)
2893  return slowToString.apply(this, arguments)
2894}
2895
2896Buffer.prototype.equals = function equals (b) {
2897  if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
2898  if (this === b) return true
2899  return Buffer.compare(this, b) === 0
2900}
2901
2902Buffer.prototype.inspect = function inspect () {
2903  var str = ''
2904  var max = exports.INSPECT_MAX_BYTES
2905  if (this.length > 0) {
2906    str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
2907    if (this.length > max) str += ' ... '
2908  }
2909  return '<Buffer ' + str + '>'
2910}
2911
2912Buffer.prototype.compare = function compare (b) {
2913  if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
2914  if (this === b) return 0
2915  return Buffer.compare(this, b)
2916}
2917
2918Buffer.prototype.indexOf = function indexOf (val, byteOffset) {
2919  if (byteOffset > 0x7fffffff) byteOffset = 0x7fffffff
2920  else if (byteOffset < -0x80000000) byteOffset = -0x80000000
2921  byteOffset >>= 0
2922
2923  if (this.length === 0) return -1
2924  if (byteOffset >= this.length) return -1
2925
2926  // Negative offsets start from the end of the buffer
2927  if (byteOffset < 0) byteOffset = Math.max(this.length + byteOffset, 0)
2928
2929  if (typeof val === 'string') {
2930    if (val.length === 0) return -1 // special case: looking for empty string always fails
2931    return String.prototype.indexOf.call(this, val, byteOffset)
2932  }
2933  if (Buffer.isBuffer(val)) {
2934    return arrayIndexOf(this, val, byteOffset)
2935  }
2936  if (typeof val === 'number') {
2937    if (Buffer.TYPED_ARRAY_SUPPORT && Uint8Array.prototype.indexOf === 'function') {
2938      return Uint8Array.prototype.indexOf.call(this, val, byteOffset)
2939    }
2940    return arrayIndexOf(this, [ val ], byteOffset)
2941  }
2942
2943  function arrayIndexOf (arr, val, byteOffset) {
2944    var foundIndex = -1
2945    for (var i = 0; byteOffset + i < arr.length; i++) {
2946      if (arr[byteOffset + i] === val[foundIndex === -1 ? 0 : i - foundIndex]) {
2947        if (foundIndex === -1) foundIndex = i
2948        if (i - foundIndex + 1 === val.length) return byteOffset + foundIndex
2949      } else {
2950        foundIndex = -1
2951      }
2952    }
2953    return -1
2954  }
2955
2956  throw new TypeError('val must be string, number or Buffer')
2957}
2958
2959// `get` is deprecated
2960Buffer.prototype.get = function get (offset) {
2961  console.log('.get() is deprecated. Access using array indexes instead.')
2962  return this.readUInt8(offset)
2963}
2964
2965// `set` is deprecated
2966Buffer.prototype.set = function set (v, offset) {
2967  console.log('.set() is deprecated. Access using array indexes instead.')
2968  return this.writeUInt8(v, offset)
2969}
2970
2971function hexWrite (buf, string, offset, length) {
2972  offset = Number(offset) || 0
2973  var remaining = buf.length - offset
2974  if (!length) {
2975    length = remaining
2976  } else {
2977    length = Number(length)
2978    if (length > remaining) {
2979      length = remaining
2980    }
2981  }
2982
2983  // must be an even number of digits
2984  var strLen = string.length
2985  if (strLen % 2 !== 0) throw new Error('Invalid hex string')
2986
2987  if (length > strLen / 2) {
2988    length = strLen / 2
2989  }
2990  for (var i = 0; i < length; i++) {
2991    var parsed = parseInt(string.substr(i * 2, 2), 16)
2992    if (isNaN(parsed)) throw new Error('Invalid hex string')
2993    buf[offset + i] = parsed
2994  }
2995  return i
2996}
2997
2998function utf8Write (buf, string, offset, length) {
2999  return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
3000}
3001
3002function asciiWrite (buf, string, offset, length) {
3003  return blitBuffer(asciiToBytes(string), buf, offset, length)
3004}
3005
3006function binaryWrite (buf, string, offset, length) {
3007  return asciiWrite(buf, string, offset, length)
3008}
3009
3010function base64Write (buf, string, offset, length) {
3011  return blitBuffer(base64ToBytes(string), buf, offset, length)
3012}
3013
3014function ucs2Write (buf, string, offset, length) {
3015  return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
3016}
3017
3018Buffer.prototype.write = function write (string, offset, length, encoding) {
3019  // Buffer#write(string)
3020  if (offset === undefined) {
3021    encoding = 'utf8'
3022    length = this.length
3023    offset = 0
3024  // Buffer#write(string, encoding)
3025  } else if (length === undefined && typeof offset === 'string') {
3026    encoding = offset
3027    length = this.length
3028    offset = 0
3029  // Buffer#write(string, offset[, length][, encoding])
3030  } else if (isFinite(offset)) {
3031    offset = offset | 0
3032    if (isFinite(length)) {
3033      length = length | 0
3034      if (encoding === undefined) encoding = 'utf8'
3035    } else {
3036      encoding = length
3037      length = undefined
3038    }
3039  // legacy write(string, encoding, offset, length) - remove in v0.13
3040  } else {
3041    var swap = encoding
3042    encoding = offset
3043    offset = length | 0
3044    length = swap
3045  }
3046
3047  var remaining = this.length - offset
3048  if (length === undefined || length > remaining) length = remaining
3049
3050  if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
3051    throw new RangeError('attempt to write outside buffer bounds')
3052  }
3053
3054  if (!encoding) encoding = 'utf8'
3055
3056  var loweredCase = false
3057  for (;;) {
3058    switch (encoding) {
3059      case 'hex':
3060        return hexWrite(this, string, offset, length)
3061
3062      case 'utf8':
3063      case 'utf-8':
3064        return utf8Write(this, string, offset, length)
3065
3066      case 'ascii':
3067        return asciiWrite(this, string, offset, length)
3068
3069      case 'binary':
3070        return binaryWrite(this, string, offset, length)
3071
3072      case 'base64':
3073        // Warning: maxLength not taken into account in base64Write
3074        return base64Write(this, string, offset, length)
3075
3076      case 'ucs2':
3077      case 'ucs-2':
3078      case 'utf16le':
3079      case 'utf-16le':
3080        return ucs2Write(this, string, offset, length)
3081
3082      default:
3083        if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
3084        encoding = ('' + encoding).toLowerCase()
3085        loweredCase = true
3086    }
3087  }
3088}
3089
3090Buffer.prototype.toJSON = function toJSON () {
3091  return {
3092    type: 'Buffer',
3093    data: Array.prototype.slice.call(this._arr || this, 0)
3094  }
3095}
3096
3097function base64Slice (buf, start, end) {
3098  if (start === 0 && end === buf.length) {
3099    return base64.fromByteArray(buf)
3100  } else {
3101    return base64.fromByteArray(buf.slice(start, end))
3102  }
3103}
3104
3105function utf8Slice (buf, start, end) {
3106  end = Math.min(buf.length, end)
3107  var firstByte
3108  var secondByte
3109  var thirdByte
3110  var fourthByte
3111  var bytesPerSequence
3112  var tempCodePoint
3113  var codePoint
3114  var res = []
3115  var i = start
3116
3117  for (; i < end; i += bytesPerSequence) {
3118    firstByte = buf[i]
3119    codePoint = 0xFFFD
3120
3121    if (firstByte > 0xEF) {
3122      bytesPerSequence = 4
3123    } else if (firstByte > 0xDF) {
3124      bytesPerSequence = 3
3125    } else if (firstByte > 0xBF) {
3126      bytesPerSequence = 2
3127    } else {
3128      bytesPerSequence = 1
3129    }
3130
3131    if (i + bytesPerSequence <= end) {
3132      switch (bytesPerSequence) {
3133        case 1:
3134          if (firstByte < 0x80) {
3135            codePoint = firstByte
3136          }
3137          break
3138        case 2:
3139          secondByte = buf[i + 1]
3140          if ((secondByte & 0xC0) === 0x80) {
3141            tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
3142            if (tempCodePoint > 0x7F) {
3143              codePoint = tempCodePoint
3144            }
3145          }
3146          break
3147        case 3:
3148          secondByte = buf[i + 1]
3149          thirdByte = buf[i + 2]
3150          if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
3151            tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
3152            if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
3153              codePoint = tempCodePoint
3154            }
3155          }
3156          break
3157        case 4:
3158          secondByte = buf[i + 1]
3159          thirdByte = buf[i + 2]
3160          fourthByte = buf[i + 3]
3161          if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
3162            tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
3163            if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
3164              codePoint = tempCodePoint
3165            }
3166          }
3167      }
3168    }
3169
3170    if (codePoint === 0xFFFD) {
3171      // we generated an invalid codePoint so make sure to only advance by 1 byte
3172      bytesPerSequence = 1
3173    } else if (codePoint > 0xFFFF) {
3174      // encode to utf16 (surrogate pair dance)
3175      codePoint -= 0x10000
3176      res.push(codePoint >>> 10 & 0x3FF | 0xD800)
3177      codePoint = 0xDC00 | codePoint & 0x3FF
3178    }
3179
3180    res.push(codePoint)
3181  }
3182
3183  return String.fromCharCode.apply(String, res)
3184}
3185
3186function asciiSlice (buf, start, end) {
3187  var ret = ''
3188  end = Math.min(buf.length, end)
3189
3190  for (var i = start; i < end; i++) {
3191    ret += String.fromCharCode(buf[i] & 0x7F)
3192  }
3193  return ret
3194}
3195
3196function binarySlice (buf, start, end) {
3197  var ret = ''
3198  end = Math.min(buf.length, end)
3199
3200  for (var i = start; i < end; i++) {
3201    ret += String.fromCharCode(buf[i])
3202  }
3203  return ret
3204}
3205
3206function hexSlice (buf, start, end) {
3207  var len = buf.length
3208
3209  if (!start || start < 0) start = 0
3210  if (!end || end < 0 || end > len) end = len
3211
3212  var out = ''
3213  for (var i = start; i < end; i++) {
3214    out += toHex(buf[i])
3215  }
3216  return out
3217}
3218
3219function utf16leSlice (buf, start, end) {
3220  var bytes = buf.slice(start, end)
3221  var res = ''
3222  for (var i = 0; i < bytes.length; i += 2) {
3223    res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
3224  }
3225  return res
3226}
3227
3228Buffer.prototype.slice = function slice (start, end) {
3229  var len = this.length
3230  start = ~~start
3231  end = end === undefined ? len : ~~end
3232
3233  if (start < 0) {
3234    start += len
3235    if (start < 0) start = 0
3236  } else if (start > len) {
3237    start = len
3238  }
3239
3240  if (end < 0) {
3241    end += len
3242    if (end < 0) end = 0
3243  } else if (end > len) {
3244    end = len
3245  }
3246
3247  if (end < start) end = start
3248
3249  var newBuf
3250  if (Buffer.TYPED_ARRAY_SUPPORT) {
3251    newBuf = Buffer._augment(this.subarray(start, end))
3252  } else {
3253    var sliceLen = end - start
3254    newBuf = new Buffer(sliceLen, undefined)
3255    for (var i = 0; i < sliceLen; i++) {
3256      newBuf[i] = this[i + start]
3257    }
3258  }
3259
3260  if (newBuf.length) newBuf.parent = this.parent || this
3261
3262  return newBuf
3263}
3264
3265/*
3266 * Need to make sure that buffer isn't trying to write out of bounds.
3267 */
vendor: 9,683 bytes, lines 3268-3596
3268function checkOffset (offset, ext, length) {
3269  if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
3270  if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
3271}
3272
3273Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
3274  offset = offset | 0
3275  byteLength = byteLength | 0
3276  if (!noAssert) checkOffset(offset, byteLength, this.length)
3277
3278  var val = this[offset]
3279  var mul = 1
3280  var i = 0
3281  while (++i < byteLength && (mul *= 0x100)) {
3282    val += this[offset + i] * mul
3283  }
3284
3285  return val
3286}
3287
3288Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
3289  offset = offset | 0
3290  byteLength = byteLength | 0
3291  if (!noAssert) {
3292    checkOffset(offset, byteLength, this.length)
3293  }
3294
3295  var val = this[offset + --byteLength]
3296  var mul = 1
3297  while (byteLength > 0 && (mul *= 0x100)) {
3298    val += this[offset + --byteLength] * mul
3299  }
3300
3301  return val
3302}
3303
3304Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
3305  if (!noAssert) checkOffset(offset, 1, this.length)
3306  return this[offset]
3307}
3308
3309Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
3310  if (!noAssert) checkOffset(offset, 2, this.length)
3311  return this[offset] | (this[offset + 1] << 8)
3312}
3313
3314Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
3315  if (!noAssert) checkOffset(offset, 2, this.length)
3316  return (this[offset] << 8) | this[offset + 1]
3317}
3318
3319Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
3320  if (!noAssert) checkOffset(offset, 4, this.length)
3321
3322  return ((this[offset]) |
3323      (this[offset + 1] << 8) |
3324      (this[offset + 2] << 16)) +
3325      (this[offset + 3] * 0x1000000)
3326}
3327
3328Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
3329  if (!noAssert) checkOffset(offset, 4, this.length)
3330
3331  return (this[offset] * 0x1000000) +
3332    ((this[offset + 1] << 16) |
3333    (this[offset + 2] << 8) |
3334    this[offset + 3])
3335}
3336
3337Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
3338  offset = offset | 0
3339  byteLength = byteLength | 0
3340  if (!noAssert) checkOffset(offset, byteLength, this.length)
3341
3342  var val = this[offset]
3343  var mul = 1
3344  var i = 0
3345  while (++i < byteLength && (mul *= 0x100)) {
3346    val += this[offset + i] * mul
3347  }
3348  mul *= 0x80
3349
3350  if (val >= mul) val -= Math.pow(2, 8 * byteLength)
3351
3352  return val
3353}
3354
3355Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
3356  offset = offset | 0
3357  byteLength = byteLength | 0
3358  if (!noAssert) checkOffset(offset, byteLength, this.length)
3359
3360  var i = byteLength
3361  var mul = 1
3362  var val = this[offset + --i]
3363  while (i > 0 && (mul *= 0x100)) {
3364    val += this[offset + --i] * mul
3365  }
3366  mul *= 0x80
3367
3368  if (val >= mul) val -= Math.pow(2, 8 * byteLength)
3369
3370  return val
3371}
3372
3373Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
3374  if (!noAssert) checkOffset(offset, 1, this.length)
3375  if (!(this[offset] & 0x80)) return (this[offset])
3376  return ((0xff - this[offset] + 1) * -1)
3377}
3378
3379Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
3380  if (!noAssert) checkOffset(offset, 2, this.length)
3381  var val = this[offset] | (this[offset + 1] << 8)
3382  return (val & 0x8000) ? val | 0xFFFF0000 : val
3383}
3384
3385Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
3386  if (!noAssert) checkOffset(offset, 2, this.length)
3387  var val = this[offset + 1] | (this[offset] << 8)
3388  return (val & 0x8000) ? val | 0xFFFF0000 : val
3389}
3390
3391Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
3392  if (!noAssert) checkOffset(offset, 4, this.length)
3393
3394  return (this[offset]) |
3395    (this[offset + 1] << 8) |
3396    (this[offset + 2] << 16) |
3397    (this[offset + 3] << 24)
3398}
3399
3400Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
3401  if (!noAssert) checkOffset(offset, 4, this.length)
3402
3403  return (this[offset] << 24) |
3404    (this[offset + 1] << 16) |
3405    (this[offset + 2] << 8) |
3406    (this[offset + 3])
3407}
3408
3409Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
3410  if (!noAssert) checkOffset(offset, 4, this.length)
3411  return ieee754.read(this, offset, true, 23, 4)
3412}
3413
3414Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
3415  if (!noAssert) checkOffset(offset, 4, this.length)
3416  return ieee754.read(this, offset, false, 23, 4)
3417}
3418
3419Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
3420  if (!noAssert) checkOffset(offset, 8, this.length)
3421  return ieee754.read(this, offset, true, 52, 8)
3422}
3423
3424Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
3425  if (!noAssert) checkOffset(offset, 8, this.length)
3426  return ieee754.read(this, offset, false, 52, 8)
3427}
3428
3429function checkInt (buf, value, offset, ext, max, min) {
3430  if (!Buffer.isBuffer(buf)) throw new TypeError('buffer must be a Buffer instance')
3431  if (value > max || value < min) throw new RangeError('value is out of bounds')
3432  if (offset + ext > buf.length) throw new RangeError('index out of range')
3433}
3434
3435Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
3436  value = +value
3437  offset = offset | 0
3438  byteLength = byteLength | 0
3439  if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)
3440
3441  var mul = 1
3442  var i = 0
3443  this[offset] = value & 0xFF
3444  while (++i < byteLength && (mul *= 0x100)) {
3445    this[offset + i] = (value / mul) & 0xFF
3446  }
3447
3448  return offset + byteLength
3449}
3450
3451Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
3452  value = +value
3453  offset = offset | 0
3454  byteLength = byteLength | 0
3455  if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)
3456
3457  var i = byteLength - 1
3458  var mul = 1
3459  this[offset + i] = value & 0xFF
3460  while (--i >= 0 && (mul *= 0x100)) {
3461    this[offset + i] = (value / mul) & 0xFF
3462  }
3463
3464  return offset + byteLength
3465}
3466
3467Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
3468  value = +value
3469  offset = offset | 0
3470  if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
3471  if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
3472  this[offset] = value
3473  return offset + 1
3474}
3475
3476function objectWriteUInt16 (buf, value, offset, littleEndian) {
3477  if (value < 0) value = 0xffff + value + 1
3478  for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; i++) {
3479    buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
3480      (littleEndian ? i : 1 - i) * 8
3481  }
3482}
3483
3484Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
3485  value = +value
3486  offset = offset | 0
3487  if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
3488  if (Buffer.TYPED_ARRAY_SUPPORT) {
3489    this[offset] = value
3490    this[offset + 1] = (value >>> 8)
3491  } else {
3492    objectWriteUInt16(this, value, offset, true)
3493  }
3494  return offset + 2
3495}
3496
3497Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
3498  value = +value
3499  offset = offset | 0
3500  if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
3501  if (Buffer.TYPED_ARRAY_SUPPORT) {
3502    this[offset] = (value >>> 8)
3503    this[offset + 1] = value
3504  } else {
3505    objectWriteUInt16(this, value, offset, false)
3506  }
3507  return offset + 2
3508}
3509
3510function objectWriteUInt32 (buf, value, offset, littleEndian) {
3511  if (value < 0) value = 0xffffffff + value + 1
3512  for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; i++) {
3513    buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
3514  }
3515}
3516
3517Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
3518  value = +value
3519  offset = offset | 0
3520  if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
3521  if (Buffer.TYPED_ARRAY_SUPPORT) {
3522    this[offset + 3] = (value >>> 24)
3523    this[offset + 2] = (value >>> 16)
3524    this[offset + 1] = (value >>> 8)
3525    this[offset] = value
3526  } else {
3527    objectWriteUInt32(this, value, offset, true)
3528  }
3529  return offset + 4
3530}
3531
3532Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
3533  value = +value
3534  offset = offset | 0
3535  if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
3536  if (Buffer.TYPED_ARRAY_SUPPORT) {
3537    this[offset] = (value >>> 24)
3538    this[offset + 1] = (value >>> 16)
3539    this[offset + 2] = (value >>> 8)
3540    this[offset + 3] = value
3541  } else {
3542    objectWriteUInt32(this, value, offset, false)
3543  }
3544  return offset + 4
3545}
3546
3547Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
3548  value = +value
3549  offset = offset | 0
3550  if (!noAssert) {
3551    var limit = Math.pow(2, 8 * byteLength - 1)
3552
3553    checkInt(this, value, offset, byteLength, limit - 1, -limit)
3554  }
3555
3556  var i = 0
3557  var mul = 1
3558  var sub = value < 0 ? 1 : 0
3559  this[offset] = value & 0xFF
3560  while (++i < byteLength && (mul *= 0x100)) {
3561    this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
3562  }
3563
3564  return offset + byteLength
3565}
3566
3567Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
3568  value = +value
3569  offset = offset | 0
3570  if (!noAssert) {
3571    var limit = Math.pow(2, 8 * byteLength - 1)
3572
3573    checkInt(this, value, offset, byteLength, limit - 1, -limit)
3574  }
3575
3576  var i = byteLength - 1
3577  var mul = 1
3578  var sub = value < 0 ? 1 : 0
3579  this[offset + i] = value & 0xFF
3580  while (--i >= 0 && (mul *= 0x100)) {
3581    this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
3582  }
3583
3584  return offset + byteLength
3585}
3586
3587Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
3588  value = +value
3589  offset = offset | 0
3590  if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
3591  if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
3592  if (value < 0) value = 0xff + value + 1
3593  this[offset] = value
3594  return offset + 1
3595}
3596
vendor: 4,097 bytes, lines 3597-3720
3597Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
3598  value = +value
3599  offset = offset | 0
3600  if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
3601  if (Buffer.TYPED_ARRAY_SUPPORT) {
3602    this[offset] = value
3603    this[offset + 1] = (value >>> 8)
3604  } else {
3605    objectWriteUInt16(this, value, offset, true)
3606  }
3607  return offset + 2
3608}
3609
3610Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
3611  value = +value
3612  offset = offset | 0
3613  if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
3614  if (Buffer.TYPED_ARRAY_SUPPORT) {
3615    this[offset] = (value >>> 8)
3616    this[offset + 1] = value
3617  } else {
3618    objectWriteUInt16(this, value, offset, false)
3619  }
3620  return offset + 2
3621}
3622
3623Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
3624  value = +value
3625  offset = offset | 0
3626  if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
3627  if (Buffer.TYPED_ARRAY_SUPPORT) {
3628    this[offset] = value
3629    this[offset + 1] = (value >>> 8)
3630    this[offset + 2] = (value >>> 16)
3631    this[offset + 3] = (value >>> 24)
3632  } else {
3633    objectWriteUInt32(this, value, offset, true)
3634  }
3635  return offset + 4
3636}
3637
3638Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
3639  value = +value
3640  offset = offset | 0
3641  if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
3642  if (value < 0) value = 0xffffffff + value + 1
3643  if (Buffer.TYPED_ARRAY_SUPPORT) {
3644    this[offset] = (value >>> 24)
3645    this[offset + 1] = (value >>> 16)
3646    this[offset + 2] = (value >>> 8)
3647    this[offset + 3] = value
3648  } else {
3649    objectWriteUInt32(this, value, offset, false)
3650  }
3651  return offset + 4
3652}
3653
3654function checkIEEE754 (buf, value, offset, ext, max, min) {
3655  if (value > max || value < min) throw new RangeError('value is out of bounds')
3656  if (offset + ext > buf.length) throw new RangeError('index out of range')
3657  if (offset < 0) throw new RangeError('index out of range')
3658}
3659
3660function writeFloat (buf, value, offset, littleEndian, noAssert) {
3661  if (!noAssert) {
3662    checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
3663  }
3664  ieee754.write(buf, value, offset, littleEndian, 23, 4)
3665  return offset + 4
3666}
3667
3668Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
3669  return writeFloat(this, value, offset, true, noAssert)
3670}
3671
3672Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
3673  return writeFloat(this, value, offset, false, noAssert)
3674}
3675
3676function writeDouble (buf, value, offset, littleEndian, noAssert) {
3677  if (!noAssert) {
3678    checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
3679  }
3680  ieee754.write(buf, value, offset, littleEndian, 52, 8)
3681  return offset + 8
3682}
3683
3684Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
3685  return writeDouble(this, value, offset, true, noAssert)
3686}
3687
3688Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
3689  return writeDouble(this, value, offset, false, noAssert)
3690}
3691
3692// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
3693Buffer.prototype.copy = function copy (target, targetStart, start, end) {
3694  if (!start) start = 0
3695  if (!end && end !== 0) end = this.length
3696  if (targetStart >= target.length) targetStart = target.length
3697  if (!targetStart) targetStart = 0
3698  if (end > 0 && end < start) end = start
3699
3700  // Copy 0 bytes; we're done
3701  if (end === start) return 0
3702  if (target.length === 0 || this.length === 0) return 0
3703
3704  // Fatal error conditions
3705  if (targetStart < 0) {
3706    throw new RangeError('targetStart out of bounds')
3707  }
3708  if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
3709  if (end < 0) throw new RangeError('sourceEnd out of bounds')
3710
3711  // Are we oob?
3712  if (end > this.length) end = this.length
3713  if (target.length - targetStart < end - start) {
3714    end = target.length - targetStart + start
3715  }
3716
3717  var len = end - start
3718  var i
3719
3720  if (this === target && start < targetStart && targetStart < end) {
3721    // descending copy from end
3722    for (i = len - 1; i >= 0; i--) {
3723      target[i + targetStart] = this[i + start]
3724    }
3725  } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
3726    // ascending copy from start
3727    for (i = 0; i < len; i++) {
3728      target[i + targetStart] = this[i + start]
3729    }
3730  } else {
3731    target._set(this.subarray(start, start + len), targetStart)
3732  }
3733
3734  return len
3735}
3736
3737// fill(value, start=0, end=buffer.length)
3738Buffer.prototype.fill = function fill (value, start, end) {
3739  if (!value) value = 0
3740  if (!start) start = 0
3741  if (!end) end = this.length
3742
3743  if (end < start) throw new RangeError('end < start')
3744
3745  // Fill 0 bytes; we're done
3746  if (end === start) return
3747  if (this.length === 0) return
3748
3749  if (start < 0 || start >= this.length) throw new RangeError('start out of bounds')
3750  if (end < 0 || end > this.length) throw new RangeError('end out of bounds')
3751
3752  var i
3753  if (typeof value === 'number') {
3754    for (i = start; i < end; i++) {
3755      this[i] = value
3756    }
3757  } else {
3758    var bytes = utf8ToBytes(value.toString())
3759    var len = bytes.length
3760    for (i = start; i < end; i++) {
3761      this[i] = bytes[i % len]
3762    }
3763  }
3764
3765  return this
3766}
3767
3768/**
3769 * Creates a new `ArrayBuffer` with the *copied* memory of the buffer instance.
3770 * Added in Node 0.12. Only available in browsers that support ArrayBuffer.
3771 */
3772Buffer.prototype.toArrayBuffer = function toArrayBuffer () {
3773  if (typeof Uint8Array !== 'undefined') {
3774    if (Buffer.TYPED_ARRAY_SUPPORT) {
3775      return (new Buffer(this)).buffer
3776    } else {
3777      var buf = new Uint8Array(this.length)
3778      for (var i = 0, len = buf.length; i < len; i += 1) {
3779        buf[i] = this[i]
3780      }
3781      return buf.buffer
3782    }
3783  } else {
3784    throw new TypeError('Buffer.toArrayBuffer not supported in this browser')
3785  }
3786}
3787
3788// HELPER FUNCTIONS
3789// ================
3790
3791var BP = Buffer.prototype
3792
3793/**
3794 * Augment a Uint8Array *instance* (not the Uint8Array class!) with Buffer methods
3795 */
3796Buffer._augment = function _augment (arr) {
3797  arr.constructor = Buffer
3798  arr._isBuffer = true
3799
3800  // save reference to original Uint8Array set method before overwriting
3801  arr._set = arr.set
3802
3803  // deprecated
3804  arr.get = BP.get
3805  arr.set = BP.set
3806
3807  arr.write = BP.write
3808  arr.toString = BP.toString
3809  arr.toLocaleString = BP.toString
3810  arr.toJSON = BP.toJSON
3811  arr.equals = BP.equals
3812  arr.compare = BP.compare
3813  arr.indexOf = BP.indexOf
3814  arr.copy = BP.copy
3815  arr.slice = BP.slice
3816  arr.readUIntLE = BP.readUIntLE
3817  arr.readUIntBE = BP.readUIntBE
3818  arr.readUInt8 = BP.readUInt8
3819  arr.readUInt16LE = BP.readUInt16LE
3820  arr.readUInt16BE = BP.readUInt16BE
3821  arr.readUInt32LE = BP.readUInt32LE
3822  arr.readUInt32BE = BP.readUInt32BE
3823  arr.readIntLE = BP.readIntLE
3824  arr.readIntBE = BP.readIntBE
3825  arr.readInt8 = BP.readInt8
3826  arr.readInt16LE = BP.readInt16LE
3827  arr.readInt16BE = BP.readInt16BE
3828  arr.readInt32LE = BP.readInt32LE
3829  arr.readInt32BE = BP.readInt32BE
3830  arr.readFloatLE = BP.readFloatLE
3831  arr.readFloatBE = BP.readFloatBE
3832  arr.readDoubleLE = BP.readDoubleLE
3833  arr.readDoubleBE = BP.readDoubleBE
3834  arr.writeUInt8 = BP.writeUInt8
3835  arr.writeUIntLE = BP.writeUIntLE
3836  arr.writeUIntBE = BP.writeUIntBE
3837  arr.writeUInt16LE = BP.writeUInt16LE
3838  arr.writeUInt16BE = BP.writeUInt16BE
3839  arr.writeUInt32LE = BP.writeUInt32LE
3840  arr.writeUInt32BE = BP.writeUInt32BE
3841  arr.writeIntLE = BP.writeIntLE
3842  arr.writeIntBE = BP.writeIntBE
3843  arr.writeInt8 = BP.writeInt8
3844  arr.writeInt16LE = BP.writeInt16LE
3845  arr.writeInt16BE = BP.writeInt16BE
3846  arr.writeInt32LE = BP.writeInt32LE
3847  arr.writeInt32BE = BP.writeInt32BE
3848  arr.writeFloatLE = BP.writeFloatLE
3849  arr.writeFloatBE = BP.writeFloatBE
3850  arr.writeDoubleLE = BP.writeDoubleLE
3851  arr.writeDoubleBE = BP.writeDoubleBE
3852  arr.fill = BP.fill
3853  arr.inspect = BP.inspect
3854  arr.toArrayBuffer = BP.toArrayBuffer
3855
3856  return arr
3857}
3858
3859var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
3860
3861function base64clean (str) {
3862  // Node strips out invalid characters like \n and \t from the string, base64-js does not
3863  str = stringtrim(str).replace(INVALID_BASE64_RE, '')
3864  // Node converts strings with length < 2 to ''
3865  if (str.length < 2) return ''
3866  // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
3867  while (str.length % 4 !== 0) {
3868    str = str + '='
3869  }
3870  return str
3871}
3872
3873function stringtrim (str) {
3874  if (str.trim) return str.trim()
3875  return str.replace(/^\s+|\s+$/g, '')
3876}
3877
3878function toHex (n) {
3879  if (n < 16) return '0' + n.toString(16)
3880  return n.toString(16)
3881}
3882
3883function utf8ToBytes (string, units) {
3884  units = units || Infinity
3885  var codePoint
3886  var length = string.length
3887  var leadSurrogate = null
3888  var bytes = []
3889
3890  for (var i = 0; i < length; i++) {
3891    codePoint = string.charCodeAt(i)
3892
3893    // is surrogate component
3894    if (codePoint > 0xD7FF && codePoint < 0xE000) {
3895      // last char was a lead
3896      if (!leadSurrogate) {
3897        // no lead yet
3898        if (codePoint > 0xDBFF) {
3899          // unexpected trail
3900          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
3901          continue
3902
3903        } else if (i + 1 === length) {
3904          // unpaired lead
3905          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
3906          continue
3907        }
3908
3909        // valid lead
3910        leadSurrogate = codePoint
3911
3912        continue
3913      }
3914
3915      // 2 leads in a row
3916      if (codePoint < 0xDC00) {
3917        if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
3918        leadSurrogate = codePoint
3919        continue
3920      }
3921
3922      // valid surrogate pair
3923      codePoint = leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00 | 0x10000
3924
3925    } else if (leadSurrogate) {
3926      // valid bmp char, but last char was a lead
3927      if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
3928    }
3929
3930    leadSurrogate = null
3931
3932    // encode utf8
3933    if (codePoint < 0x80) {
3934      if ((units -= 1) < 0) break
3935      bytes.push(codePoint)
3936    } else if (codePoint < 0x800) {
3937      if ((units -= 2) < 0) break
3938      bytes.push(
3939        codePoint >> 0x6 | 0xC0,
vendor: 4,996 bytes, lines 3940-4126
3940        codePoint & 0x3F | 0x80
3941      )
3942    } else if (codePoint < 0x10000) {
3943      if ((units -= 3) < 0) break
3944      bytes.push(
3945        codePoint >> 0xC | 0xE0,
3946        codePoint >> 0x6 & 0x3F | 0x80,
3947        codePoint & 0x3F | 0x80
3948      )
3949    } else if (codePoint < 0x110000) {
3950      if ((units -= 4) < 0) break
3951      bytes.push(
3952        codePoint >> 0x12 | 0xF0,
3953        codePoint >> 0xC & 0x3F | 0x80,
3954        codePoint >> 0x6 & 0x3F | 0x80,
3955        codePoint & 0x3F | 0x80
3956      )
3957    } else {
3958      throw new Error('Invalid code point')
3959    }
3960  }
3961
3962  return bytes
3963}
3964
3965function asciiToBytes (str) {
3966  var byteArray = []
3967  for (var i = 0; i < str.length; i++) {
3968    // Node's code seems to be doing this and not & 0x7F..
3969    byteArray.push(str.charCodeAt(i) & 0xFF)
3970  }
3971  return byteArray
3972}
3973
3974function utf16leToBytes (str, units) {
3975  var c, hi, lo
3976  var byteArray = []
3977  for (var i = 0; i < str.length; i++) {
3978    if ((units -= 2) < 0) break
3979
3980    c = str.charCodeAt(i)
3981    hi = c >> 8
3982    lo = c % 256
3983    byteArray.push(lo)
3984    byteArray.push(hi)
3985  }
3986
3987  return byteArray
3988}
3989
3990function base64ToBytes (str) {
3991  return base64.toByteArray(base64clean(str))
3992}
3993
3994function blitBuffer (src, dst, offset, length) {
3995  for (var i = 0; i < length; i++) {
3996    if ((i + offset >= dst.length) || (i >= src.length)) break
3997    dst[i + offset] = src[i]
3998  }
3999  return i
4000}
4001
4002},{"base64-js":8,"ieee754":9,"is-array":10}],8:[function(require,module,exports){
4003var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
4004
4005;(function (exports) {
4006	'use strict';
4007
4008  var Arr = (typeof Uint8Array !== 'undefined')
4009    ? Uint8Array
4010    : Array
4011
4012	var PLUS   = '+'.charCodeAt(0)
4013	var SLASH  = '/'.charCodeAt(0)
4014	var NUMBER = '0'.charCodeAt(0)
4015	var LOWER  = 'a'.charCodeAt(0)
4016	var UPPER  = 'A'.charCodeAt(0)
4017	var PLUS_URL_SAFE = '-'.charCodeAt(0)
4018	var SLASH_URL_SAFE = '_'.charCodeAt(0)
4019
4020	function decode (elt) {
4021		var code = elt.charCodeAt(0)
4022		if (code === PLUS ||
4023		    code === PLUS_URL_SAFE)
4024			return 62 // '+'
4025		if (code === SLASH ||
4026		    code === SLASH_URL_SAFE)
4027			return 63 // '/'
4028		if (code < NUMBER)
4029			return -1 //no match
4030		if (code < NUMBER + 10)
4031			return code - NUMBER + 26 + 26
4032		if (code < UPPER + 26)
4033			return code - UPPER
4034		if (code < LOWER + 26)
4035			return code - LOWER + 26
4036	}
4037
4038	function b64ToByteArray (b64) {
4039		var i, j, l, tmp, placeHolders, arr
4040
4041		if (b64.length % 4 > 0) {
4042			throw new Error('Invalid string. Length must be a multiple of 4')
4043		}
4044
4045		// the number of equal signs (place holders)
4046		// if there are two placeholders, than the two characters before it
4047		// represent one byte
4048		// if there is only one, then the three characters before it represent 2 bytes
4049		// this is just a cheap hack to not do indexOf twice
4050		var len = b64.length
4051		placeHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0
4052
4053		// base64 is 4/3 + up to two characters of the original data
4054		arr = new Arr(b64.length * 3 / 4 - placeHolders)
4055
4056		// if there are placeholders, only get up to the last complete 4 chars
4057		l = placeHolders > 0 ? b64.length - 4 : b64.length
4058
4059		var L = 0
4060
4061		function push (v) {
4062			arr[L++] = v
4063		}
4064
4065		for (i = 0, j = 0; i < l; i += 4, j += 3) {
4066			tmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3))
4067			push((tmp & 0xFF0000) >> 16)
4068			push((tmp & 0xFF00) >> 8)
4069			push(tmp & 0xFF)
4070		}
4071
4072		if (placeHolders === 2) {
4073			tmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4)
4074			push(tmp & 0xFF)
4075		} else if (placeHolders === 1) {
4076			tmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2)
4077			push((tmp >> 8) & 0xFF)
4078			push(tmp & 0xFF)
4079		}
4080
4081		return arr
4082	}
4083
4084	function uint8ToBase64 (uint8) {
4085		var i,
4086			extraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes
4087			output = "",
4088			temp, length
4089
4090		function encode (num) {
4091			return lookup.charAt(num)
4092		}
4093
4094		function tripletToBase64 (num) {
4095			return encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F)
4096		}
4097
4098		// go through the array every three bytes, we'll deal with trailing stuff later
4099		for (i = 0, length = uint8.length - extraBytes; i < length; i += 3) {
4100			temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
4101			output += tripletToBase64(temp)
4102		}
4103
4104		// pad the end with zeros, but make sure to not forget the extra bytes
4105		switch (extraBytes) {
4106			case 1:
4107				temp = uint8[uint8.length - 1]
4108				output += encode(temp >> 2)
4109				output += encode((temp << 4) & 0x3F)
4110				output += '=='
4111				break
4112			case 2:
4113				temp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1])
4114				output += encode(temp >> 10)
4115				output += encode((temp >> 4) & 0x3F)
4116				output += encode((temp << 2) & 0x3F)
4117				output += '='
4118				break
4119		}
4120
4121		return output
4122	}
4123
4124	exports.toByteArray = b64ToByteArray
4125	exports.fromByteArray = uint8ToBase64
4126}(typeof exports === 'undefined' ? (this.base64js = {}
4126) : exports))
4127
4128},{}],9:[function(require,module,exports){
4129exports.read = function (buffer, offset, isLE, mLen, nBytes) {
4130  var e, m
4131  var eLen = nBytes * 8 - mLen - 1
4132  var eMax = (1 << eLen) - 1
4133  var eBias = eMax >> 1
4134  var nBits = -7
4135  var i = isLE ? (nBytes - 1) : 0
4136  var d = isLE ? -1 : 1
4137  var s = buffer[offset + i]
4138
4139  i += d
4140
4141  e = s & ((1 << (-nBits)) - 1)
4142  s >>= (-nBits)
4143  nBits += eLen
4144  for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
4145
4146  m = e & ((1 << (-nBits)) - 1)
4147  e >>= (-nBits)
4148  nBits += mLen
4149  for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
4150
4151  if (e === 0) {
4152    e = 1 - eBias
4153  } else if (e === eMax) {
4154    return m ? NaN : ((s ? -1 : 1) * Infinity)
4155  } else {
4156    m = m + Math.pow(2, mLen)
4157    e = e - eBias
4158  }
4159  return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
4160}
4161
4162exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
4163  var e, m, c
4164  var eLen = nBytes * 8 - mLen - 1
4165  var eMax = (1 << eLen) - 1
4166  var eBias = eMax >> 1
4167  var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
4168  var i = isLE ? 0 : (nBytes - 1)
4169  var d = isLE ? 1 : -1
4170  var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
4171
4172  value = Math.abs(value)
4173
4174  if (isNaN(value) || value === Infinity) {
4175    m = isNaN(value) ? 1 : 0
4176    e = eMax
4177  } else {
4178    e = Math.floor(Math.log(value) / Math.LN2)
4179    if (value * (c = Math.pow(2, -e)) < 1) {
4180      e--
4181      c *= 2
4182    }
4183    if (e + eBias >= 1) {
4184      value += rt / c
4185    } else {
4186      value += rt * Math.pow(2, 1 - eBias)
4187    }
4188    if (value * c >= 2) {
4189      e++
4190      c /= 2
4191    }
4192
4193    if (e + eBias >= eMax) {
4194      m = 0
4195      e = eMax
4196    } else if (e + eBias >= 1) {
4197      m = (value * c - 1) * Math.pow(2, mLen)
4198      e = e + eBias
4199    } else {
4200      m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
4201      e = 0
4202    }
4203  }
4204
4205  for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
4206
4207  e = (e << mLen) | m
4208  eLen += mLen
4209  for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
4210
4211  buffer[offset + i - d] |= s * 128
4212}
4213
4214},{}],10:[function(require,module,exports){
4215
4216/**
4217 * isArray
4218 */
4219
4220var isArray = Array.isArray;
4221
4222/**
4223 * toString
4224 */
4225
4226var str = Object.prototype.toString;
4227
4228/**
4229 * Whether or not the given `val`
4230 * is an array.
4231 *
4232 * example:
4233 *
4234 *        isArray([]);
4235 *        // > true
4236 *        isArray(arguments);
4237 *        // > false
4238 *        isArray('');
4239 *        // > false
4240 *
4241 * @param {mixed} val
4242 * @return {bool}
4243 */
4244
4245module.exports = isArray || function (val) {
4246  return !! val && '[object Array]' == str.call(val);
4247};
4248
4249},{}],11:[function(require,module,exports){
4250// Copyright Joyent, Inc. and other Node contributors.
4251//
4252// Permission is hereby granted, free of charge, to any person obtaining a
4253// copy of this software and associated documentation files (the
4254// "Software"), to deal in the Software without restriction, including
4255// without limitation the rights to use, copy, modify, merge, publish,
4256// distribute, sublicense, and/or sell copies of the Software, and to permit
4257// persons to whom the Software is furnished to do so, subject to the
4258// following conditions:
4259//
4260// The above copyright notice and this permission notice shall be included
4261// in all copies or substantial portions of the Software.
4262//
4263// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
4264// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
4265// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
4266// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
4267// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
4268// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
4269// USE OR OTHER DEALINGS IN THE SOFTWARE.
4270
4271function EventEmitter() {
4272  this._events = this._events || {};
4273  this._maxListeners = this._maxListeners || undefined;
4274}
4275module.exports = EventEmitter;
4276
4277// Backwards-compat with node 0.10.x
4278EventEmitter.EventEmitter = EventEmitter;
4279
4280EventEmitter.prototype._events = undefined;
4281EventEmitter.prototype._maxListeners = undefined;
4282
4283// By default EventEmitters will print a warning if more than 10 listeners are
4284// added to it. This is a useful default which helps finding memory leaks.
4285EventEmitter.defaultMaxListeners = 10;
4286
4287// Obviously not all Emitters should be limited to 10. This function allows
4288// that to be increased. Set to zero for unlimited.
4289EventEmitter.prototype.setMaxListeners = function(n) {
4290  if (!isNumber(n) || n < 0 || isNaN(n))
4291    throw TypeError('n must be a positive number');
4292  this._maxListeners = n;
4293  return this;
4294};
4295
4296EventEmitter.prototype.emit = function(type) {
4297  var er, handler, len, args, i, listeners;
4298
4299  if (!this._events)
4300    this._events = {};
4301
4302  // If there is no 'error' event listener then throw.
4303  if (type === 'error') {
4304    if (!this._events.error ||
4305        (isObject(this._events.error) && !this._events.error.length)) {
4306      er = arguments[1];
4307      if (er instanceof Error) {
4308        throw er; // Unhandled 'error' event
4309      }
4310      throw TypeError('Uncaught, unspecified "error" event.');
4311    }
4312  }
4313
4314  handler = this._events[type];
4315
4316  if (isUndefined(handler))
4317    return false;
4318
4319  if (isFunction(handler)) {
4320    switch (arguments.length) {
4321      // fast cases
4322      case 1:
4323        handler.call(this);
4324        break;
4325      case 2:
4326        handler.call(this, arguments[1]);
4327        break;
4328      case 3:
4329        handler.call(this, arguments[1], arguments[2]);
4330        break;
4331      // slower
4332      default:
4333        len = arguments.length;
4334        args = new Array(len - 1);
4335        for (i = 1; i < len; i++)
4336          args[i - 1] = arguments[i];
4337        handler.apply(this, args);
4338    }
4339  } else if (isObject(handler)) {
4340    len = arguments.length;
4341    args = new Array(len - 1);
4342    for (i = 1; i < len; i++)
4343      args[i - 1] = arguments[i];
4344
4345    listeners = handler.slice();
4346    len = listeners.length;
4347    for (i = 0; i < len; i++)
4348      listeners[i].apply(this, args);
4349  }
4350
4351  return true;
4352};
4353
4354EventEmitter.prototype.addListener = function(type, listener) {
4355  var m;
4356
4357  if (!isFunction(listener))
4358    throw TypeError('listener must be a function');
4359
4360  if (!this._events)
4361    this._events = {};
4362
4363  // To avoid recursion in the case that type === "newListener"! Before
4364  // adding it to the listeners, first emit "newListener".
4365  if (this._events.newListener)
4366    this.emit('newListener', type,
4367              isFunction(listener.listener) ?
4368              listener.listener : listener);
4369
4370  if (!this._events[type])
4371    // Optimize the case of one listener. Don't need the extra array object.
4372    this._events[type] = listener;
4373  else if (isObject(this._events[type]))
4374    // If we've already got an array, just append.
4375    this._events[type].push(listener);
4376  else
4377    // Adding the second element, need to change to array.
4378    this._events[type] = [this._events[type], listener];
4379
4380  // Check for listener leak
4381  if (isObject(this._events[type]) && !this._events[type].warned) {
4382    var m;
4383    if (!isUndefined(this._maxListeners)) {
4384      m = this._maxListeners;
4385    } else {
4386      m = EventEmitter.defaultMaxListeners;
4387    }
4388
4389    if (m && m > 0 && this._events[type].length > m) {
4390      this._events[type].warned = true;
4391      console.error('(node) warning: possible EventEmitter memory ' +
4392                    'leak detected. %d listeners added. ' +
4393                    'Use emitter.setMaxListeners() to increase limit.',
4394                    this._events[type].length);
4395      if (typeof console.trace === 'function') {
4396        // not supported in IE 10
4397        console.trace();
4398      }
4399    }
4400  }
4401
4402  return this;
4403};
4404
4405EventEmitter.prototype.on = EventEmitter.prototype.addListener;
4406
4407EventEmitter.prototype.once = function(type, listener) {
4408  if (!isFunction(listener))
4409    throw TypeError('listener must be a function');
4410
4411  var fired = false;
4412
4413  function g() {
4414    this.removeListener(type, g);
4415
4416    if (!fired) {
4417      fired = true;
4418      listener.apply(this, arguments);
4419    }
4420  }
4421
4422  g.listener = listener;
4423  this.on(type, g);
4424
4425  return this;
4426};
4427
4428// emits a 'removeListener' event iff the listener was removed
4429EventEmitter.prototype.removeListener = function(type, listener) {
4430  var list, position, length, i;
4431
4432  if (!isFunction(listener))
4433    throw TypeError('listener must be a function');
4434
4435  if (!this._events || !this._events[type])
4436    return this;
4437
4438  list = this._events[type];
4439  length = list.length;
4440  position = -1;
4441
4442  if (list === listener ||
4443      (isFunction(list.listener) && list.listener === listener)) {
4444    delete this._events[type];
4445    if (this._events.removeListener)
4446      this.emit('removeListener', type, listener);
4447
4448  } else if (isObject(list)) {
4449    for (i = length; i-- > 0;) {
4450      if (list[i] === listener ||
4451          (list[i].listener && list[i].listener === listener)) {
4452        position = i;
4453        break;
4454      }
4455    }
4456
4457    if (position < 0)
4458      return this;
4459
4460    if (list.length === 1) {
4461      list.length = 0;
4462      delete this._events[type];
4463    } else {
4464      list.splice(position, 1);
4465    }
4466
4467    if (this._events.removeListener)
4468      this.emit('removeListener', type, listener);
4469  }
4470
4471  return this;
4472};
4473
4474EventEmitter.prototype.removeAllListeners = function(type) {
4475  var key, listeners;
4476
4477  if (!this._events)
4478    return this;
4479
4480  // not listening for removeListener, no need to emit
4481  if (!this._events.removeListener) {
4482    if (arguments.length === 0)
4483      this._events = {};
4484    else if (this._events[type])
4485      delete this._events[type];
4486    return this;
4487  }
4488
4489  // emit removeListener for all listeners on all events
4490  if (arguments.length === 0) {
4491    for (key in this._events) {
4492      if (key === 'removeListener') continue;
4493      this.removeAllListeners(key);
4494    }
4495    this.removeAllListeners('removeListener');
4496    this._events = {};
4497    return this;
4498  }
4499
4500  listeners = this._events[type];
4501
4502  if (isFunction(listeners)) {
4503    this.removeListener(type, listeners);
4504  } else {
4505    // LIFO order
4506    while (listeners.length)
4507      this.removeListener(type, listeners[listeners.length - 1]);
4508  }
4509  delete this._events[type];
4510
4511  return this;
4512};
4513
4514EventEmitter.prototype.listeners = function(type) {
4515  var ret;
4516  if (!this._events || !this._events[type])
4517    ret = [];
4518  else if (isFunction(this._events[type]))
4519    ret = [this._events[type]];
4520  else
4521    ret = this._events[type].slice();
4522  return ret;
4523};
4524
4525EventEmitter.listenerCount = function(emitter, type) {
4526  var ret;
4527  if (!emitter._events || !emitter._events[type])
4528    ret = 0;
4529  else if (isFunction(emitter._events[type]))
4530    ret = 1;
4531  else
4532    ret = emitter._events[type].length;
4533  return ret;
4534};
4535
4536function isFunction(arg) {
4537  return typeof arg === 'function';
4538}
4539
4540function isNumber(arg) {
4541  return typeof arg === 'number';
4542}
4543
4544function isObject(arg) {
4545  return typeof arg === 'object' && arg !== null;
4546}
4547
4548function isUndefined(arg) {
4549  return arg === void 0;
4550}
4551
4552},{}],12:[function(require,module,exports){
4553if (typeof Object.create === 'function') {
4554  // implementation from standard node.js 'util' module
4555  module.exports = function inherits(ctor, superCtor) {
4556    ctor.super_ = superCtor
4557    ctor.prototype = Object.create(superCtor.prototype, {
4558      constructor: {
4559        value: ctor,
4560        enumerable: false,
4561        writable: true,
4562        configurable: true
4563      }
4564    });
4565  };
4566} else {
4567  // old school shim for old browsers
4568  module.exports = function inherits(ctor, superCtor) {
4569    ctor.super_ = superCtor
4570    var TempCtor = function () {}
4571    TempCtor.prototype = superCtor.prototype
4572    ctor.prototype = new TempCtor()
4573    ctor.prototype.constructor = ctor
4574  }
4575}
4576
4577},{}],13:[function(require,module,exports){
4578module.exports = Array.isArray || function (arr) {
4579  return Object.prototype.toString.call(arr) == '[object Array]';
4580};
4581
4582},{}],14:[function(require,module,exports){
4583// shim for using process in browser
4584
4585var process = module.exports = {};
4586var queue = [];
4587var draining = false;
vendor: 13,641 bytes, lines 4588-5040
4588var currentQueue;
4589var queueIndex = -1;
4590
4591function cleanUpNextTick() {
4592    draining = false;
4593    if (currentQueue.length) {
4594        queue = currentQueue.concat(queue);
4595    } else {
4596        queueIndex = -1;
4597    }
4598    if (queue.length) {
4599        drainQueue();
4600    }
4601}
4602
4603function drainQueue() {
4604    if (draining) {
4605        return;
4606    }
4607    var timeout = setTimeout(cleanUpNextTick);
4608    draining = true;
4609
4610    var len = queue.length;
4611    while(len) {
4612        currentQueue = queue;
4613        queue = [];
4614        while (++queueIndex < len) {
4615            currentQueue[queueIndex].run();
4616        }
4617        queueIndex = -1;
4618        len = queue.length;
4619    }
4620    currentQueue = null;
4621    draining = false;
4622    clearTimeout(timeout);
4623}
4624
4625process.nextTick = function (fun) {
4626    var args = new Array(arguments.length - 1);
4627    if (arguments.length > 1) {
4628        for (var i = 1; i < arguments.length; i++) {
4629            args[i - 1] = arguments[i];
4630        }
4631    }
4632    queue.push(new Item(fun, args));
4633    if (queue.length === 1 && !draining) {
4634        setTimeout(drainQueue, 0);
4635    }
4636};
4637
4638// v8 likes predictible objects
4639function Item(fun, array) {
4640    this.fun = fun;
4641    this.array = array;
4642}
4643Item.prototype.run = function () {
4644    this.fun.apply(null, this.array);
4645};
4646process.title = 'browser';
4647process.browser = true;
4648process.env = {};
4649process.argv = [];
4650process.version = ''; // empty string to avoid regexp issues
4651process.versions = {};
4652
4653function noop() {}
4654
4655process.on = noop;
4656process.addListener = noop;
4657process.once = noop;
4658process.off = noop;
4659process.removeListener = noop;
4660process.removeAllListeners = noop;
4661process.emit = noop;
4662
4663process.binding = function (name) {
4664    throw new Error('process.binding is not supported');
4665};
4666
4667// TODO(shtylman)
4668process.cwd = function () { return '/' };
4669process.chdir = function (dir) {
4670    throw new Error('process.chdir is not supported');
4671};
4672process.umask = function() { return 0; };
4673
4674},{}],15:[function(require,module,exports){
4675module.exports = require("./lib/_stream_duplex.js")
4676
4677},{"./lib/_stream_duplex.js":16}],16:[function(require,module,exports){
4678(function (process){
4679// Copyright Joyent, Inc. and other Node contributors.
4680//
4681// Permission is hereby granted, free of charge, to any person obtaining a
4682// copy of this software and associated documentation files (the
4683// "Software"), to deal in the Software without restriction, including
4684// without limitation the rights to use, copy, modify, merge, publish,
4685// distribute, sublicense, and/or sell copies of the Software, and to permit
4686// persons to whom the Software is furnished to do so, subject to the
4687// following conditions:
4688//
4689// The above copyright notice and this permission notice shall be included
4690// in all copies or substantial portions of the Software.
4691//
4692// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
4693// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
4694// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
4695// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
4696// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
4697// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
4698// USE OR OTHER DEALINGS IN THE SOFTWARE.
4699
4700// a duplex stream is just a stream that is both readable and writable.
4701// Since JS doesn't have multiple prototypal inheritance, this class
4702// prototypally inherits from Readable, and then parasitically from
4703// Writable.
4704
4705module.exports = Duplex;
4706
4707/*<replacement>*/
4708var objectKeys = Object.keys || function (obj) {
4709  var keys = [];
4710  for (var key in obj) keys.push(key);
4711  return keys;
4712}
4713/*</replacement>*/
4714
4715
4716/*<replacement>*/
4717var util = require('core-util-is');
4718util.inherits = require('inherits');
4719/*</replacement>*/
4720
4721var Readable = require('./_stream_readable');
4722var Writable = require('./_stream_writable');
4723
4724util.inherits(Duplex, Readable);
4725
4726forEach(objectKeys(Writable.prototype), function(method) {
4727  if (!Duplex.prototype[method])
4728    Duplex.prototype[method] = Writable.prototype[method];
4729});
4730
4731function Duplex(options) {
4732  if (!(this instanceof Duplex))
4733    return new Duplex(options);
4734
4735  Readable.call(this, options);
4736  Writable.call(this, options);
4737
4738  if (options && options.readable === false)
4739    this.readable = false;
4740
4741  if (options && options.writable === false)
4742    this.writable = false;
4743
4744  this.allowHalfOpen = true;
4745  if (options && options.allowHalfOpen === false)
4746    this.allowHalfOpen = false;
4747
4748  this.once('end', onend);
4749}
4750
4751// the no-half-open enforcer
4752function onend() {
4753  // if we allow half-open state, or if the writable side ended,
4754  // then we're ok.
4755  if (this.allowHalfOpen || this._writableState.ended)
4756    return;
4757
4758  // no more data can be written.
4759  // But allow more writes to happen in this tick.
4760  process.nextTick(this.end.bind(this));
4761}
4762
4763function forEach (xs, f) {
4764  for (var i = 0, l = xs.length; i < l; i++) {
4765    f(xs[i], i);
4766  }
4767}
4768
4769}).call(this,require('_process'))
4770},{"./_stream_readable":18,"./_stream_writable":20,"_process":14,"core-util-is":21,"inherits":12}],17:[function(require,module,exports){
4771// Copyright Joyent, Inc. and other Node contributors.
4772//
4773// Permission is hereby granted, free of charge, to any person obtaining a
4774// copy of this software and associated documentation files (the
4775// "Software"), to deal in the Software without restriction, including
4776// without limitation the rights to use, copy, modify, merge, publish,
4777// distribute, sublicense, and/or sell copies of the Software, and to permit
4778// persons to whom the Software is furnished to do so, subject to the
4779// following conditions:
4780//
4781// The above copyright notice and this permission notice shall be included
4782// in all copies or substantial portions of the Software.
4783//
4784// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
4785// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
4786// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
4787// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
4788// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
4789// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
4790// USE OR OTHER DEALINGS IN THE SOFTWARE.
4791
4792// a passthrough stream.
4793// basically just the most minimal sort of Transform stream.
4794// Every written chunk gets output as-is.
4795
4796module.exports = PassThrough;
4797
4798var Transform = require('./_stream_transform');
4799
4800/*<replacement>*/
4801var util = require('core-util-is');
4802util.inherits = require('inherits');
4803/*</replacement>*/
4804
4805util.inherits(PassThrough, Transform);
4806
4807function PassThrough(options) {
4808  if (!(this instanceof PassThrough))
4809    return new PassThrough(options);
4810
4811  Transform.call(this, options);
4812}
4813
4814PassThrough.prototype._transform = function(chunk, encoding, cb) {
4815  cb(null, chunk);
4816};
4817
4818},{"./_stream_transform":19,"core-util-is":21,"inherits":12}],18:[function(require,module,exports){
4819(function (process){
4820// Copyright Joyent, Inc. and other Node contributors.
4821//
4822// Permission is hereby granted, free of charge, to any person obtaining a
4823// copy of this software and associated documentation files (the
4824// "Software"), to deal in the Software without restriction, including
4825// without limitation the rights to use, copy, modify, merge, publish,
4826// distribute, sublicense, and/or sell copies of the Software, and to permit
4827// persons to whom the Software is furnished to do so, subject to the
4828// following conditions:
4829//
4830// The above copyright notice and this permission notice shall be included
4831// in all copies or substantial portions of the Software.
4832//
4833// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
4834// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
4835// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
4836// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
4837// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
4838// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
4839// USE OR OTHER DEALINGS IN THE SOFTWARE.
4840
4841module.exports = Readable;
4842
4843/*<replacement>*/
4844var isArray = require('isarray');
4845/*</replacement>*/
4846
4847
4848/*<replacement>*/
4849var Buffer = require('buffer').Buffer;
4850/*</replacement>*/
4851
4852Readable.ReadableState = ReadableState;
4853
4854var EE = require('events').EventEmitter;
4855
4856/*<replacement>*/
4857if (!EE.listenerCount) EE.listenerCount = function(emitter, type) {
4858  return emitter.listeners(type).length;
4859};
4860/*</replacement>*/
4861
4862var Stream = require('stream');
4863
4864/*<replacement>*/
4865var util = require('core-util-is');
4866util.inherits = require('inherits');
4867/*</replacement>*/
4868
4869var StringDecoder;
4870
4871
4872/*<replacement>*/
4873var debug = require('util');
4874if (debug && debug.debuglog) {
4875  debug = debug.debuglog('stream');
4876} else {
4877  debug = function () {};
4878}
4879/*</replacement>*/
4880
4881
4882util.inherits(Readable, Stream);
4883
4884function ReadableState(options, stream) {
4885  var Duplex = require('./_stream_duplex');
4886
4887  options = options || {};
4888
4889  // the point at which it stops calling _read() to fill the buffer
4890  // Note: 0 is a valid value, means "don't call _read preemptively ever"
4891  var hwm = options.highWaterMark;
4892  var defaultHwm = options.objectMode ? 16 : 16 * 1024;
4893  this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;
4894
4895  // cast to ints.
4896  this.highWaterMark = ~~this.highWaterMark;
4897
4898  this.buffer = [];
4899  this.length = 0;
4900  this.pipes = null;
4901  this.pipesCount = 0;
4902  this.flowing = null;
4903  this.ended = false;
4904  this.endEmitted = false;
4905  this.reading = false;
4906
4907  // a flag to be able to tell if the onwrite cb is called immediately,
4908  // or on a later tick.  We set this to true at first, because any
4909  // actions that shouldn't happen until "later" should generally also
4910  // not happen before the first write call.
4911  this.sync = true;
4912
4913  // whenever we return null, then we set a flag to say
4914  // that we're awaiting a 'readable' event emission.
4915  this.needReadable = false;
4916  this.emittedReadable = false;
4917  this.readableListening = false;
4918
4919
4920  // object stream flag. Used to make read(n) ignore n and to
4921  // make all the buffer merging and length checks go away
4922  this.objectMode = !!options.objectMode;
4923
4924  if (stream instanceof Duplex)
4925    this.objectMode = this.objectMode || !!options.readableObjectMode;
4926
4927  // Crypto is kind of old and crusty.  Historically, its default string
4928  // encoding is 'binary' so we have to make this configurable.
4929  // Everything else in the universe uses 'utf8', though.
4930  this.defaultEncoding = options.defaultEncoding || 'utf8';
4931
4932  // when piping, we only care about 'readable' events that happen
4933  // after read()ing all the bytes and not getting any pushback.
4934  this.ranOut = false;
4935
4936  // the number of writers that are awaiting a drain event in .pipe()s
4937  this.awaitDrain = 0;
4938
4939  // if true, a maybeReadMore has been scheduled
4940  this.readingMore = false;
4941
4942  this.decoder = null;
4943  this.encoding = null;
4944  if (options.encoding) {
4945    if (!StringDecoder)
4946      StringDecoder = require('string_decoder/').StringDecoder;
4947    this.decoder = new StringDecoder(options.encoding);
4948    this.encoding = options.encoding;
4949  }
4950}
4951
4952function Readable(options) {
4953  var Duplex = require('./_stream_duplex');
4954
4955  if (!(this instanceof Readable))
4956    return new Readable(options);
4957
4958  this._readableState = new ReadableState(options, this);
4959
4960  // legacy
4961  this.readable = true;
4962
4963  Stream.call(this);
4964}
4965
4966// Manually shove something into the read() buffer.
4967// This returns true if the highWaterMark has not been hit yet,
4968// similar to how Writable.write() returns true if you should
4969// write() some more.
4970Readable.prototype.push = function(chunk, encoding) {
4971  var state = this._readableState;
4972
4973  if (util.isString(chunk) && !state.objectMode) {
4974    encoding = encoding || state.defaultEncoding;
4975    if (encoding !== state.encoding) {
4976      chunk = new Buffer(chunk, encoding);
4977      encoding = '';
4978    }
4979  }
4980
4981  return readableAddChunk(this, state, chunk, encoding, false);
4982};
4983
4984// Unshift should *always* be something directly out of read()
4985Readable.prototype.unshift = function(chunk) {
4986  var state = this._readableState;
4987  return readableAddChunk(this, state, chunk, '', true);
4988};
4989
4990function readableAddChunk(stream, state, chunk, encoding, addToFront) {
4991  var er = chunkInvalid(state, chunk);
4992  if (er) {
4993    stream.emit('error', er);
4994  } else if (util.isNullOrUndefined(chunk)) {
4995    state.reading = false;
4996    if (!state.ended)
4997      onEofChunk(stream, state);
4998  } else if (state.objectMode || chunk && chunk.length > 0) {
4999    if (state.ended && !addToFront) {
5000      var e = new Error('stream.push() after EOF');
5001      stream.emit('error', e);
5002    } else if (state.endEmitted && addToFront) {
5003      var e = new Error('stream.unshift() after end event');
5004      stream.emit('error', e);
5005    } else {
5006      if (state.decoder && !addToFront && !encoding)
5007        chunk = state.decoder.write(chunk);
5008
5009      if (!addToFront)
5010        state.reading = false;
5011
5012      // if we want the data now, just emit it.
5013      if (state.flowing && state.length === 0 && !state.sync) {
5014        stream.emit('data', chunk);
5015        stream.read(0);
5016      } else {
5017        // update the buffer info.
5018        state.length += state.objectMode ? 1 : chunk.length;
5019        if (addToFront)
5020          state.buffer.unshift(chunk);
5021        else
5022          state.buffer.push(chunk);
5023
5024        if (state.needReadable)
5025          emitReadable(stream);
5026      }
5027
5028      maybeReadMore(stream, state);
5029    }
5030  } else if (!addToFront) {
5031    state.reading = false;
5032  }
5033
5034  return needMoreData(state);
5035}
5036
5037
5038
5039// if it's past the high water mark, we can push in some more.
5040// Also, if we have no data yet, we can stand some
5041// more bytes.  This is to work around cases where hwm=0,
5042// such as the repl.  Also, if the push() triggered a
5043// readable event, and the user called read(largeNumber) such that
5044// needReadable was set, then we ought to push more, so that another
5045// 'readable' event will be triggered.
5046function needMoreData(state) {
5047  return !state.ended &&
5048         (state.needReadable ||
5049          state.length < state.highWaterMark ||
5050          state.length === 0);
5051}
5052
5053// backwards compatibility.
5054Readable.prototype.setEncoding = function(enc) {
5055  if (!StringDecoder)
5056    StringDecoder = require
vendor: 18,684 bytes, lines 5056-5772
5056('string_decoder/').StringDecoder;
5057  this._readableState.decoder = new StringDecoder(enc);
5058  this._readableState.encoding = enc;
5059  return this;
5060};
5061
5062// Don't raise the hwm > 128MB
5063var MAX_HWM = 0x800000;
5064function roundUpToNextPowerOf2(n) {
5065  if (n >= MAX_HWM) {
5066    n = MAX_HWM;
5067  } else {
5068    // Get the next highest power of 2
5069    n--;
5070    for (var p = 1; p < 32; p <<= 1) n |= n >> p;
5071    n++;
5072  }
5073  return n;
5074}
5075
5076function howMuchToRead(n, state) {
5077  if (state.length === 0 && state.ended)
5078    return 0;
5079
5080  if (state.objectMode)
5081    return n === 0 ? 0 : 1;
5082
5083  if (isNaN(n) || util.isNull(n)) {
5084    // only flow one buffer at a time
5085    if (state.flowing && state.buffer.length)
5086      return state.buffer[0].length;
5087    else
5088      return state.length;
5089  }
5090
5091  if (n <= 0)
5092    return 0;
5093
5094  // If we're asking for more than the target buffer level,
5095  // then raise the water mark.  Bump up to the next highest
5096  // power of 2, to prevent increasing it excessively in tiny
5097  // amounts.
5098  if (n > state.highWaterMark)
5099    state.highWaterMark = roundUpToNextPowerOf2(n);
5100
5101  // don't have that much.  return null, unless we've ended.
5102  if (n > state.length) {
5103    if (!state.ended) {
5104      state.needReadable = true;
5105      return 0;
5106    } else
5107      return state.length;
5108  }
5109
5110  return n;
5111}
5112
5113// you can override either this method, or the async _read(n) below.
5114Readable.prototype.read = function(n) {
5115  debug('read', n);
5116  var state = this._readableState;
5117  var nOrig = n;
5118
5119  if (!util.isNumber(n) || n > 0)
5120    state.emittedReadable = false;
5121
5122  // if we're doing read(0) to trigger a readable event, but we
5123  // already have a bunch of data in the buffer, then just trigger
5124  // the 'readable' event and move on.
5125  if (n === 0 &&
5126      state.needReadable &&
5127      (state.length >= state.highWaterMark || state.ended)) {
5128    debug('read: emitReadable', state.length, state.ended);
5129    if (state.length === 0 && state.ended)
5130      endReadable(this);
5131    else
5132      emitReadable(this);
5133    return null;
5134  }
5135
5136  n = howMuchToRead(n, state);
5137
5138  // if we've ended, and we're now clear, then finish it up.
5139  if (n === 0 && state.ended) {
5140    if (state.length === 0)
5141      endReadable(this);
5142    return null;
5143  }
5144
5145  // All the actual chunk generation logic needs to be
5146  // *below* the call to _read.  The reason is that in certain
5147  // synthetic stream cases, such as passthrough streams, _read
5148  // may be a completely synchronous operation which may change
5149  // the state of the read buffer, providing enough data when
5150  // before there was *not* enough.
5151  //
5152  // So, the steps are:
5153  // 1. Figure out what the state of things will be after we do
5154  // a read from the buffer.
5155  //
5156  // 2. If that resulting state will trigger a _read, then call _read.
5157  // Note that this may be asynchronous, or synchronous.  Yes, it is
5158  // deeply ugly to write APIs this way, but that still doesn't mean
5159  // that the Readable class should behave improperly, as streams are
5160  // designed to be sync/async agnostic.
5161  // Take note if the _read call is sync or async (ie, if the read call
5162  // has returned yet), so that we know whether or not it's safe to emit
5163  // 'readable' etc.
5164  //
5165  // 3. Actually pull the requested chunks out of the buffer and return.
5166
5167  // if we need a readable event, then we need to do some reading.
5168  var doRead = state.needReadable;
5169  debug('need readable', doRead);
5170
5171  // if we currently have less than the highWaterMark, then also read some
5172  if (state.length === 0 || state.length - n < state.highWaterMark) {
5173    doRead = true;
5174    debug('length less than watermark', doRead);
5175  }
5176
5177  // however, if we've ended, then there's no point, and if we're already
5178  // reading, then it's unnecessary.
5179  if (state.ended || state.reading) {
5180    doRead = false;
5181    debug('reading or ended', doRead);
5182  }
5183
5184  if (doRead) {
5185    debug('do read');
5186    state.reading = true;
5187    state.sync = true;
5188    // if the length is currently zero, then we *need* a readable event.
5189    if (state.length === 0)
5190      state.needReadable = true;
5191    // call internal read method
5192    this._read(state.highWaterMark);
5193    state.sync = false;
5194  }
5195
5196  // If _read pushed data synchronously, then `reading` will be false,
5197  // and we need to re-evaluate how much data we can return to the user.
5198  if (doRead && !state.reading)
5199    n = howMuchToRead(nOrig, state);
5200
5201  var ret;
5202  if (n > 0)
5203    ret = fromList(n, state);
5204  else
5205    ret = null;
5206
5207  if (util.isNull(ret)) {
5208    state.needReadable = true;
5209    n = 0;
5210  }
5211
5212  state.length -= n;
5213
5214  // If we have nothing in the buffer, then we want to know
5215  // as soon as we *do* get something into the buffer.
5216  if (state.length === 0 && !state.ended)
5217    state.needReadable = true;
5218
5219  // If we tried to read() past the EOF, then emit end on the next tick.
5220  if (nOrig !== n && state.ended && state.length === 0)
5221    endReadable(this);
5222
5223  if (!util.isNull(ret))
5224    this.emit('data', ret);
5225
5226  return ret;
5227};
5228
5229function chunkInvalid(state, chunk) {
5230  var er = null;
5231  if (!util.isBuffer(chunk) &&
5232      !util.isString(chunk) &&
5233      !util.isNullOrUndefined(chunk) &&
5234      !state.objectMode) {
5235    er = new TypeError('Invalid non-string/buffer chunk');
5236  }
5237  return er;
5238}
5239
5240
5241function onEofChunk(stream, state) {
5242  if (state.decoder && !state.ended) {
5243    var chunk = state.decoder.end();
5244    if (chunk && chunk.length) {
5245      state.buffer.push(chunk);
5246      state.length += state.objectMode ? 1 : chunk.length;
5247    }
5248  }
5249  state.ended = true;
5250
5251  // emit 'readable' now to make sure it gets picked up.
5252  emitReadable(stream);
5253}
5254
5255// Don't emit readable right away in sync mode, because this can trigger
5256// another read() call => stack overflow.  This way, it might trigger
5257// a nextTick recursion warning, but that's not so bad.
5258function emitReadable(stream) {
5259  var state = stream._readableState;
5260  state.needReadable = false;
5261  if (!state.emittedReadable) {
5262    debug('emitReadable', state.flowing);
5263    state.emittedReadable = true;
5264    if (state.sync)
5265      process.nextTick(function() {
5266        emitReadable_(stream);
5267      });
5268    else
5269      emitReadable_(stream);
5270  }
5271}
5272
5273function emitReadable_(stream) {
5274  debug('emit readable');
5275  stream.emit('readable');
5276  flow(stream);
5277}
5278
5279
5280// at this point, the user has presumably seen the 'readable' event,
5281// and called read() to consume some data.  that may have triggered
5282// in turn another _read(n) call, in which case reading = true if
5283// it's in progress.
5284// However, if we're not ended, or reading, and the length < hwm,
5285// then go ahead and try to read some more preemptively.
5286function maybeReadMore(stream, state) {
5287  if (!state.readingMore) {
5288    state.readingMore = true;
5289    process.nextTick(function() {
5290      maybeReadMore_(stream, state);
5291    });
5292  }
5293}
5294
5295function maybeReadMore_(stream, state) {
5296  var len = state.length;
5297  while (!state.reading && !state.flowing && !state.ended &&
5298         state.length < state.highWaterMark) {
5299    debug('maybeReadMore read 0');
5300    stream.read(0);
5301    if (len === state.length)
5302      // didn't get any data, stop spinning.
5303      break;
5304    else
5305      len = state.length;
5306  }
5307  state.readingMore = false;
5308}
5309
5310// abstract method.  to be overridden in specific implementation classes.
5311// call cb(er, data) where data is <= n in length.
5312// for virtual (non-string, non-buffer) streams, "length" is somewhat
5313// arbitrary, and perhaps not very meaningful.
5314Readable.prototype._read = function(n) {
5315  this.emit('error', new Error('not implemented'));
5316};
5317
5318Readable.prototype.pipe = function(dest, pipeOpts) {
5319  var src = this;
5320  var state = this._readableState;
5321
5322  switch (state.pipesCount) {
5323    case 0:
5324      state.pipes = dest;
5325      break;
5326    case 1:
5327      state.pipes = [state.pipes, dest];
5328      break;
5329    default:
5330      state.pipes.push(dest);
5331      break;
5332  }
5333  state.pipesCount += 1;
5334  debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
5335
5336  var doEnd = (!pipeOpts || pipeOpts.end !== false) &&
5337              dest !== process.stdout &&
5338              dest !== process.stderr;
5339
5340  var endFn = doEnd ? onend : cleanup;
5341  if (state.endEmitted)
5342    process.nextTick(endFn);
5343  else
5344    src.once('end', endFn);
5345
5346  dest.on('unpipe', onunpipe);
5347  function onunpipe(readable) {
5348    debug('onunpipe');
5349    if (readable === src) {
5350      cleanup();
5351    }
5352  }
5353
5354  function onend() {
5355    debug('onend');
5356    dest.end();
5357  }
5358
5359  // when the dest drains, it reduces the awaitDrain counter
5360  // on the source.  This would be more elegant with a .once()
5361  // handler in flow(), but adding and removing repeatedly is
5362  // too slow.
5363  var ondrain = pipeOnDrain(src);
5364  dest.on('drain', ondrain);
5365
5366  function cleanup() {
5367    debug('cleanup');
5368    // cleanup event handlers once the pipe is broken
5369    dest.removeListener('close', onclose);
5370    dest.removeListener('finish', onfinish);
5371    dest.removeListener('drain', ondrain);
5372    dest.removeListener('error', onerror);
5373    dest.removeListener('unpipe', onunpipe);
5374    src.removeListener('end', onend);
5375    src.removeListener('end', cleanup);
5376    src.removeListener('data', ondata);
5377
5378    // if the reader is waiting for a drain event from this
5379    // specific writer, then it would cause it to never start
5380    // flowing again.
5381    // So, if this is awaiting a drain, then we just call it now.
5382    // If we don't know, then assume that we are waiting for one.
5383    if (state.awaitDrain &&
5384        (!dest._writableState || dest._writableState.needDrain))
5385      ondrain();
5386  }
5387
5388  src.on('data', ondata);
5389  function ondata(chunk) {
5390    debug('ondata');
5391    var ret = dest.write(chunk);
5392    if (false === ret) {
5393      debug('false write response, pause',
5394            src._readableState.awaitDrain);
5395      src._readableState.awaitDrain++;
5396      src.pause();
5397    }
5398  }
5399
5400  // if the dest has an error, then stop piping into it.
5401  // however, don't suppress the throwing behavior for this.
5402  function onerror(er) {
5403    debug('onerror', er);
5404    unpipe();
5405    dest.removeListener('error', onerror);
5406    if (EE.listenerCount(dest, 'error') === 0)
5407      dest.emit('error', er);
5408  }
5409  // This is a brutally ugly hack to make sure that our error handler
5410  // is attached before any userland ones.  NEVER DO THIS.
5411  if (!dest._events || !dest._events.error)
5412    dest.on('error', onerror);
5413  else if (isArray(dest._events.error))
5414    dest._events.error.unshift(onerror);
5415  else
5416    dest._events.error = [onerror, dest._events.error];
5417
5418
5419
5420  // Both close and finish should trigger unpipe, but only once.
5421  function onclose() {
5422    dest.removeListener('finish', onfinish);
5423    unpipe();
5424  }
5425  dest.once('close', onclose);
5426  function onfinish() {
5427    debug('onfinish');
5428    dest.removeListener('close', onclose);
5429    unpipe();
5430  }
5431  dest.once('finish', onfinish);
5432
5433  function unpipe() {
5434    debug('unpipe');
5435    src.unpipe(dest);
5436  }
5437
5438  // tell the dest that it's being piped to
5439  dest.emit('pipe', src);
5440
5441  // start the flow if it hasn't been started already.
5442  if (!state.flowing) {
5443    debug('pipe resume');
5444    src.resume();
5445  }
5446
5447  return dest;
5448};
5449
5450function pipeOnDrain(src) {
5451  return function() {
5452    var state = src._readableState;
5453    debug('pipeOnDrain', state.awaitDrain);
5454    if (state.awaitDrain)
5455      state.awaitDrain--;
5456    if (state.awaitDrain === 0 && EE.listenerCount(src, 'data')) {
5457      state.flowing = true;
5458      flow(src);
5459    }
5460  };
5461}
5462
5463
5464Readable.prototype.unpipe = function(dest) {
5465  var state = this._readableState;
5466
5467  // if we're not piping anywhere, then do nothing.
5468  if (state.pipesCount === 0)
5469    return this;
5470
5471  // just one destination.  most common case.
5472  if (state.pipesCount === 1) {
5473    // passed in one, but it's not the right one.
5474    if (dest && dest !== state.pipes)
5475      return this;
5476
5477    if (!dest)
5478      dest = state.pipes;
5479
5480    // got a match.
5481    state.pipes = null;
5482    state.pipesCount = 0;
5483    state.flowing = false;
5484    if (dest)
5485      dest.emit('unpipe', this);
5486    return this;
5487  }
5488
5489  // slow case. multiple pipe destinations.
5490
5491  if (!dest) {
5492    // remove all.
5493    var dests = state.pipes;
5494    var len = state.pipesCount;
5495    state.pipes = null;
5496    state.pipesCount = 0;
5497    state.flowing = false;
5498
5499    for (var i = 0; i < len; i++)
5500      dests[i].emit('unpipe', this);
5501    return this;
5502  }
5503
5504  // try to find the right one.
5505  var i = indexOf(state.pipes, dest);
5506  if (i === -1)
5507    return this;
5508
5509  state.pipes.splice(i, 1);
5510  state.pipesCount -= 1;
5511  if (state.pipesCount === 1)
5512    state.pipes = state.pipes[0];
5513
5514  dest.emit('unpipe', this);
5515
5516  return this;
5517};
5518
5519// set up data events if they are asked for
5520// Ensure readable listeners eventually get something
5521Readable.prototype.on = function(ev, fn) {
5522  var res = Stream.prototype.on.call(this, ev, fn);
5523
5524  // If listening to data, and it has not explicitly been paused,
5525  // then call resume to start the flow of data on the next tick.
5526  if (ev === 'data' && false !== this._readableState.flowing) {
5527    this.resume();
5528  }
5529
5530  if (ev === 'readable' && this.readable) {
5531    var state = this._readableState;
5532    if (!state.readableListening) {
5533      state.readableListening = true;
5534      state.emittedReadable = false;
5535      state.needReadable = true;
5536      if (!state.reading) {
5537        var self = this;
5538        process.nextTick(function() {
5539          debug('readable nexttick read 0');
5540          self.read(0);
5541        });
5542      } else if (state.length) {
5543        emitReadable(this, state);
5544      }
5545    }
5546  }
5547
5548  return res;
5549};
5550Readable.prototype.addListener = Readable.prototype.on;
5551
5552// pause() and resume() are remnants of the legacy readable stream API
5553// If the user uses them, then switch into old mode.
5554Readable.prototype.resume = function() {
5555  var state = this._readableState;
5556  if (!state.flowing) {
5557    debug('resume');
5558    state.flowing = true;
5559    if (!state.reading) {
5560      debug('resume read 0');
5561      this.read(0);
5562    }
5563    resume(this, state);
5564  }
5565  return this;
5566};
5567
5568function resume(stream, state) {
5569  if (!state.resumeScheduled) {
5570    state.resumeScheduled = true;
5571    process.nextTick(function() {
5572      resume_(stream, state);
5573    });
5574  }
5575}
5576
5577function resume_(stream, state) {
5578  state.resumeScheduled = false;
5579  stream.emit('resume');
5580  flow(stream);
5581  if (state.flowing && !state.reading)
5582    stream.read(0);
5583}
5584
5585Readable.prototype.pause = function() {
5586  debug('call pause flowing=%j', this._readableState.flowing);
5587  if (false !== this._readableState.flowing) {
5588    debug('pause');
5589    this._readableState.flowing = false;
5590    this.emit('pause');
5591  }
5592  return this;
5593};
5594
5595function flow(stream) {
5596  var state = stream._readableState;
5597  debug('flow', state.flowing);
5598  if (state.flowing) {
5599    do {
5600      var chunk = stream.read();
5601    } while (null !== chunk && state.flowing);
5602  }
5603}
5604
5605// wrap an old-style stream as the async data source.
5606// This is *not* part of the readable stream interface.
5607// It is an ugly unfortunate mess of history.
5608Readable.prototype.wrap = function(stream) {
5609  var state = this._readableState;
5610  var paused = false;
5611
5612  var self = this;
5613  stream.on('end', function() {
5614    debug('wrapped end');
5615    if (state.decoder && !state.ended) {
5616      var chunk = state.decoder.end();
5617      if (chunk && chunk.length)
5618        self.push(chunk);
5619    }
5620
5621    self.push(null);
5622  });
5623
5624  stream.on('data', function(chunk) {
5625    debug('wrapped data');
5626    if (state.decoder)
5627      chunk = state.decoder.write(chunk);
5628    if (!chunk || !state.objectMode && !chunk.length)
5629      return;
5630
5631    var ret = self.push(chunk);
5632    if (!ret) {
5633      paused = true;
5634      stream.pause();
5635    }
5636  });
5637
5638  // proxy all the other methods.
5639  // important when wrapping filters and duplexes.
5640  for (var i in stream) {
5641    if (util.isFunction(stream[i]) && util.isUndefined(this[i])) {
5642      this[i] = function(method) { return function() {
5643        return stream[method].apply(stream, arguments);
5644      }}(i);
5645    }
5646  }
5647
5648  // proxy certain important events.
5649  var events = ['error', 'close', 'destroy', 'pause', 'resume'];
5650  forEach(events, function(ev) {
5651    stream.on(ev, self.emit.bind(self, ev));
5652  });
5653
5654  // when we try to consume some more bytes, simply unpause the
5655  // underlying stream.
5656  self._read = function(n) {
5657    debug('wrapped _read', n);
5658    if (paused) {
5659      paused = false;
5660      stream.resume();
5661    }
5662  };
5663
5664  return self;
5665};
5666
5667
5668
5669// exposed for testing purposes only.
5670Readable._fromList = fromList;
5671
5672// Pluck off n bytes from an array of buffers.
5673// Length is the combined lengths of all the buffers in the list.
5674function fromList(n, state) {
5675  var list = state.buffer;
5676  var length = state.length;
5677  var stringMode = !!state.decoder;
5678  var objectMode = !!state.objectMode;
5679  var ret;
5680
5681  // nothing in the list, definitely empty.
5682  if (list.length === 0)
5683    return null;
5684
5685  if (length === 0)
5686    ret = null;
5687  else if (objectMode)
5688    ret = list.shift();
5689  else if (!n || n >= length) {
5690    // read it all, truncate the array.
5691    if (stringMode)
5692      ret = list.join('');
5693    else
5694      ret = Buffer.concat(list, length);
5695    list.length = 0;
5696  } else {
5697    // read just some of it.
5698    if (n < list[0].length) {
5699      // just take a part of the first list item.
5700      // slice is the same for buffers and strings.
5701      var buf = list[0];
5702      ret = buf.slice(0, n);
5703      list[0] = buf.slice(n);
5704    } else if (n === list[0].length) {
5705      // first list is a perfect match
5706      ret = list.shift();
5707    } else {
5708      // complex case.
5709      // we have enough to cover it, but it spans past the first buffer.
5710      if (stringMode)
5711        ret = '';
5712      else
5713        ret = new Buffer(n);
5714
5715      var c = 0;
5716      for (var i = 0, l = list.length; i < l && c < n; i++) {
5717        var buf = list[0];
5718        var cpy = Math.min(n - c, buf.length);
5719
5720        if (stringMode)
5721          ret += buf.slice(0, cpy);
5722        else
5723          buf.copy(ret, c, 0, cpy);
5724
5725        if (cpy < buf.length)
5726          list[0] = buf.slice(cpy);
5727        else
5728          list.shift();
5729
5730        c += cpy;
5731      }
5732    }
5733  }
5734
5735  return ret;
5736}
5737
5738function endReadable(stream) {
5739  var state = stream._readableState;
5740
5741  // If we get here before consuming all the bytes, then that is a
5742  // bug in node.  Should never happen.
5743  if (state.length > 0)
5744    throw new Error('endReadable called on non-empty stream');
5745
5746  if (!state.endEmitted) {
5747    state.ended = true;
5748    process.nextTick(function() {
5749      // Check that we didn't get one last unshift.
5750      if (!state.endEmitted && state.length === 0) {
5751        state.endEmitted = true;
5752        stream.readable = false;
5753        stream.emit('end');
5754      }
5755    });
5756  }
5757}
5758
5759function forEach (xs, f) {
5760  for (var i = 0, l = xs.length; i < l; i++) {
5761    f(xs[i], i);
5762  }
5763}
5764
5765function indexOf (xs, x) {
5766  for (var i = 0, l = xs.length; i < l; i++) {
5767    if (xs[i] === x) return i;
5768  }
5769  return -1;
5770}
5771
5772}).call(this
5772,require('_process'))
5773},{"./_stream_duplex":16,"_process":14,"buffer":7,"core-util-is":21,"events":11,"inherits":12,"isarray":13,"stream":26,"string_decoder/":27,"util":6}],19:[function(require,module,exports){
5774// Copyright Joyent, Inc. and other Node contributors.
5775//
5776// Permission is hereby granted, free of charge, to any person obtaining a
5777// copy of this software and associated documentation files (the
5778// "Software"), to deal in the Software without restriction, including
5779// without limitation the rights to use, copy, modify, merge, publish,
5780// distribute, sublicense, and/or sell copies of the Software, and to permit
5781// persons to whom the Software is furnished to do so, subject to the
5782// following conditions:
5783//
5784// The above copyright notice and this permission notice shall be included
5785// in all copies or substantial portions of the Software.
5786//
5787// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
5788// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
5789// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
5790// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
5791// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
5792// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
5793// USE OR OTHER DEALINGS IN THE SOFTWARE.
5794
5795
5796// a transform stream is a readable/writable stream where you do
5797// something with the data.  Sometimes it's called a "filter",
5798// but that's not a great name for it, since that implies a thing where
5799// some bits pass through, and others are simply ignored.  (That would
5800// be a valid example of a transform, of course.)
5801//
5802// While the output is causally related to the input, it's not a
5803// necessarily symmetric or synchronous transformation.  For example,
5804// a zlib stream might take multiple plain-text writes(), and then
5805// emit a single compressed chunk some time in the future.
5806//
5807// Here's how this works:
5808//
5809// The Transform stream has all the aspects of the readable and writable
5810// stream classes.  When you write(chunk), that calls _write(chunk,cb)
5811// internally, and returns false if there's a lot of pending writes
5812// buffered up.  When you call read(), that calls _read(n) until
5813// there's enough pending readable data buffered up.
vendor: 7,897 bytes, lines 5814-6057
5814//
5815// In a transform stream, the written data is placed in a buffer.  When
5816// _read(n) is called, it transforms the queued up data, calling the
5817// buffered _write cb's as it consumes chunks.  If consuming a single
5818// written chunk would result in multiple output chunks, then the first
5819// outputted bit calls the readcb, and subsequent chunks just go into
5820// the read buffer, and will cause it to emit 'readable' if necessary.
5821//
5822// This way, back-pressure is actually determined by the reading side,
5823// since _read has to be called to start processing a new chunk.  However,
5824// a pathological inflate type of transform can cause excessive buffering
5825// here.  For example, imagine a stream where every byte of input is
5826// interpreted as an integer from 0-255, and then results in that many
5827// bytes of output.  Writing the 4 bytes {ff,ff,ff,ff} would result in
5828// 1kb of data being output.  In this case, you could write a very small
5829// amount of input, and end up with a very large amount of output.  In
5830// such a pathological inflating mechanism, there'd be no way to tell
5831// the system to stop doing the transform.  A single 4MB write could
5832// cause the system to run out of memory.
5833//
5834// However, even in such a pathological case, only a single written chunk
5835// would be consumed, and then the rest would wait (un-transformed) until
5836// the results of the previous transformed chunk were consumed.
5837
5838module.exports = Transform;
5839
5840var Duplex = require('./_stream_duplex');
5841
5842/*<replacement>*/
5843var util = require('core-util-is');
5844util.inherits = require('inherits');
5845/*</replacement>*/
5846
5847util.inherits(Transform, Duplex);
5848
5849
5850function TransformState(options, stream) {
5851  this.afterTransform = function(er, data) {
5852    return afterTransform(stream, er, data);
5853  };
5854
5855  this.needTransform = false;
5856  this.transforming = false;
5857  this.writecb = null;
5858  this.writechunk = null;
5859}
5860
5861function afterTransform(stream, er, data) {
5862  var ts = stream._transformState;
5863  ts.transforming = false;
5864
5865  var cb = ts.writecb;
5866
5867  if (!cb)
5868    return stream.emit('error', new Error('no writecb in Transform class'));
5869
5870  ts.writechunk = null;
5871  ts.writecb = null;
5872
5873  if (!util.isNullOrUndefined(data))
5874    stream.push(data);
5875
5876  if (cb)
5877    cb(er);
5878
5879  var rs = stream._readableState;
5880  rs.reading = false;
5881  if (rs.needReadable || rs.length < rs.highWaterMark) {
5882    stream._read(rs.highWaterMark);
5883  }
5884}
5885
5886
5887function Transform(options) {
5888  if (!(this instanceof Transform))
5889    return new Transform(options);
5890
5891  Duplex.call(this, options);
5892
5893  this._transformState = new TransformState(options, this);
5894
5895  // when the writable side finishes, then flush out anything remaining.
5896  var stream = this;
5897
5898  // start out asking for a readable event once data is transformed.
5899  this._readableState.needReadable = true;
5900
5901  // we have implemented the _read method, and done the other things
5902  // that Readable wants before the first _read call, so unset the
5903  // sync guard flag.
5904  this._readableState.sync = false;
5905
5906  this.once('prefinish', function() {
5907    if (util.isFunction(this._flush))
5908      this._flush(function(er) {
5909        done(stream, er);
5910      });
5911    else
5912      done(stream);
5913  });
5914}
5915
5916Transform.prototype.push = function(chunk, encoding) {
5917  this._transformState.needTransform = false;
5918  return Duplex.prototype.push.call(this, chunk, encoding);
5919};
5920
5921// This is the part where you do stuff!
5922// override this function in implementation classes.
5923// 'chunk' is an input chunk.
5924//
5925// Call `push(newChunk)` to pass along transformed output
5926// to the readable side.  You may call 'push' zero or more times.
5927//
5928// Call `cb(err)` when you are done with this chunk.  If you pass
5929// an error, then that'll put the hurt on the whole operation.  If you
5930// never call cb(), then you'll never get another chunk.
5931Transform.prototype._transform = function(chunk, encoding, cb) {
5932  throw new Error('not implemented');
5933};
5934
5935Transform.prototype._write = function(chunk, encoding, cb) {
5936  var ts = this._transformState;
5937  ts.writecb = cb;
5938  ts.writechunk = chunk;
5939  ts.writeencoding = encoding;
5940  if (!ts.transforming) {
5941    var rs = this._readableState;
5942    if (ts.needTransform ||
5943        rs.needReadable ||
5944        rs.length < rs.highWaterMark)
5945      this._read(rs.highWaterMark);
5946  }
5947};
5948
5949// Doesn't matter what the args are here.
5950// _transform does all the work.
5951// That we got here means that the readable side wants more data.
5952Transform.prototype._read = function(n) {
5953  var ts = this._transformState;
5954
5955  if (!util.isNull(ts.writechunk) && ts.writecb && !ts.transforming) {
5956    ts.transforming = true;
5957    this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
5958  } else {
5959    // mark that we need a transform, so that any data that comes in
5960    // will get processed, now that we've asked for it.
5961    ts.needTransform = true;
5962  }
5963};
5964
5965
5966function done(stream, er) {
5967  if (er)
5968    return stream.emit('error', er);
5969
5970  // if there's nothing in the write buffer, then that means
5971  // that nothing more will ever be provided
5972  var ws = stream._writableState;
5973  var ts = stream._transformState;
5974
5975  if (ws.length)
5976    throw new Error('calling transform done when ws.length != 0');
5977
5978  if (ts.transforming)
5979    throw new Error('calling transform done when still transforming');
5980
5981  return stream.push(null);
5982}
5983
5984},{"./_stream_duplex":16,"core-util-is":21,"inherits":12}],20:[function(require,module,exports){
5985(function (process){
5986// Copyright Joyent, Inc. and other Node contributors.
5987//
5988// Permission is hereby granted, free of charge, to any person obtaining a
5989// copy of this software and associated documentation files (the
5990// "Software"), to deal in the Software without restriction, including
5991// without limitation the rights to use, copy, modify, merge, publish,
5992// distribute, sublicense, and/or sell copies of the Software, and to permit
5993// persons to whom the Software is furnished to do so, subject to the
5994// following conditions:
5995//
5996// The above copyright notice and this permission notice shall be included
5997// in all copies or substantial portions of the Software.
5998//
5999// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
6000// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
6001// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
6002// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
6003// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
6004// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
6005// USE OR OTHER DEALINGS IN THE SOFTWARE.
6006
6007// A bit simpler than readable streams.
6008// Implement an async ._write(chunk, cb), and it'll handle all
6009// the drain event emission and buffering.
6010
6011module.exports = Writable;
6012
6013/*<replacement>*/
6014var Buffer = require('buffer').Buffer;
6015/*</replacement>*/
6016
6017Writable.WritableState = WritableState;
6018
6019
6020/*<replacement>*/
6021var util = require('core-util-is');
6022util.inherits = require('inherits');
6023/*</replacement>*/
6024
6025var Stream = require('stream');
6026
6027util.inherits(Writable, Stream);
6028
6029function WriteReq(chunk, encoding, cb) {
6030  this.chunk = chunk;
6031  this.encoding = encoding;
6032  this.callback = cb;
6033}
6034
6035function WritableState(options, stream) {
6036  var Duplex = require('./_stream_duplex');
6037
6038  options = options || {};
6039
6040  // the point at which write() starts returning false
6041  // Note: 0 is a valid value, means that we always return false if
6042  // the entire buffer is not flushed immediately on write()
6043  var hwm = options.highWaterMark;
6044  var defaultHwm = options.objectMode ? 16 : 16 * 1024;
6045  this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;
6046
6047  // object stream flag to indicate whether or not this stream
6048  // contains buffers or objects.
6049  this.objectMode = !!options.objectMode;
6050
6051  if (stream instanceof Duplex)
6052    this.objectMode = this.objectMode || !!options.writableObjectMode;
6053
6054  // cast to ints.
6055  this.highWaterMark = ~~this.highWaterMark;
6056
6057  this.needDrain = false;
6058  // at the start of calling end()
6059  this.ending = false;
6060  // when end() has been called, and returned
6061  this.ended = false;
6062  // when 'finish' is emitted
6063  this.finished = false;
6064
6065  // should we decode strings into buffers before passing to _write?
6066  // this is here so that some node-core streams can optimize string
6067  // handling at a lower level.
6068  var noDecode = options.decodeStrings === false;
6069  this.decodeStrings = !noDecode;
6070
6071  // Crypto is kind of old and crusty.  Historically, its default string
6072  // encoding is 'binary' so we have to make this configurable.
6073  // Everything else in the universe uses 'utf8', though.
6074  this.defaultEncoding = options.defaultEncoding || 'utf8';
6075
6076  // not an actual buffer we keep track of, but a measurement
6077  // of how much we're waiting to get pushed to some underlying
6078  // socket or file.
6079  this.length = 0;
6080
6081  // a flag to see when we're in the middle of a write.
6082  this.writing = false;
6083
6084  // when true all writes will be buffered until .uncork() call
6085  this.corked = 0;
6086
6087  // a flag to be able to tell if the onwrite cb is called immediately,
6088  // or on a later tick.  We set this to true at first, because any
6089  // actions that shouldn't happen until "later" should generally also
6090  // not happen before the first write call.
6091  this.sync = true;
6092
6093  // a flag to know if we're processing previously buffered items, which
6094  // may call the _write() callback in the same tick, so that we don't
6095  // end up in an overlapped onwrite situation.
6096  this.bufferProcessing = false;
6097
6098  // the callback that's passed to _write(chunk,cb)
6099  this.onwrite = function(er) {
6100    onwrite(stream, er);
6101  };
6102
6103  // the callback that the user supplies to write(chunk,encoding,cb)
6104  this.writecb = null;
6105
6106  // the amount that is being written when _write is called.
6107  this.writelen = 0;
6108
6109  this.buffer = [];
6110
6111  // number of pending user-supplied write callbacks
6112  // this must be 0 before 'finish' can be emitted
6113  this.pendingcb = 0;
6114
6115  // emit prefinish if the only thing we're waiting for is _write cbs
6116  // This is relevant for synchronous Transform streams
6117  this.prefinished = false;
6118
6119  // True if the error was already emitted and should not be thrown again
6120  this.errorEmitted = false;
6121}
6122
6123function Writable(options) {
6124  var Duplex = require
vendor: 8,293 bytes, lines 6124-6464
6124('./_stream_duplex');
6125
6126  // Writable ctor is applied to Duplexes, though they're not
6127  // instanceof Writable, they're instanceof Readable.
6128  if (!(this instanceof Writable) && !(this instanceof Duplex))
6129    return new Writable(options);
6130
6131  this._writableState = new WritableState(options, this);
6132
6133  // legacy.
6134  this.writable = true;
6135
6136  Stream.call(this);
6137}
6138
6139// Otherwise people can pipe Writable streams, which is just wrong.
6140Writable.prototype.pipe = function() {
6141  this.emit('error', new Error('Cannot pipe. Not readable.'));
6142};
6143
6144
6145function writeAfterEnd(stream, state, cb) {
6146  var er = new Error('write after end');
6147  // TODO: defer error events consistently everywhere, not just the cb
6148  stream.emit('error', er);
6149  process.nextTick(function() {
6150    cb(er);
6151  });
6152}
6153
6154// If we get something that is not a buffer, string, null, or undefined,
6155// and we're not in objectMode, then that's an error.
6156// Otherwise stream chunks are all considered to be of length=1, and the
6157// watermarks determine how many objects to keep in the buffer, rather than
6158// how many bytes or characters.
6159function validChunk(stream, state, chunk, cb) {
6160  var valid = true;
6161  if (!util.isBuffer(chunk) &&
6162      !util.isString(chunk) &&
6163      !util.isNullOrUndefined(chunk) &&
6164      !state.objectMode) {
6165    var er = new TypeError('Invalid non-string/buffer chunk');
6166    stream.emit('error', er);
6167    process.nextTick(function() {
6168      cb(er);
6169    });
6170    valid = false;
6171  }
6172  return valid;
6173}
6174
6175Writable.prototype.write = function(chunk, encoding, cb) {
6176  var state = this._writableState;
6177  var ret = false;
6178
6179  if (util.isFunction(encoding)) {
6180    cb = encoding;
6181    encoding = null;
6182  }
6183
6184  if (util.isBuffer(chunk))
6185    encoding = 'buffer';
6186  else if (!encoding)
6187    encoding = state.defaultEncoding;
6188
6189  if (!util.isFunction(cb))
6190    cb = function() {};
6191
6192  if (state.ended)
6193    writeAfterEnd(this, state, cb);
6194  else if (validChunk(this, state, chunk, cb)) {
6195    state.pendingcb++;
6196    ret = writeOrBuffer(this, state, chunk, encoding, cb);
6197  }
6198
6199  return ret;
6200};
6201
6202Writable.prototype.cork = function() {
6203  var state = this._writableState;
6204
6205  state.corked++;
6206};
6207
6208Writable.prototype.uncork = function() {
6209  var state = this._writableState;
6210
6211  if (state.corked) {
6212    state.corked--;
6213
6214    if (!state.writing &&
6215        !state.corked &&
6216        !state.finished &&
6217        !state.bufferProcessing &&
6218        state.buffer.length)
6219      clearBuffer(this, state);
6220  }
6221};
6222
6223function decodeChunk(state, chunk, encoding) {
6224  if (!state.objectMode &&
6225      state.decodeStrings !== false &&
6226      util.isString(chunk)) {
6227    chunk = new Buffer(chunk, encoding);
6228  }
6229  return chunk;
6230}
6231
6232// if we're already writing something, then just put this
6233// in the queue, and wait our turn.  Otherwise, call _write
6234// If we return false, then we need a drain event, so set that flag.
6235function writeOrBuffer(stream, state, chunk, encoding, cb) {
6236  chunk = decodeChunk(state, chunk, encoding);
6237  if (util.isBuffer(chunk))
6238    encoding = 'buffer';
6239  var len = state.objectMode ? 1 : chunk.length;
6240
6241  state.length += len;
6242
6243  var ret = state.length < state.highWaterMark;
6244  // we must ensure that previous needDrain will not be reset to false.
6245  if (!ret)
6246    state.needDrain = true;
6247
6248  if (state.writing || state.corked)
6249    state.buffer.push(new WriteReq(chunk, encoding, cb));
6250  else
6251    doWrite(stream, state, false, len, chunk, encoding, cb);
6252
6253  return ret;
6254}
6255
6256function doWrite(stream, state, writev, len, chunk, encoding, cb) {
6257  state.writelen = len;
6258  state.writecb = cb;
6259  state.writing = true;
6260  state.sync = true;
6261  if (writev)
6262    stream._writev(chunk, state.onwrite);
6263  else
6264    stream._write(chunk, encoding, state.onwrite);
6265  state.sync = false;
6266}
6267
6268function onwriteError(stream, state, sync, er, cb) {
6269  if (sync)
6270    process.nextTick(function() {
6271      state.pendingcb--;
6272      cb(er);
6273    });
6274  else {
6275    state.pendingcb--;
6276    cb(er);
6277  }
6278
6279  stream._writableState.errorEmitted = true;
6280  stream.emit('error', er);
6281}
6282
6283function onwriteStateUpdate(state) {
6284  state.writing = false;
6285  state.writecb = null;
6286  state.length -= state.writelen;
6287  state.writelen = 0;
6288}
6289
6290function onwrite(stream, er) {
6291  var state = stream._writableState;
6292  var sync = state.sync;
6293  var cb = state.writecb;
6294
6295  onwriteStateUpdate(state);
6296
6297  if (er)
6298    onwriteError(stream, state, sync, er, cb);
6299  else {
6300    // Check if we're actually ready to finish, but don't emit yet
6301    var finished = needFinish(stream, state);
6302
6303    if (!finished &&
6304        !state.corked &&
6305        !state.bufferProcessing &&
6306        state.buffer.length) {
6307      clearBuffer(stream, state);
6308    }
6309
6310    if (sync) {
6311      process.nextTick(function() {
6312        afterWrite(stream, state, finished, cb);
6313      });
6314    } else {
6315      afterWrite(stream, state, finished, cb);
6316    }
6317  }
6318}
6319
6320function afterWrite(stream, state, finished, cb) {
6321  if (!finished)
6322    onwriteDrain(stream, state);
6323  state.pendingcb--;
6324  cb();
6325  finishMaybe(stream, state);
6326}
6327
6328// Must force callback to be called on nextTick, so that we don't
6329// emit 'drain' before the write() consumer gets the 'false' return
6330// value, and has a chance to attach a 'drain' listener.
6331function onwriteDrain(stream, state) {
6332  if (state.length === 0 && state.needDrain) {
6333    state.needDrain = false;
6334    stream.emit('drain');
6335  }
6336}
6337
6338
6339// if there's something in the buffer waiting, then process it
6340function clearBuffer(stream, state) {
6341  state.bufferProcessing = true;
6342
6343  if (stream._writev && state.buffer.length > 1) {
6344    // Fast case, write everything using _writev()
6345    var cbs = [];
6346    for (var c = 0; c < state.buffer.length; c++)
6347      cbs.push(state.buffer[c].callback);
6348
6349    // count the one we are adding, as well.
6350    // TODO(isaacs) clean this up
6351    state.pendingcb++;
6352    doWrite(stream, state, true, state.length, state.buffer, '', function(err) {
6353      for (var i = 0; i < cbs.length; i++) {
6354        state.pendingcb--;
6355        cbs[i](err);
6356      }
6357    });
6358
6359    // Clear buffer
6360    state.buffer = [];
6361  } else {
6362    // Slow case, write chunks one-by-one
6363    for (var c = 0; c < state.buffer.length; c++) {
6364      var entry = state.buffer[c];
6365      var chunk = entry.chunk;
6366      var encoding = entry.encoding;
6367      var cb = entry.callback;
6368      var len = state.objectMode ? 1 : chunk.length;
6369
6370      doWrite(stream, state, false, len, chunk, encoding, cb);
6371
6372      // if we didn't call the onwrite immediately, then
6373      // it means that we need to wait until it does.
6374      // also, that means that the chunk and cb are currently
6375      // being processed, so move the buffer counter past them.
6376      if (state.writing) {
6377        c++;
6378        break;
6379      }
6380    }
6381
6382    if (c < state.buffer.length)
6383      state.buffer = state.buffer.slice(c);
6384    else
6385      state.buffer.length = 0;
6386  }
6387
6388  state.bufferProcessing = false;
6389}
6390
6391Writable.prototype._write = function(chunk, encoding, cb) {
6392  cb(new Error('not implemented'));
6393
6394};
6395
6396Writable.prototype._writev = null;
6397
6398Writable.prototype.end = function(chunk, encoding, cb) {
6399  var state = this._writableState;
6400
6401  if (util.isFunction(chunk)) {
6402    cb = chunk;
6403    chunk = null;
6404    encoding = null;
6405  } else if (util.isFunction(encoding)) {
6406    cb = encoding;
6407    encoding = null;
6408  }
6409
6410  if (!util.isNullOrUndefined(chunk))
6411    this.write(chunk, encoding);
6412
6413  // .end() fully uncorks
6414  if (state.corked) {
6415    state.corked = 1;
6416    this.uncork();
6417  }
6418
6419  // ignore unnecessary end() calls.
6420  if (!state.ending && !state.finished)
6421    endWritable(this, state, cb);
6422};
6423
6424
6425function needFinish(stream, state) {
6426  return (state.ending &&
6427          state.length === 0 &&
6428          !state.finished &&
6429          !state.writing);
6430}
6431
6432function prefinish(stream, state) {
6433  if (!state.prefinished) {
6434    state.prefinished = true;
6435    stream.emit('prefinish');
6436  }
6437}
6438
6439function finishMaybe(stream, state) {
6440  var need = needFinish(stream, state);
6441  if (need) {
6442    if (state.pendingcb === 0) {
6443      prefinish(stream, state);
6444      state.finished = true;
6445      stream.emit('finish');
6446    } else
6447      prefinish(stream, state);
6448  }
6449  return need;
6450}
6451
6452function endWritable(stream, state, cb) {
6453  state.ending = true;
6454  finishMaybe(stream, state);
6455  if (cb) {
6456    if (state.finished)
6457      process.nextTick(cb);
6458    else
6459      stream.once('finish', cb);
6460  }
6461  state.ended = true;
6462}
6463
6464}).call(this
vendor: 31,675 bytes, lines 6464-7531
6464,require('_process'))
6465},{"./_stream_duplex":16,"_process":14,"buffer":7,"core-util-is":21,"inherits":12,"stream":26}],21:[function(require,module,exports){
6466(function (Buffer){
6467// Copyright Joyent, Inc. and other Node contributors.
6468//
6469// Permission is hereby granted, free of charge, to any person obtaining a
6470// copy of this software and associated documentation files (the
6471// "Software"), to deal in the Software without restriction, including
6472// without limitation the rights to use, copy, modify, merge, publish,
6473// distribute, sublicense, and/or sell copies of the Software, and to permit
6474// persons to whom the Software is furnished to do so, subject to the
6475// following conditions:
6476//
6477// The above copyright notice and this permission notice shall be included
6478// in all copies or substantial portions of the Software.
6479//
6480// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
6481// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
6482// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
6483// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
6484// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
6485// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
6486// USE OR OTHER DEALINGS IN THE SOFTWARE.
6487
6488// NOTE: These type checking functions intentionally don't use `instanceof`
6489// because it is fragile and can be easily faked with `Object.create()`.
6490function isArray(ar) {
6491  return Array.isArray(ar);
6492}
6493exports.isArray = isArray;
6494
6495function isBoolean(arg) {
6496  return typeof arg === 'boolean';
6497}
6498exports.isBoolean = isBoolean;
6499
6500function isNull(arg) {
6501  return arg === null;
6502}
6503exports.isNull = isNull;
6504
6505function isNullOrUndefined(arg) {
6506  return arg == null;
6507}
6508exports.isNullOrUndefined = isNullOrUndefined;
6509
6510function isNumber(arg) {
6511  return typeof arg === 'number';
6512}
6513exports.isNumber = isNumber;
6514
6515function isString(arg) {
6516  return typeof arg === 'string';
6517}
6518exports.isString = isString;
6519
6520function isSymbol(arg) {
6521  return typeof arg === 'symbol';
6522}
6523exports.isSymbol = isSymbol;
6524
6525function isUndefined(arg) {
6526  return arg === void 0;
6527}
6528exports.isUndefined = isUndefined;
6529
6530function isRegExp(re) {
6531  return isObject(re) && objectToString(re) === '[object RegExp]';
6532}
6533exports.isRegExp = isRegExp;
6534
6535function isObject(arg) {
6536  return typeof arg === 'object' && arg !== null;
6537}
6538exports.isObject = isObject;
6539
6540function isDate(d) {
6541  return isObject(d) && objectToString(d) === '[object Date]';
6542}
6543exports.isDate = isDate;
6544
6545function isError(e) {
6546  return isObject(e) &&
6547      (objectToString(e) === '[object Error]' || e instanceof Error);
6548}
6549exports.isError = isError;
6550
6551function isFunction(arg) {
6552  return typeof arg === 'function';
6553}
6554exports.isFunction = isFunction;
6555
6556function isPrimitive(arg) {
6557  return arg === null ||
6558         typeof arg === 'boolean' ||
6559         typeof arg === 'number' ||
6560         typeof arg === 'string' ||
6561         typeof arg === 'symbol' ||  // ES6 symbol
6562         typeof arg === 'undefined';
6563}
6564exports.isPrimitive = isPrimitive;
6565
6566function isBuffer(arg) {
6567  return Buffer.isBuffer(arg);
6568}
6569exports.isBuffer = isBuffer;
6570
6571function objectToString(o) {
6572  return Object.prototype.toString.call(o);
6573}
6574}).call(this,require("buffer").Buffer)
6575},{"buffer":7}],22:[function(require,module,exports){
6576module.exports = require("./lib/_stream_passthrough.js")
6577
6578},{"./lib/_stream_passthrough.js":17}],23:[function(require,module,exports){
6579exports = module.exports = require('./lib/_stream_readable.js');
6580exports.Stream = require('stream');
6581exports.Readable = exports;
6582exports.Writable = require('./lib/_stream_writable.js');
6583exports.Duplex = require('./lib/_stream_duplex.js');
6584exports.Transform = require('./lib/_stream_transform.js');
6585exports.PassThrough = require('./lib/_stream_passthrough.js');
6586
6587},{"./lib/_stream_duplex.js":16,"./lib/_stream_passthrough.js":17,"./lib/_stream_readable.js":18,"./lib/_stream_transform.js":19,"./lib/_stream_writable.js":20,"stream":26}],24:[function(require,module,exports){
6588module.exports = require("./lib/_stream_transform.js")
6589
6590},{"./lib/_stream_transform.js":19}],25:[function(require,module,exports){
6591module.exports = require("./lib/_stream_writable.js")
6592
6593},{"./lib/_stream_writable.js":20}],26:[function(require,module,exports){
6594// Copyright Joyent, Inc. and other Node contributors.
6595//
6596// Permission is hereby granted, free of charge, to any person obtaining a
6597// copy of this software and associated documentation files (the
6598// "Software"), to deal in the Software without restriction, including
6599// without limitation the rights to use, copy, modify, merge, publish,
6600// distribute, sublicense, and/or sell copies of the Software, and to permit
6601// persons to whom the Software is furnished to do so, subject to the
6602// following conditions:
6603//
6604// The above copyright notice and this permission notice shall be included
6605// in all copies or substantial portions of the Software.
6606//
6607// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
6608// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
6609// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
6610// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
6611// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
6612// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
6613// USE OR OTHER DEALINGS IN THE SOFTWARE.
6614
6615module.exports = Stream;
6616
6617var EE = require('events').EventEmitter;
6618var inherits = require('inherits');
6619
6620inherits(Stream, EE);
6621Stream.Readable = require('readable-stream/readable.js');
6622Stream.Writable = require('readable-stream/writable.js');
6623Stream.Duplex = require('readable-stream/duplex.js');
6624Stream.Transform = require('readable-stream/transform.js');
6625Stream.PassThrough = require('readable-stream/passthrough.js');
6626
6627// Backwards-compat with node 0.4.x
6628Stream.Stream = Stream;
6629
6630
6631
6632// old-style streams.  Note that the pipe method (the only relevant
6633// part of this class) is overridden in the Readable class.
6634
6635function Stream() {
6636  EE.call(this);
6637}
6638
6639Stream.prototype.pipe = function(dest, options) {
6640  var source = this;
6641
6642  function ondata(chunk) {
6643    if (dest.writable) {
6644      if (false === dest.write(chunk) && source.pause) {
6645        source.pause();
6646      }
6647    }
6648  }
6649
6650  source.on('data', ondata);
6651
6652  function ondrain() {
6653    if (source.readable && source.resume) {
6654      source.resume();
6655    }
6656  }
6657
6658  dest.on('drain', ondrain);
6659
6660  // If the 'end' option is not supplied, dest.end() will be called when
6661  // source gets the 'end' or 'close' events.  Only dest.end() once.
6662  if (!dest._isStdio && (!options || options.end !== false)) {
6663    source.on('end', onend);
6664    source.on('close', onclose);
6665  }
6666
6667  var didOnEnd = false;
6668  function onend() {
6669    if (didOnEnd) return;
6670    didOnEnd = true;
6671
6672    dest.end();
6673  }
6674
6675
6676  function onclose() {
6677    if (didOnEnd) return;
6678    didOnEnd = true;
6679
6680    if (typeof dest.destroy === 'function') dest.destroy();
6681  }
6682
6683  // don't leave dangling pipes when there are errors.
6684  function onerror(er) {
6685    cleanup();
6686    if (EE.listenerCount(this, 'error') === 0) {
6687      throw er; // Unhandled stream error in pipe.
6688    }
6689  }
6690
6691  source.on('error', onerror);
6692  dest.on('error', onerror);
6693
6694  // remove all the event listeners that were added.
6695  function cleanup() {
6696    source.removeListener('data', ondata);
6697    dest.removeListener('drain', ondrain);
6698
6699    source.removeListener('end', onend);
6700    source.removeListener('close', onclose);
6701
6702    source.removeListener('error', onerror);
6703    dest.removeListener('error', onerror);
6704
6705    source.removeListener('end', cleanup);
6706    source.removeListener('close', cleanup);
6707
6708    dest.removeListener('close', cleanup);
6709  }
6710
6711  source.on('end', cleanup);
6712  source.on('close', cleanup);
6713
6714  dest.on('close', cleanup);
6715
6716  dest.emit('pipe', source);
6717
6718  // Allow for unix-like usage: A.pipe(B).pipe(C)
6719  return dest;
6720};
6721
6722},{"events":11,"inherits":12,"readable-stream/duplex.js":15,"readable-stream/passthrough.js":22,"readable-stream/readable.js":23,"readable-stream/transform.js":24,"readable-stream/writable.js":25}],27:[function(require,module,exports){
6723// Copyright Joyent, Inc. and other Node contributors.
6724//
6725// Permission is hereby granted, free of charge, to any person obtaining a
6726// copy of this software and associated documentation files (the
6727// "Software"), to deal in the Software without restriction, including
6728// without limitation the rights to use, copy, modify, merge, publish,
6729// distribute, sublicense, and/or sell copies of the Software, and to permit
6730// persons to whom the Software is furnished to do so, subject to the
6731// following conditions:
6732//
6733// The above copyright notice and this permission notice shall be included
6734// in all copies or substantial portions of the Software.
6735//
6736// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
6737// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
6738// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
6739// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
6740// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
6741// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
6742// USE OR OTHER DEALINGS IN THE SOFTWARE.
6743
6744var Buffer = require('buffer').Buffer;
6745
6746var isBufferEncoding = Buffer.isEncoding
6747  || function(encoding) {
6748       switch (encoding && encoding.toLowerCase()) {
6749         case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true;
6750         default: return false;
6751       }
6752     }
6753
6754
6755function assertEncoding(encoding) {
6756  if (encoding && !isBufferEncoding(encoding)) {
6757    throw new Error('Unknown encoding: ' + encoding);
6758  }
6759}
6760
6761// StringDecoder provides an interface for efficiently splitting a series of
6762// buffers into a series of JS strings without breaking apart multi-byte
6763// characters. CESU-8 is handled as part of the UTF-8 encoding.
6764//
6765// @TODO Handling all encodings inside a single object makes it very difficult
6766// to reason about this code, so it should be split up in the future.
6767// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code
6768// points as used by CESU-8.
6769var StringDecoder = exports.StringDecoder = function(encoding) {
6770  this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, '');
6771  assertEncoding(encoding);
6772  switch (this.encoding) {
6773    case 'utf8':
6774      // CESU-8 represents each of Surrogate Pair by 3-bytes
6775      this.surrogateSize = 3;
6776      break;
6777    case 'ucs2':
6778    case 'utf16le':
6779      // UTF-16 represents each of Surrogate Pair by 2-bytes
6780      this.surrogateSize = 2;
6781      this.detectIncompleteChar = utf16DetectIncompleteChar;
6782      break;
6783    case 'base64':
6784      // Base-64 stores 3 bytes in 4 chars, and pads the remainder.
6785      this.surrogateSize = 3;
6786      this.detectIncompleteChar = base64DetectIncompleteChar;
6787      break;
6788    default:
6789      this.write = passThroughWrite;
6790      return;
6791  }
6792
6793  // Enough space to store all bytes of a single character. UTF-8 needs 4
6794  // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate).
6795  this.charBuffer = new Buffer(6);
6796  // Number of bytes received for the current incomplete multi-byte character.
6797  this.charReceived = 0;
6798  // Number of bytes expected for the current incomplete multi-byte character.
6799  this.charLength = 0;
6800};
6801
6802
6803// write decodes the given buffer and returns it as JS string that is
6804// guaranteed to not contain any partial multi-byte characters. Any partial
6805// character found at the end of the buffer is buffered up, and will be
6806// returned when calling write again with the remaining bytes.
6807//
6808// Note: Converting a Buffer containing an orphan surrogate to a String
6809// currently works, but converting a String to a Buffer (via `new Buffer`, or
6810// Buffer#write) will replace incomplete surrogates with the unicode
6811// replacement character. See https://codereview.chromium.org/121173009/ .
6812StringDecoder.prototype.write = function(buffer) {
6813  var charStr = '';
6814  // if our last write ended with an incomplete multibyte character
6815  while (this.charLength) {
6816    // determine how many remaining bytes this buffer has to offer for this char
6817    var available = (buffer.length >= this.charLength - this.charReceived) ?
6818        this.charLength - this.charReceived :
6819        buffer.length;
6820
6821    // add the new bytes to the char buffer
6822    buffer.copy(this.charBuffer, this.charReceived, 0, available);
6823    this.charReceived += available;
6824
6825    if (this.charReceived < this.charLength) {
6826      // still not enough chars in this buffer? wait for more ...
6827      return '';
6828    }
6829
6830    // remove bytes belonging to the current character from the buffer
6831    buffer = buffer.slice(available, buffer.length);
6832
6833    // get the character that was split
6834    charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding);
6835
6836    // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
6837    var charCode = charStr.charCodeAt(charStr.length - 1);
6838    if (charCode >= 0xD800 && charCode <= 0xDBFF) {
6839      this.charLength += this.surrogateSize;
6840      charStr = '';
6841      continue;
6842    }
6843    this.charReceived = this.charLength = 0;
6844
6845    // if there are no more bytes in this buffer, just emit our char
6846    if (buffer.length === 0) {
6847      return charStr;
6848    }
6849    break;
6850  }
6851
6852  // determine and set charLength / charReceived
6853  this.detectIncompleteChar(buffer);
6854
6855  var end = buffer.length;
6856  if (this.charLength) {
6857    // buffer the incomplete character bytes we got
6858    buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end);
6859    end -= this.charReceived;
6860  }
6861
6862  charStr += buffer.toString(this.encoding, 0, end);
6863
6864  var end = charStr.length - 1;
6865  var charCode = charStr.charCodeAt(end);
6866  // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
6867  if (charCode >= 0xD800 && charCode <= 0xDBFF) {
6868    var size = this.surrogateSize;
6869    this.charLength += size;
6870    this.charReceived += size;
6871    this.charBuffer.copy(this.charBuffer, size, 0, size);
6872    buffer.copy(this.charBuffer, 0, 0, size);
6873    return charStr.substring(0, end);
6874  }
6875
6876  // or just emit the charStr
6877  return charStr;
6878};
6879
6880// detectIncompleteChar determines if there is an incomplete UTF-8 character at
6881// the end of the given buffer. If so, it sets this.charLength to the byte
6882// length that character, and sets this.charReceived to the number of bytes
6883// that are available for this character.
6884StringDecoder.prototype.detectIncompleteChar = function(buffer) {
6885  // determine how many bytes we have to check at the end of this buffer
6886  var i = (buffer.length >= 3) ? 3 : buffer.length;
6887
6888  // Figure out if one of the last i bytes of our buffer announces an
6889  // incomplete char.
6890  for (; i > 0; i--) {
6891    var c = buffer[buffer.length - i];
6892
6893    // See http://en.wikipedia.org/wiki/UTF-8#Description
6894
6895    // 110XXXXX
6896    if (i == 1 && c >> 5 == 0x06) {
6897      this.charLength = 2;
6898      break;
6899    }
6900
6901    // 1110XXXX
6902    if (i <= 2 && c >> 4 == 0x0E) {
6903      this.charLength = 3;
6904      break;
6905    }
6906
6907    // 11110XXX
6908    if (i <= 3 && c >> 3 == 0x1E) {
6909      this.charLength = 4;
6910      break;
6911    }
6912  }
6913  this.charReceived = i;
6914};
6915
6916StringDecoder.prototype.end = function(buffer) {
6917  var res = '';
6918  if (buffer && buffer.length)
6919    res = this.write(buffer);
6920
6921  if (this.charReceived) {
6922    var cr = this.charReceived;
6923    var buf = this.charBuffer;
6924    var enc = this.encoding;
6925    res += buf.slice(0, cr).toString(enc);
6926  }
6927
6928  return res;
6929};
6930
6931function passThroughWrite(buffer) {
6932  return buffer.toString(this.encoding);
6933}
6934
6935function utf16DetectIncompleteChar(buffer) {
6936  this.charReceived = buffer.length % 2;
6937  this.charLength = this.charReceived ? 2 : 0;
6938}
6939
6940function base64DetectIncompleteChar(buffer) {
6941  this.charReceived = buffer.length % 3;
6942  this.charLength = this.charReceived ? 3 : 0;
6943}
6944
6945},{"buffer":7}],28:[function(require,module,exports){
6946module.exports = function isBuffer(arg) {
6947  return arg && typeof arg === 'object'
6948    && typeof arg.copy === 'function'
6949    && typeof arg.fill === 'function'
6950    && typeof arg.readUInt8 === 'function';
6951}
6952},{}],29:[function(require,module,exports){
6953(function (process,global){
6954// Copyright Joyent, Inc. and other Node contributors.
6955//
6956// Permission is hereby granted, free of charge, to any person obtaining a
6957// copy of this software and associated documentation files (the
6958// "Software"), to deal in the Software without restriction, including
6959// without limitation the rights to use, copy, modify, merge, publish,
6960// distribute, sublicense, and/or sell copies of the Software, and to permit
6961// persons to whom the Software is furnished to do so, subject to the
6962// following conditions:
6963//
6964// The above copyright notice and this permission notice shall be included
6965// in all copies or substantial portions of the Software.
6966//
6967// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
6968// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
6969// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
6970// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
6971// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
6972// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
6973// USE OR OTHER DEALINGS IN THE SOFTWARE.
6974
6975var formatRegExp = /%[sdj%]/g;
6976exports.format = function(f) {
6977  if (!isString(f)) {
6978    var objects = [];
6979    for (var i = 0; i < arguments.length; i++) {
6980      objects.push(inspect(arguments[i]));
6981    }
6982    return objects.join(' ');
6983  }
6984
6985  var i = 1;
6986  var args = arguments;
6987  var len = args.length;
6988  var str = String(f).replace(formatRegExp, function(x) {
6989    if (x === '%%') return '%';
6990    if (i >= len) return x;
6991    switch (x) {
6992      case '%s': return String(args[i++]);
6993      case '%d': return Number(args[i++]);
6994      case '%j':
6995        try {
6996          return JSON.stringify(args[i++]);
6997        } catch (_) {
6998          return '[Circular]';
6999        }
7000      default:
7001        return x;
7002    }
7003  });
7004  for (var x = args[i]; i < len; x = args[++i]) {
7005    if (isNull(x) || !isObject(x)) {
7006      str += ' ' + x;
7007    } else {
7008      str += ' ' + inspect(x);
7009    }
7010  }
7011  return str;
7012};
7013
7014
7015// Mark that a method should not be used.
7016// Returns a modified function which warns once by default.
7017// If --no-deprecation is set, then it is a no-op.
7018exports.deprecate = function(fn, msg) {
7019  // Allow for deprecating things in the process of starting up.
7020  if (isUndefined(global.process)) {
7021    return function() {
7022      return exports.deprecate(fn, msg).apply(this, arguments);
7023    };
7024  }
7025
7026  if (process.noDeprecation === true) {
7027    return fn;
7028  }
7029
7030  var warned = false;
7031  function deprecated() {
7032    if (!warned) {
7033      if (process.throwDeprecation) {
7034        throw new Error(msg);
7035      } else if (process.traceDeprecation) {
7036        console.trace(msg);
7037      } else {
7038        console.error(msg);
7039      }
7040      warned = true;
7041    }
7042    return fn.apply(this, arguments);
7043  }
7044
7045  return deprecated;
7046};
7047
7048
7049var debugs = {};
7050var debugEnviron;
7051exports.debuglog = function(set) {
7052  if (isUndefined(debugEnviron))
7053    debugEnviron = process.env.NODE_DEBUG || '';
7054  set = set.toUpperCase();
7055  if (!debugs[set]) {
7056    if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
7057      var pid = process.pid;
7058      debugs[set] = function() {
7059        var msg = exports.format.apply(exports, arguments);
7060        console.error('%s %d: %s', set, pid, msg);
7061      };
7062    } else {
7063      debugs[set] = function() {};
7064    }
7065  }
7066  return debugs[set];
7067};
7068
7069
7070/**
7071 * Echos the value of a value. Trys to print the value out
7072 * in the best way possible given the different types.
7073 *
7074 * @param {Object} obj The object to print out.
7075 * @param {Object} opts Optional options object that alters the output.
7076 */
7077/* legacy: obj, showHidden, depth, colors*/
7078function inspect(obj, opts) {
7079  // default options
7080  var ctx = {
7081    seen: [],
7082    stylize: stylizeNoColor
7083  };
7084  // legacy...
7085  if (arguments.length >= 3) ctx.depth = arguments[2];
7086  if (arguments.length >= 4) ctx.colors = arguments[3];
7087  if (isBoolean(opts)) {
7088    // legacy...
7089    ctx.showHidden = opts;
7090  } else if (opts) {
7091    // got an "options" object
7092    exports._extend(ctx, opts);
7093  }
7094  // set default options
7095  if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
7096  if (isUndefined(ctx.depth)) ctx.depth = 2;
7097  if (isUndefined(ctx.colors)) ctx.colors = false;
7098  if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
7099  if (ctx.colors) ctx.stylize = stylizeWithColor;
7100  return formatValue(ctx, obj, ctx.depth);
7101}
7102exports.inspect = inspect;
7103
7104
7105// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
7106inspect.colors = {
7107  'bold' : [1, 22],
7108  'italic' : [3, 23],
7109  'underline' : [4, 24],
7110  'inverse' : [7, 27],
7111  'white' : [37, 39],
7112  'grey' : [90, 39],
7113  'black' : [30, 39],
7114  'blue' : [34, 39],
7115  'cyan' : [36, 39],
7116  'green' : [32, 39],
7117  'magenta' : [35, 39],
7118  'red' : [31, 39],
7119  'yellow' : [33, 39]
7120};
7121
7122// Don't use 'blue' not visible on cmd.exe
7123inspect.styles = {
7124  'special': 'cyan',
7125  'number': 'yellow',
7126  'boolean': 'yellow',
7127  'undefined': 'grey',
7128  'null': 'bold',
7129  'string': 'green',
7130  'date': 'magenta',
7131  // "name": intentionally not styling
7132  'regexp': 'red'
7133};
7134
7135
7136function stylizeWithColor(str, styleType) {
7137  var style = inspect.styles[styleType];
7138
7139  if (style) {
7140    return '\u001b[' + inspect.colors[style][0] + 'm' + str +
7141           '\u001b[' + inspect.colors[style][1] + 'm';
7142  } else {
7143    return str;
7144  }
7145}
7146
7147
7148function stylizeNoColor(str, styleType) {
7149  return str;
7150}
7151
7152
7153function arrayToHash(array) {
7154  var hash = {};
7155
7156  array.forEach(function(val, idx) {
7157    hash[val] = true;
7158  });
7159
7160  return hash;
7161}
7162
7163
7164function formatValue(ctx, value, recurseTimes) {
7165  // Provide a hook for user-specified inspect functions.
7166  // Check that value is an object with an inspect function on it
7167  if (ctx.customInspect &&
7168      value &&
7169      isFunction(value.inspect) &&
7170      // Filter out the util module, it's inspect function is special
7171      value.inspect !== exports.inspect &&
7172      // Also filter out any prototype objects using the circular check.
7173      !(value.constructor && value.constructor.prototype === value)) {
7174    var ret = value.inspect(recurseTimes, ctx);
7175    if (!isString(ret)) {
7176      ret = formatValue(ctx, ret, recurseTimes);
7177    }
7178    return ret;
7179  }
7180
7181  // Primitive types cannot have properties
7182  var primitive = formatPrimitive(ctx, value);
7183  if (primitive) {
7184    return primitive;
7185  }
7186
7187  // Look up the keys of the object.
7188  var keys = Object.keys(value);
7189  var visibleKeys = arrayToHash(keys);
7190
7191  if (ctx.showHidden) {
7192    keys = Object.getOwnPropertyNames(value);
7193  }
7194
7195  // IE doesn't make error fields non-enumerable
7196  // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
7197  if (isError(value)
7198      && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
7199    return formatError(value);
7200  }
7201
7202  // Some type of object without properties can be shortcutted.
7203  if (keys.length === 0) {
7204    if (isFunction(value)) {
7205      var name = value.name ? ': ' + value.name : '';
7206      return ctx.stylize('[Function' + name + ']', 'special');
7207    }
7208    if (isRegExp(value)) {
7209      return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
7210    }
7211    if (isDate(value)) {
7212      return ctx.stylize(Date.prototype.toString.call(value), 'date');
7213    }
7214    if (isError(value)) {
7215      return formatError(value);
7216    }
7217  }
7218
7219  var base = '', array = false, braces = ['{', '}'];
7220
7221  // Make Array say that they are Array
7222  if (isArray(value)) {
7223    array = true;
7224    braces = ['[', ']'];
7225  }
7226
7227  // Make functions say that they are functions
7228  if (isFunction(value)) {
7229    var n = value.name ? ': ' + value.name : '';
7230    base = ' [Function' + n + ']';
7231  }
7232
7233  // Make RegExps say that they are RegExps
7234  if (isRegExp(value)) {
7235    base = ' ' + RegExp.prototype.toString.call(value);
7236  }
7237
7238  // Make dates with properties first say the date
7239  if (isDate(value)) {
7240    base = ' ' + Date.prototype.toUTCString.call(value);
7241  }
7242
7243  // Make error with message first say the error
7244  if (isError(value)) {
7245    base = ' ' + formatError(value);
7246  }
7247
7248  if (keys.length === 0 && (!array || value.length == 0)) {
7249    return braces[0] + base + braces[1];
7250  }
7251
7252  if (recurseTimes < 0) {
7253    if (isRegExp(value)) {
7254      return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
7255    } else {
7256      return ctx.stylize('[Object]', 'special');
7257    }
7258  }
7259
7260  ctx.seen.push(value);
7261
7262  var output;
7263  if (array) {
7264    output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
7265  } else {
7266    output = keys.map(function(key) {
7267      return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
7268    });
7269  }
7270
7271  ctx.seen.pop();
7272
7273  return reduceToSingleString(output, base, braces);
7274}
7275
7276
7277function formatPrimitive(ctx, value) {
7278  if (isUndefined(value))
7279    return ctx.stylize('undefined', 'undefined');
7280  if (isString(value)) {
7281    var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
7282                                             .replace(/'/g, "\\'")
7283                                             .replace(/\\"/g, '"') + '\'';
7284    return ctx.stylize(simple, 'string');
7285  }
7286  if (isNumber(value))
7287    return ctx.stylize('' + value, 'number');
7288  if (isBoolean(value))
7289    return ctx.stylize('' + value, 'boolean');
7290  // For some reason typeof null is "object", so special case here.
7291  if (isNull(value))
7292    return ctx.stylize('null', 'null');
7293}
7294
7295
7296function formatError(value) {
7297  return '[' + Error.prototype.toString.call(value) + ']';
7298}
7299
7300
7301function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
7302  var output = [];
7303  for (var i = 0, l = value.length; i < l; ++i) {
7304    if (hasOwnProperty(value, String(i))) {
7305      output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
7306          String(i), true));
7307    } else {
7308      output.push('');
7309    }
7310  }
7311  keys.forEach(function(key) {
7312    if (!key.match(/^\d+$/)) {
7313      output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
7314          key, true));
7315    }
7316  });
7317  return output;
7318}
7319
7320
7321function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
7322  var name, str, desc;
7323  desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
7324  if (desc.get) {
7325    if (desc.set) {
7326      str = ctx.stylize('[Getter/Setter]', 'special');
7327    } else {
7328      str = ctx.stylize('[Getter]', 'special');
7329    }
7330  } else {
7331    if (desc.set) {
7332      str = ctx.stylize('[Setter]', 'special');
7333    }
7334  }
7335  if (!hasOwnProperty(visibleKeys, key)) {
7336    name = '[' + key + ']';
7337  }
7338  if (!str) {
7339    if (ctx.seen.indexOf(desc.value) < 0) {
7340      if (isNull(recurseTimes)) {
7341        str = formatValue(ctx, desc.value, null);
7342      } else {
7343        str = formatValue(ctx, desc.value, recurseTimes - 1);
7344      }
7345      if (str.indexOf('\n') > -1) {
7346        if (array) {
7347          str = str.split('\n').map(function(line) {
7348            return '  ' + line;
7349          }).join('\n').substr(2);
7350        } else {
7351          str = '\n' + str.split('\n').map(function(line) {
7352            return '   ' + line;
7353          }).join('\n');
7354        }
7355      }
7356    } else {
7357      str = ctx.stylize('[Circular]', 'special');
7358    }
7359  }
7360  if (isUndefined(name)) {
7361    if (array && key.match(/^\d+$/)) {
7362      return str;
7363    }
7364    name = JSON.stringify('' + key);
7365    if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
7366      name = name.substr(1, name.length - 2);
7367      name = ctx.stylize(name, 'name');
7368    } else {
7369      name = name.replace(/'/g, "\\'")
7370                 .replace(/\\"/g, '"')
7371                 .replace(/(^"|"$)/g, "'");
7372      name = ctx.stylize(name, 'string');
7373    }
7374  }
7375
7376  return name + ': ' + str;
7377}
7378
7379
7380function reduceToSingleString(output, base, braces) {
7381  var numLinesEst = 0;
7382  var length = output.reduce(function(prev, cur) {
7383    numLinesEst++;
7384    if (cur.indexOf('\n') >= 0) numLinesEst++;
7385    return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
7386  }, 0);
7387
7388  if (length > 60) {
7389    return braces[0] +
7390           (base === '' ? '' : base + '\n ') +
7391           ' ' +
7392           output.join(',\n  ') +
7393           ' ' +
7394           braces[1];
7395  }
7396
7397  return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
7398}
7399
7400
7401// NOTE: These type checking functions intentionally don't use `instanceof`
7402// because it is fragile and can be easily faked with `Object.create()`.
7403function isArray(ar) {
7404  return Array.isArray(ar);
7405}
7406exports.isArray = isArray;
7407
7408function isBoolean(arg) {
7409  return typeof arg === 'boolean';
7410}
7411exports.isBoolean = isBoolean;
7412
7413function isNull(arg) {
7414  return arg === null;
7415}
7416exports.isNull = isNull;
7417
7418function isNullOrUndefined(arg) {
7419  return arg == null;
7420}
7421exports.isNullOrUndefined = isNullOrUndefined;
7422
7423function isNumber(arg) {
7424  return typeof arg === 'number';
7425}
7426exports.isNumber = isNumber;
7427
7428function isString(arg) {
7429  return typeof arg === 'string';
7430}
7431exports.isString = isString;
7432
7433function isSymbol(arg) {
7434  return typeof arg === 'symbol';
7435}
7436exports.isSymbol = isSymbol;
7437
7438function isUndefined(arg) {
7439  return arg === void 0;
7440}
7441exports.isUndefined = isUndefined;
7442
7443function isRegExp(re) {
7444  return isObject(re) && objectToString(re) === '[object RegExp]';
7445}
7446exports.isRegExp = isRegExp;
7447
7448function isObject(arg) {
7449  return typeof arg === 'object' && arg !== null;
7450}
7451exports.isObject = isObject;
7452
7453function isDate(d) {
7454  return isObject(d) && objectToString(d) === '[object Date]';
7455}
7456exports.isDate = isDate;
7457
7458function isError(e) {
7459  return isObject(e) &&
7460      (objectToString(e) === '[object Error]' || e instanceof Error);
7461}
7462exports.isError = isError;
7463
7464function isFunction(arg) {
7465  return typeof arg === 'function';
7466}
7467exports.isFunction = isFunction;
7468
7469function isPrimitive(arg) {
7470  return arg === null ||
7471         typeof arg === 'boolean' ||
7472         typeof arg === 'number' ||
7473         typeof arg === 'string' ||
7474         typeof arg === 'symbol' ||  // ES6 symbol
7475         typeof arg === 'undefined';
7476}
7477exports.isPrimitive = isPrimitive;
7478
7479exports.isBuffer = require('./support/isBuffer');
7480
7481function objectToString(o) {
7482  return Object.prototype.toString.call(o);
7483}
7484
7485
7486function pad(n) {
7487  return n < 10 ? '0' + n.toString(10) : n.toString(10);
7488}
7489
7490
7491var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
7492              'Oct', 'Nov', 'Dec'];
7493
7494// 26 Feb 16:19:34
7495function timestamp() {
7496  var d = new Date();
7497  var time = [pad(d.getHours()),
7498              pad(d.getMinutes()),
7499              pad(d.getSeconds())].join(':');
7500  return [d.getDate(), months[d.getMonth()], time].join(' ');
7501}
7502
7503
7504// log is just a thin wrapper to console.log that prepends a timestamp
7505exports.log = function() {
7506  console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
7507};
7508
7509
7510/**
7511 * Inherit the prototype methods from one constructor into another.
7512 *
7513 * The Function.prototype.inherits from lang.js rewritten as a standalone
7514 * function (not on Function.prototype). NOTE: If this file is to be loaded
7515 * during bootstrapping this function needs to be rewritten using some native
7516 * functions as prototype setup using normal JavaScript does not work as
7517 * expected during bootstrapping (see mirror.js in r114903).
7518 *
7519 * @param {function} ctor Constructor function which needs to inherit the
7520 *     prototype.
7521 * @param {function} superCtor Constructor function to inherit prototype from.
7522 */
7523exports.inherits = require('inherits');
7524
7525exports._extend = function(origin, add) {
7526  // Don't do anything if add isn't an object
7527  if (!add || !isObject(add)) return origin;
7528
7529  var keys = Object.keys(add);
7530  var i = keys.length;
7531  while (i--) {
7532    origin[keys[i]] = add[keys[i]];
7533  }
7534  return origin;
7535};
7536
7537function hasOwnProperty(obj, prop) {
7538  return Object.prototype.hasOwnProperty.call(obj, prop);
7539}
7540
7541}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
7542},{"./support/isBuffer":28,"_process":14,"inherits":12}],30:[function(require,module,exports){
7543// Base58 encoding/decoding
7544// Originally written by Mike Hearn for BitcoinJ
7545// Copyright (c) 2011 Google Inc
7546// Ported to JavaScript by Stefan Thomas
7547// Merged Buffer refactorings from base58-native by Stephen Pair
7548// Copyright (c) 2013 BitPay Inc
7549
7550var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
7551var ALPHABET_MAP = {}
7552for(var i = 0; i < ALPHABET.length; i++) {
7553  ALPHABET_MAP[ALPHABET.charAt(i)] = i
7554}
7555var BASE = 58
7556
7557function encode(buffer) {
7558  if (buffer.length === 0) return ''
7559
7560  var i, j, digits = [0]
7561  for (i = 0; i < buffer.length; i++) {
7562    for (j = 0; j < digits.length; j++) digits[j] <<= 8
7563
7564    digits[0] += buffer[i]
7565
7566    var carry = 0
7567    for (j = 0; j < digits.length; ++j) {
7568      digits[j] += carry
7569
7570      carry = (digits[j] / BASE) | 0
7571      digits[j] %= BASE
7572    }
7573
7574    while (carry) {
7575      digits.push(carry % BASE)
7576
7577      carry = (carry / BASE) | 0
7578    }
7579  }
7580
7581  // deal with leading zeros
7582  for (i = 0; buffer[i] === 0 && i < buffer.length - 1; i++) digits.push(0)
7583
7584  // convert digits to a string
7585  var stringOutput = ""
7586  for (var i = digits.length - 1; i >= 0; i--) {
7587    stringOutput = stringOutput + ALPHABET[digits[i]]
7588  }
7589  return stringOutput
7590}
7591
7592function decode(string) {
7593  if (string.length === 0) return []
7594
7595  var i, j, bytes = [0]
7596  for (i = 0; i < string.length; i++) {
7597    var c = string[i]
7598    if (!(c in ALPHABET_MAP)) throw new Error('Non-base58 character')
7599
7600    for (j = 0; j < bytes.length; j++) bytes[j] *= BASE
7601    bytes[0] += ALPHABET_MAP[c]
7602
7603    var carry = 0
7604    for (j = 0; j < bytes.length; ++j) {
7605      bytes[j] += carry
7606
7607      carry = bytes[j] >> 8
7608      bytes[j] &= 0xff
7609    }
7610
7611    while (carry) {
7612      bytes.push(carry & 0xff)
7613
7614      carry >>= 8
7615    }
7616  }
7617
7618  // deal with leading zeros
7619  for (i = 0; string[i] === '1' && i < string.length - 1; i++) bytes.push(0)
7620
7621  return bytes.reverse()
7622}
7623
7624module.exports = {
7625  encode: encode,
7626  decode: decode
7627}
7628
7629},{}],31:[function(require,module,exports){
7630(function (Buffer){
7631'use strict'
7632
7633var base58 = require('bs58')
7634var createHash = require('create-hash')
7635
7636// SHA256(SHA256(buffer))
7637function sha256x2 (buffer) {
7638  buffer = createHash('sha256').update(buffer).digest()
7639  return createHash('sha256').update(buffer).digest()
7640}
7641
7642// Encode a buffer as a base58-check encoded string
7643function encode (payload) {
7644  var checksum = sha256x2(payload).slice(0, 4)
7645
7646  return base58.encode(Buffer.concat([
7647    payload,
7648    checksum
7649  ]))
7650}
7651
7652// Decode a base58-check encoded string to a buffer
7653function decode (string) {
7654  var buffer = new Buffer(base58.decode(string))
7655
7656  var payload = buffer.slice(0, -4)
7657  var checksum = buffer.slice(-4)
7658  var newChecksum = sha256x2(payload).slice(0, 4)
7659
7660  for (var i = 0; i < newChecksum.length; ++i) {
7661    if (newChecksum[i] === checksum[i]) continue
7662
7663    throw new Error('Invalid checksum')
7664  }
7665
7666  return payload
7667}
7668
7669module.exports = {
7670  encode: encode,
7671  decode: decode
7672}
7673
7674}).call(this,require("buffer").Buffer)
7675},{"bs58":30,"buffer":7,"create-hash":32}],32:[function(require,module,exports){
7676(function (Buffer){
7677'use strict';
7678var inherits = require('inherits')
7679var md5 = require('./md5')
7680var rmd160 = require('ripemd160')
7681var sha = require('sha.js')
7682
7683var Transform = require('stream').Transform
7684
7685function HashNoConstructor(hash) {
7686  Transform.call(this)
7687
7688  this._hash = hash
7689  this.buffers = []
7690}
7691
7692inherits(HashNoConstructor, Transform)
7693
7694HashNoConstructor.prototype._transform = function (data, _, next) {
7695  this.buffers.push(data)
7696
7697  next()
7698}
7699
7700HashNoConstructor.prototype._flush = function (next) {
7701  this.push(this.digest())
7702  next()
7703}
7704
7705HashNoConstructor.prototype.update = function (data, enc) {
7706  if (typeof data === 'string') {
7707    data = new Buffer(data, enc)
7708  }
7709
7710  this.buffers.push(data)
7711  return this
7712}
7713
7714HashNoConstructor.prototype.digest = function (enc) {
7715  var buf = Buffer.concat(this.buffers)
7716  var r = this._hash(buf)
7717  this.buffers = null
7718
7719  return enc ? r.toString(enc) : r
7720}
7721
7722function Hash(hash) {
7723  Transform.call(this)
7724
7725  this._hash = hash
7726}
7727
7728inherits(Hash, Transform)
7729
7730Hash.prototype._transform = function (data, enc, next) {
7731  if (enc) data = new Buffer(data, enc)
7732
7733  this._hash.update(data)
7734
7735  next()
7736}
7737
7738Hash.prototype._flush = function (next) {
7739  this.push(this._hash.digest())
7740  this._hash = null
7741
7742  next()
7743}
7744
7745Hash.prototype.update = function (data, enc) {
7746  if (typeof data === 'string') {
7747    data = new Buffer(data, enc)
7748  }
7749
7750  this._hash.update(data)
7751  return this
7752}
7753
7754Hash.prototype.digest = function (enc) {
7755  var outData = this._hash.digest()
7756
7757  return enc ? outData.toString(enc) : outData
7758}
7759
7760module.exports = function createHash (alg) {
7761  if ('md5' === alg) return new HashNoConstructor(md5)
7762  if ('rmd160' === alg) return new HashNoConstructor(rmd160)
7763
7764  return new Hash(sha(alg))
7765}
7766
7767}).call(this,require("buffer").Buffer)
7768},{"./md5":34,"buffer":7,"inherits":35,"ripemd160":36,"sha.js":38,"stream":26}],33:[function(require,module,exports){
7769(function (Buffer){
7770'use strict';
7771var intSize = 4;
7772var zeroBuffer = new Buffer(intSize); zeroBuffer.fill(0);
7773var chrsz = 8;
7774
7775function toArray(buf, bigEndian) {
7776  if ((buf.length % intSize) !== 0) {
7777    var len = buf.length + (intSize - (buf.length % intSize));
7778    buf = Buffer.concat([buf, zeroBuffer], len);
7779  }
7780
7781  var arr = [];
7782  var fn = bigEndian ? buf.readInt32BE : buf.readInt32LE;
7783  for (var i = 0; i < buf.length; i += intSize) {
7784    arr.push(fn.call(buf, i));
7785  }
7786  return arr;
7787}
7788
7789function toBuffer(arr, size, bigEndian) {
7790  var buf = new Buffer(size);
7791  var fn = bigEndian ? buf.writeInt32BE : buf.writeInt32LE;
7792  for (var i = 0; i < arr.length; i++) {
7793    fn.call(buf, arr[i], i * 4, true);
7794  }
7795  return buf;
7796}
7797
7798function hash(buf, fn, hashSize, bigEndian) {
7799  if (!Buffer.isBuffer(buf)) buf = new Buffer(buf);
7800  var arr = fn(toArray(buf, bigEndian), buf.length * chrsz);
7801  return toBuffer(arr, hashSize, bigEndian);
7802}
7803exports.hash = hash;
7804}).call(this,require("buffer").Buffer)
7805},{"buffer":7}],34:[function(require,module,exports){
7806'use strict';
7807/*
7808 * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
7809 * Digest Algorithm, as defined in RFC 1321.
7810 * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002.
7811 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
7812 * Distributed under the BSD License
7813 * See http://pajhome.org.uk/crypt/md5 for more info.
7814 */
7815
7816var helpers = require('./helpers');
7817
7818/*
7819 * Calculate the MD5 of an array of little-endian words, and a bit length
7820 */
7821function core_md5(x, len)
7822{
7823  /* append padding */
7824  x[len >> 5] |= 0x80 << ((len) % 32);
7825  x[(((len + 64) >>> 9) << 4) + 14] = len;
7826
7827  var a =  1732584193;
7828  var b = -271733879;
7829  var c = -1732584194;
7830  var d =  271733878;
7831
7832  for(var i = 0; i < x.length; i += 16)
7833  {
7834    var olda = a;
7835    var oldb = b;
7836    var oldc = c;
7837    var oldd = d;
7838
7839    a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);
7840    d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);
7841    c = md5_ff(c, d, a, b, x[i+ 2], 17,  606105819);
7842    b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
7843    a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);
7844    d = md5_ff(d, a, b, c, x[i+ 5], 12,  1200080426);
7845    c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
7846    b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);
7847    a = md5_ff(a, b, c, d, x[i+ 8], 7 ,  1770035416);
7848    d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);
7849    c = md5_ff(c, d, a, b, x[i+10], 17, -42063);
7850    b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
7851    a = md5_ff(a, b, c, d, x[i+12], 7 ,  1804603682);
7852    d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);
7853    c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
7854    b = md5_ff(b, c, d, a, x[i+15], 22,  1236535329);
7855
7856    a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);
7857    d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
7858    c = md5_gg(c, d, a, b, x[i+11], 14,  643717713);
7859    b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);
7860    a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);
7861    d = md5_gg(d, a, b, c, x[i+10], 9 ,  38016083);
7862    c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);
7863    b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
7864    a = md5_gg(a, b, c, d, x[i+ 9], 5 ,  568446438);
7865    d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);
7866    c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);
7867    b = md5_gg(b, c, d, a, x[i+ 8], 20,  1163531501);
7868    a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);
7869    d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);
7870    c = md5_gg(c, d, a, b, x[i+ 7], 14,  1735328473);
7871    b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);
7872
7873    a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);
7874    d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
7875    c = md5_hh(c, d, a, b, x[i+11], 16,  1839030562);
7876    b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);
7877    a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
7878    d = md5_hh(d, a, b, c, x[i+ 4], 11,  1272893353);
7879    c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);
7880    b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
7881    a = md5_hh(a, b, c, d, x[i+13], 4 ,  681279174);
7882    d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);
7883    c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);
7884    b = md5_hh(b, c, d, a, x[i+ 6], 23,  76029189);
7885    a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);
7886    d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);
7887    c = md5_hh(c, d, a, b, x[i+15], 16,  530742520);
7888    b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);
7889
7890    a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);
7891    d = md5_ii(d, a, b, c, x[i+ 7], 10,  1126891415);
7892    c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
7893    b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);
7894    a = md5_ii(a, b, c, d, x[i+12], 6 ,  1700485571);
7895    d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
7896    c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);
7897    b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);
7898    a = md5_ii(a, b, c, d, x[i+ 8], 6 ,  1873313359);
7899    d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);
7900    c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);
7901    b = md5_ii(b, c, d, a, x[i+13], 21,  1309151649);
7902    a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);
7903    d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
7904    c = md5_ii(c, d, a, b, x[i+ 2], 15,  718787259);
7905    b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);
7906
7907    a = safe_add(a, olda);
7908    b = safe_add(b, oldb);
7909    c = safe_add(c, oldc);
7910    d = safe_add(d, oldd);
7911  }
7912  return Array(a, b, c, d);
7913
7914}
7915
7916/*
7917 * These functions implement the four basic operations the algorithm uses.
7918 */
7919function md5_cmn(q, a, b, x, s, t)
7920{
7921  return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);
7922}
7923function md5_ff(a, b, c, d, x, s, t)
7924{
7925  return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
7926}
7927function md5_gg(a, b, c, d, x, s, t)
7928{
7929  return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
7930}
7931function md5_hh(a, b, c, d, x, s, t)
7932{
7933  return md5_cmn(b ^ c ^ d, a, b, x, s, t);
7934}
7935function md5_ii(a, b, c, d, x, s, t)
7936{
7937  return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
7938}
7939
7940/*
7941 * Add integers, wrapping at 2^32. This uses 16-bit operations internally
7942 * to work around bugs in some JS interpreters.
7943 */
7944function safe_add(x, y)
7945{
7946  var lsw = (x & 0xFFFF) + (y & 0xFFFF);
7947  var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
7948  return (msw << 16) | (lsw & 0xFFFF);
7949}
7950
7951/*
7952 * Bitwise rotate a 32-bit number to the left.
7953 */
7954function bit_rol(num, cnt)
7955{
7956  return (num << cnt) | (num >>> (32 - cnt));
7957}
7958
7959module.exports = function md5(buf) {
7960  return helpers.hash(buf, core_md5, 16);
7961};
7962},{"./helpers":33}],35:[function(require,module,exports){
7963arguments[4][12][0].apply(exports,arguments)
7964},{"dup":12}],36:[function(require,module,exports){
7965(function (Buffer){
7966/*
7967CryptoJS v3.1.2
7968code.google.com/p/crypto-js
7969(c) 2009-2013 by Jeff Mott. All rights reserved.
7970code.google.com/p/crypto-js/wiki/License
7971*/
7972/** @preserve
7973(c) 2012 by Cédric Mesnil. All rights reserved.
7974
7975Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
7976
7977    - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7978    - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
7979
7980THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7981*/
7982
7983// constants table
7984var zl = [
7985  0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
7986  7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
7987  3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
7988  1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
7989  4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13
7990]
7991
7992var zr = [
7993  5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
7994  6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
7995  15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
7996  8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
7997  12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
7998]
7999
8000var sl = [
8001  11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
8002  7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
8003  11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
8004  11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
8005  9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
8006]
8007
8008var sr = [
8009  8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
8010  9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
8011  9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
8012  15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
8013  8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
8014]
8015
8016var hl = [0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]
8017var hr = [0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]
8018
8019function bytesToWords (bytes) {
8020  var words = []
8021  for (var i = 0, b = 0; i < bytes.length; i++, b += 8) {
8022    words[b >>> 5] |= bytes[i] << (24 - b % 32)
8023  }
8024  return words
8025}
8026
8027function wordsToBytes (words) {
8028  var bytes = []
8029  for (var b = 0; b < words.length * 32; b += 8) {
8030    bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF)
8031  }
8032  return bytes
8033}
8034
8035function processBlock (H, M, offset) {
8036  // swap endian
8037  for (var i = 0; i < 16; i++) {
8038    var offset_i = offset + i
8039    var M_offset_i = M[offset_i]
8040
8041    // Swap
8042    M[offset_i] = (
8043      (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) |
8044      (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)
8045    )
8046  }
8047
8048  // Working variables
8049  var al, bl, cl, dl, el
8050  var ar, br, cr, dr, er
8051
8052  ar = al = H[0]
8053  br = bl = H[1]
8054  cr = cl = H[2]
8055  dr = dl = H[3]
8056  er = el = H[4]
8057
8058  // computation
8059  var t
8060  for (i = 0; i < 80; i += 1) {
8061    t = (al + M[offset + zl[i]]) | 0
8062    if (i < 16) {
8063      t += f1(bl, cl, dl) + hl[0]
8064    } else if (i < 32) {
8065      t += f2(bl, cl, dl) + hl[1]
8066    } else if (i < 48) {
8067      t += f3(bl, cl, dl) + hl[2]
8068    } else if (i < 64) {
8069      t += f4(bl, cl, dl) + hl[3]
8070    } else {// if (i<80) {
8071      t += f5(bl, cl, dl) + hl[4]
8072    }
8073    t = t | 0
8074    t = rotl(t, sl[i])
8075    t = (t + el) | 0
8076    al = el
8077    el = dl
8078    dl = rotl(cl, 10)
8079    cl = bl
8080    bl = t
8081
8082    t = (ar + M[offset + zr[i]]) | 0
8083    if (i < 16) {
8084      t += f5(br, cr, dr) + hr[0]
8085    } else if (i < 32) {
8086      t += f4(br, cr, dr) + hr[1]
8087    } else if (i < 48) {
8088      t += f3(br, cr, dr) + hr[2]
8089    } else if (i < 64) {
8090      t += f2(br, cr, dr) + hr[3]
8091    } else {// if (i<80) {
8092      t += f1(br, cr, dr) + hr[4]
8093    }
8094
8095    t = t | 0
8096    t = rotl(t, sr[i])
8097    t = (t + er) | 0
8098    ar = er
8099    er = dr
8100    dr = rotl(cr, 10)
8101    cr = br
8102    br = t
8103  }
8104
8105  // intermediate hash value
8106  t = (H[1] + cl + dr) | 0
8107  H[1] = (H[2] + dl + er) | 0
8108  H[2] = (H[3] + el + ar) | 0
8109  H[3] = (H[4] + al + br) | 0
8110  H[4] = (H[0] + bl + cr) | 0
8111  H[0] = t
8112}
8113
8114function f1 (x, y, z) {
8115  return ((x) ^ (y) ^ (z))
8116}
8117
8118function f2 (x, y, z) {
8119  return (((x) & (y)) | ((~x) & (z)))
8120}
8121
8122function f3 (x, y, z) {
8123  return (((x) | (~(y))) ^ (z))
8124}
8125
8126function f4 (x, y, z) {
8127  return (((x) & (z)) | ((y) & (~(z))))
8128}
8129
8130function f5 (x, y, z) {
8131  return ((x) ^ ((y) | (~(z))))
8132}
8133
8134function rotl (x, n) {
8135  return (x << n) | (x >>> (32 - n))
8136}
8137
8138function ripemd160 (message) {
8139  var H = [0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]
8140
8141  if (typeof message === 'string') {
8142    message = new Buffer(message, 'utf8')
8143  }
8144
8145  var m = bytesToWords(message)
8146
8147  var nBitsLeft = message.length * 8
8148  var nBitsTotal = message.length * 8
8149
8150  // Add padding
8151  m[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32)
8152  m[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
8153    (((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) |
8154    (((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00)
8155  )
8156
8157  for (var i = 0; i < m.length; i += 16) {
8158    processBlock(H, m, i)
8159  }
8160
8161  // swap endian
8162  for (i = 0; i < 5; i++) {
8163    // shortcut
8164    var H_i = H[i]
8165
8166    // Swap
8167    H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) |
8168      (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00)
8169  }
8170
8171  var digestbytes = wordsToBytes(H)
8172  return new Buffer(digestbytes)
8173}
8174
8175module.exports = ripemd160
8176
8177}).call(this,require("buffer").Buffer)
8178},{"buffer":7}],37:[function(require,module,exports){
8179(function (Buffer){
8180// prototype class for hash functions
8181function Hash (blockSize, finalSize) {
8182  this._block = new Buffer(blockSize)
8183  this._finalSize = finalSize
8184  this._blockSize = blockSize
8185  this._len = 0
8186  this._s = 0
8187}
8188
8189Hash.prototype.update = function (data, enc) {
8190  if (typeof data === 'string') {
8191    enc = enc || 'utf8'
8192    data = new Buffer(data, enc)
8193  }
8194
8195  var l = this._len += data.length
8196  var s = this._s || 0
8197  var f = 0
8198  var buffer = this._block
8199
8200  while (s < l) {
8201    var t = Math.min(data.length, f + this._blockSize - (s % this._blockSize))
8202    var ch = (t - f)
8203
8204    for (var i = 0; i < ch; i++) {
8205      buffer[(s % this._blockSize) + i] = data[i + f]
8206    }
8207
8208    s += ch
8209    f += ch
8210
8211    if ((s % this._blockSize) === 0) {
8212      this._update(buffer)
8213    }
8214  }
8215  this._s = s
8216
8217  return this
8218}
8219
8220Hash.prototype.digest = function (enc) {
8221  // Suppose the length of the message M, in bits, is l
8222  var l = this._len * 8
8223
8224  // Append the bit 1 to the end of the message
8225  this._block[this._len % this._blockSize] = 0x80
8226
8227  // and then k zero bits, where k is the smallest non-negative solution to the equation (l + 1 + k) === finalSize mod blockSize
8228  this._block.fill(0, this._len % this._blockSize + 1)
8229
8230  if (l % (this._blockSize * 8) >= this._finalSize * 8) {
8231    this._update(this._block)
8232    this._block.fill(0)
8233  }
8234
8235  // to this append the block which is equal to the number l written in binary
8236  // TODO: handle case where l is > Math.pow(2, 29)
8237  this._block.writeInt32BE(l, this._blockSize - 4)
8238
8239  var hash = this._update(this._block) || this._hash()
8240
8241  return enc ? hash.toString(enc) : hash
8242}
8243
8244Hash.prototype._update = function () {
8245  throw new Error('_update must be implemented by subclass')
8246}
8247
8248module.exports = Hash
8249
8250}).call(this,require("buffer").Buffer)
8251},{"buffer":7}],38:[function(require,module,exports){
8252var exports = module.exports = function SHA (algorithm) {
8253  algorithm = algorithm.toLowerCase()
8254
8255  var Algorithm = exports[algorithm]
8256  if (!Algorithm) throw new Error(algorithm + ' is not supported (we accept pull requests)')
8257
8258  return new Algorithm()
8259}
8260
8261exports.sha = require('./sha')
8262exports.sha1 = require('./sha1')
8263exports.sha224 = require('./sha224')
8264exports.sha256 = require('./sha256')
8265exports.sha384 = require('./sha384')
8266exports.sha512 = require('./sha512')
8267
8268},{"./sha":39,"./sha1":40,"./sha224":41,"./sha256":42,"./sha384":43,"./sha512":44}],39:[function(require,module,exports){
8269(function (Buffer){
8270/*
8271 * A JavaScript implementation of the Secure Hash Algorithm, SHA-0, as defined
8272 * in FIPS PUB 180-1
8273 * This source code is derived from sha1.js of the same repository.
8274 * The difference between SHA-0 and SHA-1 is just a bitwise rotate left
8275 * operation was added.
8276 */
8277
8278var inherits = require('inherits')
8279var Hash = require('./hash')
8280
8281var W = new Array(80)
8282
8283function Sha () {
8284  this.init()
8285  this._w = W
8286
8287  Hash.call(this, 64, 56)
8288}
8289
8290inherits(Sha, Hash)
8291
8292Sha.prototype.init = function () {
8293  this._a = 0x67452301 | 0
8294  this._b = 0xefcdab89 | 0
8295  this._c = 0x98badcfe | 0
8296  this._d = 0x10325476 | 0
8297  this._e = 0xc3d2e1f0 | 0
8298
8299  return this
8300}
8301
8302/*
8303 * Bitwise rotate a 32-bit number to the left.
8304 */
8305function rol (num, cnt) {
8306  return (num << cnt) | (num >>> (32 - cnt))
8307}
8308
8309Sha.prototype._update = function (M) {
8310  var W = this._w
8311
8312  var a = this._a
8313  var b = this._b
8314  var c = this._c
8315  var d = this._d
8316  var e = this._e
8317
8318  var j = 0, k
8319
8320  /*
8321   * SHA-1 has a bitwise rotate left operation. But, SHA is not
8322   * function calcW() { return rol(W[j - 3] ^ W[j -  8] ^ W[j - 14] ^ W[j - 16], 1) }
8323   */
8324  function calcW () { return W[j - 3] ^ W[j - 8] ^ W[j - 14] ^ W[j - 16] }
8325  function loop (w, f) {
8326    W[j] = w
8327
8328    var t = rol(a, 5) + f + e + w + k
8329
8330    e = d
8331    d = c
8332    c = rol(b, 30)
8333    b = a
8334    a = t
8335    j++
8336  }
8337
8338  k = 1518500249
8339  while (j < 16) loop(M.readInt32BE(j * 4), (b & c) | ((~b) & d))
8340  while (j < 20) loop(calcW(), (b & c) | ((~b) & d))
8341  k = 1859775393
8342  while (j < 40) loop(calcW(), b ^ c ^ d)
8343  k = -1894007588
8344  while (j < 60) loop(calcW(), (b & c) | (b & d) | (c & d))
8345  k = -899497514
8346  while (j < 80) loop(calcW(), b ^ c ^ d)
8347
8348  this._a = (a + this._a) | 0
8349  this._b = (b + this._b) | 0
8350  this._c = (c + this._c) | 0
8351  this._d = (d + this._d) | 0
8352  this._e = (e + this._e) | 0
8353}
8354
8355Sha.prototype._hash = function () {
8356  var H = new Buffer(20)
8357
8358  H.writeInt32BE(this._a | 0, 0)
8359  H.writeInt32BE(this._b | 0, 4)
8360  H.writeInt32BE(this._c | 0, 8)
8361  H.writeInt32BE(this._d | 0, 12)
8362  H.writeInt32BE(this._e | 0, 16)
8363
8364  return H
8365}
8366
8367module.exports = Sha
8368
8369
8370}).call(this,require("buffer").Buffer)
8371},{"./hash":37,"buffer":7,"inherits":35}],40:[function(require,module,exports){
8372(function (Buffer){
8373/*
8374 * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
8375 * in FIPS PUB 180-1
8376 * Version 2.1a Copyright Paul Johnston 2000 - 2002.
8377 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
8378 * Distributed under the BSD License
8379 * See http://pajhome.org.uk/crypt/md5 for details.
8380 */
8381
8382var inherits = require('inherits')
8383var Hash = require('./hash')
8384
8385var W = new Array(80)
8386
8387function Sha1 () {
8388  this.init()
8389  this._w = W
8390
8391  Hash.call(this, 64, 56)
8392}
8393
8394inherits(Sha1, Hash)
8395
8396Sha1.prototype.init = function () {
8397  this._a = 0x67452301 | 0
8398  this._b = 0xefcdab89 | 0
8399  this._c = 0x98badcfe | 0
8400  this._d = 0x10325476 | 0
8401  this._e = 0xc3d2e1f0 | 0
8402
8403  return this
8404}
8405
8406/*
8407 * Bitwise rotate a 32-bit number to the left.
8408 */
8409function rol (num, cnt) {
8410  return (num << cnt) | (num >>> (32 - cnt))
8411}
8412
8413Sha1.prototype._update = function (M) {
8414  var W = this._w
8415
8416  var a = this._a
8417  var b = this._b
8418  var c = this._c
8419  var d = this._d
8420  var e = this._e
8421
8422  var j = 0, k
8423
8424  function calcW () { return rol(W[j - 3] ^ W[j - 8] ^ W[j - 14] ^ W[j - 16], 1) }
8425  function loop (w, f) {
8426    W[j] = w
8427
8428    var t = rol(a, 5) + f + e + w + k
8429
8430    e = d
8431    d = c
8432    c = rol(b, 30)
8433    b = a
8434    a = t
8435    j++
8436  }
8437
8438  k = 1518500249
8439  while (j < 16) loop(M.readInt32BE(j * 4), (b & c) | ((~b) & d))
8440  while (j < 20) loop(calcW(), (b & c) | ((~b) & d))
8441  k = 1859775393
8442  while (j < 40) loop(calcW(), b ^ c ^ d)
8443  k = -1894007588
8444  while (j < 60) loop(calcW(), (b & c) | (b & d) | (c & d))
8445  k = -899497514
8446  while (j < 80) loop(calcW(), b ^ c ^ d)
8447
8448  this._a = (a + this._a) | 0
8449  this._b = (b + this._b) | 0
8450  this._c = (c + this._c) | 0
8451  this._d = (d + this._d) | 0
8452  this._e = (e + this._e) | 0
8453}
8454
8455Sha1.prototype._hash = function () {
8456  var H = new Buffer(20)
8457
8458  H.writeInt32BE(this._a | 0, 0)
8459  H.writeInt32BE(this._b | 0, 4)
8460  H.writeInt32BE(this._c | 0, 8)
8461  H.writeInt32BE(this._d | 0, 12)
8462  H.writeInt32BE(this._e | 0, 16)
8463
8464  return H
8465}
8466
8467module.exports = Sha1
8468
8469}).call(this,require("buffer").Buffer)
8470},{"./hash":37,"buffer":7,"inherits":35}],41:[function(require,module,exports){
8471(function (Buffer){
8472/**
8473 * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
8474 * in FIPS 180-2
8475 * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.
8476 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
8477 *
8478 */
8479
8480var inherits = require('inherits')
8481var Sha256 = require('./sha256')
8482var Hash = require('./hash')
8483
8484var W = new Array(64)
8485
8486function Sha224 () {
8487  this.init()
8488
8489  this._w = W // new Array(64)
8490
8491  Hash.call(this, 64, 56)
8492}
8493
8494inherits(Sha224, Sha256)
8495
8496Sha224.prototype.init = function () {
8497  this._a = 0xc1059ed8 | 0
8498  this._b = 0x367cd507 | 0
8499  this._c = 0x3070dd17 | 0
8500  this._d = 0xf70e5939 | 0
8501  this._e = 0xffc00b31 | 0
8502  this._f = 0x68581511 | 0
8503  this._g = 0x64f98fa7 | 0
8504  this._h = 0xbefa4fa4 | 0
8505
8506  return this
8507}
8508
8509Sha224.prototype._hash = function () {
8510  var H = new Buffer(28)
8511
8512  H.writeInt32BE(this._a, 0)
8513  H.writeInt32BE(this._b, 4)
8514  H.writeInt32BE(this._c, 8)
8515  H.writeInt32BE(this._d, 12)
8516  H.writeInt32BE(this._e, 16)
8517  H.writeInt32BE(this._f, 20)
8518  H.writeInt32BE(this._g, 24)
8519
8520  return H
8521}
8522
8523module.exports = Sha224
8524
8525}).call(this,require("buffer").Buffer)
8526},{"./hash":37,"./sha256":42,"buffer":7,"inherits":35}],42:[function(require,module,exports){
8527(function (Buffer){
8528/**
8529 * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
8530 * in FIPS 180-2
8531 * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.
8532 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
8533 *
8534 */
8535
8536var inherits = require('inherits')
8537var Hash = require('./hash')
8538
8539var K = [
8540  0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5,
8541  0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5,
8542  0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3,
8543  0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174,
8544  0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC,
8545  0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA,
8546  0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7,
8547  0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967,
8548  0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13,
8549  0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85,
8550  0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3,
8551  0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070,
8552  0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5,
8553  0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3,
8554  0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208,
8555  0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2
8556]
8557
8558var W = new Array(64)
8559
8560function Sha256 () {
8561  this.init()
8562
8563  this._w = W // new Array(64)
8564
8565  Hash.call(this, 64, 56)
8566}
8567
8568inherits(Sha256, Hash)
8569
8570Sha256.prototype.init = function () {
8571  this._a = 0x6a09e667 | 0
8572  this._b = 0xbb67ae85 | 0
8573  this._c = 0x3c6ef372 | 0
8574  this._d = 0xa54ff53a | 0
8575  this._e = 0x510e527f | 0
8576  this._f = 0x9b05688c | 0
8577  this._g = 0x1f83d9ab | 0
8578  this._h = 0x5be0cd19 | 0
8579
8580  return this
8581}
8582
8583function S (X, n) {
8584  return (X >>> n) | (X << (32 - n))
8585}
8586
8587function R (X, n) {
8588  return (X >>> n)
8589}
8590
8591function Ch (x, y, z) {
8592  return ((x & y) ^ ((~x) & z))
8593}
8594
8595function Maj (x, y, z) {
8596  return ((x & y) ^ (x & z) ^ (y & z))
8597}
8598
8599function Sigma0256 (x) {
8600  return (S(x, 2) ^ S(x, 13) ^ S(x, 22))
8601}
8602
8603function Sigma1256 (x) {
8604  return (S(x, 6) ^ S(x, 11) ^ S(x, 25))
8605}
8606
8607function Gamma0256 (x) {
8608  return (S(x, 7) ^ S(x, 18) ^ R(x, 3))
8609}
8610
8611function Gamma1256 (x) {
8612  return (S(x, 17) ^ S(x, 19) ^ R(x, 10))
8613}
8614
8615Sha256.prototype._update = function (M) {
8616  var W = this._w
8617
8618  var a = this._a | 0
8619  var b = this._b | 0
8620  var c = this._c | 0
8621  var d = this._d | 0
8622  var e = this._e | 0
8623  var f = this._f | 0
8624  var g = this._g | 0
8625  var h = this._h | 0
8626
8627  var j = 0
8628
8629  function calcW () { return Gamma1256(W[j - 2]) + W[j - 7] + Gamma0256(W[j - 15]) + W[j - 16] }
8630  function loop (w) {
8631    W[j] = w
8632
8633    var T1 = h + Sigma1256(e) + Ch(e, f, g) + K[j] + w
8634    var T2 = Sigma0256(a) + Maj(a, b, c)
8635
8636    h = g
8637    g = f
8638    f = e
8639    e = d + T1
8640    d = c
8641    c = b
8642    b = a
8643    a = T1 + T2
8644
8645    j++
8646  }
8647
8648  while (j < 16) loop(M.readInt32BE(j * 4))
8649  while (j < 64) loop(calcW())
8650
8651  this._a = (a + this._a) | 0
8652  this._b = (b + this._b) | 0
8653  this._c = (c + this._c) | 0
8654  this._d = (d + this._d) | 0
8655  this._e = (e + this._e) | 0
8656  this._f = (f + this._f) | 0
8657  this._g = (g + this._g) | 0
8658  this._h = (h + this._h) | 0
8659}
8660
8661Sha256.prototype._hash = function () {
8662  var H = new Buffer(32)
8663
8664  H.writeInt32BE(this._a, 0)
8665  H.writeInt32BE(this._b, 4)
8666  H.writeInt32BE(this._c, 8)
8667  H.writeInt32BE(this._d, 12)
8668  H.writeInt32BE(this._e, 16)
8669  H.writeInt32BE(this._f, 20)
8670  H.writeInt32BE(this._g, 24)
8671  H.writeInt32BE(this._h, 28)
8672
8673  return H
8674}
8675
8676module.exports = Sha256
8677
8678}).call(this,require("buffer").Buffer)
8679},{"./hash":37,"buffer":7,"inherits":35}],43:[function(require,module,exports){
8680(function (Buffer){
8681var inherits = require('inherits')
8682var SHA512 = require('./sha512')
8683var Hash = require('./hash')
8684
8685var W = new Array(160)
8686
8687function Sha384 () {
8688  this.init()
8689  this._w = W
8690
8691  Hash.call(this, 128, 112)
8692}
8693
8694inherits(Sha384, SHA512)
8695
8696Sha384.prototype.init = function () {
8697  this._a = 0xcbbb9d5d | 0
8698  this._b = 0x629a292a | 0
8699  this._c = 0x9159015a | 0
8700  this._d = 0x152fecd8 | 0
8701  this._e = 0x67332667 | 0
8702  this._f = 0x8eb44a87 | 0
8703  this._g = 0xdb0c2e0d | 0
8704  this._h = 0x47b5481d | 0
8705
8706  this._al = 0xc1059ed8 | 0
8707  this._bl = 0x367cd507 | 0
8708  this._cl = 0x3070dd17 | 0
8709  this._dl = 0xf70e5939 | 0
8710  this._el = 0xffc00b31 | 0
8711  this._fl = 0x68581511 | 0
8712  this._gl = 0x64f98fa7 | 0
8713  this._hl = 0xbefa4fa4 | 0
8714
8715  return this
8716}
8717
8718Sha384.prototype._hash = function () {
8719  var H = new Buffer(48)
8720
8721  function writeInt64BE (h, l, offset) {
8722    H.writeInt32BE(h, offset)
8723    H.writeInt32BE(l, offset + 4)
8724  }
8725
8726  writeInt64BE(this._a, this._al, 0)
8727  writeInt64BE(this._b, this._bl, 8)
8728  writeInt64BE(this._c, this._cl, 16)
8729  writeInt64BE(this._d, this._dl, 24)
8730  writeInt64BE(this._e, this._el, 32)
8731  writeInt64BE(this._f, this._fl, 40)
8732
8733  return H
8734}
8735
8736module.exports = Sha384
8737
8738}).call(this,require("buffer").Buffer)
8739},{"./hash":37,"./sha512":44,"buffer":7,"inherits":35}],44:[function(require,module,exports){
8740(function (Buffer){
8741var inherits = require('inherits')
8742var Hash = require('./hash')
8743
8744var K = [
8745  0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
8746  0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
8747  0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
8748  0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
8749  0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
8750  0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
8751  0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
8752  0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
8753  0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
8754  0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
8755  0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
8756  0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
8757  0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
8758  0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
8759  0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
8760  0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
8761  0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
8762  0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
8763  0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
8764  0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
8765  0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
8766  0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
8767  0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
8768  0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
8769  0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
8770  0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
8771  0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
8772  0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
8773  0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
8774  0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
8775  0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
8776  0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
8777  0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
8778  0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
8779  0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
8780  0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
8781  0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
8782  0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
8783  0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
8784  0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
8785]
8786
8787var W = new Array(160)
8788
8789function Sha512 () {
8790  this.init()
8791  this._w = W
8792
8793  Hash.call(this, 128, 112)
8794}
8795
8796inherits(Sha512, Hash)
8797
8798Sha512.prototype.init = function () {
8799  this._a = 0x6a09e667 | 0
8800  this._b = 0xbb67ae85 | 0
8801  this._c = 0x3c6ef372 | 0
8802  this._d = 0xa54ff53a | 0
8803  this._e = 0x510e527f | 0
8804  this._f = 0x9b05688c | 0
8805  this._g = 0x1f83d9ab | 0
8806  this._h = 0x5be0cd19 | 0
8807
8808  this._al = 0xf3bcc908 | 0
8809  this._bl = 0x84caa73b | 0
8810  this._cl = 0xfe94f82b | 0
8811  this._dl = 0x5f1d36f1 | 0
8812  this._el = 0xade682d1 | 0
8813  this._fl = 0x2b3e6c1f | 0
8814  this._gl = 0xfb41bd6b | 0
8815  this._hl = 0x137e2179 | 0
8816
8817  return this
8818}
8819
8820function S (X, Xl, n) {
8821  return (X >>> n) | (Xl << (32 - n))
8822}
8823
8824function Ch (x, y, z) {
8825  return ((x & y) ^ ((~x) & z))
8826}
8827
8828function Maj (x, y, z) {
8829  return ((x & y) ^ (x & z) ^ (y & z))
8830}
8831
8832Sha512.prototype._update = function (M) {
8833  var W = this._w
8834
8835  var a = this._a | 0
8836  var b = this._b | 0
8837  var c = this._c | 0
8838  var d = this._d | 0
8839  var e = this._e | 0
8840  var f = this._f | 0
8841  var g = this._g | 0
8842  var h = this._h | 0
8843
8844  var al = this._al | 0
8845  var bl = this._bl | 0
8846  var cl = this._cl | 0
8847  var dl = this._dl | 0
8848  var el = this._el | 0
8849  var fl = this._fl | 0
8850  var gl = this._gl | 0
8851  var hl = this._hl | 0
8852
8853  var i = 0, j = 0
8854  var Wi, Wil
8855  function calcW () {
8856    var x = W[j - 15 * 2]
8857    var xl = W[j - 15 * 2 + 1]
8858    var gamma0 = S(x, xl, 1) ^ S(x, xl, 8) ^ (x >>> 7)
8859    var gamma0l = S(xl, x, 1) ^ S(xl, x, 8) ^ S(xl, x, 7)
8860
8861    x = W[j - 2 * 2]
8862    xl = W[j - 2 * 2 + 1]
8863    var gamma1 = S(x, xl, 19) ^ S(xl, x, 29) ^ (x >>> 6)
8864    var gamma1l = S(xl, x, 19) ^ S(x, xl, 29) ^ S(xl, x, 6)
8865
8866    // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]
8867    var Wi7 = W[j - 7 * 2]
8868    var Wi7l = W[j - 7 * 2 + 1]
8869
8870    var Wi16 = W[j - 16 * 2]
8871    var Wi16l = W[j - 16 * 2 + 1]
8872
8873    Wil = gamma0l + Wi7l
8874    Wi = gamma0 + Wi7 + ((Wil >>> 0) < (gamma0l >>> 0) ? 1 : 0)
8875    Wil = Wil + gamma1l
8876    Wi = Wi + gamma1 + ((Wil >>> 0) < (gamma1l >>> 0) ? 1 : 0)
8877    Wil = Wil + Wi16l
8878    Wi = Wi + Wi16 + ((Wil >>> 0) < (Wi16l >>> 0) ? 1 : 0)
8879  }
8880
8881  function loop () {
8882    W[j] = Wi
8883    W[j + 1] = Wil
8884
8885    var maj = Maj(a, b, c)
8886    var majl = Maj(al, bl, cl)
8887
8888    var sigma0h = S(a, al, 28) ^ S(al, a, 2) ^ S(al, a, 7)
8889    var sigma0l = S(al, a, 28) ^ S(a, al, 2) ^ S(a, al, 7)
8890    var sigma1h = S(e, el, 14) ^ S(e, el, 18) ^ S(el, e, 9)
8891    var sigma1l = S(el, e, 14) ^ S(el, e, 18) ^ S(e, el, 9)
8892
8893    // t1 = h + sigma1 + ch + K[i] + W[i]
8894    var Ki = K[j]
8895    var Kil = K[j + 1]
8896
8897    var ch = Ch(e, f, g)
8898    var chl = Ch(el, fl, gl)
8899
8900    var t1l = hl + sigma1l
8901    var t1 = h + sigma1h + ((t1l >>> 0) < (hl >>> 0) ? 1 : 0)
8902    t1l = t1l + chl
8903    t1 = t1 + ch + ((t1l >>> 0) < (chl >>> 0) ? 1 : 0)
8904    t1l = t1l + Kil
8905    t1 = t1 + Ki + ((t1l >>> 0) < (Kil >>> 0) ? 1 : 0)
8906    t1l = t1l + Wil
8907    t1 = t1 + Wi + ((t1l >>> 0) < (Wil >>> 0) ? 1 : 0)
8908
8909    // t2 = sigma0 + maj
8910    var t2l = sigma0l + majl
8911    var t2 = sigma0h + maj + ((t2l >>> 0) < (sigma0l >>> 0) ? 1 : 0)
8912
8913    h = g
8914    hl = gl
8915    g = f
8916    gl = fl
8917    f = e
8918    fl = el
8919    el = (dl + t1l) | 0
8920    e = (d + t1 + ((el >>> 0) < (dl >>> 0) ? 1 : 0)) | 0
8921    d = c
8922    dl = cl
8923    c = b
8924    cl = bl
8925    b = a
8926    bl = al
8927    al = (t1l + t2l) | 0
8928    a = (t1 + t2 + ((al >>> 0) < (t1l >>> 0) ? 1 : 0)) | 0
8929
8930    i++
8931    j += 2
8932  }
8933
8934  while (i < 16) {
8935    Wi = M.readInt32BE(j * 4)
8936    Wil = M.readInt32BE(j * 4 + 4)
8937
8938    loop()
8939  }
8940
8941  while (i < 80) {
8942    calcW()
8943    loop()
8944  }
8945
8946  this._al = (this._al + al) | 0
8947  this._bl = (this._bl + bl) | 0
8948  this._cl = (this._cl + cl) | 0
8949  this._dl = (this._dl + dl) | 0
8950  this._el = (this._el + el) | 0
8951  this._fl = (this._fl + fl) | 0
8952  this._gl = (this._gl + gl) | 0
8953  this._hl = (this._hl + hl) | 0
8954
8955  this._a = (this._a + a + ((this._al >>> 0) < (al >>> 0) ? 1 : 0)) | 0
8956  this._b = (this._b + b + ((this._bl >>> 0) < (bl >>> 0) ? 1 : 0)) | 0
8957  this._c = (this._c + c + ((this._cl >>> 0) < (cl >>> 0) ? 1 : 0)) | 0
8958  this._d = (this._d + d + ((this._dl >>> 0) < (dl >>> 0) ? 1 : 0)) | 0
8959  this._e = (this._e + e + ((this._el >>> 0) < (el >>> 0) ? 1 : 0)) | 0
8960  this._f = (this._f + f + ((this._fl >>> 0) < (fl >>> 0) ? 1 : 0)) | 0
8961  this._g = (this._g + g + ((this._gl >>> 0) < (gl >>> 0) ? 1 : 0)) | 0
8962  this._h = (this._h + h + ((this._hl >>> 0) < (hl >>> 0) ? 1 : 0)) | 0
8963}
8964
8965Sha512.prototype._hash = function () {
8966  var H = new Buffer(64)
8967
8968  function writeInt64BE (h, l, offset) {
8969    H.writeInt32BE(h, offset)
8970    H.writeInt32BE(l, offset + 4)
8971  }
8972
8973  writeInt64BE(this._a, this._al, 0)
8974  writeInt64BE(this._b, this._bl, 8)
8975  writeInt64BE(this._c, this._cl, 16)
8976  writeInt64BE(this._d, this._dl, 24)
8977  writeInt64BE(this._e, this._el, 32)
8978  writeInt64BE(this._f, this._fl, 40)
8979  writeInt64BE(this._g, this._gl, 48)
8980  writeInt64BE(this._h, this._hl, 56)
8981
8982  return H
8983}
8984
8985module.exports = Sha512
8986
8987}).call(this,require("buffer").Buffer)
8988},{"./hash":37,"buffer":7,"inherits":35}],45:[function(require,module,exports){
8989(function (Buffer){
8990'use strict';
8991var createHash = require('create-hash/browser');
8992var inherits = require('inherits')
8993
8994var Transform = require('stream').Transform
8995
8996var ZEROS = new Buffer(128)
8997ZEROS.fill(0)
8998
8999function Hmac(alg, key) {
9000  Transform.call(this)
9001
9002  if (typeof key === 'string') {
9003    key = new Buffer(key)
9004  }
9005
9006  var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64
9007
9008  this._alg = alg
9009  this._key = key
9010
9011  if (key.length > blocksize) {
9012    key = createHash(alg).update(key).digest()
9013
9014  } else if (key.length < blocksize) {
9015    key = Buffer.concat([key, ZEROS], blocksize)
9016  }
9017
9018  var ipad = this._ipad = new Buffer(blocksize)
9019  var opad = this._opad = new Buffer(blocksize)
9020
9021  for (var i = 0; i < blocksize; i++) {
9022    ipad[i] = key[i] ^ 0x36
9023    opad[i] = key[i] ^ 0x5C
9024  }
9025
9026  this._hash = createHash(alg).update(ipad)
9027}
9028
9029inherits(Hmac, Transform)
9030
9031Hmac.prototype.update = function (data, enc) {
9032  this._hash.update(data, enc)
9033
9034  return this
9035}
9036
9037Hmac.prototype._transform = function (data, _, next) {
9038  this._hash.update(data)
9039
9040  next()
9041}
9042
9043Hmac.prototype._flush = function (next) {
9044  this.push(this.digest())
9045
9046  next()
9047}
9048
9049Hmac.prototype.digest = function (enc) {
9050  var h = this._hash.digest()
9051
9052  return createHash(this._alg).update(this._opad).update(h).digest(enc)
9053}
9054
9055module.exports = function createHmac(alg, key) {
9056  return new Hmac(alg, key)
9057}
9058
9059}).call(this,require("buffer").Buffer)
9060},{"buffer":7,"create-hash/browser":32,"inherits":46,"stream":26}],46:[function(require,module,exports){
9061arguments[4][12][0].apply(exports,arguments)
9062},{"dup":12}],47:[function(require,module,exports){
9063var assert = require('assert')
9064var BigInteger = require('bigi')
9065
9066var Point = require('./point')
9067
9068function Curve(p, a, b, Gx, Gy, n, h) {
9069  this.p = p
9070  this.a = a
9071  this.b = b
9072  this.G = Point.fromAffine(this, Gx, Gy)
9073  this.n = n
9074  this.h = h
9075
9076  this.infinity = new Point(this, null, null, BigInteger.ZERO)
9077
9078  // result caching
9079  this.pOverFour = p.add(BigInteger.ONE).shiftRight(2)
9080}
9081
9082Curve.prototype.pointFromX = function(isOdd, x) {
9083  var alpha = x.pow(3).add(this.a.multiply(x)).add(this.b).mod(this.p)
9084  var beta = alpha.modPow(this.pOverFour, this.p) // XXX: not compatible with all curves
9085
9086  var y = beta
9087  if (beta.isEven() ^ !isOdd) {
9088    y = this.p.subtract(y) // -y % p
9089  }
9090
9091  return Point.fromAffine(this, x, y)
9092}
9093
9094Curve.prototype.isInfinity = function(Q) {
9095  if (Q === this.infinity) return true
9096
9097  return Q.z.signum() === 0 && Q.y.signum() !== 0
9098}
9099
9100Curve.prototype.isOnCurve = function(Q) {
9101  if (this.isInfinity(Q)) return true
9102
9103  var x = Q.affineX
9104  var y = Q.affineY
9105  var a = this.a
9106  var b = this.b
9107  var p = this.p
9108
9109  // Check that xQ and yQ are integers in the interval [0, p - 1]
9110  if (x.signum() < 0 || x.compareTo(p) >= 0) return false
9111  if (y.signum() < 0 || y.compareTo(p) >= 0) return false
9112
9113  // and check that y^2 = x^3 + ax + b (mod p)
9114  var lhs = y.square().mod(p)
9115  var rhs = x.pow(3).add(a.multiply(x)).add(b).mod(p)
9116  return lhs.equals(rhs)
9117}
9118
9119/**
9120 * Validate an elliptic curve point.
9121 *
9122 * See SEC 1, section 3.2.2.1: Elliptic Curve Public Key Validation Primitive
9123 */
9124Curve.prototype.validate = function(Q) {
9125  // Check Q != O
9126  assert(!this.isInfinity(Q), 'Point is at infinity')
9127  assert(this.isOnCurve(Q), 'Point is not on the curve')
9128
9129  // Check nQ = O (where Q is a scalar multiple of G)
9130  var nQ = Q.multiply(this.n)
9131  assert(this.isInfinity(nQ), 'Point is not a scalar multiple of G')
9132
9133  return true
9134}
9135
9136module.exports = Curve
9137
9138},{"./point":51,"assert":5,"bigi":3}],48:[function(require,module,exports){
9139module.exports={
9140  "secp128r1": {
9141    "p": "fffffffdffffffffffffffffffffffff",
9142    "a": "fffffffdfffffffffffffffffffffffc",
9143    "b": "e87579c11079f43dd824993c2cee5ed3",
9144    "n": "fffffffe0000000075a30d1b9038a115",
9145    "h": "01",
9146    "Gx": "161ff7528b899b2d0c28607ca52c5b86",
9147    "Gy": "cf5ac8395bafeb13c02da292dded7a83"
9148  },
9149  "secp160k1": {
9150    "p": "fffffffffffffffffffffffffffffffeffffac73",
9151    "a": "00",
9152    "b": "07",
9153    "n": "0100000000000000000001b8fa16dfab9aca16b6b3",
9154    "h": "01",
9155    "Gx": "3b4c382ce37aa192a4019e763036f4f5dd4d7ebb",
9156    "Gy": "938cf935318fdced6bc28286531733c3f03c4fee"
9157  },
9158  "secp160r1": {
9159    "p": "ffffffffffffffffffffffffffffffff7fffffff",
9160    "a": "ffffffffffffffffffffffffffffffff7ffffffc",
9161    "b": "1c97befc54bd7a8b65acf89f81d4d4adc565fa45",
9162    "n": "0100000000000000000001f4c8f927aed3ca752257",
9163    "h": "01",
9164    "Gx": "4a96b5688ef573284664698968c38bb913cbfc82",
9165    "Gy": "23a628553168947d59dcc912042351377ac5fb32"
9166  },
9167  "secp192k1": {
9168    "p": "fffffffffffffffffffffffffffffffffffffffeffffee37",
9169    "a": "00",
9170    "b": "03",
9171    "n": "fffffffffffffffffffffffe26f2fc170f69466a74defd8d",
9172    "h": "01",
9173    "Gx": "db4ff10ec057e9ae26b07d0280b7f4341da5d1b1eae06c7d",
9174    "Gy": "9b2f2f6d9c5628a7844163d015be86344082aa88d95e2f9d"
9175  },
9176  "secp192r1": {
9177    "p": "fffffffffffffffffffffffffffffffeffffffffffffffff",
9178    "a": "fffffffffffffffffffffffffffffffefffffffffffffffc",
9179    "b": "64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1",
9180    "n": "ffffffffffffffffffffffff99def836146bc9b1b4d22831",
9181    "h": "01",
9182    "Gx": "188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012",
9183    "Gy": "07192b95ffc8da78631011ed6b24cdd573f977a11e794811"
9184  },
9185  "secp256k1": {
9186    "p": "fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f",
9187    "a": "00",
9188    "b": "07",
9189    "n": "fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",
9190    "h": "01",
9191    "Gx": "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",
9192    "Gy": "483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"
9193  },
9194  "secp256r1": {
9195    "p": "ffffffff00000001000000000000000000000000ffffffffffffffffffffffff",
9196    "a": "ffffffff00000001000000000000000000000000fffffffffffffffffffffffc",
9197    "b": "5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b",
9198    "n": "ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551",
9199    "h": "01",
9200    "Gx": "6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296",
9201    "Gy": "4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5"
9202  }
9203}
9204
9205},{}],49:[function(require,module,exports){
9206var Point = require('./point')
9207var Curve = require('./curve')
9208
9209var getCurveByName = require('./names')
9210
9211module.exports = {
9212  Curve: Curve,
9213  Point: Point,
9214  getCurveByName: getCurveByName
9215}
9216
9217},{"./curve":47,"./names":50,"./point":51}],50:[function(require,module,exports){
9218var BigInteger = require('bigi')
9219
9220var curves = require('./curves')
9221var Curve = require('./curve')
9222
9223function getCurveByName(name) {
9224  var curve = curves[name]
9225  if (!curve) return null
9226
9227  var p = new BigInteger(curve.p, 16)
9228  var a = new BigInteger(curve.a, 16)
9229  var b = new BigInteger(curve.b, 16)
9230  var n = new BigInteger(curve.n, 16)
9231  var h = new BigInteger(curve.h, 16)
9232  var Gx = new BigInteger(curve.Gx, 16)
9233  var Gy = new BigInteger(curve.Gy, 16)
9234
9235  return new Curve(p, a, b, Gx, Gy, n, h)
9236}
9237
9238module.exports = getCurveByName
9239
9240},{"./curve":47,"./curves":48,"bigi":3}],51:[function(require,module,exports){
9241(function (Buffer){
9242var assert = require('assert')
9243var BigInteger = require('bigi')
9244
9245var THREE = BigInteger.valueOf(3)
9246
9247function Point(curve, x, y, z) {
9248  assert.notStrictEqual(z, undefined, 'Missing Z coordinate')
9249
9250  this.curve = curve
9251  this.x = x
9252  this.y = y
9253  this.z = z
9254  this._zInv = null
9255
9256  this.compressed = true
9257}
9258
9259Object.defineProperty(Point.prototype, 'zInv', {
9260  get: function() {
9261    if (this._zInv === null) {
9262      this._zInv = this.z.modInverse(this.curve.p)
9263    }
9264
9265    return this._zInv
9266  }
9267})
9268
9269Object.defineProperty(Point.prototype, 'affineX', {
9270  get: function() {
9271    return this.x.multiply(this.zInv).mod(this.curve.p)
9272  }
9273})
9274
9275Object.defineProperty(Point.prototype, 'affineY', {
9276  get: function() {
9277    return this.y.multiply(this.zInv).mod(this.curve.p)
9278  }
9279})
9280
9281Point.fromAffine = function(curve, x, y) {
9282  return new Point(curve, x, y, BigInteger.ONE)
9283}
9284
9285Point.prototype.equals = function(other) {
9286  if (other === this) return true
9287  if (this.curve.isInfinity(this)) return this.curve.isInfinity(other)
9288  if (this.curve.isInfinity(other)) return this.curve.isInfinity(this)
9289
9290  // u = Y2 * Z1 - Y1 * Z2
9291  var u = other.y.multiply(this.z).subtract(this.y.multiply(other.z)).mod(this.curve.p)
9292
9293  if (u.signum() !== 0) return false
9294
9295  // v = X2 * Z1 - X1 * Z2
9296  var v = other.x.multiply(this.z).subtract(this.x.multiply(other.z)).mod(this.curve.p)
9297
9298  return v.signum() === 0
9299}
9300
9301Point.prototype.negate = function() {
9302  var y = this.curve.p.subtract(this.y)
9303
9304  return new Point(this.curve, this.x, y, this.z)
9305}
9306
9307Point.prototype.add = function(b) {
9308  if (this.curve.isInfinity(this)) return b
9309  if (this.curve.isInfinity(b)) return this
9310
9311  var x1 = this.x
9312  var y1 = this.y
9313  var x2 = b.x
9314  var y2 = b.y
9315
9316  // u = Y2 * Z1 - Y1 * Z2
9317  var u = y2.multiply(this.z).subtract(y1.multiply(b.z)).mod(this.curve.p)
9318  // v = X2 * Z1 - X1 * Z2
9319  var v = x2.multiply(this.z).subtract(x1.multiply(b.z)).mod(this.curve.p)
9320
9321  if (v.signum() === 0) {
9322    if (u.signum() === 0) {
9323      return this.twice() // this == b, so double
9324    }
9325
9326    return this.curve.infinity // this = -b, so infinity
9327  }
9328
9329  var v2 = v.square()
9330  var v3 = v2.multiply(v)
9331  var x1v2 = x1.multiply(v2)
9332  var zu2 = u.square().multiply(this.z)
9333
9334  // x3 = v * (z2 * (z1 * u^2 - 2 * x1 * v^2) - v^3)
9335  var x3 = zu2.subtract(x1v2.shiftLeft(1)).multiply(b.z).subtract(v3).multiply(v).mod(this.curve.p)
9336  // y3 = z2 * (3 * x1 * u * v^2 - y1 * v^3 - z1 * u^3) + u * v^3
9337  var y3 = x1v2.multiply(THREE).multiply(u).subtract(y1.multiply(v3)).subtract(zu2.multiply(u)).multiply(b.z).add(u.multiply(v3)).mod(this.curve.p)
9338  // z3 = v^3 * z1 * z2
9339  var z3 = v3.multiply(this.z).multiply(b.z).mod(this.curve.p)
9340
9341  return new Point(this.curve, x3, y3, z3)
9342}
9343
9344Point.prototype.twice = function() {
9345  if (this.curve.isInfinity(this)) return this
9346  if (this.y.signum() === 0) return this.curve.infinity
9347
9348  var x1 = this.x
9349  var y1 = this.y
9350
9351  var y1z1 = y1.multiply(this.z)
9352  var y1sqz1 = y1z1.multiply(y1).mod(this.curve.p)
9353  var a = this.curve.a
9354
9355  // w = 3 * x1^2 + a * z1^2
9356  var w = x1.square().multiply(THREE)
9357
9358  if (a.signum() !== 0) {
9359    w = w.add(this.z.square().multiply(a))
9360  }
9361
9362  w = w.mod(this.curve.p)
9363  // x3 = 2 * y1 * z1 * (w^2 - 8 * x1 * y1^2 * z1)
9364  var x3 = w.square().subtract(x1.shiftLeft(3).multiply(y1sqz1)).shiftLeft(1).multiply(y1z1).mod(this.curve.p)
9365  // y3 = 4 * y1^2 * z1 * (3 * w * x1 - 2 * y1^2 * z1) - w^3
9366  var y3 = w.multiply(THREE).multiply(x1).subtract(y1sqz1.shiftLeft(1)).shiftLeft(2).multiply(y1sqz1).subtract(w.pow(3)).mod(this.curve.p)
9367  // z3 = 8 * (y1 * z1)^3
9368  var z3 = y1z1.pow(3).shiftLeft(3).mod(this.curve.p)
9369
9370  return new Point(this.curve, x3, y3, z3)
9371}
9372
9373// Simple NAF (Non-Adjacent Form) multiplication algorithm
9374// TODO: modularize the multiplication algorithm
9375Point.prototype.multiply = function(k) {
9376  if (this.curve.isInfinity(this)) return this
9377  if (k.signum() === 0) return this.curve.infinity
9378
9379  var e = k
9380  var h = e.multiply(THREE)
9381
9382  var neg = this.negate()
9383  var R = this
9384
9385  for (var i = h.bitLength() - 2; i > 0; --i) {
9386    R = R.twice()
9387
9388    var hBit = h.testBit(i)
9389    var eBit = e.testBit(i)
9390
9391    if (hBit != eBit) {
9392      R = R.add(hBit ? this : neg)
9393    }
9394  }
9395
9396  return R
9397}
9398
9399// Compute this*j + x*k (simultaneous multiplication)
9400Point.prototype.multiplyTwo = function(j, x, k) {
9401  var i
9402
9403  if (j.bitLength() > k.bitLength())
9404    i = j.bitLength() - 1
9405  else
9406    i = k.bitLength() - 1
9407
9408  var R = this.curve.infinity
9409  var both = this.add(x)
9410
9411  while (i >= 0) {
9412    R = R.twice()
9413
9414    var jBit = j.testBit(i)
9415    var kBit = k.testBit(i)
9416
9417    if (jBit) {
9418      if (kBit) {
9419        R = R.add(both)
9420
9421      } else {
9422        R = R.add(this)
9423      }
9424
9425    } else {
9426      if (kBit) {
9427        R = R.add(x)
9428      }
9429    }
9430    --i
9431  }
9432
9433  return R
9434}
9435
9436Point.prototype.getEncoded = function(compressed) {
9437  if (compressed == undefined) compressed = this.compressed
9438  if (this.curve.isInfinity(this)) return new Buffer('00', 'hex') // Infinity point encoded is simply '00'
9439
9440  var x = this.affineX
9441  var y = this.affineY
9442
9443  var buffer
9444
9445  // Determine size of q in bytes
9446  var byteLength = Math.floor((this.curve.p.bitLength() + 7) / 8)
9447
9448  // 0x02/0x03 | X
9449  if (compressed) {
9450    buffer = new Buffer(1 + byteLength)
9451    buffer.writeUInt8(y.isEven() ? 0x02 : 0x03, 0)
9452
9453  // 0x04 | X | Y
9454  } else {
9455    buffer = new Buffer(1 + byteLength + byteLength)
9456    buffer.writeUInt8(0x04, 0)
9457
9458    y.toBuffer(byteLength).copy(buffer, 1 + byteLength)
9459  }
9460
9461  x.toBuffer(byteLength).copy(buffer, 1)
9462
9463  return buffer
9464}
9465
9466Point.decodeFrom = function(curve, buffer) {
9467  var type = buffer.readUInt8(0)
9468  var compressed = (type !== 4)
9469
9470  var byteLength = Math.floor((curve.p.bitLength() + 7) / 8)
9471  var x = BigInteger.fromBuffer(buffer.slice(1, 1 + byteLength))
9472
9473  var Q
9474  if (compressed) {
9475    assert.equal(buffer.length, byteLength + 1, 'Invalid sequence length')
9476    assert(type === 0x02 || type === 0x03, 'Invalid sequence tag')
9477
9478    var isOdd = (type === 0x03)
9479    Q = curve.pointFromX(isOdd, x)
9480
9481  } else {
9482    assert.equal(buffer.length, 1 + byteLength + byteLength, 'Invalid sequence length')
9483
9484    var y = BigInteger.fromBuffer(buffer.slice(1 + byteLength))
9485    Q = Point.fromAffine(curve, x, y)
9486  }
9487
9488  Q.compressed = compressed
9489  return Q
9490}
9491
9492Point.prototype.toString = function () {
9493  if (this.curve.isInfinity(this)) return '(INFINITY)'
9494
9495  return '(' + this.affineX.toString() + ',' + this.affineY.toString() + ')'
9496}
9497
9498module.exports = Point
9499
9500}).call(this,require("buffer").Buffer)
9501},{"assert":5,"bigi":3,"buffer":7}],52:[function(require,module,exports){
9502(function (process,global,Buffer){
9503'use strict';
9504
9505var crypto = global.crypto || global.msCrypto
9506if(crypto && crypto.getRandomValues) {
9507  module.exports = randomBytes;
9508} else {
9509  module.exports = oldBrowser;
9510}
9511function randomBytes(size, cb) {
9512  var bytes = new Buffer(size); //in browserify, this is an extended Uint8Array
9513    /* This will not work in older browsers.
9514     * See https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues
9515     */
9516
9517  crypto.getRandomValues(bytes);
9518  if (typeof cb === 'function') {
9519    return process.nextTick(function () {
9520      cb(null, bytes);
9521    });
9522  }
9523  return bytes;
9524}
9525function oldBrowser() {
9526  throw new Error(
9527      'secure random number generation not supported by this browser\n'+
9528      'use chrome, FireFox or Internet Explorer 11'
9529    )
9530}
9531
9532}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer)
9533},{"_process":14,"buffer":7}],53:[function(require,module,exports){
9534(function (Buffer){
9535'use strict';
9536
9537function getFunctionName(fn) {
9538  return fn.name || fn.toString().match(/function (.*?)\s*\(/)[1];
9539}
9540
9541function getTypeTypeName(type) {
9542  if (nativeTypes.Function(type)) {
9543    type = type.toJSON ? type.toJSON() : getFunctionName(type);
9544  }
9545  if (nativeTypes.Object(type)) return JSON.stringify(type);
9546
9547  return type;
9548}
9549
9550function getValueTypeName(value) {
9551  if (nativeTypes.Null(value)) return '';
9552
9553  return getFunctionName(value.constructor);
9554}
9555
9556function tfErrorString(type, value) {
9557  var typeTypeName = getTypeTypeName(type);
9558  var valueTypeName = getValueTypeName(value);
9559
9560  return 'Expected ' + typeTypeName + ', got ' + (valueTypeName && valueTypeName + ' ') + JSON.stringify(value);
9561}
9562
9563function tfPropertyErrorString(type, name, value) {
9564  return tfErrorString('property \"' + name + '\" of type ' + getTypeTypeName(type), value);
9565}
9566
9567var nativeTypes = {
9568  Array: (function (_Array) {
9569    function Array(_x) {
9570      return _Array.apply(this, arguments);
9571    }
9572
9573    Array.toString = function () {
9574      return _Array.toString();
9575    };
9576
9577    return Array;
9578  })(function (value) {
9579    return value !== null && value !== undefined && value.constructor === Array;
9580  }),
9581  Boolean: function Boolean(value) {
9582    return typeof value === 'boolean';
9583  },
9584  Buffer: (function (_Buffer) {
9585    function Buffer(_x2) {
9586      return _Buffer.apply(this, arguments);
9587    }
9588
9589    Buffer.toString = function () {
9590      return _Buffer.toString();
9591    };
9592
9593    return Buffer;
9594  })(function (value) {
9595    return Buffer.isBuffer(value);
9596  }),
9597  Function: function Function(value) {
9598    return typeof value === 'function';
9599  },
9600  Null: function Null(value) {
9601    return value === undefined || value === null;
9602  },
9603  Number: function Number(value) {
9604    return typeof value === 'number';
9605  },
9606  Object: function Object(value) {
9607    return typeof value === 'object';
9608  },
9609  String: function String(value) {
9610    return typeof value === 'string';
9611  },
9612  '': function _() {
9613    return true;
9614  }
9615};
9616
9617function tJSON(type) {
9618  return type && type.toJSON ? type.toJSON() : type;
9619}
9620
9621function sJSON(type) {
9622  var json = tJSON(type);
9623  return nativeTypes.Object(json) ? JSON.stringify(json) : json;
9624}
9625
9626var otherTypes = {
9627  arrayOf: function arrayOf(type) {
9628    function arrayOf(value, strict) {
9629      try {
9630        return nativeTypes.Array(value) && value.every(function (x) {
9631          return typeforce(type, x, strict);
9632        });
9633      } catch (e) {
9634        return false;
9635      }
9636    }
9637    arrayOf.toJSON = function () {
9638      return [tJSON(type)];
9639    };
9640
9641    return arrayOf;
9642  },
9643
9644  maybe: function maybe(type) {
9645    function maybe(value, strict) {
9646      return nativeTypes.Null(value) || typeforce(type, value, strict);
9647    }
9648    maybe.toJSON = function () {
9649      return '?' + sJSON(type);
9650    };
9651
9652    return maybe;
9653  },
9654
9655  object: function object(type) {
9656    function object(value, strict) {
9657      typeforce(nativeTypes.Object, value, strict);
9658
9659      var propertyName, propertyType, propertyValue;
9660
9661      try {
9662        for (propertyName in type) {
9663          propertyType = type[propertyName];
9664          propertyValue = value[propertyName];
9665
9666          typeforce(propertyType, propertyValue, strict);
9667        }
9668      } catch (e) {
9669        throw new TypeError(tfPropertyErrorString(propertyType, propertyName, propertyValue));
9670      }
9671
9672      if (strict) {
9673        for (propertyName in value) {
9674          if (type[propertyName]) continue;
9675
9676          throw new TypeError('Unexpected property "' + propertyName + '"');
9677        }
9678      }
9679
9680      return true;
9681    }
9682    object.toJSON = function () {
9683      return type;
9684    };
9685
9686    return object;
9687  },
9688
9689  oneOf: function oneOf() {
9690    for (var _len = arguments.length, types = Array(_len), _key = 0; _key < _len; _key++) {
9691      types[_key] = arguments[_key];
9692    }
9693
9694    function oneOf(value, strict) {
9695      return types.some(function (type) {
9696        try {
9697          return typeforce(type, value, strict);
9698        } catch (e) {
9699          return false;
9700        }
9701      });
9702    }
9703    oneOf.toJSON = function () {
9704      return types.map(sJSON).join('|');
9705    };
9706
9707    return oneOf;
9708  },
9709
9710  quacksLike: function quacksLike(type) {
9711    function quacksLike(value, strict) {
9712      return type === getValueTypeName(value);
9713    }
9714    quacksLike.toJSON = function () {
9715      return type;
9716    };
9717
9718    return quacksLike;
9719  },
9720
9721  tuple: function tuple() {
9722    for (var _len2 = arguments.length, types = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
9723      types[_key2] = arguments[_key2];
9724    }
9725
9726    function tuple(value, strict) {
9727      return types.every(function (type, i) {
9728        return typeforce(type, value[i], strict);
9729      });
9730    }
9731    tuple.toJSON = function () {
9732      return '(' + types.map(sJSON).join(', ') + ')';
9733    };
9734
9735    return tuple;
9736  },
9737
9738  value: function value(expected) {
9739    function value(actual) {
9740      return actual === expected;
9741    }
9742    value.toJSON = function () {
9743      return expected;
9744    };
9745
9746    return value;
9747  }
9748};
9749
9750function compile(type) {
9751  if (nativeTypes.String(type)) {
9752    if (type[0] === '?') return otherTypes.maybe(compile(type.slice(1)));
9753
9754    return nativeTypes[type] || otherTypes.quacksLike(type);
9755  } else if (type && nativeTypes.Object(type)) {
9756    if (nativeTypes.Array(type)) return otherTypes.arrayOf(compile(type[0]));
9757
9758    var compiled = {};
9759
9760    for (var propertyName in type) {
9761      compiled[propertyName] = compile(type[propertyName]);
9762    }
9763
9764    return otherTypes.object(compiled);
9765  } else if (nativeTypes.Function(type)) {
9766    return type;
9767  }
9768
9769  return otherTypes.value(type);
9770}
9771
9772function typeforce(_x3, _x4, _x5) {
9773  var _again = true;
9774
9775  _function: while (_again) {
9776    var type = _x3,
9777        value = _x4,
9778        strict = _x5;
9779    _again = false;
9780
9781    if (nativeTypes.Function(type)) {
9782      if (type(value, strict)) return true;
9783
9784      throw new TypeError(tfErrorString(type, value));
9785    }
9786
9787    // JIT
9788    _x3 = compile(type);
9789    _x4 = value;
9790    _x5 = strict;
9791    _again = true;
9792    continue _function;
9793  }
9794}
9795
9796// assign all types to typeforce function
9797var typeName;
9798Object.keys(nativeTypes).forEach(function (typeName) {
9799  var nativeType = nativeTypes[typeName];
9800  nativeType.toJSON = function () {
9801    return typeName;
9802  };
9803
9804  typeforce[typeName] = nativeType;
9805});
9806
9807for (typeName in otherTypes) {
9808  typeforce[typeName] = otherTypes[typeName];
9809}
9810
9811module.exports = typeforce;
9812module.exports.compile = compile;
9813}).call(this,require("buffer").Buffer)
9814},{"buffer":7}],54:[function(require,module,exports){
9815(function (Buffer){
9816var assert = require('assert')
9817var base58check = require('bs58check')
9818var typeForce = require('typeforce')
9819var networks = require('./networks')
9820var scripts = require('./scripts')
9821
9822function findScriptTypeByVersion (version) {
9823  for (var networkName in networks) {
9824    var network = networks[networkName]
9825
9826    if (version === network.pubKeyHash) return 'pubkeyhash'
9827    if (version === network.scriptHash) return 'scripthash'
9828  }
9829}
9830
9831function Address (hash, version) {
9832  typeForce('Buffer', hash)
9833
9834  assert.strictEqual(hash.length, 20, 'Invalid hash length')
9835  assert.strictEqual(version & 0xff, version, 'Invalid version byte')
9836
9837  this.hash = hash
9838  this.version = version
9839}
9840
9841Address.fromBase58Check = function (string) {
9842  var payload = base58check.decode(string)
9843  var version = payload.readUInt8(0)
9844  var hash = payload.slice(1)
9845
9846  return new Address(hash, version)
9847}
9848
9849Address.fromOutputScript = function (script, network) {
9850  network = network || networks.bitcoin
9851
9852  if (scripts.isPubKeyHashOutput(script)) return new Address(script.chunks[2], network.pubKeyHash)
9853  if (scripts.isScriptHashOutput(script)) return new Address(script.chunks[1], network.scriptHash)
9854
9855  assert(false, script.toASM() + ' has no matching Address')
9856}
9857
9858Address.prototype.toBase58Check = function () {
9859  var payload = new Buffer(21)
9860  payload.writeUInt8(this.version, 0)
9861  this.hash.copy(payload, 1)
9862
9863  return base58check.encode(payload)
9864}
9865
9866Address.prototype.toOutputScript = function () {
9867  var scriptType = findScriptTypeByVersion(this.version)
9868
9869  if (scriptType === 'pubkeyhash') return scripts.pubKeyHashOutput(this.hash)
9870  if (scriptType === 'scripthash') return scripts.scriptHashOutput(this.hash)
9871
9872  assert(false, this.toString() + ' has no matching Script')
9873}
9874
9875Address.prototype.toString = Address.prototype.toBase58Check
9876
9877module.exports = Address
9878
9879}).call(this,require("buffer").Buffer)
9880},{"./networks":66,"./scripts":69,"assert":5,"bs58check":31,"buffer":7,"typeforce":53}],55:[function(require,module,exports){
9881var bs58check = require('bs58check')
9882
9883function decode () {
9884  console.warn('bs58check will be removed in 2.0.0. require("bs58check") instead.')
9885
9886  return bs58check.decode.apply(undefined, arguments)
9887}
9888
9889function encode () {
9890  console.warn('bs58check will be removed in 2.0.0. require("bs58check") instead.')
9891
9892  return bs58check.encode.apply(undefined, arguments)
9893}
9894
9895module.exports = {
9896  decode: decode,
9897  encode: encode
9898}
9899
9900},{"bs58check":31}],56:[function(require,module,exports){
9901(function (Buffer){
9902var assert = require('assert')
9903var bufferutils = require('./bufferutils')
9904var crypto = require('./crypto')
9905
9906var Transaction = require('./transaction')
9907
9908function Block () {
9909  this.version = 1
9910  this.prevHash = null
9911  this.merkleRoot = null
9912  this.timestamp = 0
9913  this.bits = 0
9914  this.nonce = 0
9915}
9916
9917Block.fromBuffer = function (buffer) {
9918  assert(buffer.length >= 80, 'Buffer too small (< 80 bytes)')
9919
9920  var offset = 0
9921  function readSlice (n) {
9922    offset += n
9923    return buffer.slice(offset - n, offset)
9924  }
9925
9926  function readUInt32 () {
9927    var i = buffer.readUInt32LE(offset)
9928    offset += 4
9929    return i
9930  }
9931
9932  var block = new Block()
9933  block.version = readUInt32()
9934  block.prevHash = readSlice(32)
9935  block.merkleRoot = readSlice(32)
9936  block.timestamp = readUInt32()
9937  block.bits = readUInt32()
9938  block.nonce = readUInt32()
9939
9940  if (buffer.length === 80) return block
9941
9942  function readVarInt () {
9943    var vi = bufferutils.readVarInt(buffer, offset)
9944    offset += vi.size
9945    return vi.number
9946  }
9947
9948  // FIXME: poor performance
9949  function readTransaction () {
9950    var tx = Transaction.fromBuffer(buffer.slice(offset), true)
9951
9952    offset += tx.toBuffer().length
9953    return tx
9954  }
9955
9956  var nTransactions = readVarInt()
9957  block.transactions = []
9958
9959  for (var i = 0; i < nTransactions; ++i) {
9960    var tx = readTransaction()
9961    block.transactions.push(tx)
9962  }
9963
9964  return block
9965}
9966
9967Block.fromHex = function (hex) {
9968  return Block.fromBuffer(new Buffer(hex, 'hex'))
9969}
9970
9971Block.prototype.getHash = function () {
9972  return crypto.hash256(this.toBuffer(true))
9973}
9974
9975Block.prototype.getId = function () {
9976  return bufferutils.reverse(this.getHash()).toString('hex')
9977}
9977
9978
9979Block.prototype.getUTCDate = function () {
9980  var date = new Date(0) // epoch
9981  date.setUTCSeconds(this.timestamp)
9982
9983  return date
9984}
9985
9986Block.prototype.toBuffer = function (headersOnly) {
9987  var buffer = new Buffer(80)
9988
9989  var offset = 0
9990  function writeSlice (slice) {
9991    slice.copy(buffer, offset)
9992    offset += slice.length
9993  }
9994
9995  function writeUInt32 (i) {
9996    buffer.writeUInt32LE(i, offset)
9997    offset += 4
9998  }
9999
10000  writeUInt32(this.version)
10001  writeSlice(this.prevHash)
10002  writeSlice(this.merkleRoot)
10003  writeUInt32(this.timestamp)
10004  writeUInt32(this.bits)
10005  writeUInt32(this.nonce)
10006
10007  if (headersOnly || !this.transactions) return buffer
10008
10009  var txLenBuffer = bufferutils.varIntBuffer(this.transactions.length)
10010  var txBuffers = this.transactions.map(function (tx) {
10011    return tx.toBuffer()
10012  })
10013
10014  return Buffer.concat([buffer, txLenBuffer].concat(txBuffers))
10015}
10016
10017Block.prototype.toHex = function (headersOnly) {
10018  return this.toBuffer(headersOnly).toString('hex')
10019}
10020
10021module.exports = Block
10022
10023}).call(this,require("buffer").Buffer)
10024},{"./bufferutils":57,"./crypto":58,"./transaction":70,"assert":5,"buffer":7}],57:[function(require,module,exports){
10025(function (Buffer){
10026var assert = require('assert')
10027var opcodes = require('./opcodes')
10028
10029// https://github.com/feross/buffer/blob/master/index.js#L1127
10030function verifuint (value, max) {
10031  assert(typeof value === 'number', 'cannot write a non-number as a number')
10032  assert(value >= 0, 'specified a negative value for writing an unsigned value')
10033  assert(value <= max, 'value is larger than maximum value for type')
10034  assert(Math.floor(value) === value, 'value has a fractional component')
10035}
10036
10037function pushDataSize (i) {
10038  return i < opcodes.OP_PUSHDATA1 ? 1
10039  : i < 0xff ? 2
10040  : i < 0xffff ? 3
10041  : 5
10042}
10043
10044function readPushDataInt (buffer, offset) {
10045  var opcode = buffer.readUInt8(offset)
10046  var number, size
10047
10048  // ~6 bit
10049  if (opcode < opcodes.OP_PUSHDATA1) {
10050    number = opcode
10051    size = 1
10052
10053  // 8 bit
10054  } else if (opcode === opcodes.OP_PUSHDATA1) {
10055    if (offset + 2 > buffer.length) return null
10056    number = buffer.readUInt8(offset + 1)
10057    size = 2
10058
10059  // 16 bit
10060  } else if (opcode === opcodes.OP_PUSHDATA2) {
10061    if (offset + 3 > buffer.length) return null
10062    number = buffer.readUInt16LE(offset + 1)
10063    size = 3
10064
10065  // 32 bit
10066  } else {
10067    if (offset + 5 > buffer.length) return null
10068    assert.equal(opcode, opcodes.OP_PUSHDATA4, 'Unexpected opcode')
10069
10070    number = buffer.readUInt32LE(offset + 1)
10071    size = 5
10072  }
10073
10074  return {
10075    opcode: opcode,
10076    number: number,
10077    size: size
10078  }
10079}
10080
10081function readUInt64LE (buffer, offset) {
10082  var a = buffer.readUInt32LE(offset)
10083  var b = buffer.readUInt32LE(offset + 4)
10084  b *= 0x100000000
10085
10086  verifuint(b + a, 0x001fffffffffffff)
10087
10088  return b + a
10089}
10090
10091function readVarInt (buffer, offset) {
10092  var t = buffer.readUInt8(offset)
10093  var number, size
10094
10095  // 8 bit
10096  if (t < 253) {
10097    number = t
10098    size = 1
10099
10100  // 16 bit
10101  } else if (t < 254) {
10102    number = buffer.readUInt16LE(offset + 1)
10103    size = 3
10104
10105  // 32 bit
10106  } else if (t < 255) {
10107    number = buffer.readUInt32LE(offset + 1)
10108    size = 5
10109
10110  // 64 bit
10111  } else {
10112    number = readUInt64LE(buffer, offset + 1)
10113    size = 9
10114  }
10115
10116  return {
10117    number: number,
10118    size: size
10119  }
10120}
10121
10122function writePushDataInt (buffer, number, offset) {
10123  var size = pushDataSize(number)
10124
10125  // ~6 bit
10126  if (size === 1) {
10127    buffer.writeUInt8(number, offset)
10128
10129  // 8 bit
10130  } else if (size === 2) {
10131    buffer.writeUInt8(opcodes.OP_PUSHDATA1, offset)
10132    buffer.writeUInt8(number, offset + 1)
10133
10134  // 16 bit
10135  } else if (size === 3) {
10136    buffer.writeUInt8(opcodes.OP_PUSHDATA2, offset)
10137    buffer.writeUInt16LE(number, offset + 1)
10138
10139  // 32 bit
10140  } else {
10141    buffer.writeUInt8(opcodes.OP_PUSHDATA4, offset)
10142    buffer.writeUInt32LE(number, offset + 1)
10143  }
10144
10145  return size
10146}
10147
10148function writeUInt64LE (buffer, value, offset) {
10149  verifuint(value, 0x001fffffffffffff)
10150
10151  buffer.writeInt32LE(value & -1, offset)
10152  buffer.writeUInt32LE(Math.floor(value / 0x100000000), offset + 4)
10153}
10154
10155function varIntSize (i) {
10156  return i < 253 ? 1
10157  : i < 0x10000 ? 3
10158  : i < 0x100000000 ? 5
10159  : 9
10160}
10161
10162function writeVarInt (buffer, number, offset) {
10163  var size = varIntSize(number)
10164
10165  // 8 bit
10166  if (size === 1) {
10167    buffer.writeUInt8(number, offset)
10168
10169  // 16 bit
10170  } else if (size === 3) {
10171    buffer.writeUInt8(253, offset)
10172    buffer.writeUInt16LE(number, offset + 1)
10173
10174  // 32 bit
10175  } else if (size === 5) {
10176    buffer.writeUInt8(254, offset)
10177    buffer.writeUInt32LE(number, offset + 1)
10178
10179  // 64 bit
10180  } else {
10181    buffer.writeUInt8(255, offset)
10182    writeUInt64LE(buffer, number, offset + 1)
10183  }
10184
10185  return size
10186}
10187
10188function varIntBuffer (i) {
10189  var size = varIntSize(i)
10190  var buffer = new Buffer(size)
10191  writeVarInt(buffer, i, 0)
10192
10193  return buffer
10194}
10195
10196function reverse (buffer) {
10197  var buffer2 = new Buffer(buffer)
10198  Array.prototype.reverse.call(buffer2)
10199  return buffer2
10200}
10201
10202module.exports = {
10203  pushDataSize: pushDataSize,
10204  readPushDataInt: readPushDataInt,
10205  readUInt64LE: readUInt64LE,
10206  readVarInt: readVarInt,
10207  reverse: reverse,
10208  varIntBuffer: varIntBuffer,
10209  varIntSize: varIntSize,
10210  writePushDataInt: writePushDataInt,
10211  writeUInt64LE: writeUInt64LE,
10212  writeVarInt: writeVarInt
10213}
10214
10215}).call(this,require("buffer").Buffer)
10216},{"./opcodes":67,"assert":5,"buffer":7}],58:[function(require,module,exports){
10217var createHash = require('create-hash')
10218
10219function hash160 (buffer) {
10220  return ripemd160(sha256(buffer))
10221}
10222
10223function hash256 (buffer) {
10224  return sha256(sha256(buffer))
10225}
10226
10227function ripemd160 (buffer) {
10228  return createHash('rmd160').update(buffer).digest()
10229}
10230
10231function sha1 (buffer) {
10232  return createHash('sha1').update(buffer).digest()
10233}
10234
10235function sha256 (buffer) {
10236  return createHash('sha256').update(buffer).digest()
10237}
10238
10239// FIXME: Name not consistent with others
10240var createHmac = require('create-hmac')
10241
10242function HmacSHA256 (buffer, secret) {
10243  console.warn('Hmac* functions are deprecated for removal in 2.0.0, use node crypto instead')
10244  return createHmac('sha256', secret).update(buffer).digest()
10245}
10246
10247function HmacSHA512 (buffer, secret) {
10248  console.warn('Hmac* functions are deprecated for removal in 2.0.0, use node crypto instead')
10249  return createHmac('sha512', secret).update(buffer).digest()
10250}
10251
10252module.exports = {
10253  ripemd160: ripemd160,
10254  sha1: sha1,
10255  sha256: sha256,
10256  hash160: hash160,
10257  hash256: hash256,
10258  HmacSHA256: HmacSHA256,
10259  HmacSHA512: HmacSHA512
10260}
10261
10262},{"create-hash":32,"create-hmac":45}],59:[function(require,module,exports){
10263(function (Buffer){
10264var assert = require('assert')
10265var createHmac = require('create-hmac')
10266var typeForce = require('typeforce')
10267
10268var BigInteger = require('bigi')
10269var ECSignature = require('./ecsignature')
10270
10271var ZERO = new Buffer([0])
10272var ONE = new Buffer([1])
10273
10274// https://tools.ietf.org/html/rfc6979#section-3.2
10275function deterministicGenerateK (curve, hash, d, checkSig) {
10276  typeForce('Buffer', hash)
10277  typeForce('BigInteger', d)
10278
10279  // FIXME: remove/uncomment for 2.0.0
10280  //  typeForce('Function', checkSig)
10281
10282  if (typeof checkSig !== 'function') {
10283    console.warn('deterministicGenerateK requires a checkSig callback in 2.0.0, see #337 for more information')
10284
10285    checkSig = function (k) {
10286      var G = curve.G
10287      var n = curve.n
10288      var e = BigInteger.fromBuffer(hash)
10289
10290      var Q = G.multiply(k)
10291
10292      if (curve.isInfinity(Q))
10293        return false
10294
10295      var r = Q.affineX.mod(n)
10296      if (r.signum() === 0)
10297        return false
10298
10299      var s = k.modInverse(n).multiply(e.add(d.multiply(r))).mod(n)
10300      if (s.signum() === 0)
10301        return false
10302
10303      return true
10304    }
10305  }
10306
10307  // sanity check
10308  assert.equal(hash.length, 32, 'Hash must be 256 bit')
10309
10310  var x = d.toBuffer(32)
10311  var k = new Buffer(32)
10312  var v = new Buffer(32)
10313
10314  // Step A, ignored as hash already provided
10315  // Step B
10316  v.fill(1)
10317
10318  // Step C
10319  k.fill(0)
10320
10321  // Step D
10322  k = createHmac('sha256', k)
10323    .update(v)
10324    .update(ZERO)
10325    .update(x)
10326    .update(hash)
10327    .digest()
10328
10329  // Step E
10330  v = createHmac('sha256', k).update(v).digest()
10331
10332  // Step F
10333  k = createHmac('sha256', k)
10334    .update(v)
10335    .update(ONE)
10336    .update(x)
10337    .update(hash)
10338    .digest()
10339
10340  // Step G
10341  v = createHmac('sha256', k).update(v).digest()
10342
10343  // Step H1/H2a, ignored as tlen === qlen (256 bit)
10344  // Step H2b
10345  v = createHmac('sha256', k).update(v).digest()
10346
10347  var T = BigInteger.fromBuffer(v)
10348
10349  // Step H3, repeat until T is within the interval [1, n - 1] and is suitable for ECDSA
10350  while ((T.signum() <= 0) || (T.compareTo(curve.n) >= 0) || !checkSig(T)) {
10351    k = createHmac('sha256', k)
10352      .update(v)
10353      .update(ZERO)
10354      .digest()
10355
10356    v = createHmac('sha256', k).update(v).digest()
10357
10358    // Step H1/H2a, again, ignored as tlen === qlen (256 bit)
10359    // Step H2b again
10360    v = createHmac('sha256', k).update(v).digest()
10361    T = BigInteger.fromBuffer(v)
10362  }
10363
10364  return T
10365}
10366
10367function sign (curve, hash, d) {
10368  var r, s
10369
10370  var e = BigInteger.fromBuffer(hash)
10371  var n = curve.n
10372  var G = curve.G
10373
10374  deterministicGenerateK(curve, hash, d, function (k) {
10375    var Q = G.multiply(k)
10376
10377    if (curve.isInfinity(Q))
10378      return false
10379
10380    r = Q.affineX.mod(n)
10381    if (r.signum() === 0)
10382      return false
10383
10384    s = k.modInverse(n).multiply(e.add(d.multiply(r))).mod(n)
10385    if (s.signum() === 0)
10386      return false
10387
10388    return true
10389  })
10390
10391  var N_OVER_TWO = n.shiftRight(1)
10392
10393  // enforce low S values, see bip62: 'low s values in signatures'
10394  if (s.compareTo(N_OVER_TWO) > 0) {
10395    s = n.subtract(s)
10396  }
10397
10398  return new ECSignature(r, s)
10399}
10400
10401function verifyRaw (curve, e, signature, Q) {
10402  var n = curve.n
10403  var G = curve.G
10404
10405  var r = signature.r
10406  var s = signature.s
10407
10408  // 1.4.1 Enforce r and s are both integers in the interval [1, n − 1]
10409  if (r.signum() <= 0 || r.compareTo(n) >= 0) return false
10410  if (s.signum() <= 0 || s.compareTo(n) >= 0) return false
10411
10412  // c = s^-1 mod n
10413  var c = s.modInverse(n)
10414
10415  // 1.4.4 Compute u1 = es^−1 mod n
10416  //               u2 = rs^−1 mod n
10417  var u1 = e.multiply(c).mod(n)
10418  var u2 = r.multiply(c).mod(n)
10419
10420  // 1.4.5 Compute R = (xR, yR) = u1G + u2Q
10421  var R = G.multiplyTwo(u1, Q, u2)
10422  var v = R.affineX.mod(n)
10423
10424  // 1.4.5 (cont.) Enforce R is not at infinity
10425  if (curve.isInfinity(R)) return false
10426
10427  // 1.4.8 If v = r, output "valid", and if v != r, output "invalid"
10428  return v.equals(r)
10429}
10430
10431function verify (curve, hash, signature, Q) {
10432  // 1.4.2 H = Hash(M), already done by the user
10433  // 1.4.3 e = H
10434  var e = BigInteger.fromBuffer(hash)
10435
10436  return verifyRaw(curve, e, signature, Q)
10437}
10438
10439/**
10440  * Recover a public key from a signature.
10441  *
10442  * See SEC 1: Elliptic Curve Cryptography, section 4.1.6, "Public
10443  * Key Recovery Operation".
10444  *
10445  * http://www.secg.org/download/aid-780/sec1-v2.pdf
10446  */
10447function recoverPubKey (curve, e, signature, i) {
10448  assert.strictEqual(i & 3, i, 'Recovery param is more than two bits')
10449
10450  var n = curve.n
10451  var G = curve.G
10452
10453  var r = signature.r
10454  var s = signature.s
10455
10456  assert(r.signum() > 0 && r.compareTo(n) < 0, 'Invalid r value')
10457  assert(s.signum() > 0 && s.compareTo(n) < 0, 'Invalid s value')
10458
10459  // A set LSB signifies that the y-coordinate is odd
10460  var isYOdd = i & 1
10461
10462  // The more significant bit specifies whether we should use the
10463  // first or second candidate key.
10464  var isSecondKey = i >> 1
10465
10466  // 1.1 Let x = r + jn
10467  var x = isSecondKey ? r.add(n) : r
10468  var R = curve.pointFromX(isYOdd, x)
10469
10470  // 1.4 Check that nR is at infinity
10471  var nR = R.multiply(n)
10472  assert(curve.isInfinity(nR), 'nR is not a valid curve point')
10473
10474  // Compute -e from e
10475  var eNeg = e.negate().mod(n)
10476
10477  // 1.6.1 Compute Q = r^-1 (sR -  eG)
10478  //               Q = r^-1 (sR + -eG)
10479  var rInv = r.modInverse(n)
10480
10481  var Q = R.multiplyTwo(s, G, eNeg).multiply(rInv)
10482  curve.validate(Q)
10483
10484  return Q
10485}
10486
10487/**
10488  * Calculate pubkey extraction parameter.
10489  *
10490  * When extracting a pubkey from a signature, we have to
10491  * distinguish four different cases. Rather than putting this
10492  * burden on the verifier, Bitcoin includes a 2-bit value with the
10493  * signature.
10494  *
10495  * This function simply tries all four cases and returns the value
10496  * that resulted in a successful pubkey recovery.
10497  */
10498function calcPubKeyRecoveryParam (curve, e, signature, Q) {
10499  for (var i = 0; i < 4; i++) {
10500    var Qprime = recoverPubKey(curve, e, signature, i)
10501
10502    // 1.6.2 Verify Q
10503    if (Qprime.equals(Q)) {
10504      return i
10505    }
10506  }
10507
10508  throw new Error('Unable to find valid recovery factor')
10509}
10510
10511module.exports = {
10512  calcPubKeyRecoveryParam: calcPubKeyRecoveryParam,
10513  deterministicGenerateK: deterministicGenerateK,
10514  recoverPubKey: recoverPubKey,
10515  sign: sign,
10516  verify: verify,
10517  verifyRaw: verifyRaw
10518}
10519
10520}).call(this,require("buffer").Buffer)
10521},{"./ecsignature":62,"assert":5,"bigi":3,"buffer":7,"create-hmac":45,"typeforce":53}],60:[function(require,module,exports){
10522(function (Buffer){
10523var assert = require('assert')
10524var base58check = require('bs58check')
10525var ecdsa = require('./ecdsa')
10526var networks = require('./networks')
10527var randomBytes = require('randombytes')
10528var typeForce = require('typeforce')
10529
10530var BigInteger = require('bigi')
10531var ECPubKey = require('./ecpubkey')
10532
10533var ecurve = require('ecurve')
10534var secp256k1 = ecurve.getCurveByName('secp256k1')
10535
10536function ECKey (d, compressed) {
10537  assert(d.signum() > 0, 'Private key must be greater than 0')
10538  assert(d.compareTo(ECKey.curve.n) < 0, 'Private key must be less than the curve order')
10539
10540  var Q = ECKey.curve.G.multiply(d)
10541
10542  this.d = d
10543  this.pub = new ECPubKey(Q, compressed)
10544}
10545
10546// Constants
10547ECKey.curve = secp256k1
10548
10549// Static constructors
10550ECKey.fromWIF = function (string) {
10551  var payload = base58check.decode(string)
10552  var compressed = false
10553
10554  // Ignore the version byte
10555  payload = payload.slice(1)
10556
10557  if (payload.length === 33) {
10558    assert.strictEqual(payload[32], 0x01, 'Invalid compression flag')
10559
10560    // Truncate the compression flag
10561    payload = payload.slice(0, -1)
10562    compressed = true
10563  }
10564
10565  assert.equal(payload.length, 32, 'Invalid WIF payload length')
10566
10567  var d = BigInteger.fromBuffer(payload)
10568  return new ECKey(d, compressed)
10569}
10570
10571ECKey.makeRandom = function (compressed, rng) {
10572  rng = rng || randomBytes
10573
10574  var buffer = rng(32)
10575  typeForce('Buffer', buffer)
10576  assert.equal(buffer.length, 32, 'Expected 256-bit Buffer from RNG')
10577
10578  var d = BigInteger.fromBuffer(buffer)
10579  d = d.mod(ECKey.curve.n)
10580
10581  return new ECKey(d, compressed)
10582}
10583
10584// Export functions
10585ECKey.prototype.toWIF = function (network) {
10586  network = network || networks.bitcoin
10587
10588  var bufferLen = this.pub.compressed ? 34 : 33
10589  var buffer = new Buffer(bufferLen)
10590
10591  buffer.writeUInt8(network.wif, 0)
10592  this.d.toBuffer(32).copy(buffer, 1)
10593
10594  if (this.pub.compressed) {
10595    buffer.writeUInt8(0x01, 33)
10596  }
10597
10598  return base58check.encode(buffer)
10599}
10600
10601// Operations
10602ECKey.prototype.sign = function (hash) {
10603  return ecdsa.sign(ECKey.curve, hash, this.d)
10604}
10605
10606module.exports = ECKey
10607
10608}).call(this,require("buffer").Buffer)
10609},{"./ecdsa":59,"./ecpubkey":61,"./networks":66,"assert":5,"bigi":3,"bs58check":31,"buffer":7,"ecurve":49,"randombytes":52,"typeforce":53}],61:[function(require,module,exports){
10610(function (Buffer){
10611var crypto = require('./crypto')
10612var ecdsa = require('./ecdsa')
10613var typeForce = require('typeforce')
10614var networks = require('./networks')
10615
10616var Address = require('./address')
10617
10618var ecurve = require('ecurve')
10619var secp256k1 = ecurve.getCurveByName('secp256k1')
10620
10621function ECPubKey (Q, compressed) {
10622  if (compressed === undefined) {
10623    compressed = true
10624  }
10625
10626  typeForce('Point', Q)
10627  typeForce('Boolean', compressed)
10628
10629  this.compressed = compressed
10630  this.Q = Q
10631}
10632
10633// Constants
10634ECPubKey.curve = secp256k1
10635
10636// Static constructors
10637ECPubKey.fromBuffer = function (buffer) {
10638  var Q = ecurve.Point.decodeFrom(ECPubKey.curve, buffer)
10639  return new ECPubKey(Q, Q.compressed)
10640}
10641
10642ECPubKey.fromHex = function (hex) {
10643  return ECPubKey.fromBuffer(new Buffer(hex, 'hex'))
10644}
10645
10646// Operations
10647ECPubKey.prototype.getAddress = function (network) {
10648  network = network || networks.bitcoin
10649
10650  return new Address(crypto.hash160(this.toBuffer()), network.pubKeyHash)
10651}
10652
10653ECPubKey.prototype.verify = function (hash, signature) {
10654  return ecdsa.verify(ECPubKey.curve, hash, signature, this.Q)
10655}
10656
10657// Export functions
10658ECPubKey.prototype.toBuffer = function () {
10659  return this.Q.getEncoded(this.compressed)
10660}
10661
10662ECPubKey.prototype.toHex = function () {
10663  return this.toBuffer().toString('hex')
10664}
10665
10666module.exports = ECPubKey
10667
10668}).call(this,require("buffer").Buffer)
10669},{"./address":54,"./crypto":58,"./ecdsa":59,"./networks":66,"buffer":7,"ecurve":49,"typeforce":53}],62:[function(require,module,exports){
10670(function (Buffer){
10671var assert = require('assert')
10672var typeForce = require('typeforce')
10673
10674var BigInteger = require('bigi')
10675
10676function ECSignature (r, s) {
10677  typeForce('BigInteger', r)
10678  typeForce('BigInteger', s)
10679
10680  this.r = r
10681  this.s = s
10682}
10683
10684ECSignature.parseCompact = function (buffer) {
10685  assert.equal(buffer.length, 65, 'Invalid signature length')
10686  var i = buffer.readUInt8(0) - 27
10687
10688  // At most 3 bits
10689  assert.equal(i, i & 7, 'Invalid signature parameter')
10690  var compressed = !!(i & 4)
10691
10692  // Recovery param only
10693  i = i & 3
10694
10695  var r = BigInteger.fromBuffer(buffer.slice(1, 33))
10696  var s = BigInteger.fromBuffer(buffer.slice(33))
10697
10698  return {
10699    compressed: compressed,
10700    i: i,
10701    signature: new ECSignature(r, s)
10702  }
10703}
10704
10705ECSignature.fromDER = function (buffer) {
10706  assert.equal(buffer.readUInt8(0), 0x30, 'Not a DER sequence')
10707  assert.equal(buffer.readUInt8(1), buffer.length - 2, 'Invalid sequence length')
10708  assert.equal(buffer.readUInt8(2), 0x02, 'Expected a DER integer')
10709
10710  var rLen = buffer.readUInt8(3)
10711  assert(rLen > 0, 'R length is zero')
10712
10713  var offset = 4 + rLen
10714  assert.equal(buffer.readUInt8(offset), 0x02, 'Expected a DER integer (2)')
10715
10716  var sLen = buffer.readUInt8(offset + 1)
10717  assert(sLen > 0, 'S length is zero')
10718
10719  var rB = buffer.slice(4, offset)
10720  var sB = buffer.slice(offset + 2)
10721  offset += 2 + sLen
10722
10723  if (rLen > 1 && rB.readUInt8(0) === 0x00) {
10724    assert(rB.readUInt8(1) & 0x80, 'R value excessively padded')
10725  }
10726
10727  if (sLen > 1 && sB.readUInt8(0) === 0x00) {
10728    assert(sB.readUInt8(1) & 0x80, 'S value excessively padded')
10729  }
10730
10731  assert.equal(offset, buffer.length, 'Invalid DER encoding')
10732  var r = BigInteger.fromDERInteger(rB)
10733  var s = BigInteger.fromDERInteger(sB)
10734
10735  assert(r.signum() >= 0, 'R value is negative')
10736  assert(s.signum() >= 0, 'S value is negative')
10737
10738  return new ECSignature(r, s)
10739}
10740
10741// BIP62: 1 byte hashType flag (only 0x01, 0x02, 0x03, 0x81, 0x82 and 0x83 are allowed)
10742ECSignature.parseScriptSignature = function (buffer) {
10743  var hashType = buffer.readUInt8(buffer.length - 1)
10744  var hashTypeMod = hashType & ~0x80
10745
10746  assert(hashTypeMod > 0x00 && hashTypeMod < 0x04, 'Invalid hashType ' + hashType)
10747
10748  return {
10749    signature: ECSignature.fromDER(buffer.slice(0, -1)),
10750    hashType: hashType
10751  }
10752}
10753
10754ECSignature.prototype.toCompact = function (i, compressed) {
10755  if (compressed) {
10756    i += 4
10757  }
10758
10759  i += 27
10760
10761  var buffer = new Buffer(65)
10762  buffer.writeUInt8(i, 0)
10763
10764  this.r.toBuffer(32).copy(buffer, 1)
10765  this.s.toBuffer(32).copy(buffer, 33)
10766
10767  return buffer
10768}
10769
10770ECSignature.prototype.toDER = function () {
10771  var rBa = this.r.toDERInteger()
10772  var sBa = this.s.toDERInteger()
10773
10774  var sequence = []
10775
10776  // INTEGER
10777  sequence.push(0x02, rBa.length)
10778  sequence = sequence.concat(rBa)
10779
10780  // INTEGER
10781  sequence.push(0x02, sBa.length)
10782  sequence = sequence.concat(sBa)
10783
10784  // SEQUENCE
10785  sequence.unshift(0x30, sequence.length)
10786
10787  return new Buffer(sequence)
10788}
10789
10790ECSignature.prototype.toScriptSignature = function (hashType) {
10791  var hashTypeMod = hashType & ~0x80
10792  assert(hashTypeMod > 0x00 && hashTypeMod < 0x04, 'Invalid hashType ' + hashType)
10793
10794  var hashTypeBuffer = new Buffer(1)
10795  hashTypeBuffer.writeUInt8(hashType, 0)
10796
10797  return Buffer.concat([this.toDER(), hashTypeBuffer])
10798}
10799
10800module.exports = ECSignature
10801
10802}).call(this,require("buffer").Buffer)
10803},{"assert":5,"bigi":3,"buffer":7,"typeforce":53}],63:[function(require,module,exports){
10804(function (Buffer){
10805var assert = require('assert')
10806var base58check = require('bs58check')
10807var bcrypto = require('./crypto')
10808var createHmac = require('create-hmac')
10809var typeForce = require('typeforce')
10810var networks = require('./networks')
10811
10812var BigInteger = require('bigi')
10813var ECKey = require('./eckey')
10814var ECPubKey = require('./ecpubkey')
10815
10816var ecurve = require('ecurve')
10817var curve = ecurve.getCurveByName('secp256k1')
10818
10819function findBIP32NetworkByVersion (version) {
10820  for (var name in networks) {
10821    var network = networks[name]
10822
10823    if (version === network.bip32.private || version === network.bip32.public) {
10824      return network
10825    }
10826  }
10827
10828  assert(false, 'Could not find network for ' + version.toString(16))
10829}
10830
10831function HDNode (K, chainCode, network) {
10832  network = network || networks.bitcoin
10833
10834  typeForce('Buffer', chainCode)
10835
10836  assert.equal(chainCode.length, 32, 'Expected chainCode length of 32, got ' + chainCode.length)
10837  assert(network.bip32, 'Unknown BIP32 constants for network')
10838
10839  this.chainCode = chainCode
10840  this.depth = 0
10841  this.index = 0
10842  this.parentFingerprint = 0x00000000
10843  this.network = network
10844
10845  if (K instanceof BigInteger) {
10846    this.privKey = new ECKey(K, true)
10847    this.pubKey = this.privKey.pub
10848  } else if (K instanceof ECKey) {
10849    assert(K.pub.compressed, 'ECKey must be compressed')
10850    this.privKey = K
10851    this.pubKey = K.pub
10852  } else if (K instanceof ECPubKey) {
10853    assert(K.compressed, 'ECPubKey must be compressed')
10854    this.pubKey = K
10855  } else {
10856    this.pubKey = new ECPubKey(K, true)
10857  }
10858}
10859
10860HDNode.MASTER_SECRET = new Buffer('Bitcoin seed')
10861HDNode.HIGHEST_BIT = 0x80000000
10862HDNode.LENGTH = 78
10863
10864HDNode.fromSeedBuffer = function (seed, network) {
10865  typeForce('Buffer', seed)
10866
10867  assert(seed.length >= 16, 'Seed should be at least 128 bits')
10868  assert(seed.length <= 64, 'Seed should be at most 512 bits')
10869
10870  var I = createHmac('sha512', HDNode.MASTER_SECRET).update(seed).digest()
10871  var IL = I.slice(0, 32)
10872  var IR = I.slice(32)
10873
10874  // In case IL is 0 or >= n, the master key is invalid
10875  // This is handled by `new ECKey` in the HDNode constructor
10876  var pIL = BigInteger.fromBuffer(IL)
10877
10878  return new HDNode(pIL, IR, network)
10879}
10880
10881HDNode.fromSeedHex = function (hex, network) {
10882  return HDNode.fromSeedBuffer(new Buffer(hex, 'hex'), network)
10883}
10884
10885HDNode.fromBase58 = function (string, network) {
10886  return HDNode.fromBuffer(base58check.decode(string), network, true)
10887}
10888
10889// FIXME: remove in 2.x.y
10890HDNode.fromBuffer = function (buffer, network, __ignoreDeprecation) {
10891  if (!__ignoreDeprecation) {
10892    console.warn('HDNode.fromBuffer() is deprecated for removal in 2.x.y, use fromBase58 instead')
10893  }
10894
10895  assert.strictEqual(buffer.length, HDNode.LENGTH, 'Invalid buffer length')
10896
10897  // 4 byte: version bytes
10898  var version = buffer.readUInt32BE(0)
10899
10900  if (network) {
10901    assert(version === network.bip32.private || version === network.bip32.public, "Network doesn't match")
10902
10903  // auto-detect
10904  } else {
10905    network = findBIP32NetworkByVersion(version)
10906  }
10907
10908  // 1 byte: depth: 0x00 for master nodes, 0x01 for level-1 descendants, ...
10909  var depth = buffer.readUInt8(4)
10910
10911  // 4 bytes: the fingerprint of the parent's key (0x00000000 if master key)
10912  var parentFingerprint = buffer.readUInt32BE(5)
10913  if (depth === 0) {
10914    assert.strictEqual(parentFingerprint, 0x00000000, 'Invalid parent fingerprint')
10915  }
10916
10917  // 4 bytes: child number. This is the number i in xi = xpar/i, with xi the key being serialized.
10918  // This is encoded in MSB order. (0x00000000 if master key)
10919  var index = buffer.readUInt32BE(9)
10920  assert(depth > 0 || index === 0, 'Invalid index')
10921
10922  // 32 bytes: the chain code
10923  var chainCode = buffer.slice(13, 45)
10924  var data, hd
10925
10926  // 33 bytes: private key data (0x00 + k)
10927  if (version === network.bip32.private) {
10928    assert.strictEqual(buffer.readUInt8(45), 0x00, 'Invalid private key')
10929    data = buffer.slice(46, 78)
10930    var d = BigInteger.fromBuffer(data)
10931    hd = new HDNode(d, chainCode, network)
10932
10933  // 33 bytes: public key data (0x02 + X or 0x03 + X)
10934  } else {
10935    data = buffer.slice(45, 78)
10936    var Q = ecurve.Point.decodeFrom(curve, data)
10937    assert.equal(Q.compressed, true, 'Invalid public key')
10938
10939    // Verify that the X coordinate in the public point corresponds to a point on the curve.
10940    // If not, the extended public key is invalid.
10941    curve.validate(Q)
10942
10943    hd = new HDNode(Q, chainCode, network)
10944  }
10945
10946  hd.depth = depth
10947  hd.index = index
10948  hd.parentFingerprint = parentFingerprint
10949
10950  return hd
10951}
10952
10953// FIXME: remove in 2.x.y
10954HDNode.fromHex = function (hex, network) {
10955  return HDNode.fromBuffer(new Buffer(hex, 'hex'), network)
10956}
10957
10958HDNode.prototype.getIdentifier = function () {
10959  return bcrypto.hash160(this.pubKey.toBuffer())
10960}
10961
10962HDNode.prototype.getFingerprint = function () {
10963  return this.getIdentifier().slice(0, 4)
10964}
10965
10966HDNode.prototype.getAddress = function () {
10967  return this.pubKey.getAddress(this.network)
10968}
10969
10970HDNode.prototype.neutered = function () {
10971  var neutered = new HDNode(this.pubKey.Q, this.chainCode, this.network)
10972  neutered.depth = this.depth
10973  neutered.index = this.index
10974  neutered.parentFingerprint = this.parentFingerprint
10975
10976  return neutered
10977}
10978
10979HDNode.prototype.toBase58 = function (isPrivate) {
10980  return base58check.encode(this.toBuffer(isPrivate, true))
10981}
10982
10983// FIXME: remove in 2.x.y
10984HDNode.prototype.toBuffer = function (isPrivate, __ignoreDeprecation) {
10985  if (isPrivate === undefined) {
10986    isPrivate = !!this.privKey
10987
10988  // FIXME: remove in 2.x.y
10989  } else {
10990    console.warn('isPrivate flag is deprecated, please use the .neutered() method instead')
10991  }
10992
10993  if (!__ignoreDeprecation) {
10994    console.warn('HDNode.toBuffer() is deprecated for removal in 2.x.y, use toBase58 instead')
10995  }
10996
10997  // Version
10998  var version = isPrivate ? this.network.bip32.private : this.network.bip32.public
10999  var buffer = new Buffer(HDNode.LENGTH)
11000
11001  // 4 bytes: version bytes
11002  buffer.writeUInt32BE(version, 0)
11003
11004  // Depth
11005  // 1 byte: depth: 0x00 for master nodes, 0x01 for level-1 descendants, ....
11006  buffer.writeUInt8(this.depth, 4)
11007
11008  // 4 bytes: the fingerprint of the parent's key (0x00000000 if master key)
11009  buffer.writeUInt32BE(this.parentFingerprint, 5)
11010
11011  // 4 bytes: child number. This is the number i in xi = xpar/i, with xi the key being serialized.
11012  // This is encoded in Big endian. (0x00000000 if master key)
11013  buffer.writeUInt32BE(this.index, 9)
11014
11015  // 32 bytes: the chain code
11016  this.chainCode.copy(buffer, 13)
11017
11018  // 33 bytes: the public key or private key data
11019  if (isPrivate) {
11020    // FIXME: remove in 2.x.y
11021    assert(this.privKey, 'Missing private key')
11022
11023    // 0x00 + k for private keys
11024    buffer.writeUInt8(0, 45)
11025    this.privKey.d.toBuffer(32).copy(buffer, 46)
11026  } else {
11027    // X9.62 encoding for public keys
11028    this.pubKey.toBuffer().copy(buffer, 45)
11029  }
11030
11031  return buffer
11032}
11033
11034// FIXME: remove in 2.x.y
11035HDNode.prototype.toHex = function (isPrivate) {
11036  return this.toBuffer(isPrivate).toString('hex')
11037}
11038
11039// https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#child-key-derivation-ckd-functions
11040HDNode.prototype.derive = function (index) {
11041  var isHardened = index >= HDNode.HIGHEST_BIT
11042  var indexBuffer = new Buffer(4)
11043  indexBuffer.writeUInt32BE(index, 0)
11044
11045  var data
11046
11047  // Hardened child
11048  if (isHardened) {
11049    assert(this.privKey, 'Could not derive hardened child key')
11050
11051    // data = 0x00 || ser256(kpar) || ser32(index)
11052    data = Buffer.concat([
11053      this.privKey.d.toBuffer(33),
11054      indexBuffer
11055    ])
11056
11057  // Normal child
11058  } else {
11059    // data = serP(point(kpar)) || ser32(index)
11060    //      = serP(Kpar) || ser32(index)
11061    data = Buffer.concat([
11062      this.pubKey.toBuffer(),
11063      indexBuffer
11064    ])
11065  }
11066
11067  var I = createHmac('sha512', this.chainCode).update(data).digest()
11068  var IL = I.slice(0, 32)
11069  var IR = I.slice(32)
11070
11071  var pIL = BigInteger.fromBuffer(IL)
11072
11073  // In case parse256(IL) >= n, proceed with the next value for i
11074  if (pIL.compareTo(curve.n) >= 0) {
11075    return this.derive(index + 1)
11076  }
11077
11078  // Private parent key -> private child key
11079  var hd
11080  if (this.privKey) {
11081    // ki = parse256(IL) + kpar (mod n)
11082    var ki = pIL.add(this.privKey.d).mod(curve.n)
11083
11084    // In case ki == 0, proceed with the next value for i
11085    if (ki.signum() === 0) {
11086      return this.derive(index + 1)
11087    }
11088
11089    hd = new HDNode(ki, IR, this.network)
11090
11091  // Public parent key -> public child key
11092  } else {
11093    // Ki = point(parse256(IL)) + Kpar
11094    //    = G*IL + Kpar
11095    var Ki = curve.G.multiply(pIL).add(this.pubKey.Q)
11096
11097    // In case Ki is the point at infinity, proceed with the next value for i
11098    if (curve.isInfinity(Ki)) {
11099      return this.derive(index + 1)
11100    }
11101
11102    hd = new HDNode(Ki, IR, this.network)
11103  }
11104
11105  hd.depth = this.depth + 1
11106  hd.index = index
11107  hd.parentFingerprint = this.getFingerprint().readUInt32BE(0)
11108
11109  return hd
11110}
11111
11112HDNode.prototype.deriveHardened = function (index) {
11113  // Only derives hardened private keys by default
11114  return this.derive(index + HDNode.HIGHEST_BIT)
11115}
11116
11117HDNode.prototype.toString = HDNode.prototype.toBase58
11118
11119module.exports = HDNode
11120
11121}).call(this,require("buffer").Buffer)
11122},{"./crypto":58,"./eckey":60,"./ecpubkey":61,"./networks":66,"assert":5,"bigi":3,"bs58check":31,"buffer":7,"create-hmac":45,"ecurve":49,"typeforce":53}],64:[function(require,module,exports){
11123module.exports = {
11124  Address: require('./address'),
11125  base58check: require('./base58check'),
11126  Block: require('./block'),
11127  bufferutils: require('./bufferutils'),
11128  crypto: require('./crypto'),
11129  ecdsa: require('./ecdsa'),
11130  ECKey: require('./eckey'),
11131  ECPubKey: require('./ecpubkey'),
11132  ECSignature: require('./ecsignature'),
11133  Message: require('./message'),
11134  opcodes: require('./opcodes'),
11135  HDNode: require('./hdnode'),
11136  Script: require('./script'),
11137  scripts: require('./scripts'),
11138  Transaction: require('./transaction'),
11139  TransactionBuilder: require('./transaction_builder'),
11140  networks: require('./networks'),
11141  Wallet: require('./wallet')
11142}
11143
11144},{"./address":54,"./base58check":55,"./block":56,"./bufferutils":57,"./crypto":58,"./ecdsa":59,"./eckey":60,"./ecpubkey":61,"./ecsignature":62,"./hdnode":63,"./message":65,"./networks":66,"./opcodes":67,"./script":68,"./scripts":69,"./transaction":70,"./transaction_builder":71,"./wallet":72}],65:[function(require,module,exports){
11145(function (Buffer){
11146var bufferutils = require('./bufferutils')
11147var crypto = require('./crypto')
11148var ecdsa = require('./ecdsa')
11149var networks = require('./networks')
11150
11151var BigInteger = require('bigi')
11152var ECPubKey = require('./ecpubkey')
11153var ECSignature = require('./ecsignature')
11154
11155var ecurve = require('ecurve')
11156var ecparams = ecurve.getCurveByName('secp256k1')
11157
11158function magicHash (message, network) {
11159  var magicPrefix = new Buffer(network.magicPrefix)
11160  var messageBuffer = new Buffer(message)
11161  var lengthBuffer = bufferutils.varIntBuffer(messageBuffer.length)
11162
11163  var buffer = Buffer.concat([magicPrefix, lengthBuffer, messageBuffer])
11164  return crypto.hash256(buffer)
11165}
11166
11167function sign (privKey, message, network) {
11168  network = network || networks.bitcoin
11169
11170  var hash = magicHash(message, network)
11171  var signature = privKey.sign(hash)
11172  var e = BigInteger.fromBuffer(hash)
11173  var i = ecdsa.calcPubKeyRecoveryParam(ecparams, e, signature, privKey.pub.Q)
11174
11175  return signature.toCompact(i, privKey.pub.compressed)
11176}
11177
11178// TODO: network could be implied from address
11179function verify (address, signature, message, network) {
11180  if (!Buffer.isBuffer(signature)) {
11181    signature = new Buffer(signature, 'base64')
11182  }
11183
11184  network = network || networks.bitcoin
11185
11186  var hash = magicHash(message, network)
11187  var parsed = ECSignature.parseCompact(signature)
11188  var e = BigInteger.fromBuffer(hash)
11189  var Q = ecdsa.recoverPubKey(ecparams, e, parsed.signature, parsed.i)
11190
11191  var pubKey = new ECPubKey(Q, parsed.compressed)
11192  return pubKey.getAddress(network).toString() === address.toString()
11193}
11194
11195module.exports = {
11196  magicHash: magicHash,
11197  sign: sign,
11198  verify: verify
11199}
11200
11201}).call(this,require("buffer").Buffer)
11202},{"./bufferutils":57,"./crypto":58,"./ecdsa":59,"./ecpubkey":61,"./ecsignature":62,"./networks":66,"bigi":3,"buffer":7,"ecurve":49}],66:[function(require,module,exports){
11203// https://en.bitcoin.it/wiki/List_of_address_prefixes
11204// Dogecoin BIP32 is a proposed standard: https://bitcointalk.org/index.php?topic=409731
11205
11206var networks = {
11207  bitcoin: {
11208    magicPrefix: '\x18Bitcoin Signed Message:\n',
11209    bip32: {
11210      public: 0x0488b21e,
11211      private: 0x0488ade4
11212    },
11213    pubKeyHash: 0x00,
11214    scriptHash: 0x05,
11215    wif: 0x80,
11216    dustThreshold: 546, // https://github.com/bitcoin/bitcoin/blob/v0.9.2/src/core.h#L151-L162
11217    feePerKb: 10000, // https://github.com/bitcoin/bitcoin/blob/v0.9.2/src/main.cpp#L53
11218    estimateFee: estimateFee('bitcoin')
11219  },
11220  testnet: {
11221    magicPrefix: '\x18Bitcoin Signed Message:\n',
11222    bip32: {
11223      public: 0x043587cf,
11224      private: 0x04358394
11225    },
11226    pubKeyHash: 0x6f,
11227    scriptHash: 0xc4,
11228    wif: 0xef,
11229    dustThreshold: 546,
11230    feePerKb: 10000,
11231    estimateFee: estimateFee('testnet')
11232  },
11233  litecoin: {
11234    magicPrefix: '\x19Litecoin Signed Message:\n',
11235    bip32: {
11236      public: 0x019da462,
11237      private: 0x019d9cfe
11238    },
11239    pubKeyHash: 0x30,
11240    scriptHash: 0x05,
11241    wif: 0xb0,
11242    dustThreshold: 0, // https://github.com/litecoin-project/litecoin/blob/v0.8.7.2/src/main.cpp#L360-L365
11243    dustSoftThreshold: 100000, // https://github.com/litecoin-project/litecoin/blob/v0.8.7.2/src/main.h#L53
11244    feePerKb: 100000, // https://github.com/litecoin-project/litecoin/blob/v0.8.7.2/src/main.cpp#L56
11245    estimateFee: estimateFee('litecoin')
11246  },
11247  dogecoin: {
11248    magicPrefix: '\x19Dogecoin Signed Message:\n',
11249    bip32: {
11250      public: 0x02facafd,
11251      private: 0x02fac398
11252    },
11253    pubKeyHash: 0x1e,
11254    scriptHash: 0x16,
11255    wif: 0x9e,
11256    dustThreshold: 0, // https://github.com/dogecoin/dogecoin/blob/v1.7.1/src/core.h#L155-L160
11257    dustSoftThreshold: 100000000, // https://github.com/dogecoin/dogecoin/blob/v1.7.1/src/main.h#L62
11258    feePerKb: 100000000, // https://github.com/dogecoin/dogecoin/blob/v1.7.1/src/main.cpp#L58
11259    estimateFee: estimateFee('dogecoin')
11260  },
11261  viacoin: {
11262    magicPrefix: '\x18Viacoin Signed Message:\n',
11263    bip32: {
11264      public: 0x0488b21e,
11265      private: 0x0488ade4
11266    },
11267    pubKeyHash: 0x47,
11268    scriptHash: 0x21,
11269    wif: 0xc7,
11270    dustThreshold: 560,
11271    dustSoftThreshold: 100000,
11272    feePerKb: 100000, //
11273    estimateFee: estimateFee('viacoin')
11274  },
11275  viacointestnet: {
11276    magicPrefix: '\x18Viacoin Signed Message:\n',
11277    bip32: {
11278      public: 0x043587cf,
11279      private: 0x04358394
11280    },
11281    pubKeyHash: 0x7f,
11282    scriptHash: 0xc4,
11283    wif: 0xff,
11284    dustThreshold: 560,
11285    dustSoftThreshold: 100000,
11286    feePerKb: 100000,
11287    estimateFee: estimateFee('viacointestnet')
11288  },
11289  gamerscoin: {
11290    magicPrefix: '\x19Gamerscoin Signed Message:\n',
11291    bip32: {
11292      public: 0x019da462,
11293      private: 0x019d9cfe
11294    },
11295    pubKeyHash: 0x26,
11296    scriptHash: 0x05,
11297    wif: 0xA6,
11298    dustThreshold: 0, // https://github.com/gamers-coin/gamers-coinv3/blob/master/src/main.cpp#L358-L363
11299    dustSoftThreshold: 100000, // https://github.com/gamers-coin/gamers-coinv3/blob/master/src/main.cpp#L51
11300    feePerKb: 100000, // https://github.com/gamers-coin/gamers-coinv3/blob/master/src/main.cpp#L54
11301    estimateFee: estimateFee('gamerscoin')
11302  },
11303  jumbucks: {
11304    magicPrefix: '\x19Jumbucks Signed Message:\n',
11305    bip32: {
11306      public: 0x037a689a,
11307      private: 0x037a6460
11308    },
11309    pubKeyHash: 0x2b,
11310    scriptHash: 0x05,
11311    wif: 0xab,
11312    dustThreshold: 0,
11313    dustSoftThreshold: 10000,
11314    feePerKb: 10000,
11315    estimateFee: estimateFee('jumbucks')
11316  },
11317  zetacoin: {
11318    magicPrefix: '\x18Zetacoin Signed Message:\n',
11319    bip32: {
11320      public: 0x0488b21e,
11321      private: 0x0488ade4
11322    },
11323    pubKeyHash: 0x50,
11324    scriptHash: 0x09,
11325    wif: 0xe0,
11326    dustThreshold: 546, // https://github.com/zetacoin/zetacoin/blob/master/src/core.h#L159
11327    feePerKb: 10000, // https://github.com/zetacoin/zetacoin/blob/master/src/main.cpp#L54
11328    estimateFee: estimateFee('zetacoin')
11329  }
11330}
11331
11332function estimateFee (type) {
11333  return function (tx) {
11334    var network = networks[type]
11335    var baseFee = network.feePerKb
11336    var byteSize = tx.toBuffer().length
11337
11338    var fee = baseFee * Math.ceil(byteSize / 1000)
11339    if (network.dustSoftThreshold === undefined) return fee
11340
11341    tx.outs.forEach(function (e) {
11342      if (e.value < network.dustSoftThreshold) {
11343        fee += baseFee
11344      }
11345    })
11346
11347    return fee
11348  }
11349}
11350
11351module.exports = networks
11352
11353},{}],67:[function(require,module,exports){
11354module.exports = {
11355  // push value
11356  OP_FALSE: 0,
11357  OP_0: 0,
11358  OP_PUSHDATA1: 76,
11359  OP_PUSHDATA2: 77,
11360  OP_PUSHDATA4: 78,
11361  OP_1NEGATE: 79,
11362  OP_RESERVED: 80,
11363  OP_1: 81,
11364  OP_TRUE: 81,
11365  OP_2: 82,
11366  OP_3: 83,
11367  OP_4: 84,
11368  OP_5: 85,
11369  OP_6: 86,
11370  OP_7: 87,
11371  OP_8: 88,
11372  OP_9: 89,
11373  OP_10: 90,
11374  OP_11: 91,
11375  OP_12: 92,
11376  OP_13: 93,
11377  OP_14: 94,
11378  OP_15: 95,
11379  OP_16: 96,
11380
11381  // control
11382  OP_NOP: 97,
11383  OP_VER: 98,
11384  OP_IF: 99,
11385  OP_NOTIF: 100,
11386  OP_VERIF: 101,
11387  OP_VERNOTIF: 102,
11388  OP_ELSE: 103,
11389  OP_ENDIF: 104,
11390  OP_VERIFY: 105,
11391  OP_RETURN: 106,
11392
11393  // stack ops
11394  OP_TOALTSTACK: 107,
11395  OP_FROMALTSTACK: 108,
11396  OP_2DROP: 109,
11397  OP_2DUP: 110,
11398  OP_3DUP: 111,
11399  OP_2OVER: 112,
11400  OP_2ROT: 113,
11401  OP_2SWAP: 114,
11402  OP_IFDUP: 115,
11403  OP_DEPTH: 116,
11404  OP_DROP: 117,
11405  OP_DUP: 118,
11406  OP_NIP: 119,
11407  OP_OVER: 120,
11408  OP_PICK: 121,
11409  OP_ROLL: 122,
11410  OP_ROT: 123,
11411  OP_SWAP: 124,
11412  OP_TUCK: 125,
11413
11414  // splice ops
11415  OP_CAT: 126,
11416  OP_SUBSTR: 127,
11417  OP_LEFT: 128,
11418  OP_RIGHT: 129,
11419  OP_SIZE: 130,
11420
11421  // bit logic
11422  OP_INVERT: 131,
11423  OP_AND: 132,
11424  OP_OR: 133,
11425  OP_XOR: 134,
11426  OP_EQUAL: 135,
11427  OP_EQUALVERIFY: 136,
11428  OP_RESERVED1: 137,
11429  OP_RESERVED2: 138,
11430
11431  // numeric
11432  OP_1ADD: 139,
11433  OP_1SUB: 140,
11434  OP_2MUL: 141,
11435  OP_2DIV: 142,
11436  OP_NEGATE: 143,
11437  OP_ABS: 144,
11438  OP_NOT: 145,
11439  OP_0NOTEQUAL: 146,
11440
11441  OP_ADD: 147,
11442  OP_SUB: 148,
11443  OP_MUL: 149,
11444  OP_DIV: 150,
11445  OP_MOD: 151,
11446  OP_LSHIFT: 152,
11447  OP_RSHIFT: 153,
11448
11449  OP_BOOLAND: 154,
11450  OP_BOOLOR: 155,
11451  OP_NUMEQUAL: 156,
11452  OP_NUMEQUALVERIFY: 157,
11453  OP_NUMNOTEQUAL: 158,
11454  OP_LESSTHAN: 159,
11455  OP_GREATERTHAN: 160,
11456  OP_LESSTHANOREQUAL: 161,
11457  OP_GREATERTHANOREQUAL: 162,
11458  OP_MIN: 163,
11459  OP_MAX: 164,
11460
11461  OP_WITHIN: 165,
11462
11463  // crypto
11464  OP_RIPEMD160: 166,
11465  OP_SHA1: 167,
11466  OP_SHA256: 168,
11467  OP_HASH160: 169,
11468  OP_HASH256: 170,
11469  OP_CODESEPARATOR: 171,
11470  OP_CHECKSIG: 172,
11471  OP_CHECKSIGVERIFY: 173,
11472  OP_CHECKMULTISIG: 174,
11473  OP_CHECKMULTISIGVERIFY: 175,
11474
11475  // expansion
11476  OP_NOP1: 176,
11477  OP_NOP2: 177,
11478  OP_NOP3: 178,
11479  OP_NOP4: 179,
11480  OP_NOP5: 180,
11481  OP_NOP6: 181,
11482  OP_NOP7: 182,
11483  OP_NOP8: 183,
11484  OP_NOP9: 184,
11485  OP_NOP10: 185,
11486
11487  // template matching params
11488  OP_PUBKEYHASH: 253,
11489  OP_PUBKEY: 254,
11490  OP_INVALIDOPCODE: 255
11491}
11492
11493},{}],68:[function(require,module,exports){
11494(function (Buffer){
11495var assert = require('assert')
11496var bufferutils = require('./bufferutils')
11497var crypto = require('./crypto')
11498var typeForce = require('typeforce')
11499var opcodes = require('./opcodes')
11500
11501function Script (buffer, chunks) {
11502  typeForce('Buffer', buffer)
11503  typeForce('Array', chunks)
11504
11505  this.buffer = buffer
11506  this.chunks = chunks
11507}
11508
11509Script.fromASM = function (asm) {
11510  var strChunks = asm.split(' ')
11511  var chunks = strChunks.map(function (strChunk) {
11512    // opcode
11513    if (strChunk in opcodes) {
11514      return opcodes[strChunk]
11515
11516    // data chunk
11517    } else {
11518      return new Buffer(strChunk, 'hex')
11519    }
11520  })
11521
11522  return Script.fromChunks(chunks)
11523}
11524
11525Script.fromBuffer = function (buffer) {
11526  var chunks = []
11527  var i = 0
11528
11529  while (i < buffer.length) {
11530    var opcode = buffer.readUInt8(i)
11531
11532    // data chunk
11533    if ((opcode > opcodes.OP_0) && (opcode <= opcodes.OP_PUSHDATA4)) {
11534      var d = bufferutils.readPushDataInt(buffer, i)
11535
11536      // did reading a pushDataInt fail? return non-chunked script
11537      if (d === null) return new Script(buffer, [])
11538      i += d.size
11539
11540      // attempt to read too much data?
11541      if (i + d.number > buffer.length) return new Script(buffer, [])
11542
11543      var data = buffer.slice(i, i + d.number)
11544      i += d.number
11545
11546      chunks.push(data)
11547
11548    // opcode
11549    } else {
11550      chunks.push(opcode)
11551
11552      i += 1
11553    }
11554  }
11555
11556  return new Script(buffer, chunks)
11557}
11558
11559Script.fromChunks = function (chunks) {
11560  typeForce('Array', chunks)
11561
11562  var bufferSize = chunks.reduce(function (accum, chunk) {
11563    // data chunk
11564    if (Buffer.isBuffer(chunk)) {
11565      return accum + bufferutils.pushDataSize(chunk.length) + chunk.length
11566    }
11567
11568    // opcode
11569    return accum + 1
11570  }, 0.0)
11571
11572  var buffer = new Buffer(bufferSize)
11573  var offset = 0
11574
11575  chunks.forEach(function (chunk) {
11576    // data chunk
11577    if (Buffer.isBuffer(chunk)) {
11578      offset += bufferutils.writePushDataInt(buffer, chunk.length, offset)
11579
11580      chunk.copy(buffer, offset)
11581      offset += chunk.length
11582
11583    // opcode
11584    } else {
11585      buffer.writeUInt8(chunk, offset)
11586      offset += 1
11587    }
11588  })
11589
11590  assert.equal(offset, buffer.length, 'Could not decode chunks')
11591  return new Script(buffer, chunks)
11592}
11593
11594Script.fromHex = function (hex) {
11595  return Script.fromBuffer(new Buffer(hex, 'hex'))
11596}
11597
11598Script.EMPTY = Script.fromChunks([])
11599
11600Script.prototype.getHash = function () {
11601  return crypto.hash160(this.buffer)
11602}
11603
11604// FIXME: doesn't work for data chunks, maybe time to use buffertools.compare...
11605Script.prototype.without = function (needle) {
11606  return Script.fromChunks(this.chunks.filter(function (op) {
11607    return op !== needle
11608  }))
11609}
11610
11611var reverseOps = []
11612for (var op in opcodes) {
11613  var code = opcodes[op]
11614  reverseOps[code] = op
11615}
11616
11617Script.prototype.toASM = function () {
11618  return this.chunks.map(function (chunk) {
11619    // data chunk
11620    if (Buffer.isBuffer(chunk)) {
11621      return chunk.toString('hex')
11622
11623    // opcode
11624    } else {
11625      return reverseOps[chunk]
11626    }
11627  }).join(' ')
11628}
11629
11630Script.prototype.toBuffer = function () {
11631  return this.buffer
11632}
11633
11634Script.prototype.toHex = function () {
11635  return this.toBuffer().toString('hex')
11636}
11636
11637
11638module.exports = Script
11639
11640}).call(this,require("buffer").Buffer)
11641},{"./bufferutils":57,"./crypto":58,"./opcodes":67,"assert":5,"buffer":7,"typeforce":53}],69:[function(require,module,exports){
11642(function (Buffer){
11643var assert = require('assert')
11644var ops = require('./opcodes')
11645var typeForce = require('typeforce')
11646
11647var ecurve = require('ecurve')
11648var curve = ecurve.getCurveByName('secp256k1')
11649
11650var ECSignature = require('./ecsignature')
11651var Script = require('./script')
11652
11653function isCanonicalPubKey (buffer) {
11654  if (!Buffer.isBuffer(buffer)) return false
11655
11656  try {
11657    ecurve.Point.decodeFrom(curve, buffer)
11658  } catch (e) {
11659    if (!(e.message.match(/Invalid sequence (length|tag)/)))
11660      throw e
11661
11662    return false
11663  }
11664
11665  return true
11666}
11667
11668function isCanonicalSignature (buffer) {
11669  if (!Buffer.isBuffer(buffer)) return false
11670
11671  try {
11672    ECSignature.parseScriptSignature(buffer)
11673  } catch (e) {
11674    if (!(e.message.match(/Not a DER sequence|Invalid sequence length|Expected a DER integer|R length is zero|S length is zero|R value excessively padded|S value excessively padded|R value is negative|S value is negative|Invalid hashType/))) {
11675      throw e
11676    }
11677
11678    return false
11679  }
11680
11681  return true
11682}
11683
11684function isPubKeyHashInput (script) {
11685  return script.chunks.length === 2 &&
11686    isCanonicalSignature(script.chunks[0]) &&
11687    isCanonicalPubKey(script.chunks[1])
11688}
11689
11690function isPubKeyHashOutput (script) {
11691  return script.chunks.length === 5 &&
11692    script.chunks[0] === ops.OP_DUP &&
11693    script.chunks[1] === ops.OP_HASH160 &&
11694    Buffer.isBuffer(script.chunks[2]) &&
11695    script.chunks[2].length === 20 &&
11696    script.chunks[3] === ops.OP_EQUALVERIFY &&
11697    script.chunks[4] === ops.OP_CHECKSIG
11698}
11699
11700function isPubKeyInput (script) {
11701  return script.chunks.length === 1 &&
11702    isCanonicalSignature(script.chunks[0])
11703}
11704
11705function isPubKeyOutput (script) {
11706  return script.chunks.length === 2 &&
11707    isCanonicalPubKey(script.chunks[0]) &&
11708    script.chunks[1] === ops.OP_CHECKSIG
11709}
11710
11711function isScriptHashInput (script, allowIncomplete) {
11712  if (script.chunks.length < 2) return false
11713
11714  var lastChunk = script.chunks[script.chunks.length - 1]
11715  if (!Buffer.isBuffer(lastChunk)) return false
11716
11717  var scriptSig = Script.fromChunks(script.chunks.slice(0, -1))
11718  var redeemScript = Script.fromBuffer(lastChunk)
11719
11720  // is redeemScript a valid script?
11721  if (redeemScript.chunks.length === 0) return false
11722
11723  return classifyInput(scriptSig, allowIncomplete) === classifyOutput(redeemScript)
11724}
11725
11726function isScriptHashOutput (script) {
11727  return script.chunks.length === 3 &&
11728    script.chunks[0] === ops.OP_HASH160 &&
11729    Buffer.isBuffer(script.chunks[1]) &&
11730    script.chunks[1].length === 20 &&
11731    script.chunks[2] === ops.OP_EQUAL
11732}
11733
11734// allowIncomplete is to account for combining signatures
11735// See https://github.com/bitcoin/bitcoin/blob/f425050546644a36b0b8e0eb2f6934a3e0f6f80f/src/script/sign.cpp#L195-L197
11736function isMultisigInput (script, allowIncomplete) {
11737  if (script.chunks.length < 2) return false
11738  if (script.chunks[0] !== ops.OP_0) return false
11739
11740  if (allowIncomplete) {
11741    return script.chunks.slice(1).every(function (chunk) {
11742      return chunk === ops.OP_0 || isCanonicalSignature(chunk)
11743    })
11744  }
11745
11746  return script.chunks.slice(1).every(isCanonicalSignature)
11747}
11748
11749function isMultisigOutput (script) {
11750  if (script.chunks.length < 4) return false
11751  if (script.chunks[script.chunks.length - 1] !== ops.OP_CHECKMULTISIG) return false
11752
11753  var mOp = script.chunks[0]
11754  if (mOp === ops.OP_0) return false
11755  if (mOp < ops.OP_1) return false
11756  if (mOp > ops.OP_16) return false
11757
11758  var nOp = script.chunks[script.chunks.length - 2]
11759  if (nOp === ops.OP_0) return false
11760  if (nOp < ops.OP_1) return false
11761  if (nOp > ops.OP_16) return false
11762
11763  var m = mOp - (ops.OP_1 - 1)
11764  var n = nOp - (ops.OP_1 - 1)
11765  if (n < m) return false
11766
11767  var pubKeys = script.chunks.slice(1, -2)
11768  if (n < pubKeys.length) return false
11769
11770  return pubKeys.every(isCanonicalPubKey)
11771}
11772
11773function isNullDataOutput (script) {
11774  return script.chunks[0] === ops.OP_RETURN
11775}
11776
11777function classifyOutput (script) {
11778  typeForce('Script', script)
11779
11780  if (isPubKeyHashOutput(script)) {
11781    return 'pubkeyhash'
11782  } else if (isScriptHashOutput(script)) {
11783    return 'scripthash'
11784  } else if (isMultisigOutput(script)) {
11785    return 'multisig'
11786  } else if (isPubKeyOutput(script)) {
11787    return 'pubkey'
11788  } else if (isNullDataOutput(script)) {
11789    return 'nulldata'
11790  }
11791
11792  return 'nonstandard'
11793}
11794
11795function classifyInput (script, allowIncomplete) {
11796  typeForce('Script', script)
11797
11798  if (isPubKeyHashInput(script)) {
11799    return 'pubkeyhash'
11800  } else if (isMultisigInput(script, allowIncomplete)) {
11801    return 'multisig'
11802  } else if (isScriptHashInput(script, allowIncomplete)) {
11803    return 'scripthash'
11804  } else if (isPubKeyInput(script)) {
11805    return 'pubkey'
11806  }
11807
11808  return 'nonstandard'
11809}
11810
11811// Standard Script Templates
11812// {pubKey} OP_CHECKSIG
11813function pubKeyOutput (pubKey) {
11814  return Script.fromChunks([
11815    pubKey.toBuffer(),
11816    ops.OP_CHECKSIG
11817  ])
11818}
11819
11820// OP_DUP OP_HASH160 {pubKeyHash} OP_EQUALVERIFY OP_CHECKSIG
11821function pubKeyHashOutput (hash) {
11822  typeForce('Buffer', hash)
11823
11824  return Script.fromChunks([
11825    ops.OP_DUP,
11826    ops.OP_HASH160,
11827    hash,
11828    ops.OP_EQUALVERIFY,
11829    ops.OP_CHECKSIG
11830  ])
11831}
11832
11833// OP_HASH160 {scriptHash} OP_EQUAL
11834function scriptHashOutput (hash) {
11835  typeForce('Buffer', hash)
11836
11837  return Script.fromChunks([
11838    ops.OP_HASH160,
11839    hash,
11840    ops.OP_EQUAL
11841  ])
11842}
11843
11844// m [pubKeys ...] n OP_CHECKMULTISIG
11845function multisigOutput (m, pubKeys) {
11846  typeForce(['ECPubKey'], pubKeys)
11847
11848  assert(pubKeys.length >= m, 'Not enough pubKeys provided')
11849
11850  var pubKeyBuffers = pubKeys.map(function (pubKey) {
11851    return pubKey.toBuffer()
11852  })
11853  var n = pubKeys.length
11854
11855  return Script.fromChunks([].concat(
11856    (ops.OP_1 - 1) + m,
11857    pubKeyBuffers,
11858    (ops.OP_1 - 1) + n,
11859    ops.OP_CHECKMULTISIG
11860  ))
11861}
11862
11863// {signature}
11864function pubKeyInput (signature) {
11865  typeForce('Buffer', signature)
11866
11867  return Script.fromChunks([signature])
11868}
11869
11870// {signature} {pubKey}
11871function pubKeyHashInput (signature, pubKey) {
11872  typeForce('Buffer', signature)
11873
11874  return Script.fromChunks([signature, pubKey.toBuffer()])
11875}
11876
11877// 
11877<scriptSig> {serialized scriptPubKey script}
11878function scriptHashInput (scriptSig, scriptPubKey) {
11879  return Script.fromChunks([].concat(
11880    scriptSig.chunks,
11881    scriptPubKey.toBuffer()
11882  ))
11883}
11884
11885// OP_0 [signatures ...]
11886function multisigInput (signatures, scriptPubKey) {
11887  if (scriptPubKey) {
11888    assert(isMultisigOutput(scriptPubKey))
11889
11890    var mOp = scriptPubKey.chunks[0]
11891    var nOp = scriptPubKey.chunks[scriptPubKey.chunks.length - 2]
11892    var m = mOp - (ops.OP_1 - 1)
11893    var n = nOp - (ops.OP_1 - 1)
11894
11895    assert(signatures.length >= m, 'Not enough signatures provided')
11896    assert(signatures.length <= n, 'Too many signatures provided')
11897  }
11898
11899  return Script.fromChunks([].concat(ops.OP_0, signatures))
11900}
11901
11902function nullDataOutput (data) {
11903  return Script.fromChunks([ops.OP_RETURN, data])
11904}
11905
11906module.exports = {
11907  isCanonicalPubKey: isCanonicalPubKey,
11908  isCanonicalSignature: isCanonicalSignature,
11909  isPubKeyHashInput: isPubKeyHashInput,
11910  isPubKeyHashOutput: isPubKeyHashOutput,
11911  isPubKeyInput: isPubKeyInput,
11912  isPubKeyOutput: isPubKeyOutput,
11913  isScriptHashInput: isScriptHashInput,
11914  isScriptHashOutput: isScriptHashOutput,
11915  isMultisigInput: isMultisigInput,
11916  isMultisigOutput: isMultisigOutput,
11917  isNullDataOutput: isNullDataOutput,
11918  classifyOutput: classifyOutput,
11919  classifyInput: classifyInput,
11920  pubKeyOutput: pubKeyOutput,
11921  pubKeyHashOutput: pubKeyHashOutput,
11922  scriptHashOutput: scriptHashOutput,
11923  multisigOutput: multisigOutput,
11924  pubKeyInput: pubKeyInput,
11925  pubKeyHashInput: pubKeyHashInput,
11926  scriptHashInput: scriptHashInput,
11927  multisigInput: multisigInput,
11928  dataOutput: function (data) {
11929    console.warn('dataOutput is deprecated, use nullDataOutput by 2.0.0')
11930    return nullDataOutput(data)
11931  },
11932  nullDataOutput: nullDataOutput
11933}
11934
11935}).call(this,require("buffer").Buffer)
11936},{"./ecsignature":62,"./opcodes":67,"./script":68,"assert":5,"buffer":7,"ecurve":49,"typeforce":53}],70:[function(require,module,exports){
11937(function (Buffer){
11938var assert = require('assert')
11939var bufferutils = require('./bufferutils')
11940var crypto = require('./crypto')
11941var typeForce = require('typeforce')
11942var opcodes = require('./opcodes')
11943var scripts = require('./scripts')
11944
11945var Address = require('./address')
11946var ECSignature = require('./ecsignature')
11947var Script = require('./script')
11948
11949function Transaction () {
11950  this.version = 1
11951  this.locktime = 0
11952  this.ins = []
11953  this.outs = []
11954}
11955
11956Transaction.DEFAULT_SEQUENCE = 0xffffffff
11957Transaction.SIGHASH_ALL = 0x01
11958Transaction.SIGHASH_NONE = 0x02
11959Transaction.SIGHASH_SINGLE = 0x03
11960Transaction.SIGHASH_ANYONECANPAY = 0x80
11961
11962Transaction.fromBuffer = function (buffer, __disableAssert) {
11963  var offset = 0
11964  function readSlice (n) {
11965    offset += n
11966    return buffer.slice(offset - n, offset)
11967  }
11968
11969  function readUInt32 () {
11970    var i = buffer.readUInt32LE(offset)
11971    offset += 4
11972    return i
11973  }
11974
11975  function readUInt64 () {
11976    var i = bufferutils.readUInt64LE(buffer, offset)
11977    offset += 8
11978    return i
11979  }
11980
11981  function readVarInt () {
11982    var vi = bufferutils.readVarInt(buffer, offset)
11983    offset += vi.size
11984    return vi.number
11985  }
11986
11987  function readScript () {
11988    return Script.fromBuffer(readSlice(readVarInt()))
11989  }
11990
11991  function readGenerationScript () {
11992    return new Script(readSlice(readVarInt()), [])
11993  }
11994
11995  var tx = new Transaction()
11996  tx.version = readUInt32()
11997
11998  var vinLen = readVarInt()
11999  for (var i = 0; i < vinLen; ++i) {
12000    var hash = readSlice(32)
12001
12002    if (Transaction.isCoinbaseHash(hash)) {
12003      tx.ins.push({
12004        hash: hash,
12005        index: readUInt32(),
12006        script: readGenerationScript(),
12007        sequence: readUInt32()
12008      })
12009    } else {
12010      tx.ins.push({
12011        hash: hash,
12012        index: readUInt32(),
12013        script: readScript(),
12014        sequence: readUInt32()
12015      })
12016    }
12017  }
12018
12019  var voutLen = readVarInt()
12020  for (i = 0; i < voutLen; ++i) {
12021    tx.outs.push({
12022      value: readUInt64(),
12023      script: readScript()
12024    })
12025  }
12026
12027  tx.locktime = readUInt32()
12028
12029  if (!__disableAssert) {
12030    assert.equal(offset, buffer.length, 'Transaction has unexpected data')
12031  }
12032
12033  return tx
12034}
12035
12036Transaction.fromHex = function (hex) {
12037  return Transaction.fromBuffer(new Buffer(hex, 'hex'))
12038}
12039
12040Transaction.isCoinbaseHash = function (buffer) {
12041  return Array.prototype.every.call(buffer, function (x) {
12042    return x === 0
12043  })
12044}
12045
12046/**
12047 * Create a new txIn.
12048 *
12049 * Can be called with any of:
12050 *
12051 * - A transaction and an index
12052 * - A transaction hash and an index
12053 *
12054 * Note that this method does not sign the created input.
12055 */
12056Transaction.prototype.addInput = function (hash, index, sequence, script) {
12057  if (sequence === undefined || sequence === null) {
12058    sequence = Transaction.DEFAULT_SEQUENCE
12059  }
12060
12061  script = script || Script.EMPTY
12062
12063  if (typeof hash === 'string') {
12064    // TxId hex is big-endian, we need little-endian
12065    hash = bufferutils.reverse(new Buffer(hash, 'hex'))
12066  } else if (hash instanceof Transaction) {
12067    hash = hash.getHash()
12068  }
12069
12070  typeForce('Buffer', hash)
12071  typeForce('Number', index)
12072  typeForce('Number', sequence)
12073  typeForce('Script', script)
12074
12075  assert.equal(hash.length, 32, 'Expected hash length of 32, got ' + hash.length)
12076
12077  // Add the input and return the input's index
12078  return (this.ins.push({
12079    hash: hash,
12080    index: index,
12081    script: script,
12082    sequence: sequence
12083  }) - 1)
12084}
12085
12086/**
12087 * Create a new txOut.
12088 *
12089 * Can be called with:
12090 *
12091 * - A base58 address string and a value
12092 * - An Address object and a value
12093 * - A scriptPubKey Script and a value
12094 */
12095Transaction.prototype.addOutput = function (scriptPubKey, value) {
12096  // Attempt to get a valid address if it's a base58 address string
12097  if (typeof scriptPubKey === 'string') {
12098    scriptPubKey = Address.fromBase58Check(scriptPubKey)
12099  }
12100
12101  // Attempt to get a valid script if it's an Address object
12102  if (scriptPubKey instanceof Address) {
12103    scriptPubKey = scriptPubKey.toOutputScript()
12104  }
12105
12106  typeForce('Script', scriptPubKey)
12107  typeForce('Number', value)
12108
12109  // Add the output and return the output's index
12110  return (this.outs.push({
12111    script: scriptPubKey,
12112    value: value
12113  }) - 1)
12114}
12115
12116Transaction.prototype.clone = function () {
12117  var newTx = new Transaction()
12118  newTx.version = this.version
12119  newTx.locktime = this.locktime
12120
12121  newTx.ins = this.ins.map(function (txIn) {
12122    return {
12123      hash: txIn.hash,
12124      index: txIn.index,
12125      script: txIn.script,
12126      sequence: txIn.sequence
12127    }
12128  })
12129
12130  newTx.outs = this.outs.map(function (txOut) {
12131    return {
12132      script: txOut.script,
12133      value: txOut.value
12134    }
12135  })
12136
12137  return newTx
12138}
12139
12140/**
12141 * Hash transaction for signing a specific input.
12142 *
12143 * Bitcoin uses a different hash for each signed transaction input. This
12144 * method copies the transaction, makes the necessary changes based on the
12145 * hashType, serializes and finally hashes the result. This hash can then be
12146 * used to sign the transaction input in question.
12147 */
12148Transaction.prototype.hashForSignature = function (inIndex, prevOutScript, hashType) {
12149  // FIXME: remove in 2.x.y
12150  if (arguments[0] instanceof Script) {
12151    console.warn('hashForSignature(prevOutScript, inIndex, ...) has been deprecated. Use hashForSignature(inIndex, prevOutScript, ...)')
12152
12153    // swap the arguments (must be stored in tmp, arguments is special)
12154    var tmp = arguments[0]
12155    inIndex = arguments[1]
12156    prevOutScript = tmp
12157  }
12158
12159  typeForce('Number', inIndex)
12160  typeForce('Script', prevOutScript)
12161  typeForce('Number', hashType)
12162
12163  assert(inIndex >= 0, 'Invalid vin index')
12164  assert(inIndex < this.ins.length, 'Invalid vin index')
12165
12166  var txTmp = this.clone()
12167  var hashScript = prevOutScript.without(opcodes.OP_CODESEPARATOR)
12168
12169  // Blank out other inputs' signatures
12170  txTmp.ins.forEach(function (txIn) {
12171    txIn.script = Script.EMPTY
12172  })
12173  txTmp.ins[inIndex].script = hashScript
12174
12175  var hashTypeModifier = hashType & 0x1f
12176
12177  if (hashTypeModifier === Transaction.SIGHASH_NONE) {
12178    assert(false, 'SIGHASH_NONE not yet supported')
12179  } else if (hashTypeModifier === Transaction.SIGHASH_SINGLE) {
12180    assert(false, 'SIGHASH_SINGLE not yet supported')
12181  }
12182
12183  if (hashType & Transaction.SIGHASH_ANYONECANPAY) {
12184    assert(false, 'SIGHASH_ANYONECANPAY not yet supported')
12185  }
12186
12187  var hashTypeBuffer = new Buffer(4)
12188  hashTypeBuffer.writeInt32LE(hashType, 0)
12189
12190  var buffer = Buffer.concat([txTmp.toBuffer(), hashTypeBuffer])
12191  return crypto.hash256(buffer)
12192}
12193
12194Transaction.prototype.getHash = function () {
12195  return crypto.hash256(this.toBuffer())
12196}
12197
12198Transaction.prototype.getId = function () {
12199  // TxHash is little-endian, we need big-endian
12200  return bufferutils.reverse(this.getHash()).toString('hex')
12201}
12202
12203Transaction.prototype.toBuffer = function () {
12204  function scriptSize (script) {
12205    var length = script.buffer.length
12206
12207    return bufferutils.varIntSize(length) + length
12208  }
12209
12210  var buffer = new Buffer(
12211    8 +
12212    bufferutils.varIntSize(this.ins.length) +
12213    bufferutils.varIntSize(this.outs.length) +
12214    this.ins.reduce(function (sum, input) { return sum + 40 + scriptSize(input.script) }, 0) +
12215    this.outs.reduce(function (sum, output) { return sum + 8 + scriptSize(output.script) }, 0)
12216  )
12217
12218  var offset = 0
12219  function writeSlice (slice) {
12220    slice.copy(buffer, offset)
12221    offset += slice.length
12222  }
12223
12224  function writeUInt32 (i) {
12225    buffer.writeUInt32LE(i, offset)
12226    offset += 4
12227  }
12228
12229  function writeUInt64 (i) {
12230    bufferutils.writeUInt64LE(buffer, i, offset)
12231    offset += 8
12232  }
12233
12234  function writeVarInt (i) {
12235    var n = bufferutils.writeVarInt(buffer, i, offset)
12236    offset += n
12237  }
12238
12239  writeUInt32(this.version)
12240  writeVarInt(this.ins.length)
12241
12242  this.ins.forEach(function (txIn) {
12243    writeSlice(txIn.hash)
12244    writeUInt32(txIn.index)
12245    writeVarInt(txIn.script.buffer.length)
12246    writeSlice(txIn.script.buffer)
12247    writeUInt32(txIn.sequence)
12248  })
12249
12250  writeVarInt(this.outs.length)
12251  this.outs.forEach(function (txOut) {
12252    writeUInt64(txOut.value)
12253    writeVarInt(txOut.script.buffer.length)
12254    writeSlice(txOut.script.buffer)
12255  })
12256
12257  writeUInt32(this.locktime)
12258
12259  return buffer
12260}
12261
12262Transaction.prototype.toHex = function () {
12263  return this.toBuffer().toString('hex')
12264}
12265
12266Transaction.prototype.setInputScript = function (index, script) {
12267  typeForce('Number', index)
12268  typeForce('Script', script)
12269
12270  this.ins[index].script = script
12271}
12272
12273// FIXME: remove in 2.x.y
12274Transaction.prototype.sign = function (index, privKey, hashType) {
12275  console.warn('Transaction.prototype.sign is deprecated.  Use TransactionBuilder instead.')
12276
12277  var prevOutScript = privKey.pub.getAddress().toOutputScript()
12278  var signature = this.signInput(index, prevOutScript, privKey, hashType)
12279
12280  var scriptSig = scripts.pubKeyHashInput(signature, privKey.pub)
12281  this.setInputScript(index, scriptSig)
12282}
12283
12284// FIXME: remove in 2.x.y
12285Transaction.prototype.signInput = function (index, prevOutScript, privKey, hashType) {
12286  console.warn('Transaction.prototype.signInput is deprecated.  Use TransactionBuilder instead.')
12287
12288  hashType = hashType || Transaction.SIGHASH_ALL
12289
12290  var hash = this.hashForSignature(index, prevOutScript, hashType)
12291  var signature = privKey.sign(hash)
12292
12293  return signature.toScriptSignature(hashType)
12294}
12295
12296// FIXME: remove in 2.x.y
12297Transaction.prototype.validateInput = function (index, prevOutScript, pubKey, buffer) {
12298  console.warn('Transaction.prototype.validateInput is deprecated.  Use TransactionBuilder instead.')
12299
12300  var parsed = ECSignature.parseScriptSignature(buffer)
12301  var hash = this.hashForSignature(index, prevOutScript, parsed.hashType)
12302
12303  return pubKey.verify(hash, parsed.signature)
12304}
12305
12306module.exports = Transaction
12307
12308}).call(this,require("buffer").Buffer)
12309},{"./address":54,"./bufferutils":57,"./crypto":58,"./ecsignature":62,"./opcodes":67,"./script":68,"./scripts":69,"assert":5,"buffer":7,"typeforce":53}],71:[function(require,module,exports){
12310(function (Buffer){
12311var assert = require('assert')
12312var ops = require('./opcodes')
12313var scripts = require('./scripts')
12314
12315var ECPubKey = require('./ecpubkey')
12316var ECSignature = require('./ecsignature')
12317var Script = require('./script')
12318var Transaction = require('./transaction')
12319
12320function extractInput (txIn) {
12321  var redeemScript
12322  var scriptSig = txIn.script
12323  var prevOutScript
12324  var prevOutType = scripts.classifyInput(scriptSig, true)
12325  var scriptType
12326
12327  // Re-classify if scriptHash
12328  if (prevOutType === 'scripthash') {
12329    redeemScript = Script.fromBuffer(scriptSig.chunks.slice(-1)[0])
12330    prevOutScript = scripts.scriptHashOutput(redeemScript.getHash())
12331
12332    scriptSig = Script.fromChunks(scriptSig.chunks.slice(0, -1))
12333    scriptType = scripts.classifyInput(scriptSig, true)
12334  } else {
12335    scriptType = prevOutType
12336  }
12337
12338  // Extract hashType, pubKeys and signatures
12339  var hashType, parsed, pubKeys, signatures
12340
12341  switch (scriptType) {
12342    case 'pubkeyhash': {
12343      parsed = ECSignature.parseScriptSignature(scriptSig.chunks[0])
12344      hashType = parsed.hashType
12345      pubKeys = [ECPubKey.fromBuffer(scriptSig.chunks[1])]
12346      signatures = [parsed.signature]
12347      prevOutScript = pubKeys[0].getAddress().toOutputScript()
12348
12349      break
12350    }
12351
12352    case 'pubkey': {
12353      parsed = ECSignature.parseScriptSignature(scriptSig.chunks[0])
12354      hashType = parsed.hashType
12355      signatures = [parsed.signature]
12356
12357      if (redeemScript) {
12358        pubKeys = [ECPubKey.fromBuffer(redeemScript.chunks[0])]
12359      }
12360
12361      break
12362    }
12363
12364    case 'multisig': {
12365      signatures = scriptSig.chunks.slice(1).map(function (chunk) {
12366        if (chunk === ops.OP_0) return chunk
12367
12368        var parsed = ECSignature.parseScriptSignature(chunk)
12369        hashType = parsed.hashType
12370
12371        return parsed.signature
12372      })
12373
12374      if (redeemScript) {
12375        pubKeys = redeemScript.chunks.slice(1, -2).map(ECPubKey.fromBuffer)
12376      }
12377
12378      break
12379    }
12380  }
12381
12382  return {
12383    hashType: hashType,
12384    prevOutScript: prevOutScript,
12385    prevOutType: prevOutType,
12386    pubKeys: pubKeys,
12387    redeemScript: redeemScript,
12388    scriptType: scriptType,
12389    signatures: signatures
12390  }
12391}
12392
12393function TransactionBuilder () {
12394  this.prevTxMap = {}
12395  this.prevOutScripts = {}
12396  this.prevOutTypes = {}
12397
12398  this.inputs = []
12399  this.tx = new Transaction()
12400}
12401
12402TransactionBuilder.fromTransaction = function (transaction) {
12403  var txb = new TransactionBuilder()
12404
12405  // Copy other transaction fields
12406  txb.tx.version = transaction.version
12407  txb.tx.locktime = transaction.locktime
12408
12409  // Extract/add inputs
12410  transaction.ins.forEach(function (txIn) {
12411    txb.addInput(txIn.hash, txIn.index, txIn.sequence)
12412  })
12413
12414  // Extract/add outputs
12415  transaction.outs.forEach(function (txOut) {
12416    txb.addOutput(txOut.script, txOut.value)
12417  })
12418
12419  // Extract/add signatures
12420  txb.inputs = transaction.ins.map(function (txIn) {
12421    // TODO: remove me after testcase added
12422    assert(!Transaction.isCoinbaseHash(txIn.hash), 'coinbase inputs not supported')
12423
12424    // Ignore empty scripts
12425    if (txIn.script.buffer.length === 0) return {}
12426
12427    return extractInput(txIn)
12428  })
12429
12430  return txb
12431}
12432
12433TransactionBuilder.prototype.addInput = function (prevTx, index, sequence, prevOut
12433Script) {
12434  var prevOutHash
12435
12436  // txId
12437  if (typeof prevTx === 'string') {
12438    prevOutHash = new Buffer(prevTx, 'hex')
12439
12440    // TxId hex is big-endian, we want little-endian hash
12441    Array.prototype.reverse.call(prevOutHash)
12442
12443  // Transaction
12444  } else if (prevTx instanceof Transaction) {
12445    prevOutHash = prevTx.getHash()
12446    prevOutScript = prevTx.outs[index].script
12447
12448  // txHash
12449  } else {
12450    prevOutHash = prevTx
12451  }
12452
12453  var input = {}
12454  if (prevOutScript) {
12455    var prevOutType = scripts.classifyOutput(prevOutScript)
12456
12457    // if we can, extract pubKey information
12458    switch (prevOutType) {
12459      case 'multisig': {
12460        input.pubKeys = prevOutScript.chunks.slice(1, -2).map(ECPubKey.fromBuffer)
12461        break
12462      }
12463
12464      case 'pubkey': {
12465        input.pubKeys = prevOutScript.chunks.slice(0, 1).map(ECPubKey.fromBuffer)
12466        break
12467      }
12468    }
12469
12470    if (prevOutType !== 'scripthash') {
12471      input.scriptType = prevOutType
12472    }
12473
12474    input.prevOutScript = prevOutScript
12475    input.prevOutType = prevOutType
12476  }
12477
12478  assert(this.inputs.every(function (input2) {
12479    if (input2.hashType === undefined) return true
12480
12481    return input2.hashType & Transaction.SIGHASH_ANYONECANPAY
12482  }
12482), 'No, this would invalidate signatures')
12483
12484  var prevOut = prevOutHash.toString('hex') + ':' + index
12485  assert(!(prevOut in this.prevTxMap), 'Transaction is already an input')
12486
12487  var vin = this.tx.addInput(prevOutHash, index, sequence)
12488  this.inputs[vin] = input
12489  this.prevTxMap[prevOut] = vin
12490
12491  return vin
12492}
12493
12494TransactionBuilder.prototype.addOutput = function (scriptPubKey, value) {
12495  assert(this.inputs.every(function (input) {
12496    if (input.hashType === undefined) return true
12497
12498    return (input.hashType & 0x1f) === Transaction.SIGHASH_SINGLE
12499  }), 'No, this would invalidate signatures')
12500
12501  return this.tx.addOutput(scriptPubKey, value)
12502}
12503
12504TransactionBuilder.prototype.build = function () {
12505  return this.__build(false)
12506}
12507TransactionBuilder.prototype.buildIncomplete = function () {
12508  return this.__build(true)
12509}
12510
12511var canSignTypes = {
12512  'pubkeyhash': true,
12513  'multisig': true,
12514  'pubkey': true
12515}
12516
12517TransactionBuilder.prototype.__build = function (allowIncomplete) {
12518  if (!allowIncomplete) {
12519    assert(this.tx.ins.length > 0, 'Transaction has no inputs')
12520    assert(this.tx.outs.length > 0, 'Transaction has no outputs')
12521  }
12522
12523  var tx = this.tx.clone()
12524
12525  // Create script signatures from signature meta-data
12526  this.inputs.forEach(function (input, index) {
12527    var scriptType = input.scriptType
12528    var scriptSig
12529
12530    if (!allowIncomplete) {
12531      assert(!!scriptType, 'Transaction is not complete')
12532      assert(scriptType in canSignTypes, scriptType + ' not supported')
12533      assert(input.signatures, 'Transaction is missing signatures')
12534    }
12535
12536    if (input.signatures) {
12537      switch (scriptType) {
12538        case 'pubkeyhash': {
12539          var pkhSignature = input.signatures[0].toScriptSignature(input.hashType)
12540          scriptSig = scripts.pubKeyHashInput(pkhSignature, input.pubKeys[0])
12541          break
12542        }
12543
12544        case 'multisig': {
12545          // Array.prototype.map is sparse-compatible
12546          var msSignatures = input.signatures.map(function (signature) {
12547            return signature && signature.toScriptSignature(input.hashType)
12548          })
12549
12550          // fill in blanks with OP_0
12551          if (allowIncomplete) {
12552            for (var i = 0; i < msSignatures.length; ++i) {
12553              if (msSignatures[i]) continue
12554
12555              msSignatures[i] = ops.OP_0
12556            }
12557          } else {
12558            // Array.prototype.filter returns non-sparse array
12559            msSignatures = msSignatures.filter(function (x) { return x })
12560          }
12561
12562          var redeemScript = allowIncomplete ? undefined : input.redeemScript
12563          scriptSig = scripts.multisigInput(msSignatures, redeemScript)
12564          break
12565        }
12566
12567        case 'pubkey': {
12568          var pkSignature = input.signatures[0].toScriptSignature(input.hashType)
12569          scriptSig = scripts.pubKeyInput(pkSignature)
12570          break
12571        }
12572      }
12573    }
12574
12575    // did we build a scriptSig?
12576    if (scriptSig) {
12577      // wrap as scriptHash if necessary
12578      if (input.prevOutType === 'scripthash') {
12579        scriptSig = scripts.scriptHashInput(scriptSig, input.redeemScript)
12580      }
12581
12582      tx.setInputScript(index, scriptSig)
12583    }
12584  })
12585
12586  return tx
12587}
12588
12589TransactionBuilder.prototype.sign = function (index, privKey, redeemScript, hashType) {
12590  assert(index in this.inputs, 'No input at index: ' + index)
12591  hashType = hashType || Transaction.SIGHASH_ALL
12592
12593  var input = this.inputs[index]
12594  var canSign = input.hashType &&
12595    input.prevOutScript &&
12596    input.prevOutType &&
12597    input.pubKeys &&
12598    input.scriptType &&
12599    input.signatures
12600
12601  // are we almost ready to sign?
12602  if (canSign) {
12603    // if redeemScript was provided, enforce consistency
12604    if (redeemScript) {
12605      assert.deepEqual(input.redeemScript, redeemScript, 'Inconsistent redeemScript')
12606    }
12607
12608    assert.equal(input.hashType, hashType, 'Inconsistent hashType')
12609
12610  // no? prepare
12611  } else {
12612    // must be pay-to-scriptHash?
12613    if (redeemScript) {
12614      // if we have a prevOutScript, enforce scriptHash equality to the redeemScript
12615      if (input.prevOutScript) {
12616        assert.equal(input.prevOutType, 'scripthash', 'PrevOutScript must be P2SH')
12617
12618        var scriptHash = input.prevOutScript.chunks[1]
12619        assert.deepEqual(scriptHash, redeemScript.getHash(), 'RedeemScript does not match ' + scriptHash.toString('hex'))
12620      }
12621
12622      var scriptType = scripts.classifyOutput(redeemScript)
12623      assert(scriptType in canSignTypes, 'RedeemScript not supported (' + scriptType + ')')
12624
12625      var pubKeys = []
12626      switch (scriptType) {
12627        case 'multisig': {
12628          pubKeys = redeemScript.chunks.slice(1, -2).map(ECPubKey.fromBuffer)
12629          break
12630        }
12631
12632        case 'pubkeyhash': {
12633          var pkh1 = redeemScript.chunks[2]
12634          var pkh2 = privKey.pub.getAddress().hash
12635
12636          assert.deepEqual(pkh1, pkh2, 'privateKey cannot sign for this input')
12637          pubKeys = [privKey.pub]
12638          break
12639        }
12640
12641        case 'pubkey': {
12642          pubKeys = redeemScript.chunks.slice(0, 1).map(ECPubKey.fromBuffer)
12643          break
12644        }
12645      }
12646
12647      if (!input.prevOutScript) {
12648        input.prevOutScript = scripts.scriptHashOutput(redeemScript.getHash())
12649        input.prevOutType = 'scripthash'
12650      }
12651
12652      input.pubKeys = pubKeys
12653      input.redeemScript = redeemScript
12654      input.scriptType = scriptType
12655
12656    // cannot be pay-to-scriptHash
12657    } else {
12658      assert.notEqual(input.prevOutType, 'scripthash', 'PrevOutScript is P2SH, missing redeemScript')
12659
12660      // can we otherwise sign this?
12661      if (input.scriptType) {
12662        assert(input.pubKeys, input.scriptType + ' not supported')
12663
12664      // we know nothin' Jon Snow, assume pubKeyHash
12665      } else {
12666        input.prevOutScript = privKey.pub.getAddress().toOutputScript()
12667        input.prevOutType = 'pubkeyhash'
12668        input.pubKeys = [privKey.pub]
12669        input.scriptType = input.prevOutType
12670      }
12671    }
12672
12673    input.hashType = hashType
12674    input.signatures = input.signatures || []
12675  }
12676
12677  var signatureScript = input.redeemScript || input.prevOutScript
12678  var signatureHash = this.tx.hashForSignature(index, signatureScript, hashType)
12679
12680  // enforce signature order matches public keys
12681  if (input.scriptType === 'multisig' && input.redeemScript && input.signatures.length !== input.pubKeys.length) {
12682    // maintain a local copy of unmatched signatures
12683    var unmatched = input.signatures.slice()
12684
12685    input.signatures = input.pubKeys.map(function (pubKey) {
12686      var match
12687
12688      // check for any matching signatures
12689      unmatched.some(function (signature, i) {
12690        if (!pubKey.verify(signatureHash, signature)) return false
12691        match = signature
12692
12693        // remove matched signature from unmatched
12694        unmatched.splice(i, 1)
12695
12696        return true
12697      })
12698
12699      return match || undefined
12700    })
12701  }
12702
12703  // enforce in order signing of public keys
12704  assert(input.pubKeys.some(function (pubKey, i) {
12705    if (!privKey.pub.Q.equals(pubKey.Q)) return false
12706
12707    assert(!input.signatures[i], 'Signature already exists')
12708    var signature = privKey.sign(signatureHash)
12709    input.signatures[i] = signature
12710
12711    return true
12712  }, this), 'privateKey cannot sign for this input')
12713}
12714
12715module.exports = TransactionBuilder
12716
12717}).call(this,require("buffer").Buffer)
12718},{"./ecpubkey":61,"./ecsignature":62,"./opcodes":67,"./script":68,"./scripts":69,"./transaction":70,"assert":5,"buffer":7}],72:[function(require,module,exports){
12719(function (Buffer){
12720var assert = require('assert')
12721var bufferutils = require('./bufferutils')
12722var typeForce = require('typeforce')
12723var networks = require('./networks')
12724var randomBytes = require('randombytes')
12725
12726var Address = require('./address')
12727var HDNode = require('./hdnode')
12728var TransactionBuilder = require('./transaction_builder')
12729var Script = require('./script')
12730
12731function Wallet (seed, network) {
12732  console.warn('Wallet is deprecated and will be removed in 2.0.0, see #296')
12733
12734  seed = seed || randomBytes(32)
12735  network = network || networks.bitcoin
12736
12737  // Stored in a closure to make accidental serialization less likely
12738  var masterKey = HDNode.fromSeedBuffer(seed, network)
12739
12740  // HD first-level child derivation method should be hardened
12741  // See https://bitcointalk.org/index.php?topic=405179.msg4415254#msg4415254
12742  var accountZero = masterKey.deriveHardened(0)
12743  var externalAccount = accountZero.derive(0)
12744  var internalAccount = accountZero.derive(1)
12745
12746  this.addresses = []
12747  this.changeAddresses = []
12748  this.network = network
12749  this.unspents = []
12750
12751  // FIXME: remove in 2.0.0
12752  this.unspentMap = {}
12753
12754  // FIXME: remove in 2.0.0
12755  var me = this
12756  this.newMasterKey = function (seed) {
12757    console.warn('newMasterKey is deprecated, please make a new Wallet instance instead')
12758
12759    seed = seed || randomBytes(32)
12760    masterKey = HDNode.fromSeedBuffer(seed, network)
12761
12762    accountZero = masterKey.deriveHardened(0)
12763    externalAccount = accountZero.derive(0)
12764    internalAccount = accountZero.derive(1)
12765
12766    me.addresses = []
12767    me.changeAddresses = []
12768
12769    me.unspents = []
12770    me.unspentMap = {}
12771  }
12772
12773  this.getMasterKey = function () {
12774    return masterKey
12775  }
12776  this.getAccountZero = function () {
12777    return accountZero
12778  }
12779  this.getExternalAccount = function () {
12780    return externalAccount
12781  }
12782  this.getInternalAccount = function () {
12783    return internalAccount
12784  }
12785}
12786
12787Wallet.prototype.createTransaction = function (to, value, options) {
12788  // FIXME: remove in 2.0.0
12789  if (typeof options !== 'object') {
12790    if (options !== undefined) {
12791      console.warn('Non options object parameters are deprecated, use options object instead')
12792
12793      options = {
12794        fixedFee: arguments[2],
12795        changeAddress: arguments[3]
12796      }
12797    }
12798  }
12799
12800  options = options || {}
12801
12802  assert(value > this.network.dustThreshold, value + ' must be above dust threshold (' + this.network.dustThreshold + ' Satoshis)')
12803
12804  var changeAddress = options.changeAddress
12805  var fixedFee = options.fixedFee
12806  var minConf = options.minConf === undefined ? 0 : options.minConf // FIXME: change minConf:1 by default in 2.0.0
12807
12808  // filter by minConf, then pending and sort by descending value
12809  var unspents = this.unspents.filter(function (unspent) {
12810    return unspent.confirmations >= minConf
12811  }).filter(function (unspent) {
12812    return !unspent.pending
12813  }).sort(function (o1, o2) {
12814    return o2.value - o1.value
12815  })
12816
12817  var accum = 0
12818  var addresses = []
12819  var subTotal = value
12820
12821  var txb = new TransactionBuilder()
12822  txb.addOutput(to, value)
12823
12824  for (var i = 0; i < unspents.length; ++i) {
12825    var unspent = unspents[i]
12826    addresses.push(unspent.address)
12827
12828    txb.addInput(unspent.txHash, unspent.index)
12829
12830    var fee = fixedFee === undefined ? estimatePaddedFee(txb.buildIncomplete(), this.network) : fixedFee
12831
12832    accum += unspent.value
12833    subTotal = value + fee
12834
12835    if (accum >= subTotal) {
12836      var change = accum - subTotal
12837
12838      if (change > this.network.dustThreshold) {
12839        txb.addOutput(changeAddress || this.getChangeAddress(), change)
12840      }
12841
12842      break
12843    }
12844  }
12845
12846  assert(accum >= subTotal, 'Not enough funds (incl. fee): ' + accum + ' < ' + subTotal)
12847
12848  return this.signWith(txb, addresses).build()
12849}
12850
12851// FIXME: remove in 2.0.0
12852Wallet.prototype.processPendingTx = function (tx) {
12853  this.__processTx(tx, true)
12854}
12855
12856// FIXME: remove in 2.0.0
12857Wallet.prototype.processConfirmedTx = function (tx) {
12858  this.__processTx(tx, false)
12859}
12860
12861// FIXME: remove in 2.0.0
12862Wallet.prototype.__processTx = function (tx, isPending) {
12863  console.warn('processTransaction is considered harmful, see issue #260 for more information')
12864
12865  var txId = tx.getId()
12866  var txHash = tx.getHash()
12867
12868  tx.outs.forEach(function (txOut, i) {
12869    var address
12870
12871    try {
12872      address = Address.fromOutputScript(txOut.script, this.network).toString()
12873    } catch (e) {
12874      if (!(e.message.match(/has no matching Address/)))
12875        throw e
12876    }
12877
12878    var myAddresses = this.addresses.concat(this.changeAddresses)
12879    if (myAddresses.indexOf(address) > -1) {
12880      var lookup = txId + ':' + i
12881      if (lookup in this.unspentMap) return
12882
12883      // its unique, add it
12884      var unspent = {
12885        address: address,
12886        confirmations: 0, // no way to determine this without more information
12887        index: i,
12888        txHash: txHash,
12889        txId: txId,
12890        value: txOut.value,
12891        pending: isPending
12892      }
12893
12894      this.unspentMap[lookup] = unspent
12895      this.unspents.push(unspent)
12896    }
12897  }, this)
12898
12899  tx.ins.forEach(function (txIn) {
12900    // copy and convert to big-endian hex
12901    var txInId = bufferutils.reverse(txIn.hash).toString('hex')
12902
12903    var lookup = txInId + ':' + txIn.index
12904    if (!(lookup in this.unspentMap)) return
12905
12906    var unspent = this.unspentMap[lookup]
12907
12908    if (isPending) {
12909      unspent.pending = true
12910      unspent.spent = true
12911    } else {
12912      delete this.unspentMap[lookup]
12913
12914      this.unspents = this.unspents.filter(function (unspent2) {
12915        return unspent !== unspent2
12916      })
12917    }
12918  }, this)
12919}
12920
12921Wallet.prototype.generateAddress = function () {
12922  var k = this.addresses.length
12923  var address = this.getExternalAccount().derive(k).getAddress()
12924
12925  this.addresses.push(address.toString())
12926
12927  return this.getReceiveAddress()
12928}
12929
12930Wallet.prototype.generateChangeAddress = function () {
12931  var k = this.changeAddresses.length
12932  var address = this.getInternalAccount().derive(k).getAddress()
12933
12934  this.changeAddresses.push(address.toString())
12935
12936  return this.getChangeAddress()
12937}
12938
12939Wallet.prototype.getAddress = function () {
12940  if (this.addresses.length === 0) {
12941    this.generateAddress()
12942  }
12943
12944  return this.addresses[this.addresses.length - 1]
12945}
12946
12947Wallet.prototype.getBalance = function (minConf) {
12948  minConf = minConf || 0
12949
12950  return this.unspents.filter(function (unspent) {
12951    return unspent.confirmations >= minConf
12952
12953      // FIXME: remove spent filter in 2.0.0
12954  }).filter(function (unspent) {
12955    return !unspent.spent
12956  }).reduce(function (accum, unspent) {
12957    return accum + unspent.value
12958  }, 0)
12959}
12960
12961Wallet.prototype.getChangeAddress = function () {
12962  if (this.changeAddresses.length === 0) {
12963    this.generateChangeAddress()
12964  }
12965
12966  return this.changeAddresses[this.changeAddresses.length - 1]
12967}
12968
12969Wallet.prototype.getInternalPrivateKey = function (index) {
12970  return this.getInternalAccount().derive(index).privKey
12971}
12972
12973Wallet.prototype.getPrivateKey = function (index) {
12974  return this.getExternalAccount().derive(index).privKey
12975}
12976
12977Wallet.prototype.getPrivateKeyForAddress = function (address) {
12978  var index
12979
12980  if ((index = this.addresses.indexOf(address)) > -1) {
12981    return this.getPrivateKey(index)
12982  }
12983
12984  if ((index = this.changeAddresses.indexOf(address)) > -1) {
12985    return this.getInternalPrivateKey(index)
12986  }
12987
12988  assert(false, 'Unknown address. Make sure the address is from the keychain and has been generated')
12989}
12990
12991Wallet.prototype.getUnspentOutputs = function (minConf) {
12992  minConf = minConf || 0
12993
12994  return this.unspents.filter(function (unspent) {
12995    return unspent.confirmations >= minConf
12996
12997      // FIXME: remove spent filter in 2.0.0
12998  }).filter(function (unspent) {
12999    return !unspent.spent
13000  }).map(function (unspent) {
13001    return {
13002      address: unspent.address,
13003      confirmations: unspent.confirmations,
13004      index: unspent.index,
13005      txId: unspent.txId,
13006      value: unspent.value,
13007
13008      // FIXME: remove in 2.0.0
13009      hash: unspent.txId,
13010      pending: unspent.pending
13011    }
13012  })
13013}
13014
13015Wallet.prototype.setUnspentOutputs = function (unspents) {
13016  this.unspentMap = {}
13017  this.unspents = unspents.map(function (unspent) {
13018    // FIXME: remove unspent.hash in 2.0.0
13019    var txId = unspent.txId || unspent.hash
13020    var index = unspent.index
13021
13022    // FIXME: remove in 2.0.0
13023    if (unspent.hash !== undefined) {
13024      console.warn('unspent.hash is deprecated, use unspent.txId instead')
13025    }
13026
13027    // FIXME: remove in 2.0.0
13028    if (index === undefined) {
13029      console.warn('unspent.outputIndex is deprecated, use unspent.index instead')
13030      index = unspent.outputIndex
13031    }
13032
13033    typeForce('String', txId)
13034    typeForce('Number', index)
13035    typeForce('Number', unspent.value)
13036
13037    assert.equal(txId.length, 64, 'Expected valid txId, got ' + txId)
13038    assert.doesNotThrow(function () {
13039      Address.fromBase58Check(unspent.address)
13040    }, 'Expected Base58 Address, got ' + unspent.address)
13041    assert(isFinite(index), 'Expected finite index, got ' + index)
13042
13043    // FIXME: remove branch in 2.0.0
13044    if (unspent.confirmations !== undefined) {
13045      typeForce('Number', unspent.confirmations)
13046    }
13047
13048    var txHash = bufferutils.reverse(new Buffer(txId, 'hex'))
13049
13050    unspent = {
13051      address: unspent.address,
13052      confirmations: unspent.confirmations || 0,
13053      index: index,
13054      txHash: txHash,
13055      txId: txId,
13056      value: unspent.value,
13057
13058      // FIXME: remove in 2.0.0
13059      pending: unspent.pending || false
13060    }
13061
13062    // FIXME: remove in 2.0.0
13063    this.unspentMap[txId + ':' + index] = unspent
13064
13065    return unspent
13066  }, this)
13067}
13068
13069Wallet.prototype.signWith = function (tx, addresses) {
13070  addresses.forEach(function (address, i) {
13071    var privKey = this.getPrivateKeyForAddress(address)
13072
13073    tx.sign(i, privKey)
13074  }, this)
13075
13076  return tx
13077}
13078
13079function estimatePaddedFee (tx, network) {
13080  var tmpTx = tx.clone()
13081  tmpTx.addOutput(Script.EMPTY, network.dustSoftThreshold || 0)
13082
13083  return network.estimateFee(tmpTx)
13084}
13085
13086// FIXME: 1.0.0 shims, remove in 2.0.0
13087Wallet.prototype.getReceiveAddress = Wallet.prototype.getAddress
13088Wallet.prototype.createTx = Wallet.prototype.createTransaction
13089
13090module.exports = Wallet
13091
13092}).call(this,require("buffer").Buffer)
13093},{"./address":54,"./bufferutils":57,"./hdnode":63,"./networks":66,"./script":68,"./transaction_builder":71,"assert":5,"buffer":7,"randombytes":52,"typeforce":53}]},{},[64])(64)
13094});</script>
13094
13095        
13095<script>bitcoin.pubkeysToMultisig = function(M, pubkeys, network) {
13096    var r = {};
13097    r.redeemScript = bitcoin.scripts.multisigOutput(M, pubkeys);
13098    r.scriptPubKey = bitcoin.scripts.scriptHashOutput(r.redeemScript.getHash());
13099    r.address = bitcoin.Address.fromOutputScript(r.scriptPubKey, network).toString();
13100    return r;
13101}
13102
13103bitcoin.networks.shadow = {
13104  magicPrefix: '\x19ShadowCash Signed Message:\n',
13105  bip32: {
13106    public: 0xEE80286A,
13107    private: 0xEE8031E8
13108  },
13109  pubKeyHash: 0x3f,
13110  scriptHash: 0x7d,
13111  wif: 0xbf,
13112  dustThreshold: 0,
13113  feePerKb: 1000,
13114  estimateFee: function() { return "unused in this app" },
13115};
13116
13117bitcoin.networks.shadowtn = {
13118  magicPrefix: '\x19ShadowCash Signed Message:\n',
13119  bip32: {
13120    public: 0x76C0FDFB,
13121    private: 0x76C1077A
13122  },
13123  pubKeyHash: 0x7f,
13124  scriptHash: 0xc4,
13125  wif: 0xff,
13126  dustThreshold: 0,
13127  feePerKb: 1000,
13128  estimateFee: function() { return "unused in this app" },
13129};
13130
13131bitcoin.networks.dash = {
13132  bip32: {
13133    public: 0x0488b21e,
13134    private: 0x0488ade4
13135  },
13136  pubKeyHash: 0x4c,
13137  scriptHash: 0x10,
13138  wif: 0xcc,
13139};
13140
13141bitcoin.networks.game = {
13142  bip32: {
13143    public: 0x0488b21e,
13144    private: 0x0488ade4
13145  },
13146  pubKeyHash: 0x26,
13147  scriptHash: 0x05,
13148  wif: 0xa6,
13149};
13150</script>
13150
13151        
13151<script>// Converts a string into part of a multisig key
13152Part = function(s, i) {
13153
13154    var self = this;
13155
13156    this.prvkey = null;
13157    this.pubkey = null;
13158
13159    this.isValid = validate(s);
13160    this.tableRow = $("<tr>");
13161
13162    // set index in table row
13163    this.indexChar = String.fromCharCode(65+i);
13164    var indexCell = $("<td>").text(self.indexChar);
13165    self.tableRow.append(indexCell);
13166
13167    // set string cell in table row
13168    var stringCell = $("<td>").text(s);
13169    self.tableRow.append(stringCell);
13170
13171    // checks the part can be a part of a multisig key
13172    function validate(s) {
13173        // check hex public key
13174        try {
13175            self.pubkey = bitcoin.ECPubKey.fromHex(s);
13176            return true;
13177        }
13178        catch(e) {}
13179        // check WIF private key
13180        try {
13181            self.prvkey = bitcoin.ECKey.fromWIF(s);
13182            self.pubkey = self.prvkey.pub;
13183            return true;
13184        }
13185        catch(e) {}
13186        return false;
13187    }
13188}
13189</script>
13189
13190        
13190<script>Discover = function(options) {
13191
13192    var orderings = options.orderings || [];
13193    var onDiscover = options.onDiscover || function(el){};
13194    var onComplete = options.onComplete || function(){};
13195    var onStop = options.onStop || function(){};
13196    var onError = options.onError || function(el){};
13197    var network = options.network || bitcoin.networks.bitcoin;
13198
13199    var scrapeRate = 1000; // ms between checks to avoid rate limiting
13200
13201    var continueDiscovering = true;
13202
13203    this.stop = function() {
13204        onStop();
13205        continueDiscovering = false;
13206    }
13207
13208    function start() {
13209        checkAddressForOrderIndex(0, 0);
13210    }
13211
13212    function checkAddressForOrderIndex(i, m) {
13213        // stop if needed
13214        if (!continueDiscovering) {
13215            return;
13216        }
13217        // get address
13218        var ordering = orderings[i];
13219        var n = ordering.length;
13220        var orderingText = ordering.map(function(p) { return p.indexChar }).join("");
13221        var pubkeys = ordering.map(function(o) { return o.pubkey });
13222        // check address
13223        var multisig = bitcoin.pubkeysToMultisig(m, pubkeys, network);
13224        var address = multisig.address;
13225        var elText = orderingText + " : " + m + " of " + n + " : " + address;
13226        checkAddressForUsage(address, function(d) {
13227            var hasBeenUsed = d.txApperances && d.txApperances > 0;
13228            // show result
13229            var el = $("<div>");
13230            el.text(elText);
13231            if (hasBeenUsed) {
13232                el.addClass("text-success");
13233            }
13234            else {
13235                el.addClass("text-danger strikethrough");
13236            }
13237            if (continueDiscovering) {
13238                onDiscover(el);
13239            }
13240        }, function(e) {
13241            // show error
13242            var el = $("<div class='text-danger'>");
13243            // TODO be more specific with text here
13244            el.text(elText + " unknown error");
13245            if (continueDiscovering) {
13246                onError(el);
13247            }
13248        }, function() {
13249            // move onto the next address
13250            var nextI = i;
13251            var nextM = m + 1;
13252            if (nextM > n) {
13253                nextM = 0;
13254                nextI = i + 1;
13255            }
13256            if (nextI >= orderings.length) {
13257                if (continueDiscovering) {
13258                    onComplete();
13259                }
13260                return;
13261            } else {
13262                setTimeout(function() {
13263                    checkAddressForOrderIndex(nextI, nextM);
13264                }, scrapeRate);
13265            }
13266        });
13267    }
13268
13269    function checkAddressForUsage(address, onSuccess, onError, onComplete) {
13270        $.ajax({
13271            url: "https://insight.bitpay.com/api/addr/" + address + "/?noTxList=1",
13272            success: onSuccess,
13273            error: onError,
13274            complete: onComplete,
13275        });
13276    }
13277
13278    start();
13279
13280}
13281</script>
13281
13282        
13282<script>// An extremely basic translation library
13283//
13284// Example usage:
13285//
13286// Set some html to be translated. Do this using the 'data-translate' attribute:
13287//
13288//   <div data-translate>Test</div>
13289//   <div data-translate-html><em>keep em tag</em></div>
13290//   <input data-translate-placeholder placeholder="Example placeholder">
13291//   <span data-translate-title title="Example title"></span>
13292//
13293// Obtain all the phrases to be translated via js debug console:
13294//
13295//   Translate.phrasesAsJson();
13296//
13297// Use that template to translate the phrases into another language.
13298// Leave the key the same. Change the value to the new language.
13299//
13300// Create a js file to load the new phrases. In this example for Spanish,
13301// es.js will contain the following code:
13302//
13303//   Translate.loadForeignPhrases("es", {
13304//       "Test": "Test in Spanish",
13305//       "<em>keep em tag</em>": "<em>keep em tag in Spanish</em>",
13306//       "Example placeholder": "Example placeholder in Spanish"
13307//       "Example title": "Example title in Spanish"
13308//   });
13309//
13310// In your UI put a listener for clicking on the Spanish button:
13311//
13312//   mySpanishButton.addEventListener("click", function() {
13313//       Translate.setLanguage("es");
13314//   });
13315//   myEnglishButton.addEventListener("click", function() {
13316//       Translate.setLanguage("en");
13317//   });
13318
13319Translate = new (function() {
13320
13321    var defaultLanguage = "en";
13322
13323    var allPhrases = {};
13324    allPhrases[defaultLanguage] = {};
13325
13326    // Node types
13327
13328    var text = {
13329        selector: "[data-translate]",
13330        getKey: function() {
13331            return this.textContent.trim().replace(/\s+/g, " ");
13332        },
13333        setPhrase: function(p) {
13334            this.textContent = p;
13335        },
13336    }
13337
13338    var html = {
13339        selector: "[data-translate-html]",
13340        getKey: function() {
13341            return this.innerHTML.trim().replace(/\s+/g, " ");
13342        },
13343        setPhrase: function(p) {
13344            this.innerHTML = p;
13345        },
13346    }
13347
13348    var placeholder = {
13349        selector: "[data-translate-placeholder]",
13350        getKey: function() {
13351            return this.getAttribute("placeholder").trim().replace(/\s+/g, " ");
13352        },
13353        setPhrase: function(p) {
13354            this.setAttribute("placeholder", p);
13355        },
13356    }
13357
13358    var title = {
13359        selector: "[data-translate-title]",
13360        getKey: function() {
13361            return this.getAttribute("title").trim().replace(/\s+/g, " ");
13362        },
13363        setPhrase: function(p) {
13364            this.setAttribute("title", p);
13365        },
13366    }
13367
13368    // Get elements to be translated
13369    var allEls = getEls(text)
13370        .concat(getEls(html))
13371        .concat(getEls(placeholder))
13372        .concat(getEls(title));
13373
13374    // Provides access to phrases from a non-default language.
13375    // See phrases_en.js for example usage.
13376    this.loadForeignPhrases = function(language, phrases) {
13377        allPhrases[language] =  phrases;
13378    }
13379
13380    // Displays a different language, eg "en" or "fr"
13381    this.setLanguage = function(language) {
13382        for (var i=0; i<allEls.length; i++) {
13383            var el = allEls[i];
13384            var key = el.key;
13385            if (!(language in allPhrases)) {
13386                console.log(language + " not in allPhrases");
13387                return;
13388            }
13389            if (!(key in allPhrases[language])) {
13390                console.log(language + " does not contain phrase: " + key);
13391                return;
13392            }
13393            var phrase = allPhrases[language][key];
13394            el.setPhrase(phrase);
13395        }
13396    }
13397
13398    // Converts the phrases to a key-pair json file.
13399    // This is a good way to export phrases for use in translation tools.
13400    this.phrasesAsJson = function(language) {
13401        var keys = [];
13402        for (var i=0; i<allEls.length; i++) {
13403            var el = allEls[i];
13404            var key = el.key;
13405            keys.push(key);
13406        }
13407        keys.sort();
13408        var output = {};
13409        for (var i=0; i<keys.length; i++) {
13410            var key = keys[i];
13411            var translated = "";
13412            if (language in allPhrases && key in allPhrases[language]) {
13413                translated = allPhrases[language][key];
13414            }
13415            output[key] = translated;
13416        }
13417        return JSON.stringify(output, null, 2);
13418    }
13419
13420    function getEls(nodeType) {
13421        var nodes = document.querySelectorAll(nodeType.selector);
13422        var els = [];
13423        for (var i=0; i<nodes.length; i++) {
13424            var node = nodes[i];
13425            node.getKey = nodeType.getKey;
13426            node.setPhrase = nodeType.setPhrase;
13427            node.key = node.getKey();
13428            allPhrases[defaultLanguage][node.key] = node.key;
13429            els.push(node);
13430        }
13431        return els;
13432    }
13433
13434})();
13435</script>
13435
13436        
13436<script>(function() {
13437
13438    var self = this;
13439
13440    var showQr = false;
13441    var network = bitcoin.networks.bitcoin;
13442    var parts = [];
13443    var orderedPubkeys = [];
13444    var orderings = [];
13445    var discoveryProcesses = [];
13446    var discoveriesCompleted = 0;
13447
13448    var DOM = {};
13449    DOM.feedback = $(".feedback");
13450    DOM.parts = $(".parts");
13451    DOM.network = $("#network");
13452    DOM.qrContainer = $(".qr-container");
13453    DOM.qrHider = DOM.qrContainer.find(".qr-hider");
13454    DOM.qrImage = DOM.qrContainer.find(".qr-image");
13455    DOM.qrHint = DOM.qrContainer.find(".qr-hint");
13456    DOM.showQrEls = $("[data-show-qr]");
13457    DOM.partList = $(".part-list");
13458    DOM.participantsCount = $(".participants-count");
13459    DOM.signatoriesCount = $(".signatories-count");
13460    DOM.partOrder = $(".part-order");
13461    DOM.address = $(".address");
13462    DOM.pubkeyScript = $(".pubkey-script");
13463    DOM.redeemScript = $(".redeem-script");
13464    DOM.discover = $(".discover");
13465    DOM.discovered = $(".discovered");
13466    DOM.discoverInProgress = $(".discover-in-progress");
13467    DOM.remainingDiscoveries = $(".discover-in-progress .remaining");
13468    DOM.totalDiscoveries = $(".discover-in-progress .total");
13469    DOM.cancelDiscover = $(".cancel-discover");
13470    DOM.bip45order = $(".bip45-order");
13471    DOM.bip45address = $(".bip45-address");
13472
13473    function init() {
13474        // Events
13475        DOM.parts.on("input", partsChanged);
13476        DOM.network.on("change", networkChanged);
13477        DOM.signatoriesCount.on("change", detailsChanged);
13478        DOM.partOrder.on("change", detailsChanged);
13479        DOM.discover.on("click", discoverClicked);
13480        DOM.cancelDiscover.on("click", cancelDiscoverClicked);
13481        setQrEvents(DOM.showQrEls);
13482        hideFeedback();
13483        populateNetworkSelect();
13484    }
13485
13486    // Event handlers
13487
13488    function partsChanged(e) {
13489        clearDom();
13490        stopExistingDiscoveries();
13491        var partsStr = DOM.parts.val();
13492        parts = partsFromString(partsStr);
13493        if (parts.length == 0) {
13494            return;
13495        }
13496        orderings = orderingsFromParts(parts);
13497        displayPartList();
13498        setDetails();
13499        detailsChanged();
13500    }
13501
13502    function detailsChanged() {
13503        var orderIndex = parseInt(DOM.partOrder.val());
13504        var ordering = orderings[orderIndex];
13505        var pubKeys = ordering.map(function(o) { return o.pubkey });
13506        var M = parseInt(DOM.signatoriesCount.val());
13507        var multisig = bitcoin.pubkeysToMultisig(M, pubKeys, network);
13508        // address
13509        DOM.redeemScript.text(multisig.redeemScript.toHex());
13510        DOM.pubkeyScript.val(multisig.scriptPubKey.toHex());
13511        DOM.address.val(multisig.address);
13512        // bip45 values
13513        var k = orderedPubkeys.map(function(p) { return p.pubkey });
13514        var bip45multisig = bitcoin.pubkeysToMultisig(M, k, network);
13515        DOM.bip45address.val(bip45multisig.address);
13516    }
13517
13518    function networkChanged(e) {
13519        var networkIndex = e.target.value;
13520        networks[networkIndex].onSelect();
13521        detailsChanged();
13522    }
13523
13524    function discoverClicked() {
13525        stopExistingDiscoveries();
13526        clearDisplayedDiscoveries();
13527        discoverUsedAddresses();
13528    }
13529
13530    function cancelDiscoverClicked() {
13531        stopExistingDiscoveries();
13532        hideDiscoverInProgress();
13533    }
13534
13535    // Private methods
13536
13537    function setDetails() {
13538        // N
13539        var N = parts.length;
13540        DOM.participantsCount.text(N);
13541        // M
13542        DOM.signatoriesCount.empty();
13543        for (var i=0; i<=parts.length; i++) {
13544            var option =$("<option>");
13545            option.attr("value", i);
13546            option.text(i);
13547            DOM.signatoriesCount.append(option);
13548        }
13549        var M = initialSignatoryCount(N);
13550        DOM.signatoriesCount.val(M);
13551        // lexicographical order
13552        orderedPubkeys = [];
13553        for (var i=0; i<parts.length; i++) {
13554            var part = parts[i];
13555            orderedPubkeys.push({
13556                pubkey: part.pubkey,
13557                hex: part.pubkey.toHex(),
13558                indexChar: part.indexChar,
13559            });
13560        }
13561        orderedPubkeys.sort(function(a, b) { return a.hex > b.hex });
13562        var orderText = "";
13563        for (var i=0; i<orderedPubkeys.length; i++) {
13564            orderText = orderText + orderedPubkeys[i].indexChar;
13565        }
13566        DOM.bip45order.val(orderText);
13567        // Ordering
13568        DOM.partOrder.empty();
13569        for (var i=0; i<orderings.length; i++) {
13570            var ordering = orderings[i];
13571            var option = $("<option>");
13572            option.attr("value", i);
13573            var optionText = ordering.map(function(p) { return p.indexChar }).join("");
13574            option.text(optionText);
13575            DOM.partOrder.append(option);
13576        }
13577    }
13578
13579    function stopExistingDiscoveries() {
13580        while (discoveryProcesses.length > 0) {
13581            var p = discoveryProcesses.shift();
13582            p.stop();
13583        }
13584    }
13585
13586    function clearDisplayedDiscoveries() {
13587        DOM.discovered.empty();
13588    }
13589
13590    function discoverUsedAddresses() {
13591        if (orderings.length == 0) {
13592            return;
13593        }
13594        var totalDiscoveries = orderings.length * (orderings[0].length + 1);
13595        DOM.totalDiscoveries.text(totalDiscoveries);
13596        discoveriesCompleted = 0;
13597        showDiscoverInProgress();
13598        var p = new Discover({
13599            orderings: orderings,
13600            onDiscover: displayDiscovery,
13601            onComplete: discoverComplete,
13602            onStop: discoverStopped,
13603            onError: discoverError,
13604            network: network,
13605        });
13606        discoveryProcesses.push(p);
13607    }
13608
13609    function displayDiscovery(el) {
13610        discoveriesCompleted = discoveriesCompleted + 1;
13611        showDiscoverInProgress();
13612        DOM.discovered.append(el);
13613    }
13614
13615    function discoverComplete() {
13616        hideDiscoverInProgress();
13617    }
13618
13619    function discoverStopped() {
13620        hideDiscoverInProgress();
13621    }
13622
13623    function discoverError(msg) {
13624        var el = $("<div class='text-danger'>");
13625        el.text(msg);
13626        DOM.discovered.append(el);
13627    }
13628
13629    function showDiscoverInProgress() {
13630        DOM.remainingDiscoveries.text(discoveriesCompleted);
13631        DOM.cancelDiscover.removeClass("hidden");
13632        DOM.discover.addClass("hidden");
13633        DOM.discoverInProgress.removeClass("hidden");
13634    }
13635
13636    function hideDiscoverInProgress() {
13637        DOM.cancelDiscover.addClass("hidden");
13638        DOM.discover.removeClass("hidden");
13639        DOM.discoverInProgress.addClass("hidden");
13640    }
13641
13642    function partsFromString(s) {
13643        var parts = [];
13644        // filter valid parts
13645        var bits = s.split(/\W+/g);
13646        for (var i=0; i<bits.length; i++) {
13647            var bit = bits[i];
13648            var part = new Part(bit, parts.length);
13649            if (part.isValid) {
13650                parts.push(part);
13651            }
13652        }
13653        return parts;
13654    }
13655
13656    function displayPartList() {
13657        DOM.partList.empty();
13658        if (parts.length == 0) {
13659            DOM.partList.append($("<tr><td>No valid parts</td></tr>"));
13660        }
13661        for (var i=0; i<parts.length; i++) {
13662            var part = parts[i];
13663            DOM.partList.append(part.tableRow);
13664        }
13665    }
13666
13667    function hideFeedback() {
13668        DOM.feedback
13669            .text("")
13670            .hide();
13671    }
13672
13673    function populateNetworkSelect() {
13674        for (var i=0; i<networks.length; i++) {
13675            var network = networks[i];
13676            var option = $("<option>");
13677            option.attr("value", i);
13678            option.text(network.name);
13679            DOM.network.append(option);
13680        }
13681    }
13682
13683    function setQrEvents(els) {
13684        els.on("mouseenter", createQr);
13685        els.on("mouseleave", destroyQr);
13686        els.on("click", toggleQr);
13687    }
13688
13689    function createQr(e) {
13690        var content = e.target.textContent || e.target.value;
13691        if (content) {
13692            var size = 130;
13693            DOM.qrImage.qrcode({width: size, height: size, text: content});
13694            if (!showQr) {
13695                DOM.qrHider.addClass("hidden");
13696            }
13697            else {
13698                DOM.qrHider.removeClass("hidden");
13699            }
13700            DOM.qrContainer.removeClass("hidden");
13701        }
13702    }
13703
13704    function destroyQr() {
13705        DOM.qrImage.text("");
13706        DOM.qrContainer.addClass("hidden");
13707    }
13708
13709    function toggleQr() {
13710        showQr = !showQr;
13711        DOM.qrHider.toggleClass("hidden");
13712        DOM.qrHint.toggleClass("hidden");
13713    }
13714
13715    // https://stackoverflow.com/a/20871714
13716    function orderingsFromParts(inputArr) {
13717        var results = [];
13718        function permute(arr, memo) {
13719            var cur, memo = memo || [];
13720            for (var i = 0; i < arr.length; i++) {
13721                cur = arr.splice(i, 1);
13722                if (arr.length === 0) {
13723                    results.push(memo.concat(cur));
13724                }
13725                permute(arr.slice(), memo.concat(cur));
13726                arr.splice(i, 0, cur[0]);
13727            }
13728            return results;
13729        }
13730        return permute(inputArr);
13731    }
13732
13733    function initialSignatoryCount(n) {
13734        return Math.ceil(n/2);
13735    }
13736
13737    function clearDom() {
13738        parts = [];
13739        orderings = [];
13740        DOM.partList.empty();
13741        DOM.discovered.empty();
13742        hideDiscoverInProgress();
13743        DOM.participantsCount.text("N");
13744        DOM.signatoriesCount.empty().append($("<option>M</option>"));
13745        DOM.partOrder.empty();
13746        DOM.address.val("");
13747        DOM.pubkeyScript.val("");
13748        DOM.redeemScript.text("");
13749    }
13750
13751    var networks = [
13752        {
13753            name: "Bitcoin",
13754            onSelect: function() {
13755                network = bitcoin.networks.bitcoin;
13756            },
13757        },
13758        {
13759            name: "Bitcoin Testnet",
13760            onSelect: function() {
13761                network = bitcoin.networks.testnet;
13762            },
13763        },
13764        {
13765            name: "Dogecoin",
13766            onSelect: function() {
13767                network = bitcoin.networks.dogecoin;
13768            },
13769        },
13770        {
13771            name: "DASH",
13772            onSelect: function() {
13773                network = bitcoin.networks.dash;
13774            },
13775        },
13776        {
13777            name: "GAME",
13778            onSelect: function() {
13779                network = bitcoin.networks.game;
13780            },
13781        },
13782        {
13783            name: "Jumbucks",
13784            onSelect: function() {
13785                network = bitcoin.networks.jumbucks;
13786            },
13787        },
13788        {
13789            name: "Litecoin",
13790            onSelect: function() {
13791                network = bitcoin.networks.litecoin;
13792            },
13793        },
13794        {
13795            name: "ShadowCash",
13796            onSelect: function() {
13797                network = bitcoin.networks.shadow;
13798            },
13799        },
13800        {
13801            name: "ShadowCash Testnet",
13802            onSelect: function() {
13803                network = bitcoin.networks.shadowtn;
13804            },
13805        },
13806        {
13807            name: "Viacoin",
13808            onSelect: function() {
13809                network = bitcoin.networks.viacoin;
13810            },
13811        },
13812        {
13813            name: "Viacoin Testnet",
13814            onSelect: function() {
13815                network = bitcoin.networks.viacointestnet;
13816            },
13817        },
13818    ]
13819
13820    init();
13821
13822}
13822)();
13823</script>
13823
13824    </body>
13825</html>

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.