Zsolt Haraszti | 9ceb1b8 | 2016-10-01 15:15:18 -0700 | [diff] [blame] | 1 | /** |
| 2 | * swagger-ui - Swagger UI is a dependency-free collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API |
| 3 | * @version v2.2.5 |
| 4 | * @link http://swagger.io |
| 5 | * @license Apache-2.0 |
| 6 | */ |
| 7 | (function(){/* jshint ignore:start */ |
| 8 | {(function() { |
| 9 | var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; |
| 10 | templates['apikey_auth'] = template({"1":function(container,depth0,helpers,partials,data) { |
| 11 | var stack1; |
| 12 | |
| 13 | return " <span class=\"key_auth__value\">" |
| 14 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.value : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 15 | + "</span>\n"; |
| 16 | },"3":function(container,depth0,helpers,partials,data) { |
| 17 | return " <input placeholder=\"api_key\" class=\"auth_input input_apiKey_entry\" name=\"apiKey\" type=\"text\"/>\n"; |
| 18 | },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { |
| 19 | var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing; |
| 20 | |
| 21 | return "<div class=\"key_input_container\">\n <h3 class=\"auth__title\">Api key authorization</h3>\n <div class=\"auth__description\">" |
| 22 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.description : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 23 | + "</div>\n <div>\n <div class=\"key_auth__field\">\n <span class=\"key_auth__label\">name:</span>\n <span class=\"key_auth__value\">" |
| 24 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.name : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 25 | + "</span>\n </div>\n <div class=\"key_auth__field\">\n <span class=\"key_auth__label\">in:</span>\n <span class=\"key_auth__value\">" |
| 26 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0["in"] : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 27 | + "</span>\n </div>\n <div class=\"key_auth__field\">\n <span class=\"key_auth__label\">value:</span>\n" |
| 28 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.isLogout : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.program(3, data, 0),"data":data})) != null ? stack1 : "") |
| 29 | + " </div>\n </div>\n</div>\n"; |
| 30 | },"useData":true}); |
| 31 | templates['auth_button'] = template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { |
| 32 | return "<a class='authorize__btn' href=\"#\">Authorize</a>\n"; |
| 33 | },"useData":true}); |
| 34 | templates['auth_button_operation'] = template({"1":function(container,depth0,helpers,partials,data) { |
| 35 | return " authorize__btn_operation_login\n"; |
| 36 | },"3":function(container,depth0,helpers,partials,data) { |
| 37 | return " authorize__btn_operation_logout\n"; |
| 38 | },"5":function(container,depth0,helpers,partials,data) { |
| 39 | var stack1; |
| 40 | |
| 41 | return " <ul class=\"authorize-scopes\">\n" |
| 42 | + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.scopes : depth0),{"name":"each","hash":{},"fn":container.program(6, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 43 | + " </ul>\n"; |
| 44 | },"6":function(container,depth0,helpers,partials,data) { |
| 45 | var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing; |
| 46 | |
| 47 | return " <li class=\"authorize__scope\" title=\"" |
| 48 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.description : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 49 | + "\">" |
| 50 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.scope : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 51 | + "</li>\n"; |
| 52 | },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { |
| 53 | var stack1, alias1=depth0 != null ? depth0 : {}; |
| 54 | |
| 55 | return "<div class=\"authorize__btn authorize__btn_operation\n" |
| 56 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.isLogout : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.program(3, data, 0),"data":data})) != null ? stack1 : "") |
| 57 | + "\">\n" |
| 58 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.scopes : depth0),{"name":"if","hash":{},"fn":container.program(5, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 59 | + "</div>\n"; |
| 60 | },"useData":true}); |
| 61 | templates['auth_view'] = template({"1":function(container,depth0,helpers,partials,data) { |
| 62 | return " <button type=\"button\" class=\"auth__button auth_submit__button\" data-sw-translate>Authorize</button>\n"; |
| 63 | },"3":function(container,depth0,helpers,partials,data) { |
| 64 | return " <button type=\"button\" class=\"auth__button auth_logout__button\" data-sw-translate>Logout</button>\n"; |
| 65 | },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { |
| 66 | var stack1, alias1=depth0 != null ? depth0 : {}; |
| 67 | |
| 68 | return "<div class=\"auth_container\">\n\n <div class=\"auth_inner\"></div>\n <div class=\"auth_submit\">\n" |
| 69 | + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isLogout : depth0),{"name":"unless","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 70 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.isAuthorized : depth0),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 71 | + " </div>\n\n</div>\n"; |
| 72 | },"useData":true}); |
| 73 | templates['basic_auth'] = template({"1":function(container,depth0,helpers,partials,data) { |
| 74 | return " - authorized"; |
| 75 | },"3":function(container,depth0,helpers,partials,data) { |
| 76 | var stack1; |
| 77 | |
| 78 | return " <span class=\"basic_auth__value\">" |
| 79 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.username : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 80 | + "</span>\n"; |
| 81 | },"5":function(container,depth0,helpers,partials,data) { |
| 82 | return " <input required placeholder=\"username\" class=\"basic_auth__username auth_input\" name=\"username\" type=\"text\"/>\n"; |
| 83 | },"7":function(container,depth0,helpers,partials,data) { |
| 84 | return " <div class=\"auth_label\">\n <span class=\"basic_auth__label\" data-sw-translate>password:</span>\n <input required placeholder=\"password\" class=\"basic_auth__password auth_input\" name=\"password\" type=\"password\"/></label>\n </div>\n"; |
| 85 | },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { |
| 86 | var stack1, alias1=depth0 != null ? depth0 : {}; |
| 87 | |
| 88 | return "<div class='basic_auth_container'>\n <h3 class=\"auth__title\">Basic authentication" |
| 89 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.isLogout : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 90 | + "</h3>\n <form class=\"basic_input_container\">\n <div class=\"auth__description\">" |
| 91 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || helpers.helperMissing).call(alias1,(depth0 != null ? depth0.description : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 92 | + "</div>\n <div class=\"auth_label\">\n <span class=\"basic_auth__label\" data-sw-translate>username:</span>\n" |
| 93 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.isLogout : depth0),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.program(5, data, 0),"data":data})) != null ? stack1 : "") |
| 94 | + " </div>\n" |
| 95 | + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isLogout : depth0),{"name":"unless","hash":{},"fn":container.program(7, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 96 | + " </form>\n</div>\n"; |
| 97 | },"useData":true}); |
| 98 | templates['content_type'] = template({"1":function(container,depth0,helpers,partials,data) { |
| 99 | var stack1; |
| 100 | |
| 101 | return ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.produces : depth0),{"name":"each","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : ""); |
| 102 | },"2":function(container,depth0,helpers,partials,data) { |
| 103 | var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing; |
| 104 | |
| 105 | return " <option value=\"" |
| 106 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,depth0,{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 107 | + "\">" |
| 108 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,depth0,{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 109 | + "</option>\n"; |
| 110 | },"4":function(container,depth0,helpers,partials,data) { |
| 111 | return " <option value=\"application/json\">application/json</option>\n"; |
| 112 | },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { |
| 113 | var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing; |
| 114 | |
| 115 | return "<label data-sw-translate for=\"" |
| 116 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.contentTypeId : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 117 | + "\">Response Content Type</label>\n<select name=\"contentType\" id=\"" |
| 118 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.contentTypeId : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 119 | + "\">\n" |
| 120 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.produces : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.program(4, data, 0),"data":data})) != null ? stack1 : "") |
| 121 | + "</select>\n"; |
| 122 | },"useData":true}); |
| 123 | templates['main'] = template({"1":function(container,depth0,helpers,partials,data) { |
| 124 | var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing; |
| 125 | |
| 126 | return " <div class=\"info_title\">" |
| 127 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.title : stack1),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 128 | + "</div>\n <div class=\"info_description markdown\">" |
| 129 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.description : stack1),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 130 | + "</div>\n" |
| 131 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.externalDocs : depth0),{"name":"if","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 132 | + " " |
| 133 | + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.termsOfServiceUrl : stack1),{"name":"if","hash":{},"fn":container.program(4, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 134 | + "\n " |
| 135 | + ((stack1 = helpers["if"].call(alias1,((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.name : stack1),{"name":"if","hash":{},"fn":container.program(6, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 136 | + "\n " |
| 137 | + ((stack1 = helpers["if"].call(alias1,((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1),{"name":"if","hash":{},"fn":container.program(8, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 138 | + "\n " |
| 139 | + ((stack1 = helpers["if"].call(alias1,((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.email : stack1),{"name":"if","hash":{},"fn":container.program(10, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 140 | + "\n " |
| 141 | + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1),{"name":"if","hash":{},"fn":container.program(12, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 142 | + "\n"; |
| 143 | },"2":function(container,depth0,helpers,partials,data) { |
| 144 | var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing; |
| 145 | |
| 146 | return " <p>" |
| 147 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,((stack1 = (depth0 != null ? depth0.externalDocs : depth0)) != null ? stack1.description : stack1),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 148 | + "</p>\n <a href=\"" |
| 149 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,((stack1 = (depth0 != null ? depth0.externalDocs : depth0)) != null ? stack1.url : stack1),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 150 | + "\" target=\"_blank\">" |
| 151 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,((stack1 = (depth0 != null ? depth0.externalDocs : depth0)) != null ? stack1.url : stack1),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 152 | + "</a>\n"; |
| 153 | },"4":function(container,depth0,helpers,partials,data) { |
| 154 | var stack1; |
| 155 | |
| 156 | return "<div class=\"info_tos\"><a target=\"_blank\" href=\"" |
| 157 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || helpers.helperMissing).call(depth0 != null ? depth0 : {},((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.termsOfServiceUrl : stack1),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 158 | + "\" data-sw-translate>Terms of service</a></div>"; |
| 159 | },"6":function(container,depth0,helpers,partials,data) { |
| 160 | var stack1; |
| 161 | |
| 162 | return "<div><div class='info_name' style=\"display: inline\" data-sw-translate>Created by </div> " |
| 163 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || helpers.helperMissing).call(depth0 != null ? depth0 : {},((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.name : stack1),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 164 | + "</div>"; |
| 165 | },"8":function(container,depth0,helpers,partials,data) { |
| 166 | var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing; |
| 167 | |
| 168 | return "<div class='info_url' data-sw-translate>See more at <a href=\"" |
| 169 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 170 | + "\">" |
| 171 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 172 | + "</a></div>"; |
| 173 | },"10":function(container,depth0,helpers,partials,data) { |
| 174 | var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing; |
| 175 | |
| 176 | return "<div class='info_email'><a target=\"_parent\" href=\"mailto:" |
| 177 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.email : stack1),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 178 | + "?subject=" |
| 179 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.title : stack1),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 180 | + "\" data-sw-translate>Contact the developer</a></div>"; |
| 181 | },"12":function(container,depth0,helpers,partials,data) { |
| 182 | var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing; |
| 183 | |
| 184 | return "<div class='info_license'><a target=\"_blank\" href='" |
| 185 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1)) != null ? stack1.url : stack1),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 186 | + "'>" |
| 187 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1)) != null ? stack1.name : stack1),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 188 | + "</a></div>"; |
| 189 | },"14":function(container,depth0,helpers,partials,data) { |
| 190 | var stack1; |
| 191 | |
| 192 | return " , <span style=\"font-variant: small-caps\" data-sw-translate>api version</span>: " |
| 193 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || helpers.helperMissing).call(depth0 != null ? depth0 : {},((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.version : stack1),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 194 | + "\n "; |
| 195 | },"16":function(container,depth0,helpers,partials,data) { |
| 196 | var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing; |
| 197 | |
| 198 | return " <span style=\"float:right\"><a target=\"_blank\" href=\"" |
| 199 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.validatorUrl : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 200 | + "/debug?url=" |
| 201 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.url : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 202 | + "\"><img id=\"validator\" src=\"" |
| 203 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.validatorUrl : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 204 | + "?url=" |
| 205 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.url : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 206 | + "\"></a>\n </span>\n"; |
| 207 | },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { |
| 208 | var stack1, alias1=depth0 != null ? depth0 : {}; |
| 209 | |
| 210 | return "<div class='info' id='api_info'>\n" |
| 211 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.info : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 212 | + "</div>\n<div class='container' id='resources_container'>\n <div class='authorize-wrapper'></div>\n\n <ul id='resources'></ul>\n\n <div class=\"footer\">\n <h4 style=\"color: #999\">[ <span style=\"font-variant: small-caps\">base url</span>: " |
| 213 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || helpers.helperMissing).call(alias1,(depth0 != null ? depth0.basePath : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 214 | + "\n" |
| 215 | + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.version : stack1),{"name":"if","hash":{},"fn":container.program(14, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 216 | + "]\n" |
| 217 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.validatorUrl : depth0),{"name":"if","hash":{},"fn":container.program(16, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 218 | + " </h4>\n </div>\n</div>\n"; |
| 219 | },"useData":true}); |
| 220 | templates['oauth2'] = template({"1":function(container,depth0,helpers,partials,data) { |
| 221 | var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing; |
| 222 | |
| 223 | return " <li>\n <input class=\"oauth-scope\" type=\"checkbox\" data-scope=\"" |
| 224 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.scope : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 225 | + "\" oauthtype=\"" |
| 226 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.OAuthSchemeKey : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 227 | + "\"/>\n <label>" |
| 228 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.scope : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 229 | + "</label><br/>\n <span class=\"api-scope-desc\">" |
| 230 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.description : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 231 | + "\n" |
| 232 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.OAuthSchemeKey : depth0),{"name":"if","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 233 | + " </span>\n </li>\n"; |
| 234 | },"2":function(container,depth0,helpers,partials,data) { |
| 235 | var stack1; |
| 236 | |
| 237 | return " (" |
| 238 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.OAuthSchemeKey : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 239 | + ")\n"; |
| 240 | },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { |
| 241 | var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing; |
| 242 | |
| 243 | return "<div>\n <h3 class=\"auth__title\">Select OAuth2.0 Scopes</h3>\n <p>" |
| 244 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.description : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 245 | + "</p>\n <p>Scopes are used to grant an application different levels of access to data on behalf of the end user. Each API may declare one or more scopes.\n <a href=\"#\">Learn how to use</a>\n </p>\n <p><strong> " |
| 246 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.appName : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 247 | + " </strong> API requires the following scopes. Select which ones you want to grant to Swagger UI.</p>\n <p>Authorization URL: " |
| 248 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.authorizationUrl : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 249 | + "</p>\n <p>flow: " |
| 250 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.flow : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 251 | + "</p>\n <ul class=\"api-popup-scopes\">\n" |
| 252 | + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.scopes : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 253 | + " </ul>\n</div>"; |
| 254 | },"useData":true}); |
| 255 | templates['operation'] = template({"1":function(container,depth0,helpers,partials,data) { |
| 256 | return "deprecated"; |
| 257 | },"3":function(container,depth0,helpers,partials,data) { |
| 258 | return " <h4><span data-sw-translate>Warning: Deprecated</span></h4>\n"; |
| 259 | },"5":function(container,depth0,helpers,partials,data) { |
| 260 | var stack1; |
| 261 | |
| 262 | return " <h4><span data-sw-translate>Implementation Notes</span></h4>\n <div class=\"markdown\">" |
| 263 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.description : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 264 | + "</div>\n"; |
| 265 | },"7":function(container,depth0,helpers,partials,data) { |
| 266 | return " <div class='authorize-wrapper authorize-wrapper_operation'></div>\n"; |
| 267 | },"9":function(container,depth0,helpers,partials,data) { |
| 268 | var stack1, alias1=depth0 != null ? depth0 : {}; |
| 269 | |
| 270 | return " <div class=\"response-class\">\n <h4><span data-sw-translate>Response Class</span> (<span data-sw-translate>Status</span> " |
| 271 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || helpers.helperMissing).call(alias1,(depth0 != null ? depth0.successCode : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 272 | + ")</h4>\n " |
| 273 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.successDescription : depth0),{"name":"if","hash":{},"fn":container.program(10, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 274 | + "\n <p><span class=\"model-signature\" /></p>\n <br/>\n <div class=\"response-content-type\" />\n </div>\n"; |
| 275 | },"10":function(container,depth0,helpers,partials,data) { |
| 276 | var stack1; |
| 277 | |
| 278 | return "<div class=\"markdown\">" |
| 279 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.successDescription : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 280 | + "</div>"; |
| 281 | },"12":function(container,depth0,helpers,partials,data) { |
| 282 | var stack1; |
| 283 | |
| 284 | return " <h4 data-sw-translate>Headers</h4>\n <table class=\"headers\">\n <thead>\n <tr>\n <th style=\"width: 100px; max-width: 100px\" data-sw-translate>Header</th>\n <th style=\"width: 310px; max-width: 310px\" data-sw-translate>Description</th>\n <th style=\"width: 200px; max-width: 200px\" data-sw-translate>Type</th>\n <th style=\"width: 320px; max-width: 320px\" data-sw-translate>Other</th>\n </tr>\n </thead>\n <tbody>\n" |
| 285 | + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.headers : depth0),{"name":"each","hash":{},"fn":container.program(13, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 286 | + " </tbody>\n </table>\n"; |
| 287 | },"13":function(container,depth0,helpers,partials,data) { |
| 288 | var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing; |
| 289 | |
| 290 | return " <tr>\n <td>" |
| 291 | + container.escapeExpression(((helper = (helper = helpers.key || (data && data.key)) != null ? helper : alias2),(typeof helper === "function" ? helper.call(alias1,{"name":"key","hash":{},"data":data}) : helper))) |
| 292 | + "</td>\n <td>" |
| 293 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.description : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 294 | + "</td>\n <td>" |
| 295 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.type : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 296 | + "</td>\n <td>" |
| 297 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.other : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 298 | + "</td>\n </tr>\n"; |
| 299 | },"15":function(container,depth0,helpers,partials,data) { |
| 300 | return " <h4 data-sw-translate>Parameters</h4>\n <table class='fullwidth parameters'>\n <thead>\n <tr>\n <th style=\"width: 100px; max-width: 100px\" data-sw-translate>Parameter</th>\n <th style=\"width: 310px; max-width: 310px\" data-sw-translate>Value</th>\n <th style=\"width: 200px; max-width: 200px\" data-sw-translate>Description</th>\n <th style=\"width: 100px; max-width: 100px\" data-sw-translate>Parameter Type</th>\n <th style=\"width: 220px; max-width: 230px\" data-sw-translate>Data Type</th>\n </tr>\n </thead>\n <tbody class=\"operation-params\">\n\n </tbody>\n </table>\n"; |
| 301 | },"17":function(container,depth0,helpers,partials,data) { |
| 302 | return " <div style='margin:0;padding:0;display:inline'></div>\n <h4 data-sw-translate>Response Messages</h4>\n <table class='fullwidth response-messages'>\n <thead>\n <tr>\n <th data-sw-translate>HTTP Status Code</th>\n <th data-sw-translate>Reason</th>\n <th data-sw-translate>Response Model</th>\n <th data-sw-translate>Headers</th>\n </tr>\n </thead>\n <tbody class=\"operation-status\">\n </tbody>\n </table>\n"; |
| 303 | },"19":function(container,depth0,helpers,partials,data) { |
| 304 | return ""; |
| 305 | },"21":function(container,depth0,helpers,partials,data) { |
| 306 | return " <div class='sandbox_header'>\n <input class='submit' type='submit' value='Try it out!' data-sw-translate/>\n <a href='#' class='response_hider' style='display:none' data-sw-translate>Hide Response</a>\n <span class='response_throbber' style='display:none'></span>\n </div>\n"; |
| 307 | },"23":function(container,depth0,helpers,partials,data) { |
| 308 | return " <h4 data-sw-translate>Request Headers</h4>\n <div class='block request_headers'></div>\n"; |
| 309 | },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { |
| 310 | var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=container.escapeExpression; |
| 311 | |
| 312 | return " <ul class='operations' >\n <li class='" |
| 313 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.method : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 314 | + " operation' id='" |
| 315 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.parentId : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 316 | + "_" |
| 317 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.nickname : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 318 | + "'>\n <div class='heading'>\n <h3>\n <span class='http_method'>\n <a href='#!/" |
| 319 | + alias3((helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.encodedParentId : depth0),{"name":"sanitize","hash":{},"data":data})) |
| 320 | + "/" |
| 321 | + alias3((helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.nickname : depth0),{"name":"sanitize","hash":{},"data":data})) |
| 322 | + "' class=\"toggleOperation\">" |
| 323 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.method : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 324 | + "</a>\n </span>\n <span class='path'>\n <a href='#!/" |
| 325 | + alias3((helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.encodedParentId : depth0),{"name":"sanitize","hash":{},"data":data})) |
| 326 | + "/" |
| 327 | + alias3((helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.nickname : depth0),{"name":"sanitize","hash":{},"data":data})) |
| 328 | + "' class=\"toggleOperation " |
| 329 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.deprecated : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 330 | + "\">" |
| 331 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.path : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 332 | + "</a>\n </span>\n </h3>\n <ul class='options'>\n <li>\n <a href='#!/" |
| 333 | + alias3((helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.encodedParentId : depth0),{"name":"sanitize","hash":{},"data":data})) |
| 334 | + "/" |
| 335 | + alias3((helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.nickname : depth0),{"name":"sanitize","hash":{},"data":data})) |
| 336 | + "' class=\"toggleOperation\"><span class=\"markdown\">" |
| 337 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.summary : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 338 | + "</span></a>\n </li>\n </ul>\n </div>\n <div class='content' id='" |
| 339 | + alias3((helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.encodedParentId : depth0),{"name":"sanitize","hash":{},"data":data})) |
| 340 | + "_" |
| 341 | + alias3((helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.nickname : depth0),{"name":"sanitize","hash":{},"data":data})) |
| 342 | + "_content' style='display:none'>\n" |
| 343 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.deprecated : depth0),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 344 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.description : depth0),{"name":"if","hash":{},"fn":container.program(5, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 345 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.security : depth0),{"name":"if","hash":{},"fn":container.program(7, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 346 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.type : depth0),{"name":"if","hash":{},"fn":container.program(9, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 347 | + "\n" |
| 348 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.headers : depth0),{"name":"if","hash":{},"fn":container.program(12, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 349 | + "\n <form accept-charset='UTF-8' class='sandbox'>\n <div style='margin:0;padding:0;display:inline'></div>\n" |
| 350 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.parameters : depth0),{"name":"if","hash":{},"fn":container.program(15, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 351 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.responseMessages : depth0),{"name":"if","hash":{},"fn":container.program(17, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 352 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.isReadOnly : depth0),{"name":"if","hash":{},"fn":container.program(19, data, 0),"inverse":container.program(21, data, 0),"data":data})) != null ? stack1 : "") |
| 353 | + " </form>\n <div class='response' style='display:none'>\n <h4 class='curl'>Curl</h4>\n <div class='block curl'></div>\n <h4 data-sw-translate>Request URL</h4>\n <div class='block request_url'></div>\n" |
| 354 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.showRequestHeaders : depth0),{"name":"if","hash":{},"fn":container.program(23, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 355 | + " <h4 data-sw-translate>Response Body</h4>\n <div class='block response_body'></div>\n <h4 data-sw-translate>Response Code</h4>\n <div class='block response_code'></div>\n <h4 data-sw-translate>Response Headers</h4>\n <div class='block response_headers'></div>\n </div>\n </div>\n </li>\n </ul>\n"; |
| 356 | },"useData":true}); |
| 357 | templates['param'] = template({"1":function(container,depth0,helpers,partials,data) { |
| 358 | var stack1; |
| 359 | |
| 360 | return ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isFile : depth0),{"name":"if","hash":{},"fn":container.program(2, data, 0),"inverse":container.program(4, data, 0),"data":data})) != null ? stack1 : ""); |
| 361 | },"2":function(container,depth0,helpers,partials,data) { |
| 362 | var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing; |
| 363 | |
| 364 | return " <input type=\"file\" name='" |
| 365 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.name : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 366 | + "' id='" |
| 367 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.valueId : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 368 | + "'/>\n <div class=\"parameter-content-type\" />\n"; |
| 369 | },"4":function(container,depth0,helpers,partials,data) { |
| 370 | var stack1; |
| 371 | |
| 372 | return ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0["default"] : depth0),{"name":"if","hash":{},"fn":container.program(5, data, 0),"inverse":container.program(7, data, 0),"data":data})) != null ? stack1 : ""); |
| 373 | },"5":function(container,depth0,helpers,partials,data) { |
| 374 | var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing; |
| 375 | |
| 376 | return " <div class=\"editor_holder\"></div>\n <textarea class='body-textarea' name='" |
| 377 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.name : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 378 | + "' id='" |
| 379 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.valueId : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 380 | + "'>" |
| 381 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0["default"] : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 382 | + "</textarea>\n <br />\n <div class=\"parameter-content-type\" />\n"; |
| 383 | },"7":function(container,depth0,helpers,partials,data) { |
| 384 | var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing; |
| 385 | |
| 386 | return " <textarea class='body-textarea' name='" |
| 387 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.name : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 388 | + "' id='" |
| 389 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.valueId : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 390 | + "'></textarea>\n <div class=\"editor_holder\"></div>\n <br />\n <div class=\"parameter-content-type\" />\n"; |
| 391 | },"9":function(container,depth0,helpers,partials,data) { |
| 392 | var stack1; |
| 393 | |
| 394 | return ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isFile : depth0),{"name":"if","hash":{},"fn":container.program(2, data, 0),"inverse":container.program(10, data, 0),"data":data})) != null ? stack1 : ""); |
| 395 | },"10":function(container,depth0,helpers,partials,data) { |
| 396 | var stack1; |
| 397 | |
| 398 | return ((stack1 = (helpers.renderTextParam || (depth0 && depth0.renderTextParam) || helpers.helperMissing).call(depth0 != null ? depth0 : {},depth0,{"name":"renderTextParam","hash":{},"fn":container.program(11, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : ""); |
| 399 | },"11":function(container,depth0,helpers,partials,data) { |
| 400 | return ""; |
| 401 | },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { |
| 402 | var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing; |
| 403 | |
| 404 | return "<td class='code'><label for='" |
| 405 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.valueId : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 406 | + "'>" |
| 407 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.name : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 408 | + "</label></td>\n<td>\n\n" |
| 409 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.isBody : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.program(9, data, 0),"data":data})) != null ? stack1 : "") |
| 410 | + "\n</td>\n<td class=\"markdown\">" |
| 411 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.description : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 412 | + "</td>\n<td>" |
| 413 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.paramType : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 414 | + "</td>\n<td>\n <span class=\"model-signature\"></span>\n</td>\n"; |
| 415 | },"useData":true}); |
| 416 | templates['param_list'] = template({"1":function(container,depth0,helpers,partials,data) { |
| 417 | return " required"; |
| 418 | },"3":function(container,depth0,helpers,partials,data) { |
| 419 | return " multiple=\"multiple\""; |
| 420 | },"5":function(container,depth0,helpers,partials,data) { |
| 421 | return " required "; |
| 422 | },"7":function(container,depth0,helpers,partials,data) { |
| 423 | var stack1; |
| 424 | |
| 425 | return " <option " |
| 426 | + ((stack1 = helpers.unless.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.hasDefault : depth0),{"name":"unless","hash":{},"fn":container.program(8, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 427 | + " value=''></option>\n"; |
| 428 | },"8":function(container,depth0,helpers,partials,data) { |
| 429 | return " selected=\"\" "; |
| 430 | },"10":function(container,depth0,helpers,partials,data) { |
| 431 | var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing; |
| 432 | |
| 433 | return "\n <option " |
| 434 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.isDefault : depth0),{"name":"if","hash":{},"fn":container.program(11, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 435 | + " value='" |
| 436 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.value : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 437 | + "'> " |
| 438 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.value : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 439 | + " " |
| 440 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.isDefault : depth0),{"name":"if","hash":{},"fn":container.program(13, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 441 | + " </option>\n\n"; |
| 442 | },"11":function(container,depth0,helpers,partials,data) { |
| 443 | return " selected=\"\" "; |
| 444 | },"13":function(container,depth0,helpers,partials,data) { |
| 445 | return " (default) "; |
| 446 | },"15":function(container,depth0,helpers,partials,data) { |
| 447 | return "<strong>"; |
| 448 | },"17":function(container,depth0,helpers,partials,data) { |
| 449 | return "</strong>"; |
| 450 | },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { |
| 451 | var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing; |
| 452 | |
| 453 | return "<td class='code" |
| 454 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.required : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 455 | + "'><label for='" |
| 456 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.valueId : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 457 | + "'>" |
| 458 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.name : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 459 | + "</label></td>\n<td>\n <select " |
| 460 | + ((stack1 = (helpers.isArray || (depth0 && depth0.isArray) || alias2).call(alias1,depth0,{"name":"isArray","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 461 | + " class=\"parameter " |
| 462 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.required : depth0),{"name":"if","hash":{},"fn":container.program(5, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 463 | + "\" name=\"" |
| 464 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.name : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 465 | + "\" id=\"" |
| 466 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.valueId : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 467 | + "\">\n\n" |
| 468 | + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.required : depth0),{"name":"unless","hash":{},"fn":container.program(7, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 469 | + "\n" |
| 470 | + ((stack1 = helpers.each.call(alias1,((stack1 = (depth0 != null ? depth0.allowableValues : depth0)) != null ? stack1.descriptiveValues : stack1),{"name":"each","hash":{},"fn":container.program(10, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 471 | + "\n </select>\n</td>\n<td class=\"markdown\">" |
| 472 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.required : depth0),{"name":"if","hash":{},"fn":container.program(15, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 473 | + ((stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : alias2),(typeof helper === "function" ? helper.call(alias1,{"name":"description","hash":{},"data":data}) : helper))) != null ? stack1 : "") |
| 474 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.required : depth0),{"name":"if","hash":{},"fn":container.program(17, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 475 | + "</td>\n<td>" |
| 476 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.paramType : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 477 | + "</td>\n<td><span class=\"model-signature\"></span></td>\n"; |
| 478 | },"useData":true}); |
| 479 | templates['param_readonly'] = template({"1":function(container,depth0,helpers,partials,data) { |
| 480 | var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing; |
| 481 | |
| 482 | return " <textarea class='body-textarea' readonly='readonly' name='" |
| 483 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.name : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 484 | + "' id='" |
| 485 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.valueId : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 486 | + "'>" |
| 487 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0["default"] : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 488 | + "</textarea>\n <div class=\"parameter-content-type\" />\n"; |
| 489 | },"3":function(container,depth0,helpers,partials,data) { |
| 490 | var stack1; |
| 491 | |
| 492 | return ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0["default"] : depth0),{"name":"if","hash":{},"fn":container.program(4, data, 0),"inverse":container.program(6, data, 0),"data":data})) != null ? stack1 : ""); |
| 493 | },"4":function(container,depth0,helpers,partials,data) { |
| 494 | var stack1; |
| 495 | |
| 496 | return " " |
| 497 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0["default"] : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 498 | + "\n"; |
| 499 | },"6":function(container,depth0,helpers,partials,data) { |
| 500 | return " (empty)\n"; |
| 501 | },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { |
| 502 | var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing; |
| 503 | |
| 504 | return "<td class='code'><label for='" |
| 505 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.valueId : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 506 | + "'>" |
| 507 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.name : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 508 | + "</label></td>\n<td>\n" |
| 509 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.isBody : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.program(3, data, 0),"data":data})) != null ? stack1 : "") |
| 510 | + "</td>\n<td class=\"markdown\">" |
| 511 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.description : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 512 | + "</td>\n<td>" |
| 513 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.paramType : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 514 | + "</td>\n<td><span class=\"model-signature\"></span></td>\n"; |
| 515 | },"useData":true}); |
| 516 | templates['param_readonly_required'] = template({"1":function(container,depth0,helpers,partials,data) { |
| 517 | var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing; |
| 518 | |
| 519 | return " <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='" |
| 520 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.name : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 521 | + "' id='" |
| 522 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.valueId : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 523 | + "'>" |
| 524 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0["default"] : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 525 | + "</textarea>\n"; |
| 526 | },"3":function(container,depth0,helpers,partials,data) { |
| 527 | var stack1; |
| 528 | |
| 529 | return ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0["default"] : depth0),{"name":"if","hash":{},"fn":container.program(4, data, 0),"inverse":container.program(6, data, 0),"data":data})) != null ? stack1 : ""); |
| 530 | },"4":function(container,depth0,helpers,partials,data) { |
| 531 | var stack1; |
| 532 | |
| 533 | return " " |
| 534 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0["default"] : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 535 | + "\n"; |
| 536 | },"6":function(container,depth0,helpers,partials,data) { |
| 537 | return " (empty)\n"; |
| 538 | },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { |
| 539 | var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing; |
| 540 | |
| 541 | return "<td class='code required'><label for='" |
| 542 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.valueId : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 543 | + "'>" |
| 544 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.name : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 545 | + "</label></td>\n<td>\n" |
| 546 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.isBody : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.program(3, data, 0),"data":data})) != null ? stack1 : "") |
| 547 | + "</td>\n<td class=\"markdown\">" |
| 548 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.description : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 549 | + "</td>\n<td>" |
| 550 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.paramType : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 551 | + "</td>\n<td><span class=\"model-signature\"></span></td>\n"; |
| 552 | },"useData":true}); |
| 553 | templates['param_required'] = template({"1":function(container,depth0,helpers,partials,data) { |
| 554 | var stack1; |
| 555 | |
| 556 | return ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isFile : depth0),{"name":"if","hash":{},"fn":container.program(2, data, 0),"inverse":container.program(4, data, 0),"data":data})) != null ? stack1 : ""); |
| 557 | },"2":function(container,depth0,helpers,partials,data) { |
| 558 | var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing; |
| 559 | |
| 560 | return " <input type=\"file\" name='" |
| 561 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.name : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 562 | + "' id='" |
| 563 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.valueId : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 564 | + "'/>\n"; |
| 565 | },"4":function(container,depth0,helpers,partials,data) { |
| 566 | var stack1; |
| 567 | |
| 568 | return ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0["default"] : depth0),{"name":"if","hash":{},"fn":container.program(5, data, 0),"inverse":container.program(7, data, 0),"data":data})) != null ? stack1 : ""); |
| 569 | },"5":function(container,depth0,helpers,partials,data) { |
| 570 | var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing; |
| 571 | |
| 572 | return " <div class=\"editor_holder\"></div>\n <textarea class='body-textarea required' placeholder='(required)' name='" |
| 573 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.name : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 574 | + "' id=\"" |
| 575 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.valueId : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 576 | + "\">" |
| 577 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0["default"] : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 578 | + "</textarea>\n <br />\n <div class=\"parameter-content-type\" />\n"; |
| 579 | },"7":function(container,depth0,helpers,partials,data) { |
| 580 | var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing; |
| 581 | |
| 582 | return " <textarea class='body-textarea required' placeholder='(required)' name='" |
| 583 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.name : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 584 | + "' id='" |
| 585 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.valueId : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 586 | + "'></textarea>\n <div class=\"editor_holder\"></div>\n <br />\n <div class=\"parameter-content-type\" />\n"; |
| 587 | },"9":function(container,depth0,helpers,partials,data) { |
| 588 | var stack1; |
| 589 | |
| 590 | return ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isFile : depth0),{"name":"if","hash":{},"fn":container.program(10, data, 0),"inverse":container.program(12, data, 0),"data":data})) != null ? stack1 : ""); |
| 591 | },"10":function(container,depth0,helpers,partials,data) { |
| 592 | var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing; |
| 593 | |
| 594 | return " <input class='parameter' class='required' type='file' name='" |
| 595 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.name : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 596 | + "' id='" |
| 597 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.valueId : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 598 | + "'/>\n"; |
| 599 | },"12":function(container,depth0,helpers,partials,data) { |
| 600 | var stack1; |
| 601 | |
| 602 | return ((stack1 = (helpers.renderTextParam || (depth0 && depth0.renderTextParam) || helpers.helperMissing).call(depth0 != null ? depth0 : {},depth0,{"name":"renderTextParam","hash":{},"fn":container.program(13, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : ""); |
| 603 | },"13":function(container,depth0,helpers,partials,data) { |
| 604 | return ""; |
| 605 | },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { |
| 606 | var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing; |
| 607 | |
| 608 | return "<td class='code required'><label for='" |
| 609 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.valueId : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 610 | + "'>" |
| 611 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.name : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 612 | + "</label></td>\n<td>\n" |
| 613 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.isBody : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.program(9, data, 0),"data":data})) != null ? stack1 : "") |
| 614 | + "</td>\n<td>\n <strong><span class=\"markdown\">" |
| 615 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.description : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 616 | + "</span></strong>\n</td>\n<td>" |
| 617 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.paramType : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 618 | + "</td>\n<td><span class=\"model-signature\"></span></td>\n"; |
| 619 | },"useData":true}); |
| 620 | templates['parameter_content_type'] = template({"1":function(container,depth0,helpers,partials,data) { |
| 621 | var stack1; |
| 622 | |
| 623 | return ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.consumes : depth0),{"name":"each","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : ""); |
| 624 | },"2":function(container,depth0,helpers,partials,data) { |
| 625 | var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing; |
| 626 | |
| 627 | return " <option value=\"" |
| 628 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,depth0,{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 629 | + "\">" |
| 630 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,depth0,{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 631 | + "</option>\n"; |
| 632 | },"4":function(container,depth0,helpers,partials,data) { |
| 633 | return " <option value=\"application/json\">application/json</option>\n"; |
| 634 | },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { |
| 635 | var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing; |
| 636 | |
| 637 | return "<label for=\"" |
| 638 | + container.escapeExpression(((helper = (helper = helpers.parameterContentTypeId || (depth0 != null ? depth0.parameterContentTypeId : depth0)) != null ? helper : alias2),(typeof helper === "function" ? helper.call(alias1,{"name":"parameterContentTypeId","hash":{},"data":data}) : helper))) |
| 639 | + "\" data-sw-translate>Parameter content type:</label>\n<select name=\"parameterContentType\" id=\"" |
| 640 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.parameterContentTypeId : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 641 | + "\">\n" |
| 642 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.consumes : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.program(4, data, 0),"data":data})) != null ? stack1 : "") |
| 643 | + "</select>\n"; |
| 644 | },"useData":true}); |
| 645 | templates['popup'] = template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { |
| 646 | var helper; |
| 647 | |
| 648 | return "<div class=\"api-popup-dialog-wrapper\">\n <div class=\"api-popup-title\">" |
| 649 | + container.escapeExpression(((helper = (helper = helpers.title || (depth0 != null ? depth0.title : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"title","hash":{},"data":data}) : helper))) |
| 650 | + "</div>\n <div class=\"api-popup-content\"></div>\n <p class=\"error-msg\"></p>\n <div class=\"api-popup-actions\">\n <button class=\"api-popup-cancel api-button gray\" type=\"button\">Cancel</button>\n </div>\n</div>\n<div class=\"api-popup-dialog-shadow\"></div>"; |
| 651 | },"useData":true}); |
| 652 | templates['resource'] = template({"1":function(container,depth0,helpers,partials,data) { |
| 653 | return " : "; |
| 654 | },"3":function(container,depth0,helpers,partials,data) { |
| 655 | var stack1; |
| 656 | |
| 657 | return " <li>\n <a href='" |
| 658 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.url : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 659 | + "' data-sw-translate>Raw</a>\n </li>\n"; |
| 660 | },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { |
| 661 | var stack1, helper, options, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, buffer = |
| 662 | "<div class='heading'>\n <h2>\n <a href='#!/" |
| 663 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.id : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 664 | + "' class=\"toggleEndpointList\" data-id=\"" |
| 665 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.id : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 666 | + "\">" |
| 667 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.name : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 668 | + "</a> "; |
| 669 | stack1 = ((helper = (helper = helpers.summary || (depth0 != null ? depth0.summary : depth0)) != null ? helper : alias2),(options={"name":"summary","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data}),(typeof helper === "function" ? helper.call(alias1,options) : helper)); |
| 670 | if (!helpers.summary) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)} |
| 671 | if (stack1 != null) { buffer += stack1; } |
| 672 | return buffer + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.summary : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 673 | + "\n </h2>\n <ul class='options'>\n <li>\n <a href='#!/" |
| 674 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.id : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 675 | + "' id='endpointListTogger_" |
| 676 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.id : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 677 | + "' class=\"toggleEndpointList\" data-id=\"" |
| 678 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.id : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 679 | + "\" data-sw-translate>Show/Hide</a>\n </li>\n <li>\n <a href='#' class=\"collapseResource\" data-id=\"" |
| 680 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.id : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 681 | + "\" data-sw-translate>\n List Operations\n </a>\n </li>\n <li>\n <a href='#' class=\"expandResource\" data-id=\"" |
| 682 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.id : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 683 | + "\" data-sw-translate>\n Expand Operations\n </a>\n </li>\n" |
| 684 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.url : depth0),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 685 | + " </ul>\n</div>\n<ul class='endpoints' id='" |
| 686 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.id : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 687 | + "_endpoint_list' style='display:none'>\n\n</ul>\n"; |
| 688 | },"useData":true}); |
| 689 | templates['response_content_type'] = template({"1":function(container,depth0,helpers,partials,data) { |
| 690 | var stack1; |
| 691 | |
| 692 | return ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.produces : depth0),{"name":"each","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : ""); |
| 693 | },"2":function(container,depth0,helpers,partials,data) { |
| 694 | var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing; |
| 695 | |
| 696 | return " <option value=\"" |
| 697 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,depth0,{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 698 | + "\">" |
| 699 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,depth0,{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 700 | + "</option>\n"; |
| 701 | },"4":function(container,depth0,helpers,partials,data) { |
| 702 | return " <option value=\"application/json\">application/json</option>\n"; |
| 703 | },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { |
| 704 | var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; |
| 705 | |
| 706 | return "<label data-sw-translate for=\"" |
| 707 | + alias4(((helper = (helper = helpers.responseContentTypeId || (depth0 != null ? depth0.responseContentTypeId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"responseContentTypeId","hash":{},"data":data}) : helper))) |
| 708 | + "\">Response Content Type</label>\n<select name=\"responseContentType\" id=\"" |
| 709 | + alias4(((helper = (helper = helpers.responseContentTypeId || (depth0 != null ? depth0.responseContentTypeId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"responseContentTypeId","hash":{},"data":data}) : helper))) |
| 710 | + "\">\n" |
| 711 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.produces : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.program(4, data, 0),"data":data})) != null ? stack1 : "") |
| 712 | + "</select>\n"; |
| 713 | },"useData":true}); |
| 714 | templates['signature'] = template({"1":function(container,depth0,helpers,partials,data) { |
| 715 | var stack1, alias1=depth0 != null ? depth0 : {}; |
| 716 | |
| 717 | return "\n<div>\n<ul class=\"signature-nav\">\n <li><a class=\"description-link\" href=\"#\" data-sw-translate>Model</a></li>\n <li><a class=\"snippet-link\" href=\"#\" data-sw-translate>Example Value</a></li>\n</ul>\n<div>\n\n<div class=\"signature-container\">\n <div class=\"description\">\n " |
| 718 | + container.escapeExpression((helpers.sanitize || (depth0 && depth0.sanitize) || helpers.helperMissing).call(alias1,(depth0 != null ? depth0.signature : depth0),{"name":"sanitize","hash":{},"data":data})) |
| 719 | + "\n </div>\n\n <div class=\"snippet\">\n" |
| 720 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.sampleJSON : depth0),{"name":"if","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 721 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.sampleXML : depth0),{"name":"if","hash":{},"fn":container.program(5, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 722 | + " </div>\n</div>\n"; |
| 723 | },"2":function(container,depth0,helpers,partials,data) { |
| 724 | var stack1, alias1=depth0 != null ? depth0 : {}; |
| 725 | |
| 726 | return " <div class=\"snippet_json\">\n <pre><code>" |
| 727 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || helpers.helperMissing).call(alias1,(depth0 != null ? depth0.sampleJSON : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 728 | + "</code></pre>\n " |
| 729 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.isParam : depth0),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 730 | + "\n </div>\n"; |
| 731 | },"3":function(container,depth0,helpers,partials,data) { |
| 732 | return "<small class=\"notice\" data-sw-translate></small>"; |
| 733 | },"5":function(container,depth0,helpers,partials,data) { |
| 734 | var stack1, alias1=depth0 != null ? depth0 : {}; |
| 735 | |
| 736 | return " <div class=\"snippet_xml\">\n <pre><code>" |
| 737 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || helpers.helperMissing).call(alias1,(depth0 != null ? depth0.sampleXML : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 738 | + "</code></pre>\n " |
| 739 | + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.isParam : depth0),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 740 | + "\n </div>\n"; |
| 741 | },"7":function(container,depth0,helpers,partials,data) { |
| 742 | var stack1; |
| 743 | |
| 744 | return " " |
| 745 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.signature : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 746 | + "\n"; |
| 747 | },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { |
| 748 | var stack1; |
| 749 | |
| 750 | return ((stack1 = (helpers.ifCond || (depth0 && depth0.ifCond) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.sampleJSON : depth0),"||",(depth0 != null ? depth0.sampleXML : depth0),{"name":"ifCond","hash":{},"fn":container.program(1, data, 0),"inverse":container.program(7, data, 0),"data":data})) != null ? stack1 : ""); |
| 751 | },"useData":true}); |
| 752 | templates['status_code'] = template({"1":function(container,depth0,helpers,partials,data) { |
| 753 | var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing; |
| 754 | |
| 755 | return " <tr>\n <td>" |
| 756 | + container.escapeExpression(((helper = (helper = helpers.key || (data && data.key)) != null ? helper : alias2),(typeof helper === "function" ? helper.call(alias1,{"name":"key","hash":{},"data":data}) : helper))) |
| 757 | + "</td>\n <td>" |
| 758 | + ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.description : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "") |
| 759 | + "</td>\n <td>" |
| 760 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.type : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 761 | + "</td>\n </tr>\n"; |
| 762 | },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { |
| 763 | var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing; |
| 764 | |
| 765 | return "<td width='15%' class='code'>" |
| 766 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.code : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 767 | + "</td>\n<td class=\"markdown\">" |
| 768 | + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.message : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "") |
| 769 | + "</td>\n<td width='50%'><span class=\"model-signature\" /></td>\n<td class=\"headers\">\n <table>\n <tbody>\n" |
| 770 | + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.headers : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |
| 771 | + " </tbody>\n </table>\n</td>"; |
| 772 | },"useData":true}); |
| 773 | })();} |
| 774 | /* jshint ignore:end */ |
| 775 | 'use strict'; |
| 776 | |
| 777 | |
| 778 | $(function() { |
| 779 | |
| 780 | // Helper function for vertically aligning DOM elements |
| 781 | // http://www.seodenver.com/simple-vertical-align-plugin-for-jquery/ |
| 782 | $.fn.vAlign = function() { |
| 783 | return this.each(function(){ |
| 784 | var ah = $(this).height(); |
| 785 | var ph = $(this).parent().height(); |
| 786 | var mh = (ph - ah) / 2; |
| 787 | $(this).css('margin-top', mh); |
| 788 | }); |
| 789 | }; |
| 790 | |
| 791 | $.fn.stretchFormtasticInputWidthToParent = function() { |
| 792 | return this.each(function(){ |
| 793 | var p_width = $(this).closest("form").innerWidth(); |
| 794 | var p_padding = parseInt($(this).closest("form").css('padding-left') ,10) + parseInt($(this).closest('form').css('padding-right'), 10); |
| 795 | var this_padding = parseInt($(this).css('padding-left'), 10) + parseInt($(this).css('padding-right'), 10); |
| 796 | $(this).css('width', p_width - p_padding - this_padding); |
| 797 | }); |
| 798 | }; |
| 799 | |
| 800 | $('form.formtastic li.string input, form.formtastic textarea').stretchFormtasticInputWidthToParent(); |
| 801 | |
| 802 | // Vertically center these paragraphs |
| 803 | // Parent may need a min-height for this to work.. |
| 804 | $('ul.downplayed li div.content p').vAlign(); |
| 805 | |
| 806 | // When a sandbox form is submitted.. |
| 807 | $("form.sandbox").submit(function(){ |
| 808 | |
| 809 | var error_free = true; |
| 810 | |
| 811 | // Cycle through the forms required inputs |
| 812 | $(this).find("input.required").each(function() { |
| 813 | |
| 814 | // Remove any existing error styles from the input |
| 815 | $(this).removeClass('error'); |
| 816 | |
| 817 | // Tack the error style on if the input is empty.. |
| 818 | if ($(this).val() === '') { |
| 819 | $(this).addClass('error'); |
| 820 | $(this).wiggle(); |
| 821 | error_free = false; |
| 822 | } |
| 823 | |
| 824 | }); |
| 825 | |
| 826 | return error_free; |
| 827 | }); |
| 828 | |
| 829 | }); |
| 830 | |
| 831 | function clippyCopiedCallback() { |
| 832 | $('#api_key_copied').fadeIn().delay(1000).fadeOut(); |
| 833 | |
| 834 | // var b = $("#clippy_tooltip_" + a); |
| 835 | // b.length != 0 && (b.attr("title", "copied!").trigger("tipsy.reload"), setTimeout(function() { |
| 836 | // b.attr("title", "copy to clipboard") |
| 837 | // }, |
| 838 | // 500)) |
| 839 | } |
| 840 | |
| 841 | // Logging function that accounts for browsers that don't have window.console |
| 842 | function log(){ |
| 843 | log.history = log.history || []; |
| 844 | log.history.push(arguments); |
| 845 | if(this.console){ |
| 846 | console.log( Array.prototype.slice.call(arguments)[0] ); |
| 847 | } |
| 848 | } |
| 849 | |
| 850 | // Handle browsers that do console incorrectly (IE9 and below, see http://stackoverflow.com/a/5539378/7913) |
| 851 | if (Function.prototype.bind && console && typeof console.log === "object") { |
| 852 | [ |
| 853 | "log","info","warn","error","assert","dir","clear","profile","profileEnd" |
| 854 | ].forEach(function (method) { |
| 855 | console[method] = this.bind(console[method], console); |
| 856 | }, Function.prototype.call); |
| 857 | } |
| 858 | |
| 859 | window.Docs = { |
| 860 | |
| 861 | shebang: function() { |
| 862 | |
| 863 | // If shebang has an operation nickname in it.. |
| 864 | // e.g. /docs/#!/words/get_search |
| 865 | var fragments = $.param.fragment().split('/'); |
| 866 | fragments.shift(); // get rid of the bang |
| 867 | |
| 868 | switch (fragments.length) { |
| 869 | case 1: |
| 870 | if (fragments[0].length > 0) { // prevent matching "#/" |
| 871 | // Expand all operations for the resource and scroll to it |
| 872 | var dom_id = 'resource_' + fragments[0]; |
| 873 | |
| 874 | Docs.expandEndpointListForResource(fragments[0]); |
| 875 | $("#"+dom_id).slideto({highlight: false}); |
| 876 | } |
| 877 | break; |
| 878 | case 2: |
| 879 | // Refer to the endpoint DOM element, e.g. #words_get_search |
| 880 | |
| 881 | // Expand Resource |
| 882 | Docs.expandEndpointListForResource(fragments[0]); |
| 883 | $("#"+dom_id).slideto({highlight: false}); |
| 884 | |
| 885 | // Expand operation |
| 886 | var li_dom_id = fragments.join('_'); |
| 887 | var li_content_dom_id = li_dom_id + "_content"; |
| 888 | |
| 889 | |
| 890 | Docs.expandOperation($('#'+li_content_dom_id)); |
| 891 | $('#'+li_dom_id).slideto({highlight: false}); |
| 892 | break; |
| 893 | } |
| 894 | }, |
| 895 | |
| 896 | toggleEndpointListForResource: function(resource) { |
| 897 | var elem = $('li#resource_' + Docs.escapeResourceName(resource) + ' ul.endpoints'); |
| 898 | if (elem.is(':visible')) { |
| 899 | $.bbq.pushState('#/', 2); |
| 900 | Docs.collapseEndpointListForResource(resource); |
| 901 | } else { |
| 902 | $.bbq.pushState('#/' + resource, 2); |
| 903 | Docs.expandEndpointListForResource(resource); |
| 904 | } |
| 905 | }, |
| 906 | |
| 907 | // Expand resource |
| 908 | expandEndpointListForResource: function(resource) { |
| 909 | var resource = Docs.escapeResourceName(resource); |
| 910 | if (resource == '') { |
| 911 | $('.resource ul.endpoints').slideDown(); |
| 912 | return; |
| 913 | } |
| 914 | |
| 915 | $('li#resource_' + resource).addClass('active'); |
| 916 | |
| 917 | var elem = $('li#resource_' + resource + ' ul.endpoints'); |
| 918 | elem.slideDown(); |
| 919 | }, |
| 920 | |
| 921 | // Collapse resource and mark as explicitly closed |
| 922 | collapseEndpointListForResource: function(resource) { |
| 923 | var resource = Docs.escapeResourceName(resource); |
| 924 | if (resource == '') { |
| 925 | $('.resource ul.endpoints').slideUp(); |
| 926 | return; |
| 927 | } |
| 928 | |
| 929 | $('li#resource_' + resource).removeClass('active'); |
| 930 | |
| 931 | var elem = $('li#resource_' + resource + ' ul.endpoints'); |
| 932 | elem.slideUp(); |
| 933 | }, |
| 934 | |
| 935 | expandOperationsForResource: function(resource) { |
| 936 | // Make sure the resource container is open.. |
| 937 | Docs.expandEndpointListForResource(resource); |
| 938 | |
| 939 | if (resource == '') { |
| 940 | $('.resource ul.endpoints li.operation div.content').slideDown(); |
| 941 | return; |
| 942 | } |
| 943 | |
| 944 | $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() { |
| 945 | Docs.expandOperation($(this)); |
| 946 | }); |
| 947 | }, |
| 948 | |
| 949 | collapseOperationsForResource: function(resource) { |
| 950 | // Make sure the resource container is open.. |
| 951 | Docs.expandEndpointListForResource(resource); |
| 952 | |
| 953 | if (resource == '') { |
| 954 | $('.resource ul.endpoints li.operation div.content').slideUp(); |
| 955 | return; |
| 956 | } |
| 957 | |
| 958 | $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() { |
| 959 | Docs.collapseOperation($(this)); |
| 960 | }); |
| 961 | }, |
| 962 | |
| 963 | escapeResourceName: function(resource) { |
| 964 | return resource.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g, "\\$&"); |
| 965 | }, |
| 966 | |
| 967 | expandOperation: function(elem) { |
| 968 | elem.slideDown(); |
| 969 | }, |
| 970 | |
| 971 | collapseOperation: function(elem) { |
| 972 | elem.slideUp(); |
| 973 | } |
| 974 | }; |
| 975 | |
| 976 | /*! |
| 977 | * https://github.com/es-shims/es5-shim |
| 978 | * @license es5-shim Copyright 2009-2015 by contributors, MIT License |
| 979 | * see https://github.com/es-shims/es5-shim/blob/master/LICENSE |
| 980 | */ |
| 981 | |
| 982 | // vim: ts=4 sts=4 sw=4 expandtab |
| 983 | |
| 984 | // Add semicolon to prevent IIFE from being passed as argument to concatenated code. |
| 985 | ; |
| 986 | |
| 987 | // UMD (Universal Module Definition) |
| 988 | // see https://github.com/umdjs/umd/blob/master/templates/returnExports.js |
| 989 | (function (root, factory) { |
| 990 | 'use strict'; |
| 991 | |
| 992 | /* global define, exports, module */ |
| 993 | if (typeof define === 'function' && define.amd) { |
| 994 | // AMD. Register as an anonymous module. |
| 995 | define(factory); |
| 996 | } else if (typeof exports === 'object') { |
| 997 | // Node. Does not work with strict CommonJS, but |
| 998 | // only CommonJS-like enviroments that support module.exports, |
| 999 | // like Node. |
| 1000 | module.exports = factory(); |
| 1001 | } else { |
| 1002 | // Browser globals (root is window) |
| 1003 | root.returnExports = factory(); |
| 1004 | } |
| 1005 | }(this, function () { |
| 1006 | /** |
| 1007 | * Brings an environment as close to ECMAScript 5 compliance |
| 1008 | * as is possible with the facilities of erstwhile engines. |
| 1009 | * |
| 1010 | * Annotated ES5: http://es5.github.com/ (specific links below) |
| 1011 | * ES5 Spec: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf |
| 1012 | * Required reading: http://javascriptweblog.wordpress.com/2011/12/05/extending-javascript-natives/ |
| 1013 | */ |
| 1014 | |
| 1015 | // Shortcut to an often accessed properties, in order to avoid multiple |
| 1016 | // dereference that costs universally. This also holds a reference to known-good |
| 1017 | // functions. |
| 1018 | var $Array = Array; |
| 1019 | var ArrayPrototype = $Array.prototype; |
| 1020 | var $Object = Object; |
| 1021 | var ObjectPrototype = $Object.prototype; |
| 1022 | var $Function = Function; |
| 1023 | var FunctionPrototype = $Function.prototype; |
| 1024 | var $String = String; |
| 1025 | var StringPrototype = $String.prototype; |
| 1026 | var $Number = Number; |
| 1027 | var NumberPrototype = $Number.prototype; |
| 1028 | var array_slice = ArrayPrototype.slice; |
| 1029 | var array_splice = ArrayPrototype.splice; |
| 1030 | var array_push = ArrayPrototype.push; |
| 1031 | var array_unshift = ArrayPrototype.unshift; |
| 1032 | var array_concat = ArrayPrototype.concat; |
| 1033 | var array_join = ArrayPrototype.join; |
| 1034 | var call = FunctionPrototype.call; |
| 1035 | var apply = FunctionPrototype.apply; |
| 1036 | var max = Math.max; |
| 1037 | var min = Math.min; |
| 1038 | |
| 1039 | // Having a toString local variable name breaks in Opera so use to_string. |
| 1040 | var to_string = ObjectPrototype.toString; |
| 1041 | |
| 1042 | /* global Symbol */ |
| 1043 | /* eslint-disable one-var-declaration-per-line, no-redeclare, max-statements-per-line */ |
| 1044 | var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; |
| 1045 | var isCallable; /* inlined from https://npmjs.com/is-callable */ var fnToStr = Function.prototype.toString, constructorRegex = /^\s*class /, isES6ClassFn = function isES6ClassFn(value) { try { var fnStr = fnToStr.call(value); var singleStripped = fnStr.replace(/\/\/.*\n/g, ''); var multiStripped = singleStripped.replace(/\/\*[.\s\S]*\*\//g, ''); var spaceStripped = multiStripped.replace(/\n/mg, ' ').replace(/ {2}/g, ' '); return constructorRegex.test(spaceStripped); } catch (e) { return false; /* not a function */ } }, tryFunctionObject = function tryFunctionObject(value) { try { if (isES6ClassFn(value)) { return false; } fnToStr.call(value); return true; } catch (e) { return false; } }, fnClass = '[object Function]', genClass = '[object GeneratorFunction]', isCallable = function isCallable(value) { if (!value) { return false; } if (typeof value !== 'function' && typeof value !== 'object') { return false; } if (hasToStringTag) { return tryFunctionObject(value); } if (isES6ClassFn(value)) { return false; } var strClass = to_string.call(value); return strClass === fnClass || strClass === genClass; }; |
| 1046 | |
| 1047 | var isRegex; /* inlined from https://npmjs.com/is-regex */ var regexExec = RegExp.prototype.exec, tryRegexExec = function tryRegexExec(value) { try { regexExec.call(value); return true; } catch (e) { return false; } }, regexClass = '[object RegExp]'; isRegex = function isRegex(value) { if (typeof value !== 'object') { return false; } return hasToStringTag ? tryRegexExec(value) : to_string.call(value) === regexClass; }; |
| 1048 | var isString; /* inlined from https://npmjs.com/is-string */ var strValue = String.prototype.valueOf, tryStringObject = function tryStringObject(value) { try { strValue.call(value); return true; } catch (e) { return false; } }, stringClass = '[object String]'; isString = function isString(value) { if (typeof value === 'string') { return true; } if (typeof value !== 'object') { return false; } return hasToStringTag ? tryStringObject(value) : to_string.call(value) === stringClass; }; |
| 1049 | /* eslint-enable one-var-declaration-per-line, no-redeclare, max-statements-per-line */ |
| 1050 | |
| 1051 | /* inlined from http://npmjs.com/define-properties */ |
| 1052 | var supportsDescriptors = $Object.defineProperty && (function () { |
| 1053 | try { |
| 1054 | var obj = {}; |
| 1055 | $Object.defineProperty(obj, 'x', { enumerable: false, value: obj }); |
| 1056 | for (var _ in obj) { // jscs:ignore disallowUnusedVariables |
| 1057 | return false; |
| 1058 | } |
| 1059 | return obj.x === obj; |
| 1060 | } catch (e) { /* this is ES3 */ |
| 1061 | return false; |
| 1062 | } |
| 1063 | }()); |
| 1064 | var defineProperties = (function (has) { |
| 1065 | // Define configurable, writable, and non-enumerable props |
| 1066 | // if they don't exist. |
| 1067 | var defineProperty; |
| 1068 | if (supportsDescriptors) { |
| 1069 | defineProperty = function (object, name, method, forceAssign) { |
| 1070 | if (!forceAssign && (name in object)) { |
| 1071 | return; |
| 1072 | } |
| 1073 | $Object.defineProperty(object, name, { |
| 1074 | configurable: true, |
| 1075 | enumerable: false, |
| 1076 | writable: true, |
| 1077 | value: method |
| 1078 | }); |
| 1079 | }; |
| 1080 | } else { |
| 1081 | defineProperty = function (object, name, method, forceAssign) { |
| 1082 | if (!forceAssign && (name in object)) { |
| 1083 | return; |
| 1084 | } |
| 1085 | object[name] = method; |
| 1086 | }; |
| 1087 | } |
| 1088 | return function defineProperties(object, map, forceAssign) { |
| 1089 | for (var name in map) { |
| 1090 | if (has.call(map, name)) { |
| 1091 | defineProperty(object, name, map[name], forceAssign); |
| 1092 | } |
| 1093 | } |
| 1094 | }; |
| 1095 | }(ObjectPrototype.hasOwnProperty)); |
| 1096 | |
| 1097 | // |
| 1098 | // Util |
| 1099 | // ====== |
| 1100 | // |
| 1101 | |
| 1102 | /* replaceable with https://npmjs.com/package/es-abstract /helpers/isPrimitive */ |
| 1103 | var isPrimitive = function isPrimitive(input) { |
| 1104 | var type = typeof input; |
| 1105 | return input === null || (type !== 'object' && type !== 'function'); |
| 1106 | }; |
| 1107 | |
| 1108 | var isActualNaN = $Number.isNaN || function isActualNaN(x) { |
| 1109 | return x !== x; |
| 1110 | }; |
| 1111 | |
| 1112 | var ES = { |
| 1113 | // ES5 9.4 |
| 1114 | // http://es5.github.com/#x9.4 |
| 1115 | // http://jsperf.com/to-integer |
| 1116 | /* replaceable with https://npmjs.com/package/es-abstract ES5.ToInteger */ |
| 1117 | ToInteger: function ToInteger(num) { |
| 1118 | var n = +num; |
| 1119 | if (isActualNaN(n)) { |
| 1120 | n = 0; |
| 1121 | } else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0)) { |
| 1122 | n = (n > 0 || -1) * Math.floor(Math.abs(n)); |
| 1123 | } |
| 1124 | return n; |
| 1125 | }, |
| 1126 | |
| 1127 | /* replaceable with https://npmjs.com/package/es-abstract ES5.ToPrimitive */ |
| 1128 | ToPrimitive: function ToPrimitive(input) { |
| 1129 | var val, valueOf, toStr; |
| 1130 | if (isPrimitive(input)) { |
| 1131 | return input; |
| 1132 | } |
| 1133 | valueOf = input.valueOf; |
| 1134 | if (isCallable(valueOf)) { |
| 1135 | val = valueOf.call(input); |
| 1136 | if (isPrimitive(val)) { |
| 1137 | return val; |
| 1138 | } |
| 1139 | } |
| 1140 | toStr = input.toString; |
| 1141 | if (isCallable(toStr)) { |
| 1142 | val = toStr.call(input); |
| 1143 | if (isPrimitive(val)) { |
| 1144 | return val; |
| 1145 | } |
| 1146 | } |
| 1147 | throw new TypeError(); |
| 1148 | }, |
| 1149 | |
| 1150 | // ES5 9.9 |
| 1151 | // http://es5.github.com/#x9.9 |
| 1152 | /* replaceable with https://npmjs.com/package/es-abstract ES5.ToObject */ |
| 1153 | ToObject: function (o) { |
| 1154 | if (o == null) { // this matches both null and undefined |
| 1155 | throw new TypeError("can't convert " + o + ' to object'); |
| 1156 | } |
| 1157 | return $Object(o); |
| 1158 | }, |
| 1159 | |
| 1160 | /* replaceable with https://npmjs.com/package/es-abstract ES5.ToUint32 */ |
| 1161 | ToUint32: function ToUint32(x) { |
| 1162 | return x >>> 0; |
| 1163 | } |
| 1164 | }; |
| 1165 | |
| 1166 | // |
| 1167 | // Function |
| 1168 | // ======== |
| 1169 | // |
| 1170 | |
| 1171 | // ES-5 15.3.4.5 |
| 1172 | // http://es5.github.com/#x15.3.4.5 |
| 1173 | |
| 1174 | var Empty = function Empty() {}; |
| 1175 | |
| 1176 | defineProperties(FunctionPrototype, { |
| 1177 | bind: function bind(that) { // .length is 1 |
| 1178 | // 1. Let Target be the this value. |
| 1179 | var target = this; |
| 1180 | // 2. If IsCallable(Target) is false, throw a TypeError exception. |
| 1181 | if (!isCallable(target)) { |
| 1182 | throw new TypeError('Function.prototype.bind called on incompatible ' + target); |
| 1183 | } |
| 1184 | // 3. Let A be a new (possibly empty) internal list of all of the |
| 1185 | // argument values provided after thisArg (arg1, arg2 etc), in order. |
| 1186 | // XXX slicedArgs will stand in for "A" if used |
| 1187 | var args = array_slice.call(arguments, 1); // for normal call |
| 1188 | // 4. Let F be a new native ECMAScript object. |
| 1189 | // 11. Set the [[Prototype]] internal property of F to the standard |
| 1190 | // built-in Function prototype object as specified in 15.3.3.1. |
| 1191 | // 12. Set the [[Call]] internal property of F as described in |
| 1192 | // 15.3.4.5.1. |
| 1193 | // 13. Set the [[Construct]] internal property of F as described in |
| 1194 | // 15.3.4.5.2. |
| 1195 | // 14. Set the [[HasInstance]] internal property of F as described in |
| 1196 | // 15.3.4.5.3. |
| 1197 | var bound; |
| 1198 | var binder = function () { |
| 1199 | |
| 1200 | if (this instanceof bound) { |
| 1201 | // 15.3.4.5.2 [[Construct]] |
| 1202 | // When the [[Construct]] internal method of a function object, |
| 1203 | // F that was created using the bind function is called with a |
| 1204 | // list of arguments ExtraArgs, the following steps are taken: |
| 1205 | // 1. Let target be the value of F's [[TargetFunction]] |
| 1206 | // internal property. |
| 1207 | // 2. If target has no [[Construct]] internal method, a |
| 1208 | // TypeError exception is thrown. |
| 1209 | // 3. Let boundArgs be the value of F's [[BoundArgs]] internal |
| 1210 | // property. |
| 1211 | // 4. Let args be a new list containing the same values as the |
| 1212 | // list boundArgs in the same order followed by the same |
| 1213 | // values as the list ExtraArgs in the same order. |
| 1214 | // 5. Return the result of calling the [[Construct]] internal |
| 1215 | // method of target providing args as the arguments. |
| 1216 | |
| 1217 | var result = apply.call( |
| 1218 | target, |
| 1219 | this, |
| 1220 | array_concat.call(args, array_slice.call(arguments)) |
| 1221 | ); |
| 1222 | if ($Object(result) === result) { |
| 1223 | return result; |
| 1224 | } |
| 1225 | return this; |
| 1226 | |
| 1227 | } else { |
| 1228 | // 15.3.4.5.1 [[Call]] |
| 1229 | // When the [[Call]] internal method of a function object, F, |
| 1230 | // which was created using the bind function is called with a |
| 1231 | // this value and a list of arguments ExtraArgs, the following |
| 1232 | // steps are taken: |
| 1233 | // 1. Let boundArgs be the value of F's [[BoundArgs]] internal |
| 1234 | // property. |
| 1235 | // 2. Let boundThis be the value of F's [[BoundThis]] internal |
| 1236 | // property. |
| 1237 | // 3. Let target be the value of F's [[TargetFunction]] internal |
| 1238 | // property. |
| 1239 | // 4. Let args be a new list containing the same values as the |
| 1240 | // list boundArgs in the same order followed by the same |
| 1241 | // values as the list ExtraArgs in the same order. |
| 1242 | // 5. Return the result of calling the [[Call]] internal method |
| 1243 | // of target providing boundThis as the this value and |
| 1244 | // providing args as the arguments. |
| 1245 | |
| 1246 | // equiv: target.call(this, ...boundArgs, ...args) |
| 1247 | return apply.call( |
| 1248 | target, |
| 1249 | that, |
| 1250 | array_concat.call(args, array_slice.call(arguments)) |
| 1251 | ); |
| 1252 | |
| 1253 | } |
| 1254 | |
| 1255 | }; |
| 1256 | |
| 1257 | // 15. If the [[Class]] internal property of Target is "Function", then |
| 1258 | // a. Let L be the length property of Target minus the length of A. |
| 1259 | // b. Set the length own property of F to either 0 or L, whichever is |
| 1260 | // larger. |
| 1261 | // 16. Else set the length own property of F to 0. |
| 1262 | |
| 1263 | var boundLength = max(0, target.length - args.length); |
| 1264 | |
| 1265 | // 17. Set the attributes of the length own property of F to the values |
| 1266 | // specified in 15.3.5.1. |
| 1267 | var boundArgs = []; |
| 1268 | for (var i = 0; i < boundLength; i++) { |
| 1269 | array_push.call(boundArgs, '$' + i); |
| 1270 | } |
| 1271 | |
| 1272 | // XXX Build a dynamic function with desired amount of arguments is the only |
| 1273 | // way to set the length property of a function. |
| 1274 | // In environments where Content Security Policies enabled (Chrome extensions, |
| 1275 | // for ex.) all use of eval or Function costructor throws an exception. |
| 1276 | // However in all of these environments Function.prototype.bind exists |
| 1277 | // and so this code will never be executed. |
| 1278 | bound = $Function('binder', 'return function (' + array_join.call(boundArgs, ',') + '){ return binder.apply(this, arguments); }')(binder); |
| 1279 | |
| 1280 | if (target.prototype) { |
| 1281 | Empty.prototype = target.prototype; |
| 1282 | bound.prototype = new Empty(); |
| 1283 | // Clean up dangling references. |
| 1284 | Empty.prototype = null; |
| 1285 | } |
| 1286 | |
| 1287 | // TODO |
| 1288 | // 18. Set the [[Extensible]] internal property of F to true. |
| 1289 | |
| 1290 | // TODO |
| 1291 | // 19. Let thrower be the [[ThrowTypeError]] function Object (13.2.3). |
| 1292 | // 20. Call the [[DefineOwnProperty]] internal method of F with |
| 1293 | // arguments "caller", PropertyDescriptor {[[Get]]: thrower, [[Set]]: |
| 1294 | // thrower, [[Enumerable]]: false, [[Configurable]]: false}, and |
| 1295 | // false. |
| 1296 | // 21. Call the [[DefineOwnProperty]] internal method of F with |
| 1297 | // arguments "arguments", PropertyDescriptor {[[Get]]: thrower, |
| 1298 | // [[Set]]: thrower, [[Enumerable]]: false, [[Configurable]]: false}, |
| 1299 | // and false. |
| 1300 | |
| 1301 | // TODO |
| 1302 | // NOTE Function objects created using Function.prototype.bind do not |
| 1303 | // have a prototype property or the [[Code]], [[FormalParameters]], and |
| 1304 | // [[Scope]] internal properties. |
| 1305 | // XXX can't delete prototype in pure-js. |
| 1306 | |
| 1307 | // 22. Return F. |
| 1308 | return bound; |
| 1309 | } |
| 1310 | }); |
| 1311 | |
| 1312 | // _Please note: Shortcuts are defined after `Function.prototype.bind` as we |
| 1313 | // use it in defining shortcuts. |
| 1314 | var owns = call.bind(ObjectPrototype.hasOwnProperty); |
| 1315 | var toStr = call.bind(ObjectPrototype.toString); |
| 1316 | var arraySlice = call.bind(array_slice); |
| 1317 | var arraySliceApply = apply.bind(array_slice); |
| 1318 | var strSlice = call.bind(StringPrototype.slice); |
| 1319 | var strSplit = call.bind(StringPrototype.split); |
| 1320 | var strIndexOf = call.bind(StringPrototype.indexOf); |
| 1321 | var pushCall = call.bind(array_push); |
| 1322 | var isEnum = call.bind(ObjectPrototype.propertyIsEnumerable); |
| 1323 | var arraySort = call.bind(ArrayPrototype.sort); |
| 1324 | |
| 1325 | // |
| 1326 | // Array |
| 1327 | // ===== |
| 1328 | // |
| 1329 | |
| 1330 | var isArray = $Array.isArray || function isArray(obj) { |
| 1331 | return toStr(obj) === '[object Array]'; |
| 1332 | }; |
| 1333 | |
| 1334 | // ES5 15.4.4.12 |
| 1335 | // http://es5.github.com/#x15.4.4.13 |
| 1336 | // Return len+argCount. |
| 1337 | // [bugfix, ielt8] |
| 1338 | // IE < 8 bug: [].unshift(0) === undefined but should be "1" |
| 1339 | var hasUnshiftReturnValueBug = [].unshift(0) !== 1; |
| 1340 | defineProperties(ArrayPrototype, { |
| 1341 | unshift: function () { |
| 1342 | array_unshift.apply(this, arguments); |
| 1343 | return this.length; |
| 1344 | } |
| 1345 | }, hasUnshiftReturnValueBug); |
| 1346 | |
| 1347 | // ES5 15.4.3.2 |
| 1348 | // http://es5.github.com/#x15.4.3.2 |
| 1349 | // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/isArray |
| 1350 | defineProperties($Array, { isArray: isArray }); |
| 1351 | |
| 1352 | // The IsCallable() check in the Array functions |
| 1353 | // has been replaced with a strict check on the |
| 1354 | // internal class of the object to trap cases where |
| 1355 | // the provided function was actually a regular |
| 1356 | // expression literal, which in V8 and |
| 1357 | // JavaScriptCore is a typeof "function". Only in |
| 1358 | // V8 are regular expression literals permitted as |
| 1359 | // reduce parameters, so it is desirable in the |
| 1360 | // general case for the shim to match the more |
| 1361 | // strict and common behavior of rejecting regular |
| 1362 | // expressions. |
| 1363 | |
| 1364 | // ES5 15.4.4.18 |
| 1365 | // http://es5.github.com/#x15.4.4.18 |
| 1366 | // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/array/forEach |
| 1367 | |
| 1368 | // Check failure of by-index access of string characters (IE < 9) |
| 1369 | // and failure of `0 in boxedString` (Rhino) |
| 1370 | var boxedString = $Object('a'); |
| 1371 | var splitString = boxedString[0] !== 'a' || !(0 in boxedString); |
| 1372 | |
| 1373 | var properlyBoxesContext = function properlyBoxed(method) { |
| 1374 | // Check node 0.6.21 bug where third parameter is not boxed |
| 1375 | var properlyBoxesNonStrict = true; |
| 1376 | var properlyBoxesStrict = true; |
| 1377 | var threwException = false; |
| 1378 | if (method) { |
| 1379 | try { |
| 1380 | method.call('foo', function (_, __, context) { |
| 1381 | if (typeof context !== 'object') { |
| 1382 | properlyBoxesNonStrict = false; |
| 1383 | } |
| 1384 | }); |
| 1385 | |
| 1386 | method.call([1], function () { |
| 1387 | 'use strict'; |
| 1388 | |
| 1389 | properlyBoxesStrict = typeof this === 'string'; |
| 1390 | }, 'x'); |
| 1391 | } catch (e) { |
| 1392 | threwException = true; |
| 1393 | } |
| 1394 | } |
| 1395 | return !!method && !threwException && properlyBoxesNonStrict && properlyBoxesStrict; |
| 1396 | }; |
| 1397 | |
| 1398 | defineProperties(ArrayPrototype, { |
| 1399 | forEach: function forEach(callbackfn/*, thisArg*/) { |
| 1400 | var object = ES.ToObject(this); |
| 1401 | var self = splitString && isString(this) ? strSplit(this, '') : object; |
| 1402 | var i = -1; |
| 1403 | var length = ES.ToUint32(self.length); |
| 1404 | var T; |
| 1405 | if (arguments.length > 1) { |
| 1406 | T = arguments[1]; |
| 1407 | } |
| 1408 | |
| 1409 | // If no callback function or if callback is not a callable function |
| 1410 | if (!isCallable(callbackfn)) { |
| 1411 | throw new TypeError('Array.prototype.forEach callback must be a function'); |
| 1412 | } |
| 1413 | |
| 1414 | while (++i < length) { |
| 1415 | if (i in self) { |
| 1416 | // Invoke the callback function with call, passing arguments: |
| 1417 | // context, property value, property key, thisArg object |
| 1418 | if (typeof T === 'undefined') { |
| 1419 | callbackfn(self[i], i, object); |
| 1420 | } else { |
| 1421 | callbackfn.call(T, self[i], i, object); |
| 1422 | } |
| 1423 | } |
| 1424 | } |
| 1425 | } |
| 1426 | }, !properlyBoxesContext(ArrayPrototype.forEach)); |
| 1427 | |
| 1428 | // ES5 15.4.4.19 |
| 1429 | // http://es5.github.com/#x15.4.4.19 |
| 1430 | // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/map |
| 1431 | defineProperties(ArrayPrototype, { |
| 1432 | map: function map(callbackfn/*, thisArg*/) { |
| 1433 | var object = ES.ToObject(this); |
| 1434 | var self = splitString && isString(this) ? strSplit(this, '') : object; |
| 1435 | var length = ES.ToUint32(self.length); |
| 1436 | var result = $Array(length); |
| 1437 | var T; |
| 1438 | if (arguments.length > 1) { |
| 1439 | T = arguments[1]; |
| 1440 | } |
| 1441 | |
| 1442 | // If no callback function or if callback is not a callable function |
| 1443 | if (!isCallable(callbackfn)) { |
| 1444 | throw new TypeError('Array.prototype.map callback must be a function'); |
| 1445 | } |
| 1446 | |
| 1447 | for (var i = 0; i < length; i++) { |
| 1448 | if (i in self) { |
| 1449 | if (typeof T === 'undefined') { |
| 1450 | result[i] = callbackfn(self[i], i, object); |
| 1451 | } else { |
| 1452 | result[i] = callbackfn.call(T, self[i], i, object); |
| 1453 | } |
| 1454 | } |
| 1455 | } |
| 1456 | return result; |
| 1457 | } |
| 1458 | }, !properlyBoxesContext(ArrayPrototype.map)); |
| 1459 | |
| 1460 | // ES5 15.4.4.20 |
| 1461 | // http://es5.github.com/#x15.4.4.20 |
| 1462 | // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/filter |
| 1463 | defineProperties(ArrayPrototype, { |
| 1464 | filter: function filter(callbackfn/*, thisArg*/) { |
| 1465 | var object = ES.ToObject(this); |
| 1466 | var self = splitString && isString(this) ? strSplit(this, '') : object; |
| 1467 | var length = ES.ToUint32(self.length); |
| 1468 | var result = []; |
| 1469 | var value; |
| 1470 | var T; |
| 1471 | if (arguments.length > 1) { |
| 1472 | T = arguments[1]; |
| 1473 | } |
| 1474 | |
| 1475 | // If no callback function or if callback is not a callable function |
| 1476 | if (!isCallable(callbackfn)) { |
| 1477 | throw new TypeError('Array.prototype.filter callback must be a function'); |
| 1478 | } |
| 1479 | |
| 1480 | for (var i = 0; i < length; i++) { |
| 1481 | if (i in self) { |
| 1482 | value = self[i]; |
| 1483 | if (typeof T === 'undefined' ? callbackfn(value, i, object) : callbackfn.call(T, value, i, object)) { |
| 1484 | pushCall(result, value); |
| 1485 | } |
| 1486 | } |
| 1487 | } |
| 1488 | return result; |
| 1489 | } |
| 1490 | }, !properlyBoxesContext(ArrayPrototype.filter)); |
| 1491 | |
| 1492 | // ES5 15.4.4.16 |
| 1493 | // http://es5.github.com/#x15.4.4.16 |
| 1494 | // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/every |
| 1495 | defineProperties(ArrayPrototype, { |
| 1496 | every: function every(callbackfn/*, thisArg*/) { |
| 1497 | var object = ES.ToObject(this); |
| 1498 | var self = splitString && isString(this) ? strSplit(this, '') : object; |
| 1499 | var length = ES.ToUint32(self.length); |
| 1500 | var T; |
| 1501 | if (arguments.length > 1) { |
| 1502 | T = arguments[1]; |
| 1503 | } |
| 1504 | |
| 1505 | // If no callback function or if callback is not a callable function |
| 1506 | if (!isCallable(callbackfn)) { |
| 1507 | throw new TypeError('Array.prototype.every callback must be a function'); |
| 1508 | } |
| 1509 | |
| 1510 | for (var i = 0; i < length; i++) { |
| 1511 | if (i in self && !(typeof T === 'undefined' ? callbackfn(self[i], i, object) : callbackfn.call(T, self[i], i, object))) { |
| 1512 | return false; |
| 1513 | } |
| 1514 | } |
| 1515 | return true; |
| 1516 | } |
| 1517 | }, !properlyBoxesContext(ArrayPrototype.every)); |
| 1518 | |
| 1519 | // ES5 15.4.4.17 |
| 1520 | // http://es5.github.com/#x15.4.4.17 |
| 1521 | // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/some |
| 1522 | defineProperties(ArrayPrototype, { |
| 1523 | some: function some(callbackfn/*, thisArg */) { |
| 1524 | var object = ES.ToObject(this); |
| 1525 | var self = splitString && isString(this) ? strSplit(this, '') : object; |
| 1526 | var length = ES.ToUint32(self.length); |
| 1527 | var T; |
| 1528 | if (arguments.length > 1) { |
| 1529 | T = arguments[1]; |
| 1530 | } |
| 1531 | |
| 1532 | // If no callback function or if callback is not a callable function |
| 1533 | if (!isCallable(callbackfn)) { |
| 1534 | throw new TypeError('Array.prototype.some callback must be a function'); |
| 1535 | } |
| 1536 | |
| 1537 | for (var i = 0; i < length; i++) { |
| 1538 | if (i in self && (typeof T === 'undefined' ? callbackfn(self[i], i, object) : callbackfn.call(T, self[i], i, object))) { |
| 1539 | return true; |
| 1540 | } |
| 1541 | } |
| 1542 | return false; |
| 1543 | } |
| 1544 | }, !properlyBoxesContext(ArrayPrototype.some)); |
| 1545 | |
| 1546 | // ES5 15.4.4.21 |
| 1547 | // http://es5.github.com/#x15.4.4.21 |
| 1548 | // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduce |
| 1549 | var reduceCoercesToObject = false; |
| 1550 | if (ArrayPrototype.reduce) { |
| 1551 | reduceCoercesToObject = typeof ArrayPrototype.reduce.call('es5', function (_, __, ___, list) { |
| 1552 | return list; |
| 1553 | }) === 'object'; |
| 1554 | } |
| 1555 | defineProperties(ArrayPrototype, { |
| 1556 | reduce: function reduce(callbackfn/*, initialValue*/) { |
| 1557 | var object = ES.ToObject(this); |
| 1558 | var self = splitString && isString(this) ? strSplit(this, '') : object; |
| 1559 | var length = ES.ToUint32(self.length); |
| 1560 | |
| 1561 | // If no callback function or if callback is not a callable function |
| 1562 | if (!isCallable(callbackfn)) { |
| 1563 | throw new TypeError('Array.prototype.reduce callback must be a function'); |
| 1564 | } |
| 1565 | |
| 1566 | // no value to return if no initial value and an empty array |
| 1567 | if (length === 0 && arguments.length === 1) { |
| 1568 | throw new TypeError('reduce of empty array with no initial value'); |
| 1569 | } |
| 1570 | |
| 1571 | var i = 0; |
| 1572 | var result; |
| 1573 | if (arguments.length >= 2) { |
| 1574 | result = arguments[1]; |
| 1575 | } else { |
| 1576 | do { |
| 1577 | if (i in self) { |
| 1578 | result = self[i++]; |
| 1579 | break; |
| 1580 | } |
| 1581 | |
| 1582 | // if array contains no values, no initial value to return |
| 1583 | if (++i >= length) { |
| 1584 | throw new TypeError('reduce of empty array with no initial value'); |
| 1585 | } |
| 1586 | } while (true); |
| 1587 | } |
| 1588 | |
| 1589 | for (; i < length; i++) { |
| 1590 | if (i in self) { |
| 1591 | result = callbackfn(result, self[i], i, object); |
| 1592 | } |
| 1593 | } |
| 1594 | |
| 1595 | return result; |
| 1596 | } |
| 1597 | }, !reduceCoercesToObject); |
| 1598 | |
| 1599 | // ES5 15.4.4.22 |
| 1600 | // http://es5.github.com/#x15.4.4.22 |
| 1601 | // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduceRight |
| 1602 | var reduceRightCoercesToObject = false; |
| 1603 | if (ArrayPrototype.reduceRight) { |
| 1604 | reduceRightCoercesToObject = typeof ArrayPrototype.reduceRight.call('es5', function (_, __, ___, list) { |
| 1605 | return list; |
| 1606 | }) === 'object'; |
| 1607 | } |
| 1608 | defineProperties(ArrayPrototype, { |
| 1609 | reduceRight: function reduceRight(callbackfn/*, initial*/) { |
| 1610 | var object = ES.ToObject(this); |
| 1611 | var self = splitString && isString(this) ? strSplit(this, '') : object; |
| 1612 | var length = ES.ToUint32(self.length); |
| 1613 | |
| 1614 | // If no callback function or if callback is not a callable function |
| 1615 | if (!isCallable(callbackfn)) { |
| 1616 | throw new TypeError('Array.prototype.reduceRight callback must be a function'); |
| 1617 | } |
| 1618 | |
| 1619 | // no value to return if no initial value, empty array |
| 1620 | if (length === 0 && arguments.length === 1) { |
| 1621 | throw new TypeError('reduceRight of empty array with no initial value'); |
| 1622 | } |
| 1623 | |
| 1624 | var result; |
| 1625 | var i = length - 1; |
| 1626 | if (arguments.length >= 2) { |
| 1627 | result = arguments[1]; |
| 1628 | } else { |
| 1629 | do { |
| 1630 | if (i in self) { |
| 1631 | result = self[i--]; |
| 1632 | break; |
| 1633 | } |
| 1634 | |
| 1635 | // if array contains no values, no initial value to return |
| 1636 | if (--i < 0) { |
| 1637 | throw new TypeError('reduceRight of empty array with no initial value'); |
| 1638 | } |
| 1639 | } while (true); |
| 1640 | } |
| 1641 | |
| 1642 | if (i < 0) { |
| 1643 | return result; |
| 1644 | } |
| 1645 | |
| 1646 | do { |
| 1647 | if (i in self) { |
| 1648 | result = callbackfn(result, self[i], i, object); |
| 1649 | } |
| 1650 | } while (i--); |
| 1651 | |
| 1652 | return result; |
| 1653 | } |
| 1654 | }, !reduceRightCoercesToObject); |
| 1655 | |
| 1656 | // ES5 15.4.4.14 |
| 1657 | // http://es5.github.com/#x15.4.4.14 |
| 1658 | // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf |
| 1659 | var hasFirefox2IndexOfBug = ArrayPrototype.indexOf && [0, 1].indexOf(1, 2) !== -1; |
| 1660 | defineProperties(ArrayPrototype, { |
| 1661 | indexOf: function indexOf(searchElement/*, fromIndex */) { |
| 1662 | var self = splitString && isString(this) ? strSplit(this, '') : ES.ToObject(this); |
| 1663 | var length = ES.ToUint32(self.length); |
| 1664 | |
| 1665 | if (length === 0) { |
| 1666 | return -1; |
| 1667 | } |
| 1668 | |
| 1669 | var i = 0; |
| 1670 | if (arguments.length > 1) { |
| 1671 | i = ES.ToInteger(arguments[1]); |
| 1672 | } |
| 1673 | |
| 1674 | // handle negative indices |
| 1675 | i = i >= 0 ? i : max(0, length + i); |
| 1676 | for (; i < length; i++) { |
| 1677 | if (i in self && self[i] === searchElement) { |
| 1678 | return i; |
| 1679 | } |
| 1680 | } |
| 1681 | return -1; |
| 1682 | } |
| 1683 | }, hasFirefox2IndexOfBug); |
| 1684 | |
| 1685 | // ES5 15.4.4.15 |
| 1686 | // http://es5.github.com/#x15.4.4.15 |
| 1687 | // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/lastIndexOf |
| 1688 | var hasFirefox2LastIndexOfBug = ArrayPrototype.lastIndexOf && [0, 1].lastIndexOf(0, -3) !== -1; |
| 1689 | defineProperties(ArrayPrototype, { |
| 1690 | lastIndexOf: function lastIndexOf(searchElement/*, fromIndex */) { |
| 1691 | var self = splitString && isString(this) ? strSplit(this, '') : ES.ToObject(this); |
| 1692 | var length = ES.ToUint32(self.length); |
| 1693 | |
| 1694 | if (length === 0) { |
| 1695 | return -1; |
| 1696 | } |
| 1697 | var i = length - 1; |
| 1698 | if (arguments.length > 1) { |
| 1699 | i = min(i, ES.ToInteger(arguments[1])); |
| 1700 | } |
| 1701 | // handle negative indices |
| 1702 | i = i >= 0 ? i : length - Math.abs(i); |
| 1703 | for (; i >= 0; i--) { |
| 1704 | if (i in self && searchElement === self[i]) { |
| 1705 | return i; |
| 1706 | } |
| 1707 | } |
| 1708 | return -1; |
| 1709 | } |
| 1710 | }, hasFirefox2LastIndexOfBug); |
| 1711 | |
| 1712 | // ES5 15.4.4.12 |
| 1713 | // http://es5.github.com/#x15.4.4.12 |
| 1714 | var spliceNoopReturnsEmptyArray = (function () { |
| 1715 | var a = [1, 2]; |
| 1716 | var result = a.splice(); |
| 1717 | return a.length === 2 && isArray(result) && result.length === 0; |
| 1718 | }()); |
| 1719 | defineProperties(ArrayPrototype, { |
| 1720 | // Safari 5.0 bug where .splice() returns undefined |
| 1721 | splice: function splice(start, deleteCount) { |
| 1722 | if (arguments.length === 0) { |
| 1723 | return []; |
| 1724 | } else { |
| 1725 | return array_splice.apply(this, arguments); |
| 1726 | } |
| 1727 | } |
| 1728 | }, !spliceNoopReturnsEmptyArray); |
| 1729 | |
| 1730 | var spliceWorksWithEmptyObject = (function () { |
| 1731 | var obj = {}; |
| 1732 | ArrayPrototype.splice.call(obj, 0, 0, 1); |
| 1733 | return obj.length === 1; |
| 1734 | }()); |
| 1735 | defineProperties(ArrayPrototype, { |
| 1736 | splice: function splice(start, deleteCount) { |
| 1737 | if (arguments.length === 0) { |
| 1738 | return []; |
| 1739 | } |
| 1740 | var args = arguments; |
| 1741 | this.length = max(ES.ToInteger(this.length), 0); |
| 1742 | if (arguments.length > 0 && typeof deleteCount !== 'number') { |
| 1743 | args = arraySlice(arguments); |
| 1744 | if (args.length < 2) { |
| 1745 | pushCall(args, this.length - start); |
| 1746 | } else { |
| 1747 | args[1] = ES.ToInteger(deleteCount); |
| 1748 | } |
| 1749 | } |
| 1750 | return array_splice.apply(this, args); |
| 1751 | } |
| 1752 | }, !spliceWorksWithEmptyObject); |
| 1753 | var spliceWorksWithLargeSparseArrays = (function () { |
| 1754 | // Per https://github.com/es-shims/es5-shim/issues/295 |
| 1755 | // Safari 7/8 breaks with sparse arrays of size 1e5 or greater |
| 1756 | var arr = new $Array(1e5); |
| 1757 | // note: the index MUST be 8 or larger or the test will false pass |
| 1758 | arr[8] = 'x'; |
| 1759 | arr.splice(1, 1); |
| 1760 | // note: this test must be defined *after* the indexOf shim |
| 1761 | // per https://github.com/es-shims/es5-shim/issues/313 |
| 1762 | return arr.indexOf('x') === 7; |
| 1763 | }()); |
| 1764 | var spliceWorksWithSmallSparseArrays = (function () { |
| 1765 | // Per https://github.com/es-shims/es5-shim/issues/295 |
| 1766 | // Opera 12.15 breaks on this, no idea why. |
| 1767 | var n = 256; |
| 1768 | var arr = []; |
| 1769 | arr[n] = 'a'; |
| 1770 | arr.splice(n + 1, 0, 'b'); |
| 1771 | return arr[n] === 'a'; |
| 1772 | }()); |
| 1773 | defineProperties(ArrayPrototype, { |
| 1774 | splice: function splice(start, deleteCount) { |
| 1775 | var O = ES.ToObject(this); |
| 1776 | var A = []; |
| 1777 | var len = ES.ToUint32(O.length); |
| 1778 | var relativeStart = ES.ToInteger(start); |
| 1779 | var actualStart = relativeStart < 0 ? max((len + relativeStart), 0) : min(relativeStart, len); |
| 1780 | var actualDeleteCount = min(max(ES.ToInteger(deleteCount), 0), len - actualStart); |
| 1781 | |
| 1782 | var k = 0; |
| 1783 | var from; |
| 1784 | while (k < actualDeleteCount) { |
| 1785 | from = $String(actualStart + k); |
| 1786 | if (owns(O, from)) { |
| 1787 | A[k] = O[from]; |
| 1788 | } |
| 1789 | k += 1; |
| 1790 | } |
| 1791 | |
| 1792 | var items = arraySlice(arguments, 2); |
| 1793 | var itemCount = items.length; |
| 1794 | var to; |
| 1795 | if (itemCount < actualDeleteCount) { |
| 1796 | k = actualStart; |
| 1797 | var maxK = len - actualDeleteCount; |
| 1798 | while (k < maxK) { |
| 1799 | from = $String(k + actualDeleteCount); |
| 1800 | to = $String(k + itemCount); |
| 1801 | if (owns(O, from)) { |
| 1802 | O[to] = O[from]; |
| 1803 | } else { |
| 1804 | delete O[to]; |
| 1805 | } |
| 1806 | k += 1; |
| 1807 | } |
| 1808 | k = len; |
| 1809 | var minK = len - actualDeleteCount + itemCount; |
| 1810 | while (k > minK) { |
| 1811 | delete O[k - 1]; |
| 1812 | k -= 1; |
| 1813 | } |
| 1814 | } else if (itemCount > actualDeleteCount) { |
| 1815 | k = len - actualDeleteCount; |
| 1816 | while (k > actualStart) { |
| 1817 | from = $String(k + actualDeleteCount - 1); |
| 1818 | to = $String(k + itemCount - 1); |
| 1819 | if (owns(O, from)) { |
| 1820 | O[to] = O[from]; |
| 1821 | } else { |
| 1822 | delete O[to]; |
| 1823 | } |
| 1824 | k -= 1; |
| 1825 | } |
| 1826 | } |
| 1827 | k = actualStart; |
| 1828 | for (var i = 0; i < items.length; ++i) { |
| 1829 | O[k] = items[i]; |
| 1830 | k += 1; |
| 1831 | } |
| 1832 | O.length = len - actualDeleteCount + itemCount; |
| 1833 | |
| 1834 | return A; |
| 1835 | } |
| 1836 | }, !spliceWorksWithLargeSparseArrays || !spliceWorksWithSmallSparseArrays); |
| 1837 | |
| 1838 | var originalJoin = ArrayPrototype.join; |
| 1839 | var hasStringJoinBug; |
| 1840 | try { |
| 1841 | hasStringJoinBug = Array.prototype.join.call('123', ',') !== '1,2,3'; |
| 1842 | } catch (e) { |
| 1843 | hasStringJoinBug = true; |
| 1844 | } |
| 1845 | if (hasStringJoinBug) { |
| 1846 | defineProperties(ArrayPrototype, { |
| 1847 | join: function join(separator) { |
| 1848 | var sep = typeof separator === 'undefined' ? ',' : separator; |
| 1849 | return originalJoin.call(isString(this) ? strSplit(this, '') : this, sep); |
| 1850 | } |
| 1851 | }, hasStringJoinBug); |
| 1852 | } |
| 1853 | |
| 1854 | var hasJoinUndefinedBug = [1, 2].join(undefined) !== '1,2'; |
| 1855 | if (hasJoinUndefinedBug) { |
| 1856 | defineProperties(ArrayPrototype, { |
| 1857 | join: function join(separator) { |
| 1858 | var sep = typeof separator === 'undefined' ? ',' : separator; |
| 1859 | return originalJoin.call(this, sep); |
| 1860 | } |
| 1861 | }, hasJoinUndefinedBug); |
| 1862 | } |
| 1863 | |
| 1864 | var pushShim = function push(item) { |
| 1865 | var O = ES.ToObject(this); |
| 1866 | var n = ES.ToUint32(O.length); |
| 1867 | var i = 0; |
| 1868 | while (i < arguments.length) { |
| 1869 | O[n + i] = arguments[i]; |
| 1870 | i += 1; |
| 1871 | } |
| 1872 | O.length = n + i; |
| 1873 | return n + i; |
| 1874 | }; |
| 1875 | |
| 1876 | var pushIsNotGeneric = (function () { |
| 1877 | var obj = {}; |
| 1878 | var result = Array.prototype.push.call(obj, undefined); |
| 1879 | return result !== 1 || obj.length !== 1 || typeof obj[0] !== 'undefined' || !owns(obj, 0); |
| 1880 | }()); |
| 1881 | defineProperties(ArrayPrototype, { |
| 1882 | push: function push(item) { |
| 1883 | if (isArray(this)) { |
| 1884 | return array_push.apply(this, arguments); |
| 1885 | } |
| 1886 | return pushShim.apply(this, arguments); |
| 1887 | } |
| 1888 | }, pushIsNotGeneric); |
| 1889 | |
| 1890 | // This fixes a very weird bug in Opera 10.6 when pushing `undefined |
| 1891 | var pushUndefinedIsWeird = (function () { |
| 1892 | var arr = []; |
| 1893 | var result = arr.push(undefined); |
| 1894 | return result !== 1 || arr.length !== 1 || typeof arr[0] !== 'undefined' || !owns(arr, 0); |
| 1895 | }()); |
| 1896 | defineProperties(ArrayPrototype, { push: pushShim }, pushUndefinedIsWeird); |
| 1897 | |
| 1898 | // ES5 15.2.3.14 |
| 1899 | // http://es5.github.io/#x15.4.4.10 |
| 1900 | // Fix boxed string bug |
| 1901 | defineProperties(ArrayPrototype, { |
| 1902 | slice: function (start, end) { |
| 1903 | var arr = isString(this) ? strSplit(this, '') : this; |
| 1904 | return arraySliceApply(arr, arguments); |
| 1905 | } |
| 1906 | }, splitString); |
| 1907 | |
| 1908 | var sortIgnoresNonFunctions = (function () { |
| 1909 | try { |
| 1910 | [1, 2].sort(null); |
| 1911 | [1, 2].sort({}); |
| 1912 | return true; |
| 1913 | } catch (e) {} |
| 1914 | return false; |
| 1915 | }()); |
| 1916 | var sortThrowsOnRegex = (function () { |
| 1917 | // this is a problem in Firefox 4, in which `typeof /a/ === 'function'` |
| 1918 | try { |
| 1919 | [1, 2].sort(/a/); |
| 1920 | return false; |
| 1921 | } catch (e) {} |
| 1922 | return true; |
| 1923 | }()); |
| 1924 | var sortIgnoresUndefined = (function () { |
| 1925 | // applies in IE 8, for one. |
| 1926 | try { |
| 1927 | [1, 2].sort(undefined); |
| 1928 | return true; |
| 1929 | } catch (e) {} |
| 1930 | return false; |
| 1931 | }()); |
| 1932 | defineProperties(ArrayPrototype, { |
| 1933 | sort: function sort(compareFn) { |
| 1934 | if (typeof compareFn === 'undefined') { |
| 1935 | return arraySort(this); |
| 1936 | } |
| 1937 | if (!isCallable(compareFn)) { |
| 1938 | throw new TypeError('Array.prototype.sort callback must be a function'); |
| 1939 | } |
| 1940 | return arraySort(this, compareFn); |
| 1941 | } |
| 1942 | }, sortIgnoresNonFunctions || !sortIgnoresUndefined || !sortThrowsOnRegex); |
| 1943 | |
| 1944 | // |
| 1945 | // Object |
| 1946 | // ====== |
| 1947 | // |
| 1948 | |
| 1949 | // ES5 15.2.3.14 |
| 1950 | // http://es5.github.com/#x15.2.3.14 |
| 1951 | |
| 1952 | // http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation |
| 1953 | var hasDontEnumBug = !isEnum({ 'toString': null }, 'toString'); |
| 1954 | var hasProtoEnumBug = isEnum(function () {}, 'prototype'); |
| 1955 | var hasStringEnumBug = !owns('x', '0'); |
| 1956 | var equalsConstructorPrototype = function (o) { |
| 1957 | var ctor = o.constructor; |
| 1958 | return ctor && ctor.prototype === o; |
| 1959 | }; |
| 1960 | var blacklistedKeys = { |
| 1961 | $window: true, |
| 1962 | $console: true, |
| 1963 | $parent: true, |
| 1964 | $self: true, |
| 1965 | $frame: true, |
| 1966 | $frames: true, |
| 1967 | $frameElement: true, |
| 1968 | $webkitIndexedDB: true, |
| 1969 | $webkitStorageInfo: true, |
| 1970 | $external: true |
| 1971 | }; |
| 1972 | var hasAutomationEqualityBug = (function () { |
| 1973 | /* globals window */ |
| 1974 | if (typeof window === 'undefined') { |
| 1975 | return false; |
| 1976 | } |
| 1977 | for (var k in window) { |
| 1978 | try { |
| 1979 | if (!blacklistedKeys['$' + k] && owns(window, k) && window[k] !== null && typeof window[k] === 'object') { |
| 1980 | equalsConstructorPrototype(window[k]); |
| 1981 | } |
| 1982 | } catch (e) { |
| 1983 | return true; |
| 1984 | } |
| 1985 | } |
| 1986 | return false; |
| 1987 | }()); |
| 1988 | var equalsConstructorPrototypeIfNotBuggy = function (object) { |
| 1989 | if (typeof window === 'undefined' || !hasAutomationEqualityBug) { |
| 1990 | return equalsConstructorPrototype(object); |
| 1991 | } |
| 1992 | try { |
| 1993 | return equalsConstructorPrototype(object); |
| 1994 | } catch (e) { |
| 1995 | return false; |
| 1996 | } |
| 1997 | }; |
| 1998 | var dontEnums = [ |
| 1999 | 'toString', |
| 2000 | 'toLocaleString', |
| 2001 | 'valueOf', |
| 2002 | 'hasOwnProperty', |
| 2003 | 'isPrototypeOf', |
| 2004 | 'propertyIsEnumerable', |
| 2005 | 'constructor' |
| 2006 | ]; |
| 2007 | var dontEnumsLength = dontEnums.length; |
| 2008 | |
| 2009 | // taken directly from https://github.com/ljharb/is-arguments/blob/master/index.js |
| 2010 | // can be replaced with require('is-arguments') if we ever use a build process instead |
| 2011 | var isStandardArguments = function isArguments(value) { |
| 2012 | return toStr(value) === '[object Arguments]'; |
| 2013 | }; |
| 2014 | var isLegacyArguments = function isArguments(value) { |
| 2015 | return value !== null && |
| 2016 | typeof value === 'object' && |
| 2017 | typeof value.length === 'number' && |
| 2018 | value.length >= 0 && |
| 2019 | !isArray(value) && |
| 2020 | isCallable(value.callee); |
| 2021 | }; |
| 2022 | var isArguments = isStandardArguments(arguments) ? isStandardArguments : isLegacyArguments; |
| 2023 | |
| 2024 | defineProperties($Object, { |
| 2025 | keys: function keys(object) { |
| 2026 | var isFn = isCallable(object); |
| 2027 | var isArgs = isArguments(object); |
| 2028 | var isObject = object !== null && typeof object === 'object'; |
| 2029 | var isStr = isObject && isString(object); |
| 2030 | |
| 2031 | if (!isObject && !isFn && !isArgs) { |
| 2032 | throw new TypeError('Object.keys called on a non-object'); |
| 2033 | } |
| 2034 | |
| 2035 | var theKeys = []; |
| 2036 | var skipProto = hasProtoEnumBug && isFn; |
| 2037 | if ((isStr && hasStringEnumBug) || isArgs) { |
| 2038 | for (var i = 0; i < object.length; ++i) { |
| 2039 | pushCall(theKeys, $String(i)); |
| 2040 | } |
| 2041 | } |
| 2042 | |
| 2043 | if (!isArgs) { |
| 2044 | for (var name in object) { |
| 2045 | if (!(skipProto && name === 'prototype') && owns(object, name)) { |
| 2046 | pushCall(theKeys, $String(name)); |
| 2047 | } |
| 2048 | } |
| 2049 | } |
| 2050 | |
| 2051 | if (hasDontEnumBug) { |
| 2052 | var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object); |
| 2053 | for (var j = 0; j < dontEnumsLength; j++) { |
| 2054 | var dontEnum = dontEnums[j]; |
| 2055 | if (!(skipConstructor && dontEnum === 'constructor') && owns(object, dontEnum)) { |
| 2056 | pushCall(theKeys, dontEnum); |
| 2057 | } |
| 2058 | } |
| 2059 | } |
| 2060 | return theKeys; |
| 2061 | } |
| 2062 | }); |
| 2063 | |
| 2064 | var keysWorksWithArguments = $Object.keys && (function () { |
| 2065 | // Safari 5.0 bug |
| 2066 | return $Object.keys(arguments).length === 2; |
| 2067 | }(1, 2)); |
| 2068 | var keysHasArgumentsLengthBug = $Object.keys && (function () { |
| 2069 | var argKeys = $Object.keys(arguments); |
| 2070 | return arguments.length !== 1 || argKeys.length !== 1 || argKeys[0] !== 1; |
| 2071 | }(1)); |
| 2072 | var originalKeys = $Object.keys; |
| 2073 | defineProperties($Object, { |
| 2074 | keys: function keys(object) { |
| 2075 | if (isArguments(object)) { |
| 2076 | return originalKeys(arraySlice(object)); |
| 2077 | } else { |
| 2078 | return originalKeys(object); |
| 2079 | } |
| 2080 | } |
| 2081 | }, !keysWorksWithArguments || keysHasArgumentsLengthBug); |
| 2082 | |
| 2083 | // |
| 2084 | // Date |
| 2085 | // ==== |
| 2086 | // |
| 2087 | |
| 2088 | var hasNegativeMonthYearBug = new Date(-3509827329600292).getUTCMonth() !== 0; |
| 2089 | var aNegativeTestDate = new Date(-1509842289600292); |
| 2090 | var aPositiveTestDate = new Date(1449662400000); |
| 2091 | var hasToUTCStringFormatBug = aNegativeTestDate.toUTCString() !== 'Mon, 01 Jan -45875 11:59:59 GMT'; |
| 2092 | var hasToDateStringFormatBug; |
| 2093 | var hasToStringFormatBug; |
| 2094 | var timeZoneOffset = aNegativeTestDate.getTimezoneOffset(); |
| 2095 | if (timeZoneOffset < -720) { |
| 2096 | hasToDateStringFormatBug = aNegativeTestDate.toDateString() !== 'Tue Jan 02 -45875'; |
| 2097 | hasToStringFormatBug = !(/^Thu Dec 10 2015 \d\d:\d\d:\d\d GMT[-\+]\d\d\d\d(?: |$)/).test(aPositiveTestDate.toString()); |
| 2098 | } else { |
| 2099 | hasToDateStringFormatBug = aNegativeTestDate.toDateString() !== 'Mon Jan 01 -45875'; |
| 2100 | hasToStringFormatBug = !(/^Wed Dec 09 2015 \d\d:\d\d:\d\d GMT[-\+]\d\d\d\d(?: |$)/).test(aPositiveTestDate.toString()); |
| 2101 | } |
| 2102 | |
| 2103 | var originalGetFullYear = call.bind(Date.prototype.getFullYear); |
| 2104 | var originalGetMonth = call.bind(Date.prototype.getMonth); |
| 2105 | var originalGetDate = call.bind(Date.prototype.getDate); |
| 2106 | var originalGetUTCFullYear = call.bind(Date.prototype.getUTCFullYear); |
| 2107 | var originalGetUTCMonth = call.bind(Date.prototype.getUTCMonth); |
| 2108 | var originalGetUTCDate = call.bind(Date.prototype.getUTCDate); |
| 2109 | var originalGetUTCDay = call.bind(Date.prototype.getUTCDay); |
| 2110 | var originalGetUTCHours = call.bind(Date.prototype.getUTCHours); |
| 2111 | var originalGetUTCMinutes = call.bind(Date.prototype.getUTCMinutes); |
| 2112 | var originalGetUTCSeconds = call.bind(Date.prototype.getUTCSeconds); |
| 2113 | var originalGetUTCMilliseconds = call.bind(Date.prototype.getUTCMilliseconds); |
| 2114 | var dayName = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; |
| 2115 | var monthName = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; |
| 2116 | var daysInMonth = function daysInMonth(month, year) { |
| 2117 | return originalGetDate(new Date(year, month, 0)); |
| 2118 | }; |
| 2119 | |
| 2120 | defineProperties(Date.prototype, { |
| 2121 | getFullYear: function getFullYear() { |
| 2122 | if (!this || !(this instanceof Date)) { |
| 2123 | throw new TypeError('this is not a Date object.'); |
| 2124 | } |
| 2125 | var year = originalGetFullYear(this); |
| 2126 | if (year < 0 && originalGetMonth(this) > 11) { |
| 2127 | return year + 1; |
| 2128 | } |
| 2129 | return year; |
| 2130 | }, |
| 2131 | getMonth: function getMonth() { |
| 2132 | if (!this || !(this instanceof Date)) { |
| 2133 | throw new TypeError('this is not a Date object.'); |
| 2134 | } |
| 2135 | var year = originalGetFullYear(this); |
| 2136 | var month = originalGetMonth(this); |
| 2137 | if (year < 0 && month > 11) { |
| 2138 | return 0; |
| 2139 | } |
| 2140 | return month; |
| 2141 | }, |
| 2142 | getDate: function getDate() { |
| 2143 | if (!this || !(this instanceof Date)) { |
| 2144 | throw new TypeError('this is not a Date object.'); |
| 2145 | } |
| 2146 | var year = originalGetFullYear(this); |
| 2147 | var month = originalGetMonth(this); |
| 2148 | var date = originalGetDate(this); |
| 2149 | if (year < 0 && month > 11) { |
| 2150 | if (month === 12) { |
| 2151 | return date; |
| 2152 | } |
| 2153 | var days = daysInMonth(0, year + 1); |
| 2154 | return (days - date) + 1; |
| 2155 | } |
| 2156 | return date; |
| 2157 | }, |
| 2158 | getUTCFullYear: function getUTCFullYear() { |
| 2159 | if (!this || !(this instanceof Date)) { |
| 2160 | throw new TypeError('this is not a Date object.'); |
| 2161 | } |
| 2162 | var year = originalGetUTCFullYear(this); |
| 2163 | if (year < 0 && originalGetUTCMonth(this) > 11) { |
| 2164 | return year + 1; |
| 2165 | } |
| 2166 | return year; |
| 2167 | }, |
| 2168 | getUTCMonth: function getUTCMonth() { |
| 2169 | if (!this || !(this instanceof Date)) { |
| 2170 | throw new TypeError('this is not a Date object.'); |
| 2171 | } |
| 2172 | var year = originalGetUTCFullYear(this); |
| 2173 | var month = originalGetUTCMonth(this); |
| 2174 | if (year < 0 && month > 11) { |
| 2175 | return 0; |
| 2176 | } |
| 2177 | return month; |
| 2178 | }, |
| 2179 | getUTCDate: function getUTCDate() { |
| 2180 | if (!this || !(this instanceof Date)) { |
| 2181 | throw new TypeError('this is not a Date object.'); |
| 2182 | } |
| 2183 | var year = originalGetUTCFullYear(this); |
| 2184 | var month = originalGetUTCMonth(this); |
| 2185 | var date = originalGetUTCDate(this); |
| 2186 | if (year < 0 && month > 11) { |
| 2187 | if (month === 12) { |
| 2188 | return date; |
| 2189 | } |
| 2190 | var days = daysInMonth(0, year + 1); |
| 2191 | return (days - date) + 1; |
| 2192 | } |
| 2193 | return date; |
| 2194 | } |
| 2195 | }, hasNegativeMonthYearBug); |
| 2196 | |
| 2197 | defineProperties(Date.prototype, { |
| 2198 | toUTCString: function toUTCString() { |
| 2199 | if (!this || !(this instanceof Date)) { |
| 2200 | throw new TypeError('this is not a Date object.'); |
| 2201 | } |
| 2202 | var day = originalGetUTCDay(this); |
| 2203 | var date = originalGetUTCDate(this); |
| 2204 | var month = originalGetUTCMonth(this); |
| 2205 | var year = originalGetUTCFullYear(this); |
| 2206 | var hour = originalGetUTCHours(this); |
| 2207 | var minute = originalGetUTCMinutes(this); |
| 2208 | var second = originalGetUTCSeconds(this); |
| 2209 | return dayName[day] + ', ' + |
| 2210 | (date < 10 ? '0' + date : date) + ' ' + |
| 2211 | monthName[month] + ' ' + |
| 2212 | year + ' ' + |
| 2213 | (hour < 10 ? '0' + hour : hour) + ':' + |
| 2214 | (minute < 10 ? '0' + minute : minute) + ':' + |
| 2215 | (second < 10 ? '0' + second : second) + ' GMT'; |
| 2216 | } |
| 2217 | }, hasNegativeMonthYearBug || hasToUTCStringFormatBug); |
| 2218 | |
| 2219 | // Opera 12 has `,` |
| 2220 | defineProperties(Date.prototype, { |
| 2221 | toDateString: function toDateString() { |
| 2222 | if (!this || !(this instanceof Date)) { |
| 2223 | throw new TypeError('this is not a Date object.'); |
| 2224 | } |
| 2225 | var day = this.getDay(); |
| 2226 | var date = this.getDate(); |
| 2227 | var month = this.getMonth(); |
| 2228 | var year = this.getFullYear(); |
| 2229 | return dayName[day] + ' ' + |
| 2230 | monthName[month] + ' ' + |
| 2231 | (date < 10 ? '0' + date : date) + ' ' + |
| 2232 | year; |
| 2233 | } |
| 2234 | }, hasNegativeMonthYearBug || hasToDateStringFormatBug); |
| 2235 | |
| 2236 | // can't use defineProperties here because of toString enumeration issue in IE <= 8 |
| 2237 | if (hasNegativeMonthYearBug || hasToStringFormatBug) { |
| 2238 | Date.prototype.toString = function toString() { |
| 2239 | if (!this || !(this instanceof Date)) { |
| 2240 | throw new TypeError('this is not a Date object.'); |
| 2241 | } |
| 2242 | var day = this.getDay(); |
| 2243 | var date = this.getDate(); |
| 2244 | var month = this.getMonth(); |
| 2245 | var year = this.getFullYear(); |
| 2246 | var hour = this.getHours(); |
| 2247 | var minute = this.getMinutes(); |
| 2248 | var second = this.getSeconds(); |
| 2249 | var timezoneOffset = this.getTimezoneOffset(); |
| 2250 | var hoursOffset = Math.floor(Math.abs(timezoneOffset) / 60); |
| 2251 | var minutesOffset = Math.floor(Math.abs(timezoneOffset) % 60); |
| 2252 | return dayName[day] + ' ' + |
| 2253 | monthName[month] + ' ' + |
| 2254 | (date < 10 ? '0' + date : date) + ' ' + |
| 2255 | year + ' ' + |
| 2256 | (hour < 10 ? '0' + hour : hour) + ':' + |
| 2257 | (minute < 10 ? '0' + minute : minute) + ':' + |
| 2258 | (second < 10 ? '0' + second : second) + ' GMT' + |
| 2259 | (timezoneOffset > 0 ? '-' : '+') + |
| 2260 | (hoursOffset < 10 ? '0' + hoursOffset : hoursOffset) + |
| 2261 | (minutesOffset < 10 ? '0' + minutesOffset : minutesOffset); |
| 2262 | }; |
| 2263 | if (supportsDescriptors) { |
| 2264 | $Object.defineProperty(Date.prototype, 'toString', { |
| 2265 | configurable: true, |
| 2266 | enumerable: false, |
| 2267 | writable: true |
| 2268 | }); |
| 2269 | } |
| 2270 | } |
| 2271 | |
| 2272 | // ES5 15.9.5.43 |
| 2273 | // http://es5.github.com/#x15.9.5.43 |
| 2274 | // This function returns a String value represent the instance in time |
| 2275 | // represented by this Date object. The format of the String is the Date Time |
| 2276 | // string format defined in 15.9.1.15. All fields are present in the String. |
| 2277 | // The time zone is always UTC, denoted by the suffix Z. If the time value of |
| 2278 | // this object is not a finite Number a RangeError exception is thrown. |
| 2279 | var negativeDate = -62198755200000; |
| 2280 | var negativeYearString = '-000001'; |
| 2281 | var hasNegativeDateBug = Date.prototype.toISOString && new Date(negativeDate).toISOString().indexOf(negativeYearString) === -1; |
| 2282 | var hasSafari51DateBug = Date.prototype.toISOString && new Date(-1).toISOString() !== '1969-12-31T23:59:59.999Z'; |
| 2283 | |
| 2284 | var getTime = call.bind(Date.prototype.getTime); |
| 2285 | |
| 2286 | defineProperties(Date.prototype, { |
| 2287 | toISOString: function toISOString() { |
| 2288 | if (!isFinite(this) || !isFinite(getTime(this))) { |
| 2289 | // Adope Photoshop requires the second check. |
| 2290 | throw new RangeError('Date.prototype.toISOString called on non-finite value.'); |
| 2291 | } |
| 2292 | |
| 2293 | var year = originalGetUTCFullYear(this); |
| 2294 | |
| 2295 | var month = originalGetUTCMonth(this); |
| 2296 | // see https://github.com/es-shims/es5-shim/issues/111 |
| 2297 | year += Math.floor(month / 12); |
| 2298 | month = (month % 12 + 12) % 12; |
| 2299 | |
| 2300 | // the date time string format is specified in 15.9.1.15. |
| 2301 | var result = [month + 1, originalGetUTCDate(this), originalGetUTCHours(this), originalGetUTCMinutes(this), originalGetUTCSeconds(this)]; |
| 2302 | year = ( |
| 2303 | (year < 0 ? '-' : (year > 9999 ? '+' : '')) + |
| 2304 | strSlice('00000' + Math.abs(year), (0 <= year && year <= 9999) ? -4 : -6) |
| 2305 | ); |
| 2306 | |
| 2307 | for (var i = 0; i < result.length; ++i) { |
| 2308 | // pad months, days, hours, minutes, and seconds to have two digits. |
| 2309 | result[i] = strSlice('00' + result[i], -2); |
| 2310 | } |
| 2311 | // pad milliseconds to have three digits. |
| 2312 | return ( |
| 2313 | year + '-' + arraySlice(result, 0, 2).join('-') + |
| 2314 | 'T' + arraySlice(result, 2).join(':') + '.' + |
| 2315 | strSlice('000' + originalGetUTCMilliseconds(this), -3) + 'Z' |
| 2316 | ); |
| 2317 | } |
| 2318 | }, hasNegativeDateBug || hasSafari51DateBug); |
| 2319 | |
| 2320 | // ES5 15.9.5.44 |
| 2321 | // http://es5.github.com/#x15.9.5.44 |
| 2322 | // This function provides a String representation of a Date object for use by |
| 2323 | // JSON.stringify (15.12.3). |
| 2324 | var dateToJSONIsSupported = (function () { |
| 2325 | try { |
| 2326 | return Date.prototype.toJSON && |
| 2327 | new Date(NaN).toJSON() === null && |
| 2328 | new Date(negativeDate).toJSON().indexOf(negativeYearString) !== -1 && |
| 2329 | Date.prototype.toJSON.call({ // generic |
| 2330 | toISOString: function () { return true; } |
| 2331 | }); |
| 2332 | } catch (e) { |
| 2333 | return false; |
| 2334 | } |
| 2335 | }()); |
| 2336 | if (!dateToJSONIsSupported) { |
| 2337 | Date.prototype.toJSON = function toJSON(key) { |
| 2338 | // When the toJSON method is called with argument key, the following |
| 2339 | // steps are taken: |
| 2340 | |
| 2341 | // 1. Let O be the result of calling ToObject, giving it the this |
| 2342 | // value as its argument. |
| 2343 | // 2. Let tv be ES.ToPrimitive(O, hint Number). |
| 2344 | var O = $Object(this); |
| 2345 | var tv = ES.ToPrimitive(O); |
| 2346 | // 3. If tv is a Number and is not finite, return null. |
| 2347 | if (typeof tv === 'number' && !isFinite(tv)) { |
| 2348 | return null; |
| 2349 | } |
| 2350 | // 4. Let toISO be the result of calling the [[Get]] internal method of |
| 2351 | // O with argument "toISOString". |
| 2352 | var toISO = O.toISOString; |
| 2353 | // 5. If IsCallable(toISO) is false, throw a TypeError exception. |
| 2354 | if (!isCallable(toISO)) { |
| 2355 | throw new TypeError('toISOString property is not callable'); |
| 2356 | } |
| 2357 | // 6. Return the result of calling the [[Call]] internal method of |
| 2358 | // toISO with O as the this value and an empty argument list. |
| 2359 | return toISO.call(O); |
| 2360 | |
| 2361 | // NOTE 1 The argument is ignored. |
| 2362 | |
| 2363 | // NOTE 2 The toJSON function is intentionally generic; it does not |
| 2364 | // require that its this value be a Date object. Therefore, it can be |
| 2365 | // transferred to other kinds of objects for use as a method. However, |
| 2366 | // it does require that any such object have a toISOString method. An |
| 2367 | // object is free to use the argument key to filter its |
| 2368 | // stringification. |
| 2369 | }; |
| 2370 | } |
| 2371 | |
| 2372 | // ES5 15.9.4.2 |
| 2373 | // http://es5.github.com/#x15.9.4.2 |
| 2374 | // based on work shared by Daniel Friesen (dantman) |
| 2375 | // http://gist.github.com/303249 |
| 2376 | var supportsExtendedYears = Date.parse('+033658-09-27T01:46:40.000Z') === 1e15; |
| 2377 | var acceptsInvalidDates = !isNaN(Date.parse('2012-04-04T24:00:00.500Z')) || !isNaN(Date.parse('2012-11-31T23:59:59.000Z')) || !isNaN(Date.parse('2012-12-31T23:59:60.000Z')); |
| 2378 | var doesNotParseY2KNewYear = isNaN(Date.parse('2000-01-01T00:00:00.000Z')); |
| 2379 | if (doesNotParseY2KNewYear || acceptsInvalidDates || !supportsExtendedYears) { |
| 2380 | // XXX global assignment won't work in embeddings that use |
| 2381 | // an alternate object for the context. |
| 2382 | /* global Date: true */ |
| 2383 | /* eslint-disable no-undef */ |
| 2384 | var maxSafeUnsigned32Bit = Math.pow(2, 31) - 1; |
| 2385 | var hasSafariSignedIntBug = isActualNaN(new Date(1970, 0, 1, 0, 0, 0, maxSafeUnsigned32Bit + 1).getTime()); |
| 2386 | /* eslint-disable no-implicit-globals */ |
| 2387 | Date = (function (NativeDate) { |
| 2388 | /* eslint-enable no-implicit-globals */ |
| 2389 | /* eslint-enable no-undef */ |
| 2390 | // Date.length === 7 |
| 2391 | var DateShim = function Date(Y, M, D, h, m, s, ms) { |
| 2392 | var length = arguments.length; |
| 2393 | var date; |
| 2394 | if (this instanceof NativeDate) { |
| 2395 | var seconds = s; |
| 2396 | var millis = ms; |
| 2397 | if (hasSafariSignedIntBug && length >= 7 && ms > maxSafeUnsigned32Bit) { |
| 2398 | // work around a Safari 8/9 bug where it treats the seconds as signed |
| 2399 | var msToShift = Math.floor(ms / maxSafeUnsigned32Bit) * maxSafeUnsigned32Bit; |
| 2400 | var sToShift = Math.floor(msToShift / 1e3); |
| 2401 | seconds += sToShift; |
| 2402 | millis -= sToShift * 1e3; |
| 2403 | } |
| 2404 | date = length === 1 && $String(Y) === Y ? // isString(Y) |
| 2405 | // We explicitly pass it through parse: |
| 2406 | new NativeDate(DateShim.parse(Y)) : |
| 2407 | // We have to manually make calls depending on argument |
| 2408 | // length here |
| 2409 | length >= 7 ? new NativeDate(Y, M, D, h, m, seconds, millis) : |
| 2410 | length >= 6 ? new NativeDate(Y, M, D, h, m, seconds) : |
| 2411 | length >= 5 ? new NativeDate(Y, M, D, h, m) : |
| 2412 | length >= 4 ? new NativeDate(Y, M, D, h) : |
| 2413 | length >= 3 ? new NativeDate(Y, M, D) : |
| 2414 | length >= 2 ? new NativeDate(Y, M) : |
| 2415 | length >= 1 ? new NativeDate(Y instanceof NativeDate ? +Y : Y) : |
| 2416 | new NativeDate(); |
| 2417 | } else { |
| 2418 | date = NativeDate.apply(this, arguments); |
| 2419 | } |
| 2420 | if (!isPrimitive(date)) { |
| 2421 | // Prevent mixups with unfixed Date object |
| 2422 | defineProperties(date, { constructor: DateShim }, true); |
| 2423 | } |
| 2424 | return date; |
| 2425 | }; |
| 2426 | |
| 2427 | // 15.9.1.15 Date Time String Format. |
| 2428 | var isoDateExpression = new RegExp('^' + |
| 2429 | '(\\d{4}|[+-]\\d{6})' + // four-digit year capture or sign + |
| 2430 | // 6-digit extended year |
| 2431 | '(?:-(\\d{2})' + // optional month capture |
| 2432 | '(?:-(\\d{2})' + // optional day capture |
| 2433 | '(?:' + // capture hours:minutes:seconds.milliseconds |
| 2434 | 'T(\\d{2})' + // hours capture |
| 2435 | ':(\\d{2})' + // minutes capture |
| 2436 | '(?:' + // optional :seconds.milliseconds |
| 2437 | ':(\\d{2})' + // seconds capture |
| 2438 | '(?:(\\.\\d{1,}))?' + // milliseconds capture |
| 2439 | ')?' + |
| 2440 | '(' + // capture UTC offset component |
| 2441 | 'Z|' + // UTC capture |
| 2442 | '(?:' + // offset specifier +/-hours:minutes |
| 2443 | '([-+])' + // sign capture |
| 2444 | '(\\d{2})' + // hours offset capture |
| 2445 | ':(\\d{2})' + // minutes offset capture |
| 2446 | ')' + |
| 2447 | ')?)?)?)?' + |
| 2448 | '$'); |
| 2449 | |
| 2450 | var months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365]; |
| 2451 | |
| 2452 | var dayFromMonth = function dayFromMonth(year, month) { |
| 2453 | var t = month > 1 ? 1 : 0; |
| 2454 | return ( |
| 2455 | months[month] + |
| 2456 | Math.floor((year - 1969 + t) / 4) - |
| 2457 | Math.floor((year - 1901 + t) / 100) + |
| 2458 | Math.floor((year - 1601 + t) / 400) + |
| 2459 | 365 * (year - 1970) |
| 2460 | ); |
| 2461 | }; |
| 2462 | |
| 2463 | var toUTC = function toUTC(t) { |
| 2464 | var s = 0; |
| 2465 | var ms = t; |
| 2466 | if (hasSafariSignedIntBug && ms > maxSafeUnsigned32Bit) { |
| 2467 | // work around a Safari 8/9 bug where it treats the seconds as signed |
| 2468 | var msToShift = Math.floor(ms / maxSafeUnsigned32Bit) * maxSafeUnsigned32Bit; |
| 2469 | var sToShift = Math.floor(msToShift / 1e3); |
| 2470 | s += sToShift; |
| 2471 | ms -= sToShift * 1e3; |
| 2472 | } |
| 2473 | return $Number(new NativeDate(1970, 0, 1, 0, 0, s, ms)); |
| 2474 | }; |
| 2475 | |
| 2476 | // Copy any custom methods a 3rd party library may have added |
| 2477 | for (var key in NativeDate) { |
| 2478 | if (owns(NativeDate, key)) { |
| 2479 | DateShim[key] = NativeDate[key]; |
| 2480 | } |
| 2481 | } |
| 2482 | |
| 2483 | // Copy "native" methods explicitly; they may be non-enumerable |
| 2484 | defineProperties(DateShim, { |
| 2485 | now: NativeDate.now, |
| 2486 | UTC: NativeDate.UTC |
| 2487 | }, true); |
| 2488 | DateShim.prototype = NativeDate.prototype; |
| 2489 | defineProperties(DateShim.prototype, { |
| 2490 | constructor: DateShim |
| 2491 | }, true); |
| 2492 | |
| 2493 | // Upgrade Date.parse to handle simplified ISO 8601 strings |
| 2494 | var parseShim = function parse(string) { |
| 2495 | var match = isoDateExpression.exec(string); |
| 2496 | if (match) { |
| 2497 | // parse months, days, hours, minutes, seconds, and milliseconds |
| 2498 | // provide default values if necessary |
| 2499 | // parse the UTC offset component |
| 2500 | var year = $Number(match[1]), |
| 2501 | month = $Number(match[2] || 1) - 1, |
| 2502 | day = $Number(match[3] || 1) - 1, |
| 2503 | hour = $Number(match[4] || 0), |
| 2504 | minute = $Number(match[5] || 0), |
| 2505 | second = $Number(match[6] || 0), |
| 2506 | millisecond = Math.floor($Number(match[7] || 0) * 1000), |
| 2507 | // When time zone is missed, local offset should be used |
| 2508 | // (ES 5.1 bug) |
| 2509 | // see https://bugs.ecmascript.org/show_bug.cgi?id=112 |
| 2510 | isLocalTime = Boolean(match[4] && !match[8]), |
| 2511 | signOffset = match[9] === '-' ? 1 : -1, |
| 2512 | hourOffset = $Number(match[10] || 0), |
| 2513 | minuteOffset = $Number(match[11] || 0), |
| 2514 | result; |
| 2515 | var hasMinutesOrSecondsOrMilliseconds = minute > 0 || second > 0 || millisecond > 0; |
| 2516 | if ( |
| 2517 | hour < (hasMinutesOrSecondsOrMilliseconds ? 24 : 25) && |
| 2518 | minute < 60 && second < 60 && millisecond < 1000 && |
| 2519 | month > -1 && month < 12 && hourOffset < 24 && |
| 2520 | minuteOffset < 60 && // detect invalid offsets |
| 2521 | day > -1 && |
| 2522 | day < (dayFromMonth(year, month + 1) - dayFromMonth(year, month)) |
| 2523 | ) { |
| 2524 | result = ( |
| 2525 | (dayFromMonth(year, month) + day) * 24 + |
| 2526 | hour + |
| 2527 | hourOffset * signOffset |
| 2528 | ) * 60; |
| 2529 | result = ( |
| 2530 | (result + minute + minuteOffset * signOffset) * 60 + |
| 2531 | second |
| 2532 | ) * 1000 + millisecond; |
| 2533 | if (isLocalTime) { |
| 2534 | result = toUTC(result); |
| 2535 | } |
| 2536 | if (-8.64e15 <= result && result <= 8.64e15) { |
| 2537 | return result; |
| 2538 | } |
| 2539 | } |
| 2540 | return NaN; |
| 2541 | } |
| 2542 | return NativeDate.parse.apply(this, arguments); |
| 2543 | }; |
| 2544 | defineProperties(DateShim, { parse: parseShim }); |
| 2545 | |
| 2546 | return DateShim; |
| 2547 | }(Date)); |
| 2548 | /* global Date: false */ |
| 2549 | } |
| 2550 | |
| 2551 | // ES5 15.9.4.4 |
| 2552 | // http://es5.github.com/#x15.9.4.4 |
| 2553 | if (!Date.now) { |
| 2554 | Date.now = function now() { |
| 2555 | return new Date().getTime(); |
| 2556 | }; |
| 2557 | } |
| 2558 | |
| 2559 | // |
| 2560 | // Number |
| 2561 | // ====== |
| 2562 | // |
| 2563 | |
| 2564 | // ES5.1 15.7.4.5 |
| 2565 | // http://es5.github.com/#x15.7.4.5 |
| 2566 | var hasToFixedBugs = NumberPrototype.toFixed && ( |
| 2567 | (0.00008).toFixed(3) !== '0.000' || |
| 2568 | (0.9).toFixed(0) !== '1' || |
| 2569 | (1.255).toFixed(2) !== '1.25' || |
| 2570 | (1000000000000000128).toFixed(0) !== '1000000000000000128' |
| 2571 | ); |
| 2572 | |
| 2573 | var toFixedHelpers = { |
| 2574 | base: 1e7, |
| 2575 | size: 6, |
| 2576 | data: [0, 0, 0, 0, 0, 0], |
| 2577 | multiply: function multiply(n, c) { |
| 2578 | var i = -1; |
| 2579 | var c2 = c; |
| 2580 | while (++i < toFixedHelpers.size) { |
| 2581 | c2 += n * toFixedHelpers.data[i]; |
| 2582 | toFixedHelpers.data[i] = c2 % toFixedHelpers.base; |
| 2583 | c2 = Math.floor(c2 / toFixedHelpers.base); |
| 2584 | } |
| 2585 | }, |
| 2586 | divide: function divide(n) { |
| 2587 | var i = toFixedHelpers.size; |
| 2588 | var c = 0; |
| 2589 | while (--i >= 0) { |
| 2590 | c += toFixedHelpers.data[i]; |
| 2591 | toFixedHelpers.data[i] = Math.floor(c / n); |
| 2592 | c = (c % n) * toFixedHelpers.base; |
| 2593 | } |
| 2594 | }, |
| 2595 | numToString: function numToString() { |
| 2596 | var i = toFixedHelpers.size; |
| 2597 | var s = ''; |
| 2598 | while (--i >= 0) { |
| 2599 | if (s !== '' || i === 0 || toFixedHelpers.data[i] !== 0) { |
| 2600 | var t = $String(toFixedHelpers.data[i]); |
| 2601 | if (s === '') { |
| 2602 | s = t; |
| 2603 | } else { |
| 2604 | s += strSlice('0000000', 0, 7 - t.length) + t; |
| 2605 | } |
| 2606 | } |
| 2607 | } |
| 2608 | return s; |
| 2609 | }, |
| 2610 | pow: function pow(x, n, acc) { |
| 2611 | return (n === 0 ? acc : (n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc))); |
| 2612 | }, |
| 2613 | log: function log(x) { |
| 2614 | var n = 0; |
| 2615 | var x2 = x; |
| 2616 | while (x2 >= 4096) { |
| 2617 | n += 12; |
| 2618 | x2 /= 4096; |
| 2619 | } |
| 2620 | while (x2 >= 2) { |
| 2621 | n += 1; |
| 2622 | x2 /= 2; |
| 2623 | } |
| 2624 | return n; |
| 2625 | } |
| 2626 | }; |
| 2627 | |
| 2628 | var toFixedShim = function toFixed(fractionDigits) { |
| 2629 | var f, x, s, m, e, z, j, k; |
| 2630 | |
| 2631 | // Test for NaN and round fractionDigits down |
| 2632 | f = $Number(fractionDigits); |
| 2633 | f = isActualNaN(f) ? 0 : Math.floor(f); |
| 2634 | |
| 2635 | if (f < 0 || f > 20) { |
| 2636 | throw new RangeError('Number.toFixed called with invalid number of decimals'); |
| 2637 | } |
| 2638 | |
| 2639 | x = $Number(this); |
| 2640 | |
| 2641 | if (isActualNaN(x)) { |
| 2642 | return 'NaN'; |
| 2643 | } |
| 2644 | |
| 2645 | // If it is too big or small, return the string value of the number |
| 2646 | if (x <= -1e21 || x >= 1e21) { |
| 2647 | return $String(x); |
| 2648 | } |
| 2649 | |
| 2650 | s = ''; |
| 2651 | |
| 2652 | if (x < 0) { |
| 2653 | s = '-'; |
| 2654 | x = -x; |
| 2655 | } |
| 2656 | |
| 2657 | m = '0'; |
| 2658 | |
| 2659 | if (x > 1e-21) { |
| 2660 | // 1e-21 < x < 1e21 |
| 2661 | // -70 < log2(x) < 70 |
| 2662 | e = toFixedHelpers.log(x * toFixedHelpers.pow(2, 69, 1)) - 69; |
| 2663 | z = (e < 0 ? x * toFixedHelpers.pow(2, -e, 1) : x / toFixedHelpers.pow(2, e, 1)); |
| 2664 | z *= 0x10000000000000; // Math.pow(2, 52); |
| 2665 | e = 52 - e; |
| 2666 | |
| 2667 | // -18 < e < 122 |
| 2668 | // x = z / 2 ^ e |
| 2669 | if (e > 0) { |
| 2670 | toFixedHelpers.multiply(0, z); |
| 2671 | j = f; |
| 2672 | |
| 2673 | while (j >= 7) { |
| 2674 | toFixedHelpers.multiply(1e7, 0); |
| 2675 | j -= 7; |
| 2676 | } |
| 2677 | |
| 2678 | toFixedHelpers.multiply(toFixedHelpers.pow(10, j, 1), 0); |
| 2679 | j = e - 1; |
| 2680 | |
| 2681 | while (j >= 23) { |
| 2682 | toFixedHelpers.divide(1 << 23); |
| 2683 | j -= 23; |
| 2684 | } |
| 2685 | |
| 2686 | toFixedHelpers.divide(1 << j); |
| 2687 | toFixedHelpers.multiply(1, 1); |
| 2688 | toFixedHelpers.divide(2); |
| 2689 | m = toFixedHelpers.numToString(); |
| 2690 | } else { |
| 2691 | toFixedHelpers.multiply(0, z); |
| 2692 | toFixedHelpers.multiply(1 << (-e), 0); |
| 2693 | m = toFixedHelpers.numToString() + strSlice('0.00000000000000000000', 2, 2 + f); |
| 2694 | } |
| 2695 | } |
| 2696 | |
| 2697 | if (f > 0) { |
| 2698 | k = m.length; |
| 2699 | |
| 2700 | if (k <= f) { |
| 2701 | m = s + strSlice('0.0000000000000000000', 0, f - k + 2) + m; |
| 2702 | } else { |
| 2703 | m = s + strSlice(m, 0, k - f) + '.' + strSlice(m, k - f); |
| 2704 | } |
| 2705 | } else { |
| 2706 | m = s + m; |
| 2707 | } |
| 2708 | |
| 2709 | return m; |
| 2710 | }; |
| 2711 | defineProperties(NumberPrototype, { toFixed: toFixedShim }, hasToFixedBugs); |
| 2712 | |
| 2713 | var hasToPrecisionUndefinedBug = (function () { |
| 2714 | try { |
| 2715 | return 1.0.toPrecision(undefined) === '1'; |
| 2716 | } catch (e) { |
| 2717 | return true; |
| 2718 | } |
| 2719 | }()); |
| 2720 | var originalToPrecision = NumberPrototype.toPrecision; |
| 2721 | defineProperties(NumberPrototype, { |
| 2722 | toPrecision: function toPrecision(precision) { |
| 2723 | return typeof precision === 'undefined' ? originalToPrecision.call(this) : originalToPrecision.call(this, precision); |
| 2724 | } |
| 2725 | }, hasToPrecisionUndefinedBug); |
| 2726 | |
| 2727 | // |
| 2728 | // String |
| 2729 | // ====== |
| 2730 | // |
| 2731 | |
| 2732 | // ES5 15.5.4.14 |
| 2733 | // http://es5.github.com/#x15.5.4.14 |
| 2734 | |
| 2735 | // [bugfix, IE lt 9, firefox 4, Konqueror, Opera, obscure browsers] |
| 2736 | // Many browsers do not split properly with regular expressions or they |
| 2737 | // do not perform the split correctly under obscure conditions. |
| 2738 | // See http://blog.stevenlevithan.com/archives/cross-browser-split |
| 2739 | // I've tested in many browsers and this seems to cover the deviant ones: |
| 2740 | // 'ab'.split(/(?:ab)*/) should be ["", ""], not [""] |
| 2741 | // '.'.split(/(.?)(.?)/) should be ["", ".", "", ""], not ["", ""] |
| 2742 | // 'tesst'.split(/(s)*/) should be ["t", undefined, "e", "s", "t"], not |
| 2743 | // [undefined, "t", undefined, "e", ...] |
| 2744 | // ''.split(/.?/) should be [], not [""] |
| 2745 | // '.'.split(/()()/) should be ["."], not ["", "", "."] |
| 2746 | |
| 2747 | if ( |
| 2748 | 'ab'.split(/(?:ab)*/).length !== 2 || |
| 2749 | '.'.split(/(.?)(.?)/).length !== 4 || |
| 2750 | 'tesst'.split(/(s)*/)[1] === 't' || |
| 2751 | 'test'.split(/(?:)/, -1).length !== 4 || |
| 2752 | ''.split(/.?/).length || |
| 2753 | '.'.split(/()()/).length > 1 |
| 2754 | ) { |
| 2755 | (function () { |
| 2756 | var compliantExecNpcg = typeof (/()??/).exec('')[1] === 'undefined'; // NPCG: nonparticipating capturing group |
| 2757 | var maxSafe32BitInt = Math.pow(2, 32) - 1; |
| 2758 | |
| 2759 | StringPrototype.split = function (separator, limit) { |
| 2760 | var string = String(this); |
| 2761 | if (typeof separator === 'undefined' && limit === 0) { |
| 2762 | return []; |
| 2763 | } |
| 2764 | |
| 2765 | // If `separator` is not a regex, use native split |
| 2766 | if (!isRegex(separator)) { |
| 2767 | return strSplit(this, separator, limit); |
| 2768 | } |
| 2769 | |
| 2770 | var output = []; |
| 2771 | var flags = (separator.ignoreCase ? 'i' : '') + |
| 2772 | (separator.multiline ? 'm' : '') + |
| 2773 | (separator.unicode ? 'u' : '') + // in ES6 |
| 2774 | (separator.sticky ? 'y' : ''), // Firefox 3+ and ES6 |
| 2775 | lastLastIndex = 0, |
| 2776 | // Make `global` and avoid `lastIndex` issues by working with a copy |
| 2777 | separator2, match, lastIndex, lastLength; |
| 2778 | var separatorCopy = new RegExp(separator.source, flags + 'g'); |
| 2779 | if (!compliantExecNpcg) { |
| 2780 | // Doesn't need flags gy, but they don't hurt |
| 2781 | separator2 = new RegExp('^' + separatorCopy.source + '$(?!\\s)', flags); |
| 2782 | } |
| 2783 | /* Values for `limit`, per the spec: |
| 2784 | * If undefined: 4294967295 // maxSafe32BitInt |
| 2785 | * If 0, Infinity, or NaN: 0 |
| 2786 | * If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296; |
| 2787 | * If negative number: 4294967296 - Math.floor(Math.abs(limit)) |
| 2788 | * If other: Type-convert, then use the above rules |
| 2789 | */ |
| 2790 | var splitLimit = typeof limit === 'undefined' ? maxSafe32BitInt : ES.ToUint32(limit); |
| 2791 | match = separatorCopy.exec(string); |
| 2792 | while (match) { |
| 2793 | // `separatorCopy.lastIndex` is not reliable cross-browser |
| 2794 | lastIndex = match.index + match[0].length; |
| 2795 | if (lastIndex > lastLastIndex) { |
| 2796 | pushCall(output, strSlice(string, lastLastIndex, match.index)); |
| 2797 | // Fix browsers whose `exec` methods don't consistently return `undefined` for |
| 2798 | // nonparticipating capturing groups |
| 2799 | if (!compliantExecNpcg && match.length > 1) { |
| 2800 | /* eslint-disable no-loop-func */ |
| 2801 | match[0].replace(separator2, function () { |
| 2802 | for (var i = 1; i < arguments.length - 2; i++) { |
| 2803 | if (typeof arguments[i] === 'undefined') { |
| 2804 | match[i] = void 0; |
| 2805 | } |
| 2806 | } |
| 2807 | }); |
| 2808 | /* eslint-enable no-loop-func */ |
| 2809 | } |
| 2810 | if (match.length > 1 && match.index < string.length) { |
| 2811 | array_push.apply(output, arraySlice(match, 1)); |
| 2812 | } |
| 2813 | lastLength = match[0].length; |
| 2814 | lastLastIndex = lastIndex; |
| 2815 | if (output.length >= splitLimit) { |
| 2816 | break; |
| 2817 | } |
| 2818 | } |
| 2819 | if (separatorCopy.lastIndex === match.index) { |
| 2820 | separatorCopy.lastIndex++; // Avoid an infinite loop |
| 2821 | } |
| 2822 | match = separatorCopy.exec(string); |
| 2823 | } |
| 2824 | if (lastLastIndex === string.length) { |
| 2825 | if (lastLength || !separatorCopy.test('')) { |
| 2826 | pushCall(output, ''); |
| 2827 | } |
| 2828 | } else { |
| 2829 | pushCall(output, strSlice(string, lastLastIndex)); |
| 2830 | } |
| 2831 | return output.length > splitLimit ? arraySlice(output, 0, splitLimit) : output; |
| 2832 | }; |
| 2833 | }()); |
| 2834 | |
| 2835 | // [bugfix, chrome] |
| 2836 | // If separator is undefined, then the result array contains just one String, |
| 2837 | // which is the this value (converted to a String). If limit is not undefined, |
| 2838 | // then the output array is truncated so that it contains no more than limit |
| 2839 | // elements. |
| 2840 | // "0".split(undefined, 0) -> [] |
| 2841 | } else if ('0'.split(void 0, 0).length) { |
| 2842 | StringPrototype.split = function split(separator, limit) { |
| 2843 | if (typeof separator === 'undefined' && limit === 0) { |
| 2844 | return []; |
| 2845 | } |
| 2846 | return strSplit(this, separator, limit); |
| 2847 | }; |
| 2848 | } |
| 2849 | |
| 2850 | var str_replace = StringPrototype.replace; |
| 2851 | var replaceReportsGroupsCorrectly = (function () { |
| 2852 | var groups = []; |
| 2853 | 'x'.replace(/x(.)?/g, function (match, group) { |
| 2854 | pushCall(groups, group); |
| 2855 | }); |
| 2856 | return groups.length === 1 && typeof groups[0] === 'undefined'; |
| 2857 | }()); |
| 2858 | |
| 2859 | if (!replaceReportsGroupsCorrectly) { |
| 2860 | StringPrototype.replace = function replace(searchValue, replaceValue) { |
| 2861 | var isFn = isCallable(replaceValue); |
| 2862 | var hasCapturingGroups = isRegex(searchValue) && (/\)[*?]/).test(searchValue.source); |
| 2863 | if (!isFn || !hasCapturingGroups) { |
| 2864 | return str_replace.call(this, searchValue, replaceValue); |
| 2865 | } else { |
| 2866 | var wrappedReplaceValue = function (match) { |
| 2867 | var length = arguments.length; |
| 2868 | var originalLastIndex = searchValue.lastIndex; |
| 2869 | searchValue.lastIndex = 0; |
| 2870 | var args = searchValue.exec(match) || []; |
| 2871 | searchValue.lastIndex = originalLastIndex; |
| 2872 | pushCall(args, arguments[length - 2], arguments[length - 1]); |
| 2873 | return replaceValue.apply(this, args); |
| 2874 | }; |
| 2875 | return str_replace.call(this, searchValue, wrappedReplaceValue); |
| 2876 | } |
| 2877 | }; |
| 2878 | } |
| 2879 | |
| 2880 | // ECMA-262, 3rd B.2.3 |
| 2881 | // Not an ECMAScript standard, although ECMAScript 3rd Edition has a |
| 2882 | // non-normative section suggesting uniform semantics and it should be |
| 2883 | // normalized across all browsers |
| 2884 | // [bugfix, IE lt 9] IE < 9 substr() with negative value not working in IE |
| 2885 | var string_substr = StringPrototype.substr; |
| 2886 | var hasNegativeSubstrBug = ''.substr && '0b'.substr(-1) !== 'b'; |
| 2887 | defineProperties(StringPrototype, { |
| 2888 | substr: function substr(start, length) { |
| 2889 | var normalizedStart = start; |
| 2890 | if (start < 0) { |
| 2891 | normalizedStart = max(this.length + start, 0); |
| 2892 | } |
| 2893 | return string_substr.call(this, normalizedStart, length); |
| 2894 | } |
| 2895 | }, hasNegativeSubstrBug); |
| 2896 | |
| 2897 | // ES5 15.5.4.20 |
| 2898 | // whitespace from: http://es5.github.io/#x15.5.4.20 |
| 2899 | var ws = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' + |
| 2900 | '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028' + |
| 2901 | '\u2029\uFEFF'; |
| 2902 | var zeroWidth = '\u200b'; |
| 2903 | var wsRegexChars = '[' + ws + ']'; |
| 2904 | var trimBeginRegexp = new RegExp('^' + wsRegexChars + wsRegexChars + '*'); |
| 2905 | var trimEndRegexp = new RegExp(wsRegexChars + wsRegexChars + '*$'); |
| 2906 | var hasTrimWhitespaceBug = StringPrototype.trim && (ws.trim() || !zeroWidth.trim()); |
| 2907 | defineProperties(StringPrototype, { |
| 2908 | // http://blog.stevenlevithan.com/archives/faster-trim-javascript |
| 2909 | // http://perfectionkills.com/whitespace-deviations/ |
| 2910 | trim: function trim() { |
| 2911 | if (typeof this === 'undefined' || this === null) { |
| 2912 | throw new TypeError("can't convert " + this + ' to object'); |
| 2913 | } |
| 2914 | return $String(this).replace(trimBeginRegexp, '').replace(trimEndRegexp, ''); |
| 2915 | } |
| 2916 | }, hasTrimWhitespaceBug); |
| 2917 | var trim = call.bind(String.prototype.trim); |
| 2918 | |
| 2919 | var hasLastIndexBug = StringPrototype.lastIndexOf && 'abcあい'.lastIndexOf('あい', 2) !== -1; |
| 2920 | defineProperties(StringPrototype, { |
| 2921 | lastIndexOf: function lastIndexOf(searchString) { |
| 2922 | if (typeof this === 'undefined' || this === null) { |
| 2923 | throw new TypeError("can't convert " + this + ' to object'); |
| 2924 | } |
| 2925 | var S = $String(this); |
| 2926 | var searchStr = $String(searchString); |
| 2927 | var numPos = arguments.length > 1 ? $Number(arguments[1]) : NaN; |
| 2928 | var pos = isActualNaN(numPos) ? Infinity : ES.ToInteger(numPos); |
| 2929 | var start = min(max(pos, 0), S.length); |
| 2930 | var searchLen = searchStr.length; |
| 2931 | var k = start + searchLen; |
| 2932 | while (k > 0) { |
| 2933 | k = max(0, k - searchLen); |
| 2934 | var index = strIndexOf(strSlice(S, k, start + searchLen), searchStr); |
| 2935 | if (index !== -1) { |
| 2936 | return k + index; |
| 2937 | } |
| 2938 | } |
| 2939 | return -1; |
| 2940 | } |
| 2941 | }, hasLastIndexBug); |
| 2942 | |
| 2943 | var originalLastIndexOf = StringPrototype.lastIndexOf; |
| 2944 | defineProperties(StringPrototype, { |
| 2945 | lastIndexOf: function lastIndexOf(searchString) { |
| 2946 | return originalLastIndexOf.apply(this, arguments); |
| 2947 | } |
| 2948 | }, StringPrototype.lastIndexOf.length !== 1); |
| 2949 | |
| 2950 | // ES-5 15.1.2.2 |
| 2951 | /* eslint-disable radix */ |
| 2952 | if (parseInt(ws + '08') !== 8 || parseInt(ws + '0x16') !== 22) { |
| 2953 | /* eslint-enable radix */ |
| 2954 | /* global parseInt: true */ |
| 2955 | parseInt = (function (origParseInt) { |
| 2956 | var hexRegex = /^[\-+]?0[xX]/; |
| 2957 | return function parseInt(str, radix) { |
| 2958 | var string = trim(String(str)); |
| 2959 | var defaultedRadix = $Number(radix) || (hexRegex.test(string) ? 16 : 10); |
| 2960 | return origParseInt(string, defaultedRadix); |
| 2961 | }; |
| 2962 | }(parseInt)); |
| 2963 | } |
| 2964 | |
| 2965 | // https://es5.github.io/#x15.1.2.3 |
| 2966 | if (1 / parseFloat('-0') !== -Infinity) { |
| 2967 | /* global parseFloat: true */ |
| 2968 | parseFloat = (function (origParseFloat) { |
| 2969 | return function parseFloat(string) { |
| 2970 | var inputString = trim(String(string)); |
| 2971 | var result = origParseFloat(inputString); |
| 2972 | return result === 0 && strSlice(inputString, 0, 1) === '-' ? -0 : result; |
| 2973 | }; |
| 2974 | }(parseFloat)); |
| 2975 | } |
| 2976 | |
| 2977 | if (String(new RangeError('test')) !== 'RangeError: test') { |
| 2978 | var errorToStringShim = function toString() { |
| 2979 | if (typeof this === 'undefined' || this === null) { |
| 2980 | throw new TypeError("can't convert " + this + ' to object'); |
| 2981 | } |
| 2982 | var name = this.name; |
| 2983 | if (typeof name === 'undefined') { |
| 2984 | name = 'Error'; |
| 2985 | } else if (typeof name !== 'string') { |
| 2986 | name = $String(name); |
| 2987 | } |
| 2988 | var msg = this.message; |
| 2989 | if (typeof msg === 'undefined') { |
| 2990 | msg = ''; |
| 2991 | } else if (typeof msg !== 'string') { |
| 2992 | msg = $String(msg); |
| 2993 | } |
| 2994 | if (!name) { |
| 2995 | return msg; |
| 2996 | } |
| 2997 | if (!msg) { |
| 2998 | return name; |
| 2999 | } |
| 3000 | return name + ': ' + msg; |
| 3001 | }; |
| 3002 | // can't use defineProperties here because of toString enumeration issue in IE <= 8 |
| 3003 | Error.prototype.toString = errorToStringShim; |
| 3004 | } |
| 3005 | |
| 3006 | if (supportsDescriptors) { |
| 3007 | var ensureNonEnumerable = function (obj, prop) { |
| 3008 | if (isEnum(obj, prop)) { |
| 3009 | var desc = Object.getOwnPropertyDescriptor(obj, prop); |
| 3010 | if (desc.configurable) { |
| 3011 | desc.enumerable = false; |
| 3012 | Object.defineProperty(obj, prop, desc); |
| 3013 | } |
| 3014 | } |
| 3015 | }; |
| 3016 | ensureNonEnumerable(Error.prototype, 'message'); |
| 3017 | if (Error.prototype.message !== '') { |
| 3018 | Error.prototype.message = ''; |
| 3019 | } |
| 3020 | ensureNonEnumerable(Error.prototype, 'name'); |
| 3021 | } |
| 3022 | |
| 3023 | if (String(/a/mig) !== '/a/gim') { |
| 3024 | var regexToString = function toString() { |
| 3025 | var str = '/' + this.source + '/'; |
| 3026 | if (this.global) { |
| 3027 | str += 'g'; |
| 3028 | } |
| 3029 | if (this.ignoreCase) { |
| 3030 | str += 'i'; |
| 3031 | } |
| 3032 | if (this.multiline) { |
| 3033 | str += 'm'; |
| 3034 | } |
| 3035 | return str; |
| 3036 | }; |
| 3037 | // can't use defineProperties here because of toString enumeration issue in IE <= 8 |
| 3038 | RegExp.prototype.toString = regexToString; |
| 3039 | } |
| 3040 | })); |
| 3041 | |
| 3042 | 'use strict'; |
| 3043 | /*jslint eqeq: true*/ |
| 3044 | |
| 3045 | Handlebars.registerHelper('sanitize', function (text) { |
| 3046 | var result; |
| 3047 | |
| 3048 | if (text === undefined) { return ''; } |
| 3049 | |
| 3050 | result = sanitizeHtml(text, { |
| 3051 | allowedTags: [ 'div', 'span', 'b', 'i', 'em', 'strong', 'a' ], |
| 3052 | allowedAttributes: { |
| 3053 | 'div': [ 'class' ], |
| 3054 | 'span': [ 'class' ], |
| 3055 | 'a': [ 'href' ] |
| 3056 | } |
| 3057 | }); |
| 3058 | |
| 3059 | return new Handlebars.SafeString(result); |
| 3060 | }); |
| 3061 | |
| 3062 | Handlebars.registerHelper('renderTextParam', function(param) { |
| 3063 | var result, type = 'text', idAtt = ''; |
| 3064 | var paramType = param.type || param.schema && param.schema.type || ''; |
| 3065 | var isArray = paramType.toLowerCase() === 'array' || param.allowMultiple; |
| 3066 | var defaultValue = isArray && Array.isArray(param.default) ? param.default.join('\n') : param.default; |
| 3067 | var name = Handlebars.Utils.escapeExpression(param.name); |
| 3068 | var valueId = Handlebars.Utils.escapeExpression(param.valueId); |
| 3069 | paramType = Handlebars.Utils.escapeExpression(paramType); |
| 3070 | |
| 3071 | var dataVendorExtensions = Object.keys(param).filter(function(property) { |
| 3072 | // filter X-data- properties |
| 3073 | return property.match(/^X-data-/i) !== null; |
| 3074 | }).reduce(function(result, property) { |
| 3075 | // remove X- from property name, so it results in html attributes like data-foo='bar' |
| 3076 | return result += ' ' + property.substring(2, property.length) + '=\'' + param[property] + '\''; |
| 3077 | }, ''); |
| 3078 | |
| 3079 | if(param.format && param.format === 'password') { |
| 3080 | type = 'password'; |
| 3081 | } |
| 3082 | |
| 3083 | if(valueId) { |
| 3084 | idAtt = ' id=\'' + valueId + '\''; |
| 3085 | } |
| 3086 | |
| 3087 | if (defaultValue) { |
| 3088 | defaultValue = sanitizeHtml(defaultValue); |
| 3089 | } else { |
| 3090 | defaultValue = ''; |
| 3091 | } |
| 3092 | |
| 3093 | if(isArray) { |
| 3094 | result = '<textarea class=\'body-textarea' + (param.required ? ' required' : '') + '\' name=\'' + name + '\'' + idAtt + dataVendorExtensions; |
| 3095 | result += ' placeholder=\'Provide multiple values in new lines' + (param.required ? ' (at least one required).' : '.') + '\'>'; |
| 3096 | result += defaultValue + '</textarea>'; |
| 3097 | } else { |
| 3098 | var parameterClass = 'parameter'; |
| 3099 | if(param.required) { |
| 3100 | parameterClass += ' required'; |
| 3101 | } |
| 3102 | result = '<input class=\'' + parameterClass + '\' minlength=\'' + (param.required ? 1 : 0) + '\''; |
| 3103 | result += ' name=\'' + name +'\' placeholder=\'' + (param.required ? '(required)' : '') + '\'' + idAtt + dataVendorExtensions; |
| 3104 | result += ' type=\'' + type + '\' value=\'' + defaultValue + '\'/>'; |
| 3105 | } |
| 3106 | return new Handlebars.SafeString(result); |
| 3107 | }); |
| 3108 | |
| 3109 | Handlebars.registerHelper('ifCond', function (v1, operator, v2, options) { |
| 3110 | |
| 3111 | switch (operator) { |
| 3112 | case '==': |
| 3113 | return (v1 == v2) ? options.fn(this) : options.inverse(this); |
| 3114 | case '===': |
| 3115 | return (v1 === v2) ? options.fn(this) : options.inverse(this); |
| 3116 | case '<': |
| 3117 | return (v1 < v2) ? options.fn(this) : options.inverse(this); |
| 3118 | case '<=': |
| 3119 | return (v1 <= v2) ? options.fn(this) : options.inverse(this); |
| 3120 | case '>': |
| 3121 | return (v1 > v2) ? options.fn(this) : options.inverse(this); |
| 3122 | case '>=': |
| 3123 | return (v1 >= v2) ? options.fn(this) : options.inverse(this); |
| 3124 | case '&&': |
| 3125 | return (v1 && v2) ? options.fn(this) : options.inverse(this); |
| 3126 | case '||': |
| 3127 | return (v1 || v2) ? options.fn(this) : options.inverse(this); |
| 3128 | default: |
| 3129 | return options.inverse(this); |
| 3130 | } |
| 3131 | }); |
| 3132 | |
| 3133 | Handlebars.registerHelper('escape', function (value) { |
| 3134 | var text = Handlebars.Utils.escapeExpression(value); |
| 3135 | |
| 3136 | return new Handlebars.SafeString(text); |
| 3137 | }); |
| 3138 | |
| 3139 | (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.sanitizeHtml=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){var htmlparser=require("htmlparser2");var extend=require("xtend");var quoteRegexp=require("regexp-quote");function each(obj,cb){if(obj)Object.keys(obj).forEach(function(key){cb(obj[key],key)})}function has(obj,key){return{}.hasOwnProperty.call(obj,key)}module.exports=sanitizeHtml;function sanitizeHtml(html,options,_recursing){var result="";function Frame(tag,attribs){var that=this;this.tag=tag;this.attribs=attribs||{};this.tagPosition=result.length;this.text="";this.updateParentNodeText=function(){if(stack.length){var parentFrame=stack[stack.length-1];parentFrame.text+=that.text}}}if(!options){options=sanitizeHtml.defaults;options.parser=htmlParserDefaults}else{options=extend(sanitizeHtml.defaults,options);if(options.parser){options.parser=extend(htmlParserDefaults,options.parser)}else{options.parser=htmlParserDefaults}}var nonTextTagsArray=options.nonTextTags||["script","style","textarea"];var allowedAttributesMap;var allowedAttributesGlobMap;if(options.allowedAttributes){allowedAttributesMap={};allowedAttributesGlobMap={};each(options.allowedAttributes,function(attributes,tag){allowedAttributesMap[tag]=[];var globRegex=[];attributes.forEach(function(name){if(name.indexOf("*")>=0){globRegex.push(quoteRegexp(name).replace(/\\\*/g,".*"))}else{allowedAttributesMap[tag].push(name)}});allowedAttributesGlobMap[tag]=new RegExp("^("+globRegex.join("|")+")$")})}var allowedClassesMap={};each(options.allowedClasses,function(classes,tag){if(allowedAttributesMap){if(!has(allowedAttributesMap,tag)){allowedAttributesMap[tag]=[]}allowedAttributesMap[tag].push("class")}allowedClassesMap[tag]=classes});var transformTagsMap={};var transformTagsAll;each(options.transformTags,function(transform,tag){var transFun;if(typeof transform==="function"){transFun=transform}else if(typeof transform==="string"){transFun=sanitizeHtml.simpleTransform(transform)}if(tag==="*"){transformTagsAll=transFun}else{transformTagsMap[tag]=transFun}});var depth=0;var stack=[];var skipMap={};var transformMap={};var skipText=false;var skipTextDepth=0;var parser=new htmlparser.Parser({onopentag:function(name,attribs){if(skipText){skipTextDepth++;return}var frame=new Frame(name,attribs);stack.push(frame);var skip=false;var hasText=frame.text?true:false;var transformedTag;if(has(transformTagsMap,name)){transformedTag=transformTagsMap[name](name,attribs);frame.attribs=attribs=transformedTag.attribs;if(transformedTag.text!==undefined){frame.innerText=transformedTag.text}if(name!==transformedTag.tagName){frame.name=name=transformedTag.tagName;transformMap[depth]=transformedTag.tagName}}if(transformTagsAll){transformedTag=transformTagsAll(name,attribs);frame.attribs=attribs=transformedTag.attribs;if(name!==transformedTag.tagName){frame.name=name=transformedTag.tagName;transformMap[depth]=transformedTag.tagName}}if(options.allowedTags&&options.allowedTags.indexOf(name)===-1){skip=true;if(nonTextTagsArray.indexOf(name)!==-1){skipText=true;skipTextDepth=1}skipMap[depth]=true}depth++;if(skip){return}result+="<"+name;if(!allowedAttributesMap||has(allowedAttributesMap,name)||allowedAttributesMap["*"]){each(attribs,function(value,a){if(!allowedAttributesMap||has(allowedAttributesMap,name)&&allowedAttributesMap[name].indexOf(a)!==-1||allowedAttributesMap["*"]&&allowedAttributesMap["*"].indexOf(a)!==-1||has(allowedAttributesGlobMap,name)&&allowedAttributesGlobMap[name].test(a)||allowedAttributesGlobMap["*"]&&allowedAttributesGlobMap["*"].test(a)){if(a==="href"||a==="src"){if(naughtyHref(name,value)){delete frame.attribs[a];return}}if(a==="class"){value=filterClasses(value,allowedClassesMap[name]);if(!value.length){delete frame.attribs[a];return}}result+=" "+a;if(value.length){result+='="'+escapeHtml(value)+'"'}}else{delete frame.attribs[a]}})}if(options.selfClosing.indexOf(name)!==-1){result+=" />"}else{result+=">";if(frame.innerText&&!hasText&&!options.textFilter){result+=frame.innerText}}},ontext:function(text){if(skipText){return}var lastFrame=stack[stack.length-1];var tag;if(lastFrame){tag=lastFrame.tag;text=lastFrame.innerText!==undefined?lastFrame.innerText:text}if(tag==="script"||tag==="style"){result+=text}else{var escaped=escapeHtml(text);if(options.textFilter){result+=options.textFilter(escaped)}else{result+=escaped}}if(stack.length){var frame=stack[stack.length-1];frame.text+=text}},onclosetag:function(name){if(skipText){skipTextDepth--;if(!skipTextDepth){skipText=false}else{return}}var frame=stack.pop();if(!frame){return}skipText=false;depth--;if(skipMap[depth]){delete skipMap[depth];frame.updateParentNodeText();return}if(transformMap[depth]){name=transformMap[depth];delete transformMap[depth]}if(options.exclusiveFilter&&options.exclusiveFilter(frame)){result=result.substr(0,frame.tagPosition);return}frame.updateParentNodeText();if(options.selfClosing.indexOf(name)!==-1){return}result+="</"+name+">"}},options.parser);parser.write(html);parser.end();return result;function escapeHtml(s){if(typeof s!=="string"){s=s+""}return s.replace(/\&/g,"&").replace(/</g,"<").replace(/\>/g,">").replace(/\"/g,""")}function naughtyHref(name,href){href=href.replace(/[\x00-\x20]+/g,"");href=href.replace(/<\!\-\-.*?\-\-\>/g,"");var matches=href.match(/^([a-zA-Z]+)\:/);if(!matches){return false}var scheme=matches[1].toLowerCase();if(has(options.allowedSchemesByTag,name)){return options.allowedSchemesByTag[name].indexOf(scheme)===-1}return!options.allowedSchemes||options.allowedSchemes.indexOf(scheme)===-1}function filterClasses(classes,allowed){if(!allowed){return classes}classes=classes.split(/\s+/);return classes.filter(function(clss){return allowed.indexOf(clss)!==-1}).join(" ")}}var htmlParserDefaults={decodeEntities:true};sanitizeHtml.defaults={allowedTags:["h3","h4","h5","h6","blockquote","p","a","ul","ol","nl","li","b","i","strong","em","strike","code","hr","br","div","table","thead","caption","tbody","tr","th","td","pre"],allowedAttributes:{a:["href","name","target"],img:["src"]},selfClosing:["img","br","hr","area","base","basefont","input","link","meta"],allowedSchemes:["http","https","ftp","mailto"],allowedSchemesByTag:{}};sanitizeHtml.simpleTransform=function(newTagName,newAttribs,merge){merge=merge===undefined?true:merge;newAttribs=newAttribs||{};return function(tagName,attribs){var attrib;if(merge){for(attrib in newAttribs){attribs[attrib]=newAttribs[attrib]}}else{attribs=newAttribs}return{tagName:newTagName,attribs:attribs}}}},{htmlparser2:36,"regexp-quote":54,xtend:58}],2:[function(require,module,exports){"use strict";exports.toByteArray=toByteArray;exports.fromByteArray=fromByteArray;var lookup=[];var revLookup=[];var Arr=typeof Uint8Array!=="undefined"?Uint8Array:Array;function init(){var code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i=0,len=code.length;i<len;++i){lookup[i]=code[i];revLookup[code.charCodeAt(i)]=i}revLookup["-".charCodeAt(0)]=62;revLookup["_".charCodeAt(0)]=63}init();function toByteArray(b64){var i,j,l,tmp,placeHolders,arr;var len=b64.length;if(len%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}placeHolders=b64[len-2]==="="?2:b64[len-1]==="="?1:0;arr=new Arr(len*3/4-placeHolders);l=placeHolders>0?len-4:len;var L=0;for(i=0,j=0;i<l;i+=4,j+=3){tmp=revLookup[b64.charCodeAt(i)]<<18|revLookup[b64.charCodeAt(i+1)]<<12|revLookup[b64.charCodeAt(i+2)]<<6|revLookup[b64.charCodeAt(i+3)];arr[L++]=tmp>>16&255;arr[L++]=tmp>>8&255;arr[L++]=tmp&255}if(placeHolders===2){tmp=revLookup[b64.charCodeAt(i)]<<2|revLookup[b64.charCodeAt(i+1)]>>4;arr[L++]=tmp&255}else if(placeHolders===1){tmp=revLookup[b64.charCodeAt(i)]<<10|revLookup[b64.charCodeAt(i+1)]<<4|revLookup[b64.charCodeAt(i+2)]>>2;arr[L++]=tmp>>8&255;arr[L++]=tmp&255}return arr}function tripletToBase64(num){return lookup[num>>18&63]+lookup[num>>12&63]+lookup[num>>6&63]+lookup[num&63]}function encodeChunk(uint8,start,end){var tmp;var output=[];for(var i=start;i<end;i+=3){tmp=(uint8[i]<<16)+(uint8[i+1]<<8)+uint8[i+2];output.push(tripletToBase64(tmp))}return output.join("")}function fromByteArray(uint8){var tmp;var len=uint8.length;var extraBytes=len%3;var output="";var parts=[];var maxChunkLength=16383;for(var i=0,len2=len-extraBytes;i<len2;i+=maxChunkLength){parts.push(encodeChunk(uint8,i,i+maxChunkLength>len2?len2:i+maxChunkLength))}if(extraBytes===1){tmp=uint8[len-1];output+=lookup[tmp>>2];output+=lookup[tmp<<4&63];output+="=="}else if(extraBytes===2){tmp=(uint8[len-2]<<8)+uint8[len-1];output+=lookup[tmp>>10];output+=lookup[tmp>>4&63];output+=lookup[tmp<<2&63];output+="="}parts.push(output);return parts.join("")}},{}],3:[function(require,module,exports){},{}],4:[function(require,module,exports){(function(global){"use strict";var buffer=require("buffer");var Buffer=buffer.Buffer;var SlowBuffer=buffer.SlowBuffer;var MAX_LEN=buffer.kMaxLength||2147483647;exports.alloc=function alloc(size,fill,encoding){if(typeof Buffer.alloc==="function"){return Buffer.alloc(size,fill,encoding)}if(typeof encoding==="number"){throw new TypeError("encoding must not be number")}if(typeof size!=="number"){throw new TypeError("size must be a number")}if(size>MAX_LEN){throw new RangeError("size is too large")}var enc=encoding;var _fill=fill;if(_fill===undefined){enc=undefined;_fill=0}var buf=new Buffer(size);if(typeof _fill==="string"){var fillBuf=new Buffer(_fill,enc);var flen=fillBuf.length;var i=-1;while(++i<size){buf[i]=fillBuf[i%flen]}}else{buf.fill(_fill)}return buf};exports.allocUnsafe=function allocUnsafe(size){if(typeof Buffer.allocUnsafe==="function"){return Buffer.allocUnsafe(size)}if(typeof size!=="number"){throw new TypeError("size must be a number")}if(size>MAX_LEN){throw new RangeError("size is too large")}return new Buffer(size)};exports.from=function from(value,encodingOrOffset,length){if(typeof Buffer.from==="function"&&(!global.Uint8Array||Uint8Array.from!==Buffer.from)){return Buffer.from(value,encodingOrOffset,length)}if(typeof value==="number"){throw new TypeError('"value" argument must not be a number')}if(typeof value==="string"){return new Buffer(value,encodingOrOffset)}if(typeof ArrayBuffer!=="undefined"&&value instanceof ArrayBuffer){var offset=encodingOrOffset;if(arguments.length===1){return new Buffer(value)}if(typeof offset==="undefined"){offset=0}var len=length;if(typeof len==="undefined"){len=value.byteLength-offset}if(offset>=value.byteLength){throw new RangeError("'offset' is out of bounds")}if(len>value.byteLength-offset){throw new RangeError("'length' is out of bounds")}return new Buffer(value.slice(offset,offset+len))}if(Buffer.isBuffer(value)){var out=new Buffer(value.length);value.copy(out,0,0,value.length);return out}if(value){if(Array.isArray(value)||typeof ArrayBuffer!=="undefined"&&value.buffer instanceof ArrayBuffer||"length"in value){return new Buffer(value)}if(value.type==="Buffer"&&Array.isArray(value.data)){return new Buffer(value.data)}}throw new TypeError("First argument must be a string, Buffer, "+"ArrayBuffer, Array, or array-like object.")};exports.allocUnsafeSlow=function allocUnsafeSlow(size){if(typeof Buffer.allocUnsafeSlow==="function"){return Buffer.allocUnsafeSlow(size)}if(typeof size!=="number"){throw new TypeError("size must be a number")}if(size>=MAX_LEN){throw new RangeError("size is too large")}return new SlowBuffer(size)}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{buffer:5}],5:[function(require,module,exports){(function(global){"use strict";var base64=require("base64-js");var ieee754=require("ieee754");var isArray=require("isarray");exports.Buffer=Buffer;exports.SlowBuffer=SlowBuffer;exports.INSPECT_MAX_BYTES=50;Buffer.TYPED_ARRAY_SUPPORT=global.TYPED_ARRAY_SUPPORT!==undefined?global.TYPED_ARRAY_SUPPORT:typedArraySupport();exports.kMaxLength=kMaxLength();function typedArraySupport(){try{var arr=new Uint8Array(1);arr.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}};return arr.foo()===42&&typeof arr.subarray==="function"&&arr.subarray(1,1).byteLength===0}catch(e){return false}}function kMaxLength(){return Buffer.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function createBuffer(that,length){if(kMaxLength()<length){throw new RangeError("Invalid typed array length")}if(Buffer.TYPED_ARRAY_SUPPORT){that=new Uint8Array(length);that.__proto__=Buffer.prototype}else{if(that===null){that=new Buffer(length)}that.length=length}return that}function Buffer(arg,encodingOrOffset,length){if(!Buffer.TYPED_ARRAY_SUPPORT&&!(this instanceof Buffer)){return new Buffer(arg,encodingOrOffset,length)}if(typeof arg==="number"){if(typeof encodingOrOffset==="string"){throw new Error("If encoding is specified then the first argument must be a string")}return allocUnsafe(this,arg)}return from(this,arg,encodingOrOffset,length)}Buffer.poolSize=8192;Buffer._augment=function(arr){arr.__proto__=Buffer.prototype;return arr};function from(that,value,encodingOrOffset,length){if(typeof value==="number"){throw new TypeError('"value" argument must not be a number')}if(typeof ArrayBuffer!=="undefined"&&value instanceof ArrayBuffer){return fromArrayBuffer(that,value,encodingOrOffset,length)}if(typeof value==="string"){return fromString(that,value,encodingOrOffset)}return fromObject(that,value)}Buffer.from=function(value,encodingOrOffset,length){return from(null,value,encodingOrOffset,length)};if(Buffer.TYPED_ARRAY_SUPPORT){Buffer.prototype.__proto__=Uint8Array.prototype;Buffer.__proto__=Uint8Array;if(typeof Symbol!=="undefined"&&Symbol.species&&Buffer[Symbol.species]===Buffer){Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:true})}}function assertSize(size){if(typeof size!=="number"){throw new TypeError('"size" argument must be a number')}else if(size<0){throw new RangeError('"size" argument must not be negative')}}function alloc(that,size,fill,encoding){assertSize(size);if(size<=0){return createBuffer(that,size)}if(fill!==undefined){return typeof encoding==="string"?createBuffer(that,size).fill(fill,encoding):createBuffer(that,size).fill(fill)}return createBuffer(that,size)}Buffer.alloc=function(size,fill,encoding){return alloc(null,size,fill,encoding)};function allocUnsafe(that,size){assertSize(size);that=createBuffer(that,size<0?0:checked(size)|0);if(!Buffer.TYPED_ARRAY_SUPPORT){for(var i=0;i<size;++i){that[i]=0}}return that}Buffer.allocUnsafe=function(size){return allocUnsafe(null,size)};Buffer.allocUnsafeSlow=function(size){return allocUnsafe(null,size)};function fromString(that,string,encoding){if(typeof encoding!=="string"||encoding===""){encoding="utf8"}if(!Buffer.isEncoding(encoding)){throw new TypeError('"encoding" must be a valid string encoding')}var length=byteLength(string,encoding)|0;that=createBuffer(that,length);var actual=that.write(string,encoding);if(actual!==length){that=that.slice(0,actual)}return that}function fromArrayLike(that,array){var length=array.length<0?0:checked(array.length)|0;that=createBuffer(that,length);for(var i=0;i<length;i+=1){that[i]=array[i]&255}return that}function fromArrayBuffer(that,array,byteOffset,length){array.byteLength;if(byteOffset<0||array.byteLength<byteOffset){throw new RangeError("'offset' is out of bounds")}if(array.byteLength<byteOffset+(length||0)){throw new RangeError("'length' is out of bounds")}if(byteOffset===undefined&&length===undefined){array=new Uint8Array(array)}else if(length===undefined){array=new Uint8Array(array,byteOffset)}else{array=new Uint8Array(array,byteOffset,length)}if(Buffer.TYPED_ARRAY_SUPPORT){that=array;that.__proto__=Buffer.prototype}else{that=fromArrayLike(that,array)}return that}function fromObject(that,obj){if(Buffer.isBuffer(obj)){var len=checked(obj.length)|0;that=createBuffer(that,len);if(that.length===0){return that}obj.copy(that,0,0,len);return that}if(obj){if(typeof ArrayBuffer!=="undefined"&&obj.buffer instanceof ArrayBuffer||"length"in obj){if(typeof obj.length!=="number"||isnan(obj.length)){return createBuffer(that,0)}return fromArrayLike(that,obj)}if(obj.type==="Buffer"&&isArray(obj.data)){return fromArrayLike(that,obj.data)}}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function checked(length){if(length>=kMaxLength()){throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+kMaxLength().toString(16)+" bytes")}return length|0}function SlowBuffer(length){if(+length!=length){length=0}return Buffer.alloc(+length)}Buffer.isBuffer=function isBuffer(b){return!!(b!=null&&b._isBuffer)};Buffer.compare=function compare(a,b){if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b)){throw new TypeError("Arguments must be Buffers")}if(a===b)return 0;var x=a.length;var y=b.length;for(var i=0,len=Math.min(x,y);i<len;++i){if(a[i]!==b[i]){x=a[i];y=b[i];break}}if(x<y)return-1;if(y<x)return 1;return 0};Buffer.isEncoding=function isEncoding(encoding){switch(String(encoding).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return true;default:return false}};Buffer.concat=function concat(list,length){if(!isArray(list)){throw new TypeError('"list" argument must be an Array of Buffers')}if(list.length===0){return Buffer.alloc(0)}var i;if(length===undefined){length=0;for(i=0;i<list.length;++i){length+=list[i].length}}var buffer=Buffer.allocUnsafe(length);var pos=0;for(i=0;i<list.length;++i){var buf=list[i];if(!Buffer.isBuffer(buf)){throw new TypeError('"list" argument must be an Array of Buffers')}buf.copy(buffer,pos);pos+=buf.length}return buffer};function byteLength(string,encoding){if(Buffer.isBuffer(string)){return string.length}if(typeof ArrayBuffer!=="undefined"&&typeof ArrayBuffer.isView==="function"&&(ArrayBuffer.isView(string)||string instanceof ArrayBuffer)){return string.byteLength}if(typeof string!=="string"){string=""+string}var len=string.length;if(len===0)return 0;var loweredCase=false;for(;;){switch(encoding){case"ascii":case"latin1":case"binary":return len;case"utf8":case"utf-8":case undefined:return utf8ToBytes(string).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return len*2;case"hex":return len>>>1;case"base64":return base64ToBytes(string).length;default:if(loweredCase)return utf8ToBytes(string).length;encoding=(""+encoding).toLowerCase();loweredCase=true}}}Buffer.byteLength=byteLength;function slowToString(encoding,start,end){var loweredCase=false;if(start===undefined||start<0){start=0}if(start>this.length){return""}if(end===undefined||end>this.length){end=this.length}if(end<=0){return""}end>>>=0;start>>>=0;if(end<=start){return""}if(!encoding)encoding="utf8";while(true){switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"latin1":case"binary":return latin1Slice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase();loweredCase=true}}}Buffer.prototype._isBuffer=true;function swap(b,n,m){var i=b[n];b[n]=b[m];b[m]=i}Buffer.prototype.swap16=function swap16(){var len=this.length;if(len%2!==0){throw new RangeError("Buffer size must be a multiple of 16-bits")}for(var i=0;i<len;i+=2){swap(this,i,i+1)}return this};Buffer.prototype.swap32=function swap32(){var len=this.length;if(len%4!==0){throw new RangeError("Buffer size must be a multiple of 32-bits")}for(var i=0;i<len;i+=4){swap(this,i,i+3);swap(this,i+1,i+2)}return this};Buffer.prototype.swap64=function swap64(){var len=this.length;if(len%8!==0){throw new RangeError("Buffer size must be a multiple of 64-bits")}for(var i=0;i<len;i+=8){swap(this,i,i+7);swap(this,i+1,i+6);swap(this,i+2,i+5);swap(this,i+3,i+4)}return this};Buffer.prototype.toString=function toString(){var length=this.length|0;if(length===0)return"";if(arguments.length===0)return utf8Slice(this,0,length);return slowToString.apply(this,arguments)};Buffer.prototype.equals=function equals(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");if(this===b)return true;return Buffer.compare(this,b)===0};Buffer.prototype.inspect=function inspect(){var str="";var max=exports.INSPECT_MAX_BYTES;if(this.length>0){str=this.toString("hex",0,max).match(/.{2}/g).join(" ");if(this.length>max)str+=" ... "}return"<Buffer "+str+">"};Buffer.prototype.compare=function compare(target,start,end,thisStart,thisEnd){if(!Buffer.isBuffer(target)){throw new TypeError("Argument must be a Buffer")}if(start===undefined){start=0}if(end===undefined){end=target?target.length:0}if(thisStart===undefined){thisStart=0}if(thisEnd===undefined){thisEnd=this.length}if(start<0||end>target.length||thisStart<0||thisEnd>this.length){throw new RangeError("out of range index")}if(thisStart>=thisEnd&&start>=end){return 0}if(thisStart>=thisEnd){return-1}if(start>=end){return 1}start>>>=0;end>>>=0;thisStart>>>=0;thisEnd>>>=0;if(this===target)return 0;var x=thisEnd-thisStart;var y=end-start;var len=Math.min(x,y);var thisCopy=this.slice(thisStart,thisEnd);var targetCopy=target.slice(start,end);for(var i=0;i<len;++i){if(thisCopy[i]!==targetCopy[i]){x=thisCopy[i];y=targetCopy[i];break}}if(x<y)return-1;if(y<x)return 1;return 0};function bidirectionalIndexOf(buffer,val,byteOffset,encoding,dir){if(buffer.length===0)return-1;if(typeof byteOffset==="string"){encoding=byteOffset;byteOffset=0}else if(byteOffset>2147483647){byteOffset=2147483647}else if(byteOffset<-2147483648){byteOffset=-2147483648}byteOffset=+byteOffset;if(isNaN(byteOffset)){byteOffset=dir?0:buffer.length-1}if(byteOffset<0)byteOffset=buffer.length+byteOffset;if(byteOffset>=buffer.length){if(dir)return-1;else byteOffset=buffer.length-1}else if(byteOffset<0){if(dir)byteOffset=0;else return-1}if(typeof val==="string"){val=Buffer.from(val,encoding)}if(Buffer.isBuffer(val)){if(val.length===0){return-1}return arrayIndexOf(buffer,val,byteOffset,encoding,dir)}else if(typeof val==="number"){val=val&255;if(Buffer.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf==="function"){if(dir){return Uint8Array.prototype.indexOf.call(buffer,val,byteOffset)}else{return Uint8Array.prototype.lastIndexOf.call(buffer,val,byteOffset)}}return arrayIndexOf(buffer,[val],byteOffset,encoding,dir)}throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(arr,val,byteOffset,encoding,dir){var indexSize=1;var arrLength=arr.length;var valLength=val.length;if(encoding!==undefined){encoding=String(encoding).toLowerCase();if(encoding==="ucs2"||encoding==="ucs-2"||encoding==="utf16le"||encoding==="utf-16le"){if(arr.length<2||val.length<2){return-1}indexSize=2;arrLength/=2;valLength/=2;byteOffset/=2}}function read(buf,i){if(indexSize===1){return buf[i]}else{return buf.readUInt16BE(i*indexSize)}}var i;if(dir){var foundIndex=-1;for(i=byteOffset;i<arrLength;i++){if(read(arr,i)===read(val,foundIndex===-1?0:i-foundIndex)){if(foundIndex===-1)foundIndex=i;if(i-foundIndex+1===valLength)return foundIndex*indexSize}else{if(foundIndex!==-1)i-=i-foundIndex;foundIndex=-1}}}else{if(byteOffset+valLength>arrLength)byteOffset=arrLength-valLength;for(i=byteOffset;i>=0;i--){var found=true;for(var j=0;j<valLength;j++){if(read(arr,i+j)!==read(val,j)){found=false;break}}if(found)return i}}return-1}Buffer.prototype.includes=function includes(val,byteOffset,encoding){return this.indexOf(val,byteOffset,encoding)!==-1};Buffer.prototype.indexOf=function indexOf(val,byteOffset,encoding){return bidirectionalIndexOf(this,val,byteOffset,encoding,true)};Buffer.prototype.lastIndexOf=function lastIndexOf(val,byteOffset,encoding){return bidirectionalIndexOf(this,val,byteOffset,encoding,false)};function hexWrite(buf,string,offset,length){offset=Number(offset)||0;var remaining=buf.length-offset;if(!length){length=remaining}else{length=Number(length);if(length>remaining){length=remaining}}var strLen=string.length;if(strLen%2!==0)throw new TypeError("Invalid hex string");if(length>strLen/2){length=strLen/2}for(var i=0;i<length;++i){var parsed=parseInt(string.substr(i*2,2),16);if(isNaN(parsed))return i;buf[offset+i]=parsed}return i}function utf8Write(buf,string,offset,length){return blitBuffer(utf8ToBytes(string,buf.length-offset),buf,offset,length)}function asciiWrite(buf,string,offset,length){return blitBuffer(asciiToBytes(string),buf,offset,length)}function latin1Write(buf,string,offset,length){return asciiWrite(buf,string,offset,length)}function base64Write(buf,string,offset,length){return blitBuffer(base64ToBytes(string),buf,offset,length)}function ucs2Write(buf,string,offset,length){return blitBuffer(utf16leToBytes(string,buf.length-offset),buf,offset,length)}Buffer.prototype.write=function write(string,offset,length,encoding){if(offset===undefined){encoding="utf8";length=this.length;offset=0}else if(length===undefined&&typeof offset==="string"){encoding=offset;length=this.length;offset=0}else if(isFinite(offset)){offset=offset|0;if(isFinite(length)){length=length|0;if(encoding===undefined)encoding="utf8"}else{encoding=length;length=undefined}}else{throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported")}var remaining=this.length-offset;if(length===undefined||length>remaining)length=remaining;if(string.length>0&&(length<0||offset<0)||offset>this.length){throw new RangeError("Attempt to write outside buffer bounds")}if(!encoding)encoding="utf8";var loweredCase=false;for(;;){switch(encoding){case"hex":return hexWrite(this,string,offset,length);case"utf8":case"utf-8":return utf8Write(this,string,offset,length);case"ascii":return asciiWrite(this,string,offset,length);case"latin1":case"binary":return latin1Write(this,string,offset,length);case"base64":return base64Write(this,string,offset,length);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,string,offset,length);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(""+encoding).toLowerCase();loweredCase=true}}};Buffer.prototype.toJSON=function toJSON(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function base64Slice(buf,start,end){if(start===0&&end===buf.length){return base64.fromByteArray(buf)}else{return base64.fromByteArray(buf.slice(start,end))}}function utf8Slice(buf,start,end){end=Math.min(buf.length,end);var res=[];var i=start;while(i<end){var firstByte=buf[i];var codePoint=null;var bytesPerSequence=firstByte>239?4:firstByte>223?3:firstByte>191?2:1;if(i+bytesPerSequence<=end){var secondByte,thirdByte,fourthByte,tempCodePoint;switch(bytesPerSequence){case 1:if(firstByte<128){codePoint=firstByte}break;case 2:secondByte=buf[i+1];if((secondByte&192)===128){tempCodePoint=(firstByte&31)<<6|secondByte&63;if(tempCodePoint>127){codePoint=tempCodePoint}}break;case 3:secondByte=buf[i+1];thirdByte=buf[i+2];if((secondByte&192)===128&&(thirdByte&192)===128){tempCodePoint=(firstByte&15)<<12|(secondByte&63)<<6|thirdByte&63;if(tempCodePoint>2047&&(tempCodePoint<55296||tempCodePoint>57343)){codePoint=tempCodePoint}}break;case 4:secondByte=buf[i+1];thirdByte=buf[i+2];fourthByte=buf[i+3];if((secondByte&192)===128&&(thirdByte&192)===128&&(fourthByte&192)===128){tempCodePoint=(firstByte&15)<<18|(secondByte&63)<<12|(thirdByte&63)<<6|fourthByte&63;if(tempCodePoint>65535&&tempCodePoint<1114112){codePoint=tempCodePoint}}}}if(codePoint===null){codePoint=65533;bytesPerSequence=1}else if(codePoint>65535){codePoint-=65536;res.push(codePoint>>>10&1023|55296);codePoint=56320|codePoint&1023}res.push(codePoint);i+=bytesPerSequence}return decodeCodePointsArray(res)}var MAX_ARGUMENTS_LENGTH=4096;function decodeCodePointsArray(codePoints){var len=codePoints.length;if(len<=MAX_ARGUMENTS_LENGTH){return String.fromCharCode.apply(String,codePoints)}var res="";var i=0;while(i<len){res+=String.fromCharCode.apply(String,codePoints.slice(i,i+=MAX_ARGUMENTS_LENGTH))}return res}function asciiSlice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;++i){ret+=String.fromCharCode(buf[i]&127)}return ret}function latin1Slice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;++i){ret+=String.fromCharCode(buf[i])}return ret}function hexSlice(buf,start,end){var len=buf.length;if(!start||start<0)start=0;if(!end||end<0||end>len)end=len;var out="";for(var i=start;i<end;++i){out+=toHex(buf[i])}return out}function utf16leSlice(buf,start,end){var bytes=buf.slice(start,end);var res="";for(var i=0;i<bytes.length;i+=2){res+=String.fromCharCode(bytes[i]+bytes[i+1]*256)}return res}Buffer.prototype.slice=function slice(start,end){var len=this.length;start=~~start;end=end===undefined?len:~~end;if(start<0){start+=len;if(start<0)start=0}else if(start>len){start=len}if(end<0){end+=len;if(end<0)end=0}else if(end>len){end=len}if(end<start)end=start;var newBuf;if(Buffer.TYPED_ARRAY_SUPPORT){newBuf=this.subarray(start,end);newBuf.__proto__=Buffer.prototype}else{var sliceLen=end-start;newBuf=new Buffer(sliceLen,undefined);for(var i=0;i<sliceLen;++i){newBuf[i]=this[i+start]}}return newBuf};function checkOffset(offset,ext,length){if(offset%1!==0||offset<0)throw new RangeError("offset is not uint");if(offset+ext>length)throw new RangeError("Trying to access beyond buffer length")}Buffer.prototype.readUIntLE=function readUIntLE(offset,byteLength,noAssert){offset=offset|0;byteLength=byteLength|0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i<byteLength&&(mul*=256)){val+=this[offset+i]*mul}return val};Buffer.prototype.readUIntBE=function readUIntBE(offset,byteLength,noAssert){offset=offset|0;byteLength=byteLength|0;if(!noAssert){checkOffset(offset,byteLength,this.length)}var val=this[offset+--byteLength];var mul=1;while(byteLength>0&&(mul*=256)){val+=this[offset+--byteLength]*mul}return val};Buffer.prototype.readUInt8=function readUInt8(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);return this[offset]};Buffer.prototype.readUInt16LE=function readUInt16LE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]|this[offset+1]<<8};Buffer.prototype.readUInt16BE=function readUInt16BE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]<<8|this[offset+1]};Buffer.prototype.readUInt32LE=function readUInt32LE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+this[offset+3]*16777216};Buffer.prototype.readUInt32BE=function readUInt32BE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]*16777216+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])};Buffer.prototype.readIntLE=function readIntLE(offset,byteLength,noAssert){offset=offset|0;byteLength=byteLength|0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i<byteLength&&(mul*=256)){val+=this[offset+i]*mul}mul*=128;if(val>=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readIntBE=function readIntBE(offset,byteLength,noAssert){offset=offset|0;byteLength=byteLength|0;if(!noAssert)checkOffset(offset,byteLength,this.length); |
| 3140 | var i=byteLength;var mul=1;var val=this[offset+--i];while(i>0&&(mul*=256)){val+=this[offset+--i]*mul}mul*=128;if(val>=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readInt8=function readInt8(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);if(!(this[offset]&128))return this[offset];return(255-this[offset]+1)*-1};Buffer.prototype.readInt16LE=function readInt16LE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt16BE=function readInt16BE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt32LE=function readInt32LE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24};Buffer.prototype.readInt32BE=function readInt32BE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]};Buffer.prototype.readFloatLE=function readFloatLE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,true,23,4)};Buffer.prototype.readFloatBE=function readFloatBE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,false,23,4)};Buffer.prototype.readDoubleLE=function readDoubleLE(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,true,52,8)};Buffer.prototype.readDoubleBE=function readDoubleBE(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,false,52,8)};function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError('"buffer" argument must be a Buffer instance');if(value>max||value<min)throw new RangeError('"value" argument is out of bounds');if(offset+ext>buf.length)throw new RangeError("Index out of range")}Buffer.prototype.writeUIntLE=function writeUIntLE(value,offset,byteLength,noAssert){value=+value;offset=offset|0;byteLength=byteLength|0;if(!noAssert){var maxBytes=Math.pow(2,8*byteLength)-1;checkInt(this,value,offset,byteLength,maxBytes,0)}var mul=1;var i=0;this[offset]=value&255;while(++i<byteLength&&(mul*=256)){this[offset+i]=value/mul&255}return offset+byteLength};Buffer.prototype.writeUIntBE=function writeUIntBE(value,offset,byteLength,noAssert){value=+value;offset=offset|0;byteLength=byteLength|0;if(!noAssert){var maxBytes=Math.pow(2,8*byteLength)-1;checkInt(this,value,offset,byteLength,maxBytes,0)}var i=byteLength-1;var mul=1;this[offset+i]=value&255;while(--i>=0&&(mul*=256)){this[offset+i]=value/mul&255}return offset+byteLength};Buffer.prototype.writeUInt8=function writeUInt8(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,1,255,0);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);this[offset]=value&255;return offset+1};function objectWriteUInt16(buf,value,offset,littleEndian){if(value<0)value=65535+value+1;for(var i=0,j=Math.min(buf.length-offset,2);i<j;++i){buf[offset+i]=(value&255<<8*(littleEndian?i:1-i))>>>(littleEndian?i:1-i)*8}}Buffer.prototype.writeUInt16LE=function writeUInt16LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value&255;this[offset+1]=value>>>8}else{objectWriteUInt16(this,value,offset,true)}return offset+2};Buffer.prototype.writeUInt16BE=function writeUInt16BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value&255}else{objectWriteUInt16(this,value,offset,false)}return offset+2};function objectWriteUInt32(buf,value,offset,littleEndian){if(value<0)value=4294967295+value+1;for(var i=0,j=Math.min(buf.length-offset,4);i<j;++i){buf[offset+i]=value>>>(littleEndian?i:3-i)*8&255}}Buffer.prototype.writeUInt32LE=function writeUInt32LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset+3]=value>>>24;this[offset+2]=value>>>16;this[offset+1]=value>>>8;this[offset]=value&255}else{objectWriteUInt32(this,value,offset,true)}return offset+4};Buffer.prototype.writeUInt32BE=function writeUInt32BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value&255}else{objectWriteUInt32(this,value,offset,false)}return offset+4};Buffer.prototype.writeIntLE=function writeIntLE(value,offset,byteLength,noAssert){value=+value;offset=offset|0;if(!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=0;var mul=1;var sub=0;this[offset]=value&255;while(++i<byteLength&&(mul*=256)){if(value<0&&sub===0&&this[offset+i-1]!==0){sub=1}this[offset+i]=(value/mul>>0)-sub&255}return offset+byteLength};Buffer.prototype.writeIntBE=function writeIntBE(value,offset,byteLength,noAssert){value=+value;offset=offset|0;if(!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=byteLength-1;var mul=1;var sub=0;this[offset+i]=value&255;while(--i>=0&&(mul*=256)){if(value<0&&sub===0&&this[offset+i+1]!==0){sub=1}this[offset+i]=(value/mul>>0)-sub&255}return offset+byteLength};Buffer.prototype.writeInt8=function writeInt8(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,1,127,-128);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);if(value<0)value=255+value+1;this[offset]=value&255;return offset+1};Buffer.prototype.writeInt16LE=function writeInt16LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value&255;this[offset+1]=value>>>8}else{objectWriteUInt16(this,value,offset,true)}return offset+2};Buffer.prototype.writeInt16BE=function writeInt16BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value&255}else{objectWriteUInt16(this,value,offset,false)}return offset+2};Buffer.prototype.writeInt32LE=function writeInt32LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value&255;this[offset+1]=value>>>8;this[offset+2]=value>>>16;this[offset+3]=value>>>24}else{objectWriteUInt32(this,value,offset,true)}return offset+4};Buffer.prototype.writeInt32BE=function writeInt32BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(value<0)value=4294967295+value+1;if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value&255}else{objectWriteUInt32(this,value,offset,false)}return offset+4};function checkIEEE754(buf,value,offset,ext,max,min){if(offset+ext>buf.length)throw new RangeError("Index out of range");if(offset<0)throw new RangeError("Index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){if(!noAssert){checkIEEE754(buf,value,offset,4,3.4028234663852886e38,-3.4028234663852886e38)}ieee754.write(buf,value,offset,littleEndian,23,4);return offset+4}Buffer.prototype.writeFloatLE=function writeFloatLE(value,offset,noAssert){return writeFloat(this,value,offset,true,noAssert)};Buffer.prototype.writeFloatBE=function writeFloatBE(value,offset,noAssert){return writeFloat(this,value,offset,false,noAssert)};function writeDouble(buf,value,offset,littleEndian,noAssert){if(!noAssert){checkIEEE754(buf,value,offset,8,1.7976931348623157e308,-1.7976931348623157e308)}ieee754.write(buf,value,offset,littleEndian,52,8);return offset+8}Buffer.prototype.writeDoubleLE=function writeDoubleLE(value,offset,noAssert){return writeDouble(this,value,offset,true,noAssert)};Buffer.prototype.writeDoubleBE=function writeDoubleBE(value,offset,noAssert){return writeDouble(this,value,offset,false,noAssert)};Buffer.prototype.copy=function copy(target,targetStart,start,end){if(!start)start=0;if(!end&&end!==0)end=this.length;if(targetStart>=target.length)targetStart=target.length;if(!targetStart)targetStart=0;if(end>0&&end<start)end=start;if(end===start)return 0;if(target.length===0||this.length===0)return 0;if(targetStart<0){throw new RangeError("targetStart out of bounds")}if(start<0||start>=this.length)throw new RangeError("sourceStart out of bounds");if(end<0)throw new RangeError("sourceEnd out of bounds");if(end>this.length)end=this.length;if(target.length-targetStart<end-start){end=target.length-targetStart+start}var len=end-start;var i;if(this===target&&start<targetStart&&targetStart<end){for(i=len-1;i>=0;--i){target[i+targetStart]=this[i+start]}}else if(len<1e3||!Buffer.TYPED_ARRAY_SUPPORT){for(i=0;i<len;++i){target[i+targetStart]=this[i+start]}}else{Uint8Array.prototype.set.call(target,this.subarray(start,start+len),targetStart)}return len};Buffer.prototype.fill=function fill(val,start,end,encoding){if(typeof val==="string"){if(typeof start==="string"){encoding=start;start=0;end=this.length}else if(typeof end==="string"){encoding=end;end=this.length}if(val.length===1){var code=val.charCodeAt(0);if(code<256){val=code}}if(encoding!==undefined&&typeof encoding!=="string"){throw new TypeError("encoding must be a string")}if(typeof encoding==="string"&&!Buffer.isEncoding(encoding)){throw new TypeError("Unknown encoding: "+encoding)}}else if(typeof val==="number"){val=val&255}if(start<0||this.length<start||this.length<end){throw new RangeError("Out of range index")}if(end<=start){return this}start=start>>>0;end=end===undefined?this.length:end>>>0;if(!val)val=0;var i;if(typeof val==="number"){for(i=start;i<end;++i){this[i]=val}}else{var bytes=Buffer.isBuffer(val)?val:utf8ToBytes(new Buffer(val,encoding).toString());var len=bytes.length;for(i=0;i<end-start;++i){this[i+start]=bytes[i%len]}}return this};var INVALID_BASE64_RE=/[^+\/0-9A-Za-z-_]/g;function base64clean(str){str=stringtrim(str).replace(INVALID_BASE64_RE,"");if(str.length<2)return"";while(str.length%4!==0){str=str+"="}return str}function stringtrim(str){if(str.trim)return str.trim();return str.replace(/^\s+|\s+$/g,"")}function toHex(n){if(n<16)return"0"+n.toString(16);return n.toString(16)}function utf8ToBytes(string,units){units=units||Infinity;var codePoint;var length=string.length;var leadSurrogate=null;var bytes=[];for(var i=0;i<length;++i){codePoint=string.charCodeAt(i);if(codePoint>55295&&codePoint<57344){if(!leadSurrogate){if(codePoint>56319){if((units-=3)>-1)bytes.push(239,191,189);continue}else if(i+1===length){if((units-=3)>-1)bytes.push(239,191,189);continue}leadSurrogate=codePoint;continue}if(codePoint<56320){if((units-=3)>-1)bytes.push(239,191,189);leadSurrogate=codePoint;continue}codePoint=(leadSurrogate-55296<<10|codePoint-56320)+65536}else if(leadSurrogate){if((units-=3)>-1)bytes.push(239,191,189)}leadSurrogate=null;if(codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,codePoint&63|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,codePoint&63|128)}else if(codePoint<1114112){if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,codePoint&63|128)}else{throw new Error("Invalid code point")}}return bytes}function asciiToBytes(str){var byteArray=[];for(var i=0;i<str.length;++i){byteArray.push(str.charCodeAt(i)&255)}return byteArray}function utf16leToBytes(str,units){var c,hi,lo;var byteArray=[];for(var i=0;i<str.length;++i){if((units-=2)<0)break;c=str.charCodeAt(i);hi=c>>8;lo=c%256;byteArray.push(lo);byteArray.push(hi)}return byteArray}function base64ToBytes(str){return base64.toByteArray(base64clean(str))}function blitBuffer(src,dst,offset,length){for(var i=0;i<length;++i){if(i+offset>=dst.length||i>=src.length)break;dst[i+offset]=src[i]}return i}function isnan(val){return val!==val}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"base64-js":2,ieee754:37,isarray:40}],6:[function(require,module,exports){(function(Buffer){function isArray(arg){if(Array.isArray){return Array.isArray(arg)}return objectToString(arg)==="[object Array]"}exports.isArray=isArray;function isBoolean(arg){return typeof arg==="boolean"}exports.isBoolean=isBoolean;function isNull(arg){return arg===null}exports.isNull=isNull;function isNullOrUndefined(arg){return arg==null}exports.isNullOrUndefined=isNullOrUndefined;function isNumber(arg){return typeof arg==="number"}exports.isNumber=isNumber;function isString(arg){return typeof arg==="string"}exports.isString=isString;function isSymbol(arg){return typeof arg==="symbol"}exports.isSymbol=isSymbol;function isUndefined(arg){return arg===void 0}exports.isUndefined=isUndefined;function isRegExp(re){return objectToString(re)==="[object RegExp]"}exports.isRegExp=isRegExp;function isObject(arg){return typeof arg==="object"&&arg!==null}exports.isObject=isObject;function isDate(d){return objectToString(d)==="[object Date]"}exports.isDate=isDate;function isError(e){return objectToString(e)==="[object Error]"||e instanceof Error}exports.isError=isError;function isFunction(arg){return typeof arg==="function"}exports.isFunction=isFunction;function isPrimitive(arg){return arg===null||typeof arg==="boolean"||typeof arg==="number"||typeof arg==="string"||typeof arg==="symbol"||typeof arg==="undefined"}exports.isPrimitive=isPrimitive;exports.isBuffer=Buffer.isBuffer;function objectToString(o){return Object.prototype.toString.call(o)}}).call(this,{isBuffer:require("../../is-buffer/index.js")})},{"../../is-buffer/index.js":39}],7:[function(require,module,exports){var ElementType=require("domelementtype");var entities=require("entities");var booleanAttributes={__proto__:null,allowfullscreen:true,async:true,autofocus:true,autoplay:true,checked:true,controls:true,default:true,defer:true,disabled:true,hidden:true,ismap:true,loop:true,multiple:true,muted:true,open:true,readonly:true,required:true,reversed:true,scoped:true,seamless:true,selected:true,typemustmatch:true};var unencodedElements={__proto__:null,style:true,script:true,xmp:true,iframe:true,noembed:true,noframes:true,plaintext:true,noscript:true};function formatAttrs(attributes,opts){if(!attributes)return;var output="",value;for(var key in attributes){value=attributes[key];if(output){output+=" "}if(!value&&booleanAttributes[key]){output+=key}else{output+=key+'="'+(opts.decodeEntities?entities.encodeXML(value):value)+'"'}}return output}var singleTag={__proto__:null,area:true,base:true,basefont:true,br:true,col:true,command:true,embed:true,frame:true,hr:true,img:true,input:true,isindex:true,keygen:true,link:true,meta:true,param:true,source:true,track:true,wbr:true};var render=module.exports=function(dom,opts){if(!Array.isArray(dom)&&!dom.cheerio)dom=[dom];opts=opts||{};var output="";for(var i=0;i<dom.length;i++){var elem=dom[i];if(elem.type==="root")output+=render(elem.children,opts);else if(ElementType.isTag(elem))output+=renderTag(elem,opts);else if(elem.type===ElementType.Directive)output+=renderDirective(elem);else if(elem.type===ElementType.Comment)output+=renderComment(elem);else if(elem.type===ElementType.CDATA)output+=renderCdata(elem);else output+=renderText(elem,opts)}return output};function renderTag(elem,opts){if(elem.name==="svg")opts={decodeEntities:opts.decodeEntities,xmlMode:true};var tag="<"+elem.name,attribs=formatAttrs(elem.attribs,opts);if(attribs){tag+=" "+attribs}if(opts.xmlMode&&(!elem.children||elem.children.length===0)){tag+="/>"}else{tag+=">";if(elem.children){tag+=render(elem.children,opts)}if(!singleTag[elem.name]||opts.xmlMode){tag+="</"+elem.name+">"}}return tag}function renderDirective(elem){return"<"+elem.data+">"}function renderText(elem,opts){var data=elem.data||"";if(opts.decodeEntities&&!(elem.parent&&elem.parent.name in unencodedElements)){data=entities.encodeXML(data)}return data}function renderCdata(elem){return"<![CDATA["+elem.children[0].data+"]]>"}function renderComment(elem){return"<!--"+elem.data+"-->"}},{domelementtype:8,entities:20}],8:[function(require,module,exports){module.exports={Text:"text",Directive:"directive",Comment:"comment",Script:"script",Style:"style",Tag:"tag",CDATA:"cdata",isTag:function(elem){return elem.type==="tag"||elem.type==="script"||elem.type==="style"}}},{}],9:[function(require,module,exports){module.exports={Text:"text",Directive:"directive",Comment:"comment",Script:"script",Style:"style",Tag:"tag",CDATA:"cdata",Doctype:"doctype",isTag:function(elem){return elem.type==="tag"||elem.type==="script"||elem.type==="style"}}},{}],10:[function(require,module,exports){var ElementType=require("domelementtype");var re_whitespace=/\s+/g;var NodePrototype=require("./lib/node");var ElementPrototype=require("./lib/element");function DomHandler(callback,options,elementCB){if(typeof callback==="object"){elementCB=options;options=callback;callback=null}else if(typeof options==="function"){elementCB=options;options=defaultOpts}this._callback=callback;this._options=options||defaultOpts;this._elementCB=elementCB;this.dom=[];this._done=false;this._tagStack=[];this._parser=this._parser||null}var defaultOpts={normalizeWhitespace:false,withStartIndices:false};DomHandler.prototype.onparserinit=function(parser){this._parser=parser};DomHandler.prototype.onreset=function(){DomHandler.call(this,this._callback,this._options,this._elementCB)};DomHandler.prototype.onend=function(){if(this._done)return;this._done=true;this._parser=null;this._handleCallback(null)};DomHandler.prototype._handleCallback=DomHandler.prototype.onerror=function(error){if(typeof this._callback==="function"){this._callback(error,this.dom)}else{if(error)throw error}};DomHandler.prototype.onclosetag=function(){var elem=this._tagStack.pop();if(this._elementCB)this._elementCB(elem)};DomHandler.prototype._addDomElement=function(element){var parent=this._tagStack[this._tagStack.length-1];var siblings=parent?parent.children:this.dom;var previousSibling=siblings[siblings.length-1];element.next=null;if(this._options.withStartIndices){element.startIndex=this._parser.startIndex}if(this._options.withDomLvl1){element.__proto__=element.type==="tag"?ElementPrototype:NodePrototype}if(previousSibling){element.prev=previousSibling;previousSibling.next=element}else{element.prev=null}siblings.push(element);element.parent=parent||null};DomHandler.prototype.onopentag=function(name,attribs){var element={type:name==="script"?ElementType.Script:name==="style"?ElementType.Style:ElementType.Tag,name:name,attribs:attribs,children:[]};this._addDomElement(element);this._tagStack.push(element)};DomHandler.prototype.ontext=function(data){var normalize=this._options.normalizeWhitespace||this._options.ignoreWhitespace;var lastTag;if(!this._tagStack.length&&this.dom.length&&(lastTag=this.dom[this.dom.length-1]).type===ElementType.Text){if(normalize){lastTag.data=(lastTag.data+data).replace(re_whitespace," ")}else{lastTag.data+=data}}else{if(this._tagStack.length&&(lastTag=this._tagStack[this._tagStack.length-1])&&(lastTag=lastTag.children[lastTag.children.length-1])&&lastTag.type===ElementType.Text){if(normalize){lastTag.data=(lastTag.data+data).replace(re_whitespace," ")}else{lastTag.data+=data}}else{if(normalize){data=data.replace(re_whitespace," ")}this._addDomElement({data:data,type:ElementType.Text})}}};DomHandler.prototype.oncomment=function(data){var lastTag=this._tagStack[this._tagStack.length-1];if(lastTag&&lastTag.type===ElementType.Comment){lastTag.data+=data;return}var element={data:data,type:ElementType.Comment};this._addDomElement(element);this._tagStack.push(element)};DomHandler.prototype.oncdatastart=function(){var element={children:[{data:"",type:ElementType.Text}],type:ElementType.CDATA};this._addDomElement(element);this._tagStack.push(element)};DomHandler.prototype.oncommentend=DomHandler.prototype.oncdataend=function(){this._tagStack.pop()};DomHandler.prototype.onprocessinginstruction=function(name,data){this._addDomElement({name:name,data:data,type:ElementType.Directive})};module.exports=DomHandler},{"./lib/element":11,"./lib/node":12,domelementtype:9}],11:[function(require,module,exports){var NodePrototype=require("./node");var ElementPrototype=module.exports=Object.create(NodePrototype);var domLvl1={tagName:"name"};Object.keys(domLvl1).forEach(function(key){var shorthand=domLvl1[key];Object.defineProperty(ElementPrototype,key,{get:function(){return this[shorthand]||null},set:function(val){this[shorthand]=val;return val}})})},{"./node":12}],12:[function(require,module,exports){var NodePrototype=module.exports={get firstChild(){var children=this.children;return children&&children[0]||null},get lastChild(){var children=this.children;return children&&children[children.length-1]||null},get nodeType(){return nodeTypes[this.type]||nodeTypes.element}};var domLvl1={tagName:"name",childNodes:"children",parentNode:"parent",previousSibling:"prev",nextSibling:"next",nodeValue:"data"};var nodeTypes={element:1,text:3,cdata:4,comment:8};Object.keys(domLvl1).forEach(function(key){var shorthand=domLvl1[key];Object.defineProperty(NodePrototype,key,{get:function(){return this[shorthand]||null},set:function(val){this[shorthand]=val;return val}})})},{}],13:[function(require,module,exports){var DomUtils=module.exports;[require("./lib/stringify"),require("./lib/traversal"),require("./lib/manipulation"),require("./lib/querying"),require("./lib/legacy"),require("./lib/helpers")].forEach(function(ext){Object.keys(ext).forEach(function(key){DomUtils[key]=ext[key].bind(DomUtils)})})},{"./lib/helpers":14,"./lib/legacy":15,"./lib/manipulation":16,"./lib/querying":17,"./lib/stringify":18,"./lib/traversal":19}],14:[function(require,module,exports){exports.removeSubsets=function(nodes){var idx=nodes.length,node,ancestor,replace;while(--idx>-1){node=ancestor=nodes[idx];nodes[idx]=null;replace=true;while(ancestor){if(nodes.indexOf(ancestor)>-1){replace=false;nodes.splice(idx,1);break}ancestor=ancestor.parent}if(replace){nodes[idx]=node}}return nodes};var POSITION={DISCONNECTED:1,PRECEDING:2,FOLLOWING:4,CONTAINS:8,CONTAINED_BY:16};var comparePos=exports.compareDocumentPosition=function(nodeA,nodeB){var aParents=[];var bParents=[];var current,sharedParent,siblings,aSibling,bSibling,idx;if(nodeA===nodeB){return 0}current=nodeA;while(current){aParents.unshift(current);current=current.parent}current=nodeB;while(current){bParents.unshift(current);current=current.parent}idx=0;while(aParents[idx]===bParents[idx]){idx++}if(idx===0){return POSITION.DISCONNECTED}sharedParent=aParents[idx-1];siblings=sharedParent.children;aSibling=aParents[idx];bSibling=bParents[idx];if(siblings.indexOf(aSibling)>siblings.indexOf(bSibling)){if(sharedParent===nodeB){return POSITION.FOLLOWING|POSITION.CONTAINED_BY}return POSITION.FOLLOWING}else{if(sharedParent===nodeA){return POSITION.PRECEDING|POSITION.CONTAINS}return POSITION.PRECEDING}};exports.uniqueSort=function(nodes){var idx=nodes.length,node,position;nodes=nodes.slice();while(--idx>-1){node=nodes[idx];position=nodes.indexOf(node);if(position>-1&&position<idx){nodes.splice(idx,1)}}nodes.sort(function(a,b){var relative=comparePos(a,b);if(relative&POSITION.PRECEDING){return-1}else if(relative&POSITION.FOLLOWING){return 1}return 0});return nodes}},{}],15:[function(require,module,exports){var ElementType=require("domelementtype");var isTag=exports.isTag=ElementType.isTag;exports.testElement=function(options,element){for(var key in options){if(!options.hasOwnProperty(key));else if(key==="tag_name"){if(!isTag(element)||!options.tag_name(element.name)){return false}}else if(key==="tag_type"){if(!options.tag_type(element.type))return false}else if(key==="tag_contains"){if(isTag(element)||!options.tag_contains(element.data)){return false}}else if(!element.attribs||!options[key](element.attribs[key])){return false}}return true};var Checks={tag_name:function(name){if(typeof name==="function"){return function(elem){return isTag(elem)&&name(elem.name)}}else if(name==="*"){return isTag}else{return function(elem){return isTag(elem)&&elem.name===name}}},tag_type:function(type){if(typeof type==="function"){return function(elem){return type(elem.type)}}else{return function(elem){return elem.type===type}}},tag_contains:function(data){if(typeof data==="function"){return function(elem){return!isTag(elem)&&data(elem.data)}}else{return function(elem){return!isTag(elem)&&elem.data===data}}}};function getAttribCheck(attrib,value){if(typeof value==="function"){return function(elem){return elem.attribs&&value(elem.attribs[attrib])}}else{return function(elem){return elem.attribs&&elem.attribs[attrib]===value}}}function combineFuncs(a,b){return function(elem){return a(elem)||b(elem)}}exports.getElements=function(options,element,recurse,limit){var funcs=Object.keys(options).map(function(key){var value=options[key];return key in Checks?Checks[key](value):getAttribCheck(key,value)});return funcs.length===0?[]:this.filter(funcs.reduce(combineFuncs),element,recurse,limit)};exports.getElementById=function(id,element,recurse){if(!Array.isArray(element))element=[element];return this.findOne(getAttribCheck("id",id),element,recurse!==false)};exports.getElementsByTagName=function(name,element,recurse,limit){return this.filter(Checks.tag_name(name),element,recurse,limit)};exports.getElementsByTagType=function(type,element,recurse,limit){return this.filter(Checks.tag_type(type),element,recurse,limit)}},{domelementtype:9}],16:[function(require,module,exports){exports.removeElement=function(elem){if(elem.prev)elem.prev.next=elem.next;if(elem.next)elem.next.prev=elem.prev;if(elem.parent){var childs=elem.parent.children;childs.splice(childs.lastIndexOf(elem),1)}};exports.replaceElement=function(elem,replacement){var prev=replacement.prev=elem.prev;if(prev){prev.next=replacement}var next=replacement.next=elem.next;if(next){next.prev=replacement}var parent=replacement.parent=elem.parent;if(parent){var childs=parent.children;childs[childs.lastIndexOf(elem)]=replacement}};exports.appendChild=function(elem,child){child.parent=elem;if(elem.children.push(child)!==1){var sibling=elem.children[elem.children.length-2];sibling.next=child;child.prev=sibling;child.next=null}};exports.append=function(elem,next){var parent=elem.parent,currNext=elem.next;next.next=currNext;next.prev=elem;elem.next=next;next.parent=parent;if(currNext){currNext.prev=next;if(parent){var childs=parent.children;childs.splice(childs.lastIndexOf(currNext),0,next)}}else if(parent){parent.children.push(next)}};exports.prepend=function(elem,prev){var parent=elem.parent;if(parent){var childs=parent.children;childs.splice(childs.lastIndexOf(elem),0,prev)}if(elem.prev){elem.prev.next=prev}prev.parent=parent;prev.prev=elem.prev;prev.next=elem;elem.prev=prev}},{}],17:[function(require,module,exports){var isTag=require("domelementtype").isTag;module.exports={filter:filter,find:find,findOneChild:findOneChild,findOne:findOne,existsOne:existsOne,findAll:findAll};function filter(test,element,recurse,limit){if(!Array.isArray(element))element=[element];if(typeof limit!=="number"||!isFinite(limit)){limit=Infinity}return find(test,element,recurse!==false,limit)}function find(test,elems,recurse,limit){var result=[],childs;for(var i=0,j=elems.length;i<j;i++){if(test(elems[i])){result.push(elems[i]);if(--limit<=0)break}childs=elems[i].children;if(recurse&&childs&&childs.length>0){childs=find(test,childs,recurse,limit);result=result.concat(childs);limit-=childs.length;if(limit<=0)break}}return result}function findOneChild(test,elems){for(var i=0,l=elems.length;i<l;i++){if(test(elems[i]))return elems[i]}return null}function findOne(test,elems){var elem=null;for(var i=0,l=elems.length;i<l&&!elem;i++){if(!isTag(elems[i])){continue}else if(test(elems[i])){elem=elems[i]}else if(elems[i].children.length>0){elem=findOne(test,elems[i].children)}}return elem}function existsOne(test,elems){for(var i=0,l=elems.length;i<l;i++){if(isTag(elems[i])&&(test(elems[i])||elems[i].children.length>0&&existsOne(test,elems[i].children))){return true}}return false}function findAll(test,elems){var result=[];for(var i=0,j=elems.length;i<j;i++){if(!isTag(elems[i]))continue;if(test(elems[i]))result.push(elems[i]);if(elems[i].children.length>0){result=result.concat(findAll(test,elems[i].children))}}return result}},{domelementtype:9}],18:[function(require,module,exports){var ElementType=require("domelementtype"),getOuterHTML=require("dom-serializer"),isTag=ElementType.isTag;module.exports={getInnerHTML:getInnerHTML,getOuterHTML:getOuterHTML,getText:getText};function getInnerHTML(elem,opts){return elem.children?elem.children.map(function(elem){return getOuterHTML(elem,opts)}).join(""):""}function getText(elem){if(Array.isArray(elem))return elem.map(getText).join("");if(isTag(elem)||elem.type===ElementType.CDATA)return getText(elem.children);if(elem.type===ElementType.Text)return elem.data;return""}},{"dom-serializer":7,domelementtype:9}],19:[function(require,module,exports){var getChildren=exports.getChildren=function(elem){return elem.children};var getParent=exports.getParent=function(elem){return elem.parent};exports.getSiblings=function(elem){var parent=getParent(elem);return parent?getChildren(parent):[elem]};exports.getAttributeValue=function(elem,name){return elem.attribs&&elem.attribs[name]};exports.hasAttrib=function(elem,name){return!!elem.attribs&&hasOwnProperty.call(elem.attribs,name)};exports.getName=function(elem){return elem.name}},{}],20:[function(require,module,exports){var encode=require("./lib/encode.js"),decode=require("./lib/decode.js");exports.decode=function(data,level){return(!level||level<=0?decode.XML:decode.HTML)(data)};exports.decodeStrict=function(data,level){return(!level||level<=0?decode.XML:decode.HTMLStrict)(data)};exports.encode=function(data,level){return(!level||level<=0?encode.XML:encode.HTML)(data)};exports.encodeXML=encode.XML;exports.encodeHTML4=exports.encodeHTML5=exports.encodeHTML=encode.HTML;exports.decodeXML=exports.decodeXMLStrict=decode.XML;exports.decodeHTML4=exports.decodeHTML5=exports.decodeHTML=decode.HTML;exports.decodeHTML4Strict=exports.decodeHTML5Strict=exports.decodeHTMLStrict=decode.HTMLStrict;exports.escape=encode.escape},{"./lib/decode.js":21,"./lib/encode.js":23}],21:[function(require,module,exports){var entityMap=require("../maps/entities.json"),legacyMap=require("../maps/legacy.json"),xmlMap=require("../maps/xml.json"),decodeCodePoint=require("./decode_codepoint.js");var decodeXMLStrict=getStrictDecoder(xmlMap),decodeHTMLStrict=getStrictDecoder(entityMap);function getStrictDecoder(map){var keys=Object.keys(map).join("|"),replace=getReplacer(map);keys+="|#[xX][\\da-fA-F]+|#\\d+";var re=new RegExp("&(?:"+keys+");","g");return function(str){return String(str).replace(re,replace)}}var decodeHTML=function(){var legacy=Object.keys(legacyMap).sort(sorter);var keys=Object.keys(entityMap).sort(sorter);for(var i=0,j=0;i<keys.length;i++){if(legacy[j]===keys[i]){keys[i]+=";?";j++}else{keys[i]+=";"}}var re=new RegExp("&(?:"+keys.join("|")+"|#[xX][\\da-fA-F]+;?|#\\d+;?)","g"),replace=getReplacer(entityMap);function replacer(str){if(str.substr(-1)!==";")str+=";";return replace(str)}return function(str){return String(str).replace(re,replacer)}}();function sorter(a,b){return a<b?1:-1}function getReplacer(map){return function replace(str){if(str.charAt(1)==="#"){if(str.charAt(2)==="X"||str.charAt(2)==="x"){return decodeCodePoint(parseInt(str.substr(3),16))}return decodeCodePoint(parseInt(str.substr(2),10))}return map[str.slice(1,-1)]; |
| 3141 | }}module.exports={XML:decodeXMLStrict,HTML:decodeHTML,HTMLStrict:decodeHTMLStrict}},{"../maps/entities.json":25,"../maps/legacy.json":26,"../maps/xml.json":27,"./decode_codepoint.js":22}],22:[function(require,module,exports){var decodeMap=require("../maps/decode.json");module.exports=decodeCodePoint;function decodeCodePoint(codePoint){if(codePoint>=55296&&codePoint<=57343||codePoint>1114111){return"�"}if(codePoint in decodeMap){codePoint=decodeMap[codePoint]}var output="";if(codePoint>65535){codePoint-=65536;output+=String.fromCharCode(codePoint>>>10&1023|55296);codePoint=56320|codePoint&1023}output+=String.fromCharCode(codePoint);return output}},{"../maps/decode.json":24}],23:[function(require,module,exports){var inverseXML=getInverseObj(require("../maps/xml.json")),xmlReplacer=getInverseReplacer(inverseXML);exports.XML=getInverse(inverseXML,xmlReplacer);var inverseHTML=getInverseObj(require("../maps/entities.json")),htmlReplacer=getInverseReplacer(inverseHTML);exports.HTML=getInverse(inverseHTML,htmlReplacer);function getInverseObj(obj){return Object.keys(obj).sort().reduce(function(inverse,name){inverse[obj[name]]="&"+name+";";return inverse},{})}function getInverseReplacer(inverse){var single=[],multiple=[];Object.keys(inverse).forEach(function(k){if(k.length===1){single.push("\\"+k)}else{multiple.push(k)}});multiple.unshift("["+single.join("")+"]");return new RegExp(multiple.join("|"),"g")}var re_nonASCII=/[^\0-\x7F]/g,re_astralSymbols=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;function singleCharReplacer(c){return"&#x"+c.charCodeAt(0).toString(16).toUpperCase()+";"}function astralReplacer(c){var high=c.charCodeAt(0);var low=c.charCodeAt(1);var codePoint=(high-55296)*1024+low-56320+65536;return"&#x"+codePoint.toString(16).toUpperCase()+";"}function getInverse(inverse,re){function func(name){return inverse[name]}return function(data){return data.replace(re,func).replace(re_astralSymbols,astralReplacer).replace(re_nonASCII,singleCharReplacer)}}var re_xmlChars=getInverseReplacer(inverseXML);function escapeXML(data){return data.replace(re_xmlChars,singleCharReplacer).replace(re_astralSymbols,astralReplacer).replace(re_nonASCII,singleCharReplacer)}exports.escape=escapeXML},{"../maps/entities.json":25,"../maps/xml.json":27}],24:[function(require,module,exports){module.exports={0:65533,128:8364,130:8218,131:402,132:8222,133:8230,134:8224,135:8225,136:710,137:8240,138:352,139:8249,140:338,142:381,145:8216,146:8217,147:8220,148:8221,149:8226,150:8211,151:8212,152:732,153:8482,154:353,155:8250,156:339,158:382,159:376}},{}],25:[function(require,module,exports){module.exports={Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",amp:"&",AMP:"&",andand:"⩕",And:"⩓",and:"∧",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angmsd:"∡",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",apacir:"⩯",ap:"≈",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",barwed:"⌅",Barwed:"⌆",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",because:"∵",Because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxdl:"┐",boxdL:"╕",boxDl:"╖",boxDL:"╗",boxdr:"┌",boxdR:"╒",boxDr:"╓",boxDR:"╔",boxh:"─",boxH:"═",boxhd:"┬",boxHd:"╤",boxhD:"╥",boxHD:"╦",boxhu:"┴",boxHu:"╧",boxhU:"╨",boxHU:"╩",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxul:"┘",boxuL:"╛",boxUl:"╜",boxUL:"╝",boxur:"└",boxuR:"╘",boxUr:"╙",boxUR:"╚",boxv:"│",boxV:"║",boxvh:"┼",boxvH:"╪",boxVh:"╫",boxVH:"╬",boxvl:"┤",boxvL:"╡",boxVl:"╢",boxVL:"╣",boxvr:"├",boxvR:"╞",boxVr:"╟",boxVR:"╠",bprime:"‵",breve:"˘",Breve:"˘",brvbar:"¦",bscr:"𝒷",Bscr:"ℬ",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsolb:"⧅",bsol:"\\",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",capand:"⩄",capbrcup:"⩉",capcap:"⩋",cap:"∩",Cap:"⋒",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",centerdot:"·",CenterDot:"·",cfr:"𝔠",Cfr:"ℭ",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cir:"○",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",colon:":",Colon:"∷",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",conint:"∮",Conint:"∯",ContourIntegral:"∮",copf:"𝕔",Copf:"ℂ",coprod:"∐",Coproduct:"∐",copy:"©",COPY:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",cross:"✗",Cross:"⨯",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",cupbrcap:"⩈",cupcap:"⩆",CupCap:"≍",cup:"∪",Cup:"⋓",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",dagger:"†",Dagger:"‡",daleth:"ℸ",darr:"↓",Darr:"↡",dArr:"⇓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",ddagger:"‡",ddarr:"⇊",DD:"ⅅ",dd:"ⅆ",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",diamond:"⋄",Diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrowBar:"⤓",downarrow:"↓",DownArrow:"↓",Downarrow:"⇓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVectorBar:"⥖",DownLeftVector:"↽",DownRightTeeVector:"⥟",DownRightVectorBar:"⥗",DownRightVector:"⇁",DownTeeArrow:"↧",DownTee:"⊤",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",Ecirc:"Ê",ecirc:"ê",ecir:"≖",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",edot:"ė",eDot:"≑",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp13:" ",emsp14:" ",emsp:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",escr:"ℯ",Escr:"ℰ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",exponentiale:"ⅇ",ExponentialE:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",forall:"∀",ForAll:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",fscr:"𝒻",Fscr:"ℱ",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",ge:"≥",gE:"≧",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",gescc:"⪩",ges:"⩾",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",gg:"≫",Gg:"⋙",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gla:"⪥",gl:"≷",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gne:"⪈",gnE:"≩",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",gtcc:"⪧",gtcir:"⩺",gt:">",GT:">",Gt:"≫",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",harrcir:"⥈",harr:"↔",hArr:"⇔",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",hfr:"𝔥",Hfr:"ℌ",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",hopf:"𝕙",Hopf:"ℍ",horbar:"―",HorizontalLine:"─",hscr:"𝒽",Hscr:"ℋ",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",ifr:"𝔦",Ifr:"ℑ",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",Im:"ℑ",imof:"⊷",imped:"Ƶ",Implies:"⇒",incare:"℅",in:"∈",infin:"∞",infintie:"⧝",inodot:"ı",intcal:"⊺",int:"∫",Int:"∬",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"",InvisibleTimes:"",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",iscr:"𝒾",Iscr:"ℐ",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",lang:"⟨",Lang:"⟪",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",larrb:"⇤",larrbfs:"⤟",larr:"←",Larr:"↞",lArr:"⇐",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",latail:"⤙",lAtail:"⤛",lat:"⪫",late:"⪭",lates:"⪭︀",lbarr:"⤌",lBarr:"⤎",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",le:"≤",lE:"≦",LeftAngleBracket:"⟨",LeftArrowBar:"⇤",leftarrow:"←",LeftArrow:"←",Leftarrow:"⇐",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVectorBar:"⥙",LeftDownVector:"⇃",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",leftrightarrow:"↔",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTeeArrow:"↤",LeftTee:"⊣",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangleBar:"⧏",LeftTriangle:"⊲",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVectorBar:"⥘",LeftUpVector:"↿",LeftVectorBar:"⥒",LeftVector:"↼",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",lescc:"⪨",les:"⩽",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",llarr:"⇇",ll:"≪",Ll:"⋘",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoustache:"⎰",lmoust:"⎰",lnap:"⪉",lnapprox:"⪉",lne:"⪇",lnE:"≨",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",longleftarrow:"⟵",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftrightarrow:"⟷",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longmapsto:"⟼",longrightarrow:"⟶",LongRightArrow:"⟶",Longrightarrow:"⟹",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"‹",lscr:"𝓁",Lscr:"ℒ",lsh:"↰",Lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",ltcc:"⪦",ltcir:"⩹",lt:"<",LT:"<",Lt:"≪",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",midast:"*",midcir:"⫰",mid:"∣",middot:"·",minusb:"⊟",minus:"−",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",mscr:"𝓂",Mscr:"ℳ",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natural:"♮",naturals:"ℕ",natur:"♮",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",nearhk:"⤤",nearr:"↗",neArr:"⇗",nearrow:"↗",ne:"≠",nedot:"≐̸",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nharr:"↮",nhArr:"⇎",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlarr:"↚",nlArr:"⇍",nldr:"‥",nlE:"≦̸",nle:"≰",nleftarrow:"↚",nLeftarrow:"⇍",nleftrightarrow:"↮",nLeftrightarrow:"⇎",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"",NonBreakingSpace:" ",nopf:"𝕟",Nopf:"ℕ",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangleBar:"⧏̸",NotLeftTriangle:"⋪",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangleBar:"⧐̸",NotRightTriangle:"⋫",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",nparallel:"∦",npar:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",nprec:"⊀",npreceq:"⪯̸",npre:"⪯̸",nrarrc:"⤳̸",nrarr:"↛",nrArr:"⇏",nrarrw:"↝̸",nrightarrow:"↛",nRightarrow:"⇏",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nvdash:"⊬",nvDash:"⊭",nVdash:"⊮",nVDash:"⊯",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwarr:"↖",nwArr:"⇖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",Ocirc:"Ô",ocirc:"ô",ocir:"⊚",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",orarr:"↻",Or:"⩔",or:"∨",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",otimesas:"⨶",Otimes:"⨷",otimes:"⊗",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",para:"¶",parallel:"∥",par:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plus:"+",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",popf:"𝕡",Popf:"ℙ",pound:"£",prap:"⪷",Pr:"⪻",pr:"≺",prcue:"≼",precapprox:"⪷",prec:"≺",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",pre:"⪯",prE:"⪳",precsim:"≾",prime:"′",Prime:"″",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportional:"∝",Proportion:"∷",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",qopf:"𝕢",Qopf:"ℚ",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",quot:'"',QUOT:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",rang:"⟩",Rang:"⟫",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarr:"→",Rarr:"↠",rArr:"⇒",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",ratail:"⤚",rAtail:"⤜",ratio:"∶",rationals:"ℚ",rbarr:"⤍",rBarr:"⤏",RBarr:"⤐",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",Re:"ℜ",rect:"▭",reg:"®",REG:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",rfr:"𝔯",Rfr:"ℜ",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrowBar:"⇥",rightarrow:"→",RightArrow:"→",Rightarrow:"⇒",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVectorBar:"⥕",RightDownVector:"⇂",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTeeArrow:"↦",RightTee:"⊢",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangleBar:"⧐",RightTriangle:"⊳",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVectorBar:"⥔",RightUpVector:"↾",RightVectorBar:"⥓",RightVector:"⇀",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoustache:"⎱",rmoust:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",ropf:"𝕣",Ropf:"ℝ",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",rscr:"𝓇",Rscr:"ℛ",rsh:"↱",Rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",scap:"⪸",Scaron:"Š",scaron:"š",Sc:"⪼",sc:"≻",sccue:"≽",sce:"⪰",scE:"⪴",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdotb:"⊡",sdot:"⋅",sdote:"⩦",searhk:"⤥",searr:"↘",seArr:"⇘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",solbar:"⌿",solb:"⧄",sol:"/",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",square:"□",Square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squ:"□",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",sub:"⊂",Sub:"⋐",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",subset:"⊂",Subset:"⋐",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succapprox:"⪸",succ:"≻",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",sum:"∑",Sum:"∑",sung:"♪",sup1:"¹",sup2:"²",sup3:"³",sup:"⊃",Sup:"⋑",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",supset:"⊃",Supset:"⋑",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swarr:"↙",swArr:"⇙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"\t",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",therefore:"∴",Therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:" ",ThinSpace:" ",thinsp:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",tilde:"˜",Tilde:"∼",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",timesbar:"⨱",timesb:"⊠",times:"×",timesd:"⨰",tint:"∭",toea:"⤨",topbot:"⌶",topcir:"⫱",top:"⊤",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",trade:"™",TRADE:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",uarr:"↑",Uarr:"↟",uArr:"⇑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrowBar:"⤒",uparrow:"↑",UpArrow:"↑",Uparrow:"⇑",UpArrowDownArrow:"⇅",updownarrow:"↕",UpDownArrow:"↕",Updownarrow:"⇕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",upsi:"υ",Upsi:"ϒ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTeeArrow:"↥",UpTee:"⊥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",varr:"↕",vArr:"⇕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",vBar:"⫨",Vbar:"⫫",vBarv:"⫩",Vcy:"В",vcy:"в",vdash:"⊢",vDash:"⊨",Vdash:"⊩",VDash:"⊫",Vdashl:"⫦",veebar:"⊻",vee:"∨",Vee:"⋁",veeeq:"≚",vellip:"⋮",verbar:"|",Verbar:"‖",vert:"|",Vert:"‖",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",wedge:"∧",Wedge:"⋀",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xharr:"⟷",xhArr:"⟺",Xi:"Ξ",xi:"ξ",xlarr:"⟵",xlArr:"⟸",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrarr:"⟶",xrArr:"⟹",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",yuml:"ÿ",Yuml:"Ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"",Zeta:"Ζ",zeta:"ζ",zfr:"𝔷",Zfr:"ℨ",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",zopf:"𝕫",Zopf:"ℤ",Zscr:"𝒵",zscr:"𝓏",zwj:"",zwnj:""}},{}],26:[function(require,module,exports){module.exports={Aacute:"Á",aacute:"á",Acirc:"Â",acirc:"â",acute:"´",AElig:"Æ",aelig:"æ",Agrave:"À",agrave:"à",amp:"&",AMP:"&",Aring:"Å",aring:"å",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",brvbar:"¦",Ccedil:"Ç",ccedil:"ç",cedil:"¸",cent:"¢",copy:"©",COPY:"©",curren:"¤",deg:"°",divide:"÷",Eacute:"É",eacute:"é",Ecirc:"Ê",ecirc:"ê",Egrave:"È",egrave:"è",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",frac12:"½",frac14:"¼",frac34:"¾",gt:">",GT:">",Iacute:"Í",iacute:"í",Icirc:"Î",icirc:"î",iexcl:"¡",Igrave:"Ì",igrave:"ì",iquest:"¿",Iuml:"Ï",iuml:"ï",laquo:"«",lt:"<",LT:"<",macr:"¯",micro:"µ",middot:"·",nbsp:" ",not:"¬",Ntilde:"Ñ",ntilde:"ñ",Oacute:"Ó",oacute:"ó",Ocirc:"Ô",ocirc:"ô",Ograve:"Ò",ograve:"ò",ordf:"ª",ordm:"º",Oslash:"Ø",oslash:"ø",Otilde:"Õ",otilde:"õ",Ouml:"Ö",ouml:"ö",para:"¶",plusmn:"±",pound:"£",quot:'"',QUOT:'"',raquo:"»",reg:"®",REG:"®",sect:"§",shy:"",sup1:"¹",sup2:"²",sup3:"³",szlig:"ß",THORN:"Þ",thorn:"þ",times:"×",Uacute:"Ú",uacute:"ú",Ucirc:"Û",ucirc:"û",Ugrave:"Ù",ugrave:"ù",uml:"¨",Uuml:"Ü",uuml:"ü",Yacute:"Ý",yacute:"ý",yen:"¥",yuml:"ÿ"}},{}],27:[function(require,module,exports){module.exports={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}},{}],28:[function(require,module,exports){function EventEmitter(){this._events=this._events||{};this._maxListeners=this._maxListeners||undefined}module.exports=EventEmitter;EventEmitter.EventEmitter=EventEmitter;EventEmitter.prototype._events=undefined;EventEmitter.prototype._maxListeners=undefined;EventEmitter.defaultMaxListeners=10;EventEmitter.prototype.setMaxListeners=function(n){if(!isNumber(n)||n<0||isNaN(n))throw TypeError("n must be a positive number");this._maxListeners=n;return this};EventEmitter.prototype.emit=function(type){var er,handler,len,args,i,listeners;if(!this._events)this._events={};if(type==="error"){if(!this._events.error||isObject(this._events.error)&&!this._events.error.length){er=arguments[1];if(er instanceof Error){throw er}else{var err=new Error('Uncaught, unspecified "error" event. ('+er+")");err.context=er;throw err}}}handler=this._events[type];if(isUndefined(handler))return false;if(isFunction(handler)){switch(arguments.length){case 1:handler.call(this);break;case 2:handler.call(this,arguments[1]);break;case 3:handler.call(this,arguments[1],arguments[2]);break;default:args=Array.prototype.slice.call(arguments,1);handler.apply(this,args)}}else if(isObject(handler)){args=Array.prototype.slice.call(arguments,1);listeners=handler.slice();len=listeners.length;for(i=0;i<len;i++)listeners[i].apply(this,args)}return true};EventEmitter.prototype.addListener=function(type,listener){var m;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events)this._events={};if(this._events.newListener)this.emit("newListener",type,isFunction(listener.listener)?listener.listener:listener);if(!this._events[type])this._events[type]=listener;else if(isObject(this._events[type]))this._events[type].push(listener);else this._events[type]=[this._events[type],listener];if(isObject(this._events[type])&&!this._events[type].warned){if(!isUndefined(this._maxListeners)){m=this._maxListeners}else{m=EventEmitter.defaultMaxListeners}if(m&&m>0&&this._events[type].length>m){this._events[type].warned=true;console.error("(node) warning: possible EventEmitter memory "+"leak detected. %d listeners added. "+"Use emitter.setMaxListeners() to increase limit.",this._events[type].length);if(typeof console.trace==="function"){console.trace()}}}return this};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.once=function(type,listener){if(!isFunction(listener))throw TypeError("listener must be a function");var fired=false;function g(){this.removeListener(type,g);if(!fired){fired=true;listener.apply(this,arguments)}}g.listener=listener;this.on(type,g);return this};EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events||!this._events[type])return this;list=this._events[type];length=list.length;position=-1;if(list===listener||isFunction(list.listener)&&list.listener===listener){delete this._events[type];if(this._events.removeListener)this.emit("removeListener",type,listener)}else if(isObject(list)){for(i=length;i-- >0;){if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break}}if(position<0)return this;if(list.length===1){list.length=0;delete this._events[type]}else{list.splice(position,1); |
| 3142 | }if(this._events.removeListener)this.emit("removeListener",type,listener)}return this};EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener){if(arguments.length===0)this._events={};else if(this._events[type])delete this._events[type];return this}if(arguments.length===0){for(key in this._events){if(key==="removeListener")continue;this.removeAllListeners(key)}this.removeAllListeners("removeListener");this._events={};return this}listeners=this._events[type];if(isFunction(listeners)){this.removeListener(type,listeners)}else if(listeners){while(listeners.length)this.removeListener(type,listeners[listeners.length-1])}delete this._events[type];return this};EventEmitter.prototype.listeners=function(type){var ret;if(!this._events||!this._events[type])ret=[];else if(isFunction(this._events[type]))ret=[this._events[type]];else ret=this._events[type].slice();return ret};EventEmitter.prototype.listenerCount=function(type){if(this._events){var evlistener=this._events[type];if(isFunction(evlistener))return 1;else if(evlistener)return evlistener.length}return 0};EventEmitter.listenerCount=function(emitter,type){return emitter.listenerCount(type)};function isFunction(arg){return typeof arg==="function"}function isNumber(arg){return typeof arg==="number"}function isObject(arg){return typeof arg==="object"&&arg!==null}function isUndefined(arg){return arg===void 0}},{}],29:[function(require,module,exports){module.exports=CollectingHandler;function CollectingHandler(cbs){this._cbs=cbs||{};this.events=[]}var EVENTS=require("./").EVENTS;Object.keys(EVENTS).forEach(function(name){if(EVENTS[name]===0){name="on"+name;CollectingHandler.prototype[name]=function(){this.events.push([name]);if(this._cbs[name])this._cbs[name]()}}else if(EVENTS[name]===1){name="on"+name;CollectingHandler.prototype[name]=function(a){this.events.push([name,a]);if(this._cbs[name])this._cbs[name](a)}}else if(EVENTS[name]===2){name="on"+name;CollectingHandler.prototype[name]=function(a,b){this.events.push([name,a,b]);if(this._cbs[name])this._cbs[name](a,b)}}else{throw Error("wrong number of arguments")}});CollectingHandler.prototype.onreset=function(){this.events=[];if(this._cbs.onreset)this._cbs.onreset()};CollectingHandler.prototype.restart=function(){if(this._cbs.onreset)this._cbs.onreset();for(var i=0,len=this.events.length;i<len;i++){if(this._cbs[this.events[i][0]]){var num=this.events[i].length;if(num===1){this._cbs[this.events[i][0]]()}else if(num===2){this._cbs[this.events[i][0]](this.events[i][1])}else{this._cbs[this.events[i][0]](this.events[i][1],this.events[i][2])}}}}},{"./":36}],30:[function(require,module,exports){var index=require("./index.js"),DomHandler=index.DomHandler,DomUtils=index.DomUtils;function FeedHandler(callback,options){this.init(callback,options)}require("inherits")(FeedHandler,DomHandler);FeedHandler.prototype.init=DomHandler;function getElements(what,where){return DomUtils.getElementsByTagName(what,where,true)}function getOneElement(what,where){return DomUtils.getElementsByTagName(what,where,true,1)[0]}function fetch(what,where,recurse){return DomUtils.getText(DomUtils.getElementsByTagName(what,where,recurse,1)).trim()}function addConditionally(obj,prop,what,where,recurse){var tmp=fetch(what,where,recurse);if(tmp)obj[prop]=tmp}var isValidFeed=function(value){return value==="rss"||value==="feed"||value==="rdf:RDF"};FeedHandler.prototype.onend=function(){var feed={},feedRoot=getOneElement(isValidFeed,this.dom),tmp,childs;if(feedRoot){if(feedRoot.name==="feed"){childs=feedRoot.children;feed.type="atom";addConditionally(feed,"id","id",childs);addConditionally(feed,"title","title",childs);if((tmp=getOneElement("link",childs))&&(tmp=tmp.attribs)&&(tmp=tmp.href))feed.link=tmp;addConditionally(feed,"description","subtitle",childs);if(tmp=fetch("updated",childs))feed.updated=new Date(tmp);addConditionally(feed,"author","email",childs,true);feed.items=getElements("entry",childs).map(function(item){var entry={},tmp;item=item.children;addConditionally(entry,"id","id",item);addConditionally(entry,"title","title",item);if((tmp=getOneElement("link",item))&&(tmp=tmp.attribs)&&(tmp=tmp.href))entry.link=tmp;if(tmp=fetch("summary",item)||fetch("content",item))entry.description=tmp;if(tmp=fetch("updated",item))entry.pubDate=new Date(tmp);return entry})}else{childs=getOneElement("channel",feedRoot.children).children;feed.type=feedRoot.name.substr(0,3);feed.id="";addConditionally(feed,"title","title",childs);addConditionally(feed,"link","link",childs);addConditionally(feed,"description","description",childs);if(tmp=fetch("lastBuildDate",childs))feed.updated=new Date(tmp);addConditionally(feed,"author","managingEditor",childs,true);feed.items=getElements("item",feedRoot.children).map(function(item){var entry={},tmp;item=item.children;addConditionally(entry,"id","guid",item);addConditionally(entry,"title","title",item);addConditionally(entry,"link","link",item);addConditionally(entry,"description","description",item);if(tmp=fetch("pubDate",item))entry.pubDate=new Date(tmp);return entry})}}this.dom=feed;DomHandler.prototype._handleCallback.call(this,feedRoot?null:Error("couldn't find root of feed"))};module.exports=FeedHandler},{"./index.js":36,inherits:38}],31:[function(require,module,exports){var Tokenizer=require("./Tokenizer.js");var formTags={input:true,option:true,optgroup:true,select:true,button:true,datalist:true,textarea:true};var openImpliesClose={tr:{tr:true,th:true,td:true},th:{th:true},td:{thead:true,th:true,td:true},body:{head:true,link:true,script:true},li:{li:true},p:{p:true},h1:{p:true},h2:{p:true},h3:{p:true},h4:{p:true},h5:{p:true},h6:{p:true},select:formTags,input:formTags,output:formTags,button:formTags,datalist:formTags,textarea:formTags,option:{option:true},optgroup:{optgroup:true}};var voidElements={__proto__:null,area:true,base:true,basefont:true,br:true,col:true,command:true,embed:true,frame:true,hr:true,img:true,input:true,isindex:true,keygen:true,link:true,meta:true,param:true,source:true,track:true,wbr:true,path:true,circle:true,ellipse:true,line:true,rect:true,use:true,stop:true,polyline:true,polygon:true};var re_nameEnd=/\s|\//;function Parser(cbs,options){this._options=options||{};this._cbs=cbs||{};this._tagname="";this._attribname="";this._attribvalue="";this._attribs=null;this._stack=[];this.startIndex=0;this.endIndex=null;this._lowerCaseTagNames="lowerCaseTags"in this._options?!!this._options.lowerCaseTags:!this._options.xmlMode;this._lowerCaseAttributeNames="lowerCaseAttributeNames"in this._options?!!this._options.lowerCaseAttributeNames:!this._options.xmlMode;if(this._options.Tokenizer){Tokenizer=this._options.Tokenizer}this._tokenizer=new Tokenizer(this._options,this);if(this._cbs.onparserinit)this._cbs.onparserinit(this)}require("inherits")(Parser,require("events").EventEmitter);Parser.prototype._updatePosition=function(initialOffset){if(this.endIndex===null){if(this._tokenizer._sectionStart<=initialOffset){this.startIndex=0}else{this.startIndex=this._tokenizer._sectionStart-initialOffset}}else this.startIndex=this.endIndex+1;this.endIndex=this._tokenizer.getAbsoluteIndex()};Parser.prototype.ontext=function(data){this._updatePosition(1);this.endIndex--;if(this._cbs.ontext)this._cbs.ontext(data)};Parser.prototype.onopentagname=function(name){if(this._lowerCaseTagNames){name=name.toLowerCase()}this._tagname=name;if(!this._options.xmlMode&&name in openImpliesClose){for(var el;(el=this._stack[this._stack.length-1])in openImpliesClose[name];this.onclosetag(el));}if(this._options.xmlMode||!(name in voidElements)){this._stack.push(name)}if(this._cbs.onopentagname)this._cbs.onopentagname(name);if(this._cbs.onopentag)this._attribs={}};Parser.prototype.onopentagend=function(){this._updatePosition(1);if(this._attribs){if(this._cbs.onopentag)this._cbs.onopentag(this._tagname,this._attribs);this._attribs=null}if(!this._options.xmlMode&&this._cbs.onclosetag&&this._tagname in voidElements){this._cbs.onclosetag(this._tagname)}this._tagname=""};Parser.prototype.onclosetag=function(name){this._updatePosition(1);if(this._lowerCaseTagNames){name=name.toLowerCase()}if(this._stack.length&&(!(name in voidElements)||this._options.xmlMode)){var pos=this._stack.lastIndexOf(name);if(pos!==-1){if(this._cbs.onclosetag){pos=this._stack.length-pos;while(pos--)this._cbs.onclosetag(this._stack.pop())}else this._stack.length=pos}else if(name==="p"&&!this._options.xmlMode){this.onopentagname(name);this._closeCurrentTag()}}else if(!this._options.xmlMode&&(name==="br"||name==="p")){this.onopentagname(name);this._closeCurrentTag()}};Parser.prototype.onselfclosingtag=function(){if(this._options.xmlMode||this._options.recognizeSelfClosing){this._closeCurrentTag()}else{this.onopentagend()}};Parser.prototype._closeCurrentTag=function(){var name=this._tagname;this.onopentagend();if(this._stack[this._stack.length-1]===name){if(this._cbs.onclosetag){this._cbs.onclosetag(name)}this._stack.pop()}};Parser.prototype.onattribname=function(name){if(this._lowerCaseAttributeNames){name=name.toLowerCase()}this._attribname=name};Parser.prototype.onattribdata=function(value){this._attribvalue+=value};Parser.prototype.onattribend=function(){if(this._cbs.onattribute)this._cbs.onattribute(this._attribname,this._attribvalue);if(this._attribs&&!Object.prototype.hasOwnProperty.call(this._attribs,this._attribname)){this._attribs[this._attribname]=this._attribvalue}this._attribname="";this._attribvalue=""};Parser.prototype._getInstructionName=function(value){var idx=value.search(re_nameEnd),name=idx<0?value:value.substr(0,idx);if(this._lowerCaseTagNames){name=name.toLowerCase()}return name};Parser.prototype.ondeclaration=function(value){if(this._cbs.onprocessinginstruction){var name=this._getInstructionName(value);this._cbs.onprocessinginstruction("!"+name,"!"+value)}};Parser.prototype.onprocessinginstruction=function(value){if(this._cbs.onprocessinginstruction){var name=this._getInstructionName(value);this._cbs.onprocessinginstruction("?"+name,"?"+value)}};Parser.prototype.oncomment=function(value){this._updatePosition(4);if(this._cbs.oncomment)this._cbs.oncomment(value);if(this._cbs.oncommentend)this._cbs.oncommentend()};Parser.prototype.oncdata=function(value){this._updatePosition(1);if(this._options.xmlMode||this._options.recognizeCDATA){if(this._cbs.oncdatastart)this._cbs.oncdatastart();if(this._cbs.ontext)this._cbs.ontext(value);if(this._cbs.oncdataend)this._cbs.oncdataend()}else{this.oncomment("[CDATA["+value+"]]")}};Parser.prototype.onerror=function(err){if(this._cbs.onerror)this._cbs.onerror(err)};Parser.prototype.onend=function(){if(this._cbs.onclosetag){for(var i=this._stack.length;i>0;this._cbs.onclosetag(this._stack[--i]));}if(this._cbs.onend)this._cbs.onend()};Parser.prototype.reset=function(){if(this._cbs.onreset)this._cbs.onreset();this._tokenizer.reset();this._tagname="";this._attribname="";this._attribs=null;this._stack=[];if(this._cbs.onparserinit)this._cbs.onparserinit(this)};Parser.prototype.parseComplete=function(data){this.reset();this.end(data)};Parser.prototype.write=function(chunk){this._tokenizer.write(chunk)};Parser.prototype.end=function(chunk){this._tokenizer.end(chunk)};Parser.prototype.pause=function(){this._tokenizer.pause()};Parser.prototype.resume=function(){this._tokenizer.resume()};Parser.prototype.parseChunk=Parser.prototype.write;Parser.prototype.done=Parser.prototype.end;module.exports=Parser},{"./Tokenizer.js":34,events:28,inherits:38}],32:[function(require,module,exports){module.exports=ProxyHandler;function ProxyHandler(cbs){this._cbs=cbs||{}}var EVENTS=require("./").EVENTS;Object.keys(EVENTS).forEach(function(name){if(EVENTS[name]===0){name="on"+name;ProxyHandler.prototype[name]=function(){if(this._cbs[name])this._cbs[name]()}}else if(EVENTS[name]===1){name="on"+name;ProxyHandler.prototype[name]=function(a){if(this._cbs[name])this._cbs[name](a)}}else if(EVENTS[name]===2){name="on"+name;ProxyHandler.prototype[name]=function(a,b){if(this._cbs[name])this._cbs[name](a,b)}}else{throw Error("wrong number of arguments")}})},{"./":36}],33:[function(require,module,exports){module.exports=Stream;var Parser=require("./WritableStream.js");function Stream(options){Parser.call(this,new Cbs(this),options)}require("inherits")(Stream,Parser);Stream.prototype.readable=true;function Cbs(scope){this.scope=scope}var EVENTS=require("../").EVENTS;Object.keys(EVENTS).forEach(function(name){if(EVENTS[name]===0){Cbs.prototype["on"+name]=function(){this.scope.emit(name)}}else if(EVENTS[name]===1){Cbs.prototype["on"+name]=function(a){this.scope.emit(name,a)}}else if(EVENTS[name]===2){Cbs.prototype["on"+name]=function(a,b){this.scope.emit(name,a,b)}}else{throw Error("wrong number of arguments!")}})},{"../":36,"./WritableStream.js":35,inherits:38}],34:[function(require,module,exports){module.exports=Tokenizer;var decodeCodePoint=require("entities/lib/decode_codepoint.js"),entityMap=require("entities/maps/entities.json"),legacyMap=require("entities/maps/legacy.json"),xmlMap=require("entities/maps/xml.json"),i=0,TEXT=i++,BEFORE_TAG_NAME=i++,IN_TAG_NAME=i++,IN_SELF_CLOSING_TAG=i++,BEFORE_CLOSING_TAG_NAME=i++,IN_CLOSING_TAG_NAME=i++,AFTER_CLOSING_TAG_NAME=i++,BEFORE_ATTRIBUTE_NAME=i++,IN_ATTRIBUTE_NAME=i++,AFTER_ATTRIBUTE_NAME=i++,BEFORE_ATTRIBUTE_VALUE=i++,IN_ATTRIBUTE_VALUE_DQ=i++,IN_ATTRIBUTE_VALUE_SQ=i++,IN_ATTRIBUTE_VALUE_NQ=i++,BEFORE_DECLARATION=i++,IN_DECLARATION=i++,IN_PROCESSING_INSTRUCTION=i++,BEFORE_COMMENT=i++,IN_COMMENT=i++,AFTER_COMMENT_1=i++,AFTER_COMMENT_2=i++,BEFORE_CDATA_1=i++,BEFORE_CDATA_2=i++,BEFORE_CDATA_3=i++,BEFORE_CDATA_4=i++,BEFORE_CDATA_5=i++,BEFORE_CDATA_6=i++,IN_CDATA=i++,AFTER_CDATA_1=i++,AFTER_CDATA_2=i++,BEFORE_SPECIAL=i++,BEFORE_SPECIAL_END=i++,BEFORE_SCRIPT_1=i++,BEFORE_SCRIPT_2=i++,BEFORE_SCRIPT_3=i++,BEFORE_SCRIPT_4=i++,BEFORE_SCRIPT_5=i++,AFTER_SCRIPT_1=i++,AFTER_SCRIPT_2=i++,AFTER_SCRIPT_3=i++,AFTER_SCRIPT_4=i++,AFTER_SCRIPT_5=i++,BEFORE_STYLE_1=i++,BEFORE_STYLE_2=i++,BEFORE_STYLE_3=i++,BEFORE_STYLE_4=i++,AFTER_STYLE_1=i++,AFTER_STYLE_2=i++,AFTER_STYLE_3=i++,AFTER_STYLE_4=i++,BEFORE_ENTITY=i++,BEFORE_NUMERIC_ENTITY=i++,IN_NAMED_ENTITY=i++,IN_NUMERIC_ENTITY=i++,IN_HEX_ENTITY=i++,j=0,SPECIAL_NONE=j++,SPECIAL_SCRIPT=j++,SPECIAL_STYLE=j++;function whitespace(c){return c===" "||c==="\n"||c==="\t"||c==="\f"||c==="\r"}function characterState(char,SUCCESS){return function(c){if(c===char)this._state=SUCCESS}}function ifElseState(upper,SUCCESS,FAILURE){var lower=upper.toLowerCase();if(upper===lower){return function(c){if(c===lower){this._state=SUCCESS}else{this._state=FAILURE;this._index--}}}else{return function(c){if(c===lower||c===upper){this._state=SUCCESS}else{this._state=FAILURE;this._index--}}}}function consumeSpecialNameChar(upper,NEXT_STATE){var lower=upper.toLowerCase();return function(c){if(c===lower||c===upper){this._state=NEXT_STATE}else{this._state=IN_TAG_NAME;this._index--}}}function Tokenizer(options,cbs){this._state=TEXT;this._buffer="";this._sectionStart=0;this._index=0;this._bufferOffset=0;this._baseState=TEXT;this._special=SPECIAL_NONE;this._cbs=cbs;this._running=true;this._ended=false;this._xmlMode=!!(options&&options.xmlMode);this._decodeEntities=!!(options&&options.decodeEntities)}Tokenizer.prototype._stateText=function(c){if(c==="<"){if(this._index>this._sectionStart){this._cbs.ontext(this._getSection())}this._state=BEFORE_TAG_NAME;this._sectionStart=this._index}else if(this._decodeEntities&&this._special===SPECIAL_NONE&&c==="&"){if(this._index>this._sectionStart){this._cbs.ontext(this._getSection())}this._baseState=TEXT;this._state=BEFORE_ENTITY;this._sectionStart=this._index}};Tokenizer.prototype._stateBeforeTagName=function(c){if(c==="/"){this._state=BEFORE_CLOSING_TAG_NAME}else if(c==="<"){this._cbs.ontext(this._getSection());this._sectionStart=this._index}else if(c===">"||this._special!==SPECIAL_NONE||whitespace(c)){this._state=TEXT}else if(c==="!"){this._state=BEFORE_DECLARATION;this._sectionStart=this._index+1}else if(c==="?"){this._state=IN_PROCESSING_INSTRUCTION;this._sectionStart=this._index+1}else{this._state=!this._xmlMode&&(c==="s"||c==="S")?BEFORE_SPECIAL:IN_TAG_NAME;this._sectionStart=this._index}};Tokenizer.prototype._stateInTagName=function(c){if(c==="/"||c===">"||whitespace(c)){this._emitToken("onopentagname");this._state=BEFORE_ATTRIBUTE_NAME;this._index--}};Tokenizer.prototype._stateBeforeCloseingTagName=function(c){if(whitespace(c));else if(c===">"){this._state=TEXT}else if(this._special!==SPECIAL_NONE){if(c==="s"||c==="S"){this._state=BEFORE_SPECIAL_END}else{this._state=TEXT;this._index--}}else{this._state=IN_CLOSING_TAG_NAME;this._sectionStart=this._index}};Tokenizer.prototype._stateInCloseingTagName=function(c){if(c===">"||whitespace(c)){this._emitToken("onclosetag");this._state=AFTER_CLOSING_TAG_NAME;this._index--}};Tokenizer.prototype._stateAfterCloseingTagName=function(c){if(c===">"){this._state=TEXT;this._sectionStart=this._index+1}};Tokenizer.prototype._stateBeforeAttributeName=function(c){if(c===">"){this._cbs.onopentagend();this._state=TEXT;this._sectionStart=this._index+1}else if(c==="/"){this._state=IN_SELF_CLOSING_TAG}else if(!whitespace(c)){this._state=IN_ATTRIBUTE_NAME;this._sectionStart=this._index}};Tokenizer.prototype._stateInSelfClosingTag=function(c){if(c===">"){this._cbs.onselfclosingtag();this._state=TEXT;this._sectionStart=this._index+1}else if(!whitespace(c)){this._state=BEFORE_ATTRIBUTE_NAME;this._index--}};Tokenizer.prototype._stateInAttributeName=function(c){if(c==="="||c==="/"||c===">"||whitespace(c)){this._cbs.onattribname(this._getSection());this._sectionStart=-1;this._state=AFTER_ATTRIBUTE_NAME;this._index--}};Tokenizer.prototype._stateAfterAttributeName=function(c){if(c==="="){this._state=BEFORE_ATTRIBUTE_VALUE}else if(c==="/"||c===">"){this._cbs.onattribend();this._state=BEFORE_ATTRIBUTE_NAME;this._index--}else if(!whitespace(c)){this._cbs.onattribend();this._state=IN_ATTRIBUTE_NAME;this._sectionStart=this._index}};Tokenizer.prototype._stateBeforeAttributeValue=function(c){if(c==='"'){this._state=IN_ATTRIBUTE_VALUE_DQ;this._sectionStart=this._index+1}else if(c==="'"){this._state=IN_ATTRIBUTE_VALUE_SQ;this._sectionStart=this._index+1}else if(!whitespace(c)){this._state=IN_ATTRIBUTE_VALUE_NQ;this._sectionStart=this._index;this._index--}};Tokenizer.prototype._stateInAttributeValueDoubleQuotes=function(c){if(c==='"'){this._emitToken("onattribdata");this._cbs.onattribend();this._state=BEFORE_ATTRIBUTE_NAME}else if(this._decodeEntities&&c==="&"){this._emitToken("onattribdata");this._baseState=this._state;this._state=BEFORE_ENTITY;this._sectionStart=this._index}};Tokenizer.prototype._stateInAttributeValueSingleQuotes=function(c){if(c==="'"){this._emitToken("onattribdata");this._cbs.onattribend();this._state=BEFORE_ATTRIBUTE_NAME}else if(this._decodeEntities&&c==="&"){this._emitToken("onattribdata");this._baseState=this._state;this._state=BEFORE_ENTITY;this._sectionStart=this._index}};Tokenizer.prototype._stateInAttributeValueNoQuotes=function(c){if(whitespace(c)||c===">"){this._emitToken("onattribdata");this._cbs.onattribend();this._state=BEFORE_ATTRIBUTE_NAME;this._index--}else if(this._decodeEntities&&c==="&"){this._emitToken("onattribdata");this._baseState=this._state;this._state=BEFORE_ENTITY;this._sectionStart=this._index}};Tokenizer.prototype._stateBeforeDeclaration=function(c){this._state=c==="["?BEFORE_CDATA_1:c==="-"?BEFORE_COMMENT:IN_DECLARATION};Tokenizer.prototype._stateInDeclaration=function(c){if(c===">"){this._cbs.ondeclaration(this._getSection());this._state=TEXT;this._sectionStart=this._index+1}};Tokenizer.prototype._stateInProcessingInstruction=function(c){if(c===">"){this._cbs.onprocessinginstruction(this._getSection());this._state=TEXT;this._sectionStart=this._index+1}};Tokenizer.prototype._stateBeforeComment=function(c){if(c==="-"){this._state=IN_COMMENT;this._sectionStart=this._index+1}else{this._state=IN_DECLARATION}};Tokenizer.prototype._stateInComment=function(c){if(c==="-")this._state=AFTER_COMMENT_1};Tokenizer.prototype._stateAfterComment1=function(c){if(c==="-"){this._state=AFTER_COMMENT_2}else{this._state=IN_COMMENT}};Tokenizer.prototype._stateAfterComment2=function(c){if(c===">"){this._cbs.oncomment(this._buffer.substring(this._sectionStart,this._index-2));this._state=TEXT;this._sectionStart=this._index+1}else if(c!=="-"){this._state=IN_COMMENT}};Tokenizer.prototype._stateBeforeCdata1=ifElseState("C",BEFORE_CDATA_2,IN_DECLARATION);Tokenizer.prototype._stateBeforeCdata2=ifElseState("D",BEFORE_CDATA_3,IN_DECLARATION);Tokenizer.prototype._stateBeforeCdata3=ifElseState("A",BEFORE_CDATA_4,IN_DECLARATION);Tokenizer.prototype._stateBeforeCdata4=ifElseState("T",BEFORE_CDATA_5,IN_DECLARATION);Tokenizer.prototype._stateBeforeCdata5=ifElseState("A",BEFORE_CDATA_6,IN_DECLARATION);Tokenizer.prototype._stateBeforeCdata6=function(c){if(c==="["){this._state=IN_CDATA;this._sectionStart=this._index+1}else{this._state=IN_DECLARATION;this._index--}};Tokenizer.prototype._stateInCdata=function(c){if(c==="]")this._state=AFTER_CDATA_1};Tokenizer.prototype._stateAfterCdata1=characterState("]",AFTER_CDATA_2);Tokenizer.prototype._stateAfterCdata2=function(c){if(c===">"){this._cbs.oncdata(this._buffer.substring(this._sectionStart,this._index-2));this._state=TEXT;this._sectionStart=this._index+1}else if(c!=="]"){this._state=IN_CDATA}};Tokenizer.prototype._stateBeforeSpecial=function(c){if(c==="c"||c==="C"){this._state=BEFORE_SCRIPT_1}else if(c==="t"||c==="T"){this._state=BEFORE_STYLE_1}else{this._state=IN_TAG_NAME;this._index--}};Tokenizer.prototype._stateBeforeSpecialEnd=function(c){if(this._special===SPECIAL_SCRIPT&&(c==="c"||c==="C")){this._state=AFTER_SCRIPT_1}else if(this._special===SPECIAL_STYLE&&(c==="t"||c==="T")){this._state=AFTER_STYLE_1}else this._state=TEXT};Tokenizer.prototype._stateBeforeScript1=consumeSpecialNameChar("R",BEFORE_SCRIPT_2);Tokenizer.prototype._stateBeforeScript2=consumeSpecialNameChar("I",BEFORE_SCRIPT_3);Tokenizer.prototype._stateBeforeScript3=consumeSpecialNameChar("P",BEFORE_SCRIPT_4);Tokenizer.prototype._stateBeforeScript4=consumeSpecialNameChar("T",BEFORE_SCRIPT_5);Tokenizer.prototype._stateBeforeScript5=function(c){if(c==="/"||c===">"||whitespace(c)){this._special=SPECIAL_SCRIPT}this._state=IN_TAG_NAME;this._index--};Tokenizer.prototype._stateAfterScript1=ifElseState("R",AFTER_SCRIPT_2,TEXT);Tokenizer.prototype._stateAfterScript2=ifElseState("I",AFTER_SCRIPT_3,TEXT);Tokenizer.prototype._stateAfterScript3=ifElseState("P",AFTER_SCRIPT_4,TEXT);Tokenizer.prototype._stateAfterScript4=ifElseState("T",AFTER_SCRIPT_5,TEXT);Tokenizer.prototype._stateAfterScript5=function(c){if(c===">"||whitespace(c)){this._special=SPECIAL_NONE;this._state=IN_CLOSING_TAG_NAME;this._sectionStart=this._index-6;this._index--}else this._state=TEXT};Tokenizer.prototype._stateBeforeStyle1=consumeSpecialNameChar("Y",BEFORE_STYLE_2);Tokenizer.prototype._stateBeforeStyle2=consumeSpecialNameChar("L",BEFORE_STYLE_3);Tokenizer.prototype._stateBeforeStyle3=consumeSpecialNameChar("E",BEFORE_STYLE_4);Tokenizer.prototype._stateBeforeStyle4=function(c){if(c==="/"||c===">"||whitespace(c)){this._special=SPECIAL_STYLE}this._state=IN_TAG_NAME;this._index--};Tokenizer.prototype._stateAfterStyle1=ifElseState("Y",AFTER_STYLE_2,TEXT);Tokenizer.prototype._stateAfterStyle2=ifElseState("L",AFTER_STYLE_3,TEXT);Tokenizer.prototype._stateAfterStyle3=ifElseState("E",AFTER_STYLE_4,TEXT);Tokenizer.prototype._stateAfterStyle4=function(c){if(c===">"||whitespace(c)){this._special=SPECIAL_NONE;this._state=IN_CLOSING_TAG_NAME;this._sectionStart=this._index-5;this._index--}else this._state=TEXT};Tokenizer.prototype._stateBeforeEntity=ifElseState("#",BEFORE_NUMERIC_ENTITY,IN_NAMED_ENTITY);Tokenizer.prototype._stateBeforeNumericEntity=ifElseState("X",IN_HEX_ENTITY,IN_NUMERIC_ENTITY);Tokenizer.prototype._parseNamedEntityStrict=function(){if(this._sectionStart+1<this._index){var entity=this._buffer.substring(this._sectionStart+1,this._index),map=this._xmlMode?xmlMap:entityMap;if(map.hasOwnProperty(entity)){this._emitPartial(map[entity]);this._sectionStart=this._index+1}}};Tokenizer.prototype._parseLegacyEntity=function(){var start=this._sectionStart+1,limit=this._index-start;if(limit>6)limit=6;while(limit>=2){var entity=this._buffer.substr(start,limit);if(legacyMap.hasOwnProperty(entity)){this._emitPartial(legacyMap[entity]);this._sectionStart+=limit+1;return}else{limit--}}};Tokenizer.prototype._stateInNamedEntity=function(c){if(c===";"){this._parseNamedEntityStrict();if(this._sectionStart+1<this._index&&!this._xmlMode){this._parseLegacyEntity()}this._state=this._baseState}else if((c<"a"||c>"z")&&(c<"A"||c>"Z")&&(c<"0"||c>"9")){if(this._xmlMode);else if(this._sectionStart+1===this._index);else if(this._baseState!==TEXT){if(c!=="="){this._parseNamedEntityStrict()}}else{this._parseLegacyEntity()}this._state=this._baseState;this._index--}};Tokenizer.prototype._decodeNumericEntity=function(offset,base){var sectionStart=this._sectionStart+offset;if(sectionStart!==this._index){var entity=this._buffer.substring(sectionStart,this._index);var parsed=parseInt(entity,base);this._emitPartial(decodeCodePoint(parsed));this._sectionStart=this._index}else{this._sectionStart--}this._state=this._baseState};Tokenizer.prototype._stateInNumericEntity=function(c){if(c===";"){this._decodeNumericEntity(2,10);this._sectionStart++}else if(c<"0"||c>"9"){if(!this._xmlMode){this._decodeNumericEntity(2,10)}else{this._state=this._baseState}this._index--}};Tokenizer.prototype._stateInHexEntity=function(c){if(c===";"){this._decodeNumericEntity(3,16);this._sectionStart++}else if((c<"a"||c>"f")&&(c<"A"||c>"F")&&(c<"0"||c>"9")){if(!this._xmlMode){this._decodeNumericEntity(3,16)}else{this._state=this._baseState}this._index--}};Tokenizer.prototype._cleanup=function(){if(this._sectionStart<0){this._buffer="";this._index=0;this._bufferOffset+=this._index}else if(this._running){if(this._state===TEXT){if(this._sectionStart!==this._index){this._cbs.ontext(this._buffer.substr(this._sectionStart))}this._buffer="";this._bufferOffset+=this._index;this._index=0}else if(this._sectionStart===this._index){this._buffer="";this._bufferOffset+=this._index;this._index=0}else{this._buffer=this._buffer.substr(this._sectionStart);this._index-=this._sectionStart;this._bufferOffset+=this._sectionStart}this._sectionStart=0}};Tokenizer.prototype.write=function(chunk){if(this._ended)this._cbs.onerror(Error(".write() after done!"));this._buffer+=chunk;this._parse()};Tokenizer.prototype._parse=function(){while(this._index<this._buffer.length&&this._running){var c=this._buffer.charAt(this._index);if(this._state===TEXT){this._stateText(c)}else if(this._state===BEFORE_TAG_NAME){this._stateBeforeTagName(c)}else if(this._state===IN_TAG_NAME){this._stateInTagName(c)}else if(this._state===BEFORE_CLOSING_TAG_NAME){this._stateBeforeCloseingTagName(c)}else if(this._state===IN_CLOSING_TAG_NAME){this._stateInCloseingTagName(c)}else if(this._state===AFTER_CLOSING_TAG_NAME){this._stateAfterCloseingTagName(c)}else if(this._state===IN_SELF_CLOSING_TAG){this._stateInSelfClosingTag(c)}else if(this._state===BEFORE_ATTRIBUTE_NAME){this._stateBeforeAttributeName(c)}else if(this._state===IN_ATTRIBUTE_NAME){this._stateInAttributeName(c)}else if(this._state===AFTER_ATTRIBUTE_NAME){this._stateAfterAttributeName(c)}else if(this._state===BEFORE_ATTRIBUTE_VALUE){this._stateBeforeAttributeValue(c)}else if(this._state===IN_ATTRIBUTE_VALUE_DQ){this._stateInAttributeValueDoubleQuotes(c)}else if(this._state===IN_ATTRIBUTE_VALUE_SQ){this._stateInAttributeValueSingleQuotes(c)}else if(this._state===IN_ATTRIBUTE_VALUE_NQ){this._stateInAttributeValueNoQuotes(c)}else if(this._state===BEFORE_DECLARATION){this._stateBeforeDeclaration(c)}else if(this._state===IN_DECLARATION){this._stateInDeclaration(c)}else if(this._state===IN_PROCESSING_INSTRUCTION){this._stateInProcessingInstruction(c)}else if(this._state===BEFORE_COMMENT){this._stateBeforeComment(c)}else if(this._state===IN_COMMENT){this._stateInComment(c)}else if(this._state===AFTER_COMMENT_1){this._stateAfterComment1(c)}else if(this._state===AFTER_COMMENT_2){this._stateAfterComment2(c)}else if(this._state===BEFORE_CDATA_1){this._stateBeforeCdata1(c)}else if(this._state===BEFORE_CDATA_2){this._stateBeforeCdata2(c)}else if(this._state===BEFORE_CDATA_3){this._stateBeforeCdata3(c)}else if(this._state===BEFORE_CDATA_4){this._stateBeforeCdata4(c)}else if(this._state===BEFORE_CDATA_5){this._stateBeforeCdata5(c)}else if(this._state===BEFORE_CDATA_6){this._stateBeforeCdata6(c)}else if(this._state===IN_CDATA){this._stateInCdata(c)}else if(this._state===AFTER_CDATA_1){this._stateAfterCdata1(c)}else if(this._state===AFTER_CDATA_2){this._stateAfterCdata2(c)}else if(this._state===BEFORE_SPECIAL){this._stateBeforeSpecial(c)}else if(this._state===BEFORE_SPECIAL_END){this._stateBeforeSpecialEnd(c)}else if(this._state===BEFORE_SCRIPT_1){this._stateBeforeScript1(c)}else if(this._state===BEFORE_SCRIPT_2){this._stateBeforeScript2(c)}else if(this._state===BEFORE_SCRIPT_3){this._stateBeforeScript3(c)}else if(this._state===BEFORE_SCRIPT_4){this._stateBeforeScript4(c)}else if(this._state===BEFORE_SCRIPT_5){this._stateBeforeScript5(c)}else if(this._state===AFTER_SCRIPT_1){this._stateAfterScript1(c)}else if(this._state===AFTER_SCRIPT_2){this._stateAfterScript2(c)}else if(this._state===AFTER_SCRIPT_3){this._stateAfterScript3(c)}else if(this._state===AFTER_SCRIPT_4){this._stateAfterScript4(c)}else if(this._state===AFTER_SCRIPT_5){this._stateAfterScript5(c)}else if(this._state===BEFORE_STYLE_1){this._stateBeforeStyle1(c)}else if(this._state===BEFORE_STYLE_2){this._stateBeforeStyle2(c)}else if(this._state===BEFORE_STYLE_3){this._stateBeforeStyle3(c)}else if(this._state===BEFORE_STYLE_4){this._stateBeforeStyle4(c)}else if(this._state===AFTER_STYLE_1){this._stateAfterStyle1(c)}else if(this._state===AFTER_STYLE_2){this._stateAfterStyle2(c)}else if(this._state===AFTER_STYLE_3){this._stateAfterStyle3(c)}else if(this._state===AFTER_STYLE_4){this._stateAfterStyle4(c)}else if(this._state===BEFORE_ENTITY){this._stateBeforeEntity(c)}else if(this._state===BEFORE_NUMERIC_ENTITY){this._stateBeforeNumericEntity(c)}else if(this._state===IN_NAMED_ENTITY){this._stateInNamedEntity(c)}else if(this._state===IN_NUMERIC_ENTITY){this._stateInNumericEntity(c)}else if(this._state===IN_HEX_ENTITY){this._stateInHexEntity(c)}else{this._cbs.onerror(Error("unknown _state"),this._state)}this._index++}this._cleanup()};Tokenizer.prototype.pause=function(){this._running=false};Tokenizer.prototype.resume=function(){this._running=true;if(this._index<this._buffer.length){this._parse()}if(this._ended){this._finish()}};Tokenizer.prototype.end=function(chunk){if(this._ended)this._cbs.onerror(Error(".end() after done!"));if(chunk)this.write(chunk);this._ended=true;if(this._running)this._finish()};Tokenizer.prototype._finish=function(){if(this._sectionStart<this._index){this._handleTrailingData()}this._cbs.onend()};Tokenizer.prototype._handleTrailingData=function(){var data=this._buffer.substr(this._sectionStart);if(this._state===IN_CDATA||this._state===AFTER_CDATA_1||this._state===AFTER_CDATA_2){this._cbs.oncdata(data)}else if(this._state===IN_COMMENT||this._state===AFTER_COMMENT_1||this._state===AFTER_COMMENT_2){this._cbs.oncomment(data)}else if(this._state===IN_NAMED_ENTITY&&!this._xmlMode){this._parseLegacyEntity();if(this._sectionStart<this._index){this._state=this._baseState;this._handleTrailingData()}}else if(this._state===IN_NUMERIC_ENTITY&&!this._xmlMode){this._decodeNumericEntity(2,10);if(this._sectionStart<this._index){this._state=this._baseState;this._handleTrailingData()}}else if(this._state===IN_HEX_ENTITY&&!this._xmlMode){this._decodeNumericEntity(3,16);if(this._sectionStart<this._index){this._state=this._baseState;this._handleTrailingData()}}else if(this._state!==IN_TAG_NAME&&this._state!==BEFORE_ATTRIBUTE_NAME&&this._state!==BEFORE_ATTRIBUTE_VALUE&&this._state!==AFTER_ATTRIBUTE_NAME&&this._state!==IN_ATTRIBUTE_NAME&&this._state!==IN_ATTRIBUTE_VALUE_SQ&&this._state!==IN_ATTRIBUTE_VALUE_DQ&&this._state!==IN_ATTRIBUTE_VALUE_NQ&&this._state!==IN_CLOSING_TAG_NAME){ |
| 3143 | this._cbs.ontext(data)}};Tokenizer.prototype.reset=function(){Tokenizer.call(this,{xmlMode:this._xmlMode,decodeEntities:this._decodeEntities},this._cbs)};Tokenizer.prototype.getAbsoluteIndex=function(){return this._bufferOffset+this._index};Tokenizer.prototype._getSection=function(){return this._buffer.substring(this._sectionStart,this._index)};Tokenizer.prototype._emitToken=function(name){this._cbs[name](this._getSection());this._sectionStart=-1};Tokenizer.prototype._emitPartial=function(value){if(this._baseState!==TEXT){this._cbs.onattribdata(value)}else{this._cbs.ontext(value)}}},{"entities/lib/decode_codepoint.js":22,"entities/maps/entities.json":25,"entities/maps/legacy.json":26,"entities/maps/xml.json":27}],35:[function(require,module,exports){module.exports=Stream;var Parser=require("./Parser.js"),WritableStream=require("stream").Writable||require("readable-stream").Writable,StringDecoder=require("string_decoder").StringDecoder,Buffer=require("buffer").Buffer;function Stream(cbs,options){var parser=this._parser=new Parser(cbs,options);var decoder=this._decoder=new StringDecoder;WritableStream.call(this,{decodeStrings:false});this.once("finish",function(){parser.end(decoder.end())})}require("inherits")(Stream,WritableStream);WritableStream.prototype._write=function(chunk,encoding,cb){if(chunk instanceof Buffer)chunk=this._decoder.write(chunk);this._parser.write(chunk);cb()}},{"./Parser.js":31,buffer:5,inherits:38,"readable-stream":3,stream:55,string_decoder:56}],36:[function(require,module,exports){var Parser=require("./Parser.js"),DomHandler=require("domhandler");function defineProp(name,value){delete module.exports[name];module.exports[name]=value;return value}module.exports={Parser:Parser,Tokenizer:require("./Tokenizer.js"),ElementType:require("domelementtype"),DomHandler:DomHandler,get FeedHandler(){return defineProp("FeedHandler",require("./FeedHandler.js"))},get Stream(){return defineProp("Stream",require("./Stream.js"))},get WritableStream(){return defineProp("WritableStream",require("./WritableStream.js"))},get ProxyHandler(){return defineProp("ProxyHandler",require("./ProxyHandler.js"))},get DomUtils(){return defineProp("DomUtils",require("domutils"))},get CollectingHandler(){return defineProp("CollectingHandler",require("./CollectingHandler.js"))},DefaultHandler:DomHandler,get RssHandler(){return defineProp("RssHandler",this.FeedHandler)},parseDOM:function(data,options){var handler=new DomHandler(options);new Parser(handler,options).end(data);return handler.dom},parseFeed:function(feed,options){var handler=new module.exports.FeedHandler(options);new Parser(handler,options).end(feed);return handler.dom},createDomStream:function(cb,options,elementCb){var handler=new DomHandler(cb,options,elementCb);return new Parser(handler,options)},EVENTS:{attribute:2,cdatastart:0,cdataend:0,text:1,processinginstruction:2,comment:1,commentend:0,closetag:1,opentag:2,opentagname:1,error:1,end:0}}},{"./CollectingHandler.js":29,"./FeedHandler.js":30,"./Parser.js":31,"./ProxyHandler.js":32,"./Stream.js":33,"./Tokenizer.js":34,"./WritableStream.js":35,domelementtype:9,domhandler:10,domutils:13}],37:[function(require,module,exports){exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m;var eLen=nBytes*8-mLen-1;var eMax=(1<<eLen)-1;var eBias=eMax>>1;var nBits=-7;var i=isLE?nBytes-1:0;var d=isLE?-1:1;var s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8){}m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8){}if(e===0){e=1-eBias}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity}else{m=m+Math.pow(2,mLen);e=e-eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)};exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c;var eLen=nBytes*8-mLen-1;var eMax=(1<<eLen)-1;var eBias=eMax>>1;var rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0;var i=isLE?0:nBytes-1;var d=isLE?1:-1;var s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2}if(e+eBias>=1){value+=rt/c}else{value+=rt*Math.pow(2,1-eBias)}if(value*c>=2){e++;c/=2}if(e+eBias>=eMax){m=0;e=eMax}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0}}for(;mLen>=8;buffer[offset+i]=m&255,i+=d,m/=256,mLen-=8){}e=e<<mLen|m;eLen+=mLen;for(;eLen>0;buffer[offset+i]=e&255,i+=d,e/=256,eLen-=8){}buffer[offset+i-d]|=s*128}},{}],38:[function(require,module,exports){if(typeof Object.create==="function"){module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:false,writable:true,configurable:true}})}}else{module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor;ctor.prototype.constructor=ctor}}},{}],39:[function(require,module,exports){module.exports=function(obj){return obj!=null&&(isBuffer(obj)||isSlowBuffer(obj)||!!obj._isBuffer)};function isBuffer(obj){return!!obj.constructor&&typeof obj.constructor.isBuffer==="function"&&obj.constructor.isBuffer(obj)}function isSlowBuffer(obj){return typeof obj.readFloatLE==="function"&&typeof obj.slice==="function"&&isBuffer(obj.slice(0,0))}},{}],40:[function(require,module,exports){var toString={}.toString;module.exports=Array.isArray||function(arr){return toString.call(arr)=="[object Array]"}},{}],41:[function(require,module,exports){(function(process){"use strict";if(!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0){module.exports=nextTick}else{module.exports=process.nextTick}function nextTick(fn,arg1,arg2,arg3){if(typeof fn!=="function"){throw new TypeError('"callback" argument must be a function')}var len=arguments.length;var args,i;switch(len){case 0:case 1:return process.nextTick(fn);case 2:return process.nextTick(function afterTickOne(){fn.call(null,arg1)});case 3:return process.nextTick(function afterTickTwo(){fn.call(null,arg1,arg2)});case 4:return process.nextTick(function afterTickThree(){fn.call(null,arg1,arg2,arg3)});default:args=new Array(len-1);i=0;while(i<args.length){args[i++]=arguments[i]}return process.nextTick(function afterTick(){fn.apply(null,args)})}}}).call(this,require("_process"))},{_process:42}],42:[function(require,module,exports){var process=module.exports={};var cachedSetTimeout;var cachedClearTimeout;function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function"){cachedSetTimeout=setTimeout}else{cachedSetTimeout=defaultSetTimout}}catch(e){cachedSetTimeout=defaultSetTimout}try{if(typeof clearTimeout==="function"){cachedClearTimeout=clearTimeout}else{cachedClearTimeout=defaultClearTimeout}}catch(e){cachedClearTimeout=defaultClearTimeout}})();function runTimeout(fun){if(cachedSetTimeout===setTimeout){return setTimeout(fun,0)}if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout){cachedSetTimeout=setTimeout;return setTimeout(fun,0)}try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}function runClearTimeout(marker){if(cachedClearTimeout===clearTimeout){return clearTimeout(marker)}if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout){cachedClearTimeout=clearTimeout;return clearTimeout(marker)}try{return cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}var queue=[];var draining=false;var currentQueue;var queueIndex=-1;function cleanUpNextTick(){if(!draining||!currentQueue){return}draining=false;if(currentQueue.length){queue=currentQueue.concat(queue)}else{queueIndex=-1}if(queue.length){drainQueue()}}function drainQueue(){if(draining){return}var timeout=runTimeout(cleanUpNextTick);draining=true;var len=queue.length;while(len){currentQueue=queue;queue=[];while(++queueIndex<len){if(currentQueue){currentQueue[queueIndex].run()}}queueIndex=-1;len=queue.length}currentQueue=null;draining=false;runClearTimeout(timeout)}process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1){for(var i=1;i<arguments.length;i++){args[i-1]=arguments[i]}}queue.push(new Item(fun,args));if(queue.length===1&&!draining){runTimeout(drainQueue)}};function Item(fun,array){this.fun=fun;this.array=array}Item.prototype.run=function(){this.fun.apply(null,this.array)};process.title="browser";process.browser=true;process.env={};process.argv=[];process.version="";process.versions={};function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")};process.umask=function(){return 0}},{}],43:[function(require,module,exports){module.exports=require("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":44}],44:[function(require,module,exports){"use strict";var objectKeys=Object.keys||function(obj){var keys=[];for(var key in obj){keys.push(key)}return keys};module.exports=Duplex;var processNextTick=require("process-nextick-args");var util=require("core-util-is");util.inherits=require("inherits");var Readable=require("./_stream_readable");var Writable=require("./_stream_writable");util.inherits(Duplex,Readable);var keys=objectKeys(Writable.prototype);for(var v=0;v<keys.length;v++){var method=keys[v];if(!Duplex.prototype[method])Duplex.prototype[method]=Writable.prototype[method]}function Duplex(options){if(!(this instanceof Duplex))return new Duplex(options);Readable.call(this,options);Writable.call(this,options);if(options&&options.readable===false)this.readable=false;if(options&&options.writable===false)this.writable=false;this.allowHalfOpen=true;if(options&&options.allowHalfOpen===false)this.allowHalfOpen=false;this.once("end",onend)}function onend(){if(this.allowHalfOpen||this._writableState.ended)return;processNextTick(onEndNT,this)}function onEndNT(self){self.end()}function forEach(xs,f){for(var i=0,l=xs.length;i<l;i++){f(xs[i],i)}}},{"./_stream_readable":46,"./_stream_writable":48,"core-util-is":6,inherits:38,"process-nextick-args":41}],45:[function(require,module,exports){"use strict";module.exports=PassThrough;var Transform=require("./_stream_transform");var util=require("core-util-is");util.inherits=require("inherits");util.inherits(PassThrough,Transform);function PassThrough(options){if(!(this instanceof PassThrough))return new PassThrough(options);Transform.call(this,options)}PassThrough.prototype._transform=function(chunk,encoding,cb){cb(null,chunk)}},{"./_stream_transform":47,"core-util-is":6,inherits:38}],46:[function(require,module,exports){(function(process){"use strict";module.exports=Readable;var processNextTick=require("process-nextick-args");var isArray=require("isarray");Readable.ReadableState=ReadableState;var EE=require("events").EventEmitter;var EElistenerCount=function(emitter,type){return emitter.listeners(type).length};var Stream;(function(){try{Stream=require("st"+"ream")}catch(_){}finally{if(!Stream)Stream=require("events").EventEmitter}})();var Buffer=require("buffer").Buffer;var bufferShim=require("buffer-shims");var util=require("core-util-is");util.inherits=require("inherits");var debugUtil=require("util");var debug=void 0;if(debugUtil&&debugUtil.debuglog){debug=debugUtil.debuglog("stream")}else{debug=function(){}}var BufferList=require("./internal/streams/BufferList");var StringDecoder;util.inherits(Readable,Stream);function prependListener(emitter,event,fn){if(typeof emitter.prependListener==="function"){return emitter.prependListener(event,fn)}else{if(!emitter._events||!emitter._events[event])emitter.on(event,fn);else if(isArray(emitter._events[event]))emitter._events[event].unshift(fn);else emitter._events[event]=[fn,emitter._events[event]]}}var Duplex;function ReadableState(options,stream){Duplex=Duplex||require("./_stream_duplex");options=options||{};this.objectMode=!!options.objectMode;if(stream instanceof Duplex)this.objectMode=this.objectMode||!!options.readableObjectMode;var hwm=options.highWaterMark;var defaultHwm=this.objectMode?16:16*1024;this.highWaterMark=hwm||hwm===0?hwm:defaultHwm;this.highWaterMark=~~this.highWaterMark;this.buffer=new BufferList;this.length=0;this.pipes=null;this.pipesCount=0;this.flowing=null;this.ended=false;this.endEmitted=false;this.reading=false;this.sync=true;this.needReadable=false;this.emittedReadable=false;this.readableListening=false;this.resumeScheduled=false;this.defaultEncoding=options.defaultEncoding||"utf8";this.ranOut=false;this.awaitDrain=0;this.readingMore=false;this.decoder=null;this.encoding=null;if(options.encoding){if(!StringDecoder)StringDecoder=require("string_decoder/").StringDecoder;this.decoder=new StringDecoder(options.encoding);this.encoding=options.encoding}}var Duplex;function Readable(options){Duplex=Duplex||require("./_stream_duplex");if(!(this instanceof Readable))return new Readable(options);this._readableState=new ReadableState(options,this);this.readable=true;if(options&&typeof options.read==="function")this._read=options.read;Stream.call(this)}Readable.prototype.push=function(chunk,encoding){var state=this._readableState;if(!state.objectMode&&typeof chunk==="string"){encoding=encoding||state.defaultEncoding;if(encoding!==state.encoding){chunk=bufferShim.from(chunk,encoding);encoding=""}}return readableAddChunk(this,state,chunk,encoding,false)};Readable.prototype.unshift=function(chunk){var state=this._readableState;return readableAddChunk(this,state,chunk,"",true)};Readable.prototype.isPaused=function(){return this._readableState.flowing===false};function readableAddChunk(stream,state,chunk,encoding,addToFront){var er=chunkInvalid(state,chunk);if(er){stream.emit("error",er)}else if(chunk===null){state.reading=false;onEofChunk(stream,state)}else if(state.objectMode||chunk&&chunk.length>0){if(state.ended&&!addToFront){var e=new Error("stream.push() after EOF");stream.emit("error",e)}else if(state.endEmitted&&addToFront){var _e=new Error("stream.unshift() after end event");stream.emit("error",_e)}else{var skipAdd;if(state.decoder&&!addToFront&&!encoding){chunk=state.decoder.write(chunk);skipAdd=!state.objectMode&&chunk.length===0}if(!addToFront)state.reading=false;if(!skipAdd){if(state.flowing&&state.length===0&&!state.sync){stream.emit("data",chunk);stream.read(0)}else{state.length+=state.objectMode?1:chunk.length;if(addToFront)state.buffer.unshift(chunk);else state.buffer.push(chunk);if(state.needReadable)emitReadable(stream)}}maybeReadMore(stream,state)}}else if(!addToFront){state.reading=false}return needMoreData(state)}function needMoreData(state){return!state.ended&&(state.needReadable||state.length<state.highWaterMark||state.length===0)}Readable.prototype.setEncoding=function(enc){if(!StringDecoder)StringDecoder=require("string_decoder/").StringDecoder;this._readableState.decoder=new StringDecoder(enc);this._readableState.encoding=enc;return this};var MAX_HWM=8388608;function computeNewHighWaterMark(n){if(n>=MAX_HWM){n=MAX_HWM}else{n--;n|=n>>>1;n|=n>>>2;n|=n>>>4;n|=n>>>8;n|=n>>>16;n++}return n}function howMuchToRead(n,state){if(n<=0||state.length===0&&state.ended)return 0;if(state.objectMode)return 1;if(n!==n){if(state.flowing&&state.length)return state.buffer.head.data.length;else return state.length}if(n>state.highWaterMark)state.highWaterMark=computeNewHighWaterMark(n);if(n<=state.length)return n;if(!state.ended){state.needReadable=true;return 0}return state.length}Readable.prototype.read=function(n){debug("read",n);n=parseInt(n,10);var state=this._readableState;var nOrig=n;if(n!==0)state.emittedReadable=false;if(n===0&&state.needReadable&&(state.length>=state.highWaterMark||state.ended)){debug("read: emitReadable",state.length,state.ended);if(state.length===0&&state.ended)endReadable(this);else emitReadable(this);return null}n=howMuchToRead(n,state);if(n===0&&state.ended){if(state.length===0)endReadable(this);return null}var doRead=state.needReadable;debug("need readable",doRead);if(state.length===0||state.length-n<state.highWaterMark){doRead=true;debug("length less than watermark",doRead)}if(state.ended||state.reading){doRead=false;debug("reading or ended",doRead)}else if(doRead){debug("do read");state.reading=true;state.sync=true;if(state.length===0)state.needReadable=true;this._read(state.highWaterMark);state.sync=false;if(!state.reading)n=howMuchToRead(nOrig,state)}var ret;if(n>0)ret=fromList(n,state);else ret=null;if(ret===null){state.needReadable=true;n=0}else{state.length-=n}if(state.length===0){if(!state.ended)state.needReadable=true;if(nOrig!==n&&state.ended)endReadable(this)}if(ret!==null)this.emit("data",ret);return ret};function chunkInvalid(state,chunk){var er=null;if(!Buffer.isBuffer(chunk)&&typeof chunk!=="string"&&chunk!==null&&chunk!==undefined&&!state.objectMode){er=new TypeError("Invalid non-string/buffer chunk")}return er}function onEofChunk(stream,state){if(state.ended)return;if(state.decoder){var chunk=state.decoder.end();if(chunk&&chunk.length){state.buffer.push(chunk);state.length+=state.objectMode?1:chunk.length}}state.ended=true;emitReadable(stream)}function emitReadable(stream){var state=stream._readableState;state.needReadable=false;if(!state.emittedReadable){debug("emitReadable",state.flowing);state.emittedReadable=true;if(state.sync)processNextTick(emitReadable_,stream);else emitReadable_(stream)}}function emitReadable_(stream){debug("emit readable");stream.emit("readable");flow(stream)}function maybeReadMore(stream,state){if(!state.readingMore){state.readingMore=true;processNextTick(maybeReadMore_,stream,state)}}function maybeReadMore_(stream,state){var len=state.length;while(!state.reading&&!state.flowing&&!state.ended&&state.length<state.highWaterMark){debug("maybeReadMore read 0");stream.read(0);if(len===state.length)break;else len=state.length}state.readingMore=false}Readable.prototype._read=function(n){this.emit("error",new Error("not implemented"))};Readable.prototype.pipe=function(dest,pipeOpts){var src=this;var state=this._readableState;switch(state.pipesCount){case 0:state.pipes=dest;break;case 1:state.pipes=[state.pipes,dest];break;default:state.pipes.push(dest);break}state.pipesCount+=1;debug("pipe count=%d opts=%j",state.pipesCount,pipeOpts);var doEnd=(!pipeOpts||pipeOpts.end!==false)&&dest!==process.stdout&&dest!==process.stderr;var endFn=doEnd?onend:cleanup;if(state.endEmitted)processNextTick(endFn);else src.once("end",endFn);dest.on("unpipe",onunpipe);function onunpipe(readable){debug("onunpipe");if(readable===src){cleanup()}}function onend(){debug("onend");dest.end()}var ondrain=pipeOnDrain(src);dest.on("drain",ondrain);var cleanedUp=false;function cleanup(){debug("cleanup");dest.removeListener("close",onclose);dest.removeListener("finish",onfinish);dest.removeListener("drain",ondrain);dest.removeListener("error",onerror);dest.removeListener("unpipe",onunpipe);src.removeListener("end",onend);src.removeListener("end",cleanup);src.removeListener("data",ondata);cleanedUp=true;if(state.awaitDrain&&(!dest._writableState||dest._writableState.needDrain))ondrain()}var increasedAwaitDrain=false;src.on("data",ondata);function ondata(chunk){debug("ondata");increasedAwaitDrain=false;var ret=dest.write(chunk);if(false===ret&&!increasedAwaitDrain){if((state.pipesCount===1&&state.pipes===dest||state.pipesCount>1&&indexOf(state.pipes,dest)!==-1)&&!cleanedUp){debug("false write response, pause",src._readableState.awaitDrain);src._readableState.awaitDrain++;increasedAwaitDrain=true}src.pause()}}function onerror(er){debug("onerror",er);unpipe();dest.removeListener("error",onerror);if(EElistenerCount(dest,"error")===0)dest.emit("error",er)}prependListener(dest,"error",onerror);function onclose(){dest.removeListener("finish",onfinish);unpipe()}dest.once("close",onclose);function onfinish(){debug("onfinish");dest.removeListener("close",onclose);unpipe()}dest.once("finish",onfinish);function unpipe(){debug("unpipe");src.unpipe(dest)}dest.emit("pipe",src);if(!state.flowing){debug("pipe resume");src.resume()}return dest};function pipeOnDrain(src){return function(){var state=src._readableState;debug("pipeOnDrain",state.awaitDrain);if(state.awaitDrain)state.awaitDrain--;if(state.awaitDrain===0&&EElistenerCount(src,"data")){state.flowing=true;flow(src)}}}Readable.prototype.unpipe=function(dest){var state=this._readableState;if(state.pipesCount===0)return this;if(state.pipesCount===1){if(dest&&dest!==state.pipes)return this;if(!dest)dest=state.pipes;state.pipes=null;state.pipesCount=0;state.flowing=false;if(dest)dest.emit("unpipe",this);return this}if(!dest){var dests=state.pipes;var len=state.pipesCount;state.pipes=null;state.pipesCount=0;state.flowing=false;for(var _i=0;_i<len;_i++){dests[_i].emit("unpipe",this)}return this}var i=indexOf(state.pipes,dest);if(i===-1)return this;state.pipes.splice(i,1);state.pipesCount-=1;if(state.pipesCount===1)state.pipes=state.pipes[0];dest.emit("unpipe",this);return this};Readable.prototype.on=function(ev,fn){var res=Stream.prototype.on.call(this,ev,fn);if(ev==="data"){if(this._readableState.flowing!==false)this.resume()}else if(ev==="readable"){var state=this._readableState;if(!state.endEmitted&&!state.readableListening){state.readableListening=state.needReadable=true;state.emittedReadable=false;if(!state.reading){processNextTick(nReadingNextTick,this)}else if(state.length){emitReadable(this,state)}}}return res};Readable.prototype.addListener=Readable.prototype.on;function nReadingNextTick(self){debug("readable nexttick read 0");self.read(0)}Readable.prototype.resume=function(){var state=this._readableState;if(!state.flowing){debug("resume");state.flowing=true;resume(this,state)}return this};function resume(stream,state){if(!state.resumeScheduled){state.resumeScheduled=true;processNextTick(resume_,stream,state)}}function resume_(stream,state){if(!state.reading){debug("resume read 0");stream.read(0)}state.resumeScheduled=false;state.awaitDrain=0;stream.emit("resume");flow(stream);if(state.flowing&&!state.reading)stream.read(0)}Readable.prototype.pause=function(){debug("call pause flowing=%j",this._readableState.flowing);if(false!==this._readableState.flowing){debug("pause");this._readableState.flowing=false;this.emit("pause")}return this};function flow(stream){var state=stream._readableState;debug("flow",state.flowing);while(state.flowing&&stream.read()!==null){}}Readable.prototype.wrap=function(stream){var state=this._readableState;var paused=false;var self=this;stream.on("end",function(){debug("wrapped end");if(state.decoder&&!state.ended){var chunk=state.decoder.end();if(chunk&&chunk.length)self.push(chunk)}self.push(null)});stream.on("data",function(chunk){debug("wrapped data");if(state.decoder)chunk=state.decoder.write(chunk);if(state.objectMode&&(chunk===null||chunk===undefined))return;else if(!state.objectMode&&(!chunk||!chunk.length))return;var ret=self.push(chunk);if(!ret){paused=true;stream.pause()}});for(var i in stream){if(this[i]===undefined&&typeof stream[i]==="function"){this[i]=function(method){return function(){return stream[method].apply(stream,arguments)}}(i)}}var events=["error","close","destroy","pause","resume"];forEach(events,function(ev){stream.on(ev,self.emit.bind(self,ev))});self._read=function(n){debug("wrapped _read",n);if(paused){paused=false;stream.resume()}};return self};Readable._fromList=fromList;function fromList(n,state){if(state.length===0)return null;var ret;if(state.objectMode)ret=state.buffer.shift();else if(!n||n>=state.length){if(state.decoder)ret=state.buffer.join("");else if(state.buffer.length===1)ret=state.buffer.head.data;else ret=state.buffer.concat(state.length);state.buffer.clear()}else{ret=fromListPartial(n,state.buffer,state.decoder)}return ret}function fromListPartial(n,list,hasStrings){var ret;if(n<list.head.data.length){ret=list.head.data.slice(0,n);list.head.data=list.head.data.slice(n)}else if(n===list.head.data.length){ret=list.shift()}else{ret=hasStrings?copyFromBufferString(n,list):copyFromBuffer(n,list)}return ret}function copyFromBufferString(n,list){var p=list.head;var c=1;var ret=p.data;n-=ret.length;while(p=p.next){var str=p.data;var nb=n>str.length?str.length:n;if(nb===str.length)ret+=str;else ret+=str.slice(0,n);n-=nb;if(n===0){if(nb===str.length){++c;if(p.next)list.head=p.next;else list.head=list.tail=null}else{list.head=p;p.data=str.slice(nb)}break}++c}list.length-=c;return ret}function copyFromBuffer(n,list){var ret=bufferShim.allocUnsafe(n);var p=list.head;var c=1;p.data.copy(ret);n-=p.data.length;while(p=p.next){var buf=p.data;var nb=n>buf.length?buf.length:n;buf.copy(ret,ret.length-n,0,nb);n-=nb;if(n===0){if(nb===buf.length){++c;if(p.next)list.head=p.next;else list.head=list.tail=null}else{list.head=p;p.data=buf.slice(nb)}break}++c}list.length-=c;return ret}function endReadable(stream){var state=stream._readableState;if(state.length>0)throw new Error('"endReadable()" called on non-empty stream');if(!state.endEmitted){state.ended=true;processNextTick(endReadableNT,state,stream)}}function endReadableNT(state,stream){if(!state.endEmitted&&state.length===0){state.endEmitted=true;stream.readable=false;stream.emit("end")}}function forEach(xs,f){for(var i=0,l=xs.length;i<l;i++){f(xs[i],i)}}function indexOf(xs,x){for(var i=0,l=xs.length;i<l;i++){if(xs[i]===x)return i}return-1}}).call(this,require("_process"))},{"./_stream_duplex":44,"./internal/streams/BufferList":49,_process:42,buffer:5,"buffer-shims":4,"core-util-is":6,events:28,inherits:38,isarray:40,"process-nextick-args":41,"string_decoder/":56,util:3}],47:[function(require,module,exports){"use strict";module.exports=Transform;var Duplex=require("./_stream_duplex");var util=require("core-util-is");util.inherits=require("inherits");util.inherits(Transform,Duplex);function TransformState(stream){this.afterTransform=function(er,data){return afterTransform(stream,er,data)};this.needTransform=false;this.transforming=false;this.writecb=null;this.writechunk=null;this.writeencoding=null}function afterTransform(stream,er,data){var ts=stream._transformState;ts.transforming=false;var cb=ts.writecb;if(!cb)return stream.emit("error",new Error("no writecb in Transform class"));ts.writechunk=null;ts.writecb=null;if(data!==null&&data!==undefined)stream.push(data);cb(er);var rs=stream._readableState;rs.reading=false;if(rs.needReadable||rs.length<rs.highWaterMark){stream._read(rs.highWaterMark)}}function Transform(options){if(!(this instanceof Transform))return new Transform(options);Duplex.call(this,options);this._transformState=new TransformState(this);var stream=this;this._readableState.needReadable=true;this._readableState.sync=false;if(options){if(typeof options.transform==="function")this._transform=options.transform;if(typeof options.flush==="function")this._flush=options.flush}this.once("prefinish",function(){if(typeof this._flush==="function")this._flush(function(er){done(stream,er)});else done(stream)})}Transform.prototype.push=function(chunk,encoding){this._transformState.needTransform=false;return Duplex.prototype.push.call(this,chunk,encoding)};Transform.prototype._transform=function(chunk,encoding,cb){throw new Error("Not implemented")};Transform.prototype._write=function(chunk,encoding,cb){var ts=this._transformState;ts.writecb=cb;ts.writechunk=chunk;ts.writeencoding=encoding;if(!ts.transforming){var rs=this._readableState;if(ts.needTransform||rs.needReadable||rs.length<rs.highWaterMark)this._read(rs.highWaterMark)}};Transform.prototype._read=function(n){var ts=this._transformState;if(ts.writechunk!==null&&ts.writecb&&!ts.transforming){ts.transforming=true;this._transform(ts.writechunk,ts.writeencoding,ts.afterTransform)}else{ts.needTransform=true}};function done(stream,er){if(er)return stream.emit("error",er);var ws=stream._writableState;var ts=stream._transformState;if(ws.length)throw new Error("Calling transform done when ws.length != 0");if(ts.transforming)throw new Error("Calling transform done when still transforming");return stream.push(null)}},{"./_stream_duplex":44,"core-util-is":6,inherits:38}],48:[function(require,module,exports){(function(process){"use strict";module.exports=Writable;var processNextTick=require("process-nextick-args");var asyncWrite=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:processNextTick;Writable.WritableState=WritableState;var util=require("core-util-is");util.inherits=require("inherits");var internalUtil={deprecate:require("util-deprecate")};var Stream;(function(){try{Stream=require("st"+"ream")}catch(_){}finally{if(!Stream)Stream=require("events").EventEmitter}})();var Buffer=require("buffer").Buffer;var bufferShim=require("buffer-shims");util.inherits(Writable,Stream);function nop(){}function WriteReq(chunk,encoding,cb){this.chunk=chunk;this.encoding=encoding;this.callback=cb;this.next=null}var Duplex;function WritableState(options,stream){Duplex=Duplex||require("./_stream_duplex");options=options||{};this.objectMode=!!options.objectMode;if(stream instanceof Duplex)this.objectMode=this.objectMode||!!options.writableObjectMode;var hwm=options.highWaterMark;var defaultHwm=this.objectMode?16:16*1024;this.highWaterMark=hwm||hwm===0?hwm:defaultHwm;this.highWaterMark=~~this.highWaterMark;this.needDrain=false;this.ending=false;this.ended=false;this.finished=false;var noDecode=options.decodeStrings===false;this.decodeStrings=!noDecode;this.defaultEncoding=options.defaultEncoding||"utf8";this.length=0;this.writing=false;this.corked=0;this.sync=true;this.bufferProcessing=false;this.onwrite=function(er){onwrite(stream,er)};this.writecb=null;this.writelen=0;this.bufferedRequest=null;this.lastBufferedRequest=null;this.pendingcb=0;this.prefinished=false;this.errorEmitted=false;this.bufferedRequestCount=0;this.corkedRequestsFree=new CorkedRequest(this)}WritableState.prototype.getBuffer=function writableStateGetBuffer(){var current=this.bufferedRequest;var out=[];while(current){out.push(current);current=current.next}return out};(function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:internalUtil.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer "+"instead.")})}catch(_){}})();var Duplex;function Writable(options){Duplex=Duplex||require("./_stream_duplex");if(!(this instanceof Writable)&&!(this instanceof Duplex))return new Writable(options);this._writableState=new WritableState(options,this);this.writable=true;if(options){if(typeof options.write==="function")this._write=options.write;if(typeof options.writev==="function")this._writev=options.writev}Stream.call(this)}Writable.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function writeAfterEnd(stream,cb){var er=new Error("write after end");stream.emit("error",er);processNextTick(cb,er)}function validChunk(stream,state,chunk,cb){var valid=true;var er=false;if(chunk===null){er=new TypeError("May not write null values to stream")}else if(!Buffer.isBuffer(chunk)&&typeof chunk!=="string"&&chunk!==undefined&&!state.objectMode){er=new TypeError("Invalid non-string/buffer chunk")}if(er){stream.emit("error",er);processNextTick(cb,er);valid=false}return valid}Writable.prototype.write=function(chunk,encoding,cb){var state=this._writableState;var ret=false;if(typeof encoding==="function"){cb=encoding;encoding=null}if(Buffer.isBuffer(chunk))encoding="buffer";else if(!encoding)encoding=state.defaultEncoding;if(typeof cb!=="function")cb=nop;if(state.ended)writeAfterEnd(this,cb);else if(validChunk(this,state,chunk,cb)){ |
| 3144 | state.pendingcb++;ret=writeOrBuffer(this,state,chunk,encoding,cb)}return ret};Writable.prototype.cork=function(){var state=this._writableState;state.corked++};Writable.prototype.uncork=function(){var state=this._writableState;if(state.corked){state.corked--;if(!state.writing&&!state.corked&&!state.finished&&!state.bufferProcessing&&state.bufferedRequest)clearBuffer(this,state)}};Writable.prototype.setDefaultEncoding=function setDefaultEncoding(encoding){if(typeof encoding==="string")encoding=encoding.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((encoding+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+encoding);this._writableState.defaultEncoding=encoding;return this};function decodeChunk(state,chunk,encoding){if(!state.objectMode&&state.decodeStrings!==false&&typeof chunk==="string"){chunk=bufferShim.from(chunk,encoding)}return chunk}function writeOrBuffer(stream,state,chunk,encoding,cb){chunk=decodeChunk(state,chunk,encoding);if(Buffer.isBuffer(chunk))encoding="buffer";var len=state.objectMode?1:chunk.length;state.length+=len;var ret=state.length<state.highWaterMark;if(!ret)state.needDrain=true;if(state.writing||state.corked){var last=state.lastBufferedRequest;state.lastBufferedRequest=new WriteReq(chunk,encoding,cb);if(last){last.next=state.lastBufferedRequest}else{state.bufferedRequest=state.lastBufferedRequest}state.bufferedRequestCount+=1}else{doWrite(stream,state,false,len,chunk,encoding,cb)}return ret}function doWrite(stream,state,writev,len,chunk,encoding,cb){state.writelen=len;state.writecb=cb;state.writing=true;state.sync=true;if(writev)stream._writev(chunk,state.onwrite);else stream._write(chunk,encoding,state.onwrite);state.sync=false}function onwriteError(stream,state,sync,er,cb){--state.pendingcb;if(sync)processNextTick(cb,er);else cb(er);stream._writableState.errorEmitted=true;stream.emit("error",er)}function onwriteStateUpdate(state){state.writing=false;state.writecb=null;state.length-=state.writelen;state.writelen=0}function onwrite(stream,er){var state=stream._writableState;var sync=state.sync;var cb=state.writecb;onwriteStateUpdate(state);if(er)onwriteError(stream,state,sync,er,cb);else{var finished=needFinish(state);if(!finished&&!state.corked&&!state.bufferProcessing&&state.bufferedRequest){clearBuffer(stream,state)}if(sync){asyncWrite(afterWrite,stream,state,finished,cb)}else{afterWrite(stream,state,finished,cb)}}}function afterWrite(stream,state,finished,cb){if(!finished)onwriteDrain(stream,state);state.pendingcb--;cb();finishMaybe(stream,state)}function onwriteDrain(stream,state){if(state.length===0&&state.needDrain){state.needDrain=false;stream.emit("drain")}}function clearBuffer(stream,state){state.bufferProcessing=true;var entry=state.bufferedRequest;if(stream._writev&&entry&&entry.next){var l=state.bufferedRequestCount;var buffer=new Array(l);var holder=state.corkedRequestsFree;holder.entry=entry;var count=0;while(entry){buffer[count]=entry;entry=entry.next;count+=1}doWrite(stream,state,true,state.length,buffer,"",holder.finish);state.pendingcb++;state.lastBufferedRequest=null;if(holder.next){state.corkedRequestsFree=holder.next;holder.next=null}else{state.corkedRequestsFree=new CorkedRequest(state)}}else{while(entry){var chunk=entry.chunk;var encoding=entry.encoding;var cb=entry.callback;var len=state.objectMode?1:chunk.length;doWrite(stream,state,false,len,chunk,encoding,cb);entry=entry.next;if(state.writing){break}}if(entry===null)state.lastBufferedRequest=null}state.bufferedRequestCount=0;state.bufferedRequest=entry;state.bufferProcessing=false}Writable.prototype._write=function(chunk,encoding,cb){cb(new Error("not implemented"))};Writable.prototype._writev=null;Writable.prototype.end=function(chunk,encoding,cb){var state=this._writableState;if(typeof chunk==="function"){cb=chunk;chunk=null;encoding=null}else if(typeof encoding==="function"){cb=encoding;encoding=null}if(chunk!==null&&chunk!==undefined)this.write(chunk,encoding);if(state.corked){state.corked=1;this.uncork()}if(!state.ending&&!state.finished)endWritable(this,state,cb)};function needFinish(state){return state.ending&&state.length===0&&state.bufferedRequest===null&&!state.finished&&!state.writing}function prefinish(stream,state){if(!state.prefinished){state.prefinished=true;stream.emit("prefinish")}}function finishMaybe(stream,state){var need=needFinish(state);if(need){if(state.pendingcb===0){prefinish(stream,state);state.finished=true;stream.emit("finish")}else{prefinish(stream,state)}}return need}function endWritable(stream,state,cb){state.ending=true;finishMaybe(stream,state);if(cb){if(state.finished)processNextTick(cb);else stream.once("finish",cb)}state.ended=true;stream.writable=false}function CorkedRequest(state){var _this=this;this.next=null;this.entry=null;this.finish=function(err){var entry=_this.entry;_this.entry=null;while(entry){var cb=entry.callback;state.pendingcb--;cb(err);entry=entry.next}if(state.corkedRequestsFree){state.corkedRequestsFree.next=_this}else{state.corkedRequestsFree=_this}}}}).call(this,require("_process"))},{"./_stream_duplex":44,_process:42,buffer:5,"buffer-shims":4,"core-util-is":6,events:28,inherits:38,"process-nextick-args":41,"util-deprecate":57}],49:[function(require,module,exports){"use strict";var Buffer=require("buffer").Buffer;var bufferShim=require("buffer-shims");module.exports=BufferList;function BufferList(){this.head=null;this.tail=null;this.length=0}BufferList.prototype.push=function(v){var entry={data:v,next:null};if(this.length>0)this.tail.next=entry;else this.head=entry;this.tail=entry;++this.length};BufferList.prototype.unshift=function(v){var entry={data:v,next:this.head};if(this.length===0)this.tail=entry;this.head=entry;++this.length};BufferList.prototype.shift=function(){if(this.length===0)return;var ret=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;--this.length;return ret};BufferList.prototype.clear=function(){this.head=this.tail=null;this.length=0};BufferList.prototype.join=function(s){if(this.length===0)return"";var p=this.head;var ret=""+p.data;while(p=p.next){ret+=s+p.data}return ret};BufferList.prototype.concat=function(n){if(this.length===0)return bufferShim.alloc(0);if(this.length===1)return this.head.data;var ret=bufferShim.allocUnsafe(n>>>0);var p=this.head;var i=0;while(p){p.data.copy(ret,i);i+=p.data.length;p=p.next}return ret}},{buffer:5,"buffer-shims":4}],50:[function(require,module,exports){module.exports=require("./lib/_stream_passthrough.js")},{"./lib/_stream_passthrough.js":45}],51:[function(require,module,exports){(function(process){var Stream=function(){try{return require("st"+"ream")}catch(_){}}();exports=module.exports=require("./lib/_stream_readable.js");exports.Stream=Stream||exports;exports.Readable=exports;exports.Writable=require("./lib/_stream_writable.js");exports.Duplex=require("./lib/_stream_duplex.js");exports.Transform=require("./lib/_stream_transform.js");exports.PassThrough=require("./lib/_stream_passthrough.js");if(!process.browser&&process.env.READABLE_STREAM==="disable"&&Stream){module.exports=Stream}}).call(this,require("_process"))},{"./lib/_stream_duplex.js":44,"./lib/_stream_passthrough.js":45,"./lib/_stream_readable.js":46,"./lib/_stream_transform.js":47,"./lib/_stream_writable.js":48,_process:42}],52:[function(require,module,exports){module.exports=require("./lib/_stream_transform.js")},{"./lib/_stream_transform.js":47}],53:[function(require,module,exports){module.exports=require("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":48}],54:[function(require,module,exports){module.exports=function(string){return string.replace(/[-\\^$*+?.()|[\]{}]/g,"\\$&")}},{}],55:[function(require,module,exports){module.exports=Stream;var EE=require("events").EventEmitter;var inherits=require("inherits");inherits(Stream,EE);Stream.Readable=require("readable-stream/readable.js");Stream.Writable=require("readable-stream/writable.js");Stream.Duplex=require("readable-stream/duplex.js");Stream.Transform=require("readable-stream/transform.js");Stream.PassThrough=require("readable-stream/passthrough.js");Stream.Stream=Stream;function Stream(){EE.call(this)}Stream.prototype.pipe=function(dest,options){var source=this;function ondata(chunk){if(dest.writable){if(false===dest.write(chunk)&&source.pause){source.pause()}}}source.on("data",ondata);function ondrain(){if(source.readable&&source.resume){source.resume()}}dest.on("drain",ondrain);if(!dest._isStdio&&(!options||options.end!==false)){source.on("end",onend);source.on("close",onclose)}var didOnEnd=false;function onend(){if(didOnEnd)return;didOnEnd=true;dest.end()}function onclose(){if(didOnEnd)return;didOnEnd=true;if(typeof dest.destroy==="function")dest.destroy()}function onerror(er){cleanup();if(EE.listenerCount(this,"error")===0){throw er}}source.on("error",onerror);dest.on("error",onerror);function cleanup(){source.removeListener("data",ondata);dest.removeListener("drain",ondrain);source.removeListener("end",onend);source.removeListener("close",onclose);source.removeListener("error",onerror);dest.removeListener("error",onerror);source.removeListener("end",cleanup);source.removeListener("close",cleanup);dest.removeListener("close",cleanup)}source.on("end",cleanup);source.on("close",cleanup);dest.on("close",cleanup);dest.emit("pipe",source);return dest}},{events:28,inherits:38,"readable-stream/duplex.js":43,"readable-stream/passthrough.js":50,"readable-stream/readable.js":51,"readable-stream/transform.js":52,"readable-stream/writable.js":53}],56:[function(require,module,exports){var Buffer=require("buffer").Buffer;var isBufferEncoding=Buffer.isEncoding||function(encoding){switch(encoding&&encoding.toLowerCase()){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;default:return false}};function assertEncoding(encoding){if(encoding&&!isBufferEncoding(encoding)){throw new Error("Unknown encoding: "+encoding)}}var StringDecoder=exports.StringDecoder=function(encoding){this.encoding=(encoding||"utf8").toLowerCase().replace(/[-_]/,"");assertEncoding(encoding);switch(this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2;this.detectIncompleteChar=utf16DetectIncompleteChar;break;case"base64":this.surrogateSize=3;this.detectIncompleteChar=base64DetectIncompleteChar;break;default:this.write=passThroughWrite;return}this.charBuffer=new Buffer(6);this.charReceived=0;this.charLength=0};StringDecoder.prototype.write=function(buffer){var charStr="";while(this.charLength){var available=buffer.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:buffer.length;buffer.copy(this.charBuffer,this.charReceived,0,available);this.charReceived+=available;if(this.charReceived<this.charLength){return""}buffer=buffer.slice(available,buffer.length);charStr=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var charCode=charStr.charCodeAt(charStr.length-1);if(charCode>=55296&&charCode<=56319){this.charLength+=this.surrogateSize;charStr="";continue}this.charReceived=this.charLength=0;if(buffer.length===0){return charStr}break}this.detectIncompleteChar(buffer);var end=buffer.length;if(this.charLength){buffer.copy(this.charBuffer,0,buffer.length-this.charReceived,end);end-=this.charReceived}charStr+=buffer.toString(this.encoding,0,end);var end=charStr.length-1;var charCode=charStr.charCodeAt(end);if(charCode>=55296&&charCode<=56319){var size=this.surrogateSize;this.charLength+=size;this.charReceived+=size;this.charBuffer.copy(this.charBuffer,size,0,size);buffer.copy(this.charBuffer,0,0,size);return charStr.substring(0,end)}return charStr};StringDecoder.prototype.detectIncompleteChar=function(buffer){var i=buffer.length>=3?3:buffer.length;for(;i>0;i--){var c=buffer[buffer.length-i];if(i==1&&c>>5==6){this.charLength=2;break}if(i<=2&&c>>4==14){this.charLength=3;break}if(i<=3&&c>>3==30){this.charLength=4;break}}this.charReceived=i};StringDecoder.prototype.end=function(buffer){var res="";if(buffer&&buffer.length)res=this.write(buffer);if(this.charReceived){var cr=this.charReceived;var buf=this.charBuffer;var enc=this.encoding;res+=buf.slice(0,cr).toString(enc)}return res};function passThroughWrite(buffer){return buffer.toString(this.encoding)}function utf16DetectIncompleteChar(buffer){this.charReceived=buffer.length%2;this.charLength=this.charReceived?2:0}function base64DetectIncompleteChar(buffer){this.charReceived=buffer.length%3;this.charLength=this.charReceived?3:0}},{buffer:5}],57:[function(require,module,exports){(function(global){module.exports=deprecate;function deprecate(fn,msg){if(config("noDeprecation")){return fn}var warned=false;function deprecated(){if(!warned){if(config("throwDeprecation")){throw new Error(msg)}else if(config("traceDeprecation")){console.trace(msg)}else{console.warn(msg)}warned=true}return fn.apply(this,arguments)}return deprecated}function config(name){try{if(!global.localStorage)return false}catch(_){return false}var val=global.localStorage[name];if(null==val)return false;return String(val).toLowerCase()==="true"}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],58:[function(require,module,exports){module.exports=extend;var hasOwnProperty=Object.prototype.hasOwnProperty;function extend(){var target={};for(var i=0;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target}},{}]},{},[1])(1)}); |
| 3145 | |
| 3146 | /** |
| 3147 | * swagger-client - swagger-client is a javascript client for use with swaggering APIs. |
| 3148 | * @version v2.1.22 |
| 3149 | * @link http://swagger.io |
| 3150 | * @license Apache-2.0 |
| 3151 | */ |
| 3152 | (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.SwaggerClient = 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){ |
| 3153 | 'use strict'; |
| 3154 | |
| 3155 | var auth = require('./lib/auth'); |
| 3156 | var helpers = require('./lib/helpers'); |
| 3157 | var SwaggerClient = require('./lib/client'); |
| 3158 | var deprecationWrapper = function (url, options) { |
| 3159 | helpers.log('This is deprecated, use "new SwaggerClient" instead.'); |
| 3160 | |
| 3161 | return new SwaggerClient(url, options); |
| 3162 | }; |
| 3163 | |
| 3164 | /* Here for IE8 Support */ |
| 3165 | if (!Array.prototype.indexOf) { |
| 3166 | Array.prototype.indexOf = function(obj, start) { |
| 3167 | for (var i = (start || 0), j = this.length; i < j; i++) { |
| 3168 | if (this[i] === obj) { return i; } |
| 3169 | } |
| 3170 | return -1; |
| 3171 | }; |
| 3172 | } |
| 3173 | |
| 3174 | /* Here for IE8 Support */ |
| 3175 | if (!String.prototype.trim) { |
| 3176 | String.prototype.trim = function () { |
| 3177 | return this.replace(/^\s+|\s+$/g, ''); |
| 3178 | }; |
| 3179 | } |
| 3180 | |
| 3181 | /* Here for node 10.x support */ |
| 3182 | if (!String.prototype.endsWith) { |
| 3183 | String.prototype.endsWith = function(suffix) { |
| 3184 | return this.indexOf(suffix, this.length - suffix.length) !== -1; |
| 3185 | }; |
| 3186 | } |
| 3187 | |
| 3188 | module.exports = SwaggerClient; |
| 3189 | |
| 3190 | SwaggerClient.ApiKeyAuthorization = auth.ApiKeyAuthorization; |
| 3191 | SwaggerClient.PasswordAuthorization = auth.PasswordAuthorization; |
| 3192 | SwaggerClient.CookieAuthorization = auth.CookieAuthorization; |
| 3193 | SwaggerClient.SwaggerApi = deprecationWrapper; |
| 3194 | SwaggerClient.SwaggerClient = deprecationWrapper; |
| 3195 | SwaggerClient.SchemaMarkup = require('./lib/schema-markup'); |
| 3196 | |
| 3197 | },{"./lib/auth":2,"./lib/client":3,"./lib/helpers":4,"./lib/schema-markup":7}],2:[function(require,module,exports){ |
| 3198 | 'use strict'; |
| 3199 | |
| 3200 | var helpers = require('./helpers'); |
| 3201 | var btoa = require('btoa'); // jshint ignore:line |
| 3202 | var CookieJar = require('cookiejar').CookieJar; |
| 3203 | var _ = { |
| 3204 | each: require('lodash-compat/collection/each'), |
| 3205 | includes: require('lodash-compat/collection/includes'), |
| 3206 | isObject: require('lodash-compat/lang/isObject'), |
| 3207 | isArray: require('lodash-compat/lang/isArray') |
| 3208 | }; |
| 3209 | |
| 3210 | /** |
| 3211 | * SwaggerAuthorizations applys the correct authorization to an operation being executed |
| 3212 | */ |
| 3213 | var SwaggerAuthorizations = module.exports.SwaggerAuthorizations = function (authz) { |
| 3214 | this.authz = authz || {}; |
| 3215 | }; |
| 3216 | |
| 3217 | /** |
| 3218 | * Add auths to the hash |
| 3219 | * Will overwrite any existing |
| 3220 | * |
| 3221 | */ |
| 3222 | SwaggerAuthorizations.prototype.add = function (name, auth) { |
| 3223 | if(_.isObject(name)) { |
| 3224 | for (var key in name) { |
| 3225 | this.authz[key] = name[key]; |
| 3226 | } |
| 3227 | } else if(typeof name === 'string' ){ |
| 3228 | this.authz[name] = auth; |
| 3229 | } |
| 3230 | |
| 3231 | return auth; |
| 3232 | }; |
| 3233 | |
| 3234 | SwaggerAuthorizations.prototype.remove = function (name) { |
| 3235 | return delete this.authz[name]; |
| 3236 | }; |
| 3237 | |
| 3238 | SwaggerAuthorizations.prototype.apply = function (obj, securities) { |
| 3239 | var status = true; |
| 3240 | var applyAll = !securities; |
| 3241 | var flattenedSecurities = []; |
| 3242 | |
| 3243 | // favor the object-level authorizations over global |
| 3244 | var authz = obj.clientAuthorizations || this.authz; |
| 3245 | |
| 3246 | // Securities could be [ {} ] |
| 3247 | _.each(securities, function (obj, key) { |
| 3248 | |
| 3249 | // Make sure we account for securities being [ str ] |
| 3250 | if(typeof key === 'string') { |
| 3251 | flattenedSecurities.push(key); |
| 3252 | } |
| 3253 | |
| 3254 | // Flatten keys in to our array |
| 3255 | _.each(obj, function (val, key) { |
| 3256 | flattenedSecurities.push(key); |
| 3257 | }); |
| 3258 | }); |
| 3259 | |
| 3260 | _.each(authz, function (auth, authName) { |
| 3261 | if(applyAll || _.includes(flattenedSecurities, authName)) { |
| 3262 | var newStatus = auth.apply(obj); |
| 3263 | status = status && !!newStatus; // logical ORs regarding status |
| 3264 | } |
| 3265 | }); |
| 3266 | |
| 3267 | return status; |
| 3268 | }; |
| 3269 | |
| 3270 | /** |
| 3271 | * ApiKeyAuthorization allows a query param or header to be injected |
| 3272 | */ |
| 3273 | var ApiKeyAuthorization = module.exports.ApiKeyAuthorization = function (name, value, type) { |
| 3274 | this.name = name; |
| 3275 | this.value = value; |
| 3276 | this.type = type; |
| 3277 | }; |
| 3278 | |
| 3279 | ApiKeyAuthorization.prototype.apply = function (obj) { |
| 3280 | if (this.type === 'query') { |
| 3281 | // see if already applied. If so, don't do it again |
| 3282 | |
| 3283 | var qp; |
| 3284 | if (obj.url.indexOf('?') > 0) { |
| 3285 | qp = obj.url.substring(obj.url.indexOf('?') + 1); |
| 3286 | var parts = qp.split('&'); |
| 3287 | if(parts && parts.length > 0) { |
| 3288 | for(var i = 0; i < parts.length; i++) { |
| 3289 | var kv = parts[i].split('='); |
| 3290 | if(kv && kv.length > 0) { |
| 3291 | if (kv[0] === this.name) { |
| 3292 | // skip it |
| 3293 | return false; |
| 3294 | } |
| 3295 | } |
| 3296 | } |
| 3297 | } |
| 3298 | } |
| 3299 | |
| 3300 | if (obj.url.indexOf('?') > 0) { |
| 3301 | obj.url = obj.url + '&' + this.name + '=' + this.value; |
| 3302 | } else { |
| 3303 | obj.url = obj.url + '?' + this.name + '=' + this.value; |
| 3304 | } |
| 3305 | |
| 3306 | return true; |
| 3307 | } else if (this.type === 'header') { |
| 3308 | if(typeof obj.headers[this.name] === 'undefined') { |
| 3309 | obj.headers[this.name] = this.value; |
| 3310 | } |
| 3311 | |
| 3312 | return true; |
| 3313 | } |
| 3314 | }; |
| 3315 | |
| 3316 | var CookieAuthorization = module.exports.CookieAuthorization = function (cookie) { |
| 3317 | this.cookie = cookie; |
| 3318 | }; |
| 3319 | |
| 3320 | CookieAuthorization.prototype.apply = function (obj) { |
| 3321 | obj.cookieJar = obj.cookieJar || new CookieJar(); |
| 3322 | obj.cookieJar.setCookie(this.cookie); |
| 3323 | |
| 3324 | return true; |
| 3325 | }; |
| 3326 | |
| 3327 | /** |
| 3328 | * Password Authorization is a basic auth implementation |
| 3329 | */ |
| 3330 | var PasswordAuthorization = module.exports.PasswordAuthorization = function (username, password) { |
| 3331 | if (arguments.length === 3) { |
| 3332 | helpers.log('PasswordAuthorization: the \'name\' argument has been removed, pass only username and password'); |
| 3333 | username = arguments[1]; |
| 3334 | password = arguments[2]; |
| 3335 | } |
| 3336 | this.username = username; |
| 3337 | this.password = password; |
| 3338 | }; |
| 3339 | |
| 3340 | PasswordAuthorization.prototype.apply = function (obj) { |
| 3341 | if(typeof obj.headers.Authorization === 'undefined') { |
| 3342 | obj.headers.Authorization = 'Basic ' + btoa(this.username + ':' + this.password); |
| 3343 | } |
| 3344 | |
| 3345 | return true; |
| 3346 | }; |
| 3347 | |
| 3348 | },{"./helpers":4,"btoa":13,"cookiejar":18,"lodash-compat/collection/each":52,"lodash-compat/collection/includes":55,"lodash-compat/lang/isArray":140,"lodash-compat/lang/isObject":144}],3:[function(require,module,exports){ |
| 3349 | 'use strict'; |
| 3350 | |
| 3351 | var _ = { |
| 3352 | bind: require('lodash-compat/function/bind'), |
| 3353 | cloneDeep: require('lodash-compat/lang/cloneDeep'), |
| 3354 | find: require('lodash-compat/collection/find'), |
| 3355 | forEach: require('lodash-compat/collection/forEach'), |
| 3356 | indexOf: require('lodash-compat/array/indexOf'), |
| 3357 | isArray: require('lodash-compat/lang/isArray'), |
| 3358 | isObject: require('lodash-compat/lang/isObject'), |
| 3359 | isFunction: require('lodash-compat/lang/isFunction'), |
| 3360 | isPlainObject: require('lodash-compat/lang/isPlainObject'), |
| 3361 | isUndefined: require('lodash-compat/lang/isUndefined') |
| 3362 | }; |
| 3363 | var auth = require('./auth'); |
| 3364 | var helpers = require('./helpers'); |
| 3365 | var Model = require('./types/model'); |
| 3366 | var Operation = require('./types/operation'); |
| 3367 | var OperationGroup = require('./types/operationGroup'); |
| 3368 | var Resolver = require('./resolver'); |
| 3369 | var SwaggerHttp = require('./http'); |
| 3370 | var SwaggerSpecConverter = require('./spec-converter'); |
| 3371 | var Q = require('q'); |
| 3372 | |
| 3373 | // We have to keep track of the function/property names to avoid collisions for tag names which are used to allow the |
| 3374 | // following usage: 'client.{tagName}' |
| 3375 | var reservedClientTags = [ |
| 3376 | 'apis', |
| 3377 | 'authorizationScheme', |
| 3378 | 'authorizations', |
| 3379 | 'basePath', |
| 3380 | 'build', |
| 3381 | 'buildFrom1_1Spec', |
| 3382 | 'buildFrom1_2Spec', |
| 3383 | 'buildFromSpec', |
| 3384 | 'clientAuthorizations', |
| 3385 | 'convertInfo', |
| 3386 | 'debug', |
| 3387 | 'defaultErrorCallback', |
| 3388 | 'defaultSuccessCallback', |
| 3389 | 'enableCookies', |
| 3390 | 'fail', |
| 3391 | 'failure', |
| 3392 | 'finish', |
| 3393 | 'help', |
| 3394 | 'host', |
| 3395 | 'idFromOp', |
| 3396 | 'info', |
| 3397 | 'initialize', |
| 3398 | 'isBuilt', |
| 3399 | 'isValid', |
| 3400 | 'modelPropertyMacro', |
| 3401 | 'models', |
| 3402 | 'modelsArray', |
| 3403 | 'options', |
| 3404 | 'parameterMacro', |
| 3405 | 'parseUri', |
| 3406 | 'progress', |
| 3407 | 'resourceCount', |
| 3408 | 'sampleModels', |
| 3409 | 'selfReflect', |
| 3410 | 'setConsolidatedModels', |
| 3411 | 'spec', |
| 3412 | 'supportedSubmitMethods', |
| 3413 | 'swaggerRequestHeaders', |
| 3414 | 'tagFromLabel', |
| 3415 | 'title', |
| 3416 | 'url', |
| 3417 | 'useJQuery', |
| 3418 | 'jqueryAjaxCache' |
| 3419 | ]; |
| 3420 | // We have to keep track of the function/property names to avoid collisions for tag names which are used to allow the |
| 3421 | // following usage: 'client.apis.{tagName}' |
| 3422 | var reservedApiTags = [ |
| 3423 | 'apis', |
| 3424 | 'asCurl', |
| 3425 | 'description', |
| 3426 | 'externalDocs', |
| 3427 | 'help', |
| 3428 | 'label', |
| 3429 | 'name', |
| 3430 | 'operation', |
| 3431 | 'operations', |
| 3432 | 'operationsArray', |
| 3433 | 'path', |
| 3434 | 'tag' |
| 3435 | ]; |
| 3436 | var supportedOperationMethods = ['delete', 'get', 'head', 'options', 'patch', 'post', 'put']; |
| 3437 | var SwaggerClient = module.exports = function (url, options) { |
| 3438 | this.authorizations = null; |
| 3439 | this.authorizationScheme = null; |
| 3440 | this.basePath = null; |
| 3441 | this.debug = false; |
| 3442 | this.enableCookies = false; |
| 3443 | this.info = null; |
| 3444 | this.isBuilt = false; |
| 3445 | this.isValid = false; |
| 3446 | this.modelsArray = []; |
| 3447 | this.resourceCount = 0; |
| 3448 | this.url = null; |
| 3449 | this.useJQuery = false; |
| 3450 | this.jqueryAjaxCache = false; |
| 3451 | this.swaggerObject = {}; |
| 3452 | this.deferredClient = undefined; |
| 3453 | |
| 3454 | this.clientAuthorizations = new auth.SwaggerAuthorizations(); |
| 3455 | |
| 3456 | if (typeof url !== 'undefined') { |
| 3457 | return this.initialize(url, options); |
| 3458 | } else { |
| 3459 | return this; |
| 3460 | } |
| 3461 | }; |
| 3462 | |
| 3463 | SwaggerClient.prototype.initialize = function (url, options) { |
| 3464 | this.models = {}; |
| 3465 | this.sampleModels = {}; |
| 3466 | |
| 3467 | if (typeof url === 'string') { |
| 3468 | this.url = url; |
| 3469 | } else if (_.isObject(url)) { |
| 3470 | options = url; |
| 3471 | this.url = options.url; |
| 3472 | } |
| 3473 | |
| 3474 | if(this.url && this.url.indexOf('http:') === -1 && this.url.indexOf('https:') === -1) { |
| 3475 | // no protocol, so we can only use window if it exists |
| 3476 | if(typeof(window) !== 'undefined' && window && window.location) { |
| 3477 | this.url = window.location.origin + this.url; |
| 3478 | } |
| 3479 | } |
| 3480 | |
| 3481 | options = options || {}; |
| 3482 | this.clientAuthorizations.add(options.authorizations); |
| 3483 | this.swaggerRequestHeaders = options.swaggerRequestHeaders || 'application/json;charset=utf-8,*/*'; |
| 3484 | this.defaultSuccessCallback = options.defaultSuccessCallback || null; |
| 3485 | this.defaultErrorCallback = options.defaultErrorCallback || null; |
| 3486 | this.modelPropertyMacro = options.modelPropertyMacro || null; |
| 3487 | this.parameterMacro = options.parameterMacro || null; |
| 3488 | this.usePromise = options.usePromise || null; |
| 3489 | |
| 3490 | // operation request timeout default |
| 3491 | this.timeout = options.timeout || null; |
| 3492 | // default to request timeout when not specified |
| 3493 | this.fetchSpecTimeout = typeof options.fetchSpecTimeout !== 'undefined' ? |
| 3494 | options.fetchSpecTimeout : options.timeout || null; |
| 3495 | |
| 3496 | if(this.usePromise) { |
| 3497 | this.deferredClient = Q.defer(); |
| 3498 | } |
| 3499 | |
| 3500 | if (typeof options.success === 'function') { |
| 3501 | this.success = options.success; |
| 3502 | } |
| 3503 | if (options.useJQuery) { |
| 3504 | this.useJQuery = options.useJQuery; |
| 3505 | } |
| 3506 | |
| 3507 | if (options.jqueryAjaxCache) { |
| 3508 | this.jqueryAjaxCache = options.jqueryAjaxCache; |
| 3509 | } |
| 3510 | |
| 3511 | if (options.enableCookies) { |
| 3512 | this.enableCookies = options.enableCookies; |
| 3513 | } |
| 3514 | |
| 3515 | this.options = options || {}; |
| 3516 | |
| 3517 | // maybe don't need this? |
| 3518 | this.options.timeout = this.timeout; |
| 3519 | this.options.fetchSpecTimeout = this.fetchSpecTimeout; |
| 3520 | |
| 3521 | this.supportedSubmitMethods = options.supportedSubmitMethods || []; |
| 3522 | this.failure = options.failure || function (err) { throw err; }; |
| 3523 | this.progress = options.progress || function () {}; |
| 3524 | this.spec = _.cloneDeep(options.spec); // Clone so we do not alter the provided document |
| 3525 | |
| 3526 | if (options.scheme) { |
| 3527 | this.scheme = options.scheme; |
| 3528 | } |
| 3529 | |
| 3530 | if (this.usePromise || typeof options.success === 'function') { |
| 3531 | this.ready = true; |
| 3532 | return this.build(); |
| 3533 | } |
| 3534 | }; |
| 3535 | |
| 3536 | SwaggerClient.prototype.build = function (mock) { |
| 3537 | if (this.isBuilt) { |
| 3538 | return this; |
| 3539 | } |
| 3540 | |
| 3541 | var self = this; |
| 3542 | |
| 3543 | if (this.spec) { |
| 3544 | this.progress('fetching resource list; Please wait.'); |
| 3545 | } else { |
| 3546 | this.progress('fetching resource list: ' + this.url + '; Please wait.'); |
| 3547 | } |
| 3548 | |
| 3549 | var obj = { |
| 3550 | useJQuery: this.useJQuery, |
| 3551 | jqueryAjaxCache: this.jqueryAjaxCache, |
| 3552 | url: this.url, |
| 3553 | method: 'get', |
| 3554 | headers: { |
| 3555 | accept: this.swaggerRequestHeaders |
| 3556 | }, |
| 3557 | on: { |
| 3558 | error: function (response) { |
| 3559 | if (self.url.substring(0, 4) !== 'http') { |
| 3560 | return self.fail('Please specify the protocol for ' + self.url); |
| 3561 | } else if (response.errObj && (response.errObj.code === 'ECONNABORTED' || response.errObj.message.indexOf('timeout') !== -1)) { |
| 3562 | return self.fail('Request timed out after ' + self.fetchSpecTimeout + 'ms'); |
| 3563 | } else if (response.status === 0) { |
| 3564 | return self.fail('Can\'t read from server. It may not have the appropriate access-control-origin settings.'); |
| 3565 | } else if (response.status === 404) { |
| 3566 | return self.fail('Can\'t read swagger JSON from ' + self.url); |
| 3567 | } else { |
| 3568 | return self.fail(response.status + ' : ' + response.statusText + ' ' + self.url); |
| 3569 | } |
| 3570 | }, |
| 3571 | response: function (resp) { |
| 3572 | |
| 3573 | var responseObj = resp.obj; |
| 3574 | if(!responseObj) { |
| 3575 | return self.fail('failed to parse JSON/YAML response'); |
| 3576 | } |
| 3577 | |
| 3578 | self.swaggerVersion = responseObj.swaggerVersion; |
| 3579 | self.swaggerObject = responseObj; |
| 3580 | |
| 3581 | if (responseObj.swagger && parseInt(responseObj.swagger) === 2) { |
| 3582 | self.swaggerVersion = responseObj.swagger; |
| 3583 | |
| 3584 | new Resolver().resolve(responseObj, self.url, self.buildFromSpec, self); |
| 3585 | |
| 3586 | self.isValid = true; |
| 3587 | } else { |
| 3588 | var converter = new SwaggerSpecConverter(); |
| 3589 | self.oldSwaggerObject = self.swaggerObject; |
| 3590 | |
| 3591 | converter.setDocumentationLocation(self.url); |
| 3592 | converter.convert(responseObj, self.clientAuthorizations, self.options, function(spec) { |
| 3593 | self.swaggerObject = spec; |
| 3594 | new Resolver().resolve(spec, self.url, self.buildFromSpec, self); |
| 3595 | self.isValid = true; |
| 3596 | }); |
| 3597 | } |
| 3598 | } |
| 3599 | } |
| 3600 | }; |
| 3601 | |
| 3602 | // only set timeout when specified |
| 3603 | if (this.fetchSpecTimeout) { |
| 3604 | obj.timeout = this.fetchSpecTimeout; |
| 3605 | } |
| 3606 | |
| 3607 | if (this.spec) { |
| 3608 | self.swaggerObject = this.spec; |
| 3609 | setTimeout(function () { |
| 3610 | new Resolver().resolve(self.spec, self.url, self.buildFromSpec, self); |
| 3611 | }, 10); |
| 3612 | } else { |
| 3613 | this.clientAuthorizations.apply(obj); |
| 3614 | |
| 3615 | if (mock) { |
| 3616 | return obj; |
| 3617 | } |
| 3618 | |
| 3619 | new SwaggerHttp().execute(obj, this.options); |
| 3620 | } |
| 3621 | |
| 3622 | return (this.usePromise) ? this.deferredClient.promise : this; |
| 3623 | }; |
| 3624 | |
| 3625 | SwaggerClient.prototype.buildFromSpec = function (response) { |
| 3626 | if (this.isBuilt) { |
| 3627 | return this; |
| 3628 | } |
| 3629 | |
| 3630 | this.apis = {}; |
| 3631 | this.apisArray = []; |
| 3632 | this.basePath = response.basePath || ''; |
| 3633 | this.consumes = response.consumes; |
| 3634 | this.host = response.host || ''; |
| 3635 | this.info = response.info || {}; |
| 3636 | this.produces = response.produces; |
| 3637 | this.schemes = response.schemes || []; |
| 3638 | this.securityDefinitions = response.securityDefinitions; |
| 3639 | this.security = response.security; |
| 3640 | this.title = response.title || ''; |
| 3641 | |
| 3642 | if (response.externalDocs) { |
| 3643 | this.externalDocs = response.externalDocs; |
| 3644 | } |
| 3645 | |
| 3646 | // legacy support |
| 3647 | this.authSchemes = response.securityDefinitions; |
| 3648 | |
| 3649 | var definedTags = {}; |
| 3650 | var k; |
| 3651 | |
| 3652 | if (Array.isArray(response.tags)) { |
| 3653 | definedTags = {}; |
| 3654 | |
| 3655 | for (k = 0; k < response.tags.length; k++) { |
| 3656 | var t = response.tags[k]; |
| 3657 | definedTags[t.name] = t; |
| 3658 | } |
| 3659 | } |
| 3660 | |
| 3661 | var location; |
| 3662 | |
| 3663 | if (typeof this.url === 'string') { |
| 3664 | location = this.parseUri(this.url); |
| 3665 | if (typeof this.scheme === 'undefined' && typeof this.schemes === 'undefined' || this.schemes.length === 0) { |
| 3666 | if(typeof window !== 'undefined') { |
| 3667 | // use the window scheme |
| 3668 | this.scheme = window.location.protocol.replace(':',''); |
| 3669 | } |
| 3670 | else { |
| 3671 | this.scheme = location.scheme || 'http'; |
| 3672 | } |
| 3673 | } else if (typeof this.scheme === 'undefined') { |
| 3674 | if(typeof window !== 'undefined') { |
| 3675 | var scheme = window.location.protocol.replace(':',''); |
| 3676 | if(scheme === 'https' && this.schemes.indexOf(scheme) === -1) { |
| 3677 | // can't call http from https served page in a browser! |
| 3678 | helpers.log('Cannot call a http server from https inside a browser!'); |
| 3679 | this.scheme = 'http'; |
| 3680 | } |
| 3681 | else if(this.schemes.indexOf(scheme) !== -1) { |
| 3682 | this.scheme = scheme; |
| 3683 | } |
| 3684 | else { |
| 3685 | if(this.schemes.indexOf('https') !== -1) { |
| 3686 | this.scheme = 'https'; |
| 3687 | } |
| 3688 | else { |
| 3689 | this.scheme = 'http'; |
| 3690 | } |
| 3691 | } |
| 3692 | } |
| 3693 | else { |
| 3694 | this.scheme = this.schemes[0] || location.scheme; |
| 3695 | } |
| 3696 | } |
| 3697 | |
| 3698 | if (typeof this.host === 'undefined' || this.host === '') { |
| 3699 | this.host = location.host; |
| 3700 | |
| 3701 | if (location.port) { |
| 3702 | this.host = this.host + ':' + location.port; |
| 3703 | } |
| 3704 | } |
| 3705 | } |
| 3706 | else { |
| 3707 | if (typeof this.schemes === 'undefined' || this.schemes.length === 0) { |
| 3708 | this.scheme = 'http'; |
| 3709 | } |
| 3710 | else if (typeof this.scheme === 'undefined') { |
| 3711 | this.scheme = this.schemes[0]; |
| 3712 | } |
| 3713 | } |
| 3714 | |
| 3715 | this.definitions = response.definitions; |
| 3716 | |
| 3717 | var key; |
| 3718 | |
| 3719 | for (key in this.definitions) { |
| 3720 | var model = new Model(key, this.definitions[key], this.models, this.modelPropertyMacro); |
| 3721 | |
| 3722 | if (model) { |
| 3723 | this.models[key] = model; |
| 3724 | } |
| 3725 | } |
| 3726 | |
| 3727 | // get paths, create functions for each operationId |
| 3728 | var self = this; |
| 3729 | |
| 3730 | // Bind help to 'client.apis' |
| 3731 | self.apis.help = _.bind(self.help, self); |
| 3732 | |
| 3733 | _.forEach(response.paths, function (pathObj, path) { |
| 3734 | // Only process a path if it's an object |
| 3735 | if (!_.isPlainObject(pathObj)) { |
| 3736 | return; |
| 3737 | } |
| 3738 | |
| 3739 | _.forEach(supportedOperationMethods, function (method) { |
| 3740 | var operation = pathObj[method]; |
| 3741 | |
| 3742 | if (_.isUndefined(operation)) { |
| 3743 | // Operation does not exist |
| 3744 | return; |
| 3745 | } else if (!_.isPlainObject(operation)) { |
| 3746 | // Operation exists but it is not an Operation Object. Since this is invalid, log it. |
| 3747 | helpers.log('The \'' + method + '\' operation for \'' + path + '\' path is not an Operation Object'); |
| 3748 | |
| 3749 | return; |
| 3750 | } |
| 3751 | |
| 3752 | var tags = operation.tags; |
| 3753 | |
| 3754 | if (_.isUndefined(tags) || !_.isArray(tags) || tags.length === 0) { |
| 3755 | tags = operation.tags = [ 'default' ]; |
| 3756 | } |
| 3757 | |
| 3758 | var operationId = self.idFromOp(path, method, operation); |
| 3759 | |
| 3760 | var operationObject = new Operation(self, |
| 3761 | operation.scheme, |
| 3762 | operationId, |
| 3763 | method, |
| 3764 | path, |
| 3765 | operation, |
| 3766 | self.definitions, |
| 3767 | self.models, |
| 3768 | self.clientAuthorizations); |
| 3769 | |
| 3770 | // bind self operation's execute command to the api |
| 3771 | _.forEach(tags, function (tag) { |
| 3772 | var clientProperty = _.indexOf(reservedClientTags, tag) > -1 ? '_' + tag : tag; |
| 3773 | var apiProperty = _.indexOf(reservedApiTags, tag) > -1 ? '_' + tag : tag; |
| 3774 | var operationGroup = self[clientProperty]; |
| 3775 | |
| 3776 | if (clientProperty !== tag) { |
| 3777 | helpers.log('The \'' + tag + '\' tag conflicts with a SwaggerClient function/property name. Use \'client.' + |
| 3778 | clientProperty + '\' or \'client.apis.' + tag + '\' instead of \'client.' + tag + '\'.'); |
| 3779 | } |
| 3780 | |
| 3781 | if (apiProperty !== tag) { |
| 3782 | helpers.log('The \'' + tag + '\' tag conflicts with a SwaggerClient operation function/property name. Use ' + |
| 3783 | '\'client.apis.' + apiProperty + '\' instead of \'client.apis.' + tag + '\'.'); |
| 3784 | } |
| 3785 | |
| 3786 | if (_.indexOf(reservedApiTags, operationId) > -1) { |
| 3787 | helpers.log('The \'' + operationId + '\' operationId conflicts with a SwaggerClient operation ' + |
| 3788 | 'function/property name. Use \'client.apis.' + apiProperty + '._' + operationId + |
| 3789 | '\' instead of \'client.apis.' + apiProperty + '.' + operationId + '\'.'); |
| 3790 | |
| 3791 | operationId = '_' + operationId; |
| 3792 | operationObject.nickname = operationId; // So 'client.apis.[tag].operationId.help() works properly |
| 3793 | } |
| 3794 | |
| 3795 | if (_.isUndefined(operationGroup)) { |
| 3796 | operationGroup = self[clientProperty] = self.apis[apiProperty] = {}; |
| 3797 | |
| 3798 | operationGroup.operations = {}; |
| 3799 | operationGroup.label = apiProperty; |
| 3800 | operationGroup.apis = {}; |
| 3801 | |
| 3802 | var tagDef = definedTags[tag]; |
| 3803 | |
| 3804 | if (!_.isUndefined(tagDef)) { |
| 3805 | operationGroup.description = tagDef.description; |
| 3806 | operationGroup.externalDocs = tagDef.externalDocs; |
| 3807 | } |
| 3808 | |
| 3809 | self[clientProperty].help = _.bind(self.help, operationGroup); |
| 3810 | self.apisArray.push(new OperationGroup(tag, operationGroup.description, operationGroup.externalDocs, operationObject)); |
| 3811 | } |
| 3812 | |
| 3813 | operationId = self.makeUniqueOperationId(operationId, self.apis[apiProperty]); |
| 3814 | |
| 3815 | // Bind tag help |
| 3816 | if (!_.isFunction(operationGroup.help)) { |
| 3817 | operationGroup.help = _.bind(self.help, operationGroup); |
| 3818 | } |
| 3819 | |
| 3820 | // bind to the apis object |
| 3821 | self.apis[apiProperty][operationId] = operationGroup[operationId] = _.bind(operationObject.execute, |
| 3822 | operationObject); |
| 3823 | self.apis[apiProperty][operationId].help = operationGroup[operationId].help = _.bind(operationObject.help, |
| 3824 | operationObject); |
| 3825 | self.apis[apiProperty][operationId].asCurl = operationGroup[operationId].asCurl = _.bind(operationObject.asCurl, |
| 3826 | operationObject); |
| 3827 | |
| 3828 | operationGroup.apis[operationId] = operationGroup.operations[operationId] = operationObject; |
| 3829 | |
| 3830 | // legacy UI feature |
| 3831 | var api = _.find(self.apisArray, function (api) { |
| 3832 | return api.tag === tag; |
| 3833 | }); |
| 3834 | |
| 3835 | if (api) { |
| 3836 | api.operationsArray.push(operationObject); |
| 3837 | } |
| 3838 | }); |
| 3839 | }); |
| 3840 | }); |
| 3841 | |
| 3842 | // sort the apisArray according to the tags |
| 3843 | var sortedApis = []; |
| 3844 | _.forEach(Object.keys(definedTags), function (tag) { |
| 3845 | var pos; |
| 3846 | for(pos in self.apisArray) { |
| 3847 | var _api = self.apisArray[pos]; |
| 3848 | if(_api && tag === _api.name) { |
| 3849 | sortedApis.push(_api); |
| 3850 | self.apisArray[pos] = null; |
| 3851 | } |
| 3852 | } |
| 3853 | }); |
| 3854 | // add anything left |
| 3855 | _.forEach(self.apisArray, function (api) { |
| 3856 | if(api) { |
| 3857 | sortedApis.push(api); |
| 3858 | } |
| 3859 | }); |
| 3860 | self.apisArray = sortedApis; |
| 3861 | |
| 3862 | _.forEach(response.definitions, function (definitionObj, definition) { |
| 3863 | definitionObj.id = definition.toLowerCase(); |
| 3864 | definitionObj.name = definition; |
| 3865 | self.modelsArray.push(definitionObj); |
| 3866 | }); |
| 3867 | |
| 3868 | this.isBuilt = true; |
| 3869 | |
| 3870 | if (this.usePromise) { |
| 3871 | this.isValid = true; |
| 3872 | this.isBuilt = true; |
| 3873 | this.deferredClient.resolve(this); |
| 3874 | |
| 3875 | return this.deferredClient.promise; |
| 3876 | } |
| 3877 | |
| 3878 | if (this.success) { |
| 3879 | this.success(); |
| 3880 | } |
| 3881 | |
| 3882 | return this; |
| 3883 | }; |
| 3884 | |
| 3885 | SwaggerClient.prototype.makeUniqueOperationId = function(operationId, api) { |
| 3886 | var count = 0; |
| 3887 | var name = operationId; |
| 3888 | |
| 3889 | // make unique across this operation group |
| 3890 | while(true) { |
| 3891 | var matched = false; |
| 3892 | _.forEach(api.operations, function (operation) { |
| 3893 | if(operation.nickname === name) { |
| 3894 | matched = true; |
| 3895 | } |
| 3896 | }); |
| 3897 | if(!matched) { |
| 3898 | return name; |
| 3899 | } |
| 3900 | name = operationId + '_' + count; |
| 3901 | count ++; |
| 3902 | } |
| 3903 | |
| 3904 | return operationId; |
| 3905 | }; |
| 3906 | |
| 3907 | SwaggerClient.prototype.parseUri = function (uri) { |
| 3908 | var urlParseRE = /^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/; |
| 3909 | var parts = urlParseRE.exec(uri); |
| 3910 | |
| 3911 | return { |
| 3912 | scheme: parts[4] ? parts[4].replace(':','') : undefined, |
| 3913 | host: parts[11], |
| 3914 | port: parts[12], |
| 3915 | path: parts[15] |
| 3916 | }; |
| 3917 | }; |
| 3918 | |
| 3919 | SwaggerClient.prototype.help = function (dontPrint) { |
| 3920 | var output = ''; |
| 3921 | |
| 3922 | if (this instanceof SwaggerClient) { |
| 3923 | _.forEach(this.apis, function (api, name) { |
| 3924 | if (_.isPlainObject(api)) { |
| 3925 | output += 'operations for the \'' + name + '\' tag\n'; |
| 3926 | |
| 3927 | _.forEach(api.operations, function (operation, name) { |
| 3928 | output += ' * ' + name + ': ' + operation.summary + '\n'; |
| 3929 | }); |
| 3930 | } |
| 3931 | }); |
| 3932 | } else if (this instanceof OperationGroup || _.isPlainObject(this)) { |
| 3933 | output += 'operations for the \'' + this.label + '\' tag\n'; |
| 3934 | |
| 3935 | _.forEach(this.apis, function (operation, name) { |
| 3936 | output += ' * ' + name + ': ' + operation.summary + '\n'; |
| 3937 | }); |
| 3938 | } |
| 3939 | |
| 3940 | if (dontPrint) { |
| 3941 | return output; |
| 3942 | } else { |
| 3943 | helpers.log(output); |
| 3944 | |
| 3945 | return output; |
| 3946 | } |
| 3947 | }; |
| 3948 | |
| 3949 | SwaggerClient.prototype.tagFromLabel = function (label) { |
| 3950 | return label; |
| 3951 | }; |
| 3952 | |
| 3953 | SwaggerClient.prototype.idFromOp = function (path, httpMethod, op) { |
| 3954 | if(!op || !op.operationId) { |
| 3955 | op = op || {}; |
| 3956 | op.operationId = httpMethod + '_' + path; |
| 3957 | } |
| 3958 | var opId = op.operationId.replace(/[\s!@#$%^&*()_+=\[{\]};:<>|.\/?,\\'""-]/g, '_') || (path.substring(1) + '_' + httpMethod); |
| 3959 | |
| 3960 | opId = opId.replace(/((_){2,})/g, '_'); |
| 3961 | opId = opId.replace(/^(_)*/g, ''); |
| 3962 | opId = opId.replace(/([_])*$/g, ''); |
| 3963 | |
| 3964 | return opId; |
| 3965 | }; |
| 3966 | |
| 3967 | SwaggerClient.prototype.setHost = function (host) { |
| 3968 | this.host = host; |
| 3969 | |
| 3970 | if(this.apis) { |
| 3971 | _.forEach(this.apis, function(api) { |
| 3972 | if(api.operations) { |
| 3973 | _.forEach(api.operations, function(operation) { |
| 3974 | operation.host = host; |
| 3975 | }); |
| 3976 | } |
| 3977 | }); |
| 3978 | } |
| 3979 | }; |
| 3980 | |
| 3981 | SwaggerClient.prototype.setBasePath = function (basePath) { |
| 3982 | this.basePath = basePath; |
| 3983 | |
| 3984 | if(this.apis) { |
| 3985 | _.forEach(this.apis, function(api) { |
| 3986 | if(api.operations) { |
| 3987 | _.forEach(api.operations, function(operation) { |
| 3988 | operation.basePath = basePath; |
| 3989 | }); |
| 3990 | } |
| 3991 | }); |
| 3992 | } |
| 3993 | }; |
| 3994 | |
| 3995 | SwaggerClient.prototype.setSchemes = function (schemes) { |
| 3996 | this.schemes = schemes; |
| 3997 | |
| 3998 | if(schemes && schemes.length > 0) { |
| 3999 | if(this.apis) { |
| 4000 | _.forEach(this.apis, function (api) { |
| 4001 | if (api.operations) { |
| 4002 | _.forEach(api.operations, function (operation) { |
| 4003 | operation.scheme = schemes[0]; |
| 4004 | }); |
| 4005 | } |
| 4006 | }); |
| 4007 | } |
| 4008 | } |
| 4009 | }; |
| 4010 | |
| 4011 | |
| 4012 | SwaggerClient.prototype.fail = function (message) { |
| 4013 | if (this.usePromise) { |
| 4014 | this.deferredClient.reject(message); |
| 4015 | return this.deferredClient.promise; |
| 4016 | } else { |
| 4017 | if (this.failure) { |
| 4018 | this.failure(message); |
| 4019 | } |
| 4020 | else { |
| 4021 | this.failure(message); |
| 4022 | } |
| 4023 | } |
| 4024 | }; |
| 4025 | |
| 4026 | },{"./auth":2,"./helpers":4,"./http":5,"./resolver":6,"./spec-converter":8,"./types/model":9,"./types/operation":10,"./types/operationGroup":11,"lodash-compat/array/indexOf":49,"lodash-compat/collection/find":53,"lodash-compat/collection/forEach":54,"lodash-compat/function/bind":58,"lodash-compat/lang/cloneDeep":138,"lodash-compat/lang/isArray":140,"lodash-compat/lang/isFunction":142,"lodash-compat/lang/isObject":144,"lodash-compat/lang/isPlainObject":145,"lodash-compat/lang/isUndefined":148,"q":157}],4:[function(require,module,exports){ |
| 4027 | (function (process){ |
| 4028 | 'use strict'; |
| 4029 | |
| 4030 | var _ = { |
| 4031 | isPlainObject: require('lodash-compat/lang/isPlainObject'), |
| 4032 | indexOf: require('lodash-compat/array/indexOf') |
| 4033 | }; |
| 4034 | |
| 4035 | module.exports.__bind = function (fn, me) { |
| 4036 | return function(){ |
| 4037 | return fn.apply(me, arguments); |
| 4038 | }; |
| 4039 | }; |
| 4040 | |
| 4041 | var log = module.exports.log = function() { |
| 4042 | // Only log if available and we're not testing |
| 4043 | if (console && process.env.NODE_ENV !== 'test') { |
| 4044 | console.log(Array.prototype.slice.call(arguments)[0]); |
| 4045 | } |
| 4046 | }; |
| 4047 | |
| 4048 | module.exports.fail = function (message) { |
| 4049 | log(message); |
| 4050 | }; |
| 4051 | |
| 4052 | var optionHtml = module.exports.optionHtml = function (label, value) { |
| 4053 | return '<tr><td class="optionName">' + label + ':</td><td>' + value + '</td></tr>'; |
| 4054 | }; |
| 4055 | |
| 4056 | var resolveSchema = module.exports.resolveSchema = function (schema) { |
| 4057 | if (_.isPlainObject(schema.schema)) { |
| 4058 | schema = resolveSchema(schema.schema); |
| 4059 | } |
| 4060 | |
| 4061 | return schema; |
| 4062 | }; |
| 4063 | |
| 4064 | var simpleRef = module.exports.simpleRef = function (name) { |
| 4065 | if (typeof name === 'undefined') { |
| 4066 | return null; |
| 4067 | } |
| 4068 | |
| 4069 | if (name.indexOf('#/definitions/') === 0) { |
| 4070 | return name.substring('#/definitions/'.length); |
| 4071 | } else { |
| 4072 | return name; |
| 4073 | } |
| 4074 | }; |
| 4075 | |
| 4076 | |
| 4077 | }).call(this,require('_process')) |
| 4078 | //# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpYi9oZWxwZXJzLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7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G1sID0gbW9kdWxlLmV4cG9ydHMub3B0aW9uSHRtbCA9IGZ1bmN0aW9uIChsYWJlbCwgdmFsdWUpIHtcbiAgcmV0dXJuICc8dHI+PHRkIGNsYXNzPVwib3B0aW9uTmFtZVwiPicgKyBsYWJlbCArICc6PC90ZD48dGQ+JyArIHZhbHVlICsgJzwvdGQ+PC90cj4nO1xufTtcblxudmFyIHJlc29sdmVTY2hlbWEgPSBtb2R1bGUuZXhwb3J0cy5yZXNvbHZlU2NoZW1hID0gZnVuY3Rpb24gKHNjaGVtYSkge1xuICBpZiAoXy5pc1BsYWluT2JqZWN0KHNjaGVtYS5zY2hlbWEpKSB7XG4gICAgc2NoZW1hID0gcmVzb2x2ZVNjaGVtYShzY2hlbWEuc2NoZW1hKTtcbiAgfVxuXG4gIHJldHVybiBzY2hlbWE7XG59O1xuXG52YXIgc2ltcGxlUmVmID0gbW9kdWxlLmV4cG9ydHMuc2ltcGxlUmVmID0gZnVuY3Rpb24gKG5hbWUpIHtcbiAgaWYgKHR5cGVvZiBuYW1lID09PSAndW5kZWZpbmVkJykge1xuICAgIHJldHVybiBudWxsO1xuICB9XG5cbiAgaWYgKG5hbWUuaW5kZXhPZignIy9kZWZpbml0aW9ucy8nKSA9PT0gMCkge1xuICAgIHJldHVybiBuYW1lLnN1YnN0cmluZygnIy9kZWZpbml0aW9ucy8nLmxlbmd0aCk7XG4gIH0gZWxzZSB7XG4gICAgcmV0dXJuIG5hbWU7XG4gIH1cbn07XG5cbiJdfQ== |
| 4079 | },{"_process":12,"lodash-compat/array/indexOf":49,"lodash-compat/lang/isPlainObject":145}],5:[function(require,module,exports){ |
| 4080 | (function (Buffer){ |
| 4081 | 'use strict'; |
| 4082 | |
| 4083 | var helpers = require('./helpers'); |
| 4084 | var request = require('superagent'); |
| 4085 | var jsyaml = require('js-yaml'); |
| 4086 | var _ = { |
| 4087 | isObject: require('lodash-compat/lang/isObject'), |
| 4088 | keys: require('lodash-compat/object/keys') |
| 4089 | }; |
| 4090 | |
| 4091 | /* |
| 4092 | * JQueryHttpClient is a light-weight, node or browser HTTP client |
| 4093 | */ |
| 4094 | var JQueryHttpClient = function () { |
| 4095 | this.type = 'JQueryHttpClient'; |
| 4096 | }; |
| 4097 | |
| 4098 | /* |
| 4099 | * SuperagentHttpClient is a light-weight, node or browser HTTP client |
| 4100 | */ |
| 4101 | var SuperagentHttpClient = function () { |
| 4102 | this.type = 'SuperagentHttpClient'; |
| 4103 | }; |
| 4104 | |
| 4105 | /** |
| 4106 | * SwaggerHttp is a wrapper for executing requests |
| 4107 | */ |
| 4108 | var SwaggerHttp = module.exports = function () {}; |
| 4109 | |
| 4110 | SwaggerHttp.prototype.execute = function (obj, opts) { |
| 4111 | var client; |
| 4112 | |
| 4113 | if(opts && opts.client) { |
| 4114 | client = opts.client; |
| 4115 | } |
| 4116 | else { |
| 4117 | client = new SuperagentHttpClient(opts); |
| 4118 | } |
| 4119 | client.opts = opts || {}; |
| 4120 | |
| 4121 | // legacy support |
| 4122 | var hasJQuery = false; |
| 4123 | if(typeof window !== 'undefined') { |
| 4124 | if(typeof window.jQuery !== 'undefined') { |
| 4125 | hasJQuery = true; |
| 4126 | } |
| 4127 | } |
| 4128 | // OPTIONS support |
| 4129 | if(obj.method.toLowerCase() === 'options' && client.type === 'SuperagentHttpClient') { |
| 4130 | log('forcing jQuery as OPTIONS are not supported by SuperAgent'); |
| 4131 | obj.useJQuery = true; |
| 4132 | } |
| 4133 | if(this.isInternetExplorer() && (obj.useJQuery === false || !hasJQuery )) { |
| 4134 | throw new Error('Unsupported configuration! JQuery is required but not available'); |
| 4135 | } |
| 4136 | if ((obj && obj.useJQuery === true) || this.isInternetExplorer() && hasJQuery) { |
| 4137 | client = new JQueryHttpClient(opts); |
| 4138 | } |
| 4139 | |
| 4140 | var success = obj.on.response; |
| 4141 | var error = obj.on.error; |
| 4142 | |
| 4143 | var requestInterceptor = function(data) { |
| 4144 | if(opts && opts.requestInterceptor) { |
| 4145 | data = opts.requestInterceptor.apply(data); |
| 4146 | } |
| 4147 | return data; |
| 4148 | }; |
| 4149 | |
| 4150 | var responseInterceptor = function(data) { |
| 4151 | if(opts && opts.responseInterceptor) { |
| 4152 | data = opts.responseInterceptor.apply(data); |
| 4153 | } |
| 4154 | return success(data); |
| 4155 | }; |
| 4156 | |
| 4157 | var errorInterceptor = function(data) { |
| 4158 | if(opts && opts.responseInterceptor) { |
| 4159 | data = opts.responseInterceptor.apply(data); |
| 4160 | } |
| 4161 | error(data); |
| 4162 | }; |
| 4163 | |
| 4164 | obj.on.error = function(data) { |
| 4165 | errorInterceptor(data); |
| 4166 | }; |
| 4167 | |
| 4168 | obj.on.response = function(data) { |
| 4169 | responseInterceptor(data); |
| 4170 | }; |
| 4171 | |
| 4172 | if (_.isObject(obj) && _.isObject(obj.body)) { |
| 4173 | // special processing for file uploads via jquery |
| 4174 | if (obj.body.type && obj.body.type === 'formData'){ |
| 4175 | if(opts.useJQuery) { |
| 4176 | obj.contentType = false; |
| 4177 | obj.processData = false; |
| 4178 | delete obj.headers['Content-Type']; |
| 4179 | } |
| 4180 | } |
| 4181 | } |
| 4182 | |
| 4183 | obj = requestInterceptor(obj) || obj; |
| 4184 | if (obj.beforeSend) { |
| 4185 | obj.beforeSend(function(_obj) { |
| 4186 | client.execute(_obj || obj); |
| 4187 | }); |
| 4188 | } else { |
| 4189 | client.execute(obj); |
| 4190 | } |
| 4191 | |
| 4192 | return (obj.deferred) ? obj.deferred.promise : obj; |
| 4193 | }; |
| 4194 | |
| 4195 | SwaggerHttp.prototype.isInternetExplorer = function () { |
| 4196 | var detectedIE = false; |
| 4197 | |
| 4198 | if (typeof navigator !== 'undefined' && navigator.userAgent) { |
| 4199 | var nav = navigator.userAgent.toLowerCase(); |
| 4200 | |
| 4201 | if (nav.indexOf('msie') !== -1) { |
| 4202 | var version = parseInt(nav.split('msie')[1]); |
| 4203 | |
| 4204 | if (version <= 8) { |
| 4205 | detectedIE = true; |
| 4206 | } |
| 4207 | } |
| 4208 | } |
| 4209 | |
| 4210 | return detectedIE; |
| 4211 | }; |
| 4212 | |
| 4213 | JQueryHttpClient.prototype.execute = function (obj) { |
| 4214 | var jq = this.jQuery || (typeof window !== 'undefined' && window.jQuery); |
| 4215 | var cb = obj.on; |
| 4216 | var request = obj; |
| 4217 | |
| 4218 | if(typeof jq === 'undefined' || jq === false) { |
| 4219 | throw new Error('Unsupported configuration! JQuery is required but not available'); |
| 4220 | } |
| 4221 | |
| 4222 | obj.type = obj.method; |
| 4223 | obj.cache = obj.jqueryAjaxCache; |
| 4224 | obj.data = obj.body; |
| 4225 | delete obj.jqueryAjaxCache; |
| 4226 | delete obj.useJQuery; |
| 4227 | delete obj.body; |
| 4228 | |
| 4229 | obj.complete = function (response) { |
| 4230 | var headers = {}; |
| 4231 | var headerArray = response.getAllResponseHeaders().split('\n'); |
| 4232 | |
| 4233 | for (var i = 0; i < headerArray.length; i++) { |
| 4234 | var toSplit = headerArray[i].trim(); |
| 4235 | |
| 4236 | if (toSplit.length === 0) { |
| 4237 | continue; |
| 4238 | } |
| 4239 | |
| 4240 | var separator = toSplit.indexOf(':'); |
| 4241 | |
| 4242 | if (separator === -1) { |
| 4243 | // Name but no value in the header |
| 4244 | headers[toSplit] = null; |
| 4245 | |
| 4246 | continue; |
| 4247 | } |
| 4248 | |
| 4249 | var name = toSplit.substring(0, separator).trim(); |
| 4250 | var value = toSplit.substring(separator + 1).trim(); |
| 4251 | |
| 4252 | headers[name] = value; |
| 4253 | } |
| 4254 | |
| 4255 | var out = { |
| 4256 | url: request.url, |
| 4257 | method: request.method, |
| 4258 | status: response.status, |
| 4259 | statusText: response.statusText, |
| 4260 | data: response.responseText, |
| 4261 | headers: headers |
| 4262 | }; |
| 4263 | |
| 4264 | try { |
| 4265 | var possibleObj = response.responseJSON || jsyaml.safeLoad(response.responseText); |
| 4266 | out.obj = (typeof possibleObj === 'string') ? {} : possibleObj; |
| 4267 | } catch (ex) { |
| 4268 | // do not set out.obj |
| 4269 | helpers.log('unable to parse JSON/YAML content'); |
| 4270 | } |
| 4271 | |
| 4272 | // I can throw, or parse null? |
| 4273 | out.obj = out.obj || null; |
| 4274 | |
| 4275 | if (response.status >= 200 && response.status < 300) { |
| 4276 | cb.response(out); |
| 4277 | } else if (response.status === 0 || (response.status >= 400 && response.status < 599)) { |
| 4278 | cb.error(out); |
| 4279 | } else { |
| 4280 | return cb.response(out); |
| 4281 | } |
| 4282 | }; |
| 4283 | |
| 4284 | jq.support.cors = true; |
| 4285 | |
| 4286 | return jq.ajax(obj); |
| 4287 | }; |
| 4288 | |
| 4289 | SuperagentHttpClient.prototype.execute = function (obj) { |
| 4290 | var method = obj.method.toLowerCase(); |
| 4291 | var timeout = obj.timeout; |
| 4292 | |
| 4293 | if (method === 'delete') { |
| 4294 | method = 'del'; |
| 4295 | } |
| 4296 | var headers = obj.headers || {}; |
| 4297 | var r = request[method](obj.url); |
| 4298 | |
| 4299 | if (timeout) { |
| 4300 | r.timeout(timeout); |
| 4301 | } |
| 4302 | |
| 4303 | if (obj.enableCookies) { |
| 4304 | r.withCredentials(); |
| 4305 | } |
| 4306 | |
| 4307 | var accept = obj.headers.Accept; |
| 4308 | |
| 4309 | if(this.binaryRequest(accept)) { |
| 4310 | r.on('request', function () { |
| 4311 | if(this.xhr) { |
| 4312 | this.xhr.responseType = 'blob'; |
| 4313 | } |
| 4314 | }); |
| 4315 | } |
| 4316 | |
| 4317 | if(obj.body) { |
| 4318 | if(_.isObject(obj.body)) { |
| 4319 | var contentType = obj.headers['Content-Type'] || ''; |
| 4320 | if (contentType.indexOf('multipart/form-data') === 0) { |
| 4321 | delete headers['Content-Type']; |
| 4322 | if({}.toString.apply(obj.body) === '[object FormData]') { |
| 4323 | var itr = obj.body.keys(); |
| 4324 | var p = []; |
| 4325 | while(true) { |
| 4326 | var v = itr.next(); |
| 4327 | if(v.done) { |
| 4328 | break; |
| 4329 | } |
| 4330 | var key = v.value; |
| 4331 | // only once |
| 4332 | if(p.indexOf(key) === -1) { |
| 4333 | p.push(key); |
| 4334 | var value = obj.body.getAll(key); |
| 4335 | if({}.toString.apply(value) === '[object File]') { |
| 4336 | r.attach(key, value); |
| 4337 | } |
| 4338 | else { |
| 4339 | if (Array.isArray(value)) { |
| 4340 | for (var t in value) { |
| 4341 | r.field(key, value[t]); |
| 4342 | } |
| 4343 | } |
| 4344 | else { |
| 4345 | r.field(key, value); |
| 4346 | } |
| 4347 | } |
| 4348 | } |
| 4349 | } |
| 4350 | } |
| 4351 | else { |
| 4352 | var keyname, value, v; |
| 4353 | for (keyname in obj.body) { |
| 4354 | value = obj.body[keyname]; |
| 4355 | if(Array.isArray(value)) { |
| 4356 | for(v in value) { |
| 4357 | r.field(keyname, v); |
| 4358 | } |
| 4359 | } |
| 4360 | else { |
| 4361 | r.field(keyname, value); |
| 4362 | } |
| 4363 | } |
| 4364 | } |
| 4365 | } |
| 4366 | else if (_.isObject(obj.body)) { |
| 4367 | obj.body = JSON.stringify(obj.body); |
| 4368 | r.send(obj.body); |
| 4369 | } |
| 4370 | } |
| 4371 | else { |
| 4372 | r.send(obj.body); |
| 4373 | } |
| 4374 | } |
| 4375 | |
| 4376 | var name; |
| 4377 | for (name in headers) { |
| 4378 | r.set(name, headers[name]); |
| 4379 | } |
| 4380 | |
| 4381 | if(typeof r.buffer === 'function') { |
| 4382 | r.buffer(); // force superagent to populate res.text with the raw response data |
| 4383 | } |
| 4384 | |
| 4385 | r.end(function (err, res) { |
| 4386 | res = res || { |
| 4387 | status: 0, |
| 4388 | headers: {error: 'no response from server'} |
| 4389 | }; |
| 4390 | var response = { |
| 4391 | url: obj.url, |
| 4392 | method: obj.method, |
| 4393 | headers: res.headers |
| 4394 | }; |
| 4395 | var cb; |
| 4396 | |
| 4397 | if (!err && res.error) { |
| 4398 | err = res.error; |
| 4399 | } |
| 4400 | |
| 4401 | if (err && obj.on && obj.on.error) { |
| 4402 | response.errObj = err; |
| 4403 | response.status = res ? res.status : 500; |
| 4404 | response.statusText = res ? res.text : err.message; |
| 4405 | if (res.headers && res.headers['content-type']) { |
| 4406 | if (res.headers['content-type'].indexOf('application/json') >= 0) { |
| 4407 | try { |
| 4408 | response.obj = JSON.parse(response.statusText); |
| 4409 | } |
| 4410 | catch (e) { |
| 4411 | response.obj = null; |
| 4412 | } |
| 4413 | } |
| 4414 | } |
| 4415 | cb = obj.on.error; |
| 4416 | } else if (res && obj.on && obj.on.response) { |
| 4417 | var possibleObj; |
| 4418 | |
| 4419 | // Already parsed by by superagent? |
| 4420 | if (res.body && _.keys(res.body).length > 0) { |
| 4421 | possibleObj = res.body; |
| 4422 | } else { |
| 4423 | try { |
| 4424 | possibleObj = jsyaml.safeLoad(res.text); |
| 4425 | // can parse into a string... which we don't need running around in the system |
| 4426 | possibleObj = (typeof possibleObj === 'string') ? null : possibleObj; |
| 4427 | } catch (e) { |
| 4428 | helpers.log('cannot parse JSON/YAML content'); |
| 4429 | } |
| 4430 | } |
| 4431 | |
| 4432 | // null means we can't parse into object |
| 4433 | if(typeof Buffer === 'function' && Buffer.isBuffer(possibleObj)) { |
| 4434 | response.data = possibleObj; |
| 4435 | } |
| 4436 | else { |
| 4437 | response.obj = (typeof possibleObj === 'object') ? possibleObj : null; |
| 4438 | } |
| 4439 | |
| 4440 | response.status = res.status; |
| 4441 | response.statusText = res.text; |
| 4442 | cb = obj.on.response; |
| 4443 | } |
| 4444 | if (res.xhr && res.xhr.response) { |
| 4445 | response.data = res.xhr.response; |
| 4446 | } |
| 4447 | else if(!response.data) { |
| 4448 | response.data = response.statusText; |
| 4449 | } |
| 4450 | |
| 4451 | if (cb) { |
| 4452 | cb(response); |
| 4453 | } |
| 4454 | }); |
| 4455 | }; |
| 4456 | |
| 4457 | SuperagentHttpClient.prototype. binaryRequest = function (accept) { |
| 4458 | if(!accept) { |
| 4459 | return false; |
| 4460 | } |
| 4461 | return (/^image/i).test(accept) || (/^application\/pdf/).test(accept); |
| 4462 | }; |
| 4463 | |
| 4464 | }).call(this,require("buffer").Buffer) |
| 4465 | //# sourceMapp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UgPSAnYmxvYic7XG4gICAgICB9XG4gICAgfSk7XG4gIH1cblxuICBpZihvYmouYm9keSkge1xuICAgIGlmKF8uaXNPYmplY3Qob2JqLmJvZHkpKSB7XG4gICAgICB2YXIgY29udGVudFR5cGUgPSBvYmouaGVhZGVyc1snQ29udGVudC1UeXBlJ10gfHwgJyc7XG4gICAgICBpZiAoY29udGVudFR5cGUuaW5kZXhPZignbXVsdGlwYXJ0L2Zvcm0tZGF0YScpID09PSAwKSB7XG4gICAgICAgIGRlbGV0ZSBoZWFkZXJzWydDb250ZW50LVR5cGUnXTtcbiAgICAgICAgaWYoe30udG9TdHJpbmcuYXBwbHkob2JqLmJvZHkpID09PSAnW29iamVjdCBGb3JtRGF0YV0nKSB7XG4gICAgICAgICAgdmFyIGl0ciA9IG9iai5ib2R5LmtleXMoKTtcbiAgICAgICAgICB2YXIgcCA9IFtdO1xuICAgICAgICAgIHdoaWxlKHRydWUpIHtcbiAgICAgICAgICAgIHZhciB2ID0gaXRyLm5leHQoKTtcbiAgICAgICAgICAgIGlmKHYuZG9uZSkge1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciBrZXkgPSB2LnZhbHVlO1xuICAgICAgICAgICAgLy8gb25seSBvbmNlXG4gICAgICAgICAgICBpZihwLmluZGV4T2Yoa2V5KSA9PT0gLTEpIHtcbiAgICAgICAgICAgICAgcC5wdXNoKGtleSk7XG4gICAgICAgICAgICAgIHZhciB2YWx1ZSA9IG9iai5ib2R5LmdldEFsbChrZXkpO1xuICAgICAgICAgICAgICBpZih7fS50b1N0cmluZy5hcHBseSh2YWx1ZSkgPT09ICdbb2JqZWN0IEZpbGVdJykge1xuICAgICAgICAgICAgICAgIHIuYXR0YWNoKGtleSwgdmFsdWUpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KHZhbHVlKSkge1xuICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCBpbiB2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICByLmZpZWxkKGtleSwgdmFsdWVbdF0pO1xuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgIHIuZmllbGQoa2V5LCB2YWx1ZSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGVsc2Uge1xuICAgICAgICAgIHZhciBrZXluYW1lLCB2YWx1ZSwgdjtcbiAgICAgICAgICBmb3IgKGtleW5hbWUgaW4gb2JqLmJvZHkpIHtcbiAgICAgICAgICAgIHZhbHVlID0gb2JqLmJvZHlba2V5bmFtZV07XG4gICAgICAgICAgICBpZihBcnJheS5pc0FycmF5KHZhbHVlKSkge1xuICAgICAgICAgICAgICBmb3IodiBpbiB2YWx1ZSkge1xuICAgICAgICAgICAgICAgIHIuZmllbGQoa2V5bmFtZSwgdik7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICByLmZpZWxkKGtleW5hbWUsIHZhbHVlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIGVsc2UgaWYgKF8uaXNPYmplY3Qob2JqLmJvZHkpKSB7XG4gICAgICAgIG9iai5ib2R5ID0gSlNPTi5zdHJpbmdpZnkob2JqLmJvZHkpO1xuICAgICAgICByLnNlbmQob2JqLmJvZHkpO1xuICAgICAgfVxuICAgIH1cbiAgICBlbHNlIHtcbiAgICAgIHIuc2VuZChvYmouYm9keSk7XG4gICAgfVxuICB9XG5cbiAgdmFyIG5hbWU7XG4gIGZvciAobmFtZSBpbiBoZWFkZXJzKSB7XG4gICAgci5zZXQobmFtZSw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7XG4gICAgICAgIHJlc3BvbnNlLmRhdGEgPSBwb3NzaWJsZU9iajtcbiAgICAgIH1cbiAgICAgIGVsc2Uge1xuICAgICAgICByZXNwb25zZS5vYmogPSAodHlwZW9mIHBvc3NpYmxlT2JqID09PSAnb2JqZWN0JykgPyBwb3NzaWJsZU9iaiA6IG51bGw7XG4gICAgICB9XG5cbiAgICAgIHJlc3BvbnNlLnN0YXR1cyA9IHJlcy5zdGF0dXM7XG4gICAgICByZXNwb25zZS5zdGF0dXNUZXh0ID0gcmVzLnRleHQ7XG4gICAgICBjYiA9IG9iai5vbi5yZXNwb25zZTtcbiAgICB9XG4gICAgaWYgKHJlcy54aHIgJiYgcmVzLnhoci5yZXNwb25zZSkge1xuICAgICAgcmVzcG9uc2UuZGF0YSA9IHJlcy54aHIucmVzcG9uc2U7XG4gICAgfVxuICAgIGVsc2UgaWYoIXJlc3BvbnNlLmRhdGEpIHtcbiAgICAgIHJlc3BvbnNlLmRhdGEgPSByZXNwb25zZS5zdGF0dXNUZXh0O1xuICAgIH1cblxuICAgIGlmIChjYikge1xuICAgICAgY2IocmVzcG9uc2UpO1xuICAgIH1cbiAgfSk7XG59O1xuXG5TdXBlcmFnZW50SHR0cENsaWVudC5wcm90b3R5cGUuIGJpbmFyeVJlcXVlc3QgPSBmdW5jdGlvbiAoYWNjZXB0KSB7XG4gIGlmKCFhY2NlcHQpIHtcbiAgICByZXR1cm4gZmFsc2U7XG4gIH1cbiAgcmV0dXJuICgvXmltYWdlL2kpLnRlc3QoYWNjZXB0KSB8fCAoL15hcHBsaWNhdGlvblxcL3BkZi8pLnRlc3QoYWNjZXB0KTtcbn07XG4iXX0= |
| 4466 | },{"./helpers":4,"buffer":14,"js-yaml":19,"lodash-compat/lang/isObject":144,"lodash-compat/object/keys":149,"superagent":158}],6:[function(require,module,exports){ |
| 4467 | 'use strict'; |
| 4468 | |
| 4469 | var SwaggerHttp = require('./http'); |
| 4470 | var _ = { |
| 4471 | isObject: require('lodash-compat/lang/isObject'), |
| 4472 | cloneDeep: require('lodash-compat/lang/cloneDeep'), |
| 4473 | isArray: require('lodash-compat/lang/isArray'), |
| 4474 | isString: require('lodash-compat/lang/isString') |
| 4475 | }; |
| 4476 | |
| 4477 | |
| 4478 | /** |
| 4479 | * Resolves a spec's remote references |
| 4480 | */ |
| 4481 | var Resolver = module.exports = function () { |
| 4482 | this.failedUrls = []; |
| 4483 | this.resolverCache = {}; |
| 4484 | this.pendingUrls = {}; |
| 4485 | }; |
| 4486 | |
| 4487 | Resolver.prototype.processAllOf = function(root, name, definition, resolutionTable, unresolvedRefs, spec) { |
| 4488 | var i, location, property; |
| 4489 | |
| 4490 | definition['x-resolved-from'] = [ '#/definitions/' + name ]; |
| 4491 | var allOf = definition.allOf; |
| 4492 | // the refs go first |
| 4493 | allOf.sort(function(a, b) { |
| 4494 | if(a.$ref && b.$ref) { return 0; } |
| 4495 | else if(a.$ref) { return -1; } |
| 4496 | else { return 1; } |
| 4497 | }); |
| 4498 | for (i = 0; i < allOf.length; i++) { |
| 4499 | property = allOf[i]; |
| 4500 | location = '/definitions/' + name + '/allOf'; |
| 4501 | this.resolveInline(root, spec, property, resolutionTable, unresolvedRefs, location); |
| 4502 | } |
| 4503 | }; |
| 4504 | |
| 4505 | Resolver.prototype.resolve = function (spec, arg1, arg2, arg3) { |
| 4506 | this.spec = spec; |
| 4507 | var root = arg1, callback = arg2, scope = arg3, opts = {}, location, i; |
| 4508 | if(typeof arg1 === 'function') { |
| 4509 | root = null; |
| 4510 | callback = arg1; |
| 4511 | scope = arg2; |
| 4512 | } |
| 4513 | var _root = root; |
| 4514 | this.scope = (scope || this); |
| 4515 | this.iteration = this.iteration || 0; |
| 4516 | |
| 4517 | if(this.scope.options && this.scope.options.requestInterceptor){ |
| 4518 | opts.requestInterceptor = this.scope.options.requestInterceptor; |
| 4519 | } |
| 4520 | |
| 4521 | if(this.scope.options && this.scope.options.responseInterceptor){ |
| 4522 | opts.responseInterceptor = this.scope.options.responseInterceptor; |
| 4523 | } |
| 4524 | |
| 4525 | var name, path, property, propertyName; |
| 4526 | var processedCalls = 0, resolvedRefs = {}, unresolvedRefs = {}; |
| 4527 | var resolutionTable = []; // store objects for dereferencing |
| 4528 | |
| 4529 | spec.definitions = spec.definitions || {}; |
| 4530 | // definitions |
| 4531 | for (name in spec.definitions) { |
| 4532 | var definition = spec.definitions[name]; |
| 4533 | if(definition['$ref']) { |
| 4534 | this.resolveInline(root, spec, definition, resolutionTable, unresolvedRefs, definition); |
| 4535 | } |
| 4536 | else { |
| 4537 | for (propertyName in definition.properties) { |
| 4538 | property = definition.properties[propertyName]; |
| 4539 | if (_.isArray(property.allOf)) { |
| 4540 | this.processAllOf(root, name, property, resolutionTable, unresolvedRefs, spec); |
| 4541 | } |
| 4542 | else { |
| 4543 | this.resolveTo(root, property, resolutionTable, '/definitions'); |
| 4544 | } |
| 4545 | } |
| 4546 | |
| 4547 | if (definition.allOf) { |
| 4548 | this.processAllOf(root, name, definition, resolutionTable, unresolvedRefs, spec); |
| 4549 | } |
| 4550 | } |
| 4551 | } |
| 4552 | |
| 4553 | // shared parameters |
| 4554 | spec.parameters = spec.parameters || {}; |
| 4555 | for(name in spec.parameters) { |
| 4556 | var parameter = spec.parameters[name]; |
| 4557 | if (parameter.in === 'body' && parameter.schema) { |
| 4558 | if(_.isArray(parameter.schema.allOf)) { |
| 4559 | // move to a definition |
| 4560 | var modelName = 'inline_model'; |
| 4561 | var name = modelName; |
| 4562 | var done = false; var counter = 0; |
| 4563 | while(!done) { |
| 4564 | if(typeof spec.definitions[name] === 'undefined') { |
| 4565 | done = true; |
| 4566 | break; |
| 4567 | } |
| 4568 | name = modelName + '_' + counter; |
| 4569 | counter ++; |
| 4570 | } |
| 4571 | spec.definitions[name] = { allOf: parameter.schema.allOf }; |
| 4572 | delete parameter.schema.allOf; |
| 4573 | parameter.schema.$ref = '#/definitions/' + name; |
| 4574 | this.processAllOf(root, name, spec.definitions[name], resolutionTable, unresolvedRefs, spec); |
| 4575 | } |
| 4576 | else { |
| 4577 | this.resolveTo(root, parameter.schema, resolutionTable, location); |
| 4578 | } |
| 4579 | } |
| 4580 | |
| 4581 | if (parameter.$ref) { |
| 4582 | // parameter reference |
| 4583 | this.resolveInline(root, spec, parameter, resolutionTable, unresolvedRefs, parameter.$ref); |
| 4584 | } |
| 4585 | } |
| 4586 | |
| 4587 | // operations |
| 4588 | for (name in spec.paths) { |
| 4589 | var method, operation, responseCode; |
| 4590 | path = spec.paths[name]; |
| 4591 | |
| 4592 | for (method in path) { |
| 4593 | // operation reference |
| 4594 | if(method === '$ref') { |
| 4595 | // location = path[method]; |
| 4596 | location = '/paths' + name; |
| 4597 | this.resolveInline(root, spec, path, resolutionTable, unresolvedRefs, location); |
| 4598 | } |
| 4599 | else { |
| 4600 | operation = path[method]; |
| 4601 | var sharedParameters = path.parameters || []; |
| 4602 | var parameters = operation.parameters || []; |
| 4603 | |
| 4604 | for (i in sharedParameters) { |
| 4605 | var parameter = sharedParameters[i]; |
| 4606 | parameters.unshift(parameter); |
| 4607 | } |
| 4608 | if(method !== 'parameters' && _.isObject(operation)) { |
| 4609 | operation.parameters = operation.parameters || parameters; |
| 4610 | } |
| 4611 | |
| 4612 | for (i in parameters) { |
| 4613 | var parameter = parameters[i]; |
| 4614 | location = '/paths' + name + '/' + method + '/parameters'; |
| 4615 | |
| 4616 | if (parameter.in === 'body' && parameter.schema) { |
| 4617 | if(_.isArray(parameter.schema.allOf)) { |
| 4618 | // move to a definition |
| 4619 | var modelName = 'inline_model'; |
| 4620 | var name = modelName; |
| 4621 | var done = false; var counter = 0; |
| 4622 | while(!done) { |
| 4623 | if(typeof spec.definitions[name] === 'undefined') { |
| 4624 | done = true; |
| 4625 | break; |
| 4626 | } |
| 4627 | name = modelName + '_' + counter; |
| 4628 | counter ++; |
| 4629 | } |
| 4630 | spec.definitions[name] = { allOf: parameter.schema.allOf }; |
| 4631 | delete parameter.schema.allOf; |
| 4632 | parameter.schema.$ref = '#/definitions/' + name; |
| 4633 | this.processAllOf(root, name, spec.definitions[name], resolutionTable, unresolvedRefs, spec); |
| 4634 | } |
| 4635 | else { |
| 4636 | this.resolveTo(root, parameter.schema, resolutionTable, location); |
| 4637 | } |
| 4638 | } |
| 4639 | |
| 4640 | if (parameter.$ref) { |
| 4641 | // parameter reference |
| 4642 | this.resolveInline(root, spec, parameter, resolutionTable, unresolvedRefs, parameter.$ref); |
| 4643 | } |
| 4644 | } |
| 4645 | |
| 4646 | for (responseCode in operation.responses) { |
| 4647 | var response = operation.responses[responseCode]; |
| 4648 | location = '/paths' + name + '/' + method + '/responses/' + responseCode; |
| 4649 | |
| 4650 | if(_.isObject(response)) { |
| 4651 | if(response.$ref) { |
| 4652 | // response reference |
| 4653 | this.resolveInline(root, spec, response, resolutionTable, unresolvedRefs, location); |
| 4654 | } |
| 4655 | if (response.schema) { |
| 4656 | var responseObj = response; |
| 4657 | if(_.isArray(responseObj.schema.allOf)) { |
| 4658 | // move to a definition |
| 4659 | var modelName = 'inline_model'; |
| 4660 | var name = modelName; |
| 4661 | var done = false; var counter = 0; |
| 4662 | while(!done) { |
| 4663 | if(typeof spec.definitions[name] === 'undefined') { |
| 4664 | done = true; |
| 4665 | break; |
| 4666 | } |
| 4667 | name = modelName + '_' + counter; |
| 4668 | counter ++; |
| 4669 | } |
| 4670 | spec.definitions[name] = { allOf: responseObj.schema.allOf }; |
| 4671 | delete responseObj.schema.allOf; |
| 4672 | delete responseObj.schema.type; |
| 4673 | responseObj.schema.$ref = '#/definitions/' + name; |
| 4674 | this.processAllOf(root, name, spec.definitions[name], resolutionTable, unresolvedRefs, spec); |
| 4675 | } |
| 4676 | else if('array' === responseObj.schema.type) { |
| 4677 | if(responseObj.schema.items && responseObj.schema.items.$ref) { |
| 4678 | // response reference |
| 4679 | this.resolveInline(root, spec, responseObj.schema.items, resolutionTable, unresolvedRefs, location); |
| 4680 | } |
| 4681 | } |
| 4682 | else { |
| 4683 | this.resolveTo(root, response.schema, resolutionTable, location); |
| 4684 | } |
| 4685 | } |
| 4686 | } |
| 4687 | } |
| 4688 | } |
| 4689 | } |
| 4690 | // clear them out to avoid multiple resolutions |
| 4691 | path.parameters = []; |
| 4692 | } |
| 4693 | |
| 4694 | var expectedCalls = 0, toResolve = []; |
| 4695 | // if the root is same as obj[i].root we can resolve locally |
| 4696 | var all = resolutionTable; |
| 4697 | |
| 4698 | var parts; |
| 4699 | for(i = 0; i < all.length; i++) { |
| 4700 | var a = all[i]; |
| 4701 | if(root === a.root) { |
| 4702 | if(a.resolveAs === 'ref') { |
| 4703 | // resolve any path walking |
| 4704 | var joined = ((a.root || '') + '/' + a.key).split('/'); |
| 4705 | var normalized = []; |
| 4706 | var url = ''; |
| 4707 | var k; |
| 4708 | |
| 4709 | if(a.key.indexOf('../') >= 0) { |
| 4710 | for(var j = 0; j < joined.length; j++) { |
| 4711 | if(joined[j] === '..') { |
| 4712 | normalized = normalized.slice(0, normalized.length-1); |
| 4713 | } |
| 4714 | else { |
| 4715 | normalized.push(joined[j]); |
| 4716 | } |
| 4717 | } |
| 4718 | for(k = 0; k < normalized.length; k ++) { |
| 4719 | if(k > 0) { |
| 4720 | url += '/'; |
| 4721 | } |
| 4722 | url += normalized[k]; |
| 4723 | } |
| 4724 | // we now have to remote resolve this because the path has changed |
| 4725 | a.root = url; |
| 4726 | toResolve.push(a); |
| 4727 | } |
| 4728 | else { |
| 4729 | parts = a.key.split('#'); |
| 4730 | if(parts.length === 2) { |
| 4731 | if(parts[0].indexOf('http:') === 0 || parts[0].indexOf('https:') === 0) { |
| 4732 | a.root = parts[0]; |
| 4733 | } |
| 4734 | location = parts[1].split('/'); |
| 4735 | var r; |
| 4736 | var s = spec; |
| 4737 | for(k = 0; k < location.length; k++) { |
| 4738 | var part = location[k]; |
| 4739 | if(part !== '') { |
| 4740 | s = s[part]; |
| 4741 | if(typeof s !== 'undefined') { |
| 4742 | r = s; |
| 4743 | } |
| 4744 | else { |
| 4745 | r = null; |
| 4746 | break; |
| 4747 | } |
| 4748 | } |
| 4749 | } |
| 4750 | if(r === null) { |
| 4751 | // must resolve this too |
| 4752 | toResolve.push(a); |
| 4753 | } |
| 4754 | } |
| 4755 | } |
| 4756 | } |
| 4757 | else { |
| 4758 | if (a.resolveAs === 'inline') { |
| 4759 | if(a.key && a.key.indexOf('#') === -1 && a.key.charAt(0) !== '/') { |
| 4760 | // handle relative schema |
| 4761 | parts = a.root.split('/'); |
| 4762 | location = ''; |
| 4763 | for(i = 0; i < parts.length - 1; i++) { |
| 4764 | location += parts[i] + '/'; |
| 4765 | } |
| 4766 | location += a.key; |
| 4767 | a.root = location; |
| 4768 | a.location = ''; |
| 4769 | } |
| 4770 | toResolve.push(a); |
| 4771 | } |
| 4772 | } |
| 4773 | } |
| 4774 | else { |
| 4775 | toResolve.push(a); |
| 4776 | } |
| 4777 | } |
| 4778 | expectedCalls = toResolve.length; |
| 4779 | |
| 4780 | // resolve anything that is local |
| 4781 | |
| 4782 | var lock = {}; |
| 4783 | for(var ii = 0; ii < toResolve.length; ii++) { |
| 4784 | (function(item, spec, self, lock, ii) { |
| 4785 | if(!item.root || item.root === root) { |
| 4786 | // local resolve |
| 4787 | self.resolveItem(spec, _root, resolutionTable, resolvedRefs, unresolvedRefs, item); |
| 4788 | processedCalls += 1; |
| 4789 | |
| 4790 | if(processedCalls === expectedCalls) { |
| 4791 | self.finish(spec, root, resolutionTable, resolvedRefs, unresolvedRefs, callback, true); |
| 4792 | } |
| 4793 | } |
| 4794 | else if(self.failedUrls.indexOf(item.root) === -1) { |
| 4795 | var obj = { |
| 4796 | useJQuery: false, // TODO |
| 4797 | url: item.root, |
| 4798 | method: 'get', |
| 4799 | headers: { |
| 4800 | accept: self.scope.swaggerRequestHeaders || 'application/json' |
| 4801 | }, |
| 4802 | on: { |
| 4803 | error: function (error) { |
| 4804 | processedCalls += 1; |
| 4805 | console.log('failed url: ' + obj.url); |
| 4806 | self.failedUrls.push(obj.url); |
| 4807 | if (lock) { |
| 4808 | delete lock[item.root]; |
| 4809 | } |
| 4810 | unresolvedRefs[item.key] = { |
| 4811 | root: item.root, |
| 4812 | location: item.location |
| 4813 | }; |
| 4814 | |
| 4815 | if (processedCalls === expectedCalls) { |
| 4816 | self.finish(spec, _root, resolutionTable, resolvedRefs, unresolvedRefs, callback); |
| 4817 | } |
| 4818 | }, // jshint ignore:line |
| 4819 | response: function (response) { |
| 4820 | var swagger = response.obj; |
| 4821 | if (lock) { |
| 4822 | delete lock[item.root]; |
| 4823 | } |
| 4824 | if (self.resolverCache) { |
| 4825 | self.resolverCache[item.root] = swagger; |
| 4826 | } |
| 4827 | self.resolveItem(swagger, item.root, resolutionTable, resolvedRefs, unresolvedRefs, item); |
| 4828 | processedCalls += 1; |
| 4829 | |
| 4830 | if (processedCalls === expectedCalls) { |
| 4831 | self.finish(spec, _root, resolutionTable, resolvedRefs, unresolvedRefs, callback); |
| 4832 | } |
| 4833 | } |
| 4834 | } // jshint ignore:line |
| 4835 | }; |
| 4836 | |
| 4837 | // apply timeout only when specified |
| 4838 | if (scope && scope.fetchSpecTimeout) { |
| 4839 | obj.timeout = scope.fetchSpecTimeout; |
| 4840 | } |
| 4841 | |
| 4842 | if (scope && scope.clientAuthorizations) { |
| 4843 | scope.clientAuthorizations.apply(obj); |
| 4844 | } |
| 4845 | |
| 4846 | (function waitForUnlock() { |
| 4847 | setTimeout(function() { |
| 4848 | if (lock[obj.url]) { |
| 4849 | waitForUnlock(); |
| 4850 | } |
| 4851 | else { |
| 4852 | var cached = self.resolverCache[obj.url]; |
| 4853 | if (_.isObject(cached)) { |
| 4854 | obj.on.response({obj: cached}), 1; |
| 4855 | } |
| 4856 | else { |
| 4857 | lock[obj.url] = true; |
| 4858 | new SwaggerHttp().execute(obj, opts); |
| 4859 | } |
| 4860 | } |
| 4861 | }, 0); |
| 4862 | })(); |
| 4863 | } |
| 4864 | |
| 4865 | else { |
| 4866 | processedCalls += 1; |
| 4867 | unresolvedRefs[item.key] = { |
| 4868 | root: item.root, |
| 4869 | location: item.location |
| 4870 | }; |
| 4871 | if (processedCalls === expectedCalls) { |
| 4872 | self.finish(spec, _root, resolutionTable, resolvedRefs, unresolvedRefs, callback); |
| 4873 | } |
| 4874 | } |
| 4875 | }(toResolve[ii], spec, this, lock, ii)); |
| 4876 | } |
| 4877 | |
| 4878 | if (Object.keys(toResolve).length === 0) { |
| 4879 | this.finish(spec, _root, resolutionTable, resolvedRefs, unresolvedRefs, callback); |
| 4880 | } |
| 4881 | }; |
| 4882 | |
| 4883 | Resolver.prototype.resolveItem = function(spec, root, resolutionTable, resolvedRefs, unresolvedRefs, item) { |
| 4884 | var path = item.location; |
| 4885 | var location = spec, parts = path.split('/'); |
| 4886 | if(path !== '') { |
| 4887 | for (var j = 0; j < parts.length; j++) { |
| 4888 | var segment = parts[j]; |
| 4889 | if (segment.indexOf('~1') !== -1) { |
| 4890 | segment = parts[j].replace(/~0/g, '~').replace(/~1/g, '/'); |
| 4891 | if (segment.charAt(0) !== '/') { |
| 4892 | segment = '/' + segment; |
| 4893 | } |
| 4894 | } |
| 4895 | if (typeof location === 'undefined' || location === null) { |
| 4896 | break; |
| 4897 | } |
| 4898 | if (segment === '' && j === (parts.length - 1) && parts.length > 1) { |
| 4899 | location = null; |
| 4900 | break; |
| 4901 | } |
| 4902 | if (segment.length > 0) { |
| 4903 | location = location[segment]; |
| 4904 | } |
| 4905 | } |
| 4906 | } |
| 4907 | var resolved = item.key; |
| 4908 | parts = item.key.split('/'); |
| 4909 | var resolvedName = parts[parts.length-1]; |
| 4910 | |
| 4911 | if(resolvedName.indexOf('#') >= 0) { |
| 4912 | resolvedName = resolvedName.split('#')[1]; |
| 4913 | } |
| 4914 | |
| 4915 | if (location !== null && typeof location !== 'undefined') { |
| 4916 | resolvedRefs[resolved] = { |
| 4917 | name: resolvedName, |
| 4918 | obj: location, |
| 4919 | key: item.key, |
| 4920 | root: item.root |
| 4921 | }; |
| 4922 | } else { |
| 4923 | unresolvedRefs[resolved] = { |
| 4924 | root: item.root, |
| 4925 | location: item.location |
| 4926 | }; |
| 4927 | } |
| 4928 | }; |
| 4929 | |
| 4930 | Resolver.prototype.finish = function (spec, root, resolutionTable, resolvedRefs, unresolvedRefs, callback, localResolve) { |
| 4931 | // walk resolution table and replace with resolved refs |
| 4932 | var ref; |
| 4933 | for (ref in resolutionTable) { |
| 4934 | var item = resolutionTable[ref]; |
| 4935 | |
| 4936 | var key = item.key; |
| 4937 | var resolvedTo = resolvedRefs[key]; |
| 4938 | if (resolvedTo) { |
| 4939 | spec.definitions = spec.definitions || {}; |
| 4940 | if (item.resolveAs === 'ref') { |
| 4941 | if (localResolve !== true) { |
| 4942 | // don't retain root for local definitions |
| 4943 | for (key in resolvedTo.obj) { |
| 4944 | var abs = this.retainRoot(key, resolvedTo.obj[key], item.root); |
| 4945 | resolvedTo.obj[key] = abs; |
| 4946 | } |
| 4947 | } |
| 4948 | spec.definitions[resolvedTo.name] = resolvedTo.obj; |
| 4949 | item.obj.$ref = '#/definitions/' + resolvedTo.name; |
| 4950 | } else if (item.resolveAs === 'inline') { |
| 4951 | var targetObj = item.obj; |
| 4952 | targetObj['x-resolved-from'] = [ item.key ]; |
| 4953 | delete targetObj.$ref; |
| 4954 | |
| 4955 | for (key in resolvedTo.obj) { |
| 4956 | var abs = resolvedTo.obj[key]; |
| 4957 | |
| 4958 | if (localResolve !== true) { |
| 4959 | // don't retain root for local definitions |
| 4960 | abs = this.retainRoot(key, resolvedTo.obj[key], item.root); |
| 4961 | } |
| 4962 | targetObj[key] = abs; |
| 4963 | } |
| 4964 | } |
| 4965 | } |
| 4966 | } |
| 4967 | var existingUnresolved = this.countUnresolvedRefs(spec); |
| 4968 | |
| 4969 | if(existingUnresolved === 0 || this.iteration > 5) { |
| 4970 | this.resolveAllOf(spec.definitions); |
| 4971 | this.resolverCache = null; |
| 4972 | callback.call(this.scope, spec, unresolvedRefs); |
| 4973 | } |
| 4974 | else { |
| 4975 | this.iteration += 1; |
| 4976 | this.resolve(spec, root, callback, this.scope); |
| 4977 | } |
| 4978 | }; |
| 4979 | |
| 4980 | Resolver.prototype.countUnresolvedRefs = function(spec) { |
| 4981 | var i; |
| 4982 | var refs = this.getRefs(spec); |
| 4983 | var keys = []; |
| 4984 | var unresolvedKeys = []; |
| 4985 | for(i in refs) { |
| 4986 | if(i.indexOf('#') === 0) { |
| 4987 | keys.push(i.substring(1)); |
| 4988 | } |
| 4989 | else { |
| 4990 | unresolvedKeys.push(i); |
| 4991 | } |
| 4992 | } |
| 4993 | |
| 4994 | // verify possible keys |
| 4995 | for (i = 0; i < keys.length; i++) { |
| 4996 | var part = keys[i]; |
| 4997 | var parts = part.split('/'); |
| 4998 | var obj = spec; |
| 4999 | |
| 5000 | for (var k = 0; k < parts.length; k++) { |
| 5001 | var key = parts[k]; |
| 5002 | if(key !== '') { |
| 5003 | obj = obj[key]; |
| 5004 | if(typeof obj === 'undefined') { |
| 5005 | unresolvedKeys.push(part); |
| 5006 | break; |
| 5007 | } |
| 5008 | } |
| 5009 | } |
| 5010 | } |
| 5011 | return unresolvedKeys.length; |
| 5012 | }; |
| 5013 | |
| 5014 | Resolver.prototype.getRefs = function(spec, obj) { |
| 5015 | obj = obj || spec; |
| 5016 | var output = {}; |
| 5017 | for(var key in obj) { |
| 5018 | if (!obj.hasOwnProperty(key)) { |
| 5019 | continue; |
| 5020 | } |
| 5021 | var item = obj[key]; |
| 5022 | if(key === '$ref' && typeof item === 'string') { |
| 5023 | output[item] = null; |
| 5024 | } |
| 5025 | else if(_.isObject(item)) { |
| 5026 | var o = this.getRefs(item); |
| 5027 | for(var k in o) { |
| 5028 | output[k] = null; |
| 5029 | } |
| 5030 | } |
| 5031 | } |
| 5032 | return output; |
| 5033 | }; |
| 5034 | |
| 5035 | function splitUrl(url) { |
| 5036 | var result = {}; |
| 5037 | var proto = /[a-z]+:\/\//i.exec(url); |
| 5038 | if (proto) { |
| 5039 | result.proto = proto[0].slice(0, -3); |
| 5040 | url = url.slice(result.proto.length + 1); |
| 5041 | } |
| 5042 | if (url.slice(0, 2) === '//') { |
| 5043 | result.domain = url.slice(2).split('/')[0]; |
| 5044 | url = url.slice(2 + result.domain.length); |
| 5045 | } |
| 5046 | var p = url.split('#'); |
| 5047 | if (p[0].length) { |
| 5048 | result.path = p[0]; |
| 5049 | } |
| 5050 | if (p.length > 1) { |
| 5051 | result.fragment = p.slice(1).join('#'); |
| 5052 | } |
| 5053 | return result; |
| 5054 | } |
| 5055 | |
| 5056 | function unsplitUrl(url) { |
| 5057 | var result = url.path; |
| 5058 | if (result === undefined) { |
| 5059 | result = ''; |
| 5060 | } |
| 5061 | if (url.fragment !== undefined) { |
| 5062 | result += '#' + url.fragment; |
| 5063 | } |
| 5064 | if (url.domain !== undefined) { |
| 5065 | if (result.slice(0, 1) === '/') { |
| 5066 | result = result.slice(1); |
| 5067 | } |
| 5068 | result = '//' + url.domain + '/' + result; |
| 5069 | if (url.proto !== undefined) { |
| 5070 | result = url.proto + ':' + result; |
| 5071 | } |
| 5072 | } |
| 5073 | return result; |
| 5074 | } |
| 5075 | |
| 5076 | function joinUrl(base, rel) { |
| 5077 | var relsp = splitUrl(rel); |
| 5078 | if (relsp.domain !== undefined) { |
| 5079 | return rel; |
| 5080 | } |
| 5081 | var result = splitUrl(base); |
| 5082 | if (relsp.path === undefined) { |
| 5083 | // change only fragment part |
| 5084 | result.fragment = relsp.fragment; |
| 5085 | } else if (relsp.path.slice(0, 1) === '/') { |
| 5086 | // relative to domain |
| 5087 | result.path = relsp.path; |
| 5088 | result.fragment = relsp.fragment; |
| 5089 | } else { |
| 5090 | // relative to path |
| 5091 | var path = result.path === undefined ? [] : result.path.split('/'); |
| 5092 | var relpath = relsp.path.split('/'); |
| 5093 | if (path.length) { |
| 5094 | path.pop(); |
| 5095 | } |
| 5096 | while (relpath[0] === '..' || relpath[0] === '.') { |
| 5097 | if (relpath[0] === '..') { |
| 5098 | path.pop(); |
| 5099 | } |
| 5100 | relpath.shift(); |
| 5101 | } |
| 5102 | result.path = path.concat(relpath).join('/'); |
| 5103 | result.fragment = relsp.fragment; |
| 5104 | } |
| 5105 | return unsplitUrl(result); |
| 5106 | } |
| 5107 | |
| 5108 | Resolver.prototype.retainRoot = function(origKey, obj, root) { |
| 5109 | // walk object and look for relative $refs |
| 5110 | if(_.isObject(obj)) { |
| 5111 | for(var key in obj) { |
| 5112 | var item = obj[key]; |
| 5113 | if (key === '$ref' && typeof item === 'string') { |
| 5114 | obj[key] = joinUrl(root, item); |
| 5115 | } |
| 5116 | else if (_.isObject(item)) { |
| 5117 | this.retainRoot(key, item, root); |
| 5118 | } |
| 5119 | } |
| 5120 | } |
| 5121 | else if(_.isString(obj) && origKey === '$ref') { |
| 5122 | obj = joinUrl(root, obj); |
| 5123 | } |
| 5124 | return obj; |
| 5125 | }; |
| 5126 | |
| 5127 | /** |
| 5128 | * immediately in-lines local refs, queues remote refs |
| 5129 | * for inline resolution |
| 5130 | */ |
| 5131 | Resolver.prototype.resolveInline = function (root, spec, property, resolutionTable, unresolvedRefs, location) { |
| 5132 | var key = property.$ref, ref = property.$ref, i, p, p2, rs; |
| 5133 | var rootTrimmed = false; |
| 5134 | |
| 5135 | root = root || '' // Guard against .split. @fehguy, you'll need to check if this logic fits |
| 5136 | // More imporantly is how do we gracefully handle relative urls, when provided just a 'spec', not a 'url' ? |
| 5137 | |
| 5138 | if (ref) { |
| 5139 | if(ref.indexOf('../') === 0) { |
| 5140 | // reset root |
| 5141 | p = ref.split('../'); |
| 5142 | p2 = root.split('/'); |
| 5143 | ref = ''; |
| 5144 | for(i = 0; i < p.length; i++) { |
| 5145 | if(p[i] === '') { |
| 5146 | p2 = p2.slice(0, p2.length-1); |
| 5147 | } |
| 5148 | else { |
| 5149 | ref += p[i]; |
| 5150 | } |
| 5151 | } |
| 5152 | root = ''; |
| 5153 | for(i = 0; i < p2.length - 1; i++) { |
| 5154 | if(i > 0) { root += '/'; } |
| 5155 | root += p2[i]; |
| 5156 | } |
| 5157 | rootTrimmed = true; |
| 5158 | } |
| 5159 | if(ref.indexOf('#') >= 0) { |
| 5160 | if(ref.indexOf('/') === 0) { |
| 5161 | rs = ref.split('#'); |
| 5162 | p = root.split('//'); |
| 5163 | p2 = p[1].split('/'); |
| 5164 | root = p[0] + '//' + p2[0] + rs[0]; |
| 5165 | location = rs[1]; |
| 5166 | } |
| 5167 | else { |
| 5168 | rs = ref.split('#'); |
| 5169 | if(rs[0] !== '') { |
| 5170 | p2 = root.split('/'); |
| 5171 | p2 = p2.slice(0, p2.length - 1); |
| 5172 | if(!rootTrimmed) { |
| 5173 | root = ''; |
| 5174 | for (var k = 0; k < p2.length; k++) { |
| 5175 | if(k > 0) { root += '/'; } |
| 5176 | root += p2[k]; |
| 5177 | } |
| 5178 | } |
| 5179 | root += '/' + ref.split('#')[0]; |
| 5180 | } |
| 5181 | location = rs[1]; |
| 5182 | } |
| 5183 | } |
| 5184 | if (ref.indexOf('http:') === 0 || ref.indexOf('https:') === 0) { |
| 5185 | if(ref.indexOf('#') >= 0) { |
| 5186 | root = ref.split('#')[0]; |
| 5187 | location = ref.split('#')[1]; |
| 5188 | } |
| 5189 | else { |
| 5190 | root = ref; |
| 5191 | location = ''; |
| 5192 | } |
| 5193 | resolutionTable.push({obj: property, resolveAs: 'inline', root: root, key: key, location: location}); |
| 5194 | } else if (ref.indexOf('#') === 0) { |
| 5195 | location = ref.split('#')[1]; |
| 5196 | resolutionTable.push({obj: property, resolveAs: 'inline', root: root, key: key, location: location}); |
| 5197 | } else if (ref.indexOf('/') === 0 && ref.indexOf('#') === -1) { |
| 5198 | location = ref; |
| 5199 | var matches = root.match(/^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i); |
| 5200 | if(matches) { |
| 5201 | root = matches[0] + ref.substring(1); |
| 5202 | location = ''; |
| 5203 | } |
| 5204 | resolutionTable.push({obj: property, resolveAs: 'inline', root: root, key: key, location: location}); |
| 5205 | } |
| 5206 | else { |
| 5207 | resolutionTable.push({obj: property, resolveAs: 'inline', root: root, key: key, location: location}); |
| 5208 | } |
| 5209 | } |
| 5210 | else if (property.type === 'array') { |
| 5211 | this.resolveTo(root, property.items, resolutionTable, location); |
| 5212 | } |
| 5213 | }; |
| 5214 | |
| 5215 | Resolver.prototype.resolveTo = function (root, property, resolutionTable, location) { |
| 5216 | var sp, i; |
| 5217 | var ref = property.$ref; |
| 5218 | var lroot = root; |
| 5219 | if ((typeof ref !== 'undefined') && (ref !== null)) { |
| 5220 | if(ref.indexOf('#') >= 0) { |
| 5221 | var parts = ref.split('#'); |
| 5222 | |
| 5223 | // #/definitions/foo |
| 5224 | // foo.json#/bar |
| 5225 | if(parts[0] && ref.indexOf('/') === 0) { |
| 5226 | |
| 5227 | } |
| 5228 | else if(parts[0] && (parts[0].indexOf('http:') === 0 || parts[0].indexOf('https:') === 0)) { |
| 5229 | lroot = parts[0]; |
| 5230 | ref = parts[1]; |
| 5231 | } |
| 5232 | else if(parts[0] && parts[0].length > 0) { |
| 5233 | // relative file |
| 5234 | sp = root.split('/'); |
| 5235 | lroot = ''; |
| 5236 | for(i = 0; i < sp.length - 1; i++) { |
| 5237 | lroot += sp[i] + '/'; |
| 5238 | } |
| 5239 | lroot += parts[0]; |
| 5240 | } |
| 5241 | else { |
| 5242 | |
| 5243 | } |
| 5244 | |
| 5245 | location = parts[1]; |
| 5246 | } |
| 5247 | else if (ref.indexOf('http:') === 0 || ref.indexOf('https:') === 0) { |
| 5248 | lroot = ref; |
| 5249 | location = ''; |
| 5250 | } |
| 5251 | else { |
| 5252 | // relative file |
| 5253 | sp = root.split('/'); |
| 5254 | lroot = ''; |
| 5255 | for(i = 0; i < sp.length - 1; i++) { |
| 5256 | lroot += sp[i] + '/'; |
| 5257 | } |
| 5258 | lroot += ref; |
| 5259 | location = ''; |
| 5260 | } |
| 5261 | resolutionTable.push({ |
| 5262 | obj: property, resolveAs: 'ref', root: lroot, key: ref, location: location |
| 5263 | }); |
| 5264 | } else if (property.type === 'array') { |
| 5265 | var items = property.items; |
| 5266 | this.resolveTo(root, items, resolutionTable, location); |
| 5267 | } else { |
| 5268 | if(property && (property.properties || property.additionalProperties)) { |
| 5269 | var name = this.uniqueName('inline_model'); |
| 5270 | if (property.title) { |
| 5271 | name = this.uniqueName(property.title); |
| 5272 | } |
| 5273 | delete property.title; |
| 5274 | this.spec.definitions[name] = _.cloneDeep(property); |
| 5275 | property['$ref'] = '#/definitions/' + name; |
| 5276 | delete property.type; |
| 5277 | delete property.properties; |
| 5278 | } |
| 5279 | } |
| 5280 | }; |
| 5281 | |
| 5282 | Resolver.prototype.uniqueName = function(base) { |
| 5283 | var name = base; |
| 5284 | var count = 0; |
| 5285 | while(true) { |
| 5286 | if(!_.isObject(this.spec.definitions[name])) { |
| 5287 | return name; |
| 5288 | } |
| 5289 | name = base + '_' + count; |
| 5290 | count++; |
| 5291 | } |
| 5292 | }; |
| 5293 | |
| 5294 | Resolver.prototype.resolveAllOf = function(spec, obj, depth) { |
| 5295 | depth = depth || 0; |
| 5296 | obj = obj || spec; |
| 5297 | var name; |
| 5298 | for(var key in obj) { |
| 5299 | if (!obj.hasOwnProperty(key)) { |
| 5300 | continue; |
| 5301 | } |
| 5302 | var item = obj[key]; |
| 5303 | if(item === null) { |
| 5304 | throw new TypeError('Swagger 2.0 does not support null types (' + obj + '). See https://github.com/swagger-api/swagger-spec/issues/229.'); |
| 5305 | } |
| 5306 | if(typeof item === 'object') { |
| 5307 | this.resolveAllOf(spec, item, depth + 1); |
| 5308 | } |
| 5309 | if(item && typeof item.allOf !== 'undefined') { |
| 5310 | var allOf = item.allOf; |
| 5311 | if(_.isArray(allOf)) { |
| 5312 | var output = _.cloneDeep(item); |
| 5313 | delete output.allOf; |
| 5314 | |
| 5315 | output['x-composed'] = true; |
| 5316 | if (typeof item['x-resolved-from'] !== 'undefined') { |
| 5317 | output['x-resolved-from'] = item['x-resolved-from']; |
| 5318 | } |
| 5319 | |
| 5320 | for(var i = 0; i < allOf.length; i++) { |
| 5321 | var component = allOf[i]; |
| 5322 | var source = 'self'; |
| 5323 | if(typeof component['x-resolved-from'] !== 'undefined') { |
| 5324 | source = component['x-resolved-from'][0]; |
| 5325 | } |
| 5326 | |
| 5327 | for(var part in component) { |
| 5328 | if(!output.hasOwnProperty(part)) { |
| 5329 | output[part] = _.cloneDeep(component[part]); |
| 5330 | if(part === 'properties') { |
| 5331 | for(name in output[part]) { |
| 5332 | output[part][name]['x-resolved-from'] = source; |
| 5333 | } |
| 5334 | } |
| 5335 | } |
| 5336 | else { |
| 5337 | if(part === 'properties') { |
| 5338 | var properties = component[part]; |
| 5339 | for(name in properties) { |
| 5340 | output.properties[name] = _.cloneDeep(properties[name]); |
| 5341 | var resolvedFrom = properties[name]['x-resolved-from']; |
| 5342 | if (typeof resolvedFrom === 'undefined' || resolvedFrom === 'self') { |
| 5343 | resolvedFrom = source; |
| 5344 | } |
| 5345 | output.properties[name]['x-resolved-from'] = resolvedFrom; |
| 5346 | } |
| 5347 | } |
| 5348 | else if(part === 'required') { |
| 5349 | // merge & dedup the required array |
| 5350 | var a = output.required.concat(component[part]); |
| 5351 | for(var k = 0; k < a.length; ++k) { |
| 5352 | for(var j = k + 1; j < a.length; ++j) { |
| 5353 | if(a[k] === a[j]) { a.splice(j--, 1); } |
| 5354 | } |
| 5355 | } |
| 5356 | output.required = a; |
| 5357 | } |
| 5358 | else if(part === 'x-resolved-from') { |
| 5359 | output['x-resolved-from'].push(source); |
| 5360 | } |
| 5361 | else { |
| 5362 | // TODO: need to merge this property |
| 5363 | // console.log('what to do with ' + part) |
| 5364 | } |
| 5365 | } |
| 5366 | } |
| 5367 | } |
| 5368 | obj[key] = output; |
| 5369 | } |
| 5370 | } |
| 5371 | } |
| 5372 | }; |
| 5373 | |
| 5374 | },{"./http":5,"lodash-compat/lang/cloneDeep":138,"lodash-compat/lang/isArray":140,"lodash-compat/lang/isObject":144,"lodash-compat/lang/isString":146}],7:[function(require,module,exports){ |
| 5375 | 'use strict'; |
| 5376 | |
| 5377 | var Helpers = require('./helpers'); |
| 5378 | |
| 5379 | var _ = { |
| 5380 | isPlainObject: require('lodash-compat/lang/isPlainObject'), |
| 5381 | isUndefined: require('lodash-compat/lang/isUndefined'), |
| 5382 | isArray: require('lodash-compat/lang/isArray'), |
| 5383 | isObject: require('lodash-compat/lang/isObject'), |
| 5384 | isEmpty: require('lodash-compat/lang/isEmpty'), |
| 5385 | map: require('lodash-compat/collection/map'), |
| 5386 | indexOf: require('lodash-compat/array/indexOf'), |
| 5387 | cloneDeep: require('lodash-compat/lang/cloneDeep'), |
| 5388 | keys: require('lodash-compat/object/keys'), |
| 5389 | forEach: require('lodash-compat/collection/forEach') |
| 5390 | }; |
| 5391 | |
| 5392 | module.exports.optionHtml = optionHtml; |
| 5393 | module.exports.typeFromJsonSchema = typeFromJsonSchema; |
| 5394 | module.exports.getStringSignature = getStringSignature; |
| 5395 | module.exports.schemaToHTML = schemaToHTML; |
| 5396 | module.exports.schemaToJSON = schemaToJSON; |
| 5397 | |
| 5398 | function optionHtml(label, value) { |
| 5399 | return '<tr><td class="optionName">' + label + ':</td><td>' + value + '</td></tr>'; |
| 5400 | } |
| 5401 | |
| 5402 | function typeFromJsonSchema(type, format) { |
| 5403 | var str; |
| 5404 | |
| 5405 | if (type === 'integer' && format === 'int32') { |
| 5406 | str = 'integer'; |
| 5407 | } else if (type === 'integer' && format === 'int64') { |
| 5408 | str = 'long'; |
| 5409 | } else if (type === 'integer' && typeof format === 'undefined') { |
| 5410 | str = 'long'; |
| 5411 | } else if (type === 'string' && format === 'date-time') { |
| 5412 | str = 'date-time'; |
| 5413 | } else if (type === 'string' && format === 'date') { |
| 5414 | str = 'date'; |
| 5415 | } else if (type === 'number' && format === 'float') { |
| 5416 | str = 'float'; |
| 5417 | } else if (type === 'number' && format === 'double') { |
| 5418 | str = 'double'; |
| 5419 | } else if (type === 'number' && typeof format === 'undefined') { |
| 5420 | str = 'double'; |
| 5421 | } else if (type === 'boolean') { |
| 5422 | str = 'boolean'; |
| 5423 | } else if (type === 'string') { |
| 5424 | str = 'string'; |
| 5425 | } |
| 5426 | |
| 5427 | return str; |
| 5428 | } |
| 5429 | |
| 5430 | function getStringSignature(obj, baseComponent) { |
| 5431 | var str = ''; |
| 5432 | |
| 5433 | if (typeof obj.$ref !== 'undefined') { |
| 5434 | str += Helpers.simpleRef(obj.$ref); |
| 5435 | } else if (typeof obj.type === 'undefined') { |
| 5436 | str += 'object'; |
| 5437 | } else if (obj.type === 'array') { |
| 5438 | if (baseComponent) { |
| 5439 | str += getStringSignature((obj.items || obj.$ref || {})); |
| 5440 | } else { |
| 5441 | str += 'Array['; |
| 5442 | str += getStringSignature((obj.items || obj.$ref || {})); |
| 5443 | str += ']'; |
| 5444 | } |
| 5445 | } else if (obj.type === 'integer' && obj.format === 'int32') { |
| 5446 | str += 'integer'; |
| 5447 | } else if (obj.type === 'integer' && obj.format === 'int64') { |
| 5448 | str += 'long'; |
| 5449 | } else if (obj.type === 'integer' && typeof obj.format === 'undefined') { |
| 5450 | str += 'long'; |
| 5451 | } else if (obj.type === 'string' && obj.format === 'date-time') { |
| 5452 | str += 'date-time'; |
| 5453 | } else if (obj.type === 'string' && obj.format === 'date') { |
| 5454 | str += 'date'; |
| 5455 | } else if (obj.type === 'string' && typeof obj.format === 'undefined') { |
| 5456 | str += 'string'; |
| 5457 | } else if (obj.type === 'number' && obj.format === 'float') { |
| 5458 | str += 'float'; |
| 5459 | } else if (obj.type === 'number' && obj.format === 'double') { |
| 5460 | str += 'double'; |
| 5461 | } else if (obj.type === 'number' && typeof obj.format === 'undefined') { |
| 5462 | str += 'double'; |
| 5463 | } else if (obj.type === 'boolean') { |
| 5464 | str += 'boolean'; |
| 5465 | } else if (obj.$ref) { |
| 5466 | str += Helpers.simpleRef(obj.$ref); |
| 5467 | } else { |
| 5468 | str += obj.type; |
| 5469 | } |
| 5470 | |
| 5471 | return str; |
| 5472 | } |
| 5473 | |
| 5474 | function schemaToJSON(schema, models, modelsToIgnore, modelPropertyMacro) { |
| 5475 | // Resolve the schema (Handle nested schemas) |
| 5476 | schema = Helpers.resolveSchema(schema); |
| 5477 | |
| 5478 | if(typeof modelPropertyMacro !== 'function') { |
| 5479 | modelPropertyMacro = function(prop){ |
| 5480 | return (prop || {}).default; |
| 5481 | }; |
| 5482 | } |
| 5483 | |
| 5484 | modelsToIgnore= modelsToIgnore || {}; |
| 5485 | |
| 5486 | var type = schema.type || 'object'; |
| 5487 | var format = schema.format; |
| 5488 | var model; |
| 5489 | var output; |
| 5490 | |
| 5491 | if (!_.isUndefined(schema.example)) { |
| 5492 | output = schema.example; |
| 5493 | } else if (_.isUndefined(schema.items) && _.isArray(schema.enum)) { |
| 5494 | output = schema.enum[0]; |
| 5495 | } |
| 5496 | |
| 5497 | if (_.isUndefined(output)) { |
| 5498 | if (schema.$ref) { |
| 5499 | model = models[Helpers.simpleRef(schema.$ref)]; |
| 5500 | |
| 5501 | if (!_.isUndefined(model)) { |
| 5502 | if (_.isUndefined(modelsToIgnore[model.name])) { |
| 5503 | modelsToIgnore[model.name] = model; |
| 5504 | output = schemaToJSON(model.definition, models, modelsToIgnore, modelPropertyMacro); |
| 5505 | delete modelsToIgnore[model.name]; |
| 5506 | } else { |
| 5507 | if (model.type === 'array') { |
| 5508 | output = []; |
| 5509 | } else { |
| 5510 | output = {}; |
| 5511 | } |
| 5512 | } |
| 5513 | } |
| 5514 | } else if (!_.isUndefined(schema.default)) { |
| 5515 | output = schema.default; |
| 5516 | } else if (type === 'string') { |
| 5517 | if (format === 'date-time') { |
| 5518 | output = new Date().toISOString(); |
| 5519 | } else if (format === 'date') { |
| 5520 | output = new Date().toISOString().split('T')[0]; |
| 5521 | } else { |
| 5522 | output = 'string'; |
| 5523 | } |
| 5524 | } else if (type === 'integer') { |
| 5525 | output = 0; |
| 5526 | } else if (type === 'number') { |
| 5527 | output = 0.0; |
| 5528 | } else if (type === 'boolean') { |
| 5529 | output = true; |
| 5530 | } else if (type === 'object') { |
| 5531 | output = {}; |
| 5532 | |
| 5533 | _.forEach(schema.properties, function (property, name) { |
| 5534 | var cProperty = _.cloneDeep(property); |
| 5535 | |
| 5536 | // Allow macro to set the default value |
| 5537 | cProperty.default = modelPropertyMacro(property); |
| 5538 | |
| 5539 | output[name] = schemaToJSON(cProperty, models, modelsToIgnore, modelPropertyMacro); |
| 5540 | }); |
| 5541 | } else if (type === 'array') { |
| 5542 | output = []; |
| 5543 | |
| 5544 | if (_.isArray(schema.items)) { |
| 5545 | _.forEach(schema.items, function (item) { |
| 5546 | output.push(schemaToJSON(item, models, modelsToIgnore, modelPropertyMacro)); |
| 5547 | }); |
| 5548 | } else if (_.isPlainObject(schema.items)) { |
| 5549 | output.push(schemaToJSON(schema.items, models, modelsToIgnore, modelPropertyMacro)); |
| 5550 | } else if (_.isUndefined(schema.items)) { |
| 5551 | output.push({}); |
| 5552 | } else { |
| 5553 | Helpers.log('Array type\'s \'items\' property is not an array or an object, cannot process'); |
| 5554 | } |
| 5555 | } |
| 5556 | } |
| 5557 | |
| 5558 | return output; |
| 5559 | } |
| 5560 | |
| 5561 | function schemaToHTML(name, schema, models, modelPropertyMacro) { |
| 5562 | |
| 5563 | var strongOpen = '<span class="strong">'; |
| 5564 | var strongClose = '</span>'; |
| 5565 | |
| 5566 | // Allow for ignoring the 'name' argument.... shifting the rest |
| 5567 | if(_.isObject(arguments[0])) { |
| 5568 | name = void 0; |
| 5569 | schema = arguments[0]; |
| 5570 | models = arguments[1]; |
| 5571 | modelPropertyMacro = arguments[2]; |
| 5572 | } |
| 5573 | |
| 5574 | models = models || {}; |
| 5575 | |
| 5576 | // Resolve the schema (Handle nested schemas) |
| 5577 | schema = Helpers.resolveSchema(schema); |
| 5578 | |
| 5579 | // Return for empty object |
| 5580 | if(_.isEmpty(schema)) { |
| 5581 | return strongOpen + 'Empty' + strongClose; |
| 5582 | } |
| 5583 | |
| 5584 | // Dereference $ref from 'models' |
| 5585 | if(typeof schema.$ref === 'string') { |
| 5586 | name = Helpers.simpleRef(schema.$ref); |
| 5587 | schema = models[name]; |
| 5588 | if(typeof schema === 'undefined') |
| 5589 | { |
| 5590 | return strongOpen + name + ' is not defined!' + strongClose; |
| 5591 | } |
| 5592 | } |
| 5593 | |
| 5594 | if(typeof name !== 'string') { |
| 5595 | name = schema.title || 'Inline Model'; |
| 5596 | } |
| 5597 | |
| 5598 | // If we are a Model object... adjust accordingly |
| 5599 | if(schema.definition) { |
| 5600 | schema = schema.definition; |
| 5601 | } |
| 5602 | |
| 5603 | if(typeof modelPropertyMacro !== 'function') { |
| 5604 | modelPropertyMacro = function(prop){ |
| 5605 | return (prop || {}).default; |
| 5606 | }; |
| 5607 | } |
| 5608 | |
| 5609 | var references = {}; |
| 5610 | var seenModels = []; |
| 5611 | var inlineModels = 0; |
| 5612 | |
| 5613 | |
| 5614 | |
| 5615 | // Generate current HTML |
| 5616 | var html = processModel(schema, name); |
| 5617 | |
| 5618 | // Generate references HTML |
| 5619 | while (_.keys(references).length > 0) { |
| 5620 | /* jshint ignore:start */ |
| 5621 | _.forEach(references, function (schema, name) { |
| 5622 | var seenModel = _.indexOf(seenModels, name) > -1; |
| 5623 | |
| 5624 | delete references[name]; |
| 5625 | |
| 5626 | if (!seenModel) { |
| 5627 | seenModels.push(name); |
| 5628 | |
| 5629 | html += '<br />' + processModel(schema, name); |
| 5630 | } |
| 5631 | }); |
| 5632 | /* jshint ignore:end */ |
| 5633 | } |
| 5634 | |
| 5635 | return html; |
| 5636 | |
| 5637 | ///////////////////////////////// |
| 5638 | |
| 5639 | function addReference(schema, name, skipRef) { |
| 5640 | var modelName = name; |
| 5641 | var model; |
| 5642 | |
| 5643 | if (schema.$ref) { |
| 5644 | modelName = schema.title || Helpers.simpleRef(schema.$ref); |
| 5645 | model = models[modelName]; |
| 5646 | } else if (_.isUndefined(name)) { |
| 5647 | modelName = schema.title || 'Inline Model ' + (++inlineModels); |
| 5648 | model = {definition: schema}; |
| 5649 | } |
| 5650 | |
| 5651 | if (skipRef !== true) { |
| 5652 | references[modelName] = _.isUndefined(model) ? {} : model.definition; |
| 5653 | } |
| 5654 | |
| 5655 | return modelName; |
| 5656 | } |
| 5657 | |
| 5658 | function primitiveToHTML(schema) { |
| 5659 | var html = '<span class="propType">'; |
| 5660 | var type = schema.type || 'object'; |
| 5661 | |
| 5662 | if (schema.$ref) { |
| 5663 | html += addReference(schema, Helpers.simpleRef(schema.$ref)); |
| 5664 | } else if (type === 'object') { |
| 5665 | if (!_.isUndefined(schema.properties)) { |
| 5666 | html += addReference(schema); |
| 5667 | } else { |
| 5668 | html += 'object'; |
| 5669 | } |
| 5670 | } else if (type === 'array') { |
| 5671 | html += 'Array['; |
| 5672 | |
| 5673 | if (_.isArray(schema.items)) { |
| 5674 | html += _.map(schema.items, addReference).join(','); |
| 5675 | } else if (_.isPlainObject(schema.items)) { |
| 5676 | if (_.isUndefined(schema.items.$ref)) { |
| 5677 | if (!_.isUndefined(schema.items.type) && _.indexOf(['array', 'object'], schema.items.type) === -1) { |
| 5678 | html += schema.items.type; |
| 5679 | } else { |
| 5680 | html += addReference(schema.items); |
| 5681 | } |
| 5682 | } else { |
| 5683 | html += addReference(schema.items, Helpers.simpleRef(schema.items.$ref)); |
| 5684 | } |
| 5685 | } else { |
| 5686 | Helpers.log('Array type\'s \'items\' schema is not an array or an object, cannot process'); |
| 5687 | html += 'object'; |
| 5688 | } |
| 5689 | |
| 5690 | html += ']'; |
| 5691 | } else { |
| 5692 | html += schema.type; |
| 5693 | } |
| 5694 | |
| 5695 | html += '</span>'; |
| 5696 | |
| 5697 | return html; |
| 5698 | } |
| 5699 | |
| 5700 | function primitiveToOptionsHTML(schema, html) { |
| 5701 | var options = ''; |
| 5702 | var type = schema.type || 'object'; |
| 5703 | var isArray = type === 'array'; |
| 5704 | |
| 5705 | if (isArray) { |
| 5706 | if (_.isPlainObject(schema.items) && !_.isUndefined(schema.items.type)) { |
| 5707 | type = schema.items.type; |
| 5708 | } else { |
| 5709 | type = 'object'; |
| 5710 | } |
| 5711 | } |
| 5712 | |
| 5713 | if (!_.isUndefined(schema.default)) { |
| 5714 | options += optionHtml('Default', schema.default); |
| 5715 | } |
| 5716 | |
| 5717 | switch (type) { |
| 5718 | case 'string': |
| 5719 | if (schema.minLength) { |
| 5720 | options += optionHtml('Min. Length', schema.minLength); |
| 5721 | } |
| 5722 | |
| 5723 | if (schema.maxLength) { |
| 5724 | options += optionHtml('Max. Length', schema.maxLength); |
| 5725 | } |
| 5726 | |
| 5727 | if (schema.pattern) { |
| 5728 | options += optionHtml('Reg. Exp.', schema.pattern); |
| 5729 | } |
| 5730 | break; |
| 5731 | case 'integer': |
| 5732 | case 'number': |
| 5733 | if (schema.minimum) { |
| 5734 | options += optionHtml('Min. Value', schema.minimum); |
| 5735 | } |
| 5736 | |
| 5737 | if (schema.exclusiveMinimum) { |
| 5738 | options += optionHtml('Exclusive Min.', 'true'); |
| 5739 | } |
| 5740 | |
| 5741 | if (schema.maximum) { |
| 5742 | options += optionHtml('Max. Value', schema.maximum); |
| 5743 | } |
| 5744 | |
| 5745 | if (schema.exclusiveMaximum) { |
| 5746 | options += optionHtml('Exclusive Max.', 'true'); |
| 5747 | } |
| 5748 | |
| 5749 | if (schema.multipleOf) { |
| 5750 | options += optionHtml('Multiple Of', schema.multipleOf); |
| 5751 | } |
| 5752 | |
| 5753 | break; |
| 5754 | } |
| 5755 | |
| 5756 | if (isArray) { |
| 5757 | if (schema.minItems) { |
| 5758 | options += optionHtml('Min. Items', schema.minItems); |
| 5759 | } |
| 5760 | |
| 5761 | if (schema.maxItems) { |
| 5762 | options += optionHtml('Max. Items', schema.maxItems); |
| 5763 | } |
| 5764 | |
| 5765 | if (schema.uniqueItems) { |
| 5766 | options += optionHtml('Unique Items', 'true'); |
| 5767 | } |
| 5768 | |
| 5769 | if (schema.collectionFormat) { |
| 5770 | options += optionHtml('Coll. Format', schema.collectionFormat); |
| 5771 | } |
| 5772 | } |
| 5773 | |
| 5774 | if (_.isUndefined(schema.items)) { |
| 5775 | if (_.isArray(schema.enum)) { |
| 5776 | var enumString; |
| 5777 | |
| 5778 | if (type === 'number' || type === 'integer') { |
| 5779 | enumString = schema.enum.join(', '); |
| 5780 | } else { |
| 5781 | enumString = '"' + schema.enum.join('", "') + '"'; |
| 5782 | } |
| 5783 | |
| 5784 | options += optionHtml('Enum', enumString); |
| 5785 | } |
| 5786 | } |
| 5787 | |
| 5788 | if (options.length > 0) { |
| 5789 | html = '<span class="propWrap">' + html + '<table class="optionsWrapper"><tr><th colspan="2">' + type + '</th></tr>' + options + '</table></span>'; |
| 5790 | } |
| 5791 | |
| 5792 | return html; |
| 5793 | } |
| 5794 | |
| 5795 | function processModel(schema, name) { |
| 5796 | var type = schema.type || 'object'; |
| 5797 | var isArray = schema.type === 'array'; |
| 5798 | var html = strongOpen + name + ' ' + (isArray ? '[' : '{') + strongClose; |
| 5799 | |
| 5800 | if (name) { |
| 5801 | seenModels.push(name); |
| 5802 | } |
| 5803 | |
| 5804 | if (isArray) { |
| 5805 | if (_.isArray(schema.items)) { |
| 5806 | html += '<div>' + _.map(schema.items, function (item) { |
| 5807 | var type = item.type || 'object'; |
| 5808 | |
| 5809 | if (_.isUndefined(item.$ref)) { |
| 5810 | if (_.indexOf(['array', 'object'], type) > -1) { |
| 5811 | if (type === 'object' && _.isUndefined(item.properties)) { |
| 5812 | return 'object'; |
| 5813 | } else { |
| 5814 | return addReference(item); |
| 5815 | } |
| 5816 | } else { |
| 5817 | return primitiveToOptionsHTML(item, type); |
| 5818 | } |
| 5819 | } else { |
| 5820 | return addReference(item, Helpers.simpleRef(item.$ref)); |
| 5821 | } |
| 5822 | }).join(',</div><div>'); |
| 5823 | } else if (_.isPlainObject(schema.items)) { |
| 5824 | if (_.isUndefined(schema.items.$ref)) { |
| 5825 | if (_.indexOf(['array', 'object'], schema.items.type || 'object') > -1) { |
| 5826 | if ((_.isUndefined(schema.items.type) || schema.items.type === 'object') && _.isUndefined(schema.items.properties)) { |
| 5827 | html += '<div>object</div>'; |
| 5828 | } else { |
| 5829 | html += '<div>' + addReference(schema.items) + '</div>'; |
| 5830 | } |
| 5831 | } else { |
| 5832 | html += '<div>' + primitiveToOptionsHTML(schema.items, schema.items.type) + '</div>'; |
| 5833 | } |
| 5834 | } else { |
| 5835 | html += '<div>' + addReference(schema.items, Helpers.simpleRef(schema.items.$ref)) + '</div>'; |
| 5836 | } |
| 5837 | } else { |
| 5838 | Helpers.log('Array type\'s \'items\' property is not an array or an object, cannot process'); |
| 5839 | html += '<div>object</div>'; |
| 5840 | } |
| 5841 | } else { |
| 5842 | if (schema.$ref) { |
| 5843 | html += '<div>' + addReference(schema, name) + '</div>'; |
| 5844 | } else if (type === 'object') { |
| 5845 | if (_.isPlainObject(schema.properties)) { |
| 5846 | var contents = _.map(schema.properties, function (property, name) { |
| 5847 | var propertyIsRequired = (_.indexOf(schema.required, name) >= 0); |
| 5848 | var cProperty = _.cloneDeep(property); |
| 5849 | |
| 5850 | var requiredClass = propertyIsRequired ? 'required' : ''; |
| 5851 | var html = '<span class="propName ' + requiredClass + '">' + name + '</span> ('; |
| 5852 | var model; |
| 5853 | var propDescription; |
| 5854 | |
| 5855 | // Allow macro to set the default value |
| 5856 | cProperty.default = modelPropertyMacro(cProperty); |
| 5857 | |
| 5858 | // Resolve the schema (Handle nested schemas) |
| 5859 | cProperty = Helpers.resolveSchema(cProperty); |
| 5860 | |
| 5861 | propDescription = property.description || cProperty.description; |
| 5862 | |
| 5863 | // We need to handle property references to primitives (Issue 339) |
| 5864 | if (!_.isUndefined(cProperty.$ref)) { |
| 5865 | model = models[Helpers.simpleRef(cProperty.$ref)]; |
| 5866 | |
| 5867 | if (!_.isUndefined(model) && _.indexOf([undefined, 'array', 'object'], model.definition.type) === -1) { |
| 5868 | // Use referenced schema |
| 5869 | cProperty = Helpers.resolveSchema(model.definition); |
| 5870 | } |
| 5871 | } |
| 5872 | |
| 5873 | html += primitiveToHTML(cProperty); |
| 5874 | |
| 5875 | if(!propertyIsRequired) { |
| 5876 | html += ', <span class="propOptKey">optional</span>'; |
| 5877 | } |
| 5878 | |
| 5879 | if(property.readOnly) { |
| 5880 | html += ', <span class="propReadOnly">read only</span>'; |
| 5881 | } |
| 5882 | |
| 5883 | html += ')'; |
| 5884 | |
| 5885 | if (!_.isUndefined(propDescription)) { |
| 5886 | html += ': ' + '<span class="propDesc">' + propDescription + '</span>'; |
| 5887 | } |
| 5888 | |
| 5889 | if (cProperty.enum) { |
| 5890 | html += ' = <span class="propVals">[\'' + cProperty.enum.join('\', \'') + '\']</span>'; |
| 5891 | } |
| 5892 | |
| 5893 | return '<div' + (property.readOnly ? ' class="readOnly"' : '') + '>' + primitiveToOptionsHTML(cProperty, html); |
| 5894 | }).join(',</div>'); |
| 5895 | |
| 5896 | if (contents) { |
| 5897 | html += contents + '</div>'; |
| 5898 | } |
| 5899 | } |
| 5900 | } else { |
| 5901 | html += '<div>' + primitiveToOptionsHTML(schema, type) + '</div>'; |
| 5902 | } |
| 5903 | } |
| 5904 | |
| 5905 | return html + strongOpen + (isArray ? ']' : '}') + strongClose; |
| 5906 | } |
| 5907 | } |
| 5908 | |
| 5909 | },{"./helpers":4,"lodash-compat/array/indexOf":49,"lodash-compat/collection/forEach":54,"lodash-compat/collection/map":56,"lodash-compat/lang/cloneDeep":138,"lodash-compat/lang/isArray":140,"lodash-compat/lang/isEmpty":141,"lodash-compat/lang/isObject":144,"lodash-compat/lang/isPlainObject":145,"lodash-compat/lang/isUndefined":148,"lodash-compat/object/keys":149}],8:[function(require,module,exports){ |
| 5910 | 'use strict'; |
| 5911 | |
| 5912 | var SwaggerHttp = require('./http'); |
| 5913 | var _ = { |
| 5914 | isObject: require('lodash-compat/lang/isObject') |
| 5915 | }; |
| 5916 | |
| 5917 | var SwaggerSpecConverter = module.exports = function () { |
| 5918 | this.errors = []; |
| 5919 | this.warnings = []; |
| 5920 | this.modelMap = {}; |
| 5921 | }; |
| 5922 | |
| 5923 | SwaggerSpecConverter.prototype.setDocumentationLocation = function (location) { |
| 5924 | this.docLocation = location; |
| 5925 | }; |
| 5926 | |
| 5927 | /** |
| 5928 | * converts a resource listing OR api declaration |
| 5929 | **/ |
| 5930 | SwaggerSpecConverter.prototype.convert = function (obj, clientAuthorizations, opts, callback) { |
| 5931 | // not a valid spec |
| 5932 | if(!obj || !Array.isArray(obj.apis)) { |
| 5933 | return this.finish(callback, null); |
| 5934 | } |
| 5935 | this.clientAuthorizations = clientAuthorizations; |
| 5936 | |
| 5937 | // create a new swagger object to return |
| 5938 | var swagger = { swagger: '2.0' }; |
| 5939 | |
| 5940 | swagger.originalVersion = obj.swaggerVersion; |
| 5941 | |
| 5942 | // add the info |
| 5943 | this.apiInfo(obj, swagger); |
| 5944 | |
| 5945 | // add security definitions |
| 5946 | this.securityDefinitions(obj, swagger); |
| 5947 | |
| 5948 | // take basePath into account |
| 5949 | if (obj.basePath) { |
| 5950 | this.setDocumentationLocation(obj.basePath); |
| 5951 | } |
| 5952 | |
| 5953 | // see if this is a single-file swagger definition |
| 5954 | var isSingleFileSwagger = false; |
| 5955 | var i; |
| 5956 | for(i = 0; i < obj.apis.length; i++) { |
| 5957 | var api = obj.apis[i]; |
| 5958 | if(Array.isArray(api.operations)) { |
| 5959 | isSingleFileSwagger = true; |
| 5960 | } |
| 5961 | } |
| 5962 | if(isSingleFileSwagger) { |
| 5963 | this.declaration(obj, swagger); |
| 5964 | this.finish(callback, swagger); |
| 5965 | } |
| 5966 | else { |
| 5967 | this.resourceListing(obj, swagger, opts, callback); |
| 5968 | } |
| 5969 | }; |
| 5970 | |
| 5971 | SwaggerSpecConverter.prototype.declaration = function(obj, swagger) { |
| 5972 | var name, i, p, pos; |
| 5973 | if(!obj.apis) { |
| 5974 | return; |
| 5975 | } |
| 5976 | |
| 5977 | if (obj.basePath.indexOf('http://') === 0) { |
| 5978 | p = obj.basePath.substring('http://'.length); |
| 5979 | pos = p.indexOf('/'); |
| 5980 | if (pos > 0) { |
| 5981 | swagger.host = p.substring(0, pos); |
| 5982 | swagger.basePath = p.substring(pos); |
| 5983 | } |
| 5984 | else { |
| 5985 | swagger.host = p; |
| 5986 | swagger.basePath = '/'; |
| 5987 | } |
| 5988 | } else if (obj.basePath.indexOf('https://') === 0) { |
| 5989 | p = obj.basePath.substring('https://'.length); |
| 5990 | pos = p.indexOf('/'); |
| 5991 | if (pos > 0) { |
| 5992 | swagger.host = p.substring(0, pos); |
| 5993 | swagger.basePath = p.substring(pos); |
| 5994 | } |
| 5995 | else { |
| 5996 | swagger.host = p; |
| 5997 | swagger.basePath = '/'; |
| 5998 | } |
| 5999 | } else { |
| 6000 | swagger.basePath = obj.basePath; |
| 6001 | } |
| 6002 | |
| 6003 | var resourceLevelAuth; |
| 6004 | if(obj.authorizations) { |
| 6005 | resourceLevelAuth = obj.authorizations; |
| 6006 | } |
| 6007 | if(obj.consumes) { |
| 6008 | swagger.consumes = obj.consumes; |
| 6009 | } |
| 6010 | if(obj.produces) { |
| 6011 | swagger.produces = obj.produces; |
| 6012 | } |
| 6013 | |
| 6014 | // build a mapping of id to name for 1.0 model resolutions |
| 6015 | if(_.isObject(obj)) { |
| 6016 | for(name in obj.models) { |
| 6017 | var existingModel = obj.models[name]; |
| 6018 | var key = (existingModel.id || name); |
| 6019 | this.modelMap[key] = name; |
| 6020 | } |
| 6021 | } |
| 6022 | |
| 6023 | for(i = 0; i < obj.apis.length; i++) { |
| 6024 | var api = obj.apis[i]; |
| 6025 | var path = api.path; |
| 6026 | var operations = api.operations; |
| 6027 | this.operations(path, obj.resourcePath, operations, resourceLevelAuth, swagger); |
| 6028 | } |
| 6029 | |
| 6030 | var models = obj.models || {}; |
| 6031 | this.models(models, swagger); |
| 6032 | }; |
| 6033 | |
| 6034 | SwaggerSpecConverter.prototype.models = function(obj, swagger) { |
| 6035 | if(!_.isObject(obj)) { |
| 6036 | return; |
| 6037 | } |
| 6038 | var name; |
| 6039 | |
| 6040 | swagger.definitions = swagger.definitions || {}; |
| 6041 | for(name in obj) { |
| 6042 | var existingModel = obj[name]; |
| 6043 | var _required = []; |
| 6044 | var schema = { properties: {}}; |
| 6045 | var propertyName; |
| 6046 | for(propertyName in existingModel.properties) { |
| 6047 | var existingProperty = existingModel.properties[propertyName]; |
| 6048 | var property = {}; |
| 6049 | this.dataType(existingProperty, property); |
| 6050 | if(existingProperty.description) { |
| 6051 | property.description = existingProperty.description; |
| 6052 | } |
| 6053 | if(existingProperty['enum']) { |
| 6054 | property['enum'] = existingProperty['enum']; |
| 6055 | } |
| 6056 | if(typeof existingProperty.required === 'boolean' && existingProperty.required === true) { |
| 6057 | _required.push(propertyName); |
| 6058 | } |
| 6059 | if(typeof existingProperty.required === 'string' && existingProperty.required === 'true') { |
| 6060 | _required.push(propertyName); |
| 6061 | } |
| 6062 | schema.properties[propertyName] = property; |
| 6063 | } |
| 6064 | if(_required.length > 0) { |
| 6065 | schema.required = _required; |
| 6066 | } else { |
| 6067 | schema.required = existingModel.required; |
| 6068 | } |
| 6069 | swagger.definitions[name] = schema; |
| 6070 | } |
| 6071 | }; |
| 6072 | |
| 6073 | SwaggerSpecConverter.prototype.extractTag = function(resourcePath) { |
| 6074 | var pathString = resourcePath || 'default'; |
| 6075 | if(pathString.indexOf('http:') === 0 || pathString.indexOf('https:') === 0) { |
| 6076 | pathString = pathString.split(['/']); |
| 6077 | pathString = pathString[pathString.length -1].substring(); |
| 6078 | } |
| 6079 | if(pathString.endsWith('.json')) { |
| 6080 | pathString = pathString.substring(0, pathString.length - '.json'.length); |
| 6081 | } |
| 6082 | return pathString.replace('/',''); |
| 6083 | }; |
| 6084 | |
| 6085 | SwaggerSpecConverter.prototype.operations = function(path, resourcePath, obj, resourceLevelAuth, swagger) { |
| 6086 | if(!Array.isArray(obj)) { |
| 6087 | return; |
| 6088 | } |
| 6089 | var i; |
| 6090 | |
| 6091 | if(!swagger.paths) { |
| 6092 | swagger.paths = {}; |
| 6093 | } |
| 6094 | |
| 6095 | var pathObj = swagger.paths[path] || {}; |
| 6096 | var tag = this.extractTag(resourcePath); |
| 6097 | swagger.tags = swagger.tags || []; |
| 6098 | var matched = false; |
| 6099 | for(i = 0; i < swagger.tags.length; i++) { |
| 6100 | var tagObject = swagger.tags[i]; |
| 6101 | if(tagObject.name === tag) { |
| 6102 | matched = true; |
| 6103 | } |
| 6104 | } |
| 6105 | if(!matched) { |
| 6106 | swagger.tags.push({name: tag}); |
| 6107 | } |
| 6108 | |
| 6109 | for(i = 0; i < obj.length; i++) { |
| 6110 | var existingOperation = obj[i]; |
| 6111 | var method = (existingOperation.method || existingOperation.httpMethod).toLowerCase(); |
| 6112 | var operation = {tags: [tag]}; |
| 6113 | var existingAuthorizations = existingOperation.authorizations; |
| 6114 | |
| 6115 | if(existingAuthorizations && Object.keys(existingAuthorizations).length === 0) { |
| 6116 | existingAuthorizations = resourceLevelAuth; |
| 6117 | } |
| 6118 | |
| 6119 | if(typeof existingAuthorizations !== 'undefined') { |
| 6120 | var scopesObject; |
| 6121 | for(var key in existingAuthorizations) { |
| 6122 | operation.security = operation.security || []; |
| 6123 | var scopes = existingAuthorizations[key]; |
| 6124 | if(scopes) { |
| 6125 | var securityScopes = []; |
| 6126 | for(var j in scopes) { |
| 6127 | securityScopes.push(scopes[j].scope); |
| 6128 | } |
| 6129 | scopesObject = {}; |
| 6130 | scopesObject[key] = securityScopes; |
| 6131 | operation.security.push(scopesObject); |
| 6132 | } |
| 6133 | else { |
| 6134 | scopesObject = {}; |
| 6135 | scopesObject[key] = []; |
| 6136 | operation.security.push(scopesObject); |
| 6137 | } |
| 6138 | } |
| 6139 | } |
| 6140 | |
| 6141 | if(existingOperation.consumes) { |
| 6142 | operation.consumes = existingOperation.consumes; |
| 6143 | } |
| 6144 | else if(swagger.consumes) { |
| 6145 | operation.consumes = swagger.consumes; |
| 6146 | } |
| 6147 | if(existingOperation.produces) { |
| 6148 | operation.produces = existingOperation.produces; |
| 6149 | } |
| 6150 | else if(swagger.produces) { |
| 6151 | operation.produces = swagger.produces; |
| 6152 | } |
| 6153 | if(existingOperation.summary) { |
| 6154 | operation.summary = existingOperation.summary; |
| 6155 | } |
| 6156 | if(existingOperation.notes) { |
| 6157 | operation.description = existingOperation.notes; |
| 6158 | } |
| 6159 | if(existingOperation.nickname) { |
| 6160 | operation.operationId = existingOperation.nickname; |
| 6161 | } |
| 6162 | if(existingOperation.deprecated) { |
| 6163 | operation.deprecated = existingOperation.deprecated; |
| 6164 | } |
| 6165 | |
| 6166 | this.authorizations(existingAuthorizations, swagger); |
| 6167 | this.parameters(operation, existingOperation.parameters, swagger); |
| 6168 | this.responseMessages(operation, existingOperation, swagger); |
| 6169 | |
| 6170 | pathObj[method] = operation; |
| 6171 | } |
| 6172 | |
| 6173 | swagger.paths[path] = pathObj; |
| 6174 | }; |
| 6175 | |
| 6176 | SwaggerSpecConverter.prototype.responseMessages = function(operation, existingOperation) { |
| 6177 | if(!_.isObject(existingOperation)) { |
| 6178 | return; |
| 6179 | } |
| 6180 | // build default response from the operation (1.x) |
| 6181 | var defaultResponse = {}; |
| 6182 | this.dataType(existingOperation, defaultResponse); |
| 6183 | // TODO: look into the real problem of rendering responses in swagger-ui |
| 6184 | // ....should reponseType have an implicit schema? |
| 6185 | if(!defaultResponse.schema && defaultResponse.type) { |
| 6186 | defaultResponse = {schema: defaultResponse}; |
| 6187 | } |
| 6188 | |
| 6189 | operation.responses = operation.responses || {}; |
| 6190 | |
| 6191 | // grab from responseMessages (1.2) |
| 6192 | var has200 = false; |
| 6193 | if(Array.isArray(existingOperation.responseMessages)) { |
| 6194 | var i; |
| 6195 | var existingResponses = existingOperation.responseMessages; |
| 6196 | for(i = 0; i < existingResponses.length; i++) { |
| 6197 | var existingResponse = existingResponses[i]; |
| 6198 | var response = { description: existingResponse.message }; |
| 6199 | if(existingResponse.code === 200) { |
| 6200 | has200 = true; |
| 6201 | } |
| 6202 | // Convert responseModel -> schema{$ref: responseModel} |
| 6203 | if(existingResponse.responseModel) { |
| 6204 | response.schema = {'$ref': '#/definitions/' + existingResponse.responseModel}; |
| 6205 | } |
| 6206 | operation.responses['' + existingResponse.code] = response; |
| 6207 | } |
| 6208 | } |
| 6209 | |
| 6210 | if(has200) { |
| 6211 | operation.responses['default'] = defaultResponse; |
| 6212 | } |
| 6213 | else { |
| 6214 | operation.responses['200'] = defaultResponse; |
| 6215 | } |
| 6216 | }; |
| 6217 | |
| 6218 | SwaggerSpecConverter.prototype.authorizations = function(obj) { |
| 6219 | // TODO |
| 6220 | if(!_.isObject(obj)) { |
| 6221 | return; |
| 6222 | } |
| 6223 | }; |
| 6224 | |
| 6225 | SwaggerSpecConverter.prototype.parameters = function(operation, obj) { |
| 6226 | if(!Array.isArray(obj)) { |
| 6227 | return; |
| 6228 | } |
| 6229 | var i; |
| 6230 | for(i = 0; i < obj.length; i++) { |
| 6231 | var existingParameter = obj[i]; |
| 6232 | var parameter = {}; |
| 6233 | parameter.name = existingParameter.name; |
| 6234 | parameter.description = existingParameter.description; |
| 6235 | parameter.required = existingParameter.required; |
| 6236 | parameter.in = existingParameter.paramType; |
| 6237 | |
| 6238 | // per #168 |
| 6239 | if(parameter.in === 'body') { |
| 6240 | parameter.name = 'body'; |
| 6241 | } |
| 6242 | if(parameter.in === 'form') { |
| 6243 | parameter.in = 'formData'; |
| 6244 | } |
| 6245 | |
| 6246 | if(existingParameter.enum) { |
| 6247 | parameter.enum = existingParameter.enum; |
| 6248 | } |
| 6249 | |
| 6250 | if(existingParameter.allowMultiple === true || existingParameter.allowMultiple === 'true') { |
| 6251 | var innerType = {}; |
| 6252 | this.dataType(existingParameter, innerType); |
| 6253 | parameter.type = 'array'; |
| 6254 | parameter.items = innerType; |
| 6255 | |
| 6256 | if(existingParameter.allowableValues) { |
| 6257 | var av = existingParameter.allowableValues; |
| 6258 | if(av.valueType === 'LIST') { |
| 6259 | parameter['enum'] = av.values; |
| 6260 | } |
| 6261 | } |
| 6262 | } |
| 6263 | else { |
| 6264 | this.dataType(existingParameter, parameter); |
| 6265 | } |
| 6266 | if(typeof existingParameter.defaultValue !== 'undefined') { |
| 6267 | parameter.default = existingParameter.defaultValue; |
| 6268 | } |
| 6269 | |
| 6270 | operation.parameters = operation.parameters || []; |
| 6271 | operation.parameters.push(parameter); |
| 6272 | } |
| 6273 | }; |
| 6274 | |
| 6275 | SwaggerSpecConverter.prototype.dataType = function(source, target) { |
| 6276 | if(!_.isObject(source)) { |
| 6277 | return; |
| 6278 | } |
| 6279 | |
| 6280 | if(source.minimum) { |
| 6281 | target.minimum = source.minimum; |
| 6282 | } |
| 6283 | if(source.maximum) { |
| 6284 | target.maximum = source.maximum; |
| 6285 | } |
| 6286 | if (source.format) { |
| 6287 | target.format = source.format; |
| 6288 | } |
| 6289 | |
| 6290 | // default can be 'false' |
| 6291 | if(typeof source.defaultValue !== 'undefined') { |
| 6292 | target.default = source.defaultValue; |
| 6293 | } |
| 6294 | |
| 6295 | var jsonSchemaType = this.toJsonSchema(source); |
| 6296 | if(jsonSchemaType) { |
| 6297 | target = target || {}; |
| 6298 | if(jsonSchemaType.type) { |
| 6299 | target.type = jsonSchemaType.type; |
| 6300 | } |
| 6301 | if(jsonSchemaType.format) { |
| 6302 | target.format = jsonSchemaType.format; |
| 6303 | } |
| 6304 | if(jsonSchemaType.$ref) { |
| 6305 | target.schema = {$ref: jsonSchemaType.$ref}; |
| 6306 | } |
| 6307 | if(jsonSchemaType.items) { |
| 6308 | target.items = jsonSchemaType.items; |
| 6309 | } |
| 6310 | } |
| 6311 | }; |
| 6312 | |
| 6313 | SwaggerSpecConverter.prototype.toJsonSchema = function(source) { |
| 6314 | if(!source) { |
| 6315 | return 'object'; |
| 6316 | } |
| 6317 | var detectedType = (source.type || source.dataType || source.responseClass || ''); |
| 6318 | var lcType = detectedType.toLowerCase(); |
| 6319 | var format = (source.format || '').toLowerCase(); |
| 6320 | |
| 6321 | if(lcType.indexOf('list[') === 0) { |
| 6322 | var innerType = detectedType.substring(5, detectedType.length - 1); |
| 6323 | var jsonType = this.toJsonSchema({type: innerType}); |
| 6324 | return {type: 'array', items: jsonType}; |
| 6325 | } else if(lcType === 'int' || (lcType === 'integer' && format === 'int32')) { |
| 6326 | {return {type: 'integer', format: 'int32'};} |
| 6327 | } else if(lcType === 'long' || (lcType === 'integer' && format === 'int64')) { |
| 6328 | {return {type: 'integer', format: 'int64'};} |
| 6329 | } else if(lcType === 'integer') { |
| 6330 | {return {type: 'integer', format: 'int64'};} |
| 6331 | } else if(lcType === 'float' || (lcType === 'number' && format === 'float')) { |
| 6332 | {return {type: 'number', format: 'float'};} |
| 6333 | } else if(lcType === 'double' || (lcType === 'number' && format === 'double')) { |
| 6334 | {return {type: 'number', format: 'double'};} |
| 6335 | } else if((lcType === 'string' && format === 'date-time') || (lcType === 'date')) { |
| 6336 | {return {type: 'string', format: 'date-time'};} |
| 6337 | } else if(lcType === 'string') { |
| 6338 | {return {type: 'string'};} |
| 6339 | } else if(lcType === 'file') { |
| 6340 | {return {type: 'file'};} |
| 6341 | } else if(lcType === 'boolean') { |
| 6342 | {return {type: 'boolean'};} |
| 6343 | } else if(lcType === 'boolean') { |
| 6344 | {return {type: 'boolean'};} |
| 6345 | } else if(lcType === 'array' || lcType === 'list') { |
| 6346 | if(source.items) { |
| 6347 | var it = this.toJsonSchema(source.items); |
| 6348 | return {type: 'array', items: it}; |
| 6349 | } |
| 6350 | else { |
| 6351 | return {type: 'array', items: {type: 'object'}}; |
| 6352 | } |
| 6353 | } else if(source.$ref) { |
| 6354 | return {$ref: this.modelMap[source.$ref] ? '#/definitions/' + this.modelMap[source.$ref] : source.$ref}; |
| 6355 | } else if(lcType === 'void' || lcType === '') { |
| 6356 | {return {};} |
| 6357 | } else if (this.modelMap[source.type]) { |
| 6358 | // If this a model using `type` instead of `$ref`, that's fine. |
| 6359 | return {$ref: '#/definitions/' + this.modelMap[source.type]}; |
| 6360 | } else { |
| 6361 | // Unknown model type or 'object', pass it along. |
| 6362 | return {type: source.type}; |
| 6363 | } |
| 6364 | }; |
| 6365 | |
| 6366 | SwaggerSpecConverter.prototype.resourceListing = function(obj, swagger, opts, callback) { |
| 6367 | var i; |
| 6368 | var processedCount = 0; // jshint ignore:line |
| 6369 | var self = this; // jshint ignore:line |
| 6370 | var expectedCount = obj.apis.length; |
| 6371 | var _swagger = swagger; // jshint ignore:line |
| 6372 | var _opts = {}; |
| 6373 | |
| 6374 | if(opts && opts.requestInterceptor){ |
| 6375 | _opts.requestInterceptor = opts.requestInterceptor; |
| 6376 | } |
| 6377 | |
| 6378 | if(opts && opts.responseInterceptor){ |
| 6379 | _opts.responseInterceptor = opts.responseInterceptor; |
| 6380 | } |
| 6381 | |
| 6382 | var swaggerRequestHeaders = 'application/json'; |
| 6383 | |
| 6384 | if(opts && opts.swaggerRequestHeaders) { |
| 6385 | swaggerRequestHeaders = opts.swaggerRequestHeaders; |
| 6386 | } |
| 6387 | |
| 6388 | if(expectedCount === 0) { |
| 6389 | this.finish(callback, swagger); |
| 6390 | } |
| 6391 | |
| 6392 | for(i = 0; i < expectedCount; i++) { |
| 6393 | var api = obj.apis[i]; |
| 6394 | var path = api.path; |
| 6395 | var absolutePath = this.getAbsolutePath(obj.swaggerVersion, this.docLocation, path); |
| 6396 | |
| 6397 | if(api.description) { |
| 6398 | swagger.tags = swagger.tags || []; |
| 6399 | swagger.tags.push({ |
| 6400 | name : this.extractTag(api.path), |
| 6401 | description : api.description || '' |
| 6402 | }); |
| 6403 | } |
| 6404 | var http = { |
| 6405 | url: absolutePath, |
| 6406 | headers: { accept: swaggerRequestHeaders }, |
| 6407 | on: {}, |
| 6408 | method: 'get', |
| 6409 | timeout: opts.timeout |
| 6410 | }; |
| 6411 | /* jshint ignore:start */ |
| 6412 | http.on.response = function(data) { |
| 6413 | processedCount += 1; |
| 6414 | var obj = data.obj; |
| 6415 | if(obj) { |
| 6416 | self.declaration(obj, _swagger); |
| 6417 | } |
| 6418 | if(processedCount === expectedCount) { |
| 6419 | self.finish(callback, _swagger); |
| 6420 | } |
| 6421 | }; |
| 6422 | http.on.error = function(data) { |
| 6423 | console.error(data); |
| 6424 | processedCount += 1; |
| 6425 | if(processedCount === expectedCount) { |
| 6426 | self.finish(callback, _swagger); |
| 6427 | } |
| 6428 | }; |
| 6429 | /* jshint ignore:end */ |
| 6430 | |
| 6431 | if(this.clientAuthorizations && typeof this.clientAuthorizations.apply === 'function') { |
| 6432 | this.clientAuthorizations.apply(http); |
| 6433 | } |
| 6434 | |
| 6435 | new SwaggerHttp().execute(http, _opts); |
| 6436 | } |
| 6437 | }; |
| 6438 | |
| 6439 | SwaggerSpecConverter.prototype.getAbsolutePath = function(version, docLocation, path) { |
| 6440 | if(version === '1.0') { |
| 6441 | if(docLocation.endsWith('.json')) { |
| 6442 | // get root path |
| 6443 | var pos = docLocation.lastIndexOf('/'); |
| 6444 | if(pos > 0) { |
| 6445 | docLocation = docLocation.substring(0, pos); |
| 6446 | } |
| 6447 | } |
| 6448 | } |
| 6449 | |
| 6450 | var location = docLocation; |
| 6451 | if(path.indexOf('http:') === 0 || path.indexOf('https:') === 0) { |
| 6452 | location = path; |
| 6453 | } |
| 6454 | else { |
| 6455 | if(docLocation.endsWith('/')) { |
| 6456 | location = docLocation.substring(0, docLocation.length - 1); |
| 6457 | } |
| 6458 | location += path; |
| 6459 | } |
| 6460 | location = location.replace('{format}', 'json'); |
| 6461 | return location; |
| 6462 | }; |
| 6463 | |
| 6464 | SwaggerSpecConverter.prototype.securityDefinitions = function(obj, swagger) { |
| 6465 | if(obj.authorizations) { |
| 6466 | var name; |
| 6467 | for(name in obj.authorizations) { |
| 6468 | var isValid = false; |
| 6469 | var securityDefinition = {}; |
| 6470 | var definition = obj.authorizations[name]; |
| 6471 | if(definition.type === 'apiKey') { |
| 6472 | securityDefinition.type = 'apiKey'; |
| 6473 | securityDefinition.in = definition.passAs; |
| 6474 | securityDefinition.name = definition.keyname || name; |
| 6475 | isValid = true; |
| 6476 | } |
| 6477 | else if(definition.type === 'basicAuth') { |
| 6478 | securityDefinition.type = 'basicAuth'; |
| 6479 | isValid = true; |
| 6480 | } |
| 6481 | else if(definition.type === 'oauth2') { |
| 6482 | var existingScopes = definition.scopes || []; |
| 6483 | var scopes = {}; |
| 6484 | var i; |
| 6485 | for(i in existingScopes) { |
| 6486 | var scope = existingScopes[i]; |
| 6487 | scopes[scope.scope] = scope.description; |
| 6488 | } |
| 6489 | securityDefinition.type = 'oauth2'; |
| 6490 | if(i > 0) { |
| 6491 | securityDefinition.scopes = scopes; |
| 6492 | } |
| 6493 | if(definition.grantTypes) { |
| 6494 | if(definition.grantTypes.implicit) { |
| 6495 | var implicit = definition.grantTypes.implicit; |
| 6496 | securityDefinition.flow = 'implicit'; |
| 6497 | securityDefinition.authorizationUrl = implicit.loginEndpoint; |
| 6498 | isValid = true; |
| 6499 | } |
| 6500 | /* jshint ignore:start */ |
| 6501 | if(definition.grantTypes['authorization_code']) { |
| 6502 | if(!securityDefinition.flow) { |
| 6503 | // cannot set if flow is already defined |
| 6504 | var authCode = definition.grantTypes['authorization_code']; |
| 6505 | securityDefinition.flow = 'accessCode'; |
| 6506 | securityDefinition.authorizationUrl = authCode.tokenRequestEndpoint.url; |
| 6507 | securityDefinition.tokenUrl = authCode.tokenEndpoint.url; |
| 6508 | isValid = true; |
| 6509 | } |
| 6510 | } |
| 6511 | /* jshint ignore:end */ |
| 6512 | } |
| 6513 | } |
| 6514 | if(isValid) { |
| 6515 | swagger.securityDefinitions = swagger.securityDefinitions || {}; |
| 6516 | swagger.securityDefinitions[name] = securityDefinition; |
| 6517 | } |
| 6518 | } |
| 6519 | } |
| 6520 | }; |
| 6521 | |
| 6522 | SwaggerSpecConverter.prototype.apiInfo = function(obj, swagger) { |
| 6523 | // info section |
| 6524 | if(obj.info) { |
| 6525 | var info = obj.info; |
| 6526 | swagger.info = {}; |
| 6527 | |
| 6528 | if(info.contact) { |
| 6529 | swagger.info.contact = {}; |
| 6530 | swagger.info.contact.email = info.contact; |
| 6531 | } |
| 6532 | if(info.description) { |
| 6533 | swagger.info.description = info.description; |
| 6534 | } |
| 6535 | if(info.title) { |
| 6536 | swagger.info.title = info.title; |
| 6537 | } |
| 6538 | if(info.termsOfServiceUrl) { |
| 6539 | swagger.info.termsOfService = info.termsOfServiceUrl; |
| 6540 | } |
| 6541 | if(info.license || info.licenseUrl) { |
| 6542 | swagger.license = {}; |
| 6543 | if(info.license) { |
| 6544 | swagger.license.name = info.license; |
| 6545 | } |
| 6546 | if(info.licenseUrl) { |
| 6547 | swagger.license.url = info.licenseUrl; |
| 6548 | } |
| 6549 | } |
| 6550 | } |
| 6551 | else { |
| 6552 | this.warnings.push('missing info section'); |
| 6553 | } |
| 6554 | }; |
| 6555 | |
| 6556 | SwaggerSpecConverter.prototype.finish = function (callback, obj) { |
| 6557 | callback(obj); |
| 6558 | }; |
| 6559 | |
| 6560 | },{"./http":5,"lodash-compat/lang/isObject":144}],9:[function(require,module,exports){ |
| 6561 | 'use strict'; |
| 6562 | |
| 6563 | var log = require('../helpers').log; |
| 6564 | var _ = { |
| 6565 | isPlainObject: require('lodash-compat/lang/isPlainObject'), |
| 6566 | isString: require('lodash-compat/lang/isString'), |
| 6567 | }; |
| 6568 | |
| 6569 | var SchemaMarkup = require('../schema-markup.js'); |
| 6570 | var jsyaml = require('js-yaml'); |
| 6571 | |
| 6572 | var Model = module.exports = function (name, definition, models, modelPropertyMacro) { |
| 6573 | this.definition = definition || {}; |
| 6574 | this.isArray = definition.type === 'array'; |
| 6575 | this.models = models || {}; |
| 6576 | this.name = name || definition.title || 'Inline Model'; |
| 6577 | this.modelPropertyMacro = modelPropertyMacro || function (property) { |
| 6578 | return property.default; |
| 6579 | }; |
| 6580 | |
| 6581 | return this; |
| 6582 | }; |
| 6583 | |
| 6584 | // Note! This function will be removed in 2.2.x! |
| 6585 | Model.prototype.createJSONSample = Model.prototype.getSampleValue = function (modelsToIgnore) { |
| 6586 | modelsToIgnore = modelsToIgnore || {}; |
| 6587 | |
| 6588 | modelsToIgnore[this.name] = this; |
| 6589 | |
| 6590 | // Response support |
| 6591 | if (this.examples && _.isPlainObject(this.examples) && this.examples['application/json']) { |
| 6592 | this.definition.example = this.examples['application/json']; |
| 6593 | |
| 6594 | if (_.isString(this.definition.example)) { |
| 6595 | this.definition.example = jsyaml.safeLoad(this.definition.example); |
| 6596 | } |
| 6597 | } else if (!this.definition.example) { |
| 6598 | this.definition.example = this.examples; |
| 6599 | } |
| 6600 | |
| 6601 | return SchemaMarkup.schemaToJSON(this.definition, this.models, modelsToIgnore, this.modelPropertyMacro); |
| 6602 | }; |
| 6603 | |
| 6604 | Model.prototype.getMockSignature = function () { |
| 6605 | return SchemaMarkup.schemaToHTML(this.name, this.definition, this.models, this.modelPropertyMacro); |
| 6606 | }; |
| 6607 | |
| 6608 | },{"../helpers":4,"../schema-markup.js":7,"js-yaml":19,"lodash-compat/lang/isPlainObject":145,"lodash-compat/lang/isString":146}],10:[function(require,module,exports){ |
| 6609 | 'use strict'; |
| 6610 | |
| 6611 | var _ = { |
| 6612 | cloneDeep: require('lodash-compat/lang/cloneDeep'), |
| 6613 | isUndefined: require('lodash-compat/lang/isUndefined'), |
| 6614 | isEmpty: require('lodash-compat/lang/isEmpty'), |
| 6615 | isObject: require('lodash-compat/lang/isObject') |
| 6616 | }; |
| 6617 | var helpers = require('../helpers'); |
| 6618 | var Model = require('./model'); |
| 6619 | var SwaggerHttp = require('../http'); |
| 6620 | var Q = require('q'); |
| 6621 | |
| 6622 | var Operation = module.exports = function (parent, scheme, operationId, httpMethod, path, args, definitions, models, clientAuthorizations) { |
| 6623 | var errors = []; |
| 6624 | |
| 6625 | parent = parent || {}; |
| 6626 | args = args || {}; |
| 6627 | |
| 6628 | if(parent && parent.options) { |
| 6629 | this.client = parent.options.client || null; |
| 6630 | this.requestInterceptor = parent.options.requestInterceptor || null; |
| 6631 | this.responseInterceptor = parent.options.responseInterceptor || null; |
| 6632 | } |
| 6633 | this.authorizations = args.security; |
| 6634 | this.basePath = parent.basePath || '/'; |
| 6635 | this.clientAuthorizations = clientAuthorizations; |
| 6636 | this.consumes = args.consumes || parent.consumes || ['application/json']; |
| 6637 | this.produces = args.produces || parent.produces || ['application/json']; |
| 6638 | this.deprecated = args.deprecated; |
| 6639 | this.description = args.description; |
| 6640 | this.host = parent.host; |
| 6641 | this.method = (httpMethod || errors.push('Operation ' + operationId + ' is missing method.')); |
| 6642 | this.models = models || {}; |
| 6643 | this.nickname = (operationId || errors.push('Operations must have a nickname.')); |
| 6644 | this.operation = args; |
| 6645 | this.operations = {}; |
| 6646 | this.parameters = args !== null ? (args.parameters || []) : {}; |
| 6647 | this.parent = parent; |
| 6648 | this.path = (path || errors.push('Operation ' + this.nickname + ' is missing path.')); |
| 6649 | this.responses = (args.responses || {}); |
| 6650 | this.scheme = scheme || parent.scheme || 'http'; |
| 6651 | this.schemes = args.schemes || parent.schemes; |
| 6652 | this.security = args.security || parent.security; |
| 6653 | this.summary = args.summary || ''; |
| 6654 | this.timeout = parent.timeout; |
| 6655 | this.type = null; |
| 6656 | this.useJQuery = parent.useJQuery; |
| 6657 | this.jqueryAjaxCache = parent.jqueryAjaxCache; |
| 6658 | this.enableCookies = parent.enableCookies; |
| 6659 | |
| 6660 | if(!this.host) { |
| 6661 | if(typeof window !== 'undefined') { |
| 6662 | this.host = window.location.host; |
| 6663 | } |
| 6664 | else { |
| 6665 | this.host = 'localhost'; |
| 6666 | } |
| 6667 | } |
| 6668 | this.parameterMacro = parent.parameterMacro || function (operation, parameter) { |
| 6669 | return parameter.default; |
| 6670 | }; |
| 6671 | |
| 6672 | this.inlineModels = []; |
| 6673 | |
| 6674 | if(this.basePath !== '/' && this.basePath.slice(-1) === '/') { |
| 6675 | this.basePath = this.basePath.slice(0, -1); |
| 6676 | } |
| 6677 | |
| 6678 | if (typeof this.deprecated === 'string') { |
| 6679 | switch(this.deprecated.toLowerCase()) { |
| 6680 | case 'true': case 'yes': case '1': { |
| 6681 | this.deprecated = true; |
| 6682 | break; |
| 6683 | } |
| 6684 | |
| 6685 | case 'false': case 'no': case '0': case null: { |
| 6686 | this.deprecated = false; |
| 6687 | break; |
| 6688 | } |
| 6689 | |
| 6690 | default: this.deprecated = Boolean(this.deprecated); |
| 6691 | } |
| 6692 | } |
| 6693 | |
| 6694 | var i, model; |
| 6695 | |
| 6696 | if (definitions) { |
| 6697 | // add to global models |
| 6698 | var key; |
| 6699 | |
| 6700 | for (key in definitions) { |
| 6701 | model = new Model(key, definitions[key], this.models, parent.modelPropertyMacro); |
| 6702 | |
| 6703 | if (model) { |
| 6704 | this.models[key] = model; |
| 6705 | } |
| 6706 | } |
| 6707 | } |
| 6708 | else { |
| 6709 | definitions = {}; |
| 6710 | } |
| 6711 | |
| 6712 | for (i = 0; i < this.parameters.length; i++) { |
| 6713 | var param = this.parameters[i]; |
| 6714 | |
| 6715 | // Allow macro to set the default value |
| 6716 | param.default = this.parameterMacro(this, param); |
| 6717 | |
| 6718 | if (param.type === 'array') { |
| 6719 | param.isList = true; |
| 6720 | param.allowMultiple = true; |
| 6721 | // the enum can be defined at the items level |
| 6722 | //if (param.items && param.items.enum) { |
| 6723 | // param['enum'] = param.items.enum; |
| 6724 | //} |
| 6725 | } |
| 6726 | |
| 6727 | var innerType = this.getType(param); |
| 6728 | |
| 6729 | if (innerType && innerType.toString().toLowerCase() === 'boolean') { |
| 6730 | param.allowableValues = {}; |
| 6731 | param.isList = true; |
| 6732 | param['enum'] = [true, false]; // use actual primitives |
| 6733 | } |
| 6734 | |
| 6735 | if(typeof param['x-example'] !== 'undefined') { |
| 6736 | var d = param['x-example']; |
| 6737 | param.default = d; |
| 6738 | } |
| 6739 | if(param['x-examples']) { |
| 6740 | var d = param['x-examples'].default; |
| 6741 | if(typeof d !== 'undefined') { |
| 6742 | param.default = d; |
| 6743 | } |
| 6744 | } |
| 6745 | |
| 6746 | var enumValues = param['enum'] || (param.items && param.items['enum']); |
| 6747 | |
| 6748 | if (typeof enumValues !== 'undefined') { |
| 6749 | var id; |
| 6750 | |
| 6751 | param.allowableValues = {}; |
| 6752 | param.allowableValues.values = []; |
| 6753 | param.allowableValues.descriptiveValues = []; |
| 6754 | |
| 6755 | for (id = 0; id < enumValues.length; id++) { |
| 6756 | var value = enumValues[id]; |
| 6757 | var isDefault = (value === param.default || value+'' === param.default); |
| 6758 | |
| 6759 | param.allowableValues.values.push(value); |
| 6760 | // Always have string for descriptive values.... |
| 6761 | param.allowableValues.descriptiveValues.push({value : value+'', isDefault: isDefault}); |
| 6762 | } |
| 6763 | } |
| 6764 | |
| 6765 | if (param.type === 'array') { |
| 6766 | innerType = [innerType]; |
| 6767 | |
| 6768 | if (typeof param.allowableValues === 'undefined') { |
| 6769 | // can't show as a list if no values to select from |
| 6770 | delete param.isList; |
| 6771 | delete param.allowMultiple; |
| 6772 | } |
| 6773 | } |
| 6774 | |
| 6775 | param.modelSignature = {type: innerType, definitions: this.models}; |
| 6776 | param.signature = this.getModelSignature(innerType, this.models).toString(); |
| 6777 | param.sampleJSON = this.getModelSampleJSON(innerType, this.models); |
| 6778 | param.responseClassSignature = param.signature; |
| 6779 | } |
| 6780 | |
| 6781 | var defaultResponseCode, response, responses = this.responses; |
| 6782 | |
| 6783 | if (responses['200']) { |
| 6784 | response = responses['200']; |
| 6785 | defaultResponseCode = '200'; |
| 6786 | } else if (responses['201']) { |
| 6787 | response = responses['201']; |
| 6788 | defaultResponseCode = '201'; |
| 6789 | } else if (responses['202']) { |
| 6790 | response = responses['202']; |
| 6791 | defaultResponseCode = '202'; |
| 6792 | } else if (responses['203']) { |
| 6793 | response = responses['203']; |
| 6794 | defaultResponseCode = '203'; |
| 6795 | } else if (responses['204']) { |
| 6796 | response = responses['204']; |
| 6797 | defaultResponseCode = '204'; |
| 6798 | } else if (responses['205']) { |
| 6799 | response = responses['205']; |
| 6800 | defaultResponseCode = '205'; |
| 6801 | } else if (responses['206']) { |
| 6802 | response = responses['206']; |
| 6803 | defaultResponseCode = '206'; |
| 6804 | } else if (responses['default']) { |
| 6805 | response = responses['default']; |
| 6806 | defaultResponseCode = 'default'; |
| 6807 | } |
| 6808 | |
| 6809 | if (response && response.schema) { |
| 6810 | var resolvedModel = this.resolveModel(response.schema, definitions); |
| 6811 | var successResponse; |
| 6812 | |
| 6813 | delete responses[defaultResponseCode]; |
| 6814 | |
| 6815 | if (resolvedModel) { |
| 6816 | this.successResponse = {}; |
| 6817 | successResponse = this.successResponse[defaultResponseCode] = resolvedModel; |
| 6818 | } else if (!response.schema.type || response.schema.type === 'object' || response.schema.type === 'array') { |
| 6819 | // Inline model |
| 6820 | this.successResponse = {}; |
| 6821 | successResponse = this.successResponse[defaultResponseCode] = new Model(undefined, response.schema || {}, this.models, parent.modelPropertyMacro); |
| 6822 | } else { |
| 6823 | // Primitive |
| 6824 | this.successResponse = {}; |
| 6825 | successResponse = this.successResponse[defaultResponseCode] = response.schema; |
| 6826 | } |
| 6827 | |
| 6828 | if (successResponse) { |
| 6829 | // Attach response properties |
| 6830 | if (response.description) { |
| 6831 | successResponse.description = response.description; |
| 6832 | } |
| 6833 | |
| 6834 | if (response.examples) { |
| 6835 | successResponse.examples = response.examples; |
| 6836 | } |
| 6837 | |
| 6838 | if (response.headers) { |
| 6839 | successResponse.headers = response.headers; |
| 6840 | } |
| 6841 | } |
| 6842 | |
| 6843 | this.type = response; |
| 6844 | } |
| 6845 | |
| 6846 | if (errors.length > 0) { |
| 6847 | if (this.resource && this.resource.api && this.resource.api.fail) { |
| 6848 | this.resource.api.fail(errors); |
| 6849 | } |
| 6850 | } |
| 6851 | |
| 6852 | return this; |
| 6853 | }; |
| 6854 | |
| 6855 | Operation.prototype.isDefaultArrayItemValue = function(value, param) { |
| 6856 | if (param.default && Array.isArray(param.default)) { |
| 6857 | return param.default.indexOf(value) !== -1; |
| 6858 | } |
| 6859 | return value === param.default; |
| 6860 | }; |
| 6861 | |
| 6862 | Operation.prototype.getType = function (param) { |
| 6863 | var type = param.type; |
| 6864 | var format = param.format; |
| 6865 | var isArray = false; |
| 6866 | var str; |
| 6867 | |
| 6868 | if (type === 'integer' && format === 'int32') { |
| 6869 | str = 'integer'; |
| 6870 | } else if (type === 'integer' && format === 'int64') { |
| 6871 | str = 'long'; |
| 6872 | } else if (type === 'integer') { |
| 6873 | str = 'integer'; |
| 6874 | } else if (type === 'string') { |
| 6875 | if (format === 'date-time') { |
| 6876 | str = 'date-time'; |
| 6877 | } else if (format === 'date') { |
| 6878 | str = 'date'; |
| 6879 | } else { |
| 6880 | str = 'string'; |
| 6881 | } |
| 6882 | } else if (type === 'number' && format === 'float') { |
| 6883 | str = 'float'; |
| 6884 | } else if (type === 'number' && format === 'double') { |
| 6885 | str = 'double'; |
| 6886 | } else if (type === 'number') { |
| 6887 | str = 'double'; |
| 6888 | } else if (type === 'boolean') { |
| 6889 | str = 'boolean'; |
| 6890 | } else if (type === 'array') { |
| 6891 | isArray = true; |
| 6892 | |
| 6893 | if (param.items) { |
| 6894 | str = this.getType(param.items); |
| 6895 | } |
| 6896 | } else if (type === 'file') { |
| 6897 | str = 'file'; |
| 6898 | } |
| 6899 | |
| 6900 | if (param.$ref) { |
| 6901 | str = helpers.simpleRef(param.$ref); |
| 6902 | } |
| 6903 | |
| 6904 | var schema = param.schema; |
| 6905 | |
| 6906 | if (schema) { |
| 6907 | var ref = schema.$ref; |
| 6908 | |
| 6909 | if (ref) { |
| 6910 | ref = helpers.simpleRef(ref); |
| 6911 | |
| 6912 | if (isArray) { |
| 6913 | return [ ref ]; |
| 6914 | } else { |
| 6915 | return ref; |
| 6916 | } |
| 6917 | } else { |
| 6918 | // If inline schema, we add it our interal hash -> which gives us it's ID (int) |
| 6919 | if(schema.type === 'object') { |
| 6920 | return this.addInlineModel(schema); |
| 6921 | } |
| 6922 | return this.getType(schema); |
| 6923 | } |
| 6924 | } |
| 6925 | if (isArray) { |
| 6926 | return [ str ]; |
| 6927 | } else { |
| 6928 | return str; |
| 6929 | } |
| 6930 | }; |
| 6931 | |
| 6932 | /** |
| 6933 | * adds an inline schema (model) to a hash, where we can ref it later |
| 6934 | * @param {object} schema a schema |
| 6935 | * @return {number} the ID of the schema being added, or null |
| 6936 | **/ |
| 6937 | Operation.prototype.addInlineModel = function (schema) { |
| 6938 | var len = this.inlineModels.length; |
| 6939 | var model = this.resolveModel(schema, {}); |
| 6940 | if(model) { |
| 6941 | this.inlineModels.push(model); |
| 6942 | return 'Inline Model '+len; // return string ref of the inline model (used with #getInlineModel) |
| 6943 | } |
| 6944 | return null; // report errors? |
| 6945 | }; |
| 6946 | |
| 6947 | /** |
| 6948 | * gets the internal ref to an inline model |
| 6949 | * @param {string} inline_str a string reference to an inline model |
| 6950 | * @return {Model} the model being referenced. Or null |
| 6951 | **/ |
| 6952 | Operation.prototype.getInlineModel = function(inlineStr) { |
| 6953 | if(/^Inline Model \d+$/.test(inlineStr)) { |
| 6954 | var id = parseInt(inlineStr.substr('Inline Model'.length).trim(),10); // |
| 6955 | var model = this.inlineModels[id]; |
| 6956 | return model; |
| 6957 | } |
| 6958 | // I'm returning null here, should I rather throw an error? |
| 6959 | return null; |
| 6960 | }; |
| 6961 | |
| 6962 | Operation.prototype.resolveModel = function (schema, definitions) { |
| 6963 | if (typeof schema.$ref !== 'undefined') { |
| 6964 | var ref = schema.$ref; |
| 6965 | |
| 6966 | if (ref.indexOf('#/definitions/') === 0) { |
| 6967 | ref = ref.substring('#/definitions/'.length); |
| 6968 | } |
| 6969 | |
| 6970 | if (definitions[ref]) { |
| 6971 | return new Model(ref, definitions[ref], this.models, this.parent.modelPropertyMacro); |
| 6972 | } |
| 6973 | // schema must at least be an object to get resolved to an inline Model |
| 6974 | } else if (schema && typeof schema === 'object' && |
| 6975 | (schema.type === 'object' || _.isUndefined(schema.type))) { |
| 6976 | return new Model(undefined, schema, this.models, this.parent.modelPropertyMacro); |
| 6977 | } |
| 6978 | |
| 6979 | return null; |
| 6980 | }; |
| 6981 | |
| 6982 | Operation.prototype.help = function (dontPrint) { |
| 6983 | var out = this.nickname + ': ' + this.summary + '\n'; |
| 6984 | |
| 6985 | for (var i = 0; i < this.parameters.length; i++) { |
| 6986 | var param = this.parameters[i]; |
| 6987 | var typeInfo = param.signature; |
| 6988 | |
| 6989 | out += '\n * ' + param.name + ' (' + typeInfo + '): ' + param.description; |
| 6990 | } |
| 6991 | |
| 6992 | if (typeof dontPrint === 'undefined') { |
| 6993 | helpers.log(out); |
| 6994 | } |
| 6995 | |
| 6996 | return out; |
| 6997 | }; |
| 6998 | |
| 6999 | Operation.prototype.getModelSignature = function (type, definitions) { |
| 7000 | var isPrimitive, listType; |
| 7001 | |
| 7002 | if (type instanceof Array) { |
| 7003 | listType = true; |
| 7004 | type = type[0]; |
| 7005 | } |
| 7006 | |
| 7007 | // Convert undefined to string of 'undefined' |
| 7008 | if (typeof type === 'undefined') { |
| 7009 | type = 'undefined'; |
| 7010 | isPrimitive = true; |
| 7011 | |
| 7012 | } else if (definitions[type]){ |
| 7013 | // a model def exists? |
| 7014 | type = definitions[type]; /* Model */ |
| 7015 | isPrimitive = false; |
| 7016 | |
| 7017 | } else if (this.getInlineModel(type)) { |
| 7018 | type = this.getInlineModel(type); /* Model */ |
| 7019 | isPrimitive = false; |
| 7020 | |
| 7021 | } else { |
| 7022 | // We default to primitive |
| 7023 | isPrimitive = true; |
| 7024 | } |
| 7025 | |
| 7026 | if (isPrimitive) { |
| 7027 | if (listType) { |
| 7028 | return 'Array[' + type + ']'; |
| 7029 | } else { |
| 7030 | return type.toString(); |
| 7031 | } |
| 7032 | } else { |
| 7033 | if (listType) { |
| 7034 | return 'Array[' + type.getMockSignature() + ']'; |
| 7035 | } else { |
| 7036 | return type.getMockSignature(); |
| 7037 | } |
| 7038 | } |
| 7039 | }; |
| 7040 | |
| 7041 | Operation.prototype.supportHeaderParams = function () { |
| 7042 | return true; |
| 7043 | }; |
| 7044 | |
| 7045 | Operation.prototype.supportedSubmitMethods = function () { |
| 7046 | return this.parent.supportedSubmitMethods; |
| 7047 | }; |
| 7048 | |
| 7049 | Operation.prototype.getHeaderParams = function (args) { |
| 7050 | var headers = this.setContentTypes(args, {}); |
| 7051 | var headerParamsByLowerCase = {}; |
| 7052 | |
| 7053 | for (var i = 0; i < this.parameters.length; i++) { |
| 7054 | var param = this.parameters[i]; |
| 7055 | |
| 7056 | if (param.in === 'header') { |
| 7057 | headerParamsByLowerCase[param.name.toLowerCase()] = param; |
| 7058 | } |
| 7059 | } |
| 7060 | |
| 7061 | for (var arg in args) { |
| 7062 | var headerParam = headerParamsByLowerCase[arg.toLowerCase()]; |
| 7063 | if (typeof headerParam !== 'undefined') { |
| 7064 | var value = args[arg]; |
| 7065 | |
| 7066 | if (Array.isArray(value)) { |
| 7067 | value = value.toString(); |
| 7068 | } |
| 7069 | |
| 7070 | headers[headerParam.name] = value; |
| 7071 | } |
| 7072 | } |
| 7073 | |
| 7074 | return headers; |
| 7075 | }; |
| 7076 | |
| 7077 | Operation.prototype.urlify = function (args) { |
| 7078 | var formParams = {}; |
| 7079 | var requestUrl = this.path.replace(/#.*/, ''); // remove URL fragment |
| 7080 | var querystring = ''; // grab params from the args, build the querystring along the way |
| 7081 | |
| 7082 | for (var i = 0; i < this.parameters.length; i++) { |
| 7083 | var param = this.parameters[i]; |
| 7084 | |
| 7085 | if (typeof args[param.name] !== 'undefined') { |
| 7086 | if (param.in === 'path') { |
| 7087 | var reg = new RegExp('\{' + param.name + '\}', 'gi'); |
| 7088 | var value = args[param.name]; |
| 7089 | |
| 7090 | if (Array.isArray(value)) { |
| 7091 | value = this.encodePathCollection(param.collectionFormat, param.name, value); |
| 7092 | } else { |
| 7093 | value = this.encodePathParam(value); |
| 7094 | } |
| 7095 | |
| 7096 | requestUrl = requestUrl.replace(reg, value); |
| 7097 | } else if (param.in === 'query' && typeof args[param.name] !== 'undefined') { |
| 7098 | if (querystring === '' && requestUrl.indexOf('?') < 0) { |
| 7099 | querystring += '?'; |
| 7100 | } else { |
| 7101 | querystring += '&'; |
| 7102 | } |
| 7103 | |
| 7104 | if (typeof param.collectionFormat !== 'undefined') { |
| 7105 | var qp = args[param.name]; |
| 7106 | |
| 7107 | if (Array.isArray(qp)) { |
| 7108 | querystring += this.encodeQueryCollection(param.collectionFormat, param.name, qp); |
| 7109 | } else { |
| 7110 | querystring += this.encodeQueryKey(param.name) + '=' + this.encodeQueryParam(args[param.name]); |
| 7111 | } |
| 7112 | } else { |
| 7113 | querystring += this.encodeQueryKey(param.name) + '=' + this.encodeQueryParam(args[param.name]); |
| 7114 | } |
| 7115 | } else if (param.in === 'formData') { |
| 7116 | formParams[param.name] = args[param.name]; |
| 7117 | } |
| 7118 | } |
| 7119 | } |
| 7120 | var url = this.scheme + '://' + this.host; |
| 7121 | |
| 7122 | if (this.basePath !== '/') { |
| 7123 | url += this.basePath; |
| 7124 | } |
| 7125 | return url + requestUrl + querystring; |
| 7126 | }; |
| 7127 | |
| 7128 | Operation.prototype.getMissingParams = function (args) { |
| 7129 | var missingParams = []; // check required params, track the ones that are missing |
| 7130 | var i; |
| 7131 | |
| 7132 | for (i = 0; i < this.parameters.length; i++) { |
| 7133 | var param = this.parameters[i]; |
| 7134 | |
| 7135 | if (param.required === true) { |
| 7136 | if (typeof args[param.name] === 'undefined') { |
| 7137 | missingParams = param.name; |
| 7138 | } |
| 7139 | } |
| 7140 | } |
| 7141 | |
| 7142 | return missingParams; |
| 7143 | }; |
| 7144 | |
| 7145 | Operation.prototype.getBody = function (headers, args, opts) { |
| 7146 | var formParams = {}, hasFormParams, body, key, value, hasBody = false; |
| 7147 | |
| 7148 | // look at each param and put form params in an object |
| 7149 | for (var i = 0; i < this.parameters.length; i++) { |
| 7150 | var param = this.parameters[i]; |
| 7151 | if (typeof args[param.name] !== 'undefined') { |
| 7152 | if (param.in === 'body') { |
| 7153 | body = args[param.name]; |
| 7154 | } else if (param.in === 'formData') { |
| 7155 | formParams[param.name] = { |
| 7156 | param: param, |
| 7157 | value: args[param.name] |
| 7158 | }; |
| 7159 | hasFormParams = true; |
| 7160 | } |
| 7161 | } |
| 7162 | else { |
| 7163 | if(param.in === 'body') { |
| 7164 | hasBody = true; |
| 7165 | } |
| 7166 | } |
| 7167 | } |
| 7168 | |
| 7169 | // if body is null and hasBody is true, AND a JSON body is requested, send empty {} |
| 7170 | if(hasBody && typeof body === 'undefined') { |
| 7171 | var contentType = headers['Content-Type']; |
| 7172 | if(contentType && contentType.indexOf('application/json') === 0) { |
| 7173 | body = '{}'; |
| 7174 | } |
| 7175 | } |
| 7176 | |
| 7177 | var isMultiPart = false; |
| 7178 | if(headers['Content-Type'] && headers['Content-Type'].indexOf('multipart/form-data') >= 0) { |
| 7179 | isMultiPart = true; |
| 7180 | } |
| 7181 | |
| 7182 | // handle form params |
| 7183 | if (hasFormParams && !isMultiPart) { |
| 7184 | var encoded = ''; |
| 7185 | |
| 7186 | for (key in formParams) { |
| 7187 | var param = formParams[key].param; |
| 7188 | value = formParams[key].value; |
| 7189 | |
| 7190 | if (typeof value !== 'undefined') { |
| 7191 | if (Array.isArray(value)) { |
| 7192 | if (encoded !== '') { |
| 7193 | encoded += '&'; |
| 7194 | } |
| 7195 | encoded += this.encodeQueryCollection(param.collectionFormat, key, value); |
| 7196 | } |
| 7197 | else { |
| 7198 | if (encoded !== '') { |
| 7199 | encoded += '&'; |
| 7200 | } |
| 7201 | |
| 7202 | encoded += encodeURIComponent(key) + '=' + encodeURIComponent(value); |
| 7203 | } |
| 7204 | } |
| 7205 | } |
| 7206 | |
| 7207 | body = encoded; |
| 7208 | } else if (isMultiPart) { |
| 7209 | var bodyParam; |
| 7210 | if (typeof FormData === 'function') { |
| 7211 | bodyParam = new FormData(); |
| 7212 | |
| 7213 | bodyParam.type = 'formData'; |
| 7214 | |
| 7215 | for (key in formParams) { |
| 7216 | var param = formParams[key].param; |
| 7217 | value = args[key]; |
| 7218 | |
| 7219 | if (typeof value !== 'undefined') { |
| 7220 | if({}.toString.apply(value) === '[object File]') { |
| 7221 | bodyParam.append(key, value); |
| 7222 | } |
| 7223 | else if (value.type === 'file' && value.value) { |
| 7224 | bodyParam.append(key, value.value); |
| 7225 | } else { |
| 7226 | if (Array.isArray(value)) { |
| 7227 | if(param.collectionFormat === 'multi') { |
| 7228 | bodyParam.delete(key); |
| 7229 | for(var v in value) { |
| 7230 | bodyParam.append(key, value[v]); |
| 7231 | } |
| 7232 | } |
| 7233 | else { |
| 7234 | bodyParam.append(key, this.encodeQueryCollection(param.collectionFormat, key, value).split('=').slice(1).join('=')); |
| 7235 | } |
| 7236 | } |
| 7237 | else { |
| 7238 | bodyParam.append(key, value); |
| 7239 | } |
| 7240 | } |
| 7241 | } |
| 7242 | } |
| 7243 | body = bodyParam; |
| 7244 | } |
| 7245 | else { |
| 7246 | bodyParam = {}; |
| 7247 | for (key in formParams) { |
| 7248 | value = args[key]; |
| 7249 | if (Array.isArray(value)) { |
| 7250 | var delimeter; |
| 7251 | var format = param.collectionFormat || 'multi'; |
| 7252 | if(format === 'ssv') { |
| 7253 | delimeter = ' '; |
| 7254 | } |
| 7255 | else if(format === 'pipes') { |
| 7256 | delimeter = '|'; |
| 7257 | } |
| 7258 | else if(format === 'tsv') { |
| 7259 | delimeter = '\t'; |
| 7260 | } |
| 7261 | else if(format === 'multi') { |
| 7262 | bodyParam[key] = value; |
| 7263 | break; |
| 7264 | } |
| 7265 | else { |
| 7266 | delimeter = ','; |
| 7267 | } |
| 7268 | var data; |
| 7269 | value.forEach(function(v) { |
| 7270 | if(data) { |
| 7271 | data += delimeter; |
| 7272 | } |
| 7273 | else { |
| 7274 | data = ''; |
| 7275 | } |
| 7276 | data += v; |
| 7277 | }); |
| 7278 | bodyParam[key] = data; |
| 7279 | } |
| 7280 | else { |
| 7281 | bodyParam[key] = value; |
| 7282 | } |
| 7283 | } |
| 7284 | body = bodyParam; |
| 7285 | } |
| 7286 | headers['Content-Type'] = 'multipart/form-data'; |
| 7287 | } |
| 7288 | |
| 7289 | return body; |
| 7290 | }; |
| 7291 | |
| 7292 | /** |
| 7293 | * gets sample response for a single operation |
| 7294 | **/ |
| 7295 | Operation.prototype.getModelSampleJSON = function (type, models) { |
| 7296 | var listType, sampleJson, innerType; |
| 7297 | models = models || {}; |
| 7298 | |
| 7299 | listType = (type instanceof Array); |
| 7300 | innerType = listType ? type[0] : type; |
| 7301 | |
| 7302 | if(models[innerType]) { |
| 7303 | sampleJson = models[innerType].createJSONSample(); |
| 7304 | } else if (this.getInlineModel(innerType)){ |
| 7305 | sampleJson = this.getInlineModel(innerType).createJSONSample(); // may return null, if type isn't correct |
| 7306 | } |
| 7307 | |
| 7308 | |
| 7309 | if (sampleJson) { |
| 7310 | sampleJson = listType ? [sampleJson] : sampleJson; |
| 7311 | |
| 7312 | if (typeof sampleJson === 'string') { |
| 7313 | return sampleJson; |
| 7314 | } else if (_.isObject(sampleJson)) { |
| 7315 | var t = sampleJson; |
| 7316 | |
| 7317 | if (sampleJson instanceof Array && sampleJson.length > 0) { |
| 7318 | t = sampleJson[0]; |
| 7319 | } |
| 7320 | |
| 7321 | if (t.nodeName && typeof t === 'Node') { |
| 7322 | var xmlString = new XMLSerializer().serializeToString(t); |
| 7323 | |
| 7324 | return this.formatXml(xmlString); |
| 7325 | } else { |
| 7326 | return JSON.stringify(sampleJson, null, 2); |
| 7327 | } |
| 7328 | } else { |
| 7329 | return sampleJson; |
| 7330 | } |
| 7331 | } |
| 7332 | }; |
| 7333 | |
| 7334 | /** |
| 7335 | * legacy binding |
| 7336 | **/ |
| 7337 | Operation.prototype.do = function (args, opts, callback, error, parent) { |
| 7338 | return this.execute(args, opts, callback, error, parent); |
| 7339 | }; |
| 7340 | |
| 7341 | /** |
| 7342 | * executes an operation |
| 7343 | **/ |
| 7344 | Operation.prototype.execute = function (arg1, arg2, arg3, arg4, parent) { |
| 7345 | var args = arg1 || {}; |
| 7346 | var opts = {}, success, error, deferred, timeout; |
| 7347 | |
| 7348 | if (_.isObject(arg2)) { |
| 7349 | opts = arg2; |
| 7350 | success = arg3; |
| 7351 | error = arg4; |
| 7352 | } |
| 7353 | |
| 7354 | timeout = typeof opts.timeout !== 'undefined' |
| 7355 | ? opts.timeout |
| 7356 | : this.timeout; |
| 7357 | |
| 7358 | if(this.client) { |
| 7359 | opts.client = this.client; |
| 7360 | } |
| 7361 | |
| 7362 | // add the request interceptor from parent, if none sent from client |
| 7363 | if(!opts.requestInterceptor && this.requestInterceptor ) { |
| 7364 | opts.requestInterceptor = this.requestInterceptor ; |
| 7365 | } |
| 7366 | |
| 7367 | if(!opts.responseInterceptor && this.responseInterceptor) { |
| 7368 | opts.responseInterceptor = this.responseInterceptor; |
| 7369 | } |
| 7370 | |
| 7371 | if (typeof arg2 === 'function') { |
| 7372 | success = arg2; |
| 7373 | error = arg3; |
| 7374 | } |
| 7375 | |
| 7376 | if (this.parent.usePromise) { |
| 7377 | deferred = Q.defer(); |
| 7378 | } else { |
| 7379 | success = (success || this.parent.defaultSuccessCallback || helpers.log); |
| 7380 | error = (error || this.parent.defaultErrorCallback || helpers.log); |
| 7381 | } |
| 7382 | |
| 7383 | if (typeof opts.useJQuery === 'undefined') { |
| 7384 | opts.useJQuery = this.useJQuery; |
| 7385 | } |
| 7386 | |
| 7387 | if (typeof opts.jqueryAjaxCache === 'undefined') { |
| 7388 | opts.jqueryAjaxCache = this.jqueryAjaxCache; |
| 7389 | } |
| 7390 | |
| 7391 | if (typeof opts.enableCookies === 'undefined') { |
| 7392 | opts.enableCookies = this.enableCookies; |
| 7393 | } |
| 7394 | |
| 7395 | var missingParams = this.getMissingParams(args); |
| 7396 | |
| 7397 | if (missingParams.length > 0) { |
| 7398 | var message = 'missing required params: ' + missingParams; |
| 7399 | |
| 7400 | helpers.fail(message); |
| 7401 | |
| 7402 | if (this.parent.usePromise) { |
| 7403 | deferred.reject(message); |
| 7404 | return deferred.promise; |
| 7405 | } else { |
| 7406 | error(message, parent); |
| 7407 | return {}; |
| 7408 | } |
| 7409 | } |
| 7410 | |
| 7411 | var allHeaders = this.getHeaderParams(args); |
| 7412 | var contentTypeHeaders = this.setContentTypes(args, opts); |
| 7413 | var headers = {}, attrname; |
| 7414 | |
| 7415 | for (attrname in allHeaders) { headers[attrname] = allHeaders[attrname]; } |
| 7416 | for (attrname in contentTypeHeaders) { headers[attrname] = contentTypeHeaders[attrname]; } |
| 7417 | |
| 7418 | var body = this.getBody(contentTypeHeaders, args, opts); |
| 7419 | var url = this.urlify(args); |
| 7420 | |
| 7421 | if(url.indexOf('.{format}') > 0) { |
| 7422 | if(headers) { |
| 7423 | var format = headers.Accept || headers.accept; |
| 7424 | if(format && format.indexOf('json') > 0) { |
| 7425 | url = url.replace('.{format}', '.json'); |
| 7426 | } |
| 7427 | else if(format && format.indexOf('xml') > 0) { |
| 7428 | url = url.replace('.{format}', '.xml'); |
| 7429 | } |
| 7430 | } |
| 7431 | } |
| 7432 | |
| 7433 | var obj = { |
| 7434 | url: url, |
| 7435 | method: this.method.toUpperCase(), |
| 7436 | body: body, |
| 7437 | enableCookies: opts.enableCookies, |
| 7438 | useJQuery: opts.useJQuery, |
| 7439 | jqueryAjaxCache: opts.jqueryAjaxCache, |
| 7440 | deferred: deferred, |
| 7441 | headers: headers, |
| 7442 | clientAuthorizations: opts.clientAuthorizations, |
| 7443 | on: { |
| 7444 | response: function (response) { |
| 7445 | if (deferred) { |
| 7446 | deferred.resolve(response); |
| 7447 | return deferred.promise; |
| 7448 | } else { |
| 7449 | return success(response, parent); |
| 7450 | } |
| 7451 | }, |
| 7452 | error: function (response) { |
| 7453 | if (deferred) { |
| 7454 | deferred.reject(response); |
| 7455 | return deferred.promise; |
| 7456 | } else { |
| 7457 | return error(response, parent); |
| 7458 | } |
| 7459 | } |
| 7460 | } |
| 7461 | }; |
| 7462 | |
| 7463 | if (timeout) { |
| 7464 | obj.timeout = timeout; |
| 7465 | } |
| 7466 | |
| 7467 | this.clientAuthorizations.apply(obj, this.operation.security); |
| 7468 | if (opts.mock === true) { |
| 7469 | return obj; |
| 7470 | } else { |
| 7471 | return new SwaggerHttp().execute(obj, opts); |
| 7472 | } |
| 7473 | }; |
| 7474 | |
| 7475 | function itemByPriority(col, itemPriority) { |
| 7476 | |
| 7477 | // No priorities? return first... |
| 7478 | if(_.isEmpty(itemPriority)) { |
| 7479 | return col[0]; |
| 7480 | } |
| 7481 | |
| 7482 | for (var i = 0, len = itemPriority.length; i < len; i++) { |
| 7483 | if(col.indexOf(itemPriority[i]) > -1) { |
| 7484 | return itemPriority[i]; |
| 7485 | } |
| 7486 | } |
| 7487 | |
| 7488 | // Otherwise return first |
| 7489 | return col[0]; |
| 7490 | } |
| 7491 | |
| 7492 | Operation.prototype.setContentTypes = function (args, opts) { |
| 7493 | // default type |
| 7494 | var allDefinedParams = this.parameters; |
| 7495 | var body; |
| 7496 | var consumes = args.parameterContentType || itemByPriority(this.consumes, ['application/json', 'application/yaml']); |
| 7497 | var accepts = opts.responseContentType || itemByPriority(this.produces, ['application/json', 'application/yaml']); |
| 7498 | var definedFileParams = []; |
| 7499 | var definedFormParams = []; |
| 7500 | var headers = {}; |
| 7501 | var i; |
| 7502 | |
| 7503 | // get params from the operation and set them in definedFileParams, definedFormParams, headers |
| 7504 | for (i = 0; i < allDefinedParams.length; i++) { |
| 7505 | var param = allDefinedParams[i]; |
| 7506 | |
| 7507 | if (param.in === 'formData') { |
| 7508 | if (param.type === 'file') { |
| 7509 | definedFileParams.push(param); |
| 7510 | } else { |
| 7511 | definedFormParams.push(param); |
| 7512 | } |
| 7513 | } else if (param.in === 'header' && opts) { |
| 7514 | var key = param.name; |
| 7515 | var headerValue = opts[param.name]; |
| 7516 | |
| 7517 | if (typeof opts[param.name] !== 'undefined') { |
| 7518 | headers[key] = headerValue; |
| 7519 | } |
| 7520 | } else if (param.in === 'body' && typeof args[param.name] !== 'undefined') { |
| 7521 | body = args[param.name]; |
| 7522 | } |
| 7523 | } |
| 7524 | |
| 7525 | // if there's a body, need to set the consumes header via requestContentType |
| 7526 | var hasBody = body || definedFileParams.length || definedFormParams.length; |
| 7527 | if (this.method === 'post' || this.method === 'put' || this.method === 'patch' || |
| 7528 | ((this.method === 'delete' || this.method === 'get') && hasBody)) { |
| 7529 | if (opts.requestContentType) { |
| 7530 | consumes = opts.requestContentType; |
| 7531 | } |
| 7532 | // if any form params, content type must be set |
| 7533 | if (definedFormParams.length > 0) { |
| 7534 | consumes = undefined; |
| 7535 | if (opts.requestContentType) { // override if set |
| 7536 | consumes = opts.requestContentType; |
| 7537 | } else if (definedFileParams.length > 0) { // if a file, must be multipart/form-data |
| 7538 | consumes = 'multipart/form-data'; |
| 7539 | } else { |
| 7540 | if (this.consumes && this.consumes.length > 0) { |
| 7541 | // use the consumes setting |
| 7542 | for(var c in this.consumes) { |
| 7543 | var chk = this.consumes[c]; |
| 7544 | if(chk.indexOf('application/x-www-form-urlencoded') === 0 || chk.indexOf('multipart/form-data') === 0) { |
| 7545 | consumes = chk; |
| 7546 | } |
| 7547 | } |
| 7548 | } |
| 7549 | } |
| 7550 | if(typeof consumes === 'undefined') { |
| 7551 | // default to x-www-from-urlencoded |
| 7552 | consumes = 'application/x-www-form-urlencoded'; |
| 7553 | } |
| 7554 | } |
| 7555 | } |
| 7556 | else { |
| 7557 | consumes = null; |
| 7558 | } |
| 7559 | |
| 7560 | if (consumes && this.consumes) { |
| 7561 | if (this.consumes.indexOf(consumes) === -1) { |
| 7562 | helpers.log('server doesn\'t consume ' + consumes + ', try ' + JSON.stringify(this.consumes)); |
| 7563 | } |
| 7564 | } |
| 7565 | |
| 7566 | if (!this.matchesAccept(accepts)) { |
| 7567 | helpers.log('server can\'t produce ' + accepts); |
| 7568 | } |
| 7569 | |
| 7570 | if ((consumes && body !== '') || (consumes === 'application/x-www-form-urlencoded')) { |
| 7571 | headers['Content-Type'] = consumes; |
| 7572 | } |
| 7573 | else if(this.consumes && this.consumes.length > 0 && this.consumes[0] === 'application/x-www-form-urlencoded') { |
| 7574 | headers['Content-Type'] = this.consumes[0]; |
| 7575 | } |
| 7576 | |
| 7577 | if (accepts) { |
| 7578 | headers.Accept = accepts; |
| 7579 | } |
| 7580 | |
| 7581 | return headers; |
| 7582 | }; |
| 7583 | |
| 7584 | /** |
| 7585 | * Returns true if the request accepts header matches anything in this.produces. |
| 7586 | * If this.produces contains * / *, ignore the accept header. |
| 7587 | * @param {string=} accepts The client request accept header. |
| 7588 | * @return {boolean} |
| 7589 | */ |
| 7590 | Operation.prototype.matchesAccept = function(accepts) { |
| 7591 | // no accepts or produces, no problem! |
| 7592 | if (!accepts || !this.produces) { |
| 7593 | return true; |
| 7594 | } |
| 7595 | return this.produces.indexOf(accepts) !== -1 || this.produces.indexOf('*/*') !== -1; |
| 7596 | }; |
| 7597 | |
| 7598 | Operation.prototype.asCurl = function (args1, args2) { |
| 7599 | var opts = {mock: true}; |
| 7600 | if (typeof args2 === 'object') { |
| 7601 | for (var argKey in args2) { |
| 7602 | opts[argKey] = args2[argKey]; |
| 7603 | } |
| 7604 | } |
| 7605 | var obj = this.execute(args1, opts); |
| 7606 | |
| 7607 | this.clientAuthorizations.apply(obj, this.operation.security); |
| 7608 | |
| 7609 | var results = []; |
| 7610 | |
| 7611 | results.push('-X ' + this.method.toUpperCase()); |
| 7612 | |
| 7613 | if (typeof obj.headers !== 'undefined') { |
| 7614 | var key; |
| 7615 | |
| 7616 | for (key in obj.headers) { |
| 7617 | var value = obj.headers[key]; |
| 7618 | if(typeof value === 'string'){ |
| 7619 | value = value.replace(/\'/g, '\\u0027'); |
| 7620 | } |
| 7621 | results.push('--header \'' + key + ': ' + value + '\''); |
| 7622 | } |
| 7623 | } |
| 7624 | var isFormData = false; |
| 7625 | var isMultipart = false; |
| 7626 | |
| 7627 | var type = obj.headers['Content-Type']; |
| 7628 | if(type && type.indexOf('application/x-www-form-urlencoded') === 0) { |
| 7629 | isFormData = true; |
| 7630 | } |
| 7631 | else if (type && type.indexOf('multipart/form-data') === 0) { |
| 7632 | isFormData = true; |
| 7633 | isMultipart = true; |
| 7634 | } |
| 7635 | |
| 7636 | if (obj.body) { |
| 7637 | var body; |
| 7638 | if (_.isObject(obj.body)) { |
| 7639 | if(isMultipart) { |
| 7640 | isMultipart = true; |
| 7641 | // add the form data |
| 7642 | for(var i = 0; i < this.parameters.length; i++) { |
| 7643 | var parameter = this.parameters[i]; |
| 7644 | if(parameter.in === 'formData') { |
| 7645 | if (!body) { |
| 7646 | body = ''; |
| 7647 | } |
| 7648 | |
| 7649 | var paramValue; |
| 7650 | if(typeof FormData === 'function' && obj.body instanceof FormData) { |
| 7651 | paramValue = obj.body.getAll(parameter.name); |
| 7652 | } |
| 7653 | else { |
| 7654 | paramValue = obj.body[parameter.name]; |
| 7655 | } |
| 7656 | if (paramValue) { |
| 7657 | if (parameter.type === 'file') { |
| 7658 | if(paramValue.name) { |
| 7659 | body += '-F ' + parameter.name + '=@"' + paramValue.name + '" '; |
| 7660 | } |
| 7661 | } |
| 7662 | else { |
| 7663 | if (Array.isArray(paramValue)) { |
| 7664 | if(parameter.collectionFormat === 'multi') { |
| 7665 | for(var v in paramValue) { |
| 7666 | body += '-F ' + this.encodeQueryKey(parameter.name) + '=' + paramValue[v] + ' '; |
| 7667 | } |
| 7668 | } |
| 7669 | else { |
| 7670 | body += '-F ' + this.encodeQueryCollection(parameter.collectionFormat, parameter.name, paramValue) + ' '; |
| 7671 | } |
| 7672 | } else { |
| 7673 | body += '-F ' + this.encodeQueryKey(parameter.name) + '=' + paramValue + ' '; |
| 7674 | } |
| 7675 | } |
| 7676 | } |
| 7677 | } |
| 7678 | } |
| 7679 | } |
| 7680 | if(!body) { |
| 7681 | body = JSON.stringify(obj.body); |
| 7682 | } |
| 7683 | } else { |
| 7684 | body = obj.body; |
| 7685 | } |
| 7686 | // escape @ => %40, ' => %27 |
| 7687 | body = body.replace(/\'/g, '%27').replace(/\n/g, ' \\ \n '); |
| 7688 | |
| 7689 | if(!isFormData) { |
| 7690 | // escape & => %26 |
| 7691 | body = body.replace(/&/g, '%26'); |
| 7692 | } |
| 7693 | if(isMultipart) { |
| 7694 | results.push(body); |
| 7695 | } |
| 7696 | else { |
| 7697 | results.push('-d \'' + body.replace(/@/g, '%40') + '\''); |
| 7698 | } |
| 7699 | } |
| 7700 | |
| 7701 | return 'curl ' + (results.join(' ')) + ' \'' + obj.url + '\''; |
| 7702 | }; |
| 7703 | |
| 7704 | Operation.prototype.encodePathCollection = function (type, name, value) { |
| 7705 | var encoded = ''; |
| 7706 | var i; |
| 7707 | var separator = ''; |
| 7708 | |
| 7709 | if (type === 'ssv') { |
| 7710 | separator = '%20'; |
| 7711 | } else if (type === 'tsv') { |
| 7712 | separator = '%09'; |
| 7713 | } else if (type === 'pipes') { |
| 7714 | separator = '|'; |
| 7715 | } else { |
| 7716 | separator = ','; |
| 7717 | } |
| 7718 | |
| 7719 | for (i = 0; i < value.length; i++) { |
| 7720 | if (i === 0) { |
| 7721 | encoded = this.encodeQueryParam(value[i]); |
| 7722 | } else { |
| 7723 | encoded += separator + this.encodeQueryParam(value[i]); |
| 7724 | } |
| 7725 | } |
| 7726 | |
| 7727 | return encoded; |
| 7728 | }; |
| 7729 | |
| 7730 | Operation.prototype.encodeQueryCollection = function (type, name, value) { |
| 7731 | var encoded = ''; |
| 7732 | var i; |
| 7733 | |
| 7734 | type = type || 'default'; |
| 7735 | if (type === 'default' || type === 'multi') { |
| 7736 | for (i = 0; i < value.length; i++) { |
| 7737 | if (i > 0) {encoded += '&';} |
| 7738 | |
| 7739 | encoded += this.encodeQueryKey(name) + '=' + this.encodeQueryParam(value[i]); |
| 7740 | } |
| 7741 | } else { |
| 7742 | var separator = ''; |
| 7743 | |
| 7744 | if (type === 'csv') { |
| 7745 | separator = ','; |
| 7746 | } else if (type === 'ssv') { |
| 7747 | separator = '%20'; |
| 7748 | } else if (type === 'tsv') { |
| 7749 | separator = '%09'; |
| 7750 | } else if (type === 'pipes') { |
| 7751 | separator = '|'; |
| 7752 | } else if (type === 'brackets') { |
| 7753 | for (i = 0; i < value.length; i++) { |
| 7754 | if (i !== 0) { |
| 7755 | encoded += '&'; |
| 7756 | } |
| 7757 | |
| 7758 | encoded += this.encodeQueryKey(name) + '[]=' + this.encodeQueryParam(value[i]); |
| 7759 | } |
| 7760 | } |
| 7761 | |
| 7762 | if (separator !== '') { |
| 7763 | for (i = 0; i < value.length; i++) { |
| 7764 | if (i === 0) { |
| 7765 | encoded = this.encodeQueryKey(name) + '=' + this.encodeQueryParam(value[i]); |
| 7766 | } else { |
| 7767 | encoded += separator + this.encodeQueryParam(value[i]); |
| 7768 | } |
| 7769 | } |
| 7770 | } |
| 7771 | } |
| 7772 | |
| 7773 | return encoded; |
| 7774 | }; |
| 7775 | |
| 7776 | Operation.prototype.encodeQueryKey = function (arg) { |
| 7777 | return encodeURIComponent(arg) |
| 7778 | .replace('%5B','[').replace('%5D', ']').replace('%24', '$'); |
| 7779 | }; |
| 7780 | |
| 7781 | Operation.prototype.encodeQueryParam = function (arg) { |
| 7782 | return encodeURIComponent(arg); |
| 7783 | }; |
| 7784 | |
| 7785 | /** |
| 7786 | * TODO revisit, might not want to leave '/' |
| 7787 | **/ |
| 7788 | Operation.prototype.encodePathParam = function (pathParam) { |
| 7789 | return encodeURIComponent(pathParam); |
| 7790 | }; |
| 7791 | |
| 7792 | },{"../helpers":4,"../http":5,"./model":9,"lodash-compat/lang/cloneDeep":138,"lodash-compat/lang/isEmpty":141,"lodash-compat/lang/isObject":144,"lodash-compat/lang/isUndefined":148,"q":157}],11:[function(require,module,exports){ |
| 7793 | 'use strict'; |
| 7794 | |
| 7795 | var OperationGroup = module.exports = function (tag, description, externalDocs, operation) { |
| 7796 | this.description = description; |
| 7797 | this.externalDocs = externalDocs; |
| 7798 | this.name = tag; |
| 7799 | this.operation = operation; |
| 7800 | this.operationsArray = []; |
| 7801 | this.path = tag; |
| 7802 | this.tag = tag; |
| 7803 | }; |
| 7804 | |
| 7805 | OperationGroup.prototype.sort = function () { |
| 7806 | |
| 7807 | }; |
| 7808 | |
| 7809 | |
| 7810 | },{}],12:[function(require,module,exports){ |
| 7811 | // shim for using process in browser |
| 7812 | |
| 7813 | var process = module.exports = {}; |
| 7814 | var queue = []; |
| 7815 | var draining = false; |
| 7816 | |
| 7817 | function drainQueue() { |
| 7818 | if (draining) { |
| 7819 | return; |
| 7820 | } |
| 7821 | draining = true; |
| 7822 | var currentQueue; |
| 7823 | var len = queue.length; |
| 7824 | while(len) { |
| 7825 | currentQueue = queue; |
| 7826 | queue = []; |
| 7827 | var i = -1; |
| 7828 | while (++i < len) { |
| 7829 | currentQueue[i](); |
| 7830 | } |
| 7831 | len = queue.length; |
| 7832 | } |
| 7833 | draining = false; |
| 7834 | } |
| 7835 | process.nextTick = function (fun) { |
| 7836 | queue.push(fun); |
| 7837 | if (!draining) { |
| 7838 | setTimeout(drainQueue, 0); |
| 7839 | } |
| 7840 | }; |
| 7841 | |
| 7842 | process.title = 'browser'; |
| 7843 | process.browser = true; |
| 7844 | process.env = {}; |
| 7845 | process.argv = []; |
| 7846 | process.version = ''; // empty string to avoid regexp issues |
| 7847 | process.versions = {}; |
| 7848 | |
| 7849 | function noop() {} |
| 7850 | |
| 7851 | process.on = noop; |
| 7852 | process.addListener = noop; |
| 7853 | process.once = noop; |
| 7854 | process.off = noop; |
| 7855 | process.removeListener = noop; |
| 7856 | process.removeAllListeners = noop; |
| 7857 | process.emit = noop; |
| 7858 | |
| 7859 | process.binding = function (name) { |
| 7860 | throw new Error('process.binding is not supported'); |
| 7861 | }; |
| 7862 | |
| 7863 | // TODO(shtylman) |
| 7864 | process.cwd = function () { return '/' }; |
| 7865 | process.chdir = function (dir) { |
| 7866 | throw new Error('process.chdir is not supported'); |
| 7867 | }; |
| 7868 | process.umask = function() { return 0; }; |
| 7869 | |
| 7870 | },{}],13:[function(require,module,exports){ |
| 7871 | (function (Buffer){ |
| 7872 | (function () { |
| 7873 | "use strict"; |
| 7874 | |
| 7875 | function btoa(str) { |
| 7876 | var buffer |
| 7877 | ; |
| 7878 | |
| 7879 | if (str instanceof Buffer) { |
| 7880 | buffer = str; |
| 7881 | } else { |
| 7882 | buffer = new Buffer(str.toString(), 'binary'); |
| 7883 | } |
| 7884 | |
| 7885 | return buffer.toString('base64'); |
| 7886 | } |
| 7887 | |
| 7888 | module.exports = btoa; |
| 7889 | }()); |
| 7890 | |
| 7891 | }).call(this,require("buffer").Buffer) |
| 7892 | //# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9idG9hL2luZGV4LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSIsImZpbGUiOiJnZW5lcmF0ZWQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlc0NvbnRlbnQiOlsiKGZ1bmN0aW9uICgpIHtcbiAgXCJ1c2Ugc3RyaWN0XCI7XG5cbiAgZnVuY3Rpb24gYnRvYShzdHIpIHtcbiAgICB2YXIgYnVmZmVyXG4gICAgICA7XG5cbiAgICBpZiAoc3RyIGluc3RhbmNlb2YgQnVmZmVyKSB7XG4gICAgICBidWZmZXIgPSBzdHI7XG4gICAgfSBlbHNlIHtcbiAgICAgIGJ1ZmZlciA9IG5ldyBCdWZmZXIoc3RyLnRvU3RyaW5nKCksICdiaW5hcnknKTtcbiAgICB9XG5cbiAgICByZXR1cm4gYnVmZmVyLnRvU3RyaW5nKCdiYXNlNjQnKTtcbiAgfVxuXG4gIG1vZHVsZS5leHBvcnRzID0gYnRvYTtcbn0oKSk7XG4iXX0= |
| 7893 | },{"buffer":14}],14:[function(require,module,exports){ |
| 7894 | /*! |
| 7895 | * The buffer module from node.js, for the browser. |
| 7896 | * |
| 7897 | * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org> |
| 7898 | * @license MIT |
| 7899 | */ |
| 7900 | |
| 7901 | var base64 = require('base64-js') |
| 7902 | var ieee754 = require('ieee754') |
| 7903 | var isArray = require('is-array') |
| 7904 | |
| 7905 | exports.Buffer = Buffer |
| 7906 | exports.SlowBuffer = SlowBuffer |
| 7907 | exports.INSPECT_MAX_BYTES = 50 |
| 7908 | Buffer.poolSize = 8192 // not used by this implementation |
| 7909 | |
| 7910 | var rootParent = {} |
| 7911 | |
| 7912 | /** |
| 7913 | * If `Buffer.TYPED_ARRAY_SUPPORT`: |
| 7914 | * === true Use Uint8Array implementation (fastest) |
| 7915 | * === false Use Object implementation (most compatible, even IE6) |
| 7916 | * |
| 7917 | * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, |
| 7918 | * Opera 11.6+, iOS 4.2+. |
| 7919 | * |
| 7920 | * Due to various browser bugs, sometimes the Object implementation will be used even |
| 7921 | * when the browser supports typed arrays. |
| 7922 | * |
| 7923 | * Note: |
| 7924 | * |
| 7925 | * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances, |
| 7926 | * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438. |
| 7927 | * |
| 7928 | * - Safari 5-7 lacks support for changing the `Object.prototype.constructor` property |
| 7929 | * on objects. |
| 7930 | * |
| 7931 | * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function. |
| 7932 | * |
| 7933 | * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of |
| 7934 | * incorrect length in some situations. |
| 7935 | |
| 7936 | * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they |
| 7937 | * get the Object implementation, which is slower but behaves correctly. |
| 7938 | */ |
| 7939 | Buffer.TYPED_ARRAY_SUPPORT = (function () { |
| 7940 | function Bar () {} |
| 7941 | try { |
| 7942 | var arr = new Uint8Array(1) |
| 7943 | arr.foo = function () { return 42 } |
| 7944 | arr.constructor = Bar |
| 7945 | return arr.foo() === 42 && // typed array instances can be augmented |
| 7946 | arr.constructor === Bar && // constructor can be set |
| 7947 | typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray` |
| 7948 | arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray` |
| 7949 | } catch (e) { |
| 7950 | return false |
| 7951 | } |
| 7952 | })() |
| 7953 | |
| 7954 | function kMaxLength () { |
| 7955 | return Buffer.TYPED_ARRAY_SUPPORT |
| 7956 | ? 0x7fffffff |
| 7957 | : 0x3fffffff |
| 7958 | } |
| 7959 | |
| 7960 | /** |
| 7961 | * Class: Buffer |
| 7962 | * ============= |
| 7963 | * |
| 7964 | * The Buffer constructor returns instances of `Uint8Array` that are augmented |
| 7965 | * with function properties for all the node `Buffer` API functions. We use |
| 7966 | * `Uint8Array` so that square bracket notation works as expected -- it returns |
| 7967 | * a single octet. |
| 7968 | * |
| 7969 | * By augmenting the instances, we can avoid modifying the `Uint8Array` |
| 7970 | * prototype. |
| 7971 | */ |
| 7972 | function Buffer (arg) { |
| 7973 | if (!(this instanceof Buffer)) { |
| 7974 | // Avoid going through an ArgumentsAdaptorTrampoline in the common case. |
| 7975 | if (arguments.length > 1) return new Buffer(arg, arguments[1]) |
| 7976 | return new Buffer(arg) |
| 7977 | } |
| 7978 | |
| 7979 | this.length = 0 |
| 7980 | this.parent = undefined |
| 7981 | |
| 7982 | // Common case. |
| 7983 | if (typeof arg === 'number') { |
| 7984 | return fromNumber(this, arg) |
| 7985 | } |
| 7986 | |
| 7987 | // Slightly less common case. |
| 7988 | if (typeof arg === 'string') { |
| 7989 | return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8') |
| 7990 | } |
| 7991 | |
| 7992 | // Unusual. |
| 7993 | return fromObject(this, arg) |
| 7994 | } |
| 7995 | |
| 7996 | function fromNumber (that, length) { |
| 7997 | that = allocate(that, length < 0 ? 0 : checked(length) | 0) |
| 7998 | if (!Buffer.TYPED_ARRAY_SUPPORT) { |
| 7999 | for (var i = 0; i < length; i++) { |
| 8000 | that[i] = 0 |
| 8001 | } |
| 8002 | } |
| 8003 | return that |
| 8004 | } |
| 8005 | |
| 8006 | function fromString (that, string, encoding) { |
| 8007 | if (typeof encoding !== 'string' || encoding === '') encoding = 'utf8' |
| 8008 | |
| 8009 | // Assumption: byteLength() return value is always < kMaxLength. |
| 8010 | var length = byteLength(string, encoding) | 0 |
| 8011 | that = allocate(that, length) |
| 8012 | |
| 8013 | that.write(string, encoding) |
| 8014 | return that |
| 8015 | } |
| 8016 | |
| 8017 | function fromObject (that, object) { |
| 8018 | if (Buffer.isBuffer(object)) return fromBuffer(that, object) |
| 8019 | |
| 8020 | if (isArray(object)) return fromArray(that, object) |
| 8021 | |
| 8022 | if (object == null) { |
| 8023 | throw new TypeError('must start with number, buffer, array or string') |
| 8024 | } |
| 8025 | |
| 8026 | if (typeof ArrayBuffer !== 'undefined') { |
| 8027 | if (object.buffer instanceof ArrayBuffer) { |
| 8028 | return fromTypedArray(that, object) |
| 8029 | } |
| 8030 | if (object instanceof ArrayBuffer) { |
| 8031 | return fromArrayBuffer(that, object) |
| 8032 | } |
| 8033 | } |
| 8034 | |
| 8035 | if (object.length) return fromArrayLike(that, object) |
| 8036 | |
| 8037 | return fromJsonObject(that, object) |
| 8038 | } |
| 8039 | |
| 8040 | function fromBuffer (that, buffer) { |
| 8041 | var length = checked(buffer.length) | 0 |
| 8042 | that = allocate(that, length) |
| 8043 | buffer.copy(that, 0, 0, length) |
| 8044 | return that |
| 8045 | } |
| 8046 | |
| 8047 | function fromArray (that, array) { |
| 8048 | var length = checked(array.length) | 0 |
| 8049 | that = allocate(that, length) |
| 8050 | for (var i = 0; i < length; i += 1) { |
| 8051 | that[i] = array[i] & 255 |
| 8052 | } |
| 8053 | return that |
| 8054 | } |
| 8055 | |
| 8056 | // Duplicate of fromArray() to keep fromArray() monomorphic. |
| 8057 | function fromTypedArray (that, array) { |
| 8058 | var length = checked(array.length) | 0 |
| 8059 | that = allocate(that, length) |
| 8060 | // Truncating the elements is probably not what people expect from typed |
| 8061 | // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior |
| 8062 | // of the old Buffer constructor. |
| 8063 | for (var i = 0; i < length; i += 1) { |
| 8064 | that[i] = array[i] & 255 |
| 8065 | } |
| 8066 | return that |
| 8067 | } |
| 8068 | |
| 8069 | function fromArrayBuffer (that, array) { |
| 8070 | if (Buffer.TYPED_ARRAY_SUPPORT) { |
| 8071 | // Return an augmented `Uint8Array` instance, for best performance |
| 8072 | array.byteLength |
| 8073 | that = Buffer._augment(new Uint8Array(array)) |
| 8074 | } else { |
| 8075 | // Fallback: Return an object instance of the Buffer class |
| 8076 | that = fromTypedArray(that, new Uint8Array(array)) |
| 8077 | } |
| 8078 | return that |
| 8079 | } |
| 8080 | |
| 8081 | function fromArrayLike (that, array) { |
| 8082 | var length = checked(array.length) | 0 |
| 8083 | that = allocate(that, length) |
| 8084 | for (var i = 0; i < length; i += 1) { |
| 8085 | that[i] = array[i] & 255 |
| 8086 | } |
| 8087 | return that |
| 8088 | } |
| 8089 | |
| 8090 | // Deserialize { type: 'Buffer', data: [1,2,3,...] } into a Buffer object. |
| 8091 | // Returns a zero-length buffer for inputs that don't conform to the spec. |
| 8092 | function fromJsonObject (that, object) { |
| 8093 | var array |
| 8094 | var length = 0 |
| 8095 | |
| 8096 | if (object.type === 'Buffer' && isArray(object.data)) { |
| 8097 | array = object.data |
| 8098 | length = checked(array.length) | 0 |
| 8099 | } |
| 8100 | that = allocate(that, length) |
| 8101 | |
| 8102 | for (var i = 0; i < length; i += 1) { |
| 8103 | that[i] = array[i] & 255 |
| 8104 | } |
| 8105 | return that |
| 8106 | } |
| 8107 | |
| 8108 | function allocate (that, length) { |
| 8109 | if (Buffer.TYPED_ARRAY_SUPPORT) { |
| 8110 | // Return an augmented `Uint8Array` instance, for best performance |
| 8111 | that = Buffer._augment(new Uint8Array(length)) |
| 8112 | } else { |
| 8113 | // Fallback: Return an object instance of the Buffer class |
| 8114 | that.length = length |
| 8115 | that._isBuffer = true |
| 8116 | } |
| 8117 | |
| 8118 | var fromPool = length !== 0 && length <= Buffer.poolSize >>> 1 |
| 8119 | if (fromPool) that.parent = rootParent |
| 8120 | |
| 8121 | return that |
| 8122 | } |
| 8123 | |
| 8124 | function checked (length) { |
| 8125 | // Note: cannot use `length < kMaxLength` here because that fails when |
| 8126 | // length is NaN (which is otherwise coerced to zero.) |
| 8127 | if (length >= kMaxLength()) { |
| 8128 | throw new RangeError('Attempt to allocate Buffer larger than maximum ' + |
| 8129 | 'size: 0x' + kMaxLength().toString(16) + ' bytes') |
| 8130 | } |
| 8131 | return length | 0 |
| 8132 | } |
| 8133 | |
| 8134 | function SlowBuffer (subject, encoding) { |
| 8135 | if (!(this instanceof SlowBuffer)) return new SlowBuffer(subject, encoding) |
| 8136 | |
| 8137 | var buf = new Buffer(subject, encoding) |
| 8138 | delete buf.parent |
| 8139 | return buf |
| 8140 | } |
| 8141 | |
| 8142 | Buffer.isBuffer = function isBuffer (b) { |
| 8143 | return !!(b != null && b._isBuffer) |
| 8144 | } |
| 8145 | |
| 8146 | Buffer.compare = function compare (a, b) { |
| 8147 | if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { |
| 8148 | throw new TypeError('Arguments must be Buffers') |
| 8149 | } |
| 8150 | |
| 8151 | if (a === b) return 0 |
| 8152 | |
| 8153 | var x = a.length |
| 8154 | var y = b.length |
| 8155 | |
| 8156 | var i = 0 |
| 8157 | var len = Math.min(x, y) |
| 8158 | while (i < len) { |
| 8159 | if (a[i] !== b[i]) break |
| 8160 | |
| 8161 | ++i |
| 8162 | } |
| 8163 | |
| 8164 | if (i !== len) { |
| 8165 | x = a[i] |
| 8166 | y = b[i] |
| 8167 | } |
| 8168 | |
| 8169 | if (x < y) return -1 |
| 8170 | if (y < x) return 1 |
| 8171 | return 0 |
| 8172 | } |
| 8173 | |
| 8174 | Buffer.isEncoding = function isEncoding (encoding) { |
| 8175 | switch (String(encoding).toLowerCase()) { |
| 8176 | case 'hex': |
| 8177 | case 'utf8': |
| 8178 | case 'utf-8': |
| 8179 | case 'ascii': |
| 8180 | case 'binary': |
| 8181 | case 'base64': |
| 8182 | case 'raw': |
| 8183 | case 'ucs2': |
| 8184 | case 'ucs-2': |
| 8185 | case 'utf16le': |
| 8186 | case 'utf-16le': |
| 8187 | return true |
| 8188 | default: |
| 8189 | return false |
| 8190 | } |
| 8191 | } |
| 8192 | |
| 8193 | Buffer.concat = function concat (list, length) { |
| 8194 | if (!isArray(list)) throw new TypeError('list argument must be an Array of Buffers.') |
| 8195 | |
| 8196 | if (list.length === 0) { |
| 8197 | return new Buffer(0) |
| 8198 | } |
| 8199 | |
| 8200 | var i |
| 8201 | if (length === undefined) { |
| 8202 | length = 0 |
| 8203 | for (i = 0; i < list.length; i++) { |
| 8204 | length += list[i].length |
| 8205 | } |
| 8206 | } |
| 8207 | |
| 8208 | var buf = new Buffer(length) |
| 8209 | var pos = 0 |
| 8210 | for (i = 0; i < list.length; i++) { |
| 8211 | var item = list[i] |
| 8212 | item.copy(buf, pos) |
| 8213 | pos += item.length |
| 8214 | } |
| 8215 | return buf |
| 8216 | } |
| 8217 | |
| 8218 | function byteLength (string, encoding) { |
| 8219 | if (typeof string !== 'string') string = '' + string |
| 8220 | |
| 8221 | var len = string.length |
| 8222 | if (len === 0) return 0 |
| 8223 | |
| 8224 | // Use a for loop to avoid recursion |
| 8225 | var loweredCase = false |
| 8226 | for (;;) { |
| 8227 | switch (encoding) { |
| 8228 | case 'ascii': |
| 8229 | case 'binary': |
| 8230 | // Deprecated |
| 8231 | case 'raw': |
| 8232 | case 'raws': |
| 8233 | return len |
| 8234 | case 'utf8': |
| 8235 | case 'utf-8': |
| 8236 | return utf8ToBytes(string).length |
| 8237 | case 'ucs2': |
| 8238 | case 'ucs-2': |
| 8239 | case 'utf16le': |
| 8240 | case 'utf-16le': |
| 8241 | return len * 2 |
| 8242 | case 'hex': |
| 8243 | return len >>> 1 |
| 8244 | case 'base64': |
| 8245 | return base64ToBytes(string).length |
| 8246 | default: |
| 8247 | if (loweredCase) return utf8ToBytes(string).length // assume utf8 |
| 8248 | encoding = ('' + encoding).toLowerCase() |
| 8249 | loweredCase = true |
| 8250 | } |
| 8251 | } |
| 8252 | } |
| 8253 | Buffer.byteLength = byteLength |
| 8254 | |
| 8255 | // pre-set for values that may exist in the future |
| 8256 | Buffer.prototype.length = undefined |
| 8257 | Buffer.prototype.parent = undefined |
| 8258 | |
| 8259 | function slowToString (encoding, start, end) { |
| 8260 | var loweredCase = false |
| 8261 | |
| 8262 | start = start | 0 |
| 8263 | end = end === undefined || end === Infinity ? this.length : end | 0 |
| 8264 | |
| 8265 | if (!encoding) encoding = 'utf8' |
| 8266 | if (start < 0) start = 0 |
| 8267 | if (end > this.length) end = this.length |
| 8268 | if (end <= start) return '' |
| 8269 | |
| 8270 | while (true) { |
| 8271 | switch (encoding) { |
| 8272 | case 'hex': |
| 8273 | return hexSlice(this, start, end) |
| 8274 | |
| 8275 | case 'utf8': |
| 8276 | case 'utf-8': |
| 8277 | return utf8Slice(this, start, end) |
| 8278 | |
| 8279 | case 'ascii': |
| 8280 | return asciiSlice(this, start, end) |
| 8281 | |
| 8282 | case 'binary': |
| 8283 | return binarySlice(this, start, end) |
| 8284 | |
| 8285 | case 'base64': |
| 8286 | return base64Slice(this, start, end) |
| 8287 | |
| 8288 | case 'ucs2': |
| 8289 | case 'ucs-2': |
| 8290 | case 'utf16le': |
| 8291 | case 'utf-16le': |
| 8292 | return utf16leSlice(this, start, end) |
| 8293 | |
| 8294 | default: |
| 8295 | if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) |
| 8296 | encoding = (encoding + '').toLowerCase() |
| 8297 | loweredCase = true |
| 8298 | } |
| 8299 | } |
| 8300 | } |
| 8301 | |
| 8302 | Buffer.prototype.toString = function toString () { |
| 8303 | var length = this.length | 0 |
| 8304 | if (length === 0) return '' |
| 8305 | if (arguments.length === 0) return utf8Slice(this, 0, length) |
| 8306 | return slowToString.apply(this, arguments) |
| 8307 | } |
| 8308 | |
| 8309 | Buffer.prototype.equals = function equals (b) { |
| 8310 | if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') |
| 8311 | if (this === b) return true |
| 8312 | return Buffer.compare(this, b) === 0 |
| 8313 | } |
| 8314 | |
| 8315 | Buffer.prototype.inspect = function inspect () { |
| 8316 | var str = '' |
| 8317 | var max = exports.INSPECT_MAX_BYTES |
| 8318 | if (this.length > 0) { |
| 8319 | str = this.toString('hex', 0, max).match(/.{2}/g).join(' ') |
| 8320 | if (this.length > max) str += ' ... ' |
| 8321 | } |
| 8322 | return '<Buffer ' + str + '>' |
| 8323 | } |
| 8324 | |
| 8325 | Buffer.prototype.compare = function compare (b) { |
| 8326 | if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') |
| 8327 | if (this === b) return 0 |
| 8328 | return Buffer.compare(this, b) |
| 8329 | } |
| 8330 | |
| 8331 | Buffer.prototype.indexOf = function indexOf (val, byteOffset) { |
| 8332 | if (byteOffset > 0x7fffffff) byteOffset = 0x7fffffff |
| 8333 | else if (byteOffset < -0x80000000) byteOffset = -0x80000000 |
| 8334 | byteOffset >>= 0 |
| 8335 | |
| 8336 | if (this.length === 0) return -1 |
| 8337 | if (byteOffset >= this.length) return -1 |
| 8338 | |
| 8339 | // Negative offsets start from the end of the buffer |
| 8340 | if (byteOffset < 0) byteOffset = Math.max(this.length + byteOffset, 0) |
| 8341 | |
| 8342 | if (typeof val === 'string') { |
| 8343 | if (val.length === 0) return -1 // special case: looking for empty string always fails |
| 8344 | return String.prototype.indexOf.call(this, val, byteOffset) |
| 8345 | } |
| 8346 | if (Buffer.isBuffer(val)) { |
| 8347 | return arrayIndexOf(this, val, byteOffset) |
| 8348 | } |
| 8349 | if (typeof val === 'number') { |
| 8350 | if (Buffer.TYPED_ARRAY_SUPPORT && Uint8Array.prototype.indexOf === 'function') { |
| 8351 | return Uint8Array.prototype.indexOf.call(this, val, byteOffset) |
| 8352 | } |
| 8353 | return arrayIndexOf(this, [ val ], byteOffset) |
| 8354 | } |
| 8355 | |
| 8356 | function arrayIndexOf (arr, val, byteOffset) { |
| 8357 | var foundIndex = -1 |
| 8358 | for (var i = 0; byteOffset + i < arr.length; i++) { |
| 8359 | if (arr[byteOffset + i] === val[foundIndex === -1 ? 0 : i - foundIndex]) { |
| 8360 | if (foundIndex === -1) foundIndex = i |
| 8361 | if (i - foundIndex + 1 === val.length) return byteOffset + foundIndex |
| 8362 | } else { |
| 8363 | foundIndex = -1 |
| 8364 | } |
| 8365 | } |
| 8366 | return -1 |
| 8367 | } |
| 8368 | |
| 8369 | throw new TypeError('val must be string, number or Buffer') |
| 8370 | } |
| 8371 | |
| 8372 | // `get` is deprecated |
| 8373 | Buffer.prototype.get = function get (offset) { |
| 8374 | console.log('.get() is deprecated. Access using array indexes instead.') |
| 8375 | return this.readUInt8(offset) |
| 8376 | } |
| 8377 | |
| 8378 | // `set` is deprecated |
| 8379 | Buffer.prototype.set = function set (v, offset) { |
| 8380 | console.log('.set() is deprecated. Access using array indexes instead.') |
| 8381 | return this.writeUInt8(v, offset) |
| 8382 | } |
| 8383 | |
| 8384 | function hexWrite (buf, string, offset, length) { |
| 8385 | offset = Number(offset) || 0 |
| 8386 | var remaining = buf.length - offset |
| 8387 | if (!length) { |
| 8388 | length = remaining |
| 8389 | } else { |
| 8390 | length = Number(length) |
| 8391 | if (length > remaining) { |
| 8392 | length = remaining |
| 8393 | } |
| 8394 | } |
| 8395 | |
| 8396 | // must be an even number of digits |
| 8397 | var strLen = string.length |
| 8398 | if (strLen % 2 !== 0) throw new Error('Invalid hex string') |
| 8399 | |
| 8400 | if (length > strLen / 2) { |
| 8401 | length = strLen / 2 |
| 8402 | } |
| 8403 | for (var i = 0; i < length; i++) { |
| 8404 | var parsed = parseInt(string.substr(i * 2, 2), 16) |
| 8405 | if (isNaN(parsed)) throw new Error('Invalid hex string') |
| 8406 | buf[offset + i] = parsed |
| 8407 | } |
| 8408 | return i |
| 8409 | } |
| 8410 | |
| 8411 | function utf8Write (buf, string, offset, length) { |
| 8412 | return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) |
| 8413 | } |
| 8414 | |
| 8415 | function asciiWrite (buf, string, offset, length) { |
| 8416 | return blitBuffer(asciiToBytes(string), buf, offset, length) |
| 8417 | } |
| 8418 | |
| 8419 | function binaryWrite (buf, string, offset, length) { |
| 8420 | return asciiWrite(buf, string, offset, length) |
| 8421 | } |
| 8422 | |
| 8423 | function base64Write (buf, string, offset, length) { |
| 8424 | return blitBuffer(base64ToBytes(string), buf, offset, length) |
| 8425 | } |
| 8426 | |
| 8427 | function ucs2Write (buf, string, offset, length) { |
| 8428 | return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) |
| 8429 | } |
| 8430 | |
| 8431 | Buffer.prototype.write = function write (string, offset, length, encoding) { |
| 8432 | // Buffer#write(string) |
| 8433 | if (offset === undefined) { |
| 8434 | encoding = 'utf8' |
| 8435 | length = this.length |
| 8436 | offset = 0 |
| 8437 | // Buffer#write(string, encoding) |
| 8438 | } else if (length === undefined && typeof offset === 'string') { |
| 8439 | encoding = offset |
| 8440 | length = this.length |
| 8441 | offset = 0 |
| 8442 | // Buffer#write(string, offset[, length][, encoding]) |
| 8443 | } else if (isFinite(offset)) { |
| 8444 | offset = offset | 0 |
| 8445 | if (isFinite(length)) { |
| 8446 | length = length | 0 |
| 8447 | if (encoding === undefined) encoding = 'utf8' |
| 8448 | } else { |
| 8449 | encoding = length |
| 8450 | length = undefined |
| 8451 | } |
| 8452 | // legacy write(string, encoding, offset, length) - remove in v0.13 |
| 8453 | } else { |
| 8454 | var swap = encoding |
| 8455 | encoding = offset |
| 8456 | offset = length | 0 |
| 8457 | length = swap |
| 8458 | } |
| 8459 | |
| 8460 | var remaining = this.length - offset |
| 8461 | if (length === undefined || length > remaining) length = remaining |
| 8462 | |
| 8463 | if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { |
| 8464 | throw new RangeError('attempt to write outside buffer bounds') |
| 8465 | } |
| 8466 | |
| 8467 | if (!encoding) encoding = 'utf8' |
| 8468 | |
| 8469 | var loweredCase = false |
| 8470 | for (;;) { |
| 8471 | switch (encoding) { |
| 8472 | case 'hex': |
| 8473 | return hexWrite(this, string, offset, length) |
| 8474 | |
| 8475 | case 'utf8': |
| 8476 | case 'utf-8': |
| 8477 | return utf8Write(this, string, offset, length) |
| 8478 | |
| 8479 | case 'ascii': |
| 8480 | return asciiWrite(this, string, offset, length) |
| 8481 | |
| 8482 | case 'binary': |
| 8483 | return binaryWrite(this, string, offset, length) |
| 8484 | |
| 8485 | case 'base64': |
| 8486 | // Warning: maxLength not taken into account in base64Write |
| 8487 | return base64Write(this, string, offset, length) |
| 8488 | |
| 8489 | case 'ucs2': |
| 8490 | case 'ucs-2': |
| 8491 | case 'utf16le': |
| 8492 | case 'utf-16le': |
| 8493 | return ucs2Write(this, string, offset, length) |
| 8494 | |
| 8495 | default: |
| 8496 | if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) |
| 8497 | encoding = ('' + encoding).toLowerCase() |
| 8498 | loweredCase = true |
| 8499 | } |
| 8500 | } |
| 8501 | } |
| 8502 | |
| 8503 | Buffer.prototype.toJSON = function toJSON () { |
| 8504 | return { |
| 8505 | type: 'Buffer', |
| 8506 | data: Array.prototype.slice.call(this._arr || this, 0) |
| 8507 | } |
| 8508 | } |
| 8509 | |
| 8510 | function base64Slice (buf, start, end) { |
| 8511 | if (start === 0 && end === buf.length) { |
| 8512 | return base64.fromByteArray(buf) |
| 8513 | } else { |
| 8514 | return base64.fromByteArray(buf.slice(start, end)) |
| 8515 | } |
| 8516 | } |
| 8517 | |
| 8518 | function utf8Slice (buf, start, end) { |
| 8519 | end = Math.min(buf.length, end) |
| 8520 | var res = [] |
| 8521 | |
| 8522 | var i = start |
| 8523 | while (i < end) { |
| 8524 | var firstByte = buf[i] |
| 8525 | var codePoint = null |
| 8526 | var bytesPerSequence = (firstByte > 0xEF) ? 4 |
| 8527 | : (firstByte > 0xDF) ? 3 |
| 8528 | : (firstByte > 0xBF) ? 2 |
| 8529 | : 1 |
| 8530 | |
| 8531 | if (i + bytesPerSequence <= end) { |
| 8532 | var secondByte, thirdByte, fourthByte, tempCodePoint |
| 8533 | |
| 8534 | switch (bytesPerSequence) { |
| 8535 | case 1: |
| 8536 | if (firstByte < 0x80) { |
| 8537 | codePoint = firstByte |
| 8538 | } |
| 8539 | break |
| 8540 | case 2: |
| 8541 | secondByte = buf[i + 1] |
| 8542 | if ((secondByte & 0xC0) === 0x80) { |
| 8543 | tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) |
| 8544 | if (tempCodePoint > 0x7F) { |
| 8545 | codePoint = tempCodePoint |
| 8546 | } |
| 8547 | } |
| 8548 | break |
| 8549 | case 3: |
| 8550 | secondByte = buf[i + 1] |
| 8551 | thirdByte = buf[i + 2] |
| 8552 | if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { |
| 8553 | tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) |
| 8554 | if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { |
| 8555 | codePoint = tempCodePoint |
| 8556 | } |
| 8557 | } |
| 8558 | break |
| 8559 | case 4: |
| 8560 | secondByte = buf[i + 1] |
| 8561 | thirdByte = buf[i + 2] |
| 8562 | fourthByte = buf[i + 3] |
| 8563 | if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { |
| 8564 | tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) |
| 8565 | if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { |
| 8566 | codePoint = tempCodePoint |
| 8567 | } |
| 8568 | } |
| 8569 | } |
| 8570 | } |
| 8571 | |
| 8572 | if (codePoint === null) { |
| 8573 | // we did not generate a valid codePoint so insert a |
| 8574 | // replacement char (U+FFFD) and advance only 1 byte |
| 8575 | codePoint = 0xFFFD |
| 8576 | bytesPerSequence = 1 |
| 8577 | } else if (codePoint > 0xFFFF) { |
| 8578 | // encode to utf16 (surrogate pair dance) |
| 8579 | codePoint -= 0x10000 |
| 8580 | res.push(codePoint >>> 10 & 0x3FF | 0xD800) |
| 8581 | codePoint = 0xDC00 | codePoint & 0x3FF |
| 8582 | } |
| 8583 | |
| 8584 | res.push(codePoint) |
| 8585 | i += bytesPerSequence |
| 8586 | } |
| 8587 | |
| 8588 | return decodeCodePointsArray(res) |
| 8589 | } |
| 8590 | |
| 8591 | // Based on http://stackoverflow.com/a/22747272/680742, the browser with |
| 8592 | // the lowest limit is Chrome, with 0x10000 args. |
| 8593 | // We go 1 magnitude less, for safety |
| 8594 | var MAX_ARGUMENTS_LENGTH = 0x1000 |
| 8595 | |
| 8596 | function decodeCodePointsArray (codePoints) { |
| 8597 | var len = codePoints.length |
| 8598 | if (len <= MAX_ARGUMENTS_LENGTH) { |
| 8599 | return String.fromCharCode.apply(String, codePoints) // avoid extra slice() |
| 8600 | } |
| 8601 | |
| 8602 | // Decode in chunks to avoid "call stack size exceeded". |
| 8603 | var res = '' |
| 8604 | var i = 0 |
| 8605 | while (i < len) { |
| 8606 | res += String.fromCharCode.apply( |
| 8607 | String, |
| 8608 | codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) |
| 8609 | ) |
| 8610 | } |
| 8611 | return res |
| 8612 | } |
| 8613 | |
| 8614 | function asciiSlice (buf, start, end) { |
| 8615 | var ret = '' |
| 8616 | end = Math.min(buf.length, end) |
| 8617 | |
| 8618 | for (var i = start; i < end; i++) { |
| 8619 | ret += String.fromCharCode(buf[i] & 0x7F) |
| 8620 | } |
| 8621 | return ret |
| 8622 | } |
| 8623 | |
| 8624 | function binarySlice (buf, start, end) { |
| 8625 | var ret = '' |
| 8626 | end = Math.min(buf.length, end) |
| 8627 | |
| 8628 | for (var i = start; i < end; i++) { |
| 8629 | ret += String.fromCharCode(buf[i]) |
| 8630 | } |
| 8631 | return ret |
| 8632 | } |
| 8633 | |
| 8634 | function hexSlice (buf, start, end) { |
| 8635 | var len = buf.length |
| 8636 | |
| 8637 | if (!start || start < 0) start = 0 |
| 8638 | if (!end || end < 0 || end > len) end = len |
| 8639 | |
| 8640 | var out = '' |
| 8641 | for (var i = start; i < end; i++) { |
| 8642 | out += toHex(buf[i]) |
| 8643 | } |
| 8644 | return out |
| 8645 | } |
| 8646 | |
| 8647 | function utf16leSlice (buf, start, end) { |
| 8648 | var bytes = buf.slice(start, end) |
| 8649 | var res = '' |
| 8650 | for (var i = 0; i < bytes.length; i += 2) { |
| 8651 | res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256) |
| 8652 | } |
| 8653 | return res |
| 8654 | } |
| 8655 | |
| 8656 | Buffer.prototype.slice = function slice (start, end) { |
| 8657 | var len = this.length |
| 8658 | start = ~~start |
| 8659 | end = end === undefined ? len : ~~end |
| 8660 | |
| 8661 | if (start < 0) { |
| 8662 | start += len |
| 8663 | if (start < 0) start = 0 |
| 8664 | } else if (start > len) { |
| 8665 | start = len |
| 8666 | } |
| 8667 | |
| 8668 | if (end < 0) { |
| 8669 | end += len |
| 8670 | if (end < 0) end = 0 |
| 8671 | } else if (end > len) { |
| 8672 | end = len |
| 8673 | } |
| 8674 | |
| 8675 | if (end < start) end = start |
| 8676 | |
| 8677 | var newBuf |
| 8678 | if (Buffer.TYPED_ARRAY_SUPPORT) { |
| 8679 | newBuf = Buffer._augment(this.subarray(start, end)) |
| 8680 | } else { |
| 8681 | var sliceLen = end - start |
| 8682 | newBuf = new Buffer(sliceLen, undefined) |
| 8683 | for (var i = 0; i < sliceLen; i++) { |
| 8684 | newBuf[i] = this[i + start] |
| 8685 | } |
| 8686 | } |
| 8687 | |
| 8688 | if (newBuf.length) newBuf.parent = this.parent || this |
| 8689 | |
| 8690 | return newBuf |
| 8691 | } |
| 8692 | |
| 8693 | /* |
| 8694 | * Need to make sure that buffer isn't trying to write out of bounds. |
| 8695 | */ |
| 8696 | function checkOffset (offset, ext, length) { |
| 8697 | if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') |
| 8698 | if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') |
| 8699 | } |
| 8700 | |
| 8701 | Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { |
| 8702 | offset = offset | 0 |
| 8703 | byteLength = byteLength | 0 |
| 8704 | if (!noAssert) checkOffset(offset, byteLength, this.length) |
| 8705 | |
| 8706 | var val = this[offset] |
| 8707 | var mul = 1 |
| 8708 | var i = 0 |
| 8709 | while (++i < byteLength && (mul *= 0x100)) { |
| 8710 | val += this[offset + i] * mul |
| 8711 | } |
| 8712 | |
| 8713 | return val |
| 8714 | } |
| 8715 | |
| 8716 | Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { |
| 8717 | offset = offset | 0 |
| 8718 | byteLength = byteLength | 0 |
| 8719 | if (!noAssert) { |
| 8720 | checkOffset(offset, byteLength, this.length) |
| 8721 | } |
| 8722 | |
| 8723 | var val = this[offset + --byteLength] |
| 8724 | var mul = 1 |
| 8725 | while (byteLength > 0 && (mul *= 0x100)) { |
| 8726 | val += this[offset + --byteLength] * mul |
| 8727 | } |
| 8728 | |
| 8729 | return val |
| 8730 | } |
| 8731 | |
| 8732 | Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { |
| 8733 | if (!noAssert) checkOffset(offset, 1, this.length) |
| 8734 | return this[offset] |
| 8735 | } |
| 8736 | |
| 8737 | Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { |
| 8738 | if (!noAssert) checkOffset(offset, 2, this.length) |
| 8739 | return this[offset] | (this[offset + 1] << 8) |
| 8740 | } |
| 8741 | |
| 8742 | Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { |
| 8743 | if (!noAssert) checkOffset(offset, 2, this.length) |
| 8744 | return (this[offset] << 8) | this[offset + 1] |
| 8745 | } |
| 8746 | |
| 8747 | Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { |
| 8748 | if (!noAssert) checkOffset(offset, 4, this.length) |
| 8749 | |
| 8750 | return ((this[offset]) | |
| 8751 | (this[offset + 1] << 8) | |
| 8752 | (this[offset + 2] << 16)) + |
| 8753 | (this[offset + 3] * 0x1000000) |
| 8754 | } |
| 8755 | |
| 8756 | Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { |
| 8757 | if (!noAssert) checkOffset(offset, 4, this.length) |
| 8758 | |
| 8759 | return (this[offset] * 0x1000000) + |
| 8760 | ((this[offset + 1] << 16) | |
| 8761 | (this[offset + 2] << 8) | |
| 8762 | this[offset + 3]) |
| 8763 | } |
| 8764 | |
| 8765 | Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { |
| 8766 | offset = offset | 0 |
| 8767 | byteLength = byteLength | 0 |
| 8768 | if (!noAssert) checkOffset(offset, byteLength, this.length) |
| 8769 | |
| 8770 | var val = this[offset] |
| 8771 | var mul = 1 |
| 8772 | var i = 0 |
| 8773 | while (++i < byteLength && (mul *= 0x100)) { |
| 8774 | val += this[offset + i] * mul |
| 8775 | } |
| 8776 | mul *= 0x80 |
| 8777 | |
| 8778 | if (val >= mul) val -= Math.pow(2, 8 * byteLength) |
| 8779 | |
| 8780 | return val |
| 8781 | } |
| 8782 | |
| 8783 | Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { |
| 8784 | offset = offset | 0 |
| 8785 | byteLength = byteLength | 0 |
| 8786 | if (!noAssert) checkOffset(offset, byteLength, this.length) |
| 8787 | |
| 8788 | var i = byteLength |
| 8789 | var mul = 1 |
| 8790 | var val = this[offset + --i] |
| 8791 | while (i > 0 && (mul *= 0x100)) { |
| 8792 | val += this[offset + --i] * mul |
| 8793 | } |
| 8794 | mul *= 0x80 |
| 8795 | |
| 8796 | if (val >= mul) val -= Math.pow(2, 8 * byteLength) |
| 8797 | |
| 8798 | return val |
| 8799 | } |
| 8800 | |
| 8801 | Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { |
| 8802 | if (!noAssert) checkOffset(offset, 1, this.length) |
| 8803 | if (!(this[offset] & 0x80)) return (this[offset]) |
| 8804 | return ((0xff - this[offset] + 1) * -1) |
| 8805 | } |
| 8806 | |
| 8807 | Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { |
| 8808 | if (!noAssert) checkOffset(offset, 2, this.length) |
| 8809 | var val = this[offset] | (this[offset + 1] << 8) |
| 8810 | return (val & 0x8000) ? val | 0xFFFF0000 : val |
| 8811 | } |
| 8812 | |
| 8813 | Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { |
| 8814 | if (!noAssert) checkOffset(offset, 2, this.length) |
| 8815 | var val = this[offset + 1] | (this[offset] << 8) |
| 8816 | return (val & 0x8000) ? val | 0xFFFF0000 : val |
| 8817 | } |
| 8818 | |
| 8819 | Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { |
| 8820 | if (!noAssert) checkOffset(offset, 4, this.length) |
| 8821 | |
| 8822 | return (this[offset]) | |
| 8823 | (this[offset + 1] << 8) | |
| 8824 | (this[offset + 2] << 16) | |
| 8825 | (this[offset + 3] << 24) |
| 8826 | } |
| 8827 | |
| 8828 | Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { |
| 8829 | if (!noAssert) checkOffset(offset, 4, this.length) |
| 8830 | |
| 8831 | return (this[offset] << 24) | |
| 8832 | (this[offset + 1] << 16) | |
| 8833 | (this[offset + 2] << 8) | |
| 8834 | (this[offset + 3]) |
| 8835 | } |
| 8836 | |
| 8837 | Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { |
| 8838 | if (!noAssert) checkOffset(offset, 4, this.length) |
| 8839 | return ieee754.read(this, offset, true, 23, 4) |
| 8840 | } |
| 8841 | |
| 8842 | Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { |
| 8843 | if (!noAssert) checkOffset(offset, 4, this.length) |
| 8844 | return ieee754.read(this, offset, false, 23, 4) |
| 8845 | } |
| 8846 | |
| 8847 | Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { |
| 8848 | if (!noAssert) checkOffset(offset, 8, this.length) |
| 8849 | return ieee754.read(this, offset, true, 52, 8) |
| 8850 | } |
| 8851 | |
| 8852 | Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { |
| 8853 | if (!noAssert) checkOffset(offset, 8, this.length) |
| 8854 | return ieee754.read(this, offset, false, 52, 8) |
| 8855 | } |
| 8856 | |
| 8857 | function checkInt (buf, value, offset, ext, max, min) { |
| 8858 | if (!Buffer.isBuffer(buf)) throw new TypeError('buffer must be a Buffer instance') |
| 8859 | if (value > max || value < min) throw new RangeError('value is out of bounds') |
| 8860 | if (offset + ext > buf.length) throw new RangeError('index out of range') |
| 8861 | } |
| 8862 | |
| 8863 | Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { |
| 8864 | value = +value |
| 8865 | offset = offset | 0 |
| 8866 | byteLength = byteLength | 0 |
| 8867 | if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0) |
| 8868 | |
| 8869 | var mul = 1 |
| 8870 | var i = 0 |
| 8871 | this[offset] = value & 0xFF |
| 8872 | while (++i < byteLength && (mul *= 0x100)) { |
| 8873 | this[offset + i] = (value / mul) & 0xFF |
| 8874 | } |
| 8875 | |
| 8876 | return offset + byteLength |
| 8877 | } |
| 8878 | |
| 8879 | Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { |
| 8880 | value = +value |
| 8881 | offset = offset | 0 |
| 8882 | byteLength = byteLength | 0 |
| 8883 | if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0) |
| 8884 | |
| 8885 | var i = byteLength - 1 |
| 8886 | var mul = 1 |
| 8887 | this[offset + i] = value & 0xFF |
| 8888 | while (--i >= 0 && (mul *= 0x100)) { |
| 8889 | this[offset + i] = (value / mul) & 0xFF |
| 8890 | } |
| 8891 | |
| 8892 | return offset + byteLength |
| 8893 | } |
| 8894 | |
| 8895 | Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { |
| 8896 | value = +value |
| 8897 | offset = offset | 0 |
| 8898 | if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) |
| 8899 | if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) |
| 8900 | this[offset] = value |
| 8901 | return offset + 1 |
| 8902 | } |
| 8903 | |
| 8904 | function objectWriteUInt16 (buf, value, offset, littleEndian) { |
| 8905 | if (value < 0) value = 0xffff + value + 1 |
| 8906 | for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; i++) { |
| 8907 | buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>> |
| 8908 | (littleEndian ? i : 1 - i) * 8 |
| 8909 | } |
| 8910 | } |
| 8911 | |
| 8912 | Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { |
| 8913 | value = +value |
| 8914 | offset = offset | 0 |
| 8915 | if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) |
| 8916 | if (Buffer.TYPED_ARRAY_SUPPORT) { |
| 8917 | this[offset] = value |
| 8918 | this[offset + 1] = (value >>> 8) |
| 8919 | } else { |
| 8920 | objectWriteUInt16(this, value, offset, true) |
| 8921 | } |
| 8922 | return offset + 2 |
| 8923 | } |
| 8924 | |
| 8925 | Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { |
| 8926 | value = +value |
| 8927 | offset = offset | 0 |
| 8928 | if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) |
| 8929 | if (Buffer.TYPED_ARRAY_SUPPORT) { |
| 8930 | this[offset] = (value >>> 8) |
| 8931 | this[offset + 1] = value |
| 8932 | } else { |
| 8933 | objectWriteUInt16(this, value, offset, false) |
| 8934 | } |
| 8935 | return offset + 2 |
| 8936 | } |
| 8937 | |
| 8938 | function objectWriteUInt32 (buf, value, offset, littleEndian) { |
| 8939 | if (value < 0) value = 0xffffffff + value + 1 |
| 8940 | for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; i++) { |
| 8941 | buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff |
| 8942 | } |
| 8943 | } |
| 8944 | |
| 8945 | Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { |
| 8946 | value = +value |
| 8947 | offset = offset | 0 |
| 8948 | if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) |
| 8949 | if (Buffer.TYPED_ARRAY_SUPPORT) { |
| 8950 | this[offset + 3] = (value >>> 24) |
| 8951 | this[offset + 2] = (value >>> 16) |
| 8952 | this[offset + 1] = (value >>> 8) |
| 8953 | this[offset] = value |
| 8954 | } else { |
| 8955 | objectWriteUInt32(this, value, offset, true) |
| 8956 | } |
| 8957 | return offset + 4 |
| 8958 | } |
| 8959 | |
| 8960 | Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { |
| 8961 | value = +value |
| 8962 | offset = offset | 0 |
| 8963 | if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) |
| 8964 | if (Buffer.TYPED_ARRAY_SUPPORT) { |
| 8965 | this[offset] = (value >>> 24) |
| 8966 | this[offset + 1] = (value >>> 16) |
| 8967 | this[offset + 2] = (value >>> 8) |
| 8968 | this[offset + 3] = value |
| 8969 | } else { |
| 8970 | objectWriteUInt32(this, value, offset, false) |
| 8971 | } |
| 8972 | return offset + 4 |
| 8973 | } |
| 8974 | |
| 8975 | Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { |
| 8976 | value = +value |
| 8977 | offset = offset | 0 |
| 8978 | if (!noAssert) { |
| 8979 | var limit = Math.pow(2, 8 * byteLength - 1) |
| 8980 | |
| 8981 | checkInt(this, value, offset, byteLength, limit - 1, -limit) |
| 8982 | } |
| 8983 | |
| 8984 | var i = 0 |
| 8985 | var mul = 1 |
| 8986 | var sub = value < 0 ? 1 : 0 |
| 8987 | this[offset] = value & 0xFF |
| 8988 | while (++i < byteLength && (mul *= 0x100)) { |
| 8989 | this[offset + i] = ((value / mul) >> 0) - sub & 0xFF |
| 8990 | } |
| 8991 | |
| 8992 | return offset + byteLength |
| 8993 | } |
| 8994 | |
| 8995 | Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { |
| 8996 | value = +value |
| 8997 | offset = offset | 0 |
| 8998 | if (!noAssert) { |
| 8999 | var limit = Math.pow(2, 8 * byteLength - 1) |
| 9000 | |
| 9001 | checkInt(this, value, offset, byteLength, limit - 1, -limit) |
| 9002 | } |
| 9003 | |
| 9004 | var i = byteLength - 1 |
| 9005 | var mul = 1 |
| 9006 | var sub = value < 0 ? 1 : 0 |
| 9007 | this[offset + i] = value & 0xFF |
| 9008 | while (--i >= 0 && (mul *= 0x100)) { |
| 9009 | this[offset + i] = ((value / mul) >> 0) - sub & 0xFF |
| 9010 | } |
| 9011 | |
| 9012 | return offset + byteLength |
| 9013 | } |
| 9014 | |
| 9015 | Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { |
| 9016 | value = +value |
| 9017 | offset = offset | 0 |
| 9018 | if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) |
| 9019 | if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) |
| 9020 | if (value < 0) value = 0xff + value + 1 |
| 9021 | this[offset] = value |
| 9022 | return offset + 1 |
| 9023 | } |
| 9024 | |
| 9025 | Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { |
| 9026 | value = +value |
| 9027 | offset = offset | 0 |
| 9028 | if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) |
| 9029 | if (Buffer.TYPED_ARRAY_SUPPORT) { |
| 9030 | this[offset] = value |
| 9031 | this[offset + 1] = (value >>> 8) |
| 9032 | } else { |
| 9033 | objectWriteUInt16(this, value, offset, true) |
| 9034 | } |
| 9035 | return offset + 2 |
| 9036 | } |
| 9037 | |
| 9038 | Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { |
| 9039 | value = +value |
| 9040 | offset = offset | 0 |
| 9041 | if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) |
| 9042 | if (Buffer.TYPED_ARRAY_SUPPORT) { |
| 9043 | this[offset] = (value >>> 8) |
| 9044 | this[offset + 1] = value |
| 9045 | } else { |
| 9046 | objectWriteUInt16(this, value, offset, false) |
| 9047 | } |
| 9048 | return offset + 2 |
| 9049 | } |
| 9050 | |
| 9051 | Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { |
| 9052 | value = +value |
| 9053 | offset = offset | 0 |
| 9054 | if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) |
| 9055 | if (Buffer.TYPED_ARRAY_SUPPORT) { |
| 9056 | this[offset] = value |
| 9057 | this[offset + 1] = (value >>> 8) |
| 9058 | this[offset + 2] = (value >>> 16) |
| 9059 | this[offset + 3] = (value >>> 24) |
| 9060 | } else { |
| 9061 | objectWriteUInt32(this, value, offset, true) |
| 9062 | } |
| 9063 | return offset + 4 |
| 9064 | } |
| 9065 | |
| 9066 | Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { |
| 9067 | value = +value |
| 9068 | offset = offset | 0 |
| 9069 | if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) |
| 9070 | if (value < 0) value = 0xffffffff + value + 1 |
| 9071 | if (Buffer.TYPED_ARRAY_SUPPORT) { |
| 9072 | this[offset] = (value >>> 24) |
| 9073 | this[offset + 1] = (value >>> 16) |
| 9074 | this[offset + 2] = (value >>> 8) |
| 9075 | this[offset + 3] = value |
| 9076 | } else { |
| 9077 | objectWriteUInt32(this, value, offset, false) |
| 9078 | } |
| 9079 | return offset + 4 |
| 9080 | } |
| 9081 | |
| 9082 | function checkIEEE754 (buf, value, offset, ext, max, min) { |
| 9083 | if (value > max || value < min) throw new RangeError('value is out of bounds') |
| 9084 | if (offset + ext > buf.length) throw new RangeError('index out of range') |
| 9085 | if (offset < 0) throw new RangeError('index out of range') |
| 9086 | } |
| 9087 | |
| 9088 | function writeFloat (buf, value, offset, littleEndian, noAssert) { |
| 9089 | if (!noAssert) { |
| 9090 | checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) |
| 9091 | } |
| 9092 | ieee754.write(buf, value, offset, littleEndian, 23, 4) |
| 9093 | return offset + 4 |
| 9094 | } |
| 9095 | |
| 9096 | Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { |
| 9097 | return writeFloat(this, value, offset, true, noAssert) |
| 9098 | } |
| 9099 | |
| 9100 | Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { |
| 9101 | return writeFloat(this, value, offset, false, noAssert) |
| 9102 | } |
| 9103 | |
| 9104 | function writeDouble (buf, value, offset, littleEndian, noAssert) { |
| 9105 | if (!noAssert) { |
| 9106 | checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) |
| 9107 | } |
| 9108 | ieee754.write(buf, value, offset, littleEndian, 52, 8) |
| 9109 | return offset + 8 |
| 9110 | } |
| 9111 | |
| 9112 | Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { |
| 9113 | return writeDouble(this, value, offset, true, noAssert) |
| 9114 | } |
| 9115 | |
| 9116 | Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { |
| 9117 | return writeDouble(this, value, offset, false, noAssert) |
| 9118 | } |
| 9119 | |
| 9120 | // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) |
| 9121 | Buffer.prototype.copy = function copy (target, targetStart, start, end) { |
| 9122 | if (!start) start = 0 |
| 9123 | if (!end && end !== 0) end = this.length |
| 9124 | if (targetStart >= target.length) targetStart = target.length |
| 9125 | if (!targetStart) targetStart = 0 |
| 9126 | if (end > 0 && end < start) end = start |
| 9127 | |
| 9128 | // Copy 0 bytes; we're done |
| 9129 | if (end === start) return 0 |
| 9130 | if (target.length === 0 || this.length === 0) return 0 |
| 9131 | |
| 9132 | // Fatal error conditions |
| 9133 | if (targetStart < 0) { |
| 9134 | throw new RangeError('targetStart out of bounds') |
| 9135 | } |
| 9136 | if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds') |
| 9137 | if (end < 0) throw new RangeError('sourceEnd out of bounds') |
| 9138 | |
| 9139 | // Are we oob? |
| 9140 | if (end > this.length) end = this.length |
| 9141 | if (target.length - targetStart < end - start) { |
| 9142 | end = target.length - targetStart + start |
| 9143 | } |
| 9144 | |
| 9145 | var len = end - start |
| 9146 | var i |
| 9147 | |
| 9148 | if (this === target && start < targetStart && targetStart < end) { |
| 9149 | // descending copy from end |
| 9150 | for (i = len - 1; i >= 0; i--) { |
| 9151 | target[i + targetStart] = this[i + start] |
| 9152 | } |
| 9153 | } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) { |
| 9154 | // ascending copy from start |
| 9155 | for (i = 0; i < len; i++) { |
| 9156 | target[i + targetStart] = this[i + start] |
| 9157 | } |
| 9158 | } else { |
| 9159 | target._set(this.subarray(start, start + len), targetStart) |
| 9160 | } |
| 9161 | |
| 9162 | return len |
| 9163 | } |
| 9164 | |
| 9165 | // fill(value, start=0, end=buffer.length) |
| 9166 | Buffer.prototype.fill = function fill (value, start, end) { |
| 9167 | if (!value) value = 0 |
| 9168 | if (!start) start = 0 |
| 9169 | if (!end) end = this.length |
| 9170 | |
| 9171 | if (end < start) throw new RangeError('end < start') |
| 9172 | |
| 9173 | // Fill 0 bytes; we're done |
| 9174 | if (end === start) return |
| 9175 | if (this.length === 0) return |
| 9176 | |
| 9177 | if (start < 0 || start >= this.length) throw new RangeError('start out of bounds') |
| 9178 | if (end < 0 || end > this.length) throw new RangeError('end out of bounds') |
| 9179 | |
| 9180 | var i |
| 9181 | if (typeof value === 'number') { |
| 9182 | for (i = start; i < end; i++) { |
| 9183 | this[i] = value |
| 9184 | } |
| 9185 | } else { |
| 9186 | var bytes = utf8ToBytes(value.toString()) |
| 9187 | var len = bytes.length |
| 9188 | for (i = start; i < end; i++) { |
| 9189 | this[i] = bytes[i % len] |
| 9190 | } |
| 9191 | } |
| 9192 | |
| 9193 | return this |
| 9194 | } |
| 9195 | |
| 9196 | /** |
| 9197 | * Creates a new `ArrayBuffer` with the *copied* memory of the buffer instance. |
| 9198 | * Added in Node 0.12. Only available in browsers that support ArrayBuffer. |
| 9199 | */ |
| 9200 | Buffer.prototype.toArrayBuffer = function toArrayBuffer () { |
| 9201 | if (typeof Uint8Array !== 'undefined') { |
| 9202 | if (Buffer.TYPED_ARRAY_SUPPORT) { |
| 9203 | return (new Buffer(this)).buffer |
| 9204 | } else { |
| 9205 | var buf = new Uint8Array(this.length) |
| 9206 | for (var i = 0, len = buf.length; i < len; i += 1) { |
| 9207 | buf[i] = this[i] |
| 9208 | } |
| 9209 | return buf.buffer |
| 9210 | } |
| 9211 | } else { |
| 9212 | throw new TypeError('Buffer.toArrayBuffer not supported in this browser') |
| 9213 | } |
| 9214 | } |
| 9215 | |
| 9216 | // HELPER FUNCTIONS |
| 9217 | // ================ |
| 9218 | |
| 9219 | var BP = Buffer.prototype |
| 9220 | |
| 9221 | /** |
| 9222 | * Augment a Uint8Array *instance* (not the Uint8Array class!) with Buffer methods |
| 9223 | */ |
| 9224 | Buffer._augment = function _augment (arr) { |
| 9225 | arr.constructor = Buffer |
| 9226 | arr._isBuffer = true |
| 9227 | |
| 9228 | // save reference to original Uint8Array set method before overwriting |
| 9229 | arr._set = arr.set |
| 9230 | |
| 9231 | // deprecated |
| 9232 | arr.get = BP.get |
| 9233 | arr.set = BP.set |
| 9234 | |
| 9235 | arr.write = BP.write |
| 9236 | arr.toString = BP.toString |
| 9237 | arr.toLocaleString = BP.toString |
| 9238 | arr.toJSON = BP.toJSON |
| 9239 | arr.equals = BP.equals |
| 9240 | arr.compare = BP.compare |
| 9241 | arr.indexOf = BP.indexOf |
| 9242 | arr.copy = BP.copy |
| 9243 | arr.slice = BP.slice |
| 9244 | arr.readUIntLE = BP.readUIntLE |
| 9245 | arr.readUIntBE = BP.readUIntBE |
| 9246 | arr.readUInt8 = BP.readUInt8 |
| 9247 | arr.readUInt16LE = BP.readUInt16LE |
| 9248 | arr.readUInt16BE = BP.readUInt16BE |
| 9249 | arr.readUInt32LE = BP.readUInt32LE |
| 9250 | arr.readUInt32BE = BP.readUInt32BE |
| 9251 | arr.readIntLE = BP.readIntLE |
| 9252 | arr.readIntBE = BP.readIntBE |
| 9253 | arr.readInt8 = BP.readInt8 |
| 9254 | arr.readInt16LE = BP.readInt16LE |
| 9255 | arr.readInt16BE = BP.readInt16BE |
| 9256 | arr.readInt32LE = BP.readInt32LE |
| 9257 | arr.readInt32BE = BP.readInt32BE |
| 9258 | arr.readFloatLE = BP.readFloatLE |
| 9259 | arr.readFloatBE = BP.readFloatBE |
| 9260 | arr.readDoubleLE = BP.readDoubleLE |
| 9261 | arr.readDoubleBE = BP.readDoubleBE |
| 9262 | arr.writeUInt8 = BP.writeUInt8 |
| 9263 | arr.writeUIntLE = BP.writeUIntLE |
| 9264 | arr.writeUIntBE = BP.writeUIntBE |
| 9265 | arr.writeUInt16LE = BP.writeUInt16LE |
| 9266 | arr.writeUInt16BE = BP.writeUInt16BE |
| 9267 | arr.writeUInt32LE = BP.writeUInt32LE |
| 9268 | arr.writeUInt32BE = BP.writeUInt32BE |
| 9269 | arr.writeIntLE = BP.writeIntLE |
| 9270 | arr.writeIntBE = BP.writeIntBE |
| 9271 | arr.writeInt8 = BP.writeInt8 |
| 9272 | arr.writeInt16LE = BP.writeInt16LE |
| 9273 | arr.writeInt16BE = BP.writeInt16BE |
| 9274 | arr.writeInt32LE = BP.writeInt32LE |
| 9275 | arr.writeInt32BE = BP.writeInt32BE |
| 9276 | arr.writeFloatLE = BP.writeFloatLE |
| 9277 | arr.writeFloatBE = BP.writeFloatBE |
| 9278 | arr.writeDoubleLE = BP.writeDoubleLE |
| 9279 | arr.writeDoubleBE = BP.writeDoubleBE |
| 9280 | arr.fill = BP.fill |
| 9281 | arr.inspect = BP.inspect |
| 9282 | arr.toArrayBuffer = BP.toArrayBuffer |
| 9283 | |
| 9284 | return arr |
| 9285 | } |
| 9286 | |
| 9287 | var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g |
| 9288 | |
| 9289 | function base64clean (str) { |
| 9290 | // Node strips out invalid characters like \n and \t from the string, base64-js does not |
| 9291 | str = stringtrim(str).replace(INVALID_BASE64_RE, '') |
| 9292 | // Node converts strings with length < 2 to '' |
| 9293 | if (str.length < 2) return '' |
| 9294 | // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not |
| 9295 | while (str.length % 4 !== 0) { |
| 9296 | str = str + '=' |
| 9297 | } |
| 9298 | return str |
| 9299 | } |
| 9300 | |
| 9301 | function stringtrim (str) { |
| 9302 | if (str.trim) return str.trim() |
| 9303 | return str.replace(/^\s+|\s+$/g, '') |
| 9304 | } |
| 9305 | |
| 9306 | function toHex (n) { |
| 9307 | if (n < 16) return '0' + n.toString(16) |
| 9308 | return n.toString(16) |
| 9309 | } |
| 9310 | |
| 9311 | function utf8ToBytes (string, units) { |
| 9312 | units = units || Infinity |
| 9313 | var codePoint |
| 9314 | var length = string.length |
| 9315 | var leadSurrogate = null |
| 9316 | var bytes = [] |
| 9317 | |
| 9318 | for (var i = 0; i < length; i++) { |
| 9319 | codePoint = string.charCodeAt(i) |
| 9320 | |
| 9321 | // is surrogate component |
| 9322 | if (codePoint > 0xD7FF && codePoint < 0xE000) { |
| 9323 | // last char was a lead |
| 9324 | if (!leadSurrogate) { |
| 9325 | // no lead yet |
| 9326 | if (codePoint > 0xDBFF) { |
| 9327 | // unexpected trail |
| 9328 | if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) |
| 9329 | continue |
| 9330 | } else if (i + 1 === length) { |
| 9331 | // unpaired lead |
| 9332 | if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) |
| 9333 | continue |
| 9334 | } |
| 9335 | |
| 9336 | // valid lead |
| 9337 | leadSurrogate = codePoint |
| 9338 | |
| 9339 | continue |
| 9340 | } |
| 9341 | |
| 9342 | // 2 leads in a row |
| 9343 | if (codePoint < 0xDC00) { |
| 9344 | if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) |
| 9345 | leadSurrogate = codePoint |
| 9346 | continue |
| 9347 | } |
| 9348 | |
| 9349 | // valid surrogate pair |
| 9350 | codePoint = leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00 | 0x10000 |
| 9351 | } else if (leadSurrogate) { |
| 9352 | // valid bmp char, but last char was a lead |
| 9353 | if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) |
| 9354 | } |
| 9355 | |
| 9356 | leadSurrogate = null |
| 9357 | |
| 9358 | // encode utf8 |
| 9359 | if (codePoint < 0x80) { |
| 9360 | if ((units -= 1) < 0) break |
| 9361 | bytes.push(codePoint) |
| 9362 | } else if (codePoint < 0x800) { |
| 9363 | if ((units -= 2) < 0) break |
| 9364 | bytes.push( |
| 9365 | codePoint >> 0x6 | 0xC0, |
| 9366 | codePoint & 0x3F | 0x80 |
| 9367 | ) |
| 9368 | } else if (codePoint < 0x10000) { |
| 9369 | if ((units -= 3) < 0) break |
| 9370 | bytes.push( |
| 9371 | codePoint >> 0xC | 0xE0, |
| 9372 | codePoint >> 0x6 & 0x3F | 0x80, |
| 9373 | codePoint & 0x3F | 0x80 |
| 9374 | ) |
| 9375 | } else if (codePoint < 0x110000) { |
| 9376 | if ((units -= 4) < 0) break |
| 9377 | bytes.push( |
| 9378 | codePoint >> 0x12 | 0xF0, |
| 9379 | codePoint >> 0xC & 0x3F | 0x80, |
| 9380 | codePoint >> 0x6 & 0x3F | 0x80, |
| 9381 | codePoint & 0x3F | 0x80 |
| 9382 | ) |
| 9383 | } else { |
| 9384 | throw new Error('Invalid code point') |
| 9385 | } |
| 9386 | } |
| 9387 | |
| 9388 | return bytes |
| 9389 | } |
| 9390 | |
| 9391 | function asciiToBytes (str) { |
| 9392 | var byteArray = [] |
| 9393 | for (var i = 0; i < str.length; i++) { |
| 9394 | // Node's code seems to be doing this and not & 0x7F.. |
| 9395 | byteArray.push(str.charCodeAt(i) & 0xFF) |
| 9396 | } |
| 9397 | return byteArray |
| 9398 | } |
| 9399 | |
| 9400 | function utf16leToBytes (str, units) { |
| 9401 | var c, hi, lo |
| 9402 | var byteArray = [] |
| 9403 | for (var i = 0; i < str.length; i++) { |
| 9404 | if ((units -= 2) < 0) break |
| 9405 | |
| 9406 | c = str.charCodeAt(i) |
| 9407 | hi = c >> 8 |
| 9408 | lo = c % 256 |
| 9409 | byteArray.push(lo) |
| 9410 | byteArray.push(hi) |
| 9411 | } |
| 9412 | |
| 9413 | return byteArray |
| 9414 | } |
| 9415 | |
| 9416 | function base64ToBytes (str) { |
| 9417 | return base64.toByteArray(base64clean(str)) |
| 9418 | } |
| 9419 | |
| 9420 | function blitBuffer (src, dst, offset, length) { |
| 9421 | for (var i = 0; i < length; i++) { |
| 9422 | if ((i + offset >= dst.length) || (i >= src.length)) break |
| 9423 | dst[i + offset] = src[i] |
| 9424 | } |
| 9425 | return i |
| 9426 | } |
| 9427 | |
| 9428 | },{"base64-js":15,"ieee754":16,"is-array":17}],15:[function(require,module,exports){ |
| 9429 | var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; |
| 9430 | |
| 9431 | ;(function (exports) { |
| 9432 | 'use strict'; |
| 9433 | |
| 9434 | var Arr = (typeof Uint8Array !== 'undefined') |
| 9435 | ? Uint8Array |
| 9436 | : Array |
| 9437 | |
| 9438 | var PLUS = '+'.charCodeAt(0) |
| 9439 | var SLASH = '/'.charCodeAt(0) |
| 9440 | var NUMBER = '0'.charCodeAt(0) |
| 9441 | var LOWER = 'a'.charCodeAt(0) |
| 9442 | var UPPER = 'A'.charCodeAt(0) |
| 9443 | var PLUS_URL_SAFE = '-'.charCodeAt(0) |
| 9444 | var SLASH_URL_SAFE = '_'.charCodeAt(0) |
| 9445 | |
| 9446 | function decode (elt) { |
| 9447 | var code = elt.charCodeAt(0) |
| 9448 | if (code === PLUS || |
| 9449 | code === PLUS_URL_SAFE) |
| 9450 | return 62 // '+' |
| 9451 | if (code === SLASH || |
| 9452 | code === SLASH_URL_SAFE) |
| 9453 | return 63 // '/' |
| 9454 | if (code < NUMBER) |
| 9455 | return -1 //no match |
| 9456 | if (code < NUMBER + 10) |
| 9457 | return code - NUMBER + 26 + 26 |
| 9458 | if (code < UPPER + 26) |
| 9459 | return code - UPPER |
| 9460 | if (code < LOWER + 26) |
| 9461 | return code - LOWER + 26 |
| 9462 | } |
| 9463 | |
| 9464 | function b64ToByteArray (b64) { |
| 9465 | var i, j, l, tmp, placeHolders, arr |
| 9466 | |
| 9467 | if (b64.length % 4 > 0) { |
| 9468 | throw new Error('Invalid string. Length must be a multiple of 4') |
| 9469 | } |
| 9470 | |
| 9471 | // the number of equal signs (place holders) |
| 9472 | // if there are two placeholders, than the two characters before it |
| 9473 | // represent one byte |
| 9474 | // if there is only one, then the three characters before it represent 2 bytes |
| 9475 | // this is just a cheap hack to not do indexOf twice |
| 9476 | var len = b64.length |
| 9477 | placeHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0 |
| 9478 | |
| 9479 | // base64 is 4/3 + up to two characters of the original data |
| 9480 | arr = new Arr(b64.length * 3 / 4 - placeHolders) |
| 9481 | |
| 9482 | // if there are placeholders, only get up to the last complete 4 chars |
| 9483 | l = placeHolders > 0 ? b64.length - 4 : b64.length |
| 9484 | |
| 9485 | var L = 0 |
| 9486 | |
| 9487 | function push (v) { |
| 9488 | arr[L++] = v |
| 9489 | } |
| 9490 | |
| 9491 | for (i = 0, j = 0; i < l; i += 4, j += 3) { |
| 9492 | tmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3)) |
| 9493 | push((tmp & 0xFF0000) >> 16) |
| 9494 | push((tmp & 0xFF00) >> 8) |
| 9495 | push(tmp & 0xFF) |
| 9496 | } |
| 9497 | |
| 9498 | if (placeHolders === 2) { |
| 9499 | tmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4) |
| 9500 | push(tmp & 0xFF) |
| 9501 | } else if (placeHolders === 1) { |
| 9502 | tmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2) |
| 9503 | push((tmp >> 8) & 0xFF) |
| 9504 | push(tmp & 0xFF) |
| 9505 | } |
| 9506 | |
| 9507 | return arr |
| 9508 | } |
| 9509 | |
| 9510 | function uint8ToBase64 (uint8) { |
| 9511 | var i, |
| 9512 | extraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes |
| 9513 | output = "", |
| 9514 | temp, length |
| 9515 | |
| 9516 | function encode (num) { |
| 9517 | return lookup.charAt(num) |
| 9518 | } |
| 9519 | |
| 9520 | function tripletToBase64 (num) { |
| 9521 | return encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F) |
| 9522 | } |
| 9523 | |
| 9524 | // go through the array every three bytes, we'll deal with trailing stuff later |
| 9525 | for (i = 0, length = uint8.length - extraBytes; i < length; i += 3) { |
| 9526 | temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2]) |
| 9527 | output += tripletToBase64(temp) |
| 9528 | } |
| 9529 | |
| 9530 | // pad the end with zeros, but make sure to not forget the extra bytes |
| 9531 | switch (extraBytes) { |
| 9532 | case 1: |
| 9533 | temp = uint8[uint8.length - 1] |
| 9534 | output += encode(temp >> 2) |
| 9535 | output += encode((temp << 4) & 0x3F) |
| 9536 | output += '==' |
| 9537 | break |
| 9538 | case 2: |
| 9539 | temp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1]) |
| 9540 | output += encode(temp >> 10) |
| 9541 | output += encode((temp >> 4) & 0x3F) |
| 9542 | output += encode((temp << 2) & 0x3F) |
| 9543 | output += '=' |
| 9544 | break |
| 9545 | } |
| 9546 | |
| 9547 | return output |
| 9548 | } |
| 9549 | |
| 9550 | exports.toByteArray = b64ToByteArray |
| 9551 | exports.fromByteArray = uint8ToBase64 |
| 9552 | }(typeof exports === 'undefined' ? (this.base64js = {}) : exports)) |
| 9553 | |
| 9554 | },{}],16:[function(require,module,exports){ |
| 9555 | exports.read = function (buffer, offset, isLE, mLen, nBytes) { |
| 9556 | var e, m |
| 9557 | var eLen = nBytes * 8 - mLen - 1 |
| 9558 | var eMax = (1 << eLen) - 1 |
| 9559 | var eBias = eMax >> 1 |
| 9560 | var nBits = -7 |
| 9561 | var i = isLE ? (nBytes - 1) : 0 |
| 9562 | var d = isLE ? -1 : 1 |
| 9563 | var s = buffer[offset + i] |
| 9564 | |
| 9565 | i += d |
| 9566 | |
| 9567 | e = s & ((1 << (-nBits)) - 1) |
| 9568 | s >>= (-nBits) |
| 9569 | nBits += eLen |
| 9570 | for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {} |
| 9571 | |
| 9572 | m = e & ((1 << (-nBits)) - 1) |
| 9573 | e >>= (-nBits) |
| 9574 | nBits += mLen |
| 9575 | for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {} |
| 9576 | |
| 9577 | if (e === 0) { |
| 9578 | e = 1 - eBias |
| 9579 | } else if (e === eMax) { |
| 9580 | return m ? NaN : ((s ? -1 : 1) * Infinity) |
| 9581 | } else { |
| 9582 | m = m + Math.pow(2, mLen) |
| 9583 | e = e - eBias |
| 9584 | } |
| 9585 | return (s ? -1 : 1) * m * Math.pow(2, e - mLen) |
| 9586 | } |
| 9587 | |
| 9588 | exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { |
| 9589 | var e, m, c |
| 9590 | var eLen = nBytes * 8 - mLen - 1 |
| 9591 | var eMax = (1 << eLen) - 1 |
| 9592 | var eBias = eMax >> 1 |
| 9593 | var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) |
| 9594 | var i = isLE ? 0 : (nBytes - 1) |
| 9595 | var d = isLE ? 1 : -1 |
| 9596 | var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 |
| 9597 | |
| 9598 | value = Math.abs(value) |
| 9599 | |
| 9600 | if (isNaN(value) || value === Infinity) { |
| 9601 | m = isNaN(value) ? 1 : 0 |
| 9602 | e = eMax |
| 9603 | } else { |
| 9604 | e = Math.floor(Math.log(value) / Math.LN2) |
| 9605 | if (value * (c = Math.pow(2, -e)) < 1) { |
| 9606 | e-- |
| 9607 | c *= 2 |
| 9608 | } |
| 9609 | if (e + eBias >= 1) { |
| 9610 | value += rt / c |
| 9611 | } else { |
| 9612 | value += rt * Math.pow(2, 1 - eBias) |
| 9613 | } |
| 9614 | if (value * c >= 2) { |
| 9615 | e++ |
| 9616 | c /= 2 |
| 9617 | } |
| 9618 | |
| 9619 | if (e + eBias >= eMax) { |
| 9620 | m = 0 |
| 9621 | e = eMax |
| 9622 | } else if (e + eBias >= 1) { |
| 9623 | m = (value * c - 1) * Math.pow(2, mLen) |
| 9624 | e = e + eBias |
| 9625 | } else { |
| 9626 | m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) |
| 9627 | e = 0 |
| 9628 | } |
| 9629 | } |
| 9630 | |
| 9631 | for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} |
| 9632 | |
| 9633 | e = (e << mLen) | m |
| 9634 | eLen += mLen |
| 9635 | for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} |
| 9636 | |
| 9637 | buffer[offset + i - d] |= s * 128 |
| 9638 | } |
| 9639 | |
| 9640 | },{}],17:[function(require,module,exports){ |
| 9641 | |
| 9642 | /** |
| 9643 | * isArray |
| 9644 | */ |
| 9645 | |
| 9646 | var isArray = Array.isArray; |
| 9647 | |
| 9648 | /** |
| 9649 | * toString |
| 9650 | */ |
| 9651 | |
| 9652 | var str = Object.prototype.toString; |
| 9653 | |
| 9654 | /** |
| 9655 | * Whether or not the given `val` |
| 9656 | * is an array. |
| 9657 | * |
| 9658 | * example: |
| 9659 | * |
| 9660 | * isArray([]); |
| 9661 | * // > true |
| 9662 | * isArray(arguments); |
| 9663 | * // > false |
| 9664 | * isArray(''); |
| 9665 | * // > false |
| 9666 | * |
| 9667 | * @param {mixed} val |
| 9668 | * @return {bool} |
| 9669 | */ |
| 9670 | |
| 9671 | module.exports = isArray || function (val) { |
| 9672 | return !! val && '[object Array]' == str.call(val); |
| 9673 | }; |
| 9674 | |
| 9675 | },{}],18:[function(require,module,exports){ |
| 9676 | /* jshint node: true */ |
| 9677 | (function () { |
| 9678 | "use strict"; |
| 9679 | |
| 9680 | function CookieAccessInfo(domain, path, secure, script) { |
| 9681 | if (this instanceof CookieAccessInfo) { |
| 9682 | this.domain = domain || undefined; |
| 9683 | this.path = path || "/"; |
| 9684 | this.secure = !!secure; |
| 9685 | this.script = !!script; |
| 9686 | return this; |
| 9687 | } |
| 9688 | return new CookieAccessInfo(domain, path, secure, script); |
| 9689 | } |
| 9690 | exports.CookieAccessInfo = CookieAccessInfo; |
| 9691 | |
| 9692 | function Cookie(cookiestr, request_domain, request_path) { |
| 9693 | if (cookiestr instanceof Cookie) { |
| 9694 | return cookiestr; |
| 9695 | } |
| 9696 | if (this instanceof Cookie) { |
| 9697 | this.name = null; |
| 9698 | this.value = null; |
| 9699 | this.expiration_date = Infinity; |
| 9700 | this.path = String(request_path || "/"); |
| 9701 | this.explicit_path = false; |
| 9702 | this.domain = request_domain || null; |
| 9703 | this.explicit_domain = false; |
| 9704 | this.secure = false; //how to define default? |
| 9705 | this.noscript = false; //httponly |
| 9706 | if (cookiestr) { |
| 9707 | this.parse(cookiestr, request_domain, request_path); |
| 9708 | } |
| 9709 | return this; |
| 9710 | } |
| 9711 | return new Cookie(cookiestr, request_domain, request_path); |
| 9712 | } |
| 9713 | exports.Cookie = Cookie; |
| 9714 | |
| 9715 | Cookie.prototype.toString = function toString() { |
| 9716 | var str = [this.name + "=" + this.value]; |
| 9717 | if (this.expiration_date !== Infinity) { |
| 9718 | str.push("expires=" + (new Date(this.expiration_date)).toGMTString()); |
| 9719 | } |
| 9720 | if (this.domain) { |
| 9721 | str.push("domain=" + this.domain); |
| 9722 | } |
| 9723 | if (this.path) { |
| 9724 | str.push("path=" + this.path); |
| 9725 | } |
| 9726 | if (this.secure) { |
| 9727 | str.push("secure"); |
| 9728 | } |
| 9729 | if (this.noscript) { |
| 9730 | str.push("httponly"); |
| 9731 | } |
| 9732 | return str.join("; "); |
| 9733 | }; |
| 9734 | |
| 9735 | Cookie.prototype.toValueString = function toValueString() { |
| 9736 | return this.name + "=" + this.value; |
| 9737 | }; |
| 9738 | |
| 9739 | var cookie_str_splitter = /[:](?=\s*[a-zA-Z0-9_\-]+\s*[=])/g; |
| 9740 | Cookie.prototype.parse = function parse(str, request_domain, request_path) { |
| 9741 | if (this instanceof Cookie) { |
| 9742 | var parts = str.split(";").filter(function (value) { |
| 9743 | return !!value; |
| 9744 | }), |
| 9745 | pair = parts[0].match(/([^=]+)=([\s\S]*)/), |
| 9746 | key = pair[1], |
| 9747 | value = pair[2], |
| 9748 | i; |
| 9749 | this.name = key; |
| 9750 | this.value = value; |
| 9751 | |
| 9752 | for (i = 1; i < parts.length; i += 1) { |
| 9753 | pair = parts[i].match(/([^=]+)(?:=([\s\S]*))?/); |
| 9754 | key = pair[1].trim().toLowerCase(); |
| 9755 | value = pair[2]; |
| 9756 | switch (key) { |
| 9757 | case "httponly": |
| 9758 | this.noscript = true; |
| 9759 | break; |
| 9760 | case "expires": |
| 9761 | this.expiration_date = value ? |
| 9762 | Number(Date.parse(value)) : |
| 9763 | Infinity; |
| 9764 | break; |
| 9765 | case "path": |
| 9766 | this.path = value ? |
| 9767 | value.trim() : |
| 9768 | ""; |
| 9769 | this.explicit_path = true; |
| 9770 | break; |
| 9771 | case "domain": |
| 9772 | this.domain = value ? |
| 9773 | value.trim() : |
| 9774 | ""; |
| 9775 | this.explicit_domain = !!this.domain; |
| 9776 | break; |
| 9777 | case "secure": |
| 9778 | this.secure = true; |
| 9779 | break; |
| 9780 | } |
| 9781 | } |
| 9782 | |
| 9783 | if (!this.explicit_path) { |
| 9784 | this.path = request_path || "/"; |
| 9785 | } |
| 9786 | if (!this.explicit_domain) { |
| 9787 | this.domain = request_domain; |
| 9788 | } |
| 9789 | |
| 9790 | return this; |
| 9791 | } |
| 9792 | return new Cookie().parse(str, request_domain, request_path); |
| 9793 | }; |
| 9794 | |
| 9795 | Cookie.prototype.matches = function matches(access_info) { |
| 9796 | if (this.noscript && access_info.script || |
| 9797 | this.secure && !access_info.secure || |
| 9798 | !this.collidesWith(access_info)) { |
| 9799 | return false; |
| 9800 | } |
| 9801 | return true; |
| 9802 | }; |
| 9803 | |
| 9804 | Cookie.prototype.collidesWith = function collidesWith(access_info) { |
| 9805 | if ((this.path && !access_info.path) || (this.domain && !access_info.domain)) { |
| 9806 | return false; |
| 9807 | } |
| 9808 | if (this.path && access_info.path.indexOf(this.path) !== 0) { |
| 9809 | return false; |
| 9810 | } |
| 9811 | if (this.explicit_path && access_info.path.indexOf( this.path ) !== 0) { |
| 9812 | return false; |
| 9813 | } |
| 9814 | var access_domain = access_info.domain && access_info.domain.replace(/^[\.]/,''); |
| 9815 | var cookie_domain = this.domain && this.domain.replace(/^[\.]/,''); |
| 9816 | if (cookie_domain === access_domain) { |
| 9817 | return true; |
| 9818 | } |
| 9819 | if (cookie_domain) { |
| 9820 | if (!this.explicit_domain) { |
| 9821 | return false; // we already checked if the domains were exactly the same |
| 9822 | } |
| 9823 | var wildcard = access_domain.indexOf(cookie_domain); |
| 9824 | if (wildcard === -1 || wildcard !== access_domain.length - cookie_domain.length) { |
| 9825 | return false; |
| 9826 | } |
| 9827 | return true; |
| 9828 | } |
| 9829 | return true; |
| 9830 | }; |
| 9831 | |
| 9832 | function CookieJar() { |
| 9833 | var cookies, cookies_list, collidable_cookie; |
| 9834 | if (this instanceof CookieJar) { |
| 9835 | cookies = Object.create(null); //name: [Cookie] |
| 9836 | |
| 9837 | this.setCookie = function setCookie(cookie, request_domain, request_path) { |
| 9838 | var remove, i; |
| 9839 | cookie = new Cookie(cookie, request_domain, request_path); |
| 9840 | //Delete the cookie if the set is past the current time |
| 9841 | remove = cookie.expiration_date <= Date.now(); |
| 9842 | if (cookies[cookie.name] !== undefined) { |
| 9843 | cookies_list = cookies[cookie.name]; |
| 9844 | for (i = 0; i < cookies_list.length; i += 1) { |
| 9845 | collidable_cookie = cookies_list[i]; |
| 9846 | if (collidable_cookie.collidesWith(cookie)) { |
| 9847 | if (remove) { |
| 9848 | cookies_list.splice(i, 1); |
| 9849 | if (cookies_list.length === 0) { |
| 9850 | delete cookies[cookie.name]; |
| 9851 | } |
| 9852 | return false; |
| 9853 | } |
| 9854 | cookies_list[i] = cookie; |
| 9855 | return cookie; |
| 9856 | } |
| 9857 | } |
| 9858 | if (remove) { |
| 9859 | return false; |
| 9860 | } |
| 9861 | cookies_list.push(cookie); |
| 9862 | return cookie; |
| 9863 | } |
| 9864 | if (remove) { |
| 9865 | return false; |
| 9866 | } |
| 9867 | cookies[cookie.name] = [cookie]; |
| 9868 | return cookies[cookie.name]; |
| 9869 | }; |
| 9870 | //returns a cookie |
| 9871 | this.getCookie = function getCookie(cookie_name, access_info) { |
| 9872 | var cookie, i; |
| 9873 | cookies_list = cookies[cookie_name]; |
| 9874 | if (!cookies_list) { |
| 9875 | return; |
| 9876 | } |
| 9877 | for (i = 0; i < cookies_list.length; i += 1) { |
| 9878 | cookie = cookies_list[i]; |
| 9879 | if (cookie.expiration_date <= Date.now()) { |
| 9880 | if (cookies_list.length === 0) { |
| 9881 | delete cookies[cookie.name]; |
| 9882 | } |
| 9883 | continue; |
| 9884 | } |
| 9885 | |
| 9886 | if (cookie.matches(access_info)) { |
| 9887 | return cookie; |
| 9888 | } |
| 9889 | } |
| 9890 | }; |
| 9891 | //returns a list of cookies |
| 9892 | this.getCookies = function getCookies(access_info) { |
| 9893 | var matches = [], cookie_name, cookie; |
| 9894 | for (cookie_name in cookies) { |
| 9895 | cookie = this.getCookie(cookie_name, access_info); |
| 9896 | if (cookie) { |
| 9897 | matches.push(cookie); |
| 9898 | } |
| 9899 | } |
| 9900 | matches.toString = function toString() { |
| 9901 | return matches.join(":"); |
| 9902 | }; |
| 9903 | matches.toValueString = function toValueString() { |
| 9904 | return matches.map(function (c) { |
| 9905 | return c.toValueString(); |
| 9906 | }).join(';'); |
| 9907 | }; |
| 9908 | return matches; |
| 9909 | }; |
| 9910 | |
| 9911 | return this; |
| 9912 | } |
| 9913 | return new CookieJar(); |
| 9914 | } |
| 9915 | exports.CookieJar = CookieJar; |
| 9916 | |
| 9917 | //returns list of cookies that were set correctly. Cookies that are expired and removed are not returned. |
| 9918 | CookieJar.prototype.setCookies = function setCookies(cookies, request_domain, request_path) { |
| 9919 | cookies = Array.isArray(cookies) ? |
| 9920 | cookies : |
| 9921 | cookies.split(cookie_str_splitter); |
| 9922 | var successful = [], |
| 9923 | i, |
| 9924 | cookie; |
| 9925 | cookies = cookies.map(function(item){ |
| 9926 | return new Cookie(item, request_domain, request_path); |
| 9927 | }); |
| 9928 | for (i = 0; i < cookies.length; i += 1) { |
| 9929 | cookie = cookies[i]; |
| 9930 | if (this.setCookie(cookie, request_domain, request_path)) { |
| 9931 | successful.push(cookie); |
| 9932 | } |
| 9933 | } |
| 9934 | return successful; |
| 9935 | }; |
| 9936 | }()); |
| 9937 | |
| 9938 | },{}],19:[function(require,module,exports){ |
| 9939 | 'use strict'; |
| 9940 | |
| 9941 | |
| 9942 | var yaml = require('./lib/js-yaml.js'); |
| 9943 | |
| 9944 | |
| 9945 | module.exports = yaml; |
| 9946 | |
| 9947 | },{"./lib/js-yaml.js":20}],20:[function(require,module,exports){ |
| 9948 | 'use strict'; |
| 9949 | |
| 9950 | |
| 9951 | var loader = require('./js-yaml/loader'); |
| 9952 | var dumper = require('./js-yaml/dumper'); |
| 9953 | |
| 9954 | |
| 9955 | function deprecated(name) { |
| 9956 | return function () { |
| 9957 | throw new Error('Function ' + name + ' is deprecated and cannot be used.'); |
| 9958 | }; |
| 9959 | } |
| 9960 | |
| 9961 | |
| 9962 | module.exports.Type = require('./js-yaml/type'); |
| 9963 | module.exports.Schema = require('./js-yaml/schema'); |
| 9964 | module.exports.FAILSAFE_SCHEMA = require('./js-yaml/schema/failsafe'); |
| 9965 | module.exports.JSON_SCHEMA = require('./js-yaml/schema/json'); |
| 9966 | module.exports.CORE_SCHEMA = require('./js-yaml/schema/core'); |
| 9967 | module.exports.DEFAULT_SAFE_SCHEMA = require('./js-yaml/schema/default_safe'); |
| 9968 | module.exports.DEFAULT_FULL_SCHEMA = require('./js-yaml/schema/default_full'); |
| 9969 | module.exports.load = loader.load; |
| 9970 | module.exports.loadAll = loader.loadAll; |
| 9971 | module.exports.safeLoad = loader.safeLoad; |
| 9972 | module.exports.safeLoadAll = loader.safeLoadAll; |
| 9973 | module.exports.dump = dumper.dump; |
| 9974 | module.exports.safeDump = dumper.safeDump; |
| 9975 | module.exports.YAMLException = require('./js-yaml/exception'); |
| 9976 | |
| 9977 | // Deprecated schema names from JS-YAML 2.0.x |
| 9978 | module.exports.MINIMAL_SCHEMA = require('./js-yaml/schema/failsafe'); |
| 9979 | module.exports.SAFE_SCHEMA = require('./js-yaml/schema/default_safe'); |
| 9980 | module.exports.DEFAULT_SCHEMA = require('./js-yaml/schema/default_full'); |
| 9981 | |
| 9982 | // Deprecated functions from JS-YAML 1.x.x |
| 9983 | module.exports.scan = deprecated('scan'); |
| 9984 | module.exports.parse = deprecated('parse'); |
| 9985 | module.exports.compose = deprecated('compose'); |
| 9986 | module.exports.addConstructor = deprecated('addConstructor'); |
| 9987 | |
| 9988 | },{"./js-yaml/dumper":22,"./js-yaml/exception":23,"./js-yaml/loader":24,"./js-yaml/schema":26,"./js-yaml/schema/core":27,"./js-yaml/schema/default_full":28,"./js-yaml/schema/default_safe":29,"./js-yaml/schema/failsafe":30,"./js-yaml/schema/json":31,"./js-yaml/type":32}],21:[function(require,module,exports){ |
| 9989 | 'use strict'; |
| 9990 | |
| 9991 | |
| 9992 | function isNothing(subject) { |
| 9993 | return (typeof subject === 'undefined') || (subject === null); |
| 9994 | } |
| 9995 | |
| 9996 | |
| 9997 | function isObject(subject) { |
| 9998 | return (typeof subject === 'object') && (subject !== null); |
| 9999 | } |
| 10000 | |
| 10001 | |
| 10002 | function toArray(sequence) { |
| 10003 | if (Array.isArray(sequence)) return sequence; |
| 10004 | else if (isNothing(sequence)) return []; |
| 10005 | |
| 10006 | return [ sequence ]; |
| 10007 | } |
| 10008 | |
| 10009 | |
| 10010 | function extend(target, source) { |
| 10011 | var index, length, key, sourceKeys; |
| 10012 | |
| 10013 | if (source) { |
| 10014 | sourceKeys = Object.keys(source); |
| 10015 | |
| 10016 | for (index = 0, length = sourceKeys.length; index < length; index += 1) { |
| 10017 | key = sourceKeys[index]; |
| 10018 | target[key] = source[key]; |
| 10019 | } |
| 10020 | } |
| 10021 | |
| 10022 | return target; |
| 10023 | } |
| 10024 | |
| 10025 | |
| 10026 | function repeat(string, count) { |
| 10027 | var result = '', cycle; |
| 10028 | |
| 10029 | for (cycle = 0; cycle < count; cycle += 1) { |
| 10030 | result += string; |
| 10031 | } |
| 10032 | |
| 10033 | return result; |
| 10034 | } |
| 10035 | |
| 10036 | |
| 10037 | function isNegativeZero(number) { |
| 10038 | return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number); |
| 10039 | } |
| 10040 | |
| 10041 | |
| 10042 | module.exports.isNothing = isNothing; |
| 10043 | module.exports.isObject = isObject; |
| 10044 | module.exports.toArray = toArray; |
| 10045 | module.exports.repeat = repeat; |
| 10046 | module.exports.isNegativeZero = isNegativeZero; |
| 10047 | module.exports.extend = extend; |
| 10048 | |
| 10049 | },{}],22:[function(require,module,exports){ |
| 10050 | 'use strict'; |
| 10051 | |
| 10052 | /*eslint-disable no-use-before-define*/ |
| 10053 | |
| 10054 | var common = require('./common'); |
| 10055 | var YAMLException = require('./exception'); |
| 10056 | var DEFAULT_FULL_SCHEMA = require('./schema/default_full'); |
| 10057 | var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe'); |
| 10058 | |
| 10059 | var _toString = Object.prototype.toString; |
| 10060 | var _hasOwnProperty = Object.prototype.hasOwnProperty; |
| 10061 | |
| 10062 | var CHAR_TAB = 0x09; /* Tab */ |
| 10063 | var CHAR_LINE_FEED = 0x0A; /* LF */ |
| 10064 | var CHAR_SPACE = 0x20; /* Space */ |
| 10065 | var CHAR_EXCLAMATION = 0x21; /* ! */ |
| 10066 | var CHAR_DOUBLE_QUOTE = 0x22; /* " */ |
| 10067 | var CHAR_SHARP = 0x23; /* # */ |
| 10068 | var CHAR_PERCENT = 0x25; /* % */ |
| 10069 | var CHAR_AMPERSAND = 0x26; /* & */ |
| 10070 | var CHAR_SINGLE_QUOTE = 0x27; /* ' */ |
| 10071 | var CHAR_ASTERISK = 0x2A; /* * */ |
| 10072 | var CHAR_COMMA = 0x2C; /* , */ |
| 10073 | var CHAR_MINUS = 0x2D; /* - */ |
| 10074 | var CHAR_COLON = 0x3A; /* : */ |
| 10075 | var CHAR_GREATER_THAN = 0x3E; /* > */ |
| 10076 | var CHAR_QUESTION = 0x3F; /* ? */ |
| 10077 | var CHAR_COMMERCIAL_AT = 0x40; /* @ */ |
| 10078 | var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */ |
| 10079 | var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */ |
| 10080 | var CHAR_GRAVE_ACCENT = 0x60; /* ` */ |
| 10081 | var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */ |
| 10082 | var CHAR_VERTICAL_LINE = 0x7C; /* | */ |
| 10083 | var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */ |
| 10084 | |
| 10085 | var ESCAPE_SEQUENCES = {}; |
| 10086 | |
| 10087 | ESCAPE_SEQUENCES[0x00] = '\\0'; |
| 10088 | ESCAPE_SEQUENCES[0x07] = '\\a'; |
| 10089 | ESCAPE_SEQUENCES[0x08] = '\\b'; |
| 10090 | ESCAPE_SEQUENCES[0x09] = '\\t'; |
| 10091 | ESCAPE_SEQUENCES[0x0A] = '\\n'; |
| 10092 | ESCAPE_SEQUENCES[0x0B] = '\\v'; |
| 10093 | ESCAPE_SEQUENCES[0x0C] = '\\f'; |
| 10094 | ESCAPE_SEQUENCES[0x0D] = '\\r'; |
| 10095 | ESCAPE_SEQUENCES[0x1B] = '\\e'; |
| 10096 | ESCAPE_SEQUENCES[0x22] = '\\"'; |
| 10097 | ESCAPE_SEQUENCES[0x5C] = '\\\\'; |
| 10098 | ESCAPE_SEQUENCES[0x85] = '\\N'; |
| 10099 | ESCAPE_SEQUENCES[0xA0] = '\\_'; |
| 10100 | ESCAPE_SEQUENCES[0x2028] = '\\L'; |
| 10101 | ESCAPE_SEQUENCES[0x2029] = '\\P'; |
| 10102 | |
| 10103 | var DEPRECATED_BOOLEANS_SYNTAX = [ |
| 10104 | 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', |
| 10105 | 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' |
| 10106 | ]; |
| 10107 | |
| 10108 | function compileStyleMap(schema, map) { |
| 10109 | var result, keys, index, length, tag, style, type; |
| 10110 | |
| 10111 | if (map === null) return {}; |
| 10112 | |
| 10113 | result = {}; |
| 10114 | keys = Object.keys(map); |
| 10115 | |
| 10116 | for (index = 0, length = keys.length; index < length; index += 1) { |
| 10117 | tag = keys[index]; |
| 10118 | style = String(map[tag]); |
| 10119 | |
| 10120 | if (tag.slice(0, 2) === '!!') { |
| 10121 | tag = 'tag:yaml.org,2002:' + tag.slice(2); |
| 10122 | } |
| 10123 | |
| 10124 | type = schema.compiledTypeMap[tag]; |
| 10125 | |
| 10126 | if (type && _hasOwnProperty.call(type.styleAliases, style)) { |
| 10127 | style = type.styleAliases[style]; |
| 10128 | } |
| 10129 | |
| 10130 | result[tag] = style; |
| 10131 | } |
| 10132 | |
| 10133 | return result; |
| 10134 | } |
| 10135 | |
| 10136 | function encodeHex(character) { |
| 10137 | var string, handle, length; |
| 10138 | |
| 10139 | string = character.toString(16).toUpperCase(); |
| 10140 | |
| 10141 | if (character <= 0xFF) { |
| 10142 | handle = 'x'; |
| 10143 | length = 2; |
| 10144 | } else if (character <= 0xFFFF) { |
| 10145 | handle = 'u'; |
| 10146 | length = 4; |
| 10147 | } else if (character <= 0xFFFFFFFF) { |
| 10148 | handle = 'U'; |
| 10149 | length = 8; |
| 10150 | } else { |
| 10151 | throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF'); |
| 10152 | } |
| 10153 | |
| 10154 | return '\\' + handle + common.repeat('0', length - string.length) + string; |
| 10155 | } |
| 10156 | |
| 10157 | function State(options) { |
| 10158 | this.schema = options['schema'] || DEFAULT_FULL_SCHEMA; |
| 10159 | this.indent = Math.max(1, (options['indent'] || 2)); |
| 10160 | this.skipInvalid = options['skipInvalid'] || false; |
| 10161 | this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']); |
| 10162 | this.styleMap = compileStyleMap(this.schema, options['styles'] || null); |
| 10163 | this.sortKeys = options['sortKeys'] || false; |
| 10164 | this.lineWidth = options['lineWidth'] || 80; |
| 10165 | this.noRefs = options['noRefs'] || false; |
| 10166 | this.noCompatMode = options['noCompatMode'] || false; |
| 10167 | |
| 10168 | this.implicitTypes = this.schema.compiledImplicit; |
| 10169 | this.explicitTypes = this.schema.compiledExplicit; |
| 10170 | |
| 10171 | this.tag = null; |
| 10172 | this.result = ''; |
| 10173 | |
| 10174 | this.duplicates = []; |
| 10175 | this.usedDuplicates = null; |
| 10176 | } |
| 10177 | |
| 10178 | // Indents every line in a string. Empty lines (\n only) are not indented. |
| 10179 | function indentString(string, spaces) { |
| 10180 | var ind = common.repeat(' ', spaces), |
| 10181 | position = 0, |
| 10182 | next = -1, |
| 10183 | result = '', |
| 10184 | line, |
| 10185 | length = string.length; |
| 10186 | |
| 10187 | while (position < length) { |
| 10188 | next = string.indexOf('\n', position); |
| 10189 | if (next === -1) { |
| 10190 | line = string.slice(position); |
| 10191 | position = length; |
| 10192 | } else { |
| 10193 | line = string.slice(position, next + 1); |
| 10194 | position = next + 1; |
| 10195 | } |
| 10196 | |
| 10197 | if (line.length && line !== '\n') result += ind; |
| 10198 | |
| 10199 | result += line; |
| 10200 | } |
| 10201 | |
| 10202 | return result; |
| 10203 | } |
| 10204 | |
| 10205 | function generateNextLine(state, level) { |
| 10206 | return '\n' + common.repeat(' ', state.indent * level); |
| 10207 | } |
| 10208 | |
| 10209 | function testImplicitResolving(state, str) { |
| 10210 | var index, length, type; |
| 10211 | |
| 10212 | for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { |
| 10213 | type = state.implicitTypes[index]; |
| 10214 | |
| 10215 | if (type.resolve(str)) { |
| 10216 | return true; |
| 10217 | } |
| 10218 | } |
| 10219 | |
| 10220 | return false; |
| 10221 | } |
| 10222 | |
| 10223 | // [33] s-white ::= s-space | s-tab |
| 10224 | function isWhitespace(c) { |
| 10225 | return c === CHAR_SPACE || c === CHAR_TAB; |
| 10226 | } |
| 10227 | |
| 10228 | // Returns true if the character can be printed without escaping. |
| 10229 | // From YAML 1.2: "any allowed characters known to be non-printable |
| 10230 | // should also be escaped. [However,] This isn’t mandatory" |
| 10231 | // Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029. |
| 10232 | function isPrintable(c) { |
| 10233 | return (0x00020 <= c && c <= 0x00007E) |
| 10234 | || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029) |
| 10235 | || ((0x0E000 <= c && c <= 0x00FFFD) && c !== 0xFEFF /* BOM */) |
| 10236 | || (0x10000 <= c && c <= 0x10FFFF); |
| 10237 | } |
| 10238 | |
| 10239 | // Simplified test for values allowed after the first character in plain style. |
| 10240 | function isPlainSafe(c) { |
| 10241 | // Uses a subset of nb-char - c-flow-indicator - ":" - "#" |
| 10242 | // where nb-char ::= c-printable - b-char - c-byte-order-mark. |
| 10243 | return isPrintable(c) && c !== 0xFEFF |
| 10244 | // - c-flow-indicator |
| 10245 | && c !== CHAR_COMMA |
| 10246 | && c !== CHAR_LEFT_SQUARE_BRACKET |
| 10247 | && c !== CHAR_RIGHT_SQUARE_BRACKET |
| 10248 | && c !== CHAR_LEFT_CURLY_BRACKET |
| 10249 | && c !== CHAR_RIGHT_CURLY_BRACKET |
| 10250 | // - ":" - "#" |
| 10251 | && c !== CHAR_COLON |
| 10252 | && c !== CHAR_SHARP; |
| 10253 | } |
| 10254 | |
| 10255 | // Simplified test for values allowed as the first character in plain style. |
| 10256 | function isPlainSafeFirst(c) { |
| 10257 | // Uses a subset of ns-char - c-indicator |
| 10258 | // where ns-char = nb-char - s-white. |
| 10259 | return isPrintable(c) && c !== 0xFEFF |
| 10260 | && !isWhitespace(c) // - s-white |
| 10261 | // - (c-indicator ::= |
| 10262 | // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}” |
| 10263 | && c !== CHAR_MINUS |
| 10264 | && c !== CHAR_QUESTION |
| 10265 | && c !== CHAR_COLON |
| 10266 | && c !== CHAR_COMMA |
| 10267 | && c !== CHAR_LEFT_SQUARE_BRACKET |
| 10268 | && c !== CHAR_RIGHT_SQUARE_BRACKET |
| 10269 | && c !== CHAR_LEFT_CURLY_BRACKET |
| 10270 | && c !== CHAR_RIGHT_CURLY_BRACKET |
| 10271 | // | “#” | “&” | “*” | “!” | “|” | “>” | “'” | “"” |
| 10272 | && c !== CHAR_SHARP |
| 10273 | && c !== CHAR_AMPERSAND |
| 10274 | && c !== CHAR_ASTERISK |
| 10275 | && c !== CHAR_EXCLAMATION |
| 10276 | && c !== CHAR_VERTICAL_LINE |
| 10277 | && c !== CHAR_GREATER_THAN |
| 10278 | && c !== CHAR_SINGLE_QUOTE |
| 10279 | && c !== CHAR_DOUBLE_QUOTE |
| 10280 | // | “%” | “@” | “`”) |
| 10281 | && c !== CHAR_PERCENT |
| 10282 | && c !== CHAR_COMMERCIAL_AT |
| 10283 | && c !== CHAR_GRAVE_ACCENT; |
| 10284 | } |
| 10285 | |
| 10286 | var STYLE_PLAIN = 1, |
| 10287 | STYLE_SINGLE = 2, |
| 10288 | STYLE_LITERAL = 3, |
| 10289 | STYLE_FOLDED = 4, |
| 10290 | STYLE_DOUBLE = 5; |
| 10291 | |
| 10292 | // Determines which scalar styles are possible and returns the preferred style. |
| 10293 | // lineWidth = -1 => no limit. |
| 10294 | // Pre-conditions: str.length > 0. |
| 10295 | // Post-conditions: |
| 10296 | // STYLE_PLAIN or STYLE_SINGLE => no \n are in the string. |
| 10297 | // STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1). |
| 10298 | // STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1). |
| 10299 | function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) { |
| 10300 | var i; |
| 10301 | var char; |
| 10302 | var hasLineBreak = false; |
| 10303 | var hasFoldableLine = false; // only checked if shouldTrackWidth |
| 10304 | var shouldTrackWidth = lineWidth !== -1; |
| 10305 | var previousLineBreak = -1; // count the first line correctly |
| 10306 | var plain = isPlainSafeFirst(string.charCodeAt(0)) |
| 10307 | && !isWhitespace(string.charCodeAt(string.length - 1)); |
| 10308 | |
| 10309 | if (singleLineOnly) { |
| 10310 | // Case: no block styles. |
| 10311 | // Check for disallowed characters to rule out plain and single. |
| 10312 | for (i = 0; i < string.length; i++) { |
| 10313 | char = string.charCodeAt(i); |
| 10314 | if (!isPrintable(char)) { |
| 10315 | return STYLE_DOUBLE; |
| 10316 | } |
| 10317 | plain = plain && isPlainSafe(char); |
| 10318 | } |
| 10319 | } else { |
| 10320 | // Case: block styles permitted. |
| 10321 | for (i = 0; i < string.length; i++) { |
| 10322 | char = string.charCodeAt(i); |
| 10323 | if (char === CHAR_LINE_FEED) { |
| 10324 | hasLineBreak = true; |
| 10325 | // Check if any line can be folded. |
| 10326 | if (shouldTrackWidth) { |
| 10327 | hasFoldableLine = hasFoldableLine || |
| 10328 | // Foldable line = too long, and not more-indented. |
| 10329 | (i - previousLineBreak - 1 > lineWidth && |
| 10330 | string[previousLineBreak + 1] !== ' '); |
| 10331 | previousLineBreak = i; |
| 10332 | } |
| 10333 | } else if (!isPrintable(char)) { |
| 10334 | return STYLE_DOUBLE; |
| 10335 | } |
| 10336 | plain = plain && isPlainSafe(char); |
| 10337 | } |
| 10338 | // in case the end is missing a \n |
| 10339 | hasFoldableLine = hasFoldableLine || (shouldTrackWidth && |
| 10340 | (i - previousLineBreak - 1 > lineWidth && |
| 10341 | string[previousLineBreak + 1] !== ' ')); |
| 10342 | } |
| 10343 | // Although every style can represent \n without escaping, prefer block styles |
| 10344 | // for multiline, since they're more readable and they don't add empty lines. |
| 10345 | // Also prefer folding a super-long line. |
| 10346 | if (!hasLineBreak && !hasFoldableLine) { |
| 10347 | // Strings interpretable as another type have to be quoted; |
| 10348 | // e.g. the string 'true' vs. the boolean true. |
| 10349 | return plain && !testAmbiguousType(string) |
| 10350 | ? STYLE_PLAIN : STYLE_SINGLE; |
| 10351 | } |
| 10352 | // Edge case: block indentation indicator can only have one digit. |
| 10353 | if (string[0] === ' ' && indentPerLevel > 9) { |
| 10354 | return STYLE_DOUBLE; |
| 10355 | } |
| 10356 | // At this point we know block styles are valid. |
| 10357 | // Prefer literal style unless we want to fold. |
| 10358 | return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL; |
| 10359 | } |
| 10360 | |
| 10361 | // Note: line breaking/folding is implemented for only the folded style. |
| 10362 | // NB. We drop the last trailing newline (if any) of a returned block scalar |
| 10363 | // since the dumper adds its own newline. This always works: |
| 10364 | // • No ending newline => unaffected; already using strip "-" chomping. |
| 10365 | // • Ending newline => removed then restored. |
| 10366 | // Importantly, this keeps the "+" chomp indicator from gaining an extra line. |
| 10367 | function writeScalar(state, string, level, iskey) { |
| 10368 | state.dump = (function () { |
| 10369 | if (string.length === 0) { |
| 10370 | return "''"; |
| 10371 | } |
| 10372 | if (!state.noCompatMode && |
| 10373 | DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1) { |
| 10374 | return "'" + string + "'"; |
| 10375 | } |
| 10376 | |
| 10377 | var indent = state.indent * Math.max(1, level); // no 0-indent scalars |
| 10378 | // As indentation gets deeper, let the width decrease monotonically |
| 10379 | // to the lower bound min(state.lineWidth, 40). |
| 10380 | // Note that this implies |
| 10381 | // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound. |
| 10382 | // state.lineWidth > 40 + state.indent: width decreases until the lower bound. |
| 10383 | // This behaves better than a constant minimum width which disallows narrower options, |
| 10384 | // or an indent threshold which causes the width to suddenly increase. |
| 10385 | var lineWidth = state.lineWidth === -1 |
| 10386 | ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent); |
| 10387 | |
| 10388 | // Without knowing if keys are implicit/explicit, assume implicit for safety. |
| 10389 | var singleLineOnly = iskey |
| 10390 | // No block styles in flow mode. |
| 10391 | || (state.flowLevel > -1 && level >= state.flowLevel); |
| 10392 | function testAmbiguity(string) { |
| 10393 | return testImplicitResolving(state, string); |
| 10394 | } |
| 10395 | |
| 10396 | switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity)) { |
| 10397 | case STYLE_PLAIN: |
| 10398 | return string; |
| 10399 | case STYLE_SINGLE: |
| 10400 | return "'" + string.replace(/'/g, "''") + "'"; |
| 10401 | case STYLE_LITERAL: |
| 10402 | return '|' + blockHeader(string, state.indent) |
| 10403 | + dropEndingNewline(indentString(string, indent)); |
| 10404 | case STYLE_FOLDED: |
| 10405 | return '>' + blockHeader(string, state.indent) |
| 10406 | + dropEndingNewline(indentString(foldString(string, lineWidth), indent)); |
| 10407 | case STYLE_DOUBLE: |
| 10408 | return '"' + escapeString(string, lineWidth) + '"'; |
| 10409 | default: |
| 10410 | throw new YAMLException('impossible error: invalid scalar style'); |
| 10411 | } |
| 10412 | }()); |
| 10413 | } |
| 10414 | |
| 10415 | // Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9. |
| 10416 | function blockHeader(string, indentPerLevel) { |
| 10417 | var indentIndicator = (string[0] === ' ') ? String(indentPerLevel) : ''; |
| 10418 | |
| 10419 | // note the special case: the string '\n' counts as a "trailing" empty line. |
| 10420 | var clip = string[string.length - 1] === '\n'; |
| 10421 | var keep = clip && (string[string.length - 2] === '\n' || string === '\n'); |
| 10422 | var chomp = keep ? '+' : (clip ? '' : '-'); |
| 10423 | |
| 10424 | return indentIndicator + chomp + '\n'; |
| 10425 | } |
| 10426 | |
| 10427 | // (See the note for writeScalar.) |
| 10428 | function dropEndingNewline(string) { |
| 10429 | return string[string.length - 1] === '\n' ? string.slice(0, -1) : string; |
| 10430 | } |
| 10431 | |
| 10432 | // Note: a long line without a suitable break point will exceed the width limit. |
| 10433 | // Pre-conditions: every char in str isPrintable, str.length > 0, width > 0. |
| 10434 | function foldString(string, width) { |
| 10435 | // In folded style, $k$ consecutive newlines output as $k+1$ newlines— |
| 10436 | // unless they're before or after a more-indented line, or at the very |
| 10437 | // beginning or end, in which case $k$ maps to $k$. |
| 10438 | // Therefore, parse each chunk as newline(s) followed by a content line. |
| 10439 | var lineRe = /(\n+)([^\n]*)/g; |
| 10440 | |
| 10441 | // first line (possibly an empty line) |
| 10442 | var result = (function () { |
| 10443 | var nextLF = string.indexOf('\n'); |
| 10444 | nextLF = nextLF !== -1 ? nextLF : string.length; |
| 10445 | lineRe.lastIndex = nextLF; |
| 10446 | return foldLine(string.slice(0, nextLF), width); |
| 10447 | }()); |
| 10448 | // If we haven't reached the first content line yet, don't add an extra \n. |
| 10449 | var prevMoreIndented = string[0] === '\n' || string[0] === ' '; |
| 10450 | var moreIndented; |
| 10451 | |
| 10452 | // rest of the lines |
| 10453 | var match; |
| 10454 | while ((match = lineRe.exec(string))) { |
| 10455 | var prefix = match[1], line = match[2]; |
| 10456 | moreIndented = (line[0] === ' '); |
| 10457 | result += prefix |
| 10458 | + (!prevMoreIndented && !moreIndented && line !== '' |
| 10459 | ? '\n' : '') |
| 10460 | + foldLine(line, width); |
| 10461 | prevMoreIndented = moreIndented; |
| 10462 | } |
| 10463 | |
| 10464 | return result; |
| 10465 | } |
| 10466 | |
| 10467 | // Greedy line breaking. |
| 10468 | // Picks the longest line under the limit each time, |
| 10469 | // otherwise settles for the shortest line over the limit. |
| 10470 | // NB. More-indented lines *cannot* be folded, as that would add an extra \n. |
| 10471 | function foldLine(line, width) { |
| 10472 | if (line === '' || line[0] === ' ') return line; |
| 10473 | |
| 10474 | // Since a more-indented line adds a \n, breaks can't be followed by a space. |
| 10475 | var breakRe = / [^ ]/g; // note: the match index will always be <= length-2. |
| 10476 | var match; |
| 10477 | // start is an inclusive index. end, curr, and next are exclusive. |
| 10478 | var start = 0, end, curr = 0, next = 0; |
| 10479 | var result = ''; |
| 10480 | |
| 10481 | // Invariants: 0 <= start <= length-1. |
| 10482 | // 0 <= curr <= next <= max(0, length-2). curr - start <= width. |
| 10483 | // Inside the loop: |
| 10484 | // A match implies length >= 2, so curr and next are <= length-2. |
| 10485 | while ((match = breakRe.exec(line))) { |
| 10486 | next = match.index; |
| 10487 | // maintain invariant: curr - start <= width |
| 10488 | if (next - start > width) { |
| 10489 | end = (curr > start) ? curr : next; // derive end <= length-2 |
| 10490 | result += '\n' + line.slice(start, end); |
| 10491 | // skip the space that was output as \n |
| 10492 | start = end + 1; // derive start <= length-1 |
| 10493 | } |
| 10494 | curr = next; |
| 10495 | } |
| 10496 | |
| 10497 | // By the invariants, start <= length-1, so there is something left over. |
| 10498 | // It is either the whole string or a part starting from non-whitespace. |
| 10499 | result += '\n'; |
| 10500 | // Insert a break if the remainder is too long and there is a break available. |
| 10501 | if (line.length - start > width && curr > start) { |
| 10502 | result += line.slice(start, curr) + '\n' + line.slice(curr + 1); |
| 10503 | } else { |
| 10504 | result += line.slice(start); |
| 10505 | } |
| 10506 | |
| 10507 | return result.slice(1); // drop extra \n joiner |
| 10508 | } |
| 10509 | |
| 10510 | // Escapes a double-quoted string. |
| 10511 | function escapeString(string) { |
| 10512 | var result = ''; |
| 10513 | var char; |
| 10514 | var escapeSeq; |
| 10515 | |
| 10516 | for (var i = 0; i < string.length; i++) { |
| 10517 | char = string.charCodeAt(i); |
| 10518 | escapeSeq = ESCAPE_SEQUENCES[char]; |
| 10519 | result += !escapeSeq && isPrintable(char) |
| 10520 | ? string[i] |
| 10521 | : escapeSeq || encodeHex(char); |
| 10522 | } |
| 10523 | |
| 10524 | return result; |
| 10525 | } |
| 10526 | |
| 10527 | function writeFlowSequence(state, level, object) { |
| 10528 | var _result = '', |
| 10529 | _tag = state.tag, |
| 10530 | index, |
| 10531 | length; |
| 10532 | |
| 10533 | for (index = 0, length = object.length; index < length; index += 1) { |
| 10534 | // Write only valid elements. |
| 10535 | if (writeNode(state, level, object[index], false, false)) { |
| 10536 | if (index !== 0) _result += ', '; |
| 10537 | _result += state.dump; |
| 10538 | } |
| 10539 | } |
| 10540 | |
| 10541 | state.tag = _tag; |
| 10542 | state.dump = '[' + _result + ']'; |
| 10543 | } |
| 10544 | |
| 10545 | function writeBlockSequence(state, level, object, compact) { |
| 10546 | var _result = '', |
| 10547 | _tag = state.tag, |
| 10548 | index, |
| 10549 | length; |
| 10550 | |
| 10551 | for (index = 0, length = object.length; index < length; index += 1) { |
| 10552 | // Write only valid elements. |
| 10553 | if (writeNode(state, level + 1, object[index], true, true)) { |
| 10554 | if (!compact || index !== 0) { |
| 10555 | _result += generateNextLine(state, level); |
| 10556 | } |
| 10557 | _result += '- ' + state.dump; |
| 10558 | } |
| 10559 | } |
| 10560 | |
| 10561 | state.tag = _tag; |
| 10562 | state.dump = _result || '[]'; // Empty sequence if no valid values. |
| 10563 | } |
| 10564 | |
| 10565 | function writeFlowMapping(state, level, object) { |
| 10566 | var _result = '', |
| 10567 | _tag = state.tag, |
| 10568 | objectKeyList = Object.keys(object), |
| 10569 | index, |
| 10570 | length, |
| 10571 | objectKey, |
| 10572 | objectValue, |
| 10573 | pairBuffer; |
| 10574 | |
| 10575 | for (index = 0, length = objectKeyList.length; index < length; index += 1) { |
| 10576 | pairBuffer = ''; |
| 10577 | |
| 10578 | if (index !== 0) pairBuffer += ', '; |
| 10579 | |
| 10580 | objectKey = objectKeyList[index]; |
| 10581 | objectValue = object[objectKey]; |
| 10582 | |
| 10583 | if (!writeNode(state, level, objectKey, false, false)) { |
| 10584 | continue; // Skip this pair because of invalid key; |
| 10585 | } |
| 10586 | |
| 10587 | if (state.dump.length > 1024) pairBuffer += '? '; |
| 10588 | |
| 10589 | pairBuffer += state.dump + ': '; |
| 10590 | |
| 10591 | if (!writeNode(state, level, objectValue, false, false)) { |
| 10592 | continue; // Skip this pair because of invalid value. |
| 10593 | } |
| 10594 | |
| 10595 | pairBuffer += state.dump; |
| 10596 | |
| 10597 | // Both key and value are valid. |
| 10598 | _result += pairBuffer; |
| 10599 | } |
| 10600 | |
| 10601 | state.tag = _tag; |
| 10602 | state.dump = '{' + _result + '}'; |
| 10603 | } |
| 10604 | |
| 10605 | function writeBlockMapping(state, level, object, compact) { |
| 10606 | var _result = '', |
| 10607 | _tag = state.tag, |
| 10608 | objectKeyList = Object.keys(object), |
| 10609 | index, |
| 10610 | length, |
| 10611 | objectKey, |
| 10612 | objectValue, |
| 10613 | explicitPair, |
| 10614 | pairBuffer; |
| 10615 | |
| 10616 | // Allow sorting keys so that the output file is deterministic |
| 10617 | if (state.sortKeys === true) { |
| 10618 | // Default sorting |
| 10619 | objectKeyList.sort(); |
| 10620 | } else if (typeof state.sortKeys === 'function') { |
| 10621 | // Custom sort function |
| 10622 | objectKeyList.sort(state.sortKeys); |
| 10623 | } else if (state.sortKeys) { |
| 10624 | // Something is wrong |
| 10625 | throw new YAMLException('sortKeys must be a boolean or a function'); |
| 10626 | } |
| 10627 | |
| 10628 | for (index = 0, length = objectKeyList.length; index < length; index += 1) { |
| 10629 | pairBuffer = ''; |
| 10630 | |
| 10631 | if (!compact || index !== 0) { |
| 10632 | pairBuffer += generateNextLine(state, level); |
| 10633 | } |
| 10634 | |
| 10635 | objectKey = objectKeyList[index]; |
| 10636 | objectValue = object[objectKey]; |
| 10637 | |
| 10638 | if (!writeNode(state, level + 1, objectKey, true, true, true)) { |
| 10639 | continue; // Skip this pair because of invalid key. |
| 10640 | } |
| 10641 | |
| 10642 | explicitPair = (state.tag !== null && state.tag !== '?') || |
| 10643 | (state.dump && state.dump.length > 1024); |
| 10644 | |
| 10645 | if (explicitPair) { |
| 10646 | if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { |
| 10647 | pairBuffer += '?'; |
| 10648 | } else { |
| 10649 | pairBuffer += '? '; |
| 10650 | } |
| 10651 | } |
| 10652 | |
| 10653 | pairBuffer += state.dump; |
| 10654 | |
| 10655 | if (explicitPair) { |
| 10656 | pairBuffer += generateNextLine(state, level); |
| 10657 | } |
| 10658 | |
| 10659 | if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { |
| 10660 | continue; // Skip this pair because of invalid value. |
| 10661 | } |
| 10662 | |
| 10663 | if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { |
| 10664 | pairBuffer += ':'; |
| 10665 | } else { |
| 10666 | pairBuffer += ': '; |
| 10667 | } |
| 10668 | |
| 10669 | pairBuffer += state.dump; |
| 10670 | |
| 10671 | // Both key and value are valid. |
| 10672 | _result += pairBuffer; |
| 10673 | } |
| 10674 | |
| 10675 | state.tag = _tag; |
| 10676 | state.dump = _result || '{}'; // Empty mapping if no valid pairs. |
| 10677 | } |
| 10678 | |
| 10679 | function detectType(state, object, explicit) { |
| 10680 | var _result, typeList, index, length, type, style; |
| 10681 | |
| 10682 | typeList = explicit ? state.explicitTypes : state.implicitTypes; |
| 10683 | |
| 10684 | for (index = 0, length = typeList.length; index < length; index += 1) { |
| 10685 | type = typeList[index]; |
| 10686 | |
| 10687 | if ((type.instanceOf || type.predicate) && |
| 10688 | (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) && |
| 10689 | (!type.predicate || type.predicate(object))) { |
| 10690 | |
| 10691 | state.tag = explicit ? type.tag : '?'; |
| 10692 | |
| 10693 | if (type.represent) { |
| 10694 | style = state.styleMap[type.tag] || type.defaultStyle; |
| 10695 | |
| 10696 | if (_toString.call(type.represent) === '[object Function]') { |
| 10697 | _result = type.represent(object, style); |
| 10698 | } else if (_hasOwnProperty.call(type.represent, style)) { |
| 10699 | _result = type.represent[style](object, style); |
| 10700 | } else { |
| 10701 | throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style'); |
| 10702 | } |
| 10703 | |
| 10704 | state.dump = _result; |
| 10705 | } |
| 10706 | |
| 10707 | return true; |
| 10708 | } |
| 10709 | } |
| 10710 | |
| 10711 | return false; |
| 10712 | } |
| 10713 | |
| 10714 | // Serializes `object` and writes it to global `result`. |
| 10715 | // Returns true on success, or false on invalid object. |
| 10716 | // |
| 10717 | function writeNode(state, level, object, block, compact, iskey) { |
| 10718 | state.tag = null; |
| 10719 | state.dump = object; |
| 10720 | |
| 10721 | if (!detectType(state, object, false)) { |
| 10722 | detectType(state, object, true); |
| 10723 | } |
| 10724 | |
| 10725 | var type = _toString.call(state.dump); |
| 10726 | |
| 10727 | if (block) { |
| 10728 | block = (state.flowLevel < 0 || state.flowLevel > level); |
| 10729 | } |
| 10730 | |
| 10731 | var objectOrArray = type === '[object Object]' || type === '[object Array]', |
| 10732 | duplicateIndex, |
| 10733 | duplicate; |
| 10734 | |
| 10735 | if (objectOrArray) { |
| 10736 | duplicateIndex = state.duplicates.indexOf(object); |
| 10737 | duplicate = duplicateIndex !== -1; |
| 10738 | } |
| 10739 | |
| 10740 | if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) { |
| 10741 | compact = false; |
| 10742 | } |
| 10743 | |
| 10744 | if (duplicate && state.usedDuplicates[duplicateIndex]) { |
| 10745 | state.dump = '*ref_' + duplicateIndex; |
| 10746 | } else { |
| 10747 | if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) { |
| 10748 | state.usedDuplicates[duplicateIndex] = true; |
| 10749 | } |
| 10750 | if (type === '[object Object]') { |
| 10751 | if (block && (Object.keys(state.dump).length !== 0)) { |
| 10752 | writeBlockMapping(state, level, state.dump, compact); |
| 10753 | if (duplicate) { |
| 10754 | state.dump = '&ref_' + duplicateIndex + state.dump; |
| 10755 | } |
| 10756 | } else { |
| 10757 | writeFlowMapping(state, level, state.dump); |
| 10758 | if (duplicate) { |
| 10759 | state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; |
| 10760 | } |
| 10761 | } |
| 10762 | } else if (type === '[object Array]') { |
| 10763 | if (block && (state.dump.length !== 0)) { |
| 10764 | writeBlockSequence(state, level, state.dump, compact); |
| 10765 | if (duplicate) { |
| 10766 | state.dump = '&ref_' + duplicateIndex + state.dump; |
| 10767 | } |
| 10768 | } else { |
| 10769 | writeFlowSequence(state, level, state.dump); |
| 10770 | if (duplicate) { |
| 10771 | state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; |
| 10772 | } |
| 10773 | } |
| 10774 | } else if (type === '[object String]') { |
| 10775 | if (state.tag !== '?') { |
| 10776 | writeScalar(state, state.dump, level, iskey); |
| 10777 | } |
| 10778 | } else { |
| 10779 | if (state.skipInvalid) return false; |
| 10780 | throw new YAMLException('unacceptable kind of an object to dump ' + type); |
| 10781 | } |
| 10782 | |
| 10783 | if (state.tag !== null && state.tag !== '?') { |
| 10784 | state.dump = '!<' + state.tag + '> ' + state.dump; |
| 10785 | } |
| 10786 | } |
| 10787 | |
| 10788 | return true; |
| 10789 | } |
| 10790 | |
| 10791 | function getDuplicateReferences(object, state) { |
| 10792 | var objects = [], |
| 10793 | duplicatesIndexes = [], |
| 10794 | index, |
| 10795 | length; |
| 10796 | |
| 10797 | inspectNode(object, objects, duplicatesIndexes); |
| 10798 | |
| 10799 | for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) { |
| 10800 | state.duplicates.push(objects[duplicatesIndexes[index]]); |
| 10801 | } |
| 10802 | state.usedDuplicates = new Array(length); |
| 10803 | } |
| 10804 | |
| 10805 | function inspectNode(object, objects, duplicatesIndexes) { |
| 10806 | var objectKeyList, |
| 10807 | index, |
| 10808 | length; |
| 10809 | |
| 10810 | if (object !== null && typeof object === 'object') { |
| 10811 | index = objects.indexOf(object); |
| 10812 | if (index !== -1) { |
| 10813 | if (duplicatesIndexes.indexOf(index) === -1) { |
| 10814 | duplicatesIndexes.push(index); |
| 10815 | } |
| 10816 | } else { |
| 10817 | objects.push(object); |
| 10818 | |
| 10819 | if (Array.isArray(object)) { |
| 10820 | for (index = 0, length = object.length; index < length; index += 1) { |
| 10821 | inspectNode(object[index], objects, duplicatesIndexes); |
| 10822 | } |
| 10823 | } else { |
| 10824 | objectKeyList = Object.keys(object); |
| 10825 | |
| 10826 | for (index = 0, length = objectKeyList.length; index < length; index += 1) { |
| 10827 | inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes); |
| 10828 | } |
| 10829 | } |
| 10830 | } |
| 10831 | } |
| 10832 | } |
| 10833 | |
| 10834 | function dump(input, options) { |
| 10835 | options = options || {}; |
| 10836 | |
| 10837 | var state = new State(options); |
| 10838 | |
| 10839 | if (!state.noRefs) getDuplicateReferences(input, state); |
| 10840 | |
| 10841 | if (writeNode(state, 0, input, true, true)) return state.dump + '\n'; |
| 10842 | |
| 10843 | return ''; |
| 10844 | } |
| 10845 | |
| 10846 | function safeDump(input, options) { |
| 10847 | return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); |
| 10848 | } |
| 10849 | |
| 10850 | module.exports.dump = dump; |
| 10851 | module.exports.safeDump = safeDump; |
| 10852 | |
| 10853 | },{"./common":21,"./exception":23,"./schema/default_full":28,"./schema/default_safe":29}],23:[function(require,module,exports){ |
| 10854 | // YAML error class. http://stackoverflow.com/questions/8458984 |
| 10855 | // |
| 10856 | 'use strict'; |
| 10857 | |
| 10858 | function YAMLException(reason, mark) { |
| 10859 | // Super constructor |
| 10860 | Error.call(this); |
| 10861 | |
| 10862 | // Include stack trace in error object |
| 10863 | if (Error.captureStackTrace) { |
| 10864 | // Chrome and NodeJS |
| 10865 | Error.captureStackTrace(this, this.constructor); |
| 10866 | } else { |
| 10867 | // FF, IE 10+ and Safari 6+. Fallback for others |
| 10868 | this.stack = (new Error()).stack || ''; |
| 10869 | } |
| 10870 | |
| 10871 | this.name = 'YAMLException'; |
| 10872 | this.reason = reason; |
| 10873 | this.mark = mark; |
| 10874 | this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : ''); |
| 10875 | } |
| 10876 | |
| 10877 | |
| 10878 | // Inherit from Error |
| 10879 | YAMLException.prototype = Object.create(Error.prototype); |
| 10880 | YAMLException.prototype.constructor = YAMLException; |
| 10881 | |
| 10882 | |
| 10883 | YAMLException.prototype.toString = function toString(compact) { |
| 10884 | var result = this.name + ': '; |
| 10885 | |
| 10886 | result += this.reason || '(unknown reason)'; |
| 10887 | |
| 10888 | if (!compact && this.mark) { |
| 10889 | result += ' ' + this.mark.toString(); |
| 10890 | } |
| 10891 | |
| 10892 | return result; |
| 10893 | }; |
| 10894 | |
| 10895 | |
| 10896 | module.exports = YAMLException; |
| 10897 | |
| 10898 | },{}],24:[function(require,module,exports){ |
| 10899 | 'use strict'; |
| 10900 | |
| 10901 | /*eslint-disable max-len,no-use-before-define*/ |
| 10902 | |
| 10903 | var common = require('./common'); |
| 10904 | var YAMLException = require('./exception'); |
| 10905 | var Mark = require('./mark'); |
| 10906 | var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe'); |
| 10907 | var DEFAULT_FULL_SCHEMA = require('./schema/default_full'); |
| 10908 | |
| 10909 | |
| 10910 | var _hasOwnProperty = Object.prototype.hasOwnProperty; |
| 10911 | |
| 10912 | |
| 10913 | var CONTEXT_FLOW_IN = 1; |
| 10914 | var CONTEXT_FLOW_OUT = 2; |
| 10915 | var CONTEXT_BLOCK_IN = 3; |
| 10916 | var CONTEXT_BLOCK_OUT = 4; |
| 10917 | |
| 10918 | |
| 10919 | var CHOMPING_CLIP = 1; |
| 10920 | var CHOMPING_STRIP = 2; |
| 10921 | var CHOMPING_KEEP = 3; |
| 10922 | |
| 10923 | |
| 10924 | var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; |
| 10925 | var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; |
| 10926 | var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; |
| 10927 | var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; |
| 10928 | var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; |
| 10929 | |
| 10930 | |
| 10931 | function is_EOL(c) { |
| 10932 | return (c === 0x0A/* LF */) || (c === 0x0D/* CR */); |
| 10933 | } |
| 10934 | |
| 10935 | function is_WHITE_SPACE(c) { |
| 10936 | return (c === 0x09/* Tab */) || (c === 0x20/* Space */); |
| 10937 | } |
| 10938 | |
| 10939 | function is_WS_OR_EOL(c) { |
| 10940 | return (c === 0x09/* Tab */) || |
| 10941 | (c === 0x20/* Space */) || |
| 10942 | (c === 0x0A/* LF */) || |
| 10943 | (c === 0x0D/* CR */); |
| 10944 | } |
| 10945 | |
| 10946 | function is_FLOW_INDICATOR(c) { |
| 10947 | return c === 0x2C/* , */ || |
| 10948 | c === 0x5B/* [ */ || |
| 10949 | c === 0x5D/* ] */ || |
| 10950 | c === 0x7B/* { */ || |
| 10951 | c === 0x7D/* } */; |
| 10952 | } |
| 10953 | |
| 10954 | function fromHexCode(c) { |
| 10955 | var lc; |
| 10956 | |
| 10957 | if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { |
| 10958 | return c - 0x30; |
| 10959 | } |
| 10960 | |
| 10961 | /*eslint-disable no-bitwise*/ |
| 10962 | lc = c | 0x20; |
| 10963 | |
| 10964 | if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) { |
| 10965 | return lc - 0x61 + 10; |
| 10966 | } |
| 10967 | |
| 10968 | return -1; |
| 10969 | } |
| 10970 | |
| 10971 | function escapedHexLen(c) { |
| 10972 | if (c === 0x78/* x */) { return 2; } |
| 10973 | if (c === 0x75/* u */) { return 4; } |
| 10974 | if (c === 0x55/* U */) { return 8; } |
| 10975 | return 0; |
| 10976 | } |
| 10977 | |
| 10978 | function fromDecimalCode(c) { |
| 10979 | if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { |
| 10980 | return c - 0x30; |
| 10981 | } |
| 10982 | |
| 10983 | return -1; |
| 10984 | } |
| 10985 | |
| 10986 | function simpleEscapeSequence(c) { |
| 10987 | return (c === 0x30/* 0 */) ? '\x00' : |
| 10988 | (c === 0x61/* a */) ? '\x07' : |
| 10989 | (c === 0x62/* b */) ? '\x08' : |
| 10990 | (c === 0x74/* t */) ? '\x09' : |
| 10991 | (c === 0x09/* Tab */) ? '\x09' : |
| 10992 | (c === 0x6E/* n */) ? '\x0A' : |
| 10993 | (c === 0x76/* v */) ? '\x0B' : |
| 10994 | (c === 0x66/* f */) ? '\x0C' : |
| 10995 | (c === 0x72/* r */) ? '\x0D' : |
| 10996 | (c === 0x65/* e */) ? '\x1B' : |
| 10997 | (c === 0x20/* Space */) ? ' ' : |
| 10998 | (c === 0x22/* " */) ? '\x22' : |
| 10999 | (c === 0x2F/* / */) ? '/' : |
| 11000 | (c === 0x5C/* \ */) ? '\x5C' : |
| 11001 | (c === 0x4E/* N */) ? '\x85' : |
| 11002 | (c === 0x5F/* _ */) ? '\xA0' : |
| 11003 | (c === 0x4C/* L */) ? '\u2028' : |
| 11004 | (c === 0x50/* P */) ? '\u2029' : ''; |
| 11005 | } |
| 11006 | |
| 11007 | function charFromCodepoint(c) { |
| 11008 | if (c <= 0xFFFF) { |
| 11009 | return String.fromCharCode(c); |
| 11010 | } |
| 11011 | // Encode UTF-16 surrogate pair |
| 11012 | // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF |
| 11013 | return String.fromCharCode(((c - 0x010000) >> 10) + 0xD800, |
| 11014 | ((c - 0x010000) & 0x03FF) + 0xDC00); |
| 11015 | } |
| 11016 | |
| 11017 | var simpleEscapeCheck = new Array(256); // integer, for fast access |
| 11018 | var simpleEscapeMap = new Array(256); |
| 11019 | for (var i = 0; i < 256; i++) { |
| 11020 | simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; |
| 11021 | simpleEscapeMap[i] = simpleEscapeSequence(i); |
| 11022 | } |
| 11023 | |
| 11024 | |
| 11025 | function State(input, options) { |
| 11026 | this.input = input; |
| 11027 | |
| 11028 | this.filename = options['filename'] || null; |
| 11029 | this.schema = options['schema'] || DEFAULT_FULL_SCHEMA; |
| 11030 | this.onWarning = options['onWarning'] || null; |
| 11031 | this.legacy = options['legacy'] || false; |
| 11032 | this.json = options['json'] || false; |
| 11033 | this.listener = options['listener'] || null; |
| 11034 | |
| 11035 | this.implicitTypes = this.schema.compiledImplicit; |
| 11036 | this.typeMap = this.schema.compiledTypeMap; |
| 11037 | |
| 11038 | this.length = input.length; |
| 11039 | this.position = 0; |
| 11040 | this.line = 0; |
| 11041 | this.lineStart = 0; |
| 11042 | this.lineIndent = 0; |
| 11043 | |
| 11044 | this.documents = []; |
| 11045 | |
| 11046 | /* |
| 11047 | this.version; |
| 11048 | this.checkLineBreaks; |
| 11049 | this.tagMap; |
| 11050 | this.anchorMap; |
| 11051 | this.tag; |
| 11052 | this.anchor; |
| 11053 | this.kind; |
| 11054 | this.result;*/ |
| 11055 | |
| 11056 | } |
| 11057 | |
| 11058 | |
| 11059 | function generateError(state, message) { |
| 11060 | return new YAMLException( |
| 11061 | message, |
| 11062 | new Mark(state.filename, state.input, state.position, state.line, (state.position - state.lineStart))); |
| 11063 | } |
| 11064 | |
| 11065 | function throwError(state, message) { |
| 11066 | throw generateError(state, message); |
| 11067 | } |
| 11068 | |
| 11069 | function throwWarning(state, message) { |
| 11070 | if (state.onWarning) { |
| 11071 | state.onWarning.call(null, generateError(state, message)); |
| 11072 | } |
| 11073 | } |
| 11074 | |
| 11075 | |
| 11076 | var directiveHandlers = { |
| 11077 | |
| 11078 | YAML: function handleYamlDirective(state, name, args) { |
| 11079 | |
| 11080 | var match, major, minor; |
| 11081 | |
| 11082 | if (state.version !== null) { |
| 11083 | throwError(state, 'duplication of %YAML directive'); |
| 11084 | } |
| 11085 | |
| 11086 | if (args.length !== 1) { |
| 11087 | throwError(state, 'YAML directive accepts exactly one argument'); |
| 11088 | } |
| 11089 | |
| 11090 | match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); |
| 11091 | |
| 11092 | if (match === null) { |
| 11093 | throwError(state, 'ill-formed argument of the YAML directive'); |
| 11094 | } |
| 11095 | |
| 11096 | major = parseInt(match[1], 10); |
| 11097 | minor = parseInt(match[2], 10); |
| 11098 | |
| 11099 | if (major !== 1) { |
| 11100 | throwError(state, 'unacceptable YAML version of the document'); |
| 11101 | } |
| 11102 | |
| 11103 | state.version = args[0]; |
| 11104 | state.checkLineBreaks = (minor < 2); |
| 11105 | |
| 11106 | if (minor !== 1 && minor !== 2) { |
| 11107 | throwWarning(state, 'unsupported YAML version of the document'); |
| 11108 | } |
| 11109 | }, |
| 11110 | |
| 11111 | TAG: function handleTagDirective(state, name, args) { |
| 11112 | |
| 11113 | var handle, prefix; |
| 11114 | |
| 11115 | if (args.length !== 2) { |
| 11116 | throwError(state, 'TAG directive accepts exactly two arguments'); |
| 11117 | } |
| 11118 | |
| 11119 | handle = args[0]; |
| 11120 | prefix = args[1]; |
| 11121 | |
| 11122 | if (!PATTERN_TAG_HANDLE.test(handle)) { |
| 11123 | throwError(state, 'ill-formed tag handle (first argument) of the TAG directive'); |
| 11124 | } |
| 11125 | |
| 11126 | if (_hasOwnProperty.call(state.tagMap, handle)) { |
| 11127 | throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); |
| 11128 | } |
| 11129 | |
| 11130 | if (!PATTERN_TAG_URI.test(prefix)) { |
| 11131 | throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive'); |
| 11132 | } |
| 11133 | |
| 11134 | state.tagMap[handle] = prefix; |
| 11135 | } |
| 11136 | }; |
| 11137 | |
| 11138 | |
| 11139 | function captureSegment(state, start, end, checkJson) { |
| 11140 | var _position, _length, _character, _result; |
| 11141 | |
| 11142 | if (start < end) { |
| 11143 | _result = state.input.slice(start, end); |
| 11144 | |
| 11145 | if (checkJson) { |
| 11146 | for (_position = 0, _length = _result.length; |
| 11147 | _position < _length; |
| 11148 | _position += 1) { |
| 11149 | _character = _result.charCodeAt(_position); |
| 11150 | if (!(_character === 0x09 || |
| 11151 | (0x20 <= _character && _character <= 0x10FFFF))) { |
| 11152 | throwError(state, 'expected valid JSON character'); |
| 11153 | } |
| 11154 | } |
| 11155 | } else if (PATTERN_NON_PRINTABLE.test(_result)) { |
| 11156 | throwError(state, 'the stream contains non-printable characters'); |
| 11157 | } |
| 11158 | |
| 11159 | state.result += _result; |
| 11160 | } |
| 11161 | } |
| 11162 | |
| 11163 | function mergeMappings(state, destination, source, overridableKeys) { |
| 11164 | var sourceKeys, key, index, quantity; |
| 11165 | |
| 11166 | if (!common.isObject(source)) { |
| 11167 | throwError(state, 'cannot merge mappings; the provided source object is unacceptable'); |
| 11168 | } |
| 11169 | |
| 11170 | sourceKeys = Object.keys(source); |
| 11171 | |
| 11172 | for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { |
| 11173 | key = sourceKeys[index]; |
| 11174 | |
| 11175 | if (!_hasOwnProperty.call(destination, key)) { |
| 11176 | destination[key] = source[key]; |
| 11177 | overridableKeys[key] = true; |
| 11178 | } |
| 11179 | } |
| 11180 | } |
| 11181 | |
| 11182 | function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode) { |
| 11183 | var index, quantity; |
| 11184 | |
| 11185 | keyNode = String(keyNode); |
| 11186 | |
| 11187 | if (_result === null) { |
| 11188 | _result = {}; |
| 11189 | } |
| 11190 | |
| 11191 | if (keyTag === 'tag:yaml.org,2002:merge') { |
| 11192 | if (Array.isArray(valueNode)) { |
| 11193 | for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { |
| 11194 | mergeMappings(state, _result, valueNode[index], overridableKeys); |
| 11195 | } |
| 11196 | } else { |
| 11197 | mergeMappings(state, _result, valueNode, overridableKeys); |
| 11198 | } |
| 11199 | } else { |
| 11200 | if (!state.json && |
| 11201 | !_hasOwnProperty.call(overridableKeys, keyNode) && |
| 11202 | _hasOwnProperty.call(_result, keyNode)) { |
| 11203 | throwError(state, 'duplicated mapping key'); |
| 11204 | } |
| 11205 | _result[keyNode] = valueNode; |
| 11206 | delete overridableKeys[keyNode]; |
| 11207 | } |
| 11208 | |
| 11209 | return _result; |
| 11210 | } |
| 11211 | |
| 11212 | function readLineBreak(state) { |
| 11213 | var ch; |
| 11214 | |
| 11215 | ch = state.input.charCodeAt(state.position); |
| 11216 | |
| 11217 | if (ch === 0x0A/* LF */) { |
| 11218 | state.position++; |
| 11219 | } else if (ch === 0x0D/* CR */) { |
| 11220 | state.position++; |
| 11221 | if (state.input.charCodeAt(state.position) === 0x0A/* LF */) { |
| 11222 | state.position++; |
| 11223 | } |
| 11224 | } else { |
| 11225 | throwError(state, 'a line break is expected'); |
| 11226 | } |
| 11227 | |
| 11228 | state.line += 1; |
| 11229 | state.lineStart = state.position; |
| 11230 | } |
| 11231 | |
| 11232 | function skipSeparationSpace(state, allowComments, checkIndent) { |
| 11233 | var lineBreaks = 0, |
| 11234 | ch = state.input.charCodeAt(state.position); |
| 11235 | |
| 11236 | while (ch !== 0) { |
| 11237 | while (is_WHITE_SPACE(ch)) { |
| 11238 | ch = state.input.charCodeAt(++state.position); |
| 11239 | } |
| 11240 | |
| 11241 | if (allowComments && ch === 0x23/* # */) { |
| 11242 | do { |
| 11243 | ch = state.input.charCodeAt(++state.position); |
| 11244 | } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0); |
| 11245 | } |
| 11246 | |
| 11247 | if (is_EOL(ch)) { |
| 11248 | readLineBreak(state); |
| 11249 | |
| 11250 | ch = state.input.charCodeAt(state.position); |
| 11251 | lineBreaks++; |
| 11252 | state.lineIndent = 0; |
| 11253 | |
| 11254 | while (ch === 0x20/* Space */) { |
| 11255 | state.lineIndent++; |
| 11256 | ch = state.input.charCodeAt(++state.position); |
| 11257 | } |
| 11258 | } else { |
| 11259 | break; |
| 11260 | } |
| 11261 | } |
| 11262 | |
| 11263 | if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) { |
| 11264 | throwWarning(state, 'deficient indentation'); |
| 11265 | } |
| 11266 | |
| 11267 | return lineBreaks; |
| 11268 | } |
| 11269 | |
| 11270 | function testDocumentSeparator(state) { |
| 11271 | var _position = state.position, |
| 11272 | ch; |
| 11273 | |
| 11274 | ch = state.input.charCodeAt(_position); |
| 11275 | |
| 11276 | // Condition state.position === state.lineStart is tested |
| 11277 | // in parent on each call, for efficiency. No needs to test here again. |
| 11278 | if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) && |
| 11279 | ch === state.input.charCodeAt(_position + 1) && |
| 11280 | ch === state.input.charCodeAt(_position + 2)) { |
| 11281 | |
| 11282 | _position += 3; |
| 11283 | |
| 11284 | ch = state.input.charCodeAt(_position); |
| 11285 | |
| 11286 | if (ch === 0 || is_WS_OR_EOL(ch)) { |
| 11287 | return true; |
| 11288 | } |
| 11289 | } |
| 11290 | |
| 11291 | return false; |
| 11292 | } |
| 11293 | |
| 11294 | function writeFoldedLines(state, count) { |
| 11295 | if (count === 1) { |
| 11296 | state.result += ' '; |
| 11297 | } else if (count > 1) { |
| 11298 | state.result += common.repeat('\n', count - 1); |
| 11299 | } |
| 11300 | } |
| 11301 | |
| 11302 | |
| 11303 | function readPlainScalar(state, nodeIndent, withinFlowCollection) { |
| 11304 | var preceding, |
| 11305 | following, |
| 11306 | captureStart, |
| 11307 | captureEnd, |
| 11308 | hasPendingContent, |
| 11309 | _line, |
| 11310 | _lineStart, |
| 11311 | _lineIndent, |
| 11312 | _kind = state.kind, |
| 11313 | _result = state.result, |
| 11314 | ch; |
| 11315 | |
| 11316 | ch = state.input.charCodeAt(state.position); |
| 11317 | |
| 11318 | if (is_WS_OR_EOL(ch) || |
| 11319 | is_FLOW_INDICATOR(ch) || |
| 11320 | ch === 0x23/* # */ || |
| 11321 | ch === 0x26/* & */ || |
| 11322 | ch === 0x2A/* * */ || |
| 11323 | ch === 0x21/* ! */ || |
| 11324 | ch === 0x7C/* | */ || |
| 11325 | ch === 0x3E/* > */ || |
| 11326 | ch === 0x27/* ' */ || |
| 11327 | ch === 0x22/* " */ || |
| 11328 | ch === 0x25/* % */ || |
| 11329 | ch === 0x40/* @ */ || |
| 11330 | ch === 0x60/* ` */) { |
| 11331 | return false; |
| 11332 | } |
| 11333 | |
| 11334 | if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) { |
| 11335 | following = state.input.charCodeAt(state.position + 1); |
| 11336 | |
| 11337 | if (is_WS_OR_EOL(following) || |
| 11338 | withinFlowCollection && is_FLOW_INDICATOR(following)) { |
| 11339 | return false; |
| 11340 | } |
| 11341 | } |
| 11342 | |
| 11343 | state.kind = 'scalar'; |
| 11344 | state.result = ''; |
| 11345 | captureStart = captureEnd = state.position; |
| 11346 | hasPendingContent = false; |
| 11347 | |
| 11348 | while (ch !== 0) { |
| 11349 | if (ch === 0x3A/* : */) { |
| 11350 | following = state.input.charCodeAt(state.position + 1); |
| 11351 | |
| 11352 | if (is_WS_OR_EOL(following) || |
| 11353 | withinFlowCollection && is_FLOW_INDICATOR(following)) { |
| 11354 | break; |
| 11355 | } |
| 11356 | |
| 11357 | } else if (ch === 0x23/* # */) { |
| 11358 | preceding = state.input.charCodeAt(state.position - 1); |
| 11359 | |
| 11360 | if (is_WS_OR_EOL(preceding)) { |
| 11361 | break; |
| 11362 | } |
| 11363 | |
| 11364 | } else if ((state.position === state.lineStart && testDocumentSeparator(state)) || |
| 11365 | withinFlowCollection && is_FLOW_INDICATOR(ch)) { |
| 11366 | break; |
| 11367 | |
| 11368 | } else if (is_EOL(ch)) { |
| 11369 | _line = state.line; |
| 11370 | _lineStart = state.lineStart; |
| 11371 | _lineIndent = state.lineIndent; |
| 11372 | skipSeparationSpace(state, false, -1); |
| 11373 | |
| 11374 | if (state.lineIndent >= nodeIndent) { |
| 11375 | hasPendingContent = true; |
| 11376 | ch = state.input.charCodeAt(state.position); |
| 11377 | continue; |
| 11378 | } else { |
| 11379 | state.position = captureEnd; |
| 11380 | state.line = _line; |
| 11381 | state.lineStart = _lineStart; |
| 11382 | state.lineIndent = _lineIndent; |
| 11383 | break; |
| 11384 | } |
| 11385 | } |
| 11386 | |
| 11387 | if (hasPendingContent) { |
| 11388 | captureSegment(state, captureStart, captureEnd, false); |
| 11389 | writeFoldedLines(state, state.line - _line); |
| 11390 | captureStart = captureEnd = state.position; |
| 11391 | hasPendingContent = false; |
| 11392 | } |
| 11393 | |
| 11394 | if (!is_WHITE_SPACE(ch)) { |
| 11395 | captureEnd = state.position + 1; |
| 11396 | } |
| 11397 | |
| 11398 | ch = state.input.charCodeAt(++state.position); |
| 11399 | } |
| 11400 | |
| 11401 | captureSegment(state, captureStart, captureEnd, false); |
| 11402 | |
| 11403 | if (state.result) { |
| 11404 | return true; |
| 11405 | } |
| 11406 | |
| 11407 | state.kind = _kind; |
| 11408 | state.result = _result; |
| 11409 | return false; |
| 11410 | } |
| 11411 | |
| 11412 | function readSingleQuotedScalar(state, nodeIndent) { |
| 11413 | var ch, |
| 11414 | captureStart, captureEnd; |
| 11415 | |
| 11416 | ch = state.input.charCodeAt(state.position); |
| 11417 | |
| 11418 | if (ch !== 0x27/* ' */) { |
| 11419 | return false; |
| 11420 | } |
| 11421 | |
| 11422 | state.kind = 'scalar'; |
| 11423 | state.result = ''; |
| 11424 | state.position++; |
| 11425 | captureStart = captureEnd = state.position; |
| 11426 | |
| 11427 | while ((ch = state.input.charCodeAt(state.position)) !== 0) { |
| 11428 | if (ch === 0x27/* ' */) { |
| 11429 | captureSegment(state, captureStart, state.position, true); |
| 11430 | ch = state.input.charCodeAt(++state.position); |
| 11431 | |
| 11432 | if (ch === 0x27/* ' */) { |
| 11433 | captureStart = captureEnd = state.position; |
| 11434 | state.position++; |
| 11435 | } else { |
| 11436 | return true; |
| 11437 | } |
| 11438 | |
| 11439 | } else if (is_EOL(ch)) { |
| 11440 | captureSegment(state, captureStart, captureEnd, true); |
| 11441 | writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); |
| 11442 | captureStart = captureEnd = state.position; |
| 11443 | |
| 11444 | } else if (state.position === state.lineStart && testDocumentSeparator(state)) { |
| 11445 | throwError(state, 'unexpected end of the document within a single quoted scalar'); |
| 11446 | |
| 11447 | } else { |
| 11448 | state.position++; |
| 11449 | captureEnd = state.position; |
| 11450 | } |
| 11451 | } |
| 11452 | |
| 11453 | throwError(state, 'unexpected end of the stream within a single quoted scalar'); |
| 11454 | } |
| 11455 | |
| 11456 | function readDoubleQuotedScalar(state, nodeIndent) { |
| 11457 | var captureStart, |
| 11458 | captureEnd, |
| 11459 | hexLength, |
| 11460 | hexResult, |
| 11461 | tmp, |
| 11462 | ch; |
| 11463 | |
| 11464 | ch = state.input.charCodeAt(state.position); |
| 11465 | |
| 11466 | if (ch !== 0x22/* " */) { |
| 11467 | return false; |
| 11468 | } |
| 11469 | |
| 11470 | state.kind = 'scalar'; |
| 11471 | state.result = ''; |
| 11472 | state.position++; |
| 11473 | captureStart = captureEnd = state.position; |
| 11474 | |
| 11475 | while ((ch = state.input.charCodeAt(state.position)) !== 0) { |
| 11476 | if (ch === 0x22/* " */) { |
| 11477 | captureSegment(state, captureStart, state.position, true); |
| 11478 | state.position++; |
| 11479 | return true; |
| 11480 | |
| 11481 | } else if (ch === 0x5C/* \ */) { |
| 11482 | captureSegment(state, captureStart, state.position, true); |
| 11483 | ch = state.input.charCodeAt(++state.position); |
| 11484 | |
| 11485 | if (is_EOL(ch)) { |
| 11486 | skipSeparationSpace(state, false, nodeIndent); |
| 11487 | |
| 11488 | // TODO: rework to inline fn with no type cast? |
| 11489 | } else if (ch < 256 && simpleEscapeCheck[ch]) { |
| 11490 | state.result += simpleEscapeMap[ch]; |
| 11491 | state.position++; |
| 11492 | |
| 11493 | } else if ((tmp = escapedHexLen(ch)) > 0) { |
| 11494 | hexLength = tmp; |
| 11495 | hexResult = 0; |
| 11496 | |
| 11497 | for (; hexLength > 0; hexLength--) { |
| 11498 | ch = state.input.charCodeAt(++state.position); |
| 11499 | |
| 11500 | if ((tmp = fromHexCode(ch)) >= 0) { |
| 11501 | hexResult = (hexResult << 4) + tmp; |
| 11502 | |
| 11503 | } else { |
| 11504 | throwError(state, 'expected hexadecimal character'); |
| 11505 | } |
| 11506 | } |
| 11507 | |
| 11508 | state.result += charFromCodepoint(hexResult); |
| 11509 | |
| 11510 | state.position++; |
| 11511 | |
| 11512 | } else { |
| 11513 | throwError(state, 'unknown escape sequence'); |
| 11514 | } |
| 11515 | |
| 11516 | captureStart = captureEnd = state.position; |
| 11517 | |
| 11518 | } else if (is_EOL(ch)) { |
| 11519 | captureSegment(state, captureStart, captureEnd, true); |
| 11520 | writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); |
| 11521 | captureStart = captureEnd = state.position; |
| 11522 | |
| 11523 | } else if (state.position === state.lineStart && testDocumentSeparator(state)) { |
| 11524 | throwError(state, 'unexpected end of the document within a double quoted scalar'); |
| 11525 | |
| 11526 | } else { |
| 11527 | state.position++; |
| 11528 | captureEnd = state.position; |
| 11529 | } |
| 11530 | } |
| 11531 | |
| 11532 | throwError(state, 'unexpected end of the stream within a double quoted scalar'); |
| 11533 | } |
| 11534 | |
| 11535 | function readFlowCollection(state, nodeIndent) { |
| 11536 | var readNext = true, |
| 11537 | _line, |
| 11538 | _tag = state.tag, |
| 11539 | _result, |
| 11540 | _anchor = state.anchor, |
| 11541 | following, |
| 11542 | terminator, |
| 11543 | isPair, |
| 11544 | isExplicitPair, |
| 11545 | isMapping, |
| 11546 | overridableKeys = {}, |
| 11547 | keyNode, |
| 11548 | keyTag, |
| 11549 | valueNode, |
| 11550 | ch; |
| 11551 | |
| 11552 | ch = state.input.charCodeAt(state.position); |
| 11553 | |
| 11554 | if (ch === 0x5B/* [ */) { |
| 11555 | terminator = 0x5D;/* ] */ |
| 11556 | isMapping = false; |
| 11557 | _result = []; |
| 11558 | } else if (ch === 0x7B/* { */) { |
| 11559 | terminator = 0x7D;/* } */ |
| 11560 | isMapping = true; |
| 11561 | _result = {}; |
| 11562 | } else { |
| 11563 | return false; |
| 11564 | } |
| 11565 | |
| 11566 | if (state.anchor !== null) { |
| 11567 | state.anchorMap[state.anchor] = _result; |
| 11568 | } |
| 11569 | |
| 11570 | ch = state.input.charCodeAt(++state.position); |
| 11571 | |
| 11572 | while (ch !== 0) { |
| 11573 | skipSeparationSpace(state, true, nodeIndent); |
| 11574 | |
| 11575 | ch = state.input.charCodeAt(state.position); |
| 11576 | |
| 11577 | if (ch === terminator) { |
| 11578 | state.position++; |
| 11579 | state.tag = _tag; |
| 11580 | state.anchor = _anchor; |
| 11581 | state.kind = isMapping ? 'mapping' : 'sequence'; |
| 11582 | state.result = _result; |
| 11583 | return true; |
| 11584 | } else if (!readNext) { |
| 11585 | throwError(state, 'missed comma between flow collection entries'); |
| 11586 | } |
| 11587 | |
| 11588 | keyTag = keyNode = valueNode = null; |
| 11589 | isPair = isExplicitPair = false; |
| 11590 | |
| 11591 | if (ch === 0x3F/* ? */) { |
| 11592 | following = state.input.charCodeAt(state.position + 1); |
| 11593 | |
| 11594 | if (is_WS_OR_EOL(following)) { |
| 11595 | isPair = isExplicitPair = true; |
| 11596 | state.position++; |
| 11597 | skipSeparationSpace(state, true, nodeIndent); |
| 11598 | } |
| 11599 | } |
| 11600 | |
| 11601 | _line = state.line; |
| 11602 | composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); |
| 11603 | keyTag = state.tag; |
| 11604 | keyNode = state.result; |
| 11605 | skipSeparationSpace(state, true, nodeIndent); |
| 11606 | |
| 11607 | ch = state.input.charCodeAt(state.position); |
| 11608 | |
| 11609 | if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) { |
| 11610 | isPair = true; |
| 11611 | ch = state.input.charCodeAt(++state.position); |
| 11612 | skipSeparationSpace(state, true, nodeIndent); |
| 11613 | composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); |
| 11614 | valueNode = state.result; |
| 11615 | } |
| 11616 | |
| 11617 | if (isMapping) { |
| 11618 | storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode); |
| 11619 | } else if (isPair) { |
| 11620 | _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode)); |
| 11621 | } else { |
| 11622 | _result.push(keyNode); |
| 11623 | } |
| 11624 | |
| 11625 | skipSeparationSpace(state, true, nodeIndent); |
| 11626 | |
| 11627 | ch = state.input.charCodeAt(state.position); |
| 11628 | |
| 11629 | if (ch === 0x2C/* , */) { |
| 11630 | readNext = true; |
| 11631 | ch = state.input.charCodeAt(++state.position); |
| 11632 | } else { |
| 11633 | readNext = false; |
| 11634 | } |
| 11635 | } |
| 11636 | |
| 11637 | throwError(state, 'unexpected end of the stream within a flow collection'); |
| 11638 | } |
| 11639 | |
| 11640 | function readBlockScalar(state, nodeIndent) { |
| 11641 | var captureStart, |
| 11642 | folding, |
| 11643 | chomping = CHOMPING_CLIP, |
| 11644 | didReadContent = false, |
| 11645 | detectedIndent = false, |
| 11646 | textIndent = nodeIndent, |
| 11647 | emptyLines = 0, |
| 11648 | atMoreIndented = false, |
| 11649 | tmp, |
| 11650 | ch; |
| 11651 | |
| 11652 | ch = state.input.charCodeAt(state.position); |
| 11653 | |
| 11654 | if (ch === 0x7C/* | */) { |
| 11655 | folding = false; |
| 11656 | } else if (ch === 0x3E/* > */) { |
| 11657 | folding = true; |
| 11658 | } else { |
| 11659 | return false; |
| 11660 | } |
| 11661 | |
| 11662 | state.kind = 'scalar'; |
| 11663 | state.result = ''; |
| 11664 | |
| 11665 | while (ch !== 0) { |
| 11666 | ch = state.input.charCodeAt(++state.position); |
| 11667 | |
| 11668 | if (ch === 0x2B/* + */ || ch === 0x2D/* - */) { |
| 11669 | if (CHOMPING_CLIP === chomping) { |
| 11670 | chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP; |
| 11671 | } else { |
| 11672 | throwError(state, 'repeat of a chomping mode identifier'); |
| 11673 | } |
| 11674 | |
| 11675 | } else if ((tmp = fromDecimalCode(ch)) >= 0) { |
| 11676 | if (tmp === 0) { |
| 11677 | throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one'); |
| 11678 | } else if (!detectedIndent) { |
| 11679 | textIndent = nodeIndent + tmp - 1; |
| 11680 | detectedIndent = true; |
| 11681 | } else { |
| 11682 | throwError(state, 'repeat of an indentation width identifier'); |
| 11683 | } |
| 11684 | |
| 11685 | } else { |
| 11686 | break; |
| 11687 | } |
| 11688 | } |
| 11689 | |
| 11690 | if (is_WHITE_SPACE(ch)) { |
| 11691 | do { ch = state.input.charCodeAt(++state.position); } |
| 11692 | while (is_WHITE_SPACE(ch)); |
| 11693 | |
| 11694 | if (ch === 0x23/* # */) { |
| 11695 | do { ch = state.input.charCodeAt(++state.position); } |
| 11696 | while (!is_EOL(ch) && (ch !== 0)); |
| 11697 | } |
| 11698 | } |
| 11699 | |
| 11700 | while (ch !== 0) { |
| 11701 | readLineBreak(state); |
| 11702 | state.lineIndent = 0; |
| 11703 | |
| 11704 | ch = state.input.charCodeAt(state.position); |
| 11705 | |
| 11706 | while ((!detectedIndent || state.lineIndent < textIndent) && |
| 11707 | (ch === 0x20/* Space */)) { |
| 11708 | state.lineIndent++; |
| 11709 | ch = state.input.charCodeAt(++state.position); |
| 11710 | } |
| 11711 | |
| 11712 | if (!detectedIndent && state.lineIndent > textIndent) { |
| 11713 | textIndent = state.lineIndent; |
| 11714 | } |
| 11715 | |
| 11716 | if (is_EOL(ch)) { |
| 11717 | emptyLines++; |
| 11718 | continue; |
| 11719 | } |
| 11720 | |
| 11721 | // End of the scalar. |
| 11722 | if (state.lineIndent < textIndent) { |
| 11723 | |
| 11724 | // Perform the chomping. |
| 11725 | if (chomping === CHOMPING_KEEP) { |
| 11726 | state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); |
| 11727 | } else if (chomping === CHOMPING_CLIP) { |
| 11728 | if (didReadContent) { // i.e. only if the scalar is not empty. |
| 11729 | state.result += '\n'; |
| 11730 | } |
| 11731 | } |
| 11732 | |
| 11733 | // Break this `while` cycle and go to the funciton's epilogue. |
| 11734 | break; |
| 11735 | } |
| 11736 | |
| 11737 | // Folded style: use fancy rules to handle line breaks. |
| 11738 | if (folding) { |
| 11739 | |
| 11740 | // Lines starting with white space characters (more-indented lines) are not folded. |
| 11741 | if (is_WHITE_SPACE(ch)) { |
| 11742 | atMoreIndented = true; |
| 11743 | // except for the first content line (cf. Example 8.1) |
| 11744 | state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); |
| 11745 | |
| 11746 | // End of more-indented block. |
| 11747 | } else if (atMoreIndented) { |
| 11748 | atMoreIndented = false; |
| 11749 | state.result += common.repeat('\n', emptyLines + 1); |
| 11750 | |
| 11751 | // Just one line break - perceive as the same line. |
| 11752 | } else if (emptyLines === 0) { |
| 11753 | if (didReadContent) { // i.e. only if we have already read some scalar content. |
| 11754 | state.result += ' '; |
| 11755 | } |
| 11756 | |
| 11757 | // Several line breaks - perceive as different lines. |
| 11758 | } else { |
| 11759 | state.result += common.repeat('\n', emptyLines); |
| 11760 | } |
| 11761 | |
| 11762 | // Literal style: just add exact number of line breaks between content lines. |
| 11763 | } else { |
| 11764 | // Keep all line breaks except the header line break. |
| 11765 | state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); |
| 11766 | } |
| 11767 | |
| 11768 | didReadContent = true; |
| 11769 | detectedIndent = true; |
| 11770 | emptyLines = 0; |
| 11771 | captureStart = state.position; |
| 11772 | |
| 11773 | while (!is_EOL(ch) && (ch !== 0)) { |
| 11774 | ch = state.input.charCodeAt(++state.position); |
| 11775 | } |
| 11776 | |
| 11777 | captureSegment(state, captureStart, state.position, false); |
| 11778 | } |
| 11779 | |
| 11780 | return true; |
| 11781 | } |
| 11782 | |
| 11783 | function readBlockSequence(state, nodeIndent) { |
| 11784 | var _line, |
| 11785 | _tag = state.tag, |
| 11786 | _anchor = state.anchor, |
| 11787 | _result = [], |
| 11788 | following, |
| 11789 | detected = false, |
| 11790 | ch; |
| 11791 | |
| 11792 | if (state.anchor !== null) { |
| 11793 | state.anchorMap[state.anchor] = _result; |
| 11794 | } |
| 11795 | |
| 11796 | ch = state.input.charCodeAt(state.position); |
| 11797 | |
| 11798 | while (ch !== 0) { |
| 11799 | |
| 11800 | if (ch !== 0x2D/* - */) { |
| 11801 | break; |
| 11802 | } |
| 11803 | |
| 11804 | following = state.input.charCodeAt(state.position + 1); |
| 11805 | |
| 11806 | if (!is_WS_OR_EOL(following)) { |
| 11807 | break; |
| 11808 | } |
| 11809 | |
| 11810 | detected = true; |
| 11811 | state.position++; |
| 11812 | |
| 11813 | if (skipSeparationSpace(state, true, -1)) { |
| 11814 | if (state.lineIndent <= nodeIndent) { |
| 11815 | _result.push(null); |
| 11816 | ch = state.input.charCodeAt(state.position); |
| 11817 | continue; |
| 11818 | } |
| 11819 | } |
| 11820 | |
| 11821 | _line = state.line; |
| 11822 | composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); |
| 11823 | _result.push(state.result); |
| 11824 | skipSeparationSpace(state, true, -1); |
| 11825 | |
| 11826 | ch = state.input.charCodeAt(state.position); |
| 11827 | |
| 11828 | if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { |
| 11829 | throwError(state, 'bad indentation of a sequence entry'); |
| 11830 | } else if (state.lineIndent < nodeIndent) { |
| 11831 | break; |
| 11832 | } |
| 11833 | } |
| 11834 | |
| 11835 | if (detected) { |
| 11836 | state.tag = _tag; |
| 11837 | state.anchor = _anchor; |
| 11838 | state.kind = 'sequence'; |
| 11839 | state.result = _result; |
| 11840 | return true; |
| 11841 | } |
| 11842 | return false; |
| 11843 | } |
| 11844 | |
| 11845 | function readBlockMapping(state, nodeIndent, flowIndent) { |
| 11846 | var following, |
| 11847 | allowCompact, |
| 11848 | _line, |
| 11849 | _tag = state.tag, |
| 11850 | _anchor = state.anchor, |
| 11851 | _result = {}, |
| 11852 | overridableKeys = {}, |
| 11853 | keyTag = null, |
| 11854 | keyNode = null, |
| 11855 | valueNode = null, |
| 11856 | atExplicitKey = false, |
| 11857 | detected = false, |
| 11858 | ch; |
| 11859 | |
| 11860 | if (state.anchor !== null) { |
| 11861 | state.anchorMap[state.anchor] = _result; |
| 11862 | } |
| 11863 | |
| 11864 | ch = state.input.charCodeAt(state.position); |
| 11865 | |
| 11866 | while (ch !== 0) { |
| 11867 | following = state.input.charCodeAt(state.position + 1); |
| 11868 | _line = state.line; // Save the current line. |
| 11869 | |
| 11870 | // |
| 11871 | // Explicit notation case. There are two separate blocks: |
| 11872 | // first for the key (denoted by "?") and second for the value (denoted by ":") |
| 11873 | // |
| 11874 | if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) { |
| 11875 | |
| 11876 | if (ch === 0x3F/* ? */) { |
| 11877 | if (atExplicitKey) { |
| 11878 | storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); |
| 11879 | keyTag = keyNode = valueNode = null; |
| 11880 | } |
| 11881 | |
| 11882 | detected = true; |
| 11883 | atExplicitKey = true; |
| 11884 | allowCompact = true; |
| 11885 | |
| 11886 | } else if (atExplicitKey) { |
| 11887 | // i.e. 0x3A/* : */ === character after the explicit key. |
| 11888 | atExplicitKey = false; |
| 11889 | allowCompact = true; |
| 11890 | |
| 11891 | } else { |
| 11892 | throwError(state, 'incomplete explicit mapping pair; a key node is missed'); |
| 11893 | } |
| 11894 | |
| 11895 | state.position += 1; |
| 11896 | ch = following; |
| 11897 | |
| 11898 | // |
| 11899 | // Implicit notation case. Flow-style node as the key first, then ":", and the value. |
| 11900 | // |
| 11901 | } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { |
| 11902 | |
| 11903 | if (state.line === _line) { |
| 11904 | ch = state.input.charCodeAt(state.position); |
| 11905 | |
| 11906 | while (is_WHITE_SPACE(ch)) { |
| 11907 | ch = state.input.charCodeAt(++state.position); |
| 11908 | } |
| 11909 | |
| 11910 | if (ch === 0x3A/* : */) { |
| 11911 | ch = state.input.charCodeAt(++state.position); |
| 11912 | |
| 11913 | if (!is_WS_OR_EOL(ch)) { |
| 11914 | throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping'); |
| 11915 | } |
| 11916 | |
| 11917 | if (atExplicitKey) { |
| 11918 | storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); |
| 11919 | keyTag = keyNode = valueNode = null; |
| 11920 | } |
| 11921 | |
| 11922 | detected = true; |
| 11923 | atExplicitKey = false; |
| 11924 | allowCompact = false; |
| 11925 | keyTag = state.tag; |
| 11926 | keyNode = state.result; |
| 11927 | |
| 11928 | } else if (detected) { |
| 11929 | throwError(state, 'can not read an implicit mapping pair; a colon is missed'); |
| 11930 | |
| 11931 | } else { |
| 11932 | state.tag = _tag; |
| 11933 | state.anchor = _anchor; |
| 11934 | return true; // Keep the result of `composeNode`. |
| 11935 | } |
| 11936 | |
| 11937 | } else if (detected) { |
| 11938 | throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); |
| 11939 | |
| 11940 | } else { |
| 11941 | state.tag = _tag; |
| 11942 | state.anchor = _anchor; |
| 11943 | return true; // Keep the result of `composeNode`. |
| 11944 | } |
| 11945 | |
| 11946 | } else { |
| 11947 | break; // Reading is done. Go to the epilogue. |
| 11948 | } |
| 11949 | |
| 11950 | // |
| 11951 | // Common reading code for both explicit and implicit notations. |
| 11952 | // |
| 11953 | if (state.line === _line || state.lineIndent > nodeIndent) { |
| 11954 | if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { |
| 11955 | if (atExplicitKey) { |
| 11956 | keyNode = state.result; |
| 11957 | } else { |
| 11958 | valueNode = state.result; |
| 11959 | } |
| 11960 | } |
| 11961 | |
| 11962 | if (!atExplicitKey) { |
| 11963 | storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode); |
| 11964 | keyTag = keyNode = valueNode = null; |
| 11965 | } |
| 11966 | |
| 11967 | skipSeparationSpace(state, true, -1); |
| 11968 | ch = state.input.charCodeAt(state.position); |
| 11969 | } |
| 11970 | |
| 11971 | if (state.lineIndent > nodeIndent && (ch !== 0)) { |
| 11972 | throwError(state, 'bad indentation of a mapping entry'); |
| 11973 | } else if (state.lineIndent < nodeIndent) { |
| 11974 | break; |
| 11975 | } |
| 11976 | } |
| 11977 | |
| 11978 | // |
| 11979 | // Epilogue. |
| 11980 | // |
| 11981 | |
| 11982 | // Special case: last mapping's node contains only the key in explicit notation. |
| 11983 | if (atExplicitKey) { |
| 11984 | storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); |
| 11985 | } |
| 11986 | |
| 11987 | // Expose the resulting mapping. |
| 11988 | if (detected) { |
| 11989 | state.tag = _tag; |
| 11990 | state.anchor = _anchor; |
| 11991 | state.kind = 'mapping'; |
| 11992 | state.result = _result; |
| 11993 | } |
| 11994 | |
| 11995 | return detected; |
| 11996 | } |
| 11997 | |
| 11998 | function readTagProperty(state) { |
| 11999 | var _position, |
| 12000 | isVerbatim = false, |
| 12001 | isNamed = false, |
| 12002 | tagHandle, |
| 12003 | tagName, |
| 12004 | ch; |
| 12005 | |
| 12006 | ch = state.input.charCodeAt(state.position); |
| 12007 | |
| 12008 | if (ch !== 0x21/* ! */) return false; |
| 12009 | |
| 12010 | if (state.tag !== null) { |
| 12011 | throwError(state, 'duplication of a tag property'); |
| 12012 | } |
| 12013 | |
| 12014 | ch = state.input.charCodeAt(++state.position); |
| 12015 | |
| 12016 | if (ch === 0x3C/* < */) { |
| 12017 | isVerbatim = true; |
| 12018 | ch = state.input.charCodeAt(++state.position); |
| 12019 | |
| 12020 | } else if (ch === 0x21/* ! */) { |
| 12021 | isNamed = true; |
| 12022 | tagHandle = '!!'; |
| 12023 | ch = state.input.charCodeAt(++state.position); |
| 12024 | |
| 12025 | } else { |
| 12026 | tagHandle = '!'; |
| 12027 | } |
| 12028 | |
| 12029 | _position = state.position; |
| 12030 | |
| 12031 | if (isVerbatim) { |
| 12032 | do { ch = state.input.charCodeAt(++state.position); } |
| 12033 | while (ch !== 0 && ch !== 0x3E/* > */); |
| 12034 | |
| 12035 | if (state.position < state.length) { |
| 12036 | tagName = state.input.slice(_position, state.position); |
| 12037 | ch = state.input.charCodeAt(++state.position); |
| 12038 | } else { |
| 12039 | throwError(state, 'unexpected end of the stream within a verbatim tag'); |
| 12040 | } |
| 12041 | } else { |
| 12042 | while (ch !== 0 && !is_WS_OR_EOL(ch)) { |
| 12043 | |
| 12044 | if (ch === 0x21/* ! */) { |
| 12045 | if (!isNamed) { |
| 12046 | tagHandle = state.input.slice(_position - 1, state.position + 1); |
| 12047 | |
| 12048 | if (!PATTERN_TAG_HANDLE.test(tagHandle)) { |
| 12049 | throwError(state, 'named tag handle cannot contain such characters'); |
| 12050 | } |
| 12051 | |
| 12052 | isNamed = true; |
| 12053 | _position = state.position + 1; |
| 12054 | } else { |
| 12055 | throwError(state, 'tag suffix cannot contain exclamation marks'); |
| 12056 | } |
| 12057 | } |
| 12058 | |
| 12059 | ch = state.input.charCodeAt(++state.position); |
| 12060 | } |
| 12061 | |
| 12062 | tagName = state.input.slice(_position, state.position); |
| 12063 | |
| 12064 | if (PATTERN_FLOW_INDICATORS.test(tagName)) { |
| 12065 | throwError(state, 'tag suffix cannot contain flow indicator characters'); |
| 12066 | } |
| 12067 | } |
| 12068 | |
| 12069 | if (tagName && !PATTERN_TAG_URI.test(tagName)) { |
| 12070 | throwError(state, 'tag name cannot contain such characters: ' + tagName); |
| 12071 | } |
| 12072 | |
| 12073 | if (isVerbatim) { |
| 12074 | state.tag = tagName; |
| 12075 | |
| 12076 | } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) { |
| 12077 | state.tag = state.tagMap[tagHandle] + tagName; |
| 12078 | |
| 12079 | } else if (tagHandle === '!') { |
| 12080 | state.tag = '!' + tagName; |
| 12081 | |
| 12082 | } else if (tagHandle === '!!') { |
| 12083 | state.tag = 'tag:yaml.org,2002:' + tagName; |
| 12084 | |
| 12085 | } else { |
| 12086 | throwError(state, 'undeclared tag handle "' + tagHandle + '"'); |
| 12087 | } |
| 12088 | |
| 12089 | return true; |
| 12090 | } |
| 12091 | |
| 12092 | function readAnchorProperty(state) { |
| 12093 | var _position, |
| 12094 | ch; |
| 12095 | |
| 12096 | ch = state.input.charCodeAt(state.position); |
| 12097 | |
| 12098 | if (ch !== 0x26/* & */) return false; |
| 12099 | |
| 12100 | if (state.anchor !== null) { |
| 12101 | throwError(state, 'duplication of an anchor property'); |
| 12102 | } |
| 12103 | |
| 12104 | ch = state.input.charCodeAt(++state.position); |
| 12105 | _position = state.position; |
| 12106 | |
| 12107 | while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { |
| 12108 | ch = state.input.charCodeAt(++state.position); |
| 12109 | } |
| 12110 | |
| 12111 | if (state.position === _position) { |
| 12112 | throwError(state, 'name of an anchor node must contain at least one character'); |
| 12113 | } |
| 12114 | |
| 12115 | state.anchor = state.input.slice(_position, state.position); |
| 12116 | return true; |
| 12117 | } |
| 12118 | |
| 12119 | function readAlias(state) { |
| 12120 | var _position, alias, |
| 12121 | ch; |
| 12122 | |
| 12123 | ch = state.input.charCodeAt(state.position); |
| 12124 | |
| 12125 | if (ch !== 0x2A/* * */) return false; |
| 12126 | |
| 12127 | ch = state.input.charCodeAt(++state.position); |
| 12128 | _position = state.position; |
| 12129 | |
| 12130 | while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { |
| 12131 | ch = state.input.charCodeAt(++state.position); |
| 12132 | } |
| 12133 | |
| 12134 | if (state.position === _position) { |
| 12135 | throwError(state, 'name of an alias node must contain at least one character'); |
| 12136 | } |
| 12137 | |
| 12138 | alias = state.input.slice(_position, state.position); |
| 12139 | |
| 12140 | if (!state.anchorMap.hasOwnProperty(alias)) { |
| 12141 | throwError(state, 'unidentified alias "' + alias + '"'); |
| 12142 | } |
| 12143 | |
| 12144 | state.result = state.anchorMap[alias]; |
| 12145 | skipSeparationSpace(state, true, -1); |
| 12146 | return true; |
| 12147 | } |
| 12148 | |
| 12149 | function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { |
| 12150 | var allowBlockStyles, |
| 12151 | allowBlockScalars, |
| 12152 | allowBlockCollections, |
| 12153 | indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this<parent |
| 12154 | atNewLine = false, |
| 12155 | hasContent = false, |
| 12156 | typeIndex, |
| 12157 | typeQuantity, |
| 12158 | type, |
| 12159 | flowIndent, |
| 12160 | blockIndent; |
| 12161 | |
| 12162 | if (state.listener !== null) { |
| 12163 | state.listener('open', state); |
| 12164 | } |
| 12165 | |
| 12166 | state.tag = null; |
| 12167 | state.anchor = null; |
| 12168 | state.kind = null; |
| 12169 | state.result = null; |
| 12170 | |
| 12171 | allowBlockStyles = allowBlockScalars = allowBlockCollections = |
| 12172 | CONTEXT_BLOCK_OUT === nodeContext || |
| 12173 | CONTEXT_BLOCK_IN === nodeContext; |
| 12174 | |
| 12175 | if (allowToSeek) { |
| 12176 | if (skipSeparationSpace(state, true, -1)) { |
| 12177 | atNewLine = true; |
| 12178 | |
| 12179 | if (state.lineIndent > parentIndent) { |
| 12180 | indentStatus = 1; |
| 12181 | } else if (state.lineIndent === parentIndent) { |
| 12182 | indentStatus = 0; |
| 12183 | } else if (state.lineIndent < parentIndent) { |
| 12184 | indentStatus = -1; |
| 12185 | } |
| 12186 | } |
| 12187 | } |
| 12188 | |
| 12189 | if (indentStatus === 1) { |
| 12190 | while (readTagProperty(state) || readAnchorProperty(state)) { |
| 12191 | if (skipSeparationSpace(state, true, -1)) { |
| 12192 | atNewLine = true; |
| 12193 | allowBlockCollections = allowBlockStyles; |
| 12194 | |
| 12195 | if (state.lineIndent > parentIndent) { |
| 12196 | indentStatus = 1; |
| 12197 | } else if (state.lineIndent === parentIndent) { |
| 12198 | indentStatus = 0; |
| 12199 | } else if (state.lineIndent < parentIndent) { |
| 12200 | indentStatus = -1; |
| 12201 | } |
| 12202 | } else { |
| 12203 | allowBlockCollections = false; |
| 12204 | } |
| 12205 | } |
| 12206 | } |
| 12207 | |
| 12208 | if (allowBlockCollections) { |
| 12209 | allowBlockCollections = atNewLine || allowCompact; |
| 12210 | } |
| 12211 | |
| 12212 | if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { |
| 12213 | if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { |
| 12214 | flowIndent = parentIndent; |
| 12215 | } else { |
| 12216 | flowIndent = parentIndent + 1; |
| 12217 | } |
| 12218 | |
| 12219 | blockIndent = state.position - state.lineStart; |
| 12220 | |
| 12221 | if (indentStatus === 1) { |
| 12222 | if (allowBlockCollections && |
| 12223 | (readBlockSequence(state, blockIndent) || |
| 12224 | readBlockMapping(state, blockIndent, flowIndent)) || |
| 12225 | readFlowCollection(state, flowIndent)) { |
| 12226 | hasContent = true; |
| 12227 | } else { |
| 12228 | if ((allowBlockScalars && readBlockScalar(state, flowIndent)) || |
| 12229 | readSingleQuotedScalar(state, flowIndent) || |
| 12230 | readDoubleQuotedScalar(state, flowIndent)) { |
| 12231 | hasContent = true; |
| 12232 | |
| 12233 | } else if (readAlias(state)) { |
| 12234 | hasContent = true; |
| 12235 | |
| 12236 | if (state.tag !== null || state.anchor !== null) { |
| 12237 | throwError(state, 'alias node should not have any properties'); |
| 12238 | } |
| 12239 | |
| 12240 | } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { |
| 12241 | hasContent = true; |
| 12242 | |
| 12243 | if (state.tag === null) { |
| 12244 | state.tag = '?'; |
| 12245 | } |
| 12246 | } |
| 12247 | |
| 12248 | if (state.anchor !== null) { |
| 12249 | state.anchorMap[state.anchor] = state.result; |
| 12250 | } |
| 12251 | } |
| 12252 | } else if (indentStatus === 0) { |
| 12253 | // Special case: block sequences are allowed to have same indentation level as the parent. |
| 12254 | // http://www.yaml.org/spec/1.2/spec.html#id2799784 |
| 12255 | hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); |
| 12256 | } |
| 12257 | } |
| 12258 | |
| 12259 | if (state.tag !== null && state.tag !== '!') { |
| 12260 | if (state.tag === '?') { |
| 12261 | for (typeIndex = 0, typeQuantity = state.implicitTypes.length; |
| 12262 | typeIndex < typeQuantity; |
| 12263 | typeIndex += 1) { |
| 12264 | type = state.implicitTypes[typeIndex]; |
| 12265 | |
| 12266 | // Implicit resolving is not allowed for non-scalar types, and '?' |
| 12267 | // non-specific tag is only assigned to plain scalars. So, it isn't |
| 12268 | // needed to check for 'kind' conformity. |
| 12269 | |
| 12270 | if (type.resolve(state.result)) { // `state.result` updated in resolver if matched |
| 12271 | state.result = type.construct(state.result); |
| 12272 | state.tag = type.tag; |
| 12273 | if (state.anchor !== null) { |
| 12274 | state.anchorMap[state.anchor] = state.result; |
| 12275 | } |
| 12276 | break; |
| 12277 | } |
| 12278 | } |
| 12279 | } else if (_hasOwnProperty.call(state.typeMap, state.tag)) { |
| 12280 | type = state.typeMap[state.tag]; |
| 12281 | |
| 12282 | if (state.result !== null && type.kind !== state.kind) { |
| 12283 | throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"'); |
| 12284 | } |
| 12285 | |
| 12286 | if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched |
| 12287 | throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag'); |
| 12288 | } else { |
| 12289 | state.result = type.construct(state.result); |
| 12290 | if (state.anchor !== null) { |
| 12291 | state.anchorMap[state.anchor] = state.result; |
| 12292 | } |
| 12293 | } |
| 12294 | } else { |
| 12295 | throwError(state, 'unknown tag !<' + state.tag + '>'); |
| 12296 | } |
| 12297 | } |
| 12298 | |
| 12299 | if (state.listener !== null) { |
| 12300 | state.listener('close', state); |
| 12301 | } |
| 12302 | return state.tag !== null || state.anchor !== null || hasContent; |
| 12303 | } |
| 12304 | |
| 12305 | function readDocument(state) { |
| 12306 | var documentStart = state.position, |
| 12307 | _position, |
| 12308 | directiveName, |
| 12309 | directiveArgs, |
| 12310 | hasDirectives = false, |
| 12311 | ch; |
| 12312 | |
| 12313 | state.version = null; |
| 12314 | state.checkLineBreaks = state.legacy; |
| 12315 | state.tagMap = {}; |
| 12316 | state.anchorMap = {}; |
| 12317 | |
| 12318 | while ((ch = state.input.charCodeAt(state.position)) !== 0) { |
| 12319 | skipSeparationSpace(state, true, -1); |
| 12320 | |
| 12321 | ch = state.input.charCodeAt(state.position); |
| 12322 | |
| 12323 | if (state.lineIndent > 0 || ch !== 0x25/* % */) { |
| 12324 | break; |
| 12325 | } |
| 12326 | |
| 12327 | hasDirectives = true; |
| 12328 | ch = state.input.charCodeAt(++state.position); |
| 12329 | _position = state.position; |
| 12330 | |
| 12331 | while (ch !== 0 && !is_WS_OR_EOL(ch)) { |
| 12332 | ch = state.input.charCodeAt(++state.position); |
| 12333 | } |
| 12334 | |
| 12335 | directiveName = state.input.slice(_position, state.position); |
| 12336 | directiveArgs = []; |
| 12337 | |
| 12338 | if (directiveName.length < 1) { |
| 12339 | throwError(state, 'directive name must not be less than one character in length'); |
| 12340 | } |
| 12341 | |
| 12342 | while (ch !== 0) { |
| 12343 | while (is_WHITE_SPACE(ch)) { |
| 12344 | ch = state.input.charCodeAt(++state.position); |
| 12345 | } |
| 12346 | |
| 12347 | if (ch === 0x23/* # */) { |
| 12348 | do { ch = state.input.charCodeAt(++state.position); } |
| 12349 | while (ch !== 0 && !is_EOL(ch)); |
| 12350 | break; |
| 12351 | } |
| 12352 | |
| 12353 | if (is_EOL(ch)) break; |
| 12354 | |
| 12355 | _position = state.position; |
| 12356 | |
| 12357 | while (ch !== 0 && !is_WS_OR_EOL(ch)) { |
| 12358 | ch = state.input.charCodeAt(++state.position); |
| 12359 | } |
| 12360 | |
| 12361 | directiveArgs.push(state.input.slice(_position, state.position)); |
| 12362 | } |
| 12363 | |
| 12364 | if (ch !== 0) readLineBreak(state); |
| 12365 | |
| 12366 | if (_hasOwnProperty.call(directiveHandlers, directiveName)) { |
| 12367 | directiveHandlers[directiveName](state, directiveName, directiveArgs); |
| 12368 | } else { |
| 12369 | throwWarning(state, 'unknown document directive "' + directiveName + '"'); |
| 12370 | } |
| 12371 | } |
| 12372 | |
| 12373 | skipSeparationSpace(state, true, -1); |
| 12374 | |
| 12375 | if (state.lineIndent === 0 && |
| 12376 | state.input.charCodeAt(state.position) === 0x2D/* - */ && |
| 12377 | state.input.charCodeAt(state.position + 1) === 0x2D/* - */ && |
| 12378 | state.input.charCodeAt(state.position + 2) === 0x2D/* - */) { |
| 12379 | state.position += 3; |
| 12380 | skipSeparationSpace(state, true, -1); |
| 12381 | |
| 12382 | } else if (hasDirectives) { |
| 12383 | throwError(state, 'directives end mark is expected'); |
| 12384 | } |
| 12385 | |
| 12386 | composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); |
| 12387 | skipSeparationSpace(state, true, -1); |
| 12388 | |
| 12389 | if (state.checkLineBreaks && |
| 12390 | PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) { |
| 12391 | throwWarning(state, 'non-ASCII line breaks are interpreted as content'); |
| 12392 | } |
| 12393 | |
| 12394 | state.documents.push(state.result); |
| 12395 | |
| 12396 | if (state.position === state.lineStart && testDocumentSeparator(state)) { |
| 12397 | |
| 12398 | if (state.input.charCodeAt(state.position) === 0x2E/* . */) { |
| 12399 | state.position += 3; |
| 12400 | skipSeparationSpace(state, true, -1); |
| 12401 | } |
| 12402 | return; |
| 12403 | } |
| 12404 | |
| 12405 | if (state.position < (state.length - 1)) { |
| 12406 | throwError(state, 'end of the stream or a document separator is expected'); |
| 12407 | } else { |
| 12408 | return; |
| 12409 | } |
| 12410 | } |
| 12411 | |
| 12412 | |
| 12413 | function loadDocuments(input, options) { |
| 12414 | input = String(input); |
| 12415 | options = options || {}; |
| 12416 | |
| 12417 | if (input.length !== 0) { |
| 12418 | |
| 12419 | // Add tailing `\n` if not exists |
| 12420 | if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ && |
| 12421 | input.charCodeAt(input.length - 1) !== 0x0D/* CR */) { |
| 12422 | input += '\n'; |
| 12423 | } |
| 12424 | |
| 12425 | // Strip BOM |
| 12426 | if (input.charCodeAt(0) === 0xFEFF) { |
| 12427 | input = input.slice(1); |
| 12428 | } |
| 12429 | } |
| 12430 | |
| 12431 | var state = new State(input, options); |
| 12432 | |
| 12433 | // Use 0 as string terminator. That significantly simplifies bounds check. |
| 12434 | state.input += '\0'; |
| 12435 | |
| 12436 | while (state.input.charCodeAt(state.position) === 0x20/* Space */) { |
| 12437 | state.lineIndent += 1; |
| 12438 | state.position += 1; |
| 12439 | } |
| 12440 | |
| 12441 | while (state.position < (state.length - 1)) { |
| 12442 | readDocument(state); |
| 12443 | } |
| 12444 | |
| 12445 | return state.documents; |
| 12446 | } |
| 12447 | |
| 12448 | |
| 12449 | function loadAll(input, iterator, options) { |
| 12450 | var documents = loadDocuments(input, options), index, length; |
| 12451 | |
| 12452 | for (index = 0, length = documents.length; index < length; index += 1) { |
| 12453 | iterator(documents[index]); |
| 12454 | } |
| 12455 | } |
| 12456 | |
| 12457 | |
| 12458 | function load(input, options) { |
| 12459 | var documents = loadDocuments(input, options); |
| 12460 | |
| 12461 | if (documents.length === 0) { |
| 12462 | /*eslint-disable no-undefined*/ |
| 12463 | return undefined; |
| 12464 | } else if (documents.length === 1) { |
| 12465 | return documents[0]; |
| 12466 | } |
| 12467 | throw new YAMLException('expected a single document in the stream, but found more'); |
| 12468 | } |
| 12469 | |
| 12470 | |
| 12471 | function safeLoadAll(input, output, options) { |
| 12472 | loadAll(input, output, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); |
| 12473 | } |
| 12474 | |
| 12475 | |
| 12476 | function safeLoad(input, options) { |
| 12477 | return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); |
| 12478 | } |
| 12479 | |
| 12480 | |
| 12481 | module.exports.loadAll = loadAll; |
| 12482 | module.exports.load = load; |
| 12483 | module.exports.safeLoadAll = safeLoadAll; |
| 12484 | module.exports.safeLoad = safeLoad; |
| 12485 | |
| 12486 | },{"./common":21,"./exception":23,"./mark":25,"./schema/default_full":28,"./schema/default_safe":29}],25:[function(require,module,exports){ |
| 12487 | 'use strict'; |
| 12488 | |
| 12489 | |
| 12490 | var common = require('./common'); |
| 12491 | |
| 12492 | |
| 12493 | function Mark(name, buffer, position, line, column) { |
| 12494 | this.name = name; |
| 12495 | this.buffer = buffer; |
| 12496 | this.position = position; |
| 12497 | this.line = line; |
| 12498 | this.column = column; |
| 12499 | } |
| 12500 | |
| 12501 | |
| 12502 | Mark.prototype.getSnippet = function getSnippet(indent, maxLength) { |
| 12503 | var head, start, tail, end, snippet; |
| 12504 | |
| 12505 | if (!this.buffer) return null; |
| 12506 | |
| 12507 | indent = indent || 4; |
| 12508 | maxLength = maxLength || 75; |
| 12509 | |
| 12510 | head = ''; |
| 12511 | start = this.position; |
| 12512 | |
| 12513 | while (start > 0 && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1)) === -1) { |
| 12514 | start -= 1; |
| 12515 | if (this.position - start > (maxLength / 2 - 1)) { |
| 12516 | head = ' ... '; |
| 12517 | start += 5; |
| 12518 | break; |
| 12519 | } |
| 12520 | } |
| 12521 | |
| 12522 | tail = ''; |
| 12523 | end = this.position; |
| 12524 | |
| 12525 | while (end < this.buffer.length && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end)) === -1) { |
| 12526 | end += 1; |
| 12527 | if (end - this.position > (maxLength / 2 - 1)) { |
| 12528 | tail = ' ... '; |
| 12529 | end -= 5; |
| 12530 | break; |
| 12531 | } |
| 12532 | } |
| 12533 | |
| 12534 | snippet = this.buffer.slice(start, end); |
| 12535 | |
| 12536 | return common.repeat(' ', indent) + head + snippet + tail + '\n' + |
| 12537 | common.repeat(' ', indent + this.position - start + head.length) + '^'; |
| 12538 | }; |
| 12539 | |
| 12540 | |
| 12541 | Mark.prototype.toString = function toString(compact) { |
| 12542 | var snippet, where = ''; |
| 12543 | |
| 12544 | if (this.name) { |
| 12545 | where += 'in "' + this.name + '" '; |
| 12546 | } |
| 12547 | |
| 12548 | where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1); |
| 12549 | |
| 12550 | if (!compact) { |
| 12551 | snippet = this.getSnippet(); |
| 12552 | |
| 12553 | if (snippet) { |
| 12554 | where += ':\n' + snippet; |
| 12555 | } |
| 12556 | } |
| 12557 | |
| 12558 | return where; |
| 12559 | }; |
| 12560 | |
| 12561 | |
| 12562 | module.exports = Mark; |
| 12563 | |
| 12564 | },{"./common":21}],26:[function(require,module,exports){ |
| 12565 | 'use strict'; |
| 12566 | |
| 12567 | /*eslint-disable max-len*/ |
| 12568 | |
| 12569 | var common = require('./common'); |
| 12570 | var YAMLException = require('./exception'); |
| 12571 | var Type = require('./type'); |
| 12572 | |
| 12573 | |
| 12574 | function compileList(schema, name, result) { |
| 12575 | var exclude = []; |
| 12576 | |
| 12577 | schema.include.forEach(function (includedSchema) { |
| 12578 | result = compileList(includedSchema, name, result); |
| 12579 | }); |
| 12580 | |
| 12581 | schema[name].forEach(function (currentType) { |
| 12582 | result.forEach(function (previousType, previousIndex) { |
| 12583 | if (previousType.tag === currentType.tag) { |
| 12584 | exclude.push(previousIndex); |
| 12585 | } |
| 12586 | }); |
| 12587 | |
| 12588 | result.push(currentType); |
| 12589 | }); |
| 12590 | |
| 12591 | return result.filter(function (type, index) { |
| 12592 | return exclude.indexOf(index) === -1; |
| 12593 | }); |
| 12594 | } |
| 12595 | |
| 12596 | |
| 12597 | function compileMap(/* lists... */) { |
| 12598 | var result = {}, index, length; |
| 12599 | |
| 12600 | function collectType(type) { |
| 12601 | result[type.tag] = type; |
| 12602 | } |
| 12603 | |
| 12604 | for (index = 0, length = arguments.length; index < length; index += 1) { |
| 12605 | arguments[index].forEach(collectType); |
| 12606 | } |
| 12607 | |
| 12608 | return result; |
| 12609 | } |
| 12610 | |
| 12611 | |
| 12612 | function Schema(definition) { |
| 12613 | this.include = definition.include || []; |
| 12614 | this.implicit = definition.implicit || []; |
| 12615 | this.explicit = definition.explicit || []; |
| 12616 | |
| 12617 | this.implicit.forEach(function (type) { |
| 12618 | if (type.loadKind && type.loadKind !== 'scalar') { |
| 12619 | throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); |
| 12620 | } |
| 12621 | }); |
| 12622 | |
| 12623 | this.compiledImplicit = compileList(this, 'implicit', []); |
| 12624 | this.compiledExplicit = compileList(this, 'explicit', []); |
| 12625 | this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit); |
| 12626 | } |
| 12627 | |
| 12628 | |
| 12629 | Schema.DEFAULT = null; |
| 12630 | |
| 12631 | |
| 12632 | Schema.create = function createSchema() { |
| 12633 | var schemas, types; |
| 12634 | |
| 12635 | switch (arguments.length) { |
| 12636 | case 1: |
| 12637 | schemas = Schema.DEFAULT; |
| 12638 | types = arguments[0]; |
| 12639 | break; |
| 12640 | |
| 12641 | case 2: |
| 12642 | schemas = arguments[0]; |
| 12643 | types = arguments[1]; |
| 12644 | break; |
| 12645 | |
| 12646 | default: |
| 12647 | throw new YAMLException('Wrong number of arguments for Schema.create function'); |
| 12648 | } |
| 12649 | |
| 12650 | schemas = common.toArray(schemas); |
| 12651 | types = common.toArray(types); |
| 12652 | |
| 12653 | if (!schemas.every(function (schema) { return schema instanceof Schema; })) { |
| 12654 | throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.'); |
| 12655 | } |
| 12656 | |
| 12657 | if (!types.every(function (type) { return type instanceof Type; })) { |
| 12658 | throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.'); |
| 12659 | } |
| 12660 | |
| 12661 | return new Schema({ |
| 12662 | include: schemas, |
| 12663 | explicit: types |
| 12664 | }); |
| 12665 | }; |
| 12666 | |
| 12667 | |
| 12668 | module.exports = Schema; |
| 12669 | |
| 12670 | },{"./common":21,"./exception":23,"./type":32}],27:[function(require,module,exports){ |
| 12671 | // Standard YAML's Core schema. |
| 12672 | // http://www.yaml.org/spec/1.2/spec.html#id2804923 |
| 12673 | // |
| 12674 | // NOTE: JS-YAML does not support schema-specific tag resolution restrictions. |
| 12675 | // So, Core schema has no distinctions from JSON schema is JS-YAML. |
| 12676 | |
| 12677 | |
| 12678 | 'use strict'; |
| 12679 | |
| 12680 | |
| 12681 | var Schema = require('../schema'); |
| 12682 | |
| 12683 | |
| 12684 | module.exports = new Schema({ |
| 12685 | include: [ |
| 12686 | require('./json') |
| 12687 | ] |
| 12688 | }); |
| 12689 | |
| 12690 | },{"../schema":26,"./json":31}],28:[function(require,module,exports){ |
| 12691 | // JS-YAML's default schema for `load` function. |
| 12692 | // It is not described in the YAML specification. |
| 12693 | // |
| 12694 | // This schema is based on JS-YAML's default safe schema and includes |
| 12695 | // JavaScript-specific types: !!js/undefined, !!js/regexp and !!js/function. |
| 12696 | // |
| 12697 | // Also this schema is used as default base schema at `Schema.create` function. |
| 12698 | |
| 12699 | |
| 12700 | 'use strict'; |
| 12701 | |
| 12702 | |
| 12703 | var Schema = require('../schema'); |
| 12704 | |
| 12705 | |
| 12706 | module.exports = Schema.DEFAULT = new Schema({ |
| 12707 | include: [ |
| 12708 | require('./default_safe') |
| 12709 | ], |
| 12710 | explicit: [ |
| 12711 | require('../type/js/undefined'), |
| 12712 | require('../type/js/regexp'), |
| 12713 | require('../type/js/function') |
| 12714 | ] |
| 12715 | }); |
| 12716 | |
| 12717 | },{"../schema":26,"../type/js/function":37,"../type/js/regexp":38,"../type/js/undefined":39,"./default_safe":29}],29:[function(require,module,exports){ |
| 12718 | // JS-YAML's default schema for `safeLoad` function. |
| 12719 | // It is not described in the YAML specification. |
| 12720 | // |
| 12721 | // This schema is based on standard YAML's Core schema and includes most of |
| 12722 | // extra types described at YAML tag repository. (http://yaml.org/type/) |
| 12723 | |
| 12724 | |
| 12725 | 'use strict'; |
| 12726 | |
| 12727 | |
| 12728 | var Schema = require('../schema'); |
| 12729 | |
| 12730 | |
| 12731 | module.exports = new Schema({ |
| 12732 | include: [ |
| 12733 | require('./core') |
| 12734 | ], |
| 12735 | implicit: [ |
| 12736 | require('../type/timestamp'), |
| 12737 | require('../type/merge') |
| 12738 | ], |
| 12739 | explicit: [ |
| 12740 | require('../type/binary'), |
| 12741 | require('../type/omap'), |
| 12742 | require('../type/pairs'), |
| 12743 | require('../type/set') |
| 12744 | ] |
| 12745 | }); |
| 12746 | |
| 12747 | },{"../schema":26,"../type/binary":33,"../type/merge":41,"../type/omap":43,"../type/pairs":44,"../type/set":46,"../type/timestamp":48,"./core":27}],30:[function(require,module,exports){ |
| 12748 | // Standard YAML's Failsafe schema. |
| 12749 | // http://www.yaml.org/spec/1.2/spec.html#id2802346 |
| 12750 | |
| 12751 | |
| 12752 | 'use strict'; |
| 12753 | |
| 12754 | |
| 12755 | var Schema = require('../schema'); |
| 12756 | |
| 12757 | |
| 12758 | module.exports = new Schema({ |
| 12759 | explicit: [ |
| 12760 | require('../type/str'), |
| 12761 | require('../type/seq'), |
| 12762 | require('../type/map') |
| 12763 | ] |
| 12764 | }); |
| 12765 | |
| 12766 | },{"../schema":26,"../type/map":40,"../type/seq":45,"../type/str":47}],31:[function(require,module,exports){ |
| 12767 | // Standard YAML's JSON schema. |
| 12768 | // http://www.yaml.org/spec/1.2/spec.html#id2803231 |
| 12769 | // |
| 12770 | // NOTE: JS-YAML does not support schema-specific tag resolution restrictions. |
| 12771 | // So, this schema is not such strict as defined in the YAML specification. |
| 12772 | // It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc. |
| 12773 | |
| 12774 | |
| 12775 | 'use strict'; |
| 12776 | |
| 12777 | |
| 12778 | var Schema = require('../schema'); |
| 12779 | |
| 12780 | |
| 12781 | module.exports = new Schema({ |
| 12782 | include: [ |
| 12783 | require('./failsafe') |
| 12784 | ], |
| 12785 | implicit: [ |
| 12786 | require('../type/null'), |
| 12787 | require('../type/bool'), |
| 12788 | require('../type/int'), |
| 12789 | require('../type/float') |
| 12790 | ] |
| 12791 | }); |
| 12792 | |
| 12793 | },{"../schema":26,"../type/bool":34,"../type/float":35,"../type/int":36,"../type/null":42,"./failsafe":30}],32:[function(require,module,exports){ |
| 12794 | 'use strict'; |
| 12795 | |
| 12796 | var YAMLException = require('./exception'); |
| 12797 | |
| 12798 | var TYPE_CONSTRUCTOR_OPTIONS = [ |
| 12799 | 'kind', |
| 12800 | 'resolve', |
| 12801 | 'construct', |
| 12802 | 'instanceOf', |
| 12803 | 'predicate', |
| 12804 | 'represent', |
| 12805 | 'defaultStyle', |
| 12806 | 'styleAliases' |
| 12807 | ]; |
| 12808 | |
| 12809 | var YAML_NODE_KINDS = [ |
| 12810 | 'scalar', |
| 12811 | 'sequence', |
| 12812 | 'mapping' |
| 12813 | ]; |
| 12814 | |
| 12815 | function compileStyleAliases(map) { |
| 12816 | var result = {}; |
| 12817 | |
| 12818 | if (map !== null) { |
| 12819 | Object.keys(map).forEach(function (style) { |
| 12820 | map[style].forEach(function (alias) { |
| 12821 | result[String(alias)] = style; |
| 12822 | }); |
| 12823 | }); |
| 12824 | } |
| 12825 | |
| 12826 | return result; |
| 12827 | } |
| 12828 | |
| 12829 | function Type(tag, options) { |
| 12830 | options = options || {}; |
| 12831 | |
| 12832 | Object.keys(options).forEach(function (name) { |
| 12833 | if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) { |
| 12834 | throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); |
| 12835 | } |
| 12836 | }); |
| 12837 | |
| 12838 | // TODO: Add tag format check. |
| 12839 | this.tag = tag; |
| 12840 | this.kind = options['kind'] || null; |
| 12841 | this.resolve = options['resolve'] || function () { return true; }; |
| 12842 | this.construct = options['construct'] || function (data) { return data; }; |
| 12843 | this.instanceOf = options['instanceOf'] || null; |
| 12844 | this.predicate = options['predicate'] || null; |
| 12845 | this.represent = options['represent'] || null; |
| 12846 | this.defaultStyle = options['defaultStyle'] || null; |
| 12847 | this.styleAliases = compileStyleAliases(options['styleAliases'] || null); |
| 12848 | |
| 12849 | if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { |
| 12850 | throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); |
| 12851 | } |
| 12852 | } |
| 12853 | |
| 12854 | module.exports = Type; |
| 12855 | |
| 12856 | },{"./exception":23}],33:[function(require,module,exports){ |
| 12857 | 'use strict'; |
| 12858 | |
| 12859 | /*eslint-disable no-bitwise*/ |
| 12860 | |
| 12861 | var NodeBuffer; |
| 12862 | |
| 12863 | try { |
| 12864 | // A trick for browserified version, to not include `Buffer` shim |
| 12865 | var _require = require; |
| 12866 | NodeBuffer = _require('buffer').Buffer; |
| 12867 | } catch (__) {} |
| 12868 | |
| 12869 | var Type = require('../type'); |
| 12870 | |
| 12871 | |
| 12872 | // [ 64, 65, 66 ] -> [ padding, CR, LF ] |
| 12873 | var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; |
| 12874 | |
| 12875 | |
| 12876 | function resolveYamlBinary(data) { |
| 12877 | if (data === null) return false; |
| 12878 | |
| 12879 | var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP; |
| 12880 | |
| 12881 | // Convert one by one. |
| 12882 | for (idx = 0; idx < max; idx++) { |
| 12883 | code = map.indexOf(data.charAt(idx)); |
| 12884 | |
| 12885 | // Skip CR/LF |
| 12886 | if (code > 64) continue; |
| 12887 | |
| 12888 | // Fail on illegal characters |
| 12889 | if (code < 0) return false; |
| 12890 | |
| 12891 | bitlen += 6; |
| 12892 | } |
| 12893 | |
| 12894 | // If there are any bits left, source was corrupted |
| 12895 | return (bitlen % 8) === 0; |
| 12896 | } |
| 12897 | |
| 12898 | function constructYamlBinary(data) { |
| 12899 | var idx, tailbits, |
| 12900 | input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan |
| 12901 | max = input.length, |
| 12902 | map = BASE64_MAP, |
| 12903 | bits = 0, |
| 12904 | result = []; |
| 12905 | |
| 12906 | // Collect by 6*4 bits (3 bytes) |
| 12907 | |
| 12908 | for (idx = 0; idx < max; idx++) { |
| 12909 | if ((idx % 4 === 0) && idx) { |
| 12910 | result.push((bits >> 16) & 0xFF); |
| 12911 | result.push((bits >> 8) & 0xFF); |
| 12912 | result.push(bits & 0xFF); |
| 12913 | } |
| 12914 | |
| 12915 | bits = (bits << 6) | map.indexOf(input.charAt(idx)); |
| 12916 | } |
| 12917 | |
| 12918 | // Dump tail |
| 12919 | |
| 12920 | tailbits = (max % 4) * 6; |
| 12921 | |
| 12922 | if (tailbits === 0) { |
| 12923 | result.push((bits >> 16) & 0xFF); |
| 12924 | result.push((bits >> 8) & 0xFF); |
| 12925 | result.push(bits & 0xFF); |
| 12926 | } else if (tailbits === 18) { |
| 12927 | result.push((bits >> 10) & 0xFF); |
| 12928 | result.push((bits >> 2) & 0xFF); |
| 12929 | } else if (tailbits === 12) { |
| 12930 | result.push((bits >> 4) & 0xFF); |
| 12931 | } |
| 12932 | |
| 12933 | // Wrap into Buffer for NodeJS and leave Array for browser |
| 12934 | if (NodeBuffer) return new NodeBuffer(result); |
| 12935 | |
| 12936 | return result; |
| 12937 | } |
| 12938 | |
| 12939 | function representYamlBinary(object /*, style*/) { |
| 12940 | var result = '', bits = 0, idx, tail, |
| 12941 | max = object.length, |
| 12942 | map = BASE64_MAP; |
| 12943 | |
| 12944 | // Convert every three bytes to 4 ASCII characters. |
| 12945 | |
| 12946 | for (idx = 0; idx < max; idx++) { |
| 12947 | if ((idx % 3 === 0) && idx) { |
| 12948 | result += map[(bits >> 18) & 0x3F]; |
| 12949 | result += map[(bits >> 12) & 0x3F]; |
| 12950 | result += map[(bits >> 6) & 0x3F]; |
| 12951 | result += map[bits & 0x3F]; |
| 12952 | } |
| 12953 | |
| 12954 | bits = (bits << 8) + object[idx]; |
| 12955 | } |
| 12956 | |
| 12957 | // Dump tail |
| 12958 | |
| 12959 | tail = max % 3; |
| 12960 | |
| 12961 | if (tail === 0) { |
| 12962 | result += map[(bits >> 18) & 0x3F]; |
| 12963 | result += map[(bits >> 12) & 0x3F]; |
| 12964 | result += map[(bits >> 6) & 0x3F]; |
| 12965 | result += map[bits & 0x3F]; |
| 12966 | } else if (tail === 2) { |
| 12967 | result += map[(bits >> 10) & 0x3F]; |
| 12968 | result += map[(bits >> 4) & 0x3F]; |
| 12969 | result += map[(bits << 2) & 0x3F]; |
| 12970 | result += map[64]; |
| 12971 | } else if (tail === 1) { |
| 12972 | result += map[(bits >> 2) & 0x3F]; |
| 12973 | result += map[(bits << 4) & 0x3F]; |
| 12974 | result += map[64]; |
| 12975 | result += map[64]; |
| 12976 | } |
| 12977 | |
| 12978 | return result; |
| 12979 | } |
| 12980 | |
| 12981 | function isBinary(object) { |
| 12982 | return NodeBuffer && NodeBuffer.isBuffer(object); |
| 12983 | } |
| 12984 | |
| 12985 | module.exports = new Type('tag:yaml.org,2002:binary', { |
| 12986 | kind: 'scalar', |
| 12987 | resolve: resolveYamlBinary, |
| 12988 | construct: constructYamlBinary, |
| 12989 | predicate: isBinary, |
| 12990 | represent: representYamlBinary |
| 12991 | }); |
| 12992 | |
| 12993 | },{"../type":32}],34:[function(require,module,exports){ |
| 12994 | 'use strict'; |
| 12995 | |
| 12996 | var Type = require('../type'); |
| 12997 | |
| 12998 | function resolveYamlBoolean(data) { |
| 12999 | if (data === null) return false; |
| 13000 | |
| 13001 | var max = data.length; |
| 13002 | |
| 13003 | return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) || |
| 13004 | (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')); |
| 13005 | } |
| 13006 | |
| 13007 | function constructYamlBoolean(data) { |
| 13008 | return data === 'true' || |
| 13009 | data === 'True' || |
| 13010 | data === 'TRUE'; |
| 13011 | } |
| 13012 | |
| 13013 | function isBoolean(object) { |
| 13014 | return Object.prototype.toString.call(object) === '[object Boolean]'; |
| 13015 | } |
| 13016 | |
| 13017 | module.exports = new Type('tag:yaml.org,2002:bool', { |
| 13018 | kind: 'scalar', |
| 13019 | resolve: resolveYamlBoolean, |
| 13020 | construct: constructYamlBoolean, |
| 13021 | predicate: isBoolean, |
| 13022 | represent: { |
| 13023 | lowercase: function (object) { return object ? 'true' : 'false'; }, |
| 13024 | uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; }, |
| 13025 | camelcase: function (object) { return object ? 'True' : 'False'; } |
| 13026 | }, |
| 13027 | defaultStyle: 'lowercase' |
| 13028 | }); |
| 13029 | |
| 13030 | },{"../type":32}],35:[function(require,module,exports){ |
| 13031 | 'use strict'; |
| 13032 | |
| 13033 | var common = require('../common'); |
| 13034 | var Type = require('../type'); |
| 13035 | |
| 13036 | var YAML_FLOAT_PATTERN = new RegExp( |
| 13037 | '^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?' + |
| 13038 | '|\\.[0-9_]+(?:[eE][-+][0-9]+)?' + |
| 13039 | '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' + |
| 13040 | '|[-+]?\\.(?:inf|Inf|INF)' + |
| 13041 | '|\\.(?:nan|NaN|NAN))$'); |
| 13042 | |
| 13043 | function resolveYamlFloat(data) { |
| 13044 | if (data === null) return false; |
| 13045 | |
| 13046 | if (!YAML_FLOAT_PATTERN.test(data)) return false; |
| 13047 | |
| 13048 | return true; |
| 13049 | } |
| 13050 | |
| 13051 | function constructYamlFloat(data) { |
| 13052 | var value, sign, base, digits; |
| 13053 | |
| 13054 | value = data.replace(/_/g, '').toLowerCase(); |
| 13055 | sign = value[0] === '-' ? -1 : 1; |
| 13056 | digits = []; |
| 13057 | |
| 13058 | if ('+-'.indexOf(value[0]) >= 0) { |
| 13059 | value = value.slice(1); |
| 13060 | } |
| 13061 | |
| 13062 | if (value === '.inf') { |
| 13063 | return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; |
| 13064 | |
| 13065 | } else if (value === '.nan') { |
| 13066 | return NaN; |
| 13067 | |
| 13068 | } else if (value.indexOf(':') >= 0) { |
| 13069 | value.split(':').forEach(function (v) { |
| 13070 | digits.unshift(parseFloat(v, 10)); |
| 13071 | }); |
| 13072 | |
| 13073 | value = 0.0; |
| 13074 | base = 1; |
| 13075 | |
| 13076 | digits.forEach(function (d) { |
| 13077 | value += d * base; |
| 13078 | base *= 60; |
| 13079 | }); |
| 13080 | |
| 13081 | return sign * value; |
| 13082 | |
| 13083 | } |
| 13084 | return sign * parseFloat(value, 10); |
| 13085 | } |
| 13086 | |
| 13087 | |
| 13088 | var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/; |
| 13089 | |
| 13090 | function representYamlFloat(object, style) { |
| 13091 | var res; |
| 13092 | |
| 13093 | if (isNaN(object)) { |
| 13094 | switch (style) { |
| 13095 | case 'lowercase': return '.nan'; |
| 13096 | case 'uppercase': return '.NAN'; |
| 13097 | case 'camelcase': return '.NaN'; |
| 13098 | } |
| 13099 | } else if (Number.POSITIVE_INFINITY === object) { |
| 13100 | switch (style) { |
| 13101 | case 'lowercase': return '.inf'; |
| 13102 | case 'uppercase': return '.INF'; |
| 13103 | case 'camelcase': return '.Inf'; |
| 13104 | } |
| 13105 | } else if (Number.NEGATIVE_INFINITY === object) { |
| 13106 | switch (style) { |
| 13107 | case 'lowercase': return '-.inf'; |
| 13108 | case 'uppercase': return '-.INF'; |
| 13109 | case 'camelcase': return '-.Inf'; |
| 13110 | } |
| 13111 | } else if (common.isNegativeZero(object)) { |
| 13112 | return '-0.0'; |
| 13113 | } |
| 13114 | |
| 13115 | res = object.toString(10); |
| 13116 | |
| 13117 | // JS stringifier can build scientific format without dots: 5e-100, |
| 13118 | // while YAML requres dot: 5.e-100. Fix it with simple hack |
| 13119 | |
| 13120 | return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res; |
| 13121 | } |
| 13122 | |
| 13123 | function isFloat(object) { |
| 13124 | return (Object.prototype.toString.call(object) === '[object Number]') && |
| 13125 | (object % 1 !== 0 || common.isNegativeZero(object)); |
| 13126 | } |
| 13127 | |
| 13128 | module.exports = new Type('tag:yaml.org,2002:float', { |
| 13129 | kind: 'scalar', |
| 13130 | resolve: resolveYamlFloat, |
| 13131 | construct: constructYamlFloat, |
| 13132 | predicate: isFloat, |
| 13133 | represent: representYamlFloat, |
| 13134 | defaultStyle: 'lowercase' |
| 13135 | }); |
| 13136 | |
| 13137 | },{"../common":21,"../type":32}],36:[function(require,module,exports){ |
| 13138 | 'use strict'; |
| 13139 | |
| 13140 | var common = require('../common'); |
| 13141 | var Type = require('../type'); |
| 13142 | |
| 13143 | function isHexCode(c) { |
| 13144 | return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || |
| 13145 | ((0x41/* A */ <= c) && (c <= 0x46/* F */)) || |
| 13146 | ((0x61/* a */ <= c) && (c <= 0x66/* f */)); |
| 13147 | } |
| 13148 | |
| 13149 | function isOctCode(c) { |
| 13150 | return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)); |
| 13151 | } |
| 13152 | |
| 13153 | function isDecCode(c) { |
| 13154 | return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)); |
| 13155 | } |
| 13156 | |
| 13157 | function resolveYamlInteger(data) { |
| 13158 | if (data === null) return false; |
| 13159 | |
| 13160 | var max = data.length, |
| 13161 | index = 0, |
| 13162 | hasDigits = false, |
| 13163 | ch; |
| 13164 | |
| 13165 | if (!max) return false; |
| 13166 | |
| 13167 | ch = data[index]; |
| 13168 | |
| 13169 | // sign |
| 13170 | if (ch === '-' || ch === '+') { |
| 13171 | ch = data[++index]; |
| 13172 | } |
| 13173 | |
| 13174 | if (ch === '0') { |
| 13175 | // 0 |
| 13176 | if (index + 1 === max) return true; |
| 13177 | ch = data[++index]; |
| 13178 | |
| 13179 | // base 2, base 8, base 16 |
| 13180 | |
| 13181 | if (ch === 'b') { |
| 13182 | // base 2 |
| 13183 | index++; |
| 13184 | |
| 13185 | for (; index < max; index++) { |
| 13186 | ch = data[index]; |
| 13187 | if (ch === '_') continue; |
| 13188 | if (ch !== '0' && ch !== '1') return false; |
| 13189 | hasDigits = true; |
| 13190 | } |
| 13191 | return hasDigits; |
| 13192 | } |
| 13193 | |
| 13194 | |
| 13195 | if (ch === 'x') { |
| 13196 | // base 16 |
| 13197 | index++; |
| 13198 | |
| 13199 | for (; index < max; index++) { |
| 13200 | ch = data[index]; |
| 13201 | if (ch === '_') continue; |
| 13202 | if (!isHexCode(data.charCodeAt(index))) return false; |
| 13203 | hasDigits = true; |
| 13204 | } |
| 13205 | return hasDigits; |
| 13206 | } |
| 13207 | |
| 13208 | // base 8 |
| 13209 | for (; index < max; index++) { |
| 13210 | ch = data[index]; |
| 13211 | if (ch === '_') continue; |
| 13212 | if (!isOctCode(data.charCodeAt(index))) return false; |
| 13213 | hasDigits = true; |
| 13214 | } |
| 13215 | return hasDigits; |
| 13216 | } |
| 13217 | |
| 13218 | // base 10 (except 0) or base 60 |
| 13219 | |
| 13220 | for (; index < max; index++) { |
| 13221 | ch = data[index]; |
| 13222 | if (ch === '_') continue; |
| 13223 | if (ch === ':') break; |
| 13224 | if (!isDecCode(data.charCodeAt(index))) { |
| 13225 | return false; |
| 13226 | } |
| 13227 | hasDigits = true; |
| 13228 | } |
| 13229 | |
| 13230 | if (!hasDigits) return false; |
| 13231 | |
| 13232 | // if !base60 - done; |
| 13233 | if (ch !== ':') return true; |
| 13234 | |
| 13235 | // base60 almost not used, no needs to optimize |
| 13236 | return /^(:[0-5]?[0-9])+$/.test(data.slice(index)); |
| 13237 | } |
| 13238 | |
| 13239 | function constructYamlInteger(data) { |
| 13240 | var value = data, sign = 1, ch, base, digits = []; |
| 13241 | |
| 13242 | if (value.indexOf('_') !== -1) { |
| 13243 | value = value.replace(/_/g, ''); |
| 13244 | } |
| 13245 | |
| 13246 | ch = value[0]; |
| 13247 | |
| 13248 | if (ch === '-' || ch === '+') { |
| 13249 | if (ch === '-') sign = -1; |
| 13250 | value = value.slice(1); |
| 13251 | ch = value[0]; |
| 13252 | } |
| 13253 | |
| 13254 | if (value === '0') return 0; |
| 13255 | |
| 13256 | if (ch === '0') { |
| 13257 | if (value[1] === 'b') return sign * parseInt(value.slice(2), 2); |
| 13258 | if (value[1] === 'x') return sign * parseInt(value, 16); |
| 13259 | return sign * parseInt(value, 8); |
| 13260 | } |
| 13261 | |
| 13262 | if (value.indexOf(':') !== -1) { |
| 13263 | value.split(':').forEach(function (v) { |
| 13264 | digits.unshift(parseInt(v, 10)); |
| 13265 | }); |
| 13266 | |
| 13267 | value = 0; |
| 13268 | base = 1; |
| 13269 | |
| 13270 | digits.forEach(function (d) { |
| 13271 | value += (d * base); |
| 13272 | base *= 60; |
| 13273 | }); |
| 13274 | |
| 13275 | return sign * value; |
| 13276 | |
| 13277 | } |
| 13278 | |
| 13279 | return sign * parseInt(value, 10); |
| 13280 | } |
| 13281 | |
| 13282 | function isInteger(object) { |
| 13283 | return (Object.prototype.toString.call(object)) === '[object Number]' && |
| 13284 | (object % 1 === 0 && !common.isNegativeZero(object)); |
| 13285 | } |
| 13286 | |
| 13287 | module.exports = new Type('tag:yaml.org,2002:int', { |
| 13288 | kind: 'scalar', |
| 13289 | resolve: resolveYamlInteger, |
| 13290 | construct: constructYamlInteger, |
| 13291 | predicate: isInteger, |
| 13292 | represent: { |
| 13293 | binary: function (object) { return '0b' + object.toString(2); }, |
| 13294 | octal: function (object) { return '0' + object.toString(8); }, |
| 13295 | decimal: function (object) { return object.toString(10); }, |
| 13296 | hexadecimal: function (object) { return '0x' + object.toString(16).toUpperCase(); } |
| 13297 | }, |
| 13298 | defaultStyle: 'decimal', |
| 13299 | styleAliases: { |
| 13300 | binary: [ 2, 'bin' ], |
| 13301 | octal: [ 8, 'oct' ], |
| 13302 | decimal: [ 10, 'dec' ], |
| 13303 | hexadecimal: [ 16, 'hex' ] |
| 13304 | } |
| 13305 | }); |
| 13306 | |
| 13307 | },{"../common":21,"../type":32}],37:[function(require,module,exports){ |
| 13308 | 'use strict'; |
| 13309 | |
| 13310 | var esprima; |
| 13311 | |
| 13312 | // Browserified version does not have esprima |
| 13313 | // |
| 13314 | // 1. For node.js just require module as deps |
| 13315 | // 2. For browser try to require mudule via external AMD system. |
| 13316 | // If not found - try to fallback to window.esprima. If not |
| 13317 | // found too - then fail to parse. |
| 13318 | // |
| 13319 | try { |
| 13320 | // workaround to exclude package from browserify list. |
| 13321 | var _require = require; |
| 13322 | esprima = _require('esprima'); |
| 13323 | } catch (_) { |
| 13324 | /*global window */ |
| 13325 | if (typeof window !== 'undefined') esprima = window.esprima; |
| 13326 | } |
| 13327 | |
| 13328 | var Type = require('../../type'); |
| 13329 | |
| 13330 | function resolveJavascriptFunction(data) { |
| 13331 | if (data === null) return false; |
| 13332 | |
| 13333 | try { |
| 13334 | var source = '(' + data + ')', |
| 13335 | ast = esprima.parse(source, { range: true }); |
| 13336 | |
| 13337 | if (ast.type !== 'Program' || |
| 13338 | ast.body.length !== 1 || |
| 13339 | ast.body[0].type !== 'ExpressionStatement' || |
| 13340 | ast.body[0].expression.type !== 'FunctionExpression') { |
| 13341 | return false; |
| 13342 | } |
| 13343 | |
| 13344 | return true; |
| 13345 | } catch (err) { |
| 13346 | return false; |
| 13347 | } |
| 13348 | } |
| 13349 | |
| 13350 | function constructJavascriptFunction(data) { |
| 13351 | /*jslint evil:true*/ |
| 13352 | |
| 13353 | var source = '(' + data + ')', |
| 13354 | ast = esprima.parse(source, { range: true }), |
| 13355 | params = [], |
| 13356 | body; |
| 13357 | |
| 13358 | if (ast.type !== 'Program' || |
| 13359 | ast.body.length !== 1 || |
| 13360 | ast.body[0].type !== 'ExpressionStatement' || |
| 13361 | ast.body[0].expression.type !== 'FunctionExpression') { |
| 13362 | throw new Error('Failed to resolve function'); |
| 13363 | } |
| 13364 | |
| 13365 | ast.body[0].expression.params.forEach(function (param) { |
| 13366 | params.push(param.name); |
| 13367 | }); |
| 13368 | |
| 13369 | body = ast.body[0].expression.body.range; |
| 13370 | |
| 13371 | // Esprima's ranges include the first '{' and the last '}' characters on |
| 13372 | // function expressions. So cut them out. |
| 13373 | /*eslint-disable no-new-func*/ |
| 13374 | return new Function(params, source.slice(body[0] + 1, body[1] - 1)); |
| 13375 | } |
| 13376 | |
| 13377 | function representJavascriptFunction(object /*, style*/) { |
| 13378 | return object.toString(); |
| 13379 | } |
| 13380 | |
| 13381 | function isFunction(object) { |
| 13382 | return Object.prototype.toString.call(object) === '[object Function]'; |
| 13383 | } |
| 13384 | |
| 13385 | module.exports = new Type('tag:yaml.org,2002:js/function', { |
| 13386 | kind: 'scalar', |
| 13387 | resolve: resolveJavascriptFunction, |
| 13388 | construct: constructJavascriptFunction, |
| 13389 | predicate: isFunction, |
| 13390 | represent: representJavascriptFunction |
| 13391 | }); |
| 13392 | |
| 13393 | },{"../../type":32}],38:[function(require,module,exports){ |
| 13394 | 'use strict'; |
| 13395 | |
| 13396 | var Type = require('../../type'); |
| 13397 | |
| 13398 | function resolveJavascriptRegExp(data) { |
| 13399 | if (data === null) return false; |
| 13400 | if (data.length === 0) return false; |
| 13401 | |
| 13402 | var regexp = data, |
| 13403 | tail = /\/([gim]*)$/.exec(data), |
| 13404 | modifiers = ''; |
| 13405 | |
| 13406 | // if regexp starts with '/' it can have modifiers and must be properly closed |
| 13407 | // `/foo/gim` - modifiers tail can be maximum 3 chars |
| 13408 | if (regexp[0] === '/') { |
| 13409 | if (tail) modifiers = tail[1]; |
| 13410 | |
| 13411 | if (modifiers.length > 3) return false; |
| 13412 | // if expression starts with /, is should be properly terminated |
| 13413 | if (regexp[regexp.length - modifiers.length - 1] !== '/') return false; |
| 13414 | } |
| 13415 | |
| 13416 | return true; |
| 13417 | } |
| 13418 | |
| 13419 | function constructJavascriptRegExp(data) { |
| 13420 | var regexp = data, |
| 13421 | tail = /\/([gim]*)$/.exec(data), |
| 13422 | modifiers = ''; |
| 13423 | |
| 13424 | // `/foo/gim` - tail can be maximum 4 chars |
| 13425 | if (regexp[0] === '/') { |
| 13426 | if (tail) modifiers = tail[1]; |
| 13427 | regexp = regexp.slice(1, regexp.length - modifiers.length - 1); |
| 13428 | } |
| 13429 | |
| 13430 | return new RegExp(regexp, modifiers); |
| 13431 | } |
| 13432 | |
| 13433 | function representJavascriptRegExp(object /*, style*/) { |
| 13434 | var result = '/' + object.source + '/'; |
| 13435 | |
| 13436 | if (object.global) result += 'g'; |
| 13437 | if (object.multiline) result += 'm'; |
| 13438 | if (object.ignoreCase) result += 'i'; |
| 13439 | |
| 13440 | return result; |
| 13441 | } |
| 13442 | |
| 13443 | function isRegExp(object) { |
| 13444 | return Object.prototype.toString.call(object) === '[object RegExp]'; |
| 13445 | } |
| 13446 | |
| 13447 | module.exports = new Type('tag:yaml.org,2002:js/regexp', { |
| 13448 | kind: 'scalar', |
| 13449 | resolve: resolveJavascriptRegExp, |
| 13450 | construct: constructJavascriptRegExp, |
| 13451 | predicate: isRegExp, |
| 13452 | represent: representJavascriptRegExp |
| 13453 | }); |
| 13454 | |
| 13455 | },{"../../type":32}],39:[function(require,module,exports){ |
| 13456 | 'use strict'; |
| 13457 | |
| 13458 | var Type = require('../../type'); |
| 13459 | |
| 13460 | function resolveJavascriptUndefined() { |
| 13461 | return true; |
| 13462 | } |
| 13463 | |
| 13464 | function constructJavascriptUndefined() { |
| 13465 | /*eslint-disable no-undefined*/ |
| 13466 | return undefined; |
| 13467 | } |
| 13468 | |
| 13469 | function representJavascriptUndefined() { |
| 13470 | return ''; |
| 13471 | } |
| 13472 | |
| 13473 | function isUndefined(object) { |
| 13474 | return typeof object === 'undefined'; |
| 13475 | } |
| 13476 | |
| 13477 | module.exports = new Type('tag:yaml.org,2002:js/undefined', { |
| 13478 | kind: 'scalar', |
| 13479 | resolve: resolveJavascriptUndefined, |
| 13480 | construct: constructJavascriptUndefined, |
| 13481 | predicate: isUndefined, |
| 13482 | represent: representJavascriptUndefined |
| 13483 | }); |
| 13484 | |
| 13485 | },{"../../type":32}],40:[function(require,module,exports){ |
| 13486 | 'use strict'; |
| 13487 | |
| 13488 | var Type = require('../type'); |
| 13489 | |
| 13490 | module.exports = new Type('tag:yaml.org,2002:map', { |
| 13491 | kind: 'mapping', |
| 13492 | construct: function (data) { return data !== null ? data : {}; } |
| 13493 | }); |
| 13494 | |
| 13495 | },{"../type":32}],41:[function(require,module,exports){ |
| 13496 | 'use strict'; |
| 13497 | |
| 13498 | var Type = require('../type'); |
| 13499 | |
| 13500 | function resolveYamlMerge(data) { |
| 13501 | return data === '<<' || data === null; |
| 13502 | } |
| 13503 | |
| 13504 | module.exports = new Type('tag:yaml.org,2002:merge', { |
| 13505 | kind: 'scalar', |
| 13506 | resolve: resolveYamlMerge |
| 13507 | }); |
| 13508 | |
| 13509 | },{"../type":32}],42:[function(require,module,exports){ |
| 13510 | 'use strict'; |
| 13511 | |
| 13512 | var Type = require('../type'); |
| 13513 | |
| 13514 | function resolveYamlNull(data) { |
| 13515 | if (data === null) return true; |
| 13516 | |
| 13517 | var max = data.length; |
| 13518 | |
| 13519 | return (max === 1 && data === '~') || |
| 13520 | (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL')); |
| 13521 | } |
| 13522 | |
| 13523 | function constructYamlNull() { |
| 13524 | return null; |
| 13525 | } |
| 13526 | |
| 13527 | function isNull(object) { |
| 13528 | return object === null; |
| 13529 | } |
| 13530 | |
| 13531 | module.exports = new Type('tag:yaml.org,2002:null', { |
| 13532 | kind: 'scalar', |
| 13533 | resolve: resolveYamlNull, |
| 13534 | construct: constructYamlNull, |
| 13535 | predicate: isNull, |
| 13536 | represent: { |
| 13537 | canonical: function () { return '~'; }, |
| 13538 | lowercase: function () { return 'null'; }, |
| 13539 | uppercase: function () { return 'NULL'; }, |
| 13540 | camelcase: function () { return 'Null'; } |
| 13541 | }, |
| 13542 | defaultStyle: 'lowercase' |
| 13543 | }); |
| 13544 | |
| 13545 | },{"../type":32}],43:[function(require,module,exports){ |
| 13546 | 'use strict'; |
| 13547 | |
| 13548 | var Type = require('../type'); |
| 13549 | |
| 13550 | var _hasOwnProperty = Object.prototype.hasOwnProperty; |
| 13551 | var _toString = Object.prototype.toString; |
| 13552 | |
| 13553 | function resolveYamlOmap(data) { |
| 13554 | if (data === null) return true; |
| 13555 | |
| 13556 | var objectKeys = [], index, length, pair, pairKey, pairHasKey, |
| 13557 | object = data; |
| 13558 | |
| 13559 | for (index = 0, length = object.length; index < length; index += 1) { |
| 13560 | pair = object[index]; |
| 13561 | pairHasKey = false; |
| 13562 | |
| 13563 | if (_toString.call(pair) !== '[object Object]') return false; |
| 13564 | |
| 13565 | for (pairKey in pair) { |
| 13566 | if (_hasOwnProperty.call(pair, pairKey)) { |
| 13567 | if (!pairHasKey) pairHasKey = true; |
| 13568 | else return false; |
| 13569 | } |
| 13570 | } |
| 13571 | |
| 13572 | if (!pairHasKey) return false; |
| 13573 | |
| 13574 | if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey); |
| 13575 | else return false; |
| 13576 | } |
| 13577 | |
| 13578 | return true; |
| 13579 | } |
| 13580 | |
| 13581 | function constructYamlOmap(data) { |
| 13582 | return data !== null ? data : []; |
| 13583 | } |
| 13584 | |
| 13585 | module.exports = new Type('tag:yaml.org,2002:omap', { |
| 13586 | kind: 'sequence', |
| 13587 | resolve: resolveYamlOmap, |
| 13588 | construct: constructYamlOmap |
| 13589 | }); |
| 13590 | |
| 13591 | },{"../type":32}],44:[function(require,module,exports){ |
| 13592 | 'use strict'; |
| 13593 | |
| 13594 | var Type = require('../type'); |
| 13595 | |
| 13596 | var _toString = Object.prototype.toString; |
| 13597 | |
| 13598 | function resolveYamlPairs(data) { |
| 13599 | if (data === null) return true; |
| 13600 | |
| 13601 | var index, length, pair, keys, result, |
| 13602 | object = data; |
| 13603 | |
| 13604 | result = new Array(object.length); |
| 13605 | |
| 13606 | for (index = 0, length = object.length; index < length; index += 1) { |
| 13607 | pair = object[index]; |
| 13608 | |
| 13609 | if (_toString.call(pair) !== '[object Object]') return false; |
| 13610 | |
| 13611 | keys = Object.keys(pair); |
| 13612 | |
| 13613 | if (keys.length !== 1) return false; |
| 13614 | |
| 13615 | result[index] = [ keys[0], pair[keys[0]] ]; |
| 13616 | } |
| 13617 | |
| 13618 | return true; |
| 13619 | } |
| 13620 | |
| 13621 | function constructYamlPairs(data) { |
| 13622 | if (data === null) return []; |
| 13623 | |
| 13624 | var index, length, pair, keys, result, |
| 13625 | object = data; |
| 13626 | |
| 13627 | result = new Array(object.length); |
| 13628 | |
| 13629 | for (index = 0, length = object.length; index < length; index += 1) { |
| 13630 | pair = object[index]; |
| 13631 | |
| 13632 | keys = Object.keys(pair); |
| 13633 | |
| 13634 | result[index] = [ keys[0], pair[keys[0]] ]; |
| 13635 | } |
| 13636 | |
| 13637 | return result; |
| 13638 | } |
| 13639 | |
| 13640 | module.exports = new Type('tag:yaml.org,2002:pairs', { |
| 13641 | kind: 'sequence', |
| 13642 | resolve: resolveYamlPairs, |
| 13643 | construct: constructYamlPairs |
| 13644 | }); |
| 13645 | |
| 13646 | },{"../type":32}],45:[function(require,module,exports){ |
| 13647 | 'use strict'; |
| 13648 | |
| 13649 | var Type = require('../type'); |
| 13650 | |
| 13651 | module.exports = new Type('tag:yaml.org,2002:seq', { |
| 13652 | kind: 'sequence', |
| 13653 | construct: function (data) { return data !== null ? data : []; } |
| 13654 | }); |
| 13655 | |
| 13656 | },{"../type":32}],46:[function(require,module,exports){ |
| 13657 | 'use strict'; |
| 13658 | |
| 13659 | var Type = require('../type'); |
| 13660 | |
| 13661 | var _hasOwnProperty = Object.prototype.hasOwnProperty; |
| 13662 | |
| 13663 | function resolveYamlSet(data) { |
| 13664 | if (data === null) return true; |
| 13665 | |
| 13666 | var key, object = data; |
| 13667 | |
| 13668 | for (key in object) { |
| 13669 | if (_hasOwnProperty.call(object, key)) { |
| 13670 | if (object[key] !== null) return false; |
| 13671 | } |
| 13672 | } |
| 13673 | |
| 13674 | return true; |
| 13675 | } |
| 13676 | |
| 13677 | function constructYamlSet(data) { |
| 13678 | return data !== null ? data : {}; |
| 13679 | } |
| 13680 | |
| 13681 | module.exports = new Type('tag:yaml.org,2002:set', { |
| 13682 | kind: 'mapping', |
| 13683 | resolve: resolveYamlSet, |
| 13684 | construct: constructYamlSet |
| 13685 | }); |
| 13686 | |
| 13687 | },{"../type":32}],47:[function(require,module,exports){ |
| 13688 | 'use strict'; |
| 13689 | |
| 13690 | var Type = require('../type'); |
| 13691 | |
| 13692 | module.exports = new Type('tag:yaml.org,2002:str', { |
| 13693 | kind: 'scalar', |
| 13694 | construct: function (data) { return data !== null ? data : ''; } |
| 13695 | }); |
| 13696 | |
| 13697 | },{"../type":32}],48:[function(require,module,exports){ |
| 13698 | 'use strict'; |
| 13699 | |
| 13700 | var Type = require('../type'); |
| 13701 | |
| 13702 | var YAML_DATE_REGEXP = new RegExp( |
| 13703 | '^([0-9][0-9][0-9][0-9])' + // [1] year |
| 13704 | '-([0-9][0-9])' + // [2] month |
| 13705 | '-([0-9][0-9])$'); // [3] day |
| 13706 | |
| 13707 | var YAML_TIMESTAMP_REGEXP = new RegExp( |
| 13708 | '^([0-9][0-9][0-9][0-9])' + // [1] year |
| 13709 | '-([0-9][0-9]?)' + // [2] month |
| 13710 | '-([0-9][0-9]?)' + // [3] day |
| 13711 | '(?:[Tt]|[ \\t]+)' + // ... |
| 13712 | '([0-9][0-9]?)' + // [4] hour |
| 13713 | ':([0-9][0-9])' + // [5] minute |
| 13714 | ':([0-9][0-9])' + // [6] second |
| 13715 | '(?:\\.([0-9]*))?' + // [7] fraction |
| 13716 | '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour |
| 13717 | '(?::([0-9][0-9]))?))?$'); // [11] tz_minute |
| 13718 | |
| 13719 | function resolveYamlTimestamp(data) { |
| 13720 | if (data === null) return false; |
| 13721 | if (YAML_DATE_REGEXP.exec(data) !== null) return true; |
| 13722 | if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true; |
| 13723 | return false; |
| 13724 | } |
| 13725 | |
| 13726 | function constructYamlTimestamp(data) { |
| 13727 | var match, year, month, day, hour, minute, second, fraction = 0, |
| 13728 | delta = null, tz_hour, tz_minute, date; |
| 13729 | |
| 13730 | match = YAML_DATE_REGEXP.exec(data); |
| 13731 | if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data); |
| 13732 | |
| 13733 | if (match === null) throw new Error('Date resolve error'); |
| 13734 | |
| 13735 | // match: [1] year [2] month [3] day |
| 13736 | |
| 13737 | year = +(match[1]); |
| 13738 | month = +(match[2]) - 1; // JS month starts with 0 |
| 13739 | day = +(match[3]); |
| 13740 | |
| 13741 | if (!match[4]) { // no hour |
| 13742 | return new Date(Date.UTC(year, month, day)); |
| 13743 | } |
| 13744 | |
| 13745 | // match: [4] hour [5] minute [6] second [7] fraction |
| 13746 | |
| 13747 | hour = +(match[4]); |
| 13748 | minute = +(match[5]); |
| 13749 | second = +(match[6]); |
| 13750 | |
| 13751 | if (match[7]) { |
| 13752 | fraction = match[7].slice(0, 3); |
| 13753 | while (fraction.length < 3) { // milli-seconds |
| 13754 | fraction += '0'; |
| 13755 | } |
| 13756 | fraction = +fraction; |
| 13757 | } |
| 13758 | |
| 13759 | // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute |
| 13760 | |
| 13761 | if (match[9]) { |
| 13762 | tz_hour = +(match[10]); |
| 13763 | tz_minute = +(match[11] || 0); |
| 13764 | delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds |
| 13765 | if (match[9] === '-') delta = -delta; |
| 13766 | } |
| 13767 | |
| 13768 | date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); |
| 13769 | |
| 13770 | if (delta) date.setTime(date.getTime() - delta); |
| 13771 | |
| 13772 | return date; |
| 13773 | } |
| 13774 | |
| 13775 | function representYamlTimestamp(object /*, style*/) { |
| 13776 | return object.toISOString(); |
| 13777 | } |
| 13778 | |
| 13779 | module.exports = new Type('tag:yaml.org,2002:timestamp', { |
| 13780 | kind: 'scalar', |
| 13781 | resolve: resolveYamlTimestamp, |
| 13782 | construct: constructYamlTimestamp, |
| 13783 | instanceOf: Date, |
| 13784 | represent: representYamlTimestamp |
| 13785 | }); |
| 13786 | |
| 13787 | },{"../type":32}],49:[function(require,module,exports){ |
| 13788 | var baseIndexOf = require('../internal/baseIndexOf'), |
| 13789 | binaryIndex = require('../internal/binaryIndex'); |
| 13790 | |
| 13791 | /* Native method references for those with the same name as other `lodash` methods. */ |
| 13792 | var nativeMax = Math.max; |
| 13793 | |
| 13794 | /** |
| 13795 | * Gets the index at which the first occurrence of `value` is found in `array` |
| 13796 | * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) |
| 13797 | * for equality comparisons. If `fromIndex` is negative, it's used as the offset |
| 13798 | * from the end of `array`. If `array` is sorted providing `true` for `fromIndex` |
| 13799 | * performs a faster binary search. |
| 13800 | * |
| 13801 | * @static |
| 13802 | * @memberOf _ |
| 13803 | * @category Array |
| 13804 | * @param {Array} array The array to search. |
| 13805 | * @param {*} value The value to search for. |
| 13806 | * @param {boolean|number} [fromIndex=0] The index to search from or `true` |
| 13807 | * to perform a binary search on a sorted array. |
| 13808 | * @returns {number} Returns the index of the matched value, else `-1`. |
| 13809 | * @example |
| 13810 | * |
| 13811 | * _.indexOf([1, 2, 1, 2], 2); |
| 13812 | * // => 1 |
| 13813 | * |
| 13814 | * // using `fromIndex` |
| 13815 | * _.indexOf([1, 2, 1, 2], 2, 2); |
| 13816 | * // => 3 |
| 13817 | * |
| 13818 | * // performing a binary search |
| 13819 | * _.indexOf([1, 1, 2, 2], 2, true); |
| 13820 | * // => 2 |
| 13821 | */ |
| 13822 | function indexOf(array, value, fromIndex) { |
| 13823 | var length = array ? array.length : 0; |
| 13824 | if (!length) { |
| 13825 | return -1; |
| 13826 | } |
| 13827 | if (typeof fromIndex == 'number') { |
| 13828 | fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex; |
| 13829 | } else if (fromIndex) { |
| 13830 | var index = binaryIndex(array, value); |
| 13831 | if (index < length && |
| 13832 | (value === value ? (value === array[index]) : (array[index] !== array[index]))) { |
| 13833 | return index; |
| 13834 | } |
| 13835 | return -1; |
| 13836 | } |
| 13837 | return baseIndexOf(array, value, fromIndex || 0); |
| 13838 | } |
| 13839 | |
| 13840 | module.exports = indexOf; |
| 13841 | |
| 13842 | },{"../internal/baseIndexOf":78,"../internal/binaryIndex":92}],50:[function(require,module,exports){ |
| 13843 | /** |
| 13844 | * Gets the last element of `array`. |
| 13845 | * |
| 13846 | * @static |
| 13847 | * @memberOf _ |
| 13848 | * @category Array |
| 13849 | * @param {Array} array The array to query. |
| 13850 | * @returns {*} Returns the last element of `array`. |
| 13851 | * @example |
| 13852 | * |
| 13853 | * _.last([1, 2, 3]); |
| 13854 | * // => 3 |
| 13855 | */ |
| 13856 | function last(array) { |
| 13857 | var length = array ? array.length : 0; |
| 13858 | return length ? array[length - 1] : undefined; |
| 13859 | } |
| 13860 | |
| 13861 | module.exports = last; |
| 13862 | |
| 13863 | },{}],51:[function(require,module,exports){ |
| 13864 | var LazyWrapper = require('../internal/LazyWrapper'), |
| 13865 | LodashWrapper = require('../internal/LodashWrapper'), |
| 13866 | baseLodash = require('../internal/baseLodash'), |
| 13867 | isArray = require('../lang/isArray'), |
| 13868 | isObjectLike = require('../internal/isObjectLike'), |
| 13869 | wrapperClone = require('../internal/wrapperClone'); |
| 13870 | |
| 13871 | /** Used for native method references. */ |
| 13872 | var objectProto = Object.prototype; |
| 13873 | |
| 13874 | /** Used to check objects for own properties. */ |
| 13875 | var hasOwnProperty = objectProto.hasOwnProperty; |
| 13876 | |
| 13877 | /** |
| 13878 | * Creates a `lodash` object which wraps `value` to enable implicit chaining. |
| 13879 | * Methods that operate on and return arrays, collections, and functions can |
| 13880 | * be chained together. Methods that retrieve a single value or may return a |
| 13881 | * primitive value will automatically end the chain returning the unwrapped |
| 13882 | * value. Explicit chaining may be enabled using `_.chain`. The execution of |
| 13883 | * chained methods is lazy, that is, execution is deferred until `_#value` |
| 13884 | * is implicitly or explicitly called. |
| 13885 | * |
| 13886 | * Lazy evaluation allows several methods to support shortcut fusion. Shortcut |
| 13887 | * fusion is an optimization strategy which merge iteratee calls; this can help |
| 13888 | * to avoid the creation of intermediate data structures and greatly reduce the |
| 13889 | * number of iteratee executions. |
| 13890 | * |
| 13891 | * Chaining is supported in custom builds as long as the `_#value` method is |
| 13892 | * directly or indirectly included in the build. |
| 13893 | * |
| 13894 | * In addition to lodash methods, wrappers have `Array` and `String` methods. |
| 13895 | * |
| 13896 | * The wrapper `Array` methods are: |
| 13897 | * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`, |
| 13898 | * `splice`, and `unshift` |
| 13899 | * |
| 13900 | * The wrapper `String` methods are: |
| 13901 | * `replace` and `split` |
| 13902 | * |
| 13903 | * The wrapper methods that support shortcut fusion are: |
| 13904 | * `compact`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `filter`, |
| 13905 | * `first`, `initial`, `last`, `map`, `pluck`, `reject`, `rest`, `reverse`, |
| 13906 | * `slice`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `toArray`, |
| 13907 | * and `where` |
| 13908 | * |
| 13909 | * The chainable wrapper methods are: |
| 13910 | * `after`, `ary`, `assign`, `at`, `before`, `bind`, `bindAll`, `bindKey`, |
| 13911 | * `callback`, `chain`, `chunk`, `commit`, `compact`, `concat`, `constant`, |
| 13912 | * `countBy`, `create`, `curry`, `debounce`, `defaults`, `defaultsDeep`, |
| 13913 | * `defer`, `delay`, `difference`, `drop`, `dropRight`, `dropRightWhile`, |
| 13914 | * `dropWhile`, `fill`, `filter`, `flatten`, `flattenDeep`, `flow`, `flowRight`, |
| 13915 | * `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, |
| 13916 | * `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, |
| 13917 | * `invoke`, `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, |
| 13918 | * `matchesProperty`, `memoize`, `merge`, `method`, `methodOf`, `mixin`, |
| 13919 | * `modArgs`, `negate`, `omit`, `once`, `pairs`, `partial`, `partialRight`, |
| 13920 | * `partition`, `pick`, `plant`, `pluck`, `property`, `propertyOf`, `pull`, |
| 13921 | * `pullAt`, `push`, `range`, `rearg`, `reject`, `remove`, `rest`, `restParam`, |
| 13922 | * `reverse`, `set`, `shuffle`, `slice`, `sort`, `sortBy`, `sortByAll`, |
| 13923 | * `sortByOrder`, `splice`, `spread`, `take`, `takeRight`, `takeRightWhile`, |
| 13924 | * `takeWhile`, `tap`, `throttle`, `thru`, `times`, `toArray`, `toPlainObject`, |
| 13925 | * `transform`, `union`, `uniq`, `unshift`, `unzip`, `unzipWith`, `values`, |
| 13926 | * `valuesIn`, `where`, `without`, `wrap`, `xor`, `zip`, `zipObject`, `zipWith` |
| 13927 | * |
| 13928 | * The wrapper methods that are **not** chainable by default are: |
| 13929 | * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clone`, `cloneDeep`, |
| 13930 | * `deburr`, `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`, |
| 13931 | * `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`, |
| 13932 | * `floor`, `get`, `gt`, `gte`, `has`, `identity`, `includes`, `indexOf`, |
| 13933 | * `inRange`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`, |
| 13934 | * `isEmpty`, `isEqual`, `isError`, `isFinite` `isFunction`, `isMatch`, |
| 13935 | * `isNative`, `isNaN`, `isNull`, `isNumber`, `isObject`, `isPlainObject`, |
| 13936 | * `isRegExp`, `isString`, `isUndefined`, `isTypedArray`, `join`, `kebabCase`, |
| 13937 | * `last`, `lastIndexOf`, `lt`, `lte`, `max`, `min`, `noConflict`, `noop`, |
| 13938 | * `now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`, `random`, `reduce`, |
| 13939 | * `reduceRight`, `repeat`, `result`, `round`, `runInContext`, `shift`, `size`, |
| 13940 | * `snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`, `startCase`, |
| 13941 | * `startsWith`, `sum`, `template`, `trim`, `trimLeft`, `trimRight`, `trunc`, |
| 13942 | * `unescape`, `uniqueId`, `value`, and `words` |
| 13943 | * |
| 13944 | * The wrapper method `sample` will return a wrapped value when `n` is provided, |
| 13945 | * otherwise an unwrapped value is returned. |
| 13946 | * |
| 13947 | * @name _ |
| 13948 | * @constructor |
| 13949 | * @category Chain |
| 13950 | * @param {*} value The value to wrap in a `lodash` instance. |
| 13951 | * @returns {Object} Returns the new `lodash` wrapper instance. |
| 13952 | * @example |
| 13953 | * |
| 13954 | * var wrapped = _([1, 2, 3]); |
| 13955 | * |
| 13956 | * // returns an unwrapped value |
| 13957 | * wrapped.reduce(function(total, n) { |
| 13958 | * return total + n; |
| 13959 | * }); |
| 13960 | * // => 6 |
| 13961 | * |
| 13962 | * // returns a wrapped value |
| 13963 | * var squares = wrapped.map(function(n) { |
| 13964 | * return n * n; |
| 13965 | * }); |
| 13966 | * |
| 13967 | * _.isArray(squares); |
| 13968 | * // => false |
| 13969 | * |
| 13970 | * _.isArray(squares.value()); |
| 13971 | * // => true |
| 13972 | */ |
| 13973 | function lodash(value) { |
| 13974 | if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { |
| 13975 | if (value instanceof LodashWrapper) { |
| 13976 | return value; |
| 13977 | } |
| 13978 | if (hasOwnProperty.call(value, '__chain__') && hasOwnProperty.call(value, '__wrapped__')) { |
| 13979 | return wrapperClone(value); |
| 13980 | } |
| 13981 | } |
| 13982 | return new LodashWrapper(value); |
| 13983 | } |
| 13984 | |
| 13985 | // Ensure wrappers are instances of `baseLodash`. |
| 13986 | lodash.prototype = baseLodash.prototype; |
| 13987 | |
| 13988 | module.exports = lodash; |
| 13989 | |
| 13990 | },{"../internal/LazyWrapper":60,"../internal/LodashWrapper":61,"../internal/baseLodash":82,"../internal/isObjectLike":126,"../internal/wrapperClone":137,"../lang/isArray":140}],52:[function(require,module,exports){ |
| 13991 | module.exports = require('./forEach'); |
| 13992 | |
| 13993 | },{"./forEach":54}],53:[function(require,module,exports){ |
| 13994 | var baseEach = require('../internal/baseEach'), |
| 13995 | createFind = require('../internal/createFind'); |
| 13996 | |
| 13997 | /** |
| 13998 | * Iterates over elements of `collection`, returning the first element |
| 13999 | * `predicate` returns truthy for. The predicate is bound to `thisArg` and |
| 14000 | * invoked with three arguments: (value, index|key, collection). |
| 14001 | * |
| 14002 | * If a property name is provided for `predicate` the created `_.property` |
| 14003 | * style callback returns the property value of the given element. |
| 14004 | * |
| 14005 | * If a value is also provided for `thisArg` the created `_.matchesProperty` |
| 14006 | * style callback returns `true` for elements that have a matching property |
| 14007 | * value, else `false`. |
| 14008 | * |
| 14009 | * If an object is provided for `predicate` the created `_.matches` style |
| 14010 | * callback returns `true` for elements that have the properties of the given |
| 14011 | * object, else `false`. |
| 14012 | * |
| 14013 | * @static |
| 14014 | * @memberOf _ |
| 14015 | * @alias detect |
| 14016 | * @category Collection |
| 14017 | * @param {Array|Object|string} collection The collection to search. |
| 14018 | * @param {Function|Object|string} [predicate=_.identity] The function invoked |
| 14019 | * per iteration. |
| 14020 | * @param {*} [thisArg] The `this` binding of `predicate`. |
| 14021 | * @returns {*} Returns the matched element, else `undefined`. |
| 14022 | * @example |
| 14023 | * |
| 14024 | * var users = [ |
| 14025 | * { 'user': 'barney', 'age': 36, 'active': true }, |
| 14026 | * { 'user': 'fred', 'age': 40, 'active': false }, |
| 14027 | * { 'user': 'pebbles', 'age': 1, 'active': true } |
| 14028 | * ]; |
| 14029 | * |
| 14030 | * _.result(_.find(users, function(chr) { |
| 14031 | * return chr.age < 40; |
| 14032 | * }), 'user'); |
| 14033 | * // => 'barney' |
| 14034 | * |
| 14035 | * // using the `_.matches` callback shorthand |
| 14036 | * _.result(_.find(users, { 'age': 1, 'active': true }), 'user'); |
| 14037 | * // => 'pebbles' |
| 14038 | * |
| 14039 | * // using the `_.matchesProperty` callback shorthand |
| 14040 | * _.result(_.find(users, 'active', false), 'user'); |
| 14041 | * // => 'fred' |
| 14042 | * |
| 14043 | * // using the `_.property` callback shorthand |
| 14044 | * _.result(_.find(users, 'active'), 'user'); |
| 14045 | * // => 'barney' |
| 14046 | */ |
| 14047 | var find = createFind(baseEach); |
| 14048 | |
| 14049 | module.exports = find; |
| 14050 | |
| 14051 | },{"../internal/baseEach":71,"../internal/createFind":102}],54:[function(require,module,exports){ |
| 14052 | var arrayEach = require('../internal/arrayEach'), |
| 14053 | baseEach = require('../internal/baseEach'), |
| 14054 | createForEach = require('../internal/createForEach'); |
| 14055 | |
| 14056 | /** |
| 14057 | * Iterates over elements of `collection` invoking `iteratee` for each element. |
| 14058 | * The `iteratee` is bound to `thisArg` and invoked with three arguments: |
| 14059 | * (value, index|key, collection). Iteratee functions may exit iteration early |
| 14060 | * by explicitly returning `false`. |
| 14061 | * |
| 14062 | * **Note:** As with other "Collections" methods, objects with a "length" property |
| 14063 | * are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn` |
| 14064 | * may be used for object iteration. |
| 14065 | * |
| 14066 | * @static |
| 14067 | * @memberOf _ |
| 14068 | * @alias each |
| 14069 | * @category Collection |
| 14070 | * @param {Array|Object|string} collection The collection to iterate over. |
| 14071 | * @param {Function} [iteratee=_.identity] The function invoked per iteration. |
| 14072 | * @param {*} [thisArg] The `this` binding of `iteratee`. |
| 14073 | * @returns {Array|Object|string} Returns `collection`. |
| 14074 | * @example |
| 14075 | * |
| 14076 | * _([1, 2]).forEach(function(n) { |
| 14077 | * console.log(n); |
| 14078 | * }).value(); |
| 14079 | * // => logs each value from left to right and returns the array |
| 14080 | * |
| 14081 | * _.forEach({ 'a': 1, 'b': 2 }, function(n, key) { |
| 14082 | * console.log(n, key); |
| 14083 | * }); |
| 14084 | * // => logs each value-key pair and returns the object (iteration order is not guaranteed) |
| 14085 | */ |
| 14086 | var forEach = createForEach(arrayEach, baseEach); |
| 14087 | |
| 14088 | module.exports = forEach; |
| 14089 | |
| 14090 | },{"../internal/arrayEach":63,"../internal/baseEach":71,"../internal/createForEach":103}],55:[function(require,module,exports){ |
| 14091 | var baseIndexOf = require('../internal/baseIndexOf'), |
| 14092 | getLength = require('../internal/getLength'), |
| 14093 | isArray = require('../lang/isArray'), |
| 14094 | isIterateeCall = require('../internal/isIterateeCall'), |
| 14095 | isLength = require('../internal/isLength'), |
| 14096 | isString = require('../lang/isString'), |
| 14097 | values = require('../object/values'); |
| 14098 | |
| 14099 | /* Native method references for those with the same name as other `lodash` methods. */ |
| 14100 | var nativeMax = Math.max; |
| 14101 | |
| 14102 | /** |
| 14103 | * Checks if `target` is in `collection` using |
| 14104 | * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) |
| 14105 | * for equality comparisons. If `fromIndex` is negative, it's used as the offset |
| 14106 | * from the end of `collection`. |
| 14107 | * |
| 14108 | * @static |
| 14109 | * @memberOf _ |
| 14110 | * @alias contains, include |
| 14111 | * @category Collection |
| 14112 | * @param {Array|Object|string} collection The collection to search. |
| 14113 | * @param {*} target The value to search for. |
| 14114 | * @param {number} [fromIndex=0] The index to search from. |
| 14115 | * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`. |
| 14116 | * @returns {boolean} Returns `true` if a matching element is found, else `false`. |
| 14117 | * @example |
| 14118 | * |
| 14119 | * _.includes([1, 2, 3], 1); |
| 14120 | * // => true |
| 14121 | * |
| 14122 | * _.includes([1, 2, 3], 1, 2); |
| 14123 | * // => false |
| 14124 | * |
| 14125 | * _.includes({ 'user': 'fred', 'age': 40 }, 'fred'); |
| 14126 | * // => true |
| 14127 | * |
| 14128 | * _.includes('pebbles', 'eb'); |
| 14129 | * // => true |
| 14130 | */ |
| 14131 | function includes(collection, target, fromIndex, guard) { |
| 14132 | var length = collection ? getLength(collection) : 0; |
| 14133 | if (!isLength(length)) { |
| 14134 | collection = values(collection); |
| 14135 | length = collection.length; |
| 14136 | } |
| 14137 | if (typeof fromIndex != 'number' || (guard && isIterateeCall(target, fromIndex, guard))) { |
| 14138 | fromIndex = 0; |
| 14139 | } else { |
| 14140 | fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0); |
| 14141 | } |
| 14142 | return (typeof collection == 'string' || !isArray(collection) && isString(collection)) |
| 14143 | ? (fromIndex <= length && collection.indexOf(target, fromIndex) > -1) |
| 14144 | : (!!length && baseIndexOf(collection, target, fromIndex) > -1); |
| 14145 | } |
| 14146 | |
| 14147 | module.exports = includes; |
| 14148 | |
| 14149 | },{"../internal/baseIndexOf":78,"../internal/getLength":112,"../internal/isIterateeCall":122,"../internal/isLength":125,"../lang/isArray":140,"../lang/isString":146,"../object/values":152}],56:[function(require,module,exports){ |
| 14150 | var arrayMap = require('../internal/arrayMap'), |
| 14151 | baseCallback = require('../internal/baseCallback'), |
| 14152 | baseMap = require('../internal/baseMap'), |
| 14153 | isArray = require('../lang/isArray'); |
| 14154 | |
| 14155 | /** |
| 14156 | * Creates an array of values by running each element in `collection` through |
| 14157 | * `iteratee`. The `iteratee` is bound to `thisArg` and invoked with three |
| 14158 | * arguments: (value, index|key, collection). |
| 14159 | * |
| 14160 | * If a property name is provided for `iteratee` the created `_.property` |
| 14161 | * style callback returns the property value of the given element. |
| 14162 | * |
| 14163 | * If a value is also provided for `thisArg` the created `_.matchesProperty` |
| 14164 | * style callback returns `true` for elements that have a matching property |
| 14165 | * value, else `false`. |
| 14166 | * |
| 14167 | * If an object is provided for `iteratee` the created `_.matches` style |
| 14168 | * callback returns `true` for elements that have the properties of the given |
| 14169 | * object, else `false`. |
| 14170 | * |
| 14171 | * Many lodash methods are guarded to work as iteratees for methods like |
| 14172 | * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. |
| 14173 | * |
| 14174 | * The guarded methods are: |
| 14175 | * `ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`, |
| 14176 | * `drop`, `dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`, |
| 14177 | * `parseInt`, `slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`, |
| 14178 | * `trimLeft`, `trimRight`, `trunc`, `random`, `range`, `sample`, `some`, |
| 14179 | * `sum`, `uniq`, and `words` |
| 14180 | * |
| 14181 | * @static |
| 14182 | * @memberOf _ |
| 14183 | * @alias collect |
| 14184 | * @category Collection |
| 14185 | * @param {Array|Object|string} collection The collection to iterate over. |
| 14186 | * @param {Function|Object|string} [iteratee=_.identity] The function invoked |
| 14187 | * per iteration. |
| 14188 | * @param {*} [thisArg] The `this` binding of `iteratee`. |
| 14189 | * @returns {Array} Returns the new mapped array. |
| 14190 | * @example |
| 14191 | * |
| 14192 | * function timesThree(n) { |
| 14193 | * return n * 3; |
| 14194 | * } |
| 14195 | * |
| 14196 | * _.map([1, 2], timesThree); |
| 14197 | * // => [3, 6] |
| 14198 | * |
| 14199 | * _.map({ 'a': 1, 'b': 2 }, timesThree); |
| 14200 | * // => [3, 6] (iteration order is not guaranteed) |
| 14201 | * |
| 14202 | * var users = [ |
| 14203 | * { 'user': 'barney' }, |
| 14204 | * { 'user': 'fred' } |
| 14205 | * ]; |
| 14206 | * |
| 14207 | * // using the `_.property` callback shorthand |
| 14208 | * _.map(users, 'user'); |
| 14209 | * // => ['barney', 'fred'] |
| 14210 | */ |
| 14211 | function map(collection, iteratee, thisArg) { |
| 14212 | var func = isArray(collection) ? arrayMap : baseMap; |
| 14213 | iteratee = baseCallback(iteratee, thisArg, 3); |
| 14214 | return func(collection, iteratee); |
| 14215 | } |
| 14216 | |
| 14217 | module.exports = map; |
| 14218 | |
| 14219 | },{"../internal/arrayMap":64,"../internal/baseCallback":67,"../internal/baseMap":83,"../lang/isArray":140}],57:[function(require,module,exports){ |
| 14220 | var getNative = require('../internal/getNative'); |
| 14221 | |
| 14222 | /* Native method references for those with the same name as other `lodash` methods. */ |
| 14223 | var nativeNow = getNative(Date, 'now'); |
| 14224 | |
| 14225 | /** |
| 14226 | * Gets the number of milliseconds that have elapsed since the Unix epoch |
| 14227 | * (1 January 1970 00:00:00 UTC). |
| 14228 | * |
| 14229 | * @static |
| 14230 | * @memberOf _ |
| 14231 | * @category Date |
| 14232 | * @example |
| 14233 | * |
| 14234 | * _.defer(function(stamp) { |
| 14235 | * console.log(_.now() - stamp); |
| 14236 | * }, _.now()); |
| 14237 | * // => logs the number of milliseconds it took for the deferred function to be invoked |
| 14238 | */ |
| 14239 | var now = nativeNow || function() { |
| 14240 | return new Date().getTime(); |
| 14241 | }; |
| 14242 | |
| 14243 | module.exports = now; |
| 14244 | |
| 14245 | },{"../internal/getNative":114}],58:[function(require,module,exports){ |
| 14246 | var createWrapper = require('../internal/createWrapper'), |
| 14247 | replaceHolders = require('../internal/replaceHolders'), |
| 14248 | restParam = require('./restParam'); |
| 14249 | |
| 14250 | /** Used to compose bitmasks for wrapper metadata. */ |
| 14251 | var BIND_FLAG = 1, |
| 14252 | PARTIAL_FLAG = 32; |
| 14253 | |
| 14254 | /** |
| 14255 | * Creates a function that invokes `func` with the `this` binding of `thisArg` |
| 14256 | * and prepends any additional `_.bind` arguments to those provided to the |
| 14257 | * bound function. |
| 14258 | * |
| 14259 | * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, |
| 14260 | * may be used as a placeholder for partially applied arguments. |
| 14261 | * |
| 14262 | * **Note:** Unlike native `Function#bind` this method does not set the "length" |
| 14263 | * property of bound functions. |
| 14264 | * |
| 14265 | * @static |
| 14266 | * @memberOf _ |
| 14267 | * @category Function |
| 14268 | * @param {Function} func The function to bind. |
| 14269 | * @param {*} thisArg The `this` binding of `func`. |
| 14270 | * @param {...*} [partials] The arguments to be partially applied. |
| 14271 | * @returns {Function} Returns the new bound function. |
| 14272 | * @example |
| 14273 | * |
| 14274 | * var greet = function(greeting, punctuation) { |
| 14275 | * return greeting + ' ' + this.user + punctuation; |
| 14276 | * }; |
| 14277 | * |
| 14278 | * var object = { 'user': 'fred' }; |
| 14279 | * |
| 14280 | * var bound = _.bind(greet, object, 'hi'); |
| 14281 | * bound('!'); |
| 14282 | * // => 'hi fred!' |
| 14283 | * |
| 14284 | * // using placeholders |
| 14285 | * var bound = _.bind(greet, object, _, '!'); |
| 14286 | * bound('hi'); |
| 14287 | * // => 'hi fred!' |
| 14288 | */ |
| 14289 | var bind = restParam(function(func, thisArg, partials) { |
| 14290 | var bitmask = BIND_FLAG; |
| 14291 | if (partials.length) { |
| 14292 | var holders = replaceHolders(partials, bind.placeholder); |
| 14293 | bitmask |= PARTIAL_FLAG; |
| 14294 | } |
| 14295 | return createWrapper(func, bitmask, thisArg, partials, holders); |
| 14296 | }); |
| 14297 | |
| 14298 | // Assign default placeholders. |
| 14299 | bind.placeholder = {}; |
| 14300 | |
| 14301 | module.exports = bind; |
| 14302 | |
| 14303 | },{"../internal/createWrapper":106,"../internal/replaceHolders":132,"./restParam":59}],59:[function(require,module,exports){ |
| 14304 | /** Used as the `TypeError` message for "Functions" methods. */ |
| 14305 | var FUNC_ERROR_TEXT = 'Expected a function'; |
| 14306 | |
| 14307 | /* Native method references for those with the same name as other `lodash` methods. */ |
| 14308 | var nativeMax = Math.max; |
| 14309 | |
| 14310 | /** |
| 14311 | * Creates a function that invokes `func` with the `this` binding of the |
| 14312 | * created function and arguments from `start` and beyond provided as an array. |
| 14313 | * |
| 14314 | * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/Web/JavaScript/Reference/Functions/rest_parameters). |
| 14315 | * |
| 14316 | * @static |
| 14317 | * @memberOf _ |
| 14318 | * @category Function |
| 14319 | * @param {Function} func The function to apply a rest parameter to. |
| 14320 | * @param {number} [start=func.length-1] The start position of the rest parameter. |
| 14321 | * @returns {Function} Returns the new function. |
| 14322 | * @example |
| 14323 | * |
| 14324 | * var say = _.restParam(function(what, names) { |
| 14325 | * return what + ' ' + _.initial(names).join(', ') + |
| 14326 | * (_.size(names) > 1 ? ', & ' : '') + _.last(names); |
| 14327 | * }); |
| 14328 | * |
| 14329 | * say('hello', 'fred', 'barney', 'pebbles'); |
| 14330 | * // => 'hello fred, barney, & pebbles' |
| 14331 | */ |
| 14332 | function restParam(func, start) { |
| 14333 | if (typeof func != 'function') { |
| 14334 | throw new TypeError(FUNC_ERROR_TEXT); |
| 14335 | } |
| 14336 | start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0); |
| 14337 | return function() { |
| 14338 | var args = arguments, |
| 14339 | index = -1, |
| 14340 | length = nativeMax(args.length - start, 0), |
| 14341 | rest = Array(length); |
| 14342 | |
| 14343 | while (++index < length) { |
| 14344 | rest[index] = args[start + index]; |
| 14345 | } |
| 14346 | switch (start) { |
| 14347 | case 0: return func.call(this, rest); |
| 14348 | case 1: return func.call(this, args[0], rest); |
| 14349 | case 2: return func.call(this, args[0], args[1], rest); |
| 14350 | } |
| 14351 | var otherArgs = Array(start + 1); |
| 14352 | index = -1; |
| 14353 | while (++index < start) { |
| 14354 | otherArgs[index] = args[index]; |
| 14355 | } |
| 14356 | otherArgs[start] = rest; |
| 14357 | return func.apply(this, otherArgs); |
| 14358 | }; |
| 14359 | } |
| 14360 | |
| 14361 | module.exports = restParam; |
| 14362 | |
| 14363 | },{}],60:[function(require,module,exports){ |
| 14364 | var baseCreate = require('./baseCreate'), |
| 14365 | baseLodash = require('./baseLodash'); |
| 14366 | |
| 14367 | /** Used as references for `-Infinity` and `Infinity`. */ |
| 14368 | var POSITIVE_INFINITY = Number.POSITIVE_INFINITY; |
| 14369 | |
| 14370 | /** |
| 14371 | * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. |
| 14372 | * |
| 14373 | * @private |
| 14374 | * @param {*} value The value to wrap. |
| 14375 | */ |
| 14376 | function LazyWrapper(value) { |
| 14377 | this.__wrapped__ = value; |
| 14378 | this.__actions__ = []; |
| 14379 | this.__dir__ = 1; |
| 14380 | this.__filtered__ = false; |
| 14381 | this.__iteratees__ = []; |
| 14382 | this.__takeCount__ = POSITIVE_INFINITY; |
| 14383 | this.__views__ = []; |
| 14384 | } |
| 14385 | |
| 14386 | LazyWrapper.prototype = baseCreate(baseLodash.prototype); |
| 14387 | LazyWrapper.prototype.constructor = LazyWrapper; |
| 14388 | |
| 14389 | module.exports = LazyWrapper; |
| 14390 | |
| 14391 | },{"./baseCreate":70,"./baseLodash":82}],61:[function(require,module,exports){ |
| 14392 | var baseCreate = require('./baseCreate'), |
| 14393 | baseLodash = require('./baseLodash'); |
| 14394 | |
| 14395 | /** |
| 14396 | * The base constructor for creating `lodash` wrapper objects. |
| 14397 | * |
| 14398 | * @private |
| 14399 | * @param {*} value The value to wrap. |
| 14400 | * @param {boolean} [chainAll] Enable chaining for all wrapper methods. |
| 14401 | * @param {Array} [actions=[]] Actions to peform to resolve the unwrapped value. |
| 14402 | */ |
| 14403 | function LodashWrapper(value, chainAll, actions) { |
| 14404 | this.__wrapped__ = value; |
| 14405 | this.__actions__ = actions || []; |
| 14406 | this.__chain__ = !!chainAll; |
| 14407 | } |
| 14408 | |
| 14409 | LodashWrapper.prototype = baseCreate(baseLodash.prototype); |
| 14410 | LodashWrapper.prototype.constructor = LodashWrapper; |
| 14411 | |
| 14412 | module.exports = LodashWrapper; |
| 14413 | |
| 14414 | },{"./baseCreate":70,"./baseLodash":82}],62:[function(require,module,exports){ |
| 14415 | /** |
| 14416 | * Copies the values of `source` to `array`. |
| 14417 | * |
| 14418 | * @private |
| 14419 | * @param {Array} source The array to copy values from. |
| 14420 | * @param {Array} [array=[]] The array to copy values to. |
| 14421 | * @returns {Array} Returns `array`. |
| 14422 | */ |
| 14423 | function arrayCopy(source, array) { |
| 14424 | var index = -1, |
| 14425 | length = source.length; |
| 14426 | |
| 14427 | array || (array = Array(length)); |
| 14428 | while (++index < length) { |
| 14429 | array[index] = source[index]; |
| 14430 | } |
| 14431 | return array; |
| 14432 | } |
| 14433 | |
| 14434 | module.exports = arrayCopy; |
| 14435 | |
| 14436 | },{}],63:[function(require,module,exports){ |
| 14437 | /** |
| 14438 | * A specialized version of `_.forEach` for arrays without support for callback |
| 14439 | * shorthands and `this` binding. |
| 14440 | * |
| 14441 | * @private |
| 14442 | * @param {Array} array The array to iterate over. |
| 14443 | * @param {Function} iteratee The function invoked per iteration. |
| 14444 | * @returns {Array} Returns `array`. |
| 14445 | */ |
| 14446 | function arrayEach(array, iteratee) { |
| 14447 | var index = -1, |
| 14448 | length = array.length; |
| 14449 | |
| 14450 | while (++index < length) { |
| 14451 | if (iteratee(array[index], index, array) === false) { |
| 14452 | break; |
| 14453 | } |
| 14454 | } |
| 14455 | return array; |
| 14456 | } |
| 14457 | |
| 14458 | module.exports = arrayEach; |
| 14459 | |
| 14460 | },{}],64:[function(require,module,exports){ |
| 14461 | /** |
| 14462 | * A specialized version of `_.map` for arrays without support for callback |
| 14463 | * shorthands and `this` binding. |
| 14464 | * |
| 14465 | * @private |
| 14466 | * @param {Array} array The array to iterate over. |
| 14467 | * @param {Function} iteratee The function invoked per iteration. |
| 14468 | * @returns {Array} Returns the new mapped array. |
| 14469 | */ |
| 14470 | function arrayMap(array, iteratee) { |
| 14471 | var index = -1, |
| 14472 | length = array.length, |
| 14473 | result = Array(length); |
| 14474 | |
| 14475 | while (++index < length) { |
| 14476 | result[index] = iteratee(array[index], index, array); |
| 14477 | } |
| 14478 | return result; |
| 14479 | } |
| 14480 | |
| 14481 | module.exports = arrayMap; |
| 14482 | |
| 14483 | },{}],65:[function(require,module,exports){ |
| 14484 | /** |
| 14485 | * A specialized version of `_.some` for arrays without support for callback |
| 14486 | * shorthands and `this` binding. |
| 14487 | * |
| 14488 | * @private |
| 14489 | * @param {Array} array The array to iterate over. |
| 14490 | * @param {Function} predicate The function invoked per iteration. |
| 14491 | * @returns {boolean} Returns `true` if any element passes the predicate check, |
| 14492 | * else `false`. |
| 14493 | */ |
| 14494 | function arraySome(array, predicate) { |
| 14495 | var index = -1, |
| 14496 | length = array.length; |
| 14497 | |
| 14498 | while (++index < length) { |
| 14499 | if (predicate(array[index], index, array)) { |
| 14500 | return true; |
| 14501 | } |
| 14502 | } |
| 14503 | return false; |
| 14504 | } |
| 14505 | |
| 14506 | module.exports = arraySome; |
| 14507 | |
| 14508 | },{}],66:[function(require,module,exports){ |
| 14509 | var baseCopy = require('./baseCopy'), |
| 14510 | keys = require('../object/keys'); |
| 14511 | |
| 14512 | /** |
| 14513 | * The base implementation of `_.assign` without support for argument juggling, |
| 14514 | * multiple sources, and `customizer` functions. |
| 14515 | * |
| 14516 | * @private |
| 14517 | * @param {Object} object The destination object. |
| 14518 | * @param {Object} source The source object. |
| 14519 | * @returns {Object} Returns `object`. |
| 14520 | */ |
| 14521 | function baseAssign(object, source) { |
| 14522 | return source == null |
| 14523 | ? object |
| 14524 | : baseCopy(source, keys(source), object); |
| 14525 | } |
| 14526 | |
| 14527 | module.exports = baseAssign; |
| 14528 | |
| 14529 | },{"../object/keys":149,"./baseCopy":69}],67:[function(require,module,exports){ |
| 14530 | var baseMatches = require('./baseMatches'), |
| 14531 | baseMatchesProperty = require('./baseMatchesProperty'), |
| 14532 | bindCallback = require('./bindCallback'), |
| 14533 | identity = require('../utility/identity'), |
| 14534 | property = require('../utility/property'); |
| 14535 | |
| 14536 | /** |
| 14537 | * The base implementation of `_.callback` which supports specifying the |
| 14538 | * number of arguments to provide to `func`. |
| 14539 | * |
| 14540 | * @private |
| 14541 | * @param {*} [func=_.identity] The value to convert to a callback. |
| 14542 | * @param {*} [thisArg] The `this` binding of `func`. |
| 14543 | * @param {number} [argCount] The number of arguments to provide to `func`. |
| 14544 | * @returns {Function} Returns the callback. |
| 14545 | */ |
| 14546 | function baseCallback(func, thisArg, argCount) { |
| 14547 | var type = typeof func; |
| 14548 | if (type == 'function') { |
| 14549 | return thisArg === undefined |
| 14550 | ? func |
| 14551 | : bindCallback(func, thisArg, argCount); |
| 14552 | } |
| 14553 | if (func == null) { |
| 14554 | return identity; |
| 14555 | } |
| 14556 | if (type == 'object') { |
| 14557 | return baseMatches(func); |
| 14558 | } |
| 14559 | return thisArg === undefined |
| 14560 | ? property(func) |
| 14561 | : baseMatchesProperty(func, thisArg); |
| 14562 | } |
| 14563 | |
| 14564 | module.exports = baseCallback; |
| 14565 | |
| 14566 | },{"../utility/identity":154,"../utility/property":156,"./baseMatches":84,"./baseMatchesProperty":85,"./bindCallback":94}],68:[function(require,module,exports){ |
| 14567 | var arrayCopy = require('./arrayCopy'), |
| 14568 | arrayEach = require('./arrayEach'), |
| 14569 | baseAssign = require('./baseAssign'), |
| 14570 | baseForOwn = require('./baseForOwn'), |
| 14571 | initCloneArray = require('./initCloneArray'), |
| 14572 | initCloneByTag = require('./initCloneByTag'), |
| 14573 | initCloneObject = require('./initCloneObject'), |
| 14574 | isArray = require('../lang/isArray'), |
| 14575 | isHostObject = require('./isHostObject'), |
| 14576 | isObject = require('../lang/isObject'); |
| 14577 | |
| 14578 | /** `Object#toString` result references. */ |
| 14579 | var argsTag = '[object Arguments]', |
| 14580 | arrayTag = '[object Array]', |
| 14581 | boolTag = '[object Boolean]', |
| 14582 | dateTag = '[object Date]', |
| 14583 | errorTag = '[object Error]', |
| 14584 | funcTag = '[object Function]', |
| 14585 | mapTag = '[object Map]', |
| 14586 | numberTag = '[object Number]', |
| 14587 | objectTag = '[object Object]', |
| 14588 | regexpTag = '[object RegExp]', |
| 14589 | setTag = '[object Set]', |
| 14590 | stringTag = '[object String]', |
| 14591 | weakMapTag = '[object WeakMap]'; |
| 14592 | |
| 14593 | var arrayBufferTag = '[object ArrayBuffer]', |
| 14594 | float32Tag = '[object Float32Array]', |
| 14595 | float64Tag = '[object Float64Array]', |
| 14596 | int8Tag = '[object Int8Array]', |
| 14597 | int16Tag = '[object Int16Array]', |
| 14598 | int32Tag = '[object Int32Array]', |
| 14599 | uint8Tag = '[object Uint8Array]', |
| 14600 | uint8ClampedTag = '[object Uint8ClampedArray]', |
| 14601 | uint16Tag = '[object Uint16Array]', |
| 14602 | uint32Tag = '[object Uint32Array]'; |
| 14603 | |
| 14604 | /** Used to identify `toStringTag` values supported by `_.clone`. */ |
| 14605 | var cloneableTags = {}; |
| 14606 | cloneableTags[argsTag] = cloneableTags[arrayTag] = |
| 14607 | cloneableTags[arrayBufferTag] = cloneableTags[boolTag] = |
| 14608 | cloneableTags[dateTag] = cloneableTags[float32Tag] = |
| 14609 | cloneableTags[float64Tag] = cloneableTags[int8Tag] = |
| 14610 | cloneableTags[int16Tag] = cloneableTags[int32Tag] = |
| 14611 | cloneableTags[numberTag] = cloneableTags[objectTag] = |
| 14612 | cloneableTags[regexpTag] = cloneableTags[stringTag] = |
| 14613 | cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = |
| 14614 | cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; |
| 14615 | cloneableTags[errorTag] = cloneableTags[funcTag] = |
| 14616 | cloneableTags[mapTag] = cloneableTags[setTag] = |
| 14617 | cloneableTags[weakMapTag] = false; |
| 14618 | |
| 14619 | /** Used for native method references. */ |
| 14620 | var objectProto = Object.prototype; |
| 14621 | |
| 14622 | /** |
| 14623 | * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) |
| 14624 | * of values. |
| 14625 | */ |
| 14626 | var objToString = objectProto.toString; |
| 14627 | |
| 14628 | /** |
| 14629 | * The base implementation of `_.clone` without support for argument juggling |
| 14630 | * and `this` binding `customizer` functions. |
| 14631 | * |
| 14632 | * @private |
| 14633 | * @param {*} value The value to clone. |
| 14634 | * @param {boolean} [isDeep] Specify a deep clone. |
| 14635 | * @param {Function} [customizer] The function to customize cloning values. |
| 14636 | * @param {string} [key] The key of `value`. |
| 14637 | * @param {Object} [object] The object `value` belongs to. |
| 14638 | * @param {Array} [stackA=[]] Tracks traversed source objects. |
| 14639 | * @param {Array} [stackB=[]] Associates clones with source counterparts. |
| 14640 | * @returns {*} Returns the cloned value. |
| 14641 | */ |
| 14642 | function baseClone(value, isDeep, customizer, key, object, stackA, stackB) { |
| 14643 | var result; |
| 14644 | if (customizer) { |
| 14645 | result = object ? customizer(value, key, object) : customizer(value); |
| 14646 | } |
| 14647 | if (result !== undefined) { |
| 14648 | return result; |
| 14649 | } |
| 14650 | if (!isObject(value)) { |
| 14651 | return value; |
| 14652 | } |
| 14653 | var isArr = isArray(value); |
| 14654 | if (isArr) { |
| 14655 | result = initCloneArray(value); |
| 14656 | if (!isDeep) { |
| 14657 | return arrayCopy(value, result); |
| 14658 | } |
| 14659 | } else { |
| 14660 | var tag = objToString.call(value), |
| 14661 | isFunc = tag == funcTag; |
| 14662 | |
| 14663 | if (tag == objectTag || tag == argsTag || (isFunc && !object)) { |
| 14664 | if (isHostObject(value)) { |
| 14665 | return object ? value : {}; |
| 14666 | } |
| 14667 | result = initCloneObject(isFunc ? {} : value); |
| 14668 | if (!isDeep) { |
| 14669 | return baseAssign(result, value); |
| 14670 | } |
| 14671 | } else { |
| 14672 | return cloneableTags[tag] |
| 14673 | ? initCloneByTag(value, tag, isDeep) |
| 14674 | : (object ? value : {}); |
| 14675 | } |
| 14676 | } |
| 14677 | // Check for circular references and return its corresponding clone. |
| 14678 | stackA || (stackA = []); |
| 14679 | stackB || (stackB = []); |
| 14680 | |
| 14681 | var length = stackA.length; |
| 14682 | while (length--) { |
| 14683 | if (stackA[length] == value) { |
| 14684 | return stackB[length]; |
| 14685 | } |
| 14686 | } |
| 14687 | // Add the source value to the stack of traversed objects and associate it with its clone. |
| 14688 | stackA.push(value); |
| 14689 | stackB.push(result); |
| 14690 | |
| 14691 | // Recursively populate clone (susceptible to call stack limits). |
| 14692 | (isArr ? arrayEach : baseForOwn)(value, function(subValue, key) { |
| 14693 | result[key] = baseClone(subValue, isDeep, customizer, key, value, stackA, stackB); |
| 14694 | }); |
| 14695 | return result; |
| 14696 | } |
| 14697 | |
| 14698 | module.exports = baseClone; |
| 14699 | |
| 14700 | },{"../lang/isArray":140,"../lang/isObject":144,"./arrayCopy":62,"./arrayEach":63,"./baseAssign":66,"./baseForOwn":76,"./initCloneArray":116,"./initCloneByTag":117,"./initCloneObject":118,"./isHostObject":120}],69:[function(require,module,exports){ |
| 14701 | /** |
| 14702 | * Copies properties of `source` to `object`. |
| 14703 | * |
| 14704 | * @private |
| 14705 | * @param {Object} source The object to copy properties from. |
| 14706 | * @param {Array} props The property names to copy. |
| 14707 | * @param {Object} [object={}] The object to copy properties to. |
| 14708 | * @returns {Object} Returns `object`. |
| 14709 | */ |
| 14710 | function baseCopy(source, props, object) { |
| 14711 | object || (object = {}); |
| 14712 | |
| 14713 | var index = -1, |
| 14714 | length = props.length; |
| 14715 | |
| 14716 | while (++index < length) { |
| 14717 | var key = props[index]; |
| 14718 | object[key] = source[key]; |
| 14719 | } |
| 14720 | return object; |
| 14721 | } |
| 14722 | |
| 14723 | module.exports = baseCopy; |
| 14724 | |
| 14725 | },{}],70:[function(require,module,exports){ |
| 14726 | var isObject = require('../lang/isObject'); |
| 14727 | |
| 14728 | /** |
| 14729 | * The base implementation of `_.create` without support for assigning |
| 14730 | * properties to the created object. |
| 14731 | * |
| 14732 | * @private |
| 14733 | * @param {Object} prototype The object to inherit from. |
| 14734 | * @returns {Object} Returns the new object. |
| 14735 | */ |
| 14736 | var baseCreate = (function() { |
| 14737 | function object() {} |
| 14738 | return function(prototype) { |
| 14739 | if (isObject(prototype)) { |
| 14740 | object.prototype = prototype; |
| 14741 | var result = new object; |
| 14742 | object.prototype = undefined; |
| 14743 | } |
| 14744 | return result || {}; |
| 14745 | }; |
| 14746 | }()); |
| 14747 | |
| 14748 | module.exports = baseCreate; |
| 14749 | |
| 14750 | },{"../lang/isObject":144}],71:[function(require,module,exports){ |
| 14751 | var baseForOwn = require('./baseForOwn'), |
| 14752 | createBaseEach = require('./createBaseEach'); |
| 14753 | |
| 14754 | /** |
| 14755 | * The base implementation of `_.forEach` without support for callback |
| 14756 | * shorthands and `this` binding. |
| 14757 | * |
| 14758 | * @private |
| 14759 | * @param {Array|Object|string} collection The collection to iterate over. |
| 14760 | * @param {Function} iteratee The function invoked per iteration. |
| 14761 | * @returns {Array|Object|string} Returns `collection`. |
| 14762 | */ |
| 14763 | var baseEach = createBaseEach(baseForOwn); |
| 14764 | |
| 14765 | module.exports = baseEach; |
| 14766 | |
| 14767 | },{"./baseForOwn":76,"./createBaseEach":98}],72:[function(require,module,exports){ |
| 14768 | /** |
| 14769 | * The base implementation of `_.find`, `_.findLast`, `_.findKey`, and `_.findLastKey`, |
| 14770 | * without support for callback shorthands and `this` binding, which iterates |
| 14771 | * over `collection` using the provided `eachFunc`. |
| 14772 | * |
| 14773 | * @private |
| 14774 | * @param {Array|Object|string} collection The collection to search. |
| 14775 | * @param {Function} predicate The function invoked per iteration. |
| 14776 | * @param {Function} eachFunc The function to iterate over `collection`. |
| 14777 | * @param {boolean} [retKey] Specify returning the key of the found element |
| 14778 | * instead of the element itself. |
| 14779 | * @returns {*} Returns the found element or its key, else `undefined`. |
| 14780 | */ |
| 14781 | function baseFind(collection, predicate, eachFunc, retKey) { |
| 14782 | var result; |
| 14783 | eachFunc(collection, function(value, key, collection) { |
| 14784 | if (predicate(value, key, collection)) { |
| 14785 | result = retKey ? key : value; |
| 14786 | return false; |
| 14787 | } |
| 14788 | }); |
| 14789 | return result; |
| 14790 | } |
| 14791 | |
| 14792 | module.exports = baseFind; |
| 14793 | |
| 14794 | },{}],73:[function(require,module,exports){ |
| 14795 | /** |
| 14796 | * The base implementation of `_.findIndex` and `_.findLastIndex` without |
| 14797 | * support for callback shorthands and `this` binding. |
| 14798 | * |
| 14799 | * @private |
| 14800 | * @param {Array} array The array to search. |
| 14801 | * @param {Function} predicate The function invoked per iteration. |
| 14802 | * @param {boolean} [fromRight] Specify iterating from right to left. |
| 14803 | * @returns {number} Returns the index of the matched value, else `-1`. |
| 14804 | */ |
| 14805 | function baseFindIndex(array, predicate, fromRight) { |
| 14806 | var length = array.length, |
| 14807 | index = fromRight ? length : -1; |
| 14808 | |
| 14809 | while ((fromRight ? index-- : ++index < length)) { |
| 14810 | if (predicate(array[index], index, array)) { |
| 14811 | return index; |
| 14812 | } |
| 14813 | } |
| 14814 | return -1; |
| 14815 | } |
| 14816 | |
| 14817 | module.exports = baseFindIndex; |
| 14818 | |
| 14819 | },{}],74:[function(require,module,exports){ |
| 14820 | var createBaseFor = require('./createBaseFor'); |
| 14821 | |
| 14822 | /** |
| 14823 | * The base implementation of `baseForIn` and `baseForOwn` which iterates |
| 14824 | * over `object` properties returned by `keysFunc` invoking `iteratee` for |
| 14825 | * each property. Iteratee functions may exit iteration early by explicitly |
| 14826 | * returning `false`. |
| 14827 | * |
| 14828 | * @private |
| 14829 | * @param {Object} object The object to iterate over. |
| 14830 | * @param {Function} iteratee The function invoked per iteration. |
| 14831 | * @param {Function} keysFunc The function to get the keys of `object`. |
| 14832 | * @returns {Object} Returns `object`. |
| 14833 | */ |
| 14834 | var baseFor = createBaseFor(); |
| 14835 | |
| 14836 | module.exports = baseFor; |
| 14837 | |
| 14838 | },{"./createBaseFor":99}],75:[function(require,module,exports){ |
| 14839 | var baseFor = require('./baseFor'), |
| 14840 | keysIn = require('../object/keysIn'); |
| 14841 | |
| 14842 | /** |
| 14843 | * The base implementation of `_.forIn` without support for callback |
| 14844 | * shorthands and `this` binding. |
| 14845 | * |
| 14846 | * @private |
| 14847 | * @param {Object} object The object to iterate over. |
| 14848 | * @param {Function} iteratee The function invoked per iteration. |
| 14849 | * @returns {Object} Returns `object`. |
| 14850 | */ |
| 14851 | function baseForIn(object, iteratee) { |
| 14852 | return baseFor(object, iteratee, keysIn); |
| 14853 | } |
| 14854 | |
| 14855 | module.exports = baseForIn; |
| 14856 | |
| 14857 | },{"../object/keysIn":150,"./baseFor":74}],76:[function(require,module,exports){ |
| 14858 | var baseFor = require('./baseFor'), |
| 14859 | keys = require('../object/keys'); |
| 14860 | |
| 14861 | /** |
| 14862 | * The base implementation of `_.forOwn` without support for callback |
| 14863 | * shorthands and `this` binding. |
| 14864 | * |
| 14865 | * @private |
| 14866 | * @param {Object} object The object to iterate over. |
| 14867 | * @param {Function} iteratee The function invoked per iteration. |
| 14868 | * @returns {Object} Returns `object`. |
| 14869 | */ |
| 14870 | function baseForOwn(object, iteratee) { |
| 14871 | return baseFor(object, iteratee, keys); |
| 14872 | } |
| 14873 | |
| 14874 | module.exports = baseForOwn; |
| 14875 | |
| 14876 | },{"../object/keys":149,"./baseFor":74}],77:[function(require,module,exports){ |
| 14877 | var toObject = require('./toObject'); |
| 14878 | |
| 14879 | /** |
| 14880 | * The base implementation of `get` without support for string paths |
| 14881 | * and default values. |
| 14882 | * |
| 14883 | * @private |
| 14884 | * @param {Object} object The object to query. |
| 14885 | * @param {Array} path The path of the property to get. |
| 14886 | * @param {string} [pathKey] The key representation of path. |
| 14887 | * @returns {*} Returns the resolved value. |
| 14888 | */ |
| 14889 | function baseGet(object, path, pathKey) { |
| 14890 | if (object == null) { |
| 14891 | return; |
| 14892 | } |
| 14893 | object = toObject(object); |
| 14894 | if (pathKey !== undefined && pathKey in object) { |
| 14895 | path = [pathKey]; |
| 14896 | } |
| 14897 | var index = 0, |
| 14898 | length = path.length; |
| 14899 | |
| 14900 | while (object != null && index < length) { |
| 14901 | object = toObject(object)[path[index++]]; |
| 14902 | } |
| 14903 | return (index && index == length) ? object : undefined; |
| 14904 | } |
| 14905 | |
| 14906 | module.exports = baseGet; |
| 14907 | |
| 14908 | },{"./toObject":135}],78:[function(require,module,exports){ |
| 14909 | var indexOfNaN = require('./indexOfNaN'); |
| 14910 | |
| 14911 | /** |
| 14912 | * The base implementation of `_.indexOf` without support for binary searches. |
| 14913 | * |
| 14914 | * @private |
| 14915 | * @param {Array} array The array to search. |
| 14916 | * @param {*} value The value to search for. |
| 14917 | * @param {number} fromIndex The index to search from. |
| 14918 | * @returns {number} Returns the index of the matched value, else `-1`. |
| 14919 | */ |
| 14920 | function baseIndexOf(array, value, fromIndex) { |
| 14921 | if (value !== value) { |
| 14922 | return indexOfNaN(array, fromIndex); |
| 14923 | } |
| 14924 | var index = fromIndex - 1, |
| 14925 | length = array.length; |
| 14926 | |
| 14927 | while (++index < length) { |
| 14928 | if (array[index] === value) { |
| 14929 | return index; |
| 14930 | } |
| 14931 | } |
| 14932 | return -1; |
| 14933 | } |
| 14934 | |
| 14935 | module.exports = baseIndexOf; |
| 14936 | |
| 14937 | },{"./indexOfNaN":115}],79:[function(require,module,exports){ |
| 14938 | var baseIsEqualDeep = require('./baseIsEqualDeep'), |
| 14939 | isObject = require('../lang/isObject'), |
| 14940 | isObjectLike = require('./isObjectLike'); |
| 14941 | |
| 14942 | /** |
| 14943 | * The base implementation of `_.isEqual` without support for `this` binding |
| 14944 | * `customizer` functions. |
| 14945 | * |
| 14946 | * @private |
| 14947 | * @param {*} value The value to compare. |
| 14948 | * @param {*} other The other value to compare. |
| 14949 | * @param {Function} [customizer] The function to customize comparing values. |
| 14950 | * @param {boolean} [isLoose] Specify performing partial comparisons. |
| 14951 | * @param {Array} [stackA] Tracks traversed `value` objects. |
| 14952 | * @param {Array} [stackB] Tracks traversed `other` objects. |
| 14953 | * @returns {boolean} Returns `true` if the values are equivalent, else `false`. |
| 14954 | */ |
| 14955 | function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) { |
| 14956 | if (value === other) { |
| 14957 | return true; |
| 14958 | } |
| 14959 | if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) { |
| 14960 | return value !== value && other !== other; |
| 14961 | } |
| 14962 | return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB); |
| 14963 | } |
| 14964 | |
| 14965 | module.exports = baseIsEqual; |
| 14966 | |
| 14967 | },{"../lang/isObject":144,"./baseIsEqualDeep":80,"./isObjectLike":126}],80:[function(require,module,exports){ |
| 14968 | var equalArrays = require('./equalArrays'), |
| 14969 | equalByTag = require('./equalByTag'), |
| 14970 | equalObjects = require('./equalObjects'), |
| 14971 | isArray = require('../lang/isArray'), |
| 14972 | isHostObject = require('./isHostObject'), |
| 14973 | isTypedArray = require('../lang/isTypedArray'); |
| 14974 | |
| 14975 | /** `Object#toString` result references. */ |
| 14976 | var argsTag = '[object Arguments]', |
| 14977 | arrayTag = '[object Array]', |
| 14978 | objectTag = '[object Object]'; |
| 14979 | |
| 14980 | /** Used for native method references. */ |
| 14981 | var objectProto = Object.prototype; |
| 14982 | |
| 14983 | /** Used to check objects for own properties. */ |
| 14984 | var hasOwnProperty = objectProto.hasOwnProperty; |
| 14985 | |
| 14986 | /** |
| 14987 | * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) |
| 14988 | * of values. |
| 14989 | */ |
| 14990 | var objToString = objectProto.toString; |
| 14991 | |
| 14992 | /** |
| 14993 | * A specialized version of `baseIsEqual` for arrays and objects which performs |
| 14994 | * deep comparisons and tracks traversed objects enabling objects with circular |
| 14995 | * references to be compared. |
| 14996 | * |
| 14997 | * @private |
| 14998 | * @param {Object} object The object to compare. |
| 14999 | * @param {Object} other The other object to compare. |
| 15000 | * @param {Function} equalFunc The function to determine equivalents of values. |
| 15001 | * @param {Function} [customizer] The function to customize comparing objects. |
| 15002 | * @param {boolean} [isLoose] Specify performing partial comparisons. |
| 15003 | * @param {Array} [stackA=[]] Tracks traversed `value` objects. |
| 15004 | * @param {Array} [stackB=[]] Tracks traversed `other` objects. |
| 15005 | * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. |
| 15006 | */ |
| 15007 | function baseIsEqualDeep(object, other, equalFunc, customizer, isLoose, stackA, stackB) { |
| 15008 | var objIsArr = isArray(object), |
| 15009 | othIsArr = isArray(other), |
| 15010 | objTag = arrayTag, |
| 15011 | othTag = arrayTag; |
| 15012 | |
| 15013 | if (!objIsArr) { |
| 15014 | objTag = objToString.call(object); |
| 15015 | if (objTag == argsTag) { |
| 15016 | objTag = objectTag; |
| 15017 | } else if (objTag != objectTag) { |
| 15018 | objIsArr = isTypedArray(object); |
| 15019 | } |
| 15020 | } |
| 15021 | if (!othIsArr) { |
| 15022 | othTag = objToString.call(other); |
| 15023 | if (othTag == argsTag) { |
| 15024 | othTag = objectTag; |
| 15025 | } else if (othTag != objectTag) { |
| 15026 | othIsArr = isTypedArray(other); |
| 15027 | } |
| 15028 | } |
| 15029 | var objIsObj = objTag == objectTag && !isHostObject(object), |
| 15030 | othIsObj = othTag == objectTag && !isHostObject(other), |
| 15031 | isSameTag = objTag == othTag; |
| 15032 | |
| 15033 | if (isSameTag && !(objIsArr || objIsObj)) { |
| 15034 | return equalByTag(object, other, objTag); |
| 15035 | } |
| 15036 | if (!isLoose) { |
| 15037 | var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), |
| 15038 | othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); |
| 15039 | |
| 15040 | if (objIsWrapped || othIsWrapped) { |
| 15041 | return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, isLoose, stackA, stackB); |
| 15042 | } |
| 15043 | } |
| 15044 | if (!isSameTag) { |
| 15045 | return false; |
| 15046 | } |
| 15047 | // Assume cyclic values are equal. |
| 15048 | // For more information on detecting circular references see https://es5.github.io/#JO. |
| 15049 | stackA || (stackA = []); |
| 15050 | stackB || (stackB = []); |
| 15051 | |
| 15052 | var length = stackA.length; |
| 15053 | while (length--) { |
| 15054 | if (stackA[length] == object) { |
| 15055 | return stackB[length] == other; |
| 15056 | } |
| 15057 | } |
| 15058 | // Add `object` and `other` to the stack of traversed objects. |
| 15059 | stackA.push(object); |
| 15060 | stackB.push(other); |
| 15061 | |
| 15062 | var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isLoose, stackA, stackB); |
| 15063 | |
| 15064 | stackA.pop(); |
| 15065 | stackB.pop(); |
| 15066 | |
| 15067 | return result; |
| 15068 | } |
| 15069 | |
| 15070 | module.exports = baseIsEqualDeep; |
| 15071 | |
| 15072 | },{"../lang/isArray":140,"../lang/isTypedArray":147,"./equalArrays":107,"./equalByTag":108,"./equalObjects":109,"./isHostObject":120}],81:[function(require,module,exports){ |
| 15073 | var baseIsEqual = require('./baseIsEqual'), |
| 15074 | toObject = require('./toObject'); |
| 15075 | |
| 15076 | /** |
| 15077 | * The base implementation of `_.isMatch` without support for callback |
| 15078 | * shorthands and `this` binding. |
| 15079 | * |
| 15080 | * @private |
| 15081 | * @param {Object} object The object to inspect. |
| 15082 | * @param {Array} matchData The propery names, values, and compare flags to match. |
| 15083 | * @param {Function} [customizer] The function to customize comparing objects. |
| 15084 | * @returns {boolean} Returns `true` if `object` is a match, else `false`. |
| 15085 | */ |
| 15086 | function baseIsMatch(object, matchData, customizer) { |
| 15087 | var index = matchData.length, |
| 15088 | length = index, |
| 15089 | noCustomizer = !customizer; |
| 15090 | |
| 15091 | if (object == null) { |
| 15092 | return !length; |
| 15093 | } |
| 15094 | object = toObject(object); |
| 15095 | while (index--) { |
| 15096 | var data = matchData[index]; |
| 15097 | if ((noCustomizer && data[2]) |
| 15098 | ? data[1] !== object[data[0]] |
| 15099 | : !(data[0] in object) |
| 15100 | ) { |
| 15101 | return false; |
| 15102 | } |
| 15103 | } |
| 15104 | while (++index < length) { |
| 15105 | data = matchData[index]; |
| 15106 | var key = data[0], |
| 15107 | objValue = object[key], |
| 15108 | srcValue = data[1]; |
| 15109 | |
| 15110 | if (noCustomizer && data[2]) { |
| 15111 | if (objValue === undefined && !(key in object)) { |
| 15112 | return false; |
| 15113 | } |
| 15114 | } else { |
| 15115 | var result = customizer ? customizer(objValue, srcValue, key) : undefined; |
| 15116 | if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, true) : result)) { |
| 15117 | return false; |
| 15118 | } |
| 15119 | } |
| 15120 | } |
| 15121 | return true; |
| 15122 | } |
| 15123 | |
| 15124 | module.exports = baseIsMatch; |
| 15125 | |
| 15126 | },{"./baseIsEqual":79,"./toObject":135}],82:[function(require,module,exports){ |
| 15127 | /** |
| 15128 | * The function whose prototype all chaining wrappers inherit from. |
| 15129 | * |
| 15130 | * @private |
| 15131 | */ |
| 15132 | function baseLodash() { |
| 15133 | // No operation performed. |
| 15134 | } |
| 15135 | |
| 15136 | module.exports = baseLodash; |
| 15137 | |
| 15138 | },{}],83:[function(require,module,exports){ |
| 15139 | var baseEach = require('./baseEach'), |
| 15140 | isArrayLike = require('./isArrayLike'); |
| 15141 | |
| 15142 | /** |
| 15143 | * The base implementation of `_.map` without support for callback shorthands |
| 15144 | * and `this` binding. |
| 15145 | * |
| 15146 | * @private |
| 15147 | * @param {Array|Object|string} collection The collection to iterate over. |
| 15148 | * @param {Function} iteratee The function invoked per iteration. |
| 15149 | * @returns {Array} Returns the new mapped array. |
| 15150 | */ |
| 15151 | function baseMap(collection, iteratee) { |
| 15152 | var index = -1, |
| 15153 | result = isArrayLike(collection) ? Array(collection.length) : []; |
| 15154 | |
| 15155 | baseEach(collection, function(value, key, collection) { |
| 15156 | result[++index] = iteratee(value, key, collection); |
| 15157 | }); |
| 15158 | return result; |
| 15159 | } |
| 15160 | |
| 15161 | module.exports = baseMap; |
| 15162 | |
| 15163 | },{"./baseEach":71,"./isArrayLike":119}],84:[function(require,module,exports){ |
| 15164 | var baseIsMatch = require('./baseIsMatch'), |
| 15165 | getMatchData = require('./getMatchData'), |
| 15166 | toObject = require('./toObject'); |
| 15167 | |
| 15168 | /** |
| 15169 | * The base implementation of `_.matches` which does not clone `source`. |
| 15170 | * |
| 15171 | * @private |
| 15172 | * @param {Object} source The object of property values to match. |
| 15173 | * @returns {Function} Returns the new function. |
| 15174 | */ |
| 15175 | function baseMatches(source) { |
| 15176 | var matchData = getMatchData(source); |
| 15177 | if (matchData.length == 1 && matchData[0][2]) { |
| 15178 | var key = matchData[0][0], |
| 15179 | value = matchData[0][1]; |
| 15180 | |
| 15181 | return function(object) { |
| 15182 | if (object == null) { |
| 15183 | return false; |
| 15184 | } |
| 15185 | object = toObject(object); |
| 15186 | return object[key] === value && (value !== undefined || (key in object)); |
| 15187 | }; |
| 15188 | } |
| 15189 | return function(object) { |
| 15190 | return baseIsMatch(object, matchData); |
| 15191 | }; |
| 15192 | } |
| 15193 | |
| 15194 | module.exports = baseMatches; |
| 15195 | |
| 15196 | },{"./baseIsMatch":81,"./getMatchData":113,"./toObject":135}],85:[function(require,module,exports){ |
| 15197 | var baseGet = require('./baseGet'), |
| 15198 | baseIsEqual = require('./baseIsEqual'), |
| 15199 | baseSlice = require('./baseSlice'), |
| 15200 | isArray = require('../lang/isArray'), |
| 15201 | isKey = require('./isKey'), |
| 15202 | isStrictComparable = require('./isStrictComparable'), |
| 15203 | last = require('../array/last'), |
| 15204 | toObject = require('./toObject'), |
| 15205 | toPath = require('./toPath'); |
| 15206 | |
| 15207 | /** |
| 15208 | * The base implementation of `_.matchesProperty` which does not clone `srcValue`. |
| 15209 | * |
| 15210 | * @private |
| 15211 | * @param {string} path The path of the property to get. |
| 15212 | * @param {*} srcValue The value to compare. |
| 15213 | * @returns {Function} Returns the new function. |
| 15214 | */ |
| 15215 | function baseMatchesProperty(path, srcValue) { |
| 15216 | var isArr = isArray(path), |
| 15217 | isCommon = isKey(path) && isStrictComparable(srcValue), |
| 15218 | pathKey = (path + ''); |
| 15219 | |
| 15220 | path = toPath(path); |
| 15221 | return function(object) { |
| 15222 | if (object == null) { |
| 15223 | return false; |
| 15224 | } |
| 15225 | var key = pathKey; |
| 15226 | object = toObject(object); |
| 15227 | if ((isArr || !isCommon) && !(key in object)) { |
| 15228 | object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1)); |
| 15229 | if (object == null) { |
| 15230 | return false; |
| 15231 | } |
| 15232 | key = last(path); |
| 15233 | object = toObject(object); |
| 15234 | } |
| 15235 | return object[key] === srcValue |
| 15236 | ? (srcValue !== undefined || (key in object)) |
| 15237 | : baseIsEqual(srcValue, object[key], undefined, true); |
| 15238 | }; |
| 15239 | } |
| 15240 | |
| 15241 | module.exports = baseMatchesProperty; |
| 15242 | |
| 15243 | },{"../array/last":50,"../lang/isArray":140,"./baseGet":77,"./baseIsEqual":79,"./baseSlice":89,"./isKey":123,"./isStrictComparable":127,"./toObject":135,"./toPath":136}],86:[function(require,module,exports){ |
| 15244 | var toObject = require('./toObject'); |
| 15245 | |
| 15246 | /** |
| 15247 | * The base implementation of `_.property` without support for deep paths. |
| 15248 | * |
| 15249 | * @private |
| 15250 | * @param {string} key The key of the property to get. |
| 15251 | * @returns {Function} Returns the new function. |
| 15252 | */ |
| 15253 | function baseProperty(key) { |
| 15254 | return function(object) { |
| 15255 | return object == null ? undefined : toObject(object)[key]; |
| 15256 | }; |
| 15257 | } |
| 15258 | |
| 15259 | module.exports = baseProperty; |
| 15260 | |
| 15261 | },{"./toObject":135}],87:[function(require,module,exports){ |
| 15262 | var baseGet = require('./baseGet'), |
| 15263 | toPath = require('./toPath'); |
| 15264 | |
| 15265 | /** |
| 15266 | * A specialized version of `baseProperty` which supports deep paths. |
| 15267 | * |
| 15268 | * @private |
| 15269 | * @param {Array|string} path The path of the property to get. |
| 15270 | * @returns {Function} Returns the new function. |
| 15271 | */ |
| 15272 | function basePropertyDeep(path) { |
| 15273 | var pathKey = (path + ''); |
| 15274 | path = toPath(path); |
| 15275 | return function(object) { |
| 15276 | return baseGet(object, path, pathKey); |
| 15277 | }; |
| 15278 | } |
| 15279 | |
| 15280 | module.exports = basePropertyDeep; |
| 15281 | |
| 15282 | },{"./baseGet":77,"./toPath":136}],88:[function(require,module,exports){ |
| 15283 | var identity = require('../utility/identity'), |
| 15284 | metaMap = require('./metaMap'); |
| 15285 | |
| 15286 | /** |
| 15287 | * The base implementation of `setData` without support for hot loop detection. |
| 15288 | * |
| 15289 | * @private |
| 15290 | * @param {Function} func The function to associate metadata with. |
| 15291 | * @param {*} data The metadata. |
| 15292 | * @returns {Function} Returns `func`. |
| 15293 | */ |
| 15294 | var baseSetData = !metaMap ? identity : function(func, data) { |
| 15295 | metaMap.set(func, data); |
| 15296 | return func; |
| 15297 | }; |
| 15298 | |
| 15299 | module.exports = baseSetData; |
| 15300 | |
| 15301 | },{"../utility/identity":154,"./metaMap":129}],89:[function(require,module,exports){ |
| 15302 | /** |
| 15303 | * The base implementation of `_.slice` without an iteratee call guard. |
| 15304 | * |
| 15305 | * @private |
| 15306 | * @param {Array} array The array to slice. |
| 15307 | * @param {number} [start=0] The start position. |
| 15308 | * @param {number} [end=array.length] The end position. |
| 15309 | * @returns {Array} Returns the slice of `array`. |
| 15310 | */ |
| 15311 | function baseSlice(array, start, end) { |
| 15312 | var index = -1, |
| 15313 | length = array.length; |
| 15314 | |
| 15315 | start = start == null ? 0 : (+start || 0); |
| 15316 | if (start < 0) { |
| 15317 | start = -start > length ? 0 : (length + start); |
| 15318 | } |
| 15319 | end = (end === undefined || end > length) ? length : (+end || 0); |
| 15320 | if (end < 0) { |
| 15321 | end += length; |
| 15322 | } |
| 15323 | length = start > end ? 0 : ((end - start) >>> 0); |
| 15324 | start >>>= 0; |
| 15325 | |
| 15326 | var result = Array(length); |
| 15327 | while (++index < length) { |
| 15328 | result[index] = array[index + start]; |
| 15329 | } |
| 15330 | return result; |
| 15331 | } |
| 15332 | |
| 15333 | module.exports = baseSlice; |
| 15334 | |
| 15335 | },{}],90:[function(require,module,exports){ |
| 15336 | /** |
| 15337 | * Converts `value` to a string if it's not one. An empty string is returned |
| 15338 | * for `null` or `undefined` values. |
| 15339 | * |
| 15340 | * @private |
| 15341 | * @param {*} value The value to process. |
| 15342 | * @returns {string} Returns the string. |
| 15343 | */ |
| 15344 | function baseToString(value) { |
| 15345 | return value == null ? '' : (value + ''); |
| 15346 | } |
| 15347 | |
| 15348 | module.exports = baseToString; |
| 15349 | |
| 15350 | },{}],91:[function(require,module,exports){ |
| 15351 | /** |
| 15352 | * The base implementation of `_.values` and `_.valuesIn` which creates an |
| 15353 | * array of `object` property values corresponding to the property names |
| 15354 | * of `props`. |
| 15355 | * |
| 15356 | * @private |
| 15357 | * @param {Object} object The object to query. |
| 15358 | * @param {Array} props The property names to get values for. |
| 15359 | * @returns {Object} Returns the array of property values. |
| 15360 | */ |
| 15361 | function baseValues(object, props) { |
| 15362 | var index = -1, |
| 15363 | length = props.length, |
| 15364 | result = Array(length); |
| 15365 | |
| 15366 | while (++index < length) { |
| 15367 | result[index] = object[props[index]]; |
| 15368 | } |
| 15369 | return result; |
| 15370 | } |
| 15371 | |
| 15372 | module.exports = baseValues; |
| 15373 | |
| 15374 | },{}],92:[function(require,module,exports){ |
| 15375 | var binaryIndexBy = require('./binaryIndexBy'), |
| 15376 | identity = require('../utility/identity'); |
| 15377 | |
| 15378 | /** Used as references for the maximum length and index of an array. */ |
| 15379 | var MAX_ARRAY_LENGTH = 4294967295, |
| 15380 | HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; |
| 15381 | |
| 15382 | /** |
| 15383 | * Performs a binary search of `array` to determine the index at which `value` |
| 15384 | * should be inserted into `array` in order to maintain its sort order. |
| 15385 | * |
| 15386 | * @private |
| 15387 | * @param {Array} array The sorted array to inspect. |
| 15388 | * @param {*} value The value to evaluate. |
| 15389 | * @param {boolean} [retHighest] Specify returning the highest qualified index. |
| 15390 | * @returns {number} Returns the index at which `value` should be inserted |
| 15391 | * into `array`. |
| 15392 | */ |
| 15393 | function binaryIndex(array, value, retHighest) { |
| 15394 | var low = 0, |
| 15395 | high = array ? array.length : low; |
| 15396 | |
| 15397 | if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { |
| 15398 | while (low < high) { |
| 15399 | var mid = (low + high) >>> 1, |
| 15400 | computed = array[mid]; |
| 15401 | |
| 15402 | if ((retHighest ? (computed <= value) : (computed < value)) && computed !== null) { |
| 15403 | low = mid + 1; |
| 15404 | } else { |
| 15405 | high = mid; |
| 15406 | } |
| 15407 | } |
| 15408 | return high; |
| 15409 | } |
| 15410 | return binaryIndexBy(array, value, identity, retHighest); |
| 15411 | } |
| 15412 | |
| 15413 | module.exports = binaryIndex; |
| 15414 | |
| 15415 | },{"../utility/identity":154,"./binaryIndexBy":93}],93:[function(require,module,exports){ |
| 15416 | /* Native method references for those with the same name as other `lodash` methods. */ |
| 15417 | var nativeFloor = Math.floor, |
| 15418 | nativeMin = Math.min; |
| 15419 | |
| 15420 | /** Used as references for the maximum length and index of an array. */ |
| 15421 | var MAX_ARRAY_LENGTH = 4294967295, |
| 15422 | MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1; |
| 15423 | |
| 15424 | /** |
| 15425 | * This function is like `binaryIndex` except that it invokes `iteratee` for |
| 15426 | * `value` and each element of `array` to compute their sort ranking. The |
| 15427 | * iteratee is invoked with one argument; (value). |
| 15428 | * |
| 15429 | * @private |
| 15430 | * @param {Array} array The sorted array to inspect. |
| 15431 | * @param {*} value The value to evaluate. |
| 15432 | * @param {Function} iteratee The function invoked per iteration. |
| 15433 | * @param {boolean} [retHighest] Specify returning the highest qualified index. |
| 15434 | * @returns {number} Returns the index at which `value` should be inserted |
| 15435 | * into `array`. |
| 15436 | */ |
| 15437 | function binaryIndexBy(array, value, iteratee, retHighest) { |
| 15438 | value = iteratee(value); |
| 15439 | |
| 15440 | var low = 0, |
| 15441 | high = array ? array.length : 0, |
| 15442 | valIsNaN = value !== value, |
| 15443 | valIsNull = value === null, |
| 15444 | valIsUndef = value === undefined; |
| 15445 | |
| 15446 | while (low < high) { |
| 15447 | var mid = nativeFloor((low + high) / 2), |
| 15448 | computed = iteratee(array[mid]), |
| 15449 | isDef = computed !== undefined, |
| 15450 | isReflexive = computed === computed; |
| 15451 | |
| 15452 | if (valIsNaN) { |
| 15453 | var setLow = isReflexive || retHighest; |
| 15454 | } else if (valIsNull) { |
| 15455 | setLow = isReflexive && isDef && (retHighest || computed != null); |
| 15456 | } else if (valIsUndef) { |
| 15457 | setLow = isReflexive && (retHighest || isDef); |
| 15458 | } else if (computed == null) { |
| 15459 | setLow = false; |
| 15460 | } else { |
| 15461 | setLow = retHighest ? (computed <= value) : (computed < value); |
| 15462 | } |
| 15463 | if (setLow) { |
| 15464 | low = mid + 1; |
| 15465 | } else { |
| 15466 | high = mid; |
| 15467 | } |
| 15468 | } |
| 15469 | return nativeMin(high, MAX_ARRAY_INDEX); |
| 15470 | } |
| 15471 | |
| 15472 | module.exports = binaryIndexBy; |
| 15473 | |
| 15474 | },{}],94:[function(require,module,exports){ |
| 15475 | var identity = require('../utility/identity'); |
| 15476 | |
| 15477 | /** |
| 15478 | * A specialized version of `baseCallback` which only supports `this` binding |
| 15479 | * and specifying the number of arguments to provide to `func`. |
| 15480 | * |
| 15481 | * @private |
| 15482 | * @param {Function} func The function to bind. |
| 15483 | * @param {*} thisArg The `this` binding of `func`. |
| 15484 | * @param {number} [argCount] The number of arguments to provide to `func`. |
| 15485 | * @returns {Function} Returns the callback. |
| 15486 | */ |
| 15487 | function bindCallback(func, thisArg, argCount) { |
| 15488 | if (typeof func != 'function') { |
| 15489 | return identity; |
| 15490 | } |
| 15491 | if (thisArg === undefined) { |
| 15492 | return func; |
| 15493 | } |
| 15494 | switch (argCount) { |
| 15495 | case 1: return function(value) { |
| 15496 | return func.call(thisArg, value); |
| 15497 | }; |
| 15498 | case 3: return function(value, index, collection) { |
| 15499 | return func.call(thisArg, value, index, collection); |
| 15500 | }; |
| 15501 | case 4: return function(accumulator, value, index, collection) { |
| 15502 | return func.call(thisArg, accumulator, value, index, collection); |
| 15503 | }; |
| 15504 | case 5: return function(value, other, key, object, source) { |
| 15505 | return func.call(thisArg, value, other, key, object, source); |
| 15506 | }; |
| 15507 | } |
| 15508 | return function() { |
| 15509 | return func.apply(thisArg, arguments); |
| 15510 | }; |
| 15511 | } |
| 15512 | |
| 15513 | module.exports = bindCallback; |
| 15514 | |
| 15515 | },{"../utility/identity":154}],95:[function(require,module,exports){ |
| 15516 | (function (global){ |
| 15517 | /** Native method references. */ |
| 15518 | var ArrayBuffer = global.ArrayBuffer, |
| 15519 | Uint8Array = global.Uint8Array; |
| 15520 | |
| 15521 | /** |
| 15522 | * Creates a clone of the given array buffer. |
| 15523 | * |
| 15524 | * @private |
| 15525 | * @param {ArrayBuffer} buffer The array buffer to clone. |
| 15526 | * @returns {ArrayBuffer} Returns the cloned array buffer. |
| 15527 | */ |
| 15528 | function bufferClone(buffer) { |
| 15529 | var result = new ArrayBuffer(buffer.byteLength), |
| 15530 | view = new Uint8Array(result); |
| 15531 | |
| 15532 | view.set(new Uint8Array(buffer)); |
| 15533 | return result; |
| 15534 | } |
| 15535 | |
| 15536 | module.exports = bufferClone; |
| 15537 | |
| 15538 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) |
| 15539 | //# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9sb2Rhc2gtY29tcGF0L2ludGVybmFsL2J1ZmZlckNsb25lLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJmaWxlIjoiZ2VuZXJhdGVkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXNDb250ZW50IjpbIi8qKiBOYXRpdmUgbWV0aG9kIHJlZmVyZW5jZXMuICovXG52YXIgQXJyYXlCdWZmZXIgPSBnbG9iYWwuQXJyYXlCdWZmZXIsXG4gICAgVWludDhBcnJheSA9IGdsb2JhbC5VaW50OEFycmF5O1xuXG4vKipcbiAqIENyZWF0ZXMgYSBjbG9uZSBvZiB0aGUgZ2l2ZW4gYXJyYXkgYnVmZmVyLlxuICpcbiAqIEBwcml2YXRlXG4gKiBAcGFyYW0ge0FycmF5QnVmZmVyfSBidWZmZXIgVGhlIGFycmF5IGJ1ZmZlciB0byBjbG9uZS5cbiAqIEByZXR1cm5zIHtBcnJheUJ1ZmZlcn0gUmV0dXJucyB0aGUgY2xvbmVkIGFycmF5IGJ1ZmZlci5cbiAqL1xuZnVuY3Rpb24gYnVmZmVyQ2xvbmUoYnVmZmVyKSB7XG4gIHZhciByZXN1bHQgPSBuZXcgQXJyYXlCdWZmZXIoYnVmZmVyLmJ5dGVMZW5ndGgpLFxuICAgICAgdmlldyA9IG5ldyBVaW50OEFycmF5KHJlc3VsdCk7XG5cbiAgdmlldy5zZXQobmV3IFVpbnQ4QXJyYXkoYnVmZmVyKSk7XG4gIHJldHVybiByZXN1bHQ7XG59XG5cbm1vZHVsZS5leHBvcnRzID0gYnVmZmVyQ2xvbmU7XG4iXX0= |
| 15540 | },{}],96:[function(require,module,exports){ |
| 15541 | /* Native method references for those with the same name as other `lodash` methods. */ |
| 15542 | var nativeMax = Math.max; |
| 15543 | |
| 15544 | /** |
| 15545 | * Creates an array that is the composition of partially applied arguments, |
| 15546 | * placeholders, and provided arguments into a single array of arguments. |
| 15547 | * |
| 15548 | * @private |
| 15549 | * @param {Array|Object} args The provided arguments. |
| 15550 | * @param {Array} partials The arguments to prepend to those provided. |
| 15551 | * @param {Array} holders The `partials` placeholder indexes. |
| 15552 | * @returns {Array} Returns the new array of composed arguments. |
| 15553 | */ |
| 15554 | function composeArgs(args, partials, holders) { |
| 15555 | var holdersLength = holders.length, |
| 15556 | argsIndex = -1, |
| 15557 | argsLength = nativeMax(args.length - holdersLength, 0), |
| 15558 | leftIndex = -1, |
| 15559 | leftLength = partials.length, |
| 15560 | result = Array(leftLength + argsLength); |
| 15561 | |
| 15562 | while (++leftIndex < leftLength) { |
| 15563 | result[leftIndex] = partials[leftIndex]; |
| 15564 | } |
| 15565 | while (++argsIndex < holdersLength) { |
| 15566 | result[holders[argsIndex]] = args[argsIndex]; |
| 15567 | } |
| 15568 | while (argsLength--) { |
| 15569 | result[leftIndex++] = args[argsIndex++]; |
| 15570 | } |
| 15571 | return result; |
| 15572 | } |
| 15573 | |
| 15574 | module.exports = composeArgs; |
| 15575 | |
| 15576 | },{}],97:[function(require,module,exports){ |
| 15577 | /* Native method references for those with the same name as other `lodash` methods. */ |
| 15578 | var nativeMax = Math.max; |
| 15579 | |
| 15580 | /** |
| 15581 | * This function is like `composeArgs` except that the arguments composition |
| 15582 | * is tailored for `_.partialRight`. |
| 15583 | * |
| 15584 | * @private |
| 15585 | * @param {Array|Object} args The provided arguments. |
| 15586 | * @param {Array} partials The arguments to append to those provided. |
| 15587 | * @param {Array} holders The `partials` placeholder indexes. |
| 15588 | * @returns {Array} Returns the new array of composed arguments. |
| 15589 | */ |
| 15590 | function composeArgsRight(args, partials, holders) { |
| 15591 | var holdersIndex = -1, |
| 15592 | holdersLength = holders.length, |
| 15593 | argsIndex = -1, |
| 15594 | argsLength = nativeMax(args.length - holdersLength, 0), |
| 15595 | rightIndex = -1, |
| 15596 | rightLength = partials.length, |
| 15597 | result = Array(argsLength + rightLength); |
| 15598 | |
| 15599 | while (++argsIndex < argsLength) { |
| 15600 | result[argsIndex] = args[argsIndex]; |
| 15601 | } |
| 15602 | var offset = argsIndex; |
| 15603 | while (++rightIndex < rightLength) { |
| 15604 | result[offset + rightIndex] = partials[rightIndex]; |
| 15605 | } |
| 15606 | while (++holdersIndex < holdersLength) { |
| 15607 | result[offset + holders[holdersIndex]] = args[argsIndex++]; |
| 15608 | } |
| 15609 | return result; |
| 15610 | } |
| 15611 | |
| 15612 | module.exports = composeArgsRight; |
| 15613 | |
| 15614 | },{}],98:[function(require,module,exports){ |
| 15615 | var getLength = require('./getLength'), |
| 15616 | isLength = require('./isLength'), |
| 15617 | toObject = require('./toObject'); |
| 15618 | |
| 15619 | /** |
| 15620 | * Creates a `baseEach` or `baseEachRight` function. |
| 15621 | * |
| 15622 | * @private |
| 15623 | * @param {Function} eachFunc The function to iterate over a collection. |
| 15624 | * @param {boolean} [fromRight] Specify iterating from right to left. |
| 15625 | * @returns {Function} Returns the new base function. |
| 15626 | */ |
| 15627 | function createBaseEach(eachFunc, fromRight) { |
| 15628 | return function(collection, iteratee) { |
| 15629 | var length = collection ? getLength(collection) : 0; |
| 15630 | if (!isLength(length)) { |
| 15631 | return eachFunc(collection, iteratee); |
| 15632 | } |
| 15633 | var index = fromRight ? length : -1, |
| 15634 | iterable = toObject(collection); |
| 15635 | |
| 15636 | while ((fromRight ? index-- : ++index < length)) { |
| 15637 | if (iteratee(iterable[index], index, iterable) === false) { |
| 15638 | break; |
| 15639 | } |
| 15640 | } |
| 15641 | return collection; |
| 15642 | }; |
| 15643 | } |
| 15644 | |
| 15645 | module.exports = createBaseEach; |
| 15646 | |
| 15647 | },{"./getLength":112,"./isLength":125,"./toObject":135}],99:[function(require,module,exports){ |
| 15648 | var toObject = require('./toObject'); |
| 15649 | |
| 15650 | /** |
| 15651 | * Creates a base function for `_.forIn` or `_.forInRight`. |
| 15652 | * |
| 15653 | * @private |
| 15654 | * @param {boolean} [fromRight] Specify iterating from right to left. |
| 15655 | * @returns {Function} Returns the new base function. |
| 15656 | */ |
| 15657 | function createBaseFor(fromRight) { |
| 15658 | return function(object, iteratee, keysFunc) { |
| 15659 | var iterable = toObject(object), |
| 15660 | props = keysFunc(object), |
| 15661 | length = props.length, |
| 15662 | index = fromRight ? length : -1; |
| 15663 | |
| 15664 | while ((fromRight ? index-- : ++index < length)) { |
| 15665 | var key = props[index]; |
| 15666 | if (iteratee(iterable[key], key, iterable) === false) { |
| 15667 | break; |
| 15668 | } |
| 15669 | } |
| 15670 | return object; |
| 15671 | }; |
| 15672 | } |
| 15673 | |
| 15674 | module.exports = createBaseFor; |
| 15675 | |
| 15676 | },{"./toObject":135}],100:[function(require,module,exports){ |
| 15677 | (function (global){ |
| 15678 | var createCtorWrapper = require('./createCtorWrapper'); |
| 15679 | |
| 15680 | /** |
| 15681 | * Creates a function that wraps `func` and invokes it with the `this` |
| 15682 | * binding of `thisArg`. |
| 15683 | * |
| 15684 | * @private |
| 15685 | * @param {Function} func The function to bind. |
| 15686 | * @param {*} [thisArg] The `this` binding of `func`. |
| 15687 | * @returns {Function} Returns the new bound function. |
| 15688 | */ |
| 15689 | function createBindWrapper(func, thisArg) { |
| 15690 | var Ctor = createCtorWrapper(func); |
| 15691 | |
| 15692 | function wrapper() { |
| 15693 | var fn = (this && this !== global && this instanceof wrapper) ? Ctor : func; |
| 15694 | return fn.apply(thisArg, arguments); |
| 15695 | } |
| 15696 | return wrapper; |
| 15697 | } |
| 15698 | |
| 15699 | module.exports = createBindWrapper; |
| 15700 | |
| 15701 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) |
| 15702 | //# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9sb2Rhc2gtY29tcGF0L2ludGVybmFsL2NyZWF0ZUJpbmRXcmFwcGVyLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwiZmlsZSI6ImdlbmVyYXRlZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgY3JlYXRlQ3RvcldyYXBwZXIgPSByZXF1aXJlKCcuL2NyZWF0ZUN0b3JXcmFwcGVyJyk7XG5cbi8qKlxuICogQ3JlYXRlcyBhIGZ1bmN0aW9uIHRoYXQgd3JhcHMgYGZ1bmNgIGFuZCBpbnZva2VzIGl0IHdpdGggdGhlIGB0aGlzYFxuICogYmluZGluZyBvZiBgdGhpc0FyZ2AuXG4gKlxuICogQHByaXZhdGVcbiAqIEBwYXJhbSB7RnVuY3Rpb259IGZ1bmMgVGhlIGZ1bmN0aW9uIHRvIGJpbmQuXG4gKiBAcGFyYW0geyp9IFt0aGlzQXJnXSBUaGUgYHRoaXNgIGJpbmRpbmcgb2YgYGZ1bmNgLlxuICogQHJldHVybnMge0Z1bmN0aW9ufSBSZXR1cm5zIHRoZSBuZXcgYm91bmQgZnVuY3Rpb24uXG4gKi9cbmZ1bmN0aW9uIGNyZWF0ZUJpbmRXcmFwcGVyKGZ1bmMsIHRoaXNBcmcpIHtcbiAgdmFyIEN0b3IgPSBjcmVhdGVDdG9yV3JhcHBlcihmdW5jKTtcblxuICBmdW5jdGlvbiB3cmFwcGVyKCkge1xuICAgIHZhciBmbiA9ICh0aGlzICYmIHRoaXMgIT09IGdsb2JhbCAmJiB0aGlzIGluc3RhbmNlb2Ygd3JhcHBlcikgPyBDdG9yIDogZnVuYztcbiAgICByZXR1cm4gZm4uYXBwbHkodGhpc0FyZywgYXJndW1lbnRzKTtcbiAgfVxuICByZXR1cm4gd3JhcHBlcjtcbn1cblxubW9kdWxlLmV4cG9ydHMgPSBjcmVhdGVCaW5kV3JhcHBlcjtcbiJdfQ== |
| 15703 | },{"./createCtorWrapper":101}],101:[function(require,module,exports){ |
| 15704 | var baseCreate = require('./baseCreate'), |
| 15705 | isObject = require('../lang/isObject'); |
| 15706 | |
| 15707 | /** |
| 15708 | * Creates a function that produces an instance of `Ctor` regardless of |
| 15709 | * whether it was invoked as part of a `new` expression or by `call` or `apply`. |
| 15710 | * |
| 15711 | * @private |
| 15712 | * @param {Function} Ctor The constructor to wrap. |
| 15713 | * @returns {Function} Returns the new wrapped function. |
| 15714 | */ |
| 15715 | function createCtorWrapper(Ctor) { |
| 15716 | return function() { |
| 15717 | // Use a `switch` statement to work with class constructors. |
| 15718 | // See http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist |
| 15719 | // for more details. |
| 15720 | var args = arguments; |
| 15721 | switch (args.length) { |
| 15722 | case 0: return new Ctor; |
| 15723 | case 1: return new Ctor(args[0]); |
| 15724 | case 2: return new Ctor(args[0], args[1]); |
| 15725 | case 3: return new Ctor(args[0], args[1], args[2]); |
| 15726 | case 4: return new Ctor(args[0], args[1], args[2], args[3]); |
| 15727 | case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); |
| 15728 | case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); |
| 15729 | case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); |
| 15730 | } |
| 15731 | var thisBinding = baseCreate(Ctor.prototype), |
| 15732 | result = Ctor.apply(thisBinding, args); |
| 15733 | |
| 15734 | // Mimic the constructor's `return` behavior. |
| 15735 | // See https://es5.github.io/#x13.2.2 for more details. |
| 15736 | return isObject(result) ? result : thisBinding; |
| 15737 | }; |
| 15738 | } |
| 15739 | |
| 15740 | module.exports = createCtorWrapper; |
| 15741 | |
| 15742 | },{"../lang/isObject":144,"./baseCreate":70}],102:[function(require,module,exports){ |
| 15743 | var baseCallback = require('./baseCallback'), |
| 15744 | baseFind = require('./baseFind'), |
| 15745 | baseFindIndex = require('./baseFindIndex'), |
| 15746 | isArray = require('../lang/isArray'); |
| 15747 | |
| 15748 | /** |
| 15749 | * Creates a `_.find` or `_.findLast` function. |
| 15750 | * |
| 15751 | * @private |
| 15752 | * @param {Function} eachFunc The function to iterate over a collection. |
| 15753 | * @param {boolean} [fromRight] Specify iterating from right to left. |
| 15754 | * @returns {Function} Returns the new find function. |
| 15755 | */ |
| 15756 | function createFind(eachFunc, fromRight) { |
| 15757 | return function(collection, predicate, thisArg) { |
| 15758 | predicate = baseCallback(predicate, thisArg, 3); |
| 15759 | if (isArray(collection)) { |
| 15760 | var index = baseFindIndex(collection, predicate, fromRight); |
| 15761 | return index > -1 ? collection[index] : undefined; |
| 15762 | } |
| 15763 | return baseFind(collection, predicate, eachFunc); |
| 15764 | }; |
| 15765 | } |
| 15766 | |
| 15767 | module.exports = createFind; |
| 15768 | |
| 15769 | },{"../lang/isArray":140,"./baseCallback":67,"./baseFind":72,"./baseFindIndex":73}],103:[function(require,module,exports){ |
| 15770 | var bindCallback = require('./bindCallback'), |
| 15771 | isArray = require('../lang/isArray'); |
| 15772 | |
| 15773 | /** |
| 15774 | * Creates a function for `_.forEach` or `_.forEachRight`. |
| 15775 | * |
| 15776 | * @private |
| 15777 | * @param {Function} arrayFunc The function to iterate over an array. |
| 15778 | * @param {Function} eachFunc The function to iterate over a collection. |
| 15779 | * @returns {Function} Returns the new each function. |
| 15780 | */ |
| 15781 | function createForEach(arrayFunc, eachFunc) { |
| 15782 | return function(collection, iteratee, thisArg) { |
| 15783 | return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection)) |
| 15784 | ? arrayFunc(collection, iteratee) |
| 15785 | : eachFunc(collection, bindCallback(iteratee, thisArg, 3)); |
| 15786 | }; |
| 15787 | } |
| 15788 | |
| 15789 | module.exports = createForEach; |
| 15790 | |
| 15791 | },{"../lang/isArray":140,"./bindCallback":94}],104:[function(require,module,exports){ |
| 15792 | (function (global){ |
| 15793 | var arrayCopy = require('./arrayCopy'), |
| 15794 | composeArgs = require('./composeArgs'), |
| 15795 | composeArgsRight = require('./composeArgsRight'), |
| 15796 | createCtorWrapper = require('./createCtorWrapper'), |
| 15797 | isLaziable = require('./isLaziable'), |
| 15798 | reorder = require('./reorder'), |
| 15799 | replaceHolders = require('./replaceHolders'), |
| 15800 | setData = require('./setData'); |
| 15801 | |
| 15802 | /** Used to compose bitmasks for wrapper metadata. */ |
| 15803 | var BIND_FLAG = 1, |
| 15804 | BIND_KEY_FLAG = 2, |
| 15805 | CURRY_BOUND_FLAG = 4, |
| 15806 | CURRY_FLAG = 8, |
| 15807 | CURRY_RIGHT_FLAG = 16, |
| 15808 | PARTIAL_FLAG = 32, |
| 15809 | PARTIAL_RIGHT_FLAG = 64, |
| 15810 | ARY_FLAG = 128; |
| 15811 | |
| 15812 | /* Native method references for those with the same name as other `lodash` methods. */ |
| 15813 | var nativeMax = Math.max; |
| 15814 | |
| 15815 | /** |
| 15816 | * Creates a function that wraps `func` and invokes it with optional `this` |
| 15817 | * binding of, partial application, and currying. |
| 15818 | * |
| 15819 | * @private |
| 15820 | * @param {Function|string} func The function or method name to reference. |
| 15821 | * @param {number} bitmask The bitmask of flags. See `createWrapper` for more details. |
| 15822 | * @param {*} [thisArg] The `this` binding of `func`. |
| 15823 | * @param {Array} [partials] The arguments to prepend to those provided to the new function. |
| 15824 | * @param {Array} [holders] The `partials` placeholder indexes. |
| 15825 | * @param {Array} [partialsRight] The arguments to append to those provided to the new function. |
| 15826 | * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. |
| 15827 | * @param {Array} [argPos] The argument positions of the new function. |
| 15828 | * @param {number} [ary] The arity cap of `func`. |
| 15829 | * @param {number} [arity] The arity of `func`. |
| 15830 | * @returns {Function} Returns the new wrapped function. |
| 15831 | */ |
| 15832 | function createHybridWrapper(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { |
| 15833 | var isAry = bitmask & ARY_FLAG, |
| 15834 | isBind = bitmask & BIND_FLAG, |
| 15835 | isBindKey = bitmask & BIND_KEY_FLAG, |
| 15836 | isCurry = bitmask & CURRY_FLAG, |
| 15837 | isCurryBound = bitmask & CURRY_BOUND_FLAG, |
| 15838 | isCurryRight = bitmask & CURRY_RIGHT_FLAG, |
| 15839 | Ctor = isBindKey ? undefined : createCtorWrapper(func); |
| 15840 | |
| 15841 | function wrapper() { |
| 15842 | // Avoid `arguments` object use disqualifying optimizations by |
| 15843 | // converting it to an array before providing it to other functions. |
| 15844 | var length = arguments.length, |
| 15845 | index = length, |
| 15846 | args = Array(length); |
| 15847 | |
| 15848 | while (index--) { |
| 15849 | args[index] = arguments[index]; |
| 15850 | } |
| 15851 | if (partials) { |
| 15852 | args = composeArgs(args, partials, holders); |
| 15853 | } |
| 15854 | if (partialsRight) { |
| 15855 | args = composeArgsRight(args, partialsRight, holdersRight); |
| 15856 | } |
| 15857 | if (isCurry || isCurryRight) { |
| 15858 | var placeholder = wrapper.placeholder, |
| 15859 | argsHolders = replaceHolders(args, placeholder); |
| 15860 | |
| 15861 | length -= argsHolders.length; |
| 15862 | if (length < arity) { |
| 15863 | var newArgPos = argPos ? arrayCopy(argPos) : undefined, |
| 15864 | newArity = nativeMax(arity - length, 0), |
| 15865 | newsHolders = isCurry ? argsHolders : undefined, |
| 15866 | newHoldersRight = isCurry ? undefined : argsHolders, |
| 15867 | newPartials = isCurry ? args : undefined, |
| 15868 | newPartialsRight = isCurry ? undefined : args; |
| 15869 | |
| 15870 | bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG); |
| 15871 | bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG); |
| 15872 | |
| 15873 | if (!isCurryBound) { |
| 15874 | bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG); |
| 15875 | } |
| 15876 | var newData = [func, bitmask, thisArg, newPartials, newsHolders, newPartialsRight, newHoldersRight, newArgPos, ary, newArity], |
| 15877 | result = createHybridWrapper.apply(undefined, newData); |
| 15878 | |
| 15879 | if (isLaziable(func)) { |
| 15880 | setData(result, newData); |
| 15881 | } |
| 15882 | result.placeholder = placeholder; |
| 15883 | return result; |
| 15884 | } |
| 15885 | } |
| 15886 | var thisBinding = isBind ? thisArg : this, |
| 15887 | fn = isBindKey ? thisBinding[func] : func; |
| 15888 | |
| 15889 | if (argPos) { |
| 15890 | args = reorder(args, argPos); |
| 15891 | } |
| 15892 | if (isAry && ary < args.length) { |
| 15893 | args.length = ary; |
| 15894 | } |
| 15895 | if (this && this !== global && this instanceof wrapper) { |
| 15896 | fn = Ctor || createCtorWrapper(func); |
| 15897 | } |
| 15898 | return fn.apply(thisBinding, args); |
| 15899 | } |
| 15900 | return wrapper; |
| 15901 | } |
| 15902 | |
| 15903 | module.exports = createHybridWrapper; |
| 15904 | |
| 15905 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) |
| 15906 | //# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9u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xvYmFsICYmIHRoaXMgaW5zdGFuY2VvZiB3cmFwcGVyKSB7XG4gICAgICBmbiA9IEN0b3IgfHwgY3JlYXRlQ3RvcldyYXBwZXIoZnVuYyk7XG4gICAgfVxuICAgIHJldHVybiBmbi5hcHBseSh0aGlzQmluZGluZywgYXJncyk7XG4gIH1cbiAgcmV0dXJuIHdyYXBwZXI7XG59XG5cbm1vZHVsZS5leHBvcnRzID0gY3JlYXRlSHlicmlkV3JhcHBlcjtcbiJdfQ== |
| 15907 | },{"./arrayCopy":62,"./composeArgs":96,"./composeArgsRight":97,"./createCtorWrapper":101,"./isLaziable":124,"./reorder":131,"./replaceHolders":132,"./setData":133}],105:[function(require,module,exports){ |
| 15908 | (function (global){ |
| 15909 | var createCtorWrapper = require('./createCtorWrapper'); |
| 15910 | |
| 15911 | /** Used to compose bitmasks for wrapper metadata. */ |
| 15912 | var BIND_FLAG = 1; |
| 15913 | |
| 15914 | /** |
| 15915 | * Creates a function that wraps `func` and invokes it with the optional `this` |
| 15916 | * binding of `thisArg` and the `partials` prepended to those provided to |
| 15917 | * the wrapper. |
| 15918 | * |
| 15919 | * @private |
| 15920 | * @param {Function} func The function to partially apply arguments to. |
| 15921 | * @param {number} bitmask The bitmask of flags. See `createWrapper` for more details. |
| 15922 | * @param {*} thisArg The `this` binding of `func`. |
| 15923 | * @param {Array} partials The arguments to prepend to those provided to the new function. |
| 15924 | * @returns {Function} Returns the new bound function. |
| 15925 | */ |
| 15926 | function createPartialWrapper(func, bitmask, thisArg, partials) { |
| 15927 | var isBind = bitmask & BIND_FLAG, |
| 15928 | Ctor = createCtorWrapper(func); |
| 15929 | |
| 15930 | function wrapper() { |
| 15931 | // Avoid `arguments` object use disqualifying optimizations by |
| 15932 | // converting it to an array before providing it `func`. |
| 15933 | var argsIndex = -1, |
| 15934 | argsLength = arguments.length, |
| 15935 | leftIndex = -1, |
| 15936 | leftLength = partials.length, |
| 15937 | args = Array(leftLength + argsLength); |
| 15938 | |
| 15939 | while (++leftIndex < leftLength) { |
| 15940 | args[leftIndex] = partials[leftIndex]; |
| 15941 | } |
| 15942 | while (argsLength--) { |
| 15943 | args[leftIndex++] = arguments[++argsIndex]; |
| 15944 | } |
| 15945 | var fn = (this && this !== global && this instanceof wrapper) ? Ctor : func; |
| 15946 | return fn.apply(isBind ? thisArg : this, args); |
| 15947 | } |
| 15948 | return wrapper; |
| 15949 | } |
| 15950 | |
| 15951 | module.exports = createPartialWrapper; |
| 15952 | |
| 15953 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) |
| 15954 | //# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9sb2Rhc2gtY29tcGF0L2ludGVybmFsL2NyZWF0ZVBhcnRpYWxXcmFwcGVyLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwiZmlsZSI6ImdlbmVyYXRlZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgY3JlYXRlQ3RvcldyYXBwZXIgPSByZXF1aXJlKCcuL2NyZWF0ZUN0b3JXcmFwcGVyJyk7XG5cbi8qKiBVc2VkIHRvIGNvbXBvc2UgYml0bWFza3MgZm9yIHdyYXBwZXIgbWV0YWRhdGEuICovXG52YXIgQklOR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aXNxdWFsaWZ5aW5nIG9wdGltaXphdGlvbnMgYnlcbiAgICAvLyBjb252ZXJ0aW5nIGl0IHRvIGFuIGFycmF5IGJlZm9yZSBwcm92aWRpbmcgaXQgYGZ1bmNgLlxuICAgIHZhciBhcmdzSW5kZXggPSAtMSxcbiAgICAgICAgYXJnc0xlbmd0aCA9IGFyZ3VtZW50cy5sZW5ndGgsXG4gICAgICAgIGxlZnRJbmRleCA9IC0xLFxuICAgICAgICBsZWZ0TGVuZ3RoID0gcGFydGlhbHMubGVuZ3RoLFxuICAgICAgICBhcmdzID0gQXJyYXkobGVmdExlbmd0aCArIGFyZ3NMZW5ndGgpO1xuXG4gICAgd2hpbGUgKCsrbGVmdEluZGV4IDwgbGVmdExlbmd0aCkge1xuICAgICAgYXJnc1tsZWZ0SW5kZXhdID0gcGFydGlhbHNbbGVmdEluZGV4XTtcbiAgICB9XG4gICAgd2hpbGUgKGFyZ3NMZW5ndGgtLSkge1xuICAgICAgYXJnc1tsZWZ0SW5kZXgrK10gPSBhcmd1bWVudHNbKythcmdzSW5kZXhdO1xuICAgIH1cbiAgICB2YXIgZm4gPSAodGhpcyAmJiB0aGlzICE9PSBnbG9iYWwgJiYgdGhpcyBpbnN0YW5jZW9mIHdyYXBwZXIpID8gQ3RvciA6IGZ1bmM7XG4gICAgcmV0dXJuIGZuLmFwcGx5KGlzQmluZCA/IHRoaXNBcmcgOiB0aGlzLCBhcmdzKTtcbiAgfVxuICByZXR1cm4gd3JhcHBlcjtcbn1cblxubW9kdWxlLmV4cG9ydHMgPSBjcmVhdGVQYXJ0aWFsV3JhcHBlcjtcbiJdfQ== |
| 15955 | },{"./createCtorWrapper":101}],106:[function(require,module,exports){ |
| 15956 | var baseSetData = require('./baseSetData'), |
| 15957 | createBindWrapper = require('./createBindWrapper'), |
| 15958 | createHybridWrapper = require('./createHybridWrapper'), |
| 15959 | createPartialWrapper = require('./createPartialWrapper'), |
| 15960 | getData = require('./getData'), |
| 15961 | mergeData = require('./mergeData'), |
| 15962 | setData = require('./setData'); |
| 15963 | |
| 15964 | /** Used to compose bitmasks for wrapper metadata. */ |
| 15965 | var BIND_FLAG = 1, |
| 15966 | BIND_KEY_FLAG = 2, |
| 15967 | PARTIAL_FLAG = 32, |
| 15968 | PARTIAL_RIGHT_FLAG = 64; |
| 15969 | |
| 15970 | /** Used as the `TypeError` message for "Functions" methods. */ |
| 15971 | var FUNC_ERROR_TEXT = 'Expected a function'; |
| 15972 | |
| 15973 | /* Native method references for those with the same name as other `lodash` methods. */ |
| 15974 | var nativeMax = Math.max; |
| 15975 | |
| 15976 | /** |
| 15977 | * Creates a function that either curries or invokes `func` with optional |
| 15978 | * `this` binding and partially applied arguments. |
| 15979 | * |
| 15980 | * @private |
| 15981 | * @param {Function|string} func The function or method name to reference. |
| 15982 | * @param {number} bitmask The bitmask of flags. |
| 15983 | * The bitmask may be composed of the following flags: |
| 15984 | * 1 - `_.bind` |
| 15985 | * 2 - `_.bindKey` |
| 15986 | * 4 - `_.curry` or `_.curryRight` of a bound function |
| 15987 | * 8 - `_.curry` |
| 15988 | * 16 - `_.curryRight` |
| 15989 | * 32 - `_.partial` |
| 15990 | * 64 - `_.partialRight` |
| 15991 | * 128 - `_.rearg` |
| 15992 | * 256 - `_.ary` |
| 15993 | * @param {*} [thisArg] The `this` binding of `func`. |
| 15994 | * @param {Array} [partials] The arguments to be partially applied. |
| 15995 | * @param {Array} [holders] The `partials` placeholder indexes. |
| 15996 | * @param {Array} [argPos] The argument positions of the new function. |
| 15997 | * @param {number} [ary] The arity cap of `func`. |
| 15998 | * @param {number} [arity] The arity of `func`. |
| 15999 | * @returns {Function} Returns the new wrapped function. |
| 16000 | */ |
| 16001 | function createWrapper(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { |
| 16002 | var isBindKey = bitmask & BIND_KEY_FLAG; |
| 16003 | if (!isBindKey && typeof func != 'function') { |
| 16004 | throw new TypeError(FUNC_ERROR_TEXT); |
| 16005 | } |
| 16006 | var length = partials ? partials.length : 0; |
| 16007 | if (!length) { |
| 16008 | bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG); |
| 16009 | partials = holders = undefined; |
| 16010 | } |
| 16011 | length -= (holders ? holders.length : 0); |
| 16012 | if (bitmask & PARTIAL_RIGHT_FLAG) { |
| 16013 | var partialsRight = partials, |
| 16014 | holdersRight = holders; |
| 16015 | |
| 16016 | partials = holders = undefined; |
| 16017 | } |
| 16018 | var data = isBindKey ? undefined : getData(func), |
| 16019 | newData = [func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity]; |
| 16020 | |
| 16021 | if (data) { |
| 16022 | mergeData(newData, data); |
| 16023 | bitmask = newData[1]; |
| 16024 | arity = newData[9]; |
| 16025 | } |
| 16026 | newData[9] = arity == null |
| 16027 | ? (isBindKey ? 0 : func.length) |
| 16028 | : (nativeMax(arity - length, 0) || 0); |
| 16029 | |
| 16030 | if (bitmask == BIND_FLAG) { |
| 16031 | var result = createBindWrapper(newData[0], newData[2]); |
| 16032 | } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !newData[4].length) { |
| 16033 | result = createPartialWrapper.apply(undefined, newData); |
| 16034 | } else { |
| 16035 | result = createHybridWrapper.apply(undefined, newData); |
| 16036 | } |
| 16037 | var setter = data ? baseSetData : setData; |
| 16038 | return setter(result, newData); |
| 16039 | } |
| 16040 | |
| 16041 | module.exports = createWrapper; |
| 16042 | |
| 16043 | },{"./baseSetData":88,"./createBindWrapper":100,"./createHybridWrapper":104,"./createPartialWrapper":105,"./getData":110,"./mergeData":128,"./setData":133}],107:[function(require,module,exports){ |
| 16044 | var arraySome = require('./arraySome'); |
| 16045 | |
| 16046 | /** |
| 16047 | * A specialized version of `baseIsEqualDeep` for arrays with support for |
| 16048 | * partial deep comparisons. |
| 16049 | * |
| 16050 | * @private |
| 16051 | * @param {Array} array The array to compare. |
| 16052 | * @param {Array} other The other array to compare. |
| 16053 | * @param {Function} equalFunc The function to determine equivalents of values. |
| 16054 | * @param {Function} [customizer] The function to customize comparing arrays. |
| 16055 | * @param {boolean} [isLoose] Specify performing partial comparisons. |
| 16056 | * @param {Array} [stackA] Tracks traversed `value` objects. |
| 16057 | * @param {Array} [stackB] Tracks traversed `other` objects. |
| 16058 | * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. |
| 16059 | */ |
| 16060 | function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) { |
| 16061 | var index = -1, |
| 16062 | arrLength = array.length, |
| 16063 | othLength = other.length; |
| 16064 | |
| 16065 | if (arrLength != othLength && !(isLoose && othLength > arrLength)) { |
| 16066 | return false; |
| 16067 | } |
| 16068 | // Ignore non-index properties. |
| 16069 | while (++index < arrLength) { |
| 16070 | var arrValue = array[index], |
| 16071 | othValue = other[index], |
| 16072 | result = customizer ? customizer(isLoose ? othValue : arrValue, isLoose ? arrValue : othValue, index) : undefined; |
| 16073 | |
| 16074 | if (result !== undefined) { |
| 16075 | if (result) { |
| 16076 | continue; |
| 16077 | } |
| 16078 | return false; |
| 16079 | } |
| 16080 | // Recursively compare arrays (susceptible to call stack limits). |
| 16081 | if (isLoose) { |
| 16082 | if (!arraySome(other, function(othValue) { |
| 16083 | return arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB); |
| 16084 | })) { |
| 16085 | return false; |
| 16086 | } |
| 16087 | } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB))) { |
| 16088 | return false; |
| 16089 | } |
| 16090 | } |
| 16091 | return true; |
| 16092 | } |
| 16093 | |
| 16094 | module.exports = equalArrays; |
| 16095 | |
| 16096 | },{"./arraySome":65}],108:[function(require,module,exports){ |
| 16097 | /** `Object#toString` result references. */ |
| 16098 | var boolTag = '[object Boolean]', |
| 16099 | dateTag = '[object Date]', |
| 16100 | errorTag = '[object Error]', |
| 16101 | numberTag = '[object Number]', |
| 16102 | regexpTag = '[object RegExp]', |
| 16103 | stringTag = '[object String]'; |
| 16104 | |
| 16105 | /** |
| 16106 | * A specialized version of `baseIsEqualDeep` for comparing objects of |
| 16107 | * the same `toStringTag`. |
| 16108 | * |
| 16109 | * **Note:** This function only supports comparing values with tags of |
| 16110 | * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. |
| 16111 | * |
| 16112 | * @private |
| 16113 | * @param {Object} object The object to compare. |
| 16114 | * @param {Object} other The other object to compare. |
| 16115 | * @param {string} tag The `toStringTag` of the objects to compare. |
| 16116 | * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. |
| 16117 | */ |
| 16118 | function equalByTag(object, other, tag) { |
| 16119 | switch (tag) { |
| 16120 | case boolTag: |
| 16121 | case dateTag: |
| 16122 | // Coerce dates and booleans to numbers, dates to milliseconds and booleans |
| 16123 | // to `1` or `0` treating invalid dates coerced to `NaN` as not equal. |
| 16124 | return +object == +other; |
| 16125 | |
| 16126 | case errorTag: |
| 16127 | return object.name == other.name && object.message == other.message; |
| 16128 | |
| 16129 | case numberTag: |
| 16130 | // Treat `NaN` vs. `NaN` as equal. |
| 16131 | return (object != +object) |
| 16132 | ? other != +other |
| 16133 | : object == +other; |
| 16134 | |
| 16135 | case regexpTag: |
| 16136 | case stringTag: |
| 16137 | // Coerce regexes to strings and treat strings primitives and string |
| 16138 | // objects as equal. See https://es5.github.io/#x15.10.6.4 for more details. |
| 16139 | return object == (other + ''); |
| 16140 | } |
| 16141 | return false; |
| 16142 | } |
| 16143 | |
| 16144 | module.exports = equalByTag; |
| 16145 | |
| 16146 | },{}],109:[function(require,module,exports){ |
| 16147 | var keys = require('../object/keys'); |
| 16148 | |
| 16149 | /** Used for native method references. */ |
| 16150 | var objectProto = Object.prototype; |
| 16151 | |
| 16152 | /** Used to check objects for own properties. */ |
| 16153 | var hasOwnProperty = objectProto.hasOwnProperty; |
| 16154 | |
| 16155 | /** |
| 16156 | * A specialized version of `baseIsEqualDeep` for objects with support for |
| 16157 | * partial deep comparisons. |
| 16158 | * |
| 16159 | * @private |
| 16160 | * @param {Object} object The object to compare. |
| 16161 | * @param {Object} other The other object to compare. |
| 16162 | * @param {Function} equalFunc The function to determine equivalents of values. |
| 16163 | * @param {Function} [customizer] The function to customize comparing values. |
| 16164 | * @param {boolean} [isLoose] Specify performing partial comparisons. |
| 16165 | * @param {Array} [stackA] Tracks traversed `value` objects. |
| 16166 | * @param {Array} [stackB] Tracks traversed `other` objects. |
| 16167 | * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. |
| 16168 | */ |
| 16169 | function equalObjects(object, other, equalFunc, customizer, isLoose, stackA, stackB) { |
| 16170 | var objProps = keys(object), |
| 16171 | objLength = objProps.length, |
| 16172 | othProps = keys(other), |
| 16173 | othLength = othProps.length; |
| 16174 | |
| 16175 | if (objLength != othLength && !isLoose) { |
| 16176 | return false; |
| 16177 | } |
| 16178 | var index = objLength; |
| 16179 | while (index--) { |
| 16180 | var key = objProps[index]; |
| 16181 | if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) { |
| 16182 | return false; |
| 16183 | } |
| 16184 | } |
| 16185 | var skipCtor = isLoose; |
| 16186 | while (++index < objLength) { |
| 16187 | key = objProps[index]; |
| 16188 | var objValue = object[key], |
| 16189 | othValue = other[key], |
| 16190 | result = customizer ? customizer(isLoose ? othValue : objValue, isLoose? objValue : othValue, key) : undefined; |
| 16191 | |
| 16192 | // Recursively compare objects (susceptible to call stack limits). |
| 16193 | if (!(result === undefined ? equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB) : result)) { |
| 16194 | return false; |
| 16195 | } |
| 16196 | skipCtor || (skipCtor = key == 'constructor'); |
| 16197 | } |
| 16198 | if (!skipCtor) { |
| 16199 | var objCtor = object.constructor, |
| 16200 | othCtor = other.constructor; |
| 16201 | |
| 16202 | // Non `Object` object instances with different constructors are not equal. |
| 16203 | if (objCtor != othCtor && |
| 16204 | ('constructor' in object && 'constructor' in other) && |
| 16205 | !(typeof objCtor == 'function' && objCtor instanceof objCtor && |
| 16206 | typeof othCtor == 'function' && othCtor instanceof othCtor)) { |
| 16207 | return false; |
| 16208 | } |
| 16209 | } |
| 16210 | return true; |
| 16211 | } |
| 16212 | |
| 16213 | module.exports = equalObjects; |
| 16214 | |
| 16215 | },{"../object/keys":149}],110:[function(require,module,exports){ |
| 16216 | var metaMap = require('./metaMap'), |
| 16217 | noop = require('../utility/noop'); |
| 16218 | |
| 16219 | /** |
| 16220 | * Gets metadata for `func`. |
| 16221 | * |
| 16222 | * @private |
| 16223 | * @param {Function} func The function to query. |
| 16224 | * @returns {*} Returns the metadata for `func`. |
| 16225 | */ |
| 16226 | var getData = !metaMap ? noop : function(func) { |
| 16227 | return metaMap.get(func); |
| 16228 | }; |
| 16229 | |
| 16230 | module.exports = getData; |
| 16231 | |
| 16232 | },{"../utility/noop":155,"./metaMap":129}],111:[function(require,module,exports){ |
| 16233 | var realNames = require('./realNames'); |
| 16234 | |
| 16235 | /** |
| 16236 | * Gets the name of `func`. |
| 16237 | * |
| 16238 | * @private |
| 16239 | * @param {Function} func The function to query. |
| 16240 | * @returns {string} Returns the function name. |
| 16241 | */ |
| 16242 | function getFuncName(func) { |
| 16243 | var result = (func.name + ''), |
| 16244 | array = realNames[result], |
| 16245 | length = array ? array.length : 0; |
| 16246 | |
| 16247 | while (length--) { |
| 16248 | var data = array[length], |
| 16249 | otherFunc = data.func; |
| 16250 | if (otherFunc == null || otherFunc == func) { |
| 16251 | return data.name; |
| 16252 | } |
| 16253 | } |
| 16254 | return result; |
| 16255 | } |
| 16256 | |
| 16257 | module.exports = getFuncName; |
| 16258 | |
| 16259 | },{"./realNames":130}],112:[function(require,module,exports){ |
| 16260 | var baseProperty = require('./baseProperty'); |
| 16261 | |
| 16262 | /** |
| 16263 | * Gets the "length" property value of `object`. |
| 16264 | * |
| 16265 | * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) |
| 16266 | * that affects Safari on at least iOS 8.1-8.3 ARM64. |
| 16267 | * |
| 16268 | * @private |
| 16269 | * @param {Object} object The object to query. |
| 16270 | * @returns {*} Returns the "length" value. |
| 16271 | */ |
| 16272 | var getLength = baseProperty('length'); |
| 16273 | |
| 16274 | module.exports = getLength; |
| 16275 | |
| 16276 | },{"./baseProperty":86}],113:[function(require,module,exports){ |
| 16277 | var isStrictComparable = require('./isStrictComparable'), |
| 16278 | pairs = require('../object/pairs'); |
| 16279 | |
| 16280 | /** |
| 16281 | * Gets the propery names, values, and compare flags of `object`. |
| 16282 | * |
| 16283 | * @private |
| 16284 | * @param {Object} object The object to query. |
| 16285 | * @returns {Array} Returns the match data of `object`. |
| 16286 | */ |
| 16287 | function getMatchData(object) { |
| 16288 | var result = pairs(object), |
| 16289 | length = result.length; |
| 16290 | |
| 16291 | while (length--) { |
| 16292 | result[length][2] = isStrictComparable(result[length][1]); |
| 16293 | } |
| 16294 | return result; |
| 16295 | } |
| 16296 | |
| 16297 | module.exports = getMatchData; |
| 16298 | |
| 16299 | },{"../object/pairs":151,"./isStrictComparable":127}],114:[function(require,module,exports){ |
| 16300 | var isNative = require('../lang/isNative'); |
| 16301 | |
| 16302 | /** |
| 16303 | * Gets the native function at `key` of `object`. |
| 16304 | * |
| 16305 | * @private |
| 16306 | * @param {Object} object The object to query. |
| 16307 | * @param {string} key The key of the method to get. |
| 16308 | * @returns {*} Returns the function if it's native, else `undefined`. |
| 16309 | */ |
| 16310 | function getNative(object, key) { |
| 16311 | var value = object == null ? undefined : object[key]; |
| 16312 | return isNative(value) ? value : undefined; |
| 16313 | } |
| 16314 | |
| 16315 | module.exports = getNative; |
| 16316 | |
| 16317 | },{"../lang/isNative":143}],115:[function(require,module,exports){ |
| 16318 | /** |
| 16319 | * Gets the index at which the first occurrence of `NaN` is found in `array`. |
| 16320 | * |
| 16321 | * @private |
| 16322 | * @param {Array} array The array to search. |
| 16323 | * @param {number} fromIndex The index to search from. |
| 16324 | * @param {boolean} [fromRight] Specify iterating from right to left. |
| 16325 | * @returns {number} Returns the index of the matched `NaN`, else `-1`. |
| 16326 | */ |
| 16327 | function indexOfNaN(array, fromIndex, fromRight) { |
| 16328 | var length = array.length, |
| 16329 | index = fromIndex + (fromRight ? 0 : -1); |
| 16330 | |
| 16331 | while ((fromRight ? index-- : ++index < length)) { |
| 16332 | var other = array[index]; |
| 16333 | if (other !== other) { |
| 16334 | return index; |
| 16335 | } |
| 16336 | } |
| 16337 | return -1; |
| 16338 | } |
| 16339 | |
| 16340 | module.exports = indexOfNaN; |
| 16341 | |
| 16342 | },{}],116:[function(require,module,exports){ |
| 16343 | /** Used for native method references. */ |
| 16344 | var objectProto = Object.prototype; |
| 16345 | |
| 16346 | /** Used to check objects for own properties. */ |
| 16347 | var hasOwnProperty = objectProto.hasOwnProperty; |
| 16348 | |
| 16349 | /** |
| 16350 | * Initializes an array clone. |
| 16351 | * |
| 16352 | * @private |
| 16353 | * @param {Array} array The array to clone. |
| 16354 | * @returns {Array} Returns the initialized clone. |
| 16355 | */ |
| 16356 | function initCloneArray(array) { |
| 16357 | var length = array.length, |
| 16358 | result = new array.constructor(length); |
| 16359 | |
| 16360 | // Add array properties assigned by `RegExp#exec`. |
| 16361 | if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { |
| 16362 | result.index = array.index; |
| 16363 | result.input = array.input; |
| 16364 | } |
| 16365 | return result; |
| 16366 | } |
| 16367 | |
| 16368 | module.exports = initCloneArray; |
| 16369 | |
| 16370 | },{}],117:[function(require,module,exports){ |
| 16371 | (function (global){ |
| 16372 | var bufferClone = require('./bufferClone'); |
| 16373 | |
| 16374 | /** `Object#toString` result references. */ |
| 16375 | var boolTag = '[object Boolean]', |
| 16376 | dateTag = '[object Date]', |
| 16377 | numberTag = '[object Number]', |
| 16378 | regexpTag = '[object RegExp]', |
| 16379 | stringTag = '[object String]'; |
| 16380 | |
| 16381 | var arrayBufferTag = '[object ArrayBuffer]', |
| 16382 | float32Tag = '[object Float32Array]', |
| 16383 | float64Tag = '[object Float64Array]', |
| 16384 | int8Tag = '[object Int8Array]', |
| 16385 | int16Tag = '[object Int16Array]', |
| 16386 | int32Tag = '[object Int32Array]', |
| 16387 | uint8Tag = '[object Uint8Array]', |
| 16388 | uint8ClampedTag = '[object Uint8ClampedArray]', |
| 16389 | uint16Tag = '[object Uint16Array]', |
| 16390 | uint32Tag = '[object Uint32Array]'; |
| 16391 | |
| 16392 | /** Used to match `RegExp` flags from their coerced string values. */ |
| 16393 | var reFlags = /\w*$/; |
| 16394 | |
| 16395 | /** Native method references. */ |
| 16396 | var Uint8Array = global.Uint8Array; |
| 16397 | |
| 16398 | /** Used to lookup a type array constructors by `toStringTag`. */ |
| 16399 | var ctorByTag = {}; |
| 16400 | ctorByTag[float32Tag] = global.Float32Array; |
| 16401 | ctorByTag[float64Tag] = global.Float64Array; |
| 16402 | ctorByTag[int8Tag] = global.Int8Array; |
| 16403 | ctorByTag[int16Tag] = global.Int16Array; |
| 16404 | ctorByTag[int32Tag] = global.Int32Array; |
| 16405 | ctorByTag[uint8Tag] = Uint8Array; |
| 16406 | ctorByTag[uint8ClampedTag] = global.Uint8ClampedArray; |
| 16407 | ctorByTag[uint16Tag] = global.Uint16Array; |
| 16408 | ctorByTag[uint32Tag] = global.Uint32Array; |
| 16409 | |
| 16410 | /** |
| 16411 | * Initializes an object clone based on its `toStringTag`. |
| 16412 | * |
| 16413 | * **Note:** This function only supports cloning values with tags of |
| 16414 | * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. |
| 16415 | * |
| 16416 | * @private |
| 16417 | * @param {Object} object The object to clone. |
| 16418 | * @param {string} tag The `toStringTag` of the object to clone. |
| 16419 | * @param {boolean} [isDeep] Specify a deep clone. |
| 16420 | * @returns {Object} Returns the initialized clone. |
| 16421 | */ |
| 16422 | function initCloneByTag(object, tag, isDeep) { |
| 16423 | var Ctor = object.constructor; |
| 16424 | switch (tag) { |
| 16425 | case arrayBufferTag: |
| 16426 | return bufferClone(object); |
| 16427 | |
| 16428 | case boolTag: |
| 16429 | case dateTag: |
| 16430 | return new Ctor(+object); |
| 16431 | |
| 16432 | case float32Tag: case float64Tag: |
| 16433 | case int8Tag: case int16Tag: case int32Tag: |
| 16434 | case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: |
| 16435 | // Safari 5 mobile incorrectly has `Object` as the constructor of typed arrays. |
| 16436 | if (Ctor instanceof Ctor) { |
| 16437 | Ctor = ctorByTag[tag]; |
| 16438 | } |
| 16439 | var buffer = object.buffer; |
| 16440 | return new Ctor(isDeep ? bufferClone(buffer) : buffer, object.byteOffset, object.length); |
| 16441 | |
| 16442 | case numberTag: |
| 16443 | case stringTag: |
| 16444 | return new Ctor(object); |
| 16445 | |
| 16446 | case regexpTag: |
| 16447 | var result = new Ctor(object.source, reFlags.exec(object)); |
| 16448 | result.lastIndex = object.lastIndex; |
| 16449 | } |
| 16450 | return result; |
| 16451 | } |
| 16452 | |
| 16453 | module.exports = initCloneByTag; |
| 16454 | |
| 16455 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) |
| 16456 | //# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9sb2Rhc2gtY29tcGF0L2ludGVybmFsL2luaXRDbG9uZUJ5VGFnLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQ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VGFnOiBjYXNlIHVpbnQxNlRhZzogY2FzZSB1aW50MzJUYWc6XG4gICAgICAvLyBTYWZhcmkgNSBtb2JpbGUgaW5jb3JyZWN0bHkgaGFzIGBPYmplY3RgIGFzIHRoZSBjb25zdHJ1Y3RvciBvZiB0eXBlZCBhcnJheXMuXG4gICAgICBpZiAoQ3RvciBpbnN0YW5jZW9mIEN0b3IpIHtcbiAgICAgICAgQ3RvciA9IGN0b3JCeVRhZ1t0YWddO1xuICAgICAgfVxuICAgICAgdmFyIGJ1ZmZlciA9IG9iamVjdC5idWZmZXI7XG4gICAgICByZXR1cm4gbmV3IEN0b3IoaXNEZWVwID8gYnVmZmVyQ2xvbmUoYnVmZmVyKSA6IGJ1ZmZlciwgb2JqZWN0LmJ5dGVPZmZzZXQsIG9iamVjdC5sZW5ndGgpO1xuXG4gICAgY2FzZSBudW1iZXJUYWc6XG4gICAgY2FzZSBzdHJpbmdUYWc6XG4gICAgICByZXR1cm4gbmV3IEN0b3Iob2JqZWN0KTtcblxuICAgIGNhc2UgcmVnZXhwVGFnOlxuICAgICAgdmFyIHJlc3VsdCA9IG5ldyBDdG9yKG9iamVjdC5zb3VyY2UsIHJlRmxhZ3MuZXhlYyhvYmplY3QpKTtcbiAgICAgIHJlc3VsdC5sYXN0SW5kZXggPSBvYmplY3QubGFzdEluZGV4O1xuICB9XG4gIHJldHVybiByZXN1bHQ7XG59XG5cbm1vZHVsZS5leHBvcnRzID0gaW5pdENsb25lQnlUYWc7XG4iXX0= |
| 16457 | },{"./bufferClone":95}],118:[function(require,module,exports){ |
| 16458 | /** |
| 16459 | * Initializes an object clone. |
| 16460 | * |
| 16461 | * @private |
| 16462 | * @param {Object} object The object to clone. |
| 16463 | * @returns {Object} Returns the initialized clone. |
| 16464 | */ |
| 16465 | function initCloneObject(object) { |
| 16466 | var Ctor = object.constructor; |
| 16467 | if (!(typeof Ctor == 'function' && Ctor instanceof Ctor)) { |
| 16468 | Ctor = Object; |
| 16469 | } |
| 16470 | return new Ctor; |
| 16471 | } |
| 16472 | |
| 16473 | module.exports = initCloneObject; |
| 16474 | |
| 16475 | },{}],119:[function(require,module,exports){ |
| 16476 | var getLength = require('./getLength'), |
| 16477 | isLength = require('./isLength'); |
| 16478 | |
| 16479 | /** |
| 16480 | * Checks if `value` is array-like. |
| 16481 | * |
| 16482 | * @private |
| 16483 | * @param {*} value The value to check. |
| 16484 | * @returns {boolean} Returns `true` if `value` is array-like, else `false`. |
| 16485 | */ |
| 16486 | function isArrayLike(value) { |
| 16487 | return value != null && isLength(getLength(value)); |
| 16488 | } |
| 16489 | |
| 16490 | module.exports = isArrayLike; |
| 16491 | |
| 16492 | },{"./getLength":112,"./isLength":125}],120:[function(require,module,exports){ |
| 16493 | /** |
| 16494 | * Checks if `value` is a host object in IE < 9. |
| 16495 | * |
| 16496 | * @private |
| 16497 | * @param {*} value The value to check. |
| 16498 | * @returns {boolean} Returns `true` if `value` is a host object, else `false`. |
| 16499 | */ |
| 16500 | var isHostObject = (function() { |
| 16501 | try { |
| 16502 | Object({ 'toString': 0 } + ''); |
| 16503 | } catch(e) { |
| 16504 | return function() { return false; }; |
| 16505 | } |
| 16506 | return function(value) { |
| 16507 | // IE < 9 presents many host objects as `Object` objects that can coerce |
| 16508 | // to strings despite having improperly defined `toString` methods. |
| 16509 | return typeof value.toString != 'function' && typeof (value + '') == 'string'; |
| 16510 | }; |
| 16511 | }()); |
| 16512 | |
| 16513 | module.exports = isHostObject; |
| 16514 | |
| 16515 | },{}],121:[function(require,module,exports){ |
| 16516 | /** Used to detect unsigned integer values. */ |
| 16517 | var reIsUint = /^\d+$/; |
| 16518 | |
| 16519 | /** |
| 16520 | * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) |
| 16521 | * of an array-like value. |
| 16522 | */ |
| 16523 | var MAX_SAFE_INTEGER = 9007199254740991; |
| 16524 | |
| 16525 | /** |
| 16526 | * Checks if `value` is a valid array-like index. |
| 16527 | * |
| 16528 | * @private |
| 16529 | * @param {*} value The value to check. |
| 16530 | * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. |
| 16531 | * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. |
| 16532 | */ |
| 16533 | function isIndex(value, length) { |
| 16534 | value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; |
| 16535 | length = length == null ? MAX_SAFE_INTEGER : length; |
| 16536 | return value > -1 && value % 1 == 0 && value < length; |
| 16537 | } |
| 16538 | |
| 16539 | module.exports = isIndex; |
| 16540 | |
| 16541 | },{}],122:[function(require,module,exports){ |
| 16542 | var isArrayLike = require('./isArrayLike'), |
| 16543 | isIndex = require('./isIndex'), |
| 16544 | isObject = require('../lang/isObject'); |
| 16545 | |
| 16546 | /** |
| 16547 | * Checks if the provided arguments are from an iteratee call. |
| 16548 | * |
| 16549 | * @private |
| 16550 | * @param {*} value The potential iteratee value argument. |
| 16551 | * @param {*} index The potential iteratee index or key argument. |
| 16552 | * @param {*} object The potential iteratee object argument. |
| 16553 | * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`. |
| 16554 | */ |
| 16555 | function isIterateeCall(value, index, object) { |
| 16556 | if (!isObject(object)) { |
| 16557 | return false; |
| 16558 | } |
| 16559 | var type = typeof index; |
| 16560 | if (type == 'number' |
| 16561 | ? (isArrayLike(object) && isIndex(index, object.length)) |
| 16562 | : (type == 'string' && index in object)) { |
| 16563 | var other = object[index]; |
| 16564 | return value === value ? (value === other) : (other !== other); |
| 16565 | } |
| 16566 | return false; |
| 16567 | } |
| 16568 | |
| 16569 | module.exports = isIterateeCall; |
| 16570 | |
| 16571 | },{"../lang/isObject":144,"./isArrayLike":119,"./isIndex":121}],123:[function(require,module,exports){ |
| 16572 | var isArray = require('../lang/isArray'), |
| 16573 | toObject = require('./toObject'); |
| 16574 | |
| 16575 | /** Used to match property names within property paths. */ |
| 16576 | var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/, |
| 16577 | reIsPlainProp = /^\w*$/; |
| 16578 | |
| 16579 | /** |
| 16580 | * Checks if `value` is a property name and not a property path. |
| 16581 | * |
| 16582 | * @private |
| 16583 | * @param {*} value The value to check. |
| 16584 | * @param {Object} [object] The object to query keys on. |
| 16585 | * @returns {boolean} Returns `true` if `value` is a property name, else `false`. |
| 16586 | */ |
| 16587 | function isKey(value, object) { |
| 16588 | var type = typeof value; |
| 16589 | if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') { |
| 16590 | return true; |
| 16591 | } |
| 16592 | if (isArray(value)) { |
| 16593 | return false; |
| 16594 | } |
| 16595 | var result = !reIsDeepProp.test(value); |
| 16596 | return result || (object != null && value in toObject(object)); |
| 16597 | } |
| 16598 | |
| 16599 | module.exports = isKey; |
| 16600 | |
| 16601 | },{"../lang/isArray":140,"./toObject":135}],124:[function(require,module,exports){ |
| 16602 | var LazyWrapper = require('./LazyWrapper'), |
| 16603 | getData = require('./getData'), |
| 16604 | getFuncName = require('./getFuncName'), |
| 16605 | lodash = require('../chain/lodash'); |
| 16606 | |
| 16607 | /** |
| 16608 | * Checks if `func` has a lazy counterpart. |
| 16609 | * |
| 16610 | * @private |
| 16611 | * @param {Function} func The function to check. |
| 16612 | * @returns {boolean} Returns `true` if `func` has a lazy counterpart, else `false`. |
| 16613 | */ |
| 16614 | function isLaziable(func) { |
| 16615 | var funcName = getFuncName(func), |
| 16616 | other = lodash[funcName]; |
| 16617 | |
| 16618 | if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) { |
| 16619 | return false; |
| 16620 | } |
| 16621 | if (func === other) { |
| 16622 | return true; |
| 16623 | } |
| 16624 | var data = getData(other); |
| 16625 | return !!data && func === data[0]; |
| 16626 | } |
| 16627 | |
| 16628 | module.exports = isLaziable; |
| 16629 | |
| 16630 | },{"../chain/lodash":51,"./LazyWrapper":60,"./getData":110,"./getFuncName":111}],125:[function(require,module,exports){ |
| 16631 | /** |
| 16632 | * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) |
| 16633 | * of an array-like value. |
| 16634 | */ |
| 16635 | var MAX_SAFE_INTEGER = 9007199254740991; |
| 16636 | |
| 16637 | /** |
| 16638 | * Checks if `value` is a valid array-like length. |
| 16639 | * |
| 16640 | * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). |
| 16641 | * |
| 16642 | * @private |
| 16643 | * @param {*} value The value to check. |
| 16644 | * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. |
| 16645 | */ |
| 16646 | function isLength(value) { |
| 16647 | return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; |
| 16648 | } |
| 16649 | |
| 16650 | module.exports = isLength; |
| 16651 | |
| 16652 | },{}],126:[function(require,module,exports){ |
| 16653 | /** |
| 16654 | * Checks if `value` is object-like. |
| 16655 | * |
| 16656 | * @private |
| 16657 | * @param {*} value The value to check. |
| 16658 | * @returns {boolean} Returns `true` if `value` is object-like, else `false`. |
| 16659 | */ |
| 16660 | function isObjectLike(value) { |
| 16661 | return !!value && typeof value == 'object'; |
| 16662 | } |
| 16663 | |
| 16664 | module.exports = isObjectLike; |
| 16665 | |
| 16666 | },{}],127:[function(require,module,exports){ |
| 16667 | var isObject = require('../lang/isObject'); |
| 16668 | |
| 16669 | /** |
| 16670 | * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. |
| 16671 | * |
| 16672 | * @private |
| 16673 | * @param {*} value The value to check. |
| 16674 | * @returns {boolean} Returns `true` if `value` if suitable for strict |
| 16675 | * equality comparisons, else `false`. |
| 16676 | */ |
| 16677 | function isStrictComparable(value) { |
| 16678 | return value === value && !isObject(value); |
| 16679 | } |
| 16680 | |
| 16681 | module.exports = isStrictComparable; |
| 16682 | |
| 16683 | },{"../lang/isObject":144}],128:[function(require,module,exports){ |
| 16684 | var arrayCopy = require('./arrayCopy'), |
| 16685 | composeArgs = require('./composeArgs'), |
| 16686 | composeArgsRight = require('./composeArgsRight'), |
| 16687 | replaceHolders = require('./replaceHolders'); |
| 16688 | |
| 16689 | /** Used to compose bitmasks for wrapper metadata. */ |
| 16690 | var BIND_FLAG = 1, |
| 16691 | CURRY_BOUND_FLAG = 4, |
| 16692 | CURRY_FLAG = 8, |
| 16693 | ARY_FLAG = 128, |
| 16694 | REARG_FLAG = 256; |
| 16695 | |
| 16696 | /** Used as the internal argument placeholder. */ |
| 16697 | var PLACEHOLDER = '__lodash_placeholder__'; |
| 16698 | |
| 16699 | /* Native method references for those with the same name as other `lodash` methods. */ |
| 16700 | var nativeMin = Math.min; |
| 16701 | |
| 16702 | /** |
| 16703 | * Merges the function metadata of `source` into `data`. |
| 16704 | * |
| 16705 | * Merging metadata reduces the number of wrappers required to invoke a function. |
| 16706 | * This is possible because methods like `_.bind`, `_.curry`, and `_.partial` |
| 16707 | * may be applied regardless of execution order. Methods like `_.ary` and `_.rearg` |
| 16708 | * augment function arguments, making the order in which they are executed important, |
| 16709 | * preventing the merging of metadata. However, we make an exception for a safe |
| 16710 | * common case where curried functions have `_.ary` and or `_.rearg` applied. |
| 16711 | * |
| 16712 | * @private |
| 16713 | * @param {Array} data The destination metadata. |
| 16714 | * @param {Array} source The source metadata. |
| 16715 | * @returns {Array} Returns `data`. |
| 16716 | */ |
| 16717 | function mergeData(data, source) { |
| 16718 | var bitmask = data[1], |
| 16719 | srcBitmask = source[1], |
| 16720 | newBitmask = bitmask | srcBitmask, |
| 16721 | isCommon = newBitmask < ARY_FLAG; |
| 16722 | |
| 16723 | var isCombo = |
| 16724 | (srcBitmask == ARY_FLAG && bitmask == CURRY_FLAG) || |
| 16725 | (srcBitmask == ARY_FLAG && bitmask == REARG_FLAG && data[7].length <= source[8]) || |
| 16726 | (srcBitmask == (ARY_FLAG | REARG_FLAG) && bitmask == CURRY_FLAG); |
| 16727 | |
| 16728 | // Exit early if metadata can't be merged. |
| 16729 | if (!(isCommon || isCombo)) { |
| 16730 | return data; |
| 16731 | } |
| 16732 | // Use source `thisArg` if available. |
| 16733 | if (srcBitmask & BIND_FLAG) { |
| 16734 | data[2] = source[2]; |
| 16735 | // Set when currying a bound function. |
| 16736 | newBitmask |= (bitmask & BIND_FLAG) ? 0 : CURRY_BOUND_FLAG; |
| 16737 | } |
| 16738 | // Compose partial arguments. |
| 16739 | var value = source[3]; |
| 16740 | if (value) { |
| 16741 | var partials = data[3]; |
| 16742 | data[3] = partials ? composeArgs(partials, value, source[4]) : arrayCopy(value); |
| 16743 | data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : arrayCopy(source[4]); |
| 16744 | } |
| 16745 | // Compose partial right arguments. |
| 16746 | value = source[5]; |
| 16747 | if (value) { |
| 16748 | partials = data[5]; |
| 16749 | data[5] = partials ? composeArgsRight(partials, value, source[6]) : arrayCopy(value); |
| 16750 | data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : arrayCopy(source[6]); |
| 16751 | } |
| 16752 | // Use source `argPos` if available. |
| 16753 | value = source[7]; |
| 16754 | if (value) { |
| 16755 | data[7] = arrayCopy(value); |
| 16756 | } |
| 16757 | // Use source `ary` if it's smaller. |
| 16758 | if (srcBitmask & ARY_FLAG) { |
| 16759 | data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); |
| 16760 | } |
| 16761 | // Use source `arity` if one is not provided. |
| 16762 | if (data[9] == null) { |
| 16763 | data[9] = source[9]; |
| 16764 | } |
| 16765 | // Use source `func` and merge bitmasks. |
| 16766 | data[0] = source[0]; |
| 16767 | data[1] = newBitmask; |
| 16768 | |
| 16769 | return data; |
| 16770 | } |
| 16771 | |
| 16772 | module.exports = mergeData; |
| 16773 | |
| 16774 | },{"./arrayCopy":62,"./composeArgs":96,"./composeArgsRight":97,"./replaceHolders":132}],129:[function(require,module,exports){ |
| 16775 | (function (global){ |
| 16776 | var getNative = require('./getNative'); |
| 16777 | |
| 16778 | /** Native method references. */ |
| 16779 | var WeakMap = getNative(global, 'WeakMap'); |
| 16780 | |
| 16781 | /** Used to store function metadata. */ |
| 16782 | var metaMap = WeakMap && new WeakMap; |
| 16783 | |
| 16784 | module.exports = metaMap; |
| 16785 | |
| 16786 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) |
| 16787 | //# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9sb2Rhc2gtY29tcGF0L2ludGVybmFsL21ldGFNYXAuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwiZmlsZSI6ImdlbmVyYXRlZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgZ2V0TmF0aXZlID0gcmVxdWlyZSgnLi9nZXROYXRpdmUnKTtcblxuLyoqIE5hdGl2ZSBtZXRob2QgcmVmZXJlbmNlcy4gKi9cbnZhciBXZWFrTWFwID0gZ2V0TmF0aXZlKGdsb2JhbCwgJ1dlYWtNYXAnKTtcblxuLyoqIFVzZWQgdG8gc3RvcmUgZnVuY3Rpb24gbWV0YWRhdGEuICovXG52YXIgbWV0YU1hcCA9IFdlYWtNYXAgJiYgbmV3IFdlYWtNYXA7XG5cbm1vZHVsZS5leHBvcnRzID0gbWV0YU1hcDtcbiJdfQ== |
| 16788 | },{"./getNative":114}],130:[function(require,module,exports){ |
| 16789 | /** Used to lookup unminified function names. */ |
| 16790 | var realNames = {}; |
| 16791 | |
| 16792 | module.exports = realNames; |
| 16793 | |
| 16794 | },{}],131:[function(require,module,exports){ |
| 16795 | var arrayCopy = require('./arrayCopy'), |
| 16796 | isIndex = require('./isIndex'); |
| 16797 | |
| 16798 | /* Native method references for those with the same name as other `lodash` methods. */ |
| 16799 | var nativeMin = Math.min; |
| 16800 | |
| 16801 | /** |
| 16802 | * Reorder `array` according to the specified indexes where the element at |
| 16803 | * the first index is assigned as the first element, the element at |
| 16804 | * the second index is assigned as the second element, and so on. |
| 16805 | * |
| 16806 | * @private |
| 16807 | * @param {Array} array The array to reorder. |
| 16808 | * @param {Array} indexes The arranged array indexes. |
| 16809 | * @returns {Array} Returns `array`. |
| 16810 | */ |
| 16811 | function reorder(array, indexes) { |
| 16812 | var arrLength = array.length, |
| 16813 | length = nativeMin(indexes.length, arrLength), |
| 16814 | oldArray = arrayCopy(array); |
| 16815 | |
| 16816 | while (length--) { |
| 16817 | var index = indexes[length]; |
| 16818 | array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined; |
| 16819 | } |
| 16820 | return array; |
| 16821 | } |
| 16822 | |
| 16823 | module.exports = reorder; |
| 16824 | |
| 16825 | },{"./arrayCopy":62,"./isIndex":121}],132:[function(require,module,exports){ |
| 16826 | /** Used as the internal argument placeholder. */ |
| 16827 | var PLACEHOLDER = '__lodash_placeholder__'; |
| 16828 | |
| 16829 | /** |
| 16830 | * Replaces all `placeholder` elements in `array` with an internal placeholder |
| 16831 | * and returns an array of their indexes. |
| 16832 | * |
| 16833 | * @private |
| 16834 | * @param {Array} array The array to modify. |
| 16835 | * @param {*} placeholder The placeholder to replace. |
| 16836 | * @returns {Array} Returns the new array of placeholder indexes. |
| 16837 | */ |
| 16838 | function replaceHolders(array, placeholder) { |
| 16839 | var index = -1, |
| 16840 | length = array.length, |
| 16841 | resIndex = -1, |
| 16842 | result = []; |
| 16843 | |
| 16844 | while (++index < length) { |
| 16845 | if (array[index] === placeholder) { |
| 16846 | array[index] = PLACEHOLDER; |
| 16847 | result[++resIndex] = index; |
| 16848 | } |
| 16849 | } |
| 16850 | return result; |
| 16851 | } |
| 16852 | |
| 16853 | module.exports = replaceHolders; |
| 16854 | |
| 16855 | },{}],133:[function(require,module,exports){ |
| 16856 | var baseSetData = require('./baseSetData'), |
| 16857 | now = require('../date/now'); |
| 16858 | |
| 16859 | /** Used to detect when a function becomes hot. */ |
| 16860 | var HOT_COUNT = 150, |
| 16861 | HOT_SPAN = 16; |
| 16862 | |
| 16863 | /** |
| 16864 | * Sets metadata for `func`. |
| 16865 | * |
| 16866 | * **Note:** If this function becomes hot, i.e. is invoked a lot in a short |
| 16867 | * period of time, it will trip its breaker and transition to an identity function |
| 16868 | * to avoid garbage collection pauses in V8. See [V8 issue 2070](https://code.google.com/p/v8/issues/detail?id=2070) |
| 16869 | * for more details. |
| 16870 | * |
| 16871 | * @private |
| 16872 | * @param {Function} func The function to associate metadata with. |
| 16873 | * @param {*} data The metadata. |
| 16874 | * @returns {Function} Returns `func`. |
| 16875 | */ |
| 16876 | var setData = (function() { |
| 16877 | var count = 0, |
| 16878 | lastCalled = 0; |
| 16879 | |
| 16880 | return function(key, value) { |
| 16881 | var stamp = now(), |
| 16882 | remaining = HOT_SPAN - (stamp - lastCalled); |
| 16883 | |
| 16884 | lastCalled = stamp; |
| 16885 | if (remaining > 0) { |
| 16886 | if (++count >= HOT_COUNT) { |
| 16887 | return key; |
| 16888 | } |
| 16889 | } else { |
| 16890 | count = 0; |
| 16891 | } |
| 16892 | return baseSetData(key, value); |
| 16893 | }; |
| 16894 | }()); |
| 16895 | |
| 16896 | module.exports = setData; |
| 16897 | |
| 16898 | },{"../date/now":57,"./baseSetData":88}],134:[function(require,module,exports){ |
| 16899 | var isArguments = require('../lang/isArguments'), |
| 16900 | isArray = require('../lang/isArray'), |
| 16901 | isIndex = require('./isIndex'), |
| 16902 | isLength = require('./isLength'), |
| 16903 | isString = require('../lang/isString'), |
| 16904 | keysIn = require('../object/keysIn'); |
| 16905 | |
| 16906 | /** Used for native method references. */ |
| 16907 | var objectProto = Object.prototype; |
| 16908 | |
| 16909 | /** Used to check objects for own properties. */ |
| 16910 | var hasOwnProperty = objectProto.hasOwnProperty; |
| 16911 | |
| 16912 | /** |
| 16913 | * A fallback implementation of `Object.keys` which creates an array of the |
| 16914 | * own enumerable property names of `object`. |
| 16915 | * |
| 16916 | * @private |
| 16917 | * @param {Object} object The object to query. |
| 16918 | * @returns {Array} Returns the array of property names. |
| 16919 | */ |
| 16920 | function shimKeys(object) { |
| 16921 | var props = keysIn(object), |
| 16922 | propsLength = props.length, |
| 16923 | length = propsLength && object.length; |
| 16924 | |
| 16925 | var allowIndexes = !!length && isLength(length) && |
| 16926 | (isArray(object) || isArguments(object) || isString(object)); |
| 16927 | |
| 16928 | var index = -1, |
| 16929 | result = []; |
| 16930 | |
| 16931 | while (++index < propsLength) { |
| 16932 | var key = props[index]; |
| 16933 | if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) { |
| 16934 | result.push(key); |
| 16935 | } |
| 16936 | } |
| 16937 | return result; |
| 16938 | } |
| 16939 | |
| 16940 | module.exports = shimKeys; |
| 16941 | |
| 16942 | },{"../lang/isArguments":139,"../lang/isArray":140,"../lang/isString":146,"../object/keysIn":150,"./isIndex":121,"./isLength":125}],135:[function(require,module,exports){ |
| 16943 | var isObject = require('../lang/isObject'), |
| 16944 | isString = require('../lang/isString'), |
| 16945 | support = require('../support'); |
| 16946 | |
| 16947 | /** |
| 16948 | * Converts `value` to an object if it's not one. |
| 16949 | * |
| 16950 | * @private |
| 16951 | * @param {*} value The value to process. |
| 16952 | * @returns {Object} Returns the object. |
| 16953 | */ |
| 16954 | function toObject(value) { |
| 16955 | if (support.unindexedChars && isString(value)) { |
| 16956 | var index = -1, |
| 16957 | length = value.length, |
| 16958 | result = Object(value); |
| 16959 | |
| 16960 | while (++index < length) { |
| 16961 | result[index] = value.charAt(index); |
| 16962 | } |
| 16963 | return result; |
| 16964 | } |
| 16965 | return isObject(value) ? value : Object(value); |
| 16966 | } |
| 16967 | |
| 16968 | module.exports = toObject; |
| 16969 | |
| 16970 | },{"../lang/isObject":144,"../lang/isString":146,"../support":153}],136:[function(require,module,exports){ |
| 16971 | var baseToString = require('./baseToString'), |
| 16972 | isArray = require('../lang/isArray'); |
| 16973 | |
| 16974 | /** Used to match property names within property paths. */ |
| 16975 | var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g; |
| 16976 | |
| 16977 | /** Used to match backslashes in property paths. */ |
| 16978 | var reEscapeChar = /\\(\\)?/g; |
| 16979 | |
| 16980 | /** |
| 16981 | * Converts `value` to property path array if it's not one. |
| 16982 | * |
| 16983 | * @private |
| 16984 | * @param {*} value The value to process. |
| 16985 | * @returns {Array} Returns the property path array. |
| 16986 | */ |
| 16987 | function toPath(value) { |
| 16988 | if (isArray(value)) { |
| 16989 | return value; |
| 16990 | } |
| 16991 | var result = []; |
| 16992 | baseToString(value).replace(rePropName, function(match, number, quote, string) { |
| 16993 | result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); |
| 16994 | }); |
| 16995 | return result; |
| 16996 | } |
| 16997 | |
| 16998 | module.exports = toPath; |
| 16999 | |
| 17000 | },{"../lang/isArray":140,"./baseToString":90}],137:[function(require,module,exports){ |
| 17001 | var LazyWrapper = require('./LazyWrapper'), |
| 17002 | LodashWrapper = require('./LodashWrapper'), |
| 17003 | arrayCopy = require('./arrayCopy'); |
| 17004 | |
| 17005 | /** |
| 17006 | * Creates a clone of `wrapper`. |
| 17007 | * |
| 17008 | * @private |
| 17009 | * @param {Object} wrapper The wrapper to clone. |
| 17010 | * @returns {Object} Returns the cloned wrapper. |
| 17011 | */ |
| 17012 | function wrapperClone(wrapper) { |
| 17013 | return wrapper instanceof LazyWrapper |
| 17014 | ? wrapper.clone() |
| 17015 | : new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__, arrayCopy(wrapper.__actions__)); |
| 17016 | } |
| 17017 | |
| 17018 | module.exports = wrapperClone; |
| 17019 | |
| 17020 | },{"./LazyWrapper":60,"./LodashWrapper":61,"./arrayCopy":62}],138:[function(require,module,exports){ |
| 17021 | var baseClone = require('../internal/baseClone'), |
| 17022 | bindCallback = require('../internal/bindCallback'); |
| 17023 | |
| 17024 | /** |
| 17025 | * Creates a deep clone of `value`. If `customizer` is provided it's invoked |
| 17026 | * to produce the cloned values. If `customizer` returns `undefined` cloning |
| 17027 | * is handled by the method instead. The `customizer` is bound to `thisArg` |
| 17028 | * and invoked with up to three argument; (value [, index|key, object]). |
| 17029 | * |
| 17030 | * **Note:** This method is loosely based on the |
| 17031 | * [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm). |
| 17032 | * The enumerable properties of `arguments` objects and objects created by |
| 17033 | * constructors other than `Object` are cloned to plain `Object` objects. An |
| 17034 | * empty object is returned for uncloneable values such as functions, DOM nodes, |
| 17035 | * Maps, Sets, and WeakMaps. |
| 17036 | * |
| 17037 | * @static |
| 17038 | * @memberOf _ |
| 17039 | * @category Lang |
| 17040 | * @param {*} value The value to deep clone. |
| 17041 | * @param {Function} [customizer] The function to customize cloning values. |
| 17042 | * @param {*} [thisArg] The `this` binding of `customizer`. |
| 17043 | * @returns {*} Returns the deep cloned value. |
| 17044 | * @example |
| 17045 | * |
| 17046 | * var users = [ |
| 17047 | * { 'user': 'barney' }, |
| 17048 | * { 'user': 'fred' } |
| 17049 | * ]; |
| 17050 | * |
| 17051 | * var deep = _.cloneDeep(users); |
| 17052 | * deep[0] === users[0]; |
| 17053 | * // => false |
| 17054 | * |
| 17055 | * // using a customizer callback |
| 17056 | * var el = _.cloneDeep(document.body, function(value) { |
| 17057 | * if (_.isElement(value)) { |
| 17058 | * return value.cloneNode(true); |
| 17059 | * } |
| 17060 | * }); |
| 17061 | * |
| 17062 | * el === document.body |
| 17063 | * // => false |
| 17064 | * el.nodeName |
| 17065 | * // => BODY |
| 17066 | * el.childNodes.length; |
| 17067 | * // => 20 |
| 17068 | */ |
| 17069 | function cloneDeep(value, customizer, thisArg) { |
| 17070 | return typeof customizer == 'function' |
| 17071 | ? baseClone(value, true, bindCallback(customizer, thisArg, 3)) |
| 17072 | : baseClone(value, true); |
| 17073 | } |
| 17074 | |
| 17075 | module.exports = cloneDeep; |
| 17076 | |
| 17077 | },{"../internal/baseClone":68,"../internal/bindCallback":94}],139:[function(require,module,exports){ |
| 17078 | var isArrayLike = require('../internal/isArrayLike'), |
| 17079 | isObjectLike = require('../internal/isObjectLike'); |
| 17080 | |
| 17081 | /** Used for native method references. */ |
| 17082 | var objectProto = Object.prototype; |
| 17083 | |
| 17084 | /** Used to check objects for own properties. */ |
| 17085 | var hasOwnProperty = objectProto.hasOwnProperty; |
| 17086 | |
| 17087 | /** Native method references. */ |
| 17088 | var propertyIsEnumerable = objectProto.propertyIsEnumerable; |
| 17089 | |
| 17090 | /** |
| 17091 | * Checks if `value` is classified as an `arguments` object. |
| 17092 | * |
| 17093 | * @static |
| 17094 | * @memberOf _ |
| 17095 | * @category Lang |
| 17096 | * @param {*} value The value to check. |
| 17097 | * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. |
| 17098 | * @example |
| 17099 | * |
| 17100 | * _.isArguments(function() { return arguments; }()); |
| 17101 | * // => true |
| 17102 | * |
| 17103 | * _.isArguments([1, 2, 3]); |
| 17104 | * // => false |
| 17105 | */ |
| 17106 | function isArguments(value) { |
| 17107 | return isObjectLike(value) && isArrayLike(value) && |
| 17108 | hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee'); |
| 17109 | } |
| 17110 | |
| 17111 | module.exports = isArguments; |
| 17112 | |
| 17113 | },{"../internal/isArrayLike":119,"../internal/isObjectLike":126}],140:[function(require,module,exports){ |
| 17114 | var getNative = require('../internal/getNative'), |
| 17115 | isLength = require('../internal/isLength'), |
| 17116 | isObjectLike = require('../internal/isObjectLike'); |
| 17117 | |
| 17118 | /** `Object#toString` result references. */ |
| 17119 | var arrayTag = '[object Array]'; |
| 17120 | |
| 17121 | /** Used for native method references. */ |
| 17122 | var objectProto = Object.prototype; |
| 17123 | |
| 17124 | /** |
| 17125 | * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) |
| 17126 | * of values. |
| 17127 | */ |
| 17128 | var objToString = objectProto.toString; |
| 17129 | |
| 17130 | /* Native method references for those with the same name as other `lodash` methods. */ |
| 17131 | var nativeIsArray = getNative(Array, 'isArray'); |
| 17132 | |
| 17133 | /** |
| 17134 | * Checks if `value` is classified as an `Array` object. |
| 17135 | * |
| 17136 | * @static |
| 17137 | * @memberOf _ |
| 17138 | * @category Lang |
| 17139 | * @param {*} value The value to check. |
| 17140 | * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. |
| 17141 | * @example |
| 17142 | * |
| 17143 | * _.isArray([1, 2, 3]); |
| 17144 | * // => true |
| 17145 | * |
| 17146 | * _.isArray(function() { return arguments; }()); |
| 17147 | * // => false |
| 17148 | */ |
| 17149 | var isArray = nativeIsArray || function(value) { |
| 17150 | return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag; |
| 17151 | }; |
| 17152 | |
| 17153 | module.exports = isArray; |
| 17154 | |
| 17155 | },{"../internal/getNative":114,"../internal/isLength":125,"../internal/isObjectLike":126}],141:[function(require,module,exports){ |
| 17156 | var isArguments = require('./isArguments'), |
| 17157 | isArray = require('./isArray'), |
| 17158 | isArrayLike = require('../internal/isArrayLike'), |
| 17159 | isFunction = require('./isFunction'), |
| 17160 | isObjectLike = require('../internal/isObjectLike'), |
| 17161 | isString = require('./isString'), |
| 17162 | keys = require('../object/keys'); |
| 17163 | |
| 17164 | /** |
| 17165 | * Checks if `value` is empty. A value is considered empty unless it's an |
| 17166 | * `arguments` object, array, string, or jQuery-like collection with a length |
| 17167 | * greater than `0` or an object with own enumerable properties. |
| 17168 | * |
| 17169 | * @static |
| 17170 | * @memberOf _ |
| 17171 | * @category Lang |
| 17172 | * @param {Array|Object|string} value The value to inspect. |
| 17173 | * @returns {boolean} Returns `true` if `value` is empty, else `false`. |
| 17174 | * @example |
| 17175 | * |
| 17176 | * _.isEmpty(null); |
| 17177 | * // => true |
| 17178 | * |
| 17179 | * _.isEmpty(true); |
| 17180 | * // => true |
| 17181 | * |
| 17182 | * _.isEmpty(1); |
| 17183 | * // => true |
| 17184 | * |
| 17185 | * _.isEmpty([1, 2, 3]); |
| 17186 | * // => false |
| 17187 | * |
| 17188 | * _.isEmpty({ 'a': 1 }); |
| 17189 | * // => false |
| 17190 | */ |
| 17191 | function isEmpty(value) { |
| 17192 | if (value == null) { |
| 17193 | return true; |
| 17194 | } |
| 17195 | if (isArrayLike(value) && (isArray(value) || isString(value) || isArguments(value) || |
| 17196 | (isObjectLike(value) && isFunction(value.splice)))) { |
| 17197 | return !value.length; |
| 17198 | } |
| 17199 | return !keys(value).length; |
| 17200 | } |
| 17201 | |
| 17202 | module.exports = isEmpty; |
| 17203 | |
| 17204 | },{"../internal/isArrayLike":119,"../internal/isObjectLike":126,"../object/keys":149,"./isArguments":139,"./isArray":140,"./isFunction":142,"./isString":146}],142:[function(require,module,exports){ |
| 17205 | var isObject = require('./isObject'); |
| 17206 | |
| 17207 | /** `Object#toString` result references. */ |
| 17208 | var funcTag = '[object Function]'; |
| 17209 | |
| 17210 | /** Used for native method references. */ |
| 17211 | var objectProto = Object.prototype; |
| 17212 | |
| 17213 | /** |
| 17214 | * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) |
| 17215 | * of values. |
| 17216 | */ |
| 17217 | var objToString = objectProto.toString; |
| 17218 | |
| 17219 | /** |
| 17220 | * Checks if `value` is classified as a `Function` object. |
| 17221 | * |
| 17222 | * @static |
| 17223 | * @memberOf _ |
| 17224 | * @category Lang |
| 17225 | * @param {*} value The value to check. |
| 17226 | * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. |
| 17227 | * @example |
| 17228 | * |
| 17229 | * _.isFunction(_); |
| 17230 | * // => true |
| 17231 | * |
| 17232 | * _.isFunction(/abc/); |
| 17233 | * // => false |
| 17234 | */ |
| 17235 | function isFunction(value) { |
| 17236 | // The use of `Object#toString` avoids issues with the `typeof` operator |
| 17237 | // in older versions of Chrome and Safari which return 'function' for regexes |
| 17238 | // and Safari 8 which returns 'object' for typed array constructors. |
| 17239 | return isObject(value) && objToString.call(value) == funcTag; |
| 17240 | } |
| 17241 | |
| 17242 | module.exports = isFunction; |
| 17243 | |
| 17244 | },{"./isObject":144}],143:[function(require,module,exports){ |
| 17245 | var isFunction = require('./isFunction'), |
| 17246 | isHostObject = require('../internal/isHostObject'), |
| 17247 | isObjectLike = require('../internal/isObjectLike'); |
| 17248 | |
| 17249 | /** Used to detect host constructors (Safari > 5). */ |
| 17250 | var reIsHostCtor = /^\[object .+?Constructor\]$/; |
| 17251 | |
| 17252 | /** Used for native method references. */ |
| 17253 | var objectProto = Object.prototype; |
| 17254 | |
| 17255 | /** Used to resolve the decompiled source of functions. */ |
| 17256 | var fnToString = Function.prototype.toString; |
| 17257 | |
| 17258 | /** Used to check objects for own properties. */ |
| 17259 | var hasOwnProperty = objectProto.hasOwnProperty; |
| 17260 | |
| 17261 | /** Used to detect if a method is native. */ |
| 17262 | var reIsNative = RegExp('^' + |
| 17263 | fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') |
| 17264 | .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' |
| 17265 | ); |
| 17266 | |
| 17267 | /** |
| 17268 | * Checks if `value` is a native function. |
| 17269 | * |
| 17270 | * @static |
| 17271 | * @memberOf _ |
| 17272 | * @category Lang |
| 17273 | * @param {*} value The value to check. |
| 17274 | * @returns {boolean} Returns `true` if `value` is a native function, else `false`. |
| 17275 | * @example |
| 17276 | * |
| 17277 | * _.isNative(Array.prototype.push); |
| 17278 | * // => true |
| 17279 | * |
| 17280 | * _.isNative(_); |
| 17281 | * // => false |
| 17282 | */ |
| 17283 | function isNative(value) { |
| 17284 | if (value == null) { |
| 17285 | return false; |
| 17286 | } |
| 17287 | if (isFunction(value)) { |
| 17288 | return reIsNative.test(fnToString.call(value)); |
| 17289 | } |
| 17290 | return isObjectLike(value) && (isHostObject(value) ? reIsNative : reIsHostCtor).test(value); |
| 17291 | } |
| 17292 | |
| 17293 | module.exports = isNative; |
| 17294 | |
| 17295 | },{"../internal/isHostObject":120,"../internal/isObjectLike":126,"./isFunction":142}],144:[function(require,module,exports){ |
| 17296 | /** |
| 17297 | * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. |
| 17298 | * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) |
| 17299 | * |
| 17300 | * @static |
| 17301 | * @memberOf _ |
| 17302 | * @category Lang |
| 17303 | * @param {*} value The value to check. |
| 17304 | * @returns {boolean} Returns `true` if `value` is an object, else `false`. |
| 17305 | * @example |
| 17306 | * |
| 17307 | * _.isObject({}); |
| 17308 | * // => true |
| 17309 | * |
| 17310 | * _.isObject([1, 2, 3]); |
| 17311 | * // => true |
| 17312 | * |
| 17313 | * _.isObject(1); |
| 17314 | * // => false |
| 17315 | */ |
| 17316 | function isObject(value) { |
| 17317 | // Avoid a V8 JIT bug in Chrome 19-20. |
| 17318 | // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. |
| 17319 | var type = typeof value; |
| 17320 | return !!value && (type == 'object' || type == 'function'); |
| 17321 | } |
| 17322 | |
| 17323 | module.exports = isObject; |
| 17324 | |
| 17325 | },{}],145:[function(require,module,exports){ |
| 17326 | var baseForIn = require('../internal/baseForIn'), |
| 17327 | isArguments = require('./isArguments'), |
| 17328 | isHostObject = require('../internal/isHostObject'), |
| 17329 | isObjectLike = require('../internal/isObjectLike'), |
| 17330 | support = require('../support'); |
| 17331 | |
| 17332 | /** `Object#toString` result references. */ |
| 17333 | var objectTag = '[object Object]'; |
| 17334 | |
| 17335 | /** Used for native method references. */ |
| 17336 | var objectProto = Object.prototype; |
| 17337 | |
| 17338 | /** Used to check objects for own properties. */ |
| 17339 | var hasOwnProperty = objectProto.hasOwnProperty; |
| 17340 | |
| 17341 | /** |
| 17342 | * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) |
| 17343 | * of values. |
| 17344 | */ |
| 17345 | var objToString = objectProto.toString; |
| 17346 | |
| 17347 | /** |
| 17348 | * Checks if `value` is a plain object, that is, an object created by the |
| 17349 | * `Object` constructor or one with a `[[Prototype]]` of `null`. |
| 17350 | * |
| 17351 | * **Note:** This method assumes objects created by the `Object` constructor |
| 17352 | * have no inherited enumerable properties. |
| 17353 | * |
| 17354 | * @static |
| 17355 | * @memberOf _ |
| 17356 | * @category Lang |
| 17357 | * @param {*} value The value to check. |
| 17358 | * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. |
| 17359 | * @example |
| 17360 | * |
| 17361 | * function Foo() { |
| 17362 | * this.a = 1; |
| 17363 | * } |
| 17364 | * |
| 17365 | * _.isPlainObject(new Foo); |
| 17366 | * // => false |
| 17367 | * |
| 17368 | * _.isPlainObject([1, 2, 3]); |
| 17369 | * // => false |
| 17370 | * |
| 17371 | * _.isPlainObject({ 'x': 0, 'y': 0 }); |
| 17372 | * // => true |
| 17373 | * |
| 17374 | * _.isPlainObject(Object.create(null)); |
| 17375 | * // => true |
| 17376 | */ |
| 17377 | function isPlainObject(value) { |
| 17378 | var Ctor; |
| 17379 | |
| 17380 | // Exit early for non `Object` objects. |
| 17381 | if (!(isObjectLike(value) && objToString.call(value) == objectTag && !isHostObject(value) && !isArguments(value)) || |
| 17382 | (!hasOwnProperty.call(value, 'constructor') && (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) { |
| 17383 | return false; |
| 17384 | } |
| 17385 | // IE < 9 iterates inherited properties before own properties. If the first |
| 17386 | // iterated property is an object's own property then there are no inherited |
| 17387 | // enumerable properties. |
| 17388 | var result; |
| 17389 | if (support.ownLast) { |
| 17390 | baseForIn(value, function(subValue, key, object) { |
| 17391 | result = hasOwnProperty.call(object, key); |
| 17392 | return false; |
| 17393 | }); |
| 17394 | return result !== false; |
| 17395 | } |
| 17396 | // In most environments an object's own properties are iterated before |
| 17397 | // its inherited properties. If the last iterated property is an object's |
| 17398 | // own property then there are no inherited enumerable properties. |
| 17399 | baseForIn(value, function(subValue, key) { |
| 17400 | result = key; |
| 17401 | }); |
| 17402 | return result === undefined || hasOwnProperty.call(value, result); |
| 17403 | } |
| 17404 | |
| 17405 | module.exports = isPlainObject; |
| 17406 | |
| 17407 | },{"../internal/baseForIn":75,"../internal/isHostObject":120,"../internal/isObjectLike":126,"../support":153,"./isArguments":139}],146:[function(require,module,exports){ |
| 17408 | var isObjectLike = require('../internal/isObjectLike'); |
| 17409 | |
| 17410 | /** `Object#toString` result references. */ |
| 17411 | var stringTag = '[object String]'; |
| 17412 | |
| 17413 | /** Used for native method references. */ |
| 17414 | var objectProto = Object.prototype; |
| 17415 | |
| 17416 | /** |
| 17417 | * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) |
| 17418 | * of values. |
| 17419 | */ |
| 17420 | var objToString = objectProto.toString; |
| 17421 | |
| 17422 | /** |
| 17423 | * Checks if `value` is classified as a `String` primitive or object. |
| 17424 | * |
| 17425 | * @static |
| 17426 | * @memberOf _ |
| 17427 | * @category Lang |
| 17428 | * @param {*} value The value to check. |
| 17429 | * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. |
| 17430 | * @example |
| 17431 | * |
| 17432 | * _.isString('abc'); |
| 17433 | * // => true |
| 17434 | * |
| 17435 | * _.isString(1); |
| 17436 | * // => false |
| 17437 | */ |
| 17438 | function isString(value) { |
| 17439 | return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag); |
| 17440 | } |
| 17441 | |
| 17442 | module.exports = isString; |
| 17443 | |
| 17444 | },{"../internal/isObjectLike":126}],147:[function(require,module,exports){ |
| 17445 | var isLength = require('../internal/isLength'), |
| 17446 | isObjectLike = require('../internal/isObjectLike'); |
| 17447 | |
| 17448 | /** `Object#toString` result references. */ |
| 17449 | var argsTag = '[object Arguments]', |
| 17450 | arrayTag = '[object Array]', |
| 17451 | boolTag = '[object Boolean]', |
| 17452 | dateTag = '[object Date]', |
| 17453 | errorTag = '[object Error]', |
| 17454 | funcTag = '[object Function]', |
| 17455 | mapTag = '[object Map]', |
| 17456 | numberTag = '[object Number]', |
| 17457 | objectTag = '[object Object]', |
| 17458 | regexpTag = '[object RegExp]', |
| 17459 | setTag = '[object Set]', |
| 17460 | stringTag = '[object String]', |
| 17461 | weakMapTag = '[object WeakMap]'; |
| 17462 | |
| 17463 | var arrayBufferTag = '[object ArrayBuffer]', |
| 17464 | float32Tag = '[object Float32Array]', |
| 17465 | float64Tag = '[object Float64Array]', |
| 17466 | int8Tag = '[object Int8Array]', |
| 17467 | int16Tag = '[object Int16Array]', |
| 17468 | int32Tag = '[object Int32Array]', |
| 17469 | uint8Tag = '[object Uint8Array]', |
| 17470 | uint8ClampedTag = '[object Uint8ClampedArray]', |
| 17471 | uint16Tag = '[object Uint16Array]', |
| 17472 | uint32Tag = '[object Uint32Array]'; |
| 17473 | |
| 17474 | /** Used to identify `toStringTag` values of typed arrays. */ |
| 17475 | var typedArrayTags = {}; |
| 17476 | typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = |
| 17477 | typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = |
| 17478 | typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = |
| 17479 | typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = |
| 17480 | typedArrayTags[uint32Tag] = true; |
| 17481 | typedArrayTags[argsTag] = typedArrayTags[arrayTag] = |
| 17482 | typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = |
| 17483 | typedArrayTags[dateTag] = typedArrayTags[errorTag] = |
| 17484 | typedArrayTags[funcTag] = typedArrayTags[mapTag] = |
| 17485 | typedArrayTags[numberTag] = typedArrayTags[objectTag] = |
| 17486 | typedArrayTags[regexpTag] = typedArrayTags[setTag] = |
| 17487 | typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; |
| 17488 | |
| 17489 | /** Used for native method references. */ |
| 17490 | var objectProto = Object.prototype; |
| 17491 | |
| 17492 | /** |
| 17493 | * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) |
| 17494 | * of values. |
| 17495 | */ |
| 17496 | var objToString = objectProto.toString; |
| 17497 | |
| 17498 | /** |
| 17499 | * Checks if `value` is classified as a typed array. |
| 17500 | * |
| 17501 | * @static |
| 17502 | * @memberOf _ |
| 17503 | * @category Lang |
| 17504 | * @param {*} value The value to check. |
| 17505 | * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. |
| 17506 | * @example |
| 17507 | * |
| 17508 | * _.isTypedArray(new Uint8Array); |
| 17509 | * // => true |
| 17510 | * |
| 17511 | * _.isTypedArray([]); |
| 17512 | * // => false |
| 17513 | */ |
| 17514 | function isTypedArray(value) { |
| 17515 | return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)]; |
| 17516 | } |
| 17517 | |
| 17518 | module.exports = isTypedArray; |
| 17519 | |
| 17520 | },{"../internal/isLength":125,"../internal/isObjectLike":126}],148:[function(require,module,exports){ |
| 17521 | /** |
| 17522 | * Checks if `value` is `undefined`. |
| 17523 | * |
| 17524 | * @static |
| 17525 | * @memberOf _ |
| 17526 | * @category Lang |
| 17527 | * @param {*} value The value to check. |
| 17528 | * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. |
| 17529 | * @example |
| 17530 | * |
| 17531 | * _.isUndefined(void 0); |
| 17532 | * // => true |
| 17533 | * |
| 17534 | * _.isUndefined(null); |
| 17535 | * // => false |
| 17536 | */ |
| 17537 | function isUndefined(value) { |
| 17538 | return value === undefined; |
| 17539 | } |
| 17540 | |
| 17541 | module.exports = isUndefined; |
| 17542 | |
| 17543 | },{}],149:[function(require,module,exports){ |
| 17544 | var getNative = require('../internal/getNative'), |
| 17545 | isArrayLike = require('../internal/isArrayLike'), |
| 17546 | isObject = require('../lang/isObject'), |
| 17547 | shimKeys = require('../internal/shimKeys'), |
| 17548 | support = require('../support'); |
| 17549 | |
| 17550 | /* Native method references for those with the same name as other `lodash` methods. */ |
| 17551 | var nativeKeys = getNative(Object, 'keys'); |
| 17552 | |
| 17553 | /** |
| 17554 | * Creates an array of the own enumerable property names of `object`. |
| 17555 | * |
| 17556 | * **Note:** Non-object values are coerced to objects. See the |
| 17557 | * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) |
| 17558 | * for more details. |
| 17559 | * |
| 17560 | * @static |
| 17561 | * @memberOf _ |
| 17562 | * @category Object |
| 17563 | * @param {Object} object The object to query. |
| 17564 | * @returns {Array} Returns the array of property names. |
| 17565 | * @example |
| 17566 | * |
| 17567 | * function Foo() { |
| 17568 | * this.a = 1; |
| 17569 | * this.b = 2; |
| 17570 | * } |
| 17571 | * |
| 17572 | * Foo.prototype.c = 3; |
| 17573 | * |
| 17574 | * _.keys(new Foo); |
| 17575 | * // => ['a', 'b'] (iteration order is not guaranteed) |
| 17576 | * |
| 17577 | * _.keys('hi'); |
| 17578 | * // => ['0', '1'] |
| 17579 | */ |
| 17580 | var keys = !nativeKeys ? shimKeys : function(object) { |
| 17581 | var Ctor = object == null ? undefined : object.constructor; |
| 17582 | if ((typeof Ctor == 'function' && Ctor.prototype === object) || |
| 17583 | (typeof object == 'function' ? support.enumPrototypes : isArrayLike(object))) { |
| 17584 | return shimKeys(object); |
| 17585 | } |
| 17586 | return isObject(object) ? nativeKeys(object) : []; |
| 17587 | }; |
| 17588 | |
| 17589 | module.exports = keys; |
| 17590 | |
| 17591 | },{"../internal/getNative":114,"../internal/isArrayLike":119,"../internal/shimKeys":134,"../lang/isObject":144,"../support":153}],150:[function(require,module,exports){ |
| 17592 | var arrayEach = require('../internal/arrayEach'), |
| 17593 | isArguments = require('../lang/isArguments'), |
| 17594 | isArray = require('../lang/isArray'), |
| 17595 | isFunction = require('../lang/isFunction'), |
| 17596 | isIndex = require('../internal/isIndex'), |
| 17597 | isLength = require('../internal/isLength'), |
| 17598 | isObject = require('../lang/isObject'), |
| 17599 | isString = require('../lang/isString'), |
| 17600 | support = require('../support'); |
| 17601 | |
| 17602 | /** `Object#toString` result references. */ |
| 17603 | var arrayTag = '[object Array]', |
| 17604 | boolTag = '[object Boolean]', |
| 17605 | dateTag = '[object Date]', |
| 17606 | errorTag = '[object Error]', |
| 17607 | funcTag = '[object Function]', |
| 17608 | numberTag = '[object Number]', |
| 17609 | objectTag = '[object Object]', |
| 17610 | regexpTag = '[object RegExp]', |
| 17611 | stringTag = '[object String]'; |
| 17612 | |
| 17613 | /** Used to fix the JScript `[[DontEnum]]` bug. */ |
| 17614 | var shadowProps = [ |
| 17615 | 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', |
| 17616 | 'toLocaleString', 'toString', 'valueOf' |
| 17617 | ]; |
| 17618 | |
| 17619 | /** Used for native method references. */ |
| 17620 | var errorProto = Error.prototype, |
| 17621 | objectProto = Object.prototype, |
| 17622 | stringProto = String.prototype; |
| 17623 | |
| 17624 | /** Used to check objects for own properties. */ |
| 17625 | var hasOwnProperty = objectProto.hasOwnProperty; |
| 17626 | |
| 17627 | /** |
| 17628 | * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) |
| 17629 | * of values. |
| 17630 | */ |
| 17631 | var objToString = objectProto.toString; |
| 17632 | |
| 17633 | /** Used to avoid iterating over non-enumerable properties in IE < 9. */ |
| 17634 | var nonEnumProps = {}; |
| 17635 | nonEnumProps[arrayTag] = nonEnumProps[dateTag] = nonEnumProps[numberTag] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true }; |
| 17636 | nonEnumProps[boolTag] = nonEnumProps[stringTag] = { 'constructor': true, 'toString': true, 'valueOf': true }; |
| 17637 | nonEnumProps[errorTag] = nonEnumProps[funcTag] = nonEnumProps[regexpTag] = { 'constructor': true, 'toString': true }; |
| 17638 | nonEnumProps[objectTag] = { 'constructor': true }; |
| 17639 | |
| 17640 | arrayEach(shadowProps, function(key) { |
| 17641 | for (var tag in nonEnumProps) { |
| 17642 | if (hasOwnProperty.call(nonEnumProps, tag)) { |
| 17643 | var props = nonEnumProps[tag]; |
| 17644 | props[key] = hasOwnProperty.call(props, key); |
| 17645 | } |
| 17646 | } |
| 17647 | }); |
| 17648 | |
| 17649 | /** |
| 17650 | * Creates an array of the own and inherited enumerable property names of `object`. |
| 17651 | * |
| 17652 | * **Note:** Non-object values are coerced to objects. |
| 17653 | * |
| 17654 | * @static |
| 17655 | * @memberOf _ |
| 17656 | * @category Object |
| 17657 | * @param {Object} object The object to query. |
| 17658 | * @returns {Array} Returns the array of property names. |
| 17659 | * @example |
| 17660 | * |
| 17661 | * function Foo() { |
| 17662 | * this.a = 1; |
| 17663 | * this.b = 2; |
| 17664 | * } |
| 17665 | * |
| 17666 | * Foo.prototype.c = 3; |
| 17667 | * |
| 17668 | * _.keysIn(new Foo); |
| 17669 | * // => ['a', 'b', 'c'] (iteration order is not guaranteed) |
| 17670 | */ |
| 17671 | function keysIn(object) { |
| 17672 | if (object == null) { |
| 17673 | return []; |
| 17674 | } |
| 17675 | if (!isObject(object)) { |
| 17676 | object = Object(object); |
| 17677 | } |
| 17678 | var length = object.length; |
| 17679 | |
| 17680 | length = (length && isLength(length) && |
| 17681 | (isArray(object) || isArguments(object) || isString(object)) && length) || 0; |
| 17682 | |
| 17683 | var Ctor = object.constructor, |
| 17684 | index = -1, |
| 17685 | proto = (isFunction(Ctor) && Ctor.prototype) || objectProto, |
| 17686 | isProto = proto === object, |
| 17687 | result = Array(length), |
| 17688 | skipIndexes = length > 0, |
| 17689 | skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error), |
| 17690 | skipProto = support.enumPrototypes && isFunction(object); |
| 17691 | |
| 17692 | while (++index < length) { |
| 17693 | result[index] = (index + ''); |
| 17694 | } |
| 17695 | // lodash skips the `constructor` property when it infers it's iterating |
| 17696 | // over a `prototype` object because IE < 9 can't set the `[[Enumerable]]` |
| 17697 | // attribute of an existing property and the `constructor` property of a |
| 17698 | // prototype defaults to non-enumerable. |
| 17699 | for (var key in object) { |
| 17700 | if (!(skipProto && key == 'prototype') && |
| 17701 | !(skipErrorProps && (key == 'message' || key == 'name')) && |
| 17702 | !(skipIndexes && isIndex(key, length)) && |
| 17703 | !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { |
| 17704 | result.push(key); |
| 17705 | } |
| 17706 | } |
| 17707 | if (support.nonEnumShadows && object !== objectProto) { |
| 17708 | var tag = object === stringProto ? stringTag : (object === errorProto ? errorTag : objToString.call(object)), |
| 17709 | nonEnums = nonEnumProps[tag] || nonEnumProps[objectTag]; |
| 17710 | |
| 17711 | if (tag == objectTag) { |
| 17712 | proto = objectProto; |
| 17713 | } |
| 17714 | length = shadowProps.length; |
| 17715 | while (length--) { |
| 17716 | key = shadowProps[length]; |
| 17717 | var nonEnum = nonEnums[key]; |
| 17718 | if (!(isProto && nonEnum) && |
| 17719 | (nonEnum ? hasOwnProperty.call(object, key) : object[key] !== proto[key])) { |
| 17720 | result.push(key); |
| 17721 | } |
| 17722 | } |
| 17723 | } |
| 17724 | return result; |
| 17725 | } |
| 17726 | |
| 17727 | module.exports = keysIn; |
| 17728 | |
| 17729 | },{"../internal/arrayEach":63,"../internal/isIndex":121,"../internal/isLength":125,"../lang/isArguments":139,"../lang/isArray":140,"../lang/isFunction":142,"../lang/isObject":144,"../lang/isString":146,"../support":153}],151:[function(require,module,exports){ |
| 17730 | var keys = require('./keys'), |
| 17731 | toObject = require('../internal/toObject'); |
| 17732 | |
| 17733 | /** |
| 17734 | * Creates a two dimensional array of the key-value pairs for `object`, |
| 17735 | * e.g. `[[key1, value1], [key2, value2]]`. |
| 17736 | * |
| 17737 | * @static |
| 17738 | * @memberOf _ |
| 17739 | * @category Object |
| 17740 | * @param {Object} object The object to query. |
| 17741 | * @returns {Array} Returns the new array of key-value pairs. |
| 17742 | * @example |
| 17743 | * |
| 17744 | * _.pairs({ 'barney': 36, 'fred': 40 }); |
| 17745 | * // => [['barney', 36], ['fred', 40]] (iteration order is not guaranteed) |
| 17746 | */ |
| 17747 | function pairs(object) { |
| 17748 | object = toObject(object); |
| 17749 | |
| 17750 | var index = -1, |
| 17751 | props = keys(object), |
| 17752 | length = props.length, |
| 17753 | result = Array(length); |
| 17754 | |
| 17755 | while (++index < length) { |
| 17756 | var key = props[index]; |
| 17757 | result[index] = [key, object[key]]; |
| 17758 | } |
| 17759 | return result; |
| 17760 | } |
| 17761 | |
| 17762 | module.exports = pairs; |
| 17763 | |
| 17764 | },{"../internal/toObject":135,"./keys":149}],152:[function(require,module,exports){ |
| 17765 | var baseValues = require('../internal/baseValues'), |
| 17766 | keys = require('./keys'); |
| 17767 | |
| 17768 | /** |
| 17769 | * Creates an array of the own enumerable property values of `object`. |
| 17770 | * |
| 17771 | * **Note:** Non-object values are coerced to objects. |
| 17772 | * |
| 17773 | * @static |
| 17774 | * @memberOf _ |
| 17775 | * @category Object |
| 17776 | * @param {Object} object The object to query. |
| 17777 | * @returns {Array} Returns the array of property values. |
| 17778 | * @example |
| 17779 | * |
| 17780 | * function Foo() { |
| 17781 | * this.a = 1; |
| 17782 | * this.b = 2; |
| 17783 | * } |
| 17784 | * |
| 17785 | * Foo.prototype.c = 3; |
| 17786 | * |
| 17787 | * _.values(new Foo); |
| 17788 | * // => [1, 2] (iteration order is not guaranteed) |
| 17789 | * |
| 17790 | * _.values('hi'); |
| 17791 | * // => ['h', 'i'] |
| 17792 | */ |
| 17793 | function values(object) { |
| 17794 | return baseValues(object, keys(object)); |
| 17795 | } |
| 17796 | |
| 17797 | module.exports = values; |
| 17798 | |
| 17799 | },{"../internal/baseValues":91,"./keys":149}],153:[function(require,module,exports){ |
| 17800 | /** Used for native method references. */ |
| 17801 | var arrayProto = Array.prototype, |
| 17802 | errorProto = Error.prototype, |
| 17803 | objectProto = Object.prototype; |
| 17804 | |
| 17805 | /** Native method references. */ |
| 17806 | var propertyIsEnumerable = objectProto.propertyIsEnumerable, |
| 17807 | splice = arrayProto.splice; |
| 17808 | |
| 17809 | /** |
| 17810 | * An object environment feature flags. |
| 17811 | * |
| 17812 | * @static |
| 17813 | * @memberOf _ |
| 17814 | * @type Object |
| 17815 | */ |
| 17816 | var support = {}; |
| 17817 | |
| 17818 | (function(x) { |
| 17819 | var Ctor = function() { this.x = x; }, |
| 17820 | object = { '0': x, 'length': x }, |
| 17821 | props = []; |
| 17822 | |
| 17823 | Ctor.prototype = { 'valueOf': x, 'y': x }; |
| 17824 | for (var key in new Ctor) { props.push(key); } |
| 17825 | |
| 17826 | /** |
| 17827 | * Detect if `name` or `message` properties of `Error.prototype` are |
| 17828 | * enumerable by default (IE < 9, Safari < 5.1). |
| 17829 | * |
| 17830 | * @memberOf _.support |
| 17831 | * @type boolean |
| 17832 | */ |
| 17833 | support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || |
| 17834 | propertyIsEnumerable.call(errorProto, 'name'); |
| 17835 | |
| 17836 | /** |
| 17837 | * Detect if `prototype` properties are enumerable by default. |
| 17838 | * |
| 17839 | * Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1 |
| 17840 | * (if the prototype or a property on the prototype has been set) |
| 17841 | * incorrectly set the `[[Enumerable]]` value of a function's `prototype` |
| 17842 | * property to `true`. |
| 17843 | * |
| 17844 | * @memberOf _.support |
| 17845 | * @type boolean |
| 17846 | */ |
| 17847 | support.enumPrototypes = propertyIsEnumerable.call(Ctor, 'prototype'); |
| 17848 | |
| 17849 | /** |
| 17850 | * Detect if properties shadowing those on `Object.prototype` are non-enumerable. |
| 17851 | * |
| 17852 | * In IE < 9 an object's own properties, shadowing non-enumerable ones, |
| 17853 | * are made non-enumerable as well (a.k.a the JScript `[[DontEnum]]` bug). |
| 17854 | * |
| 17855 | * @memberOf _.support |
| 17856 | * @type boolean |
| 17857 | */ |
| 17858 | support.nonEnumShadows = !/valueOf/.test(props); |
| 17859 | |
| 17860 | /** |
| 17861 | * Detect if own properties are iterated after inherited properties (IE < 9). |
| 17862 | * |
| 17863 | * @memberOf _.support |
| 17864 | * @type boolean |
| 17865 | */ |
| 17866 | support.ownLast = props[0] != 'x'; |
| 17867 | |
| 17868 | /** |
| 17869 | * Detect if `Array#shift` and `Array#splice` augment array-like objects |
| 17870 | * correctly. |
| 17871 | * |
| 17872 | * Firefox < 10, compatibility modes of IE 8, and IE < 9 have buggy Array |
| 17873 | * `shift()` and `splice()` functions that fail to remove the last element, |
| 17874 | * `value[0]`, of array-like objects even though the "length" property is |
| 17875 | * set to `0`. The `shift()` method is buggy in compatibility modes of IE 8, |
| 17876 | * while `splice()` is buggy regardless of mode in IE < 9. |
| 17877 | * |
| 17878 | * @memberOf _.support |
| 17879 | * @type boolean |
| 17880 | */ |
| 17881 | support.spliceObjects = (splice.call(object, 0, 1), !object[0]); |
| 17882 | |
| 17883 | /** |
| 17884 | * Detect lack of support for accessing string characters by index. |
| 17885 | * |
| 17886 | * IE < 8 can't access characters by index. IE 8 can only access characters |
| 17887 | * by index on string literals, not string objects. |
| 17888 | * |
| 17889 | * @memberOf _.support |
| 17890 | * @type boolean |
| 17891 | */ |
| 17892 | support.unindexedChars = ('x'[0] + Object('x')[0]) != 'xx'; |
| 17893 | }(1, 0)); |
| 17894 | |
| 17895 | module.exports = support; |
| 17896 | |
| 17897 | },{}],154:[function(require,module,exports){ |
| 17898 | /** |
| 17899 | * This method returns the first argument provided to it. |
| 17900 | * |
| 17901 | * @static |
| 17902 | * @memberOf _ |
| 17903 | * @category Utility |
| 17904 | * @param {*} value Any value. |
| 17905 | * @returns {*} Returns `value`. |
| 17906 | * @example |
| 17907 | * |
| 17908 | * var object = { 'user': 'fred' }; |
| 17909 | * |
| 17910 | * _.identity(object) === object; |
| 17911 | * // => true |
| 17912 | */ |
| 17913 | function identity(value) { |
| 17914 | return value; |
| 17915 | } |
| 17916 | |
| 17917 | module.exports = identity; |
| 17918 | |
| 17919 | },{}],155:[function(require,module,exports){ |
| 17920 | /** |
| 17921 | * A no-operation function that returns `undefined` regardless of the |
| 17922 | * arguments it receives. |
| 17923 | * |
| 17924 | * @static |
| 17925 | * @memberOf _ |
| 17926 | * @category Utility |
| 17927 | * @example |
| 17928 | * |
| 17929 | * var object = { 'user': 'fred' }; |
| 17930 | * |
| 17931 | * _.noop(object) === undefined; |
| 17932 | * // => true |
| 17933 | */ |
| 17934 | function noop() { |
| 17935 | // No operation performed. |
| 17936 | } |
| 17937 | |
| 17938 | module.exports = noop; |
| 17939 | |
| 17940 | },{}],156:[function(require,module,exports){ |
| 17941 | var baseProperty = require('../internal/baseProperty'), |
| 17942 | basePropertyDeep = require('../internal/basePropertyDeep'), |
| 17943 | isKey = require('../internal/isKey'); |
| 17944 | |
| 17945 | /** |
| 17946 | * Creates a function that returns the property value at `path` on a |
| 17947 | * given object. |
| 17948 | * |
| 17949 | * @static |
| 17950 | * @memberOf _ |
| 17951 | * @category Utility |
| 17952 | * @param {Array|string} path The path of the property to get. |
| 17953 | * @returns {Function} Returns the new function. |
| 17954 | * @example |
| 17955 | * |
| 17956 | * var objects = [ |
| 17957 | * { 'a': { 'b': { 'c': 2 } } }, |
| 17958 | * { 'a': { 'b': { 'c': 1 } } } |
| 17959 | * ]; |
| 17960 | * |
| 17961 | * _.map(objects, _.property('a.b.c')); |
| 17962 | * // => [2, 1] |
| 17963 | * |
| 17964 | * _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); |
| 17965 | * // => [1, 2] |
| 17966 | */ |
| 17967 | function property(path) { |
| 17968 | return isKey(path) ? baseProperty(path) : basePropertyDeep(path); |
| 17969 | } |
| 17970 | |
| 17971 | module.exports = property; |
| 17972 | |
| 17973 | },{"../internal/baseProperty":86,"../internal/basePropertyDeep":87,"../internal/isKey":123}],157:[function(require,module,exports){ |
| 17974 | (function (process){ |
| 17975 | // vim:ts=4:sts=4:sw=4: |
| 17976 | /*! |
| 17977 | * |
| 17978 | * Copyright 2009-2012 Kris Kowal under the terms of the MIT |
| 17979 | * license found at http://github.com/kriskowal/q/raw/master/LICENSE |
| 17980 | * |
| 17981 | * With parts by Tyler Close |
| 17982 | * Copyright 2007-2009 Tyler Close under the terms of the MIT X license found |
| 17983 | * at http://www.opensource.org/licenses/mit-license.html |
| 17984 | * Forked at ref_send.js version: 2009-05-11 |
| 17985 | * |
| 17986 | * With parts by Mark Miller |
| 17987 | * Copyright (C) 2011 Google Inc. |
| 17988 | * |
| 17989 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 17990 | * you may not use this file except in compliance with the License. |
| 17991 | * You may obtain a copy of the License at |
| 17992 | * |
| 17993 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 17994 | * |
| 17995 | * Unless required by applicable law or agreed to in writing, software |
| 17996 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 17997 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 17998 | * See the License for the specific language governing permissions and |
| 17999 | * limitations under the License. |
| 18000 | * |
| 18001 | */ |
| 18002 | |
| 18003 | (function (definition) { |
| 18004 | "use strict"; |
| 18005 | |
| 18006 | // This file will function properly as a <script> tag, or a module |
| 18007 | // using CommonJS and NodeJS or RequireJS module formats. In |
| 18008 | // Common/Node/RequireJS, the module exports the Q API and when |
| 18009 | // executed as a simple <script>, it creates a Q global instead. |
| 18010 | |
| 18011 | // Montage Require |
| 18012 | if (typeof bootstrap === "function") { |
| 18013 | bootstrap("promise", definition); |
| 18014 | |
| 18015 | // CommonJS |
| 18016 | } else if (typeof exports === "object" && typeof module === "object") { |
| 18017 | module.exports = definition(); |
| 18018 | |
| 18019 | // RequireJS |
| 18020 | } else if (typeof define === "function" && define.amd) { |
| 18021 | define(definition); |
| 18022 | |
| 18023 | // SES (Secure EcmaScript) |
| 18024 | } else if (typeof ses !== "undefined") { |
| 18025 | if (!ses.ok()) { |
| 18026 | return; |
| 18027 | } else { |
| 18028 | ses.makeQ = definition; |
| 18029 | } |
| 18030 | |
| 18031 | // <script> |
| 18032 | } else if (typeof window !== "undefined" || typeof self !== "undefined") { |
| 18033 | // Prefer window over self for add-on scripts. Use self for |
| 18034 | // non-windowed contexts. |
| 18035 | var global = typeof window !== "undefined" ? window : self; |
| 18036 | |
| 18037 | // Get the `window` object, save the previous Q global |
| 18038 | // and initialize Q as a global. |
| 18039 | var previousQ = global.Q; |
| 18040 | global.Q = definition(); |
| 18041 | |
| 18042 | // Add a noConflict function so Q can be removed from the |
| 18043 | // global namespace. |
| 18044 | global.Q.noConflict = function () { |
| 18045 | global.Q = previousQ; |
| 18046 | return this; |
| 18047 | }; |
| 18048 | |
| 18049 | } else { |
| 18050 | throw new Error("This environment was not anticipated by Q. Please file a bug."); |
| 18051 | } |
| 18052 | |
| 18053 | })(function () { |
| 18054 | "use strict"; |
| 18055 | |
| 18056 | var hasStacks = false; |
| 18057 | try { |
| 18058 | throw new Error(); |
| 18059 | } catch (e) { |
| 18060 | hasStacks = !!e.stack; |
| 18061 | } |
| 18062 | |
| 18063 | // All code after this point will be filtered from stack traces reported |
| 18064 | // by Q. |
| 18065 | var qStartingLine = captureLine(); |
| 18066 | var qFileName; |
| 18067 | |
| 18068 | // shims |
| 18069 | |
| 18070 | // used for fallback in "allResolved" |
| 18071 | var noop = function () {}; |
| 18072 | |
| 18073 | // Use the fastest possible means to execute a task in a future turn |
| 18074 | // of the event loop. |
| 18075 | var nextTick =(function () { |
| 18076 | // linked list of tasks (single, with head node) |
| 18077 | var head = {task: void 0, next: null}; |
| 18078 | var tail = head; |
| 18079 | var flushing = false; |
| 18080 | var requestTick = void 0; |
| 18081 | var isNodeJS = false; |
| 18082 | // queue for late tasks, used by unhandled rejection tracking |
| 18083 | var laterQueue = []; |
| 18084 | |
| 18085 | function flush() { |
| 18086 | /* jshint loopfunc: true */ |
| 18087 | var task, domain; |
| 18088 | |
| 18089 | while (head.next) { |
| 18090 | head = head.next; |
| 18091 | task = head.task; |
| 18092 | head.task = void 0; |
| 18093 | domain = head.domain; |
| 18094 | |
| 18095 | if (domain) { |
| 18096 | head.domain = void 0; |
| 18097 | domain.enter(); |
| 18098 | } |
| 18099 | runSingle(task, domain); |
| 18100 | |
| 18101 | } |
| 18102 | while (laterQueue.length) { |
| 18103 | task = laterQueue.pop(); |
| 18104 | runSingle(task); |
| 18105 | } |
| 18106 | flushing = false; |
| 18107 | } |
| 18108 | // runs a single function in the async queue |
| 18109 | function runSingle(task, domain) { |
| 18110 | try { |
| 18111 | task(); |
| 18112 | |
| 18113 | } catch (e) { |
| 18114 | if (isNodeJS) { |
| 18115 | // In node, uncaught exceptions are considered fatal errors. |
| 18116 | // Re-throw them synchronously to interrupt flushing! |
| 18117 | |
| 18118 | // Ensure continuation if the uncaught exception is suppressed |
| 18119 | // listening "uncaughtException" events (as domains does). |
| 18120 | // Continue in next event to avoid tick recursion. |
| 18121 | if (domain) { |
| 18122 | domain.exit(); |
| 18123 | } |
| 18124 | setTimeout(flush, 0); |
| 18125 | if (domain) { |
| 18126 | domain.enter(); |
| 18127 | } |
| 18128 | |
| 18129 | throw e; |
| 18130 | |
| 18131 | } else { |
| 18132 | // In browsers, uncaught exceptions are not fatal. |
| 18133 | // Re-throw them asynchronously to avoid slow-downs. |
| 18134 | setTimeout(function () { |
| 18135 | throw e; |
| 18136 | }, 0); |
| 18137 | } |
| 18138 | } |
| 18139 | |
| 18140 | if (domain) { |
| 18141 | domain.exit(); |
| 18142 | } |
| 18143 | } |
| 18144 | |
| 18145 | nextTick = function (task) { |
| 18146 | tail = tail.next = { |
| 18147 | task: task, |
| 18148 | domain: isNodeJS && process.domain, |
| 18149 | next: null |
| 18150 | }; |
| 18151 | |
| 18152 | if (!flushing) { |
| 18153 | flushing = true; |
| 18154 | requestTick(); |
| 18155 | } |
| 18156 | }; |
| 18157 | |
| 18158 | if (typeof process === "object" && |
| 18159 | process.toString() === "[object process]" && process.nextTick) { |
| 18160 | // Ensure Q is in a real Node environment, with a `process.nextTick`. |
| 18161 | // To see through fake Node environments: |
| 18162 | // * Mocha test runner - exposes a `process` global without a `nextTick` |
| 18163 | // * Browserify - exposes a `process.nexTick` function that uses |
| 18164 | // `setTimeout`. In this case `setImmediate` is preferred because |
| 18165 | // it is faster. Browserify's `process.toString()` yields |
| 18166 | // "[object Object]", while in a real Node environment |
| 18167 | // `process.nextTick()` yields "[object process]". |
| 18168 | isNodeJS = true; |
| 18169 | |
| 18170 | requestTick = function () { |
| 18171 | process.nextTick(flush); |
| 18172 | }; |
| 18173 | |
| 18174 | } else if (typeof setImmediate === "function") { |
| 18175 | // In IE10, Node.js 0.9+, or https://github.com/NobleJS/setImmediate |
| 18176 | if (typeof window !== "undefined") { |
| 18177 | requestTick = setImmediate.bind(window, flush); |
| 18178 | } else { |
| 18179 | requestTick = function () { |
| 18180 | setImmediate(flush); |
| 18181 | }; |
| 18182 | } |
| 18183 | |
| 18184 | } else if (typeof MessageChannel !== "undefined") { |
| 18185 | // modern browsers |
| 18186 | // http://www.nonblocking.io/2011/06/windownexttick.html |
| 18187 | var channel = new MessageChannel(); |
| 18188 | // At least Safari Version 6.0.5 (8536.30.1) intermittently cannot create |
| 18189 | // working message ports the first time a page loads. |
| 18190 | channel.port1.onmessage = function () { |
| 18191 | requestTick = requestPortTick; |
| 18192 | channel.port1.onmessage = flush; |
| 18193 | flush(); |
| 18194 | }; |
| 18195 | var requestPortTick = function () { |
| 18196 | // Opera requires us to provide a message payload, regardless of |
| 18197 | // whether we use it. |
| 18198 | channel.port2.postMessage(0); |
| 18199 | }; |
| 18200 | requestTick = function () { |
| 18201 | setTimeout(flush, 0); |
| 18202 | requestPortTick(); |
| 18203 | }; |
| 18204 | |
| 18205 | } else { |
| 18206 | // old browsers |
| 18207 | requestTick = function () { |
| 18208 | setTimeout(flush, 0); |
| 18209 | }; |
| 18210 | } |
| 18211 | // runs a task after all other tasks have been run |
| 18212 | // this is useful for unhandled rejection tracking that needs to happen |
| 18213 | // after all `then`d tasks have been run. |
| 18214 | nextTick.runAfter = function (task) { |
| 18215 | laterQueue.push(task); |
| 18216 | if (!flushing) { |
| 18217 | flushing = true; |
| 18218 | requestTick(); |
| 18219 | } |
| 18220 | }; |
| 18221 | return nextTick; |
| 18222 | })(); |
| 18223 | |
| 18224 | // Attempt to make generics safe in the face of downstream |
| 18225 | // modifications. |
| 18226 | // There is no situation where this is necessary. |
| 18227 | // If you need a security guarantee, these primordials need to be |
| 18228 | // deeply frozen anyway, and if you don’t need a security guarantee, |
| 18229 | // this is just plain paranoid. |
| 18230 | // However, this **might** have the nice side-effect of reducing the size of |
| 18231 | // the minified code by reducing x.call() to merely x() |
| 18232 | // See Mark Miller’s explanation of what this does. |
| 18233 | // http://wiki.ecmascript.org/doku.php?id=conventions:safe_meta_programming |
| 18234 | var call = Function.call; |
| 18235 | function uncurryThis(f) { |
| 18236 | return function () { |
| 18237 | return call.apply(f, arguments); |
| 18238 | }; |
| 18239 | } |
| 18240 | // This is equivalent, but slower: |
| 18241 | // uncurryThis = Function_bind.bind(Function_bind.call); |
| 18242 | // http://jsperf.com/uncurrythis |
| 18243 | |
| 18244 | var array_slice = uncurryThis(Array.prototype.slice); |
| 18245 | |
| 18246 | var array_reduce = uncurryThis( |
| 18247 | Array.prototype.reduce || function (callback, basis) { |
| 18248 | var index = 0, |
| 18249 | length = this.length; |
| 18250 | // concerning the initial value, if one is not provided |
| 18251 | if (arguments.length === 1) { |
| 18252 | // seek to the first value in the array, accounting |
| 18253 | // for the possibility that is is a sparse array |
| 18254 | do { |
| 18255 | if (index in this) { |
| 18256 | basis = this[index++]; |
| 18257 | break; |
| 18258 | } |
| 18259 | if (++index >= length) { |
| 18260 | throw new TypeError(); |
| 18261 | } |
| 18262 | } while (1); |
| 18263 | } |
| 18264 | // reduce |
| 18265 | for (; index < length; index++) { |
| 18266 | // account for the possibility that the array is sparse |
| 18267 | if (index in this) { |
| 18268 | basis = callback(basis, this[index], index); |
| 18269 | } |
| 18270 | } |
| 18271 | return basis; |
| 18272 | } |
| 18273 | ); |
| 18274 | |
| 18275 | var array_indexOf = uncurryThis( |
| 18276 | Array.prototype.indexOf || function (value) { |
| 18277 | // not a very good shim, but good enough for our one use of it |
| 18278 | for (var i = 0; i < this.length; i++) { |
| 18279 | if (this[i] === value) { |
| 18280 | return i; |
| 18281 | } |
| 18282 | } |
| 18283 | return -1; |
| 18284 | } |
| 18285 | ); |
| 18286 | |
| 18287 | var array_map = uncurryThis( |
| 18288 | Array.prototype.map || function (callback, thisp) { |
| 18289 | var self = this; |
| 18290 | var collect = []; |
| 18291 | array_reduce(self, function (undefined, value, index) { |
| 18292 | collect.push(callback.call(thisp, value, index, self)); |
| 18293 | }, void 0); |
| 18294 | return collect; |
| 18295 | } |
| 18296 | ); |
| 18297 | |
| 18298 | var object_create = Object.create || function (prototype) { |
| 18299 | function Type() { } |
| 18300 | Type.prototype = prototype; |
| 18301 | return new Type(); |
| 18302 | }; |
| 18303 | |
| 18304 | var object_hasOwnProperty = uncurryThis(Object.prototype.hasOwnProperty); |
| 18305 | |
| 18306 | var object_keys = Object.keys || function (object) { |
| 18307 | var keys = []; |
| 18308 | for (var key in object) { |
| 18309 | if (object_hasOwnProperty(object, key)) { |
| 18310 | keys.push(key); |
| 18311 | } |
| 18312 | } |
| 18313 | return keys; |
| 18314 | }; |
| 18315 | |
| 18316 | var object_toString = uncurryThis(Object.prototype.toString); |
| 18317 | |
| 18318 | function isObject(value) { |
| 18319 | return value === Object(value); |
| 18320 | } |
| 18321 | |
| 18322 | // generator related shims |
| 18323 | |
| 18324 | // FIXME: Remove this function once ES6 generators are in SpiderMonkey. |
| 18325 | function isStopIteration(exception) { |
| 18326 | return ( |
| 18327 | object_toString(exception) === "[object StopIteration]" || |
| 18328 | exception instanceof QReturnValue |
| 18329 | ); |
| 18330 | } |
| 18331 | |
| 18332 | // FIXME: Remove this helper and Q.return once ES6 generators are in |
| 18333 | // SpiderMonkey. |
| 18334 | var QReturnValue; |
| 18335 | if (typeof ReturnValue !== "undefined") { |
| 18336 | QReturnValue = ReturnValue; |
| 18337 | } else { |
| 18338 | QReturnValue = function (value) { |
| 18339 | this.value = value; |
| 18340 | }; |
| 18341 | } |
| 18342 | |
| 18343 | // long stack traces |
| 18344 | |
| 18345 | var STACK_JUMP_SEPARATOR = "From previous event:"; |
| 18346 | |
| 18347 | function makeStackTraceLong(error, promise) { |
| 18348 | // If possible, transform the error stack trace by removing Node and Q |
| 18349 | // cruft, then concatenating with the stack trace of `promise`. See #57. |
| 18350 | if (hasStacks && |
| 18351 | promise.stack && |
| 18352 | typeof error === "object" && |
| 18353 | error !== null && |
| 18354 | error.stack && |
| 18355 | error.stack.indexOf(STACK_JUMP_SEPARATOR) === -1 |
| 18356 | ) { |
| 18357 | var stacks = []; |
| 18358 | for (var p = promise; !!p; p = p.source) { |
| 18359 | if (p.stack) { |
| 18360 | stacks.unshift(p.stack); |
| 18361 | } |
| 18362 | } |
| 18363 | stacks.unshift(error.stack); |
| 18364 | |
| 18365 | var concatedStacks = stacks.join("\n" + STACK_JUMP_SEPARATOR + "\n"); |
| 18366 | error.stack = filterStackString(concatedStacks); |
| 18367 | } |
| 18368 | } |
| 18369 | |
| 18370 | function filterStackString(stackString) { |
| 18371 | var lines = stackString.split("\n"); |
| 18372 | var desiredLines = []; |
| 18373 | for (var i = 0; i < lines.length; ++i) { |
| 18374 | var line = lines[i]; |
| 18375 | |
| 18376 | if (!isInternalFrame(line) && !isNodeFrame(line) && line) { |
| 18377 | desiredLines.push(line); |
| 18378 | } |
| 18379 | } |
| 18380 | return desiredLines.join("\n"); |
| 18381 | } |
| 18382 | |
| 18383 | function isNodeFrame(stackLine) { |
| 18384 | return stackLine.indexOf("(module.js:") !== -1 || |
| 18385 | stackLine.indexOf("(node.js:") !== -1; |
| 18386 | } |
| 18387 | |
| 18388 | function getFileNameAndLineNumber(stackLine) { |
| 18389 | // Named functions: "at functionName (filename:lineNumber:columnNumber)" |
| 18390 | // In IE10 function name can have spaces ("Anonymous function") O_o |
| 18391 | var attempt1 = /at .+ \((.+):(\d+):(?:\d+)\)$/.exec(stackLine); |
| 18392 | if (attempt1) { |
| 18393 | return [attempt1[1], Number(attempt1[2])]; |
| 18394 | } |
| 18395 | |
| 18396 | // Anonymous functions: "at filename:lineNumber:columnNumber" |
| 18397 | var attempt2 = /at ([^ ]+):(\d+):(?:\d+)$/.exec(stackLine); |
| 18398 | if (attempt2) { |
| 18399 | return [attempt2[1], Number(attempt2[2])]; |
| 18400 | } |
| 18401 | |
| 18402 | // Firefox style: "function@filename:lineNumber or @filename:lineNumber" |
| 18403 | var attempt3 = /.*@(.+):(\d+)$/.exec(stackLine); |
| 18404 | if (attempt3) { |
| 18405 | return [attempt3[1], Number(attempt3[2])]; |
| 18406 | } |
| 18407 | } |
| 18408 | |
| 18409 | function isInternalFrame(stackLine) { |
| 18410 | var fileNameAndLineNumber = getFileNameAndLineNumber(stackLine); |
| 18411 | |
| 18412 | if (!fileNameAndLineNumber) { |
| 18413 | return false; |
| 18414 | } |
| 18415 | |
| 18416 | var fileName = fileNameAndLineNumber[0]; |
| 18417 | var lineNumber = fileNameAndLineNumber[1]; |
| 18418 | |
| 18419 | return fileName === qFileName && |
| 18420 | lineNumber >= qStartingLine && |
| 18421 | lineNumber <= qEndingLine; |
| 18422 | } |
| 18423 | |
| 18424 | // discover own file name and line number range for filtering stack |
| 18425 | // traces |
| 18426 | function captureLine() { |
| 18427 | if (!hasStacks) { |
| 18428 | return; |
| 18429 | } |
| 18430 | |
| 18431 | try { |
| 18432 | throw new Error(); |
| 18433 | } catch (e) { |
| 18434 | var lines = e.stack.split("\n"); |
| 18435 | var firstLine = lines[0].indexOf("@") > 0 ? lines[1] : lines[2]; |
| 18436 | var fileNameAndLineNumber = getFileNameAndLineNumber(firstLine); |
| 18437 | if (!fileNameAndLineNumber) { |
| 18438 | return; |
| 18439 | } |
| 18440 | |
| 18441 | qFileName = fileNameAndLineNumber[0]; |
| 18442 | return fileNameAndLineNumber[1]; |
| 18443 | } |
| 18444 | } |
| 18445 | |
| 18446 | function deprecate(callback, name, alternative) { |
| 18447 | return function () { |
| 18448 | if (typeof console !== "undefined" && |
| 18449 | typeof console.warn === "function") { |
| 18450 | console.warn(name + " is deprecated, use " + alternative + |
| 18451 | " instead.", new Error("").stack); |
| 18452 | } |
| 18453 | return callback.apply(callback, arguments); |
| 18454 | }; |
| 18455 | } |
| 18456 | |
| 18457 | // end of shims |
| 18458 | // beginning of real work |
| 18459 | |
| 18460 | /** |
| 18461 | * Constructs a promise for an immediate reference, passes promises through, or |
| 18462 | * coerces promises from different systems. |
| 18463 | * @param value immediate reference or promise |
| 18464 | */ |
| 18465 | function Q(value) { |
| 18466 | // If the object is already a Promise, return it directly. This enables |
| 18467 | // the resolve function to both be used to created references from objects, |
| 18468 | // but to tolerably coerce non-promises to promises. |
| 18469 | if (value instanceof Promise) { |
| 18470 | return value; |
| 18471 | } |
| 18472 | |
| 18473 | // assimilate thenables |
| 18474 | if (isPromiseAlike(value)) { |
| 18475 | return coerce(value); |
| 18476 | } else { |
| 18477 | return fulfill(value); |
| 18478 | } |
| 18479 | } |
| 18480 | Q.resolve = Q; |
| 18481 | |
| 18482 | /** |
| 18483 | * Performs a task in a future turn of the event loop. |
| 18484 | * @param {Function} task |
| 18485 | */ |
| 18486 | Q.nextTick = nextTick; |
| 18487 | |
| 18488 | /** |
| 18489 | * Controls whether or not long stack traces will be on |
| 18490 | */ |
| 18491 | Q.longStackSupport = false; |
| 18492 | |
| 18493 | // enable long stacks if Q_DEBUG is set |
| 18494 | if (typeof process === "object" && process && process.env && process.env.Q_DEBUG) { |
| 18495 | Q.longStackSupport = true; |
| 18496 | } |
| 18497 | |
| 18498 | /** |
| 18499 | * Constructs a {promise, resolve, reject} object. |
| 18500 | * |
| 18501 | * `resolve` is a callback to invoke with a more resolved value for the |
| 18502 | * promise. To fulfill the promise, invoke `resolve` with any value that is |
| 18503 | * not a thenable. To reject the promise, invoke `resolve` with a rejected |
| 18504 | * thenable, or invoke `reject` with the reason directly. To resolve the |
| 18505 | * promise to another thenable, thus putting it in the same state, invoke |
| 18506 | * `resolve` with that other thenable. |
| 18507 | */ |
| 18508 | Q.defer = defer; |
| 18509 | function defer() { |
| 18510 | // if "messages" is an "Array", that indicates that the promise has not yet |
| 18511 | // been resolved. If it is "undefined", it has been resolved. Each |
| 18512 | // element of the messages array is itself an array of complete arguments to |
| 18513 | // forward to the resolved promise. We coerce the resolution value to a |
| 18514 | // promise using the `resolve` function because it handles both fully |
| 18515 | // non-thenable values and other thenables gracefully. |
| 18516 | var messages = [], progressListeners = [], resolvedPromise; |
| 18517 | |
| 18518 | var deferred = object_create(defer.prototype); |
| 18519 | var promise = object_create(Promise.prototype); |
| 18520 | |
| 18521 | promise.promiseDispatch = function (resolve, op, operands) { |
| 18522 | var args = array_slice(arguments); |
| 18523 | if (messages) { |
| 18524 | messages.push(args); |
| 18525 | if (op === "when" && operands[1]) { // progress operand |
| 18526 | progressListeners.push(operands[1]); |
| 18527 | } |
| 18528 | } else { |
| 18529 | Q.nextTick(function () { |
| 18530 | resolvedPromise.promiseDispatch.apply(resolvedPromise, args); |
| 18531 | }); |
| 18532 | } |
| 18533 | }; |
| 18534 | |
| 18535 | // XXX deprecated |
| 18536 | promise.valueOf = function () { |
| 18537 | if (messages) { |
| 18538 | return promise; |
| 18539 | } |
| 18540 | var nearerValue = nearer(resolvedPromise); |
| 18541 | if (isPromise(nearerValue)) { |
| 18542 | resolvedPromise = nearerValue; // shorten chain |
| 18543 | } |
| 18544 | return nearerValue; |
| 18545 | }; |
| 18546 | |
| 18547 | promise.inspect = function () { |
| 18548 | if (!resolvedPromise) { |
| 18549 | return { state: "pending" }; |
| 18550 | } |
| 18551 | return resolvedPromise.inspect(); |
| 18552 | }; |
| 18553 | |
| 18554 | if (Q.longStackSupport && hasStacks) { |
| 18555 | try { |
| 18556 | throw new Error(); |
| 18557 | } catch (e) { |
| 18558 | // NOTE: don't try to use `Error.captureStackTrace` or transfer the |
| 18559 | // accessor around; that causes memory leaks as per GH-111. Just |
| 18560 | // reify the stack trace as a string ASAP. |
| 18561 | // |
| 18562 | // At the same time, cut off the first line; it's always just |
| 18563 | // "[object Promise]\n", as per the `toString`. |
| 18564 | promise.stack = e.stack.substring(e.stack.indexOf("\n") + 1); |
| 18565 | } |
| 18566 | } |
| 18567 | |
| 18568 | // NOTE: we do the checks for `resolvedPromise` in each method, instead of |
| 18569 | // consolidating them into `become`, since otherwise we'd create new |
| 18570 | // promises with the lines `become(whatever(value))`. See e.g. GH-252. |
| 18571 | |
| 18572 | function become(newPromise) { |
| 18573 | resolvedPromise = newPromise; |
| 18574 | promise.source = newPromise; |
| 18575 | |
| 18576 | array_reduce(messages, function (undefined, message) { |
| 18577 | Q.nextTick(function () { |
| 18578 | newPromise.promiseDispatch.apply(newPromise, message); |
| 18579 | }); |
| 18580 | }, void 0); |
| 18581 | |
| 18582 | messages = void 0; |
| 18583 | progressListeners = void 0; |
| 18584 | } |
| 18585 | |
| 18586 | deferred.promise = promise; |
| 18587 | deferred.resolve = function (value) { |
| 18588 | if (resolvedPromise) { |
| 18589 | return; |
| 18590 | } |
| 18591 | |
| 18592 | become(Q(value)); |
| 18593 | }; |
| 18594 | |
| 18595 | deferred.fulfill = function (value) { |
| 18596 | if (resolvedPromise) { |
| 18597 | return; |
| 18598 | } |
| 18599 | |
| 18600 | become(fulfill(value)); |
| 18601 | }; |
| 18602 | deferred.reject = function (reason) { |
| 18603 | if (resolvedPromise) { |
| 18604 | return; |
| 18605 | } |
| 18606 | |
| 18607 | become(reject(reason)); |
| 18608 | }; |
| 18609 | deferred.notify = function (progress) { |
| 18610 | if (resolvedPromise) { |
| 18611 | return; |
| 18612 | } |
| 18613 | |
| 18614 | array_reduce(progressListeners, function (undefined, progressListener) { |
| 18615 | Q.nextTick(function () { |
| 18616 | progressListener(progress); |
| 18617 | }); |
| 18618 | }, void 0); |
| 18619 | }; |
| 18620 | |
| 18621 | return deferred; |
| 18622 | } |
| 18623 | |
| 18624 | /** |
| 18625 | * Creates a Node-style callback that will resolve or reject the deferred |
| 18626 | * promise. |
| 18627 | * @returns a nodeback |
| 18628 | */ |
| 18629 | defer.prototype.makeNodeResolver = function () { |
| 18630 | var self = this; |
| 18631 | return function (error, value) { |
| 18632 | if (error) { |
| 18633 | self.reject(error); |
| 18634 | } else if (arguments.length > 2) { |
| 18635 | self.resolve(array_slice(arguments, 1)); |
| 18636 | } else { |
| 18637 | self.resolve(value); |
| 18638 | } |
| 18639 | }; |
| 18640 | }; |
| 18641 | |
| 18642 | /** |
| 18643 | * @param resolver {Function} a function that returns nothing and accepts |
| 18644 | * the resolve, reject, and notify functions for a deferred. |
| 18645 | * @returns a promise that may be resolved with the given resolve and reject |
| 18646 | * functions, or rejected by a thrown exception in resolver |
| 18647 | */ |
| 18648 | Q.Promise = promise; // ES6 |
| 18649 | Q.promise = promise; |
| 18650 | function promise(resolver) { |
| 18651 | if (typeof resolver !== "function") { |
| 18652 | throw new TypeError("resolver must be a function."); |
| 18653 | } |
| 18654 | var deferred = defer(); |
| 18655 | try { |
| 18656 | resolver(deferred.resolve, deferred.reject, deferred.notify); |
| 18657 | } catch (reason) { |
| 18658 | deferred.reject(reason); |
| 18659 | } |
| 18660 | return deferred.promise; |
| 18661 | } |
| 18662 | |
| 18663 | promise.race = race; // ES6 |
| 18664 | promise.all = all; // ES6 |
| 18665 | promise.reject = reject; // ES6 |
| 18666 | promise.resolve = Q; // ES6 |
| 18667 | |
| 18668 | // XXX experimental. This method is a way to denote that a local value is |
| 18669 | // serializable and should be immediately dispatched to a remote upon request, |
| 18670 | // instead of passing a reference. |
| 18671 | Q.passByCopy = function (object) { |
| 18672 | //freeze(object); |
| 18673 | //passByCopies.set(object, true); |
| 18674 | return object; |
| 18675 | }; |
| 18676 | |
| 18677 | Promise.prototype.passByCopy = function () { |
| 18678 | //freeze(object); |
| 18679 | //passByCopies.set(object, true); |
| 18680 | return this; |
| 18681 | }; |
| 18682 | |
| 18683 | /** |
| 18684 | * If two promises eventually fulfill to the same value, promises that value, |
| 18685 | * but otherwise rejects. |
| 18686 | * @param x {Any*} |
| 18687 | * @param y {Any*} |
| 18688 | * @returns {Any*} a promise for x and y if they are the same, but a rejection |
| 18689 | * otherwise. |
| 18690 | * |
| 18691 | */ |
| 18692 | Q.join = function (x, y) { |
| 18693 | return Q(x).join(y); |
| 18694 | }; |
| 18695 | |
| 18696 | Promise.prototype.join = function (that) { |
| 18697 | return Q([this, that]).spread(function (x, y) { |
| 18698 | if (x === y) { |
| 18699 | // TODO: "===" should be Object.is or equiv |
| 18700 | return x; |
| 18701 | } else { |
| 18702 | throw new Error("Can't join: not the same: " + x + " " + y); |
| 18703 | } |
| 18704 | }); |
| 18705 | }; |
| 18706 | |
| 18707 | /** |
| 18708 | * Returns a promise for the first of an array of promises to become settled. |
| 18709 | * @param answers {Array[Any*]} promises to race |
| 18710 | * @returns {Any*} the first promise to be settled |
| 18711 | */ |
| 18712 | Q.race = race; |
| 18713 | function race(answerPs) { |
| 18714 | return promise(function (resolve, reject) { |
| 18715 | // Switch to this once we can assume at least ES5 |
| 18716 | // answerPs.forEach(function (answerP) { |
| 18717 | // Q(answerP).then(resolve, reject); |
| 18718 | // }); |
| 18719 | // Use this in the meantime |
| 18720 | for (var i = 0, len = answerPs.length; i < len; i++) { |
| 18721 | Q(answerPs[i]).then(resolve, reject); |
| 18722 | } |
| 18723 | }); |
| 18724 | } |
| 18725 | |
| 18726 | Promise.prototype.race = function () { |
| 18727 | return this.then(Q.race); |
| 18728 | }; |
| 18729 | |
| 18730 | /** |
| 18731 | * Constructs a Promise with a promise descriptor object and optional fallback |
| 18732 | * function. The descriptor contains methods like when(rejected), get(name), |
| 18733 | * set(name, value), post(name, args), and delete(name), which all |
| 18734 | * return either a value, a promise for a value, or a rejection. The fallback |
| 18735 | * accepts the operation name, a resolver, and any further arguments that would |
| 18736 | * have been forwarded to the appropriate method above had a method been |
| 18737 | * provided with the proper name. The API makes no guarantees about the nature |
| 18738 | * of the returned object, apart from that it is usable whereever promises are |
| 18739 | * bought and sold. |
| 18740 | */ |
| 18741 | Q.makePromise = Promise; |
| 18742 | function Promise(descriptor, fallback, inspect) { |
| 18743 | if (fallback === void 0) { |
| 18744 | fallback = function (op) { |
| 18745 | return reject(new Error( |
| 18746 | "Promise does not support operation: " + op |
| 18747 | )); |
| 18748 | }; |
| 18749 | } |
| 18750 | if (inspect === void 0) { |
| 18751 | inspect = function () { |
| 18752 | return {state: "unknown"}; |
| 18753 | }; |
| 18754 | } |
| 18755 | |
| 18756 | var promise = object_create(Promise.prototype); |
| 18757 | |
| 18758 | promise.promiseDispatch = function (resolve, op, args) { |
| 18759 | var result; |
| 18760 | try { |
| 18761 | if (descriptor[op]) { |
| 18762 | result = descriptor[op].apply(promise, args); |
| 18763 | } else { |
| 18764 | result = fallback.call(promise, op, args); |
| 18765 | } |
| 18766 | } catch (exception) { |
| 18767 | result = reject(exception); |
| 18768 | } |
| 18769 | if (resolve) { |
| 18770 | resolve(result); |
| 18771 | } |
| 18772 | }; |
| 18773 | |
| 18774 | promise.inspect = inspect; |
| 18775 | |
| 18776 | // XXX deprecated `valueOf` and `exception` support |
| 18777 | if (inspect) { |
| 18778 | var inspected = inspect(); |
| 18779 | if (inspected.state === "rejected") { |
| 18780 | promise.exception = inspected.reason; |
| 18781 | } |
| 18782 | |
| 18783 | promise.valueOf = function () { |
| 18784 | var inspected = inspect(); |
| 18785 | if (inspected.state === "pending" || |
| 18786 | inspected.state === "rejected") { |
| 18787 | return promise; |
| 18788 | } |
| 18789 | return inspected.value; |
| 18790 | }; |
| 18791 | } |
| 18792 | |
| 18793 | return promise; |
| 18794 | } |
| 18795 | |
| 18796 | Promise.prototype.toString = function () { |
| 18797 | return "[object Promise]"; |
| 18798 | }; |
| 18799 | |
| 18800 | Promise.prototype.then = function (fulfilled, rejected, progressed) { |
| 18801 | var self = this; |
| 18802 | var deferred = defer(); |
| 18803 | var done = false; // ensure the untrusted promise makes at most a |
| 18804 | // single call to one of the callbacks |
| 18805 | |
| 18806 | function _fulfilled(value) { |
| 18807 | try { |
| 18808 | return typeof fulfilled === "function" ? fulfilled(value) : value; |
| 18809 | } catch (exception) { |
| 18810 | return reject(exception); |
| 18811 | } |
| 18812 | } |
| 18813 | |
| 18814 | function _rejected(exception) { |
| 18815 | if (typeof rejected === "function") { |
| 18816 | makeStackTraceLong(exception, self); |
| 18817 | try { |
| 18818 | return rejected(exception); |
| 18819 | } catch (newException) { |
| 18820 | return reject(newException); |
| 18821 | } |
| 18822 | } |
| 18823 | return reject(exception); |
| 18824 | } |
| 18825 | |
| 18826 | function _progressed(value) { |
| 18827 | return typeof progressed === "function" ? progressed(value) : value; |
| 18828 | } |
| 18829 | |
| 18830 | Q.nextTick(function () { |
| 18831 | self.promiseDispatch(function (value) { |
| 18832 | if (done) { |
| 18833 | return; |
| 18834 | } |
| 18835 | done = true; |
| 18836 | |
| 18837 | deferred.resolve(_fulfilled(value)); |
| 18838 | }, "when", [function (exception) { |
| 18839 | if (done) { |
| 18840 | return; |
| 18841 | } |
| 18842 | done = true; |
| 18843 | |
| 18844 | deferred.resolve(_rejected(exception)); |
| 18845 | }]); |
| 18846 | }); |
| 18847 | |
| 18848 | // Progress propagator need to be attached in the current tick. |
| 18849 | self.promiseDispatch(void 0, "when", [void 0, function (value) { |
| 18850 | var newValue; |
| 18851 | var threw = false; |
| 18852 | try { |
| 18853 | newValue = _progressed(value); |
| 18854 | } catch (e) { |
| 18855 | threw = true; |
| 18856 | if (Q.onerror) { |
| 18857 | Q.onerror(e); |
| 18858 | } else { |
| 18859 | throw e; |
| 18860 | } |
| 18861 | } |
| 18862 | |
| 18863 | if (!threw) { |
| 18864 | deferred.notify(newValue); |
| 18865 | } |
| 18866 | }]); |
| 18867 | |
| 18868 | return deferred.promise; |
| 18869 | }; |
| 18870 | |
| 18871 | Q.tap = function (promise, callback) { |
| 18872 | return Q(promise).tap(callback); |
| 18873 | }; |
| 18874 | |
| 18875 | /** |
| 18876 | * Works almost like "finally", but not called for rejections. |
| 18877 | * Original resolution value is passed through callback unaffected. |
| 18878 | * Callback may return a promise that will be awaited for. |
| 18879 | * @param {Function} callback |
| 18880 | * @returns {Q.Promise} |
| 18881 | * @example |
| 18882 | * doSomething() |
| 18883 | * .then(...) |
| 18884 | * .tap(console.log) |
| 18885 | * .then(...); |
| 18886 | */ |
| 18887 | Promise.prototype.tap = function (callback) { |
| 18888 | callback = Q(callback); |
| 18889 | |
| 18890 | return this.then(function (value) { |
| 18891 | return callback.fcall(value).thenResolve(value); |
| 18892 | }); |
| 18893 | }; |
| 18894 | |
| 18895 | /** |
| 18896 | * Registers an observer on a promise. |
| 18897 | * |
| 18898 | * Guarantees: |
| 18899 | * |
| 18900 | * 1. that fulfilled and rejected will be called only once. |
| 18901 | * 2. that either the fulfilled callback or the rejected callback will be |
| 18902 | * called, but not both. |
| 18903 | * 3. that fulfilled and rejected will not be called in this turn. |
| 18904 | * |
| 18905 | * @param value promise or immediate reference to observe |
| 18906 | * @param fulfilled function to be called with the fulfilled value |
| 18907 | * @param rejected function to be called with the rejection exception |
| 18908 | * @param progressed function to be called on any progress notifications |
| 18909 | * @return promise for the return value from the invoked callback |
| 18910 | */ |
| 18911 | Q.when = when; |
| 18912 | function when(value, fulfilled, rejected, progressed) { |
| 18913 | return Q(value).then(fulfilled, rejected, progressed); |
| 18914 | } |
| 18915 | |
| 18916 | Promise.prototype.thenResolve = function (value) { |
| 18917 | return this.then(function () { return value; }); |
| 18918 | }; |
| 18919 | |
| 18920 | Q.thenResolve = function (promise, value) { |
| 18921 | return Q(promise).thenResolve(value); |
| 18922 | }; |
| 18923 | |
| 18924 | Promise.prototype.thenReject = function (reason) { |
| 18925 | return this.then(function () { throw reason; }); |
| 18926 | }; |
| 18927 | |
| 18928 | Q.thenReject = function (promise, reason) { |
| 18929 | return Q(promise).thenReject(reason); |
| 18930 | }; |
| 18931 | |
| 18932 | /** |
| 18933 | * If an object is not a promise, it is as "near" as possible. |
| 18934 | * If a promise is rejected, it is as "near" as possible too. |
| 18935 | * If it’s a fulfilled promise, the fulfillment value is nearer. |
| 18936 | * If it’s a deferred promise and the deferred has been resolved, the |
| 18937 | * resolution is "nearer". |
| 18938 | * @param object |
| 18939 | * @returns most resolved (nearest) form of the object |
| 18940 | */ |
| 18941 | |
| 18942 | // XXX should we re-do this? |
| 18943 | Q.nearer = nearer; |
| 18944 | function nearer(value) { |
| 18945 | if (isPromise(value)) { |
| 18946 | var inspected = value.inspect(); |
| 18947 | if (inspected.state === "fulfilled") { |
| 18948 | return inspected.value; |
| 18949 | } |
| 18950 | } |
| 18951 | return value; |
| 18952 | } |
| 18953 | |
| 18954 | /** |
| 18955 | * @returns whether the given object is a promise. |
| 18956 | * Otherwise it is a fulfilled value. |
| 18957 | */ |
| 18958 | Q.isPromise = isPromise; |
| 18959 | function isPromise(object) { |
| 18960 | return object instanceof Promise; |
| 18961 | } |
| 18962 | |
| 18963 | Q.isPromiseAlike = isPromiseAlike; |
| 18964 | function isPromiseAlike(object) { |
| 18965 | return isObject(object) && typeof object.then === "function"; |
| 18966 | } |
| 18967 | |
| 18968 | /** |
| 18969 | * @returns whether the given object is a pending promise, meaning not |
| 18970 | * fulfilled or rejected. |
| 18971 | */ |
| 18972 | Q.isPending = isPending; |
| 18973 | function isPending(object) { |
| 18974 | return isPromise(object) && object.inspect().state === "pending"; |
| 18975 | } |
| 18976 | |
| 18977 | Promise.prototype.isPending = function () { |
| 18978 | return this.inspect().state === "pending"; |
| 18979 | }; |
| 18980 | |
| 18981 | /** |
| 18982 | * @returns whether the given object is a value or fulfilled |
| 18983 | * promise. |
| 18984 | */ |
| 18985 | Q.isFulfilled = isFulfilled; |
| 18986 | function isFulfilled(object) { |
| 18987 | return !isPromise(object) || object.inspect().state === "fulfilled"; |
| 18988 | } |
| 18989 | |
| 18990 | Promise.prototype.isFulfilled = function () { |
| 18991 | return this.inspect().state === "fulfilled"; |
| 18992 | }; |
| 18993 | |
| 18994 | /** |
| 18995 | * @returns whether the given object is a rejected promise. |
| 18996 | */ |
| 18997 | Q.isRejected = isRejected; |
| 18998 | function isRejected(object) { |
| 18999 | return isPromise(object) && object.inspect().state === "rejected"; |
| 19000 | } |
| 19001 | |
| 19002 | Promise.prototype.isRejected = function () { |
| 19003 | return this.inspect().state === "rejected"; |
| 19004 | }; |
| 19005 | |
| 19006 | //// BEGIN UNHANDLED REJECTION TRACKING |
| 19007 | |
| 19008 | // This promise library consumes exceptions thrown in handlers so they can be |
| 19009 | // handled by a subsequent promise. The exceptions get added to this array when |
| 19010 | // they are created, and removed when they are handled. Note that in ES6 or |
| 19011 | // shimmed environments, this would naturally be a `Set`. |
| 19012 | var unhandledReasons = []; |
| 19013 | var unhandledRejections = []; |
| 19014 | var reportedUnhandledRejections = []; |
| 19015 | var trackUnhandledRejections = true; |
| 19016 | |
| 19017 | function resetUnhandledRejections() { |
| 19018 | unhandledReasons.length = 0; |
| 19019 | unhandledRejections.length = 0; |
| 19020 | |
| 19021 | if (!trackUnhandledRejections) { |
| 19022 | trackUnhandledRejections = true; |
| 19023 | } |
| 19024 | } |
| 19025 | |
| 19026 | function trackRejection(promise, reason) { |
| 19027 | if (!trackUnhandledRejections) { |
| 19028 | return; |
| 19029 | } |
| 19030 | if (typeof process === "object" && typeof process.emit === "function") { |
| 19031 | Q.nextTick.runAfter(function () { |
| 19032 | if (array_indexOf(unhandledRejections, promise) !== -1) { |
| 19033 | process.emit("unhandledRejection", reason, promise); |
| 19034 | reportedUnhandledRejections.push(promise); |
| 19035 | } |
| 19036 | }); |
| 19037 | } |
| 19038 | |
| 19039 | unhandledRejections.push(promise); |
| 19040 | if (reason && typeof reason.stack !== "undefined") { |
| 19041 | unhandledReasons.push(reason.stack); |
| 19042 | } else { |
| 19043 | unhandledReasons.push("(no stack) " + reason); |
| 19044 | } |
| 19045 | } |
| 19046 | |
| 19047 | function untrackRejection(promise) { |
| 19048 | if (!trackUnhandledRejections) { |
| 19049 | return; |
| 19050 | } |
| 19051 | |
| 19052 | var at = array_indexOf(unhandledRejections, promise); |
| 19053 | if (at !== -1) { |
| 19054 | if (typeof process === "object" && typeof process.emit === "function") { |
| 19055 | Q.nextTick.runAfter(function () { |
| 19056 | var atReport = array_indexOf(reportedUnhandledRejections, promise); |
| 19057 | if (atReport !== -1) { |
| 19058 | process.emit("rejectionHandled", unhandledReasons[at], promise); |
| 19059 | reportedUnhandledRejections.splice(atReport, 1); |
| 19060 | } |
| 19061 | }); |
| 19062 | } |
| 19063 | unhandledRejections.splice(at, 1); |
| 19064 | unhandledReasons.splice(at, 1); |
| 19065 | } |
| 19066 | } |
| 19067 | |
| 19068 | Q.resetUnhandledRejections = resetUnhandledRejections; |
| 19069 | |
| 19070 | Q.getUnhandledReasons = function () { |
| 19071 | // Make a copy so that consumers can't interfere with our internal state. |
| 19072 | return unhandledReasons.slice(); |
| 19073 | }; |
| 19074 | |
| 19075 | Q.stopUnhandledRejectionTracking = function () { |
| 19076 | resetUnhandledRejections(); |
| 19077 | trackUnhandledRejections = false; |
| 19078 | }; |
| 19079 | |
| 19080 | resetUnhandledRejections(); |
| 19081 | |
| 19082 | //// END UNHANDLED REJECTION TRACKING |
| 19083 | |
| 19084 | /** |
| 19085 | * Constructs a rejected promise. |
| 19086 | * @param reason value describing the failure |
| 19087 | */ |
| 19088 | Q.reject = reject; |
| 19089 | function reject(reason) { |
| 19090 | var rejection = Promise({ |
| 19091 | "when": function (rejected) { |
| 19092 | // note that the error has been handled |
| 19093 | if (rejected) { |
| 19094 | untrackRejection(this); |
| 19095 | } |
| 19096 | return rejected ? rejected(reason) : this; |
| 19097 | } |
| 19098 | }, function fallback() { |
| 19099 | return this; |
| 19100 | }, function inspect() { |
| 19101 | return { state: "rejected", reason: reason }; |
| 19102 | }); |
| 19103 | |
| 19104 | // Note that the reason has not been handled. |
| 19105 | trackRejection(rejection, reason); |
| 19106 | |
| 19107 | return rejection; |
| 19108 | } |
| 19109 | |
| 19110 | /** |
| 19111 | * Constructs a fulfilled promise for an immediate reference. |
| 19112 | * @param value immediate reference |
| 19113 | */ |
| 19114 | Q.fulfill = fulfill; |
| 19115 | function fulfill(value) { |
| 19116 | return Promise({ |
| 19117 | "when": function () { |
| 19118 | return value; |
| 19119 | }, |
| 19120 | "get": function (name) { |
| 19121 | return value[name]; |
| 19122 | }, |
| 19123 | "set": function (name, rhs) { |
| 19124 | value[name] = rhs; |
| 19125 | }, |
| 19126 | "delete": function (name) { |
| 19127 | delete value[name]; |
| 19128 | }, |
| 19129 | "post": function (name, args) { |
| 19130 | // Mark Miller proposes that post with no name should apply a |
| 19131 | // promised function. |
| 19132 | if (name === null || name === void 0) { |
| 19133 | return value.apply(void 0, args); |
| 19134 | } else { |
| 19135 | return value[name].apply(value, args); |
| 19136 | } |
| 19137 | }, |
| 19138 | "apply": function (thisp, args) { |
| 19139 | return value.apply(thisp, args); |
| 19140 | }, |
| 19141 | "keys": function () { |
| 19142 | return object_keys(value); |
| 19143 | } |
| 19144 | }, void 0, function inspect() { |
| 19145 | return { state: "fulfilled", value: value }; |
| 19146 | }); |
| 19147 | } |
| 19148 | |
| 19149 | /** |
| 19150 | * Converts thenables to Q promises. |
| 19151 | * @param promise thenable promise |
| 19152 | * @returns a Q promise |
| 19153 | */ |
| 19154 | function coerce(promise) { |
| 19155 | var deferred = defer(); |
| 19156 | Q.nextTick(function () { |
| 19157 | try { |
| 19158 | promise.then(deferred.resolve, deferred.reject, deferred.notify); |
| 19159 | } catch (exception) { |
| 19160 | deferred.reject(exception); |
| 19161 | } |
| 19162 | }); |
| 19163 | return deferred.promise; |
| 19164 | } |
| 19165 | |
| 19166 | /** |
| 19167 | * Annotates an object such that it will never be |
| 19168 | * transferred away from this process over any promise |
| 19169 | * communication channel. |
| 19170 | * @param object |
| 19171 | * @returns promise a wrapping of that object that |
| 19172 | * additionally responds to the "isDef" message |
| 19173 | * without a rejection. |
| 19174 | */ |
| 19175 | Q.master = master; |
| 19176 | function master(object) { |
| 19177 | return Promise({ |
| 19178 | "isDef": function () {} |
| 19179 | }, function fallback(op, args) { |
| 19180 | return dispatch(object, op, args); |
| 19181 | }, function () { |
| 19182 | return Q(object).inspect(); |
| 19183 | }); |
| 19184 | } |
| 19185 | |
| 19186 | /** |
| 19187 | * Spreads the values of a promised array of arguments into the |
| 19188 | * fulfillment callback. |
| 19189 | * @param fulfilled callback that receives variadic arguments from the |
| 19190 | * promised array |
| 19191 | * @param rejected callback that receives the exception if the promise |
| 19192 | * is rejected. |
| 19193 | * @returns a promise for the return value or thrown exception of |
| 19194 | * either callback. |
| 19195 | */ |
| 19196 | Q.spread = spread; |
| 19197 | function spread(value, fulfilled, rejected) { |
| 19198 | return Q(value).spread(fulfilled, rejected); |
| 19199 | } |
| 19200 | |
| 19201 | Promise.prototype.spread = function (fulfilled, rejected) { |
| 19202 | return this.all().then(function (array) { |
| 19203 | return fulfilled.apply(void 0, array); |
| 19204 | }, rejected); |
| 19205 | }; |
| 19206 | |
| 19207 | /** |
| 19208 | * The async function is a decorator for generator functions, turning |
| 19209 | * them into asynchronous generators. Although generators are only part |
| 19210 | * of the newest ECMAScript 6 drafts, this code does not cause syntax |
| 19211 | * errors in older engines. This code should continue to work and will |
| 19212 | * in fact improve over time as the language improves. |
| 19213 | * |
| 19214 | * ES6 generators are currently part of V8 version 3.19 with the |
| 19215 | * --harmony-generators runtime flag enabled. SpiderMonkey has had them |
| 19216 | * for longer, but under an older Python-inspired form. This function |
| 19217 | * works on both kinds of generators. |
| 19218 | * |
| 19219 | * Decorates a generator function such that: |
| 19220 | * - it may yield promises |
| 19221 | * - execution will continue when that promise is fulfilled |
| 19222 | * - the value of the yield expression will be the fulfilled value |
| 19223 | * - it returns a promise for the return value (when the generator |
| 19224 | * stops iterating) |
| 19225 | * - the decorated function returns a promise for the return value |
| 19226 | * of the generator or the first rejected promise among those |
| 19227 | * yielded. |
| 19228 | * - if an error is thrown in the generator, it propagates through |
| 19229 | * every following yield until it is caught, or until it escapes |
| 19230 | * the generator function altogether, and is translated into a |
| 19231 | * rejection for the promise returned by the decorated generator. |
| 19232 | */ |
| 19233 | Q.async = async; |
| 19234 | function async(makeGenerator) { |
| 19235 | return function () { |
| 19236 | // when verb is "send", arg is a value |
| 19237 | // when verb is "throw", arg is an exception |
| 19238 | function continuer(verb, arg) { |
| 19239 | var result; |
| 19240 | |
| 19241 | // Until V8 3.19 / Chromium 29 is released, SpiderMonkey is the only |
| 19242 | // engine that has a deployed base of browsers that support generators. |
| 19243 | // However, SM's generators use the Python-inspired semantics of |
| 19244 | // outdated ES6 drafts. We would like to support ES6, but we'd also |
| 19245 | // like to make it possible to use generators in deployed browsers, so |
| 19246 | // we also support Python-style generators. At some point we can remove |
| 19247 | // this block. |
| 19248 | |
| 19249 | if (typeof StopIteration === "undefined") { |
| 19250 | // ES6 Generators |
| 19251 | try { |
| 19252 | result = generator[verb](arg); |
| 19253 | } catch (exception) { |
| 19254 | return reject(exception); |
| 19255 | } |
| 19256 | if (result.done) { |
| 19257 | return Q(result.value); |
| 19258 | } else { |
| 19259 | return when(result.value, callback, errback); |
| 19260 | } |
| 19261 | } else { |
| 19262 | // SpiderMonkey Generators |
| 19263 | // FIXME: Remove this case when SM does ES6 generators. |
| 19264 | try { |
| 19265 | result = generator[verb](arg); |
| 19266 | } catch (exception) { |
| 19267 | if (isStopIteration(exception)) { |
| 19268 | return Q(exception.value); |
| 19269 | } else { |
| 19270 | return reject(exception); |
| 19271 | } |
| 19272 | } |
| 19273 | return when(result, callback, errback); |
| 19274 | } |
| 19275 | } |
| 19276 | var generator = makeGenerator.apply(this, arguments); |
| 19277 | var callback = continuer.bind(continuer, "next"); |
| 19278 | var errback = continuer.bind(continuer, "throw"); |
| 19279 | return callback(); |
| 19280 | }; |
| 19281 | } |
| 19282 | |
| 19283 | /** |
| 19284 | * The spawn function is a small wrapper around async that immediately |
| 19285 | * calls the generator and also ends the promise chain, so that any |
| 19286 | * unhandled errors are thrown instead of forwarded to the error |
| 19287 | * handler. This is useful because it's extremely common to run |
| 19288 | * generators at the top-level to work with libraries. |
| 19289 | */ |
| 19290 | Q.spawn = spawn; |
| 19291 | function spawn(makeGenerator) { |
| 19292 | Q.done(Q.async(makeGenerator)()); |
| 19293 | } |
| 19294 | |
| 19295 | // FIXME: Remove this interface once ES6 generators are in SpiderMonkey. |
| 19296 | /** |
| 19297 | * Throws a ReturnValue exception to stop an asynchronous generator. |
| 19298 | * |
| 19299 | * This interface is a stop-gap measure to support generator return |
| 19300 | * values in older Firefox/SpiderMonkey. In browsers that support ES6 |
| 19301 | * generators like Chromium 29, just use "return" in your generator |
| 19302 | * functions. |
| 19303 | * |
| 19304 | * @param value the return value for the surrounding generator |
| 19305 | * @throws ReturnValue exception with the value. |
| 19306 | * @example |
| 19307 | * // ES6 style |
| 19308 | * Q.async(function* () { |
| 19309 | * var foo = yield getFooPromise(); |
| 19310 | * var bar = yield getBarPromise(); |
| 19311 | * return foo + bar; |
| 19312 | * }) |
| 19313 | * // Older SpiderMonkey style |
| 19314 | * Q.async(function () { |
| 19315 | * var foo = yield getFooPromise(); |
| 19316 | * var bar = yield getBarPromise(); |
| 19317 | * Q.return(foo + bar); |
| 19318 | * }) |
| 19319 | */ |
| 19320 | Q["return"] = _return; |
| 19321 | function _return(value) { |
| 19322 | throw new QReturnValue(value); |
| 19323 | } |
| 19324 | |
| 19325 | /** |
| 19326 | * The promised function decorator ensures that any promise arguments |
| 19327 | * are settled and passed as values (`this` is also settled and passed |
| 19328 | * as a value). It will also ensure that the result of a function is |
| 19329 | * always a promise. |
| 19330 | * |
| 19331 | * @example |
| 19332 | * var add = Q.promised(function (a, b) { |
| 19333 | * return a + b; |
| 19334 | * }); |
| 19335 | * add(Q(a), Q(B)); |
| 19336 | * |
| 19337 | * @param {function} callback The function to decorate |
| 19338 | * @returns {function} a function that has been decorated. |
| 19339 | */ |
| 19340 | Q.promised = promised; |
| 19341 | function promised(callback) { |
| 19342 | return function () { |
| 19343 | return spread([this, all(arguments)], function (self, args) { |
| 19344 | return callback.apply(self, args); |
| 19345 | }); |
| 19346 | }; |
| 19347 | } |
| 19348 | |
| 19349 | /** |
| 19350 | * sends a message to a value in a future turn |
| 19351 | * @param object* the recipient |
| 19352 | * @param op the name of the message operation, e.g., "when", |
| 19353 | * @param args further arguments to be forwarded to the operation |
| 19354 | * @returns result {Promise} a promise for the result of the operation |
| 19355 | */ |
| 19356 | Q.dispatch = dispatch; |
| 19357 | function dispatch(object, op, args) { |
| 19358 | return Q(object).dispatch(op, args); |
| 19359 | } |
| 19360 | |
| 19361 | Promise.prototype.dispatch = function (op, args) { |
| 19362 | var self = this; |
| 19363 | var deferred = defer(); |
| 19364 | Q.nextTick(function () { |
| 19365 | self.promiseDispatch(deferred.resolve, op, args); |
| 19366 | }); |
| 19367 | return deferred.promise; |
| 19368 | }; |
| 19369 | |
| 19370 | /** |
| 19371 | * Gets the value of a property in a future turn. |
| 19372 | * @param object promise or immediate reference for target object |
| 19373 | * @param name name of property to get |
| 19374 | * @return promise for the property value |
| 19375 | */ |
| 19376 | Q.get = function (object, key) { |
| 19377 | return Q(object).dispatch("get", [key]); |
| 19378 | }; |
| 19379 | |
| 19380 | Promise.prototype.get = function (key) { |
| 19381 | return this.dispatch("get", [key]); |
| 19382 | }; |
| 19383 | |
| 19384 | /** |
| 19385 | * Sets the value of a property in a future turn. |
| 19386 | * @param object promise or immediate reference for object object |
| 19387 | * @param name name of property to set |
| 19388 | * @param value new value of property |
| 19389 | * @return promise for the return value |
| 19390 | */ |
| 19391 | Q.set = function (object, key, value) { |
| 19392 | return Q(object).dispatch("set", [key, value]); |
| 19393 | }; |
| 19394 | |
| 19395 | Promise.prototype.set = function (key, value) { |
| 19396 | return this.dispatch("set", [key, value]); |
| 19397 | }; |
| 19398 | |
| 19399 | /** |
| 19400 | * Deletes a property in a future turn. |
| 19401 | * @param object promise or immediate reference for target object |
| 19402 | * @param name name of property to delete |
| 19403 | * @return promise for the return value |
| 19404 | */ |
| 19405 | Q.del = // XXX legacy |
| 19406 | Q["delete"] = function (object, key) { |
| 19407 | return Q(object).dispatch("delete", [key]); |
| 19408 | }; |
| 19409 | |
| 19410 | Promise.prototype.del = // XXX legacy |
| 19411 | Promise.prototype["delete"] = function (key) { |
| 19412 | return this.dispatch("delete", [key]); |
| 19413 | }; |
| 19414 | |
| 19415 | /** |
| 19416 | * Invokes a method in a future turn. |
| 19417 | * @param object promise or immediate reference for target object |
| 19418 | * @param name name of method to invoke |
| 19419 | * @param value a value to post, typically an array of |
| 19420 | * invocation arguments for promises that |
| 19421 | * are ultimately backed with `resolve` values, |
| 19422 | * as opposed to those backed with URLs |
| 19423 | * wherein the posted value can be any |
| 19424 | * JSON serializable object. |
| 19425 | * @return promise for the return value |
| 19426 | */ |
| 19427 | // bound locally because it is used by other methods |
| 19428 | Q.mapply = // XXX As proposed by "Redsandro" |
| 19429 | Q.post = function (object, name, args) { |
| 19430 | return Q(object).dispatch("post", [name, args]); |
| 19431 | }; |
| 19432 | |
| 19433 | Promise.prototype.mapply = // XXX As proposed by "Redsandro" |
| 19434 | Promise.prototype.post = function (name, args) { |
| 19435 | return this.dispatch("post", [name, args]); |
| 19436 | }; |
| 19437 | |
| 19438 | /** |
| 19439 | * Invokes a method in a future turn. |
| 19440 | * @param object promise or immediate reference for target object |
| 19441 | * @param name name of method to invoke |
| 19442 | * @param ...args array of invocation arguments |
| 19443 | * @return promise for the return value |
| 19444 | */ |
| 19445 | Q.send = // XXX Mark Miller's proposed parlance |
| 19446 | Q.mcall = // XXX As proposed by "Redsandro" |
| 19447 | Q.invoke = function (object, name /*...args*/) { |
| 19448 | return Q(object).dispatch("post", [name, array_slice(arguments, 2)]); |
| 19449 | }; |
| 19450 | |
| 19451 | Promise.prototype.send = // XXX Mark Miller's proposed parlance |
| 19452 | Promise.prototype.mcall = // XXX As proposed by "Redsandro" |
| 19453 | Promise.prototype.invoke = function (name /*...args*/) { |
| 19454 | return this.dispatch("post", [name, array_slice(arguments, 1)]); |
| 19455 | }; |
| 19456 | |
| 19457 | /** |
| 19458 | * Applies the promised function in a future turn. |
| 19459 | * @param object promise or immediate reference for target function |
| 19460 | * @param args array of application arguments |
| 19461 | */ |
| 19462 | Q.fapply = function (object, args) { |
| 19463 | return Q(object).dispatch("apply", [void 0, args]); |
| 19464 | }; |
| 19465 | |
| 19466 | Promise.prototype.fapply = function (args) { |
| 19467 | return this.dispatch("apply", [void 0, args]); |
| 19468 | }; |
| 19469 | |
| 19470 | /** |
| 19471 | * Calls the promised function in a future turn. |
| 19472 | * @param object promise or immediate reference for target function |
| 19473 | * @param ...args array of application arguments |
| 19474 | */ |
| 19475 | Q["try"] = |
| 19476 | Q.fcall = function (object /* ...args*/) { |
| 19477 | return Q(object).dispatch("apply", [void 0, array_slice(arguments, 1)]); |
| 19478 | }; |
| 19479 | |
| 19480 | Promise.prototype.fcall = function (/*...args*/) { |
| 19481 | return this.dispatch("apply", [void 0, array_slice(arguments)]); |
| 19482 | }; |
| 19483 | |
| 19484 | /** |
| 19485 | * Binds the promised function, transforming return values into a fulfilled |
| 19486 | * promise and thrown errors into a rejected one. |
| 19487 | * @param object promise or immediate reference for target function |
| 19488 | * @param ...args array of application arguments |
| 19489 | */ |
| 19490 | Q.fbind = function (object /*...args*/) { |
| 19491 | var promise = Q(object); |
| 19492 | var args = array_slice(arguments, 1); |
| 19493 | return function fbound() { |
| 19494 | return promise.dispatch("apply", [ |
| 19495 | this, |
| 19496 | args.concat(array_slice(arguments)) |
| 19497 | ]); |
| 19498 | }; |
| 19499 | }; |
| 19500 | Promise.prototype.fbind = function (/*...args*/) { |
| 19501 | var promise = this; |
| 19502 | var args = array_slice(arguments); |
| 19503 | return function fbound() { |
| 19504 | return promise.dispatch("apply", [ |
| 19505 | this, |
| 19506 | args.concat(array_slice(arguments)) |
| 19507 | ]); |
| 19508 | }; |
| 19509 | }; |
| 19510 | |
| 19511 | /** |
| 19512 | * Requests the names of the owned properties of a promised |
| 19513 | * object in a future turn. |
| 19514 | * @param object promise or immediate reference for target object |
| 19515 | * @return promise for the keys of the eventually settled object |
| 19516 | */ |
| 19517 | Q.keys = function (object) { |
| 19518 | return Q(object).dispatch("keys", []); |
| 19519 | }; |
| 19520 | |
| 19521 | Promise.prototype.keys = function () { |
| 19522 | return this.dispatch("keys", []); |
| 19523 | }; |
| 19524 | |
| 19525 | /** |
| 19526 | * Turns an array of promises into a promise for an array. If any of |
| 19527 | * the promises gets rejected, the whole array is rejected immediately. |
| 19528 | * @param {Array*} an array (or promise for an array) of values (or |
| 19529 | * promises for values) |
| 19530 | * @returns a promise for an array of the corresponding values |
| 19531 | */ |
| 19532 | // By Mark Miller |
| 19533 | // http://wiki.ecmascript.org/doku.php?id=strawman:concurrency&rev=1308776521#allfulfilled |
| 19534 | Q.all = all; |
| 19535 | function all(promises) { |
| 19536 | return when(promises, function (promises) { |
| 19537 | var pendingCount = 0; |
| 19538 | var deferred = defer(); |
| 19539 | array_reduce(promises, function (undefined, promise, index) { |
| 19540 | var snapshot; |
| 19541 | if ( |
| 19542 | isPromise(promise) && |
| 19543 | (snapshot = promise.inspect()).state === "fulfilled" |
| 19544 | ) { |
| 19545 | promises[index] = snapshot.value; |
| 19546 | } else { |
| 19547 | ++pendingCount; |
| 19548 | when( |
| 19549 | promise, |
| 19550 | function (value) { |
| 19551 | promises[index] = value; |
| 19552 | if (--pendingCount === 0) { |
| 19553 | deferred.resolve(promises); |
| 19554 | } |
| 19555 | }, |
| 19556 | deferred.reject, |
| 19557 | function (progress) { |
| 19558 | deferred.notify({ index: index, value: progress }); |
| 19559 | } |
| 19560 | ); |
| 19561 | } |
| 19562 | }, void 0); |
| 19563 | if (pendingCount === 0) { |
| 19564 | deferred.resolve(promises); |
| 19565 | } |
| 19566 | return deferred.promise; |
| 19567 | }); |
| 19568 | } |
| 19569 | |
| 19570 | Promise.prototype.all = function () { |
| 19571 | return all(this); |
| 19572 | }; |
| 19573 | |
| 19574 | /** |
| 19575 | * Returns the first resolved promise of an array. Prior rejected promises are |
| 19576 | * ignored. Rejects only if all promises are rejected. |
| 19577 | * @param {Array*} an array containing values or promises for values |
| 19578 | * @returns a promise fulfilled with the value of the first resolved promise, |
| 19579 | * or a rejected promise if all promises are rejected. |
| 19580 | */ |
| 19581 | Q.any = any; |
| 19582 | |
| 19583 | function any(promises) { |
| 19584 | if (promises.length === 0) { |
| 19585 | return Q.resolve(); |
| 19586 | } |
| 19587 | |
| 19588 | var deferred = Q.defer(); |
| 19589 | var pendingCount = 0; |
| 19590 | array_reduce(promises, function (prev, current, index) { |
| 19591 | var promise = promises[index]; |
| 19592 | |
| 19593 | pendingCount++; |
| 19594 | |
| 19595 | when(promise, onFulfilled, onRejected, onProgress); |
| 19596 | function onFulfilled(result) { |
| 19597 | deferred.resolve(result); |
| 19598 | } |
| 19599 | function onRejected() { |
| 19600 | pendingCount--; |
| 19601 | if (pendingCount === 0) { |
| 19602 | deferred.reject(new Error( |
| 19603 | "Can't get fulfillment value from any promise, all " + |
| 19604 | "promises were rejected." |
| 19605 | )); |
| 19606 | } |
| 19607 | } |
| 19608 | function onProgress(progress) { |
| 19609 | deferred.notify({ |
| 19610 | index: index, |
| 19611 | value: progress |
| 19612 | }); |
| 19613 | } |
| 19614 | }, undefined); |
| 19615 | |
| 19616 | return deferred.promise; |
| 19617 | } |
| 19618 | |
| 19619 | Promise.prototype.any = function () { |
| 19620 | return any(this); |
| 19621 | }; |
| 19622 | |
| 19623 | /** |
| 19624 | * Waits for all promises to be settled, either fulfilled or |
| 19625 | * rejected. This is distinct from `all` since that would stop |
| 19626 | * waiting at the first rejection. The promise returned by |
| 19627 | * `allResolved` will never be rejected. |
| 19628 | * @param promises a promise for an array (or an array) of promises |
| 19629 | * (or values) |
| 19630 | * @return a promise for an array of promises |
| 19631 | */ |
| 19632 | Q.allResolved = deprecate(allResolved, "allResolved", "allSettled"); |
| 19633 | function allResolved(promises) { |
| 19634 | return when(promises, function (promises) { |
| 19635 | promises = array_map(promises, Q); |
| 19636 | return when(all(array_map(promises, function (promise) { |
| 19637 | return when(promise, noop, noop); |
| 19638 | })), function () { |
| 19639 | return promises; |
| 19640 | }); |
| 19641 | }); |
| 19642 | } |
| 19643 | |
| 19644 | Promise.prototype.allResolved = function () { |
| 19645 | return allResolved(this); |
| 19646 | }; |
| 19647 | |
| 19648 | /** |
| 19649 | * @see Promise#allSettled |
| 19650 | */ |
| 19651 | Q.allSettled = allSettled; |
| 19652 | function allSettled(promises) { |
| 19653 | return Q(promises).allSettled(); |
| 19654 | } |
| 19655 | |
| 19656 | /** |
| 19657 | * Turns an array of promises into a promise for an array of their states (as |
| 19658 | * returned by `inspect`) when they have all settled. |
| 19659 | * @param {Array[Any*]} values an array (or promise for an array) of values (or |
| 19660 | * promises for values) |
| 19661 | * @returns {Array[State]} an array of states for the respective values. |
| 19662 | */ |
| 19663 | Promise.prototype.allSettled = function () { |
| 19664 | return this.then(function (promises) { |
| 19665 | return all(array_map(promises, function (promise) { |
| 19666 | promise = Q(promise); |
| 19667 | function regardless() { |
| 19668 | return promise.inspect(); |
| 19669 | } |
| 19670 | return promise.then(regardless, regardless); |
| 19671 | })); |
| 19672 | }); |
| 19673 | }; |
| 19674 | |
| 19675 | /** |
| 19676 | * Captures the failure of a promise, giving an oportunity to recover |
| 19677 | * with a callback. If the given promise is fulfilled, the returned |
| 19678 | * promise is fulfilled. |
| 19679 | * @param {Any*} promise for something |
| 19680 | * @param {Function} callback to fulfill the returned promise if the |
| 19681 | * given promise is rejected |
| 19682 | * @returns a promise for the return value of the callback |
| 19683 | */ |
| 19684 | Q.fail = // XXX legacy |
| 19685 | Q["catch"] = function (object, rejected) { |
| 19686 | return Q(object).then(void 0, rejected); |
| 19687 | }; |
| 19688 | |
| 19689 | Promise.prototype.fail = // XXX legacy |
| 19690 | Promise.prototype["catch"] = function (rejected) { |
| 19691 | return this.then(void 0, rejected); |
| 19692 | }; |
| 19693 | |
| 19694 | /** |
| 19695 | * Attaches a listener that can respond to progress notifications from a |
| 19696 | * promise's originating deferred. This listener receives the exact arguments |
| 19697 | * passed to ``deferred.notify``. |
| 19698 | * @param {Any*} promise for something |
| 19699 | * @param {Function} callback to receive any progress notifications |
| 19700 | * @returns the given promise, unchanged |
| 19701 | */ |
| 19702 | Q.progress = progress; |
| 19703 | function progress(object, progressed) { |
| 19704 | return Q(object).then(void 0, void 0, progressed); |
| 19705 | } |
| 19706 | |
| 19707 | Promise.prototype.progress = function (progressed) { |
| 19708 | return this.then(void 0, void 0, progressed); |
| 19709 | }; |
| 19710 | |
| 19711 | /** |
| 19712 | * Provides an opportunity to observe the settling of a promise, |
| 19713 | * regardless of whether the promise is fulfilled or rejected. Forwards |
| 19714 | * the resolution to the returned promise when the callback is done. |
| 19715 | * The callback can return a promise to defer completion. |
| 19716 | * @param {Any*} promise |
| 19717 | * @param {Function} callback to observe the resolution of the given |
| 19718 | * promise, takes no arguments. |
| 19719 | * @returns a promise for the resolution of the given promise when |
| 19720 | * ``fin`` is done. |
| 19721 | */ |
| 19722 | Q.fin = // XXX legacy |
| 19723 | Q["finally"] = function (object, callback) { |
| 19724 | return Q(object)["finally"](callback); |
| 19725 | }; |
| 19726 | |
| 19727 | Promise.prototype.fin = // XXX legacy |
| 19728 | Promise.prototype["finally"] = function (callback) { |
| 19729 | callback = Q(callback); |
| 19730 | return this.then(function (value) { |
| 19731 | return callback.fcall().then(function () { |
| 19732 | return value; |
| 19733 | }); |
| 19734 | }, function (reason) { |
| 19735 | // TODO attempt to recycle the rejection with "this". |
| 19736 | return callback.fcall().then(function () { |
| 19737 | throw reason; |
| 19738 | }); |
| 19739 | }); |
| 19740 | }; |
| 19741 | |
| 19742 | /** |
| 19743 | * Terminates a chain of promises, forcing rejections to be |
| 19744 | * thrown as exceptions. |
| 19745 | * @param {Any*} promise at the end of a chain of promises |
| 19746 | * @returns nothing |
| 19747 | */ |
| 19748 | Q.done = function (object, fulfilled, rejected, progress) { |
| 19749 | return Q(object).done(fulfilled, rejected, progress); |
| 19750 | }; |
| 19751 | |
| 19752 | Promise.prototype.done = function (fulfilled, rejected, progress) { |
| 19753 | var onUnhandledError = function (error) { |
| 19754 | // forward to a future turn so that ``when`` |
| 19755 | // does not catch it and turn it into a rejection. |
| 19756 | Q.nextTick(function () { |
| 19757 | makeStackTraceLong(error, promise); |
| 19758 | if (Q.onerror) { |
| 19759 | Q.onerror(error); |
| 19760 | } else { |
| 19761 | throw error; |
| 19762 | } |
| 19763 | }); |
| 19764 | }; |
| 19765 | |
| 19766 | // Avoid unnecessary `nextTick`ing via an unnecessary `when`. |
| 19767 | var promise = fulfilled || rejected || progress ? |
| 19768 | this.then(fulfilled, rejected, progress) : |
| 19769 | this; |
| 19770 | |
| 19771 | if (typeof process === "object" && process && process.domain) { |
| 19772 | onUnhandledError = process.domain.bind(onUnhandledError); |
| 19773 | } |
| 19774 | |
| 19775 | promise.then(void 0, onUnhandledError); |
| 19776 | }; |
| 19777 | |
| 19778 | /** |
| 19779 | * Causes a promise to be rejected if it does not get fulfilled before |
| 19780 | * some milliseconds time out. |
| 19781 | * @param {Any*} promise |
| 19782 | * @param {Number} milliseconds timeout |
| 19783 | * @param {Any*} custom error message or Error object (optional) |
| 19784 | * @returns a promise for the resolution of the given promise if it is |
| 19785 | * fulfilled before the timeout, otherwise rejected. |
| 19786 | */ |
| 19787 | Q.timeout = function (object, ms, error) { |
| 19788 | return Q(object).timeout(ms, error); |
| 19789 | }; |
| 19790 | |
| 19791 | Promise.prototype.timeout = function (ms, error) { |
| 19792 | var deferred = defer(); |
| 19793 | var timeoutId = setTimeout(function () { |
| 19794 | if (!error || "string" === typeof error) { |
| 19795 | error = new Error(error || "Timed out after " + ms + " ms"); |
| 19796 | error.code = "ETIMEDOUT"; |
| 19797 | } |
| 19798 | deferred.reject(error); |
| 19799 | }, ms); |
| 19800 | |
| 19801 | this.then(function (value) { |
| 19802 | clearTimeout(timeoutId); |
| 19803 | deferred.resolve(value); |
| 19804 | }, function (exception) { |
| 19805 | clearTimeout(timeoutId); |
| 19806 | deferred.reject(exception); |
| 19807 | }, deferred.notify); |
| 19808 | |
| 19809 | return deferred.promise; |
| 19810 | }; |
| 19811 | |
| 19812 | /** |
| 19813 | * Returns a promise for the given value (or promised value), some |
| 19814 | * milliseconds after it resolved. Passes rejections immediately. |
| 19815 | * @param {Any*} promise |
| 19816 | * @param {Number} milliseconds |
| 19817 | * @returns a promise for the resolution of the given promise after milliseconds |
| 19818 | * time has elapsed since the resolution of the given promise. |
| 19819 | * If the given promise rejects, that is passed immediately. |
| 19820 | */ |
| 19821 | Q.delay = function (object, timeout) { |
| 19822 | if (timeout === void 0) { |
| 19823 | timeout = object; |
| 19824 | object = void 0; |
| 19825 | } |
| 19826 | return Q(object).delay(timeout); |
| 19827 | }; |
| 19828 | |
| 19829 | Promise.prototype.delay = function (timeout) { |
| 19830 | return this.then(function (value) { |
| 19831 | var deferred = defer(); |
| 19832 | setTimeout(function () { |
| 19833 | deferred.resolve(value); |
| 19834 | }, timeout); |
| 19835 | return deferred.promise; |
| 19836 | }); |
| 19837 | }; |
| 19838 | |
| 19839 | /** |
| 19840 | * Passes a continuation to a Node function, which is called with the given |
| 19841 | * arguments provided as an array, and returns a promise. |
| 19842 | * |
| 19843 | * Q.nfapply(FS.readFile, [__filename]) |
| 19844 | * .then(function (content) { |
| 19845 | * }) |
| 19846 | * |
| 19847 | */ |
| 19848 | Q.nfapply = function (callback, args) { |
| 19849 | return Q(callback).nfapply(args); |
| 19850 | }; |
| 19851 | |
| 19852 | Promise.prototype.nfapply = function (args) { |
| 19853 | var deferred = defer(); |
| 19854 | var nodeArgs = array_slice(args); |
| 19855 | nodeArgs.push(deferred.makeNodeResolver()); |
| 19856 | this.fapply(nodeArgs).fail(deferred.reject); |
| 19857 | return deferred.promise; |
| 19858 | }; |
| 19859 | |
| 19860 | /** |
| 19861 | * Passes a continuation to a Node function, which is called with the given |
| 19862 | * arguments provided individually, and returns a promise. |
| 19863 | * @example |
| 19864 | * Q.nfcall(FS.readFile, __filename) |
| 19865 | * .then(function (content) { |
| 19866 | * }) |
| 19867 | * |
| 19868 | */ |
| 19869 | Q.nfcall = function (callback /*...args*/) { |
| 19870 | var args = array_slice(arguments, 1); |
| 19871 | return Q(callback).nfapply(args); |
| 19872 | }; |
| 19873 | |
| 19874 | Promise.prototype.nfcall = function (/*...args*/) { |
| 19875 | var nodeArgs = array_slice(arguments); |
| 19876 | var deferred = defer(); |
| 19877 | nodeArgs.push(deferred.makeNodeResolver()); |
| 19878 | this.fapply(nodeArgs).fail(deferred.reject); |
| 19879 | return deferred.promise; |
| 19880 | }; |
| 19881 | |
| 19882 | /** |
| 19883 | * Wraps a NodeJS continuation passing function and returns an equivalent |
| 19884 | * version that returns a promise. |
| 19885 | * @example |
| 19886 | * Q.nfbind(FS.readFile, __filename)("utf-8") |
| 19887 | * .then(console.log) |
| 19888 | * .done() |
| 19889 | */ |
| 19890 | Q.nfbind = |
| 19891 | Q.denodeify = function (callback /*...args*/) { |
| 19892 | var baseArgs = array_slice(arguments, 1); |
| 19893 | return function () { |
| 19894 | var nodeArgs = baseArgs.concat(array_slice(arguments)); |
| 19895 | var deferred = defer(); |
| 19896 | nodeArgs.push(deferred.makeNodeResolver()); |
| 19897 | Q(callback).fapply(nodeArgs).fail(deferred.reject); |
| 19898 | return deferred.promise; |
| 19899 | }; |
| 19900 | }; |
| 19901 | |
| 19902 | Promise.prototype.nfbind = |
| 19903 | Promise.prototype.denodeify = function (/*...args*/) { |
| 19904 | var args = array_slice(arguments); |
| 19905 | args.unshift(this); |
| 19906 | return Q.denodeify.apply(void 0, args); |
| 19907 | }; |
| 19908 | |
| 19909 | Q.nbind = function (callback, thisp /*...args*/) { |
| 19910 | var baseArgs = array_slice(arguments, 2); |
| 19911 | return function () { |
| 19912 | var nodeArgs = baseArgs.concat(array_slice(arguments)); |
| 19913 | var deferred = defer(); |
| 19914 | nodeArgs.push(deferred.makeNodeResolver()); |
| 19915 | function bound() { |
| 19916 | return callback.apply(thisp, arguments); |
| 19917 | } |
| 19918 | Q(bound).fapply(nodeArgs).fail(deferred.reject); |
| 19919 | return deferred.promise; |
| 19920 | }; |
| 19921 | }; |
| 19922 | |
| 19923 | Promise.prototype.nbind = function (/*thisp, ...args*/) { |
| 19924 | var args = array_slice(arguments, 0); |
| 19925 | args.unshift(this); |
| 19926 | return Q.nbind.apply(void 0, args); |
| 19927 | }; |
| 19928 | |
| 19929 | /** |
| 19930 | * Calls a method of a Node-style object that accepts a Node-style |
| 19931 | * callback with a given array of arguments, plus a provided callback. |
| 19932 | * @param object an object that has the named method |
| 19933 | * @param {String} name name of the method of object |
| 19934 | * @param {Array} args arguments to pass to the method; the callback |
| 19935 | * will be provided by Q and appended to these arguments. |
| 19936 | * @returns a promise for the value or error |
| 19937 | */ |
| 19938 | Q.nmapply = // XXX As proposed by "Redsandro" |
| 19939 | Q.npost = function (object, name, args) { |
| 19940 | return Q(object).npost(name, args); |
| 19941 | }; |
| 19942 | |
| 19943 | Promise.prototype.nmapply = // XXX As proposed by "Redsandro" |
| 19944 | Promise.prototype.npost = function (name, args) { |
| 19945 | var nodeArgs = array_slice(args || []); |
| 19946 | var deferred = defer(); |
| 19947 | nodeArgs.push(deferred.makeNodeResolver()); |
| 19948 | this.dispatch("post", [name, nodeArgs]).fail(deferred.reject); |
| 19949 | return deferred.promise; |
| 19950 | }; |
| 19951 | |
| 19952 | /** |
| 19953 | * Calls a method of a Node-style object that accepts a Node-style |
| 19954 | * callback, forwarding the given variadic arguments, plus a provided |
| 19955 | * callback argument. |
| 19956 | * @param object an object that has the named method |
| 19957 | * @param {String} name name of the method of object |
| 19958 | * @param ...args arguments to pass to the method; the callback will |
| 19959 | * be provided by Q and appended to these arguments. |
| 19960 | * @returns a promise for the value or error |
| 19961 | */ |
| 19962 | Q.nsend = // XXX Based on Mark Miller's proposed "send" |
| 19963 | Q.nmcall = // XXX Based on "Redsandro's" proposal |
| 19964 | Q.ninvoke = function (object, name /*...args*/) { |
| 19965 | var nodeArgs = array_slice(arguments, 2); |
| 19966 | var deferred = defer(); |
| 19967 | nodeArgs.push(deferred.makeNodeResolver()); |
| 19968 | Q(object).dispatch("post", [name, nodeArgs]).fail(deferred.reject); |
| 19969 | return deferred.promise; |
| 19970 | }; |
| 19971 | |
| 19972 | Promise.prototype.nsend = // XXX Based on Mark Miller's proposed "send" |
| 19973 | Promise.prototype.nmcall = // XXX Based on "Redsandro's" proposal |
| 19974 | Promise.prototype.ninvoke = function (name /*...args*/) { |
| 19975 | var nodeArgs = array_slice(arguments, 1); |
| 19976 | var deferred = defer(); |
| 19977 | nodeArgs.push(deferred.makeNodeResolver()); |
| 19978 | this.dispatch("post", [name, nodeArgs]).fail(deferred.reject); |
| 19979 | return deferred.promise; |
| 19980 | }; |
| 19981 | |
| 19982 | /** |
| 19983 | * If a function would like to support both Node continuation-passing-style and |
| 19984 | * promise-returning-style, it can end its internal promise chain with |
| 19985 | * `nodeify(nodeback)`, forwarding the optional nodeback argument. If the user |
| 19986 | * elects to use a nodeback, the result will be sent there. If they do not |
| 19987 | * pass a nodeback, they will receive the result promise. |
| 19988 | * @param object a result (or a promise for a result) |
| 19989 | * @param {Function} nodeback a Node.js-style callback |
| 19990 | * @returns either the promise or nothing |
| 19991 | */ |
| 19992 | Q.nodeify = nodeify; |
| 19993 | function nodeify(object, nodeback) { |
| 19994 | return Q(object).nodeify(nodeback); |
| 19995 | } |
| 19996 | |
| 19997 | Promise.prototype.nodeify = function (nodeback) { |
| 19998 | if (nodeback) { |
| 19999 | this.then(function (value) { |
| 20000 | Q.nextTick(function () { |
| 20001 | nodeback(null, value); |
| 20002 | }); |
| 20003 | }, function (error) { |
| 20004 | Q.nextTick(function () { |
| 20005 | nodeback(error); |
| 20006 | }); |
| 20007 | }); |
| 20008 | } else { |
| 20009 | return this; |
| 20010 | } |
| 20011 | }; |
| 20012 | |
| 20013 | Q.noConflict = function() { |
| 20014 | throw new Error("Q.noConflict only works when Q is used as a global"); |
| 20015 | }; |
| 20016 | |
| 20017 | // All code before this point will be filtered from stack traces. |
| 20018 | var qEndingLine = captureLine(); |
| 20019 | |
| 20020 | return Q; |
| 20021 | |
| 20022 | }); |
| 20023 | |
| 20024 | }).call(this,require('_process')) |
| 20025 | //# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9xL3EuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQU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GZhbHNlO1xuICAgIH1cbiAgICAvLyBydW5zIGEgc2luZ2xlIGZ1bmN0aW9uIGluIHRoZSBhc3luYyBxdWV1ZVxuICAgIGZ1bmN0aW9uIHJ1blNpbmdsZSh0YXNrLCBkb21haW4pIHtcbiAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgIHRhc2soKTtcblxuICAgICAgICB9IGNhdGNoIChlKSB7XG4gICAgICAgICAgICBpZiAoaXNOb2RlSlMpIHtcbiAgICAgICAgICAgICAgICAvLyBJbiBub2RlLCB1bmNhdWdodCBleGNlcHRpb25zIGFyZSBjb25zaWRlcmVkIGZhdGFsIGVycm9ycy5cbiAgICAgICAgICAgICAgICAvLyBSZS10aHJvdyB0aGVtIHN5bmNocm9ub3VzbHkgdG8gaW50ZXJydXB0IGZsdXNoaW5nIVxuXG4gICAgICAgICAgICAgICAgLy8gRW5zdXJlIGNvbnRpbnVhdGlvbiBpZiB0aGUgdW5jYXVnaHQgZXhjZXB0aW9uIGlzIHN1cHByZXNzZWRcbiAgICAgICAgICAgICAgICAvLyBsaXN0ZW5pbmcgXCJ1bmNhdWdodEV4Y2VwdGlvblwiIGV2ZW50cyAoYXMgZG9tYWlucyBkb2VzKS5cbiAgICAgICAgICAgICAgICAvLyBDb250aW51ZSBpbiBuZXh0IGV2ZW50IHRvIGF2b2lkIHRpY2sgcmVjdXJzaW9uLlxuICAgICAgICAgICAgICAgIGlmIChkb21haW4pIHtcbiAgICAgICAgICAgICAgICAgICAgZG9tYWluLmV4aXQoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgc2V0VGltZW91dChmbHVzaCwgMCk7XG4gICAgICAgICAgICAgICAgaWYgKGRvbWFpbikge1xuICAgICAgICAgICAgICAgICAgICBkb21haW4uZW50ZXIoKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICB0aHJvdyBlO1xuXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIC8vIEluIGJyb3dzZXJzLCB1bmNhdWdodCBleGNlcHRpb25zIGFyZSBub3QgZmF0YWwuXG4gICAgICAgICAgICAgICAgLy8gUmUtdGhyb3cgdGhlbSBhc3luY2hyb25vdXNseSB0byBhdm9pZCBzbG93LWRvd25zLlxuICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBlO1xuICAgICAgICAgICAgICAgIH0sIDApO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGRvbWFpbikge1xuICAgICAgICAgICAgZG9tYWluLmV4aXQoKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIG5leHRUaWNrID0gZnVuY3Rpb24gKHRhc2spIHtcbiAgICAgICAgdGFpbCA9IHRhaWwubmV4dCA9IHtcbiAgICAgICAgICAgIHRhc2s6IHRhc2ssXG4gICAgICAgICAgICBkb21haW46IGlzTm9kZUpTICYmIHByb2Nlc3MuZG9tYWluLFxuICAgICAgICAgICAgbmV4dDogbnVsbFxuICAgICAgICB9O1xuXG4gICAgICAgIGlmICghZmx1c2hpbmcpIHtcbiAgICAgICAgICAgIGZsdXNoaW5nID0gdHJ1ZTtcbiAgICAgICAgICAgIHJlcXVlc3RUaWNrKCk7XG4gICAgICAgIH1cbiAgICB9O1xuXG4gICAgaWYgKHR5cGVvZiBwcm9jZXNzID09PSBcIm9iamVjdFwiICYmXG4gICAgICAgIHByb2Nlc3MudG9TdHJpbmcoKSA9PT0gXCJbb2JqZWN0IHByb2Nlc3NdXCIgJiYgcHJvY2Vzcy5uZXh0VGljaykge1xuICAgICAgICAvLyBFbnN1cmUgUSBpcyBpbiBhIHJlYWwgTm9kZSBlbnZpcm9ubWVudCwgd2l0aCBhIGBwcm9jZXNzLm5leHRUaWNrYC5cbiAgICAgICAgLy8gVG8gc2VlIHRocm91Z2ggZmFrZSBOb2RlIGVudmlyb25tZW50czpcbiAgICAgICAgLy8gKiBNb2N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IGluZGV4ID0gMCxcbiAgICAgICAgICAgIGxlbmd0aCA9IHRoaXMubGVuZ3RoO1xuICAgICAgICAvLyBjb25jZXJuaW5nIHRoZSBpbml0aWFsIHZhbHVlLCBpZiBvbmUgaXMgbm90IHByb3ZpZGVkXG4gICAgICAgIGlmIChhcmd1bWVudHMubGVuZ3RoID09PSAxKSB7XG4gICAgICAgICAgICAvLyBzZWVrIHRvIHRoZSBmaXJzdCB2YWx1ZSBpbiB0aGUgYXJyYXksIGFjY291bnRpbmdcbiAgICAgICAgICAgIC8vIGZvciB0aGUgcG9zc2liaWxpdHkgdGhhdCBpcyBpcyBhIHNwYXJzZSBhcnJheVxuICAgICAgICAgICAgZG8ge1xuICAgICAgICAgICAgICAgIGlmIChpbmRleCBpbiB0aGlzKSB7XG4gICAgICAgICAgICAgICAgICAgIGJhc2lzID0gdGhpc1tpbmRleCsrXTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmICgrK2luZGV4ID49IGxlbmd0aCkge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSB3aGlsZSAoMSk7XG4gICAgICAgIH1cbiAgICAgICAgLy8gcmVkdWNlXG4gICAgICAgIGZvciAoOyBpbmRleCA8IGxlbmd0aDsgaW5kZXgrKykge1xuICAgICAgICAgICAgLy8gYWNjb3VudCBmb3IgdGhlIHBvc3NpYmlsaXR5IHRoYXQgdGhlIGFycmF5IGlzIHNwYXJzZVxuICAgICAgICAgICAgaWYgKGluZGV4IGluIHRoaXMpIHtcbiAgICAgICAgICAgICAgICBiYXNpcyA9IGNhbGxiYWNrKGJhc2lzLCB0aGlzW2luZGV4XSwgaW5kZXgpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBiYXNpcztcbiAgICB9XG4pO1xuXG52YXIgYX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25nKGV4Y2VwdGlvbiwgc2VsZik7XG4gICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgIHJldHVybiByZWplY3RlZChleGNlcHRpb24pO1xuICAgICAgICAgICAgfSBjYXRjaCAobmV3RXhjZXB0aW9uKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHJlamVjdChuZXdFeGNlcHRpb24pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZWplY3QoZXhjZXB0aW9uKTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBfcHJvZ3Jlc3NlZCh2YWx1ZSkge1xuICAgICAgICByZXR1cm4gdHlwZW9mIHByb2dyZXNzZWQgPT09IFwiZnVuY3Rpb25cIiA/IHByb2dyZXNzZWQodmFsdWUpIDogdmFsdWU7XG4gICAgfVxuXG4gICAgUS5uZXh0VGljayhmdW5jdGlvbiAoKSB7XG4gICAgICAgIHNlbGYucHJvbWlzZURpc3BhdGNoKGZ1bmN0aW9uICh2YWx1ZSkge1xuICAgICAgICAgICAgaWYgKGRvbmUpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBkb25lID0gdHJ1ZTtcblxuICAgICAgICAgICAgZGVmZXJyZWQucmVzb2x2ZShfZnVsZmlsbGVkKHZhbHVlKSk7XG4gICAgICAgIH0sIFwid2hlblwiLCBbZnVuY3Rpb24gKGV4Y2VwdGlvbikge1xuICAgICAgICAgICAgaWYgKGRvbmUpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBkb25lID0gdHJ1ZTtcblxuICAgICAgICAgICAgZGVmZXJyZWQucmVzb2x2ZShfcmVqZWN0ZWQoZXhjZXB0aW9uKSk7XG4gICAgICAgIH1dKTtcbiAgICB9KTtcblxuICAgIC8vIFByb2dyZXNzIHByb3BhZ2F0b3IgbmVlZCB0byBiZSBhdHRhY2hlZCBpbiB0aGUgY3V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ICAgICAgICAgICAvLyBsaWtlIHRvIG1ha2UgaXQgcG9zc2libGUgdG8gdXNlIGdlbmVyYXRvcnMgaW4gZGVwbG95ZWQgYnJvd3NlcnMsIHNvXG4gICAgICAgICAgICAvLyB3ZSBhbHNvIHN1cHBvcnQgUHl0aG9uLXN0eWxlIGdlbmVyYXRvcnMuICBBdCBzb21lIHBvaW50IHdlIGNhbiByZW1vdmVcbiAgICAgICAgICAgIC8vIHRoaXMgYmxvY2suXG5cbiAgICAgICAgICAgIGlmICh0eXBlb2YgU3RvcEl0ZXJhdGlvbiA9PT0gXCJ1bmRlZmluZWRcIikge1xuICAgICAgICAgICAgICAgIC8vIEVTNiBHZW5lcmF0b3JzXG4gICAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAgICAgcmVzdWx0ID0gZ2VuZXJhdG9yW3ZlcmJdKGFyZyk7XG4gICAgICAgICAgICAgICAgfSBjYXRjaCAoZXhjZXB0aW9uKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiByZWplY3QoZXhjZXB0aW9uKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKHJlc3VsdC5kb25lKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBRKHJlc3VsdC52YWx1ZSk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdoZW4ocmVzdWx0LnZhbHVlLCBjYWxsYmFjaywgZXJyYmFjayk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAvLyBTcGlkZXJNb25rZXkgR2VuZXJhdG9yc1xuICAgICAgICAgICAgICAgIC8vIEZJWE1FOiBSZW1vdmUgdGhpcyBjYXNlIHdoZW4gU00gZG9lcyBFUzYgZ2VuZXJhdG9ycy5cbiAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICByZXN1bHQg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AwO1xuICAgICAgICB2YXIgZGVmZXJyZWQgPSBkZWZlcigpO1xuICAgICAgICBhcnJheV9yZWR1Y2UocHJvbWlzZXMsIGZ1bmN0aW9uICh1bmRlZmluZWQsIHByb21pc2UsIGluZGV4KSB7XG4gICAgICAgICAgICB2YXIgc25hcHNob3Q7XG4gICAgICAgICAgICBpZiAoXG4gICAgICAgICAgICAgICAgaXNQcm9taXNlKHByb21pc2UpICYmXG4gICAgICAgICAgICAgICAgKHNuYXBzaG90ID0gcHJvbWlzZS5pbnNwZWN0KCkpLnN0YXRlID09PSBcImZ1bGZpbGxlZFwiXG4gICAgICAgICAgICApIHtcbiAgICAgICAgICAgICAgICBwcm9taXNlc1tpbmRleF0gPSBzbmFwc2hvdC52YWx1ZTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgKytwZW5kaW5nQ291bnQ7XG4gICAgICAgICAgICAgICAgd2hlbihcbiAgICAgICAgICAgICAgICAgICAgcHJvbWlzZSxcbiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBwcm9taXNlc1tpbmRleF0gPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgtLXBlbmRpbmdDb3VudCA9PT0gMCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmVycmVkLnJlc29sdmUocHJvbWlzZXMpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgICAgICBkZWZlcnJlZC5yZWplY3QsXG4gICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChwcm9ncmVzcykge1xuICAgICAgICAgICAgICAgICAgICAgICAgZGVmZXJyZWQubm90aWZ5KHsgaW5kZXg6IGluZGV4LCB2YWx1ZTogcHJvZ3Jlc3MgfSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICA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IgcHJvbWlzZSA9IHByb21pc2VzW2luZGV4XTtcblxuICAgICAgICBwZW5kaW5nQ291bnQrKztcblxuICAgICAgICB3aGVuKHByb21pc2UsIG9uRnVsZmlsbGVkLCBvblJlamVjdGVkLCBvblByb2dyZXNzKTtcbiAgICAgICAgZnVuY3Rpb24gb25GdWxmaWxsZWQocmVzdWx0KSB7XG4gICAgICAgICAgICBkZWZlcnJlZC5yZXNvbHZlKHJlc3VsdCk7XG4gICAgICAgIH1cbiAgICAgICAgZnVuY3Rpb24gb25SZWplY3RlZCgpIHtcbiAgICAgICAgICAgIHBlbmRpbmdDb3VudC0tO1xuICAgICAgICAgICAgaWYgKHBlbmRpbmdDb3VudCA9PT0gMCkge1xuICAgICAgICAgICAgICAgIGRlZmVycmVkLnJlamVjdChuZXcgRXJyb3IoXG4gICAgICAgICAgICAgICAgICAgIFwiQ2FuJ3QgZ2V0IGZ1bGZpbGxtZW50IHZhbHVlIGZyb20gYW55IHByb21pc2UsIGFsbCBcIiArXG4gICAgICAgICAgICAgICAgICAgIFwicHJvbWlzZXMgd2VyZSByZWplY3RlZC5cIlxuICAgICAgICAgICAgICAgICkpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGZ1bmN0aW9uIG9uUHJvZ3Jlc3MocHJvZ3Jlc3MpIHtcbiAgICAgICAgICAgIGRlZmVycmVkLm5vdGlmeSh7XG4gICAgICAgICAgICAgICAgaW5kZXg6IGluZGV4LFxuICAgICAgICAgICAgICAgIHZhbHVlOiBwcm9ncmVzc1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICB9LCB1bmRlZmluZWQpO1xuXG4gICAgcmV0dXJuIGRlZmVycmVkLnByb21pc2U7XG59XG5cblByb21pc2UucHJvdG90eXBlLmFueSA9IGZ1bmN0aW9uICgpIHtcbiAgICByZXR1cm4gYW55KHRoaXMpO1xufTtcblxuLyoqXG4gKiBXYWl0cyBmb3IgYWxsIHByb21pc2VzIHRvIGJlIHNldHR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lZm9yZSB0aGlzIHBvaW50IHdpbGwgYmUgZmlsdGVyZWQgZnJvbSBzdGFjayB0cmFjZXMuXG52YXIgcUVuZGluZ0xpbmUgPSBjYXB0dXJlTGluZSgpO1xuXG5yZXR1cm4gUTtcblxufSk7XG4iXX0= |
| 20026 | },{"_process":12}],158:[function(require,module,exports){ |
| 20027 | /** |
| 20028 | * Root reference for iframes. |
| 20029 | */ |
| 20030 | |
| 20031 | var root; |
| 20032 | if (typeof window !== 'undefined') { // Browser window |
| 20033 | root = window; |
| 20034 | } else if (typeof self !== 'undefined') { // Web Worker |
| 20035 | root = self; |
| 20036 | } else { // Other environments |
| 20037 | console.warn("Using browser-only version of superagent in non-browser environment"); |
| 20038 | root = this; |
| 20039 | } |
| 20040 | |
| 20041 | var Emitter = require('emitter'); |
| 20042 | var requestBase = require('./request-base'); |
| 20043 | var isObject = require('./is-object'); |
| 20044 | |
| 20045 | /** |
| 20046 | * Noop. |
| 20047 | */ |
| 20048 | |
| 20049 | function noop(){}; |
| 20050 | |
| 20051 | /** |
| 20052 | * Expose `request`. |
| 20053 | */ |
| 20054 | |
| 20055 | var request = module.exports = require('./request').bind(null, Request); |
| 20056 | |
| 20057 | /** |
| 20058 | * Determine XHR. |
| 20059 | */ |
| 20060 | |
| 20061 | request.getXHR = function () { |
| 20062 | if (root.XMLHttpRequest |
| 20063 | && (!root.location || 'file:' != root.location.protocol |
| 20064 | || !root.ActiveXObject)) { |
| 20065 | return new XMLHttpRequest; |
| 20066 | } else { |
| 20067 | try { return new ActiveXObject('Microsoft.XMLHTTP'); } catch(e) {} |
| 20068 | try { return new ActiveXObject('Msxml2.XMLHTTP.6.0'); } catch(e) {} |
| 20069 | try { return new ActiveXObject('Msxml2.XMLHTTP.3.0'); } catch(e) {} |
| 20070 | try { return new ActiveXObject('Msxml2.XMLHTTP'); } catch(e) {} |
| 20071 | } |
| 20072 | throw Error("Browser-only verison of superagent could not find XHR"); |
| 20073 | }; |
| 20074 | |
| 20075 | /** |
| 20076 | * Removes leading and trailing whitespace, added to support IE. |
| 20077 | * |
| 20078 | * @param {String} s |
| 20079 | * @return {String} |
| 20080 | * @api private |
| 20081 | */ |
| 20082 | |
| 20083 | var trim = ''.trim |
| 20084 | ? function(s) { return s.trim(); } |
| 20085 | : function(s) { return s.replace(/(^\s*|\s*$)/g, ''); }; |
| 20086 | |
| 20087 | /** |
| 20088 | * Serialize the given `obj`. |
| 20089 | * |
| 20090 | * @param {Object} obj |
| 20091 | * @return {String} |
| 20092 | * @api private |
| 20093 | */ |
| 20094 | |
| 20095 | function serialize(obj) { |
| 20096 | if (!isObject(obj)) return obj; |
| 20097 | var pairs = []; |
| 20098 | for (var key in obj) { |
| 20099 | pushEncodedKeyValuePair(pairs, key, obj[key]); |
| 20100 | } |
| 20101 | return pairs.join('&'); |
| 20102 | } |
| 20103 | |
| 20104 | /** |
| 20105 | * Helps 'serialize' with serializing arrays. |
| 20106 | * Mutates the pairs array. |
| 20107 | * |
| 20108 | * @param {Array} pairs |
| 20109 | * @param {String} key |
| 20110 | * @param {Mixed} val |
| 20111 | */ |
| 20112 | |
| 20113 | function pushEncodedKeyValuePair(pairs, key, val) { |
| 20114 | if (val != null) { |
| 20115 | if (Array.isArray(val)) { |
| 20116 | val.forEach(function(v) { |
| 20117 | pushEncodedKeyValuePair(pairs, key, v); |
| 20118 | }); |
| 20119 | } else if (isObject(val)) { |
| 20120 | for(var subkey in val) { |
| 20121 | pushEncodedKeyValuePair(pairs, key + '[' + subkey + ']', val[subkey]); |
| 20122 | } |
| 20123 | } else { |
| 20124 | pairs.push(encodeURIComponent(key) |
| 20125 | + '=' + encodeURIComponent(val)); |
| 20126 | } |
| 20127 | } else if (val === null) { |
| 20128 | pairs.push(encodeURIComponent(key)); |
| 20129 | } |
| 20130 | } |
| 20131 | |
| 20132 | /** |
| 20133 | * Expose serialization method. |
| 20134 | */ |
| 20135 | |
| 20136 | request.serializeObject = serialize; |
| 20137 | |
| 20138 | /** |
| 20139 | * Parse the given x-www-form-urlencoded `str`. |
| 20140 | * |
| 20141 | * @param {String} str |
| 20142 | * @return {Object} |
| 20143 | * @api private |
| 20144 | */ |
| 20145 | |
| 20146 | function parseString(str) { |
| 20147 | var obj = {}; |
| 20148 | var pairs = str.split('&'); |
| 20149 | var pair; |
| 20150 | var pos; |
| 20151 | |
| 20152 | for (var i = 0, len = pairs.length; i < len; ++i) { |
| 20153 | pair = pairs[i]; |
| 20154 | pos = pair.indexOf('='); |
| 20155 | if (pos == -1) { |
| 20156 | obj[decodeURIComponent(pair)] = ''; |
| 20157 | } else { |
| 20158 | obj[decodeURIComponent(pair.slice(0, pos))] = |
| 20159 | decodeURIComponent(pair.slice(pos + 1)); |
| 20160 | } |
| 20161 | } |
| 20162 | |
| 20163 | return obj; |
| 20164 | } |
| 20165 | |
| 20166 | /** |
| 20167 | * Expose parser. |
| 20168 | */ |
| 20169 | |
| 20170 | request.parseString = parseString; |
| 20171 | |
| 20172 | /** |
| 20173 | * Default MIME type map. |
| 20174 | * |
| 20175 | * superagent.types.xml = 'application/xml'; |
| 20176 | * |
| 20177 | */ |
| 20178 | |
| 20179 | request.types = { |
| 20180 | html: 'text/html', |
| 20181 | json: 'application/json', |
| 20182 | xml: 'application/xml', |
| 20183 | urlencoded: 'application/x-www-form-urlencoded', |
| 20184 | 'form': 'application/x-www-form-urlencoded', |
| 20185 | 'form-data': 'application/x-www-form-urlencoded' |
| 20186 | }; |
| 20187 | |
| 20188 | /** |
| 20189 | * Default serialization map. |
| 20190 | * |
| 20191 | * superagent.serialize['application/xml'] = function(obj){ |
| 20192 | * return 'generated xml here'; |
| 20193 | * }; |
| 20194 | * |
| 20195 | */ |
| 20196 | |
| 20197 | request.serialize = { |
| 20198 | 'application/x-www-form-urlencoded': serialize, |
| 20199 | 'application/json': JSON.stringify |
| 20200 | }; |
| 20201 | |
| 20202 | /** |
| 20203 | * Default parsers. |
| 20204 | * |
| 20205 | * superagent.parse['application/xml'] = function(str){ |
| 20206 | * return { object parsed from str }; |
| 20207 | * }; |
| 20208 | * |
| 20209 | */ |
| 20210 | |
| 20211 | request.parse = { |
| 20212 | 'application/x-www-form-urlencoded': parseString, |
| 20213 | 'application/json': JSON.parse |
| 20214 | }; |
| 20215 | |
| 20216 | /** |
| 20217 | * Parse the given header `str` into |
| 20218 | * an object containing the mapped fields. |
| 20219 | * |
| 20220 | * @param {String} str |
| 20221 | * @return {Object} |
| 20222 | * @api private |
| 20223 | */ |
| 20224 | |
| 20225 | function parseHeader(str) { |
| 20226 | var lines = str.split(/\r?\n/); |
| 20227 | var fields = {}; |
| 20228 | var index; |
| 20229 | var line; |
| 20230 | var field; |
| 20231 | var val; |
| 20232 | |
| 20233 | lines.pop(); // trailing CRLF |
| 20234 | |
| 20235 | for (var i = 0, len = lines.length; i < len; ++i) { |
| 20236 | line = lines[i]; |
| 20237 | index = line.indexOf(':'); |
| 20238 | field = line.slice(0, index).toLowerCase(); |
| 20239 | val = trim(line.slice(index + 1)); |
| 20240 | fields[field] = val; |
| 20241 | } |
| 20242 | |
| 20243 | return fields; |
| 20244 | } |
| 20245 | |
| 20246 | /** |
| 20247 | * Check if `mime` is json or has +json structured syntax suffix. |
| 20248 | * |
| 20249 | * @param {String} mime |
| 20250 | * @return {Boolean} |
| 20251 | * @api private |
| 20252 | */ |
| 20253 | |
| 20254 | function isJSON(mime) { |
| 20255 | return /[\/+]json\b/.test(mime); |
| 20256 | } |
| 20257 | |
| 20258 | /** |
| 20259 | * Return the mime type for the given `str`. |
| 20260 | * |
| 20261 | * @param {String} str |
| 20262 | * @return {String} |
| 20263 | * @api private |
| 20264 | */ |
| 20265 | |
| 20266 | function type(str){ |
| 20267 | return str.split(/ *; */).shift(); |
| 20268 | }; |
| 20269 | |
| 20270 | /** |
| 20271 | * Return header field parameters. |
| 20272 | * |
| 20273 | * @param {String} str |
| 20274 | * @return {Object} |
| 20275 | * @api private |
| 20276 | */ |
| 20277 | |
| 20278 | function params(str){ |
| 20279 | return str.split(/ *; */).reduce(function(obj, str){ |
| 20280 | var parts = str.split(/ *= */), |
| 20281 | key = parts.shift(), |
| 20282 | val = parts.shift(); |
| 20283 | |
| 20284 | if (key && val) obj[key] = val; |
| 20285 | return obj; |
| 20286 | }, {}); |
| 20287 | }; |
| 20288 | |
| 20289 | /** |
| 20290 | * Initialize a new `Response` with the given `xhr`. |
| 20291 | * |
| 20292 | * - set flags (.ok, .error, etc) |
| 20293 | * - parse header |
| 20294 | * |
| 20295 | * Examples: |
| 20296 | * |
| 20297 | * Aliasing `superagent` as `request` is nice: |
| 20298 | * |
| 20299 | * request = superagent; |
| 20300 | * |
| 20301 | * We can use the promise-like API, or pass callbacks: |
| 20302 | * |
| 20303 | * request.get('/').end(function(res){}); |
| 20304 | * request.get('/', function(res){}); |
| 20305 | * |
| 20306 | * Sending data can be chained: |
| 20307 | * |
| 20308 | * request |
| 20309 | * .post('/user') |
| 20310 | * .send({ name: 'tj' }) |
| 20311 | * .end(function(res){}); |
| 20312 | * |
| 20313 | * Or passed to `.send()`: |
| 20314 | * |
| 20315 | * request |
| 20316 | * .post('/user') |
| 20317 | * .send({ name: 'tj' }, function(res){}); |
| 20318 | * |
| 20319 | * Or passed to `.post()`: |
| 20320 | * |
| 20321 | * request |
| 20322 | * .post('/user', { name: 'tj' }) |
| 20323 | * .end(function(res){}); |
| 20324 | * |
| 20325 | * Or further reduced to a single call for simple cases: |
| 20326 | * |
| 20327 | * request |
| 20328 | * .post('/user', { name: 'tj' }, function(res){}); |
| 20329 | * |
| 20330 | * @param {XMLHTTPRequest} xhr |
| 20331 | * @param {Object} options |
| 20332 | * @api private |
| 20333 | */ |
| 20334 | |
| 20335 | function Response(req, options) { |
| 20336 | options = options || {}; |
| 20337 | this.req = req; |
| 20338 | this.xhr = this.req.xhr; |
| 20339 | // responseText is accessible only if responseType is '' or 'text' and on older browsers |
| 20340 | this.text = ((this.req.method !='HEAD' && (this.xhr.responseType === '' || this.xhr.responseType === 'text')) || typeof this.xhr.responseType === 'undefined') |
| 20341 | ? this.xhr.responseText |
| 20342 | : null; |
| 20343 | this.statusText = this.req.xhr.statusText; |
| 20344 | this._setStatusProperties(this.xhr.status); |
| 20345 | this.header = this.headers = parseHeader(this.xhr.getAllResponseHeaders()); |
| 20346 | // getAllResponseHeaders sometimes falsely returns "" for CORS requests, but |
| 20347 | // getResponseHeader still works. so we get content-type even if getting |
| 20348 | // other headers fails. |
| 20349 | this.header['content-type'] = this.xhr.getResponseHeader('content-type'); |
| 20350 | this._setHeaderProperties(this.header); |
| 20351 | this.body = this.req.method != 'HEAD' |
| 20352 | ? this._parseBody(this.text ? this.text : this.xhr.response) |
| 20353 | : null; |
| 20354 | } |
| 20355 | |
| 20356 | /** |
| 20357 | * Get case-insensitive `field` value. |
| 20358 | * |
| 20359 | * @param {String} field |
| 20360 | * @return {String} |
| 20361 | * @api public |
| 20362 | */ |
| 20363 | |
| 20364 | Response.prototype.get = function(field){ |
| 20365 | return this.header[field.toLowerCase()]; |
| 20366 | }; |
| 20367 | |
| 20368 | /** |
| 20369 | * Set header related properties: |
| 20370 | * |
| 20371 | * - `.type` the content type without params |
| 20372 | * |
| 20373 | * A response of "Content-Type: text/plain; charset=utf-8" |
| 20374 | * will provide you with a `.type` of "text/plain". |
| 20375 | * |
| 20376 | * @param {Object} header |
| 20377 | * @api private |
| 20378 | */ |
| 20379 | |
| 20380 | Response.prototype._setHeaderProperties = function(header){ |
| 20381 | // content-type |
| 20382 | var ct = this.header['content-type'] || ''; |
| 20383 | this.type = type(ct); |
| 20384 | |
| 20385 | // params |
| 20386 | var obj = params(ct); |
| 20387 | for (var key in obj) this[key] = obj[key]; |
| 20388 | }; |
| 20389 | |
| 20390 | /** |
| 20391 | * Parse the given body `str`. |
| 20392 | * |
| 20393 | * Used for auto-parsing of bodies. Parsers |
| 20394 | * are defined on the `superagent.parse` object. |
| 20395 | * |
| 20396 | * @param {String} str |
| 20397 | * @return {Mixed} |
| 20398 | * @api private |
| 20399 | */ |
| 20400 | |
| 20401 | Response.prototype._parseBody = function(str){ |
| 20402 | var parse = request.parse[this.type]; |
| 20403 | if (!parse && isJSON(this.type)) { |
| 20404 | parse = request.parse['application/json']; |
| 20405 | } |
| 20406 | return parse && str && (str.length || str instanceof Object) |
| 20407 | ? parse(str) |
| 20408 | : null; |
| 20409 | }; |
| 20410 | |
| 20411 | /** |
| 20412 | * Set flags such as `.ok` based on `status`. |
| 20413 | * |
| 20414 | * For example a 2xx response will give you a `.ok` of __true__ |
| 20415 | * whereas 5xx will be __false__ and `.error` will be __true__. The |
| 20416 | * `.clientError` and `.serverError` are also available to be more |
| 20417 | * specific, and `.statusType` is the class of error ranging from 1..5 |
| 20418 | * sometimes useful for mapping respond colors etc. |
| 20419 | * |
| 20420 | * "sugar" properties are also defined for common cases. Currently providing: |
| 20421 | * |
| 20422 | * - .noContent |
| 20423 | * - .badRequest |
| 20424 | * - .unauthorized |
| 20425 | * - .notAcceptable |
| 20426 | * - .notFound |
| 20427 | * |
| 20428 | * @param {Number} status |
| 20429 | * @api private |
| 20430 | */ |
| 20431 | |
| 20432 | Response.prototype._setStatusProperties = function(status){ |
| 20433 | // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request |
| 20434 | if (status === 1223) { |
| 20435 | status = 204; |
| 20436 | } |
| 20437 | |
| 20438 | var type = status / 100 | 0; |
| 20439 | |
| 20440 | // status / class |
| 20441 | this.status = this.statusCode = status; |
| 20442 | this.statusType = type; |
| 20443 | |
| 20444 | // basics |
| 20445 | this.info = 1 == type; |
| 20446 | this.ok = 2 == type; |
| 20447 | this.clientError = 4 == type; |
| 20448 | this.serverError = 5 == type; |
| 20449 | this.error = (4 == type || 5 == type) |
| 20450 | ? this.toError() |
| 20451 | : false; |
| 20452 | |
| 20453 | // sugar |
| 20454 | this.accepted = 202 == status; |
| 20455 | this.noContent = 204 == status; |
| 20456 | this.badRequest = 400 == status; |
| 20457 | this.unauthorized = 401 == status; |
| 20458 | this.notAcceptable = 406 == status; |
| 20459 | this.notFound = 404 == status; |
| 20460 | this.forbidden = 403 == status; |
| 20461 | }; |
| 20462 | |
| 20463 | /** |
| 20464 | * Return an `Error` representative of this response. |
| 20465 | * |
| 20466 | * @return {Error} |
| 20467 | * @api public |
| 20468 | */ |
| 20469 | |
| 20470 | Response.prototype.toError = function(){ |
| 20471 | var req = this.req; |
| 20472 | var method = req.method; |
| 20473 | var url = req.url; |
| 20474 | |
| 20475 | var msg = 'cannot ' + method + ' ' + url + ' (' + this.status + ')'; |
| 20476 | var err = new Error(msg); |
| 20477 | err.status = this.status; |
| 20478 | err.method = method; |
| 20479 | err.url = url; |
| 20480 | |
| 20481 | return err; |
| 20482 | }; |
| 20483 | |
| 20484 | /** |
| 20485 | * Expose `Response`. |
| 20486 | */ |
| 20487 | |
| 20488 | request.Response = Response; |
| 20489 | |
| 20490 | /** |
| 20491 | * Initialize a new `Request` with the given `method` and `url`. |
| 20492 | * |
| 20493 | * @param {String} method |
| 20494 | * @param {String} url |
| 20495 | * @api public |
| 20496 | */ |
| 20497 | |
| 20498 | function Request(method, url) { |
| 20499 | var self = this; |
| 20500 | this._query = this._query || []; |
| 20501 | this.method = method; |
| 20502 | this.url = url; |
| 20503 | this.header = {}; // preserves header name case |
| 20504 | this._header = {}; // coerces header names to lowercase |
| 20505 | this.on('end', function(){ |
| 20506 | var err = null; |
| 20507 | var res = null; |
| 20508 | |
| 20509 | try { |
| 20510 | res = new Response(self); |
| 20511 | } catch(e) { |
| 20512 | err = new Error('Parser is unable to parse the response'); |
| 20513 | err.parse = true; |
| 20514 | err.original = e; |
| 20515 | // issue #675: return the raw response if the response parsing fails |
| 20516 | err.rawResponse = self.xhr && self.xhr.responseText ? self.xhr.responseText : null; |
| 20517 | // issue #876: return the http status code if the response parsing fails |
| 20518 | err.statusCode = self.xhr && self.xhr.status ? self.xhr.status : null; |
| 20519 | return self.callback(err); |
| 20520 | } |
| 20521 | |
| 20522 | self.emit('response', res); |
| 20523 | |
| 20524 | var new_err; |
| 20525 | try { |
| 20526 | if (res.status < 200 || res.status >= 300) { |
| 20527 | new_err = new Error(res.statusText || 'Unsuccessful HTTP response'); |
| 20528 | new_err.original = err; |
| 20529 | new_err.response = res; |
| 20530 | new_err.status = res.status; |
| 20531 | } |
| 20532 | } catch(e) { |
| 20533 | new_err = e; // #985 touching res may cause INVALID_STATE_ERR on old Android |
| 20534 | } |
| 20535 | |
| 20536 | // #1000 don't catch errors from the callback to avoid double calling it |
| 20537 | if (new_err) { |
| 20538 | self.callback(new_err, res); |
| 20539 | } else { |
| 20540 | self.callback(null, res); |
| 20541 | } |
| 20542 | }); |
| 20543 | } |
| 20544 | |
| 20545 | /** |
| 20546 | * Mixin `Emitter` and `requestBase`. |
| 20547 | */ |
| 20548 | |
| 20549 | Emitter(Request.prototype); |
| 20550 | for (var key in requestBase) { |
| 20551 | Request.prototype[key] = requestBase[key]; |
| 20552 | } |
| 20553 | |
| 20554 | /** |
| 20555 | * Set Content-Type to `type`, mapping values from `request.types`. |
| 20556 | * |
| 20557 | * Examples: |
| 20558 | * |
| 20559 | * superagent.types.xml = 'application/xml'; |
| 20560 | * |
| 20561 | * request.post('/') |
| 20562 | * .type('xml') |
| 20563 | * .send(xmlstring) |
| 20564 | * .end(callback); |
| 20565 | * |
| 20566 | * request.post('/') |
| 20567 | * .type('application/xml') |
| 20568 | * .send(xmlstring) |
| 20569 | * .end(callback); |
| 20570 | * |
| 20571 | * @param {String} type |
| 20572 | * @return {Request} for chaining |
| 20573 | * @api public |
| 20574 | */ |
| 20575 | |
| 20576 | Request.prototype.type = function(type){ |
| 20577 | this.set('Content-Type', request.types[type] || type); |
| 20578 | return this; |
| 20579 | }; |
| 20580 | |
| 20581 | /** |
| 20582 | * Set responseType to `val`. Presently valid responseTypes are 'blob' and |
| 20583 | * 'arraybuffer'. |
| 20584 | * |
| 20585 | * Examples: |
| 20586 | * |
| 20587 | * req.get('/') |
| 20588 | * .responseType('blob') |
| 20589 | * .end(callback); |
| 20590 | * |
| 20591 | * @param {String} val |
| 20592 | * @return {Request} for chaining |
| 20593 | * @api public |
| 20594 | */ |
| 20595 | |
| 20596 | Request.prototype.responseType = function(val){ |
| 20597 | this._responseType = val; |
| 20598 | return this; |
| 20599 | }; |
| 20600 | |
| 20601 | /** |
| 20602 | * Set Accept to `type`, mapping values from `request.types`. |
| 20603 | * |
| 20604 | * Examples: |
| 20605 | * |
| 20606 | * superagent.types.json = 'application/json'; |
| 20607 | * |
| 20608 | * request.get('/agent') |
| 20609 | * .accept('json') |
| 20610 | * .end(callback); |
| 20611 | * |
| 20612 | * request.get('/agent') |
| 20613 | * .accept('application/json') |
| 20614 | * .end(callback); |
| 20615 | * |
| 20616 | * @param {String} accept |
| 20617 | * @return {Request} for chaining |
| 20618 | * @api public |
| 20619 | */ |
| 20620 | |
| 20621 | Request.prototype.accept = function(type){ |
| 20622 | this.set('Accept', request.types[type] || type); |
| 20623 | return this; |
| 20624 | }; |
| 20625 | |
| 20626 | /** |
| 20627 | * Set Authorization field value with `user` and `pass`. |
| 20628 | * |
| 20629 | * @param {String} user |
| 20630 | * @param {String} pass |
| 20631 | * @param {Object} options with 'type' property 'auto' or 'basic' (default 'basic') |
| 20632 | * @return {Request} for chaining |
| 20633 | * @api public |
| 20634 | */ |
| 20635 | |
| 20636 | Request.prototype.auth = function(user, pass, options){ |
| 20637 | if (!options) { |
| 20638 | options = { |
| 20639 | type: 'basic' |
| 20640 | } |
| 20641 | } |
| 20642 | |
| 20643 | switch (options.type) { |
| 20644 | case 'basic': |
| 20645 | var str = btoa(user + ':' + pass); |
| 20646 | this.set('Authorization', 'Basic ' + str); |
| 20647 | break; |
| 20648 | |
| 20649 | case 'auto': |
| 20650 | this.username = user; |
| 20651 | this.password = pass; |
| 20652 | break; |
| 20653 | } |
| 20654 | return this; |
| 20655 | }; |
| 20656 | |
| 20657 | /** |
| 20658 | * Add query-string `val`. |
| 20659 | * |
| 20660 | * Examples: |
| 20661 | * |
| 20662 | * request.get('/shoes') |
| 20663 | * .query('size=10') |
| 20664 | * .query({ color: 'blue' }) |
| 20665 | * |
| 20666 | * @param {Object|String} val |
| 20667 | * @return {Request} for chaining |
| 20668 | * @api public |
| 20669 | */ |
| 20670 | |
| 20671 | Request.prototype.query = function(val){ |
| 20672 | if ('string' != typeof val) val = serialize(val); |
| 20673 | if (val) this._query.push(val); |
| 20674 | return this; |
| 20675 | }; |
| 20676 | |
| 20677 | /** |
| 20678 | * Queue the given `file` as an attachment to the specified `field`, |
| 20679 | * with optional `filename`. |
| 20680 | * |
| 20681 | * ``` js |
| 20682 | * request.post('/upload') |
| 20683 | * .attach('content', new Blob(['<a id="a"><b id="b">hey!</b></a>'], { type: "text/html"})) |
| 20684 | * .end(callback); |
| 20685 | * ``` |
| 20686 | * |
| 20687 | * @param {String} field |
| 20688 | * @param {Blob|File} file |
| 20689 | * @param {String} filename |
| 20690 | * @return {Request} for chaining |
| 20691 | * @api public |
| 20692 | */ |
| 20693 | |
| 20694 | Request.prototype.attach = function(field, file, filename){ |
| 20695 | this._getFormData().append(field, file, filename || file.name); |
| 20696 | return this; |
| 20697 | }; |
| 20698 | |
| 20699 | Request.prototype._getFormData = function(){ |
| 20700 | if (!this._formData) { |
| 20701 | this._formData = new root.FormData(); |
| 20702 | } |
| 20703 | return this._formData; |
| 20704 | }; |
| 20705 | |
| 20706 | /** |
| 20707 | * Invoke the callback with `err` and `res` |
| 20708 | * and handle arity check. |
| 20709 | * |
| 20710 | * @param {Error} err |
| 20711 | * @param {Response} res |
| 20712 | * @api private |
| 20713 | */ |
| 20714 | |
| 20715 | Request.prototype.callback = function(err, res){ |
| 20716 | var fn = this._callback; |
| 20717 | this.clearTimeout(); |
| 20718 | fn(err, res); |
| 20719 | }; |
| 20720 | |
| 20721 | /** |
| 20722 | * Invoke callback with x-domain error. |
| 20723 | * |
| 20724 | * @api private |
| 20725 | */ |
| 20726 | |
| 20727 | Request.prototype.crossDomainError = function(){ |
| 20728 | var err = new Error('Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.'); |
| 20729 | err.crossDomain = true; |
| 20730 | |
| 20731 | err.status = this.status; |
| 20732 | err.method = this.method; |
| 20733 | err.url = this.url; |
| 20734 | |
| 20735 | this.callback(err); |
| 20736 | }; |
| 20737 | |
| 20738 | /** |
| 20739 | * Invoke callback with timeout error. |
| 20740 | * |
| 20741 | * @api private |
| 20742 | */ |
| 20743 | |
| 20744 | Request.prototype._timeoutError = function(){ |
| 20745 | var timeout = this._timeout; |
| 20746 | var err = new Error('timeout of ' + timeout + 'ms exceeded'); |
| 20747 | err.timeout = timeout; |
| 20748 | this.callback(err); |
| 20749 | }; |
| 20750 | |
| 20751 | /** |
| 20752 | * Compose querystring to append to req.url |
| 20753 | * |
| 20754 | * @api private |
| 20755 | */ |
| 20756 | |
| 20757 | Request.prototype._appendQueryString = function(){ |
| 20758 | var query = this._query.join('&'); |
| 20759 | if (query) { |
| 20760 | this.url += ~this.url.indexOf('?') |
| 20761 | ? '&' + query |
| 20762 | : '?' + query; |
| 20763 | } |
| 20764 | }; |
| 20765 | |
| 20766 | /** |
| 20767 | * Initiate request, invoking callback `fn(res)` |
| 20768 | * with an instanceof `Response`. |
| 20769 | * |
| 20770 | * @param {Function} fn |
| 20771 | * @return {Request} for chaining |
| 20772 | * @api public |
| 20773 | */ |
| 20774 | |
| 20775 | Request.prototype.end = function(fn){ |
| 20776 | var self = this; |
| 20777 | var xhr = this.xhr = request.getXHR(); |
| 20778 | var timeout = this._timeout; |
| 20779 | var data = this._formData || this._data; |
| 20780 | |
| 20781 | // store callback |
| 20782 | this._callback = fn || noop; |
| 20783 | |
| 20784 | // state change |
| 20785 | xhr.onreadystatechange = function(){ |
| 20786 | if (4 != xhr.readyState) return; |
| 20787 | |
| 20788 | // In IE9, reads to any property (e.g. status) off of an aborted XHR will |
| 20789 | // result in the error "Could not complete the operation due to error c00c023f" |
| 20790 | var status; |
| 20791 | try { status = xhr.status } catch(e) { status = 0; } |
| 20792 | |
| 20793 | if (0 == status) { |
| 20794 | if (self.timedout) return self._timeoutError(); |
| 20795 | if (self._aborted) return; |
| 20796 | return self.crossDomainError(); |
| 20797 | } |
| 20798 | self.emit('end'); |
| 20799 | }; |
| 20800 | |
| 20801 | // progress |
| 20802 | var handleProgress = function(e){ |
| 20803 | if (e.total > 0) { |
| 20804 | e.percent = e.loaded / e.total * 100; |
| 20805 | } |
| 20806 | e.direction = 'download'; |
| 20807 | self.emit('progress', e); |
| 20808 | }; |
| 20809 | if (this.hasListeners('progress')) { |
| 20810 | xhr.onprogress = handleProgress; |
| 20811 | } |
| 20812 | try { |
| 20813 | if (xhr.upload && this.hasListeners('progress')) { |
| 20814 | xhr.upload.onprogress = handleProgress; |
| 20815 | } |
| 20816 | } catch(e) { |
| 20817 | // Accessing xhr.upload fails in IE from a web worker, so just pretend it doesn't exist. |
| 20818 | // Reported here: |
| 20819 | // https://connect.microsoft.com/IE/feedback/details/837245/xmlhttprequest-upload-throws-invalid-argument-when-used-from-web-worker-context |
| 20820 | } |
| 20821 | |
| 20822 | // timeout |
| 20823 | if (timeout && !this._timer) { |
| 20824 | this._timer = setTimeout(function(){ |
| 20825 | self.timedout = true; |
| 20826 | self.abort(); |
| 20827 | }, timeout); |
| 20828 | } |
| 20829 | |
| 20830 | // querystring |
| 20831 | this._appendQueryString(); |
| 20832 | |
| 20833 | // initiate request |
| 20834 | if (this.username && this.password) { |
| 20835 | xhr.open(this.method, this.url, true, this.username, this.password); |
| 20836 | } else { |
| 20837 | xhr.open(this.method, this.url, true); |
| 20838 | } |
| 20839 | |
| 20840 | // CORS |
| 20841 | if (this._withCredentials) xhr.withCredentials = true; |
| 20842 | |
| 20843 | // body |
| 20844 | if ('GET' != this.method && 'HEAD' != this.method && 'string' != typeof data && !this._isHost(data)) { |
| 20845 | // serialize stuff |
| 20846 | var contentType = this._header['content-type']; |
| 20847 | var serialize = this._serializer || request.serialize[contentType ? contentType.split(';')[0] : '']; |
| 20848 | if (!serialize && isJSON(contentType)) serialize = request.serialize['application/json']; |
| 20849 | if (serialize) data = serialize(data); |
| 20850 | } |
| 20851 | |
| 20852 | // set header fields |
| 20853 | for (var field in this.header) { |
| 20854 | if (null == this.header[field]) continue; |
| 20855 | xhr.setRequestHeader(field, this.header[field]); |
| 20856 | } |
| 20857 | |
| 20858 | if (this._responseType) { |
| 20859 | xhr.responseType = this._responseType; |
| 20860 | } |
| 20861 | |
| 20862 | // send stuff |
| 20863 | this.emit('request', this); |
| 20864 | |
| 20865 | // IE11 xhr.send(undefined) sends 'undefined' string as POST payload (instead of nothing) |
| 20866 | // We need null here if data is undefined |
| 20867 | xhr.send(typeof data !== 'undefined' ? data : null); |
| 20868 | return this; |
| 20869 | }; |
| 20870 | |
| 20871 | |
| 20872 | /** |
| 20873 | * Expose `Request`. |
| 20874 | */ |
| 20875 | |
| 20876 | request.Request = Request; |
| 20877 | |
| 20878 | /** |
| 20879 | * GET `url` with optional callback `fn(res)`. |
| 20880 | * |
| 20881 | * @param {String} url |
| 20882 | * @param {Mixed|Function} [data] or fn |
| 20883 | * @param {Function} [fn] |
| 20884 | * @return {Request} |
| 20885 | * @api public |
| 20886 | */ |
| 20887 | |
| 20888 | request.get = function(url, data, fn){ |
| 20889 | var req = request('GET', url); |
| 20890 | if ('function' == typeof data) fn = data, data = null; |
| 20891 | if (data) req.query(data); |
| 20892 | if (fn) req.end(fn); |
| 20893 | return req; |
| 20894 | }; |
| 20895 | |
| 20896 | /** |
| 20897 | * HEAD `url` with optional callback `fn(res)`. |
| 20898 | * |
| 20899 | * @param {String} url |
| 20900 | * @param {Mixed|Function} [data] or fn |
| 20901 | * @param {Function} [fn] |
| 20902 | * @return {Request} |
| 20903 | * @api public |
| 20904 | */ |
| 20905 | |
| 20906 | request.head = function(url, data, fn){ |
| 20907 | var req = request('HEAD', url); |
| 20908 | if ('function' == typeof data) fn = data, data = null; |
| 20909 | if (data) req.send(data); |
| 20910 | if (fn) req.end(fn); |
| 20911 | return req; |
| 20912 | }; |
| 20913 | |
| 20914 | /** |
| 20915 | * OPTIONS query to `url` with optional callback `fn(res)`. |
| 20916 | * |
| 20917 | * @param {String} url |
| 20918 | * @param {Mixed|Function} [data] or fn |
| 20919 | * @param {Function} [fn] |
| 20920 | * @return {Request} |
| 20921 | * @api public |
| 20922 | */ |
| 20923 | |
| 20924 | request.options = function(url, data, fn){ |
| 20925 | var req = request('OPTIONS', url); |
| 20926 | if ('function' == typeof data) fn = data, data = null; |
| 20927 | if (data) req.send(data); |
| 20928 | if (fn) req.end(fn); |
| 20929 | return req; |
| 20930 | }; |
| 20931 | |
| 20932 | /** |
| 20933 | * DELETE `url` with optional callback `fn(res)`. |
| 20934 | * |
| 20935 | * @param {String} url |
| 20936 | * @param {Function} [fn] |
| 20937 | * @return {Request} |
| 20938 | * @api public |
| 20939 | */ |
| 20940 | |
| 20941 | function del(url, fn){ |
| 20942 | var req = request('DELETE', url); |
| 20943 | if (fn) req.end(fn); |
| 20944 | return req; |
| 20945 | }; |
| 20946 | |
| 20947 | request['del'] = del; |
| 20948 | request['delete'] = del; |
| 20949 | |
| 20950 | /** |
| 20951 | * PATCH `url` with optional `data` and callback `fn(res)`. |
| 20952 | * |
| 20953 | * @param {String} url |
| 20954 | * @param {Mixed} [data] |
| 20955 | * @param {Function} [fn] |
| 20956 | * @return {Request} |
| 20957 | * @api public |
| 20958 | */ |
| 20959 | |
| 20960 | request.patch = function(url, data, fn){ |
| 20961 | var req = request('PATCH', url); |
| 20962 | if ('function' == typeof data) fn = data, data = null; |
| 20963 | if (data) req.send(data); |
| 20964 | if (fn) req.end(fn); |
| 20965 | return req; |
| 20966 | }; |
| 20967 | |
| 20968 | /** |
| 20969 | * POST `url` with optional `data` and callback `fn(res)`. |
| 20970 | * |
| 20971 | * @param {String} url |
| 20972 | * @param {Mixed} [data] |
| 20973 | * @param {Function} [fn] |
| 20974 | * @return {Request} |
| 20975 | * @api public |
| 20976 | */ |
| 20977 | |
| 20978 | request.post = function(url, data, fn){ |
| 20979 | var req = request('POST', url); |
| 20980 | if ('function' == typeof data) fn = data, data = null; |
| 20981 | if (data) req.send(data); |
| 20982 | if (fn) req.end(fn); |
| 20983 | return req; |
| 20984 | }; |
| 20985 | |
| 20986 | /** |
| 20987 | * PUT `url` with optional `data` and callback `fn(res)`. |
| 20988 | * |
| 20989 | * @param {String} url |
| 20990 | * @param {Mixed|Function} [data] or fn |
| 20991 | * @param {Function} [fn] |
| 20992 | * @return {Request} |
| 20993 | * @api public |
| 20994 | */ |
| 20995 | |
| 20996 | request.put = function(url, data, fn){ |
| 20997 | var req = request('PUT', url); |
| 20998 | if ('function' == typeof data) fn = data, data = null; |
| 20999 | if (data) req.send(data); |
| 21000 | if (fn) req.end(fn); |
| 21001 | return req; |
| 21002 | }; |
| 21003 | |
| 21004 | },{"./is-object":159,"./request":161,"./request-base":160,"emitter":162}],159:[function(require,module,exports){ |
| 21005 | /** |
| 21006 | * Check if `obj` is an object. |
| 21007 | * |
| 21008 | * @param {Object} obj |
| 21009 | * @return {Boolean} |
| 21010 | * @api private |
| 21011 | */ |
| 21012 | |
| 21013 | function isObject(obj) { |
| 21014 | return null !== obj && 'object' === typeof obj; |
| 21015 | } |
| 21016 | |
| 21017 | module.exports = isObject; |
| 21018 | |
| 21019 | },{}],160:[function(require,module,exports){ |
| 21020 | /** |
| 21021 | * Module of mixed-in functions shared between node and client code |
| 21022 | */ |
| 21023 | var isObject = require('./is-object'); |
| 21024 | |
| 21025 | /** |
| 21026 | * Clear previous timeout. |
| 21027 | * |
| 21028 | * @return {Request} for chaining |
| 21029 | * @api public |
| 21030 | */ |
| 21031 | |
| 21032 | exports.clearTimeout = function _clearTimeout(){ |
| 21033 | this._timeout = 0; |
| 21034 | clearTimeout(this._timer); |
| 21035 | return this; |
| 21036 | }; |
| 21037 | |
| 21038 | /** |
| 21039 | * Override default response body parser |
| 21040 | * |
| 21041 | * This function will be called to convert incoming data into request.body |
| 21042 | * |
| 21043 | * @param {Function} |
| 21044 | * @api public |
| 21045 | */ |
| 21046 | |
| 21047 | exports.parse = function parse(fn){ |
| 21048 | this._parser = fn; |
| 21049 | return this; |
| 21050 | }; |
| 21051 | |
| 21052 | /** |
| 21053 | * Override default request body serializer |
| 21054 | * |
| 21055 | * This function will be called to convert data set via .send or .attach into payload to send |
| 21056 | * |
| 21057 | * @param {Function} |
| 21058 | * @api public |
| 21059 | */ |
| 21060 | |
| 21061 | exports.serialize = function serialize(fn){ |
| 21062 | this._serializer = fn; |
| 21063 | return this; |
| 21064 | }; |
| 21065 | |
| 21066 | /** |
| 21067 | * Set timeout to `ms`. |
| 21068 | * |
| 21069 | * @param {Number} ms |
| 21070 | * @return {Request} for chaining |
| 21071 | * @api public |
| 21072 | */ |
| 21073 | |
| 21074 | exports.timeout = function timeout(ms){ |
| 21075 | this._timeout = ms; |
| 21076 | return this; |
| 21077 | }; |
| 21078 | |
| 21079 | /** |
| 21080 | * Promise support |
| 21081 | * |
| 21082 | * @param {Function} resolve |
| 21083 | * @param {Function} reject |
| 21084 | * @return {Request} |
| 21085 | */ |
| 21086 | |
| 21087 | exports.then = function then(resolve, reject) { |
| 21088 | if (!this._fullfilledPromise) { |
| 21089 | var self = this; |
| 21090 | this._fullfilledPromise = new Promise(function(innerResolve, innerReject){ |
| 21091 | self.end(function(err, res){ |
| 21092 | if (err) innerReject(err); else innerResolve(res); |
| 21093 | }); |
| 21094 | }); |
| 21095 | } |
| 21096 | return this._fullfilledPromise.then(resolve, reject); |
| 21097 | } |
| 21098 | |
| 21099 | /** |
| 21100 | * Allow for extension |
| 21101 | */ |
| 21102 | |
| 21103 | exports.use = function use(fn) { |
| 21104 | fn(this); |
| 21105 | return this; |
| 21106 | } |
| 21107 | |
| 21108 | |
| 21109 | /** |
| 21110 | * Get request header `field`. |
| 21111 | * Case-insensitive. |
| 21112 | * |
| 21113 | * @param {String} field |
| 21114 | * @return {String} |
| 21115 | * @api public |
| 21116 | */ |
| 21117 | |
| 21118 | exports.get = function(field){ |
| 21119 | return this._header[field.toLowerCase()]; |
| 21120 | }; |
| 21121 | |
| 21122 | /** |
| 21123 | * Get case-insensitive header `field` value. |
| 21124 | * This is a deprecated internal API. Use `.get(field)` instead. |
| 21125 | * |
| 21126 | * (getHeader is no longer used internally by the superagent code base) |
| 21127 | * |
| 21128 | * @param {String} field |
| 21129 | * @return {String} |
| 21130 | * @api private |
| 21131 | * @deprecated |
| 21132 | */ |
| 21133 | |
| 21134 | exports.getHeader = exports.get; |
| 21135 | |
| 21136 | /** |
| 21137 | * Set header `field` to `val`, or multiple fields with one object. |
| 21138 | * Case-insensitive. |
| 21139 | * |
| 21140 | * Examples: |
| 21141 | * |
| 21142 | * req.get('/') |
| 21143 | * .set('Accept', 'application/json') |
| 21144 | * .set('X-API-Key', 'foobar') |
| 21145 | * .end(callback); |
| 21146 | * |
| 21147 | * req.get('/') |
| 21148 | * .set({ Accept: 'application/json', 'X-API-Key': 'foobar' }) |
| 21149 | * .end(callback); |
| 21150 | * |
| 21151 | * @param {String|Object} field |
| 21152 | * @param {String} val |
| 21153 | * @return {Request} for chaining |
| 21154 | * @api public |
| 21155 | */ |
| 21156 | |
| 21157 | exports.set = function(field, val){ |
| 21158 | if (isObject(field)) { |
| 21159 | for (var key in field) { |
| 21160 | this.set(key, field[key]); |
| 21161 | } |
| 21162 | return this; |
| 21163 | } |
| 21164 | this._header[field.toLowerCase()] = val; |
| 21165 | this.header[field] = val; |
| 21166 | return this; |
| 21167 | }; |
| 21168 | |
| 21169 | /** |
| 21170 | * Remove header `field`. |
| 21171 | * Case-insensitive. |
| 21172 | * |
| 21173 | * Example: |
| 21174 | * |
| 21175 | * req.get('/') |
| 21176 | * .unset('User-Agent') |
| 21177 | * .end(callback); |
| 21178 | * |
| 21179 | * @param {String} field |
| 21180 | */ |
| 21181 | exports.unset = function(field){ |
| 21182 | delete this._header[field.toLowerCase()]; |
| 21183 | delete this.header[field]; |
| 21184 | return this; |
| 21185 | }; |
| 21186 | |
| 21187 | /** |
| 21188 | * Write the field `name` and `val` for "multipart/form-data" |
| 21189 | * request bodies. |
| 21190 | * |
| 21191 | * ``` js |
| 21192 | * request.post('/upload') |
| 21193 | * .field('foo', 'bar') |
| 21194 | * .end(callback); |
| 21195 | * ``` |
| 21196 | * |
| 21197 | * @param {String} name |
| 21198 | * @param {String|Blob|File|Buffer|fs.ReadStream} val |
| 21199 | * @return {Request} for chaining |
| 21200 | * @api public |
| 21201 | */ |
| 21202 | exports.field = function(name, val) { |
| 21203 | this._getFormData().append(name, val); |
| 21204 | return this; |
| 21205 | }; |
| 21206 | |
| 21207 | /** |
| 21208 | * Abort the request, and clear potential timeout. |
| 21209 | * |
| 21210 | * @return {Request} |
| 21211 | * @api public |
| 21212 | */ |
| 21213 | exports.abort = function(){ |
| 21214 | if (this._aborted) { |
| 21215 | return this; |
| 21216 | } |
| 21217 | this._aborted = true; |
| 21218 | this.xhr && this.xhr.abort(); // browser |
| 21219 | this.req && this.req.abort(); // node |
| 21220 | this.clearTimeout(); |
| 21221 | this.emit('abort'); |
| 21222 | return this; |
| 21223 | }; |
| 21224 | |
| 21225 | /** |
| 21226 | * Enable transmission of cookies with x-domain requests. |
| 21227 | * |
| 21228 | * Note that for this to work the origin must not be |
| 21229 | * using "Access-Control-Allow-Origin" with a wildcard, |
| 21230 | * and also must set "Access-Control-Allow-Credentials" |
| 21231 | * to "true". |
| 21232 | * |
| 21233 | * @api public |
| 21234 | */ |
| 21235 | |
| 21236 | exports.withCredentials = function(){ |
| 21237 | // This is browser-only functionality. Node side is no-op. |
| 21238 | this._withCredentials = true; |
| 21239 | return this; |
| 21240 | }; |
| 21241 | |
| 21242 | /** |
| 21243 | * Set the max redirects to `n`. Does noting in browser XHR implementation. |
| 21244 | * |
| 21245 | * @param {Number} n |
| 21246 | * @return {Request} for chaining |
| 21247 | * @api public |
| 21248 | */ |
| 21249 | |
| 21250 | exports.redirects = function(n){ |
| 21251 | this._maxRedirects = n; |
| 21252 | return this; |
| 21253 | }; |
| 21254 | |
| 21255 | /** |
| 21256 | * Convert to a plain javascript object (not JSON string) of scalar properties. |
| 21257 | * Note as this method is designed to return a useful non-this value, |
| 21258 | * it cannot be chained. |
| 21259 | * |
| 21260 | * @return {Object} describing method, url, and data of this request |
| 21261 | * @api public |
| 21262 | */ |
| 21263 | |
| 21264 | exports.toJSON = function(){ |
| 21265 | return { |
| 21266 | method: this.method, |
| 21267 | url: this.url, |
| 21268 | data: this._data, |
| 21269 | headers: this._header |
| 21270 | }; |
| 21271 | }; |
| 21272 | |
| 21273 | /** |
| 21274 | * Check if `obj` is a host object, |
| 21275 | * we don't want to serialize these :) |
| 21276 | * |
| 21277 | * TODO: future proof, move to compoent land |
| 21278 | * |
| 21279 | * @param {Object} obj |
| 21280 | * @return {Boolean} |
| 21281 | * @api private |
| 21282 | */ |
| 21283 | |
| 21284 | exports._isHost = function _isHost(obj) { |
| 21285 | var str = {}.toString.call(obj); |
| 21286 | |
| 21287 | switch (str) { |
| 21288 | case '[object File]': |
| 21289 | case '[object Blob]': |
| 21290 | case '[object FormData]': |
| 21291 | return true; |
| 21292 | default: |
| 21293 | return false; |
| 21294 | } |
| 21295 | } |
| 21296 | |
| 21297 | /** |
| 21298 | * Send `data` as the request body, defaulting the `.type()` to "json" when |
| 21299 | * an object is given. |
| 21300 | * |
| 21301 | * Examples: |
| 21302 | * |
| 21303 | * // manual json |
| 21304 | * request.post('/user') |
| 21305 | * .type('json') |
| 21306 | * .send('{"name":"tj"}') |
| 21307 | * .end(callback) |
| 21308 | * |
| 21309 | * // auto json |
| 21310 | * request.post('/user') |
| 21311 | * .send({ name: 'tj' }) |
| 21312 | * .end(callback) |
| 21313 | * |
| 21314 | * // manual x-www-form-urlencoded |
| 21315 | * request.post('/user') |
| 21316 | * .type('form') |
| 21317 | * .send('name=tj') |
| 21318 | * .end(callback) |
| 21319 | * |
| 21320 | * // auto x-www-form-urlencoded |
| 21321 | * request.post('/user') |
| 21322 | * .type('form') |
| 21323 | * .send({ name: 'tj' }) |
| 21324 | * .end(callback) |
| 21325 | * |
| 21326 | * // defaults to x-www-form-urlencoded |
| 21327 | * request.post('/user') |
| 21328 | * .send('name=tobi') |
| 21329 | * .send('species=ferret') |
| 21330 | * .end(callback) |
| 21331 | * |
| 21332 | * @param {String|Object} data |
| 21333 | * @return {Request} for chaining |
| 21334 | * @api public |
| 21335 | */ |
| 21336 | |
| 21337 | exports.send = function(data){ |
| 21338 | var obj = isObject(data); |
| 21339 | var type = this._header['content-type']; |
| 21340 | |
| 21341 | // merge |
| 21342 | if (obj && isObject(this._data)) { |
| 21343 | for (var key in data) { |
| 21344 | this._data[key] = data[key]; |
| 21345 | } |
| 21346 | } else if ('string' == typeof data) { |
| 21347 | // default to x-www-form-urlencoded |
| 21348 | if (!type) this.type('form'); |
| 21349 | type = this._header['content-type']; |
| 21350 | if ('application/x-www-form-urlencoded' == type) { |
| 21351 | this._data = this._data |
| 21352 | ? this._data + '&' + data |
| 21353 | : data; |
| 21354 | } else { |
| 21355 | this._data = (this._data || '') + data; |
| 21356 | } |
| 21357 | } else { |
| 21358 | this._data = data; |
| 21359 | } |
| 21360 | |
| 21361 | if (!obj || this._isHost(data)) return this; |
| 21362 | |
| 21363 | // default to json |
| 21364 | if (!type) this.type('json'); |
| 21365 | return this; |
| 21366 | }; |
| 21367 | |
| 21368 | },{"./is-object":159}],161:[function(require,module,exports){ |
| 21369 | // The node and browser modules expose versions of this with the |
| 21370 | // appropriate constructor function bound as first argument |
| 21371 | /** |
| 21372 | * Issue a request: |
| 21373 | * |
| 21374 | * Examples: |
| 21375 | * |
| 21376 | * request('GET', '/users').end(callback) |
| 21377 | * request('/users').end(callback) |
| 21378 | * request('/users', callback) |
| 21379 | * |
| 21380 | * @param {String} method |
| 21381 | * @param {String|Function} url or callback |
| 21382 | * @return {Request} |
| 21383 | * @api public |
| 21384 | */ |
| 21385 | |
| 21386 | function request(RequestConstructor, method, url) { |
| 21387 | // callback |
| 21388 | if ('function' == typeof url) { |
| 21389 | return new RequestConstructor('GET', method).end(url); |
| 21390 | } |
| 21391 | |
| 21392 | // url first |
| 21393 | if (2 == arguments.length) { |
| 21394 | return new RequestConstructor('GET', method); |
| 21395 | } |
| 21396 | |
| 21397 | return new RequestConstructor(method, url); |
| 21398 | } |
| 21399 | |
| 21400 | module.exports = request; |
| 21401 | |
| 21402 | },{}],162:[function(require,module,exports){ |
| 21403 |
|
| 21404 | /**
|
| 21405 | * Expose `Emitter`.
|
| 21406 | */
|
| 21407 |
|
| 21408 | if (typeof module !== 'undefined') {
|
| 21409 | module.exports = Emitter;
|
| 21410 | }
|
| 21411 |
|
| 21412 | /**
|
| 21413 | * Initialize a new `Emitter`.
|
| 21414 | *
|
| 21415 | * @api public
|
| 21416 | */
|
| 21417 |
|
| 21418 | function Emitter(obj) {
|
| 21419 | if (obj) return mixin(obj);
|
| 21420 | };
|
| 21421 |
|
| 21422 | /**
|
| 21423 | * Mixin the emitter properties.
|
| 21424 | *
|
| 21425 | * @param {Object} obj
|
| 21426 | * @return {Object}
|
| 21427 | * @api private
|
| 21428 | */
|
| 21429 |
|
| 21430 | function mixin(obj) {
|
| 21431 | for (var key in Emitter.prototype) {
|
| 21432 | obj[key] = Emitter.prototype[key];
|
| 21433 | }
|
| 21434 | return obj;
|
| 21435 | }
|
| 21436 |
|
| 21437 | /**
|
| 21438 | * Listen on the given `event` with `fn`.
|
| 21439 | *
|
| 21440 | * @param {String} event
|
| 21441 | * @param {Function} fn
|
| 21442 | * @return {Emitter}
|
| 21443 | * @api public
|
| 21444 | */
|
| 21445 |
|
| 21446 | Emitter.prototype.on =
|
| 21447 | Emitter.prototype.addEventListener = function(event, fn){
|
| 21448 | this._callbacks = this._callbacks || {};
|
| 21449 | (this._callbacks['$' + event] = this._callbacks['$' + event] || [])
|
| 21450 | .push(fn);
|
| 21451 | return this;
|
| 21452 | };
|
| 21453 |
|
| 21454 | /**
|
| 21455 | * Adds an `event` listener that will be invoked a single
|
| 21456 | * time then automatically removed.
|
| 21457 | *
|
| 21458 | * @param {String} event
|
| 21459 | * @param {Function} fn
|
| 21460 | * @return {Emitter}
|
| 21461 | * @api public
|
| 21462 | */
|
| 21463 |
|
| 21464 | Emitter.prototype.once = function(event, fn){
|
| 21465 | function on() {
|
| 21466 | this.off(event, on);
|
| 21467 | fn.apply(this, arguments);
|
| 21468 | }
|
| 21469 |
|
| 21470 | on.fn = fn;
|
| 21471 | this.on(event, on);
|
| 21472 | return this;
|
| 21473 | };
|
| 21474 |
|
| 21475 | /**
|
| 21476 | * Remove the given callback for `event` or all
|
| 21477 | * registered callbacks.
|
| 21478 | *
|
| 21479 | * @param {String} event
|
| 21480 | * @param {Function} fn
|
| 21481 | * @return {Emitter}
|
| 21482 | * @api public
|
| 21483 | */
|
| 21484 |
|
| 21485 | Emitter.prototype.off =
|
| 21486 | Emitter.prototype.removeListener =
|
| 21487 | Emitter.prototype.removeAllListeners =
|
| 21488 | Emitter.prototype.removeEventListener = function(event, fn){
|
| 21489 | this._callbacks = this._callbacks || {};
|
| 21490 |
|
| 21491 | // all
|
| 21492 | if (0 == arguments.length) {
|
| 21493 | this._callbacks = {};
|
| 21494 | return this;
|
| 21495 | }
|
| 21496 |
|
| 21497 | // specific event
|
| 21498 | var callbacks = this._callbacks['$' + event];
|
| 21499 | if (!callbacks) return this;
|
| 21500 |
|
| 21501 | // remove all handlers
|
| 21502 | if (1 == arguments.length) {
|
| 21503 | delete this._callbacks['$' + event];
|
| 21504 | return this;
|
| 21505 | }
|
| 21506 |
|
| 21507 | // remove specific handler
|
| 21508 | var cb;
|
| 21509 | for (var i = 0; i < callbacks.length; i++) {
|
| 21510 | cb = callbacks[i];
|
| 21511 | if (cb === fn || cb.fn === fn) {
|
| 21512 | callbacks.splice(i, 1);
|
| 21513 | break;
|
| 21514 | }
|
| 21515 | }
|
| 21516 | return this;
|
| 21517 | };
|
| 21518 |
|
| 21519 | /**
|
| 21520 | * Emit `event` with the given args.
|
| 21521 | *
|
| 21522 | * @param {String} event
|
| 21523 | * @param {Mixed} ...
|
| 21524 | * @return {Emitter}
|
| 21525 | */
|
| 21526 |
|
| 21527 | Emitter.prototype.emit = function(event){
|
| 21528 | this._callbacks = this._callbacks || {};
|
| 21529 | var args = [].slice.call(arguments, 1)
|
| 21530 | , callbacks = this._callbacks['$' + event];
|
| 21531 |
|
| 21532 | if (callbacks) {
|
| 21533 | callbacks = callbacks.slice(0);
|
| 21534 | for (var i = 0, len = callbacks.length; i < len; ++i) {
|
| 21535 | callbacks[i].apply(this, args);
|
| 21536 | }
|
| 21537 | }
|
| 21538 |
|
| 21539 | return this;
|
| 21540 | };
|
| 21541 |
|
| 21542 | /**
|
| 21543 | * Return array of callbacks for `event`.
|
| 21544 | *
|
| 21545 | * @param {String} event
|
| 21546 | * @return {Array}
|
| 21547 | * @api public
|
| 21548 | */
|
| 21549 |
|
| 21550 | Emitter.prototype.listeners = function(event){
|
| 21551 | this._callbacks = this._callbacks || {};
|
| 21552 | return this._callbacks['$' + event] || [];
|
| 21553 | };
|
| 21554 |
|
| 21555 | /**
|
| 21556 | * Check if this emitter has `event` handlers.
|
| 21557 | *
|
| 21558 | * @param {String} event
|
| 21559 | * @return {Boolean}
|
| 21560 | * @api public
|
| 21561 | */
|
| 21562 |
|
| 21563 | Emitter.prototype.hasListeners = function(event){
|
| 21564 | return !! this.listeners(event).length;
|
| 21565 | };
|
| 21566 | |
| 21567 | },{}]},{},[1])(1) |
| 21568 | }); |
| 21569 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJpbmRleC5qcyIsImxpYi9hdXRoLmpzIiwibGliL2NsaWVudC5qcyIsImxpYi9oZWxwZXJzLmpzIiwibGliL2h0dHAuanMiLCJsaWIvcmVzb2x2ZXIuanMiLCJsaWIvc2NoZW1hLW1hcmt1cC5qcyIsImxpYi9zcGVjLWNvbnZlcnRlci5qcyIsImxpYi90eXBlcy9tb2RlbC5q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Kykge1xuICAgICAgICAgIHZhciBrdiA9IHBhcnRzW2ldLnNwbGl0KCc9Jyk7XG4gICAgICAgICAgaWYoa3YgJiYga3YubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgaWYgKGt2WzBdID09PSB0aGlzLm5hbWUpIHtcbiAgICAgICAgICAgICAgLy8gc2tpcCBpdFxuICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG4gICAgfVxuXG4gICAgaWYgKG9iai51cmwuaW5kZXhPZignPycpID4gMCkge1xuICAgICAgb2JqLnVybCA9IG9iai51cmwgKyAnJicgKyB0aGlzLm5hbWUgKyAnPScgKyB0aGlzLnZhbHVlO1xuICAgIH0gZWxzZSB7XG4gICAgICBvYmoudXJsID0gb2JqLnVybCArICc/JyArIHRoaXMubmFtZSArICc9JyArIHRoaXMudmFsdWU7XG4gICAgfVxuXG4gICAgcmV0dXJuIHRydWU7XG4gIH0gZWxzZSBpZiAodGhpcy50eXBlID09PSAnaGVhZGVyJykge1xuICAgIGlmKHR5cGVvZiBvYmouaGVhZGVyc1t0aGlzLm5hbWVdID09PSAndW5kZWZpbmVkJykge1xuICAgICAgb2JqLmhlYWRlcnNbdGhpcy5uYW1lXSA9IHRoaXMudmFsdWU7XG4gICAgfVxuXG4gICAgcmV0dXJuIHRydWU7XG4gIH1cbn07XG5cbnZhciBDb29raWVBdXRob3JpemF0aW9uID0gbW9kdWxlLmV4cG9ydHMuQ29va2llQXV0aG9yaXphdGlvbiA9IGZ1bmN0aW9uIChjb29raWUpIHtcbiAgdGhpcy5jb29raWUgPSBjb29raWU7XG59O1xuXG5Db29raWVBdXRob3JpemF0aW9uLnByb3RvdHlwZS5hcHBseSA9IGZ1bmN0aW9uIChvYmopIHtcbiAgb2JqLmNvb2tpZUphciA9IG9iai5jb29raWVKYXIgfHwgbmV3IENvb2tpZUphcigpO1xuICBvYmouY29va2llSmFyLnNldENvb2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AsIG9wZXJhdGlvbkdyb3VwKTtcbiAgICAgICAgfVxuXG4gICAgICAgIC8vIGJpbmQgdG8gdGhlIGFwaXMgb2JqZWN0XG4gICAgICAgIHNlbGYuYXBpc1thcGlQcm9wZXJ0eV1bb3BlcmF0aW9uSWRdID0gb3BlcmF0aW9uR3JvdXBbb3BlcmF0aW9uSWRdID0gXy5iaW5kKG9wZXJhdGlvbk9iamVjdC5leGVjdXRlLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wZXJhdGlvbk9iamVjdCk7XG4gICAgICAgIHNlbGYuYXBpc1thcGlQcm9wZXJ0eV1bb3BlcmF0aW9uSWRdLmhlbHAgPSBvcGVyYXRpb25Hcm91cFtvcGVyYXRpb25JZF0uaGVscCA9IF8uYmluZChvcGVyYXRpb25PYmplY3QuaGVscCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wZXJhdGlvbk9iamVjdCk7XG4gICAgICAgIHNlbGYuYXBpc1thcGlQcm9wZXJ0eV1bb3BlcmF0aW9uSWRdLmFzQ3VybCA9IG9wZXJhdGlvbkdyb3VwW29wZXJhdGlvbklkXS5hc0N1cmwgPSBfLmJpbmQob3BlcmF0aW9uT2JqZWN0LmFzQ3VybCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcGVyYXRpb25PYmplY3QpO1xuXG4gICAgICAgIG9wZXJhdGlvbkdyb3VwLmFwaXNbb3BlcmF0aW9uSWRdID0gb3BlcmF0aW9uR3JvdXAub3BlcmF0aW9uc1tvcGVyYXRpb25JZF0gPSBvcGVyYXRpb25PYmplY3Q7XG5cbiAgICAgICAgLy8g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tcbiAgICAgICAgICAgIC8vIG9ubHkgb25jZVxuICAgICAgICAgICAgaWYocC5pbmRleE9mKGtleSkgPT09IC0xKSB7XG4gICAgICAgICAgICAgIHAucHVzaChrZXkpO1xuICAgICAgICAgICAgICB2YXIgdmFsdWUgPSBvYmouYm9keS5nZXRBbGwoa2V5KTtcbiAgICAgICAgICAgICAgaWYoe30udG9TdHJpbmcuYXBwbHkodmFsdWUpID09PSAnW29iamVjdCBGaWxlXScpIHtcbiAgICAgICAgICAgICAgICByLmF0dGFjaChrZXksIHZhbHVlKTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheSh2YWx1ZSkpIHtcbiAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgaW4gdmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgci5maWVsZChrZXksIHZhbHVlW3RdKTtcbiAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICByLmZpZWxkKGtleSwgdmFsdWUpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBlbHNlIHtcbiAgICAgICAgICB2YXIga2V5bmFtZSwgdmFsdWUsIHY7XG4gICAgICAgICAgZm9yIChrZXluYW1lIGluIG9iai5ib2R5KSB7XG4gICAgICAgICAgICB2YWx1ZSA9IG9iai5ib2R5W2tleW5hbWVdO1xuICAgICAgICAgICAgaWYoQXJyYXkuaXNBcnJheSh2YWx1ZSkpIHtcbiAgICAgICAgICAgICAgZm9yKHYgaW4gdmFsdWUpIHtcbiAgICAgICAgICAgICAgICByLmZpZWxkKGtleW5hbWUsIHYpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIH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AgIHJlc3BvbnNlLmVyck9iaiA9IGVycjtcbiAgICAgIHJlc3BvbnNlLnN0YXR1cyA9IHJlcyA/IHJlcy5zdGF0dXMgOiA1MDA7XG4gICAgICByZXNwb25zZS5zdGF0dXNUZXh0ID0gcmVzID8gcmVzLnRleHQgOiBlcnIubWVzc2FnZTtcbiAgICAgIGlmIChyZXMuaGVhZGVycyAmJiByZXMuaGVhZGVyc1snY29udGVudC10eXBlJ10pIHtcbiAgICAgICAgaWYgKHJlcy5oZWFkZXJzWydjb250ZW50LXR5cGUnXS5pbmRleE9mKCdhcHBsaWNhdGlvbi9qc29uJykgPj0gMCkge1xuICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICByZXNwb25zZS5vYmogPSBKU09OLnBhcnNlKHJlc3BvbnNlLnN0YXR1c1RleHQpO1xuICAgICAgICAgIH1cbiAgICAgICAgICBjYXRjaCAoZSkge1xuICAgICAgICAgICAgcmVzcG9uc2Uub2JqID0gbnVsbDtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIGNiID0gb2JqLm9uLmVycm9yO1xuICAgIH0gZWxzZSBpZiAocmVzICYmIG9iai5vbiAmJiBvYmoub24ucmVzcG9uc2UpIHtcbiAgICAgIHZhciBwb3NzaWJsZU9iajtcblxuICAgICAgLy8gQWxyZWFkeSBwYXJzZWQgYnkgYnkgc3VwZXJhZ2VudD9cbiAgICAgIGlmIChyZXMuYm9keSAmJiBfLmtleXMocmVzLmJvZHkpLmxlbmd0aCA+IDApIHtcbiAgICAgICAgcG9zc2libGVPYmogPSByZXMuYm9keTtcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgcG9zc2libGVPYmogPSBqc3lhbWwuc2FmZUxvYWQocmVzLnRleHQpO1xuICAgICAgICAgIC8vIGNhbiBwYXJzZSBpbnRvIGEgc3RyaW5nLi4uIHdoaWNoIHdlIGRvbid0IG5lZWQgcnVubmluZyBhcm91bmQgaW4gdG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ICAgICB9XG4gICAgICAgIGlmKG1ldGhvZCAhPT0gJ3BhcmFtZXRlcnMnICYmIF8uaXNPYmplY3Qob3BlcmF0aW9uKSkge1xuICAgICAgICAgIG9wZXJhdGlvbi5wYXJhbWV0ZXJzID0gb3BlcmF0aW9uLnBhcmFtZXRlcnMgfHwgcGFyYW1ldGVycztcbiAgICAgICAgfVxuXG4gICAgICAgIGZvciAoaSBpbiBwYXJhbWV0ZXJzKSB7XG4gICAgICAgICAgdmFyIHBhcmFtZXRlciA9IHBhcmFtZXRlcnNbaV07XG4gICAgICAgICAgbG9jYXRpb24gPSAnL3BhdGhzJyArIG5hbWUgKyAnLycgKyBtZXRob2QgKyAnL3BhcmFtZXRlcnMnO1xuXG4gICAgICAgICAgaWYgKHBhcmFtZXRlci5pbiA9PT0gJ2JvZHknICYmIHBhcmFtZXRlci5zY2hlbWEpIHtcbiAgICAgICAgICAgIGlmKF8uaXNBcnJheShwYXJhbWV0ZXIuc2NoZW1hLmFsbE9mKSkge1xuICAgICAgICAgICAgICAvLyBtb3ZlIHRvIGEgZGVmaW5pdGlvblxuICAgICAgICAgICAgICB2YXIgbW9kZWxOYW1lID0gJ2lubGluZV9tb2RlbCc7XG4gICAgICAgICAgICAgIHZhciBuYW1lID0gbW9kZWxOYW1lO1xuICAgICAgICAgICAgICB2YXIgZG9uZSA9IGZhbHNlOyB2YXIgY291bnRlciA9IDA7XG4gICAgICAgICAgICAgIHdoaWxlKCFkb25lKSB7XG4gICAgICAgICAgICAgICAgaWYodHlwZW9mIHNwZWMuZGVmaW5pdGlvbnNbbmFtZV0gPT09ICd1bmRlZmluZWQnKSB7XG4gICAgICAgICAgICAgICAgICBkb25lID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBuYW1lID0gbW9kZWxOYW1lICsgJ18nICsgY291bnRlcjtcbiAgICAgICAgICAgICAgICBjb3VudGVyICsrO1xuICAgICAg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yByZXNwb25zZUNvZGU7XG5cbiAgICAgICAgICBpZihfLmlzT2JqZWN0KHJlc3BvbnNlKSkge1xuICAgICAgICAgICAgaWYocmVzcG9uc2UuJHJlZikge1xuICAgICAgICAgICAgICAvLyByZXNwb25zZSByZWZlcmVuY2VcbiAgICAgICAgICAgICAgdGhpcy5yZXNvbHZlSW5saW5lKHJvb3QsIHNwZWMsIHJlc3BvbnNlLCByZXNvbHV0aW9uVGFibGUsIHVucmVzb2x2ZWRSZWZzLCBsb2NhdGlvbik7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAocmVzcG9uc2Uuc2NoZW1hKSB7XG4gICAgICAgICAgICAgIHZhciByZXNwb25zZU9iaiA9IHJlc3BvbnNlO1xuICAgICAgICAgICAgICBpZihfLmlzQXJyYXkocmVzcG9uc2VPYmouc2NoZW1hLmFsbE9mKSkge1xuICAgICAgICAgICAgICAgIC8vIG1vdmUgdG8gYSBkZWZpbml0aW9uXG4gICAgICAgICAgICAgICAgdmFyIG1vZGVsTmFtZSA9ICdpbmxpbmVfbW9kZWwnO1xuICAgICAgICAgICAgICAgIHZhciBuYW1lID0gbW9kZWxOYW1lO1xuICAgICAgICAgICAgICAgIHZhciBkb25lID0gZmFsc2U7IHZhciBjb3VudGVyID0gMDtcbiAgICAgICAgICAgICAgICB3aGlsZSghZG9uZSkge1xuICAgICAgICAgICAgICAgICAgaWYodHlwZW9mIHNwZWMuZGVmaW5pdGlvbnNbbmFtZV0gPT09ICd1bmRlZmluZWQnKSB7XG4gICAgICAgICAgICAgICAgICAgIGRvbmUgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgIG5hbWUgPSBtb2RlbE5hbWUgKyAnXycgKyBjb3VudGVyO1xuICAgICAgICAgICAgICAgICAgY291bnRlciArKztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgc3BlYy5kZWZpbml0aW9uc1tuYW1lXSA9IHsgYWxsT2Y6IHJlc3BvbnNlT2JqLnNjaGVtYS5hbGxPZiB9O1xuICAgICAgICAgICAgICAgIGRlbGV0ZSByZXNwb25zZU9iai5zY2hlbWEuYWxsT2Y7XG4gICAgICAgICAgICAgICAgZGVsZXRlIHJlc3BvbnNlT2JqLnNjaGVtYS50eXBlO1xuICAgICAgICAgICAgICAgIHJlc3BvbnNlT2JqLnNjaGVtYS4kcmVmID0gJyMvZGVmaW5pdGlvbnMvJyArIG5hbWU7XG4gICAgICAgICAgICAgICAgdGhpcy5wcm9jZXNzQWxsT2Yocm9vdCwgbmFtZSwgc3BlYy5kZWZpbml0aW9uc1tuYW1lXSwgcmVzb2x1dGlvblRhYmxlLCB1bnJlc29sdmVkUmVmcywgc3BlYyk7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgZWxzZSBpZignYXJyYXknID09PSByZXNwb25zZU9iai5zY2hlbWEudHlwZSkge1xuICAgICAgICAgICAgICAgIGlmKHJlc3BvbnNlT2JqLnNjaGVtYS5pdGVtcyAmJiByZXNwb25zZU9iai5zY2hlbWEuaXRlbXMuJHJlZikge1xuICAgICAgICAgICAgICAgICAgLy8gcmVzcG9uc2UgcmVmZXJlbmNlXG4gICAgICAgICAgICAgICAgICB0aGlzLnJlc29sdmVJbmxpbmUocm9vdCwgc3BlYywgcmVzcG9uc2VPYmouc2NoZW1hLml0ZW1zLCByZXNvbHV0aW9uVGFibGUsIHVucmVzb2x2ZWRSZWZzLCBsb2NhdGlvbik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIHRoaXMucmVzb2x2ZVRvKHJvb3QsIHJlc3BvbnNlLnNjaGVtYSwgcmVzb2x1dGlvblRhYmxlLCBsb2NhdGlvbik7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgI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ICAgICAgICAgIH1cbiAgICAgICAgICBmb3IoayA9IDA7IGsgPCBub3JtYWxpemVkLmxlbmd0aDsgayArKykge1xuICAgICAgICAgICAgaWYoayA+IDApIHtcbiAgICAgICAgICAgICAgdXJsICs9ICcvJztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHVybCArPSBub3JtYWxpemVkW2tdO1xuICAgICAgICAgIH1cbiAgICAgICAgICAvLyB3ZSBub3cgaGF2ZSB0byByZW1vdGUgcmVzb2x2ZSB0aGlzIGJlY2F1c2UgdGhlIHBhdGggaGFzIGNoYW5nZWRcbiAgICAgICAgICBhLnJvb3QgPSB1cmw7XG4gICAgICAgICAgdG9SZXNvbHZlLnB1c2goYSk7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSB7XG4gICAgICAgICAgcGFydHMgPSBhLmtleS5zcGxpdCgnIycpO1xuICAgICAgICAgIGlmKHBhcnRzLmxlbmd0aCA9PT0gMikge1xuICAgICAgICAgICAgaWYocGFydHNbMF0uaW5kZXhPZignaHR0cDonKSA9PT0gMCB8fCBwYXJ0c1swXS5pbmRleE9mKCdodHRwczonKSA9PT0gMCkge1xuICAgICAgICAgICAgICBhLnJvb3QgPSBwYXJ0c1swXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGxvY2F0aW9uID0gcGFydHNbMV0uc3BsaXQoJy8nKTtcbiAgICAgICAgICAgIHZhciByO1xuICAgICAgICAgICAgdmFyIHMgPSBzcGVjO1xuICAgICAgICAgICAgZm9yKGsgPSAwOyBrIDwgbG9jYXRpb24ubGVuZ3RoOyBrKyspIHtcbiAgICAgICAgICAgICAgdmFyIHBhcnQgPSBsb2NhdGlvbltrXTtcbiAgICAgICAgICAgICAgaWYocGFydCAhPT0gJycpIHtcbiAgICAgICAgICAgICAgICBzID0gc1twYXJ0XTtcbiAgICAgICAgICAgICAgICBpZih0eXBlb2YgcyAhPT0gJ3VuZGVmaW5lZCcpIHtcbiAgICAgICAgICAgICAgICAgIHIgPSBzO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgIHIgPSBudWxsO1xuICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZihyID09PSBudWxsKSB7XG4gICAgICAgICAgICAgIC8vIG11c3QgcmVzb2x2ZSB0aGlzIHRvb1xuICAgICAgICAgICAgICB0b1Jlc29sdmUucHVzaChhKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIGVsc2Uge1xuICAgICAgICBpZiAoYS5yZXNvbHZlQXMgPT09ICdpbmxpbmUnKSB7XG4gICAgICAgICAgaWYoYS5rZXkgJiYgYS5rZXkuaW5kZXhPZignIycpID09PSAtMSAmJiBhLmtleS5jaGFyQXQoMCkgIT09ICcvJykge1xuICAgICAgICAgICAgLy8gaGFuZGxlIHJlbGF0aXZlIHNjaGVtYVxuICAgICAgICAgICAgcGFydHMgPSBhLnJvb3Quc3BsaXQoJy8nKTtcbiAgICAgICAgICAgIGxvY2F0aW9uID0gJyc7XG4gICAgICAgICAgICBmb3IoaSA9IDA7IGkgPCBwYXJ0cy5sZW5ndGggLSAxOyBpKyspIHtcbiAgICAgICAgICAgICAgbG9jYXRpb24gKz0gcGFydHNbaV0gKyAnLyc7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBsb2NhdGlvbiArPSBhLmtleTtcbiAgICAgICAgICAgIGEucm9vdCA9IGxvY2F0aW9uO1xuICAgICAgICAgICAgYS5sb2NhdGlvbiA9ICcnO1xuICAgICAgICAgIH1cbiAgICAgICAgICB0b1Jlc29sdmUucHVzaChhKTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH1cbiAgICBlbHNlIHtcbiAgICAgIHRvUmVzb2x2ZS5wdXNoKGEpO1xuICAgIH1cbiAgfVxuICBle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gICAgICAgIH0sXG4gICAgICAgICAgb246IHtcbiAgICAgICAgICAgIGVycm9yOiBmdW5jdGlvbiAoZXJyb3IpIHtcbiAgICAgICAgICAgICAgcHJvY2Vzc2VkQ2FsbHMgKz0gMTtcbiAgICAgICAgICAgICAgY29uc29sZS5sb2coJ2ZhaWxlZCB1cmw6ICcgKyBvYmoudXJsKTtcbiAgICAgICAgICAgICAgc2VsZi5mYWlsZWRVcmxzLnB1c2gob2JqLnVybCk7XG4gICAgICAgICAgICAgIGlmIChsb2NrKSB7XG4gICAgICAgICAgICAgICAgZGVsZXRlIGxvY2tbaXRlbS5yb290XTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB1bnJlc29sdmVkUmVmc1tpdGVtLmtleV0gPSB7XG4gICAgICAgICAgICAgICAgcm9vdDogaXRlbS5yb290LFxuICAgICAgICAgICAgICAgIGxvY2F0aW9uOiBpdGVtLmxvY2F0aW9uXG4gICAgICAgICAgICAgIH07XG5cbiAgICAgICAgICAgICAgaWYgKHByb2Nlc3NlZENhbGxzID09PSBleHBlY3RlZENhbGxzKSB7XG4gICAgICAgICAgICAgICAgc2VsZi5maW5pc2goc3BlYywgX3Jvb3QsIHJlc29sdXRpb25UYWJsZSwgcmVzb2x2ZWRSZWZzLCB1bnJlc29sdmVkUmVmcywgY2FsbGJhY2spO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LCAgLy8ganNoaW50IGlnbm9yZTpsaW5lXG4gICAgICAgICAgICByZXNwb25zZTogZnVuY3Rpb24gKHJlc3BvbnNlKSB7XG4gICAgICAgICAgICAgIHZhciBzd2FnZ2VyID0gcmVzcG9uc2Uub2JqO1xuICAgICAgICAgICAgICBpZiAobG9jaykge1xuICAgICAgICAgICAgICAgIGRlbGV0ZSBsb2NrW2l0ZW0ucm9vdF07XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgaWYgKHNlbGYucmVzb2x2ZXJDYWNoZSkge1xuICAgICAgICAgICAgICAgIH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O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgIHZhciBjYWNoZWQgPSBzZWxmLnJlc29sdmVyQ2FjaGVbb2JqLnVybF07XG4gICAgICAgICAgICAgIGlmIChfLmlzT2JqZWN0KGNhY2hlZCkpIHtcbiAgICAgICAgICAgICAgICBvYmoub24ucmVzcG9uc2Uoe29iajogY2FjaGVkfSksIDE7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgbG9ja1tvYmoudXJsXSA9IHRydWU7XG4gICAgICAgICAgICAgICAgbmV3IFN3YWdnZXJIdHRwKCkuZXhlY3V0ZShvYmosIG9wdHMpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfSwgMCk7XG4gICAgICAgIH0pKCk7XG4gICAgICB9XG5cbiAgICAgIGVsc2Uge1xuICAgICAgICBwcm9jZXNzZWRDYWxscyArPSAxO1xuICAgICAgICB1bnJlc29sdmVkUmVmc1tpdGVtLmtleV0gPSB7XG4gICAgICAgICAgcm9vdDogaXRlbS5yb290LFxuICAgICAgICAgIGxvY2F0aW9uOiBpdGVtLmxvY2F0aW9uXG4gICAgICAgIH07XG4gICAgICAgIGlmIChwcm9jZXNzZWRDYWxscyA9PT0gZXhwZWN0ZWRDYWxscykge1xuICAgICAgICAgIHNlbGYuZmluaXNoKHNwZWMsIF9yb290LCByZXNvbHV0aW9uVGFibGUsIHJlc29sdmVkUmVmcywgdW5yZXNvbHZlZFJlZnMsIGNhbGxiYWNrKTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0odG9SZXNvbHZlW2lpXSwgc3BlYywgdGhpcywgbG9jaywgaWkpKTtcbiAgfVxuXG4gIGlmIChPYmplY3Qua2V5cyh0b1Jlc29sdmUpLmxlbmd0aCA9PT0gMCkge1xuICAgIHRoaXMuZmluaXNoKHNwZWMsIF9yb290LCByZXNvbHV0aW9uVGFibGUs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AgICB2YXIga2V5ID0gaXRlbS5rZXk7XG4gICAgdmFyIHJlc29sdmVkVG8gPSByZXNvbHZlZFJlZnNba2V5XTtcbiAgICBpZiAocmVzb2x2ZWRUbykge1xuICAgICAgc3BlYy5kZWZpbml0aW9ucyA9IHNwZWMuZGVmaW5pdGlvbnMgfHwge307XG4gICAgICBpZiAoaXRlbS5yZXNvbHZlQXMgPT09ICdyZWYnKSB7XG4gICAgICAgIGlmIChsb2NhbFJlc29sdmUgIT09IHRydWUpIHtcbiAgICAgICAgICAvLyBkb24ndCByZXRhaW4gcm9vdCBmb3IgbG9jYWwgZGVmaW5pdGlvbnNcbiAgICAgICAgICBmb3IgKGtleSBpbiByZXNvbHZlZFRvLm9iaikge1xuICAgICAgICAgICAgdmFyIGFicyA9IHRoaXMucmV0YWluUm9vdChrZXksIHJlc29sdmVkVG8ub2JqW2tleV0sIGl0ZW0ucm9vdCk7XG4gICAgICAgICAgICByZXNvbHZlZFRvLm9ialtrZXldID0gYWJzO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBzcGVjLmRlZmluaXRpb25zW3Jlc29sdmVkVG8ubmFtZV0gPSByZXNvbHZlZFRvLm9iajtcbiAgICAgICAgaXRlbS5vYmouJHJlZiA9ICcjL2RlZmluaXRpb25zLycgKyByZXNvbHZlZFRvLm5hbWU7XG4gICAgICB9IGVsc2UgaWYgKGl0ZW0ucmVzb2x2ZUFzID09PSAnaW5saW5lJykge1xuICAgICAgICB2YXIgdGFyZ2V0T2JqID0gaXRlbS5vYmo7XG4gICAgICAgIHRhcmdldE9ialsneC1yZXNvbHZlZC1mcm9tJ10gPSBbIGl0ZW0ua2V5IF07XG4gICAgICAgIGRlbGV0ZSB0YXJnZXRPYmouJHJlZjtcblxuICAgICAgICBmb3IgKGtleSBpbiByZXNvbHZlZFRvLm9iaikge1xuICAgICAgICAgIHZhciBhYnMgPSByZXNvbHZlZFRvLm9ialtrZXldO1xuXG4gICAgICAgICAgaWYgKGxvY2Fs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AgICAgIH1cbiAgICAgIHJvb3QgPSAnJztcbiAgICAgIGZvcihpID0gMDsgaSA8IHAyLmxlbmd0aCAtIDE7IGkrKykge1xuICAgICAgICBpZihpID4gMCkgeyByb290ICs9ICcvJzsgfVxuICAgICAgICByb290ICs9IHAyW2ldO1xuICAgICAgfVxuICAgICAgcm9vdFRyaW1tZWQgPSB0cnVlO1xuICAgIH1cbiAgICBpZihyZWYuaW5kZXhPZignIycpID49IDApIHtcbiAgICAgIGlmKHJlZi5pbmRleE9mKCcvJykgPT09IDApIHtcbiAgICAgICAgcnMgPSByZWYuc3BsaXQoJyMnKTtcbiAgICAgICAgcCAgPSByb290LnNwbGl0KCcvLycpO1xuICAgICAgICBwMiA9IHBbMV0uc3BsaXQoJy8nKTtcbiAgICAgICAgcm9vdCA9IHBbMF0gKyAnLy8nICsgcDJbMF0gKyByc1swXTtcbiAgICAgICAgbG9jYXRpb24gPSByc1sxXTtcbiAgICAgIH1cbiAgICAgIGVsc2Uge1xuICAgICAgICBycyA9IHJlZi5zcGxpdCgnIycpO1xuICAgICAgICBpZihyc1swXSAhPT0gJycpIHtcbiAgICAgICAgICBwMiA9IHJvb3Quc3BsaXQoJy8nKTtcbiAgICAgICAgICBwMiA9IHAyLnNsaWNlKDAsIHAyLmxlbmd0aCAtIDEpO1xuICAgICAgICAgIGlmKCFyb290VHJpbW1lZCkge1xuICAgICAgICAgICAgcm9vdCA9ICcnO1xuICAgICAgICAgICAgZm9yICh2YXIgayA9IDA7IGsgPCBwMi5sZW5ndGg7IGsrKykge1xuICAgICAgICAgICAgICBpZihrID4gMCkgeyByb290ICs9ICcvJzsgfVxuICAgICAgICAgICAgICByb290ICs9IHAyW2tdO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgICByb290ICs9ICcvJyArIHJlZi5zcGxpdCgnIycpWzBdO1xuICAgICAgICB9XG4gICAgICAgIGxvY2F0aW9uID0gcnNbMV07XG4gICAgICB9XG4gICAgfVxuICAgIGlmIChyZWYuaW5kZXhPZignaHR0cDonKSA9PT0gMCB8fCByZWYuaW5kZXhPZignaHR0cHM6JykgPT09IDApIHtcbiAgICAgIGlmKHJlZi5pbmRleE9mKCcjJykgPj0gMCkge1xuICAgICAgICByb290ID0gcmVmLnNwbGl0KCcjJylbMF07XG4gICAgICAgIGxvY2F0aW9uID0gcmVmLnNwbGl0KCcjJylbMV07XG4gICAgICB9XG4gICAgICBlbHNlIHtcbiAgICAgICAgcm9vdCA9IHJlZjtcbiAgICAgICAgbG9jYXRpb24gPSAnJztcbiAgICAgIH1cbiAgICAgIHJlc29sdXRpb25UYWJsZS5wdXNoKHtvYmo6IHByb3BlcnR5LCByZXNvbHZlQXM6ICdpbmxpbmUnLCByb290OiByb290LCBrZXk6IGtleSwgbG9jYXRpb246IGxvY2F0aW9ufSk7XG4gICAgfSBlbHNlIGlmIChyZWYuaW5kZXhPZignIycpID09PSAwKSB7XG4gICAgICBsb2NhdGlvbiA9IHJlZi5zcGxpdCgnIycpWzFdO1xuICAgICAgcmVzb2x1dGlvblRhYmxlLnB1c2goe29iajogcHJvcGVydHksIHJlc29sdmVBczogJ2lubGluZScsIHJvb3Q6IHJvb3QsIGtleToga2V5LCBsb2NhdGlvbjogbG9jYXRpb259KTtcbiAgICB9IGVsc2UgaWYgKHJlZi5pbmRleE9mKCcvJykgPT09IDAgJiYgcmVmLmluZGV4T2YoJyMnKSA9PT0gLTEpIHtcbiAgICAgIGxvY2F0aW9uID0gcmVmO1xuICAgICAgdmFyIG1hdGNoZXMgPSByb290Lm1hdGNoKC9eaHR0cHM/XFw6XFwvXFwvKFteXFwvPyNdKykoPzpbXFwvPyNdfCQpL2kpO1xuICAgICAgaWYobWF0Y2hlcykge1xuICAgICAgICByb290ID0gbWF0Y2hlc1swXSArIHJlZi5zdWJzdHJpbmcoMSk7XG4gICAgICAgIGxvY2F0aW9uID0gJyc7XG4gICAgICB9XG4gICAgICByZXNvbHV0aW9uVGFibGUucHVzaCh7b2JqOiBwcm9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A9IHBhcnRzWzBdO1xuICAgICAgICByZWYgPSBwYXJ0c1sxXTtcbiAgICAgIH1cbiAgICAgIGVsc2UgaWYocGFydHNbMF0gJiYgcGFydHNbMF0ubGVuZ3RoID4gMCkge1xuICAgICAgICAvLyByZWxhdGl2ZSBmaWxlXG4gICAgICAgIHNwID0gcm9vdC5zcGxpdCgnLycpO1xuICAgICAgICBscm9vdCA9ICcnO1xuICAgICAgICBmb3IoaSA9IDA7IGkgPCBzcC5sZW5ndGggLSAxOyBpKyspIHtcbiAgICAgICAgICBscm9vdCArPSBzcFtpXSArICcvJztcbiAgICAgICAgfVxuICAgICAgICBscm9vdCArPSBwYXJ0c1swXTtcbiAgICAgIH1cbiAgICAgIGVsc2Uge1xuXG4gICAgICB9XG5cbiAgICAgIGxvY2F0aW9uID0gcGFydHNbMV07XG4gICAgfVxuICAgIGVsc2UgaWYgKHJlZi5pbmRleE9mKCdodHRwOicpID09PSAwIHx8IHJlZi5pbmRleE9mKCdodHRwczonKSA9PT0gMCkge1xuICAgICAgbHJvb3QgPSByZWY7XG4gICAgICBsb2NhdGlvbiA9ICcnO1xuICAgIH1cbiAgICBlbHNlIHtcbiAgICAgIC8vIHJlbGF0aXZlIGZpbGVcbiAgICAgIHNwID0gcm9vdC5zcGxpdCgnLycpO1xuICAgICAgbHJvb3QgPSAnJztcbiAgICAgIGZvcihpID0gMDsgaSA8IHNwLmxlbmd0aCAtIDE7IGkrKykge1xuICAgICAgICBscm9vdCArPSBzcFtpXSArICcvJztcbiAgICAgIH1cbiAgICAgIGxyb290ICs9IHJlZjtcbiAgICAgIGxvY2F0aW9uID0gJyc7XG4gICAgfVxuICAgIHJlc29sdXRpb25UYWJsZS5wdXNoKHtcbiAgICAgIG9iajogcHJvcGVydHksIHJlc29sdmVBczogJ3JlZicsIHJvb3Q6IGxyb290LCBrZXk6IHJlZiwgbG9jYXRpb246IGxvY2F0aW9uXG4gICAgfSk7XG4gIH0gZWxzZSBpZiAocHJvcGVydHkudHlwZS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1yZXNvbHZlZC1mcm9tJ107XG4gICAgICAgIH1cblxuICAgICAgICBmb3IodmFyIGkgPSAwOyBpIDwgYWxsT2YubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICB2YXIgY29tcG9uZW50ID0gYWxsT2ZbaV07XG4gICAgICAgICAgdmFyIHNvdXJjZSA9ICdzZWxmJztcbiAgICAgICAgICBpZih0eXBlb2YgY29tcG9uZW50Wyd4LXJlc29sdmVkLWZyb20nXSAhPT0gJ3VuZGVmaW5lZCcpIHtcbiAgICAgICAgICAgIHNvdXJjZSA9IGNvbXBvbmVudFsneC1yZXNvbHZlZC1mcm9tJ11bMF07XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgZm9yKHZhciBwYXJ0IGluIGNvbXBvbmVudCkge1xuICAgICAgICAgICAgaWYoIW91dHB1dC5oYXNPd25Qcm9wZXJ0eShwYXJ0KSkge1xuICAgICAgICAgICAgICBvdXRwdXRbcGFydF0gPSBfLmNsb25lRGVlcChjb21wb25lbnRbcGFydF0pO1xuICAgICAgICAgICAgICBpZihwYXJ0ID09PSAncHJvcGVydGllcycpIHtcbiAgICAgICAgICAgICAgICBmb3IobmFtZSBpbiBvdXRwdXRbcGFydF0pIHtcbiAgICAgICAgICAgICAgICAgIG91dHB1dFtwYXJ0XVtuYW1lXVsneC1yZXNvbHZlZC1mcm9tJ10gPSBzb3VyY2U7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgaWYocGFydCA9PT0gJ3Byb3BlcnRpZXMnKSB7XG4gICAgICAgICAgICAgICAgdmFyIHByb3BlcnRpZXMgPSBjb21wb25lbnRbcGFydF07XG4gICAgICAgICAgICAgICAgZm9yKG5hbWUgaW4gcHJvcGVydGllcykge1xuICAgICAgICAgICAgICAgICAgb3V0cHV0LnByb3BlcnRpZXNbbmFtZV0gPSBfLmNsb25lRGVlcChwcm9wZXJ0aWVzW25hbWVdKTtcbiAgICAgICAgICAgICAgICAgIHZhciByZXNvbHZlZEZyb20gPSBwcm9wZXJ0aWVzW25hbWVdWyd4LXJlc29sdmVkLWZyb20nXTtcbiAgICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgcmVzb2x2ZWRGcm9tID09PSAndW5kZWZpbmVkJyB8fCByZXNvbHZlZEZyb20gPT09ICdzZWxmJykge1xuICAgICAgICAgICAgICAgICAgICByZXNvbHZlZEZyb20gPSBzb3VyY2U7XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICBvdXRwdXQucHJvcGVydGllc1tuYW1lXVsneC1yZXNvbHZlZC1mcm9tJ10gPSByZXNvbHZlZEZyb207XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIGVsc2UgaWYocGFydCA9PT0gJ3JlcXVpcmVkJykge1xuICAgICAgICAgICAgICAgIC8vIG1lcmdlICYgZGVkdXAgdGhlIHJlcXVpcmVkIGFycmF5XG4gICAgICAgICAgICAgICAgdmFyIGEgPSBvdXRwdXQucmVxdWlyZWQuY29uY2F0KGNvbXBvbmVudFtwYXJ0XSk7XG4gICAgICAgICAgICAgICAgZm9yKHZhciBrID0gMDsgayA8IGEubGVuZ3RoOyArK2spIHtcbiAgICAgICAgICAgICAgICAgIGZvcih2YXIgaiA9IGsgKyAxOyBqIDwgYS5sZW5ndGg7ICsraikge1xuICAgICAgICAgICAgICAgICAgICBpZihhW2tdID09PSBhW2pdKSB7IGEuc3BsaWNlKGotLSwgMSk7IH1cbiAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgb3V0cHV0LnJlcXVpcmVkID0gYTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBlbHNlIGlmKHBhcnQgPT09ICd4LXJlc29sdmVkLWZyb20nKSB7XG4gICAgICAgICAgICAgICAgb3V0cHV0Wyd4LXJlc29sdmVkLWZy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3QnO1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHJldHVybiBhZGRSZWZlcmVuY2UoaXRlbSk7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgIHJldHVybiBwcmltaXRpdmVUb09wdGlvbnNIVE1MKGl0ZW0sIHR5cGUpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICByZXR1cm4gYWRkUmVmZXJlbmNlKGl0ZW0sIEhlbHBlcnMuc2ltcGxlUmVmKGl0ZW0uJHJlZikpO1xuICAgICAgICAgIH1cbiAgICAgICAgfSkuam9pbignLDwvZGl2PjxkaXY+Jyk7XG4gICAgICB9IGVsc2UgaWYgKF8uaXNQbGFpbk9iamVjdChzY2hlbWEuaXRlbXMpKSB7XG4gICAgICAgIGlmIChfLmlzVW5kZWZpbmVkKHNjaGVtYS5pdGVtcy4kcmVmKSkge1xuICAgICAgICAgIGlmIChfLmluZGV4T2YoWydhcnJheScsICdvYmplY3QnXSwgc2NoZW1hLml0ZW1zLnR5cGUgfHwgJ29iamVjdCcpID4gLTEpIHtcbiAgICAgICAgICAgIGlmICgoXy5pc1VuZGVmaW5lZChzY2hlbWEuaXRlbXMudHlwZSkgfHwgc2NoZW1hLml0ZW1zLnR5cGUgPT09ICdvYmplY3QnKSAmJiBfLmlzVW5kZWZpbmVkKHNjaGVtYS5pdGVtcy5wcm9wZXJ0aWVzKSkge1xuICAgICAgICAgICAgICBodG1sICs9ICc8ZGl2Pm9iamVjdDwvZGl2Pic7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICBodG1sICs9ICc8ZGl2PicgKyBhZGRSZWZlcmVuY2Uoc2NoZW1hLml0ZW1zKSArICc8L2Rpdj4nO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBodG1sICs9ICc8ZGl2PicgKyBwcmlt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EpIHtcbiAgICAgICAgICAgICAgICAvLyBVc2UgcmVmZXJlbmNlZCBzY2hlbWFcbiAgICAgICAgICAgICAgICBjUHJvcGVydHkgPSBIZWxwZXJzLnJlc29sdmVTY2hlbWEobW9kZWwuZGVmaW5pdGlvbik7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaHRtbCArPSBwcmltaXRpdmVUb0hUTUwoY1Byb3BlcnR5KTtcblxuICAgICAgICAgICAgaWYoIXByb3BlcnR5SXNSZXF1aXJlZCkge1xuICAgICAgICAgICAgICBodG1sICs9ICcsIDxzcGFuIGNsYXNzPVwicHJvcE9wdEtleVwiPm9wdGlvbmFsPC9zcGFuPic7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmKHByb3BlcnR5LnJlYWRPbmx5KSB7XG4gICAgICAgICAgICAgICAgaHRtbCArPSAnLCA8c3BhbiBjbGFzcz1cInByb3BSZWFkT25seVwiPnJlYWQgb25seTwvc3Bhbj4nO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBodG1sICs9ICcpJztcblxuICAgICAgICAgICAgaWYgKCFfLmlzVW5kZWZpbmVkKHByb3BEZXNjcmlwdGlvbikpIHtcbiAgICAgICAgICAgICAgaHRtbCArPSAnOiAnICsgJzxzcGFuIGNsYXNzPVwicHJvcERlc2NcIj4nICsgcHJvcERlc2NyaXB0aW9uICsgJzwvc3Bhbj4nO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAoY1Byb3BlcnR5LmVudW0pIHtcbiAgICAgICAgICAgICAgaHRtbCArPSAnID0gPHNwYW4gY2xhc3M9XCJwcm9wVmFsc1wiPltcXCcnICsgY1Byb3BlcnR5LmVudW0uam9pbignXFwnLCBcXCcnKSArICdcXCddPC9zcGFuPic7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiAnPGRpdicgKyAocHJvcGVydHkucmVhZE9ubHkgPyAnIGNsYXNzPVwic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AgIHZhciBpc1ZhbGlkID0gZmFsc2U7XG4gICAgICB2YXIgc2VjdXJpdHlEZWZpbml0aW9uID0ge307XG4gICAgICB2YXIgZGVmaW5pdGlvbiA9IG9iai5hdXRob3JpemF0aW9uc1tuYW1lXTtcbiAgICAgIGlmKGRlZmluaXRpb24udHlwZSA9PT0gJ2FwaUtleScpIHtcbiAgICAgICAgc2VjdXJpdHlEZWZpbml0aW9uLnR5cGUgPSAnYXBpS2V5JztcbiAgICAgICAgc2VjdXJpdHlEZWZpbml0aW9uLmluID0gZGVmaW5pdGlvbi5wYXNzQXM7XG4gICAgICAgIHNlY3VyaXR5RGVmaW5pdGlvbi5uYW1lID0gZGVmaW5pdGlvbi5rZXluYW1lIHx8IG5hbWU7XG4gICAgICAgIGlzVmFsaWQgPSB0cnVlO1xuICAgICAgfVxuICAgICAgZWxzZSBpZihkZWZpbml0aW9uLnR5cGUgPT09ICdiYXNpY0F1dGgnKSB7XG4gICAgICAgIHNlY3VyaXR5RGVmaW5pdGlvbi50eXBlID0gJ2Jhc2ljQXV0aCc7XG4gICAgICAgIGlzVmFsaWQgPSB0cnVlO1xuICAgICAgfVxuICAgICAgZWxzZSBpZihkZWZpbml0aW9uLnR5cGUgPT09ICdvYXV0aDInKSB7XG4gICAgICAgIHZhciBleGlzdGluZ1Njb3BlcyA9IGRlZmluaXRpb24uc2NvcGVzIHx8IFtdO1xuICAgICAgICB2YXIgc2NvcGVzID0ge307XG4gICAgICAgIHZhciBpO1xuICAgICAgICBmb3IoaSBpbiBleGlzdGluZ1Njb3Blcykge1xuICAgICAgICAgIHZhciBzY29wZSA9IGV4aXN0aW5nU2NvcGVzW2ldO1xuICAgICAgICAgIHNjb3Blc1tzY29wZS5zY29wZV0gPSBzY29wZS5kZXNjcmlwdGlvbjtcbiAgICAgICAgfVxuICAgICAgICBzZWN1cml0eURlZmluaXRpb24udHlwZSA9ICdvYXV0aDInO1xuICAgICAgICBpZihpID4gMCkge1xuICAgICAgICAgIHNlY3VyaXR5RGVmaW5pdGlvbi5zY29wZXMgPSBzY29wZXM7XG4gICAgICAgIH1cbiAgICAgICAgaWYoZGVmaW5pdGlvbi5ncmFudFR5cGVzKSB7XG4gICAgICAgICAgaWYoZGVmaW5pdGlvbi5ncmFudFR5cGVzLmltcGxpY2l0KSB7XG4gICAgICAgICAgICB2YXIgaW1wbGljaXQgPSBkZWZpbml0aW9uLmdyYW50VHlwZXMuaW1wbGljaXQ7XG4gICAgICAgICAgICBzZWN1cml0eURlZmluaXRpb24uZmxvdyA9ICdpbXBsaWNpdCc7XG4gICAgICAgICAgICBzZWN1cml0eURlZmluaXRpb24uYXV0aG9yaXphdGlvblVybCA9IGltcGxpY2l0LmxvZ2luRW5kcG9pbnQ7XG4gICAgICAgICAgICBpc1ZhbGlkID0gdHJ1ZTtcbiAgICAgICAgICB9XG4gICAgICAgICAgLyoganNoaW50IGlnbm9yZTpzdGFydCAqL1xuICAgICAgICAgIGlmKGRlZmluaXRpb24uZ3JhbnRUeXBlc1snYXV0aG9yaXphdGlvbl9jb2RlJ10pIHtcbiAgICAgICAgICAgIGlmKCFzZWN1cml0eURlZmluaXRpb24uZmxvdykge1xuICAgICAgICAgICAgICAvLyBjYW5ub3Qgc2V0IGlmIGZsb3cgaXMgYWxyZWFkeSBkZWZpbmVkXG4gICAgICAgICAgICAgIHZhciBhdXRoQ29kZSA9IGRlZmluaXRpb24uZ3JhbnRUeXBlc1snYXV0aG9yaXphdGlvbl9jb2RlJ107XG4gICAgICAgICAgICAgIHNlY3VyaXR5RGVmaW5pdGlvbi5mbG93ID0gJ2FjY2Vzc0NvZGUnO1xuICAgICAgICAgICAgICBzZWN1cml0eURlZmluaXRpb24uYXV0aG9yaXphdGlvblVybCA9IGF1dGhDb2RlLnRva2VuUmVxdWVzdEVuZHBvaW50LnVybDtcbiAgICAgICAgICAgICAgc2VjdXJpdHlEZWZpbml0aW9uLnRva2VuVXJsID0gYXV0aENvZGUudG9rZW5FbmRwb2ludC51cmw7XG4gICAgIC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TtcbiAgICAgICAgICAgICAgICBmb3IodmFyIHYgaW4gdmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgIGJvZHlQYXJhbS5hcHBlbmQoa2V5LCB2YWx1ZVt2XSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIGJvZHlQYXJhbS5hcHBlbmQoa2V5LCB0aGlzLmVuY29kZVF1ZXJ5Q29sbGVjdGlvbihwYXJhbS5jb2xsZWN0aW9uRm9ybWF0LCBrZXksIHZhbHVlKS5zcGxpdCgnPScpLnNsaWNlKDEpLmpvaW4oJz0nKSk7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICBib2R5UGFyYW0uYXBwZW5kKGtleSwgdmFsdWUpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgYm9keSA9IGJvZHlQYXJhbTtcbiAgICB9XG4gICAgZWxzZSB7XG4gICAgICBib2R5UGFyYW0gPSB7fTtcbiAgICAgIGZvciAoa2V5IGluIGZvcm1QYXJhbXMpIHtcbiAgICAgICAgdmFsdWUgPSBhcmdzW2tleV07XG4gICAgICAgIGlmIChBcnJheS5pc0FycmF5KHZhbHVlKSkge1xuICAgICAgICAgIHZhciBkZWxpbWV0ZXI7XG4gICAgICAgICAgdmFyIGZvcm1hdCA9IHBhcmFtLmNvbGxlY3Rpb25Gb3JtYXQgfHwgJ211bHRpJztcbiAgICAgICAgICBpZihmb3JtYXQgPT09ICdzc3YnKSB7XG4gICAgICAgICAgICBkZWxpbWV0ZXIgPSAnICc7XG4gICAgICAgICAgfVxuICAgICAgICAgIGVsc2UgaWYoZm9ybWF0ID09PSAncGlwZXMnKSB7XG4gICAgICAgICAgICBkZWxpbWV0ZXIgPSAnfCc7XG4gICAgICAgICAgfVxuICAgICAgICAgIGVsc2UgaWYoZm9ybWF0ID09PSAndHN2Jykge1xuICAgICAgICAgICAgZGVsaW1ldGVyID0gJ1xcdCc7XG4gICAgICAgICAgfVxuICAgICAgICAgIGVsc2UgaWYoZm9ybWF0ID09PSAnbXVsdGknKSB7XG4gICAgICAgICAgICBib2R5UGFyYW1ba2V5XSA9IHZhbHVlO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgZGVsaW1ldGVyID0gJywnO1xuICAgICAgICAgIH1cbiAgICAgICAgICB2YXIgZGF0YTtcbiAgICAgICAgICB2YWx1ZS5mb3JFYWNoKGZ1bmN0aW9uKHYpIHtcbiAgICAgICAgICAgIGlmKGRhdGEpIHtcbiAgICAgICAgICAgICAgZGF0YSArPSBkZWxpbWV0ZXI7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgZGF0YSA9ICcnO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZGF0YSArPSB2O1xuICAgICAgICAgIH0pO1xuICAgICAgICAgIGJvZHlQYXJhbVtrZXldID0gZGF0YTtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIHtcbiAgICAgICAgICBib2R5UGFyYW1ba2V5XSA9IHZhbHVlO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgICBib2R5ID0gYm9keVBhcmFtO1xuICAgIH1cbiAgICBoZWFkZXJzWydDb250ZW50LVR5cGUnXSA9ICdtdWx0aXBhcnQvZm9ybS1kYXRhJztcbiAgfVxuXG4gIHJldHVybiBib2R5O1xufTtcblxuLyoqXG4gKiBnZXRzIHNhbXBsZSByZXNwb25zZSBmb3IgYSBzaW5nbGUgb3BlcmF0aW9uXG4gKiovXG5PcGVyYXRpb24ucHJvdG90eXBlLmdldE1vZGVsU2FtcGxlSlNPTiA9IGZ1bmN0aW9uICh0eXBlLCBtb2RlbHMpIHtcbiAgdmFyIGxpc3RUeXBlLCBz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ICAgIGlmIChfLmlzT2JqZWN0KG9iai5ib2R5KSkge1xuICAgICAgaWYoaXNNdWx0aXBhcnQpIHtcbiAgICAgICAgaXNNdWx0aXBhcnQgPSB0cnVlO1xuICAgICAgICAvLyBhZGQgdGhlIGZvcm0gZGF0YVxuICAgICAgICBmb3IodmFyIGkgPSAwOyBpIDwgdGhpcy5wYXJhbWV0ZXJzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgdmFyIHBhcmFtZXRlciA9IHRoaXMucGFyYW1ldGVyc1tpXTtcbiAgICAgICAgICBpZihwYXJhbWV0ZXIuaW4gPT09ICdmb3JtRGF0YScpIHtcbiAgICAgICAgICAgIGlmICghYm9keSkge1xuICAgICAgICAgICAgICBib2R5ID0gJyc7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhciBwYXJhbVZhbHVlO1xuICAgICAgICAgICAgaWYodHlwZW9mIEZvcm1EYXRhID09PSAnZnVuY3Rpb24nICYmIG9iai5ib2R5IGluc3RhbmNlb2YgRm9ybURhdGEpIHtcbiAgICAgICAgICAgICAgcGFyYW1WYWx1ZSA9IG9iai5ib2R5LmdldEFsbChwYXJhbWV0ZXIubmFtZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgcGFyYW1WYWx1ZSA9IG9iai5ib2R5W3BhcmFtZXRlci5uYW1lXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChwYXJhbVZhbHVlKSB7XG4gICAgICAgICAgICAgIGlmIChwYXJhbWV0ZXIudHlwZSA9PT0gJ2ZpbGUnKSB7XG4gICAgICAgICAgICAgICAgaWYocGFyYW1WYWx1ZS5uYW1lKSB7XG4gICAgICAgICAgICAgICAgICBib2R5ICs9ICctRiAnICsgcGFyYW1ldGVyLm5hbWUgKyAnPUBcIicgKyBwYXJhbVZhbHVlLm5hbWUgKyAnXCIgJztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkocGFyYW1WYWx1ZSkpIHtcbiAgICAgICAgICAgICAgICAgIGlmKHBhcmFtZXRlci5jb2xsZWN0aW9uRm9ybWF0ID09PSAnbXVsdGknKSB7XG4gICAgICAgICAgICAgICAgICAgIGZvcih2YXIgdiBpbiBwYXJhbVZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgICAgYm9keSArPSAnLUYgJyArIHRoaXMuZW5jb2RlUXVlcnlLZXkocGFyYW1ldGVyLm5hbWUpICsgJz0nICsgcGFyYW1WYWx1ZVt2XSArICcgJztcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGJvZHkgKz0gJy1GICcgKyB0aGlzLmVuY29kZVF1ZXJ5Q29sbGVjdGlvbihwYXJhbWV0ZXIuY29sbGVjdGlvbkZvcm1hdCwgcGFyYW1ldGVyLm5hbWUsIHBhcmFtVmFsdWUpICsgJyAnO1xuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICBib2R5ICs9ICctRiAnICsgdGhpcy5lbmNvZGVRdWVyeUtleShwYXJhbWV0ZXIubmFtZSkgKyAnPScgKyBwYXJhbVZhbHVlICsgJyAnO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgaWYoIWJvZHkpIHtcbiAgICAgICAgYm9keSA9IEpTT04uc3RyaW5naWZ5KG9iai5ib2R5KTtcbiAgICAgIH1cbiAgICB9IGVsc2Uge1xuICAgICAgYm9keSA9IG9iai5ib2R5O1xuICAgIH1cbiAgICAvLyBlc2NhcGUgQCA9PiAlNDAsICcgPT4gJTI3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HIucHVzaChcImRvbWFpbj1cIiArIHRoaXMuZG9tYWluKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAodGhpcy5wYXRoKSB7XG4gICAgICAgICAgICBzdHIucHVzaChcInBhdGg9XCIgKyB0aGlzLnBhdGgpO1xuICAgICAgICB9XG4gICAgICAgIGlmICh0aGlzLnNlY3VyZSkge1xuICAgICAgICAgICAgc3RyLnB1c2goXCJzZWN1cmVcIik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHRoaXMubm9zY3JpcHQpIHtcbiAgICAgICAgICAgIHN0ci5wdXNoKFwiaHR0cG9ubHlcIik7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHN0ci5qb2luKFwiOyBcIik7XG4gICAgfTtcblxuICAgIENvb2tpZS5wcm90b3R5cGUudG9WYWx1ZVN0cmluZyA9IGZ1bmN0aW9uIHRvVmFsdWVTdHJpbmcoKSB7XG4gICAgICAgIHJldHVybiB0aGlzLm5hbWUgKyBcIj1cIiArIHRoaXMudmFsdWU7XG4gICAgfTtcblxuICAgIHZhciBjb29raWVfc3RyX3NwbGl0dGVyID0gL1s6XSg/PVxccypbYS16QS1aMC05X1xcLV0rXFxzKls9XSkvZztcbiAgICBDb29raWUucHJvdG90eXBlLnBhcnNlID0gZnVuY3Rpb24gcGFyc2Uoc3RyLCByZXF1ZXN0X2RvbWFpbiwgcmVxdWVzdF9wYXRoKSB7XG4gICAgICAgIGlmICh0aGlzIGluc3RhbmNlb2YgQ29va2llKSB7XG4gICAgICAgICAgICB2YXIgcGFydHMgPSBzdHIuc3BsaXQoXCI7XCIpLmZpbHRlcihmdW5jdGlvbiAodmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhdmFsdWU7XG4gICAgICAgICAgICAgICAgfSksXG4gICAgICAgICAgICAgICAgcGFpciA9IHBhcnRzWzBdLm1hdGNoKC8oW149XSspPShbXFxzXFxTXSopLyksXG4gICAgICAgICAgICAgICAga2V5ID0gcGFpclsxXSxcbiAgICAgICAgICAgICAgICB2YWx1ZSA9IHBhaXJbMl0sXG4gICAgICAgICAgICAgICAgaTtcbiAgICAgICAgICAgIHRoaXMubmFtZSA9IGtleTtcbiAgICAgICAgICAgIHRoaXMudmFsdWUgPSB2YWx1ZTtcblxuICAgICAgICAgICAgZm9yIChpID0gMTsgaSA8IHBhcnRzLmxlbmd0aDsgaSArPSAxKSB7XG4gICAgICAgICAgICAgICAgcGFpciA9IHBhcnRzW2ldLm1hdGNoKC8oW149XSspKD86PShbXFxzXFxTXSopKT8vKTtcbiAgICAgICAgICAgICAgICBrZXkgPSBwYWlyWzFdLnRyaW0oKS50b0xvd2VyQ2FzZSgpO1xuICAgICAgICAgICAgICAgIHZhbHVlID0gcGFpclsyXTtcbiAgICAgICAgICAgICAgICBzd2l0Y2ggKGtleSkge1xuICAgICAgICAgICAgICAgIGNhc2UgXCJodHRwb25seVwiOlxuICAgICAgICAgICAgICAgICAgICB0aGlzLm5vc2NyaXB0ID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSBcImV4cGlyZXNcIjpcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5leHBpcmF0aW9uX2RhdGUgPSB2YWx1ZSA/XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgTnVtYmVyKERhdGUucGFyc2UodmFsdWUpKSA6XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgSW5maW5pdHk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgXCJwYXRoXCI6XG4gICAgICAgICAgICAgICAgICAgIHRoaXMucGF0aCA9IHZhbHVlID9cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZS50cmltKCkgOlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiXCI7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZXhwbGljaXRfcGF0aCA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgXCJkb21haW5cIjpcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5kb21haW4gPSB2YWx1ZSA/XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWUudHJpbSgpIDpcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIlwiO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmV4cGxpY2l0X2RvbWFpbiA9ICEhdGhpcy5kb21haW47XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgXCJzZWN1cmVcIjpcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5zZWN1cmUgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmICghdGhpcy5leHBsaWNpdF9wYXRoKSB7XG4gICAgICAgICAgICAgICB0aGlzLnBhdGggPSByZXF1ZXN0X3BhdGggfHwgXCIvXCI7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoIXRoaXMuZXhwbGljaXRfZG9tYWluKSB7XG4gICAgICAgICAgICAgICB0aGlzLmRvbWFpbiA9IHJlcXVlc3RfZG9tYWluO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbmV3IENvb2tpZSgpLnBhcnNlKHN0ciwgcmVxdWVzdF9kb21haW4sIHJlcXVlc3RfcGF0aCk7XG4gICAgfTtcblxuICAgIENvb2tpZS5wcm90b3R5cGUubWF0Y2hlcyA9IGZ1bmN0aW9uIG1hdGNoZXMoYWNjZXNzX2luZm8pIHtcbiAgICAgICAgaWYgKHRoaXMubm9zY3JpcHQgJiYgYWNjZXNzX2luZm8uc2NyaXB0IHx8XG4gICAgICAgICAgICAgICAgdGhpcy5zZWN1c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AgIGlmIChjb29raWVfZG9tYWluKSB7XG4gICAgICAgICAgICBpZiAoIXRoaXMuZXhwbGljaXRfZG9tYWluKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOyAvLyB3ZSBhbHJlYWR5IGNoZWNrZWQgaWYgdGhlIGRvbWFpbnMgd2VyZSBleGFjdGx5IHRoZSBzYW1lXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgd2lsZGNhcmQgPSBhY2Nlc3NfZG9tYWluLmluZGV4T2YoY29va2llX2RvbWFpbik7XG4gICAgICAgICAgICBpZiAod2lsZGNhcmQgPT09IC0xIHx8IHdpbGRjYXJkICE9PSBhY2Nlc3NfZG9tYWluLmxlbmd0aCAtIGNvb2tpZV9kb21haW4ubGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgfTtcblxuICAgIGZ1bmN0aW9uIENvb2tpZUphcigpIHtcbiAgICAgICAgdmFyIGNvb2tpZXMsIGNvb2tpZXNfbGlzdCwgY29sbGlkYWJsZV9jb29raWU7XG4gICAgICAgIGlmICh0aGlzIGluc3RhbmNlb2YgQ29va2llSmFyKSB7XG4gICAgICAgICAgICBjb29raWVzID0gT2JqZWN0LmNyZWF0ZShudWxsKTsgLy9uYW1lOiBbQ29va2llXVxuXG4gICAgICAgICAgICB0aGlzLnNldENvb2tpZSA9IGZ1bmN0aW9uIHNldENvb2tpZShjb29raWUsIHJlcXVlc3RfZG9tYWluLCByZXF1ZXN0X3BhdGgpIHtcbiAgICAgICAgICAgICAgICB2YXIgcmVtb3ZlLCBpO1xuICAgICAgICAgICAgICAgIGNvb2tpZSA9IG5ldyBDb29raWUoY29va2llLCByZXF1ZXN0X2RvbWFpbiwgcmVxdWVzdF9wYXRoKTtcbiAgICAgICAgICAgICAgICAvL0RlbGV0ZSB0aGUgY29va2llIGlmIHRoZSBzZXQgaXMgcGFzdCB0aGUgY3VycmVudCB0aW1lXG4gICAgICAgICAgICAgICAgcmVtb3ZlID0gY29va2llLmV4cGlyYXRpb25fZGF0ZSA8PSBEYXRlLm5vdygpO1xuICAgICAgICAgICAgICAgIGlmIChjb29raWVzW2Nvb2tpZS5uYW1lXSAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvb2tpZXNfbGlzdCA9IGNvb2tpZXNbY29va2llLm5hbWVdO1xuICAgICAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgY29va2llc19saXN0Lmxlbmd0aDsgaSArPSAxKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb2xsaWRhYmxlX2Nvb2tpZSA9IGNvb2tpZXNfbGlzdFtpXTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjb2xsaWRhYmxlX2Nvb2tpZS5jb2xsaWRlc1dpdGgoY29va2llKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyZW1vdmUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29va2llc19saXN0LnNwbGljZShpLCAxKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNvb2tpZXNfbGlzdC5sZW5ndGggPT09IDApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZSBjb29raWVzW2Nvb2tpZS5uYW1lXTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvb2tpZXNfbGlzdFtpXSA9IGNvb2tpZTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY29va2llO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGlmIChyZW1vdmUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBjb29raWVzX2xpc3QucHVzaChjb29raWUpO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gY29va2llO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAocmVtb3ZlKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgY29va2llc1tjb29raWUubmFtZV0gPSBbY29va2llXTtcbiAgICAgICAgICAgICAgICByZXR1cm4gY29va2llc1tjb29raWUubmFtZV07XG4gICAgICAgICAgICB9O1xuICAgICAgICAgICAgLy9yZXR1cm5zIGEgY29va2llXG4gICAgICAgICAgICB0aGlzLmdldENvb2tpZSA9IGZ1bmN0aW9uIGdldENvb2tpZShjb29raWVfbmFtZSwgYWNjZXNzX2luZm8pIHtcbiAgICAgICAgICAgICAgICB2YXIgY29va2llLCBpO1xuICAgICAgICAgICAgICAgIGNvb2tpZXNfbGlzdCA9IGNvb2tpZXNbY29va2llX25hbWVdO1xuICAgICAgICAgICAgICAgIGlmICghY29va2llc19saXN0KSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IGNvb2tpZXNfbGlzdC5sZW5ndGg7IGkgKz0gMSkge1xuICAgICAgICAgICAgICAgICAgICBjb29raWUgPSBjb29raWVzX2xpc3RbaV07XG4gICAgICAgICAgICAgICAgICAgIGlmIChjb29raWUuZXhwaXJhdGlvbl9kYXRlIDw9IERhdGUubm93KCkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjb29raWVzX2xpc3QubGVuZ3RoID09PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlIGNvb2tpZXNbY29va2llLm5hbWVdO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICBpZiAoY29va2llLm1hdGNoZXMoYWNjZXNzX2luZm8pKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY29va2llO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIC8vcmV0dXJucyBhIGxpc3Qgb2YgY29va2llc1xuICAgICAgICAgICAgdGhpcy5nZXRDb29raWVzID0gZnVuY3Rpb24gZ2V0Q29va2llcyhhY2Nlc3NfaW5mbykge1xuICAgICAgICAgICAgICAgIHZhciBtYXRjaGVzID0gW10sIGNvb2tpZV9uYW1lLCBjb29raWU7XG4gICAgICAgICAgICAgICAgZm9yIChjb29raWVfbmFtZSBpbiBjb29raWVzKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvb2tpZSA9IHRoaXMuZ2V0Q29va2llKGNvb2tpZV9uYW1lLCBhY2Nlc3NfaW5mbyk7XG4gICAgICAgICAgICAgICAgICAgIGlmIChjb29raWUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1hdGNoZXMucHVzaChjb29raWUpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIG1hdGNoZXMudG9TdHJpbmcgPSBmdW5jdGlvbiB0b1N0cmluZygpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG1hdGNoZXMuam9pbihcIjpcIik7XG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICBtYXRjaGVzLnRvVmFsdWVTdHJpbmcgPSBmdW5jdGlvbiB0b1ZhbHVlU3RyaW5nKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gbWF0Y2hlcy5tYXAoZnVuY3Rpb24gKGMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjLnRvVmFsdWVTdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgfSkuam9pbignOycpO1xuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgcmV0dXJuIG1hdGNoZXM7XG4gICAgICAgICAgICB9O1xuXG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbmV3IENvb2tpZUphcigpO1xuICAgIH1cbiAgICBleHBvcnRzLkNvb2tpZUphciA9IENvb2tpZUphcjtcblxuICAgIC8vcmV0dXJucyBsaXN0IG9mIGNvb2tpZXMgdGhhdCB3ZXJlIHNldCBjb3JyZWN0bHkuIENvb2tpZXMgdGhhdCBhcmUgZXhwaXJlZCBhbmQgcmVtb3ZlZCBhcmUgbm90IHJldHVybmVkLlxuICAgIENvb2tpZUphci5wcm90b3R5cGUuc2V0Q29va2llcyA9IGZ1bmN0aW9uIHNldENvb2tpZXMoY29va2llcywgcmVxdWVzdF9kb21haW4sIHJlcXVlc3RfcGF0aCkge1xuICAgICAgICBjb29raWVzID0gQXJyYXkuaXNBcnJheShjb29raWVzKSA/XG4gICAgICAgICAgICAgICAgY29va2llcyA6XG4gICAgICAgICAgICAgICAgY29va2llcy5zcGxpdChjb29raWVfc3RyX3NwbGl0dGVyKTtcbiAgICAgICAgdmFyIHN1Y2Nlc3NmdWwgPSBbXSxcbiAgICAgICAgICAgIGksXG4gICAgICAgICAgICBjb29raWU7XG4gICAgICAgIGNvb2tpZXMgPSBjb29raWVzLm1hcChmdW5jdGlvbihpdGVtKXtcbiAgICAgICAgICAgIHJldHVybiBuZXcgQ29va2llKGl0ZW0sIHJlcXVlc3RfZG9tYWluLCByZXF1ZXN0X3BhdGgpO1xuICAgICA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bGUuZXhwb3J0cy5leHRlbmQgICAgICAgICA9IGV4dGVuZDtcbiIsIid1c2Ugc3RyaWN0JztcblxuLyplc2xpbnQtZGlzYWJsZSBuby11c2UtYmVmb3JlLWRlZmluZSovXG5cbnZhciBjb21tb24gICAgICAgICAgICAgID0gcmVxdWlyZSgnLi9jb21tb24nKTtcbnZhciBZQU1MRXhjZXB0aW9uICAgICAgID0gcmVxdWlyZSgnLi9leGNlcHRpb24nKTtcbnZhciBERUZBVUxUX0ZVTExfU0NIRU1BID0gcmVxdWlyZSgnLi9zY2hlbWEvZGVmYXVsdF9mdWxsJyk7XG52YXIgREVGQVVMVF9TQUZFX1NDSEVNQSA9IHJlcXVpcmUoJy4vc2NoZW1hL2RlZmF1bHRfc2FmZScpO1xuXG52YXIgX3RvU3RyaW5nICAgICAgID0gT2JqZWN0LnByb3RvdHlwZS50b1N0cmluZztcbnZhciBfaGFzT3duUHJvcGVydHkgPSBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5O1xuXG52YXIgQ0hBUl9UQUIgICAgICAgICAgICAgICAgICA9IDB4MDk7IC8qIFRhYiAqL1xudmFyIENIQVJfTElORV9GRUVEICAgICAgICAgICAgPSAweDBBOyAvKiBMRiAqL1xudmFyIENIQVJfU1BBQ0UgICAgICAgICAgICAgICAgPSAweDIwOyAvKiBTcGFjZSAqL1xudmFyIENIQVJfRVhDTEFNQVRJT04gICAgICAgICAgPSAweDIxOyAvKiAhICovXG52YXIgQ0hBUl9ET1VCTEVfUVVPVEUgICAgICAgICA9IDB4MjI7IC8qIFwiICovXG52YXIgQ0hBUl9TSEFSUCAgICAgICAgICAgICAgICA9IDB4MjM7IC8qICMgKi9cbnZhciBDSEFSX1BFUkNFTlQgICAgICAgICAgICAgID0gMHgyNTsgLyogJSAqL1xudmFyIENIQVJfQU1QRVJTQU5EICAgICAgICAgICAgPSAweDI2OyAvKiAmICovXG52YXIgQ0hBUl9TSU5HTEVfUVVPVEUgICAgICAgICA9IDB4Mjc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5mdW5jdGlvbiBpc19FT0woYykge1xuICByZXR1cm4gKGMgPT09IDB4MEEvKiBMRiAqLykgfHwgKGMgPT09IDB4MEQvKiBDUiAqLyk7XG59XG5cbmZ1bmN0aW9uIGlzX1dISVRFX1NQQUNFKGMpIHtcbiAgcmV0dXJuIChjID09PSAweDA5LyogVGFiICovKSB8fCAoYyA9PT0gMHgyMC8qIFNwYWNlICovKTtcbn1cblxuZnVuY3Rpb24gaXNfV1NfT1JfRU9MKGMpIHtcbiAgcmV0dXJuIChjID09PSAweDA5LyogVGFiICovKSB8fFxuICAgICAgICAgKGMgPT09IDB4MjAvKiBTcGFjZSAqLykgfHxcbiAgICAgICAgIChjID09PSAweDBBLyogTEYgKi8pIHx8XG4gICAgICAgICAoYyA9PT0gMHgwRC8qIENSICovKTtcbn1cblxuZnVuY3Rpb24gaXNfRkxPV19JTkRJQ0FUT1IoYykge1xuICByZXR1cm4gYyA9PT0gMHgyQy8qICwgKi8gfHxcbiAgICAgICAgIGMgPT09IDB4NUIvKiBbICovIHx8XG4gICAgICAgICBjID09PSAweDVELyogXSAqLyB8fFxuICAgICAgICAgYyA9PT0gMHg3Qi8qIHsgKi8gfHxcbiAgICAgICAgIGMgPT09IDB4N0QvKiB9ICovO1xufVxuXG5mdW5jdGlvbiBmcm9tSGV4Q29kZShjKSB7XG4gIHZhciBsYztcblxuICBpZiAoKDB4MzAvKiAwICovIDw9IGMpICYmIChjIDw9IDB4MzkvKiA5ICovKSkge1xuICAgIHJldHVybiBjIC0gMHgzMDtcbiAgfVxuXG4gIC8qZXNsaW50LWRpc2FibGUgbm8tYml0d2lzZSovXG4gIGxjID0gYyB8IDB4MjA7XG5cbiAgaWYgKCgweDYxLyogYSAqLyA8PSBsYykgJiYgKGxjIDw9IDB4NjYvKiBmICovKSkge1xuICAgIHJldHVybiBsYyAtIDB4NjEgKyAxMDtcbiAgfVxuXG4gIHJldHVybiAtMTtcbn1cblxuZnVuY3Rpb24gZXNjYXBlZEhleExlbihjKSB7XG4gIGlmIChjID09PSAweDc4LyogeCAqLykgeyByZXR1cm4gMjsgfVxuICBpZiAoYyA9PT0gMHg3NS8qIHUgKi8pIHsgcmV0dXJuIDQ7IH1cbiAgaWYgKGMgPT09IDB4NTUvKiBVICovKSB7IHJldHVybiA4OyB9XG4gIHJldHVybiAwO1xufVxuXG5mdW5jdGlvbiBmcm9tRGVjaW1hbENvZGUoYykge1xuICBpZiAoKDB4MzAvKiAwICovIDw9IGMpICYmIChjIDw9IDB4MzkvKiA5ICovKSkge1xuICAgIHJldHVybiBjIC0gMHgzMDtcbiAgfVxuXG4gIHJldHVybiAtMTtcbn1cblxuZnVuY3Rpb24gc2ltcGxlRXNjYXBlU2VxdWVuY2UoYykge1xuICByZXR1cm4gKGMgPT09IDB4MzAvKiAwICovKSA/ICdcXHgwMCcgOlxuICAgICAgICAoYyA9PT0gMHg2MS8qIGEgKi8pID8gJ1xceDA3JyA6XG4gICAgICAgIChjID09PSAweDYyLyogYiAqLykgPyAnXFx4MDgnIDpcbiAgICAgICAgKGMgPT09IDB4NzQvKiB0ICovKSA/ICdcXHgwOScgOlxuICAgICAgICAoYyA9PT0gMHgwOS8qIFRhYiAqLykgPyAnXFx4MDknIDpcbiAgICAgICAgKGMgPT09IDB4NkUvKiBuICovKSA/ICdcXHgwQScgOlxuICAgICAgICAoYyA9PT0gMHg3Ni8qIHYgKi8pID8gJ1xceDBCJyA6XG4gICAgICAgIChjID09PSAweDY2LyogZiAqLykgPyAnXFx4MEMnIDpcbiAgICAgICAgKGMgPT09IDB4NzIvKiByICovKSA/ICdcXHgwRCcgOlxuICAgICAgICAoYyA9PT0gMHg2NS8qIGUgKi8pID8gJ1xceDFCJyA6XG4gICAgICAgIChjID09PSAweDIwLyogU3BhY2UgKi8pID8gJyAnIDpcbiAgICAgICAgKGMgPT09IDB4MjIvKiBcIiAqLykgPyAnXFx4MjInIDpcbiAgICAgICAgKGMgPT09IDB4MkYvKiAvICovKSA/ICcvJyA6XG4gICAgICAgICh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aW5nQ29udGVudCxcbiAgICAgIF9saW5lLFxuICAgICAgX2xpbmVTdGFydCxcbiAgICAgIF9saW5lSW5kZW50LFxuICAgICAgX2tpbmQgPSBzdGF0ZS5raW5kLFxuICAgICAgX3Jlc3VsdCA9IHN0YXRlLnJlc3VsdCxcbiAgICAgIGNoO1xuXG4gIGNoID0gc3RhdGUuaW5wdXQuY2hhckNvZGVBdChzdGF0ZS5wb3NpdGlvbik7XG5cbiAgaWYgKGlzX1dTX09SX0VPTChjaCkgICAgICB8fFxuICAgICAgaXNfRkxPV19JTkRJQ0FUT1IoY2gpIHx8XG4gICAgICBjaCA9PT0gMHgyMy8qICMgKi8gICAgfHxcbiAgICAgIGNoID09PSAweDI2LyogJiAqLyAgICB8fFxuICAgICAgY2ggPT09IDB4MkEvKiAqICovICAgIHx8XG4gICAgICBjaCA9PT0gMHgyMS8qICEgKi8gICAgfHxcbiAgICAgIGNoID09PSAweDdDLyogfCAqLyAgICB8fFxuICAgICAgY2ggPT09IDB4M0UvKiA+ICovICAgIHx8XG4gICAgICBjaCA9PT0gMHgyNy8qICcgKi8gICAgfHxcbiAgICAgIGNoID09PSAweDIyLyogXCIgKi8gICAgfHxcbiAgICAgIGNoID09PSAweDI1LyogJSAqLyAgICB8fFxuICAgICAgY2ggPT09IDB4NDAvKiBAICovICAgIHx8XG4gICAgICBjaCA9PT0gMHg2MC8qIGAgKi8pIHtcbiAgICByZXR1cm4gZmFsc2U7XG4gIH1cblxuICBpZiAoY2ggPT09IDB4M0YvKiA/ICovIHx8IGNoID09PSAweDJELyogLSAqLykge1xuICAgIGZvbGxvd2luZyA9IHN0YXRlLmlucHV0LmNoYXJDb2RlQXQoc3RhdGUucG9zaXRpb24gKyAxKTtcblxuICAgIGlmIChpc19XU19PUl9FT0woZm9sbG93aW5nKSB8fFxuICAgICAgICB3aXRoaW5GbG93Q29sbGVjdGlvbiAmJiBpc19GTE9XX0lORElDQVRPUihmb2xsb3dpbmcpKSB7XG4gICAgICByZXR1cm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nICsgZGF0YSArICcpJyxcbiAgICAgICAgYXN0ICAgID0gZXNwcmltYS5wYXJzZShzb3VyY2UsIHsgcmFuZ2U6IHRydWUgfSk7XG5cbiAgICBpZiAoYXN0LnR5cGUgICAgICAgICAgICAgICAgICAgICE9PSAnUHJvZ3JhbScgICAgICAgICAgICAgfHxcbiAgICAgICAgYXN0LmJvZHkubGVuZ3RoICAgICAgICAgICAgICE9PSAxICAgICAgICAgICAgICAgICAgICAgfHxcbiAgICAgICAgYXN0LmJvZHlbMF0udHlwZSAgICAgICAgICAgICE9PSAnRXhwcmVzc2lvblN0YXRlbWVudCcgfHxcbiAgICAgICAgYXN0LmJvZHlbMF0uZXhwcmVzc2lvbi50eXBlICE9PSAnRnVuY3Rpb25FeHByZXNzaW9uJykge1xuICAgICAgcmV0dXJuIGZhbHNlO1xuICAgIH1cblxuICAgIHJldHVybiB0cnVlO1xuICB9IGNhdGNoIChlcnIpIHtcbiAgICByZXR1cm4gZmFsc2U7XG4gIH1cbn1cblxuZnVuY3Rpb24gY29uc3RydWN0SmF2YXNjcmlwdEZ1bmN0aW9uKGRhdGEpIHtcbiAgLypqc2xpbnQgZXZpbDp0cnVlKi9cblxuICB2YXIgc291cmNlID0gJygnICsgZGF0YSArICcpJyxcbiAgICAgIGFzdCAgICA9IGVzcHJpbWEucGFyc2Uoc291cmNlLCB7IHJhbmdlOiB0cnVlIH0pLFxuICAgICAgcGFyYW1zID0gW10sXG4gICAgICBib2R5O1xuXG4gIGlmIChhc3QudHlwZSAgICAgICAgICAgICAgICAgICAgIT09ICdQcm9ncmFtJyAgICAgICAgICAgICB8fFxuICAgICAgYXN0LmJvZHkubGVuZ3RoICAgICAgICAgICAgICE9PSAxICAgICAgICAgICAgICAgICAgICAgfHxcbiAgICAgIGFzdC5ib2R5WzBdLnR5cGUgICAgICAgICAgICAhPT0gJ0V4cHJlc3Npb25TdGF0ZW1lbnQnIHx8XG4gICAgICBhc3QuYm9keVswXS5leHByZXNzaW9uLnR5cGUg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6ICdtYXBwaW5nJyxcbiAgcmVzb2x2ZTogcmVzb2x2ZVlhbWxTZXQsXG4gIGNvbnN0cnVjdDogY29uc3RydWN0WWFtbFNldFxufSk7XG4iLCIndXNlIHN0cmljdCc7XG5cbnZhciBUeXBlID0gcmVxdWlyZSgnLi4vdHlwZScpO1xuXG5tb2R1bGUuZXhwb3J0cyA9IG5ldyBUeXBlKCd0YWc6eWFtbC5vcmcsMjAwMjpzdHInLCB7XG4gIGtpbmQ6ICdzY2FsYXInLFxuICBjb25zdHJ1Y3Q6IGZ1bmN0aW9uIChkYXRhKSB7IHJldHVybiBkYXRhICE9PSBudWxsID8gZGF0YSA6ICcnOyB9XG59KTtcbiIsIid1c2Ugc3RyaWN0JztcblxudmFyIFR5cGUgPSByZXF1aXJlKCcuLi90eXBlJyk7XG5cbnZhciBZQU1MX0RBVEVfUkVHRVhQID0gbmV3IFJlZ0V4cChcbiAgJ14oWzAtOV1bMC05XVswLTldWzAtOV0pJyAgICAgICAgICArIC8vIFsxXSB5ZWFyXG4gICctKFswLTldWzAtOV0pJyAgICAgICAgICAgICAgICAgICAgKyAvLyBbMl0gbW9udGhcbiAgJy0oWzAtOV1bMC05XSkkJyk7ICAgICAgICAgICAgICAgICAgIC8vIFszXSBkYXlcblxudmFyIFlBTUxfVElNRVNUQU1QX1JFR0VYUCA9IG5ldyBSZWdFeHAoXG4gICdeKFswLTldWzAtOV1bMC05XVswLTldKScgICAgICAgICAgKyAvLyBbMV0geWVhclxuICAnLShbMC05XVswLTldPyknICAgICAgICAgICAgICAgICAgICsgLy8gWzJdIG1vbnRoXG4gICctKFswLTldWzAtOV0/KScgICAgICAgICAgICAgICAgICAgKyAvLyBbM10gZGF5XG4gICcoPzpbVHRdfFsgXFxcXHRdKyknICAgICAgICAgICAgICAgICArIC8vIC4uLlxuICAnKFswLTldWzAtOV0/KScgICAgICAgICAgICAgICAgICAgICsgLy8gWzRdIGhvdXJcbiAgJzooWzAtOV1bMC05XSknICAgICAgICAgICAg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IHJ1blNpbmdsZSh0YXNrLCBkb21haW4pIHtcbiAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgIHRhc2soKTtcblxuICAgICAgICB9IGNhdGNoIChlKSB7XG4gICAgICAgICAgICBpZiAoaXNOb2RlSlMpIHtcbiAgICAgICAgICAgICAgICAvLyBJbiBub2RlLCB1bmNhdWdodCBleGNlcHRpb25zIGFyZSBjb25zaWRlcmVkIGZhdGFsIGVycm9ycy5cbiAgICAgICAgICAgICAgICAvLyBSZS10aHJvdyB0aGVtIHN5bmNocm9ub3VzbHkgdG8gaW50ZXJydXB0IGZsdXNoaW5nIVxuXG4gICAgICAgICAgICAgICAgLy8gRW5zdXJlIGNvbnRpbnVhdGlvbiBpZiB0aGUgdW5jYXVnaHQgZXhjZXB0aW9uIGlzIHN1cHByZXNzZWRcbiAgICAgICAgICAgICAgICAvLyBsaXN0ZW5pbmcgXCJ1bmNhdWdodEV4Y2VwdGlvblwiIGV2ZW50cyAoYXMgZG9tYWlucyBkb2VzKS5cbiAgICAgICAgICAgICAgICAvLyBDb250aW51ZSBpbiBuZXh0IGV2ZW50IHRvIGF2b2lkIHRpY2sgcmVjdXJzaW9uLlxuICAgICAgICAgICAgICAgIGlmIChkb21haW4pIHtcbiAgICAgICAgICAgICAgICAgICAgZG9tYWluLmV4aXQoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgc2V0VGltZW91dChmbHVzaCwgMCk7XG4gICAgICAgICAgICAgICAgaWYgKGRvbWFpbikge1xuICAgICAgICAgICAgICAgICAgICBkb21haW4uZW50ZXIoKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICB0aHJvdyBlO1xuXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIC8vIEluIGJyb3dzZXJzLCB1bmNhdWdodCBleGNlcHRpb25zIGFyZSBub3QgZmF0YWwuXG4gICAgICAgICAgICAgICAgLy8gUmUtdGhyb3cgdGhlbSBhc3luY2hyb25vdXNseSB0byBhdm9pZCBzbG93LWRvd25zLlxuICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBlO1xuICAgICAgICAgICAgICAgIH0sIDApO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGRvbWFpbikge1xuICAgICAgICAgICAgZG9tYWluLmV4aXQoKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIG5leHRUaWNrID0gZnVuY3Rpb24gKHRhc2spIHtcbiAgICAgICAgdGFpbCA9IHRhaWwubmV4dCA9IHtcbiAgICAgICAgICAgIHRhc2s6IHRhc2ssXG4gICAgICAgICAgICBkb21haW46IGlzTm9kZUpTICYmIHByb2Nlc3MuZG9tYWluLFxuICAgICAgICAgICAgbmV4dDogbnVsbFxuICAgICAgICB9O1xuXG4gICAgICAgIGlmICghZmx1c2hpbmcpIHtcbiAgICAgICAgICAgIGZsdXNoaW5nID0gdHJ1ZTtcbiAgICAgICAgICAgIHJlcXVlc3RUaWNrKCk7XG4gICAgICAgIH1cbiAgICB9O1xuXG4gICAgaWYgKHR5cGVvZiBwcm9jZXNzID09PSBcIm9iamVjdFwiICYmXG4gICAgICAgIHByb2Nlc3MudG9TdHJpbmcoKSA9PT0gXCJbb2JqZWN0IHByb2Nlc3NdXCIgJiYgcHJvY2Vzcy5uZXh0VGljaykge1xuICAgICAgICAvLyBFbnN1cmUgUSBpcyBpbiBhIHJlYWwgTm9kZSBlbnZpcm9ubWVudCwgd2l0aCBhIGBwcm9jZXNzLm5leHRUaWNrYC5cbiAgICAgICAgLy8gVG8gc2VlIHRocm91Z2ggZmFrZSBOb2RlIGVudmlyb25tZW50czpcbiAgICAgICAgLy8gKiBNb2NoYSB0ZXN0IHJ1bm5lciAtIGV4cG9zZXMgYSBgcHJvY2Vzc2AgZ2xvYmFsIHdpdGhvdXQgYSBgbmV4dFRpY2tgXG4gICAgICAgIC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HZhbHVlLCBpZiBvbmUgaXMgbm90IHByb3ZpZGVkXG4gICAgICAgIGlmIChhcmd1bWVudHMubGVuZ3RoID09PSAxKSB7XG4gICAgICAgICAgICAvLyBzZWVrIHRvIHRoZSBmaXJzdCB2YWx1ZSBpbiB0aGUgYXJyYXksIGFjY291bnRpbmdcbiAgICAgICAgICAgIC8vIGZvciB0aGUgcG9zc2liaWxpdHkgdGhhdCBpcyBpcyBhIHNwYXJzZSBhcnJheVxuICAgICAgICAgICAgZG8ge1xuICAgICAgICAgICAgICAgIGlmIChpbmRleCBpbiB0aGlzKSB7XG4gICAgICAgICAgICAgICAgICAgIGJhc2lzID0gdGhpc1tpbmRleCsrXTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmICgrK2luZGV4ID49IGxlbmd0aCkge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSB3aGlsZSAoMSk7XG4gICAgICAgIH1cbiAgICAgICAgLy8gcmVkdWNlXG4gICAgICAgIGZvciAoOyBpbmRleCA8IGxlbmd0aDsgaW5kZXgrKykge1xuICAgICAgICAgICAgLy8gYWNjb3VudCBmb3IgdGhlIHBvc3NpYmlsaXR5IHRoYXQgdGhlIGFycmF5IGlzIHNwYXJzZVxuICAgICAgICAgICAgaWYgKGluZGV4IGluIHRoaXMpIHtcbiAgICAgICAgICAgICAgICBiYXNpcyA9IGNhbGxiYWNrKGJhc2lzLCB0aGlzW2luZGV4XSwgaW5kZXgpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBiYXNpcztcbiAgICB9XG4pO1xuXG52YXIgYXJyYXlfaW5kZXhPZiA9IHVuY3VycnlUaGlzKFxuICAgIEFycmF5LnByb3RvdHlwZS5pbmRleE9mIHx8IGZ1bmN0aW9uICh2YWx1ZSkge1x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jcmlwdG9yW29wXSkge1xuICAgICAgICAgICAgICAgIHJlc3VsdCA9IGRlc2NyaXB0b3Jbb3BdLmFwcGx5KHByb21pc2UsIGFyZ3MpO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICByZXN1bHQgPSBmYWxsYmFjay5jYWxsKHByb21pc2UsIG9wLCBhcmdzKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBjYXRjaCAoZXhjZXB0aW9uKSB7XG4gICAgICAgICAgICByZXN1bHQgPSByZWplY3QoZXhjZXB0aW9uKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAocmVzb2x2ZSkge1xuICAgICAgICAgICAgcmVzb2x2ZShyZXN1bHQpO1xuICAgICAgICB9XG4gICAgfTtcblxuICAgIHByb21pc2UuaW5zcGVjdCA9IGluc3BlY3Q7XG5cbiAgICAvLyBYWFggZGVwcmVjYXRlZCBgdmFsdWVPZmAgYW5kIGBleGNlcHRpb25gIHN1cHBvcnRcbiAgICBpZiAoaW5zcGVjdCkge1xuICAgICAgICB2YXIgaW5zcGVjdGVkID0gaW5zcGVjdCgpO1xuICAgICAgICBpZiAoaW5zcGVjdGVkLnN0YXRlID09PSBcInJlamVjdGVkXCIpIHtcbiAgICAgICAgICAgIHByb21pc2UuZXhjZXB0aW9uID0gaW5zcGVjdGVkLnJlYXNvbjtcbiAgICAgICAgfVxuXG4gICAgICAgIHByb21pc2UudmFsdWVPZiA9IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIHZhciBpbnNwZWN0ZWQgPSBpbnNwZWN0KCk7XG4gICAgICAgICAgICBpZiAoaW5zcGVjdGVkLnN0YXRlID09PSBcInBlbmRpbmdcIiB8fFxuICAgICAgICAgICAgICAgIGluc3BlY3RlZC5zdGF0ZSA9PT0gXCJyZWplY3RlZFwiKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHByb21pc2U7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gaW5zcGV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ICAgICAgICAgfSBjYXRjaCAobmV3RXhjZXB0aW9uKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHJlamVjdChuZXdFeGNlcHRpb24pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZWplY3QoZXhjZXB0aW9uKTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBfcHJvZ3Jlc3NlZCh2YWx1ZSkge1xuICAgICAgICByZXR1cm4gdHlwZW9mIHByb2dyZXNzZWQgPT09IFwiZnVuY3Rpb25cIiA/IHByb2dyZXNzZWQodmFsdWUpIDogdmFsdWU7XG4gICAgfVxuXG4gICAgUS5uZXh0VGljayhmdW5jdGlvbiAoKSB7XG4gICAgICAgIHNlbGYucHJvbWlzZURpc3BhdGNoKGZ1bmN0aW9uICh2YWx1ZSkge1xuICAgICAgICAgICAgaWYgKGRvbmUpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBkb25lID0gdHJ1ZTtcblxuICAgICAgICAgICAgZGVmZXJyZWQucmVzb2x2ZShfZnVsZmlsbGVkKHZhbHVlKSk7XG4gICAgICAgIH0sIFwid2hlblwiLCBbZnVuY3Rpb24gKGV4Y2VwdGlvbikge1xuICAgICAgICAgICAgaWYgKGRvbmUpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBkb25lID0gdHJ1ZTtcblxuICAgICAgICAgICAgZGVmZXJyZWQucmVzb2x2ZShfcmVqZWN0ZWQoZXhjZXB0aW9uKSk7XG4gICAgICAgIH1dKTtcbiAgICB9KTtcblxuICAgIC8vIFByb2dyZXNzIHByb3BhZ2F0b3IgbmVlZCB0byBiZSBhdHRhY2hlZCBpbiB0aGUgY3VycmVudCB0aWNrLlxuICAgIHNlbGYucHJvbWlzZURpc3BhdGNoKHZvaWQgMCwgXCJ3aGVuXCIsIFt2b2lkIDAsIGZ1bmN0aW9uICh2YWx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NvXG4gICAgICAgICAgICAvLyB3ZSBhbHNvIHN1cHBvcnQgUHl0aG9uLXN0eWxlIGdlbmVyYXRvcnMuICBBdCBzb21lIHBvaW50IHdlIGNhbiByZW1vdmVcbiAgICAgICAgICAgIC8vIHRoaXMgYmxvY2suXG5cbiAgICAgICAgICAgIGlmICh0eXBlb2YgU3RvcEl0ZXJhdGlvbiA9PT0gXCJ1bmRlZmluZWRcIikge1xuICAgICAgICAgICAgICAgIC8vIEVTNiBHZW5lcmF0b3JzXG4gICAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAgICAgcmVzdWx0ID0gZ2VuZXJhdG9yW3ZlcmJdKGFyZyk7XG4gICAgICAgICAgICAgICAgfSBjYXRjaCAoZXhjZXB0aW9uKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiByZWplY3QoZXhjZXB0aW9uKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKHJlc3VsdC5kb25lKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBRKHJlc3VsdC52YWx1ZSk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdoZW4ocmVzdWx0LnZhbHVlLCBjYWxsYmFjaywgZXJyYmFjayk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAvLyBTcGlkZXJNb25rZXkgR2VuZXJhdG9yc1xuICAgICAgICAgICAgICAgIC8vIEZJWE1FOiBSZW1vdmUgdGhpcyBjYXNlIHdoZW4gU00gZG9lcyBFUzYgZ2VuZXJhdG9ycy5cbiAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICByZXN1bHQgPSBnZW5lcmF0b3JbdmVyYl0oYXJnKTtcbiAgICAgICAgICAgICAgICB9IGNhdGNoIChleGNlcHRpb24pIHtcbiAgICAgICAgICAgICAgICAgICAgaW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RlZmluZWQsIHByb21pc2UsIGluZGV4KSB7XG4gICAgICAgICAgICB2YXIgc25hcHNob3Q7XG4gICAgICAgICAgICBpZiAoXG4gICAgICAgICAgICAgICAgaXNQcm9taXNlKHByb21pc2UpICYmXG4gICAgICAgICAgICAgICAgKHNuYXBzaG90ID0gcHJvbWlzZS5pbnNwZWN0KCkpLnN0YXRlID09PSBcImZ1bGZpbGxlZFwiXG4gICAgICAgICAgICApIHtcbiAgICAgICAgICAgICAgICBwcm9taXNlc1tpbmRleF0gPSBzbmFwc2hvdC52YWx1ZTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgKytwZW5kaW5nQ291bnQ7XG4gICAgICAgICAgICAgICAgd2hlbihcbiAgICAgICAgICAgICAgICAgICAgcHJvbWlzZSxcbiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBwcm9taXNlc1tpbmRleF0gPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgtLXBlbmRpbmdDb3VudCA9PT0gMCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmVycmVkLnJlc29sdmUocHJvbWlzZXMpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgICAgICBkZWZlcnJlZC5yZWplY3QsXG4gICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChwcm9ncmVzcykge1xuICAgICAgICAgICAgICAgICAgICAgICAgZGVmZXJyZWQubm90aWZ5KHsgaW5kZXg6IGluZGV4LCB2YWx1ZTogcHJvZ3Jlc3MgfSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LCB2b2lkIDApO1xuICAgICAgICBpZiAocGVuZGluZ0NvdW50ID09PSAwKSB7XG4gICAgICAgICAgICB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mlsbGVkLCBvblJlamVjdGVkLCBvblByb2dyZXNzKTtcbiAgICAgICAgZnVuY3Rpb24gb25GdWxmaWxsZWQocmVzdWx0KSB7XG4gICAgICAgICAgICBkZWZlcnJlZC5yZXNvbHZlKHJlc3VsdCk7XG4gICAgICAgIH1cbiAgICAgICAgZnVuY3Rpb24gb25SZWplY3RlZCgpIHtcbiAgICAgICAgICAgIHBlbmRpbmdDb3VudC0tO1xuICAgICAgICAgICAgaWYgKHBlbmRpbmdDb3VudCA9PT0gMCkge1xuICAgICAgICAgICAgICAgIGRlZmVycmVkLnJlamVjdChuZXcgRXJyb3IoXG4gICAgICAgICAgICAgICAgICAgIFwiQ2FuJ3QgZ2V0IGZ1bGZpbGxtZW50IHZhbHVlIGZyb20gYW55IHByb21pc2UsIGFsbCBcIiArXG4gICAgICAgICAgICAgICAgICAgIFwicHJvbWlzZXMgd2VyZSByZWplY3RlZC5cIlxuICAgICAgICAgICAgICAgICkpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGZ1bmN0aW9uIG9uUHJvZ3Jlc3MocHJvZ3Jlc3MpIHtcbiAgICAgICAgICAgIGRlZmVycmVkLm5vdGlmeSh7XG4gICAgICAgICAgICAgICAgaW5kZXg6IGluZGV4LFxuICAgICAgICAgICAgICAgIHZhbHVlOiBwcm9ncmVzc1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICB9LCB1bmRlZmluZWQpO1xuXG4gICAgcmV0dXJuIGRlZmVycmVkLnByb21pc2U7XG59XG5cblByb21pc2UucHJvdG90eXBlLmFueSA9IGZ1bmN0aW9uICgpIHtcbiAgICByZXR1cm4gYW55KHRoaXMpO1xufTtcblxuLyoqXG4gKiBXYWl0cyBmb3IgYWxsIHByb21pc2VzIHRvIGJlIHNldHRsZWQsIGVpdGhlciBmdWxmaWxsZWQgb3JcbiAqIHJlamVjdGVkLiAgVGhpcyBpcyBkaXN0aW5jdCBmcm9tIGBhbGxgIHNpbmNlIHRoY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hY2tzIGZvciBgZXZlbnRgLlxyXG4gKlxyXG4gKiBAcGFyYW0ge1N0cmluZ30gZXZlbnRcclxuICogQHJldHVybiB7QXJyYXl9XHJcbiAqIEBhcGkgcHVibGljXHJcbiAqL1xyXG5cclxuRW1pdHRlci5wcm90b3R5cGUubGlzdGVuZXJzID0gZnVuY3Rpb24oZXZlbnQpe1xyXG4gIHRoaXMuX2NhbGxiYWNrcyA9IHRoaXMuX2NhbGxiYWNrcyB8fCB7fTtcclxuICByZXR1cm4gdGhpcy5fY2FsbGJhY2tzWyckJyArIGV2ZW50XSB8fCBbXTtcclxufTtcclxuXHJcbi8qKlxyXG4gKiBDaGVjayBpZiB0aGlzIGVtaXR0ZXIgaGFzIGBldmVudGAgaGFuZGxlcnMuXHJcbiAqXHJcbiAqIEBwYXJhbSB7U3RyaW5nfSBldmVudFxyXG4gKiBAcmV0dXJuIHtCb29sZWFufVxyXG4gKiBAYXBpIHB1YmxpY1xyXG4gKi9cclxuXHJcbkVtaXR0ZXIucHJvdG90eXBlLmhhc0xpc3RlbmVycyA9IGZ1bmN0aW9uKGV2ZW50KXtcclxuICByZXR1cm4gISEgdGhpcy5saXN0ZW5lcnMoZXZlbnQpLmxlbmd0aDtcclxufTtcclxuIl19 |
| 21570 | |
| 21571 | /*global JSONEditor*/ |
| 21572 | 'use strict'; |
| 21573 | |
| 21574 | window.SwaggerUi = Backbone.Router.extend({ |
| 21575 | |
| 21576 | dom_id: 'swagger_ui', |
| 21577 | |
| 21578 | // Attributes |
| 21579 | options: null, |
| 21580 | api: null, |
| 21581 | headerView: null, |
| 21582 | mainView: null, |
| 21583 | |
| 21584 | // SwaggerUi accepts all the same options as SwaggerApi |
| 21585 | initialize: function(options) { |
| 21586 | options = options || {}; |
| 21587 | |
| 21588 | if (options.defaultModelRendering !== 'model') { |
| 21589 | options.defaultModelRendering = 'schema'; |
| 21590 | } |
| 21591 | |
| 21592 | if (!options.highlightSizeThreshold) { |
| 21593 | options.highlightSizeThreshold = 100000; |
| 21594 | } |
| 21595 | |
| 21596 | // Allow dom_id to be overridden |
| 21597 | if (options.dom_id) { |
| 21598 | this.dom_id = options.dom_id; |
| 21599 | delete options.dom_id; |
| 21600 | } |
| 21601 | |
| 21602 | if (!options.supportedSubmitMethods){ |
| 21603 | options.supportedSubmitMethods = [ |
| 21604 | 'get', |
| 21605 | 'put', |
| 21606 | 'post', |
| 21607 | 'delete', |
| 21608 | 'head', |
| 21609 | 'options', |
| 21610 | 'patch' |
| 21611 | ]; |
| 21612 | } |
| 21613 | |
| 21614 | if (typeof options.oauth2RedirectUrl === 'string') { |
| 21615 | window.oAuthRedirectUrl = options.oauth2RedirectUrl; |
| 21616 | } |
| 21617 | |
| 21618 | // Create an empty div which contains the dom_id |
| 21619 | if (! $('#' + this.dom_id).length){ |
| 21620 | $('body').append('<div id="' + this.dom_id + '"></div>') ; |
| 21621 | } |
| 21622 | |
| 21623 | this.options = options; |
| 21624 | |
| 21625 | // set marked options |
| 21626 | marked.setOptions({gfm: true}); |
| 21627 | |
| 21628 | // Set the callbacks |
| 21629 | var that = this; |
| 21630 | this.options.success = function() { return that.render(); }; |
| 21631 | this.options.progress = function(d) { return that.showMessage(d); }; |
| 21632 | this.options.failure = function(d) { return that.onLoadFailure(d); }; |
| 21633 | |
| 21634 | // Create view to handle the header inputs |
| 21635 | this.headerView = new SwaggerUi.Views.HeaderView({el: $('#header')}); |
| 21636 | |
| 21637 | // Event handler for when the baseUrl/apiKey is entered by user |
| 21638 | this.headerView.on('update-swagger-ui', function(data) { |
| 21639 | return that.updateSwaggerUi(data); |
| 21640 | }); |
| 21641 | |
| 21642 | // JSon Editor custom theming |
| 21643 | JSONEditor.defaults.iconlibs.swagger = JSONEditor.AbstractIconLib.extend({ |
| 21644 | mapping: { |
| 21645 | collapse: 'collapse', |
| 21646 | expand: 'expand' |
| 21647 | }, |
| 21648 | icon_prefix: 'swagger-' |
| 21649 | }); |
| 21650 | |
| 21651 | }, |
| 21652 | |
| 21653 | // Set an option after initializing |
| 21654 | setOption: function(option, value) { |
| 21655 | this.options[option] = value; |
| 21656 | }, |
| 21657 | |
| 21658 | // Get the value of a previously set option |
| 21659 | getOption: function(option) { |
| 21660 | return this.options[option]; |
| 21661 | }, |
| 21662 | |
| 21663 | // Event handler for when url/key is received from user |
| 21664 | updateSwaggerUi: function(data){ |
| 21665 | this.options.url = data.url; |
| 21666 | this.load(); |
| 21667 | }, |
| 21668 | |
| 21669 | // Create an api and render |
| 21670 | load: function(){ |
| 21671 | // Initialize the API object |
| 21672 | if (this.mainView) { |
| 21673 | this.mainView.clear(); |
| 21674 | } |
| 21675 | |
| 21676 | if (this.authView) { |
| 21677 | this.authView.remove(); |
| 21678 | } |
| 21679 | var url = this.options.url; |
| 21680 | if (url && url.indexOf('http') !== 0) { |
| 21681 | url = this.buildUrl(window.location.href.toString(), url); |
| 21682 | } |
| 21683 | if(this.api) { |
| 21684 | this.options.authorizations = this.api.clientAuthorizations.authz; |
| 21685 | } |
| 21686 | this.options.url = url; |
| 21687 | this.headerView.update(url); |
| 21688 | |
| 21689 | this.api = new SwaggerClient(this.options); |
| 21690 | }, |
| 21691 | |
| 21692 | // collapse all sections |
| 21693 | collapseAll: function(){ |
| 21694 | Docs.collapseEndpointListForResource(''); |
| 21695 | }, |
| 21696 | |
| 21697 | // list operations for all sections |
| 21698 | listAll: function(){ |
| 21699 | Docs.collapseOperationsForResource(''); |
| 21700 | }, |
| 21701 | |
| 21702 | // expand operations for all sections |
| 21703 | expandAll: function(){ |
| 21704 | Docs.expandOperationsForResource(''); |
| 21705 | }, |
| 21706 | |
| 21707 | // This is bound to success handler for SwaggerApi |
| 21708 | // so it gets called when SwaggerApi completes loading |
| 21709 | render: function(){ |
| 21710 | var authsModel; |
| 21711 | this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...'); |
| 21712 | this.mainView = new SwaggerUi.Views.MainView({ |
| 21713 | model: this.api, |
| 21714 | el: $('#' + this.dom_id), |
| 21715 | swaggerOptions: this.options, |
| 21716 | router: this |
| 21717 | }).render(); |
| 21718 | if (!_.isEmpty(this.api.securityDefinitions)){ |
| 21719 | authsModel = _.map(this.api.securityDefinitions, function (auth, name) { |
| 21720 | var result = {}; |
| 21721 | result[name] = auth; |
| 21722 | return result; |
| 21723 | }); |
| 21724 | this.authView = new SwaggerUi.Views.AuthButtonView({ |
| 21725 | data: SwaggerUi.utils.parseSecurityDefinitions(authsModel), |
| 21726 | router: this |
| 21727 | }); |
| 21728 | $('#auth_container').append(this.authView.render().el); |
| 21729 | } |
| 21730 | this.showMessage(); |
| 21731 | switch (this.options.docExpansion) { |
| 21732 | case 'full': |
| 21733 | this.expandAll(); break; |
| 21734 | case 'list': |
| 21735 | this.listAll(); break; |
| 21736 | default: |
| 21737 | break; |
| 21738 | } |
| 21739 | this.renderGFM(); |
| 21740 | |
| 21741 | if (this.options.onComplete){ |
| 21742 | this.options.onComplete(this.api, this); |
| 21743 | } |
| 21744 | |
| 21745 | setTimeout(Docs.shebang.bind(this), 100); |
| 21746 | }, |
| 21747 | |
| 21748 | buildUrl: function(base, url){ |
| 21749 | if (url.indexOf('/') === 0) { |
| 21750 | var parts = base.split('/'); |
| 21751 | base = parts[0] + '//' + parts[2]; |
| 21752 | return base + url; |
| 21753 | } else { |
| 21754 | var endOfPath = base.length; |
| 21755 | |
| 21756 | if (base.indexOf('?') > -1){ |
| 21757 | endOfPath = Math.min(endOfPath, base.indexOf('?')); |
| 21758 | } |
| 21759 | |
| 21760 | if (base.indexOf('#') > -1){ |
| 21761 | endOfPath = Math.min(endOfPath, base.indexOf('#')); |
| 21762 | } |
| 21763 | |
| 21764 | base = base.substring(0, endOfPath); |
| 21765 | |
| 21766 | if (base.indexOf('/', base.length - 1 ) !== -1){ |
| 21767 | return base + url; |
| 21768 | } |
| 21769 | |
| 21770 | return base + '/' + url; |
| 21771 | } |
| 21772 | }, |
| 21773 | |
| 21774 | // Shows message on topbar of the ui |
| 21775 | showMessage: function(data){ |
| 21776 | if (data === undefined) { |
| 21777 | data = ''; |
| 21778 | } |
| 21779 | var $msgbar = $('#message-bar'); |
| 21780 | $msgbar.removeClass('message-fail'); |
| 21781 | $msgbar.addClass('message-success'); |
| 21782 | $msgbar.text(data); |
| 21783 | if(window.SwaggerTranslator) { |
| 21784 | window.SwaggerTranslator.translate($msgbar); |
| 21785 | } |
| 21786 | }, |
| 21787 | |
| 21788 | // shows message in red |
| 21789 | onLoadFailure: function(data){ |
| 21790 | if (data === undefined) { |
| 21791 | data = ''; |
| 21792 | } |
| 21793 | $('#message-bar').removeClass('message-success'); |
| 21794 | $('#message-bar').addClass('message-fail'); |
| 21795 | |
| 21796 | var val = $('#message-bar').text(data); |
| 21797 | |
| 21798 | if (this.options.onFailure) { |
| 21799 | this.options.onFailure(data); |
| 21800 | } |
| 21801 | |
| 21802 | return val; |
| 21803 | }, |
| 21804 | |
| 21805 | // Renders GFM for elements with 'markdown' class |
| 21806 | renderGFM: function(){ |
| 21807 | $('.markdown').each(function(){ |
| 21808 | $(this).html(marked($(this).html())); |
| 21809 | }); |
| 21810 | |
| 21811 | $('.propDesc', '.model-signature .description').each(function () { |
| 21812 | $(this).html(marked($(this).html())).addClass('markdown'); |
| 21813 | }); |
| 21814 | } |
| 21815 | |
| 21816 | }); |
| 21817 | |
| 21818 | window.SwaggerUi.Views = {}; |
| 21819 | window.SwaggerUi.Models = {}; |
| 21820 | window.SwaggerUi.Collections = {}; |
| 21821 | window.SwaggerUi.partials = {}; |
| 21822 | window.SwaggerUi.utils = {}; |
| 21823 | |
| 21824 | // don't break backward compatibility with previous versions and warn users to upgrade their code |
| 21825 | (function(){ |
| 21826 | window.authorizations = { |
| 21827 | add: function() { |
| 21828 | warn('Using window.authorizations is deprecated. Please use SwaggerUi.api.clientAuthorizations.add().'); |
| 21829 | |
| 21830 | if (typeof window.swaggerUi === 'undefined') { |
| 21831 | throw new TypeError('window.swaggerUi is not defined'); |
| 21832 | } |
| 21833 | |
| 21834 | if (window.swaggerUi instanceof SwaggerUi) { |
| 21835 | window.swaggerUi.api.clientAuthorizations.add.apply(window.swaggerUi.api.clientAuthorizations, arguments); |
| 21836 | } |
| 21837 | } |
| 21838 | }; |
| 21839 | |
| 21840 | window.ApiKeyAuthorization = function() { |
| 21841 | warn('window.ApiKeyAuthorization is deprecated. Please use SwaggerClient.ApiKeyAuthorization.'); |
| 21842 | SwaggerClient.ApiKeyAuthorization.apply(window, arguments); |
| 21843 | }; |
| 21844 | |
| 21845 | window.PasswordAuthorization = function() { |
| 21846 | warn('window.PasswordAuthorization is deprecated. Please use SwaggerClient.PasswordAuthorization.'); |
| 21847 | SwaggerClient.PasswordAuthorization.apply(window, arguments); |
| 21848 | }; |
| 21849 | |
| 21850 | function warn(message) { |
| 21851 | if ('console' in window && typeof window.console.warn === 'function') { |
| 21852 | console.warn(message); |
| 21853 | } |
| 21854 | } |
| 21855 | })(); |
| 21856 | |
| 21857 | |
| 21858 | // UMD |
| 21859 | (function (root, factory) { |
| 21860 | if (typeof define === 'function' && define.amd) { |
| 21861 | // AMD. Register as an anonymous module. |
| 21862 | define(['b'], function (b) { |
| 21863 | return (root.SwaggerUi = factory(b)); |
| 21864 | }); |
| 21865 | } else if (typeof exports === 'object') { |
| 21866 | // Node. Does not work with strict CommonJS, but |
| 21867 | // only CommonJS-like environments that support module.exports, |
| 21868 | // like Node. |
| 21869 | module.exports = factory(require('b')); |
| 21870 | } else { |
| 21871 | // Browser globals |
| 21872 | root.SwaggerUi = factory(root.b); |
| 21873 | } |
| 21874 | }(this, function () { |
| 21875 | return SwaggerUi; |
| 21876 | })); |
| 21877 | |
| 21878 | 'use strict'; |
| 21879 | |
| 21880 | window.SwaggerUi.utils = { |
| 21881 | parseSecurityDefinitions: function (security) { |
| 21882 | var auths = Object.assign({}, window.swaggerUi.api.authSchemes || window.swaggerUi.api.securityDefinitions); |
| 21883 | var oauth2Arr = []; |
| 21884 | var authsArr = []; |
| 21885 | var scopes = []; |
| 21886 | var utils = window.SwaggerUi.utils; |
| 21887 | |
| 21888 | if (!Array.isArray(security)) { return null; } |
| 21889 | |
| 21890 | security.forEach(function (item) { |
| 21891 | var singleSecurity = {}; |
| 21892 | var singleOauth2Security = {}; |
| 21893 | |
| 21894 | for (var key in item) { |
| 21895 | if (Array.isArray(item[key])) { |
| 21896 | if (!auths[key]) { continue; } |
| 21897 | auths[key] = auths[key] || {}; |
| 21898 | if (auths[key].type === 'oauth2') { |
| 21899 | singleOauth2Security[key] = Object.assign({}, auths[key]); |
| 21900 | singleOauth2Security[key].scopes = Object.assign({}, auths[key].scopes); |
| 21901 | for (var i in singleOauth2Security[key].scopes) { |
| 21902 | if (item[key].indexOf(i) < 0) { |
| 21903 | delete singleOauth2Security[key].scopes[i]; |
| 21904 | } |
| 21905 | } |
| 21906 | singleOauth2Security[key].scopes = utils.parseOauth2Scopes(singleOauth2Security[key].scopes); |
| 21907 | scopes = _.merge(scopes, singleOauth2Security[key].scopes); |
| 21908 | } else { |
| 21909 | singleSecurity[key] = Object.assign({}, auths[key]); |
| 21910 | } |
| 21911 | } else { |
| 21912 | if (item[key].type === 'oauth2') { |
| 21913 | singleOauth2Security[key] = Object.assign({}, item[key]); |
| 21914 | singleOauth2Security[key].scopes = utils.parseOauth2Scopes(singleOauth2Security[key].scopes); |
| 21915 | scopes = _.merge(scopes, singleOauth2Security[key].scopes); |
| 21916 | } else { |
| 21917 | singleSecurity[key] = item[key]; |
| 21918 | } |
| 21919 | } |
| 21920 | } |
| 21921 | |
| 21922 | if (!_.isEmpty(singleSecurity)) { |
| 21923 | authsArr.push(singleSecurity); |
| 21924 | } |
| 21925 | |
| 21926 | if (!_.isEmpty(singleOauth2Security)){ |
| 21927 | oauth2Arr.push(singleOauth2Security); |
| 21928 | } |
| 21929 | }); |
| 21930 | |
| 21931 | return { |
| 21932 | auths : authsArr, |
| 21933 | oauth2: oauth2Arr, |
| 21934 | scopes: scopes |
| 21935 | }; |
| 21936 | }, |
| 21937 | |
| 21938 | parseOauth2Scopes: function (data) { |
| 21939 | var scopes = Object.assign({}, data); |
| 21940 | var result = []; |
| 21941 | var key; |
| 21942 | |
| 21943 | for (key in scopes) { |
| 21944 | result.push({scope: key, description: scopes[key]}); |
| 21945 | } |
| 21946 | |
| 21947 | return result; |
| 21948 | }, |
| 21949 | |
| 21950 | sanitize: function(html) { |
| 21951 | // Strip the script tags from the html and inline evenhandlers |
| 21952 | html = html.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, ''); |
| 21953 | html = html.replace(/(on\w+="[^"]*")*(on\w+='[^']*')*(on\w+=\w*\(\w*\))*/gi, ''); |
| 21954 | |
| 21955 | return html; |
| 21956 | } |
| 21957 | }; |
| 21958 | 'use strict'; |
| 21959 | |
| 21960 | SwaggerUi.Models.ApiKeyAuthModel = Backbone.Model.extend({ |
| 21961 | defaults: { |
| 21962 | 'in': '', |
| 21963 | name: '', |
| 21964 | title: '', |
| 21965 | value: '' |
| 21966 | }, |
| 21967 | |
| 21968 | initialize: function () { |
| 21969 | this.on('change', this.validate); |
| 21970 | }, |
| 21971 | |
| 21972 | validate: function () { |
| 21973 | var valid = !!this.get('value'); |
| 21974 | |
| 21975 | this.set('valid', valid); |
| 21976 | |
| 21977 | return valid; |
| 21978 | } |
| 21979 | }); |
| 21980 | 'use strict'; |
| 21981 | |
| 21982 | SwaggerUi.Views.ApiKeyAuthView = Backbone.View.extend({ // TODO: append this to global SwaggerUi |
| 21983 | |
| 21984 | events: { |
| 21985 | 'change .input_apiKey_entry': 'apiKeyChange' |
| 21986 | }, |
| 21987 | |
| 21988 | selectors: { |
| 21989 | apikeyInput: '.input_apiKey_entry' |
| 21990 | }, |
| 21991 | |
| 21992 | template: Handlebars.templates.apikey_auth, |
| 21993 | |
| 21994 | initialize: function(opts) { |
| 21995 | this.options = opts || {}; |
| 21996 | this.router = this.options.router; |
| 21997 | }, |
| 21998 | |
| 21999 | render: function (){ |
| 22000 | this.$el.html(this.template(this.model.toJSON())); |
| 22001 | |
| 22002 | return this; |
| 22003 | }, |
| 22004 | |
| 22005 | apiKeyChange: function (e) { |
| 22006 | var val = $(e.target).val(); |
| 22007 | if (val) { |
| 22008 | this.$(this.selectors.apikeyInput).removeClass('error'); |
| 22009 | } |
| 22010 | |
| 22011 | this.model.set('value', val); |
| 22012 | }, |
| 22013 | |
| 22014 | isValid: function () { |
| 22015 | return this.model.validate(); |
| 22016 | }, |
| 22017 | |
| 22018 | highlightInvalid: function () { |
| 22019 | if (!this.isValid()) { |
| 22020 | this.$(this.selectors.apikeyInput).addClass('error'); |
| 22021 | } |
| 22022 | } |
| 22023 | |
| 22024 | }); |
| 22025 | 'use strict'; |
| 22026 | |
| 22027 | SwaggerUi.Views.AuthButtonView = Backbone.View.extend({ |
| 22028 | events: { |
| 22029 | 'click .authorize__btn': 'authorizeBtnClick' |
| 22030 | }, |
| 22031 | |
| 22032 | tpls: { |
| 22033 | popup: Handlebars.templates.popup, |
| 22034 | authBtn: Handlebars.templates.auth_button, |
| 22035 | authBtnOperation: Handlebars.templates.auth_button_operation |
| 22036 | }, |
| 22037 | |
| 22038 | initialize: function(opts) { |
| 22039 | this.options = opts || {}; |
| 22040 | this.options.data = this.options.data || {}; |
| 22041 | this.isOperation = this.options.isOperation; |
| 22042 | this.model = this.model || {}; |
| 22043 | this.router = this.options.router; |
| 22044 | this.auths = this.options.data.oauth2.concat(this.options.data.auths); |
| 22045 | }, |
| 22046 | |
| 22047 | render: function () { |
| 22048 | var tplName = this.isOperation ? 'authBtnOperation' : 'authBtn'; |
| 22049 | |
| 22050 | this.$authEl = this.renderAuths(this.auths); |
| 22051 | this.$el.html(this.tpls[tplName](this.model)); |
| 22052 | |
| 22053 | return this; |
| 22054 | }, |
| 22055 | |
| 22056 | authorizeBtnClick: function (e) { |
| 22057 | var authsModel; |
| 22058 | |
| 22059 | e.preventDefault(); |
| 22060 | |
| 22061 | authsModel = { |
| 22062 | title: 'Available authorizations', |
| 22063 | content: this.$authEl |
| 22064 | }; |
| 22065 | |
| 22066 | // The content of the popup is removed and all events unbound after clicking the 'Cancel' button of the popup. |
| 22067 | // We'll have to re-render the contents before creating a new popup view. |
| 22068 | this.render(); |
| 22069 | |
| 22070 | this.popup = new SwaggerUi.Views.PopupView({model: authsModel}); |
| 22071 | this.popup.render(); |
| 22072 | }, |
| 22073 | |
| 22074 | renderAuths: function (auths) { |
| 22075 | var $el = $('<div>'); |
| 22076 | var isLogout = false; |
| 22077 | |
| 22078 | auths.forEach(function (auth) { |
| 22079 | var authView = new SwaggerUi.Views.AuthView({data: auth, router: this.router}); |
| 22080 | var authEl = authView.render().el; |
| 22081 | $el.append(authEl); |
| 22082 | if (authView.isLogout) { |
| 22083 | isLogout = true; |
| 22084 | } |
| 22085 | }, this); |
| 22086 | |
| 22087 | this.model.isLogout = isLogout; |
| 22088 | |
| 22089 | return $el; |
| 22090 | } |
| 22091 | |
| 22092 | }); |
| 22093 | |
| 22094 | 'use strict'; |
| 22095 | |
| 22096 | SwaggerUi.Collections.AuthsCollection = Backbone.Collection.extend({ |
| 22097 | constructor: function() { |
| 22098 | var args = Array.prototype.slice.call(arguments); |
| 22099 | |
| 22100 | args[0] = this.parse(args[0]); |
| 22101 | |
| 22102 | Backbone.Collection.apply(this, args); |
| 22103 | }, |
| 22104 | |
| 22105 | add: function (model) { |
| 22106 | var args = Array.prototype.slice.call(arguments); |
| 22107 | |
| 22108 | if (Array.isArray(model)) { |
| 22109 | args[0] = _.map(model, function(val) { |
| 22110 | return this.handleOne(val); |
| 22111 | }, this); |
| 22112 | } else { |
| 22113 | args[0] = this.handleOne(model); |
| 22114 | } |
| 22115 | |
| 22116 | Backbone.Collection.prototype.add.apply(this, args); |
| 22117 | }, |
| 22118 | |
| 22119 | handleOne: function (model) { |
| 22120 | var result = model; |
| 22121 | |
| 22122 | if (! (model instanceof Backbone.Model) ) { |
| 22123 | switch (model.type) { |
| 22124 | case 'oauth2': |
| 22125 | result = new SwaggerUi.Models.Oauth2Model(model); |
| 22126 | break; |
| 22127 | case 'basic': |
| 22128 | result = new SwaggerUi.Models.BasicAuthModel(model); |
| 22129 | break; |
| 22130 | case 'apiKey': |
| 22131 | result = new SwaggerUi.Models.ApiKeyAuthModel(model); |
| 22132 | break; |
| 22133 | default: |
| 22134 | result = new Backbone.Model(model); |
| 22135 | } |
| 22136 | } |
| 22137 | |
| 22138 | return result; |
| 22139 | }, |
| 22140 | |
| 22141 | isValid: function () { |
| 22142 | var valid = true; |
| 22143 | |
| 22144 | this.models.forEach(function(model) { |
| 22145 | if (!model.validate()) { |
| 22146 | valid = false; |
| 22147 | } |
| 22148 | }); |
| 22149 | |
| 22150 | return valid; |
| 22151 | }, |
| 22152 | |
| 22153 | isAuthorized: function () { |
| 22154 | return this.length === this.where({ isLogout: true }).length; |
| 22155 | }, |
| 22156 | |
| 22157 | isPartiallyAuthorized: function () { |
| 22158 | return this.where({ isLogout: true }).length > 0; |
| 22159 | }, |
| 22160 | |
| 22161 | parse: function (data) { |
| 22162 | var authz = Object.assign({}, window.swaggerUi.api.clientAuthorizations.authz); |
| 22163 | |
| 22164 | return _.map(data, function (auth, name) { |
| 22165 | var isBasic = authz[name] && auth.type === 'basic' && authz[name].username && authz[name].password; |
| 22166 | |
| 22167 | _.extend(auth, { |
| 22168 | title: name |
| 22169 | }); |
| 22170 | |
| 22171 | if (authz[name] || isBasic) { |
| 22172 | _.extend(auth, { |
| 22173 | isLogout: true, |
| 22174 | value: isBasic ? undefined : authz[name].value, |
| 22175 | username: isBasic ? authz[name].username : undefined, |
| 22176 | password: isBasic ? authz[name].password : undefined, |
| 22177 | valid: true |
| 22178 | }); |
| 22179 | } |
| 22180 | |
| 22181 | return auth; |
| 22182 | }); |
| 22183 | } |
| 22184 | }); |
| 22185 | 'use strict'; |
| 22186 | |
| 22187 | SwaggerUi.Views.AuthsCollectionView = Backbone.View.extend({ |
| 22188 | |
| 22189 | initialize: function(opts) { |
| 22190 | this.options = opts || {}; |
| 22191 | this.options.data = this.options.data || {}; |
| 22192 | this.router = this.options.router; |
| 22193 | |
| 22194 | this.collection = new SwaggerUi.Collections.AuthsCollection(opts.data); |
| 22195 | |
| 22196 | this.$innerEl = $('<div>'); |
| 22197 | this.authViews = []; |
| 22198 | }, |
| 22199 | |
| 22200 | render: function () { |
| 22201 | this.collection.each(function (auth) { |
| 22202 | this.renderOneAuth(auth); |
| 22203 | }, this); |
| 22204 | |
| 22205 | this.$el.html(this.$innerEl.html() ? this.$innerEl : ''); |
| 22206 | |
| 22207 | return this; |
| 22208 | }, |
| 22209 | |
| 22210 | renderOneAuth: function (authModel) { |
| 22211 | var authViewEl, authView, authViewName; |
| 22212 | var type = authModel.get('type'); |
| 22213 | |
| 22214 | if (type === 'apiKey') { |
| 22215 | authViewName = 'ApiKeyAuthView'; |
| 22216 | } else if (type === 'basic' && this.$innerEl.find('.basic_auth_container').length === 0) { |
| 22217 | authViewName = 'BasicAuthView'; |
| 22218 | } else if (type === 'oauth2') { |
| 22219 | authViewName = 'Oauth2View'; |
| 22220 | } |
| 22221 | |
| 22222 | if (authViewName) { |
| 22223 | authView = new SwaggerUi.Views[authViewName]({model: authModel, router: this.router}); |
| 22224 | authViewEl = authView.render().el; |
| 22225 | this.authViews.push(authView); |
| 22226 | } |
| 22227 | |
| 22228 | this.$innerEl.append(authViewEl); |
| 22229 | }, |
| 22230 | |
| 22231 | highlightInvalid: function () { |
| 22232 | this.authViews.forEach(function (view) { |
| 22233 | view.highlightInvalid(); |
| 22234 | }, this); |
| 22235 | } |
| 22236 | |
| 22237 | }); |
| 22238 | |
| 22239 | 'use strict'; |
| 22240 | |
| 22241 | /* global redirect_uri:true */ |
| 22242 | /* global clientId */ |
| 22243 | /* global scopeSeparator */ |
| 22244 | /* global additionalQueryStringParams */ |
| 22245 | /* global clientSecret */ |
| 22246 | /* global onOAuthComplete */ |
| 22247 | /* global realm */ |
| 22248 | /*jshint unused:false*/ |
| 22249 | |
| 22250 | SwaggerUi.Views.AuthView = Backbone.View.extend({ |
| 22251 | events: { |
| 22252 | 'click .auth_submit__button': 'authorizeClick', |
| 22253 | 'click .auth_logout__button': 'logoutClick' |
| 22254 | }, |
| 22255 | |
| 22256 | tpls: { |
| 22257 | main: Handlebars.templates.auth_view |
| 22258 | }, |
| 22259 | |
| 22260 | selectors: { |
| 22261 | innerEl: '.auth_inner', |
| 22262 | authBtn: '.auth_submit__button' |
| 22263 | }, |
| 22264 | |
| 22265 | initialize: function(opts) { |
| 22266 | this.options = opts || {}; |
| 22267 | opts.data = opts.data || {}; |
| 22268 | this.router = this.options.router; |
| 22269 | |
| 22270 | this.authsCollectionView = new SwaggerUi.Views.AuthsCollectionView({data: opts.data}); |
| 22271 | |
| 22272 | this.$el.html(this.tpls.main({ |
| 22273 | isLogout: this.authsCollectionView.collection.isAuthorized(), |
| 22274 | isAuthorized: this.authsCollectionView.collection.isPartiallyAuthorized() |
| 22275 | })); |
| 22276 | this.$innerEl = this.$(this.selectors.innerEl); |
| 22277 | this.isLogout = this.authsCollectionView.collection.isPartiallyAuthorized(); |
| 22278 | }, |
| 22279 | |
| 22280 | render: function () { |
| 22281 | this.$innerEl.html(this.authsCollectionView.render().el); |
| 22282 | |
| 22283 | return this; |
| 22284 | }, |
| 22285 | |
| 22286 | authorizeClick: function (e) { |
| 22287 | e.preventDefault(); |
| 22288 | e.stopPropagation(); |
| 22289 | |
| 22290 | if (this.authsCollectionView.collection.isValid()) { |
| 22291 | this.authorize(); |
| 22292 | } else { |
| 22293 | this.authsCollectionView.highlightInvalid(); |
| 22294 | } |
| 22295 | }, |
| 22296 | |
| 22297 | authorize: function () { |
| 22298 | this.authsCollectionView.collection.forEach(function (auth) { |
| 22299 | var keyAuth, basicAuth; |
| 22300 | var type = auth.get('type'); |
| 22301 | |
| 22302 | if (type === 'apiKey') { |
| 22303 | keyAuth = new SwaggerClient.ApiKeyAuthorization( |
| 22304 | auth.get('name'), |
| 22305 | auth.get('value'), |
| 22306 | auth.get('in') |
| 22307 | ); |
| 22308 | |
| 22309 | this.router.api.clientAuthorizations.add(auth.get('title'), keyAuth); |
| 22310 | } else if (type === 'basic') { |
| 22311 | basicAuth = new SwaggerClient.PasswordAuthorization(auth.get('username'), auth.get('password')); |
| 22312 | this.router.api.clientAuthorizations.add(auth.get('title'), basicAuth); |
| 22313 | } else if (type === 'oauth2') { |
| 22314 | this.handleOauth2Login(auth); |
| 22315 | } |
| 22316 | }, this); |
| 22317 | |
| 22318 | this.router.load(); |
| 22319 | }, |
| 22320 | |
| 22321 | logoutClick: function (e) { |
| 22322 | e.preventDefault(); |
| 22323 | |
| 22324 | this.authsCollectionView.collection.forEach(function (auth) { |
| 22325 | window.swaggerUi.api.clientAuthorizations.remove(auth.get('title')); |
| 22326 | }); |
| 22327 | |
| 22328 | this.router.load(); |
| 22329 | }, |
| 22330 | |
| 22331 | // taken from lib/swagger-oauth.js |
| 22332 | handleOauth2Login: function (auth) { |
| 22333 | var host = window.location; |
| 22334 | var pathname = location.pathname.substring(0, location.pathname.lastIndexOf('/')); |
| 22335 | var defaultRedirectUrl = host.protocol + '//' + host.host + pathname + '/o2c.html'; |
| 22336 | var redirectUrl = window.oAuthRedirectUrl || defaultRedirectUrl; |
| 22337 | var url = null; |
| 22338 | var scopes = _.map(auth.get('scopes'), function (scope) { |
| 22339 | return scope.scope; |
| 22340 | }); |
| 22341 | var state, dets, ep; |
| 22342 | window.OAuthSchemeKey = auth.get('title'); |
| 22343 | |
| 22344 | window.enabledScopes = scopes; |
| 22345 | var flow = auth.get('flow'); |
| 22346 | |
| 22347 | if(auth.get('type') === 'oauth2' && flow && (flow === 'implicit' || flow === 'accessCode')) { |
| 22348 | dets = auth.attributes; |
| 22349 | url = dets.authorizationUrl + '?response_type=' + (flow === 'implicit' ? 'token' : 'code'); |
| 22350 | window.swaggerUi.tokenName = dets.tokenName || 'access_token'; |
| 22351 | window.swaggerUi.tokenUrl = (flow === 'accessCode' ? dets.tokenUrl : null); |
| 22352 | state = window.OAuthSchemeKey; |
| 22353 | } |
| 22354 | else if(auth.get('type') === 'oauth2' && flow && (flow === 'application')) { |
| 22355 | dets = auth.attributes; |
| 22356 | window.swaggerUi.tokenName = dets.tokenName || 'access_token'; |
| 22357 | this.clientCredentialsFlow(scopes, dets.tokenUrl, window.OAuthSchemeKey); |
| 22358 | return; |
| 22359 | } |
| 22360 | else if(auth.get('grantTypes')) { |
| 22361 | // 1.2 support |
| 22362 | var o = auth.get('grantTypes'); |
| 22363 | for(var t in o) { |
| 22364 | if(o.hasOwnProperty(t) && t === 'implicit') { |
| 22365 | dets = o[t]; |
| 22366 | ep = dets.loginEndpoint.url; |
| 22367 | url = dets.loginEndpoint.url + '?response_type=token'; |
| 22368 | window.swaggerUi.tokenName = dets.tokenName; |
| 22369 | } |
| 22370 | else if (o.hasOwnProperty(t) && t === 'accessCode') { |
| 22371 | dets = o[t]; |
| 22372 | ep = dets.tokenRequestEndpoint.url; |
| 22373 | url = dets.tokenRequestEndpoint.url + '?response_type=code'; |
| 22374 | window.swaggerUi.tokenName = dets.tokenName; |
| 22375 | } |
| 22376 | } |
| 22377 | } |
| 22378 | |
| 22379 | redirect_uri = redirectUrl; |
| 22380 | |
| 22381 | url += '&redirect_uri=' + encodeURIComponent(redirectUrl); |
| 22382 | url += '&realm=' + encodeURIComponent(realm); |
| 22383 | url += '&client_id=' + encodeURIComponent(clientId); |
| 22384 | url += '&scope=' + encodeURIComponent(scopes.join(scopeSeparator)); |
| 22385 | url += '&state=' + encodeURIComponent(state); |
| 22386 | for (var key in additionalQueryStringParams) { |
| 22387 | url += '&' + key + '=' + encodeURIComponent(additionalQueryStringParams[key]); |
| 22388 | } |
| 22389 | |
| 22390 | window.open(url); |
| 22391 | }, |
| 22392 | |
| 22393 | // taken from lib/swagger-oauth.js |
| 22394 | clientCredentialsFlow: function (scopes, tokenUrl, OAuthSchemeKey) { |
| 22395 | var params = { |
| 22396 | 'client_id': clientId, |
| 22397 | 'client_secret': clientSecret, |
| 22398 | 'scope': scopes.join(' '), |
| 22399 | 'grant_type': 'client_credentials' |
| 22400 | }; |
| 22401 | $.ajax({ |
| 22402 | url : tokenUrl, |
| 22403 | type: 'POST', |
| 22404 | data: params, |
| 22405 | success: function (data) |
| 22406 | { |
| 22407 | onOAuthComplete(data, OAuthSchemeKey); |
| 22408 | }, |
| 22409 | error: function () |
| 22410 | { |
| 22411 | onOAuthComplete(''); |
| 22412 | } |
| 22413 | }); |
| 22414 | } |
| 22415 | |
| 22416 | }); |
| 22417 | |
| 22418 | 'use strict'; |
| 22419 | |
| 22420 | SwaggerUi.Models.BasicAuthModel = Backbone.Model.extend({ |
| 22421 | defaults: { |
| 22422 | username: '', |
| 22423 | password: '', |
| 22424 | title: 'basic' |
| 22425 | }, |
| 22426 | |
| 22427 | initialize: function () { |
| 22428 | this.on('change', this.validate); |
| 22429 | }, |
| 22430 | |
| 22431 | validate: function () { |
| 22432 | var valid = !!this.get('password') && !!this.get('username'); |
| 22433 | |
| 22434 | this.set('valid', valid); |
| 22435 | |
| 22436 | return valid; |
| 22437 | } |
| 22438 | }); |
| 22439 | 'use strict'; |
| 22440 | |
| 22441 | SwaggerUi.Views.BasicAuthView = Backbone.View.extend({ |
| 22442 | |
| 22443 | initialize: function (opts) { |
| 22444 | this.options = opts || {}; |
| 22445 | this.router = this.options.router; |
| 22446 | }, |
| 22447 | |
| 22448 | events: { |
| 22449 | 'change .auth_input': 'inputChange' |
| 22450 | }, |
| 22451 | |
| 22452 | selectors: { |
| 22453 | usernameInput: '.basic_auth__username', |
| 22454 | passwordInput: '.basic_auth__password' |
| 22455 | }, |
| 22456 | |
| 22457 | cls: { |
| 22458 | error: 'error' |
| 22459 | }, |
| 22460 | |
| 22461 | template: Handlebars.templates.basic_auth, |
| 22462 | |
| 22463 | render: function(){ |
| 22464 | $(this.el).html(this.template(this.model.toJSON())); |
| 22465 | |
| 22466 | return this; |
| 22467 | }, |
| 22468 | |
| 22469 | inputChange: function (e) { |
| 22470 | var $el = $(e.target); |
| 22471 | var val = $el.val(); |
| 22472 | var attr = $el.prop('name'); |
| 22473 | |
| 22474 | if (val) { |
| 22475 | $el.removeClass(this.cls.error); |
| 22476 | } |
| 22477 | |
| 22478 | this.model.set(attr, val); |
| 22479 | }, |
| 22480 | |
| 22481 | isValid: function () { |
| 22482 | return this.model.validate(); |
| 22483 | }, |
| 22484 | |
| 22485 | highlightInvalid: function () { |
| 22486 | if (!this.model.get('username')) { |
| 22487 | this.$(this.selectors.usernameInput).addClass(this.cls.error); |
| 22488 | } |
| 22489 | } |
| 22490 | }); |
| 22491 | |
| 22492 | 'use strict'; |
| 22493 | |
| 22494 | SwaggerUi.Views.ContentTypeView = Backbone.View.extend({ |
| 22495 | initialize: function() {}, |
| 22496 | |
| 22497 | render: function(){ |
| 22498 | this.model.contentTypeId = 'ct' + Math.random(); |
| 22499 | $(this.el).html(Handlebars.templates.content_type(this.model)); |
| 22500 | return this; |
| 22501 | } |
| 22502 | }); |
| 22503 | 'use strict'; |
| 22504 | |
| 22505 | SwaggerUi.Views.HeaderView = Backbone.View.extend({ |
| 22506 | events: { |
| 22507 | 'click #show-pet-store-icon' : 'showPetStore', |
| 22508 | 'click #explore' : 'showCustom', |
| 22509 | 'submit #api_selector' : 'showCustom', |
| 22510 | 'keyup #input_baseUrl' : 'showCustomOnKeyup', |
| 22511 | 'keyup #input_apiKey' : 'showCustomOnKeyup' |
| 22512 | }, |
| 22513 | |
| 22514 | initialize: function(){}, |
| 22515 | |
| 22516 | showPetStore: function(){ |
| 22517 | this.trigger('update-swagger-ui', { |
| 22518 | url:'http://petstore.swagger.io/v2/swagger.json' |
| 22519 | }); |
| 22520 | }, |
| 22521 | |
| 22522 | showCustomOnKeyup: function(e){ |
| 22523 | if (e.keyCode === 13) { |
| 22524 | this.showCustom(); |
| 22525 | } |
| 22526 | }, |
| 22527 | |
| 22528 | showCustom: function(e){ |
| 22529 | if (e) { |
| 22530 | e.preventDefault(); |
| 22531 | } |
| 22532 | |
| 22533 | this.trigger('update-swagger-ui', { |
| 22534 | url: $('#input_baseUrl').val() |
| 22535 | }); |
| 22536 | }, |
| 22537 | |
| 22538 | update: function(url, apiKey, trigger){ |
| 22539 | if (trigger === undefined) { |
| 22540 | trigger = false; |
| 22541 | } |
| 22542 | |
| 22543 | $('#input_baseUrl').val(url); |
| 22544 | |
| 22545 | if (trigger) { |
| 22546 | this.trigger('update-swagger-ui', {url:url}); |
| 22547 | } |
| 22548 | } |
| 22549 | }); |
| 22550 | |
| 22551 | 'use strict'; |
| 22552 | |
| 22553 | SwaggerUi.Views.MainView = Backbone.View.extend({ |
| 22554 | apisSorter : { |
| 22555 | alpha : function(a,b){ return a.name.localeCompare(b.name); } |
| 22556 | }, |
| 22557 | operationsSorters : { |
| 22558 | alpha : function(a,b){ return a.path.localeCompare(b.path); }, |
| 22559 | method : function(a,b){ return a.method.localeCompare(b.method); } |
| 22560 | }, |
| 22561 | initialize: function(opts){ |
| 22562 | var sorterOption, sorterFn, key, value; |
| 22563 | opts = opts || {}; |
| 22564 | |
| 22565 | this.router = opts.router; |
| 22566 | |
| 22567 | // Sort APIs |
| 22568 | if (opts.swaggerOptions.apisSorter) { |
| 22569 | sorterOption = opts.swaggerOptions.apisSorter; |
| 22570 | if (_.isFunction(sorterOption)) { |
| 22571 | sorterFn = sorterOption; |
| 22572 | } else { |
| 22573 | sorterFn = this.apisSorter[sorterOption]; |
| 22574 | } |
| 22575 | if (_.isFunction(sorterFn)) { |
| 22576 | this.model.apisArray.sort(sorterFn); |
| 22577 | } |
| 22578 | } |
| 22579 | // Sort operations of each API |
| 22580 | if (opts.swaggerOptions.operationsSorter) { |
| 22581 | sorterOption = opts.swaggerOptions.operationsSorter; |
| 22582 | if (_.isFunction(sorterOption)) { |
| 22583 | sorterFn = sorterOption; |
| 22584 | } else { |
| 22585 | sorterFn = this.operationsSorters[sorterOption]; |
| 22586 | } |
| 22587 | if (_.isFunction(sorterFn)) { |
| 22588 | for (key in this.model.apisArray) { |
| 22589 | this.model.apisArray[key].operationsArray.sort(sorterFn); |
| 22590 | } |
| 22591 | } |
| 22592 | } |
| 22593 | |
| 22594 | // set up the UI for input |
| 22595 | this.model.auths = []; |
| 22596 | |
| 22597 | for (key in this.model.securityDefinitions) { |
| 22598 | value = this.model.securityDefinitions[key]; |
| 22599 | |
| 22600 | this.model.auths.push({ |
| 22601 | name: key, |
| 22602 | type: value.type, |
| 22603 | value: value |
| 22604 | }); |
| 22605 | } |
| 22606 | |
| 22607 | if ('validatorUrl' in opts.swaggerOptions) { |
| 22608 | // Validator URL specified explicitly |
| 22609 | this.model.validatorUrl = opts.swaggerOptions.validatorUrl; |
| 22610 | } else if (this.model.url.indexOf('localhost') > 0 || this.model.url.indexOf('127.0.0.1') > 0) { |
| 22611 | // Localhost override |
| 22612 | this.model.validatorUrl = null; |
| 22613 | } else { |
| 22614 | this.model.validatorUrl = '//online.swagger.io/validator'; |
| 22615 | } |
| 22616 | |
| 22617 | // JSonEditor requires type='object' to be present on defined types, we add it if it's missing |
| 22618 | // is there any valid case were it should not be added ? |
| 22619 | var def; |
| 22620 | for(def in this.model.definitions){ |
| 22621 | if (!this.model.definitions[def].type){ |
| 22622 | this.model.definitions[def].type = 'object'; |
| 22623 | } |
| 22624 | } |
| 22625 | |
| 22626 | }, |
| 22627 | |
| 22628 | render: function () { |
| 22629 | $(this.el).html(Handlebars.templates.main(this.model)); |
| 22630 | this.info = this.$('.info')[0]; |
| 22631 | |
| 22632 | if (this.info) { |
| 22633 | this.info.addEventListener('click', this.onLinkClick, true); |
| 22634 | } |
| 22635 | |
| 22636 | this.model.securityDefinitions = this.model.securityDefinitions || {}; |
| 22637 | |
| 22638 | // Render each resource |
| 22639 | |
| 22640 | var resources = {}; |
| 22641 | var counter = 0; |
| 22642 | for (var i = 0; i < this.model.apisArray.length; i++) { |
| 22643 | var resource = this.model.apisArray[i]; |
| 22644 | var id = resource.name; |
| 22645 | while (typeof resources[id] !== 'undefined') { |
| 22646 | id = id + '_' + counter; |
| 22647 | counter += 1; |
| 22648 | } |
| 22649 | resource.id = sanitizeHtml(id); |
| 22650 | resources[id] = resource; |
| 22651 | this.addResource(resource, this.model.auths); |
| 22652 | } |
| 22653 | |
| 22654 | $('.propWrap').hover(function onHover(){ |
| 22655 | $('.optionsWrapper', $(this)).show(); |
| 22656 | }, function offhover(){ |
| 22657 | $('.optionsWrapper', $(this)).hide(); |
| 22658 | }); |
| 22659 | return this; |
| 22660 | }, |
| 22661 | |
| 22662 | addResource: function(resource, auths){ |
| 22663 | // Render a resource and add it to resources li |
| 22664 | resource.id = resource.id.replace(/\s/g, '_'); |
| 22665 | |
| 22666 | // Make all definitions available at the root of the resource so that they can |
| 22667 | // be loaded by the JSonEditor |
| 22668 | resource.definitions = this.model.definitions; |
| 22669 | |
| 22670 | var resourceView = new SwaggerUi.Views.ResourceView({ |
| 22671 | model: resource, |
| 22672 | router: this.router, |
| 22673 | tagName: 'li', |
| 22674 | id: 'resource_' + resource.id, |
| 22675 | className: 'resource', |
| 22676 | auths: auths, |
| 22677 | swaggerOptions: this.options.swaggerOptions |
| 22678 | }); |
| 22679 | $('#resources', this.el).append(resourceView.render().el); |
| 22680 | }, |
| 22681 | |
| 22682 | clear: function(){ |
| 22683 | $(this.el).html(''); |
| 22684 | }, |
| 22685 | |
| 22686 | onLinkClick: function (e) { |
| 22687 | var el = e.target; |
| 22688 | |
| 22689 | if (el.tagName === 'A' && el.href && !el.target) { |
| 22690 | e.preventDefault(); |
| 22691 | window.open(el.href, '_blank'); |
| 22692 | } |
| 22693 | } |
| 22694 | }); |
| 22695 | |
| 22696 | 'use strict'; |
| 22697 | |
| 22698 | SwaggerUi.Models.Oauth2Model = Backbone.Model.extend({ |
| 22699 | defaults: { |
| 22700 | scopes: {} |
| 22701 | }, |
| 22702 | |
| 22703 | initialize: function () { |
| 22704 | this.on('change', this.validate); |
| 22705 | }, |
| 22706 | |
| 22707 | setScopes: function (name, val) { |
| 22708 | var auth = _.extend({}, this.attributes); |
| 22709 | var index = _.findIndex(auth.scopes, function(o) { |
| 22710 | return o.scope === name; |
| 22711 | }); |
| 22712 | auth.scopes[index].checked = val; |
| 22713 | |
| 22714 | this.set(auth); |
| 22715 | this.validate(); |
| 22716 | }, |
| 22717 | |
| 22718 | validate: function () { |
| 22719 | var valid = false; |
| 22720 | var scp = this.get('scopes'); |
| 22721 | var idx = _.findIndex(scp, function (o) { |
| 22722 | return o.checked === true; |
| 22723 | }); |
| 22724 | |
| 22725 | if(scp.length > 0 && idx >= 0) { |
| 22726 | valid = true; |
| 22727 | } |
| 22728 | |
| 22729 | if(scp.length === 0) { |
| 22730 | valid = true; |
| 22731 | } |
| 22732 | |
| 22733 | this.set('valid', valid); |
| 22734 | |
| 22735 | return valid; |
| 22736 | } |
| 22737 | }); |
| 22738 | |
| 22739 | 'use strict'; |
| 22740 | |
| 22741 | SwaggerUi.Views.Oauth2View = Backbone.View.extend({ |
| 22742 | events: { |
| 22743 | 'change .oauth-scope': 'scopeChange' |
| 22744 | }, |
| 22745 | |
| 22746 | template: Handlebars.templates.oauth2, |
| 22747 | |
| 22748 | render: function () { |
| 22749 | this.$el.html(this.template(this.model.toJSON())); |
| 22750 | |
| 22751 | return this; |
| 22752 | }, |
| 22753 | |
| 22754 | scopeChange: function (e) { |
| 22755 | var val = $(e.target).prop('checked'); |
| 22756 | var scope = $(e.target).data('scope'); |
| 22757 | |
| 22758 | this.model.setScopes(scope, val); |
| 22759 | } |
| 22760 | }); |
| 22761 | 'use strict'; |
| 22762 | |
| 22763 | SwaggerUi.Views.OperationView = Backbone.View.extend({ |
| 22764 | invocationUrl: null, |
| 22765 | |
| 22766 | events: { |
| 22767 | 'submit .sandbox' : 'submitOperation', |
| 22768 | 'click .submit' : 'submitOperation', |
| 22769 | 'click .response_hider' : 'hideResponse', |
| 22770 | 'click .toggleOperation' : 'toggleOperationContent', |
| 22771 | 'mouseenter .api-ic' : 'mouseEnter', |
| 22772 | 'dblclick .curl' : 'selectText', |
| 22773 | 'change [name=responseContentType]' : 'showSnippet' |
| 22774 | }, |
| 22775 | |
| 22776 | initialize: function(opts) { |
| 22777 | opts = opts || {}; |
| 22778 | this.router = opts.router; |
| 22779 | this.auths = opts.auths; |
| 22780 | this.parentId = this.model.parentId; |
| 22781 | this.nickname = this.model.nickname; |
| 22782 | this.model.encodedParentId = encodeURIComponent(this.parentId); |
| 22783 | |
| 22784 | if (opts.swaggerOptions) { |
| 22785 | this.model.defaultRendering = opts.swaggerOptions.defaultModelRendering; |
| 22786 | |
| 22787 | if (opts.swaggerOptions.showRequestHeaders) { |
| 22788 | this.model.showRequestHeaders = true; |
| 22789 | } |
| 22790 | } |
| 22791 | return this; |
| 22792 | }, |
| 22793 | |
| 22794 | selectText: function(event) { |
| 22795 | var doc = document, |
| 22796 | text = event.target.firstChild, |
| 22797 | range, |
| 22798 | selection; |
| 22799 | if (doc.body.createTextRange) { |
| 22800 | range = document.body.createTextRange(); |
| 22801 | range.moveToElementText(text); |
| 22802 | range.select(); |
| 22803 | } else if (window.getSelection) { |
| 22804 | selection = window.getSelection(); |
| 22805 | range = document.createRange(); |
| 22806 | range.selectNodeContents(text); |
| 22807 | selection.removeAllRanges(); |
| 22808 | selection.addRange(range); |
| 22809 | } |
| 22810 | }, |
| 22811 | |
| 22812 | mouseEnter: function(e) { |
| 22813 | var elem = $(this.el).find('.content'); |
| 22814 | var x = e.pageX; |
| 22815 | var y = e.pageY; |
| 22816 | var scX = $(window).scrollLeft(); |
| 22817 | var scY = $(window).scrollTop(); |
| 22818 | var scMaxX = scX + $(window).width(); |
| 22819 | var scMaxY = scY + $(window).height(); |
| 22820 | var wd = elem.width(); |
| 22821 | var hgh = elem.height(); |
| 22822 | |
| 22823 | if (x + wd > scMaxX) { |
| 22824 | x = scMaxX - wd; |
| 22825 | } |
| 22826 | |
| 22827 | if (x < scX) { |
| 22828 | x = scX; |
| 22829 | } |
| 22830 | |
| 22831 | if (y + hgh > scMaxY) { |
| 22832 | y = scMaxY - hgh; |
| 22833 | } |
| 22834 | |
| 22835 | if (y < scY) { |
| 22836 | y = scY; |
| 22837 | } |
| 22838 | |
| 22839 | var pos = {}; |
| 22840 | pos.top = y; |
| 22841 | pos.left = x; |
| 22842 | elem.css(pos); |
| 22843 | }, |
| 22844 | |
| 22845 | // Note: copied from CoffeeScript compiled file |
| 22846 | // TODO: redactor |
| 22847 | render: function() { |
| 22848 | var a, auth, auths, code, contentTypeModel, isMethodSubmissionSupported, k, key, l, len, len1, len2, len3, len4, m, modelAuths, n, o, p, param, q, ref, ref1, ref2, ref3, ref4, ref5, responseContentTypeView, responseSignatureView, schema, schemaObj, scopeIndex, signatureModel, statusCode, successResponse, type, v, value, produces, isXML, isJSON; |
| 22849 | isMethodSubmissionSupported = jQuery.inArray(this.model.method, this.model.supportedSubmitMethods()) >= 0; |
| 22850 | if (!isMethodSubmissionSupported) { |
| 22851 | this.model.isReadOnly = true; |
| 22852 | } |
| 22853 | this.model.description = this.model.description || this.model.notes; |
| 22854 | this.model.oauth = null; |
| 22855 | modelAuths = this.model.authorizations || this.model.security; |
| 22856 | if (modelAuths) { |
| 22857 | if (Array.isArray(modelAuths)) { |
| 22858 | for (l = 0, len = modelAuths.length; l < len; l++) { |
| 22859 | auths = modelAuths[l]; |
| 22860 | for (key in auths) { |
| 22861 | for (a in this.auths) { |
| 22862 | auth = this.auths[a]; |
| 22863 | if (key === auth.name) { |
| 22864 | if (auth.type === 'oauth2') { |
| 22865 | this.model.oauth = {}; |
| 22866 | this.model.oauth.scopes = []; |
| 22867 | ref1 = auth.value.scopes; |
| 22868 | for (k in ref1) { |
| 22869 | v = ref1[k]; |
| 22870 | scopeIndex = auths[key].indexOf(k); |
| 22871 | if (scopeIndex >= 0) { |
| 22872 | o = { |
| 22873 | scope: k, |
| 22874 | description: v |
| 22875 | }; |
| 22876 | this.model.oauth.scopes.push(o); |
| 22877 | } |
| 22878 | } |
| 22879 | } |
| 22880 | } |
| 22881 | } |
| 22882 | } |
| 22883 | } |
| 22884 | } else { |
| 22885 | for (k in modelAuths) { |
| 22886 | v = modelAuths[k]; |
| 22887 | if (k === 'oauth2') { |
| 22888 | if (this.model.oauth === null) { |
| 22889 | this.model.oauth = {}; |
| 22890 | } |
| 22891 | if (this.model.oauth.scopes === void 0) { |
| 22892 | this.model.oauth.scopes = []; |
| 22893 | } |
| 22894 | for (m = 0, len1 = v.length; m < len1; m++) { |
| 22895 | o = v[m]; |
| 22896 | this.model.oauth.scopes.push(o); |
| 22897 | } |
| 22898 | } |
| 22899 | } |
| 22900 | } |
| 22901 | } |
| 22902 | if (typeof this.model.responses !== 'undefined') { |
| 22903 | this.model.responseMessages = []; |
| 22904 | ref2 = this.model.responses; |
| 22905 | for (code in ref2) { |
| 22906 | value = ref2[code]; |
| 22907 | schema = null; |
| 22908 | schemaObj = this.model.responses[code].schema; |
| 22909 | if (schemaObj && schemaObj.$ref) { |
| 22910 | schema = schemaObj.$ref; |
| 22911 | if (schema.indexOf('#/definitions/') !== -1) { |
| 22912 | schema = schema.replace(/^.*#\/definitions\//, ''); |
| 22913 | } |
| 22914 | } |
| 22915 | this.model.responseMessages.push({ |
| 22916 | code: code, |
| 22917 | message: value.description, |
| 22918 | responseModel: schema, |
| 22919 | headers: value.headers, |
| 22920 | schema: schemaObj |
| 22921 | }); |
| 22922 | } |
| 22923 | } |
| 22924 | if (typeof this.model.responseMessages === 'undefined') { |
| 22925 | this.model.responseMessages = []; |
| 22926 | } |
| 22927 | signatureModel = null; |
| 22928 | produces = this.model.produces; |
| 22929 | isXML = this.contains(produces, 'xml'); |
| 22930 | isJSON = isXML ? this.contains(produces, 'json') : true; |
| 22931 | |
| 22932 | if (this.model.successResponse) { |
| 22933 | successResponse = this.model.successResponse; |
| 22934 | for (key in successResponse) { |
| 22935 | value = successResponse[key]; |
| 22936 | this.model.successCode = key; |
| 22937 | if (typeof value === 'object' && typeof value.createJSONSample === 'function') { |
| 22938 | this.model.successDescription = value.description; |
| 22939 | this.model.headers = this.parseResponseHeaders(value.headers); |
| 22940 | signatureModel = { |
| 22941 | sampleJSON: isJSON ? JSON.stringify(SwaggerUi.partials.signature.createJSONSample(value), void 0, 2) : false, |
| 22942 | isParam: false, |
| 22943 | sampleXML: isXML ? SwaggerUi.partials.signature.createXMLSample(value.name, value.definition, value.models) : false, |
| 22944 | signature: SwaggerUi.partials.signature.getModelSignature(value.name, value.definition, value.models, value.modelPropertyMacro) |
| 22945 | }; |
| 22946 | } else { |
| 22947 | signatureModel = { |
| 22948 | signature: SwaggerUi.partials.signature.getPrimitiveSignature(value) |
| 22949 | }; |
| 22950 | } |
| 22951 | } |
| 22952 | } else if (this.model.responseClassSignature && this.model.responseClassSignature !== 'string') { |
| 22953 | signatureModel = { |
| 22954 | sampleJSON: this.model.responseSampleJSON, |
| 22955 | isParam: false, |
| 22956 | signature: this.model.responseClassSignature |
| 22957 | }; |
| 22958 | } |
| 22959 | $(this.el).html(Handlebars.templates.operation(this.model)); |
| 22960 | if (signatureModel) { |
| 22961 | signatureModel.defaultRendering = this.model.defaultRendering; |
| 22962 | responseSignatureView = new SwaggerUi.Views.SignatureView({ |
| 22963 | model: signatureModel, |
| 22964 | router: this.router, |
| 22965 | tagName: 'div' |
| 22966 | }); |
| 22967 | $('.model-signature', $(this.el)).append(responseSignatureView.render().el); |
| 22968 | } else { |
| 22969 | this.model.responseClassSignature = 'string'; |
| 22970 | $('.model-signature', $(this.el)).html(this.model.type); |
| 22971 | } |
| 22972 | contentTypeModel = { |
| 22973 | isParam: false |
| 22974 | }; |
| 22975 | contentTypeModel.consumes = this.model.consumes; |
| 22976 | contentTypeModel.produces = this.model.produces; |
| 22977 | ref3 = this.model.parameters; |
| 22978 | for (n = 0, len2 = ref3.length; n < len2; n++) { |
| 22979 | param = ref3[n]; |
| 22980 | type = param.type || param.dataType || ''; |
| 22981 | if (typeof type === 'undefined') { |
| 22982 | schema = param.schema; |
| 22983 | if (schema && schema.$ref) { |
| 22984 | ref = schema.$ref; |
| 22985 | if (ref.indexOf('#/definitions/') === 0) { |
| 22986 | type = ref.substring('#/definitions/'.length); |
| 22987 | } else { |
| 22988 | type = ref; |
| 22989 | } |
| 22990 | } |
| 22991 | } |
| 22992 | if (type && type.toLowerCase() === 'file') { |
| 22993 | if (!contentTypeModel.consumes) { |
| 22994 | contentTypeModel.consumes = 'multipart/form-data'; |
| 22995 | } |
| 22996 | } |
| 22997 | param.type = type; |
| 22998 | } |
| 22999 | responseContentTypeView = new SwaggerUi.Views.ResponseContentTypeView({ |
| 23000 | model: contentTypeModel, |
| 23001 | router: this.router |
| 23002 | }); |
| 23003 | $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el); |
| 23004 | ref4 = this.model.parameters; |
| 23005 | for (p = 0, len3 = ref4.length; p < len3; p++) { |
| 23006 | param = ref4[p]; |
| 23007 | this.addParameter(param, contentTypeModel.consumes); |
| 23008 | } |
| 23009 | ref5 = this.model.responseMessages; |
| 23010 | for (q = 0, len4 = ref5.length; q < len4; q++) { |
| 23011 | statusCode = ref5[q]; |
| 23012 | statusCode.isXML = isXML; |
| 23013 | statusCode.isJSON = isJSON; |
| 23014 | if (!_.isUndefined(statusCode.headers)) { |
| 23015 | statusCode.headers = this.parseHeadersType(statusCode.headers); |
| 23016 | } |
| 23017 | this.addStatusCode(statusCode); |
| 23018 | } |
| 23019 | |
| 23020 | if (Array.isArray(this.model.security)) { |
| 23021 | var authsModel = SwaggerUi.utils.parseSecurityDefinitions(this.model.security); |
| 23022 | |
| 23023 | authsModel.isLogout = !_.isEmpty(window.swaggerUi.api.clientAuthorizations.authz); |
| 23024 | this.authView = new SwaggerUi.Views.AuthButtonView({ |
| 23025 | data: authsModel, |
| 23026 | router: this.router, |
| 23027 | isOperation: true, |
| 23028 | model: { |
| 23029 | scopes: authsModel.scopes |
| 23030 | } |
| 23031 | }); |
| 23032 | this.$('.authorize-wrapper').append(this.authView.render().el); |
| 23033 | } |
| 23034 | |
| 23035 | this.showSnippet(); |
| 23036 | return this; |
| 23037 | }, |
| 23038 | |
| 23039 | parseHeadersType: function (headers) { |
| 23040 | var map = { |
| 23041 | 'string': { |
| 23042 | 'date-time': 'dateTime', |
| 23043 | 'date' : 'date' |
| 23044 | } |
| 23045 | }; |
| 23046 | |
| 23047 | _.forEach(headers, function (header) { |
| 23048 | var value; |
| 23049 | header = header || {}; |
| 23050 | value = map[header.type] && map[header.type][header.format]; |
| 23051 | if (!_.isUndefined(value)) { |
| 23052 | header.type = value; |
| 23053 | } |
| 23054 | }); |
| 23055 | |
| 23056 | return headers; |
| 23057 | }, |
| 23058 | |
| 23059 | contains: function (produces, type) { |
| 23060 | return produces.filter(function (val) { |
| 23061 | if (val.indexOf(type) > -1) { |
| 23062 | return true; |
| 23063 | } |
| 23064 | }).length; |
| 23065 | }, |
| 23066 | |
| 23067 | parseResponseHeaders: function (data) { |
| 23068 | var HEADERS_SEPARATOR = '; '; |
| 23069 | var headers = _.clone(data); |
| 23070 | |
| 23071 | _.forEach(headers, function (header) { |
| 23072 | var other = []; |
| 23073 | _.forEach(header, function (value, key) { |
| 23074 | var properties = ['type', 'description']; |
| 23075 | if (properties.indexOf(key.toLowerCase()) === -1) { |
| 23076 | other.push(key + ': ' + value); |
| 23077 | } |
| 23078 | }); |
| 23079 | |
| 23080 | other.join(HEADERS_SEPARATOR); |
| 23081 | header.other = other; |
| 23082 | }); |
| 23083 | |
| 23084 | return headers; |
| 23085 | }, |
| 23086 | |
| 23087 | addParameter: function(param, consumes) { |
| 23088 | // Render a parameter |
| 23089 | param.consumes = consumes; |
| 23090 | param.defaultRendering = this.model.defaultRendering; |
| 23091 | |
| 23092 | // Copy this param JSON spec so that it will be available for JsonEditor |
| 23093 | if(param.schema){ |
| 23094 | $.extend(true, param.schema, this.model.definitions[param.type]); |
| 23095 | param.schema.definitions = this.model.definitions; |
| 23096 | // This is required for JsonEditor to display the root properly |
| 23097 | if(!param.schema.type){ |
| 23098 | param.schema.type = 'object'; |
| 23099 | } |
| 23100 | // This is the title that will be used by JsonEditor for the root |
| 23101 | // Since we already display the parameter's name in the Parameter column |
| 23102 | // We set this to space, we can't set it to null or space otherwise JsonEditor |
| 23103 | // will replace it with the text "root" which won't look good on screen |
| 23104 | if(!param.schema.title){ |
| 23105 | param.schema.title = ' '; |
| 23106 | } |
| 23107 | } |
| 23108 | |
| 23109 | var paramView = new SwaggerUi.Views.ParameterView({ |
| 23110 | model: param, |
| 23111 | tagName: 'tr', |
| 23112 | readOnly: this.model.isReadOnly, |
| 23113 | swaggerOptions: this.options.swaggerOptions |
| 23114 | }); |
| 23115 | $('.operation-params', $(this.el)).append(paramView.render().el); |
| 23116 | }, |
| 23117 | |
| 23118 | addStatusCode: function(statusCode) { |
| 23119 | // Render status codes |
| 23120 | statusCode.defaultRendering = this.model.defaultRendering; |
| 23121 | var statusCodeView = new SwaggerUi.Views.StatusCodeView({ |
| 23122 | model: statusCode, |
| 23123 | tagName: 'tr', |
| 23124 | router: this.router |
| 23125 | }); |
| 23126 | $('.operation-status', $(this.el)).append(statusCodeView.render().el); |
| 23127 | }, |
| 23128 | |
| 23129 | // Note: copied from CoffeeScript compiled file |
| 23130 | // TODO: redactor |
| 23131 | submitOperation: function(e) { |
| 23132 | var error_free, form, isFileUpload, map, opts; |
| 23133 | if (e !== null) { |
| 23134 | e.preventDefault(); |
| 23135 | } |
| 23136 | form = $('.sandbox', $(this.el)); |
| 23137 | error_free = true; |
| 23138 | form.find('input.required').each(function() { |
| 23139 | $(this).removeClass('error'); |
| 23140 | if (jQuery.trim($(this).val()) === '') { |
| 23141 | $(this).addClass('error'); |
| 23142 | $(this).wiggle({ |
| 23143 | callback: (function(_this) { |
| 23144 | return function() { |
| 23145 | $(_this).focus(); |
| 23146 | }; |
| 23147 | })(this) |
| 23148 | }); |
| 23149 | error_free = false; |
| 23150 | } |
| 23151 | }); |
| 23152 | form.find('textarea.required:visible').each(function() { |
| 23153 | $(this).removeClass('error'); |
| 23154 | if (jQuery.trim($(this).val()) === '') { |
| 23155 | $(this).addClass('error'); |
| 23156 | $(this).wiggle({ |
| 23157 | callback: (function(_this) { |
| 23158 | return function() { |
| 23159 | return $(_this).focus(); |
| 23160 | }; |
| 23161 | })(this) |
| 23162 | }); |
| 23163 | error_free = false; |
| 23164 | } |
| 23165 | }); |
| 23166 | form.find('select.required').each(function() { |
| 23167 | $(this).removeClass('error'); |
| 23168 | if (this.selectedIndex === -1) { |
| 23169 | $(this).addClass('error'); |
| 23170 | $(this).wiggle({ |
| 23171 | callback: (function(_this) { |
| 23172 | return function() { |
| 23173 | $(_this).focus(); |
| 23174 | }; |
| 23175 | })(this) |
| 23176 | }); |
| 23177 | error_free = false; |
| 23178 | } |
| 23179 | }); |
| 23180 | if (error_free) { |
| 23181 | map = this.getInputMap(form); |
| 23182 | isFileUpload = this.isFileUpload(form); |
| 23183 | opts = { |
| 23184 | parent: this |
| 23185 | }; |
| 23186 | if (this.options.swaggerOptions) { |
| 23187 | for(var key in this.options.swaggerOptions) { |
| 23188 | opts[key] = this.options.swaggerOptions[key]; |
| 23189 | } |
| 23190 | } |
| 23191 | |
| 23192 | var pi; |
| 23193 | for(pi = 0; pi < this.model.parameters.length; pi++){ |
| 23194 | var p = this.model.parameters[pi]; |
| 23195 | if( p.jsonEditor && p.jsonEditor.isEnabled()){ |
| 23196 | var json = p.jsonEditor.getValue(); |
| 23197 | map[p.name] = JSON.stringify(json); |
| 23198 | } |
| 23199 | } |
| 23200 | |
| 23201 | opts.responseContentType = $('div select[name=responseContentType]', $(this.el)).val(); |
| 23202 | opts.requestContentType = $('div select[name=parameterContentType]', $(this.el)).val(); |
| 23203 | $('.response_throbber', $(this.el)).show(); |
| 23204 | if (isFileUpload) { |
| 23205 | $('.request_url', $(this.el)).html('<pre></pre>'); |
| 23206 | $('.request_url pre', $(this.el)).text(this.invocationUrl); |
| 23207 | |
| 23208 | opts.useJQuery = true; |
| 23209 | map.parameterContentType = 'multipart/form-data'; |
| 23210 | this.map = map; |
| 23211 | return this.model.execute(map, opts, this.showCompleteStatus, this.showErrorStatus, this); |
| 23212 | } else { |
| 23213 | this.map = map; |
| 23214 | return this.model.execute(map, opts, this.showCompleteStatus, this.showErrorStatus, this); |
| 23215 | } |
| 23216 | } |
| 23217 | }, |
| 23218 | |
| 23219 | getInputMap: function (form) { |
| 23220 | var map, ref1, l, len, o, ref2, m, len1, val, ref3, n, len2; |
| 23221 | map = {}; |
| 23222 | ref1 = form.find('input'); |
| 23223 | for (l = 0, len = ref1.length; l < len; l++) { |
| 23224 | o = ref1[l]; |
| 23225 | if ((o.value !== null) && jQuery.trim(o.value).length > 0) { |
| 23226 | map[o.name] = o.value; |
| 23227 | } |
| 23228 | if (o.type === 'file') { |
| 23229 | map[o.name] = o.files[0]; |
| 23230 | } |
| 23231 | } |
| 23232 | ref2 = form.find('textarea'); |
| 23233 | for (m = 0, len1 = ref2.length; m < len1; m++) { |
| 23234 | o = ref2[m]; |
| 23235 | val = this.getTextAreaValue(o); |
| 23236 | if ((val !== null) && jQuery.trim(val).length > 0) { |
| 23237 | map[o.name] = val; |
| 23238 | } |
| 23239 | } |
| 23240 | ref3 = form.find('select'); |
| 23241 | for (n = 0, len2 = ref3.length; n < len2; n++) { |
| 23242 | o = ref3[n]; |
| 23243 | val = this.getSelectedValue(o); |
| 23244 | if ((val !== null) && jQuery.trim(val).length > 0) { |
| 23245 | map[o.name] = val; |
| 23246 | } |
| 23247 | } |
| 23248 | return map; |
| 23249 | }, |
| 23250 | |
| 23251 | isFileUpload: function (form) { |
| 23252 | var ref1, l, len, o; |
| 23253 | var isFileUpload = false; |
| 23254 | ref1 = form.find('input'); |
| 23255 | for (l = 0, len = ref1.length; l < len; l++) { |
| 23256 | o = ref1[l]; |
| 23257 | if (o.type === 'file') { |
| 23258 | isFileUpload = true; |
| 23259 | } |
| 23260 | } |
| 23261 | return isFileUpload; |
| 23262 | }, |
| 23263 | |
| 23264 | success: function(response, parent) { |
| 23265 | parent.showCompleteStatus(response); |
| 23266 | }, |
| 23267 | |
| 23268 | // wraps a jquery response as a shred response |
| 23269 | wrap: function(data) { |
| 23270 | var h, headerArray, headers, i, l, len, o; |
| 23271 | headers = {}; |
| 23272 | headerArray = data.getAllResponseHeaders().split('\r'); |
| 23273 | for (l = 0, len = headerArray.length; l < len; l++) { |
| 23274 | i = headerArray[l]; |
| 23275 | h = i.match(/^([^:]*?):(.*)$/); |
| 23276 | if (!h) { |
| 23277 | h = []; |
| 23278 | } |
| 23279 | h.shift(); |
| 23280 | if (h[0] !== void 0 && h[1] !== void 0) { |
| 23281 | headers[h[0].trim()] = h[1].trim(); |
| 23282 | } |
| 23283 | } |
| 23284 | o = {}; |
| 23285 | o.content = {}; |
| 23286 | o.content.data = data.responseText; |
| 23287 | o.headers = headers; |
| 23288 | o.request = {}; |
| 23289 | o.request.url = this.invocationUrl; |
| 23290 | o.status = data.status; |
| 23291 | return o; |
| 23292 | }, |
| 23293 | |
| 23294 | getSelectedValue: function(select) { |
| 23295 | if (!select.multiple) { |
| 23296 | return select.value; |
| 23297 | } else { |
| 23298 | var options = []; |
| 23299 | for (var l = 0, len = select.options.length; l < len; l++) { |
| 23300 | var opt = select.options[l]; |
| 23301 | if (opt.selected) { |
| 23302 | options.push(opt.value); |
| 23303 | } |
| 23304 | } |
| 23305 | if (options.length > 0) { |
| 23306 | return options; |
| 23307 | } else { |
| 23308 | return null; |
| 23309 | } |
| 23310 | } |
| 23311 | }, |
| 23312 | |
| 23313 | // handler for hide response link |
| 23314 | hideResponse: function(e) { |
| 23315 | if (e) { e.preventDefault(); } |
| 23316 | $('.response', $(this.el)).slideUp(); |
| 23317 | $('.response_hider', $(this.el)).fadeOut(); |
| 23318 | }, |
| 23319 | |
| 23320 | // Show response from server |
| 23321 | showResponse: function(response) { |
| 23322 | var prettyJson = JSON.stringify(response, null, '\t').replace(/\n/g, '<br>'); |
| 23323 | $('.response_body', $(this.el)).html(_.escape(prettyJson)); |
| 23324 | }, |
| 23325 | |
| 23326 | // Show error from server |
| 23327 | showErrorStatus: function(data, parent) { |
| 23328 | parent.showStatus(data); |
| 23329 | }, |
| 23330 | |
| 23331 | // show the status codes |
| 23332 | showCompleteStatus: function(data, parent){ |
| 23333 | parent.showStatus(data); |
| 23334 | }, |
| 23335 | |
| 23336 | // Adapted from http://stackoverflow.com/a/2893259/454004 |
| 23337 | // Note: directly ported from CoffeeScript |
| 23338 | // TODO: Cleanup CoffeeScript artifacts |
| 23339 | formatXml: function(xml) { |
| 23340 | var contexp, fn, formatted, indent, l, lastType, len, lines, ln, pad, reg, transitions, wsexp; |
| 23341 | reg = /(>)(<)(\/*)/g; |
| 23342 | wsexp = /[ ]*(.*)[ ]+\n/g; |
| 23343 | contexp = /(<.+>)(.+\n)/g; |
| 23344 | xml = xml.replace(/\r\n/g, '\n').replace(reg, '$1\n$2$3').replace(wsexp, '$1\n').replace(contexp, '$1\n$2'); |
| 23345 | pad = 0; |
| 23346 | formatted = ''; |
| 23347 | lines = xml.split('\n'); |
| 23348 | indent = 0; |
| 23349 | lastType = 'other'; |
| 23350 | transitions = { |
| 23351 | 'single->single': 0, |
| 23352 | 'single->closing': -1, |
| 23353 | 'single->opening': 0, |
| 23354 | 'single->other': 0, |
| 23355 | 'closing->single': 0, |
| 23356 | 'closing->closing': -1, |
| 23357 | 'closing->opening': 0, |
| 23358 | 'closing->other': 0, |
| 23359 | 'opening->single': 1, |
| 23360 | 'opening->closing': 0, |
| 23361 | 'opening->opening': 1, |
| 23362 | 'opening->other': 1, |
| 23363 | 'other->single': 0, |
| 23364 | 'other->closing': -1, |
| 23365 | 'other->opening': 0, |
| 23366 | 'other->other': 0 |
| 23367 | }; |
| 23368 | fn = function(ln) { |
| 23369 | var fromTo, j, key, padding, type, types, value; |
| 23370 | types = { |
| 23371 | single: Boolean(ln.match(/<.+\/>/)), |
| 23372 | closing: Boolean(ln.match(/<\/.+>/)), |
| 23373 | opening: Boolean(ln.match(/<[^!?].*>/)) |
| 23374 | }; |
| 23375 | type = ((function() { |
| 23376 | var results; |
| 23377 | results = []; |
| 23378 | for (key in types) { |
| 23379 | value = types[key]; |
| 23380 | if (value) { |
| 23381 | results.push(key); |
| 23382 | } |
| 23383 | } |
| 23384 | return results; |
| 23385 | })())[0]; |
| 23386 | type = type === void 0 ? 'other' : type; |
| 23387 | fromTo = lastType + '->' + type; |
| 23388 | lastType = type; |
| 23389 | padding = ''; |
| 23390 | indent += transitions[fromTo]; |
| 23391 | padding = ((function() { |
| 23392 | var m, ref1, results; |
| 23393 | results = []; |
| 23394 | for (j = m = 0, ref1 = indent; 0 <= ref1 ? m < ref1 : m > ref1; j = 0 <= ref1 ? ++m : --m) { |
| 23395 | results.push(' '); |
| 23396 | } |
| 23397 | return results; |
| 23398 | })()).join(''); |
| 23399 | if (fromTo === 'opening->closing') { |
| 23400 | formatted = formatted.substr(0, formatted.length - 1) + ln + '\n'; |
| 23401 | } else { |
| 23402 | formatted += padding + ln + '\n'; |
| 23403 | } |
| 23404 | }; |
| 23405 | for (l = 0, len = lines.length; l < len; l++) { |
| 23406 | ln = lines[l]; |
| 23407 | fn(ln); |
| 23408 | } |
| 23409 | return formatted; |
| 23410 | }, |
| 23411 | |
| 23412 | // puts the response data in UI |
| 23413 | showStatus: function(response) { |
| 23414 | console.log(response.headers); |
| 23415 | var url, content; |
| 23416 | if (response.content === undefined) { |
| 23417 | content = response.data; |
| 23418 | url = response.url; |
| 23419 | } else { |
| 23420 | content = response.content.data; |
| 23421 | url = response.request.url; |
| 23422 | } |
| 23423 | var headers = response.headers; |
| 23424 | if(typeof content === 'string') { |
| 23425 | content = jQuery.trim(content); |
| 23426 | } |
| 23427 | |
| 23428 | // if server is nice, and sends content-type back, we can use it |
| 23429 | var contentType = null; |
| 23430 | if (headers) { |
| 23431 | contentType = headers['Content-Type'] || headers['content-type']; |
| 23432 | if (contentType) { |
| 23433 | contentType = contentType.split(';')[0].trim(); |
| 23434 | } |
| 23435 | } |
| 23436 | $('.response_body', $(this.el)).removeClass('json'); |
| 23437 | $('.response_body', $(this.el)).removeClass('xml'); |
| 23438 | |
| 23439 | var supportsAudioPlayback = function(contentType){ |
| 23440 | var audioElement = document.createElement('audio'); |
| 23441 | return !!(audioElement.canPlayType && audioElement.canPlayType(contentType).replace(/no/, '')); |
| 23442 | }; |
| 23443 | |
| 23444 | var pre; |
| 23445 | var code; |
| 23446 | if (!content) { |
| 23447 | code = $('<code />').text('no content'); |
| 23448 | pre = $('<pre class="json" />').append(code); |
| 23449 | |
| 23450 | // JSON |
| 23451 | } else if (headers['Content-Disposition'] && (/attachment/).test(headers['Content-Disposition']) || |
| 23452 | headers['content-disposition'] && (/attachment/).test(headers['content-disposition']) || |
| 23453 | headers['Content-Description'] && (/File Transfer/).test(headers['Content-Description']) || |
| 23454 | headers['content-description'] && (/File Transfer/).test(headers['content-description'])) { |
| 23455 | |
| 23456 | if ('Blob' in window) { |
| 23457 | var type = contentType || 'text/html'; |
| 23458 | |
| 23459 | var a = document.createElement('a'); |
| 23460 | var href = window.URL.createObjectURL(content); |
| 23461 | var fileName = response.url.substr(response.url.lastIndexOf('/') + 1); |
| 23462 | var download = [type, fileName, href].join(':'); |
| 23463 | |
| 23464 | // Use filename from response header |
| 23465 | var disposition = headers['content-disposition'] || headers['Content-Disposition']; |
| 23466 | if(typeof disposition !== 'undefined') { |
| 23467 | var responseFilename = /filename=([^;]*);?/.exec(disposition); |
| 23468 | if(responseFilename !== null && responseFilename.length > 1) { |
| 23469 | download = responseFilename[1]; |
| 23470 | } |
| 23471 | } |
| 23472 | |
| 23473 | a.setAttribute('href', href); |
| 23474 | a.setAttribute('download', download); |
| 23475 | a.innerText = 'Download ' + fileName; |
| 23476 | |
| 23477 | pre = $('<div/>').append(a); |
| 23478 | } else { |
| 23479 | pre = $('<pre class="json" />').append('Download headers detected but your browser does not support downloading binary via XHR (Blob).'); |
| 23480 | } |
| 23481 | } else if (contentType === 'application/json' || /\+json$/.test(contentType)) { |
| 23482 | var json = null; |
| 23483 | try { |
| 23484 | json = JSON.stringify(JSON.parse(content), null, ' '); |
| 23485 | } catch (_error) { |
| 23486 | json = 'can\'t parse JSON. Raw result:\n\n' + content; |
| 23487 | } |
| 23488 | code = $('<code />').text(json); |
| 23489 | pre = $('<pre class="json" />').append(code); |
| 23490 | |
| 23491 | // XML |
| 23492 | } else if (contentType === 'application/xml' || /\+xml$/.test(contentType)) { |
| 23493 | code = $('<code />').text(this.formatXml(content)); |
| 23494 | pre = $('<pre class="xml" />').append(code); |
| 23495 | |
| 23496 | // HTML |
| 23497 | } else if (contentType === 'text/html') { |
| 23498 | code = $('<code />').html(_.escape(content)); |
| 23499 | pre = $('<pre class="xml" />').append(code); |
| 23500 | |
| 23501 | // Plain Text |
| 23502 | } else if (/text\/plain/.test(contentType)) { |
| 23503 | code = $('<code />').text(content); |
| 23504 | pre = $('<pre class="plain" />').append(code); |
| 23505 | |
| 23506 | // Image |
| 23507 | } else if (/^image\//.test(contentType)) { |
| 23508 | var urlCreator = window.URL || window.webkitURL; |
| 23509 | var imageUrl = urlCreator.createObjectURL(content); |
| 23510 | |
| 23511 | pre = $('<img>').attr( 'src', imageUrl); |
| 23512 | // Audio |
| 23513 | } else if (/^audio\//.test(contentType) && supportsAudioPlayback(contentType)) { |
| 23514 | pre = $('<audio controls>').append($('<source>').attr('src', url).attr('type', contentType)); |
| 23515 | } else if(headers.location || headers.Location) { |
| 23516 | // Location header based redirect download |
| 23517 | window.location = response.url; |
| 23518 | |
| 23519 | // Anything else (CORS) |
| 23520 | } else { |
| 23521 | code = $('<code />').text(content); |
| 23522 | pre = $('<pre class="json" />').append(code); |
| 23523 | } |
| 23524 | var response_body = pre; |
| 23525 | $('.request_url', $(this.el)).html('<pre></pre>'); |
| 23526 | $('.request_url pre', $(this.el)).text(url); |
| 23527 | $('.response_code', $(this.el)).html('<pre>' + response.status + '</pre>'); |
| 23528 | $('.response_body', $(this.el)).html(response_body); |
| 23529 | $('.response_headers', $(this.el)).html('<pre>' + _.escape(JSON.stringify(response.headers, null, ' ')).replace(/\n/g, '<br>') + '</pre>'); |
| 23530 | $('.response', $(this.el)).slideDown(); |
| 23531 | $('.response_hider', $(this.el)).show(); |
| 23532 | $('.response_throbber', $(this.el)).hide(); |
| 23533 | |
| 23534 | |
| 23535 | // adds curl output |
| 23536 | var curlCommand = this.model.asCurl(this.map, {responseContentType: contentType}); |
| 23537 | curlCommand = curlCommand.replace('!', '!'); |
| 23538 | $( 'div.curl', $(this.el)).html('<pre>' + _.escape(curlCommand) + '</pre>'); |
| 23539 | |
| 23540 | // only highlight the response if response is less than threshold, default state is highlight response |
| 23541 | var opts = this.options.swaggerOptions; |
| 23542 | |
| 23543 | if (opts.showRequestHeaders) { |
| 23544 | var form = $('.sandbox', $(this.el)), |
| 23545 | map = this.getInputMap(form), |
| 23546 | requestHeaders = this.model.getHeaderParams(map); |
| 23547 | delete requestHeaders['Content-Type']; |
| 23548 | $('.request_headers', $(this.el)).html('<pre>' + _.escape(JSON.stringify(requestHeaders, null, ' ')).replace(/\n/g, '<br>') + '</pre>'); |
| 23549 | } |
| 23550 | |
| 23551 | var response_body_el = $('.response_body', $(this.el))[0]; |
| 23552 | // only highlight the response if response is less than threshold, default state is highlight response |
| 23553 | if (opts.highlightSizeThreshold && typeof response.data !== 'undefined' && response.data.length > opts.highlightSizeThreshold) { |
| 23554 | return response_body_el; |
| 23555 | } else { |
| 23556 | return hljs.highlightBlock(response_body_el); |
| 23557 | } |
| 23558 | }, |
| 23559 | |
| 23560 | toggleOperationContent: function (event) { |
| 23561 | var elem = $('#' + Docs.escapeResourceName(this.parentId + '_' + this.nickname + '_content')); |
| 23562 | if (elem.is(':visible')){ |
| 23563 | $.bbq.pushState('#/', 2); |
| 23564 | event.preventDefault(); |
| 23565 | Docs.collapseOperation(elem); |
| 23566 | } else { |
| 23567 | Docs.expandOperation(elem); |
| 23568 | } |
| 23569 | }, |
| 23570 | |
| 23571 | getTextAreaValue: function(textArea) { |
| 23572 | var param, parsed, result, i; |
| 23573 | if (textArea.value === null || jQuery.trim(textArea.value).length === 0) { |
| 23574 | return null; |
| 23575 | } |
| 23576 | param = this.getParamByName(textArea.name); |
| 23577 | if (param && param.type && param.type.toLowerCase() === 'array') { |
| 23578 | parsed = textArea.value.split('\n'); |
| 23579 | result = []; |
| 23580 | for (i = 0; i < parsed.length; i++) { |
| 23581 | if (parsed[i] !== null && jQuery.trim(parsed[i]).length > 0) { |
| 23582 | result.push(parsed[i]); |
| 23583 | } |
| 23584 | } |
| 23585 | return result.length > 0 ? result : null; |
| 23586 | } else { |
| 23587 | return textArea.value; |
| 23588 | } |
| 23589 | }, |
| 23590 | |
| 23591 | showSnippet: function () { |
| 23592 | var contentTypeEl = this.$('[name=responseContentType]'); |
| 23593 | var xmlSnippetEl = this.$('.operation-status .snippet_xml, .response-class .snippet_xml'); |
| 23594 | var jsonSnippetEl = this.$('.operation-status .snippet_json, .response-class .snippet_json'); |
| 23595 | var contentType; |
| 23596 | |
| 23597 | if (!contentTypeEl.length) { return; } |
| 23598 | contentType = contentTypeEl.val(); |
| 23599 | |
| 23600 | if (contentType.indexOf('xml') > -1) { |
| 23601 | xmlSnippetEl.show(); |
| 23602 | jsonSnippetEl.hide(); |
| 23603 | } else { |
| 23604 | jsonSnippetEl.show(); |
| 23605 | xmlSnippetEl.hide(); |
| 23606 | } |
| 23607 | }, |
| 23608 | |
| 23609 | getParamByName: function(name) { |
| 23610 | var i; |
| 23611 | if (this.model.parameters) { |
| 23612 | for(i = 0; i < this.model.parameters.length; i++) { |
| 23613 | if (this.model.parameters[i].name === name) { |
| 23614 | return this.model.parameters[i]; |
| 23615 | } |
| 23616 | } |
| 23617 | } |
| 23618 | return null; |
| 23619 | } |
| 23620 | |
| 23621 | }); |
| 23622 | |
| 23623 | 'use strict'; |
| 23624 | |
| 23625 | SwaggerUi.Views.ParameterContentTypeView = Backbone.View.extend({ |
| 23626 | initialize: function () {}, |
| 23627 | |
| 23628 | render: function(){ |
| 23629 | this.model.parameterContentTypeId = 'pct' + Math.random(); |
| 23630 | $(this.el).html(Handlebars.templates.parameter_content_type(this.model)); |
| 23631 | return this; |
| 23632 | } |
| 23633 | |
| 23634 | }); |
| 23635 | 'use strict'; |
| 23636 | |
| 23637 | SwaggerUi.Views.ParameterView = Backbone.View.extend({ |
| 23638 | events: { |
| 23639 | 'change [name=parameterContentType]' : 'toggleParameterSnippet' |
| 23640 | }, |
| 23641 | |
| 23642 | initialize: function(){ |
| 23643 | Handlebars.registerHelper('isArray', function(param, opts) { |
| 23644 | var paramType = param.type && param.type.toLowerCase(); |
| 23645 | if (paramType === 'array' || param.allowMultiple) { |
| 23646 | return opts.fn(this); |
| 23647 | } else { |
| 23648 | return opts.inverse(this); |
| 23649 | } |
| 23650 | }); |
| 23651 | }, |
| 23652 | |
| 23653 | render: function() { |
| 23654 | var type = this.model.type || this.model.dataType; |
| 23655 | var modelType = this.model.modelSignature.type; |
| 23656 | var modelDefinitions = this.model.modelSignature.definitions; |
| 23657 | var schema = this.model.schema || {}; |
| 23658 | var consumes = this.model.consumes || []; |
| 23659 | var sampleJSON, signatureView; |
| 23660 | |
| 23661 | if (typeof type === 'undefined') { |
| 23662 | if (schema.$ref) { |
| 23663 | var ref = schema.$ref; |
| 23664 | if (ref.indexOf('#/definitions/') === 0) { |
| 23665 | type = ref.substring('#/definitions/'.length); |
| 23666 | } else { |
| 23667 | type = ref; |
| 23668 | } |
| 23669 | } |
| 23670 | } |
| 23671 | |
| 23672 | this.model.type = type; |
| 23673 | this.model.paramType = this.model.in || this.model.paramType; |
| 23674 | this.model.isBody = this.model.paramType === 'body' || this.model.in === 'body'; |
| 23675 | this.model.isFile = type && type.toLowerCase() === 'file'; |
| 23676 | |
| 23677 | // Allow for default === false |
| 23678 | if(typeof this.model.default === 'undefined') { |
| 23679 | this.model.default = this.model.defaultValue; |
| 23680 | } |
| 23681 | |
| 23682 | this.model.hasDefault = (typeof this.model.default !== 'undefined'); |
| 23683 | this.model.valueId = 'm' + this.model.name + Math.random(); |
| 23684 | |
| 23685 | if (this.model.allowableValues) { |
| 23686 | this.model.isList = true; |
| 23687 | } |
| 23688 | |
| 23689 | var isXML = this.contains(consumes, 'xml'); |
| 23690 | var isJSON = isXML ? this.contains(consumes, 'json') : true; |
| 23691 | sampleJSON = SwaggerUi.partials.signature.createParameterJSONSample(modelType, modelDefinitions); |
| 23692 | |
| 23693 | var template = this.template(); |
| 23694 | $(this.el).html(template(this.model)); |
| 23695 | |
| 23696 | var signatureModel = { |
| 23697 | sampleJSON: isJSON ? sampleJSON : false, |
| 23698 | sampleXML: sampleJSON && isXML ? SwaggerUi.partials.signature.createXMLSample('', schema, modelDefinitions, true) : false, |
| 23699 | isParam: true, |
| 23700 | signature: SwaggerUi.partials.signature.getParameterModelSignature(modelType, modelDefinitions), |
| 23701 | defaultRendering: this.model.defaultRendering |
| 23702 | }; |
| 23703 | |
| 23704 | if (sampleJSON) { |
| 23705 | signatureView = new SwaggerUi.Views.SignatureView({model: signatureModel, tagName: 'div'}); |
| 23706 | $('.model-signature', $(this.el)).append(signatureView.render().el); |
| 23707 | } |
| 23708 | else { |
| 23709 | $('.model-signature', $(this.el)).html(this.model.signature); |
| 23710 | } |
| 23711 | |
| 23712 | var isParam = false; |
| 23713 | |
| 23714 | if( this.options.swaggerOptions.jsonEditor && this.model.isBody && this.model.schema){ |
| 23715 | var $self = $(this.el); |
| 23716 | this.model.jsonEditor = |
| 23717 | /* global JSONEditor */ |
| 23718 | new JSONEditor($('.editor_holder', $self)[0], |
| 23719 | {schema: this.model.schema, startval : this.model.default, |
| 23720 | ajax:true, |
| 23721 | disable_properties:true, |
| 23722 | disable_edit_json:true, |
| 23723 | iconlib: 'swagger' }); |
| 23724 | // This is so that the signature can send back the sample to the json editor |
| 23725 | // TODO: SignatureView should expose an event "onSampleClicked" instead |
| 23726 | signatureModel.jsonEditor = this.model.jsonEditor; |
| 23727 | $('.body-textarea', $self).hide(); |
| 23728 | $('.editor_holder', $self).show(); |
| 23729 | $('.parameter-content-type', $self) |
| 23730 | .change(function(e){ |
| 23731 | if(e.target.value === 'application/xml'){ |
| 23732 | $('.body-textarea', $self).show(); |
| 23733 | $('.editor_holder', $self).hide(); |
| 23734 | this.model.jsonEditor.disable(); |
| 23735 | } |
| 23736 | else { |
| 23737 | $('.body-textarea', $self).hide(); |
| 23738 | $('.editor_holder', $self).show(); |
| 23739 | this.model.jsonEditor.enable(); |
| 23740 | } |
| 23741 | }); |
| 23742 | } |
| 23743 | |
| 23744 | |
| 23745 | if (this.model.isBody) { |
| 23746 | isParam = true; |
| 23747 | } |
| 23748 | |
| 23749 | var contentTypeModel = { |
| 23750 | isParam: isParam |
| 23751 | }; |
| 23752 | |
| 23753 | contentTypeModel.consumes = this.model.consumes; |
| 23754 | |
| 23755 | if (isParam) { |
| 23756 | var parameterContentTypeView = new SwaggerUi.Views.ParameterContentTypeView({model: contentTypeModel}); |
| 23757 | $('.parameter-content-type', $(this.el)).append(parameterContentTypeView.render().el); |
| 23758 | this.toggleParameterSnippet(); |
| 23759 | } |
| 23760 | |
| 23761 | else { |
| 23762 | var responseContentTypeView = new SwaggerUi.Views.ResponseContentTypeView({model: contentTypeModel}); |
| 23763 | $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el); |
| 23764 | this.toggleResponseSnippet(); |
| 23765 | } |
| 23766 | |
| 23767 | return this; |
| 23768 | }, |
| 23769 | |
| 23770 | contains: function (consumes, type) { |
| 23771 | return consumes.filter(function (val) { |
| 23772 | if (val.indexOf(type) > -1) { |
| 23773 | return true; |
| 23774 | } |
| 23775 | }).length; |
| 23776 | }, |
| 23777 | |
| 23778 | toggleParameterSnippet: function () { |
| 23779 | var contentType = this.$('[name=parameterContentType]').val(); |
| 23780 | |
| 23781 | this.toggleSnippet(contentType); |
| 23782 | }, |
| 23783 | |
| 23784 | toggleResponseSnippet: function () { |
| 23785 | var contentEl = this.$('[name=responseContentType]'); |
| 23786 | |
| 23787 | if (!contentEl.length) { return; } |
| 23788 | |
| 23789 | this.toggleSnippet(contentEl.val()); |
| 23790 | }, |
| 23791 | |
| 23792 | toggleSnippet: function (type) { |
| 23793 | type = type || ''; |
| 23794 | if (type.indexOf('xml') > -1) { |
| 23795 | this.$('.snippet_xml').show(); |
| 23796 | this.$('.snippet_json').hide(); |
| 23797 | } else { |
| 23798 | this.$('.snippet_json').show(); |
| 23799 | this.$('.snippet_xml').hide(); |
| 23800 | } |
| 23801 | }, |
| 23802 | |
| 23803 | // Return an appropriate template based on if the parameter is a list, readonly, required |
| 23804 | template: function(){ |
| 23805 | if (this.model.isList) { |
| 23806 | return Handlebars.templates.param_list; |
| 23807 | } else { |
| 23808 | if (this.options.readOnly) { |
| 23809 | if (this.model.required) { |
| 23810 | return Handlebars.templates.param_readonly_required; |
| 23811 | } else { |
| 23812 | return Handlebars.templates.param_readonly; |
| 23813 | } |
| 23814 | } else { |
| 23815 | if (this.model.required) { |
| 23816 | return Handlebars.templates.param_required; |
| 23817 | } else { |
| 23818 | return Handlebars.templates.param; |
| 23819 | } |
| 23820 | } |
| 23821 | } |
| 23822 | } |
| 23823 | }); |
| 23824 | |
| 23825 | 'use strict'; |
| 23826 | |
| 23827 | /* jshint -W122 */ |
| 23828 | SwaggerUi.partials.signature = (function () { |
| 23829 | // copy-pasted from swagger-js |
| 23830 | var resolveSchema = function (schema) { |
| 23831 | if (_.isPlainObject(schema.schema)) { |
| 23832 | schema = resolveSchema(schema.schema); |
| 23833 | } |
| 23834 | |
| 23835 | return schema; |
| 23836 | }; |
| 23837 | |
| 23838 | // copy-pasted from swagger-js |
| 23839 | var simpleRef = function (name) { |
| 23840 | if (typeof name === 'undefined') { |
| 23841 | return null; |
| 23842 | } |
| 23843 | |
| 23844 | if (name.indexOf('#/definitions/') === 0) { |
| 23845 | return name.substring('#/definitions/'.length); |
| 23846 | } else { |
| 23847 | return name; |
| 23848 | } |
| 23849 | }; |
| 23850 | |
| 23851 | // copy-pasted from swagger-js |
| 23852 | var getInlineModel = function(inlineStr) { |
| 23853 | if(/^Inline Model \d+$/.test(inlineStr) && this.inlineModels) { |
| 23854 | var id = parseInt(inlineStr.substr('Inline Model'.length).trim(),10); // |
| 23855 | var model = this.inlineModels[id]; |
| 23856 | return model; |
| 23857 | } |
| 23858 | // I'm returning null here, should I rather throw an error? |
| 23859 | return null; |
| 23860 | }; |
| 23861 | |
| 23862 | // copy-pasted from swagger-js |
| 23863 | var formatXml = function(xml) { |
| 23864 | var contexp, fn, formatted, indent, l, lastType, len, lines, ln, pad, reg, transitions, wsexp; |
| 23865 | reg = /(>)(<)(\/*)/g; |
| 23866 | wsexp = /[ ]*(.*)[ ]+\n/g; |
| 23867 | contexp = /(<.+>)(.+\n)/g; |
| 23868 | xml = xml.replace(reg, '$1\n$2$3').replace(wsexp, '$1\n').replace(contexp, '$1\n$2'); |
| 23869 | pad = 0; |
| 23870 | formatted = ''; |
| 23871 | lines = xml.split('\n'); |
| 23872 | indent = 0; |
| 23873 | lastType = 'other'; |
| 23874 | transitions = { |
| 23875 | 'single->single': 0, |
| 23876 | 'single->closing': -1, |
| 23877 | 'single->opening': 0, |
| 23878 | 'single->other': 0, |
| 23879 | 'closing->single': 0, |
| 23880 | 'closing->closing': -1, |
| 23881 | 'closing->opening': 0, |
| 23882 | 'closing->other': 0, |
| 23883 | 'opening->single': 1, |
| 23884 | 'opening->closing': 0, |
| 23885 | 'opening->opening': 1, |
| 23886 | 'opening->other': 1, |
| 23887 | 'other->single': 0, |
| 23888 | 'other->closing': -1, |
| 23889 | 'other->opening': 0, |
| 23890 | 'other->other': 0 |
| 23891 | }; |
| 23892 | fn = function(ln) { |
| 23893 | var fromTo, j, key, padding, type, types, value; |
| 23894 | types = { |
| 23895 | single: Boolean(ln.match(/<.+\/>/)), |
| 23896 | closing: Boolean(ln.match(/<\/.+>/)), |
| 23897 | opening: Boolean(ln.match(/<[^!?].*>/)) |
| 23898 | }; |
| 23899 | type = ((function() { |
| 23900 | var results; |
| 23901 | results = []; |
| 23902 | for (key in types) { |
| 23903 | value = types[key]; |
| 23904 | if (value) { |
| 23905 | results.push(key); |
| 23906 | } |
| 23907 | } |
| 23908 | return results; |
| 23909 | })())[0]; |
| 23910 | type = type === void 0 ? 'other' : type; |
| 23911 | fromTo = lastType + '->' + type; |
| 23912 | lastType = type; |
| 23913 | padding = ''; |
| 23914 | indent += transitions[fromTo]; |
| 23915 | padding = ((function() { |
| 23916 | var m, ref1, results; |
| 23917 | results = []; |
| 23918 | for (j = m = 0, ref1 = indent; 0 <= ref1 ? m < ref1 : m > ref1; j = 0 <= ref1 ? ++m : --m) { |
| 23919 | results.push(' '); |
| 23920 | } |
| 23921 | return results; |
| 23922 | })()).join(''); |
| 23923 | if (fromTo === 'opening->closing') { |
| 23924 | formatted = formatted.substr(0, formatted.length - 1) + ln + '\n'; |
| 23925 | } else { |
| 23926 | formatted += padding + ln + '\n'; |
| 23927 | } |
| 23928 | }; |
| 23929 | for (l = 0, len = lines.length; l < len; l++) { |
| 23930 | ln = lines[l]; |
| 23931 | fn(ln); |
| 23932 | } |
| 23933 | return formatted; |
| 23934 | }; |
| 23935 | |
| 23936 | // copy-pasted from swagger-js |
| 23937 | var getModelSignature = function (name, schema, models, modelPropertyMacro) { |
| 23938 | var strongOpen = '<span class="strong">'; |
| 23939 | var strongClose = '</span>'; |
| 23940 | |
| 23941 | var optionHtml = function (label, value) { |
| 23942 | return '<tr><td class="optionName">' + label + ':</td><td>' + value + '</td></tr>'; |
| 23943 | }; |
| 23944 | |
| 23945 | |
| 23946 | // Allow for ignoring the 'name' argument.... shifting the rest |
| 23947 | if(_.isObject(arguments[0])) { |
| 23948 | name = void 0; |
| 23949 | schema = arguments[0]; |
| 23950 | models = arguments[1]; |
| 23951 | modelPropertyMacro = arguments[2]; |
| 23952 | } |
| 23953 | |
| 23954 | models = models || {}; |
| 23955 | |
| 23956 | // Resolve the schema (Handle nested schemas) |
| 23957 | schema = resolveSchema(schema); |
| 23958 | |
| 23959 | // Return for empty object |
| 23960 | if(_.isEmpty(schema)) { |
| 23961 | return strongOpen + 'Empty' + strongClose; |
| 23962 | } |
| 23963 | |
| 23964 | // Dereference $ref from 'models' |
| 23965 | if(typeof schema.$ref === 'string') { |
| 23966 | name = simpleRef(schema.$ref); |
| 23967 | schema = models[name]; |
| 23968 | if(typeof schema === 'undefined') |
| 23969 | { |
| 23970 | return strongOpen + name + ' is not defined!' + strongClose; |
| 23971 | } |
| 23972 | } |
| 23973 | |
| 23974 | if(typeof name !== 'string') { |
| 23975 | name = schema.title || 'Inline Model'; |
| 23976 | } |
| 23977 | |
| 23978 | // If we are a Model object... adjust accordingly |
| 23979 | if(schema.definition) { |
| 23980 | schema = schema.definition; |
| 23981 | } |
| 23982 | |
| 23983 | if(typeof modelPropertyMacro !== 'function') { |
| 23984 | modelPropertyMacro = function(prop){ |
| 23985 | return (prop || {}).default; |
| 23986 | }; |
| 23987 | } |
| 23988 | |
| 23989 | var references = {}; |
| 23990 | var seenModels = []; |
| 23991 | var inlineModels = 0; |
| 23992 | |
| 23993 | // Generate current HTML |
| 23994 | var html = processModel(schema, name); |
| 23995 | |
| 23996 | // Generate references HTML |
| 23997 | while (_.keys(references).length > 0) { |
| 23998 | /* jshint ignore:start */ |
| 23999 | _.forEach(references, function (schema, name) { |
| 24000 | var seenModel = _.indexOf(seenModels, name) > -1; |
| 24001 | |
| 24002 | delete references[name]; |
| 24003 | |
| 24004 | if (!seenModel) { |
| 24005 | seenModels.push(name); |
| 24006 | |
| 24007 | html += '<br />' + processModel(schema, name); |
| 24008 | } |
| 24009 | }); |
| 24010 | /* jshint ignore:end */ |
| 24011 | } |
| 24012 | |
| 24013 | return html; |
| 24014 | |
| 24015 | |
| 24016 | function addReference(schema, name, skipRef) { |
| 24017 | var modelName = name; |
| 24018 | var model; |
| 24019 | |
| 24020 | if (schema.$ref) { |
| 24021 | modelName = schema.title || simpleRef(schema.$ref); |
| 24022 | model = models[simpleRef(schema.$ref)]; |
| 24023 | } else if (_.isUndefined(name)) { |
| 24024 | modelName = schema.title || 'Inline Model ' + (++inlineModels); |
| 24025 | model = {definition: schema}; |
| 24026 | } |
| 24027 | |
| 24028 | if (skipRef !== true) { |
| 24029 | references[modelName] = _.isUndefined(model) ? {} : model.definition; |
| 24030 | } |
| 24031 | |
| 24032 | return modelName; |
| 24033 | } |
| 24034 | |
| 24035 | function primitiveToHTML(schema) { |
| 24036 | var html = '<span class="propType">'; |
| 24037 | var type = schema.type || 'object'; |
| 24038 | |
| 24039 | if (schema.$ref) { |
| 24040 | html += addReference(schema, simpleRef(schema.$ref)); |
| 24041 | } else if (type === 'object') { |
| 24042 | if (!_.isUndefined(schema.properties)) { |
| 24043 | html += addReference(schema); |
| 24044 | } else { |
| 24045 | html += 'object'; |
| 24046 | } |
| 24047 | } else if (type === 'array') { |
| 24048 | html += 'Array['; |
| 24049 | |
| 24050 | if (_.isArray(schema.items)) { |
| 24051 | html += _.map(schema.items, addReference).join(','); |
| 24052 | } else if (_.isPlainObject(schema.items)) { |
| 24053 | if (_.isUndefined(schema.items.$ref)) { |
| 24054 | if (!_.isUndefined(schema.items.type) && _.indexOf(['array', 'object'], schema.items.type) === -1) { |
| 24055 | html += schema.items.type; |
| 24056 | } else { |
| 24057 | html += addReference(schema.items); |
| 24058 | } |
| 24059 | } else { |
| 24060 | html += addReference(schema.items, simpleRef(schema.items.$ref)); |
| 24061 | } |
| 24062 | } else { |
| 24063 | console.log('Array type\'s \'items\' schema is not an array or an object, cannot process'); |
| 24064 | html += 'object'; |
| 24065 | } |
| 24066 | |
| 24067 | html += ']'; |
| 24068 | } else { |
| 24069 | html += schema.type; |
| 24070 | } |
| 24071 | |
| 24072 | html += '</span>'; |
| 24073 | |
| 24074 | return html; |
| 24075 | } |
| 24076 | |
| 24077 | function primitiveToOptionsHTML(schema, html) { |
| 24078 | var options = ''; |
| 24079 | var type = schema.type || 'object'; |
| 24080 | var isArray = type === 'array'; |
| 24081 | |
| 24082 | if (!_.isUndefined(schema.description)) { |
| 24083 | html += ': ' + '<span class="propDesc">' + schema.description + '</span>'; |
| 24084 | } |
| 24085 | |
| 24086 | if (schema.enum) { |
| 24087 | html += ' = <span class="propVals">[\'' + schema.enum.join('\', \'') + '\']</span>'; |
| 24088 | } |
| 24089 | |
| 24090 | if (isArray) { |
| 24091 | if (_.isPlainObject(schema.items) && !_.isUndefined(schema.items.type)) { |
| 24092 | type = schema.items.type; |
| 24093 | } else { |
| 24094 | type = 'object'; |
| 24095 | } |
| 24096 | } |
| 24097 | |
| 24098 | if (!_.isUndefined(schema.default)) { |
| 24099 | options += optionHtml('Default', schema.default); |
| 24100 | } |
| 24101 | |
| 24102 | switch (type) { |
| 24103 | case 'string': |
| 24104 | if (schema.minLength) { |
| 24105 | options += optionHtml('Min. Length', schema.minLength); |
| 24106 | } |
| 24107 | |
| 24108 | if (schema.maxLength) { |
| 24109 | options += optionHtml('Max. Length', schema.maxLength); |
| 24110 | } |
| 24111 | |
| 24112 | if (schema.pattern) { |
| 24113 | options += optionHtml('Reg. Exp.', schema.pattern); |
| 24114 | } |
| 24115 | break; |
| 24116 | case 'integer': |
| 24117 | case 'number': |
| 24118 | if (schema.minimum) { |
| 24119 | options += optionHtml('Min. Value', schema.minimum); |
| 24120 | } |
| 24121 | |
| 24122 | if (schema.exclusiveMinimum) { |
| 24123 | options += optionHtml('Exclusive Min.', 'true'); |
| 24124 | } |
| 24125 | |
| 24126 | if (schema.maximum) { |
| 24127 | options += optionHtml('Max. Value', schema.maximum); |
| 24128 | } |
| 24129 | |
| 24130 | if (schema.exclusiveMaximum) { |
| 24131 | options += optionHtml('Exclusive Max.', 'true'); |
| 24132 | } |
| 24133 | |
| 24134 | if (schema.multipleOf) { |
| 24135 | options += optionHtml('Multiple Of', schema.multipleOf); |
| 24136 | } |
| 24137 | |
| 24138 | break; |
| 24139 | } |
| 24140 | |
| 24141 | if (isArray) { |
| 24142 | if (schema.minItems) { |
| 24143 | options += optionHtml('Min. Items', schema.minItems); |
| 24144 | } |
| 24145 | |
| 24146 | if (schema.maxItems) { |
| 24147 | options += optionHtml('Max. Items', schema.maxItems); |
| 24148 | } |
| 24149 | |
| 24150 | if (schema.uniqueItems) { |
| 24151 | options += optionHtml('Unique Items', 'true'); |
| 24152 | } |
| 24153 | |
| 24154 | if (schema.collectionFormat) { |
| 24155 | options += optionHtml('Coll. Format', schema.collectionFormat); |
| 24156 | } |
| 24157 | } |
| 24158 | |
| 24159 | if (_.isUndefined(schema.items)) { |
| 24160 | if (_.isArray(schema.enum)) { |
| 24161 | var enumString; |
| 24162 | |
| 24163 | if (type === 'number' || type === 'integer') { |
| 24164 | enumString = schema.enum.join(', '); |
| 24165 | } else { |
| 24166 | enumString = '"' + schema.enum.join('", "') + '"'; |
| 24167 | } |
| 24168 | |
| 24169 | options += optionHtml('Enum', enumString); |
| 24170 | } |
| 24171 | } |
| 24172 | |
| 24173 | if (options.length > 0) { |
| 24174 | html = '<span class="propWrap">' + html + '<table class="optionsWrapper"><tr><th colspan="2">' + type + '</th></tr>' + options + '</table></span>'; |
| 24175 | } |
| 24176 | |
| 24177 | return html; |
| 24178 | } |
| 24179 | |
| 24180 | function processModel(schema, name) { |
| 24181 | var type = schema.type || 'object'; |
| 24182 | var isArray = schema.type === 'array'; |
| 24183 | var html = strongOpen + name + ' ' + (isArray ? '[' : '{') + strongClose; |
| 24184 | var contents; |
| 24185 | |
| 24186 | if (name) { |
| 24187 | seenModels.push(name); |
| 24188 | } |
| 24189 | |
| 24190 | if (isArray) { |
| 24191 | if (_.isArray(schema.items)) { |
| 24192 | html += '<div>' + _.map(schema.items, function (item) { |
| 24193 | var type = item.type || 'object'; |
| 24194 | |
| 24195 | if (_.isUndefined(item.$ref)) { |
| 24196 | if (_.indexOf(['array', 'object'], type) > -1) { |
| 24197 | if (type === 'object' && _.isUndefined(item.properties)) { |
| 24198 | return 'object'; |
| 24199 | } else { |
| 24200 | return addReference(item); |
| 24201 | } |
| 24202 | } else { |
| 24203 | return primitiveToOptionsHTML(item, type); |
| 24204 | } |
| 24205 | } else { |
| 24206 | return addReference(item, simpleRef(item.$ref)); |
| 24207 | } |
| 24208 | }).join(',</div><div>'); |
| 24209 | } else if (_.isPlainObject(schema.items)) { |
| 24210 | if (_.isUndefined(schema.items.$ref)) { |
| 24211 | if (_.indexOf(['array', 'object'], schema.items.type || 'object') > -1) { |
| 24212 | if ((_.isUndefined(schema.items.type) || schema.items.type === 'object') && _.isUndefined(schema.items.properties)) { |
| 24213 | html += '<div>object</div>'; |
| 24214 | } else { |
| 24215 | html += '<div>' + addReference(schema.items) + '</div>'; |
| 24216 | } |
| 24217 | } else { |
| 24218 | html += '<div>' + primitiveToOptionsHTML(schema.items, schema.items.type) + '</div>'; |
| 24219 | } |
| 24220 | } else { |
| 24221 | html += '<div>' + addReference(schema.items, simpleRef(schema.items.$ref)) + '</div>'; |
| 24222 | } |
| 24223 | } else { |
| 24224 | console.log('Array type\'s \'items\' property is not an array or an object, cannot process'); |
| 24225 | html += '<div>object</div>'; |
| 24226 | } |
| 24227 | } else { |
| 24228 | if (schema.$ref) { |
| 24229 | html += '<div>' + addReference(schema, name) + '</div>'; |
| 24230 | } else if (type === 'object') { |
| 24231 | if (_.isPlainObject(schema.properties)) { |
| 24232 | contents = _.map(schema.properties, function (property, name) { |
| 24233 | var propertyIsRequired = (_.indexOf(schema.required, name) >= 0); |
| 24234 | var cProperty = _.cloneDeep(property); |
| 24235 | |
| 24236 | var requiredClass = propertyIsRequired ? 'required' : ''; |
| 24237 | var html = '<span class="propName ' + requiredClass + '">' + name + '</span> ('; |
| 24238 | var model; |
| 24239 | |
| 24240 | // Allow macro to set the default value |
| 24241 | cProperty.default = modelPropertyMacro(cProperty); |
| 24242 | |
| 24243 | // Resolve the schema (Handle nested schemas) |
| 24244 | cProperty = resolveSchema(cProperty); |
| 24245 | |
| 24246 | // We need to handle property references to primitives (Issue 339) |
| 24247 | if (!_.isUndefined(cProperty.$ref)) { |
| 24248 | model = models[simpleRef(cProperty.$ref)]; |
| 24249 | |
| 24250 | if (!_.isUndefined(model) && _.indexOf([undefined, 'array', 'object'], model.definition.type) === -1) { |
| 24251 | // Use referenced schema |
| 24252 | cProperty = resolveSchema(model.definition); |
| 24253 | } |
| 24254 | } |
| 24255 | |
| 24256 | html += primitiveToHTML(cProperty); |
| 24257 | |
| 24258 | if(!propertyIsRequired) { |
| 24259 | html += ', <span class="propOptKey">optional</span>'; |
| 24260 | } |
| 24261 | |
| 24262 | if(property.readOnly) { |
| 24263 | html += ', <span class="propReadOnly">read only</span>'; |
| 24264 | } |
| 24265 | |
| 24266 | html += ')'; |
| 24267 | |
| 24268 | return '<div' + (property.readOnly ? ' class="readOnly"' : '') + '>' + primitiveToOptionsHTML(cProperty, html); |
| 24269 | }).join(',</div>'); |
| 24270 | } |
| 24271 | |
| 24272 | if (contents) { |
| 24273 | html += contents + '</div>'; |
| 24274 | } |
| 24275 | } else { |
| 24276 | html += '<div>' + primitiveToOptionsHTML(schema, type) + '</div>'; |
| 24277 | } |
| 24278 | } |
| 24279 | |
| 24280 | return html + strongOpen + (isArray ? ']' : '}') + strongClose; |
| 24281 | } |
| 24282 | |
| 24283 | }; |
| 24284 | |
| 24285 | // copy-pasted from swagger-js |
| 24286 | var schemaToJSON = function (schema, models, modelsToIgnore, modelPropertyMacro) { |
| 24287 | // Resolve the schema (Handle nested schemas) |
| 24288 | schema = resolveSchema(schema); |
| 24289 | |
| 24290 | if(typeof modelPropertyMacro !== 'function') { |
| 24291 | modelPropertyMacro = function(prop){ |
| 24292 | return (prop || {}).default; |
| 24293 | }; |
| 24294 | } |
| 24295 | |
| 24296 | modelsToIgnore= modelsToIgnore || {}; |
| 24297 | |
| 24298 | var type = schema.type || 'object'; |
| 24299 | var format = schema.format; |
| 24300 | var model; |
| 24301 | var output; |
| 24302 | |
| 24303 | if (!_.isUndefined(schema.example)) { |
| 24304 | output = schema.example; |
| 24305 | } else if (_.isUndefined(schema.items) && _.isArray(schema.enum)) { |
| 24306 | output = schema.enum[0]; |
| 24307 | } |
| 24308 | |
| 24309 | if (_.isUndefined(output)) { |
| 24310 | if (schema.$ref) { |
| 24311 | model = models[simpleRef(schema.$ref)]; |
| 24312 | |
| 24313 | if (!_.isUndefined(model)) { |
| 24314 | if (_.isUndefined(modelsToIgnore[model.name])) { |
| 24315 | modelsToIgnore[model.name] = model; |
| 24316 | output = schemaToJSON(model.definition, models, modelsToIgnore, modelPropertyMacro); |
| 24317 | delete modelsToIgnore[model.name]; |
| 24318 | } else { |
| 24319 | if (model.type === 'array') { |
| 24320 | output = []; |
| 24321 | } else { |
| 24322 | output = {}; |
| 24323 | } |
| 24324 | } |
| 24325 | } |
| 24326 | } else if (!_.isUndefined(schema.default)) { |
| 24327 | output = schema.default; |
| 24328 | } else if (type === 'string') { |
| 24329 | if (format === 'date-time') { |
| 24330 | output = new Date().toISOString(); |
| 24331 | } else if (format === 'date') { |
| 24332 | output = new Date().toISOString().split('T')[0]; |
| 24333 | } else { |
| 24334 | output = 'string'; |
| 24335 | } |
| 24336 | } else if (type === 'integer') { |
| 24337 | output = 0; |
| 24338 | } else if (type === 'number') { |
| 24339 | output = 0.0; |
| 24340 | } else if (type === 'boolean') { |
| 24341 | output = true; |
| 24342 | } else if (type === 'object') { |
| 24343 | output = {}; |
| 24344 | |
| 24345 | _.forEach(schema.properties, function (property, name) { |
| 24346 | var cProperty = _.cloneDeep(property); |
| 24347 | |
| 24348 | // Allow macro to set the default value |
| 24349 | cProperty.default = modelPropertyMacro(property); |
| 24350 | |
| 24351 | output[name] = schemaToJSON(cProperty, models, modelsToIgnore, modelPropertyMacro); |
| 24352 | }); |
| 24353 | } else if (type === 'array') { |
| 24354 | output = []; |
| 24355 | |
| 24356 | if (_.isArray(schema.items)) { |
| 24357 | _.forEach(schema.items, function (item) { |
| 24358 | output.push(schemaToJSON(item, models, modelsToIgnore, modelPropertyMacro)); |
| 24359 | }); |
| 24360 | } else if (_.isPlainObject(schema.items)) { |
| 24361 | output.push(schemaToJSON(schema.items, models, modelsToIgnore, modelPropertyMacro)); |
| 24362 | } else if (_.isUndefined(schema.items)) { |
| 24363 | output.push({}); |
| 24364 | } else { |
| 24365 | console.log('Array type\'s \'items\' property is not an array or an object, cannot process'); |
| 24366 | } |
| 24367 | } |
| 24368 | } |
| 24369 | |
| 24370 | return output; |
| 24371 | }; |
| 24372 | |
| 24373 | // copy-pasted from swagger-js |
| 24374 | var createJSONSample = function (value, modelsToIgnore) { |
| 24375 | modelsToIgnore = modelsToIgnore || {}; |
| 24376 | |
| 24377 | modelsToIgnore[value.name] = value; |
| 24378 | |
| 24379 | // Response support |
| 24380 | if (value.examples && _.isPlainObject(value.examples) && value.examples['application/json']) { |
| 24381 | value.definition.example = value.examples['application/json']; |
| 24382 | |
| 24383 | if (_.isString(value.definition.example)) { |
| 24384 | value.definition.example = jsyaml.safeLoad(value.definition.example); |
| 24385 | } |
| 24386 | } else if (!value.definition.example) { |
| 24387 | value.definition.example = value.examples; |
| 24388 | } |
| 24389 | |
| 24390 | return schemaToJSON(value.definition, value.models, modelsToIgnore, value.modelPropertyMacro); |
| 24391 | }; |
| 24392 | |
| 24393 | // copy-pasted from swagger-js |
| 24394 | var getParameterModelSignature = function (type, definitions) { |
| 24395 | var isPrimitive, listType; |
| 24396 | |
| 24397 | if (type instanceof Array) { |
| 24398 | listType = true; |
| 24399 | type = type[0]; |
| 24400 | } |
| 24401 | |
| 24402 | // Convert undefined to string of 'undefined' |
| 24403 | if (typeof type === 'undefined') { |
| 24404 | type = 'undefined'; |
| 24405 | isPrimitive = true; |
| 24406 | |
| 24407 | } else if (definitions[type]){ |
| 24408 | // a model def exists? |
| 24409 | type = definitions[type]; /* Model */ |
| 24410 | isPrimitive = false; |
| 24411 | |
| 24412 | } else if (getInlineModel(type)) { |
| 24413 | type = getInlineModel(type); /* Model */ |
| 24414 | isPrimitive = false; |
| 24415 | |
| 24416 | } else { |
| 24417 | // We default to primitive |
| 24418 | isPrimitive = true; |
| 24419 | } |
| 24420 | |
| 24421 | if (isPrimitive) { |
| 24422 | if (listType) { |
| 24423 | return 'Array[' + type + ']'; |
| 24424 | } else { |
| 24425 | return type.toString(); |
| 24426 | } |
| 24427 | } else { |
| 24428 | if (listType) { |
| 24429 | return 'Array[' + getModelSignature(type.name, type.definition, type.models, type.modelPropertyMacro) + ']'; |
| 24430 | } else { |
| 24431 | return getModelSignature(type.name, type.definition, type.models, type.modelPropertyMacro); |
| 24432 | } |
| 24433 | } |
| 24434 | }; |
| 24435 | |
| 24436 | // copy-pasted from swagger-js |
| 24437 | var createParameterJSONSample = function (type, models) { |
| 24438 | var listType, sampleJson, innerType; |
| 24439 | models = models || {}; |
| 24440 | |
| 24441 | listType = (type instanceof Array); |
| 24442 | innerType = listType ? type[0] : type; |
| 24443 | |
| 24444 | if(models[innerType]) { |
| 24445 | sampleJson = createJSONSample(models[innerType]); |
| 24446 | } else if (getInlineModel(innerType)){ |
| 24447 | sampleJson = createJSONSample(getInlineModel(innerType)); // may return null, if type isn't correct |
| 24448 | } |
| 24449 | |
| 24450 | |
| 24451 | if (sampleJson) { |
| 24452 | sampleJson = listType ? [sampleJson] : sampleJson; |
| 24453 | |
| 24454 | if (typeof sampleJson === 'string') { |
| 24455 | return sampleJson; |
| 24456 | } else if (_.isObject(sampleJson)) { |
| 24457 | var t = sampleJson; |
| 24458 | |
| 24459 | if (sampleJson instanceof Array && sampleJson.length > 0) { |
| 24460 | t = sampleJson[0]; |
| 24461 | } |
| 24462 | |
| 24463 | if (t.nodeName && typeof t === 'Node') { |
| 24464 | var xmlString = new XMLSerializer().serializeToString(t); |
| 24465 | |
| 24466 | return formatXml(xmlString); |
| 24467 | } else { |
| 24468 | return JSON.stringify(sampleJson, null, 2); |
| 24469 | } |
| 24470 | } else { |
| 24471 | return sampleJson; |
| 24472 | } |
| 24473 | } |
| 24474 | }; |
| 24475 | |
| 24476 | var wrapTag = function (name, value, attrs) { |
| 24477 | var str, attributes; |
| 24478 | |
| 24479 | attrs = attrs || []; |
| 24480 | |
| 24481 | attributes = attrs.map(function (attr) { |
| 24482 | return ' ' + attr.name + '="' + attr.value + '"'; |
| 24483 | }).join(''); |
| 24484 | |
| 24485 | if (!name) { |
| 24486 | return getErrorMessage('Node name is not provided'); |
| 24487 | } |
| 24488 | |
| 24489 | str = [ |
| 24490 | '<', name, |
| 24491 | attributes, |
| 24492 | '>', |
| 24493 | value, |
| 24494 | '</', name, '>' |
| 24495 | ]; |
| 24496 | |
| 24497 | return str.join(''); |
| 24498 | }; |
| 24499 | |
| 24500 | var getName = function (name, xml) { |
| 24501 | var result = name || ''; |
| 24502 | |
| 24503 | xml = xml || {}; |
| 24504 | |
| 24505 | if (xml.name) { |
| 24506 | result = xml.name; |
| 24507 | } |
| 24508 | |
| 24509 | if (xml.prefix) { |
| 24510 | result = xml.prefix + ':' + result; |
| 24511 | } |
| 24512 | |
| 24513 | return result; |
| 24514 | }; |
| 24515 | |
| 24516 | var getNamespace = function (xml) { |
| 24517 | var namespace = ''; |
| 24518 | var name = 'xmlns'; |
| 24519 | |
| 24520 | xml = xml || {}; |
| 24521 | |
| 24522 | if (xml.namespace) { |
| 24523 | namespace = xml.namespace; |
| 24524 | } else { |
| 24525 | return namespace; |
| 24526 | } |
| 24527 | |
| 24528 | if (xml.prefix) { |
| 24529 | name += ':' + xml.prefix; |
| 24530 | } |
| 24531 | |
| 24532 | return { |
| 24533 | name: name, |
| 24534 | value: namespace |
| 24535 | }; |
| 24536 | }; |
| 24537 | |
| 24538 | var createArrayXML = function (descriptor) { |
| 24539 | var name = descriptor.name; |
| 24540 | var config = descriptor.config; |
| 24541 | var definition = descriptor.definition; |
| 24542 | var models = descriptor.models; |
| 24543 | var value; |
| 24544 | var items = definition.items; |
| 24545 | var xml = definition.xml || {}; |
| 24546 | var namespace = getNamespace(xml); |
| 24547 | var attributes = []; |
| 24548 | |
| 24549 | if (!items) { return getErrorMessage(); } |
| 24550 | |
| 24551 | value = createSchemaXML(name, items, models, config); |
| 24552 | |
| 24553 | if (namespace) { |
| 24554 | attributes.push(namespace); |
| 24555 | } |
| 24556 | |
| 24557 | if (xml.wrapped) { |
| 24558 | value = wrapTag(name, value, attributes); |
| 24559 | } |
| 24560 | |
| 24561 | return value; |
| 24562 | }; |
| 24563 | |
| 24564 | var getPrimitiveSignature = function (schema) { |
| 24565 | var type, items; |
| 24566 | |
| 24567 | schema = schema || {}; |
| 24568 | items = schema.items || {}; |
| 24569 | type = schema.type || ''; |
| 24570 | |
| 24571 | switch (type) { |
| 24572 | case 'object': return 'Object is not a primitive'; |
| 24573 | case 'array' : return 'Array[' + (items.format || items.type) + ']'; |
| 24574 | default: return schema.format || type; |
| 24575 | } |
| 24576 | }; |
| 24577 | |
| 24578 | var createPrimitiveXML = function (descriptor) { |
| 24579 | var name = descriptor.name; |
| 24580 | var definition = descriptor.definition; |
| 24581 | var primitivesMap = { |
| 24582 | 'string': { |
| 24583 | 'date': new Date(1).toISOString().split('T')[0], |
| 24584 | 'date-time' : new Date(1).toISOString(), |
| 24585 | 'default': 'string' |
| 24586 | }, |
| 24587 | 'integer': { |
| 24588 | 'default': 1 |
| 24589 | }, |
| 24590 | 'number': { |
| 24591 | 'default': 1.1 |
| 24592 | }, |
| 24593 | 'boolean': { |
| 24594 | 'default': true |
| 24595 | } |
| 24596 | }; |
| 24597 | var type = definition.type; |
| 24598 | var format = definition.format; |
| 24599 | var xml = definition.xml || {}; |
| 24600 | var namespace = getNamespace(xml); |
| 24601 | var attributes = []; |
| 24602 | var value; |
| 24603 | |
| 24604 | if (_.keys(primitivesMap).indexOf(type) < 0) { return getErrorMessage(); } |
| 24605 | |
| 24606 | if (_.isArray(definition.enum)){ |
| 24607 | value = definition.enum[0]; |
| 24608 | } else { |
| 24609 | value = definition.example || primitivesMap[type][format] || primitivesMap[type].default; |
| 24610 | } |
| 24611 | |
| 24612 | if (xml.attribute) { |
| 24613 | return {name: name, value: value}; |
| 24614 | } |
| 24615 | |
| 24616 | if (namespace) { |
| 24617 | attributes.push(namespace); |
| 24618 | } |
| 24619 | |
| 24620 | return wrapTag(name, value, attributes); |
| 24621 | }; |
| 24622 | |
| 24623 | function createObjectXML (descriptor) { |
| 24624 | var name = descriptor.name; |
| 24625 | var definition = descriptor.definition; |
| 24626 | var config = descriptor.config; |
| 24627 | var models = descriptor.models; |
| 24628 | var isParam = descriptor.config.isParam; |
| 24629 | var serializedProperties; |
| 24630 | var attrs = []; |
| 24631 | var properties = definition.properties; |
| 24632 | var additionalProperties = definition.additionalProperties; |
| 24633 | var xml = definition.xml; |
| 24634 | var namespace = getNamespace(xml); |
| 24635 | |
| 24636 | if (namespace) { |
| 24637 | attrs.push(namespace); |
| 24638 | } |
| 24639 | |
| 24640 | if (!properties && !additionalProperties) { return getErrorMessage(); } |
| 24641 | |
| 24642 | properties = properties || {}; |
| 24643 | |
| 24644 | serializedProperties = _.map(properties, function (prop, key) { |
| 24645 | var xml, result; |
| 24646 | |
| 24647 | if (isParam && prop.readOnly) { |
| 24648 | return ''; |
| 24649 | } |
| 24650 | |
| 24651 | xml = prop.xml || {}; |
| 24652 | result = createSchemaXML(key, prop, models, config); |
| 24653 | |
| 24654 | if (xml.attribute) { |
| 24655 | attrs.push(result); |
| 24656 | return ''; |
| 24657 | } |
| 24658 | |
| 24659 | return result; |
| 24660 | }).join(''); |
| 24661 | |
| 24662 | if (additionalProperties) { |
| 24663 | serializedProperties += '<!-- additional elements allowed -->'; |
| 24664 | } |
| 24665 | |
| 24666 | return wrapTag(name, serializedProperties, attrs); |
| 24667 | } |
| 24668 | |
| 24669 | function getInfiniteLoopMessage (name, loopTo) { |
| 24670 | return wrapTag(name, '<!-- Infinite loop $ref:' + loopTo + ' -->'); |
| 24671 | } |
| 24672 | |
| 24673 | function getErrorMessage (details) { |
| 24674 | details = details ? ': ' + details : ''; |
| 24675 | return '<!-- invalid XML' + details + ' -->'; |
| 24676 | } |
| 24677 | |
| 24678 | function createSchemaXML (name, definition, models, config) { |
| 24679 | var $ref = _.isObject(definition) ? definition.$ref : null; |
| 24680 | var output, index; |
| 24681 | config = config || {}; |
| 24682 | config.modelsToIgnore = config.modelsToIgnore || []; |
| 24683 | var descriptor = _.isString($ref) ? getDescriptorByRef($ref, name, models, config) |
| 24684 | : getDescriptor(name, definition, models, config); |
| 24685 | |
| 24686 | if (!descriptor) { |
| 24687 | return getErrorMessage(); |
| 24688 | } |
| 24689 | |
| 24690 | switch (descriptor.type) { |
| 24691 | case 'array': |
| 24692 | output = createArrayXML(descriptor); break; |
| 24693 | case 'object': |
| 24694 | output = createObjectXML(descriptor); break; |
| 24695 | case 'loop': |
| 24696 | output = getInfiniteLoopMessage(descriptor.name, descriptor.config.loopTo); break; |
| 24697 | default: |
| 24698 | output = createPrimitiveXML(descriptor); |
| 24699 | } |
| 24700 | |
| 24701 | if ($ref && descriptor.type !== 'loop') { |
| 24702 | index = config.modelsToIgnore.indexOf($ref); |
| 24703 | if (index > -1) { |
| 24704 | config.modelsToIgnore.splice(index, 1); |
| 24705 | } |
| 24706 | } |
| 24707 | |
| 24708 | return output; |
| 24709 | } |
| 24710 | |
| 24711 | function Descriptor (name, type, definition, models, config) { |
| 24712 | if (arguments.length < 4) { |
| 24713 | throw new Error(); |
| 24714 | } |
| 24715 | |
| 24716 | this.config = config || {}; |
| 24717 | this.config.modelsToIgnore = this.config.modelsToIgnore || []; |
| 24718 | this.name = getName(name, definition.xml); |
| 24719 | this.definition = definition; |
| 24720 | this.models = models; |
| 24721 | this.type = type; |
| 24722 | } |
| 24723 | |
| 24724 | function getDescriptorByRef($ref, name, models, config) { |
| 24725 | var modelType = simpleRef($ref); |
| 24726 | var model = models[modelType] || {}; |
| 24727 | var type = model.definition && model.definition.type ? model.definition.type : 'object'; |
| 24728 | name = name || model.name; |
| 24729 | |
| 24730 | if (config.modelsToIgnore.indexOf($ref) > -1) { |
| 24731 | type = 'loop'; |
| 24732 | config.loopTo = modelType; |
| 24733 | } else { |
| 24734 | config.modelsToIgnore.push($ref); |
| 24735 | } |
| 24736 | |
| 24737 | if (!model.definition) { |
| 24738 | return null; |
| 24739 | } |
| 24740 | |
| 24741 | return new Descriptor(name, type, model.definition, models, config); |
| 24742 | } |
| 24743 | |
| 24744 | function getDescriptor (name, definition, models, config){ |
| 24745 | var type = definition.type || 'object'; |
| 24746 | |
| 24747 | if (!definition) { |
| 24748 | return null; |
| 24749 | } |
| 24750 | |
| 24751 | return new Descriptor(name, type, definition, models, config); |
| 24752 | } |
| 24753 | |
| 24754 | function createXMLSample (name, definition, models, isParam) { |
| 24755 | var prolog = '<?xml version="1.0"?>'; |
| 24756 | |
| 24757 | return formatXml(prolog + createSchemaXML(name, definition, models, { isParam: isParam } )); |
| 24758 | } |
| 24759 | |
| 24760 | return { |
| 24761 | getModelSignature: getModelSignature, |
| 24762 | createJSONSample: createJSONSample, |
| 24763 | getParameterModelSignature: getParameterModelSignature, |
| 24764 | createParameterJSONSample: createParameterJSONSample, |
| 24765 | createSchemaXML: createSchemaXML, |
| 24766 | createXMLSample: createXMLSample, |
| 24767 | getPrimitiveSignature: getPrimitiveSignature |
| 24768 | }; |
| 24769 | |
| 24770 | })(); |
| 24771 | |
| 24772 | 'use strict'; |
| 24773 | |
| 24774 | SwaggerUi.Views.PopupView = Backbone.View.extend({ |
| 24775 | events: { |
| 24776 | 'click .api-popup-cancel': 'cancelClick' |
| 24777 | }, |
| 24778 | |
| 24779 | template: Handlebars.templates.popup, |
| 24780 | className: 'api-popup-dialog', |
| 24781 | |
| 24782 | selectors: { |
| 24783 | content: '.api-popup-content', |
| 24784 | main : '#swagger-ui-container' |
| 24785 | }, |
| 24786 | |
| 24787 | initialize: function(){ |
| 24788 | this.$el.html(this.template(this.model)); |
| 24789 | }, |
| 24790 | |
| 24791 | render: function () { |
| 24792 | this.$(this.selectors.content).append(this.model.content); |
| 24793 | $(this.selectors.main).first().append(this.el); |
| 24794 | this.showPopup(); |
| 24795 | |
| 24796 | return this; |
| 24797 | }, |
| 24798 | |
| 24799 | showPopup: function () { |
| 24800 | this.$el.show(); |
| 24801 | }, |
| 24802 | |
| 24803 | cancelClick: function () { |
| 24804 | this.remove(); |
| 24805 | } |
| 24806 | |
| 24807 | }); |
| 24808 | |
| 24809 | 'use strict'; |
| 24810 | |
| 24811 | SwaggerUi.Views.ResourceView = Backbone.View.extend({ |
| 24812 | initialize: function(opts) { |
| 24813 | opts = opts || {}; |
| 24814 | this.router = opts.router; |
| 24815 | this.auths = opts.auths; |
| 24816 | if ('' === this.model.description) { |
| 24817 | this.model.description = null; |
| 24818 | } |
| 24819 | if (this.model.description) { |
| 24820 | this.model.summary = this.model.description; |
| 24821 | } |
| 24822 | this.number = 0; |
| 24823 | }, |
| 24824 | |
| 24825 | render: function(){ |
| 24826 | var methods = {}; |
| 24827 | |
| 24828 | |
| 24829 | $(this.el).html(Handlebars.templates.resource(this.model)); |
| 24830 | |
| 24831 | // Render each operation |
| 24832 | for (var i = 0; i < this.model.operationsArray.length; i++) { |
| 24833 | var operation = this.model.operationsArray[i]; |
| 24834 | var counter = 0; |
| 24835 | var id = operation.nickname; |
| 24836 | |
| 24837 | while (typeof methods[id] !== 'undefined') { |
| 24838 | id = id + '_' + counter; |
| 24839 | counter += 1; |
| 24840 | } |
| 24841 | |
| 24842 | methods[id] = operation; |
| 24843 | |
| 24844 | operation.nickname = id; |
| 24845 | operation.parentId = this.model.id; |
| 24846 | operation.definitions = this.model.definitions; // make Json Schema available for JSonEditor in this operation |
| 24847 | this.addOperation(operation); |
| 24848 | } |
| 24849 | |
| 24850 | $('.toggleEndpointList', this.el).click(this.callDocs.bind(this, 'toggleEndpointListForResource')); |
| 24851 | $('.collapseResource', this.el).click(this.callDocs.bind(this, 'collapseOperationsForResource')); |
| 24852 | $('.expandResource', this.el).click(this.callDocs.bind(this, 'expandOperationsForResource')); |
| 24853 | |
| 24854 | return this; |
| 24855 | }, |
| 24856 | |
| 24857 | addOperation: function(operation) { |
| 24858 | |
| 24859 | operation.number = this.number; |
| 24860 | |
| 24861 | // Render an operation and add it to operations li |
| 24862 | var operationView = new SwaggerUi.Views.OperationView({ |
| 24863 | model: operation, |
| 24864 | router: this.router, |
| 24865 | tagName: 'li', |
| 24866 | className: 'endpoint', |
| 24867 | swaggerOptions: this.options.swaggerOptions, |
| 24868 | auths: this.auths |
| 24869 | }); |
| 24870 | |
| 24871 | $('.endpoints', $(this.el)).append(operationView.render().el); |
| 24872 | |
| 24873 | this.number++; |
| 24874 | |
| 24875 | }, |
| 24876 | // Generic Event handler (`Docs` is global) |
| 24877 | |
| 24878 | |
| 24879 | callDocs: function(fnName, e) { |
| 24880 | e.preventDefault(); |
| 24881 | Docs[fnName](e.currentTarget.getAttribute('data-id')); |
| 24882 | } |
| 24883 | }); |
| 24884 | |
| 24885 | 'use strict'; |
| 24886 | |
| 24887 | SwaggerUi.Views.ResponseContentTypeView = Backbone.View.extend({ |
| 24888 | initialize: function(){}, |
| 24889 | |
| 24890 | render: function(){ |
| 24891 | this.model.responseContentTypeId = 'rct' + Math.random(); |
| 24892 | $(this.el).html(Handlebars.templates.response_content_type(this.model)); |
| 24893 | return this; |
| 24894 | } |
| 24895 | }); |
| 24896 | 'use strict'; |
| 24897 | |
| 24898 | SwaggerUi.Views.SignatureView = Backbone.View.extend({ |
| 24899 | events: { |
| 24900 | 'click a.description-link' : 'switchToDescription', |
| 24901 | 'click a.snippet-link' : 'switchToSnippet', |
| 24902 | 'mousedown .snippet_json' : 'jsonSnippetMouseDown', |
| 24903 | 'mousedown .snippet_xml' : 'xmlSnippetMouseDown' |
| 24904 | }, |
| 24905 | |
| 24906 | initialize: function () { |
| 24907 | }, |
| 24908 | |
| 24909 | render: function(){ |
| 24910 | |
| 24911 | $(this.el).html(Handlebars.templates.signature(this.model)); |
| 24912 | |
| 24913 | if (this.model.defaultRendering === 'model') { |
| 24914 | this.switchToDescription(); |
| 24915 | } else { |
| 24916 | this.switchToSnippet(); |
| 24917 | } |
| 24918 | |
| 24919 | return this; |
| 24920 | }, |
| 24921 | |
| 24922 | // handler for show signature |
| 24923 | switchToDescription: function(e){ |
| 24924 | if (e) { e.preventDefault(); } |
| 24925 | |
| 24926 | $('.snippet', $(this.el)).hide(); |
| 24927 | $('.description', $(this.el)).show(); |
| 24928 | $('.description-link', $(this.el)).addClass('selected'); |
| 24929 | $('.snippet-link', $(this.el)).removeClass('selected'); |
| 24930 | }, |
| 24931 | |
| 24932 | // handler for show sample |
| 24933 | switchToSnippet: function(e){ |
| 24934 | if (e) { e.preventDefault(); } |
| 24935 | |
| 24936 | $('.snippet', $(this.el)).show(); |
| 24937 | $('.description', $(this.el)).hide(); |
| 24938 | $('.snippet-link', $(this.el)).addClass('selected'); |
| 24939 | $('.description-link', $(this.el)).removeClass('selected'); |
| 24940 | }, |
| 24941 | |
| 24942 | // handler for snippet to text area |
| 24943 | snippetToTextArea: function(val) { |
| 24944 | var textArea = $('textarea', $(this.el.parentNode.parentNode.parentNode)); |
| 24945 | |
| 24946 | // Fix for bug in IE 10/11 which causes placeholder text to be copied to "value" |
| 24947 | if ($.trim(textArea.val()) === '' || textArea.prop('placeholder') === textArea.val()) { |
| 24948 | textArea.val(val); |
| 24949 | // TODO move this code outside of the view and expose an event instead |
| 24950 | if( this.model.jsonEditor && this.model.jsonEditor.isEnabled()){ |
| 24951 | this.model.jsonEditor.setValue(JSON.parse(this.model.sampleJSON)); |
| 24952 | } |
| 24953 | } |
| 24954 | }, |
| 24955 | |
| 24956 | jsonSnippetMouseDown: function (e) { |
| 24957 | if (this.model.isParam) { |
| 24958 | if (e) { e.preventDefault(); } |
| 24959 | |
| 24960 | this.snippetToTextArea(this.model.sampleJSON); |
| 24961 | } |
| 24962 | }, |
| 24963 | |
| 24964 | xmlSnippetMouseDown: function (e) { |
| 24965 | if (this.model.isParam) { |
| 24966 | if (e) { e.preventDefault(); } |
| 24967 | |
| 24968 | this.snippetToTextArea(this.model.sampleXML); |
| 24969 | } |
| 24970 | } |
| 24971 | }); |
| 24972 | 'use strict'; |
| 24973 | |
| 24974 | SwaggerUi.Views.StatusCodeView = Backbone.View.extend({ |
| 24975 | initialize: function (opts) { |
| 24976 | this.options = opts || {}; |
| 24977 | this.router = this.options.router; |
| 24978 | }, |
| 24979 | |
| 24980 | render: function(){ |
| 24981 | var responseModel, responseModelView; |
| 24982 | var value = this.router.api.models[this.model.responseModel]; |
| 24983 | $(this.el).html(Handlebars.templates.status_code(this.model)); |
| 24984 | |
| 24985 | if (this.router.api.models.hasOwnProperty(this.model.responseModel)) { |
| 24986 | responseModel = { |
| 24987 | sampleJSON: JSON.stringify(SwaggerUi.partials.signature.createJSONSample(value), void 0, 2), |
| 24988 | sampleXML: this.model.isXML ? SwaggerUi.partials.signature.createXMLSample('', this.model.schema, this.router.api.models) : false, |
| 24989 | isParam: false, |
| 24990 | signature: SwaggerUi.partials.signature.getModelSignature(this.model.responseModel, value, this.router.api.models), |
| 24991 | defaultRendering: this.model.defaultRendering |
| 24992 | }; |
| 24993 | } else { |
| 24994 | responseModel = { |
| 24995 | signature: SwaggerUi.partials.signature.getPrimitiveSignature(this.model.schema) |
| 24996 | }; |
| 24997 | } |
| 24998 | |
| 24999 | responseModelView = new SwaggerUi.Views.SignatureView({model: responseModel, tagName: 'div'}); |
| 25000 | $('.model-signature', this.$el).append(responseModelView.render().el); |
| 25001 | return this; |
| 25002 | } |
| 25003 | });}).call(this); |